1!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.zPlayer=e():t.zPlayer=e()}(window,(function(){return function(t){function e(e){for(var n,i,o=e[0],a=e[1],s=0,l=[];s<o.length;s++)i=o[s],r[i]&&l.push(r[i][0]),r[i]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(t[n]=a[n]);for(u&&u(e);l.length;)l.shift()()}var n={},r={0:0};function i(e){if(n[e])return n[e].exports;var r=n[e]={i:e,l:!1,exports:{}};return t[e].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.e=function(t){var e=[],n=r[t];if(0!==n)if(n)e.push(n[2]);else{var o=new Promise((function(e,i){n=r[t]=[e,i]}));e.push(n[2]=o);var a,s=document.getElementsByTagName("head")[0],u=document.createElement("script");u.charset="utf-8",u.timeout=120,i.nc&&u.setAttribute("nonce",i.nc),u.src=function(t){return i.p+""+({}[t]||t)+".min.js"}(t),a=function(e){u.onerror=u.onload=null,clearTimeout(l);var n=r[t];if(0!==n){if(n){var i=e&&("load"===e.type?"missing":e.type),o=e&&e.target&&e.target.src,a=new Error("Loading chunk "+t+" failed.\n("+i+": "+o+")");a.type=i,a.request=o,n[1](a)}r[t]=void 0}};var l=setTimeout((function(){a({type:"timeout",target:u})}),12e4);u.onerror=u.onload=a,s.appendChild(u)}return Promise.all(e)},i.m=t,i.c=n,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(n,r,function(e){return t[e]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="//static.znews.vn/zplayer/releases/v1.1.6/",i.oe=function(t){throw console.error(t),t};var o=window.webpackJsonpzPlayer=window.webpackJsonpzPlayer||[],a=o.push.bind(o);o.push=e,o=o.slice();for(var s=0;s<o.length;s++)e(o[s]);var u=a;return i(i.s=32)}([function(t,e,n){var r;"undefined"!=typeof window&&(r=function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s="./src/hls.ts")}({
vendor: 2,794 bytes, line 1
1"./node_modules/eventemitter3/index.js":function(t,e,n){"use strict";var r=Object.prototype.hasOwnProperty,i="~";function o(){}function a(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function s(t,e,n,r,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new a(n,r||t,o),u=i?i+e:e;return t._events[u]?t._events[u].fn?t._events[u]=[t._events[u],s]:t._events[u].push(s):(t._events[u]=s,t._eventsCount++),t}function u(t,e){0==--t._eventsCount?t._events=new o:delete t._events[e]}function l(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(i=!1)),l.prototype.eventNames=function(){var t,e,n=[];if(0===this._eventsCount)return n;for(e in t=this._events)r.call(t,e)&&n.push(i?e.slice(1):e);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},l.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var r=0,o=n.length,a=new Array(o);r<o;r++)a[r]=n[r].fn;return a},l.prototype.listenerCount=function(t){var e=i?i+t:t,n=this._events[e];return n?n.fn?1:n.length:0},l.prototype.emit=function(t,e,n,r,o,a){var s=i?i+t:t;if(!this._events[s])return!1;var u,l,c=this._events[s],f=arguments.length;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),f){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,n),!0;case 4:return c.fn.call(c.context,e,n,r),!0;case 5:return c.fn.call(c.context,e,n,r,o),!0;case 6:return c.fn.call(c.context,e,n,r,o,a),!0}for(l=1,u=new Array(f-1);l<f;l++)u[l-1]=arguments[l];c.fn.apply(c.context,u)}else{var d,h=c.length;for(l=0;l<h;l++)switch(c[l].once&&this.removeListener(t,c[l].fn,void 0,!0),f){case 1:c[l].fn.call(c[l].context);break;case 2:c[l].fn.call(c[l].context,e);break;case 3:c[l].fn.call(c[l].context,e,n);break;case 4:c[l].fn.call(c[l].context,e,n,r);break;default:if(!u)for(d=1,u=new Array(f-1);d<f;d++)u[d-1]=arguments[d];c[l].fn.apply(c[l].context,u)}}return!0},l.prototype.on=function(t,e,n){return s(this,t,e,n,!1)},l.prototype.once=function(t,e,n){return s(this,t,e,n,!0)},l.prototype.removeListener=function(t,e,n,r){var o=i?i+t:t;if(!this._events[o])return this;if(!e)return u(this,o),this;var a=this._events[o];if(a.fn)a.fn!==e||r&&!a.once||n&&a.context!==n||u(this,o);else{for(var s=0,l=[],c=a.length;s<c;s++)(a[s].fn!==e||r&&!a[s].once||n&&a[s].context!==n)&&l.push(a[s]);l.length?this._events[o]=1===l.length?l[0]:l:u(this,o)}return this},l.prototype.removeAllListeners=function(t){var e;return t?(e=i?i+t:t,this._events[e]&&u(this,e)):(this._events=new o,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=i,l.EventEmitter=l,t.exports=l},
vendor: 1,712 bytes, line 1
1"./node_modules/url-toolkit/src/url-toolkit.js":function(t,e,n){var r,i,o,a,s;r=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,i=/^([^\/?#]*)([^]*)$/,o=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,s={buildAbsoluteURL:function(t,e,n){if(n=n||{},t=t.trim(),!(e=e.trim())){if(!n.alwaysNormalize)return t;var r=s.parseURL(t);if(!r)throw new Error("Error trying to parse base URL.");return r.path=s.normalizePath(r.path),s.buildURLFromParts(r)}var o=s.parseURL(e);if(!o)throw new Error("Error trying to parse relative URL.");if(o.scheme)return n.alwaysNormalize?(o.path=s.normalizePath(o.path),s.buildURLFromParts(o)):e;var a=s.parseURL(t);if(!a)throw new Error("Error trying to parse base URL.");if(!a.netLoc&&a.path&&"/"!==a.path[0]){var u=i.exec(a.path);a.netLoc=u[1],a.path=u[2]}a.netLoc&&!a.path&&(a.path="/");var l={scheme:a.scheme,netLoc:o.netLoc,path:null,params:o.params,query:o.query,fragment:o.fragment};if(!o.netLoc&&(l.netLoc=a.netLoc,"/"!==o.path[0]))if(o.path){var c=a.path,f=c.substring(0,c.lastIndexOf("/")+1)+o.path;l.path=s.normalizePath(f)}else l.path=a.path,o.params||(l.params=a.params,o.query||(l.query=a.query));return null===l.path&&(l.path=n.alwaysNormalize?s.normalizePath(o.path):o.path),s.buildURLFromParts(l)},parseURL:function(t){var e=r.exec(t);return e?{scheme:e[1]||"",netLoc:e[2]||"",path:e[3]||"",params:e[4]||"",query:e[5]||"",fragment:e[6]||""}:null},normalizePath:function(t){for(t=t.split("").reverse().join("").replace(o,"");t.length!==(t=t.replace(a,"")).length;);return t.split("").reverse().join("")},buildURLFromParts:function(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}},t.exports=s},
vendor: 2,716 bytes, line 1
1"./node_modules/webworkify-webpack/index.js":function(t,e,n){function r(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.i=function(t){return t},n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/",n.oe=function(t){throw console.error(t),t};var r=n(n.s=ENTRY_MODULE);return r.default||r}function i(t){return(t+"").replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}function o(t,e,r){var o={};o[r]=[];var a=e.toString(),s=a.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);if(!s)return o;for(var u,l=s[1],c=new RegExp("(\\\\n|\\W)"+i(l)+"\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)","g");u=c.exec(a);)"dll-reference"!==u[3]&&o[r].push(u[3]);for(c=new RegExp("\\("+i(l)+'\\("(dll-reference\\s([\\.|\\-|\\+|\\w|/|@]+))"\\)\\)\\(\\s*(/\\*.*?\\*/)?\\s*.*?([\\.|\\-|\\+|\\w|/|@]+).*?\\)',"g");u=c.exec(a);)t[u[2]]||(o[r].push(u[1]),t[u[2]]=n(u[1]).m),o[u[2]]=o[u[2]]||[],o[u[2]].push(u[4]);for(var f,d=Object.keys(o),h=0;h<d.length;h++)for(var p=0;p<o[d[h]].length;p++)f=o[d[h]][p],isNaN(1*f)||(o[d[h]][p]=1*o[d[h]][p]);return o}function a(t){return Object.keys(t).reduce((function(e,n){return e||t[n].length>0}),!1)}t.exports=function(t,e){e=e||{};var i={main:n.m},s=e.all?{main:Object.keys(i.main)}:function(t,e){for(var n={main:[e]},r={main:[]},i={main:{}};a(n);)for(var s=Object.keys(n),u=0;u<s.length;u++){var l=s[u],c=n[l].pop();if(i[l]=i[l]||{},!i[l][c]&&t[l][c]){i[l][c]=!0,r[l]=r[l]||[],r[l].push(c);for(var f=o(t,t[l][c],l),d=Object.keys(f),h=0;h<d.length;h++)n[d[h]]=n[d[h]]||[],n[d[h]]=n[d[h]].concat(f[d[h]])}}return r}(i,t),u="";Object.keys(s).filter((function(t){return"main"!==t})).forEach((function(t){for(var e=0;s[t][e];)e++;s[t].push(e),i[t][e]="(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })",u=u+"var "+t+" = ("+r.toString().replace("ENTRY_MODULE",JSON.stringify(e))+")({"+s[t].map((function(e){return JSON.stringify(e)+": "+i[t][e].toString()})).join(",")+"});\n"})),u=u+"new (("+r.toString().replace("ENTRY_MODULE",JSON.stringify(t))+")({"+s.main.map((function(t){return JSON.stringify(t)+": "+i.main[t].toString()})).join(",")+"}))(self);";var l=new window.Blob([u],{type:"text/javascript"});if(e.bare)return l;var c=(window.URL||window.webkitURL||window.mozURL||window.msURL).createObjectURL(l),f=new window.Worker(c);return f.objectURL=c,f}},
vendor: 5,103 bytes, line 1
1"./src/config.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"hlsDefaultConfig",(function(){return k})),n.d(e,"mergeConfig",(function(){return A})),n.d(e,"enableStreamingMode",(function(){return S}));var r=n("./src/controller/abr-controller.ts"),i=n("./src/controller/audio-stream-controller.ts"),o=n("./src/controller/audio-track-controller.ts"),a=n("./src/controller/subtitle-stream-controller.ts"),s=n("./src/controller/subtitle-track-controller.ts"),u=n("./src/controller/buffer-controller.ts"),l=n("./src/controller/timeline-controller.ts"),c=n("./src/controller/cap-level-controller.ts"),f=n("./src/controller/fps-controller.ts"),d=n("./src/controller/eme-controller.ts"),h=n("./src/controller/cmcd-controller.ts"),p=n("./src/utils/xhr-loader.ts"),y=n("./src/utils/fetch-loader.ts"),v=n("./src/utils/cues.ts"),g=n("./src/utils/mediakeys-helper.ts"),m=n("./src/utils/logger.ts");function b(){return(b=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function E(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function _(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?E(Object(n),!0).forEach((function(e){T(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):E(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function T(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var k=_(_({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:p.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:r.default,bufferController:u.default,capLevelController:c.default,fpsController:f.default,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystemOptions:{},requestMediaKeySystemAccessFunc:g.requestMediaKeySystemAccess,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0},{cueHandler:v.default,enableCEA708Captions:!0,enableWebVTT:!0,enableIMSC1:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:a.SubtitleStreamController,subtitleTrackController:s.default,timelineController:l.TimelineController,audioStreamController:i.default,audioTrackController:o.default,emeController:d.default,cmcdController:h.default});function A(t,e){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==e.liveMaxLatencyDurationCount&&(void 0===e.liveSyncDurationCount||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==e.liveMaxLatencyDuration&&(void 0===e.liveSyncDuration||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');return b({},t,e)}function S(t){var e=t.loader;e!==y.default&&e!==p.default?(m.logger.log("[config]: Custom loader detected, cannot enable progressive streaming"),t.progressive=!1):Object(y.fetchSupported)()&&(t.loader=y
vendor: 164 bytes, line 1
1.default,t.progressive=!0,t.enableSoftwareAES=!0,m.logger.log("[config]: Progressive streaming enabled, using FetchLoader"))}},"./src/controller/abr-controller.ts":
vendor: 67,880 bytes, line 1
1function(t,e,n){"use strict";n.r(e);var r=n("./src/polyfills/number.ts"),i=n("./src/utils/ewma-bandwidth-estimator.ts"),o=n("./src/events.ts"),a=n("./src/utils/buffer-helper.ts"),s=n("./src/errors.ts"),u=n("./src/types/loader.ts"),l=n("./src/utils/logger.ts");function c(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var f=function(){function t(t){this.hls=void 0,this.lastLoadedFragLevel=0,this._nextAutoLevel=-1,this.timer=void 0,this.onCheck=this._abandonRulesCheck.bind(this),this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this.hls=t;var e=t.config;this.bwEstimator=new i.default(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate),this.registerListeners()}var e,n,f,d=t.prototype;return d.registerListeners=function(){var t=this.hls;t.on(o.Events.FRAG_LOADING,this.onFragLoading,this),t.on(o.Events.FRAG_LOADED,this.onFragLoaded,this),t.on(o.Events.FRAG_BUFFERED,this.onFragBuffered,this),t.on(o.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.on(o.Events.ERROR,this.onError,this)},d.unregisterListeners=function(){var t=this.hls;t.off(o.Events.FRAG_LOADING,this.onFragLoading,this),t.off(o.Events.FRAG_LOADED,this.onFragLoaded,this),t.off(o.Events.FRAG_BUFFERED,this.onFragBuffered,this),t.off(o.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.off(o.Events.ERROR,this.onError,this)},d.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this.onCheck=null,this.fragCurrent=this.partCurrent=null},d.onFragLoading=function(t,e){var n,r=e.frag;r.type===u.PlaylistLevelType.MAIN&&(this.timer||(this.fragCurrent=r,this.partCurrent=null!=(n=e.part)?n:null,this.timer=self.setInterval(this.onCheck,100)))},d.onLevelLoaded=function(t,e){var n=this.hls.config;e.details.live?this.bwEstimator.update(n.abrEwmaSlowLive,n.abrEwmaFastLive):this.bwEstimator.update(n.abrEwmaSlowVoD,n.abrEwmaFastVoD)},d._abandonRulesCheck=function(){var t=this.fragCurrent,e=this.partCurrent,n=this.hls,i=n.autoLevelEnabled,s=n.config,u=n.media;if(t&&u){var c=e?e.stats:t.stats,f=e?e.duration:t.duration;if(c.aborted)return l.logger.warn("frag loader destroy or aborted, disarm abandonRules"),this.clearTimer(),void(this._nextAutoLevel=-1);if(i&&!u.paused&&u.playbackRate&&u.readyState){var d=performance.now()-c.loading.start,h=Math.abs(u.playbackRate);if(!(d<=500*f/h)){var p=n.levels,y=n.minAutoLevel,v=p[t.level],g=c.total||Math.max(c.loaded,Math.round(f*v.maxBitrate/8)),m=Math.max(1,c.bwEstimate?c.bwEstimate/8:1e3*c.loaded/d),b=(g-c.loaded)/m,E=u.currentTime,_=(a.BufferHelper.bufferInfo(u,E,s.maxBufferHole).end-E)/h;if(!(_>=2*f/h||b<=_)){var T,k=Number.POSITIVE_INFINITY;for(T=t.level-1;T>y&&!((k=f*p[T].maxBitrate/(6.4*m))<_);T--);if(!(k>=b)){var A=this.bwEstimator.getEstimate();l.logger.warn("Fragment "+t.sn+(e?" part "+e.index:"")+" of level "+t.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+T+"\n Current BW estimate: "+(Object(r.isFiniteNumber)(A)?(A/1024).toFixed(3):"Unknown")+" Kb/s\n Estimated load time for current fragment: "+b.toFixed(3)+" s\n Estimated load time for the next fragment: "+k.toFixed(3)+" s\n Time to underbuffer: "+_.toFixed(3)+" s"),n.nextLoadLevel=T,this.bwEstimator.sample(d,c.loaded),this.clearTimer(),t.loader&&(this.fragCurrent=this.partCurrent=null,t.loader.abort()),n.trigger(o.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:e,stats:c})}}}}}},d.onFragLoaded=function(t,e){var n=e.frag,i=e.part;if(n.type===u.PlaylistLevelType.MAIN&&Object(r.isFiniteNumber)(n.sn)){var a=i?i.stats:n.stats,s=i?i.duration:n.duration;if(this.clearTimer(),this.lastLoadedFragLevel=n.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var l=this.hls.levels[n.level],c=(l.loaded?l.loaded.bytes:0)+a.loaded,f=(l.loaded?l.loaded.duration:0)+s;l.loaded={bytes:c,duration:f},l.realBitrate=Math.round(8*c/f)}if(n.bitrateTest){var d={stats:a,frag:n,part:i,id:n.type};this.onFragBuffered(o.Events.FRAG_BUFFERED,d),n.bitrateTest=!1}}},d.onFragBuffered=function(t,e){var n=e.frag,r=e.part,i=r?r.stats:n.stats;if(!i.aborted&&n.type===u.PlaylistLevelType.MAIN&&"initSegment"!==n.sn){var o=i.parsing.end-i.loading.start;this.bwEstimator.sample(o,i.loaded),i.bwEstimate=this.bwEstimator.getEstimate(),n.bitrateTest?this.bitrateTestDelay=o/1e3:this.bitrateTestDelay=0}},d.onError=function(t,e){switch(e.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer()}},d.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},d.getNextABRAutoLevel=function(){var t=this.fragCurrent,e=this.partCurrent,n=this.hls,r=n.maxAutoLevel,i=n.config,o=n.minAutoLevel,s=n.media,u=e?e.duration:t?t.duration:0,c=s?s.currentTime:0,f=s&&0!==s.playbackRate?Math.abs(s.playbackRate):1,d=this.bwEstimator?this.bwEstimator.getEstimate():i.abrEwmaDefaultEstimate,h=(a.BufferHelper.bufferInfo(s,c,i.maxBufferHole).end-c)/f,p=this.findBestLevel(d,o,r,h,i.abrBandWidthFactor,i.abrBandWidthUpFactor);if(p>=0)return p;l.logger.trace((h?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var y=u?Math.min(u,i.maxStarvationDelay):i.maxStarvationDelay,v=i.abrBandWidthFactor,g=i.abrBandWidthUpFactor;if(!h){var m=this.bitrateTestDelay;m&&(y=(u?Math.min(u,i.maxLoadingDelay):i.maxLoadingDelay)-m,l.logger.trace("bitrate test took "+Math.round(1e3*m)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*y)+" ms"),v=g=1)}return p=this.findBestLevel(d,o,r,h+y,v,g),Math.max(p,0)},d.findBestLevel=function(t,e,n,r,i,o){for(var a,s=this.fragCurrent,u=this.partCurrent,c=this.lastLoadedFragLevel,f=this.hls.levels,d=f[c],h=!(null==d||null===(a=d.details)||void 0===a||!a.live),p=null==d?void 0:d.codecSet,y=u?u.duration:s?s.duration:0,v=n;v>=e;v--){var g=f[v];if(g&&(!p||g.codecSet===p)){var m=g.details,b=(u?null==m?void 0:m.partTarget:null==m?void 0:m.averagetargetduration)||y,E=void 0;E=v<=c?i*t:o*t;var _=f[v].maxBitrate,T=_*b/E;if(l.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+v+"/"+Math.round(E)+"/"+_+"/"+b+"/"+r+"/"+T),E>_&&(!T||h&&!this.bitrateTestDelay||T<r))return v}}return-1},e=t,(n=[{key:"nextAutoLevel",get:function(){var t=this._nextAutoLevel,e=this.bwEstimator;if(!(-1===t||e&&e.canEstimate()))return t;var n=this.getNextABRAutoLevel();return-1!==t&&(n=Math.min(t,n)),n},set:function(t){this._nextAutoLevel=t}}])&&c(e.prototype,n),f&&c(e,f),t}();e.default=f},"./src/controller/audio-stream-controller.ts":function(t,e,n){"use strict";n.r(e);var r=n("./src/polyfills/number.ts"),i=n("./src/controller/base-stream-controller.ts"),o=n("./src/events.ts"),a=n("./src/utils/buffer-helper.ts"),s=n("./src/controller/fragment-tracker.ts"),u=n("./src/types/level.ts"),l=n("./src/types/loader.ts"),c=n("./src/loader/fragment.ts"),f=n("./src/demux/chunk-cache.ts"),d=n("./src/demux/transmuxer-interface.ts"),h=n("./src/types/transmuxer.ts"),p=n("./src/controller/fragment-finders.ts"),y=n("./src/utils/discontinuities.ts"),v=n("./src/errors.ts"),g=n("./src/utils/logger.ts");function m(){return(m=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function b(t,e){return(b=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var E=function(t){var e,n;function E(e,n){var r;return(r=t.call(this,e,n,"[audio-stream-controller]")||this).videoBuffer=null,r.videoTrackCC=-1,r.waitingVideoCC=-1,r.audioSwitch=!1,r.trackId=-1,r.waitingData=null,r.mainDetails=null,r.bufferFlushed=!1,r._registerListeners(),r}n=t,(e=E).prototype=Object.create(n.prototype),e.prototype.constructor=e,b(e,n);var _=E.prototype;return _.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},_._registerListeners=function(){var t=this.hls;t.on(o.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(o.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(o.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(o.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.on(o.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.on(o.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(o.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(o.Events.ERROR,this.onError,this),t.on(o.Events.BUFFER_RESET,this.onBufferReset,this),t.on(o.Events.BUFFER_CREATED,this.onBufferCreated,this),t.on(o.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(o.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(o.Events.FRAG_BUFFERED,this.onFragBuffered,this)},_._unregisterListeners=function(){var t=this.hls;t.off(o.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(o.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(o.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(o.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.off(o.Events.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.off(o.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(o.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(o.Events.ERROR,this.onError,this),t.off(o.Events.BUFFER_RESET,this.onBufferReset,this),t.off(o.Events.BUFFER_CREATED,this.onBufferCreated,this),t.off(o.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(o.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(o.Events.FRAG_BUFFERED,this.onFragBuffered,this)},_.onInitPtsFound=function(t,e){var n=e.frag,r=e.id,o=e.initPTS;if("main"===r){var a=n.cc;this.initPTS[n.cc]=o,this.log("InitPTS for cc: "+a+" found from main: "+o),this.videoTrackCC=a,this.state===i.State.WAITING_INIT_PTS&&this.tick()}},_.startLoad=function(t){if(!this.levels)return this.startPosition=t,void(this.state=i.State.STOPPED);var e=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),this.fragLoadError=0,e>0&&-1===t?(this.log("Override startPosition with lastCurrentTime @"+e.toFixed(3)),this.state=i.State.IDLE):(this.loadedmetadata=!1,this.state=i.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()},_.doTick=function(){switch(this.state){case i.State.IDLE:this.doTickIdle();break;case i.State.WAITING_TRACK:var e,n=this.levels,r=this.trackId,o=null==n||null===(e=n[r])||void 0===e?void 0:e.details;if(o){if(this.waitForCdnTuneIn(o))break;this.state=i.State.WAITING_INIT_PTS}break;case i.State.FRAG_LOADING_WAITING_RETRY:var s,u=performance.now(),l=this.retryDate;(!l||u>=l||null!==(s=this.media)&&void 0!==s&&s.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=i.State.IDLE);break;case i.State.WAITING_INIT_PTS:var c=this.waitingData;if(c){var f=c.frag,d=c.part,h=c.cache,y=c.complete;if(void 0!==this.initPTS[f.cc]){this.waitingData=null,this.waitingVideoCC=-1,this.state=i.State.FRAG_LOADING;var v={frag:f,part:d,payload:h.flush(),networkDetails:null};this._handleFragmentLoadProgress(v),y&&t.prototype._handleFragmentLoadComplete.call(this,v)}else if(this.videoTrackCC!==this.waitingVideoCC)g.logger.log("Waiting fragment cc ("+f.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var m=this.getLoadPosition(),b=a.BufferHelper.bufferInfo(this.mediaBuffer,m,this.config.maxBufferHole);Object(p.fragmentWithinToleranceTest)(b.end,this.config.maxFragLookUpTolerance,f)<0&&(g.logger.log("Waiting fragment cc ("+f.cc+") @ "+f.start+" cancelled because another fragment at "+b.end+" is needed"),this.clearWaitingFragment())}}else this.state=i.State.IDLE}this.onTickEnd()},_.clearWaitingFragment=function(){var t=this.waitingData;t&&(this.fragmentTracker.removeFragment(t.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=i.State.IDLE)},_.onTickEnd=function(){var t=this.media;if(t&&t.readyState){var e=(this.mediaBuffer?this.mediaBuffer:t).buffered;!this.loadedmetadata&&e.length&&(this.loadedmetadata=!0),this.lastCurrentTime=t.currentTime}},_.doTickIdle=function(){var t,e,n=this.hls,r=this.levels,a=this.media,s=this.trackId,u=n.config;if(r&&r[s]&&(a||!this.startFragRequested&&u.startFragPrefetch)){var f=r[s].details;if(!f||f.live&&this.levelLastLoaded!==s||this.waitForCdnTuneIn(f))this.state=i.State.WAITING_TRACK;else{this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,c.ElementaryStreamTypes.AUDIO,l.PlaylistLevelType.AUDIO));var d=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,l.PlaylistLevelType.AUDIO);if(null!==d){var h=d.len,p=this.getMaxBufferLength(),y=this.audioSwitch;if(!(h>=p)||y){if(!y&&this._streamEnded(d,f))return n.trigger(o.Events.BUFFER_EOS,{type:"audio"}),void(this.state=i.State.ENDED);var v=f.fragments[0].start,g=d.end;if(y){var m=this.getLoadPosition();g=m,f.PTSKnown&&m<v&&(d.end>v||d.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),a.currentTime=v+.05)}var b=this.getNextFragment(g,f);b?"identity"!==(null===(t=b.decryptdata)||void 0===t?void 0:t.keyFormat)||null!==(e=b.decryptdata)&&void 0!==e&&e.key?this.loadFragment(b,f,g):this.loadKey(b,f):this.bufferFlushed=!0}}}}},_.getMaxBufferLength=function(){var e=t.prototype.getMaxBufferLength.call(this),n=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,l.PlaylistLevelType.MAIN);return null===n?e:Math.max(e,n.len)},_.onMediaDetaching=function(){this.videoBuffer=null,t.prototype.onMediaDetaching.call(this)},_.onAudioTracksUpdated=function(t,e){var n=e.audioTracks;this.resetTransmuxer(),this.levels=n.map((function(t){return new u.Level(t)}))},_.onAudioTrackSwitching=function(t,e){var n=!!e.url;this.trackId=e.id;var r=this.fragCurrent;null!=r&&r.loader&&r.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),n?this.setInterval(100):this.resetTransmuxer(),n?(this.audioSwitch=!0,this.state=i.State.IDLE):this.state=i.State.STOPPED,this.tick()},_.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},_.onLevelLoaded=function(t,e){this.mainDetails=e.details},_.onAudioTrackLoaded=function(t,e){var n,r=this.levels,o=e.details,a=e.id;if(r){this.log("Track "+a+" loaded ["+o.startSN+","+o.endSN+"],duration:"+o.totalduration);var s=r[a],u=0;if(o.live||null!==(n=s.details)&&void 0!==n&&n.live){var l=this.mainDetails;if(o.fragments[0]||(o.deltaUpdateFailed=!0),o.deltaUpdateFailed||!l)return;!s.details&&o.hasProgramDateTime&&l.hasProgramDateTime?(Object(y.alignMediaPlaylistByPDT)(o,l),u=o.fragments[0].start):u=this.alignPlaylists(o,s.details)}s.details=o,this.levelLastLoaded=a,this.startFragRequested||!this.mainDetails&&o.live||this.setStartPosition(s.details,u),this.state!==i.State.WAITING_TRACK||this.waitForCdnTuneIn(o)||(this.state=i.State.IDLE),this.tick()}else this.warn("Audio tracks were reset while loading level "+a)},_._handleFragmentLoadProgress=function(t){var e,n=t.frag,r=t.part,o=t.payload,a=this.config,s=this.trackId,u=this.levels;if(u){var c=u[s];console.assert(c,"Audio track is defined on fragment load progress");var p=c.details;console.assert(p,"Audio track details are defined on fragment load progress");var y=a.defaultAudioCodec||c.audioCodec||"mp4a.40.2",v=this.transmuxer;v||(v=this.transmuxer=new d.default(this.hls,l.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var m=this.initPTS[n.cc],b=null===(e=n.initSegment)||void 0===e?void 0:e.data;if(void 0!==m){var E=r?r.index:-1,_=-1!==E,T=new h.ChunkMetadata(n.level,n.sn,n.stats.chunkCount,o.byteLength,E,_);v.push(o,b,y,"",n,r,p.totalduration,!1,T,m)}else g.logger.log("Unknown video PTS for cc "+n.cc+", waiting for video PTS before demuxing audio frag "+n.sn+" of ["+p.startSN+" ,"+p.endSN+"],track "+s),(this.waitingData=this.waitingData||{frag:n,part:r,cache:new f.default,complete:!1}).cache.push(new Uint8Array(o)),this.waitingVideoCC=this.videoTrackCC,this.state=i.State.WAITING_INIT_PTS}else this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+n.sn+" of level "+n.level+" will not be buffered")},_._handleFragmentLoadComplete=function(e){this.waitingData?this.waitingData.complete=!0:t.prototype._handleFragmentLoadComplete.call(this,e)},_.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},_.onBufferCreated=function(t,e){var n=e.tracks.audio;n&&(this.mediaBuffer=n.buffer),e.tracks.video&&(this.videoBuffer=e.tracks.video.buffer)},_.onFragBuffered=function(t,e){var n=e.frag,r=e.part;n.type===l.PlaylistLevelType.AUDIO&&(this.fragContextChanged(n)?this.warn("Fragment "+n.sn+(r?" p: "+r.index:"")+" of level "+n.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch):("initSegment"!==n.sn&&(this.fragPrevious=n,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(o.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(n,r)))},_.onError=function(e,n){switch(n.details){case v.ErrorDetails.FRAG_LOAD_ERROR:case v.ErrorDetails.FRAG_LOAD_TIMEOUT:case v.ErrorDetails.KEY_LOAD_ERROR:case v.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(l.PlaylistLevelType.AUDIO,n);break;case v.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case v.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==i.State.ERROR&&this.state!==i.State.STOPPED&&(this.state=n.fatal?i.State.ERROR:i.State.IDLE,this.warn(n.details+" while loading frag, switching to "+this.state+" state"));break;case v.ErrorDetails.BUFFER_FULL_ERROR:if("audio"===n.parent&&(this.state===i.State.PARSING||this.state===i.State.PARSED)){var r=!0,o=this.getFwdBufferInfo(this.mediaBuffer,l.PlaylistLevelType.AUDIO);o&&o.len>.5&&(r=!this.reduceMaxBufferLength(o.len)),r&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,t.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}}},_.onBufferFlushed=function(t,e){e.type===c.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},_._handleTransmuxComplete=function(t){var e,n="audio",r=this.hls,a=t.remuxResult,s=t.chunkMeta,u=this.getCurrentContext(s);if(!u)return this.warn("The loading context changed while buffering fragment "+s.sn+" of level "+s.level+". This chunk will not be buffered."),void this.resetLiveStartWhenNotLoaded(s.level);var l=u.frag,f=u.part,d=a.audio,h=a.text,p=a.id3,y=a.initSegment;if(!this.fragContextChanged(l)){if(this.state=i.State.PARSING,this.audioSwitch&&d&&this.completeAudioSwitch(),null!=y&&y.tracks&&(this._bufferInitSegment(y.tracks,l,s),r.trigger(o.Events.FRAG_PARSING_INIT_SEGMENT,{frag:l,id:n,tracks:y.tracks})),d){var v=d.startPTS,g=d.endPTS,b=d.startDTS,E=d.endDTS;f&&(f.elementaryStreams[c.ElementaryStreamTypes.AUDIO]={startPTS:v,endPTS:g,startDTS:b,endDTS:E}),l.setElementaryStreamInfo(c.ElementaryStreamTypes.AUDIO,v,g,b,E),this.bufferFragmentData(d,l,f,s)}if(null!=p&&null!==(e=p.samples)&&void 0!==e&&e.length){var _=m({frag:l,id:n},p);r.trigger(o.Events.FRAG_PARSING_METADATA,_)}if(h){var T=m({frag:l,id:n},h);r.trigger(o.Events.FRAG_PARSING_USERDATA,T)}}},_._bufferInitSegment=function(t,e,n){if(this.state===i.State.PARSING){t.video&&delete t.video;var r=t.audio;if(r){r.levelCodec=r.codec,r.id="audio",this.log("Init audio buffer, container:"+r.container+", codecs[parsed]=["+r.codec+"]"),this.hls.trigger(o.Events.BUFFER_CODECS,t);var a=r.initSegment;if(null!=a&&a.byteLength){var s={type:"audio",frag:e,part:null,chunkMeta:n,parent:e.type,data:a};this.hls.trigger(o.Events.BUFFER_APPENDING,s)}this.tick()}}},_.loadFragment=function(e,n,o){var a=this.fragmentTracker.getState(e);this.fragCurrent=e,(this.audioSwitch||a===s.FragmentState.NOT_LOADED||a===s.FragmentState.PARTIAL)&&("initSegment"===e.sn?this._loadInitSegment(e):n.live&&!Object(r.isFiniteNumber)(this.initPTS[e.cc])?(this.log("Waiting for video PTS in continuity counter "+e.cc+" of live stream before loading audio fragment "+e.sn+" of level "+this.trackId),this.state=i.State.WAITING_INIT_PTS):(this.startFragRequested=!0,t.prototype.loadFragment.call(this,e,n,o)))},_.completeAudioSwitch=function(){var e=this.hls,n=this.media,r=this.trackId;n&&(this.log("Switching audio track : flushing all audio"),t.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,e.trigger(o.Events.AUDIO_TRACK_SWITCHED,{id:r})},E}(i.default);e.default=E},"./src/controller/audio-track-controller.ts":function(t,e,n){"use strict";n.r(e);var r=n("./src/events.ts"),i=n("./src/errors.ts"),o=n("./src/controller/base-playlist-controller.ts"),a=n("./src/types/loader.ts");function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var l=function(t){var e,n;function o(e){var n;return(n=t.call(this,e,"[audio-track-controller]")||this).tracks=[],n.groupId=null,n.tracksInGroup=[],n.trackId=-1,n.trackName="",n.selectDefaultTrack=!0,n.registerListeners(),n}n=t,(e=o).prototype=Object.create(n.prototype),e.prototype.constructor=e,u(e,n);var l,c,f,d=o.prototype;return d.registerListeners=function(){var t=this.hls;t.on(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(r.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.on(r.Events.LEVEL_LOADING,this.onLevelLoading,this),t.on(r.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(r.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(r.Events.ERROR,this.onError,this)},d.unregisterListeners=function(){var t=this.hls;t.off(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(r.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.off(r.Events.LEVEL_LOADING,this.onLevelLoading,this),t.off(r.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(r.Events.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(r.Events.ERROR,this.onError,this)},d.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,t.prototype.destroy.call(this)},d.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.trackName="",this.selectDefaultTrack=!0},d.onManifestParsed=function(t,e){this.tracks=e.audioTracks||[]},d.onAudioTrackLoaded=function(t,e){var n=e.id,r=e.details,i=this.tracksInGroup[n];if(i){var o=i.details;i.details=e.details,this.log("audioTrack "+n+" loaded ["+r.startSN+"-"+r.endSN+"]"),n===this.trackId&&(this.retryCount=0,this.playlistLoaded(n,e,o))}else this.warn("Invalid audio track id "+n)},d.onLevelLoading=function(t,e){this.switchLevel(e.level)},d.onLevelSwitching=function(t,e){this.switchLevel(e.level)},d.switchLevel=function(t){var e=this.hls.levels[t];if(null!=e&&e.audioGroupIds){var n=e.audioGroupIds[e.urlId];if(this.groupId!==n){this.groupId=n;var i=this.tracks.filter((function(t){return!n||t.groupId===n}));this.selectDefaultTrack&&!i.some((function(t){return t.default}))&&(this.selectDefaultTrack=!1),this.tracksInGroup=i;var o={audioTracks:i};this.log("Updating audio tracks, "+i.length+' track(s) found in "'+n+'" group-id'),this.hls.trigger(r.Events.AUDIO_TRACKS_UPDATED,o),this.selectInitialTrack()}}},d.onError=function(e,n){t.prototype.onError.call(this,e,n),!n.fatal&&n.context&&n.context.type===a.PlaylistContextType.AUDIO_TRACK&&n.context.id===this.trackId&&n.context.groupId===this.groupId&&this.retryLoadingOrFail(n)},d.setAudioTrack=function(t){var e=this.tracksInGroup;if(t<0||t>=e.length)this.warn("Invalid id passed to audio-track controller");else{this.clearTimer();var n=e[this.trackId];this.log("Now switching to audio-track index "+t);var i=e[t],o=i.id,a=i.groupId,s=void 0===a?"":a,u=i.name,l=i.type,c=i.url;if(this.trackId=t,this.trackName=u,this.selectDefaultTrack=!1,this.hls.trigger(r.Events.AUDIO_TRACK_SWITCHING,{id:o,groupId:s,name:u,type:l,url:c}),!i.details||i.details.live){var f=this.switchParams(i.url,null==n?void 0:n.details);this.loadPlaylist(f)}}},d.selectInitialTrack=function(){var t=this.tracksInGroup;console.assert(t.length,"Initial audio track should be selected when tracks are known");var e=this.trackName,n=this.findTrackId(e)||this.findTrackId();-1!==n?this.setAudioTrack(n):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(r.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},d.findTrackId=function(t){for(var e=this.tracksInGroup,n=0;n<e.length;n++){var r=e[n];if((!this.selectDefaultTrack||r.default)&&(!t||t===r.name))return r.id}return-1},d.loadPlaylist=function(t){var e=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(e)){var n=e.id,i=e.groupId,o=e.url;if(t)try{o=t.addDirectives(o)}catch(t){this.warn("Could not construct new URL with HLS Delivery Directives: "+t)}this.log("loading audio-track playlist for id: "+n),this.clearTimer(),this.hls.trigger(r.Events.AUDIO_TRACK_LOADING,{url:o,id:n,groupId:i,deliveryDirectives:t||null})}},l=o,(c=[{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(t){this.selectDefaultTrack=!1,this.setAudioTrack(t)}}])&&s(l.prototype,c),f&&s(l,f),o}(o.default);e.default=l},"./src/controller/base-playlist-controller.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return u}));var r=n("./src/polyfills/number.ts"),i=n("./src/types/level.ts"),o=n("./src/controller/level-helper.ts"),a=n("./src/utils/logger.ts"),s=n("./src/errors.ts"),u=function(){function t(t,e){this.hls=void 0,this.timer=-1,this.canLoad=!1,this.retryCount=0,this.log=void 0,this.warn=void 0,this.log=a.logger.log.bind(a.logger,e+":"),this.warn=a.logger.warn.bind(a.logger,e+":"),this.hls=t}var e=t.prototype;return e.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},e.onError=function(t,e){e.fatal&&e.type===s.ErrorTypes.NETWORK_ERROR&&this.clearTimer()},e.clearTimer=function(){clearTimeout(this.timer),this.timer=-1},e.startLoad=function(){this.canLoad=!0,this.retryCount=0,this.loadPlaylist()},e.stopLoad=function(){this.canLoad=!1,this.clearTimer()},e.switchParams=function(t,e){var n=null==e?void 0:e.renditionReports;if(n)for(var o=0;o<n.length;o++){var a=n[o],s=""+a.URI;if(s===t.substr(-s.length)){var u=parseInt(a["LAST-MSN"]),l=parseInt(a["LAST-PART"]);if(e&&this.hls.config.lowLatencyMode){var c=Math.min(e.age-e.partTarget,e.targetduration);void 0!==l&&c>e.partTarget&&(l+=1)}if(Object(r.isFiniteNumber)(u))return new i.HlsUrlParameters(u,Object(r.isFiniteNumber)(l)?l:void 0,i.HlsSkip.No)}}},e.loadPlaylist=function(t){},e.shouldLoadTrack=function(t){return this.canLoad&&t&&!!t.url&&(!t.details||t.details.live)},e.playlistLoaded=function(t,e,n){var r=this,i=e.details,a=e.stats,s=a.loading.end?Math.max(0,self.performance.now()-a.loading.end):0;if(i.advancedDateTime=Date.now()-s,i.live||null!=n&&n.live){if(i.reloaded(n),n&&this.log("live playlist "+t+" "+(i.advanced?"REFRESHED "+i.lastPartSn+"-"+i.lastPartIndex:"MISSED")),n&&i.fragments.length>0&&Object(o.mergeDetails)(n,i),!this.canLoad||!i.live)return;var u,l=void 0,c=void 0;if(i.canBlockReload&&i.endSN&&i.advanced){var f=this.hls.config.lowLatencyMode,d=i.lastPartSn,h=i.endSN,p=i.lastPartIndex,y=d===h;-1!==p?(l=y?h+1:d,c=y?f?0:p:p+1):l=h+1;var v=i.age,g=v+i.ageHeader,m=Math.min(g-i.partTarget,1.5*i.targetduration);if(m>0){if(n&&m>n.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+n.tuneInGoal+" to: "+m+" with playlist age: "+i.age),m=0;else{var b=Math.floor(m/i.targetduration);l+=b,void 0!==c&&(c+=Math.round(m%i.targetduration/i.partTarget)),this.log("CDN Tune-in age: "+i.ageHeader+"s last advanced "+v.toFixed(2)+"s goal: "+m+" skip sn "+b+" to part "+c)}i.tuneInGoal=m}if(u=this.getDeliveryDirectives(i,e.deliveryDirectives,l,c),f||!y)return void this.loadPlaylist(u)}else u=this.getDeliveryDirectives(i,e.deliveryDirectives,l,c);var E=Object(o.computeReloadInterval)(i,a);void 0!==l&&i.canBlockReload&&(E-=i.partTarget||1),this.log("reload live playlist "+t+" in "+Math.round(E)+" ms"),this.timer=self.setTimeout((function(){return r.loadPlaylist(u)}),E)}else this.clearTimer()},e.getDeliveryDirectives=function(t,e,n,r){var o=Object(i.getSkipValue)(t,n);return null!=e&&e.skip&&t.deltaUpdateFailed&&(n=e.msn,r=e.part,o=i.HlsSkip.No),new i.HlsUrlParameters(n,r,o)},e.retryLoadingOrFail=function(t){var e,n=this,r=this.hls.config,i=this.retryCount<r.levelLoadingMaxRetry;if(i)if(this.retryCount++,t.details.indexOf("LoadTimeOut")>-1&&null!==(e=t.context)&&void 0!==e&&e.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+t.details+'"'),this.loadPlaylist();else{var o=Math.min(Math.pow(2,this.retryCount)*r.levelLoadingRetryDelay,r.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout((function(){return n.loadPlaylist()}),o),this.warn("retry playlist loading #"+this.retryCount+" in "+o+' ms after "'+t.details+'"')}else this.warn('cannot recover from error "'+t.details+'"'),this.clearTimer(),t.fatal=!0;return i},t}()},"./src/controller/base-stream-controller.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"State",(function(){return _})),n.d(e,"default",(function(){return T}));var r=n("./src/polyfills/number.ts"),i=n("./src/task-loop.ts"),o=n("./src/controller/fragment-tracker.ts"),a=n("./src/utils/buffer-helper.ts"),s=n("./src/utils/logger.ts"),u=n("./src/events.ts"),l=n("./src/errors.ts"),c=n("./src/types/transmuxer.ts"),f=n("./src/utils/mp4-tools.ts"),d=n("./src/utils/discontinuities.ts"),h=n("./src/controller/fragment-finders.ts"),p=n("./src/controller/level-helper.ts"),y=n("./src/loader/fragment-loader.ts"),v=n("./src/crypt/decrypter.ts"),g=n("./src/utils/time-ranges.ts"),m=n("./src/types/loader.ts");function b(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function E(t,e){return(E=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var _={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",BACKTRACKING:"BACKTRACKING",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"},T=function(t){var e,n;function i(e,n,r){var i;return(i=t.call(this)||this).hls=void 0,i.fragPrevious=null,i.fragCurrent=null,i.fragmentTracker=void 0,i.transmuxer=null,i._state=_.STOPPED,i.media=void 0,i.mediaBuffer=void 0,i.config=void 0,i.bitrateTest=!1,i.lastCurrentTime=0,i.nextLoadPosition=0,i.startPosition=0,i.loadedmetadata=!1,i.fragLoadError=0,i.retryDate=0,i.levels=null,i.fragmentLoader=void 0,i.levelLastLoaded=null,i.startFragRequested=!1,i.decrypter=void 0,i.initPTS=[],i.onvseeking=null,i.onvended=null,i.logPrefix="",i.log=void 0,i.warn=void 0,i.logPrefix=r,i.log=s.logger.log.bind(s.logger,r+":"),i.warn=s.logger.warn.bind(s.logger,r+":"),i.hls=e,i.fragmentLoader=new y.default(e.config),i.fragmentTracker=n,i.config=e.config,i.decrypter=new v.default(e,e.config),e.on(u.Events.KEY_LOADED,i.onKeyLoaded,function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(i)),i}n=t,(e=i).prototype=Object.create(n.prototype),e.prototype.constructor=e,E(e,n);var T,k,A,S=i.prototype;return S.doTick=function(){this.onTickEnd()},S.onTickEnd=function(){},S.startLoad=function(t){},S.stopLoad=function(){this.fragmentLoader.abort();var t=this.fragCurrent;t&&this.fragmentTracker.removeFragment(t),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=_.STOPPED},S._streamEnded=function(t,e){var n=this.fragCurrent,r=this.fragmentTracker;if(!e.live&&n&&n.sn>=e.endSN&&!t.nextStart){var i=e.partList;if(null!=i&&i.length){var s=i[i.length-1];return a.BufferHelper.isBuffered(this.media,s.start+s.duration/2)}var u=r.getState(n);return u===o.FragmentState.PARTIAL||u===o.FragmentState.OK}return!1},S.onMediaAttached=function(t,e){var n=this.media=this.mediaBuffer=e.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),n.addEventListener("seeking",this.onvseeking),n.addEventListener("ended",this.onvended);var r=this.config;this.levels&&r.autoStartLoad&&this.state===_.STOPPED&&this.startLoad(r.startPosition)},S.onMediaDetaching=function(){var t=this.media;null!=t&&t.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),t&&(t.removeEventListener("seeking",this.onvseeking),t.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},S.onMediaSeeking=function(){var t=this.config,e=this.fragCurrent,n=this.media,i=this.mediaBuffer,o=this.state,s=n?n.currentTime:0,u=a.BufferHelper.bufferInfo(i||n,s,t.maxBufferHole);if(this.log("media seeking to "+(Object(r.isFiniteNumber)(s)?s.toFixed(3):s)+", state: "+o),o===_.ENDED)this.resetLoadingState();else if(e&&!u.len){var l=t.maxFragLookUpTolerance,c=e.start-l,f=s>e.start+e.duration+l;(s<c||f)&&(f&&e.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),e.loader.abort()),this.resetLoadingState())}n&&(this.lastCurrentTime=s),this.loadedmetadata||u.len||(this.nextLoadPosition=this.startPosition=s),this.tickImmediate()},S.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},S.onKeyLoaded=function(t,e){if(this.state===_.KEY_LOADING&&e.frag===this.fragCurrent&&this.levels){this.state=_.IDLE;var n=this.levels[e.frag.level].details;n&&this.loadFragment(e.frag,n,e.frag.start)}},S.onHandlerDestroying=function(){this.stopLoad(),t.prototype.onHandlerDestroying.call(this)},S.onHandlerDestroyed=function(){this.state=_.STOPPED,this.hls.off(u.Events.KEY_LOADED,this.onKeyLoaded,this),this.fragmentLoader&&this.fragmentLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.fragmentLoader=this.fragmentTracker=null,t.prototype.onHandlerDestroyed.call(this)},S.loadKey=function(t,e){this.log("Loading key for "+t.sn+" of ["+e.startSN+"-"+e.endSN+"], "+("[stream-controller]"===this.logPrefix?"level":"track")+" "+t.level),this.state=_.KEY_LOADING,this.fragCurrent=t,this.hls.trigger(u.Events.KEY_LOADING,{frag:t})},S.loadFragment=function(t,e,n){this._loadFragForPlayback(t,e,n)},S._loadFragForPlayback=function(t,e,n){var r=this;this._doFragLoad(t,e,n,(function(e){if(r.fragContextChanged(t))return r.warn("Fragment "+t.sn+(e.part?" p: "+e.part.index:"")+" of level "+t.level+" was dropped during download."),void r.fragmentTracker.removeFragment(t);t.stats.chunkCount++,r._handleFragmentLoadProgress(e)})).then((function(e){if(e){r.fragLoadError=0;var n=r.state;if(!r.fragContextChanged(t))return"payload"in e&&(r.log("Loaded fragment "+t.sn+" of level "+t.level),r.hls.trigger(u.Events.FRAG_LOADED,e),r.state===_.BACKTRACKING)?(r.fragmentTracker.backtrack(t,e),void r.resetFragmentLoading(t)):void r._handleFragmentLoadComplete(e);(n===_.FRAG_LOADING||n===_.BACKTRACKING||!r.fragCurrent&&n===_.PARSING)&&(r.fragmentTracker.removeFragment(t),r.state=_.IDLE)}})).catch((function(e){r.warn(e),r.resetFragmentLoading(t)}))},S.flushMainBuffer=function(t,e,n){if(void 0===n&&(n=null),t-e){var r={startOffset:t,endOffset:e,type:n};this.fragLoadError=0,this.hls.trigger(u.Events.BUFFER_FLUSHING,r)}},S._loadInitSegment=function(t){var e=this;this._doFragLoad(t).then((function(n){if(!n||e.fragContextChanged(t)||!e.levels)throw new Error("init load aborted");return n})).then((function(n){var r=e.hls,i=n.payload,o=t.decryptdata;if(i&&i.byteLength>0&&o&&o.key&&o.iv&&"AES-128"===o.method){var a=self.performance.now();return e.decrypter.webCryptoDecrypt(new Uint8Array(i),o.key.buffer,o.iv.buffer).then((function(e){var i=self.performance.now();return r.trigger(u.Events.FRAG_DECRYPTED,{frag:t,payload:e,stats:{tstart:a,tdecrypt:i}}),n.payload=e,n}))}return n})).then((function(n){var r=e.fragCurrent,i=e.hls,o=e.levels;if(!o)throw new Error("init load aborted, missing levels");var a=o[t.level].details;console.assert(a,"Level details are defined when init segment is loaded");var s=t.stats;e.state=_.IDLE,e.fragLoadError=0,t.data=new Uint8Array(n.payload),s.parsing.start=s.buffering.start=self.performance.now(),s.parsing.end=s.buffering.end=self.performance.now(),n.frag===r&&i.trigger(u.Events.FRAG_BUFFERED,{stats:s,frag:r,part:null,id:t.type}),e.tick()})).catch((function(n){e.warn(n),e.resetFragmentLoading(t)}))},S.fragContextChanged=function(t){var e=this.fragCurrent;return!t||!e||t.level!==e.level||t.sn!==e.sn||t.urlId!==e.urlId},S.fragBufferedComplete=function(t,e){var n=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+t.type+" sn: "+t.sn+(e?" part: "+e.index:"")+" of "+("[stream-controller]"===this.logPrefix?"level":"track")+" "+t.level+" "+g.default.toString(a.BufferHelper.getBuffered(n))),this.state=_.IDLE,this.tick()},S._handleFragmentLoadComplete=function(t){var e=this.transmuxer;if(e){var n=t.frag,r=t.part,i=t.partsLoaded,o=!i||0===i.length||i.some((function(t){return!t})),a=new c.ChunkMetadata(n.level,n.sn,n.stats.chunkCount+1,0,r?r.index:-1,!o);e.flush(a)}},S._handleFragmentLoadProgress=function(t){},S._doFragLoad=function(t,e,n,i){var o=this;if(void 0===n&&(n=null),!this.levels)throw new Error("frag load aborted, missing levels");if(n=Math.max(t.start,n||0),this.config.lowLatencyMode&&e){var a=e.partList;if(a&&i){n>t.end&&e.fragmentHint&&(t=e.fragmentHint);var s=this.getNextPart(a,t,n);if(s>-1){var l=a[s];return this.log("Loading part sn: "+t.sn+" p: "+l.index+" cc: "+t.cc+" of playlist ["+e.startSN+"-"+e.endSN+"] parts [0-"+s+"-"+(a.length-1)+"] "+("[stream-controller]"===this.logPrefix?"level":"track")+": "+t.level+", target: "+parseFloat(n.toFixed(3))),this.nextLoadPosition=l.start+l.duration,this.state=_.FRAG_LOADING,this.hls.trigger(u.Events.FRAG_LOADING,{frag:t,part:a[s],targetBufferTime:n}),this.doFragPartsLoad(t,a,s,i).catch((function(t){return o.handleFragLoadError(t)}))}if(!t.url||this.loadedEndOfParts(a,n))return Promise.resolve(null)}}return this.log("Loading fragment "+t.sn+" cc: "+t.cc+" "+(e?"of ["+e.startSN+"-"+e.endSN+"] ":"")+("[stream-controller]"===this.logPrefix?"level":"track")+": "+t.level+", target: "+parseFloat(n.toFixed(3))),Object(r.isFiniteNumber)(t.sn)&&!this.bitrateTest&&(this.nextLoadPosition=t.start+t.duration),this.state=_.FRAG_LOADING,this.hls.trigger(u.Events.FRAG_LOADING,{frag:t,targetBufferTime:n}),this.fragmentLoader.load(t,i).catch((function(t){return o.handleFragLoadError(t)}))},S.doFragPartsLoad=function(t,e,n,r){var i=this;return new Promise((function(o,a){var s=[];!function n(l){var c=e[l];i.fragmentLoader.loadPart(t,c,r).then((function(r){s[c.index]=r;var a=r.part;i.hls.trigger(u.Events.FRAG_LOADED,r);var f=e[l+1];if(!f||f.fragment!==t)return o({frag:t,part:a,partsLoaded:s});n(l+1)})).catch(a)}(n)}))},S.handleFragLoadError=function(t){var e=t.data;return e&&e.details===l.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(e.frag,e.part):this.hls.trigger(u.Events.ERROR,e),null},S._handleTransmuxerFlush=function(t){var e=this.getCurrentContext(t);if(e&&this.state===_.PARSING){var n=e.frag,r=e.part,i=e.level,o=self.performance.now();n.stats.parsing.end=o,r&&(r.stats.parsing.end=o),this.updateLevelTiming(n,r,i,t.partial)}else this.fragCurrent||(this.state=_.IDLE)},S.getCurrentContext=function(t){var e=this.levels,n=t.level,r=t.sn,i=t.part;if(!e||!e[n])return this.warn("Levels object was unset while buffering fragment "+r+" of level "+n+". The current chunk will not be buffered."),null;var o=e[n],a=i>-1?Object(p.getPartWith)(o,r,i):null,s=a?a.fragment:Object(p.getFragmentWithSN)(o,r,this.fragCurrent);return s?{frag:s,part:a,level:o}:null},S.bufferFragmentData=function(t,e,n,r){if(t&&this.state===_.PARSING){var i=t.data1,o=t.data2,a=i;if(i&&o&&(a=Object(f.appendUint8Array)(i,o)),a&&a.length){var s={type:t.type,frag:e,part:n,chunkMeta:r,parent:e.type,data:a};this.hls.trigger(u.Events.BUFFER_APPENDING,s),t.dropped&&t.independent&&!n&&this.flushBufferGap(e)}}},S.flushBufferGap=function(t){var e=this.media;if(e)if(a.BufferHelper.isBuffered(e,e.currentTime)){var n=e.currentTime,r=a.BufferHelper.bufferInfo(e,n,0),i=t.duration,o=Math.min(2*this.config.maxFragLookUpTolerance,.25*i),s=Math.max(Math.min(t.start-o,r.end-o),n+o);t.start-s>o&&this.flushMainBuffer(s,t.start)}else this.flushMainBuffer(0,t.start)},S.getFwdBufferInfo=function(t,e){var n=this.config,i=this.getLoadPosition();if(!Object(r.isFiniteNumber)(i))return null;var o=a.BufferHelper.bufferInfo(t,i,n.maxBufferHole);if(0===o.len&&void 0!==o.nextStart){var s=this.fragmentTracker.getBufferedFrag(i,e);if(s&&o.nextStart<s.end)return a.BufferHelper.bufferInfo(t,i,Math.max(o.nextStart,n.maxBufferHole))}return o},S.getMaxBufferLength=function(t){var e,n=this.config;return e=t?Math.max(8*n.maxBufferSize/t,n.maxBufferLength):n.maxBufferLength,Math.min(e,n.maxMaxBufferLength)},S.reduceMaxBufferLength=function(t){var e=this.config,n=t||e.maxBufferLength;return e.maxMaxBufferLength>=n&&(e.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+e.maxMaxBufferLength+"s"),!0)},S.getNextFragment=function(t,e){var n,r,i=e.fragments,o=i.length;if(!o)return null;var a,s=this.config,u=i[0].start;if(e.live){var l=s.initialLiveManifestSize;if(o<l)return this.warn("Not enough fragments to start playback (have: "+o+", need: "+l+")"),null;e.PTSKnown||this.startFragRequested||-1!==this.startPosition||(a=this.getInitialLiveFragment(e,i),this.startPosition=a?this.hls.liveSyncPosition||a.start:t)}else t<=u&&(a=i[0]);if(!a){var c=s.lowLatencyMode?e.partEnd:e.fragmentEnd;a=this.getFragmentAtPosition(t,c,e)}return null===(n=a)||void 0===n||!n.initSegment||null!==(r=a)&&void 0!==r&&r.initSegment.data||this.bitrateTest||(a=a.initSegment),a},S.getNextPart=function(t,e,n){for(var r=-1,i=!1,o=!0,a=0,s=t.length;a<s;a++){var u=t[a];if(o=o&&!u.independent,r>-1&&n<u.start)break;var l=u.loaded;!l&&(i||u.independent||o)&&u.fragment===e&&(r=a),i=l}return r},S.loadedEndOfParts=function(t,e){var n=t[t.length-1];return n&&e>n.start&&n.loaded},S.getInitialLiveFragment=function(t,e){var n=this.fragPrevious,r=null;if(n){if(t.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+n.programDateTime),r=Object(h.findFragmentByPDT)(e,n.endProgramDateTime,this.config.maxFragLookUpTolerance)),!r){var i=n.sn+1;if(i>=t.startSN&&i<=t.endSN){var o=e[i-t.startSN];n.cc===o.cc&&(r=o,this.log("Live playlist, switching playlist, load frag with next SN: "+r.sn))}r||(r=Object(h.findFragWithCC)(e,n.cc))&&this.log("Live playlist, switching playlist, load frag with same CC: "+r.sn)}}else{var a=this.hls.liveSyncPosition;null!==a&&(r=this.getFragmentAtPosition(a,this.bitrateTest?t.fragmentEnd:t.edge,t))}return r},S.getFragmentAtPosition=function(t,e,n){var r,i=this.config,a=this.fragPrevious,s=n.fragments,u=n.endSN,l=n.fragmentHint,c=i.maxFragLookUpTolerance,f=!!(i.lowLatencyMode&&n.partList&&l);if(f&&l&&!this.bitrateTest&&(s=s.concat(l),u=l.sn),t<e){var d=t>e-c?0:c;r=Object(h.findFragmentByPTS)(a,s,t,d)}else r=s[s.length-1];if(r){var p=r.sn-n.startSN,y=a&&r.level===a.level,v=s[p+1];if(this.fragmentTracker.getState(r)===o.FragmentState.BACKTRACKED){r=null;for(var g=p;s[g]&&this.fragmentTracker.getState(s[g])===o.FragmentState.BACKTRACKED;)r=a?s[g--]:s[--g];r||(r=v)}else a&&r.sn===a.sn&&!f&&y&&(r.sn<u&&this.fragmentTracker.getState(v)!==o.FragmentState.OK?(this.log("SN "+r.sn+" just loaded, load next one: "+v.sn),r=v):r=null)}return r},S.synchronizeToLiveEdge=function(t){var e=this.config,n=this.media;if(n){var r=this.hls.liveSyncPosition,i=n.currentTime,o=t.fragments[0].start,a=t.edge,s=i>=o-e.maxFragLookUpTolerance&&i<=a;if(null!==r&&n.duration>r&&(i<r||!s)){var u=void 0!==e.liveMaxLatencyDuration?e.liveMaxLatencyDuration:e.liveMaxLatencyDurationCount*t.targetduration;(!s&&n.readyState<4||i<a-u)&&(this.loadedmetadata||(this.nextLoadPosition=r),n.readyState&&(this.warn("Playback: "+i.toFixed(3)+" is located too far from the end of live sliding playlist: "+a+", reset currentTime to : "+r.toFixed(3)),n.currentTime=r))}}},S.alignPlaylists=function(t,e){var n=this.levels,i=this.levelLastLoaded,o=this.fragPrevious,a=null!==i?n[i]:null,s=t.fragments.length;if(!s)return this.warn("No fragments in live playlist"),0;var u=t.fragments[0].start,l=!e,c=t.alignedSliding&&Object(r.isFiniteNumber)(u);if(l||!c&&!u){Object(d.alignStream)(o,a,t);var f=t.fragments[0].start;return this.log("Live playlist sliding: "+f.toFixed(2)+" start-sn: "+(e?e.startSN:"na")+"->"+t.startSN+" prev-sn: "+(o?o.sn:"na")+" fragments: "+s),f}return u},S.waitForCdnTuneIn=function(t){return t.live&&t.canBlockReload&&t.tuneInGoal>Math.max(t.partHoldBack,3*t.partTarget)},S.setStartPosition=function(t,e){var n=this.startPosition;if(n<e&&(n=-1),-1===n||-1===this.lastCurrentTime){var i=t.startTimeOffset;Object(r.isFiniteNumber)(i)?(n=e+i,i<0&&(n+=t.totalduration),n=Math.min(Math.max(e,n),e+t.totalduration),this.log("Start time offset "+i+" found in playlist, adjust startPosition to "+n),this.startPosition=n):t.live?n=this.hls.liveSyncPosition||e:this.startPosition=n=0,this.lastCurrentTime=n}this.nextLoadPosition=n},S.getLoadPosition=function(){var t=this.media,e=0;return this.loadedmetadata&&t?e=t.currentTime:this.nextLoadPosition&&(e=this.nextLoadPosition),e},S.handleFragLoadAborted=function(t,e){this.transmuxer&&"initSegment"!==t.sn&&t.stats.aborted&&(this.warn("Fragment "+t.sn+(e?" part"+e.index:"")+" of level "+t.level+" was aborted"),this.resetFragmentLoading(t))},S.resetFragmentLoading=function(t){this.fragCurrent&&this.fragContextChanged(t)||(this.state=_.IDLE)},S.onFragmentOrKeyLoadError=function(t,e){if(!e.fatal){var n=e.frag;if(n&&n.type===t){var r=this.fragCurrent;console.assert(r&&n.sn===r.sn&&n.level===r.level&&n.urlId===r.urlId,"Frag load error must match current frag to retry");var i=this.config;if(this.fragLoadError+1<=i.fragLoadingMaxRetry){if(this.resetLiveStartWhenNotLoaded(n.level))return;var o=Math.min(Math.pow(2,this.fragLoadError)*i.fragLoadingRetryDelay,i.fragLoadingMaxRetryTimeout);this.warn("Fragment "+n.sn+" of "+t+" "+n.level+" failed to load, retrying in "+o+"ms"),this.retryDate=self.performance.now()+o,this.fragLoadError++,this.state=_.FRAG_LOADING_WAITING_RETRY}else e.levelRetry?(t===m.PlaylistLevelType.AUDIO&&(this.fragCurrent=null),this.fragLoadError=0,this.state=_.IDLE):(s.logger.error(e.details+" reaches max retry, redispatch as fatal ..."),e.fatal=!0,this.hls.stopLoad(),this.state=_.ERROR)}}},S.afterBufferFlushed=function(t,e,n){if(t){var r=a.BufferHelper.getBuffered(t);this.fragmentTracker.detectEvictedFragments(e,r,n),this.state===_.ENDED&&this.resetLoadingState()}},S.resetLoadingState=function(){this.fragCurrent=null,this.fragPrevious=null,this.state=_.IDLE},S.resetLiveStartWhenNotLoaded=function(t){if(!this.loadedmetadata){this.startFragRequested=!1;var e=this.levels?this.levels[t].details:null;if(null!=e&&e.live)return this.startPosition=-1,this.setStartPosition(e,0),this.resetLoadingState(),!0;this.nextLoadPosition=this.startPosition}return!1},S.updateLevelTiming=function(t,e,n,r){var i=this,o=n.details;console.assert(!!o,"level.details must be defined"),Object.keys(t.elementaryStreams).reduce((function(e,a){var s=t.elementaryStreams[a];if(s){var l=s.endPTS-s.startPTS;if(l<=0)return i.warn("Could not parse fragment "+t.sn+" "+a+" duration reliably ("+l+") resetting transmuxer to fallback to playlist timing"),i.resetTransmuxer(),e||!1;var c=r?0:Object(p.updateFragPTSDTS)(o,t,s.startPTS,s.endPTS,s.startDTS,s.endDTS);return i.hls.trigger(u.Events.LEVEL_PTS_UPDATED,{details:o,level:n,drift:c,type:a,frag:t,start:s.startPTS,end:s.endPTS}),!0}return e}),!1)?(this.state=_.PARSED,this.hls.trigger(u.Events.FRAG_PARSED,{frag:t,part:e})):this.resetLoadingState()},S.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},T=i,(k=[{key:"state",get:function(){return this._state},set:function(t){var e=this._state;e!==t&&(this._state=t,this.log(e+"->"+t))}}])&&b(T.prototype,k),A&&b(T,A),i}(i.default)},"./src/controller/buffer-controller.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return h}));var r=n("./src/polyfills/number.ts"),i=n("./src/events.ts"),o=n("./src/utils/logger.ts"),a=n("./src/errors.ts"),s=n("./src/utils/buffer-helper.ts"),u=n("./src/utils/mediasource-helper.ts"),l=n("./src/loader/fragment.ts"),c=n("./src/controller/buffer-operation-queue.ts"),f=Object(u.getMediaSource)(),d=/([ha]vc.)(?:\.[^.,]+)+/,h=function(){function t(t){var e=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var t=e.hls,n=e.media,r=e.mediaSource;o.logger.log("[buffer-controller]: Media source opened"),n&&(e.updateMediaElementDuration(),t.trigger(i.Events.MEDIA_ATTACHED,{media:n})),r&&r.removeEventListener("sourceopen",e._onMediaSourceOpen),e.checkPendingTracks()},this._onMediaSourceClose=function(){o.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){o.logger.log("[buffer-controller]: Media source ended")},this.hls=t,this._initSourceBuffer(),this.registerListeners()}var e=t.prototype;return e.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},e.destroy=function(){this.unregisterListeners(),this.details=null},e.registerListeners=function(){var t=this.hls;t.on(i.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(i.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.on(i.Events.BUFFER_RESET,this.onBufferReset,this),t.on(i.Events.BUFFER_APPENDING,this.onBufferAppending,this),t.on(i.Events.BUFFER_CODECS,this.onBufferCodecs,this),t.on(i.Events.BUFFER_EOS,this.onBufferEos,this),t.on(i.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(i.Events.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(i.Events.FRAG_PARSED,this.onFragParsed,this),t.on(i.Events.FRAG_CHANGED,this.onFragChanged,this)},e.unregisterListeners=function(){var t=this.hls;t.off(i.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(i.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.off(i.Events.BUFFER_RESET,this.onBufferReset,this),t.off(i.Events.BUFFER_APPENDING,this.onBufferAppending,this),t.off(i.Events.BUFFER_CODECS,this.onBufferCodecs,this),t.off(i.Events.BUFFER_EOS,this.onBufferEos,this),t.off(i.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(i.Events.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(i.Events.FRAG_PARSED,this.onFragParsed,this),t.off(i.Events.FRAG_CHANGED,this.onFragChanged,this)},e._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new c.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},e.onManifestParsed=function(t,e){var n=2;(e.audio&&!e.video||!e.altAudio)&&(n=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=n,this.details=null,o.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},e.onMediaAttaching=function(t,e){var n=this.media=e.media;if(n&&f){var r=this.mediaSource=new f;r.addEventListener("sourceopen",this._onMediaSourceOpen),r.addEventListener("sourceended",this._onMediaSourceEnded),r.addEventListener("sourceclose",this._onMediaSourceClose),n.src=self.URL.createObjectURL(r),this._objectUrl=n.src}},e.onMediaDetaching=function(){var t=this.media,e=this.mediaSource,n=this._objectUrl;if(e){if(o.logger.log("[buffer-controller]: media source detaching"),"open"===e.readyState)try{e.endOfStream()}catch(t){o.logger.warn("[buffer-controller]: onMediaDetaching: "+t.message+" while calling endOfStream")}this.onBufferReset(),e.removeEventListener("sourceopen",this._onMediaSourceOpen),e.removeEventListener("sourceended",this._onMediaSourceEnded),e.removeEventListener("sourceclose",this._onMediaSourceClose),t&&(n&&self.URL.revokeObjectURL(n),t.src===n?(t.removeAttribute("src"),t.load()):o.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(i.Events.MEDIA_DETACHED,void 0)},e.onBufferReset=function(){var t=this;this.getSourceBufferTypes().forEach((function(e){var n=t.sourceBuffer[e];try{n&&(t.removeBufferListeners(e),t.mediaSource&&t.mediaSource.removeSourceBuffer(n),t.sourceBuffer[e]=void 0)}catch(t){o.logger.warn("[buffer-controller]: Failed to reset the "+e+" buffer",t)}})),this._initSourceBuffer()},e.onBufferCodecs=function(t,e){var n=this,r=this.getSourceBufferTypes().length;Object.keys(e).forEach((function(t){if(r){var i=n.tracks[t];if(i&&"function"==typeof i.buffer.changeType){var o=e[t],a=o.codec,s=o.levelCodec,u=o.container;if((i.levelCodec||i.codec).replace(d,"$1")!==(s||a).replace(d,"$1")){var l=u+";codecs="+(s||a);n.appendChangeType(t,l)}}}else n.pendingTracks[t]=e[t]})),r||(this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks())},e.appendChangeType=function(t,e){var n=this,r=this.operationQueue,i={execute:function(){var i=n.sourceBuffer[t];i&&(o.logger.log("[buffer-controller]: changing "+t+" sourceBuffer type to "+e),i.changeType(e)),r.shiftAndExecuteNext(t)},onStart:function(){},onComplete:function(){},onError:function(e){o.logger.warn("[buffer-controller]: Failed to change "+t+" SourceBuffer type",e)}};r.append(i,t)},e.onBufferAppending=function(t,e){var n=this,r=this.hls,u=this.operationQueue,l=this.tracks,c=e.data,f=e.type,d=e.frag,h=e.part,p=e.chunkMeta,y=p.buffering[f],v=self.performance.now();y.start=v;var g=d.stats.buffering,m=h?h.stats.buffering:null;0===g.start&&(g.start=v),m&&0===m.start&&(m.start=v);var b=l.audio,E="audio"===f&&1===p.id&&"audio/mpeg"===(null==b?void 0:b.container),_={execute:function(){if(y.executeStart=self.performance.now(),E){var t=n.sourceBuffer[f];if(t){var e=d.start-t.timestampOffset;Math.abs(e)>=.1&&(o.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+d.start+" (delta: "+e+") sn: "+d.sn+")"),t.timestampOffset=d.start)}}n.appendExecutor(c,f)},onStart:function(){},onComplete:function(){var t=self.performance.now();y.executeEnd=y.end=t,0===g.first&&(g.first=t),m&&0===m.first&&(m.first=t);var e=n.sourceBuffer,r={};for(var o in e)r[o]=s.BufferHelper.getBuffered(e[o]);n.appendError=0,n.hls.trigger(i.Events.BUFFER_APPENDED,{type:f,frag:d,part:h,chunkMeta:p,parent:d.type,timeRanges:r})},onError:function(t){o.logger.error("[buffer-controller]: Error encountered while trying to append to the "+f+" SourceBuffer",t);var e={type:a.ErrorTypes.MEDIA_ERROR,parent:d.type,details:a.ErrorDetails.BUFFER_APPEND_ERROR,err:t,fatal:!1};t.code===DOMException.QUOTA_EXCEEDED_ERR?e.details=a.ErrorDetails.BUFFER_FULL_ERROR:(n.appendError++,e.details=a.ErrorDetails.BUFFER_APPEND_ERROR,n.appendError>r.config.appendErrorMaxRetry&&(o.logger.error("[buffer-controller]: Failed "+r.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),e.fatal=!0)),r.trigger(i.Events.ERROR,e)}};u.append(_,f)},e.onBufferFlushing=function(t,e){var n=this,r=this.operationQueue,a=function(t){return{execute:n.removeExecutor.bind(n,t,e.startOffset,e.endOffset),onStart:function(){},onComplete:function(){n.hls.trigger(i.Events.BUFFER_FLUSHED,{type:t})},onError:function(e){o.logger.warn("[buffer-controller]: Failed to remove from "+t+" SourceBuffer",e)}}};e.type?r.append(a(e.type),e.type):this.getSourceBufferTypes().forEach((function(t){r.append(a(t),t)}))},e.onFragParsed=function(t,e){var n=this,r=e.frag,a=e.part,s=[],u=a?a.elementaryStreams:r.elementaryStreams;u[l.ElementaryStreamTypes.AUDIOVIDEO]?s.push("audiovideo"):(u[l.ElementaryStreamTypes.AUDIO]&&s.push("audio"),u[l.ElementaryStreamTypes.VIDEO]&&s.push("video")),0===s.length&&o.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+r.type+" level: "+r.level+" sn: "+r.sn),this.blockBuffers((function(){var t=self.performance.now();r.stats.buffering.end=t,a&&(a.stats.buffering.end=t);var e=a?a.stats:r.stats;n.hls.trigger(i.Events.FRAG_BUFFERED,{frag:r,part:a,stats:e,id:r.type})}),s)},e.onFragChanged=function(t,e){this.flushBackBuffer()},e.onBufferEos=function(t,e){var n=this;this.getSourceBufferTypes().reduce((function(t,r){var i=n.sourceBuffer[r];return e.type&&e.type!==r||i&&!i.ended&&(i.ended=!0,o.logger.log("[buffer-controller]: "+r+" sourceBuffer now EOS")),t&&!(i&&!i.ended)}),!0)&&this.blockBuffers((function(){var t=n.mediaSource;t&&"open"===t.readyState&&t.endOfStream()}))},e.onLevelUpdated=function(t,e){var n=e.details;n.fragments.length&&(this.details=n,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())},e.flushBackBuffer=function(){var t=this.hls,e=this.details,n=this.media,o=this.sourceBuffer;if(n&&null!==e){var a=this.getSourceBufferTypes();if(a.length){var u=e.live&&null!==t.config.liveBackBufferLength?t.config.liveBackBufferLength:t.config.backBufferLength;if(Object(r.isFiniteNumber)(u)&&!(u<0)){var l=n.currentTime,c=e.levelTargetDuration,f=Math.max(u,c),d=Math.floor(l/c)*c-f;a.forEach((function(n){var r=o[n];if(r){var a=s.BufferHelper.getBuffered(r);a.length>0&&d>a.start(0)&&(t.trigger(i.Events.BACK_BUFFER_REACHED,{bufferEnd:d}),e.live&&t.trigger(i.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:d}),t.trigger(i.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:d,type:n}))}}))}}}},e.updateMediaElementDuration=function(){if(this.details&&this.media&&this.mediaSource&&"open"===this.mediaSource.readyState){var t=this.details,e=this.hls,n=this.media,i=this.mediaSource,a=t.fragments[0].start+t.totalduration,s=n.duration,u=Object(r.isFiniteNumber)(i.duration)?i.duration:0;t.live&&e.config.liveDurationInfinity?(o.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),i.duration=1/0,this.updateSeekableRange(t)):(a>u&&a>s||!Object(r.isFiniteNumber)(s))&&(o.logger.log("[buffer-controller]: Updating Media Source duration to "+a.toFixed(3)),i.duration=a)}},e.updateSeekableRange=function(t){var e=this.mediaSource,n=t.fragments;if(n.length&&t.live&&null!=e&&e.setLiveSeekableRange){var r=Math.max(0,n[0].start),i=Math.max(r,r+t.totalduration);e.setLiveSeekableRange(r,i)}},e.checkPendingTracks=function(){var t=this.bufferCodecEventsExpected,e=this.operationQueue,n=this.pendingTracks,r=Object.keys(n).length;if(r&&!t||2===r){this.createSourceBuffers(n),this.pendingTracks={};var o=this.getSourceBufferTypes();if(0===o.length)return void this.hls.trigger(i.Events.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});o.forEach((function(t){e.executeNext(t)}))}},e.createSourceBuffers=function(t){var e=this.sourceBuffer,n=this.mediaSource;if(!n)throw Error("createSourceBuffers called when mediaSource was null");var r=0;for(var s in t)if(!e[s]){var u=t[s];if(!u)throw Error("source buffer exists for track "+s+", however track does not");var l=u.levelCodec||u.codec,c=u.container+";codecs="+l;o.logger.log("[buffer-controller]: creating sourceBuffer("+c+")");try{var f=e[s]=n.addSourceBuffer(c),d=s;this.addBufferListener(d,"updatestart",this._onSBUpdateStart),this.addBufferListener(d,"updateend",this._onSBUpdateEnd),this.addBufferListener(d,"error",this._onSBUpdateError),this.tracks[s]={buffer:f,codec:l,container:u.container,levelCodec:u.levelCodec,id:u.id},r++}catch(t){o.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+t.message),this.hls.trigger(i.Events.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:t,mimeType:c})}}r&&this.hls.trigger(i.Events.BUFFER_CREATED,{tracks:this.tracks})},e._onSBUpdateStart=function(t){this.operationQueue.current(t).onStart()},e._onSBUpdateEnd=function(t){var e=this.operationQueue;e.current(t).onComplete(),e.shiftAndExecuteNext(t)},e._onSBUpdateError=function(t,e){o.logger.error("[buffer-controller]: "+t+" SourceBuffer error",e),this.hls.trigger(i.Events.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var n=this.operationQueue.current(t);n&&n.onError(e)},e.removeExecutor=function(t,e,n){var i=this.media,a=this.mediaSource,s=this.operationQueue,u=this.sourceBuffer[t];if(!i||!a||!u)return o.logger.warn("[buffer-controller]: Attempting to remove from the "+t+" SourceBuffer, but it does not exist"),void s.shiftAndExecuteNext(t);var l=Object(r.isFiniteNumber)(i.duration)?i.duration:1/0,c=Object(r.isFiniteNumber)(a.duration)?a.duration:1/0,f=Math.max(0,e),d=Math.min(n,l,c);d>f?(o.logger.log("[buffer-controller]: Removing ["+f+","+d+"] from the "+t+" SourceBuffer"),console.assert(!u.updating,t+" sourceBuffer must not be updating"),u.remove(f,d)):s.shiftAndExecuteNext(t)},e.appendExecutor=function(t,e){var n=this.operationQueue,r=this.sourceBuffer[e];if(!r)return o.logger.warn("[buffer-controller]: Attempting to append to the "+e+" SourceBuffer, but it does not exist"),void n.shiftAndExecuteNext(e);r.ended=!1,console.assert(!r.updating,e+" sourceBuffer must not be updating"),r.appendBuffer(t)},e.blockBuffers=function(t,e){var n=this;if(void 0===e&&(e=this.getSourceBufferTypes()),!e.length)return o.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve(t);var r=this.operationQueue,i=e.map((function(t){return r.appendBlocker(t)}));Promise.all(i).then((function(){t(),e.forEach((function(t){var e=n.sourceBuffer[t];e&&e.updating||r.shiftAndExecuteNext(t)}))}))},e.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},e.addBufferListener=function(t,e,n){var r=this.sourceBuffer[t];if(r){var i=n.bind(this,t);this.listeners[t].push({event:e,listener:i}),r.addEventListener(e,i)}},e.removeBufferListeners=function(t){var e=this.sourceBuffer[t];e&&this.listeners[t].forEach((function(t){e.removeEventListener(t.event,t.listener)}))},t}()},"./src/controller/buffer-operation-queue.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return i}));var r=n("./src/utils/logger.ts"),i=function(){function t(t){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=t}var e=t.prototype;return e.append=function(t,e){var n=this.queues[e];n.push(t),1===n.length&&this.buffers[e]&&this.executeNext(e)},e.insertAbort=function(t,e){this.queues[e].unshift(t),this.executeNext(e)},e.appendBlocker=function(t){var e,n=new Promise((function(t){e=t})),r={execute:e,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(r,t),n},e.executeNext=function(t){var e=this.buffers,n=this.queues,i=e[t],o=n[t];if(o.length){var a=o[0];try{a.execute()}catch(e){r.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),a.onError(e),i&&i.updating||(o.shift(),this.executeNext(t))}}},e.shiftAndExecuteNext=function(t){this.queues[t].shift(),this.executeNext(t)},e.current=function(t){return this.queues[t][0]},t}()},"./src/controller/cap-level-controller.ts":function(t,e,n){"use strict";n.r(e);var r=n("./src/events.ts");function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=function(){function t(t){this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.hls=void 0,this.streamController=void 0,this.clientRect=void 0,this.hls=t,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}var e,n,o,a=t.prototype;return a.setStreamController=function(t){this.streamController=t},a.destroy=function(){this.unregisterListener(),this.hls.config.capLevelToPlayerSize&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},a.registerListeners=function(){var t=this.hls;t.on(r.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.on(r.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(r.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.on(r.Events.BUFFER_CODECS,this.onBufferCodecs,this),t.on(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},a.unregisterListener=function(){var t=this.hls;t.off(r.Events.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.off(r.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(r.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.off(r.Events.BUFFER_CODECS,this.onBufferCodecs,this),t.off(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this)},a.onFpsDropLevelCapping=function(e,n){t.isLevelAllowed(n.droppedLevel,this.restrictedLevels)&&this.restrictedLevels.push(n.droppedLevel)},a.onMediaAttaching=function(t,e){this.media=e.media instanceof HTMLVideoElement?e.media:null},a.onManifestParsed=function(t,e){var n=this.hls;this.restrictedLevels=[],this.firstLevel=e.firstLevel,n.config.capLevelToPlayerSize&&e.video&&this.startCapping()},a.onBufferCodecs=function(t,e){this.hls.config.capLevelToPlayerSize&&e.video&&this.startCapping()},a.onMediaDetaching=function(){this.stopCapping()},a.detectPlayerSize=function(){if(this.media&&this.mediaHeight>0&&this.mediaWidth>0){var t=this.hls.levels;if(t.length){var e=this.hls;e.autoLevelCapping=this.getMaxLevel(t.length-1),e.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=e.autoLevelCapping}}},a.getMaxLevel=function(e){var n=this,r=this.hls.levels;if(!r.length)return-1;var i=r.filter((function(r,i){return t.isLevelAllowed(i,n.restrictedLevels)&&i<=e}));return this.clientRect=null,t.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)},a.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},a.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},a.getDimensions=function(){if(this.clientRect)return this.clientRect;var t=this.media,e={width:0,height:0};if(t){var n=t.getBoundingClientRect();e.width=n.width,e.height=n.height,e.width||e.height||(e.width=n.right-n.left||t.width||0,e.height=n.bottom-n.top||t.height||0)}return this.clientRect=e,e},t.isLevelAllowed=function(t,e){return void 0===e&&(e=[]),-1===e.indexOf(t)},t.getMaxLevelByMediaSize=function(t,e,n){if(!t||!t.length)return-1;for(var r,i,o=t.length-1,a=0;a<t.length;a+=1){var s=t[a];if((s.width>=e||s.height>=n)&&(r=s,!(i=t[a+1])||r.width!==i.width||r.height!==i.height)){o=a;break}}return o},e=t,o=[{key:"contentScaleFactor",get:function(){var t=1;try{t=self.devicePixelRatio}catch(t){}return t}}],(n=[{key:"mediaWidth",get:function(){return this.getDimensions().width*t.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*t.contentScaleFactor}}])&&i(e.prototype,n),o&&i(e,o),t}();e.default=o},
1"./src/controller/cmcd-controller.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return d}));var r=n("./src/events.ts"),i=n("./src/types/cmcd.ts"),o=n("./src/utils/buffer-helper.ts"),a=n("./src/utils/logger.ts");function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function u(t,e,n){return e&&s(t.prototype,e),n&&s(t,n),t}function l(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return c(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[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.")}function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function f(){return(f=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}var d=function(){function t(e){var n=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){n.initialized&&(n.starved=!0),n.buffering=!0},this.onPlaying=function(){n.initialized||(n.initialized=!0),n.buffering=!1},this.applyPlaylistData=function(t){try{n.apply(t,{ot:i.CMCDObjectType.MANIFEST,su:!n.initialized})}catch(t){a.logger.warn("Could not generate manifest CMCD data.",t)}},this.applyFragmentData=function(t){try{var e=t.frag,r=n.hls.levels[e.level],o=n.getObjectType(e),s={d:1e3*e.duration,ot:o};o!==i.CMCDObjectType.VIDEO&&o!==i.CMCDObjectType.AUDIO&&o!=i.CMCDObjectType.MUXED||(s.br=r.bitrate/1e3,s.tb=n.getTopBandwidth(o)/1e3,s.bl=n.getBufferLength(o)),n.apply(t,s)}catch(t){a.logger.warn("Could not generate segment CMCD data.",t)}},this.hls=e;var r=this.config=e.config,o=r.cmcd;null!=o&&(r.pLoader=this.createPlaylistLoader(),r.fLoader=this.createFragmentLoader(),this.sid=o.sessionId||t.uuid(),this.cid=o.contentId,this.useHeaders=!0===o.useHeaders,this.registerListeners())}var e=t.prototype;return e.registerListeners=function(){var t=this.hls;t.on(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(r.Events.MEDIA_DETACHED,this.onMediaDetached,this),t.on(r.Events.BUFFER_CREATED,this.onBufferCreated,this)},e.unregisterListeners=function(){var t=this.hls;t.off(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(r.Events.MEDIA_DETACHED,this.onMediaDetached,this),t.off(r.Events.BUFFER_CREATED,this.onBufferCreated,this),this.onMediaDetached()},e.destroy=function(){this.unregisterListeners(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null},e.onMediaAttached=function(t,e){this.media=e.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},e.onMediaDetached=function(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)},e.onBufferCreated=function(t,e){var n,r;this.audioBuffer=null===(n=e.tracks.audio)||void 0===n?void 0:n.buffer,this.videoBuffer=null===(r=e.tracks.video)||void 0===r?void 0:r.buffer},e.createData=function(){var t;return{v:i.CMCDVersion,sf:i.CMCDStreamingFormat.HLS,sid:this.sid,cid:this.cid,pr:null===(t=this.media)||void 0===t?void 0:t.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},e.apply=function(e,n){void 0===n&&(n={}),f(n,this.createData());var r=n.ot===i.CMCDObjectType.INIT||n.ot===i.CMCDObjectType.VIDEO||n.ot===i.CMCDObjectType.MUXED;if(this.starved&&r&&(n.bs=!0,n.su=!0,this.starved=!1),null==n.su&&(n.su=this.buffering),this.useHeaders){var o=t.toHeaders(n);if(!Object.keys(o).length)return;e.headers||(e.headers={}),f(e.headers,o)}else{var a=t.toQuery(n);if(!a)return;e.url=t.appendQueryToUri(e.url,a)}},e.getObjectType=function(t){var e=t.type;return"subtitle"===e?i.CMCDObjectType.TIMED_TEXT:"initSegment"===t.sn?i.CMCDObjectType.INIT:"audio"===e?i.CMCDObjectType.AUDIO:"main"===e?this.hls.audioTracks.length?i.CMCDObjectType.VIDEO:i.CMCDObjectType.MUXED:void 0},e.getTopBandwidth=function(t){var e,n=0,r=this.hls;if(t===i.CMCDObjectType.AUDIO)e=r.audioTracks;else{var o=r.maxAutoLevel,a=o>-1?o+1:r.levels.length;e=r.levels.slice(0,a)}for(var s,u=l(e);!(s=u()).done;){var c=s.value;c.bitrate>n&&(n=c.bitrate)}return n>0?n:NaN},e.getBufferLength=function(t){var e=this.hls.media,n=t===i.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;return n&&e?1e3*o.BufferHelper.bufferInfo(n,e.currentTime,this.config.maxBufferHole).len:NaN},e.createPlaylistLoader=function(){var t=this.config.pLoader,e=this.applyPlaylistData,n=t||this.config.loader;return function(){function t(t){this.loader=void 0,this.loader=new n(t)}var r=t.prototype;return r.destroy=function(){this.loader.destroy()},r.abort=function(){this.loader.abort()},r.load=function(t,n,r){e(t),this.loader.load(t,n,r)},u(t,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),t}()}
1,e.createFragmentLoader=function(){var t=this.config.fLoader,e=this.applyFragmentData,n=t||this.config.loader;return function(){function t(t){this.loader=void 0,this.loader=new n(t)}var r=t.prototype;return r.destroy=function(){this.loader.destroy()},r.abort=function(){this.loader.abort()},r.load=function(t,n,r){e(t),this.loader.load(t,n,r)},u(t,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),t}()},t.uuid=function(){var t=URL.createObjectURL(new Blob),e=t.toString();return URL.revokeObjectURL(t),e.substr(e.lastIndexOf("/")+1)},t.serialize=function(t){for(var e,n=[],r=function(t){return!Number.isNaN(t)&&null!=t&&""!==t&&!1!==t},i=function(t){return Math.round(t)},o=function(t){return 100*i(t/100)},a={br:i,d:i,bl:o,dl:o,mtp:o,nor:function(t){return encodeURIComponent(t)},rtp:o,tb:i},s=l(Object.keys(t||{}).sort());!(e=s()).done;){var u=e.value,c=t[u];if(r(c)&&!("v"===u&&1===c||"pr"==u&&1===c)){var f=a[u];f&&(c=f(c));var d=typeof c,h=void 0;h="ot"===u||"sf"===u||"st"===u?u+"="+c:"boolean"===d?u:"number"===d?u+"="+c:u+"="+JSON.stringify(c),n.push(h)}}return n.join(",")},t.toHeaders=function(e){for(var n={},r=["Object","Request","Session","Status"],i=[{},{},{},{}],o={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},a=0,s=Object.keys(e);a<s.length;a++){var u=s[a];i[null!=o[u]?o[u]:1][u]=e[u]}for(var l=0;l<i.length;l++){var c=t.serialize(i[l]);c&&(n["CMCD-"+r[l]]=c)}return n},t.toQuery=function(e){return"CMCD="+encodeURIComponent(t.serialize(e))},t.appendQueryToUri=function(t,e){if(!e)return t;var n=t.includes("?")?"&":"?";return""+t+n+e},t}()},
vendor: 2,293 bytes, line 1
1"./src/controller/eme-controller.ts":function(t,e,n){"use strict";n.r(e);var r=n("./src/events.ts"),i=n("./src/errors.ts"),o=n("./src/utils/logger.ts"),a=n("./src/utils/mediakeys-helper.ts");function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var u=function(){function t(t){this.hls=void 0,this._widevineLicenseUrl=void 0,this._licenseXhrSetup=void 0,this._licenseResponseCallback=void 0,this._emeEnabled=void 0,this._requestMediaKeySystemAccess=void 0,this._drmSystemOptions=void 0,this._config=void 0,this._mediaKeysList=[],this._media=null,this._hasSetMediaKeys=!1,this._requestLicenseFailureCount=0,this.mediaKeysPromise=null,this._onMediaEncrypted=this.onMediaEncrypted.bind(this),this.hls=t,this._config=t.config,this._widevineLicenseUrl=this._config.widevineLicenseUrl,this._licenseXhrSetup=this._config.licenseXhrSetup,this._licenseResponseCallback=this._config.licenseResponseCallback,this._emeEnabled=this._config.emeEnabled,this._requestMediaKeySystemAccess=this._config.requestMediaKeySystemAccessFunc,this._drmSystemOptions=this._config.drmSystemOptions,this._registerListeners()}var e,n,u,l=t.prototype;return l.destroy=function(){this._unregisterListeners(),this.hls=this._onMediaEncrypted=null,this._requestMediaKeySystemAccess=null},l._registerListeners=function(){this.hls.on(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(r.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(r.Events.MANIFEST_PARSED,this.onManifestParsed,this)},l._unregisterListeners=function(){this.hls.off(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(r.Events.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(r.Events.MANIFEST_PARSED,this.onManifestParsed,this)},l.getLicenseServerUrl=function(t){switch(t){case a.KeySystems.WIDEVINE:if(!this._widevineLicenseUrl)break;return this._widevineLicenseUrl}throw new Error('no license server URL configured for key-system "'+t+'"')},l._attemptKeySystemAccess=function(t,e,n){var r=this,i=function(t,e,n,r){switch(t){case a.KeySystems.WIDEVINE:return function(t,e,n){var r={audioCapabilities:[],videoCapabilities:[]};return t.forEach((function(t){r.audioCapabilities.push({contentType:'audio/mp4;
1 codecs="'+t+'"',robustness:n.audioRobustness||""})})),e.forEach((function(t){r.videoCapabilities.push({contentType:'video/mp4; codecs="'+t+'"',robustness:n.videoRobustness||""})})),[r]}(e,n,r);default:throw new Error("Unknown key-system: "+t)}}(t,e,n,this._drmSystemOptions);o.logger.log("Requesting encrypted media key-system access");var s=this.requestMediaKeySystemAccess(t,i);this.mediaKeysPromise=s.then((function(e){return r._onMediaKeySystemAccessObtained(t,e)})),s.catch((function(e){o.logger.error('Failed to obtain key-system "'+t+'" access:',e)}))},l._onMediaKeySystemAccessObtained=function(t,e){var n=this;o.logger.log('Access for key-system "'+t+'" obtained');var r={mediaKeysSessionInitialized:!1,mediaKeySystemAccess:e,mediaKeySystemDomain:t};this._mediaKeysList.push(r);var i=Promise.resolve().then((function(){return e.createMediaKeys()})).then((function(e){return r.mediaKeys=e,o.logger.log('Media-keys created for key-system "'+t+'"'),n._onMediaKeysCreated(),e}));return i.catch((function(t){o.logger.error("Failed to create media-keys:",t)})),i},l._onMediaKeysCreated=function(){var t=this;this._mediaKeysList.forEach((function(e){e.mediaKeysSession||(e.mediaKeysSession=e.mediaKeys.createSession(),t._onNewMediaKeySession(e.mediaKeysSession))}))},l._onNewMediaKeySession=function(t){var e=this;o.logger.log("New key-system session "+t.sessionId),t.addEventListener("message",(function(n){e._onKeySessionMessage(t,n.message)}),!1)},l._onKeySessionMessage=function(t,e){o.logger.log("Got EME message event, creating license request"),this._requestLicense(e,(function(e){o.logger.log("Received license data (length: "+(e?e.byteLength:e)+"), updating key-session"),t.update(e)}))},l.onMediaEncrypted=function(t){var e=this;if(o.logger.log('Media is encrypted using "'+t.initDataType+'" init data type'),!this.mediaKeysPromise)return o.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been requested"),void this.hls.trigger(r.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});var n=function(n){e._media&&(e._attemptSetMediaKeys(n),e._generateRequestWithPreferredKeySession(t.initDataType,t.initData))};this.mediaKeysPromise.then(n).catch(n)},l._attemptSetMediaKeys=function(t){if(!this._media)throw new Error("Attempted to set mediaKeys without first attaching a media element");if(!this._hasSetMediaKeys){var e=this._mediaKeysList[0];if(!e||!e.mediaKeys)return o.logger.error("Fatal: Media is encrypted but no CDM access or no keys have been obtained yet"),void this.hls.trigger(r.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_KEYS,fatal:!0});o.logger.log("Setting keys for encrypted media"),this._media.setMediaKeys(e.mediaKeys),this._hasSetMediaKeys=!0}},l._generateRequestWithPreferredKeySession=function(t,e){var n=this,a=this._mediaKeysList[0];if(!a)return o.logger.error("Fatal: Media is encrypted but not any key-system access has been obtained yet"),void this.hls.trigger(r.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});if(a.mediaKeysSessionInitialized)o.logger.warn("Key-Session already initialized but requested again");else{var s=a.mediaKeysSession;if(!s)return o.logger.error("Fatal: Media is encrypted but no key-session existing"),void this.hls.trigger(r.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!0});if(!e)return o.logger.warn("Fatal: initData required for generating a key session is null"),void this.hls.trigger(r.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_INIT_DATA,fatal:!0});o.logger.log('Generating key-session request for "'+t+'" init data type'),a.mediaKeysSessionInitialized=!0,s.generateRequest(t,e).then((function(){o.logger.debug("Key-session generation succeeded")})).catch((function(t){o.logger.error("Error generating key-session request:",t),n.hls.trigger(r.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_SESSION,fatal:!1})}))}},l._createLicenseXhr=function(t,e,n){var r=new XMLHttpRequest;r.responseType="arraybuffer",r.onreadystatechange=this._onLicenseRequestReadyStageChange.bind(this,r,t,e,n);var i=this._licenseXhrSetup;if(i)try{i.call(this.hls,r,t),i=void 0}catch(t){o.logger.error(t)}try{r.readyState||r.open("POST",t,!0),i&&i.call(this.hls,r,t)}catch(t){throw new Error("issue setting up KeySystem license XHR "+t)}return r},l._onLicenseRequestReadyStageChange=function(t,e,n,a){switch(t.readyState){case 4:if(200===t.status){this._requestLicenseFailureCount=0,o.logger.log("License request succeeded");var s=t.response,u=this._licenseResponseCallback;if(u)try{s=u.call(this.hls,t,e)}catch(t){o.logger.error(t)}a(s)}else{if(o.logger.error("License Request XHR failed ("+e+"). Status: "+t.status+" ("+t.statusText+")"),this._requestLicenseFailureCount++,this._requestLicenseFailureCount>3)return void this.hls.trigger(r.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});var l=3-this._requestLicenseFailureCount+1;o.logger.warn("Retrying license request, "+l+" attempts left"),this._requestLicense(n,a)}}},l._generateLicenseRequestChallenge=function(t,e){switch(t.mediaKeySystemDomain){case a.Ke
vendor: 32,719 bytes, line 1
1ySystems.WIDEVINE:return e}throw new Error("unsupported key-system: "+t.mediaKeySystemDomain)},l._requestLicense=function(t,e){o.logger.log("Requesting content license for key-system");var n=this._mediaKeysList[0];if(!n)return o.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),void this.hls.trigger(r.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});try{var a=this.getLicenseServerUrl(n.mediaKeySystemDomain),s=this._createLicenseXhr(a,t,e);o.logger.log("Sending license request to URL: "+a);var u=this._generateLicenseRequestChallenge(n,t);s.send(u)}catch(t){o.logger.error("Failure requesting DRM license: "+t),this.hls.trigger(r.Events.ERROR,{type:i.ErrorTypes.KEY_SYSTEM_ERROR,details:i.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},l.onMediaAttached=function(t,e){if(this._emeEnabled){var n=e.media;this._media=n,n.addEventListener("encrypted",this._onMediaEncrypted)}},l.onMediaDetached=function(){var t=this._media,e=this._mediaKeysList;t&&(t.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(e.map((function(t){if(t.mediaKeysSession)return t.mediaKeysSession.close().catch((function(){}))}))).then((function(){return t.setMediaKeys(null)})).catch((function(){})))},l.onManifestParsed=function(t,e){if(this._emeEnabled){var n=e.levels.map((function(t){return t.audioCodec})).filter((function(t){return!!t})),r=e.levels.map((function(t){return t.videoCodec})).filter((function(t){return!!t}));this._attemptKeySystemAccess(a.KeySystems.WIDEVINE,n,r)}},e=t,(n=[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}])&&s(e.prototype,n),u&&s(e,u),t}();e.default=u},"./src/controller/fps-controller.ts":function(t,e,n){"use strict";n.r(e);var r=n("./src/events.ts"),i=n("./src/utils/logger.ts"),o=function(){function t(t){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=t,this.registerListeners()}var e=t.prototype;return e.setStreamController=function(t){this.streamController=t},e.registerListeners=function(){this.hls.on(r.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},e.unregisterListeners=function(){this.hls.off(r.Events.MEDIA_ATTACHING,this.onMediaAttaching)},e.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},e.onMediaAttaching=function(t,e){var n=this.hls.config;if(n.capLevelOnFPSDrop){var r=e.media instanceof self.HTMLVideoElement?e.media:null;this.media=r,r&&"function"==typeof r.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),n.fpsDroppedMonitoringPeriod)}},e.checkFPS=function(t,e,n){var o=performance.now();if(e){if(this.lastTime){var a=o-this.lastTime,s=n-this.lastDroppedFrames,u=e-this.lastDecodedFrames,l=1e3*s/a,c=this.hls;if(c.trigger(r.Events.FPS_DROP,{currentDropped:s,currentDecoded:u,totalDroppedFrames:n}),l>0&&s>c.config.fpsDroppedMonitoringThreshold*u){var f=c.currentLevel;i.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+f),f>0&&(-1===c.autoLevelCapping||c.autoLevelCapping>=f)&&(f-=1,c.trigger(r.Events.FPS_DROP_LEVEL_CAPPING,{level:f,droppedLevel:c.currentLevel}),c.autoLevelCapping=f,this.streamController.nextLevelSwitch())}}this.lastTime=o,this.lastDroppedFrames=n,this.lastDecodedFrames=e}},e.checkFPSInterval=function(){var t=this.media;if(t)if(this.isVideoPlaybackQualityAvailable){var e=t.getVideoPlaybackQuality();this.checkFPS(t,e.totalVideoFrames,e.droppedVideoFrames)}else this.checkFPS(t,t.webkitDecodedFrameCount,t.webkitDroppedFrameCount)},t}();e.default=o},"./src/controller/fragment-finders.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"findFragmentByPDT",(function(){return o})),n.d(e,"findFragmentByPTS",(function(){return a})),n.d(e,"fragmentWithinToleranceTest",(function(){return s})),n.d(e,"pdtWithinToleranceTest",(function(){return u})),n.d(e,"findFragWithCC",(function(){return l}));var r=n("./src/polyfills/number.ts"),i=n("./src/utils/binary-search.ts");function o(t,e,n){if(null===e||!Array.isArray(t)||!t.length||!Object(r.isFiniteNumber)(e))return null;if(e<(t[0].programDateTime||0))return null;if(e>=(t[t.length-1].endProgramDateTime||0))return null;n=n||0;for(var i=0;i<t.length;++i){var o=t[i];if(u(e,n,o))return o}return null}function a(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=0);var o=null;if(t?o=e[t.sn-e[0].sn+1]||null:0===n&&0===e[0].start&&(o=e[0]),o&&0===s(n,r,o))return o;var a=i.default.search(e,s.bind(null,n,r));return a||o}function s(t,e,n){void 0===t&&(t=0),void 0===e&&(e=0);var r=Math.min(e,n.duration+(n.deltaPTS?n.deltaPTS:0));return n.start+n.duration-r<=t?1:n.start-r>t&&n.start?-1:0}function u(t,e,n){var r=1e3*Math.min(e,n.duration+(n.deltaPTS?n.deltaPTS:0));return(n.endProgramDateTime||0)-r>t}function l(t,e){return i.default.search(t,(function(t){return t.cc<e?1:t.cc>e?-1:0}))}},"./src/controller/fragment-tracker.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"FragmentState",(function(){return r})),n.d(e,"FragmentTracker",(function(){return a}));var r,i=n("./src/events.ts"),o=n("./src/types/loader.ts");!function(t){t.NOT_LOADED="NOT_LOADED",t.BACKTRACKED="BACKTRACKED",t.APPENDING="APPENDING",t.PARTIAL="PARTIAL",t.OK="OK"}(r||(r={}));var a=function(){function t(t){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=t,this._registerListeners()}var e=t.prototype;return e._registerListeners=function(){var t=this.hls;t.on(i.Events.BUFFER_APPENDED,this.onBufferAppended,this),t.on(i.Events.FRAG_BUFFERED,this.onFragBuffered,this),t.on(i.Events.FRAG_LOADED,this.onFragLoaded,this)},e._unregisterListeners=function(){var t=this.hls;t.off(i.Events.BUFFER_APPENDED,this.onBufferAppended,this),t.off(i.Events.FRAG_BUFFERED,this.onFragBuffered,this),t.off(i.Events.FRAG_LOADED,this.onFragLoaded,this)},e.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},e.getAppendedFrag=function(t,e){if(e===o.PlaylistLevelType.MAIN){var n=this.activeFragment,r=this.activeParts;if(!n)return null;if(r)for(var i=r.length;i--;){var a=r[i],s=a?a.end:n.appendedPTS;if(a.start<=t&&void 0!==s&&t<=s)return i>9&&(this.activeParts=r.slice(i-9)),a}else if(n.start<=t&&void 0!==n.appendedPTS&&t<=n.appendedPTS)return n}return this.getBufferedFrag(t,e)},e.getBufferedFrag=function(t,e){for(var n=this.fragments,r=Object.keys(n),i=r.length;i--;){var o=n[r[i]];if((null==o?void 0:o.body.type)===e&&o.buffered){var a=o.body;if(a.start<=t&&t<=a.end)return a}}return null},e.detectEvictedFragments=function(t,e,n){var r=this;Object.keys(this.fragments).forEach((function(i){var o=r.fragments[i];if(o)if(o.buffered){var a=o.range[t];a&&a.time.some((function(t){var n=!r.isTimeBuffered(t.startPTS,t.endPTS,e);return n&&r.removeFragment(o.body),n}))}else o.body.type===n&&r.removeFragment(o.body)}))},e.detectPartialFragments=function(t){var e=this,n=this.timeRanges,r=t.frag,i=t.part;if(n&&"initSegment"!==r.sn){var o=u(r),a=this.fragments[o];a&&(Object.keys(n).forEach((function(t){var o=r.elementaryStreams[t];if(o){var s=n[t],u=null!==i||!0===o.partial;a.range[t]=e.getBufferedTimes(r,i,u,s)}})),a.backtrack=a.loaded=null,Object.keys(a.range).length?a.buffered=!0:this.removeFragment(a.body))}},e.fragBuffered=function(t){var e=u(t),n=this.fragments[e];n&&(n.backtrack=n.loaded=null,n.buffered=!0)},e.getBufferedTimes=function(t,e,n,r){for(var i={time:[],partial:n},o=e?e.start:t.start,a=e?e.end:t.end,s=t.minEndPTS||a,u=t.maxStartPTS||o,l=0;l<r.length;l++){var c=r.start(l)-this.bufferPadding,f=r.end(l)+this.bufferPadding;if(u>=c&&s<=f){i.time.push({startPTS:Math.max(o,r.start(l)),endPTS:Math.min(a,r.end(l))});break}if(o<f&&a>c)i.partial=!0,i.time.push({startPTS:Math.max(o,r.start(l)),endPTS:Math.min(a,r.end(l))});else if(a<=c)break}return i},e.getPartialFragment=function(t){var e,n,r,i=null,o=0,a=this.bufferPadding,u=this.fragments;return Object.keys(u).forEach((function(l){var c=u[l];c&&s(c)&&(n=c.body.start-a,r=c.body.end+a,t>=n&&t<=r&&(e=Math.min(t-n,r-t),o<=e&&(i=c.body,o=e)))})),i},e.getState=function(t){var e=u(t),n=this.fragments[e];return n?n.buffered?s(n)?r.PARTIAL:r.OK:n.backtrack?r.BACKTRACKED:r.APPENDING:r.NOT_LOADED},e.backtrack=function(t,e){var n=u(t),r=this.fragments[n];if(!r||r.backtrack)return null;var i=r.backtrack=e||r.loaded;return r.loaded=null,i},e.getBacktrackData=function(t){var e=u(t),n=this.fragments[e];if(n){var r,i=n.backtrack;if(null!=i&&null!==(r=i.payload)&&void 0!==r&&r.byteLength)return i;this.removeFragment(t)}return null},e.isTimeBuffered=function(t,e,n){for(var r,i,o=0;o<n.length;o++){if(r=n.start(o)-this.bufferPadding,i=n.end(o)+this.bufferPadding,t>=r&&e<=i)return!0;if(e<=r)return!1}return!1},e.onFragLoaded=function(t,e){var n=e.frag,r=e.part;if("initSegment"!==n.sn&&!n.bitrateTest&&!r){var i=u(n);this.fragments[i]={body:n,loaded:e,backtrack:null,buffered:!1,range:Object.create(null)}}},e.onBufferAppended=function(t,e){var n=this,r=e.frag,i=e.part,a=e.timeRanges;if(r.type===o.PlaylistLevelType.MAIN)if(this.activeFragment=r,i){var s=this.activeParts;s||(this.activeParts=s=[]),s.push(i)}else this.activeParts=null;this.timeRanges=a,Object.keys(a).forEach((function(t){var e=a[t];if(n.detectEvictedFragments(t,e),!i)for(var o=0;o<e.length;o++)r.appendedPTS=Math.max(e.end(o),r.appendedPTS||0)}))},e.onFragBuffered=function(t,e){this.detectPartialFragments(e)},e.hasFragment=function(t){var e=u(t);return!!this.fragments[e]},e.removeFragmentsInRange=function(t,e,n){var r=this;Object.keys(this.fragments).forEach((function(i){var o=r.fragments[i];if(o&&o.buffered){var a=o.body;a.type===n&&a.start<e&&a.end>t&&r.removeFragment(a)}}))},e.removeFragment=function(t){var e=u(t);t.stats.loaded=0,t.clearElementaryStreamInfo(),delete this.fragments[e]},e.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},t}();function s(t){var e,n;return t.buffered&&((null===(e=t.range.video)||void 0===e?void 0:e.partial)||(null===(n=t.range.audio)||void 0===n?void 0:n.partial))}function u(t){return t.type+"_"+t.level+"_"+t.urlId+"_"+t.sn}},"./src/controller/gap-controller.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"STALL_MINIMUM_DURATION_MS",(function(){return s})),n.d(e,"MAX_START_GAP_JUMP",(function(){return u})),n.d(e,"SKIP_BUFFER_HOLE_STEP_SECONDS",(function(){return l})),n.d(e,"SKIP_BUFFER_RANGE_START",(function(){return c})),n.d(e,"default",(function(){return f}));var r=n("./src/utils/buffer-helper.ts"),i=n("./src/errors.ts"),o=n("./src/events.ts"),a=n("./src/utils/logger.ts"),s=250,u=2,l=.1,c=.05,f=function(){function t(t,e,n,r){this.config=void 0,this.media=void 0,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=t,this.media=e,this.fragmentTracker=n,this.hls=r}var e=t.prototype;return e.destroy=function(){this.hls=this.fragmentTracker=this.media=null},e.poll=function(t){var e=this.config,n=this.media,i=this.stalled,o=n.currentTime,l=n.seeking,c=this.seeking&&!l,f=!this.seeking&&l;if(this.seeking=l,o===t){if((f||c)&&(this.stalled=null),!n.paused&&!n.ended&&0!==n.playbackRate&&r.BufferHelper.getBuffered(n).length){var d=r.BufferHelper.bufferInfo(n,o,0),h=d.len>0,p=d.nextStart||0;if(h||p){if(l){var y=d.len>u,v=!p||p-o>u&&!this.fragmentTracker.getPartialFragment(o);if(y||v)return;this.moved=!1}if(!this.moved&&null!==this.stalled){var g,m=Math.max(p,d.start||0)-o,b=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,E=(null==b||null===(g=b.details)||void 0===g?void 0:g.live)?2*b.details.targetduration:u;if(m>0&&m<=E)return void this._trySkipBufferHole(null)}var _=self.performance.now();if(null!==i){var T=_-i;!l&&T>=s&&this._reportStall(d.len);var k=r.BufferHelper.bufferInfo(n,o,e.maxBufferHole);this._tryFixBufferStall(k,T)}else this.stalled=_}}}else if(this.moved=!0,null!==i){if(this.stallReported){var A=self.performance.now()-i;a.logger.warn("playback not stuck anymore @"+o+", after "+Math.round(A)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}},e._tryFixBufferStall=function(t,e){var n=this.config,r=this.fragmentTracker,i=this.media.currentTime,o=r.getPartialFragment(i);o&&this._trySkipBufferHole(o)||t.len>n.maxBufferHole&&e>1e3*n.highBufferWatchdogPeriod&&(a.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())},e._reportStall=function(t){var e=this.hls,n=this.media;this.stallReported||(this.stallReported=!0,a.logger.warn("Playback stalling at @"+n.currentTime+" due to low buffer (buffer="+t+")"),e.trigger(o.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:t}))},e._trySkipBufferHole=function(t){for(var e=this.config,n=this.hls,s=this.media,u=s.currentTime,f=0,d=r.BufferHelper.getBuffered(s),h=0;h<d.length;h++){var p=d.start(h);if(u+e.maxBufferHole>=f&&u<p){var y=Math.max(p+c,s.currentTime+l);return a.logger.warn("skipping hole, adjusting currentTime from "+u+" to "+y),this.moved=!0,this.stalled=null,s.currentTime=y,t&&n.trigger(o.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,reason:"fragment loaded with buffer holes, seeking from "+u+" to "+y,frag:t}),y}f=d.end(h)}return 0},e._tryNudgeBuffer=function(){var t=this.config,e=this.hls,n=this.media,r=n.currentTime,s=(this.nudgeRetry||0)+1;if(this.nudgeRetry=s,s<t.nudgeMaxRetry){var u=r+s*t.nudgeOffset;a.logger.warn("Nudging 'currentTime' from "+r+" to "+u),n.currentTime=u,e.trigger(o.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_NUDGE_ON_STALL,fatal:!1})}else a.logger.error("Playhead still not moving while enough data buffered @"+r+" after "+t.nudgeMaxRetry+" nudges"),e.trigger(o.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!0})},t}()},"./src/controller/id3-track-controller.ts":function(t,e,n){"use strict";n.r(e);var r=n("./src/events.ts"),i=n("./src/utils/texttrack-utils.ts"),o=n("./src/demux/id3.ts"),a=function(){function t(t){this.hls=void 0,this.id3Track=null,this.media=null,this.hls=t,this._registerListeners()}var e=t.prototype;return e.destroy=function(){this._unregisterListeners()},e._registerListeners=function(){var t=this.hls;t.on(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(r.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.on(r.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},e._unregisterListeners=function(){var t=this.hls;t.off(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(r.Events.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.off(r.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},e.onMediaAttached=function(t,e){this.media=e.media},e.onMediaDetaching=function(){this.id3Track&&(Object(i.clearCurrentCues)(this.id3Track),this.id3Track=null,this.media=null)},e.getID3Track=function(t){if(this.media){for(var e=0;e<t.length;e++){var n=t[e];if("metadata"===n.kind&&"id3"===n.label)return Object(i.sendAddTrackEvent)(n,this.media),n}return this.media.addTextTrack("metadata","id3")}},e.onFragParsingMetadata=function(t,e){if(this.media){var n=e.frag,r=e.samples;this.id3Track||(this.id3Track=this.getID3Track(this.media.textTracks),this.id3Track.mode="hidden");for(var i=self.WebKitDataCue||self.VTTCue||self.TextTrackCue,a=0;a<r.length;a++){var s=o.getID3Frames(r[a].data);if(s){var u=r[a].pts,l=a<r.length-1?r[a+1].pts:n.end;l-u<=0&&(l=u+.25);for(var c=0;c<s.length;c++){var f=s[c];if(!o.isTimeStampFrame(f)){var d=new i(u,l,"");d.value=f,this.id3Track.addCue(d)}}}}}},e.onBufferFlushing=function(t,e){var n=e.startOffset,r=e.endOffset,o=e.type;if(!o||"audio"===o){var a=this.id3Track;a&&Object(i.removeCuesInRange)(a,n,r)}},t}();e.default=a},"./src/controller/latency-controller.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return s}));var r=n("./src/errors.ts"),i=n("./src/events.ts"),o=n("./src/utils/logger.ts");function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var s=function(){function t(t){var e=this;this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=function(){return e.timeupdate()},this.hls=t,this.config=t.config,this.registerListeners()}var e,n,s,u=t.prototype;return u.destroy=function(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null},u.registerListeners=function(){this.hls.on(i.Events.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(i.Events.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(i.Events.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(i.Events.ERROR,this.onError,this)},u.unregisterListeners=function(){this.hls.off(i.Events.MEDIA_ATTACHED,this.onMediaAttached),this.hls.off(i.Events.MEDIA_DETACHING,this.onMediaDetaching),this.hls.off(i.Events.MANIFEST_LOADING,this.onManifestLoading),this.hls.off(i.Events.LEVEL_UPDATED,this.onLevelUpdated),this.hls.off(i.Events.ERROR,this.onError)},u.onMediaAttached=function(t,e){this.media=e.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)},u.onMediaDetaching=function(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)},u.onManifestLoading=function(){this.levelDetails=null,this._latency=null,this.stallCount=0},u.onLevelUpdated=function(t,e){var n=e.details;this.levelDetails=n,n.advanced&&this.timeupdate(),!n.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)},u.onError=function(t,e){e.details===r.ErrorDetails.BUFFER_STALLED_ERROR&&(this.stallCount++,o.logger.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))},u.timeupdate=function(){var t=this.media,e=this.levelDetails;if(t&&e){this.currentTime=t.currentTime;var n=this.computeLatency();if(null!==n){this._latency=n;var r=this.config,i=r.lowLatencyMode,o=r.maxLiveSyncPlaybackRate;if(i&&1!==o){var a=this.targetLatency;if(null!==a){var s=n-a,u=s<Math.min(this.maxLatency,a+e.targetduration);if(e.live&&u&&s>.05&&this.forwardBufferLength>1){var l=Math.min(2,Math.max(1,o)),c=Math.round(2/(1+Math.exp(-.75*s-this.edgeStalled))*20)/20;t.playbackRate=Math.min(l,Math.max(1,c))}else 1!==t.playbackRate&&0!==t.playbackRate&&(t.playbackRate=1)}}}}},u.estimateLiveEdge=function(){var t=this.levelDetails;return null===t?null:t.edge+t.age},u.computeLatency=function(){var t=this.estimateLiveEdge();return null===t?null:t-this.currentTime},e=t,(n=[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var t=this.config,e=this.levelDetails;return void 0!==t.liveMaxLatencyDuration?t.liveMaxLatencyDuration:e?t.liveMaxLatencyDurationCount*e.targetduration:0}},{key:"targetLatency",get:function(){var t=this.levelDetails;if(null===t)return null;var e=t.holdBack,n=t.partHoldBack,r=t.targetduration,i=this.config,o=i.liveSyncDuration,a=i.liveSyncDurationCount,s=i.lowLatencyMode,u=this.hls.userConfig,l=s&&n||e;(u.liveSyncDuration||u.liveSyncDurationCount||0===l)&&(l=void 0!==o?o:a*r);var c=r;return l+Math.min(1*this.stallCount,c)}},{key:"liveSyncPosition",get:function(){var t=this.estimateLiveEdge(),e=this.targetLatency,n=this.levelDetails;if(null===t||null===e||null===n)return null;var r=n.edge,i=t-e-this.edgeStalled,o=r-n.totalduration,a=r-(this.config.lowLatencyMode&&n.partTarget||n.targetduration);return Math.min(Math.max(o,i),a)}},{key:"drift",get:function(){var t=this.levelDetails;return null===t?1:t.drift}},{key:"edgeStalled",get:function(){var t=this.levelDetails;if(null===t)return 0;var e=3*(this.config.lowLatencyMode&&t.partTarget||t.targetduration);return Math.max(t.age-e,0)}},{key:"forwardBufferLength",get:function(){var t=this.media,e=this.levelDetails;if(!t||!e)return 0;var n=t.buffered.length;return n?t.buffered.end(n-1):e.edge-this.currentTime}}])&&a(e.prototype,n),s&&a(e,s),t}()},"./src/controller/level-controller.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return p}));var r=n("./src/types/level.ts"),i=n("./src/events.ts"),o=n("./src/errors.ts"),a=n("./src/utils/codecs.ts"),s=n("./src/controller/level-helper.ts"),u=n("./src/controller/base-playlist-controller.ts"),l=n("./src/types/loader.ts");function c(){return(c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function f(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function d(t,e){return(d=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var h=/chrome|firefox/.test(navigator.userAgent.toLowerCase()),p=function(t){var e,n;function u(e){var n;return(n=t.call(this,e,"[level-controller]")||this)._levels=[],n._firstLevel=-1,n._startLevel=void 0,n.currentLevelIndex=-1,n.manualLevelIndex=-1,n.onParsedComplete=void 0,n._registerListeners(),n}n=t,(e=u).prototype=Object.create(n.prototype),e.prototype.constructor=e,d(e,n);var p,y,v,g=u.prototype;return g._registerListeners=function(){var t=this.hls;t.on(i.Events.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(i.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.on(i.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(i.Events.FRAG_LOADED,this.onFragLoaded,this),t.on(i.Events.ERROR,this.onError,this)},g._unregisterListeners=function(){var t=this.hls;t.off(i.Events.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(i.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.off(i.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(i.Events.FRAG_LOADED,this.onFragLoaded,this),t.off(i.Events.ERROR,this.onError,this)},g.destroy=function(){this._unregisterListeners(),this.manualLevelIndex=-1,this._levels.length=0,t.prototype.destroy.call(this)},g.startLoad=function(){this._levels.forEach((function(t){t.loadError=0})),t.prototype.startLoad.call(this)},g.onManifestLoaded=function(t,e){var n,u,l=[],c=[],f=[],d={},p=!1,y=!1,v=!1;if(e.levels.forEach((function(t){var e=t.attrs;p=p||!(!t.width||!t.height),y=y||!!t.videoCodec,v=v||!!t.audioCodec,h&&t.audioCodec&&-1!==t.audioCodec.indexOf("mp4a.40.34")&&(t.audioCodec=void 0);var n=t.bitrate+"-"+t.attrs.RESOLUTION+"-"+t.attrs.CODECS;(u=d[n])?u.url.push(t.url):(u=new r.Level(t),d[n]=u,l.push(u)),e&&(e.AUDIO&&Object(s.addGroupId)(u,"audio",e.AUDIO),e.SUBTITLES&&Object(s.addGroupId)(u,"text",e.SUBTITLES))})),(p||y)&&v&&(l=l.filter((function(t){var e=t.videoCodec,n=t.width,r=t.height;return!!e||!(!n||!r)}))),l=l.filter((function(t){var e=t.audioCodec,n=t.videoCodec;return(!e||Object(a.isCodecSupportedInMp4)(e,"audio"))&&(!n||Object(a.isCodecSupportedInMp4)(n,"video"))})),e.audioTracks&&(c=e.audioTracks.filter((function(t){return!t.audioCodec||Object(a.isCodecSupportedInMp4)(t.audioCodec,"audio")})),Object(s.assignTrackIdsByGroup)(c)),e.subtitles&&(f=e.subtitles,Object(s.assignTrackIdsByGroup)(f)),l.length>0){n=l[0].bitrate,l.sort((function(t,e){return t.bitrate-e.bitrate})),this._levels=l;for(var g=0;g<l.length;g++)if(l[g].bitrate===n){this._firstLevel=g,this.log("manifest loaded, "+l.length+" level(s) found, first bitrate: "+n);break}var m=v&&!y,b={levels:l,audioTracks:c,subtitleTracks:f,firstLevel:this._firstLevel,stats:e.stats,audio:v,video:y,altAudio:!m&&c.some((function(t){return!!t.url}))};this.hls.trigger(i.Events.MANIFEST_PARSED,b),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else this.hls.trigger(i.Events.ERROR,{type:o.ErrorTypes.MEDIA_ERROR,details:o.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:e.url,reason:"no level with compatible codecs found in manifest"})},g.onError=function(e,n){if(t.prototype.onError.call(this,e,n),!n.fatal){var r=n.context,i=this._levels[this.currentLevelIndex];if(r&&(r.type===l.PlaylistContextType.AUDIO_TRACK&&i.audioGroupIds&&r.groupId===i.audioGroupIds[i.urlId]||r.type===l.PlaylistContextType.SUBTITLE_TRACK&&i.textGroupIds&&r.groupId===i.textGroupIds[i.urlId]))this.redundantFailover(this.currentLevelIndex);else{var a,s=!1,u=!0;switch(n.details){case o.ErrorDetails.FRAG_LOAD_ERROR:case o.ErrorDetails.FRAG_LOAD_TIMEOUT:case o.ErrorDetails.KEY_LOAD_ERROR:case o.ErrorDetails.KEY_LOAD_TIMEOUT:if(n.frag){var c=this._levels[n.frag.level];c?(c.fragmentError++,c.fragmentError>this.hls.config.fragLoadingMaxRetry&&(a=n.frag.level)):a=n.frag.level}break;case o.ErrorDetails.LEVEL_LOAD_ERROR:case o.ErrorDetails.LEVEL_LOAD_TIMEOUT:r&&(r.deliveryDirectives&&(u=!1),a=r.level),s=!0;break;case o.ErrorDetails.REMUX_ALLOC_ERROR:a=n.level,s=!0}void 0!==a&&this.recoverLevel(n,a,s,u)}}},g.recoverLevel=function(t,e,n,r){var i=t.details,o=this._levels[e];if(o.loadError++,n){if(!this.retryLoadingOrFail(t))return void(this.currentLevelIndex=-1);t.levelRetry=!0}if(r){var a=o.url.length;if(a>1&&o.loadError<a)t.levelRetry=!0,this.redundantFailover(e);else if(-1===this.manualLevelIndex){var s=0===e?this._levels.length-1:e-1;this.currentLevelIndex!==s&&0===this._levels[s].loadError&&(this.warn(i+": switch to "+s),t.levelRetry=!0,this.hls.nextAutoLevel=s)}}},g.redundantFailover=function(t){var e=this._levels[t],n=e.url.length;if(n>1){var r=(e.urlId+1)%n;this.warn("Switching to redundant URL-id "+r),this._levels.forEach((function(t){t.urlId=r})),this.level=t}},g.onFragLoaded=function(t,e){var n=e.frag;if(void 0!==n&&n.type===l.PlaylistLevelType.MAIN){var r=this._levels[n.level];void 0!==r&&(r.fragmentError=0,r.loadError=0)}},g.onLevelLoaded=function(t,e){var n,r,i=e.level,o=e.details,a=this._levels[i];if(!a)return this.warn("Invalid level index "+i),void(null!==(r=e.deliveryDirectives)&&void 0!==r&&r.skip&&(o.deltaUpdateFailed=!0));i===this.currentLevelIndex?(0===a.fragmentError&&(a.loadError=0,this.retryCount=0),this.playlistLoaded(i,e,a.details)):null!==(n=e.deliveryDirectives)&&void 0!==n&&n.skip&&(o.deltaUpdateFailed=!0)},g.onAudioTrackSwitched=function(t,e){var n=this.hls.levels[this.currentLevelIndex];if(n&&n.audioGroupIds){for(var r=-1,i=this.hls.audioTracks[e.id].groupId,o=0;o<n.audioGroupIds.length;o++)if(n.audioGroupIds[o]===i){r=o;break}r!==n.urlId&&(n.urlId=r,this.startLoad())}},g.loadPlaylist=function(t){var e=this.currentLevelIndex,n=this._levels[e];if(this.canLoad&&n&&n.url.length>0){var r=n.urlId,o=n.url[r];if(t)try{o=t.addDirectives(o)}catch(t){this.warn("Could not construct new URL with HLS Delivery Directives: "+t)}this.log("Attempt loading level index "+e+(t?" at sn "+t.msn+" part "+t.part:"")+" with URL-id "+r+" "+o),this.clearTimer(),this.hls.trigger(i.Events.LEVEL_LOADING,{url:o,level:e,id:r,deliveryDirectives:t||null})}},g.removeLevel=function(t,e){var n=function(t,n){return n!==e},r=this._levels.filter((function(r,i){return i!==t||r.url.length>1&&void 0!==e&&(r.url=r.url.filter(n),r.audioGroupIds&&(r.audioGroupIds=r.audioGroupIds.filter(n)),r.textGroupIds&&(r.textGroupIds=r.textGroupIds.filter(n)),r.urlId=0,!0)})).map((function(t,e){var n=t.details;return null!=n&&n.fragments&&n.fragments.forEach((function(t){t.level=e})),t}));this._levels=r,this.hls.trigger(i.Events.LEVELS_UPDATED,{levels:r})},p=u,(y=[{key:"levels",get:function(){return 0===this._levels.length?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(t){var e,n=this._levels;if(0!==n.length&&(this.currentLevelIndex!==t||null===(e=n[t])||void 0===e||!e.details)){if(t<0||t>=n.length){var r=t<0;if(this.hls.trigger(i.Events.ERROR,{type:o.ErrorTypes.OTHER_ERROR,details:o.ErrorDetails.LEVEL_SWITCH_ERROR,level:t,fatal:r,reason:"invalid level idx"}),r)return;t=Math.min(t,n.length-1)}this.clearTimer();var a=this.currentLevelIndex,s=n[a],u=n[t];this.log("switching to level "+t+" from "+a),this.currentLevelIndex=t;var l=c({},u,{level:t,maxBitrate:u.maxBitrate,uri:u.uri,urlId:u.urlId});delete l._urlId,this.hls.trigger(i.Events.LEVEL_SWITCHING,l);var f=u.details;if(!f||f.live){var d=this.switchParams(u.uri,null==s?void 0:s.details);this.loadPlaylist(d)}}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(t){this.manualLevelIndex=t,void 0===this._startLevel&&(this._startLevel=t),-1!==t&&(this.level=t)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(t){this._firstLevel=t}},{key:"startLevel",get:function(){if(void 0===this._startLevel){var t=this.hls.config.startLevel;return void 0!==t?t:this._firstLevel}return this._startLevel},set:function(t){this._startLevel=t}},{key:"nextLoadLevel",get:function(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(t){this.level=t,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=t)}}])&&f(p.prototype,y),v&&f(p,v),u}(u.default)},"./src/controller/level-helper.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"addGroupId",(function(){return o})),n.d(e,"assignTrackIdsByGroup",(function(){return a})),n.d(e,"updatePTS",(function(){return s})),n.d(e,"updateFragPTSDTS",(function(){return l})),n.d(e,"mergeDetails",(function(){return c})),n.d(e,"mapPartIntersection",(function(){return f})),n.d(e,"mapFragmentIntersection",(function(){return d})),n.d(e,"adjustSliding",(function(){return h})),n.d(e,"addSliding",(function(){return p})),n.d(e,"computeReloadInterval",(function(){return y})),n.d(e,"getFragmentWithSN",(function(){return v})),n.d(e,"getPartWith",(function(){return g}));var r=n("./src/polyfills/number.ts"),i=n("./src/utils/logger.ts");function o(t,e,n){switch(e){case"audio":t.audioGroupIds||(t.audioGroupIds=[]),t.audioGroupIds.push(n);break;case"text":t.textGroupIds||(t.textGroupIds=[]),t.textGroupIds.push(n)}}function a(t){var e={};t.forEach((function(t){var n=t.groupId||"";t.id=e[n]=e[n]||0,e[n]++}))}function s(t,e,n){u(t[e],t[n])}function u(t,e){var n=e.startPTS;if(Object(r.isFiniteNumber)(n)){var i,o=0;e.sn>t.sn?(o=n-t.start,i=t):(o=t.start-n,i=e),i.duration!==o&&(i.duration=o)}else e.sn>t.sn?t.cc===e.cc&&t.minEndPTS?e.start=t.start+(t.minEndPTS-t.start):e.start=t.start+t.duration:e.start=Math.max(t.start-e.duration,0)}function l(t,e,n,o,a,s){o-n<=0&&(i.logger.warn("Fragment should have a positive duration",e),o=n+e.duration,s=a+e.duration);var l=n,c=o,f=e.startPTS,d=e.endPTS;if(Object(r.isFiniteNumber)(f)){var h=Math.abs(f-n);Object(r.isFiniteNumber)(e.deltaPTS)?e.deltaPTS=Math.max(h,e.deltaPTS):e.deltaPTS=h,l=Math.max(n,f),n=Math.min(n,f),a=Math.min(a,e.startDTS),c=Math.min(o,d),o=Math.max(o,d),s=Math.max(s,e.endDTS)}e.duration=o-n;var p=n-e.start;e.appendedPTS=o,e.start=e.startPTS=n,e.maxStartPTS=l,e.startDTS=a,e.endPTS=o,e.minEndPTS=c,e.endDTS=s;var y,v=e.sn;if(!t||v<t.startSN||v>t.endSN)return 0;var g=v-t.startSN,m=t.fragments;for(m[g]=e,y=g;y>0;y--)u(m[y],m[y-1]);for(y=g;y<m.length-1;y++)u(m[y],m[y+1]);return t.fragmentHint&&u(m[m.length-1],t.fragmentHint),t.PTSKnown=t.alignedSliding=!0,p}function c(t,e){for(var n=null,o=t.fragments,a=o.length-1;a>=0;a--){var s=o[a].initSegment;if(s){n=s;break}}t.fragmentHint&&delete t.fragmentHint.endPTS;var u,c=0;if(d(t,e,(function(t,i){t.relurl&&(c=t.cc-i.cc),Object(r.isFiniteNumber)(t.startPTS)&&Object(r.isFiniteNumber)(t.endPTS)&&(i.start=i.startPTS=t.startPTS,i.startDTS=t.startDTS,i.appendedPTS=t.appendedPTS,i.maxStartPTS=t.maxStartPTS,i.endPTS=t.endPTS,i.endDTS=t.endDTS,i.minEndPTS=t.minEndPTS,i.duration=t.endPTS-t.startPTS,i.duration&&(u=i),e.PTSKnown=e.alignedSliding=!0),i.elementaryStreams=t.elementaryStreams,i.loader=t.loader,i.stats=t.stats,i.urlId=t.urlId,t.initSegment&&(i.initSegment=t.initSegment,n=t.initSegment)})),n&&(e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments).forEach((function(t){var e;t.initSegment&&t.initSegment.relurl!==(null===(e=n)||void 0===e?void 0:e.relurl)||(t.initSegment=n)})),e.skippedSegments&&(e.deltaUpdateFailed=e.fragments.some((function(t){return!t})),e.deltaUpdateFailed)){i.logger.warn("[level-helper] Previous playlist missing segments ski
1pped in delta playlist");for(var p=e.skippedSegments;p--;)e.fragments.shift();e.startSN=e.fragments[0].sn,e.startCC=e.fragments[0].cc}var y=e.fragments;if(c){i.logger.warn("discontinuity sliding from playlist, take drift into account");for(var v=0;v<y.length;v++)y[v].cc+=c}e.skippedSegments&&(e.startCC=e.fragments[0].cc),f(t.partList,e.partList,(function(t,e){e.elementaryStreams=t.elementaryStreams,e.stats=t.stats})),u?l(e,u,u.startPTS,u.endPTS,u.startDTS,u.endDTS):h(t,e),y.length&&(e.totalduration=e.edge-y[0].start),e.driftStartTime=t.driftStartTime,e.driftStart=t.driftStart;var g=e.advancedDateTime;if(e.advanced&&g){var m=e.edge;e.driftStart||(e.driftStartTime=g,e.driftStart=m),e.driftEndTime=g,e.driftEnd=m}else e.driftEndTime=t.driftEndTime,e.driftEnd=t.driftEnd,e.advancedDateTime=t.advancedDateTime}function f(t,e,n){if(t&&e)for(var r=0,i=0,o=t.length;i<=o;i++){var a=t[i],s=e[i+r];a&&s&&a.index===s.index&&a.fragment.sn===s.fragment.sn?n(a,s):r--}}function d(t,e,n){for(var r=e.skippedSegments,i=Math.max(t.startSN,e.startSN)-e.startSN,o=(t.fragmentHint?1:0)+(r?e.endSN:Math.min(t.endSN,e.endSN))-e.startSN,a=e.startSN-t.startSN,s=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,u=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,l=i;l<=o;l++){var c=u[a+l],f=s[l];r&&!f&&l<r&&(f=e.fragments[l]=c),c&&f&&n(c,f)}}function h(t,e){var n=e.startSN+e.skippedSegments-t.startSN,r=t.fragments;n<0||n>=r.length||p(e,r[n].start)}function p(t,e){if(e){for(var n=t.fragments,r=t.skippedSegments;r<n.length;r++)n[r].start+=e;t.fragmentHint&&(t.fragmentHint.start+=e)}}function y(t,e){var n,r=1e3*t.levelTargetDuration,i=r/2,o=t.age,a=o>0&&o<3*r,s=e.loading.end-e.loading.start,u=t.availabilityDelay;if(!1===t.updated)if(a){var l=333*t.misses;n=Math.max(Math.min(i,2*s),l),t.availabilityDelay=(t.availabilityDelay||0)+n}else n=i;else a?(u=Math.min(u||r/2,o),t.availabilityDelay=u,n=u+r-o):n=r-s;return Math.round(n)}function v(t,e,n){if(!t||!t.details)return null;var r=t.details,i=r.fragments[e-r.startSN];return i||((i=r.fragmentHint)&&i.sn===e?i:e<r.startSN&&n&&n.sn===e?n:null)}function g(t,e,n){if(!t||!t.details)return null;var r=t.details.partList;if(r)for(var i=r.length;i--;){var o=r[i];if(o.index===n&&o.fragment.sn===e)return o}return null}},
vendor: 44,537 bytes, line 1
1"./src/controller/stream-controller.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return m}));var r=n("./src/polyfills/number.ts"),i=n("./src/controller/base-stream-controller.ts"),o=n("./src/is-supported.ts"),a=n("./src/events.ts"),s=n("./src/utils/buffer-helper.ts"),u=n("./src/controller/fragment-tracker.ts"),l=n("./src/types/loader.ts"),c=n("./src/loader/fragment.ts"),f=n("./src/demux/transmuxer-interface.ts"),d=n("./src/types/transmuxer.ts"),h=n("./src/controller/gap-controller.ts"),p=n("./src/errors.ts"),y=n("./src/utils/logger.ts");function v(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function g(t,e){return(g=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var m=function(t){var e,n;function m(e,n){var r;return(r=t.call(this,e,n,"[stream-controller]")||this).audioCodecSwap=!1,r.gapController=null,r.level=-1,r._forceStartLoad=!1,r.altAudio=!1,r.audioOnly=!1,r.fragPlaying=null,r.onvplaying=null,r.onvseeked=null,r.fragLastKbps=0,r.stalled=!1,r.couldBacktrack=!1,r.audioCodecSwitch=!1,r.videoBuffer=null,r._registerListeners(),r}n=t,(e=m).prototype=Object.create(n.prototype),e.prototype.constructor=e,g(e,n);var b,E,_,T=m.prototype;return T._registerListeners=function(){var t=this.hls;t.on(a.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(a.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(a.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(a.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.on(a.Events.LEVEL_LOADING,this.onLevelLoading,this),t.on(a.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.on(a.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.on(a.Events.ERROR,this.onError,this),t.on(a.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(a.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(a.Events.BUFFER_CREATED,this.onBufferCreated,this),t.on(a.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(a.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(a.Events.FRAG_BUFFERED,this.onFragBuffered,this)},T._unregisterListeners=function(){var t=this.hls;t.off(a.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(a.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(a.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(a.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.off(a.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.off(a.Events.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.off(a.Events.ERROR,this.onError,this),t.off(a.Events.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(a.Events.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(a.Events.BUFFER_CREATED,this.onBufferCreated,this),t.off(a.Events.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(a.Events.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(a.Events.FRAG_BUFFERED,this.onFragBuffered,this)},T.onHandlerDestroying=function(){this._unregisterListeners(),this.onMediaDetaching()},T.startLoad=function(t){if(this.levels){var e=this.lastCurrentTime,n=this.hls;if(this.stopLoad(),this.setInterval(100),this.level=-1,this.fragLoadError=0,!this.startFragRequested){var r=n.startLevel;-1===r&&(n.config.testBandwidth?(r=0,this.bitrateTest=!0):r=n.nextAutoLevel),this.level=n.nextLoadLevel=r,this.loadedmetadata=!1}e>0&&-1===t&&(this.log("Override startPosition with lastCurrentTime @"+e.toFixed(3)),t=e),this.state=i.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()}else this._forceStartLoad=!0,this.state=i.State.STOPPED},T.stopLoad=function(){this._forceStartLoad=!1,t.prototype.stopLoad.call(this)},T.doTick=function(){switch(this.state){case i.State.IDLE:this.doTickIdle();break;case i.State.WAITING_LEVEL:var t,e=this.levels,n=this.level,r=null==e||null===(t=e[n])||void 0===t?void 0:t.details;if(r&&(!r.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(r))break;this.state=i.State.IDLE;break}break;case i.State.FRAG_LOADING_WAITING_RETRY:var o,a=self.performance.now(),s=this.retryDate;(!s||a>=s||null!==(o=this.media)&&void 0!==o&&o.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.state=i.State.IDLE)}this.onTickEnd()},T.onTickEnd=function(){t.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},T.doTickIdle=function(){var t,e,n=this.hls,r=this.levelLastLoaded,o=this.levels,s=this.media,f=n.config,d=n.nextLoadLevel;if(null!==r&&(s||!this.startFragRequested&&f.startFragPrefetch)&&(!this.altAudio||!this.audioOnly)&&o&&o[d]){var h=o[d];this.level=n.nextLoadLevel=d;var p=h.details;if(!p||this.state===i.State.WAITING_LEVEL||p.live&&this.levelLastLoaded!==d)this.state=i.State.WAITING_LEVEL;else{var y=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:s,l.PlaylistLevelType.MAIN);if(null!==y&&!(y.len>=this.getMaxBufferLength(h.maxBitrate))){if(this._streamEnded(y,p)){var v={};return this.altAudio&&(v.type="video"),this.hls.trigger(a.Events.BUFFER_EOS,v),void(this.state=i.State.ENDED)}var g=y.end,m=this.getNextFragment(g,p);if(this.couldBacktrack&&!this.fragPrevious&&m&&"initSegment"!==m.sn){var b=m.sn-p.startSN;b>1&&(m=p.fragments[b-1],this.fragmentTracker.removeFragment(m))}if(m&&this.fragmentTracker.getState(m)===u.FragmentState.OK&&this.nextLoadPosition>g){var E=this.audioOnly&&!this.altAudio?c.ElementaryStreamTypes.AUDIO:c.ElementaryStreamTypes.VIDEO;this.afterBufferFlushed(s,E,l.PlaylistLevelType.MAIN),m=this.getNextFragment(this.nextLoadPosition,p)}m&&(!m.initSegment||m.initSegment.data||this.bitrateTest||(m=m.initSegment),"identity"!==(null===(t=m.decryptdata)||void 0===t?void 0:t.keyFormat)||null!==(e=m.decryptdata)&&void 0!==e&&e.key?this.loadFragment(m,p,g):this.loadKey(m,p))}}}},T.loadFragment=function(e,n,r){var i,o=this.fragmentTracker.getState(e);if(this.fragCurrent=e,o===u.FragmentState.BACKTRACKED){var a=this.fragmentTracker.getBacktrackData(e);if(a)return this._handleFragmentLoadProgress(a),void this._handleFragmentLoadComplete(a);o=u.FragmentState.NOT_LOADED}o===u.FragmentState.NOT_LOADED||o===u.FragmentState.PARTIAL?"initSegment"===e.sn?this._loadInitSegment(e):this.bitrateTest?(e.bitrateTest=!0,this.log("Fragment "+e.sn+" of level "+e.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(e)):(this.startFragRequested=!0,t.prototype.loadFragment.call(this,e,n,r)):o===u.FragmentState.APPENDING?this.reduceMaxBufferLength(e.duration)&&this.fragmentTracker.removeFragment(e):0===(null===(i=this.media)||void 0===i?void 0:i.buffered.length)&&this.fragmentTracker.removeAllFragments()},T.getAppendedFrag=function(t){var e=this.fragmentTracker.getAppendedFrag(t,l.PlaylistLevelType.MAIN);return e&&"fragment"in e?e.fragment:e},T.getBufferedFrag=function(t){return this.fragmentTracker.getBufferedFrag(t,l.PlaylistLevelType.MAIN)},T.followingBufferedFrag=function(t){return t?this.getBufferedFrag(t.end+.5):null},T.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},T.nextLevelSwitch=function(){var t=this.levels,e=this.media;if(null!=e&&e.readyState){var n,r=this.getAppendedFrag(e.currentTime);if(r&&r.start>1&&this.flushMainBuffer(0,r.start-1),!e.paused&&t){var i=t[this.hls.nextLoadLevel],o=this.fragLastKbps;n=o&&this.fragCurrent?this.fragCurrent.duration*i.maxBitrate/(1e3*o)+1:0}else n=0;var a=this.getBufferedFrag(e.currentTime+n);if(a){var s=this.followingBufferedFrag(a);if(s){this.abortCurrentFrag();var u=s.maxStartPTS?s.maxStartPTS:s.start,l=s.duration,c=Math.max(a.end,u+Math.min(Math.max(l-this.config.maxFragLookUpTolerance,.5*l),.75*l));this.flushMainBuffer(c,Number.POSITIVE_INFINITY)}}}},T.abortCurrentFrag=function(){var t=this.fragCurrent;this.fragCurrent=null,null!=t&&t.loader&&t.loader.abort(),this.state===i.State.KEY_LOADING&&(this.state=i.State.IDLE),this.nextLoadPosition=this.getLoadPosition()},T.flushMainBuffer=function(e,n){t.prototype.flushMainBuffer.call(this,e,n,this.altAudio?"video":null)},T.onMediaAttached=function(e,n){t.prototype.onMediaAttached.call(this,e,n);var r=n.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),r.addEventListener("playing",this.onvplaying),r.addEventListener("seeked",this.onvseeked),this.gapController=new h.default(this.config,r,this.fragmentTracker,this.hls)},T.onMediaDetaching=function(){var e=this.media;e&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),t.prototype.onMediaDetaching.call(this)},T.onMediaPlaying=function(){this.tick()},T.onMediaSeeked=function(){var t=this.media,e=t?t.currentTime:null;Object(r.isFiniteNumber)(e)&&this.log("Media seeked to "+e.toFixed(3)),this.tick()},T.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(a.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=this.stalled=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null},T.onManifestParsed=function(t,e){var n,r=!1,i=!1;e.levels.forEach((function(t){(n=t.audioCodec)&&(-1!==n.indexOf("mp4a.40.2")&&(r=!0),-1!==n.indexOf("mp4a.40.5")&&(i=!0))})),this.audioCodecSwitch=r&&i&&!Object(o.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=e.levels,this.startFragRequested=!1},T.onLevelLoading=function(t,e){var n=this.levels;if(n&&this.state===i.State.IDLE){var r=n[e.level];(!r.details||r.details.live&&this.levelLastLoaded!==e.level||this.waitForCdnTuneIn(r.details))&&(this.state=i.State.WAITING_LEVEL)}},T.onLevelLoaded=function(t,e){var n,r=this.levels,o=e.level,s=e.details,u=s.totalduration;if(r){this.log("Level "+o+" loaded ["+s.startSN+","+s.endSN+"], cc ["+s.startCC+", "+s.endCC+"] duration:"+u);var l=this.fragCurrent;!l||this.state!==i.State.FRAG_LOADING&&this.state!==i.State.FRAG_LOADING_WAITING_RETRY||l.level!==e.level&&l.loader&&(this.state=i.State.IDLE,l.loader.abort());var c=r[o],f=0;if(s.live||null!==(n=c.details)&&void 0!==n&&n.live){if(s.fragments[0]||(s.deltaUpdateFailed=!0),s.deltaUpdateFailed)return;f=this.alignPlaylists(s,c.details)}if(c.details=s,this.levelLastLoaded=o,this.hls.trigger(a.Events.LEVEL_UPDATED,{details:s,level:o}),this.state===i.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(s))return;this.state=i.State.IDLE}this.startFragRequested?s.live&&this.synchronizeToLiveEdge(s):this.setStartPosition(s,f),this.tick()}else this.warn("Levels were reset while loading level "+o)},T._handleFragmentLoadProgress=function(t){var e,n=t.frag,r=t.part,i=t.payload,o=this.levels;if(o){var a=o[n.level],s=a.details;if(s){var u=a.videoCodec,c=s.PTSKnown||!s.live,h=null===(e=n.initSegment)||void 0===e?void 0:e.data,p=this._getAudioCodec(a),y=this.transmuxer=this.transmuxer||new f.default(this.hls,l.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),v=r?r.index:-1,g=-1!==v,m=new d.ChunkMetadata(n.level,n.sn,n.stats.chunkCount,i.byteLength,v,g),b=this.initPTS[n.cc];y.push(i,h,p,u,n,r,s.totalduration,c,m,b)}else this.warn("Dropping fragment "+n.sn+" of level "+n.level+" after level details were reset")}else this.warn("Levels were reset while fragment load was in progress. Fragment "+n.sn+" of level "+n.level+" will not be buffered")},T.onAudioTrackSwitching=function(t,e){var n=this.altAudio,r=!!e.url,i=e.id;if(!r){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var o=this.fragCurrent;null!=o&&o.loader&&(this.log("Switching to main audio track, cancel main fragment load"),o.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var s=this.hls;n&&s.trigger(a.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),s.trigger(a.Events.AUDIO_TRACK_SWITCHED,{id:i})}},T.onAudioTrackSwitched=function(t,e){var n=e.id,r=!!this.hls.audioTracks[n].url;if(r){var i=this.videoBuffer;i&&this.mediaBuffer!==i&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=i)}this.altAudio=r,this.tick()},T.onBufferCreated=function(t,e){var n,r,i=e.tracks,o=!1;for(var a in i){var s=i[a];if("main"===s.id){if(r=a,n=s,"video"===a){var u=i[a];u&&(this.videoBuffer=u.buffer)}}else o=!0}o&&n?(this.log("Alternate track found, use "+r+".buffered to schedule main fragment loading"),this.mediaBuffer=n.buffer):this.mediaBuffer=this.media},T.onFragBuffered=function(t,e){var n=e.frag,r=e.part;if(!n||n.type===l.PlaylistLevelType.MAIN){if(this.fragContextChanged(n))return this.warn("Fragment "+n.sn+(r?" p: "+r.index:"")+" of level "+n.level+" finished buffering, but was aborted. state: "+this.state),void(this.state===i.State.PARSED&&(this.state=i.State.IDLE));var o=r?r.stats:n.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),"initSegment"!==n.sn&&(this.fragPrevious=n),this.fragBufferedComplete(n,r)}},T.onError=function(t,e){switch(e.details){case p.ErrorDetails.FRAG_LOAD_ERROR:case p.ErrorDetails.FRAG_LOAD_TIMEOUT:case p.ErrorDetails.KEY_LOAD_ERROR:case p.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(l.PlaylistLevelType.MAIN,e);break;case p.ErrorDetails.LEVEL_LOAD_ERROR:case p.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==i.State.ERROR&&(e.fatal?(this.warn(""+e.details),this.state=i.State.ERROR):e.levelRetry||this.state!==i.State.WAITING_LEVEL||(this.state=i.State.IDLE));break;case p.ErrorDetails.BUFFER_FULL_ERROR:if("main"===e.parent&&(this.state===i.State.PARSING||this.state===i.State.PARSED)){var n=!0,r=this.getFwdBufferInfo(this.media,l.PlaylistLevelType.MAIN);r&&r.len>.5&&(n=!this.reduceMaxBufferLength(r.len)),n&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}}},T.checkBuffer=function(){var t=this.media,e=this.gapController;if(t&&e&&t.readyState){var n=s.BufferHelper.getBuffered(t);!this.loadedmetadata&&n.length?(this.loadedmetadata=!0,this.seekToStartPos()):e.poll(this.lastCurrentTime),this.lastCurrentTime=t.currentTime}},T.onFragLoadEmergencyAborted=function(){this.state=i.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},T.onBufferFlushed=function(t,e){var n=e.type;if(n!==c.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var r=(n===c.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(r,n,l.PlaylistLevelType.MAIN)}},T.onLevelsUpdated=function(t,e){this.levels=e.levels},T.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},T.seekToStartPos=function(){var t=this.media,e=t.currentTime,n=this.startPosition;if(n>=0&&e<n){if(t.seeking)return void y.logger.log("could not seek to "+n+", already seeking at "+e);var r=s.BufferHelper.getBuffered(t),i=(r.length?r.start(0):0)-n;i>0&&(i<this.config.maxBufferHole||i<this.config.maxFragLookUpTolerance)&&(y.logger.log("adjusting start position by "+i+" to match buffer start"),n+=i,this.startPosition=n),this.log("seek to target start position "+n+" from current time "+e),t.currentTime=n}},T._getAudioCodec=function(t){var e=this.config.defaultAudioCodec||t.audioCodec;return this.audioCodecSwap&&e&&(this.log("Swapping audio codec"),e=-1!==e.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),e},T._loadBitrateTestFrag=function(t){var e=this;this._doFragLoad(t).then((function(n){var r=e.hls;if(n&&!r.nextLoadLevel&&!e.fragContextChanged(t)){e.fragLoadError=0,e.state=i.State.IDLE,e.startFragRequested=!1,e.bitrateTest=!1;var o=t.stats;o.parsing.start=o.parsing.end=o.buffering.start=o.buffering.end=self.performance.now(),r.trigger(a.Events.FRAG_LOADED,n)}}))},T._handleTransmuxComplete=function(t){var e,n="main",o=this.hls,s=t.remuxResult,u=t.chunkMeta,l=this.getCurrentContext(u);if(!l)return this.warn("The loading context changed while buffering fragment "+u.sn+" of level "+u.level+". This chunk will not be buffered."),void this.resetLiveStartWhenNotLoaded(u.level);var f=l.frag,d=l.part,h=l.level,p=s.video,y=s.text,v=s.id3,g=s.initSegment,m=this.altAudio?void 0:s.audio;if(!this.fragContextChanged(f)){if(this.state=i.State.PARSING,g){g.tracks&&(this._bufferInitSegment(h,g.tracks,f,u),o.trigger(a.Events.FRAG_PARSING_INIT_SEGMENT,{frag:f,id:n,tracks:g.tracks}));var b=g.initPTS,E=g.timescale;Object(r.isFiniteNumber)(b)&&(this.initPTS[f.cc]=b,o.trigger(a.Events.INIT_PTS_FOUND,{frag:f,id:n,initPTS:b,timescale:E}))}if(p&&!1!==s.independent){if(h.details){var _=p.startPTS,T=p.endPTS,k=p.startDTS,A=p.endDTS;if(d)d.elementaryStreams[p.type]={startPTS:_,endPTS:T,startDTS:k,endDTS:A};else if(p.firstKeyFrame&&p.independent&&(this.couldBacktrack=!0),p.dropped&&p.independent){if(this.getLoadPosition()+this.config.maxBufferHole<_)return void this.backtrack(f);f.setElementaryStreamInfo(p.type,f.start,T,f.start,A,!0)}f.setElementaryStreamInfo(p.type,_,T,k,A),this.bufferFragmentData(p,f,d,u)}}else if(!1===s.independent)return void this.backtrack(f);if(m){var S=m.startPTS,w=m.endPTS,P=m.startDTS,L=m.endDTS;d&&(d.elementaryStreams[c.ElementaryStreamTypes.AUDIO]={startPTS:S,endPTS:w,startDTS:P,endDTS:L}),f.setElementaryStreamInfo(c.ElementaryStreamTypes.AUDIO,S,w,P,L),this.bufferFragmentData(m,f,d,u)}if(null!=v&&null!==(e=v.samples)&&void 0!==e&&e.length){var O={frag:f,id:n,samples:v.samples};o.trigger(a.Events.FRAG_PARSING_METADATA,O)}if(y){var R={frag:f,id:n,samples:y.samples};o.trigger(a.Events.FRAG_PARSING_USERDATA,R)}}},T._bufferInitSegment=function(t,e,n,r){var o=this;if(this.state===i.State.PARSING){this.audioOnly=!!e.audio&&!e.video,this.altAudio&&!this.audioOnly&&delete e.audio;var s=e.audio,u=e.video,l=e.audiovideo;if(s){var c=t.audioCodec,f=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(c&&(c=-1!==c.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),1!==s.metadata.channelCount&&-1===f.indexOf("firefox")&&(c="mp4a.40.5")),-1!==f.indexOf("android")&&"audio/mpeg"!==s.container&&(c="mp4a.40.2",this.log("Android: force audio codec to "+c)),t.audioCodec&&t.audioCodec!==c&&this.log('Swapping manifest audio codec "'+t.audioCodec+'" for "'+c+'"'),s.levelCodec=c,s.id="main",this.log("Init audio buffer, container:"+s.container+", codecs[selected/level/parsed]=["+(c||"")+"/"+(t.audioCodec||"")+"/"+s.codec+"]")}u&&(u.levelCodec=t.videoCodec,u.id="main",this.log("Init video buffer, container:"+u.container+", codecs[level/parsed]=["+(t.videoCodec||"")+"/"+u.codec+"]")),l&&this.log("Init audiovideo buffer, container:"+l.container+", codecs[level/parsed]=["+(t.attrs.CODECS||"")+"/"+l.codec+"]"),this.hls.trigger(a.Events.BUFFER_CODECS,e),Object.keys(e).forEach((function(t){var i=e[t].initSegment;null!=i&&i.byteLength&&o.hls.trigger(a.Events.BUFFER_APPENDING,{type:t,data:i,frag:n,part:null,chunkMeta:r,parent:n.type})})),this.tick()}},T.backtrack=function(t){this.couldBacktrack=!0,this.resetTransmuxer(),this.flushBufferGap(t);var e=this.fragmentTracker.backtrack(t);this.fragPrevious=null,this.nextLoadPosition=t.start,e?this.resetFragmentLoading(t):this.state=i.State.BACKTRACKING},T.checkFragmentChanged=function(){var t=this.media,e=null;if(t&&t.readyState>1&&!1===t.seeking){var n=t.currentTime;if(s.BufferHelper.isBuffered(t,n)?e=this.getAppendedFrag(n):s.BufferHelper.isBuffered(t,n+.1)&&(e=this.getAppendedFrag(n+.1)),e){var r=this.fragPlaying,i=e.level;r&&e.sn===r.sn&&r.level===i&&e.urlId===r.urlId||(this.hls.trigger(a.Events.FRAG_CHANGED,{frag:e}),r&&r.level===i||this.hls.trigger(a.Events.LEVEL_SWITCHED,{level:i}),this.fragPlaying=e)}}},b=m,(E=[{key:"nextLevel",get:function(){var t=this.nextBufferedFrag;return t?t.level:-1}},{key:"currentLevel",get:function(){var t=this.media;if(t){var e=this.getAppendedFrag(t.currentTime);if(e)return e.level}return-1}},{key:"nextBufferedFrag",get:function(){var t=this.media;if(t){var e=this.getAppendedFrag(t.currentTime);return this.followingBufferedFrag(e)}return null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}])&&v(b.prototype,E),_&&v(b,_),m}(i.default)},"./src/controller/subtitle-stream-controller.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"SubtitleStreamController",(function(){return p}));var r=n("./src/events.ts"),i=n("./src/utils/buffer-helper.ts"),o=n("./src/controller/fragment-finders.ts"),a=n("./src/utils/discontinuities.ts"),s=n("./src/controller/level-helper.ts"),u=n("./src/controller/fragment-tracker.ts"),l=n("./src/controller/base-stream-controller.ts"),c=n("./src/types/loader.ts"),f=n("./src/types/level.ts");function d(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function h(t,e){return(h=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var p=function(t){var e,n;function p(e,n){var r;return(r=t.call(this,e,n,"[subtitle-stream-controller]")||this).levels=[],r.currentTrackId=-1,r.tracksBuffered=[],r.mainDetails=null,r._registerListeners(),r}n=t,(e=p).prototype=Object.create(n.prototype),e.prototype.constructor=e,h(e,n);var y,v,g,m=p.prototype;return m.onHandlerDestroying=function(){this._unregisterListeners(),this.mainDetails=null},m._registerListeners=function(){var t=this.hls;t.on(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(r.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.on(r.Events.ERROR,this.onError,this),t.on(r.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(r.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.on(r.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(r.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.on(r.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},m._unregisterListeners=function(){var t=this.hls;t.off(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(r.Events.LEVEL_LOADED,this.onLevelLoaded,this),t.off(r.Events.ERROR,this.onError,this),t.off(r.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(r.Events.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.off(r.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(r.Events.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.off(r.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)},m.startLoad=function(){this.stopLoad(),this.state=l.State.IDLE,this.setInterval(500),this.tick()},m.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()},m.onLevelLoaded=function(t,e){this.mainDetails=e.details},m.onSubtitleFragProcessed=function(t,e){var n=e.frag,r=e.success;if(this.fragPrevious=n,this.state=l.State.IDLE,r){var i=this.tracksBuffered[this.currentTrackId];if(i){for(var o,a=n.start,s=0;s<i.length;s++)if(a>=i[s].start&&a<=i[s].end){o=i[s];break}var u=n.start+n.duration;o?o.end=u:(o={start:a,end:u},i.push(o)),this.fragmentTracker.fragBuffered(n)}}},m.onBufferFlushing=function(t,e){var n=e.startOffset,r=e.endOffset;if(0===n&&r!==Number.POSITIVE_INFINITY){var i=this.currentTrackId,o=this.levels;if(!o.length||!o[i]||!o[i].details)return;var a=r-o[i].details.targetduration;if(a<=0)return;e.endOffsetSubtitles=Math.max(0,a),this.tracksBuffered.forEach((function(t){for(var e=0;e<t.length;)if(t[e].end<=a)t.shift();else{if(!(t[e].start<a))break;t[e].start=a,e++}})),this.fragmentTracker.removeFragmentsInRange(n,a,c.PlaylistLevelType.SUBTITLE)}},m.onError=function(t,e){var n,r=e.frag;r&&r.type===c.PlaylistLevelType.SUBTITLE&&(null!==(n=this.fragCurrent)&&void 0!==n&&n.loader&&this.fragCurrent.loader.abort(),this.state=l.State.IDLE)},m.onSubtitleTracksUpdated=function(t,e){var n=this,r=e.subtitleTracks;this.tracksBuffered=[],this.levels=r.map((function(t){return new f.Level(t)})),this.fragmentTracker.removeAllFragments(),this.fragPrevious=null,this.levels.forEach((function(t){n.tracksBuffered[t.id]=[]})),this.mediaBuffer=null},m.onSubtitleTrackSwitch=function(t,e){if(this.currentTrackId=e.id,this.levels.length&&-1!==this.currentTrackId){var n=this.levels[this.currentTrackId];null!=n&&n.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,n&&this.setInterval(500)}else this.clearInterval()},m.onSubtitleTrackLoaded=function(t,e){var n,r=e.details,i=e.id,u=this.currentTrackId,c=this.levels;if(c.length){var f=c[u];if(!(i>=c.length||i!==u)&&f){if(this.mediaBuffer=this.mediaBufferTimeRanges,r.live||null!==(n=f.details)&&void 0!==n&&n.live){var d=this.mainDetails;if(r.deltaUpdateFailed||!d)return;var h=d.fragments[0];f.details?0===this.alignPlaylists(r,f.details)&&h&&Object(s.addSliding)(r,h.start):r.hasProgramDateTime&&d.hasProgramDateTime?Object(a.alignMediaPlaylistByPDT)(r,d):h&&Object(s.addSliding)(r,h.start)}f.details=r,this.levelLastLoaded=i,this.tick(),r.live&&!this.fragCurrent&&this.media&&this.state===l.State.IDLE&&(Object(o.findFragmentByPTS)(null,r.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),f.details=void 0))}}},m._handleFragmentLoadComplete=function(t){var e=t.frag,n=t.payload,i=e.decryptdata,o=this.hls;if(!this.fragContextChanged(e)&&n&&n.byteLength>0&&i&&i.key&&i.iv&&"AES-128"===i.method){var a=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(n),i.key.buffer,i.iv.buffer).then((function(t){var n=performance.now();o.trigger(r.Events.FRAG_DECRYPTED,{frag:e,payload:t,stats:{tstart:a,tdecrypt:n}})}))}},m.doTick=function(){if(this.media){if(this.state===l.State.IDLE){var t,e=this.currentTrackId,n=this.levels;if(!n.length||!n[e]||!n[e].details)return;var r=n[e].details,a=r.targetduration,s=this.config,c=this.media,f=i.BufferHelper.bufferedInfo(this.mediaBufferTimeRanges,c.currentTime-a,s.maxBufferHole),d=f.end;if(f.len>this.getMaxBufferLength()+a)return;console.assert(r,"Subtitle track details are defined on idle subtitle stream controller tick");var h,p=r.fragments,y=p.length,v=r.edge,g=this.fragPrevious;if(d<v){var m=s.maxFragLookUpTolerance;!(h=Object(o.findFragmentByPTS)(g,p,d,m))&&g&&g.start<p[0].start&&(h=p[0])}else h=p[y-1];null!==(t=h)&&void 0!==t&&t.encrypted?this.loadKey(h,r):h&&this.fragmentTracker.getState(h)===u.FragmentState.NOT_LOADED&&this.loadFragment(h,r,d)}}else this.state=l.State.IDLE},m.loadFragment=function(e,n,r){this.fragCurrent=e,t.prototype.loadFragment.call(this,e,n,r)},y=p,(v=[{key:"mediaBufferTimeRanges",get:function(){return this.tracksBuffered[this.currentTrackId]||[]}}])&&d(y.prototype,v),g&&d(y,g),p}(l.default)},"./src/controller/subtitle-track-controller.ts":function(t,e,n){"use strict";n.r(e);var r=n("./src/events.ts"),i=n("./src/utils/texttrack-utils.ts"),o=n("./src/controller/base-playlist-controller.ts"),a=n("./src/types/loader.ts");function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var l=function(t){var e,n;function o(e){var n;return(n=t.call(this,e,"[subtitle-track-controller]")||this).media=null,n.tracks=[],n.groupId=null,n.tracksInGroup=[],n.trackId=-1,n.selectDefaultTrack=!0,n.queuedDefaultTrack=-1,n.trackChangeListener=function(){return n.onTextTracksChanged()},n.asyncPollTrackChange=function(){return n.pollTrackChange(0)},n.useTextTrackPolling=!1,n.subtitlePollingInterval=-1,n.subtitleDisplay=!0,n.registerListeners(),n}n=t,(e=o).prototype=Object.create(n.prototype),e.prototype.constructor=e,u(e,n);var l,f,d,h=o.prototype;return h.destroy=function(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.trackChangeListener=this.asyncPollTrackChange=null,t.prototype.destroy.call(this)},h.registerListeners=function(){var t=this.hls;t.on(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(r.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.on(r.Events.LEVEL_LOADING,this.onLevelLoading,this),t.on(r.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(r.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(r.Events.ERROR,this.onError,this)},h.unregisterListeners=function(){var t=this.hls;t.off(r.Events.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(r.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(r.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(r.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.off(r.Events.LEVEL_LOADING,this.onLevelLoading,this),t.off(r.Events.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(r.Events.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(r.Events.ERROR,this.onError,this)},h.onMediaAttached=function(t,e){this.media=e.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))},h.pollTrackChange=function(t){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,t)},h.onMediaDetaching=function(){this.media&&(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),c(this.media.textTracks).forEach((function(t){Object(i.clearCurrentCues)(t)})),this.subtitleTrack=-1,this.media=null)},h.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},h.onManifestParsed=function(t,e){this.tracks=e.subtitleTracks},h.onSubtitleTrackLoaded=function(t,e){var n=e.id,r=e.details,i=this.trackId,o=this.tracksInGroup[i];if(o){var a=o.details;o.details=e.details,this.log("subtitle track "+n+" loaded ["+r.startSN+"-"+r.endSN+"]"),n===this.trackId&&(this.retryCount=0,this.playlistLoaded(n,e,a))}else this.warn("Invalid subtitle track id "+n)},h.onLevelLoading=function(t,e){this.switchLevel(e.level)},h.onLevelSwitching=function(t,e){this.switchLevel(e.level)},h.switchLevel=function(t){var e=this.hls.levels[t];if(null!=e&&e.textGroupIds){var n=e.textGroupIds[e.urlId];if(this.groupId!==n){var i=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,o=this.tracks.filter((function(t){return!n||t.groupId===n}));this.tracksInGroup=o;var a=this.findTrackId(null==i?void 0:i.name)||this.findTrackId();this.groupId=n;var s={subtitleTracks:o};this.log("Updating subtitle tracks, "+o.length+' track(s) found in "'+n+'" group-id'),this.hls.trigger(r.Events.SUBTITLE_TRACKS_UPDATED,s),-1!==a&&this.setSubtitleTrack(a,i)}}},h.findTrackId=function(t){for(var e=this.tracksInGroup,n=0;n<e.length;n++){var r=e[n];if((!this.selectDefaultTrack||r.default)&&(!t||t===r.name))return r.id}return-1},h.onError=function(e,n){t.prototype.onError.call(this,e,n),!n.fatal&&n.context&&n.context.type===a.PlaylistContextType.SUBTITLE_TRACK&&n.context.id===this.trackId&&n.context.groupId===this.groupId&&this.retryLoadingOrFail(n)},h.loadPlaylist=function(t){var e=this.tracksInGroup[this.trackId];if(this.shouldLoadTrack(e)){var n=e.id,i=e.groupId,o=e.url;if(t)try{o=t.addDirectives(o)}catch(t){this.warn("Could not construct new URL with HLS Delivery Directives: "+t)}this.log("Loading subtitle playlist for id "+n),this.hls.trigger(r.Events.SUBTITLE_TRACK_LOADING,{url:o,id:n,groupId:i,deliveryDirectives:t||null})}},h.toggleTrackModes=function(t){var e=this,n=this.media,r=this.subtitleDisplay,i=this.trackId;if(n){var o=c(n.textTracks),a=o.filter((function(t){return t.groupId===e.groupId}));if(-1===t)[].slice.call(o).forEach((function(t){t.mode="disabled"}));else{var s=a[i];s&&(s.mode="disabled")}var u=a[t];u&&(u.mode=r?"showing":"hidden")}},h.setSubtitleTrack=function(t,e){var n,i=this.tracksInGroup;if(this.media){if(this.trackId!==t&&this.toggleTrackModes(t),!(this.trackId===t&&(-1===t||null!==(n=i[t])&&void 0!==n&&n.details)||t<-1||t>=i.length)){this.clearTimer();var o=i[t];if(this.log("Switching to subtitle track "+t),this.trackId=t,o){var a=o.id,s=o.groupId,u=void 0===s?"":s,l=o.name,c=o.type,f=o.url;this.hls.trigger(r.Events.SUBTITLE_TRACK_SWITCH,{id:a,groupId:u,name:l,type:c,url:f});var d=this.switchParams(o.url,null==e?void 0:e.details);this.loadPlaylist(d)}else this.hls.trigger(r.Events.SUBTITLE_TRACK_SWITCH,{id:t})}}else this.queuedDefaultTrack=t},h.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),this.media&&this.hls.config.renderTextTracksNatively){for(var t=-1,e=c(this.media.textTracks),n=0;n<e.length;n++)if("hidden"===e[n].mode)t=n;else if("showing"===e[n].mode){t=n;break}this.subtitleTrack!==t&&(this.subtitleTrack=t)}},l=o,(f=[{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(t){this.selectDefaultTrack=!1;var e=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(t,e)}}])&&s(l.prototype,f),d&&s(l,d),o}(o.default);function c(t){for(var e=[],n=0;n<t.length;n++){var r=t[n];"subtitles"===r.kind&&r.label&&e.push(t[n])}return e}e.default=l},"./src/controller/timeline-controller.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"TimelineController",(function(){return d}));var r=n("./src/polyfills/number.ts"),i=n("./src/events.ts"),o=n("./src/utils/cea-608-parser.ts"),a=n("./src/utils/output-filter.ts"),s=n("./src/utils/webvtt-parser.ts"),u=n("./src/utils/texttrack-utils.ts"),l=n("./src/utils/imsc1-ttml-parser.ts"),c=n("./src/types/loader.ts"),f=n("./src/utils/logger.ts"),d=function(){function t(t){if(this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.timescale=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}},this.captionsProperties=void 0,this.hls=t,this.config=t.config,this.Cues=t.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},this.config.enableCEA708Captions){var e=new a.default(this,"textTrack1"),n=new a.default(this,"textTrack2"),r=new a.default(this,"textTrack3"),s=new a.default(this,"textTrack4");this.cea608Parser1=new o.default(1,e,n),this.cea608Parser2=new o.default(3,r,s)}t.on(i.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(i.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(i.Events.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(i.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(i.Events.FRAG_LOADING,this.onFragLoading,this),t.on(i.Events.FRAG_LOADED,this.onFragLoaded,this),t.on(i.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.on(i.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),t.on(i.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(i.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.on(i.Events.BUFFER_FLUSHING,this.onBufferFlushing,this)}var e=t.prototype;return e.destroy=function(){var t=this.hls;t.off(i.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(i.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(i.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(i.Events.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(i.Events.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(i.Events.FRAG_LOADING,this.onFragLoading,this),t.off(i.Events.FRAG_LOADED,this.onFragLoaded,this),t.off(i.Events.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.off(i.Events.FRAG_DECRYPTED,this.onFragDecrypted,this),t.off(i.Events.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(i.Events.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.off(i.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.cea608Parser1=this.cea608Parser2=null},e.addCues=function(t,e,n,r,o){for(var a,s,u,l,c=!1,f=o.length;f--;){var d=o[f],h=(a=d[0],s=d[1],u=e,l=n,Math.min(s,l)-Math.max(a,u));if(h>=0&&(d[0]=Math.min(d[0],e),d[1]=Math.max(d[1],n),c=!0,h/(n-e)>.5))return}if(c||o.push([e,n]),this.config.renderTextTracksNatively){var p=this.captionsTracks[t];this.Cues.newCue(p,e,n,r)}else{var y=this.Cues.newCue(null,e,n,r);this.hls.trigger(i.Events.CUES_PARSED,{type:"captions",cues:y,track:t})}},e.onInitPtsFound=function(t,e){var n=this,r=e.frag,o=e.id,a=e.initPTS,s=e.timescale,u=this.unparsedVttFrags;"main"===o&&(this.initPTS[r.cc]=a,this.timescale[r.cc]=s),u.length&&(this.unparsedVttFrags=[],u.forEach((function(t){n.onFragLoaded(i.Events.FRAG_LOADED,t)})))},e.getExistingTrack=function(t){var e=this.media;if(e)for(var n=0;n<e.textTracks.length;n++){var r=e.textTracks[n];if(r[t])return r}return null},e.createCaptionsTrack=function(t){this.config.renderTextTracksNatively?this.createNativeTrack(t):this.createNonNativeTrack(t)},e.createNativeTrack=function(t){if(!this.captionsTracks[t]){var e=this.captionsProperties,n=this.captionsTracks,r=this.media,i=e[t],o=i.label,a=i.languageCode,s=this.getExistingTrack(t);if(s)n[t]=s,Object(u.clearCurrentCues)(n[t]),Object(u.sendAddTrackEvent)(n[t],r);else{var l=this.createTextTrack("captions",o,a);l&&(l[t]=!0,n[t]=l)}}},e.createNonNativeTrack=function(t){if(!this.nonNativeCaptionsTracks[t]){var e=this.captionsProperties[t];if(e){var n={_id:t,label:e.label,kind:"captions",default:!!e.media&&!!e.media.default,closedCaptions:e.media};this.nonNativeCaptionsTracks[t]=n,this.hls.trigger(i.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[n]})}}},e.createTextTrack=function(t,e,n){var r=this.media;if(r)return r.addTextTrack(t,e,n)},e.onMediaAttaching=function(t,e){this.media=e.media,this._cleanTracks()},e.onMediaDetaching=function(){var t=this.captionsTracks;Object.keys(t).forEach((function(e){Object(u.clearCurrentCues)(t[e]),delete t[e]})),this.nonNativeCaptionsTracks={}},e.onManifestLoading=function(){this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!1}},this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=this.unparsedVttFrags||[],this.initPTS=[],this.timescale=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())},e._cleanTracks=function(){var t=this.media;if(t){var e=t.textTracks;if(e)for(var n=0;n<e.length;n++)Object(u.clearCurrentCues)(e[n])}},e.onSubtitleTracksUpdated=function(t,e){var n=this;this.textTracks=[];var r=e.subtitleTracks||[],o=r.some((function(t){return t.textCodec===l.IMSC1_CODEC}));if(this.config.enableWebVTT||o&&this.config.enableIMSC1){var a=this.tracks&&r&&this.tracks.length===r.length;if(this.tracks=r||[],this.config.renderTextTracksNatively){var s=this.media?this.media.textTracks:[];this.tracks.forEach((function(t,e){var r;if(e<s.length){for(var i=null,o=0;o<s.length;o++)if(h(s[o],t)){i=s[o];break}i&&(r=i)}r?Object(u.clearCurrentCues)(r):(r=n.createTextTrack("subtitles",t.name,t.lang))&&(r.mode="disabled"),r&&(r.groupId=t.groupId,n.textTracks.push(r))}))}else if(!a&&this.tracks&&this.tracks.length){var c=this.tracks.map((function(t){return{label:t.name,kind:t.type.toLowerCase(),default:t.default,subtitleTrack:t}}));this.hls.trigger(i.Events.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:c})}}},e.onManifestLoaded=function(t,e){var n=this;this.config.enableCEA708Captions&&e.captions&&e.captions.forEach((function(t){var e=/(?:CC|SERVICE)([1-4])/.exec(t.instreamId);if(e){var r="textTrack"+e[1],i=n.captionsProperties[r];i&&(i.label=t.name,t.lang&&(i.languageCode=t.lang),i.media=t)}}))},e.onFragLoading=function(t,e){var n=this.cea608Parser1,r=this.cea608Parser2,i=this.lastSn,o=this.lastPartIndex;if(this.enabled&&n&&r&&e.frag.type===c.PlaylistLevelType.MAIN){var a,s,u=e.frag.sn,l=null!=(a=null==e||null===(s=e.part)||void 0===s?void 0:s.index)?a:-1;u===i+1||u===i&&l===o+1||(n.reset(),r.reset()),this.lastSn=u,this.lastPartIndex=l}},e.onFragLoaded=function(t,e){var n=e.frag,o=e.payload,a=this.initPTS,s=this.unparsedVttFrags;if(n.type===c.PlaylistLevelType.SUBTITLE)if(o.byteLength){if(!Object(r.isFiniteNumber)(a[n.cc]))return s.push(e),void(a.length&&this.hls.trigger(i.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:new Error("Missing initial subtitle PTS")}));var u=n.decryptdata,f="stats"in e;if(null==u||null==u.key||"AES-128"!==u.method||f){var d=this.tracks[n.level],h=this.vttCCs;h[n.cc]||(h[n.cc]={start:n.start,prevCC:this.prevCC,new:!0},this.prevCC=n.cc),d&&d.textCodec===l.IMSC1_CODEC?this._parseIMSC1(n,o):this._parseVTTs(n,o,h)}}else this.hls.trigger(i.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:new Error("Empty subtitle payload")})},e._parseIMSC1=function(t,e){var n=this,r=this.hls;Object(l.parseIMSC1)(e,this.initPTS[t.cc],this.timescale[t.cc],(function(e){n._appendCues(e,t.level),r.trigger(i.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:t})}),(function(e){f.logger.log("Failed to parse IMSC1: "+e),r.trigger(i.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t,error:e})}))},e._parseVTTs=function(t,e,n){var r=this,o=this.hls;Object(s.parseWebVTT)(e,this.initPTS[t.cc],this.timescale[t.cc],n,t.cc,t.start,(function(e){r._appendCues(e,t.level),o.trigger(i.Events.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:t})}),(function(n){r._fallbackToIMSC1(t,e),f.logger.log("Failed to parse VTT cue: "+n),o.trigger(i.Events.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t,error:n})}))},e._fallbackToIMSC1=function(t,e){var n=this,r=this.tracks[t.level];r.textCodec||Object(l.parseIMSC1)(e,this.initPTS[t.cc],this.timescale[t.cc],(function(){r.textCodec=l.IMSC1_CODEC,n._parseIMSC1(t,e)}),(function(){r.textCodec="wvtt"}))},e._appendCues=function(t,e){var n=this.hls;if(this.config.renderTextTracksNatively){var r=this.textTracks[e];if("disabled"===r.mode)return;t.forEach((function(t){return Object(u.addCueToTrack)(r,t)}))}else{var o=this.tracks[e].default?"default":"subtitles"+e;n.trigger(i.Events.CUES_PARSED,{type:"subtitles",cues:t,track:o})}},e.onFragDecrypted=function(t,e){var n=e.frag;if(n.type===c.PlaylistLevelType.SUBTITLE){if(!Object(r.isFiniteNumber)(this.initPTS[n.cc]))return void this.unparsedVttFrags.push(e);this.onFragLoaded(i.Events.FRAG_LOADED,e)}},e.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},e.onFragParsingUserdata=function(t,e){var n=this.cea608Parser1,r=this.cea608Parser2;if(this.enabled&&n&&r)for(var i=0;i<e.samples.length;i++){var o=e.samples[i].bytes;if(o){var a=this.extractCea608Data(o);n.addData(e.samples[i].pts,a[0]),r.addData(e.samples[i].pts,a[1])}}},e.onBufferFlushing=function(t,e){var n=e.startOffset,r=e.endOffset,i=e.endOffsetSubtitles,o=e.type,a=this.media;if(a&&!(a.currentTime<r)){if(!o||"video"===o){var s=this.captionsTracks;Object.keys(s).forEach((function(t){return Object(u.removeCuesInRange)(s[t],n,r)}))}if(this.config.renderTextTracksNatively&&0===n&&void 0!==i){var l=this.textTracks;Object.keys(l).forEach((function(t){return Object(u.removeCuesInRange)(l[t],n,i)}))}}},e.extractCea608Data=function(t){for(var e=31&t[0],n=2,r=[[],[]],i=0;i<e;i++){var o=t[n++],a=127&t[n++],s=127&t[n++],u=3&o;0===a&&0===s||0!=(4&o)&&(0!==u&&1!==u||(r[u].push(a),r[u].push(s)))}return r},t}();function h(t,e){return t&&t.label===e.name&&!(t.textTrack1||t.textTrack2)}},
1"./src/crypt/aes-crypto.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return r}));var r=function(){function t(t,e){this.subtle=void 0,this.aesIV=void 0,this.subtle=t,this.aesIV=e}return t.prototype.decrypt=function(t,e){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},e,t)},t}()},
vendor: 13,001 bytes, line 1
1"./src/crypt/aes-decryptor.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"removePadding",(function(){return i})),n.d(e,"default",(function(){return o}));var r=n("./src/utils/typed-array.ts");function i(t){var e=t.byteLength,n=e&&new DataView(t.buffer).getUint8(e-1);return n?Object(r.sliceUint8)(t,0,e-n):t}var o=function(){function t(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}var e=t.prototype;return e.uint8ArrayToUint32Array_=function(t){for(var e=new DataView(t),n=new Uint32Array(4),r=0;r<4;r++)n[r]=e.getUint32(4*r);return n},e.initTable=function(){var t=this.sBox,e=this.invSBox,n=this.subMix,r=n[0],i=n[1],o=n[2],a=n[3],s=this.invSubMix,u=s[0],l=s[1],c=s[2],f=s[3],d=new Uint32Array(256),h=0,p=0,y=0;for(y=0;y<256;y++)d[y]=y<128?y<<1:y<<1^283;for(y=0;y<256;y++){var v=p^p<<1^p<<2^p<<3^p<<4;v=v>>>8^255&v^99,t[h]=v,e[v]=h;var g=d[h],m=d[g],b=d[m],E=257*d[v]^16843008*v;r[h]=E<<24|E>>>8,i[h]=E<<16|E>>>16,o[h]=E<<8|E>>>24,a[h]=E,E=16843009*b^65537*m^257*g^16843008*h,u[v]=E<<24|E>>>8,l[v]=E<<16|E>>>16,c[v]=E<<8|E>>>24,f[v]=E,h?(h=g^d[d[d[b^g]]],p^=d[d[p]]):h=p=1}},e.expandKey=function(t){for(var e=this.uint8ArrayToUint32Array_(t),n=!0,r=0;r<e.length&&n;)n=e[r]===this.key[r],r++;if(!n){this.key=e;var i=this.keySize=e.length;if(4!==i&&6!==i&&8!==i)throw new Error("Invalid aes key size="+i);var o,a,s,u,l=this.ksRows=4*(i+6+1),c=this.keySchedule=new Uint32Array(l),f=this.invKeySchedule=new Uint32Array(l),d=this.sBox,h=this.rcon,p=this.invSubMix,y=p[0],v=p[1],g=p[2],m=p[3];for(o=0;o<l;o++)o<i?s=c[o]=e[o]:(u=s,o%i==0?(u=d[(u=u<<8|u>>>24)>>>24]<<24|d[u>>>16&255]<<16|d[u>>>8&255]<<8|d[255&u],u^=h[o/i|0]<<24):i>6&&o%i==4&&(u=d[u>>>24]<<24|d[u>>>16&255]<<16|d[u>>>8&255]<<8|d[255&u]),c[o]=s=(c[o-i]^u)>>>0);for(a=0;a<l;a++)o=l-a,u=3&a?c[o]:c[o-4],f[a]=a<4||o<=4?u:y[d[u>>>24]]^v[d[u>>>16&255]]^g[d[u>>>8&255]]^m[d[255&u]],f[a]=f[a]>>>0}},e.networkToHostOrderSwap=function(t){return t<<24|(65280&t)<<8|(16711680&t)>>8|t>>>24},e.decrypt=function(t,e,n){for(var r,i,o,a,s,u,l,c,f,d,h,p,y,v,g=this.keySize+6,m=this.invKeySchedule,b=this.invSBox,E=this.invSubMix,_=E[0],T=E[1],k=E[2],A=E[3],S=this.uint8ArrayToUint32Array_(n),w=S[0],P=S[1],L=S[2],O=S[3],R=new Int32Array(t),C=new Int32Array(R.length),D=this.networkToHostOrderSwap;e<R.length;){for(f=D(R[e]),d=D(R[e+1]),h=D(R[e+2]),p=D(R[e+3]),s=f^m[0],u=p^m[1],l=h^m[2],c=d^m[3],y=4,v=1;v<g;v++)r=_[s>>>24]^T[u>>16&255]^k[l>>8&255]^A[255&c]^m[y],i=_[u>>>24]^T[l>>16&255]^k[c>>8&255]^A[255&s]^m[y+1],o=_[l>>>24]^T[c>>16&255]^k[s>>8&255]^A[255&u]^m[y+2],a=_[c>>>24]^T[s>>16&255]^k[u>>8&255]^A[255&l]^m[y+3],s=r,u=i,l=o,c=a,y+=4;r=b[s>>>24]<<24^b[u>>16&255]<<16^b[l>>8&255]<<8^b[255&c]^m[y],i=b[u>>>24]<<24^b[l>>16&255]<<16^b[c>>8&255]<<8^b[255&s]^m[y+1],o=b[l>>>24]<<24^b[c>>16&255]<<16^b[s>>8&255]<<8^b[255&u]^m[y+2],a=b[c>>>24]<<24^b[s>>16&255]<<16^b[u>>8&255]<<8^b[255&l]^m[y+3],C[e]=D(r^w),C[e+1]=D(a^P),C[e+2]=D(o^L),C[e+3]=D(i^O),w=f,P=d,L=h,O=p,e+=4}return C.buffer},t}()},"./src/crypt/decrypter.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return l}));var r=n("./src/crypt/aes-crypto.ts"),i=n("./src/crypt/fast-aes-key.ts"),o=n("./src/crypt/aes-decryptor.ts"),a=n("./src/utils/logger.ts"),s=n("./src/utils/mp4-tools.ts"),u=n("./src/utils/typed-array.ts"),l=function(){function t(t,e,n){var r=(void 0===n?{}:n).removePKCS7Padding,i=void 0===r||r;if(this.logEnabled=!0,this.observer=void 0,this.config=void 0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.observer=t,this.config=e,this.removePKCS7Padding=i,i)try{var o=self.crypto;o&&(this.subtle=o.subtle||o.webkitSubtle)}catch(t){}null===this.subtle&&(this.config.enableSoftwareAES=!0)}var e=t.prototype;return e.destroy=function(){this.observer=null},e.isSync=function(){return this.config.enableSoftwareAES},e.flush=function(){var t=this.currentResult;if(t){var e=new Uint8Array(t);return this.reset(),this.removePKCS7Padding?Object(o.removePadding)(e):e}this.reset()},e.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},e.decrypt=function(t,e,n,r){if(this.config.enableSoftwareAES){this.softwareDecrypt(new Uint8Array(t),e,n);var i=this.flush();i&&r(i.buffer)}else this.webCryptoDecrypt(new Uint8Array(t),e,n).then(r)},e.softwareDecrypt=function(t,e,n){var r=this.currentIV,i=this.currentResult,a=this.remainderData;this.logOnce("JS AES decrypt"),a&&(t=Object(s.appendUint8Array)(a,t),this.remainderData=null);var l=this.getValidChunk(t);if(!l.length)return null;r&&(n=r);var c=this.softwareDecrypter;c||(c=this.softwareDecrypter=new o.default),c.expandKey(e);var f=i;return this.currentResult=c.decrypt(l.buffer,0,n),this.currentIV=Object(u.sliceUint8)(l,-16).buffer,f||null},e.webCryptoDecrypt=function(t,e,n){var o=this,a=this.subtle;return this.key===e&&this.fastAesKey||(this.key=e,this.fastAesKey=new i.default(a,e)),this.fastAesKey.expandKey().then((function(e){return a?new r.default(a,n).decrypt(t.buffer,e):Promise.reject(new Error("web crypto not initialized"))})).catch((function(r){return o.onWebCryptoError(r,t,e,n)}))},e.onWebCryptoError=function(t,e,n,r){return a.logger.warn("[decrypter.ts]: WebCrypto Error, disable WebCrypto API:",t),this.config.enableSoftwareAES=!0,this.logEnabled=!0,this.softwareDecrypt(e,n,r)},e.getValidChunk=function(t){var e=t,n=t.length-t.length%16;return n!==t.length&&(e=Object(u.sliceUint8)(t,0,n),this.remainderData=Object(u.sliceUint8)(t,n)),e},e.logOnce=function(t){this.logEnabled&&(a.logger.log("[decrypter.ts]: "+t),this.logEnabled=!1)},t}()},"./src/crypt/fast-aes-key.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return r}));var r=function(){function t(t,e){this.subtle=void 0,this.key=void 0,this.subtle=t,this.key=e}return t.prototype.expandKey=function(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])},t}()},"./src/demux/aacdemuxer.ts":function(t,e,n){"use strict";n.r(e);var r=n("./src/demux/base-audio-demuxer.ts"),i=n("./src/demux/adts.ts"),o=n("./src/utils/logger.ts"),a=n("./src/demux/id3.ts");function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var u=function(t){var e,n;function r(e,n){var r;return(r=t.call(this)||this).observer=void 0,r.config=void 0,r.observer=e,r.config=n,r}n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,s(e,n);var u=r.prototype;return u.resetInitSegment=function(e,n,r){t.prototype.resetInitSegment.call(this,e,n,r),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!0,samples:[],manifestCodec:e,duration:r,inputTimeScale:9e4,dropped:0}},r.probe=function(t){if(!t)return!1;for(var e=(a.getID3Data(t,0)||[]).length,n=t.length;e<n;e++)if(i.probe(t,e))return o.logger.log("ADTS sync word found !"),!0;return!1},u.canParse=function(t,e){return i.canParse(t,e)},u.appendFrame=function(t,e,n){i.initTrackConfig(t,this.observer,e,n,t.manifestCodec);var r=i.appendFrame(t,e,n,this.initPTS,this.frameIndex);if(r&&0===r.missing)return r},r}(r.default);u.minProbeByteLength=9,e.default=u},"./src/demux/adts.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"getAudioConfig",(function(){return a})),n.d(e,"isHeaderPattern",(function(){return s})),n.d(e,"getHeaderLength",(function(){return u})),n.d(e,"getFullFrameLength",(function(){return l})),n.d(e,"canGetFrameLength",(function(){return c})),n.d(e,"isHeader",(function(){return f})),n.d(e,"canParse",(function(){return d})),n.d(e,"probe",(function(){return h})),n.d(e,"initTrackConfig",(function(){return p})),n.d(e,"getFrameDuration",(function(){return y})),n.d(e,"parseFrameHeader",(function(){return v})),n.d(e,"appendFrame",(function(){return g}));var r=n("./src/utils/logger.ts"),i=n("./src/errors.ts"),o=n("./src/events.ts");function a(t,e,n,a){var s,u,l,c,f=navigator.userAgent.toLowerCase(),d=a,h=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];s=1+((192&e[n+2])>>>6);var p=(60&e[n+2])>>>2;if(!(p>h.length-1))return l=(1&e[n+2])<<2,l|=(192&e[n+3])>>>6,r.logger.log("manifest codec:"+a+", ADTS type:"+s+", samplingIndex:"+p),/firefox/i.test(f)?p>=6?(s=5,c=new Array(4),u=p-3):(s=2,c=new Array(2),u=p):-1!==f.indexOf("android")?(s=2,c=new Array(2),u=p):(s=5,c=new Array(4),a&&(-1!==a.indexOf("mp4a.40.29")||-1!==a.indexOf("mp4a.40.5"))||!a&&p>=6?u=p-3:((a&&-1!==a.indexOf("mp4a.40.2")&&(p>=6&&1===l||/vivaldi/i.test(f))||!a&&1===l)&&(s=2,c=new Array(2)),u=p)),c[0]=s<<3,c[0]|=(14&p)>>1,c[1]|=(1&p)<<7,c[1]|=l<<3,5===s&&(c[1]|=(14&u)>>1,c[2]=(1&u)<<7,c[2]|=8,c[3]=0),{config:c,samplerate:h[p],channelCount:l,codec:"mp4a.40."+s,manifestCodec:d};t.trigger(o.Events.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+p})}function s(t,e){return 255===t[e]&&240==(246&t[e+1])}function u(t,e){return 1&t[e+1]?7:9}function l(t,e){return(3&t[e+3])<<11|t[e+4]<<3|(224&t[e+5])>>>5}function c(t,e){return e+5<t.length}function f(t,e){return e+1<t.length&&s(t,e)}function d(t,e){return c(t,e)&&s(t,e)&&l(t,e)<=t.length-e}function h(t,e){if(f(t,e)){var n=u(t,e);if(e+n>=t.length)return!1;var r=l(t,e);if(r<=n)return!1;var i=e+r;return i===t.length||f(t,i)}return!1}function p(t,e,n,i,o){if(!t.samplerate){var s=a(e,n,i,o);if(!s)return;t.config=s.config,t.samplerate=s.samplerate,t.channelCount=s.channelCount,t.codec=s.codec,t.manifestCodec=s.manifestCodec,r.logger.log("parsed codec:"+t.codec+", rate:"+s.samplerate+", channels:"+s.channelCount)}}function y(t){return 9216e4/t}function v(t,e,n,r,i){var o=u(t,e),a=l(t,e);if((a-=o)>0)return{headerLength:o,frameLength:a,stamp:n+r*i}}function g(t,e,n,r,i){var o=v(e,n,r,i,y(t.samplerate));if(o){var a,s=o.frameLength,u=o.headerLength,l=o.stamp,c=u+s,f=Math.max(0,n+c-e.length);f?(a=new Uint8Array(c-u)).set(e.subarray(n+u,e.length),0):a=e.subarray(n+u,n+c);var d={unit:a,pts:l};return f||t.samples.push(d),{sample:d,length:c,missing:f}}}},"./src/demux/base-audio-demuxer.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"initPTSFn",(function(){return l}));var r=n("./src/polyfills/number.ts"),i=n("./src/demux/id3.ts"),o=n("./src/demux/dummy-demuxed-track.ts"),a=n("./src/utils/mp4-tools.ts"),s=n("./src/utils/typed-array.ts"),u=function(){function t(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.initPTS=null}var e=t.prototype;return e.resetInitSegment=function(t,e,n){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},e.resetTimeStamp=function(){},e.resetContiguity=function(){},e.canParse=function(t,e){return!1},e.appendFrame=function(t,e,n){},e.demux=function(t,e){this.cachedData&&(t=Object(a.appendUint8Array)(this.cachedData,t),this.cachedData=null);var n,r,u=i.getID3Data(t,0),c=u?u.length:0,f=this._audioTrack,d=this._id3Track,h=u?i.getTimeStamp(u):void 0,p=t.length;for(0!==this.frameIndex&&null!==this.initPTS||(this.initPTS=l(h,e)),u&&u.length>0&&d.samples.push({pts:this.initPTS,dts:this.initPTS,data:u}),r=this.initPTS;c<p;){if(this.canParse(t,c)){var y=this.appendFrame(f,t,c);y?(this.frameIndex++,r=y.sample.pts,n=c+=y.length):c=p}else i.canParse(t,c)?(u=i.getID3Data(t,c),d.samples.push({pts:r,dts:r,data:u}),n=c+=u.length):c++;if(c===p&&n!==p){var v=Object(s.sliceUint8)(t,n);this.cachedData?this.cachedData=Object(a.appendUint8Array)(this.cachedData,v):this.cachedData=v}}return{audioTrack:f,avcTrack:Object(o.dummyTrack)(),id3Track:d,textTrack:Object(o.dummyTrack)()}},e.demuxSampleAes=function(t,e,n){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},e.flush=function(t){var e=this.cachedData;return e&&(this.cachedData=null,this.demux(e,0)),this.frameIndex=0,{audioTrack:this._audioTrack,avcTrack:Object(o.dummyTrack)(),id3Track:this._id3Track,textTrack:Object(o.dummyTrack)()}},e.destroy=function(){},t}(),l=function(t,e){return Object(r.isFiniteNumber)(t)?90*t:9e4*e};e.default=u},"./src/demux/chunk-cache.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return r}));var r=function(){function t(){this.chunks=[],this.dataLength=0}var e=t.prototype;return e.push=function(t){this.chunks.push(t),this.dataLength+=t.length},e.flush=function(){var t,e=this.chunks,n=this.dataLength;return e.length?(t=1===e.length?e[0]:function(t,e){for(var n=new Uint8Array(e),r=0,i=0;i<t.length;i++){var o=t[i];n.set(o,r),r+=o.length}return n}(e,n),this.reset(),t):new Uint8Array(0)},e.reset=function(){this.chunks.length=0,this.dataLength=0},t}()},
1"./src/demux/dummy-demuxed-track.ts":function(t,e,n){"use strict";function r(){return{type:"",id:-1,pid:-1,inputTimeScale:9e4,sequenceNumber:-1,samples:[],dropped:0}}n.r(e),n.d(e,"dummyTrack",(function(){return r}))},
vendor: 35,883 bytes, line 1
1"./src/demux/exp-golomb.ts":function(t,e,n){"use strict";n.r(e);var r=n("./src/utils/logger.ts"),i=function(){function t(t){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=t,this.bytesAvailable=t.byteLength,this.word=0,this.bitsAvailable=0}var e=t.prototype;return e.loadWord=function(){var t=this.data,e=this.bytesAvailable,n=t.byteLength-e,r=new Uint8Array(4),i=Math.min(4,e);if(0===i)throw new Error("no bytes available");r.set(t.subarray(n,n+i)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=8*i,this.bytesAvailable-=i},e.skipBits=function(t){var e;this.bitsAvailable>t?(this.word<<=t,this.bitsAvailable-=t):(t-=this.bitsAvailable,t-=(e=t>>3)>>3,this.bytesAvailable-=e,this.loadWord(),this.word<<=t,this.bitsAvailable-=t)},e.readBits=function(t){var e=Math.min(this.bitsAvailable,t),n=this.word>>>32-e;return t>32&&r.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=e,this.bitsAvailable>0?this.word<<=e:this.bytesAvailable>0&&this.loadWord(),(e=t-e)>0&&this.bitsAvailable?n<<e|this.readBits(e):n},e.skipLZ=function(){var t;for(t=0;t<this.bitsAvailable;++t)if(0!=(this.word&2147483648>>>t))return this.word<<=t,this.bitsAvailable-=t,t;return this.loadWord(),t+this.skipLZ()},e.skipUEG=function(){this.skipBits(1+this.skipLZ())},e.skipEG=function(){this.skipBits(1+this.skipLZ())},e.readUEG=function(){var t=this.skipLZ();return this.readBits(t+1)-1},e.readEG=function(){var t=this.readUEG();return 1&t?1+t>>>1:-1*(t>>>1)},e.readBoolean=function(){return 1===this.readBits(1)},e.readUByte=function(){return this.readBits(8)},e.readUShort=function(){return this.readBits(16)},e.readUInt=function(){return this.readBits(32)},e.skipScalingList=function(t){for(var e=8,n=8,r=0;r<t;r++)0!==n&&(n=(e+this.readEG()+256)%256),e=0===n?e:n},e.readSPS=function(){var t,e,n,r=0,i=0,o=0,a=0,s=this.readUByte.bind(this),u=this.readBits.bind(this),l=this.readUEG.bind(this),c=this.readBoolean.bind(this),f=this.skipBits.bind(this),d=this.skipEG.bind(this),h=this.skipUEG.bind(this),p=this.skipScalingList.bind(this);s();var y=s();if(u(5),f(3),s(),h(),100===y||110===y||122===y||244===y||44===y||83===y||86===y||118===y||128===y){var v=l();if(3===v&&f(1),h(),h(),f(1),c())for(e=3!==v?8:12,n=0;n<e;n++)c()&&p(n<6?16:64)}h();var g=l();if(0===g)l();else if(1===g)for(f(1),d(),d(),t=l(),n=0;n<t;n++)d();h(),f(1);var m=l(),b=l(),E=u(1);0===E&&f(1),f(1),c()&&(r=l(),i=l(),o=l(),a=l());var _=[1,1];if(c()&&c())switch(s()){case 1:_=[1,1];break;case 2:_=[12,11];break;case 3:_=[10,11];break;case 4:_=[16,11];break;case 5:_=[40,33];break;case 6:_=[24,11];break;case 7:_=[20,11];break;case 8:_=[32,11];break;case 9:_=[80,33];break;case 10:_=[18,11];break;case 11:_=[15,11];break;case 12:_=[64,33];break;case 13:_=[160,99];break;case 14:_=[4,3];break;case 15:_=[3,2];break;case 16:_=[2,1];break;case 255:_=[s()<<8|s(),s()<<8|s()]}return{width:Math.ceil(16*(m+1)-2*r-2*i),height:(2-E)*(b+1)*16-(E?2:4)*(o+a),pixelRatio:_}},e.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},t}();e.default=i},"./src/demux/id3.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"isHeader",(function(){return i})),n.d(e,"isFooter",(function(){return o})),n.d(e,"getID3Data",(function(){return a})),n.d(e,"canParse",(function(){return u})),n.d(e,"getTimeStamp",(function(){return l})),n.d(e,"isTimeStampFrame",(function(){return c})),n.d(e,"getID3Frames",(function(){return d})),n.d(e,"decodeFrame",(function(){return h})),n.d(e,"utf8ArrayToStr",(function(){return m})),n.d(e,"testables",(function(){return b}));var r,i=function(t,e){return e+10<=t.length&&73===t[e]&&68===t[e+1]&&51===t[e+2]&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128},o=function(t,e){return e+10<=t.length&&51===t[e]&&68===t[e+1]&&73===t[e+2]&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128},a=function(t,e){for(var n=e,r=0;i(t,e);)r+=10,r+=s(t,e+6),o(t,e+10)&&(r+=10),e+=r;if(r>0)return t.subarray(n,n+r)},s=function(t,e){var n=0;return n=(127&t[e])<<21,n|=(127&t[e+1])<<14,n|=(127&t[e+2])<<7,n|=127&t[e+3]},u=function(t,e){return i(t,e)&&s(t,e+6)+10<=t.length-e},l=function(t){for(var e=d(t),n=0;n<e.length;n++){var r=e[n];if(c(r))return g(r)}},c=function(t){return t&&"PRIV"===t.key&&"com.apple.streaming.transportStreamTimestamp"===t.info},f=function(t){var e=String.fromCharCode(t[0],t[1],t[2],t[3]),n=s(t,4);return{type:e,size:n,data:t.subarray(10,10+n)}},d=function(t){for(var e=0,n=[];i(t,e);){for(var r=s(t,e+6),a=(e+=10)+r;e+8<a;){var u=f(t.subarray(e)),l=h(u);l&&n.push(l),e+=u.size+10}o(t,e)&&(e+=10)}return n},h=function(t){return"PRIV"===t.type?p(t):"W"===t.type[0]?v(t):y(t)},p=function(t){if(!(t.size<2)){var e=m(t.data,!0),n=new Uint8Array(t.data.subarray(e.length+1));return{key:t.type,info:e,data:n.buffer}}},y=function(t){if(!(t.size<2)){if("TXXX"===t.type){var e=1,n=m(t.data.subarray(e),!0);e+=n.length+1;var r=m(t.data.subarray(e));return{key:t.type,info:n,data:r}}var i=m(t.data.subarray(1));return{key:t.type,data:i}}},v=function(t){if("WXXX"===t.type){if(t.size<2)return;var e=1,n=m(t.data.subarray(e),!0);e+=n.length+1;var r=m(t.data.subarray(e));return{key:t.type,info:n,data:r}}var i=m(t.data);return{key:t.type,data:i}},g=function(t){if(8===t.data.byteLength){var e=new Uint8Array(t.data),n=1&e[3],r=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return r/=45,n&&(r+=47721858.84),Math.round(r)}},m=function(t,e){void 0===e&&(e=!1);var n=E();if(n){var r=n.decode(t);if(e){var i=r.indexOf("\0");return-1!==i?r.substring(0,i):r}return r.replace(/\0/g,"")}for(var o,a,s,u=t.length,l="",c=0;c<u;){if(0===(o=t[c++])&&e)return l;if(0!==o&&3!==o)switch(o>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:l+=String.fromCharCode(o);break;case 12:case 13:a=t[c++],l+=String.fromCharCode((31&o)<<6|63&a);break;case 14:a=t[c++],s=t[c++],l+=String.fromCharCode((15&o)<<12|(63&a)<<6|(63&s)<<0)}}return l},b={decodeTextFrame:y};function E(){return r||void 0===self.TextDecoder||(r=new self.TextDecoder("utf-8")),r}},"./src/demux/mp3demuxer.ts":function(t,e,n){"use strict";n.r(e);var r=n("./src/demux/base-audio-demuxer.ts"),i=n("./src/demux/id3.ts"),o=n("./src/utils/logger.ts"),a=n("./src/demux/mpegaudio.ts");function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var u=function(t){var e,n;function r(){return t.apply(this,arguments)||this}n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,s(e,n);var u=r.prototype;return u.resetInitSegment=function(e,n,r){t.prototype.resetInitSegment.call(this,e,n,r),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,isAAC:!1,samples:[],manifestCodec:e,duration:r,inputTimeScale:9e4,dropped:0}},r.probe=function(t){if(!t)return!1;for(var e=(i.getID3Data(t,0)||[]).length,n=t.length;e<n;e++)if(a.probe(t,e))return o.logger.log("MPEG Audio sync word found !"),!0;return!1},u.canParse=function(t,e){return a.canParse(t,e)},u.appendFrame=function(t,e,n){if(null!==this.initPTS)return a.appendFrame(t,e,n,this.initPTS,this.frameIndex)},r}(r.default);u.minProbeByteLength=4,e.default=u},"./src/demux/mp4demuxer.ts":function(t,e,n){"use strict";n.r(e);var r=n("./src/utils/mp4-tools.ts"),i=n("./src/demux/dummy-demuxed-track.ts"),o=function(){function t(t,e){this.remainderData=null,this.config=void 0,this.config=e}var e=t.prototype;return e.resetTimeStamp=function(){},e.resetInitSegment=function(){},e.resetContiguity=function(){},t.probe=function(t){return Object(r.findBox)({data:t,start:0,end:Math.min(t.length,16384)},["moof"]).length>0},e.demux=function(t){var e=t,n=Object(i.dummyTrack)();if(this.config.progressive){this.remainderData&&(e=Object(r.appendUint8Array)(this.remainderData,t));var o=Object(r.segmentValidRange)(e);this.remainderData=o.remainder,n.samples=o.valid||new Uint8Array}else n.samples=e;return{audioTrack:Object(i.dummyTrack)(),avcTrack:n,id3Track:Object(i.dummyTrack)(),textTrack:Object(i.dummyTrack)()}},e.flush=function(){var t=Object(i.dummyTrack)();return t.samples=this.remainderData||new Uint8Array,this.remainderData=null,{audioTrack:Object(i.dummyTrack)(),avcTrack:t,id3Track:Object(i.dummyTrack)(),textTrack:Object(i.dummyTrack)()}},e.demuxSampleAes=function(t,e,n){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},e.destroy=function(){},t}();o.minProbeByteLength=1024,e.default=o},"./src/demux/mpegaudio.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"appendFrame",(function(){return u})),n.d(e,"parseHeader",(function(){return l})),n.d(e,"isHeaderPattern",(function(){return c})),n.d(e,"isHeader",(function(){return f})),n.d(e,"canParse",(function(){return d})),n.d(e,"probe",(function(){return h}));var r=null,i=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],o=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],a=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],s=[0,1,1,4];function u(t,e,n,r,i){if(!(n+24>e.length)){var o=l(e,n);if(o&&n+o.frameLength<=e.length){var a=r+i*(9e4*o.samplesPerFrame/o.sampleRate),s={unit:e.subarray(n,n+o.frameLength),pts:a,dts:a};return t.config=[],t.channelCount=o.channelCount,t.samplerate=o.sampleRate,t.samples.push(s),{sample:s,length:o.frameLength,missing:0}}}}function l(t,e){var n=t[e+1]>>3&3,u=t[e+1]>>1&3,l=t[e+2]>>4&15,c=t[e+2]>>2&3;if(1!==n&&0!==l&&15!==l&&3!==c){var f=t[e+2]>>1&1,d=t[e+3]>>6,h=1e3*i[14*(3===n?3-u:3===u?3:4)+l-1],p=o[3*(3===n?0:2===n?1:2)+c],y=3===d?1:2,v=a[n][u],g=s[u],m=8*v*g,b=Math.floor(v*h/p+f)*g;if(null===r){var E=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);r=E?parseInt(E[1]):0}return!!r&&r<=87&&2===u&&h>=224e3&&0===d&&(t[e+3]=128|t[e+3]),{sampleRate:p,channelCount:y,frameLength:b,samplesPerFrame:m}}}function c(t,e){return 255===t[e]&&224==(224&t[e+1])&&0!=(6&t[e+1])}function f(t,e){return e+1<t.length&&c(t,e)}function d(t,e){return c(t,e)&&4<=t.length-e}function h(t,e){if(e+1<t.length&&c(t,e)){var n=l(t,e),r=4;null!=n&&n.frameLength&&(r=n.frameLength);var i=e+r;return i===t.length||f(t,i)}return!1}},"./src/demux/sample-aes.ts":function(t,e,n){"use strict";n.r(e);var r=n("./src/crypt/decrypter.ts"),i=n("./src/demux/tsdemuxer.ts"),o=function(){function t(t,e,n){this.keyData=void 0,this.decrypter=void 0,this.keyData=n,this.decrypter=new r.default(t,e,{removePKCS7Padding:!1})}var e=t.prototype;return e.decryptBuffer=function(t,e){this.decrypter.decrypt(t,this.keyData.key.buffer,this.keyData.iv.buffer,e)},e.decryptAacSample=function(t,e,n,r){var i=t[e].unit,o=i.subarray(16,i.length-i.length%16),a=o.buffer.slice(o.byteOffset,o.byteOffset+o.length),s=this;this.decryptBuffer(a,(function(o){var a=new Uint8Array(o);i.set(a,16),r||s.decryptAacSamples(t,e+1,n)}))},e.decryptAacSamples=function(t,e,n){for(;;e++){if(e>=t.length)return void n();if(!(t[e].unit.length<32)){var r=this.decrypter.isSync();if(this.decryptAacSample(t,e,n,r),!r)return}}},e.getAvcEncryptedData=function(t){for(var e=16*Math.floor((t.length-48)/160)+16,n=new Int8Array(e),r=0,i=32;i<t.length-16;i+=160,r+=16)n.set(t.subarray(i,i+16),r);return n},e.getAvcDecryptedUnit=function(t,e){for(var n=new Uint8Array(e),r=0,i=32;i<t.length-16;i+=160,r+=16)t.set(n.subarray(r,r+16),i);return t},e.decryptAvcSample=function(t,e,n,r,o,a){var s=Object(i.discardEPB)(o.data),u=this.getAvcEncryptedData(s),l=this;this.decryptBuffer(u.buffer,(function(i){o.data=l.getAvcDecryptedUnit(s,i),a||l.decryptAvcSamples(t,e,n+1,r)}))},e.decryptAvcSamples=function(t,e,n,r){if(t instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;e++,n=0){if(e>=t.length)return void r();for(var i=t[e].units;!(n>=i.length);n++){var o=i[n];if(!(o.data.length<=48||1!==o.type&&5!==o.type)){var a=this.decrypter.isSync();if(this.decryptAvcSample(t,e,n,r,o,a),!a)return}}}},t}();e.default=o},"./src/demux/transmuxer-interface.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return f}));var r=n("./node_modules/webworkify-webpack/index.js"),i=n("./src/events.ts"),o=n("./src/demux/transmuxer.ts"),a=n("./src/utils/logger.ts"),s=n("./src/errors.ts"),u=n("./src/utils/mediasource-helper.ts"),l=n("./node_modules/eventemitter3/index.js"),c=Object(u.getMediaSource)()||{isTypeSupported:function(){return!1}},f=function(){function t(t,e,n,u){var f=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=t,this.id=e,this.onTransmuxComplete=n,this.onFlush=u;var d=t.config,h=function(e,n){(n=n||{}).frag=f.frag,n.id=f.id,t.trigger(e,n)};this.observer=new l.EventEmitter,this.observer.on(i.Events.FRAG_DECRYPTED,h),this.observer.on(i.Events.ERROR,h);var p={mp4:c.isTypeSupported("video/mp4"),mpeg:c.isTypeSupported("audio/mpeg"),mp3:c.isTypeSupported('audio/mp4; codecs="mp3"')},y=navigator.vendor;if(d.enableWorker&&"undefined"!=typeof Worker){var v;a.logger.log("demuxing in webworker");try{v=this.worker=r("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),v.addEventListener("message",this.onwmsg),v.onerror=function(e){t.trigger(i.Events.ERROR,{type:s.ErrorTypes.OTHER_ERROR,details:s.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(e.message+" ("+e.filename+":"+e.lineno+")")})},v.postMessage({cmd:"init",typeSupported:p,vendor:y,id:e,config:JSON.stringify(d)})}catch(t){a.logger.warn("Error in worker:",t),a.logger.error("Error while initializing DemuxerWorker, fallback to inline"),v&&self.URL.revokeObjectURL(v.objectURL),this.transmuxer=new o.default(this.observer,p,d,y,e),this.worker=null}}else this.transmuxer=new o.default(this.observer,p,d,y,e)}var e=t.prototype;return e.destroy=function(){var t=this.worker;if(t)t.removeEventListener("message",this.onwmsg),t.terminate(),this.worker=null;else{var e=this.transmuxer;e&&(e.destroy(),this.transmuxer=null)}var n=this.observer;n&&n.removeAllListeners(),this.observer=null},e.push=function(t,e,n,r,i,s,u,l,c,f){var d,h,p=this;c.transmuxing.start=self.performance.now();var y=this.transmuxer,v=this.worker,g=s?s.start:i.start,m=i.decryptdata,b=this.frag,E=!(b&&i.cc===b.cc),_=!(b&&c.level===b.level),T=b?c.sn-b.sn:-1,k=this.part?c.part-this.part.index:1,A=!_&&(1===T||0===T&&1===k),S=self.performance.now();(_||T||0===i.stats.parsing.start)&&(i.stats.parsing.start=S),!s||!k&&A||(s.stats.parsing.start=S);var w=!(b&&(null===(d=i.initSegment)||void 0===d?void 0:d.url)===(null===(h=b.initSegment)||void 0===h?void 0:h.url)),P=new o.TransmuxState(E,A,l,_,g,w);if(!A||E||w){a.logger.log("[transmuxer-interface, "+i.type+"]: Starting new transmux session for sn: "+c.sn+" p: "+c.part+" level: "+c.level+" id: "+c.id+"\n discontinuity: "+E+"\n trackSwitch: "+_+"\n contiguous: "+A+"\n accurateTimeOffset: "+l+"\n timeOffset: "+g+"\n initSegmentChange: "+w);var L=new o.TransmuxConfig(n,r,e,u,f);this.configureTransmuxer(L)}if(this.frag=i,this.part=s,v)v.postMessage({cmd:"demux",data:t,decryptdata:m,chunkMeta:c,state:P},t instanceof ArrayBuffer?[t]:[]);else if(y){var O=y.push(t,m,c,P);Object(o.isPromise)(O)?O.then((function(t){p.handleTransmuxComplete(t)})):this.handleTransmuxComplete(O)}},e.flush=function(t){var e=this;t.transmuxing.start=self.performance.now();var n=this.transmuxer,r=this.worker;if(r)r.postMessage({cmd:"flush",chunkMeta:t});else if(n){var i=n.flush(t);Object(o.isPromise)(i)?i.then((function(n){e.handleFlushResult(n,t)})):this.handleFlushResult(i,t)}},e.handleFlushResult=function(t,e){var n=this;t.forEach((function(t){n.handleTransmuxComplete(t)})),this.onFlush(e)},e.onWorkerMessage=function(t){var e=t.data,n=this.hls;switch(e.event){case"init":self.URL.revokeObjectURL(this.worker.objectURL);break;case"transmuxComplete":this.handleTransmuxComplete(e.data);break;case"flush":this.onFlush(e.data);break;default:e.data=e.data||{},e.data.frag=this.frag,e.data.id=this.id,n.trigger(e.event,e.data)}},e.configureTransmuxer=function(t){var e=this.worker,n=this.transmuxer;e?e.postMessage({cmd:"configure",config:t}):n&&n.configure(t)},e.handleTransmuxComplete=function(t){t.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(t)},t}()},"./src/demux/transmuxer-worker.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return s}));var r=n("./src/demux/transmuxer.ts"),i=n("./src/events.ts"),o=n("./src/utils/logger.ts"),a=n("./node_modules/eventemitter3/index.js");function s(t){var e=new a.EventEmitter,n=function(e,n){t.postMessage({event:e,data:n})};e.on(i.Events.FRAG_DECRYPTED,n),e.on(i.Events.ERROR,n),t.addEventListener("message",(function(i){var a=i.data;switch(a.cmd){case"init":var s=JSON.parse(a.config);t.transmuxer=new r.default(e,a.typeSupported,s,a.vendor,a.id),Object(o.enableLogs)(s.debug),n("init",null);break;case"configure":t.transmuxer.configure(a.config);break;case"demux":var l=t.transmuxer.push(a.data,a.decryptdata,a.chunkMeta,a.state);Object(r.isPromise)(l)?l.then((function(e){u(t,e)})):u(t,l);break;case"flush":var f=a.chunkMeta,d=t.transmuxer.flush(f);Object(r.isPromise)(d)?d.then((function(e){c(t,e,f)})):c(t,d,f)}}))}function u(t,e){if((n=e.remuxResult).audio||n.video||n.text||n.id3||n.initSegment){var n,r=[],i=e.remuxResult,o=i.audio,a=i.video;o&&l(r,o),a&&l(r,a),t.postMessage({event:"transmuxComplete",data:e},r)}}function l(t,e){e.data1&&t.push(e.data1.buffer),e.data2&&t.push(e.data2.buffer)}function c(t,e,n){e.forEach((function(e){u(t,e)})),t.postMessage({event:"flush",data:n})}},"./src/demux/transmuxer.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return m})),n.d(e,"isPromise",(function(){return E})),n.d(e,"TransmuxConfig",(function(){return _})),n.d(e,"TransmuxState",(function(){return T}));var r,i=n("./src/events.ts"),o=n("./src/errors.ts"),a=n("./src/crypt/decrypter.ts"),s=n("./src/demux/aacdemuxer.ts"),u=n("./src/demux/mp4demuxer.ts"),l=n("./src/demux/tsdemuxer.ts"),c=n("./src/demux/mp3demuxer.ts"),f=n("./src/remux/mp4-remuxer.ts"),d=n("./src/remux/passthrough-remuxer.ts"),h=n("./src/demux/chunk-cache.ts"),p=n("./src/utils/mp4-tools.ts"),y=n("./src/utils/logger.ts");try{r=self.performance.now.bind(self.performance)}catch(t){y.logger.debug("Unable to use Performance API on this environment"),r=self.Date.now}var v=[{demux:l.default,remux:f.default},{demux:u.default,remux:d.default},{demux:s.default,remux:f.default},{demux:c.default,remux:f.default}],g=1024;v.forEach((function(t){var e=t.demux;g=Math.max(g,e.minProbeByteLength)}));var m=function(){function t(t,e,n,r,i){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.cache=new h.default,this.observer=t,this.typeSupported=e,this.config=n,this.vendor=r,this.id=i}var e=t.prototype;return e.configure=function(t){this.transmuxConfig=t,this.decrypter&&this.decrypter.reset()},e.push=function(t,e,n,i){var o=this,a=n.transmuxing;a.executeStart=r();var s=new Uint8Array(t),u=this.cache,l=this.config,c=this.currentTransmuxState,f=this.transmuxConfig;i&&(this.currentTransmuxState=i);var d=function(t,e){var n=null;return t.byteLength>0&&null!=e&&null!=e.key&&null!==e.iv&&null!=e.method&&(n=e),n}(s,e);if(d&&"AES-128"===d.method){var h=this.getDecrypter();if(!l.enableSoftwareAES)return this.decryptionPromise=h.webCryptoDecrypt(s,d.key.buffer,d.iv.buffer).then((function(t){var e=o.push(t,null,n);return o.decryptionPromise=null,e})),this.decryptionPromise;var y=h.softwareDecrypt(s,d.key.buffer,d.iv.buffer);if(!y)return a.executeEnd=r(),b(n);s=new Uint8Array(y)}var v=i||c,g=v.contiguous,m=v.discontinuity,E=v.trackSwitch,_=v.accurateTimeOffset,T=v.timeOffset,k=v.initSegmentChange,A=f.audioCodec,S=f.videoCodec,w=f.defaultInitPts,P=f.duration,L=f.initSegmentData;if((m||E||k)&&this.resetInitSegment(L,A,S,P),(m||k)&&this.resetInitialTimestamp(w),g||this.resetContiguity(),this.needsProbing(s,m,E)){if(u.dataLength){var O=u.flush();s=Object(p.appendUint8Array)(O,s)}this.configureTransmuxer(s,f)}var R=this.transmux(s,d,T,_,n),C=this.currentTransmuxState;return C.contiguous=!0,C.discontinuity=!1,C.trackSwitch=!1,a.executeEnd=r(),R},e.flush=function(t){var e=this,n=t.transmuxing;n.executeStart=r();var a=this.decrypter,s=this.cache,u=this.currentTransmuxState,l=this.decryptionPromise;if(l)return l.then((function(){return e.flush(t)}));var c=[],f=u.timeOffset;if(a){var d=a.flush();d&&c.push(this.push(d,null,t))}var h=s.dataLength;s.reset();var p=this.demuxer,y=this.remuxer;if(!p||!y)return h>=g&&this.observer.emit(i.Events.ERROR,i.Events.ERROR,{type:o.ErrorTypes.MEDIA_ERROR,details:o.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),n.executeEnd=r(),[b(t)];var v=p.flush(f);return E(v)?v.then((function(n){return e.flushRemux(c,n,t),c})):(this.flushRemux(c,v,t),c)},e.flushRemux=function(t,e,n){var i=e.audioTrack,o=e.avcTrack,a=e.id3Track,s=e.textTrack,u=this.currentTransmuxState,l=u.accurateTimeOffset,c=u.timeOffset;y.logger.log("[transmuxer.ts]: Flushed fragment "+n.sn+(n.part>-1?" p: "+n.part:"")+" of level "+n.level);var f=this.remuxer.remux(i,o,a,s,c,l,!0,this.id);t.push({remuxResult:f,chunkMeta:n}),n.transmuxing.executeEnd=r()},e.resetInitialTimestamp=function(t){var e=this.demuxer,n=this.remuxer;e&&n&&(e.resetTimeStamp(t),n.resetTimeStamp(t))},e.resetContiguity=function(){var t=this.demuxer,e=this.remuxer;t&&e&&(t.resetContiguity(),e.resetNextTimestamp())},e.resetInitSegment=function(t,e,n,r){var i=this.demuxer,o=this.remuxer;i&&o&&(i.resetInitSegment(e,n,r),o.resetInitSegment(t,e,n))},e.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},e.transmux=function(t,e,n,r,i){return e&&"SAMPLE-AES"===e.method?this.transmuxSampleAes(t,e,n,r,i):this.transmuxUnencrypted(t,n,r,i)},e.transmuxUnencrypted=function(t,e,n,r){var i=this.demuxer.demux(t,e,!1,!this.config.progressive),o=i.audioTrack,a=i.avcTrack,s=i.id3Track,u=i.textTrack;return{remuxResult:this.remuxer.remux(o,a,s,u,e,n,!1,this.id),chunkMeta:r}},e.transmuxSampleAes=function(t,e,n,r,i){var o=this;return this.demuxer.demuxSampleAes(t,e,n).then((function(t){return{remuxResult:o.remuxer.remux(t.audioTrack,t.avcTrack,t.id3Track,t.textTrack,n,r,!1,o.id),chunkMeta:i}}))},e.configureTransmuxer=function(t,e){for(var n,r=this.config,i=this.observer,o=this.typeSupported,a=this.vendor,s=e.audioCodec,l=e.defaultInitPts,c=e.duration,f=e.initSegmentData,h=e.videoCodec,p=0,g=v.length;p<g;p++)if(v[p].demux.probe(t)){n=v[p];break}n||(y.logger.warn("Failed to find demuxer by probing frag, treating as mp4 passthrough"),n={demux:u.default,remux:d.default});var m=this.demuxer,b=this.remuxer,E=n.remux,_=n.demux;b&&b instanceof E||(this.remuxer=new E(i,r,o,a)),m&&m instanceof _||(this.demuxer=new _(i,r,o),this.probe=_.probe),this.resetInitSegment(f,s,h,c),this.resetInitialTimestamp(l)},e.needsProbing=function(t,e,n){return!this.demuxer||!this.remuxer||e||n},e.getDecrypter=function(){var t=this.decrypter;return t||(t=this.decrypter=new a.default(this.observer,this.config)),t},t}(),b=function(t){return{remuxResult:{},chunkMeta:t}};function E(t){return"then"in t&&t.then instanceof Function}var _=function(t,e,n,r,i){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=t,this.videoCodec=e,this.initSegmentData=n,this.duration=r,this.defaultInitPts=i},T=function(t,e,n,r,i,o){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=t,this.contiguous=e,this.accurateTimeOffset=n,this.trackSwitch=r,this.timeOffset=i,this.initSegmentChange=o}},"./src/demux/tsdemuxer.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"discardEPB",(function(){return E}));var r=n("./src/demux/adts.ts"),i=n("./src/demux/mpegaudio.ts"),o=n("./src/demux/exp-golomb.ts"),a=n("./src/demux/id3.ts"),s=n("./src/demux/sample-aes.ts"),u=n("./src/events.ts"),l=n("./src/utils/mp4-tools.ts"),c=n("./src/utils/logger.ts"),f=n("./src/errors.ts"),d={video:1,audio:2,id3:3,text:4},h=function(){function t(t,e,n){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this.aacLastPTS=null,this._initPTS=null,this._initDTS=null,this._pmtId=-1,this._avcTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.avcSample=null,this.remainderData=null,this.observer=t,this.config=e,this.typeSupported=n}t.probe=function(e){var n=t.syncOffset(e);return!(n<0||(n&&c.logger.warn("MPEG2-TS detected but first sync word found @ offset "+n+", junk ahead ?"),0))},t.syncOffset=function(t){for(var e=Math.min(1e3,t.length-564),n=0;n<e;){if(71===t[n]&&71===t[n+188]&&71===t[n+376])return n;n++}return-1},t.createTrack=function(t,e){return{container:"video"===t||"audio"===t?"video/mp2t":void 0,type:t,id:d[t],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===t?e:void 0}};var e=t.prototype;return e.resetInitSegment=function(e,n,r){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack=t.createTrack("video",r),this._audioTrack=t.createTrack("audio",r),this._id3Track=t.createTrack("id3",r),this._txtTrack=t.createTrack("text",r),this._audioTrack.isAAC=!0,this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.audioCodec=e,this.videoCodec=n,this._duration=r},e.resetTimeStamp=function(){},e.resetContiguity=function(){var t=this._audioTrack,e=this._avcTrack,n=this._id3Track;t&&(t.pesData=null),e&&(e.pesData=null),n&&(n.pesData=null),this.aacOverFlow=null,this.aacLastPTS=null},e.demux=function(e,n,r,i){var o;void 0===r&&(r=!1),void 0===i&&(i=!1),r||(this.sampleAes=null);var a=this._avcTrack,s=this._audioTrack,d=this._id3Track,h=a.pid,p=a.pesData,m=s.pid,b=d.pid,E=s.pesData,_=d.pesData,T=!1,k=this.pmtParsed,A=this._pmtId,S=e.length;if(this.remainderData&&(S=(e=Object(l.appendUint8Array)(this.remainderData,e)).length,this.remainderData=null),S<188&&!i)return this.remainderData=e,{audioTrack:s,avcTrack:a,id3Track:d,textTrack:this._txtTrack};var w=Math.max(0,t.syncOffset(e));(S-=(S+w)%188)<e.byteLength&&!i&&(this.remainderData=new Uint8Array(e.buffer,S,e.buffer.byteLength-S));for(var P=0,L=w;L<S;L+=188)if(71===e[L]){var O=!!(64&e[L+1]),R=((31&e[L+1])<<8)+e[L+2],C=void 0;if((48&e[L+3])>>4>1){if((C=L+5+e[L+4])===L+188)continue}else C=L+4;switch(R){case h:O&&(p&&(o=g(p))&&this.parseAVCPES(o,!1),p={data:[],size:0}),p&&(p.data.push(e.subarray(C,L+188)),p.size+=L+188-C);break;case m:O&&(E&&(o=g(E))&&(s.isAAC?this.parseAACPES(o):this.parseMPEGPES(o)),E={data:[],size:0}),E&&(E.data.push(e.subarray(C,L+188)),E.size+=L+188-C);break;case b:O&&(_&&(o=g(_))&&this.parseID3PES(o),_={data:[],size:0}),_&&(_.data.push(e.subarray(C,L+188)),_.size+=L+188-C);break;case 0:O&&(C+=e[C]+1),A=this._pmtId=y(e,C);break;case A:O&&(C+=e[C]+1);var D=v(e,C,!0===this.typeSupported.mpeg||!0===this.typeSupported.mp3,r);(h=D.avc)>0&&(a.pid=h),(m=D.audio)>0&&(s.pid=m,s.isAAC=D.isAAC),(b=D.id3)>0&&(d.pid=b),T&&!k&&(c.logger.log("reparse from beginning"),T=!1,L=w-188),k=this.pmtParsed=!0;break;case 17:case 8191:break;default:T=!0}}else P++;P>0&&this.observer.emit(u.Events.ERROR,u.Events.ERROR,{type:f.ErrorTypes.MEDIA_ERROR,details:f.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"Found "+P+" TS packet/s that do not start with 0x47"}),a.pesData=p,s.pesData=E,d.pesData=_;var I={audioTrack:s,avcTrack:a,id3Track:d,textTrack:this._txtTrack};return i&&this.extractRemainingSamples(I),I},e.flush=function(){var t,e=this.remainderData;return this.remainderData=null,t=e?this.demux(e,-1,!1,!0):{audioTrack:this._audioTrack,avcTrack:this._avcTrack,textTrack:this._txtTrack,id3Track:this._id3Track},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t},e.extractRemainingSamples=function(t){var e,n=t.audioTrack,r=t.avcTrack,i=t.id3Track,o=r.pesData,a=n.pesData,s=i.pesData;o&&(e=g(o))?(this.parseAVCPES(e,!0),r.pesData=null):r.pesData=o,a&&(e=g(a))?(n.isAAC?this.parseAACPES(e):this.parseMPEGPES(e),n.pesData=null):(null!=a&&a.size&&c.logger.log("last AAC PES packet truncated,might overlap between fragments"),n.pesData=a),s&&(e=g(s))?(this.parseID3PES(e),i.pesData=null):i.pesData=s},e.demuxSampleAes=function(t,e,n){var r=this.demux(t,n,!0,!this.config.progressive),i=this.sampleAes=new s.default(this.observer,this.config,e);return this.decrypt(r,i)},e.decrypt=function(t,e){return new Promise((function(n){var r=t.audioTrack,i=t.avcTrack;r.samples&&r.isAAC?e.decryptAacSamples(r.samples,0,(function(){i.samples?e.decryptAvcSamples(i.samples,0,0,(function(){n(t)})):n(t)})):i.samples&&e.decryptAvcSamples(i.samples,0,0,(function(){n(t)}))}))},e.destroy=function(){this._initPTS=this._initDTS=null,this._duration=0},e.parseAVCPES=function(t,e){var n,r=this,i=this._avcTrack,s=this.parseAVCNALu(t.data),u=this.avcSample,l=!1;t.data=null,u&&s.length&&!i.audFound&&(m(u,i),u=this.avcSample=p(!1,t.pts,t.dts,"")),s.forEach((function(e){switch(e.type){case 1:n=!0,u||(u=r.avcSample=p(!0,t.pts,t.dts,"")),u.frame=!0;var s=e.data;if(l&&s.length>4){var c=new o.default(s).readSliceType();2!==c&&4!==c&&7!==c&&9!==c||(u.key=!0)}break;case 5:n=!0,u||(u=r.avcSample=p(!0,t.pts,t.dts,"")),u.key=!0,u.frame=!0;break;case 6:n=!0;var f=new o.default(E(e.data));f.readUByte();for(var d=0,h=0,y=!1,v=0;!y&&f.bytesAvailable>1;){d=0;do{d+=v=f.readUByte()}while(255===v);h=0;do{h+=v=f.readUByte()}while(255===v);if(4===d&&0!==f.bytesAvailable){if(y=!0,181===f.readUByte()&&49===f.readUShort()&&1195456820===f.readUInt()&&3===f.readUByte()){for(var g=f.readUByte(),_=31&g,T=[g,f.readUByte()],k=0;k<_;k++)T.push(f.readUByte()),T.push(f.readUByte()),T.push(f.readUByte());b(r._txtTrack.samples,{type:3,pts:t.pts,bytes:T})}}else if(5===d&&0!==f.bytesAvailable){if(y=!0,h>16){for(var A=[],S=0;S<16;S++)A.push(f.readUByte().toString(16)),3!==S&&5!==S&&7!==S&&9!==S||A.push("-");for(var w=h-16,P=new Uint8Array(w),L=0;L<w;L++)P[L]=f.readUByte();b(r._txtTrack.samples,{pts:t.pts,payloadType:d,uuid:A.join(""),userData:Object(a.utf8ArrayToStr)(P),userDataBytes:P})}}else if(h<f.bytesAvailable)for(var O=0;O<h;O++)f.readUByte()}break;case 7:if(n=!0,l=!0,!i.sps){var R=new o.default(e.data).readSPS();i.width=R.width,i.height=R.height,i.pixelRatio=R.pixelRatio,i.sps=[e.data],i.duration=r._duration;for(var C=e.data.subarray(1,4),D="avc1.",I=0;I<3;I++){var x=C[I].toString(16);x.length<2&&(x="0"+x),D+=x}i.codec=D}break;case 8:n=!0,i.pps||(i.pps=[e.data]);break;case 9:n=!1,i.audFound=!0,u&&m(u,i),u=r.avcSample=p(!1,t.pts,t.dts,"");break;case 12:n=!1;break;default:n=!1,u&&(u.debug+="unknown NAL "+e.type+" ")}u&&n&&u.units.push(e)})),e&&u&&(m(u,i),this.avcSample=null)},e.getLastNalUnit=function(){var t,e,n=this.avcSample;if(!n||0===n.units.length){var r=this._avcTrack.samples;n=r[r.length-1]}if(null!==(t=n)&&void 0!==t&&t.units){var i=n.units;e=i[i.length-1]}return e},e.parseAVCNALu=function(t){var e,n,r=t.byteLength,i=this._avcTrack,o=i.naluState||0,a=o,s=[],u=0,l=-1,c=0;for(-1===o&&(l=0,c=31&t[0],o=0,u=1);u<r;)if(e=t[u++],o)if(1!==o)if(e)if(1===e){if(l>=0){var f={data:t.subarray(l,u-o-1),type:c};s.push(f)}else{var d=this.getLastNalUnit();if(d&&(a&&u<=4-a&&d.state&&(d.data=d.data.subarray(0,d.data.byteLength-a)),(n=u-o-1)>0)){var h=new Uint8Array(d.data.byteLength+n);h.set(d.data,0),h.set(t.subarray(0,n),d.data.byteLength),d.data=h,d.state=0}}u<r?(l=u,c=31&t[u],o=0):o=-1}else o=0;else o=3;else o=e?0:2;else o=e?0:1;if(l>=0&&o>=0){var p={data:t.subarray(l,r),type:c,state:o};s.push(p)}if(0===s.length){var y=this.getLastNalUnit();if(y){var v=new Uint8Array(y.data.byteLength+t.byteLength);v.set(y.data,0),v.set(t,y.data.byteLength),y.data=v}}return i.naluState=o,s},e.parseAACPES=function(t){var e,n,i,o,a,s=0,l=this._audioTrack,d=this.aacOverFlow,h=t.data;if(d){this.aacOverFlow=null;var p=d.sample.unit.byteLength,y=Math.min(d.missing,p),v=p-y;d.sample.unit.set(h.subarray(0,y),v),l.samples.push(d.sample),s=d.missing}for(e=s,n=h.length;e<n-1&&!r.isHeader(h,e);e++);if(e===s||(e<n-1?(i="AAC PES did not start with ADTS header,offset:"+e,o=!1):(i="no ADTS header found in AAC PES",o=!0),c.logger.warn("parsing error:"+i),this.observer.emit(u.Events.ERROR,u.Events.ERROR,{type:f.ErrorTypes.MEDIA_ERROR,details:f.ErrorDetails.FRAG_PARSING_ERROR,fatal:o,reason:i}),!o)){if(r.initTrackConfig(l,this.observer,h,e,this.audioCodec),void 0!==t.pts)a=t.pts;else{if(!d)return void c.logger.warn("[tsdemuxer]: AAC PES unknown PTS");var g=r.getFrameDuration(l.samplerate);a=d.sample.pts+g}for(var m=0;e<n;){if(r.isHeader(h,e)){if(e+5<n){var b=r.appendFrame(l,h,e,a,m);if(b){if(!b.missing){e+=b.length,m++;continue}this.aacOverFlow=b}}break}e++}}},e.parseMPEGPES=function(t){var e=t.data,n=e.length,r=0,o=0,a=t.pts;if(void 0!==a)for(;o<n;)if(i.isHeader(e,o)){var s=i.appendFrame(this._audioTrack,e,o,a,r);if(!s)break;o+=s.length,r++}else o++;else c.logger.warn("[tsdemuxer]: MPEG PES unknown PTS")},e.parseID3PES=function(t){void 0!==t.pts?this._id3Track.samples.push(t):c.logger.warn("[tsdemuxer]: ID3 PES unknown PTS")},t}();function p(t,e,n,r){return{key:t,frame:!1,pts:e,dts:n,units:[],debug:r,length:0}}function y(t,e){return(31&t[e+10])<<8|t[e+11]}function v(t,e,n,r){var i={audio:-1,avc:-1,id3:-1,isAAC:!0},o=e+3+((15&t[e+1])<<8|t[e+2])-4;for(e+=12+((15&t[e+10])<<8|t[e+11]);e<o;){var a=(31&t[e+1])<<8|t[e+2];switch(t[e]){case 207:if(!r){c.logger.log("ADTS AAC with AES-128-CBC frame encryption found in unencrypted stream");break}case 15:-1===i.audio&&(i.audio=a);break;case 21:-1===i.id3&&(i.id3=a);break;case 219:if(!r){c.logger.log("H.264 with AES-128-CBC slice encryption found in unencrypted stream");break}case 27:-1===i.avc&&(i.avc=a);break;case 3:case 4:n?-1===i.audio&&(i.audio=a,i.isAAC=!1):c.logger.log("MPEG audio found, not supported in this browser");break;case 36:c.logger.warn("Unsupported HEVC stream type found")}e+=5+((15&t[e+3])<<8|t[e+4])}return i}function g(t){var e,n,r,i,o,a=0,s=t.data;if(!t||0===t.size)return null;for(;s[0].length<19&&s.length>1;){var u=new Uint8Array(s[0].length+s[1].length);u.set(s[0]),u.set(s[1],s[0].length),s[0]=u,s.splice(1,1)}if(1===((e=s[0])[0]<<16)+(e[1]<<8)+e[2]){if((n=(e[4]<<8)+e[5])&&n>t.size-6)return null;var l=e[7];192&l&&(i=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,64&l?i-(o=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2)>54e5&&(c.logger.warn(Math.round((i-o)/9e4)+"s delta between PTS and DTS, align them"),i=o):o=i);var f=(r=e[8])+9;if(t.size<=f)return null;t.size-=f;for(var d=new Uint8Array(t.size),h=0,p=s.length;h<p;h++){var y=(e=s[h]).byteLength;if(f){if(f>y){f-=y;continue}e=e.subarray(f),y-=f,f=0}d.set(e,a),a+=y}return n&&(n-=r+3),{data:d,pts:i,dts:o,len:n}}return null}function m(t,e){if(t.units.length&&t.frame){if(void 0===t.pts){var n=e.samples,r=n.length;if(!r)return void e.dropped++;var i=n[r-1];t.pts=i.pts,t.dts=i.dts}e.samples.push(t)}t.debug.length&&c.logger.log(t.pts+"/"+t.dts+":"+t.debug)}function b(t,e){var n=t.length;if(n>0){if(e.pts>=t[n-1].pts)t.push(e);else for(var r=n-1;r>=0;r--)if(e.pts<t[r].pts){t.splice(r,0,e);break}}else t.push(e)}function E(t){for(var e=t.byteLength,n=[],r=1;r<e-2;)0===t[r]&&0===t[r+1]&&3===t[r+2]?(n.push(r+2),r+=2):r++;if(0===n.length)return t;var i=e-n.length,o=new Uint8Array(i),a=0;for(r=0;r<i;a++,r++)a===n[0]&&(a++,n.shift()),o[r]=t[a];return o}h.minProbeByteLength=188,e.default=h},
1"./src/errors.ts":function(t,e,n){"use strict";var r,i;n.r(e),n.d(e,"ErrorTypes",(function(){return r})),n.d(e,"ErrorDetails",(function(){return i})),function(t){t.NETWORK_ERROR="networkError",t.MEDIA_ERROR="mediaError",t.KEY_SYSTEM_ERROR="keySystemError",t.MUX_ERROR="muxError",t.OTHER_ERROR="otherError"}(r||(r={})),function(t){t.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",t.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",t.KEY_SYSTEM_NO_SESSION="keySystemNoSession",t.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",t.KEY_SYSTEM_NO_INIT_DATA="keySystemNoInitData",t.MANIFEST_LOAD_ERROR="manifestLoadError",t.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",t.MANIFEST_PARSING_ERROR="manifestParsingError",t.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",t.LEVEL_EMPTY_ERROR="levelEmptyError",t.LEVEL_LOAD_ERROR="levelLoadError",t.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",t.LEVEL_SWITCH_ERROR="levelSwitchError",t.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",t.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",t.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",t.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",t.FRAG_LOAD_ERROR="fragLoadError",t.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",t.FRAG_DECRYPT_ERROR="fragDecryptError",t.FRAG_PARSING_ERROR="fragParsingError",t.REMUX_ALLOC_ERROR="remuxAllocError",t.KEY_LOAD_ERROR="keyLoadError",t.KEY_LOAD_TIMEOUT="keyLoadTimeOut",t.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",t.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",t.BUFFER_APPEND_ERROR="bufferAppendError",t.BUFFER_APPENDING_ERROR="bufferAppendingError",t.BUFFER_STALLED_ERROR="bufferStalledError",t.BUFFER_FULL_ERROR="bufferFullError",t.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",t.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",t.INTERNAL_EXCEPTION="internalException",t.INTERNAL_ABORTED="aborted",t.UNKNOWN="unknown"}(i||(i={}))},
1"./src/events.ts":function(t,e,n){"use strict";var r;n.r(e),n.d(e,"Events",(function(){return r})),function(t){t.MEDIA_ATTACHING="hlsMediaAttaching",t.MEDIA_ATTACHED="hlsMediaAttached",t.MEDIA_DETACHING="hlsMediaDetaching",t.MEDIA_DETACHED="hlsMediaDetached",t.BUFFER_RESET="hlsBufferReset",t.BUFFER_CODECS="hlsBufferCodecs",t.BUFFER_CREATED="hlsBufferCreated",t.BUFFER_APPENDING="hlsBufferAppending",t.BUFFER_APPENDED="hlsBufferAppended",t.BUFFER_EOS="hlsBufferEos",t.BUFFER_FLUSHING="hlsBufferFlushing",t.BUFFER_FLUSHED="hlsBufferFlushed",t.MANIFEST_LOADING="hlsManifestLoading",t.MANIFEST_LOADED="hlsManifestLoaded",t.MANIFEST_PARSED="hlsManifestParsed",t.LEVEL_SWITCHING="hlsLevelSwitching",t.LEVEL_SWITCHED="hlsLevelSwitched",t.LEVEL_LOADING="hlsLevelLoading",t.LEVEL_LOADED="hlsLevelLoaded",t.LEVEL_UPDATED="hlsLevelUpdated",t.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",t.LEVELS_UPDATED="hlsLevelsUpdated",t.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",t.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",t.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",t.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",t.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",t.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",t.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",t.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",t.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",t.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",t.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",t.CUES_PARSED="hlsCuesParsed",t.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",t.INIT_PTS_FOUND="hlsInitPtsFound",t.FRAG_LOADING="hlsFragLoading",t.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",t.FRAG_LOADED="hlsFragLoaded",t.FRAG_DECRYPTED="hlsFragDecrypted",t.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",t.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",t.FRAG_PARSING_METADATA="hlsFragParsingMetadata",t.FRAG_PARSED="hlsFragParsed",t.FRAG_BUFFERED="hlsFragBuffered",t.FRAG_CHANGED="hlsFragChanged",t.FPS_DROP="hlsFpsDrop",t.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",t.ERROR="hlsError",t.DESTROYING="hlsDestroying",t.KEY_LOADING="hlsKeyLoading",t.KEY_LOADED="hlsKeyLoaded",t.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",t.BACK_BUFFER_REACHED="hlsBackBufferReached"}(r||(r={}))},
vendor: 25,389 bytes, line 1
1"./src/hls.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return m}));var r=n("./node_modules/url-toolkit/src/url-toolkit.js"),i=n("./src/loader/playlist-loader.ts"),o=n("./src/loader/key-loader.ts"),a=n("./src/controller/id3-track-controller.ts"),s=n("./src/controller/latency-controller.ts"),u=n("./src/controller/level-controller.ts"),l=n("./src/controller/fragment-tracker.ts"),c=n("./src/controller/stream-controller.ts"),f=n("./src/is-supported.ts"),d=n("./src/utils/logger.ts"),h=n("./src/config.ts"),p=n("./node_modules/eventemitter3/index.js"),y=n("./src/events.ts"),v=n("./src/errors.ts");function g(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var m=function(){function t(e){void 0===e&&(e={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new p.EventEmitter,this._autoLevelCapping=void 0,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null;var n=this.config=Object(h.mergeConfig)(t.DefaultConfig,e);this.userConfig=e,Object(d.enableLogs)(n.debug),this._autoLevelCapping=-1,n.progressive&&Object(h.enableStreamingMode)(n);var r=n.abrController,f=n.bufferController,y=n.capLevelController,v=n.fpsController,g=this.abrController=new r(this),m=this.bufferController=new f(this),b=this.capLevelController=new y(this),E=new v(this),_=new i.default(this),T=new o.default(this),k=new a.default(this),A=this.levelController=new u.default(this),S=new l.FragmentTracker(this),w=this.streamController=new c.default(this,S);b.setStreamController(w),E.setStreamController(w);var P=[A,w];this.networkControllers=P;var L=[_,T,g,m,b,E,k,S];this.audioTrackController=this.createController(n.audioTrackController,null,P),this.createController(n.audioStreamController,S,P),this.subtitleTrackController=this.createController(n.subtitleTrackController,null,P),this.createController(n.subtitleStreamController,S,P),this.createController(n.timelineController,null,L),this.emeController=this.createController(n.emeController,null,L),this.cmcdController=this.createController(n.cmcdController,null,L),this.latencyController=this.createController(s.default,null,L),this.coreComponents=L}t.isSupported=function(){return Object(f.isSupported)()};var e,n,m,b=t.prototype;return b.createController=function(t,e,n){if(t){var r=e?new t(this,e):new t(this);return n&&n.push(r),r}return null},b.on=function(t,e,n){void 0===n&&(n=this),this._emitter.on(t,e,n)},b.once=function(t,e,n){void 0===n&&(n=this),this._emitter.once(t,e,n)},b.removeAllListeners=function(t){this._emitter.removeAllListeners(t)},b.off=function(t,e,n,r){void 0===n&&(n=this),this._emitter.off(t,e,n,r)},b.listeners=function(t){return this._emitter.listeners(t)},b.emit=function(t,e,n){return this._emitter.emit(t,e,n)},b.trigger=function(t,e){if(this.config.debug)return this.emit(t,t,e);try{return this.emit(t,t,e)}catch(e){d.logger.error("An internal error happened while handling event "+t+'. Error message: "'+e.message+'". Here is a stacktrace:',e),this.trigger(y.Events.ERROR,{type:v.ErrorTypes.OTHER_ERROR,details:v.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:t,error:e})}return!1},b.listenerCount=function(t){return this._emitter.listenerCount(t)},b.destroy=function(){d.logger.log("destroy"),this.trigger(y.Events.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach((function(t){return t.destroy()})),this.networkControllers.length=0,this.coreComponents.forEach((function(t){return t.destroy()})),this.coreComponents.length=0},b.attachMedia=function(t){d.logger.log("attachMedia"),this._media=t,this.trigger(y.Events.MEDIA_ATTACHING,{media:t})},b.detachMedia=function(){d.logger.log("detachMedia"),this.trigger(y.Events.MEDIA_DETACHING,void 0),this._media=null},b.loadSource=function(t){this.stopLoad();var e=this.media,n=this.url,i=this.url=r.buildAbsoluteURL(self.location.href,t,{alwaysNormalize:!0});d.logger.log("loadSource:"+i),e&&n&&n!==i&&this.bufferController.hasSourceTypes()&&(this.detachMedia(),this.attachMedia(e)),this.trigger(y.Events.MANIFEST_LOADING,{url:t})},b.startLoad=function(t){void 0===t&&(t=-1),d.logger.log("startLoad("+t+")"),this.networkControllers.forEach((function(e){e.startLoad(t)}))},b.stopLoad=function(){d.logger.log("stopLoad"),this.networkControllers.forEach((function(t){t.stopLoad()}))},b.swapAudioCodec=function(){d.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()},b.recoverMediaError=function(){d.logger.log("recoverMediaError");var t=this._media;this.detachMedia(),t&&this.attachMedia(t)},b.removeLevel=function(t,e){void 0===e&&(e=0),this.levelController.removeLevel(t,e)},e=t,m=[{key:"version",get:function(){return"1.1.5"}},{key:"Events",get:function(){return y.Events}},{key:"ErrorTypes",get:function(){return v.ErrorTypes}},{key:"ErrorDetails",get:function(){return v.ErrorDetails}},{key:"DefaultConfig",get:function(){return t.defaultConfig?t.defaultConfig:h.hlsDefaultConfig},set:function(e){t.defaultConfig=e}}],(n=[{key:"levels",get:function(){var t=this.levelController.levels;return t||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(t){d.logger.log("set currentLevel:"+t),this.loadLevel=t,this.abrController.clearTimer(),this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(t){d.logger.log("set nextLevel:"+t),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(t){d.logger.log("set loadLevel:"+t),this.levelController.manualLevel=t}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(t){this.levelController.nextLoadLevel=t}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(t){d.logger.log("set firstLevel:"+t),this.levelController.firstLevel=t}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(t){d.logger.log("set startLevel:"+t),-1!==t&&(t=Math.max(t,this.minAutoLevel)),this.levelController.startLevel=t}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(t){var e=!!t;e!==this.config.capLevelToPlayerSize&&(e?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=e)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(t){this._autoLevelCapping!==t&&(d.logger.log("set autoLevelCapping:"+t),this._autoLevelCapping=t)}},{key:"bandwidthEstimate",get:function(){var t=this.abrController.bwEstimator;return t?t.getEstimate():NaN}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var t=this.levels,e=this.config.minAutoBitrate;if(!t)return 0;for(var n=t.length,r=0;r<n;r++)if(t[r].maxBitrate>e)return r;return 0}},{key:"maxAutoLevel",get:function(){var t=this.levels,e=this.autoLevelCapping;return-1===e&&t&&t.length?t.length-1:e}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(t){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,t)}},{key:"audioTracks",get:function(){var t=this.audioTrackController;return t?t.audioTracks:[]}},{key:"audioTrack",get:function(){var t=this.audioTrackController;return t?t.audioTrack:-1},set:function(t){var e=this.audioTrackController;e&&(e.audioTrack=t)}},{key:"subtitleTracks",get:function(){var t=this.subtitleTrackController;return t?t.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var t=this.subtitleTrackController;return t?t.subtitleTrack:-1},set:function(t){var e=this.subtitleTrackController;e&&(e.subtitleTrack=t)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var t=this.subtitleTrackController;return!!t&&t.subtitleDisplay},set:function(t){var e=this.subtitleTrackController;e&&(e.subtitleDisplay=t)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(t){this.config.lowLatencyMode=t}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}])&&g(e.prototype,n),m&&g(e,m),t}();m.defaultConfig=void 0},"./src/is-supported.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"isSupported",(function(){return o})),n.d(e,"changeTypeSupported",(function(){return a}));var r=n("./src/utils/mediasource-helper.ts");function i(){return self.SourceBuffer||self.WebKitSourceBuffer}function o(){var t=Object(r.getMediaSource)();if(!t)return!1;var e=i(),n=t&&"function"==typeof t.isTypeSupported&&t.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),o=!e||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove;return!!n&&!!o}function a(){var t,e=i();return"function"==typeof(null==e||null===(t=e.prototype)||void 0===t?void 0:t.changeType)}},"./src/loader/fragment-loader.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return f})),n.d(e,"LoadError",(function(){return h}));var r=n("./src/polyfills/number.ts"),i=n("./src/errors.ts");function o(t){var e="function"==typeof Map?new Map:void 0;return(o=function(t){if(null===t||(n=t,-1===Function.toString.call(n).indexOf("[native code]")))return t;var n;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return a(t,arguments,l(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),u(r,t)})(t)}function a(t,e,n){return(a=s()?Reflect.construct:function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&u(i,n.prototype),i}).apply(null,arguments)}function s(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var c=Math.pow(2,17),f=function(){function t(t){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=t}var e=t.prototype;return e.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},e.abort=function(){this.loader&&this.loader.abort()},e.load=function(t,e){var n=this,r=t.url;if(!r)return Promise.reject(new h({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:t,networkDetails:null},"Fragment does not have a "+(r?"part list":"url")));this.abort();var o=this.config,a=o.fLoader,s=o.loader;return new Promise((function(r,u){n.loader&&n.loader.destroy();var l=n.loader=t.loader=a?new a(o):new s(o),f=d(t),p={timeout:o.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:o.fragLoadingMaxRetryTimeout,highWaterMark:c};t.stats=l.stats,l.load(f,p,{onSuccess:function(e,i,o,a){n.resetLoader(t,l),r({frag:t,part:null,payload:e.data,networkDetails:a})},onError:function(e,r,o){n.resetLoader(t,l),u(new h({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:t,response:e,networkDetails:o}))},onAbort:function(e,r,o){n.resetLoader(t,l),u(new h({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:t,networkDetails:o}))},onTimeout:function(e,r,o){n.resetLoader(t,l),u(new h({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,networkDetails:o}))},onProgress:function(n,r,i,o){e&&e({frag:t,part:null,payload:i,networkDetails:o})}})}))},e.loadPart=function(t,e,n){var r=this;this.abort();var o=this.config,a=o.fLoader,s=o.loader;return new Promise((function(u,l){r.loader&&r.loader.destroy();var f=r.loader=t.loader=a?new a(o):new s(o),p=d(t,e),y={timeout:o.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:o.fragLoadingMaxRetryTimeout,highWaterMark:c};e.stats=f.stats,f.load(p,y,{onSuccess:function(i,o,a,s){r.resetLoader(t,f),r.updateStatsFromPart(t,e);var l={frag:t,part:e,payload:i.data,networkDetails:s};n(l),u(l)},onError:function(n,o,a){r.resetLoader(t,f),l(new h({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:t,part:e,response:n,networkDetails:a}))},onAbort:function(n,o,a){t.stats.aborted=e.stats.aborted,r.resetLoader(t,f),l(new h({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:t,part:e,networkDetails:a}))},onTimeout:function(n,o,a){r.resetLoader(t,f),l(new h({type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,part:e,networkDetails:a}))}})}))},e.updateStatsFromPart=function(t,e){var n=t.stats,r=e.stats,i=r.total;if(n.loaded+=r.loaded,i){var o=Math.round(t.duration/e.duration),a=Math.min(Math.round(n.loaded/i),o),s=(o-a)*Math.round(n.loaded/a);n.total=n.loaded+s}else n.total=Math.max(n.loaded,n.total);var u=n.loading,l=r.loading;u.start?u.first+=l.first-l.start:(u.start=l.start,u.first=l.first),u.end=l.end},e.resetLoader=function(t,e){t.loader=null,this.loader===e&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),e.destroy()},t}();function d(t,e){void 0===e&&(e=null);var n=e||t,i={frag:t,part:e,responseType:"arraybuffer",url:n.url,headers:{},rangeStart:0,rangeEnd:0},o=n.byteRangeStartOffset,a=n.byteRangeEndOffset;return Object(r.isFiniteNumber)(o)&&Object(r.isFiniteNumber)(a)&&(i.rangeStart=o,i.rangeEnd=a),i}var h=function(t){var e,n;function r(e){for(var n,r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];return(n=t.call.apply(t,[this].concat(i))||this).data=void 0,n.data=e,n}return n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,u(e,n),r}(o(Error))},"./src/loader/fragment.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"ElementaryStreamTypes",(function(){return r})),n.d(e,"BaseSegment",(function(){return h})),n.d(e,"Fragment",(function(){return p})),n.d(e,"Part",(function(){return y}));var r,i=n("./src/polyfills/number.ts"),o=n("./node_modules/url-toolkit/src/url-toolkit.js"),a=n("./src/utils/logger.ts"),s=n("./src/loader/level-key.ts"),u=n("./src/loader/load-stats.ts");function l(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,c(t,e)}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function f(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function d(t,e,n){return e&&f(t.prototype,e),n&&f(t,n),t}!function(t){t.AUDIO="audio",t.VIDEO="video",t.AUDIOVIDEO="audiovideo"}(r||(r={}));var h=function(){function t(t){var e;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=((e={})[r.AUDIO]=null,e[r.VIDEO]=null,e[r.AUDIOVIDEO]=null,e),this.baseurl=t}return t.prototype.setByteRange=function(t,e){var n=t.split("@",2),r=[];1===n.length?r[0]=e?e.byteRangeEndOffset:0:r[0]=parseInt(n[1]),r[1]=parseInt(n[0])+r[0],this._byteRange=r},d(t,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Object(o.buildAbsoluteURL)(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(t){this._url=t}}]),t}(),p=function(t){function e(e,n){var r;return(r=t.call(this,n)||this)._decryptdata=null,r.rawProgramDateTime=null,r.programDateTime=null,r.tagList=[],r.duration=0,r.sn=0,r.levelkey=void 0,r.type=void 0,r.loader=null,r.level=-1,r.cc=0,r.startPTS=void 0,r.endPTS=void 0,r.appendedPTS=void 0,r.startDTS=void 0,r.endDTS=void 0,r.start=0,r.deltaPTS=void 0,r.maxStartPTS=void 0,r.minEndPTS=void 0,r.stats=new u.LoadStats,r.urlId=0,r.data=void 0,r.bitrateTest=!1,r.title=null,r.initSegment=null,r.type=e,r}l(e,t);var n=e.prototype;return n.createInitializationVector=function(t){for(var e=new Uint8Array(16),n=12;n<16;n++)e[n]=t>>8*(15-n)&255;return e},n.setDecryptDataFromLevelKey=function(t,e){var n=t;return"AES-128"===(null==t?void 0:t.method)&&t.uri&&!t.iv&&((n=s.LevelKey.fromURI(t.uri)).method=t.method,n.iv=this.createInitializationVector(e),n.keyFormat="identity"),n},n.setElementaryStreamInfo=function(t,e,n,r,i,o){void 0===o&&(o=!1);var a=this.elementaryStreams,s=a[t];s?(s.startPTS=Math.min(s.startPTS,e),s.endPTS=Math.max(s.endPTS,n),s.startDTS=Math.min(s.startDTS,r),s.endDTS=Math.max(s.endDTS,i)):a[t]={startPTS:e,endPTS:n,startDTS:r,endDTS:i,partial:o}},n.clearElementaryStreamInfo=function(){var t=this.elementaryStreams;t[r.AUDIO]=null,t[r.VIDEO]=null,t[r.AUDIOVIDEO]=null},d(e,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var t=this.sn;"number"!=typeof t&&(this.levelkey&&"AES-128"===this.levelkey.method&&!this.levelkey.iv&&a.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),t=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,t)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(null===this.programDateTime)return null;if(!Object(i.isFiniteNumber)(this.programDateTime))return null;var t=Object(i.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+1e3*t}},{key:"encrypted",get:function(){var t;return!(null===(t=this.decryptdata)||void 0===t||!t.keyFormat||!this.decryptdata.uri)}}]),e}(h),y=function(t){function e(e,n,r,i,o){var a;(a=t.call(this,r)||this).fragOffset=0,a.duration=0,a.gap=!1,a.independent=!1,a.relurl=void 0,a.fragment=void 0,a.index=void 0,a.stats=new u.LoadStats,a.duration=e.decimalFloatingPoint("DURATION"),a.gap=e.bool("GAP"),a.independent=e.bool("INDEPENDENT"),a.relurl=e.enumeratedString("URI"),a.fragment=n,a.index=i;var s=e.enumeratedString("BYTERANGE");return s&&a.setByteRange(s,o),o&&(a.fragOffset=o.fragOffset+o.duration),a}return l(e,t),d(e,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var t=this.elementaryStreams;return!!(t.audio||t.video||t.audiovideo)}}]),e}(h)},"./src/loader/key-loader.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return a}));var r=n("./src/events.ts"),i=n("./src/errors.ts"),o=n("./src/utils/logger.ts"),a=function(){function t(t){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=t,this._registerListeners()}var e=t.prototype;return e._registerListeners=function(){this.hls.on(r.Events.KEY_LOADING,this.onKeyLoading,this)},e._unregisterListeners=function(){this.hls.off(r.Events.KEY_LOADING,this.onKeyLoading)},e.destroy=function(){for(var t in this._unregisterListeners(),this.loaders){var e=this.loaders[t];e&&e.destroy()}this.loaders={}},e.onKeyLoading=function(t,e){var n=e.frag,i=n.type,a=this.loaders[i];if(n.decryptdata){var s=n.decryptdata.uri;if(s!==this.decrypturl||null===this.decryptkey){var u=this.hls.config;if(a&&(o.logger.warn("abort previous key loader for type:"+i),a.abort()),!s)return void o.logger.warn("key uri is falsy");var l=u.loader,c=n.loader=this.loaders[i]=new l(u);this.decrypturl=s,this.decryptkey=null;var f={url:s,frag:n,responseType:"arraybuffer"},d={timeout:u.fragLoadingTimeOut,maxRetry:0,retryDelay:u.fragLoadingRetryDelay,maxRetryDelay:u.fragLoadingMaxRetryTimeout,highWaterMark:0},h={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};c.load(f,d,h)}else this.decryptkey&&(n.decryptdata.key=this.decryptkey,this.hls.trigger(r.Events.KEY_LOADED,{frag:n}))}else o.logger.warn("Missing decryption data on fragment in onKeyLoading")},e.loadsuccess=function(t,e,n){var i=n.frag;i.decryptdata?(this.decryptkey=i.decryptdata.key=new Uint8Array(t.data),i.loader=null,delete this.loaders[i.type],this.hls.trigger(r.Events.KEY_LOADED,{frag:i})):o.logger.error("after key load, decryptdata unset")},e.loaderror=function(t,e){var n=e.frag,o=n.loader;o&&o.abort(),delete this.loaders[n.type],this.hls.trigger(r.Events.ERROR,{type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:n,response:t})},e.loadtimeout=function(t,e){var n=e.frag,o=n.loader;o&&o.abort(),delete this.loaders[n.type],this.hls.trigger(r.Events.ERROR,{type:i.ErrorTypes.NETWORK_ERROR,details:i.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:n})},t}()},"./src/loader/level-details.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"LevelDetails",(function(){return o}));var r=n("./src/polyfills/number.ts");function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=function(){function t(t){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.needSidxRanges=!1,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.fragments=[],this.url=t}var e,n,o;return t.prototype.reloaded=function(t){if(!t)return this.advanced=!0,void(this.updated=!0);var e=this.lastPartSn-t.lastPartSn,n=this.lastPartIndex-t.lastPartIndex;this.updated=this.endSN!==t.endSN||!!n||!!e,this.advanced=this.endSN>t.endSN||e>0||0===e&&n>0,this.updated||this.advanced?this.misses=Math.floor(.6*t.misses):this.misses=t.misses+1,this.availabilityDelay=t.availabilityDelay},e=t,(n=[{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&Object(r.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime)}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||10}},{key:"drift",get:function(){var t=this.driftEndTime-this.driftStartTime;return t>0?1e3*(this.driftEnd-this.driftStart)/t:1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var t;return null!==(t=this.partList)&&void 0!==t&&t.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var t;return null!==(t=this.fragments)&&void 0!==t&&t.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var t;return null!==(t=this.partList)&&void 0!==t&&t.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var t;return null!==(t=this.partList)&&void 0!==t&&t.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}])&&i(e.prototype,n),o&&i(e,o),t}()},"./src/loader/level-key.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"LevelKey",(function(){return o}));var r=n("./node_modules/url-toolkit/src/url-toolkit.js");function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=function(){function t(t,e){this._uri=null,this.method=null,this.keyFormat=null,this.keyFormatVersions=null,this.keyID=null,this.key=null,this.iv=null,this._uri=e?Object(r.buildAbsoluteURL)(t,e,{alwaysNormalize:!0}):t}var e,n,o;return t.fromURL=function(e,n){return new t(e,n)},t.fromURI=function(e){return new t(e)},e=t,(n=[{key:"uri",get:function(){return this._uri}}])&&i(e.prototype,n),o&&i(e,o),t}()},
1"./src/loader/load-stats.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"LoadStats",(function(){return r}));var r=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}},
vendor: 17,320 bytes, line 1
1"./src/loader/m3u8-parser.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return v}));var r=n("./src/polyfills/number.ts"),i=n("./node_modules/url-toolkit/src/url-toolkit.js"),o=n("./src/loader/fragment.ts"),a=n("./src/loader/level-details.ts"),s=n("./src/loader/level-key.ts"),u=n("./src/utils/attr-list.ts"),l=n("./src/utils/logger.ts"),c=n("./src/utils/codecs.ts"),f=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-SESSION-DATA:([^\r\n]*)[\r\n]+/g,d=/#EXT-X-MEDIA:(.*)/g,h=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),p=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(PLAYLIST-TYPE):(.+)/.source,/#EXT-X-(MEDIA-SEQUENCE): *(\d+)/.source,/#EXT-X-(SKIP):(.+)/.source,/#EXT-X-(TARGETDURATION): *(\d+)/.source,/#EXT-X-(KEY):(.+)/.source,/#EXT-X-(START):(.+)/.source,/#EXT-X-(ENDLIST)/.source,/#EXT-X-(DISCONTINUITY-SEQ)UENCE: *(\d+)/.source,/#EXT-X-(DIS)CONTINUITY/.source,/#EXT-X-(VERSION):(\d+)/.source,/#EXT-X-(MAP):(.+)/.source,/#EXT-X-(SERVER-CONTROL):(.+)/.source,/#EXT-X-(PART-INF):(.+)/.source,/#EXT-X-(GAP)/.source,/#EXT-X-(BITRATE):\s*(\d+)/.source,/#EXT-X-(PART):(.+)/.source,/#EXT-X-(PRELOAD-HINT):(.+)/.source,/#EXT-X-(RENDITION-REPORT):(.+)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),y=/\.(mp4|m4s|m4v|m4a)$/i,v=function(){function t(){}return t.findGroup=function(t,e){for(var n=0;n<t.length;n++){var r=t[n];if(r.id===e)return r}},t.convertAVC1ToAVCOTI=function(t){var e=t.split(".");if(e.length>2){var n=e.shift()+".";return n+=parseInt(e.shift()).toString(16),n+=("000"+parseInt(e.shift()).toString(16)).substr(-4)}return t},t.resolve=function(t,e){return i.buildAbsoluteURL(e,t,{alwaysNormalize:!0})},t.parseMasterPlaylist=function(e,n){var r,i=[],o={},a=!1;for(f.lastIndex=0;null!=(r=f.exec(e));)if(r[1]){var s=new u.AttrList(r[1]),l={attrs:s,bitrate:s.decimalInteger("AVERAGE-BANDWIDTH")||s.decimalInteger("BANDWIDTH"),name:s.NAME,url:t.resolve(r[2],n)},c=s.decimalResolution("RESOLUTION");c&&(l.width=c.width,l.height=c.height),g((s.CODECS||"").split(/[ ,]+/).filter((function(t){return t})),l),l.videoCodec&&-1!==l.videoCodec.indexOf("avc1")&&(l.videoCodec=t.convertAVC1ToAVCOTI(l.videoCodec)),i.push(l)}else if(r[3]){var d=new u.AttrList(r[3]);d["DATA-ID"]&&(a=!0,o[d["DATA-ID"]]=d)}return{levels:i,sessionData:a?o:null}},t.parseMasterPlaylistMedia=function(e,n,r,i){var o;void 0===i&&(i=[]);var a=[],s=0;for(d.lastIndex=0;null!==(o=d.exec(e));){var l=new u.AttrList(o[1]);if(l.TYPE===r){var c={attrs:l,bitrate:0,id:s++,groupId:l["GROUP-ID"],instreamId:l["INSTREAM-ID"],name:l.NAME||l.LANGUAGE||"",type:r,default:l.bool("DEFAULT"),autoselect:l.bool("AUTOSELECT"),forced:l.bool("FORCED"),lang:l.LANGUAGE,url:l.URI?t.resolve(l.URI,n):""};if(i.length){var f=t.findGroup(i,c.groupId)||i[0];m(c,f,"audioCodec"),m(c,f,"textCodec")}a.push(c)}}return a},t.parseLevelPlaylist=function(t,e,n,c,f){var d,v,g,m=new a.LevelDetails(e),E=m.fragments,_=null,T=0,k=0,A=0,S=0,w=null,P=new o.Fragment(c,e),L=-1,O=!1;for(h.lastIndex=0,m.m3u8=t;null!==(d=h.exec(t));){O&&(O=!1,(P=new o.Fragment(c,e)).start=A,P.sn=T,P.cc=S,P.level=n,_&&(P.initSegment=_,P.rawProgramDateTime=_.rawProgramDateTime));var R=d[1];if(R){P.duration=parseFloat(R);var C=(" "+d[2]).slice(1);P.title=C||null,P.tagList.push(C?["INF",R,C]:["INF",R])}else if(d[3])Object(r.isFiniteNumber)(P.duration)&&(P.start=A,g&&(P.levelkey=g),P.sn=T,P.level=n,P.cc=S,P.urlId=f,E.push(P),P.relurl=(" "+d[3]).slice(1),b(P,w),w=P,A+=P.duration,T++,k=0,O=!0);else if(d[4]){var D=(" "+d[4]).slice(1);w?P.setByteRange(D,w):P.setByteRange(D)}else if(d[5])P.rawProgramDateTime=(" "+d[5]).slice(1),P.tagList.push(["PROGRAM-DATE-TIME",P.rawProgramDateTime]),-1===L&&(L=E.length);else{if(!(d=d[0].match(p))){l.logger.warn("No matches on slow regex match for level playlist!");continue}for(v=1;v<d.length&&void 0===d[v];v++);var I=(" "+d[v]).slice(1),x=(" "+d[v+1]).slice(1),M=d[v+2]?(" "+d[v+2]).slice(1):"";switch(I){case"PLAYLIST-TYPE":m.type=x.toUpperCase();break;case"MEDIA-SEQUENCE":T=m.startSN=parseInt(x);break;case"SKIP":var F=new u.AttrList(x),N=F.decimalInteger("SKIPPED-SEGMENTS");if(Object(r.isFiniteNumber)(N)){m.skippedSegments=N;for(var B=N;B--;)E.unshift(null);T+=N}var j=F.enumeratedString("RECENTLY-REMOVED-DATERANGES");j&&(m.recentlyRemovedDateranges=j.split("\t"));break;case"TARGETDURATION":m.targetduration=parseFloat(x);break;case"VERSION":m.version=parseInt(x);break;case"EXTM3U":break;case"ENDLIST":m.live=!1;break;case"#":(x||M)&&P.tagList.push(M?[x,M]:[x]);break;case"DIS":S++;case"GAP":P.tagList.push([I]);break;case"BITRATE":P.tagList.push([I,x]);break;case"DISCONTINUITY-SEQ":S=parseInt(x);break;case"KEY":var U,H=new u.AttrList(x),G=H.enumeratedString("METHOD"),V=H.URI,Y=H.hexadecimalInteger("IV"),K=H.enumeratedString("KEYFORMATVERSIONS"),z=H.enumeratedString("KEYID"),W=null!=(U=H.enumeratedString("KEYFORMAT"))?U:"identity";if(["com.apple.streamingkeydelivery","com.microsoft.playready","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed","com.widevine"].indexOf(W)>-1){l.logger.warn("Keyformat "+W+" is not supported from the manifest");continue}if("identity"!==W)continue;G&&(g=s.LevelKey.fromURL(e,V),V&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(G)>=0&&(g.method=G,g.keyFormat=W,z&&(g.keyID=z),K&&(g.keyFormatVersions=K),g.iv=Y));break;case"START":var q=new u.AttrList(x).decimalFloatingPoint("TIME-OFFSET");Object(r.isFiniteNumber)(q)&&(m.startTimeOffset=q);break;case"MAP":var X=new u.AttrList(x);P.relurl=X.URI,X.BYTERANGE&&P.setByteRange(X.BYTERANGE),P.level=n,P.sn="initSegment",g&&(P.levelkey=g),P.initSegment=null,_=P,O=!0;break;case"SERVER-CONTROL":var $=new u.AttrList(x);m.canBlockReload=$.bool("CAN-BLOCK-RELOAD"),m.canSkipUntil=$.optionalFloat("CAN-SKIP-UNTIL",0),m.canSkipDateRanges=m.canSkipUntil>0&&$.bool("CAN-SKIP-DATERANGES"),m.partHoldBack=$.optionalFloat("PART-HOLD-BACK",0),m.holdBack=$.optionalFloat("HOLD-BACK",0);break;case"PART-INF":var Q=new u.AttrList(x);m.partTarget=Q.decimalFloatingPoint("PART-TARGET");break;case"PART":var J=m.partList;J||(J=m.partList=[]);var Z=k>0?J[J.length-1]:void 0,tt=k++,et=new o.Part(new u.AttrList(x),P,e,tt,Z);J.push(et),P.duration+=et.duration;break;case"PRELOAD-HINT":var nt=new u.AttrList(x);m.preloadHint=nt;break;case"RENDITION-REPORT":var rt=new u.AttrList(x);m.renditionReports=m.renditionReports||[],m.renditionReports.push(rt);break;default:l.logger.warn("line parsed but not handled: "+d)}}}w&&!w.relurl?(E.pop(),A-=w.duration,m.partList&&(m.fragmentHint=w)):m.partList&&(b(P,w),P.cc=S,m.fragmentHint=P);var it=E.length,ot=E[0],at=E[it-1];if((A+=m.skippedSegments*m.targetduration)>0&&it&&at){m.averagetargetduration=A/it;var st=at.sn;m.endSN="initSegment"!==st?st:0,ot&&(m.startCC=ot.cc,ot.initSegment||m.fragments.every((function(t){return t.relurl&&(e=t.relurl,y.test(null!=(n=null===(r=i.parseURL(e))||void 0===r?void 0:r.path)?n:""));var e,n,r}))&&(l.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),(P=new o.Fragment(c,e)).relurl=at.relurl,P.level=n,P.sn="initSegment",ot.initSegment=P,m.needSidxRanges=!0))}else m.endSN=0,m.startCC=0;return m.fragmentHint&&(A+=m.fragmentHint.duration),m.totalduration=A,m.endCC=S,L>0&&function(t,e){for(var n=t[e],r=e;r--;){var i=t[r];if(!i)return;i.programDateTime=n.programDateTime-1e3*i.duration,n=i}}(E,L),m},t}();function g(t,e){["video","audio","text"].forEach((function(n){var r=t.filter((function(t){return Object(c.isCodecType)(t,n)}));if(r.length){var i=r.filter((function(t){return 0===t.lastIndexOf("avc1",0)||0===t.lastIndexOf("mp4a",0)}));e[n+"Codec"]=i.length>0?i[0]:r[0],t=t.filter((function(t){return-1===r.indexOf(t)}))}})),e.unknownCodecs=t}function m(t,e,n){var r=e[n];r&&(t[n]=r)}function b(t,e){t.rawProgramDateTime?t.programDateTime=Date.parse(t.rawProgramDateTime):null!=e&&e.programDateTime&&(t.programDateTime=e.endProgramDateTime),Object(r.isFiniteNumber)(t.programDateTime)||(t.programDateTime=null,t.rawProgramDateTime=null)}},"./src/loader/playlist-loader.ts":function(t,e,n){"use strict";n.r(e);var r=n("./src/polyfills/number.ts"),i=n("./src/events.ts"),o=n("./src/errors.ts"),a=n("./src/utils/logger.ts"),s=n("./src/utils/mp4-tools.ts"),u=n("./src/loader/m3u8-parser.ts"),l=n("./src/types/loader.ts"),c=n("./src/utils/attr-list.ts");function f(t,e){var n=t.url;return void 0!==n&&0!==n.indexOf("data:")||(n=e.url),n}var d=function(){function t(t){this.hls=void 0,this.loaders=Object.create(null),this.hls=t,this.registerListeners()}var e=t.prototype;return e.registerListeners=function(){var t=this.hls;t.on(i.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(i.Events.LEVEL_LOADING,this.onLevelLoading,this),t.on(i.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.on(i.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},e.unregisterListeners=function(){var t=this.hls;t.off(i.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(i.Events.LEVEL_LOADING,this.onLevelLoading,this),t.off(i.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.off(i.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},e.createInternalLoader=function(t){var e=this.hls.config,n=e.pLoader,r=e.loader,i=new(n||r)(e);return t.loader=i,this.loaders[t.type]=i,i},e.getInternalLoader=function(t){return this.loaders[t.type]},e.resetInternalLoader=function(t){this.loaders[t]&&delete this.loaders[t]},e.destroyInternalLoaders=function(){for(var t in this.loaders){var e=this.loaders[t];e&&e.destroy(),this.resetInternalLoader(t)}},e.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},e.onManifestLoading=function(t,e){var n=e.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:l.PlaylistContextType.MANIFEST,url:n,deliveryDirectives:null})},e.onLevelLoading=function(t,e){var n=e.id,r=e.level,i=e.url,o=e.deliveryDirectives;this.load({id:n,groupId:null,level:r,responseType:"text",type:l.PlaylistContextType.LEVEL,url:i,deliveryDirectives:o})},e.onAudioTrackLoading=function(t,e){var n=e.id,r=e.groupId,i=e.url,o=e.deliveryDirectives;this.load({id:n,groupId:r,level:null,responseType:"text",type:l.PlaylistContextType.AUDIO_TRACK,url:i,deliveryDirectives:o})},e.onSubtitleTrackLoading=function(t,e){var n=e.id,r=e.groupId,i=e.url,o=e.deliveryDirectives;this.load({id:n,groupId:r,level:null,responseType:"text",type:l.PlaylistContextType.SUBTITLE_TRACK,url:i,deliveryDirectives:o})},e.load=function(t){var e,n,r,i,o,s,u=this.hls.config,c=this.getInternalLoader(t);if(c){var f=c.context;if(f&&f.url===t.url)return void a.logger.trace("[playlist-loader]: playlist request ongoing");a.logger.log("[playlist-loader]: aborting previous loader for type: "+t.type),c.abort()}switch(t.type){case l.PlaylistContextType.MANIFEST:n=u.manifestLoadingMaxRetry,r=u.manifestLoadingTimeOut,i=u.manifestLoadingRetryDelay,o=u.manifestLoadingMaxRetryTimeout;break;case l.PlaylistContextType.LEVEL:case l.PlaylistContextType.AUDIO_TRACK:case l.PlaylistContextType.SUBTITLE_TRACK:n=0,r=u.levelLoadingTimeOut;break;default:n=u.levelLoadingMaxRetry,r=u.levelLoadingTimeOut,i=u.levelLoadingRetryDelay,o=u.levelLoadingMaxRetryTimeout}if(c=this.createInternalLoader(t),null!==(e=t.deliveryDirectives)&&void 0!==e&&e.part&&(t.type===l.PlaylistContextType.LEVEL&&null!==t.level?s=this.hls.levels[t.level].details:t.type===l.PlaylistContextType.AUDIO_TRACK&&null!==t.id?s=this.hls.audioTracks[t.id].details:t.type===l.PlaylistContextType.SUBTITLE_TRACK&&null!==t.id&&(s=this.hls.subtitleTracks[t.id].details),s)){var d=s.partTarget,h=s.targetduration;d&&h&&(r=Math.min(1e3*Math.max(3*d,.8*h),r))}var p={timeout:r,maxRetry:n,retryDelay:i,maxRetryDelay:o,highWaterMark:0},y={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};c.load(t,p,y)},e.loadsuccess=function(t,e,n,r){if(void 0===r&&(r=null),n.isSidxRequest)return this.handleSidxRequest(t,n),void this.handlePlaylistLoaded(t,e,n,r);this.resetInternalLoader(n.type);var i=t.data;0===i.indexOf("#EXTM3U")?(e.parsing.start=performance.now(),i.indexOf("#EXTINF:")>0||i.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(t,e,n,r):this.handleMasterPlaylist(t,e,n,r)):this.handleManifestParsingError(t,n,"no EXTM3U delimiter",r)},e.loaderror=function(t,e,n){void 0===n&&(n=null),this.handleNetworkError(e,n,!1,t)},e.loadtimeout=function(t,e,n){void 0===n&&(n=null),this.handleNetworkError(e,n,!0)},e.handleMasterPlaylist=function(t,e,n,r){var o=this.hls,s=t.data,l=f(t,n),d=u.default.parseMasterPlaylist(s,l),h=d.levels,p=d.sessionData;if(h.length){var y=h.map((function(t){return{id:t.attrs.AUDIO,audioCodec:t.audioCodec}})),v=h.map((function(t){return{id:t.attrs.SUBTITLES,textCodec:t.textCodec}})),g=u.default.parseMasterPlaylistMedia(s,l,"AUDIO",y),m=u.default.parseMasterPlaylistMedia(s,l,"SUBTITLES",v),b=u.default.parseMasterPlaylistMedia(s,l,"CLOSED-CAPTIONS");g.length&&(g.some((function(t){return!t.url}))||!h[0].audioCodec||h[0].attrs.AUDIO||(a.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),g.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new c.AttrList({}),bitrate:0,url:""}))),o.trigger(i.Events.MANIFEST_LOADED,{levels:h,audioTracks:g,subtitles:m,captions:b,url:l,stats:e,networkDetails:r,sessionData:p})}else this.handleManifestParsingError(t,n,"no level found in manifest",r)},e.handleTrackOrLevelPlaylist=function(t,e,n,a){var s=this.hls,d=n.id,h=n.level,p=n.type,y=f(t,n),v=Object(r.isFiniteNumber)(d)?d:0,g=Object(r.isFiniteNumber)(h)?h:v,m=function(t){switch(t.type){case l.PlaylistContextType.AUDIO_TRACK:return l.PlaylistLevelType.AUDIO;case l.PlaylistContextType.SUBTITLE_TRACK:return l.PlaylistLevelType.SUBTITLE;default:return l.PlaylistLevelType.MAIN}}(n),b=u.default.parseLevelPlaylist(t.data,y,g,m,v);if(b.fragments.length){if(p===l.PlaylistContextType.MANIFEST){var E={attrs:new c.AttrList({}),bitrate:0,details:b,name:"",url:y};s.trigger(i.Events.MANIFEST_LOADED,{levels:[E],audioTracks:[],url:y,stats:e,networkDetails:a,sessionData:null})}if(e.parsing.end=performance.now(),b.needSidxRanges){var _,T=null===(_=b.fragments[0].initSegment)||void 0===_?void 0:_.url;this.load({url:T,isSidxRequest:!0,type:p,level:h,levelDetails:b,id:d,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null})}else n.levelDetails=b,this.handlePlaylistLoaded(t,e,n,a)}else s.trigger(i.Events.ERROR,{type:o.ErrorTypes.NETWORK_ERROR,details:o.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:y,reason:"no fragments found in level",level:"number"==typeof n.level?n.level:void 0})},e.handleSidxRequest=function(t,e){var n=Object(s.parseSegmentIndex)(new Uint8Array(t.data));if(n){var r=n.references,i=e.levelDetails;r.forEach((function(t,e){var r=t.info,o=i.fragments[e];0===o.byteRange.length&&o.setByteRange(String(1+r.end-r.start)+"@"+String(r.start)),o.initSegment&&o.initSegment.setByteRange(String(n.moovEndOffset)+"@0")}))}},e.handleManifestParsingError=function(t,e,n,r){this.hls.trigger(i.Events.ERROR,{type:o.ErrorTypes.NETWORK_ERROR,details:o.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:e.type===l.PlaylistContextType.MANIFEST,url:t.url,reason:n,response:t,context:e,networkDetails:r})},e.handleNetworkError=function(t,e,n,r){void 0===n&&(n=!1),a.logger.warn("[playlist-loader]: A network "+(n?"timeout":"error")+" occurred while loading "+t.type+" level: "+t.level+" id: "+t.id+' group-id: "'+t.groupId+'"');var s=o.ErrorDetails.UNKNOWN,u=!1,c=this.getInternalLoader(t);switch(t.type){case l.PlaylistContextType.MANIFEST:s=n?o.ErrorDetails.MANIFEST_LOAD_TIMEOUT:o.ErrorDetails.MANIFEST_LOAD_ERROR,u=!0;break;case l.PlaylistContextType.LEVEL:s=n?o.ErrorDetails.LEVEL_LOAD_TIMEOUT:o.ErrorDetails.LEVEL_LOAD_ERROR,u=!1;break;case l.PlaylistContextType.AUDIO_TRACK:s=n?o.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:o.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,u=!1;break;case l.PlaylistContextType.SUBTITLE_TRACK:s=n?o.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:o.ErrorDetails.SUBTITLE_LOAD_ERROR,u=!1}c&&this.resetInternalLoader(t.type);var f={type:o.ErrorTypes.NETWORK_ERROR,details:s,fatal:u,url:t.url,loader:c,context:t,networkDetails:e};r&&(f.response=r),this.hls.trigger(i.Events.ERROR,f)},e.handlePlaylistLoaded=function(t,e,n,r){var o=n.type,a=n.level,s=n.id,u=n.groupId,c=n.loader,f=n.levelDetails,d=n.deliveryDirectives;if(null!=f&&f.targetduration){if(c)switch(f.live&&(c.getCacheAge&&(f.ageHeader=c.getCacheAge()||0),c.getCacheAge&&!isNaN(f.ageHeader)||(f.ageHeader=0)),o){case l.PlaylistContextType.MANIFEST:case l.PlaylistContextType.LEVEL:this.hls.trigger(i.Events.LEVEL_LOADED,{details:f,level:a||0,id:s||0,stats:e,networkDetails:r,deliveryDirectives:d});break;case l.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(i.Events.AUDIO_TRACK_LOADED,{details:f,id:s||0,groupId:u||"",stats:e,networkDetails:r,deliveryDirectives:d});break;case l.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(i.Events.SUBTITLE_TRACK_LOADED,{details:f,id:s||0,groupId:u||"",stats:e,networkDetails:r,deliveryDirectives:d})}}else this.handleManifestParsingError(t,n,"invalid target duration",r)},t}();e.default=d},
1"./src/polyfills/number.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"isFiniteNumber",(function(){return r})),n.d(e,"MAX_SAFE_INTEGER",(function(){return i}));var r=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},i=Number.MAX_SAFE_INTEGER||9007199254740991},
1"./src/remux/aac-helper.ts":function(t,e,n){"use strict";n.r(e);var r=function(){function t(){}return t.getSilentFrame=function(t,e){switch(t){case"mp4a.40.2":if(1===e)return new Uint8Array([0,200,0,128,35,128]);if(2===e)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===e)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===e)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]);break;default:if(1===e)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===e)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===e)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])}},t}();e.default=r},
vendor: 22,048 bytes, line 1
1"./src/remux/mp4-generator.ts":function(t,e,n){"use strict";n.r(e);var r=Math.pow(2,32)-1,i=function(){function t(){}return t.init=function(){var e;for(e in t.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},t.types)t.types.hasOwnProperty(e)&&(t.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);var n=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]),r=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]);t.HDLR_TYPES={video:n,audio:r};var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),o=new Uint8Array([0,0,0,0,0,0,0,0]);t.STTS=t.STSC=t.STCO=o,t.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),t.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),t.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),t.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var a=new Uint8Array([105,115,111,109]),s=new Uint8Array([97,118,99,49]),u=new Uint8Array([0,0,0,1]);t.FTYP=t.box(t.types.ftyp,a,u,a,s),t.DINF=t.box(t.types.dinf,t.box(t.types.dref,i))},t.box=function(t){for(var e=8,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];for(var o=r.length,a=o;o--;)e+=r[o].byteLength;var s=new Uint8Array(e);for(s[0]=e>>24&255,s[1]=e>>16&255,s[2]=e>>8&255,s[3]=255&e,s.set(t,4),o=0,e=8;o<a;o++)s.set(r[o],e),e+=r[o].byteLength;return s},t.hdlr=function(e){return t.box(t.types.hdlr,t.HDLR_TYPES[e])},t.mdat=function(e){return t.box(t.types.mdat,e)},t.mdhd=function(e,n){n*=e;var i=Math.floor(n/(r+1)),o=Math.floor(n%(r+1));return t.box(t.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,o>>24,o>>16&255,o>>8&255,255&o,85,196,0,0]))},t.mdia=function(e){return t.box(t.types.mdia,t.mdhd(e.timescale,e.duration),t.hdlr(e.type),t.minf(e))},t.mfhd=function(e){return t.box(t.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))},t.minf=function(e){return"audio"===e.type?t.box(t.types.minf,t.box(t.types.smhd,t.SMHD),t.DINF,t.stbl(e)):t.box(t.types.minf,t.box(t.types.vmhd,t.VMHD),t.DINF,t.stbl(e))},t.moof=function(e,n,r){return t.box(t.types.moof,t.mfhd(e),t.traf(r,n))},t.moov=function(e){for(var n=e.length,r=[];n--;)r[n]=t.trak(e[n]);return t.box.apply(null,[t.types.moov,t.mvhd(e[0].timescale,e[0].duration)].concat(r).concat(t.mvex(e)))},t.mvex=function(e){for(var n=e.length,r=[];n--;)r[n]=t.trex(e[n]);return t.box.apply(null,[t.types.mvex].concat(r))},t.mvhd=function(e,n){n*=e;var i=Math.floor(n/(r+1)),o=Math.floor(n%(r+1)),a=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,i>>24,i>>16&255,i>>8&255,255&i,o>>24,o>>16&255,o>>8&255,255&o,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]);return t.box(t.types.mvhd,a)},t.sdtp=function(e){var n,r,i=e.samples||[],o=new Uint8Array(4+i.length);for(n=0;n<i.length;n++)r=i[n].flags,o[n+4]=r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy;return t.box(t.types.sdtp,o)},t.stbl=function(e){return t.box(t.types.stbl,t.stsd(e),t.box(t.types.stts,t.STTS),t.box(t.types.stsc,t.STSC),t.box(t.types.stsz,t.STSZ),t.box(t.types.stco,t.STCO))},t.avc1=function(e){var n,r,i,o=[],a=[];for(n=0;n<e.sps.length;n++)i=(r=e.sps[n]).byteLength,o.push(i>>>8&255),o.push(255&i),o=o.concat(Array.prototype.slice.call(r));for(n=0;n<e.pps.length;n++)i=(r=e.pps[n]).byteLength,a.push(i>>>8&255),a.push(255&i),a=a.concat(Array.prototype.slice.call(r));var s=t.box(t.types.avcC,new Uint8Array([1,o[3],o[4],o[5],255,224|e.sps.length].concat(o).concat([e.pps.length]).concat(a))),u=e.width,l=e.height,c=e.pixelRatio[0],f=e.pixelRatio[1];return t.box(t.types.avc1,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,u>>8&255,255&u,l>>8&255,255&l,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]),s,t.box(t.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),t.box(t.types.pasp,new Uint8Array([c>>24,c>>16&255,c>>8&255,255&c,f>>24,f>>16&255,f>>8&255,255&f])))},t.esds=function(t){var e=t.config.length;return new Uint8Array([0,0,0,0,3,23+e,0,1,0,4,15+e,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([e]).concat(t.config).concat([6,1,2]))},t.mp4a=function(e){var n=e.samplerate;return t.box(t.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,n>>8&255,255&n,0,0]),t.box(t.types.esds,t.esds(e)))},t.mp3=function(e){var n=e.samplerate;return t.box(t.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,n>>8&255,255&n,0,0]))},t.stsd=function(e){return"audio"===e.type?e.isAAC||"mp3"!==e.codec?t.box(t.types.stsd,t.STSD,t.mp4a(e)):t.box(t.types.stsd,t.STSD,t.mp3(e)):t.box(t.types.stsd,t.STSD,t.avc1(e))},t.tkhd=function(e){var n=e.id,i=e.duration*e.timescale,o=e.width,a=e.height,s=Math.floor(i/(r+1)),u=Math.floor(i%(r+1));return t.box(t.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,n>>24&255,n>>16&255,n>>8&255,255&n,0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,u>>24,u>>16&255,u>>8&255,255&u,0,0,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,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,o>>8&255,255&o,0,0,a>>8&255,255&a,0,0]))},t.traf=function(e,n){var i=t.sdtp(e),o=e.id,a=Math.floor(n/(r+1)),s=Math.floor(n%(r+1));return t.box(t.types.traf,t.box(t.types.tfhd,new Uint8Array([0,0,0,0,o>>24,o>>16&255,o>>8&255,255&o])),t.box(t.types.tfdt,new Uint8Array([1,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,s>>24,s>>16&255,s>>8&255,255&s])),t.trun(e,i.length+16+20+8+16+8+8),i)},t.trak=function(e){return e.duration=e.duration||4294967295,t.box(t.types.trak,t.tkhd(e),t.mdia(e))},t.trex=function(e){var n=e.id;return t.box(t.types.trex,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},t.trun=function(e,n){var r,i,o,a,s,u,l=e.samples||[],c=l.length,f=12+16*c,d=new Uint8Array(f);for(n+=8+f,d.set([0,0,15,1,c>>>24&255,c>>>16&255,c>>>8&255,255&c,n>>>24&255,n>>>16&255,n>>>8&255,255&n],0),r=0;r<c;r++)o=(i=l[r]).duration,a=i.size,s=i.flags,u=i.cts,d.set([o>>>24&255,o>>>16&255,o>>>8&255,255&o,a>>>24&255,a>>>16&255,a>>>8&255,255&a,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.paddingValue<<1|s.isNonSync,61440&s.degradPrio,15&s.degradPrio,u>>>24&255,u>>>16&255,u>>>8&255,255&u],12+16*r);return t.box(t.types.trun,d)},t.initSegment=function(e){t.types||t.init();var n=t.moov(e),r=new Uint8Array(t.FTYP.byteLength+n.byteLength);return r.set(t.FTYP),r.set(n,t.FTYP.byteLength),r},t}();i.types=void 0,i.HDLR_TYPES=void 0,i.STTS=void 0,i.STSC=void 0,i.STCO=void 0,i.STSZ=void 0,i.VMHD=void 0,i.SMHD=void 0,i.STSD=void 0,i.FTYP=void 0,i.DINF=void 0,e.default=i},"./src/remux/mp4-remuxer.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return y})),n.d(e,"normalizePts",(function(){return v}));var r=n("./src/polyfills/number.ts"),i=n("./src/remux/aac-helper.ts"),o=n("./src/remux/mp4-generator.ts"),a=n("./src/events.ts"),s=n("./src/errors.ts"),u=n("./src/utils/logger.ts"),l=n("./src/types/loader.ts"),c=n("./src/utils/timescale-conversion.ts");function f(){return(f=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}var d=null,h=null,p=!1,y=function(){function t(t,e,n,r){if(void 0===r&&(r=""),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=void 0,this._initDTS=void 0,this.nextAvcDts=null,this.nextAudioPts=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.observer=t,this.config=e,this.typeSupported=n,this.ISGenerated=!1,null===d){var i=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);d=i?parseInt(i[1]):0}if(null===h){var o=navigator.userAgent.match(/Safari\/(\d+)/i);h=o?parseInt(o[1]):0}p=!!d&&d<75||!!h&&h<600}var e=t.prototype;return e.destroy=function(){},e.resetTimeStamp=function(t){u.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=t},e.resetNextTimestamp=function(){u.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},e.resetInitSegment=function(){u.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},e.getVideoStartPts=function(t){var e=!1,n=t.reduce((function(t,n){var r=n.pts-t;return r<-4294967296?(e=!0,v(t,n.pts)):r>0?t:n.pts}),t[0].pts);return e&&u.logger.debug("PTS rollover detected"),n},e.remux=function(t,e,n,r,i,o,a,s){var c,f,d,h,p,y,g=i,m=i,b=t.pid>-1,E=e.pid>-1,_=e.samples.length,T=t.samples.length>0,k=_>1;if((!b||T)&&(!E||k)||this.ISGenerated||a){this.ISGenerated||(d=this.generateIS(t,e,i));var A=this.isVideoContiguous,S=-1;if(k&&(S=function(t){for(var e=0;e<t.length;e++)if(t[e].key)return e;return-1}(e.samples),!A&&this.config.forceKeyFrameOnDiscontinuity))if(y=!0,S>0){u.logger.warn("[mp4-remuxer]: Dropped "+S+" out of "+_+" video samples due to a missing keyframe");var w=this.getVideoStartPts(e.samples);e.samples=e.samples.slice(S),e.dropped+=S,m+=(e.samples[0].pts-w)/(e.timescale||9e4)}else-1===S&&(u.logger.warn("[mp4-remuxer]: No keyframe found out of "+_+" video samples"),y=!1);if(this.ISGenerated){if(T&&k){var P=this.getVideoStartPts(e.samples),L=(v(t.samples[0].pts,P)-P)/e.inputTimeScale;g+=Math.max(0,L),m+=Math.max(0,-L)}if(T){if(t.samplerate||(u.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),d=this.generateIS(t,e,i)),f=this.remuxAudio(t,g,this.isAudioContiguous,o,E||k||s===l.PlaylistLevelType.AUDIO?m:void 0),k){var O=f?f.endPTS-f.startPTS:0;e.inputTimeScale||(u.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),d=this.generateIS(t,e,i)),c=this.remuxVideo(e,m,A,O)}}else k&&(c=this.remuxVideo(e,m,A,0));c&&(c.firstKeyFrame=S,c.independent=-1!==S)}}return this.ISGenerated&&(n.samples.length&&(p=this.remuxID3(n,i)),r.samples.length&&(h=this.remuxText(r,i))),{audio:f,video:c,initSegment:d,independent:y,text:h,id3:p}},e.generateIS=function(t,e,n){var i,a,s,u=t.samples,l=e.samples,c=this.typeSupported,f={},d=!Object(r.isFiniteNumber)(this._initPTS),h="audio/mp4";if(d&&(i=a=1/0),t.config&&u.length&&(t.timescale=t.samplerate,t.isAAC||(c.mpeg?(h="audio/mpeg",t.codec=""):c.mp3&&(t.codec="mp3")),f.audio={id:"audio",container:h,codec:t.codec,initSegment:!t.isAAC&&c.mpeg?new Uint8Array(0):o.default.initSegment([t]),metadata:{channelCount:t.channelCount}},d&&(s=t.inputTimeScale,i=a=u[0].pts-Math.round(s*n))),e.sps&&e.pps&&l.length&&(e.timescale=e.inputTimeScale,f.video={id:"main",container:"video/mp4",codec:e.codec,initSegment:o.default.initSegment([e]),metadata:{width:e.width,height:e.height}},d)){s=e.inputTimeScale;var p=this.getVideoStartPts(l),y=Math.round(s*n);a=Math.min(a,v(l[0].dts,p)-y),i=Math.min(i,p-y)}if(Object.keys(f).length)return this.ISGenerated=!0,d&&(this._initPTS=i,this._initDTS=a),{tracks:f,initPTS:i,timescale:s}},e.remuxVideo=function(t,e,n,r){var i,l,h,y=t.inputTimeScale,m=t.samples,b=[],E=m.length,_=this._initPTS,T=this.nextAvcDts,k=8,A=Number.POSITIVE_INFINITY,S=Number.NEGATIVE_INFINITY,w=0,P=!1;n&&null!==T||(T=e*y-(m[0].pts-v(m[0].dts,m[0].pts)));for(var L=0;L<E;L++){var O=m[L];O.pts=v(O.pts-_,T),O.dts=v(O.dts-_,T),O.dts>O.pts&&(w=Math.max(Math.min(w,O.pts-O.dts),-18e3)),O.dts<m[L>0?L-1:L].dts&&(P=!0)}P&&m.sort((function(t,e){var n=t.dts-e.dts,r=t.pts-e.pts;return n||r})),l=m[0].dts,h=m[m.length-1].dts;var R=Math.round((h-l)/(E-1));if(w<0){if(w<-2*R){u.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(c.toMsFromMpegTsClock)(-R,!0)+" ms");for(var C=w,D=0;D<E;D++)m[D].dts=C=Math.max(C,m[D].pts-R),m[D].pts=Math.max(C,m[D].pts)}else{u.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Object(c.toMsFromMpegTsClock)(w,!0)+" ms to overcome this issue");for(var I=0;I<E;I++)m[I].dts=m[I].dts+w}l=m[0].dts}if(n){var x=l-T,M=x>R;if(M||x<-1){M?u.logger.warn("AVC: "+Object(c.toMsFromMpegTsClock)(x,!0)+" ms ("+x+"dts) hole between fragments detected, filling it"):u.logger.warn("AVC: "+Object(c.toMsFromMpegTsClock)(-x,!0)+" ms ("+x+"dts) overlapping between fragments detected"),l=T;var F=m[0].pts-x;m[0].dts=l,m[0].pts=F,u.logger.log("Video: First PTS/DTS adjusted: "+Object(c.toMsFromMpegTsClock)(F,!0)+"/"+Object(c.toMsFromMpegTsClock)(l,!0)+", delta: "+Object(c.toMsFromMpegTsClock)(x,!0)+" ms")}}p&&(l=Math.max(0,l));for(var N=0,B=0,j=0;j<E;j++){for(var U=m[j],H=U.units,G=H.length,V=0,Y=0;Y<G;Y++)V+=H[Y].data.length;B+=V,N+=G,U.length=V,U.dts=Math.max(U.dts,l),U.pts=Math.max(U.pts,U.dts,0),A=Math.min(U.pts,A),S=Math.max(U.pts,S)}h=m[E-1].dts;var K,z=B+4*N+8;try{K=new Uint8Array(z)}catch(t){return void this.observer.emit(a.Events.ERROR,a.Events.ERROR,{type:s.ErrorTypes.MUX_ERROR,details:s.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:z,reason:"fail allocating video mdat "+z})}var W=new DataView(K.buffer);W.setUint32(0,z),K.set(o.default.types.mdat,4);for(var q=0;q<E;q++){for(var X=m[q],$=X.units,Q=0,J=0,Z=$.length;J<Z;J++){var tt=$[J],et=tt.data,nt=tt.data.byteLength;W.setUint32(k,nt),k+=4,K.set(et,k),k+=nt,Q+=4+nt}if(q<E-1)i=m[q+1].dts-X.dts;else{var rt=this.config,it=X.dts-m[q>0?q-1:q].dts;if(rt.stretchShortVideoTrack&&null!==this.nextAudioPts){var ot=Math.floor(rt.maxBufferHole*y),at=(r?A+r*y:this.nextAudioPts)-X.pts;at>ot?((i=at-it)<0&&(i=it),u.logger.log("[mp4-remuxer]: It is approximately "+at/90+" ms to the next segment; using duration "+i/90+" ms for the last video frame.")):i=it}else i=it}var st=Math.round(X.pts-X.dts);b.push(new g(X.key,i,Q,st))}if(b.length&&d&&d<70){var ut=b[0].flags;ut.dependsOn=2,ut.isNonSync=0}console.assert(void 0!==i,"mp4SampleDuration must be computed"),this.nextAvcDts=T=h+i,this.isVideoContiguous=!0;var lt={data1:o.default.moof(t.sequenceNumber++,l,f({},t,{samples:b})),data2:K,startPTS:A/y,endPTS:(S+i)/y,startDTS:l/y,endDTS:T/y,type:"video",hasAudio:!1,hasVideo:!0,nb:b.length,dropped:t.dropped};return t.samples=[],t.dropped=0,console.assert(K.length,"MDAT length must not be zero"),lt},e.remuxAudio=function(t,e,n,r,l){var c=t.inputTimeScale,d=c/(t.samplerate?t.samplerate:c),h=t.isAAC?1024:1152,p=h*d,y=this._initPTS,m=!t.isAAC&&this.typeSupported.mpeg,b=[],E=t.samples,_=m?0:8,T=this.nextAudioPts||-1,k=e*c;if(this.isAudioContiguous=n=n||E.length&&T>0&&(r&&Math.abs(k-T)<9e3||Math.abs(v(E[0].pts-y,k)-T)<20*p),E.forEach((function(t){t.pts=v(t.pts-y,k)})),!n||T<0){if(!(E=E.filter((function(t){return t.pts>=0}))).length)return;T=0===l?0:r?Math.max(0,k):E[0].pts}if(t.isAAC)for(var A=void 0!==l,S=this.config.maxAudioFramesDrift,w=0,P=T;w<E.length;w++){var L=E[w],O=L.pts,R=O-P,C=Math.abs(1e3*R/c);if(R<=-S*p&&A)0===w&&(u.logger.warn("Audio frame @ "+(O/c).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*R/c)+" ms."),this.nextAudioPts=T=P=O);else if(R>=S*p&&C<1e4&&A){var D=Math.round(R/p);(P=O-D*p)<0&&(D--,P+=p),0===w&&(this.nextAudioPts=T=P),u.logger.warn("[mp4-remuxer]: Injecting "+D+" audio frame @ "+(P/c).toFixed(3)+"s due to "+Math.round(1e3*R/c)+" ms gap.");for(var I=0;I<D;I++){var x=Math.max(P,0),M=i.default.getSilentFrame(t.manifestCodec||t.codec,t.channelCount);M||(u.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),M=L.unit.subarray()),E.splice(w,0,{unit:M,pts:x}),P+=p,w++}}L.pts=P,P+=p}for(var F,N=null,B=null,j=0,U=E.length;U--;)j+=E[U].unit.byteLength;for(var H=0,G=E.length;H<G;H++){var V=E[H],Y=V.unit,K=V.pts;if(null!==B)b[H-1].duration=Math.round((K-B)/d);else{if(n&&t.isAAC&&(K=T),N=K,!(j>0))return;j+=_;try{F=new Uint8Array(j)}catch(t){return void this.observer.emit(a.Events.ERROR,a.Events.ERROR,{type:s.ErrorTypes.MUX_ERROR,details:s.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:j,reason:"fail allocating audio mdat "+j})}m||(new DataView(F.buffer).setUint32(0,j),F.set(o.default.types.mdat,4))}F.set(Y,_);var z=Y.byteLength;_+=z,b.push(new g(!0,h,z,0)),B=K}var W=b.length;if(W){var q=b[b.length-1];this.nextAudioPts=T=B+d*q.duration;var X=m?new Uint8Array(0):o.default.moof(t.sequenceNumber++,N/d,f({},t,{samples:b}));t.samples=[];var $=N/c,Q=T/c,J={data1:X,data2:F,startPTS:$,endPTS:Q,startDTS:$,endDTS:Q,type:"audio",hasAudio:!0,hasVideo:!1,nb:W};return this.isAudioContiguous=!0,console.assert(F.length,"MDAT length must not be zero"),J}},e.remuxEmptyAudio=function(t,e,n,r){var o=t.inputTimeScale,a=o/(t.samplerate?t.samplerate:o),s=this.nextAudioPts,l=(null!==s?s:r.startDTS*o)+this._initDTS,c=r.endDTS*o+this._initDTS,f=1024*a,d=Math.ceil((c-l)/f),h=i.default.getSilentFrame(t.manifestCodec||t.codec,t.channelCount);if(u.logger.warn("[mp4-remuxer]: remux empty Audio"),h){for(var p=[],y=0;y<d;y++){var v=l+y*f;p.push({unit:h,pts:v,dts:v})}return t.samples=p,this.remuxAudio(t,e,n,!1)}u.logger.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec")},e.remuxID3=function(t,e){var n=t.samples.length;if(n){for(var r=t.inputTimeScale,i=this._initPTS,o=this._initDTS,a=0;a<n;a++){var s=t.samples[a];s.pts=v(s.pts-i,e*r)/r,s.dts=v(s.dts-o,e*r)/r}var u=t.samples;return t.samples=[],{samples:u}}},e.remuxText=function(t,e){var n=t.samples.length;if(n){for(var r=t.inputTimeScale,i=this._initPTS,o=0;o<n;o++){var a=t.samples[o];a.pts=v(a.pts-i,e*r)/r}t.samples.sort((function(t,e){return t.pts-e.pts}));var s=t.samples;return t.samples=[],{samples:s}}},t}();function v(t,e){var n;if(null===e)return t;for(n=e<t?-8589934592:8589934592;Math.abs(t-e)>4294967296;)t+=n;return t}var g=function(t,e,n,r){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=e,this.size=n,this.cts=r,this.flags=new m(t)},m=function(t){this.isLeading=0,this.isDependedOn=0,this.hasRedundancy=0,this.degradPrio=0,this.dependsOn=1,this.isNonSync=1,this.dependsOn=t?2:1,this.isNonSync=t?0:1}},"./src/remux/passthrough-remuxer.ts":function(t,e,n){"use strict";n.r(e);var r=n("./src/polyfills/number.ts"),i=n("./src/utils/mp4-tools.ts"),o=n("./src/loader/fragment.ts"),a=n("./src/utils/logger.ts"),s=function(){function t(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=void 0,this.initTracks=void 0,this.lastEndDTS=null}var e=t.prototype;return e.destroy=function(){},e.resetTimeStamp=function(t){this.initPTS=t,this.lastEndDTS=null},e.resetNextTimestamp=function(){this.lastEndDTS=null},e.resetInitSegment=function(t,e,n){this.audioCodec=e,this.videoCodec=n,this.generateInitSegment(t),this.emitInitSegment=!0},e.generateInitSegment=function(t){var e=this.audioCodec,n=this.videoCodec;if(!t||!t.byteLength)return this.initTracks=void 0,void(this.initData=void 0);var r=this.initData=Object(i.parseInitSegment)(t);e||(e=l(r.audio,o.ElementaryStreamTypes.AUDIO)),n||(n=l(r.video,o.ElementaryStreamTypes.VIDEO));var s={};r.audio&&r.video?s.audiovideo={container:"video/mp4",codec:e+","+n,initSegment:t,id:"main"}:r.audio?s.audio={container:"audio/mp4",codec:e,initSegment:t,id:"audio"}:r.video?s.video={container:"video/mp4",codec:n,initSegment:t,id:"main"}:a.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=s},e.remux=function(t,e,n,o,s){var l=this.initPTS,c=this.lastEndDTS,f={audio:void 0,video:void 0,text:o,id3:n,initSegment:void 0};Object(r.isFiniteNumber)(c)||(c=this.lastEndDTS=s||0);var d=e.samples;if(!d||!d.length)return f;var h={initPTS:void 0,timescale:1},p=this.initData;if(p&&p.length||(this.generateInitSegment(d),p=this.initData),!p||!p.length)return a.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),f;this.emitInitSegment&&(h.tracks=this.initTracks,this.emitInitSegment=!1),Object(r.isFiniteNumber)(l)||(this.initPTS=h.initPTS=l=u(p,d,c));var y=Object(i.getDuration)(d,p),v=c,g=y+v;Object(i.offsetStartDTS)(p,d,l),y>0?this.lastEndDTS=g:(a.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var m=!!p.audio,b=!!p.video,E="";m&&(E+="audio"),b&&(E+="video");var _={data1:d,startPTS:v,startDTS:v,endPTS:g,endDTS:g,type:E,hasAudio:m,hasVideo:b,nb:1,dropped:0};return f.audio="audio"===_.type?_:void 0,f.video="audio"!==_.type?_:void 0,f.text=o,f.id3=n,f.initSegment=h,f},t}(),u=function(t,e,n){return Object(i.getStartDTS)(t,e)-n};function l(t,e){var n=null==t?void 0:t.codec;return n&&n.length>4?n:"hvc1"===n?"hvc1.1.c.L120.90":"av01"===n?"av01.0.04M.08":"avc1"===n||e===o.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}e.default=s},"./src/task-loop.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return r}));var r=function(){function t(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var e=t.prototype;return e.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},e.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},e.onHandlerDestroyed=function(){},e.hasInterval=function(){return!!this._tickInterval},e.hasNextTick=function(){return!!this._tickTimer},e.setInterval=function(t){return!this._tickInterval&&(this._tickInterval=self.setInterval(this._boundTick,t),!0)},e.clearInterval=function(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)},e.clearNextTick=function(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)},e.tick=function(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},e.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},e.doTick=function(){},t}()},
1"./src/types/cmcd.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"CMCDVersion",(function(){return a})),n.d(e,"CMCDObjectType",(function(){return r})),n.d(e,"CMCDStreamingFormat",(function(){return i})),n.d(e,"CMCDStreamType",(function(){return o}));var r,i,o,a=1;!function(t){t.MANIFEST="m",t.AUDIO="a",t.VIDEO="v",t.MUXED="av",t.INIT="i",t.CAPTION="c",t.TIMED_TEXT="tt",t.KEY="k",t.OTHER="o"}(r||(r={})),function(t){t.DASH="d",t.HLS="h",t.SMOOTH="s",t.OTHER="o"}(i||(i={})),function(t){t.VOD="v",t.LIVE="l"}(o||(o={}))},
vendor: 2,110 bytes, line 1
1"./src/types/level.ts":function(t,e,n){"use strict";function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var i;function o(t,e){var n=t.canSkipUntil,r=t.canSkipDateRanges,o=t.endSN;return n&&(void 0!==e?e-o:0)<n?r?i.v2:i.Yes:i.No}n.r(e),n.d(e,"HlsSkip",(function(){return i})),n.d(e,"getSkipValue",(function(){return o})),n.d(e,"HlsUrlParameters",(function(){return a})),n.d(e,"Level",(function(){return s})),function(t){t.No="",t.Yes="YES",t.v2="v2"}(i||(i={}));var a=function(){function t(t,e,n){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=t,this.part=e,this.skip=n}return t.prototype.addDirectives=function(t){var e=new self.URL(t);return void 0!==this.msn&&e.searchParams.set("_HLS_msn",this.msn.toString()),void 0!==this.part&&e.searchParams.set("_HLS_part",this.part.toString()),this.skip&&e.searchParams.set("_HLS_skip",this.skip),e.toString()},t}(),s=function(){function t(t){this.attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.unknownCodecs=void 0,this.audioGroupIds=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.textGroupIds=void 0,this.url=void 0,this._urlId=0,this.url=[t.url],this.attrs=t.attrs,this.bitrate=t.bitrate,t.details&&(this.details=t.details),this.id=t.id||0,this.name=t.name,this.width=t.width||0,this.height=t.height||0,this.audioCodec=t.audioCodec,this.videoCodec=t.videoCodec,this.unknownCodecs=t.unknownCodecs,this.codecSet=[t.videoCodec,t.audioCodec].filter((function(t){return t})).join(",").replace(/\.[^.,]+/g,"")}var e,n,i;return e=t,(n=[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"uri",get:function(){return this.url[this._urlId]||""}},{key:"urlId",get:function(){return this._urlId},set:function(t){var e=t%this.url.length;this._urlId!==e&&(this.details=void 0,this._urlId=e)}}])&&r(e.prototype,n),i&&r(e,i),t}()},
1"./src/types/loader.ts":function(t,e,n){"use strict";var r,i;n.r(e),n.d(e,"PlaylistContextType",(function(){return r})),n.d(e,"PlaylistLevelType",(function(){return i})),function(t){t.MANIFEST="manifest",t.LEVEL="level",t.AUDIO_TRACK="audioTrack",t.SUBTITLE_TRACK="subtitleTrack"}(r||(r={})),function(t){t.MAIN="main",t.AUDIO="audio",t.SUBTITLE="subtitle"}(i||(i={}))},
vendor: 13,585 bytes, line 1
1"./src/types/transmuxer.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"ChunkMetadata",(function(){return r}));var r=function(t,e,n,r,i,o){void 0===r&&(r=0),void 0===i&&(i=-1),void 0===o&&(o=!1),this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing={start:0,executeStart:0,executeEnd:0,end:0},this.buffering={audio:{start:0,executeStart:0,executeEnd:0,end:0},video:{start:0,executeStart:0,executeEnd:0,end:0},audiovideo:{start:0,executeStart:0,executeEnd:0,end:0}},this.level=t,this.sn=e,this.id=n,this.size=r,this.part=i,this.partial=o}},"./src/utils/attr-list.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"AttrList",(function(){return o}));var r=/^(\d+)x(\d+)$/,i=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,o=function(){function t(e){for(var n in"string"==typeof e&&(e=t.parseAttrList(e)),e)e.hasOwnProperty(n)&&(this[n]=e[n])}var e=t.prototype;return e.decimalInteger=function(t){var e=parseInt(this[t],10);return e>Number.MAX_SAFE_INTEGER?1/0:e},e.hexadecimalInteger=function(t){if(this[t]){var e=(this[t]||"0x").slice(2);e=(1&e.length?"0":"")+e;for(var n=new Uint8Array(e.length/2),r=0;r<e.length/2;r++)n[r]=parseInt(e.slice(2*r,2*r+2),16);return n}return null},e.hexadecimalIntegerAsNumber=function(t){var e=parseInt(this[t],16);return e>Number.MAX_SAFE_INTEGER?1/0:e},e.decimalFloatingPoint=function(t){return parseFloat(this[t])},e.optionalFloat=function(t,e){var n=this[t];return n?parseFloat(n):e},e.enumeratedString=function(t){return this[t]},e.bool=function(t){return"YES"===this[t]},e.decimalResolution=function(t){var e=r.exec(this[t]);if(null!==e)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}},t.parseAttrList=function(t){var e,n={};for(i.lastIndex=0;null!==(e=i.exec(t));){var r=e[2];0===r.indexOf('"')&&r.lastIndexOf('"')===r.length-1&&(r=r.slice(1,-1)),n[e[1]]=r}return n},t}()},"./src/utils/binary-search.ts":function(t,e,n){"use strict";n.r(e),e.default={search:function(t,e){for(var n=0,r=t.length-1,i=null,o=null;n<=r;){var a=e(o=t[i=(n+r)/2|0]);if(a>0)n=i+1;else{if(!(a<0))return o;r=i-1}}return null}}},"./src/utils/buffer-helper.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"BufferHelper",(function(){return o}));var r=n("./src/utils/logger.ts"),i={length:0,start:function(){return 0},end:function(){return 0}},o=function(){function t(){}return t.isBuffered=function(e,n){try{if(e)for(var r=t.getBuffered(e),i=0;i<r.length;i++)if(n>=r.start(i)&&n<=r.end(i))return!0}catch(t){}return!1},t.bufferInfo=function(e,n,r){try{if(e){var i,o=t.getBuffered(e),a=[];for(i=0;i<o.length;i++)a.push({start:o.start(i),end:o.end(i)});return this.bufferedInfo(a,n,r)}}catch(t){}return{len:0,start:n,end:n,nextStart:void 0}},t.bufferedInfo=function(t,e,n){e=Math.max(0,e),t.sort((function(t,e){var n=t.start-e.start;return n||e.end-t.end}));var r=[];if(n)for(var i=0;i<t.length;i++){var o=r.length;if(o){var a=r[o-1].end;t[i].start-a<n?t[i].end>a&&(r[o-1].end=t[i].end):r.push(t[i])}else r.push(t[i])}else r=t;for(var s,u=0,l=e,c=e,f=0;f<r.length;f++){var d=r[f].start,h=r[f].end;if(e+n>=d&&e<h)l=d,u=(c=h)-e;else if(e+n<d){s=d;break}}return{len:u,start:l||0,end:c||0,nextStart:s}},t.getBuffered=function(t){try{return t.buffered}catch(t){return r.logger.log("failed to get media.buffered",t),i}},t}()},"./src/utils/cea-608-parser.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"Row",(function(){return v})),n.d(e,"CaptionScreen",(function(){return g}));var r,i=n("./src/utils/logger.ts"),o={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},a=function(t){var e=t;return o.hasOwnProperty(t)&&(e=o[t]),String.fromCharCode(e)},s={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},u={17:2,18:4,21:6,22:8,23:10,19:13,20:15},l={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},c={25:2,26:4,29:6,30:8,31:10,27:13,28:15},f=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];!function(t){t[t.ERROR=0]="ERROR",t[t.TEXT=1]="TEXT",t[t.WARNING=2]="WARNING",t[t.INFO=2]="INFO",t[t.DEBUG=3]="DEBUG",t[t.DATA=3]="DATA"}(r||(r={}));var d=function(){function t(){this.time=null,this.verboseLevel=r.ERROR}return t.prototype.log=function(t,e){this.verboseLevel>=t&&i.logger.log(this.time+" ["+t+"] "+e)},t}(),h=function(t){for(var e=[],n=0;n<t.length;n++)e.push(t[n].toString(16));return e},p=function(){function t(t,e,n,r,i){this.foreground=void 0,this.underline=void 0,this.italics=void 0,this.background=void 0,this.flash=void 0,this.foreground=t||"white",this.underline=e||!1,this.italics=n||!1,this.background=r||"black",this.flash=i||!1}var e=t.prototype;return e.reset=function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},e.setStyles=function(t){for(var e=["foreground","underline","italics","background","flash"],n=0;n<e.length;n++){var r=e[n];t.hasOwnProperty(r)&&(this[r]=t[r])}},e.isDefault=function(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash},e.equals=function(t){return this.foreground===t.foreground&&this.underline===t.underline&&this.italics===t.italics&&this.background===t.background&&this.flash===t.flash},e.copy=function(t){this.foreground=t.foreground,this.underline=t.underline,this.italics=t.italics,this.background=t.background,this.flash=t.flash},e.toString=function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash},t}(),y=function(){function t(t,e,n,r,i,o){this.uchar=void 0,this.penState=void 0,this.uchar=t||" ",this.penState=new p(e,n,r,i,o)}var e=t.prototype;return e.reset=function(){this.uchar=" ",this.penState.reset()},e.setChar=function(t,e){this.uchar=t,this.penState.copy(e)},e.setPenState=function(t){this.penState.copy(t)},e.equals=function(t){return this.uchar===t.uchar&&this.penState.equals(t.penState)},e.copy=function(t){this.uchar=t.uchar,this.penState.copy(t.penState)},e.isEmpty=function(){return" "===this.uchar&&this.penState.isDefault()},t}(),v=function(){function t(t){this.chars=void 0,this.pos=void 0,this.currPenState=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chars=[];for(var e=0;e<100;e++)this.chars.push(new y);this.logger=t,this.pos=0,this.currPenState=new p}var e=t.prototype;return e.equals=function(t){for(var e=!0,n=0;n<100;n++)if(!this.chars[n].equals(t.chars[n])){e=!1;break}return e},e.copy=function(t){for(var e=0;e<100;e++)this.chars[e].copy(t.chars[e])},e.isEmpty=function(){for(var t=!0,e=0;e<100;e++)if(!this.chars[e].isEmpty()){t=!1;break}return t},e.setCursor=function(t){this.pos!==t&&(this.pos=t),this.pos<0?(this.logger.log(r.DEBUG,"Negative cursor position "+this.pos),this.pos=0):this.pos>100&&(this.logger.log(r.DEBUG,"Too large cursor position "+this.pos),this.pos=100)},e.moveCursor=function(t){var e=this.pos+t;if(t>1)for(var n=this.pos+1;n<e+1;n++)this.chars[n].setPenState(this.currPenState);this.setCursor(e)},e.backSpace=function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},e.insertChar=function(t){t>=144&&this.backSpace();var e=a(t);this.pos>=100?this.logger.log(r.ERROR,"Cannot insert "+t.toString(16)+" ("+e+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(e,this.currPenState),this.moveCursor(1))},e.clearFromPos=function(t){var e;for(e=t;e<100;e++)this.chars[e].reset()},e.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},e.clearToEndOfRow=function(){this.clearFromPos(this.pos)},e.getTextString=function(){for(var t=[],e=!0,n=0;n<100;n++){var r=this.chars[n].uchar;" "!==r&&(e=!1),t.push(r)}return e?"":t.join("")},e.setPenStyles=function(t){this.currPenState.setStyles(t),this.chars[this.pos].setPenState(this.currPenState)},t}(),g=function(){function t(t){this.rows=void 0,this.currRow=void 0,this.nrRollUpRows=void 0,this.lastOutputScreen=void 0,this.logger=void 0,this.rows=[];for(var e=0;e<15;e++)this.rows.push(new v(t));this.logger=t,this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.reset()}var e=t.prototype;return e.reset=function(){for(var t=0;t<15;t++)this.rows[t].clear();this.currRow=14},e.equals=function(t){for(var e=!0,n=0;n<15;n++)if(!this.rows[n].equals(t.rows[n])){e=!1;break}return e},e.copy=function(t){for(var e=0;e<15;e++)this.rows[e].copy(t.rows[e])},e.isEmpty=function(){for(var t=!0,e=0;e<15;e++)if(!this.rows[e].isEmpty()){t=!1;break}return t},e.backSpace=function(){this.rows[this.currRow].backSpace()},e.clearToEndOfRow=function(){this.rows[this.currRow].clearToEndOfRow()},e.insertChar=function(t){this.rows[this.currRow].insertChar(t)},e.setPen=function(t){this.rows[this.currRow].setPenStyles(t)},e.moveCursor=function(t){this.rows[this.currRow].moveCursor(t)},e.setCursor=function(t){this.logger.log(r.INFO,"setCursor: "+t),this.rows[this.currRow].setCursor(t)},e.setPAC=function(t){this.logger.log(r.INFO,"pacData = "+JSON.stringify(t));var e=t.row-1;if(this.nrRollUpRows&&e<this.nrRollUpRows-1&&(e=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==e){for(var n=0;n<15;n++)this.rows[n].clear();var i=this.currRow+1-this.nrRollUpRows,o=this.lastOutputScreen;if(o){var a=o.rows[i].cueStartTime,s=this.logger.time;if(a&&null!==s&&a<s)for(var u=0;u<this.nrRollUpRows;u++)this.rows[e-this.nrRollUpRows+u+1].copy(o.rows[i+u])}}this.currRow=e;var l=this.rows[this.currRow];if(null!==t.indent){var c=t.indent,f=Math.max(c-1,0);l.setCursor(t.indent),t.color=l.chars[f].penState.foreground}var d={foreground:t.color,underline:t.underline,italics:t.italics,background:"black",flash:!1};this.setPen(d)},e.setBkgData=function(t){this.logger.log(r.INFO,"bkgData = "+JSON.stringify(t)),this.backSpace(),this.setPen(t),this.insertChar(32)},e.setRollUpRows=function(t){this.nrRollUpRows=t},e.rollUp=function(){if(null!==this.nrRollUpRows){this.logger.log(r.TEXT,this.getDisplayText());var t=this.currRow+1-this.nrRollUpRows,e=this.rows.splice(t,1)[0];e.clear(),this.rows.splice(this.currRow,0,e),this.logger.log(r.INFO,"Rolling up")}else this.logger.log(r.DEBUG,"roll_up but nrRollUpRows not set yet")},e.getDisplayText=function(t){t=t||!1;for(var e=[],n="",r=-1,i=0;i<15;i++){var o=this.rows[i].getTextString();o&&(r=i+1,t?e.push("Row "+r+": '"+o+"'"):e.push(o.trim()))}return e.length>0&&(n=t?"["+e.join(" | ")+"]":e.join("\n")),n},e.getTextAndFormat=function(){return this.rows},t}(),m=function(){function t(t,e,n){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=t,this.outputFilter=e,this.mode=null,this.verbose=0,this.displayedMemory=new g(n),this.nonDisplayedMemory=new g(n),this.lastOutputScreen=new g(n),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=n}var e=t.prototype;return e.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},e.getHandler=function(){return this.outputFilter},e.setHandler=function(t){this.outputFilter=t},e.setPAC=function(t){this.writeScreen.setPAC(t)},e.setBkgData=function(t){this.writeScreen.setBkgData(t)},e.setMode=function(t){t!==this.mode&&(this.mode=t,this.logger.log(r.INFO,"MODE="+t),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=t)},e.insertChars=function(t){for(var e=0;e<t.length;e++)this.writeScreen.insertChar(t[e]);var n=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(r.INFO,n+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(this.logger.log(r.TEXT,"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},e.ccRCL=function(){this.logger.log(r.INFO,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},e.ccBS=function(){this.logger.log(r.INFO,"BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},e.ccAOF=function(){},e.ccAON=function(){},e.ccDER=function(){this.logger.log(r.INFO,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},e.ccRU=function(t){this.logger.log(r.INFO,"RU("+t+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(t)},e.ccFON=function(){this.logger.log(r.INFO,"FON - Flash On"),this.writeScreen.setPen({flash:!0})},e.ccRDC=function(){this.logger.log(r.INFO,"RDC - Resume Direct
1Captioning"),this.setMode("MODE_PAINT-ON")},e.ccTR=function(){this.logger.log(r.INFO,"TR"),this.setMode("MODE_TEXT")},e.ccRTD=function(){this.logger.log(r.INFO,"RTD"),this.setMode("MODE_TEXT")},e.ccEDM=function(){this.logger.log(r.INFO,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)},e.ccCR=function(){this.logger.log(r.INFO,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)},e.ccENM=function(){this.logger.log(r.INFO,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},e.ccEOC=function(){if(this.logger.log(r.INFO,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode){var t=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=t,this.writeScreen=this.nonDisplayedMemory,this.logger.log(r.TEXT,"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)},e.ccTO=function(t){this.logger.log(r.INFO,"TO("+t+") - Tab Offset"),this.writeScreen.moveCursor(t)},e.ccMIDROW=function(t){var e={flash:!1};if(e.underline=t%2==1,e.italics=t>=46,e.italics)e.foreground="white";else{var n=Math.floor(t/2)-16;e.foreground=["white","green","blue","cyan","red","yellow","magenta"][n]}this.logger.log(r.INFO,"MIDROW: "+JSON.stringify(e)),this.writeScreen.setPen(e)},e.outputDataUpdate=function(t){void 0===t&&(t=!1);var e=this.logger.time;null!==e&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,e,this.lastOutputScreen),t&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:e):this.cueStartTime=e,this.lastOutputScreen.copy(this.displayedMemory))},e.cueSplitAtTime=function(t){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,t,this.displayedMemory),this.cueStartTime=t))},t}(),b=function(){function t(t,e,n){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var r=new d;this.channels=[null,new m(t,e,r),new m(t+1,n,r)],this.cmdHistory={a:null,b:null},this.logger=r}var e=t.prototype;return e.getHandler=function(t){return this.channels[t].getHandler()},e.setHandler=function(t,e){this.channels[t].setHandler(e)},e.addData=function(t,e){var n,i,o,a=!1;this.logger.time=t;for(var s=0;s<e.length;s+=2)if(i=127&e[s],o=127&e[s+1],0!==i||0!==o){if(this.logger.log(r.DATA,"["+h([e[s],e[s+1]])+"] -> ("+h([i,o])+")"),(n=this.parseCmd(i,o))||(n=this.parseMidrow(i,o)),n||(n=this.parsePAC(i,o)),n||(n=this.parseBackgroundAttributes(i,o)),!n&&(a=this.parseChars(i,o))){var u=this.currentChannel;u&&u>0?this.channels[u].insertChars(a):this.logger.log(r.WARNING,"No channel found yet. TEXT-MODE?")}n||a||this.logger.log(r.WARNING,"Couldn't parse cleaned data "+h([i,o])+" orig: "+h([e[s],e[s+1]]))}},e.parseCmd=function(t,e){var n=this.cmdHistory;if(!((20===t||28===t||21===t||29===t)&&e>=32&&e<=47||(23===t||31===t)&&e>=33&&e<=35))return!1;if(_(t,e,n))return E(null,null,n),this.logger.log(r.DEBUG,"Repeated command ("+h([t,e])+") is dropped"),!0;var i=20===t||21===t||23===t?1:2,o=this.channels[i];return 20===t||21===t||28===t||29===t?32===e?o.ccRCL():33===e?o.ccBS():34===e?o.ccAOF():35===e?o.ccAON():36===e?o.ccDER():37===e?o.ccRU(2):38===e?o.ccRU(3):39===e?o.ccRU(4):40===e?o.ccFON():41===e?o.ccRDC():42===e?o.ccTR():43===e?o.ccRTD():44===e?o.ccEDM():45===e?o.ccCR():46===e?o.ccENM():47===e&&o.ccEOC():o.ccTO(e-32),E(t,e,n),this.currentChannel=i,!0},e.parseMidrow=function(t,e){var n=0;if((17===t||25===t)&&e>=32&&e<=47){if((n=17===t?1:2)!==this.currentChannel)return this.logger.log(r.ERROR,"Mismatch channel in midrow parsing"),!1;var i=this.channels[n];return!!i&&(i.ccMIDROW(e),this.logger.log(r.DEBUG,"MIDROW ("+h([t,e])+")"),!0)}return!1},e.parsePAC=function(t,e){var n,r=this.cmdHistory;if(!((t>=17&&t<=23||t>=25&&t<=31)&&e>=64&&e<=127||(16===t||24===t)&&e>=64&&e<=95))return!1;if(_(t,e,r))return E(null,null,r),!0;var i=t<=23?1:2;n=e>=64&&e<=95?1===i?s[t]:l[t]:1===i?u[t]:c[t];var o=this.channels[i];return!!o&&(o.setPAC(this.interpretPAC(n,e)),E(t,e,r),this.currentChannel=i,!0)},e.interpretPAC=function(t,e){var n,r={color:null,italics:!1,indent:null,underline:!1,row:t};return n=e>95?e-96:e-64,r.underline=1==(1&n),n<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(n/2)]:n<=15?(r.italics=!0,r.color="white"):r.indent=4*Math.floor((n-16)/2),r},e.parseChars=function(t,e){var n,i,o=null,s=null;if(t>=25?(n=2,s=t-8):(n=1,s=t),s>=17&&s<=19?(i=17===s?e+80:18===s?e+112:e+144,this.logger.log(r.INFO,"Special char '"+a(i)+"' in channel "+n),o=[i]):t>=32&&t<=127&&(o=0===e?[t]:[t,e]),o){var u=h(o);this.logger.log(r.DEBUG,"Char codes = "+u.join(",")),E(t,e,this.cmdHistory)}return o}
vendor: 15,009 bytes, line 1
1,e.parseBackgroundAttributes=function(t,e){var n;if(!((16===t||24===t)&&e>=32&&e<=47||(23===t||31===t)&&e>=45&&e<=47))return!1;var r={};16===t||24===t?(n=Math.floor((e-32)/2),r.background=f[n],e%2==1&&(r.background=r.background+"_semi")):45===e?r.background="transparent":(r.foreground="black",47===e&&(r.underline=!0));var i=t<=23?1:2;return this.channels[i].setBkgData(r),E(t,e,this.cmdHistory),!0},e.reset=function(){for(var t=0;t<Object.keys(this.channels).length;t++){var e=this.channels[t];e&&e.reset()}this.cmdHistory={a:null,b:null}},e.cueSplitAtTime=function(t){for(var e=0;e<this.channels.length;e++){var n=this.channels[e];n&&n.cueSplitAtTime(t)}},t}();function E(t,e,n){n.a=t,n.b=e}function _(t,e,n){return n.a===t&&n.b===e}e.default=b},"./src/utils/codecs.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"isCodecType",(function(){return i})),n.d(e,"isCodecSupportedInMp4",(function(){return o}));var r={audio:{a3ds:!0,"ac-3":!0,"ac-4":!0,alac:!0,alaw:!0,dra1:!0,"dts+":!0,"dts-":!0,dtsc:!0,dtse:!0,dtsh:!0,"ec-3":!0,enca:!0,g719:!0,g726:!0,m4ae:!0,mha1:!0,mha2:!0,mhm1:!0,mhm2:!0,mlpa:!0,mp4a:!0,"raw ":!0,Opus:!0,samr:!0,sawb:!0,sawp:!0,sevc:!0,sqcp:!0,ssmv:!0,twos:!0,ulaw:!0},video:{avc1:!0,avc2:!0,avc3:!0,avc4:!0,avcp:!0,av01:!0,drac:!0,dvav:!0,dvhe:!0,encv:!0,hev1:!0,hvc1:!0,mjp2:!0,mp4v:!0,mvc1:!0,mvc2:!0,mvc3:!0,mvc4:!0,resv:!0,rv60:!0,s263:!0,svc1:!0,svc2:!0,"vc-1":!0,vp08:!0,vp09:!0},text:{stpp:!0,wvtt:!0}};function i(t,e){var n=r[e];return!!n&&!0===n[t.slice(0,4)]}function o(t,e){return MediaSource.isTypeSupported((e||"video")+'/mp4;codecs="'+t+'"')}},"./src/utils/cues.ts":function(t,e,n){"use strict";n.r(e);var r=n("./src/utils/vttparser.ts"),i=n("./src/utils/webvtt-parser.ts"),o=n("./src/utils/texttrack-utils.ts"),a=/\s/,s={newCue:function(t,e,n,s){for(var u,l,c,f,d,h=[],p=self.VTTCue||self.TextTrackCue,y=0;y<s.rows.length;y++)if(c=!0,f=0,d="",!(u=s.rows[y]).isEmpty()){for(var v=0;v<u.chars.length;v++)a.test(u.chars[v].uchar)&&c?f++:(d+=u.chars[v].uchar,c=!1);u.cueStartTime=e,e===n&&(n+=1e-4),f>=16?f--:f++;var g=Object(r.fixLineBreaks)(d.trim()),m=Object(i.generateCueId)(e,n,g);t&&t.cues&&t.cues.getCueById(m)||((l=new p(e,n,g)).id=m,l.line=y+1,l.align="left",l.position=10+Math.min(80,10*Math.floor(8*f/32)),h.push(l))}return t&&h.length&&(h.sort((function(t,e){return"auto"===t.line||"auto"===e.line?0:t.line>8&&e.line>8?e.line-t.line:t.line-e.line})),h.forEach((function(e){return Object(o.addCueToTrack)(t,e)}))),h}};e.default=s},"./src/utils/discontinuities.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"findFirstFragWithCC",(function(){return a})),n.d(e,"shouldAlignOnDiscontinuities",(function(){return s})),n.d(e,"findDiscontinuousReferenceFrag",(function(){return u})),n.d(e,"adjustSlidingStart",(function(){return c})),n.d(e,"alignStream",(function(){return f})),n.d(e,"alignPDT",(function(){return d})),n.d(e,"alignFragmentByPDTDelta",(function(){return h})),n.d(e,"alignMediaPlaylistByPDT",(function(){return p}));var r=n("./src/polyfills/number.ts"),i=n("./src/utils/logger.ts"),o=n("./src/controller/level-helper.ts");function a(t,e){for(var n=null,r=0,i=t.length;r<i;r++){var o=t[r];if(o&&o.cc===e){n=o;break}}return n}function s(t,e,n){return!(!e.details||!(n.endCC>n.startCC||t&&t.cc<n.startCC))}function u(t,e){var n=t.fragments,r=e.fragments;if(r.length&&n.length){var o=a(n,r[0].cc);if(o&&(!o||o.startPTS))return o;i.logger.log("No frag in previous level to align on")}else i.logger.log("No fragments to align")}function l(t,e){if(t){var n=t.start+e;t.start=t.startPTS=n,t.endPTS=n+t.duration}}function c(t,e){for(var n=e.fragments,r=0,i=n.length;r<i;r++)l(n[r],t);e.fragmentHint&&l(e.fragmentHint,t),e.alignedSliding=!0}function f(t,e,n){e&&(function(t,e,n){if(s(t,n,e)){var o=u(n.details,e);o&&Object(r.isFiniteNumber)(o.start)&&(i.logger.log("Adjusting PTS using last level due to CC increase within current level "+e.url),c(o.start,e))}}(t,n,e),!n.alignedSliding&&e.details&&d(n,e.details),n.alignedSliding||!e.details||n.skippedSegments||Object(o.adjustSliding)(e.details,n))}function d(t,e){if(e.fragments.length&&t.hasProgramDateTime&&e.hasProgramDateTime){var n=e.fragments[0].programDateTime,o=t.fragments[0].programDateTime,a=(o-n)/1e3+e.fragments[0].start;a&&Object(r.isFiniteNumber)(a)&&(i.logger.log("Adjusting PTS using programDateTime delta "+(o-n)+"ms, sliding:"+a.toFixed(3)+" "+t.url+" "),c(a,t))}}function h(t,e){var n=t.programDateTime;if(n){var r=(n-e)/1e3;t.start=t.startPTS=r,t.endPTS=r+t.duration}}function p(t,e){if(e.fragments.length&&t.hasProgramDateTime&&e.hasProgramDateTime){var n=e.fragments[0].programDateTime-1e3*e.fragments[0].start;t.fragments.forEach((function(t){h(t,n)})),t.fragmentHint&&h(t.fragmentHint,n),t.alignedSliding=!0}}},"./src/utils/ewma-bandwidth-estimator.ts":function(t,e,n){"use strict";n.r(e);var r=n("./src/utils/ewma.ts"),i=function(){function t(t,e,n){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultEstimate_=n,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new r.default(t),this.fast_=new r.default(e)}var e=t.prototype;return e.update=function(t,e){var n=this.slow_,i=this.fast_;this.slow_.halfLife!==t&&(this.slow_=new r.default(t,n.getEstimate(),n.getTotalWeight())),this.fast_.halfLife!==e&&(this.fast_=new r.default(e,i.getEstimate(),i.getTotalWeight()))},e.sample=function(t,e){var n=(t=Math.max(t,this.minDelayMs_))/1e3,r=8*e/n;this.fast_.sample(n,r),this.slow_.sample(n,r)},e.canEstimate=function(){var t=this.fast_;return t&&t.getTotalWeight()>=this.minWeight_},e.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},e.destroy=function(){},t}();e.default=i},"./src/utils/ewma.ts":function(t,e,n){"use strict";n.r(e);var r=function(){function t(t,e,n){void 0===e&&(e=0),void 0===n&&(n=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=t,this.alpha_=t?Math.exp(Math.log(.5)/t):0,this.estimate_=e,this.totalWeight_=n}var e=t.prototype;return e.sample=function(t,e){var n=Math.pow(this.alpha_,t);this.estimate_=e*(1-n)+n*this.estimate_,this.totalWeight_+=t},e.getTotalWeight=function(){return this.totalWeight_},e.getEstimate=function(){if(this.alpha_){var t=1-Math.pow(this.alpha_,this.totalWeight_);if(t)return this.estimate_/t}return this.estimate_},t}();e.default=r},"./src/utils/fetch-loader.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"fetchSupported",(function(){return d}));var r=n("./src/polyfills/number.ts"),i=n("./src/loader/load-stats.ts"),o=n("./src/demux/chunk-cache.ts");function a(t){var e="function"==typeof Map?new Map:void 0;return(a=function(t){if(null===t||(n=t,-1===Function.toString.call(n).indexOf("[native code]")))return t;var n;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return s(t,arguments,c(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),l(r,t)})(t)}function s(t,e,n){return(s=u()?Reflect.construct:function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&l(i,n.prototype),i}).apply(null,arguments)}function u(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function l(t,e){return(l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function f(){return(f=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}function d(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(t){}return!1}var h=function(){function t(t){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=void 0,this.response=void 0,this.controller=void 0,this.context=void 0,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=t.fetchSetup||p,this.controller=new self.AbortController,this.stats=new i.LoadStats}var e=t.prototype;return e.destroy=function(){this.loader=this.callbacks=null,this.abortInternal()},e.abortInternal=function(){var t=this.response;t&&t.ok||(this.stats.aborted=!0,this.controller.abort())},e.abort=function(){var t;this.abortInternal(),null!==(t=this.callbacks)&&void 0!==t&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},e.load=function(t,e,n){var i=this,o=this.stats;if(o.loading.start)throw new Error("Loader can only be used once.");o.loading.start=self.performance.now();var a=function(t,e){var n={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(f({},t.headers))};return t.rangeEnd&&n.headers.set("Range","bytes="+t.rangeStart+"-"+String(t.rangeEnd-1)),n}(t,this.controller.signal),s=n.onProgress,u="arraybuffer"===t.responseType,l=u?"byteLength":"length";this.context=t,this.config=e,this.callbacks=n,this.request=this.fetchSetup(t,a),self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout((function(){i.abortInternal(),n.onTimeout(o,t,i.response)}),e.timeout),self.fetch(this.request).then((function(n){if(i.response=i.loader=n,!n.ok){var a=n.status,l=n.statusText;throw new y(l||"fetch, bad network response",a,n)}return o.loading.first=Math.max(self.performance.now(),o.loading.start),o.total=parseInt(n.headers.get("Content-Length")||"0"),s&&Object(r.isFiniteNumber)(e.highWaterMark)?i.loadProgressively(n,o,t,e.highWaterMark,s):u?n.arrayBuffer():n.text()})).then((function(a){var u=i.response;self.clearTimeout(i.requestTimeout),o.loading.end=Math.max(self.performance.now(),o.loading.first),o.loaded=o.total=a[l];var c={url:u.url,data:a};s&&!Object(r.isFiniteNumber)(e.highWaterMark)&&s(o,t,a,u),n.onSuccess(c,o,t,u)})).catch((function(e){if(self.clearTimeout(i.requestTimeout),!o.aborted){var r=e.code||0;n.onError({code:r,text:e.message},t,e.details)}}))},e.getCacheAge=function(){var t=null;if(this.response){var e=this.response.headers.get("age");t=e?parseFloat(e):null}return t},e.loadProgressively=function(t,e,n,r,i){void 0===r&&(r=0);var a=new o.default,s=t.body.getReader();return function o(){return s.read().then((function(s){if(s.done)return a.dataLength&&i(e,n,a.flush(),t),Promise.resolve(new ArrayBuffer(0));var u=s.value,l=u.length;return e.loaded+=l,l<r||a.dataLength?(a.push(u),a.dataLength>=r&&i(e,n,a.flush(),t)):i(e,n,u,t),o()})).catch((function(){return Promise.reject()}))}()},t}();function p(t,e){return new self.Request(t.url,e)}var y=function(t){var e,n;function r(e,n,r){var i;return(i=t.call(this,e)||this).code=void 0,i.details=void 0,i.code=n,i.details=r,i}return n=t,(e=r).prototype=Object.create(n.prototype),e.prototype.constructor=e,l(e,n),r}(a(Error));e.default=h},"./src/utils/imsc1-ttml-parser.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"IMSC1_CODEC",(function(){return c})),n.d(e,"parseIMSC1",(function(){return p}));var r=n("./src/utils/mp4-tools.ts"),i=n("./src/utils/vttparser.ts"),o=n("./src/utils/vttcue.ts"),a=n("./src/demux/id3.ts"),s=n("./src/utils/timescale-conversion.ts"),u=n("./src/utils/webvtt-parser.ts");function l(){return(l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}var c="stpp.ttml.im1t",f=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,d=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,h={left:"start",center:"center",right:"end",start:"start",end:"end"};function p(t,e,n,i,c){var f=Object(r.findBox)(new Uint8Array(t),["mdat"]);if(0!==f.length){var d=f[0],p=Object(a.utf8ArrayToStr)(new Uint8Array(t,d.start,d.end-d.start)),E=Object(s.toTimescaleFromScale)(e,1,n);try{i(function(t,e){var n=(new DOMParser).parseFromString(t,"text/xml").getElementsByTagName("tt")[0];if(!n)throw new Error("Invalid ttml");var r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},i=Object.keys(r).reduce((function(t,e){return t[e]=n.getAttribute("ttp:"+e)||r[e],t}),{}),a="preserve"!==n.getAttribute("xml:space"),s=v(y(n,"styling","style")),c=v(y(n,"layout","region")),f=y(n,"body","[begin]");return[].map.call(f,(function(t){var n=function t(e,n){return[].slice.call(e.childNodes).reduce((function(e,r,i){var o;return"br"===r.nodeName&&i?e+"\n":null!==(o=r.childNodes)&&void 0!==o&&o.length?t(r,n):n?e+r.textContent.trim().replace(/\s+/g," "):e+r.textContent}),"")}(t,a);if(!n||!t.hasAttribute("begin"))return null;var r=b(t.getAttribute("begin"),i),f=b(t.getAttribute("dur"),i),d=b(t.getAttribute("end"),i);if(null===r)throw m(t);if(null===d){if(null===f)throw m(t);d=r+f}var p=new o.default(r-e,d-e,n);p.id=Object(u.generateCueId)(p.startTime,p.endTime,p.text);var y=c[t.getAttribute("region")],v=s[t.getAttribute("style")];p.position=10,p.size=80;var E=function(t,e){var n="http://www.w3.org/ns/ttml#styling";return["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"].reduce((function(r,i){var o=g(e,n,i)||g(t,n,i);return o&&(r[i]=o),r}),{})}(y,v),_=E.textAlign;if(_){var T=h[_];T&&(p.lineAlign=T),p.align=_}return l(p,E),p})).filter((function(t){return null!==t}))}(p,E))}catch(t){c(t)}}else c(new Error("Could not parse IMSC1 mdat"))}function y(t,e,n){var r=t.getElementsByTagName(e)[0];return r?[].slice.call(r.querySelectorAll(n)):[]}function v(t){return t.reduce((function(t,e){var n=e.getAttribute("xml:id");return n&&(t[n]=e),t}),{})}function g(t,e,n){return t.hasAttributeNS(e,n)?t.getAttributeNS(e,n):null}function m(t){return new Error("Could not parse ttml timestamp "+t)}function b(t,e){if(!t)return null;var n=Object(i.parseTimeStamp)(t);return null===n&&(f.test(t)?n=function(t,e){var n=f.exec(t),r=(0|n[4])+(0|n[5])/e.subFrameRate;return 3600*(0|n[1])+60*(0|n[2])+(0|n[3])+r/e.frameRate}(t,e):d.test(t)&&(n=function(t,e){var n=d.exec(t),r=Number(n[1]);switch(n[2]){case"h":return 3600*r;case"m":return 60*r;case"ms":return 1e3*r;case"f":return r/e.frameRate;case"t":return r/e.tickRate}return r}(t,e))),n}},"./src/utils/logger.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"enableLogs",(function(){return s})),n.d(e,"logger",(function(){return u}));var r=function(){},i={trace:r,debug:r,log:r,warn:r,info:r,error:r},o=i;function a(t){var e=self.console[t];return e?e.bind(self.console,"["+t+"] >"):r}function s(t){if(self.console&&!0===t||"object"==typeof t){!function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];n.forEach((function(e){o[e]=t[e]?t[e].bind(t):a(e)}))}(t,"debug","log","info","warn","error");try{o.log()}catch(t){o=i}}else o=i}var u=i},
1"./src/utils/mediakeys-helper.ts":function(t,e,n){"use strict";var r;n.r(e),n.d(e,"KeySystems",(function(){return r})),n.d(e,"requestMediaKeySystemAccess",(function(){return i})),function(t){t.WIDEVINE="com.widevine.alpha",t.PLAYREADY="com.microsoft.playready"}(r||(r={}));var i="undefined"!=typeof self&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null},
1"./src/utils/mediasource-helper.ts":function(t,e,n){"use strict";function r(){return self.MediaSource||self.WebKitMediaSource}n.r(e),n.d(e,"getMediaSource",(function(){return r}))},
vendor: 6,858 bytes, line 1
1"./src/utils/mp4-tools.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"bin2str",(function(){return s})),n.d(e,"readUint16",(function(){return u})),n.d(e,"readUint32",(function(){return l})),n.d(e,"writeUint32",(function(){return c})),n.d(e,"findBox",(function(){return f})),n.d(e,"parseSegmentIndex",(function(){return d})),n.d(e,"parseInitSegment",(function(){return h})),n.d(e,"getStartDTS",(function(){return p})),n.d(e,"getDuration",(function(){return y})),n.d(e,"computeRawDurationFromSamples",(function(){return v})),n.d(e,"offsetStartDTS",(function(){return g})),n.d(e,"segmentValidRange",(function(){return m})),n.d(e,"appendUint8Array",(function(){return b}));var r=n("./src/utils/typed-array.ts"),i=n("./src/loader/fragment.ts"),o=Math.pow(2,32)-1,a=[].push;function s(t){return String.fromCharCode.apply(null,t)}function u(t,e){"data"in t&&(e+=t.start,t=t.data);var n=t[e]<<8|t[e+1];return n<0?65536+n:n}function l(t,e){"data"in t&&(e+=t.start,t=t.data);var n=t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3];return n<0?4294967296+n:n}function c(t,e,n){"data"in t&&(e+=t.start,t=t.data),t[e]=n>>24,t[e+1]=n>>16&255,t[e+2]=n>>8&255,t[e+3]=255&n}function f(t,e){var n,r,i,o=[];if(!e.length)return o;"data"in t?(n=t.data,r=t.start,i=t.end):(r=0,i=(n=t).byteLength);for(var u=r;u<i;){var c=l(n,u),d=c>1?u+c:i;if(s(n.subarray(u+4,u+8))===e[0])if(1===e.length)o.push({data:n,start:u+8,end:d});else{var h=f({data:n,start:u+8,end:d},e.slice(1));h.length&&a.apply(o,h)}u=d}return o}function d(t){var e=f(t,["moov"])[0],n=e?e.end:null,r=f(t,["sidx"]);if(!r||!r[0])return null;var i=[],o=r[0],a=o.data[0],s=0===a?8:16,c=l(o,s);s+=4,s+=0===a?8:16,s+=2;var d=o.end+0,h=u(o,s);s+=2;for(var p=0;p<h;p++){var y=s,v=l(o,y);y+=4;var g=2147483647&v;if(1==(2147483648&v)>>>31)return console.warn("SIDX has hierarchical references (not supported)"),null;var m=l(o,y);y+=4,i.push({referenceSize:g,subsegmentDuration:m,info:{duration:m/c,start:d,end:d+g-1}}),d+=g,s=y+=4}return{earliestPresentationTime:0,timescale:c,version:a,referencesCount:h,references:i,moovEndOffset:n}}function h(t){for(var e=[],n=f(t,["moov","trak"]),r=0;r<n.length;r++){var o=n[r],a=f(o,["tkhd"])[0];if(a){var u=a.data[a.start],c=0===u?12:20,d=l(a,c),h=f(o,["mdia","mdhd"])[0];if(h){var p=l(h,c=0===(u=h.data[h.start])?12:20),y=f(o,["mdia","hdlr"])[0];if(y){var v=s(y.data.subarray(y.start+8,y.start+12)),g={soun:i.ElementaryStreamTypes.AUDIO,vide:i.ElementaryStreamTypes.VIDEO}[v];if(g){var m=f(o,["mdia","minf","stbl","stsd"])[0],b=void 0;m&&(b=s(m.data.subarray(m.start+12,m.start+16))),e[d]={timescale:p,type:g},e[g]={timescale:p,id:d,codec:b}}}}}}return f(t,["moov","mvex","trex"]).forEach((function(t){var n=l(t,4),r=e[n];r&&(r.default={duration:l(t,12),flags:l(t,20)})})),e}function p(t,e){return f(e,["moof","traf"]).reduce((function(e,n){var r=f(n,["tfdt"])[0],i=r.data[r.start],o=f(n,["tfhd"]).reduce((function(e,n){var o=l(n,4),a=t[o];if(a){var s=l(r,4);1===i&&(s*=Math.pow(2,32),s+=l(r,8));var u=s/(a.timescale||9e4);if(isFinite(u)&&(null===e||u<e))return u}return e}),null);return null!==o&&isFinite(o)&&(null===e||o<e)?o:e}),null)||0}function y(t,e){for(var n=0,r=0,o=0,a=f(t,["moof","traf"]),s=0;s<a.length;s++){var u=a[s],c=f(u,["tfhd"])[0],h=e[l(c,4)];if(h){var p=h.default,y=l(c,0)|(null==p?void 0:p.flags),g=null==p?void 0:p.duration;8&y&&(g=l(c,2&y?12:8));for(var m=h.timescale||9e4,b=f(u,["trun"]),E=0;E<b.length;E++)!(n=v(b[E]))&&g&&(n=g*l(b[E],4)),h.type===i.ElementaryStreamTypes.VIDEO?r+=n/m:h.type===i.ElementaryStreamTypes.AUDIO&&(o+=n/m)}}if(0===r&&0===o){var _=d(t);if(null!=_&&_.references)return _.references.reduce((function(t,e){return t+e.info.duration||0}),0)}return r||o}function v(t){var e=l(t,0),n=8;1&e&&(n+=4),4&e&&(n+=4);for(var r=0,i=l(t,4),o=0;o<i;o++)256&e&&(r+=l(t,n),n+=4),512&e&&(n+=4),1024&e&&(n+=4),2048&e&&(n+=4);return r}function g(t,e,n){f(e,["moof","traf"]).forEach((function(e){f(e,["tfhd"]).forEach((function(r){var i=l(r,4),a=t[i];if(a){var s=a.timescale||9e4;f(e,["tfdt"]).forEach((function(t){var e=t.data[t.start],r=l(t,4);if(0===e)c(t,4,r-n*s);else{r*=Math.pow(2,32),r+=l(t,8),r-=n*s,r=Math.max(r,0);var i=Math.floor(r/(o+1)),a=Math.floor(r%(o+1));c(t,4,i),c(t,8,a)}}))}}))}))}function m(t){var e={valid:null,remainder:null},n=f(t,["moof"]);if(!n)return e;if(n.length<2)return e.remainder=t,e;var i=n[n.length-1];return e.valid=Object(r.sliceUint8)(t,0,i.start-8),e.remainder=Object(r.sliceUint8)(t,i.start-8),e}function b(t,e){var n=new Uint8Array(t.length+e.length);return n.set(t),n.set(e,t.length),n}},"./src/utils/output-filter.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"default",(function(){return r}));var r=function(){function t(t,e){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=t,this.trackName=e}var e=t.prototype;return e.dispatchCue=function(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)},e.newCue=function(t,e,n){(null===this.startTime||this.startTime>t)&&(this.startTime=t),this.endTime=e,this.screen=n,this.timelineController.createCaptionsTrack(this.trackName)},e.reset=function(){this.cueRanges=[],this.startTime=null},t}()},"./src/utils/texttrack-utils.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"sendAddTrackEvent",(function(){return i})),n.d(e,"addCueToTrack",(function(){return o})),n.d(e,"clearCurrentCues",(function(){return a})),n.d(e,"removeCuesInRange",(function(){return s})),n.d(e,"getCuesInRange",(function(){return u}));var r=n("./src/utils/logger.ts");function i(t,e){var n;try{n=new Event("addtrack")}catch(t){(n=document.createEvent("Event")).initEvent("addtrack",!1,!1)}n.track=t,e.dispatchEvent(n)}function o(t,e){var n=t.mode;if("disabled"===n&&(t.mode="hidden"),t.cues&&!t.cues.getCueById(e.id))try{if(t.addCue(e),!t.cues.getCueById(e.id))throw new Error("addCue is failed for: "+e)}catch(n){r.logger.debug("[texttrack-utils]: "+n);var i=new self.TextTrackCue(e.startTime,e.endTime,e.text);i.id=e.id,t.addCue(i)}"disabled"===n&&(t.mode=n)}function a(t){var e=t.mode;if("disabled"===e&&(t.mode="hidden"),t.cues)for(var n=t.cues.length;n--;)t.removeCue(t.cues[n]);"disabled"===e&&(t.mode=e)}function s(t,e,n){var r=t.mode;if("disabled"===r&&(t.mode="hidden"),t.cues&&t.cues.length>0)for(var i=u(t.cues,e,n),o=0;o<i.length;o++)t.removeCue(i[o]);"disabled"===r&&(t.mode=r)}function u(t,e,n){var r=[],i=function(t,e){if(e<t[0].startTime)return 0;var n=t.length-1;if(e>t[n].endTime)return-1;for(var r=0,i=n;r<=i;){var o=Math.floor((i+r)/2);if(e<t[o].startTime)i=o-1;else{if(!(e>t[o].startTime&&r<n))return o;r=o+1}}return t[r].startTime-e<e-t[i].startTime?r:i}(t,e);if(i>-1)for(var o=i,a=t.length;o<a;o++){var s=t[o];if(s.startTime>=e&&s.endTime<=n)r.push(s);else if(s.startTime>n)return r}return r}},
1"./src/utils/time-ranges.ts":function(t,e,n){"use strict";n.r(e),e.default={toString:function(t){for(var e="",n=t.length,r=0;r<n;r++)e+="["+t.start(r).toFixed(3)+","+t.end(r).toFixed(3)+"]";return e}}},
vendor: 575 bytes, line 1
1"./src/utils/timescale-conversion.ts":function(t,e,n){"use strict";function r(t,e,n,r){void 0===n&&(n=1),void 0===r&&(r=!1);var i=t*e*n;return r?Math.round(i):i}function i(t,e,n,i){return void 0===n&&(n=1),void 0===i&&(i=!1),r(t,e,1/n,i)}function o(t,e){return void 0===e&&(e=!1),r(t,1e3,1/9e4,e)}function a(t,e){return void 0===e&&(e=1),r(t,9e4,1/e)}n.r(e),n.d(e,"toTimescaleFromBase",(function(){return r})),n.d(e,"toTimescaleFromScale",(function(){return i})),n.d(e,"toMsFromMpegTsClock",(function(){return o})),n.d(e,"toMpegTsClockFromTimescale",(function(){return a}))},
1"./src/utils/typed-array.ts":function(t,e,n){"use strict";function r(t,e,n){return Uint8Array.prototype.slice?t.slice(e,n):new Uint8Array(Array.prototype.slice.call(t,e,n))}n.r(e),n.d(e,"sliceUint8",(function(){return r}))},
vendor: 13,677 bytes, line 1
1"./src/utils/vttcue.ts":function(t,e,n){"use strict";n.r(e),e.default=function(){if("undefined"!=typeof self&&self.VTTCue)return self.VTTCue;var t=["","lr","rl"],e=["start","middle","end","left","right"];function n(t,e){if("string"!=typeof e)return!1;if(!Array.isArray(t))return!1;var n=e.toLowerCase();return!!~t.indexOf(n)&&n}function r(t){return n(e,t)}function i(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];for(var i=1;i<arguments.length;i++){var o=arguments[i];for(var a in o)t[a]=o[a]}return t}function o(e,o,a){var s=this,u={enumerable:!0};s.hasBeenReset=!1;var l="",c=!1,f=e,d=o,h=a,p=null,y="",v=!0,g="auto",m="start",b=50,E="middle",_=50,T="middle";Object.defineProperty(s,"id",i({},u,{get:function(){return l},set:function(t){l=""+t}})),Object.defineProperty(s,"pauseOnExit",i({},u,{get:function(){return c},set:function(t){c=!!t}})),Object.defineProperty(s,"startTime",i({},u,{get:function(){return f},set:function(t){if("number"!=typeof t)throw new TypeError("Start time must be set to a number.");f=t,this.hasBeenReset=!0}})),Object.defineProperty(s,"endTime",i({},u,{get:function(){return d},set:function(t){if("number"!=typeof t)throw new TypeError("End time must be set to a number.");d=t,this.hasBeenReset=!0}})),Object.defineProperty(s,"text",i({},u,{get:function(){return h},set:function(t){h=""+t,this.hasBeenReset=!0}})),Object.defineProperty(s,"region",i({},u,{get:function(){return p},set:function(t){p=t,this.hasBeenReset=!0}})),Object.defineProperty(s,"vertical",i({},u,{get:function(){return y},set:function(e){var r=function(e){return n(t,e)}(e);if(!1===r)throw new SyntaxError("An invalid or illegal string was specified.");y=r,this.hasBeenReset=!0}})),Object.defineProperty(s,"snapToLines",i({},u,{get:function(){return v},set:function(t){v=!!t,this.hasBeenReset=!0}})),Object.defineProperty(s,"line",i({},u,{get:function(){return g},set:function(t){if("number"!=typeof t&&"auto"!==t)throw new SyntaxError("An invalid number or illegal string was specified.");g=t,this.hasBeenReset=!0}})),Object.defineProperty(s,"lineAlign",i({},u,{get:function(){return m},set:function(t){var e=r(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");m=e,this.hasBeenReset=!0}})),Object.defineProperty(s,"position",i({},u,{get:function(){return b},set:function(t){if(t<0||t>100)throw new Error("Position must be between 0 and 100.");b=t,this.hasBeenReset=!0}})),Object.defineProperty(s,"positionAlign",i({},u,{get:function(){return E},set:function(t){var e=r(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");E=e,this.hasBeenReset=!0}})),Object.defineProperty(s,"size",i({},u,{get:function(){return _},set:function(t){if(t<0||t>100)throw new Error("Size must be between 0 and 100.");_=t,this.hasBeenReset=!0}})),Object.defineProperty(s,"align",i({},u,{get:function(){return T},set:function(t){var e=r(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");T=e,this.hasBeenReset=!0}})),s.displayState=void 0}return o.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},o}()},"./src/utils/vttparser.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"parseTimeStamp",(function(){return o})),n.d(e,"fixLineBreaks",(function(){return f})),n.d(e,"VTTParser",(function(){return d}));var r=n("./src/utils/vttcue.ts"),i=function(){function t(){}return t.prototype.decode=function(t,e){if(!t)return"";if("string"!=typeof t)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))},t}();function o(t){function e(t,e,n,r){return 3600*(0|t)+60*(0|e)+(0|n)+parseFloat(r||0)}var n=t.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return n?parseFloat(n[2])>59?e(n[2],n[3],0,n[4]):e(n[1],n[2],n[3],n[4]):null}var a=function(){function t(){this.values=Object.create(null)}var e=t.prototype;return e.set=function(t,e){this.get(t)||""===e||(this.values[t]=e)},e.get=function(t,e,n){return n?this.has(t)?this.values[t]:e[n]:this.has(t)?this.values[t]:e},e.has=function(t){return t in this.values},e.alt=function(t,e,n){for(var r=0;r<n.length;++r)if(e===n[r]){this.set(t,e);break}},e.integer=function(t,e){/^-?\d+$/.test(e)&&this.set(t,parseInt(e,10))},e.percent=function(t,e){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(e)){var n=parseFloat(e);if(n>=0&&n<=100)return this.set(t,n),!0}return!1},t}();function s(t,e,n,r){var i=r?t.split(r):[t];for(var o in i)if("string"==typeof i[o]){var a=i[o].split(n);2===a.length&&e(a[0],a[1])}}var u=new r.default(0,0,""),l="middle"===u.align?"middle":"center";function c(t,e,n){var r=t;function i(){var e=o(t);if(null===e)throw new Error("Malformed timestamp: "+r);return t=t.replace(/^[^\sa-zA-Z-]+/,""),e}function c(){t=t.replace(/^\s+/,"")}if(c(),e.startTime=i(),c(),"--\x3e"!==t.substr(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+r);t=t.substr(3),c(),e.endTime=i(),c(),function(t,e){var r=new a;s(t,(function(t,e){var i;switch(t){case"region":for(var o=n.length-1;o>=0;o--)if(n[o].id===e){r.set(t,n[o].region);break}break;case"vertical":r.alt(t,e,["rl","lr"]);break;case"line":i=e.split(","),r.integer(t,i[0]),r.percent(t,i[0])&&r.set("snapToLines",!1),r.alt(t,i[0],["auto"]),2===i.length&&r.alt("lineAlign",i[1],["start",l,"end"]);break;case"position":i=e.split(","),r.percent(t,i[0]),2===i.length&&r.alt("positionAlign",i[1],["start",l,"end","line-left","line-right","auto"]);break;case"size":r.percent(t,e);break;case"align":r.alt(t,e,["start",l,"end","left","right"])}}),/:/,/\s/),e.region=r.get("region",null),e.vertical=r.get("vertical","");var i=r.get("line","auto");"auto"===i&&-1===u.line&&(i=-1),e.line=i,e.lineAlign=r.get("lineAlign","start"),e.snapToLines=r.get("snapToLines",!0),e.size=r.get("size",100),e.align=r.get("align",l);var o=r.get("position","auto");"auto"===o&&50===u.position&&(o="start"===e.align||"left"===e.align?0:"end"===e.align||"right"===e.align?100:50),e.position=o}(t,e)}function f(t){return t.replace(/<br(?: \/)?>/gi,"\n")}var d=function(){function t(){this.state="INITIAL",this.buffer="",this.decoder=new i,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var e=t.prototype;return e.parse=function(t){var e=this;function n(){var t=e.buffer,n=0;for(t=f(t);n<t.length&&"\r"!==t[n]&&"\n"!==t[n];)++n;var r=t.substr(0,n);return"\r"===t[n]&&++n,"\n"===t[n]&&++n,e.buffer=t.substr(n),r}t&&(e.buffer+=e.decoder.decode(t,{stream:!0}));try{var i="";if("INITIAL"===e.state){if(!/\r\n|\n/.test(e.buffer))return this;var o=(i=n()).match(/^()?WEBVTT([ \t].*)?$/);if(!o||!o[0])throw new Error("Malformed WebVTT signature.");e.state="HEADER"}for(var a=!1;e.buffer;){if(!/\r\n|\n/.test(e.buffer))return this;switch(a?a=!1:i=n(),e.state){case"HEADER":/:/.test(i)?s(i,(function(t,e){}),/:/):i||(e.state="ID");continue;case"NOTE":i||(e.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(i)){e.state="NOTE";break}if(!i)continue;if(e.cue=new r.default(0,0,""),e.state="CUE",-1===i.indexOf("--\x3e")){e.cue.id=i;continue}case"CUE":if(!e.cue){e.state="BADCUE";continue}try{c(i,e.cue,e.regionList)}catch(t){e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":var u=-1!==i.indexOf("--\x3e");if(!i||u&&(a=!0)){e.oncue&&e.cue&&e.oncue(e.cue),e.cue=null,e.state="ID";continue}if(null===e.cue)continue;e.cue.text&&(e.cue.text+="\n"),e.cue.text+=i;continue;case"BADCUE":i||(e.state="ID")}}}catch(t){"CUETEXT"===e.state&&e.cue&&e.oncue&&e.oncue(e.cue),e.cue=null,e.state="INITIAL"===e.state?"BADWEBVTT":"BADCUE"}return this},e.flush=function(){try{if((this.cue||"HEADER"===this.state)&&(this.buffer+="\n\n",this.parse()),"INITIAL"===this.state||"BADWEBVTT"===this.state)throw new Error("Malformed WebVTT signature.")}catch(t){this.onparsingerror&&this.onparsingerror(t)}return this.onflush&&this.onflush(),this},t}()},"./src/utils/webvtt-parser.ts":function(t,e,n){"use strict";n.r(e),n.d(e,"generateCueId",(function(){return f})),n.d(e,"parseWebVTT",(function(){return d}));var r=n("./src/polyfills/number.ts"),i=n("./src/utils/vttparser.ts"),o=n("./src/demux/id3.ts"),a=n("./src/utils/timescale-conversion.ts"),s=n("./src/remux/mp4-remuxer.ts"),u=/\r\n|\n\r|\n|\r/g,l=function(t,e,n){return void 0===n&&(n=0),t.substr(n,e.length)===e},c=function(t){for(var e=5381,n=t.length;n;)e=33*e^t.charCodeAt(--n);return(e>>>0).toString()};function f(t,e,n){return c(t.toString())+c(e.toString())+c(n)}function d(t,e,n,c,d,h,p,y){var v,g=new i.VTTParser,m=Object(o.utf8ArrayToStr)(new Uint8Array(t)).trim().replace(u,"\n").split("\n"),b=[],E=Object(a.toMpegTsClockFromTimescale)(e,n),_="00:00.000",T=0,k=0,A=!0,S=!1;g.oncue=function(t){var e=c[d],n=c.ccOffset,r=(T-E)/9e4;if(null!=e&&e.new&&(void 0!==k?n=c.ccOffset=e.start:function(t,e,n){var r=t[e],i=t[r.prevCC];if(!i||!i.new&&r.new)return t.ccOffset=t.presentationOffset=r.start,void(r.new=!1);for(;null!==(o=i)&&void 0!==o&&o.new;){var o;t.ccOffset+=r.start-i.start,r.new=!1,i=t[(r=i).prevCC]}t.presentationOffset=n}(c,d,r)),r&&(n=r-c.presentationOffset),S){var i=t.endTime-t.startTime,o=Object(s.normalizePts)(9e4*(t.startTime+n-k),9e4*h)/9e4;t.startTime=o,t.endTime=o+i}var a=t.text.trim();t.text=decodeURIComponent(encodeURIComponent(a)),t.id||(t.id=f(t.startTime,t.endTime,a)),t.endTime>0&&b.push(t)},g.onparsingerror=function(t){v=t},g.onflush=function(){v?y(v):p(b)},m.forEach((function(t){if(A){if(l(t,"X-TIMESTAMP-MAP=")){A=!1,S=!0,t.substr(16).split(",").forEach((function(t){l(t,"LOCAL:")?_=t.substr(6):l(t,"MPEGTS:")&&(T=parseInt(t.substr(7)))}));try{k=function(t){var e=parseInt(t.substr(-3)),n=parseInt(t.substr(-6,2)),i=parseInt(t.substr(-9,2)),o=t.length>9?parseInt(t.substr(0,t.indexOf(":"))):0;if(!(Object(r.isFiniteNumber)(e)&&Object(r.isFiniteNumber)(n)&&Object(r.isFiniteNumber)(i)&&Object(r.isFiniteNumber)(o)))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+t);return e+=1e3*n,e+=6e4*i,e+=36e5*o}(_)/1e3}catch(t){S=!1,v=t}return}""===t&&(A=!1)}g.parse(t+"\n")})),g.flush()}},"./src/utils/xhr-loader.ts":function(t,e,n){"use strict";n.r(e);var r=n("./src/utils/logger.ts"),i=n("./src/loader/load-stats.ts"),o=/^age:\s*[\d.]+\s*$/m,a=function(){function t(t){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=t?t.xhrSetup:null,this.stats=new i.LoadStats,this.retryDelay=0}var e=t.prototype;return e.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},e.abortInternal=function(){var t=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),t&&(t.onreadystatechange=null,t.onprogress=null,4!==t.readyState&&(this.stats.aborted=!0,t.abort()))},e.abort=function(){var t;this.abortInternal(),null!==(t=this.callbacks)&&void 0!==t&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},e.load=function(t,e,n){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=t,this.config=e,this.callbacks=n,this.retryDelay=e.retryDelay,this.loadInternal()},e.loadInternal=function(){var t=this.config,e=this.context;if(t){var n=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0;var i=this.xhrSetup;try{if(i)try{i(n,e.url)}catch(t){n.open("GET",e.url,!0),i(n,e.url)}n.readyState||n.open("GET",e.url,!0);var o=this.context.headers;if(o)for(var a in o)n.setRequestHeader(a,o[a])}catch(t){return void this.callbacks.onError({code:n.status,text:t.message},e,n)}e.rangeEnd&&n.setRequestHeader("Range","bytes="+e.rangeStart+"-"+(e.rangeEnd-1)),n.onreadystatechange=this.readystatechange.bind(this),n.onprogress=this.loadprogress.bind(this),n.responseType=e.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),t.timeout),n.send()}},e.readystatechange=function(){var t=this.context,e=this.loader,n=this.stats;if(t&&e){var i=e.readyState,o=this.config;if(!n.aborted&&i>=2)if(self.clearTimeout(this.requestTimeout),0===n.loading.first&&(n.loading.first=Math.max(self.performance.now(),n.loading.start)),4===i){e.onreadystatechange=null,e.onprogress=null;var a=e.status;if(a>=200&&a<300){var s,u;if(n.loading.end=Math.max(self.performance.now(),n.loading.first),u="arraybuffer"===t.responseType?(s=e.response).byteLength:(s=e.responseText).length,n.loaded=n.total=u,!this.callbacks)return;var l=this.callbacks.onProgress;if(l&&l(n,t,s,e),!this.callbacks)return;var c={url:e.responseURL,data:s};this.callbacks.onSuccess(c,n,t,e)}else n.retry>=o.maxRetry||a>=400&&a<499?(r.logger.error(a+" while loading "+t.url),this.callbacks.onError({code:a,text:e.statusText},t,e)):(r.logger.warn(a+" while loading "+t.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,o.maxRetryDelay),n.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),o.timeout)}},e.loadtimeout=function(){r.logger.warn("timeout while loading "+this.context.url);var t=this.callbacks;t&&(this.abortInternal(),t.onTimeout(this.stats,this.context,this.loader))},e.loadprogress=function(t){var e=this.stats;e.loaded=t.loaded,t.lengthComputable&&(e.total=t.total)},e.getCacheAge=function(){var t=null;if(this.loader&&o.test(this.loader.getAllResponseHeaders())){var e=this.loader.getResponseHeader("age");t=e?parseFloat(e):null}return t},t}();e.default=a}
vendor: 13,006 bytes, line 1
1}).default},t.exports=r())},function(t,e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var r,i=function(){function t(t){return null==t?String(t):z[W.call(t)]||"object"}function e(e){return"function"==t(e)}function r(t){return null!=t&&t==t.window}function i(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}function o(e){return"object"==t(e)}function a(t){return o(t)&&!r(t)&&Object.getPrototypeOf(t)==Object.prototype}function s(t){return"number"==typeof t.length}function u(t){return t.length>0?k.fn.concat.apply([],t):t}function l(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function c(t){return t in I?I[t]:I[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function f(t,e){return"number"!=typeof e||x[l(t)]?e:e+"px"}function d(t){return"children"in t?R.call(t.children):k.map(t.childNodes,(function(t){return 1==t.nodeType?t:void 0}))}function h(t,e){var n,r=t?t.length:0;for(n=0;r>n;n++)this[n]=t[n];this.length=r,this.selector=e||""}function p(t,e,n){for(T in e)n&&(a(e[T])||Q(e[T]))?(a(e[T])&&!a(t[T])&&(t[T]={}),Q(e[T])&&!Q(t[T])&&(t[T]=[]),p(t[T],e[T],n)):e[T]!==_&&(t[T]=e[T])}function y(t,e){return null==e?k(t):k(t).filter(e)}function v(t,n,r,i){return e(n)?n.call(t,r,i):n}function g(t,e,n){null==n?t.removeAttribute(e):t.setAttribute(e,n)}function m(t,e){var n=t.className||"",r=n&&n.baseVal!==_;return e===_?r?n.baseVal:n:void(r?n.baseVal=e:t.className=e)}function b(t){try{return t?"true"==t||"false"!=t&&("null"==t?null:+t+""==t?+t:/^[\[\{]/.test(t)?k.parseJSON(t):t):t}catch(e){return t}}function E(t,e){e(t);for(var n=0,r=t.childNodes.length;r>n;n++)E(t.childNodes[n],e)}var _,T,k,A,S,w,P=[],L=P.concat,O=P.filter,R=P.slice,C=window.document,D={},I={},x={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},M=/^\s*<(\w+|!)[^>]*>/,F=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,N=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,B=/^(?:body|html)$/i,j=/([A-Z])/g,U=["val","css","html","text","data","width","height","offset"],H=C.createElement("table"),G=C.createElement("tr"),V={tr:C.createElement("tbody"),tbody:H,thead:H,tfoot:H,td:G,th:G,"*":C.createElement("div")},Y=/complete|loaded|interactive/,K=/^[\w-]*$/,z={},W=z.toString,q={},X=C.createElement("div"),$={tabindex:"tabIndex",readonly:"readOnly",for:"htmlFor",class:"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},Q=Array.isArray||function(t){return t instanceof Array};return q.matches=function(t,e){if(!e||!t||1!==t.nodeType)return!1;var n=t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector;if(n)return n.call(t,e);var r,i=t.parentNode,o=!i;return o&&(i=X).appendChild(t),r=~q.qsa(i,e).indexOf(t),o&&X.removeChild(t),r},S=function(t){return t.replace(/-+(.)?/g,(function(t,e){return e?e.toUpperCase():""}))},w=function(t){return O.call(t,(function(e,n){return t.indexOf(e)==n}))},q.fragment=function(t,e,n){var r,i,o;return F.test(t)&&(r=k(C.createElement(RegExp.$1))),r||(t.replace&&(t=t.replace(N,"<$1></$2>")),e===_&&(e=M.test(t)&&RegExp.$1),e in V||(e="*"),(o=V[e]).innerHTML=""+t,r=k.each(R.call(o.childNodes),(function(){o.removeChild(this)}))),a(n)&&(i=k(r),k.each(n,(function(t,e){U.indexOf(t)>-1?i[t](e):i.attr(t,e)}))),r},q.Z=function(t,e){return new h(t,e)},q.isZ=function(t){return t instanceof q.Z},q.init=function(t,n){var r;if(!t)return q.Z();if("string"==typeof t)if("<"==(t=t.trim())[0]&&M.test(t))r=q.fragment(t,RegExp.$1,n),t=null;else{if(n!==_)return k(n).find(t);r=q.qsa(C,t)}else{if(e(t))return k(C).ready(t);if(q.isZ(t))return t;if(Q(t))r=function(t){return O.call(t,(function(t){return null!=t}))}(t);else if(o(t))r=[t],t=null;else if(M.test(t))r=q.fragment(t.trim(),RegExp.$1,n),t=null;else{if(n!==_)return k(n).find(t);r=q.qsa(C,t)}}return q.Z(r,t)},(k=function(t,e){return q.init(t,e)}).extend=function(t){var e,n=R.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach((function(n){p(t,n,e)})),t},q.qsa=function(t,e){var n,r="#"==e[0],i=!r&&"."==e[0],o=r||i?e.slice(1):e,a=K.test(o);return t.getElementById&&a&&r?(n=t.getElementById(o))?[n]:[]:1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType?[]:R.call(a&&!r&&t.getElementsByClassName?i?t.getElementsByClassName(o):t.getElementsByTagName(e):t.querySelectorAll(e))},k.contains=C.documentElement.contains?function(t,e){return t!==e&&t.contains(e)}:function(t,e){for(;e&&(e=e.parentNode);)if(e===t)return!0;return!1},k.type=t,k.isFunction=e,k.isWindow=r,k.isArray=Q,k.isPlainObject=a,k.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},k.inArray=function(t,e,n){return P.indexOf.call(e,t,n)},k.camelCase=S,k.trim=function(t){return null==t?"":String.prototype.trim.call(t)},k.uuid=0,k.support={},k.expr={},k.noop=function(){},k.map=function(t,e){var n,r,i,o=[];if(s(t))for(r=0;r<t.length;r++)null!=(n=e(t[r],r))&&o.push(n);else for(i in t)null!=(n=e(t[i],i))&&o.push(n);return u(o)},k.each=function(t,e){var n,r;if(s(t)){for(n=0;n<t.length;n++)if(!1===e.call(t[n],n,t[n]))return t}else for(r in t)if(!1===e.call(t[r],r,t[r]))return t;return t},k.grep=function(t,e){return O.call(t,e)},window.JSON&&(k.parseJSON=JSON.parse),k.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),(function(t,e){z["[object "+e+"]"]=e.toLowerCase()})),k.fn={constructor:q.Z,length:0,forEach:P.forEach,reduce:P.reduce,push:P.push,sort:P.sort,splice:P.splice,indexOf:P.indexOf,concat:function(){var t,e,n=[];for(t=0;t<arguments.length;t++)e=arguments[t],n[t]=q.isZ(e)?e.toArray():e;return L.apply(q.isZ(this)?this.toArray():this,n)},map:function(t){return k(k.map(this,(function(e,n){return t.call(e,n,e)})))},slice:function(){return k(R.apply(this,arguments))},ready:function(t){return Y.test(C.readyState)&&C.body?t(k):C.addEventListener("DOMContentLoaded",(function(){t(k)}),!1),this},get:function(t){return t===_?R.call(this):this[t>=0?t:t+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each((function(){null!=this.parentNode&&this.parentNode.removeChild(this)}))},each:function(t){return P.every.call(this,(function(e,n){return!1!==t.call(e,n,e)})),this},filter:function(t){return e(t)?this.not(this.not(t)):k(O.call(this,(function(e){return q.matches(e,t)})))},add:function(t,e){return k(w(this.concat(k(t,e))))},is:function(t){return this.length>0&&q.matches(this[0],t)},not:function(t){var n=[];if(e(t)&&t.call!==_)this.each((function(e){t.call(this,e)||n.push(this)}));else{var r="string"==typeof t?this.filter(t):s(t)&&e(t.item)?R.call(t):k(t);this.forEach((function(t){r.indexOf(t)<0&&n.push(t)}))}return k(n)},has:function(t){return this.filter((function(){return o(t)?k.contains(this,t):k(this).find(t).size()}))},eq:function(t){return-1===t?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!o(t)?t:k(t)},last:function(){var t=this[this.length-1];return t&&!o(t)?t:k(t)},find:function(t){var e=this;return t?"object"==n(t)?k(t).filter((function(){var t=this;return P.some.call(e,(function(e){return k.contains(e,t)}))})):1==this.length?k(q.qsa(this[0],t)):this.map((function(){return q.qsa(this,t)})):k()},closest:function(t,e){var r=this[0],o=!1;for("object"==n(t)&&(o=k(t));r&&!(o?o.indexOf(r)>=0:q.matches(r,t));)r=r!==e&&!i(r)&&r.parentNode;return k(r)},parents:function(t){for(var e=[],n=this;n.length>0;)n=k.map(n,(function(t){return(t=t.parentNode)&&!i(t)&&e.indexOf(t)<0?(e.push(t),t):void 0}));return y(e,t)},parent:function(t){return y(w(this.pluck("parentNode")),t)},children:function(t){return y(this.map((function(){return d(this)})),t)},contents:function(){return this.map((function(){return this.contentDocument||R.call(this.childNodes)}))},siblings:function(t){return y(this.map((function(t,e){return O.call(d(e.parentNode),(function(t){return t!==e}))})),t)},empty:function(){return this.each((function(){this.innerHTML=""}))},pluck:function(t){return k.map(this,(function(e){return e[t]}))},show:function(){return this.each((function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=function(t){var e,n;return D[t]||(e=C.createElement(t),C.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),D[t]=n),D[t]}(this.nodeName))}))},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var n=e(t);if(this[0]&&!n)var r=k(t).get(0),i=r.parentNode||this.length>1;return this.each((function(e){k(this).wrapAll(n?t.call(this,e):i?r.cloneNode(!0):r)}))},wrapAll:function(t){if(this[0]){k(this[0]).before(t=k(t));for(var e;(e=t.children()).length;)t=e.first();k(t).append(this)}return this},wrapInner:function(t){var n=e(t);return this.each((function(e){var r=k(this),i=r.contents(),o=n?t.call(this,e):t;i.length?i.wrapAll(o):r.append(o)}))},unwrap:function(){return this.parent().each((function(){k(this).replaceWith(k(this).children())})),this},clone:function(){return this.map((function(){return this.cloneNode(!0)}))},hide:function(){return this.css("display","none")},toggle:function(t){return this.each((function(){var e=k(this);(t===_?"none"==e.css("display"):t)?e.show():e.hide()}))},prev:function(t){return k(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return k(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0 in arguments?this.each((function(e){var n=this.innerHTML;k(this).empty().append(v(this,t,e,n))})):0 in this?this[0].innerHTML:null},text:function(t){return 0 in arguments?this.each((function(e){var n=v(this,t,e,this.textContent);this.textContent=null==n?"":""+n})):0 in this?this[0].textContent:null},attr:function(t,e){var n;return"string"!=typeof t||1 in arguments?this.each((function(n){if(1===this.nodeType)if(o(t))for(T in t)g(this,T,t[T]);else g(this,t,v(this,e,n,this.getAttribute(t)))})):this.length&&1===this[0].nodeType?!(n=this[0].getAttribute(t))&&t in this[0]?this[0][t]:n:_},removeAttr:function(t){return this.each((function(){1===this.nodeType&&t.split(" ").forEach((function(t){g(this,t)}),this)}))},prop:function(t,e){return t=$[t]||t,1 in arguments?this.each((function(n){this[t]=v(this,e,n,this[t])})):this[0]&&this[0][t]},data:function(t,e){var n="data-"+t.replace(j,"-$1").toLowerCase(),r=1 in arguments?this.attr(n,e):this.attr(n);return null!==r?b(r):_},val:function(t){return 0 in arguments?this.each((function(e){this.value=v(this,t,e,this.value)})):this[0]&&(this[0].multiple?k(this[0]).find("option").filter((function(){return this.selected})).pluck("value"):this[0].value)},offset:function(t){if(t)return this.each((function(e){var n=k(this),r=v(this,t,e,n.offset()),i=n.offsetParent().offset(),o={top:r.top-i.top,left:r.left-i.left};"static"==n.css("position")&&(o.position="relative"),n.css(o)}));if(!this.length)return null;if(!k.contains(C.documentElement,this[0]))return{top:0,left:0};var e=this[0].getBoundingClientRect();return{left:e.left+window.pageXOffset,top:e.top+window.pageYOffset,width:Math.round(e.width),height:Math.round(e.height)}},css:function(e,n){if(arguments.length<2){var r,i=this[0];if(!i)return;if(r=getComputedStyle(i,""),"string"==typeof e)return i.style[S(e)]||r.getPropertyValue(e);if(Q(e)){var o={};return k.each(e,(function(t,e){o[e]=i.style[S(e)]||r.getPropertyValue(e)})),o}}var a="";if("string"==t(e))n||0===n?a=l(e)+":"+f(e,n):this.each((function(){this.style.removeProperty(l(e))}));else for(T in e)e[T]||0===e[T]?a+=l(T)+":"+f(T,e[T])+";":this.each((function(){this.style.removeProperty(l(T))}));return this.each((function(){this.style.cssText+=";"+a}))},index:function(t){return t?this.indexOf(k(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return!!t&&P.some.call(this,(function(t){return this.test(m(t))}),c(t))},addClass:function(t){return t?this.each((function(e){if("className"in this){A=[];var n=m(this);v(this,t,e,n).split(/\s+/g).forEach((function(t){k(this).hasClass(t)||A.push(t)}),this),A.length&&m(this,n+(n?" ":"")+A.join(" "))}})):this},removeClass:function(t){return this.each((function(e){if("className"in this){if(t===_)return m(this,"");A=m(this),v(this,t,e,A).split(/\s+/g).forEach((function(t){A=A.replace(c(t)," ")})),m(this,A.trim())}}))},toggleClass:function(t,e){return t?this.each((function(n){var r=k(this);v(this,t,n,m(this)).split(/\s+/g).forEach((function(t){(e===_?!r.hasClass(t):e)?r.addClass(t):r.removeClass(t)}))})):this},scrollTop:function(t){if(this.length){var e="scrollTop"in this[0];return t===_?e?this[0].scrollTop:this[0].pageYOffset:this.each(e?function(){this.scrollTop=t}:function(){this.scrollTo(this.scrollX,t)}
1)}},scrollLeft:function(t){if(this.length){var e="scrollLeft"in this[0];return t===_?e?this[0].scrollLeft:this[0].pageXOffset:this.each(e?function(){this.scrollLeft=t}:function(){this.scrollTo(t,this.scrollY)})}},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),n=this.offset(),r=B.test(e[0].nodeName)?{top:0,left:0}:e.offset();return n.top-=parseFloat(k(t).css("margin-top"))||0,n.left-=parseFloat(k(t).css("margin-left"))||0,r.top+=parseFloat(k(e[0]).css("border-top-width"))||0,r.left+=parseFloat(k(e[0]).css("border-left-width"))||0,{top:n.top-r.top,left:n.left-r.left}}},offsetParent:function(){return this.map((function(){for(var t=this.offsetParent||C.body;t&&!B.test(t.nodeName)&&"static"==k(t).css("position");)t=t.offsetParent;return t}))}},k.fn.detach=k.fn.remove,["width","height"].forEach((function(t){var e=t.replace(/./,(function(t){return t[0].toUpperCase()}));k.fn[t]=function(n){var o,a=this[0];return n===_?r(a)?a["inner"+e]:i(a)?a.documentElement["scroll"+e]:(o=this.offset())&&o[t]:this.each((function(e){(a=k(this)).css(t,v(this,n,e,a[t]()))}))}})),["after","prepend","before","append"].forEach((function(e,n){var r=n%2;k.fn[e]=function(){var e,i,o=k.map(arguments,(function(n){return"object"==(e=t(n))||"array"==e||null==n?n:q.fragment(n)})),a=this.length>1;return o.length<1?this:this.each((function(t,e){i=r?e:e.parentNode,e=0==n?e.nextSibling:1==n?e.firstChild:2==n?e:null;var s=k.contains(C.documentElement,i);o.forEach((function(t){if(a)t=t.cloneNode(!0);else if(!i)return k(t).remove();i.insertBefore(t,e),s&&E(t,(function(t){null==t.nodeName||"SCRIPT"!==t.nodeName.toUpperCase()||t.type&&"text/javascript"!==t.type||t.src||window.eval.call(window,t.innerHTML)}))}))}))},k.fn[r?e+"To":"insert"+(n?"Before":"After")]=function(t){return k(t)[e](this),this}})),q.Z.prototype=h.prototype=k.fn,q.uniq=w,q.deserializeValue=b,k.zepto=q,k}();window.Zepto=i,void 0===window.$&&(window.$=i),function(t){function e(t){return t._zid||(t._zid=f++)}function n(t,n,i,o){if((n=r(n)).ns)var a=function(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$)")}(n.ns);return(y[e(t)]||[]).filter((function(t){return!(!t||n.e&&t.e!=n.e||n.ns&&!a.test(t.ns)||i&&e(t.fn)!==e(i)||o&&t.sel!=o)}))}function r(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function i(t,e){return t.del&&!g&&t.e in m||!!e}function o(t){return b[t]||g&&m[t]||t}function a(n,a,s,l,f,d,h){var p=e(n),v=y[p]||(y[p]=[]);a.split(/\s/).forEach((function(e){if("ready"==e)return t(document).ready(s);var a=r(e);a.fn=s,a.sel=f,a.e in b&&(s=function(e){var n=e.relatedTarget;return!n||n!==this&&!t.contains(this,n)?a.fn.apply(this,arguments):void 0}),a.del=d;var p=d||s;a.proxy=function(t){if(!(t=u(t)).isImmediatePropagationStopped()){t.data=l;var e=p.apply(n,t._args==c?[t]:[t].concat(t._args));return!1===e&&(t.preventDefault(),t.stopPropagation()),e}},a.i=v.length,v.push(a),"addEventListener"in n&&n.addEventListener(o(a.e),a.proxy,i(a,h))}))}function s(t,r,a,s,u){var l=e(t);(r||"").split(/\s/).forEach((function(e){n(t,e,a,s).forEach((function(e){delete y[l][e.i],"removeEventListener"in t&&t.removeEventListener(o(e.e),e.proxy,i(e,u))}))}))}function u(e,n){return(n||!e.isDefaultPrevented)&&(n||(n=e),t.each(k,(function(t,r){var i=n[t];e[t]=function(){return this[r]=E,i&&i.apply(n,arguments)},e[r]=_})),(n.defaultPrevented!==c?n.defaultPrevented:"returnValue"in n?!1===n.returnValue:n.getPreventDefault&&n.getPreventDefault())&&(e.isDefaultPrevented=E)),e}function l(t){var e,n={originalEvent:t};for(e in t)T.test(e)||t[e]===c||(n[e]=t[e]);return u(n,t)}var c,f=1,d=Array.prototype.slice,h=t.isFunction,p=function(t){return"string"==typeof t},y={},v={},g="onfocusin"in window,m={focus:"focusin",blur:"focusout"}
1,b={mouseenter:"mouseover",mouseleave:"mouseout"};v.click=v.mousedown=v.mouseup=v.mousemove="MouseEvents",t.event={add:a,remove:s},t.proxy=function(n,r){var i=2 in arguments&&d.call(arguments,2);if(h(n)){var o=function(){return n.apply(r,i?i.concat(d.call(arguments)):arguments)};return o._zid=e(n),o}if(p(r))return i?(i.unshift(n[r],n),t.proxy.apply(null,i)):t.proxy(n[r],n);throw new TypeError("expected function")},t.fn.bind=function(t,e,n){return this.on(t,e,n)},t.fn.unbind=function(t,e){return this.off(t,e)},t.fn.one=function(t,e,n,r){return this.on(t,e,n,r,1)};var E=function(){return!0},_=function(){return!1},T=/^([A-Z]|returnValue$|layer[XY]$)/,k={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};t.fn.delegate=function(t,e,n){return this.on(e,t,n)},t.fn.undelegate=function(t,e,n){return this.off(e,t,n)},t.fn.live=function(e,n){return t(document.body).delegate(this.selector,e,n),this},t.fn.die=function(e,n){return t(document.body).undelegate(this.selector,e,n),this},t.fn.on=function(e,n,r,i,o){var u,f,y=this;return e&&!p(e)?(t.each(e,(function(t,e){y.on(t,n,r,e,o)})),y):(p(n)||h(i)||!1===i||(i=r,r=n,n=c),(i===c||!1===r)&&(i=r,r=c),!1===i&&(i=_),y.each((function(c,h){o&&(u=function(t){return s(h,t.type,i),i.apply(this,arguments)}),n&&(f=function(e){var r,o=t(e.target).closest(n,h).get(0);return o&&o!==h?(r=t.extend(l(e),{currentTarget:o,liveFired:h}),(u||i).apply(o,[r].concat(d.call(arguments,1)))):void 0}),a(h,e,i,r,n,f||u)})))},t.fn.off=function(e,n,r){var i=this;return e&&!p(e)?(t.each(e,(function(t,e){i.off(t,n,e)})),i):(p(n)||h(r)||!1===r||(r=n,n=c),!1===r&&(r=_),i.each((function(){s(this,e,r,n)})))},t.fn.trigger=function(e,n){return(e=p(e)||t.isPlainObject(e)?t.Event(e):u(e))._args=n,this.each((function(){e.type in m&&"function"==typeof this[e.type]?this[e.type]():"dispatchEvent"in this?this.dispatchEvent(e):t(this).triggerHandler(e,n)}))},t.fn.triggerHandler=function(e,r){var i,o;return this.each((function(a,s){(i=l(p(e)?t.Event(e):e))._args=r,i.target=s,t.each(n(s,e.type||e),(function(t,e){return o=e.proxy(i),!i.isImmediatePropagationStopped()&&void 0}))})),o},"focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach((function(e){t.fn[e]=function(t){return 0 in arguments?this.bind(e,t):this.trigger(e)}})),t.Event=function(t,e){p(t)||(t=(e=t).type);var n=document.createEvent(v[t]||"Events"),r=!0;if(e)for(var i in e)"bubbles"==i?r=!!e[i]:n[i]=e[i];return n.initEvent(t,r,!0),u(n)}}(i),function(t){function e(e,n,r){var i=t.Event(n);return t(e).trigger(i,r),!i.isDefaultPrevented()}function n(t,n,r,i){return t.global?e(n||v,r,i):void 0}function r(e){e.global&&0==t.active++&&n(e,null,"ajaxStart")}function i(e){e.global&&!--t.active&&n(e,null,"ajaxStop")}function o(t,e){var r=e.context;return!1!==e.beforeSend.call(r,t,e)&&!1!==n(e,r,"ajaxBeforeSend",[t,e])&&void n(e,r,"ajaxSend",[t,e])}function a(t,e,r,i){var o=r.context,a="success";r.success.call(o,t,a,e),i&&i.resolveWith(o,[t,a,e]),n(r,o,"ajaxSuccess",[e,r,t]),u(a,e,r)}function s(t,e,r,i,o){var a=i.context;i.error.call(a,r,e,t),o&&o.rejectWith(a,[r,e,t]),n(i,a,"ajaxError",[r,i,t||e]),u(e,r,i)}function u(t,e,r){var o=r.context;r.complete.call(o,e,t),n(r,o,"ajaxComplete",[e,r]),i(r)}function l(){}function c(t){return t&&(t=t.split(";",2)[0]),t&&(t==_?"html":t==E?"json":m.test(t)?"script":b.test(t)&&"xml")||"text"}function f(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}function d(e,n,r,i){return t.isFunction(n)&&(i=r,r=n,n=void 0),t.isFunction(r)||(i=r,r=void 0),{url:e,data:n,success:r,dataType:i}}var h,p,y=0,v=window.document,g=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,m=/^(?:text|application)\/javascript/i,b=/^(?:text|application)\/xml/i,E="application/json",_="text/html",T=/^\s*$/,k=v.createElement("a");k.href=window.location.href,t.active=0,t.ajaxJSONP=function(e,n){if(!("type"in e))return t.ajax(e);var r,i,u=e.jsonpCallback,l=(t.isFunction(u)?u():u)||"jsonp"+ ++y,c=v.createElement("script"),f=window[l],d=function(e){t(c).triggerHandler("error",e||"abort")},h={abort:d};return n&&n.promise(h),t(c).on("load error",(function(o,u){clearTimeout(i),t(c).off().remove(),"error"!=o.type&&r?a(r[0],h,e,n):s(null,u||"error",h,e,n),window[l]=f,r&&t.isFunction(f)&&f(r[0]),f=r=void 0})),!1===o(h,e)?(d("abort"),h):(window[l]=function(){r=arguments},c.src=e.url.replace(/\?(.+)=\?/,"?$1="+l),v.head.appendChild(c),e.timeout>0&&(i=setTimeout((function(){d("timeout")}),e.timeout)),h)},t.ajaxSettings={type:"GET",beforeSend:l,success:l,error:l,complete:l,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:E,xml:"application/xml, text/xml",html:_,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0},t.ajax=function(e){var n,i,u=t.extend({},e||{}),d=t.Deferred&&t.Deferred();for(h in t.ajaxSettings)void 0===u[h]&&(u[h]=t.ajaxSettings[h]);r(u),u.crossDomain||((n=v.createElement("a")).href=u.url,n.href=n.href,u.crossDomain=k.protocol+"//"+k.host!=n.protocol+"//"+n.host),u.url||(u.url=window.location.toString()),(i=u.url.indexOf("#"))>-1&&(u.url=u.url.slice(0,i)),function(e){e.processData&&e.data&&"string"!=t.type(e.data)&&(e.data=t.param(e.data,e.traditional)),!e.data||e.type&&"GET"!=e.type.toUpperCase()||(e.url=f(e.url,e.data),e.data=void 0)}(u);var y=u.dataType,g=/\?.+=\?/.test(u.url);if(g&&(y="jsonp"),!1!==u.cache&&(e&&!0===e.cache||"script"!=y&&"jsonp"!=y)||(u.url=f(u.url,"_="+Date.now())),"jsonp"==y)return g||(u.url=f(u.url,u.jsonp?u.jsonp+"=?":!1===u.jsonp?"":"callback=?")),t.ajaxJSONP(u,d);var m,b=u.accepts[y],E={},_=function(t,e){E[t.toLowerCase()]=[t,e]},A=/^([\w-]+:)\/\//.test(u.url)?RegExp.$1:window.location.protocol,S=u.xhr(
1),w=S.setRequestHeader;if(d&&d.promise(S),u.crossDomain||_("X-Requested-With","XMLHttpRequest"),_("Accept",b||"*/*"),(b=u.mimeType||b)&&(b.indexOf(",")>-1&&(b=b.split(",",2)[0]),S.overrideMimeType&&S.overrideMimeType(b)),(u.contentType||!1!==u.contentType&&u.data&&"GET"!=u.type.toUpperCase())&&_("Content-Type",u.contentType||"application/x-www-form-urlencoded"),u.headers)for(p in u.headers)_(p,u.headers[p]);if(S.setRequestHeader=_,S.onreadystatechange=function(){if(4==S.readyState){S.onreadystatechange=l,clearTimeout(m);var e,n=!1;if(S.status>=200&&S.status<300||304==S.status||0==S.status&&"file:"==A){y=y||c(u.mimeType||S.getResponseHeader("content-type")),e=S.responseText;try{"script"==y?(0,eval)(e):"xml"==y?e=S.responseXML:"json"==y&&(e=T.test(e)?null:t.parseJSON(e))}catch(t){n=t}n?s(n,"parsererror",S,u,d):a(e,S,u,d)}else s(S.statusText||null,S.status?"error":"abort",S,u,d)}},!1===o(S,u))return S.abort(),s(null,"abort",S,u,d),S;if(u.xhrFields)for(p in u.xhrFields)S[p]=u.xhrFields[p];var P=!("async"in u)||u.async;for(p in S.open(u.type,u.url,P,u.username,u.password),E)w.apply(S,E[p]);return u.timeout>0&&(m=setTimeout((function(){S.onreadystatechange=l,S.abort(),s(null,"timeout",S,u,d)}),u.timeout)),S.send(u.data?u.data:null),S},t.get=function(){return t.ajax(d.apply(null,arguments))},t.post=function(){var e=d.apply(null,arguments);return e.type="POST",t.ajax(e)},t.getJSON=function(){var e=d.apply(null,arguments);return e.dataType="json",t.ajax(e)},t.fn.load=function(e,n,r){if(!this.length)return this;var i,o=this,a=e.split(/\s/),s=d(e,n,r),u=s.success;return a.length>1&&(s.url=a[0],i=a[1]),s.success=function(e){o.html(i?t("<div>").html(e.replace(g,"")).find(i):e),u&&u.apply(o,arguments)},t.ajax(s),this};var A=encodeURIComponent;t.param=function(e,n){var r=[];return r.add=function(e,n){t.isFunction(n)&&(n=n()),null==n&&(n=""),this.push(A(e)+"="+A(n))},function e(n,r,i,o){var a,s=t.isArray(r),u=t.isPlainObject(r);t.each(r,(function(r,l){a=t.type(l),o&&(r=i?o:o+"["+(u||"object"==a||"array"==a?r:"")+"]"),!o&&s?n.add(l.name,l.value):"array"==a||!i&&"object"==a?e(n,l,i,r):n.add(r,l)}))}(r,e,n),r.join("&").replace(/%20/g,"+")}}(i),(r=i).Callbacks=function(t){t=r.extend({},t);var e,n,i,o,a,s,u=[],l=!t.once&&[],c=function r(c){for(e=t.memory&&c,n=!0,s=o||0,o=0,a=u.length,i=!0;u&&a>s;++s)if(!1===u[s].apply(c[0],c[1])&&t.stopOnFalse){e=!1;break}i=!1,u&&(l?l.length&&r(l.shift()):e?u.length=0:f.disable())},f={add:function(){if(u){var n=u.length,s=function e(n){r.each(n,(function(n,r){"function"==typeof r?t.unique&&f.has(r)||u.push(r):r&&r.length&&"string"!=typeof r&&e(r)}))};s(arguments),i?a=u.length:e&&(o=n,c(e))}return this},remove:function(){return u&&r.each(arguments,(function(t,e){for(var n;(n=r.inArray(e,u,n))>-1;)u.splice(n,1),i&&(a>=n&&--a,s>=n&&--s)})),this},has:function(t){return!(!u||!(t?r.inArray(t,u)>-1:u.length))},empty:function(){return a=u.length=0,this},disable:function(){return u=l=e=void 0,this},disabled:function(){return!u},lock:function(){return l=void 0,e||f.disable(),this},locked:function(){return!l},fireWith:function(t,e){return!u||n&&!l||(e=[t,(e=e||[]).slice?e.slice():e],i?l.push(e):c(e)),this},fire:function(){return f.fireWith(this,arguments)},fired:function(){return!!n}};return f},function(t){function e(n){var r=[["resolve","done",t.Callbacks({once:1,memory:1}),"resolved"],["reject","fail",t.Callbacks({once:1,memory:1}),"rejected"],["notify","progress",t.Callbacks({memory:1})]],i="pending",o={state:function(){return i},always:function(){return a.done(arguments).fail(arguments),this},then:function(){var n=arguments;return e((function(e){t.each(r,(function(r,i){var s=t.isFunction(n[r])&&n[r];a[i[1]]((function(){var n=s&&s.apply(this,arguments);if(n&&t.isFunction(n.promise))n.promise().done(e.resolve).fail(e.reject).progress(e.notify);else{var r=this===o?e.promise():this,a=s?[n]:arguments;e[i[0]+"With"](r,a)}}))})),n=null})).promise()},promise:function(e){return null!=e?t.extend(e,o):o}},a={};return t.each(r,(function(t,e){var n=e[2],s=e[3];o[e[1]]=n.add,s&&n.add((function(){i=s}),r[1^t][2].disable,r[2][2].lock),a[e[0]]=function(){return a[e[0]+"With"](this===a?o:this,arguments),this},a[e[0]+"With"]=n.fireWith})),o.promise(a),n&&n.call(a,a),a}var n=Array.prototype.slice;t.when=function(r){var i,o,a,s=n.call(arguments),u=s.length,l=0,c=1!==u||r&&t.isFunction(r.promise)?u:0,f=1===c?r:e(),d=function(t,e,r){return function(o){e[t]=this,r[t]=arguments.length>1?n.call(arguments):o,r===i?f.notifyWith(e,r):--c||f.resolveWith(e,r)}};if(u>1)for(i=new Array(u),o=new Array(u),a=new Array(u);u>l;++l)s[l]&&t.isFunction(s[l].promise)?s[l].promise().done(d(l,a,s)).fail(f.reject).progress(d(l,o,i)):--c;return c||f.resolveWith(a,s),f.promise()},t.Deferred=e}(i),function(t){function e(){l=null,f.last&&(f.el.trigger("longTap"),f={})}function n(){l&&clearTimeout(l),l=null}function r(){a&&clearTimeout(a),s&&clearTimeout(s),u&&clearTimeout(u),l&&clearTimeout(l),a=s=u=l=null,f={}}function i(t){return("touch"==t.pointerType||t.pointerType==t.MSPOINTER_TYPE_TOUCH)&&t.isPrimary}function o(t,e){return t.type=="pointer"+e||t.type.toLowerCase()=="mspointer"+e}var a,s,u,l,c,f={};t(document).ready((function(){var d,h,p,y,v=0,g=0;"MSGesture"in window&&((c=new MSGesture).target=document.body),t(document).bind("MSGestureEnd",(function(t){var e=t.velocityX>1?"Right":t.velocityX<-1?"Left":t.velocityY>1?"Down":t.velocityY<-1?"Up":null;e&&(f&&f.el&&f.el.trigger("swipe"),f&&f.el&&f.el.trigger("swipe"+e))})).on("touchstart MSPointerDown pointerdown",(function(n){(!(y=o(n,"down"))||i(n))&&(p=y?n:n.touches[0],n.touches&&1===n.touches.length&&f.x2&&(f.x2=void 0,f.y2=void 0),d=Date.now(),h=d-(f.last||d),f.el=t("tagName"in p.target?p.target:p.target.parentNode),a&&clearTimeout(a),f.x1=p.pageX,f.y1=p.pageY,h>0&&250>=h&&(f.isDoubleTap=!0),f.last=d,l=setTimeout(e,750),c&&y&&c.addPointer(n.pointerId))})).on("touchmove MSPointerMove pointermove",(function(t){(!(y=o(t,"move"))||i(t))&&(p=y?t:t.touches[0],n(),f.x2=p.pageX,f.y2=p.pageY,v+=Math.abs(f.x1-f.x2),g+=Math.abs(f.y1-f.y2))})).on("touchend MSPointerUp pointerup",(function(e){(!(y=o(e,"up"))||i(e))&&(n(),f.x2&&Math.abs(f.x1-f.x2)>30||f.y2&&Math.abs(f.y1-f.y2)>30?u=setTimeout((function(){f&&f.el&&f.el.trigger("swipe"),f&&f.el&&f.el.trigger("swipe"+function(t,e,n,r){return Math.abs(t-e)>=Math.abs(n-r)?t-e>0?"Left":"Right":n-r>0?"Up":"Down"}(f.x1,f.x2,f.y1,f.y2)),f={}}),0):"last"in f&&(30>v&&30>g?s=setTimeout((function(){var e=t.Event("tap");e.cancelTouch=r,f.el&&f.el.trigger(e),f.isDoubleTap?(f.el&&f.el.trigger("doubleTap"),f={}):a=setTimeout((function(){a=null,f.el&&f.el.trigger("singleTap"),f={}}),250)}),0):f={}),v=g=0)})).on("touchcancel MSPointerCancel pointercancel",r),t(window).on("scroll",r)})),["swipe","swipeLeft","swipeRight","swipeUp","swipeDown","doubleTap","tap","singleTap","longTap"].forEach((function(e){t.fn[e]=function(t){return this.on(e,t)}}))}(i),function(t){function e(e){return!(!(e=t(e)).width()&&!e.height())&&"none"!==e.css("display")}function n(t,e){t=t.replace(/=#\]/g,'="#"]');var n,r,i=s.exec(t);if(i&&i[2]in a&&(n=a[i[2]],r=i[3],t=i[1],r)){var o=Number(r);r=isNaN(o)?r.replace(/^["']|["']$/g,""):o}return e(t,n,r)}var r=t.zepto,i=r.qsa,o=r.matches,a=t.expr[":"]={visible:function(){return e(this)?this:void 0},hidden:function(){return e(this)?void 0:this},selected:function(){return this.selected?this:void 0},checked:function(){return this.checked?this:void 0},parent:function(){return this.parentNode},first:function(t){return 0===t?this:void 0},last:function(t,e){return t===e.length-1?this:void 0},eq:function(t,e,n){return t===n?this:void 0},contains:function(e,n,r){return t(this).text().indexOf(r)>-1?this:void 0},has:function(t,e,n){return r.qsa(this,n).length?this:void 0}},s=new RegExp("(.*):(\\w+)(?:\\(([^)]+)\\))?$\\s*"),u=/^\s*>/,l="Zepto"+ +new Date;r.qsa=function(e,o){return n(o,(function(n,a,s){try{var c;!n&&a?n="*":u.test(n)&&(c=t(e).addClass(l),n="."+l+" "+n);var f=i(e,n)}catch(t){throw console.error("error performing selector: %o",o),t}finally{c&&c.removeClass(l)}return a?r.uniq(t.map(f,(function(t,e){return a.call(t,e,f,s)}))):f}))},r.matches=function(t,e){return n(e,(function(e,n,r){return!(e&&!o(t,e)||n&&n.call(t,null,r)!==t)}))}}(i),function(){try{getComputedStyle(void 0)}catch(e){var t=getComputedStyle;window.getComputedStyle=function(e){try{return t(e)}catch(t){return null}}}}(),t.exports=i},function(t,e,n){"use strict";var r=n(6);function i(){}var o={},a=["REJECTED"],s=["FULFILLED"],u=["PENDING"];function l(t){if("function"!=typeof t)throw new TypeError("resolver must be a function");this.state=u,this.queue=[],this.outcome=void 0,t!==i&&h(this,t)}function c(t,e,n){this.promise=t,"function"==typeof e&&(this.onFulfilled=e,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function f(t,e,n){r((function(){var r;try{r=e(n)}catch(e){return o.reject(t,e)}r===t?o.reject(t,new TypeError("Cannot resolve promise with itself")):o.resolve(t,r)}))}function d(t){var e=t&&t.then;if(t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof e)return function(){e.apply(t,arguments)}}function h(t,e){var n=!1;
1function r(e){n||(n=!0,o.reject(t,e))}function i(e){n||(n=!0,o.resolve(t,e))}var a=p((function(){e(i,r)}));"error"===a.status&&r(a.value)}function p(t,e){var n={};try{n.value=t(e),n.status="success"}catch(t){n.status="error",n.value=t}return n}t.exports=l,l.prototype.finally=function(t){if("function"!=typeof t)return this;var e=this.constructor;return this.then((function(n){return e.resolve(t()).then((function(){return n}))}),(function(n){return e.resolve(t()).then((function(){throw n}))}))},l.prototype.catch=function(t){return this.then(null,t)},l.prototype.then=function(t,e){if("function"!=typeof t&&this.state===s||"function"!=typeof e&&this.state===a)return this;var n=new this.constructor(i);this.state!==u?f(n,this.state===s?t:e,this.outcome):this.queue.push(new c(n,t,e));return n},c.prototype.callFulfilled=function(t){o.resolve(this.promise,t)},c.prototype.otherCallFulfilled=function(t){f(this.promise,this.onFulfilled,t)},c.prototype.callRejected=function(t){o.reject(this.promise,t)},c.prototype.otherCallRejected=function(t){f(this.promise,this.onRejected,t)},o.resolve=function(t,e){var n=p(d,e);if("error"===n.status)return o.reject(t,n.value);var r=n.value;if(r)h(t,r);else{t.state=s,t.outcome=e;for(var i=-1,a=t.queue.length;++i<a;)t.queue[i].callFulfilled(e)}return t},o.reject=function(t,e){t.state=a,t.outcome=e;for(var n=-1,r=t.queue.length;++n<r;)t.queue[n].callRejected(e);return t},l.resolve=function(t){if(t instanceof this)return t;return o.resolve(new this(i),t)},l.reject=function(t){var e=new this(i);return o.reject(e,t)},l.all=function(t){var e=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var n=t.length,r=!1;if(!n)return this.resolve([]);var a=new Array(n),s=0,u=-1,l=new this(i);for(;++u<n;)c(t[u],u);return l;function c(t,i){e.resolve(t).then((function(t){a[i]=t,++s!==n||r||(r=!0,o.resolve(l,a))}),(function(t){r||(r=!0,o.reject(l,t))}))}},l.race=function(t){var e=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var n=t.length,r=!1;if(!n)return this.resolve([]);var a=-1,s=new this(i);for(;++a<n;)u=t[a],e.resolve(u).then((function(t){r||(r=!0,o.resolve(s,t))}),(function(t){r||(r=!0,o.reject(s,t))}));var u;return s}},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){window,t.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=20)}([function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=function(t,e){var n=t[1]||"",r=t[3];if(!r)return n;if(e&&"function"==typeof btoa){var i=function(t){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t))))+" */"}(r),o=r.sources.map((function(t){return"/*# sourceURL="+r.sourceRoot+t+" */"}));return[n].concat(o).concat([i]).join("\n")}return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n})).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var r={},i=0;i<this.length;i++){var o=this[i][0];"number"==typeof o&&(r[o]=!0)}for(i=0;i<t.length;i++){var a=t[i];"number"==typeof a[0]&&r[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),e.push(a))}},e}},function(t,e,n){var r={},i=function(t){var e;return function(){return void 0===e&&(e=t.apply(this,arguments)),e}}((function(){return window&&document&&document.all&&!window.atob})),o=function(t){var e={};return function(t,n){if("function"==typeof t)return t();if(void 0===e[t]){var r=function(t,e){return e?e.querySelector(t):document.querySelector(t)}.call(this,t,n);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(t){r=null}e[t]=r}return e[t]}}(),a=null,s=0,u=[],l=n(58);function c(t,e){for(var n=0;n<t.length;n++){var i=t[n],o=r[i.id];if(o){o.refs++;for(var a=0;a<o.parts.length;a++)o.parts[a](i.parts[a]);for(;a<i.parts.length;a++)o.parts.push(v(i.parts[a],e))}else{var s=[];for(a=0;a<i.parts.length;a++)s.push(v(i.parts[a],e));r[i.id]={id:i.id,refs:1,parts:s}}}}function f(t,e){for(var n=[],r={},i=0;i<t.length;
1i++){var o=t[i],a=e.base?o[0]+e.base:o[0],s={css:o[1],media:o[2],sourceMap:o[3]};r[a]?r[a].parts.push(s):n.push(r[a]={id:a,parts:[s]})}return n}function d(t,e){var n=o(t.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var r=u[u.length-1];if("top"===t.insertAt)r?r.nextSibling?n.insertBefore(e,r.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),u.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var i=o(t.insertAt.before,n);n.insertBefore(e,i)}}function h(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=u.indexOf(t);e>=0&&u.splice(e,1)}function p(t){var e=document.createElement("style");if(void 0===t.attrs.type&&(t.attrs.type="text/css"),void 0===t.attrs.nonce){var r=n.nc;r&&(t.attrs.nonce=r)}return y(e,t.attrs),d(t,e),e}function y(t,e){Object.keys(e).forEach((function(n){t.setAttribute(n,e[n])}))}function v(t,e){var n,r,i,o;if(e.transform&&t.css){if(!(o=e.transform(t.css)))return function(){};t.css=o}if(e.singleton){var u=s++;n=a||(a=p(e)),r=m.bind(null,n,u,!1),i=m.bind(null,n,u,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",y(e,t.attrs),d(t,e),e}(e),r=function(t,e,n){var r=n.css,i=n.sourceMap,o=void 0===e.convertToAbsoluteUrls&&i;(e.convertToAbsoluteUrls||o)&&(r=l(r)),i&&(r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */");var a=new Blob([r],{type:"text/css"}),s=t.href;t.href=URL.createObjectURL(a),s&&URL.revokeObjectURL(s)}.bind(null,n,e),i=function(){h(n),n.href&&URL.revokeObjectURL(n.href)}):(n=p(e),r=function(t,e){var n=e.css,r=e.media;if(r&&t.setAttribute("media",r),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}.bind(null,n),i=function(){h(n)});return r(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;r(t=e)}else i()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=i()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=f(t,e);return c(n,e),function(t){for(var i=[],o=0;o<n.length;o++){var a=n[o];(s=r[a.id]).refs--,i.push(s)}for(t&&c(f(t,e),e),o=0;o<i.length;o++){var s;if(0===(s=i[o]).refs){for(var u=0;u<s.parts.length;u++)s.parts[u]();delete r[s.id]}}}};var g=function(){var t=[];return function(e,n){return t[e]=n,t.filter(Boolean).join("\n")}}();function m(t,e,n,r){var i=n?"":r.css;if(t.styleSheet)t.styleSheet.cssText=g(e,i);else{var o=document.createTextNode(i),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(o,a[e]):t.appendChild(o)}}},function(t,e){function n(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}t.exports=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.options=e||{}}return function(t,e,r){e&&n(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1})}(t,[{key:"name",get:function(){return this.constructor.name}},{key:"tagName",get:function(){return this.options.tagName||"div"}},{key:"attributes",get:function(){return{class:this.options.className}}},{key:"attr",value:function(t,e){if(void 0===e)return this.element.getAttribute(t);this.element.setAttribute(t,e)}},{key:"show",value:function(){this.removeClass("ad_runner_ui_hide")}},{key:"hide",value:function(){this.addClass("ad_runner_ui_hide")}},{key:"on",value:function(t,e){this.element.addEventListener(t,e)}},{key:"off",value:function(t,e){this.element.removeEventListener(t,e)}},{key:"html",value:function(t){this.element.innerHTML=t}},{key:"style",value:function(t,e){this.element.style[t]=e}},{key:"appendChild",value:function(t){this.element.appendChild(t.element||t)}},{key:"hasClass",value:function(t){return this.element.classList?this.element.classList.contains(t):new RegExp("(^|\\s)"+t+"($|\\s)").test(this.element.className)}},{key:"addClass",value:function(t){this.element.classList?this.element.classList.add(t):this.hasClass(this.element,t)||(this.element.className=(this.element.className+" "+t).trim())}},{key:"removeClass",value:function(t){this.element.classList?this.element.classList.remove(t):this.element.className=this.element.className.split(/\s+/).filter((function(e){return e!==t})).join(" ")}},{key:"render",value:function(){var t=this;this.element=this.options.element||document.createElement(this.tagName),Object.keys(this.attributes).forEac
1h((function(e){var n=t.attributes[e];void 0!==n&&t.element.setAttribute(e,n)}))}},{key:"remove",value:function(){this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.element=null}}]),t}()},function(t,e,n){var r=n(5).DEFAULT_MAX_VOLUME;function i(t,e){return String(t).toUpperCase().indexOf(String(e).toUpperCase())>-1}function o(){var t={};return t.promise=new Promise((function(e,n){t.resolve=e,t.reject=n})),t}t.exports={contentVolumeToAdVolume:function(t){return t?t/100*r:0},convertToSecond:function(t){var e=isNaN(t)?t.split(":"):t;return 60*+e[0]*60+60*+e[1]+ +e[2]},isImaAd:function(t){return!i(t.system.name,"celtra")&&(i(t.system.name,"google")||i(t.system.version,"google")||i(t.system.name,"gamma"))},isFacebookAd:function(t){return i(t.system.name,"facebook")||i(t.system.version,"facebook")},isAsiaSmartAd:function(t){return t.vastAdTagURI&&i(t.vastAdTagURI,"adnetwork.adasiaholdings.com")||i(t.system.name,"smart")||i(t.system.name,"wootag")},isYomediaAd:function(t){return i(t.system.name,"yomedia")},formatTime:function(t,e){if(!isFinite(t))return"--:--";t*=1e3;var n=(t=parseInt(t/1e3))%60,r=(t=parseInt(t/60))%60,i=(t=parseInt(t/60))%24,o=parseInt(t/24),a="";return o&&o>0&&(a+=o+":",i<1&&(a+="00:")),(i&&i>0||e)&&(a+=("0"+i).slice(-2)+":"),a+=("0"+r).slice(-2)+":",(a+=("0"+n).slice(-2)).trim()},createPromiseDefer:o,createTimeoutPromise:function(t){var e=o(),n=setTimeout(e.resolve,t);return e.promise.cancel=function(){return clearTimeout(n)},e.promise},isMobile:function(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|Windows Phone|IEMobile|Opera Mini/i.test(navigator.userAgent)}}},function(t,e,n){"use strict";var r=["AdLoaded","AdStarted","AdStopped","AdSkipped","AdSkippableStateChange","AdSizeChange","AdLinearChange","AdDurationChange","AdExpandedChange","AdRemainingTimeChange","AdVolumeChange","AdImpression","AdViewableImpression","AdVideoStart","AdVideoFirstQuartile","AdVideoMidpoint","AdVideoThirdQuartile","AdVideoProgress","AdVideoComplete","AdClickThru","AdInteraction","AdUserAcceptInvitation","AdUserMinimize","AdUserClose","AdPaused","AdPlaying","AdLog","AdError","AdClickBackground","AdClickThruVpaid"];r.forEach((function(t){r[t]=t})),Object.freeze(r),t.exports=r},function(t,e){t.exports={AD_POSITION:{preroll:"pre-roll",midroll:"mid-roll",postroll:"post-roll"},AD_DONE_REASON:{timeout:"timeout",error:"error",ended:"ended",skipped:"skipped"},COUNT_DOWN_DURATION:5,PRELOAD_DURATION:7,DEFAULT_MIDROLL_START_TIME:10,DEFAULT_SKIP_TIMEOUT:3,DEFAULT_AD_START_TIMEOUT:10,DEFAULT_NON_LINEAR_DURATION:15,DEFAULT_MAX_VOLUME:.75}},function(t,e){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(t){return"function"==typeof t}function o(t){return"object"===n(t)&&null!==t}function a(t){return void 0===t}r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(t){if(!function(t){return"number"==typeof t}(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},r.prototype.emit=function(t){var e,n,r,s,u,l;if(this._events||(this._events={}),"error"===t&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var c=new Error('Uncaught, unspecified "error" event. ('+e+")");throw c.context=e,c}if(a(n=this._events[t]))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(o(n))for(s=Array.prototype.slice.call(arguments,1),r=(l=n.slice()).length,u=0;u<r;u++)l[u].apply(this,s);return!0},r.prototype.addListener=function(t,e){var n;if(!i(e))throw TypeError("listener must be a function");return this._events||(this._events={}
1),this._events.newListener&&this.emit("newListener",t,i(e.listener)?e.listener:e),this._events[t]?o(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,o(this._events[t])&&!this._events[t].warned&&(n=a(this._maxListeners)?r.defaultMaxListeners:this._maxListeners)&&n>0&&this._events[t].length>n&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){if(!i(e))throw TypeError("listener must be a function");var n=!1;function r(){this.removeListener(t,r),n||(n=!0,e.apply(this,arguments))}return r.listener=e,this.on(t,r),this},r.prototype.removeListener=function(t,e){var n,r,a,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(a=(n=this._events[t]).length,r=-1,n===e||i(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(n)){for(s=a;s-- >0;)if(n[s]===e||n[s].listener&&n[s].listener===e){r=s;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(i(n=this._events[t]))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){return this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},t.exports=r},function(t,e,n){t.exports={VastPlayer:n(22),VAST:n(8),EventEmitter:n(6)}},function(t,e,n){t.exports=n(23)},function(t,e,n){"use strict";var r=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","interruptbegin","interruptend","loadeddata","loadedmetadata","loadstart","mozaudioavailable","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting"];r.forEach((function(t){this[t.toUpperCase()]=t}),r),Object.freeze(r),t.exports=r},function(t,e,n){"use strict";var r=n(15),i=document.createElement("video");n(14),e.isDesktop=!/Android|Silk|Mobile|PlayBook/.test(r.navigator.userAgent),e.canPlay=function(t){switch(i.canPlayType(t)){case"probably":return 2;case"maybe":return 1;default:return 0}},Object.freeze(e)},function(t,e,n){"use strict";function r(t,e,n){e.on(t,(function(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];n.emit.apply(n,[t].concat(e))}))}function i(t,e,n){n.forEach((function(n){e.listeners(n).length>0&&r(n,t,e)})),e.on("newListener",(function(i){n.indexOf(i)>-1&&e.listeners(i).length<1&&r(i,t,e)}))}function o(t){this.events=t.slice(),this.__private__={target:null,source:null}}o.prototype.from=function(t){return this.__private__.source=t,this.__private__.target&&i(t,this.__private__.target,this.events),this},o.prototype.to=function(t){return this.__private__.target=t,this.__private__.source&&i(this.__private__.source,t,this.events),this},t.exports=o},function(t,e){function n(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}t.exports=function(){function t(e,n,r,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.adContainerElement=e,this.videoContent=n,this.logger=r.logger,this.onAdStarted=r.onAdStarted,this.onAdStopped=r.onAdStopped,this.onAdLoaded=r.onAdLoaded,this.options=i,this.logger.debug(this.name,"initializing")}return function(t,e,r){e&&n(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1})}(t,[{key:"selfControl",get:function(){return!1}},{key:"canClickThrough",get:function(){return!1}},{key:"viewDetailLink",get:function(){return""}},{key:"loadAd",value:function(t){throw new Error("this must be overridden")}},{key:"initUserAction",value:function(){throw new Error("this must be overridden")}},{key:"canRun",value:function(t){throw new Error("this must be overridden")}},{key:"start",value:function(){throw new Error("this must be overridden")}},{key:"stop",value:function(){throw new Error("this must be overridden")}},{key:"pause",value:function(){throw new Error("this must be overridden")}},{key:"resume",value:function(){throw new Error("this must be overridden")}},{key:"cancel",value:function(){throw new Error("this must be overridden")}},{key:"viewDetail",value:function(){throw new Error("this must be overridden")}},{key:"setVolume",value:function(t){throw new Error("this must be overridden")}},{key:"setAdData",value:function(t){this.adData=t}},{key:"getVolume",value:function(){throw new Error("this must be overridden")}},{key:"isPaused",value:function(){throw new Error("this must be overridden")}},{key:"getRemainingTime",value:function(){throw new Error("this must be overridden")}},{key:"getDuration",value:function(){throw new Error("this must be overridden")}},{key:"getSkipOffset",value:function(){throw new Error("this must be overridden")}},{key:"resize",value:function(t,e,n){}},{key:"destroy",value:function(){throw new Error("this must be overridden")}}]),t}()},function(t,e,n){"use strict";
1t.exports=function(){return Array.prototype.slice.call(arguments).reduce((function(t,e){return Object.keys(e||{}).reduce((function(t,n){return t[n]=e[n],t}),t)}),{})}},function(t,e){var n={JAVASCRIPT:"application/javascript",FLASH:"application/x-shockwave-flash"};Object.freeze(n),t.exports=n},function(t,e){t.exports=window},function(t,e,n){"use strict";var r=n(40),i=n(9);function o(t,e){var n=this;r.call(this,Math.floor(t.duration||0),e),this.video=t,[i.PLAYING,i.PAUSE,i.TIMEUPDATE].forEach((function(e){return t.addEventListener(e,(function(){return n.tick()}),!1)}))}o.prototype=Object.create(r.prototype),o.prototype._getState=function(){return{playing:!this.video.paused,currentTime:this.video.currentTime}},t.exports=o},function(t,e){t.exports={getVpaidVendor:function(t){return/moatads\.com/.test(t[0].uri)?"MOAT":/yomedia\.vn/.test(t[0].uri)?"YOMEDIA":null},getUrlParam:function(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];e||(e=window.location.href),t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var r="[\\".concat(n?"#":"?","&]").concat(t,"=([^&#]*)"),i=new RegExp(r).exec(e);return null==i?null:decodeURIComponent(i[1])},httpGet:function(t){return new Promise((function(e,n){var r=new XMLHttpRequest;r.open("GET",t,!0),r.withCredentials=!0,r.onreadystatechange=function(){r.readyState===XMLHttpRequest.DONE&&(200===r.status?e(r.responseText):n(new Error("unexpected status code or empty body: ".concat(r.status))))},r.send()}))},isURL:function(t){return!!new RegExp("^(https?:\\/\\/)?","i").test(t)}}},function(t,e,n){function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var i=n(46),o=n(52),a=n(53),s=[i,o,a],u=function(){},l=function(){function t(e){var n=this,r=e.linearAdContainer,i=e.nonLinearAdContainer,o=e.contentPlayer,l=e.logger,c=e.onAdStarted,f=e.onAdStopped,d=e.onAdSkipped,h=e.onAdLoaded,p=e.onResetState,y=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.logger=l,this.props={onAdStarted:c,onAdStopped:f,onAdSkipped:d,onAdLoaded:h||u,onResetState:p||u},this.loadPromise=null,this.currentPlayer=null,this.adData=null,this.adStarted=!1,this.adCancelled=!1,this.adVolume=1,this.lastError=null,this.players=s.map((function(t){return new t(t===a?i:r,o,{logger:l,onAdStarted:n._onAdStarted.bind(n),onAdStopped:n._onAdStopped.bind(n),onAdSkipped:n._onAdSkipped.bind(n),onAdLoaded:n._onAdLoaded.bind(n)},y)}))}return function(t,e,n){e&&r(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1})}(t,[{key:"name",get:function(){return"Player"}},{key:"initUserAction",value:function(){this.players.forEach((function(t){return t.initUserAction()}))}},{key:"load",value:function(t){return this.adData=t,this.adCancelled=!1,this.adStarted=!1,this.lastError=null,this.loadPromise=this._loadAd(),this.loadPromise}},{key:"start",value:function(){this._playAd()}},{key:"stop",value:function(){this.currentPlayer.stop()}},{key:"skip",value:function(){this.currentPlayer.skip()}},{key:"cancel",value:function(){this.adCancelled=!0,this.currentPlayer&&this.currentPlayer.cancel()}},{key:"pause",value:function(){this.currentPlayer.pause()}},{key:"resume",value:function(){this.currentPlayer.resume()}},{key:"destroy",value:function(){this.players.forEach((function(t){return t.destroy()}))}},{key:"resize",value:function(t,e,n){this.players.forEach((function(r){return r.resize(t,e,n)}))}},{key:"setVolume",value:function(t){this.adVolume=t,this.currentPlayer&&this.currentPlayer.setVolume(t)}},{key:"getCurrentPlayer",value:function(){return this.currentPlayer}},{key:"isPlayingLinearAd",value:function(){return this.currentPlayer instanceof i?this.currentPlayer.currentAd&&this.currentPlayer.currentAd.isLinear():!(this.currentPlayer instanceof a)}},{key:"isGoogleNonLinearAd",value:function(){return this.currentPlayer instanceof i&&this.currentPlayer.currentAd&&!this.currentPlayer.currentAd.isLinear()}},{key:"_onAdStarted",value:function(){this.adStarted=!0,this.props.onAdStarted()}},{key:"_onAdStopped",value:function(t,e,n,r){var i=r||this.adData;this.adStarted||n?this.props.onAdStopped(t,e,i):(this.lastError=t,this._playAd(this.adIndex+1))}},{key:"_onAdSkipped",value:function(){this.props.onAdSkipped()}},{key:"_onAdLoaded",value:function(){this.props.onAdLoaded()}},{key:"_loadAd",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(this.logger.debug(this.name,"_loadAd | adIndex",e," | adData",this.adData.ads),this.adCancelled)return Promise.resolve();var n=this.adData.ads[e];if(this.currentPlayer=null,!n)return e>0&&this.logger.debug(this.name,"no ad left to load"),Promise.resolve();this.logger.debug(this.name,"loading ad item ".concat(e+1,"/").concat(this.adData.ads.length),n);var r=this._getPlayerForAd(n);return r?r.loadAd(n,this.adData).then((function(){return t.logger.debug(t.name,"ad loaded"),{player:r,adIndex:e}})).catch((function(n){return t.logger.error(t.name,"error while loading ad, falling back to next item:",n),t._loadAd(e+1)})):(this.logger.debug(this.name,"no player to play this ad, trying next item",n),this._loadAd(e+1))}},{key:"_playAd",value:function(){var t,e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.adCancelled||(this.loadPromise?(t=this.loadPromise,delete this.loadPromise):t=this._loadAd(n),t.then((function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.player,r=t.adIndex;e.adCancelled||(n?(e.adIndex=r,e.currentPlayer=n,n.setAdData(e.adData),n.setVolume(e.adVolume),n.start()):e._onAdStopped(e.lastError||new Error("Cannot run ad"),null,!0))})))}},{key:"_getPlayerForAd",value:function(t){return this.players.filter((function(e){return e.canRun(t)}))[0]}}]),t}();t.exports=l},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}
1function o(t,e){return(o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var s=n(2),u=n(3).formatTime;n(62),t.exports=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e)}(n,s);var e=function(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=a(t);if(e){var o=a(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return function(t,e){if(e&&("object"===r(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,n)}}(n);function n(t){var r;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(r=e.call(this,t)).render(),"string"!=typeof r.options.template)throw new Error("options.template is required");return r}return function(t,e,n){e&&i(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1})}(n,[{key:"attributes",get:function(){return{class:this.options.className||"ad_runner_ui_countdown"}}},{key:"update",value:function(t){this._setRemainingTime(t)}},{key:"_setRemainingTime",value:function(t){var e;e=this.options.formatTime?u(t):Math.round(t),this.element.textContent=this.options.template.replace("%s",e)}}]),n}()},function(t,e,n){t.exports={Runner:n(21),Player:n(18),VAST:n(7).VAST}},function(t,e,n){function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var i=n(7).VAST,o=n(18),a=n(60),s=n(61),u=n(87),l=n(3),c=l.contentVolumeToAdVolume,f=l.convertToSecond,d=l.createPromiseDefer,h=l.createTimeoutPromise,p=n(5),y=p.AD_POSITION,v=p.AD_DONE_REASON,g=p.DEFAULT_AD_START_TIMEOUT,m=p.DEFAULT_MIDROLL_START_TIME,b=1,E=2,_=3,T=4,k={startTimeout:g,skipTimeout:p.DEFAULT_SKIP_TIMEOUT,countdownPlay:!0,defaultMidrollStartTime:m,getPoster:function(){},showSlideBlack:!1,removeAdmarkOnError:!0,autoPlayAdBreaks:!0,autoPlay:!1,mute:!1},A=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.plugin=e,this.options=this._normalizeOption(n);var r=e.getAdContainers(),i=e.getContentPlayer();this.player=new o({linearAdContainer:r.linear,nonLinearAdContainer:r.nonLinear,contentPlayer:i,logger:this.logger,onAdStarted:this._onAdStarted.bind(this),onAdStopped:this._onAdStopped.bind(this),onAdSkipped:this._onAdSkipped.bind(this),onAdLoaded:this._onAdLoaded.bind(this),onResetState:this._onResetState.bind(this)},this.options),this.scheduler=new a({logger:this.logger,prepareAd:this._prepareAd.bind(this),beforePlayAd:this._beforePlayAd.bind(this),preloadAd:this._preloadAd.bind(this),loadAd:this._loadAd.bind(this),playAd:this._playAd.bind(this)}),this.adUi=new s(this.options,r),this.adMark=new u(r.adMark),this.state=b,this.adsLoaded=!1,this.adDeferred=null}return function(t,e,n){e&&r(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1})}(t,[{key:"name",get:function(){return"Runner"}},{key:"logger",get:function(){return this.plugin.getLogger()}},{key:"viewDetailLink",get:function(){var t=this.player.getCurrentPlayer();return t&&t.viewDetailLink}},{key:"onContentProgress",value:function(t){this.scheduler.onContentProgress(t)}},{key:"onContentEnded",value:function(){this.scheduler.onContentEnded(),this.adMark.removeMarkItems()}},{key:"onUserAction",value:function(){this.player.initUserAction()}},{key:"onAdsDataLoaded",value:function(t){var e=this;this.logger.debug(this.name,"onAdsDataLoaded",t),this._normalizeAdsData(t),this.scheduler.populateAdsData(t),this.plugin.getContentMetadata().then((function(t){e.scheduler&&e.scheduler.dataLoadingDeferred.promise.then((function(){e.adMark.render(t.duration,e.scheduler.midrollAds)}))}))}},{key:"destroy",value:function(){this.player.destroy(),this.player=null,this.scheduler
1=null,this.adUi.remove(),this.adMark.remove()}},{key:"resize",value:function(t,e,n){this.player.resize(t,e,n)}},{key:"pauseAd",value:function(){this.player.pause()}},{key:"resumeAd",value:function(){this.player.resume()}},{key:"stopAd",value:function(){this.player.stop()}},{key:"showPosterAndPlayIcon",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=this.adUi.skipButton,n=e.poster,r=e.playIcon;t?(e.loadPoster(),n.show(),r.show()):(n.hide(),r.hide())}},{key:"_onResetState",value:function(){this.state=b,this.adsLoaded=!1}},{key:"_preloadAd",value:function(t){this.adsLoaded||this._loadAd(t)}},{key:"_prepareAd",value:function(t,e){this.options.countdownPlay&&this.adsLoaded&&(this.adUi.countdownToPlay.show(),this.adUi.countdownToPlay.update(e))}},{key:"_beforePlayAd",value:function(t,e){var n=this;this.adUi.countdownToPlay.hide(),t||!this.adsLoaded?setTimeout((function(){n.adsLoaded&&(n.options.showSlideBlack?(n.plugin.pauseForAd(),n.logger.debug(n.name,"Showing black screen"),n.adUi.slideBlack.show(),n.adUi.slideBlack.fadeIn(),setTimeout((function(){e()}),2e3)):e())}),1e3):e()}},{key:"_loadAd",value:function(t){this.state===b&&(this.adsLoaded=!1,this.state=E,this.adDeferred=d(),this.logger.debug(this.name,"loading ad",t),this.player.load(t))}},{key:"_playAd",value:function(t,e){var n=this;return this._loadAd(t),this.logger.debug(this.name,"play ad",t),this.state=_,this.adMetadata=e,this.adUi.onAdWillStart(),this.plugin.onAdWillStart&&this.plugin.onAdWillStart(),this.adTimeoutPromise=h(1e3*this.options.startTimeout),this.adTimeoutPromise.then((function(){n.logger.debug(n.name,"cannot start ad within ".concat(n.options.startTimeout,"s, cancelling...")),n.player&&n.player.cancel(),n._onAdStopped(null,v.timeout,t)})),this.player.setVolume(c(this.plugin.getContentVolume())),this.player.start(),this.adDeferred.promise}},{key:"_onAdStarted",value:function(){var t=this;this._mayPauseContent();var e=this.player.getCurrentPlayer();this.state=T,this.adTimeoutPromise.cancel(),this.adUi.slideBlack.fadeOut(),setTimeout((function(){t.adUi.slideBlack.hide()}),400),this.adUi.setPlayer(e),this.adUi.onAdStarted(this.adMetadata),this.plugin.onAdStarted&&this.plugin.onAdStarted(),this.logger.debug(this.name,"ad started by player:",e.name),this.player.isPlayingLinearAd()||(this.state=b,this.adDeferred.resolve(),this._mayResumeContent())}},{key:"_onAdStopped",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:v.ended,r=arguments.length>2?arguments[2]:void 0;t&&(n=v.error),this.player.isGoogleNonLinearAd()&&this.plugin.hideLinearAdContainer&&this.plugin.hideLinearAdContainer(),(!t||t&&this.options.removeAdmarkOnError)&&r._completeAd&&r._completeAd(),this.state,e.adTimeoutPromise.cancel(),e.adUi.onAdStopped(),e.plugin.onAdStopped&&e.plugin.onAdStopped(n),e._mayResumeContent(),e.logger.debug(e.name,"ad stopped:",n,t||""),e.adUi.slideBlack.hide(),this.state=b,this.adsLoaded=!1,this.adDeferred.resolve()}},{key:"_onAdSkipped",value:function(){this.plugin.onAdSkipped&&this.plugin.onAdSkipped()}},{key:"_onAdLoaded",value:function(){this.adsLoaded=!0}},{key:"_mayPauseContent",value:function(){this.player.isPlayingLinearAd()?this.plugin.pauseForAd():this.player.isGoogleNonLinearAd()&&(this.plugin.showLinearAdContainer&&this.plugin.showLinearAdContainer(),this.adUi.onAdStopped())}},{key:"_mayResumeContent",value:function(){this.adMetadata.order===this.adMetadata.total&&this.plugin.resumeAfterAd()}},{key:"_normalizeAdsData",value:function(t){var e=this;t.forEach((function(t){t.ads=i.pojoFromXML(t.server.tag).ads,delete t.server,Object.assign(t,e._buildAdOption(t))}))}},{key:"_buildAdOption",value:function(t){var e={position:t.position,skipoffset:t.skipoffset?f(t.skipoffset):-1,startTime:t.startTime?f(t.startTime):0};return e.position!==y.midroll||e.startTime||(this.logger.warn(this.name,"no startTime specified on mid-roll ad, will use default startTime:",this.options.defaultMidrollStartTime),e.startTime=this.options.defaultMidrollStartTime),e}},{key:"_normalizeOption",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.assign({},k,t,{getPoster:this.plugin.getPoster&&this.plugin.getPoster.bind(this.plugin)})}}]),t}();t.exports=A},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=n(6),o=n(8),a=n(37),s=n(41),u=n(4),l=n(11),c=n(44),f=n(45),d=n(10),h=n(17);function p(t){return t}function y(){return new Error("VASTPlayer not ready.")}function v(t){return function(){var e=this,n=this.__private__.player;return this.ready?n[t]?n[t].apply(n,arguments).then((function(){return e})):Promise.resolve().then((function(){return e})):Promise.reject(y())}}function g(t){return{get:function(){if(!this.ready)throw y();return this.__private__.player[t]},set:function(e){if(!this.ready)throw y();return this.__private__.player[t]=e}}}function m(t,e){return String(t).toUpperCase().indexOf(String(e).toUpperCase())>-1}function b(t,e){var n=this;i.call(this),this.__private__={container:t,config:function t(){var e,n,i,o,a={},s=arguments.length;for(e=0;e<s;e++)for(i in n=arguments[e]||{})o=n[i],void 0===a[i]&&(a[i]=o),"object"===r(o)&&(a[i]=t(a[i],o));return a}(e,{vast:{resolveWrappers:!0,maxRedirects:5},tracking:{mapper:p},width:480,height:270}),vast:null,ready:!1,player:null,isVPAID:!1,vpaidVendor:null,video:f()};var o=this;this.on(u.AdClickThru,(function(t,e,n){var r=t||o.viewDetailLink;n&&r&&(this.__private__.player.alreadyEmitViewable||(this.__private__.player.alreadyEmitViewable=!0,this.__private__.player.emit(u.AdViewableImpression)),window.open(r));var i=o.vast.get("ads[0].creatives[0].videoClicks.clickTrackings");i&&i.length>0&&i.map((function(t){var e=new XMLHttpRequest;e.open("GET",t,!0),e.send(null)}))}
1)),this.on(u.AdClickBackground,(function(){var t=o.__private__.player;t.video&&d.isDesktop&&(t.video.paused?n.resumeAd():n.pauseAd())}))}n(15).console,b.prototype=Object.create(i.prototype),Object.defineProperties(b.prototype,{container:{get:function(){return this.__private__.container}},config:{get:function(){return this.__private__.config}},vast:{get:function(){return this.__private__.vast}},ready:{get:function(){return this.__private__.ready}},paused:{get:function(){return this.__private__.video.paused}},video:{set:function(t){return this.__private__.video=t}},isVPAID:{get:function(){return this.__private__.isVPAID}},isAsiaSmartAd:{get:function(){return function(t){return t.vastAdTagURI&&m(t.vastAdTagURI,"adnetwork.adasiaholdings.com")||m(t.system.name,"smart")||m(t.system.name,"wootag")}(this.vast.ads[0])}},vpaidVendor:{get:function(){return this.__private__.vpaidVendor}},viewDetailLink:{get:function(){return this.vast&&this.vast.get("ads[0].creatives[0].videoClicks.clickThrough")}},adRemainingTime:g("adRemainingTime"),adDuration:g("adDuration"),adVolume:g("adVolume")}),b.prototype.load=function(t){var e=this,n=this.config.vast;return("string"==typeof t?o.fetch(t,n):new o(t).resolveWrappers()).then((function(t){var n=function(){var n=t.filter("ads[0].creatives[0].mediaFiles",a.canPlayMediaFile),r=t.filter("ads[0].creatives[0].mediaFiles",s.canPlayMediaFile);if(r.length>0)return e.__private__.isVPAID=!1,e.__private__.vpaidVendor=null,{player:new s(e.container,e.__private__.video,e.config),mediaFiles:r};if(n.length>0)return e.__private__.isVPAID=!0,e.__private__.vpaidVendor=h.getVpaidVendor(n),{player:new a(e.container,e.__private__.video,e.config,e),mediaFiles:n};throw new Error("There are no playable <MediaFile>s.")}(),r=n.player,i=n.mediaFiles,o={adParameters:t.get("ads[0].creatives[0].parameters"),progressEvents:t.get("ads[0].creatives[0].trackingEvents").filter((function(t){return"progress"==t.event}))},f=[].concat(t.map("ads[0].impressions",(function(t){return{event:"impression",uri:t.uri}})),t.map("ads[0].viewableImpressions",(function(t){return{event:"viewableImpression",uri:t.uri}})),t.map("ads[0].errors",(function(t){return{event:"error",uri:t}})),t.get("ads[0].creatives[0].trackingEvents"),t.map("ads[0].creatives[0].videoClicks.clickTrackings",(function(t){return{event:"clickThrough",uri:t}}))),d=new l(u),p=new c(f,e.config.tracking.mapper);if(d.from(r).to(e),e.__private__.vast=t,e.__private__.player=r,e.isAsiaSmartAd){var y=t.get("ads[0].creatives[0].duration");y&&(r.adDuration=y)}return r.load(i,o).then((function(){p.track(r)}))})).then((function(){return e.__private__.ready=!0,e.emit("ready"),e})).catch((function(t){throw e.emit("error",t),t}))},b.prototype.startAd=v("startAd"),b.prototype.stopAd=v("stopAd"),b.prototype.skipAd=v("skipAd"),b.prototype.pauseAd=v("pauseAd"),b.prototype.resumeAd=v("resumeAd"),b.prototype.playAd=v("playAd"),b.prototype.init=function(){var t=this.__private__.video,e=this.__private__.container;return t.init(e)},b.vpaidSWFLocation="https://ajax.cdnjs.com/ajax/libs/videojs-vast-vpaid/2.0.2/VPAIDFlash.swf",t.exports=b},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=n(24),o=n(25),a=n(26),s=n(13),u=n(27),l=Array.prototype.push,c=n(28),f={inline:function(t){a({description:null,survey:null},t)},wrapper:function(){}},d={linear:function(t){a({trackingEvents:[],parameters:null,videoClicks:null},t),(t.mediaFiles||[]).forEach((function(t){a({id:null,bitrate:null,scalable:null,maintainAspectRatio:null,apiFramework:null},t)}))},companions:function(t){t.companions.forEach((function(t){a({expandedWidth:null,expandedHeight:null,apiFramework:null,trackingEvents:[],clickThrough:null,altText:null,parameters:null},t)}))},nonLinear:function(t){a({trackingEvents:[]},t),t.ads.forEach((function(t){a({id:null,expandedWidth:null,expandedHeight:null,scalable:null,maintainAspectRatio:null,minSuggestedDuration:null,apiFramework:null,clickThrough:null,parameters:null},t)}))}},h=["ads.celtra.com"];function p(){}function y(t,e){var n=t.indexOf("redirectUrl=");if(n>-1&&h.some((function(e){return t.indexOf(e)>-1}))){var r=t.slice(n+"redirectUrl=".length);return t=t.slice(0,n),i.get(t,e).catch(p).then((function(){return i.get(r,e)}))}return i.get(t,e)}
1function v(t){o(t,this,!0),this.ads.forEach((function(t){a({system:{version:null},errors:[]},t),t.creatives.forEach((function(t){a({id:null,sequence:null,adID:null},t),d[t.type](t)})),f[t.type](t)})),this.__private__={wrappers:[],inlines:[]}}Object.defineProperties(v.prototype,{wrappers:{get:function(){var t=this.__private__.wrappers;return t.length=0,l.apply(t,this.filter("ads",(function(t){return"wrapper"===t.type}))),t}},inlines:{get:function(){var t=this.__private__.inlines;return t.length=0,l.apply(t,this.filter("ads",(function(t){return"inline"===t.type}))),t}}}),v.prototype.get=function(t){return((t||"").match(/[^\[\]\.]+/g)||[]).reduce((function(t,e){return t?t[e]:void 0}),this)},v.prototype.set=function(t,e){var n=function(){for(var e,n=/[^\[\]\.]+/g,r=[];e=n.exec(t);)r.push({token:e[0],type:o(e,e.index+e[0].length)});return r}(),r=n.pop(),i=n.reduce((function(t,e){return t[e.token]||(t[e.token]=new e.type)}),this);function o(t,e){switch(t.input.charAt(e)){case".":return Object;case"[":return Array;case"]":return o(t,e+1);default:return null}}if(!t)throw new Error("prop must be specified.");return i[r.token]=e},v.prototype.map=function(t,e){var n=this.get(t)||[],r=n.length,i=[];if(!(n instanceof Array))return i;for(var o=0;o<r;o++)i.push(e.call(this,n[o],o,n));return i},v.prototype.filter=function(t,e){var n=this.get(t)||[],r=n.length,i=[];if(!(n instanceof Array))return i;for(var o=0;o<r;o++)e.call(this,n[o],o,n)&&i.push(n[o]);return i},v.prototype.find=function(t,e){var n=this.get(t)||[],r=n.length;if(n instanceof Array)for(var i=0;i<r;i++)if(e.call(this,n[i],i,n))return n[i]},v.prototype.toPOJO=function(){var t=JSON.parse(JSON.stringify(this));return delete t.__private__,t},v.prototype.copy=function(){return new this.constructor(this.toPOJO())},v.prototype.resolveWrappers=function(){var t=isNaN(arguments[0])?1/0:arguments[0],e="function"==typeof arguments[0]?arguments[0]:arguments[1],n=this.constructor,r=this;return 0===t?Promise.reject(new Error("Too many redirects were made.")):u(Promise.all(this.map("wrappers",(function(t){return Promise.resolve(y(t.vastAdTagURI,{withCredentials:!0})).then((function(e){return{wrapper:t,response:n.pojoFromXML(e.data).ads}}))}))).then((function(t){var e=t.map((function(t){return t.wrapper})),i=t.map((function(t){return t.response}));return new n(s(r.toPOJO(),{ads:r.map("ads",(function(t){var n=e.indexOf(t),r=e[n],o=i[n];return o?o.map(function(t,e){var n=function(t){return{linear:t.filter(r("linear")),companions:t.filter(r("companions")),nonLinear:t.filter(r("nonLinear"))}}(t.creatives);function r(t){return function(e){return e.type===t}}return a(t.impressions,e.impressions),a(t.viewableImpressions,e.viewableImpressions),a(t.errors,e.errors),e.creatives.forEach((function(t){a(n[t.type].shift()||{},t)})),l.apply(e.creatives,"wrapper"!==e.type?[]:["linear","companions","nonLinear"].reduce((function(t,e){return t.concat(n[e])}),[])),e}.bind(null,r)):[t]})).reduce((function(t,e){return t.concat(e)}))}))})).then((function(e){return e.get("wrappers.length")>0?e.resolveWrappers(t-1):e})),e)},v.prototype.toXML=function(){var t=this.validate();if(!t.valid)throw new Error("VAST is invalid: "+t.reasons.join(", "));return c(this)},v.prototype.validate=function(){var t=this,e=[],n={inline:function(e){var n={linear:function(t){a(t,{exists:["duration"],atLeastOne:["mediaFiles"]})},companions:function(e){t.get(e("companions")).forEach((function(t,n){a((function(t){return e("companions["+n+"]."+t)}),{exists:[],atLeastOne:["resources"]})}))},nonLinear:function(e){t.get(e("ads")).forEach((function(t,n){a((function(t){return e("ads["+n+"]."+t)}),{exists:[],atLeastOne:["resources"]})}))}};a(e,{exists:["title"],atLeastOne:["creatives"]}),t.get(e("creatives")).forEach((function(t,r){function i(t){return e("creatives["+r+"]."+t)}a(i,{exists:["type"],atLeastOne:[]}),(n[t.type]||p)(i)}))},wrapper:function(t){a(t,{exists:["vastAdTagURI"],atLeastOne:[]})}};function r(t,n){t||e.push(n)}function i(e){r(t.get(e),e+" is required")}function o(e){r(t.get(e+".length")>0,e+" must contain at least one value")}function a(t,e){e.exists.map(t).forEach(i),e.atLeastOne.map(t).forEach(o)}return a((function(t){return t}),{exists:[],atLeastOne:["ads"]}),this.get("ads").forEach((function(t,e){function r(t){return"ads["+e+"]."+t}a(r,{exists:["type","system.name"],atLeastOne:["impressions"]}),(n[t.type]||p)(r)})),{valid:0===e.length,reasons:0===e.length?null:e}},v.pojoFromXML=n(31),v.fetch=function(t){var e="object"===r(arguments[1])&&arguments[1]||{},n="function"==typeof arguments[2]?arguments[2]:arguments[1],i=this;return u(Promise.resolve(y(t,{headers:e.headers||{}})).then((function(t){var n=new i(i.pojoFromXML(t.data));return e.resolveWrappers?n.resolveWrappers(e.maxRedirects):n})),n)},t.exports=v},function(t,e){t.exports={get:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.withCredentials,r=e.headers;return new Promise((function(e,i){var o=new XMLHttpRequest;o.open("GET",t),o.withCredentials=Boolean(n),o.onreadystatechange=function(){o.readyState===XMLHttpRequest.DONE&&(200===o.status?e({data:o.responseText}):i(new Error("Unexpected status code:",o.status)))},r&&Object.keys(r).forEach((function(t){o.setRequestHeader(t,r[t])})),o.send()}))}}},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var i=Array.prototype.push;t.exports=function t(e){var n="object"===r(arguments[1])?arguments[1]:null,o="boolean"==typeof arguments[1]?arguments[1]:arguments[2];return Object(e)!==e?e:e instanceof Array?function(e,n,r){var o=n||[];return i.apply(o,r?e.map((function(e){return t(e,null,!0)})):e),o}(e,n,o):function(e,n,r){return Object.keys(e).reduce((function(n,i){return n[i]=r?t(e[i],null,!0):e[i],n}),n||{})}(e,n,o)}},function(t,e,n){"use strict";var r=Array.prototype.push;function i(t){return Object(t)===t}function o(t){return t instanceof Array}t.exports=function t(e,n){return[e,n].every(o)?(r.apply(n,e.filter((function(t){return n.indexOf(t)<0}))),n):Object.keys(e).reduce((function(n,r){return[e[r],n[r]].every(i)&&t(e[r],n[r]),r in n||(n[r]=e[r]),n}),n)}},function(t,e,n){"use strict";
1t.exports=function(t,e){return"function"!=typeof e||t.then((function(t){e(null,t)}),(function(t){e(t)})),t}},function(t,e,n){"use strict";var r=n(29),i=n(30),o={linear:function(t){return{tag:"Linear",children:[{tag:"Duration",value:r(t.duration)},a(t.trackingEvents),u(t)].concat(t.videoClicks?[{tag:"VideoClicks",children:[{tag:"ClickThrough",value:t.videoClicks.clickThrough,cdata:!0}].concat(t.videoClicks.clickTrackings.map((function(t){return{tag:"ClickTracking",value:t,cdata:!0}})),t.videoClicks.customClicks.map((function(t){return{tag:"CustomClick",attributes:{id:t.id},value:t.uri,cdata:!0}})))}]:[],[{tag:"MediaFiles",children:t.mediaFiles.map((function(t){return{tag:"MediaFile",attributes:{id:t.id,width:t.width,height:t.height,bitrate:t.bitrate,type:t.type,delivery:t.delivery,scalable:t.scalable,maintainAspectRatio:t.maintainAspectRatio,apiFramework:t.apiFramework},value:t.uri,cdata:!0}}))}])}},companions:function(t){return{tag:"CompanionAds",children:t.companions.map((function(t){return{tag:"Companion",attributes:{id:t.id,width:t.width,height:t.height,expandedWidth:t.expandedWidth,expandedHeight:t.expandedHeight,apiFramework:t.apiFramework},children:s(t.resources).concat([a(t.trackingEvents),{tag:"CompanionClickThrough",value:t.clickThrough,cdata:!0},{tag:"AltText",value:t.altText},u(t)])}}))}},nonLinear:function(t){return{tag:"NonLinearAds",children:t.ads.map((function(t){return{tag:"NonLinear",attributes:{id:t.id,width:t.width,height:t.height,expandedWidth:t.expandedWidth,expandedHeight:t.expandedHeight,scalable:t.scalable,maintainAspectRatio:t.maintainAspectRatio,minSuggestedDuration:r(t.minSuggestedDuration),apiFramework:t.apiFramework},children:s(t.resources).concat([{tag:"NonLinearClickThrough",value:t.clickThrough,cdata:!0},u(t)])}})).concat([a(t.trackingEvents)])}}};function a(t){return{tag:"TrackingEvents",children:t.map((function(t){return{tag:"Tracking",attributes:{event:t.event},value:t.uri,cdata:!0}}))}}function s(t){return t.map((function(t){return{tag:function(e){switch(t.type){case"static":return"StaticResource";case"iframe":return"IFrameResource";case"html":return"HTMLResource"}}(),attributes:{creativeType:t.creativeType},value:t.data,cdata:!0}}))}function u(t){return{tag:"AdParameters",value:t.parameters}}t.exports=function(t){return i({tag:"VAST",attributes:{version:t.get("version")},children:t.map("ads",(function(t){return{tag:"Ad",attributes:{id:t.id},children:[{tag:function(){switch(t.type){case"inline":return"InLine";case"wrapper":return"Wrapper"}}(),children:[{tag:"AdSystem",attributes:{version:t.system.version},value:t.system.name},{tag:"AdTitle",value:t.title},{tag:"Description",value:t.description},{tag:"Survey",value:t.survey,cdata:!0},{tag:"VASTAdTagURI",value:t.vastAdTagURI,cdata:!0}].concat(t.errors.map((function(t){return{tag:"Error",value:t,cdata:!0}})),t.impressions.map((function(t){return{tag:"Impression",value:t.uri,cdata:!0,attributes:{id:t.id}}})),[{tag:"ViewableImpression",children:t.viewableImpressions.map((function(t){return{tag:"Viewable",value:t.uri,cdata:!0,attributes:{id:t.id}}}))}],[{tag:"Creatives",children:t.creatives.map((function(t){return{tag:"Creative",attributes:{id:t.id,sequence:t.sequence,AdID:t.adID},children:[function(e){return o[e](t)}(t.type)]}})),required:!0}])}]}}))},!0)}},function(t,e,n){"use strict";function r(t){return(t>9?"":"0")+t.toString()}t.exports=function(t){return Number(t)!==t?null:[Math.floor(t/60/60),Math.floor(t/60%60),Math.floor(t%60%60)].map(r).join(":")}},function(t,e,n){"use strict";function r(t){return null!=t}function i(t){return void 0!==t?String(t).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">"):""}function o(t){return t.cdata?function(t){return(void 0!==t?function(t){for(var e,n,r=[],i=/]]>/g,o=0;e=i.exec(t);)n=e.index+2,r.push(e.input.substring(o,n)),o=n;return r.push(t.substring(o,t.length)),r}(String(t)):[""]).reduce((function(t,e){return t+"<![CDATA["+e+"]]>"}),"")}(t.value):i(t.value)}t.exports=function(t,e){return['<?xml version="1.0" encoding="UTF-8"?>'].concat(function t(e,n,a){var s=e.tag,u=e.attributes||{},l=Object.keys(u),c=e.children||[],f=e.value,d=c.length>0,h=l.every((function(t){return r(u[t])}))&&l.length>0,p=r(f)||d||h,y=function(t){for(var e="";t--;)e+=" ";return e}(n),v="<"+s+Object.keys(u).reduce((function(t,e){return a&&!r(u[e])?t:t+" "+e+'="'+i(u[e])+'"'}),"")+">",g="</"+s+">";return!a||p||e.required?d?[y+v].concat(e.children.reduce((function(e,r){return e.concat(t(r,n+4,a))}),[]),[y+g]):[y+v+o(e)+g]:[]}(t,0,e)).join("\n")}},function(t,e,n){"use strict";var r=n(32),i=n(33),o=n(34),a=n(13),s=n(35),u=n(36),l={linear:function(t){var e=f(t.find("Duration")),n=f(t.find("Linear")),r=t.find("Tracking"),a=f(t.find("AdParameters")),s=t.find("VideoClicks")[0],l=t.find("MediaFile");return{type:"linear",skipOffset:n.attributes.skipoffset,duration:i(e.value)||void 0,trackingEvents:r.map((function(t){var e={event:t.attributes.event,uri:t.value};return"progress"===t.attributes.event&&(e.offset=i(t.attributes.offset)),e})),parameters:a.value,videoClicks:s&&function(){var t=f(s.find("ClickThrough")),e=s.find("ClickTracking"),n=s.find("CustomClick");return{clickThrough:t.value,clickTrackings:e.map((function(t){return t.value})),customClicks:n.map((function(t){return{id:t.attributes.id,uri:t.value}}))}}(),mediaFiles:l.map((function(t){var e=t.attributes;return{id:e.id,delivery:e.delivery,type:e.type,uri:t.value,bitrate:u(e.bitrate),width:u(e.width),height:u(e.height),scalable:o(e.scalable),maintainAspectRatio:o(e.maintainAspectRatio),apiFramework:e.apiFramework}}))}},companions:function(t){return{type:"companions",companions:t.find("Companion").map((function(t){var e=t.find("Tracking"),n=f(t.find("CompanionCl
1ickThrough")),r=f(t.find("StaticResource")),i=f(t.find("AltText")),o=f(t.find("AdParameters"));return{id:t.attributes.id,width:u(t.attributes.width),height:u(t.attributes.height),expandedWidth:u(t.attributes.expandedWidth),expandedHeight:u(t.attributes.expandedHeight),apiFramework:t.attributes.apiFramework,resources:function(t){return t.find("URL").map((function(t){return{data:t.value}}))}(t),staticResource:r.value,trackingEvents:e.map((function(t){return{event:t.attributes.event,uri:t.value}})),clickThrough:n.value,altText:i.value,parameters:o.value}}))}},nonLinear:function(t){var e=t.find("NonLinear"),n=t.find("Tracking");return{type:"nonLinear",ads:e.map((function(t){var e=f(t.find("NonLinearClickThrough")),n=f(t.find("StaticResource")),r=f(t.find("AdParameters"));return{id:t.attributes.id,width:t.attributes.width,height:t.attributes.height,expandedWidth:u(t.attributes.expandedWidth),expandedHeight:u(t.attributes.expandedHeight),scalable:o(t.attributes.scalable),maintainAspectRatio:o(t.attributes.maintainAspectRatio),minSuggestedDuration:i(t.attributes.minSuggestedDuration)||void 0,apiFramework:t.attributes.apiFramework,resources:n.value,clickThrough:e.value,parameters:r.value}})),trackingEvents:n.map((function(t){return{event:t.attributes.event,uri:t.value}}))}}},c={inline:function(t){var e=f(t.find("AdTitle")),n=f(t.find("Description")),r=f(t.find("Survey"));return{type:"inline",title:e.value,description:n.value,survey:r.value}},wrapper:function(t){return{type:"wrapper",vastAdTagURI:f(t.find("VASTAdTagURI")).value}}};function f(t){return t[0]||{attributes:{}}}t.exports=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"VAST",n=r(t);if(!n(e)[0])throw new Error("["+t+"] is not a valid VAST document.");return s({version:f(n(e)).attributes.version,ads:n("Ad").map((function(t){var e=f(t.find("Wrapper,InLine")).tag.toLowerCase(),n=f(t.find("AdSystem")),r=f(t.find("AdTitle")),i=f(t.find("Description")),o=t.find("Error"),s=t.find("Impression"),d=t.find("ViewableImpression Viewable"),h=t.find("Creative").filter((function(t){return t.children().length}));return a({id:t.attributes.id,system:{name:n.value,version:n.attributes.version},advertiser:{title:r.value,description:i.value},errors:o.map((function(t){return t.value})),impressions:s.map((function(t){return{uri:t.value,id:t.attributes.id}})),viewableImpressions:d.map((function(t){return{uri:t.value,id:t.attributes.id}})),creatives:h.map((function(t){var e=function(){switch(f(t.find("Linear,CompanionAds,NonLinearAds")).tag){case"Linear":return"linear";case"CompanionAds":return"companions";case"NonLinearAds":return"nonLinear"}}();return a({id:t.attributes.id,sequence:u(t.attributes.sequence),adID:t.attributes.AdID},l[e](t))}))},c[e](t))}))},!0)}},function(t,e,n){"use strict";var r=Array.prototype.map,i=Array.prototype.filter,o=Array.prototype.reduce,a=new DOMParser;function s(t){var e=t.childElementCount>0;return{tag:t.tagName,value:e?null:t.textContent,attributes:o.call(t.attributes,(function(t,e){return t[e.name]=e.value,t}),{}),find:function(e){return u(t.querySelectorAll(e))},children:function(){return i.call(t.childNodes,(function(t){return t instanceof Element})).map(s)}}}function u(t){return r.call(t,s)}t.exports=function(t){var e=a.parseFromString(t,"application/xml");return function(t){return u(e.querySelectorAll(t))}}},function(t,e,n){"use strict";t.exports=function(t){var e=(t||"").match(/^(\d\d):(\d\d):(\d\d)$/);return e&&e.slice(1,4).map(parseFloat).reduce((function(t,e,n){return t+e*Math.pow(60,Math.abs(n-2))}),0)}},function(t,e,n){"use strict";t.exports=function(t){switch((t||"").toLowerCase()){case"true":return!0;case"false":return!1}}},function(t,e,n){"use strict";t.exports=function t(e,n){return Object(e)!==e?e:Object.keys(e).reduce((function(r,i){return n&&e[i]instanceof Array?r[i]=e[i].filter((function(t){return void 0!==t})).map((function(e){return t(e,!0)})):n&&e[i]instanceof Object?r[i]=t(e[i],!0):void 0!==e[i]&&(r[i]=e[i]),r}),{})}},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}t.exports=function(t){if(/string|number|boolean/.test(r(t)))return isNaN(t)?void 0:Number(t)}},function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}
1function o(t,e){return(o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function a(t,e,n,r){return(a="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(t,e,n,r){var i,o=u(t,e);if(o){if((i=Object.getOwnPropertyDescriptor(o,e)).set)return i.set.call(r,n),!0;if(!i.writable)return!1}if(i=Object.getOwnPropertyDescriptor(r,e)){if(!i.writable)return!1;i.value=n,Object.defineProperty(r,e,i)}else!function(t,e,n){e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n}(r,e,n);return!0})(t,e,n,r)}function s(){return(s="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=u(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}}).apply(this,arguments)}function u(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=l(t)););return t}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var c=n(38),f=n(4),d=n(14),h=n(9),p=n(10).isDesktop,y=n(39),v=n(16),g=n(11),m=n(17),b=n(8);function E(t,e,n){return t.addEventListener(e,n,!1)}var _=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e)}(n,c);var e=function(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=l(t);if(e){var o=l(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return function(t,e){if(e&&("object"===r(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,n)}}(n);function n(t,r,i,o){var a;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(a=e.call(this,t)).frame=null,a.video=r,a.config=i,a.parent=o,a}return function(t,e,n){e&&i(t.prototype,e),n&&i(t,n),Object.defineProperty(t,"prototype",{writable:!1})}(n,[{key:"adVolume",get:function(){return s(l(n.prototype),"adVolume",this)},set:function(t){(function(t,e,n,r,i){if(!a(t,e,n,r||t)&&i)throw new Error("failed to set property")})(l(n.prototype),"adVolume",t,this,!0),this.video.muted=0===t}},{key:"load",value:function(t,e){var n=this,r=t[0].uri,i=t[0].bitrate;return new Promise((function(t,o){var a=document.createElement("iframe"),s=document.createElement("script"),u=n.video,l=null;function c(t){n.container.removeChild(a),n.adVolume=0,n.video.clean&&n.video.clean(),n.video=null,n.frame=null,n.api=null,t&&o(t)}a.src="about:blank",a.setAttribute("scrolling","no"),a.style.width="100%",a.style.height="100%",a.style.display="block",a.style.opacity="0",a.style.border="none",n.container.appendChild(a),a.contentWindow.document.open(),a.contentWindow.document.close(),a.contentWindow.document.body.style.margin="0",n.frame=a,s.src=r,s.onload=function(){var s=a.contentWindow.getVPAIDAd(),l=a.contentWindow.document.body,d=n.vpaidVersion=new y(s.handshakeVersion("2.0"));if(d.major>2)return o(new Error("VPAID version "+d+" is not supported."));a.contentWindow.addEventListener("resize",(function(){var t=a.getBoundingClientRect();n.resizeAd(t.width,t.height,"normal")}),!1),f.forEach((function(t){if(n.parent.isAsiaSmartAd||t!==f.AdStarted)return s.subscribe((function(){for(var e=new Array(arguments.length),r=arguments.length;r--;)e[r]=arguments[r];return n.emit.apply(n,[t].concat(e))}),t)})),n.once(f.AdLoaded,(function(){a.style.opacity="1",n.api=s;var e=m.getUrlParam("vast",r);e&&m.isURL(e)&&function(t){return m.httpGet(t)}(e).then((function(t){var e=new b(b.pojoFromXML(t)).get("ads[0].creatives[0].videoClicks.clickThrough");n.api.clickThrough=e})),t(n)})),n.once(f.AdError,(function(t){c(new Error(t))})),n.once(f.AdStopped,c),n.parent.isAsiaSmartAd&&(n.once(f.AdStopped,(function(t){n.emit(f.AdSkipped)})),n.once(f.AdVideoStart,(function(t){var e=a.contentWindow.document.querySelector(".sas-container").querySelector("iframe").contentWindow.document.querySelector("video");n.video=e,n.parent.video=e}))),s.initAd(n.config.width,n.config.height,"normal",i,{AdParameters:e.adParameters}
1,{slot:l,videoSlot:u,videoSlotCanAutoPlay:p})},s.onerror=function(){c(new Error("Failed to load MediaFile ["+r+"]."))},function(t,e,n){E(t,e,(function r(){return function(t,e,n){t.removeEventListener(e,n,!1)}(t,e,r),n.apply(this,arguments)}))}(u,h.PLAYING,(function(){n.emit(f.AdStarted)})),E(u,h.TIMEUPDATE,(function(){!function(t){var e=t.getBoundingClientRect();return e.top||e.height/2<=window.innerHeight-e.top&&e.bottom>=e.height/2}(n.container)||n.alreadyEmitViewable?l=null:(l||(l=u.currentTime),u.currentTime-l>=2&&(n.alreadyEmitViewable=!0,n.emit(f.AdViewableImpression)))})),E(u,h.LOADEDMETADATA,(function(){var t=new v(u,e.progressEvents);new g([f.AdVideoProgress]).from(t).to(n)})),a.contentWindow.document.body.appendChild(u),a.contentWindow.document.body.appendChild(s)}))}}],[{key:"canPlayMediaFile",value:function(t){return(t.type===d.JAVASCRIPT||"application/x-javascript"===t.type)&&"VPAID"===t.apiFramework}}]),n}();t.exports=_},function(t,e,n){"use strict";var r=n(6),i=n(4);function o(t,e){return function(){var n=arguments,r=this.api,i=this;function o(){return new Error("Ad has not been loaded.")}function a(){return r[t].apply(r,n)}if(!e){if(!r)throw o();return a()}return new Promise((function(t,n){return r?(i.once(e,(function(){t(i)})),a()):n(o())}))}}function a(t){r.call(this),this.container=t,this.api=null,this.vpaidVersion=null}a.prototype=Object.create(r.prototype),Object.defineProperties(a.prototype,{adLinear:{get:o("getAdLinear")},adWidth:{get:o("getAdWidth")},adHeight:{get:o("getAdHeight")},adExpanded:{get:o("getAdExpanded")},adSkippableState:{get:o("getAdSkippableState")},adRemainingTime:{get:o("getAdRemainingTime")},adDuration:{get:o("getAdDuration"),set:function(t){}},adVolume:{get:o("getAdVolume"),set:o("setAdVolume")},adCompanions:{get:o("getAdCompanions")},adIcons:{get:o("getAdIcons")}}),a.prototype.load=function(){throw new Error("VPAID subclass must implement load() method.")},a.prototype.resizeAd=o("resizeAd",i.AdSizeChange),a.prototype.startAd=o("startAd",i.AdStarted),a.prototype.stopAd=o("stopAd",i.AdStopped),a.prototype.pauseAd=o("pauseAd",i.AdPaused),a.prototype.resumeAd=o("resumeAd",i.AdPlaying),a.prototype.playAd=o("playAd",i.AdPlaying),a.prototype.expandAd=o("expandAd",i.AdExpandedChange),a.prototype.collapseAd=o("collapseAd",i.AdExpandedChange),a.prototype.skipAd=function(){o("skipAd",i.AdSkipped).call(this),this.stopAd()},t.exports=a},function(t,e,n){"use strict";function r(t){var e=t.split(".").map(parseFloat);this.string=t,this.major=e[0],this.minor=e[1],this.patch=e[2],Object.freeze(this)}r.prototype.toString=function(){return this.string},t.exports=r},function(t,e,n){"use strict";var r=n(6),i=n(4);function o(t,e,n){t!==i.AdVideoProgress?e.fired[t]||(e.emit(t),e.fired[t]=!0):e.emit(t,n)}function a(t,e){r.apply(this,arguments),this.duration=t,this.progressEvents=e.sort((function(t,e){return t.offset<e.offset})),this.seconds=Array.apply([],new Array(t)).map((function(){return!1})),this.fired=[i.AdVideoStart,i.AdVideoFirstQuartile,i.AdVideoMidpoint,i.AdVideoThirdQuartile,i.AdVideoComplete].reduce((function(t,e){return t[e]=!1,t}),{})}a.prototype=Object.create(r.prototype),a.prototype.tick=function(){var t=this,e=this.seconds,n=this._getState(),r=Math.round(n.currentTime)-1,a=[1,2,3,4].map((function(t){return Math.floor(this.duration/4*t)}),this);function s(t){var n=a[t-1];return!(!n||0==n)&&e.slice(0,n).every((function(t){return!0===t}))}n.playing&&(o(i.AdVideoStart,this),r>-1&&(this.seconds[r]=!0)),s(1)&&o(i.AdVideoFirstQuartile,this),s(2)&&o(i.AdVideoMidpoint,this),s(3)&&o(i.AdVideoThirdQuartile,this),s(4)&&o(i.AdVideoComplete,this),this.progressEvents.length&&this._popMatchProgressEvents(n.currentTime).forEach((function(e){return o(i.AdVideoProgress,t,e)}))},a.prototype._popMatchProgressEvents=function(t){for(var e=this.progressEvents,n=e.length-1;n>-1&&t>e[n].offset;)n-=1;return e.splice(n+1)},a.prototype._getState=function(){throw Error("this method must be overridden")},t.exports=a},function(t,e,n){"use strict";var r=n(6),i=n(10).canPlay,o=n(42),a=n(4),s=n(9),u=n(16),l=n(11);function c(t,e,n){return t.addEventListener(e,n,!1)}function f(t,e,n){return c(t,e,(function r(){return function(t,e,n){t.removeEventListener(e,n,!1)}(t,e,r),n.apply(this,arguments)}))}function d(t,e){function n(){return new Error("The <video> has not been loaded.")}return function(){if(!this.video){if(e)return Promise.reject(n());throw n()}return t.apply(this,arguments)}}function h(){return this.container.removeChild(this.video),this.video.clean(),this.video=null,this.alreadyEmitViewable=!1,Promise.resolve(this)}function p(t,e,n){r.call(this),this.container=t,this.video=e,this.config=n,this.__private__={hasPlayed:!1}
1}p.prototype=Object.create(r.prototype),Object.defineProperties(p.prototype,{adRemainingTime:{get:d((function(){return this.video.duration-this.video.currentTime}))},adDuration:{get:d((function(){return this.video.duration}))},adVolume:{get:d((function(){return this.video.volume})),set:d((function(t){this.video.muted=0===t,this.video.volume=t}))}}),p.prototype.load=function(t,e){var n=this;return new Promise((function(r,d){var h=n.video,p=function(t,e){var n=e.width,r=t.map((function(t){return{mediaFile:t,playability:"video/3gpp"!==t.type&&i(t.type)}})).filter((function(t){return t.playability>0})).sort(o("-playability","-mediaFile.bitrate")),a=r.map((function(t){return Math.abs(n-(t.mediaFile.width||0))})),s=r[a.indexOf(Math.min.apply(Math,a))];return s&&s.mediaFile&&(s.mediaFile.uri=s.mediaFile.uri.trim()),!s||s.playability<1?null:s.mediaFile}(t,{width:n.config.width,height:n.config.height}),y=null;if(!p)return d(new Error("There are no playable <MediaFile>s."));h.src=p.uri,f(h,s.LOADEDMETADATA,(function(){var t=new u(h,e.progressEvents);new l(a).from(t).to(n),r(n),n.emit(a.AdLoaded),c(h,s.DURATIONCHANGE,(function(){n.emit(a.AdDurationChange)})),c(h,s.VOLUMECHANGE,(function(){n.emit(a.AdVolumeChange)}))})),f(h,s.ERROR,(function(){var t=h.error;n.emit(a.AdError,t.message),d(t)})),f(h,s.PLAYING,(function(){n.__private__.hasPlayed=!0,n.emit(a.AdImpression)})),f(h,s.ENDED,(function(){n.stopAd()})),c(h,s.TIMEUPDATE,(function(){!function(t){var e=t.getBoundingClientRect();return e.top||e.height/2<=window.innerHeight-e.top&&e.bottom>=e.height/2}(n.container)||n.alreadyEmitViewable?y=null:(y||(y=h.currentTime),h.currentTime-y>=2&&(n.alreadyEmitViewable=!0,n.emit(a.AdViewableImpression)))})),c(h,"click",(function(){n.emit(a.AdClickBackground,null,null,!0)})),n.container.appendChild(h)}))},p.prototype.startAd=d((function(){var t=this,e=this.video;return this.__private__.hasPlayed?Promise.reject(new Error("The advertisement has already been started.")):new Promise((function(n,r){return f(e,s.PLAYING,(function(){n(t),t.alreadyPlayAd=!0,t.emit(a.AdStarted)})),e.play().catch(r)}))}),!0),p.prototype.stopAd=d((function(){return this.emit(a.AdStopped),h.call(this)}),!0),p.prototype.skipAd=d((function(){return this.emit(a.AdSkipped),h.call(this)}),!0),p.prototype.pauseAd=d((function(){var t=this,e=this.video;return this.video.paused?Promise.resolve(this):new Promise((function(n){return f(e,s.PAUSE,(function(){n(t),t.emit(a.AdPaused)})),e.pause()}))}),!0),p.prototype.resumeAd=d((function(){var t=this,e=this.video;return this.__private__.hasPlayed?this.video.paused?new Promise((function(n){return f(e,s.PLAY,(function(){n(t),t.emit(a.AdPlaying)})),e.play()})):Promise.resolve(this):Promise.reject(new Error("The ad has not been started yet."))}),!0),p.canPlayMediaFile=function(t){return Boolean(document.createElement("video").canPlayType(t.type))},t.exports=p},function(t,e,n){var r,i,o,a=n(43);o=function(t){return function(e){return typeof e===t}},i=function(t,e){var n=1,r=e||function(t,e){return e};return"-"===t[0]&&(n=-1,t=t.substr(1)),function(e,i){var o,s=r(t,a.get(e,t)),u=r(t,a.get(i,t));return s<u&&(o=-1),s>u&&(o=1),s===u&&(o=0),o*n}},r=function(){var t=Array.prototype.slice.call(arguments),e=t.filter(o("string")),n=t.filter(o("function"))[0];return function(t,r){for(var o=e.length,a=0,s=0;0===a&&s<o;)a=i(e[s],n)(t,r),s++;return a}},t.exports=r},function(t,e,n){var r,i,o;!function(n,a){"use strict";"object"==typeof t&&"object"==typeof t.exports?t.exports=a():(i=[],void 0===(o="function"==typeof(r=a)?r.apply(e,i):r)||(t.exports=o))}(0,(function(){"use strict";var t=Object.prototype.toString,e=Object.prototype.hasOwnProperty;function n(t){if(!t)return!0;if(a(t)&&0===t.length)return!0;for(var n in t)if(e.call(t,n))return!1;return!0}function r(e){return t.call(e)}function i(t){return"number"==typeof t||"[object Number]"===r(t)}function o(t){return"string"==typeof t||"[object String]"===r(t)}function a(t){return"object"==typeof t&&"number"==typeof t.length&&"[object Array]"===r(t)}function s(t){var e=parseInt(t);return e.toString()===t?e:t}function u(t,e,r,a){if(i(e)&&(e=[e]),n(e))return t;if(o(e))return u(t,e.split("."),r,a);var l=s(e[0]);if(1===e.length){var c=t[l];return void 0!==c&&a||(t[l]=r),c}return void 0===t[l]&&(i(l)?t[l]=[]:t[l]={}),u(t[l],e.slice(1),r,a)}var l={ensureExists:function(t,e,n){return u(t,e,n,!0)},set:function(t,e,n,r){return u(t,e,n,r)},insert:function(t,e,n,r){var i=l.get(t,e);r=~~r,a(i)||(i=[],l.set(t,e,i)),i.splice(r,0,n)},empty:function(t,s){if(n(s))return t;if(!n(t)){var u,c;if(!(u=l.get(t,s)))return t;if(o(u))return l.set(t,s,"");if(function(t){return"boolean"==typeof t||"[object Boolean]"===r(t)}(u))return l.set(t,s,!1);if(i(u))return l.set(t,s,0);if(a(u))u.length=0;else{if(!function(t){return"object"==typeof t&&"[object Object]"===r(t)}(u))return l.set(t,s,null);for(c in u)e.call(u,c)&&delete u[c]}}},push:function(t,e){var n=l.get(t,e);a(n)||(n=[],l.set(t,e,n)),n.push.apply(n,Array.prototype.slice.call(arguments,2))},coalesce:function(t,e,n){for(var r,i=0,o=e.length;i<o;i++)if(void 0!==(r=l.get(t,e[i])))return r;return n},get:function(t,e,r){if(i(e)&&(e=[e]),n(e))return t;if(n(t))return r;
1if(o(e))return l.get(t,e.split("."),r);var a=s(e[0]);return 1===e.length?void 0===t[a]?r:t[a]:l.get(t[a],e.slice(1),r)},del:function(t,e){return function t(e,r){if(i(r)&&(r=[r]),!n(e)){if(n(r))return e;if(o(r))return t(e,r.split("."));var u=s(r[0]),l=e[u];if(1===r.length)void 0!==l&&(a(e)?e.splice(u,1):delete e[u]);else if(void 0!==e[u])return t(e[u],r.slice(1));return e}}(t,e)}};return l}))},function(t,e,n){"use strict";var r=n(4);function i(t){return t}function o(t,e){(t||[]).forEach((function(t){(new Image).src=e(t)}))}function a(t,e){this.pixels=t.reduce((function(t,e){return e&&(t[e.event]||(t[e.event]=[])).push(e.uri),t}),{}),this.__private__={mapper:e||i}}a.prototype.track=function(t){var e=this.pixels,n=this.__private__.mapper,a=t.adVolume;function s(t,r,a){function s(t){return n((r||i)(t))}return function(){a&&!a()||o(e[t],s)}}t.on(r.AdSkipped,s("skip")),t.on(r.AdStarted,s("creativeView")),t.on(r.AdVolumeChange,s("unmute",null,(function(){return 0===a&&t.adVolume>0}))),t.on(r.AdVolumeChange,s("mute",null,(function(){return a>0&&0===t.adVolume}))),t.on(r.AdImpression,s("impression")),t.on(r.AdViewableImpression,(function(){s("viewableImpression"),s("impression")})),t.on(r.AdVideoStart,s("start")),t.on(r.AdVideoFirstQuartile,s("firstQuartile")),t.on(r.AdVideoMidpoint,s("midpoint")),t.on(r.AdVideoThirdQuartile,s("thirdQuartile")),t.on(r.AdVideoProgress,(function(t){o([t.uri],n||i)})),t.on(r.AdVideoComplete,s("complete")),t.on(r.AdUserAcceptInvitation,s("acceptInvitationLinear")),t.on(r.AdUserMinimize,s("collapse")),t.on(r.AdUserClose,s("closeLinear")),t.on(r.AdPaused,s("pause")),t.on(r.AdResumed,s("resume")),t.on(r.AdPlaying,s("resume")),t.on(r.AdError,s("error",(function(t){return t.replace(/\[ERRORCODE\]/g,901)}))),t.on(r.AdVolumeChange,(function(){a=t.adVolume}))},t.exports=a},function(t,e){t.exports=function(){var t=document.createElement("video"),e=[],n=!1,r=t.addEventListener,i=t.removeEventListener,o=t.play,a=Array.prototype.map.call(t.attributes,(function(t){return t.name}));return t.init=function(e){return n?Promise.resolve():(n=!0,t.parentNode||e.appendChild(t),Promise.resolve().then((function(){return t.load()})).catch((function(t){return console.log("Error while initializing video",t)})))},t.clean=function(){e.forEach((function(e){i.call(t,e.type,e.listener,e.options)})),e=[],t.load(),s()},t.addEventListener=function(n,i,o){return e.push({type:n,listener:i,options:o}),r.call(t,n,i,o)},t.removeEventListener=function(e,n,r){return i.call(t,e,n,r)},t.play=function(){return n=!0,o.call(t)},s(),t;function s(){Array.prototype.forEach.call(t.attributes,(function(e){-1===a.indexOf(e.name)&&t.removeAttribute(e.name)})),t.setAttribute("webkit-playsinline",""),t.setAttribute("playsinline",""),t.setAttribute("preload","auto"),t.style.display="block",t.style.width="100%",t.style.height="100%",t.style.position="absolute",t.style.left="0px",t.style.top="0px",t.style.backgroundColor="#000",t.style.objectFit="contain"}}},function(t,e,n){t.exports=n(47)},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function o(t,e){return(o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function a(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var u=n(48),l=n(50),c=n(12),f=n(3),d=f.isImaAd,h=f.createPromiseDefer,p=n(51),y=n(5).DEFAULT_MAX_VOLUME;t.exports=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e)}(n,c);var e=function(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=s(t);if(e){var o=s(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return function(t,e){if(e&&("object"===r(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return a(t)}(this,n)}}(n);function n(t,r,i,o){var s;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(s=e.call(this,t,r,i,o))._onAdsManagerLoaded=s._onAdsManagerLoaded.bind(a(s)),s._onAdEvent=s._onAdEvent.bind(a(s)),s._onAdErrorEvent=s._onAdErrorEvent.bind(a(s)),s.adDisplayContainer=null,s.adsLoader=null,s.adsManager=null,s.adOption=null,s.currentAd=null,s.volume=s.videoContent.muted?0:s.videoContent.volume*y,s.paused=!1,s.destroyed=!1,s.loadDeferred=null,s.startAdRequested=!1,s.cancelledAdRequested=!1,s.initUserActionHappened=!1,u.load().then((function(){return s._init()})).catch((function(t){s.destroyed||s.logger.error(s.name,"cannot load SDK",t)})),s}return function(t,e,n){e&&i(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1})}(n,[{key:"name",get:function(){return"GoogleImaPlayer"}},{key:"videoContentWidth",get:function(){return this.videoContent.offsetWidth}},{key:"videoContentHeight",get:function(){return this.videoContent.offsetHeight}},{key:"videoContentVolume",get:function(){return this.videoContent.muted?0:this.videoContent.volume}},{key:"selfControl",get:function(){return!1}},{key:"canClickThrough",get:function(){return!0}},{key:"isGoogleImaAd",get:function(){return!0}},{key:"initUserAction",value:function(){!this.initUserActionHappened&&this.adDisplayContainer&&(this.initUserActionHappened=!0,this.adDisplayContainer.initialize(),this.adDisplayContainer.initialized=!0,this.logger.debug(this.name,"init user action done"))}},{key:"loadAd",value:function(t,e){var n=this;this.logger.debug(this.name,"loadAd ad ",t),this.adOption=e,this.tracker=new l(t),this.tracker._trackEvent("requestVast"),this.loadDeferred=h();var r=t.vastAdTagURI;return u.isReady().then((function(){return n._requestAds(r)})).then((function(){return n.loadDeferred.promise}))}},{key:"canRun",value:function(t){return d(t)}},{key:"start",value:function(){return this.startAdRequested=!1,this.cancelledAdRequested=!1,this.paused=!1,this.destroyed?this._onAdStopped(new Error("cannot play ad since adsManager was destroyed")):this.adsManager?(this.initUserAction(),void this.adsManager.start()):(this.startAdRequested=!0,void this.logger.debug(this.name,"cannot play ad since adsManager is not loaded yet, try to play on load event"))}},{key:"stop",value:function(){this.adsManager&&this.adsManager.stop()}},{key:"skip",value:function(){this.stop()}},{key:"pause",value:function(){this.adsManager&&this.adsManager.pause()}},{key:"resume",value:function(){this.adsManager&&this.adsManager.resume()}},{key:"cancel",value:function(){this.adsManager?this.adsManager.stop():this.cancelledAdRequested=!0}},{key:"setVolume",value:function(t){this.logger.debug(this.name,"setVolume | volume ",t),this.volume=t,this.adsManager&&this.adsManager.setVolume(t)}},{key:"getVolume",value:function(){return this.volume}},{key:"isPaused",value:function(){return this.paused}},{key:"getRemainingTime",value:function(){return this.adsManager.getRemainingTime()}},{key:"getDuration",value:function(){return this.currentAd?this.currentAd.getDuration():0}},{key:"getSkipOffset",value:function(){return this.logger.debug(this.name,"skipTimeOffset",this.currentAd&&this.currentAd.getSkipTimeOffset()),this.adOption?this.adOption.skipoffset:-1}},{key:"resize",value:function(){this.adsManager&&this.adsManager.resize(this.videoContentWidth,this.videoContentHeight,google.ima.ViewMode.NORMAL)}},{key:"destroy",value:function(){this.destroyed=!0,this._destroyAdsManager(),this._destroyAdDisplayContainer(),this.element&&(this.adContainerElement.removeChild(this.element),this.element=null),this.logger.debug(this.name,"de
1stroyed")}},{key:"_init",value:function(){this.destroyed||(this.element=document.createElement("div"),this.element.style.width="100%",this.element.style.height="100%",this.element.style.position="absolute",this.element.style.zIndex=1,this.element.style.backgroundColor="rgba(0, 0, 0, 0.8)",this.element.setAttribute("data-player",this.name),this.adContainerElement.appendChild(this.element),google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.INSECURE),google.ima.settings.setDisableCustomPlaybackForIOS10Plus(!0),google.ima.settings.setDisableFlashAds(!0),this.adDisplayContainer=new google.ima.AdDisplayContainer(this.element,this.videoContent),this.adsLoader=new google.ima.AdsLoader(this.adDisplayContainer),this.adsLoader.getSettings().setPlayerType("zplayer-ima"),this.adsLoader.getSettings().setPlayerVersion(p.version),this.adsLoader.getSettings().setAutoPlayAdBreaks(this.options.autoPlayAdBreaks),this.adsLoader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this._onAdsManagerLoaded,!1),this.adsLoader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,this._onAdErrorEvent,!1),this._hide())}},{key:"_show",value:function(){this.element.style.display="block"}},{key:"_hide",value:function(){this.element.style.display="none"}},{key:"_requestAds",value:function(t){this.logger.debug(this.name,"_requestAds | adTagUrl",t);var e=new google.ima.AdsRequest;e.adTagUrl=t,e.linearAdSlotWidth=this.videoContentWidth,e.linearAdSlotHeight=this.videoContentHeight,e.nonLinearAdSlotWidth=this.videoContentWidth,e.nonLinearAdSlotHeight=this.videoContentHeight,e.forceNonLinearFullSlot=!0,e.setAdWillAutoPlay(this.options.autoPlay),e.setAdWillPlayMuted(this.options.mute),this.adsLoader.requestAds(e)}},{key:"_onAdsManagerLoaded",value:function(t){var e=new google.ima.AdsRenderingSettings;e.restoreCustomPlaybackStateOnAdBreakComplete=!0,e.enablePreloading=!0,this.adsManager=t.getAdsManager(this.videoContent,e),this.setVolume(this.volume),this.adsManager.init(this.videoContentWidth,this.videoContentHeight,google.ima.ViewMode.NORMAL),this._startAdsManager(this.adsManager)}},{key:"_startAdsManager",value:function(t){t.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,this._onAdErrorEvent,!1,this);var e=[google.ima.AdEvent.Type.LOADED,google.ima.AdEvent.Type.STARTED,google.ima.AdEvent.Type.IMPRESSION,google.ima.AdEvent.Type.FIRST_QUARTILE,google.ima.AdEvent.Type.MIDPOINT,google.ima.AdEvent.Type.THIRD_QUARTILE,google.ima.AdEvent.Type.COMPLETE,google.ima.AdEvent.Type.PAUSED,google.ima.AdEvent.Type.RESUMED,google.ima.AdEvent.Type.SKIPPED,google.ima.AdEvent.Type.CLICK,google.ima.AdEvent.Type.USER_CLOSE,google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,google.ima.AdEvent.Type.ALL_ADS_COMPLETED];for(var n in e)t.addEventListener(e[n],this._onAdEvent,!1,this);this.cancelledAdRequested?this.cancel():this.startAdRequested&&this.start()}},{key:"_onAdEvent",value:function(t){var e=this;this.logger.debug(this.name,"Ad event:",t.type),this.tracker.onAdEvent(t);var n=t.getAd();switch(t.type){case google.ima.AdEvent.Type.LOADED:this.onAdLoaded(),this.loadDeferred.resolve(),this.loadDeferred=null,n.isLinear()||(this.element.style.backgroundColor="transparent");break;case google.ima.AdEvent.Type.STARTED:if(this.currentAd=n,this._onAdStarted(),!n.isLinear()){var r=-1===n.g.duration?15:n.g.duration;setTimeout((function(){e.adsManager&&e.adsManager.stop(),e._onAdStopped()}),1e3*r)}break;case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED:this._onAdStopped();break;case google.ima.AdEvent.Type.PAUSED:this._onAdPausedEvent();break;case google.ima.AdEvent.Type.RESUMED:this._onAdResumedEvent()}}},{key:"_onAdErrorEvent",value:function(t){var e=t.getError();this.loadDeferred?this.loadDeferred.reject(e):(this.logger.error(this.name,"Ad error:",e.toString()),this._onAdStopped(e))}},{key:"_onAdPausedEvent",value:function(){this.paused=!0}},{key:"_onAdResumedEvent",value:function(){this.paused=!1}},{key:"_onAdStarted",value:function(){this._show(),this.onAdStarted()}},{key:"_onAdStopped",value:function(t){this._hide(),this._destroyAdsManager(),this.onAdStopped(t)}},{key:"_destroyAdsManager",value:function(){this.adsManager&&(this.adsManager.destroy(),this.adsManager=null)}},{key:"_destroyAdDisplayContainer",value:function(){this.adDisplayContainer&&(this.adDisplayContainer.destroy(),this.adDisplayContainer=null)}}]),n}()},function(t,e,n){var r,i=n(49);t.exports={load:function(){return r||(r=new Promise((function(t,e){i((function(n){n?t():e(new Error("failed to load IMA SDK"))}),!0,6e3)}))),r},isReady:function(){return r}}},function(t,e){t.exports=function(t,e,n){var r=window,i=document,o=null,a=function(e){r.clearTimeout(o),"function"==typeof t&&t(e)};if(r.google&&r.google.ima)a(!0);else{var s=!0===e?"https:":"",u=i.getElementsByTagName("script")[0],l=i.createElement("script");l.src=s+"//imasdk.googleapis.com/js/sdkloader/ima3.js",l.async=!0,"function"==typeof t&&(l.onload=function(){a(!0)}),u.parentNode.insertBefore(l,u),n&&(o=r.setTimeout((function(){a(!1)}),n))}}},function(t,e){function n(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}t.exports=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.impressionEvents=[].concat(e.impressions||[],e.viewableImpressions||[]),this.trackingEvents=e.creatives.lenght&&e.creatives[0].trackingEvents||[],e.creatives.lenght&&e.creatives[0].videoClicks&&(this.clickTrackingUri=e.creatives[0].videoClicks.clickTrackings[0])}return function(t,e,r){e&&n(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1})}(t,[{key:"onAdEvent",value:function(t){var e=this;switch(t.type){case google.ima.AdEvent.Type.IMPRESSION:this.impressionEvents.forEac
1h((function(t){return e._fireEvent(t.uri)}));break;case google.ima.AdEvent.Type.STARTED:this._trackEvent("start"),this._trackEvent("creativeView");break;case google.ima.AdEvent.Type.FIRST_QUARTILE:this._trackEvent("firstQuartile");break;case google.ima.AdEvent.Type.MIDPOINT:this._trackEvent("midpoint");break;case google.ima.AdEvent.Type.THIRD_QUARTILE:this._trackEvent("thirdQuartile");break;case google.ima.AdEvent.Type.COMPLETE:this._trackEvent("complete");break;case google.ima.AdEvent.Type.PAUSED:this._trackEvent("pause");break;case google.ima.AdEvent.Type.RESUMED:this._trackEvent("resume");break;case google.ima.AdEvent.Type.SKIPPED:this._trackEvent("skip");break;case google.ima.AdEvent.Type.USER_CLOSE:this._trackEvent("close");break;case google.ima.AdEvent.Type.CLICK:this.clickTrackingUri&&this._fireEvent(this.clickTrackingUri)}}},{key:"_trackEvent",value:function(t){var e=this;this.trackingEvents.filter((function(e){return e.event===t})).forEach((function(t){return e._fireEvent(t.uri)}))}},{key:"_fireEvent",value:function(t){t&&((new Image).src=t)}}]),t}()},function(t){t.exports={name:"@zplayer/ad-runner",version:"1.0.36",description:"Generic ad runner library for media player",main:"dist/ad-runner.min.js",author:"ZTE folks",publishConfig:{registry:"https://nexus-repo.zapps.vn/repository/zjs-repo/"},scripts:{dev:"webpack-dev-server --progress --mode development --config webpack.config.js",watch:"webpack --progress --watch --mode development --output-filename=[name].min.js --config webpack.config.js",build:"webpack -p --progress --mode production --config webpack.config.js","build-demo":"webpack --progress --mode development --config webpack.config.js",lint:"eslint *.js src/"},devDependencies:{"@babel/core":"^7.1.2","@babel/preset-env":"^7.1.0","@zjs/vast-player":"1.3.70","babel-loader":"^8.0.4","clean-webpack-plugin":"0.1.19","css-loader":"1.0.0",eslint:"^5.4.0","eslint-plugin-import":"^2.15.0","generate-changelog":"^1.7.1","html-webpack-plugin":"3.2.0","node-sass":"4.13.0","sass-loader":"7.1.0","style-loader":"0.23.0",webpack:"4.17.2","webpack-cli":"3.1.0","webpack-dev-server":"3.1.8","webpack-merge":"4.1.4"}}},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function o(t,e){return(o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function a(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var u=n(7).VastPlayer,l=n(12),c=n(3),f=c.isImaAd,d=c.isFacebookAd,h=c.isAsiaSmartAd,p=c.isYomediaAd,y=n(5).AD_DONE_REASON;t.exports=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e)}(n,l);var e=function(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=s(t);if(e){var o=s(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return function(t,e){if(e&&("object"===r(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return a(t)}(this,n)}}(n);function n(t,r,i,o){var s;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(s=e.call(this,t,r,i,o)).adOption=null,s.loadPromise=null,s.initUserActionHappened=!1,s.onAdSkipped=i.onAdSkipped,s._onAdError=s._onAdError.bind(a(s)),s._init(),s}return function(t,e,n){e&&i(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1})}(n,[{key:"name",get:function(){return"VastLinearPlayer"}},{key:"canClickThrough",get:function(){return this.player.isVPAID&&"MOAT"!==this.player.vpaidVendor&&"YOMEDIA"!==this.player.vpaidVendor}},{key:"isFacebookAd",get:function(){return d(this.ad)}},{key:"isAsiaSmartAd",get:function(){return h(this.ad)}},{key:"isYomediaAd",get:function(){return p(this.ad)||!1}},{key:"viewDetailLink",get:function(){return this.player&&this.player.viewDetailLink}},{key:"canRun",value:function(t){return!f(t)&&"linear"===t.creatives[0].type}},{key:"initUserAction",value:function(){this.initUserActionHappened||(this.initUserActionHappened=!0,this.player.init(),this.logger.debug(this.name,"init user action done"))}},{key:"loadAd",value:function(t,e){return this.ad=t,this.adOption=e,this.loadPromise=this.player.load({ads:[t]}),this.loadPromise}},{key:"start",value:function(){var t=this;this.loadPromise.then((function(){return t.player.startAd()})).catch(this._onAdError)}},{key:"stop",value:function(){var t=this;this.loadPromise.then((function(){return t.player.stopAd()})).catch(this._onAdError)}},{key:"skip",value:function(){var t=this;this.loadPromise.then((function(){return t.player.skipAd()})).catch(this._onAdError)}},{key:"pause",value:function(){var t=this;return this.loadPromise.then((function(){return t.player.pauseAd()})).catch(this._onAdError)}},{key:"resume",value:function(){var t=this;return this.loadPromise.then((function(){t.isYomediaAd?t.player.playAd():t.player.resumeAd()})).catch(this._onAdError)}},{key:"cancel",value:function(){this.stop()}},{key:"viewDetail",value:function(){var t=this;this.loadPromise.then((function(){if(t.player.isVPAID)try{var e=t.player.__private__.player.api&&t.player.__private__.player.api.clickThrough;if(e)return void t.player.emit("AdClickThru",e,null,!0);t.player.__private__.video.click(),t.resume()}catch(e){t.logger.error(t.name,"error while simulate click on VPAID ad",e)}else t.player.emit("AdClickThru",null,null,!0)})).catch(this._onAdError)}},{key:"setVolume",value:function(t){var e=this;this.loadPromise.then((function(){e.player.adVolume=t}))}},{key:"getVolume",value:function(){return this.loadPromise?this.player.adVolume:0}},{key:"isPaused",value:function(){return this.player.paused}},{key:"getRemainingTime",value:function(){if(this.isAsiaSmartAd||this.isYomediaAd){var t=this.getDuration();return t>0?t-this.getAdCurrentTime():t}return this.player&&this.player.adRemainingTime}},{key:"getDuration",value:function(){return this.player&&this.player.adDuration}},{key:"getAdCurrentTime",value:function(){return Math.floor(this.player.__private__.video.currentTime)}},{key:"getSkipOffset",value:function(){return this.logger.debug(this.name,"skipTimeOffset",this.adOption.skipoffset),this.adOption?this.adOption.skipoffset:-1}},{key:"destroy",value:function(){this.loadPromise&&this.ad&&this.stop(),this.player=null,this.element&&(this.adContainerElement.removeChild(this.element),this.element=null),this.logger.debug(this.name,"de
1stroyed")}},{key:"_init",value:function(){var t=this,e=document.createElement("div"),n=new u(e,{width:t.videoContent.offsetWidth,height:t.videoContent.offsetHeight});e.style.width="100%",e.style.height="100%",e.style.position="absolute",e.style.zIndex=1,e.setAttribute("data-player",this.name),n.on("AdStarted",(function(){return t._onAdStartedEvent()})),n.on("AdStopped",(function(){return t._onAdStoppedEvent()})),n.on("AdSkipped",(function(){return t._onAdSkippedEvent()})),n.on("AdLoaded",(function(){return t._onAdLoadedEvent()})),t.adContainerElement.appendChild(e),t.element=e,t.player=n,t._hide()}},{key:"_show",value:function(){this.element.style.display="block"}},{key:"_hide",value:function(){this.element.style.display="none"}},{key:"_onAdLoadedEvent",value:function(){this.onAdLoaded()}},{key:"_onAdStartedEvent",value:function(){if(this._show(),this.onAdStarted(),this.isFacebookAd)try{this.player.__private__.player.frame.contentDocument.querySelector("#an_skip_button").style.display="none"}catch(t){this.logger.warn(this.name,"failed to remove FB skip button",t)}}},{key:"_onAdStoppedEvent",value:function(t,e){this.loadPromise=null,this._hide(),this.onAdStopped(t,e)}},{key:"_onAdSkippedEvent",value:function(){this.onAdSkipped(),this._onAdStoppedEvent(null,y.skipped)}},{key:"_onAdError",value:function(t){this._onAdStoppedEvent(t)}}]),n}()},function(t,e,n){t.exports=n(54)},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function o(t,e){return(o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var s=n(12),u=n(3).isImaAd,l=n(55),c=n(59),f=n(5).DEFAULT_NON_LINEAR_DURATION;t.exports=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e)}(n,s);var e=function(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=a(t);if(e){var o=a(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return function(t,e){if(e&&("object"===r(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,n)}}(n);function n(t,r,i,o){var a;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(a=e.call(this,t,r,i,o)).ad=null,a.adOption=null,a.imgUrl=null,a.adTimer=null,a}return function(t,e,n){e&&i(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1})}(n,[{key:"name",get:function(){return"VastNonLinearPlayer"}},{key:"selfControl",get:function(){return!0}},{key:"viewDetailLink",get:function(){return this.ad.creatives[0].ads[0].clickThrough}},{key:"canRun",value:function(t){return!u(t)&&t.creatives.length&&"nonLinear"===t.creatives[0].type}},{key:"initUserAction",value:function(){}},{key:"loadAd",value:function(t,e){this.ad=t,this.adOption=e,this.imgUrl=null;var n=t.creatives[0].ads[0].resources;return n&&this._isValidImageAd(n)?(this.imgUrl=n,this.onAdLoaded(),Promise.resolve()):Promise.reject(new Error("no playable non-linear file"))}},{key:"start",value:function(){this.adTimer&&this.stop();var t=this.ad.creatives[0],e=parseInt(t.ads[0].width),n=parseInt(t.ads[0].height);return this.tracker=new c(this.ad),this.adUi=new l(this,this.videoContent.offsetWidth,this.videoContent.offsetHeight),this.adUi.setImage(this.imgUrl,e,n),this.adContainerElement.appendChild(this.adUi.element),this._onAdStartedEvent(),Promise.resolve()}},{key:"stop",value:function(){this._onAdStoppedEvent()}},{key:"cancel",value:function(){this.stop()}},{key:"viewDetail",value:function(){try{var t=this.viewDetailLink;t&&window.open(t,"_blank")}catch(t){this.logger.error(this.name,"error while showing detail of ad",t)}}},{key:"setVolume",value:function(){}},{key:"getRemainingTime",value:function(){}},{key:"getDuration",value:function(){}},{key:"destroy",value:function(){this._stopAdTimer(),this.adUi&&this.adUi.remove(),this.logger.debug(this.name,"de
1stroyed")}},{key:"_isValidImageAd",value:function(t){return!/\.swf/.test(t)}},{key:"_startAdTimer",value:function(){var t=this;this.adTimer=setTimeout((function(){return t.stop()}),1e3*(this.adOption.duration||f))}},{key:"_stopAdTimer",value:function(){clearTimeout(this.adTimer),delete this.adTimer}},{key:"_onAdStartedEvent",value:function(){this._startAdTimer(),this.adUi.show(),this.tracker.onAdStarted(),this.onAdStarted()}},{key:"_onAdStoppedEvent",value:function(){this._stopAdTimer(),this.adUi.remove(),this.tracker.onAdStopped(),this.onAdStopped(null,null,!0,this.adData)}}]),n}()},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function o(){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=u(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}}).apply(this,arguments)}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}n(56);var l=n(2);t.exports=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e)}(n,l);var e=function(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=u(t);if(e){var o=u(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return function(t,e){if(e&&("object"===r(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return s(t)}(this,n)}}(n);function n(t,r,i){var o;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(o=e.call(this,{className:"ad_runner_non_linear_ad_ui"})).player=t,o.maxWidth=r,o.maxHeight=i,o._onCloseButtonClickEvent=o._onCloseButtonClickEvent.bind(s(o)),o._onImageClickEvent=o._onImageClickEvent.bind(s(o)),o.render(),o._registerEvents(),o}return function(t,e,n){e&&i(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1})}(n,[{key:"render",value:function(){o(u(n.prototype),"render",this).call(this),this.closeButton=new l({tagName:"span"}),this.closeButton.render(),this.closeButton.html("[x]"),this.closeButton.attr("title","Äóng quảng cáo"),this.appendChild(this.closeButton),this.image=new l({tagName:"img"}),this.image.render(),this.appendChild(this.image)}},{key:"remove",value:function(){this._unregisterEvents(),o(u(n.prototype),"remove",this).call(this)}},{key:"setImage",value:function(t,e,n){(e>this.maxWidth||n>this.maxHeight)&&(this.image.attr("width","auto"),this.image.attr("height","auto"),e>n?this.image.style("max-width","".concat(this.maxWidth-40,"px")):this.image.style("max-height","".concat(this.maxHeight-40,"px"))),this.image.attr("src",t)}},{key:"_registerEvents",value:function(){this.closeButton.on("click",this._onCloseButtonClickEvent),this.image.on("click",this._onImageClickEvent)}},{key:"_unregisterEvents",value:function(){this.closeButton.off("click",this._onCloseButtonClickEvent),this.image.off("click",this._onImageClickEvent)}},{key:"_onCloseButtonClickEvent",value:function(t){t.stopPropagation(),this.player.stop()}},{key:"_onImageClickEvent",value:function(t){t.stopPropagation(),this.player.viewDetail()}}]),n}()},function(t,e,n){var r=n(57);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e,n){(t.exports=n(0)(!1)).push([t.i,".ad_runner_non_linear_ad_ui span{position:absolute;top:0;right:0;color:#f9754d;cursor:pointer;padding:2px;font-weight:bold;background-color:white}.ad_runner_non_linear_ad_ui img{cursor:pointer}\n",""])},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,r=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(t,e){var i,o=e.trim().replace(/^"(.*)"$/,(function(t,e){return e})).replace(/^'(.*)'$/,(function(t,e){return e}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(o)?t:(i=0===o.indexOf("//")?o:0===o.indexOf("/")?n+o:r+o.replace(/^\.\//,""),"url("+JSON.stringify(i)+")")}))}},function(t,e){function n(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var r=["start","creativeView"],i=["close"];t.exports=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.impressionEvents=[].concat(e.impressions||[],e.viewableImpressions||[]),this.trackingEvents=e.creatives[0].trackingEvents}return function(t,e,r){e&&n(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1})}(t,[{key:"onAdStarted",value:function(){var t=this;
1this.impressionEvents.forEach((function(e){return t._fireEvent(e.uri)})),this._trackEvents(r)}},{key:"onAdStopped",value:function(){this._trackEvents(i)}},{key:"_trackEvents",value:function(t){var e=this;this.trackingEvents.filter((function(e){return t.indexOf(e.event)>-1})).forEach((function(t){return e._fireEvent(t.uri)}))}},{key:"_fireEvent",value:function(t){t&&((new Image).src=t)}}]),t}()},function(t,e,n){function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var i=n(5),o=i.AD_POSITION,a=i.PRELOAD_DURATION,s=i.COUNT_DOWN_DURATION,u=n(3).createPromiseDefer,l="midroll";function c(t){return t.ads[0]&&t.ads[0].creatives.length&&"nonLinear"!==t.ads[0].creatives[0].type}t.exports=function(){function t(e){var n=e.prepareAd,r=e.beforePlayAd,i=e.preloadAd,o=e.loadAd,a=e.playAd,s=e.logger;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.props={prepareAd:n,beforePlayAd:r,preloadAd:i,loadAd:o,playAd:a,logger:s},this._reset(),this.dataLoadingDeferred=u()}return function(t,e,n){e&&r(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1})}(t,[{key:"name",get:function(){return"Scheduler"}},{key:"logger",get:function(){return this.props.logger}},{key:"populateAdsData",value:function(t){var e=this;t.forEach((function(t){return t.position===o.preroll?e.prerollAds.push(t):t.position===o.postroll?e.postrollAds.push(t):void e.midrollAds.push(t)})),this.midrollAds.sort((function(t,e){return e.startTime>t.startTime?1:-1})),this.prerollAds.length&&this.props.loadAd(this.prerollAds[0]),this.dataLoadingDeferred.resolve()}},{key:"onContentProgress",value:function(t){var e=this;if(this.ignoredFirstFrame){if(!this.state)return this._setState("preroll"),void this.dataLoadingDeferred.promise.then((function(){e._playAds(e.prerollAds).then((function(){e._setState(l)}))}));if(this.state===l){if(!this.midrollAds.length)return this._setState("postroll");var n=t.current<0?t.total:t.current,r=this._getAdsPriorTime(this.midrollAds,n),i=this._getAdsPriorTime(this.midrollAds,n+a);if(i.length&&this.props.preloadAd(i[0]),r.length)this.midrollAds.splice(this.midrollAds.length-r.length,r.length),this.props.beforePlayAd(c(r[0]),(function(){e._playAds(r)}));else{var o=this._getAdsPriorTime(this.midrollAds,n+s);if(o.length){var u=o[0].startTime-n;this.props.prepareAd(o[0],u)}}}}else this.ignoredFirstFrame=!0}},{key:"onContentEnded",value:function(){this.midrollAds.length&&this.logger.warn(this.name,"cannot play these mid-roll ads because start time is too late",this.midrollAds),this._playAds(this.postrollAds),this._reset()}},{key:"_reset",value:function(){this.ignoredFirstFrame=!1,this._setState(null),this.prerollAds=[],this.midrollAds=[],this.postrollAds=[]}},{key:"_setState",value:function(t){this.logger.info(this.name,"state changed from ".concat(this.state," to ").concat(t)),this.state=t}},{key:"_playAds",value:function(t){var e=this,n=[],r=[];return t.forEach((function(t){c(t)?n.push(t):r.push(t)})),this._playAd(n).then((function(){return e._playAd(r)}))}},{key:"_playAd",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=t[n];if(r){var i={order:n+1,total:t.length};return this.props.playAd(r,i).catch((function(t){e.logger.error(e.name,"error while playing ad",t)})).then((function(){return e._playAd(t,n+1)}))}return Promise.resolve()}},{key:"_getAdsPriorTime",value:function(t,e){for(var n=t.length-1;n>-1&&e>t[n].startTime;)--n;return t.slice(n+1).reverse()}}]),t}()},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function o(){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=u(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}}).apply(this,arguments)}
1function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var l=n(2),c=n(19),f=n(64),d=n(3),h=n(79),p=n(82);n(85),t.exports=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e)}(n,l);var e=function(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=u(t);if(e){var o=u(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return function(t,e){if(e&&("object"===r(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return s(t)}(this,n)}}(n);function n(t,r){var i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(i=e.call(this)).options=t,i.adContainers=r,i.$adContainer=new l({element:r.linear}),i.$adContainer.render(),i.adPlayer=null,i.adPaused=!1,i.adVolume=0,i.adVolumeCached=1,i.mouseEntered=!1,i._onClick=i._onClick.bind(s(i)),i._onMouseEnter=i._onMouseEnter.bind(s(i)),i._onMouseLeave=i._onMouseLeave.bind(s(i)),i._onSkipBtnClick=i._onSkipBtnClick.bind(s(i)),i._onViewDetailBtnClick=i._onViewDetailBtnClick.bind(s(i)),i.render(),i._registerEvents(),i.control.hide(),d.isMobile()&&(i.addClass("is_mobile"),i.$adContainer.off("mouseenter",i._onMouseEnter),i.$adContainer.off("mouseleave",i._onMouseLeave)),i}return function(t,e,n){e&&i(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1})}(n,[{key:"name",get:function(){return"ad_runner_ui"}},{key:"attributes",get:function(){return{class:this.name}}},{key:"render",value:function(){return o(u(n.prototype),"render",this).call(this),this.hide(),this.$uiLoading=new l({className:"ad_runner_ui_loading"}),this.$uiLoading.render(),this.$uiLoading.element.textContent="Äang tải quảng cáo...",this.$uiLoading.hide(),this.$uiViewDetail=new l({className:"ad_runner_ui_viewdetail"}),this.$uiViewDetail.render(),this.$uiViewDetail.element.textContent="Xem chi tiết quảng cáo",this.$uiAdIndex=new l({className:"ad_runner_ui_adindex"}),this.$uiAdIndex.render(),this.$uiAdIndex.hide(),this.countdownToPlay=new c({template:"Quảng cáo hiá»n thá» sau %ss",className:"ad_runner_ui_countdown_to_play"}),this.countdownToPlay.hide(),this.skipButton=new h({getPoster:this.options.getPoster}),this.control=new f(this),this.slideBlack=new p(this),this.appendChild(this.$uiViewDetail),this.appendChild(this.$uiAdIndex),this.appendChild(this.skipButton),this.appendChild(this.control),this.$adContainer.appendChild(this),this.adContainers.notification.appendChild(this.countdownToPlay.element),this.adContainers.notification.appendChild(this.$uiLoading.element),this.adContainers.notification.appendChild(this.slideBlack.element),this}},{key:"remove",value:function(){this._unregisterEvents(),this._stopSkipTimer(),this._stopProgressTimer(),this.skipButton.remove(),this.countdownToPlay.remove(),this.control.remove(),this.$uiLoading.remove(),this.slideBlack.remove(),o(u(n.prototype),"remove",this).call(this)}},{key:"setPlayer",value:function(t){this.adPlayer=t}},{key:"togglePlayPause",value:function(){this.adPlayer.isPaused()?(this.adPlayer.resume(),this._onPauseStateChanged(!1)):(this.adPlayer.pause(),this._onPauseStateChanged(!0))}},{key:"toggleMute",value:function(){var t=this.adPlayer.getVolume(),e=t?0:this.adVolumeCached;this.adPlayer.setVolume(e),this._onVolumeChanged(e),this.adVolumeCached=t}},{key:"onAdWillStart",value:function(){this.show(),this.$uiLoading.show(),this.$uiViewDetail.hide(),this.$uiAdIndex.hide(),this.skipButton.hide(),this.skipButton.loadPoster(),this.countdownToPlay.hide()}},{key:"onAdStarted",value:function(t){if(this.adPlayer.selfControl)return this.$uiLoading.hide(),void this.hide();this.adPlayer.canClickThrough?this.addClass("click-through"):this.removeClass("click-through"),this.adPlayer.isFacebookAd?this.addClass("facebook-ad"):this.removeClass("facebook-ad"),this.adPlayer.isGoogleImaAd?this.addClass("google-ima-ad"):this.removeClass("google-ima-ad"),this.$uiLoading.hide(),this.$uiViewDetail.show(),t&&t.total>1&&(this.$uiAdIndex.show(),this.$uiAdIndex.html("Quảng cáo ".concat(t.order," / ").concat(t.total))),this._startProgressTimer(),this.adPlayer.getSkipOffset()>-1&&(this.skipButton.show(),this.skipButton.update(this._getTimeToSkip()||5),this._startSkipTimer()),this._onVolumeChanged(this.adPlayer.getVolume())}},{key:"onAdStopped",value:function(){this._stopSkipTimer(),this._stopProgressTimer(),this.$uiLoading.hide(),this.hide()}},{key:"_registerEvents",value:function(){this.on("click",this._onClick),this.$adContainer.on("mouseenter",this._onMouseEnter),this.$adContainer.on("mouseleave",this._onMouseLeave),this.skipButton.on("click",this._onSkipBtnClick),this.$uiViewDetail.on("click",this._onViewDetailBtnClick)}},{key:"_unregisterEvents",value:function(){this.off("click",this._onClick),this.$adContainer.off("mouseenter",this._onMouseEnter),this.$adContainer.off("mouseleave",this._onMouseLeave),this.skipButton.off("click",this._onSkipBtnClick),this.$uiViewDetail.off("click",this._onViewDetailBtnClick)}},{key:"_startProgressTimer",value:function(){var t=this;this.progressTimer=setInterval((function(){var e={duration:t.adPlayer.getDuration(),remaining:t.adPlayer.getRemainingTime(),paused:t.adPlayer.isPaused()};t.control.onProgress(e);var n=t.adPlayer.getVolume();e.paused!==t.adPaused&&t._onPauseStateChanged(e.paused),n!==t.adVolume&&t._onVolumeChanged(n)}),1e3)}},{key:"_stopProgressTimer",value:function(){clearInterval(this.progressTimer),this.progressTimer=null}},{key:"_startSkipTimer",value:function(){var t=this;this._stopSkipTimer();var e=this._getTimeToSkip();this.skipTimer=setInterval((function(){var n=t._getTimeToSkip();t.adPlayer.isPaused()||(e-=1),n<=0||n-e>t.options.skipTimeout?(t.skipButton.skipOn(),t._stopSkipTimer()):t.skipButton.update(n)}),1e3)}},{key:"_stopSkipTimer",value:function(){this.skipTimer&&(clearInterval(this.skipTimer),this.skipTimer=null)}},{key:"_getTimeToSkip",value:function(){var t=this.adPlayer.getSkipOffset()+this.adPlayer.getRemainingTime()-this.adPlayer.getDuration();return t<0?5:t}},{key:"_onSkipBtnClick",value:function(t){var e=this;t.stopPropagation(),function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:400,n=arguments.length>2?arguments[2]:void 0;t.style.opacity||(t.style.opacity=1);var r=null;window.requestAnimationFrame((function i(o){var a=o-(r=r||o),s=parseFloat(1-a/e,2);t.style.opacity=s<0?0:s,a>e?"function"==typeof n&&n():window.requestAnimationFrame(i)}))}(this.adPlayer.element,300,(function(){e.adPlayer.skip(),e.adPlayer.element.style.opacity=null}))}},{key:"_onViewDetailBtnClick",value:function(t){t.stopPropagation(),this.adPlayer.viewDetail()}},{key:"_onClick",value:function(){this.togglePlayPause()}},{key:"_onMouseEnter",value:function(){this.mouseEntered=!0,!this.adPaused&&this.control.show()}},{key:"_onMouseLeave",value:function(){this.mouseEntered=!1,!this.adPaused&&this.control.hide()}},{key:"_onPauseStateChanged",value:function(t){this.adPaused=t,this.control.onPauseStateChanged(t,this.mouseEntered)}},{key:"_onVolumeChanged",value:function(t){this.adVolume=t,this.control.onMuteStateChanged(0===t)}}]),n}()},function(t,e,n){var r=n(63);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e,n){(t.exports=n(0)(!1)).push([t.i,".ad_runner_ui_countdown{background-color:rgba(0,0,0,0.4);color:#eee;font-size:12px;height:auto;line-height:18px;padding:5px;position:absolute;width:auto;top:10px;left:10px}\n",""])},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function o(){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=s(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}}).apply(this,arguments)}
1function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var u=n(2),l=n(65),c=n(68),f=n(71),d=n(74);n(77),t.exports=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e)}(n,u);var e=function(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=s(t);if(e){var o=s(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return function(t,e){if(e&&("object"===r(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,n)}}(n);function n(t){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(r=e.call(this)).adUi=t,r.render(),r}return function(t,e,n){e&&i(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1})}(n,[{key:"name",get:function(){return"ad_runner_ui_control"}},{key:"attributes",get:function(){return{class:this.name}}},{key:"show",value:function(){this.playpause.show(),this.volume.show(),this.timer.show(),this.removeClass("minimized"),this.adUi.addClass("has_control")}},{key:"hide",value:function(){this.playpause.hide(),this.volume.hide(),this.timer.hide(),this.addClass("minimized"),this.adUi.removeClass("has_control")}},{key:"remove",value:function(){this.timeline.remove(),this.playpause.remove(),this.volume.remove(),this.timer.remove(),o(s(n.prototype),"remove",this).call(this)}},{key:"render",value:function(){o(s(n.prototype),"render",this).call(this),this.timeline=new l,this.playpause=new c(this.adUi),this.timer=new d,this.volume=new f(this.adUi),this.appendChild(this.timeline),this.appendChild(this.playpause),this.appendChild(this.timer),this.appendChild(this.volume)}},{key:"onProgress",value:function(t){t.paused||(this.timeline.setPosition((t.duration-t.remaining)/t.duration*100),this.timer.update(t))}},{key:"onPauseStateChanged",value:function(t,e){t?this.show():e||this.hide(),this.playpause.onPauseStateChanged(t)}},{key:"onMuteStateChanged",value:function(t){this.volume.onMuteStateChanged(t)}}]),n}()},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function o(){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=s(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}}).apply(this,arguments)}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var u=n(2);n(66),t.exports=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e)}(n,u);var e=function(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=s(t);if(e){var o=s(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return function(t,e){if(e&&("object"===r(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,n)}}(n);function n(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(t=e.call(this)).render(),t}return function(t,e,n){e&&i(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1})}(n,[{key:"name",get:function(){return"ad_runner_ui_timeline"}},{key:"attributes",get:function(){return{class:this.name}}},{key:"render",value:function(){o(s(n.prototype),"render",this).call(this),this.$uiProgress=new u,this.$uiProgress.render(),this.appendChild(this.$uiProgress)}},{key:"setPosition",value:function(t){t<=100&&this.$uiProgress.style("width","".concat(t,"%"))}}]),n}()},function(t,e,n){var r=n(67);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e,n){(t.exports=n(0)(!1)).push([t.i,".ad_runner_ui_timeline{bottom:0;height:4px;left:0;position:absolute;width:100%}.ad_runner_ui_timeline>div{-webkit-transition:width 1s linear;-moz-transition:width 1s linear;-o-transition:width 1s linear;transition:width 1s linear;background-color:#ffff00;height:100%;width:0%}\n",""])},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function o(){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=u(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}}).apply(this,arguments)}
1function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var l=n(2);n(69);var c='<svg height="100%" version="1.1" viewBox="0 0 36 36" width="100%"><path d="M 12,26 16,26 16,10 12,10 z M 21,26 25,26 25,10 21,10 z"></path></svg>';t.exports=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e)}(n,l);var e=function(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=u(t);if(e){var o=u(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return function(t,e){if(e&&("object"===r(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return s(t)}(this,n)}}(n);function n(t){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(r=e.call(this)).adUi=t,r._onClickEvent=r._onClickEvent.bind(s(r)),r.render(),r._registerEvents(),r}return function(t,e,n){e&&i(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1})}(n,[{key:"name",get:function(){return"ad_runner_ui_playpause"}},{key:"attributes",get:function(){return{class:this.name}}},{key:"render",value:function(){o(u(n.prototype),"render",this).call(this),this.html(c)}},{key:"remove",value:function(){this._unregisterEvents(),o(u(n.prototype),"remove",this).call(this)}},{key:"onPauseStateChanged",value:function(t){t?this.html('<svg height="100%" version="1.1" viewBox="0 0 36 36" width="100%"><path d="M 12,26 18.5,22 18.5,14 12,10 z M 18.5,22 25,18 25,18 18.5,14 z"></path></svg>'):this.html(c)}},{key:"_registerEvents",value:function(){this.on("click",this._onClickEvent)}},{key:"_unregisterEvents",value:function(){this.off("click",this._onClickEvent)}},{key:"_onClickEvent",value:function(t){t.stopPropagation(),this.adUi.togglePlayPause()}}]),n}()},function(t,e,n){var r=n(70);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e,n){(t.exports=n(0)(!1)).push([t.i,".ad_runner_ui_playpause{width:35px;height:35px;float:left;margin-left:5px}.ad_runner_ui_playpause:hover{cursor:pointer}.ad_runner_ui_playpause>svg{fill:#f5f5f5}.ad_runner_ui_playpause:hover>svg,.ad_runner_ui_playpause:active>svg{fill:#ffffff}\n",""])},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function o(){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=u(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}}).apply(this,arguments)}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var l=n(2);n(72);
1var c='<svg height="100%" viewBox="0 0 36 36" width="100%"><path d="M8,21 L12,21 L17,26 L17,10 L12,15 L8,15 L8,21 Z M19,14 L19,22 C20.48,21.32 21.5,19.77 21.5,18 C21.5,16.26 20.48,14.74 19,14 Z M19,11.29 C21.89,12.15 24,14.83 24,18 C24,21.17 21.89,23.85 19,24.71 L19,26.77 C23.01,25.86 26,22.28 26,18 C26,13.72 23.01,10.14 19,9.23 L19,11.29 Z"></path></svg>';t.exports=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e)}(n,l);var e=function(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=u(t);if(e){var o=u(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return function(t,e){if(e&&("object"===r(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return s(t)}(this,n)}}(n);function n(t){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(r=e.call(this))._onClickEvent=r._onClickEvent.bind(s(r)),r.adUi=t,r.render(),r._registerEvents(),r}return function(t,e,n){e&&i(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1})}(n,[{key:"name",get:function(){return"ad_runner_ui_volume"}},{key:"attributes",get:function(){return{class:this.name}}},{key:"render",value:function(){o(u(n.prototype),"render",this).call(this),this.html(c)}},{key:"remove",value:function(){this._unregisterEvents(),o(u(n.prototype),"remove",this).call(this)}},{key:"onMuteStateChanged",value:function(t){t?this.html('<svg height="100%" viewBox="0 0 36 36" width="100%"><path d="m16.98686,9.984l0,4.219l-2.109,-2.109l2.109,-2.11zm-7.734,-0.984l16.734,16.734l-1.266,1.266l-2.063,-2.063c-1.078,0.844 -2.297,1.5 -3.656,1.828l0,-2.063c0.844,-0.234 1.594,-0.656 2.25,-1.172l-4.266,-4.266l0,6.75l-5.016,-5.016l-3.984,0l0,-6l4.734,0l-4.734,-4.734l1.267,-1.264zm14.718,9c0,-3.188 -2.063,-5.859 -4.969,-6.703l0,-2.063c4.031,0.891 6.984,4.5 6.984,8.766c0,1.5 -0.375,2.953 -1.031,4.172l-1.5,-1.547c0.328,-0.797 0.516,-1.688 0.516,-2.625zm-2.484,0c0,0.234 0,0.422 -0.047,0.609l-2.438,-2.438l0,-2.203c1.5,0.75 2.484,2.25 2.484,4.031l0.001,0.001z"></path></svg>'):this.html(c)}},{key:"_registerEvents",value:function(){this.on("click",this._onClickEvent)}},{key:"_unregisterEvents",value:function(){this.off("click",this._onClickEvent)}},{key:"_onClickEvent",value:function(t){t.stopPropagation(),this.adUi.toggleMute()}}]),n}()},function(t,e,n){var r=n(73);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e,n){(t.exports=n(0)(!1)).push([t.i,".ad_runner_ui_volume{width:35px;height:35px;float:right;margin-right:5px}.ad_runner_ui_volume:hover{cursor:pointer}.ad_runner_ui_volume>svg{fill:#f5f5f5}.ad_runner_ui_volume:hover>svg,.ad_runner_ui_volume:active>svg{fill:#ffffff}\n",""])},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function o(){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=s(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}}).apply(this,arguments)}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}
1function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var u=n(2),l=n(3).formatTime;n(75),t.exports=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e)}(n,u);var e=function(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=s(t);if(e){var o=s(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return function(t,e){if(e&&("object"===r(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,n)}}(n);function n(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(t=e.call(this)).render(),t}return function(t,e,n){e&&i(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1})}(n,[{key:"name",get:function(){return"ad_runner_ui_timer"}},{key:"attributes",get:function(){return{class:this.name}}},{key:"render",value:function(){o(s(n.prototype),"render",this).call(this),this.html("00:00 / 00:00")}},{key:"update",value:function(t){var e=l(t.duration-t.remaining),n=l(t.duration);this.html("".concat(e," / ").concat(n))}}]),n}()},function(t,e,n){var r=n(76);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e,n){(t.exports=n(0)(!1)).push([t.i,".ad_runner_ui_timer{color:#f5f5f5;float:left;margin-left:5px;height:35px;line-height:35px;font-size:12px}\n",""])},function(t,e,n){var r=n(78);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e,n){(t.exports=n(0)(!1)).push([t.i,".ad_runner_ui_control{-webkit-transition:height 100ms ease;-moz-transition:height 100ms ease;-o-transition:height 100ms ease;transition:height 100ms ease;background:linear-gradient(transparent, #000);bottom:0;height:40px;left:0;position:absolute;width:100%;pointer-events:none}.ad_runner_ui_control.minimized{background:none;height:5px}.ad_runner_ui_control>*{pointer-events:auto}\n",""])},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function o(){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=u(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}}).apply(this,arguments)}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var l=n(2),c=n(19);n(80),t.exports=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e)}(n,l);var e=function(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=u(t);if(e){var o=u(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return function(t,e){if(e&&("object"===r(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return s(t)}(this,n)}}(n);function n(t){var r,i=t.getPoster;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(r=e.call(this))._onPosterLoad=r._onPosterLoad.bind(s(r)),r.render(),r._registerEvents(),r.getPoster=i,r}return function(t,e,n){e&&i(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1})}(n,[{key:"attributes",get:function(){return{class:"ad_runner_ui_skip_button"}}},{key:"render",value:function(){o(u(n.prototype),"render",this).call(this),this.countdown=new c({template:"BỠqua quảng cáo sau %ss",className:"countdown"}),this.countdown.render(),this.update=this.countdown.update.bind(this.countdown),this.skipText=new l({className:"skip_text"}),this.skipText.render(),this.skipText.element.textContent="BỠqua",this.poster=new l({tagName:"img"}),this.poster.render(),this.poster.hide(),this.playIcon=new l({className:"play_icon"}),this.playIcon.render(),this.playIcon.html('<svg viewBox="12 12 24 24"><style type="text/css"> .st1{fill:none;stroke:#f1f1f1;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;} </style><g><g><path class="st1" d="M21.88173,28.00095l6.30217-3.67922c0.24333-0.14206,0.24348-0.49362,0.00028-0.63589l-6.30217-3.68663 c-0.2455-0.14361-0.5542,0.03345-0.5542,0.31786v7.36585C21.32781,27.9672,21.63623,28.14428,21.88173,28.00095z"/><circle class="st1" cx="24" cy="24" r="11.1667"/></g></g></svg>'),this.appendChild(this.skipText),this.appendChild(this.countdown),this.appendChild(this.poster),this.appendChild(this.playIcon)}},{key:"show",value:function(){o(u(n.prototype),"show",this).call(this),this.skipText.hide(),this.countdown.show(),this.removeClass("skippable")}},{key:"hide",value:function(){o(u(n.prototype),"hide",this).call(this),this.poster.hide(),this.removeClass("has_poster")}},{key:"remove",value:function(){this._unregisterEvents(),this.countdown.remove(),this.poster.remove(),this.skipText.remove(),this.playIcon.remove(),o(u(n.prototype),"remove",this).call(this)}},{key:"loadPoster",value:function(){var t=this;this.getPoster&&this.getPoster().then((function(e){t.poster.attr("src",e)}))}},{key:"skipOn",value:function(){this.skipText.show(),this.countdown.hide(),this.addClass("skippable")}},{key:"_onPosterLoad",value:function(){this.poster.show(),this.addClass("has_poster")}},{key:"_registerEvents",value:function(){this.poster.on("load",this._onPosterLoad)}},{key:"_unregisterEvents",value:function(){this.poster.off("load",this._onPosterLoad)}}]),n}()},function(t,e,n){var r=n(81);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e,n){(t.exports=n(0)(!1)).push([t.i,".ad_runner_ui_skip_button{background-color:rgba(0,0,0,0.4);color:#eee;font-size:12px;height:auto;line-height:18px;padding:5px;position:absolute;width:auto;-webkit-transition:bottom 100ms ease;-moz-transition:bottom 100ms ease;-o-transition:bottom 100ms ease;transition:bottom 100ms ease;background-color:#2b2a2a;align-items:center;border:1px solid rgba(72,72,72,0.4);bottom:35px;display:flex;height:42px;padding:0;pointer-events:none !important;right:0px;text-align:center}.ad_runner_ui_skip_button.skippable{pointer-events:auto !important;cursor:pointer}.ad_runner_ui_skip_button .countdown{padding:5px;max-width:100px}.ad_runner_ui_skip_button .skip_text{font-size:13px;width:100px}.ad_runner_ui_skip_button .play_icon{position:absolute;
1width:65px;height:30px;right:0;display:none}.ad_runner_ui_skip_button .play_icon svg{width:30px;height:30px}.ad_runner_ui_skip_button.skippable.has_poster .play_icon{display:block}.ad_runner_ui_skip_button img{height:38px;object-fit:cover;width:65px}.is_mobile .ad_runner_ui_skip_button{width:170px;justify-content:center}.is_mobile .ad_runner_ui_skip_button .countdown{max-width:120px}.ad_runner_ui.facebook-ad .ad_runner_ui_skip_button{background-color:#000}.ad_runner_ui.has_control .ad_runner_ui_skip_button{bottom:35px}\n",""])},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function o(){return(o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=s(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}}).apply(this,arguments)}function a(t,e){return(a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}n(83);var u=n(2);t.exports=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&a(t,e)}(n,u);var e=function(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=s(t);if(e){var o=s(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return function(t,e){if(e&&("object"===r(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,n)}}(n);function n(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(t=e.call(this,{className:"ad_runners_ui_slide_black"})).render(),t}return function(t,e,n){e&&i(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1})}(n,[{key:"fadeIn",value:function(){this.addClass("ad_ui_slide_black_fade_in")}},{key:"fadeOut",value:function(){this.removeClass("ad_ui_slide_black_fade_in")}},{key:"render",value:function(){o(s(n.prototype),"render",this).call(this),this.html('<span class="ad_message_text">Video ná»i dung sẽ tiếp tục sau Äoạn quảng cáo</span>'),this.hide()}}]),n}()},function(t,e,n){var r=n(84);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e,n){(t.exports=n(0)(!1)).push([t.i,".ad_runners_ui_slide_black{position:absolute;top:0;left:0;z-index:1;width:100%;height:100%;background-color:#000;opacity:0;-webkit-transition:opacity .3s linear;-moz-transition:opacity .3s linear;-o-transition:opacity .3s linear;transition:opacity .3s linear}.ad_runners_ui_slide_black.ad_ui_slide_black_fade_in{opacity:1}.ad_runners_ui_slide_black .ad_message_text{color:#eee;font-size:13px;position:absolute;left:10px;bottom:10px}\n",""])},function(t,e,n){var r=n(86);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e,n){(t.exports=n(0)(!1)).push([t.i,'.ad_runner_ui{left:0px;position:absolute;top:0px;width:100%;height:100%;z-index:2}.ad_runner_ui.click-through{pointer-events:none}.ad_runner_ui.click-through>*{pointer-events:auto}.ad_runner_ui.click-through .ad_runner_ui_viewdetail{display:none}.ad_runner_ui .ad_runner_ui_viewdetail{background-color:rgba(0,0,0,0.4);color:#eee;font-size:12px;height:auto;line-height:18px;padding:5px;position:absolute;width:auto;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAA2ElEQVQ4ja2U0U3DMBRFz0MM0BkyQleo2CAVm7ACYoaOUDagjJBs0G6A6AaHjzhSVcXGDtw/289H9z1fGbVXv83rCKBuCzWqwwPwBmz4D92Qt433+iVnawz0wDEtr/N+Myx1cEjLE/C6CpZAn0wzPkXE0+15New3UDXsDjQC+1xh8TVTvuYcDmo+RiVYEwh4bGhtFxHXTN0z8LXoTO3Uc40j9SUb2gT9ALqS
1o6o2I2JUR6ZkV4MWYQm4V7sWEBRyFhGXFlARtkahnpmG/Ve9z/9S6aet0aB2P+baSzgLyi9XAAAAAElFTkSuQmCC");background-position-x:calc(100% - 5px);background-position-y:center;background-repeat:no-repeat;background-size:12px;cursor:pointer;padding-right:20px;right:10px;top:10px}.ad_runner_ui .ad_runner_ui_adindex{background-color:rgba(0,0,0,0.4);color:#eee;font-size:12px;height:auto;line-height:18px;padding:5px;position:absolute;width:auto;background-color:transparent;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAAAXNSR0IArs4c6QAAAjVJREFUOBHlVEFrU0EQ/mb35TVtqqRKq0LaXhRbxbMggh5UKioePQserEcP4smjoHjoTUERvAi9eCmC9A+UCqJQJIJ6KAhNqlBLNE3y8nb89iV5SbB66bEDYb/9ZufLzOy8BXadia84Wi/MOCezgE6rYoTkEEQy3Bu6hZxfScFxUSIH1YigSm6D+6Ix+jgz9u2NROWJ87Fziz5gp2aNuWCcczd3KtSJ91oGghMdorPa4bsIR5eQ2b8IM3itQ8OEZ8ktIBwrIsg/B8xo6ksAtdgb6WNt7hZsbhZxdR4arSDY+xASngbsOEWesIMNxL/mKH6Svvv9gtQKyOR6WZO9TKFlxL/nSFuE2Yuw2Stw0QeIySHavAONv/JOfkLsZG+oxzkKqhdNTYKjcLWF9j6GuhI8J1pJOHXfk9VtzacxXaCBHwc/Cl2Ly+zCnnQvxOrWeWqzxclga7UF/tF0eq4NnOFU1XtZx3JNeIqHp2AGZljWQbZtmSW/S47Z7FV2YgLhyEv28EFvqJ/QutRK4yU25EDqkTxv8hVMcCShtLmKxo8zxDEFHsEOtW5dXQXRxvWk391YKUt9rVDkxE+lZBtIcJwZnoMdvo1m5R5c9UXiEXuY47IP2lxhRlt9YfzCPgX8nj4zw78EtfkRMX8uesuS36eBGn/xyW5v1DIKebq9t8VqY4mg9r8jqc9rJY9DbW3ykoi7wUyPqSCfPA
16QAdb078cBWk8eB+XjIFJUNc+yh1Zfp+q7B/wBa0XJ8tc9BKoAAAAASUVORK5CYII=");background-position-y:center;background-repeat:no-repeat;bottom:50px;left:15px;padding-left:25px;text-shadow:0 0 4px #000}.ad_runner_ui_countdown_to_play{background-color:rgba(0,0,0,0.4);color:#eee;font-size:12px;height:auto;line-height:18px;padding:5px;position:absolute;width:auto;top:10px;left:10px;z-index:1}.ad_runner_ui_loading{background-color:rgba(0,0,0,0.4);color:#eee;font-size:12px;height:auto;line-height:18px;padding:5px;position:absolute;width:auto;top:10px;left:10px}.ad_runner_ui_hide{display:none !important}\n',""])},function(t,e,n){function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function o(t,e){return(o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t})(t,e)}function a(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function s(){return(s="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=u(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}}).apply(this,arguments)}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}n(88);var l=n(2);t.exports=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e)}(n,l);var e=function(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,i=u(t);if(e){var o=u(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return function(t,e){if(e&&("object"===r(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return a(t)}(this,n)}}(n);function n(t){var r,i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),s((r=a(i=e.call(this,{className:"ad_runners_ui_ad_mark_container"})),u(n.prototype)),"render",r).call(r),i.containerElement=t,t&&t.appendChild(i.element),i}return function(t,e,n){e&&i(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1})}(n,[{key:"render",value:function(t,e){var n=this;this.containerElement&&e.forEach((function(e){var r=100*e.startTime/t;if(0<=r&&r<=100){var i=n._createAdMarkItem(r);n.appendChild(i),e.adMarkItem=i,e._completeAd=function(){i.remove()}}}))}},{key:"removeMarkItems",value:function(){this.html("")}},{key:"setContainer",value:function(t){t.appendChild(this.element)}},{key:"_createAdMarkItem",value:function(t){var e=document.createElement("span");return e.setAttribute("class","ad_runners_ui_ad_mark_container_item"),e.style.left="".concat(t,"%"),e}}]),n}()},function(t,e,n){var r=n(89);"string"==typeof r&&(r=[[t.i,r,""]]),n(1)(r,{hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(t.exports=r.locals)},function(t,e,n){(t.exports=n(0)(!1)).push([t.i,".ad_runners_ui_ad_mark_container{display:flex !important;width:100%;height:100%}.ad_runners_ui_ad_mark_container .ad_runners_ui_ad_mark_container_item{height:100%;width:5px;background-color:yellow;display:block;position:relative}\n",""])}])},function(t,e,n){"use strict";(function(t){"function"!=typeof t.Promise&&(t.Promise=n(2))}).call(this,n(3))},function(t,e,n){"use strict";(function(e){var n,r,i=e.MutationObserver||e.WebKitMutationObserver;if(i){var o=0,a=new i(c),s=e.document.createTextNode("");a.observe(s,{characterData:!0}
1),n=function(){s.data=o=++o%2}}else if(e.setImmediate||void 0===e.MessageChannel)n="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){c(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(c,0)};else{var u=new e.MessageChannel;u.port1.onmessage=c,n=function(){u.port2.postMessage(0)}}var l=[];function c(){var t,e;r=!0;for(var n=l.length;n;){for(e=l,l=[],t=-1;++t<n;)e[t]();n=l.length}r=!1}t.exports=function(t){1!==l.push(t)||r||n()}}).call(this,n(3))},function(t,e,n){var r=n(8);Object.getOwnPropertySymbols||(Object.getOwnPropertySymbols=r)},function(t,e,n){(function(e){!function(t,n){"use strict";if(!(n in t)){var r,i=typeof e==typeof i?window:e,o=0,a=String(Math.random()),s="__�symbol:",u=s.length,l="__�symbol@@"+a,c="defineProperty",f="defineProperties",d="getOwnPropertyNames",h="getOwnPropertyDescriptor",p="propertyIsEnumerable",y=t[d],v=t[h],g=t.create,m=t.keys,b=t.freeze||t,E=t[c],_=t[f],T=v(t,d),k=t.prototype,A=k.hasOwnProperty,S=k[p],w=k.toString,P=function(t,e,n){A.call(t,l)||E(t,l,{enumerable:!1,configurable:!1,writable:!1,value:{}}),t[l]["@@"+e]=n},L=function(t,e){var n=g(t);return y(e).forEach((function(t){D.call(e,t)&&B(n,t,e[t])})),n},O=function(){},R=function(t){return t!=l&&!A.call(M,t)},C=function(t){return t!=l&&A.call(M,t)},D=function(t){var e=String(t);return C(e)?A.call(this,e)&&!!this[l]&&this[l]["@@"+e]:S.call(this,t)},I=function(e){return E(k,e,{enumerable:!1,configurable:!0,get:O,set:function(t){r(this,e,{enumerable:!1,configurable:!0,writable:!0,value:t}),P(this,e,!0)}}),M[e]=E(t(e),"constructor",F),b(M[e])},x=function t(e){if(this instanceof t)throw new TypeError("Symbol is not a constructor");return I(s.concat(e||"",a,++o))},M=g(null),F={value:x},N=function(t){return M[t]},B=function(t,e,n){var i=String(e);return C(i)?(r(t,i,n.enumerable?function(t){var e=g(t);return e.enumerable=!1,e}(n):n),P(t,i,!!n.enumerable)):E(t,e,n),t},j=function(t){return y(t).filter(C).map(N)};T.value=B,E(t,c,T),T.value=j,E(t,n,T),T.value=function(t){return y(t).filter(R)},E(t,d,T),T.value=function(t,e){var n=j(e);return n.length?m(e).concat(n).forEach((function(n){D.call(e,n)&&B(t,n,e[n])})):_(t,e),t},E(t,f,T),T.value=D,E(k,p,T),T.value=x,E(i,"Symbol",T),T.value=function(t){var e=s.concat(s,t,a);return e in k?M[e]:I(e)},E(x,"for",T),T.value=function(t){if(R(t))throw new TypeError(t+" is not a symbol");if(A.call(M,t)){var e=t.slice(u);if(e.slice(0,u)===s&&(e=e.slice(u))!==a)return(e=e.slice(0,e.length-a.length)).length>0?e:void 0}},E(x,"keyFor",T),T.value=function(t,e){var n=v(t,e);return n&&C(e)&&(n.enumerable=D.call(t,e)),n},E(t,h,T),T.value=function(t,e){return 1===arguments.length||void 0===e?g(t):L(t,e)},E(t,"create",T),T.value=function(){var t=w.call(this);return"[object String]"===t&&C(this)?"[object Symbol]":t},E(k,"toString",T);try{if(!0!==g(E({},s,{get:function(){return E(this,s,{value:!0})[s]}}))[s])throw"IE11";r=E}catch(t){r=function(t,e,n){var r=v(k,e);delete k[e],E(t,e,n),E(k,e,r)}}}}(Object,"getOwnPropertySymbols"),function(t,e){"use strict";var n,r=t.defineProperty,i=t.prototype,o=i.toString,a="toStringTag";["iterator","match","replace","search","split","hasInstance","isConcatSpreadable","unscopables","species","toPrimitive",a].forEach((function(s){s in e||(r(e,s,{value:e(s)}),s===a&&((n=t.getOwnPropertyDescriptor(i,"toString")).value=function(){var t=o.call(this),n=null==this?this:this[e.toStringTag];return null==n?t:"[object "+n+"]"},r(i,"toString",n)))}))}(Object,Symbol),function(t,e,n){function r(){return this}e[t]||(e[t]=function(){var e=0,n=this,i={next:function(){var t=n.length<=e;return t?{done:t}:{done:t,value:n[e++]}}};return i[t]=r,i}),n[t]||(n[t]=function(){var e=String.fromCodePoint,n=this,i=0,o=n.length,a={next:function(){var t=o<=i,r=t?"":e(n.codePointAt(i));return i+=r.length,t?{done:t}:{done:t,value:r}}};return a[t]=r,a})}(Symbol.iterator,Array.prototype,String.prototype),t.exports=Object.getOwnPropertySymbols}).call(this,n(3))},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){var r={"./blue.scss":[33,1],"./green.scss":[34,2],"./light_blue.scss":[35,3],"./purple.
1scss":[36,4],"./red.scss":[37,5]};function i(t){var e=r[t];return e?n.e(e[1]).then((function(){var t=e[0];return n.t(t,7)})):Promise.resolve().then((function(){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}))}i.keys=function(){return Object.keys(r)},i.id=23,t.exports=i},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){},function(t,e,n){"use strict";n.r(e);var r={};n.r(r),n.d(r,"cloneDeep",(function(){return z})),n.d(r,"getDeep",(function(){return W})),n.d(r,"each",(function(){return q})),n.d(r,"extend",(function(){return X})),n.d(r,"objValuesToArray",(function(){return $}));var i={};n.r(i),n.d(i,"hasClass",(function(){return st})),n.d(i,"addClass",(function(){return ut})),n.d(i,"removeClass",(function(){return lt})),n.d(i,"toggleClass",(function(){return ct})),n.d(i,"setClass",(function(){return ft})),n.d(i,"setStyles",(function(){return dt})),n.d(i,"isEl",(function(){return ht})),n.d(i,"isTextNode",(function(){return pt})),n.d(i,"emptyEl",(function(){return yt})),n.d(i,"normalizeContent",(function(){return vt})),n.d(i,"appendContent",(function(){return gt})),n.d(i,"insertContent",(function(){return mt})),n.d(i,"textContent",(function(){return bt})),n.d(i,"createEl",(function(){return Et})),n.d(i,"createElFromHTML",(function(){return _t})),n.d(i,"getAttribute",(function(){return Tt})),n.d(i,"setAttribute",(function(){return kt})),n.d(i,"removeAttribute",(function(){return At})),n.d(i,"findPosition",(function(){return St})),n.d(i,"isOnViewport",(function(){return wt})),n.d(i,"getPointerPosition",(function(){return Pt})),n.d(i,"isSingleLeftClick",(function(){return Lt})),n.d(i,"removeFromDom",(function(){return Ot}));var o={};n.r(o),n.d(o,"IS_IPAD",(function(){return ae})),n.d(o,"IS_IPHONE",(function(){return se})),n.d(o,"IS_IPOD",(function(){return ue})),n.d(o,"IS_IOS",(function(){return le})),n.d(o,"IOS_VERSION",(function(){return ce})),n.d(o,"IS_ANDROID",(function(){return fe})),n.d(o,"ANDROID_VERSION",(function(){return de})),n.d(o,"IS_NATIVE_ANDROID",(function(){return he})),n.d(o,"IS_FIREFOX",(function(){return pe})),n.d(o,"IS_EDGE",(function(){return ye})),n.d(o,"IS_CHROME",(function(){return ve})),n.d(o,"CHROME_VERSION",(function(){return ge})),n.d(o,"IE_VERSION",(function(){return me})),n.d(o,"IS_SAFARI",(function(){return be})),n.d(o,"IS_ANY_SAFARI",(function(){return Ee})),n.d(o,"IS_MOBILE",(function(){return _e}));var a={};n.r(a),n.d(a,"createPromiseDefer",(function(){return Te}));var s={};n.r(s),n.d(s,"orderBy",(function(){return Ye})),n.d(s,"whereBy",(function(){return Ke})),n.d(s,"average",(function(){return ze})),n.d(s,"findWithAttr",(function(){return We}));var u={};n.r(u),n.d(u,"getHours",(function(){return ti})),n.d(u,"getMinutes",(function(){return ei})),n.d(u,"getSeconds",(function(){return ni})),n.d(u,"getCurrentTimeSeconds",(function(){return ri})),n.d(u,"formatTime",(function(){return ii}));var l={};n.r(l),n.d(l,"format",(function(){return Ca})),n.d(l,"escapeHtml",(function(){return Da})),n.d(l,"trimHtml",(function(){return Ia})),n.d(l,"trimAccents",(function(){return xa})),n.d(l,"startsWith",(function(){return Ma})),n.d(l,"endsWith",(function(){return Fa})),n.d(l,"generateId",(function(){return Na})),n.d(l,"getPercentage",(function(){return Ba})),n.d(l,"replaceAll",(function(){return ja})),n.d(l,"toTitleCase",(function(){return Ua})),n.d(l,"toPascalCase",(function(){return Ha})),n.d(l,"toCamelCase",(function(){return Ga})),n.d(l,"stripHTML",(function(){return Va})),n.d(l,"getHTML",(function(){return Ya}));var c={};n.r(c),n.d(c,"checkAdBlocker",(function(){return Ks}));var f={};n.r(f),n.d(f,"fetchUrl",(function(){return zs}));var d={};n.r(d),n.d(d,"fadeOut",(function(){return Gl})),n.d(d,"fadeIn",(function(){return Vl}));n(5),n(7);var h={};function p(t){return h[t]||(h[t]=0),t+ ++h[t]}function y(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var v="font-weight: bold; font-size: 13px;",g="color: #ff8000;"+v,m="color: #ff0000;"+v,b=["color: #0000ff;font-weight: bold; font-size: 13px;","color: #006600;font-weight: bold; font-size: 13px;",g,m,m],E=["debug","info","warn","error","disabled"],_=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.level=e,this.offLevel=n}var e,n;return e=t,(n=[{key:"debug",value:function(t){this.log(t,0,Array.prototype.slice.call(arguments,1
1))}},{key:"info",value:function(t){this.log(t,1,Array.prototype.slice.call(arguments,1))}},{key:"warn",value:function(t){this.log(t,2,Array.prototype.slice.call(arguments,1))}},{key:"error",value:function(t){this.log(t,3,Array.prototype.slice.call(arguments,1))}},{key:"onOff",value:function(){this.level===this.offLevel?this.level=this.previousLevel:(this.previousLevel=this.level,this.level=this.offLevel),window.console&&window.console.log&&window.console.log("%c[Zplayer.Log] set log level to "+E[this.level],g)}},{key:"level",value:function(t){this.level=t}},{key:"log",value:function(t,e,n){if(!(e<this.level)){n||(n=t,t=null);var r=b[e],i="";t&&(i="["+t+"]"),window.console&&window.console.log&&window.console.log.apply(console,["%c["+E[e]+"]"+i,r].concat(n))}}}])&&y(e.prototype,n),t}();function T(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function k(t){return(k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}_.LEVEL_DEBUG=0,_.LEVEL_INFO=1,_.LEVEL_WARN=2,_.LEVEL_ERROR=3,_.LEVEL_DISABLED=4,_.getInstance=function(){return void 0===this._instance&&(this._instance=new this,this._instance.previousLevel=this._instance.level,this._instance.level=this._instance.offLevel),this._instance},_.setLevel=function(t){this.getInstance().level=t},_.debug=function(){this.getInstance().debug.apply(this.getInstance(),arguments)},_.info=function(){this.getInstance().info.apply(this.getInstance(),arguments)},_.warn=function(){this.getInstance().warn.apply(this.getInstance(),arguments)},_.error=function(){this.getInstance().error.apply(this.getInstance(),arguments)};var A=Array.prototype.slice,S=/\s+/,w=function(t,e,n,r){if(!n)return!0;if("object"===k(n)){for(var i in n)t[e].apply(t,[i,n[i]].concat(r));return!1}if(S.test(n)){for(var o=n.split(S),a=0,s=o.length;a<s;a++)t[e].apply(t,[o[a]].concat(r));return!1}return!0},P=function(t,e,n,r){var i,o=-1,a=t.length,s=e[0],u=e[1],l=e[2];!function c(){try{switch(e.length){case 0:for(;++o<a;)(i=t[o]).callback.call(i.ctx);return;case 1:for(;++o<a;)(i=t[o]).callback.call(i.ctx,s);return;case 2:for(;++o<a;)(i=t[o]).callback.call(i.ctx,s,u);return;case 3:for(;++o<a;)(i=t[o]).callback.call(i.ctx,s,u,l);return;default:for(;++o<a;)(i=t[o]).callback.apply(i.ctx,e);return}}catch(t){_.error.apply(_,[n,"error on event",r,"trigger","-",t]),c()}}()},L=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,n,r;return e=t,r=[{key:"register",value:function(e){t.Custom||(t.Custom={});var n="string"==typeof e&&e.toUpperCase().trim();n&&!t.Custom[n]?t.Custom[n]=n.toLowerCase().split("_").map((function(t,e){return 0===e?t:t=t[0].toUpperCase()+t.slice(1)})).join(""):_.error("Events","Error when register event: "+e)}}],(n=[{key:"on",value:function(t,e,n){if(!w(this,"on",t,[e,n])||!e)return this;this._events||(this._events={});var r=this._events[t]||(this._events[t]=[]);return r?(r.push({callback:e,context:n,ctx:n||this}),this):this}},{key:"once",value:function(t,e,n){var r,i=this;if(!w(this,"once",t,[e,n])||!e)return this;var o=function(){return i.off(t,r)};return r=function(){o(),e.apply(this,arguments)},this.on(t,r,n)}},{key:"off",value:function(t,e,n){var r,i,o,a,s,u,l,c;if(!this._events||!w(this,"off",t,[e,n]))return this;if(!t&&!e&&!n)return this._events=void 0,this;for(s=0,u=(a=t?[t]:Object.keys(this._events)).length;s<u&&(t=a[s],o=this._events[t])&&(this._events[t]=r=[],e||n);s++){for(l=0,c=o.length;l<c;l++)i=o[l],(e&&e!==i.callback&&e!==i.callback._callback||n&&n!==i.context)&&r.push(i);r.length||delete this._events[t]}return this}},{key:"trigger",value:function(t){var e=this.name||this.constructor.name;if(!t)return _.warn.apply(_,[e,"trying to trigger undefined event, ignored"]),this;if(!this._events)return this;var n=A.call(arguments,1);if(!w(this,"trigger",t,n))return this;var r=this._events[t],i=this._events.all;return r&&P(r,n,e,t),i&&P(i,arguments,e,t),this}},{key:"stopListening",value:function(t,e,n){var r=this._listeningTo;if(!r)return this;var i=!e&&!n;for(var o in n||"object"!==k(e)||(n=this),t&&((r={}
1)[t._listenId]=t),r)(t=r[o]).off(e,n,this),(i||0===Object.keys(t._events).length)&&delete this._listeningTo[o];return this}}])&&T(e.prototype,n),r&&T(e,r),t}(),O={listenTo:"on",listenToOnce:"once"};Object.keys(O).forEach((function(t){L.prototype[t]=function(e,n,r){return(this._listeningTo||(this._listeningTo={}))[e._listenId||(e._listenId=p("l"))]=e,r||"object"!==k(n)||(r=this),e[O[t]](n,r,this),this}}));function R(t){return(R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function C(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function D(t,e){return(D=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function I(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=M(t);if(e){var i=M(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return x(this,n)}}function x(t,e){if(e&&("object"===R(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function M(t){return(M=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}["PLAYER_PLAY","PLAYER_PLAY_INTENT","PLAYER_PAUSE","PLAYER_STOP","PLAYER_ENDED","PLAYER_SEEK","PLAYER_SEEKED","PLAYER_SEEKING","PLAYER_ERROR","PLAYER_TIMEUPDATE","PLAYER_PROGRESS","PLAYER_FULLSCREEN","PLAYER_READY","PLAYER_BUFFERING","PLAYER_BUFFERING_CHANGE","PLAYER_BUFFERFULL","PLAYER_PRESS_PLAY","PLAYER_VOLUMEUPDATE","PLAYER_LOADEDMETADATA","PLAYER_CLICK","PLAYER_DBLCLICK","PLAYER_KEYDOWN","PLAYER_MOUSE_ENTER","PLAYER_MOUSE_LEAVE","PLAYER_MOUSE_MOVE","PLAYER_CONTEXTMENU","PLAYER_LEVELS_AVAILABEL","PLAYER_LEVEL_SWITCHED","PLAYER_SETTINGS_MENU_HIDE","PLAYER_QUALITY_LEVELS_SELECTED","PLAYER_UPDATE_SIZE","PLAYER_CANPLAYTHROUGH","PLAYER_WAITING","PLAYER_ORIENTATION_CHANGE","PLAYER_AD_PAUSE_REQUEST","PLAYER_AD_RESUME_REQUEST","PLAYER_AD_WILL_START","PLAYER_AD_STARTED","PLAYER_AD_STOPPED","PLAYER_AD_SKIPPED","PLAYER_AD_LOAD_TIMEOUT","PLAYER_MEDIACONTROL_DISABLE","PLAYER_MEDIACONTROL_ENABLE","PLAYER_MEDIACONTROL_SHOW","PLAYER_MEDIACONTROL_HIDE","PLAYER_MEDIACONTROL_READY","PLAYER_MEDIACONTROL_CLICK","PLAYER_MEDIACONTROL_DBLCLICK","PLAYER_DVRSTATECHANGED","PLAYER_THEATER_MODE_CHANGE","PLAYBACK_PROGRESS","PLAYBACK_TIMEUPDATE","PLAYBACK_BUFFERING","PLAYBACK_BUFFERING_CHANGE","PLAYBACK_BUFFERFULL","PLAYBACK_SETTINGSUPDATE","PLAYBACK_LOADEDMETADATA","PLAYBACK_VOLUMEUPDATE","PLAYBACK_HIGHDEFINITIONUPDATE","PLAYBACK_BITRATE","PLAYBACK_LEVELS_AVAILABLE","PLAYBACK_LEVEL_SWITCH_START","PLAYBACK_LEVEL_SWITCH_END","PLAYBACK_PLAYBACKSTATE","PLAYBACK_DVR","PLAYBACK_DVRSTATECHANGED","PLAYBACK_MEDIACONTROL_DISABLE","PLAYBACK_MEDIACONTROL_ENABLE","PLAYBACK_ENDED","PLAYBACK_PLAY_INTENT","PLAYBACK_PLAY","PLAYBACK_PAUSE","PLAYBACK_SEEKING","PLAYBACK_WAITING","PLAYBACK_SEEKED","PLAYBACK_STOP","PLAYBACK_ERROR","PLAYBACK_STATS_ADD","PLAYBACK_FRAGMENT_LOADED","PLAYBACK_LEVEL_SWITCHED","PLAYBACK_SUBTITLE_AVAILABLE","PLAYBACK_SUBTITLE_CHANGED","PLAYBACK_FULLSCREEN_IOS","PLAYBACK_CANPLAYTHROUGH","MEDIACONTROL_HIDE","MEDIACONTROL_SHOW","LOADING_SPINNER_HIDE","LOADING_SPINNER_SHOW","MEDIACONTROL_MOUSEMOVE_SEEKBAR","MEDIACONTROL_MOUSELEAVE_SEEKBAR"].forEach((function(t){L[t]=t}));var F=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&D(t,e)}(o,t);var e,n,r,i=I(o);function o(t,e){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),t&&(e=t.options),(n=i.call(this)).player=t,n._options=e,n.uniqueId=p("o"),n._nameEvents={}
1,n.constructor.NAME_EVENTS.forEach((function(t){L[t]=t,n._nameEvents[t]=t})),n}return e=o,r=[{key:"NAME_EVENTS",get:function(){return[]}}],(n=[{key:"options",get:function(){return this._options}},{key:"listenEvents",get:function(){return[]}},{key:"bindEvents",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.player;this.listenEvents.forEach((function(n){n.once?t.listenToOnce(n.target||e||t,n.name,n.handler):t.listenTo(n.target||e||t,n.name,n.handler)}))}},{key:"unbindEvents",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.player;this.listenEvents.forEach((function(n){n.once?t.stopListening(n.target||e||t,n.name):t.stopListening(n.target||e||t,n.name,n.handler)}))}}])&&C(e.prototype,n),r&&C(e,r),o}(L),N=function(t){return null!=t?t.constructor:null},B=function(t,e){return Boolean(t&&e&&t instanceof e)},j=function(t){return null==t},U=function(t){return N(t)===Object},H=function(t){return N(t)===String},G=function(t){return Array.isArray(t)},V=function(t){return B(t,NodeList)},Y=function(t){return j(t)||(H(t)||G(t)||V(t))&&!t.length||U(t)&&!Object.keys(t).length},K={nullOrUndefined:j,object:U,number:function(t){return N(t)===Number&&!Number.isNaN(t)},string:H,boolean:function(t){return N(t)===Boolean},function:function(t){return N(t)===Function},array:G,weakMap:function(t){return B(t,WeakMap)},nodeList:V,element:function(t){return B(t,Element)},textNode:function(t){return N(t)===Text},event:function(t){return B(t,Event)},cue:function(t){return B(t,window.TextTrackCue)||B(t,window.VTTCue)},track:function(t){return B(t,TextTrack)||!j(t)&&H(t.kind)},url:function(t){if(B(t,window.URL))return!0;var e=t;t.startsWith("http://")&&t.startsWith("https://")||(e="http://".concat(t));try{return!Y(new URL(e).hostname)}catch(t){return!1}},empty:Y};function z(t){return JSON.parse(JSON.stringify(t))}function W(t,e){return e.split(".").reduce((function(t,e){return t&&t[e]}),t)}function q(t,e){var n;(n=t,K.object(n)?Object.keys(n):[]).forEach((function(n){return e(t[n],n)}))}function X(t){t=t||{};for(var e=1,n=arguments.length;e<n;++e){var r=arguments[e];if(r)for(var i in r)r.hasOwnProperty(i)&&("[object Object]"!==Object.prototype.toString.call(r[i])?t[i]=r[i]:t[i]=X(t[i],r[i]))}return t}function $(t){return Object.values&&Object.values(t)||Object.keys(t).map((function(e){return t[e]}))}function Q(t){return(Q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function J(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Z(t,e){return(Z=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function tt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=nt(t);if(e){var i=nt(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return et(this,n)}}function et(t,e){if(e&&("object"===Q(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function nt(t){return(nt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var rt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Z(t,e)}(o,t);var e,n,r,i=tt(o);function o(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(e=i.call(this,t)).pluginOptions=e.getPluginOptions(),e.enabled=!0,e.pluginOptions.disabled&&e.disable(),e}return e=o,(n=[{key:"defaultOptions",get:function(){return{}}},{key:"initialize",value:function(){var t=this;return Promise.resolve().then((function(){return t.setUp()})).then((function(){return t.enabled&&t.bindEvents()}))}},{key:"getPluginOptions",value:function(){return X(this.defaultOptions,W(this._options,"pluginsOptions.".concat(this.name))||this.defaultOptions)}},{key:"setUp",value:function(){}},{key:"enable",value:function(){this.enabled||(this.bindEvents(),this.enabled=!0,_.debug(this.name,"enabled"))}},{key:"disable",value:function(){this.enabled&&(this.unbindEvents(),this.enabled=!1,_.debug(this.name,"disabled"))}},{key:"destroy",value:function(){this.disable(),this.player.removePlugin(this.name)}}])&&J(e.prototype,n),r&&J(e,r),o}(F),it=n(1),ot=n.n(it);function at(t){if(/\s/.test(t))throw new Error("class has illegal whitespace characters")}function st(t,e){return at(e),t.classList?t.classList.contains(e):(n=e,new RegExp("(^|\\s)"+n+"($|\\s)")).test(t.className);var n}function ut(t,e){return t.classList?t.classList.add(e):st(t,e)||(t.className=(t.className+" "+e).trim()),t}function lt(t,e){return t.classList?t.classList.remove(e):(at(e),t.className=t.className.split(/\s+/).filter((function(t){return t!==e})).join(" ")),t}function ct(t,e,n){if(t.classList)return void 0===n?t.classList.toggle(e):t.classList.toggle(e,n);var r=st(t,e);return"function"==typeof n&&(n=n(t,e)),"boolean"!=typeof n&&(n=!r),n!==r?(n?ut(t,e):lt(t,e),t):void 0}function ft(t,e){return t.className=e,t}function dt(t,e){for(var n in e)if(null===e[n]){var r=n.split(/(?=[A-Z])/).map((function(t){return t.toLowerCase()})).join("-");t.style.removeProperty(r)}else t.style[n]=e[n];return t}
1function ht(t){return K.object(t)&&1===t.nodeType}function pt(t){return K.object(t)&&3===t.nodeType}function yt(t){for(;t.firstChild;)t.removeChild(t.firstChild);return t}function vt(t){return"function"==typeof t&&(t=t()),(Array.isArray(t)?t:[t]).map((function(t){return"function"==typeof t&&(t=t()),ht(t)||pt(t)?t:"string"==typeof t&&/\S/.test(t)?document.createTextNode(t):void 0})).filter((function(t){return t}))}function gt(t,e){return vt(e).forEach((function(e){return t.appendChild(e)})),t}function mt(t,e){return gt(yt(t),e)}function bt(t,e){return void 0===t.textContent?t.innerText=e:t.textContent=e,t}function Et(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0,i=document.createElement(t);return Object.getOwnPropertyNames(e).forEach((function(t){var n=e[t];-1!==t.indexOf("aria-")||"role"===t||"type"===t?i.setAttribute(t,n):i[t]=n})),Object.getOwnPropertyNames(n).forEach((function(t){i.setAttribute(t,n[t])})),r&>(i,r),i}function _t(t){var e=document.createElement("div");return e.innerHTML=t,e.firstChild}function Tt(t,e){return t.getAttribute(e)}function kt(t,e,n){t.setAttribute(e,n)}function At(t,e){t.removeAttribute(e)}function St(t){var e;if(t.getBoundingClientRect&&t.parentNode&&(e=t.getBoundingClientRect()),!e)return{left:0,top:0};var n=document.documentElement,r=document.body,i=n.clientLeft||r.clientLeft||0,o=window.pageXOffset||r.scrollLeft,a=e.left+o-i,s=n.clientTop||r.clientTop||0,u=window.pageYOffset||r.scrollTop,l=e.top+u-s;return{left:Math.round(a),top:Math.round(l)}}function wt(t){if(t){var e=t.getBoundingClientRect();return e.height/2<=window.innerHeight-e.top&&e.bottom>=e.height/2}}function Pt(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r={},i=St(t),o=n?t.offsetHeight:t.offsetWidth,a=n?t.offsetWidth:t.offsetHeight,s=i.top,u=i.left,l=e.pageY,c=e.pageX;return e.changedTouches&&(c=e.changedTouches[0].pageX,l=e.changedTouches[0].pageY),r.y=Math.max(0,Math.min(1,(s-l+a)/a)),r.x=Math.max(0,Math.min(1,(c-u)/o)),r}function Lt(t){return void 0===t.button&&void 0===t.buttons||0===t.button&&void 0===t.buttons||0===t.button&&1===t.buttons}function Ot(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Rt(t){return(Rt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ct(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Dt(t,e){return(Dt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function It(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=Mt(t);if(e){var i=Mt(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return xt(this,n)}}function xt(t,e){if(e&&("object"===Rt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Mt(t){return(Mt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Ft=/^(\S+)\s*(.*)$/,Nt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Dt(t,e)}(o,t);var e,n,r,i=It(o);function o(t,e){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(n=i.call(this,t,e)).cid=p("c"),n.buildElement(),n.delegateEvents(),n}return e=o,r=[{key:"tagName",get:function(){return"div"}},{key:"events",get:function(){return{}}},{key:"attributes",get:function(){return{}}}],(n=[{key:"properties",get:function(){return{}}},{key:"$",value:function(t){return this.$el.find(t)}},{key:"setElement",value:function(t){return this.$el=ot.a.zepto.isZ(t)?t:ot()(t),this.el=this.$el[0],this}},{key:"buildElement",value:function(){if(this.el)this.setElement(this.el,!1);else{var t=X({},this.attributes);this.id&&(t.id=this.id);var e=X({},this.properties),n=Et(this.tagName,e,t);this.setElement(n,!1)}}},{key:"delegateEvents",value:function(t){if(!t&&!(t=this.events))return this;for(var e in t){var n=t[e];
1if(n&&n.constructor!==Function&&(n=this[t[e]]),n){var r=e.match(Ft),i=r[1],o=r[2];i+=".delegateEvents"+this.cid,""===o?this.$el.on(i,n.bind(this)):this.$el.on(i,o,n.bind(this))}}}},{key:"undelegateEvents",value:function(){return this.$el.off(".delegateEvents"+this.cid),this}},{key:"render",value:function(){return this}},{key:"remove",value:function(){return this.$el.remove(),this.unbindEvents(),this.undelegateEvents(),this}},{key:"getAttribute",value:function(t){return Tt(this.el,t)}},{key:"setAttribute",value:function(t,e){kt(this.el,t,e)}},{key:"removeAttribute",value:function(t){At(this.el,t)}},{key:"setStyles",value:function(t){dt(this.el,t)}},{key:"hasClass",value:function(t){return st(this.el,t)}},{key:"addClass",value:function(t){ut(this.el,t)}},{key:"removeClass",value:function(t){lt(this.el,t)}},{key:"toggleClass",value:function(t,e){ct(this.el,t,e)}},{key:"show",value:function(){this.removeClass("--z--hide")}},{key:"hide",value:function(){this.addClass("--z--hide")}}])&&Ct(e.prototype,n),r&&Ct(e,r),o}(F);function Bt(t){return(Bt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function jt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Ut(t,e){return(Ut=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Ht(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=Vt(t);if(e){var i=Vt(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Gt(this,n)}}function Gt(t,e){if(e&&("object"===Bt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Vt(t){return(Vt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Yt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Ut(t,e)}(o,t);var e,n,r,i=Ht(o);function o(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(e=i.call(this,t)).pluginOptions=e.getPluginOptions(),e.enabled=!0,e.pluginOptions.disabled&&e.disable(),e}return e=o,(n=[{key:"defaultOptions",get:function(){return{}}},{key:"initialize",value:function(){var t=this;return Promise.resolve().then((function(){return t.setUp()})).then((function(){return t.render()})).then((function(){return t.enabled&&t.bindEvents()}))}},{key:"getPluginOptions",value:function(){return X(this.defaultOptions,W(this._options,"pluginsOptions.".concat(this.name))||this.defaultOptions)}},{key:"setUp",value:function(){}},{key:"enable",value:function(){this.enabled||(this.bindEvents(),this.show(),this.enabled=!0,_.debug(this.name,"enabled"))}},{key:"disable",value:function(){this.enabled&&(this.unbindEvents(),this.hide(),this.enabled=!1,_.debug(this.name,"disabled"))}},{key:"destroy",value:function(){this.disable(),this.remove(),this.player.removePlugin(this.name)}}])&&jt(e.prototype,n),r&&jt(e,r),o}(Nt);n(9);function Kt(t){return(Kt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function zt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Wt(t,e){return(Wt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function qt(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=$t(t);if(e){var i=$t(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Xt(this,n)}}function Xt(t,e){if(e&&("object"===Kt(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function $t(t){return($t=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Qt=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Wt(t,e)}(o,t);var e,n,r,i=qt(o);function o(t){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),i.call(this,null,t)}return e=o,(n=[{key:"play",value:function(){throw new Error("this must be implemented")}},{key:"pause",value:function(){throw new Error("this must be implemented")}},{key:"stop",value:function(){}},{key:"seek",value:function(){}},{key:"seekPercentage",value:function(){}},{key:"getDuration",value:function(){return 0}},{key:"isPlaying",value:function(){return!1}},{key:"isReady",value:function(){throw new Error("this must be implemented")}},{key:"getPlaybackType",value:function(){return o.NO_OP}}
1,{key:"isHighDefinitionInUse",value:function(){return!1}},{key:"volume",value:function(){}},{key:"getVolume",value:function(){return 0}},{key:"isHlsPlayback",value:function(){return!1}},{key:"isMp4Playback",value:function(){return!1}},{key:"destroy",value:function(){this.remove()}}])&&zt(e.prototype,n),r&&zt(e,r),o}(Nt);Qt.canPlay=function(){return!1},Qt.VOD="vod",Qt.AOD="aod",Qt.LIVE="live",Qt.LIVE_END="live_end",Qt.NO_OP="no_op",Qt.type="playback";var Jt,Zt,te,ee,ne=Qt,re=window.navigator&&window.navigator.userAgent||"",ie=/AppleWebKit\/([\d.]+)/i.exec(re),oe=ie?parseFloat(ie.pop()):null,ae=/iPad/i.test(re),se=/iPhone/i.test(re)&&!ae,ue=/iPod/i.test(re),le=se||ae||ue,ce=(Jt=re.match(/OS (\d+)_/i))&&Jt[1]?Jt[1]:null,fe=/Android/i.test(re),de=function(){var t=re.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!t)return null;var e=t[1]&&parseFloat(t[1]),n=t[2]&&parseFloat(t[2]);return e&&n?parseFloat(t[1]+"."+t[2]):e||null}(),he=fe&&de<5&&oe<537,pe=/Firefox/i.test(re),ye=/Edge/i.test(re),ve=!ye&&(/Chrome/i.test(re)||/CriOS/i.test(re)),ge=(ee=re.match(/(Chrome|CriOS)\/(\d+)/))&&ee[2]?parseFloat(ee[2]):null,me=(!(te=(Zt=/MSIE\s(\d+)\.\d/.exec(re))&&parseFloat(Zt[1]))&&/Trident\/7.0/i.test(re)&&/rv:11.0/.test(re)&&(te=11),te),be=/Safari/i.test(re)&&!ve&&!fe&&!ye,Ee=(be||le)&&!ve,_e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|Windows Phone|IEMobile|Mobile Safari|Opera Mini/i.test(re);function Te(){var t={};return t.promise=new Promise((function(e,n){t.resolve=e,t.reject=n})),t}function ke(t){return(ke="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ae(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Se(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function we(t,e,n){return(we="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Re(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function Pe(t,e){return(Pe=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Le(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=Re(t);if(e){var i=Re(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Oe(this,n)}}function Oe(t,e){if(e&&("object"===ke(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Re(t){return(Re=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Ce(t){return function(t){if(Array.isArray(t))return De(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return De(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return De(t,e)}(t)||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 De(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var Ie={wav:["audio/wav"],mp3:["audio/mp3",'audio/mpeg;codecs="mp3"'],aac:['audio/mp4;codecs="mp4a.40.5"'],oga:["audio/ogg"]},xe=Object.keys(Ie).reduce((function(t,e){return[].concat(Ce(t),Ce(Ie[e]))}),[]),Me=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Pe(t,e)}(o,t);var e,n,r,i=Le(o);function o(){var t;Ae(this,o);for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];(t=i.call.apply(i,[this].concat(n)))._readyDeferred=Te(),t._destroyed=!1,t._loadStarted=!1,t._playheadMoving=!1,t._playheadMovingTimer=null,t._stopped=!1,t.isHlsPlayback()||t.setupSource(t.options.src),t.options.playback||(t.options.playback=t.options||{});var a=t.options.playback.preload||(be?"auto":t.options.preload);return X(t.el,{muted:t.options.mute,loop:t.options.loop,preload:a,autoPlay:t.options.autoPlay||!1}),t.options.playInline&&(t.setAttribute("webkit-playsinline",""),t.setAttribute("playsinline","")),t}return e=o,(n=[{key:"isAudioOnly",get:function(){var t=this.options.src,e=o._mimeTypesForUrl(t,Ie,this.options.mimeType);return this.options.playback&&this.options.playback.audioOnly||this.options.audioOnly||xe.indexOf(e[0])>=0}},{key:"events",get:function(){return{canplay:"_onCanPlay",canplaythrough:"_onCanplaythrough",error:"_onError",loadeddata:"_onLoadedData",loadedmetadata:"_onLoadedMetadata",stalled:"_onStalled",timeupdate:"_onTimeUpdate",waiting:"_onWaiting",pause:"_onPause",playing:"_onPlaying",progress:"_onProgress",seeking:"_onSeeking",seeked:"_onSeeked",ended:"_onEnded",webkitbeginfullscreen:"_onBeginFullScreen",webkitendfullscreen:"_onEndFullScreen"}}},{key:"ended",get:function(){return this.el.ended}},{key:"buffering",get:function(){return this._isBuffering}},{key:"setupSource",value:function(t){K.empty(t)||(this._src=t,this.el.src=t)}},{key:"getSource",value:function(){return this._src}},{key:"render",value:function(){return this._readyDeferred.resolve(),this}},{key:"isPlaying",value:function(){return!this.el.paused&&!this.el.ended}},{key:"isReady",value:function(){return this._readyDeferred.promise}},{key:"play",value:function(){return this._stopped=!1,this._handleBufferingEvents(),this.playProm
1ise=this.el.play(),_.debug(this.name,"PLAY_PROMISE",this.playPromise),this.playPromise}},{key:"pause",value:function(){var t=this;this.playPromise?this.playPromise.then((function(){return t.el.pause()})):this.el.pause()}},{key:"stop",value:function(){this.pause(),this._stopped=!0,this._stopPlayheadMovingChecks(),this._handleBufferingEvents(),this.trigger(L.PLAYBACK_STOP)}},{key:"volume",value:function(t){t<0||t>100||(0===t?this.mute():this.unmute(),this.el.volume=t/100,this.trigger(L.PLAYBACK_VOLUMEUPDATE,t))}},{key:"getVolume",value:function(){return this.el.volume}},{key:"mute",value:function(){this.$el.attr({muted:"true"}),this.el.muted=!0}},{key:"unmute",value:function(){this.$el.attr({muted:null}),this.el.muted=!1}},{key:"isMuted",value:function(){return this.el.muted}},{key:"seek",value:function(t){K.number(t)&&(this.el.currentTime=t)}},{key:"seekPercentage",value:function(t){var e=this.el.duration*(t/100);this.seek(e)}},{key:"getCurrentTime",value:function(){this.el.currentTime}},{key:"getDuration",value:function(){return this.el.duration}},{key:"setPlaybackRate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this.el.playbackRate=t}},{key:"setPreload",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"metadata";return this.el.preload=t,this}},{key:"destroy",value:function(){this._destroyed=!0,we(Re(o.prototype),"destroy",this).call(this),this.el.removeAttribute("src"),this._src=null}},{key:"_now",value:function(){return Date.now()}},{key:"_onCanPlay",value:function(){this._handleBufferingEvents()}},{key:"_onCanplaythrough",value:function(t){this._handleBufferingEvents(),this.trigger(L.PLAYBACK_CANPLAYTHROUGH,{time:this._now(),data:t})}},{key:"_onError",value:function(){var t=this.el.error;if(t){var e={code:t.code,description:t.message,raw:t};this.trigger(L.PLAYBACK_ERROR,e)}else _.warn(this.name,"HTML5 media unknown error")}},{key:"_onWaiting",value:function(t){this._handleBufferingEvents(),this.trigger(L.PLAYBACK_WAITING,{time:this._now(),data:t}),this._loadStarted=!0}},{key:"_onLoadedData",value:function(){this._loadStarted=!0,this._handleBufferingEvents()}},{key:"_onLoadedMetadata",value:function(t){this._handleBufferingEvents(),this.trigger(L.PLAYBACK_LOADEDMETADATA,{duration:t.target.duration,data:t})}},{key:"_onStalled",value:function(){this._handleBufferingEvents()}},{key:"_onTimeUpdate",value:function(){this.trigger(L.PLAYBACK_TIMEUPDATE,{current:this.el.currentTime,total:this.el.duration})}},{key:"_onProgress",value:function(){if(this.el.buffered.length){for(var t=this.el.buffered.length,e=[],n=0,r=0;r<t;r++)e=[].concat(Ce(e),[{start:this.el.buffered.start(r),end:this.el.buffered.end(r)}]),this.el.currentTime>=e[r].start&&this.el.currentTime<=e[r].end&&(n=r);var i={start:e[n].start,current:e[n].end,total:this.el.duration};this.trigger(L.PLAYBACK_PROGRESS,i,e)}}},{key:"_onPause",value:function(){this._stopPlayheadMovingChecks(),this._handleBufferingEvents(),this.trigger(L.PLAYBACK_PAUSE)}},{key:"_onPlaying",value:function(){this._startPlayheadMovingChecks(),this._handleBufferingEvents(),this.trigger(L.PLAYBACK_PLAY)}},{key:"_onSeeking",value:function(t){this._handleBufferingEvents(),this.trigger(L.PLAYBACK_SEEKING,{time:this._now(),data:t})}},{key:"_onSeeked",value:function(){this._handleBufferingEvents(),this.trigger(L.PLAYBACK_SEEKED)}},{key:"_onEnded",value:function(){this._handleBufferingEvents(),this.trigger(L.PLAYBACK_ENDED,this.name)}},{key:"_handleBufferingPercent",value:function(){if("html5_video"===this.name&&(1===this.el.networkState||2===this.el.networkState)){for(var t,e=this.el.buffered.length,n=this.el.currentTime,r=0,i=0;i<e;i++){var o=this.el.buffered.end(i);(o<=n&&o>r||this.el.buffered.start(i)<=n&&o>=n)&&(r=o)}t=100/6*(6-(n+3-r)),this.trigger(L.PLAYBACK_BUFFERING_CHANGE,t)}}},{key:"_handleBufferingEvents",value:function(){this._handleBufferingPercent();var t=!this.el.ended&&!this.el.paused,e=this._loadStarted&&!this.el.ended&&!this._stopped&&(t&&!this._playheadMoving||this.el.readyState<this.el.HAVE_FUTURE_DATA);this._isBuffering!=e&&(this._isBuffering=e,e?this.trigger(L.PLAYBACK_BUFFERING,this.name):this.trigger(L.PLAYBACK_BUFFERFULL,this.name))}},{key:"_startPlayheadMovingChecks",value:function(){null===this._playheadMovingTimer&&(this._playheadMovingTimeOnCheck=null,this._determineIfPlayheadMoving(),this._playheadMovingTimer=setInterval(this._determineIfPlayheadMoving.bind(this),500))}},{key:"_stopPlayheadMovingChecks",value:function(){null!==this._playheadMovingTimer&&(clearInterval(this._playheadMovingTimer),this._playheadMovingTimer=null,this._playheadMoving=!1)}},{key:"_determineIfPlayheadMoving",value:function(){var t=this._playheadMovingTimeOnCheck,e=this.el.currentTime;this._playheadMoving=t!==e,this._playheadMovingTimeOnCheck=e,this._handleBufferingEvents()}},{key:"_onBeginFullScreen",value:function(){this.trigger(L.PLAYBACK_FULLSCREEN_IOS,!0)}},{key:"_onEndFullScreen",value:function(){this.trigger(L.PLAYBACK_FULLSCREEN_IOS,!1)}},{key:"getPlaybackType",value:function(){throw new Error("this must be implemented")}}])&&Se(e.prototype,n),r&&Se(e,r),o}(ne);function Fe(t){return(Fe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ne(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Be(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function je(t,e){return(je=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Ue(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=Ge(t);if(e){var i=Ge(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return He(this,n)}}function He(t,e){if(e&&("object"===Fe(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Ge(t){return(Ge=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}Me._mimeTypesForUrl=function(t,e,n){var r=(t.split("?")[0].match(/.*\.(.*)$/)||[])[1],i=n||r&&e[r.toLowerCase()]||[];return i.constructor===Array?i:[i]},Me._canPlay=function(t,e,n,r){var i=Me._mimeTypesForUrl(n,e,r),o=document.createElement(t);return!!i.filter((function(t){return!!o.canPlayType(t).replace(/no/,"")}))[0]};var Ve=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&je(t,e)}(o,t);var e,n,r,i=Ue(o);function o(){return Ne(this,o),i.apply(this,arguments)}return e=o,(n=[{key:"name",get:function(){return"html5_video"}},{key:"tagName",get:function(){return this.isAudioOnly?"audio":"video"}},{key:"attributes",get:function(){return{"data-html5-video":""}}},{key:"getPlaybackType",value:function(){var t=ne.VOD;return[0,void 0,1/0].indexOf(this.el.duration)>=0?ne.LIVE:t}},{key:"isMp4Playback",value:function(){return!0}}])&&Be(e.prototype,n),r&&Be(e,r),o}(Me);function Ye(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(K.array(t)&&e)return t.sort((function(t,r){return n?t[e]-r[e]:r[e]-t[e]}))}function Ke(t,e,n){if(K.array(t))return t.filter((function(t){return t[e]===n})).shift()}function ze(t){return t.length?t.reduce((function(t,e){return t+e}),0)/t.length:0}function We(t,e,n){for(var r=t.length,i=0;i<r;i++)if(t[i][e]===n)return i;return-1}Ve.canPlay=function(t,e){var n={mp4:["avc1.42E01E","avc1.58A01E","avc1.4D401E","avc1.64001E","mp4v.20.8","mp4v.20.240","mp4a.40.2"].map((function(t){return'video/mp4; codecs="'+t+', mp4a.40.2"'})),ogg:['video/ogg; codecs="theora, vorbis"','video/ogg; codecs="dirac"','video/ogg; codecs="theora, speex"'],"3gpp":['video/3gpp; codecs="mp4v.20.8, samr"'],webm:['video/webm; codecs="vp8, vorbis"'],mkv:['video/x-matroska; codecs="theora, vorbis"'],m3u8:["application/x-mpegurl"]};return n.ogv=n.ogg,n["3gp"]=n["3gpp"],Me._canPlay("video",n,t,e)};var qe=n(0),Xe=n.n(qe);function $e(t){return($e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Qe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Je(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Ze(t,e,n){return(Ze="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=on(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}
1function tn(t,e){return(tn=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function en(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=on(t);if(e){var i=on(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return nn(this,n)}}function nn(t,e){if(e&&("object"===$e(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return rn(t)}function rn(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function on(t){return(on=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var an={startLevel:-1},sn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&tn(t,e)}(o,t);var e,n,r,i=en(o);function o(){var t;Qe(this,o);for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n)))._config={hls:W(t.options,"playback.hls")||an,recoverMaxRetry:W(t.options,"playback.hls.recoverMaxRetry")||16},t._recoverRetry=0,t._recoveredMediaError=!1,t._playbackType=ne.VOD,t._onHLSJSError=t._onHLSJSError.bind(rn(t)),t._initHls(),t}return e=o,r=[{key:"canPlay",value:function(t,e){var n=t.split("?")[0].match(/.*\.(.*)$/)||[];return(n.length>1&&"m3u8"===n[1].toLowerCase()||"application/x-mpegURL"===e||"application/vnd.apple.mpegurl"===e)&&Xe.a.isSupported()}}],(n=[{key:"name",get:function(){return"hls"}},{key:"tagName",get:function(){return this.isAudioOnly?"audio":"video"}},{key:"levels",get:function(){return this._levels||[]}},{key:"currentLevel",get:function(){return null===this._currentLevel||void 0===this._currentLevel?-1:this._currentLevel},set:function(t){var e=this;this.playPromise&&this.playPromise.then((function(){e._currentLevel=t,e._hls&&(e._hls.currentLevel=e._currentLevel)}))}},{key:"startLevel",get:function(){return this._startLevel},set:function(t){var e=this;this.playPromise&&this.playPromise.then((function(){e._startLevel=t,e._hls&&(e._hls.startLevel=e._startLevel)}))}},{key:"stop",value:function(){Ze(on(o.prototype),"stop",this).call(this),this._hls.destroy(),delete this._hls}},{key:"isHlsPlayback",value:function(){return!0}},{key:"_initHls",value:function(){var t=this,e=new Xe.a(this._config.hls);e.on(Xe.a.Events.MEDIA_ATTACHED,(function(){return e.loadSource(t.options.src)})),e.on(Xe.a.Events.ERROR,this._onHLSJSError),e.once(Xe.a.Events.LEVEL_LOADED,this._updatePlaybackType.bind(this)),e.on(Xe.a.Events.LEVEL_SWITCH,this._onLevelSwitch.bind(this)),e.on(Xe.a.Events.LEVEL_SWITCHED,this._onLevelSwitched.bind(this)),e.on(Xe.a.Events.FRAG_LOAD_PROGRESS,this._onFragLoadingProgress.bind(this)),e.on(Xe.a.Events.FRAG_LOADED,this._onFragLoadedProgress.bind(this)),e.attachMedia(this.el),this._hls=e}},{key:"_updatePlaybackType",value:function(t,e){_.debug(this.name,"_updatePlaybackType",e),this._playbackType=e.details.live?ne.LIVE:e.details.startSN>0?ne.LIVE_END:ne.VOD,this.trigger(L.PLAYBACK_DVRSTATECHANGED),this._fillLevels(),_.debug(this.name,"LEVELS",this._levels),this.initLevelFromLocalStorage()}},{key:"_onLevelSwitch",value:function(t,e){_.debug(this.name,"_onLevelSwitch",e)}},{key:"_onLevelSwitched",value:function(t,e){_.debug(this.name,"_onLevelSwitched",e);var n=Ke(this.levels,"index",e.level);this.trigger(L.PLAYBACK_LEVEL_SWITCHED,n)}},{key:"_addingSuffixCharacter",value:function(t){var e=t.toString().toLowerCase();return e.indexOf("p")>-1?e:e+"p"}},{key:"_generateLabel",value:function(t){return t.name||Math.ceil(t.bitrate/1e3)}},{key:"_fillLevels",value:function(){var t=this;K.empty(this._levels)&&(this._levels=this._hls.levels.map((function(e,n){return{index:n,level:e,label:t._addingSuffixCharacter(t._generateLabel(e))}})),this._levels.unshift({index:-1,label:"Auto"}),this.trigger(L.PLAYBACK_LEVELS_AVAILABLE,this._levels))}},{key:"initLevelFromLocalStorage",value:function(){if(K.array(this._levels)&&this.options.quality){var t=Ke(this._levels,"label",this.options.quality);K.object(t)&&K.object(t.level)&&(this.currentLevel=t.index,this.startLevel=t.index)}}},{key:"_recoverMediaError",value:function(t){return this._recoverRetry+=1,this._recoverRetry>this._config.recoverMaxRetry?(_.error(this.name,"could not recover from error after maximum number of attempts",t),this.trigger(L.PLAYBACK_ERROR,t),void this.stop()):(_.warn(this.name,"re
1covering fatal error (".concat(this._recoverRetry,"/").concat(this._config.recoverMaxRetry,"):"),t),this._recoveredMediaError?(this._hls.swapAudioCodec(),void this._hls.recoverMediaError()):(this._recoveredMediaError=!0,void this._hls.recoverMediaError()))}},{key:"_onError",value:function(){var t=this.el.error;if(t){var e=t.code,n={code:e,description:t.message,raw:t};if(e===t.MEDIA_ERR_DECODE)return this._recoverMediaError(n);this.trigger(L.PLAYBACK_ERROR,n)}else _.warn(this.name,"HTML5 video unknown error")}},{key:"_onHLSJSError",value:function(t,e){if(e.fatal){var n={code:"".concat(e.type,"_").concat(e.details),description:e.reason||(e.response?"status: ".concat(e.response.code,", text: ").concat(e.response.text):"unknown"),raw:e};return e.type===Xe.a.ErrorTypes.NETWORK_ERROR&&e.response.code<400?(_.debug(this.name,"recovering network error, user may be offline:",n),void this._hls.startLoad()):e.type!==Xe.a.ErrorTypes.MEDIA_ERROR?(_.error(this.name,"unrecoverable fatal error: ".concat(e.type),n),this.trigger(L.PLAYBACK_ERROR,n),void this.stop()):void this._recoverMediaError(n)}}},{key:"_onTimeUpdate",value:function(){this.el.duration&&this.trigger(L.PLAYBACK_TIMEUPDATE,{current:this.el.currentTime,total:this.el.duration})}},{key:"_onFragLoadingProgress",value:function(t,e){var n=100/e.stats.total*e.stats.loaded;this.trigger(L.PLAYBACK_BUFFERING_CHANGE,n)}},{key:"_onFragLoadedProgress",value:function(){this.trigger(L.PLAYBACK_BUFFERFULL,this.name)}},{key:"getPlaybackType",value:function(){return this._playbackType}}])&&Je(e.prototype,n),r&&Je(e,r),o}(Me);function un(t){return(un="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ln(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function cn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function fn(t,e,n){return(fn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=yn(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function dn(t,e){return(dn=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function hn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=yn(t);if(e){var i=yn(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return pn(this,n)}}function pn(t,e){if(e&&("object"===un(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function yn(t){return(yn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var vn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&dn(t,e)}(o,t);var e,n,r,i=hn(o);function o(){var t;ln(this,o);for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return(t=i.call.apply(i,[this].concat(n)))._ready=!1,t._readyDeferred=Te(),t._isSeeking=!1,t}return e=o,r=[{key:"canPlay",value:function(t){return this.isYTVideo(t)}},{key:"isYTVideo",value:function(t){return!!t.match(/^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/)&&RegExp.$1}}],(n=[{key:"name",get:function(){return"youtube_playback"}},{key:"attributes",get:function(){return{"data-youtube-playback":"",class:"zplayer-youtube-playback",style:"height:100%",id:this.cid}}},{key:"buffering",get:function(){return!1}},{key:"ready",value:function(){this._ready=!0,this.$el.hide(),this._readyDeferred.resolve()}},{key:"qualityChange",value:function(){this.trigger(L.PLAYBACK_HIGHDEFINITIONUPDATE)}},{key:"stateChange",value:function(t){switch(t.data){case window.YT.PlayerState.PLAYING:this.$el.show(),this.trigger(L.PLAYBACK_PLAY),this._isSeeking&&(this._isSeeking=!1,this.trigger(L.PLAYBACK_SEEKED));break;case window.YT.PlayerState.PAUSE:this.$el.hide(),this.trigger(L.PLAYBACK_PAUSE);break;case window.YT.PlayerState.ENDED:this.ended(),this.seek(0),this.stop();break;default:this.$el.show()}}},{key:"play",value:function(){var t=this;this._progressTimer=this._progressTimer||setInterval((function(){return t.progress()}),100),this._timeupdateTimer=setInterval((function(){return t.timeupdate()}),100),this.player.playVideo(),this.trigger(L.PLAYBACK_PLAY),this.trigger(L.PLAYBACK_BUFFERFULL)}},{key:"pause",value:function(){this.clearTimer(),this.player&&this.player.pauseVideo(),this.trigger(L.PLAYBACK_PAUSE)}},{key:"seek",value:function(t){this.player&&(this.player.seekTo(t),this._isSeeking=!0,setTimeout((function(){}),100))}},{key:"ended",value:function(){this.trigger(L.PLAYBACK_ENDED)}},{key:"stop",value:function(){this.player.stopVideo(),this.clearTimer()}},{key:"volume",value:function(t){this.player&&(this.player.setVolume(t),t<=0?this.player.mute():this.player.unMute(),this.trigger(L.PLAYBACK_VOLUMEUPDATE,t))}},{key:"isMuted",value:function(){return this.player&&this.player.isMuted()}},{key:"getVolume",value:function(){return this.player&&this.player.getVolume()}},{key:"progress",value:function(){var t=this.player.getDuration()*this.player.getVideoLoadedFraction();this.trigger(L.PLAYBACK_PROGRESS,0,t,this.player.getDuration())}},{key:"timeupdate",value:function(){this.trigger(L.PLAYBACK_TIMEUPDATE,{current:this.player.getCurrentTime(),total:this.player.getDuration()})}},{key:"isPlaying",value:function(){return this.player&&this._timeupdateTimer&&this.player.getPlayerState()==window.YT.PlayerState.PLAYING}},{key:"isReady",value:function(){return this._readyDeferred.promise}},{key:"getDuration",value:function(){var t=0;return this.player&&(t=this.player.getDuration()),parseFloat(t)}},{key:"render",value:function(){var t=this;return this.el.append(Et("div",{},{id:"yt".concat(this.cid)})),setTimeout((function(){t._setupYoutubePlayer()}),1),this}},{key:"setPlaybackRate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;this.player.setPlaybackRate(t)}},{key:"_setupYoutubePlayer",value:function(){window.YT&&window.YT.Player?this._embedYoutubePlayer():this._embedYoutubeApiScript()}},{key:"_getVideoId",value:function(t){return void 0!==(t=t.split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/))[2]?t[2].split(/[^0-9a-z_\-]/i)[0]:t[0]}},{key:"_embedYoutubeApiScript",value:function(){var t=this,e=document.createElement("script");e.setAttribute("type","text/javascript"),e.setAttribute("async","async"),e.setAttribute("src","https://www.youtube.com/iframe_api"),document.body.appendChild(e),window.onYouTubeIframeAPIReady=function(){return t._embedYoutubePlayer()}}},{key:"_embedYoutubePlayer",value:function(){var t=this,e={controls:0,autoplay:this.options.autoPlay?1:0,disablekb:1,rel:0,enablejsapi:1,iv_load_policy:3,modestbranding:1,showinfo:0,html5:1,playsinline:this.options.playInline?1:0};this.player=new window.YT.Player("yt".concat(this.cid),{videoId:this._getVideoId(this.options.source),playerVars:e,width:"100%",height:"100%",events:{onReady:function(){return t.ready()},onStateChange:function(e){return t.stateChange(e)},onPlaybackQualityChange:function(e){return t.qualityChange(e)}}})}},{key:"getPlaybackType",value:function(){return ne.VOD}},{key:"clearTimer",value:function(){clearInterval(this._timeupdateTimer),clearInterval(this._progressTimer),this._timeupdateTimer=null,this._progressTimer=null}},{key:"destroy",value:function(){this.clearTimer(),fn(yn(o.prototype),"destroy",this).call(this),this.stop(),this.player.destroy(),this.player=null}}])&&cn(e.prototype,n),r&&cn(e,r),o}(ne);n(10);function gn(t){return(gn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function mn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function bn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}
1function En(t,e){return(En=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function _n(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=kn(t);if(e){var i=kn(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Tn(this,n)}}function Tn(t,e){if(e&&("object"===gn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function kn(t){return(kn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var An=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&En(t,e)}(o,t);var e,n,r,i=_n(o);function o(){return mn(this,o),i.apply(this,arguments)}return e=o,r=[{key:"canPlay",value:function(){return!0}}],(n=[{key:"name",get:function(){return"no_op"}},{key:"attributes",get:function(){return{"data-no-op":""}}},{key:"render",value:function(){var t=Et("p",{innerHTML:"Your browser does not support the playback of this video. Please try using a different browser."},{"data-no-op-msg":""});return this.el.append(t),this}},{key:"isReady",value:function(){return Promise.resolve()}}])&&bn(e.prototype,n),r&&bn(e,r),o}(ne),Sn=(n(11),"--z--hide"),wn="--z--full-width",Pn="--z--bg-transparent",Ln="--z--fadeout",On={layout:{left:["playpause","volume","time"],right:["settings","fullscreen"],default:["seekbar"]},type:{fullWidth:!1},alwaysShowControl:!1,showOnPauseMobile:!1,disabledAutoHide:!1,hideAnimation:!1,theme:"",disabled:!1},Rn={BG_TYPE_TRANSPARENT:"transparent",BG_TYPE_GRADIENT:"gradient",THEME:{RED:"red",BLUE:"blue",PURPLE:"purple",GREEN:"green",LIGHT_BLUE:"light_blue"},MAP_THEME_COLOR:{RED:"#f00",BLUE:"#2FA1B3",PURPLE:"#721799",GREEN:"#6cd936",LIGHT_BLUE:"#2196F3"}};n(12);function Cn(t){return(Cn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Dn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function In(t,e){return(In=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function xn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=Fn(t);if(e){var i=Fn(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Mn(this,n)}}function Mn(t,e){if(e&&("object"===Cn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Fn(t){return(Fn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Nn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&In(t,e)}(o,t);var e,n,r,i=xn(o);function o(t,e){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(n=i.call(this,t)).plugin=e,n.bindEvents(),n}return e=o,(n=[{key:"className",get:function(){return["",this.name].join(" ")}},{key:"attributes",get:function(){return{class:this.className}}},{key:"events",get:function(){return{click:"handleClick"}}},{key:"destroy",value:function(){this.remove()}},{key:"handleClick",value:function(){}}])&&Dn(e.prototype,n),r&&Dn(e,r),o}(Nt);function Bn(t){return(Bn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function jn(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Un(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}
1function Hn(t,e){return(Hn=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Gn(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=Yn(t);if(e){var i=Yn(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Vn(this,n)}}function Vn(t,e){if(e&&("object"===Bn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Yn(t){return(Yn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Kn=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Hn(t,e)}(o,t);var e,n,r,i=Gn(o);function o(){return jn(this,o),i.apply(this,arguments)}return e=o,(n=[{key:"name",get:function(){return"ButtonControl"}},{key:"tagName",get:function(){return"button"}},{key:"className",get:function(){return["--z--control --z--btn",this.name].join(" ")}}])&&Un(e.prototype,n),r&&Un(e,r),o}(Nn);function zn(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var Wn=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,n,r;return e=t,(n=[{key:"events",get:function(){return{click:"handleClick",mouseover:"onMouseOver",mouseout:"onMouseOut"}}},{key:"initializer",value:function(t,e){this.controls=e}},{key:"onMouseOver",value:function(){_e||this.controls.disableAutoHide()}},{key:"onMouseOut",value:function(){this.controls.enableAutoHide()}},{key:"handleClick",value:function(){}}])&&zn(e.prototype,n),r&&zn(e,r),t}();function qn(t){return(qn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Xn(t){return(Xn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function $n(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Qn(t,e){return(Qn=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Jn(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];var i=function(e){function r(){for(var t,e,i,o,a=arguments.length,s=new Array(a),u=0;u<a;u++)s[u]=arguments[u];return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),i=this,o=(t=Xn(r)).call.apply(t,[this].concat(s)),e=!o||"object"!==qn(o)&&"function"!=typeof o?$n(i):o,n.forEach((function(t){var n;(n=t.prototype.initializer).call.apply(n,[$n(e)].concat(s))})),e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Qn(t,e)}(r,t),r}(),o=function(t,e){Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e)).forEach((function(n){n.match(/^(?:constructor|prototype|arguments|caller|name|bind|call|apply|toString|length)$/)||Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}))};return n.forEach((function(t){o(i.prototype,t.prototype),o(i,t)})),i}function Zn(t){return(Zn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function tr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function er(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function nr(t,e){return(nr=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function rr(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=or(t);if(e){var i=or(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return ir(this,n)}}function ir(t,e){if(e&&("object"===Zn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function or(t){return(or=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var ar=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&nr(t,e)}(o,t);var e,n,r,i=rr(o);function o(){var t;tr(this,o);for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];t=i.call.apply(i,[this].concat(n));var a=n[0];return t.config=X({},On,W(a.options,"controls.playPause")||{}),t}return e=o,(n=[{key:"name",get:function(){return"PlayPauseControl"}},{key:"className",get:function(){return"--z--control --z--btn --z--control-play"}},{key:"listenEvents",get:function(){return[{name:L.PLAYER_ENDED,handler:this.onEnded},{name:L.PLAYER_CLICK,handler:this.toogleIcon},{name:L.PLAYER_PLAY,handler:this.toogleIcon},{name:L.PLAYER_PAUSE,handler:this.toogleIcon}]}},{key:"toogleIcon",value:function(){lt(this.iconEl,"pl-ic-refresh");var t=this.player.isPlaying();
1ct(this.iconEl,"pl-ic-play_arrow",!t),ct(this.iconEl,"pl-ic-pause",t),this.setAttribute("title",t?"Dừng":"Phát")}},{key:"onEnded",value:function(){lt(this.iconEl,"pl-ic-play_arrow"),lt(this.iconEl,"pl-ic-pause"),ut(this.iconEl,"pl-ic-refresh"),this.setAttribute("title","Phát lại")}},{key:"handleClick",value:function(){this.player.togglePlay(),this.toogleIcon()}},{key:"render",value:function(){return this.iconEl=Et("span",{},{class:"--z--icon pl-ic-play_arrow"}),this.config.color&&dt(this.iconEl,{color:this.config.color}),this.el.append(this.iconEl),this}}])&&er(e.prototype,n),r&&er(e,r),o}(Jn(Kn,Wn));n(13);function sr(t){return(sr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ur(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function lr(t,e){return(lr=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function cr(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=dr(t);if(e){var i=dr(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return fr(this,n)}}function fr(t,e){if(e&&("object"===sr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function dr(t){return(dr=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var hr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&lr(t,e)}(o,t);var e,n,r,i=cr(o);function o(t,e){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(n=i.call(this,t,e)).isDragging=!1,n.distance=0,n}return e=o,(n=[{key:"name",get:function(){return"SliderControl"}},{key:"events",get:function(){return{click:"handleClick",touchmove:"onMouseMove",touchstart:"onMouseDown",mousedown:"onMouseDown",touchend:"onMouseUp"}}},{key:"onMouseDown",value:function(t){(_e||Lt(t))&&(this.isDragging=!0,t&&t.preventDefault(),this.plugin.disableAutoHide(),window.on("mousemove",this.onMouseMove.bind(this)),window.on("mouseup",this.onBodyUnbindMouseMove.bind(this)))}},{key:"onMouseUp",value:function(t){this.isDragging=!1,this.distance=this.calculateDistance(t),this.handleMouseUp(),this.plugin.enableAutoHide()}},{key:"onMouseMove",value:function(t){_e&&!this.isDragging||(this.distance=this.calculateDistance(t),(_e||Lt(t))&&(this.isDragging&&this.handleMouseMove(),this.plugin.disableAutoHide()))}},{key:"onBodyUnbindMouseMove",value:function(t){_e&&!this.isDragging||(window.off("mousemove",this.onMouseMove.bind(this)),window.off("mouseup",this.onBodyUnbindMouseMove.bind(this)),this.onMouseUp(t))}},{key:"calculateDistance",value:function(t){var e=this.player.options,n=e.lockRotateFullscreen,r=e.customIosFullscreen,i=!this.player.isLandscapeScreen(),o=this.player.isFullscreen(),a=r&&n&&i&&o,s=Pt(this.el,t,a);return a?1-s.y:s.x}},{key:"handleClick",value:function(t){t.stopPropagation(),t.preventDefault()}},{key:"handleMouseMove",value:function(){throw new Error("this must be overridden")}},{key:"handleMouseUp",value:function(){throw new Error("this must be overridden")}}])&&ur(e.prototype,n),r&&ur(e,r),o}(Nn);n(14);function pr(t){return(pr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function yr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function vr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function gr(t,e){return(gr=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function mr(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=Er(t);if(e){var i=Er(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return br(this,n)}}function br(t,e){if(e&&("object"===pr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Er(t){return(Er=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var _r={color:"",bulletColor:""},Tr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&gr(t,e)}(o,t);var e,n,r,i=mr(o);function o(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return yr(this,o),(e=i.call(this,t)).config=X({},_r,n),e.render(),e}return e=o,(n=[{key:"name",get:function(){return"SliderFillRecentBar"}},{key:"className",get:function(){return"--z--bar --z--bar-fill-recent"}},{key:"tagName",get:function(){return"span"}}
1,{key:"update",value:function(t){if(K.number(t)){var e={width:"".concat(t,"%")};dt(this.el,e)}}},{key:"render",value:function(){return this.config.color&&dt(this.el,{backgroundColor:this.config.color}),this.bulletEl=Et("span",{},{class:"--z--bullet"}),this.config.bulletColor&&dt(this.bulletEl,{backgroundColor:this.config.bulletColor}),this.el.append(this.bulletEl),this}}])&&vr(e.prototype,n),r&&vr(e,r),o}(Nn);function kr(t){return(kr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ar(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Sr(t,e){return(Sr=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function wr(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=Lr(t);if(e){var i=Lr(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Pr(this,n)}}function Pr(t,e){if(e&&("object"===kr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Lr(t){return(Lr=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Or=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Sr(t,e)}(o,t);var e,n,r,i=wr(o);function o(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o);var e=W(t.options,"controls.seekBar.foregroundColor")||"",n=W(t.options,"controls.seekBar.playHeadColor")||"";return i.call(this,t,{color:e,bulletColor:n})}return e=o,(n=[{key:"name",get:function(){return"ProgressControl"}},{key:"listenEvents",get:function(){return[{name:L.PLAYER_TIMEUPDATE,handler:this.onTimeUpdate}]}},{key:"onTimeUpdate",value:function(t){var e=t.current<0?t.total:t.current;this.currentPositionValue=e,this.currentDurationValue=t.total,this.currentSeekBarPercentage=this.currentPositionValue/this.currentDurationValue*100,this.update(this.currentSeekBarPercentage)}}])&&Ar(e.prototype,n),r&&Ar(e,r),o}(Tr);n(15);function Rr(t){return(Rr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Cr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Dr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Ir(t,e){return(Ir=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function xr(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=Fr(t);if(e){var i=Fr(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Mr(this,n)}}function Mr(t,e){if(e&&("object"===Rr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Fr(t){return(Fr=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Nr={color:""};function Br(t){return(Br="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function jr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Ur(t,e){return(Ur=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Hr(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=Vr(t);if(e){var i=Vr(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Gr(this,n)}}function Gr(t,e){if(e&&("object"===Br(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Vr(t){return(Vr=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Yr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Ur(t,e)}(o,t);var e,n,r,i=Hr(o);function o(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o);var e=W(t.options,"controls.seekBar.bufferedColor")||"";return i.call(this,t,{color:e})}return e=o,(n=[{key:"name",get:function(){return"LoadProgressBar"}},{key:"listenEvents",get:function(){return[{name:L.PLAYER_PROGRESS,handler:this.onProgressUpdate}]}},{key:"onProgressUpdate",value:function(t){var e=t.start/t.total*100,n=t.current/t.total*100;this.processLoaded=n-e,this.update(this.processLoaded)}}])&&jr(e.prototype,n),r&&jr(e,r),o}(function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Ir(t,e)}(o,t);var e,n,r,i=xr(o);function o(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Cr(this,o),(e=i.call(this,t)).config=X({},Nr,n),e.render(),e}return e=o,(n=[{key:"name",get:function(){return"SliderLoadedBar"}},{key:"className",get:function(){return"--z--bar --z--bar-fill-load"}},{key:"tagName",get:function(){return"span"}}
1,{key:"update",value:function(t){if(K.number(t)){var e={width:"".concat(t,"%")};dt(this.el,e)}}},{key:"render",value:function(){return this.config.color&&dt(this.el,{backgroundColor:this.config.color}),this}}])&&Dr(e.prototype,n),r&&Dr(e,r),o}(Nn));n(16);function Kr(t){return(Kr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function zr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Wr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function qr(t,e){return(qr=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Xr(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=Qr(t);if(e){var i=Qr(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return $r(this,n)}}function $r(t,e){if(e&&("object"===Kr(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Qr(t){return(Qr=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Jr={color:""},Zr=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&qr(t,e)}(o,t);var e,n,r,i=Xr(o);function o(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return zr(this,o),(e=i.call(this,t)).config=X({},Jr,n),e.render(),e}return e=o,(n=[{key:"name",get:function(){return"SliderBackgroundBar"}},{key:"className",get:function(){return"--z--bar --z--bar-bg"}},{key:"tagName",get:function(){return"span"}},{key:"render",value:function(){return this.config.color&&dt(this.el,{backgroundColor:this.config.color}),this}}])&&Wr(e.prototype,n),r&&Wr(e,r),o}(Nn),ti=function(t){return parseInt(t/60/60%60,10)},ei=function(t){return parseInt(t/60%60,10)},ni=function(t){return parseInt(t%60,10)};function ri(){return(new Date).getTime()/1e3}function ii(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!K.number(t))return"";var r=function(t){return"0".concat(t).slice(-2)},i=ti(t),o=ei(t),a=ni(t);return i=e||i>0?"".concat(i,":"):"","".concat(n&&t>0?"-":"").concat(i).concat(r(o),":").concat(r(a))}function oi(t){return(oi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ai(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function si(t,e){return(si=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function ui(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=ci(t);if(e){var i=ci(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return li(this,n)}}function li(t,e){if(e&&("object"===oi(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}
1function ci(t){return(ci=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var fi=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&si(t,e)}(o,t);var e,n,r,i=ui(o);function o(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(e=i.call(this,t)).enabled=!0,e.render(),e.hide(),e.bindEvents(),e}return e=o,(n=[{key:"name",get:function(){return"SeekTime"}},{key:"tagName",get:function(){return"span"}},{key:"attributes",get:function(){return{class:"--z--seek-time"}}},{key:"listenEvents",get:function(){return[{name:L.MEDIACONTROL_MOUSEMOVE_SEEKBAR,handler:this.onMouseMoveSeekbar},{name:L.MEDIACONTROL_MOUSELEAVE_SEEKBAR,handler:this.onMouseLeaveSeekbar}]}},{key:"onMouseMoveSeekbar",value:function(t,e){var n=e*this.player.getDuration();dt(this.el,{left:100*e+"%",marginLeft:-this.el.offsetWidth/2+"px"}),this.el.textContent=ii(n),this.show()}},{key:"onMouseLeaveSeekbar",value:function(){this.hide()}},{key:"enable",value:function(){this.enabled||(this.bindEvents(),this.show(),this.enabled=!0)}},{key:"disable",value:function(){this.unbindEvents(),this.hide(),this.enabled=!1}},{key:"render",value:function(){return this.el.innerHTML="00:00",this}}])&&ai(e.prototype,n),r&&ai(e,r),o}(Nt);function di(t){return(di="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function hi(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function pi(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function yi(t,e,n){return(yi="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=bi(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function vi(t,e){return(vi=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function gi(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=bi(t);if(e){var i=bi(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return mi(this,n)}}function mi(t,e){if(e&&("object"===di(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function bi(t){return(bi=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Ei=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&vi(t,e)}(o,t);var e,n,r,i=gi(o);function o(){var t;hi(this,o);for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];t=i.call.apply(i,[this].concat(n));var a=n[0],s=W(a.options,"controls.seekBar.backgroundColor")||"";return t.loadProgressBar=new Yr(a),t.progressControl=new Or(a),t.barBackground=new Zr(a,{color:s}),t.seekTime=new fi(a),t}return e=o,(n=[{key:"name",get:function(){return"SeekBarControl"}},{key:"className",get:function(){return"--z--progress-bar"}},{key:"events",get:function(){return{touchmove:"onMouseMove",mousedown:"onMouseDown",touchstart:"onMouseDown",touchend:"onMouseUp",mouseleave:"onMouseLeave",mouseover:"onMouseOver",mouseout:"onMouseOut",mousemove:"onMouseMove"}}
1},{key:"listenEvents",get:function(){return[{once:!0,name:L.PLAYER_DVRSTATECHANGED,handler:this.dvrChanged}]}},{key:"onMouseLeave",value:function(t){this.player.trigger(L.MEDIACONTROL_MOUSELEAVE_SEEKBAR,t)}},{key:"onMouseMove",value:function(t){_.debug(this.name,"onMouseMove"),yi(bi(o.prototype),"onMouseMove",this).call(this,t),this.player.trigger(L.MEDIACONTROL_MOUSEMOVE_SEEKBAR,t,this.distance)}},{key:"onMouseDown",value:function(t){_.debug(this.name,"onMouseDown"),yi(bi(o.prototype),"onMouseDown",this).call(this,t),this.addClass("active"),this.isPlayingBeforeSeek=this.player.isPlaying(),this.isPlayingBeforeSeek&&this.player.pause()}},{key:"update",value:function(){var t=100*this.distance;this.player.seekPercentage(t),this.currentSeekBarPercentage=t,this.progressControl.update(this.currentSeekBarPercentage)}},{key:"handleMouseMove",value:function(){this.player.mediaControl.draggingSeekBar=!0,this.update()}},{key:"handleMouseUp",value:function(){this.plugin.draggingSeekBar=!1,this.update(),this.removeClass("active"),this.seekTime.hide(),this.isPlayingBeforeSeek&&this.player.play()}},{key:"dvrChanged",value:function(){this.player.isLive()&&this.hide()}},{key:"render",value:function(){return this.el.append(this.barBackground.el),this.el.append(this.loadProgressBar.el),this.el.append(this.progressControl.el),this.el.append(this.seekTime.el),this}},{key:"remove",value:function(){[this.loadProgressBar,this.progressControl,this.barBackground,this.seekTime].forEach((function(t){t.remove()})),yi(bi(o.prototype),"remove",this).call(this)}}])&&pi(e.prototype,n),r&&pi(e,r),o}(Jn(hr,Wn));n(17);function _i(t){return(_i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ti(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function ki(t,e){return(ki=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Ai(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=wi(t);if(e){var i=wi(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Si(this,n)}}function Si(t,e){if(e&&("object"===_i(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function wi(t){return(wi=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Pi={currentTimeColor:"",totalTimeColor:"",delimiterColor:"",delimiter:"/"},Li=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ki(t,e)}(o,t);var e,n,r,i=Ai(o);function o(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(e=i.call(this,t)).config=X({},Pi,W(t.options,"controls.time")||{}),e.currentTime=0,e.duration=e.player.getDuration(),e}return e=o,(n=[{key:"name",get:function(){return"TimeControl"}},{key:"className",get:function(){return"--z--control --z--control-time"}},{key:"listenEvents",get:function(){return[{name:L.PLAYER_TIMEUPDATE,handler:this.onTimeUpdate},{name:L.PLAYER_LOADEDMETADATA,handler:this.onLoadedMetaData},{once:!0,name:L.PLAYER_DVRSTATECHANGED,handler:this.dvrChanged}]}},{key:"onLoadedMetaData",value:function(){this.duration=this.player.getDuration(),this.update()}},{key:"update",value:function(){this.currentTimeEl&&(this.currentTimeEl.textContent=ii(this.currentTime)),this.durationEl&&(this.durationEl.textContent=ii(this.duration))}},{key:"onTimeUpdate",value:function(t){this.el&&(this.currentTime=t.current<0?t.total:t.current,this.duration||(this.duration=this.player.getDuration()),this.update())}},{key:"dvrChanged",value:function(){this.player.isLive()&&this.hide()}},{key:"render",value:function(){return this.currentTimeEl=Et("span"),this.spaceEl=Et("span",{innerHTML:this.config.delimiter}),this.durationEl=Et("span",{innerHTML:ii(this.duration)}),dt(this.currentTimeEl,{color:this.config.currentTimeColor}),dt(this.spaceEl,{color:this.config.delimiterColor}),dt(this.durationEl,{color:this.config.totalTimeColor}),this.el.append(this.currentTimeEl),this.el.append(this.spaceEl),this.el.append(this.durationEl),this}}])&&Ti(e.prototype,n),r&&Ti(e,r),o}(Nn);n(18),n(19);function Oi(t){return(Oi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ri(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}
1function Ci(t,e){return(Ci=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Di(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=xi(t);if(e){var i=xi(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Ii(this,n)}}function Ii(t,e){if(e&&("object"===Oi(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function xi(t){return(xi=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Mi={color:""},Fi=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Ci(t,e)}(o,t);var e,n,r,i=Di(o);function o(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(e=i.call(this,t)).config=X({},Mi,W(t.options,"controls.volumeButton")||{}),e.volume=t.options.mute?0:t.options.volume,e.cachedVolume=t.options.volume||100,e.volumeIconClass="",e._chooseVolumeIconInit(),e}return e=o,(n=[{key:"name",get:function(){return"VolumeButton"}},{key:"className",get:function(){return"--z--control --z--btn --z--volume-icon"}},{key:"listenEvents",get:function(){return[{name:L.PLAYER_VOLUMEUPDATE,handler:this.onVolumeUpdated}]}},{key:"_chooseVolumeIconInit",value:function(){0===this.volume?this.volumeIconClass="pl-ic-volume_off":this.volume>=50?this.volumeIconClass="pl-ic-volume_up":this.volume<50&&(this.volumeIconClass="pl-ic-volume_down")}},{key:"handleClick",value:function(){this.player.isMuted()?this.player.setVolume(this.cachedVolume,!0):this.player.setVolume(0,!0)}},{key:"onVolumeUpdated",value:function(t){this.volume=t,t>0&&(this.cachedVolume=t),this.updateIcon(t),this.setAttribute("title",0===t?"Báºt âm thanh":"Tắt tiếng")}},{key:"updateIcon",value:function(t){ct(this.iconEl,"pl-ic-volume_down",t<50),ct(this.iconEl,"pl-ic-volume_up",t>=50),ct(this.iconEl,"pl-ic-volume_off",0===t)}},{key:"render",value:function(){return this.iconEl=Et("span",{},{class:"--z--icon ".concat(this.volumeIconClass)}),this.config.color&&dt(this.iconEl,{color:this.config.color}),this.el.append(this.iconEl),this}}])&&Ri(e.prototype,n),r&&Ri(e,r),o}(Kn);n(20);function Ni(t){return(Ni="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Bi(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function ji(t,e,n){return(ji="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Vi(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function Ui(t,e){return(Ui=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Hi(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=Vi(t);if(e){var i=Vi(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Gi(this,n)}}function Gi(t,e){if(e&&("object"===Ni(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}
1function Vi(t){return(Vi=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Yi=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Ui(t,e)}(o,t);var e,n,r,i=Hi(o);function o(t,e,n){var r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(r=i.call(this,t,n)).volume=t.options.mute?0:t.options.volume,r.parent=e;var a=W(t.options,"controls.volumeBar.foregroundColor")||"",s=W(t.options,"controls.volumeBar.backgroundColor")||"",u=W(t.options,"controls.volumeBar.volumeHeadColor")||"";return r.barFill=new Tr(t,{color:a,bulletColor:u}),r.barBackground=new Zr(t,{color:s}),r.update(),r}return e=o,(n=[{key:"name",get:function(){return"VolumeBar"}},{key:"className",get:function(){return"--z--volume-bar"}},{key:"tagName",get:function(){return"span"}},{key:"listenEvents",get:function(){return[{name:L.PLAYER_VOLUMEUPDATE,handler:this.onVolumeUpdated},{name:L.PLAYER_READY,handler:this.onPlayerReady},{name:L.PLAYER_FULLSCREEN,handler:this.onPlayerReady}]}},{key:"onPlayerReady",value:function(){this.player.getPlayerSize().width<=400?this.hide():this.show()}},{key:"onVolumeUpdated",value:function(t){this.volume=t,this.update()}},{key:"setVolume",value:function(t){t=Math.min(100,Math.max(t,0)),this.volume=t,this.player.setVolume(t,!0),this.update()}},{key:"update",value:function(){this.barFill&&this.barFill.update(this.volume)}},{key:"onMouseDown",value:function(t){ji(Vi(o.prototype),"onMouseDown",this).call(this,t),this.parent.toggleHideAnimation(!1)}},{key:"handleMouseMove",value:function(){this.handleMouse()}},{key:"handleMouseUp",value:function(){this.handleMouse(),this.parent.toggleHideAnimation(!0)}},{key:"handleMouse",value:function(){this.player.mediaControl.draggingVolumeBar=!0,this.setVolume(100*this.distance)}},{key:"render",value:function(){return this.el.append(this.barBackground.el),this.el.append(this.barFill.el),this}}])&&Bi(e.prototype,n),r&&Bi(e,r),o}(hr);function Ki(t){return(Ki="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function zi(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Wi(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function qi(t,e,n){return(qi="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Zi(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function Xi(t,e){return(Xi=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function $i(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=Zi(t);if(e){var i=Zi(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Qi(this,n)}}function Qi(t,e){if(e&&("object"===Ki(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Ji(t)}function Ji(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Zi(t){return(Zi=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var to=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Xi(t,e)}(o,t);var e,n,r,i=$i(o);function o(){var t;zi(this,o);for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];t=i.call.apply(i,[this].concat(n));var a=n[0],s=n[1];t.volumeButton=new Fi(a),t.volumeBar=new Yi(a,Ji(t),s);var u=W(a.options,"controls.volumeBarShowOnHover");return K.nullOrUndefined(u)&&(u=!0),t.toggleHideAnimation(u),t}return e=o,(n=[{key:"name",get:function(){return"VolumeControl"}},{key:"className",get:function(){return"--z--control --z--control-volume"}},{key:"toggleHideAnimation",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.toggleClass("--z--hide-animation",t)}},{key:"render",value:function(){return this.el.append(this.volumeButton.render().el),this.el.append(this.volumeBar.render().el),this}},{key:"remove",value:function(){[this.volumeButton,this.volumeBar].forEach((function(t){t.remove()})),qi(Zi(o.prototype),"remove",this).call(this)}}])&&Wi(e.prototype,n),r&&Wi(e,r),o}(Jn(Nn,Wn)),eo=(n(21),{isFullscreenIos:!1,isFullscreen:function(){return!!(document.fullscreenElement||document.webkitFullscreenElement||document.webkitIsFullScreen||document.mozFullScreen||document.msFullscreenElement||this.isFullscreenIos)},requestFullscreen:function(t){t.requestFullscreen?t.requestFullscreen().catch((function(t){_.error("requestFullscreen | ",t)})):t.webkitRequestFullscreen?t.webkitRequestFullscreen().catch((function(t){_.error("webkitRequestFullscreen | ",t)})):t.mozRequestFullScreen?t.mozRequestFullScreen().catch((function(t){_.error("mozRequestFullScreen | ",t)})):t.msRequestFullscreen?t.msRequestFullscreen().catch((function(t){_.error("msRequestFullscreen | ",t)})):t.querySelector&&t.querySelector("video")&&t.querySelector("video").webkitEnterFullScreen?t.querySelector("video").webkitEnterFullScreen().catch((function(t){_.error("webkitEnterFullScreen | ",t)})):t.webkitEnterFullScreen&&t.webkitEnterFullScreen().catch((function(t){_.error("webkitEnterFullScreen | ",t)}))},cancelFullscreen:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;return t.exitFullscreen?t.exitFullscreen().catch((function(t){_.error("exitFullscreen | ",t)})):t.webkitCancelFullScreen?t.webkitCancelFullScreen().catch((function(t){_.error("webkitCancelFullScreen | ",t)})):t.webkitExitFullscreen?t.webkitExitFullscreen().catch((function(t){_.error("webkitExitFullscreen | ",t)})):t.mozCancelFullScreen?t.mozCancelFullScreen().catch((function(t){_.error("mozCancelFullScreen | ",t)})):t.msExitFullscreen?t.msExitFullscreen().catch((function(t){_.error("msExitFullscreen | ",t)})):void 0},fullscreenEnabled:function(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)}});function no(t){return(no="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ro(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function io(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}
1function oo(t,e){return(oo=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function ao(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=uo(t);if(e){var i=uo(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return so(this,n)}}function so(t,e){if(e&&("object"===no(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function uo(t){return(uo=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var lo={color:""},co=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&oo(t,e)}(o,t);var e,n,r,i=ao(o);function o(){var t;ro(this,o);for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];t=i.call.apply(i,[this].concat(n));var a=n[0];return t.config=X({},lo,W(a.options,"controls.fullscreen")||{}),t}return e=o,(n=[{key:"name",get:function(){return"FullScreenControl"}},{key:"className",get:function(){return"--z--control --z--btn --z--control-full-screen"}},{key:"listenEvents",get:function(){return[{name:L.PLAYER_FULLSCREEN,handler:this._onFullScreenChange},{name:L.PLAYER_DBLCLICK,handler:this._onDblClicked}]}},{key:"handleClick",value:function(){this.config.functionFullscreen?this.config.functionFullscreen():this.player.toggleFullscreen()}},{key:"_onDblClicked",value:function(){this.config.dblClickToFullScreen&&this.handleClick()}},{key:"toogleIconFullScreen",value:function(t){ct(this.iconEl,"pl-ic-fullscreen_exit",t),ct(this.iconEl,"pl-ic-fullscreen",!t),this.setButtonTooltip(t)}},{key:"setButtonTooltip",value:function(t){var e=this.config.buttonTooltip,n=e?e.on:"Toà n mà n hình",r=e?e.off:"Thoát chế Äá» toà n mà n hình";this.setAttribute("title",t?r:n)}},{key:"render",value:function(){return this.iconEl=Et("span",{},{class:"--z--icon pl-ic-fullscreen"}),this.setButtonTooltip(this.player.isFullscreen()),this.config.color&&dt(this.iconEl,{color:this.config.color}),this.el.append(this.iconEl),this}},{key:"_onFullScreenChange",value:function(t){this.toogleIconFullScreen(t)}}])&&io(e.prototype,n),r&&io(e,r),o}(Jn(Kn,Wn));n(22);function fo(t){return(fo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ho(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function po(t,e,n){return(po="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=bo(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function yo(t,e){return(yo=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function vo(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=bo(t);if(e){var i=bo(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return go(this,n)}}function go(t,e){if(e&&("object"===fo(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return mo(t)}function mo(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}
1function bo(t){return(bo=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Eo={color:"",labelBgColor:"",labelTextColor:""},_o=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&yo(t,e)}(o,t);var e,n,r,i=vo(o);function o(t,e){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(n=i.call(this,t)).config=X({},Eo,W(t.options,"controls.SettingsButton")||{}),n.parent=e,n.label="",window.on("click.".concat(n.name),n.clickOutsideSettingsButton.bind(mo(n))),n}return e=o,(n=[{key:"name",get:function(){return"SettingsButton"}},{key:"className",get:function(){return"--z--btn --z--btn-settings"}},{key:"tagName",get:function(){return"button"}},{key:"clickOutsideSettingsButton",value:function(t){st(t.target,"pl-ic-settings")||this.parent.hideSettingsMenu()}},{key:"remove",value:function(){window.off("click.".concat(this.name),this.clickOutsideSettingsButton.bind(this)),po(bo(o.prototype),"remove",this).call(this)}},{key:"handleClick",value:function(t){t.stopPropagation(),this.parent.toggleVisibleSettingsMenu()}},{key:"updateBadgeLabel",value:function(t){this.label=t,this.iconLabelEl.textContent=t}},{key:"render",value:function(){return this.iconEl=Et("span",{},{class:"--z--icon pl-ic-settings"}),this.iconLabelEl=Et("span",{},{class:"--z--badge"}),this.iconLabelEl.textContent=this.label,this.setAttribute("title","Cà i Äặt"),dt(this.iconEl,{color:this.config.color}),dt(this.iconLabelEl,{backgroundColor:this.config.labelBgColor,color:this.config.labelTextColor}),this.el.append(this.iconEl),this.el.append(this.iconLabelEl),this}}])&&ho(e.prototype,n),r&&ho(e,r),o}(Nn),To={MENU_TYPE:{TOGGLE:"toggle",EXPAND:"expand"},LIST_MENU_TYPE:{CHECKLIST:"checklist",MIXIN:"mixin"}};function ko(t){return(ko="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ao(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function So(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Ao(Object(n),!0).forEach((function(e){wo(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ao(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function wo(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Po(t){return function(t){if(Array.isArray(t))return Lo(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return Lo(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Lo(t,e)}(t)||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 Lo(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Oo(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ro(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Co(t,e){return(Co=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Do(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=xo(t);if(e){var i=xo(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Io(this,n)}}function Io(t,e){if(e&&("object"===ko(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}
1function xo(t){return(xo=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Mo=function(){},Fo=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Co(t,e)}(o,t);var e,n,r,i=Do(o);function o(){var t;Oo(this,o);for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];t=i.call.apply(i,[this].concat(n));var a=n[2];return t.render(),t.parent=a,t.controls=t.parent.controls,t.settingsMenuItems={},t.routeHistory=[],t}return e=o,(n=[{key:"name",get:function(){return"SettingsMenu"}},{key:"className",get:function(){return"--z--zpl-settings-menu"}},{key:"listenEvents",get:function(){return[{name:L.PLAYER_READY,handler:this.onPlayerReady},{name:L.PLAYER_MEDIACONTROL_HIDE,handler:this.onHideMediaControl},{name:L.PLAYER_SETTINGS_MENU_HIDE,handler:this.hideMenu},{name:L.PLAYER_PLAY,handler:this.hideMenu},{name:L.PLAYER_PAUSE,handler:this.hideMenu},{name:L.PLAYER_FULLSCREEN,handler:this.hideMenu},{name:L.PLAYER_MEDIACONTROL_CLICK,handler:this.hideMenu},{name:L.PLAYER_VOLUMEUPDATE,handler:this.hideMenu}]}},{key:"handleClick",value:function(t){t.stopPropagation()}},{key:"onHideMediaControl",value:function(){this.hideMenu()}},{key:"onPlayerReady",value:function(){var t=$(this.settingsMenuItems);t.length&&(t=Ye(t,"order")),t.length?(this.createMenu({type:To.LIST_MENU_TYPE.MIXIN,config:{itemsList:t}}),this.parent.show(),this.parent.settingsButton.show()):this.parent.hide()}},{key:"registerMenuItem",value:function(t){var e=t.pluginKey,n=void 0===e?"":e,r=t.type,i=void 0===r?To.MENU_TYPE.TOGGLE:r,o=t.config,a=void 0===o?{}:o,s=t.order,u=void 0===s?0:s,l=t.callback,c=void 0===l?Mo:l,f=t.optionsConfig;if(!n)throw new Error("pluginKey must be required");this.settingsMenuItems[n]={type:i,config:a,order:u,callback:c,optionsConfig:f}}},{key:"asyncRegisterMenuItem",value:function(){this.registerMenuItem.apply(this,arguments),this.onPlayerReady()}},{key:"createToggleItem",value:function(t){var e=this,n=t.title,r=void 0===n?"":n,i=t.checked,o=void 0!==i&&i,a=t.clickCallback,s=void 0===a?Mo:a,u=t.itemIndex,l=Et("div",{innerHTML:'\n <div class="--z--zpl-item-label">\n '.concat(r,'\n </div>\n <div class="--z--zpl-item-content">\n <div class="--z--zpl-toggle-checkbox"></div>\n </div>\n ')},{class:"--z--zpl-menu-item","aria-checked":o});return l.on("click",(function(t){K.function(s)&&s(t,l);var n="true"!==Tt(l,"aria-checked");kt(l,"aria-checked",n);var r=e.routeHistory.length;if(r){var i=e.routeHistory[r-1];if("mixin"===W(i,"config.headerConfig.optionsMenu.type")){var o=W(i,"config.headerConfig.optionsMenu.data");if(K.array(o)&&o.length){var a=o[u],c=W(a,"config.checked");a&&!K.nullOrUndefined(c)&&(a.config.checked=n)}}}})),l}},{key:"createExpandableItem",value:function(t){var e=this,n=t.title,r=void 0===n?"":n,i=t.activeItemIndex,o=void 0===i?0:i,a=t.clickCallback,s=void 0===a?Mo:a,u=t.subMenu,l=t.optionsConfig,c=t.historyData,f=t.itemIndex,d=u.type,h=u.data,p=u.clickCallback,y=u.titleClickCallback,v=h&&K.array(h)&&h[o],g=v&&v.displayName||v&&v.label||"",m=Et("div",{innerHTML:'\n <div class="--z--zpl-item-label">\n '.concat(r,'\n </div>\n <div class="--z--zpl-item-content">\n <div class="--z--zpl-has-expand">\n <span> ').concat(g,' </span>\n <i class="pl-ic-keyboard_arrow_right"></i>\n </div>\n </div>\n ')},{class:"--z--zpl-menu-item"});return h.map((function(t,e){return t.checked=o===e,t})),m.data={title:r,activeItemIndex:o,subMenu:u,optionsConfig:l,itemIndex:f},m.on("click",(function(t){if(K.function(s)&&s(t,m),K.nullOrUndefined(c)||K.empty(c)||(e.routeHistory=[].concat(Po(e.routeHistory),[c])),d===To.LIST_MENU_TYPE.CHECKLIST){var n={headerConfig:{title:r,showOptions:!!l,optionText:l&&l.label,optionsClickCallback:l&&l.clickCallback,optionsMenu:l&&l.subMenu,titleClickCallback:y},itemsList:h,clickCallback:p,itemIndex:f};e.createCheckListMenu(n,{type:To.LIST_MENU_TYPE.CHECKLIST,config:n})}})),m}},{key:"createCheckableItem",value:function(t){var e=this,n=t.label,r=void 0===n?"":n,i=t.disabled,o=void 0!==i&&i,a=t.checked,s=void 0!==a&&a,u=t.callback,l=void 0===u?Mo:u,c=t.itemIndex,f=Et("div",{innerHTML:'\n <div class="--z--zpl-item-label">\n <i class="pl-ic-done"></i>
1\n <span class="txt">'.concat(r,"</span>\n </div>\n ")},{class:"--z--zpl-menu-item","aria-checked":s,"aria-disabled":o});return f.on("click",(function(t){if(K.function(l)&&l(t,f),o)return!1;for(var n=(f.parentNode||f.parentElement).childNodes,r=n.length,i=0;i<r;i++)kt(n[i],"aria-checked",!1);kt(f,"aria-checked",!0);var a=e.routeHistory.length,s=e.routeHistory[a-1],u=W(s,"config.itemsList"),d=u&&K.array(u)&&u[c],h=W(f.data,"index");if(K.nullOrUndefined(h))throw new Error("Element must be have index property in data",f);if(d&&!K.nullOrUndefined(d.type)){var p=W(d,"config.activeItemIndex");K.nullOrUndefined(p)||(d.config.activeItemIndex=h)}else{var y=W(s,"config.headerConfig.optionsMenu");y&&!K.nullOrUndefined(W(y,"activeItemIndex"))&&(y.activeItemIndex=h)}})),f}},{key:"goBack",value:function(){var t=this.routeHistory.length;if(t){var e=this.routeHistory[t-1];e&&(this.createMenu(e),this.routeHistory.pop())}}},{key:"createMenuHeader",value:function(t){var e=this,n=t.title,r=void 0===n?"":n,i=t.showOptions,o=void 0!==i&&i,a=t.optionText,s=void 0===a?"Options":a,u=t.titleClickCallback,l=void 0===u?Mo:u,c=t.optionsClickCallback,f=void 0===c?Mo:c,d=t.optionsMenu,h=t.historyData,p=t.itemIndex,y=Et("div",{},{class:"--z--zpl-panel-header --z--clearfix"}),v=Et("button",{innerHTML:'<i class="pl-ic-keyboard_arrow_left"></i> '.concat(r)},{class:"--z--panel-title"});if(v.on("click",(function(t){t.stopPropagation(),e.goBack(),K.function(l)&&l(t)})),y.append(v),o){var g=Et("div",{innerText:s},{class:"--z--zpl-options"});g.on("click",(function(t){t.stopPropagation();var n=e.routeHistory[e.routeHistory.length-1],r=n&&W(n,"config.itemsList"),i=r&&K.array(r)&&r[p];if(i){var o=W(i,"config.activeItemIndex");K.nullOrUndefined(o)||(h.config.activeItemIndex=o,W(h,"config.itemsList")&&h.config.itemsList.map((function(t,e){return t.checked=o===e,t})))}K.nullOrUndefined(h)||K.empty(h)||(e.routeHistory=[].concat(Po(e.routeHistory),[h])),K.function(f)&&f(t);var a=d.type,u=d.data,l=d.activeItemIndex,c={headerConfig:{title:s},itemsList:u,itemIndex:p};a===To.LIST_MENU_TYPE.CHECKLIST?(K.number(l)&&u.map((function(t,e){return t.checked=l===e,t})),e.createCheckListMenu(c,{type:To.LIST_MENU_TYPE.CHECKLIST,config:c})):a===To.LIST_MENU_TYPE.MIXIN&&e.createMixinMenu(c,{type:To.LIST_MENU_TYPE.MIXIN,config:c})})),y.append(g)}return y}},{key:"createMenu",value:function(t){var e=t.type,n=t.config;"checklist"===e?this.createCheckListMenu(So({},n),{type:e,config:n}):"mixin"===e&&this.createMixinMenu(So({},n),{type:e,config:n})}},{key:"createCheckListMenu",value:function(t,e){var n=t.headerConfig,r=t.itemsList,i=void 0===r?[]:r,o=t.clickCallback,a=void 0===o?Mo:o,s=t.itemIndex;if(this.panelEl.innerHTML="",n){var u=this.createMenuHeader(So(So({},n),{},{historyData:e,itemIndex:s}));this.panelEl.append(u)}for(var l=Et("div",{},{class:"--z--panel-scroll-wrapper"}),c=Et("div",{},{class:"--z--zpl-panel-menu"}),f=i.length,d=0;d<f;d++){var h=i[d];if(!K.object(h)||!h.label)return;var p=this.createCheckableItem({label:h.displayName||h.label,checked:!!h.checked,disabled:!!h.disabled,callback:a,itemIndex:s});p.data=h,c.append(p)}l.append(c),this.panelEl.append(l)}},{key:"createMixinMenu",value:function(t,e){var n=t.headerConfig,r=t.itemsList,i=void 0===r?[]:r;if(this.panelEl.innerHTML="",n){var o=this.createMenuHeader(n);this.panelEl.append(o)}for(var a=Et("div",{},{class:"--z--panel-scroll-wrapper"}),s=Et("div",{},{class:"--z--zpl-panel-inner"}),u=i.length,l=0;l<u;l++){var c=i[l],f=c.type,d=c.config,h=c.callback,p=c.optionsConfig,y=null;f===To.MENU_TYPE.TOGGLE?y=this.createToggleItem(So(So({},d),{},{itemIndex:l})):f===To.MENU_TYPE.EXPAND&&(y=this.createExpandableItem(So(So({},d),{},{optionsConfig:p,historyData:e,itemIndex:l}))),K.function(h)&&h(y),y&&s.append(y)}a.append(s),this.panelEl.append(a)}},{key:"toggleVisibleMenu",value:function(){ct(this.el,"--z--show"),this.player.isMenuOpen=!this.player.isMenuOpen}},{key:"hideMenu",value:function(){lt(this.el,"--z--show"),this.player.isMenuOpen=!1}},{key:"render",value:function(){this.panelEl=Et("div",{},{class:"--z--zpl-panel"}),this.el.append(this.panelEl),this.player.el.append(this.el)}}])&&Ro(e.prototype,n),r&&Ro(e,r),o}(Jn(Nn,Wn));function No(t){return(No="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Bo(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function jo(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Uo(t,e,n){return(Uo="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Ko(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}
vendor: 5,339 bytes, line 1
1function Ho(t,e){return(Ho=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Go(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=Ko(t);if(e){var i=Ko(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Vo(this,n)}}function Vo(t,e){if(e&&("object"===No(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Yo(t)}function Yo(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Ko(t){return(Ko=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var zo=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Ho(t,e)}(o,t);var e,n,r,i=Go(o);function o(){var t;Bo(this,o);for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];t=i.call.apply(i,[this].concat(n));var a=n[0],s=n[1];return t.settingsButton=new _o(a,Yo(t)),t.settingsMenu=new Fo(a,s,Yo(t)),t}return e=o,(n=[{key:"name",get:function(){return"SettingsControl"}},{key:"className",get:function(){return"--z--control --z--control-settings"}},{key:"toggleVisibleSettingsMenu",value:function(){this.settingsMenu.toggleVisibleMenu()}},{key:"hideSettingsMenu",value:function(){this.settingsMenu.hideMenu()}},{key:"render",value:function(){return this.el.append(this.settingsButton.render().el),this}},{key:"remove",value:function(){[this.settingsButton,this.settingsMenu].forEach((function(t){t.remove()})),Uo(Ko(o.prototype),"remove",this).call(this)}}])&&jo(e.prototype,n),r&&jo(e,r),o}(Jn(Nn,Wn));function Wo(t){return(Wo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function qo(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Xo(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function $o(t,e){return($o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Qo(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=Zo(t);if(e){var i=Zo(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Jo(this,n)}}function Jo(t,e){if(e&&("object"===Wo(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Zo(t){return(Zo=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function ta(t){return(ta="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ea(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return na(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return na(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function na(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function ra(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ia(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function oa(t,e,n){return(oa="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=la(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}
1function aa(t,e){return(aa=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function sa(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=la(t);if(e){var i=la(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return ua(this,n)}}function ua(t,e){if(e&&("object"===ta(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function la(t){return(la=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var ca={playpause:ar,seekbar:Ei,time:Li,volume:to,fullscreen:co,settings:zo,theatermode:function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&$o(t,e)}(o,t);var e,n,r,i=Qo(o);function o(){var t;qo(this,o);for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];t=i.call.apply(i,[this].concat(n));var a=n[0];return t.config=X({},On,W(a.options,"controls.theaterMode")||{}),t}return e=o,(n=[{key:"name",get:function(){return"TheaterModeControl"}},{key:"className",get:function(){return"--z--control --z--btn --z--control-theater-mode"}},{key:"listenEvents",get:function(){return[{name:L.PLAYER_THEATER_MODE_CHANGE,handler:this._onTheaterModeChange}]}},{key:"toggleIcon",value:function(t){ct(this.iconEl,"pl-ic-theater",t),ct(this.iconEl,"pl-ic-theater-mini",!t),this.setButtonTooltip(t)}},{key:"handleClick",value:function(){this.player.toggleTheaterMode()}},{key:"setButtonTooltip",value:function(t){var e=this.config.buttonTooltip,n=e?e.on:"Chế Äá» rạp chiếu",r=e?e.off:"Thoát chế Äá» rạp chiếu";this.setAttribute("title",t?r:n)}},{key:"render",value:function(){var t=this.options.theaterMode,e=t?"pl-ic-theater":"pl-ic-theater-mini";return this.iconEl=Et("span",{},{class:"--z--icon ".concat(e)}),this.setButtonTooltip(t),this.el.append(this.iconEl),this}},{key:"_onTheaterModeChange",value:function(t){this.toggleIcon(t)}}])&&Xo(e.prototype,n),r&&Xo(e,r),o}(Jn(Kn,Wn))},fa=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&aa(t,e)}(a,t);var e,r,i,o=sa(a);function a(){return ra(this,a),o.apply(this,arguments)}return e=a,i=[{key:"NAME_EVENTS",get:function(){return[{name:L.PLAYER_MOUSE_MOVE,handler:this.onMouseMove},{name:L.PLAYER_MOUSE_LEAVE,handler:this.onMouseLeave},{name:L.PLAYER_PLAY,handler:this.onPlay},{name:L.PLAYER_PAUSE,handler:this.onPause}]}}],(r=[{key:"name",get:function(){return"ControlsPlugin"}},{key:"attributes",get:function(){return{class:"--z--controls-wrapper"}}},{key:"events",get:function(){return{click:"onClicked",dblclick:"onDblClicked"}}},{key:"listenEvents",get:function(){return[{name:L.PLAYER_MOUSE_MOVE,handler:this.onMouseMove},{name:L.PLAYER_MOUSE_LEAVE,handler:this.onMouseLeave},{name:L.PLAYER_PLAY,handler:this.onPlay},{name:L.PLAYER_PAUSE,handler:this.onPause}]}},{key:"defaultOptions",get:function(){return On}},{key:"setUp",value:function(){this.draggingVolumeBar=!1,this.draggingSeekBar=!1,this.autoHideDisabled=!1,this.setting=X({},this.pluginOptions),this.setting.layout=W(this.pluginOptions,"layout"),this.controls=[],this.leftElement=null,this.rightElement=null,this.pluginOptions.disabled||this.onMouseMove()}},{key:"setupTheme",value:function(){var t=this,e=this.setting,r=e.type,i=e.theme;if(r.fullWidth){ut(this.innerEl,wn),ut(this.el,wn);var o=r.fullWidth;switch(o.backgoundType){case Rn.BG_TYPE_TRANSPARENT:ut(this.innerEl,Pn);break;case Rn.BG_TYPE_GRADIENT:ut(this.innerEl,Pn),ut(this.el,Pn)}var a=o.paddingTop;K.number(a)&&a>=0&&dt(this.innerEl,{paddingTop:String(a).indexOf("px")>-1?a:"".concat(a,"px")}),dt(this.innerEl,{backgroundImage:o.backgroundImage,backgroundColor:o.backgroundColor}),this.setting.hideAnimation&&(this.hideClass=Ln)}i&&$(Rn.THEME).indexOf(i)>-1&&n(23)("./".concat(i,".scss")).then((function(e){var n=Et("style",{innerHTML:e.default});t.innerEl.append(n)}))}},{key:"onClicked",value:function(t){t.stopPropagation(),this.player.trigger(L.PLAYER_MEDIACONTROL_CLICK)}},{key:"onDblClicked",value:function(t){t.stopPropagation(),this.player.trigger(L.PLAYER_MEDIACONTROL_DBLCLICK)}},{key:"onMouseLeave",value:function(){this.autoHideDisabled||this.setting.alwaysShowControl||(clearTimeout(this.hideTimeout),this.hide())}},{key:"onMouseMove",value:function(){var t=this;this.autoHideDisabled||this.setting.disabledAutoHide||(clearTimeout(this.hideTimeout),this.show(),this.setting.alwaysShowControl||(this.hideTimeout=setTimeout((function(){return t.onMouseLeave()}),3e3)))}},{key:"onPlay",value:function(){this.enableAutoHide()}},{key:"onPause",value:function(){this.onMouseLeave(),_e?this.setting.showOnPauseMobile&&this.disableAutoHide():this.disableAutoHide()}},{key:"disableAutoHide",value:function(){this.autoHideDisabled=!0,clearTimeout(this.hideTimeout),this.show()}},{key:"enableAutoHide",value:function(){this.setting.disabledAutoHide||this.player.isPlaying()&&(this.autoHideDisabled=!1,this.onMouseMove())}},{key:"disable",value:function(){oa(la(a.prototype),"disable",this).call(this),this.player.disableMediaControl()}},{key:"enable",value:function(){oa(la(a.prototype),"enable",this).call(this),this.player.enableMediaControl()}},{key:"show",value:function(){_.debug(this.name,"show"),lt(this.el,this.hideClass),this.player.showMediaControl()}},{key:"hide",value:function(){this.hideClass||(this.hideClass=Sn),_.debug(this.name,"hide",this.hideClass),ut(this.el,this.hideClass),this.player.hideMediaControl()}},{key:"destroy",value:function(){oa(la(a.prototype),"destroy",this).call(this),this.controls.forEac
1h((function(t){return t.remove()})),this.remove()}},{key:"getControl",value:function(t){return this.controls&&this.controls.filter((function(e){return e.name===t}))[0]}},{key:"renderControl",value:function(t,e){if(e){var n=ca[e];if(n){var r=new n(this.player,this);t.append(r.render().el),this.controls.push(r)}}}},{key:"render",value:function(){var t=this;if(!this.controls)return this;if(oa(la(a.prototype),"render",this).call(this),this.leftElement=Et("div",{},{class:"--z--control-left"}),this.rightElement=Et("div",{},{class:"--z--control-right"}),this.innerEl=Et("div",{},{class:"--z--controls"}),(!this.setting.layout.left||!this.setting.layout.left.length)&&ut(this.rightElement,"--z--only-right-control"),this.setting.layout.default){var e,n=ea(this.setting.layout.default);try{for(n.s();!(e=n.n()).done;){var r=e.value;this.renderControl(this.innerEl,r)}}catch(t){n.e(t)}finally{n.f()}}if(this.setting.layout.left){var i,o=ea(this.setting.layout.left);try{for(o.s();!(i=o.n()).done;){var s=i.value;this.renderControl(this.leftElement,s)}}catch(t){o.e(t)}finally{o.f()}}if(this.setting.layout.right){var u,l=ea(this.setting.layout.right);try{for(l.s();!(u=l.n()).done;){var c=u.value;this.renderControl(this.rightElement,c)}}catch(t){l.e(t)}finally{l.f()}}return this.setupTheme(),this.innerEl.append(this.leftElement),this.innerEl.append(this.rightElement),this.el.append(this.innerEl),this.player.$el.append(this.el),setTimeout((function(){t.player.mediaControlReady()}),0),this}}])&&ia(e.prototype,r),i&&ia(e,i),a}(Yt);n(24);function da(t){return(da="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ha(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function pa(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function ya(t,e){return(ya=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function va(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=ma(t);if(e){var i=ma(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return ga(this,n)}}function ga(t,e){if(e&&("object"===da(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function ma(t){return(ma=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var ba={poster:"//static.znews.vn/zplayer/images/poster_default.jpg"},Ea=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ya(t,e)}(o,t);var e,n,r,i=va(o);function o(){return ha(this,o),i.apply(this,arguments)}return e=o,(n=[{key:"name",get:function(){return"PosterPlugin"}},{key:"attributes",get:function(){return{class:"--z--player-poster"}}},{key:"events",get:function(){return{click:"handleClick",touch:"handleClick"}}},{key:"defaultOptions",get:function(){return ba}},{key:"listenEvents",get:function(){return[{name:L.PLAYER_PLAY_INTENT,handler:this._onPlayerPlayIntent},{name:L.PLAYER_ENDED,handler:this._onPlayerEnded}]}},{key:"_onPlayerPlayIntent",value:function(){this.hide()}},{key:"_onPlayerEnded",value:function(){this.player.options.customIosFullscreen||this.show()}},{key:"handleClick",value:function(){return this.player.play(),!1}},{key:"getPosterUrl",value:function(){return this.options.poster||this.pluginOptions.poster}},{key:"render",value:function(){var t=this.getPosterUrl(),e=Et("div",{}
1,{class:"--z--poster-controls --z--play-wrapper --z--active"});return this.el.setAttribute("style","background-image : url(".concat(t,");")),K.empty(this.pluginOptions.styles)||dt(this.el,this.pluginOptions.styles),this.$el.append(e),this.player.$el.append(this.el),this}}])&&pa(e.prototype,n),r&&pa(e,r),o}(Yt);n(25);function _a(t){return(_a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ta(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ka(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Aa(t,e,n){return(Aa="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=La(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function Sa(t,e){return(Sa=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function wa(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=La(t);if(e){var i=La(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Pa(this,n)}}function Pa(t,e){if(e&&("object"===_a(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function La(t){return(La=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Oa={showLabel:!1},Ra=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Sa(t,e)}(o,t);var e,n,r,i=wa(o);function o(){return Ta(this,o),i.apply(this,arguments)}return e=o,(n=[{key:"name",get:function(){return"LoadingSpinnerPlugin"}},{key:"attributes",get:function(){return{class:"--z--loading-wrapper"}}},{key:"defaultOptions",get:function(){return Oa}},{key:"listenEvents",get:function(){return[{name:L.PLAYER_PLAY_INTENT,handler:this._onPlayerPlayIntent},{name:L.PLAYER_BUFFERING,handler:this.onBuffering},{name:L.PLAYER_BUFFERING_CHANGE,handler:this.onBufferingChange},{name:L.PLAYER_BUFFERFULL,handler:this.onBufferFull},{name:L.PLAYER_STOP,handler:this.onStop},{name:L.PLAYER_ENDED,handler:this.onStop},{name:L.PLAYER_ERROR,handler:this.onStop}]}},{key:"setUp",value:function(){Aa(La(o.prototype),"setUp",this).call(this),this.bufferingPercent=1,this.shouldUpdate=!0}},{key:"onBuffering",value:function(){this.shouldUpdate=!0,this.show()}},{key:"onBufferingChange",value:function(t){K.number(t)&&((t=Math.floor(t))<1?t=1:t>99&&(t=99),this.bufferingPercent=t,this.update())}},{key:"onBufferFull",value:function(){_.debug(this.name,"onBufferFull"),this.bufferingPercent=1,this.update(),this.hide(),this.shouldUpdate=!1}},{key:"onStop",value:function(){_.debug(this.name,"onStop"),this.bufferingPercent=1,this.hide()}},{key:"show",value:function(){var t=this;null===this.showTimeout&&(this.showTimeout=setTimeout((function(){t.player.trigger(L.LOADING_SPINNER_SHOW),t.$el.show()}),300))}},{key:"hide",value:function(){null!==this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=null),this.player.trigger(L.LOADING_SPINNER_HIDE),this.$el.hide()}},{key:"update",value:function(){this.shouldUpdate&&this.pieWrapperEl&&(ft(this.pieWrapperEl,"--z--pie-wrapper --z--progress-".concat(this.bufferingPercent)),this.labelEl&&bt(this.labelEl,"".concat(this.bufferingPercent,"%")))}},{key:"render",value:function(){return this.pieEl=Et("div",{},{class:"--z--pie-progress-size"}),this.pieWrapperEl=Et("div",{innerHTML:'\n <div class="--z--pie">\n <div class="--z--left-side --z--half-circle"></div>\n <div class="--z--right-side --z--half-circle"></div>\n </div>\n <div class="--z--shadow"></div>\n '},{class:"--z--pie-wrapper"}),this.pluginOptions.showLabel&&(this.labelEl=Et("div",{innerHTML:"".concat(this.bufferingPercent,"%")},{class:"--z--label"}),this.pieWrapperEl.prepend(this.labelEl)),this.pieEl.append(this.pieWrapperEl),this.$el.append(this.pieEl),this.player.$el.append(this.$el),this.$el.hide(),this.player.buffering&&this.onBuffering(),this}},{key:"_onPlayerPlayIntent",value:function(){this.player.buffering&&this.show()}}])&&ka(e.prototype,n),r&&ka(e,r),o}(Yt);function Ca(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return t?t.toString().replace(/{(\d+)}/g,(function(t,e){return n[e].toString()})):t}function Da(t){var e=document.createElement("div");return e.appendChild(document.createTextNode(t)),e.innerHTML}function Ia(t){var e=document.createDocumentFragment(),n=document.createElement("div");return e.appendChild(n),n.innerHTML=t,e.firstChild.innerText}function xa(t){return t.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function Ma(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return String.prototype.startsWith?t.startsWith(e,n):(n=!n||n<0?0:+n,t.indexOf(e)===n)}function Fa(t,e,n){return String.prototype.endsWith?t.endsWith(e,n):((void 0===n||n>t.length)&&(n=t.length),t.substring(n-e.length,n)===e)}function Na(t){return"".concat(t,"-").concat(Math.floor(1e4*Math.random()))}function Ba(t,e){return 0===t||0===e||Number.isNaN(t)||Number.isNaN(e)?0:(t/e*100).toFixed(2)}function ja(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return t.replace(new RegExp(e.toString().replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1"),"g"),n.toString())}function Ua(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").toString().replace(/\w\S*/g,(function(t){return t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()}))}function Ha(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").toString();return t=ja(t,"-"," "),t=ja(t,"_"," "),ja(t=Ua(t)," ","")}function Ga(){var t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").toString();return(t=Ha(t)).charAt(0).toLowerCase()+t.slice(1)}function Va(t){var e=document.createDocumentFragment(),n=document.createElement("div");return e.appendChild(n),n.innerHTML=t,e.firstChild.innerText}function Ya(t){var e=document.createElement("div");return e.appendChild(t),e.innerHTML}function Ka(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var za=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.data=[]}var e,n,r;return e=t,(n=[{key:"getItem",value:function(t){return this.data[t]}},{key:"setItem",value:function(t,e){this.data[t]=String(e)}},{key:"removeItem",value:function(t){delete this.data[t]}}])&&Ka(e.prototype,n),r&&Ka(e,r),t}();function Wa(){try{return"localStorage"in window&&(window.localStorage.setItem("__test__","__test__"),window.localStorage.removeItem("__test__"),!0)}catch(t){return!1}}var qa=Wa()?window.localStorage:new za;function Xa(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function $a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var Qa=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"zplayer";Xa(this,t),this.key=e}var e,n,r;return e=t,r=[{key:"supported",value:function(){return Wa()}}],(n=[{key:"get",value:function(t){var e=qa.getItem(this.key);if(K.empty(e))return{};var n=function(t){try{return JSON.parse(t)}catch(t){return{}}}(e);
1return K.string(t)&&t.length?n[t]:n}},{key:"set",value:function(t){if(K.object(t)){var e=this.get();K.empty(e)&&(e={}),X(e,t),qa.setItem(this.key,JSON.stringify(e))}}},{key:"clean",value:function(){qa.removeItem(this.key)}}])&&$a(e.prototype,n),r&&$a(e,r),t}();function Ja(t){return(Ja="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Za(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ts(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function es(t,e,n){return(es="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=os(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function ns(t,e){return(ns=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function rs(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=os(t);if(e){var i=os(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return is(this,n)}}function is(t,e){if(e&&("object"===Ja(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function os(t){return(os=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var as=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ns(t,e)}(o,t);var e,n,r,i=rs(o);function o(){return Za(this,o),i.apply(this,arguments)}return e=o,(n=[{key:"name",get:function(){return"StatsPlugin"}},{key:"defaultOptions",get:function(){return{trackingApi:["https://zplayer-trk.zdn.vn/track"]}}},{key:"_playbackName",get:function(){return this.player.playback.name}},{key:"_playbackType",get:function(){return this.player.getPlaybackType()}},{key:"listenEvents",get:function(){return[{once:!0,name:L.PLAYER_PLAY_INTENT,handler:this._onPlayIntent},{once:!0,name:L.PLAYER_PLAY,handler:this._onFirstPlaying},{name:L.PLAYER_QUALITY_LEVELS_SELECTED,handler:this._onBitrate},{name:L.PLAYER_CANPLAYTHROUGH,handler:this._onCanPlayThrough},{name:L.PLAYER_PLAY,handler:this.onPlay},{name:L.PLAYER_PAUSE,handler:this.onPause},{once:!0,name:L.PLAYER_ERROR,handler:this._onPlayerError},{name:L.PLAYER_ENDED,handler:this._onPlayerEnded},{name:L.PLAYER_SEEKING,handler:this._onSeeking},{name:L.PLAYER_SEEK,handler:this.onSeek},{name:L.PLAYER_WAITING,handler:this._onWaiting},{name:L.PLAYER_FULLSCREEN,handler:this.onFullScreen},{name:L.PLAYER_PROGRESS,handler:this.onProgress},{name:L.PLAYER_TIMEUPDATE,handler:this.onTimeUpdate},{once:!0,name:L.PLAYER_BUFFERING,handler:this.onBuffering},{once:!0,name:L.PLAYER_BUFFERFULL,handler:this.onBufferfull}]}},{key:"setUp",value:function(){this.options.sources!=[{source:"",mimeType:""}]&&(this._isFirstLoad=!0,this._isBuffering=!0,this._trackingApi=this.pluginOptions.trackingApi,this._storage=new Qa(Na("zplayer-trk")),this._reset(),this._sendLastReports())}},{key:"destroy",value:function(){es(os(o.prototype),"destroy",this).call(this),this._stopMonitoring()}},{key:"_now",value:function(){return Date.now()}},{key:"_onPlayIntent",value:function(){this._timeOnStartLoad=this._now(),this._start("startup"),this._startMonitoring()}},{key:"_onBitrate",value:function(t){var e=parseInt(t.label),n=this._now(),r=this._metrics.extra.bitratesHistory.length;if(r>0){var i=this._metrics.extra.bitratesHistory[r-1];i.end=n,i.time=n-i.start}this._metrics.extra.bitratesHistory.push({start:this._now(),bitrate:e}),this._inc("changeLevel")}},{key:"_onFirstPlaying",value:function(){this.listenTo(this.player,L.PLAYER_TIMEUPDATE,this._onContainerUpdateWhilePlaying),this.listenEvents.push({name:L.PLAYER_TIMEUPDATE,handler:this._onContainerUpdateWhilePlaying}),this._start("watch"),this._stop("startup")}},{key:"_onContainerUpdateWhilePlaying",value:function(){this.player.isPlaying()&&(this._stop("watch"),this._start("watch"))}},{key:"_onCanPlayThrough",value:function(t){if(this.player.isPlaying()){var e=t.time;this._isFirstLoad?(this._isFirstLoad=!1,this._timeOnCanPlayFirstLoad=e):(this._timeOnCanPlayThrough=e,this._trackLatencyHistory(this._isBuffering))}}},{key:"_trackLatencyHistory",value:function(t){if(t)if(this._isSeeking)this._seekLatencyHistory.push(this._timeOnCanPlayThrough-this._timeOnSeeking),this._isSeeking=!1;else if(this._isWaiting){var e=this._timeOnCanPlayThrough-this._timeOnWaiting;this._metrics.timers.playLatency+=e,this._isWaiting=!1}}},{key:"_onSeeking",value:function(t){this._isSeeking=!0,this._timeOnSeeking=t.time}},{key:"_onWaiting",value:function(t){this._isSeeking||(this._isWaiting=!0,this._timeOnWaiting=t.time)}},{key:"_onPlayerEnded",value:function(){this._sendReportThenReset(),this.stopListening(),this.bindEvents()}},{key:"_onPlayerError",value:function(t){this._metrics.extra.errorDetail.push("code: ".concat(t.code,", description: ").concat(t.description)),this._inc("error"),this._sendReportThenReset()}},{key:"_startMonitoring",value:function(){var t=this;this._intervalId=setInterval((function(){t._buildReport(),t._sendLastReports()}
1),5e3),this._buildReport(),_.info(this.name,"started monitoring")}},{key:"_stopMonitoring",value:function(){clearInterval(this._intervalId),_.info(this.name,"stopped monitoring")}},{key:"_sendReportThenReset",value:function(){this._stopMonitoring(),this._buildReport(),this._sendReport(this._storage.get()),this._reset()}},{key:"_reset",value:function(){this._isFirstLoad=!0,this._seekLatencyHistory=[],this._newMetrics(),this._storage.clean()}},{key:"_sendLastReports",value:function(){var t=this;Object.keys(qa).filter(ss).forEach((function(e){var n,r=JSON.parse(qa.getItem(e));t._storage.key===e||(n=r)&&Date.now()-n._updatedAt<5e3||(t._sendReport(r),qa.removeItem(e),_.debug(t.name,"sent report:",e))}))}},{key:"_saveMetrics",value:function(){var t={_updatedAt:this._now(),userAgent:navigator.userAgent,fromUrl:window.location.href,params:JSON.stringify(this._metrics)};this._storage.set(t)}},{key:"_sendReport",value:function(t){_.debug(this.name,"sending report:",t),this._trackingApi.forEach((function(e){(new Image).src=e+"?userAgent="+encodeURIComponent(t.userAgent)+"&fromUrl="+encodeURIComponent(t.fromUrl)+"¶ms="+encodeURIComponent(t.params)}))}},{key:"onPlay",value:function(){this._inc("play")}},{key:"onPause",value:function(){this._stop("watch"),this._start("pause"),this._inc("pause"),this.listenToOnce(this.player,L.PLAYER_PLAY,this.playAfterPause)}},{key:"playAfterPause",value:function(){this._stop("pause"),this._start("watch")}},{key:"onSeek",value:function(t){this._inc("seek"),this._metrics.extra.watchHistory.push([1e3*t,1e3*t])}},{key:"onFullScreen",value:function(){this._inc("fullscreen")}},{key:"onProgress",value:function(t){this._metrics.extra.buffersize=1e3*t.current}},{key:"onTimeUpdate",value:function(t){var e=1e3*t.current,n=1e3*t.total,r=this._metrics.extra.watchHistory.length;this._metrics.extra.duration=n,this._metrics.extra.currentTime=e,0===r?this._metrics.extra.watchHistory.push([e,e]):this._metrics.extra.watchHistory[r-1][1]=e}},{key:"onBuffering",value:function(){this._isBuffering=!0,this._inc("buffering"),this._start("buffering"),this.listenToOnce(this.player,L.PLAYER_BUFFERFULL,this.onBufferfull)}},{key:"onBufferfull",value:function(){this._isBuffering=!1,this._stop("buffering"),this.listenToOnce(this.player,L.PLAYER_BUFFERING,this.onBuffering)}},{key:"_inc",value:function(t){this._metrics.counters[t]+=1}},{key:"_timerHasStarted",value:function(t){return void 0!==this["_start".concat(t)]}},{key:"_start",value:function(t){this["_start".concat(t)]=this._now()}},{key:"_stop",value:function(t){this._metrics.timers[t]+=this._now()-this["_start".concat(t)]}},{key:"_fetchFPS",value:function(){var t={html5_video:this._html5FetchFPS,hls:this._html5FetchFPS};t[this._playbackName]&&t[this._playbackName].call(this)}},{key:"_calculateBitrates",value:function(){var t=this,e=this._metrics.extra.bitratesHistory.map((function(t){return t.bitrate}));this._metrics.extra.bitrateMean=e.reduce((function(t,e){return t+e}),0)/e.length,this._metrics.extra.bitrateVariance=e.map((function(e){return Math.pow(e-t._metrics.extra.bitrateMean,2)})).reduce((function(t,e){return t+e}),0)/e.length,this._metrics.extra.bitrateStandardDeviation=Math.sqrt(this._metrics.extra.bitrateVariance),this._metrics.extra.bitrateMostUsed=this._metrics.extra.bitratesHistory.sort((function(t,e){return t.time<e.time}))[0]}},{key:"_calculatePercentages",value:function(){this._metrics.extra.duration>0&&(this._metrics.extra.watchedPercentage=this._metrics.timers.watch/this._metrics.extra.duration*100,this._metrics.extra.bufferingPercentage=this._metrics.timers.buffering/this._metrics.extra.duration*100)}},{key:"_calculateStartLatency",value:function(){!this._timeOnCanPlayFirstLoad||this._timeOnCanPlayFirstLoad<=0||(this._metrics.timers.startLatency=this._timeOnCanPlayFirstLoad-this._timeOnStartLoad)}},{key:"_calculateSeekLatency",value:function(){this._metrics.timers.seekLatency=ze(this._seekLatencyHistory)}},{key:"_newMetrics",value:function(){var t=this;this._metrics={counters:{play:0,pause:0,error:0,buffering:0,decodedFrames:0,droppedFrames:0,fps:0,changeLevel:0,seek:0,fullscreen:0,dvrUsage:0},timers:{startup:0,watch:0,pause:0,buffering:0,session:0,startLatency:0,seekLatency:0,playLatency:0,getSourceLatency:0},extra:{product:"",level:"",playbackName:"",playbackType:"",playbackRedirector:"",playbackSrc:"",mimeType:"",platform:_e?"webm":"webd",zdnServer:"",bitratesHistory:[],bitrateMean:0,bitrateVariance:0,bitrateStandardDeviation:0,bitrateMostUsed:0,buffersize:0,errorDetail:[],watchHistory:[],watchedPercentage:0,bufferingPercentage:0,isOnline:!0}},window.ZA&&K.function(window.ZA.getVisitorID)&&window.ZA.getVisitorID((function(e){_.debug(t.name,"ZA visitor ID:",e),t._metrics.extra.visitorId=e}))}},{key:"_buildReport",value:function(){this._stop("session"),this._start("session"),this._metrics.extra.playbackName=this._playbackName,this._metrics.extra.playbackType=this._playbackType,this._metrics.extra.product=this.options.product,this._calculateBitrates(),this._calculatePercentages(),this._fetchFPS(),this._calculateStartLatency(),this._calculateSeekLatency(),this._metrics.extra.playbackSrc=this.player.isHlsPlayback()?this.player.options.source:this.player.playback.el.src,this._metrics.extra.mimeType=this.player.options.mimeType,this._saveMetrics()}},{key:"_html5FetchFPS",value:function(){var t=this.player.playback.el,e=t.webkitDecodedFrameCount||t.mozDecodedFrames||0,n=t.
1webkitDroppedFrameCount||t.mozParsedFrames-t.mozDecodedFrames||0,r=e-(this._lastDecodedFramesCount||0);this._metrics.counters.decodedFrames=e,this._metrics.counters.droppedFrames=n,this._metrics.counters.fps=r/5,this._lastDecodedFramesCount=e}}])&&ts(e.prototype,n),r&&ts(e,r),o}(Yt);function ss(t){return t&&0===t.indexOf("zplayer-trk")}n(26);function us(t){return(us="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ls(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function cs(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function fs(t,e){return(fs=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function ds(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=ps(t);if(e){var i=ps(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return hs(this,n)}}function hs(t,e){if(e&&("object"===us(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function ps(t){return(ps=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var ys=["PosterPlugin","LoadingSpinnerPlugin","BigPlayButtonPlugin","ClickToPausePlugin","PauseAdPlugin","PlayPauseFaceoutPlugin","HotKeysPlugin"],vs=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&fs(t,e)}(o,t);var e,n,r,i=ds(o);function o(){return ls(this,o),i.apply(this,arguments)}return e=o,(n=[{key:"name",get:function(){return"ErrorScreenPlugin"}},{key:"attributes",get:function(){return{class:"player-error-screen","data-error-screen":""}}},{key:"listenEvents",get:function(){return[{name:L.PLAYER_ERROR,handler:this.onError}]}},{key:"defaultOptions",get:function(){return{message:"Có lá»i xảy ra!"}}},{key:"setUp",value:function(){var t=this;if(this.defaultOptions.disabled)return this.disable();this.shouldRender=!0,this.interferedPlugins=ys.map((function(e){return t.player.getPlugin(e)}))}},{key:"bindReload",value:function(){this.reloadButton=this.$el.find(".player-error-screen__reload"),this.reloadButton&&this.reloadButton.on("click",this.reload.bind(this))}},{key:"reload",value:function(){var t=this;this.listenToOnce(this.player,L.PLAYER_READY,(function(){return t.player.play()})),this.unbindReload()}},{key:"unbindReload",value:function(){this.reloadButton&&this.reloadButton.off("click")}},{key:"onError",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.err=t,this.player.mediaControl.disable(),this._disableInterferedPlugins(),this.render(),this.show(),this.shouldRender=!1}},{key:"_disableInterferedPlugins",value:function(){this.interferedPlugins.forEach((function(t){return t&&t.disable()}))}},{key:"render",value:function(){if(this.err&&this.shouldRender){var t=Et("div",{innerHTML:'\n <div class="player-error-screen__title" data-error-screen>'.concat(this.pluginOptions.message,'.</div>\n <div class="player-error-screen__code" data-error-screen>Error code: ').concat(this.err.code,"</div>\n ")},{"data-error-screen":"",class:"player-error-screen__content"});return this.el.append(t),this.player.el.append(this.el),this.bindReload(),this}}}])&&cs(e.prototype,n),r&&cs(e,r),o}(Yt);function gs(t){return(gs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ms(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function bs(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}
1function Es(t,e){return(Es=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function _s(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=ks(t);if(e){var i=ks(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Ts(this,n)}}function Ts(t,e){if(e&&("object"===gs(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function ks(t){return(ks=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var As={disableHotKeys:!1},Ss=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Es(t,e)}(o,t);var e,n,r,i=_s(o);function o(){return ms(this,o),i.apply(this,arguments)}return e=o,(n=[{key:"name",get:function(){return"HotKeysPlugin"}},{key:"defaultOptions",get:function(){return As}},{key:"listenEvents",get:function(){return[{name:L.PLAYER_KEYDOWN,handler:this._onPlayerKeydown}]}},{key:"playPauseKey",value:function(t){return 32===t.which||179===t.which}},{key:"rewindKey",value:function(t){return 37===t.which||177===t.which}},{key:"forwardKey",value:function(t){return 39===t.which||176===t.which}},{key:"volumeUpKey",value:function(t){return 38===t.which}},{key:"volumeDownKey",value:function(t){return 40===t.which}},{key:"muteKey",value:function(t){return 77===t.which}},{key:"fullscreenKey",value:function(t){return 70===t.which}},{key:"numberKey",value:function(t){return t.which>47&&t.which<59||t.which>95&&t.which<106}},{key:"getNumberKey",value:function(t){var e=48;return t.which>95&&(e=96),t.which-e}},{key:"getKey",value:function(t){return!(t.metaKey||t.ctrlKey||t.altKey)&&(this.playPauseKey(t)?1:this.volumeUpKey(t)?2:this.volumeDownKey(t)?3:this.muteKey(t)?8:this.fullscreenKey(t)?4:this.rewindKey(t)?5:this.forwardKey(t)?6:this.numberKey(t)?9:void 0)}},{key:"_onPlayerKeydown",value:function(t){if(this.player.mediaControl.disabled)return!0;var e=this.getKey(t);if(!e)return!0;t.preventDefault(),t.stopPropagation(),this.player.mediaControl.show();var n=this.player.getCurrentTime(),r=100*this.player.getVolume(),i=this.player.getDuration(),o=this.getNumberKey(t);switch(e){case 1:this.player.togglePlay();break;case 2:this.player.setVolume(r+5,!0);break;case 3:this.player.setVolume(r-5,!0);break;case 8:this.player.isMuted()?this.player.unmute(!0):this.player.mute(!0);break;case 4:this.player.toggleFullscreen();break;case 5:this.player.seek(n-5);break;case 6:this.player.seek(n+5);break;case 9:this.player.seek(i*o*.1)}}}])&&bs(e.prototype,n),r&&bs(e,r),o}(rt);function ws(t){return(ws="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ps(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ls(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Os(t,e){return(Os=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Rs(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=Ds(t);if(e){var i=Ds(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Cs(this,n)}}function Cs(t,e){if(e&&("object"===ws(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}
1function Ds(t){return(Ds=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Is=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Os(t,e)}(o,t);var e,n,r,i=Rs(o);function o(){return Ps(this,o),i.apply(this,arguments)}return e=o,(n=[{key:"name",get:function(){return"ClickToPausePlugin"}},{key:"listenEvents",get:function(){return[{name:L.PLAYER_CLICK,handler:this._onPlayerClickEvent},{name:L.PLAYER_MEDIACONTROL_HIDE,handler:this._onHideMediaControl}]}},{key:"setUp",value:function(){this.userInteractive=!1}},{key:"_onPlayerClickEvent",value:function(){this.player.isMenuOpen||(_e?(this.userInteractive&&this.player.togglePlay(),this.userInteractive=!0):this.player.togglePlay())}},{key:"_onHideMediaControl",value:function(){this.userInteractive=!1}}])&&Ls(e.prototype,n),r&&Ls(e,r),o}(rt);function xs(t){return(xs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Ms(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Fs(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Ns(t,e){return(Ns=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Bs(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=Us(t);if(e){var i=Us(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return js(this,n)}}function js(t,e){if(e&&("object"===xs(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Us(t){return(Us=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Hs=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Ns(t,e)}(o,t);var e,n,r,i=Bs(o);function o(){return Ms(this,o),i.apply(this,arguments)}return e=o,(n=[{key:"name",get:function(){return"DoubleClickToFullscreen"}},{key:"listenEvents",get:function(){return[{name:L.PLAYER_DBLCLICK,handler:this._onDblClicked}]}},{key:"_onDblClicked",value:function(){this.options.dblClickToFullScreen&&!_e&&this.player.toggleFullscreen()}}])&&Fs(e.prototype,n),r&&Fs(e,r),o}(rt),Gs=n(4),Vs=n(2),Ys=n.n(Vs),Ks=function(){return new Promise((function(t,e){var n=new XMLHttpRequest;n.open("HEAD","//static.znews.vn/zplayer/ads.js?ad",!0),n.onreadystatechange=function(){n.readyState===XMLHttpRequest.DONE&&(200===n.status?t():e(new Error("Ad Blocker is enabled")))},n.send()}))};function zs(){var t=Array.prototype.slice.call(arguments);if(window.fetch)return window.fetch.apply(window,t);function e(t){if("string"!=typeof t&&(t=t.toString()),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function n(t){return"string"!=typeof t&&(t=t.toString()),t}function r(t){var e=this;this.map={},t instanceof r?t.forEach((function(t,n){n.forEach((function(n){e.append(t,n)}))})):t&&Object.getOwnPropertyNames(t).forEach((function(n){e.append(n,t[n])}))}function i(t){if(t.bodyUsed)return fetch.Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function o(t){return new fetch.Promise((function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}}))}function a(t){var e=new FileReader;return e.readAsArrayBuffer(t),o(e)}r.prototype.append=function(t,r){t=e(t),r=n(r);var i=this.map[t];i||(i=[],this.map[t]=i),i.push(r)},r.prototype.delete=function(t){delete this.map[e(t)]},r.prototype.get=function(t){var n=this.map[e(t)];return n?n[0]:null},r.prototype.getAll=function(t){return this.map[e(t)]||[]},r.prototype.has=function(t){return this.map.hasOwnProperty(e(t))},r.prototype.set=function(t,r){this.map[e(t)]=[n(r)]},r.prototype.forEach=function(t){var e=this;
1Object.getOwnPropertyNames(this.map).forEach((function(n){t(n,e.map[n])}))};var s={blob:"FileReader"in window&&"Blob"in window&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in window};function u(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t,"string"==typeof t)this._bodyText=t;else if(s.blob&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(s.formData&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else{if(t)throw new Error("unsupported BodyInit type");this._bodyText=""}},s.blob?(this.blob=function(){var t=i(this);if(t)return t;if(this._bodyBlob)return fetch.Promise.resolve(this._bodyBlob);if(this._bodyFormData)throw new Error("could not read FormData body as blob");return fetch.Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this.blob().then(a)},this.text=function(){var t,e,n=i(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,(e=new FileReader).readAsText(t),o(e);if(this._bodyFormData)throw new Error("could not read FormData body as text");return fetch.Promise.resolve(this._bodyText)}):this.text=function(){return i(this)||fetch.Promise.resolve(this._bodyText)},s.formData&&(this.formData=function(){return this.text().then(f)}),this.json=function(){return this.text().then((function(t){return JSON.parse(t)}))},this}var l=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function c(t,e){var n,i;if(e=e||{},this.url=t,this.credentials=e.credentials||"omit",this.headers=new r(e.headers),this.method=(i=(n=e.method||"GET").toUpperCase(),l.indexOf(i)>-1?i:n),this.mode=e.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&e.body)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(e.body)}function f(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var n=t.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(i))}})),e}function d(t){var e=new r;return t.getAllResponseHeaders().trim().split("\n").forEach((function(t){var n=t.trim().split(":"),r=n.shift().trim(),i=n.join(":").trim();e.append(r,i)})),e}var h=!("undefined"==typeof window||!window.ActiveXObject||window.XMLHttpRequest&&(new XMLHttpRequest).dispatchEvent);function p(t,e){e||(e={}),this._initBody(t),this.type="default",this.url=null,this.status=e.status,this.ok=this.status>=200&&this.status<300,this.statusText=e.statusText,this.headers=e.headers instanceof r?e.headers:new r(e.headers),this.url=e.url||""}return u.call(c.prototype),u.call(p.prototype),window.Headers=r,window.Request=c,window.Response=p,window.fetch=function(t,e){var n;return n=c.prototype.isPrototypeOf(t)&&!e?t:new c(t,e),new fetch.Promise((function(t,e){var r=function(){return h&&!/^(get|post|head|put|delete|options)$/i.test(this.method)?(this.usingActiveXhr=!0,new window.ActiveXObject("Microsoft.XMLHTTP")):new XMLHttpRequest}.call(this);function i(){if(4===r.readyState){var n=1223===r.status?204:r.status;if(n<100||n>599)e(new TypeError("Network request failed"));else{var i={status:n,statusText:r.statusText,headers:d(r),url:"responseURL"in r?r.responseURL:/^X-Request-URL:/m.test(r.getAllResponseHeaders())?r.getResponseHeader("X-Request-URL"):void 0},o="response"in r?r.response:r.responseText;t(new p(o,i))}}}"cors"===n.credentials&&(r.withCredentials=!0),r.onreadystatechange=i,this.usingActiveXhr||(r.onload=i,r.onerror=function(){e(new TypeError("Network request failed"))}),r.open(n.method,n.url,!0),"responseType"in r&&s.blob&&(r.responseType="blob"),n.headers.forEach((function(t,e){e.forEach((function(e){r.setRequestHeader(t,e)}))}
1)),r.send(void 0===n._bodyInit?null:n._bodyInit)}))},fetch.Promise=window.Promise,window.fetch.polyfill=!0,window.fetch.apply(window,t)}var Ws={load:function(t,e){return Promise.resolve().then(Ks).then((function(){return function(t){if("function"==typeof t)return t();return t}(t)})).then(qs).then((function(t){return function(t,e){var n;_.debug("AdLoader","loading ad from source:",t);var r=zs(t,{credentials:"include"}).then((function(t){return t.json()})).then((function(t){return clearTimeout(n),t&&t.ads?t.ads.schedule:[]})),i=new Promise((function(t,r){n=setTimeout((function(){return r(new Error("Timeout reached: ".concat(e)))}),e)}));return Promise.race([r,i])}(t,e)}))}};function qs(t){if(!t)throw new Error("no ad source");return t}function Xs(t){return(Xs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function $s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Qs(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Js(t,e,n){return(Js="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=nu(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function Zs(t,e){return(Zs=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function tu(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=nu(t);if(e){var i=nu(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return eu(this,n)}}function eu(t,e){if(e&&("object"===Xs(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function nu(t){return(nu=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var ru=["PosterPlugin","ClickToPausePlugin","DoubleClickToFullscreen","PauseAdPlugin","HotKeysPlugin"],iu=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Zs(t,e)}(o,t);var e,n,r,i=tu(o);function o(){return $s(this,o),i.apply(this,arguments)}return e=o,(n=[{key:"name",get:function(){return"AdsBase"}},{key:"attributes",get:function(){return{class:this.name}}},{key:"setUp",value:function(){this.interferedPlugins=[],this.pauseContentRequested=!1,this.interferedPluginNames=ru.slice(0),_.debug(this.name,"initializing"),this._loadSource()}},{key:"addInterferedPlugin",value:function(t){this.interferedPluginNames.push(t)}},{key:"getPluginOptions",value:function(){return X(this.defaultOptions,W(this._options,"pluginsOptions.ads")||this.defaultOptions)}},{key:"render",value:function(){Js(nu(o.prototype),"render",this).call(this),this.$el.hide()}},{key:"init",value:function(){throw new Error("this must be overridden")}},{key:"canHandle",value:function(t){throw new Error("this must be overridden")}},{key:"onAdsDataLoaded",value:function(t){throw new Error("this must be overridden")}},{key:"onAdWillStart",value:function(){_.info(this.name,"ad will start"),this.player.trigger(L.PLAYER_AD_WILL_START)}},{key:"onAdStarted",value:function(){_.info(this.name,"ad started"),this.player.trigger(L.PLAYER_AD_STARTED)}},{key:"onAdStopped",value:function(t){_.info(this.name,"ad stopped:",t),this.player.trigger(L.PLAYER_AD_STOPPED,{reason:t})}},{key:"onAdSkipped",value:function(){_.info(this.name,"ad skipped"),this.player.trigger(L.PLAYER_AD_SKIPPED)}},{key:"pauseForAd",value:function(){return this.pauseContentRequested?Ys.a.resolve():(_.debug(this.name,"pauseForAd"),this.pauseContentRequested=!0,this._disableMediaControl(),this._disableInterferedPlugins(),this.$el.show(),this._pausePlayback())}},{key:"resumeAfterAd",value:function(){return _.debug(this.name,"resumeAfterAd"),this.pauseContentRequested?(this.pauseContentRequested=!1,this._enableMediaControl(),this._enableInterferedPlugins(),this.$el.hide(),this._resumePlayback()):Ys.a.resolve()}},{key:"_pausePlayback",value:function(){return this.player.pause()}},{key:"_resumePlayback",value:function(){return this.player.playback.ended?Ys.a.resolve():this.player.play()}},{key:"_disableInterferedPlugins",value:function(){var t=this;this.interferedPlugins=this.interferedPluginNames.map((function(e){return(n=t.player.getPlugin(e))&&n.enabled?{enable:n.enable.bind(n),disable:n.disable.bind(n)}:{enable:function(){},disable:function(){}};var n})),this.interferedPlugins.forEach((function(t){return t.disable()}))}},{key:"_enableInterferedPlugins",value:function(){this.interferedPlugins.forEach((function(t){return t.enable()}))}},{key:"_disableMediaControl",value:function(){this.mediaControlDisabled=this.player.mediaControl.disabled,this.mediaControlDisabled||this.player.mediaControl.disable()}},{key:"_enableMediaControl",value:function(){this.mediaControlDisabled||this.player.mediaControl.enable()}},{key:"_loadSource",value:function(){var t=this,e=this.pluginOptions,n=e.source,r=e.loadTimeout,i=void 0===r?3e3:r;
1(this.pluginOptions.adLoadFn||Ws.load)(n,i).then((function(e){return t.onAdsDataLoaded(e)}),(function(e){/timeout reached/.test(e.message)&&t.player.trigger(L.PLAYER_AD_LOAD_TIMEOUT),_.error(t.name,"Cannot load ad:",e),t.onAdsDataLoaded(null)}))}}])&&Qs(e.prototype,n),r&&Qs(e,r),o}(Yt);n(27);function ou(t){return(ou="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function au(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function su(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function uu(t,e,n){return(uu="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=du(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function lu(t,e){return(lu=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function cu(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=du(t);if(e){var i=du(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return fu(this,n)}}function fu(t,e){if(e&&("object"===ou(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function du(t){return(du=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var hu=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&lu(t,e)}(o,t);var e,n,r,i=cu(o);function o(){return au(this,o),i.apply(this,arguments)}return e=o,(n=[{key:"name",get:function(){return"AdsPlugin"}},{key:"defaultOptions",get:function(){return{replayAds:!1,showSlideBlack:!0,removeAdmarkOnError:!0,startTimeout:1e4,skipTimeout:3e3,autoPlayAdBreaks:!0,minDurationShowAd:5}}},{key:"listenEvents",get:function(){return[{name:L.PLAYER_PLAY_INTENT,handler:this._onUserActionEvent},{name:L.PLAYER_TIMEUPDATE,handler:this._onTimeUpdate},{once:!0,name:L.PLAYER_LOADEDMETADATA,handler:this._onLoadedMetadata},{once:!this.pluginOptions.replayAds,name:L.PLAYER_ENDED,handler:this._onPlaybackEnded},{name:L.PLAYER_ERROR,handler:this._onPlayerError},{name:L.PLAYER_AD_PAUSE_REQUEST,handler:this._onAdPauseRequest},{name:L.PLAYER_AD_RESUME_REQUEST,handler:this._onAdResumeRequest},{name:L.PLAYER_UPDATE_SIZE,handler:this._onResize},{name:L.PLAYER_MEDIACONTROL_SHOW,handler:this._onPlayerControlShow},{name:L.PLAYER_MEDIACONTROL_HIDE,handler:this._onPlayerControlHide},{once:!0,name:L.PLAYER_MEDIACONTROL_READY,handler:this._onPlayerControlReady},{name:L.PLAYER_FULLSCREEN,handler:this._onPlayerFullscreen}]}},{key:"setUp",value:function(){_.debug(this.name,"setUp"),uu(du(o.prototype),"setUp",this).call(this),this.metadataDeferred=Te(),this.runnerDeferred=Te(),this.runnerDeferredPromise=this.runnerDeferred.promise,this.rootPosterConfig=this.pluginOptions.poster,this._onResize=this._onResize.bind(this),window.on("resize.ads",this._onResize,!1),this.player.$el.append(this.$el),this.nonLinearAdContainer=Et("div",{},{class:"AdsPluginNonLinear"}),this.player.$el.append(this.nonLinearAdContainer),this.runner=null}},{key:"onAdsDataLoaded",value:function(t){var e=this;this._transformAdsData(t).then((function(t){t&&t.length?e._runnerProxy((function(){e.runner.onAdsDataLoaded(t)})):(_.info(e.name,"empty ad data, destroying plugin..."),e.destroy())}))}},{key:"destroy",value:function(){var t=this;uu(du(o.prototype),"destroy",this).call(this),window.off("resize.ads",this._onResize,!1),Ot(this.nonLinearAdContainer),this._runnerProxy((function(){t.runner.destroy(),t.runner=null}
1)),_.debug(this.name,"destroyed")}},{key:"getPoster",value:function(){var t=this.player.getPlayerSize().width;if(this.pluginOptions.poster=!(t<=400)&&this.rootPosterConfig,!this.pluginOptions.poster)return Promise.resolve();var e=this.player.getPlugin("PosterPlugin");return e?Promise.resolve(e.getPosterUrl()):Promise.resolve()}},{key:"getContentPlayer",value:function(){return this.player.playback.el}},{key:"getContentVolume",value:function(){return this.player.isMuted()?0:100*this.player.getVolume()}},{key:"getContentMetadata",value:function(){return this.metadataDeferred.promise}},{key:"getAdContainers",value:function(){var t=this.player.mediaControl.getControl("SeekBarControl");return{linear:this.el,nonLinear:this.nonLinearAdContainer,notification:this.player.el,adMark:t&&t.el}}},{key:"getLogger",value:function(){return _}},{key:"onAdStarted",value:function(){var t=this;uu(du(o.prototype),"onAdStarted",this).call(this),!this.player.options.customIosFullscreen&&le&&eo.isFullscreen()&&(_.info(this.name,"player in fullscreen mode on iOS, skipping ad..."),this._runnerProxy((function(){t.runner.stopAd()})))}},{key:"_onUserActionEvent",value:function(){var t=this;this._runnerProxy((function(){t.runner.onUserAction()}))}},{key:"_onPlaybackEnded",value:function(){var t=this;this._runnerProxy((function(){t.runner.onContentEnded()})),this.pluginOptions.replayAds&&this._loadSource()}},{key:"_onPlayerError",value:function(){this.destroy()}},{key:"_onTimeUpdate",value:function(t){var e=this;this.player.mediaControl.draggingSeekBar||this._runnerProxy((function(){e.runner.onContentProgress(t)}))}},{key:"_onLoadedMetadata",value:function(t){this.player.getDuration()<this.pluginOptions.minDurationShowAd&&this.destroy(),this.metadataDeferred.resolve(t)}},{key:"_onAdPauseRequest",value:function(){this._pauseAd()}},{key:"_onAdResumeRequest",value:function(){this._resumeAd()}},{key:"_onResize",value:function(t){var e=arguments,n=this,r=this.player.getPlayerSize().width,i=this.rootPosterConfig&&r>400;this._runnerProxy((function(){var r=n.runner;K.nullOrUndefined(r)||(r.showPosterAndPlayIcon(i),"resize"===t.type?r.resize():r.resize.apply(r,e))}))}},{key:"_pauseAd",value:function(){var t=this;this._runnerProxy((function(){t.runner.pauseAd()}))}},{key:"_resumeAd",value:function(){var t=this;this._runnerProxy((function(){t.runner.resumeAd()}))}},{key:"_transformAdsData",value:function(t){var e=this.pluginOptions.transform;return"function"!=typeof e?Promise.resolve(t):(_.debug(this.name,"transforming ad data..."),this.getContentMetadata().then((function(n){return e(t,n)})))}},{key:"_runnerProxy",value:function(t){this.runnerDeferred&&this.runnerDeferredPromise.then(t)}},{key:"_toggleMediaControls",value:function(){var t=this,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this._runnerProxy((function(){var n=e?"addClass":"removeClass";t.runner.adUi.countdownToPlay[n]("has_controls_bar"),t.runner.adUi.$uiLoading[n]("has_controls_bar")}))}},{key:"_onPlayerControlShow",value:function(){this._toggleMediaControls()}},{key:"_onPlayerControlHide",value:function(){this._toggleMediaControls(!1)}},{key:"_onPlayerControlReady",value:function(){this.runner||(this.runnerOptions={startTimeout:this.pluginOptions.startTimeout/1e3,skipTimeout:this.pluginOptions.skipTimeout/1e3,countdownPlay:!this.pluginOptions.noCountdownPlay,showSlideBlack:this.pluginOptions.showSlideBlack,removeAdmarkOnError:this.pluginOptions.removeAdmarkOnError,autoPlayAdBreaks:this.pluginOptions.autoPlayAdBreaks,autoPlay:!!this.player.options.autoPlay,mute:!!this.player.options.mute},this.runner=new Gs.Runner(this,this.runnerOptions),this.runnerDeferred.resolve())}},{key:"_onPlayerFullscreen",value:function(){this._onResize("resize")}}])&&su(e.prototype,n),r&&su(e,r),o}(iu);n(28);function pu(t){return(pu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function yu(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function vu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function gu(t,e){return(gu=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function mu(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=Eu(t);if(e){var i=Eu(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return bu(this,n)}}function bu(t,e){if(e&&("object"===pu(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Eu(t){return(Eu=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var _u=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&gu(t,e)}(o,t);var e,n,r,i=mu(o);function o(){return yu(this,o),i.apply(this,arguments)}return e=o,(n=[{key:"name",get:function(){return"BigPlayButtonPlugin"}},{key:"tagName",get:function(){return"button"}},{key:"className",get:function(){return"--z--big-play-button"}},{key:"attributes",get:function(){return{class:this.className,type:"button"}}},{key:"events",get:function(){return{click:"handleClick",touch:"handleClick"}}},{key:"listenEvents",get:function(){return[{name:L.PLAYER_PLAY,handler:this._onPlayerPlay},{name:L.PLAYER_PLAY_INTENT,handler:this._onPlayerPlay},{name:L.PLAYER_PAUSE,handler:this._onPlayerPause}]}},{key:"defaultOptions",get:function(){return{showOnPauseMobile:!0}}},{key:"setUp",value:function(){this.pluginOptions.disabled&&this.disable()}},{key:"handleClick",value:function(t){return t.stopPropagation(),this.player.play(),this.player.el.focus(),!1}},{key:"_onPlayerPlay",value:function(){this.hide()}},{key:"_onPlayerPause",value:function(){this.pluginOptions.showOnPauseMobile&&this.show()}},{key:"render",value:function(){var t=Et("span",{}
1,{class:"--z--icon pl-ic-play_arrow"});return dt(t,this.pluginOptions.iconStyles),dt(this.el,this.pluginOptions.buttonStyles),this.setAttribute("title","Phát"),this.el.append(t),this.player.el.append(this.el),this}}])&&vu(e.prototype,n),r&&vu(e,r),o}(Yt);n(29);function Tu(t){return(Tu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ku(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Au(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Su(t,e){return(Su=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function wu(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=Lu(t);if(e){var i=Lu(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Pu(this,n)}}function Pu(t,e){if(e&&("object"===Tu(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Lu(t){return(Lu=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Ou=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Su(t,e)}(o,t);var e,n,r,i=wu(o);function o(){return ku(this,o),i.apply(this,arguments)}return e=o,(n=[{key:"name",get:function(){return"PlayPauseFaceoutPlugin"}},{key:"tagName",get:function(){return"button"}},{key:"className",get:function(){return"--z--playpause-fadeout"}},{key:"attributes",get:function(){return{class:this.className,type:"button"}}},{key:"listenEvents",get:function(){return[{name:L.PLAYER_CLICK,handler:this._onPlayerClick},{name:L.PLAYER_ENDED,handler:this._onPlayerEnded},{name:L.PLAYER_PLAY_INTENT,handler:this._onPlayerPlayIntent}]}},{key:"setUp",value:function(){this.pluginOptions.disabled||_e?this.disable():(this.bigPlayButtonPlugin=this.player.getPlugin("BigPlayButtonPlugin"),this.isPlaying=!this.player.isPlaying(),this.mediaControlDisabled=this.player.mediaControl.disabled,this.bigPlayButtonEnabled=this.bigPlayButtonPlugin.enabled)}},{key:"_disableInterferedPlugins",value:function(){this.bigPlayButtonEnabled&&this.bigPlayButtonPlugin.disable()}},{key:"_onPlayerPlayIntent",value:function(){this._disableInterferedPlugins()}},{key:"_onPlayerClick",value:function(){this.player.isMenuOpen||this._togglePlayPause()}},{key:"_togglePlayPause",value:function(){var t=this;this.isPlaying=!this.isPlaying,dt(this.el,{display:"flex"}),setTimeout((function(){dt(t.el,{display:"none"})}),500),ct(this.iconEl,"pl-ic-play_arrow",this.isPlaying),ct(this.iconEl,"pl-ic-pause",!this.isPlaying)}},{key:"_onPlayerEnded",value:function(){this.bigPlayButtonEnabled&&this.bigPlayButtonPlugin.enable(),this.mediaControlDisabled||this.player.mediaControl.enable()}},{key:"render",value:function(){return this.iconEl=Et("span",{},{class:"--z--icon pl-ic-play_arrow"}),dt(this.iconEl,this.pluginOptions.iconStyles),dt(this.el,this.pluginOptions.buttonStyles),this.el.append(this.iconEl),this.player.el.append(this.el),this}}])&&Au(e.prototype,n),r&&Au(e,r),o}(Yt),Ru=new Blob([new Uint8Array([255,227,24,196,0,0,0,3,72,1,64,0,0,4,132,16,31,227,192,225,76,255,67,12,255,221,27,255,228,97,73,63,255,195,131,69,192,232,223,255,255,207,102,239,255,255,255,101,158,206,70,20,59,255,254,95,70,149,66,4,16,128,0,2,2,32,240,138,255,36,106,183,255,227,24,196,59,11,34,62,80,49,135,40,0,253,29,191,209,200,141,71,7,255,252,152,74,15,130,33,185,6,63,255,252,195,70,203,86,53,15,255,255,247,103,76,121,64,32,47,255,34,227,194,209,138,76,65,77,69,51,46,57,55,170,170,170,170,170,170,170,170,170,170,255,227,24,196,73,13,153,210,100,81,135,56,0,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170])],{type:"audio/mpeg"}),Cu=new Blob([new Uint8Array([0,0,0,28,102,116,121,112,105,115,111,109,0,0,2,0,105,115,111,109,105,115,111,50,109,112,52,49,0,0,0,8,102,114,101,101,0,0,2,239,109,100,97,116,33,16,5,32,164,27,255,192,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,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,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,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,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,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,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,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,0,0,0,0,55,167,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,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,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,112,33,16,5,32,164,27,255,192,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,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,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,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,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,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,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,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,0,0,0,0,55,167,128,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,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,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,112,0,0,2,194,109,111,111,118,0,0,0,108,109,118,104,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,232,0,0,0,47,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,0,0,0,3,0,0,1,236,116,114,97,107,0,0,0,92,116,107,104,100,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,47,0,0,0,0,0,0,0,0,0,0,0,1,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,0,0,0,0,0,0,0,0,0,0,0,36,101,100,116,115,0,0,0,28,101,108,115,116,0,0,0,0,0,0,0,1,0,0,0,47,0,0,0,0,0,1,0,0,0,0,1,100,109,100,105,97,0,0,0,32,109,100,104,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,172,68,0,0,8,0,85,196,0,0,0,0,0,45,104,100,108,114,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,0,0,1,15,109,105,110,
1102,0,0,0,16,115,109,104,100,0,0,0,0,0,0,0,0,0,0,0,36,100,105,110,102,0,0,0,28,100,114,101,102,0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1,0,0,0,211,115,116,98,108,0,0,0,103,115,116,115,100,0,0,0,0,0,0,0,1,0,0,0,87,109,112,52,97,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,16,0,0,0,0,172,68,0,0,0,0,0,51,101,115,100,115,0,0,0,0,3,128,128,128,34,0,2,0,4,128,128,128,20,64,21,0,0,0,0,1,244,0,0,1,243,249,5,128,128,128,2,18,16,6,128,128,128,1,2,0,0,0,24,115,116,116,115,0,0,0,0,0,0,0,1,0,0,0,2,0,0,4,0,0,0,0,28,115,116,115,99,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,2,0,0,0,1,0,0,0,28,115,116,115,122,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,115,0,0,1,116,0,0,0,20,115,116,99,111,0,0,0,0,0,0,0,1,0,0,0,44,0,0,0,98,117,100,116,97,0,0,0,90,109,101,116,97,0,0,0,0,0,0,0,33,104,100,108,114,0,0,0,0,0,0,0,0,109,100,105,114,97,112,112,108,0,0,0,0,0,0,0,0,0,0,0,0,45,105,108,115,116,0,0,0,37,169,116,111,111,0,0,0,29,100,97,116,97,0,0,0,1,0,0,0,0,76,97,118,102,53,54,46,52,48,46,49,48,49])],{type:"video/mp4"});function Du(t){return Object.assign({muted:!1,timeout:250,inline:!1},t)}function Iu(t,e){var n=t.muted,r=t.timeout,i=t.inline,o=e(),a=o.element,s=o.source,u=void 0,l=void 0,c=void 0;return a.muted=n,!0===n&&a.setAttribute("muted","muted"),!0===i&&a.setAttribute("playsinline","playsinline"),a.src=s,new Promise((function(t){u=a.play(),l=setTimeout((function(){c(!1,new Error("Timeout "+r+" ms has been reached"))}),r),c=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;a.remove(),a.srcObject=null,clearTimeout(l),t({result:e,error:n})},void 0!==u?u.then((function(){return c(!0)})).catch((function(t){return c(!1,t)})):c(!0)}))}var xu={audio:function(t){return Iu(t=Du(t),(function(){return{element:document.createElement("audio"),source:URL.createObjectURL(Ru)}}))},video:function(t){return Iu(t=Du(t),(function(){return{element:document.createElement("video"),source:URL.createObjectURL(Cu)}}))}};n(30);function Mu(t){return(Mu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Fu(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Nu(t,e,n){return(Nu="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Hu(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function Bu(t,e){return(Bu=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function ju(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=Hu(t);if(e){var i=Hu(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Uu(this,n)}}function Uu(t,e){if(e&&("object"===Mu(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Hu(t){return(Hu=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Gu=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Bu(t,e)}(o,t);var e,n,r,i=ju(o);function o(t,e){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(n=i.call(this,t)).pluginOptions=e,n.render(),n.bindEvents(),n}return e=o,(n=[{key:"attributes",get:function(){return{class:"--z--unmute-box"}}},{key:"listenEvents",get:function(){return[{name:L.PLAYER_VOLUMEUPDATE,handler:this._update}]}},{key:"events",get:function(){return{click:"handleClick",touch:"handleClick"}}},{key:"render",value:function(){return Nu(Hu(o.prototype),"render",this).call(this),this.el.innerHTML='<button class="--z--btn-unmute" title=\''.concat(this.pluginOptions.boxUnmute.message,'\'>\n <i class="--z--icon pl-ic-volume_off"></i>\n </button>
1\n <span>').concat(this.pluginOptions.boxUnmute.message,"</span>"),this.player.el.append(this.el),this}},{key:"handleClick",value:function(t){t.stopPropagation(),this.player.unmute(),this.remove()}},{key:"_update",value:function(){this.player.isMuted()||this.remove()}}])&&Fu(e.prototype,n),r&&Fu(e,r),o}(Nt);function Vu(t){return(Vu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Yu(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Ku(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function zu(t,e,n){return(zu="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=$u(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function Wu(t,e){return(Wu=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function qu(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=$u(t);if(e){var i=$u(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Xu(this,n)}}function Xu(t,e){if(e&&("object"===Vu(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function $u(t){return($u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Qu=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Wu(t,e)}(o,t);var e,n,r,i=qu(o);function o(){return Yu(this,o),i.apply(this,arguments)}return e=o,r=[{key:"NAME_EVENTS",get:function(){return["PLUGIN_AUTOPLAY_MUTE"]}}],(n=[{key:"name",get:function(){return"AutoPlayPlugin"}},{key:"defaultOptions",get:function(){return{showInSettingsMenu:!1,timeout:1e3,showBoxUnmute:!0,boxUnmute:{message:"Nhấn Äá» báºt tiếng"}}}},{key:"registerMenuCallback",value:function(t){this.menuItemEl=t}},{key:"setUp",value:function(){var t=this;if(this.options.autoPlay&&this.enabled){var e="";switch(this.player.getPlaybackType()){case ne.VOD:e="video";break;case ne.AOD:e="audio"}e&&xu[e]({timeout:this.pluginOptions.timeout,inline:!0}).then((function(n){n.result?t.player.play():(t.player.mute(),xu[e]({timeout:t.pluginOptions.timeout,muted:!0,inline:!0}).then((function(e){var n=e.result,r=e.error;n?(_.info(t.name,"autoplay muted"),t.player.play(),t.trigger(t._nameEvents.PLUGIN_AUTOPLAY_MUTE),t.pluginOptions.showBoxUnmute&&(t.boxUnmute=new Gu(t.player,t.pluginOptions))):(_.warn(t.name,"autoplay failed: ",r),t.player.unmute())})).catch((function(){t.player.unmute()})))})),this.player.getPlayerControl("SettingsControl")&&this.pluginOptions.showInSettingsMenu&&(this.pluginLabel="Tá»± Äá»ng phát",this.autoPlayChecked=!!this.options.autoPlay,this.updateSettingsControl())}else this.disable()}},{key:"_toggleAutoPlay",value:function(t){t.stopPropagation(),this.autoPlayChecked=!this.autoPlayChecked,this.updateSettingsControl(!0)}},{key:"updateSettingsControl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=t?"asyncRegisterMenuItem":"registerMenuItem",n=this.player.getPlayerControl("SettingsControl");n&&n.settingsMenu[e]({pluginKey:this.name,type:To.MENU_TYPE.TOGGLE,config:{title:this.pluginLabel,checked:this.autoPlayChecked,clickCallback:this._toggleAutoPlay.bind(this)},order:0,callback:this.registerMenuCallback.bind(this)})}},{key:"destroy",value:function(){zu($u(o.prototype),"destroy",this).call(this),this.boxUnmute&&this.boxUnmute.remove()}}])&&Ku(e.prototype,n),r&&Ku(e,r),o}(rt);function Ju(t,e){if(K.array(t)&&e){var n=Ke(t.filter((function(t){return!t.disabled})),"label",e);if(K.object(n)&&(n.source||n.level))return n}}function Zu(t){return(Zu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function tl(t){return function(t){if(Array.isArray(t))return el(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return el(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return el(t,e)}(t)||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 el(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function nl(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function rl(t,e){return(rl=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function il(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=al(t);if(e){var i=al(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return ol(this,n)}}function ol(t,e){if(e&&("object"===Zu(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function al(t){return(al=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var sl=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&rl(t,e)}(o,t);var e,n,r,i=il(o);function o(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o),(e=i.call(this,t)).pluginLabel="Chất lượng",e.currentSourceLevel=null,e.autoEnabled=!0,e}return e=o,(n=[{key:"name",get:function(){return"QualityPlugin"}},{key:"defaultOptions",get:function(){return{autoText:"Auto",autoTextItem:"Auto"}}},{key:"registerMenuCallback",value:function(t){this.menuItemEl=t}},{key:"render",value:function(){if(this.player.isHlsPlayback())return this.listenTo(this.player,L.PLAYER_LEVELS_AVAILABEL,this.onPlayerLevelsAvailabel),void this.listenTo(this.player,L.PLAYER_LEVEL_SWITCHED,this.onPlayerLevelSwitched);if(this.autoEnabled=!1,this.levels=this.player.options.sources||[],this.handleDisplayName(),this.currentSourceLevel=void 0!==this.player.options.currentSourceLevel?this.findIndexFromSourceLevels(this.player.options.currentSourceLevel):0,this.levels.length<2||-1===this.currentSourceLevel)this.disable();else{this.levels=this.orderLevelsByIndex(this.levels),this.handleDisplayName();var t=this.levels[this.currentSourceLevel];this.settingBadgeLabel=this._generateHdLabel(t.label),this.updateSettingsControl()}}},{key:"updateSettingsControl",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=t?"asyncRegisterMenuItem":"registerMenuItem",n=this.player.mediaControl.getControl("SettingsControl");n&&(n.settingsButton.updateBadgeLabel(this.settingBadgeLabel),n.settingsMenu[e]({pluginKey:this.name,type:To.MENU_TYPE.EXPAND,config:{title:this.pluginLabel,activeItemIndex:this.currentSourceLevel,clickCallback:this.handleExpandQuality.bind(this),subMenu:{type:To.LIST_MENU_TYPE.CHECKLIST,clickCallback:this.handleQualitySelected.bind(this),titleClickCallback:this.titleClickCallback.bind(this),data:this.levels}},order:0,callback:this.registerMenuCallback.bind(this)}))}},{key:"handleDisplayName",value:function(){var t=this.pluginOptions,e=t.displayName,n=t.autoTextItem;(e||n)&&this.levels.map((function(t){if(e&&t.label){var r=e[t.label];r&&(t.displayName=r)}return"auto"==t.label.toLowerCase()&&(t.label=n),t}))}},{key:"orderLevelsByIndex",value:function(t){return Ye(t,"index",!1)}},{key:"onPlayerLevelsAvailabel",value:function(t){var e=this.player.options.sources||[];this.levels=this.orderLevelsByIndex([].concat(tl(t),tl(e))),this.handleDisplayName();var n=Ju(this.levels,this.player.options.quality);n&&(this.player.options.currentSourceLevel=n.index,this.settingBadgeLabel=this._generateHdLabel(n.label),this.offAuto=!0),this.currentSourceLevel=void 0!==this.player.options.currentSourceLevel?this.findIndexFromSourceLevels(this.player.options.currentSourceLevel):this.findIndexFromSourceLevels(-1);var r=this.levels[this.currentSourceLevel];r&&-1!==r.index&&this.handleHLSLevelSelect(r)}},{key:"findIndexFromSourceLevels",value:function(t){return We(this.levels,"index",t)}},{key:"_generateHdLabel",value:function(t){var e=parseInt(t);return this.currentLabel=t,e>=720?"HD":""}},{key:"onPlayerLevelSwitched",value:function(t){var e=t.label;this.currentSwitchedLabel=e,clearTimeout(this.playerLevelSwitchedTimeout),!this.offAuto&&(this.settingBadgeLabel=this._generateHdLabel(e)),this.updateSettingsControl(!0);var n=ot()(this.menuItemEl).find(".--z--zpl-has-expand span"),r=this.pluginOptions.autoText;this.autoEnabled&&(n.empty(),n.text(r+" "+this.transformDisplayNameLabel(e)))}},{key:"titleClickCallback",value:function(){var t=ot()(this.menuItemEl).find(".--z--zpl-has-expand span"),e=this.pluginOptions.autoText;this.autoEnabled&&(t.empty(),t.text(e+" "+this.transformDisplayNameLabel(this.currentLabel)))}},{key:"transformDisplayNameLabel",value:function(t){var e=this.pluginOptions.displayName;return e&&e[t]||t}},{key:"handleQualitySelected",value:function(t,e){t.stopPropagation();var n=e.data;if(this.player.trigger(L.PLAYER_QUALITY_LEVELS_SELECTED,n,e),this.player.trigger(L.PLAYER_SETTINGS_MENU_HIDE),n&&!n.disabled){var r=this.findIndexFromSourceLevels(n.index);if(this.currentSourceLevel===r)return!1;this.player.storage.set({quality:n.label}),this.player.isHlsPlayback()?this.handleHLSLevelSelect(n):this.handleMP4QualitySelect(n)}}},{key:"handleMP4QualitySelect",value:function(t){var e=this.player.getCurrentTime(),n=this.player.isPlaying();this.player.stop(),this.player.setupSource(t.source),this.player.setPreload("metadata"),n&&this.listenToOnce(this.player,L.PLAYER_SEEKED,this.onPlayerSeeked),this.player.seek(e),this.currentSourceLevel=this.findIndexFromSourceLevels(t.index),this.settingBadgeLabel=this._generateHdLabel(t.label),this.autoEnabled=!1,this.updateSettingsControl(!0)}},{key:"onPlayerSeeked",value:function(){this.player.play()}},{key:"handleHLSLevelSelect",value:function(t){var e=this,n=t.index,r=-1===n;r&&(this.offAuto=!1),this.currentSourceLevel=this.findIndexFromSourceLevels(n),this.autoEnabled=r,this.player.setCurrentLevel(n),this.player.setStartLevel(n),this.playerLevelSwitchedTimeout=setTimeout((function(){e.onPlayerLevelSwitched({label:e.currentSwitchedLabel})}),1e3)}},{key:"handleExpandQuality",value:function(t){t.stopPropagation()}}])&&nl(e.prototype,n),r&&nl(e,r),o}(Yt);n(31);function ul(t){return(ul="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ll(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function cl(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function fl(t,e){return(fl=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function dl(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=pl(t);if(e){var i=pl(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return hl(this,n)}}function hl(t,e){if(e&&("object"===ul(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function pl(t){return(pl=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var yl=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&fl(t,e)}(o,t);var e,n,r,i=dl(o);function o(){return ll(this,o),i.apply(this,arguments)}
1return e=o,(n=[{key:"name",get:function(){return"DVRControlsPlugin"}},{key:"attributes",get:function(){return{class:"--z--control --z--control-dvr","data-dvr-controls":""}}},{key:"listenEvents",get:function(){return[{once:!0,name:L.PLAYER_DVRSTATECHANGED,handler:this.dvrChanged}]}},{key:"setUp",value:function(){this.pluginOptions.disabled&&this.disable()}},{key:"dvrChanged",value:function(){_.info(this.name,"dvrChanged"),this.addDvrToMediaControls()}},{key:"addDvrToMediaControls",value:function(){if(this.player.isLive()){var t=Et("button",{innerHTML:'<span class="icon-live"></span><span class="text">LIVE</span>'},{class:"--z--control --z--btn --z--drv-icon"});this.$el.append(t),this.player.mediaControl.leftElement.append(this.el)}}}])&&cl(e.prototype,n),r&&cl(e,r),o}(Yt);function vl(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=ml(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function gl(t){return function(t){if(Array.isArray(t))return bl(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||ml(t)||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 ml(t,e){if(t){if("string"==typeof t)return bl(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?bl(t,e):void 0}}function bl(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function El(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var _l=function t(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];El(this,t),this.playbackPlugins=[vn,sn,Ve,An],this.plugins=[],n&&this.plugins.push(fa);var r=[Ea,_u,Ou,Is,Hs,Qu,Ra,vs,Ss,hu,yl,sl];if(this.plugins=[].concat(gl(this.plugins),r),this.plugins.push(as),!K.empty(e)){var i,o=vl(e);try{for(o.s();!(i=o.n()).done;){var a=i.value;K.function(a)&&this.plugins.push(a)}}catch(t){o.e(t)}finally{o.f()}}},Tl=function(t,e,n){this.namespaces||(this.namespaces={}),this.namespaces[t]=e;var r=n||!1;return this.addEventListener(t.split(".")[0],e,r),this},kl=function(t){return this.removeEventListener(t.split(".")[0],this.namespaces[t]),delete this.namespaces[t],this};function Al(t){return(Al="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Sl(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function wl(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Pl(t,e){return(Pl=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Ll(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=Rl(t);if(e){var i=Rl(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Ol(this,n)}}function Ol(t,e){if(e&&("object"===Al(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function Rl(t){return(Rl=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}window.on=document.on=Element.prototype.on=Tl,window.off=document.off=Element.prototype.off=kl;var Cl=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Pl(t,e)}(o,t);var e,n,r,i=Ll(o);function o(){return Sl(this,o),i.apply(this,arguments)}return e=o,(n=[{key:"getControl",value:function(){return null}},{key:"show",value:function(){}},{key:"hide",value:function(){}}])&&wl(e.prototype,n),r&&wl(e,r),o}(Yt);function Dl(t){return(Dl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function Il(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function xl(t,e,n){return(xl="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=jl(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function Ml(t,e){return(Ml=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Fl(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=jl(t);if(e){var i=jl(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return Nl(this,n)}}function Nl(t,e){if(e&&("object"===Dl(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Bl(t)}function Bl(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function jl(t){return(jl=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}var Ul={mute:!1,loop:!1,autoPlay:!1,volume:100,height:360,width:640,preload:"metadata",dblClickToFullScreen:!0,lockRotateFullscreen:!1,setStorageTheaterMode:!0},Hl=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Ml(t,e)}(o,t);var e,n,r,i=Fl(o);function o(t){var e;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,o);var n=t.storageKey,r=new Qa(void 0===n?"zplayer":n);return(e=i.call(this,null,X({},Ul,t,r.get())))._extendsOptions(e.options),_.debug(e.name,"player initialized with option:",t),e.storage=r,e.plugins=[],e._onFullScreenChanged=e._onFullScreenChanged.bind(Bl(e)),e.onWindowBlur=e.onWindowBlur.bind(Bl(e)),e._onOrientationChanged=e._onOrientationChanged.bind(Bl(e)),e.isMenuOpen=!1,e.theaterMode=!!e.options.theaterMode,e.toggleClass("--theater-mode",e.theaterMode),e}return e=o,(n=[{key:"name",get:function(){return"Player"}},{key:"attributes",get:function(){var t=this.options,e=t.width,n=t.height;return{class:t.className||"--z--player","data-player":"",tabindex:1,style:"\n width: ".concat(e&&K.number(e)?e+"px":e,";\n height: ").concat(n&&K.number(n)?n+"px":n,"\n ")}}},{key:"events",get:function(){return{click:"onClicked",dblclick:"onDblClicked",contextmenu:"onContextMenu",keydown:"onKeydown",mousemove:"onMouseMove",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchstart:"onMouseMove",touchleave:"onMouseLeave"}}},{key:"listenEvents",get:function(){return[{name:L.PLAYBACK_BUFFERING,handler:this.onBuffering},{name:L.PLAYBACK_BUFFERING_CHANGE,handler:this.onBufferingChange},{name:L.PLAYBACK_BUFFERFULL,handler:this.onBufferfull},{name:L.PLAYBACK_LOADEDMETADATA,handler:this.onLoadedMetadata},{name:L.PLAYBACK_TIMEUPDATE,handler:this.onTimeUpdated},{name:L.PLAYBACK_PROGRESS,handler:this.onProgress},{name:L.PLAYBACK_SEEKED,handler:this.onSeeked},{name:L.PLAYBACK_SEEKING,handler:this.onSeeking},{name:L.PLAYBACK_ENDED,handler:this.onEnded},{name:L.PLAYBACK_PLAY,handler:this.onPlay},{name:L.PLAYBACK_PAUSE,handler:this.onPaused},{name:L.PLAYBACK_STOP,handler:this.onStopped},{name:L.PLAYBACK_ERROR,handler:this.onError},{name:L.PLAYBACK_VOLUMEUPDATE,handler:this.onVolumeUpdated},{name:L.PLAYBACK_LEVELS_AVAILABLE,handler:this.onLevelsAvailabel},{name:L.PLAYBACK_LEVEL_SWITCHED,handler:this.onLevelSwitched},{name:L.PLAYBACK_FULLSCREEN_IOS,handler:this._onFullScreenIosChanged},{name:L.PLAYBACK_CANPLAYTHROUGH,handler:this.onCanPlayThrough},{name:L.PLAYBACK_WAITING,handler:this.onWaiting},{once:!0,name:L.PLAYBACK_DVRSTATECHANGED,handler:this.onDrvChanged},{once:!0,name:L.PLAYBACK_PLAY,handler:this.onDrvChanged}]}},{key:"buffering",get:function(){return this.playback.buffering}},{key:"loader",get:function(){return this._loader||(this._loader=new _l(this.options.plugins,this.options.useDefaultControl)),this._loader},set:function(t){this.loader=t}},{key:"mediaControl",get:function(){return this.getPlugin("ControlsPlugin")||this.dummyMediaControl}},{key:"dummyMediaControl",get:function(){return this._dummyMediaControl||(this._dummyMediaControl=new Cl(this)),this._dummyMediaControl}},{key:"bindEvents",value:function(){xl(jl(o.prototype),"bindEvents",this).call(this,this.playback),this._addEventsFullScreen(),window.on("orientationchange",this._onOrientationChanged,!1),window.on("blur",this.onWindowBlur,!1)}},{key:"unbindEvents",value:function(){xl(jl(o.prototype),"unbindEvents",this).call(this,this.playback),this._removeEventsFullScreen(),window.off("orientationchange",this._onOrientationChanged,!1),window.off("blur",this.onWindowBlur,!1)}},{key:"hasPlugin",value:function(t){return!!this.getPlugin(t)}},{key:"getPlugin",value:function(t){return this.plugins.find((function(e){return e.name===t}))}},{key:"removePlugin",value:function(t){this.plugins=this.plugins.filter((function(e){return e.name!==t}))}},{key:"getPlaybackType",value:function(){return this.playback.getPlaybackType()}},{key:"getPlaybackName",value:function(){return this.playback.name}},{key:"appendToParent",value:function(){if(!this.el)return null;this.options.parentElement.appendChild(this.el)}},{key:"render",value:function(){if(!this.el)return null;this.$el.append(this.playback.render().el)}},{key:"destroy",value:function(){this.plugins.forEach((function(t){return t.destroy()})),this.playback.destroy(),this.unbindEvents(),this.remove()}},{key:"attachTo",value:function(t){var e=this;this.options.parentElement=t,this._initPlayback(),this.bindEvents(),this.render(),this._initPlugins(),this.appendToParent(),this.playback.isReady().then((function(){return e._initConfig()}
1)).then((function(){return Promise.all(e.plugins.map((function(t){return t.initialize()})))})).then((function(){_.info(e.name,"IS LIVE",e.isLive()),e.trigger(L.PLAYER_READY,e.name)})).catch((function(t){_.error(e.name,"error while initializing player:",t)})),this.setPlayerFontSizeBase()}},{key:"getDuration",value:function(){return this.playback.getDuration()}},{key:"isPlaying",value:function(){return this.playback.isPlaying()}},{key:"play",value:function(){this.isPlaying()||(this.trigger(L.PLAYER_PLAY_INTENT),this.playback.play())}},{key:"pause",value:function(){this.isPlaying()&&this.playback.pause()}},{key:"togglePlay",value:function(){this.buffering||(this.isPlaying()?this.pause():this.play())}},{key:"stop",value:function(){this.playback.stop()}},{key:"pauseAd",value:function(){this.trigger(L.PLAYER_AD_PAUSE_REQUEST)}},{key:"resumeAd",value:function(){this.trigger(L.PLAYER_AD_RESUME_REQUEST)}},{key:"getVolume",value:function(){return this.playback.getVolume()}},{key:"setVolume",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!K.number(t)||t<0||t>100)_.debug(this.name,"setVolume fail , volume = ",t);else{var n=this.getVolume();this.playback.volume(t),e&&this.storage.set({volume:t,beforeMuteVolume:n})}}},{key:"mute",value:function(t){return this.setVolume(0,t),this}},{key:"unmute",value:function(t){var e=this.storage.get("beforeMuteVolume");return(!K.number(e)||e<=0)&&(e=1),this.setVolume(100*e,t),this}},{key:"isMuted",value:function(){return this.playback.isMuted()}},{key:"seek",value:function(t){this.isLive()||t<0||t>this.getDuration()||(this.trigger(L.PLAYER_SEEK,t,this.name),this.playback.seek(t))}},{key:"isFullscreen",value:function(){return eo.isFullscreen()}},{key:"isTheaterMode",value:function(){return this.theaterMode}},{key:"setupSource",value:function(t){this.playback.setupSource(t)}},{key:"getSource",value:function(){this.playback.getSource()}},{key:"setCurrentLevel",value:function(t){this.playback.currentLevel=t}},{key:"setStartLevel",value:function(t){this.playback.startLevel=t}},{key:"setPreload",value:function(t){this.playback.setPreload(t)}},{key:"getPlayerControl",value:function(t){return this.mediaControl&&this.mediaControl.getControl(t)}},{key:"setPlaybackRate",value:function(t){this.playback.setPlaybackRate(t)}},{key:"isHlsPlayback",value:function(){return this.playback.isHlsPlayback()}},{key:"isMp4Playback",value:function(){return!this.isHlsPlayback()}},{key:"seekPercentage",value:function(t){var e=this.getDuration();if(t>=0&&t<=100){var n=e*(t/100);this.seek(n)}}},{key:"setPlayerFontSizeBase",value:function(){_e&&dt(this.el,{fontSize:(this.isFullscreen()?70:60)+"%"})}},{key:"toggleFullscreen",value:function(){var t=this.options,e=t.customIosFullscreen;t.lockRotateFullscreen&&(this.isLandscapeScreen()?le&&this.removeClass("is-portrait"):(le&&this.addClass("--z--orient-lock-fullscreen"),le&&this.addClass("is-portrait"),setTimeout((function(){screen&&screen.orientation.lock("landscape")}),300)),this.isFullscreen()&&(le&&this.removeClass("--z--orient-lock-fullscreen"),le&&this.removeClass("is-portrait"),setTimeout((function(){return screen&&screen.orientation.unlock()}),300))),e?this._toggleFullScreenIos():this._toggleFullScreenNative()}},{key:"isLandscapeScreen",value:function(){return window.innerWidth>window.innerHeight}},{key:"getPlayBack",value:function(){return function(t,e,n){var r=null,i=n.mimeType;K.object(e)?(r=e.source.toString(),e.mimeType&&(i=e.mimeType)):r=e.toString(),r.match(/^\/\//)&&(r=window.location.protocol+r);var o=X({},n,{src:r,mimeType:i}),a=t.filter((function(t){return t.canPlay(e,i)}))[0];return"no_op"===a.name&&n.fallbackSrc&&(a=t.filter((function(t){return t.canPlay(n.fallbackSrc,i)}))[0]),new a(o)}(this.loader.playbackPlugins,this.options.source,this.options)}},{key:"isLive",value:function(){return this.getPlaybackType()===ne.LIVE}},{key:"getCurrentTime",value:function(){return this.playback.el.currentTime}},{key:"getPlayerSize",value:function(){return{width:this.el.offsetWidth,height:this.el.offsetHeight}}},{key:"updateSize",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"px",r={};t&&(r.width=t+n),e&&(r.height=e+n),dt(this.el,r),this.trigger(L.PLAYER_UPDATE_SIZE,this.el.offsetWidth,this.el.offsetHeight,this.isFullscreen())}},{key:"onClicked",value:function(){_.debug(this.name,"onClicked"),this.trigger(L.PLAYER_CLICK,this,this.name)}},{key:"onDblClicked",value:function(){this.trigger(L.PLAYER_DBLCLICK,this,this.name)}},{key:"onKeydown",value:function(t){this.trigger(L.PLAYER_KEYDOWN,t,this.name)}},{key:"onMouseEnter",value:function(){this.trigger(L.PLAYER_MOUSE_ENTER)}},{key:"onMouseLeave",value:function(){this.trigger(L.PLAYER_MOUSE_LEAVE)}},{key:"onMouseMove",value:function(){this.trigger(L.PLAYER_MOUSE_MOVE)}},{key:"onContextMenu",value:function(t){this.trigger(L.PLAYER_CONTEXTMENU,t,this.name)}},{key:"onBuffering",value:function(){this.trigger(L.PLAYER_BUFFERING,this.name)}},{key:"onBufferingChange",value:function(t){this.trigger(L.PLAYER_BUFFERING_CHANGE,t)}},{key:"onBufferfull",value:function(){this.trigger(L.PLAYER_BUFFERFULL,this.name)}},{key:"onLoadedMetadata",value:function(t){this.trigger(L.PLAYER_LOADEDMETADATA,t)}},{key:"onTimeUpdated",value:function(t){this.currentTime=t.current,this.trigger(L.PLAYER_TIMEUPDATE,t,this.name)}},{key:"onSeeked",value:function(){this.trigger(L.PLAYER_SEEKED,this.name)}},{key:"onSeeking",value:function(t){this.currentTime=t.data.target.currentTime,this.trigger(L.PLAYER_SEEKING,t)}},{key:"onWaiting",value:function(t){this.trigger(L.PLAYER_WAITING,t)}},{key:"onPlay",value:function(){_.debug(this.name,"PLAYER_PLAY"),this.trigger(L.PLAYER_PLAY,this.name)}},{key:"onPaused",value:function(){_.debug(this.name,"PLAYER_PAUSE"),this.trigger(L.PLAYER_PAUSE,this.name)}},{key:"onError",value:function(t){_.error(this.name,"player error:",t),this.trigger(L.PLAYER_ERROR,t,this.name)}},{key:"onStopped",value:function(){this.trigger(L.PLAYER_STOP)}},{key:"onEnded",value:function(){this.trigger(L.PLAYER_ENDED,this.name),this.currentTime=0}},{key:"onVolumeUpdated",value:function(t){this.trigger(L.PLAYER_VOLUMEUPDATE,t)}},{key:"onLevelsAvailabel",value:function(t){this.trigger(L.PLAYER_LEVELS_AVAILABEL,t)}},{key:"onLevelSwitched",value:function(t){this.trigger(L.PLAYER_LEVEL_SWITCHED,t)}},{key:"onCanPlayThrough",value:function(t){this.trigger(L.PLAYER_CANPLAYTHROUGH,t)}},{key:"onProgress",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];this.trigger.apply(this,[L.PLAYER_PROGRESS].concat(e,[this.name]))}},{key:"onDrvChanged",value:function(){this.trigger(L.PLAYER_DVRSTATECHANGED)}},{key:"onWindowBlur",value:function(){_e&&this.options.pauseOnBlur&&this.pause()}},{key:"_addEventsFullScreen",value:function(){document.on("webkitfullscreenchange",this._onFullScreenChanged,!1),document.on("mozfullscreenchange",this._onFullScreenChanged,!1),document.on("fullscreenchange",this._onFullScreenChanged,!1),document.on("MSFullscreenChange",this._onFullScreenChanged,!1)}},{key:"_removeEventsFullScreen",value:function(){document.off("webkitfullscreenchange",this._onFullScreenChanged,!1),document.off("mozfullscreenchange",this._onFullScreenChanged,!1),document.off("fullscreenchange",this._onFullScreenChanged,!1),document.off("MSFullscreenChange",this._onFullScreenChanged,!1)}},{key:"_onFullScreenIosChanged",value:function(t){_.debug(this.name,"fullscreen status changed on iOS:",t),eo.isFullscreenIos=t,this._onFullScreenChanged()}},{key:"_onFullScreenChanged",value:function(){_.debug(this.name,"fullscreen status changed:",this.isFullscreen()),this.isFullscreen()?this.$el.addClass("--z--full-screen"):this.$el.removeClass("--z--full-screen"),this.setPlayerFontSizeBase(),this.trigger(L.PLAYER_FULLSCREEN,this.isFullscreen(),this.name)}},{key:"_onOrientationChanged",value:function(){var t=this,e=this.options,n=e.customIosFullscreen,r=e.lockRotateFullscreen;this.setPlayerFontSizeBase(),n&&this.isFullscreen()&&this.backdropEl&&dt(this.backdropEl,{height:window.innerHeight+"px"}),r&&this.isFullscreen()&&le&&setTimeout((function(){t.isLandscapeScreen()?(t.removeClass("--z--orient-lock-fullscreen"),t.removeClass("is-portrait")):(t.addClass("is-portrait"),t.addClass("--z--orient-lock-fullscreen"))}),300),this.trigger(L.PLAYER_ORIENTATION_CHANGE,this.isFullscreen())}},{key:"_initPlayback",value:function(){this.playback=this.getPlayBack(),_.debug(this.name,"foun
1d playback",this.getPlaybackName()),_.debug(this.name,"found playbacktype",this.getPlaybackType())}},{key:"_initConfig",value:function(){var t=this.options.mute?0:this.options.volume;this.setVolume(t)}},{key:"_initPlugins",value:function(){var t=this;K.empty(this.loader.plugins)||this.loader.plugins.forEach((function(e){t.plugins.push(new e(t))}))}},{key:"_extendsOptions",value:function(t){var e=Ju(t.sources,t.quality);e&&(t.source=e.source,t.currentSourceLevel=e.index)}},{key:"_onTouchMove",value:function(t){t.preventDefault(),t.stopPropagation()}},{key:"_toggleFullScreenIos",value:function(){this.backdropEl=this.backdropEl||Et("div",{},{class:"--z--player-backdrop"}),this.isFullscreen()?(this.removeClass("--z--custom-ios-fullscreen"),this.options.parentElement.append(this.el),this.backdropEl.innerHTML="",ct(this.backdropEl,"--z--show"),eo.isFullscreenIos=!1,this.scrollTopPos&&window.scrollTo(0,this.scrollTopPos)):(this.scrollTopPos=this.scrollTopPos||window.scrollY,window.scrollTo(0,0),this.addClass("--z--custom-ios-fullscreen"),dt(this.backdropEl,{height:window.innerHeight+"px"}),this.backdropEl.append(this.el),document.body.append(this.backdropEl),ct(this.backdropEl,"--z--show"),eo.isFullscreenIos=!0),this.setPlayerFontSizeBase(),this.trigger(L.PLAYER_FULLSCREEN,this.isFullscreen())}},{key:"_toggleFullScreenNative",value:function(){this.isFullscreen()?eo.cancelFullscreen():eo.requestFullscreen(this.el)}},{key:"toggleTheaterMode",value:function(){this.theaterMode=!this.theaterMode,this.toggleClass("--theater-mode",this.theaterMode),this.options.setStorageTheaterMode&&this.storage.set({theaterMode:this.theaterMode}),this.trigger(L.PLAYER_THEATER_MODE_CHANGE,this.theaterMode)}},{key:"mediaControlReady",value:function(){_.debug(this.name,"mediaControlReady"),this.trigger(L.PLAYER_MEDIACONTROL_READY,this.name)}},{key:"disableMediaControl",value:function(){this.trigger(L.PLAYER_MEDIACONTROL_DISABLE,this.name)}},{key:"enableMediaControl",value:function(){this.trigger(L.PLAYER_MEDIACONTROL_ENABLE,this.name)}},{key:"showMediaControl",value:function(){this.trigger(L.PLAYER_MEDIACONTROL_SHOW,this.name)}},{key:"hideMediaControl",value:function(){this.trigger(L.PLAYER_MEDIACONTROL_HIDE,this.name)}}])&&Il(e.prototype,n),r&&Il(e,r),o}(Nt);function Gl(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:400,n=arguments.length>2?arguments[2]:void 0;t.style.opacity||(t.style.opacity=1);var r=null;window.requestAnimationFrame((function i(o){var a=o-(r=r||o),s=parseFloat(1-a/e,2);t.style.opacity=s<0?0:s,a>e?K.function(n)&&n():window.requestAnimationFrame(i)}))}function Vl(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:400,n=arguments.length>2?arguments[2]:void 0;t.style.opacity||(t.style.opacity=0);var r=null;window.requestAnimationFrame((function i(o){var a=o-(r=r||o),s=parseFloat(a/e,2);t.style.opacity=s>1?1:s,a>e?K.function(n)&&n():window.requestAnimationFrame(i)}))}n.d(e,"AdRunner",(function(){return Yl})),n.d(e,"Constant",(function(){return Kl})),n.d(e,"PromiseUtils",(function(){return a})),n.d(e,"AdUtils",(function(){return c})),n.d(e,"AnimationUtils",(function(){return d})),n.d(e,"ArraysUtils",(function(){return s})),n.d(e,"BaseObject",(function(){return F})),n.d(e,"BasePlugin",(function(){return rt})),n.d(e,"BrowserUtils",(function(){return o})),n.d(e,"DomUtils",(function(){return i})),n.d(e,"Events",(function(){return L})),n.d(e,"HttpUtils",(function(){return f})),n.d(e,"IsUtils",(function(){return K})),n.d(e,"Log",(function(){return _})),n.d(e,"ObjectUtils",(function(){return r})),n.d(e,"Player",(function(){return Hl})),n.d(e,"Storage",(function(){return Qa})),n.d(e,"StringsUtils",(function(){return l})),n.d(e,"TimeUtils",(function(){return u})),n.d(e,"UIObject",(function(){return Nt})),n.d(e,"UIPlugin",(function(){return Yt})),n.d(e,"AdsPlugin",(function(){return hu}));var Yl=null;Yl=n(4);var Kl={MediaControlConst:{BG_TYPE_TRANSPARENT:"transparent",BG_TYPE_GRADIENT:"gradient",THEME:{RED:"red",BLUE:"blue",PURPLE:"purple",GREEN:"green",LIGHT_BLUE:"light_blue"},MAP_THEME_COLOR:{RED:"#f00",BLUE:"#2FA1B3",PURPLE:"#721799",GREEN:"#6cd936",LIGHT_BLUE:"#2196F3"}},SettingsMenuConst:To};_.setLevel(_.LEVEL_DISABLED)}])}));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.