@flowplayer/player 2.9.11 → 3.0.1-canary.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/core.js +2 -2
  2. package/default.js +2 -2
  3. package/embed.js +360 -3
  4. package/flowplayer.css +1 -1
  5. package/index.d.ts +80 -68
  6. package/package.json +4 -13
  7. package/plugins/ads.js +2 -2
  8. package/plugins/airplay.js +1 -1
  9. package/plugins/analytics.js +1 -1
  10. package/plugins/asel.js +1 -1
  11. package/plugins/audio.js +1 -1
  12. package/plugins/chapters.js +1 -0
  13. package/plugins/chromecast.js +2 -2
  14. package/plugins/context-menu.js +1 -1
  15. package/plugins/cuepoints.js +1 -1
  16. package/plugins/dash.js +2 -18
  17. package/plugins/drm.js +1 -1
  18. package/plugins/endscreen.js +1 -1
  19. package/plugins/fas.js +1 -1
  20. package/plugins/float-on-scroll.js +1 -1
  21. package/plugins/gemius.js +1 -1
  22. package/plugins/google-analytics.js +1 -1
  23. package/plugins/health.js +1 -1
  24. package/plugins/hls.js +357 -15
  25. package/plugins/id3.js +1 -1
  26. package/plugins/iframe.js +1 -1
  27. package/plugins/keyboard.js +1 -1
  28. package/plugins/media-session.js +1 -1
  29. package/plugins/message.js +1 -1
  30. package/plugins/ovp.js +15 -1
  31. package/plugins/playlist.js +1 -1
  32. package/plugins/preview.js +1 -0
  33. package/plugins/qsel.js +1 -1
  34. package/plugins/qul.js +1 -1
  35. package/plugins/share.js +1 -1
  36. package/plugins/speed.js +1 -1
  37. package/plugins/subtitles.js +1 -1
  38. package/plugins/thumbnails.js +1 -1
  39. package/contracts/google-analytics.json +0 -21
  40. package/core/events.d.ts +0 -12
  41. package/core/events.js +0 -9
  42. package/plugins/comscore.js +0 -1
  43. package/plugins/debug.js +0 -1
  44. package/plugins/flashls.js +0 -15
  45. package/plugins/i18n.js +0 -1
  46. package/plugins/mux.js +0 -1
  47. package/plugins/subtitles-html.js +0 -1
  48. package/util/loader.d.ts +0 -8
  49. package/util/loader.js +0 -43
package/plugins/dash.js CHANGED
@@ -1,18 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("stream"),require("string_decoder")):"function"==typeof define&&define.amd?define(["stream","string_decoder"],t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.dash=t(e.require$$0,e.require$$1))}(this,(function(e,t){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=n(e),i=n(t);function o(e){var t=document.createElement("a");t.href=e;var n=t.pathname&&t.pathname.split(".");return n.length>1&&n[n.length-1]}function l(e){switch(e){case"video/mpd":return"application/dash+xml";case"video/m3u8":return"application/x-mpegurl";default:return e}}const u=e=>{var{src:t}=e,n=
2
- /*! *****************************************************************************
3
- Copyright (c) Microsoft Corporation.
4
-
5
- Permission to use, copy, modify, and/or distribute this software for any
6
- purpose with or without fee is hereby granted.
7
-
8
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
- PERFORMANCE OF THIS SOFTWARE.
15
- ***************************************************************************** */
16
- function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["src"]);return[Object.assign({src:t,type:t?l("video/"+o(t)):""},n)]};function c(e){const[t,n]=e.split("{");return n?(r=t,n.slice(0,-1).split(",").map((function(e){return{src:r+e,type:l("video/"+e)}}))):u({src:e});var r}function d(e,t){try{var n=t.exec(e)[1];return parseFloat(n,10)}catch(e){return console.error(e),0}}var f="com.widevine.alpha",g="com.microsoft.playready",h="org.w3.clearkey";var p=/\.mpd$/,m=["application/dash+xml"];function E(e){var t=e.split("?").shift();return t&&p.test(t)}function _(e){return"object"==typeof e}function T(e){var t={exports:{}};return e(t,t.exports),t.exports}var y=T((function(e,t){!function(e){var t={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},n=function(e){var n=e;return t.hasOwnProperty(e)&&(n=t[e]),String.fromCharCode(n)},r={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},i={17:2,18:4,21:6,22:8,23:10,19:13,20:15},s={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},a={25:2,26:4,29:6,30:8,31:10,27:13,28:15},o=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],l={verboseFilter:{DATA:3,DEBUG:3,INFO:2,WARNING:2,TEXT:1,ERROR:0},time:null,verboseLevel:0,setTime:function(e){this.time=e},log:function(e,t){var n=this.verboseFilter[e];this.verboseLevel>=n&&console.log(this.time+" ["+e+"] "+t)}},u=function(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n].toString(16));return t},c=function(e,t,n,r,i){this.foreground=e||"white",this.underline=t||!1,this.italics=n||!1,this.background=r||"black",this.flash=i||!1};c.prototype={reset:function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},setStyles:function(e){for(var t=["foreground","underline","italics","background","flash"],n=0;n<t.length;n++){var r=t[n];e.hasOwnProperty(r)&&(this[r]=e[r])}},isDefault:function(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash},equals:function(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash},copy:function(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash},toString:function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}};var d=function(e,t,n,r,i,s){this.uchar=e||" ",this.penState=new c(t,n,r,i,s)};d.prototype={reset:function(){this.uchar=" ",this.penState.reset()},setChar:function(e,t){this.uchar=e,this.penState.copy(t)},setPenState:function(e){this.penState.copy(e)},equals:function(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)},copy:function(e){this.uchar=e.uchar,this.penState.copy(e.penState)},isEmpty:function(){return" "===this.uchar&&this.penState.isDefault()}};var f=function(){this.chars=[];for(var e=0;e<32;e++)this.chars.push(new d);this.pos=0,this.currPenState=new c};f.prototype={equals:function(e){for(var t=!0,n=0;n<32;n++)if(!this.chars[n].equals(e.chars[n])){t=!1;break}return t},copy:function(e){for(var t=0;t<32;t++)this.chars[t].copy(e.chars[t])},isEmpty:function(){for(var e=!0,t=0;t<32;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e},setCursor:function(e){this.pos!==e&&(this.pos=e),this.pos<0?(l.log("ERROR","Negative cursor position "+this.pos),this.pos=0):this.pos>32&&(l.log("ERROR","Too large cursor position "+this.pos),this.pos=32)},moveCursor:function(e){var t=this.pos+e;if(e>1)for(var n=this.pos+1;n<t+1;n++)this.chars[n].setPenState(this.currPenState);this.setCursor(t)},backSpace:function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},insertChar:function(e){e>=144&&this.backSpace();var t=n(e);this.pos>=32?l.log("ERROR","Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))},clearFromPos:function(e){var t;for(t=e;t<32;t++)this.chars[t].reset()},clear:function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},clearToEndOfRow:function(){this.clearFromPos(this.pos)},getTextString:function(){for(var e=[],t=!0,n=0;n<32;n++){var r=this.chars[n].uchar;" "!==r&&(t=!1),e.push(r)}return t?"":e.join("")},setPenStyles:function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}};var g=function(){this.rows=[];for(var e=0;e<15;e++)this.rows.push(new f);this.currRow=14,this.nrRollUpRows=null,this.reset()};g.prototype={reset:function(){for(var e=0;e<15;e++)this.rows[e].clear();this.currRow=14},equals:function(e){for(var t=!0,n=0;n<15;n++)if(!this.rows[n].equals(e.rows[n])){t=!1;break}return t},copy:function(e){for(var t=0;t<15;t++)this.rows[t].copy(e.rows[t])},isEmpty:function(){for(var e=!0,t=0;t<15;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e},backSpace:function(){this.rows[this.currRow].backSpace()},clearToEndOfRow:function(){this.rows[this.currRow].clearToEndOfRow()},insertChar:function(e){this.rows[this.currRow].insertChar(e)},setPen:function(e){this.rows[this.currRow].setPenStyles(e)},moveCursor:function(e){this.rows[this.currRow].moveCursor(e)},setCursor:function(e){l.log("INFO","setCursor: "+e),this.rows[this.currRow].setCursor(e)},setPAC:function(e){l.log("INFO","pacData = "+JSON.stringify(e));var t=e.row-1;this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.currRow=t;var n=this.rows[this.currRow];if(null!==e.indent){var r=e.indent,i=Math.max(r-1,0);n.setCursor(e.indent),e.color=n.chars[i].penState.foreground}var s={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(s)},setBkgData:function(e){l.log("INFO","bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)},setRollUpRows:function(e){this.nrRollUpRows=e},rollUp:function(){if(null!==this.nrRollUpRows){l.log("TEXT",this.getDisplayText());var e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),l.log("INFO","Rolling up")}else l.log("DEBUG","roll_up but nrRollUpRows not set yet")},getDisplayText:function(e){e=e||!1;for(var t=[],n="",r=-1,i=0;i<15;i++){var s=this.rows[i].getTextString();s&&(r=i+1,e?t.push("Row "+r+': "'+s+'"'):t.push(s.trim()))}return t.length>0&&(n=e?"["+t.join(" | ")+"]":t.join("\n")),n},getTextAndFormat:function(){return this.rows}};var h=function(e,t){this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new g,this.nonDisplayedMemory=new g,this.lastOutputScreen=new g,this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null};h.prototype={modes:["MODE_ROLL-UP","MODE_POP-ON","MODE_PAINT-ON","MODE_TEXT"],reset:function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.lastCueEndTime=null},getHandler:function(){return this.outputFilter},setHandler:function(e){this.outputFilter=e},setPAC:function(e){this.writeScreen.setPAC(e)},setBkgData:function(e){this.writeScreen.setBkgData(e)},setMode:function(e){e!==this.mode&&(this.mode=e,l.log("INFO","MODE="+e),"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=e)},insertChars:function(e){for(var t=0;t<e.length;t++)this.writeScreen.insertChar(e[t]);var n=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";l.log("INFO",n+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(l.log("TEXT","DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},cc_RCL:function(){l.log("INFO","RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},cc_BS:function(){l.log("INFO","BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},cc_AOF:function(){},cc_AON:function(){},cc_DER:function(){l.log("INFO","DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},cc_RU:function(e){l.log("INFO","RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)},cc_FON:function(){l.log("INFO","FON - Flash On"),this.writeScreen.setPen({flash:!0})},cc_RDC:function(){l.log("INFO","RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},cc_TR:function(){l.log("INFO","TR"),this.setMode("MODE_TEXT")},cc_RTD:function(){l.log("INFO","RTD"),this.setMode("MODE_TEXT")},cc_EDM:function(){l.log("INFO","EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate()},cc_CR:function(){l.log("CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate()},cc_ENM:function(){l.log("INFO","ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},cc_EOC:function(){if(l.log("INFO","EOC - End Of Caption"),"MODE_POP-ON"===this.mode){var e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,l.log("TEXT","DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate()},cc_TO:function(e){l.log("INFO","TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)},cc_MIDROW:function(e){var t={flash:!1};if(t.underline=e%2==1,t.italics=e>=46,t.italics)t.foreground="white";else{var n=Math.floor(e/2)-16;t.foreground=["white","green","blue","cyan","red","yellow","magenta"][n]}l.log("INFO","MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)},outputDataUpdate:function(){var e=l.time;null!==e&&this.outputFilter&&(this.outputFilter.updateData&&this.outputFilter.updateData(e,this.displayedMemory),null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.lastOutputScreen),this.cueStartTime=this.displayedMemory.isEmpty()?null:e):this.cueStartTime=e,this.lastOutputScreen.copy(this.displayedMemory))},cueSplitAtTime:function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}};var p=function(e,t,n){this.field=e||1,this.outputs=[t,n],this.channels=[new h(1,t),new h(2,n)],this.currChNr=-1,this.lastCmdA=null,this.lastCmdB=null,this.bufferedData=[],this.startTime=null,this.lastTime=null,this.dataCounters={padding:0,char:0,cmd:0,other:0}};p.prototype={getHandler:function(e){return this.channels[e].getHandler()},setHandler:function(e,t){this.channels[e].setHandler(t)},addData:function(e,t){var n,r,i,s=!1;this.lastTime=e,l.setTime(e);for(var a=0;a<t.length;a+=2)if(r=127&t[a],i=127&t[a+1],r>=16&&r<=31&&r===this.lastCmdA&&i===this.lastCmdB)this.lastCmdA=null,this.lastCmdB=null,l.log("DEBUG","Repeated command ("+u([r,i])+") is dropped");else if(0!==r||0!==i){if(l.log("DATA","["+u([t[a],t[a+1]])+"] -> ("+u([r,i])+")"),(n=this.parseCmd(r,i))||(n=this.parseMidrow(r,i)),n||(n=this.parsePAC(r,i)),n||(n=this.parseBackgroundAttributes(r,i)),!n)if(s=this.parseChars(r,i))if(this.currChNr&&this.currChNr>=0)this.channels[this.currChNr-1].insertChars(s);else l.log("WARNING","No channel found yet. TEXT-MODE?");n?this.dataCounters.cmd+=2:s?this.dataCounters.char+=2:(this.dataCounters.other+=2,l.log("WARNING","Couldn't parse cleaned data "+u([r,i])+" orig: "+u([t[a],t[a+1]])))}else this.dataCounters.padding+=2},parseCmd:function(e,t){var n=null;if(!((20===e||21===e||28===e||29===e)&&32<=t&&t<=47)&&!((23===e||31===e)&&33<=t&&t<=35))return!1;n=20===e||21===e||23===e?1:2;var r=this.channels[n-1];return 20===e||21===e||28===e||29===e?32===t?r.cc_RCL():33===t?r.cc_BS():34===t?r.cc_AOF():35===t?r.cc_AON():36===t?r.cc_DER():37===t?r.cc_RU(2):38===t?r.cc_RU(3):39===t?r.cc_RU(4):40===t?r.cc_FON():41===t?r.cc_RDC():42===t?r.cc_TR():43===t?r.cc_RTD():44===t?r.cc_EDM():45===t?r.cc_CR():46===t?r.cc_ENM():47===t&&r.cc_EOC():r.cc_TO(t-32),this.lastCmdA=e,this.lastCmdB=t,this.currChNr=n,!0},parseMidrow:function(e,t){var n=null;if((17===e||25===e)&&32<=t&&t<=47){if((n=17===e?1:2)!==this.currChNr)return l.log("ERROR","Mismatch channel in midrow parsing"),!1;var r=this.channels[n-1];return r.insertChars([32]),r.cc_MIDROW(t),l.log("DEBUG","MIDROW ("+u([e,t])+")"),this.lastCmdA=e,this.lastCmdB=t,!0}return!1},parsePAC:function(e,t){var n,o=null;if(!((17<=e&&e<=23||25<=e&&e<=31)&&64<=t&&t<=127)&&!((16===e||24===e)&&64<=t&&t<=95))return!1;n=e<=23?1:2,o=64<=t&&t<=95?1===n?r[e]:s[e]:1===n?i[e]:a[e];var l=this.interpretPAC(o,t);return this.channels[n-1].setPAC(l),this.lastCmdA=e,this.lastCmdB=t,this.currChNr=n,!0},interpretPAC:function(e,t){var n=t,r={color:null,italics:!1,indent:null,underline:!1,row:e};return n=t>95?t-96:t-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},parseChars:function(e,t){var r=null,i=null,s=null;if(e>=25?(r=2,s=e-8):(r=1,s=e),17<=s&&s<=19){var a=t;a=17===s?t+80:18===s?t+112:t+144,l.log("INFO","Special char '"+n(a)+"' in channel "+r),i=[a],this.lastCmdA=e,this.lastCmdB=t}else 32<=e&&e<=127&&(i=0===t?[e]:[e,t],this.lastCmdA=null,this.lastCmdB=null);if(i){var o=u(i);l.log("DEBUG","Char codes = "+o.join(","))}return i},parseBackgroundAttributes:function(e,t){var n,r,i;return((16===e||24===e)&&32<=t&&t<=47||(23===e||31===e)&&45<=t&&t<=47)&&(n={},16===e||24===e?(r=Math.floor((t-32)/2),n.background=o[r],t%2==1&&(n.background=n.background+"_semi")):45===t?n.background="transparent":(n.foreground="black",47===t&&(n.underline=!0)),i=e<24?1:2,this.channels[i-1].setBkgData(n),this.lastCmdA=e,this.lastCmdB=t,!0)},reset:function(){for(var e=0;e<this.channels.length;e++)this.channels[e]&&this.channels[e].reset();this.lastCmdA=null,this.lastCmdB=null},cueSplitAtTime:function(e){for(var t=0;t<this.channels.length;t++)this.channels[t]&&this.channels[t].cueSplitAtTime(e)}};e.logger=l,e.PenState=c,e.CaptionScreen=g,e.Cea608Parser=p,e.findCea608Nalus=function(e,t,n){for(var r=0,i=t,s=[],a=function(e,t,n,r){if(4!==e||t<8)return null;var i=n.getUint8(r),s=n.getUint16(r+1),a=n.getUint32(r+3),o=n.getUint8(r+7);return 181==i&&49==s&&1195456820==a&&3==o};i<t+n;){if(r=e.getUint32(i),6===(31&e.getUint8(i+4)))for(var o=i+5,l=-1;o<i+4+r-1;){l=0;for(var u=255;255===u;)l+=u=e.getUint8(o),o++;var c=0;for(u=255;255===u;)c+=u=e.getUint8(o),o++;a(l,c,e,o)&&s.push([o,c]),o+=c}i+=r+4}return s},e.extractCea608DataFromRange=function(e,t){var n=t[0],r=[[],[]];n+=8;var i=31&e.getUint8(n);n+=2;for(var s=0;s<i;s++){var a=e.getUint8(n),o=4&a,l=3&a;n++;var u=e.getUint8(n);n++;var c=e.getUint8(n);n++,o&&(127&u)+(127&c)!=0&&(0===l?(r[0].push(u),r[0].push(c)):1===l&&(r[1].push(u),r[1].push(c)))}return r}}(t)}));const A=new class{init(){this.STREAM="stream",this.VIDEO="video",this.AUDIO="audio",this.TEXT="text",this.FRAGMENTED_TEXT="fragmentedText",this.EMBEDDED_TEXT="embeddedText",this.MUXED="muxed",this.IMAGE="image",this.STPP="stpp",this.TTML="ttml",this.VTT="vtt",this.WVTT="wvtt",this.ABR_STRATEGY_DYNAMIC="abrDynamic",this.ABR_STRATEGY_BOLA="abrBola",this.ABR_STRATEGY_L2A="abrL2A",this.ABR_STRATEGY_LoLP="abrLoLP",this.ABR_STRATEGY_THROUGHPUT="abrThroughput",this.ABR_FETCH_THROUGHPUT_CALCULATION_DOWNLOADED_DATA="abrFetchThroughputCalculationDownloadedData",this.ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING="abrFetchThroughputCalculationMoofParsing",this.LIVE_CATCHUP_MODE_DEFAULT="liveCatchupModeDefault",this.LIVE_CATCHUP_MODE_LOLP="liveCatchupModeLoLP",this.MOVING_AVERAGE_SLIDING_WINDOW="slidingWindow",this.MOVING_AVERAGE_EWMA="ewma",this.BAD_ARGUMENT_ERROR="Invalid Arguments",this.MISSING_CONFIG_ERROR="Missing config parameter(s)",this.TRACK_SWITCH_MODE_ALWAYS_REPLACE="alwaysReplace",this.TRACK_SWITCH_MODE_NEVER_REPLACE="neverReplace",this.TRACK_SELECTION_MODE_HIGHEST_BITRATE="highestBitrate",this.TRACK_SELECTION_MODE_HIGHEST_EFFICIENCY="highestEfficiency",this.TRACK_SELECTION_MODE_WIDEST_RANGE="widestRange",this.LOCATION="Location",this.INITIALIZE="initialize",this.TEXT_SHOWING="showing",this.TEXT_HIDDEN="hidden",this.CC1="CC1",this.CC3="CC3",this.UTF8="utf-8",this.SCHEME_ID_URI="schemeIdUri",this.START_TIME="starttime",this.SERVICE_DESCRIPTION_LL_SCHEME="urn:dvb:dash:lowlatency:scope:2019",this.SUPPLEMENTAL_PROPERTY_LL_SCHEME="urn:dvb:dash:lowlatency:critical:2019",this.XML="XML",this.ARRAY_BUFFER="ArrayBuffer",this.DVB_REPORTING_URL="dvb:reportingUrl",this.DVB_PROBABILITY="dvb:probability"}constructor(){this.init()}};let S=new class{init(){this.BASE_URL="BaseURL",this.SEGMENT_BASE="SegmentBase",this.SEGMENT_TEMPLATE="SegmentTemplate",this.SEGMENT_LIST="SegmentList",this.SEGMENT_URL="SegmentURL",this.SEGMENT_TIMELINE="SegmentTimeline",this.SEGMENT_PROFILES="segmentProfiles",this.ADAPTATION_SET="AdaptationSet",this.REPRESENTATION="Representation",this.REPRESENTATION_INDEX="RepresentationIndex",this.SUB_REPRESENTATION="SubRepresentation",this.INITIALIZATION="Initialization",this.INITIALIZATION_MINUS="initialization",this.MPD="MPD",this.PERIOD="Period",this.ASSET_IDENTIFIER="AssetIdentifier",this.EVENT_STREAM="EventStream",this.ID="id",this.PROFILES="profiles",this.SERVICE_LOCATION="serviceLocation",this.RANGE="range",this.INDEX="index",this.MEDIA="media",this.BYTE_RANGE="byteRange",this.INDEX_RANGE="indexRange",this.MEDIA_RANGE="mediaRange",this.VALUE="value",this.CONTENT_TYPE="contentType",this.MIME_TYPE="mimeType",this.BITSTREAM_SWITCHING="BitstreamSwitching",this.BITSTREAM_SWITCHING_MINUS="bitstreamSwitching",this.CODECS="codecs",this.DEPENDENCY_ID="dependencyId",this.MEDIA_STREAM_STRUCTURE_ID="mediaStreamStructureId",this.METRICS="Metrics",this.METRICS_MINUS="metrics",this.REPORTING="Reporting",this.WIDTH="width",this.HEIGHT="height",this.SAR="sar",this.FRAMERATE="frameRate",this.AUDIO_SAMPLING_RATE="audioSamplingRate",this.MAXIMUM_SAP_PERIOD="maximumSAPPeriod",this.START_WITH_SAP="startWithSAP",this.MAX_PLAYOUT_RATE="maxPlayoutRate",this.CODING_DEPENDENCY="codingDependency",this.SCAN_TYPE="scanType",this.FRAME_PACKING="FramePacking",this.AUDIO_CHANNEL_CONFIGURATION="AudioChannelConfiguration",this.CONTENT_PROTECTION="ContentProtection",this.ESSENTIAL_PROPERTY="EssentialProperty",this.SUPPLEMENTAL_PROPERTY="SupplementalProperty",this.INBAND_EVENT_STREAM="InbandEventStream",this.ACCESSIBILITY="Accessibility",this.ROLE="Role",this.RATING="Rating",this.CONTENT_COMPONENT="ContentComponent",this.SUBSET="Subset",this.LANG="lang",this.VIEWPOINT="Viewpoint",this.ROLE_ASARRAY="Role_asArray",this.ACCESSIBILITY_ASARRAY="Accessibility_asArray",this.AUDIOCHANNELCONFIGURATION_ASARRAY="AudioChannelConfiguration_asArray",this.CONTENTPROTECTION_ASARRAY="ContentProtection_asArray",this.MAIN="main",this.DYNAMIC="dynamic",this.STATIC="static",this.MEDIA_PRESENTATION_DURATION="mediaPresentationDuration",this.MINIMUM_UPDATE_PERIOD="minimumUpdatePeriod",this.CODEC_PRIVATE_DATA="codecPrivateData",this.BANDWITH="bandwidth",this.SOURCE_URL="sourceURL",this.TIMESCALE="timescale",this.DURATION="duration",this.START_NUMBER="startNumber",this.PRESENTATION_TIME_OFFSET="presentationTimeOffset",this.AVAILABILITY_START_TIME="availabilityStartTime",this.AVAILABILITY_END_TIME="availabilityEndTime",this.TIMESHIFT_BUFFER_DEPTH="timeShiftBufferDepth",this.MAX_SEGMENT_DURATION="maxSegmentDuration",this.PRESENTATION_TIME="presentationTime",this.MIN_BUFFER_TIME="minBufferTime",this.MAX_SUBSEGMENT_DURATION="maxSubsegmentDuration",this.START="start",this.AVAILABILITY_TIME_OFFSET="availabilityTimeOffset",this.AVAILABILITY_TIME_COMPLETE="availabilityTimeComplete",this.CENC_DEFAULT_KID="cenc:default_KID",this.DVB_PRIORITY="dvb:priority",this.DVB_WEIGHT="dvb:weight",this.SUGGESTED_PRESENTATION_DELAY="suggestedPresentationDelay",this.SERVICE_DESCRIPTION="ServiceDescription",this.SERVICE_DESCRIPTION_SCOPE="Scope",this.SERVICE_DESCRIPTION_LATENCY="Latency",this.SERVICE_DESCRIPTION_PLAYBACK_RATE="PlaybackRate",this.PATCH_LOCATION="PatchLocation",this.PUBLISH_TIME="publishTime",this.ORIGINAL_PUBLISH_TIME="originalPublishTime",this.ORIGINAL_MPD_ID="mpdId"}constructor(){this.init()}};let I=new class{init(){this.TCP_CONNECTION="TcpList",this.HTTP_REQUEST="HttpList",this.TRACK_SWITCH="RepSwitchList",this.BUFFER_LEVEL="BufferLevel",this.BUFFER_LOADED="bufferLoaded",this.ABANDON_LOAD="abandonload",this.ALLOW_LOAD="allowload",this.BUFFER_EMPTY="bufferStalled",this.BUFFER_STATE="BufferState",this.DVR_INFO="DVRInfo",this.DROPPED_FRAMES="DroppedFrames",this.SCHEDULING_INFO="SchedulingInfo",this.REQUESTS_QUEUE="RequestsQueue",this.MANIFEST_UPDATE="ManifestUpdate",this.MANIFEST_UPDATE_STREAM_INFO="ManifestUpdatePeriodInfo",this.MANIFEST_UPDATE_TRACK_INFO="ManifestUpdateRepresentationInfo",this.PLAY_LIST="PlayList",this.DVB_ERRORS="DVBErrors"}constructor(){this.init()}};const R=function(){let e,t=[];const n={},r={};function i(e,n){for(const r in t){const i=t[r];if(i.context===e&&i.name===n)return i.instance}return null}function s(e,t){return t[e]}function a(e,t,n){e in n&&(n[e]=t)}function o(t,n,r){let i;const s=t.__dashjs_factory_name,a=n[s];if(a){let s=a.instance;if(!a.override)return s.apply({context:n,factory:e},r);i=t.apply({context:n},r),s=s.apply({context:n,factory:e,parent:i},r);for(const e in s)i.hasOwnProperty(e)&&(i[e]=s[e])}else i=t.apply({context:n},r);return i.getClassName=function(){return s},i}return e={extend:function(e,t,n,r){!r[e]&&t&&(r[e]={instance:t,override:n})},getSingletonInstance:i,setSingletonInstance:function(e,n,r){for(const i in t){const s=t[i];if(s.context===e&&s.name===n)return void(t[i].instance=r)}t.push({name:n,context:e,instance:r})},deleteSingletonInstances:function(e){t=t.filter(t=>t.context!==e)},getSingletonFactory:function(e){let r=s(e.__dashjs_factory_name,n);return r||(r=function(n){let r;return void 0===n&&(n={}),{getInstance:function(){return r||(r=i(n,e.__dashjs_factory_name)),r||(r=o(e,n,arguments),t.push({name:e.__dashjs_factory_name,context:n,instance:r})),r}}},n[e.__dashjs_factory_name]=r),r},getSingletonFactoryByName:function(e){return s(e,n)},updateSingletonFactory:function(e,t){a(e,t,n)},getClassFactory:function(e){let t=s(e.__dashjs_factory_name,r);return t||(t=function(t){return void 0===t&&(t={}),{create:function(){return o(e,t,arguments)}}},r[e.__dashjs_factory_name]=t),t},getClassFactoryByName:function(e){return s(e,r)},updateClassFactory:function(e,t){a(e,t,r)}},e}();class N{extend(e,t){if(!e)return;let n=!!t&&t.override,r=!!t&&t.publicOnly;for(const t in e)!e.hasOwnProperty(t)||this[t]&&!n||r&&-1===e[t].indexOf("public_")||(this[t]=e[t])}}let D=new class extends N{constructor(){super(),this.AST_IN_FUTURE="astInFuture",this.BUFFER_EMPTY="bufferStalled",this.BUFFER_LOADED="bufferLoaded",this.BUFFER_LEVEL_STATE_CHANGED="bufferStateChanged",this.DYNAMIC_TO_STATIC="dynamicToStatic",this.ERROR="error",this.FRAGMENT_LOADING_COMPLETED="fragmentLoadingCompleted",this.FRAGMENT_LOADING_PROGRESS="fragmentLoadingProgress",this.FRAGMENT_LOADING_STARTED="fragmentLoadingStarted",this.FRAGMENT_LOADING_ABANDONED="fragmentLoadingAbandoned",this.LOG="log",this.MANIFEST_LOADED="manifestLoaded",this.METRICS_CHANGED="metricsChanged",this.METRIC_CHANGED="metricChanged",this.METRIC_ADDED="metricAdded",this.METRIC_UPDATED="metricUpdated",this.PERIOD_SWITCH_COMPLETED="periodSwitchCompleted",this.PERIOD_SWITCH_STARTED="periodSwitchStarted",this.QUALITY_CHANGE_REQUESTED="qualityChangeRequested",this.QUALITY_CHANGE_RENDERED="qualityChangeRendered",this.TRACK_CHANGE_RENDERED="trackChangeRendered",this.SOURCE_INITIALIZED="sourceInitialized",this.STREAM_INITIALIZING="streamInitializing",this.STREAM_UPDATED="streamUpdated",this.STREAM_INITIALIZED="streamInitialized",this.STREAM_TEARDOWN_COMPLETE="streamTeardownComplete",this.TEXT_TRACKS_ADDED="allTextTracksAdded",this.TEXT_TRACK_ADDED="textTrackAdded",this.TTML_PARSED="ttmlParsed",this.TTML_TO_PARSE="ttmlToParse",this.CAPTION_RENDERED="captionRendered",this.CAPTION_CONTAINER_RESIZE="captionContainerResize",this.CAN_PLAY="canPlay",this.PLAYBACK_ENDED="playbackEnded",this.PLAYBACK_ERROR="playbackError",this.PLAYBACK_NOT_ALLOWED="playbackNotAllowed",this.PLAYBACK_METADATA_LOADED="playbackMetaDataLoaded",this.PLAYBACK_PAUSED="playbackPaused",this.PLAYBACK_PLAYING="playbackPlaying",this.PLAYBACK_PROGRESS="playbackProgress",this.PLAYBACK_RATE_CHANGED="playbackRateChanged",this.PLAYBACK_SEEKED="playbackSeeked",this.PLAYBACK_SEEKING="playbackSeeking",this.PLAYBACK_SEEK_ASKED="playbackSeekAsked",this.PLAYBACK_STALLED="playbackStalled",this.PLAYBACK_STARTED="playbackStarted",this.PLAYBACK_TIME_UPDATED="playbackTimeUpdated",this.PLAYBACK_WAITING="playbackWaiting",this.MANIFEST_VALIDITY_CHANGED="manifestValidityChanged",this.GAP_CAUSED_SEEK_TO_PERIOD_END="gapCausedSeekToPeriodEnd",this.GAP_CAUSED_INTERNAL_SEEK="gapCausedInternalSeek",this.EVENT_MODE_ON_START="eventModeOnStart",this.EVENT_MODE_ON_RECEIVE="eventModeOnReceive",this.CONFORMANCE_VIOLATION="conformanceViolation"}};function C(){let e={};function t(t,n,r){let i=-1;return e[t]?(e[t].some((e,t)=>{if(e&&e.callback===n&&(!r||r===e.scope))return i=t,!0}),i):i}return{on:function(n,r,i,s={}){if(!n)throw new Error("event type cannot be null or undefined");if(!r||"function"!=typeof r)throw new Error("listener must be a function: "+r);let a=s.priority||0;if(t(n,r,i)>=0)return;e[n]=e[n]||[];const o={callback:r,scope:i,priority:a};i&&i.getStreamId&&(o.streamId=i.getStreamId()),i&&i.getType&&(o.mediaType=i.getType()),s&&s.mode&&(o.mode=s.mode),e[n].some((t,r)=>{if(t&&a>t.priority)return e[n].splice(r,0,o),!0})||e[n].push(o)},off:function(n,r,i){if(!n||!r||!e[n])return;const s=t(n,r,i);s<0||(e[n][s]=null)},trigger:function(t,n={},r={}){if(t&&e[t]){if((n=n||{}).hasOwnProperty("type"))throw new Error("'type' is a reserved word for event dispatching");n.type=t,r.streamId&&(n.streamId=r.streamId),r.mediaType&&(n.mediaType=r.mediaType),e[t].filter(e=>!!e&&((!r.streamId||!e.streamId||e.streamId===r.streamId)&&((!r.mediaType||!e.mediaType||e.mediaType===r.mediaType)&&!(r.mode&&e.mode&&e.mode!==r.mode||!e.mode&&r.mode&&r.mode===D.EVENT_MODE_ON_RECEIVE)))).forEach(e=>e&&e.callback.call(e.scope,n))}},reset:function(){e={}}}}C.__dashjs_factory_name="EventBus";const b=R.getSingletonFactory(C);b.EVENT_PRIORITY_LOW=0,b.EVENT_PRIORITY_HIGH=5e3,R.updateSingletonFactory(C.__dashjs_factory_name,b);class v extends N{constructor(){super(),this.ATTEMPT_BACKGROUND_SYNC="attemptBackgroundSync",this.BUFFERING_COMPLETED="bufferingCompleted",this.BUFFER_CLEARED="bufferCleared",this.BUFFER_LEVEL_UPDATED="bufferLevelUpdated",this.BYTES_APPENDED="bytesAppended",this.BYTES_APPENDED_END_FRAGMENT="bytesAppendedEndFragment",this.CHECK_FOR_EXISTENCE_COMPLETED="checkForExistenceCompleted",this.CURRENT_TRACK_CHANGED="currentTrackChanged",this.DATA_UPDATE_COMPLETED="dataUpdateCompleted",this.DATA_UPDATE_STARTED="dataUpdateStarted",this.INBAND_EVENTS="inbandEvents",this.INITIALIZATION_LOADED="initializationLoaded",this.INIT_FRAGMENT_LOADED="initFragmentLoaded",this.INIT_FRAGMENT_NEEDED="initFragmentNeeded",this.INTERNAL_MANIFEST_LOADED="internalManifestLoaded",this.ORIGINAL_MANIFEST_LOADED="originalManifestLoaded",this.LIVE_EDGE_SEARCH_COMPLETED="liveEdgeSearchCompleted",this.LOADING_COMPLETED="loadingCompleted",this.LOADING_PROGRESS="loadingProgress",this.LOADING_DATA_PROGRESS="loadingDataProgress",this.LOADING_ABANDONED="loadingAborted",this.MANIFEST_UPDATED="manifestUpdated",this.MEDIA_FRAGMENT_LOADED="mediaFragmentLoaded",this.MEDIA_FRAGMENT_NEEDED="mediaFragmentNeeded",this.QUOTA_EXCEEDED="quotaExceeded",this.REPRESENTATION_UPDATE_STARTED="representationUpdateStarted",this.REPRESENTATION_UPDATE_COMPLETED="representationUpdateCompleted",this.SEGMENTS_LOADED="segmentsLoaded",this.SERVICE_LOCATION_BLACKLIST_ADD="serviceLocationBlacklistAdd",this.SERVICE_LOCATION_BLACKLIST_CHANGED="serviceLocationBlacklistChanged",this.SOURCEBUFFER_REMOVE_COMPLETED="sourceBufferRemoveCompleted",this.STREAMS_COMPOSED="streamsComposed",this.STREAM_BUFFERING_COMPLETED="streamBufferingCompleted",this.STREAM_COMPLETED="streamCompleted",this.TEXT_TRACKS_QUEUE_INITIALIZED="textTracksQueueInitialized",this.TIME_SYNCHRONIZATION_COMPLETED="timeSynchronizationComplete",this.UPDATE_TIME_SYNC_OFFSET="updateTimeSyncOffset",this.URL_RESOLUTION_FAILED="urlResolutionFailed",this.VIDEO_CHUNK_RECEIVED="videoChunkReceived",this.WALLCLOCK_TIME_UPDATED="wallclockTimeUpdated",this.XLINK_ELEMENT_LOADED="xlinkElementLoaded",this.XLINK_READY="xlinkReady",this.SEGMENTBASE_INIT_REQUEST_NEEDED="segmentBaseInitRequestNeeded",this.SEGMENTBASE_SEGMENTSLIST_REQUEST_NEEDED="segmentBaseSegmentsListRequestNeeded",this.SEEK_TARGET="seekTarget"}}let M=new class extends v{};function O(e){e=e||{};const t=this.context,n=b(t).getInstance(),r=e.settings,i=[];let s,a,o,l;function u(e){return e&&e.bind?e.bind(window.console):window.console.log.bind(window.console)}function c(...e){p(1,this,...e)}function d(...e){p(2,this,...e)}function f(...e){p(3,this,...e)}function g(...e){p(4,this,...e)}function h(...e){p(5,this,...e)}function p(e,t,...s){let u="",c=null;a&&(c=(new Date).getTime(),u+="["+(c-l)+"]"),o&&t&&t.getClassName&&(u+="["+t.getClassName()+"]",t.getType&&(u+="["+t.getType()+"]")),u.length>0&&(u+=" "),Array.apply(null,s).forEach((function(e){u+=e+" "})),i[e]&&r.get().debug.logLevel>=e&&i[e](u),r&&r.get().debug.dispatchEvent&&n.trigger(M.LOG,{message:u,level:e})}return s={getLogger:function(e){return{fatal:c.bind(e),error:d.bind(e),warn:f.bind(e),info:g.bind(e),debug:h.bind(e)}},setLogTimestampVisible:function(e){a=e},setCalleeNameVisible:function(e){o=e}},a=!0,o=!0,l=(new Date).getTime(),"undefined"!=typeof window&&window.console&&(i[1]=u(window.console.error),i[2]=u(window.console.error),i[3]=u(window.console.warn),i[4]=u(window.console.info),i[5]=u(window.console.debug)),s}O.__dashjs_factory_name="Debug";const w=R.getSingletonFactory(O);w.LOG_LEVEL_NONE=0,w.LOG_LEVEL_FATAL=1,w.LOG_LEVEL_ERROR=2,w.LOG_LEVEL_WARNING=3,w.LOG_LEVEL_INFO=4,w.LOG_LEVEL_DEBUG=5,R.updateSingletonFactory(O.__dashjs_factory_name,w);function L(){const e=this.context,t=b(e).getInstance();let n,r,i,s,a,o,l,u,c,d,f,g,h,p,m,E,_,T,y,S,R,N,D;function C(e){if(u&&isNaN(c))return;let n=c;if(isNaN(n))if(h){n=e.liveStartTime;const t=s.getCurrentDVRInfo(),i=t?t.range:null;if(i){const e=V(!0);isNaN(e)||(r.info("Start time from URI parameters: "+e),n=Math.max(Math.min(n,e),i.start))}}else{n=g.start;const e=V(!1);!isNaN(e)&&e<n+g.duration&&(r.info("Start time from URI parameters: "+e),n=Math.max(n,e))}isNaN(n)||n===o.getTime()||(t.trigger(M.PLAYBACK_SEEKING,{seekTime:n}),U(n,!1,!0))}function v(){return parseFloat((O()-B()).toFixed(5))}function O(){return g.start+g.duration}function L(){g&&o&&o.getElement()?o.play():m=!0}function P(){return g&&o?o.isPaused():null}function F(){g&&o&&o.pause()}function x(){return g&&o?o.isSeeking():null}function U(e,n,i){if(!g||!o)return;e!==(isNaN(T)?o.getTime():T)&&(!0===i?(o.removeEventListener("seeking",te),r.info("Requesting internal seek to time: "+e),o.setCurrentTime(e,n)):(T=e,t.trigger(M.PLAYBACK_SEEK_ASKED),r.info("Requesting seek to time: "+e),o.setCurrentTime(e,n)))}function B(){return g&&o?o.getTime():null}function k(){let e=B();if(h&&!isNaN(_)){const t=_/1e3;e>t&&(e-=t)}return e}function G(){return g&&o?o.getPlaybackRate():null}function Y(){return g&&o?o.getEnded():null}function K(){return h}function q(){if(!h||isNaN(_))return NaN;let e=k();if(isNaN(e)||0===e)return 0;const t=(new Date).getTime()+1e3*l.getClientTimeOffset();return Math.max(((t-_-1e3*e)/1e3).toFixed(3),0)}function H(){m=!1,u=!1,c=NaN,f=0,_=0,T=NaN,o&&(t.off(M.STREAM_INITIALIZED,C,this),t.off(M.DATA_UPDATE_COMPLETED,X,this),t.off(M.BUFFER_LEVEL_STATE_CHANGED,me,this),t.off(M.LOADING_PROGRESS,pe,this),t.off(M.PLAYBACK_PROGRESS,ce,this),t.off(M.PLAYBACK_TIME_UPDATED,ce,this),t.off(M.PLAYBACK_ENDED,le,this),t.off(M.STREAM_INITIALIZING,_e,this),z(),o.removeEventListener("canplay",Q),o.removeEventListener("play",$),o.removeEventListener("waiting",Z),o.removeEventListener("playing",J),o.removeEventListener("pause",ee),o.removeEventListener("error",ue),o.removeEventListener("seeking",te),o.removeEventListener("seeked",ne),o.removeEventListener("timeupdate",re),o.removeEventListener("progress",ie),o.removeEventListener("ratechange",se),o.removeEventListener("loadedmetadata",ae),o.removeEventListener("stalled",Ee),o.removeEventListener("ended",oe)),d=null,o=null,g=null,h=null}function V(e){const t=N.getURIFragmentData();if(!t||!t.t)return NaN;const n=i.getStreams()[0].getStreamInfo().start;t.t=t.t.split(",")[0];const r=-1!==t.t.indexOf("posix:")?"now"===t.t.substring(6)?Date.now()/1e3:parseInt(t.t.substring(6)):NaN;return e&&!isNaN(r)?r-_/1e3:parseInt(t.t)+n}function j(){if(null!==d)return;d=setInterval((function(){t.trigger(M.WALLCLOCK_TIME_UPDATED,{isDynamic:h,time:new Date}),K()&&P()&&function(){const e=Date.now();(!E||e>E+500)&&(E=e,re())}()}),D.get().streaming.wallclockTimeUpdateInterval)}function z(){clearInterval(d),d=null}function W(){if(P()||!h||0===o.getReadyState())return;const e=k(),t=function(e){const t=s.getCurrentDVRInfo(),n=t?t.range:null;let i;return n?(r.debug(`Checking DVR window for at ${e} with DVR window range ${n.start} - ${n.end}`),i=e>n.end?Math.max(n.end-f,n.start):e>0&&e+.25<n.start&&Math.abs(e-n.start)<31536e4?n.start:e,i):NaN}(e);!isNaN(t)&&t!==e&&(r.debug(`UpdateCurrentTime: Seek to actual time: ${t} from currentTime: ${e}`),U(t))}function X(e){if(e.error)return;const t=a.convertDataToRepresentationInfo(e.currentRepresentation),n=t?t.mediaInfo.streamInfo:null;null!==n&&g.id===n.id&&(g=n,W())}function Q(){t.trigger(M.CAN_PLAY)}function $(){r.info("Native video element event: play"),W(),j(),t.trigger(M.PLAYBACK_STARTED,{startTime:B()})}function Z(){r.info("Native video element event: waiting"),t.trigger(M.PLAYBACK_WAITING,{playingTime:B()})}function J(){r.info("Native video element event: playing"),t.trigger(M.PLAYBACK_PLAYING,{playingTime:B()})}function ee(){r.info("Native video element event: pause"),t.trigger(M.PLAYBACK_PAUSED,{ended:Y()})}function te(){let e=B();isNaN(T)||T===e||(e=T),T=NaN,r.info("Seeking to: "+e),j(),t.trigger(M.PLAYBACK_SEEKING,{seekTime:e})}function ne(){r.info("Native video element event: seeked"),t.trigger(M.PLAYBACK_SEEKED),o.addEventListener("seeking",te)}function re(){g&&t.trigger(M.PLAYBACK_TIME_UPDATED,{timeToEnd:v(),time:B()})}function ie(){t.trigger(M.PLAYBACK_PROGRESS)}function se(){const e=G();r.info("Native video element event: ratechange: ",e),t.trigger(M.PLAYBACK_RATE_CHANGED,{playbackRate:e})}function ae(){r.info("Native video element event: loadedmetadata"),t.trigger(M.PLAYBACK_METADATA_LOADED),j()}function oe(){r.info("Native video element event: ended"),F(),z(),t.trigger(M.PLAYBACK_ENDED,{isLast:i.getActiveStreamInfo().isLast})}function le(e){if(d&&e.isLast){r.info("onPlaybackEnded -- PLAYBACK_ENDED but native video element didn't fire ended");const t=e.seekTime?e.seekTime:O();o.setCurrentTime(t),F(),z()}}function ue(e){const n=e.target||e.srcElement;t.trigger(M.PLAYBACK_ERROR,{error:n.error})}function ce(){h&&de()&&D.get().streaming.liveCatchup.playbackRate>0&&!P()&&!x()&&(function(){try{if(de()&&D.get().streaming.liveCatchup.playbackRate>0&&B()>0){const e=ge(),t=q(),n=p.getLiveDelay(),r=p.getLiveCatchupLatencyThreshold(),i=D.get().streaming.liveCatchup.minDrift;if(e===A.LIVE_CATCHUP_MODE_LOLP){const e=fe(),s=D.get().streaming.liveCatchup.playbackBufferMin;return function(e,t,n,r,i,s){try{const a=Math.abs(e-t);return(isNaN(s)||e<=s)&&(a>n||r<i)}catch(e){return!1}}(t,n,i,e,s,r)}return function(e,t,n,r){try{return Math.abs(e-t)>r&&(isNaN(n)||e<=n)}catch(e){return!1}}(t,n,r,i)}}catch(e){return!1}}()?function(){if(o){let e;const t=o.getPlaybackRate(),n=D.get().streaming.liveCatchup.playbackRate,i=q(),a=p.getLiveDelay(),l=fe();if(ge()===A.LIVE_CATCHUP_MODE_LOLP){D.get().streaming.liveCatchup.minDrift;const s=D.get().streaming.liveCatchup.playbackBufferMin;e=function(e,t,n,i,s,a,o){const l=e;let u;if(a<s){const e=5*(a-s),t=2*l/(1+Math.pow(Math.E,-e));u=1-l+t,r.debug("[LoL+ playback control_buffer-based] bufferLevel: "+a+", newRate: "+u)}else{const e=.02;if(Math.abs(t-n)<=e*n)u=1;else{const e=5*(t-n),r=2*l/(1+Math.pow(Math.E,-e));u=1-l+r}r.debug("[LoL+ playback control_latency-based] latency: "+t+", newRate: "+u)}S&&a>n/2&&(S=!1);Math.abs(o-u)<=R&&(u=null);return{newRate:u}}(n,i,a,0,s,l,t)}else e=function(e,t,n,r,i){const s=e,a=t-n,o=5*a,l=2*s/(1+Math.pow(Math.E,-o));let u=1-s+l;S&&(r>n/2?S=!1:a>0&&(u=1));Math.abs(i-u)<=R&&(u=null);return{newRate:u}}(n,i,a,l,t);let u=e.newRate;u&&o.setPlaybackRate(u);const c=i-a;D.get().streaming.liveCatchup.maxDrift>0&&!y&&c>D.get().streaming.liveCatchup.maxDrift?(r.info("Low Latency catchup mechanism. Latency too high, doing a seek to live point"),y=!0,function(){const e=s.getCurrentDVRInfo();U((e?e.range:null).end-p.getLiveDelay(),!0,!1)}()):y=!1}}():he())}function de(){return D.get().streaming.liveCatchup.enabled||D.get().streaming.lowLatencyEnabled}function fe(){let e=null;return i.getActiveStreamProcessors().forEach(t=>{const n=t.getBufferLevel();e=null===e?n:Math.min(e,n)}),e}function ge(){const e=D.get().streaming.liveCatchup.playbackBufferMin;return D.get().streaming.liveCatchup.mode!==A.LIVE_CATCHUP_MODE_LOLP||null===e||isNaN(e)?A.LIVE_CATCHUP_MODE_DEFAULT:A.LIVE_CATCHUP_MODE_LOLP}function he(){o&&o.setPlaybackRate(1)}function pe(e){if(!1===e.stream&&D.get().streaming.lowLatencyEnabled&&!isNaN(e.request.duration)){const t=1.2*e.request.duration;if(t>p.getLiveDelay()){r.warn("Browser does not support fetch API with StreamReader. Increasing live delay to be 20% higher than segment duration:",t.toFixed(2));const e={streaming:{liveDelay:t}};D.update(e)}}}function me(e){e.streamId===g.id&&(de()?e.state!==I.BUFFER_EMPTY||x()||S||(S=!0,he()):o.setStallState(e.mediaType,e.state===I.BUFFER_EMPTY))}function Ee(e){t.trigger(M.PLAYBACK_STALLED,{e:e})}function _e(e){!function(e,t){if(e&&e.manifestInfo&&e.manifestInfo.serviceDescriptions){let n;for(let t=0;t<e.manifestInfo.serviceDescriptions.length;t++){const r=e.manifestInfo.serviceDescriptions[t];if(r.schemeIdUri===A.SERVICE_DESCRIPTION_LL_SCHEME){n=r;break}}n&&t&&t.supplementalProperties&&"true"===t.supplementalProperties[A.SUPPLEMENTAL_PROPERTY_LL_SCHEME]&&(n.latency&&n.latency.target>0&&(r.debug("Apply LL properties coming from service description. Target Latency (ms):",n.latency.target),D.update({streaming:{lowLatencyEnabled:!0,liveDelay:n.latency.target/1e3,liveCatchup:{minDrift:n.latency.max>n.latency.target?(n.latency.max-n.latency.target)/1e3:void 0}}})),n.playbackRate&&n.playbackRate.max>1&&(r.debug("Apply LL properties coming from service description. Max PlaybackRate:",n.playbackRate.max),D.update({streaming:{lowLatencyEnabled:!0,liveCatchup:{playbackRate:n.playbackRate.max-1}}})))}}(e.streamInfo,e.mediaInfo)}return n={initialize:function(e,n,r){g=e,o.addEventListener("canplay",Q),o.addEventListener("play",$),o.addEventListener("waiting",Z),o.addEventListener("playing",J),o.addEventListener("pause",ee),o.addEventListener("error",ue),o.addEventListener("seeking",te),o.addEventListener("seeked",ne),o.addEventListener("timeupdate",re),o.addEventListener("progress",ie),o.addEventListener("ratechange",se),o.addEventListener("loadedmetadata",ae),o.addEventListener("stalled",Ee),o.addEventListener("ended",oe),h=g.manifestInfo.isDynamic,y=!1,S=!1,u=!0===n,c=r;const i="undefined"!=typeof navigator?navigator.userAgent.toLowerCase():"",s=/safari/.test(i)&&!/chrome/.test(i);R=s?.25:.02,t.on(M.STREAM_INITIALIZED,C,this),t.on(M.DATA_UPDATE_COMPLETED,X,this),t.on(M.LOADING_PROGRESS,pe,this),t.on(M.BUFFER_LEVEL_STATE_CHANGED,me,this),t.on(M.PLAYBACK_PROGRESS,ce,this),t.on(M.PLAYBACK_TIME_UPDATED,ce,this),t.on(M.PLAYBACK_ENDED,le,this,{priority:b.EVENT_PRIORITY_HIGH}),t.on(M.STREAM_INITIALIZING,_e,this),m&&(m=!1,L())},setConfig:function(e){e&&(e.streamController&&(i=e.streamController),e.dashMetrics&&(s=e.dashMetrics),e.mediaPlayerModel&&(p=e.mediaPlayerModel),e.adapter&&(a=e.adapter),e.videoModel&&(o=e.videoModel),e.timelineConverter&&(l=e.timelineConverter),e.uriFragmentModel&&(N=e.uriFragmentModel),e.settings&&(D=e.settings))},getStartTimeFromUriParameters:V,getTimeToStreamEnd:v,getTime:B,getNormalizedTime:k,getPlaybackRate:G,getPlayedRanges:function(){return g&&o?o.getPlayedRanges():null},getEnded:Y,getIsDynamic:K,getStreamController:function(){return i},computeAndSetLiveDelay:function(e,t,n){let r,i,s;const o=!isNaN(e)&&isFinite(e)?e:NaN;let l=a.getSuggestedPresentationDelay();if(r=D.get().streaming.lowLatencyEnabled?0:p.getLiveDelay()?p.getLiveDelay():null===D.get().streaming.liveDelayFragmentCount||isNaN(D.get().streaming.liveDelayFragmentCount)||isNaN(o)?!0===D.get().streaming.useSuggestedPresentationDelay&&null!==l&&!isNaN(l)&&l>0?l:isNaN(o)?isNaN(n)?4*g.manifestInfo.minBufferTime:4*n:4*o:o*D.get().streaming.liveDelayFragmentCount,s=a.getAvailabilityStartTime(),null!==s&&(_=s),t>0){const e=Math.max(t-10,t/2);i=Math.min(r,e)}else i=r;return f=i,i},getLiveDelay:function(){return f},setLiveDelay:function(e,t=!1){t&&e<f||(f=e)},getCurrentLiveLatency:q,play:L,isPaused:P,pause:F,isSeeking:x,getStreamEndTime:O,seek:U,reset:H},r=w(e).getInstance().getLogger(n),H(),n}L.__dashjs_factory_name="PlaybackController";var P=R.getSingletonFactory(L);class F{constructor(){this.tcpid=null,this.type=null,this.url=null,this.actualurl=null,this.range=null,this.trequest=null,this.tresponse=null,this.responsecode=null,this.interval=null,this.trace=[],this._stream=null,this._tfinish=null,this._mediaduration=null,this._quality=null,this._responseHeaders=null,this._serviceLocation=null}}class x{constructor(){this.s=null,this.d=null,this.b=[]}}F.GET="GET",F.HEAD="HEAD",F.MPD_TYPE="MPD",F.XLINK_EXPANSION_TYPE="XLinkExpansion",F.INIT_SEGMENT_TYPE="InitializationSegment",F.INDEX_SEGMENT_TYPE="IndexSegment",F.MEDIA_SEGMENT_TYPE="MediaSegment",F.BITSTREAM_SWITCHING_SEGMENT_TYPE="BitstreamSwitchingSegment",F.LICENSE="license",F.OTHER_TYPE="other";class U{constructor(e){this.action=U.ACTION_DOWNLOAD,this.startTime=NaN,this.mediaStartTime=NaN,this.mediaType=null,this.mediaInfo=null,this.type=null,this.duration=NaN,this.timescale=NaN,this.range=null,this.url=e||null,this.serviceLocation=null,this.requestStartDate=null,this.firstByteDate=null,this.requestEndDate=null,this.quality=NaN,this.index=NaN,this.availabilityStartTime=null,this.availabilityEndTime=null,this.wallStartTime=null,this.bytesLoaded=NaN,this.bytesTotal=NaN,this.delayLoadingTime=NaN,this.responseType="arraybuffer",this.representationId=null}isInitializationRequest(){return this.type&&this.type===F.INIT_SEGMENT_TYPE}setInfo(e){this.type=e&&e.init?F.INIT_SEGMENT_TYPE:F.MEDIA_SEGMENT_TYPE,this.url=e&&e.url?e.url:null,this.range=e&&e.range?e.range.start+"-"+e.range.end:null,this.mediaType=e&&e.mediaType?e.mediaType:null}}U.ACTION_DOWNLOAD="download",U.ACTION_COMPLETE="complete";function B(e){const t=(e=e||{}).eventBus,n=e.events,r=e.dashMetrics,i=e.fragmentLoader,s=e.debug,a=e.streamInfo,o=e.type;let l,u,c,d;function f(e){return!!e&&function(t){let n=!1;return t.some(t=>{if(r=e,i=t,!isNaN(r.index)&&r.startTime===i.startTime&&r.adaptationIndex===i.adaptationIndex&&r.type===i.type||function(e,t){return isNaN(e.index)&&isNaN(t.index)&&e.quality===t.quality}(e,t)||function(e,t){return e.action===U.ACTION_COMPLETE&&e.action===t.action}(e,t))return n=!0,n;var r,i}),n}(c)}function g(e){return isNaN(e.duration)?.25:Math.min(e.duration/8,.5)}function h(e){c=c.filter(t=>{const n=g(t);return isNaN(t.startTime)||void 0!==e&&t.startTime>=e-n})}function p(e,t){t<=e+.5||(c=c.filter(n=>{const r=g(n);return isNaN(n.startTime)||n.startTime>=t-r||isNaN(n.duration)||n.startTime+n.duration<=e+r}))}function m(e,t,n){for(let r=e.length-1;r>=0;r--){const i=e[r],s=i.startTime,a=s+i.duration;if(n=isNaN(n)?g(i):n,!isNaN(s)&&!isNaN(a)&&t+n>=s&&t-n<a||isNaN(s)&&isNaN(t))return i}return null}function E(e,t){r.addSchedulingInfo(e,t),r.addRequestsQueue(e.mediaType,d,c)}function _(e){e.sender===i&&(d.splice(d.indexOf(e.request),1),e.response&&!e.error&&c.push(e.request),E(e.request,e.error?"failed":"executed"),t.trigger(n.FRAGMENT_LOADING_COMPLETED,{request:e.request,response:e.response,error:e.error,sender:this},{streamId:a.id,mediaType:o}))}function T(e){e.sender===i&&t.trigger(n.FRAGMENT_LOADING_PROGRESS,{request:e.request,response:e.response,error:e.error,sender:this},{streamId:a.id,mediaType:o})}function y(e){e.sender===i&&t.trigger(n.FRAGMENT_LOADING_ABANDONED,{request:e.request},{streamId:a.id,mediaType:o})}function A(){c=[],d=[]}return l={getStreamId:function(){return a.id},getType:function(){return o},getRequests:function(e){const t=e?e.state instanceof Array?e.state:[e.state]:[];let n=[];return t.forEach(t=>{const r=function(e){let t;switch(e){case"loading":t=d;break;case"executed":t=c;break;default:t=[]}return t}(t);n=n.concat(function(e,t){if(t.hasOwnProperty("time"))return[m(e,t.time,t.threshold)];return e.filter(e=>{for(const n in t)if("state"!==n&&t.hasOwnProperty(n)&&e[n]!=t[n])return!1;return!0})}(r,e))}),n},isFragmentLoaded:f,isFragmentLoadedOrPending:function(e){let t,n=!1,r=0;if(n=f(e),!n)for(r=0;r<d.length;r++)t=d[r],e.url===t.url&&e.startTime===t.startTime&&(n=!0);return n},removeExecutedRequestsBeforeTime:h,removeExecutedRequestsAfterTime:function(e){c=c.filter(t=>isNaN(t.startTime)||void 0!==e&&t.startTime<e)},syncExecutedRequestsWithBufferedRange:function(e,t){if(!e||0===e.length)return void h();let n=0;for(let t=0,r=e.length;t<r;t++)p(n,e.start(t)),n=e.end(t);t>0&&p(n,t)},abortRequests:function(){u.debug("abort requests"),i.abort(),d=[]},executeRequest:function(e){switch(e.action){case U.ACTION_COMPLETE:c.push(e),E(e,"executed"),u.debug("STREAM_COMPLETED"),t.trigger(n.STREAM_COMPLETED,{request:e},{streamId:e.mediaInfo.streamInfo.id,mediaType:e.mediaType});break;case U.ACTION_DOWNLOAD:E(e,"loading"),d.push(e),function(e){t.trigger(n.FRAGMENT_LOADING_STARTED,{request:e},{streamId:a.id,mediaType:o}),i.load(e)}(e);break;default:u.warn("Unknown request action.")}},reset:function(){t.off(n.LOADING_COMPLETED,_,this),t.off(n.LOADING_DATA_PROGRESS,T,this),t.off(n.LOADING_ABANDONED,y,this),i&&i.reset(),A()},addExecutedRequest:function(e){c.push(e)}},u=s.getLogger(l),A(),t.on(n.LOADING_COMPLETED,_,l),t.on(n.LOADING_DATA_PROGRESS,T,l),t.on(n.LOADING_ABANDONED,y,l),l}B.__dashjs_factory_name="FragmentModel";const k=R.getClassFactory(B);k.FRAGMENT_MODEL_LOADING="loading",k.FRAGMENT_MODEL_EXECUTED="executed",k.FRAGMENT_MODEL_CANCELED="canceled",k.FRAGMENT_MODEL_FAILED="failed",R.updateClassFactory(B.__dashjs_factory_name,k);class G{constructor(e,t,n){this.code=e||null,this.message=t||null,this.data=n||null}}class Y{constructor(){this.captionData=null,this.label=null,this.lang=null,this.defaultTrack=!1,this.kind=null,this.isFragmented=!1,this.isEmbedded=!1}}class K{constructor(e){if(this.offset=e._offset,this.type=e.type,this.size=e.size,this.boxes=[],e.boxes)for(let t=0;t<e.boxes.length;t++)this.boxes.push(new K(e.boxes[t]));switch(this.isComplete=!0,e.type){case"sidx":if(this.timescale=e.timescale,this.earliest_presentation_time=e.earliest_presentation_time,this.first_offset=e.first_offset,this.references=e.references,e.references){this.references=[];for(let t=0;t<e.references.length;t++){let n={reference_type:e.references[t].reference_type,referenced_size:e.references[t].referenced_size,subsegment_duration:e.references[t].subsegment_duration};this.references.push(n)}}break;case"emsg":this.id=e.id,this.version=1===e.version?1:0,this.value=e.value,this.timescale=e.timescale,this.scheme_id_uri=e.scheme_id_uri,this.presentation_time_delta=1===e.version?e.presentation_time:e.presentation_time_delta,this.event_duration=e.event_duration,this.message_data=e.message_data;break;case"mdhd":this.timescale=e.timescale;break;case"mfhd":this.sequence_number=e.sequence_number;break;case"subs":this.entry_count=e.entry_count,this.entries=e.entries;break;case"tfhd":this.base_data_offset=e.base_data_offset,this.sample_description_index=e.sample_description_index,this.default_sample_duration=e.default_sample_duration,this.default_sample_size=e.default_sample_size,this.default_sample_flags=e.default_sample_flags,this.flags=e.flags;break;case"tfdt":this.version=e.version,this.baseMediaDecodeTime=e.baseMediaDecodeTime,this.flags=e.flags;break;case"trun":if(this.sample_count=e.sample_count,this.first_sample_flags=e.first_sample_flags,this.data_offset=e.data_offset,this.flags=e.flags,this.samples=e.samples,e.samples){this.samples=[];for(let t=0,n=e.samples.length;t<n;t++){let n={sample_size:e.samples[t].sample_size,sample_duration:e.samples[t].sample_duration,sample_composition_time_offset:e.samples[t].sample_composition_time_offset};this.samples.push(n)}}}}getChildBox(e){for(let t=0;t<this.boxes.length;t++)if(this.boxes[t].type===e)return this.boxes[t]}getChildBoxes(e){let t=[];for(let n=0;n<this.boxes.length;n++)this.boxes[n].type===e&&t.push(this.boxes[n]);return t}}function q(){let e,t;function n(e){let n=[];if(!e||!t||"function"!=typeof t.fetchAll)return n;let i,s=t.fetchAll(e);for(let e=0,t=s.length;e<t;e++)i=r(s[e]),i&&n.push(i);return n}function r(e){if(!e)return null;let t=new K(e);return e.hasOwnProperty("_incomplete")&&(t.isComplete=!e._incomplete),t}return e={getBox:function(e){return e&&t&&t.boxes&&0!==t.boxes.length&&"function"==typeof t.fetch?r(t.fetch(e)):null},getBoxes:n,setData:function(e){t=e},getLastBox:function(){if(!t||!t.boxes||!t.boxes.length)return null;let e=n(t.boxes[t.boxes.length-1].type);return e.length>0?e[e.length-1]:null}},e}q.__dashjs_factory_name="IsoFile";var H=R.getClassFactory(q),V=T((function(e,t){var n={parseBuffer:function(e){return new r(e).parse()},addBoxProcessor:function(e,t){"string"==typeof e&&"function"==typeof t&&(i.prototype._boxProcessors[e]=t)},createFile:function(){return new r},createBox:function(e,t,n){var r=i.create(e);return t&&t.append(r,n),r},createFullBox:function(e,t,r){var i=n.createBox(e,t,r);return i.version=0,i.flags=0,i},Utils:{}};n.Utils.dataViewToString=function(e,t){var n=t||"utf-8";if("undefined"!=typeof TextDecoder)return new TextDecoder(n).decode(e);var r=[],i=0;if("utf-8"===n)for(;i<e.byteLength;){var s=e.getUint8(i++);s<128||(s<224?(s=(31&s)<<6,s|=63&e.getUint8(i++)):s<240?(s=(15&s)<<12,s|=(63&e.getUint8(i++))<<6,s|=63&e.getUint8(i++)):(s=(7&s)<<18,s|=(63&e.getUint8(i++))<<12,s|=(63&e.getUint8(i++))<<6,s|=63&e.getUint8(i++))),r.push(String.fromCharCode(s))}else for(;i<e.byteLength;)r.push(String.fromCharCode(e.getUint8(i++)));return r.join("")},n.Utils.utf8ToByteArray=function(e){var t,n;if("undefined"!=typeof TextEncoder)t=(new TextEncoder).encode(e);else for(t=[],n=0;n<e.length;++n){var r=e.charCodeAt(n);r<128?t.push(r):r<2048?(t.push(192|r>>6),t.push(128|63&r)):r<65536?(t.push(224|r>>12),t.push(128|63&r>>6),t.push(128|63&r)):(t.push(240|r>>18),t.push(128|63&r>>12),t.push(128|63&r>>6),t.push(128|63&r))}return t},n.Utils.appendBox=function(e,t,n){if(t._offset=e._cursor.offset,t._root=e._root?e._root:e,t._raw=e._raw,t._parent=e,-1!==n)if(null!=n){var r,i=-1;if("number"==typeof n)i=n;else{if("string"==typeof n)r=n;else{if("object"!=typeof n||!n.type)return void e.boxes.push(t);r=n.type}for(var s=0;s<e.boxes.length;s++)if(r===e.boxes[s].type){i=s+1;break}}e.boxes.splice(i,0,t)}else e.boxes.push(t)},t.parseBuffer=n.parseBuffer,t.addBoxProcessor=n.addBoxProcessor,t.createFile=n.createFile,t.createBox=n.createBox,t.createFullBox=n.createFullBox,t.Utils=n.Utils,n.Cursor=function(e){this.offset=void 0===e?0:e};var r=function(e){this._cursor=new n.Cursor,this.boxes=[],e&&(this._raw=new DataView(e))};r.prototype.fetch=function(e){var t=this.fetchAll(e,!0);return t.length?t[0]:null},r.prototype.fetchAll=function(e,t){var n=[];return r._sweep.call(this,e,n,t),n},r.prototype.parse=function(){for(this._cursor.offset=0,this.boxes=[];this._cursor.offset<this._raw.byteLength;){var e=i.parse(this);if(void 0===e.type)break;this.boxes.push(e)}return this},r._sweep=function(e,t,n){for(var i in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&n)return;r._sweep.call(this.boxes[i],e,t,n)}},r.prototype.write=function(){var e,t=0;for(e=0;e<this.boxes.length;e++)t+=this.boxes[e].getLength(!1);var n=new Uint8Array(t);for(this._rawo=new DataView(n.buffer),this.bytes=n,this._cursor.offset=0,e=0;e<this.boxes.length;e++)this.boxes[e].write();return n.buffer},r.prototype.append=function(e,t){n.Utils.appendBox(this,e,t)};var i=function(){this._cursor=new n.Cursor};i.parse=function(e){var t=new i;return t._offset=e._cursor.offset,t._root=e._root?e._root:e,t._raw=e._raw,t._parent=e,t._parseBox(),e._cursor.offset=t._raw.byteOffset+t._raw.byteLength,t},i.create=function(e){var t=new i;return t.type=e,t.boxes=[],t},i.prototype._boxContainers=["dinf","edts","mdia","meco","mfra","minf","moof","moov","mvex","stbl","strk","traf","trak","tref","udta","vttc","sinf","schi","encv","enca"],i.prototype._boxProcessors={},i.prototype._procField=function(e,t,n){this._parsing?this[e]=this._readField(t,n):this._writeField(t,n,this[e])},i.prototype._procFieldArray=function(e,t,n,r){var i;if(this._parsing)for(this[e]=[],i=0;i<t;i++)this[e][i]=this._readField(n,r);else for(i=0;i<this[e].length;i++)this._writeField(n,r,this[e][i])},i.prototype._procFullBox=function(){this._procField("version","uint",8),this._procField("flags","uint",24)},i.prototype._procEntries=function(e,t,n){var r;if(this._parsing)for(this[e]=[],r=0;r<t;r++)this[e].push({}),n.call(this,this[e][r]);else for(r=0;r<t;r++)n.call(this,this[e][r])},i.prototype._procSubEntries=function(e,t,n,r){var i;if(this._parsing)for(e[t]=[],i=0;i<n;i++)e[t].push({}),r.call(this,e[t][i]);else for(i=0;i<n;i++)r.call(this,e[t][i])},i.prototype._procEntryField=function(e,t,n,r){this._parsing?e[t]=this._readField(n,r):this._writeField(n,r,e[t])},i.prototype._procSubBoxes=function(e,t){var n;if(this._parsing)for(this[e]=[],n=0;n<t;n++)this[e].push(i.parse(this));else for(n=0;n<t;n++)this._rawo?this[e][n].write():this.size+=this[e][n].getLength()},i.prototype._readField=function(e,t){switch(e){case"uint":return this._readUint(t);case"int":return this._readInt(t);case"template":return this._readTemplate(t);case"string":return-1===t?this._readTerminatedString():this._readString(t);case"data":return this._readData(t);case"utf8":return this._readUTF8String();default:return-1}},i.prototype._readInt=function(e){var t=null,n=this._cursor.offset-this._raw.byteOffset;switch(e){case 8:t=this._raw.getInt8(n);break;case 16:t=this._raw.getInt16(n);break;case 32:t=this._raw.getInt32(n);break;case 64:var r=this._raw.getInt32(n),i=this._raw.getInt32(n+4);t=r*Math.pow(2,32)+i}return this._cursor.offset+=e>>3,t},i.prototype._readUint=function(e){var t,n,r=null,i=this._cursor.offset-this._raw.byteOffset;switch(e){case 8:r=this._raw.getUint8(i);break;case 16:r=this._raw.getUint16(i);break;case 24:r=((t=this._raw.getUint16(i))<<8)+(n=this._raw.getUint8(i+2));break;case 32:r=this._raw.getUint32(i);break;case 64:t=this._raw.getUint32(i),n=this._raw.getUint32(i+4),r=t*Math.pow(2,32)+n}return this._cursor.offset+=e>>3,r},i.prototype._readString=function(e){for(var t="",n=0;n<e;n++){var r=this._readUint(8);t+=String.fromCharCode(r)}return t},i.prototype._readTemplate=function(e){return this._readUint(e/2)+this._readUint(e/2)/Math.pow(2,e/2)},i.prototype._readTerminatedString=function(){for(var e="";this._cursor.offset-this._offset<this._raw.byteLength;){var t=this._readUint(8);if(0===t)break;e+=String.fromCharCode(t)}return e},i.prototype._readData=function(e){var t=e>0?e:this._raw.byteLength-(this._cursor.offset-this._offset);if(t>0){var n=new Uint8Array(this._raw.buffer,this._cursor.offset,t);return this._cursor.offset+=t,n}return null},i.prototype._readUTF8String=function(){var e=this._raw.byteLength-(this._cursor.offset-this._offset),t=null;return e>0&&(t=new DataView(this._raw.buffer,this._cursor.offset,e),this._cursor.offset+=e),t?n.Utils.dataViewToString(t):t},i.prototype._parseBox=function(){if(this._parsing=!0,this._cursor.offset=this._offset,this._offset+8>this._raw.buffer.byteLength)this._root._incomplete=!0;else{switch(this._procField("size","uint",32),this._procField("type","string",4),1===this.size&&this._procField("largesize","uint",64),"uuid"===this.type&&this._procFieldArray("usertype",16,"uint",8),this.size){case 0:this._raw=new DataView(this._raw.buffer,this._offset,this._raw.byteLength-this._cursor.offset+8);break;case 1:this._offset+this.size>this._raw.buffer.byteLength?(this._incomplete=!0,this._root._incomplete=!0):this._raw=new DataView(this._raw.buffer,this._offset,this.largesize);break;default:this._offset+this.size>this._raw.buffer.byteLength?(this._incomplete=!0,this._root._incomplete=!0):this._raw=new DataView(this._raw.buffer,this._offset,this.size)}this._incomplete||(this._boxProcessors[this.type]&&this._boxProcessors[this.type].call(this),-1!==this._boxContainers.indexOf(this.type)?this._parseContainerBox():this._data=this._readData())}},i.prototype._parseFullBox=function(){this.version=this._readUint(8),this.flags=this._readUint(24)},i.prototype._parseContainerBox=function(){for(this.boxes=[];this._cursor.offset-this._raw.byteOffset<this._raw.byteLength;)this.boxes.push(i.parse(this))},i.prototype.append=function(e,t){n.Utils.appendBox(this,e,t)},i.prototype.getLength=function(){if(this._parsing=!1,this._rawo=null,this.size=0,this._procField("size","uint",32),this._procField("type","string",4),1===this.size&&this._procField("largesize","uint",64),"uuid"===this.type&&this._procFieldArray("usertype",16,"uint",8),this._boxProcessors[this.type]&&this._boxProcessors[this.type].call(this),-1!==this._boxContainers.indexOf(this.type))for(var e=0;e<this.boxes.length;e++)this.size+=this.boxes[e].getLength();return this._data&&this._writeData(this._data),this.size},i.prototype.write=function(){switch(this._parsing=!1,this._cursor.offset=this._parent._cursor.offset,this.size){case 0:this._rawo=new DataView(this._parent._rawo.buffer,this._cursor.offset,this.parent._rawo.byteLength-this._cursor.offset);break;case 1:this._rawo=new DataView(this._parent._rawo.buffer,this._cursor.offset,this.largesize);break;default:this._rawo=new DataView(this._parent._rawo.buffer,this._cursor.offset,this.size)}if(this._procField("size","uint",32),this._procField("type","string",4),1===this.size&&this._procField("largesize","uint",64),"uuid"===this.type&&this._procFieldArray("usertype",16,"uint",8),this._boxProcessors[this.type]&&this._boxProcessors[this.type].call(this),-1!==this._boxContainers.indexOf(this.type))for(var e=0;e<this.boxes.length;e++)this.boxes[e].write();return this._data&&this._writeData(this._data),this._parent._cursor.offset+=this.size,this.size},i.prototype._writeInt=function(e,t){if(this._rawo){var n=this._cursor.offset-this._rawo.byteOffset;switch(e){case 8:this._rawo.setInt8(n,t);break;case 16:this._rawo.setInt16(n,t);break;case 32:this._rawo.setInt32(n,t);break;case 64:var r=Math.floor(t/Math.pow(2,32)),i=t-r*Math.pow(2,32);this._rawo.setUint32(n,r),this._rawo.setUint32(n+4,i)}this._cursor.offset+=e>>3}else this.size+=e>>3},i.prototype._writeUint=function(e,t){if(this._rawo){var n,r,i=this._cursor.offset-this._rawo.byteOffset;switch(e){case 8:this._rawo.setUint8(i,t);break;case 16:this._rawo.setUint16(i,t);break;case 24:n=(16776960&t)>>8,r=255&t,this._rawo.setUint16(i,n),this._rawo.setUint8(i+2,r);break;case 32:this._rawo.setUint32(i,t);break;case 64:r=t-(n=Math.floor(t/Math.pow(2,32)))*Math.pow(2,32),this._rawo.setUint32(i,n),this._rawo.setUint32(i+4,r)}this._cursor.offset+=e>>3}else this.size+=e>>3},i.prototype._writeString=function(e,t){for(var n=0;n<e;n++)this._writeUint(8,t.charCodeAt(n))},i.prototype._writeTerminatedString=function(e){if(0!==e.length){for(var t=0;t<e.length;t++)this._writeUint(8,e.charCodeAt(t));this._writeUint(8,0)}},i.prototype._writeTemplate=function(e,t){var n=Math.floor(t),r=(t-n)*Math.pow(2,e/2);this._writeUint(e/2,n),this._writeUint(e/2,r)},i.prototype._writeData=function(e){if(e)if(this._rawo){if(e instanceof Array){for(var t=this._cursor.offset-this._rawo.byteOffset,n=0;n<e.length;n++)this._rawo.setInt8(t+n,e[n]);this._cursor.offset+=e.length}e instanceof Uint8Array&&(this._root.bytes.set(e,this._cursor.offset),this._cursor.offset+=e.length)}else this.size+=e.length},i.prototype._writeUTF8String=function(e){var t=n.Utils.utf8ToByteArray(e);if(this._rawo)for(var r=new DataView(this._rawo.buffer,this._cursor.offset,t.length),i=0;i<t.length;i++)r.setUint8(i,t[i]);else this.size+=t.length},i.prototype._writeField=function(e,t,n){switch(e){case"uint":this._writeUint(t,n);break;case"int":this._writeInt(t,n);break;case"template":this._writeTemplate(t,n);break;case"string":-1==t?this._writeTerminatedString(n):this._writeString(t,n);break;case"data":this._writeData(n);break;case"utf8":this._writeUTF8String(n)}},i.prototype._boxProcessors.avc1=i.prototype._boxProcessors.encv=function(){this._procFieldArray("reserved1",6,"uint",8),this._procField("data_reference_index","uint",16),this._procField("pre_defined1","uint",16),this._procField("reserved2","uint",16),this._procFieldArray("pre_defined2",3,"uint",32),this._procField("width","uint",16),this._procField("height","uint",16),this._procField("horizresolution","template",32),this._procField("vertresolution","template",32),this._procField("reserved3","uint",32),this._procField("frame_count","uint",16),this._procFieldArray("compressorname",32,"uint",8),this._procField("depth","uint",16),this._procField("pre_defined3","int",16),this._procField("config","data",-1)},i.prototype._boxProcessors.dref=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procSubBoxes("entries",this.entry_count)},i.prototype._boxProcessors.elst=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procEntries("entries",this.entry_count,(function(e){this._procEntryField(e,"segment_duration","uint",1===this.version?64:32),this._procEntryField(e,"media_time","int",1===this.version?64:32),this._procEntryField(e,"media_rate_integer","int",16),this._procEntryField(e,"media_rate_fraction","int",16)}))},i.prototype._boxProcessors.emsg=function(){this._procFullBox(),1==this.version?(this._procField("timescale","uint",32),this._procField("presentation_time","uint",64),this._procField("event_duration","uint",32),this._procField("id","uint",32),this._procField("scheme_id_uri","string",-1),this._procField("value","string",-1)):(this._procField("scheme_id_uri","string",-1),this._procField("value","string",-1),this._procField("timescale","uint",32),this._procField("presentation_time_delta","uint",32),this._procField("event_duration","uint",32),this._procField("id","uint",32)),this._procField("message_data","data",-1)},i.prototype._boxProcessors.free=i.prototype._boxProcessors.skip=function(){this._procField("data","data",-1)},i.prototype._boxProcessors.frma=function(){this._procField("data_format","uint",32)},i.prototype._boxProcessors.ftyp=i.prototype._boxProcessors.styp=function(){this._procField("major_brand","string",4),this._procField("minor_version","uint",32);var e=-1;this._parsing&&(e=(this._raw.byteLength-(this._cursor.offset-this._raw.byteOffset))/4),this._procFieldArray("compatible_brands",e,"string",4)},i.prototype._boxProcessors.hdlr=function(){this._procFullBox(),this._procField("pre_defined","uint",32),this._procField("handler_type","string",4),this._procFieldArray("reserved",3,"uint",32),this._procField("name","string",-1)},i.prototype._boxProcessors.mdat=function(){this._procField("data","data",-1)},i.prototype._boxProcessors.mdhd=function(){this._procFullBox(),this._procField("creation_time","uint",1==this.version?64:32),this._procField("modification_time","uint",1==this.version?64:32),this._procField("timescale","uint",32),this._procField("duration","uint",1==this.version?64:32),this._parsing||"string"!=typeof this.language||(this.language=this.language.charCodeAt(0)-96<<10|this.language.charCodeAt(1)-96<<5|this.language.charCodeAt(2)-96),this._procField("language","uint",16),this._parsing&&(this.language=String.fromCharCode(96+(this.language>>10&31),96+(this.language>>5&31),96+(31&this.language))),this._procField("pre_defined","uint",16)},i.prototype._boxProcessors.mehd=function(){this._procFullBox(),this._procField("fragment_duration","uint",1==this.version?64:32)},i.prototype._boxProcessors.mfhd=function(){this._procFullBox(),this._procField("sequence_number","uint",32)},i.prototype._boxProcessors.mfro=function(){this._procFullBox(),this._procField("mfra_size","uint",32)},i.prototype._boxProcessors.mp4a=i.prototype._boxProcessors.enca=function(){this._procFieldArray("reserved1",6,"uint",8),this._procField("data_reference_index","uint",16),this._procFieldArray("reserved2",2,"uint",32),this._procField("channelcount","uint",16),this._procField("samplesize","uint",16),this._procField("pre_defined","uint",16),this._procField("reserved3","uint",16),this._procField("samplerate","template",32),this._procField("esds","data",-1)},i.prototype._boxProcessors.mvhd=function(){this._procFullBox(),this._procField("creation_time","uint",1==this.version?64:32),this._procField("modification_time","uint",1==this.version?64:32),this._procField("timescale","uint",32),this._procField("duration","uint",1==this.version?64:32),this._procField("rate","template",32),this._procField("volume","template",16),this._procField("reserved1","uint",16),this._procFieldArray("reserved2",2,"uint",32),this._procFieldArray("matrix",9,"template",32),this._procFieldArray("pre_defined",6,"uint",32),this._procField("next_track_ID","uint",32)},i.prototype._boxProcessors.payl=function(){this._procField("cue_text","utf8")},i.prototype._boxProcessors.pssh=function(){this._procFullBox(),this._procFieldArray("SystemID",16,"uint",8),this._procField("DataSize","uint",32),this._procFieldArray("Data",this.DataSize,"uint",8)},i.prototype._boxProcessors.schm=function(){this._procFullBox(),this._procField("scheme_type","uint",32),this._procField("scheme_version","uint",32),1&this.flags&&this._procField("scheme_uri","string",-1)},i.prototype._boxProcessors.sdtp=function(){this._procFullBox();var e=-1;this._parsing&&(e=this._raw.byteLength-(this._cursor.offset-this._raw.byteOffset)),this._procFieldArray("sample_dependency_table",e,"uint",8)},i.prototype._boxProcessors.sidx=function(){this._procFullBox(),this._procField("reference_ID","uint",32),this._procField("timescale","uint",32),this._procField("earliest_presentation_time","uint",1==this.version?64:32),this._procField("first_offset","uint",1==this.version?64:32),this._procField("reserved","uint",16),this._procField("reference_count","uint",16),this._procEntries("references",this.reference_count,(function(e){this._parsing||(e.reference=(1&e.reference_type)<<31,e.reference|=2147483647&e.referenced_size,e.sap=(1&e.starts_with_SAP)<<31,e.sap|=(3&e.SAP_type)<<28,e.sap|=268435455&e.SAP_delta_time),this._procEntryField(e,"reference","uint",32),this._procEntryField(e,"subsegment_duration","uint",32),this._procEntryField(e,"sap","uint",32),this._parsing&&(e.reference_type=e.reference>>31&1,e.referenced_size=2147483647&e.reference,e.starts_with_SAP=e.sap>>31&1,e.SAP_type=e.sap>>28&7,e.SAP_delta_time=268435455&e.sap)}))},i.prototype._boxProcessors.smhd=function(){this._procFullBox(),this._procField("balance","uint",16),this._procField("reserved","uint",16)},i.prototype._boxProcessors.ssix=function(){this._procFullBox(),this._procField("subsegment_count","uint",32),this._procEntries("subsegments",this.subsegment_count,(function(e){this._procEntryField(e,"ranges_count","uint",32),this._procSubEntries(e,"ranges",e.ranges_count,(function(e){this._procEntryField(e,"level","uint",8),this._procEntryField(e,"range_size","uint",24)}))}))},i.prototype._boxProcessors.stsd=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procSubBoxes("entries",this.entry_count)},i.prototype._boxProcessors.subs=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procEntries("entries",this.entry_count,(function(e){this._procEntryField(e,"sample_delta","uint",32),this._procEntryField(e,"subsample_count","uint",16),this._procSubEntries(e,"subsamples",e.subsample_count,(function(e){this._procEntryField(e,"subsample_size","uint",1===this.version?32:16),this._procEntryField(e,"subsample_priority","uint",8),this._procEntryField(e,"discardable","uint",8),this._procEntryField(e,"codec_specific_parameters","uint",32)}))}))},i.prototype._boxProcessors.tenc=function(){this._procFullBox(),this._procField("default_IsEncrypted","uint",24),this._procField("default_IV_size","uint",8),this._procFieldArray("default_KID",16,"uint",8)},i.prototype._boxProcessors.tfdt=function(){this._procFullBox(),this._procField("baseMediaDecodeTime","uint",1==this.version?64:32)},i.prototype._boxProcessors.tfhd=function(){this._procFullBox(),this._procField("track_ID","uint",32),1&this.flags&&this._procField("base_data_offset","uint",64),2&this.flags&&this._procField("sample_description_offset","uint",32),8&this.flags&&this._procField("default_sample_duration","uint",32),16&this.flags&&this._procField("default_sample_size","uint",32),32&this.flags&&this._procField("default_sample_flags","uint",32)},i.prototype._boxProcessors.tfra=function(){this._procFullBox(),this._procField("track_ID","uint",32),this._parsing||(this.reserved=0,this.reserved|=(48&this.length_size_of_traf_num)<<4,this.reserved|=(12&this.length_size_of_trun_num)<<2,this.reserved|=3&this.length_size_of_sample_num),this._procField("reserved","uint",32),this._parsing&&(this.length_size_of_traf_num=(48&this.reserved)>>4,this.length_size_of_trun_num=(12&this.reserved)>>2,this.length_size_of_sample_num=3&this.reserved),this._procField("number_of_entry","uint",32),this._procEntries("entries",this.number_of_entry,(function(e){this._procEntryField(e,"time","uint",1===this.version?64:32),this._procEntryField(e,"moof_offset","uint",1===this.version?64:32),this._procEntryField(e,"traf_number","uint",8*(this.length_size_of_traf_num+1)),this._procEntryField(e,"trun_number","uint",8*(this.length_size_of_trun_num+1)),this._procEntryField(e,"sample_number","uint",8*(this.length_size_of_sample_num+1))}))},i.prototype._boxProcessors.tkhd=function(){this._procFullBox(),this._procField("creation_time","uint",1==this.version?64:32),this._procField("modification_time","uint",1==this.version?64:32),this._procField("track_ID","uint",32),this._procField("reserved1","uint",32),this._procField("duration","uint",1==this.version?64:32),this._procFieldArray("reserved2",2,"uint",32),this._procField("layer","uint",16),this._procField("alternate_group","uint",16),this._procField("volume","template",16),this._procField("reserved3","uint",16),this._procFieldArray("matrix",9,"template",32),this._procField("width","template",32),this._procField("height","template",32)},i.prototype._boxProcessors.trex=function(){this._procFullBox(),this._procField("track_ID","uint",32),this._procField("default_sample_description_index","uint",32),this._procField("default_sample_duration","uint",32),this._procField("default_sample_size","uint",32),this._procField("default_sample_flags","uint",32)},i.prototype._boxProcessors.trun=function(){this._procFullBox(),this._procField("sample_count","uint",32),1&this.flags&&this._procField("data_offset","int",32),4&this.flags&&this._procField("first_sample_flags","uint",32),this._procEntries("samples",this.sample_count,(function(e){256&this.flags&&this._procEntryField(e,"sample_duration","uint",32),512&this.flags&&this._procEntryField(e,"sample_size","uint",32),1024&this.flags&&this._procEntryField(e,"sample_flags","uint",32),2048&this.flags&&this._procEntryField(e,"sample_composition_time_offset",1===this.version?"int":"uint",32)}))},i.prototype._boxProcessors["url "]=i.prototype._boxProcessors["urn "]=function(){this._procFullBox(),"urn "===this.type&&this._procField("name","string",-1),this._procField("location","string",-1)},i.prototype._boxProcessors.vlab=function(){this._procField("source_label","utf8")},i.prototype._boxProcessors.vmhd=function(){this._procFullBox(),this._procField("graphicsmode","uint",16),this._procFieldArray("opcolor",3,"uint",16)},i.prototype._boxProcessors.vttC=function(){this._procField("config","utf8")},i.prototype._boxProcessors.vtte=function(){}}));
17
- /*! codem-isoboxer v0.3.6 https://github.com/madebyhiro/codem-isoboxer/blob/master/LICENSE.txt */class j{constructor(e,t,n){this.lastCompletedOffset=e,this.found=t,this.size=n}}function z(){let e,t,n=this.context;function r(e){if(!e)return null;void 0===e.fileStart&&(e.fileStart=0);let t=V.parseBuffer(e),r=H(n).create();return r.setData(t),r}function i(e,t){return e[t+3]>>>0|e[t+2]<<8>>>0|e[t+1]<<16>>>0|e[t]<<24>>>0}function s(e,t){return String.fromCharCode(e[t++])+String.fromCharCode(e[t++])+String.fromCharCode(e[t++])+String.fromCharCode(e[t])}return t={parse:r,findLastTopIsoBoxCompleted:function(e,t,n){if(void 0===n&&(n=0),!t||n+8>=t.byteLength)return new j(0,!1);const r=t instanceof ArrayBuffer?new Uint8Array(t):t;let a,o=0;for(;n<r.byteLength;){const t=i(r,n),l=s(r,n+4);if(0===t)break;n+t<=r.byteLength&&(e.indexOf(l)>=0?a=new j(n,!0,t):o=n+t),n+=t}return a||new j(o,!1)},getMediaTimescaleFromMoov:function(e){let t=r(e),n=t?t.getBox("mdhd"):void 0;return n?n.timescale:NaN},getSamplesInfo:function(e){if(!e||0===e.byteLength)return{sampleList:[],lastSequenceNumber:NaN,totalDuration:NaN,numSequences:NaN};let t,n,i,s,a,o,l,u,c,d,f,g,h,p,m,E,_,T=r(e),y=T.getBoxes("moof"),A=T.getBoxes("mfhd");E=T.getBoxes("moof").length,m=A[A.length-1].sequence_number,i=0,o=[];let S=-1,I=-1;for(f=0;f<y.length;f++){let e=y[f],r=e.getChildBoxes("traf");for(c=0;c<r.length;c++){let f=r[c],m=f.getChildBox("tfhd"),E=f.getChildBox("tfdt");a=E.baseMediaDecodeTime;let T=f.getChildBoxes("trun"),y=f.getChildBoxes("subs");for(d=0;d<T.length;d++){let r=T[d];for(i=r.sample_count,p=(m.base_data_offset||0)+(r.data_offset||0),u=0;u<i;u++){l=r.samples[u],t=void 0!==l.sample_duration?l.sample_duration:m.default_sample_duration,s=void 0!==l.sample_size?l.sample_size:m.default_sample_size,n=void 0!==l.sample_composition_time_offset?l.sample_composition_time_offset:0;let i={dts:a,cts:a+n,duration:t,offset:e.offset+p,size:s,subSizes:[s]};if(y)for(g=0;g<y.length;g++){let e=y[g];if(S<e.entry_count-1&&u>I&&(S++,I+=e.entries[S].sample_delta),u==I){i.subSizes=[];let t=e.entries[S];for(h=0;h<t.subsample_count;h++)i.subSizes.push(t.subsamples[h].subsample_size)}}o.push(i),p+=s,a+=t}}_=a-E.baseMediaDecodeTime}}return{sampleList:o,lastSequenceNumber:m,totalDuration:_,numSequences:E}},findInitRange:function(t){let n,i,s=null;const a=r(t);if(!a)return s;const o=a.getBox("ftyp"),l=a.getBox("moov");return e.debug("Searching for initialization."),l&&l.isComplete&&(n=o?o.offset:l.offset,i=l.offset+l.size-1,s=n+"-"+i,e.debug("Found the initialization. Range: "+s)),s},parsePayload:function(e,t,n){if(void 0===n&&(n=0),!t||n+8>=t.byteLength)return new j(0,!1);const r=t instanceof ArrayBuffer?new Uint8Array(t):t;let a,o=0;for(;n<r.byteLength;){const t=i(r,n),l=s(r,n+4);if(0===t)break;n+t<=r.byteLength&&(e.indexOf(l)>=0?a=new j(n,!0,t,l):o=n+t),n+=t}return a||new j(o,!1)}},e=w(n).getInstance().getLogger(t),t}z.__dashjs_factory_name="BoxParser";var W=R.getSingletonFactory(z);function X(e,t){if(typeof e!==t)throw A.BAD_ARGUMENT_ERROR}function Q(e){if(!(null!==e&&!isNaN(e)&&e%1==0))throw A.BAD_ARGUMENT_ERROR+" : argument is not an integer"}function $(){return{customTimeRangeArray:[],length:0,add:function(e,t){let n=0;for(n=0;n<this.customTimeRangeArray.length&&e>this.customTimeRangeArray[n].start;n++);for(this.customTimeRangeArray.splice(n,0,{start:e,end:t}),n=0;n<this.customTimeRangeArray.length-1;n++)this.mergeRanges(n,n+1)&&n--;this.length=this.customTimeRangeArray.length},clear:function(){this.customTimeRangeArray=[],this.length=0},remove:function(e,t){for(let n=0;n<this.customTimeRangeArray.length;n++)if(e<=this.customTimeRangeArray[n].start&&t>=this.customTimeRangeArray[n].end)this.customTimeRangeArray.splice(n,1),n--;else{if(e>this.customTimeRangeArray[n].start&&t<this.customTimeRangeArray[n].end){this.customTimeRangeArray.splice(n+1,0,{start:t,end:this.customTimeRangeArray[n].end}),this.customTimeRangeArray[n].end=e;break}e>this.customTimeRangeArray[n].start&&e<this.customTimeRangeArray[n].end?this.customTimeRangeArray[n].end=e:t>this.customTimeRangeArray[n].start&&t<this.customTimeRangeArray[n].end&&(this.customTimeRangeArray[n].start=t)}this.length=this.customTimeRangeArray.length},mergeRanges:function(e,t){let n=this.customTimeRangeArray[e],r=this.customTimeRangeArray[t];return n.start<=r.start&&r.start<=n.end&&n.end<=r.end?(n.end=r.end,this.customTimeRangeArray.splice(t,1),!0):r.start<=n.start&&n.start<=r.end&&r.end<=n.end?(n.start=r.start,this.customTimeRangeArray.splice(t,1),!0):r.start<=n.start&&n.start<=r.end&&n.end<=r.end?(this.customTimeRangeArray.splice(e,1),!0):n.start<=r.start&&r.start<=n.end&&r.end<=n.end&&(this.customTimeRangeArray.splice(t,1),!0)},start:function(e){return Q(e),e>=this.customTimeRangeArray.length||e<0?NaN:this.customTimeRangeArray[e].start},end:function(e){return Q(e),e>=this.customTimeRangeArray.length||e<0?NaN:this.customTimeRangeArray[e].end}}}$.__dashjs_factory_name="CustomTimeRanges";var Z=R.getClassFactory($),J=T((function(e,t){!function(e){e.ns_tt="http://www.w3.org/ns/ttml",e.ns_tts="http://www.w3.org/ns/ttml#styling",e.ns_ttp="http://www.w3.org/ns/ttml#parameter",e.ns_xml="http://www.w3.org/XML/1998/namespace",e.ns_itts="http://www.w3.org/ns/ttml/profile/imsc1#styling",e.ns_ittp="http://www.w3.org/ns/ttml/profile/imsc1#parameter",e.ns_smpte="http://www.smpte-ra.org/schemas/2052-1/2010/smpte-tt",e.ns_ebutts="urn:ebu:tt:style"}(t)})),ee=T((function(e,t){!function(e){var t=/#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})?/,n=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/,r=/rgba\(\s*(\d+),\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/,i={transparent:[0,0,0,0],black:[0,0,0,255],silver:[192,192,192,255],gray:[128,128,128,255],white:[255,255,255,255],maroon:[128,0,0,255],red:[255,0,0,255],purple:[128,0,128,255],fuchsia:[255,0,255,255],magenta:[255,0,255,255],green:[0,128,0,255],lime:[0,255,0,255],olive:[128,128,0,255],yellow:[255,255,0,255],navy:[0,0,128,255],blue:[0,0,255,255],teal:[0,128,128,255],aqua:[0,255,255,255],cyan:[0,255,255,255]};e.parseColor=function(e){var s,a=null,o=i[e.toLowerCase()];return void 0!==o?a=o:null!==(s=t.exec(e))?a=[parseInt(s[1],16),parseInt(s[2],16),parseInt(s[3],16),void 0!==s[4]?parseInt(s[4],16):255]:null!==(s=n.exec(e))?a=[parseInt(s[1]),parseInt(s[2]),parseInt(s[3]),255]:null!==(s=r.exec(e))&&(a=[parseInt(s[1]),parseInt(s[2]),parseInt(s[3]),parseInt(s[4])]),a};var s=/^((?:\+|\-)?\d*(?:\.\d+)?)(px|em|c|%|rh|rw)$/;e.parseLength=function(e){var t,n=null;return null!==(t=s.exec(e))&&(n={value:parseFloat(t[1]),unit:t[2]}),n},e.parseTextShadow=function(t){var n=t.split(","),r=[];for(var i in n){var s=n[i].split(" ");if(1===s.length&&"none"===s[0])return"none";if(s.length>1&&s.length<5){var a=[null,null,null,null],o=e.parseLength(s.shift());if(null===o)return null;if(a[0]=o,null===(o=e.parseLength(s.shift())))return null;if(a[1]=o,0===s.length){r.push(a);continue}if(null!==(o=e.parseLength(s[0]))&&(a[2]=o,s.shift()),0===s.length){r.push(a);continue}var l=e.parseColor(s[0]);if(null===l)return null;a[3]=l,r.push(a)}}return r},e.parsePosition=function(t){var n=t.split(" "),r=function(e){return"center"===e||"left"===e||"top"===e||"bottom"===e||"right"===e};if(n.length>4)return null;for(var i in n)if(!r(n[i])){var s=e.parseLength(n[i]);if(null===s)return null;n[i]=s}for(var a={h:{edge:"left",offset:{value:50,unit:"%"}},v:{edge:"top",offset:{value:50,unit:"%"}}},o=0;o<n.length;){var l=n[o++];if(r(l)){var u={value:0,unit:"%"};2!==n.length&&o<n.length&&!r(n[o])&&(u=n[o++]),"right"===l?(a.h.edge=l,a.h.offset=u):"bottom"===l?(a.v.edge=l,a.v.offset=u):"left"===l?a.h.offset=u:"top"===l&&(a.v.offset=u)}else{if(1!==n.length&&2!==n.length)return null;1===o?a.h.offset=l:a.v.offset=l}}return a},e.ComputedLength=function(e,t){this.rw=e,this.rh=t},e.ComputedLength.prototype.toUsedLength=function(e,t){return e*this.rw+t*this.rh},e.ComputedLength.prototype.isZero=function(){return 0===this.rw&&0===this.rh},e.toComputedLength=function(t,n,r,i,s,a){return"%"===n&&i?new e.ComputedLength(i.rw*t/100,i.rh*t/100):"em"===n&&r?new e.ComputedLength(r.rw*t,r.rh*t):"c"===n&&s?new e.ComputedLength(t*s.rw,t*s.rh):"px"===n&&a?new e.ComputedLength(t*a.rw,t*a.rh):"rh"===n?new e.ComputedLength(0,t/100):"rw"===n?new e.ComputedLength(t/100,0):null}}(t)})),te=T((function(e,t){!function(e,t,n){function r(e,t,n,r,i,s,a,o){this.name=t,this.ns=e,this.qname=e+" "+t,this.inherit=i,this.animatable=s,this.initial=n,this.applies=r,this.parse=a,this.compute=o}for(var i in e.all=[new r(t.ns_tts,"backgroundColor","transparent",["body","div","p","region","span"],!1,!0,n.parseColor,null),new r(t.ns_tts,"color","white",["span"],!0,!0,n.parseColor,null),new r(t.ns_tts,"direction","ltr",["p","span"],!0,!0,(function(e){return e}),null),new r(t.ns_tts,"display","auto",["body","div","p","region","span"],!1,!0,(function(e){return e}),null),new r(t.ns_tts,"displayAlign","before",["region"],!1,!0,(function(e){return e}),null),new r(t.ns_tts,"extent","auto",["tt","region"],!1,!0,(function(e){if("auto"===e)return e;var t=e.split(" ");if(2!==t.length)return null;var r=n.parseLength(t[0]),i=n.parseLength(t[1]);return i&&r?{h:i,w:r}:null}),(function(e,t,r,i,s){var a,o;if("auto"===i)a=new n.ComputedLength(0,1);else if(null===(a=n.toComputedLength(i.h.value,i.h.unit,null,e.dimensions.h,null,e.pxLength.h)))return null;if("auto"===i)o=new n.ComputedLength(1,0);else if(null===(o=n.toComputedLength(i.w.value,i.w.unit,null,e.dimensions.w,null,e.pxLength.w)))return null;return{h:a,w:o}})),new r(t.ns_tts,"fontFamily","default",["span","p"],!0,!0,(function(e){var t=e.split(","),n=[];for(var r in t)"'"!==t[r].charAt(0)&&'"'!==t[r].charAt(0)&&"default"===t[r]?n.push("monospaceSerif"):n.push(t[r]);return n}),null),new r(t.ns_tts,"shear","0%",["p"],!0,!0,n.parseLength,(function(e,t,n,r){return"%"!==r.unit?null:Math.abs(r.value)>100?100*Math.sign(r.value):r.value})),new r(t.ns_tts,"fontSize","1c",["span","p"],!0,!0,n.parseLength,(function(t,r,i,s,a){return n.toComputedLength(s.value,s.unit,null!==r?r.styleAttrs[e.byName.fontSize.qname]:t.cellLength.h,null!==r?r.styleAttrs[e.byName.fontSize.qname]:t.cellLength.h,t.cellLength.h,t.pxLength.h)})),new r(t.ns_tts,"fontStyle","normal",["span","p"],!0,!0,(function(e){return e}),null),new r(t.ns_tts,"fontWeight","normal",["span","p"],!0,!0,(function(e){return e}),null),new r(t.ns_tts,"lineHeight","normal",["p"],!0,!0,(function(e){return"normal"===e?e:n.parseLength(e)}),(function(t,r,i,s,a){var o;if("normal"===s)o=s;else if(null===(o=n.toComputedLength(s.value,s.unit,i.styleAttrs[e.byName.fontSize.qname],i.styleAttrs[e.byName.fontSize.qname],t.cellLength.h,t.pxLength.h)))return null;return o})),new r(t.ns_tts,"opacity",1,["region"],!1,!0,parseFloat,null),new r(t.ns_tts,"origin","auto",["region"],!1,!0,(function(e){if("auto"===e)return e;var t=e.split(" ");if(2!==t.length)return null;var r=n.parseLength(t[0]),i=n.parseLength(t[1]);return i&&r?{h:i,w:r}:null}),(function(e,t,r,i,s){var a,o;if("auto"===i)a=new n.ComputedLength(0,0);else if(null===(a=n.toComputedLength(i.h.value,i.h.unit,null,e.dimensions.h,null,e.pxLength.h)))return null;if("auto"===i)o=new n.ComputedLength(0,0);else if(null===(o=n.toComputedLength(i.w.value,i.w.unit,null,e.dimensions.w,null,e.pxLength.w)))return null;return{h:a,w:o}})),new r(t.ns_tts,"overflow","hidden",["region"],!1,!0,(function(e){return e}),null),new r(t.ns_tts,"padding","0px",["region"],!1,!0,(function(e){var t=e.split(" ");if(t.length>4)return null;var r=[];for(var i in t){var s=n.parseLength(t[i]);if(!s)return null;r.push(s)}return r}),(function(t,r,i,s,a){var o;if(1===s.length)o=[s[0],s[0],s[0],s[0]];else if(2===s.length)o=[s[0],s[1],s[0],s[1]];else if(3===s.length)o=[s[0],s[1],s[2],s[1]];else{if(4!==s.length)return null;o=[s[0],s[1],s[2],s[3]]}var l=i.styleAttrs[e.byName.writingMode.qname];if("lrtb"===l||"lr"===l)o=[o[0],o[3],o[2],o[1]];else if("rltb"===l||"rl"===l)o=[o[0],o[1],o[2],o[3]];else if("tblr"===l)o=[o[3],o[0],o[1],o[2]];else{if("tbrl"!==l&&"tb"!==l)return null;o=[o[3],o[2],o[1],o[0]]}var u=[];for(var c in o)if(0===o[c].value)u[c]=new n.ComputedLength(0,0);else if(u[c]=n.toComputedLength(o[c].value,o[c].unit,i.styleAttrs[e.byName.fontSize.qname],"0"===c||"2"===c?i.styleAttrs[e.byName.extent.qname].h:i.styleAttrs[e.byName.extent.qname].w,"0"===c||"2"===c?t.cellLength.h:t.cellLength.w,"0"===c||"2"===c?t.pxLength.h:t.pxLength.w),null===u[c])return null;return u})),new r(t.ns_tts,"position","top left",["region"],!1,!0,(function(e){return n.parsePosition(e)}),(function(t,r,i,s){var a,o;return null===(a=n.toComputedLength(s.v.offset.value,s.v.offset.unit,null,new n.ComputedLength(-i.styleAttrs[e.byName.extent.qname].h.rw,t.dimensions.h.rh-i.styleAttrs[e.byName.extent.qname].h.rh),null,t.pxLength.h))?null:("bottom"===s.v.edge&&(a=new n.ComputedLength(-a.rw-i.styleAttrs[e.byName.extent.qname].h.rw,t.dimensions.h.rh-a.rh-i.styleAttrs[e.byName.extent.qname].h.rh)),o=n.toComputedLength(s.h.offset.value,s.h.offset.unit,null,new n.ComputedLength(t.dimensions.w.rw-i.styleAttrs[e.byName.extent.qname].w.rw,-i.styleAttrs[e.byName.extent.qname].w.rh),null,t.pxLength.w),null===a?null:("right"===s.h.edge&&(o=new n.ComputedLength(t.dimensions.w.rw-o.rw-i.styleAttrs[e.byName.extent.qname].w.rw,-o.rh-i.styleAttrs[e.byName.extent.qname].w.rh)),{h:a,w:o}))})),new r(t.ns_tts,"ruby","none",["span"],!1,!0,(function(e){return e}),null),new r(t.ns_tts,"rubyAlign","center",["span"],!0,!0,(function(e){return"center"!==e&&"spaceAround"!==e?null:e}),null),new r(t.ns_tts,"rubyPosition","outside",["span"],!0,!0,(function(e){return e}),null),new r(t.ns_tts,"rubyReserve","none",["p"],!0,!0,(function(e){var t=e.split(" "),r=[null,null];if(0===t.length||t.length>2)return null;if("none"!==t[0]&&"both"!==t[0]&&"after"!==t[0]&&"before"!==t[0]&&"outside"!==t[0])return null;if(r[0]=t[0],2===t.length&&"none"!==t[0]){var i=n.parseLength(t[1]);if(!i)return null;r[1]=i}return r}),(function(t,r,i,s,a){if("none"===s[0])return s;var o=null;return null===(o=null===s[1]?new n.ComputedLength(.5*i.styleAttrs[e.byName.fontSize.qname].rw,.5*i.styleAttrs[e.byName.fontSize.qname].rh):n.toComputedLength(s[1].value,s[1].unit,i.styleAttrs[e.byName.fontSize.qname],i.styleAttrs[e.byName.fontSize.qname],t.cellLength.h,t.pxLength.h))?null:[s[0],o]})),new r(t.ns_tts,"showBackground","always",["region"],!1,!0,(function(e){return e}),null),new r(t.ns_tts,"textAlign","start",["p"],!0,!0,(function(e){return e}),(function(e,t,n,r,i){return"left"===r?"start":"right"===r?"end":r})),new r(t.ns_tts,"textCombine","none",["span"],!0,!0,(function(e){return"none"===e||"all"===e?e:null}),null),new r(t.ns_tts,"textDecoration","none",["span"],!0,!0,(function(e){return e.split(" ")}),null),new r(t.ns_tts,"textEmphasis","none",["span"],!0,!0,(function(e){var t=e.split(" "),r={style:null,symbol:null,color:null,position:null};for(var i in t)if("none"===t[i]||"auto"===t[i])r.style=t[i];else if("filled"===t[i]||"open"===t[i])r.style=t[i];else if("circle"===t[i]||"dot"===t[i]||"sesame"===t[i])r.symbol=t[i];else if("current"===t[i])r.color=t[i];else if("outside"===t[i]||"before"===t[i]||"after"===t[i])r.position=t[i];else if(r.color=n.parseColor(t[i]),null===r.color)return null;return null==r.style&&null==r.symbol?r.style="auto":(r.symbol=r.symbol||"circle",r.style=r.style||"filled"),r.position=r.position||"outside",r.color=r.color||"current",r}),null),new r(t.ns_tts,"textOutline","none",["span"],!0,!0,(function(e){if("none"===e)return e;var t={},r=e.split(" ");if(0===r.length||r.length>2)return null;var i=n.parseColor(r[0]);if(t.color=i,null!==i&&r.shift(),1!==r.length)return null;var s=n.parseLength(r[0]);return s?(t.thickness=s,t):null}),(function(t,r,i,s,a){if("none"===s)return s;var o={};return null===s.color?o.color=i.styleAttrs[e.byName.color.qname]:o.color=s.color,o.thickness=n.toComputedLength(s.thickness.value,s.thickness.unit,i.styleAttrs[e.byName.fontSize.qname],i.styleAttrs[e.byName.fontSize.qname],t.cellLength.h,t.pxLength.h),null===o.thickness?null:o})),new r(t.ns_tts,"textShadow","none",["span"],!0,!0,n.parseTextShadow,(function(t,r,i,s){if("none"===s)return s;var a=[];for(var o in s){var l={};if(l.x_off=n.toComputedLength(s[o][0].value,s[o][0].unit,null,i.styleAttrs[e.byName.fontSize.qname],null,t.pxLength.w),null===l.x_off)return null;if(l.y_off=n.toComputedLength(s[o][1].value,s[o][1].unit,null,i.styleAttrs[e.byName.fontSize.qname],null,t.pxLength.h),null===l.y_off)return null;if(null===s[o][2])l.b_radius=0;else if(l.b_radius=n.toComputedLength(s[o][2].value,s[o][2].unit,null,i.styleAttrs[e.byName.fontSize.qname],null,t.pxLength.h),null===l.b_radius)return null;null===s[o][3]?l.color=i.styleAttrs[e.byName.color.qname]:l.color=s[o][3],a.push(l)}return a})),new r(t.ns_tts,"unicodeBidi","normal",["span","p"],!1,!0,(function(e){return e}),null),new r(t.ns_tts,"visibility","visible",["body","div","p","region","span"],!0,!0,(function(e){return e}),null),new r(t.ns_tts,"wrapOption","wrap",["span"],!0,!0,(function(e){return e}),null),new r(t.ns_tts,"writingMode","lrtb",["region"],!1,!0,(function(e){return e}),null),new r(t.ns_tts,"zIndex","auto",["region"],!1,!0,(function(e){var t;return"auto"===e?t=e:(t=parseInt(e),isNaN(t)&&(t=null)),t}),null),new r(t.ns_ebutts,"linePadding","0c",["p"],!0,!1,n.parseLength,(function(e,t,r,i,s){return n.toComputedLength(i.value,i.unit,null,null,e.cellLength.w,null)})),new r(t.ns_ebutts,"multiRowAlign","auto",["p"],!0,!1,(function(e){return e}),null),new r(t.ns_smpte,"backgroundImage",null,["div"],!1,!1,(function(e){return e}),null),new r(t.ns_itts,"forcedDisplay","false",["body","div","p","region","span"],!0,!0,(function(e){return"true"===e}),null),new r(t.ns_itts,"fillLineGap","false",["p"],!0,!0,(function(e){return"true"===e}),null)],e.byQName={},e.all)e.byQName[e.all[i].qname]=e.all[i];for(var s in e.byName={},e.all)e.byName[e.all[s].name]=e.all[s]}(t,"undefined"==typeof imscNames?J:imscNames,"undefined"==typeof imscUtils?ee:imscUtils)})),ne=T((function(e,t){!function(e,t,n,r){e.generateISD=function(e,t,n){var r=new a(e),i={};for(var o in e.head.layout.regions){var l=s(e,t,e.head.layout.regions[o],e.body,null,"",e.head.layout.regions[o],n,i);null!==l&&r.contents.push(l.element)}return r};var i=[n.byName.color.qname,n.byName.textCombine.qname,n.byName.textDecoration.qname,n.byName.textEmphasis.qname,n.byName.textOutline.qname,n.byName.textShadow.qname];function s(e,t,a,u,c,d,f,g,h){if(t<f.begin||t>=f.end)return null;var p="regionID"in f&&""!==f.regionID?f.regionID:d;if(null!==c&&p!==a.id&&(!("contents"in f)||"contents"in f&&0===f.contents.length||""!==p))return null;var m=new o(f);for(var E in f.sets)t<f.sets[E].begin||t>=f.sets[E].end||(m.styleAttrs[f.sets[E].qname]=f.sets[E].value);var _,T={};for(var y in m.styleAttrs)if(T[y]=!0,"region"===m.kind&&y===n.byName.writingMode.qname&&!(n.byName.direction.qname in m.styleAttrs)){var A=m.styleAttrs[y];"lrtb"===A||"lr"===A?m.styleAttrs[n.byName.direction.qname]="ltr":"rltb"!==A&&"rl"!==A||(m.styleAttrs[n.byName.direction.qname]="rtl")}if(null!==c)for(var S in n.all){var I=n.all[S];if(I.qname===n.byName.textDecoration.qname){var R=c.styleAttrs[I.qname],N=m.styleAttrs[I.qname],D=[];void 0===N?D=R:-1===N.indexOf("none")?((-1===N.indexOf("noUnderline")&&-1!==R.indexOf("underline")||-1!==N.indexOf("underline"))&&D.push("underline"),(-1===N.indexOf("noLineThrough")&&-1!==R.indexOf("lineThrough")||-1!==N.indexOf("lineThrough"))&&D.push("lineThrough"),(-1===N.indexOf("noOverline")&&-1!==R.indexOf("overline")||-1!==N.indexOf("overline"))&&D.push("overline")):D.push("none"),m.styleAttrs[I.qname]=D}else if(I.qname!==n.byName.fontSize.qname||I.qname in m.styleAttrs||"span"!==m.kind||"textContainer"!==m.styleAttrs[n.byName.ruby.qname])if(I.qname!==n.byName.fontSize.qname||I.qname in m.styleAttrs||"span"!==m.kind||"text"!==m.styleAttrs[n.byName.ruby.qname])I.inherit&&I.qname in c.styleAttrs&&!(I.qname in m.styleAttrs)&&(m.styleAttrs[I.qname]=c.styleAttrs[I.qname]);else{var C=c.styleAttrs[n.byName.fontSize.qname];"textContainer"===c.styleAttrs[n.byName.ruby.qname]?m.styleAttrs[I.qname]=C:m.styleAttrs[I.qname]=new r.ComputedLength(.5*C.rw,.5*C.rh)}else{var b=c.styleAttrs[n.byName.fontSize.qname];m.styleAttrs[I.qname]=new r.ComputedLength(.5*b.rw,.5*b.rh)}}for(var v in n.all){var M=n.all[v];if(!(M.qname in m.styleAttrs)&&!(M.qname===n.byName.position.qname&&n.byName.origin.qname in m.styleAttrs||M.qname===n.byName.origin.qname&&n.byName.position.qname in m.styleAttrs)){var O=e.head.styling.initials[M.qname]||M.initial;if(null!==O&&("region"===m.kind||!1===M.inherit&&null!==O)){var w=M.parse(O);null!==w?(m.styleAttrs[M.qname]=w,T[M.qname]=!0):l(g,"Invalid initial value for '"+M.qname+"' on element '"+m.kind)}}}for(var L in n.all){var P=n.all[L];if(P.qname in T&&null!==P.compute){var F=P.compute(e,c,m,m.styleAttrs[P.qname],h);null!==F?m.styleAttrs[P.qname]=F:(m.styleAttrs[P.qname]=P.compute(e,c,m,P.parse(P.initial),h),l(g,"Style '"+P.qname+"' on element '"+m.kind+"' cannot be computed"))}}if("none"===m.styleAttrs[n.byName.display.qname])return null;for(var x in null===c?_=null===u?[]:[u]:"contents"in f&&(_=f.contents),_){var U=s(e,t,a,u,m,p,_[x],g,h);null!==U&&m.contents.push(U.element)}for(var B in m.styleAttrs){var k=!1;if("span"===m.kind){var G=m.styleAttrs[n.byName.ruby.qname];(k=("container"===G||"textContainer"===G||"baseContainer"===G)&&-1!==i.indexOf(B))||(k="container"!==G&&B===n.byName.rubyAlign.qname),k||(k=!("textContainer"===G||"text"===G)&&B===n.byName.rubyPosition.qname)}if(!k)k=-1===n.byQName[B].applies.indexOf(m.kind);k&&delete m.styleAttrs[B]}var Y=m.styleAttrs[n.byName.ruby.qname];if("p"===m.kind||"span"===m.kind&&("textContainer"===Y||"text"===Y)){var K=[];!function e(t,r){for(var i in t.contents){var s=t.contents[i],a=s.styleAttrs[n.byName.ruby.qname];("span"!==s.kind||"textContainer"!==a&&"text"!==a)&&("contents"in s?e(s,r):("span"===s.kind&&0!==s.text.length||"br"===s.kind)&&r.push(s))}}(m,K),function(e){for(var t,n=0;n<e.length;)if("br"!==(t=e[n]).kind&&"preserve"!==t.space){var r=t.text.replace(/[\t\r\n ]+/g," ");/^[ ]/.test(r)&&(0===n||("br"===(i=e[n-1]).kind||/[\r\n\t ]$/.test(i.text)))&&(r=r.substring(1)),t.text=r,0===r.length?e.splice(n,1):n++}else n++;var i;for(n=0;n<e.length;n++)"br"!==(t=e[n]).kind&&"preserve"!==t.space?/[ ]$/.test(t.text)&&(n===e.length-1||("br"===(s=e[n+1]).kind||"preserve"===s.space&&/^[\r\n]/.test(s.text)))&&(t.text=t.text.slice(0,-1)):n++;var s}(K),function e(t){if("br"===t.kind)return!1;if("text"in t)return 0===t.text.length;if("contents"in t){for(var n=t.contents.length;n--;)e(t.contents[n])&&t.contents.splice(n,1);return 0===t.contents.length}}(m)}return"div"===m.kind&&n.byName.backgroundImage.qname in m.styleAttrs||"br"===m.kind||"image"===m.kind||"contents"in m&&m.contents.length>0||"span"===m.kind&&null!==m.text||"region"===m.kind&&"always"===m.styleAttrs[n.byName.showBackground.qname]?{region_id:p,element:m}:null}function a(e){this.contents=[],this.aspectRatio=e.aspectRatio,this.lang=e.lang}function o(e){for(var t in this.kind=e.kind||"region",this.lang=e.lang,e.id&&(this.id=e.id),this.styleAttrs={},e.styleAttrs)this.styleAttrs[t]=e.styleAttrs[t];"src"in e&&(this.src=e.src),"type"in e&&(this.type=e.type),"text"in e?this.text=e.text:("region"===this.kind||"contents"in e)&&(this.contents=[]),"space"in e&&(this.space=e.space)}function l(e,t){if(e&&e.error&&e.error(t))throw t}}(t,"undefined"==typeof imscNames||imscNames,"undefined"==typeof imscStyles?te:imscStyles,"undefined"==typeof imscUtils?ee:imscUtils)})),re=T((function(e,t){!function(e){e.parser=function(e,t){return new s(e,t)},e.SAXParser=s,e.SAXStream=o,e.createStream=function(e,t){return new o(e,t)},e.MAX_BUFFER_LENGTH=65536;var t,n=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];function s(t,r){if(!(this instanceof s))return new s(t,r);!function(e){for(var t=0,r=n.length;t<r;t++)e[n[t]]=""}(this),this.q=this.c="",this.bufferCheckPosition=e.MAX_BUFFER_LENGTH,this.opt=r||{},this.opt.lowercase=this.opt.lowercase||this.opt.lowercasetags,this.looseCase=this.opt.lowercase?"toLowerCase":"toUpperCase",this.tags=[],this.closed=this.closedRoot=this.sawRoot=!1,this.tag=this.error=null,this.strict=!!t,this.noscript=!(!t&&!this.opt.noscript),this.state=N.BEGIN,this.strictEntities=this.opt.strictEntities,this.ENTITIES=this.strictEntities?Object.create(e.XML_ENTITIES):Object.create(e.ENTITIES),this.attribList=[],this.opt.xmlns&&(this.ns=Object.create(h)),this.trackPosition=!1!==this.opt.position,this.trackPosition&&(this.position=this.line=this.column=0),C(this,"onready")}e.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"],Object.create||(Object.create=function(e){function t(){}return t.prototype=e,new t}),Object.keys||(Object.keys=function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t}),s.prototype={end:function(){w(this)},write:function(t){if(this.error)throw this.error;if(this.closed)return O(this,"Cannot write after close. Assign an onready handler.");if(null===t)return w(this);"object"==typeof t&&(t=t.toString());var r=0,i="";for(;i=Y(t,r++),this.c=i,i;)switch(this.trackPosition&&(this.position++,"\n"===i?(this.line++,this.column=0):this.column++),this.state){case N.BEGIN:if(this.state=N.BEGIN_WHITESPACE,"\ufeff"===i)continue;G(this,i);continue;case N.BEGIN_WHITESPACE:G(this,i);continue;case N.TEXT:if(this.sawRoot&&!this.closedRoot){for(var s=r-1;i&&"<"!==i&&"&"!==i;)(i=Y(t,r++))&&this.trackPosition&&(this.position++,"\n"===i?(this.line++,this.column=0):this.column++);this.textNode+=t.substring(s,r-1)}"<"!==i||this.sawRoot&&this.closedRoot&&!this.strict?(!A(l,i)||this.sawRoot&&!this.closedRoot||L(this,"Text data outside of root node."),"&"===i?this.state=N.TEXT_ENTITY:this.textNode+=i):(this.state=N.OPEN_WAKA,this.startTagPosition=this.position);continue;case N.SCRIPT:"<"===i?this.state=N.SCRIPT_ENDING:this.script+=i;continue;case N.SCRIPT_ENDING:"/"===i?this.state=N.CLOSE_TAG:(this.script+="<"+i,this.state=N.SCRIPT);continue;case N.OPEN_WAKA:if("!"===i)this.state=N.SGML_DECL,this.sgmlDecl="";else if(y(l,i));else if(y(p,i))this.state=N.OPEN_TAG,this.tagName=i;else if("/"===i)this.state=N.CLOSE_TAG,this.tagName="";else if("?"===i)this.state=N.PROC_INST,this.procInstName=this.procInstBody="";else{if(L(this,"Unencoded <"),this.startTagPosition+1<this.position){var a=this.position-this.startTagPosition;i=new Array(a).join(" ")+i}this.textNode+="<"+i,this.state=N.TEXT}continue;case N.SGML_DECL:"[CDATA["===(this.sgmlDecl+i).toUpperCase()?(b(this,"onopencdata"),this.state=N.CDATA,this.sgmlDecl="",this.cdata=""):this.sgmlDecl+i==="--"?(this.state=N.COMMENT,this.comment="",this.sgmlDecl=""):"DOCTYPE"===(this.sgmlDecl+i).toUpperCase()?(this.state=N.DOCTYPE,(this.doctype||this.sawRoot)&&L(this,"Inappropriately located doctype declaration"),this.doctype="",this.sgmlDecl=""):">"===i?(b(this,"onsgmldeclaration",this.sgmlDecl),this.sgmlDecl="",this.state=N.TEXT):y(d,i)?(this.state=N.SGML_DECL_QUOTED,this.sgmlDecl+=i):this.sgmlDecl+=i;continue;case N.SGML_DECL_QUOTED:i===this.q&&(this.state=N.SGML_DECL,this.q=""),this.sgmlDecl+=i;continue;case N.DOCTYPE:">"===i?(this.state=N.TEXT,b(this,"ondoctype",this.doctype),this.doctype=!0):(this.doctype+=i,"["===i?this.state=N.DOCTYPE_DTD:y(d,i)&&(this.state=N.DOCTYPE_QUOTED,this.q=i));continue;case N.DOCTYPE_QUOTED:this.doctype+=i,i===this.q&&(this.q="",this.state=N.DOCTYPE);continue;case N.DOCTYPE_DTD:this.doctype+=i,"]"===i?this.state=N.DOCTYPE:y(d,i)&&(this.state=N.DOCTYPE_DTD_QUOTED,this.q=i);continue;case N.DOCTYPE_DTD_QUOTED:this.doctype+=i,i===this.q&&(this.state=N.DOCTYPE_DTD,this.q="");continue;case N.COMMENT:"-"===i?this.state=N.COMMENT_ENDING:this.comment+=i;continue;case N.COMMENT_ENDING:"-"===i?(this.state=N.COMMENT_ENDED,this.comment=M(this.opt,this.comment),this.comment&&b(this,"oncomment",this.comment),this.comment=""):(this.comment+="-"+i,this.state=N.COMMENT);continue;case N.COMMENT_ENDED:">"!==i?(L(this,"Malformed comment"),this.comment+="--"+i,this.state=N.COMMENT):this.state=N.TEXT;continue;case N.CDATA:"]"===i?this.state=N.CDATA_ENDING:this.cdata+=i;continue;case N.CDATA_ENDING:"]"===i?this.state=N.CDATA_ENDING_2:(this.cdata+="]"+i,this.state=N.CDATA);continue;case N.CDATA_ENDING_2:">"===i?(this.cdata&&b(this,"oncdata",this.cdata),b(this,"onclosecdata"),this.cdata="",this.state=N.TEXT):"]"===i?this.cdata+="]":(this.cdata+="]]"+i,this.state=N.CDATA);continue;case N.PROC_INST:"?"===i?this.state=N.PROC_INST_ENDING:y(l,i)?this.state=N.PROC_INST_BODY:this.procInstName+=i;continue;case N.PROC_INST_BODY:if(!this.procInstBody&&y(l,i))continue;"?"===i?this.state=N.PROC_INST_ENDING:this.procInstBody+=i;continue;case N.PROC_INST_ENDING:">"===i?(b(this,"onprocessinginstruction",{name:this.procInstName,body:this.procInstBody}),this.procInstName=this.procInstBody="",this.state=N.TEXT):(this.procInstBody+="?"+i,this.state=N.PROC_INST_BODY);continue;case N.OPEN_TAG:y(m,i)?this.tagName+=i:(P(this),">"===i?U(this):"/"===i?this.state=N.OPEN_TAG_SLASH:(A(l,i)&&L(this,"Invalid character in tag name"),this.state=N.ATTRIB));continue;case N.OPEN_TAG_SLASH:">"===i?(U(this,!0),B(this)):(L(this,"Forward-slash in opening tag not followed by >"),this.state=N.ATTRIB);continue;case N.ATTRIB:if(y(l,i))continue;">"===i?U(this):"/"===i?this.state=N.OPEN_TAG_SLASH:y(p,i)?(this.attribName=i,this.attribValue="",this.state=N.ATTRIB_NAME):L(this,"Invalid attribute name");continue;case N.ATTRIB_NAME:"="===i?this.state=N.ATTRIB_VALUE:">"===i?(L(this,"Attribute without value"),this.attribValue=this.attribName,x(this),U(this)):y(l,i)?this.state=N.ATTRIB_NAME_SAW_WHITE:y(m,i)?this.attribName+=i:L(this,"Invalid attribute name");continue;case N.ATTRIB_NAME_SAW_WHITE:if("="===i)this.state=N.ATTRIB_VALUE;else{if(y(l,i))continue;L(this,"Attribute without value"),this.tag.attributes[this.attribName]="",this.attribValue="",b(this,"onattribute",{name:this.attribName,value:""}),this.attribName="",">"===i?U(this):y(p,i)?(this.attribName=i,this.state=N.ATTRIB_NAME):(L(this,"Invalid attribute name"),this.state=N.ATTRIB)}continue;case N.ATTRIB_VALUE:if(y(l,i))continue;y(d,i)?(this.q=i,this.state=N.ATTRIB_VALUE_QUOTED):(L(this,"Unquoted attribute value"),this.state=N.ATTRIB_VALUE_UNQUOTED,this.attribValue=i);continue;case N.ATTRIB_VALUE_QUOTED:if(i!==this.q){"&"===i?this.state=N.ATTRIB_VALUE_ENTITY_Q:this.attribValue+=i;continue}x(this),this.q="",this.state=N.ATTRIB_VALUE_CLOSED;continue;case N.ATTRIB_VALUE_CLOSED:y(l,i)?this.state=N.ATTRIB:">"===i?U(this):"/"===i?this.state=N.OPEN_TAG_SLASH:y(p,i)?(L(this,"No whitespace between attributes"),this.attribName=i,this.attribValue="",this.state=N.ATTRIB_NAME):L(this,"Invalid attribute name");continue;case N.ATTRIB_VALUE_UNQUOTED:if(A(f,i)){"&"===i?this.state=N.ATTRIB_VALUE_ENTITY_U:this.attribValue+=i;continue}x(this),">"===i?U(this):this.state=N.ATTRIB;continue;case N.CLOSE_TAG:if(this.tagName)">"===i?B(this):y(m,i)?this.tagName+=i:this.script?(this.script+="</"+this.tagName,this.tagName="",this.state=N.SCRIPT):(A(l,i)&&L(this,"Invalid tagname in closing tag"),this.state=N.CLOSE_TAG_SAW_WHITE);else{if(y(l,i))continue;A(p,i)?this.script?(this.script+="</"+i,this.state=N.SCRIPT):L(this,"Invalid tagname in closing tag."):this.tagName=i}continue;case N.CLOSE_TAG_SAW_WHITE:if(y(l,i))continue;">"===i?B(this):L(this,"Invalid characters in closing tag");continue;case N.TEXT_ENTITY:case N.ATTRIB_VALUE_ENTITY_Q:case N.ATTRIB_VALUE_ENTITY_U:var o,u;switch(this.state){case N.TEXT_ENTITY:o=N.TEXT,u="textNode";break;case N.ATTRIB_VALUE_ENTITY_Q:o=N.ATTRIB_VALUE_QUOTED,u="attribValue";break;case N.ATTRIB_VALUE_ENTITY_U:o=N.ATTRIB_VALUE_UNQUOTED,u="attribValue"}";"===i?(this[u]+=k(this),this.entity="",this.state=o):y(this.entity.length?_:E,i)?this.entity+=i:(L(this,"Invalid character in entity name"),this[u]+="&"+this.entity+i,this.entity="",this.state=o);continue;default:throw new Error(this,"Unknown state: "+this.state)}this.position>=this.bufferCheckPosition&&function(t){for(var r=Math.max(e.MAX_BUFFER_LENGTH,10),i=0,s=0,a=n.length;s<a;s++){var o=t[n[s]].length;if(o>r)switch(n[s]){case"textNode":v(t);break;case"cdata":b(t,"oncdata",t.cdata),t.cdata="";break;case"script":b(t,"onscript",t.script),t.script="";break;default:O(t,"Max buffer length exceeded: "+n[s])}i=Math.max(i,o)}var l=e.MAX_BUFFER_LENGTH-i;t.bufferCheckPosition=l+t.position}(this);return this}
18
- /*! http://mths.be/fromcodepoint v0.1.0 by @mathias */,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){var e;v(e=this),""!==e.cdata&&(b(e,"oncdata",e.cdata),e.cdata=""),""!==e.script&&(b(e,"onscript",e.script),e.script="")}};try{t=r.default.Stream}catch(e){t=function(){}}var a=e.EVENTS.filter((function(e){return"error"!==e&&"end"!==e}));function o(e,n){if(!(this instanceof o))return new o(e,n);t.apply(this),this._parser=new s(e,n),this.writable=!0,this.readable=!0;var r=this;this._parser.onend=function(){r.emit("end")},this._parser.onerror=function(e){r.emit("error",e),r._parser.error=null},this._decoder=null,a.forEach((function(e){Object.defineProperty(r,"on"+e,{get:function(){return r._parser["on"+e]},set:function(t){if(!t)return r.removeAllListeners(e),r._parser["on"+e]=t,t;r.on(e,t)},enumerable:!0,configurable:!1})}))}o.prototype=Object.create(t.prototype,{constructor:{value:o}}),o.prototype.write=function(e){if("function"==typeof Buffer&&"function"==typeof Buffer.isBuffer&&Buffer.isBuffer(e)){if(!this._decoder){var t=i.default.StringDecoder;this._decoder=new t("utf8")}e=this._decoder.write(e)}return this._parser.write(e.toString()),this.emit("data",e),!0},o.prototype.end=function(e){return e&&e.length&&this.write(e),this._parser.end(),!0},o.prototype.on=function(e,n){var r=this;return r._parser["on"+e]||-1===a.indexOf(e)||(r._parser["on"+e]=function(){var t=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);t.splice(0,0,e),r.emit.apply(r,t)}),t.prototype.on.call(r,e,n)};var l="\r\n\t ",u="0124356789",c="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",d="'\"",f=l+">",g="http://www.w3.org/XML/1998/namespace",h={xml:g,xmlns:"http://www.w3.org/2000/xmlns/"};l=T(l),u=T(u),c=T(c);var p=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,m=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/,E=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,_=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/;function T(e){return e.split("").reduce((function(e,t){return e[t]=!0,e}),{})}function y(e,t){return function(e){return"[object RegExp]"===Object.prototype.toString.call(e)}(e)?!!t.match(e):e[t]}function A(e,t){return!y(e,t)}d=T(d),f=T(f);var S,I,R,N=0;for(var D in e.STATE={BEGIN:N++,BEGIN_WHITESPACE:N++,TEXT:N++,TEXT_ENTITY:N++,OPEN_WAKA:N++,SGML_DECL:N++,SGML_DECL_QUOTED:N++,DOCTYPE:N++,DOCTYPE_QUOTED:N++,DOCTYPE_DTD:N++,DOCTYPE_DTD_QUOTED:N++,COMMENT_STARTING:N++,COMMENT:N++,COMMENT_ENDING:N++,COMMENT_ENDED:N++,CDATA:N++,CDATA_ENDING:N++,CDATA_ENDING_2:N++,PROC_INST:N++,PROC_INST_BODY:N++,PROC_INST_ENDING:N++,OPEN_TAG:N++,OPEN_TAG_SLASH:N++,ATTRIB:N++,ATTRIB_NAME:N++,ATTRIB_NAME_SAW_WHITE:N++,ATTRIB_VALUE:N++,ATTRIB_VALUE_QUOTED:N++,ATTRIB_VALUE_CLOSED:N++,ATTRIB_VALUE_UNQUOTED:N++,ATTRIB_VALUE_ENTITY_Q:N++,ATTRIB_VALUE_ENTITY_U:N++,CLOSE_TAG:N++,CLOSE_TAG_SAW_WHITE:N++,SCRIPT:N++,SCRIPT_ENDING:N++},e.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},e.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(e.ENTITIES).forEach((function(t){var n=e.ENTITIES[t],r="number"==typeof n?String.fromCharCode(n):n;e.ENTITIES[t]=r})),e.STATE)e.STATE[e.STATE[D]]=D;function C(e,t,n){e[t]&&e[t](n)}function b(e,t,n){e.textNode&&v(e),C(e,t,n)}function v(e){e.textNode=M(e.opt,e.textNode),e.textNode&&C(e,"ontext",e.textNode),e.textNode=""}function M(e,t){return e.trim&&(t=t.trim()),e.normalize&&(t=t.replace(/\s+/g," ")),t}function O(e,t){return v(e),e.trackPosition&&(t+="\nLine: "+e.line+"\nColumn: "+e.column+"\nChar: "+e.c),t=new Error(t),e.error=t,C(e,"onerror",t),e}function w(e){return e.sawRoot&&!e.closedRoot&&L(e,"Unclosed root tag"),e.state!==N.BEGIN&&e.state!==N.BEGIN_WHITESPACE&&e.state!==N.TEXT&&O(e,"Unexpected end"),v(e),e.c="",e.closed=!0,C(e,"onend"),s.call(e,e.strict,e.opt),e}function L(e,t){if("object"!=typeof e||!(e instanceof s))throw new Error("bad call to strictFail");e.strict&&O(e,t)}function P(e){e.strict||(e.tagName=e.tagName[e.looseCase]());var t=e.tags[e.tags.length-1]||e,n=e.tag={name:e.tagName,attributes:{}};e.opt.xmlns&&(n.ns=t.ns),e.attribList.length=0,b(e,"onopentagstart",n)}function F(e,t){var n=e.indexOf(":")<0?["",e]:e.split(":"),r=n[0],i=n[1];return t&&"xmlns"===e&&(r="xmlns",i=""),{prefix:r,local:i}}function x(e){if(e.strict||(e.attribName=e.attribName[e.looseCase]()),-1!==e.attribList.indexOf(e.attribName)||e.tag.attributes.hasOwnProperty(e.attribName))e.attribName=e.attribValue="";else{if(e.opt.xmlns){var t=F(e.attribName,!0),n=t.prefix,r=t.local;if("xmlns"===n)if("xml"===r&&e.attribValue!==g)L(e,"xml: prefix must be bound to "+g+"\nActual: "+e.attribValue);else if("xmlns"===r&&"http://www.w3.org/2000/xmlns/"!==e.attribValue)L(e,"xmlns: prefix must be bound to http://www.w3.org/2000/xmlns/\nActual: "+e.attribValue);else{var i=e.tag,s=e.tags[e.tags.length-1]||e;i.ns===s.ns&&(i.ns=Object.create(s.ns)),i.ns[r]=e.attribValue}e.attribList.push([e.attribName,e.attribValue])}else e.tag.attributes[e.attribName]=e.attribValue,b(e,"onattribute",{name:e.attribName,value:e.attribValue});e.attribName=e.attribValue=""}}function U(e,t){if(e.opt.xmlns){var n=e.tag,r=F(e.tagName);n.prefix=r.prefix,n.local=r.local,n.uri=n.ns[r.prefix]||"",n.prefix&&!n.uri&&(L(e,"Unbound namespace prefix: "+JSON.stringify(e.tagName)),n.uri=r.prefix);var i=e.tags[e.tags.length-1]||e;n.ns&&i.ns!==n.ns&&Object.keys(n.ns).forEach((function(t){b(e,"onopennamespace",{prefix:t,uri:n.ns[t]})}));for(var s=0,a=e.attribList.length;s<a;s++){var o=e.attribList[s],l=o[0],u=o[1],c=F(l,!0),d=c.prefix,f=c.local,g=""===d?"":n.ns[d]||"",h={name:l,value:u,prefix:d,local:f,uri:g};d&&"xmlns"!==d&&!g&&(L(e,"Unbound namespace prefix: "+JSON.stringify(d)),h.uri=d),e.tag.attributes[l]=h,b(e,"onattribute",h)}e.attribList.length=0}e.tag.isSelfClosing=!!t,e.sawRoot=!0,e.tags.push(e.tag),b(e,"onopentag",e.tag),t||(e.noscript||"script"!==e.tagName.toLowerCase()?e.state=N.TEXT:e.state=N.SCRIPT,e.tag=null,e.tagName=""),e.attribName=e.attribValue="",e.attribList.length=0}function B(e){if(!e.tagName)return L(e,"Weird empty close tag."),e.textNode+="</>",void(e.state=N.TEXT);if(e.script){if("script"!==e.tagName)return e.script+="</"+e.tagName+">",e.tagName="",void(e.state=N.SCRIPT);b(e,"onscript",e.script),e.script=""}var t=e.tags.length,n=e.tagName;e.strict||(n=n[e.looseCase]());for(var r=n;t--;){if(e.tags[t].name===r)break;L(e,"Unexpected close tag")}if(t<0)return L(e,"Unmatched closing tag: "+e.tagName),e.textNode+="</"+e.tagName+">",void(e.state=N.TEXT);e.tagName=n;for(var i=e.tags.length;i-- >t;){var s=e.tag=e.tags.pop();e.tagName=e.tag.name,b(e,"onclosetag",e.tagName);var a={};for(var o in s.ns)a[o]=s.ns[o];var l=e.tags[e.tags.length-1]||e;e.opt.xmlns&&s.ns!==l.ns&&Object.keys(s.ns).forEach((function(t){var n=s.ns[t];b(e,"onclosenamespace",{prefix:t,uri:n})}))}0===t&&(e.closedRoot=!0),e.tagName=e.attribValue=e.attribName="",e.attribList.length=0,e.state=N.TEXT}function k(e){var t,n=e.entity,r=n.toLowerCase(),i="";return e.ENTITIES[n]?e.ENTITIES[n]:e.ENTITIES[r]?e.ENTITIES[r]:("#"===(n=r).charAt(0)&&("x"===n.charAt(1)?(n=n.slice(2),i=(t=parseInt(n,16)).toString(16)):(n=n.slice(1),i=(t=parseInt(n,10)).toString(10))),n=n.replace(/^0+/,""),i.toLowerCase()!==n?(L(e,"Invalid character entity"),"&"+e.entity+";"):String.fromCodePoint(t))}function G(e,t){"<"===t?(e.state=N.OPEN_WAKA,e.startTagPosition=e.position):A(l,t)&&(L(e,"Non-whitespace before first tag."),e.textNode=t,e.state=N.TEXT)}function Y(e,t){var n="";return t<e.length&&(n=e.charAt(t)),n}N=e.STATE,String.fromCodePoint||(S=String.fromCharCode,I=Math.floor,R=function(){var e,t,n=16384,r=[],i=-1,s=arguments.length;if(!s)return"";for(var a="";++i<s;){var o=Number(arguments[i]);if(!isFinite(o)||o<0||o>1114111||I(o)!==o)throw RangeError("Invalid code point: "+o);o<=65535?r.push(o):(e=55296+((o-=65536)>>10),t=o%1024+56320,r.push(e,t)),(i+1===s||r.length>n)&&(a+=S.apply(null,r),r.length=0)}return a},Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:R,configurable:!0,writable:!0}):String.fromCodePoint=R)}(t)})),ie=T((function(e,t){!function(e,t,n,r,i){function s(e,t,n,r){var i=r&&"seq"===r.timeContainer,a=0;r&&(a=i&&n?n.end:r.begin),t.begin=t.explicit_begin?t.explicit_begin+a:a;var o=t.begin,l=null;for(var u in t.sets)s(e,t.sets[u],l,t),o="seq"===t.timeContainer?t.sets[u].end:Math.max(o,t.sets[u].end),l=t.sets[u];if("contents"in t)for(var c in t.contents)s(e,t.contents[c],l,t),o="seq"===t.timeContainer?t.contents[c].end:Math.max(o,t.contents[c].end),l=t.contents[c];else o=i?t.begin:Number.POSITIVE_INFINITY;null!==t.explicit_end&&null!==t.explicit_dur?t.end=Math.min(t.begin+t.explicit_dur,a+t.explicit_end):null===t.explicit_end&&null!==t.explicit_dur?t.end=t.begin+t.explicit_dur:null!==t.explicit_end&&null===t.explicit_dur?t.end=a+t.explicit_end:t.end=o,delete t.explicit_begin,delete t.explicit_dur,delete t.explicit_end,e._registerEvent(t)}function a(e){this.node=e}function o(){this.events=[],this.head=new l,this.body=null}function l(){this.styling=new u,this.layout=new f}function u(){this.styles={},this.initials={}}function c(){this.id=null,this.styleAttrs=null,this.styleRefs=null}function d(){this.styleAttrs=null}function f(){this.regions={}}function g(e,t){h.call(this,"image"),this.src=e,this.type=t}function h(e){this.kind=e}function p(e){this.id=e}function m(e){this.regionID=e}function E(e){this.styleAttrs=e}function _(e){this.sets=e}function T(e){this.contents=e}function y(e,t,n){this.explicit_begin=e,this.explicit_end=t,this.explicit_dur=n}function A(){h.call(this,"body")}function S(){h.call(this,"div")}function I(){h.call(this,"p")}function R(){h.call(this,"span")}function N(){h.call(this,"span")}function D(){h.call(this,"br")}function C(){}function b(){}function v(e){return e&&"xml:id"in e.attributes&&e.attributes["xml:id"].value||null}function M(e){return e&&"style"in e.attributes?e.attributes.style.value.split(" "):[]}function O(e,t){var n={};if(null!==e)for(var i in e.attributes){var s=e.attributes[i].uri+" "+e.attributes[i].local,a=r.byQName[s];if(void 0!==a){var o=a.parse(e.attributes[i].value);null!==o?(n[s]=o,a===r.byName.zIndex&&U(t,"zIndex attribute present but not used by IMSC1 since regions do not overlap")):B(t,"Cannot parse styling attribute "+s+" --\x3e "+e.attributes[i].value)}}return n}function w(e,t,n){for(var r in e.attributes)if(e.attributes[r].uri===t&&e.attributes[r].local===n)return e.attributes[r].value;return null}function L(e,t,n){var r,i=null;return null!==(r=/^(\d+(?:\.\d+)?)f$/.exec(n))?null!==t&&(i=parseFloat(r[1])/t):null!==(r=/^(\d+(?:\.\d+)?)t$/.exec(n))?null!==e&&(i=parseFloat(r[1])/e):null!==(r=/^(\d+(?:\.\d+)?)ms$/.exec(n))?i=parseFloat(r[1])/1e3:null!==(r=/^(\d+(?:\.\d+)?)s$/.exec(n))?i=parseFloat(r[1]):null!==(r=/^(\d+(?:\.\d+)?)h$/.exec(n))?i=3600*parseFloat(r[1]):null!==(r=/^(\d+(?:\.\d+)?)m$/.exec(n))?i=60*parseFloat(r[1]):null!==(r=/^(\d{2,}):(\d\d):(\d\d(?:\.\d+)?)$/.exec(n))?i=3600*parseInt(r[1])+60*parseInt(r[2])+parseFloat(r[3]):null!==(r=/^(\d{2,}):(\d\d):(\d\d)\:(\d{2,})$/.exec(n))&&null!==t&&(i=3600*parseInt(r[1])+60*parseInt(r[2])+parseInt(r[3])+(null===r[4]?0:parseInt(r[4])/t)),i}function P(e,t,n){for(;t.styleRefs.length>0;){var r=t.styleRefs.pop();r in e.styles?(P(e,e.styles[r],n),x(e.styles[r].styleAttrs,t.styleAttrs)):B(n,"Non-existant style id referenced")}}function F(e,t,n,r){for(var i=t.length-1;i>=0;i--){var s=t[i];s in e.styles?x(e.styles[s].styleAttrs,n):B(r,"Non-existant style id referenced")}}function x(e,t){for(var n in e)n in t||(t[n]=e[n])}function U(e,t){if(e&&e.warn&&e.warn(t))throw t}function B(e,t){if(e&&e.error&&e.error(t))throw t}function k(e,t){throw e&&e.fatal&&e.fatal(t),t}function G(e,t){for(var n,r=0,i=e.length-1;r<=i;){var s=e[n=Math.floor((r+i)/2)];if(s<t)r=n+1;else{if(!(s>t))return{found:!0,index:n};i=n-1}}return{found:!1,index:r}}e.fromXML=function(e,i,h){var p=t.parser(!0,{xmlns:!0}),m=[],E=[],_=[],T=0,y=null;p.onclosetag=function(e){if(m[0]instanceof C)null!==y.head&&null!==y.head.styling&&F(y.head.styling,m[0].styleRefs,m[0].styleAttrs,i),delete m[0].styleRefs;else if(m[0]instanceof u)for(var t in m[0].styles)P(m[0],m[0].styles[t],i);else if(m[0]instanceof I||m[0]instanceof R){if(m[0].contents.length>1){var r,s=[m[0].contents[0]];for(r=1;r<m[0].contents.length;r++)m[0].contents[r]instanceof N&&s[s.length-1]instanceof N?s[s.length-1].text+=m[0].contents[r].text:s.push(m[0].contents[r]);m[0].contents=s}m[0]instanceof R&&1===m[0].contents.length&&m[0].contents[0]instanceof N&&(m[0].text=m[0].contents[0].text,delete m[0].contents)}else m[0]instanceof a&&(m[0].node.uri===n.ns_tt&&"metadata"===m[0].node.local?T--:T>0&&h&&"onCloseTag"in h&&h.onCloseTag());_.shift(),E.shift(),m.shift()},p.ontext=function(e){if(void 0===m[0]);else if(m[0]instanceof R||m[0]instanceof I){if(m[0]instanceof R){var t=m[0].styleAttrs[r.byName.ruby.qname];if("container"===t||"textContainer"===t||"baseContainer"===t)return}var n=new N;n.initFromText(y,m[0],e,E[0],_[0],i),m[0].contents.push(n)}else m[0]instanceof a&&T>0&&h&&"onText"in h&&h.onText(e)},p.onopentag=function(e){var t=e.attributes["xml:space"];t?_.unshift(t.value):0===_.length?_.unshift("default"):_.unshift(_[0]);var s=e.attributes["xml:lang"];if(s?E.unshift(s.value):0===E.length?E.unshift(""):E.unshift(E[0]),e.uri===n.ns_tt)if("tt"===e.local)null!==y&&k(i,"Two <tt> elements at ("+this.line+","+this.column+")"),(y=new o).initFromNode(e,E[0],i),m.unshift(y);else if("head"===e.local)m[0]instanceof o||k(i,"Parent of <head> element is not <tt> at ("+this.line+","+this.column+")"),m.unshift(y.head);else if("styling"===e.local)m[0]instanceof l||k(i,"Parent of <styling> element is not <head> at ("+this.line+","+this.column+")"),m.unshift(y.head.styling);else if("style"===e.local){var p;m[0]instanceof u?((p=new c).initFromNode(e,i),p.id?y.head.styling.styles[p.id]=p:B(i,"<style> element missing @id attribute"),m.unshift(p)):m[0]instanceof C?((p=new c).initFromNode(e,i),x(p.styleAttrs,m[0].styleAttrs),m.unshift(p)):k(i,"Parent of <style> element is not <styling> or <region> at ("+this.line+","+this.column+")")}else if("initial"===e.local){var N;if(m[0]instanceof u){for(var v in(N=new d).initFromNode(e,i),N.styleAttrs)y.head.styling.initials[v]=N.styleAttrs[v];m.unshift(N)}else k(i,"Parent of <initial> element is not <styling> at ("+this.line+","+this.column+")")}else if("layout"===e.local)m[0]instanceof l||k(i,"Parent of <layout> element is not <head> at "+this.line+","+this.column+")"),m.unshift(y.head.layout);else if("region"===e.local){m[0]instanceof f||k(i,"Parent of <region> element is not <layout> at "+this.line+","+this.column+")");var M=new C;M.initFromNode(y,e,E[0],i),!M.id||M.id in y.head.layout.regions?B(i,"Ignoring <region> with duplicate or missing @id at "+this.line+","+this.column+")"):y.head.layout.regions[M.id]=M,m.unshift(M)}else if("body"===e.local){m[0]instanceof o||k(i,"Parent of <body> element is not <tt> at "+this.line+","+this.column+")"),null!==y.body&&k(i,"Second <body> element at "+this.line+","+this.column+")");var O=new A;O.initFromNode(y,e,E[0],i),y.body=O,m.unshift(O)}else if("div"===e.local){m[0]instanceof S||m[0]instanceof A||k(i,"Parent of <div> element is not <body> or <div> at "+this.line+","+this.column+")");var w=new S;w.initFromNode(y,m[0],e,E[0],i);var L=w.styleAttrs[r.byName.backgroundImage.qname];L&&(w.contents.push(new g(L)),delete w.styleAttrs[r.byName.backgroundImage.qname]),m[0].contents.push(w),m.unshift(w)}else if("image"===e.local){m[0]instanceof S||k(i,"Parent of <image> element is not <div> at "+this.line+","+this.column+")");var P=new g;P.initFromNode(y,m[0],e,E[0],i),m[0].contents.push(P),m.unshift(P)}else if("p"===e.local){m[0]instanceof S||k(i,"Parent of <p> element is not <div> at "+this.line+","+this.column+")");var F=new I;F.initFromNode(y,m[0],e,E[0],i),m[0].contents.push(F),m.unshift(F)}else if("span"===e.local){m[0]instanceof R||m[0]instanceof I||k(i,"Parent of <span> element is not <span> or <p> at "+this.line+","+this.column+")");var U=new R;U.initFromNode(y,m[0],e,E[0],_[0],i),m[0].contents.push(U),m.unshift(U)}else if("br"===e.local){m[0]instanceof R||m[0]instanceof I||k(i,"Parent of <br> element is not <span> or <p> at "+this.line+","+this.column+")");var G=new D;G.initFromNode(y,m[0],e,E[0],i),m[0].contents.push(G),m.unshift(G)}else if("set"===e.local){m[0]instanceof R||m[0]instanceof I||m[0]instanceof S||m[0]instanceof A||m[0]instanceof C||m[0]instanceof D||k(i,"Parent of <set> element is not a content element or a region at "+this.line+","+this.column+")");var Y=new b;Y.initFromNode(y,m[0],e,i),m[0].sets.push(Y),m.unshift(Y)}else m.unshift(new a(e));else m.unshift(new a(e));if(m[0]instanceof a)if(e.uri===n.ns_tt&&"metadata"===e.local)T++;else if(T>0&&h&&"onOpenTag"in h){var K=[];for(var q in e.attributes)K[e.attributes[q].uri+" "+e.attributes[q].local]={uri:e.attributes[q].uri,local:e.attributes[q].local,value:e.attributes[q].value};h.onOpenTag(e.uri,e.local,K)}},p.write(e).close(),delete y.head.styling.styles;var v=!1;for(var M in y.head.layout.regions){v=!0;break}if(!v){var O=C.prototype.createDefaultRegion(y.lang);y.head.layout.regions[O.id]=O}for(var w in y.head.layout.regions)s(y,y.head.layout.regions[w],null,null);return y.body&&s(y,y.body,null,null),y.body&&function e(t){if(!("contents"in t))return;for(var n=("styleAttrs"in t?t.styleAttrs[r.byName.ruby.qname]:null),i="span"===t.kind&&("container"===n||"textContainer"===n||"baseContainer"===n),s=t.contents.length-1;s>=0;s--)!i||"styleAttrs"in t.contents[s]&&r.byName.ruby.qname in t.contents[s].styleAttrs?e(t.contents[s]):delete t.contents[s]}(y.body),y},o.prototype.initFromNode=function(e,t,r){var s=function(e,t){var r=w(e,n.ns_ttp,"cellResolution"),i=15,s=32;if(null!==r){var a=/(\d+) (\d+)/.exec(r);null!==a?(s=parseInt(a[1]),i=parseInt(a[2])):U(t,"Malformed cellResolution value (using initial value instead)")}return{w:s,h:i}}(e,r);this.cellLength={h:new i.ComputedLength(0,1/s.h),w:new i.ComputedLength(1/s.w,0)};var a=function(e,t){var r,i=w(e,n.ns_ttp,"frameRate"),s=30;if(null!==i){null!==(r=/(\d+)/.exec(i))?s=parseInt(r[1]):U(t,"Malformed frame rate attribute (using initial value instead)")}var a=w(e,n.ns_ttp,"frameRateMultiplier"),o=1;if(null!==a){null!==(r=/(\d+) (\d+)/.exec(a))?o=parseInt(r[1])/parseInt(r[2]):U(t,"Malformed frame rate multiplier attribute (using initial value instead)")}var l=o*s,u=1,c=w(e,n.ns_ttp,"tickRate");if(null===c)null!==i&&(u=l);else{null!==(r=/(\d+)/.exec(c))?u=parseInt(r[1]):U(t,"Malformed tick rate attribute (using initial value instead)")}return{effectiveFrameRate:l,tickRate:u}}(e,r);this.effectiveFrameRate=a.effectiveFrameRate,this.tickRate=a.tickRate,this.aspectRatio=function(e,t){var r=w(e,n.ns_ittp,"aspectRatio");null===r&&(r=w(e,n.ns_ttp,"displayAspectRatio"));var i=null;if(null!==r){var s=/(\d+)\s+(\d+)/.exec(r);if(null!==s){var a=parseInt(s[1]),o=parseInt(s[2]);0!==a&&0!==o?i=a/o:B(t,"Illegal aspectRatio values (ignoring)")}else B(t,"Malformed aspectRatio attribute (ignoring)")}return i}(e,r);var o=w(e,n.ns_ttp,"timeBase");null!==o&&"media"!==o&&k(r,"Unsupported time base");var l=function(e,t){var r=w(e,n.ns_tts,"extent");if(null===r)return null;var s=r.split(" ");if(2!==s.length)return U(t,"Malformed extent (ignoring)"),null;var a=i.parseLength(s[0]),o=i.parseLength(s[1]);if(!o||!a)return U(t,"Malformed extent values (ignoring)"),null;return{h:o,w:a}}(e,r);null===l?this.pxLength={h:null,w:null}:("px"===l.h.unit&&"px"===l.w.unit||k(r,"Extent on TT must be in px or absent"),this.pxLength={h:new i.ComputedLength(0,1/l.h.value),w:new i.ComputedLength(1/l.w.value,0)}),this.dimensions={h:new i.ComputedLength(0,1),w:new i.ComputedLength(1,0)},this.lang=t},o.prototype._registerEvent=function(e){if(!(e.end<=e.begin)){var t=G(this.events,e.begin);if(t.found||this.events.splice(t.index,0,e.begin),e.end!==Number.POSITIVE_INFINITY){var n=G(this.events,e.end);n.found||this.events.splice(n.index,0,e.end)}}},o.prototype.getMediaTimeRange=function(){return[this.events[0],this.events[this.events.length-1]]},o.prototype.getMediaTimeEvents=function(){return this.events},c.prototype.initFromNode=function(e,t){this.id=v(e),this.styleAttrs=O(e,t),this.styleRefs=M(e)},d.prototype.initFromNode=function(e,t){for(var r in this.styleAttrs={},e.attributes)if(e.attributes[r].uri===n.ns_itts||e.attributes[r].uri===n.ns_ebutts||e.attributes[r].uri===n.ns_tts){var i=e.attributes[r].uri+" "+e.attributes[r].local;this.styleAttrs[i]=e.attributes[r].value}},g.prototype.initFromNode=function(e,t,n,r,i){this.src="src"in n.attributes?n.attributes.src.value:null,this.src||B(i,"Invalid image@src attribute"),this.type="type"in n.attributes?n.attributes.type.value:null,this.type||B(i,"Invalid image@type attribute"),E.prototype.initFromNode.call(this,e,t,n,i),y.prototype.initFromNode.call(this,e,t,n,i),_.prototype.initFromNode.call(this,e,t,n,i),m.prototype.initFromNode.call(this,e,t,n,i),this.lang=r},p.prototype.initFromNode=function(e,t,n,r){this.id=v(n)},m.prototype.initFromNode=function(e,t,n,r){this.regionID=function(e){return e&&"region"in e.attributes?e.attributes.region.value:""}(n)},E.prototype.initFromNode=function(e,t,n,r){this.styleAttrs=O(n,r),null!==e.head&&null!==e.head.styling&&F(e.head.styling,M(n),this.styleAttrs,r)},_.prototype.initFromNode=function(e,t,n,r){this.sets=[]},T.prototype.initFromNode=function(e,t,n,r){this.contents=[]},y.prototype.initFromNode=function(e,t,n,r){var i=function(e,t,n,r){var i=null;n&&"begin"in n.attributes&&null===(i=L(e.tickRate,e.effectiveFrameRate,n.attributes.begin.value))&&U(r,"Malformed begin value "+n.attributes.begin.value+" (using 0)");var s=null;n&&"dur"in n.attributes&&null===(s=L(e.tickRate,e.effectiveFrameRate,n.attributes.dur.value))&&U(r,"Malformed dur value "+n.attributes.dur.value+" (ignoring)");var a=null;n&&"end"in n.attributes&&null===(a=L(e.tickRate,e.effectiveFrameRate,n.attributes.end.value))&&U(r,"Malformed end value (ignoring)");return{explicit_begin:i,explicit_end:a,explicit_dur:s}}(e,0,n,r);this.explicit_begin=i.explicit_begin,this.explicit_end=i.explicit_end,this.explicit_dur=i.explicit_dur,this.timeContainer=function(e,t){var n=e&&"timeContainer"in e.attributes?e.attributes.timeContainer.value:null;return n&&"par"!==n?"seq"===n?"seq":(B(t,"Illegal value of timeContainer (assuming 'par')"),"par"):"par"}(n,r)},A.prototype.initFromNode=function(e,t,n,r){E.prototype.initFromNode.call(this,e,null,t,r),y.prototype.initFromNode.call(this,e,null,t,r),_.prototype.initFromNode.call(this,e,null,t,r),m.prototype.initFromNode.call(this,e,null,t,r),T.prototype.initFromNode.call(this,e,null,t,r),this.lang=n},S.prototype.initFromNode=function(e,t,n,r,i){E.prototype.initFromNode.call(this,e,t,n,i),y.prototype.initFromNode.call(this,e,t,n,i),_.prototype.initFromNode.call(this,e,t,n,i),m.prototype.initFromNode.call(this,e,t,n,i),T.prototype.initFromNode.call(this,e,t,n,i),this.lang=r},I.prototype.initFromNode=function(e,t,n,r,i){E.prototype.initFromNode.call(this,e,t,n,i),y.prototype.initFromNode.call(this,e,t,n,i),_.prototype.initFromNode.call(this,e,t,n,i),m.prototype.initFromNode.call(this,e,t,n,i),T.prototype.initFromNode.call(this,e,t,n,i),this.lang=r},R.prototype.initFromNode=function(e,t,n,r,i,s){E.prototype.initFromNode.call(this,e,t,n,s),y.prototype.initFromNode.call(this,e,t,n,s),_.prototype.initFromNode.call(this,e,t,n,s),m.prototype.initFromNode.call(this,e,t,n,s),T.prototype.initFromNode.call(this,e,t,n,s),this.space=i,this.lang=r},N.prototype.initFromText=function(e,t,n,r,i,s){y.prototype.initFromNode.call(this,e,t,null,s),this.text=n,this.space=i,this.lang=r},D.prototype.initFromNode=function(e,t,n,r,i){m.prototype.initFromNode.call(this,e,t,n,i),y.prototype.initFromNode.call(this,e,t,n,i),this.lang=r},C.prototype.createDefaultRegion=function(e){var t=new C;return p.call(t,""),E.call(t,{}),_.call(t,[]),y.call(t,0,Number.POSITIVE_INFINITY,null),this.lang=e,t},C.prototype.initFromNode=function(e,t,n,r){p.prototype.initFromNode.call(this,e,null,t,r),y.prototype.initFromNode.call(this,e,null,t,r),_.prototype.initFromNode.call(this,e,null,t,r),this.styleAttrs=O(t,r),this.styleRefs=M(t),this.lang=n},b.prototype.initFromNode=function(e,t,n,r){y.prototype.initFromNode.call(this,e,t,n,r);var i=O(n,r);for(var s in this.qname=null,this.value=null,i){if(this.qname){B(r,"More than one style specified on set");break}this.qname=s,this.value=i[s]}}}(t,"undefined"==typeof sax?re:sax,"undefined"==typeof imscNames?J:imscNames,"undefined"==typeof imscStyles?te:imscStyles,"undefined"==typeof imscUtils?ee:imscUtils)})),se=T((function(e,t){!function(e,t,n){function r(e,t,l,c){var d;if("region"===l.kind)(d=document.createElement("div")).style.position="absolute";else if("body"===l.kind)d=document.createElement("div");else if("div"===l.kind)d=document.createElement("div");else if("image"===l.kind){if(d=document.createElement("img"),null!==e.imgResolver&&null!==l.src){var h=e.imgResolver(l.src,d);h&&(d.src=h),d.height=e.regionH,d.width=e.regionW}}else if("p"===l.kind)d=document.createElement("p");else if("span"===l.kind)if("container"===l.styleAttrs[n.byName.ruby.qname])d=document.createElement("ruby"),e.ruby=!0;else if("base"===l.styleAttrs[n.byName.ruby.qname])d=document.createElement("rb");else if("text"===l.styleAttrs[n.byName.ruby.qname])d=document.createElement("rt");else if("baseContainer"===l.styleAttrs[n.byName.ruby.qname])d=document.createElement("rbc");else if("textContainer"===l.styleAttrs[n.byName.ruby.qname])d=document.createElement("rtc");else{if("delimiter"===l.styleAttrs[n.byName.ruby.qname])return;d=document.createElement("span")}else"br"===l.kind&&(d=document.createElement("br"));if(d){if(l.lang&&("region"!==l.kind&&l.lang===c.lang||(d.lang=l.lang)),t.appendChild(d),d.style.margin="0","region"===l.kind){var m=l.styleAttrs[n.byName.writingMode.qname];"lrtb"===m||"lr"===m?(e.ipd="lr",e.bpd="tb"):"rltb"===m||"rl"===m?(e.ipd="rl",e.bpd="tb"):"tblr"===m?(e.ipd="tb",e.bpd="lr"):"tbrl"!==m&&"tb"!==m||(e.ipd="tb",e.bpd="rl")}else if("p"===l.kind&&"tb"===e.bpd){var E=l.styleAttrs[n.byName.direction.qname];e.ipd="ltr"===E?"lr":"rl"}for(var _ in u){var T=u[_],y=l.styleAttrs[T.qname];void 0!==y&&null!==T.map&&T.map(e,d,l,y)}var A=d,S=l.styleAttrs[n.byName.linePadding.qname];if(S&&!S.isZero()){var I=S.toUsedLength(e.w,e.h);if(I>0){var R=Math.ceil(I)+"px";"tb"===e.bpd?(A.style.paddingLeft=R,A.style.paddingRight=R):(A.style.paddingTop=R,A.style.paddingBottom=R),e.lp=S}}var N=l.styleAttrs[n.byName.multiRowAlign.qname];if(N&&"auto"!==N){var D=document.createElement("span");D.style.display="inline-block",D.style.textAlign=N,d.appendChild(D),A=D,e.mra=N}var C=l.styleAttrs[n.byName.rubyReserve.qname];if(C&&"none"!==C[0]&&(e.rubyReserve=C),l.styleAttrs[n.byName.fillLineGap.qname]&&(e.flg=!0),"span"===l.kind&&l.text){var b=l.styleAttrs[n.byName.textEmphasis.qname];if(b&&"none"!==b.style&&(e.textEmphasis=!0),n.byName.textCombine.qname in l.styleAttrs&&"all"===l.styleAttrs[n.byName.textCombine.qname])d.textContent=l.text,b&&o(e,d,l,b);else for(var v="",M=0;M<l.text.length;M++){v+=l.text.charAt(M);var O=l.text.charCodeAt(M);if(O<55296||O>56319||M===l.text.length){var w=document.createElement("span");w.textContent=v,b&&o(e,w,l,b),d.appendChild(w),v=""}}}for(var L in l.contents)r(e,A,l.contents[L],l);var P=[];if((e.lp||e.mra||e.flg||e.ruby||e.textEmphasis||e.rubyReserve)&&"p"===l.kind&&(a(e,A,P,null),e.rubyReserve&&(!function(e,t){for(var n=0;n<e.length;n++){var r,i,s=document.createElement("ruby"),a=document.createElement("rb");a.textContent="​",s.appendChild(a);var o,l=t.rubyReserve[1].toUsedLength(t.w,t.h)+"px";if("both"===t.rubyReserve[0]||"outside"===t.rubyReserve[0]&&1==e.length)(r=document.createElement("rtc")).style[g]=f?"after":"under",r.textContent="​",r.style.fontSize=l,(i=document.createElement("rtc")).style[g]=f?"before":"over",i.textContent="​",i.style.fontSize=l,s.appendChild(r),s.appendChild(i);else(r=document.createElement("rtc")).textContent="​",r.style.fontSize=l,o="after"===t.rubyReserve[0]||"outside"===t.rubyReserve[0]&&n>0?f?"after":"tb"===t.bpd||"rl"===t.bpd?"under":"over":f?"before":"tb"===t.bpd||"rl"===t.bpd?"over":"under",r.style[g]=o,s.appendChild(r);for(var u=null,c=0;c<e[n].rbc.length;c++)if("ruby"===e[n].rbc[c].localName){u=e[n].rbc[c];for(var d=0;d<u.style.length;d++)s.style.setProperty(u.style.item(d),u.style.getPropertyValue(u.style.item(d)));break}(u=u||e[n].elements[0].node).parentElement.insertBefore(s,u)}}(P,e),e.rubyReserve=null),(e.ruby||e.rubyReserve)&&(!function(e,t){for(var n=0;n<e.length;n++)for(var r=0;r<e[n].rbc.length;r++){var i;if(!e[n].rbc[r].style[g])i=f?0===n?"before":"after":"tb"===t.bpd||"rl"===t.bpd?0===n?"over":"under":0===n?"under":"over",e[n].rbc[r].style[g]=i}}(P,e),e.ruby=null),e.textEmphasis&&(!function(e,t){for(var n=0;n<e.length;n++)for(var r=0;r<e[n].te.length;r++){var i;if(!e[n].te[r].style[p]||"none"===e[n].te[r].style[p])i="tb"===t.bpd?0===n?"left over":"left under":"rl"===t.bpd?0===n?"right under":"left under":0===n?"left under":"right under",e[n].te[r].style[p]=i}}(P,e),e.textEmphasis=null),e.mra&&(!function(e){for(var t=0;t<e.length-1;t++){var n=e[t].elements.length;if(0!==n&&!1===e[t].br){var r=document.createElement("br"),i=e[t].elements[n-1].node;i.parentElement.insertBefore(r,i.nextSibling)}}}(P),e.mra=null),e.lp&&(!function(e,t,n){for(var r in e){var i=e[r].elements.length,s=e[r].elements[e[r].start_elem],a=e[r].elements[e[r].end_elem],o=Math.ceil(t)+"px",l="-"+Math.ceil(t)+"px";0!==i&&("lr"===n.ipd?(s.node.style.borderLeftColor=s.bgcolor||"#00000000",s.node.style.borderLeftStyle="solid",s.node.style.borderLeftWidth=o,s.node.style.marginLeft=l):"rl"===n.ipd?(s.node.style.borderRightColor=s.bgcolor||"#00000000",s.node.style.borderRightStyle="solid",s.node.style.borderRightWidth=o,s.node.style.marginRight=l):"tb"===n.ipd&&(s.node.style.borderTopColor=s.bgcolor||"#00000000",s.node.style.borderTopStyle="solid",s.node.style.borderTopWidth=o,s.node.style.marginTop=l),"lr"===n.ipd?(a.node.style.borderRightColor=a.bgcolor||"#00000000",a.node.style.borderRightStyle="solid",a.node.style.borderRightWidth=o,a.node.style.marginRight=l):"rl"===n.ipd?(a.node.style.borderLeftColor=a.bgcolor||"#00000000",a.node.style.borderLeftStyle="solid",a.node.style.borderLeftWidth=o,a.node.style.marginLeft=l):"tb"===n.ipd&&(a.node.style.borderBottomColor=a.bgcolor||"#00000000",a.node.style.borderBottomStyle="solid",a.node.style.borderBottomWidth=o,a.node.style.marginBottom=l))}}(P,e.lp.toUsedLength(e.w,e.h),e),e.lp=null),e.flg)){var F=s(A.getBoundingClientRect(),e);!function(e,t,n,r){for(var i=Math.sign(n-t),s=0;s<=e.length;s++){var a,o,l;if(a=0===s?t:s===e.length?n:(e[s].before+e[s-1].after)/2,s>0)for(var u=0;u<e[s-1].elements.length;u++)null!==e[s-1].elements[u].bgcolor&&(l=e[s-1].elements[u],i*(l.after-a)<0&&(o=Math.ceil(Math.abs(a-l.after))+"px",l.node.style.backgroundColor=l.bgcolor,"lr"===r.bpd?l.node.style.paddingRight=o:"rl"===r.bpd?l.node.style.paddingLeft=o:"tb"===r.bpd&&(l.node.style.paddingBottom=o)));if(s<e.length)for(var c=0;c<e[s].elements.length;c++)null!==(l=e[s].elements[c]).bgcolor&&i*(l.before-a)>0&&(o=Math.ceil(Math.abs(l.before-a))+"px",l.node.style.backgroundColor=l.bgcolor,"lr"===r.bpd?l.node.style.paddingLeft=o:"rl"===r.bpd?l.node.style.paddingRight=o:"tb"===r.bpd&&(l.node.style.paddingTop=o))}}(P,F.before,F.after,e),e.flg=null}if("region"===l.kind&&(a(e,A,P),"tb"===e.bpd&&e.enableRollUp&&l.contents.length>0&&"after"===l.styleAttrs[n.byName.displayAlign.qname])){var x=new i(""===l.id?"_":l.id,P);if(e.currentISDState[x.id]=x,e.previousISDState&&x.id in e.previousISDState&&e.previousISDState[x.id].plist.length>0&&x.plist.length>1&&x.plist[x.plist.length-2].text===e.previousISDState[x.id].plist[e.previousISDState[x.id].plist.length-1].text){var U=d.firstElementChild,B=x.plist[x.plist.length-1].after-x.plist[x.plist.length-1].before;U.style.bottom="-"+B+"px",U.style.transition="transform 0.4s",U.style.position="relative",U.style.transform="translateY(-"+B+"px)"}}}else!function(e,t){if(e&&e.error&&e.error(t))throw t}(e.errorHandler,"Error processing ISD element kind: "+l.kind)}function i(e,t){this.id=e,this.plist=t}function s(e,t){var n={before:null,after:null,start:null,end:null};return"tb"===t.bpd?(n.before=e.top,n.after=e.bottom,"lr"===t.ipd?(n.start=e.left,n.end=e.right):(n.start=e.right,n.end=e.left)):"lr"===t.bpd?(n.before=e.left,n.after=e.right,n.start=e.top,n.end=e.bottom):"rl"===t.bpd&&(n.before=e.right,n.after=e.left,n.start=e.top,n.end=e.bottom),n}function a(e,t,n,r){if("rt"!==t.localName&&"rtc"!==t.localName){var i,o,l,u,c=t.style.backgroundColor||r;if(0===t.childElementCount)if("span"===t.localName||"rb"===t.localName){var d=t.getBoundingClientRect();if(0===d.height||0===d.width)return;var f=s(d,e);if(0!==n.length&&(i=f.before,o=f.after,l=n[n.length-1].before,u=n[n.length-1].after,o<u&&i>l||u<=o&&l>=i)){var g=Math.sign(f.after-f.before),p=Math.sign(f.end-f.start);g*(f.before-n[n.length-1].before)<0&&(n[n.length-1].before=f.before),g*(f.after-n[n.length-1].after)>0&&(n[n.length-1].after=f.after),p*(f.start-n[n.length-1].start)<0&&(n[n.length-1].start=f.start,n[n.length-1].start_elem=n[n.length-1].elements.length),p*(f.end-n[n.length-1].end)>0&&(n[n.length-1].end=f.end,n[n.length-1].end_elem=n[n.length-1].elements.length)}else n.push({before:f.before,after:f.after,start:f.start,end:f.end,start_elem:0,end_elem:0,elements:[],rbc:[],te:[],text:"",br:!1});n[n.length-1].text+=t.textContent,n[n.length-1].elements.push({node:t,bgcolor:c,before:f.before,after:f.after})}else"br"===t.localName&&0!==n.length&&(n[n.length-1].br=!0);else for(var m=t.firstChild;m;)m.nodeType===Node.ELEMENT_NODE&&(a(e,m,n,c),"ruby"===m.localName||"rtc"===m.localName?n.length>0&&n[n.length-1].rbc.push(m):"span"===m.localName&&m.style[h]&&"none"!==m.style[h]&&n.length>0&&n[n.length-1].te.push(m)),m=m.nextSibling}}function o(e,t,n,r){var i;"none"!==r.style&&("auto"===r.style?t.style[h]="filled":t.style[h]=r.style+" "+r.symbol,("before"===r.position||"after"===r.position)&&(i="tb"===e.bpd?"before"===r.position?"left over":"left under":"rl"===e.bpd?"before"===r.position?"right under":"left under":"before"===r.position?"left under":"right under",t.style[p]=i))}function l(e,t){this.qname=e,this.map=t}e.render=function(e,t,n,i,s,a,o,l,u){var c=i||t.clientHeight,d=s||t.clientWidth;if(null!==e.aspectRatio){var f=c*e.aspectRatio;f>d?c=Math.round(d/e.aspectRatio):d=f}var g=document.createElement("div");g.style.position="relative",g.style.width=d+"px",g.style.height=c+"px",g.style.margin="auto",g.style.top=0,g.style.bottom=0,g.style.left=0,g.style.right=0,g.style.zIndex=0;var h={h:c,w:d,regionH:null,regionW:null,imgResolver:n,displayForcedOnlyMode:a||!1,isd:e,errorHandler:o,previousISDState:l,enableRollUp:u||!1,currentISDState:{},flg:null,lp:null,mra:null,ipd:null,bpd:null,ruby:null,textEmphasis:null,rubyReserve:null};for(var p in t.appendChild(g),e.contents)r(h,g,e.contents[p],e);return h.currentISDState};var u=[new l("http://www.w3.org/ns/ttml#styling backgroundColor",(function(e,t,n,r){0!==r[3]&&(t.style.backgroundColor="rgba("+r[0].toString()+","+r[1].toString()+","+r[2].toString()+","+(r[3]/255).toString()+")")})),new l("http://www.w3.org/ns/ttml#styling color",(function(e,t,n,r){t.style.color="rgba("+r[0].toString()+","+r[1].toString()+","+r[2].toString()+","+(r[3]/255).toString()+")"})),new l("http://www.w3.org/ns/ttml#styling direction",(function(e,t,n,r){t.style.direction=r})),new l("http://www.w3.org/ns/ttml#styling display",(function(e,t,n,r){})),new l("http://www.w3.org/ns/ttml#styling displayAlign",(function(e,t,n,r){t.style.display="flex",t.style.flexDirection="column","before"===r?t.style.justifyContent="flex-start":"center"===r?t.style.justifyContent="center":"after"===r&&(t.style.justifyContent="flex-end")})),new l("http://www.w3.org/ns/ttml#styling extent",(function(e,t,n,r){e.regionH=r.h.toUsedLength(e.w,e.h),e.regionW=r.w.toUsedLength(e.w,e.h);var i=0,s=0,a=n.styleAttrs["http://www.w3.org/ns/ttml#styling padding"];a&&(i=a[0].toUsedLength(e.w,e.h)+a[2].toUsedLength(e.w,e.h),s=a[1].toUsedLength(e.w,e.h)+a[3].toUsedLength(e.w,e.h)),t.style.height=e.regionH-i+"px",t.style.width=e.regionW-s+"px"})),new l("http://www.w3.org/ns/ttml#styling fontFamily",(function(e,t,n,r){var i=[];for(var s in r)"monospaceSerif"===r[s]?(i.push("Courier New"),i.push('"Liberation Mono"'),i.push("Courier"),i.push("monospace")):"proportionalSansSerif"===r[s]?(i.push("Arial"),i.push("Helvetica"),i.push('"Liberation Sans"'),i.push("sans-serif")):"monospace"===r[s]?i.push("monospace"):"sansSerif"===r[s]?i.push("sans-serif"):"serif"===r[s]?i.push("serif"):"monospaceSansSerif"===r[s]?(i.push("Consolas"),i.push("monospace")):"proportionalSerif"===r[s]?i.push("serif"):i.push(r[s]);t.style.fontFamily=i.join(",")})),new l("http://www.w3.org/ns/ttml#styling shear",(function(e,t,n,r){if(0!==r){var i=-.9*r;"tb"===e.bpd?t.style.transform="skewX("+i+"deg)":t.style.transform="skewY("+i+"deg)"}})),new l("http://www.w3.org/ns/ttml#styling fontSize",(function(e,t,n,r){t.style.fontSize=r.toUsedLength(e.w,e.h)+"px"})),new l("http://www.w3.org/ns/ttml#styling fontStyle",(function(e,t,n,r){t.style.fontStyle=r})),new l("http://www.w3.org/ns/ttml#styling fontWeight",(function(e,t,n,r){t.style.fontWeight=r})),new l("http://www.w3.org/ns/ttml#styling lineHeight",(function(e,t,n,r){t.style.lineHeight="normal"===r?"normal":r.toUsedLength(e.w,e.h)+"px"})),new l("http://www.w3.org/ns/ttml#styling opacity",(function(e,t,n,r){t.style.opacity=r})),new l("http://www.w3.org/ns/ttml#styling origin",(function(e,t,n,r){t.style.top=r.h.toUsedLength(e.w,e.h)+"px",t.style.left=r.w.toUsedLength(e.w,e.h)+"px"})),new l("http://www.w3.org/ns/ttml#styling overflow",(function(e,t,n,r){t.style.overflow=r})),new l("http://www.w3.org/ns/ttml#styling padding",(function(e,t,n,r){var i=[];i[0]=r[0].toUsedLength(e.w,e.h)+"px",i[1]=r[3].toUsedLength(e.w,e.h)+"px",i[2]=r[2].toUsedLength(e.w,e.h)+"px",i[3]=r[1].toUsedLength(e.w,e.h)+"px",t.style.padding=i.join(" ")})),new l("http://www.w3.org/ns/ttml#styling position",(function(e,t,n,r){t.style.top=r.h.toUsedLength(e.w,e.h)+"px",t.style.left=r.w.toUsedLength(e.w,e.h)+"px"})),new l("http://www.w3.org/ns/ttml#styling rubyAlign",(function(e,t,n,r){t.style.rubyAlign="spaceAround"===r?"space-around":"center"})),new l("http://www.w3.org/ns/ttml#styling rubyPosition",(function(e,t,n,r){var i;"before"!==r&&"after"!==r||(i=f?r:"tb"===e.bpd||"rl"===e.bpd?"before"===r?"over":"under":"before"===r?"under":"over",t.parentElement.style[g]=i)})),new l("http://www.w3.org/ns/ttml#styling showBackground",null),new l("http://www.w3.org/ns/ttml#styling textAlign",(function(e,t,n,r){var i;i="start"===r?"rl"===e.ipd?"right":"left":"end"===r?"rl"===e.ipd?"left":"right":r,t.style.textAlign=i})),new l("http://www.w3.org/ns/ttml#styling textDecoration",(function(e,t,n,r){t.style.textDecoration=r.join(" ").replace("lineThrough","line-through")})),new l("http://www.w3.org/ns/ttml#styling textOutline",(function(e,t,n,r){})),new l("http://www.w3.org/ns/ttml#styling textShadow",(function(e,t,r,i){var s=r.styleAttrs[n.byName.textOutline.qname];if("none"===i&&"none"===s)t.style.textShadow="";else{var a=[];if("none"!==s){var o="rgba("+s.color[0].toString()+","+s.color[1].toString()+","+s.color[2].toString()+","+(s.color[3]/255).toString()+")";a.push("1px 1px 1px "+o),a.push("-1px 1px 1px "+o),a.push("1px -1px 1px "+o),a.push("-1px -1px 1px "+o)}if("none"!==i)for(var l in i)a.push(i[l].x_off.toUsedLength(e.w,e.h)+"px "+i[l].y_off.toUsedLength(e.w,e.h)+"px "+i[l].b_radius.toUsedLength(e.w,e.h)+"px rgba("+i[l].color[0].toString()+","+i[l].color[1].toString()+","+i[l].color[2].toString()+","+(i[l].color[3]/255).toString()+")");t.style.textShadow=a.join(",")}})),new l("http://www.w3.org/ns/ttml#styling textCombine",(function(e,t,n,r){t.style.textCombineUpright=r})),new l("http://www.w3.org/ns/ttml#styling textEmphasis",(function(e,t,n,r){})),new l("http://www.w3.org/ns/ttml#styling unicodeBidi",(function(e,t,n,r){var i;i="bidiOverride"===r?"bidi-override":r,t.style.unicodeBidi=i})),new l("http://www.w3.org/ns/ttml#styling visibility",(function(e,t,n,r){t.style.visibility=r})),new l("http://www.w3.org/ns/ttml#styling wrapOption",(function(e,t,n,r){"wrap"===r?"preserve"===n.space?t.style.whiteSpace="pre-wrap":t.style.whiteSpace="normal":"preserve"===n.space?t.style.whiteSpace="pre":t.style.whiteSpace="noWrap"})),new l("http://www.w3.org/ns/ttml#styling writingMode",(function(e,t,n,r){"lrtb"===r||"lr"===r||"rltb"===r||"rl"===r?t.style.writingMode="horizontal-tb":"tblr"===r?t.style.writingMode="vertical-lr":"tbrl"!==r&&"tb"!==r||(t.style.writingMode="vertical-rl")})),new l("http://www.w3.org/ns/ttml#styling zIndex",(function(e,t,n,r){t.style.zIndex=r})),new l("http://www.w3.org/ns/ttml/profile/imsc1#styling forcedDisplay",(function(e,t,n,r){e.displayForcedOnlyMode&&!1===r&&(t.style.visibility="hidden")}))],c={};for(var d in u)c[u[d].qname]=u[d];var f="webkitRubyPosition"in window.getComputedStyle(document.documentElement),g=f?"webkitRubyPosition":"rubyPosition",h="webkitTextEmphasisStyle"in window.getComputedStyle(document.documentElement)?"webkitTextEmphasisStyle":"textEmphasisStyle",p="webkitTextEmphasisPosition"in window.getComputedStyle(document.documentElement)?"webkitTextEmphasisPosition":"textEmphasisPosition"}(t,"undefined"==typeof imscNames||imscNames,"undefined"==typeof imscStyles?te:imscStyles,"undefined"==typeof imscUtils||imscUtils)})),ae=ne.generateISD,oe=ie.fromXML,le=se.render;function ue(){const e=this.context,t=b(e).getInstance();let n,r,i,s,a,o,l,u,c,d,f,g,h,p,m,E,_,T;function y(e){const t=a[e].kind,n=void 0!==a[e].id?a[e].id:a[e].lang,r=a[e].lang,i=a[e].isTTML,o=a[e].isEmbedded;return s.addTextTrack(t,n,r,i,o)}function S(e,t,n,r,i,s){let a=0,o=0;e/t>n/r?(o=t,a=o/r*n):(a=e,o=a/n*r);let l=0,u=0,c=0,d=0;return a/o>i?(d=o,c=o*i):(c=a,d=a/i),l=(e-c)/2,u=(t-d)/2,s?{x:l+.1*c,y:u+.1*d,w:.8*c,h:.8*d}:{x:l,y:u,w:c,h:d}}function I(e,n){const r=s.getClientWidth(),i=s.getClientHeight(),a=s.getVideoWidth(),o=s.getVideoHeight(),l=s.getVideoRelativeOffsetTop(),h=s.getVideoRelativeOffsetLeft();if(0!==a&&0!==o){let s=a/o,E=!1;e.isFromCEA608&&(s=3.5/3,E=!0);const T=S.call(this,r,i,a,o,s,E),y=T.w,A=T.h,I=T.x,R=T.y;if(y!=d||A!=f||I!=u||R!=c||n){if(u=I+h,c=R+l,d=y,f=A,g){const e=g.style;e&&(e.left=u+"px",e.top=c+"px",e.width=d+"px",e.height=f+"px",e.zIndex=p&&document[p]||m?_:null,t.trigger(M.CAPTION_CONTAINER_RESIZE))}const n=e.activeCues;if(n){const e=n.length;for(let t=0;t<e;++t){const e=n[t];e.scaleCue(e)}}}}}function R(e){const t=d,n=f;let r,i,s,a,o;if(e.cellResolution){const l=[t/e.cellResolution[0],n/e.cellResolution[1]];if(e.linePadding)for(r in e.linePadding)if(e.linePadding.hasOwnProperty(r)){i=(e.linePadding[r]*l[0]).toString();const t=document.getElementsByClassName("spanPadding");for(let e=0;e<t.length;e++)t[e].style.cssText=t[e].style.cssText.replace(/(padding-left\s*:\s*)[\d.,]+(?=\s*px)/gi,"$1"+i),t[e].style.cssText=t[e].style.cssText.replace(/(padding-right\s*:\s*)[\d.,]+(?=\s*px)/gi,"$1"+i)}if(e.fontSize){for(r in e.fontSize)if(e.fontSize.hasOwnProperty(r)){"%"===e.fontSize[r][0]?s=e.fontSize[r][1]/100:"c"===e.fontSize[r][0]&&(s=e.fontSize[r][1]),i=(s*l[1]).toString(),o="defaultFontSize"!==r?document.getElementsByClassName(r):document.getElementsByClassName("paragraph");for(let e=0;e<o.length;e++)o[e].style.cssText=o[e].style.cssText.replace(/(font-size\s*:\s*)[\d.,]+(?=\s*px)/gi,"$1"+i)}if(e.lineHeight)for(r in e.lineHeight)if(e.lineHeight.hasOwnProperty(r)){"%"===e.lineHeight[r][0]?a=e.lineHeight[r][1]/100:"c"===e.fontSize[r][0]&&(a=e.lineHeight[r][1]),i=(a*l[1]).toString(),o=document.getElementsByClassName(r);for(let e=0;e<o.length;e++)o[e].style.cssText=o[e].style.cssText.replace(/(line-height\s*:\s*)[\d.,]+(?=\s*px)/gi,"$1"+i)}}}if(e.isd){let t=document.getElementById(e.cueID);t&&g.removeChild(t),N(e)}}function N(e){if(g){const n=document.createElement("div");g.appendChild(n),E=le(e.isd,n,(function(t){const n=/^(urn:)(mpeg:[a-z0-9][a-z0-9-]{0,31}:)(subs:)([0-9]+)$/,r=/^#(.*)$/;if(n.test(t)){const r=n.exec(t),i=parseInt(r[4],10)-1;return"data:image/png;base64,"+btoa(e.images[i])}if(r.test(t)){const n=r.exec(t)[1];return"data:image/png;base64,"+e.embeddedImages[n]}return null}),g.clientHeight,g.clientWidth,!1,(function(e){r.info("renderCaption :",e)}),E,!0),n.id=e.cueID,t.trigger(M.CAPTION_RENDERED,{captionDiv:n,currentTrackIdx:l})}}function D(e){return e>=0&&a[e]?s.getTextTrack(a[e].kind,a[e].id,a[e].lang,a[e].isTTML,a[e].isEmbedded):null}function C(e){if(e===l)return;l=e;const t=D(l);v.call(this,t),h&&(clearInterval(h),h=null),t&&"html"===t.renderingType&&(I.call(this,t,!0),window.ResizeObserver?(T=new window.ResizeObserver(()=>{I.call(this,t,!0)}),T.observe(s.getElement())):h=setInterval(I.bind(this,t),500))}function v(e){x.call(this),e&&"html"===e.renderingType?P.call(this):F.call(this)}function O(e,t,n){return(isNaN(t)||e.startTime>=t)&&(isNaN(n)||e.endTime<=n)}function L(e,t,n){if(e.cues){const r=e.cues;for(let i=r.length-1;i>=0;i--)O(r[i],t,n)&&e.removeCue(r[i])}}function P(){let e=document.getElementById("native-cue-style");if(e)return;e=document.createElement("style"),e.id="native-cue-style",document.head.appendChild(e);const t=e.sheet,n=s.getElement();try{n&&(n.id?t.insertRule("#"+n.id+"::cue {background: transparent}",0):0!==n.classList.length?t.insertRule("."+n.className+"::cue {background: transparent}",0):t.insertRule("video::cue {background: transparent}",0))}catch(e){r.info(""+e.message)}}function F(){const e=document.getElementById("native-cue-style");e&&document.head.removeChild(e)}function x(){if(g)for(;g.firstChild;)g.removeChild(g.firstChild)}return n={initialize:function(){"undefined"!=typeof window&&"undefined"!=typeof navigator&&(i=window.VTTCue||window.TextTrackCue,a=[],o=[],l=-1,u=0,c=0,d=0,f=0,g=null,h=null,m=!1,_=2147483647,E=null,void 0!==document.fullscreenElement?p="fullscreenElement":void 0!==document.webkitIsFullScreen?p="webkitIsFullScreen":document.msFullscreenElement?p="msFullscreenElement":document.mozFullScreen&&(p="mozFullScreen"))},setDisplayCConTop:function(e){X(e,"boolean"),m=e,g&&!document[p]&&(g.style.zIndex=e?_:null)},addTextTrack:function(e,n){if(a.length!==n){if(a.push(e),a.length===n){a.sort((function(e,t){return e.index-t.index})),g=s.getTTMLRenderingDiv();let e=-1;for(let n=0;n<a.length;n++){const r=y.call(this,n);o.push(r),a[n].defaultTrack&&(r.default=!0,e=n);const i=D(n);i&&(i.mode=A.TEXT_SHOWING,g&&(a[n].isTTML||a[n].isEmbedded)?i.renderingType="html":i.renderingType="default"),this.addCaptions(n,0,a[n].captionData),t.trigger(M.TEXT_TRACK_ADDED)}if(C.call(this,e),e>=0){let n=function(){const r=D(e);r&&I.call(this,r,!0),t.off(M.PLAYBACK_METADATA_LOADED,n,this)};t.on(M.PLAYBACK_METADATA_LOADED,n,this);for(let t=0;t<a.length;t++){const n=D(t);n&&(n.mode=t===e?A.TEXT_SHOWING:A.TEXT_HIDDEN)}}t.trigger(M.TEXT_TRACKS_QUEUE_INITIALIZED,{index:l,tracks:a})}}else r.error("Trying to add too many tracks.")},addCaptions:function(e,n,s){const a=D(e),o=this;if(a&&Array.isArray(s)&&0!==s.length)for(let e=0;e<s.length;e++){let h;const p=s[e];a.cellResolution=p.cellResolution,a.isFromCEA608=p.isFromCEA608,"html"===p.type&&g?(h=new i(p.start-n,p.end-n,""),h.cueHTMLElement=p.cueHTMLElement,h.isd=p.isd,h.images=p.images,h.embeddedImages=p.embeddedImages,h.cueID=p.cueID,h.scaleCue=R.bind(o),h.cellResolution=p.cellResolution,h.lineHeight=p.lineHeight,h.linePadding=p.linePadding,h.fontSize=p.fontSize,g.style.left=u+"px",g.style.top=c+"px",g.style.width=d+"px",g.style.height=f+"px",h.onenter=function(){a.mode===A.TEXT_SHOWING&&(this.isd?(N(this),r.debug("Cue enter id:"+this.cueID)):(g.appendChild(this.cueHTMLElement),R.call(o,this),t.trigger(M.CAPTION_RENDERED,{captionDiv:this.cueHTMLElement,currentTrackIdx:l})))},h.onexit=function(){if(g){const e=g.childNodes;for(let t=0;t<e.length;++t)e[t].id===this.cueID&&(r.debug("Cue exit id:"+e[t].id),g.removeChild(e[t]),--t)}}):p.data&&(h=new i(p.start-n,p.end-n,p.data),p.styles&&(void 0!==p.styles.align&&"align"in h&&(h.align=p.styles.align),void 0!==p.styles.line&&"line"in h&&(h.line=p.styles.line),void 0!==p.styles.position&&"position"in h&&(h.position=p.styles.position),void 0!==p.styles.size&&"size"in h&&(h.size=p.styles.size)),h.onenter=function(){a.mode===A.TEXT_SHOWING&&t.trigger(M.CAPTION_RENDERED,{currentTrackIdx:l})});try{h?a.addCue(h):r.error("impossible to display subtitles.")}catch(e){throw L(a),a.addCue(h),e}}},getCurrentTrackIdx:function(){return l},setCurrentTrackIdx:C,getTrackIdxForId:function(e){let t=-1;for(let n=0;n<a.length;n++)if(a[n].id===e){t=n;break}return t},getCurrentTrackInfo:function(){return a[l]},setModeForTrackIdx:function(e,t){const n=D(e);n&&n.mode!==t&&(n.mode=t)},deleteCuesFromTrackIdx:function(e,t,n){const r=D(e);r&&L(r,t,n)},deleteAllTextTracks:function(){const e=o?o.length:0;for(let t=0;t<e;t++){const e=D(t);e&&(L.call(this,e),e.mode="disabled")}o=[],a=[],h&&(clearInterval(h),h=null),T&&s&&(T.unobserve(s.getElement()),T=null),l=-1,x.call(this)},deleteTextTrack:function(e){s.removeChild(o[e]),o.splice(e,1)},setConfig:function(e){e&&e.videoModel&&(s=e.videoModel)}},r=w(e).getInstance().getLogger(n),n}ue.__dashjs_factory_name="TextTracks";var ce=R.getSingletonFactory(ue);function de(){let e,t=0;function n(e){let t="";for(let n=0;n<e.length;++n){t+=e[n].uchar}return t.length-t.replace(/^\s+/,"").length}function r(e){return"left: "+3.125*e.x+"%; top: "+6.66*e.y1+"%; width: "+(100-3.125*e.x)+"%; height: "+6.66*Math.max(e.y2-1-e.y1,1)+"%; align-items: flex-start; overflow: visible; -webkit-writing-mode: horizontal-tb;"}function i(e){return"red"===e?"rgb(255, 0, 0)":"green"===e?"rgb(0, 255, 0)":"blue"===e?"rgb(0, 0, 255)":"cyan"===e?"rgb(0, 255, 255)":"magenta"===e?"rgb(255, 0, 255)":"yellow"===e?"rgb(255, 255, 0)":"white"===e?"rgb(255, 255, 255)":"black"===e?"rgb(0, 0, 0)":e}function s(e,t){const n=e.videoHeight/15;return t?"font-size: "+n+"px; font-family: Menlo, Consolas, 'Cutive Mono', monospace; color: "+(t.foreground?i(t.foreground):"rgb(255, 255, 255)")+"; font-style: "+(t.italics?"italic":"normal")+"; text-decoration: "+(t.underline?"underline":"none")+"; white-space: pre; background-color: "+(t.background?i(t.background):"transparent")+";":"font-size: "+n+"px; font-family: Menlo, Consolas, 'Cutive Mono', monospace; justify-content: flex-start; text-align: left; color: rgb(255, 255, 255); font-style: normal; white-space: pre; line-height: normal; font-weight: normal; text-decoration: none; width: 100%; display: flex;"}function a(e){return e.replace(/^\s+/g,"")}function o(e){return e.replace(/\s+$/g,"")}return e={createHTMLCaptionsFromScreen:function(e,i,l,u){let c=null,d=null,f=!1,g=-1,h={start:i,end:l,spans:[]},p="style_cea608_white_black";const m={},E={},_=[];let T,y;for(T=0;T<15;++T){const e=u.rows[T];let t="",r=null;if(!1===e.isEmpty()){const s=n(e.chars);null===c&&(c={x:s,y1:T,y2:T+1,p:[]}),s!==g&&f&&(c.p.push(h),h={start:i,end:l,spans:[]},c.y2=T,c.name="region_"+c.x+"_"+c.y1+"_"+c.y2,!1===m.hasOwnProperty(c.name)?(_.push(c),m[c.name]=c):(d=m[c.name],d.p.contat(c.p)),c={x:s,y1:T,y2:T+1,p:[]});for(let n=0;n<e.chars.length;++n){const i=e.chars[n],s=i.penState;if(null===r||!s.equals(r)){t.trim().length>0&&(h.spans.push({name:p,line:t,row:T}),t="");let e="style_cea608_"+s.foreground+"_"+s.background;s.underline&&(e+="_underline"),s.italics&&(e+="_italics"),E.hasOwnProperty(e)||(E[e]=JSON.parse(JSON.stringify(s))),r=s,p=e}t+=i.uchar}t.trim().length>0&&h.spans.push({name:p,line:t,row:T}),f=!0,g=s}else f=!1,g=-1,c&&(c.p.push(h),h={start:i,end:l,spans:[]},c.y2=T,c.name="region_"+c.x+"_"+c.y1+"_"+c.y2,!1===m.hasOwnProperty(c.name)?(_.push(c),m[c.name]=c):(d=m[c.name],d.p.contat(c.p)),c=null)}c&&(c.p.push(h),c.y2=T+1,c.name="region_"+c.x+"_"+c.y1+"_"+c.y2,!1===m.hasOwnProperty(c.name)?(_.push(c),m[c.name]=c):(d=m[c.name],d.p.contat(c.p)),c=null);const A=[];for(T=0;T<_.length;++T){const n=_[T],u="sub_cea608_"+t++,c=document.createElement("div");c.id=u;const d=r(n);c.style.cssText="position: absolute; margin: 0; display: flex; box-sizing: border-box; pointer-events: none;"+d;const f=document.createElement("div");f.className="paragraph bodyStyle",f.style.cssText=s(e);const g=document.createElement("div");g.className="cueUniWrapper",g.style.cssText="unicode-bidi: normal; direction: ltr;";for(let t=0;t<n.p.length;++t){const r=n.p[t];let i=0;for(y=0;y<r.spans.length;++y){let t=r.spans[y];if(t.line.length>0){if(0!==y&&i!=t.row){const e=document.createElement("br");e.className="lineBreak",g.appendChild(e)}let n=!1;i===t.row&&(n=!0),i=t.row;const l=E[t.name],u=document.createElement("span");u.className="spanPadding "+t.name+" customSpanColor",u.style.cssText=s(e,l),0!==y&&n?y===r.spans.length-1?u.textContent=o(t.line):u.textContent=t.line:r.spans.length>1&&y<r.spans.length-1&&t.row===r.spans[y+1].row?u.textContent=a(t.line):u.textContent=t.line.trim(),g.appendChild(u)}}}f.appendChild(g),c.appendChild(f);const h={bodyStyle:["%",90]};for(const e in E)E.hasOwnProperty(e)&&(h[e]=["%",90]);A.push({type:"html",start:i,end:l,cueHTMLElement:c,cueID:u,cellResolution:[32,15],isFromCEA608:!0,fontSize:h,lineHeight:{},linePadding:{}})}return A}},e}de.__dashjs_factory_name="EmbeddedTextHtmlRender";var fe=R.getSingletonFactory(de);class ge{extend(e,t){if(!e)return;let n=!!t&&t.override,r=!!t&&t.publicOnly;for(const t in e)!e.hasOwnProperty(t)||this[t]&&!n||r&&-1===e[t].indexOf("public_")||(this[t]=e[t])}}let he=new class extends ge{constructor(){super(),this.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE=10,this.MANIFEST_LOADER_LOADING_FAILURE_ERROR_CODE=11,this.XLINK_LOADER_LOADING_FAILURE_ERROR_CODE=12,this.SEGMENTS_UPDATE_FAILED_ERROR_CODE=13,this.SEGMENTS_UNAVAILABLE_ERROR_CODE=14,this.SEGMENT_BASE_LOADER_ERROR_CODE=15,this.TIME_SYNC_FAILED_ERROR_CODE=16,this.FRAGMENT_LOADER_LOADING_FAILURE_ERROR_CODE=17,this.FRAGMENT_LOADER_NULL_REQUEST_ERROR_CODE=18,this.URL_RESOLUTION_FAILED_GENERIC_ERROR_CODE=19,this.APPEND_ERROR_CODE=20,this.REMOVE_ERROR_CODE=21,this.DATA_UPDATE_FAILED_ERROR_CODE=22,this.CAPABILITY_MEDIASOURCE_ERROR_CODE=23,this.CAPABILITY_MEDIAKEYS_ERROR_CODE=24,this.DOWNLOAD_ERROR_ID_MANIFEST_CODE=25,this.DOWNLOAD_ERROR_ID_SIDX_CODE=26,this.DOWNLOAD_ERROR_ID_CONTENT_CODE=27,this.DOWNLOAD_ERROR_ID_INITIALIZATION_CODE=28,this.DOWNLOAD_ERROR_ID_XLINK_CODE=29,this.MANIFEST_ERROR_ID_CODEC_CODE=30,this.MANIFEST_ERROR_ID_PARSE_CODE=31,this.MANIFEST_ERROR_ID_NOSTREAMS_CODE=32,this.TIMED_TEXT_ERROR_ID_PARSE_CODE=33,this.MANIFEST_ERROR_ID_MULTIPLEXED_CODE=34,this.MEDIASOURCE_TYPE_UNSUPPORTED_CODE=35,this.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE="parsing failed for ",this.MANIFEST_LOADER_LOADING_FAILURE_ERROR_MESSAGE="Failed loading manifest: ",this.XLINK_LOADER_LOADING_FAILURE_ERROR_MESSAGE="Failed loading Xlink element: ",this.SEGMENTS_UPDATE_FAILED_ERROR_MESSAGE="Segments update failed",this.SEGMENTS_UNAVAILABLE_ERROR_MESSAGE="no segments are available yet",this.SEGMENT_BASE_LOADER_ERROR_MESSAGE="error loading segments",this.TIME_SYNC_FAILED_ERROR_MESSAGE="Failed to synchronize time",this.FRAGMENT_LOADER_NULL_REQUEST_ERROR_MESSAGE="request is null",this.URL_RESOLUTION_FAILED_GENERIC_ERROR_MESSAGE="Failed to resolve a valid URL",this.APPEND_ERROR_MESSAGE="chunk is not defined",this.REMOVE_ERROR_MESSAGE="buffer is not defined",this.DATA_UPDATE_FAILED_ERROR_MESSAGE="Data update failed",this.CAPABILITY_MEDIASOURCE_ERROR_MESSAGE="mediasource is not supported",this.CAPABILITY_MEDIAKEYS_ERROR_MESSAGE="mediakeys is not supported",this.TIMED_TEXT_ERROR_MESSAGE_PARSE="parsing error :",this.MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE="Error creating source buffer of type : "}};function pe(){const e=this.context,t=b(e).getInstance();let n,r,i,s,a,o,l,u,c,d,f,g,h,p,m,E,_,T,S,I,R,N,D,C,v,O,L=!1;function P(){h=null,m=NaN,E=[],S=null,p=!1}function x(){P(),f=[],u=null}function U(e){const t=e.chunk;t.mediaInfo.embeddedCaptions&&q(t.bytes,t)}function B(){R=[],g=ce(e).getInstance(),g.setConfig({videoModel:_}),g.initialize(),i=W(e).getInstance(),I=null,N=0,C=[],D=null,L=!0,v=fe(e).getInstance();const n=T.getActiveStreamProcessors();for(const e in n)if("video"===n[e].getType()){O=n[e].getRepresentationInfo().MSETimeOffset;break}t.on(M.VIDEO_CHUNK_RECEIVED,U,this),t.on(M.BUFFER_CLEARED,j,this)}function k(e){I=e}function K(e,t){const n=new Y,r={subtitle:"subtitles",caption:"captions"};n.captionData=e,n.lang=t.lang,n.labels=t.labels,n.id=t.id?t.id:t.index,n.index=t.index,n.isTTML=function(){let e=!1;return t.codec&&t.codec.search(A.STPP)>=0&&(e=!0),t.mimeType&&t.mimeType.search(A.TTML)>=0&&(e=!0),e}(),n.defaultTrack=function(e){let t=!1;R.length>1&&e.isEmbedded?t=e.id&&e.id===A.CC1:1===R.length?e.id&&"string"==typeof e.id&&"CC"===e.id.substring(0,2)&&(t=!0):0===R.length&&(t=e.index===f[0].index);return t}(t),n.isFragmented=!a.getIsTextTrack(t.mimeType),n.isEmbedded=!!t.isEmbedded,n.kind=function(){let e=t.roles.length>0?r[t.roles[0]]:r.caption;return e=e===r.caption||e===r.subtitle?e:r.caption,e}(),n.roles=t.roles,n.accessibility=t.accessibility;const i=(f?f.length:0)+R.length;g.addTextTrack(n,i)}function q(e,t){let n,a,l,c,d,f,E;const T=t.mediaInfo,b=T.type,M=T.mimeType,w=T.codec||M;if(w){if(b===A.FRAGMENTED_TEXT)if(p||"InitializationSegment"!==t.segmentType){if(!p)return;if(f=i.getSamplesInfo(e),a=f.sampleList,null===S&&a.length>0&&(S=a[0].cts-t.start*m),w.search(A.STPP)>=0)for(u=null!==u?u:H(w),l=0;l<a.length;l++){const t=a[l],i=t.cts,s=i-S;this.buffered.add(s/m,(s+t.duration)/m);const d=new DataView(e,t.offset,t.subSizes[0]);E=V.Utils.dataViewToString(d,A.UTF8);const f=[];let p=t.offset+t.subSizes[0];for(c=1;c<t.subSizes.length;c++){const n=new Uint8Array(e,p,t.subSizes[c]),r=String.fromCharCode.apply(null,n);f.push(r),p+=t.subSizes[c]}try{const e=o.getValue().ttmlTimeIsRelative?i/m:0;n=u.parse(E,e,i/m,(i+t.duration)/m,f),g.addCaptions(I,S/m,n)}catch(e){h.removeExecutedRequestsBeforeTime(),this.remove(),r.error("TTML parser error: "+e.message)}}else{const t=[];for(l=0;l<a.length;l++){const n=a[l];n.cts-=S,this.buffered.add(n.cts/m,(n.cts+n.duration)/m);const i=e.slice(n.offset,n.offset+n.size),s=V.parseBuffer(i);for(c=0;c<s.boxes.length;c++){const e=s.boxes[c];if(r.debug("VTT box1: "+e.type),"vtte"!==e.type&&"vttc"===e.type)for(r.debug("VTT vttc boxes.length = "+e.boxes.length),d=0;d<e.boxes.length;d++){const i=e.boxes[d];if(r.debug("VTT box2: "+i.type),"payl"===i.type){const e=i.cue_text;r.debug("VTT cue_text = "+e);const s=n.cts/m,a=(n.cts+n.duration)/m;t.push({start:s,end:a,data:e,styles:{}}),r.debug("VTT "+s+"-"+a+" : "+e)}}}}t.length>0&&g.addCaptions(I,0,t)}}else p=!0,m=i.getMediaTimescaleFromMoov(e);else if(b===A.TEXT){const t=new DataView(e,0,e.byteLength);E=V.Utils.dataViewToString(t,A.UTF8);try{n=H(w).parse(E,0),g.addCaptions(g.getCurrentTrackIdx(),0,n)}catch(e){s.error(new G(he.TIMED_TEXT_ERROR_ID_PARSE_CODE,he.TIMED_TEXT_ERROR_MESSAGE_PARSE+e.message,E))}}else if(b===A.VIDEO)if(t.segmentType===F.INIT_SEGMENT_TYPE){if(0===N)for(N=i.getMediaTimescaleFromMoov(e),l=0;l<R.length;l++)K(null,R[l])}else{if(0===N)return void r.warn("CEA-608: No timescale for embeddedTextTrack yet");const t=function(e,t){return function(e,n,r){let i=null;if(_.getTTMLRenderingDiv())i=v.createHTMLCaptionsFromScreen(_.getElement(),e,n,r);else{i=[{start:e,end:n,data:r.getDisplayText(),styles:{}}]}i&&g.addCaptions(t,0,i)}};f=i.getSamplesInfo(e);const n=f.lastSequenceNumber;if(!C[0]&&!C[1]){let e,n;for(l=0;l<R.length;l++){if(R[l].id===A.CC1?n=g.getTrackIdxForId(A.CC1):R[l].id===A.CC3&&(n=g.getTrackIdxForId(A.CC3)),-1===n)return void r.warn("CEA-608: data before track is ready.");e=t(this,n),C[l]=new y.Cea608Parser(l+1,{newCue:e},null)}}if(N){if(null!==D&&n!==D+f.numSequences)for(l=0;l<C.length;l++)C[l]&&C[l].reset();const t=function(e,t){if(0===t.length)return null;const n={splits:[],fields:[[],[]]},r=new DataView(e);for(let e=0;e<t.length;e++){const i=t[e],s=y.findCea608Nalus(r,i.offset,i.size);let a=null,o=0;for(let e=0;e<s.length;e++){const t=y.extractCea608DataFromRange(r,s[e]);for(let e=0;e<2;e++)t[e].length>0&&(i.cts!==a?o=0:o+=1,n.fields[e].push([i.cts+O*N,t[e],o]),a=i.cts)}}return n.fields.forEach((function(e){e.sort((function(e,t){return e[0]===t[0]?e[2]-t[2]:e[0]-t[0]}))})),n}(e,f.sampleList);for(let e=0;e<C.length;e++){const n=t.fields[e],r=C[e];if(r)for(l=0;l<n.length;l++)r.addData(n[l][0]/N,n[l][1])}D=n}}}else r.error("No text type defined")}function H(e){let t;return e.search(A.VTT)>=0?t=c:(e.search(A.TTML)>=0||e.search(A.STPP)>=0)&&(t=d),t}function j(e){R.forEach((function(t){const n=g.getTrackIdxForId(t.id);n>=0&&g.deleteCuesFromTrackIdx(n,e.from,e.to)}))}return n={initialize:function(t,r,s,o){L||B(),g.setConfig({videoModel:_}),g.initialize(),i||(i=W(e).getInstance()),function(t,r,i,s){const o=!a.getIsTextTrack(t);if(f=f.concat(i),o){h=s,n.buffered=Z(e).create(),E=l.getTracksFor(A.FRAGMENTED_TEXT,r);const t=l.getCurrentTrackFor(A.FRAGMENTED_TEXT,r);for(let e=0;e<E.length;e++)if(E[e]===t){k(e);break}}for(let e=0;e<f.length;e++)K(null,f[e])}(t,r,s,o)},append:q,abort:function(){g.deleteAllTextTracks(),P(),i=null,f=[]},addEmbeddedTrack:function(e){if(L||B(),e)if(e.id===A.CC1||e.id===A.CC3){for(let t=0;t<R.length;t++)if(R[t].id===e.id)return;R.push(e)}else r.warn("Embedded track "+e.id+" not supported!")},resetEmbedded:function(){t.off(M.VIDEO_CHUNK_RECEIVED,U,this),t.off(M.BUFFER_CLEARED,j,this),g&&g.deleteAllTextTracks(),L=!1,R=[],C=[null,null],D=null},setConfig:function(e){e&&(e.errHandler&&(s=e.errHandler),e.adapter&&(a=e.adapter),e.manifestModel&&(o=e.manifestModel),e.mediaController&&(l=e.mediaController),e.videoModel&&(_=e.videoModel),e.streamController&&(T=e.streamController),e.textTracks&&(g=e.textTracks),e.vttParser&&(c=e.vttParser),e.ttmlParser&&(d=e.ttmlParser))},getConfig:function(){return{fragmentModel:h,fragmentedTracks:E,videoModel:_}},setCurrentFragmentedTrackIdx:k,remove:function(e,t){void 0===e&&e===t&&(e=this.buffered.start(0),t=this.buffered.end(this.buffered.length-1)),this.buffered.remove(e,t)},reset:function(){x(),T=null,_=null,g=null}},r=w(e).getInstance().getLogger(n),x(),n}pe.__dashjs_factory_name="TextSourceBuffer";var me=R.getSingletonFactory(pe);function Ee(){const e=this.context;let t,n,r,i,s,a;function o(e){const t=e.split(":"),n=t.length-1;return e=60*parseInt(t[n-1],10)+parseFloat(t[n]),2===n&&(e+=3600*parseInt(t[0],10)),e}function l(e){const t=e.split(i),n=t[1].split(a);return n.shift(),t[1]=n[0],n.shift(),{cuePoints:t,styles:u(n)}}function u(e){const t={};return e.forEach((function(e){if(e.split(/:/).length>1){let n=e.split(/:/)[1];n&&-1!=n.search(/%/)&&(n=parseInt(n.replace(/%/,""),10)),(e.match(/align/)||e.match(/A/))&&(t.align=n),(e.match(/line/)||e.match(/L/))&&(t.line=n),(e.match(/position/)||e.match(/P/))&&(t.position=n),(e.match(/size/)||e.match(/S/))&&(t.size=n)}})),t}function c(e,t){let n,r=t,s="",a="";for(;""!==e[r]&&r<e.length;)r++;if(n=r-t,n>1)for(let r=0;r<n;r++){if(a=e[t+r],a.match(i)){s="";break}s+=a,r!==n-1&&(s+="\n")}else a=e[t],a.match(i)||(s=a);return s}return t={parse:function(e){const t=[];let a,u;if(!e)return t;a=(e=e.split(r)).length,u=-1;for(let r=0;r<a;r++){let a=e[r];if(a.length>0&&"WEBVTT"!==a&&a.match(i)){const i=l(a),d=i.cuePoints,f=i.styles,g=c(e,r+1),h=o(d[0].replace(s,"")),p=o(d[1].replace(s,""));!isNaN(h)&&!isNaN(p)&&h>=u&&p>h?""!==g?(u=h,t.push({start:h,end:p,data:g,styles:f})):n.error("Skipping cue due to empty/malformed cue text"):n.error("Skipping cue due to incorrect cue timing")}}return t}},n=w(e).getInstance().getLogger(t),r=/(?:\r\n|\r|\n)/gm,i=/-->/,s=/(^[\s]+|[\s]+$)/g,a=/\s\b/g,t}Ee.__dashjs_factory_name="VTTParser";var _e=R.getSingletonFactory(Ee),Te={LEVELS:{SUGGESTION:"Suggestion",WARNING:"Warning",ERROR:"Error"},EVENTS:{NO_UTC_TIMING_ELEMENT:{key:"NO_UTC_TIMING_ELEMENT",message:"No UTCTiming element is present in the manifest. You may experience playback failures. For a detailed validation use https://conformance.dashif.org/"},NON_COMPLIANT_SMPTE_IMAGE_ATTRIBUTE:{key:"NON_COMPLIANT_SMPTE_IMAGE_ATTRIBUTE",message:'SMPTE 2052-1:2013 defines the attribute name as "imageType" and does not define "imagetype"'}}};function ye(){const e=this.context,t=b(e).getInstance();let n,r,i=0;function s(){const e="cue_TTML_"+i;return i++,e}return n={parse:function(e,n,i,a,o){let l="";const u=[];let c,d,f;const g={},h={};let p="",m="",E={onOpenTag:function(e,n,i){if(i[" imagetype"]&&!i[" imageType"]&&(t.trigger(D.CONFORMANCE_VIOLATION,{level:Te.LEVELS.ERROR,event:Te.EVENTS.NON_COMPLIANT_SMPTE_IMAGE_ATTRIBUTE}),i[" imageType"]=i[" imagetype"]),"image"===n&&("http://www.smpte-ra.org/schemas/2052-1/2010/smpte-tt"===e||"http://www.smpte-ra.org/schemas/2052-1/2013/smpte-tt"===e)){if(!i[" imageType"]||"PNG"!==i[" imageType"].value)return void r.warn("smpte-tt imageType != PNG. Discarded");p=i["http://www.w3.org/XML/1998/namespace id"].value}},onCloseTag:function(){p&&(h[p]=m.trim()),m="",p=""},onText:function(e){p&&(m+=e)}};if(!e)throw l="no ttml data to parse",new Error(l);g.data=e,t.trigger(M.TTML_TO_PARSE,g);const _=oe(g.data,(function(e){l=e}),E);t.trigger(M.TTML_PARSED,{ttmlString:g.data,ttmlDoc:_});const T=_.getMediaTimeEvents();for(f=0;f<T.length;f++){let e=ae(_,T[f],(function(e){l=e}));e.contents.some(e=>e.contents.length)&&(c=T[f]+n<i?i:T[f]+n,d=T[f+1]+n>a?a:T[f+1]+n,c<d&&u.push({start:c,end:d,type:"html",cueID:s(),isd:e,images:o,embeddedImages:h}))}if(""!==l)throw r.error(l),new Error(l);return u}},r=w(e).getInstance().getLogger(n),n}ye.__dashjs_factory_name="TTMLParser";var Ae=R.getSingletonFactory(ye);function Se(){let e,t,n,r,i,s,a,o,l,u,c,d,f,g,h,p,m,E,_,T,y,S=this.context;function I(e){void 0===y&&null!==e.fromStreamInfo&&(y=this.getCurrentTrackIdx())}function R(){void 0===y&&(y=this.getCurrentTrackIdx())}function N(){void 0!==y&&(this.setTextTrack(y),y=void 0)}function D(e){let t=e.tracks,n=e.index;f&&t.some((e,t)=>{if(s.matchSettings(f,e))return this.setTextTrack(t),n=t,!0}),(!1===p||void 0===p&&!f||T)&&this.setTextTrack(-1),h=n,d.trigger(M.TEXT_TRACKS_ADDED,{enabled:v(),index:n,tracks:t}),_=!0}function C(e){if(!g&&e&&e.newMediaInfo){let t=e.newMediaInfo;t.type===A.FRAGMENTED_TEXT&&(f={lang:t.lang,role:t.roles[0],accessibility:t.accessibility[0]})}}function v(){let e=!0;return m&&!E&&(e=!1),e}function O(){m=!0,_=!1,T=!1}return e={setConfig:function(e){e&&(e.errHandler&&(n=e.errHandler),e.adapter&&(r=e.adapter),e.manifestModel&&(i=e.manifestModel),e.mediaController&&(s=e.mediaController),e.videoModel&&(a=e.videoModel),e.streamController&&(o=e.streamController),e.textTracks&&(l=e.textTracks),e.vttParser&&(u=e.vttParser),e.ttmlParser&&(c=e.ttmlParser),t.setConfig({errHandler:n,adapter:r,manifestModel:i,mediaController:s,videoModel:a,streamController:o,textTracks:l,vttParser:u,ttmlParser:c}))},getTextSourceBuffer:function(){return t},getAllTracksAreDisabled:function(){return m},addEmbeddedTrack:function(e){t.addEmbeddedTrack(e)},getTextDefaultLanguage:function(){return f&&f.lang||""},setTextDefaultLanguage:function(e){X(e,"string"),f||(f={}),f.lang=e,g=!0},setTextDefaultEnabled:function(e){X(e,"boolean"),p=e,p?m=!1:this.setTextTrack(-1)},getTextDefaultEnabled:function(){return void 0!==p&&p},setInitialSettings:function(e){f=e,g=!0},enableText:function(e){X(e,"boolean"),!p&&e&&(p=!0),v()!==e&&(e&&this.setTextTrack(h),e||(h=this.getCurrentTrackIdx(),_?this.setTextTrack(-1):T=!0))},isTextEnabled:v,setTextTrack:function(e){let n,r,i=t.getConfig(),a=i.fragmentModel,u=i.fragmentedTracks,c=i.videoModel;m=-1===e;let d=l.getCurrentTrackIdx();if(d!==e){m&&s&&s.saveTextSettingsDisabled(),l.setModeForTrackIdx(d,A.TEXT_HIDDEN),l.setCurrentTrackIdx(e),l.setModeForTrackIdx(e,A.TEXT_SHOWING);let i=l.getCurrentTrackInfo();if(i&&i.isFragmented&&!i.isEmbedded)for(let e=0;e<u.length;e++){let n=u[e];if(i.lang===n.lang&&i.index===n.index&&(n.id?i.id===n.id:i.id===n.index)){if(n!==s.getCurrentTrackFor(A.FRAGMENTED_TEXT,o.getActiveStreamInfo()))a.abortRequests(),a.removeExecutedRequestsBeforeTime(),t.remove(),l.deleteCuesFromTrackIdx(d),s.setTrack(n),t.setCurrentFragmentedTrackIdx(e);else if(-1===d){const e=o.getActiveStreamProcessors();for(let t=0;t<e.length;t++)if(e[t].getType()===A.FRAGMENTED_TEXT){r=e[t];break}r.setBufferingTime(c.getTime()),r.getScheduleController().start()}}}else if(i&&!i.isFragmented){const e=o.getActiveStreamProcessors();for(let t=0;t<e.length;t++)if(e[t].getType()===A.TEXT){r=e[t],n=r.getMediaInfoArr();break}if(r&&n)for(let e=0;e<n.length;e++)if(n[e].index===i.index&&n[e].lang===i.lang){r.selectMediaInfo(n[e]);break}}}},getCurrentTrackIdx:function(){return l.getCurrentTrackIdx()},enableForcedTextStreaming:function(e){X(e,"boolean"),E=e},reset:function(){O(),t.resetEmbedded(),t.reset()}},f=null,h=-1,E=!1,_=!1,g=!1,T=!1,l=ce(S).getInstance(),u=_e(S).getInstance(),c=Ae(S).getInstance(),t=me(S).getInstance(),d=b(S).getInstance(),l.initialize(),d.on(M.TEXT_TRACKS_QUEUE_INITIALIZED,D,e),d.on(M.CURRENT_TRACK_CHANGED,C,e),d.on(M.PERIOD_SWITCH_STARTED,I,e),d.on(M.STREAM_COMPLETED,R,e),d.on(M.PERIOD_SWITCH_COMPLETED,N,e),O(),e}Se.__dashjs_factory_name="TextController";var Ie=R.getSingletonFactory(Se);function Re(e,t,n,r){const i=this.context,s=b(i).getInstance();let a,o,l,u,c,d,f=[],g=[],h=n;function p(){try{return u.buffered}catch(e){return l.error("getAllBufferRanges exception: "+e.message),null}}function m(t){u&&S(()=>{try{let n=e.duration,r=0;t&&!isNaN(t.start)&&!isNaN(t.duration)&&isFinite(t.duration)&&(n=t.start+t.duration),t&&!isNaN(t.start)&&(r=t.start),u.appendWindowStart=0,u.appendWindowEnd=n,u.appendWindowStart=r,l.debug(`Updated append window. Set start to ${u.appendWindowStart} and end to ${u.appendWindowEnd}`)}catch(e){l.warn("Failed to set append window")}})}function E(){const e=this;if(g.length>0){c=!0;const t=g[0];g.splice(0,1);let n=[];const r=function(){const r=p();!function(e,t,n,r){t&&t.length>0&&t.length<n.length&&function(e,t){for(let n=0;n<e.length;n++){const r=Math.round(e.start(n)),i=Math.round(e.end(n));if(i===t.start||r===t.end||t.start>=r&&t.end<=i)return!0}return!1}(t,r)&&s.trigger(M.SOURCEBUFFER_REMOVE_COMPLETED,{buffer:e,from:n.end(n.length-2),to:n.start(n.length-1),unintended:!0})}(e,n,r,t),g.length>0?E.call(this):(c=!1,h&&h({chunk:t}))};try{0===t.bytes.length?r.call(this):(n=p(),u.appendBuffer?u.appendBuffer(t.bytes):u.append(t.bytes,t),S(r.bind(this)))}catch(e){l.fatal('SourceBuffer append failed "'+e+'"'),g.length>0?E():c=!1,h&&h({chunk:t,error:new G(e.code,e.message)})}}}function _(){if(f.length>0){const e=f.shift();u.updating?S(e):(e(),_())}}function T(){u.updating||_()}function y(){u.updating||_()}function A(){l.error("SourceBufferSink error")}function S(e){f.push(e),u.updating||_()}return a={getType:function(){return o},getAllBufferRanges:p,getBuffer:function(){return u},append:function(e){e?(g.push(e),c||S(E.bind(this))):h({chunk:e,error:new G(he.APPEND_ERROR_CODE,he.APPEND_ERROR_MESSAGE)})},remove:function(t,n,r){const i=this;S((function(){try{t>=0&&n>t&&(r||"ended"!==e.readyState)&&u.remove(t,n),S((function(){s.trigger(M.SOURCEBUFFER_REMOVE_COMPLETED,{buffer:i,from:t,to:n,unintended:!1})}))}catch(e){s.trigger(M.SOURCEBUFFER_REMOVE_COMPLETED,{buffer:i,from:t,to:n,unintended:!1,error:new G(e.code,e.message)})}}))},abort:function(){try{("open"===e.readyState||u.setTextTrack&&"ended"===e.readyState)&&u.abort()}catch(e){l.error('SourceBuffer append abort failed: "'+e+'"')}g=[]},reset:function(t){if(u){if("function"==typeof u.removeEventListener&&(u.removeEventListener("updateend",y,!1),u.removeEventListener("error",A,!1),u.removeEventListener("abort",A,!1)),clearInterval(d),f=[],!t){try{u.getClassName&&"TextSourceBuffer"===u.getClassName()||(l.debug("Removing sourcebuffer from media source"),e.removeSourceBuffer(u))}catch(e){l.error("Failed to remove source buffer from media source.")}u=null}c=!1}g=[],h=null},updateTimestampOffset:function(e){u.timestampOffset===e||isNaN(e)||S(()=>{e<0&&(e+=.001),u.timestampOffset=e})},hasDiscontinuitiesAfter:function(e){try{const t=p();if(t&&t.length>1)for(let n=0,r=t.length;n<r;n++)if(n>0&&e<t.start(n)&&t.start(n)>t.end(n-1)+.1)return!0}catch(e){l.error("hasDiscontinuities exception: "+e.message)}return!1},waitForUpdateEnd:S,updateAppendWindow:m},function(){l=w(i).getInstance().getLogger(a),c=!1,o=t.type;const n=t.codec;try{if(n.match(/application\/mp4;\s*codecs="(stpp|wvtt).*"/i))throw new Error("not really supported");u=r||e.addSourceBuffer(n),u.changeType&&r&&(l.debug("Doing period transition with changeType"),u.changeType(n)),m();const t=50;if("function"==typeof u.addEventListener)try{u.addEventListener("updateend",y,!1),u.addEventListener("error",A,!1),u.addEventListener("abort",A,!1)}catch(e){d=setInterval(T,t)}else d=setInterval(T,t)}catch(e){if(!t.isText&&-1===n.indexOf('codecs="stpp')&&-1===n.indexOf('codecs="wvtt'))throw e;{const e=Ie(i).getInstance();u=e.getTextSourceBuffer()}}}(),a}Re.__dashjs_factory_name="SourceBufferSink";const Ne=R.getClassFactory(Re);function De(e){const t=this.context;let n,r,i,s=[],a=e;function o(e,t){s=s.filter(n=>!((isNaN(t)||n.start<t)&&(isNaN(e)||n.end>e)))}return n={getAllBufferRanges:function(){let e=[];for(let t=0;t<s.length;t++){let n=s[t];0===e.length||n.start>e[e.length-1].end?e.push({start:n.start,end:n.end}):e[e.length-1].end=n.end}const t={start:function(t){return e[t].start},end:function(t){return e[t].end}};return Object.defineProperty(t,"length",{get:function(){return e.length}}),t},append:function(e){"InitializationSegment"!==e.segmentType?(s.push(e),s.sort((function(e,t){return e.start-t.start})),i=null):i=e,r.debug("PreBufferSink appended chunk s: "+e.start+"; e: "+e.end),a&&a({chunk:e})},remove:o,abort:function(){},discharge:function(e,t){const n=function(e,t){return s.filter(n=>(isNaN(t)||n.start<t)&&(isNaN(e)||n.end>e))}(e,t);return i&&(n.push(i),i=null),o(e,t),n},reset:function(){s=[],i=null,a=null},updateTimestampOffset:function(){},hasDiscontinuitiesAfter:function(){return!1},waitForUpdateEnd:function(e){e()},getBuffer:function(){return this}},r=w(t).getInstance().getLogger(n),n}De.__dashjs_factory_name="PreBufferSink";const Ce=R.getClassFactory(De),be={DEFAULT:.5,STRONG:1,WEAK:0};function ve(e,t,n){let r,i,s,a;return i=void 0===e?-1:e,s=function(e){let t=be.DEFAULT;return e!==be.DEFAULT&&e!==be.STRONG&&e!==be.WEAK||(t=e),t}(n),a=void 0===t?null:t,r={quality:i,reason:a,priority:s},r}ve.__dashjs_factory_name="SwitchRequest";const Me=R.getClassFactory(ve);function Oe(e){e=e||{};const t=this.context,n=e.dashMetrics;let r,i;return r={getMaxIndex:function(e){const r=Me(t).create();if(!(e&&e.hasOwnProperty("getMediaInfo")&&e.hasOwnProperty("getMediaType")&&e.hasOwnProperty("useBufferOccupancyABR")&&e.hasOwnProperty("getAbrController")&&e.hasOwnProperty("getScheduleController")))return r;!function(){if(!n||!n.hasOwnProperty("getCurrentBufferState"))throw new Error(A.MISSING_CONFIG_ERROR)}();const s=e.getMediaInfo(),a=e.getMediaType(),o=n.getCurrentBufferState(a),l=e.getScheduleController(),u=e.getAbrController(),c=e.getStreamInfo(),d=c&&c.manifestInfo?c.manifestInfo.isDynamic:null,f=u.getThroughputHistory(),g=f.getSafeAverageThroughput(a,d),h=f.getAverageLatency(a),p=e.useBufferOccupancyABR();return isNaN(g)||!o||p||u.getAbandonmentStateFor(a)!==I.ABANDON_LOAD&&(o.state===I.BUFFER_LOADED||d)&&(r.quality=u.getQualityForBitrate(s,g,h),l.setTimeToLoadDelay(0),i.debug("["+a+"] requesting switch to index: ",r.quality,"Average throughput",Math.round(g),"kbps"),r.reason={throughput:g,latency:h}),r},reset:function(){}},i=w(t).getInstance().getLogger(r),r}Me.NO_CHANGE=-1,Me.PRIORITY=be,R.updateClassFactory(ve.__dashjs_factory_name,Me),Oe.__dashjs_factory_name="ThroughputRule";var we=R.getClassFactory(Oe);function Le(e){e=e||{};const t=this.context,n=b(t).getInstance(),r=e.dashMetrics;let i,s,a;function o(){a={},a[A.VIDEO]={ignoreCount:2},a[A.AUDIO]={ignoreCount:2}}function l(){o()}function u(e){isNaN(e.startTime)||e.mediaType!==A.AUDIO&&e.mediaType!==A.VIDEO||a[e.mediaType].ignoreCount>0&&a[e.mediaType].ignoreCount--}return i={getMaxIndex:function(e){const n=Me(t).create();if(!e||!e.hasOwnProperty("getMediaType"))return n;!function(){if(!r||!r.hasOwnProperty("getCurrentBufferLevel")||!r.hasOwnProperty("getCurrentBufferState"))throw new Error(A.MISSING_CONFIG_ERROR)}();const i=e.getMediaType(),o=r.getCurrentBufferState(i),l=e.getRepresentationInfo().fragmentDuration;if(function(e){return a[e].ignoreCount>0}(i)||!l)return n;if(o&&o.state===I.BUFFER_EMPTY)s.debug("["+i+"] Switch to index 0; buffer is empty."),n.quality=0,n.reason="InsufficientBufferRule: Buffer is empty";else{const t=e.getMediaInfo(),s=e.getAbrController(),a=s.getThroughputHistory(),o=r.getCurrentBufferLevel(i),u=a.getAverageThroughput(i),c=a.getAverageLatency(i),d=u*(o/l)*.5;n.quality=s.getQualityForBitrate(t,d,c),n.reason="InsufficientBufferRule: being conservative to avoid immediate rebuffering"}return n},reset:function(){o(),n.off(M.PLAYBACK_SEEKING,l,i),n.off(M.BYTES_APPENDED_END_FRAGMENT,u,i)}},s=w(t).getInstance().getLogger(i),o(),n.on(M.PLAYBACK_SEEKING,l,i),n.on(M.BYTES_APPENDED_END_FRAGMENT,u,i),i}Le.__dashjs_factory_name="InsufficientBufferRule";var Pe=R.getClassFactory(Le);function Fe(e){e=e||{};const t=this.context,n=e.mediaPlayerModel,r=e.dashMetrics,i=e.settings;let s,a,o,l,u;function c(){o={},l={},u=[]}return s={shouldAbandon:function(e){const s=Me(t).create(Me.NO_CHANGE,{name:Fe.__dashjs_factory_name});if(!(e&&e.hasOwnProperty("getMediaInfo")&&e.hasOwnProperty("getMediaType")&&e.hasOwnProperty("getCurrentRequest")&&e.hasOwnProperty("getRepresentationInfo")&&e.hasOwnProperty("getAbrController")))return s;const c=e.getMediaInfo(),d=e.getMediaType(),f=e.getCurrentRequest();if(!isNaN(f.index)){g=d,h=f.index,o[g]=o[g]||{},o[g][h]=o[g][h]||{};const t=n.getStableBufferTime();if(r.getCurrentBufferLevel(d)>t)return s;const p=o[d][f.index];if(null===p||null===f.firstByteDate||l.hasOwnProperty(p.id))return s;if(void 0===p.firstByteTime&&(u[d]=[],p.firstByteTime=f.firstByteDate.getTime(),p.segmentDuration=f.duration,p.bytesTotal=f.bytesTotal,p.id=f.index),p.bytesLoaded=f.bytesLoaded,p.elapsedTime=(new Date).getTime()-p.firstByteTime,p.bytesLoaded>0&&p.elapsedTime>0&&function(e,t){u[e]=u[e]||[],u[e].push(t)}(d,Math.round(8*p.bytesLoaded/p.elapsedTime)),u[d].length>=5&&p.elapsedTime>500&&p.bytesLoaded<p.bytesTotal){const t=u[d].reduce((e,t)=>e+t,0);if(p.measuredBandwidthInKbps=Math.round(t/u[d].length),p.estimatedTimeOfDownload=+(8*p.bytesTotal/p.measuredBandwidthInKbps/1e3).toFixed(2),p.estimatedTimeOfDownload<1.8*p.segmentDuration||0===e.getRepresentationInfo().quality)return s;if(!l.hasOwnProperty(p.id)){const t=e.getAbrController(),n=p.bytesTotal-p.bytesLoaded,r=t.getBitrateList(c),u=t.getQualityForBitrate(c,p.measuredBandwidthInKbps*i.get().streaming.abr.bandwidthSafetyFactor),f=t.getMinAllowedIndexFor(d),g=void 0!==f?Math.max(f,u):u;n>p.bytesTotal*r[g].bitrate/r[t.getQualityFor(d)].bitrate&&(s.quality=g,s.reason.throughput=p.measuredBandwidthInKbps,s.reason.fragmentID=p.id,l[p.id]=p,a.debug("["+d+"] frag id",p.id," is asking to abandon and switch to quality to ",g," measured bandwidth was",p.measuredBandwidthInKbps),delete o[d][p.id])}}else p.bytesLoaded===p.bytesTotal&&delete o[d][p.id]}var g,h;return s},reset:c},a=w(t).getInstance().getLogger(s),c(),s}Fe.__dashjs_factory_name="AbandonRequestsRule";var xe=R.getClassFactory(Fe);function Ue(){const e=this.context;let t,n;return t={getMaxIndex:function(t){const r=Me(e).create();if(!t||!t.hasOwnProperty("getDroppedFramesHistory"))return r;const i=t.getDroppedFramesHistory();if(i){const t=i.getFrameHistory();let r=0,s=0,a=Me.NO_CHANGE;for(let e=1;e<t.length;e++)if(t[e]&&(r=t[e].droppedVideoFrames,s=t[e].totalVideoFrames,s>375&&r/s>.15)){a=e-1,n.debug("index: "+a+" Dropped Frames: "+r+" Total Frames: "+s);break}return Me(e).create(a,{droppedFrames:r})}return r}},n=w(e).getInstance().getLogger(t),t}Ue.__dashjs_factory_name="DroppedFramesRule";var Be=R.getClassFactory(Ue);function ke(){const e=this.context;let t,n;return t={getMaxIndex:function(t){const r=t?t.getSwitchHistory():null,i=r?r.getSwitchRequests():[];let s=0,a=0,o=0;const l=Me(e).create();for(let e=0;e<i.length;e++)if(void 0!==i[e]&&(s+=i[e].drops,a+=i[e].noDrops,o+=i[e].dropSize,s+a>=6&&s/a>.075)){l.quality=e>0&&i[e].drops>0?e-1:e,l.reason={index:l.quality,drops:s,noDrops:a,dropSize:o},n.debug("Switch history rule index: "+l.quality+" samples: "+(s+a)+" drops: "+s);break}return l}},n=w(e).getInstance().getLogger(t),t}ke.__dashjs_factory_name="SwitchHistoryRule";var Ge=R.getClassFactory(ke);function Ye(e){e=e||{};const t=this.context,n=e.dashMetrics,r=e.mediaPlayerModel,i=b(t).getInstance();let s,a,o;function l(e,t,n){const r=n.reduce((e,t,r)=>t>n[e]?r:e,0);if(0===r)return null;const i=Math.max(e,10+2*t.length),s=(n[r]-1)/(i/10-1);return{gp:s,Vp:10/s}}function u(e){const t={},n=e.getMediaInfo().bitrateList.map(e=>e.bandwidth);let i=function(e){return e.map(e=>Math.log(e))}(n);i=i.map(e=>e-i[0]+1);const s=r.getStableBufferTime(),a=l(s,n,i);return a?(t.state=1,t.bitrates=n,t.utilities=i,t.stableBufferTime=s,t.Vp=a.Vp,t.gp=a.gp,t.lastQuality=0,c(t)):t.state=0,t}function c(e){e.placeholderBuffer=0,e.mostAdvancedSegmentStart=NaN,e.lastSegmentWasReplacement=!1,e.lastSegmentStart=NaN,e.lastSegmentDurationS=NaN,e.lastSegmentRequestTimeMs=NaN,e.lastSegmentFinishTimeMs=NaN}function d(e,t){const i=r.getStableBufferTime();if(e.stableBufferTime!==i){const r=l(i,e.bitrates,e.utilities);if(r.Vp!==e.Vp||r.gp!==e.gp){const s=n.getCurrentBufferLevel(t);let a=s+e.placeholderBuffer;a-=10,a*=r.Vp/e.Vp,a+=10,e.stableBufferTime=i,e.Vp=r.Vp,e.gp=r.gp,e.placeholderBuffer=Math.max(0,a-s)}}}function f(e,t){return e.Vp*(e.utilities[t]+e.gp)}function g(e,t){const n=e.bitrates[t],r=e.utilities[t];let i=0;for(let s=t-1;s>=0;--s)if(e.utilities[s]<e.utilities[t]){const t=e.bitrates[s],a=e.utilities[s],o=e.Vp*(e.gp+(n*a-t*r)/(n-t));i=Math.max(i,o)}return i}function h(){for(const e in o)o.hasOwnProperty(e)&&2===o[e].state&&(o[e].placeholderBuffer=0)}function p(){for(const e in o)if(o.hasOwnProperty(e)){const t=o[e];0!==t.state&&(t.state=1,c(t))}}function m(e){if(e&&e.chunk&&e.chunk.mediaInfo){const t=o[e.chunk.mediaInfo.type];if(t&&0!==t.state){const n=e.chunk.start;isNaN(t.mostAdvancedSegmentStart)||n>t.mostAdvancedSegmentStart?(t.mostAdvancedSegmentStart=n,t.lastSegmentWasReplacement=!1):t.lastSegmentWasReplacement=!0,t.lastSegmentStart=n,t.lastSegmentDurationS=e.chunk.duration,t.lastQuality=e.chunk.quality,_(t,e.chunk.mediaInfo.type)}}}function E(e){if(e&&e.metric===I.HTTP_REQUEST&&e.value&&e.value.type===F.MEDIA_SEGMENT_TYPE&&e.value.trace&&e.value.trace.length){const t=o[e.mediaType];t&&0!==t.state&&(t.lastSegmentRequestTimeMs=e.value.trequest.getTime(),t.lastSegmentFinishTimeMs=e.value._tfinish.getTime(),_(t,e.mediaType))}}function _(e,t){if(!isNaN(e.lastSegmentStart)&&!isNaN(e.lastSegmentRequestTimeMs)&&!isNaN(e.placeholderBuffer)){if(e.placeholderBuffer*=.99,!isNaN(e.lastSegmentFinishTimeMs)){const r=n.getCurrentBufferLevel(t)+.001*(e.lastSegmentFinishTimeMs-e.lastSegmentRequestTimeMs),i=f(e,e.lastQuality),s=Math.max(0,i-r);e.placeholderBuffer=Math.min(s,e.placeholderBuffer)}e.lastSegmentWasReplacement&&!isNaN(e.lastSegmentDurationS)&&(e.placeholderBuffer+=e.lastSegmentDurationS),e.lastSegmentStart=NaN,e.lastSegmentRequestTimeMs=NaN}}function T(e){if(e){const t=o[e.mediaType];t&&0!==t.state&&(t.abrQuality=e.newQuality)}}function y(e){if(e){const t=o[e.mediaType];if(t&&0!==t.state){const r=n.getCurrentBufferLevel(e.mediaType);let i;i=t.abrQuality>0?g(t,t.abrQuality):10;const s=Math.max(0,i-r);t.placeholderBuffer=Math.min(t.placeholderBuffer,s)}}}function A(){o={}}return s={getMaxIndex:function(e){const r=Me(t).create();if(!(e&&e.hasOwnProperty("getMediaInfo")&&e.hasOwnProperty("getMediaType")&&e.hasOwnProperty("getScheduleController")&&e.hasOwnProperty("getStreamInfo")&&e.hasOwnProperty("getAbrController")&&e.hasOwnProperty("useBufferOccupancyABR")))return r;const i=e.getMediaInfo(),s=e.getMediaType(),l=e.getScheduleController(),h=e.getStreamInfo(),p=e.getAbrController(),m=p.getThroughputHistory(),E=h?h.id:null,_=h&&h.manifestInfo&&h.manifestInfo.isDynamic,T=e.useBufferOccupancyABR();if(r.reason=r.reason||{},!T)return r;l.setTimeToLoadDelay(0);const y=function(e){const t=e.getMediaType();let n=o[t];return n?0!==n.state&&d(n,t):(n=u(e),o[t]=n),n}(e);if(0===y.state)return r;const A=n.getCurrentBufferLevel(s),S=m.getAverageThroughput(s,_),I=m.getSafeAverageThroughput(s,_),R=m.getAverageLatency(s);let N;if(r.reason.state=y.state,r.reason.throughput=S,r.reason.latency=R,isNaN(S))return r;switch(y.state){case 1:N=p.getQualityForBitrate(i,I,R),r.quality=N,r.reason.throughput=I,y.placeholderBuffer=Math.max(0,g(y,N)-A),y.lastQuality=N,!isNaN(y.lastSegmentDurationS)&&A>=y.lastSegmentDurationS&&(y.state=2);break;case 2:!function(e,t){const n=Date.now();if(isNaN(e.lastSegmentFinishTimeMs)){if(!isNaN(e.lastCallTimeMs)){const t=.001*(n-e.lastCallTimeMs);e.placeholderBuffer+=Math.max(0,t)}}else{const t=.001*(n-e.lastSegmentFinishTimeMs);e.placeholderBuffer+=Math.max(0,t)}e.lastCallTimeMs=n,e.lastSegmentStart=NaN,e.lastSegmentRequestTimeMs=NaN,e.lastSegmentFinishTimeMs=NaN,d(e,t)}(y,s),N=function(e,t){const n=e.bitrates.length;let r=NaN,i=NaN;for(let s=0;s<n;++s){let n=(e.Vp*(e.utilities[s]+e.gp)-t)/e.bitrates[s];(isNaN(i)||n>=i)&&(i=n,r=s)}return r}(y,A+y.placeholderBuffer);const e=p.getQualityForBitrate(i,I,R);N>y.lastQuality&&N>e&&(N=Math.max(e,y.lastQuality));let t=Math.max(0,A+y.placeholderBuffer-f(y,N));t<=y.placeholderBuffer?(y.placeholderBuffer-=t,t=0):(t-=y.placeholderBuffer,y.placeholderBuffer=0,N<p.getTopQualityIndexFor(s,E)?l.setTimeToLoadDelay(1e3*t):t=0),r.quality=N,r.reason.throughput=S,r.reason.latency=R,r.reason.bufferLevel=A,r.reason.placeholderBuffer=y.placeholderBuffer,r.reason.delay=t,y.lastQuality=N;break;default:a.debug("BOLA ABR rule invoked in bad state."),r.quality=p.getQualityForBitrate(i,I,R),r.reason.state=y.state,r.reason.throughput=I,r.reason.latency=R,y.state=1,c(y)}return r},reset:function(){A(),i.off(M.BUFFER_EMPTY,h,s),i.off(M.PLAYBACK_SEEKING,p,s),i.off(M.MEDIA_FRAGMENT_LOADED,m,s),i.off(M.METRIC_ADDED,E,s),i.off(M.QUALITY_CHANGE_REQUESTED,T,s),i.off(M.FRAGMENT_LOADING_ABANDONED,y,s)}},a=w(t).getInstance().getLogger(s),A(),i.on(M.BUFFER_EMPTY,h,s),i.on(M.PLAYBACK_SEEKING,p,s),i.on(M.MEDIA_FRAGMENT_LOADED,m,s),i.on(M.METRIC_ADDED,E,s),i.on(M.QUALITY_CHANGE_REQUESTED,T,s),i.on(M.FRAGMENT_LOADING_ABANDONED,y,s),s}Ye.__dashjs_factory_name="BolaRule";var Ke=R.getClassFactory(Ye);function qe(e){e=e||{};const t=this.context,n=e.dashMetrics,r=b(t).getInstance();let i,s,a,o;function l(e){const t={},n=e.getMediaInfo(),r=n.bitrateList.map(e=>e.bandwidth/1e3);return t.state=1,t.bitrates=r,t.lastQuality=0,function(e){if(!e||!e.type)return;a[e.type]={},a[e.type].w=[],a[e.type].prev_w=[],a[e.type].Q=0,a[e.type].segment_request_start_s=0,a[e.type].segment_download_finish_s=0,a[e.type].B_target=1.5}(n),u(t),t}function u(e){e.placeholderBuffer=0,e.mostAdvancedSegmentStart=NaN,e.lastSegmentWasReplacement=!1,e.lastSegmentStart=NaN,e.lastSegmentDurationS=NaN,e.lastSegmentRequestTimeMs=NaN,e.lastSegmentFinishTimeMs=NaN}function c(){for(const e in s)if(s.hasOwnProperty(e)){const t=s[e];0!==t.state&&(t.state=1,u(t))}}function d(e){if(e&&e.chunk&&e.chunk.mediaInfo){const t=s[e.chunk.mediaInfo.type],n=a[e.chunk.mediaInfo.type];if(t&&0!==t.state){const r=e.chunk.start;isNaN(t.mostAdvancedSegmentStart)||r>t.mostAdvancedSegmentStart?(t.mostAdvancedSegmentStart=r,t.lastSegmentWasReplacement=!1):t.lastSegmentWasReplacement=!0,t.lastSegmentStart=r,t.lastSegmentDurationS=e.chunk.duration,t.lastQuality=e.chunk.quality,g(t,n)}}}function f(e){if(e&&e.metric===I.HTTP_REQUEST&&e.value&&e.value.type===F.MEDIA_SEGMENT_TYPE&&e.value.trace&&e.value.trace.length){const t=s[e.mediaType],n=a[e.mediaType];t&&0!==t.state&&(t.lastSegmentRequestTimeMs=e.value.trequest.getTime(),t.lastSegmentFinishTimeMs=e.value._tfinish.getTime(),g(t,n))}}function g(e,t){isNaN(e.lastSegmentStart)||isNaN(e.lastSegmentRequestTimeMs)||(t.segment_request_start_s=.001*e.lastSegmentRequestTimeMs,t.segment_download_finish_s=.001*e.lastSegmentFinishTimeMs,e.lastSegmentStart=NaN,e.lastSegmentRequestTimeMs=NaN)}function h(e){if(e&&e.mediaType){const t=s[e.mediaType];t&&0!==t.state&&(t.abrQuality=e.newQuality)}}function p(e,t){if(e.length!==t.length)return-1;let n=0;for(let r=0;r<e.length;r++)n+=e[r]*t[r];return n}function m(){s={},a={}}return i={getMaxIndex:function(e){const r=Me(t).create(),i=Math.pow(4,.99),c=Math.max(Math.pow(4,1),i*Math.sqrt(4)),d=e.getMediaInfo(),f=e.getMediaType(),g=d.bitrateList.map(e=>e.bandwidth),h=g.length,m=e.getScheduleController(),E=e.getStreamInfo(),_=e.getAbrController(),T=_.getThroughputHistory(),y=E&&E.manifestInfo&&E.manifestInfo.isDynamic,S=e.useL2AABR(),I=n.getCurrentBufferLevel(f,!0),R=T.getSafeAverageThroughput(f,y),N=T.getAverageThroughput(f,y),D=T.getAverageLatency(f);let C,b=e.getVideoModel().getPlaybackRate();if(!(e&&e.hasOwnProperty("getMediaInfo")&&e.hasOwnProperty("getMediaType")&&e.hasOwnProperty("getScheduleController")&&e.hasOwnProperty("getStreamInfo")&&e.hasOwnProperty("getAbrController")&&e.hasOwnProperty("useL2AABR")))return r;if(r.reason=r.reason||{},!S||f===A.AUDIO)return r;m.setTimeToLoadDelay(0);const v=function(e){const t=e.getMediaType();let n=s[t];return n||(n=l(e),s[t]=n),n}(e);if(0===v.state)return r;const M=a[f];if(!M)return r;if(r.reason.state=v.state,r.reason.throughput=N,r.reason.latency=D,isNaN(N))return r;switch(v.state){case 1:if(C=_.getQualityForBitrate(d,R,D),r.quality=C,r.reason.throughput=R,v.lastQuality=C,!isNaN(v.lastSegmentDurationS)&&I>=M.B_target){v.state=2,M.Q=i;for(let e=0;e<h;++e)e===v.lastQuality?M.prev_w[e]=1:M.prev_w[e]=0}break;case 2:let e=[],t=n.getCurrentHttpRequest(f).trace.reduce((e,t)=>e+t.d,0);const s=n.getCurrentHttpRequest(f).trace.reduce((e,t)=>e+t.b[0],0);let a=Math.round(8*s/t);a<1&&(a=1);let l=v.lastSegmentDurationS,m=1;for(let e=0;e<h;++e)g[e]=g[e]/1e3,b*g[e]>a&&(m=-1),M.w[e]=M.prev_w[e]+m*(l/(2*c))*((M.Q+i)*(b*g[e]/a));M.w=function(e){const t=e.length;let n=!1,r=[];for(let n=0;n<t;++n)r[n]=e[n];let i=e.sort((function(e,t){return t-e})),s=0,a=0,o=[];for(let e=0;e<t-1;++e)if(s+=i[e],a=(s-1)/(e+1),a>=i[e+1]){n=!0;break}n||(a=(s+i[t-1]-1)/t);for(let e=0;e<t;++e)o[e]=Math.max(r[e]-a,0);return o}(M.w);for(let t=0;t<h;++t)e[t]=M.w[t]-M.prev_w[t],M.prev_w[t]=M.w[t];M.Q=Math.max(0,M.Q-l+l*b*((p(g,M.prev_w)+p(g,e))/a));let E=[];for(let e=0;e<h;++e)E[e]=Math.abs(g[e]-p(M.w,g));C=E.indexOf(Math.min(...E)),C>v.lastQuality&&g[v.lastQuality+1]<=a&&(C=v.lastQuality+1),g[C]>=a&&(M.Q=2*Math.max(i,M.Q)),r.quality=C,r.reason.throughput=N,r.reason.latency=D,r.reason.bufferLevel=I,v.lastQuality=r.quality;break;default:o.debug("L2A ABR rule invoked in bad state."),r.quality=_.getQualityForBitrate(d,R,D),r.reason.state=v.state,r.reason.throughput=R,r.reason.latency=D,v.state=1,u(v)}return r},reset:function(){m(),r.off(M.PLAYBACK_SEEKING,c,i),r.off(M.MEDIA_FRAGMENT_LOADED,d,i),r.off(M.METRIC_ADDED,f,i),r.off(M.QUALITY_CHANGE_REQUESTED,h,i)}},o=w(t).getInstance().getLogger(i),m(),r.on(M.PLAYBACK_SEEKING,c,i),r.on(M.MEDIA_FRAGMENT_LOADED,d,i),r.on(M.METRIC_ADDED,f,i),r.on(M.QUALITY_CHANGE_REQUESTED,h,i),i}qe.__dashjs_factory_name="L2ARule";var He=R.getClassFactory(qe);const Ve="manual_weight_selection",je="random_weight_selection",ze="dynamic_weight_selection";function We(){const e=this.context;let t,n,r,i,s,a,o,l,u;function c(){r=null,i=1,s=100,a=0,o=null,l=null,u=ze}function d(){let e=0;if(r)for(let t=0;t<r.length;t++){let n=r[t];n.state.throughput>e&&(e=n.state.throughput)}return e}function f(e,t,n){let r=e.map((e,r)=>n[r]*Math.pow(e-t[r],2)).reduce((e,t)=>e+t);return(r<0?-1:1)*Math.sqrt(Math.abs(r))}function g(e,t){return f([e.state.throughput,e.state.latency,e.state.rebuffer,e.state.switch],[t.state.throughput,t.state.latency,t.state.rebuffer,t.state.switch],[1,1,1,1])}function h(e,t,n){for(let r=0;r<t.length;r++){let i=t[r],s=.1;const a=g(i,e);p(i,n,Math.exp(-1*Math.pow(a,2)/(2*Math.pow(s,2))))}}function p(e,t,n){let r=e.state,i=[.01,.01,.01,.01];r.throughput=r.throughput+(t[0]-r.throughput)*i[0]*n,r.latency=r.latency+(t[1]-r.latency)*i[1]*n,r.rebuffer=r.rebuffer+(t[2]-r.rebuffer)*i[2]*n,r.switch=r.switch+(t[3]-r.switch)*i[3]*n}function m(e,t,n,r,i,s,a){o||(o=l[l.length-1]);let u=e.findWeightVector(t,n,r,i,s,a);null!==u&&-1!==u&&(o=u)}return t={getNextQuality:function(e,t,c,g,p,E,_){let T=c,y=g,A=t,S=function(e){if(!r){r=[];const t=e.bitrateList;let n=[];a=t[0].bandwidth,t.forEach(e=>{n.push(e.bandwidth),e.bandwidth<a&&(a=e.bandwidth)}),i=function(e){const t=e.map(e=>Math.pow(e,2)).reduce((e,t)=>e+t);return Math.sqrt(t)}(n);for(let e=0;e<t.length;e++){let n={qualityIndex:e,bitrate:t[e].bandwidth,state:{throughput:t[e].bandwidth/i,latency:0,rebuffer:0,switch:0}};r.push(n)}l=function(e){let t=[],n=function(e){let t=[];for(let n=0;n<e;n++){let e=[Math.random()*d(),Math.random(),Math.random(),Math.random()];t.push(e)}return t}(Math.pow(e.length,2));t.push(n[0]);let r=[1,1,1,1];for(let i=1;i<e.length;i++){let e=null,i=null;for(let s=0;s<n.length;s++){let a=n[s],o=null;for(let e=0;e<t.length;e++){let n=f(a,t[e],r);(null===o||n<o)&&(o=n)}(null===i||o>i)&&(e=a,i=o)}t.push(e)}let i=null,s=null;for(let e=0;e<t.length;e++){let n=0;for(let i=0;i<t.length;i++)e!==i&&(n+=f(t[e],t[i],r));(null===i||n>i)&&(i=n,s=e)}let a=[];a.push(t[s]),t.splice(s,1);for(;t.length>0;){let e=null,n=null;for(let i=0;i<t.length;i++){let s=f(a[0],t[i],r);(null===e||s<e)&&(e=s,n=i)}a.push(t[n]),t.splice(n,1)}return a}(r)}return r}(e),I=t/i;I>1&&(I=d()),c/=s,n.debug(`getNextQuality called throughput:${I} latency:${c} bufferSize:${g} currentQualityIndex:${E} playbackRate:${p}`);let R=S[E],N=R.bitrate*_.getSegmentDuration()/A,D=Math.max(0,N-y);if(y-N<_.getMinBuffer())return n.debug(`Buffer is low for bitrate= ${R.bitrate} downloadTime=${N} currentBuffer=${y} rebuffer=${D}`),function(e,t){let n=0,i=e;if(r)for(let s=0;s<r.length;s++){let a=r[s];a.bitrate<e.bitrate&&a.bitrate>n&&t>a.bitrate&&(n=a.bitrate,i=a)}return i}(R,A).qualityIndex;switch(u){case Ve:o=[.4,.4,.4,.4];break;case je:!function(e){o=function(e,t){let n=[],r=Math.sqrt(2/e);for(let e=0;e<t;e++)n.push(Math.random()*r);return o=n,o}(e.length,4)}(S);break;case ze:m(_,S,T,y,D,A,p);break;default:m(_,S,T,y,D,A,p)}let C=null,b=null,v=null;for(let e=0;e<S.length;e++){let r=S[e],i=r.state,s=[i.throughput,i.latency,i.rebuffer,i.switch],l=o.slice(),u=_.getNextBufferWithBitrate(r.bitrate,y,A),c=u<_.getMinBuffer();c&&n.debug(`Buffer is low for bitrate=${r.bitrate} downloadTime=${N} currentBuffer=${y} nextBuffer=${u}`),(r.bitrate>t-1e4||c)&&r.bitrate!==a&&(l[0]=100);let d=f(s,[I,0,0,0],l);(null===C||d<C)&&(C=d,b=r.qualityIndex,v=r)}let M=Math.abs(R.bitrate-v.bitrate)/i;return h(R,S,[I,c,D,M]),h(v,S,[I,0,0,M]),b},reset:function(){c()}},n=w(e).getInstance().getLogger(t),c(),t}We.__dashjs_factory_name="LearningAbrController";var Xe=R.getClassFactory(We);class Qe{constructor(){this.type=null,this.lastBitrate=null,this.weights={},this.weights.bitrateReward=null,this.weights.bitrateSwitchPenalty=null,this.weights.rebufferPenalty=null,this.weights.latencyPenalty=null,this.weights.playbackSpeedPenalty=null,this.bitrateWSum=0,this.bitrateSwitchWSum=0,this.rebufferWSum=0,this.latencyWSum=0,this.playbackSpeedWSum=0,this.totalQoe=0}}function $e(){let e,t,n,r,i;function s(){t=null,n=null,r=null,i=null}function a(e,t,n,r){let i=new Qe;return i.type=e,i.weights.bitrateReward=t||1,i.weights.bitrateSwitchPenalty=1,i.weights.rebufferPenalty=n||1e3,i.weights.latencyPenalty=[],i.weights.latencyPenalty.push({threshold:1.1,penalty:.05*r}),i.weights.latencyPenalty.push({threshold:1e8,penalty:.1*n}),i.weights.playbackSpeedPenalty=r||200,i}function o(e,t,n,r,i){i.bitrateWSum+=i.weights.bitrateReward*e,i.lastBitrate&&(i.bitrateSwitchWSum+=i.weights.bitrateSwitchPenalty*Math.abs(e-i.lastBitrate)),i.lastBitrate=e,i.rebufferWSum+=i.weights.rebufferPenalty*t;for(let e=0;e<i.weights.latencyPenalty.length;e++){let t=i.weights.latencyPenalty[e];if(n<=t.threshold){i.latencyWSum+=t.penalty*n;break}}i.playbackSpeedWSum+=i.weights.playbackSpeedPenalty*Math.abs(1-r),i.totalQoe=i.bitrateWSum-i.bitrateSwitchWSum-i.rebufferWSum-i.latencyWSum-i.playbackSpeedWSum}return e={setupPerSegmentQoe:function(e,s,o){t=a("segment",e,s,o),n=e,r=s,i=o},logSegmentMetrics:function(e,n,r,i){t&&o(e,n,r,i,t)},getPerSegmentQoe:function(){return t},calculateSingleUseQoe:function(e,t,s,l){let u=null;return n&&r&&i&&(u=a("segment",n,r,i)),u?(o(e,t,s,l,u),u.totalQoe):0},reset:function(){s()}},s(),e}$e.__dashjs_factory_name="LoLpQoeEvaluator";var Ze=R.getClassFactory($e);function Je(e){let t,n,r,i,s,a=e.targetLatency,o=e.bufferMin,l=e.segmentDuration,u=e.qoeEvaluator;function c(){return l}function d(e,t){const n=c();let r;return r=t>n?e-n:e+n-t,r}return t={getMinBuffer:function(){return o},getSegmentDuration:c,getNextBufferWithBitrate:function(e,t,n){return d(t,e*l/n)},getNextBuffer:d,findWeightVector:function(e,t,n,r,c,f){let g=null,h=null,p=null,m=Math.abs(t-s);return e.forEach(e=>{i.forEach(r=>{r[0];let i,s=r[1],E=r[2],_=(r[3],e.bitrate*l/c),T=d(n,_);i=0===E?10:1/E;let y=i*Math.max(1e-5,_-T);i=0===s?10:1/s;let A=i*e.state.latency,S=u.calculateSingleUseQoe(e.bitrate,y,A,f);(null===g||S>g)&&function(e,t,n){if(e>a+n)return!1;return t>=o}(t,T,m)&&(g=S,h=r,p=e.bitrate)})}),null===h&&null===p&&(h=-1),s=t,h}},n=[.2,.4,.6,.8,1],r=4,i=function(e,t){let n=e.map((function(e){return[e]})),r=function(t,n,i){if(i===n)return t;let s=t.length;for(let n=0;n<s;n++){let n=t.shift();for(let r=0;r<e.length;r++)t.push(n.concat(e[r]))}return r(t,n,i+1)};return r(n,t,1)}(n,4),s=0,t}Je.__dashjs_factory_name="LoLpWeightSelector";var et=R.getClassFactory(Je);function tt(e){let t,n,r,i,s=(e=e||{}).dashMetrics,a=this.context;return n={getMaxIndex:function(e){try{let n=Me(a).create(),o=e.getMediaInfo().type,l=e.getAbrController();const u=e.getStreamInfo();let c=l.getQualityFor(o,u);const d=e.getMediaInfo(),f=s.getCurrentBufferState(o),g=e.getScheduleController(),h=s.getCurrentBufferLevel(o,!0),p=u&&u.manifestInfo?u.manifestInfo.isDynamic:null,m=g.getPlaybackController();let E=m.getCurrentLiveLatency();if(!e.useLoLPABR()||o===A.AUDIO)return n;E||(E=0);const _=m.getPlaybackRate(),T=l.getThroughputHistory().getSafeAverageThroughput(o,p);if(t.debug(`Throughput ${Math.round(T)} kbps`),isNaN(T)||!f)return n;if(l.getAbandonmentStateFor(o)===I.ABANDON_LOAD)return n;let y=d.bitrateList,S=e.getRepresentationInfo().fragmentDuration,R=y[0].bandwidth/1e3,N=y[y.length-1].bandwidth/1e3;for(let e=0;e<y.length;e++){let t=y[e].bandwidth/1e3;t>N?N=t:t<R&&(R=t)}let D=y[c].bandwidth/1e3,C=s.getCurrentHttpRequest(o,!0),b=(C.tresponse.getTime()-C.trequest.getTime())/1e3,v=b>S?b-S:0;i.setupPerSegmentQoe(S,N,R),i.logSegmentMetrics(D,v,E,_);let M=et(a).create({targetLatency:1.5,bufferMin:.3,segmentDuration:S,qoeEvaluator:i});return n.quality=r.getNextQuality(d,1e3*T,E,h,_,c,M),n.reason={throughput:T,latency:E},n.priority=Me.PRIORITY.STRONG,g.setTimeToLoadDelay(0),n.quality!==c&&console.log("[TgcLearningRule]["+o+"] requesting switch to index: ",n.quality,"Average throughput",Math.round(T),"kbps"),n}catch(e){throw e}},reset:function(){r.reset(),i.reset()}},t=w(a).getInstance().getLogger(n),r=Xe(a).create(),i=Ze(a).create(),n}tt.__dashjs_factory_name="LoLPRule";var nt=R.getClassFactory(tt);function rt(e){e=e||{};const t=this.context,n=e.mediaPlayerModel,r=e.dashMetrics,i=e.settings;let s,a,o;function l(e){return e.filter(e=>e.quality>Me.NO_CHANGE)}function u(e){const n={};let r,i,s,a,o,l=null;if(0!==e.length){for(n[Me.PRIORITY.STRONG]={quality:Me.NO_CHANGE,reason:null},n[Me.PRIORITY.WEAK]={quality:Me.NO_CHANGE,reason:null},n[Me.PRIORITY.DEFAULT]={quality:Me.NO_CHANGE,reason:null},r=0,i=e.length;r<i;r+=1)s=e[r],s.quality!==Me.NO_CHANGE&&(n[s.priority].quality===Me.NO_CHANGE||n[s.priority].quality>s.quality)&&(n[s.priority].quality=s.quality,n[s.priority].reason=s.reason||null);return n[Me.PRIORITY.WEAK].quality!==Me.NO_CHANGE&&(l=n[Me.PRIORITY.WEAK]),n[Me.PRIORITY.DEFAULT].quality!==Me.NO_CHANGE&&(l=n[Me.PRIORITY.DEFAULT]),n[Me.PRIORITY.STRONG].quality!==Me.NO_CHANGE&&(l=n[Me.PRIORITY.STRONG]),l&&(a=l.quality,o=l.reason),Me(t).create(a,o)}}return s={initialize:function(){a=[],o=[],i.get().streaming.abr.useDefaultABRRules&&(i.get().streaming.abr.ABRStrategy===A.ABR_STRATEGY_L2A?a.push(He(t).create({dashMetrics:r,mediaPlayerModel:n,settings:i})):i.get().streaming.abr.ABRStrategy===A.ABR_STRATEGY_LoLP?a.push(nt(t).create({dashMetrics:r})):(a.push(Ke(t).create({dashMetrics:r,mediaPlayerModel:n,settings:i})),a.push(we(t).create({dashMetrics:r})),a.push(Pe(t).create({dashMetrics:r})),a.push(Ge(t).create()),a.push(Be(t).create()),o.push(xe(t).create({dashMetrics:r,mediaPlayerModel:n,settings:i})))),n.getABRCustomRules().forEach((function(e){"qualitySwitchRules"===e.type&&a.push(e.rule(t).create()),"abandonFragmentRules"===e.type&&o.push(e.rule(t).create())}))},reset:function(){[a,o].forEach(e=>{e&&e.length&&e.forEach(e=>e.reset&&e.reset())}),a=[],o=[]},getMaxQuality:function(e){return u(l(a.map(t=>t.getMaxIndex(e))))||Me(t).create()},getMinSwitchRequest:u,shouldAbandonFragment:function(e){return u(l(o.map(t=>t.shouldAbandon(e))))||Me(t).create()},getQualitySwitchRules:function(){return a}},s}rt.__dashjs_factory_name="ABRRulesCollection";const it=R.getClassFactory(rt);it.QUALITY_SWITCH_RULES="qualitySwitchRules",it.ABANDON_FRAGMENT_RULES="abandonFragmentRules",R.updateSingletonFactory(rt.__dashjs_factory_name,it);class st{constructor(){this.mediaType=null,this.bitrate=null,this.width=null,this.height=null,this.scanType=null,this.qualityIndex=NaN}}function at(e){let t;const n=(e=e||{}).abrController,r=e.switchHistory,i=e.droppedFramesHistory,s=e.currentRequest,a=e.useBufferOccupancyABR,o=e.useL2AABR,l=e.useLoLPABR,u=e.streamProcessor?e.streamProcessor.getScheduleController():null,c=e.streamProcessor?e.streamProcessor.getRepresentationInfo():null,d=e.videoModel?e.videoModel:null;function f(){return c?c.mediaInfo:null}return t={getMediaType:function(){const e=f();return e?e.type:null},getMediaInfo:f,getDroppedFramesHistory:function(){return i},getCurrentRequest:function(){return s},getSwitchHistory:function(){return r},getStreamInfo:function(){const e=f();return e?e.streamInfo:null},getScheduleController:function(){return u},getAbrController:function(){return n},getRepresentationInfo:function(){return c},useBufferOccupancyABR:function(){return a},useL2AABR:function(){return o},useLoLPABR:function(){return l},getVideoModel:function(){return d}},t}at.__dashjs_factory_name="RulesContext";var ot=R.getClassFactory(at);function lt(){let e=[],t=[];return{push:function(n){n.newValue===Me.NO_CHANGE&&(n.newValue=n.oldValue),e[n.oldValue]||(e[n.oldValue]={noDrops:0,drops:0,dropSize:0});let r=n.newValue-n.oldValue,i=r<0?1:0,s=i?-r:0,a=i?0:1;if(e[n.oldValue].drops+=i,e[n.oldValue].dropSize+=s,e[n.oldValue].noDrops+=a,t.push({idx:n.oldValue,noDrop:a,drop:i,dropSize:s}),t.length>8){let n=t.shift();e[n.idx].drops-=n.drop,e[n.idx].dropSize-=n.dropSize,e[n.idx].noDrops-=n.noDrop}},getSwitchRequests:function(){return e},reset:function(){e=[],t=[]}}}lt.__dashjs_factory_name="SwitchRequestHistory";const ut=R.getClassFactory(lt);function ct(){let e=[],t=0,n=0;return{push:function(r,i){let s=i&&i.droppedVideoFrames?i.droppedVideoFrames:0,a=i&&i.totalVideoFrames?i.totalVideoFrames:0,o=s-t;t=s;let l=a-n;n=a,isNaN(r)||(e[r]?(e[r].droppedVideoFrames+=o,e[r].totalVideoFrames+=l):e[r]={droppedVideoFrames:o,totalVideoFrames:l})},getFrameHistory:function(){return e},reset:function(r){e=[],t=r.droppedVideoFrames,n=r.totalVideoFrames}}}ct.__dashjs_factory_name="DroppedFramesHistory";const dt=R.getClassFactory(ct);function ft(e){const t=(e=e||{}).settings;let n,r,i,s,a;function o(e,t,n,r){const i=Math.pow(.5,n/r.fast);e.fastEstimate=(1-i)*t+i*e.fastEstimate;const s=Math.pow(.5,n/r.slow);e.slowEstimate=(1-s)*t+s*e.slowEstimate,e.totalWeight+=n}function l(e,o,l){return t.get().streaming.abr.movingAverageMethod!==A.MOVING_AVERAGE_SLIDING_WINDOW?function(e,t){const n=e?a.throughputHalfLife:a.latencyHalfLife,r=e?i[t]:s[t];if(!r||r.totalWeight<=0)return NaN;const o=r.fastEstimate/(1-Math.pow(.5,r.totalWeight/n.fast)),l=r.slowEstimate/(1-Math.pow(.5,r.totalWeight/n.slow));return e?Math.min(o,l):Math.max(o,l)}(e,o):function(e,t,i){const s=function(e,t,i){let s,a;if(e?(s=n[t],a=i?3:4):(s=r[t],a=4),s){if(a>=s.length)a=s.length;else if(e)for(let e=1;e<a;++e){const t=s[s.length-e]/s[s.length-e-1];if((t>=1.3||t<=1/1.3)&&(a+=1,a===s.length))break}}else a=0;return a}(e,t,i);let a=(e?n:r)[t];if(0===s||!a||0===a.length)return NaN;return a=a.slice(-s),a.reduce((e,t)=>e+t)/a.length}(e,o,l)}function u(e,t){return l(!0,e,t)}function c(e){n[e]=n[e]||[],r[e]=r[e]||[],i[e]=i[e]||{fastEstimate:0,slowEstimate:0,totalWeight:0},s[e]=s[e]||{fastEstimate:0,slowEstimate:0,totalWeight:0}}function d(){n={},r={},i={},s={}}const f={push:function(e,l,u){if(!l.trace||!l.trace.length)return;const d=l.tresponse.getTime()-l.trequest.getTime()||1,f=l._tfinish.getTime()-l.tresponse.getTime()||1,g=l.trace.reduce((e,t)=>e+t.b[0],0);let h;h=t.get().streaming.lowLatencyEnabled?l.trace.reduce((e,t)=>e+t.d,0):u?f:d+f;const p=Math.round(8*g/h);if(c(e),function(e,n,r){return e===A.VIDEO?r<t.get().streaming.cacheLoadThresholds[A.VIDEO]:e===A.AUDIO?r<t.get().streaming.cacheLoadThresholds[A.AUDIO]:void 0}(e,0,f)){if(n[e].length>0&&!n[e].hasCachedEntries)return;n[e].hasCachedEntries=!0}else n[e]&&n[e].hasCachedEntries&&function(e){delete n[e],delete r[e],delete i[e],delete s[e],c(e)}(e);n[e].push(p),n[e].length>20&&n[e].shift(),r[e].push(d),r[e].length>20&&r[e].shift(),o(i[e],p,.001*f,a.throughputHalfLife),o(s[e],d,1,a.latencyHalfLife)},getAverageThroughput:u,getSafeAverageThroughput:function(e,n){let r=u(e,n);return isNaN(r)||(r*=t.get().streaming.abr.bandwidthSafetyFactor),r},getAverageLatency:function(e){return l(!1,e)},reset:d};return a={throughputHalfLife:{fast:3,slow:8},latencyHalfLife:{fast:1,slow:2}},d(),f}ft.__dashjs_factory_name="ThroughputHistory";var gt=R.getClassFactory(ft);function ht(){const e=this.context,t=w(e).getInstance(),n=b(e).getInstance();let r,i,s,a,o,l,u,c,d,f,g,h,p,m,E,_,T,y,S,R,N,D,C,v,O;function L(){s=it(e).create({dashMetrics:v,mediaPlayerModel:E,settings:O}),s.initialize()}function P(){o={},l={},c={},u={},y={},N={},D={},C={},void 0===f&&(f=!1),T=void 0,S=void 0,R=void 0,clearTimeout(d),d=null}function x(e){e.mediaType===A.VIDEO&&(void 0!==T&&S.push(T,m.getPlaybackQuality()),T=e.newQuality)}function U(e){e.metric!==I.HTTP_REQUEST||!e.value||e.value.type!==F.MEDIA_SEGMENT_TYPE||e.mediaType!==A.AUDIO&&e.mediaType!==A.VIDEO||R.push(e.mediaType,e.value,O.get().streaming.abr.useDeadTimeLatency),e.metric!==I.BUFFER_LEVEL||e.mediaType!==A.AUDIO&&e.mediaType!==A.VIDEO||function(e,t){const n=O.get().streaming.abr.ABRStrategy;if(n===A.ABR_STRATEGY_L2A)return N[e]=!1,C[e]=!1,void(D[e]=!0);if(n===A.ABR_STRATEGY_LoLP)return N[e]=!1,C[e]=!0,void(D[e]=!1);if(n===A.ABR_STRATEGY_BOLA)return N[e]=!0,C[e]=!1,void(D[e]=!1);if(n===A.ABR_STRATEGY_THROUGHPUT)return N[e]=!1,C[e]=!1,void(D[e]=!1);!function(e,t){const n=E.getStableBufferTime(),r=n,s=.5*n,a=N[e],o=t>(a?s:r);N[e]=o,o!==a&&(o?i.info("["+e+"] switching from throughput to buffer occupancy ABR rule (buffer: "+t.toFixed(3)+")."):i.info("["+e+"] switching from buffer occupancy to throughput ABR rule (buffer: "+t.toFixed(3)+")."))}(e,t)}(e.mediaType,.001*e.value.level)}function B(e,t){let n;return o[t]=o[t]||{},o[t].hasOwnProperty(e)||(o[t][e]=0),n=function(e,t){let n=e;if(!u[t])return n;const r=Y(t);void 0!==r&&(n=Math.max(e,r));const i=G(t);void 0!==i&&(n=Math.min(n,i));return n}(o[t][e],e),n=function(e,t,n){const r=O.get().streaming.abr.maxRepresentationRatio[t];if(isNaN(r)||r>=1||r<0)return e;return Math.min(e,Math.round(n*r))}(n,e,o[t][e]),n=function(e,t){if(t!==A.VIDEO||!O.get().streaming.abr.limitBitrateByPortal||!u[t])return e;f||Z();const n=p.getAdaptationForType(0,t).Representation;let r=e;if(g>0&&h>0){for(;r>0&&n[r]&&g<n[r].width&&g-n[r-1].width<n[r].width-g;)r-=1;for(;r<n.length-1&&n[r].width===n[r+1].width;)r+=1}return r}(n,e),n}function G(e){const t=function(e){return O.get().streaming.abr.maxBitrate[e]}(e);return t>-1?V(u[e].getMediaInfo(),t):void 0}function Y(e){const t=function(e){return O.get().streaming.abr.minBitrate[e]}(e);if(t>-1){const n=u[e].getMediaInfo(),r=j(n);let i=V(n,t);return r[i]&&i<r.length-1&&r[i].bitrate<1e3*t&&i++,i}}function K(e,t,n,r){const i=t.id,s=$(e);Q(n);const a=B(e,i);n!==s&&n>=0&&n<=a&&q(e,s,n,a,r)}function q(e,t,r,s,a){if(e&&u[e]){const o=u[e].getStreamInfo(),c=o?o.id:null;if(O.get().debug.logLevel===w.LOG_LEVEL_DEBUG){const n=v.getCurrentBufferLevel(e);i.info("["+e+"] switch from "+t+" to "+r+"/"+s+" (buffer: "+n+") "+(a?JSON.stringify(a):"."))}!function(e,t,n){l[t]=l[t]||{},l[t][e]=n}(e,c,r),n.trigger(M.QUALITY_CHANGE_REQUESTED,{oldQuality:t,newQuality:r,reason:a},{streamId:o.id,mediaType:e});const d=R.getAverageThroughput(e);isNaN(d)||_.setSavedBitrateSettings(e,d)}}function H(e,t){c[e].state=t}function V(e,t,n){const r=e&&e.type?u[e.type].getRepresentationInfo():null;if(O.get().streaming.abr.useDeadTimeLatency&&n&&r&&r.fragmentDuration){n/=1e3;const e=r.fragmentDuration;if(n>e)return 0;t*=1-n/e}const i=j(e);for(let e=i.length-1;e>=0;e--){if(1e3*t>=i[e].bitrate)return e}return 0}function j(e){const t=[];if(!e||!e.bitrateList)return t;const n=e.bitrateList,r=e.type;let i;for(let e=0,s=n.length;e<s;e++)i=new st,i.mediaType=r,i.qualityIndex=e,i.bitrate=n[e].bandwidth,i.width=n[e].width,i.height=n[e].height,i.scanType=n[e].scanType,t.push(i);return t}function z(e){return N[e]}function W(e){return D[e]}function X(e){return C[e]}function $(e){if(e&&u[e]){const t=u[e].getStreamInfo(),n=t?t.id:null;let r;if(n)return l[n]=l[n]||{},l[n].hasOwnProperty(e)||(l[n][e]=0),r=l[n][e],r}return 0}function Z(){if(m){const e=O.get().streaming.abr.usePixelRatioInLimitBitrateByPortal&&window.hasOwnProperty("devicePixelRatio")?window.devicePixelRatio:1;g=m.getClientWidth()*e,h=m.getClientHeight()*e}}function J(t){const n=t.request.mediaType;if(O.get().streaming.abr.autoSwitchBitrate[n]){const i=u[n];if(!i)return;const o=ot(e).create({abrController:r,streamProcessor:i,currentRequest:t.request,useBufferOccupancyABR:z(n),useL2AABR:W(n),useLoLPABR:X(n),videoModel:m}),l=s.shouldAbandonFragment(o);if(l.quality>Me.NO_CHANGE){const e=i.getFragmentModel();e.getRequests({state:k.FRAGMENT_MODEL_LOADING,index:t.request.index})[0]&&(e.abortRequests(),H(n,I.ABANDON_LOAD),y[n].reset(),y[n].push({oldValue:$(n),newValue:l.quality,confidence:1,reason:l.reason}),K(n,a.getActiveStreamInfo(),l.quality,l.reason),clearTimeout(d),d=setTimeout(()=>{H(n,I.ALLOW_LOAD),d=null},O.get().streaming.abandonLoadTimeout))}}}return r={isPlayingAtTopQuality:function(e){const t=e?e.id:null,n=$(A.AUDIO),r=$(A.VIDEO);return n===B(A.AUDIO,t)&&r===B(A.VIDEO,t)},updateTopQualityIndex:function(e){const t=e.type,n=e.streamInfo.id,r=e.representationCount-1;return function(e,t,n){o[t]=o[t]||{},o[t][e]=n}(t,n,r),r},getThroughputHistory:function(){return R},getBitrateList:j,getQualityForBitrate:V,getTopBitrateInfoFor:function(e){if(e&&u&&u[e]){const t=u[e].getStreamInfo();if(t&&t.id){const n=B(e,t.id),r=j(u[e].getMediaInfo());return r[n]?r[n]:null}}return null},getMaxAllowedIndexFor:G,getMinAllowedIndexFor:Y,getInitialBitrateFor:function(e){if(function(){if(!_||!_.hasOwnProperty("getSavedBitrateSettings"))throw new Error(A.MISSING_CONFIG_ERROR)}(),e===A.TEXT||e===A.FRAGMENTED_TEXT)return NaN;const t=_.getSavedBitrateSettings(e);let n=O.get().streaming.abr.initialBitrate[e],r=O.get().streaming.abr.initialRepresentationRatio[e];if(-1===n)if(r>-1){const t=p.getAdaptationForType(0,e).Representation;if(Array.isArray(t)){n=t[Math.max(Math.round(t.length*r)-1,0)].bandwidth}else n=0}else n=isNaN(t)?e===A.VIDEO?1e3:100:t;return n},getQualityFor:$,getAbandonmentStateFor:function(e){return c[e]?c[e].state:null},setPlaybackQuality:K,checkPlaybackQuality:function(t){if(t&&u&&u[t]){const n=u[t].getStreamInfo(),a=n?n.id:null,o=$(t),l=ot(e).create({abrController:r,streamProcessor:u[t],currentValue:o,switchHistory:y[t],droppedFramesHistory:S,useBufferOccupancyABR:z(t),useL2AABR:W(t),useLoLPABR:X(t),videoModel:m});if(S){const e=m.getPlaybackQuality();e&&S.push(T,e)}if(O.get().streaming.abr.autoSwitchBitrate[t]){const e=Y(t),n=B(t,a),r=s.getMaxQuality(l);let u=r.quality;if(void 0!==e&&(u>Me.NO_CHANGE?u:o)<e&&(u=e),u>n&&(u=n),y[t].push({oldValue:o,newValue:u}),u>Me.NO_CHANGE&&u!=o)(c[t].state===I.ALLOW_LOAD||u>o)&&q(t,o,u,n,r.reason);else if(O.get().debug.logLevel===w.LOG_LEVEL_DEBUG){const e=v.getCurrentBufferLevel(t,!0);i.debug("["+t+"] stay on "+o+"/"+n+" (buffer: "+e+")")}}}},getTopQualityIndexFor:B,setElementSize:Z,setWindowResizeEventCalled:function(e){f=e},createAbrRulesCollection:L,registerStreamType:function(t,i){y[t]=y[t]||ut(e).create(),u[t]=i,c[t]=c[t]||{},c[t].state=I.ALLOW_LOAD,N[t]=!1,D[t]=!1,C[t]=!1,n.on(M.LOADING_PROGRESS,J,r),t===A.VIDEO&&(n.on(M.QUALITY_CHANGE_RENDERED,x,r),S=S||dt(e).create(),Z()),n.on(M.METRIC_ADDED,U,r),n.on(M.PERIOD_SWITCH_COMPLETED,L,r),R=R||gt(e).create({settings:O})},unRegisterStreamType:function(e){delete u[e]},setConfig:function(e){e&&(e.streamController&&(a=e.streamController),e.domStorage&&(_=e.domStorage),e.mediaPlayerModel&&(E=e.mediaPlayerModel),e.dashMetrics&&(v=e.dashMetrics),e.adapter&&(p=e.adapter),e.videoModel&&(m=e.videoModel),e.settings&&(O=e.settings))},reset:function(){P(),n.off(M.LOADING_PROGRESS,J,r),n.off(M.QUALITY_CHANGE_RENDERED,x,r),n.off(M.METRIC_ADDED,U,r),n.off(M.PERIOD_SWITCH_COMPLETED,L,r),s&&s.reset()}},i=t.getLogger(r),P(),r}ht.__dashjs_factory_name="AbrController";const pt=R.getSingletonFactory(ht);function mt(){let e={};return{save:function(t){const n=t.streamId,r=t.representationId;e[n]=e[n]||{},e[n][r]=t},extract:function(t,n){return e&&e[t]&&e[t][n]?e[t][n]:null},reset:function(){e={}}}}pt.QUALITY_DEFAULT=0,R.updateSingletonFactory(ht.__dashjs_factory_name,pt),mt.__dashjs_factory_name="InitCache";var Et=R.getSingletonFactory(mt);function _t(e){e=e||{};const t=this.context,n=b(t).getInstance(),r=e.errHandler,i=e.fragmentModel,s=e.representationController,a=e.mediaController,o=e.adapter,l=e.textController,u=e.abrController,c=e.playbackController,d=e.streamInfo,f=e.type,g=e.settings;let h,p,m,E,_,T,y,S,R,N,D,C,v,O,L,P,x,U,B,Y,K,q,H;function V(e){return o.convertDataToRepresentationInfo(s.getRepresentationForQuality(e))}function j(e,n){if(!U||!e)return null;const s=e[0];if(y)try{N=n&&n[f]?Ne(t).create(y,s,$.bind(this),n[f]):Ne(t).create(y,s,$.bind(this),null),g.get().streaming.useAppendWindow&&N.updateAppendWindow(d),"function"==typeof N.getBuffer().initialize&&N.getBuffer().initialize(f,d,e,i)}catch(e){p.fatal("Caught error on create SourceBuffer: "+e),r.error(new G(he.MEDIASOURCE_TYPE_UNSUPPORTED_CODE,he.MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE+f))}else N=Ce(t).create($.bind(this));return ge(V(m)),N}function z(e){p.info("Init fragment finished loading saving to",f+"'s init cache"),U.save(e.chunk),p.debug("Append Init fragment",f," with representationId:",e.chunk.representationId," and quality:",e.chunk.quality,", data size:",e.chunk.bytes.byteLength),X(e.chunk)}function W(e){const t=e.chunk;if(q){H=t;const e=N&&N.getAllBufferRanges();e&&e.length>0&&c.getTimeToStreamEnd()>g.get().streaming.stallThreshold&&(p.debug("Clearing buffer because track changed - "+(e.end(e.length-1)+.5)),ce([{start:0,end:e.end(e.length-1)+.5,force:!0}]))}else X(t)}function X(e){N.append(e),e.mediaInfo.type===A.VIDEO&&Ie(M.VIDEO_CHUNK_RECEIVED,{chunk:e})}function Q(e){if(e&&e.length>0)for(let t=0,n=e.length;t<n;t++)p.debug("Buffered range: "+e.start(t)+" - "+e.end(t)+", currentTime = ",c.getTime())}function $(e){if(e.error){if(22===e.error.code&&(x=!0,T=.8*Ae(),p.warn("Quota exceeded, Critical Buffer: "+T),T>0)){const e=Math.max(.2*T,1),t=T-e,n=Math.min(g.get().streaming.bufferTimeAtTopQuality,.9*t),r=Math.min(g.get().streaming.bufferTimeAtTopQualityLongForm,.9*t),i={streaming:{bufferToKeep:parseFloat(e.toFixed(5)),bufferTimeAtTopQuality:parseFloat(n.toFixed(5)),bufferTimeAtTopQualityLongForm:parseFloat(r.toFixed(5))}};g.update(i)}return void(22!==e.error.code&&Se()||(p.warn("Clearing playback buffer to overcome quota exceed situation"),Ie(M.QUOTA_EXCEEDED,{criticalBufferLevel:T}),ce(ue())))}x=!1,O=e.chunk,O&&!isNaN(O.index)&&(S=Math.max(O.index,S),ae());const t=N.getAllBufferRanges();if(O.segmentType===F.MEDIA_SEGMENT_TYPE)Q(t),te(),function(){if(f!==A.AUDIO&&f!==A.VIDEO)return;if(isNaN(B))return;const e=c.getTime();let t=ie(B,0);if(e===B&&t)return;const n=s.getCurrentRepresentation().segmentDuration;if(t=ie(B,n),!t)return;Math.abs(e-B)>n?B<=t.end&&(c.seek(Math.max(B,t.start),!1,!0),B=NaN):e<t.start&&(c.seek(t.start,!1,!0),B=NaN)}();else if(q){const e=c.getTime();p.debug("AppendToBuffer seek target should be "+e),Ie(M.SEEK_TARGET,{time:e})}let n=!1;C&&(C.indexOf(O)>0&&(n=!0),C=null),O&&!n&&Ie(O.endFragment?M.BYTES_APPENDED_END_FRAGMENT:M.BYTES_APPENDED,{quality:O.quality,startTime:O.start,index:O.index,bufferedRanges:t,mediaType:f})}function Z(e){m!==e.newQuality&&(ge(this.getRepresentationInfo(e.newQuality)),m=e.newQuality)}function J(e){B=e.seekTime,E&&(Y=!0,E=!1,R=Number.POSITIVE_INFINITY),f!==A.FRAGMENTED_TEXT?N.waitForUpdateEnd(()=>{const e=function(){const e=[],t=N.getAllBufferRanges();if(!t||0===t.length)return e;const n=c.getTime(),r=t.end(t.length-1)+.5,s=i.getRequests({state:k.FRAGMENT_MODEL_EXECUTED,time:n,threshold:.01})[0];if(s){const n={start:0,end:s.startTime-g.get().streaming.stallThreshold},a=i.getRequests({state:k.FRAGMENT_MODEL_EXECUTED,time:s.startTime-s.duration/2,threshold:.01})[0];a&&a.startTime!=s.startTime&&(n.end=a.startTime),n.start<n.end&&n.end>t.start(0)&&e.push(n);const o={start:s.startTime+s.duration+g.get().streaming.stallThreshold,end:r},l=i.getRequests({state:k.FRAGMENT_MODEL_EXECUTED,time:s.startTime+s.duration+g.get().streaming.stallThreshold,threshold:.01})[0];l&&l.startTime!==s.startTime&&(o.start=l.startTime+l.duration+g.get().streaming.stallThreshold),o.start<o.end&&o.start<r&&e.push(o)}else p.debug("getAllRangesWithSafetyFactor - No request found in current time position, removing full buffer 0 -",r),e.push({start:0,end:r});return e}();e&&0!==e.length||te(),ce(e)}):te()}function ee(){B=NaN}function te(){(!q||f===A.FRAGMENTED_TEXT&&l.isTextEnabled())&&se()}function ne(){oe()}function re(){B=NaN,oe()}function ie(e,t){const n=N.getAllBufferRanges();let r,i,s=0,a=0,o=null,l=null,u=0;const c=isNaN(t)?.15:t;if(null!=n){for(i=0,r=n.length;i<r;i++)if(s=n.start(i),a=n.end(i),null===o)u=Math.abs(s-e),(e>=s&&e<a||u<=c)&&(o=s,l=a);else{if(u=s-l,!(u<=c))break;l=a}if(null!==o)return{start:o,end:l}}return null}function se(){c&&(_=function(e,t){let n,r;return g.get().streaming.jumpGaps&&(t=g.get().streaming.smallGapLimit),n=ie(e,t),r=null===n?0:n.end-e,r}((isNaN(B)?c.getTime():B)||0),Ie(M.BUFFER_LEVEL_UPDATED,{bufferLevel:_}),oe())}function ae(){S>=R-1&&!E&&void 0===N.discharge&&(E=!0,p.debug("checkIfBufferingCompleted trigger BUFFERING_COMPLETED for "+f),Ie(M.BUFFERING_COMPLETED))}function oe(){f!==A.AUDIO&&f!==A.VIDEO||(Y&&!E&&_>0&&c&&c.getTimeToStreamEnd()-_<.1&&(Y=!1,E=!0,p.debug("checkIfSufficientBuffer trigger BUFFERING_COMPLETED for type "+f),Ie(M.BUFFERING_COMPLETED)),(!g.get().streaming.lowLatencyEnabled&&_<g.get().streaming.stallThreshold||0===_)&&!E?le(I.BUFFER_EMPTY):(E||_>=d.manifestInfo.minBufferTime)&&le(I.BUFFER_LOADED))}function le(e){v===e||e===I.BUFFER_EMPTY&&0===c.getTime()||f===A.FRAGMENTED_TEXT&&!l.isTextEnabled()||(v=e,Ie(M.BUFFER_LEVEL_STATE_CHANGED,{state:e}),Ie(e===I.BUFFER_LOADED?M.BUFFER_LOADED:M.BUFFER_EMPTY),p.debug(e===I.BUFFER_LOADED?"Got enough buffer to start":"Waiting for more buffer before starting playback"))}function ue(){const e=[],t=N.getAllBufferRanges();if(!t||0===t.length)return e;const n=c.getTime();let r=Math.max(0,n-g.get().streaming.bufferToKeep);const s=i.getRequests({state:k.FRAGMENT_MODEL_EXECUTED,time:n,threshold:.01})[0];if(s)r=Math.min(s.startTime,r);else if(0===n&&c.getIsDynamic())return[];if(t.start(0)<=r){const n={start:0,end:r};for(let e=0;e<t.length&&t.end(e)<=r;e++)n.end=t.end(e);n.start<n.end&&e.push(n)}return e}function ce(e){e&&N&&0!==e.length&&(K.push.apply(K,e),P||de())}function de(){if(0===K.length||!N)return p.debug("Nothing to prune, halt pruning"),K=[],void(P=!1);const e=N.getBuffer();if(!e||!e.buffered||0===e.buffered.length)return p.debug("SourceBuffer is empty (or does not exist), halt pruning"),K=[],void(P=!1);const t=K.shift();p.debug("Removing buffer from:",t.start,"to",t.end),P=!0;c.getTime()<t.end&&(E=!1,S=0),N.remove(t.start,t.end,t.force)}function fe(e){if(N!==e.buffer)return;p.debug("onRemoved buffer from:",e.from,"to",e.to);Q(N.getAllBufferRanges()),0===K.length&&(P=!1),e.unintended&&(p.warn("Detected unintended removal from:",e.from,"to",e.to,"setting index handler time to",e.from),Ie(M.SEEK_TARGET,{time:e.from,mediaType:f,streamId:d.id})),P?de():(q?(q=!1,H&&X(H)):se(),Ie(M.BUFFER_CLEARED,{from:e.from,to:e.to,unintended:e.unintended,hasEnoughSpaceToAppend:Se(),quotaExceeded:x}))}function ge(e){e&&void 0!==e.MSETimeOffset&&N&&N.updateTimestampOffset&&N.updateTimestampOffset(e.MSETimeOffset)}function pe(e){e.error||E||ge(e.currentRepresentation)}function me(e){R=e.request.index,ae()}function Ee(e){if(e.newMediaInfo.streamInfo.id!==d.id||e.newMediaInfo.type!==f)return;const t=N&&N.getAllBufferRanges();t&&(p.info("Track change asked"),a.getSwitchMode(f)===A.TRACK_SWITCH_MODE_ALWAYS_REPLACE&&t&&t.length>0&&c.getTimeToStreamEnd()>g.get().streaming.stallThreshold&&(E=!1,R=Number.POSITIVE_INFINITY))}function _e(){L++;L*(g.get().streaming.wallclockTimeUpdateInterval/1e3)>=g.get().streaming.bufferPruningInterval&&(L=0,N&&f!==A.FRAGMENTED_TEXT&&(E||ce(ue())))}function Te(){oe()}function ye(e,t){y=e,N&&t&&"function"==typeof N.discharge&&(D=N,j(t))}function Ae(){const e=N.getAllBufferRanges();let t,n,r=0;if(!e)return r;for(n=0,t=e.length;n<t;n++)r+=e.end(n)-e.start(n);return r}function Se(){return Ae()<T}function Ie(e,t){let r=t||{};n.trigger(e,r,{streamId:d.id,mediaType:f})}function Re(e,t){T=Number.POSITIVE_INFINITY,v=void 0,m=pt.QUALITY_DEFAULT,R=Number.POSITIVE_INFINITY,S=0,O=null,E=!1,P=!1,x=!1,Y=!1,_=0,L=0,K=[],B=NaN,N&&(e||N.abort(),N.reset(t),N=null),q=!1}return h={initialize:function(e){ye(e),m=u.getQualityFor(f),n.on(M.DATA_UPDATE_COMPLETED,pe,this),n.on(M.INIT_FRAGMENT_LOADED,z,this),n.on(M.MEDIA_FRAGMENT_LOADED,W,this),n.on(M.QUALITY_CHANGE_REQUESTED,Z,this),n.on(M.STREAM_COMPLETED,me,this),n.on(M.PLAYBACK_PLAYING,re,this),n.on(M.PLAYBACK_PROGRESS,te,this),n.on(M.PLAYBACK_TIME_UPDATED,te,this),n.on(M.PLAYBACK_RATE_CHANGED,Te,this),n.on(M.PLAYBACK_SEEKING,J,this),n.on(M.PLAYBACK_SEEKED,ee,this),n.on(M.PLAYBACK_STALLED,ne,this),n.on(M.WALLCLOCK_TIME_UPDATED,_e,this),n.on(M.CURRENT_TRACK_CHANGED,Ee,this,{priority:b.EVENT_PRIORITY_HIGH}),n.on(M.SOURCEBUFFER_REMOVE_COMPLETED,fe,this)},getStreamId:function(){return d.id},getType:function(){return f},getBufferControllerType:function(){return"BufferController"},getRepresentationInfo:V,createBuffer:j,dischargePreBuffer:function(){if(N&&D&&"function"==typeof D.discharge){const e=D.getAllBufferRanges();if(e.length>0){let t="Beginning "+f+"PreBuffer discharge, adding buffer for:";for(let n=0;n<e.length;n++)t+=" start: "+e.start(n)+", end: "+e.end(n)+";";p.debug(t)}else p.debug("PreBuffer discharge requested, but there were no media segments in the PreBuffer.");C=[];let t=D.discharge(),n=null;for(let e=0;e<t.length;e++){const r=t[e];if("InitializationSegment"!==r.segmentType){const e=U.extract(r.streamId,r.representationId);e&&n!==e&&(C.push(e),N.append(e),n=e)}C.push(r),N.append(r)}D.reset(),D=null}},getBuffer:function(){return N},setBuffer:function(e){N=e},getBufferLevel:function(){return _},getRangeAt:ie,setMediaSource:ye,getMediaSource:function(){return y},appendInitSegment:function(e){const t=U.extract(d.id,e);return!!t&&(p.info("Append Init fragment",f," with representationId:",t.representationId," and quality:",t.quality,", data size:",t.bytes.byteLength),X(t),!0)},replaceBuffer:function(){q=!0},getIsBufferingCompleted:function(){return E},getIsPruningInProgress:function(){return P},reset:function(e,t){n.off(M.DATA_UPDATE_COMPLETED,pe,this),n.off(M.INIT_FRAGMENT_LOADED,z,this),n.off(M.MEDIA_FRAGMENT_LOADED,W,this),n.off(M.QUALITY_CHANGE_REQUESTED,Z,this),n.off(M.STREAM_COMPLETED,me,this),n.off(M.PLAYBACK_PLAYING,re,this),n.off(M.PLAYBACK_PROGRESS,te,this),n.off(M.PLAYBACK_TIME_UPDATED,te,this),n.off(M.PLAYBACK_RATE_CHANGED,Te,this),n.off(M.PLAYBACK_SEEKING,J,this),n.off(M.PLAYBACK_SEEKED,ee,this),n.off(M.PLAYBACK_STALLED,ne,this),n.off(M.WALLCLOCK_TIME_UPDATED,_e,this),n.off(M.CURRENT_TRACK_CHANGED,Ee,this),n.off(M.SOURCEBUFFER_REMOVE_COMPLETED,fe,this),Re(e,t)},updateAppendWindow:function(){N&&!E&&N.updateAppendWindow(d)}},p=w(t).getInstance().getLogger(h),U=Et(t).getInstance(),Re(),h}_t.__dashjs_factory_name="BufferController";var Tt=R.getClassFactory(_t);function yt(e){e=e||{};const t=this.context,n=b(t).getInstance(),r=Ie(t).getInstance(),i=e.errHandler,s=e.streamInfo,a=e.type,o=e.mimeType,l=e.fragmentModel;let u,c,d,f,g,h;function p(e){f=e}function m(e){null===h.extract(s.id,e.currentRepresentation.id)&&(c=!1,n.trigger(M.INIT_FRAGMENT_NEEDED,{representationId:e.currentRepresentation.id,sender:u},{streamId:s.id,mediaType:a}))}function E(e){e.chunk.bytes&&(h.save(e.chunk),g.append(e.chunk),c=!0,n.trigger(M.STREAM_COMPLETED,{request:e.request},{streamId:s.id,mediaType:a}))}return u={getBufferControllerType:function(){return"NotFragmentedTextBufferController"},initialize:function(e){p(e),h=Et(t).getInstance()},createBuffer:function(e){const n=e[0];try{if(g=Ne(t).create(f,n),!d){const t=g.getBuffer();t.hasOwnProperty(A.INITIALIZE)&&t.initialize(o,s,e,l),d=!0}return g}catch(e){if(n&&(n.isText||-1!==n.codec.indexOf('codecs="stpp')||-1!==n.codec.indexOf('codecs="wvtt')))try{g=r.getTextSourceBuffer()}catch(e){i.error(new G(he.MEDIASOURCE_TYPE_UNSUPPORTED_CODE,he.MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE+a+" : "+e.message))}else i.error(new G(he.MEDIASOURCE_TYPE_UNSUPPORTED_CODE,he.MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE+a))}},getStreamId:function(){return s.id},getType:function(){return a},getBuffer:function(){return g},getBufferLevel:function(){return 0},setMediaSource:p,getMediaSource:function(){return f},getIsBufferingCompleted:function(){return c},getIsPruningInProgress:function(){return!1},dischargePreBuffer:function(){},appendInitSegment:function(e){return null!==h.extract(s.id,e)},getRangeAt:function(){return null},reset:function(e){n.off(M.DATA_UPDATE_COMPLETED,m,u),n.off(M.INIT_FRAGMENT_LOADED,E,u),!e&&g&&(g.abort(),g.reset(),g=null)},updateTimestampOffset:function(e){g.timestampOffset===e||isNaN(e)||(g.timestampOffset=e)}},d=!1,f=null,c=!1,n.on(M.DATA_UPDATE_COMPLETED,m,u),n.on(M.INIT_FRAGMENT_LOADED,E,u),u}yt.__dashjs_factory_name="NotFragmentedTextBufferController";var At=R.getClassFactory(yt);function St(e){e=e||{};let t,n,r=this.context;function i(){return t.getBuffer()}return n={getBufferControllerType:function(){return t.getBufferControllerType()},initialize:function(e,n){return t.initialize(e,n)},createBuffer:function(e,n){return t.createBuffer(e,n)},getType:function(){return t.getType()},getBuffer:i,setBuffer:function(e){t.setBuffer(e)},getBufferLevel:function(){return t.getBufferLevel()},setMediaSource:function(e){t.setMediaSource(e)},getMediaSource:function(){return t.getMediaSource()},getIsBufferingCompleted:function(){return t.getIsBufferingCompleted()},getIsPruningInProgress:function(){return t.getIsPruningInProgress()},dischargePreBuffer:function(){return t.dischargePreBuffer()},appendInitSegment:function(e){t.appendInitSegment(e)},getRangeAt:function(e){return t.getRangeAt(e)},reset:function(e){t.reset(e)},updateTimestampOffset:function(e){const t=i();t.timestampOffset===e||isNaN(e)||(t.timestampOffset=e)},updateAppendWindow:function(){t.updateAppendWindow()}},t=e.type===A.FRAGMENTED_TEXT?Tt(r).create({streamInfo:e.streamInfo,type:e.type,mediaPlayerModel:e.mediaPlayerModel,manifestModel:e.manifestModel,fragmentModel:e.fragmentModel,errHandler:e.errHandler,mediaController:e.mediaController,representationController:e.representationController,adapter:e.adapter,textController:e.textController,abrController:e.abrController,playbackController:e.playbackController,settings:e.settings}):At(r).create({streamInfo:e.streamInfo,type:e.type,mimeType:e.mimeType,fragmentModel:e.fragmentModel,errHandler:e.errHandler}),n}St.__dashjs_factory_name="TextBufferController";var It=R.getClassFactory(St);function Rt(e){const t=(e=e||{}).dashMetrics,n=e.mediaPlayerModel,r=e.textController,i=e.abrController,s=e.settings;function a(e,a,o){let l=NaN;if(!e||!a)return l;if(e===A.FRAGMENTED_TEXT)if(r.isTextEnabled())if(isNaN(a.fragmentDuration)){const e=t.getCurrentSchedulingInfo(I.SCHEDULING_INFO);l=e?e.duration:0}else l=a.fragmentDuration;else l=0;else if(e===A.AUDIO&&o){const e=t.getCurrentBufferLevel(A.VIDEO);l=isNaN(a.fragmentDuration)?e:Math.max(e,a.fragmentDuration)}else{const e=a.mediaInfo.streamInfo;if(i.isPlayingAtTopQuality(e)){l=e.manifestInfo.duration>=s.get().streaming.longFormContentDurationThreshold?s.get().streaming.bufferTimeAtTopQualityLongForm:s.get().streaming.bufferTimeAtTopQuality}else l=n.getStableBufferTime()}return l}return{execute:function(e,n,r){return!e||!n||t.getCurrentBufferLevel(e)<a(e,n,r)},getBufferTarget:a}}Rt.__dashjs_factory_name="BufferLevelRule";var Nt=R.getClassFactory(Rt);function Dt(e){e=e||{};const t=this.context,n=b(t).getInstance(),r=e.adapter,i=e.dashMetrics,s=e.mediaPlayerModel,a=e.fragmentModel,o=e.abrController,l=e.playbackController,u=e.textController,c=e.streamInfo,d=e.type,f=e.mimeType,g=e.mediaController,h=e.bufferController,p=e.settings;let m,E,_,T,y,S,R,N,D,C,v,O,L,P,F,x,U,B,G;function Y(){return!1===T}function K(){Y()||_&&!h.getIsBufferingCompleted()&&(E.debug("Schedule Controller starts"),T=!1,i.createPlaylistTraceMetrics(_.id,1e3*l.getTime(),l.getPlaybackRate()),V(0))}function q(){T||(E.debug("Schedule Controller stops"),E.debug(d+" Schedule Controller stops"),T=!0,clearTimeout(R))}function H(){if(T||y||l.isPaused()&&!p.get().streaming.scheduleWhilePaused||(d===A.FRAGMENTED_TEXT||d===A.TEXT)&&!u.isTextEnabled()||h.getIsBufferingCompleted())return void q();!function(){const e=l.getTime();let t=1.5;if(isNaN(_.fragmentDuration)){const e=i.getCurrentSchedulingInfo(_.mediaInfo.type);t=e?1.5*e.duration:1.5}const n=a.getRequests({state:k.FRAGMENT_MODEL_EXECUTED,time:e+t,threshold:0})[0];if(n&&-1===P.indexOf(n)&&!r.getIsTextTrack(f)){const e=p.get().streaming.fastSwitchEnabled,r=h.getBufferLevel(),i=o.getAbandonmentStateFor(d),s=!g.isCurrentTrack(n.mediaInfo)&&g.getSwitchMode(n.mediaInfo.type)===A.TRACK_SWITCH_MODE_NEVER_REPLACE,a=n.quality<_.quality;e&&(s||a)&&r>=t&&i!==I.ABANDON_LOAD?(z(n),G=!0,E.debug("Reloading outdated fragment at index: ",n.index)):n.quality>_.quality&&!x&&le(l.getTime()+r)}}();const e=P.length>0;if(x||isNaN(L)||F||e||function(e,t){O[t]=O[t]||{};const n=o.getTopQualityIndexFor(e,t);return O[t][e]!=n&&(E.info("Top quality "+e+" index has changed from "+O[t][e]+" to "+n),O[t][e]=n,!0)}(d,c.id)||C.execute(d,_,D)){const t=function(){if(_.quality===L&&!F||x){const e=P.shift();e&&e.isInitializationRequest()?(n.trigger(M.INIT_FRAGMENT_NEEDED,{representationId:e.representationId,sender:m},{streamId:c.id,mediaType:d}),B=!1):(n.trigger(M.MEDIA_FRAGMENT_NEEDED,{seekTarget:N,replacement:e},{streamId:c.id,mediaType:d}),B=!0)}else F?(E.debug("Switch track for "+d+", representation id = "+_.id),x=g.getSwitchMode(d)===A.TRACK_SWITCH_MODE_ALWAYS_REPLACE,x&&h.replaceBuffer&&h.replaceBuffer(),F=!1):E.debug("Quality has changed, get init request for representationid = "+_.id),n.trigger(M.INIT_FRAGMENT_NEEDED,{representationId:_.id,sender:m},{streamId:c.id,mediaType:d}),L=_.quality,B=!1};j(!0),!e&&B&&o.checkPlaybackQuality(d),t()}else V(500)}function V(e){clearTimeout(R),R=setTimeout(H,e)}function j(e){y!==e?y=e:E.debug("isFragmentProcessingInProgress is already equal to",e)}function z(e){P.push(e)}function W(e){if(l&&a){const t=a.getRequests({state:k.FRAGMENT_MODEL_EXECUTED,time:l.getTime(),threshold:0})[0];t&&l.getTime()>=t.startTime&&((!v.mediaInfo||t.mediaInfo.type===v.mediaInfo.type&&t.mediaInfo.id!==v.mediaInfo.id)&&e&&n.trigger(M.TRACK_CHANGE_RENDERED,{mediaType:d,oldMediaInfo:v.mediaInfo,newMediaInfo:t.mediaInfo}),t.quality===v.quality&&t.adaptationIndex===v.adaptationIndex||!e||n.trigger(M.QUALITY_CHANGE_RENDERED,{mediaType:d,oldQuality:v.quality,newQuality:t.quality}),v={mediaInfo:t.mediaInfo,quality:t.quality,adaptationIndex:t.adaptationIndex})}}function X(){q(),j(!1),E.info(`Stream ${c.id} is complete`)}function Q(e){e.request.mediaInfo.streamInfo.id===c.id&&e.request.mediaType===d&&(E.info("OnFragmentLoadingCompleted - Url:",e.request?e.request.url:"undefined",e.request.range?", Range:"+e.request.range:""),r.getIsTextTrack(f)&&j(!1),e.error&&e.request.serviceLocation&&!T&&(z(e.request),j(!1),V(0)),x&&(U=e.request))}function $(){W(!0)}function Z(e){if(x&&!isNaN(e.startTime)&&(x=!1,a.addExecutedRequest(U)),j(!1),G&&!isNaN(e.startTime)){const t=l.getTime(),n=e.startTime+_.fragmentDuration,r=1.5*_.fragmentDuration;V(t+r>=n?0:1e3*(n-(t+r))),G=!1}else V(0)}function J(e){E.info("onFragmentLoadingAbandoned request: "+e.request.url+" has been aborted"),l.isSeeking()||F||(E.info("onFragmentLoadingAbandoned request: "+e.request.url+" has to be downloaded again, origin is not seeking process or switch track call"),z(e.request)),j(!1),V(0)}function ee(){}function te(){q()}function ne(e){x&&p.get().streaming.flushBufferAtTrackSwitch&&l.seek(l.getTime()+.001,!1,!0),e.hasEnoughSpaceToAppend&&e.quotaExceeded&&K()}function re(){q(),j(!1)}function ie(){a.abortRequests(),q()}function se(){!T&&p.get().streaming.scheduleWhilePaused||K()}function ae(e){le(e.seekTime),ue(0),T&&K();const t=_.DVRWindow&&l?_.DVRWindow.end-l.getTime():NaN;i.updateManifestUpdateInfo({latency:t}),y?a.abortRequests():V(0)}function oe(e){i.updatePlayListTraceMetrics({playbackspeed:e.playbackRate.toString()})}function le(e){N=e}function ue(e){S=e}function ce(){B=!0,y=!1,S=0,N=NaN,L=NaN,v={mediaInfo:void 0,quality:NaN,adaptationIndex:NaN},O={},P=[],T=!0,F=!1,x=!1,U=null,G=!1}return m={initialize:function(e){D=e,C=Nt(t).create({abrController:o,dashMetrics:i,mediaPlayerModel:s,textController:u,settings:p}),n.on(M.DATA_UPDATE_STARTED,ee,this),n.on(M.FRAGMENT_LOADING_COMPLETED,Q,this),n.on(M.STREAM_COMPLETED,X,this),n.on(M.BUFFER_CLEARED,ne,this),n.on(M.BYTES_APPENDED_END_FRAGMENT,Z,this),n.on(M.QUOTA_EXCEEDED,re,this),n.on(M.PLAYBACK_SEEKING,ae,this),n.on(M.PLAYBACK_STARTED,se,this),n.on(M.PLAYBACK_RATE_CHANGED,oe,this),n.on(M.PLAYBACK_TIME_UPDATED,$,this),n.on(M.URL_RESOLUTION_FAILED,ie,this),n.on(M.FRAGMENT_LOADING_ABANDONED,J,this),n.on(M.BUFFERING_COMPLETED,te,this)},getType:function(){return d},getStreamId:function(){return c.id},setCurrentRepresentation:function(e){_=e},setSeekTarget:le,setTimeToLoadDelay:ue,getTimeToLoadDelay:function(){return S},switchTrackAsked:function(){F=!0},isStarted:Y,start:K,stop:q,reset:function(){n.off(M.DATA_UPDATE_STARTED,ee,this),n.off(M.FRAGMENT_LOADING_COMPLETED,Q,this),n.off(M.STREAM_COMPLETED,X,this),n.off(M.BUFFER_CLEARED,ne,this),n.off(M.BYTES_APPENDED_END_FRAGMENT,Z,this),n.off(M.QUOTA_EXCEEDED,re,this),n.off(M.PLAYBACK_SEEKING,ae,this),n.off(M.PLAYBACK_STARTED,se,this),n.off(M.PLAYBACK_RATE_CHANGED,oe,this),n.off(M.PLAYBACK_TIME_UPDATED,$,this),n.off(M.URL_RESOLUTION_FAILED,ie,this),n.off(M.FRAGMENT_LOADING_ABANDONED,J,this),n.off(M.BUFFERING_COMPLETED,te,this),q(),W(!1),ce()},getBufferTarget:function(){return C.getBufferTarget(d,_,D)},processInitRequest:function(e){e&&(j(!0),a.executeRequest(e))},processMediaRequest:function(e){e?(E.debug("Next fragment request url is "+e.url),a.executeRequest(e)):(l.getIsDynamic()&&E.debug("Next fragment seems to be at the bleeding live edge and is not available yet. Rescheduling."),j(!1),V(p.get().streaming.lowLatencyEnabled?100:500))},getPlaybackController:function(){return l}},E=w(t).getInstance().getLogger(m),ce(),m}Dt.__dashjs_factory_name="ScheduleController";var Ct=R.getClassFactory(Dt);function bt(e){const t=(e=e||{}).eventBus,n=e.events,r=e.errors,i=e.abrController,s=e.dashMetrics,a=e.playbackController,o=e.timelineConverter,l=e.type,u=e.streamInfo,c=e.dashConstants;let d,f,g,h,p;function m(){return l}function E(){if(!(i&&s&&a&&o))throw new Error(A.MISSING_CONFIG_ERROR)}function _(){return g}function T(){return p}function y(){f=null,g=!0,h=[]}function S(){E();const e=new Date,t=T(),n=1e3*a.getTime();t&&s.addRepresentationSwitch(t.adaptation.type,e,n,t.id)}function I(e){return null==e||e>=h.length?null:h[e]}function R(e,t){if(e.segmentAvailabilityRange=o.calcSegmentAvailabilityRange(e,t),e.segmentAvailabilityRange.end<e.segmentAvailabilityRange.start){C(new G(r.SEGMENTS_UNAVAILABLE_ERROR_CODE,r.SEGMENTS_UNAVAILABLE_ERROR_MESSAGE,{availabilityDelay:e.segmentAvailabilityRange.start-e.segmentAvailabilityRange.end}))}else{var n;t&&(n=e.segmentAvailabilityRange.end,o.setExpectedLiveEdge(n),s.updateManifestUpdateInfo({presentationStartTime:n}))}}function N(e,r){E();for(let i=0,s=h.length;i<s;i++)R(h[i],e),r&&t.trigger(n.REPRESENTATION_UPDATE_STARTED,{representation:h[i]},{streamId:u.id,mediaType:l})}function D(){g=!0,t.trigger(n.DATA_UPDATE_STARTED,{},{streamId:u.id,mediaType:l})}function C(e){g=!1,t.trigger(n.DATA_UPDATE_COMPLETED,{data:f,currentRepresentation:p,error:e},{streamId:u.id,mediaType:l})}function b(e){let r=e;t.trigger(n.AST_IN_FUTURE,{delay:r}),setTimeout((function(){_()||(D(),h.forEach(e=>{e.segmentAvailabilityRange=null}),N(a.getIsDynamic(),!0))}),r)}function v(e){if(!_())return;if(e.error)return void C(e.error);let t,n,o,l=e.representation,d=s.getCurrentManifestUpdate(),f=!1,g=0;if(l.adaptation.period.mpd.manifest.type===c.DYNAMIC&&!l.adaptation.period.mpd.manifest.ignorePostponeTimePeriod&&a.getStreamController().getStreams().length<=1&&(g=function(e){try{const t=a.getStreamController().getActiveStreamInfo();let n=e.segmentAvailabilityRange.start;t&&t.id&&t.id!==u.id&&(n=Math.min(a.getTime(),n));let r=e.segmentAvailabilityRange.end-n;return 1e3*(a.getLiveDelay()-r)}catch(e){return 0}}(l)),g>0)return b(g),n=new G(r.SEGMENTS_UPDATE_FAILED_ERROR_CODE,r.SEGMENTS_UPDATE_FAILED_ERROR_MESSAGE),void C(n);if(d){for(let e=0;e<d.representationInfo.length;e++)if(t=d.representationInfo[e],t.index===l.index&&t.mediaType===m()){f=!0;break}f||s.addManifestUpdateRepresentationInfo(l,m())}var E;(function(){for(let e=0,t=h.length;e<t;e++){let t=h[e].segmentInfoType;if(null===h[e].segmentAvailabilityRange||!h[e].hasInitialization()||(t===c.SEGMENT_BASE||t===c.BASE_URL)&&!h[e].segments)return!1}return!0})()&&(i.setPlaybackQuality(m(),u,(E=p,h.indexOf(E))),s.updateManifestUpdateInfo({latency:p.segmentAvailabilityRange.end-a.getTime()}),o=s.getCurrentRepresentationSwitch(T().adaptation.type),o||S(),C())}function M(e){e.isDynamic&&N(e.isDynamic)}function O(e){p=I(e.newQuality),S()}function w(e){if(e.newDuration){const t=T();if(t&&t.adaptation.period){t.adaptation.period.duration=e.newDuration}}}return d={getStreamId:function(){return u.id},getType:m,getData:function(){return f},isUpdating:_,updateData:function(e,t,n,r){E(),D(),h=t,p=I(r),f=e,n===A.VIDEO||n===A.AUDIO||n===A.FRAGMENTED_TEXT?N(a.getIsDynamic(),!0):C()},updateRepresentation:R,getCurrentRepresentation:T,getRepresentationForQuality:I,reset:function(){t.off(n.QUALITY_CHANGE_REQUESTED,O,d),t.off(n.REPRESENTATION_UPDATE_COMPLETED,v,d),t.off(n.WALLCLOCK_TIME_UPDATED,M,d),t.off(n.MANIFEST_VALIDITY_CHANGED,w,d),y()}},y(),t.on(n.QUALITY_CHANGE_REQUESTED,O,d),t.on(n.REPRESENTATION_UPDATE_COMPLETED,v,d),t.on(n.WALLCLOCK_TIME_UPDATED,M,d),t.on(n.MANIFEST_VALIDITY_CHANGED,w,d),d}bt.__dashjs_factory_name="RepresentationController";var vt=R.getClassFactory(bt);function Mt(e){let t,n=(e=e||{}).timelineConverter;return t={getLiveEdge:function(e){return function(){if(!n||!n.hasOwnProperty("getExpectedLiveEdge"))throw new Error(A.MISSING_CONFIG_ERROR)}(),e.DVRWindow?e.DVRWindow.end:0},reset:function(){n=null}},t}Mt.__dashjs_factory_name="LiveEdgeFinder";var Ot=R.getClassFactory(Mt);class wt{constructor(){this.indexRange=null,this.index=null,this.mediaRange=null,this.media=null,this.duration=NaN,this.replacementTime=null,this.replacementNumber=NaN,this.mediaStartTime=NaN,this.presentationStartTime=NaN,this.availabilityStartTime=NaN,this.availabilityEndTime=NaN,this.availabilityIdx=NaN,this.wallStartTime=NaN,this.representation=null}}function Lt(e,t){for(;e.length<t;)e="0"+e;return e}function Pt(e){return e?e.split("$$").join("$"):e}function Ft(e,t){if(!t||!e||-1===e.indexOf("$RepresentationID$"))return e;let n=t.toString();return e.split("$RepresentationID$").join(n)}function xt(e,t,n){let r,i,s,a,o,l;const u=t.length,c="%0".length;if(!e)return e;for(;;){if(r=e.indexOf("$"+t),r<0)return e;if(i=e.indexOf("$",r+u),i<0)return e;if(s=e.indexOf("%0",r+u),s>r&&s<i)switch(a=e.charAt(i-1),o=parseInt(e.substring(s+c,i-1),10),a){case"d":case"i":case"u":l=Lt(n.toString(),o);break;case"x":l=Lt(n.toString(16),o);break;case"X":l=Lt(n.toString(16),o).toUpperCase();break;case"o":l=Lt(n.toString(8),o);break;default:return e}else l=n;e=e.substring(0,r)+l+e.substring(i+1)}}function Ut(e,t,n,r,i,s,a,o,l){let u=new wt;var c;return u.representation=e,u.duration=t,u.presentationStartTime=n,u.mediaStartTime=r,u.availabilityStartTime=i,u.availabilityEndTime=s.calcAvailabilityEndTimeFromPresentationTime(a,e.adaptation.period.mpd,o),u.wallStartTime=s.calcWallTimeForSegment(u,o),u.replacementNumber=(c=l,u.representation.startNumber+c),u.availabilityIdx=l,u}function Bt(e,t,n,r){const i=e.getPeriodEnd(t,r),s=e.calcPeriodRelativeTimeFromMpdRelativeTime(t,i);if(e.calcPeriodRelativeTimeFromMpdRelativeTime(t,n.presentationStartTime)>=s){if(!r)return!1;if(t.segmentAvailabilityRange&&n.presentationStartTime>=t.segmentAvailabilityRange.end)return!1}return!0}function kt(e,t,n,r){let i,s,a;i=n.segmentDuration,isNaN(i)&&(i=n.adaptation.period.duration),s=parseFloat((n.adaptation.period.start+r*i).toFixed(5)),a=parseFloat((s+i).toFixed(5));const o=Ut(n,i,s,e.calcMediaTimeFromPresentationTime(s,n),e.calcAvailabilityStartTimeFromPresentationTime(s,n.adaptation.period.mpd,t),e,a,t,r);return Bt(e,n,o,t)?o:null}function Gt(e,t,n,r,i,s,a,o,l,u){const c=r/s,d=Math.min(i/s,n.adaptation.period.mpd.maxSegmentDuration);let f,g,h;return f=e.calcPresentationTimeFromMediaTime(c,n),g=f+d,h=Ut(n,d,f,c,n.adaptation.period.mpd.manifest.loadedTime,e,g,t,l),Bt(e,n,h,t)?(h.replacementTime=u||r,a=xt(a,"Number",h.replacementNumber),a=xt(a,"Time",h.replacementTime),h.media=a,h.mediaRange=o,h):null}function Yt(e,t){const n=(e=e||{}).timelineConverter;let r;function i(){if(!n||!n.hasOwnProperty("calcMediaTimeFromPresentationTime")||!n.hasOwnProperty("calcSegmentAvailabilityRange"))throw new Error(A.MISSING_CONFIG_ERROR)}function s(e,r){const i=e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.index].AdaptationSet_asArray[e.adaptation.index].Representation_asArray[e.index].SegmentTemplate||e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.index].AdaptationSet_asArray[e.adaptation.index].Representation_asArray[e.index].SegmentList,s=i.SegmentTimeline,a=i.SegmentURL_asArray;let o,l,u,c,d,f,g,h,p,m=0,E=0,_=-1;p=e.timescale,o=s.S_asArray;let T=!1;for(u=0,c=o.length;u<c&&!T;u++){if(l=o[u],f=0,l.hasOwnProperty("r")&&(f=l.r),l.hasOwnProperty("t")&&(m=l.t,E=m/p),f<0){if(h=o[u+1],h&&h.hasOwnProperty("t"))g=h.t/p;else{const r=e.segmentAvailabilityRange?e.segmentAvailabilityRange.end:n.calcSegmentAvailabilityRange(e,t).end;g=n.calcMediaTimeFromPresentationTime(r,e),e.segmentDuration=l.d/p}f=Math.ceil((g-E)/(l.d/p))-1}for(d=0;d<=f&&!T;d++)_++,T=r(m,E,i,a,l,p,_,u),T&&(e.segmentDuration=l.d/p,(d<f-1||u<c-1)&&_++),m+=l.d,E=m/p}e.availableSegmentsNumber=_}return r={getSegmentByIndex:function(e,r,a){if(i(),!e)return null;let o=null,l=!1;return s(e,(function(r,i,s,u,c,d,f,g){if(l||a<0){let i=s.media,a=c.mediaRange;return u&&(i=u[g].media||"",a=u[g].mediaRange),o=Gt(n,t,e,r,c.d,d,i,a,f,c.tManifest),!0}return i>=a-.5*c.d/d&&(l=!0),!1})),o},getSegmentByTime:function(e,r){if(i(),!e)return null;void 0===r&&(r=null);let a=null;const o=n.calcMediaTimeFromPresentationTime(r,e);return s(e,(function(r,i,s,l,u,c,d,f){if(o<i+u.d/c){let i=s.media,o=u.mediaRange;return l&&(i=l[f].media||"",o=l[f].mediaRange),a=Gt(n,t,e,r,u.d,c,i,o,d,u.tManifest),!0}return!1})),a}},r}Yt.__dashjs_factory_name="TimelineSegmentsGetter";const Kt=R.getClassFactory(Yt);function qt(e,t){const n=(e=e||{}).timelineConverter;let r;function i(){if(!n||!n.hasOwnProperty("calcPeriodRelativeTimeFromMpdRelativeTime"))throw new Error(A.MISSING_CONFIG_ERROR)}function s(e,r){if(i(),!e)return null;const s=e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.index].AdaptationSet_asArray[e.adaptation.index].Representation_asArray[e.index].SegmentTemplate;r=Math.max(r,0);const a=kt(n,t,e,r);if(a){a.replacementTime=Math.round((r-1)*e.segmentDuration*e.timescale,10);let t=s.media;t=xt(t,"Number",a.replacementNumber),t=xt(t,"Time",a.replacementTime),a.media=t}const o=e.segmentDuration,l=e.segmentAvailabilityRange;return isNaN(o)?e.availableSegmentsNumber=1:e.availableSegmentsNumber=Math.ceil((l.end-l.start)/o),a}return r={getSegmentByIndex:s,getSegmentByTime:function(e,t){if(i(),!e)return null;const r=e.segmentDuration;if(isNaN(r))return null;const a=n.calcPeriodRelativeTimeFromMpdRelativeTime(e,t);return s(e,Math.floor(a/r))}},r}qt.__dashjs_factory_name="TemplateSegmentsGetter";const Ht=R.getClassFactory(qt);function Vt(e,t){const n=(e=e||{}).timelineConverter;let r;function i(){if(!n||!n.hasOwnProperty("calcPeriodRelativeTimeFromMpdRelativeTime"))throw new Error(A.MISSING_CONFIG_ERROR)}function s(e,r){if(i(),!e)return null;const s=e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.index].AdaptationSet_asArray[e.adaptation.index].Representation_asArray[e.index].SegmentList,a=s.SegmentURL_asArray.length,o=e&&!isNaN(e.startNumber)?e.startNumber:1,l=Math.max(o-1,0),u=Math.max(r-l,0);let c=null;if(u<a){const i=s.SegmentURL_asArray[u];c=kt(n,t,e,r),c&&(c.replacementTime=(o+r-1)*e.segmentDuration,c.media=i.media?i.media:"",c.mediaRange=i.mediaRange,c.index=r,c.indexRange=i.indexRange)}return e.availableSegmentsNumber=a,c}return r={getSegmentByIndex:s,getSegmentByTime:function(e,t){if(i(),!e)return null;const r=e.segmentDuration;if(isNaN(r))return null;const a=n.calcPeriodRelativeTimeFromMpdRelativeTime(e,t);return s(e,Math.floor(a/r))}},r}Vt.__dashjs_factory_name="ListSegmentsGetter";const jt=R.getClassFactory(Vt);function zt(e){const t=(e=e||{}).timelineConverter;let n;function r(){if(!t||!t.hasOwnProperty("calcPeriodRelativeTimeFromMpdRelativeTime"))throw new Error(A.MISSING_CONFIG_ERROR)}function i(e,t){if(r(),!e)return null;const n=e.segments?e.segments.length:-1;let i;if(t<n&&(i=e.segments[t],i&&i.availabilityIdx===t))return i;for(let r=0;r<n;r++)if(i=e.segments[r],i&&i.availabilityIdx===t)return i;return null}return n={getSegmentByIndex:i,getSegmentByTime:function(e,t){return r(),i(e,function(e,t){if(!e)return-1;const n=e.segments,r=n?n.length:null;let i,s,a,o,l,u=-1;if(n&&r>0)for(l=0;l<r;l++)if(s=n[l],a=s.presentationStartTime,o=s.duration,i=o/2,t+i>=a&&t-i<a+o){u=s.availabilityIdx;break}return u}(e,t))}},n}zt.__dashjs_factory_name="SegmentBaseGetter";const Wt=R.getClassFactory(zt);function Xt(e){e=e||{};const t=this.context,n=e.events,r=e.eventBus,i=e.dashConstants,s=e.streamInfo,a=e.type;let o,l;function u(e){return e?e.segments?l[i.SEGMENT_BASE]:l[e.segmentInfoType]:null}return o={initialize:function(n){l[i.SEGMENT_TIMELINE]=Kt(t).create(e,n),l[i.SEGMENT_TEMPLATE]=Ht(t).create(e,n),l[i.SEGMENT_LIST]=jt(t).create(e,n),l[i.SEGMENT_BASE]=Wt(t).create(e,n)},update:function(e,t,i,o){i||r.trigger(n.SEGMENTBASE_INIT_REQUEST_NEEDED,{streamId:s.id,mediaType:a,mimeType:t,representation:e}),o||r.trigger(n.SEGMENTBASE_SEGMENTSLIST_REQUEST_NEEDED,{streamId:s.id,mediaType:a,mimeType:t,representation:e})},getSegmentByIndex:function(e,t,n){const r=u(e);return r?r.getSegmentByIndex(e,t,n):null},getSegmentByTime:function(e,t){const n=u(e);return n?n.getSegmentByTime(e,t):null}},l={},o}Xt.__dashjs_factory_name="SegmentsController";const Qt=R.getClassFactory(Xt);function $t(e){e=e||{};const t=this.context,n=e.eventBus,r=e.events,i=e.debug,s=e.dashConstants,a=e.urlUtils,o=e.type,l=e.streamInfo,u=e.timelineConverter,c=e.dashMetrics,d=e.baseURLController;let f,g,h,p,m,E,_,T,y;function A(){return o}function S(){h=-1,p=null}function I(){S(),m=null,y=null,T=null}function R(e,t,n){const r=d.resolve(n.path);let i,s;return r&&t!==r.url&&a.isRelative(t)?(i=r.url,s=r.serviceLocation,t&&(i=a.resolve(t,i))):i=t,!a.isRelative(i)&&(e.url=i,e.serviceLocation=s,!0)}function N(e){!function(e){const t=e.hasInitialization(),i=e.hasSegments();t&&i?n.trigger(r.REPRESENTATION_UPDATE_COMPLETED,{representation:e},{streamId:l.id,mediaType:o}):y.update(e,T,t,i)}(e.representation)}function D(e,t){if(null==t)return null;const n=new U,r=t.representation,i=r.adaptation.period.mpd.manifest.Period_asArray[r.adaptation.period.index].AdaptationSet_asArray[r.adaptation.index].Representation_asArray[r.index].bandwidth;let s=t.media;return s=xt(s,"Number",t.replacementNumber),s=xt(s,"Time",t.replacementTime),s=xt(s,"Bandwidth",i),s=Ft(s,r.id),s=Pt(s),n.mediaType=A(),n.type=F.MEDIA_SEGMENT_TYPE,n.range=t.mediaRange,n.startTime=t.presentationStartTime,n.mediaStartTime=t.mediaStartTime,n.duration=t.duration,n.timescale=r.timescale,n.availabilityStartTime=t.availabilityStartTime,n.availabilityEndTime=t.availabilityEndTime,n.wallStartTime=t.wallStartTime,n.quality=r.index,n.index=t.availabilityIdx,n.mediaInfo=e,n.adaptationIndex=r.adaptation.index,n.representationId=r.id,R(n,s,r)?n:void 0}function C(e){let t=!1;if(!e)return t;if(E){if(_)t=!0;else if(p){const n=parseFloat((p.presentationStartTime-e.adaptation.period.start).toFixed(5));t=(p.duration>0?n+1.5*p.duration:n)>=e.adaptation.period.duration}}else h>=e.availableSegmentsNumber&&(t=!0);return t}function b(e){const t=e.representation;t.segments&&n.trigger(r.REPRESENTATION_UPDATE_COMPLETED,{representation:t},{streamId:l.id,mediaType:o})}function v(e){if(e.error)return;const t=e.segments,i=e.representation,s=[];let a,d,f,g,h=0;for(a=0,d=t?t.length:0;a<d;a++)f=t[a],g=Gt(u,E,i,f.startTime,f.duration,f.timescale,f.media,f.mediaRange,h),g&&(s.push(g),g=null,h++);if(s.length>0&&(i.segmentAvailabilityRange={start:s[0].presentationStartTime,end:s[s.length-1].presentationStartTime},i.availableSegmentsNumber=s.length,i.segments=s,E)){!function(e){u.setExpectedLiveEdge(e),c.updateManifestUpdateInfo({presentationStartTime:e})}(s[s.length-1].presentationStartTime-8)}i.hasInitialization()&&n.trigger(r.REPRESENTATION_UPDATE_COMPLETED,{representation:i},{streamId:l.id,mediaType:o})}function M(){g.debug("Dynamic stream complete"),_=!0}return f={initialize:function(e){E=e,_=!1,y.initialize(e)},getStreamId:function(){return l.id},getType:A,getStreamInfo:function(){return l},getInitRequest:function(e,t){return t?function(e,t,n){const r=new U,i=t.adaptation.period,s=i.start;if(r.mediaType=n,r.type=F.INIT_SEGMENT_TYPE,r.range=t.range,r.availabilityStartTime=u.calcAvailabilityStartTimeFromPresentationTime(s,i.mpd,E),r.availabilityEndTime=u.calcAvailabilityEndTimeFromPresentationTime(s+i.duration,i.mpd,E),r.quality=t.index,r.mediaInfo=e,r.representationId=t.id,R(r,t.initialization,t))return r.url=xt(r.url,"Bandwidth",t.bandwidth),r}(e,t,A()):null},getRequestForSegment:D,getSegmentRequestForTime:function(e,t,n,r){let i=null;if(!t||!t.segmentInfoType)return i;const a=h,l=!!r&&r.keepIdx,u=!(!r||!r.ignoreIsFinished);m!==n&&(m=n,g.debug("Getting the request for time : "+n));const c=y.getSegmentByTime(t,n);if(c)h=c.availabilityIdx,p=c,g.debug("Index for time "+n+" is "+h),i=D(e,c);else{!u&&C(t)&&(i=new U,i.action=U.ACTION_COMPLETE,i.index=h-1,i.mediaType=o,i.mediaInfo=e,g.debug("Signal complete in getSegmentRequestForTime"))}return l&&a>=0&&(h=t.segmentInfoType===s.SEGMENT_TIMELINE&&E?h:a),i},getNextSegmentRequest:function(e,t){let n=null;if(!t||!t.segmentInfoType)return null;m=null;let r=h+1;g.debug("Getting the next request at index: "+r);const i=y.getSegmentByIndex(t,r,p?p.mediaStartTime:-1);if(!i&&function(e){return!isFinite(e.adaptation.period.duration)}(t)&&!_)return g.debug(A()+" No segment found at index: "+r+". Wait for next loop"),null;if(i?(n=D(e,i),h=i.availabilityIdx):h=E?r-1:r,i)p=i;else{C(t)&&(n=new U,n.action=U.ACTION_COMPLETE,n.index=h-1,n.mediaType=A(),n.mediaInfo=e,g.debug("Signal complete"))}return n},setCurrentIndex:function(e){h=e},getCurrentIndex:function(){return h},isMediaFinished:C,reset:function(){I(),n.off(r.INITIALIZATION_LOADED,b,f),n.off(r.SEGMENTS_LOADED,v,f),n.off(r.REPRESENTATION_UPDATE_STARTED,N,f),n.off(r.DYNAMIC_TO_STATIC,M,f)},resetIndex:S,setMimeType:function(e){T=e},getNextSegmentRequestIdempotent:function(e,t){let n=null,r=h+1;const i=y.getSegmentByIndex(t,r,p?p.mediaStartTime:-1);return i?(n=D(e,i),n):null}},g=i.getLogger(f),I(),y=Qt(t).create(e),n.on(r.INITIALIZATION_LOADED,b,f),n.on(r.SEGMENTS_LOADED,v,f),n.on(r.REPRESENTATION_UPDATE_STARTED,N,f),n.on(r.DYNAMIC_TO_STATIC,M,f),f}$t.__dashjs_factory_name="DashHandler";var Zt=R.getClassFactory($t);function Jt(){let e;return e={modifyRequestURL:function(e){return e},modifyRequestHeader:function(e){return e}},e}Jt.__dashjs_factory_name="RequestModifier";var en=R.getSingletonFactory(Jt);function tn(){let e;const t=/^[a-z][a-z0-9+\-_.]*:/i,n=/^https?:\/\//i,r=/^https:\/\//i,i=/^([a-z][a-z0-9+\-_.]*:\/\/[^\/]+)\/?/i,s=(e,t)=>{try{return new window.URL(e,t).toString()}catch(t){return e}},a=(e,t)=>{let n=o;if(!t)return e;if(!c(e))return e;d(e)&&(n=l),f(e)&&(n=u);const r=n(t),i="/"!==r.charAt(r.length-1)&&"/"!==e.charAt(0)?"/":"";return[r,e].join(i)};function o(e){const t=e.indexOf("/"),n=e.lastIndexOf("/");return-1!==t?n===t+1?e:(-1!==e.indexOf("?")&&(e=e.substring(0,e.indexOf("?"))),e.substring(0,n+1)):""}function l(e){const t=e.match(i);return t?t[1]:""}function u(e){const n=e.match(t);return n?n[0]:""}function c(e){return!t.test(e)}function d(e){return c(e)&&"/"===e.charAt(0)}function f(e){return 0===e.indexOf("//")}!function(){try{new window.URL("x","http://y");e=s}catch(e){}finally{e=e||a}}();return{parseBaseUrl:o,parseOrigin:l,parseScheme:u,isRelative:c,isPathAbsolute:d,isSchemeRelative:f,isHTTPURL:function(e){return n.test(e)},isHTTPS:function(e){return r.test(e)},removeHostname:function(e){return/^(?:\w+\:\/\/)?([^\/]+)(.*)$/.exec(e)[2].substring(1)},resolve:function(t,n){return e(t,n)}}}tn.__dashjs_factory_name="DefaultURLUtils";var nn=R.getSingletonFactory(tn);function rn(){let e,t,n=[];const r=this.context;function i(e,r,i){let s=function(e){let r;for(r=0;r<n.length;r++){if(n[r].regex.test(e))return n[r].utils}return t}(i||r);return s&&"function"==typeof s[e]?s[e](r,i):t[e](r,i)}return t=nn(r).getInstance(),e={registerUrlRegex:function(e,t){n.push({regex:e,utils:t})},parseBaseUrl:function(e){return i("parseBaseUrl",e)},parseOrigin:function(e){return i("parseOrigin",e)},parseScheme:function(e){return i("parseScheme",e)},isRelative:function(e){return i("isRelative",e)},isPathAbsolute:function(e){return i("isPathAbsolute",e)},isSchemeRelative:function(e){return i("isSchemeRelative",e)},isHTTPURL:function(e){return i("isHTTPURL",e)},isHTTPS:function(e){return i("isHTTPS",e)},removeHostname:function(e){return i("removeHostname",e)},resolve:function(e,t){return i("resolve",e,t)}},e}rn.__dashjs_factory_name="URLUtils";const sn=R.getSingletonFactory(rn);class an{constructor(){this.start=null,this.mstart=null,this.starttype=null,this.trace=[]}}an.INITIAL_PLAYOUT_START_REASON="initial_playout",an.SEEK_START_REASON="seek",an.RESUME_FROM_PAUSE_START_REASON="resume",an.METRICS_COLLECTION_START_REASON="metrics_collection_start";class on{constructor(){this.representationid=null,this.subreplevel=null,this.start=null,this.mstart=null,this.duration=null,this.playbackspeed=null,this.stopreason=null}}function ln(e){e=e||{};let t,n,r,i,s,a,o,l,u,c,d,f,g=this.context,h=b(g).getInstance(),p=e.streamInfo,m=e.type,E=e.errHandler,_=e.mimeType,T=e.timelineConverter,y=e.adapter,R=e.manifestModel,N=e.mediaPlayerModel,D=e.fragmentModel,C=e.abrController,v=e.playbackController,O=e.mediaController,L=e.textController,P=e.dashMetrics,F=e.settings,x=e.boxParser;function B(){return m}function Y(){s=[],i=null,d=0}function K(e){if(e.error||o.setCurrentRepresentation(y.convertDataToRepresentationInfo(e.currentRepresentation)),!e.error||e.error.code===he.SEGMENTS_UPDATE_FAILED_ERROR_CODE){v.getStreamController().getActiveStreamInfo().id===p.id&&z()}}function q(e){let t=J(e.newQuality);o.setCurrentRepresentation(t),P.pushPlayListTraceMetrics(new Date,on.REPRESENTATION_SWITCH_STOP_REASON),P.createPlaylistTraceMetrics(t.id,1e3*v.getTime(),v.getPlaybackRate())}function H(e){P.addBufferLevel(m,new Date,1e3*e.bufferLevel);const t=v.getStreamController().getActiveStreamInfo().id;R.getValue().doNotUpdateDVRWindowOnBufferUpdated||p.id!==t||z()}function V(e){P.addBufferState(m,e.state,o.getBufferTarget()),e.state!==I.BUFFER_EMPTY||v.isSeeking()||P.pushPlayListTraceMetrics(new Date,on.REBUFFERING_REASON)}function j(e){D.syncExecutedRequestsWithBufferedRange(a.getBuffer().getAllBufferRanges(),p.duration),e.from>v.getTime()&&(d=e.from,f=!0)}function z(){const e=p.manifestInfo,t=e.isDynamic,n=T.calcSegmentAvailabilityRange(l.getCurrentRepresentation(),t);P.addDVRInfo(B(),v.getTime(),e,n)}function X(){return a?a.getBuffer():null}function $(){return s}function Z(){return i}function J(e){let t;return void 0!==e?(Q(e),t=l?l.getRepresentationForQuality(e):null):t=l?l.getCurrentRepresentation():null,y.convertDataToRepresentationInfo(t)}function ee(e){if(e.sender&&(!y.getIsTextTrack(_)||L.isTextEnabled())&&a&&e.representationId&&!a.appendInitSegment(e.representationId)){const e=c?c.getInitRequest(Z(),l.getCurrentRepresentation()):null;o.processInitRequest(e)}}function te(e){let t;a.getIsPruningInProgress()||(t=function(e,t){const n=J(),r=!isNaN(e),i=v.getNormalizedTime();let s,o=r?e:d,l=!1;if(isNaN(o)||B()===A.FRAGMENTED_TEXT&&!L.isTextEnabled())return null;if(a){let e=a.getRangeAt(o);const t=a.getRangeAt(i);if((null!==e||null!==t)&&!r&&(!e||t&&t.start!=e.start&&t.end!=e.end)){a.getBuffer().hasDiscontinuitiesAfter(i)&&B()!==A.FRAGMENTED_TEXT&&(D.removeExecutedRequestsAfterTime(t.end),l=!0)}}if(t)o=t.startTime+t.duration/2,s=ie(n,o,{timeThreshold:0,ignoreIsFinished:!0});else{const e=r||f||l;for(s=ie(n,e?o:void 0,{keepIdx:!e}),f=!1;s&&s.action!==U.ACTION_COMPLETE&&D.isFragmentLoaded(s);)s=ie(n)}return s}(e.seekTarget,e.replacement),t&&(o.setSeekTarget(NaN),e.replacement||(isNaN(t.startTime+t.duration)||(d=t.startTime+t.duration),t.delayLoadingTime=(new Date).getTime()+o.getTimeToLoadDelay(),o.setTimeToLoadDelay(0)))),o.processMediaRequest(t)}function ne(e){const t=e.chunk,n=t.bytes,r=t.quality,i=J(r),s=l&&i?l.getRepresentationForQuality(i.quality):null,a=y.getEventsFor(i.mediaInfo),o=y.getEventsFor(i,s);if(a&&a.length>0||o&&o.length>0){const e=function(e,t,n,r){try{const i={},s=[],a=n.concat(r);for(let e=0,t=a.length;e<t;e++)i[a[e].schemeIdUri+"/"+a[e].value]=a[e];const o=W(g).getInstance().parse(e),u=o.getBoxes("emsg");if(!u||0===u.length)return s;const c=o.getBox("sidx"),d=!c||isNaN(c.earliest_presentation_time)||isNaN(c.timescale)?t&&!isNaN(t.mediaStartTime)?t.mediaStartTime:0:c.earliest_presentation_time/c.timescale,f=Math.max(d,0),h=l.getCurrentRepresentation();for(let e=0,t=u.length;e<t;e++){const t=y.getEvent(u[e],i,f,h);t&&s.push(t)}return s}catch(e){return[]}}(n,D.getRequests({state:k.FRAGMENT_MODEL_EXECUTED,quality:r,index:t.index})[0],a,o);h.trigger(M.INBAND_EVENTS,{events:e},{streamId:p.id})}}function re(e){d=e.time,o.setSeekTarget(e.time)}function ie(e,t,n){let r=null;if(c){const i=l&&e?l.getRepresentationForQuality(e.quality):null;r=void 0!==t&&void 0!==n?c.getSegmentRequestForTime(Z(),i,t,n):c.getNextSegmentRequest(Z(),i)}return r}return t={initialize:function(n,i){c=Zt(g).create({streamInfo:p,type:m,timelineConverter:T,dashMetrics:P,mediaPlayerModel:N,baseURLController:e.baseURLController,errHandler:E,settings:F,boxParser:x,events:M,eventBus:h,errors:he,debug:w(g).getInstance(),requestModifier:en(g).getInstance(),dashConstants:S,constants:A,urlUtils:sn(g).getInstance()}),r=p.manifestInfo.isDynamic,r&&(u=Ot(g).create({timelineConverter:T})),c.initialize(r),C.registerStreamType(m,t),l=vt(g).create({streamInfo:p,type:m,abrController:C,dashMetrics:P,playbackController:v,timelineConverter:T,dashConstants:S,events:M,eventBus:h,errors:he}),a=function(e){let t=null;if(!e)return E.error(new G(he.MEDIASOURCE_TYPE_UNSUPPORTED_CODE,he.MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE+"not properly defined")),null;t=e===A.VIDEO||e===A.AUDIO?Tt(g).create({streamInfo:p,type:e,mediaPlayerModel:N,manifestModel:R,fragmentModel:D,errHandler:E,mediaController:O,representationController:l,adapter:y,textController:L,abrController:C,playbackController:v,settings:F}):It(g).create({streamInfo:p,type:e,mimeType:_,mediaPlayerModel:N,manifestModel:R,fragmentModel:D,errHandler:E,mediaController:O,representationController:l,adapter:y,textController:L,abrController:C,playbackController:v,settings:F});return t}(m),a&&a.initialize(n),o=Ct(g).create({streamInfo:p,type:m,mimeType:_,adapter:y,dashMetrics:P,mediaPlayerModel:N,fragmentModel:D,abrController:C,playbackController:v,textController:L,mediaController:O,bufferController:a,settings:F}),o.initialize(i),d=0,f=!1},getStreamId:function(){return p.id},getType:B,isUpdating:function(){return!!l&&l.isUpdating()},getBufferController:function(){return a},getFragmentModel:function(){return D},getScheduleController:function(){return o},getRepresentationController:function(){return l},getRepresentationInfo:J,getBufferLevel:function(){return a?a.getBufferLevel():0},isBufferingCompleted:function(){return!!a&&a.getIsBufferingCompleted()},createBuffer:function(e){return X()||a?a.createBuffer(s,e):null},updateStreamInfo:function(e){p=e,F.get().streaming.useAppendWindow&&a.updateAppendWindow()},getStreamInfo:function(){return p},selectMediaInfo:function(e){e===i||e&&i&&e.type!==i.type||(i=e);const t=y.getRealAdaptation(p,i),n=y.getVoRepresentations(i);if(l){const e=l.getData(),r=C.getTopQualityIndexFor(m,p.id),s=C.getMinAllowedIndexFor(m);let a,o,u=null;null!==e&&e.id==t.id||m===A.FRAGMENTED_TEXT?a=C.getQualityFor(m):(o=C.getThroughputHistory().getAverageThroughput(m),u=o||C.getInitialBitrateFor(m),a=C.getQualityForBitrate(i,u)),void 0!==s&&a<s&&(a=s),a>r&&(a=r),c.setMimeType(i?i.mimeType:null),l.updateData(t,n,m,a)}},addMediaInfo:function(e,t){-1===s.indexOf(e)&&s.push(e),t&&this.selectMediaInfo(e)},getLiveStartTime:function(){if(!r)return NaN;if(!u)return NaN;let e=NaN;const t=J(),i=u.getLiveEdge(t);if(isNaN(i))return NaN;const s=function(e,t){try{let r=null,i=v.getLiveDelay();const s=isNaN(p.manifestInfo.DVRWindowSize)?i:p.manifestInfo.DVRWindowSize,a=.1*s;let o;if(!isFinite(s)||ie(t,e-s+a,{ignoreIsFinished:!0}))for(;!r&&i<=s;)o=e-i,r=ie(t,o,{ignoreIsFinished:!0}),r||(i+=1);return r&&v.setLiveDelay(i,!0),n.debug("live edge: "+e+", live delay: "+i+", live target: "+o),r}catch(e){return null}}(i,t);return s&&(e=F.get().streaming.lowLatencyEnabled?s.duration<N.getLiveDelay()?s.startTime:s.startTime+s.duration-N.getLiveDelay():s.startTime),e},switchTrackAsked:function(){o.switchTrackAsked()},getMediaInfoArr:$,getMediaInfo:Z,getMediaSource:function(){return a.getMediaSource()},setMediaSource:function(e){a.setMediaSource(e,$())},dischargePreBuffer:function(){a.dischargePreBuffer()},getBuffer:X,setBuffer:function(e){a.setBuffer(e)},setBufferingTime:function(e){d=e},resetIndexHandler:function(){c&&c.resetIndex()},getInitRequest:function(e){Q(e);const t=l?l.getRepresentationForQuality(e):null;return c?c.getInitRequest(Z(),t):null},getFragmentRequest:ie,finalisePlayList:function(e,t){P.pushPlayListTraceMetrics(e,t)},probeNextRequest:function(){const e=J(),t=l&&e?l.getRepresentationForQuality(e.quality):null;return c.getNextSegmentRequestIdempotent(Z(),t)},reset:function(e,n){c&&c.reset(),a&&(a.reset(e,n),a=null),o&&(o.reset(),o=null),l&&(l.reset(),l=null),u&&(u.reset(),u=null),C&&!n&&C.unRegisterStreamType(m),h.off(M.DATA_UPDATE_COMPLETED,K,t),h.off(M.QUALITY_CHANGE_REQUESTED,q,t),h.off(M.INIT_FRAGMENT_NEEDED,ee,t),h.off(M.MEDIA_FRAGMENT_NEEDED,te,t),h.off(M.MEDIA_FRAGMENT_LOADED,ne,t),h.off(M.BUFFER_LEVEL_UPDATED,H,t),h.off(M.BUFFER_LEVEL_STATE_CHANGED,V,t),h.off(M.BUFFER_CLEARED,j,t),h.off(M.SEEK_TARGET,re,t),Y(),m=null,p=null}},n=w(g).getInstance().getLogger(t),Y(),h.on(M.DATA_UPDATE_COMPLETED,K,t,{priority:b.EVENT_PRIORITY_HIGH}),h.on(M.QUALITY_CHANGE_REQUESTED,q,t),h.on(M.INIT_FRAGMENT_NEEDED,ee,t),h.on(M.MEDIA_FRAGMENT_NEEDED,te,t),h.on(M.MEDIA_FRAGMENT_LOADED,ne,t),h.on(M.BUFFER_LEVEL_UPDATED,H,t),h.on(M.BUFFER_LEVEL_STATE_CHANGED,V,t),h.on(M.BUFFER_CLEARED,j,t),h.on(M.SEEK_TARGET,re,t),t}on.REPRESENTATION_SWITCH_STOP_REASON="representation_switch",on.REBUFFERING_REASON="rebuffering",on.USER_REQUEST_STOP_REASON="user_request",on.END_OF_PERIOD_STOP_REASON="end_of_period",on.END_OF_CONTENT_STOP_REASON="end_of_content",on.METRICS_COLLECTION_STOP_REASON="metrics_collection_end",on.FAILURE_STOP_REASON="failure",ln.__dashjs_factory_name="StreamProcessor";var un=R.getClassFactory(ln);class cn{constructor(){this.streamId=null,this.mediaInfo=null,this.segmentType=null,this.quality=NaN,this.index=NaN,this.bytes=null,this.start=NaN,this.end=NaN,this.duration=NaN,this.representationId=null,this.endFragment=null}}function dn(e){const t=(e=e||{}).requestModifier;let n;return n={load:function(e){const n=new Date,r=e.request;let i=new XMLHttpRequest;i.open(e.method,e.url,!0),r.responseType&&(i.responseType=r.responseType),r.range&&i.setRequestHeader("Range","bytes="+r.range),r.requestStartDate||(r.requestStartDate=n),t&&(i=t.modifyRequestHeader(i)),i.withCredentials=e.withCredentials,i.onload=e.onload,i.onloadend=e.onend,i.onerror=e.onerror,i.onprogress=e.progress,i.onabort=e.onabort,i.ontimeout=e.ontimeout,i.timeout=e.timeout,i.send(),e.response=i},abort:function(e){const t=e.response;t.onloadend=t.onerror=t.onprogress=void 0,t.abort()}},n}dn.__dashjs_factory_name="XHRLoader";const fn=R.getClassFactory(dn);class gn{static mixin(e,t,n){let r,i={};if(e)for(let s in t)t.hasOwnProperty(s)&&(r=t[s],s in e&&(e[s]===r||s in i&&i[s]===r)||("object"==typeof e[s]&&null!==e[s]?e[s]=gn.mixin(e[s],r,n):e[s]=n(r)));return e}static clone(e){if(!e||"object"!=typeof e)return e;let t;if(e instanceof Array){t=[];for(let n=0,r=e.length;n<r;++n)n in e&&t.push(gn.clone(e[n]))}else t={};return gn.mixin(t,e,gn.clone)}static addAditionalQueryParameterToUrl(e,t){try{if(!t||0===t.length)return e;let n=new URL(e);return t.forEach(e=>{e.key&&e.value&&n.searchParams.set(e.key,e.value)}),n.href}catch(t){return e}}static parseHttpHeaders(e){let t={};if(!e)return t;let n=e.trim().split("\r\n");for(let e=0,r=n.length;e<r;e++){let r=n[e],i=r.indexOf(": ");i>0&&(t[r.substring(0,i)]=r.substring(i+2))}return t}static generateUuid(){let e=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){const n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?n:3&n|8).toString(16)}))}static generateHashCode(e){let t=0;if(0===e.length)return t;for(let n=0;n<e.length;n++){t=(t<<5)-t+e.charCodeAt(n),t|=0}return t}}function hn(){let e;const t={debug:{logLevel:w.LOG_LEVEL_WARNING,dispatchEvent:!1},streaming:{metricsMaxListDepth:1e3,abandonLoadTimeout:1e4,liveDelayFragmentCount:NaN,liveDelay:null,scheduleWhilePaused:!0,fastSwitchEnabled:!1,flushBufferAtTrackSwitch:!1,calcSegmentAvailabilityRangeFromTimeline:!1,reuseExistingSourceBuffers:!0,bufferPruningInterval:10,bufferToKeep:20,jumpGaps:!0,jumpLargeGaps:!0,smallGapLimit:1.5,stableBufferTime:12,bufferTimeAtTopQuality:30,bufferTimeAtTopQualityLongForm:60,longFormContentDurationThreshold:600,wallclockTimeUpdateInterval:50,lowLatencyEnabled:!1,keepProtectionMediaKeys:!1,useManifestDateHeaderTimeSource:!0,useSuggestedPresentationDelay:!0,useAppendWindow:!0,manifestUpdateRetryInterval:100,stallThreshold:.5,filterUnsupportedEssentialProperties:!0,utcSynchronization:{backgroundAttempts:2,timeBetweenSyncAttempts:30,maximumTimeBetweenSyncAttempts:600,minimumTimeBetweenSyncAttempts:2,timeBetweenSyncAttemptsAdjustmentFactor:2,maximumAllowedDrift:100,enableBackgroundSyncAfterSegmentDownloadError:!0,defaultTimingSource:{scheme:"urn:mpeg:dash:utc:http-xsdate:2014",value:"http://time.akamai.com/?iso&ms"}},liveCatchup:{minDrift:.02,maxDrift:0,playbackRate:.5,latencyThreshold:60,playbackBufferMin:.5,enabled:!1,mode:A.LIVE_CATCHUP_MODE_DEFAULT},lastBitrateCachingInfo:{enabled:!0,ttl:36e4},lastMediaSettingsCachingInfo:{enabled:!0,ttl:36e4},cacheLoadThresholds:{video:50,audio:5},trackSwitchMode:{audio:A.TRACK_SWITCH_MODE_ALWAYS_REPLACE,video:A.TRACK_SWITCH_MODE_NEVER_REPLACE},selectionModeForInitialTrack:A.TRACK_SELECTION_MODE_HIGHEST_BITRATE,fragmentRequestTimeout:0,retryIntervals:{[F.MPD_TYPE]:500,[F.XLINK_EXPANSION_TYPE]:500,[F.MEDIA_SEGMENT_TYPE]:1e3,[F.INIT_SEGMENT_TYPE]:1e3,[F.BITSTREAM_SWITCHING_SEGMENT_TYPE]:1e3,[F.INDEX_SEGMENT_TYPE]:1e3,[F.OTHER_TYPE]:1e3,lowLatencyReductionFactor:10},retryAttempts:{[F.MPD_TYPE]:3,[F.XLINK_EXPANSION_TYPE]:1,[F.MEDIA_SEGMENT_TYPE]:3,[F.INIT_SEGMENT_TYPE]:3,[F.BITSTREAM_SWITCHING_SEGMENT_TYPE]:3,[F.INDEX_SEGMENT_TYPE]:3,[F.OTHER_TYPE]:3,lowLatencyMultiplyFactor:5},abr:{movingAverageMethod:A.MOVING_AVERAGE_SLIDING_WINDOW,ABRStrategy:A.ABR_STRATEGY_DYNAMIC,bandwidthSafetyFactor:.9,useDefaultABRRules:!0,useDeadTimeLatency:!0,limitBitrateByPortal:!1,usePixelRatioInLimitBitrateByPortal:!1,maxBitrate:{audio:-1,video:-1},minBitrate:{audio:-1,video:-1},maxRepresentationRatio:{audio:1,video:1},initialBitrate:{audio:-1,video:-1},initialRepresentationRatio:{audio:-1,video:-1},autoSwitchBitrate:{audio:!0,video:!0},fetchThroughputCalculationMode:A.ABR_FETCH_THROUGHPUT_CALCULATION_DOWNLOADED_DATA},cmcd:{enabled:!1,sid:null,cid:null,rtp:null,rtpSafetyFactor:5}}};let n=gn.clone(t);return e={get:function(){return n},update:function(e){"object"==typeof e&&function e(t,n,r){for(let i in t)t.hasOwnProperty(i)&&n.hasOwnProperty(i)&&("object"==typeof t[i]&&null!==t[i]?e(t[i],n[i],r.slice()+i+"."):n[i]=gn.clone(t[i]))}(e,n,"")},reset:function(){n=gn.clone(t)}},e}hn.__dashjs_factory_name="Settings";let pn=R.getSingletonFactory(hn);function mn(e){e=e||{};const t=this.context,n=e.requestModifier,r=e.boxParser,i=pn(t).getInstance();let s;function a(e,t){e.reader.read().then(t).catch((function(t){e.onerror&&200===e.response.status&&e.onerror(t)}))}function o(e,t,n,r,i){switch(e){case A.ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING:return function(e,t){try{let n,r;n=e.filter((t,n)=>n>0&&n<e.length-1),r=t.filter((e,n)=>n>0&&n<t.length-1);let i=0;if(n.length>1){for(let e=0;e<n.length;e++)if(n[e]&&r[e]){let t=r[e].ts-n[e].ts;i+=t}return i}return null}catch(e){return null}}(t,n);case A.ABR_FETCH_THROUGHPUT_CALCULATION_DOWNLOADED_DATA:default:return l(r,i)}}function l(e,t){try{if((e=e.filter(n=>n.bytes>t/4/e.length)).length>1){let t=0;const n=(e[e.length-1].ts-e[0].ts)/e.length;return e.forEach((r,i)=>{const s=e[i+1];if(s){const e=s.ts-r.ts;t+=e<n?e:0}}),t}return null}catch(e){return null}}return s={load:function(e){const t=new Date,s=e.request,l=new Headers;let u;s.range&&l.append("Range","bytes="+s.range),s.requestStartDate||(s.requestStartDate=t),n&&n.modifyRequestHeader({setRequestHeader:function(e,t){l.append(e,t)}}),"function"==typeof window.AbortController&&(u=new AbortController,e.abortController=u,u.signal.onabort=e.onabort);const c={method:e.method,headers:l,credentials:e.withCredentials?"include":void 0,signal:u?u.signal:void 0};fetch(e.url,c).then((function(t){e.response||(e.response={}),e.response.status=t.status,e.response.statusText=t.statusText,e.response.responseURL=t.url,t.ok||e.onerror();let n="";for(const e of t.headers.keys())n+=e+": "+t.headers.get(e)+"\r\n";if(e.response.responseHeaders=n,!t.body)return t.arrayBuffer().then((function(t){e.response.response=t;const n={loaded:t.byteLength,total:t.byteLength,stream:!1};e.progress(n),e.onload(),e.onend()}));const s=parseInt(t.headers.get("Content-Length"),10);let l=0,u=!1,c=new Uint8Array,d=0;e.reader=t.body.getReader();let f=[],g=[],h=[],p=!0;const m=i.get().streaming.abr.fetchThroughputCalculationMode,E=function({value:t,done:n}){if(n)return c&&(e.progress({loaded:l,total:isNaN(s)?l:s,lengthComputable:!0,time:o(m,g,h,f,l),stream:!0}),e.response.response=c.buffer),e.onload(),void e.onend();if(t&&t.length>0){if(c=function(e,t){if(0===e.length)return t;const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}(c,t),l+=t.length,f.push({ts:Date.now(),bytes:t.length}),m===A.ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING&&p){r.findLastTopIsoBoxCompleted(["moof"],c,d).found&&(p=!1,g.push({ts:performance.now(),bytes:t.length}))}const n=r.findLastTopIsoBoxCompleted(["moov","mdat"],c,d);if(n.found){const t=n.lastCompletedOffset+n.size;let r;m===A.ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING&&(p=!0,h.push({ts:performance.now(),bytes:c.length})),t===c.length?(r=c,c=new Uint8Array):(r=new Uint8Array(c.subarray(0,t)),c=c.subarray(t)),e.progress({data:r.buffer,lengthComputable:!1,noTrace:!0}),d=0}else d=n.lastCompletedOffset,u||(e.progress({lengthComputable:!1,noTrace:!0}),u=!0)}a(e,E)};a(e,E)})).catch((function(t){e.onerror&&e.onerror(t)}))},abort:function(e){if(e.abortController)e.abortController.abort();else if(e.reader)try{e.reader.cancel(),e.onabort()}catch(e){}},calculateDownloadedTime:o},s}mn.__dashjs_factory_name="FetchLoader";const En=R.getClassFactory(mn);let _n=new class extends N{constructor(){super(),this.METRICS_INITIALISATION_COMPLETE="internal_metricsReportingInitialized",this.BECAME_REPORTING_PLAYER="internal_becameReportingPlayer",this.CMCD_DATA_GENERATED="cmcdDataGenerated"}};class Tn{constructor(){this.id=null,this.index=-1,this.adaptation=null,this.segmentInfoType=null,this.initialization=null,this.codecs=null,this.codecPrivateData=null,this.segmentDuration=NaN,this.timescale=1,this.startNumber=1,this.indexRange=null,this.range=null,this.presentationTimeOffset=0,this.MSETimeOffset=NaN,this.segmentAvailabilityRange=null,this.availableSegmentsNumber=0,this.bandwidth=NaN,this.width=NaN,this.height=NaN,this.scanType=null,this.maxPlayoutRate=NaN,this.availabilityTimeOffset=0,this.availabilityTimeComplete=!0}hasInitialization(){return null!==this.initialization||null!==this.range}hasSegments(){return this.segmentInfoType!==S.BASE_URL&&this.segmentInfoType!==S.SEGMENT_BASE&&!this.indexRange}}class yn{constructor(){this.period=null,this.index=-1,this.type=null}}class An{constructor(){this.id=null,this.index=-1,this.duration=NaN,this.start=NaN,this.mpd=null}}An.DEFAULT_ID="defaultId";class Sn{constructor(){this.manifest=null,this.suggestedPresentationDelay=0,this.availabilityStartTime=null,this.availabilityEndTime=Number.POSITIVE_INFINITY,this.timeShiftBufferDepth=Number.POSITIVE_INFINITY,this.maxSegmentDuration=Number.POSITIVE_INFINITY,this.publishTime=null,this.minimumUpdatePeriod=NaN,this.mediaPresentationDuration=NaN}}class In{constructor(){this.schemeIdUri="",this.value=""}}class Rn{constructor(){this.duration=NaN,this.presentationTime=NaN,this.id=NaN,this.messageData="",this.eventStream=null,this.presentationTimeDelta=NaN}}class Nn{constructor(e,t,n,r){this.url=e||"",this.serviceLocation=t||e||"",this.dvb_priority=n||1,this.dvb_weight=r||1,this.availabilityTimeOffset=0,this.availabilityTimeComplete=!0}}Nn.DEFAULT_DVB_PRIORITY=1,Nn.DEFAULT_DVB_WEIGHT=1;class Dn{constructor(){this.adaptionSet=null,this.representation=null,this.period=null,this.timescale=1,this.value="",this.schemeIdUri="",this.presentationTimeOffset=0}}var Cn=Array.isArray,bn=Object.keys,vn=Object.prototype.hasOwnProperty;function Mn(){let e;return e={areEqual:function(e,t){return function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){var r,i,s,a=Cn(t),o=Cn(n);if(a&&o){if((i=t.length)!=n.length)return!1;for(r=i;0!=r--;)if(!e(t[r],n[r]))return!1;return!0}if(a!=o)return!1;var l=t instanceof Date,u=n instanceof Date;if(l!=u)return!1;if(l&&u)return t.getTime()==n.getTime();var c=t instanceof RegExp,d=n instanceof RegExp;if(c!=d)return!1;if(c&&d)return t.toString()==n.toString();var f=bn(t);if((i=f.length)!==bn(n).length)return!1;for(r=i;0!=r--;)if(!vn.call(n,f[r]))return!1;for(r=i;0!=r--;)if(!e(t[s=f[r]],n[s]))return!1;return!0}return t!=t&&n!=n}(e,t)}},e}Mn.__dashjs_factory_name="ObjectUtils";var On=R.getSingletonFactory(Mn);class wn{constructor(){this.bitrate=0,this.width=0,this.height=0,this.tilesHor=0,this.tilesVert=0,this.widthPerTile=0,this.heightPerTile=0,this.startNumber=0,this.segmentDuration=0,this.timescale=0,this.templateUrl="",this.id=""}}const Ln=["http://dashif.org/thumbnail_tile","http://dashif.org/guidelines/thumbnail_tile"];function Pn(e){const t=this.context,n=e.adapter,r=e.baseURLController,i=e.streamInfo,s=e.timelineConverter,a=e.debug,o=e.eventBus,l=e.events,u=e.dashConstants,c=sn(t).getInstance();let d,f,g,h,p,m,E;function _(){y(),m=fn(t).create({}),E=W(t).getInstance(),g=Zt(t).create({streamInfo:i,timelineConverter:s,baseURLController:r,debug:a,eventBus:o,events:l,dashConstants:u,urlUtils:c}),g.initialize(!!n&&n.getIsDynamic()),function(){if(!i||!n)return;if(p=n.getMediaInfoForType(i,A.IMAGE),!p)return;const e=n.getVoRepresentations(p);e&&e.length>0&&e.forEach(e=>{(e.segmentInfoType===S.SEGMENT_TEMPLATE&&e.segmentDuration>0&&e.media||e.segmentInfoType===S.SEGMENT_TIMELINE)&&T(e),e.segmentInfoType===S.SEGMENT_BASE&&T(e,!0)});f.length>0&&(f.sort((e,t)=>e.bitrate-t.bitrate),h=f.length-1)}()}function T(e,t){const a=new wn;a.id=e.id,a.bitrate=e.bandwidth,a.width=e.width,a.height=e.height,a.tilesHor=1,a.tilesVert=1,e.essentialProperties&&e.essentialProperties.forEach(e=>{if(Ln.indexOf(e.schemeIdUri)>=0&&e.value){const t=e.value.split("x");2!==t.length||isNaN(t[0])||isNaN(t[1])||(a.tilesHor=parseInt(t[0],10),a.tilesVert=parseInt(t[1],10))}}),t?o.trigger(M.SEGMENTBASE_SEGMENTSLIST_REQUEST_NEEDED,{streamId:i.id,mediaType:A.IMAGE,mimeType:p.mimeType,representation:e,callback:function(e,t,i,o){let l=[];i=function(e,t){const r=[];let i,a,o,l,u=0;for(i=0,a=e.length;i<a;i++)o=e[i],l=Gt(s,n.getIsDynamic(),t,o.startTime,o.duration,o.timescale,o.media,o.mediaRange,u),l&&(r.push(l),l=null,u++);return r}(i,o),a.segmentDuration=i[0].duration,a.readThumbnail=function(e,t){let n=null;l.some(t=>{if(t.start<=e&&t.end>e)return n=t.url,!0}),n?t(n):i.some(n=>{if(n.mediaStartTime<=e&&n.mediaStartTime+n.duration>e){const e=r.resolve(o.path);return m.load({method:"get",url:e.url,request:{range:n.mediaRange,responseType:"arraybuffer"},onload:function(e){let r=E.getSamplesInfo(e.target.response),i=new Blob([e.target.response.slice(r.sampleList[0].offset,r.sampleList[0].offset+r.sampleList[0].size)],{type:"image/jpeg"}),s=window.URL.createObjectURL(i);l.push({start:n.mediaStartTime,end:n.mediaStartTime+n.duration,url:s}),t&&t(s)}}),!0}})}}}):(a.startNumber=e.startNumber,a.segmentDuration=e.segmentDuration,a.timescale=e.timescale,a.templateUrl=function(e){const t=c.isRelative(e.media)?c.resolve(e.media,r.resolve(e.path).url):e.media;if(!t)return"";return Ft(t,e.id)}(e)),a.tilesHor>0&&a.tilesVert>0&&(a.widthPerTile=a.width/a.tilesHor,a.heightPerTile=a.height/a.tilesVert,f.push(a))}function y(){f=[],h=-1,p=null}return d={initialize:_,getTracks:function(){return f},reset:y,setTrackByIndex:function(e){f&&0!==f.length&&(e>=f.length&&(e=f.length-1),h=e)},getCurrentTrack:function(){return h<0?null:f[h]},getCurrentTrackIndex:function(){return h},getThumbnailRequestForTime:function(e){let t;const r=n.getVoRepresentations(p);for(let e=0;e<r.length;e++)if(f[h].id===r[e].id){t=r[e];break}return g.getSegmentRequestForTime(p,t,e)}},_(),d}Pn.__dashjs_factory_name="ThumbnailTracks";var Fn=R.getClassFactory(Pn);function xn(){let e,t,n,r;const i=this.context,s=sn(i).getInstance(),a=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e};function o(e,t){let n,r,i,s,a,o,l=!1,u=!1;if(!e)throw new Error("adaptation is not defined");if(!t)throw new Error("type is not defined");if(e.hasOwnProperty("ContentComponent_asArray")&&(s=e.ContentComponent_asArray),a=t!==A.TEXT?new RegExp(t):new RegExp("(vtt|ttml)"),e.Representation_asArray&&e.Representation_asArray.length&&e.Representation_asArray.length>0){let n=_(e.Representation_asArray[0]);if(n&&n.length>0&&Ln.indexOf(n[0].schemeIdUri)>=0)return t===A.IMAGE;if(e.Representation_asArray[0].hasOwnProperty(S.CODECS)&&(o=e.Representation_asArray[0].codecs,0===o.search(A.STPP)||0===o.search(A.WVTT)))return t===A.FRAGMENTED_TEXT}if(s){if(s.length>1)return t===A.MUXED;s[0]&&s[0].contentType===t&&(l=!0,u=!0)}if(e.hasOwnProperty(S.MIME_TYPE)&&(l=a.test(e.mimeType),u=!0),!u)for(n=0,r=e.Representation_asArray&&e.Representation_asArray.length?e.Representation_asArray.length:0;!u&&n<r;)i=e.Representation_asArray[n],i.hasOwnProperty(S.MIME_TYPE)&&(l=a.test(i.mimeType),u=!0),n++;return l}function l(e){return o(e,A.AUDIO)}function u(e){return o(e,A.VIDEO)}function c(e){return o(e,A.FRAGMENTED_TEXT)}function d(e){return o(e,A.IMAGE)}function f(e){return"text/vtt"===e||"application/ttml+xml"===e}function g(){return(e,t)=>e.bandwidth-t.bandwidth}function h(e){return e&&Array.isArray(e.Representation_asArray)&&e.Representation_asArray.sort((e,t)=>e.bandwidth-t.bandwidth),e}function p(e,t){return e&&e.Period_asArray&&a(t)&&e.Period_asArray[t]?e.Period_asArray[t].AdaptationSet_asArray:[]}function m(e){return e&&e.Period_asArray?e.Period_asArray:[]}function E(e){let t=!1;return e&&e.hasOwnProperty("type")&&(t=e.type===S.DYNAMIC),t}function _(e){return e&&e.EssentialProperty_asArray&&e.EssentialProperty_asArray.length?e.EssentialProperty_asArray.map(e=>({schemeIdUri:e.schemeIdUri,value:e.value})):null}function T(e){let t=e.S_asArray[0],n=e.S_asArray[1];return t.hasOwnProperty("d")?t.d:n.t-t.t}function y(e){const t=e.presentationTimeOffset;return e.adaptation.period.start-t}function I(e,t){if(!e)throw new Error("Period cannot be null or undefined");let n=An.DEFAULT_ID+"_"+t;return e.hasOwnProperty(S.ID)&&e.id.length>0&&"__proto__"!==e.id&&(n=e.id),n}function R(e,t){const n=[];let r;if(!e)return n;for(r=0;r<e.length;r++){const i=new Dn;if(i.timescale=1,i.representation=t,!e[r].hasOwnProperty(A.SCHEME_ID_URI))throw new Error("Invalid EventStream. SchemeIdUri has to be set");i.schemeIdUri=e[r].schemeIdUri,e[r].hasOwnProperty(S.TIMESCALE)&&(i.timescale=e[r].timescale),e[r].hasOwnProperty(S.VALUE)&&(i.value=e[r].value),n.push(i)}return n}function N(e){const t=[],n=e.BaseURL_asArray||[e.baseUri];let r=!1;return n.some(n=>{if(n){const i=new Nn;let a=n.__text||n;return s.isRelative(a)&&(r=!0,e.baseUri&&(a=s.resolve(a,e.baseUri))),i.url=a,n.hasOwnProperty(S.SERVICE_LOCATION)&&n.serviceLocation.length?i.serviceLocation=n.serviceLocation:i.serviceLocation=a,n.hasOwnProperty(S.DVB_PRIORITY)&&(i.dvb_priority=n[S.DVB_PRIORITY]),n.hasOwnProperty(S.DVB_WEIGHT)&&(i.dvb_weight=n[S.DVB_WEIGHT]),n.hasOwnProperty(S.AVAILABILITY_TIME_OFFSET)&&(i.availabilityTimeOffset=n[S.AVAILABILITY_TIME_OFFSET]),n.hasOwnProperty(S.AVAILABILITY_TIME_COMPLETE)&&(i.availabilityTimeComplete="false"!==n[S.AVAILABILITY_TIME_COMPLETE]),t.push(i),r}}),t}return e={getIsTypeOf:o,getIsTextTrack:f,getLanguageForAdaptation:function(e){let t="";return e&&e.hasOwnProperty(S.LANG)&&(t=e.lang.replace(/[^A-Za-z0-9-]/g,"")),t},getViewpointForAdaptation:function(e){return e&&e.hasOwnProperty(S.VIEWPOINT)?e.Viewpoint:null},getRolesForAdaptation:function(e){return e&&e.hasOwnProperty(S.ROLE_ASARRAY)?e.Role_asArray:[]},getAccessibilityForAdaptation:function(e){return e&&e.hasOwnProperty(S.ACCESSIBILITY_ASARRAY)?e.Accessibility_asArray:[]},getAudioChannelConfigurationForAdaptation:function(e){return e&&e.hasOwnProperty(S.AUDIOCHANNELCONFIGURATION_ASARRAY)?e.AudioChannelConfiguration_asArray:[]},getAudioChannelConfigurationForRepresentation:function(e){return e&&e.hasOwnProperty(S.AUDIOCHANNELCONFIGURATION_ASARRAY)?e.AudioChannelConfiguration_asArray:[]},getAdaptationForIndex:function(e,t,n){const r=p(t,n);return r.length>0&&a(e)?r[e]:null},getIndexForAdaptation:function(e,t,n){if(!e)return-1;const r=p(t,n);for(let t=0;t<r.length;t++){if(On(i).getInstance().areEqual(r[t],e))return t}return-1},getAdaptationForId:function(e,t,n){const r=p(t,n);let i,s;for(i=0,s=r.length;i<s;i++)if(r[i].hasOwnProperty(S.ID)&&r[i].id===e)return r[i];return null},getAdaptationsForType:function(e,t,n){const r=p(e,t);let i,s;const a=[];for(i=0,s=r.length;i<s;i++)o(r[i],n)&&a.push(h(r[i]));return a},getRealPeriods:m,getRealPeriodForIndex:function(e,t){const n=m(t);return n.length>0&&a(e)?n[e]:null},getCodec:function(e,t,n){let r=null;if(e&&e.Representation_asArray&&e.Representation_asArray.length>0){const i=a(t)&&t>=0&&t<e.Representation_asArray.length?e.Representation_asArray[t]:e.Representation_asArray[0];i&&(r=i.mimeType+';codecs="'+i.codecs+'"',n&&void 0!==i.width&&(r+=';width="'+i.width+'";height="'+i.height+'"'))}return r&&(r=r.replace(/\sprofiles=[^;]*/g,"")),r},getMimeType:function(e){return e&&e.Representation_asArray&&e.Representation_asArray.length>0?e.Representation_asArray[0].mimeType:null},getKID:function(e){return e&&e.hasOwnProperty(S.CENC_DEFAULT_KID)?e[S.CENC_DEFAULT_KID]:null},getLabelsForAdaptation:function(e){if(!e||!Array.isArray(e.Label_asArray))return[];const t=[];for(let n=0;n<e.Label_asArray.length;n++)t.push({lang:e.Label_asArray[n].lang,text:e.Label_asArray[n].__text||e.Label_asArray[n]});return t},getContentProtectionData:function(e){return e&&e.hasOwnProperty(S.CONTENTPROTECTION_ASARRAY)&&0!==e.ContentProtection_asArray.length?e.ContentProtection_asArray:null},getIsDynamic:E,getId:function(e){return e&&e[S.ID]||null},hasProfile:function(e,t){let n=!1;return e&&e.profiles&&e.profiles.length>0&&(n=-1!==e.profiles.indexOf(t)),n},getDuration:function(e){let t;return t=e&&e.hasOwnProperty(S.MEDIA_PRESENTATION_DURATION)?e.mediaPresentationDuration:e&&"dynamic"==e.type?Number.POSITIVE_INFINITY:Number.MAX_SAFE_INTEGER||Number.MAX_VALUE,t},getBandwidth:function(e){return e&&e.bandwidth?e.bandwidth:NaN},getManifestUpdatePeriod:function(e,t=0){let n=NaN;return e&&e.hasOwnProperty(S.MINIMUM_UPDATE_PERIOD)&&(n=e.minimumUpdatePeriod),isNaN(n)?n:Math.max(n-t,1)},getPublishTime:function(e){return e&&e.hasOwnProperty(S.PUBLISH_TIME)?new Date(e[S.PUBLISH_TIME]):null},getRepresentationCount:function(e){return e&&Array.isArray(e.Representation_asArray)?e.Representation_asArray.length:0},getBitrateListForAdaptation:function(e){const t=h(e);return(t&&Array.isArray(t.Representation_asArray)?t.Representation_asArray:[]).map(e=>({bandwidth:e.bandwidth,width:e.width||0,height:e.height||0,scanType:e.scanType||null,id:e.id||null}))},getRepresentationFor:function(e,t){return t&&t.Representation_asArray&&t.Representation_asArray.length>0&&a(e)?t.Representation_asArray[e]:null},getRepresentationsForAdaptation:function(e){const t=[],n=function(e){if(e&&e.period&&a(e.period.index)){const t=e.period.mpd.manifest.Period_asArray[e.period.index];if(t&&t.AdaptationSet_asArray&&a(e.index))return h(t.AdaptationSet_asArray[e.index])}}(e);let r,i;if(n&&n.Representation_asArray){if(e&&e.period&&a(e.period.index)){const t=N(e.period.mpd.manifest);t&&(i=t[0])}for(let s=0,a=n.Representation_asArray.length;s<a;++s){const a=n.Representation_asArray[s],o=new Tn;if(o.index=s,o.adaptation=e,a.hasOwnProperty(S.ID)&&(o.id=a.id),a.hasOwnProperty(S.CODECS)&&(o.codecs=a.codecs),a.hasOwnProperty(S.CODEC_PRIVATE_DATA)&&(o.codecPrivateData=a.codecPrivateData),a.hasOwnProperty(S.BANDWITH)&&(o.bandwidth=a.bandwidth),a.hasOwnProperty(S.WIDTH)&&(o.width=a.width),a.hasOwnProperty(S.HEIGHT)&&(o.height=a.height),a.hasOwnProperty(S.SCAN_TYPE)&&(o.scanType=a.scanType),a.hasOwnProperty(S.MAX_PLAYOUT_RATE)&&(o.maxPlayoutRate=a.maxPlayoutRate),a.hasOwnProperty(S.SEGMENT_BASE)?(r=a.SegmentBase,o.segmentInfoType=S.SEGMENT_BASE):a.hasOwnProperty(S.SEGMENT_LIST)?(r=a.SegmentList,r.hasOwnProperty(S.SEGMENT_TIMELINE)?o.segmentInfoType=S.SEGMENT_TIMELINE:o.segmentInfoType=S.SEGMENT_LIST):a.hasOwnProperty(S.SEGMENT_TEMPLATE)?(r=a.SegmentTemplate,r.hasOwnProperty(S.SEGMENT_TIMELINE)?o.segmentInfoType=S.SEGMENT_TIMELINE:o.segmentInfoType=S.SEGMENT_TEMPLATE,r.hasOwnProperty(S.INITIALIZATION_MINUS)&&(o.initialization=r.initialization.split("$Bandwidth$").join(a.bandwidth).split("$RepresentationID$").join(a.id))):o.segmentInfoType=S.BASE_URL,o.essentialProperties=_(a),r){if(r.hasOwnProperty(S.INITIALIZATION)){const e=r.Initialization;e.hasOwnProperty(S.SOURCE_URL)&&(o.initialization=e.sourceURL),e.hasOwnProperty(S.RANGE)&&(o.range=e.range)}else a.hasOwnProperty(S.MIME_TYPE)&&f(a.mimeType)&&(o.range=0);r.hasOwnProperty(S.TIMESCALE)&&(o.timescale=r.timescale),r.hasOwnProperty(S.DURATION)?o.segmentDuration=r.duration/o.timescale:a.hasOwnProperty(S.SEGMENT_TEMPLATE)&&(r=a.SegmentTemplate,r.hasOwnProperty(S.SEGMENT_TIMELINE)&&(o.segmentDuration=T(r.SegmentTimeline)/o.timescale)),r.hasOwnProperty(S.MEDIA)&&(o.media=r.media),r.hasOwnProperty(S.START_NUMBER)&&(o.startNumber=r.startNumber),r.hasOwnProperty(S.INDEX_RANGE)&&(o.indexRange=r.indexRange),r.hasOwnProperty(S.PRESENTATION_TIME_OFFSET)&&(o.presentationTimeOffset=r.presentationTimeOffset/o.timescale),r.hasOwnProperty(S.AVAILABILITY_TIME_OFFSET)?o.availabilityTimeOffset=r.availabilityTimeOffset:i&&void 0!==i.availabilityTimeOffset&&(o.availabilityTimeOffset=i.availabilityTimeOffset),r.hasOwnProperty(S.AVAILABILITY_TIME_COMPLETE)?o.availabilityTimeComplete="false"!==r.availabilityTimeComplete:i&&void 0!==i.availabilityTimeComplete&&(o.availabilityTimeComplete=i.availabilityTimeComplete)}o.MSETimeOffset=y(o),o.path=[e.period.index,e.index,s],t.push(o)}}return t},getAdaptationsForPeriod:function(e){const t=e&&a(e.index)?e.mpd.manifest.Period_asArray[e.index]:null,n=[];let r,i,s;if(t&&t.AdaptationSet_asArray)for(s=0;s<t.AdaptationSet_asArray.length;s++)i=t.AdaptationSet_asArray[s],r=new yn,i.hasOwnProperty(S.ID)&&(r.id=i.id),r.index=s,r.period=e,o(i,A.MUXED)?r.type=A.MUXED:l(i)?r.type=A.AUDIO:u(i)?r.type=A.VIDEO:c(i)?r.type=A.FRAGMENTED_TEXT:d(i)?r.type=A.IMAGE:r.type=A.TEXT,n.push(r);return n},getRegularPeriods:function(e){const r=!!e&&E(e.manifest),i=[];let s,a,o=null,l=null,u=null,c=null;for(a=0,s=e&&e.manifest&&e.manifest.Period_asArray?e.manifest.Period_asArray.length:0;a<s;a++)l=e.manifest.Period_asArray[a],l.hasOwnProperty(S.START)?(c=new An,c.start=l.start):null!==o&&o.hasOwnProperty(S.DURATION)&&null!==u?(c=new An,c.start=parseFloat((u.start+u.duration).toFixed(5))):0!==a||r||(c=new An,c.start=0),null!==u&&isNaN(u.duration)&&(null!==c?u.duration=parseFloat((c.start-u.start).toFixed(5)):t.warn("First period duration could not be calculated because lack of start and duration period properties. This will cause timing issues during playback")),null!==c&&(c.id=I(l,a),c.index=a,c.mpd=e,l.hasOwnProperty(S.DURATION)&&(c.duration=l.duration),i.push(c),o=l,u=c),l=null,c=null;return 0===i.length||null!==u&&isNaN(u.duration)&&(u.duration=parseFloat((function(e){!function(){if(!n||!n.hasOwnProperty("error"))throw new Error(A.MISSING_CONFIG_ERROR)}();const t=E(e.mpd.manifest);let r;e.mpd.manifest.mediaPresentationDuration?r=e.mpd.manifest.mediaPresentationDuration:e.duration?r=e.duration:t?r=Number.POSITIVE_INFINITY:n.error(new G(he.MANIFEST_ERROR_ID_PARSE_CODE,"Must have @mediaPresentationDuration on MPD or an explicit @duration on the last period.",e));return r}(u)-u.start).toFixed(5))),i},getMpd:function(e){const t=new Sn;return e&&(t.manifest=e,e.hasOwnProperty(S.AVAILABILITY_START_TIME)?t.availabilityStartTime=new Date(e.availabilityStartTime.getTime()):e.loadedTime&&(t.availabilityStartTime=new Date(e.loadedTime.getTime())),e.hasOwnProperty(S.AVAILABILITY_END_TIME)&&(t.availabilityEndTime=new Date(e.availabilityEndTime.getTime())),e.hasOwnProperty(S.MINIMUM_UPDATE_PERIOD)&&(t.minimumUpdatePeriod=e.minimumUpdatePeriod),e.hasOwnProperty(S.MEDIA_PRESENTATION_DURATION)&&(t.mediaPresentationDuration=e.mediaPresentationDuration),e.hasOwnProperty(S.SUGGESTED_PRESENTATION_DELAY)&&(t.suggestedPresentationDelay=e.suggestedPresentationDelay),e.hasOwnProperty(S.TIMESHIFT_BUFFER_DEPTH)&&(t.timeShiftBufferDepth=e.timeShiftBufferDepth),e.hasOwnProperty(S.MAX_SEGMENT_DURATION)&&(t.maxSegmentDuration=e.maxSegmentDuration),e.hasOwnProperty(S.PUBLISH_TIME)&&(t.publishTime=new Date(e.publishTime))),t},getEventsForPeriod:function(e){const t=e&&e.mpd&&e.mpd.manifest?e.mpd.manifest:null,n=t?t.Period_asArray:null,i=n&&e&&a(e.index)?n[e.index].EventStream_asArray:null,s=[];let o,l;if(i)for(o=0;o<i.length;o++){const t=new Dn;if(t.period=e,t.timescale=1,!i[o].hasOwnProperty(A.SCHEME_ID_URI))throw new Error("Invalid EventStream. SchemeIdUri has to be set");for(t.schemeIdUri=i[o][A.SCHEME_ID_URI],i[o].hasOwnProperty(S.TIMESCALE)&&(t.timescale=i[o][S.TIMESCALE]),i[o].hasOwnProperty(S.VALUE)&&(t.value=i[o][S.VALUE]),i[o].hasOwnProperty(S.PRESENTATION_TIME_OFFSET)&&(t.presentationTimeOffset=i[o][S.PRESENTATION_TIME_OFFSET]),l=0;i[o].Event_asArray&&l<i[o].Event_asArray.length;l++){const n=i[o].Event_asArray[l],a=new Rn;if(a.presentationTime=0,a.eventStream=t,n.hasOwnProperty(S.PRESENTATION_TIME)){a.presentationTime=n.presentationTime;const r=t.presentationTimeOffset?t.presentationTimeOffset/t.timescale:0;a.calculatedPresentationTime=a.presentationTime/t.timescale+e.start-r}n.hasOwnProperty(S.DURATION)&&(a.duration=n.duration/t.timescale),n.hasOwnProperty(S.ID)&&(a.id=n.id),n.Signal&&n.Signal.Binary?a.messageData=r.decodeArray(n.Signal.Binary.toString()):a.messageData=n.messageData||n.__text,s.push(a)}}return s},getEssentialPropertiesForRepresentation:_,getEventStreamForAdaptationSet:function(e,t){let n,r,i;return e&&e.Period_asArray&&t&&t.period&&a(t.period.index)&&(r=e.Period_asArray[t.period.index],r&&r.AdaptationSet_asArray&&a(t.index)&&(i=r.AdaptationSet_asArray[t.index],i&&(n=i.InbandEventStream_asArray))),R(n,null)},getEventStreamForRepresentation:function(e,t){let n,r,i,s;return e&&e.Period_asArray&&t&&t.adaptation&&t.adaptation.period&&a(t.adaptation.period.index)&&(r=e.Period_asArray[t.adaptation.period.index],r&&r.AdaptationSet_asArray&&a(t.adaptation.index)&&(i=r.AdaptationSet_asArray[t.adaptation.index],i&&i.Representation_asArray&&a(t.index)&&(s=i.Representation_asArray[t.index],s&&(n=s.InbandEventStream_asArray)))),R(n,t)},getUTCTimingSources:function(e){const t=E(e),n=!!e&&e.hasOwnProperty(S.AVAILABILITY_START_TIME),r=e?e.UTCTiming_asArray:null,i=[];return(t||n)&&r&&r.forEach((function(e){const t=new In;e.hasOwnProperty(A.SCHEME_ID_URI)&&(t.schemeIdUri=e.schemeIdUri,e.hasOwnProperty(S.VALUE)&&(t.value=e.value.toString(),i.push(t)))})),i},getBaseURLsFromElement:N,getRepresentationSortFunction:g,getLocation:function(e){if(e&&e.hasOwnProperty(A.LOCATION))return e.Location=e.Location_asArray[0],e.Location},getPatchLocation:function(e){if(e&&e.hasOwnProperty(S.PATCH_LOCATION))return e.PatchLocation=e.PatchLocation_asArray[0],e.PatchLocation},getSuggestedPresentationDelay:function(e){return e&&e.hasOwnProperty(S.SUGGESTED_PRESENTATION_DELAY)?e.suggestedPresentationDelay:null},getAvailabilityStartTime:function(e){return e&&e.hasOwnProperty(S.AVAILABILITY_START_TIME)&&null!==e.availabilityStartTime?e.availabilityStartTime.getTime():null},getServiceDescriptions:function(e){const t=[];if(e&&e.hasOwnProperty(S.SERVICE_DESCRIPTION))for(const n of e.ServiceDescription_asArray){let e,r,i,s;for(const t in n)n.hasOwnProperty(t)&&(t===S.ID?e=n[t]:t===S.SERVICE_DESCRIPTION_SCOPE?r=n[t].schemeIdUri:t===S.SERVICE_DESCRIPTION_LATENCY?i={target:n[t].target,max:n[t].max,min:n[t].min}:t===S.SERVICE_DESCRIPTION_PLAYBACK_RATE&&(s={max:n[t].max,min:n[t].min}));r===A.SERVICE_DESCRIPTION_LL_SCHEME&&(i||s)&&t.push({id:e,schemeIdUri:r,latency:i,playbackRate:s})}return t},getSupplementalPropperties:function(e){const t={};if(e&&e.hasOwnProperty(S.SUPPLEMENTAL_PROPERTY))for(const n of e.SupplementalProperty_asArray)n.hasOwnProperty(A.SCHEME_ID_URI)&&n.hasOwnProperty(S.VALUE)&&(t[n[A.SCHEME_ID_URI]]=n[S.VALUE]);return t},setConfig:function(e){e&&(e.errHandler&&(n=e.errHandler),e.BASE64&&(r=e.BASE64))}},t=w(i).getInstance().getLogger(e),e}xn.__dashjs_factory_name="DashManifestModel";var Un=R.getSingletonFactory(xn);const Bn="m",kn="a",Gn="v",Yn="i",Kn="c",qn="tt",Hn="k",Vn="o",jn="d",zn="s",Wn="v",Xn="l";function Qn(){let e,t,n,r,i,s,a,o,l,u,c=this.context,d=b(c).getInstance(),f=pn(c).getInstance();function g(){n={pr:1,nor:null,st:null,sf:null,sid:""+gn.generateUuid(),cid:null},l={},o={},u={},p()}function h(){p()}function p(){if(!s)return;const e=s.getStreamController();if(!e)return;if("function"!=typeof e.getActiveStream)return;const t=e.getActiveStream();t&&(a=t.getProcessors())}function m(){const e={};let t=f.get().streaming.cmcd.cid?f.get().streaming.cmcd.cid:n.cid;return e.v=1,e.sid=f.get().streaming.cmcd.sid?f.get().streaming.cmcd.sid:n.sid,e.sid=""+e.sid,t&&(e.cid=""+t),isNaN(n.pr)||1===n.pr||null===n.pr||(e.pr=n.pr),n.st&&(e.st=n.st),n.sf&&(e.sf=n.sf),e}function E(e){try{const t=i.getCurrentBufferLevel(e);return isNaN(t)?null:100*parseInt(10*t)}catch(e){return null}}function _(e){try{n.pr=e.playbackRate}catch(e){}}function T(t){try{const r=e.getIsDynamic(t.data)?""+Xn:""+Wn,i=t.protocol&&"MSS"===t.protocol?""+zn:""+jn;n.st=""+r,n.sf=""+i}catch(e){}}function y(e){try{e.state&&e.mediaType&&e.state===D.BUFFER_EMPTY&&(l[e.mediaType]||(l[e.mediaType]=!0),o[e.mediaType]||(o[e.mediaType]=!0))}catch(e){}}function S(){for(let e in l)l.hasOwnProperty(e)&&(l[e]=!0);for(let e in o)o.hasOwnProperty(e)&&(o[e]=!0)}return t={getQueryParameter:function(e){try{if(f.get().streaming.cmcd&&f.get().streaming.cmcd.enabled){const t=function(e){try{let t=null;return e.type===F.MPD_TYPE?function(){const e=m();return e.ot=""+Bn,e}():e.type===F.MEDIA_SEGMENT_TYPE?(function(e){u.hasOwnProperty(e)||(u[e]=!1);o.hasOwnProperty(e)||(o[e]=!1);l.hasOwnProperty(e)||(l[e]=!1)}(e.mediaType),function(e){const t=m(),c=function(e){try{const t=e.quality,n=e.mediaInfo.bitrateList;return parseInt(n[t].bandwidth/1e3)}catch(e){return null}}(e),d=function(e){try{return isNaN(e.duration)?null:Math.round(1e3*e.duration)}catch(e){return null}}(e),g=function(e){try{return 100*parseInt(r.getThroughputHistory().getSafeAverageThroughput(e)/100)}catch(e){return null}}(e.mediaType),h=function(e){try{const t=n.pr,r=i.getCurrentBufferLevel(e);return isNaN(t)||isNaN(r)?null:100*parseInt(r/t*10)}catch(e){return null}}(e.mediaType),p=E(e.mediaType),_=function(e){try{const t=r.getTopBitrateInfoFor(e);return Math.round(t.bitrate/1e3)}catch(e){return null}}(e.mediaType),T=n.pr,y=function(e){if(!a||0===a.length)return;for(let t of a)if(t.getType()===e)return t.probeNextRequest()}(e.mediaType);let S;e.mediaType===A.VIDEO&&(S=Gn);e.mediaType===A.AUDIO&&(S=kn);e.mediaType===A.FRAGMENTED_TEXT&&(S="application/mp4"===e.mediaInfo.mimeType?qn:Kn);let I=f.get().streaming.cmcd.rtp;I||(I=function(e){let t=s.getPlaybackRate();t||(t=1);let{quality:n,mediaType:r,mediaInfo:i,duration:a}=e,o=E(r);0===o&&(o=500);let l=i.bitrateList[n].bandwidth*a/1e3/(o/t/1e3),u=f.get().streaming.cmcd.rtpSafetyFactor&&!isNaN(f.get().streaming.cmcd.rtpSafetyFactor)?f.get().streaming.cmcd.rtpSafetyFactor:5;return 100*(parseInt(l*u/100)+1)}(e));if(t.rtp=I,y)if(e.url!==y.url){let e=new URL(y.url);t.nor=e.pathname}else y.range&&(t.nrr=y.range);c&&(t.br=c);S&&(t.ot=S);isNaN(d)||(t.d=d);isNaN(g)||(t.mtp=g);isNaN(h)||(t.dl=h);isNaN(p)||(t.bl=p);isNaN(_)||(t.tb=_);isNaN(T)||1===T||(t.pr=T);l[e.mediaType]&&(t.bs=!0,l[e.mediaType]=!1);!o[e.mediaType]&&u[e.mediaType]||(t.su=!0,o[e.mediaType]=!1,u[e.mediaType]=!0);return t}(e)):e.type===F.INIT_SEGMENT_TYPE?function(){const e=m();return e.ot=""+Yn,e.su=!0,e}():e.type===F.OTHER_TYPE||e.type===F.XLINK_EXPANSION_TYPE?function(){const e=m();return e.ot=""+Vn,e}():e.type===F.LICENSE?function(e){const t=m();return t.ot=Hn,t}():t}catch(e){return null}}(e),c=function(e){try{if(!e)return null;const t=Object.keys(e).sort((e,t)=>e.localeCompare(t)),n=t.length;let r=t.reduce((t,r,i)=>{if("v"===r&&1===e[r])return t;if("string"!=typeof e[r]||"ot"===r&&"sf"===r&&"st"===r)t+=`${r}=${e[r]}`;else{t+=`${r}="${e[r].replace(/"/g,'"')}"`}return i<n-1&&(t+=","),t},"");return r=r.replace(/=true/g,""),r}catch(e){return null}}(t);return d.trigger(_n.CMCD_DATA_GENERATED,{url:e.url,mediaType:e.mediaType,cmcdData:t,cmcdString:c}),{key:"CMCD",value:c}}return null}catch(e){return null}},setConfig:function(e){e&&(e.abrController&&(r=e.abrController),e.dashMetrics&&(i=e.dashMetrics),e.playbackController&&(s=e.playbackController))},reset:function(){d.off(D.PLAYBACK_RATE_CHANGED,_,this),d.off(D.MANIFEST_LOADED,T,this),d.off(D.BUFFER_LEVEL_STATE_CHANGED,y,t),d.off(D.PLAYBACK_SEEKED,S,t),g()},initialize:function(){d.on(D.PLAYBACK_RATE_CHANGED,_,t),d.on(D.MANIFEST_LOADED,T,t),d.on(D.BUFFER_LEVEL_STATE_CHANGED,y,t),d.on(D.PLAYBACK_SEEKED,S,t),d.on(D.PERIOD_SWITCH_COMPLETED,h,t)}},w(c).getInstance().getLogger(t),e=Un(c).getInstance(),g(),t}Qn.__dashjs_factory_name="CmcdModel";var $n=R.getSingletonFactory(Qn);function Zn(e){e=e||{};const t=this.context,n=e.errHandler,r=e.dashMetrics,i=e.mediaPlayerModel,s=e.requestModifier,a=e.boxParser,o=e.useFetch||!1,l=e.errors,u=e.requestTimeout||0,c=b(t).getInstance(),d=pn(t).getInstance();let f,g,h,p,m,E,_;function T(e,l){const f=e.request,y=[];let A,S=!0,I=!0,R=new Date,N=R,D=0;if(!s||!r||!n)throw new Error("config object is not correct or missing");const C=function(e){I=!1,f.requestStartDate=R,f.requestEndDate=new Date,f.firstByteDate=f.firstByteDate||R,f.checkExistenceOnly||(r.addHttpRequest(f,A.response?A.response.responseURL:null,A.response?A.response.status:null,A.response&&A.response.getAllResponseHeaders?A.response.getAllResponseHeaders():A.response?A.response.responseHeaders:[],e?y:null),f.type===F.MPD_TYPE&&r.addManifestUpdate(f))},b=function(){if(-1!==g.indexOf(A)&&(g.splice(g.indexOf(A),1),I))if(C(!1),l>0){try{if(d.get().streaming.utcSynchronization.enableBackgroundSyncAfterSegmentDownloadError&&f.type===F.MEDIA_SEGMENT_TYPE){i.getRetryAttemptsForType(F.MEDIA_SEGMENT_TYPE)===l&&c.trigger(M.ATTEMPT_BACKGROUND_SYNC)}}catch(e){}l--;let t={config:e};p.push(t),t.timeout=setTimeout((function(){-1!==p.indexOf(t)&&(p.splice(p.indexOf(t),1),T(e,l))}),i.getRetryIntervalsForType(f.type))}else n.error(new G(m[f.type],f.url+" is not available",{request:f,response:A.response})),e.error&&e.error(f,"error",A.response.statusText),e.complete&&e.complete(f,A.response.statusText)};let v;v=o&&window.fetch&&"arraybuffer"===f.responseType&&f.type===F.MEDIA_SEGMENT_TYPE?En(t).create({requestModifier:s,boxParser:a}):fn(t).create({requestModifier:s});let O=s.modifyRequestURL(f.url);const w=function(e){try{const t=[],n=E.getQueryParameter(e);return n&&t.push(n),t}catch(e){return[]}}(f);O=gn.addAditionalQueryParameterToUrl(O,w);const L=f.checkExistenceOnly?F.HEAD:F.GET,P=i.getXHRWithCredentialsForType(f.type);A={url:O,method:L,withCredentials:P,request:f,onload:function(){A.response.status>=200&&A.response.status<=299&&(C(!0),e.success&&e.success(A.response.response,A.response.statusText,A.response.responseURL),e.complete&&e.complete(f,A.response.statusText))},onend:b,onerror:b,progress:function(t){const n=new Date;S&&(S=!1,(!t.lengthComputable||t.lengthComputable&&t.total!==t.loaded)&&(f.firstByteDate=n)),t.lengthComputable&&(f.bytesLoaded=t.loaded,f.bytesTotal=t.total),t.noTrace||(y.push({s:N,d:t.time?t.time:n.getTime()-N.getTime(),b:[t.loaded?t.loaded-D:0]}),N=n,D=t.loaded),e.progress&&t&&e.progress(t)},onabort:function(){e.abort&&e.abort(f)},ontimeout:function(e){let t;if(e.lengthComputable){let n=e.loaded/e.total*100;t="Request timeout: loaded: "+e.loaded+", out of: "+e.total+" : "+n.toFixed(3)+"% Completed"}else t="Request timeout: non-computable download size";_.warn(t)},loader:v,timeout:u};let x=(new Date).getTime();if(isNaN(f.delayLoadingTime)||x>=f.delayLoadingTime)g.push(A),v.load(A);else{let e={httpRequest:A};h.push(e),e.delayTimeout=setTimeout((function(){if(-1!==h.indexOf(e)){h.splice(h.indexOf(e),1);try{R=new Date,N=R,g.push(e.httpRequest),v.load(e.httpRequest)}catch(t){e.httpRequest.onerror()}}}),f.delayLoadingTime-x)}}return f={load:function(e){e.request?T(e,i.getRetryAttemptsForType(e.request.type)):e.error&&e.error(e.request,"error")},abort:function(){p.forEach(e=>{clearTimeout(e.timeout),e.config.request&&e.config.abort&&e.config.abort(e.config.request)}),p=[],h.forEach(e=>clearTimeout(e.delayTimeout)),h=[],g.forEach(e=>{e.onloadend=e.onerror=e.onprogress=void 0,e.loader.abort(e)}),g=[]}},_=w(t).getInstance().getLogger(f),g=[],h=[],p=[],E=$n(t).getInstance(),m={[F.MPD_TYPE]:l.DOWNLOAD_ERROR_ID_MANIFEST_CODE,[F.XLINK_EXPANSION_TYPE]:l.DOWNLOAD_ERROR_ID_XLINK_CODE,[F.INIT_SEGMENT_TYPE]:l.DOWNLOAD_ERROR_ID_INITIALIZATION_CODE,[F.MEDIA_SEGMENT_TYPE]:l.DOWNLOAD_ERROR_ID_CONTENT_CODE,[F.INDEX_SEGMENT_TYPE]:l.DOWNLOAD_ERROR_ID_CONTENT_CODE,[F.BITSTREAM_SWITCHING_SEGMENT_TYPE]:l.DOWNLOAD_ERROR_ID_CONTENT_CODE,[F.OTHER_TYPE]:l.DOWNLOAD_ERROR_ID_CONTENT_CODE},f}Zn.__dashjs_factory_name="HTTPLoader";const Jn=R.getClassFactory(Zn);function er(){let e,t;function n(){t={}}function r(){n()}return r(),e={getLoader:function(e){for(var n in t)if(t.hasOwnProperty(n)&&e.startsWith(n))return t[n];return Jn},registerLoader:function(e,n){t[e]=n},unregisterLoader:function(e){t[e]&&delete t[e]},unregisterAllLoader:n,reset:r},e}er.__dashjs_factory_name="SchemeLoaderFactory";const tr=R.getSingletonFactory(er);function nr(e){e=e||{};const t=this.context;let n,r,i;return r=tr(t).getInstance(),n={load:function(n){let s=r.getLoader(n&&n.request?n.request.url:null);i=s(t).create({errHandler:e.errHandler,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,useFetch:e.useFetch||null,dashMetrics:e.dashMetrics,boxParser:e.boxParser?e.boxParser:null,constants:e.constants?e.constants:null,dashConstants:e.dashConstants?e.dashConstants:null,urlUtils:e.urlUtils?e.urlUtils:null,requestTimeout:isNaN(e.requestTimeout)?0:e.requestTimeout,errors:e.errors}),i.load(n)},abort:function(){i&&i.abort()}},n}nr.__dashjs_factory_name="URLLoader";const rr=R.getClassFactory(nr);class ir extends U{constructor(e){super(e),this.checkForExistenceOnly=!0}}function sr(e){e=e||{};const t=this.context,n=e.eventBus,r=e.events,i=e.urlUtils,s=e.errors;let a,o;return a={checkForExistence:function(e){const t=function(t){n.trigger(r.CHECK_FOR_EXISTENCE_COMPLETED,{request:e,exists:t})};if(e){let n=new ir(e.url);o.load({request:n,success:function(){t(!0)},error:function(){t(!1)}})}else t(!1)},load:function(e){const t=function(t,i){n.trigger(r.LOADING_COMPLETED,{request:e,response:t||null,error:i||null,sender:a})};e?o.load({request:e,progress:function(t){n.trigger(r.LOADING_PROGRESS,{request:e,stream:t.stream}),t.data&&n.trigger(r.LOADING_DATA_PROGRESS,{request:e,response:t.data||null,error:null,sender:a})},success:function(e){t(e)},error:function(e,n,r){t(void 0,new G(s.FRAGMENT_LOADER_LOADING_FAILURE_ERROR_CODE,r,n))},abort:function(e){e&&n.trigger(r.LOADING_ABANDONED,{mediaType:e.mediaType,request:e,sender:a})}}):t(void 0,new G(s.FRAGMENT_LOADER_NULL_REQUEST_ERROR_CODE,s.FRAGMENT_LOADER_NULL_REQUEST_ERROR_MESSAGE))},abort:function(){o&&o.abort()},reset:function(){o&&(o.abort(),o=null)}},o=rr(t).create({errHandler:e.errHandler,errors:s,dashMetrics:e.dashMetrics,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,useFetch:e.settings.get().streaming.lowLatencyEnabled,urlUtils:i,constants:A,boxParser:e.boxParser,dashConstants:e.dashConstants,requestTimeout:e.settings.get().streaming.fragmentRequestTimeout}),a}sr.__dashjs_factory_name="FragmentLoader";var ar=R.getClassFactory(sr);function or(e){e=e||{};const t=this.context,n=b(t).getInstance(),r=e.errHandler,i=e.mediaPlayerModel,s=e.dashMetrics,a=w(t).getInstance(),o=e.streamInfo;let l,u,c;function d(){for(let e in c)c[e].reset();c={}}function f(e){if(!e.sender)return;const t=e.request,r=e.response,i=t.isInitializationRequest(),s=t.mediaInfo.streamInfo;if(e.error&&(t.mediaType!==A.AUDIO&&t.mediaType!==A.VIDEO&&t.mediaType!==A.FRAGMENTED_TEXT||n.trigger(M.SERVICE_LOCATION_BLACKLIST_ADD,{entry:e.request.serviceLocation})),!r||!s)return void u.warn("No "+t.mediaType+" bytes to push or stream is inactive.");const a=function(e,t,n,r){const i=new cn;return i.streamId=n,i.mediaInfo=t.mediaInfo,i.segmentType=t.type,i.start=t.startTime,i.duration=t.duration,i.end=i.start+i.duration,i.bytes=e,i.index=t.index,i.quality=t.quality,i.representationId=t.representationId,i.endFragment=r,i}(r,t,o.id,e.type!==M.FRAGMENT_LOADING_PROGRESS);n.trigger(i?M.INIT_FRAGMENT_LOADED:M.MEDIA_FRAGMENT_LOADED,{chunk:a,request:t},{streamId:s.id,mediaType:t.mediaType})}return l={getStreamId:function(){return o.id},getModel:function(l){let u=c[l];return u||(u=k(t).create({streamInfo:o,type:l,dashMetrics:s,fragmentLoader:ar(t).create({dashMetrics:s,mediaPlayerModel:i,errHandler:r,requestModifier:en(t).getInstance(),settings:e.settings,boxParser:e.boxParser,eventBus:n,events:M,errors:he,dashConstants:e.dashConstants,urlUtils:e.urlUtils}),debug:a,eventBus:n,events:M}),c[l]=u),u},reset:function(){n.off(M.FRAGMENT_LOADING_COMPLETED,f,this),n.off(M.FRAGMENT_LOADING_PROGRESS,f,this),d()}},u=a.getLogger(l),d(),n.on(M.FRAGMENT_LOADING_COMPLETED,f,l),n.on(M.FRAGMENT_LOADING_PROGRESS,f,l),l}or.__dashjs_factory_name="FragmentController";var lr=R.getClassFactory(or);class ur{constructor(){this.url=null,this.width=null,this.height=null,this.x=null,this.y=null}}function cr(e){const t=this.context,n=e.streamInfo;let r,i;function s(){i&&i.reset()}return r={getStreamId:function(){return n.id},provide:function(e,t){if("function"!=typeof t)return;const n=i.getCurrentTrack();let r,s;if(!n||n.segmentDuration<=0||null==e)return void t(null);isNaN(n.segmentDuration)&&(s=i.getThumbnailRequestForTime(e),s&&(n.segmentDuration=s.duration)),r=e%n.segmentDuration;const a=Math.floor(r*n.tilesHor*n.tilesVert/n.segmentDuration),o=new ur;if(o.width=Math.floor(n.widthPerTile),o.height=Math.floor(n.heightPerTile),o.x=Math.floor(a%n.tilesHor)*n.widthPerTile,o.y=Math.floor(a/n.tilesHor)*n.heightPerTile,"readThumbnail"in n)return n.readThumbnail(e,e=>{o.url=e,t(o)});if(s)o.url=s.url,n.segmentDuration=NaN;else{const t=Math.floor(e/n.segmentDuration);o.url=function(e,t){const n=t+e.startNumber;let r=xt(e.templateUrl,"Number",n);return r=xt(r,"Time",(n-1)*e.segmentDuration*e.timescale),r=xt(r,"Bandwidth",e.bandwidth),Pt(r)}(n,t)}t(o)},setTrackByIndex:function(e){i.setTrackByIndex(e)},getCurrentTrackIndex:function(){return i.getCurrentTrackIndex()},getBitrateList:function(){const e=i.getTracks();let t=0;return e.map(e=>{const n=new st;return n.mediaType=A.IMAGE,n.qualityIndex=t++,n.bitrate=e.bitrate,n.width=e.width,n.height=e.height,n})},reset:s},s(),i=Fn(t).create({streamInfo:n,adapter:e.adapter,baseURLController:e.baseURLController,timelineConverter:e.timelineConverter,debug:e.debug,eventBus:e.eventBus,events:e.events,dashConstants:e.dashConstants}),r}cr.__dashjs_factory_name="ThumbnailController";var dr=R.getClassFactory(cr);function fr(e){e=e||{};const t=this.context,n=b(t).getInstance(),r=sn(t).getInstance(),i=e.manifestModel,s=e.mediaPlayerModel,a=e.manifestUpdater,o=e.adapter,l=e.capabilities,u=e.capabilitiesFilter,c=e.errHandler,d=e.timelineConverter,f=e.dashMetrics,g=e.abrController,h=e.playbackController,p=e.eventController,m=e.mediaController,E=e.textController,_=e.protectionController,T=e.videoModel,y=e.settings;let I,R,N,D,C,v,O,L,P,F,x,U,B,k,Y,K,q,H,V=e.streamInfo;function j(e){let t=N?N.length:0;for(let n=0;n<t;n++){N[n].getFragmentModel().removeExecutedRequestsBeforeTime($()+Q()),N[n].reset(!1,e)}N=[],C=!1,v=!1,_e(!1),n.off(M.CURRENT_TRACK_CHANGED,ie,I)}function z(){j(),D=!1,O=!1,L=!1,P={},F=!1,Y=!1,q=!1}function X(){h&&h.pause(),x&&(x.reset(),x=null),V=null,z(),n.off(M.DATA_UPDATE_COMPLETED,ce,I),n.off(M.BUFFERING_COMPLETED,ue,I),n.off(M.INBAND_EVENTS,de,I),_&&(n.off(M.KEY_ERROR,ne,I),n.off(M.SERVER_CERTIFICATE_UPDATED,ne,I),n.off(M.LICENSE_REQUEST_COMPLETE,ne,I),n.off(M.KEY_SYSTEM_SELECTED,ne,I),n.off(M.KEY_SESSION_CREATED,ne,I),n.off(M.KEY_STATUSES_CHANGED,ne,I)),_e(!1)}function Q(){return V?V.duration:NaN}function $(){return V?V.start:NaN}function Z(){if(!V.manifestInfo.isDynamic)return NaN;for(let e=0;e<N.length;e++)if(N[e].getType()===A.AUDIO||N[e].getType()===A.VIDEO)return N[e].getLiveStartTime();return NaN}function J(){return V?V.id:null}function ee(){return V}function te(){if(!(T&&g&&g.hasOwnProperty("getBitrateList")&&o&&o.hasOwnProperty("getAllMediaInfoForType")&&o.hasOwnProperty("getEventsFor")))throw new Error(A.MISSING_CONFIG_ERROR)}function ne(e){e.error&&(c.error(e.error),R.fatal(e.error.message),X())}function re(e){const t=e?e.type:null;let n,r;if(t===A.MUXED)return r="Multiplexed representations are intentionally not supported, as they are not compliant with the DASH-AVC/264 guidelines",R.fatal(r),c.error(new G(he.MANIFEST_ERROR_ID_MULTIPLEXED_CODE,r,i.getValue())),!1;if(t===A.TEXT||t===A.FRAGMENTED_TEXT||t===A.EMBEDDED_TEXT||t===A.IMAGE)return!0;if(n=e.codec,R.debug(t+" codec: "+n),e.contentProtection&&!l.supportsEncryptedMedia())c.error(new G(he.CAPABILITY_MEDIAKEYS_ERROR_CODE,he.CAPABILITY_MEDIAKEYS_ERROR_MESSAGE));else if(!l.supportsCodec(n))return r=t+"Codec ("+n+") is not supported.",R.error(r),!1;return!0}function ie(e){if(!V||e.newMediaInfo.streamInfo.id!==V.id)return;let t=e.newMediaInfo,n=i.getValue();o.setCurrentMediaInfo(V.id,t.type,t);let r=fe(t);if(!r)return;let s=h.getTime();R.info("Stream - Process track changed at current time "+s),R.debug("Stream - Update stream controller"),n.refreshManifestOnSwitchTrack?(R.debug("Stream - Refreshing manifest for switch track"),H=e,a.refreshManifest()):(r.selectMediaInfo(t),t.type!==A.FRAGMENTED_TEXT?(g.updateTopQualityIndex(t),r.switchTrackAsked(),r.getFragmentModel().abortRequests()):(r.getScheduleController().setSeekTarget(s),r.setBufferingTime(s),r.resetIndexHandler()))}function se(r,a){const l=o.getAllMediaInfoForType(V,r);let u,f=null;if(l&&0!==l.length){r===A.VIDEO&&(O=!0),r===A.AUDIO&&(L=!0);for(let e=0,t=l.length;e<t;e++)if(f=l[e],r===A.EMBEDDED_TEXT)E.addEmbeddedTrack(f);else{if(!re(f))continue;m.addTrack(f)}r!==A.EMBEDDED_TEXT&&0!==m.getTracksFor(r,V).length&&(r!==A.IMAGE?(m.checkInitialMediaSettingsForType(r,V),u=m.getCurrentTrackFor(r,V),n.trigger(M.STREAM_INITIALIZING,{streamInfo:V,mediaInfo:f}),function(n,r,a,l){let u=x.getModel(n?n.type:null),f=un(t).create({streamInfo:V,type:n?n.type:null,mimeType:n?n.mimeType:null,timelineConverter:d,adapter:o,manifestModel:i,mediaPlayerModel:s,fragmentModel:u,dashMetrics:e.dashMetrics,baseURLController:e.baseURLController,abrController:g,playbackController:h,mediaController:m,textController:E,errHandler:c,settings:y,boxParser:k});if(f.initialize(a,O),g.updateTopQualityIndex(n),l?(f.setBuffer(l.buffer),f.setBufferingTime(l.currentTime),N[l.replaceIdx]=f):N.push(f),!l||!l.ignoreMediaInfo)if(!n||n.type!==A.TEXT&&n.type!==A.FRAGMENTED_TEXT)f.addMediaInfo(n,!0);else{let e;for(let t=0;t<r.length;t++)r[t].index===n.index&&(e=t),f.addMediaInfo(r[t]);f.selectMediaInfo(r[e])}}(u,l,a)):U=dr(t).create({streamInfo:V,adapter:o,baseURLController:e.baseURLController,timelineConverter:e.timelineConverter,debug:K,eventBus:n,events:M,dashConstants:S}))}else R.info("No "+r+" data.")}function ae(){if(p){const e=o.getEventsFor(V);p.addInlineEvents(e)}}function oe(){const e=N.length;let t=!!P.audio||!!P.video?new G(he.DATA_UPDATE_FAILED_ERROR_CODE,he.DATA_UPDATE_FAILED_ERROR_MESSAGE):null;for(let t=0;t<e;t++)if(N[t].isUpdating()||F)return;if(v){if(_){_.clearMediaInfoArrayByStreamId(J());for(let t=0;t<e&&N[t];t++){const e=N[t].getType();if(e===A.AUDIO||e===A.VIDEO||e===A.FRAGMENTED_TEXT){let e=N[t].getMediaInfo();e&&_.initializeForMedia(e)}}}t?c.error(t):D||(D=!0,n.trigger(M.STREAM_INITIALIZED,{streamInfo:V,liveStartTime:B?NaN:Z()}));for(let t=0;t<e&&N[t];t++)N[t].getScheduleController().start()}}function le(e){const t={};for(let n=0,r=N.length;n<r;n++){const r=N[n].createBuffer(e);r&&(t[N[n].getType()]=r.getBuffer())}return t}function ue(){let e=ge();const t=e.length;if(0!==t){for(let n=0;n<t;n++)if(!e[n].isBufferingCompleted()&&(e[n].getType()===A.AUDIO||e[n].getType()===A.VIDEO))return void R.warn("onBufferingCompleted - One streamProcessor has finished but",e[n].getType(),"one is not buffering completed");R.debug("onBufferingCompleted - trigger STREAM_BUFFERING_COMPLETED"),n.trigger(M.STREAM_BUFFERING_COMPLETED,{streamInfo:V})}else R.warn("onBufferingCompleted - can't trigger STREAM_BUFFERING_COMPLETED because no streamProcessor is defined")}function ce(e){P[e.mediaType]=e.error,oe()}function de(e){!function(e){p&&p.addInbandEvents(e)}(e.events)}function fe(e){if(!e)return null;return ge().filter((function(t){return t.getType()===e.type}))[0]}function ge(){let e,t,n=[];for(let r=0;r<N.length;r++)t=N[r],e=t.getType(),e!==A.AUDIO&&e!==A.VIDEO&&e!==A.FRAGMENTED_TEXT&&e!==A.TEXT||n.push(t);return n}function pe(e,t,n=null){if(!e)return!1;const r=e.getStreamInfo(),i=n?n.getStreamInfo():ee();if(!r||!i)return!1;const s=o.getAdaptationForType(r.index,t,r),a=o.getAdaptationForType(i.index,t,i);return s&&a?!(!me(a)&&me(s)):!s&&!a}function me(e){return!!e&&!!(e.ContentProtection||e.Representation&&e.Representation.length>0&&e.Representation[0].ContentProtection)}function Ee(e,t,n=null){if(!e||!e.hasOwnProperty("getStreamInfo"))return!1;const r=e.getStreamInfo(),i=n?n.getStreamInfo():ee();if(!r||!i)return!1;const s=o.getAdaptationForType(r.index,t,r),a=o.getAdaptationForType(i.index,t,i);if(!s||!a)return!s&&!a;const u=s&&a&&s.mimeType===a.mimeType,c=a.Representation_asArray.map(e=>e.codecs),d=s.Representation_asArray.map(e=>e.codecs),f=d.some(e=>c.indexOf(e)>-1),g=d.some(e=>c.some(t=>l.codecRootCompatibleWithCodec(t,e)));return f||g&&u}function _e(e){B=e}function Te(){return B}return I={initialize:function(){n.on(M.BUFFERING_COMPLETED,ue,I),n.on(M.DATA_UPDATE_COMPLETED,ce,I),n.on(M.INBAND_EVENTS,de,I),_&&(n.on(M.KEY_ERROR,ne,I),n.on(M.SERVER_CERTIFICATE_UPDATED,ne,I),n.on(M.LICENSE_REQUEST_COMPLETE,ne,I),n.on(M.KEY_SYSTEM_SELECTED,ne,I),n.on(M.KEY_SESSION_CREATED,ne,I),n.on(M.KEY_STATUSES_CHANGED,ne,I)),n.trigger(M.STREAM_UPDATED,{streamInfo:V})},getStreamId:function(){return V?V.id:null},activate:function(e,t){if(!C){let r;return n.on(M.CURRENT_TRACK_CHANGED,ie,I),Te()?(!function(){if(F=!0,te(),u.filterUnsupportedFeaturesOfPeriod(V),v=!0,F=!1,0===N.length){const e="No streams to play.";c.error(new G(he.MANIFEST_ERROR_ID_NOSTREAMS_CODE,e,i.getValue())),R.debug(e)}else oe()}(),r=t):r=function(e,t){te();let n=T.getElement();ae(),F=!0,u.filterUnsupportedFeaturesOfPeriod(V),(!n||n&&/^VIDEO$/i.test(n.nodeName))&&se(A.VIDEO,e);se(A.AUDIO,e),se(A.TEXT,e),se(A.FRAGMENTED_TEXT,e),se(A.EMBEDDED_TEXT,e),se(A.MUXED,e),se(A.IMAGE,e);const r=le(t);if(v=!0,F=!1,0===N.length){const e="No streams to play.";c.error(new G(he.MANIFEST_ERROR_ID_NOSTREAMS_CODE,e,i.getValue())),R.fatal(e)}else oe();return r}(e,t),C=!0,r}return t},deactivate:j,isActive:function(){return C},getDuration:Q,getStartTime:$,getId:J,getStreamInfo:ee,getHasAudioTrack:function(){return L},getHasVideoTrack:function(){return O},preload:function(e,t){if(!Te()){ae(),se(A.VIDEO,e),se(A.AUDIO,e),se(A.TEXT,e),se(A.FRAGMENTED_TEXT,e),se(A.EMBEDDED_TEXT,e),se(A.MUXED,e),se(A.IMAGE,e),le(t),n.on(M.CURRENT_TRACK_CHANGED,ie,I);for(let e=0;e<N.length&&N[e];e++)N[e].getScheduleController().start();_e(!0)}},getThumbnailController:function(){return U},getBitrateListFor:function(e){if(te(),e===A.IMAGE)return U?U.getBitrateList():[];const t=function(e){let t=null;for(let n=0;n<N.length;n++)if(t=N[n],t.getType()===e)return t.getMediaInfo();return null}(e);return g.getBitrateList(t)},updateData:function(e){R.info("Manifest updated... updating data system wide."),C=!1,F=!0,V=e,n.trigger(M.STREAM_UPDATED,{streamInfo:V}),p&&ae(),u.filterUnsupportedFeaturesOfPeriod(V);for(let e=0,t=N.length;e<t;e++){let t=N[e];t.updateStreamInfo(V);let n=o.getMediaInfoForType(V,t.getType());n&&(g.updateTopQualityIndex(n),t.addMediaInfo(n,!0))}if(H){if(H.newMediaInfo.type!==A.FRAGMENTED_TEXT){let e=fe(H.oldMediaInfo);if(!e)return;e.switchTrackAsked(),H=void 0}}F=!1,oe()},reset:X,getProcessors:ge,setMediaSource:function(e){for(let t=0;t<N.length;)re(N[t].getMediaInfo())?(N[t].setMediaSource(e),t++):(N[t].reset(),N.splice(t,1));for(let e=0;e<N.length;e++)N[e].dischargePreBuffer();if(0===N.length){const e="No streams to play.";c.error(new G(he.MANIFEST_ERROR_ID_NOSTREAMS_CODE,e+"nostreams",i.getValue())),R.fatal(e)}},isMediaCodecCompatible:function(e,t=null){return Ee(e,A.VIDEO,t)&&Ee(e,A.AUDIO,t)},isProtectionCompatible:function(e,t=null){return pe(e,A.VIDEO,t)&&pe(e,A.AUDIO,t)},getPreloaded:Te,getPreloadingScheduled:function(){return Y},setPreloadingScheduled:function(e){Y=e},getIsEndedEventSignaled:function(){return q},setIsEndedEventSignaled:function(e){q=e}},K=w(t).getInstance(),R=K.getLogger(I),z(),k=W(t).getInstance(),x=lr(t).create({streamInfo:V,mediaPlayerModel:s,dashMetrics:f,errHandler:c,settings:y,boxParser:k,dashConstants:S,urlUtils:r}),I}fr.__dashjs_factory_name="Stream";var gr=R.getClassFactory(fr);function hr(){const e=this.context,t=b(e).getInstance(),n=sn(e).getInstance();let r,i,s,a,o,l,u,c,d,f,g,h;function p(){s=NaN,u=!1,o=!0,l=!1,m()}function m(){null!==a&&(clearTimeout(a),a=null)}function E(e){m(),l||(isNaN(e)&&!isNaN(s)&&(e=1e3*s),isNaN(e)||(i.debug("Refresh manifest in "+e+" milliseconds."),a=setTimeout(y,e)))}function _(e=!1){u=!0;const t=d.getValue();let r=t.url;const i=f.getPatchLocation(t),s=f.getLocation(t);i&&!e?r=i:s&&(r=s),n.isRelative(r)&&(r=n.resolve(r,t.url)),c.load(r)}function T(e){if(e){if(f.getIsPatch(e)){let t=e;e=d.getValue();let n=f.isPatchValid(e,t),r=n;if(n){let n=f.getPublishTime(e);r=f.applyPatchToManifest(e,t);let i=f.getPublishTime(e);r=n.getTime()!=i.getTime()}if(!r)return i.debug("Patch provided is invalid, performing full manifest refresh"),void _(!0);e.loadedTime=new Date}}else(e=d.getValue()).loadedTime=new Date;if(d.getValue()&&d.getValue().type===S.DYNAMIC&&e.type===S.STATIC)return t.trigger(M.DYNAMIC_TO_STATIC),u=!1,void(l=!0);d.setValue(e);const n=new Date,r=(n.getTime()-e.loadedTime.getTime())/1e3;s=f.getManifestUpdatePeriod(e,r),1e3*s>2147483647&&(s=2147483.647),t.trigger(M.MANIFEST_UPDATED,{manifest:e}),i.info("Manifest has been refreshed at "+n+"["+n.getTime()/1e3+"] "),o||E()}function y(){o||(u?E(h.get().streaming.manifestUpdateRetryInterval):_())}function A(e){e.error?e.error.code===he.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE&&g.error(e.error):T(e.manifest)}function I(){o=!1,E()}function R(){o=!h.get().streaming.scheduleWhilePaused,o&&m()}function N(){u=!1}return r={initialize:function(){p(),t.on(M.STREAMS_COMPOSED,N,this),t.on(M.PLAYBACK_STARTED,I,this),t.on(M.PLAYBACK_PAUSED,R,this),t.on(M.INTERNAL_MANIFEST_LOADED,A,this)},setManifest:function(e){T(e)},refreshManifest:_,setConfig:function(e){e&&(e.manifestModel&&(d=e.manifestModel),e.adapter&&(f=e.adapter),e.manifestLoader&&(c=e.manifestLoader),e.errHandler&&(g=e.errHandler),e.settings&&(h=e.settings))},reset:function(){t.off(M.PLAYBACK_STARTED,I,this),t.off(M.PLAYBACK_PAUSED,R,this),t.off(M.STREAMS_COMPOSED,N,this),t.off(M.INTERNAL_MANIFEST_LOADED,A,this),p()}},i=w(e).getInstance().getLogger(r),r}hr.__dashjs_factory_name="ManifestUpdater";var pr=R.getClassFactory(hr);function mr(){const e=this.context,t=b(e).getInstance(),n=sn(e).getInstance();let r,i,s,a,o,l,u,c,d,f,g,h,p,m,E;function _(){c=[],d=[],f=null,g=null,p=null,h=NaN,s=!1,a=!1,m=o.get().streaming.utcSynchronization.timeBetweenSyncAttempts}function T(){if(s||a||!p||!p.value||!p.schemeIdUri||isNaN(h)||isNaN(o.get().streaming.utcSynchronization.backgroundAttempts))return;if(g&&(Date.now()-g)/1e3<30)return;c=[],a=!0;!function e(t){try{if(t<=0)return void L();const n=Date.now();l[p.schemeIdUri](p.value,(function(r){const i=Date.now(),s=y(n,i,r);c.push(s),e(t-1)}),(function(){L()}))}catch(e){L()}}(isNaN(o.get().streaming.utcSynchronization.backgroundAttempts)?2:o.get().streaming.utcSynchronization.backgroundAttempts)}function y(e,t,n){return n-(t-(t-e)/2)}function A(e=NaN){let t=isNaN(e);t&&o.get().streaming.useManifestDateHeaderTimeSource?function(){let e=u.getLatestMPDRequestHeaderValueByID("Date"),t=null!==e?new Date(e).getTime():Number.NaN;if(isNaN(t))O(!0);else{O(!1,t-Date.now())}}():O(t,e)}function S(e){let t=Date.parse(e);return isNaN(t)&&(t=function(e){let t,n,r=/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2})(?::([0-9]*)(\.[0-9]*)?)?(?:([+\-])([0-9]{2})([0-9]{2}))?/.exec(e);return t=Date.UTC(parseInt(r[1],10),parseInt(r[2],10)-1,parseInt(r[3],10),parseInt(r[4],10),parseInt(r[5],10),r[6]&&(parseInt(r[6],10)||0),r[7]&&1e3*parseFloat(r[7])||0),r[9]&&r[10]&&(n=60*parseInt(r[9],10)+parseInt(r[10],10),t+=("+"===r[8]?-1:1)*n*60*1e3),new Date(t).getTime()}(e)),t}function I(e){return Date.parse(e)}function R(e){return Date.parse(e)}function N(e,t,n){n()}function D(e,t,n){let r=S(e);isNaN(r)?n():t(r)}function C(e,t,r,i,s){let a,o,l=!1,u=new XMLHttpRequest,c=s?F.HEAD:F.GET,d=t.match(/\S+/g);if(t=d.shift(),a=function(){l||(l=!0,d.length?C(e,d.join(" "),r,i,s):i())},o=function(){let t,n;200===u.status&&(t=s?u.getResponseHeader("Date"):u.response,n=e(t),isNaN(n)||(r(n),l=!0))},n.isRelative(t)){const e=E.resolve();e&&(t=n.resolve(t,e.url))}u.open(c,t),u.timeout=5e3,u.onload=o,u.onloadend=a,u.send()}function v(e,t,n){C(R,e,t,n,!0)}function O(e,n){if(isNaN(h)||isNaN(n)||e||function(e){try{const t=P(e),n=isNaN(m)?30:m,r=isNaN(o.get().streaming.utcSynchronization.timeBetweenSyncAttemptsAdjustmentFactor)?2:o.get().streaming.utcSynchronization.timeBetweenSyncAttemptsAdjustmentFactor,s=isNaN(o.get().streaming.utcSynchronization.maximumTimeBetweenSyncAttempts)?600:o.get().streaming.utcSynchronization.maximumTimeBetweenSyncAttempts,a=isNaN(o.get().streaming.utcSynchronization.minimumTimeBetweenSyncAttempts)?2:o.get().streaming.utcSynchronization.minimumTimeBetweenSyncAttempts;let l;t?(l=Math.min(n*r,s),i.debug("Increasing timeBetweenSyncAttempts to "+l)):(l=Math.max(n/r,a),i.debug("Decreasing timeBetweenSyncAttempts to "+l)),m=l}catch(e){}}(n),!e&&!isNaN(n)){f=Date.now(),s=!1;const e=isNaN(h);h=n,e&&T(),i.debug("Completed UTC sync. Setting client - server offset to "+n)}e&&(p=null),t.trigger(M.UPDATE_TIME_SYNC_OFFSET,{offset:n,error:e?new G(he.TIME_SYNC_FAILED_ERROR_CODE,he.TIME_SYNC_FAILED_ERROR_MESSAGE):null}),t.trigger(M.TIME_SYNCHRONIZATION_COMPLETED)}function L(){if(!c||0===c.length)return;const e=c.reduce((e,t)=>e+t,0)/c.length;P(e)?i.debug("Completed background UTC sync. Offset is within allowed threshold and is not adjusted."):(i.debug("Completed background UTC sync. Setting client - server offset to "+e),h=e,t.trigger(M.UPDATE_TIME_SYNC_OFFSET,{offset:h})),a=!1,g=Date.now()}function P(e){try{if(isNaN(h))return!0;const t=o.get().streaming.utcSynchronization.maximumAllowedDrift&&!isNaN(o.get().streaming.utcSynchronization.maximumAllowedDrift)?o.get().streaming.utcSynchronization.maximumAllowedDrift:100,n=h+t;return e>=h-t&&e<=n}catch(e){return!0}}return r={initialize:function(){_(),l={"urn:mpeg:dash:utc:http-head:2014":v,"urn:mpeg:dash:utc:http-xsdate:2014":C.bind(null,S),"urn:mpeg:dash:utc:http-iso:2014":C.bind(null,I),"urn:mpeg:dash:utc:direct:2014":D,"urn:mpeg:dash:utc:http-head:2012":v,"urn:mpeg:dash:utc:http-xsdate:2012":C.bind(null,S),"urn:mpeg:dash:utc:http-iso:2012":C.bind(null,I),"urn:mpeg:dash:utc:direct:2012":D,"urn:mpeg:dash:utc:http-ntp:2014":N,"urn:mpeg:dash:utc:ntp:2014":N,"urn:mpeg:dash:utc:sntp:2014":N}},attemptSync:function(e){d=e,s||(!function(){try{const e=isNaN(m)?30:m;return!(f&&e&&!isNaN(e))||(Date.now()-f)/1e3>=e}catch(e){return!0}}()?t.trigger(M.TIME_SYNCHRONIZATION_COMPLETED):(s=!0,function e(t=null){let n=t||0;if(!d||0===d.length||n>=d.length)return void A();let r=d[n];if(r)if(l.hasOwnProperty(r.schemeIdUri)){const t=(new Date).getTime();l[r.schemeIdUri](r.value,(function(e){const n=(new Date).getTime(),i=y(t,n,e);p=r,A(i)}),(function(){e(n+1)}))}else e(n+1);else A()}()))},setConfig:function(e){e&&(e.dashMetrics&&(u=e.dashMetrics),e.baseURLController&&(E=e.baseURLController),e.settings&&(o=e.settings))},reset:function(){_(),t.off(M.ATTEMPT_BACKGROUND_SYNC,T,r)}},i=w(e).getInstance().getLogger(r),t.on(M.ATTEMPT_BACKGROUND_SYNC,T,r),r}mr.__dashjs_factory_name="TimeSyncController";const Er=R.getSingletonFactory(mr);function _r(){let e,t;const n=this.context;return e={createMediaSource:function(){let e="WebKitMediaSource"in window;return"MediaSource"in window?new MediaSource:e?new WebKitMediaSource:null},attachMediaSource:function(e,t){let n=window.URL.createObjectURL(e);return t.setSource(n),n},detachMediaSource:function(e){e.setSource(null)},setDuration:function e(n,r){n&&"open"===n.readyState&&(null===r&&isNaN(r)||n.duration!==r&&(!function(e){let t=e.sourceBuffers;for(let e=0;e<t.length;e++)if(t[e].updating)return!0;return!1}(n)?(t.info("Set MediaSource duration:"+r),n.duration=r):setTimeout(e.bind(null,n,r),50)))},setSeekable:function(e,t,n){e&&"function"==typeof e.setLiveSeekableRange&&"function"==typeof e.clearLiveSeekableRange&&"open"===e.readyState&&t>=0&&t<n&&(e.clearLiveSeekableRange(),e.setLiveSeekableRange(t,n))},signalEndOfStream:function(e){if(!e||"open"!==e.readyState)return;let n=e.sourceBuffers;for(let e=0;e<n.length;e++){if(n[e].updating)return;if(0===n[e].buffered.length)return}t.info("call to mediaSource endOfStream"),e.endOfStream()}},t=w(n).getInstance().getLogger(e),e}Er.HTTP_TIMEOUT_MS=5e3,R.updateSingletonFactory(mr.__dashjs_factory_name,Er),_r.__dashjs_factory_name="MediaSourceController";var Tr=R.getSingletonFactory(_r);function yr(){const e="discarded",t="updated",n="added",r=this.context,i=b(r).getInstance();let s,a,o,l,u,c,d,f,g,h;function p(){if(!d||!f)throw new Error("setConfig function has to be called previously")}function m(){h=!1,o={},l={},u=null,g=!1,c=Date.now()/1e3}function E(){try{null!==u&&h&&(clearInterval(u),u=null,h=!1,function(){try{S(l),S(o)}catch(e){}}())}catch(e){throw e}}function _(r,i,s=!1){const a=r.eventStream.schemeIdUri,o=r.eventStream.value,l=r.id;let u=e;i[a]||(i[a]=[]);const c=i[a].findIndex(e=>(!o||e.eventStream.value&&e.eventStream.value===o)&&e.id===l);return-1===c?(i[a].push(r),u=n):s&&(i[a][c]=r,u=t),u}function T(e){try{if(1==e.eventStream.value){const t=e.calculatedPresentationTime;let n;n=4294967295==e.calculatedPresentationTime?NaN:e.calculatedPresentationTime+e.duration,i.trigger(D.MANIFEST_VALIDITY_CHANGED,{id:e.id,validUntil:t,newDuration:n,newManifestValidAfter:NaN},{mode:D.EVENT_MODE_ON_START})}}catch(e){}}function y(){try{if(!g){g=!0;const e=f.getTime();let t=e-c;t=c>0?Math.max(0,t):0,A(l,t,e),A(o,t,e),c=e,g=!1}}catch(e){g=!1}}function A(e,t,n){try{I(e,(function(r){if(void 0!==r){const i=isNaN(r.duration)?0:r.duration;r.calculatedPresentationTime<=n&&r.calculatedPresentationTime+t+i>=n?R(r,e,D.EVENT_MODE_ON_START):(function(e,t,n){try{return e-t>n}catch(e){return!1}}(n,i+t,r.calculatedPresentationTime)||function(e){try{const t=e.eventStream.period.start+e.eventStream.period.duration;return e.calculatedPresentationTime>t}catch(e){return!1}}(r))&&(a.debug(`Deleting event ${r.id} as it is expired or invalid`),N(e,r))}}))}catch(e){}}function S(e){try{const t=f.getTime();I(e,function(n){const r=n.eventStream&&n.eventStream.period&&!isNaN(n.eventStream.period.duration)?n.eventStream.period.duration:NaN,i=n.eventStream&&n.eventStream.period&&!isNaN(n.eventStream.period.start)?n.eventStream.period.start:NaN;if(isNaN(r)||isNaN(i))return;const s=n.calculatedPresentationTime;Math.abs(s-t)<300&&R(n,e,D.EVENT_MODE_ON_START)}())}catch(e){}}function I(e,t){try{if(e){const n=Object.keys(e);for(let r=0;r<n.length;r++){e[n[r]].forEach(e=>{void 0!==e&&t(e)})}}}catch(e){}}function R(e,t,n){try{const s=f.getTime(),o=e.id;if(n===D.EVENT_MODE_ON_RECEIVE)return a.debug("Received event "+o),void i.trigger(e.eventStream.schemeIdUri,{event:e},{mode:n});"urn:mpeg:dash:event:2012"===e.eventStream.schemeIdUri&&1===e.eventStream.value?0===e.duration&&0===e.presentationTimeDelta||(a.debug(`Starting manifest refresh event ${o} at ${s}`),N(t,e),function(){try{p(),d.refreshManifest()}catch(e){}}()):"urn:mpeg:dash:event:callback:2015"===e.eventStream.schemeIdUri&&1===e.eventStream.value?(a.debug(`Starting callback event ${o} at ${s}`),N(t,e),function(e){try{fn(r).create({}).load({method:"get",url:e,request:{responseType:"arraybuffer"}})}catch(e){throw e}}(e.messageData)):(a.debug(`Starting event ${o} at ${s}`),N(t,e),i.trigger(e.eventStream.schemeIdUri,{event:e},{mode:n}))}catch(e){}}function N(e,t){const n=t.eventStream.schemeIdUri,r=t.eventStream.value,i=t.id;e[n]=e[n].filter(e=>r&&e.eventStream.value&&e.eventStream.value!==r||e.id!==i),0===e[n].length&&delete e[n]}return s={addInlineEvents:function(e){try{if(p(),e)for(let r=0;r<e.length;r++){let i=e[r],s=_(i,o,!0);s===n?(a.debug("Added inline event with id "+i.id),R(i,e,D.EVENT_MODE_ON_RECEIVE)):s===t&&a.debug("Updated inline event with id "+i.id)}a.debug(`Added ${e.length} inline events`)}catch(e){throw e}},addInbandEvents:function(e){try{p();for(let t=0;t<e.length;t++){let r=e[t];_(r,l,!1)===n?("urn:mpeg:dash:event:2012"===r.eventStream.schemeIdUri&&void 0===l[r.id]&&T(r),a.debug("Added inband event with id "+r.id),R(r,e,D.EVENT_MODE_ON_RECEIVE)):a.debug(`Inband event with scheme_id_uri ${r.eventStream.schemeIdUri}, value ${r.eventStream.value} and id ${r.id} was ignored because it has been added before.`)}y()}catch(e){throw e}},getInbandEvents:function(){return l},getInlineEvents:function(){return o},start:function(){try{p(),a.debug("Start Event Controller"),h||isNaN(100)||(h=!0,u=setInterval(y,100))}catch(e){throw e}},setConfig:function(e){try{if(!e)return;e.manifestUpdater&&(d=e.manifestUpdater),e.playbackController&&(f=e.playbackController)}catch(e){throw e}},reset:function(){E(),m()}},a=w(r).getInstance().getLogger(s),m(),s}yr.__dashjs_factory_name="EventController";var Ar=R.getSingletonFactory(yr);function Sr(){const e=this.context,t=b(e).getInstance();let n,r,i,s,a,o,l,u,c,d,f,g,h,p,m,E,_,T,y,S,R,N,C,v,O,L,P,F,x,U,B,k,Y,K,q,H,V,j,z,W;function X(){if(ye()){const e=U.getPlaybackQuality();e&&c.addDroppedFrames(e)}}function Q(e){const t=ae(e.seekTime);t===N&&j&&j.length>0&&j.forEach(e=>{e.deactivate(!0)}),t&&t!==N?(Se(on.END_OF_PERIOD_STOP_REASON),ce(t,N,e.seekTime)):Se(on.USER_REQUEST_STOP_REASON),Ie(an.SEEK_START_REASON)}function $(e){const t=ue();Se(on.END_OF_PERIOD_STOP_REASON),ce(t,N,e.seekTime),Ie(an.SEEK_START_REASON)}function Z(){r.debug("[onPlaybackStarted]"),K?(K=!1,Ie(an.INITIAL_PLAYOUT_START_REASON)):Y&&(Y=!1,Ie(an.RESUME_FROM_PAUSE_START_REASON))}function J(e){r.debug("[onPlaybackPaused]"),e.ended||(Y=!0,Se(on.USER_REQUEST_STOP_REASON))}function ee(){q&&(clearInterval(q),q=null)}function te(){H||(H=setInterval((function(){!function(){if(!N||!ne(N))return;const e=function(e){try{const t=e||(N||null);if(t){const e=t.getStreamInfo().start;return R.filter((function(t){return t.getStreamInfo().start>e}))}}catch(e){return[]}}(N);let t=0;for(;t<e.length;){const n=e[t],r=0===t?N:e[t-1];if(!n.getPreloadingScheduled()&&ne(r)&&x){const e=[A.VIDEO,A.AUDIO];let t=!0;e.forEach(e=>{const r=u.getMediaInfoForType(n.getStreamInfo(),e);u.getVoRepresentations(r).forEach(e=>{const n=u.getIsDynamic(),r=S.calcSegmentAvailabilityRange(e,n);r.end<r.start&&(t=!1)})}),t&&se(n,r)}t+=1}}()}),500))}function ne(e){try{if(!e)return!1;const t=e.getProcessors().filter(e=>e.getType()===A.AUDIO||e.getType()===A.VIDEO);if(!t||0===t.length)return!1;const n=t.filter(e=>!e.isBufferingCompleted());return n&&0===n.length}catch(e){return!1}}function re(){const e=Ne().isLast;x&&e&&(r.info("[onStreamBufferingCompleted] calls signalEndOfStream of mediaSourceController."),d.signalEndOfStream(x))}function ie(e,t){try{return W.get().streaming.reuseExistingSourceBuffers&&t.isProtectionCompatible(e,t)&&(z||t.isMediaCodecCompatible(e,t))&&!function(e){try{const t=e.getStreamInfo(),n=u.getAdaptationForType(t.index,A.FRAGMENTED_TEXT,t);return!!n&&(-1!==n.codecs.indexOf("stpp")||-1!==n.codecs.indexOf("wvtt"))}catch(e){return!1}}(e)}catch(e){return!1}}function se(e,t=null){if(x&&!e.getPreloaded()){ie(e,t)&&(e.setPreloadingScheduled(!0),r.info("[onStreamCanLoadNext] Preloading next stream with id "+e.getId()),e.preload(x,V),j.push(e),e.getProcessors().forEach(t=>{t.setBufferingTime(e.getStartTime())}))}}function ae(e){if(isNaN(e))return null;let t=0,n=null;const r=R.length;r>0&&(t+=R[0].getStartTime());for(let i=0;i<r;i++)if(n=R[i],t=parseFloat((t+n.getDuration()).toFixed(5)),e<t)return n;return null}function oe(){return N?N.getProcessors():[]}function le(e){if(!N.getIsEndedEventSignaled()){N.setIsEndedEventSignaled(!0);const e=ue();e?(r.debug("StreamController onEnded, found next stream with id "+e.getStreamInfo().id),ce(e,N,NaN)):(r.debug("StreamController no next stream found"),N.setIsEndedEventSignaled(!1)),Se(e?on.END_OF_PERIOD_STOP_REASON:on.END_OF_CONTENT_STOP_REASON)}e&&e.isLast&&ee()}function ue(e=null){const t=e||(N||null);if(t){const e=t.getStreamInfo().start,n=t.getStreamInfo().duration,r=parseFloat((e+n).toFixed(5));let i=0,s=-1,a=NaN;for(;i<R.length;){const e=R[i].getStreamInfo().start-r;e>=0&&(isNaN(a)||e<a)&&(a=e,s=i),i+=1}return s>=0?R[s]:null}return null}function ce(e,n,i){if(L||!e||n===e&&e.isActive())return;L=!0,t.trigger(M.PERIOD_SWITCH_STARTED,{fromStreamInfo:n?n.getStreamInfo():null,toStreamInfo:e.getStreamInfo()});let s=!1;n&&(s=ie(e,n),n.deactivate(s)),i=isNaN(i)?!s&&n?e.getStreamInfo().start:NaN:i,r.info(`Switch to stream ${e.getId()}. Seektime is ${i}, current playback time is ${B.getTime()}`),r.info("Seamless period switch is set to "+s),N=e,j=j.filter(e=>e.getId()!==N.getId()),B.initialize(Ne(),!!n,i),U.getElement()?de(i,null===n,!1,s):fe(i,s)}function de(e,n,i,s){let a;function o(){x&&"open"===x.readyState&&(r.debug("MediaSource is open!"),window.URL.revokeObjectURL(a),x.removeEventListener("sourceopen",o),x.removeEventListener("webkitsourceopen",o),ge(),n||t.trigger(M.SOURCE_INITIALIZED),i?N.setMediaSource(x):fe(e,s))}x?s?(fe(e,s),n||t.trigger(M.SOURCE_INITIALIZED)):(d.detachMediaSource(U),x.addEventListener("sourceopen",o,!1),x.addEventListener("webkitsourceopen",o,!1),a=d.attachMediaSource(x,U),r.debug("MediaSource attached to element. Waiting on open...")):(x=d.createMediaSource(),x.addEventListener("sourceopen",o,!1),x.addEventListener("webkitsourceopen",o,!1),a=d.attachMediaSource(x,U),r.debug("MediaSource attached to element. Waiting on open..."))}function fe(e,n){if(V=N.activate(x,n?V:void 0),V){const e=Object.keys(V);e.length>0&&V[e[0]].changeType&&(z=!0)}K||isNaN(e)||(e===B.getTime()?t.trigger(M.SEEK_TARGET,{time:e},{streamId:N.getId()}):B.seek(e)),!O&&K||B.play(),L=!1,t.trigger(M.PERIOD_SWITCH_COMPLETED,{toStreamInfo:Ne()})}function ge(e){const t=e||Ne().manifestInfo.duration;d.setDuration(x,t)}function pe(e){for(let t=0,n=R.length;t<n;t++)if(R[t].getId()===e.id)return R[t];return null}function me(){try{const n=u.getStreamsInfo();if(0===n.length)throw new Error("There are no streams");c.updateManifestUpdateInfo({currentTime:B.getTime(),buffered:U.getBufferRange(),presentationStartTime:n[0].start,clientTimeOffset:S.getClientTimeOffset()}),R.length>0&&(R=R.filter(e=>{const t=n.filter(t=>t.id===e.getId()).length>0||e.getId()===N.getId();return t||r.debug("Removing stream "+e.getId()),t}));for(let t=0,r=n.length;t<r;t++){const r=n[t];let o=pe(r);o?o.updateData(r):(o=gr(e).create({manifestModel:l,mediaPlayerModel:k,dashMetrics:c,manifestUpdater:a,adapter:u,timelineConverter:S,capabilities:i,capabilitiesFilter:s,errHandler:y,baseURLController:g,abrController:h,playbackController:B,eventController:m,mediaController:p,textController:E,protectionController:C,videoModel:U,streamInfo:r,settings:W}),R.push(o),o.initialize()),c.addManifestUpdateStreamInfo(r)}if(!N){if(u.getIsDynamic()&&R.length){const e=n[0].manifestInfo,t=function(e,t){try{let n=NaN;if(t&&!isNaN(t.maxFragmentDuration)&&isFinite(t.maxFragmentDuration))return t.maxFragmentDuration;if(e&&1===e.length){const t=e[0],r=[A.VIDEO,A.AUDIO,A.FRAGMENTED_TEXT].reduce((e,n)=>{const r=u.getMediaInfoForType(t,n);return r&&e.push(r),e},[]).reduce((e,t)=>{const n=u.getVoRepresentations(t);return n&&n.length>0&&n.forEach(t=>{t&&e.push(t)}),e},[]).reduce((e,t)=>{const n=u.convertDataToRepresentationInfo(t);return n&&n.fragmentDuration&&!isNaN(n.fragmentDuration)&&e.push(n.fragmentDuration),e},[]);n=Math.max(...r)}return isFinite(n)?n:NaN}catch(e){return NaN}}(n,e);B.computeAndSetLiveDelay(t,e.DVRWindowSize,e.minBufferTime)}let e=null;e=ae(B.getStartTimeFromUriParameters(u.getIsDynamic())),!e&&u.getIsDynamic()&&R.length&&(r.debug("Dynamic stream: Trying to find the correct starting period"),e=function(){try{const e=S.calcPresentationTimeFromWallTime(new Date,u.getRegularPeriods()[0]),t=B.getLiveDelay();return ae(e-t)}catch(e){return null}}());ce(null!==e?e:R[0],null,NaN),q||(q=setInterval((function(){!L&&B.getTimeToStreamEnd()<=0&&t.trigger(M.PLAYBACK_ENDED,{isLast:Ne().isLast})}),200)),te()}t.trigger(M.STREAMS_COMPOSED)}catch(e){y.error(new G(he.MANIFEST_ERROR_ID_NOSTREAMS_CODE,e.message+"nostreamscomposed",l.getValue())),F=!0,ve()}}function Ee(){const e=l.getValue();C&&(t.trigger(M.PROTECTION_CREATED,{controller:C,manifest:e}),C.setMediaElement(U.getElement()),v&&C.setProtectionData(v)),me()}function _e(e){if(e.error)F=!0,ve();else{const n=e.manifest;u.updatePeriods(n);let i=u.getUTCTimingSources();!u.getIsDynamic()||i&&0!==i.length||t.trigger(D.CONFORMANCE_VIOLATION,{level:Te.LEVELS.WARNING,event:Te.EVENTS.NO_UTC_TIMING_ELEMENT});let s=u.getIsDynamic()?i.concat(k.getUTCTimingSources()):i;const a=T.isHTTPS(e.manifest.url);s.forEach((function(e){e.value.replace(/.*?:\/\//g,"")===k.getDefaultUtcTimingSource().value.replace(/.*?:\/\//g,"")&&(e.value=e.value.replace(a?new RegExp(/^(http:)?\/\//i):new RegExp(/^(https:)?\/\//i),a?"https://":"http://"),r.debug("Matching default timing source protocol to manifest protocol: ",e.value))})),g.initialize(n),f.attemptSync(s)}}function ye(){return!!N&&N.getHasVideoTrack()}function Ae(){return!!N&&N.getHasAudioTrack()}function Se(e,t){t=t||new Date,oe().forEach(n=>{n.finalisePlayList(t,e)}),c.addPlayList()}function Ie(e){c.createPlaylistMetrics(1e3*B.getTime(),e)}function Re(e){if(!e.error)return;let t="";switch(e.error.code){case 1:t="MEDIA_ERR_ABORTED";break;case 2:t="MEDIA_ERR_NETWORK";break;case 3:t="MEDIA_ERR_DECODE";break;case 4:t="MEDIA_ERR_SRC_NOT_SUPPORTED";break;case 5:t="MEDIA_ERR_ENCRYPTED";break;default:t="UNKNOWN"}P=!0,e.error.message&&(t+=" ("+e.error.message+")"),e.error.msExtendedCode&&(t+=" (0x"+(e.error.msExtendedCode>>>0).toString(16).toUpperCase()+")"),r.fatal("Video Element Error: "+t),e.error&&r.fatal(e.error),y.error(new G(e.error.code,t)),ve()}function Ne(){return N?N.getStreamInfo():null}function De(){if(!(o&&o.hasOwnProperty("load")&&S&&S.hasOwnProperty("initialize")&&S.hasOwnProperty("reset")&&S.hasOwnProperty("getClientTimeOffset")&&l&&y&&c&&B))throw new Error(A.MISSING_CONFIG_ERROR)}function Ce(e){isNaN(e.newDuration)||ge(e.newDuration)}function be(){R=[],C=null,L=!1,N=null,P=!1,F=!1,K=!0,Y=!1,O=!0,q=null,H=null,j=[]}function ve(){De(),f.reset(),Se(P||F?on.FAILURE_STOP_REASON:on.USER_REQUEST_STOP_REASON);for(let e=0,t=R?R.length:0;e<t;e++){R[e].reset(P)}t.off(M.PLAYBACK_TIME_UPDATED,X,n),t.off(M.PLAYBACK_SEEKING,Q,n),t.off(M.GAP_CAUSED_SEEK_TO_PERIOD_END,$,n),t.off(M.PLAYBACK_ERROR,Re,n),t.off(M.PLAYBACK_STARTED,Z,n),t.off(M.PLAYBACK_PAUSED,J,n),t.off(M.PLAYBACK_ENDED,le,n),t.off(M.MANIFEST_UPDATED,_e,n),t.off(M.STREAM_BUFFERING_COMPLETED,re,n),t.off(M.MANIFEST_VALIDITY_CHANGED,Ce,n),t.off(M.TIME_SYNCHRONIZATION_COMPLETED,Ee,n),t.off(D.METRIC_ADDED,Me,n),g.reset(),a.reset(),m.reset(),c.clearAllCurrentMetrics(),l.setValue(null),o.reset(),S.reset(),_.reset(),x&&(d.detachMediaSource(U),x=null),U=null,C&&(C.setMediaElement(null),C=null,v=null,l.getValue()&&t.trigger(M.PROTECTION_DESTROYED,{data:l.getValue().url})),ee(),clearInterval(H),H=null,t.trigger(M.STREAM_TEARDOWN_COMPLETE),be()}function Me(e){if(e.metric===I.DVR_INFO){const t=Ae()?A.AUDIO:A.VIDEO;e.mediaType===t&&d.setSeekable(x,e.value.range.start,e.value.range.end)}}return n={initialize:function(r,i){De(),O=r,v=i,S.initialize(),a=pr(e).create(),a.setConfig({manifestModel:l,adapter:u,manifestLoader:o,errHandler:y,settings:W}),a.initialize(),m=Ar(e).getInstance(),m.setConfig({manifestUpdater:a,playbackController:B}),m.start(),f.setConfig({dashMetrics:c,baseURLController:g,settings:W}),f.initialize(),t.on(M.PLAYBACK_TIME_UPDATED,X,n),t.on(M.PLAYBACK_SEEKING,Q,n),t.on(M.GAP_CAUSED_SEEK_TO_PERIOD_END,$,n),t.on(M.PLAYBACK_ERROR,Re,n),t.on(M.PLAYBACK_STARTED,Z,n),t.on(M.PLAYBACK_PAUSED,J,n),t.on(M.PLAYBACK_ENDED,le,n,{priority:b.EVENT_PRIORITY_HIGH}),t.on(M.MANIFEST_UPDATED,_e,n),t.on(M.STREAM_BUFFERING_COMPLETED,re,n),t.on(M.MANIFEST_VALIDITY_CHANGED,Ce,n),t.on(M.TIME_SYNCHRONIZATION_COMPLETED,Ee,n),t.on(D.METRIC_ADDED,Me,n)},getActiveStreamInfo:Ne,hasVideoTrack:ye,hasAudioTrack:Ae,switchToVideoElement:function(e){N&&(B.initialize(Ne()),de(e,!1,!0,!1))},getStreamById:function(e){return R.filter((function(t){return t.getId()===e}))[0]},getStreamForTime:ae,getTimeRelativeToStreamId:function(e,t){let n=null,r=0,i=0,s=null;for(let a=0;a<R.length;a++){if(n=R[a],i=n.getStartTime(),s=n.getDuration(),Number.isFinite(i)&&(r=i),n.getId()===t)return e-r;Number.isFinite(s)&&(r+=s)}return null},load:function(e){De(),o.load(e)},loadWithManifest:function(e){!function(){if(!a||!a.hasOwnProperty("setManifest"))throw new Error("initialize function has to be called previously")}(),a.setManifest(e)},getActiveStreamProcessors:oe,setConfig:function(e){e&&(e.capabilities&&(i=e.capabilities),e.capabilitiesFilter&&(s=e.capabilitiesFilter),e.manifestLoader&&(o=e.manifestLoader),e.manifestModel&&(l=e.manifestModel),e.mediaPlayerModel&&(k=e.mediaPlayerModel),e.protectionController&&(C=e.protectionController),e.adapter&&(u=e.adapter),e.dashMetrics&&(c=e.dashMetrics),e.errHandler&&(y=e.errHandler),e.timelineConverter&&(S=e.timelineConverter),e.videoModel&&(U=e.videoModel),e.playbackController&&(B=e.playbackController),e.abrController&&(h=e.abrController),e.mediaController&&(p=e.mediaController),e.textController&&(E=e.textController),e.settings&&(W=e.settings),e.baseURLController&&(g=e.baseURLController))},setProtectionData:function(e){v=e},getIsStreamSwitchInProgress:function(){return L},getHasMediaOrIntialisationError:function(){return P||F},hasStreamFinishedBuffering:ne,getStreams:function(){return R},getActiveStream:function(){return N},reset:ve},r=w(e).getInstance().getLogger(n),f=Er(e).getInstance(),d=Tr(e).getInstance(),_=Et(e).getInstance(),T=sn(e).getInstance(),be(),n}Sr.__dashjs_factory_name="StreamController";var Ir=R.getSingletonFactory(Sr);function Rr(){const e=this.context,t=b(e).getInstance();let n,r,i,s,a,o,l,u,c,d,f;function g(){f.debug("Stopping the gap controller"),a&&(clearInterval(a),a=null),function(){t.off(M.WALLCLOCK_TIME_UPDATED,m,this),t.off(M.PLAYBACK_SEEKING,p,this),t.off(M.BYTES_APPENDED_END_FRAGMENT,h,n)}(),a=null,o=NaN,s=0,d=null}function h(){a||function(){try{a||(f.debug("Starting the gap controller"),a=setInterval(()=>{if(!E())return;_(l.getTime())},100))}catch(e){}}()}function p(){d&&(clearTimeout(d),d=null)}function m(){if(E()&&(s++,s>=30)){const e=l.getTime();r===e?_(e,!0):(r=e,o=NaN),s=0}}function E(){return i.get().streaming.jumpGaps&&u.getActiveStreamProcessors().length>0&&(!l.isSeeking()||u.hasStreamFinishedBuffering(u.getActiveStream()))&&!l.isPaused()&&!u.getIsStreamSwitchInProgress()&&!u.getHasMediaOrIntialisationError()}function _(e,n=!1){const r=i.get().streaming.smallGapLimit,s=i.get().streaming.jumpLargeGaps,a=c.getBufferRange();let u,g=NaN,h=!1;if(u=function(e,t){try{if(!e||e.length<=1&&t>0)return NaN;let n=NaN,r=0;for(;isNaN(n)&&r<e.length;){const i=r>0?e.end(r-1):0;t<e.start(r)&&i-t<.1&&(n=r),r+=1}return n}catch(e){return null}}(a,e),!isNaN(u)){const t=a.start(u),n=t-e;n>0&&(n<=r||s)&&(g=t)}const p=l.getTimeToStreamEnd();if(isNaN(g)&&n&&isFinite(p)&&!isNaN(p)&&p<r&&(g=parseFloat(l.getStreamEndTime().toFixed(5)),h=!0),g>0&&o!==g&&g>e&&!d){const n=g-e;if(h)f.warn(`Jumping to end of stream because of gap from ${e} to ${g}. Gap duration: ${n}`),t.trigger(M.GAP_CAUSED_SEEK_TO_PERIOD_END,{seekTime:g,duration:n});else{const r=l.getIsDynamic(),i=u>0?a.end(u-1):e,s=r?1e3*n:0;d=window.setTimeout(()=>{l.seek(g,!0,!0),f.warn(`Jumping gap starting at ${i} and ending at ${g}. Jumping by: ${n}`),t.trigger(M.GAP_CAUSED_INTERNAL_SEEK,{seekTime:g,duration:n}),d=null},s)}o=g}}return n={reset:g,setConfig:function(e){e&&(e.settings&&(i=e.settings),e.playbackController&&(l=e.playbackController),e.streamController&&(u=e.streamController),e.videoModel&&(c=e.videoModel),e.timelineConverter&&e.timelineConverter,e.adapter&&e.adapter)},initialize:function(){!function(){t.on(M.WALLCLOCK_TIME_UPDATED,m,this),t.on(M.PLAYBACK_SEEKING,p,this),t.on(M.BYTES_APPENDED_END_FRAGMENT,h,n)}()}},f=w(e).getInstance().getLogger(n),g(),n}Rr.__dashjs_factory_name="GapController";var Nr=R.getSingletonFactory(Rr);function Dr(){const e=this.context,t=b(e).getInstance();let n,r,i,s,a,o;const l=[A.TRACK_SWITCH_MODE_ALWAYS_REPLACE,A.TRACK_SWITCH_MODE_NEVER_REPLACE],u=[A.TRACK_SELECTION_MODE_HIGHEST_BITRATE,A.TRACK_SELECTION_MODE_HIGHEST_EFFICIENCY,A.TRACK_SELECTION_MODE_WIDEST_RANGE];function c(e,t){if(!e||!t)return[];const n=t.id;return i[n]&&i[n][e]?i[n][e].list:[]}function d(e,t){return!e||!t||t&&!i[t.id]?null:i[t.id][e].current}function f(e,n){if(!e||!e.streamInfo)return;const r=e.type,s=e.streamInfo,a=s.id,l=d(r,s);if(i[a]&&i[a][r]&&!_(e,l)&&(i[a][r].current=e,!i[a][r].current||n&&r===A.FRAGMENTED_TEXT||t.trigger(M.CURRENT_TRACK_CHANGED,{oldMediaInfo:l,newMediaInfo:e,switchMode:p(r)}),!n)){let t=function(e){const t={lang:e.lang,viewpoint:e.viewpoint,roles:e.roles,accessibility:e.accessibility,audioChannelConfiguration:e.audioChannelConfiguration};return t.lang||t.viewpoint||t.role&&t.role.length>0||t.accessibility&&t.accessibility.length>0||t.audioChannelConfiguration&&t.audioChannelConfiguration.length>0?t:null}(e);if(!t||!i[a][r].storeLastSettings)return;t.roles&&(t.role=t.roles[0],delete t.roles),t.accessibility&&(t.accessibility=t.accessibility[0]),t.audioChannelConfiguration&&(t.audioChannelConfiguration=t.audioChannelConfiguration[0]),o.setSavedMediaSettings(r,t)}}function g(e,t){e&&t&&(a[e]=t)}function h(e){return e?a[e]:null}function p(e){return s.get().streaming.trackSwitchMode[e]}function m(){return s.get().streaming.selectionModeForInitialTrack}function E(e){return e===A.AUDIO||e===A.VIDEO||e===A.TEXT||e===A.FRAGMENTED_TEXT||e===A.IMAGE}function _(e,t){if(!e&&!t)return!0;if(!e||!t)return!1;const n=e.id===t.id,r=e.viewpoint===t.viewpoint,i=e.lang===t.lang,s=e.roles.toString()===t.roles.toString(),a=e.accessibility.toString()===t.accessibility.toString(),o=e.audioChannelConfiguration.toString()===t.audioChannelConfiguration.toString();return n&&r&&i&&s&&a&&o}function T(){i={},a={audio:null,video:null,fragmentedText:null}}function y(e,t){const n=!e.lang||t.lang.match(e.lang),r=void 0===e.index||null===e.index||t.index===e.index,i=!e.viewpoint||e.viewpoint===t.viewpoint,s=!e.role||!!t.roles.filter((function(t){return t===e.role}))[0];let a=!e.accessibility||!!t.accessibility.filter((function(t){return t===e.accessibility}))[0],o=!e.audioChannelConfiguration||!!t.audioChannelConfiguration.filter((function(t){return t===e.audioChannelConfiguration}))[0];return n&&r&&i&&s&&a&&o}function S(e){let t,n=0,r=[];return e.forEach((function(e){t=Math.max.apply(Math,e.bitrateList.map((function(e){return e.bandwidth}))),t>n?(n=t,r=[e]):t===n&&r.push(e)})),r}function I(e){let t,n=1/0,r=[];return e.forEach((function(e){const i=e.bitrateList.reduce((function(e,t){const n=Math.max(1,t.width*t.height);return e+t.bandwidth/n}),0);t=i/e.bitrateList.length,t<n?(n=t,r=[e]):t===n&&r.push(e)})),r}function R(e){let t,n=0,r=[];return e.forEach((function(e){t=e.representationCount,t>n?(n=t,r=[e]):t===n&&r.push(e)})),r}return n={checkInitialMediaSettingsForType:function(e,t){let n=h(e);const r=c(e,t),i=[];n||(n=o.getSavedMediaSettings(e),g(e,n)),r&&0!==r.length&&(n&&r.forEach((function(e){y(n,e)&&i.push(e)})),0===i.length?f(this.selectInitialTrack(e,r),!0):i.length>1?f(this.selectInitialTrack(e,i)):f(i[0]))},addTrack:function(e){if(!e)return;const t=e.type;if(!E(t))return;let n=e.streamInfo.id;i[n]||(i[n]={audio:{list:[],storeLastSettings:!0,current:null},video:{list:[],storeLastSettings:!0,current:null},text:{list:[],storeLastSettings:!0,current:null},fragmentedText:{list:[],storeLastSettings:!0,current:null},image:{list:[],storeLastSettings:!0,current:null}});const r=i[n][t].list;for(let t=0,n=r.length;t<n;++t)if(_(r[t],e))return;r.push(e);let s=h(t);s&&y(s,e)&&!d(t,e.streamInfo)&&f(e)},getTracksFor:c,getCurrentTrackFor:d,isCurrentTrack:function(e){if(!e)return!1;const t=e.type,n=e.streamInfo.id;return i[n]&&i[n][t]&&_(i[n][t].current,e)},setTrack:f,setInitialSettings:g,getInitialSettings:h,setSwitchMode:function(e,t){if(r.warn("deprecated: Please use updateSettings({streaming: { trackSwitchMode: mode } }) instead"),!(-1!==l.indexOf(t)))return void r.warn("Track switch mode is not supported: "+t);let n={};n[e]=t,s.update({streaming:{trackSwitchMode:n}})},getSwitchMode:p,selectInitialTrack:function(e,t){if(e===A.FRAGMENTED_TEXT)return t[0];let n=m(),i=[];switch(n){case A.TRACK_SELECTION_MODE_HIGHEST_BITRATE:i=S(t),i.length>1&&(i=R(i));break;case A.TRACK_SELECTION_MODE_HIGHEST_EFFICIENCY:i=I(t),i.length>1&&(i=S(i));break;case A.TRACK_SELECTION_MODE_WIDEST_RANGE:i=R(t),i.length>1&&(i=S(t));break;default:r.warn("Track selection mode is not supported: "+n)}return i[0]},getTracksWithHighestBitrate:S,getTracksWithHighestEfficiency:I,getTracksWithWidestRange:R,setSelectionModeForInitialTrack:function(e){r.warn("deprecated: Please use updateSettings({streaming: { selectionModeForInitialTrack: mode } }) instead"),-1!==u.indexOf(e)?s.update({streaming:{selectionModeForInitialTrack:e}}):r.warn("Track selection mode is not supported: "+e)},getSelectionModeForInitialTrack:m,isMultiTrackSupportedByType:E,isTracksEqual:_,matchSettings:y,saveTextSettingsDisabled:function(){o.setSavedMediaSettings(A.FRAGMENTED_TEXT,null)},setConfig:function(e){e&&(e.domStorage&&(o=e.domStorage),e.settings&&(s=e.settings))},reset:T},r=w(e).getInstance().getLogger(n),T(),n}Dr.__dashjs_factory_name="MediaController";const Cr=R.getSingletonFactory(Dr);R.updateSingletonFactory(Dr.__dashjs_factory_name,Cr);class br{constructor(e,t){this.data={baseUrls:e||null,selectedIdx:t||NaN},this.children=[]}}function vr(){let e,t,n;const r=this.context,i=On(r).getInstance();function s(e,t,r){const s=n.getBaseURLsFromElement(r);e[t]?i.areEqual(s,e[t].data.baseUrls)||(e[t].data.baseUrls=s,e[t].data.selectedIdx=NaN):e[t]=new br(s)}function a(e){!function(){if(!n||!n.hasOwnProperty("getBaseURLsFromElement")||!n.hasOwnProperty("getRepresentationSortFunction"))throw new Error("setConfig function has to be called previously")}();const r=n.getBaseURLsFromElement(e);i.areEqual(r,t.data.baseUrls)||(t.data.baseUrls=r,t.data.selectedIdx=NaN),e&&e.Period_asArray&&e.Period_asArray.forEach((e,r)=>{s(t.children,r,e),e.AdaptationSet_asArray&&e.AdaptationSet_asArray.forEach((e,i)=>{s(t.children[r].children,i,e),e.Representation_asArray&&e.Representation_asArray.sort(n.getRepresentationSortFunction()).forEach((e,n)=>{s(t.children[r].children[i].children,n,e)})})})}function o(){t=new br}return e={reset:o,update:function(e){a(e)},getForPath:function(e){let n=t;const r=[n.data];return e&&e.forEach(e=>{n=n.children[e],n&&r.push(n.data)}),r.filter(e=>e.baseUrls.length)},invalidateSelectedIndexes:function(e){!function e(n,r){const i=r||t;n(i.data),i.children&&i.children.forEach(t=>e(n,t))}(t=>{isNaN(t.selectedIdx)||e===t.baseUrls[t.selectedIdx].serviceLocation&&(t.selectedIdx=NaN)})},setConfig:function(e){e.adapter&&(n=e.adapter)}},o(),e}vr.__dashjs_factory_name="BaseURLTreeModel";var Mr=R.getClassFactory(vr);function Or(e){let t;e=e||{};let n=[];const r=b(this.context).getInstance(),i=e.updateEventName,s=e.addBlacklistEventName;function a(e){-1===n.indexOf(e)&&(n.push(e),r.trigger(i,{entry:e}))}function o(e){a(e.entry)}return t={add:a,contains:function(e){return!!(n.length&&e&&e.length)&&-1!==n.indexOf(e)},reset:function(){n=[]}},s&&r.on(s,o,t),t}Or.__dashjs_factory_name="BlackListController";var wr=R.getClassFactory(Or);function Lr(e){let t;const n=(e=e||{}).blacklistController;return t={select:function(e){return e&&function(e){let t,n,r=0,i=[],s=0;if(n=e.sort((function(e,t){let n=e.dvb_priority-t.dvb_priority;return isNaN(n)?0:n})).filter((function(e,t,n){return!t||n[0].dvb_priority&&e.dvb_priority&&n[0].dvb_priority===e.dvb_priority})),n.length)return n.length>1&&(n.forEach(e=>{r+=e.dvb_weight,i.push(r)}),t=Math.floor(Math.random()*(r-1)),i.every((e,n)=>(s=n,!(t<e)))),n[s]}(function(e){let t=[];return e.filter((function(e){return!n.contains(e.serviceLocation)||(e.dvb_priority&&t.push(e.dvb_priority),!1)})).filter((function(e){return!t.length||!e.dvb_priority||-1===t.indexOf(e.dvb_priority)}))}(e))}},t}Lr.__dashjs_factory_name="DVBSelector";var Pr=R.getClassFactory(Lr);function Fr(e){let t;const n=(e=e||{}).blacklistController;return t={select:function(e){let t,r=0;return e&&e.some((e,t)=>(r=t,!n.contains(e.serviceLocation)))&&(t=e[r]),t}},t}Fr.__dashjs_factory_name="BasicSelector";var xr=R.getClassFactory(Fr);function Ur(){const e=this.context,t=b(e).getInstance();let n,r,i,s,a;function o(){r.reset()}return n={chooseSelector:function(e){X(e,"boolean"),a=e?s:i},select:function(e){if(!e)return;const n=e.baseUrls,r=e.selectedIdx;if(!isNaN(r))return n[r];let s=a.select(n);return s?(e.selectedIdx=n.indexOf(s),s):(t.trigger(M.URL_RESOLUTION_FAILED,{error:new G(he.URL_RESOLUTION_FAILED_GENERIC_ERROR_CODE,he.URL_RESOLUTION_FAILED_GENERIC_ERROR_MESSAGE)}),void(a===i&&o()))},reset:o,setConfig:function(e){e.selector&&(a=e.selector)}},r=wr(e).create({updateEventName:M.SERVICE_LOCATION_BLACKLIST_CHANGED,addBlacklistEventName:M.SERVICE_LOCATION_BLACKLIST_ADD}),i=xr(e).create({blacklistController:r}),s=Pr(e).create({blacklistController:r}),a=i,n}Ur.__dashjs_factory_name="BaseURLSelector";var Br=R.getClassFactory(Ur);function kr(){let e,t;const n=this.context,r=b(n).getInstance(),i=sn(n).getInstance();let s,a;function o(e){s.invalidateSelectedIndexes(e.entry)}return e={reset:function(){s.reset(),a.reset()},initialize:function(e){var n;s.setConfig({adapter:t}),n=e,s.update(n),a.chooseSelector(t.getIsDVB(n))},resolve:function(e){const t=s.getForPath(e).reduce((e,t)=>{const n=a.select(t);return n?(i.isRelative(n.url)?e.url=i.resolve(n.url,e.url):(e.url=n.url,e.serviceLocation=n.serviceLocation),e.availabilityTimeOffset=n.availabilityTimeOffset,e.availabilityTimeComplete=n.availabilityTimeComplete,e):new Nn},new Nn);if(!i.isRelative(t.url))return t},setConfig:function(e){e.baseURLTreeModel&&(s=e.baseURLTreeModel),e.baseURLSelector&&(a=e.baseURLSelector),e.adapter&&(t=e.adapter)}},s=Mr(n).create(),a=Br(n).create(),r.on(M.SERVICE_LOCATION_BLACKLIST_CHANGED,o,e),e}kr.__dashjs_factory_name="BaseURLController";var Gr=R.getClassFactory(kr);class Yr extends U{constructor(e,t){super(),this.url=e||null,this.type=t||null,this.mediaType=A.STREAM,this.responseType=""}}function Kr(e){e=e||{};const t=this.context,n=b(t).getInstance();let r,i=rr(t).create({errHandler:e.errHandler,dashMetrics:e.dashMetrics,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,useFetch:e.settings?e.settings.get().streaming.lowLatencyEnabled:null,errors:he});return r={load:function(e,t,r){const s=function(i,s){t.resolved=!0,t.resolvedContent=i||null,n.trigger(M.XLINK_ELEMENT_LOADED,{element:t,resolveObject:r,error:i||s?null:new G(he.XLINK_LOADER_LOADING_FAILURE_ERROR_CODE,he.XLINK_LOADER_LOADING_FAILURE_ERROR_MESSAGE+e)})};if("urn:mpeg:dash:resolve-to-zero:2013"===e)s(null,!0);else{const t=new Yr(e,F.XLINK_EXPANSION_TYPE);i.load({request:t,success:function(e){s(e)},error:function(){s(null)}})}},reset:function(){i&&(i.abort(),i=null)}},r}Kr.__dashjs_factory_name="XlinkLoader";var qr=R.getClassFactory(Kr);function Hr(e){e=e||{},function(){void 0===e.escapeMode&&(e.escapeMode=!0);void 0===e.attributePrefix&&(e.attributePrefix="_");e.arrayAccessForm=e.arrayAccessForm||"none",e.emptyNodeForm=e.emptyNodeForm||"text",void 0===e.enableToStringFunc&&(e.enableToStringFunc=!0);e.arrayAccessFormPaths=e.arrayAccessFormPaths||[],void 0===e.skipEmptyTextNodesForObj&&(e.skipEmptyTextNodesForObj=!0);void 0===e.stripWhitespaces&&(e.stripWhitespaces=!0);e.datetimeAccessFormPaths=e.datetimeAccessFormPaths||[],void 0===e.useDoubleQuotes&&(e.useDoubleQuotes=!1);e.xmlElementsFilter=e.xmlElementsFilter||[],e.jsonPropertiesFilter=e.jsonPropertiesFilter||[],void 0===e.keepCData&&(e.keepCData=!1);void 0===e.ignoreRoot&&(e.ignoreRoot=!1)}();var t=1,n=3,r=4,i=8,s=9;function a(e){var t=e.localName;return null==t&&(t=e.baseName),null!=t&&""!=t||(t=e.nodeName),t}function o(e){return"string"==typeof e?e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;"):e}function l(e,t,n,r){for(var i=0;i<e.length;i++){var s=e[i];if("string"==typeof s){if(s==r)break}else if(s instanceof RegExp){if(s.test(r))break}else if("function"==typeof s&&s(t,n,r))break}return i!=e.length}function u(t,n,r){switch(e.arrayAccessForm){case"property":t[n]instanceof Array?t[n+"_asArray"]=t[n]:t[n+"_asArray"]=[t[n]]}!(t[n]instanceof Array)&&e.arrayAccessFormPaths.length>0&&l(e.arrayAccessFormPaths,t,n,r)&&(t[n]=[t[n]])}function c(e){var t=e.split(/[-T:+Z]/g),n=new Date(t[0],t[1]-1,t[2]),r=t[5].split(".");if(n.setHours(t[3],t[4],r[0]),r.length>1&&n.setMilliseconds(r[1]),t[6]&&t[7]){var i=60*t[6]+Number(t[7]);i=0+("-"==(/\d\d-\d\d:\d\d$/.test(e)?"-":"+")?-1*i:i),n.setMinutes(n.getMinutes()-i-n.getTimezoneOffset())}else-1!==e.indexOf("Z",e.length-1)&&(n=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds())));return n}function d(n,r,i,s){return!(r==t&&e.xmlElementsFilter.length>0)||l(e.xmlElementsFilter,n,i,s)}function f(o,g){if(o.nodeType==s){for(var h=new Object,p=o.childNodes,m=0;m<p.length;m++){if((_=p[m]).nodeType==t)if(e.ignoreRoot)h=f(_);else(h={})[T=a(_)]=f(_)}return h}if(o.nodeType==t){(h=new Object).__cnt=0;var E=[];for(p=o.childNodes,m=0;m<p.length;m++){var _,T=a(_=p[m]);if(_.nodeType!=i){var y=g+"."+T;if(d(h,_.nodeType,T,y))if(h.__cnt++,null==h[T]){var A=f(_,y);if("#text"!=T||/[^\s]/.test(A))(S={})[T]=A,E.push(S);h[T]=A,u(h,T,y)}else{null!=h[T]&&(h[T]instanceof Array||(h[T]=[h[T]],u(h,T,y)));var S;A=f(_,y);if("#text"!=T||/[^\s]/.test(A))(S={})[T]=A,E.push(S);h[T][h[T].length]=A}}}h.__children=E;for(var I=a(o),R=0;R<o.attributes.length;R++){var N=o.attributes[R];h.__cnt++;for(var D=N.value,C=0,b=e.matchers.length;C<b;C++){var v=e.matchers[C];v.test(N,I)&&(D=v.converter(N.value))}h[e.attributePrefix+N.name]=D}var M=function(e){return e.prefix}(o);return null!=M&&""!=M&&(h.__cnt++,h.__prefix=M),null!=h["#text"]&&(h.__text=h["#text"],h.__text instanceof Array&&(h.__text=h.__text.join("\n")),e.stripWhitespaces&&(h.__text=h.__text.trim()),delete h["#text"],"property"==e.arrayAccessForm&&delete h["#text_asArray"],h.__text=function(t,n,r){if(e.datetimeAccessFormPaths.length>0){var i=r.split(".#")[0];return l(e.datetimeAccessFormPaths,t,n,i)?c(t):t}return t}(h.__text,T,g+"."+T)),null!=h["#cdata-section"]&&(h.__cdata=h["#cdata-section"],delete h["#cdata-section"],"property"==e.arrayAccessForm&&delete h["#cdata-section_asArray"]),0==h.__cnt&&"text"==e.emptyNodeForm?h="":1==h.__cnt&&null!=h.__text?h=h.__text:1!=h.__cnt||null==h.__cdata||e.keepCData?h.__cnt>1&&null!=h.__text&&e.skipEmptyTextNodesForObj&&(e.stripWhitespaces&&""==h.__text||""==h.__text.trim())&&delete h.__text:h=h.__cdata,delete h.__cnt,!e.enableToStringFunc||null==h.__text&&null==h.__cdata||(h.toString=function(){return(null!=this.__text?this.__text:"")+(null!=this.__cdata?this.__cdata:"")}),h}if(o.nodeType==n||o.nodeType==r)return o.nodeValue}function g(t,n,r,i){var s="<"+(null!=t&&null!=t.__prefix?t.__prefix+":":"")+n;if(null!=r)for(var a=0;a<r.length;a++){var l=r[a],u=t[l];e.escapeMode&&(u=o(u)),s+=" "+l.substr(e.attributePrefix.length)+"=",e.useDoubleQuotes?s+='"'+u+'"':s+="'"+u+"'"}return s+=i?"/>":">"}function h(e,t){return"</"+(null!=e.__prefix?e.__prefix+":":"")+t+">"}function p(t,n){return"property"==e.arrayAccessForm&&(r=n.toString(),i="_asArray",-1!==r.indexOf(i,r.length-i.length))||0==n.toString().indexOf(e.attributePrefix)||0==n.toString().indexOf("__")||t[n]instanceof Function;var r,i}function m(e){var t=0;if(e instanceof Object)for(var n in e)p(e,n)||t++;return t}function E(t,n,r){return 0==e.jsonPropertiesFilter.length||""==r||l(e.jsonPropertiesFilter,t,n,r)}function _(t){var n=[];if(t instanceof Object)for(var r in t)-1==r.toString().indexOf("__")&&0==r.toString().indexOf(e.attributePrefix)&&n.push(r);return n}function T(t){var n="";return t instanceof Object?n+=function(t){var n="";return null!=t.__cdata&&(n+="<![CDATA["+t.__cdata+"]]>"),null!=t.__text&&(e.escapeMode?n+=o(t.__text):n+=t.__text),n}(t):null!=t&&(e.escapeMode?n+=o(t):n+=t),n}function y(e,t){return""===e?t:e+"."+t}function A(e,t,n,r){var i="";if(0==e.length)i+=g(e,t,n,!0);else for(var s=0;s<e.length;s++)i+=g(e[s],t,_(e[s]),!1),i+=S(e[s],y(r,t)),i+=h(e[s],t);return i}function S(e,t){var n="";if(m(e)>0)for(var r in e)if(!p(e,r)&&(""==t||E(e,r,y(t,r)))){var i=e[r],s=_(i);if(null==i||null==i)n+=g(i,r,s,!0);else if(i instanceof Object)if(i instanceof Array)n+=A(i,r,s,t);else if(i instanceof Date)n+=g(i,r,s,!1),n+=i.toISOString(),n+=h(i,r);else{m(i)>0||null!=i.__text||null!=i.__cdata?(n+=g(i,r,s,!1),n+=S(i,y(t,r)),n+=h(i,r)):n+=g(i,r,s,!0)}else n+=g(i,r,s,!1),n+=T(i),n+=h(i,r)}return n+=T(e)}this.parseXmlString=function(e){if(void 0===e)return null;var t;if(window.DOMParser){var n=new window.DOMParser;try{(t=n.parseFromString(e,"text/xml")).getElementsByTagNameNS("*","parsererror").length>0&&(t=null)}catch(e){t=null}}else 0==e.indexOf("<?")&&(e=e.substr(e.indexOf("?>")+2)),(t=new ActiveXObject("Microsoft.XMLDOM")).async="false",t.loadXML(e);return t},this.asArray=function(e){return void 0===e||null==e?[]:e instanceof Array?e:[e]},this.toXmlDateTime=function(e){return e instanceof Date?e.toISOString():"number"==typeof e?new Date(e).toISOString():null},this.asDateTime=function(e){return"string"==typeof e?c(e):e},this.xml2json=function(e){return f(e)},this.xml_str2json=function(e){var t=this.parseXmlString(e);return null!=t?this.xml2json(t):null},this.json2xml_str=function(e){return S(e,"")},this.json2xml=function(e){var t=this.json2xml_str(e);return this.parseXmlString(t)},this.getVersion=function(){return"1.2.0"}}function Vr(e){e=e||{};let t=this.context,n=b(t).getInstance();const r=sn(t).getInstance();let i,s,a,o,l,u;function c(e,t,n){let i,s,a={};a.elements=e,a.type=t,a.resolveType=n,0===a.elements.length&&f(a);for(let e=0;e<a.elements.length;e++)i=a.elements[e],s=r.isHTTPURL(i.url)?i.url:i.originalContent.BaseURL+i.url,u.load(s,i,a)}function d(e){let t,n;let r="";if(t=e.element,n=e.resolveObject,t.resolvedContent){let e=0;0===t.resolvedContent.indexOf("<?xml")&&(e=t.resolvedContent.indexOf("?>")+2),r=t.resolvedContent.substr(0,e)+"<response>"+t.resolvedContent.substr(e)+"</response>",t.resolvedContent=l.xml_str2json(r)}(function(e){let t,n;for(t=0;t<e.elements.length;t++)if(n=e.elements[t],!1===n.resolved)return!1;return!0})(n)&&f(n)}function f(e){let t,r,i=[];if(function(e){let t,n,r,i,s,l,u=[];for(i=e.elements.length-1;i>=0;i--){if(t=e.elements[i],n=t.type+"_asArray",t.resolvedContent){if(t.resolvedContent)for(s=0;s<t.resolvedContent[n].length;s++)r=t.resolvedContent[n][s],u.push(r)}else delete t.originalContent["xlink:actuate"],delete t.originalContent["xlink:href"],u.push(t.originalContent);for(t.parentElement[n].splice(t.index,1),l=0;l<u.length;l++)t.parentElement[n].splice(t.index+l,0,u[l]);u=[]}e.elements.length>0&&a.run(o)}(e),"onActuate"===e.resolveType&&n.trigger(M.XLINK_READY,{manifest:o}),"onLoad"===e.resolveType)switch(e.type){case S.PERIOD:for(t=0;t<o[S.PERIOD+"_asArray"].length;t++)r=o[S.PERIOD+"_asArray"][t],r.hasOwnProperty(S.ADAPTATION_SET+"_asArray")&&(i=i.concat(g(r[S.ADAPTATION_SET+"_asArray"],r,S.ADAPTATION_SET,"onLoad"))),r.hasOwnProperty(S.EVENT_STREAM+"_asArray")&&(i=i.concat(g(r[S.EVENT_STREAM+"_asArray"],r,S.EVENT_STREAM,"onLoad")));c(i,S.ADAPTATION_SET,"onLoad");break;case S.ADAPTATION_SET:n.trigger(M.XLINK_READY,{manifest:o})}}function g(e,t,n,r){let i,s,a,o=[];for(s=e.length-1;s>=0;s--)i=e[s],i.hasOwnProperty("xlink:href")&&"urn:mpeg:dash:resolve-to-zero:2013"===i["xlink:href"]&&e.splice(s,1);for(s=0;s<e.length;s++)i=e[s],i.hasOwnProperty("xlink:href")&&i.hasOwnProperty("xlink:actuate")&&i["xlink:actuate"]===r&&(a=h(i["xlink:href"],t,n,s,r,i),o.push(a));return o}function h(e,t,n,r,i,s){return{url:e,parentElement:t,type:n,index:r,resolveType:i,originalContent:s,resolvedContent:null,resolved:!1}}return i={resolveManifestOnLoad:function(e){let t;l=new Hr({escapeMode:!1,attributePrefix:"",arrayAccessForm:"property",emptyNodeForm:"object",stripWhitespaces:!1,enableToStringFunc:!1,ignoreRoot:!0,matchers:s}),o=e,o.Period_asArray?(t=g(o.Period_asArray,o,S.PERIOD,"onLoad"),c(t,S.PERIOD,"onLoad")):n.trigger(M.XLINK_READY,{manifest:o})},setMatchers:function(e){e&&(s=e)},setIron:function(e){e&&(a=e)},reset:function(){n.off(M.XLINK_ELEMENT_LOADED,d,i),u&&(u.reset(),u=null)}},n.on(M.XLINK_ELEMENT_LOADED,d,i),u=qr(t).create({errHandler:e.errHandler,dashMetrics:e.dashMetrics,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,settings:e.settings}),i}Vr.__dashjs_factory_name="XlinkController";var jr=R.getClassFactory(Vr);function zr(e){function t(e,t){for(let n in e)t.hasOwnProperty(n)||(t[n]=e[n])}function n(e,n,r){for(let i=0,s=e.length;i<s;++i){const s=e[i];if(n[s.name])if(r[s.name]){if(s.merge){const e=n[s.name],i=r[s.name];"object"==typeof e&&"object"==typeof i?t(e,i):r[s.name]=e+i}}else r[s.name]=n[s.name]}}function r(e,t){for(let i=0,s=e.children.length;i<s;++i){const s=e.children[i],a=t[s.name+"_asArray"];if(a)for(let i=0,o=a.length;i<o;++i){const o=a[i];n(e.properties,t,o),r(s,o)}}}return{run:function(t){if(null===t||"object"!=typeof t)return t;if(t.Period_asArray&&"period"in e){const n=e.period,i=t.Period_asArray;for(let t=0,s=i.length;t<s;++t){const s=i[t];if(r(n,s),"adaptationset"in e){const t=s.AdaptationSet_asArray;if(t){const n=e.adaptationset;for(let e=0,i=t.length;e<i;++e)r(n,t[e])}}}}return t}}}zr.__dashjs_factory_name="ObjectIron";const Wr=R.getClassFactory(zr);class Xr{constructor(e,t){this._test=e,this._converter=t}get test(){return this._test}get converter(){return this._converter}}class Qr extends Xr{constructor(){super((e,t)=>{const n={[S.MPD]:[S.ID,S.PROFILES],[S.PERIOD]:[S.ID],[S.BASE_URL]:[S.SERVICE_LOCATION,S.BYTE_RANGE],[S.SEGMENT_BASE]:[S.INDEX_RANGE],[S.INITIALIZATION]:[S.RANGE],[S.REPRESENTATION_INDEX]:[S.RANGE],[S.SEGMENT_LIST]:[S.INDEX_RANGE],[S.BITSTREAM_SWITCHING]:[S.RANGE],[S.SEGMENT_URL]:[S.MEDIA_RANGE,S.INDEX_RANGE],[S.SEGMENT_TEMPLATE]:[S.INDEX_RANGE,S.MEDIA,S.INDEX,S.INITIALIZATION_MINUS,S.BITSTREAM_SWITCHING_MINUS],[S.ASSET_IDENTIFIER]:[S.VALUE,S.ID],[S.EVENT_STREAM]:[S.VALUE],[S.ADAPTATION_SET]:[S.PROFILES,S.MIME_TYPE,S.SEGMENT_PROFILES,S.CODECS,S.CONTENT_TYPE],[S.FRAME_PACKING]:[S.VALUE,S.ID],[S.AUDIO_CHANNEL_CONFIGURATION]:[S.VALUE,S.ID],[S.CONTENT_PROTECTION]:[S.VALUE,S.ID],[S.ESSENTIAL_PROPERTY]:[S.VALUE,S.ID],[S.SUPPLEMENTAL_PROPERTY]:[S.VALUE,S.ID],[S.INBAND_EVENT_STREAM]:[S.VALUE,S.ID],[S.ACCESSIBILITY]:[S.VALUE,S.ID],[S.ROLE]:[S.VALUE,S.ID],[S.RATING]:[S.VALUE,S.ID],[S.VIEWPOINT]:[S.VALUE,S.ID],[S.CONTENT_COMPONENT]:[S.CONTENT_TYPE],[S.REPRESENTATION]:[S.ID,S.DEPENDENCY_ID,S.MEDIA_STREAM_STRUCTURE_ID],[S.SUBSET]:[S.ID],[S.METRICS]:[S.METRICS_MINUS],[S.REPORTING]:[S.VALUE,S.ID]};if(n.hasOwnProperty(t)){let r=n[t];return void 0!==r&&r.indexOf(e.name)>=0}return!1},e=>String(e))}}const $r=/^([-])?P(([\d.]*)Y)?(([\d.]*)M)?(([\d.]*)D)?T?(([\d.]*)H)?(([\d.]*)M)?(([\d.]*)S)?/;class Zr extends Xr{constructor(){super(e=>{const t=[S.MIN_BUFFER_TIME,S.MEDIA_PRESENTATION_DURATION,S.MINIMUM_UPDATE_PERIOD,S.TIMESHIFT_BUFFER_DEPTH,S.MAX_SEGMENT_DURATION,S.MAX_SUBSEGMENT_DURATION,S.SUGGESTED_PRESENTATION_DELAY,S.START,A.START_TIME,S.DURATION],n=t.length;for(let r=0;r<n;r++)if(e.nodeName===t[r])return $r.test(e.value);return!1},e=>{const t=$r.exec(e);let n=31536e3*parseFloat(t[3]||0)+2592e3*parseFloat(t[5]||0)+86400*parseFloat(t[7]||0)+3600*parseFloat(t[9]||0)+60*parseFloat(t[11]||0)+parseFloat(t[13]||0);return void 0!==t[1]&&(n=-n),n})}}const Jr=/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2})(?::([0-9]*)(\.[0-9]*)?)?(?:([+-])([0-9]{2})(?::?)([0-9]{2}))?/;class ei extends Xr{constructor(){super(e=>Jr.test(e.value),e=>{const t=Jr.exec(e);let n;if(n=Date.UTC(parseInt(t[1],10),parseInt(t[2],10)-1,parseInt(t[3],10),parseInt(t[4],10),parseInt(t[5],10),t[6]&&parseInt(t[6],10)||0,t[7]&&1e3*parseFloat(t[7])||0),t[9]&&t[10]){const e=60*parseInt(t[9],10)+parseInt(t[10],10);n+=("+"===t[8]?-1:1)*e*60*1e3}return new Date(n)})}}const ti=/^[-+]?[0-9]+[.]?[0-9]*([eE][-+]?[0-9]+)?$/;class ni extends Xr{constructor(){super(e=>ti.test(e.value),e=>parseFloat(e))}}class ri{constructor(e){var t;this._name=e,this._merge=(t=e)&&t.length&&t.charAt(0)===t.charAt(0).toUpperCase()}get name(){return this._name}get merge(){return this._merge}}class ii{constructor(e,t,n){this._name=e||"",this._properties=[],this._children=n||[],Array.isArray(t)&&t.forEach(e=>{this._properties.push(new ri(e))})}get name(){return this._name}get children(){return this._children}get properties(){return this._properties}}class si extends ii{constructor(){const e=[S.PROFILES,S.WIDTH,S.HEIGHT,S.SAR,S.FRAMERATE,S.AUDIO_SAMPLING_RATE,S.MIME_TYPE,S.SEGMENT_PROFILES,S.CODECS,S.MAXIMUM_SAP_PERIOD,S.START_WITH_SAP,S.MAX_PLAYOUT_RATE,S.CODING_DEPENDENCY,S.SCAN_TYPE,S.FRAME_PACKING,S.AUDIO_CHANNEL_CONFIGURATION,S.CONTENT_PROTECTION,S.ESSENTIAL_PROPERTY,S.SUPPLEMENTAL_PROPERTY,S.INBAND_EVENT_STREAM];super(S.ADAPTATION_SET,e,[new ii(S.REPRESENTATION,e,[new ii(S.SUB_REPRESENTATION,e)])])}}class ai extends ii{constructor(){const e=[S.SEGMENT_BASE,S.SEGMENT_TEMPLATE,S.SEGMENT_LIST];super(S.PERIOD,e,[new ii(S.ADAPTATION_SET,e,[new ii(S.REPRESENTATION,e)])])}}function oi(e){e=e||{};const t=this.context,n=e.debug;let r,i,s,a,o;return r={parse:function(e){let t;const n=window.performance.now();if(t=a.xml_str2json(e),!t)throw new Error("parsing the manifest failed");const r=window.performance.now();t.Patch?(t=t.Patch,t.add_asArray&&t.add_asArray.forEach(e=>o.run(e)),t.replace_asArray&&t.replace_asArray.forEach(e=>o.run(e))):(t=t.MPD,o.run(t));const s=window.performance.now();return i.info("Parsing complete: ( xml2json: "+(r-n).toPrecision(3)+"ms, objectiron: "+(s-r).toPrecision(3)+"ms, total: "+((s-n)/1e3).toPrecision(3)+"s)"),t.protocol="DASH",t},getMatchers:function(){return s},getIron:function(){return o}},i=n.getLogger(r),s=[new Zr,new ei,new ni,new Qr],a=new Hr({escapeMode:!1,attributePrefix:"",arrayAccessForm:"property",emptyNodeForm:"object",stripWhitespaces:!1,enableToStringFunc:!0,ignoreRoot:!1,matchers:s}),o=Wr(t).create({adaptationset:new si,period:new ai}),r}oi.__dashjs_factory_name="DashParser";var li=R.getClassFactory(oi);function ui(e){e=e||{};const t=this.context,n=e.debug,r=b(t).getInstance(),i=sn(t).getInstance();let s,a,o,l,u,c=e.mssHandler,d=e.errHandler;function f(e){r.trigger(M.INTERNAL_MANIFEST_LOADED,{manifest:e.manifest})}return s={load:function(e){const s=new Yr(e,F.MPD_TYPE);o.load({request:s,success:function(s,o,d){if(!l)return;let f,g,h;if(d&&d!==e?(g=i.parseBaseUrl(d),f=d):(i.isRelative(e)&&(e=i.resolve(e,window.location.href)),g=i.parseBaseUrl(e)),"No Content"!=o)if(null===u&&(u=function(e){let r=null;return e.indexOf("SmoothStreamingMedia")>-1?(c&&(r=c.createMssParser(),c.registerEvents()),r):e.indexOf("MPD")>-1||e.indexOf("Patch")>-1?li(t).create({debug:n}):r}(s)),null!==u){l.setMatchers(u.getMatchers()),l.setIron(u.getIron());try{h=u.parse(s)}catch(t){return void r.trigger(M.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new G(he.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE,he.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE+""+e)})}h?(h.url=f||e,h.originalUrl||(h.originalUrl=h.url),h.hasOwnProperty(A.LOCATION)&&(g=i.parseBaseUrl(h.Location_asArray[0]),a.debug("BaseURI set by Location to: "+g)),h.baseUri=g,h.loadedTime=new Date,l.resolveManifestOnLoad(h),r.trigger(M.ORIGINAL_MANIFEST_LOADED,{originalManifest:s})):r.trigger(M.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new G(he.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE,he.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE+""+e)})}else r.trigger(M.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new G(he.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE,he.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE+""+e)});else r.trigger(M.INTERNAL_MANIFEST_LOADED,{manifest:null})},error:function(t,n,i){r.trigger(M.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new G(he.MANIFEST_LOADER_LOADING_FAILURE_ERROR_CODE,he.MANIFEST_LOADER_LOADING_FAILURE_ERROR_MESSAGE+`${e}, ${i}`)})}})},reset:function(){r.off(M.XLINK_READY,f,s),l&&(l.reset(),l=null),o&&(o.abort(),o=null),c&&c.reset()}},a=n.getLogger(s),r.on(M.XLINK_READY,f,s),o=rr(t).create({errHandler:e.errHandler,dashMetrics:e.dashMetrics,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,useFetch:e.settings.get().streaming.lowLatencyEnabled,urlUtils:i,constants:A,dashConstants:S,errors:he}),l=jr(t).create({errHandler:d,dashMetrics:e.dashMetrics,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,settings:e.settings}),u=null,s}ui.__dashjs_factory_name="ManifestLoader";const ci=R.getClassFactory(ui);function di(){let e;const t=this.context,n=b(t).getInstance();return e={error:function(e){n.trigger(M.ERROR,{error:e})}},e}di.__dashjs_factory_name="ErrorHandler";var fi=R.getSingletonFactory(di);const gi=[{codec:"avc1",compatibleCodecs:["avc3"]},{codec:"avc3",compatibleCodecs:["avc1"]}];function hi(){let e="WebKitMediaSource"in window,t="MediaSource"in window;return e||t}function pi(){let e,t;return e={supportsMediaSource:hi,supportsEncryptedMedia:function(){return t},supportsCodec:function(e){return!(!("MediaSource"in window)||!MediaSource.isTypeSupported(e))||!(!("WebKitMediaSource"in window)||!WebKitMediaSource.isTypeSupported(e))},setEncryptedMediaSupported:function(e){t=e},supportsEssentialProperty:function(e){try{return-1!==Ln.indexOf(e.schemeIdUri)}catch(e){return!0}},codecRootCompatibleWithCodec:function(e,t){const n=e.split(".")[0],r=0===t.indexOf(n);let i;for(let e=0;e<gi.length;e++)if(gi[e].codec===n){i=gi[e];break}return i?r||i.compatibleCodecs.some(e=>0===t.indexOf(e)):r}},t=!1,e}pi.__dashjs_factory_name="Capabilities";var mi=R.getSingletonFactory(pi);function Ei(){const e=this.context;let t,n,r,i,s;function a(e,t){const i=n.getRealPeriodByIndex(t?t.index:null);i&&i.AdaptationSet_asArray&&0!==i.AdaptationSet_asArray.length&&(i.AdaptationSet_asArray=i.AdaptationSet_asArray.filter(t=>!t.Representation_asArray||0===t.Representation_asArray.length||!n.getIsTypeOf(t,e)||(t.Representation_asArray=t.Representation_asArray.filter((e,i)=>{const a=n.getCodec(t,i,!0);return!!r.supportsCodec(a)||(s.error("[Stream] codec not supported: "+a),!1)}),t.Representation_asArray&&t.Representation_asArray.length>0)))}return t={setConfig:function(e){e&&(e.adapter&&(n=e.adapter),e.capabilities&&(r=e.capabilities),e.settings&&(i=e.settings))},filterUnsupportedFeaturesOfPeriod:function(e){a(A.VIDEO,e),a(A.AUDIO,e),i.get().streaming.filterUnsupportedEssentialProperties&&function(e){const t=n.getRealPeriodByIndex(e?e.index:null);if(!t||!t.AdaptationSet_asArray||0===t.AdaptationSet_asArray.length)return;t.AdaptationSet_asArray=t.AdaptationSet_asArray.filter(e=>!e.Representation_asArray||0===e.Representation_asArray.length||(e.Representation_asArray=e.Representation_asArray.filter(e=>{const t=n.getEssentialPropertiesForRepresentation(e);if(t&&t.length>0){let e=0;for(;e<t.length;){if(!r.supportsEssentialProperty(t[e]))return s.debug("[Stream] EssentialProperty not supported: "+t[e].schemeIdUri),!1;e+=1}}return!0}),e.Representation_asArray&&e.Representation_asArray.length>0))}(e)}},s=w(e).getInstance().getLogger(t),t}Ei.__dashjs_factory_name="CapabilitiesFilter";var _i=R.getSingletonFactory(Ei);class Ti{constructor(){this.t=null,this.xywh=null,this.track=null,this.id=null,this.s=null,this.r=null}}function yi(){let e,t;return e={initialize:function(e){if(t=new Ti,!e)return null;const n=e.indexOf("#");if(-1!==n){const r=e.substr(n+1).split("&");for(let e=0,n=r.length;e<n;++e){const n=r[e],i=n.indexOf("=");if(-1!==i){const e=n.substring(0,i);t.hasOwnProperty(e)&&(t[e]=n.substr(i+1))}}}},getURIFragmentData:function(){return t}},e}yi.__dashjs_factory_name="URIFragmentModel";var Ai=R.getSingletonFactory(yi);function Si(){let e,t,n=this.context,r=b(n).getInstance();return e={getValue:function(){return t},setValue:function(e){t=e,e&&r.trigger(M.MANIFEST_LOADED,{data:e})}},e}Si.__dashjs_factory_name="ManifestModel";var Ii=R.getSingletonFactory(Si);function Ri(){let e,t,n,r;const i=this.context,s=pn(i).getInstance();function a(e){let t;for(t=0;t<r.length;t++)if(r[t].rulename===e)return t;return-1}function o(){return s.get().streaming.lowLatencyEnabled?s.get().streaming.liveDelay||3:s.get().streaming.liveDelay}function l(e,n){u(e,n);let r=new In;r.schemeIdUri=e,r.value=n,t.push(r)}function u(e,n){X(e,"string"),X(n,"string"),t.forEach((function(r,i){r.schemeIdUri===e&&r.value===n&&t.splice(i,1)}))}return e={getABRCustomRules:function(){return r},addABRCustomRule:function(e,t,n){if("string"!=typeof e||e!==it.ABANDON_FRAGMENT_RULES&&e!==it.QUALITY_SWITCH_RULES||"string"!=typeof t)throw A.BAD_ARGUMENT_ERROR;let i=a(t);-1===i?r.push({type:e,rulename:t,rule:n}):(r[i].type=e,r[i].rule=n)},removeABRCustomRule:function(e){if(e){let t=a(e);-1!==t&&r.splice(t,1)}else r=[]},getStableBufferTime:function(){if(s.get().streaming.lowLatencyEnabled)return.6*o();const e=s.get().streaming.stableBufferTime;return e>-1?e:s.get().streaming.fastSwitchEnabled?20:12},getRetryAttemptsForType:function(e){const t=isNaN(s.get().streaming.retryAttempts.lowLatencyMultiplyFactor)?5:s.get().streaming.retryAttempts.lowLatencyMultiplyFactor;return s.get().streaming.lowLatencyEnabled?s.get().streaming.retryAttempts[e]*t:s.get().streaming.retryAttempts[e]},getRetryIntervalsForType:function(e){const t=isNaN(s.get().streaming.retryIntervals.lowLatencyReductionFactor)?10:s.get().streaming.retryIntervals.lowLatencyReductionFactor;return s.get().streaming.lowLatencyEnabled?s.get().streaming.retryIntervals[e]/t:s.get().streaming.retryIntervals[e]},getLiveDelay:o,getLiveCatchupLatencyThreshold:function(){try{const e=s.get().streaming.liveCatchup.latencyThreshold,t=o();if(null!==e&&!isNaN(e))return Math.max(e,t);const n=s.get().streaming.liveCatchup.minDrift,r=!isNaN(t)&&t?isNaN(n)?o():s.get().streaming.liveCatchup.minDrift+o():NaN;return r&&!isNaN(r)?Math.max(4*r,5):NaN}catch(e){return NaN}},addUTCTimingSource:l,removeUTCTimingSource:u,getUTCTimingSources:function(){return t},clearDefaultUTCTimingSources:function(){t=[]},restoreDefaultUTCTimingSources:function(){let e=s.get().streaming.utcSynchronization.defaultTimingSource;l(e.scheme,e.value)},setXHRWithCredentialsForType:function e(t,r){t?n[t]=!!r:Object.keys(n).forEach(t=>{e(t,r)})},getXHRWithCredentialsForType:function(e){const t=n[e];return void 0===t?n.default:t},getDefaultUtcTimingSource:function(){return s.get().streaming.utcSynchronization.defaultTimingSource},reset:function(){}},t=[],n={default:!1},r=[],e}Ri.__dashjs_factory_name="MediaPlayerModel";var Ni=R.getSingletonFactory(Ri);function Di(){let e,t,n,r,i;const s=this.context,a=b(s).getInstance(),o=[];function l(){n&&(n.playbackRate=i||1,n.removeEventListener("canplay",l))}function u(e){n&&(n.readyState<=2&&e>0?n.addEventListener("canplay",l):n.playbackRate=e)}function c(){return o.length>0}function d(e){let t,r=o.indexOf(e);null!==e&&(-1!==r&&o.splice(r,1),n&&!1===c()&&0===n.playbackRate&&(u(i||1),n.paused||(t=document.createEvent("Event"),t.initEvent("playing",!0,!1),n.dispatchEvent(t))))}function f(){if(n&&c()&&0===n.playbackRate){const e=document.createEvent("Event");e.initEvent("waiting",!0,!1),n.dispatchEvent(e)}}function g(){return n?n.buffered:null}function h(e,t,r,i,s){if(n)for(let a=0;a<n.textTracks.length;a++)if(n.textTracks[a].kind===e&&(!t||n.textTracks[a].label==t)&&n.textTracks[a].language===r&&n.textTracks[a].isTTML===i&&n.textTracks[a].isEmbedded===s)return n.textTracks[a];return null}return e={initialize:function(){a.on(M.PLAYBACK_PLAYING,f,this)},setCurrentTime:function(e,t){if(n){if(n.currentTime==e)return;try{e=t?function(e){const t=g();let n=e,r=9999999999;if(t)for(let i=0;i<t.length;i++){const s=t.start(i),a=t.end(i),o=Math.abs(s-e),l=Math.abs(a-e);if(e>=s&&e<=a)return e;o<r&&(r=o,n=s),l<r&&(r=l,n=a)}return n}(e):e,n.currentTime=e}catch(t){0===n.readyState&&t.code===t.INVALID_STATE_ERR&&setTimeout((function(){n.currentTime=e}),400)}}},play:function(){if(n){n.autoplay=!0;const e=n.play();e&&e.catch&&"undefined"!=typeof Promise&&e.catch(e=>{"NotAllowedError"===e.name&&a.trigger(M.PLAYBACK_NOT_ALLOWED),t.warn(`Caught pending play exception - continuing (${e})`)})}},isPaused:function(){return n?n.paused:null},pause:function(){n&&(n.pause(),n.autoplay=!1)},isStalled:c,isSeeking:function(){return n?n.seeking:null},getTime:function(){return n?n.currentTime:null},getPlaybackRate:function(){return n?n.playbackRate:null},setPlaybackRate:u,getPlayedRanges:function(){return n?n.played:null},getEnded:function(){return n?n.ended:null},setStallState:function(e,t){!function(e,t){t?function(e){let t;if(null===e||!n||n.seeking||-1!==o.indexOf(e))return;o.push(e),n&&1===o.length&&(t=document.createEvent("Event"),t.initEvent("waiting",!0,!1),i=n.playbackRate,u(0),n.dispatchEvent(t))}(e):d(e)}(e,t)},getElement:function(){return n},setElement:function(e){if(!(null==e||e&&/^(VIDEO|AUDIO)$/i.test(e.nodeName)))throw"element is not video or audio DOM type!";n=e,n&&(n.preload="auto")},setSource:function(e){n&&(e?n.src=e:(n.removeAttribute("src"),n.load()))},getSource:function(){return n?n.src:null},getTTMLRenderingDiv:function(){return r},setTTMLRenderingDiv:function(e){r=e,r.style.position="absolute",r.style.display="flex",r.style.overflow="hidden",r.style.pointerEvents="none",r.style.top=0,r.style.left=0},getPlaybackQuality:function(){if(!n)return null;let e="webkitDroppedFrameCount"in n&&"webkitDecodedFrameCount"in n,t=null;return"getVideoPlaybackQuality"in n?t=n.getVideoPlaybackQuality():e&&(t={droppedVideoFrames:n.webkitDroppedFrameCount,totalVideoFrames:n.webkitDroppedFrameCount+n.webkitDecodedFrameCount,creationTime:new Date}),t},addEventListener:function(e,t){n&&n.addEventListener(e,t)},removeEventListener:function(e,t){n&&n.removeEventListener(e,t)},getReadyState:function(){return n?n.readyState:NaN},getBufferRange:g,getClientWidth:function(){return n?n.clientWidth:NaN},getClientHeight:function(){return n?n.clientHeight:NaN},getTextTracks:function(){return n?n.textTracks:[]},getTextTrack:h,addTextTrack:function(e,t,r,i,s){if(!n)return null;let a=h(e,t,r,i,s);return a||(a=n.addTextTrack(e,t,r),a.isEmbedded=s,a.isTTML=i),a},appendChild:function(e){n&&(n.appendChild(e),void 0!==e.isTTML&&(n.textTracks[n.textTracks.length-1].isTTML=e.isTTML,n.textTracks[n.textTracks.length-1].isEmbedded=e.isEmbedded))},removeChild:function(e){n&&n.removeChild(e)},getVideoWidth:function(){return n?n.videoWidth:NaN},getVideoHeight:function(){return n?n.videoHeight:NaN},getVideoRelativeOffsetTop:function(){const e=n.parentNode.host||n.parentNode;return e?n.getBoundingClientRect().top-e.getBoundingClientRect().top:NaN},getVideoRelativeOffsetLeft:function(){const e=n.parentNode.host||n.parentNode;return e?n.getBoundingClientRect().left-e.getBoundingClientRect().left:NaN},reset:function(){a.off(M.PLAYBACK_PLAYING,f,this)}},t=w(s).getInstance().getLogger(e),e}Di.__dashjs_factory_name="VideoModel";var Ci=R.getSingletonFactory(Di);const bi=[{oldKey:"dashjs_vbitrate",newKey:"dashjs_video_bitrate"},{oldKey:"dashjs_abitrate",newKey:"dashjs_audio_bitrate"},{oldKey:"dashjs_vsettings",newKey:"dashjs_video_settings"},{oldKey:"dashjs_asettings",newKey:"dashjs_audio_settings"}];function vi(e){e=e||{};const t=this.context,n=e.settings;let r,i,s;function a(e){if(void 0!==s)return s;s=!1;let t;try{"undefined"!=typeof window&&(t=window[e])}catch(e){return i.warn("DOMStorage access denied: "+e.message),s}if(!t||"localStorage"!==e&&"sessionStorage"!==e)return s;try{t.setItem("1","1"),t.removeItem("1"),s=!0}catch(e){i.warn("DOMStorage is supported, but cannot be used: "+e.message)}return s}function o(){return 6e5*Math.round((new Date).getTime()/6e5)}function l(e,t){return a(e)&&n.get().streaming[t+"CachingInfo"].enabled}function u(){if(!n)throw new Error(A.MISSING_CONFIG_ERROR)}return r={getSavedBitrateSettings:function(e){let t=NaN;if(u(),l("localStorage","lastBitrate")){const r="dashjs_?_bitrate".replace(/\?/,e);try{const s=JSON.parse(localStorage.getItem(r))||{},a=(new Date).getTime()-parseInt(s.timestamp,10)>=n.get().streaming.lastBitrateCachingInfo.ttl||!1,o=parseFloat(s.bitrate);isNaN(o)||a?a&&localStorage.removeItem(r):(t=o,i.debug("Last saved bitrate for "+e+" was "+o))}catch(e){return null}}return t},setSavedBitrateSettings:function(e,t){if(l("localStorage","lastBitrate")&&t){const n="dashjs_?_bitrate".replace(/\?/,e);try{localStorage.setItem(n,JSON.stringify({bitrate:t.toFixed(3),timestamp:o()}))}catch(e){i.error(e.message)}}},getSavedMediaSettings:function(e){let t=null;if(u(),l("localStorage","lastMediaSettings")){const r="dashjs_?_settings".replace(/\?/,e);try{const e=JSON.parse(localStorage.getItem(r))||{},i=(new Date).getTime()-parseInt(e.timestamp,10)>=n.get().streaming.lastMediaSettingsCachingInfo.ttl||!1;t=e.settings,i&&(localStorage.removeItem(r),t=null)}catch(e){return null}}return t},setSavedMediaSettings:function(e,t){if(l("localStorage","lastMediaSettings")){const n="dashjs_?_settings".replace(/\?/,e);try{localStorage.setItem(n,JSON.stringify({settings:t,timestamp:o()}))}catch(e){i.error(e.message)}}}},i=w(t).getInstance().getLogger(r),a("localStorage")&&bi.forEach(e=>{const t=localStorage.getItem(e.oldKey);if(t){localStorage.removeItem(e.oldKey);try{localStorage.setItem(e.newKey,t)}catch(e){i.error(e.message)}}}),r}vi.__dashjs_factory_name="DOMStorage";const Mi=R.getSingletonFactory(vi);function Oi(){const e=this.context;let t,n,r,i,s,a,o,l,u,c,d,f,g,h,p,m;function E(){if(!m||!m.hasOwnProperty("resolve"))throw new Error("setConfig function has to be called previously")}function _(e){if(!e.url)return;const t=new U;return t.setInfo(e),t}function T(e,t,n,r){d.trigger(c.SEGMENTS_LOADED,{segments:n,representation:r,error:n?void 0:new G(f.SEGMENT_BASE_LOADER_ERROR_CODE,f.SEGMENT_BASE_LOADER_ERROR_MESSAGE)},{streamId:e,mediaType:t})}return t={setConfig:function(e){e.baseURLController&&(m=e.baseURLController),e.dashMetrics&&(a=e.dashMetrics),e.mediaPlayerModel&&(l=e.mediaPlayerModel),e.errHandler&&(r=e.errHandler),e.settings&&(o=e.settings),e.boxParser&&(i=e.boxParser),e.events&&(c=e.events),e.eventBus&&(d=e.eventBus),e.debug&&(n=e.debug.getLogger(t)),e.requestModifier&&(s=e.requestModifier),e.errors&&(f=e.errors),e.urlUtils&&(p=e.urlUtils),e.constants&&(g=e.constants),e.dashConstants&&(h=e.dashConstants)},initialize:function(){u=rr(e).create({errHandler:r,dashMetrics:a,mediaPlayerModel:l,requestModifier:s,useFetch:o?o.get().streaming.lowLatencyEnabled:null,boxParser:i,errors:f,urlUtils:p,constants:g,dashConstants:h})},loadInitialization:function e(t,r,s,a){E();let o=null;const l=s?m.resolve(s.path):null,f=a||{init:!0,url:l?l.url:void 0,range:{start:0,end:1500},searching:!1,bytesLoaded:0,bytesToLoad:1500,mediaType:r};n.debug("Start searching for initialization.");const g=_(f);u.load({request:g,success:function(n){f.bytesLoaded=f.range.end,o=i.findInitRange(n),o?(s.range=o,d.trigger(c.INITIALIZATION_LOADED,{representation:s},{streamId:t,mediaType:r})):(f.range.end=f.bytesLoaded+f.bytesToLoad,e(t,r,s,f))},error:function(){d.trigger(c.INITIALIZATION_LOADED,{representation:s},{streamId:t,mediaType:r})}}),n.debug("Perform init search: "+f.url)},loadSegments:function e(t,r,s,a,o,l){if(E(),a&&(void 0===a.start||void 0===a.end)){const e=a?a.toString().split("-"):null;a=e?{start:parseFloat(e[0]),end:parseFloat(e[1])}:null}o=o||T;let c=null,d=null;const f=!!a,g=s?m.resolve(s.path):null,h={init:!1,url:g?g.url:void 0,range:f?a:{start:0,end:1500},searching:!f,bytesLoaded:l?l.bytesLoaded:0,bytesToLoad:1500,mediaType:r},p=_(h);u.load({request:p,success:function(a){const l=h.bytesToLoad,u=a.byteLength;if(h.bytesLoaded=h.range.end-h.range.start,c=i.parse(a),d=c.getBox("sidx"),d&&d.isComplete){const i=d.references;let a,l;if(null!=i&&i.length>0&&(a=1===i[0].reference_type),a){let a,l,u,c,f;n.debug("Initiate multiple SIDX load."),h.range.end=h.range.start+d.size;let g=[],p=0,m=(d.offset||h.range.start)+d.size;const E=function(e,t,n){n?(g=g.concat(n),p++,p>=l&&(g.sort((function(e,t){return e.startTime-t.startTime<0?-1:0})),o(e,t,g,s))):o(e,t,null,s)};for(a=0,l=i.length;a<l;a++)u=m,c=m+i[a].referenced_size-1,m+=i[a].referenced_size,f={start:u,end:c},e(t,r,s,f,E,h)}else n.debug("Parsing segments from SIDX. representation "+r+" - id: "+s.id+" for range : "+h.range.start+" - "+h.range.end),l=function(e,t){const n=e.references,r=n.length,i=e.timescale;let s=e.earliest_presentation_time,a=t.range.start+e.offset+e.first_offset+e.size;const o=[];let l,u,c,d;for(let e=0;e<r;e++)c=n[e].subsegment_duration,d=n[e].referenced_size,l=new wt,l.duration=c,l.startTime=s,l.timescale=i,u=a+d-1,l.mediaRange=a+"-"+u,o.push(l),s+=c,a+=d;return o}(d,h),o(t,r,l,s)}else{if(d)h.range.start=d.offset||h.range.start,h.range.end=h.range.start+(d.size||l);else{if(u<h.bytesLoaded)return void o(t,r,null,s);{const e=c.getLastBox();e&&e.size?(h.range.start=e.offset+e.size,h.range.end=h.range.start+l):h.range.end+=l}}e(t,r,s,h.range,o,h)}},error:function(){o(t,r,null,s)}}),n.debug("Perform SIDX load: "+h.url+" with range : "+h.range.start+" - "+h.range.end)},reset:function(){u.abort(),u=null,r=null,i=null,s=null}},t}Oi.__dashjs_factory_name="SegmentBaseLoader";var wi=R.getSingletonFactory(Oi);function Li(e){let t;e=e||{};let n=new DataView(e.data),r=0;function i(e,t){let i,s,a=!0,o=0;if(void 0===t&&(t=!1),e.tag>16777215?(n.getUint32(r)!==e.tag&&(a=!1),o=4):e.tag>65535?(i=n.getUint16(r),s=n.getUint8(r+2),256*i+s!==e.tag&&(a=!1),o=3):e.tag>255?(n.getUint16(r)!==e.tag&&(a=!1),o=2):(n.getUint8(r)!==e.tag&&(a=!1),o=1),!a&&e.required&&!t)throw new Error("required tag not found");return a&&(r+=o),a}function s(e){let t=1,i=128,s=-1,a=0,o=n.getUint8(r),l=0;for(l=0;l<8;l+=1){if((o&i)===i){a=void 0===e?o&~i:o,s=l;break}i>>=1}for(l=0;l<s;l+=1,t+=1)a=a<<8|255&n.getUint8(r+t);return r+=t,a}return t={getPos:function(){return r},setPos:function(e){r=e},consumeTag:i,consumeTagAndSize:function(e,t){let n=i(e,t);return n&&s(),n},parseTag:function(e){let n;return i(e),n=s(),t[e.parse](n)},skipOverElement:function(e,t){let n,a=i(e,t);return a&&(n=s(),r+=n),a},getMatroskaCodedNum:s,getMatroskaFloat:function(e){let t;switch(e){case 4:t=n.getFloat32(r),r+=4;break;case 8:t=n.getFloat64(r),r+=8}return t},getMatroskaUint:function(e){let t=0;for(let i=0;i<e;i+=1)t<<=8,t|=255&n.getUint8(r+i);return r+=e,t},moreData:function(){return r<n.byteLength}},t}Li.__dashjs_factory_name="EBMLParser";var Pi=R.getClassFactory(Li);function Fi(){const e=this.context;let t,n,r,i,s,a,o,l,u,c,d,f,g;function h(t,i,s,a){let o,l,u,c,d,f,g,h;for(l=function(t){let n,i,s=[],a=Pi(e).create({data:t});for(a.consumeTagAndSize(r.Segment.Cues);a.moreData()&&a.consumeTagAndSize(r.Segment.Cues.CuePoint,!0);){for(n={},n.CueTime=a.parseTag(r.Segment.Cues.CuePoint.CueTime),n.CueTracks=[];a.moreData()&&a.consumeTag(r.Segment.Cues.CuePoint.CueTrackPositions,!0);){const e=a.getMatroskaCodedNum(),t=a.getPos();if(i={},i.Track=a.parseTag(r.Segment.Cues.CuePoint.CueTrackPositions.CueTrack),0===i.Track)throw new Error("Cue track cannot be 0");i.ClusterPosition=a.parseTag(r.Segment.Cues.CuePoint.CueTrackPositions.CueClusterPosition),n.CueTracks.push(i),a.setPos(t+e)}if(0===n.CueTracks.length)throw new Error("Mandatory cuetrack not found");s.push(n)}if(0===s.length)throw new Error("mandatory cuepoint not found");return s}(t),u=[],d=0,f=l.length;d<f;d+=1)c=new wt,o=0,o=d<l.length-1?l[d+1].CueTime-l[d].CueTime:a-l[d].CueTime,c.duration=o,c.startTime=l[d].CueTime,c.timescale=1e3,g=l[d].CueTracks[0].ClusterPosition+i,h=d<l.length-1?l[d+1].CueTracks[0].ClusterPosition+i-1:s-1,c.mediaRange=g+"-"+h,u.push(c);return n.debug("Parsed cues: "+u.length+" cues."),u}function p(){if(!g||!g.hasOwnProperty("resolve"))throw new Error("setConfig function has to be called previously")}function m(e,t,n,r){c.trigger(d.SEGMENTS_LOADED,{segments:n,representation:r,error:n?void 0:new G(f.SEGMENT_BASE_LOADER_ERROR_CODE,f.SEGMENT_BASE_LOADER_ERROR_MESSAGE)},{streamId:e,mediaType:t})}function E(e){const t=new U;return t.setInfo(e),t}return t={setConfig:function(e){if(!(e.baseURLController&&e.dashMetrics&&e.mediaPlayerModel&&e.errHandler))throw new Error(A.MISSING_CONFIG_ERROR);g=e.baseURLController,a=e.dashMetrics,o=e.mediaPlayerModel,i=e.errHandler,u=e.settings,d=e.events,c=e.eventBus,f=e.errors,n=e.debug.getLogger(t),s=e.requestModifier},initialize:function(){l=rr(e).create({errHandler:i,dashMetrics:a,mediaPlayerModel:o,requestModifier:s,useFetch:u?u.get().streaming.lowLatencyEnabled:null,errors:f})},loadInitialization:function(e,t,r,i){p();let s=null,a=r?g.resolve(r.path):null,o=r?r.range.split("-"):null,u=i||{range:{start:o?parseFloat(o[0]):null,end:o?parseFloat(o[1]):null},request:s,url:a?a.url:void 0,init:!0,mediaType:t};n.info("Start loading initialization."),s=E(u),l.load({request:s,success:function(){c.trigger(d.INITIALIZATION_LOADED,{representation:r},{streamId:e,mediaType:t})},error:function(){c.trigger(d.INITIALIZATION_LOADED,{representation:r},{streamId:e,mediaType:t})}}),n.debug("Perform init load: "+u.url)},loadSegments:function(t,i,s,a,o){p();let u=null,c=s?g.resolve(s.path):null,d=c?c.url:void 0;o=o||m,u=E({bytesLoaded:0,bytesToLoad:8192,range:{start:0,end:8192},request:u,url:d,init:!1,mediaType:i}),n.debug("Parsing ebml header"),l.load({request:u,success:function(u){!function(t,i,s,a){if(!t||0===t.byteLength)return void a(null);let o,u,c,d,f=Pi(e).create({data:t}),g=s?s.split("-"):null,p=null,m={url:i,range:{start:g?parseFloat(g[0]):null,end:g?parseFloat(g[1]):null},request:p};for(n.debug("Parse EBML header: "+m.url),f.skipOverElement(r.EBML),f.consumeTag(r.Segment),c=f.getMatroskaCodedNum(),c+=f.getPos(),d=f.getPos();f.moreData()&&!f.consumeTagAndSize(r.Segment.Info,!0);)if(!(f.skipOverElement(r.Segment.SeekHead,!0)||f.skipOverElement(r.Segment.Tracks,!0)||f.skipOverElement(r.Segment.Cues,!0)||f.skipOverElement(r.Void,!0)))throw new Error("no valid top level element found");for(;void 0===o;){let e=f.getMatroskaCodedNum(!0),t=f.getMatroskaCodedNum();switch(e){case r.Segment.Info.Duration.tag:o=f[r.Segment.Info.Duration.parse](t);break;default:f.setPos(f.getPos()+t)}}p=E(m),l.load({request:p,success:function(e){u=h(e,d,c,o),a(u)},error:function(){n.error("Download Error: Cues "+m.url),a(null)}}),n.debug("Perform cues load: "+m.url+" bytes="+m.range.start+"-"+m.range.end)}(u,d,a,(function(e){o(t,i,e,s)}))},error:function(){o(t,i,null,s)}})},reset:function(){i=null,s=null}},r={EBML:{tag:440786851,required:!0},Segment:{tag:408125543,required:!0,SeekHead:{tag:290298740,required:!0},Info:{tag:357149030,required:!0,TimecodeScale:{tag:2807729,required:!0,parse:"getMatroskaUint"},Duration:{tag:17545,required:!0,parse:"getMatroskaFloat"}},Tracks:{tag:374648427,required:!0},Cues:{tag:475249515,required:!0,CuePoint:{tag:187,required:!0,CueTime:{tag:179,required:!0,parse:"getMatroskaUint"},CueTrackPositions:{tag:183,required:!0,CueTrack:{tag:247,required:!0,parse:"getMatroskaUint"},CueClusterPosition:{tag:241,required:!0,parse:"getMatroskaUint"}}}}},Void:{tag:236,required:!0}},t}Fi.__dashjs_factory_name="WebmSegmentBaseLoader";var xi=R.getSingletonFactory(Fi);function Ui(e){e=e||{};const t=this.context,n=e.eventBus,r=e.events,i=e.dashMetrics,s=e.mediaPlayerModel,a=e.errHandler,o=e.baseURLController,l=e.debug,u=e.boxParser,c=e.requestModifier,d=e.errors;let f,g,h;function p(e){return"webm"===(e?e.split("/")[1]:"").toLowerCase()}function m(e){p(e.mimeType)?h.loadInitialization(e.streamId,e.mediaType,e.representation):g.loadInitialization(e.streamId,e.mediaType,e.representation)}function E(e){p(e.mimeType)?h.loadSegments(e.streamId,e.mediaType,e.representation,e.representation?e.representation.indexRange:null,e.callback):g.loadSegments(e.streamId,e.mediaType,e.representation,e.representation?e.representation.indexRange:null,e.callback)}return f={initialize:function(){n.on(r.SEGMENTBASE_INIT_REQUEST_NEEDED,m,f),n.on(r.SEGMENTBASE_SEGMENTSLIST_REQUEST_NEEDED,E,f),g.initialize(),h.initialize()},reset:function(){n.off(r.SEGMENTBASE_INIT_REQUEST_NEEDED,m,f),n.off(r.SEGMENTBASE_SEGMENTSLIST_REQUEST_NEEDED,E,f)}},g=wi(t).getInstance(),h=xi(t).getInstance(),g.setConfig({baseURLController:o,dashMetrics:i,mediaPlayerModel:s,errHandler:a,eventBus:n,events:r,errors:d,debug:l,boxParser:u,requestModifier:c}),h.setConfig({baseURLController:o,dashMetrics:i,mediaPlayerModel:s,errHandler:a,eventBus:n,events:r,errors:d,debug:l,requestModifier:c}),f}Ui.__dashjs_factory_name="SegmentBaseController";const Bi=R.getSingletonFactory(Ui);class ki{constructor(){this.id=null,this.quality=null,this.DVRWindow=null,this.fragmentDuration=null,this.mediaInfo=null,this.MSETimeOffset=null}}class Gi{constructor(){this.id=null,this.index=null,this.type=null,this.streamInfo=null,this.representationCount=0,this.lang=null,this.viewpoint=null,this.accessibility=null,this.audioChannelConfiguration=null,this.roles=null,this.codec=null,this.mimeType=null,this.contentProtection=null,this.isText=!1,this.KID=null,this.bitrateList=null}}class Yi{constructor(){this.id=null,this.index=null,this.start=NaN,this.duration=NaN,this.manifestInfo=null,this.isLast=!0}}class Ki{constructor(){this.DVRWindowSize=NaN,this.loadedTime=null,this.availableFrom=null,this.minBufferTime=NaN,this.duration=NaN,this.isDynamic=!1,this.maxFragmentDuration=null}}class qi{constructor(e){this.valid="/"==e[0],this.path=e.split("/").filter(e=>0!==e.length).map(e=>{let t={name:e},n=e.indexOf("[");if(-1!=n){t.name=e.substring(0,n);let r=e.substring(n+1,e.length-1);this.valid=this.valid&&-1==r.indexOf("[");let i=r.indexOf("=");-1!=i?(t.attribute={name:r.substring(1,i),value:r.substring(i+1)},-1!=["'",'"'].indexOf(t.attribute.value[0])&&(t.attribute.value=t.attribute.value.substring(1,t.attribute.value.length-1))):t.position=parseInt(r,10)-1}return t})}isValid(){return this.valid}findsElement(){return!this.findsAttribute()}findsAttribute(){return this.path[this.path.length-1].name.startsWith("@")}getMpdTarget(e,t){let n=null,r=e,i=1,s="MPD";for(;i<this.path.length&&null!==r;){n=r;let e=this.path[i];if(s=e.name,i!==this.path.length-1||!s.startsWith("@")){let t=n[s+"_asArray"]||[];if(0===t.length&&n[s]&&t.push(n[s]),e.position)r=t[e.position]||null;else if(e.attribute){let n=e.attribute;r=t.filter(e=>e[n.name]==n.value)[0]||null}else r=t[0]||null}i++}return null===r?null:s.startsWith("@")?{name:s.substring(1),leaf:r,target:r}:{name:s,leaf:r,target:t?n:r}}}class Hi{constructor(e,t,n){this.action=e,this.xpath=t,this.value=n,this.position=null}getMpdTarget(e){let t="remove"===this.action||"replace"===this.action||"before"===this.position||"after"===this.position;return this.xpath.getMpdTarget(e,t)}}function Vi(){let e,t;const n=this.context;return e={getIsPatch:function(e){return e&&e.hasOwnProperty(S.ORIGINAL_MPD_ID)||!1},getPublishTime:function(e){return e&&e.hasOwnProperty(S.PUBLISH_TIME)?new Date(e[S.PUBLISH_TIME]):null},getOriginalPublishTime:function(e){return e&&e.hasOwnProperty(S.ORIGINAL_PUBLISH_TIME)?new Date(e[S.ORIGINAL_PUBLISH_TIME]):null},getMpdId:function(e){return e&&e[S.ORIGINAL_MPD_ID]||null},getPatchOperations:function(e){return e?(e.__children||[]).map(e=>{let n=Object.keys(e)[0];if("add"!==n&&"remove"!==n&&"replace"!==n)return t.warn("Ignoring node of invalid action: "+n),null;let r=e[n],i=r.sel;if("add"===n&&r.type){if(!r.type.startsWith("@"))return t.warn(`Ignoring add action for prefixed namespace declaration: ${r.type}=${r.__text}`),null;i=`${i}/${r.type}`}let s=new qi(i);if(!s.isValid())return t.warn(`Ignoring action with invalid selector: ${n} - ${i}`),null;let a=null;s.findsAttribute()?a=r.__text||"":"remove"!==n&&(a=r.__children.reduce((e,t)=>{let n=Object.keys(t)[0];return"#text"!==n&&(e[n]=e[n]||[],e[n].push(t[n])),e},{}));let o=new Hi(n,s,a);return"add"===n&&(o.position=r.pos),o}).filter(e=>!!e):[]}},t=w(n).getInstance().getLogger(e),e}Vi.__dashjs_factory_name="PatchManifestModel";var ji=R.getSingletonFactory(Vi);function zi(){let e,t,n,r,i,s,a,o;const l=this.context;function u(e,n,i){const a=t.getAdaptationsForType(r[0].mpd.manifest,e,n);if(!a||0===a.length)return null;if(a.length>1&&i){const e=d(i,n);if(s[i.id]&&s[i.id][n])for(let t=0,r=a.length;t<r;t++)if(c(s[i.id][n],e[t]))return a[t];for(let e=0,n=a.length;e<n;e++)if(o=a[e],t.getRolesForAdaptation(o).filter((function(e){return e.value===S.MAIN}))[0])return a[e]}var o;return a[0]}function c(e,t){if(!e||!t)return!1;const n=e.id===t.id,r=e.viewpoint===t.viewpoint,i=e.lang===t.lang,s=e.roles.toString()===t.roles.toString(),a=e.accessibility.toString()===t.accessibility.toString(),o=e.audioChannelConfiguration.toString()===t.audioChannelConfiguration.toString();return n&&r&&i&&s&&a&&o}function d(e,n,s){let o,l,u,c,d,g,h,p=r,m=s,y=[];if(m)A(),p=f(m);else{if(!(r.length>0))return y;m=r[0].mpd.manifest}const S=E(e,p);S&&(h=S.id);const I=t.getAdaptationsForType(m,e?e.index:null,n!==a.EMBEDDED_TEXT?n:a.VIDEO);if(!I||0===I.length)return y;for(i[h]=i[h]||t.getAdaptationsForPeriod(S),c=0,g=I.length;c<g;c++)if(o=I[c],u=t.getIndexForAdaptation(o,m,e.index),l=_(i[h][u]),n===a.EMBEDDED_TEXT){let e=l.accessibility.length;for(d=0;d<e;d++){if(!l)continue;let e=l.accessibility[d];if(0===e.indexOf("cea-608:")){let t=e.substring(8).split(";");if("CC"===t[0].substring(0,2))for(d=0;d<t.length;d++)l||(l=_.call(this,i[h][u])),T(l,t[d].substring(0,3),t[d].substring(4)),y.push(l),l=null;else for(d=0;d<t.length;d++)l||(l=_.call(this,i[h][u])),T(l,"CC"+(d+1),t[d]),y.push(l),l=null}else 0===e.indexOf("cea-608")&&(T(l,a.CC1,"eng"),y.push(l),l=null)}}else n===a.IMAGE?(l.type=a.IMAGE,y.push(l),l=null):l&&y.push(l);return y}function f(e){const n=g(e);return t.getRegularPeriods(n)}function g(e){const n=p(e);return t.getMpd(n)}function h(){r=[],i={},s={}}function p(e){return e||(r.length>0?r[0].mpd.manifest:null)}function m(e){return e&&e.streamInfo&&void 0!==e.streamInfo.id&&i[e.streamInfo.id]?i[e.streamInfo.id][e.index]:null}function E(e,t){const n=t.length;for(let r=0;r<n;r++){let n=t[r];if(e&&e.id===n.id)return n}return null}function _(e){if(!e)return null;let n=new Gi;const r=e.period.mpd.manifest.Period_asArray[e.period.index].AdaptationSet_asArray[e.index];let i;return n.id=e.id,n.index=e.index,n.type=e.type,n.streamInfo=y(e.period),n.representationCount=t.getRepresentationCount(r),n.labels=t.getLabelsForAdaptation(r),n.lang=t.getLanguageForAdaptation(r),i=t.getViewpointForAdaptation(r),n.viewpoint=i?i.value:void 0,n.accessibility=t.getAccessibilityForAdaptation(r).map((function(e){let t=e.value,r=t;return e.schemeIdUri&&e.schemeIdUri.search("cea-608")>=0&&void 0!==o&&(r=t?"cea-608:"+t:"cea-608",n.embeddedCaptions=!0),r})),n.audioChannelConfiguration=t.getAudioChannelConfigurationForAdaptation(r).map((function(e){return e.value})),0===n.audioChannelConfiguration.length&&Array.isArray(r.Representation_asArray)&&r.Representation_asArray.length>0&&(n.audioChannelConfiguration=t.getAudioChannelConfigurationForRepresentation(r.Representation_asArray[0]).map((function(e){return e.value}))),n.roles=t.getRolesForAdaptation(r).map((function(e){return e.value})),n.codec=t.getCodec(r),n.mimeType=t.getMimeType(r),n.contentProtection=t.getContentProtectionData(r),n.bitrateList=t.getBitrateListForAdaptation(r),n.contentProtection&&n.contentProtection.forEach((function(e){e.KID=t.getKID(e)})),n.isText=t.getIsTextTrack(n.mimeType),n.supplementalProperties=t.getSupplementalPropperties(r),n}function T(e,t,n){e.id=t,e.index=100+parseInt(t.substring(2,3)),e.type=a.EMBEDDED_TEXT,e.codec="cea-608-in-SEI",e.isText=!0,e.isEmbedded=!0,e.lang=n,e.roles=["caption"]}function y(e){let n=new Yi;return n.id=e.id,n.index=e.index,n.start=e.start,n.duration=e.duration,n.manifestInfo=function(e){let n=new Ki;return n.DVRWindowSize=e.timeShiftBufferDepth,n.loadedTime=e.manifest.loadedTime,n.availableFrom=e.availabilityStartTime,n.minBufferTime=e.manifest.minBufferTime,n.maxFragmentDuration=e.maxSegmentDuration,n.duration=t.getDuration(e.manifest),n.isDynamic=t.getIsDynamic(e.manifest),n.serviceDescriptions=t.getServiceDescriptions(e.manifest),n.protocol=e.manifest.protocol,n}(e.mpd),n.isLast=1===e.mpd.manifest.Period_asArray.length||Math.abs(n.start+n.duration-n.manifestInfo.duration)<1,n}function A(){if(!a)throw new Error("setConfig function has to be called previously")}function I(e){return r.length>0?r[0].mpd.manifest.Period_asArray[e]:null}function R(e,t,n){let r,i,s,a,o,l;if(e)for(i=e.AdaptationSet_asArray,o=0;o<i.length;o+=1)for(r=i[o],a=r.Representation_asArray,l=0;l<a.length;l+=1)if(s=a[l],t===s.id)return n?l:s;return null}return e={getBandwidthForRepresentation:function(e,t){let n;return n=R(I(t),e),n?n.bandwidth:null},getIndexForRepresentation:function(e,t){return function(e,t){const n=R(e,t,!0);return null!==n?n:-1}(I(t),e)},getMaxIndexForBufferType:function(e,n){return function(e,n){let r,i,s,a;if(!e||!n)return-1;for(i=e.AdaptationSet_asArray,a=0;a<i.length;a+=1)if(r=i[a],s=r.Representation_asArray,t.getIsTypeOf(r,n))return s.length;return-1}(I(n),e)},convertDataToRepresentationInfo:function(e){if(e){let n=new ki;const r=e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.index].AdaptationSet_asArray[e.adaptation.index],i=t.getRepresentationFor(e.index,r);return n.id=e.id,n.quality=e.index,n.bandwidth=t.getBandwidth(i),n.DVRWindow=e.segmentAvailabilityRange,n.fragmentDuration=e.segmentDuration||(e.segments&&e.segments.length>0?e.segments[0].duration:NaN),n.MSETimeOffset=e.MSETimeOffset,n.mediaInfo=_(e.adaptation),n}return null},getDataForMedia:m,getStreamsInfo:function(e,t){const n=[];let i=r;if(e&&(A(),i=f(e)),i.length>0){(!t||t>i.length)&&(t=i.length);for(let e=0;e<t;e++)n.push(y(i[e]))}return n},getMediaInfoForType:function(e,n){if(0===r.length||!e)return null;let s=E(e,r);if(!s)return null;let a=s.id;i[a]=i[a]||t.getAdaptationsForPeriod(s);let o=u(e.index,n,e);if(!o)return null;let l=t.getIndexForAdaptation(o,r[0].mpd.manifest,e.index);return _(i[a][l])},getAllMediaInfoForType:d,getAdaptationForType:u,getRealAdaptation:function(e,n){let i,s;const a=E(e,r);return i=n?n.id:null,r.length>0&&a&&(s=i?t.getAdaptationForId(i,r[0].mpd.manifest,a.index):t.getAdaptationForIndex(n?n.index:null,r[0].mpd.manifest,a.index)),s},getRealPeriodByIndex:function(e){return t.getRealPeriodForIndex(e,r[0].mpd.manifest)},getEssentialPropertiesForRepresentation:function(e){try{return t.getEssentialPropertiesForRepresentation(e)}catch(e){return[]}},getVoRepresentations:function(e){let n;const r=m(e);return n=t.getRepresentationsForAdaptation(r),n},getEventsFor:function(e,n){let i=[];if(r.length>0){const s=r[0].mpd.manifest;e instanceof Yi?i=t.getEventsForPeriod(E(e,r)):e instanceof Gi?i=t.getEventStreamForAdaptationSet(s,m(e)):e instanceof ki&&(i=t.getEventStreamForRepresentation(s,n))}return i},getEvent:function(e,t,n,r){try{if(!e||!t||isNaN(n)||!r)return null;const i=e.scheme_id_uri,s=e.value;if(!t[i+"/"+s])return null;const a=new Rn,o=e.timescale||1,l=r.adaptation.period.start,u=t[i+"/"+s],c=isNaN(r.presentationTimeOffset)?isNaN(u.presentationTimeOffset)?0:u.presentationTimeOffset:r.presentationTimeOffset;let d,f=e.presentation_time_delta/o;d=0===e.version?l+n-c+f:l-c+f;const g=e.event_duration,h=e.id,p=e.message_data;return a.eventStream=u,a.eventStream.value=s,a.eventStream.timescale=o,a.duration=g,a.id=h,a.calculatedPresentationTime=d,a.messageData=p,a.presentationTimeDelta=f,a}catch(e){return null}},getMpd:g,setConfig:function(e){e&&(e.constants&&(a=e.constants),e.cea608parser&&(o=e.cea608parser),e.errHandler&&t.setConfig({errHandler:e.errHandler}),e.BASE64&&t.setConfig({BASE64:e.BASE64}))},updatePeriods:function(e){if(!e)return null;A(),r=f(e),i={}},getIsTextTrack:function(e){return t.getIsTextTrack(e)},getUTCTimingSources:function(){const e=p();return t.getUTCTimingSources(e)},getSuggestedPresentationDelay:function(){const e=r.length>0?r[0].mpd:null;return t.getSuggestedPresentationDelay(e)},getAvailabilityStartTime:function(e){const n=g(e);return t.getAvailabilityStartTime(n)},getIsTypeOf:function(e,n){return t.getIsTypeOf(e,n)},getIsDynamic:function(e){const n=p(e);return t.getIsDynamic(n)},getDuration:function(e){const n=p(e);return t.getDuration(n)},getRegularPeriods:f,getLocation:function(e){return t.getLocation(e)},getPatchLocation:function(e){const n=t.getPatchLocation(e),r=t.getPublishTime(e);if(!n||!r)return null;if(n.hasOwnProperty("ttl")&&r){const e=1e3*parseFloat(n.ttl);if(r.getTime()+e<=(new Date).getTime())return null}return n.__text},getManifestUpdatePeriod:function(e,n=0){return t.getManifestUpdatePeriod(e,n)},getPublishTime:function(e){return t.getPublishTime(e)},getIsDVB:function(e){return t.hasProfile(e,"urn:dvb:dash:profile:dvb-dash:2014")},getIsPatch:function(e){return n.getIsPatch(e)},getBaseURLsFromElement:function(e){return t.getBaseURLsFromElement(e)},getRepresentationSortFunction:function(){return t.getRepresentationSortFunction()},getCodec:function(e,n,r){return t.getCodec(e,n,r)},getVoAdaptations:function(){return i},getVoPeriods:function(){return r},getPeriodById:function(e){if(!e||0===r.length)return null;const t=r.filter(t=>t.id===e);return t&&t.length>0?t[0]:null},setCurrentMediaInfo:function(e,t,n){s[e]=s[e]||{},s[e][t]=s[e][t]||{},s[e][t]=n},isPatchValid:function(e,r){let i=t.getId(e),s=n.getMpdId(r),a=t.getPublishTime(e),o=n.getPublishTime(r),l=n.getOriginalPublishTime(r);return!!(i&&s&&i==s&&a&&l&&a.getTime()==l.getTime()&&o&&a.getTime()<o.getTime())},applyPatchToManifest:function(e,t){n.getPatchOperations(t).forEach(t=>{let n=t.getMpdTarget(e);if(null===n)return;let{name:r,target:i,leaf:s}=n;if(t.xpath.findsAttribute()){switch(t.action){case"add":case"replace":i[r]=t.value;break;case"remove":delete i[r]}return}let a=(i[r+"_asArray"]||[]).indexOf(s),o="prepend"===t.position||"before"===t.position;if(("remove"===t.action||"replace"===t.action)&&(delete i[r],-1!=a)){let e=i[r+"_asArray"];e.splice(a,1),e.length>1?i[r]=e:1==e.length?i[r]=e[0]:delete i[r+"_asArray"]}"add"!==t.action&&"replace"!==t.action||Object.keys(t.value).forEach(e=>{let n=t.value[e],s=i[e+"_asArray"]||[];if(0===s.length&&i[e]&&s.push(i[e]),0===s.length)s=n;else{let i=s.length;i=e==r&&-1!=a?a+(o?0:1)+("replace"==t.action?-1:0):o?0:s.length,s.splice.apply(s,[i,0].concat(n))}i[e+"_asArray"]=s,i[e]=1==s.length?s[0]:s})})},reset:h},t=Un(l).getInstance(),n=ji(l).getInstance(),h(),e}zi.__dashjs_factory_name="DashAdapter";var Wi=R.getSingletonFactory(zi);class Xi{constructor(){this.TcpList=[],this.HttpList=[],this.RepSwitchList=[],this.BufferLevel=[],this.BufferState=[],this.PlayList=[],this.DroppedFrames=[],this.SchedulingInfo=[],this.DVRInfo=[],this.ManifestUpdate=[],this.RequestsQueue=null,this.DVBErrors=[]}}class Qi{constructor(){this.t=null,this.mt=null,this.to=null,this.lto=null}}class $i{constructor(){this.t=null,this.level=null}}class Zi{constructor(){this.target=null,this.state=I.BUFFER_EMPTY}}class Ji{constructor(){this.time=null,this.range=null,this.manifestInfo=null}}class es{constructor(){this.time=null,this.droppedFrames=null}}class ts{constructor(){this.mediaType=null,this.type=null,this.requestTime=null,this.fetchTime=null,this.availabilityStartTime=null,this.presentationStartTime=0,this.clientTimeOffset=0,this.currentTime=null,this.buffered=null,this.latency=0,this.streamInfo=[],this.representationInfo=[]}}class ns{constructor(){this.id=null,this.index=null,this.start=null,this.duration=null}}class rs{constructor(){this.id=null,this.index=null,this.mediaType=null,this.streamIndex=null,this.presentationTimeOffset=null,this.startNumber=null,this.fragmentInfoType=null}}class is{constructor(){this.mediaType=null,this.t=null,this.type=null,this.startTime=null,this.availabilityStartTime=null,this.duration=null,this.quality=null,this.range=null,this.state=null}}class ss{constructor(){this.loadingRequests=[],this.executedRequests=[]}}function as(e){const t=(e=e||{}).settings;let n,r,i=this.context,s=b(i).getInstance();function a(){s.trigger(M.METRICS_CHANGED)}function o(e){s.trigger(M.METRIC_CHANGED,{mediaType:e}),a()}function l(e,t,n){s.trigger(M.METRIC_UPDATED,{mediaType:e,metric:t,value:n}),o(e)}function u(e,t,n){s.trigger(M.METRIC_ADDED,{mediaType:e,metric:t,value:n}),o(e)}function c(e,t){let n=null;return e?(r.hasOwnProperty(e)?n=r[e]:t||(n=new Xi,r[e]=n),n):n}function d(e,n,r){let i=c(e);null!==i&&(i[n].push(r),i[n].length>t.get().streaming.metricsMaxListDepth&&i[n].shift())}function f(e,t,n){d(e,t,n),u(e,t,n)}return n={clearCurrentMetricsForType:function(e){delete r[e],o(e)},clearAllCurrentMetrics:function(){r={},a()},getMetricsFor:c,addHttpRequest:function e(t,n,r,i,s,a,o,l,u,c,d,g,h,p,m){let E=new F;a&&a!==i&&(e(t,null,r,i,s,null,null,l,u,null,null,null,h,null,null),E.actualurl=a),E.tcpid=n,E.type=r,E.url=i,E.range=l,E.trequest=u,E.tresponse=c,E.responsecode=g,E._tfinish=d,E._stream=t,E._mediaduration=h,E._quality=s,E._responseHeaders=p,E._serviceLocation=o,m?m.forEach(e=>{!function(e,t,n,r){let i=new x;i.s=t,i.d=n,i.b=r,e.trace.push(i),e.interval||(e.interval=0),e.interval+=n}(E,e.s,e.d,e.b)}):(delete E.interval,delete E.trace),f(t,I.HTTP_REQUEST,E)},addRepresentationSwitch:function(e,t,n,r,i){let s=new Qi;s.t=t,s.mt=n,s.to=r,i?s.lto=i:delete s.lto,f(e,I.TRACK_SWITCH,s)},addBufferLevel:function(e,t,n){let r=new $i;r.t=t,r.level=n,f(e,I.BUFFER_LEVEL,r)},addBufferState:function(e,t,n){let r=new Zi;r.target=n,r.state=t,f(e,I.BUFFER_STATE,r)},addDVRInfo:function(e,t,n,r){let i=new Ji;i.time=t,i.range=r,i.manifestInfo=n,f(e,I.DVR_INFO,i)},addDroppedFrames:function(e,t){let n=new es,r=c(e).DroppedFrames;t&&(n.time=t.creationTime,n.droppedFrames=t.droppedVideoFrames,r.length>0&&r[r.length-1]==n||f(e,I.DROPPED_FRAMES,n))},addSchedulingInfo:function(e,t,n,r,i,s,a,o,l){let u=new is;u.mediaType=e,u.t=t,u.type=n,u.startTime=r,u.availabilityStartTime=i,u.duration=s,u.quality=a,u.range=o,u.state=l,f(e,I.SCHEDULING_INFO,u)},addRequestsQueue:function(e,t,n){let r=new ss;r.loadingRequests=t,r.executedRequests=n,c(e).RequestsQueue=r,u(e,I.REQUESTS_QUEUE,r)},addManifestUpdate:function(e,t,n,r,i,s,a,o,l,c){let f=new ts;f.mediaType=e,f.type=t,f.requestTime=n,f.fetchTime=r,f.availabilityStartTime=i,f.presentationStartTime=s,f.clientTimeOffset=a,f.currentTime=o,f.buffered=l,f.latency=c,d(A.STREAM,I.MANIFEST_UPDATE,f),u(e,I.MANIFEST_UPDATE,f)},updateManifestUpdateInfo:function(e,t){if(e){for(let n in t)e[n]=t[n];l(e.mediaType,I.MANIFEST_UPDATE,e)}},addManifestUpdateStreamInfo:function(e,t,n,r,i){if(e){let s=new ns;s.id=t,s.index=n,s.start=r,s.duration=i,e.streamInfo.push(s),l(e.mediaType,I.MANIFEST_UPDATE_STREAM_INFO,e)}},addManifestUpdateRepresentationInfo:function(e,t,n,r,i,s,a,o){if(e&&e.representationInfo){const u=new rs;u.id=t,u.index=n,u.streamIndex=r,u.mediaType=i,u.startNumber=a,u.fragmentInfoType=o,u.presentationTimeOffset=s,e.representationInfo.push(u),l(e.mediaType,I.MANIFEST_UPDATE_TRACK_INFO,e)}},addPlayList:function(e){e.trace&&Array.isArray(e.trace)?e.trace.forEach(e=>{e.hasOwnProperty("subreplevel")&&!e.subreplevel&&delete e.subreplevel}):delete e.trace,f(A.STREAM,I.PLAY_LIST,e)},addDVBErrors:function(e){f(A.STREAM,I.DVB_ERRORS,e)}},r={},n}as.__dashjs_factory_name="MetricsModel";var os=R.getSingletonFactory(as);function ls(e){e=e||{};const t=this.context;let n,r,i,s,a=e.metricsModel;function o(e){const t=a.getMetricsFor(e,!0);if(!t)return null;const n=t.HttpList;let r,i=null;if(!n||n.length<=0)return null;for(r=n.length-1;r>=0;){if(n[r].responsecode){i=n[r];break}r--}return i}function l(e){const t=a.getMetricsFor(e,!0);return t&&t.HttpList?t.HttpList:[]}function u(e,t){if(!e)return null;const n=e[t];return n&&0!==n.length?n[n.length-1]:null}return n={getCurrentRepresentationSwitch:function(e){return u(a.getMetricsFor(e,!0),I.TRACK_SWITCH)},getCurrentBufferState:function(e){return u(a.getMetricsFor(e,!0),I.BUFFER_STATE)},getCurrentBufferLevel:function(e){const t=u(a.getMetricsFor(e,!0),I.BUFFER_LEVEL);return t?class{static round10(e,t){return function(e,t,n){if(void 0===n||0==+n)return Math[e](t);if(n=+n,null===(t=+t)||isNaN(t)||!("number"==typeof n&&n%1==0))return NaN;return t=t.toString().split("e"),+((t=(t=Math[e](+(t[0]+"e"+(t[1]?+t[1]-n:-n)))).toString().split("e"))[0]+"e"+(t[1]?+t[1]+n:n))}("round",e,t)}}.round10(t.level/1e3,-3):0},getCurrentHttpRequest:o,getHttpRequests:l,getCurrentDroppedFrames:function(){return u(a.getMetricsFor(A.VIDEO,!0),I.DROPPED_FRAMES)},getCurrentSchedulingInfo:function(e){return u(a.getMetricsFor(e,!0),I.SCHEDULING_INFO)},getCurrentDVRInfo:function(e){return u(e?a.getMetricsFor(e,!0):a.getMetricsFor(A.VIDEO,!0)||a.getMetricsFor(A.AUDIO,!0),I.DVR_INFO)},getCurrentManifestUpdate:function(){return u(a.getMetricsFor(A.STREAM),I.MANIFEST_UPDATE)},getLatestFragmentRequestHeaderValueByID:function(e,t){let n={},r=o(e);return r&&(n=gn.parseHttpHeaders(r._responseHeaders)),void 0===n[t]?null:n[t]},getLatestMPDRequestHeaderValueByID:function(e){let t,n,r,i={};for(t=l(A.STREAM),r=t.length-1;r>=0;r--)if(n=t[r],n.type===F.MPD_TYPE){i=gn.parseHttpHeaders(n._responseHeaders);break}return void 0===i[e]?null:i[e]},addRepresentationSwitch:function(e,t,n,r,i){a.addRepresentationSwitch(e,t,n,r,i)},addDVRInfo:function(e,t,n,r){a.addDVRInfo(e,t,n,r)},updateManifestUpdateInfo:function(e){const t=this.getCurrentManifestUpdate();a.updateManifestUpdateInfo(t,e)},addManifestUpdateStreamInfo:function(e){if(e){const t=this.getCurrentManifestUpdate();a.addManifestUpdateStreamInfo(t,e.id,e.index,e.start,e.duration)}},addManifestUpdateRepresentationInfo:function(e,t){if(e){const n=this.getCurrentManifestUpdate();a.addManifestUpdateRepresentationInfo(n,e.id,e.index,e.streamIndex,t,e.presentationTimeOffset,e.startNumber,e.fragmentInfoType)}},addManifestUpdate:function(e){a.addManifestUpdate(A.STREAM,e.type,e.requestStartDate,e.requestEndDate)},addHttpRequest:function(e,t,n,r,i){a.addHttpRequest(e.mediaType,null,e.type,e.url,e.quality,t,e.serviceLocation||null,e.range||null,e.requestStartDate,e.firstByteDate,e.requestEndDate,n,e.duration,r,i)},addSchedulingInfo:function(e,t){a.addSchedulingInfo(e.mediaType,new Date,e.type,e.startTime,e.availabilityStartTime,e.duration,e.quality,e.range,t)},addRequestsQueue:function(e,t,n){a.addRequestsQueue(e,t,n)},addBufferLevel:function(e,t,n){a.addBufferLevel(e,t,n)},addBufferState:function(e,t,n){a.addBufferState(e,t,n)},addDroppedFrames:function(e){a.addDroppedFrames(A.VIDEO,e)},addPlayList:function(){s&&(a.addPlayList(s),s=null)},addDVBErrors:function(e){a.addDVBErrors(e)},createPlaylistMetrics:function(e,t){s=new an,s.start=new Date,s.mstart=e,s.starttype=t},createPlaylistTraceMetrics:function(e,t,n){!0===r&&(r=!1,i=new on,i.representationid=e,i.start=new Date,i.mstart=t,i.playbackspeed=null!==n?n.toString():null)},updatePlayListTraceMetrics:function(e){if(i)for(let t in i)i[t]=e[t]},pushPlayListTraceMetrics:function(e,t){if(!1===r&&s&&i&&i.start){const n=i.start,a=e.getTime()-n.getTime();i.duration=a,i.stopreason=t,s.trace.push(i),r=!0}},clearAllCurrentMetrics:function(){a.clearAllCurrentMetrics()}},a=a||os(t).getInstance({settings:e.settings}),r=!0,i=null,s=null,n}ls.__dashjs_factory_name="DashMetrics";var us=R.getSingletonFactory(ls);function cs(){const e=this.context,t=b(e).getInstance(),n=pn(e).getInstance();let r,i,s,a,o;function l(e){s=e}function u(e,t,n,r){let i=NaN;return i=r?n&&t.timeShiftBufferDepth!=Number.POSITIVE_INFINITY?new Date(t.availabilityStartTime.getTime()+1e3*(e+t.timeShiftBufferDepth)):t.availabilityEndTime:n?new Date(t.availabilityStartTime.getTime()+1e3*(e-s)):t.availabilityStartTime,i}function c(e,t){return(e.getTime()-t.mpd.availabilityStartTime.getTime()+1e3*s)/1e3}function d(e,t){return e+(t.adaptation.period.start-t.presentationTimeOffset)}function f(e){void 0!==e.offset&&(l(e.offset/1e3),a=!0)}function g(){s=0,a=!1,o=NaN}function h(){t.off(M.UPDATE_TIME_SYNC_OFFSET,f,this),g()}return r={initialize:function(){g(),t.on(M.UPDATE_TIME_SYNC_OFFSET,f,this)},getClientTimeOffset:function(){return s},setClientTimeOffset:l,getExpectedLiveEdge:function(){return o},setExpectedLiveEdge:function(e){o=e},calcAvailabilityStartTimeFromPresentationTime:function(e,t,n){return u.call(this,e,t,n)},calcAvailabilityEndTimeFromPresentationTime:function(e,t,n){return u.call(this,e,t,n,!0)},calcPresentationTimeFromWallTime:c,calcPresentationTimeFromMediaTime:d,calcPeriodRelativeTimeFromMpdRelativeTime:function(e,t){return t-e.adaptation.period.start},calcMediaTimeFromPresentationTime:function(e,t){return e-t.adaptation.period.start+t.presentationTimeOffset},calcSegmentAvailabilityRange:function(e,t){const r=e.adaptation.period,s={start:r.start,end:r.start+r.duration};if(!t)return s;if(!a&&e.segmentAvailabilityRange)return e.segmentAvailabilityRange;const o=e.segmentDuration||(e.segments&&e.segments.length?e.segments[e.segments.length-1].duration:0);if(e.segmentInfoType===S.SEGMENT_TIMELINE&&n.get().streaming.calcSegmentAvailabilityRangeFromTimeline)return function(e){const t=e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.index].AdaptationSet_asArray[e.adaptation.index],n=i.getRepresentationFor(e.index,t),r=n.SegmentTemplate.SegmentTimeline,s=n.SegmentTemplate.timescale,a=r.S_asArray,o={start:0,end:0};let l,u,c,f,g=0;for(o.start=d(a[0].t/s,e),c=0,f=a.length;c<f;c++)l=a[c],u=0,l.hasOwnProperty("r")&&(u=l.r),g+=l.d/s*(1+u);return o.end=o.start+g,o}(e);const l=c(new Date,r),u=r.start+r.duration;s.start=Math.max(l-r.mpd.timeShiftBufferDepth,r.start);const f=void 0!==e.availabilityTimeOffset&&e.availabilityTimeOffset<o?o-e.availabilityTimeOffset:o;return s.end=l>=u&&l-f<u?u:l-f,s},getPeriodEnd:function(e,t){const n=e.adaptation.period;if(!t)return n.start+n.duration;if(!a&&e.segmentAvailabilityRange)return e.segmentAvailabilityRange;const r=e.segmentDuration||(e.segments&&e.segments.length?e.segments[e.segments.length-1].duration:0),i=c(new Date,n),s=n.start+n.duration,o=void 0!==e.availabilityTimeOffset&&e.availabilityTimeOffset<r?r-e.availabilityTimeOffset:r;return Math.min(i-o,s)},calcWallTimeForSegment:function(e,t){let n,r,i;return t&&(n=e.representation.adaptation.period.mpd.suggestedPresentationDelay,r=e.presentationStartTime+n,i=new Date(e.availabilityStartTime.getTime()+1e3*r)),i},reset:h},i=Un(e).getInstance(),h(),r}cs.__dashjs_factory_name="TimelineConverter";var ds=R.getSingletonFactory(cs),fs=T((function(e,t){var n,r,i,o,l,u={encode:function(e){for(var t=[],n=0;n<e.length;++n){var r=e.charCodeAt(n);r<128?t.push(r):r<2048?(t.push(192|r>>6),t.push(128|63&r)):r<65536?(t.push(224|r>>12),t.push(128|63&r>>6),t.push(128|63&r)):(t.push(240|r>>18),t.push(128|63&r>>12),t.push(128|63&r>>6),t.push(128|63&r))}return t},decode:function(e){for(var t=[],n=0;n<e.length;){var r=e[n++];r<128||(r<224?(r=(31&r)<<6,r|=63&e[n++]):r<240?(r=(15&r)<<12,r|=(63&e[n++])<<6,r|=63&e[n++]):(r=(7&r)<<18,r|=(63&e[n++])<<12,r|=(63&e[n++])<<6,r|=63&e[n++])),t.push(String.fromCharCode(r))}return t.join("")}},c={};n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=function(e){for(var t=0,r=[],i=0|e.length/3;0<i--;){var s=(e[t]<<16)+(e[t+1]<<8)+e[t+2];t+=3,r.push(n.charAt(63&s>>18)),r.push(n.charAt(63&s>>12)),r.push(n.charAt(63&s>>6)),r.push(n.charAt(63&s))}return 2==e.length-t?(s=(e[t]<<16)+(e[t+1]<<8),r.push(n.charAt(63&s>>18)),r.push(n.charAt(63&s>>12)),r.push(n.charAt(63&s>>6)),r.push("=")):1==e.length-t&&(s=e[t]<<16,r.push(n.charAt(63&s>>18)),r.push(n.charAt(63&s>>12)),r.push("==")),r.join("")},i=function(){for(var e=[],t=0;t<n.length;++t)e[n.charCodeAt(t)]=t;return e["=".charCodeAt(0)]=0,e}(),o=function(e){for(var t=0,n=[],r=0|e.length/4;0<r--;){var s=(i[e.charCodeAt(t)]<<18)+(i[e.charCodeAt(t+1)]<<12)+(i[e.charCodeAt(t+2)]<<6)+i[e.charCodeAt(t+3)];n.push(255&s>>16),n.push(255&s>>8),n.push(255&s),t+=4}return n&&("="==e.charAt(t-2)?(n.pop(),n.pop()):"="==e.charAt(t-1)&&n.pop()),n},l={encode:function(e){for(var t=[],n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t},decode:function(e){for(var t=0;t<s.length;++t)a[t]=String.fromCharCode(a[t]);return a.join("")}},c.decodeArray=function(e){var t=o(e);return new Uint8Array(t)},c.encodeASCII=function(e){var t=l.encode(e);return r(t)},c.decodeASCII=function(e){var t=o(e);return l.decode(t)},c.encode=function(e){var t=u.encode(e);return r(t)},c.decode=function(e){var t=o(e);return u.decode(t)},t.decode=c.decode,t.decodeArray=c.decodeArray,t.encode=c.encode,t.encodeASCII=c.encodeASCII}));function gs(){const e="You must first call initialize() and set a source before calling this method",t="You must first call initialize() and set a valid source and view before calling this method",n="You must first call attachView() to set the video element before calling this method",r="You must first call attachSource() with a valid source before calling this method",i=this.context,s=b(i).getInstance();let a=pn(i).getInstance();const o=w(i).getInstance({settings:a});let l,u,c,d,f,g,h,p,m,E,_,T,N,C,v,O,L,x,U,B,k,Y,K,q,H,j,z,Q,$,Z,J,ee,te,ne,re;function ie(){ye(null),Ee(null),d=null,N&&(N.reset(),N=null),C&&(C.reset(),C=null),te.reset(),a.reset(),O&&(O.reset(),O=null)}function se(){return!!c&&!!$.getElement()}function ae(){return"3.2.1"}function oe(){if(!h)throw t;return H.isPaused()}function le(e){let t=j.getCurrentDVRInfo();if(!t)return 0;let n=H.getLiveDelay(),r=t.range.start+e;return r>t.range.end-n&&(r=t.range.end-n),r}function ue(e){if(!h)throw t;let n=me().currentTime;if(void 0!==e)n=K.getTimeRelativeToStreamId(n,e);else if(H.getIsDynamic()){let e=j.getCurrentDVRInfo();n=null===e?0:de()-(e.range.end-e.time)}return n}function de(){if(!h)throw t;let e=me().duration;if(H.getIsDynamic()){let t,n=j.getCurrentDVRInfo();if(!n)return 0;t=n.range.end-n.range.start,e=t<n.manifestInfo.DVRWindowSize?t:n.manifestInfo.DVRWindowSize}return e}function fe(e){X(e,"boolean"),p=e}function ge(){x.restoreDefaultUTCTimingSources()}function pe(){return j}function me(){if(!$.getElement())throw n;return $.getElement()}function Ee(e){if(!f)throw"MediaPlayer not initialized!";$.setElement(e),e&&(Ne(),function(){if(C)return;let e=dashjs.MetricsReporting;if("function"==typeof e){let t=e(i).create();C=t.createMetricsReporting({debug:o,eventBus:s,mediaElement:me(),adapter:L,dashMetrics:j,events:M,constants:A,metricsConstants:I})}}(),function(){if(v)return;let e=dashjs.MssHandler;"function"==typeof e&&(he.extend(e.errors),v=e(i).create({eventBus:s,mediaPlayerModel:x,dashMetrics:j,manifestModel:z,playbackController:H,streamController:K,protectionController:N,baseURLController:B,errHandler:U,events:M,constants:A,debug:o,initSegmentType:F.INIT_SEGMENT_TYPE,BASE64:fs,ISOBoxer:V,settings:a}))}(),K&&K.switchToVideoElement()),h&&Se(),be()}function _e(t){if(!g)throw e;let n=K.getActiveStreamInfo();return T.getTracksFor(t,n)}function Te(e,t){let n=-1;e.some((e,r)=>{if(e===t)return n=r,!0}),n<0||e.splice(n,1)}function ye(e){if(!f)throw"MediaPlayer not initialized!";"string"==typeof e&&J.initialize(e),c=e,(g||h)&&Se(),se()&&be()}function Ae(){if(!g)throw e;let t=K.getActiveStreamInfo();return t?K.getStreamById(t.id):null}function Se(){h=!1,g=!1,L.reset(),K.reset(),q.reset(),H.reset(),m.reset(),T.reset(),Z.reset(),N&&(a.get().streaming.keepProtectionMediaKeys?N.stop():(N.reset(),N=null,Ne())),Q.reset()}function Re(){return ci(i).create({debug:o,errHandler:U,dashMetrics:j,mediaPlayerModel:x,requestModifier:en(i).getInstance(),mssHandler:v,settings:a})}function Ne(){if(N)return N;let e=dashjs.Protection;if("function"==typeof e){let t=e(i).create();return M.extend(e.events),D.extend(e.events,{publicOnly:!0}),he.extend(e.errors),k||(k=mi(i).getInstance()),N=t.createProtectionSystem({debug:o,errHandler:U,videoModel:$,capabilities:k,eventBus:s,events:M,BASE64:fs,constants:A,cmcdModel:Q}),N&&(N.setLicenseRequestFilters(ne),N.setLicenseResponseFilters(re)),N}return null}function De(){if(!f)throw"MediaPlayer not initialized!";if(O)return O;let e=dashjs.OfflineController;if("function"==typeof e){M.extend(e.events),D.extend(e.events,{publicOnly:!0}),he.extend(e.errors);const t=Re(),n=pr(i).create();return n.setConfig({manifestModel:z,adapter:L,manifestLoader:t,errHandler:U}),O=e(i).create({debug:o,manifestUpdater:n,baseURLController:B,manifestLoader:t,manifestModel:z,mediaPlayerModel:x,abrController:m,playbackController:H,adapter:L,errHandler:U,dashMetrics:j,timelineConverter:_,schemeLoaderFactory:E,eventBus:s,events:M,errors:he,constants:A,settings:a,dashConstants:S,urlUtils:sn(i).getInstance()}),O}return null}function Ce(e){let t,n,r=j.getCurrentDVRInfo();return r?(t=r.manifestInfo.availableFrom.getTime()/1e3,n=e+(t+r.range.start),n):0}function be(){O&&O.resetRecords(),!g&&c&&(g=!0,u.info("Streaming Initialized"),function(){const e=Re();K||(K=Ir(i).getInstance()),Y.setConfig({capabilities:k,adapter:L,settings:a}),K.setConfig({capabilities:k,capabilitiesFilter:Y,manifestLoader:e,manifestModel:z,mediaPlayerModel:x,protectionController:N,adapter:L,dashMetrics:j,errHandler:U,timelineConverter:_,videoModel:$,playbackController:H,abrController:m,mediaController:T,textController:Z,settings:a,baseURLController:B}),q.setConfig({settings:a,playbackController:H,streamController:K,videoModel:$,timelineConverter:_,adapter:L}),H.setConfig({streamController:K,dashMetrics:j,mediaPlayerModel:x,adapter:L,videoModel:$,timelineConverter:_,uriFragmentModel:J,settings:a}),m.setConfig({streamController:K,domStorage:ee,mediaPlayerModel:x,dashMetrics:j,adapter:L,videoModel:$,settings:a}),Z.setConfig({errHandler:U,manifestModel:z,adapter:L,mediaController:T,streamController:K,videoModel:$}),Q.setConfig({abrController:m,dashMetrics:j,playbackController:H}),K.initialize(p,d),q.initialize(),Q.initialize()}(),"string"==typeof c?K.load(c):K.loadWithManifest(c)),!h&&se()&&(h=!0,u.info("Playback Initialized"))}return l={initialize:function(e,t,n){k||(k=mi(i).getInstance()),U=fi(i).getInstance(),k.supportsMediaSource()?f||(f=!0,_=ds(i).getInstance(),m||(m=pt(i).getInstance(),m.setConfig({settings:a})),E||(E=tr(i).getInstance()),H||(H=P(i).getInstance()),T||(T=Cr(i).getInstance()),K||(K=Ir(i).getInstance()),q||(q=Nr(i).getInstance()),Y||(Y=_i(i).getInstance()),L=Wi(i).getInstance(),z=Ii(i).getInstance(),Q=$n(i).getInstance(),j=us(i).getInstance({settings:a}),Z=Ie(i).getInstance(),ee=Mi(i).getInstance({settings:a}),L.setConfig({constants:A,cea608parser:y,errHandler:U,BASE64:fs}),B||(B=Gr(i).create()),B.setConfig({adapter:L}),te=Bi(i).getInstance({dashMetrics:j,mediaPlayerModel:x,errHandler:U,baseURLController:B,events:M,eventBus:s,debug:o,boxParser:W(i).getInstance(),requestModifier:en(i).getInstance(),errors:he}),te.initialize(),T.setConfig({domStorage:ee,settings:a}),ge(),fe(void 0===n||n),De(),e&&Ee(e),t&&ye(t),u.info("[dash.js "+ae()+"] MediaPlayer has been initialized")):U.error(new G(he.CAPABILITY_MEDIASOURCE_ERROR_CODE,he.CAPABILITY_MEDIASOURCE_ERROR_MESSAGE))},setConfig:function(e){e&&(e.capabilities&&(k=e.capabilities),e.capabilitiesFilter&&(Y=e.capabilitiesFilter),e.streamController&&(K=e.streamController),e.gapController&&(q=e.gapController),e.playbackController&&(H=e.playbackController),e.mediaPlayerModel&&(x=e.mediaPlayerModel),e.abrController&&(m=e.abrController),e.schemeLoaderFactory&&(E=e.schemeLoaderFactory),e.mediaController&&(T=e.mediaController),e.settings&&(a=e.settings))},on:function(e,t,n,r){s.on(e,t,n,r)},off:function(e,t,n){s.off(e,t,n)},extend:function(e,t,n){R.extend(e,t,n,i)},attachView:Ee,attachSource:ye,isReady:se,preload:function(){if($.getElement()||g)return!1;if(!c)throw r;be()},play:function(){if(!h)throw t;(!p||oe()&&h)&&H.play()},isPaused:oe,pause:function(){if(!h)throw t;H.pause()},isSeeking:function(){if(!h)throw t;return H.isSeeking()},isDynamic:function(){if(!h)throw t;return H.getIsDynamic()},seek:function(e){if(!h)throw t;if(X(e,"number"),isNaN(e))throw A.BAD_ARGUMENT_ERROR;let n=H.getIsDynamic()?le(e):e;H.seek(n)},setPlaybackRate:function(e){me().playbackRate=e},getPlaybackRate:function(){return me().playbackRate},setMute:function(e){X(e,"boolean"),me().muted=e},isMuted:function(){return me().muted},setVolume:function(e){if("number"!=typeof e||isNaN(e)||e<0||e>1)throw A.BAD_ARGUMENT_ERROR;me().volume=e},getVolume:function(){return me().volume},time:ue,duration:de,timeAsUTC:function(){if(!h)throw t;return ue()<0?NaN:Ce(ue())},durationAsUTC:function(){if(!h)throw t;return Ce(de())},getActiveStream:Ae,getDVRWindowSize:function(){let e=j.getCurrentDVRInfo();return e?e.manifestInfo.DVRWindowSize:0},getDVRSeekOffset:le,convertToTimeCode:function(e){e=Math.max(e,0);let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%3600%60);return(0===t?"":t<10?"0"+t.toString()+":":t.toString()+":")+(n<10?"0"+n.toString():n.toString())+":"+(r<10?"0"+r.toString():r.toString())},formatUTC:function(e,t,n,r=!1){const i=new Date(1e3*e),s=i.toLocaleDateString(t),a=i.toLocaleTimeString(t,{hour12:n});return r?a+" "+s:a},getVersion:ae,getDebug:function(){return o},getBufferLength:function(e){const t=[A.VIDEO,A.AUDIO,A.FRAGMENTED_TEXT];if(e){if(-1!==t.indexOf(e)){const t=pe().getCurrentBufferLevel(e);return t||NaN}return u.warn("getBufferLength requested for invalid type"),NaN}{const e=t.map(e=>_e(e).length>0?pe().getCurrentBufferLevel(e):Number.MAX_VALUE).reduce((e,t)=>Math.min(e,t));return e===Number.MAX_VALUE?NaN:e}},getTTMLRenderingDiv:function(){return $?$.getTTMLRenderingDiv():null},getVideoElement:me,getSource:function(){if(!c)throw r;return c},getCurrentLiveLatency:function(){if(!f)throw"MediaPlayer not initialized!";return h?H.getCurrentLiveLatency():NaN},getTopBitrateInfoFor:function(t){if(!g)throw e;return m.getTopBitrateInfoFor(t)},setAutoPlay:fe,getAutoPlay:function(){return p},getDashMetrics:pe,getQualityFor:function(t){if(!g)throw e;if(t===A.IMAGE){const e=Ae();if(!e)return-1;const t=e.getThumbnailController();return t?t.getCurrentTrackIndex():-1}return m.getQualityFor(t)},setQualityFor:function(t,n){if(!g)throw e;if(t===A.IMAGE){const e=Ae();if(!e)return;const t=e.getThumbnailController();t&&t.setTrackByIndex(n)}m.setPlaybackQuality(t,K.getActiveStreamInfo(),n)},updatePortalSize:function(){m.setElementSize(),m.setWindowResizeEventCalled(!0)},setTextDefaultLanguage:function(e){u.warn('setTextDefaultLanguage is deprecated and will be removed in version 3.2.0. Please use setInitialMediaSettingsFor("fragmentedText", { lang: lang }) instead'),void 0===Z&&(Z=Ie(i).getInstance()),Z.setTextDefaultLanguage(e)},getTextDefaultLanguage:function(){return u.warn('getTextDefaultLanguage is deprecated and will be removed in version 3.2.0. Please use getInitialMediaSettingsFor("fragmentedText").lang instead'),void 0===Z&&(Z=Ie(i).getInstance()),Z.getTextDefaultLanguage()},setTextDefaultEnabled:function(e){void 0===Z&&(Z=Ie(i).getInstance()),Z.setTextDefaultEnabled(e)},getTextDefaultEnabled:function(){return void 0===Z&&(Z=Ie(i).getInstance()),Z.getTextDefaultEnabled()},enableText:function(e){void 0===Z&&(Z=Ie(i).getInstance()),Z.enableText(e)},enableForcedTextStreaming:function(e){void 0===Z&&(Z=Ie(i).getInstance()),Z.enableForcedTextStreaming(e)},isTextEnabled:function(){return void 0===Z&&(Z=Ie(i).getInstance()),Z.isTextEnabled()},setTextTrack:function(e){if(!h)throw t;void 0===Z&&(Z=Ie(i).getInstance()),Z.setTextTrack(e)},getBitrateInfoListFor:function(t){if(!g)throw e;let n=Ae();return n?n.getBitrateListFor(t):[]},getStreamsFromManifest:function(t){if(!g)throw e;return L.getStreamsInfo(t)},getTracksFor:_e,getTracksForTypeFromManifest:function(t,n,r){if(!g)throw e;return(r=r||L.getStreamsInfo(n,1)[0])?L.getAllMediaInfoForType(r,t,n):[]},getCurrentTrackFor:function(t){if(!g)throw e;let n=K.getActiveStreamInfo();return T.getCurrentTrackFor(t,n)},setInitialMediaSettingsFor:function(e,t){if(!f)throw"MediaPlayer not initialized!";T.setInitialSettings(e,t),e===A.FRAGMENTED_TEXT&&Z.setInitialSettings(t)},getInitialMediaSettingsFor:function(e){if(!f)throw"MediaPlayer not initialized!";return T.getInitialSettings(e)},setCurrentTrack:function(t){if(!g)throw e;T.setTrack(t)},getTrackSwitchModeFor:function(e){if(!f)throw"MediaPlayer not initialized!";return T.getSwitchMode(e)},setTrackSwitchModeFor:function(e,t){if(!f)throw"MediaPlayer not initialized!";T.setSwitchMode(e,t)},setSelectionModeForInitialTrack:function(e){if(!f)throw"MediaPlayer not initialized!";T.setSelectionModeForInitialTrack(e)},getSelectionModeForInitialTrack:function(){if(!f)throw"MediaPlayer not initialized!";return T.getSelectionModeForInitialTrack()},addABRCustomRule:function(e,t,n){x.addABRCustomRule(e,t,n)},removeABRCustomRule:function(e){x.removeABRCustomRule(e)},removeAllABRCustomRule:function(){x.removeABRCustomRule()},getAverageThroughput:function(e){const t=m.getThroughputHistory();return t?t.getAverageThroughput(e):0},retrieveManifest:function(e,t){let n=Re(),r=this;const i=function(e){e.error?t(null,e.error):t(e.manifest),s.off(M.INTERNAL_MANIFEST_LOADED,i,r),n.reset()};s.on(M.INTERNAL_MANIFEST_LOADED,i,r),J.initialize(e),n.load(e)},addUTCTimingSource:function(e,t){x.addUTCTimingSource(e,t)},removeUTCTimingSource:function(e,t){x.removeUTCTimingSource(e,t)},clearDefaultUTCTimingSources:function(){x.clearDefaultUTCTimingSources()},restoreDefaultUTCTimingSources:ge,setXHRWithCredentialsForType:function(e,t){x.setXHRWithCredentialsForType(e,t)},getXHRWithCredentialsForType:function(e){return x.getXHRWithCredentialsForType(e)},getProtectionController:function(){return Ne()},attachProtectionController:function(e){N=e},setProtectionData:function(e){d=e,K&&K.setProtectionData(d)},registerLicenseRequestFilter:function(e){ne.push(e),N&&N.setLicenseRequestFilters(ne)},registerLicenseResponseFilter:function(e){re.push(e),N&&N.setLicenseResponseFilters(re)},unregisterLicenseRequestFilter:function(e){Te(ne,e),N&&N.setLicenseRequestFilters(ne)},unregisterLicenseResponseFilter:function(e){Te(re,e),N&&N.setLicenseResponseFilters(re)},displayCaptionsOnTop:function(e){let t=ce(i).getInstance();t.setConfig({videoModel:$}),t.initialize(),t.setDisplayCConTop(e)},attachTTMLRenderingDiv:function(e){if(!$.getElement())throw n;$.setTTMLRenderingDiv(e)},getCurrentTextTrackIndex:function(){let e=NaN;return Z&&(e=Z.getCurrentTrackIdx()),e},provideThumbnail:function(e,t){if("function"!=typeof t)return;if(e<0)return void t(null);const n=H.getIsDynamic()?le(e):e,r=K.getStreamForTime(n);if(null===r)return void t(null);const i=r.getThumbnailController();if(!i)return void t(null);const s=K.getTimeRelativeToStreamId(n,r.getId());return i.provide(s,t)},getDashAdapter:function(){return L},getOfflineController:function(){return De()},getSettings:function(){return a.get()},updateSettings:function(e){a.update(e)},resetSettings:function(){a.reset()},reset:ie,destroy:function(){ie(),ne=[],re=[],R.deleteSingletonInstances(i)}},u=o.getLogger(l),f=!1,h=!1,g=!1,p=!0,N=null,O=null,d=null,L=null,te=null,M.extend(D),x=Ni(i).getInstance(),$=Ci(i).getInstance(),J=Ai(i).getInstance(),ne=[],re=[],l}gs.__dashjs_factory_name="MediaPlayer";const hs=R.getClassFactory(gs);hs.events=D,hs.errors=he,R.updateClassFactory(gs.__dashjs_factory_name,hs);var ps="undefined"!=typeof window&&window||global,ms=ps.dashjs;ms||(ms=ps.dashjs={}),ms.MediaPlayer=hs,ms.FactoryMaker=R,ms.Debug=w,ms.Version="3.2.1";class Es{constructor(){this.mpdurl=null,this.errorcode=null,this.terror=null,this.url=null,this.ipaddress=null,this.servicelocation=null}}function _s(e){let t,n;const r=(e=e||{}).eventBus,i=e.dashMetrics,s=e.metricsConstants,a=e.events;function o(e){let t=new Es;if(n){for(const n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.mpdurl||(t.mpdurl=n.originalUrl||n.url),t.terror||(t.terror=new Date),i.addDVBErrors(t)}}function l(e){e.error||(n=e.manifest)}function u(e){o({errorcode:Es.BASE_URL_CHANGED,servicelocation:e.entry})}function c(){o({errorcode:Es.BECAME_REPORTER})}function d(e){switch(e.metric){case s.HTTP_REQUEST:(0===(t=e.value).responsecode||t.responsecode>=400||t.responsecode<100||t.responsecode>=600)&&o({errorcode:t.responsecode||Es.CONNECTION_ERROR,url:t.url,terror:t.tresponse,servicelocation:t._serviceLocation})}var t}function f(e){let t;switch(e.error?e.error.code:0){case MediaError.MEDIA_ERR_NETWORK:t=Es.CONNECTION_ERROR;break;case MediaError.MEDIA_ERR_DECODE:t=Es.CORRUPT_MEDIA_OTHER;break;default:return}o({errorcode:t})}function g(){r.on(a.MANIFEST_UPDATED,l,t),r.on(a.SERVICE_LOCATION_BLACKLIST_CHANGED,u,t),r.on(a.METRIC_ADDED,d,t),r.on(a.METRIC_UPDATED,d,t),r.on(a.PLAYBACK_ERROR,f,t),r.on(_n.BECAME_REPORTING_PLAYER,c,t)}return t={initialise:g,reset:function(){r.off(a.MANIFEST_UPDATED,l,t),r.off(a.SERVICE_LOCATION_BLACKLIST_CHANGED,u,t),r.off(a.METRIC_ADDED,d,t),r.off(a.METRIC_UPDATED,d,t),r.off(a.PLAYBACK_ERROR,f,t),r.off(_n.BECAME_REPORTING_PLAYER,c,t)}},g(),t}Es.SSL_CONNECTION_FAILED_PREFIX="SSL",Es.DNS_RESOLUTION_FAILED="C00",Es.HOST_UNREACHABLE="C01",Es.CONNECTION_REFUSED="C02",Es.CONNECTION_ERROR="C03",Es.CORRUPT_MEDIA_ISOBMFF="M00",Es.CORRUPT_MEDIA_OTHER="M01",Es.BASE_URL_CHANGED="F00",Es.BECAME_REPORTER="S00",_s.__dashjs_factory_name="DVBErrorsTranslator";var Ts=dashjs.FactoryMaker.getSingletonFactory(_s);function ys(e){e=e||{};let t,n,r=!1,i=this.context,s=e.mediaElement;return t={initialize:function(e){e&&e.length&&(e.forEach(e=>{let t=e.starttime,r=t+e.duration;n.add(t,r)}),r=!!e[0]._useWallClockTime)},reset:function(){n.clear()},isEnabled:function(){let e,t=n.length;if(!t)return!0;e=r?(new Date).getTime()/1e3:s.currentTime;for(let r=0;r<t;r+=1){let t=n.start(r),i=n.end(r);if(t<=e&&e<i)return!0}return!1}},n=Z(i).create(),t}ys.__dashjs_factory_name="RangeController";var As=dashjs.FactoryMaker.getClassFactory(ys);function Ss(){return{serialise:function e(t){let n,r,i=[],s=[];for(n in t)if(t.hasOwnProperty(n)&&0!==n.indexOf("_")){if(r=t[n],null==r&&(r=""),Array.isArray(r)){if(!r.length)continue;s=[],r.forEach((function(t){let n="Object"!==Object.prototype.toString.call(t).slice(8,-1);s.push(n?t:e(t))})),r=s.map(encodeURIComponent).join(",")}else"string"==typeof r?r=encodeURIComponent(r):r instanceof Date?r=r.toISOString():"number"==typeof r&&(r=Math.round(r));i.push(n+"="+r)}return i.join("&")}}}Ss.__dashjs_factory_name="MetricSerialiser";var Is=dashjs.FactoryMaker.getSingletonFactory(Ss);function Rs(){let e,t,n,r=window.crypto||window.msCrypto,i=Uint32Array,s=Math.pow(2,8*i.BYTES_PER_ELEMENT)-1;function a(){r&&(e||(e=new i(10)),r.getRandomValues(e),t=0)}return n={random:function(n,i){let o;return n||(n=0),i||(i=1),r?(t===e.length&&a(),o=e[t]/s,t+=1):o=Math.random(),o*(i-n)+n}},a(),n}Rs.__dashjs_factory_name="RNG";var Ns=dashjs.FactoryMaker.getSingletonFactory(Rs);function Ds(e){let t;e=e||{};let n,r,i,s,a,o,l=this.context,u=[];const c=e.metricsConstants;function d(){i=!1,s=!1,a=null,o=null}return t={report:function(e,t){Array.isArray(t)||(t=[t]),s&&o.isEnabled()&&t.forEach((function(t){let r=n.serialise(t);e!==c.DVB_ERRORS&&(r=`metricname=${e}&${r}`),r=`${a}?${r}`,function(e,t,n){let r=new XMLHttpRequest;const i=function(){let e=u.indexOf(r);-1!==e&&(u.splice(e,1),r.status>=200&&r.status<300?t&&t():n&&n())};u.push(r);try{r.open("GET",e),r.onloadend=i,r.onerror=i,r.send()}catch(e){r.onerror()}}(r,null,(function(){s=!1}))}))},initialize:function(e,t){let n;if(o=t,a=e.dvb_reportingUrl,!a)throw new Error("required parameter missing (dvb:reportingUrl)");i||(n=e.dvb_probability,n&&(1e3===n||n/1e3>=r.random())&&(s=!0),i=!0)},reset:function(){d()}},n=Is(l).getInstance(),r=Ns(l).getInstance(),d(),t}Ds.__dashjs_factory_name="DVBReporting";var Cs=dashjs.FactoryMaker.getClassFactory(Ds);function bs(e){e=e||{};const t={"urn:dvb:dash:reporting:2014":Cs},n=this.context;let r;const i=e.debug?e.debug.getLogger(r):{},s=e.metricsConstants;return r={create:function(e,r){let a;try{a=t[e.schemeIdUri](n).create({metricsConstants:s}),a.initialize(e,r)}catch(t){a=null,i.error(`ReportingFactory: could not create Reporting with schemeIdUri ${e.schemeIdUri} (${t.message})`)}return a},register:function(e,n){t[e]=n},unregister:function(e){delete t[e]}},r}bs.__dashjs_factory_name="ReportingFactory";var vs=dashjs.FactoryMaker.getSingletonFactory(bs);function Ms(e){let t,n=[];const r=vs(this.context).getInstance(e);return t={initialize:function(e,t){e.some(e=>{let i=r.create(e,t);if(i)return n.push(i),!0})},reset:function(){n.forEach(e=>e.reset()),n=[]},report:function(e,t){n.forEach(n=>n.report(e,t))}},t}Ms.__dashjs_factory_name="ReportingController";var Os=dashjs.FactoryMaker.getClassFactory(Ms);function ws(){return{reconstructFullMetricName:function(e,t,n){let r=e;return t&&(r+="("+t,n&&n.length&&(r+=","+n),r+=")"),r},validateN:function(e){if(!e)throw new Error("missing n");if(isNaN(e))throw new Error("n is NaN");if(e<0)throw new Error("n must be positive");return e}}}ws.__dashjs_factory_name="HandlerHelpers";var Ls=dashjs.FactoryMaker.getSingletonFactory(ws);function Ps(e){let t,n,r,i,s,a;e=e||{};let o=this.context,l=Ls(o).getInstance(),u=[];const c=e.metricsConstants;function d(){let e=function(){try{return Object.keys(u).map(e=>u[e]).reduce((e,t)=>e.level<t.level?e:t)}catch(e){return}}();e&&a!==e.t&&(a=e.t,n.report(i,e))}return t={initialize:function(e,t,a){t&&(r=l.validateN(a),n=t,i=l.reconstructFullMetricName(e,a),s=setInterval(d,r))},reset:function(){clearInterval(s),s=null,r=0,n=null,a=null},handleNewMetric:function(e,t,n){e===c.BUFFER_LEVEL&&(u[n]=t)}},t}Ps.__dashjs_factory_name="BufferLevelHandler";var Fs=dashjs.FactoryMaker.getClassFactory(Ps);var xs=dashjs.FactoryMaker.getClassFactory((function(e){let t,n,r=(e=e||{}).eventBus;const i=e.metricsConstants;function s(){r.off(_n.METRICS_INITIALISATION_COMPLETE,s,this),r.trigger(_n.BECAME_REPORTING_PLAYER)}return t={initialize:function(e,t){t&&(n=t,r.on(_n.METRICS_INITIALISATION_COMPLETE,s,this))},reset:function(){n=null},handleNewMetric:function(e,t){e===i.DVB_ERRORS&&n&&n.report(e,t)}},t}));function Us(e){let t,n,r,i,s,a;e=e||{};let o=[],l=Ls(this.context).getInstance();const u=e.metricsConstants;function c(){var e=o;e.length&&n&&n.report(s,e),o=[]}return t={initialize:function(e,t,o,u){t&&(r=l.validateN(o),n=t,u&&u.length&&(i=u),s=l.reconstructFullMetricName(e,o,u),a=setInterval(c,r))},reset:function(){clearInterval(a),a=null,r=null,i=null,o=[],n=null},handleNewMetric:function(e,t){e===u.HTTP_REQUEST&&(i&&i!==t.type||o.push(t))}},t}Us.__dashjs_factory_name="HttpListHandler";var Bs=dashjs.FactoryMaker.getClassFactory(Us);function ks(){let e,t,n;return e={initialize:function(e,r){t=e,n=r},reset:function(){n=null,t=void 0},handleNewMetric:function(e,r){e===t&&n&&n.report(t,r)}},e}ks.__dashjs_factory_name="GenericMetricHandler";var Gs=dashjs.FactoryMaker.getClassFactory(ks);function Ys(e){let t;const n=(e=e||{}).debug?e.debug.getLogger(t):{};let r=/([a-zA-Z]*)(\(([0-9]*)(\,\s*([a-zA-Z]*))?\))?/;const i=this.context;let s={BufferLevel:Fs,DVBErrors:xs,HttpList:Bs,PlayList:Gs,RepSwitchList:Gs,TcpList:Gs};return t={create:function(t,a){var o,l=t.match(r);if(l){try{(o=s[l[1]](i).create({eventBus:e.eventBus,metricsConstants:e.metricsConstants})).initialize(l[1],a,l[3],l[5])}catch(e){o=null,n.error(`MetricsHandlerFactory: Could not create handler for type ${l[1]} with args ${l[3]}, ${l[5]} (${e.message})`)}return o}},register:function(e,t){s[e]=t},unregister:function(e){delete s[e]}},t}Ys.__dashjs_factory_name="MetricsHandlerFactory";var Ks=dashjs.FactoryMaker.getSingletonFactory(Ys);function qs(e){e=e||{};let t,n=[];const r=this.context,i=e.eventBus,s=e.events;let a=Ks(r).getInstance({debug:e.debug,eventBus:e.eventBus,metricsConstants:e.metricsConstants});function o(e){n.forEach(t=>{t.handleNewMetric(e.metric,e.value,e.mediaType)})}return t={initialize:function(e,r){e.split(",").forEach((e,t,i)=>{let s;if(-1!==e.indexOf("(")&&-1===e.indexOf(")")){let n=i[t+1];n&&-1===n.indexOf("(")&&-1!==n.indexOf(")")&&(e+=","+n,delete i[t+1])}s=a.create(e,r),s&&n.push(s)}),i.on(s.METRIC_ADDED,o,t),i.on(s.METRIC_UPDATED,o,t)},reset:function(){i.off(s.METRIC_ADDED,o,t),i.off(s.METRIC_UPDATED,o,t),n.forEach(e=>e.reset()),n=[]}},t}qs.__dashjs_factory_name="MetricsHandlersController";var Hs=dashjs.FactoryMaker.getClassFactory(qs);function Vs(e){let t,n,r,i;e=e||{};let s=this.context;function a(){t&&t.reset(),n&&n.reset(),r&&r.reset()}return i={initialize:function(i){try{r=As(s).create({mediaElement:e.mediaElement}),r.initialize(i.Range),n=Os(s).create({debug:e.debug,metricsConstants:e.metricsConstants}),n.initialize(i.Reporting,r),t=Hs(s).create({debug:e.debug,eventBus:e.eventBus,metricsConstants:e.metricsConstants,events:e.events}),t.initialize(i.metrics,n)}catch(e){throw a(),e}},reset:a},i}Vs.__dashjs_factory_name="MetricsController";var js=dashjs.FactoryMaker.getClassFactory(Vs);class zs{constructor(){this.metrics="",this.Range=[],this.Reporting=[]}}class Ws{constructor(){this.starttime=0,this.duration=1/0,this._useWallClockTime=!1}}class Xs{constructor(){this.schemeIdUri="",this.value="",this.dvb_reportingUrl="",this.dvb_probability=1e3}}function Qs(e){let t,n=(e=e||{}).adapter;const r=e.constants;return t={getMetrics:function(e){let t=[];return e&&e.Metrics_asArray&&e.Metrics_asArray.forEach(i=>{var s=new zs,a=n.getIsDynamic(e);i.hasOwnProperty("metrics")&&(s.metrics=i.metrics,i.Range_asArray&&i.Range_asArray.forEach(t=>{var i=new Ws;i.starttime=function(e,t,i){let s,a,o=0;return t?o=n.getAvailabilityStartTime(e)/1e3:(s=n.getRegularPeriods(e),s.length&&(o=s[0].start)),a=o,i&&i.hasOwnProperty(r.START_TIME)&&(a+=i.starttime),a}(e,a,t),t.hasOwnProperty("duration")?i.duration=t.duration:i.duration=n.getDuration(e),i._useWallClockTime=a,s.Range.push(i)}),i.Reporting_asArray&&(i.Reporting_asArray.forEach(e=>{var t=new Xs;e.hasOwnProperty(r.SCHEME_ID_URI)&&(t.schemeIdUri=e.schemeIdUri,e.hasOwnProperty("value")&&(t.value=e.value),e.hasOwnProperty(r.DVB_REPORTING_URL)&&(t.dvb_reportingUrl=e[r.DVB_REPORTING_URL]),e.hasOwnProperty(r.DVB_PROBABILITY)&&(t.dvb_probability=e[r.DVB_PROBABILITY]),s.Reporting.push(t))}),t.push(s)))}),t}},t}Qs.__dashjs_factory_name="ManifestParsing";var $s=dashjs.FactoryMaker.getSingletonFactory(Qs);function Zs(e){let t;e=e||{};let n={},r=this.context,i=e.eventBus;const s=e.events;function a(t){if(t.error)return;let s=Object.keys(n);$s(r).getInstance({adapter:e.adapter,constants:e.constants}).getMetrics(t.manifest).forEach(t=>{const i=JSON.stringify(t);if(n.hasOwnProperty(i))s.splice(i,1);else try{let s=js(r).create(e);s.initialize(t),n[i]=s}catch(e){}}),s.forEach(e=>{n[e].reset(),delete n[e]}),i.trigger(_n.METRICS_INITIALISATION_COMPLETE)}function o(){Object.keys(n).forEach(e=>{n[e].reset()}),n={}}return t={reset:function(){i.off(s.MANIFEST_UPDATED,a,t),i.off(s.STREAM_TEARDOWN_COMPLETE,o,t)}},i.on(s.MANIFEST_UPDATED,a,t),i.on(s.STREAM_TEARDOWN_COMPLETE,o,t),t}Zs.__dashjs_factory_name="MetricsCollectionController";var Js=dashjs.FactoryMaker.getClassFactory(Zs);function ea(){let e,t=this.context;return e={createMetricsReporting:function(e){return Ts(t).getInstance({eventBus:e.eventBus,dashMetrics:e.dashMetrics,metricsConstants:e.metricsConstants,events:e.events}),Js(t).create(e)},getReportingFactory:function(){return vs(t).getInstance()},getMetricsHandlerFactory:function(){return Ks(t).getInstance()}},e}ea.__dashjs_factory_name="MetricsReporting";const ta=dashjs.FactoryMaker.getClassFactory(ea);ta.events=_n,dashjs.FactoryMaker.updateClassFactory(ea.__dashjs_factory_name,ta);class na{static findCencContentProtection(e){let t=null;for(let n=0;n<e.length;++n){let r=e[n];"urn:mpeg:dash:mp4protection:2011"!==r.schemeIdUri.toLowerCase()||"cenc"!==r.value.toLowerCase()&&"cbcs"!==r.value.toLowerCase()||(t=r)}return t}static getPSSHData(e){let t=8,n=new DataView(e),r=n.getUint8(t);return t+=20,r>0&&(t+=4+16*n.getUint32(t)),t+=4,e.slice(t)}static getPSSHForKeySystem(e,t){let n=na.parsePSSHList(t);return e&&n.hasOwnProperty(e.uuid.toLowerCase())?n[e.uuid.toLowerCase()]:null}static parseInitDataFromContentProtection(e,t){return"pssh"in e?(e.pssh.__text=e.pssh.__text.replace(/\r?\n|\r/g,"").replace(/\s+/g,""),t.decodeArray(e.pssh.__text).buffer):null}static parsePSSHList(e){if(null==e)return[];let t=new DataView(e.buffer||e),n={},r=0;for(;;){let e,i,s,a,o,l,u=r;if(r>=t.buffer.byteLength)break;if(e=t.getUint32(r),i=r+e,r+=4,1886614376===t.getUint32(r))if(r+=4,s=t.getUint8(r),0===s||1===s){for(r++,r+=3,a="",o=0;o<4;o++)l=t.getUint8(r+o).toString(16),a+=1===l.length?"0"+l:l;for(r+=4,a+="-",o=0;o<2;o++)l=t.getUint8(r+o).toString(16),a+=1===l.length?"0"+l:l;for(r+=2,a+="-",o=0;o<2;o++)l=t.getUint8(r+o).toString(16),a+=1===l.length?"0"+l:l;for(r+=2,a+="-",o=0;o<2;o++)l=t.getUint8(r+o).toString(16),a+=1===l.length?"0"+l:l;for(r+=2,a+="-",o=0;o<6;o++)l=t.getUint8(r+o).toString(16),a+=1===l.length?"0"+l:l;r+=6,a=a.toLowerCase(),t.getUint32(r),r+=4,n[a]=t.buffer.slice(u,i),r=i}else r=i;else r=i}return n}}class ra{constructor(e,t){this.contentType=e,this.robustness=t}}class ia{constructor(e,t,n,r,i){this.initDataTypes=["cenc"],e&&e.length&&(this.audioCapabilities=e),t&&t.length&&(this.videoCapabilities=t),this.distinctiveIdentifier=n,this.persistentState=r,this.sessionTypes=i}}let sa=new class extends ge{constructor(){super(),this.MEDIA_KEYERR_CODE=100,this.MEDIA_KEYERR_UNKNOWN_CODE=101,this.MEDIA_KEYERR_CLIENT_CODE=102,this.MEDIA_KEYERR_SERVICE_CODE=103,this.MEDIA_KEYERR_OUTPUT_CODE=104,this.MEDIA_KEYERR_HARDWARECHANGE_CODE=105,this.MEDIA_KEYERR_DOMAIN_CODE=106,this.MEDIA_KEY_MESSAGE_ERROR_CODE=107,this.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_CODE=108,this.SERVER_CERTIFICATE_UPDATED_ERROR_CODE=109,this.KEY_STATUS_CHANGED_EXPIRED_ERROR_CODE=110,this.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_CODE=111,this.KEY_SYSTEM_ACCESS_DENIED_ERROR_CODE=112,this.KEY_SESSION_CREATED_ERROR_CODE=113,this.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE=114,this.MEDIA_KEYERR_UNKNOWN_MESSAGE="An unspecified error occurred. This value is used for errors that don't match any of the other codes.",this.MEDIA_KEYERR_CLIENT_MESSAGE="The Key System could not be installed or updated.",this.MEDIA_KEYERR_SERVICE_MESSAGE="The message passed into update indicated an error from the license service.",this.MEDIA_KEYERR_OUTPUT_MESSAGE="There is no available output device with the required characteristics for the content protection system.",this.MEDIA_KEYERR_HARDWARECHANGE_MESSAGE="A hardware configuration change caused a content protection error.",this.MEDIA_KEYERR_DOMAIN_MESSAGE="An error occurred in a multi-device domain licensing configuration. The most common error is a failure to join the domain.",this.MEDIA_KEY_MESSAGE_ERROR_MESSAGE="Multiple key sessions were creates with a user-agent that does not support sessionIDs!! Unpredictable behavior ahead!",this.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_MESSAGE="DRM: Empty key message from CDM",this.SERVER_CERTIFICATE_UPDATED_ERROR_MESSAGE="Error updating server certificate -- ",this.KEY_STATUS_CHANGED_EXPIRED_ERROR_MESSAGE="DRM: KeyStatusChange error! -- License has expired",this.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_MESSAGE="DRM: No license server URL specified!",this.KEY_SYSTEM_ACCESS_DENIED_ERROR_MESSAGE="DRM: KeySystem Access Denied! -- ",this.KEY_SESSION_CREATED_ERROR_MESSAGE="DRM: unable to create session! --",this.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE="DRM: licenser error! --"}};class aa{constructor(e,t,n,r,i,s,a,o){this.url=e,this.method=t,this.responseType=n,this.headers=r,this.withCredentials=i,this.messageType=s,this.sessionId=a,this.data=o}}class oa{constructor(e,t,n){this.url=e,this.headers=t,this.data=n}}function la(e){const t=(e=e||{}).protectionKeyController;let n=e.protectionModel;const r=e.eventBus,i=e.events,s=e.debug,a=e.BASE64,o=e.constants;let l=[];const u=e.cmcdModel;let c,d,f,g,h,p,m,E,_,T;function y(){if(!(r&&r.hasOwnProperty("on")&&t&&t.hasOwnProperty("getSupportedKeySystemsFromContentProtection")))throw new Error("Missing config parameter(s)")}function A(e,t){const s=na.getPSSHForKeySystem(E,e),a=N(E);if(s){if(S(s))return;try{n.createKeySession(s,a,C(E),t)}catch(e){r.trigger(i.KEY_SESSION_CREATED,{data:null,error:new G(sa.KEY_SESSION_CREATED_ERROR_CODE,sa.KEY_SESSION_CREATED_ERROR_MESSAGE+e.message)})}}else e?n.createKeySession(e,a,C(E),t):r.trigger(i.KEY_SESSION_CREATED,{data:null,error:new G(sa.KEY_SESSION_CREATED_ERROR_CODE,sa.KEY_SESSION_CREATED_ERROR_MESSAGE+"Selected key system is "+(E?E.systemString:null)+". needkey/encrypted event contains no initData corresponding to that key system!")})}function S(e){if(!e)return!1;try{const r=n.getAllInitData();for(let n=0;n<r.length;n++)if(t.initDataEquals(e,r[n]))return d.debug("DRM: Ignoring initData because we have already seen it!"),!0;return!1}catch(e){return!1}}function I(e,t){y(),n.loadKeySession(e,t,C(E))}function R(e){y(),e?(n.setMediaElement(e),r.on(i.NEED_KEY,w,this)):null===e&&(n.setMediaElement(e),r.off(i.NEED_KEY,w,this))}function N(e){let t=null;if(e){const n=e.systemString;h&&(t=n in h?h[n]:null)}return t}function D(e){const t=N(e),n=[],r=[],i=t&&t.audioRobustness&&t.audioRobustness.length>0?t.audioRobustness:m,s=t&&t.videoRobustness&&t.videoRobustness.length>0?t.videoRobustness:m,a=C(e),l=t&&t.distinctiveIdentifier?t.distinctiveIdentifier:"optional",u=t&&t.persistentState?t.persistentState:"temporary"===a?"optional":"required";return g.forEach(e=>{e.type===o.AUDIO?n.push(new ra(e.codec,i)):e.type===o.VIDEO&&r.push(new ra(e.codec,s))}),new ia(n,r,l,u,[a])}function C(e){const t=N(e);return t&&t.sessionType?t.sessionType:p}function b(e,s){e=e.sort((t,n)=>(h&&h[t.ks.systemString]&&h[t.ks.systemString].priority>=0?h[t.ks.systemString].priority:e.length)-(h&&h[n.ks.systemString]&&h[n.ks.systemString].priority>=0?h[n.ks.systemString].priority:e.length)),void 0===E?function(e,s){const o=this,l=[];let u,c;E=null,f.push(e);for(let t=0;t<e.length;t++)l.push({ks:e[t].ks,configs:[D(e[t].ks)]});const g=function(e){r.off(i.KEY_SYSTEM_ACCESS_COMPLETE,g,o),e.error?(E=void 0,r.off(i.INTERNAL_KEY_SYSTEM_SELECTED,h,o),s||r.trigger(i.KEY_SYSTEM_SELECTED,{data:null,error:new G(sa.KEY_SYSTEM_ACCESS_DENIED_ERROR_CODE,sa.KEY_SYSTEM_ACCESS_DENIED_ERROR_MESSAGE+e.error)})):(c=e.data,d.info("DRM: KeySystem Access Granted ("+c.keySystem.systemString+")! Selecting key system..."),n.selectKeySystem(c))};var h=function(e){if(r.off(i.INTERNAL_KEY_SYSTEM_SELECTED,h,o),r.off(i.KEY_SYSTEM_ACCESS_COMPLETE,g,o),e.error)E=void 0,s||r.trigger(i.KEY_SYSTEM_SELECTED,{data:null,error:new G(sa.KEY_SYSTEM_ACCESS_DENIED_ERROR_CODE,sa.KEY_SYSTEM_ACCESS_DENIED_ERROR_MESSAGE+"Error selecting key system! -- "+e.error)});else{if(!n)return;E=n.getKeySystem(),r.trigger(i.KEY_SYSTEM_SELECTED,{data:c});const e=N(E);e&&e.serverCertificate&&e.serverCertificate.length>0&&n.setServerCertificate(a.decodeArray(e.serverCertificate).buffer);for(let n=0;n<f.length;n++)for(u=0;u<f[n].length;u++)if(E===f[n][u].ks){if(t.isClearKey(E)&&e&&e.hasOwnProperty("clearkeys")){const t={kids:Object.keys(e.clearkeys)};f[n][u].initData=(new TextEncoder).encode(JSON.stringify(t))}f[n][u].sessionId?I(f[n][u].sessionId,f[n][u].initData):null!==f[n][u].initData&&A(f[n][u].initData,f[n][u].cdmData);break}}};r.on(i.INTERNAL_KEY_SYSTEM_SELECTED,h,o),r.on(i.KEY_SYSTEM_ACCESS_COMPLETE,g,o),n.requestKeySystemAccess(l)}(e,s):E?function(e,s){const a=this,o=[],l=e.findIndex(e=>e.ks===E);if(-1===l||!e[l].initData)return;if(S(na.getPSSHForKeySystem(E,e[l].initData)))return;o.push({ks:e[l].ks,configs:[D(E)]});const u=function(n){if(r.off(i.KEY_SYSTEM_ACCESS_COMPLETE,u,a),n.error)s||r.trigger(i.KEY_SYSTEM_SELECTED,{error:new G(sa.KEY_SYSTEM_ACCESS_DENIED_ERROR_CODE,sa.KEY_SYSTEM_ACCESS_DENIED_ERROR_MESSAGE+n.error)});else{d.info("DRM: KeySystem Access Granted"),r.trigger(i.KEY_SYSTEM_SELECTED,{data:n.data});const s=N(E);if(t.isClearKey(E)&&s&&s.hasOwnProperty("clearkeys")){const t={kids:Object.keys(s.clearkeys)};e[l].initData=(new TextEncoder).encode(JSON.stringify(t))}e[l].sessionId?I(e[l].sessionId,e[l].initData):e[l].initData&&A(e[l].initData,e[l].cdmData)}};r.on(i.KEY_SYSTEM_ACCESS_COMPLETE,u,a),n.requestKeySystemAccess(o)}(e,s):f.push(e)}function v(e,t){r.trigger(i.LICENSE_REQUEST_COMPLETE,{data:e,error:t})}function M(e){e.error?r.trigger(i.KEY_STATUSES_CHANGED,{data:null,error:e.error}):d.debug("DRM: key status = "+e.status)}function O(e){d.debug("DRM: onKeyMessage");const s=e.data;r.trigger(i.KEY_MESSAGE,{data:s});const a=s.messageType?s.messageType:"license-request",o=s.message,l=s.sessionToken,c=N(E),f=E?E.systemString:null,h=t.getLicenseServer(E,c,a),p={sessionToken:l,messageType:a};if(!o||0===o.byteLength)return void v(p,new G(sa.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_CODE,sa.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_MESSAGE));if(!h)return d.debug("DRM: License server request not required for this message (type = "+e.data.messageType+"). Session ID = "+l.getSessionID()),void v(p);if(t.isClearKey(E)){const e=t.processClearKeyLicenseRequest(E,c,o);if(e)return d.debug("DRM: ClearKey license request handled by application!"),v(p),void n.updateKeySession(l,e)}let m=null;if(c&&c.serverURL){const e=c.serverURL;"string"==typeof e&&""!==e?m=e:"object"==typeof e&&e.hasOwnProperty(a)&&(m=e[a])}else if(c&&c.laURL&&""!==c.laURL)m=c.laURL;else if(t.isClearKey(E))m=E.getLicenseServerUrlFromMediaInfo(g);else{const t=na.getPSSHData(l.initData);m=E.getLicenseServerURLFromInitData(t),m||(m=e.data.laURL)}if(m=h.getServerURLFromMessage(m,o,a),!m)return void v(p,new G(sa.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_CODE,sa.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_MESSAGE));const y={};let A=!1;const S=function(e){if(e)for(const t in e)"authorization"===t.toLowerCase()&&(A=!0),y[t]=e[t]};c&&S(c.httpRequestHeaders),S(E.getRequestHeadersFromMessage(o)),c&&"boolean"==typeof c.withCredentials&&(A=c.withCredentials);const I=function(e,t,n,r){const i=e.response?h.getErrorResponse(e.response,n,r):"NONE";v(t,new G(sa.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,sa.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE+n+' update, XHR complete. status is "'+e.statusText+'" ('+e.status+"), readyState is "+e.readyState+". Response is "+i))},R=function(e){if(n)if(200===e.status){let t=new oa(e.responseURL,gn.parseHttpHeaders(e.getAllResponseHeaders?e.getAllResponseHeaders():null),e.response);L(T,t).then(()=>{const r=h.getLicenseMessage(t.data,f,a);null!==r?(v(p),n.updateKeySession(l,r)):I(e,p,f,a)})}else I(e,p,f,a)},D=function(e){v(p,new G(sa.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,sa.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE+f+' update, XHR aborted. status is "'+e.statusText+'" ('+e.status+"), readyState is "+e.readyState))},C=function(e){v(p,new G(sa.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,sa.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE+f+' update, XHR error. status is "'+e.statusText+'" ('+e.status+"), readyState is "+e.readyState))},b=E.getLicenseRequestFromMessage(o),M=h.getHTTPMethod(a),O=h.getResponseType(f,a),w=c&&!isNaN(c.httpTimeout)?c.httpTimeout:8e3,P=l.getSessionID()||null;let x=new aa(m,M,O,y,A,a,P,b);L(_,x).then(()=>{!function e(t,n,s,a,o,l){const c=new XMLHttpRequest,f=u.getQueryParameter({url:t.url,type:F.LICENSE});f&&(t.url=gn.addAditionalQueryParameterToUrl(t.url,[f]));c.open(t.method,t.url,!0),c.responseType=t.responseType,c.withCredentials=t.withCredentials,s>0&&(c.timeout=s);for(const e in t.headers)c.setRequestHeader(e,t.headers[e]);const g=function(){n--,setTimeout((function(){e(t,n,s,a,o,l)}),1e3)};c.onload=function(){200===this.status||n<=0?a(this):(d.warn("License request failed ("+this.status+"). Retrying it... Pending retries: "+n),g())},c.ontimeout=c.onerror=function(){n<=0?l(this):(d.warn("License request network request failed . Retrying it... Pending retries: "+n),g())},c.onabort=function(){o(this)},r.trigger(i.LICENSE_REQUEST_SENDING,{url:t.url,headers:t.headers,payload:t.data,sessionId:t.sessionId}),c.send(t.data)}(x,3,w,R,D,C)})}function w(e,n){if(d.debug("DRM: onNeedKey"),"cenc"!==e.key.initDataType)return void d.warn("DRM: Only 'cenc' initData is supported! Ignoring initData of type: "+e.key.initDataType);if(0===g.length&&(d.warn("DRM: onNeedKey called before initializeForMedia, wait until initialized"),(n=void 0===n?1:n+1)<5))return void l.push(setTimeout(()=>{w(e,n)},500));let r=e.key.initData;if(ArrayBuffer.isView(r)&&(r=r.buffer),E){const e=na.getPSSHForKeySystem(E,r);if(e&&S(e))return}d.debug("DRM: initData:",String.fromCharCode.apply(null,new Uint8Array(r)));const i=t.getSupportedKeySystems(r,h);0!==i.length?b(i,!1):d.debug("DRM: Received needkey event with initData, but we don't support any of the key systems!")}function L(e,t){return e?e.reduce((e,n)=>e.then(()=>n(t)),Promise.resolve()):Promise.resolve()}return c={initializeForMedia:function(e){if(!e)throw new Error("mediaInfo can not be null or undefined");y(),r.on(i.INTERNAL_KEY_MESSAGE,O,this),r.on(i.INTERNAL_KEY_STATUS_CHANGED,M,this),g.push(e);const n=t.getSupportedKeySystemsFromContentProtection(e.contentProtection);n&&n.length>0&&b(n,!0)},clearMediaInfoArrayByStreamId:function(e){g=g.filter(t=>t.streamInfo.id!==e)},createKeySession:A,loadKeySession:I,removeKeySession:function(e){y(),n.removeKeySession(e)},closeKeySession:function(e){y(),n.closeKeySession(e)},setServerCertificate:function(e){y(),n.setServerCertificate(e)},setMediaElement:R,setSessionType:function(e){p=e},setRobustnessLevel:function(e){m=e},setProtectionData:function(e){h=e,t.setProtectionData(e)},getSupportedKeySystemsFromContentProtection:function(e){return y(),t.getSupportedKeySystemsFromContentProtection(e)},getKeySystems:function(){return t?t.getKeySystems():[]},setKeySystems:function(e){t&&t.setKeySystems(e)},setLicenseRequestFilters:function(e){_=e},setLicenseResponseFilters:function(e){T=e},stop:function(){n&&n.stop()},reset:function(){y(),_=[],T=[],r.off(i.INTERNAL_KEY_MESSAGE,O,this),r.off(i.INTERNAL_KEY_STATUS_CHANGED,M,this),R(null),E=void 0,n&&(n.reset(),n=null),l.forEach(e=>clearTimeout(e)),l=[],g=[]}},d=s.getLogger(c),f=[],g=[],p="temporary",m="",_=[],T=[],c}la.__dashjs_factory_name="ProtectionController";var ua=dashjs.FactoryMaker.getClassFactory(la);class ca{constructor(e,t){this.keyID=e,this.key=t}}class da{constructor(e,t){if(t&&"persistent"!==t&&"temporary"!==t)throw new Error("Invalid ClearKey key set type! Must be one of 'persistent' or 'temporary'");this.keyPairs=e,this.type=t}toJWK(){let e,t=this.keyPairs.length,n={keys:[]};for(e=0;e<t;e++){let t={kty:"oct",alg:"A128KW",kid:this.keyPairs[e].keyID,k:this.keyPairs[e].key};n.keys.push(t)}this.type&&(n.type=this.type);let r=JSON.stringify(n);const i=r.length;let s=new ArrayBuffer(i),a=new Uint8Array(s);for(e=0;e<i;e++)a[e]=r.charCodeAt(e);return s}}let fa=new class{init(){this.CLEARKEY_KEYSTEM_STRING="org.w3.clearkey",this.WIDEVINE_KEYSTEM_STRING="com.widevine.alpha",this.PLAYREADY_KEYSTEM_STRING="com.microsoft.playready"}constructor(){this.init()}};const ga="e2719d58-a985-b3c9-781a-b030af78d30e",ha=fa.CLEARKEY_KEYSTEM_STRING,pa="urn:uuid:"+ga;function ma(e){let t;const n=(e=e||{}).BASE64,r={attributes:["Laurl","laurl"],prefixes:["clearkey","dashif"]};return t={uuid:ga,schemeIdURI:pa,systemString:ha,getInitData:function(e,t){try{let r=na.parseInitDataFromContentProtection(e,n);if(!r&&t){const e={kids:[function(e){try{let t=e.replace(/-/g,"");return t=btoa(t.match(/\w{2}/g).map(e=>String.fromCharCode(parseInt(e,16))).join("")),t.replace(/=/g,"")}catch(e){return null}}(t["cenc:default_KID"])]};r=(new TextEncoder).encode(JSON.stringify(e))}return r}catch(e){return null}},getRequestHeadersFromMessage:function(){return{"Content-Type":"application/json"}},getLicenseRequestFromMessage:function(e){return JSON.parse(String.fromCharCode.apply(null,new Uint8Array(e)))},getLicenseServerURLFromInitData:function(){return null},getCDMData:function(){return null},getSessionId:function(){return null},getLicenseServerUrlFromMediaInfo:function(e){try{if(!e||0===e.length)return null;let t=0,n=null;for(;t<e.length&&!n;){const i=e[t];if(i&&i.contentProtection&&i.contentProtection.length>0){const e=i.contentProtection.filter(e=>e.schemeIdUri&&e.schemeIdUri===pa);if(e&&e.length>0){let t=0;for(;t<e.length&&!n;){const i=e[t];let s=0;for(;s<r.attributes.length&&!n;){let e=0;const t=r.attributes[s];for(;e<r.prefixes.length&&!n;){const s=r.prefixes[e];i[t]&&i[t].__prefix&&i[t].__prefix===s&&i[t].__text&&(n=i[t].__text),e+=1}s+=1}t+=1}}}t+=1}return n}catch(e){return null}},getClearKeysFromProtectionData:function(e,t){let n=null;if(e){const r=JSON.parse(String.fromCharCode.apply(null,new Uint8Array(t))),i=[];for(let t=0;t<r.kids.length;t++){const n=r.kids[t],s=e.clearkeys&&e.clearkeys.hasOwnProperty(n)?e.clearkeys[n]:null;if(!s)throw new Error("DRM: ClearKey keyID ("+n+") is not known!");i.push(new ca(n,s))}n=new da(i)}return n}},t}ma.__dashjs_factory_name="KeySystemClearKey";var Ea=dashjs.FactoryMaker.getSingletonFactory(ma);const _a="1077efec-c0b2-4d02-ace3-3c1e52e2fb4b",Ta=fa.CLEARKEY_KEYSTEM_STRING;function ya(e){let t;const n=e.BASE64,r=e.debug.getLogger(t);return t={uuid:_a,schemeIdURI:"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b",systemString:Ta,getInitData:function(e){return na.parseInitDataFromContentProtection(e,n)},getRequestHeadersFromMessage:function(){return null},getLicenseRequestFromMessage:function(e){return new Uint8Array(e)},getLicenseServerURLFromInitData:function(){return null},getCDMData:function(){return null},getSessionId:function(){return null},getClearKeysFromProtectionData:function(e,t){let n=null;if(e){const i=JSON.parse(String.fromCharCode.apply(null,new Uint8Array(t))),s=[];for(let t=0;t<i.kids.length;t++){const n=i.kids[t],r=e.clearkeys&&e.clearkeys.hasOwnProperty(n)?e.clearkeys[n]:null;if(!r)throw new Error("DRM: ClearKey keyID ("+n+") is not known!");s.push(new ca(n,r))}n=new da(s),r.warn("ClearKey schemeIdURI is using W3C Common PSSH systemID (1077efec-c0b2-4d02-ace3-3c1e52e2fb4b) in Content Protection. See DASH-IF IOP v4.1 section 7.6.2.4")}return n}},t}ya.__dashjs_factory_name="KeySystemW3CClearKey";var Aa=dashjs.FactoryMaker.getSingletonFactory(ya);const Sa="edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",Ia=fa.WIDEVINE_KEYSTEM_STRING;function Ra(e){let t,n=null;const r=(e=e||{}).BASE64;return t={uuid:Sa,schemeIdURI:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",systemString:Ia,init:function(e){e&&(n=e)},getInitData:function(e){return na.parseInitDataFromContentProtection(e,r)},getRequestHeadersFromMessage:function(){return null},getLicenseRequestFromMessage:function(e){return new Uint8Array(e)},getLicenseServerURLFromInitData:function(){return null},getCDMData:function(){return null},getSessionId:function(e){return n&&n.sessionId?n.sessionId:e&&e.sessionId?e.sessionId:null}},t}Ra.__dashjs_factory_name="KeySystemWidevine";var Na=dashjs.FactoryMaker.getSingletonFactory(Ra);const Da="9a04f079-9840-4286-ab92-e65be0885f95",Ca=fa.PLAYREADY_KEYSTEM_STRING;let ba;function va(e){let t,n="utf-16";const r=(e=e||{}).BASE64;function i(){if(!r||!r.hasOwnProperty("decodeArray")||!r.hasOwnProperty("decodeArray"))throw new Error("Missing config parameter(s)")}return t={uuid:Da,schemeIdURI:"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95",systemString:Ca,getInitData:function(e){const t=new Uint8Array([112,115,115,104,0,0,0,0]),n=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);let s,a,o,l,u,c=0,d=null;if(i(),!e)return null;if("pssh"in e)return na.parseInitDataFromContentProtection(e,r);if("pro"in e)d=r.decodeArray(e.pro.__text);else{if(!("prheader"in e))return null;d=r.decodeArray(e.prheader.__text)}return s=d.length,a=4+t.length+n.length+4+s,o=new ArrayBuffer(a),l=new Uint8Array(o),u=new DataView(o),u.setUint32(c,a),c+=4,l.set(t,c),c+=t.length,l.set(n,c),c+=n.length,u.setUint32(c,s),c+=4,l.set(d,c),c+=s,l.buffer},getRequestHeadersFromMessage:function(e){let t,r;const i={},s=new DOMParser,a="utf-16"===n?new Uint16Array(e):new Uint8Array(e);t=String.fromCharCode.apply(null,a),r=s.parseFromString(t,"application/xml");const o=r.getElementsByTagName("name"),l=r.getElementsByTagName("value");for(let e=0;e<o.length;e++)i[o[e].childNodes[0].nodeValue]=l[e].childNodes[0].nodeValue;return i.hasOwnProperty("Content")&&(i["Content-Type"]=i.Content,delete i.Content),i.hasOwnProperty("Content-Type")||(i["Content-Type"]="text/xml; charset=utf-8"),i},getLicenseRequestFromMessage:function(e){let t=null;const s=new DOMParser,a="utf-16"===n?new Uint16Array(e):new Uint8Array(e);i();const o=String.fromCharCode.apply(null,a),l=s.parseFromString(o,"application/xml");if(!l.getElementsByTagName("PlayReadyKeyMessage")[0])return e;{const e=l.getElementsByTagName("Challenge")[0].childNodes[0].nodeValue;e&&(t=r.decode(e))}return t},getLicenseServerURLFromInitData:function(e){if(e){const t=new DataView(e),n=t.getUint16(4,!0);let r=6;const i=new DOMParser;for(let s=0;s<n;s++){const n=t.getUint16(r,!0);r+=2;const s=t.getUint16(r,!0);if(r+=2,1!==n){r+=s;continue}const a=e.slice(r,r+s),o=String.fromCharCode.apply(null,new Uint16Array(a)),l=i.parseFromString(o,"application/xml");if(l.getElementsByTagName("LA_URL")[0]){const e=l.getElementsByTagName("LA_URL")[0].childNodes[0].nodeValue;if(e)return e}if(l.getElementsByTagName("LUI_URL")[0]){const e=l.getElementsByTagName("LUI_URL")[0].childNodes[0].nodeValue;if(e)return e}}}return null},getCDMData:function(){let e,t,n,s;if(i(),ba&&ba.cdmData){for(e=[],s=0;s<ba.cdmData.length;++s)e.push(ba.cdmData.charCodeAt(s)),e.push(0);for(e=String.fromCharCode.apply(null,e),e=r.encode(e),t='<PlayReadyCDMData type="LicenseAcquisition"><LicenseAcquisition version="1.0" Proactive="false"><CustomData encoding="base64encoded">%CUSTOMDATA%</CustomData></LicenseAcquisition></PlayReadyCDMData>'.replace("%CUSTOMDATA%",e),n=[],s=0;s<t.length;++s)n.push(t.charCodeAt(s)),n.push(0);return new Uint8Array(n).buffer}return null},getSessionId:function(e){return ba&&ba.sessionId?ba.sessionId:e&&e.sessionId?e.sessionId:null},setPlayReadyMessageFormat:function(e){if("utf-8"!==e&&"utf-16"!==e)throw new Error('Specified message format is not one of "utf-8" or "utf-16"');n=e},init:function(e){e&&(ba=e)}},t}va.__dashjs_factory_name="KeySystemPlayReady";var Ma=dashjs.FactoryMaker.getSingletonFactory(va);function Oa(e){const t=(e=e||{}).BASE64,n={};let r;return n[fa.WIDEVINE_KEYSTEM_STRING]={responseType:"json",getLicenseMessage:function(e){return t.decodeArray(e.license)},getErrorResponse:function(e){return e}},n[fa.PLAYREADY_KEYSTEM_STRING]={responseType:"arraybuffer",getLicenseMessage:function(e){return e},getErrorResponse:function(e){return String.fromCharCode.apply(null,new Uint8Array(e))}},r={getServerURLFromMessage:function(e){return e},getHTTPMethod:function(){return"POST"},getResponseType:function(e){return n[e].responseType},getLicenseMessage:function(e,r){return function(){if(!t||!t.hasOwnProperty("decodeArray"))throw new Error("Missing config parameter(s)")}(),n[r].getLicenseMessage(e)},getErrorResponse:function(e,t){return n[t].getErrorResponse(e)}},r}Oa.__dashjs_factory_name="DRMToday";var wa=dashjs.FactoryMaker.getSingletonFactory(Oa);function La(){let e;const t="http://schemas.xmlsoap.org/soap/envelope/";function n(e){const t=String.fromCharCode.apply(null,new Uint8Array(e));return decodeURIComponent(escape(t))}function r(e){if(window.DOMParser){const r=n(e),i=(new window.DOMParser).parseFromString(r,"text/xml"),s=i?i.getElementsByTagNameNS(t,"Envelope")[0]:null,a=s?s.getElementsByTagNameNS(t,"Body")[0]:null;if(a?a.getElementsByTagNameNS(t,"Fault")[0]:null)return null}return e}function i(e){let r="",i="",s="",a=-1,o=-1;if(window.DOMParser){const l=n(e),u=(new window.DOMParser).parseFromString(l,"text/xml"),c=u?u.getElementsByTagNameNS(t,"Envelope")[0]:null,d=c?c.getElementsByTagNameNS(t,"Body")[0]:null,f=d?d.getElementsByTagNameNS(t,"Fault")[0]:null,g=f?f.getElementsByTagName("detail")[0]:null,h=g?g.getElementsByTagName("Exception")[0]:null;let p=null;if(null===f)return l;p=f.getElementsByTagName("faultstring")[0].firstChild,r=p?p.nodeValue:null,null!==h&&(p=h.getElementsByTagName("StatusCode")[0],i=p?p.firstChild.nodeValue:null,p=h.getElementsByTagName("Message")[0],s=p?p.firstChild.nodeValue:null,a=s?s.lastIndexOf("[")+1:-1,o=s?s.indexOf("]"):-1,s=s?s.substring(a,o):"")}let l=`code: ${i}, name: ${r}`;return s&&(l+=", message: "+s),l}return e={getServerURLFromMessage:function(e){return e},getHTTPMethod:function(){return"POST"},getResponseType:function(){return"arraybuffer"},getLicenseMessage:function(e){return r.call(this,e)},getErrorResponse:function(e){return i.call(this,e)}},e}La.__dashjs_factory_name="PlayReady";var Pa=dashjs.FactoryMaker.getSingletonFactory(La);function Fa(){let e;return e={getServerURLFromMessage:function(e){return e},getHTTPMethod:function(){return"POST"},getResponseType:function(){return"arraybuffer"},getLicenseMessage:function(e){return e},getErrorResponse:function(e){return String.fromCharCode.apply(null,new Uint8Array(e))}},e}Fa.__dashjs_factory_name="Widevine";var xa=dashjs.FactoryMaker.getSingletonFactory(Fa);function Ua(){let e;return e={getServerURLFromMessage:function(e){return e},getHTTPMethod:function(){return"POST"},getResponseType:function(){return"json"},getLicenseMessage:function(e){if(!e.hasOwnProperty("keys"))return null;let t=[];for(let n=0;n<e.keys.length;n++){let r=e.keys[n],i=r.kid.replace(/=/g,""),s=r.k.replace(/=/g,"");t.push(new ca(i,s))}return new da(t)},getErrorResponse:function(e){return String.fromCharCode.apply(null,new Uint8Array(e))}},e}Ua.__dashjs_factory_name="ClearKey";var Ba=dashjs.FactoryMaker.getSingletonFactory(Ua);function ka(){let e,t,n,r,i,s,a,o=this.context;return e={initialize:function(){let e;r=[],e=Ma(o).getInstance({BASE64:i}),r.push(e),e=Na(o).getInstance({BASE64:i}),r.push(e),e=Ea(o).getInstance({BASE64:i}),r.push(e),s=e,e=Aa(o).getInstance({BASE64:i,debug:t}),r.push(e),a=e},setProtectionData:function(e){for(var t=function(t){var n=null;return e&&(n=t in e?e[t]:null),n},n=0;n<r.length;n++){var i=r[n];i.hasOwnProperty("init")&&i.init(t(i.systemString))}},isClearKey:function(e){return e===s||e===a},initDataEquals:function(e,t){if(e.byteLength===t.byteLength){let n=new Uint8Array(e),r=new Uint8Array(t);for(let e=0;e<n.length;e++)if(n[e]!==r[e])return!1;return!0}return!1},getKeySystems:function(){return r},setKeySystems:function(e){r=e},getKeySystemBySystemString:function(e){for(let t=0;t<r.length;t++)if(r[t].systemString===e)return r[t];return null},getSupportedKeySystemsFromContentProtection:function(e){let t,n,i,s,a=[];if(e){const o=na.findCencContentProtection(e);for(i=0;i<r.length;++i)for(n=r[i],s=0;s<e.length;++s)if(t=e[s],t.schemeIdUri.toLowerCase()===n.schemeIdURI){let e=n.getInitData(t,o);a.push({ks:r[i],initData:e,cdmData:n.getCDMData(),sessionId:n.getSessionId(t)})}}return a},getSupportedKeySystems:function(e,t){let n,i,s,a=[],o=na.parsePSSHList(e);for(let e=0;e<r.length;++e)n=r[e],i=n.systemString,s=!t||i in t,n.uuid in o&&s&&a.push({ks:n,initData:o[n.uuid],cdmData:n.getCDMData(),sessionId:n.getSessionId()});return a},getLicenseServer:function(e,t,n){if("license-release"===n||"individualization-request"===n)return null;let r=null;return t&&t.hasOwnProperty("drmtoday")?r=wa(o).getInstance({BASE64:i}):e.systemString===fa.WIDEVINE_KEYSTEM_STRING?r=xa(o).getInstance():e.systemString===fa.PLAYREADY_KEYSTEM_STRING?r=Pa(o).getInstance():e.systemString===fa.CLEARKEY_KEYSTEM_STRING&&(r=Ba(o).getInstance()),r},processClearKeyLicenseRequest:function(e,t,r){try{return e.getClearKeysFromProtectionData(t,r)}catch(e){return n.error("Failed to retrieve clearkeys from ProtectionData"),null}},setConfig:function(r){r&&(r.debug&&(t=r.debug,n=t.getLogger(e)),r.BASE64&&(i=r.BASE64))}},e}ka.__dashjs_factory_name="ProtectionKeyController";var Ga=dashjs.FactoryMaker.getSingletonFactory(ka);let Ya=new class extends N{constructor(){super(),this.INTERNAL_KEY_MESSAGE="internalKeyMessage",this.INTERNAL_KEY_SYSTEM_SELECTED="internalKeySystemSelected",this.INTERNAL_KEY_STATUS_CHANGED="internalkeyStatusChanged",this.KEY_ADDED="public_keyAdded",this.KEY_ERROR="public_keyError",this.KEY_MESSAGE="public_keyMessage",this.KEY_SESSION_CLOSED="public_keySessionClosed",this.KEY_SESSION_CREATED="public_keySessionCreated",this.KEY_SESSION_REMOVED="public_keySessionRemoved",this.KEY_STATUSES_CHANGED="public_keyStatusesChanged",this.KEY_SYSTEM_ACCESS_COMPLETE="public_keySystemAccessComplete",this.KEY_SYSTEM_SELECTED="public_keySystemSelected",this.LICENSE_REQUEST_COMPLETE="public_licenseRequestComplete",this.LICENSE_REQUEST_SENDING="public_licenseRequestSending",this.NEED_KEY="needkey",this.PROTECTION_CREATED="public_protectioncreated",this.PROTECTION_DESTROYED="public_protectiondestroyed",this.SERVER_CERTIFICATE_UPDATED="serverCertificateUpdated",this.TEARDOWN_COMPLETE="protectionTeardownComplete",this.VIDEO_ELEMENT_SELECTED="videoElementSelected"}};class Ka{constructor(e,t){this.initData=e,this.initDataType=t}}class qa{constructor(e,t,n,r){this.sessionToken=e,this.message=t,this.defaultURL=n,this.messageType=r||"license-request"}}class Ha{constructor(e,t){this.keySystem=e,this.ksConfiguration=t}}function Va(e){e=e||{};const t=this.context,n=e.eventBus,r=e.events,i=e.debug;let s,a,o,l,u,c,d,f;function g(e){const t=e.session;return t.removeEventListener("keystatuseschange",e),t.removeEventListener("message",e),t.close()}function h(e){for(let t=0;t<c.length;t++)if(c[t]===e){c.splice(t,1);break}}function p(e){let t,n;return e&&e.length>0&&(e[0]&&("string"==typeof e[0]?t=e[0]:n=e[0]),e[1]&&("string"==typeof e[1]?t=e[1]:n=e[1])),{status:t,keyId:n}}function m(e,t,i,s){const o={session:e,initData:t,sessionId:s,handleEvent:function(e){switch(e.type){case"keystatuseschange":n.trigger(r.KEY_STATUSES_CHANGED,{data:this}),e.target.keyStatuses.forEach((function(){let e=p(arguments);switch(e.status){case"expired":n.trigger(r.INTERNAL_KEY_STATUS_CHANGED,{error:new G(sa.KEY_STATUS_CHANGED_EXPIRED_ERROR_CODE,sa.KEY_STATUS_CHANGED_EXPIRED_ERROR_MESSAGE)});break;default:n.trigger(r.INTERNAL_KEY_STATUS_CHANGED,e)}}));break;case"message":let t=ArrayBuffer.isView(e.message)?e.message.buffer:e.message;n.trigger(r.INTERNAL_KEY_MESSAGE,{data:new qa(this,t,void 0,e.messageType)})}},getSessionID:function(){return e.sessionId},getExpirationTime:function(){return e.expiration},getKeyStatuses:function(){return e.keyStatuses},getUsable:function(){let t=!1;return e.keyStatuses.forEach((function(){let e=p(arguments);"usable"===e.status&&(t=!0)})),t},getSessionType:function(){return i}};return e.addEventListener("keystatuseschange",o),e.addEventListener("message",o),e.closed.then((function(){h(o),a.debug("DRM: Session closed. SessionID = "+o.getSessionID()),n.trigger(r.KEY_SESSION_CLOSED,{data:o.getSessionID()})})),c.push(o),o}return s={getAllInitData:function(){const e=[];for(let t=0;t<c.length;t++)c[t].initData&&e.push(c[t].initData);return e},requestKeySystemAccess:function(e){!function e(t,i){if(void 0===navigator.requestMediaKeySystemAccess||"function"!=typeof navigator.requestMediaKeySystemAccess)return void n.trigger(r.KEY_SYSTEM_ACCESS_COMPLETE,{error:"Insecure origins are not allowed"});!function(i){const s=t[i].ks,a=t[i].configs;let o=s.systemString;o===fa.PLAYREADY_KEYSTEM_STRING&&"required"===a[0].persistentState&&(o+=".recommendation"),navigator.requestMediaKeySystemAccess(o,a).then((function(e){const t="function"==typeof e.getConfiguration?e.getConfiguration():null,i=new Ha(s,t);i.mksa=e,n.trigger(r.KEY_SYSTEM_ACCESS_COMPLETE,{data:i})})).catch((function(s){++i<t.length?e(t,i):n.trigger(r.KEY_SYSTEM_ACCESS_COMPLETE,{error:"Key system access denied! "+s.message})}))}(i)}(e,0)},getKeySystem:function(){return o},selectKeySystem:function(e){e.mksa.createMediaKeys().then((function(t){o=e.keySystem,u=t,l?l.setMediaKeys(u).then((function(){n.trigger(r.INTERNAL_KEY_SYSTEM_SELECTED)})):n.trigger(r.INTERNAL_KEY_SYSTEM_SELECTED)})).catch((function(){n.trigger(r.INTERNAL_KEY_SYSTEM_SELECTED,{error:"Error selecting keys system ("+e.keySystem.systemString+")! Could not create MediaKeys -- TODO"})}))},setMediaElement:function(e){l!==e&&(l&&(l.removeEventListener("encrypted",d),l.setMediaKeys&&l.setMediaKeys(null)),l=e,l&&(l.addEventListener("encrypted",d),l.setMediaKeys&&u&&l.setMediaKeys(u)))},setServerCertificate:function(e){if(!o||!u)throw new Error("Can not set server certificate until you have selected a key system");u.setServerCertificate(e).then((function(){a.info("DRM: License server certificate successfully updated."),n.trigger(r.SERVER_CERTIFICATE_UPDATED)})).catch((function(e){n.trigger(r.SERVER_CERTIFICATE_UPDATED,{error:new G(sa.SERVER_CERTIFICATE_UPDATED_ERROR_CODE,sa.SERVER_CERTIFICATE_UPDATED_ERROR_MESSAGE+e.name)})}))},createKeySession:function(e,t,i){if(!o||!u)throw new Error("Can not create sessions until you have selected a key system");const s=u.createSession(i),l=m(s,e,i),c=this.getKeySystem().systemString===fa.CLEARKEY_KEYSTEM_STRING&&(e||t&&t.clearkeys)?"keyids":"cenc";s.generateRequest(c,e).then((function(){a.debug("DRM: Session created. SessionID = "+l.getSessionID()),n.trigger(r.KEY_SESSION_CREATED,{data:l})})).catch((function(e){h(l),n.trigger(r.KEY_SESSION_CREATED,{data:null,error:new G(sa.KEY_SESSION_CREATED_ERROR_CODE,sa.KEY_SESSION_CREATED_ERROR_MESSAGE+"Error generating key request -- "+e.name)})}))},updateKeySession:function(e,t){const i=e.session;f.isClearKey(o)&&(t=t.toJWK()),i.update(t).catch((function(t){n.trigger(r.KEY_ERROR,{data:new G(sa.MEDIA_KEYERR_CODE,"Error sending update() message! "+t.name,e)})}))},loadKeySession:function(e,t,i){if(!o||!u)throw new Error("Can not load sessions until you have selected a key system");for(let t=0;t<c.length;t++)if(e===c[t].sessionId)return void a.warn("DRM: Ignoring session ID because we have already seen it!");const s=u.createSession(i),l=m(s,t,i,e);s.load(e).then((function(t){t?(a.debug("DRM: Session loaded. SessionID = "+l.getSessionID()),n.trigger(r.KEY_SESSION_CREATED,{data:l})):(h(l),n.trigger(r.KEY_SESSION_CREATED,{data:null,error:new G(sa.KEY_SESSION_CREATED_ERROR_CODE,sa.KEY_SESSION_CREATED_ERROR_MESSAGE+"Could not load session! Invalid Session ID ("+e+")")}))})).catch((function(t){h(l),n.trigger(r.KEY_SESSION_CREATED,{data:null,error:new G(sa.KEY_SESSION_CREATED_ERROR_CODE,sa.KEY_SESSION_CREATED_ERROR_MESSAGE+"Could not load session ("+e+")! "+t.name)})}))},removeKeySession:function(e){e.session.remove().then((function(){a.debug("DRM: Session removed. SessionID = "+e.getSessionID()),n.trigger(r.KEY_SESSION_REMOVED,{data:e.getSessionID()})}),(function(t){n.trigger(r.KEY_SESSION_REMOVED,{data:null,error:"Error removing session ("+e.getSessionID()+"). "+t.name})}))},closeKeySession:function(e){g(e).catch((function(t){h(e),n.trigger(r.KEY_SESSION_CLOSED,{data:null,error:"Error closing session ("+e.getSessionID()+") "+t.name})}))},stop:function(){let e;for(let t=0;t<c.length;t++)e=c[t],e.getUsable()||g(e).catch((function(){h(e)}))},reset:function(){const e=c.length;let t;if(0!==e){const i=function(e){h(e),0===c.length&&(l?(l.removeEventListener("encrypted",d),l.setMediaKeys(null).then((function(){n.trigger(r.TEARDOWN_COMPLETE)}))):n.trigger(r.TEARDOWN_COMPLETE))};for(let n=0;n<e;n++)t=c[n],function(e){t.session.closed.then((function(){i(e)})),g(t).catch((function(){i(e)}))}(t)}else n.trigger(r.TEARDOWN_COMPLETE)}},a=i.getLogger(s),o=null,l=null,u=null,c=[],f=Ga(t).getInstance(),d={handleEvent:function(e){switch(e.type){case"encrypted":if(e.initData){let t=ArrayBuffer.isView(e.initData)?e.initData.buffer:e.initData;n.trigger(r.NEED_KEY,{key:new Ka(t,e.initDataType)})}}}},s}Va.__dashjs_factory_name="ProtectionModel_21Jan2015";var ja=dashjs.FactoryMaker.getClassFactory(Va);function za(e){e=e||{};const t=this.context,n=e.eventBus,r=e.events,i=e.debug,s=e.api;let a,o,l,u,c,d,f,g,h;function p(){try{for(let e=0;e<f.length;e++)m(f[e]);l&&l.removeEventListener(s.needkey,g),n.trigger(r.TEARDOWN_COMPLETE)}catch(e){n.trigger(r.TEARDOWN_COMPLETE,{error:"Error tearing down key sessions and MediaKeys! -- "+e.message})}}function m(e){const t=e.session;t.removeEventListener(s.error,e),t.removeEventListener(s.message,e),t.removeEventListener(s.ready,e),t.removeEventListener(s.close,e);for(let t=0;t<f.length;t++)if(f[t]===e){f.splice(t,1);break}t[s.release]()}function E(){let e=null;const t=function(){l.removeEventListener("loadedmetadata",e),l[s.setMediaKeys](c),n.trigger(r.VIDEO_ELEMENT_SELECTED)};l.readyState>=1?t():(e=t.bind(this),l.addEventListener("loadedmetadata",e))}return a={getAllInitData:function(){const e=[];for(let t=0;t<f.length;t++)e.push(f[t].initData);return e},requestKeySystemAccess:function(e){let t=!1;for(let i=0;i<e.length;i++){const a=e[i].ks.systemString,o=e[i].configs;let l=null,u=null;for(let e=0;e<o.length;e++){const i=o[e].audioCapabilities,c=o[e].videoCapabilities;if(i&&0!==i.length){l=[];for(let e=0;e<i.length;e++)window[s.MediaKeys].isTypeSupported(a,i[e].contentType)&&l.push(i[e])}if(c&&0!==c.length){u=[];for(let e=0;e<c.length;e++)window[s.MediaKeys].isTypeSupported(a,c[e].contentType)&&u.push(c[e])}if(!l&&!u||l&&0===l.length||u&&0===u.length)continue;t=!0;const d=new ia(l,u),f=h.getKeySystemBySystemString(a);n.trigger(r.KEY_SYSTEM_ACCESS_COMPLETE,{data:new Ha(f,d)});break}}t||n.trigger(r.KEY_SYSTEM_ACCESS_COMPLETE,{error:"Key system access denied! -- No valid audio/video content configurations detected!"})},getKeySystem:function(){return u},selectKeySystem:function(e){try{c=e.mediaKeys=new window[s.MediaKeys](e.keySystem.systemString),u=e.keySystem,d=e,l&&E(),n.trigger(r.INTERNAL_KEY_SYSTEM_SELECTED)}catch(e){n.trigger(r.INTERNAL_KEY_SYSTEM_SELECTED,{error:"Error selecting keys system ("+u.systemString+")! Could not create MediaKeys -- TODO"})}},setMediaElement:function(e){l!==e&&(l&&l.removeEventListener(s.needkey,g),l=e,l&&(l.addEventListener(s.needkey,g),c&&E()))},createKeySession:function(e,t,i,a){if(!u||!c||!d)throw new Error("Can not create sessions until you have selected a key system");let l=null;if(d.ksConfiguration.videoCapabilities&&d.ksConfiguration.videoCapabilities.length>0&&(l=d.ksConfiguration.videoCapabilities[0]),null===l&&d.ksConfiguration.audioCapabilities&&d.ksConfiguration.audioCapabilities.length>0&&(l=d.ksConfiguration.audioCapabilities[0]),null===l)throw new Error("Can not create sessions for unknown content types.");const g=l.contentType,h=c.createSession(g,new Uint8Array(e),a?new Uint8Array(a):null),p=function(e,t){return{session:e,initData:t,getSessionID:function(){return this.session.sessionId},getExpirationTime:function(){return NaN},getSessionType:function(){return"temporary"},handleEvent:function(e){switch(e.type){case s.error:let t="KeyError";n.trigger(r.KEY_ERROR,{data:new G(sa.MEDIA_KEYERR_CODE,t,this)});break;case s.message:let i=ArrayBuffer.isView(e.message)?e.message.buffer:e.message;n.trigger(r.INTERNAL_KEY_MESSAGE,{data:new qa(this,i,e.destinationURL)});break;case s.ready:o.debug("DRM: Key added."),n.trigger(r.KEY_ADDED);break;case s.close:o.debug("DRM: Session closed. SessionID = "+this.getSessionID()),n.trigger(r.KEY_SESSION_CLOSED,{data:this.getSessionID()})}}}}(h,e);h.addEventListener(s.error,p),h.addEventListener(s.message,p),h.addEventListener(s.ready,p),h.addEventListener(s.close,p),f.push(p),o.debug("DRM: Session created. SessionID = "+p.getSessionID()),n.trigger(r.KEY_SESSION_CREATED,{data:p})},updateKeySession:function(e,t){const n=e.session;h.isClearKey(u)?n.update(new Uint8Array(t.toJWK())):n.update(new Uint8Array(t))},closeKeySession:m,setServerCertificate:function(){},loadKeySession:function(){},removeKeySession:function(){},stop:p,reset:p},o=i.getLogger(a),l=null,u=null,c=null,d=null,f=[],h=Ga(t).getInstance(),g={handleEvent:function(e){switch(e.type){case s.needkey:if(e.initData){const t=ArrayBuffer.isView(e.initData)?e.initData.buffer:e.initData;n.trigger(r.NEED_KEY,{key:new Ka(t,"cenc")})}}}},a}za.__dashjs_factory_name="ProtectionModel_3Feb2014";var Wa=dashjs.FactoryMaker.getClassFactory(za);function Xa(e){e=e||{};const t=this.context,n=e.eventBus,r=e.events,i=e.debug,s=e.api,a=e.errHandler;let o,l,u,c,d,f,g,h,p;function m(){u&&T();for(let e=0;e<g.length;e++)E(g[e]);n.trigger(r.TEARDOWN_COMPLETE)}function E(e){try{u[s.cancelKeyRequest](c.systemString,e.sessionID)}catch(t){n.trigger(r.KEY_SESSION_CLOSED,{data:null,error:"Error closing session ("+e.sessionID+") "+t.message})}}function _(e,t){if(t&&e){const n=e.length;for(let r=0;r<n;r++)if(e[r].sessionID==t)return e[r];return null}return null}function T(){u.removeEventListener(s.keyerror,p),u.removeEventListener(s.needkey,p),u.removeEventListener(s.keymessage,p),u.removeEventListener(s.keyadded,p)}return o={getAllInitData:function(){const e=[];for(let t=0;t<f.length;t++)e.push(f[t].initData);for(let t=0;t<g.length;t++)e.push(g[t].initData);return e},requestKeySystemAccess:function(e){let t=u;t||(t=document.createElement("video"));let i=!1;for(let s=0;s<e.length;s++){const a=e[s].ks.systemString,o=e[s].configs;let l=null,u=null;for(let e=0;e<o.length;e++){const s=o[e].videoCapabilities;if(s&&0!==s.length){u=[];for(let e=0;e<s.length;e++)""!==t.canPlayType(s[e].contentType,a)&&u.push(s[e])}if(!u||l||u&&0===u.length)continue;i=!0;const c=new ia(l,u),f=d.getKeySystemBySystemString(a);n.trigger(r.KEY_SYSTEM_ACCESS_COMPLETE,{data:new Ha(f,c)});break}}i||n.trigger(r.KEY_SYSTEM_ACCESS_COMPLETE,{error:"Key system access denied! -- No valid audio/video content configurations detected!"})},getKeySystem:function(){return c},selectKeySystem:function(e){c=e.keySystem,n.trigger(r.INTERNAL_KEY_SYSTEM_SELECTED)},setMediaElement:function(e){if(u!==e){if(u){T();for(var t=0;t<g.length;t++)E(g[t]);g=[]}u=e,u&&(u.addEventListener(s.keyerror,p),u.addEventListener(s.needkey,p),u.addEventListener(s.keymessage,p),u.addEventListener(s.keyadded,p),n.trigger(r.VIDEO_ELEMENT_SELECTED))}},createKeySession:function(e){if(!c)throw new Error("Can not create sessions until you have selected a key system");if(h||0===g.length){const t={sessionID:null,initData:e,getSessionID:function(){return this.sessionID},getExpirationTime:function(){return NaN},getSessionType:function(){return"temporary"}};return f.push(t),u[s.generateKeyRequest](c.systemString,new Uint8Array(e)),t}throw new Error("Multiple sessions not allowed!")},updateKeySession:function(e,t){const n=e.sessionID;if(d.isClearKey(c))for(let e=0;e<t.keyPairs.length;e++)u[s.addKey](c.systemString,t.keyPairs[e].key,t.keyPairs[e].keyID,n);else u[s.addKey](c.systemString,new Uint8Array(t),new Uint8Array(e.initData),n)},closeKeySession:E,setServerCertificate:function(){},loadKeySession:function(){},removeKeySession:function(){},stop:m,reset:m},l=i.getLogger(o),u=null,c=null,f=[],g=[],d=Ga(t).getInstance(),p={handleEvent:function(e){let t=null;switch(e.type){case s.needkey:let i=ArrayBuffer.isView(e.initData)?e.initData.buffer:e.initData;n.trigger(r.NEED_KEY,{key:new Ka(i,"cenc")});break;case s.keyerror:if(t=_(g,e.sessionId),t||(t=_(f,e.sessionId)),t){let i=sa.MEDIA_KEYERR_CODE,s="";switch(e.errorCode.code){case 1:i=sa.MEDIA_KEYERR_UNKNOWN_CODE,s+="MEDIA_KEYERR_UNKNOWN - "+sa.MEDIA_KEYERR_UNKNOWN_MESSAGE;break;case 2:i=sa.MEDIA_KEYERR_CLIENT_CODE,s+="MEDIA_KEYERR_CLIENT - "+sa.MEDIA_KEYERR_CLIENT_MESSAGE;break;case 3:i=sa.MEDIA_KEYERR_SERVICE_CODE,s+="MEDIA_KEYERR_SERVICE - "+sa.MEDIA_KEYERR_SERVICE_MESSAGE;break;case 4:i=sa.MEDIA_KEYERR_OUTPUT_CODE,s+="MEDIA_KEYERR_OUTPUT - "+sa.MEDIA_KEYERR_OUTPUT_MESSAGE;break;case 5:i=sa.MEDIA_KEYERR_HARDWARECHANGE_CODE,s+="MEDIA_KEYERR_HARDWARECHANGE - "+sa.MEDIA_KEYERR_HARDWARECHANGE_MESSAGE;break;case 6:i=sa.MEDIA_KEYERR_DOMAIN_CODE,s+="MEDIA_KEYERR_DOMAIN - "+sa.MEDIA_KEYERR_DOMAIN_MESSAGE}s+=" System Code = "+e.systemCode,n.trigger(r.KEY_ERROR,{data:new G(i,s,t)})}else l.error("No session token found for key error");break;case s.keyadded:t=_(g,e.sessionId),t||(t=_(f,e.sessionId)),t?(l.debug("DRM: Key added."),n.trigger(r.KEY_ADDED,{data:t})):l.debug("No session token found for key added");break;case s.keymessage:if(h=null!==e.sessionId&&void 0!==e.sessionId,h?(t=_(g,e.sessionId),!t&&f.length>0&&(t=f.shift(),g.push(t),t.sessionID=e.sessionId,n.trigger(r.KEY_SESSION_CREATED,{data:t}))):f.length>0&&(t=f.shift(),g.push(t),0!==f.length&&a.error(new G(sa.MEDIA_KEY_MESSAGE_ERROR_CODE,sa.MEDIA_KEY_MESSAGE_ERROR_MESSAGE))),t){let i=ArrayBuffer.isView(e.message)?e.message.buffer:e.message;t.keyMessage=i,n.trigger(r.INTERNAL_KEY_MESSAGE,{data:new qa(t,i,e.defaultURL)})}else l.warn("No session token found for key message")}}},o}Xa.__dashjs_factory_name="ProtectionModel_01b";var Qa=dashjs.FactoryMaker.getClassFactory(Xa);const $a=[{generateKeyRequest:"generateKeyRequest",addKey:"addKey",cancelKeyRequest:"cancelKeyRequest",needkey:"needkey",keyerror:"keyerror",keyadded:"keyadded",keymessage:"keymessage"},{generateKeyRequest:"webkitGenerateKeyRequest",addKey:"webkitAddKey",cancelKeyRequest:"webkitCancelKeyRequest",needkey:"webkitneedkey",keyerror:"webkitkeyerror",keyadded:"webkitkeyadded",keymessage:"webkitkeymessage"}],Za=[{setMediaKeys:"setMediaKeys",MediaKeys:"MediaKeys",release:"close",needkey:"needkey",error:"keyerror",message:"keymessage",ready:"keyadded",close:"keyclose"},{setMediaKeys:"msSetMediaKeys",MediaKeys:"MSMediaKeys",release:"close",needkey:"msneedkey",error:"mskeyerror",message:"mskeymessage",ready:"mskeyadded",close:"mskeyclose"}];function Ja(){let e;const t=this.context;function n(e,t){for(let n=0;n<t.length;n++){const r=t[n];if("function"==typeof e[r[Object.keys(r)[0]]])return r}return null}return e={createProtectionSystem:function(r){let i=null;const s=Ga(t).getInstance();s.setConfig({debug:r.debug,BASE64:r.BASE64}),s.initialize();let a=function(r){const i=r.debug,s=i.getLogger(e),a=r.eventBus,o=r.errHandler,l=r.videoModel?r.videoModel.getElement():null;return l&&void 0===l.onencrypted||l&&void 0===l.mediaKeys?n(l,Za)?(s.info("EME detected on this user agent! (ProtectionModel_3Feb2014)"),Wa(t).create({debug:i,eventBus:a,events:r.events,api:n(l,Za)})):n(l,$a)?(s.info("EME detected on this user agent! (ProtectionModel_01b)"),Qa(t).create({debug:i,eventBus:a,errHandler:o,events:r.events,api:n(l,$a)})):(s.warn("No supported version of EME detected on this user agent! - Attempts to play encrypted content will fail!"),null):(s.info("EME detected on this user agent! (ProtectionModel_21Jan2015)"),ja(t).create({debug:i,eventBus:a,events:r.events}))}(r);return!i&&a&&(i=ua(t).create({protectionModel:a,protectionKeyController:s,eventBus:r.eventBus,debug:r.debug,events:r.events,BASE64:r.BASE64,constants:r.constants,cmcdModel:r.cmcdModel}),r.capabilities.setEncryptedMediaSupported(!0)),i}},e}Ja.__dashjs_factory_name="Protection";const eo=dashjs.FactoryMaker.getClassFactory(Ja);eo.events=Ya,eo.errors=sa,dashjs.FactoryMaker.updateClassFactory(Ja.__dashjs_factory_name,eo);let to,no=function(){let e;function t(t,n,r){if(!t||!/^VIDEO$/i.test(t.nodeName))return null;if(t._dashjs_player)return t._dashjs_player;let i,s=t.id||t.name||"video element";if(!(n=n||[].slice.call(t.querySelectorAll("source")).filter((function(e){return"application/dash+xml"==e.type}))[0])&&t.src)(n=document.createElement("source")).src=t.src;else if(!n&&!t.src)return null;return i=hs(r=r||{}).create(),i.initialize(t,n.src,t.autoplay),e||(e=i.getDebug().getLogger()),e.debug("Converted "+s+" to dash.js player and added content: "+n.src),t._dashjs_player=i,i}function n(e){return/^VIDEO$/i.test(e.nodeName)?e:n(e.parentNode)}return{create:t,createAll:function(e,r){let i=[];e=e||"[data-dashjs-player]";let s=(r=r||document).querySelectorAll(e);for(let e=0;e<s.length;e++){let n=t(s[e],null);i.push(n)}let a=r.querySelectorAll('source[type="application/dash+xml"]');for(let e=0;e<a.length;e++){let r=t(n(a[e]),null);i.push(r)}return i}}}();!("undefined"!=typeof window&&window&&window.dashjs&&window.dashjs.skipAutoCreate)&&"undefined"!=typeof window&&window&&window.addEventListener&&("complete"===window.document.readyState?window.dashjs?no.createAll():to=window.setInterval((function(){window.dashjs&&(window.clearInterval(to),no.createAll())}),500):window.addEventListener("load",(function e(){window.removeEventListener("load",e),no.createAll()}))),dashjs.Protection=eo,dashjs.MetricsReporting=ta,dashjs.MediaPlayerFactory=no,dashjs.Debug=w,dashjs.supportsMediaSource=hi,dashjs;var ro="audio:set",io="audio:update",so="audio:tracks";function ao(e,t,n){const r=function(e){return Array.isArray(e)?e.slice(0):e.split(".")}(t);for(;r.length;){if(null==e)return n;const t=r.shift();if("string"!=typeof t)return n;e=e[t]}return null==e?n:e}function oo(e,t,n,r){if(r){var i=ao(e,"dash",{});n.dash&&(n.emit("recover",{type:"dash"}),co(n));var s=!ao(e,"live",!1),a={seek_timer:null,initial_stream_init:!0,errored:!1,recover_count:0};n.reaper.put("dash",hs().create()),n.on("recover",(function(e){go(n,r.src,e)})),n.on("src",(function(e){co(n)})),n.on("reap",(function(e){co(n)})),n.on("quality:set",(function(e){uo(n,e)})),n.on(ro,(function(e){lo(n,e)}));var o=!!e.autoplay;if(e.autoplay=!1,n.dash.on(hs.events.SOURCE_INITIALIZED,(function(){a.initial_stream_init=!0,a.recover_count=0,o&&(e.autoplay=!0,n.dash.setAutoPlay(!0))})),n.dash.on(hs.events.STREAM_INITIALIZED,(function(){s&&n.setOpts({live:n.dash.isDynamic()}),function(e){var t=(e.dash.getBitrateInfoListFor("video")||[]).sort((function(e,t){return t.width-e.width}));t.push({text:"AUTO",qualityIndex:-1}),e.emit("qualities",t)}(n),function(e,t){if(!t.initial_stream_init)return;t.initial_stream_init=!1;var n=(e.dash.getTracksFor("audio")||[]).map((function(e){return e.autoselect=!0,e}));e.emit(so,n)}(n,a)})),n.dash.on(hs.events.TRACK_CHANGE_RENDERED,(function(e){"audio"===e.mediaType&&e.newMediaInfo&&n.emit(io,e.newMediaInfo)})),n.dash.on(hs.events.PLAYBACK_PROGRESS,(function(){!function(e){var t=e.dash.isDynamic(),n=function(e,t){var n=e.dash.getDashMetrics().getCurrentDVRInfo(t);return n?n.range:0}(e,"video"),r=e.dash.getDVRWindowSize(),i=t?e.dash.getDVRSeekOffset(e.dash.duration()):0;e.setOpts({live:t,initial_live_offset:e.opts.initial_live_offset||e.currentTime,live_duration:e.currentTime-e.opts.initial_live_offset||0,live_now:i,live_rebuffer_budget:0,live_dvr_window:t?r:0,live_seekable_range:n?{head:n.end,tail:Math.max(n.end-r,n.start)}:0})}(n)})),n.dash.on(hs.events.ERROR,(function(e){fo(n,a,e)})),n.dash.on(hs.events.PLAYBACK_SEEKING,(function(){!function(e,t){ho(e),e.seek_timer=setTimeout(t,1e4)}(a,(function(){!function(e,t){e.seek_timer=0,t.emit("recover",{type:"dash"})}(a,n)}))})),n.dash.on(hs.events.PLAYBACK_SEEKED,(function(){ho(a)})),n.dash.on(eo.events.KEY_ERROR,(function(e){fo(n,a,e)})),n.dash.on(eo.events.LICENSE_REQUEST_COMPLETE,(function(e){e.error&&fo(n,a,e)})),i.drm){if("https:"!==location.protocol&&"localhost"!==location.hostname&&"127.0.0.1"!==location.hostname)return void n.emit("error",{message:"Secure page required for DRM"});n.dash.setProtectionData(i.drm)}n.dash.initialize(n,r.src,!!e.autoplay)}}function lo(e,t){e.dash.setCurrentTrack(t.data)}function uo(e,t){var n=t.data.qualityIndex,r={streaming:{abr:{autoSwitchBitrate:{video:-1===n}}}};e.dash.updateSettings(r),-1!==n&&e.dash.setQualityFor("video",n)}function co(e){e.dash&&e.dash.reset(),e.off(ro,lo),e.off("quality:set",uo)}function fo(e,t,n){if(ao(n,"error.code")!=hs.errors.DOWNLOAD_ERROR_ID_CONTENT_CODE&&!t.errored){if(t.recover_count<3)return t.recover_count+=1,void go(e,e.src);t.errored=!0,e.emit("error",{message:ao(n,"error.message",ao(n,"event.message","playback failed"))}),co(e)}}function go(e,t,n){0!=e.reaper&&(n&&"dash"!==ao(n,"data.type")||(e.dash.setAutoPlay(!0),e.dash.attachSource(t)))}function ho(e){e.seek_timer&&(clearTimeout(e.seek_timer),e.seek_timer=0)}return oo.wants=function(e,t){if(t&&t.drm&&(0===Object.keys(t.drm).filter((function(e){return t=e,[f,g,h].filter((function(e){return e===t})).length;var t})).length||(n="undefined"!=typeof document&&"undefined"!=typeof window,r=n?navigator.userAgent:"",i=/iP(hone|od)/i.test(r)&&!/iPad/.test(r)&&!/IEMobile/i.test(r),s=/Android/.test(r)&&!/Firefox/.test(r),a=/IEMobile/.test(r),o=a?d(r,/Windows Phone (\d+\.\d+)/):0,l=a?d(r,/IEMobile\/(\d+\.\d+)/):0,u=/^((?!chrome|android).)*safari/i.test(r),p=/SamsungBrowser/.test(r),T=p&&/SMART-TV/.test(r),y=i&&/FBSN\/iOS/i.test(r),A=function(){if(!n)return!1;if(document.documentMode)return document.documentMode;for(var e=9;e>3;e--){var t=document.createElement("div");if(t.innerHTML="\x3c!--[if IE "+e+"]><span></span><![endif]--\x3e",t.getElementsByTagName("span").length)return e}return!1}(),{controls:!i&&(!a||o>=8.1&&l>=11),video:function(e){return n&&document.createElement("video").canPlayType(e)},lang:n&&(window.navigator.userLanguage||window.navigator.language),android:s,iphone:i,ie:A,safari:u,ios:n&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,samsung:p,samsung_tv:p&&T,fb_ios:y}).safari))return!1;var n,r,i,s,a,o,l,u,p,T,y,A;if(_(e)&&e.type&&~m.indexOf(e.type))return e.src;if(_(e)&&e.src&&E(e.src))return e.src;for(var S=(e=Array.isArray(e)?e:c(e)).length-1;S>=0;S--){var I=e[S];if(I.type&&~m.indexOf(I.type))return I.src;if(E(I.src))return I.src}return!1},"function"==typeof MediaSource&&function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});var n=e.flowplayer;"function"==typeof n?n(t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t))}(window,oo),oo}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("stream"),require("string_decoder")):"function"==typeof define&&define.amd?define(["stream","string_decoder"],t):((e="undefined"!=typeof globalThis?globalThis:e||self).flowplayer=e.flowplayer||{},e.flowplayer.dash=t(e.require$$0,e.require$$1))}(this,(function(e,t){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=n(e),i=n(t);const o=["com.widevine.alpha","com.microsoft.playready","org.w3.clearkey"];function u(e){const{pathname:t}=function(e){const t=document.createElement("a");return t.href=e,t}(e);return t.endsWith(".mpd")}function l(e,t,n){return!function(){const e="undefined"!=typeof document&&"undefined"!=typeof window,t=e?navigator.userAgent:"",n=/iP(hone|od)/i.test(t)&&!/iPad/.test(t)&&!/IEMobile/i.test(t),r=/Android/.test(t)&&!/Firefox/.test(t),i=/^((?!chrome|android).)*safari/i.test(t),a=/SamsungBrowser/.test(t),o=a&&/SMART-TV/.test(t);return{controls:!n,video:function(t){return e&&document.createElement("video").canPlayType(t)},lang:e&&window.navigator.language,android:r,iphone:n,safari:i,ios:e&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,samsung:a,samsung_tv:a&&o}}().safari&&(!(t.drm&&!Object.keys(t.drm).some(e=>{return t=e,o.find((function(e){return e===t}));var t}))&&("application/dash+xml"==t.type||u(e)))}var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function f(e){var t={exports:{}};return e(t,t.exports),t.exports}var c=f((function(e,t){!function(e){var t={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},n=function(e){var n=e;return t.hasOwnProperty(e)&&(n=t[e]),String.fromCharCode(n)},r={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},i={17:2,18:4,21:6,22:8,23:10,19:13,20:15},a={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},o={25:2,26:4,29:6,30:8,31:10,27:13,28:15},s=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],u={verboseFilter:{DATA:3,DEBUG:3,INFO:2,WARNING:2,TEXT:1,ERROR:0},time:null,verboseLevel:0,setTime:function(e){this.time=e},log:function(e,t){var n=this.verboseFilter[e];this.verboseLevel>=n&&console.log(this.time+" ["+e+"] "+t)}},l=function(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n].toString(16));return t},d=function(e,t,n,r,i){this.foreground=e||"white",this.underline=t||!1,this.italics=n||!1,this.background=r||"black",this.flash=i||!1};d.prototype={reset:function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1},setStyles:function(e){for(var t=["foreground","underline","italics","background","flash"],n=0;n<t.length;n++){var r=t[n];e.hasOwnProperty(r)&&(this[r]=e[r])}},isDefault:function(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash},equals:function(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash},copy:function(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash},toString:function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}};var f=function(e,t,n,r,i,a){this.uchar=e||" ",this.penState=new d(t,n,r,i,a)};f.prototype={reset:function(){this.uchar=" ",this.penState.reset()},setChar:function(e,t){this.uchar=e,this.penState.copy(t)},setPenState:function(e){this.penState.copy(e)},equals:function(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)},copy:function(e){this.uchar=e.uchar,this.penState.copy(e.penState)},isEmpty:function(){return" "===this.uchar&&this.penState.isDefault()}};var c=function(){this.chars=[];for(var e=0;e<32;e++)this.chars.push(new f);this.pos=0,this.currPenState=new d};c.prototype={equals:function(e){for(var t=!0,n=0;n<32;n++)if(!this.chars[n].equals(e.chars[n])){t=!1;break}return t},copy:function(e){for(var t=0;t<32;t++)this.chars[t].copy(e.chars[t])},isEmpty:function(){for(var e=!0,t=0;t<32;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e},setCursor:function(e){this.pos!==e&&(this.pos=e),this.pos<0?(u.log("ERROR","Negative cursor position "+this.pos),this.pos=0):this.pos>32&&(u.log("ERROR","Too large cursor position "+this.pos),this.pos=32)},moveCursor:function(e){var t=this.pos+e;if(e>1)for(var n=this.pos+1;n<t+1;n++)this.chars[n].setPenState(this.currPenState);this.setCursor(t)},backSpace:function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)},insertChar:function(e){e>=144&&this.backSpace();var t=n(e);this.pos>=32?u.log("ERROR","Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1))},clearFromPos:function(e){var t;for(t=e;t<32;t++)this.chars[t].reset()},clear:function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},clearToEndOfRow:function(){this.clearFromPos(this.pos)},getTextString:function(){for(var e=[],t=!0,n=0;n<32;n++){var r=this.chars[n].uchar;" "!==r&&(t=!1),e.push(r)}return t?"":e.join("")},setPenStyles:function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}};var g=function(){this.rows=[];for(var e=0;e<15;e++)this.rows.push(new c);this.currRow=14,this.nrRollUpRows=null,this.reset()};g.prototype={reset:function(){for(var e=0;e<15;e++)this.rows[e].clear();this.currRow=14},equals:function(e){for(var t=!0,n=0;n<15;n++)if(!this.rows[n].equals(e.rows[n])){t=!1;break}return t},copy:function(e){for(var t=0;t<15;t++)this.rows[t].copy(e.rows[t])},isEmpty:function(){for(var e=!0,t=0;t<15;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e},backSpace:function(){this.rows[this.currRow].backSpace()},clearToEndOfRow:function(){this.rows[this.currRow].clearToEndOfRow()},insertChar:function(e){this.rows[this.currRow].insertChar(e)},setPen:function(e){this.rows[this.currRow].setPenStyles(e)},moveCursor:function(e){this.rows[this.currRow].moveCursor(e)},setCursor:function(e){u.log("INFO","setCursor: "+e),this.rows[this.currRow].setCursor(e)},setPAC:function(e){u.log("INFO","pacData = "+JSON.stringify(e));var t=e.row-1;this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.currRow=t;var n=this.rows[this.currRow];if(null!==e.indent){var r=e.indent,i=Math.max(r-1,0);n.setCursor(e.indent),e.color=n.chars[i].penState.foreground}var a={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(a)},setBkgData:function(e){u.log("INFO","bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)},setRollUpRows:function(e){this.nrRollUpRows=e},rollUp:function(){if(null!==this.nrRollUpRows){u.log("TEXT",this.getDisplayText());var e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),u.log("INFO","Rolling up")}else u.log("DEBUG","roll_up but nrRollUpRows not set yet")},getDisplayText:function(e){e=e||!1;for(var t=[],n="",r=-1,i=0;i<15;i++){var a=this.rows[i].getTextString();a&&(r=i+1,e?t.push("Row "+r+': "'+a+'"'):t.push(a.trim()))}return t.length>0&&(n=e?"["+t.join(" | ")+"]":t.join("\n")),n},getTextAndFormat:function(){return this.rows}};var h=function(e,t){this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new g,this.nonDisplayedMemory=new g,this.lastOutputScreen=new g,this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null};h.prototype={modes:["MODE_ROLL-UP","MODE_POP-ON","MODE_PAINT-ON","MODE_TEXT"],reset:function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.lastCueEndTime=null},getHandler:function(){return this.outputFilter},setHandler:function(e){this.outputFilter=e},setPAC:function(e){this.writeScreen.setPAC(e)},setBkgData:function(e){this.writeScreen.setBkgData(e)},setMode:function(e){e!==this.mode&&(this.mode=e,u.log("INFO","MODE="+e),"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=e)},insertChars:function(e){for(var t=0;t<e.length;t++)this.writeScreen.insertChar(e[t]);var n=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";u.log("INFO",n+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(u.log("TEXT","DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())},cc_RCL:function(){u.log("INFO","RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")},cc_BS:function(){u.log("INFO","BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())},cc_AOF:function(){},cc_AON:function(){},cc_DER:function(){u.log("INFO","DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()},cc_RU:function(e){u.log("INFO","RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)},cc_FON:function(){u.log("INFO","FON - Flash On"),this.writeScreen.setPen({flash:!0})},cc_RDC:function(){u.log("INFO","RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")},cc_TR:function(){u.log("INFO","TR"),this.setMode("MODE_TEXT")},cc_RTD:function(){u.log("INFO","RTD"),this.setMode("MODE_TEXT")},cc_EDM:function(){u.log("INFO","EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate()},cc_CR:function(){u.log("CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate()},cc_ENM:function(){u.log("INFO","ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()},cc_EOC:function(){if(u.log("INFO","EOC - End Of Caption"),"MODE_POP-ON"===this.mode){var e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,u.log("TEXT","DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate()},cc_TO:function(e){u.log("INFO","TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)},cc_MIDROW:function(e){var t={flash:!1};if(t.underline=e%2==1,t.italics=e>=46,t.italics)t.foreground="white";else{var n=Math.floor(e/2)-16;t.foreground=["white","green","blue","cyan","red","yellow","magenta"][n]}u.log("INFO","MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)},outputDataUpdate:function(){var e=u.time;null!==e&&this.outputFilter&&(this.outputFilter.updateData&&this.outputFilter.updateData(e,this.displayedMemory),null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.lastOutputScreen),this.cueStartTime=this.displayedMemory.isEmpty()?null:e):this.cueStartTime=e,this.lastOutputScreen.copy(this.displayedMemory))},cueSplitAtTime:function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}};var p=function(e,t,n){this.field=e||1,this.outputs=[t,n],this.channels=[new h(1,t),new h(2,n)],this.currChNr=-1,this.lastCmdA=null,this.lastCmdB=null,this.bufferedData=[],this.startTime=null,this.lastTime=null,this.dataCounters={padding:0,char:0,cmd:0,other:0}};p.prototype={getHandler:function(e){return this.channels[e].getHandler()},setHandler:function(e,t){this.channels[e].setHandler(t)},addData:function(e,t){var n,r,i,a=!1;this.lastTime=e,u.setTime(e);for(var o=0;o<t.length;o+=2)if(r=127&t[o],i=127&t[o+1],r>=16&&r<=31&&r===this.lastCmdA&&i===this.lastCmdB)this.lastCmdA=null,this.lastCmdB=null,u.log("DEBUG","Repeated command ("+l([r,i])+") is dropped");else if(0!==r||0!==i){if(u.log("DATA","["+l([t[o],t[o+1]])+"] -> ("+l([r,i])+")"),(n=this.parseCmd(r,i))||(n=this.parseMidrow(r,i)),n||(n=this.parsePAC(r,i)),n||(n=this.parseBackgroundAttributes(r,i)),!n)if(a=this.parseChars(r,i))if(this.currChNr&&this.currChNr>=0)this.channels[this.currChNr-1].insertChars(a);else u.log("WARNING","No channel found yet. TEXT-MODE?");n?this.dataCounters.cmd+=2:a?this.dataCounters.char+=2:(this.dataCounters.other+=2,u.log("WARNING","Couldn't parse cleaned data "+l([r,i])+" orig: "+l([t[o],t[o+1]])))}else this.dataCounters.padding+=2},parseCmd:function(e,t){var n=null;if(!((20===e||21===e||28===e||29===e)&&32<=t&&t<=47)&&!((23===e||31===e)&&33<=t&&t<=35))return!1;n=20===e||21===e||23===e?1:2;var r=this.channels[n-1];return 20===e||21===e||28===e||29===e?32===t?r.cc_RCL():33===t?r.cc_BS():34===t?r.cc_AOF():35===t?r.cc_AON():36===t?r.cc_DER():37===t?r.cc_RU(2):38===t?r.cc_RU(3):39===t?r.cc_RU(4):40===t?r.cc_FON():41===t?r.cc_RDC():42===t?r.cc_TR():43===t?r.cc_RTD():44===t?r.cc_EDM():45===t?r.cc_CR():46===t?r.cc_ENM():47===t&&r.cc_EOC():r.cc_TO(t-32),this.lastCmdA=e,this.lastCmdB=t,this.currChNr=n,!0},parseMidrow:function(e,t){var n=null;if((17===e||25===e)&&32<=t&&t<=47){if((n=17===e?1:2)!==this.currChNr)return u.log("ERROR","Mismatch channel in midrow parsing"),!1;var r=this.channels[n-1];return r.insertChars([32]),r.cc_MIDROW(t),u.log("DEBUG","MIDROW ("+l([e,t])+")"),this.lastCmdA=e,this.lastCmdB=t,!0}return!1},parsePAC:function(e,t){var n,s=null;if(!((17<=e&&e<=23||25<=e&&e<=31)&&64<=t&&t<=127)&&!((16===e||24===e)&&64<=t&&t<=95))return!1;n=e<=23?1:2,s=64<=t&&t<=95?1===n?r[e]:a[e]:1===n?i[e]:o[e];var u=this.interpretPAC(s,t);return this.channels[n-1].setPAC(u),this.lastCmdA=e,this.lastCmdB=t,this.currChNr=n,!0},interpretPAC:function(e,t){var n=t,r={color:null,italics:!1,indent:null,underline:!1,row:e};return n=t>95?t-96:t-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},parseChars:function(e,t){var r=null,i=null,a=null;if(e>=25?(r=2,a=e-8):(r=1,a=e),17<=a&&a<=19){var o=t;o=17===a?t+80:18===a?t+112:t+144,u.log("INFO","Special char '"+n(o)+"' in channel "+r),i=[o],this.lastCmdA=e,this.lastCmdB=t}else 32<=e&&e<=127&&(i=0===t?[e]:[e,t],this.lastCmdA=null,this.lastCmdB=null);if(i){var s=l(i);u.log("DEBUG","Char codes = "+s.join(","))}return i},parseBackgroundAttributes:function(e,t){var n,r,i;return((16===e||24===e)&&32<=t&&t<=47||(23===e||31===e)&&45<=t&&t<=47)&&(n={},16===e||24===e?(r=Math.floor((t-32)/2),n.background=s[r],t%2==1&&(n.background=n.background+"_semi")):45===t?n.background="transparent":(n.foreground="black",47===t&&(n.underline=!0)),i=e<24?1:2,this.channels[i-1].setBkgData(n),this.lastCmdA=e,this.lastCmdB=t,!0)},reset:function(){for(var e=0;e<this.channels.length;e++)this.channels[e]&&this.channels[e].reset();this.lastCmdA=null,this.lastCmdB=null},cueSplitAtTime:function(e){for(var t=0;t<this.channels.length;t++)this.channels[t]&&this.channels[t].cueSplitAtTime(e)}};e.logger=u,e.PenState=d,e.CaptionScreen=g,e.Cea608Parser=p,e.findCea608Nalus=function(e,t,n){for(var r=0,i=t,a=[],o=function(e,t,n,r){if(4!==e||t<8)return null;var i=n.getUint8(r),a=n.getUint16(r+1),o=n.getUint32(r+3),s=n.getUint8(r+7);return 181==i&&49==a&&1195456820==o&&3==s};i<t+n;){if(r=e.getUint32(i),6===(31&e.getUint8(i+4)))for(var s=i+5,u=-1;s<i+4+r-1;){u=0;for(var l=255;255===l;)u+=l=e.getUint8(s),s++;var d=0;for(l=255;255===l;)d+=l=e.getUint8(s),s++;o(u,d,e,s)&&a.push([s,d]),s+=d}i+=r+4}return a},e.extractCea608DataFromRange=function(e,t){var n=t[0],r=[[],[]];n+=8;var i=31&e.getUint8(n);n+=2;for(var a=0;a<i;a++){var o=e.getUint8(n),s=4&o,u=3&o;n++;var l=e.getUint8(n);n++;var d=e.getUint8(n);n++,s&&(127&l)+(127&d)!=0&&(0===u?(r[0].push(l),r[0].push(d)):1===u&&(r[1].push(l),r[1].push(d)))}return r}}(t)})),g=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var h=new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.init()}return g(e,[{key:"init",value:function(){this.STREAM="stream",this.VIDEO="video",this.AUDIO="audio",this.TEXT="text",this.FRAGMENTED_TEXT="fragmentedText",this.EMBEDDED_TEXT="embeddedText",this.MUXED="muxed",this.IMAGE="image",this.STPP="stpp",this.TTML="ttml",this.VTT="vtt",this.WVTT="wvtt",this.ABR_STRATEGY_DYNAMIC="abrDynamic",this.ABR_STRATEGY_BOLA="abrBola",this.ABR_STRATEGY_L2A="abrL2A",this.ABR_STRATEGY_LoLP="abrLoLP",this.ABR_STRATEGY_THROUGHPUT="abrThroughput",this.ABR_FETCH_THROUGHPUT_CALCULATION_DOWNLOADED_DATA="abrFetchThroughputCalculationDownloadedData",this.ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING="abrFetchThroughputCalculationMoofParsing",this.LIVE_CATCHUP_MODE_DEFAULT="liveCatchupModeDefault",this.LIVE_CATCHUP_MODE_LOLP="liveCatchupModeLoLP",this.MOVING_AVERAGE_SLIDING_WINDOW="slidingWindow",this.MOVING_AVERAGE_EWMA="ewma",this.BAD_ARGUMENT_ERROR="Invalid Arguments",this.MISSING_CONFIG_ERROR="Missing config parameter(s)",this.TRACK_SWITCH_MODE_ALWAYS_REPLACE="alwaysReplace",this.TRACK_SWITCH_MODE_NEVER_REPLACE="neverReplace",this.TRACK_SELECTION_MODE_FIRST_TRACK="firstTrack",this.TRACK_SELECTION_MODE_HIGHEST_BITRATE="highestBitrate",this.TRACK_SELECTION_MODE_HIGHEST_EFFICIENCY="highestEfficiency",this.TRACK_SELECTION_MODE_WIDEST_RANGE="widestRange",this.CMCD_MODE_QUERY="query",this.CMCD_MODE_HEADER="header",this.LOCATION="Location",this.INITIALIZE="initialize",this.TEXT_SHOWING="showing",this.TEXT_HIDDEN="hidden",this.CC1="CC1",this.CC3="CC3",this.UTF8="utf-8",this.SCHEME_ID_URI="schemeIdUri",this.START_TIME="starttime",this.SERVICE_DESCRIPTION_LL_SCHEME="urn:dvb:dash:lowlatency:scope:2019",this.SUPPLEMENTAL_PROPERTY_LL_SCHEME="urn:dvb:dash:lowlatency:critical:2019",this.XML="XML",this.ARRAY_BUFFER="ArrayBuffer",this.DVB_REPORTING_URL="dvb:reportingUrl",this.DVB_PROBABILITY="dvb:probability"}}]),e}()),p=Object.defineProperty({default:h},"__esModule",{value:!0}),_=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var m=new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.init()}return _(e,[{key:"init",value:function(){this.BASE_URL="BaseURL",this.SEGMENT_BASE="SegmentBase",this.SEGMENT_TEMPLATE="SegmentTemplate",this.SEGMENT_LIST="SegmentList",this.SEGMENT_URL="SegmentURL",this.SEGMENT_TIMELINE="SegmentTimeline",this.SEGMENT_PROFILES="segmentProfiles",this.ADAPTATION_SET="AdaptationSet",this.REPRESENTATION="Representation",this.REPRESENTATION_INDEX="RepresentationIndex",this.SUB_REPRESENTATION="SubRepresentation",this.INITIALIZATION="Initialization",this.INITIALIZATION_MINUS="initialization",this.MPD="MPD",this.PERIOD="Period",this.ASSET_IDENTIFIER="AssetIdentifier",this.EVENT_STREAM="EventStream",this.ID="id",this.PROFILES="profiles",this.SERVICE_LOCATION="serviceLocation",this.RANGE="range",this.INDEX="index",this.MEDIA="media",this.BYTE_RANGE="byteRange",this.INDEX_RANGE="indexRange",this.MEDIA_RANGE="mediaRange",this.VALUE="value",this.CONTENT_TYPE="contentType",this.MIME_TYPE="mimeType",this.BITSTREAM_SWITCHING="BitstreamSwitching",this.BITSTREAM_SWITCHING_MINUS="bitstreamSwitching",this.CODECS="codecs",this.DEPENDENCY_ID="dependencyId",this.MEDIA_STREAM_STRUCTURE_ID="mediaStreamStructureId",this.METRICS="Metrics",this.METRICS_MINUS="metrics",this.REPORTING="Reporting",this.WIDTH="width",this.HEIGHT="height",this.SAR="sar",this.FRAMERATE="frameRate",this.AUDIO_SAMPLING_RATE="audioSamplingRate",this.MAXIMUM_SAP_PERIOD="maximumSAPPeriod",this.START_WITH_SAP="startWithSAP",this.MAX_PLAYOUT_RATE="maxPlayoutRate",this.CODING_DEPENDENCY="codingDependency",this.SCAN_TYPE="scanType",this.FRAME_PACKING="FramePacking",this.AUDIO_CHANNEL_CONFIGURATION="AudioChannelConfiguration",this.CONTENT_PROTECTION="ContentProtection",this.ESSENTIAL_PROPERTY="EssentialProperty",this.SUPPLEMENTAL_PROPERTY="SupplementalProperty",this.INBAND_EVENT_STREAM="InbandEventStream",this.ACCESSIBILITY="Accessibility",this.ROLE="Role",this.RATING="Rating",this.CONTENT_COMPONENT="ContentComponent",this.SUBSET="Subset",this.LANG="lang",this.VIEWPOINT="Viewpoint",this.ROLE_ASARRAY="Role_asArray",this.ACCESSIBILITY_ASARRAY="Accessibility_asArray",this.AUDIOCHANNELCONFIGURATION_ASARRAY="AudioChannelConfiguration_asArray",this.CONTENTPROTECTION_ASARRAY="ContentProtection_asArray",this.MAIN="main",this.DYNAMIC="dynamic",this.STATIC="static",this.MEDIA_PRESENTATION_DURATION="mediaPresentationDuration",this.MINIMUM_UPDATE_PERIOD="minimumUpdatePeriod",this.CODEC_PRIVATE_DATA="codecPrivateData",this.BANDWITH="bandwidth",this.SOURCE_URL="sourceURL",this.TIMESCALE="timescale",this.DURATION="duration",this.START_NUMBER="startNumber",this.PRESENTATION_TIME_OFFSET="presentationTimeOffset",this.AVAILABILITY_START_TIME="availabilityStartTime",this.AVAILABILITY_END_TIME="availabilityEndTime",this.TIMESHIFT_BUFFER_DEPTH="timeShiftBufferDepth",this.MAX_SEGMENT_DURATION="maxSegmentDuration",this.PRESENTATION_TIME="presentationTime",this.MIN_BUFFER_TIME="minBufferTime",this.MAX_SUBSEGMENT_DURATION="maxSubsegmentDuration",this.START="start",this.AVAILABILITY_TIME_OFFSET="availabilityTimeOffset",this.AVAILABILITY_TIME_COMPLETE="availabilityTimeComplete",this.CENC_DEFAULT_KID="cenc:default_KID",this.DVB_PRIORITY="dvb:priority",this.DVB_WEIGHT="dvb:weight",this.SUGGESTED_PRESENTATION_DELAY="suggestedPresentationDelay",this.SERVICE_DESCRIPTION="ServiceDescription",this.SERVICE_DESCRIPTION_SCOPE="Scope",this.SERVICE_DESCRIPTION_LATENCY="Latency",this.SERVICE_DESCRIPTION_PLAYBACK_RATE="PlaybackRate",this.PATCH_LOCATION="PatchLocation",this.PUBLISH_TIME="publishTime",this.ORIGINAL_PUBLISH_TIME="originalPublishTime",this.ORIGINAL_MPD_ID="mpdId"}}]),e}()),E=Object.defineProperty({default:m},"__esModule",{value:!0}),v=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var y=new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.init()}return v(e,[{key:"init",value:function(){this.TCP_CONNECTION="TcpList",this.HTTP_REQUEST="HttpList",this.TRACK_SWITCH="RepSwitchList",this.BUFFER_LEVEL="BufferLevel",this.BUFFER_LOADED="bufferLoaded",this.ABANDON_LOAD="abandonload",this.ALLOW_LOAD="allowload",this.BUFFER_EMPTY="bufferStalled",this.BUFFER_STATE="BufferState",this.DVR_INFO="DVRInfo",this.DROPPED_FRAMES="DroppedFrames",this.SCHEDULING_INFO="SchedulingInfo",this.REQUESTS_QUEUE="RequestsQueue",this.MANIFEST_UPDATE="ManifestUpdate",this.MANIFEST_UPDATE_STREAM_INFO="ManifestUpdatePeriodInfo",this.MANIFEST_UPDATE_TRACK_INFO="ManifestUpdateRepresentationInfo",this.PLAY_LIST="PlayList",this.DVB_ERRORS="DVBErrors"}}]),e}()),T=Object.defineProperty({default:y},"__esModule",{value:!0}),A=function(){var e=void 0,t=[],n={},r={};function i(e,n){for(var r in t){var i=t[r];if(i.context===e&&i.name===n)return i.instance}return null}function a(e,t){return t[e]}function o(e,t,n){e in n&&(n[e]=t)}function s(t,n,r){var i=void 0,a=t.__dashjs_factory_name,o=n[a];if(o){var s=o.instance;if(!o.override)return s.apply({context:n,factory:e},r);for(var u in i=t.apply({context:n},r),s=s.apply({context:n,factory:e,parent:i},r))i.hasOwnProperty(u)&&(i[u]=s[u])}else i=t.apply({context:n},r);return i.getClassName=function(){return a},i}return e={extend:function(e,t,n,r){!r[e]&&t&&(r[e]={instance:t,override:n})},getSingletonInstance:i,setSingletonInstance:function(e,n,r){for(var i in t){var a=t[i];if(a.context===e&&a.name===n)return void(t[i].instance=r)}t.push({name:n,context:e,instance:r})},deleteSingletonInstances:function(e){t=t.filter((function(t){return t.context!==e}))},getSingletonFactory:function(e){var r=a(e.__dashjs_factory_name,n);return r||(r=function(n){var r=void 0;return void 0===n&&(n={}),{getInstance:function(){return r||(r=i(n,e.__dashjs_factory_name)),r||(r=s(e,n,arguments),t.push({name:e.__dashjs_factory_name,context:n,instance:r})),r}}},n[e.__dashjs_factory_name]=r),r},getSingletonFactoryByName:function(e){return a(e,n)},updateSingletonFactory:function(e,t){o(e,t,n)},getClassFactory:function(e){var t=a(e.__dashjs_factory_name,r);return t||(t=function(t){return void 0===t&&(t={}),{create:function(){return s(e,t,arguments)}}},r[e.__dashjs_factory_name]=t),t},getClassFactoryByName:function(e){return a(e,r)},updateClassFactory:function(e,t){o(e,t,r)}}}(),S=Object.defineProperty({default:A},"__esModule",{value:!0}),I=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var R,b=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return I(e,[{key:"extend",value:function(e,t){if(e){var n=!!t&&t.override,r=!!t&&t.publicOnly;for(var i in e)!e.hasOwnProperty(i)||this[i]&&!n||r&&-1===e[i].indexOf("public_")||(this[i]=e[i])}}}]),e}(),N=Object.defineProperty({default:b},"__esModule",{value:!0});var M=new(function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.AST_IN_FUTURE="astInFuture",e.BUFFER_EMPTY="bufferStalled",e.BUFFER_LOADED="bufferLoaded",e.BUFFER_LEVEL_STATE_CHANGED="bufferStateChanged",e.DYNAMIC_TO_STATIC="dynamicToStatic",e.ERROR="error",e.FRAGMENT_LOADING_COMPLETED="fragmentLoadingCompleted",e.FRAGMENT_LOADING_PROGRESS="fragmentLoadingProgress",e.FRAGMENT_LOADING_STARTED="fragmentLoadingStarted",e.FRAGMENT_LOADING_ABANDONED="fragmentLoadingAbandoned",e.LOG="log",e.MANIFEST_LOADED="manifestLoaded",e.METRICS_CHANGED="metricsChanged",e.METRIC_CHANGED="metricChanged",e.METRIC_ADDED="metricAdded",e.METRIC_UPDATED="metricUpdated",e.PERIOD_SWITCH_COMPLETED="periodSwitchCompleted",e.PERIOD_SWITCH_STARTED="periodSwitchStarted",e.QUALITY_CHANGE_REQUESTED="qualityChangeRequested",e.QUALITY_CHANGE_RENDERED="qualityChangeRendered",e.TRACK_CHANGE_RENDERED="trackChangeRendered",e.SOURCE_INITIALIZED="sourceInitialized",e.STREAM_INITIALIZING="streamInitializing",e.STREAM_UPDATED="streamUpdated",e.STREAM_INITIALIZED="streamInitialized",e.STREAM_TEARDOWN_COMPLETE="streamTeardownComplete",e.TEXT_TRACKS_ADDED="allTextTracksAdded",e.TEXT_TRACK_ADDED="textTrackAdded",e.TTML_PARSED="ttmlParsed",e.TTML_TO_PARSE="ttmlToParse",e.CAPTION_RENDERED="captionRendered",e.CAPTION_CONTAINER_RESIZE="captionContainerResize",e.CAN_PLAY="canPlay",e.PLAYBACK_ENDED="playbackEnded",e.PLAYBACK_ERROR="playbackError",e.PLAYBACK_NOT_ALLOWED="playbackNotAllowed",e.PLAYBACK_METADATA_LOADED="playbackMetaDataLoaded",e.PLAYBACK_PAUSED="playbackPaused",e.PLAYBACK_PLAYING="playbackPlaying",e.PLAYBACK_PROGRESS="playbackProgress",e.PLAYBACK_RATE_CHANGED="playbackRateChanged",e.PLAYBACK_SEEKED="playbackSeeked",e.PLAYBACK_SEEKING="playbackSeeking",e.PLAYBACK_SEEK_ASKED="playbackSeekAsked",e.PLAYBACK_STALLED="playbackStalled",e.PLAYBACK_STARTED="playbackStarted",e.PLAYBACK_TIME_UPDATED="playbackTimeUpdated",e.PLAYBACK_WAITING="playbackWaiting",e.MANIFEST_VALIDITY_CHANGED="manifestValidityChanged",e.GAP_CAUSED_SEEK_TO_PERIOD_END="gapCausedSeekToPeriodEnd",e.GAP_CAUSED_INTERNAL_SEEK="gapCausedInternalSeek",e.EVENT_MODE_ON_START="eventModeOnStart",e.EVENT_MODE_ON_RECEIVE="eventModeOnReceive",e.CONFORMANCE_VIOLATION="conformanceViolation",e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(((R=N)&&R.__esModule?R:{default:R}).default)),D=Object.defineProperty({default:M},"__esModule",{value:!0}),C=w(S),O=w(D);function w(e){return e&&e.__esModule?e:{default:e}}function P(){var e={};function t(t,n,r){var i=-1;return e[t]?(e[t].some((function(e,t){if(e&&e.callback===n&&(!r||r===e.scope))return i=t,!0})),i):i}return{on:function(n,r,i){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!n)throw new Error("event type cannot be null or undefined");if(!r||"function"!=typeof r)throw new Error("listener must be a function: "+r);var o=a.priority||0;if(!(t(n,r,i)>=0)){e[n]=e[n]||[];var s={callback:r,scope:i,priority:o};i&&i.getStreamId&&(s.streamId=i.getStreamId()),i&&i.getType&&(s.mediaType=i.getType()),a&&a.mode&&(s.mode=a.mode);var u=e[n].some((function(t,r){if(t&&o>t.priority)return e[n].splice(r,0,s),!0}));u||e[n].push(s)}},off:function(n,r,i){if(n&&r&&e[n]){var a=t(n,r,i);a<0||(e[n][a]=null)}},trigger:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(t&&e[t]){if((n=n||{}).hasOwnProperty("type"))throw new Error("'type' is a reserved word for event dispatching");n.type=t,r.streamId&&(n.streamId=r.streamId),r.mediaType&&(n.mediaType=r.mediaType),e[t].filter((function(e){return!!e&&((!r.streamId||!e.streamId||e.streamId===r.streamId)&&((!r.mediaType||!e.mediaType||e.mediaType===r.mediaType)&&!(r.mode&&e.mode&&e.mode!==r.mode||!e.mode&&r.mode&&r.mode===O.default.EVENT_MODE_ON_RECEIVE)))})).forEach((function(e){return e&&e.callback.call(e.scope,n)}))}},reset:function(){e={}}}}P.__dashjs_factory_name="EventBus";var L=C.default.getSingletonFactory(P);L.EVENT_PRIORITY_LOW=0,L.EVENT_PRIORITY_HIGH=5e3,C.default.updateSingletonFactory(P.__dashjs_factory_name,L);var F=L,x=Object.defineProperty({default:F},"__esModule",{value:!0});var U=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.ATTEMPT_BACKGROUND_SYNC="attemptBackgroundSync",e.BUFFERING_COMPLETED="bufferingCompleted",e.BUFFER_CLEARED="bufferCleared",e.BUFFER_LEVEL_UPDATED="bufferLevelUpdated",e.BYTES_APPENDED="bytesAppended",e.BYTES_APPENDED_END_FRAGMENT="bytesAppendedEndFragment",e.CHECK_FOR_EXISTENCE_COMPLETED="checkForExistenceCompleted",e.CURRENT_TRACK_CHANGED="currentTrackChanged",e.DATA_UPDATE_COMPLETED="dataUpdateCompleted",e.DATA_UPDATE_STARTED="dataUpdateStarted",e.INBAND_EVENTS="inbandEvents",e.INITIALIZATION_LOADED="initializationLoaded",e.INIT_FRAGMENT_LOADED="initFragmentLoaded",e.INIT_FRAGMENT_NEEDED="initFragmentNeeded",e.INTERNAL_MANIFEST_LOADED="internalManifestLoaded",e.ORIGINAL_MANIFEST_LOADED="originalManifestLoaded",e.LIVE_EDGE_SEARCH_COMPLETED="liveEdgeSearchCompleted",e.LOADING_COMPLETED="loadingCompleted",e.LOADING_PROGRESS="loadingProgress",e.LOADING_DATA_PROGRESS="loadingDataProgress",e.LOADING_ABANDONED="loadingAborted",e.MANIFEST_UPDATED="manifestUpdated",e.MEDIA_FRAGMENT_LOADED="mediaFragmentLoaded",e.MEDIA_FRAGMENT_NEEDED="mediaFragmentNeeded",e.QUOTA_EXCEEDED="quotaExceeded",e.REPRESENTATION_UPDATE_STARTED="representationUpdateStarted",e.REPRESENTATION_UPDATE_COMPLETED="representationUpdateCompleted",e.SEGMENTS_LOADED="segmentsLoaded",e.SERVICE_LOCATION_BLACKLIST_ADD="serviceLocationBlacklistAdd",e.SERVICE_LOCATION_BLACKLIST_CHANGED="serviceLocationBlacklistChanged",e.SOURCEBUFFER_REMOVE_COMPLETED="sourceBufferRemoveCompleted",e.STREAMS_COMPOSED="streamsComposed",e.STREAM_BUFFERING_COMPLETED="streamBufferingCompleted",e.STREAM_COMPLETED="streamCompleted",e.TEXT_TRACKS_QUEUE_INITIALIZED="textTracksQueueInitialized",e.TIME_SYNCHRONIZATION_COMPLETED="timeSynchronizationComplete",e.UPDATE_TIME_SYNC_OFFSET="updateTimeSyncOffset",e.URL_RESOLUTION_FAILED="urlResolutionFailed",e.VIDEO_CHUNK_RECEIVED="videoChunkReceived",e.WALLCLOCK_TIME_UPDATED="wallclockTimeUpdated",e.XLINK_ELEMENT_LOADED="xlinkElementLoaded",e.XLINK_READY="xlinkReady",e.SEGMENTBASE_INIT_REQUEST_NEEDED="segmentBaseInitRequestNeeded",e.SEGMENTBASE_SEGMENTSLIST_REQUEST_NEEDED="segmentBaseSegmentsListRequestNeeded",e.SEEK_TARGET="seekTarget",e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(function(e){return e&&e.__esModule?e:{default:e}}(N).default);function B(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function k(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var G=new(function(e){function t(){return B(this,t),k(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(function(e){return e&&e.__esModule?e:{default:e}}(Object.defineProperty({default:U},"__esModule",{value:!0})).default)),q=Object.defineProperty({default:G},"__esModule",{value:!0}),Y=K(x),j=K(q),H=K(S);function K(e){return e&&e.__esModule?e:{default:e}}var V=1,z=2,W=3,X=4,Q=5;function Z(e){e=e||{};var t,n=this.context,r=(0,Y.default)(n).getInstance(),i=e.settings,a=[],o=void 0,s=void 0,u=void 0;function l(e){return e&&e.bind?e.bind(window.console):window.console.log.bind(window.console)}function d(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];p.apply(void 0,[V,this].concat(t))}function f(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];p.apply(void 0,[z,this].concat(t))}function c(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];p.apply(void 0,[W,this].concat(t))}function g(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];p.apply(void 0,[X,this].concat(t))}function h(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];p.apply(void 0,[Q,this].concat(t))}function p(e,t){var n="",l=null;o&&(l=(new Date).getTime(),n+="["+(l-u)+"]"),s&&t&&t.getClassName&&(n+="["+t.getClassName()+"]",t.getType&&(n+="["+t.getType()+"]")),n.length>0&&(n+=" ");for(var d=arguments.length,f=Array(d>2?d-2:0),c=2;c<d;c++)f[c-2]=arguments[c];Array.apply(null,f).forEach((function(e){n+=e+" "})),a[e]&&i.get().debug.logLevel>=e&&a[e](n),i&&i.get().debug.dispatchEvent&&r.trigger(j.default.LOG,{message:n,level:e})}return t={getLogger:function(e){return{fatal:d.bind(e),error:f.bind(e),warn:c.bind(e),info:g.bind(e),debug:h.bind(e)}},setLogTimestampVisible:function(e){o=e},setCalleeNameVisible:function(e){s=e}},o=!0,s=!0,u=(new Date).getTime(),"undefined"!=typeof window&&window.console&&(a[V]=l(window.console.error),a[z]=l(window.console.error),a[W]=l(window.console.warn),a[X]=l(window.console.info),a[Q]=l(window.console.debug)),t}Z.__dashjs_factory_name="Debug";var $=H.default.getSingletonFactory(Z);$.LOG_LEVEL_NONE=0,$.LOG_LEVEL_FATAL=V,$.LOG_LEVEL_ERROR=z,$.LOG_LEVEL_WARNING=W,$.LOG_LEVEL_INFO=X,$.LOG_LEVEL_DEBUG=Q,H.default.updateSingletonFactory(Z.__dashjs_factory_name,$);var J=$,ee=Object.defineProperty({default:J},"__esModule",{value:!0}),te=se(p),ne=se(T),re=se(x),ie=se(q),ae=se(S),oe=se(ee);function se(e){return e&&e.__esModule?e:{default:e}}function ue(){var e=this.context,t=(0,re.default)(e).getInstance(),n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,u=void 0,l=void 0,d=void 0,f=void 0,c=void 0,g=void 0,h=void 0,p=void 0,_=void 0,m=void 0,E=void 0,v=void 0,y=void 0,T=void 0,A=void 0,S=void 0,I=void 0,R=void 0;function b(e){if(!l||!isNaN(d)){var n=d;if(isNaN(n))if(h){n=e.liveStartTime;var i=a.getCurrentDVRInfo(),o=i?i.range:null;if(o){var u=q(!0);isNaN(u)||(r.info("Start time from URI parameters: "+u),n=Math.max(Math.min(n,u),o.start))}}else{n=g.start;var f=q(!1);!isNaN(f)&&f<n+g.duration&&(r.info("Start time from URI parameters: "+f),n=Math.max(n,f))}isNaN(n)||n===s.getTime()||(t.trigger(ie.default.PLAYBACK_SEEKING,{seekTime:n}),P(n,!1,!0))}}function N(){return parseFloat((M()-L()).toFixed(5))}function M(){return g.start+g.duration}function D(){g&&s&&s.getElement()?s.play():_=!0}function C(){return g&&s?s.isPaused():null}function O(){g&&s&&s.pause()}function w(){return g&&s?s.isSeeking():null}function P(e,n,i){g&&s&&(e!==(isNaN(v)?s.getTime():v)&&((y=!0===i)||(v=e,t.trigger(ie.default.PLAYBACK_SEEK_ASKED)),r.info("Requesting seek to time: "+e+(y?" (internal)":"")),s.setCurrentTime(e,n)))}function L(){return g&&s?s.getTime():null}function F(){var e=L();if(h&&!isNaN(E)){var t=E/1e3;e>t&&(e-=t)}return e}function x(){return g&&s?s.getPlaybackRate():null}function U(){return g&&s?s.getEnded():null}function B(){return h}function k(){if(!h||isNaN(E))return NaN;var e=F();if(isNaN(e)||0===e)return 0;var t=(new Date).getTime()+1e3*u.getClientTimeOffset();return Math.max(((t-E-1e3*e)/1e3).toFixed(3),0)}function G(){_=!1,l=!1,d=NaN,c=0,E=0,v=NaN,s&&(t.off(ie.default.STREAM_INITIALIZED,b,this),t.off(ie.default.DATA_UPDATE_COMPLETED,K,this),t.off(ie.default.BUFFER_LEVEL_STATE_CHANGED,me,this),t.off(ie.default.LOADING_PROGRESS,_e,this),t.off(ie.default.PLAYBACK_PROGRESS,fe,this),t.off(ie.default.PLAYBACK_TIME_UPDATED,fe,this),t.off(ie.default.PLAYBACK_ENDED,le,this),t.off(ie.default.STREAM_INITIALIZING,ve,this),j(),s.removeEventListener("canplay",V),s.removeEventListener("play",z),s.removeEventListener("waiting",W),s.removeEventListener("playing",X),s.removeEventListener("pause",Q),s.removeEventListener("error",de),s.removeEventListener("seeking",Z),s.removeEventListener("seeked",$),s.removeEventListener("timeupdate",J),s.removeEventListener("progress",ee),s.removeEventListener("ratechange",ae),s.removeEventListener("loadedmetadata",se),s.removeEventListener("stalled",Ee),s.removeEventListener("ended",ue)),f=null,s=null,g=null,h=null}function q(e){var t=I.getURIFragmentData();if(!t||!t.t)return NaN;var n=i.getStreams()[0].getStreamInfo().start;t.t=t.t.split(",")[0];var r=-1!==t.t.indexOf("posix:")?"now"===t.t.substring(6)?Date.now()/1e3:parseInt(t.t.substring(6)):NaN;return e&&!isNaN(r)?r-E/1e3:parseInt(t.t)+n}function Y(){if(null===f){f=setInterval((function(){var e;t.trigger(ie.default.WALLCLOCK_TIME_UPDATED,{isDynamic:h,time:new Date}),B()&&C()&&(e=Date.now(),(!m||e>m+500)&&(m=e,J()))}),R.get().streaming.wallclockTimeUpdateInterval)}}function j(){clearInterval(f),f=null}function H(e){if(!C()&&h&&0!==s.getReadyState()){var t=F(),n=function(e,t){var n=a.getCurrentDVRInfo(t),i=n?n.range:null;return i?(r.debug("Checking DVR window for at "+e+" with DVR window range "+i.start+" - "+i.end),e>i.end?Math.max(i.end-c,i.start):e>0&&e+.25<i.start&&Math.abs(e-i.start)<31536e4?i.start:e):NaN}(t,e);!isNaN(n)&&n!==t&&!w()&&(r.debug("UpdateCurrentTime: Seek to actual time: "+n+" from currentTime: "+t),P(n))}}function K(e){if(!e.error){var t=o.convertDataToRepresentationInfo(e.currentRepresentation),n=t?t.mediaInfo.streamInfo:null;null!==n&&g.id===n.id&&(g=n,H())}}function V(){t.trigger(ie.default.CAN_PLAY)}function z(){r.info("Native video element event: play"),H(),Y(),t.trigger(ie.default.PLAYBACK_STARTED,{startTime:L()})}function W(){r.info("Native video element event: waiting"),t.trigger(ie.default.PLAYBACK_WAITING,{playingTime:L()})}function X(){r.info("Native video element event: playing"),t.trigger(ie.default.PLAYBACK_PLAYING,{playingTime:L()})}function Q(){r.info("Native video element event: pause"),t.trigger(ie.default.PLAYBACK_PAUSED,{ended:U()})}function Z(){if(y)y=!1;else{var e=L();isNaN(v)||v===e||(e=v),v=NaN,r.info("Seeking to: "+e),Y(),t.trigger(ie.default.PLAYBACK_SEEKING,{seekTime:e})}}function $(){r.info("Native video element event: seeked"),t.trigger(ie.default.PLAYBACK_SEEKED)}function J(){g&&t.trigger(ie.default.PLAYBACK_TIME_UPDATED,{timeToEnd:N(),time:L()})}function ee(){t.trigger(ie.default.PLAYBACK_PROGRESS)}function ae(){var e=x();r.info("Native video element event: ratechange: ",e),t.trigger(ie.default.PLAYBACK_RATE_CHANGED,{playbackRate:e})}function se(){r.info("Native video element event: loadedmetadata"),t.trigger(ie.default.PLAYBACK_METADATA_LOADED),Y()}function ue(){r.info("Native video element event: ended"),O(),j();var e=i?i.getActiveStreamInfo():null;e&&t.trigger(ie.default.PLAYBACK_ENDED,{isLast:e.isLast})}function le(e){if(f&&e.isLast){r.info("onPlaybackEnded -- PLAYBACK_ENDED but native video element didn't fire ended");var t=e.seekTime?e.seekTime:M();s.setCurrentTime(t),O(),j()}}function de(e){var n=e.target||e.srcElement;t.trigger(ie.default.PLAYBACK_ERROR,{error:n.error})}function fe(){h&&ce()&&R.get().streaming.liveCatchup.playbackRate>0&&!C()&&!w()&&(function(){try{if(ce()&&R.get().streaming.liveCatchup.playbackRate>0&&L()>0){var e=he(),t=k(),n=p.getLiveDelay(),r=p.getLiveCatchupLatencyThreshold(),i=R.get().streaming.liveCatchup.minDrift;if(e===te.default.LIVE_CATCHUP_MODE_LOLP){var a=ge(),o=R.get().streaming.liveCatchup.playbackBufferMin;return function(e,t,n,r,i,a){try{var o=Math.abs(e-t);return(isNaN(a)||e<=a)&&(o>n||r<i)}catch(e){return!1}}(t,n,i,a,o,r)}return function(e,t,n,r){try{return Math.abs(e-t)>r&&(isNaN(n)||e<=n)}catch(e){return!1}}(t,n,r,i)}}catch(e){return!1}}()?function(){if(s){var e=void 0,t=s.getPlaybackRate(),n=R.get().streaming.liveCatchup.playbackRate,i=k(),o=p.getLiveDelay(),u=ge();if(he()===te.default.LIVE_CATCHUP_MODE_LOLP){R.get().streaming.liveCatchup.minDrift;var l=R.get().streaming.liveCatchup.playbackBufferMin;e=function(e,t,n,i,a,o,s){var u=e,l=void 0;if(o<a){var d=5*(o-a),f=2*u/(1+Math.pow(Math.E,-d));l=1-u+f,r.debug("[LoL+ playback control_buffer-based] bufferLevel: "+o+", newRate: "+l)}else{if(Math.abs(t-n)<=.02*n)l=1;else{var c=5*(t-n),g=2*u/(1+Math.pow(Math.E,-c));l=1-u+g}r.debug("[LoL+ playback control_latency-based] latency: "+t+", newRate: "+l)}A&&o>n/2&&(A=!1);Math.abs(s-l)<=S&&(l=null);return{newRate:l}}(n,i,o,0,l,u,t)}else e=function(e,t,n,r,i){var a=e,o=t-n,s=5*o,u=2*a/(1+Math.pow(Math.E,-s)),l=1-a+u;A&&(r>n/2?A=!1:o>0&&(l=1));Math.abs(i-l)<=S&&(l=null);return{newRate:l}}(n,i,o,u,t);var d=e.newRate;d&&s.setPlaybackRate(d);var f=i-o;R.get().streaming.liveCatchup.maxDrift>0&&!T&&f>R.get().streaming.liveCatchup.maxDrift?(r.info("Low Latency catchup mechanism. Latency too high, doing a seek to live point"),T=!0,P(((c=a.getCurrentDVRInfo())?c.range:null).end-p.getLiveDelay(),!0,!1)):T=!1}var c}():pe())}function ce(){return R.get().streaming.liveCatchup.enabled||R.get().streaming.lowLatencyEnabled}function ge(){var e=null;return i.getActiveStreamProcessors().forEach((function(t){var n=t.getBufferLevel();e=null===e?n:Math.min(e,n)})),e}function he(){var e=R.get().streaming.liveCatchup.playbackBufferMin;return R.get().streaming.liveCatchup.mode!==te.default.LIVE_CATCHUP_MODE_LOLP||null===e||isNaN(e)?te.default.LIVE_CATCHUP_MODE_DEFAULT:te.default.LIVE_CATCHUP_MODE_LOLP}function pe(){s&&s.setPlaybackRate(1)}function _e(e){if(!1===e.stream&&R.get().streaming.lowLatencyEnabled&&!isNaN(e.request.duration)){var t=1.2*e.request.duration;if(t>p.getLiveDelay()){r.warn("Browser does not support fetch API with StreamReader. Increasing live delay to be 20% higher than segment duration:",t.toFixed(2));var n={streaming:{liveDelay:t}};R.update(n)}}}function me(e){e.streamId===g.id&&(ce()?e.state!==ne.default.BUFFER_EMPTY||w()||A||(A=!0,pe()):s.setStallState(e.mediaType,e.state===ne.default.BUFFER_EMPTY))}function Ee(e){t.trigger(ie.default.PLAYBACK_STALLED,{e:e})}function ve(e){!function(e,t){if(e&&e.manifestInfo&&e.manifestInfo.serviceDescriptions){for(var n=void 0,i=0;i<e.manifestInfo.serviceDescriptions.length;i++){var a=e.manifestInfo.serviceDescriptions[i];if(a.schemeIdUri===te.default.SERVICE_DESCRIPTION_LL_SCHEME){n=a;break}}n&&t&&t.supplementalProperties&&"true"===t.supplementalProperties[te.default.SUPPLEMENTAL_PROPERTY_LL_SCHEME]&&(n.latency&&n.latency.target>0&&(r.debug("Apply LL properties coming from service description. Target Latency (ms):",n.latency.target),R.update({streaming:{lowLatencyEnabled:!0,liveDelay:n.latency.target/1e3,liveCatchup:{minDrift:n.latency.max>n.latency.target?(n.latency.max-n.latency.target)/1e3:void 0}}})),n.playbackRate&&n.playbackRate.max>1&&(r.debug("Apply LL properties coming from service description. Max PlaybackRate:",n.playbackRate.max),R.update({streaming:{lowLatencyEnabled:!0,liveCatchup:{playbackRate:n.playbackRate.max-1}}})))}}(e.streamInfo,e.mediaInfo)}return n={initialize:function(e,n,r){g=e,s.addEventListener("canplay",V),s.addEventListener("play",z),s.addEventListener("waiting",W),s.addEventListener("playing",X),s.addEventListener("pause",Q),s.addEventListener("error",de),s.addEventListener("seeking",Z),s.addEventListener("seeked",$),s.addEventListener("timeupdate",J),s.addEventListener("progress",ee),s.addEventListener("ratechange",ae),s.addEventListener("loadedmetadata",se),s.addEventListener("stalled",Ee),s.addEventListener("ended",ue),h=g.manifestInfo.isDynamic,T=!1,A=!1,l=!0===n,d=r,y=!1;var i="undefined"!=typeof navigator?navigator.userAgent.toLowerCase():"",a=/safari/.test(i)&&!/chrome/.test(i);S=a?.25:.02,t.on(ie.default.STREAM_INITIALIZED,b,this),t.on(ie.default.DATA_UPDATE_COMPLETED,K,this),t.on(ie.default.LOADING_PROGRESS,_e,this),t.on(ie.default.BUFFER_LEVEL_STATE_CHANGED,me,this),t.on(ie.default.PLAYBACK_PROGRESS,fe,this),t.on(ie.default.PLAYBACK_TIME_UPDATED,fe,this),t.on(ie.default.PLAYBACK_ENDED,le,this,{priority:re.default.EVENT_PRIORITY_HIGH}),t.on(ie.default.STREAM_INITIALIZING,ve,this),_&&(_=!1,D())},setConfig:function(e){e&&(e.streamController&&(i=e.streamController),e.dashMetrics&&(a=e.dashMetrics),e.mediaPlayerModel&&(p=e.mediaPlayerModel),e.adapter&&(o=e.adapter),e.videoModel&&(s=e.videoModel),e.timelineConverter&&(u=e.timelineConverter),e.uriFragmentModel&&(I=e.uriFragmentModel),e.settings&&(R=e.settings))},getStartTimeFromUriParameters:q,getTimeToStreamEnd:N,getTime:L,getNormalizedTime:F,getPlaybackRate:x,getPlayedRanges:function(){return g&&s?s.getPlayedRanges():null},getEnded:U,getIsDynamic:B,getStreamController:function(){return i},computeAndSetLiveDelay:function(e,t,n){var r,i=void 0,a=void 0,s=!isNaN(e)&&isFinite(e)?e:NaN,u=o.getSuggestedPresentationDelay();if(i=R.get().streaming.lowLatencyEnabled?0:p.getLiveDelay()?p.getLiveDelay():null===R.get().streaming.liveDelayFragmentCount||isNaN(R.get().streaming.liveDelayFragmentCount)||isNaN(s)?!0===R.get().streaming.useSuggestedPresentationDelay&&null!==u&&!isNaN(u)&&u>0?u:isNaN(s)?isNaN(n)?4*g.manifestInfo.minBufferTime:4*n:4*s:s*R.get().streaming.liveDelayFragmentCount,null!==(r=o.getAvailabilityStartTime())&&(E=r),t>0){var l=Math.max(t-10,t/2);a=Math.min(i,l)}else a=i;return c=a,a},getLiveDelay:function(){return c},setLiveDelay:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t&&e<c||(c=e)},getCurrentLiveLatency:k,play:D,isPaused:C,pause:O,isSeeking:w,getStreamEndTime:M,seek:P,updateCurrentTime:H,reset:G},r=(0,oe.default)(e).getInstance().getLogger(n),G(),n}ue.__dashjs_factory_name="PlaybackController";var le=ae.default.getSingletonFactory(ue),de=Object.defineProperty({default:le},"__esModule",{value:!0});function fe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var ce=function e(){fe(this,e),this.tcpid=null,this.type=null,this.url=null,this.actualurl=null,this.range=null,this.trequest=null,this.tresponse=null,this.responsecode=null,this.interval=null,this.trace=[],this._stream=null,this._tfinish=null,this._mediaduration=null,this._quality=null,this._responseHeaders=null,this._serviceLocation=null};ce.GET="GET",ce.HEAD="HEAD",ce.MPD_TYPE="MPD",ce.XLINK_EXPANSION_TYPE="XLinkExpansion",ce.INIT_SEGMENT_TYPE="InitializationSegment",ce.INDEX_SEGMENT_TYPE="IndexSegment",ce.MEDIA_SEGMENT_TYPE="MediaSegment",ce.BITSTREAM_SWITCHING_SEGMENT_TYPE="BitstreamSwitchingSegment",ce.MSS_FRAGMENT_INFO_SEGMENT_TYPE="FragmentInfoSegment",ce.LICENSE="license",ce.OTHER_TYPE="other";var ge=ce,he=function e(){fe(this,e),this.s=null,this.d=null,this.b=[]},pe=Object.defineProperty({HTTPRequest:ge,HTTPRequestTrace:he},"__esModule",{value:!0}),_e=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var me=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.action=e.ACTION_DOWNLOAD,this.startTime=NaN,this.mediaStartTime=NaN,this.mediaType=null,this.mediaInfo=null,this.type=null,this.duration=NaN,this.timescale=NaN,this.range=null,this.url=t||null,this.serviceLocation=null,this.requestStartDate=null,this.firstByteDate=null,this.requestEndDate=null,this.quality=NaN,this.index=NaN,this.availabilityStartTime=null,this.availabilityEndTime=null,this.wallStartTime=null,this.bytesLoaded=NaN,this.bytesTotal=NaN,this.delayLoadingTime=NaN,this.responseType="arraybuffer",this.representationId=null}return _e(e,[{key:"isInitializationRequest",value:function(){return this.type&&this.type===pe.HTTPRequest.INIT_SEGMENT_TYPE}},{key:"setInfo",value:function(e){this.type=e&&e.init?pe.HTTPRequest.INIT_SEGMENT_TYPE:pe.HTTPRequest.MEDIA_SEGMENT_TYPE,this.url=e&&e.url?e.url:null,this.range=e&&e.range?e.range.start+"-"+e.range.end:null,this.mediaType=e&&e.mediaType?e.mediaType:null}}]),e}();me.ACTION_DOWNLOAD="download",me.ACTION_COMPLETE="complete";var Ee=me,ve=Object.defineProperty({default:Ee},"__esModule",{value:!0}),ye=Ae(S),Te=Ae(ve);function Ae(e){return e&&e.__esModule?e:{default:e}}function Se(e){var t=(e=e||{}).eventBus,n=e.events,r=e.dashMetrics,i=e.fragmentLoader,a=e.debug,o=e.streamInfo,s=e.type,u=void 0,l=void 0,d=void 0,f=void 0;function c(e){var t;return!!e&&(t=!1,d.some((function(n){if(r=e,i=n,!isNaN(r.index)&&r.startTime===i.startTime&&r.adaptationIndex===i.adaptationIndex&&r.type===i.type||function(e,t){return isNaN(e.index)&&isNaN(t.index)&&e.quality===t.quality}(e,n)||function(e,t){return e.action===Te.default.ACTION_COMPLETE&&e.action===t.action}(e,n))return t=!0;var r,i})),t)}function g(e){return isNaN(e.duration)?.25:Math.min(e.duration/8,.5)}function h(e){d=d.filter((function(t){var n=g(t);return isNaN(t.startTime)||void 0!==e&&t.startTime>=e-n}))}function p(e,t){t<=e+.5||(d=d.filter((function(n){var r=g(n);return isNaN(n.startTime)||n.startTime>=t-r||isNaN(n.duration)||n.startTime+n.duration<=e+r})))}function _(e,t,n){for(var r=e.length-1;r>=0;r--){var i=e[r],a=i.startTime,o=a+i.duration;if(n=isNaN(n)?g(i):n,!isNaN(a)&&!isNaN(o)&&t+n>=a&&t-n<o||isNaN(a)&&isNaN(t))return i}return null}function m(e,t){r.addSchedulingInfo(e,t),r.addRequestsQueue(e.mediaType,f,d)}function E(e){e.sender===i&&(f.splice(f.indexOf(e.request),1),e.response&&!e.error&&d.push(e.request),m(e.request,e.error?"failed":"executed"),t.trigger(n.FRAGMENT_LOADING_COMPLETED,{request:e.request,response:e.response,error:e.error,sender:this},{streamId:o.id,mediaType:s}))}function v(e){e.sender===i&&t.trigger(n.FRAGMENT_LOADING_PROGRESS,{request:e.request,response:e.response,error:e.error,sender:this},{streamId:o.id,mediaType:s})}function y(e){e.sender===i&&t.trigger(n.FRAGMENT_LOADING_ABANDONED,{request:e.request},{streamId:o.id,mediaType:s})}function T(){d=[],f=[]}return u={getStreamId:function(){return o.id},getType:function(){return s},getRequests:function(e){var t=e?e.state instanceof Array?e.state:[e.state]:[],n=[];return t.forEach((function(t){var r=function(e){var t=void 0;switch(e){case"loading":t=f;break;case"executed":t=d;break;default:t=[]}return t}(t);n=n.concat(function(e,t){if(t.hasOwnProperty("time"))return[_(e,t.time,t.threshold)];return e.filter((function(e){for(var n in t)if("state"!==n&&t.hasOwnProperty(n)&&e[n]!=t[n])return!1;return!0}))}(r,e))})),n},isFragmentLoaded:c,isFragmentLoadedOrPending:function(e){var t=!1,n=0,r=void 0;if(!(t=c(e)))for(n=0;n<f.length;n++)r=f[n],e.url===r.url&&e.startTime===r.startTime&&(t=!0);return t},removeExecutedRequestsBeforeTime:h,removeExecutedRequestsAfterTime:function(e){d=d.filter((function(t){return isNaN(t.startTime)||void 0!==e&&t.startTime<e}))},syncExecutedRequestsWithBufferedRange:function(e,t){if(e&&0!==e.length){for(var n=0,r=0,i=e.length;r<i;r++)p(n,e.start(r)),n=e.end(r);t>0&&p(n,t)}else h()},abortRequests:function(){l.debug("abort requests"),i.abort(),f=[]},executeRequest:function(e){switch(e.action){case Te.default.ACTION_COMPLETE:d.push(e),m(e,"executed"),l.debug("STREAM_COMPLETED"),t.trigger(n.STREAM_COMPLETED,{request:e},{streamId:e.mediaInfo.streamInfo.id,mediaType:e.mediaType});break;case Te.default.ACTION_DOWNLOAD:m(e,"loading"),f.push(e),function(e){t.trigger(n.FRAGMENT_LOADING_STARTED,{request:e},{streamId:o.id,mediaType:s}),i.load(e)}(e);break;default:l.warn("Unknown request action.")}},reset:function(){t.off(n.LOADING_COMPLETED,E,this),t.off(n.LOADING_DATA_PROGRESS,v,this),t.off(n.LOADING_ABANDONED,y,this),i&&i.reset(),T()},addExecutedRequest:function(e){d.push(e)}},l=a.getLogger(u),T(),t.on(n.LOADING_COMPLETED,E,u),t.on(n.LOADING_DATA_PROGRESS,v,u),t.on(n.LOADING_ABANDONED,y,u),u}Se.__dashjs_factory_name="FragmentModel";var Ie=ye.default.getClassFactory(Se);Ie.FRAGMENT_MODEL_LOADING="loading",Ie.FRAGMENT_MODEL_EXECUTED="executed",Ie.FRAGMENT_MODEL_CANCELED="canceled",Ie.FRAGMENT_MODEL_FAILED="failed",ye.default.updateClassFactory(Se.__dashjs_factory_name,Ie);var Re=Ie,be=Object.defineProperty({default:Re},"__esModule",{value:!0});var Ne=function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.code=t||null,this.message=n||null,this.data=r||null},Me=Object.defineProperty({default:Ne},"__esModule",{value:!0});var De=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.captionData=null,this.label=null,this.lang=null,this.defaultTrack=!1,this.kind=null,this.isFragmented=!1,this.isEmbedded=!1},Ce=Object.defineProperty({default:De},"__esModule",{value:!0}),Oe=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var we=function(){function e(t){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.offset=t._offset,this.type=t.type,this.size=t.size,this.boxes=[],t.boxes)for(var n=0;n<t.boxes.length;n++)this.boxes.push(new e(t.boxes[n]));switch(this.isComplete=!0,t.type){case"sidx":if(this.timescale=t.timescale,this.earliest_presentation_time=t.earliest_presentation_time,this.first_offset=t.first_offset,this.references=t.references,t.references){this.references=[];for(var r=0;r<t.references.length;r++){var i={reference_type:t.references[r].reference_type,referenced_size:t.references[r].referenced_size,subsegment_duration:t.references[r].subsegment_duration};this.references.push(i)}}break;case"emsg":this.id=t.id,this.version=1===t.version?1:0,this.value=t.value,this.timescale=t.timescale,this.scheme_id_uri=t.scheme_id_uri,this.presentation_time_delta=1===t.version?t.presentation_time:t.presentation_time_delta,this.event_duration=t.event_duration,this.message_data=t.message_data;break;case"mdhd":this.timescale=t.timescale;break;case"mfhd":this.sequence_number=t.sequence_number;break;case"subs":this.entry_count=t.entry_count,this.entries=t.entries;break;case"tfhd":this.base_data_offset=t.base_data_offset,this.sample_description_index=t.sample_description_index,this.default_sample_duration=t.default_sample_duration,this.default_sample_size=t.default_sample_size,this.default_sample_flags=t.default_sample_flags,this.flags=t.flags;break;case"tfdt":this.version=t.version,this.baseMediaDecodeTime=t.baseMediaDecodeTime,this.flags=t.flags;break;case"trun":if(this.sample_count=t.sample_count,this.first_sample_flags=t.first_sample_flags,this.data_offset=t.data_offset,this.flags=t.flags,this.samples=t.samples,t.samples){this.samples=[];for(var a=0,o=t.samples.length;a<o;a++){var s={sample_size:t.samples[a].sample_size,sample_duration:t.samples[a].sample_duration,sample_composition_time_offset:t.samples[a].sample_composition_time_offset};this.samples.push(s)}}}}return Oe(e,[{key:"getChildBox",value:function(e){for(var t=0;t<this.boxes.length;t++)if(this.boxes[t].type===e)return this.boxes[t]}},{key:"getChildBoxes",value:function(e){for(var t=[],n=0;n<this.boxes.length;n++)this.boxes[n].type===e&&t.push(this.boxes[n]);return t}}]),e}(),Pe=Fe(Object.defineProperty({default:we},"__esModule",{value:!0})),Le=Fe(S);function Fe(e){return e&&e.__esModule?e:{default:e}}function xe(){var e=void 0;function t(t){var r=[];if(!t||!e||"function"!=typeof e.fetchAll)return r;for(var i=e.fetchAll(t),a=void 0,o=0,s=i.length;o<s;o++)(a=n(i[o]))&&r.push(a);return r}function n(e){if(!e)return null;var t=new Pe.default(e);return e.hasOwnProperty("_incomplete")&&(t.isComplete=!e._incomplete),t}return{getBox:function(t){return t&&e&&e.boxes&&0!==e.boxes.length&&"function"==typeof e.fetch?n(e.fetch(t)):null},getBoxes:t,setData:function(t){e=t},getLastBox:function(){if(!e||!e.boxes||!e.boxes.length)return null;var n=t(e.boxes[e.boxes.length-1].type);return n.length>0?n[n.length-1]:null}}}xe.__dashjs_factory_name="IsoFile";var Ue=Le.default.getClassFactory(xe),Be=Object.defineProperty({default:Ue},"__esModule",{value:!0}),ke=f((function(e,t){var n={parseBuffer:function(e){return new r(e).parse()},addBoxProcessor:function(e,t){"string"==typeof e&&"function"==typeof t&&(i.prototype._boxProcessors[e]=t)},createFile:function(){return new r},createBox:function(e,t,n){var r=i.create(e);return t&&t.append(r,n),r},createFullBox:function(e,t,r){var i=n.createBox(e,t,r);return i.version=0,i.flags=0,i},Utils:{}};n.Utils.dataViewToString=function(e,t){var n=t||"utf-8";if("undefined"!=typeof TextDecoder)return new TextDecoder(n).decode(e);var r=[],i=0;if("utf-8"===n)for(;i<e.byteLength;){var a=e.getUint8(i++);a<128||(a<224?(a=(31&a)<<6,a|=63&e.getUint8(i++)):a<240?(a=(15&a)<<12,a|=(63&e.getUint8(i++))<<6,a|=63&e.getUint8(i++)):(a=(7&a)<<18,a|=(63&e.getUint8(i++))<<12,a|=(63&e.getUint8(i++))<<6,a|=63&e.getUint8(i++))),r.push(String.fromCharCode(a))}else for(;i<e.byteLength;)r.push(String.fromCharCode(e.getUint8(i++)));return r.join("")},n.Utils.utf8ToByteArray=function(e){var t,n;if("undefined"!=typeof TextEncoder)t=(new TextEncoder).encode(e);else for(t=[],n=0;n<e.length;++n){var r=e.charCodeAt(n);r<128?t.push(r):r<2048?(t.push(192|r>>6),t.push(128|63&r)):r<65536?(t.push(224|r>>12),t.push(128|63&r>>6),t.push(128|63&r)):(t.push(240|r>>18),t.push(128|63&r>>12),t.push(128|63&r>>6),t.push(128|63&r))}return t},n.Utils.appendBox=function(e,t,n){if(t._offset=e._cursor.offset,t._root=e._root?e._root:e,t._raw=e._raw,t._parent=e,-1!==n)if(null!=n){var r,i=-1;if("number"==typeof n)i=n;else{if("string"==typeof n)r=n;else{if("object"!=typeof n||!n.type)return void e.boxes.push(t);r=n.type}for(var a=0;a<e.boxes.length;a++)if(r===e.boxes[a].type){i=a+1;break}}e.boxes.splice(i,0,t)}else e.boxes.push(t)},t.parseBuffer=n.parseBuffer,t.addBoxProcessor=n.addBoxProcessor,t.createFile=n.createFile,t.createBox=n.createBox,t.createFullBox=n.createFullBox,t.Utils=n.Utils,n.Cursor=function(e){this.offset=void 0===e?0:e};var r=function(e){this._cursor=new n.Cursor,this.boxes=[],e&&(this._raw=new DataView(e))};r.prototype.fetch=function(e){var t=this.fetchAll(e,!0);return t.length?t[0]:null},r.prototype.fetchAll=function(e,t){var n=[];return r._sweep.call(this,e,n,t),n},r.prototype.parse=function(){for(this._cursor.offset=0,this.boxes=[];this._cursor.offset<this._raw.byteLength;){var e=i.parse(this);if(void 0===e.type)break;this.boxes.push(e)}return this},r._sweep=function(e,t,n){for(var i in this.type&&this.type==e&&t.push(this),this.boxes){if(t.length&&n)return;r._sweep.call(this.boxes[i],e,t,n)}},r.prototype.write=function(){var e,t=0;for(e=0;e<this.boxes.length;e++)t+=this.boxes[e].getLength(!1);var n=new Uint8Array(t);for(this._rawo=new DataView(n.buffer),this.bytes=n,this._cursor.offset=0,e=0;e<this.boxes.length;e++)this.boxes[e].write();return n.buffer},r.prototype.append=function(e,t){n.Utils.appendBox(this,e,t)};var i=function(){this._cursor=new n.Cursor};i.parse=function(e){var t=new i;return t._offset=e._cursor.offset,t._root=e._root?e._root:e,t._raw=e._raw,t._parent=e,t._parseBox(),e._cursor.offset=t._raw.byteOffset+t._raw.byteLength,t},i.create=function(e){var t=new i;return t.type=e,t.boxes=[],t},i.prototype._boxContainers=["dinf","edts","mdia","meco","mfra","minf","moof","moov","mvex","stbl","strk","traf","trak","tref","udta","vttc","sinf","schi","encv","enca"],i.prototype._boxProcessors={},i.prototype._procField=function(e,t,n){this._parsing?this[e]=this._readField(t,n):this._writeField(t,n,this[e])},i.prototype._procFieldArray=function(e,t,n,r){var i;if(this._parsing)for(this[e]=[],i=0;i<t;i++)this[e][i]=this._readField(n,r);else for(i=0;i<this[e].length;i++)this._writeField(n,r,this[e][i])},i.prototype._procFullBox=function(){this._procField("version","uint",8),this._procField("flags","uint",24)},i.prototype._procEntries=function(e,t,n){var r;if(this._parsing)for(this[e]=[],r=0;r<t;r++)this[e].push({}),n.call(this,this[e][r]);else for(r=0;r<t;r++)n.call(this,this[e][r])},i.prototype._procSubEntries=function(e,t,n,r){var i;if(this._parsing)for(e[t]=[],i=0;i<n;i++)e[t].push({}),r.call(this,e[t][i]);else for(i=0;i<n;i++)r.call(this,e[t][i])},i.prototype._procEntryField=function(e,t,n,r){this._parsing?e[t]=this._readField(n,r):this._writeField(n,r,e[t])},i.prototype._procSubBoxes=function(e,t){var n;if(this._parsing)for(this[e]=[],n=0;n<t;n++)this[e].push(i.parse(this));else for(n=0;n<t;n++)this._rawo?this[e][n].write():this.size+=this[e][n].getLength()},i.prototype._readField=function(e,t){switch(e){case"uint":return this._readUint(t);case"int":return this._readInt(t);case"template":return this._readTemplate(t);case"string":return-1===t?this._readTerminatedString():this._readString(t);case"data":return this._readData(t);case"utf8":return this._readUTF8String();default:return-1}},i.prototype._readInt=function(e){var t=null,n=this._cursor.offset-this._raw.byteOffset;switch(e){case 8:t=this._raw.getInt8(n);break;case 16:t=this._raw.getInt16(n);break;case 32:t=this._raw.getInt32(n);break;case 64:var r=this._raw.getInt32(n),i=this._raw.getInt32(n+4);t=r*Math.pow(2,32)+i}return this._cursor.offset+=e>>3,t},i.prototype._readUint=function(e){var t,n,r=null,i=this._cursor.offset-this._raw.byteOffset;switch(e){case 8:r=this._raw.getUint8(i);break;case 16:r=this._raw.getUint16(i);break;case 24:r=((t=this._raw.getUint16(i))<<8)+(n=this._raw.getUint8(i+2));break;case 32:r=this._raw.getUint32(i);break;case 64:t=this._raw.getUint32(i),n=this._raw.getUint32(i+4),r=t*Math.pow(2,32)+n}return this._cursor.offset+=e>>3,r},i.prototype._readString=function(e){for(var t="",n=0;n<e;n++){var r=this._readUint(8);t+=String.fromCharCode(r)}return t},i.prototype._readTemplate=function(e){return this._readUint(e/2)+this._readUint(e/2)/Math.pow(2,e/2)},i.prototype._readTerminatedString=function(){for(var e="";this._cursor.offset-this._offset<this._raw.byteLength;){var t=this._readUint(8);if(0===t)break;e+=String.fromCharCode(t)}return e},i.prototype._readData=function(e){var t=e>0?e:this._raw.byteLength-(this._cursor.offset-this._offset);if(t>0){var n=new Uint8Array(this._raw.buffer,this._cursor.offset,t);return this._cursor.offset+=t,n}return null},i.prototype._readUTF8String=function(){var e=this._raw.byteLength-(this._cursor.offset-this._offset),t=null;return e>0&&(t=new DataView(this._raw.buffer,this._cursor.offset,e),this._cursor.offset+=e),t?n.Utils.dataViewToString(t):t},i.prototype._parseBox=function(){if(this._parsing=!0,this._cursor.offset=this._offset,this._offset+8>this._raw.buffer.byteLength)this._root._incomplete=!0;else{switch(this._procField("size","uint",32),this._procField("type","string",4),1===this.size&&this._procField("largesize","uint",64),"uuid"===this.type&&this._procFieldArray("usertype",16,"uint",8),this.size){case 0:this._raw=new DataView(this._raw.buffer,this._offset,this._raw.byteLength-this._cursor.offset+8);break;case 1:this._offset+this.size>this._raw.buffer.byteLength?(this._incomplete=!0,this._root._incomplete=!0):this._raw=new DataView(this._raw.buffer,this._offset,this.largesize);break;default:this._offset+this.size>this._raw.buffer.byteLength?(this._incomplete=!0,this._root._incomplete=!0):this._raw=new DataView(this._raw.buffer,this._offset,this.size)}this._incomplete||(this._boxProcessors[this.type]&&this._boxProcessors[this.type].call(this),-1!==this._boxContainers.indexOf(this.type)?this._parseContainerBox():this._data=this._readData())}},i.prototype._parseFullBox=function(){this.version=this._readUint(8),this.flags=this._readUint(24)},i.prototype._parseContainerBox=function(){for(this.boxes=[];this._cursor.offset-this._raw.byteOffset<this._raw.byteLength;)this.boxes.push(i.parse(this))},i.prototype.append=function(e,t){n.Utils.appendBox(this,e,t)},i.prototype.getLength=function(){if(this._parsing=!1,this._rawo=null,this.size=0,this._procField("size","uint",32),this._procField("type","string",4),1===this.size&&this._procField("largesize","uint",64),"uuid"===this.type&&this._procFieldArray("usertype",16,"uint",8),this._boxProcessors[this.type]&&this._boxProcessors[this.type].call(this),-1!==this._boxContainers.indexOf(this.type))for(var e=0;e<this.boxes.length;e++)this.size+=this.boxes[e].getLength();return this._data&&this._writeData(this._data),this.size},i.prototype.write=function(){switch(this._parsing=!1,this._cursor.offset=this._parent._cursor.offset,this.size){case 0:this._rawo=new DataView(this._parent._rawo.buffer,this._cursor.offset,this.parent._rawo.byteLength-this._cursor.offset);break;case 1:this._rawo=new DataView(this._parent._rawo.buffer,this._cursor.offset,this.largesize);break;default:this._rawo=new DataView(this._parent._rawo.buffer,this._cursor.offset,this.size)}if(this._procField("size","uint",32),this._procField("type","string",4),1===this.size&&this._procField("largesize","uint",64),"uuid"===this.type&&this._procFieldArray("usertype",16,"uint",8),this._boxProcessors[this.type]&&this._boxProcessors[this.type].call(this),-1!==this._boxContainers.indexOf(this.type))for(var e=0;e<this.boxes.length;e++)this.boxes[e].write();return this._data&&this._writeData(this._data),this._parent._cursor.offset+=this.size,this.size},i.prototype._writeInt=function(e,t){if(this._rawo){var n=this._cursor.offset-this._rawo.byteOffset;switch(e){case 8:this._rawo.setInt8(n,t);break;case 16:this._rawo.setInt16(n,t);break;case 32:this._rawo.setInt32(n,t);break;case 64:var r=Math.floor(t/Math.pow(2,32)),i=t-r*Math.pow(2,32);this._rawo.setUint32(n,r),this._rawo.setUint32(n+4,i)}this._cursor.offset+=e>>3}else this.size+=e>>3},i.prototype._writeUint=function(e,t){if(this._rawo){var n,r,i=this._cursor.offset-this._rawo.byteOffset;switch(e){case 8:this._rawo.setUint8(i,t);break;case 16:this._rawo.setUint16(i,t);break;case 24:n=(16776960&t)>>8,r=255&t,this._rawo.setUint16(i,n),this._rawo.setUint8(i+2,r);break;case 32:this._rawo.setUint32(i,t);break;case 64:r=t-(n=Math.floor(t/Math.pow(2,32)))*Math.pow(2,32),this._rawo.setUint32(i,n),this._rawo.setUint32(i+4,r)}this._cursor.offset+=e>>3}else this.size+=e>>3},i.prototype._writeString=function(e,t){for(var n=0;n<e;n++)this._writeUint(8,t.charCodeAt(n))},i.prototype._writeTerminatedString=function(e){if(0!==e.length){for(var t=0;t<e.length;t++)this._writeUint(8,e.charCodeAt(t));this._writeUint(8,0)}},i.prototype._writeTemplate=function(e,t){var n=Math.floor(t),r=(t-n)*Math.pow(2,e/2);this._writeUint(e/2,n),this._writeUint(e/2,r)},i.prototype._writeData=function(e){if(e)if(this._rawo){if(e instanceof Array){for(var t=this._cursor.offset-this._rawo.byteOffset,n=0;n<e.length;n++)this._rawo.setInt8(t+n,e[n]);this._cursor.offset+=e.length}e instanceof Uint8Array&&(this._root.bytes.set(e,this._cursor.offset),this._cursor.offset+=e.length)}else this.size+=e.length},i.prototype._writeUTF8String=function(e){var t=n.Utils.utf8ToByteArray(e);if(this._rawo)for(var r=new DataView(this._rawo.buffer,this._cursor.offset,t.length),i=0;i<t.length;i++)r.setUint8(i,t[i]);else this.size+=t.length},i.prototype._writeField=function(e,t,n){switch(e){case"uint":this._writeUint(t,n);break;case"int":this._writeInt(t,n);break;case"template":this._writeTemplate(t,n);break;case"string":-1==t?this._writeTerminatedString(n):this._writeString(t,n);break;case"data":this._writeData(n);break;case"utf8":this._writeUTF8String(n)}},i.prototype._boxProcessors.avc1=i.prototype._boxProcessors.encv=function(){this._procFieldArray("reserved1",6,"uint",8),this._procField("data_reference_index","uint",16),this._procField("pre_defined1","uint",16),this._procField("reserved2","uint",16),this._procFieldArray("pre_defined2",3,"uint",32),this._procField("width","uint",16),this._procField("height","uint",16),this._procField("horizresolution","template",32),this._procField("vertresolution","template",32),this._procField("reserved3","uint",32),this._procField("frame_count","uint",16),this._procFieldArray("compressorname",32,"uint",8),this._procField("depth","uint",16),this._procField("pre_defined3","int",16),this._procField("config","data",-1)},i.prototype._boxProcessors.dref=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procSubBoxes("entries",this.entry_count)},i.prototype._boxProcessors.elst=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procEntries("entries",this.entry_count,(function(e){this._procEntryField(e,"segment_duration","uint",1===this.version?64:32),this._procEntryField(e,"media_time","int",1===this.version?64:32),this._procEntryField(e,"media_rate_integer","int",16),this._procEntryField(e,"media_rate_fraction","int",16)}))},i.prototype._boxProcessors.emsg=function(){this._procFullBox(),1==this.version?(this._procField("timescale","uint",32),this._procField("presentation_time","uint",64),this._procField("event_duration","uint",32),this._procField("id","uint",32),this._procField("scheme_id_uri","string",-1),this._procField("value","string",-1)):(this._procField("scheme_id_uri","string",-1),this._procField("value","string",-1),this._procField("timescale","uint",32),this._procField("presentation_time_delta","uint",32),this._procField("event_duration","uint",32),this._procField("id","uint",32)),this._procField("message_data","data",-1)},i.prototype._boxProcessors.free=i.prototype._boxProcessors.skip=function(){this._procField("data","data",-1)},i.prototype._boxProcessors.frma=function(){this._procField("data_format","uint",32)},i.prototype._boxProcessors.ftyp=i.prototype._boxProcessors.styp=function(){this._procField("major_brand","string",4),this._procField("minor_version","uint",32);var e=-1;this._parsing&&(e=(this._raw.byteLength-(this._cursor.offset-this._raw.byteOffset))/4),this._procFieldArray("compatible_brands",e,"string",4)},i.prototype._boxProcessors.hdlr=function(){this._procFullBox(),this._procField("pre_defined","uint",32),this._procField("handler_type","string",4),this._procFieldArray("reserved",3,"uint",32),this._procField("name","string",-1)},i.prototype._boxProcessors.mdat=function(){this._procField("data","data",-1)},i.prototype._boxProcessors.mdhd=function(){this._procFullBox(),this._procField("creation_time","uint",1==this.version?64:32),this._procField("modification_time","uint",1==this.version?64:32),this._procField("timescale","uint",32),this._procField("duration","uint",1==this.version?64:32),this._parsing||"string"!=typeof this.language||(this.language=this.language.charCodeAt(0)-96<<10|this.language.charCodeAt(1)-96<<5|this.language.charCodeAt(2)-96),this._procField("language","uint",16),this._parsing&&(this.language=String.fromCharCode(96+(this.language>>10&31),96+(this.language>>5&31),96+(31&this.language))),this._procField("pre_defined","uint",16)},i.prototype._boxProcessors.mehd=function(){this._procFullBox(),this._procField("fragment_duration","uint",1==this.version?64:32)},i.prototype._boxProcessors.mfhd=function(){this._procFullBox(),this._procField("sequence_number","uint",32)},i.prototype._boxProcessors.mfro=function(){this._procFullBox(),this._procField("mfra_size","uint",32)},i.prototype._boxProcessors.mp4a=i.prototype._boxProcessors.enca=function(){this._procFieldArray("reserved1",6,"uint",8),this._procField("data_reference_index","uint",16),this._procFieldArray("reserved2",2,"uint",32),this._procField("channelcount","uint",16),this._procField("samplesize","uint",16),this._procField("pre_defined","uint",16),this._procField("reserved3","uint",16),this._procField("samplerate","template",32),this._procField("esds","data",-1)},i.prototype._boxProcessors.mvhd=function(){this._procFullBox(),this._procField("creation_time","uint",1==this.version?64:32),this._procField("modification_time","uint",1==this.version?64:32),this._procField("timescale","uint",32),this._procField("duration","uint",1==this.version?64:32),this._procField("rate","template",32),this._procField("volume","template",16),this._procField("reserved1","uint",16),this._procFieldArray("reserved2",2,"uint",32),this._procFieldArray("matrix",9,"template",32),this._procFieldArray("pre_defined",6,"uint",32),this._procField("next_track_ID","uint",32)},i.prototype._boxProcessors.payl=function(){this._procField("cue_text","utf8")},i.prototype._boxProcessors.pssh=function(){this._procFullBox(),this._procFieldArray("SystemID",16,"uint",8),this._procField("DataSize","uint",32),this._procFieldArray("Data",this.DataSize,"uint",8)},i.prototype._boxProcessors.schm=function(){this._procFullBox(),this._procField("scheme_type","uint",32),this._procField("scheme_version","uint",32),1&this.flags&&this._procField("scheme_uri","string",-1)},i.prototype._boxProcessors.sdtp=function(){this._procFullBox();var e=-1;this._parsing&&(e=this._raw.byteLength-(this._cursor.offset-this._raw.byteOffset)),this._procFieldArray("sample_dependency_table",e,"uint",8)},i.prototype._boxProcessors.sidx=function(){this._procFullBox(),this._procField("reference_ID","uint",32),this._procField("timescale","uint",32),this._procField("earliest_presentation_time","uint",1==this.version?64:32),this._procField("first_offset","uint",1==this.version?64:32),this._procField("reserved","uint",16),this._procField("reference_count","uint",16),this._procEntries("references",this.reference_count,(function(e){this._parsing||(e.reference=(1&e.reference_type)<<31,e.reference|=2147483647&e.referenced_size,e.sap=(1&e.starts_with_SAP)<<31,e.sap|=(3&e.SAP_type)<<28,e.sap|=268435455&e.SAP_delta_time),this._procEntryField(e,"reference","uint",32),this._procEntryField(e,"subsegment_duration","uint",32),this._procEntryField(e,"sap","uint",32),this._parsing&&(e.reference_type=e.reference>>31&1,e.referenced_size=2147483647&e.reference,e.starts_with_SAP=e.sap>>31&1,e.SAP_type=e.sap>>28&7,e.SAP_delta_time=268435455&e.sap)}))},i.prototype._boxProcessors.smhd=function(){this._procFullBox(),this._procField("balance","uint",16),this._procField("reserved","uint",16)},i.prototype._boxProcessors.ssix=function(){this._procFullBox(),this._procField("subsegment_count","uint",32),this._procEntries("subsegments",this.subsegment_count,(function(e){this._procEntryField(e,"ranges_count","uint",32),this._procSubEntries(e,"ranges",e.ranges_count,(function(e){this._procEntryField(e,"level","uint",8),this._procEntryField(e,"range_size","uint",24)}))}))},i.prototype._boxProcessors.stsd=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procSubBoxes("entries",this.entry_count)},i.prototype._boxProcessors.subs=function(){this._procFullBox(),this._procField("entry_count","uint",32),this._procEntries("entries",this.entry_count,(function(e){this._procEntryField(e,"sample_delta","uint",32),this._procEntryField(e,"subsample_count","uint",16),this._procSubEntries(e,"subsamples",e.subsample_count,(function(e){this._procEntryField(e,"subsample_size","uint",1===this.version?32:16),this._procEntryField(e,"subsample_priority","uint",8),this._procEntryField(e,"discardable","uint",8),this._procEntryField(e,"codec_specific_parameters","uint",32)}))}))},i.prototype._boxProcessors.tenc=function(){this._procFullBox(),this._procField("default_IsEncrypted","uint",24),this._procField("default_IV_size","uint",8),this._procFieldArray("default_KID",16,"uint",8)},i.prototype._boxProcessors.tfdt=function(){this._procFullBox(),this._procField("baseMediaDecodeTime","uint",1==this.version?64:32)},i.prototype._boxProcessors.tfhd=function(){this._procFullBox(),this._procField("track_ID","uint",32),1&this.flags&&this._procField("base_data_offset","uint",64),2&this.flags&&this._procField("sample_description_offset","uint",32),8&this.flags&&this._procField("default_sample_duration","uint",32),16&this.flags&&this._procField("default_sample_size","uint",32),32&this.flags&&this._procField("default_sample_flags","uint",32)},i.prototype._boxProcessors.tfra=function(){this._procFullBox(),this._procField("track_ID","uint",32),this._parsing||(this.reserved=0,this.reserved|=(48&this.length_size_of_traf_num)<<4,this.reserved|=(12&this.length_size_of_trun_num)<<2,this.reserved|=3&this.length_size_of_sample_num),this._procField("reserved","uint",32),this._parsing&&(this.length_size_of_traf_num=(48&this.reserved)>>4,this.length_size_of_trun_num=(12&this.reserved)>>2,this.length_size_of_sample_num=3&this.reserved),this._procField("number_of_entry","uint",32),this._procEntries("entries",this.number_of_entry,(function(e){this._procEntryField(e,"time","uint",1===this.version?64:32),this._procEntryField(e,"moof_offset","uint",1===this.version?64:32),this._procEntryField(e,"traf_number","uint",8*(this.length_size_of_traf_num+1)),this._procEntryField(e,"trun_number","uint",8*(this.length_size_of_trun_num+1)),this._procEntryField(e,"sample_number","uint",8*(this.length_size_of_sample_num+1))}))},i.prototype._boxProcessors.tkhd=function(){this._procFullBox(),this._procField("creation_time","uint",1==this.version?64:32),this._procField("modification_time","uint",1==this.version?64:32),this._procField("track_ID","uint",32),this._procField("reserved1","uint",32),this._procField("duration","uint",1==this.version?64:32),this._procFieldArray("reserved2",2,"uint",32),this._procField("layer","uint",16),this._procField("alternate_group","uint",16),this._procField("volume","template",16),this._procField("reserved3","uint",16),this._procFieldArray("matrix",9,"template",32),this._procField("width","template",32),this._procField("height","template",32)},i.prototype._boxProcessors.trex=function(){this._procFullBox(),this._procField("track_ID","uint",32),this._procField("default_sample_description_index","uint",32),this._procField("default_sample_duration","uint",32),this._procField("default_sample_size","uint",32),this._procField("default_sample_flags","uint",32)},i.prototype._boxProcessors.trun=function(){this._procFullBox(),this._procField("sample_count","uint",32),1&this.flags&&this._procField("data_offset","int",32),4&this.flags&&this._procField("first_sample_flags","uint",32),this._procEntries("samples",this.sample_count,(function(e){256&this.flags&&this._procEntryField(e,"sample_duration","uint",32),512&this.flags&&this._procEntryField(e,"sample_size","uint",32),1024&this.flags&&this._procEntryField(e,"sample_flags","uint",32),2048&this.flags&&this._procEntryField(e,"sample_composition_time_offset",1===this.version?"int":"uint",32)}))},i.prototype._boxProcessors["url "]=i.prototype._boxProcessors["urn "]=function(){this._procFullBox(),"urn "===this.type&&this._procField("name","string",-1),this._procField("location","string",-1)},i.prototype._boxProcessors.vlab=function(){this._procField("source_label","utf8")},i.prototype._boxProcessors.vmhd=function(){this._procFullBox(),this._procField("graphicsmode","uint",16),this._procFieldArray("opcolor",3,"uint",16)},i.prototype._boxProcessors.vttC=function(){this._procField("config","utf8")},i.prototype._boxProcessors.vtte=function(){}}));var Ge=function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.lastCompletedOffset=t,this.found=n,this.size=r},qe=Object.defineProperty({default:Ge},"__esModule",{value:!0}),Ye=ze(ee),je=ze(Be),He=ze(S),Ke=ze(ke),Ve=ze(qe);function ze(e){return e&&e.__esModule?e:{default:e}}function We(){var e=void 0,t=void 0,n=this.context;function r(e){if(!e)return null;void 0===e.fileStart&&(e.fileStart=0);var t=Ke.default.parseBuffer(e),r=(0,je.default)(n).create();return r.setData(t),r}function i(e,t){return e[t+3]>>>0|e[t+2]<<8>>>0|e[t+1]<<16>>>0|e[t]<<24>>>0}function a(e,t){return String.fromCharCode(e[t++])+String.fromCharCode(e[t++])+String.fromCharCode(e[t++])+String.fromCharCode(e[t])}return t={parse:r,findLastTopIsoBoxCompleted:function(e,t,n){if(void 0===n&&(n=0),!t||n+8>=t.byteLength)return new Ve.default(0,!1);for(var r=t instanceof ArrayBuffer?new Uint8Array(t):t,o=void 0,s=0;n<r.byteLength;){var u=i(r,n),l=a(r,n+4);if(0===u)break;n+u<=r.byteLength&&(e.indexOf(l)>=0?o=new Ve.default(n,!0,u):s=n+u),n+=u}return o||new Ve.default(s,!1)},getMediaTimescaleFromMoov:function(e){var t=r(e),n=t?t.getBox("mdhd"):void 0;return n?n.timescale:NaN},getSamplesInfo:function(e){if(!e||0===e.byteLength)return{sampleList:[],lastSequenceNumber:NaN,totalDuration:NaN,numSequences:NaN};var t,n,i=r(e),a=i.getBoxes("moof"),o=i.getBoxes("mfhd"),s=void 0,u=void 0,l=void 0,d=void 0,f=void 0,c=void 0,g=void 0,h=void 0,p=void 0,_=void 0,m=void 0,E=void 0,v=void 0,y=void 0;n=i.getBoxes("moof").length,t=o[o.length-1].sequence_number,u=0,f=[];var T=-1,A=-1;for(_=0;_<a.length;_++){var S=a[_],I=S.getChildBoxes("traf");for(h=0;h<I.length;h++){var R=I[h],b=R.getChildBox("tfhd"),N=R.getChildBox("tfdt");d=N.baseMediaDecodeTime;var M=R.getChildBoxes("trun"),D=R.getChildBoxes("subs");for(p=0;p<M.length;p++){var C=M[p];for(u=C.sample_count,v=(b.base_data_offset||0)+(C.data_offset||0),g=0;g<u;g++){s=void 0!==(c=C.samples[g]).sample_duration?c.sample_duration:b.default_sample_duration,l=void 0!==c.sample_size?c.sample_size:b.default_sample_size;var O={dts:d,cts:d+(void 0!==c.sample_composition_time_offset?c.sample_composition_time_offset:0),duration:s,offset:S.offset+v,size:l,subSizes:[l]};if(D)for(m=0;m<D.length;m++){var w=D[m];if(T<w.entry_count-1&&g>A&&(T++,A+=w.entries[T].sample_delta),g==A){O.subSizes=[];var P=w.entries[T];for(E=0;E<P.subsample_count;E++)O.subSizes.push(P.subsamples[E].subsample_size)}}f.push(O),v+=l,d+=s}}y=d-N.baseMediaDecodeTime}}return{sampleList:f,lastSequenceNumber:t,totalDuration:y,numSequences:n}},findInitRange:function(t){var n=null,i=r(t);if(!i)return n;var a=i.getBox("ftyp"),o=i.getBox("moov");return e.debug("Searching for initialization."),o&&o.isComplete&&(n=(a?a.offset:o.offset)+"-"+(o.offset+o.size-1),e.debug("Found the initialization. Range: "+n)),n},parsePayload:function(e,t,n){if(void 0===n&&(n=0),!t||n+8>=t.byteLength)return new Ve.default(0,!1);for(var r=t instanceof ArrayBuffer?new Uint8Array(t):t,o=void 0,s=0;n<r.byteLength;){var u=i(r,n),l=a(r,n+4);if(0===u)break;n+u<=r.byteLength&&(e.indexOf(l)>=0?o=new Ve.default(n,!0,u,l):s=n+u),n+=u}return o||new Ve.default(s,!1)}},e=(0,Ye.default)(n).getInstance().getLogger(t),t}We.__dashjs_factory_name="BoxParser";var Xe=He.default.getSingletonFactory(We),Qe=Object.defineProperty({default:Xe},"__esModule",{value:!0}),Ze="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$e=function(e,t){if((void 0===e?"undefined":Ze(e))!==t)throw nt.default.BAD_ARGUMENT_ERROR},Je=function(e){if(null===e||isNaN(e)||e%1!=0)throw nt.default.BAD_ARGUMENT_ERROR+" : argument is not an integer"},et=function(e,t,n){if(e<t||e>n)throw nt.default.BAD_ARGUMENT_ERROR+" : argument out of range"},tt=function(e){if("string"!=typeof e||e!==nt.default.AUDIO&&e!==nt.default.VIDEO)throw nt.default.BAD_ARGUMENT_ERROR},nt=function(e){return e&&e.__esModule?e:{default:e}}(p);var rt=Object.defineProperty({checkParameterType:$e,checkInteger:Je,checkRange:et,checkIsVideoOrAudioType:tt},"__esModule",{value:!0}),it=function(e){return e&&e.__esModule?e:{default:e}}(S);function at(){return{customTimeRangeArray:[],length:0,add:function(e,t){var n=0;for(n=0;n<this.customTimeRangeArray.length&&e>this.customTimeRangeArray[n].start;n++);for(this.customTimeRangeArray.splice(n,0,{start:e,end:t}),n=0;n<this.customTimeRangeArray.length-1;n++)this.mergeRanges(n,n+1)&&n--;this.length=this.customTimeRangeArray.length},clear:function(){this.customTimeRangeArray=[],this.length=0},remove:function(e,t){for(var n=0;n<this.customTimeRangeArray.length;n++)if(e<=this.customTimeRangeArray[n].start&&t>=this.customTimeRangeArray[n].end)this.customTimeRangeArray.splice(n,1),n--;else{if(e>this.customTimeRangeArray[n].start&&t<this.customTimeRangeArray[n].end){this.customTimeRangeArray.splice(n+1,0,{start:t,end:this.customTimeRangeArray[n].end}),this.customTimeRangeArray[n].end=e;break}e>this.customTimeRangeArray[n].start&&e<this.customTimeRangeArray[n].end?this.customTimeRangeArray[n].end=e:t>this.customTimeRangeArray[n].start&&t<this.customTimeRangeArray[n].end&&(this.customTimeRangeArray[n].start=t)}this.length=this.customTimeRangeArray.length},mergeRanges:function(e,t){var n=this.customTimeRangeArray[e],r=this.customTimeRangeArray[t];return n.start<=r.start&&r.start<=n.end&&n.end<=r.end?(n.end=r.end,this.customTimeRangeArray.splice(t,1),!0):r.start<=n.start&&n.start<=r.end&&r.end<=n.end?(n.start=r.start,this.customTimeRangeArray.splice(t,1),!0):r.start<=n.start&&n.start<=r.end&&n.end<=r.end?(this.customTimeRangeArray.splice(e,1),!0):n.start<=r.start&&r.start<=n.end&&r.end<=n.end&&(this.customTimeRangeArray.splice(t,1),!0)},start:function(e){return(0,rt.checkInteger)(e),e>=this.customTimeRangeArray.length||e<0?NaN:this.customTimeRangeArray[e].start},end:function(e){return(0,rt.checkInteger)(e),e>=this.customTimeRangeArray.length||e<0?NaN:this.customTimeRangeArray[e].end}}}at.__dashjs_factory_name="CustomTimeRanges";var ot=it.default.getClassFactory(at),st=Object.defineProperty({default:ot},"__esModule",{value:!0}),ut=f((function(e,t){!function(e){e.ns_tt="http://www.w3.org/ns/ttml",e.ns_tts="http://www.w3.org/ns/ttml#styling",e.ns_ttp="http://www.w3.org/ns/ttml#parameter",e.ns_xml="http://www.w3.org/XML/1998/namespace",e.ns_itts="http://www.w3.org/ns/ttml/profile/imsc1#styling",e.ns_ittp="http://www.w3.org/ns/ttml/profile/imsc1#parameter",e.ns_smpte="http://www.smpte-ra.org/schemas/2052-1/2010/smpte-tt",e.ns_ebutts="urn:ebu:tt:style"}(t)})),lt=f((function(e,t){!function(e){var t=/#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})?/,n=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/,r=/rgba\(\s*(\d+),\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/,i={transparent:[0,0,0,0],black:[0,0,0,255],silver:[192,192,192,255],gray:[128,128,128,255],white:[255,255,255,255],maroon:[128,0,0,255],red:[255,0,0,255],purple:[128,0,128,255],fuchsia:[255,0,255,255],magenta:[255,0,255,255],green:[0,128,0,255],lime:[0,255,0,255],olive:[128,128,0,255],yellow:[255,255,0,255],navy:[0,0,128,255],blue:[0,0,255,255],teal:[0,128,128,255],aqua:[0,255,255,255],cyan:[0,255,255,255]};e.parseColor=function(e){var a,o=null,s=i[e.toLowerCase()];return void 0!==s?o=s:null!==(a=t.exec(e))?o=[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16),void 0!==a[4]?parseInt(a[4],16):255]:null!==(a=n.exec(e))?o=[parseInt(a[1]),parseInt(a[2]),parseInt(a[3]),255]:null!==(a=r.exec(e))&&(o=[parseInt(a[1]),parseInt(a[2]),parseInt(a[3]),parseInt(a[4])]),o};var a=/^((?:\+|\-)?\d*(?:\.\d+)?)(px|em|c|%|rh|rw)$/;e.parseLength=function(e){var t,n=null;return null!==(t=a.exec(e))&&(n={value:parseFloat(t[1]),unit:t[2]}),n},e.parseTextShadow=function(t){var n=t.split(","),r=[];for(var i in n){var a=n[i].split(" ");if(1===a.length&&"none"===a[0])return"none";if(a.length>1&&a.length<5){var o=[null,null,null,null],s=e.parseLength(a.shift());if(null===s)return null;if(o[0]=s,null===(s=e.parseLength(a.shift())))return null;if(o[1]=s,0===a.length){r.push(o);continue}if(null!==(s=e.parseLength(a[0]))&&(o[2]=s,a.shift()),0===a.length){r.push(o);continue}var u=e.parseColor(a[0]);if(null===u)return null;o[3]=u,r.push(o)}}return r},e.parsePosition=function(t){var n=t.split(" "),r=function(e){return"center"===e||"left"===e||"top"===e||"bottom"===e||"right"===e};if(n.length>4)return null;for(var i in n)if(!r(n[i])){var a=e.parseLength(n[i]);if(null===a)return null;n[i]=a}for(var o={h:{edge:"left",offset:{value:50,unit:"%"}},v:{edge:"top",offset:{value:50,unit:"%"}}},s=0;s<n.length;){var u=n[s++];if(r(u)){var l={value:0,unit:"%"};2!==n.length&&s<n.length&&!r(n[s])&&(l=n[s++]),"right"===u?(o.h.edge=u,o.h.offset=l):"bottom"===u?(o.v.edge=u,o.v.offset=l):"left"===u?o.h.offset=l:"top"===u&&(o.v.offset=l)}else{if(1!==n.length&&2!==n.length)return null;1===s?o.h.offset=u:o.v.offset=u}}return o},e.ComputedLength=function(e,t){this.rw=e,this.rh=t},e.ComputedLength.prototype.toUsedLength=function(e,t){return e*this.rw+t*this.rh},e.ComputedLength.prototype.isZero=function(){return 0===this.rw&&0===this.rh},e.toComputedLength=function(t,n,r,i,a,o){return"%"===n&&i?new e.ComputedLength(i.rw*t/100,i.rh*t/100):"em"===n&&r?new e.ComputedLength(r.rw*t,r.rh*t):"c"===n&&a?new e.ComputedLength(t*a.rw,t*a.rh):"px"===n&&o?new e.ComputedLength(t*o.rw,t*o.rh):"rh"===n?new e.ComputedLength(0,t/100):"rw"===n?new e.ComputedLength(t/100,0):null}}(t)})),dt=f((function(e,t){!function(e,t,n){function r(e,t,n,r,i,a,o,s){this.name=t,this.ns=e,this.qname=e+" "+t,this.inherit=i,this.animatable=a,this.initial=n,this.applies=r,this.parse=o,this.compute=s}for(var i in e.all=[new r(t.ns_tts,"backgroundColor","transparent",["body","div","p","region","span"],!1,!0,n.parseColor,null),new r(t.ns_tts,"color","white",["span"],!0,!0,n.parseColor,null),new r(t.ns_tts,"direction","ltr",["p","span"],!0,!0,(function(e){return e}),null),new r(t.ns_tts,"display","auto",["body","div","p","region","span"],!1,!0,(function(e){return e}),null),new r(t.ns_tts,"displayAlign","before",["region"],!1,!0,(function(e){return e}),null),new r(t.ns_tts,"extent","auto",["tt","region"],!1,!0,(function(e){if("auto"===e)return e;var t=e.split(" ");if(2!==t.length)return null;var r=n.parseLength(t[0]),i=n.parseLength(t[1]);return i&&r?{h:i,w:r}:null}),(function(e,t,r,i,a){var o,s;if("auto"===i)o=new n.ComputedLength(0,1);else if(null===(o=n.toComputedLength(i.h.value,i.h.unit,null,e.dimensions.h,null,e.pxLength.h)))return null;if("auto"===i)s=new n.ComputedLength(1,0);else if(null===(s=n.toComputedLength(i.w.value,i.w.unit,null,e.dimensions.w,null,e.pxLength.w)))return null;return{h:o,w:s}})),new r(t.ns_tts,"fontFamily","default",["span","p"],!0,!0,(function(e){var t=e.split(","),n=[];for(var r in t)"'"!==t[r].charAt(0)&&'"'!==t[r].charAt(0)&&"default"===t[r]?n.push("monospaceSerif"):n.push(t[r]);return n}),null),new r(t.ns_tts,"shear","0%",["p"],!0,!0,n.parseLength,(function(e,t,n,r){return"%"!==r.unit?null:Math.abs(r.value)>100?100*Math.sign(r.value):r.value})),new r(t.ns_tts,"fontSize","1c",["span","p"],!0,!0,n.parseLength,(function(t,r,i,a,o){return n.toComputedLength(a.value,a.unit,null!==r?r.styleAttrs[e.byName.fontSize.qname]:t.cellLength.h,null!==r?r.styleAttrs[e.byName.fontSize.qname]:t.cellLength.h,t.cellLength.h,t.pxLength.h)})),new r(t.ns_tts,"fontStyle","normal",["span","p"],!0,!0,(function(e){return e}),null),new r(t.ns_tts,"fontWeight","normal",["span","p"],!0,!0,(function(e){return e}),null),new r(t.ns_tts,"lineHeight","normal",["p"],!0,!0,(function(e){return"normal"===e?e:n.parseLength(e)}),(function(t,r,i,a,o){var s;if("normal"===a)s=a;else if(null===(s=n.toComputedLength(a.value,a.unit,i.styleAttrs[e.byName.fontSize.qname],i.styleAttrs[e.byName.fontSize.qname],t.cellLength.h,t.pxLength.h)))return null;return s})),new r(t.ns_tts,"opacity",1,["region"],!1,!0,parseFloat,null),new r(t.ns_tts,"origin","auto",["region"],!1,!0,(function(e){if("auto"===e)return e;var t=e.split(" ");if(2!==t.length)return null;var r=n.parseLength(t[0]),i=n.parseLength(t[1]);return i&&r?{h:i,w:r}:null}),(function(e,t,r,i,a){var o,s;if("auto"===i)o=new n.ComputedLength(0,0);else if(null===(o=n.toComputedLength(i.h.value,i.h.unit,null,e.dimensions.h,null,e.pxLength.h)))return null;if("auto"===i)s=new n.ComputedLength(0,0);else if(null===(s=n.toComputedLength(i.w.value,i.w.unit,null,e.dimensions.w,null,e.pxLength.w)))return null;return{h:o,w:s}})),new r(t.ns_tts,"overflow","hidden",["region"],!1,!0,(function(e){return e}),null),new r(t.ns_tts,"padding","0px",["region"],!1,!0,(function(e){var t=e.split(" ");if(t.length>4)return null;var r=[];for(var i in t){var a=n.parseLength(t[i]);if(!a)return null;r.push(a)}return r}),(function(t,r,i,a,o){var s;if(1===a.length)s=[a[0],a[0],a[0],a[0]];else if(2===a.length)s=[a[0],a[1],a[0],a[1]];else if(3===a.length)s=[a[0],a[1],a[2],a[1]];else{if(4!==a.length)return null;s=[a[0],a[1],a[2],a[3]]}var u=i.styleAttrs[e.byName.writingMode.qname];if("lrtb"===u||"lr"===u)s=[s[0],s[3],s[2],s[1]];else if("rltb"===u||"rl"===u)s=[s[0],s[1],s[2],s[3]];else if("tblr"===u)s=[s[3],s[0],s[1],s[2]];else{if("tbrl"!==u&&"tb"!==u)return null;s=[s[3],s[2],s[1],s[0]]}var l=[];for(var d in s)if(0===s[d].value)l[d]=new n.ComputedLength(0,0);else if(l[d]=n.toComputedLength(s[d].value,s[d].unit,i.styleAttrs[e.byName.fontSize.qname],"0"===d||"2"===d?i.styleAttrs[e.byName.extent.qname].h:i.styleAttrs[e.byName.extent.qname].w,"0"===d||"2"===d?t.cellLength.h:t.cellLength.w,"0"===d||"2"===d?t.pxLength.h:t.pxLength.w),null===l[d])return null;return l})),new r(t.ns_tts,"position","top left",["region"],!1,!0,(function(e){return n.parsePosition(e)}),(function(t,r,i,a){var o,s;return null===(o=n.toComputedLength(a.v.offset.value,a.v.offset.unit,null,new n.ComputedLength(-i.styleAttrs[e.byName.extent.qname].h.rw,t.dimensions.h.rh-i.styleAttrs[e.byName.extent.qname].h.rh),null,t.pxLength.h))?null:("bottom"===a.v.edge&&(o=new n.ComputedLength(-o.rw-i.styleAttrs[e.byName.extent.qname].h.rw,t.dimensions.h.rh-o.rh-i.styleAttrs[e.byName.extent.qname].h.rh)),s=n.toComputedLength(a.h.offset.value,a.h.offset.unit,null,new n.ComputedLength(t.dimensions.w.rw-i.styleAttrs[e.byName.extent.qname].w.rw,-i.styleAttrs[e.byName.extent.qname].w.rh),null,t.pxLength.w),null===o?null:("right"===a.h.edge&&(s=new n.ComputedLength(t.dimensions.w.rw-s.rw-i.styleAttrs[e.byName.extent.qname].w.rw,-s.rh-i.styleAttrs[e.byName.extent.qname].w.rh)),{h:o,w:s}))})),new r(t.ns_tts,"ruby","none",["span"],!1,!0,(function(e){return e}),null),new r(t.ns_tts,"rubyAlign","center",["span"],!0,!0,(function(e){return"center"!==e&&"spaceAround"!==e?null:e}),null),new r(t.ns_tts,"rubyPosition","outside",["span"],!0,!0,(function(e){return e}),null),new r(t.ns_tts,"rubyReserve","none",["p"],!0,!0,(function(e){var t=e.split(" "),r=[null,null];if(0===t.length||t.length>2)return null;if("none"!==t[0]&&"both"!==t[0]&&"after"!==t[0]&&"before"!==t[0]&&"outside"!==t[0])return null;if(r[0]=t[0],2===t.length&&"none"!==t[0]){var i=n.parseLength(t[1]);if(!i)return null;r[1]=i}return r}),(function(t,r,i,a,o){if("none"===a[0])return a;var s=null;return null===(s=null===a[1]?new n.ComputedLength(.5*i.styleAttrs[e.byName.fontSize.qname].rw,.5*i.styleAttrs[e.byName.fontSize.qname].rh):n.toComputedLength(a[1].value,a[1].unit,i.styleAttrs[e.byName.fontSize.qname],i.styleAttrs[e.byName.fontSize.qname],t.cellLength.h,t.pxLength.h))?null:[a[0],s]})),new r(t.ns_tts,"showBackground","always",["region"],!1,!0,(function(e){return e}),null),new r(t.ns_tts,"textAlign","start",["p"],!0,!0,(function(e){return e}),(function(e,t,n,r,i){return"left"===r?"start":"right"===r?"end":r})),new r(t.ns_tts,"textCombine","none",["span"],!0,!0,(function(e){return"none"===e||"all"===e?e:null}),null),new r(t.ns_tts,"textDecoration","none",["span"],!0,!0,(function(e){return e.split(" ")}),null),new r(t.ns_tts,"textEmphasis","none",["span"],!0,!0,(function(e){var t=e.split(" "),r={style:null,symbol:null,color:null,position:null};for(var i in t)if("none"===t[i]||"auto"===t[i])r.style=t[i];else if("filled"===t[i]||"open"===t[i])r.style=t[i];else if("circle"===t[i]||"dot"===t[i]||"sesame"===t[i])r.symbol=t[i];else if("current"===t[i])r.color=t[i];else if("outside"===t[i]||"before"===t[i]||"after"===t[i])r.position=t[i];else if(r.color=n.parseColor(t[i]),null===r.color)return null;return null==r.style&&null==r.symbol?r.style="auto":(r.symbol=r.symbol||"circle",r.style=r.style||"filled"),r.position=r.position||"outside",r.color=r.color||"current",r}),null),new r(t.ns_tts,"textOutline","none",["span"],!0,!0,(function(e){if("none"===e)return e;var t={},r=e.split(" ");if(0===r.length||r.length>2)return null;var i=n.parseColor(r[0]);if(t.color=i,null!==i&&r.shift(),1!==r.length)return null;var a=n.parseLength(r[0]);return a?(t.thickness=a,t):null}),(function(t,r,i,a,o){if("none"===a)return a;var s={};return null===a.color?s.color=i.styleAttrs[e.byName.color.qname]:s.color=a.color,s.thickness=n.toComputedLength(a.thickness.value,a.thickness.unit,i.styleAttrs[e.byName.fontSize.qname],i.styleAttrs[e.byName.fontSize.qname],t.cellLength.h,t.pxLength.h),null===s.thickness?null:s})),new r(t.ns_tts,"textShadow","none",["span"],!0,!0,n.parseTextShadow,(function(t,r,i,a){if("none"===a)return a;var o=[];for(var s in a){var u={};if(u.x_off=n.toComputedLength(a[s][0].value,a[s][0].unit,null,i.styleAttrs[e.byName.fontSize.qname],null,t.pxLength.w),null===u.x_off)return null;if(u.y_off=n.toComputedLength(a[s][1].value,a[s][1].unit,null,i.styleAttrs[e.byName.fontSize.qname],null,t.pxLength.h),null===u.y_off)return null;if(null===a[s][2])u.b_radius=0;else if(u.b_radius=n.toComputedLength(a[s][2].value,a[s][2].unit,null,i.styleAttrs[e.byName.fontSize.qname],null,t.pxLength.h),null===u.b_radius)return null;null===a[s][3]?u.color=i.styleAttrs[e.byName.color.qname]:u.color=a[s][3],o.push(u)}return o})),new r(t.ns_tts,"unicodeBidi","normal",["span","p"],!1,!0,(function(e){return e}),null),new r(t.ns_tts,"visibility","visible",["body","div","p","region","span"],!0,!0,(function(e){return e}),null),new r(t.ns_tts,"wrapOption","wrap",["span"],!0,!0,(function(e){return e}),null),new r(t.ns_tts,"writingMode","lrtb",["region"],!1,!0,(function(e){return e}),null),new r(t.ns_tts,"zIndex","auto",["region"],!1,!0,(function(e){var t;return"auto"===e?t=e:(t=parseInt(e),isNaN(t)&&(t=null)),t}),null),new r(t.ns_ebutts,"linePadding","0c",["p"],!0,!1,n.parseLength,(function(e,t,r,i,a){return n.toComputedLength(i.value,i.unit,null,null,e.cellLength.w,null)})),new r(t.ns_ebutts,"multiRowAlign","auto",["p"],!0,!1,(function(e){return e}),null),new r(t.ns_smpte,"backgroundImage",null,["div"],!1,!1,(function(e){return e}),null),new r(t.ns_itts,"forcedDisplay","false",["body","div","p","region","span"],!0,!0,(function(e){return"true"===e}),null),new r(t.ns_itts,"fillLineGap","false",["p"],!0,!0,(function(e){return"true"===e}),null)],e.byQName={},e.all)e.byQName[e.all[i].qname]=e.all[i];for(var a in e.byName={},e.all)e.byName[e.all[a].name]=e.all[a]}(t,"undefined"==typeof imscNames?ut:imscNames,"undefined"==typeof imscUtils?lt:imscUtils)})),ft=f((function(e,t){!function(e,t,n,r){e.generateISD=function(e,t,n){var r=new o(e),i={};for(var s in e.head.layout.regions){var u=a(e,t,e.head.layout.regions[s],e.body,null,"",e.head.layout.regions[s],n,i);null!==u&&r.contents.push(u.element)}return r};var i=[n.byName.color.qname,n.byName.textCombine.qname,n.byName.textDecoration.qname,n.byName.textEmphasis.qname,n.byName.textOutline.qname,n.byName.textShadow.qname];function a(e,t,o,l,d,f,c,g,h){if(t<c.begin||t>=c.end)return null;var p="regionID"in c&&""!==c.regionID?c.regionID:f;if(null!==d&&p!==o.id&&(!("contents"in c)||"contents"in c&&0===c.contents.length||""!==p))return null;var _=new s(c);for(var m in c.sets)t<c.sets[m].begin||t>=c.sets[m].end||(_.styleAttrs[c.sets[m].qname]=c.sets[m].value);var E,v={};for(var y in _.styleAttrs)if(v[y]=!0,"region"===_.kind&&y===n.byName.writingMode.qname&&!(n.byName.direction.qname in _.styleAttrs)){var T=_.styleAttrs[y];"lrtb"===T||"lr"===T?_.styleAttrs[n.byName.direction.qname]="ltr":"rltb"!==T&&"rl"!==T||(_.styleAttrs[n.byName.direction.qname]="rtl")}if(null!==d)for(var A in n.all){var S=n.all[A];if(S.qname===n.byName.textDecoration.qname){var I=d.styleAttrs[S.qname],R=_.styleAttrs[S.qname],b=[];void 0===R?b=I:-1===R.indexOf("none")?((-1===R.indexOf("noUnderline")&&-1!==I.indexOf("underline")||-1!==R.indexOf("underline"))&&b.push("underline"),(-1===R.indexOf("noLineThrough")&&-1!==I.indexOf("lineThrough")||-1!==R.indexOf("lineThrough"))&&b.push("lineThrough"),(-1===R.indexOf("noOverline")&&-1!==I.indexOf("overline")||-1!==R.indexOf("overline"))&&b.push("overline")):b.push("none"),_.styleAttrs[S.qname]=b}else if(S.qname!==n.byName.fontSize.qname||S.qname in _.styleAttrs||"span"!==_.kind||"textContainer"!==_.styleAttrs[n.byName.ruby.qname])if(S.qname!==n.byName.fontSize.qname||S.qname in _.styleAttrs||"span"!==_.kind||"text"!==_.styleAttrs[n.byName.ruby.qname])S.inherit&&S.qname in d.styleAttrs&&!(S.qname in _.styleAttrs)&&(_.styleAttrs[S.qname]=d.styleAttrs[S.qname]);else{var N=d.styleAttrs[n.byName.fontSize.qname];"textContainer"===d.styleAttrs[n.byName.ruby.qname]?_.styleAttrs[S.qname]=N:_.styleAttrs[S.qname]=new r.ComputedLength(.5*N.rw,.5*N.rh)}else{var M=d.styleAttrs[n.byName.fontSize.qname];_.styleAttrs[S.qname]=new r.ComputedLength(.5*M.rw,.5*M.rh)}}for(var D in n.all){var C=n.all[D];if(!(C.qname in _.styleAttrs)&&!(C.qname===n.byName.position.qname&&n.byName.origin.qname in _.styleAttrs||C.qname===n.byName.origin.qname&&n.byName.position.qname in _.styleAttrs)){var O=e.head.styling.initials[C.qname]||C.initial;if(null!==O&&("region"===_.kind||!1===C.inherit&&null!==O)){var w=C.parse(O);null!==w?(_.styleAttrs[C.qname]=w,v[C.qname]=!0):u(g,"Invalid initial value for '"+C.qname+"' on element '"+_.kind)}}}for(var P in n.all){var L=n.all[P];if(L.qname in v&&null!==L.compute){var F=L.compute(e,d,_,_.styleAttrs[L.qname],h);null!==F?_.styleAttrs[L.qname]=F:(_.styleAttrs[L.qname]=L.compute(e,d,_,L.parse(L.initial),h),u(g,"Style '"+L.qname+"' on element '"+_.kind+"' cannot be computed"))}}if("none"===_.styleAttrs[n.byName.display.qname])return null;for(var x in null===d?E=null===l?[]:[l]:"contents"in c&&(E=c.contents),E){var U=a(e,t,o,l,_,p,E[x],g,h);null!==U&&_.contents.push(U.element)}for(var B in _.styleAttrs){var k=!1;if("span"===_.kind){var G=_.styleAttrs[n.byName.ruby.qname];(k=("container"===G||"textContainer"===G||"baseContainer"===G)&&-1!==i.indexOf(B))||(k="container"!==G&&B===n.byName.rubyAlign.qname),k||(k=!("textContainer"===G||"text"===G)&&B===n.byName.rubyPosition.qname)}if(!k)k=-1===n.byQName[B].applies.indexOf(_.kind);k&&delete _.styleAttrs[B]}var q=_.styleAttrs[n.byName.ruby.qname];if("p"===_.kind||"span"===_.kind&&("textContainer"===q||"text"===q)){var Y=[];!function e(t,r){for(var i in t.contents){var a=t.contents[i],o=a.styleAttrs[n.byName.ruby.qname];("span"!==a.kind||"textContainer"!==o&&"text"!==o)&&("contents"in a?e(a,r):("span"===a.kind&&0!==a.text.length||"br"===a.kind)&&r.push(a))}}(_,Y),function(e){for(var t,n=0;n<e.length;)if("br"!==(t=e[n]).kind&&"preserve"!==t.space){var r=t.text.replace(/[\t\r\n ]+/g," ");/^[ ]/.test(r)&&(0===n||("br"===(i=e[n-1]).kind||/[\r\n\t ]$/.test(i.text)))&&(r=r.substring(1)),t.text=r,0===r.length?e.splice(n,1):n++}else n++;var i;for(n=0;n<e.length;n++)"br"!==(t=e[n]).kind&&"preserve"!==t.space?/[ ]$/.test(t.text)&&(n===e.length-1||("br"===(a=e[n+1]).kind||"preserve"===a.space&&/^[\r\n]/.test(a.text)))&&(t.text=t.text.slice(0,-1)):n++;var a}(Y),function e(t){if("br"===t.kind)return!1;if("text"in t)return 0===t.text.length;if("contents"in t){for(var n=t.contents.length;n--;)e(t.contents[n])&&t.contents.splice(n,1);return 0===t.contents.length}}(_)}return"div"===_.kind&&n.byName.backgroundImage.qname in _.styleAttrs||"br"===_.kind||"image"===_.kind||"contents"in _&&_.contents.length>0||"span"===_.kind&&null!==_.text||"region"===_.kind&&"always"===_.styleAttrs[n.byName.showBackground.qname]?{region_id:p,element:_}:null}function o(e){this.contents=[],this.aspectRatio=e.aspectRatio,this.lang=e.lang}function s(e){for(var t in this.kind=e.kind||"region",this.lang=e.lang,e.id&&(this.id=e.id),this.styleAttrs={},e.styleAttrs)this.styleAttrs[t]=e.styleAttrs[t];"src"in e&&(this.src=e.src),"type"in e&&(this.type=e.type),"text"in e?this.text=e.text:("region"===this.kind||"contents"in e)&&(this.contents=[]),"space"in e&&(this.space=e.space)}function u(e,t){if(e&&e.error&&e.error(t))throw t}}(t,"undefined"==typeof imscNames||imscNames,"undefined"==typeof imscStyles?dt:imscStyles,"undefined"==typeof imscUtils?lt:imscUtils)})),ct=f((function(e,t){!function(e){e.parser=function(e,t){return new a(e,t)},e.SAXParser=a,e.SAXStream=s,e.createStream=function(e,t){return new s(e,t)},e.MAX_BUFFER_LENGTH=65536;var t,n=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];function a(t,r){if(!(this instanceof a))return new a(t,r);!function(e){for(var t=0,r=n.length;t<r;t++)e[n[t]]=""}(this),this.q=this.c="",this.bufferCheckPosition=e.MAX_BUFFER_LENGTH,this.opt=r||{},this.opt.lowercase=this.opt.lowercase||this.opt.lowercasetags,this.looseCase=this.opt.lowercase?"toLowerCase":"toUpperCase",this.tags=[],this.closed=this.closedRoot=this.sawRoot=!1,this.tag=this.error=null,this.strict=!!t,this.noscript=!(!t&&!this.opt.noscript),this.state=R.BEGIN,this.strictEntities=this.opt.strictEntities,this.ENTITIES=this.strictEntities?Object.create(e.XML_ENTITIES):Object.create(e.ENTITIES),this.attribList=[],this.opt.xmlns&&(this.ns=Object.create(h)),this.trackPosition=!1!==this.opt.position,this.trackPosition&&(this.position=this.line=this.column=0),N(this,"onready")}e.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"],Object.create||(Object.create=function(e){function t(){}return t.prototype=e,new t}),Object.keys||(Object.keys=function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t}),a.prototype={end:function(){w(this)},write:function(t){if(this.error)throw this.error;if(this.closed)return O(this,"Cannot write after close. Assign an onready handler.");if(null===t)return w(this);"object"==typeof t&&(t=t.toString());var r=0,i="";for(;i=q(t,r++),this.c=i,i;)switch(this.trackPosition&&(this.position++,"\n"===i?(this.line++,this.column=0):this.column++),this.state){case R.BEGIN:if(this.state=R.BEGIN_WHITESPACE,"\ufeff"===i)continue;G(this,i);continue;case R.BEGIN_WHITESPACE:G(this,i);continue;case R.TEXT:if(this.sawRoot&&!this.closedRoot){for(var a=r-1;i&&"<"!==i&&"&"!==i;)(i=q(t,r++))&&this.trackPosition&&(this.position++,"\n"===i?(this.line++,this.column=0):this.column++);this.textNode+=t.substring(a,r-1)}"<"!==i||this.sawRoot&&this.closedRoot&&!this.strict?(!T(u,i)||this.sawRoot&&!this.closedRoot||P(this,"Text data outside of root node."),"&"===i?this.state=R.TEXT_ENTITY:this.textNode+=i):(this.state=R.OPEN_WAKA,this.startTagPosition=this.position);continue;case R.SCRIPT:"<"===i?this.state=R.SCRIPT_ENDING:this.script+=i;continue;case R.SCRIPT_ENDING:"/"===i?this.state=R.CLOSE_TAG:(this.script+="<"+i,this.state=R.SCRIPT);continue;case R.OPEN_WAKA:if("!"===i)this.state=R.SGML_DECL,this.sgmlDecl="";else if(y(u,i));else if(y(p,i))this.state=R.OPEN_TAG,this.tagName=i;else if("/"===i)this.state=R.CLOSE_TAG,this.tagName="";else if("?"===i)this.state=R.PROC_INST,this.procInstName=this.procInstBody="";else{if(P(this,"Unencoded <"),this.startTagPosition+1<this.position){var o=this.position-this.startTagPosition;i=new Array(o).join(" ")+i}this.textNode+="<"+i,this.state=R.TEXT}continue;case R.SGML_DECL:"[CDATA["===(this.sgmlDecl+i).toUpperCase()?(M(this,"onopencdata"),this.state=R.CDATA,this.sgmlDecl="",this.cdata=""):this.sgmlDecl+i==="--"?(this.state=R.COMMENT,this.comment="",this.sgmlDecl=""):"DOCTYPE"===(this.sgmlDecl+i).toUpperCase()?(this.state=R.DOCTYPE,(this.doctype||this.sawRoot)&&P(this,"Inappropriately located doctype declaration"),this.doctype="",this.sgmlDecl=""):">"===i?(M(this,"onsgmldeclaration",this.sgmlDecl),this.sgmlDecl="",this.state=R.TEXT):y(f,i)?(this.state=R.SGML_DECL_QUOTED,this.sgmlDecl+=i):this.sgmlDecl+=i;continue;case R.SGML_DECL_QUOTED:i===this.q&&(this.state=R.SGML_DECL,this.q=""),this.sgmlDecl+=i;continue;case R.DOCTYPE:">"===i?(this.state=R.TEXT,M(this,"ondoctype",this.doctype),this.doctype=!0):(this.doctype+=i,"["===i?this.state=R.DOCTYPE_DTD:y(f,i)&&(this.state=R.DOCTYPE_QUOTED,this.q=i));continue;case R.DOCTYPE_QUOTED:this.doctype+=i,i===this.q&&(this.q="",this.state=R.DOCTYPE);continue;case R.DOCTYPE_DTD:this.doctype+=i,"]"===i?this.state=R.DOCTYPE:y(f,i)&&(this.state=R.DOCTYPE_DTD_QUOTED,this.q=i);continue;case R.DOCTYPE_DTD_QUOTED:this.doctype+=i,i===this.q&&(this.state=R.DOCTYPE_DTD,this.q="");continue;case R.COMMENT:"-"===i?this.state=R.COMMENT_ENDING:this.comment+=i;continue;case R.COMMENT_ENDING:"-"===i?(this.state=R.COMMENT_ENDED,this.comment=C(this.opt,this.comment),this.comment&&M(this,"oncomment",this.comment),this.comment=""):(this.comment+="-"+i,this.state=R.COMMENT);continue;case R.COMMENT_ENDED:">"!==i?(P(this,"Malformed comment"),this.comment+="--"+i,this.state=R.COMMENT):this.state=R.TEXT;continue;case R.CDATA:"]"===i?this.state=R.CDATA_ENDING:this.cdata+=i;continue;case R.CDATA_ENDING:"]"===i?this.state=R.CDATA_ENDING_2:(this.cdata+="]"+i,this.state=R.CDATA);continue;case R.CDATA_ENDING_2:">"===i?(this.cdata&&M(this,"oncdata",this.cdata),M(this,"onclosecdata"),this.cdata="",this.state=R.TEXT):"]"===i?this.cdata+="]":(this.cdata+="]]"+i,this.state=R.CDATA);continue;case R.PROC_INST:"?"===i?this.state=R.PROC_INST_ENDING:y(u,i)?this.state=R.PROC_INST_BODY:this.procInstName+=i;continue;case R.PROC_INST_BODY:if(!this.procInstBody&&y(u,i))continue;"?"===i?this.state=R.PROC_INST_ENDING:this.procInstBody+=i;continue;case R.PROC_INST_ENDING:">"===i?(M(this,"onprocessinginstruction",{name:this.procInstName,body:this.procInstBody}),this.procInstName=this.procInstBody="",this.state=R.TEXT):(this.procInstBody+="?"+i,this.state=R.PROC_INST_BODY);continue;case R.OPEN_TAG:y(_,i)?this.tagName+=i:(L(this),">"===i?U(this):"/"===i?this.state=R.OPEN_TAG_SLASH:(T(u,i)&&P(this,"Invalid character in tag name"),this.state=R.ATTRIB));continue;case R.OPEN_TAG_SLASH:">"===i?(U(this,!0),B(this)):(P(this,"Forward-slash in opening tag not followed by >"),this.state=R.ATTRIB);continue;case R.ATTRIB:if(y(u,i))continue;">"===i?U(this):"/"===i?this.state=R.OPEN_TAG_SLASH:y(p,i)?(this.attribName=i,this.attribValue="",this.state=R.ATTRIB_NAME):P(this,"Invalid attribute name");continue;case R.ATTRIB_NAME:"="===i?this.state=R.ATTRIB_VALUE:">"===i?(P(this,"Attribute without value"),this.attribValue=this.attribName,x(this),U(this)):y(u,i)?this.state=R.ATTRIB_NAME_SAW_WHITE:y(_,i)?this.attribName+=i:P(this,"Invalid attribute name");continue;case R.ATTRIB_NAME_SAW_WHITE:if("="===i)this.state=R.ATTRIB_VALUE;else{if(y(u,i))continue;P(this,"Attribute without value"),this.tag.attributes[this.attribName]="",this.attribValue="",M(this,"onattribute",{name:this.attribName,value:""}),this.attribName="",">"===i?U(this):y(p,i)?(this.attribName=i,this.state=R.ATTRIB_NAME):(P(this,"Invalid attribute name"),this.state=R.ATTRIB)}continue;case R.ATTRIB_VALUE:if(y(u,i))continue;y(f,i)?(this.q=i,this.state=R.ATTRIB_VALUE_QUOTED):(P(this,"Unquoted attribute value"),this.state=R.ATTRIB_VALUE_UNQUOTED,this.attribValue=i);continue;case R.ATTRIB_VALUE_QUOTED:if(i!==this.q){"&"===i?this.state=R.ATTRIB_VALUE_ENTITY_Q:this.attribValue+=i;continue}x(this),this.q="",this.state=R.ATTRIB_VALUE_CLOSED;continue;case R.ATTRIB_VALUE_CLOSED:y(u,i)?this.state=R.ATTRIB:">"===i?U(this):"/"===i?this.state=R.OPEN_TAG_SLASH:y(p,i)?(P(this,"No whitespace between attributes"),this.attribName=i,this.attribValue="",this.state=R.ATTRIB_NAME):P(this,"Invalid attribute name");continue;case R.ATTRIB_VALUE_UNQUOTED:if(T(c,i)){"&"===i?this.state=R.ATTRIB_VALUE_ENTITY_U:this.attribValue+=i;continue}x(this),">"===i?U(this):this.state=R.ATTRIB;continue;case R.CLOSE_TAG:if(this.tagName)">"===i?B(this):y(_,i)?this.tagName+=i:this.script?(this.script+="</"+this.tagName,this.tagName="",this.state=R.SCRIPT):(T(u,i)&&P(this,"Invalid tagname in closing tag"),this.state=R.CLOSE_TAG_SAW_WHITE);else{if(y(u,i))continue;T(p,i)?this.script?(this.script+="</"+i,this.state=R.SCRIPT):P(this,"Invalid tagname in closing tag."):this.tagName=i}continue;case R.CLOSE_TAG_SAW_WHITE:if(y(u,i))continue;">"===i?B(this):P(this,"Invalid characters in closing tag");continue;case R.TEXT_ENTITY:case R.ATTRIB_VALUE_ENTITY_Q:case R.ATTRIB_VALUE_ENTITY_U:var s,l;switch(this.state){case R.TEXT_ENTITY:s=R.TEXT,l="textNode";break;case R.ATTRIB_VALUE_ENTITY_Q:s=R.ATTRIB_VALUE_QUOTED,l="attribValue";break;case R.ATTRIB_VALUE_ENTITY_U:s=R.ATTRIB_VALUE_UNQUOTED,l="attribValue"}";"===i?(this[l]+=k(this),this.entity="",this.state=s):y(this.entity.length?E:m,i)?this.entity+=i:(P(this,"Invalid character in entity name"),this[l]+="&"+this.entity+i,this.entity="",this.state=s);continue;default:throw new Error(this,"Unknown state: "+this.state)}this.position>=this.bufferCheckPosition&&function(t){for(var r=Math.max(e.MAX_BUFFER_LENGTH,10),i=0,a=0,o=n.length;a<o;a++){var s=t[n[a]].length;if(s>r)switch(n[a]){case"textNode":D(t);break;case"cdata":M(t,"oncdata",t.cdata),t.cdata="";break;case"script":M(t,"onscript",t.script),t.script="";break;default:O(t,"Max buffer length exceeded: "+n[a])}i=Math.max(i,s)}var u=e.MAX_BUFFER_LENGTH-i;t.bufferCheckPosition=u+t.position}(this);return this}
2
+ /*! http://mths.be/fromcodepoint v0.1.0 by @mathias */,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){!function(e){D(e),""!==e.cdata&&(M(e,"oncdata",e.cdata),e.cdata=""),""!==e.script&&(M(e,"onscript",e.script),e.script="")}(this)}};try{t=r.default.Stream}catch(e){t=function(){}}var o=e.EVENTS.filter((function(e){return"error"!==e&&"end"!==e}));function s(e,n){if(!(this instanceof s))return new s(e,n);t.apply(this),this._parser=new a(e,n),this.writable=!0,this.readable=!0;var r=this;this._parser.onend=function(){r.emit("end")},this._parser.onerror=function(e){r.emit("error",e),r._parser.error=null},this._decoder=null,o.forEach((function(e){Object.defineProperty(r,"on"+e,{get:function(){return r._parser["on"+e]},set:function(t){if(!t)return r.removeAllListeners(e),r._parser["on"+e]=t,t;r.on(e,t)},enumerable:!0,configurable:!1})}))}s.prototype=Object.create(t.prototype,{constructor:{value:s}}),s.prototype.write=function(e){if("function"==typeof Buffer&&"function"==typeof Buffer.isBuffer&&Buffer.isBuffer(e)){if(!this._decoder){var t=i.default.StringDecoder;this._decoder=new t("utf8")}e=this._decoder.write(e)}return this._parser.write(e.toString()),this.emit("data",e),!0},s.prototype.end=function(e){return e&&e.length&&this.write(e),this._parser.end(),!0},s.prototype.on=function(e,n){var r=this;return r._parser["on"+e]||-1===o.indexOf(e)||(r._parser["on"+e]=function(){var t=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);t.splice(0,0,e),r.emit.apply(r,t)}),t.prototype.on.call(r,e,n)};var u="\r\n\t ",l="0124356789",d="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",f="'\"",c=u+">",g="http://www.w3.org/XML/1998/namespace",h={xml:g,xmlns:"http://www.w3.org/2000/xmlns/"};u=v(u),l=v(l),d=v(d);var p=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,_=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/,m=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,E=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040\.\d-]/;function v(e){return e.split("").reduce((function(e,t){return e[t]=!0,e}),{})}function y(e,t){return function(e){return"[object RegExp]"===Object.prototype.toString.call(e)}(e)?!!t.match(e):e[t]}function T(e,t){return!y(e,t)}f=v(f),c=v(c);var A,S,I,R=0;for(var b in e.STATE={BEGIN:R++,BEGIN_WHITESPACE:R++,TEXT:R++,TEXT_ENTITY:R++,OPEN_WAKA:R++,SGML_DECL:R++,SGML_DECL_QUOTED:R++,DOCTYPE:R++,DOCTYPE_QUOTED:R++,DOCTYPE_DTD:R++,DOCTYPE_DTD_QUOTED:R++,COMMENT_STARTING:R++,COMMENT:R++,COMMENT_ENDING:R++,COMMENT_ENDED:R++,CDATA:R++,CDATA_ENDING:R++,CDATA_ENDING_2:R++,PROC_INST:R++,PROC_INST_BODY:R++,PROC_INST_ENDING:R++,OPEN_TAG:R++,OPEN_TAG_SLASH:R++,ATTRIB:R++,ATTRIB_NAME:R++,ATTRIB_NAME_SAW_WHITE:R++,ATTRIB_VALUE:R++,ATTRIB_VALUE_QUOTED:R++,ATTRIB_VALUE_CLOSED:R++,ATTRIB_VALUE_UNQUOTED:R++,ATTRIB_VALUE_ENTITY_Q:R++,ATTRIB_VALUE_ENTITY_U:R++,CLOSE_TAG:R++,CLOSE_TAG_SAW_WHITE:R++,SCRIPT:R++,SCRIPT_ENDING:R++},e.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},e.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(e.ENTITIES).forEach((function(t){var n=e.ENTITIES[t],r="number"==typeof n?String.fromCharCode(n):n;e.ENTITIES[t]=r})),e.STATE)e.STATE[e.STATE[b]]=b;function N(e,t,n){e[t]&&e[t](n)}function M(e,t,n){e.textNode&&D(e),N(e,t,n)}function D(e){e.textNode=C(e.opt,e.textNode),e.textNode&&N(e,"ontext",e.textNode),e.textNode=""}function C(e,t){return e.trim&&(t=t.trim()),e.normalize&&(t=t.replace(/\s+/g," ")),t}function O(e,t){return D(e),e.trackPosition&&(t+="\nLine: "+e.line+"\nColumn: "+e.column+"\nChar: "+e.c),t=new Error(t),e.error=t,N(e,"onerror",t),e}function w(e){return e.sawRoot&&!e.closedRoot&&P(e,"Unclosed root tag"),e.state!==R.BEGIN&&e.state!==R.BEGIN_WHITESPACE&&e.state!==R.TEXT&&O(e,"Unexpected end"),D(e),e.c="",e.closed=!0,N(e,"onend"),a.call(e,e.strict,e.opt),e}function P(e,t){if("object"!=typeof e||!(e instanceof a))throw new Error("bad call to strictFail");e.strict&&O(e,t)}function L(e){e.strict||(e.tagName=e.tagName[e.looseCase]());var t=e.tags[e.tags.length-1]||e,n=e.tag={name:e.tagName,attributes:{}};e.opt.xmlns&&(n.ns=t.ns),e.attribList.length=0,M(e,"onopentagstart",n)}function F(e,t){var n=e.indexOf(":")<0?["",e]:e.split(":"),r=n[0],i=n[1];return t&&"xmlns"===e&&(r="xmlns",i=""),{prefix:r,local:i}}function x(e){if(e.strict||(e.attribName=e.attribName[e.looseCase]()),-1!==e.attribList.indexOf(e.attribName)||e.tag.attributes.hasOwnProperty(e.attribName))e.attribName=e.attribValue="";else{if(e.opt.xmlns){var t=F(e.attribName,!0),n=t.prefix,r=t.local;if("xmlns"===n)if("xml"===r&&e.attribValue!==g)P(e,"xml: prefix must be bound to "+g+"\nActual: "+e.attribValue);else if("xmlns"===r&&"http://www.w3.org/2000/xmlns/"!==e.attribValue)P(e,"xmlns: prefix must be bound to http://www.w3.org/2000/xmlns/\nActual: "+e.attribValue);else{var i=e.tag,a=e.tags[e.tags.length-1]||e;i.ns===a.ns&&(i.ns=Object.create(a.ns)),i.ns[r]=e.attribValue}e.attribList.push([e.attribName,e.attribValue])}else e.tag.attributes[e.attribName]=e.attribValue,M(e,"onattribute",{name:e.attribName,value:e.attribValue});e.attribName=e.attribValue=""}}function U(e,t){if(e.opt.xmlns){var n=e.tag,r=F(e.tagName);n.prefix=r.prefix,n.local=r.local,n.uri=n.ns[r.prefix]||"",n.prefix&&!n.uri&&(P(e,"Unbound namespace prefix: "+JSON.stringify(e.tagName)),n.uri=r.prefix);var i=e.tags[e.tags.length-1]||e;n.ns&&i.ns!==n.ns&&Object.keys(n.ns).forEach((function(t){M(e,"onopennamespace",{prefix:t,uri:n.ns[t]})}));for(var a=0,o=e.attribList.length;a<o;a++){var s=e.attribList[a],u=s[0],l=s[1],d=F(u,!0),f=d.prefix,c=d.local,g=""===f?"":n.ns[f]||"",h={name:u,value:l,prefix:f,local:c,uri:g};f&&"xmlns"!==f&&!g&&(P(e,"Unbound namespace prefix: "+JSON.stringify(f)),h.uri=f),e.tag.attributes[u]=h,M(e,"onattribute",h)}e.attribList.length=0}e.tag.isSelfClosing=!!t,e.sawRoot=!0,e.tags.push(e.tag),M(e,"onopentag",e.tag),t||(e.noscript||"script"!==e.tagName.toLowerCase()?e.state=R.TEXT:e.state=R.SCRIPT,e.tag=null,e.tagName=""),e.attribName=e.attribValue="",e.attribList.length=0}function B(e){if(!e.tagName)return P(e,"Weird empty close tag."),e.textNode+="</>",void(e.state=R.TEXT);if(e.script){if("script"!==e.tagName)return e.script+="</"+e.tagName+">",e.tagName="",void(e.state=R.SCRIPT);M(e,"onscript",e.script),e.script=""}var t=e.tags.length,n=e.tagName;e.strict||(n=n[e.looseCase]());for(var r=n;t--;){if(e.tags[t].name===r)break;P(e,"Unexpected close tag")}if(t<0)return P(e,"Unmatched closing tag: "+e.tagName),e.textNode+="</"+e.tagName+">",void(e.state=R.TEXT);e.tagName=n;for(var i=e.tags.length;i-- >t;){var a=e.tag=e.tags.pop();e.tagName=e.tag.name,M(e,"onclosetag",e.tagName);var o={};for(var s in a.ns)o[s]=a.ns[s];var u=e.tags[e.tags.length-1]||e;e.opt.xmlns&&a.ns!==u.ns&&Object.keys(a.ns).forEach((function(t){var n=a.ns[t];M(e,"onclosenamespace",{prefix:t,uri:n})}))}0===t&&(e.closedRoot=!0),e.tagName=e.attribValue=e.attribName="",e.attribList.length=0,e.state=R.TEXT}function k(e){var t,n=e.entity,r=n.toLowerCase(),i="";return e.ENTITIES[n]?e.ENTITIES[n]:e.ENTITIES[r]?e.ENTITIES[r]:("#"===(n=r).charAt(0)&&("x"===n.charAt(1)?(n=n.slice(2),i=(t=parseInt(n,16)).toString(16)):(n=n.slice(1),i=(t=parseInt(n,10)).toString(10))),n=n.replace(/^0+/,""),i.toLowerCase()!==n?(P(e,"Invalid character entity"),"&"+e.entity+";"):String.fromCodePoint(t))}function G(e,t){"<"===t?(e.state=R.OPEN_WAKA,e.startTagPosition=e.position):T(u,t)&&(P(e,"Non-whitespace before first tag."),e.textNode=t,e.state=R.TEXT)}function q(e,t){var n="";return t<e.length&&(n=e.charAt(t)),n}R=e.STATE,String.fromCodePoint||(A=String.fromCharCode,S=Math.floor,I=function(){var e,t,n=16384,r=[],i=-1,a=arguments.length;if(!a)return"";for(var o="";++i<a;){var s=Number(arguments[i]);if(!isFinite(s)||s<0||s>1114111||S(s)!==s)throw RangeError("Invalid code point: "+s);s<=65535?r.push(s):(e=55296+((s-=65536)>>10),t=s%1024+56320,r.push(e,t)),(i+1===a||r.length>n)&&(o+=A.apply(null,r),r.length=0)}return o},Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:I,configurable:!0,writable:!0}):String.fromCodePoint=I)}(t)})),gt=f((function(e,t){!function(e,t,n,r,i){function a(e,t,n,r){var i=r&&"seq"===r.timeContainer,o=0;r&&(o=i&&n?n.end:r.begin),t.begin=t.explicit_begin?t.explicit_begin+o:o;var s=t.begin,u=null;for(var l in t.sets)a(e,t.sets[l],u,t),s="seq"===t.timeContainer?t.sets[l].end:Math.max(s,t.sets[l].end),u=t.sets[l];if("contents"in t)for(var d in t.contents)a(e,t.contents[d],u,t),s="seq"===t.timeContainer?t.contents[d].end:Math.max(s,t.contents[d].end),u=t.contents[d];else s=i?t.begin:Number.POSITIVE_INFINITY;null!==t.explicit_end&&null!==t.explicit_dur?t.end=Math.min(t.begin+t.explicit_dur,o+t.explicit_end):null===t.explicit_end&&null!==t.explicit_dur?t.end=t.begin+t.explicit_dur:null!==t.explicit_end&&null===t.explicit_dur?t.end=o+t.explicit_end:t.end=s,delete t.explicit_begin,delete t.explicit_dur,delete t.explicit_end,e._registerEvent(t)}function o(e){this.node=e}function s(){this.events=[],this.head=new u,this.body=null}function u(){this.styling=new l,this.layout=new c}function l(){this.styles={},this.initials={}}function d(){this.id=null,this.styleAttrs=null,this.styleRefs=null}function f(){this.styleAttrs=null}function c(){this.regions={}}function g(e,t){h.call(this,"image"),this.src=e,this.type=t}function h(e){this.kind=e}function p(e){this.id=e}function _(e){this.regionID=e}function m(e){this.styleAttrs=e}function E(e){this.sets=e}function v(e){this.contents=e}function y(e,t,n){this.explicit_begin=e,this.explicit_end=t,this.explicit_dur=n}function T(){h.call(this,"body")}function A(){h.call(this,"div")}function S(){h.call(this,"p")}function I(){h.call(this,"span")}function R(){h.call(this,"span")}function b(){h.call(this,"br")}function N(){}function M(){}function D(e){return e&&"xml:id"in e.attributes&&e.attributes["xml:id"].value||null}function C(e){return e&&"style"in e.attributes?e.attributes.style.value.split(" "):[]}function O(e,t){var n={};if(null!==e)for(var i in e.attributes){var a=e.attributes[i].uri+" "+e.attributes[i].local,o=r.byQName[a];if(void 0!==o){var s=o.parse(e.attributes[i].value);null!==s?(n[a]=s,o===r.byName.zIndex&&U(t,"zIndex attribute present but not used by IMSC1 since regions do not overlap")):B(t,"Cannot parse styling attribute "+a+" --\x3e "+e.attributes[i].value)}}return n}function w(e,t,n){for(var r in e.attributes)if(e.attributes[r].uri===t&&e.attributes[r].local===n)return e.attributes[r].value;return null}function P(e,t,n){var r,i=null;return null!==(r=/^(\d+(?:\.\d+)?)f$/.exec(n))?null!==t&&(i=parseFloat(r[1])/t):null!==(r=/^(\d+(?:\.\d+)?)t$/.exec(n))?null!==e&&(i=parseFloat(r[1])/e):null!==(r=/^(\d+(?:\.\d+)?)ms$/.exec(n))?i=parseFloat(r[1])/1e3:null!==(r=/^(\d+(?:\.\d+)?)s$/.exec(n))?i=parseFloat(r[1]):null!==(r=/^(\d+(?:\.\d+)?)h$/.exec(n))?i=3600*parseFloat(r[1]):null!==(r=/^(\d+(?:\.\d+)?)m$/.exec(n))?i=60*parseFloat(r[1]):null!==(r=/^(\d{2,}):(\d\d):(\d\d(?:\.\d+)?)$/.exec(n))?i=3600*parseInt(r[1])+60*parseInt(r[2])+parseFloat(r[3]):null!==(r=/^(\d{2,}):(\d\d):(\d\d)\:(\d{2,})$/.exec(n))&&null!==t&&(i=3600*parseInt(r[1])+60*parseInt(r[2])+parseInt(r[3])+(null===r[4]?0:parseInt(r[4])/t)),i}function L(e,t,n){for(;t.styleRefs.length>0;){var r=t.styleRefs.pop();r in e.styles?(L(e,e.styles[r],n),x(e.styles[r].styleAttrs,t.styleAttrs)):B(n,"Non-existant style id referenced")}}function F(e,t,n,r){for(var i=t.length-1;i>=0;i--){var a=t[i];a in e.styles?x(e.styles[a].styleAttrs,n):B(r,"Non-existant style id referenced")}}function x(e,t){for(var n in e)n in t||(t[n]=e[n])}function U(e,t){if(e&&e.warn&&e.warn(t))throw t}function B(e,t){if(e&&e.error&&e.error(t))throw t}function k(e,t){throw e&&e.fatal&&e.fatal(t),t}function G(e,t){for(var n,r=0,i=e.length-1;r<=i;){var a=e[n=Math.floor((r+i)/2)];if(a<t)r=n+1;else{if(!(a>t))return{found:!0,index:n};i=n-1}}return{found:!1,index:r}}e.fromXML=function(e,i,h){var p=t.parser(!0,{xmlns:!0}),_=[],m=[],E=[],v=0,y=null;p.onclosetag=function(e){if(_[0]instanceof N)null!==y.head&&null!==y.head.styling&&F(y.head.styling,_[0].styleRefs,_[0].styleAttrs,i),delete _[0].styleRefs;else if(_[0]instanceof l)for(var t in _[0].styles)L(_[0],_[0].styles[t],i);else if(_[0]instanceof S||_[0]instanceof I){if(_[0].contents.length>1){var r,a=[_[0].contents[0]];for(r=1;r<_[0].contents.length;r++)_[0].contents[r]instanceof R&&a[a.length-1]instanceof R?a[a.length-1].text+=_[0].contents[r].text:a.push(_[0].contents[r]);_[0].contents=a}_[0]instanceof I&&1===_[0].contents.length&&_[0].contents[0]instanceof R&&(_[0].text=_[0].contents[0].text,delete _[0].contents)}else _[0]instanceof o&&(_[0].node.uri===n.ns_tt&&"metadata"===_[0].node.local?v--:v>0&&h&&"onCloseTag"in h&&h.onCloseTag());E.shift(),m.shift(),_.shift()},p.ontext=function(e){if(void 0===_[0]);else if(_[0]instanceof I||_[0]instanceof S){if(_[0]instanceof I){var t=_[0].styleAttrs[r.byName.ruby.qname];if("container"===t||"textContainer"===t||"baseContainer"===t)return}var n=new R;n.initFromText(y,_[0],e,m[0],E[0],i),_[0].contents.push(n)}else _[0]instanceof o&&v>0&&h&&"onText"in h&&h.onText(e)},p.onopentag=function(e){var t=e.attributes["xml:space"];t?E.unshift(t.value):0===E.length?E.unshift("default"):E.unshift(E[0]);var a=e.attributes["xml:lang"];if(a?m.unshift(a.value):0===m.length?m.unshift(""):m.unshift(m[0]),e.uri===n.ns_tt)if("tt"===e.local)null!==y&&k(i,"Two <tt> elements at ("+this.line+","+this.column+")"),(y=new s).initFromNode(e,m[0],i),_.unshift(y);else if("head"===e.local)_[0]instanceof s||k(i,"Parent of <head> element is not <tt> at ("+this.line+","+this.column+")"),_.unshift(y.head);else if("styling"===e.local)_[0]instanceof u||k(i,"Parent of <styling> element is not <head> at ("+this.line+","+this.column+")"),_.unshift(y.head.styling);else if("style"===e.local){var p;_[0]instanceof l?((p=new d).initFromNode(e,i),p.id?y.head.styling.styles[p.id]=p:B(i,"<style> element missing @id attribute"),_.unshift(p)):_[0]instanceof N?((p=new d).initFromNode(e,i),x(p.styleAttrs,_[0].styleAttrs),_.unshift(p)):k(i,"Parent of <style> element is not <styling> or <region> at ("+this.line+","+this.column+")")}else if("initial"===e.local){var R;if(_[0]instanceof l){for(var D in(R=new f).initFromNode(e,i),R.styleAttrs)y.head.styling.initials[D]=R.styleAttrs[D];_.unshift(R)}else k(i,"Parent of <initial> element is not <styling> at ("+this.line+","+this.column+")")}else if("layout"===e.local)_[0]instanceof u||k(i,"Parent of <layout> element is not <head> at "+this.line+","+this.column+")"),_.unshift(y.head.layout);else if("region"===e.local){_[0]instanceof c||k(i,"Parent of <region> element is not <layout> at "+this.line+","+this.column+")");var C=new N;C.initFromNode(y,e,m[0],i),!C.id||C.id in y.head.layout.regions?B(i,"Ignoring <region> with duplicate or missing @id at "+this.line+","+this.column+")"):y.head.layout.regions[C.id]=C,_.unshift(C)}else if("body"===e.local){_[0]instanceof s||k(i,"Parent of <body> element is not <tt> at "+this.line+","+this.column+")"),null!==y.body&&k(i,"Second <body> element at "+this.line+","+this.column+")");var O=new T;O.initFromNode(y,e,m[0],i),y.body=O,_.unshift(O)}else if("div"===e.local){_[0]instanceof A||_[0]instanceof T||k(i,"Parent of <div> element is not <body> or <div> at "+this.line+","+this.column+")");var w=new A;w.initFromNode(y,_[0],e,m[0],i);var P=w.styleAttrs[r.byName.backgroundImage.qname];P&&(w.contents.push(new g(P)),delete w.styleAttrs[r.byName.backgroundImage.qname]),_[0].contents.push(w),_.unshift(w)}else if("image"===e.local){_[0]instanceof A||k(i,"Parent of <image> element is not <div> at "+this.line+","+this.column+")");var L=new g;L.initFromNode(y,_[0],e,m[0],i),_[0].contents.push(L),_.unshift(L)}else if("p"===e.local){_[0]instanceof A||k(i,"Parent of <p> element is not <div> at "+this.line+","+this.column+")");var F=new S;F.initFromNode(y,_[0],e,m[0],i),_[0].contents.push(F),_.unshift(F)}else if("span"===e.local){_[0]instanceof I||_[0]instanceof S||k(i,"Parent of <span> element is not <span> or <p> at "+this.line+","+this.column+")");var U=new I;U.initFromNode(y,_[0],e,m[0],E[0],i),_[0].contents.push(U),_.unshift(U)}else if("br"===e.local){_[0]instanceof I||_[0]instanceof S||k(i,"Parent of <br> element is not <span> or <p> at "+this.line+","+this.column+")");var G=new b;G.initFromNode(y,_[0],e,m[0],i),_[0].contents.push(G),_.unshift(G)}else if("set"===e.local){_[0]instanceof I||_[0]instanceof S||_[0]instanceof A||_[0]instanceof T||_[0]instanceof N||_[0]instanceof b||k(i,"Parent of <set> element is not a content element or a region at "+this.line+","+this.column+")");var q=new M;q.initFromNode(y,_[0],e,i),_[0].sets.push(q),_.unshift(q)}else _.unshift(new o(e));else _.unshift(new o(e));if(_[0]instanceof o)if(e.uri===n.ns_tt&&"metadata"===e.local)v++;else if(v>0&&h&&"onOpenTag"in h){var Y=[];for(var j in e.attributes)Y[e.attributes[j].uri+" "+e.attributes[j].local]={uri:e.attributes[j].uri,local:e.attributes[j].local,value:e.attributes[j].value};h.onOpenTag(e.uri,e.local,Y)}},p.write(e).close(),delete y.head.styling.styles;var D=!1;for(var C in y.head.layout.regions){D=!0;break}if(!D){var O=N.prototype.createDefaultRegion(y.lang);y.head.layout.regions[O.id]=O}for(var w in y.head.layout.regions)a(y,y.head.layout.regions[w],null,null);return y.body&&a(y,y.body,null,null),y.body&&function e(t){if(!("contents"in t))return;for(var n=("styleAttrs"in t?t.styleAttrs[r.byName.ruby.qname]:null),i="span"===t.kind&&("container"===n||"textContainer"===n||"baseContainer"===n),a=t.contents.length-1;a>=0;a--)!i||"styleAttrs"in t.contents[a]&&r.byName.ruby.qname in t.contents[a].styleAttrs?e(t.contents[a]):delete t.contents[a]}(y.body),y},s.prototype.initFromNode=function(e,t,r){var a=function(e,t){var r=w(e,n.ns_ttp,"cellResolution"),i=15,a=32;if(null!==r){var o=/(\d+) (\d+)/.exec(r);null!==o?(a=parseInt(o[1]),i=parseInt(o[2])):U(t,"Malformed cellResolution value (using initial value instead)")}return{w:a,h:i}}(e,r);this.cellLength={h:new i.ComputedLength(0,1/a.h),w:new i.ComputedLength(1/a.w,0)};var o=function(e,t){var r,i=w(e,n.ns_ttp,"frameRate"),a=30;if(null!==i){null!==(r=/(\d+)/.exec(i))?a=parseInt(r[1]):U(t,"Malformed frame rate attribute (using initial value instead)")}var o=w(e,n.ns_ttp,"frameRateMultiplier"),s=1;if(null!==o){null!==(r=/(\d+) (\d+)/.exec(o))?s=parseInt(r[1])/parseInt(r[2]):U(t,"Malformed frame rate multiplier attribute (using initial value instead)")}var u=s*a,l=1,d=w(e,n.ns_ttp,"tickRate");if(null===d)null!==i&&(l=u);else{null!==(r=/(\d+)/.exec(d))?l=parseInt(r[1]):U(t,"Malformed tick rate attribute (using initial value instead)")}return{effectiveFrameRate:u,tickRate:l}}(e,r);this.effectiveFrameRate=o.effectiveFrameRate,this.tickRate=o.tickRate,this.aspectRatio=function(e,t){var r=w(e,n.ns_ittp,"aspectRatio");null===r&&(r=w(e,n.ns_ttp,"displayAspectRatio"));var i=null;if(null!==r){var a=/(\d+)\s+(\d+)/.exec(r);if(null!==a){var o=parseInt(a[1]),s=parseInt(a[2]);0!==o&&0!==s?i=o/s:B(t,"Illegal aspectRatio values (ignoring)")}else B(t,"Malformed aspectRatio attribute (ignoring)")}return i}(e,r);var s=w(e,n.ns_ttp,"timeBase");null!==s&&"media"!==s&&k(r,"Unsupported time base");var u=function(e,t){var r=w(e,n.ns_tts,"extent");if(null===r)return null;var a=r.split(" ");if(2!==a.length)return U(t,"Malformed extent (ignoring)"),null;var o=i.parseLength(a[0]),s=i.parseLength(a[1]);if(!s||!o)return U(t,"Malformed extent values (ignoring)"),null;return{h:s,w:o}}(e,r);null===u?this.pxLength={h:null,w:null}:("px"===u.h.unit&&"px"===u.w.unit||k(r,"Extent on TT must be in px or absent"),this.pxLength={h:new i.ComputedLength(0,1/u.h.value),w:new i.ComputedLength(1/u.w.value,0)}),this.dimensions={h:new i.ComputedLength(0,1),w:new i.ComputedLength(1,0)},this.lang=t},s.prototype._registerEvent=function(e){if(!(e.end<=e.begin)){var t=G(this.events,e.begin);if(t.found||this.events.splice(t.index,0,e.begin),e.end!==Number.POSITIVE_INFINITY){var n=G(this.events,e.end);n.found||this.events.splice(n.index,0,e.end)}}},s.prototype.getMediaTimeRange=function(){return[this.events[0],this.events[this.events.length-1]]},s.prototype.getMediaTimeEvents=function(){return this.events},d.prototype.initFromNode=function(e,t){this.id=D(e),this.styleAttrs=O(e,t),this.styleRefs=C(e)},f.prototype.initFromNode=function(e,t){for(var r in this.styleAttrs={},e.attributes)if(e.attributes[r].uri===n.ns_itts||e.attributes[r].uri===n.ns_ebutts||e.attributes[r].uri===n.ns_tts){var i=e.attributes[r].uri+" "+e.attributes[r].local;this.styleAttrs[i]=e.attributes[r].value}},g.prototype.initFromNode=function(e,t,n,r,i){this.src="src"in n.attributes?n.attributes.src.value:null,this.src||B(i,"Invalid image@src attribute"),this.type="type"in n.attributes?n.attributes.type.value:null,this.type||B(i,"Invalid image@type attribute"),m.prototype.initFromNode.call(this,e,t,n,i),y.prototype.initFromNode.call(this,e,t,n,i),E.prototype.initFromNode.call(this,e,t,n,i),_.prototype.initFromNode.call(this,e,t,n,i),this.lang=r},p.prototype.initFromNode=function(e,t,n,r){this.id=D(n)},_.prototype.initFromNode=function(e,t,n,r){this.regionID=function(e){return e&&"region"in e.attributes?e.attributes.region.value:""}(n)},m.prototype.initFromNode=function(e,t,n,r){this.styleAttrs=O(n,r),null!==e.head&&null!==e.head.styling&&F(e.head.styling,C(n),this.styleAttrs,r)},E.prototype.initFromNode=function(e,t,n,r){this.sets=[]},v.prototype.initFromNode=function(e,t,n,r){this.contents=[]},y.prototype.initFromNode=function(e,t,n,r){var i=function(e,t,n,r){var i=null;n&&"begin"in n.attributes&&null===(i=P(e.tickRate,e.effectiveFrameRate,n.attributes.begin.value))&&U(r,"Malformed begin value "+n.attributes.begin.value+" (using 0)");var a=null;n&&"dur"in n.attributes&&null===(a=P(e.tickRate,e.effectiveFrameRate,n.attributes.dur.value))&&U(r,"Malformed dur value "+n.attributes.dur.value+" (ignoring)");var o=null;n&&"end"in n.attributes&&null===(o=P(e.tickRate,e.effectiveFrameRate,n.attributes.end.value))&&U(r,"Malformed end value (ignoring)");return{explicit_begin:i,explicit_end:o,explicit_dur:a}}(e,0,n,r);this.explicit_begin=i.explicit_begin,this.explicit_end=i.explicit_end,this.explicit_dur=i.explicit_dur,this.timeContainer=function(e,t){var n=e&&"timeContainer"in e.attributes?e.attributes.timeContainer.value:null;return n&&"par"!==n?"seq"===n?"seq":(B(t,"Illegal value of timeContainer (assuming 'par')"),"par"):"par"}(n,r)},T.prototype.initFromNode=function(e,t,n,r){m.prototype.initFromNode.call(this,e,null,t,r),y.prototype.initFromNode.call(this,e,null,t,r),E.prototype.initFromNode.call(this,e,null,t,r),_.prototype.initFromNode.call(this,e,null,t,r),v.prototype.initFromNode.call(this,e,null,t,r),this.lang=n},A.prototype.initFromNode=function(e,t,n,r,i){m.prototype.initFromNode.call(this,e,t,n,i),y.prototype.initFromNode.call(this,e,t,n,i),E.prototype.initFromNode.call(this,e,t,n,i),_.prototype.initFromNode.call(this,e,t,n,i),v.prototype.initFromNode.call(this,e,t,n,i),this.lang=r},S.prototype.initFromNode=function(e,t,n,r,i){m.prototype.initFromNode.call(this,e,t,n,i),y.prototype.initFromNode.call(this,e,t,n,i),E.prototype.initFromNode.call(this,e,t,n,i),_.prototype.initFromNode.call(this,e,t,n,i),v.prototype.initFromNode.call(this,e,t,n,i),this.lang=r},I.prototype.initFromNode=function(e,t,n,r,i,a){m.prototype.initFromNode.call(this,e,t,n,a),y.prototype.initFromNode.call(this,e,t,n,a),E.prototype.initFromNode.call(this,e,t,n,a),_.prototype.initFromNode.call(this,e,t,n,a),v.prototype.initFromNode.call(this,e,t,n,a),this.space=i,this.lang=r},R.prototype.initFromText=function(e,t,n,r,i,a){y.prototype.initFromNode.call(this,e,t,null,a),this.text=n,this.space=i,this.lang=r},b.prototype.initFromNode=function(e,t,n,r,i){_.prototype.initFromNode.call(this,e,t,n,i),y.prototype.initFromNode.call(this,e,t,n,i),this.lang=r},N.prototype.createDefaultRegion=function(e){var t=new N;return p.call(t,""),m.call(t,{}),E.call(t,[]),y.call(t,0,Number.POSITIVE_INFINITY,null),this.lang=e,t},N.prototype.initFromNode=function(e,t,n,r){p.prototype.initFromNode.call(this,e,null,t,r),y.prototype.initFromNode.call(this,e,null,t,r),E.prototype.initFromNode.call(this,e,null,t,r),this.styleAttrs=O(t,r),this.styleRefs=C(t),this.lang=n},M.prototype.initFromNode=function(e,t,n,r){y.prototype.initFromNode.call(this,e,t,n,r);var i=O(n,r);for(var a in this.qname=null,this.value=null,i){if(this.qname){B(r,"More than one style specified on set");break}this.qname=a,this.value=i[a]}}}(t,"undefined"==typeof sax?ct:sax,"undefined"==typeof imscNames?ut:imscNames,"undefined"==typeof imscStyles?dt:imscStyles,"undefined"==typeof imscUtils?lt:imscUtils)})),ht=f((function(e,t){!function(e,t,n){function r(e,t,u,d){var f;if("region"===u.kind)(f=document.createElement("div")).style.position="absolute";else if("body"===u.kind)f=document.createElement("div");else if("div"===u.kind)f=document.createElement("div");else if("image"===u.kind){if(f=document.createElement("img"),null!==e.imgResolver&&null!==u.src){var h=e.imgResolver(u.src,f);h&&(f.src=h),f.height=e.regionH,f.width=e.regionW}}else if("p"===u.kind)f=document.createElement("p");else if("span"===u.kind)if("container"===u.styleAttrs[n.byName.ruby.qname])f=document.createElement("ruby"),e.ruby=!0;else if("base"===u.styleAttrs[n.byName.ruby.qname])f=document.createElement("rb");else if("text"===u.styleAttrs[n.byName.ruby.qname])f=document.createElement("rt");else if("baseContainer"===u.styleAttrs[n.byName.ruby.qname])f=document.createElement("rbc");else if("textContainer"===u.styleAttrs[n.byName.ruby.qname])f=document.createElement("rtc");else{if("delimiter"===u.styleAttrs[n.byName.ruby.qname])return;f=document.createElement("span")}else"br"===u.kind&&(f=document.createElement("br"));if(f){if(u.lang&&("region"!==u.kind&&u.lang===d.lang||(f.lang=u.lang)),t.appendChild(f),f.style.margin="0","region"===u.kind){var _=u.styleAttrs[n.byName.writingMode.qname];"lrtb"===_||"lr"===_?(e.ipd="lr",e.bpd="tb"):"rltb"===_||"rl"===_?(e.ipd="rl",e.bpd="tb"):"tblr"===_?(e.ipd="tb",e.bpd="lr"):"tbrl"!==_&&"tb"!==_||(e.ipd="tb",e.bpd="rl")}else if("p"===u.kind&&"tb"===e.bpd){var m=u.styleAttrs[n.byName.direction.qname];e.ipd="ltr"===m?"lr":"rl"}for(var E in l){var v=l[E],y=u.styleAttrs[v.qname];void 0!==y&&null!==v.map&&v.map(e,f,u,y)}var T=f,A=u.styleAttrs[n.byName.linePadding.qname];if(A&&!A.isZero()){var S=A.toUsedLength(e.w,e.h);if(S>0){var I=Math.ceil(S)+"px";"tb"===e.bpd?(T.style.paddingLeft=I,T.style.paddingRight=I):(T.style.paddingTop=I,T.style.paddingBottom=I),e.lp=A}}var R=u.styleAttrs[n.byName.multiRowAlign.qname];if(R&&"auto"!==R){var b=document.createElement("span");b.style.display="inline-block",b.style.textAlign=R,f.appendChild(b),T=b,e.mra=R}var N=u.styleAttrs[n.byName.rubyReserve.qname];if(N&&"none"!==N[0]&&(e.rubyReserve=N),u.styleAttrs[n.byName.fillLineGap.qname]&&(e.flg=!0),"span"===u.kind&&u.text){var M=u.styleAttrs[n.byName.textEmphasis.qname];if(M&&"none"!==M.style&&(e.textEmphasis=!0),n.byName.textCombine.qname in u.styleAttrs&&"all"===u.styleAttrs[n.byName.textCombine.qname])f.textContent=u.text,M&&s(e,f,u,M);else for(var D="",C=0;C<u.text.length;C++){D+=u.text.charAt(C);var O=u.text.charCodeAt(C);if(O<55296||O>56319||C===u.text.length){var w=document.createElement("span");w.textContent=D,M&&s(e,w,u,M),f.appendChild(w),D=""}}}for(var P in u.contents)r(e,T,u.contents[P],u);var L=[];if((e.lp||e.mra||e.flg||e.ruby||e.textEmphasis||e.rubyReserve)&&"p"===u.kind&&(o(e,T,L,null),e.rubyReserve&&(!function(e,t){for(var n=0;n<e.length;n++){var r,i,a=document.createElement("ruby"),o=document.createElement("rb");o.textContent="​",a.appendChild(o);var s,u=t.rubyReserve[1].toUsedLength(t.w,t.h)+"px";if("both"===t.rubyReserve[0]||"outside"===t.rubyReserve[0]&&1==e.length)(r=document.createElement("rtc")).style[g]=c?"after":"under",r.textContent="​",r.style.fontSize=u,(i=document.createElement("rtc")).style[g]=c?"before":"over",i.textContent="​",i.style.fontSize=u,a.appendChild(r),a.appendChild(i);else(r=document.createElement("rtc")).textContent="​",r.style.fontSize=u,s="after"===t.rubyReserve[0]||"outside"===t.rubyReserve[0]&&n>0?c?"after":"tb"===t.bpd||"rl"===t.bpd?"under":"over":c?"before":"tb"===t.bpd||"rl"===t.bpd?"over":"under",r.style[g]=s,a.appendChild(r);for(var l=null,d=0;d<e[n].rbc.length;d++)if("ruby"===e[n].rbc[d].localName){l=e[n].rbc[d];for(var f=0;f<l.style.length;f++)a.style.setProperty(l.style.item(f),l.style.getPropertyValue(l.style.item(f)));break}(l=l||e[n].elements[0].node).parentElement.insertBefore(a,l)}}(L,e),e.rubyReserve=null),(e.ruby||e.rubyReserve)&&(!function(e,t){for(var n=0;n<e.length;n++)for(var r=0;r<e[n].rbc.length;r++){var i;if(!e[n].rbc[r].style[g])i=c?0===n?"before":"after":"tb"===t.bpd||"rl"===t.bpd?0===n?"over":"under":0===n?"under":"over",e[n].rbc[r].style[g]=i}}(L,e),e.ruby=null),e.textEmphasis&&(!function(e,t){for(var n=0;n<e.length;n++)for(var r=0;r<e[n].te.length;r++){var i;if(!e[n].te[r].style[p]||"none"===e[n].te[r].style[p])i="tb"===t.bpd?0===n?"left over":"left under":"rl"===t.bpd?0===n?"right under":"left under":0===n?"left under":"right under",e[n].te[r].style[p]=i}}(L,e),e.textEmphasis=null),e.mra&&(!function(e){for(var t=0;t<e.length-1;t++){var n=e[t].elements.length;if(0!==n&&!1===e[t].br){var r=document.createElement("br"),i=e[t].elements[n-1].node;i.parentElement.insertBefore(r,i.nextSibling)}}}(L),e.mra=null),e.lp&&(!function(e,t,n){for(var r in e){var i=e[r].elements.length,a=e[r].elements[e[r].start_elem],o=e[r].elements[e[r].end_elem],s=Math.ceil(t)+"px",u="-"+Math.ceil(t)+"px";0!==i&&("lr"===n.ipd?(a.node.style.borderLeftColor=a.bgcolor||"#00000000",a.node.style.borderLeftStyle="solid",a.node.style.borderLeftWidth=s,a.node.style.marginLeft=u):"rl"===n.ipd?(a.node.style.borderRightColor=a.bgcolor||"#00000000",a.node.style.borderRightStyle="solid",a.node.style.borderRightWidth=s,a.node.style.marginRight=u):"tb"===n.ipd&&(a.node.style.borderTopColor=a.bgcolor||"#00000000",a.node.style.borderTopStyle="solid",a.node.style.borderTopWidth=s,a.node.style.marginTop=u),"lr"===n.ipd?(o.node.style.borderRightColor=o.bgcolor||"#00000000",o.node.style.borderRightStyle="solid",o.node.style.borderRightWidth=s,o.node.style.marginRight=u):"rl"===n.ipd?(o.node.style.borderLeftColor=o.bgcolor||"#00000000",o.node.style.borderLeftStyle="solid",o.node.style.borderLeftWidth=s,o.node.style.marginLeft=u):"tb"===n.ipd&&(o.node.style.borderBottomColor=o.bgcolor||"#00000000",o.node.style.borderBottomStyle="solid",o.node.style.borderBottomWidth=s,o.node.style.marginBottom=u))}}(L,e.lp.toUsedLength(e.w,e.h),e),e.lp=null),e.flg)){var F=a(T.getBoundingClientRect(),e);!function(e,t,n,r){for(var i=Math.sign(n-t),a=0;a<=e.length;a++){var o,s,u;if(o=0===a?t:a===e.length?n:(e[a].before+e[a-1].after)/2,a>0)for(var l=0;l<e[a-1].elements.length;l++)null!==e[a-1].elements[l].bgcolor&&(u=e[a-1].elements[l],i*(u.after-o)<0&&(s=Math.ceil(Math.abs(o-u.after))+"px",u.node.style.backgroundColor=u.bgcolor,"lr"===r.bpd?u.node.style.paddingRight=s:"rl"===r.bpd?u.node.style.paddingLeft=s:"tb"===r.bpd&&(u.node.style.paddingBottom=s)));if(a<e.length)for(var d=0;d<e[a].elements.length;d++)null!==(u=e[a].elements[d]).bgcolor&&i*(u.before-o)>0&&(s=Math.ceil(Math.abs(u.before-o))+"px",u.node.style.backgroundColor=u.bgcolor,"lr"===r.bpd?u.node.style.paddingLeft=s:"rl"===r.bpd?u.node.style.paddingRight=s:"tb"===r.bpd&&(u.node.style.paddingTop=s))}}(L,F.before,F.after,e),e.flg=null}if("region"===u.kind&&(o(e,T,L),"tb"===e.bpd&&e.enableRollUp&&u.contents.length>0&&"after"===u.styleAttrs[n.byName.displayAlign.qname])){var x=new i(""===u.id?"_":u.id,L);if(e.currentISDState[x.id]=x,e.previousISDState&&x.id in e.previousISDState&&e.previousISDState[x.id].plist.length>0&&x.plist.length>1&&x.plist[x.plist.length-2].text===e.previousISDState[x.id].plist[e.previousISDState[x.id].plist.length-1].text){var U=f.firstElementChild,B=x.plist[x.plist.length-1].after-x.plist[x.plist.length-1].before;U.style.bottom="-"+B+"px",U.style.transition="transform 0.4s",U.style.position="relative",U.style.transform="translateY(-"+B+"px)"}}}else!function(e,t){if(e&&e.error&&e.error(t))throw t}(e.errorHandler,"Error processing ISD element kind: "+u.kind)}function i(e,t){this.id=e,this.plist=t}function a(e,t){var n={before:null,after:null,start:null,end:null};return"tb"===t.bpd?(n.before=e.top,n.after=e.bottom,"lr"===t.ipd?(n.start=e.left,n.end=e.right):(n.start=e.right,n.end=e.left)):"lr"===t.bpd?(n.before=e.left,n.after=e.right,n.start=e.top,n.end=e.bottom):"rl"===t.bpd&&(n.before=e.right,n.after=e.left,n.start=e.top,n.end=e.bottom),n}function o(e,t,n,r){if("rt"!==t.localName&&"rtc"!==t.localName){var i,s,u,l,d=t.style.backgroundColor||r;if(0===t.childElementCount)if("span"===t.localName||"rb"===t.localName){var f=t.getBoundingClientRect();if(0===f.height||0===f.width)return;var c=a(f,e);if(0!==n.length&&(i=c.before,s=c.after,u=n[n.length-1].before,l=n[n.length-1].after,s<l&&i>u||l<=s&&u>=i)){var g=Math.sign(c.after-c.before),p=Math.sign(c.end-c.start);g*(c.before-n[n.length-1].before)<0&&(n[n.length-1].before=c.before),g*(c.after-n[n.length-1].after)>0&&(n[n.length-1].after=c.after),p*(c.start-n[n.length-1].start)<0&&(n[n.length-1].start=c.start,n[n.length-1].start_elem=n[n.length-1].elements.length),p*(c.end-n[n.length-1].end)>0&&(n[n.length-1].end=c.end,n[n.length-1].end_elem=n[n.length-1].elements.length)}else n.push({before:c.before,after:c.after,start:c.start,end:c.end,start_elem:0,end_elem:0,elements:[],rbc:[],te:[],text:"",br:!1});n[n.length-1].text+=t.textContent,n[n.length-1].elements.push({node:t,bgcolor:d,before:c.before,after:c.after})}else"br"===t.localName&&0!==n.length&&(n[n.length-1].br=!0);else for(var _=t.firstChild;_;)_.nodeType===Node.ELEMENT_NODE&&(o(e,_,n,d),"ruby"===_.localName||"rtc"===_.localName?n.length>0&&n[n.length-1].rbc.push(_):"span"===_.localName&&_.style[h]&&"none"!==_.style[h]&&n.length>0&&n[n.length-1].te.push(_)),_=_.nextSibling}}function s(e,t,n,r){var i;"none"!==r.style&&("auto"===r.style?t.style[h]="filled":t.style[h]=r.style+" "+r.symbol,("before"===r.position||"after"===r.position)&&(i="tb"===e.bpd?"before"===r.position?"left over":"left under":"rl"===e.bpd?"before"===r.position?"right under":"left under":"before"===r.position?"left under":"right under",t.style[p]=i))}function u(e,t){this.qname=e,this.map=t}e.render=function(e,t,n,i,a,o,s,u,l){var d=i||t.clientHeight,f=a||t.clientWidth;if(null!==e.aspectRatio){var c=d*e.aspectRatio;c>f?d=Math.round(f/e.aspectRatio):f=c}var g=document.createElement("div");g.style.position="relative",g.style.width=f+"px",g.style.height=d+"px",g.style.margin="auto",g.style.top=0,g.style.bottom=0,g.style.left=0,g.style.right=0,g.style.zIndex=0;var h={h:d,w:f,regionH:null,regionW:null,imgResolver:n,displayForcedOnlyMode:o||!1,isd:e,errorHandler:s,previousISDState:u,enableRollUp:l||!1,currentISDState:{},flg:null,lp:null,mra:null,ipd:null,bpd:null,ruby:null,textEmphasis:null,rubyReserve:null};for(var p in t.appendChild(g),e.contents)r(h,g,e.contents[p],e);return h.currentISDState};var l=[new u("http://www.w3.org/ns/ttml#styling backgroundColor",(function(e,t,n,r){0!==r[3]&&(t.style.backgroundColor="rgba("+r[0].toString()+","+r[1].toString()+","+r[2].toString()+","+(r[3]/255).toString()+")")})),new u("http://www.w3.org/ns/ttml#styling color",(function(e,t,n,r){t.style.color="rgba("+r[0].toString()+","+r[1].toString()+","+r[2].toString()+","+(r[3]/255).toString()+")"})),new u("http://www.w3.org/ns/ttml#styling direction",(function(e,t,n,r){t.style.direction=r})),new u("http://www.w3.org/ns/ttml#styling display",(function(e,t,n,r){})),new u("http://www.w3.org/ns/ttml#styling displayAlign",(function(e,t,n,r){t.style.display="flex",t.style.flexDirection="column","before"===r?t.style.justifyContent="flex-start":"center"===r?t.style.justifyContent="center":"after"===r&&(t.style.justifyContent="flex-end")})),new u("http://www.w3.org/ns/ttml#styling extent",(function(e,t,n,r){e.regionH=r.h.toUsedLength(e.w,e.h),e.regionW=r.w.toUsedLength(e.w,e.h);var i=0,a=0,o=n.styleAttrs["http://www.w3.org/ns/ttml#styling padding"];o&&(i=o[0].toUsedLength(e.w,e.h)+o[2].toUsedLength(e.w,e.h),a=o[1].toUsedLength(e.w,e.h)+o[3].toUsedLength(e.w,e.h)),t.style.height=e.regionH-i+"px",t.style.width=e.regionW-a+"px"})),new u("http://www.w3.org/ns/ttml#styling fontFamily",(function(e,t,n,r){var i=[];for(var a in r)"monospaceSerif"===r[a]?(i.push("Courier New"),i.push('"Liberation Mono"'),i.push("Courier"),i.push("monospace")):"proportionalSansSerif"===r[a]?(i.push("Arial"),i.push("Helvetica"),i.push('"Liberation Sans"'),i.push("sans-serif")):"monospace"===r[a]?i.push("monospace"):"sansSerif"===r[a]?i.push("sans-serif"):"serif"===r[a]?i.push("serif"):"monospaceSansSerif"===r[a]?(i.push("Consolas"),i.push("monospace")):"proportionalSerif"===r[a]?i.push("serif"):i.push(r[a]);t.style.fontFamily=i.join(",")})),new u("http://www.w3.org/ns/ttml#styling shear",(function(e,t,n,r){if(0!==r){var i=-.9*r;"tb"===e.bpd?t.style.transform="skewX("+i+"deg)":t.style.transform="skewY("+i+"deg)"}})),new u("http://www.w3.org/ns/ttml#styling fontSize",(function(e,t,n,r){t.style.fontSize=r.toUsedLength(e.w,e.h)+"px"})),new u("http://www.w3.org/ns/ttml#styling fontStyle",(function(e,t,n,r){t.style.fontStyle=r})),new u("http://www.w3.org/ns/ttml#styling fontWeight",(function(e,t,n,r){t.style.fontWeight=r})),new u("http://www.w3.org/ns/ttml#styling lineHeight",(function(e,t,n,r){t.style.lineHeight="normal"===r?"normal":r.toUsedLength(e.w,e.h)+"px"})),new u("http://www.w3.org/ns/ttml#styling opacity",(function(e,t,n,r){t.style.opacity=r})),new u("http://www.w3.org/ns/ttml#styling origin",(function(e,t,n,r){t.style.top=r.h.toUsedLength(e.w,e.h)+"px",t.style.left=r.w.toUsedLength(e.w,e.h)+"px"})),new u("http://www.w3.org/ns/ttml#styling overflow",(function(e,t,n,r){t.style.overflow=r})),new u("http://www.w3.org/ns/ttml#styling padding",(function(e,t,n,r){var i=[];i[0]=r[0].toUsedLength(e.w,e.h)+"px",i[1]=r[3].toUsedLength(e.w,e.h)+"px",i[2]=r[2].toUsedLength(e.w,e.h)+"px",i[3]=r[1].toUsedLength(e.w,e.h)+"px",t.style.padding=i.join(" ")})),new u("http://www.w3.org/ns/ttml#styling position",(function(e,t,n,r){t.style.top=r.h.toUsedLength(e.w,e.h)+"px",t.style.left=r.w.toUsedLength(e.w,e.h)+"px"})),new u("http://www.w3.org/ns/ttml#styling rubyAlign",(function(e,t,n,r){t.style.rubyAlign="spaceAround"===r?"space-around":"center"})),new u("http://www.w3.org/ns/ttml#styling rubyPosition",(function(e,t,n,r){var i;"before"!==r&&"after"!==r||(i=c?r:"tb"===e.bpd||"rl"===e.bpd?"before"===r?"over":"under":"before"===r?"under":"over",t.parentElement.style[g]=i)})),new u("http://www.w3.org/ns/ttml#styling showBackground",null),new u("http://www.w3.org/ns/ttml#styling textAlign",(function(e,t,n,r){var i;i="start"===r?"rl"===e.ipd?"right":"left":"end"===r?"rl"===e.ipd?"left":"right":r,t.style.textAlign=i})),new u("http://www.w3.org/ns/ttml#styling textDecoration",(function(e,t,n,r){t.style.textDecoration=r.join(" ").replace("lineThrough","line-through")})),new u("http://www.w3.org/ns/ttml#styling textOutline",(function(e,t,n,r){})),new u("http://www.w3.org/ns/ttml#styling textShadow",(function(e,t,r,i){var a=r.styleAttrs[n.byName.textOutline.qname];if("none"===i&&"none"===a)t.style.textShadow="";else{var o=[];if("none"!==a){var s="rgba("+a.color[0].toString()+","+a.color[1].toString()+","+a.color[2].toString()+","+(a.color[3]/255).toString()+")";o.push("1px 1px 1px "+s),o.push("-1px 1px 1px "+s),o.push("1px -1px 1px "+s),o.push("-1px -1px 1px "+s)}if("none"!==i)for(var u in i)o.push(i[u].x_off.toUsedLength(e.w,e.h)+"px "+i[u].y_off.toUsedLength(e.w,e.h)+"px "+i[u].b_radius.toUsedLength(e.w,e.h)+"px rgba("+i[u].color[0].toString()+","+i[u].color[1].toString()+","+i[u].color[2].toString()+","+(i[u].color[3]/255).toString()+")");t.style.textShadow=o.join(",")}})),new u("http://www.w3.org/ns/ttml#styling textCombine",(function(e,t,n,r){t.style.textCombineUpright=r})),new u("http://www.w3.org/ns/ttml#styling textEmphasis",(function(e,t,n,r){})),new u("http://www.w3.org/ns/ttml#styling unicodeBidi",(function(e,t,n,r){var i;i="bidiOverride"===r?"bidi-override":r,t.style.unicodeBidi=i})),new u("http://www.w3.org/ns/ttml#styling visibility",(function(e,t,n,r){t.style.visibility=r})),new u("http://www.w3.org/ns/ttml#styling wrapOption",(function(e,t,n,r){"wrap"===r?"preserve"===n.space?t.style.whiteSpace="pre-wrap":t.style.whiteSpace="normal":"preserve"===n.space?t.style.whiteSpace="pre":t.style.whiteSpace="noWrap"})),new u("http://www.w3.org/ns/ttml#styling writingMode",(function(e,t,n,r){"lrtb"===r||"lr"===r||"rltb"===r||"rl"===r?t.style.writingMode="horizontal-tb":"tblr"===r?t.style.writingMode="vertical-lr":"tbrl"!==r&&"tb"!==r||(t.style.writingMode="vertical-rl")})),new u("http://www.w3.org/ns/ttml#styling zIndex",(function(e,t,n,r){t.style.zIndex=r})),new u("http://www.w3.org/ns/ttml/profile/imsc1#styling forcedDisplay",(function(e,t,n,r){e.displayForcedOnlyMode&&!1===r&&(t.style.visibility="hidden")}))],d={};for(var f in l)d[l[f].qname]=l[f];var c="webkitRubyPosition"in window.getComputedStyle(document.documentElement),g=c?"webkitRubyPosition":"rubyPosition",h="webkitTextEmphasisStyle"in window.getComputedStyle(document.documentElement)?"webkitTextEmphasisStyle":"textEmphasisStyle",p="webkitTextEmphasisPosition"in window.getComputedStyle(document.documentElement)?"webkitTextEmphasisPosition":"textEmphasisPosition"}(t,"undefined"==typeof imscNames||imscNames,"undefined"==typeof imscStyles?dt:imscStyles,"undefined"==typeof imscUtils||imscUtils)})),pt=ft.generateISD,_t=gt.fromXML,mt=ht.render,Et=pt,vt=_t,yt=mt,Tt=bt(p),At=bt(x),St=bt(q),It=bt(S),Rt=bt(ee);function bt(e){return e&&e.__esModule?e:{default:e}}function Nt(){var e=this.context,t=(0,At.default)(e).getInstance(),n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,u=void 0,l=void 0,d=void 0,f=void 0,c=void 0,g=void 0,h=void 0,p=void 0,_=void 0,m=void 0,E=void 0,v=void 0;function y(e){var t=o[e].kind,n=void 0!==o[e].id?o[e].id:o[e].lang,r=o[e].lang,i=o[e].isTTML,s=o[e].isEmbedded;return a.addTextTrack(t,n,r,i,s)}function T(e,t,n,r,i,a){var o=0,s=0;e/t>n/r?o=(s=t)/r*n:s=(o=e)/n*r;var u,l,d=0,f=0;return o/s>i?(f=s,d=s*i):(d=o,f=o/i),u=(e-d)/2,l=(t-f)/2,a?{x:u+.1*d,y:l+.1*f,w:.8*d,h:.8*f}:{x:u,y:l,w:d,h:f}}function A(e,n){var r=a.getClientWidth(),i=a.getClientHeight(),o=a.getVideoWidth(),s=a.getVideoHeight(),u=a.getVideoRelativeOffsetTop(),h=a.getVideoRelativeOffsetLeft();if(0!==o&&0!==s){var m=o/s,v=!1;e.isFromCEA608&&(m=3.5/3,v=!0);var y=T.call(this,r,i,o,s,m,v),A=y.w,S=y.h,I=y.x,R=y.y;if(A!=f||S!=c||I!=l||R!=d||n){if(l=I+h,d=R+u,f=A,c=S,g){var b=g.style;b&&(b.left=l+"px",b.top=d+"px",b.width=f+"px",b.height=c+"px",b.zIndex=p&&document[p]||_?E:null,t.trigger(St.default.CAPTION_CONTAINER_RESIZE))}var N=e.activeCues;if(N)for(var M=N.length,D=0;D<M;++D){var C=N[D];C.scaleCue(C)}}}}function S(e){var t=f,n=c,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0;if(e.cellResolution){var u=[t/e.cellResolution[0],n/e.cellResolution[1]];if(e.linePadding)for(r in e.linePadding)if(e.linePadding.hasOwnProperty(r)){i=(e.linePadding[r]*u[0]).toString();for(var l=document.getElementsByClassName("spanPadding"),d=0;d<l.length;d++)l[d].style.cssText=l[d].style.cssText.replace(/(padding-left\s*:\s*)[\d.,]+(?=\s*px)/gi,"$1"+i),l[d].style.cssText=l[d].style.cssText.replace(/(padding-right\s*:\s*)[\d.,]+(?=\s*px)/gi,"$1"+i)}if(e.fontSize){for(r in e.fontSize)if(e.fontSize.hasOwnProperty(r)){"%"===e.fontSize[r][0]?a=e.fontSize[r][1]/100:"c"===e.fontSize[r][0]&&(a=e.fontSize[r][1]),i=(a*u[1]).toString(),s="defaultFontSize"!==r?document.getElementsByClassName(r):document.getElementsByClassName("paragraph");for(var h=0;h<s.length;h++)s[h].style.cssText=s[h].style.cssText.replace(/(font-size\s*:\s*)[\d.,]+(?=\s*px)/gi,"$1"+i)}if(e.lineHeight)for(r in e.lineHeight)if(e.lineHeight.hasOwnProperty(r)){"%"===e.lineHeight[r][0]?o=e.lineHeight[r][1]/100:"c"===e.fontSize[r][0]&&(o=e.lineHeight[r][1]),i=(o*u[1]).toString(),s=document.getElementsByClassName(r);for(var p=0;p<s.length;p++)s[p].style.cssText=s[p].style.cssText.replace(/(line-height\s*:\s*)[\d.,]+(?=\s*px)/gi,"$1"+i)}}}if(e.isd){var _=document.getElementById(e.cueID);_&&g.removeChild(_),I(e)}}function I(e){if(g){var n=document.createElement("div");g.appendChild(n),m=yt(e.isd,n,(function(t){var n=/^(urn:)(mpeg:[a-z0-9][a-z0-9-]{0,31}:)(subs:)([0-9]+)$/,r=/^#(.*)$/;if(n.test(t)){var i=n.exec(t),a=parseInt(i[4],10)-1;return"data:image/png;base64,"+btoa(e.images[a])}if(r.test(t)){var o=r.exec(t)[1];return"data:image/png;base64,"+e.embeddedImages[o]}return null}),g.clientHeight,g.clientWidth,!1,(function(e){r.info("renderCaption :",e)}),m,!0),n.id=e.cueID,t.trigger(St.default.CAPTION_RENDERED,{captionDiv:n,currentTrackIdx:u})}}function R(e){return e>=0&&o[e]?a.getTextTrack(o[e].kind,o[e].id,o[e].lang,o[e].isTTML,o[e].isEmbedded):null}function b(e){var t=this;if(e!==u){var n=R(u=e);N.call(this,n),h&&(clearInterval(h),h=null),n&&"html"===n.renderingType&&(A.call(this,n,!0),window.ResizeObserver?(v=new window.ResizeObserver((function(){A.call(t,n,!0)}))).observe(a.getElement()):h=setInterval(A.bind(this,n),500))}}function N(e){w.call(this),e&&"html"===e.renderingType?C.call(this):O.call(this)}function M(e,t,n){return(isNaN(t)||e.startTime>=t)&&(isNaN(n)||e.endTime<=n)}function D(e,t,n){if(e.cues)for(var r=e.cues,i=r.length-1;i>=0;i--)M(r[i],t,n)&&e.removeCue(r[i])}function C(){var e=document.getElementById("native-cue-style");if(!e){(e=document.createElement("style")).id="native-cue-style",document.head.appendChild(e);var t=e.sheet,n=a.getElement();try{n&&(n.id?t.insertRule("#"+n.id+"::cue {background: transparent}",0):0!==n.classList.length?t.insertRule("."+n.className+"::cue {background: transparent}",0):t.insertRule("video::cue {background: transparent}",0))}catch(e){r.info(""+e.message)}}}function O(){var e=document.getElementById("native-cue-style");e&&document.head.removeChild(e)}function w(){if(g)for(;g.firstChild;)g.removeChild(g.firstChild)}return n={initialize:function(){"undefined"!=typeof window&&"undefined"!=typeof navigator&&(i=window.VTTCue||window.TextTrackCue,o=[],s=[],u=-1,l=0,d=0,f=0,c=0,g=null,h=null,_=!1,E=2147483647,m=null,void 0!==document.fullscreenElement?p="fullscreenElement":void 0!==document.webkitIsFullScreen?p="webkitIsFullScreen":document.msFullscreenElement?p="msFullscreenElement":document.mozFullScreen&&(p="mozFullScreen"))},setDisplayCConTop:function(e){(0,rt.checkParameterType)(e,"boolean"),_=e,g&&!document[p]&&(g.style.zIndex=e?E:null)},addTextTrack:function(e,n){if(o.length!==n){if(o.push(e),o.length===n){o.sort((function(e,t){return e.index-t.index})),g=a.getTTMLRenderingDiv();for(var i=-1,l=0;l<o.length;l++){var d=y.call(this,l);s.push(d),o[l].defaultTrack&&(d.default=!0,i=l);var f=R(l);f&&(f.mode=Tt.default.TEXT_SHOWING,g&&(o[l].isTTML||o[l].isEmbedded)?f.renderingType="html":f.renderingType="default"),this.addCaptions(l,0,o[l].captionData),t.trigger(St.default.TEXT_TRACK_ADDED)}if(b.call(this,i),i>=0){t.on(St.default.PLAYBACK_METADATA_LOADED,(function e(){var n=R(i);n&&A.call(this,n,!0),t.off(St.default.PLAYBACK_METADATA_LOADED,e,this)}),this);for(var c=0;c<o.length;c++){var h=R(c);h&&(h.mode=c===i?Tt.default.TEXT_SHOWING:Tt.default.TEXT_HIDDEN)}}t.trigger(St.default.TEXT_TRACKS_QUEUE_INITIALIZED,{index:u,tracks:o})}}else r.error("Trying to add too many tracks.")},addCaptions:function(e,n,a){var o=R(e),s=this;if(o&&Array.isArray(a)&&0!==a.length)for(var h=0;h<a.length;h++){var p=void 0,_=a[h];o.cellResolution=_.cellResolution,o.isFromCEA608=_.isFromCEA608,"html"===_.type&&g?((p=new i(_.start-n,_.end-n,"")).cueHTMLElement=_.cueHTMLElement,p.isd=_.isd,p.images=_.images,p.embeddedImages=_.embeddedImages,p.cueID=_.cueID,p.scaleCue=S.bind(s),p.cellResolution=_.cellResolution,p.lineHeight=_.lineHeight,p.linePadding=_.linePadding,p.fontSize=_.fontSize,g.style.left=l+"px",g.style.top=d+"px",g.style.width=f+"px",g.style.height=c+"px",p.onenter=function(){o.mode===Tt.default.TEXT_SHOWING&&(this.isd?(I(this),r.debug("Cue enter id:"+this.cueID)):(g.appendChild(this.cueHTMLElement),S.call(s,this),t.trigger(St.default.CAPTION_RENDERED,{captionDiv:this.cueHTMLElement,currentTrackIdx:u})))},p.onexit=function(){if(g)for(var e=g.childNodes,t=0;t<e.length;++t)e[t].id===this.cueID&&(r.debug("Cue exit id:"+e[t].id),g.removeChild(e[t]),--t)}):_.data&&(p=new i(_.start-n,_.end-n,_.data),_.styles&&(void 0!==_.styles.align&&"align"in p&&(p.align=_.styles.align),void 0!==_.styles.line&&"line"in p&&(p.line=_.styles.line),void 0!==_.styles.position&&"position"in p&&(p.position=_.styles.position),void 0!==_.styles.size&&"size"in p&&(p.size=_.styles.size)),p.onenter=function(){o.mode===Tt.default.TEXT_SHOWING&&t.trigger(St.default.CAPTION_RENDERED,{currentTrackIdx:u})});try{p?o.addCue(p):r.error("impossible to display subtitles.")}catch(e){throw D(o),o.addCue(p),e}}},getCurrentTrackIdx:function(){return u},setCurrentTrackIdx:b,getTrackIdxForId:function(e){for(var t=-1,n=0;n<o.length;n++)if(o[n].id===e){t=n;break}return t},getCurrentTrackInfo:function(){return o[u]},setModeForTrackIdx:function(e,t){var n=R(e);n&&n.mode!==t&&(n.mode=t)},deleteCuesFromTrackIdx:function(e,t,n){var r=R(e);r&&D(r,t,n)},deleteAllTextTracks:function(){for(var e=s?s.length:0,t=0;t<e;t++){var n=R(t);n&&(D.call(this,n),n.mode="disabled")}s=[],o=[],h&&(clearInterval(h),h=null),v&&a&&(v.unobserve(a.getElement()),v=null),u=-1,w.call(this)},deleteTextTrack:function(e){a.removeChild(s[e]),s.splice(e,1)},setConfig:function(e){e&&e.videoModel&&(a=e.videoModel)}},r=(0,Rt.default)(e).getInstance().getLogger(n),n}Nt.__dashjs_factory_name="TextTracks";var Mt=It.default.getSingletonFactory(Nt),Dt=Object.defineProperty({default:Mt},"__esModule",{value:!0}),Ct=function(e){return e&&e.__esModule?e:{default:e}}(S);function Ot(){var e=0;function t(e){for(var t="",n=0;n<e.length;++n){t+=e[n].uchar}return t.length-t.replace(/^\s+/,"").length}function n(e){return"left: "+3.125*e.x+"%; top: "+6.66*e.y1+"%; width: "+(100-3.125*e.x)+"%; height: "+6.66*Math.max(e.y2-1-e.y1,1)+"%; align-items: flex-start; overflow: visible; -webkit-writing-mode: horizontal-tb;"}function r(e){return"red"===e?"rgb(255, 0, 0)":"green"===e?"rgb(0, 255, 0)":"blue"===e?"rgb(0, 0, 255)":"cyan"===e?"rgb(0, 255, 255)":"magenta"===e?"rgb(255, 0, 255)":"yellow"===e?"rgb(255, 255, 0)":"white"===e?"rgb(255, 255, 255)":"black"===e?"rgb(0, 0, 0)":e}function i(e,t){var n=e.videoHeight/15;return t?"font-size: "+n+"px; font-family: Menlo, Consolas, 'Cutive Mono', monospace; color: "+(t.foreground?r(t.foreground):"rgb(255, 255, 255)")+"; font-style: "+(t.italics?"italic":"normal")+"; text-decoration: "+(t.underline?"underline":"none")+"; white-space: pre; background-color: "+(t.background?r(t.background):"transparent")+";":"font-size: "+n+"px; font-family: Menlo, Consolas, 'Cutive Mono', monospace; justify-content: flex-start; text-align: left; color: rgb(255, 255, 255); font-style: normal; white-space: pre; line-height: normal; font-weight: normal; text-decoration: none; width: 100%; display: flex;"}function a(e){return e.replace(/^\s+/g,"")}function o(e){return e.replace(/\s+$/g,"")}return{createHTMLCaptionsFromScreen:function(r,s,u,l){var d=null,f=!1,c=-1,g={start:s,end:u,spans:[]},h="style_cea608_white_black",p={},_={},m=[],E=void 0,v=void 0;for(E=0;E<15;++E){var y=l.rows[E],T="",A=null;if(!1===y.isEmpty()){var S=t(y.chars);null===d&&(d={x:S,y1:E,y2:E+1,p:[]}),S!==c&&f&&(d.p.push(g),g={start:s,end:u,spans:[]},d.y2=E,d.name="region_"+d.x+"_"+d.y1+"_"+d.y2,!1===p.hasOwnProperty(d.name)?(m.push(d),p[d.name]=d):p[d.name].p.contat(d.p),d={x:S,y1:E,y2:E+1,p:[]});for(var I=0;I<y.chars.length;++I){var R=y.chars[I],b=R.penState;if(null===A||!b.equals(A)){T.trim().length>0&&(g.spans.push({name:h,line:T,row:E}),T="");var N="style_cea608_"+b.foreground+"_"+b.background;b.underline&&(N+="_underline"),b.italics&&(N+="_italics"),_.hasOwnProperty(N)||(_[N]=JSON.parse(JSON.stringify(b))),A=b,h=N}T+=R.uchar}T.trim().length>0&&g.spans.push({name:h,line:T,row:E}),f=!0,c=S}else f=!1,c=-1,d&&(d.p.push(g),g={start:s,end:u,spans:[]},d.y2=E,d.name="region_"+d.x+"_"+d.y1+"_"+d.y2,!1===p.hasOwnProperty(d.name)?(m.push(d),p[d.name]=d):p[d.name].p.contat(d.p),d=null)}d&&(d.p.push(g),d.y2=E+1,d.name="region_"+d.x+"_"+d.y1+"_"+d.y2,!1===p.hasOwnProperty(d.name)?(m.push(d),p[d.name]=d):p[d.name].p.contat(d.p),d=null);var M=[];for(E=0;E<m.length;++E){var D=m[E],C="sub_cea608_"+e++,O=document.createElement("div");O.id=C;var w=n(D);O.style.cssText="position: absolute; margin: 0; display: flex; box-sizing: border-box; pointer-events: none;"+w;var P=document.createElement("div");P.className="paragraph bodyStyle",P.style.cssText=i(r);var L=document.createElement("div");L.className="cueUniWrapper",L.style.cssText="unicode-bidi: normal; direction: ltr;";for(var F=0;F<D.p.length;++F){var x=D.p[F],U=0;for(v=0;v<x.spans.length;++v){var B=x.spans[v];if(B.line.length>0){if(0!==v&&U!=B.row){var k=document.createElement("br");k.className="lineBreak",L.appendChild(k)}var G=!1;U===B.row&&(G=!0),U=B.row;var q=_[B.name],Y=document.createElement("span");Y.className="spanPadding "+B.name+" customSpanColor",Y.style.cssText=i(r,q),0!==v&&G?v===x.spans.length-1?Y.textContent=o(B.line):Y.textContent=B.line:x.spans.length>1&&v<x.spans.length-1&&B.row===x.spans[v+1].row?Y.textContent=a(B.line):Y.textContent=B.line.trim(),L.appendChild(Y)}}}P.appendChild(L),O.appendChild(P);var j={bodyStyle:["%",90]};for(var H in _)_.hasOwnProperty(H)&&(j[H]=["%",90]);M.push({type:"html",start:s,end:u,cueHTMLElement:O,cueID:C,cellResolution:[32,15],isFromCEA608:!0,fontSize:j,lineHeight:{},linePadding:{}})}return M}}}Ot.__dashjs_factory_name="EmbeddedTextHtmlRender";var wt=Ct.default.getSingletonFactory(Ot),Pt=Object.defineProperty({default:wt},"__esModule",{value:!0}),Lt=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var Ft=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return Lt(e,[{key:"extend",value:function(e,t){if(e){var n=!!t&&t.override,r=!!t&&t.publicOnly;for(var i in e)!e.hasOwnProperty(i)||this[i]&&!n||r&&-1===e[i].indexOf("public_")||(this[i]=e[i])}}}]),e}(),xt=Object.defineProperty({default:Ft},"__esModule",{value:!0});var Ut=new(function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE=10,e.MANIFEST_LOADER_LOADING_FAILURE_ERROR_CODE=11,e.XLINK_LOADER_LOADING_FAILURE_ERROR_CODE=12,e.SEGMENTS_UPDATE_FAILED_ERROR_CODE=13,e.SEGMENTS_UNAVAILABLE_ERROR_CODE=14,e.SEGMENT_BASE_LOADER_ERROR_CODE=15,e.TIME_SYNC_FAILED_ERROR_CODE=16,e.FRAGMENT_LOADER_LOADING_FAILURE_ERROR_CODE=17,e.FRAGMENT_LOADER_NULL_REQUEST_ERROR_CODE=18,e.URL_RESOLUTION_FAILED_GENERIC_ERROR_CODE=19,e.APPEND_ERROR_CODE=20,e.REMOVE_ERROR_CODE=21,e.DATA_UPDATE_FAILED_ERROR_CODE=22,e.CAPABILITY_MEDIASOURCE_ERROR_CODE=23,e.CAPABILITY_MEDIAKEYS_ERROR_CODE=24,e.DOWNLOAD_ERROR_ID_MANIFEST_CODE=25,e.DOWNLOAD_ERROR_ID_SIDX_CODE=26,e.DOWNLOAD_ERROR_ID_CONTENT_CODE=27,e.DOWNLOAD_ERROR_ID_INITIALIZATION_CODE=28,e.DOWNLOAD_ERROR_ID_XLINK_CODE=29,e.MANIFEST_ERROR_ID_CODEC_CODE=30,e.MANIFEST_ERROR_ID_PARSE_CODE=31,e.MANIFEST_ERROR_ID_NOSTREAMS_CODE=32,e.TIMED_TEXT_ERROR_ID_PARSE_CODE=33,e.MANIFEST_ERROR_ID_MULTIPLEXED_CODE=34,e.MEDIASOURCE_TYPE_UNSUPPORTED_CODE=35,e.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE="parsing failed for ",e.MANIFEST_LOADER_LOADING_FAILURE_ERROR_MESSAGE="Failed loading manifest: ",e.XLINK_LOADER_LOADING_FAILURE_ERROR_MESSAGE="Failed loading Xlink element: ",e.SEGMENTS_UPDATE_FAILED_ERROR_MESSAGE="Segments update failed",e.SEGMENTS_UNAVAILABLE_ERROR_MESSAGE="no segments are available yet",e.SEGMENT_BASE_LOADER_ERROR_MESSAGE="error loading segments",e.TIME_SYNC_FAILED_ERROR_MESSAGE="Failed to synchronize time",e.FRAGMENT_LOADER_NULL_REQUEST_ERROR_MESSAGE="request is null",e.URL_RESOLUTION_FAILED_GENERIC_ERROR_MESSAGE="Failed to resolve a valid URL",e.APPEND_ERROR_MESSAGE="chunk is not defined",e.REMOVE_ERROR_MESSAGE="buffer is not defined",e.DATA_UPDATE_FAILED_ERROR_MESSAGE="Data update failed",e.CAPABILITY_MEDIASOURCE_ERROR_MESSAGE="mediasource is not supported",e.CAPABILITY_MEDIAKEYS_ERROR_MESSAGE="mediakeys is not supported",e.TIMED_TEXT_ERROR_MESSAGE_PARSE="parsing error :",e.MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE="Error creating source buffer of type : ",e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(function(e){return e&&e.__esModule?e:{default:e}}(xt).default)),Bt=Object.defineProperty({default:Ut},"__esModule",{value:!0}),kt=Jt(p),Gt=Jt(Ce),qt=Jt(Qe),Yt=Jt(st),jt=Jt(S),Ht=Jt(ee),Kt=Jt(Dt),Vt=Jt(Pt),zt=Jt(ke),Wt=Jt(c),Xt=Jt(x),Qt=Jt(q),Zt=Jt(Me),$t=Jt(Bt);function Jt(e){return e&&e.__esModule?e:{default:e}}function en(){var e=this.context,t=(0,Xt.default)(e).getInstance(),n=!1,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,u=void 0,l=void 0,d=void 0,f=void 0,c=void 0,g=void 0,h=void 0,p=void 0,_=void 0,m=void 0,E=void 0,v=void 0,y=void 0,T=void 0,A=void 0,S=void 0,I=void 0,R=void 0,b=void 0,N=void 0,M=void 0;function D(){p=null,m=NaN,E=[],T=null,_=!1}function C(){D(),g=[],d=null}function O(e){var t=e.chunk;t.mediaInfo.embeddedCaptions&&F(t.bytes,t)}function w(){S=[],(h=(0,Kt.default)(e).getInstance()).setConfig({videoModel:v}),h.initialize(),a=(0,qt.default)(e).getInstance(),A=null,I=0,b=[],R=null,n=!0,N=(0,Vt.default)(e).getInstance();var r=y.getActiveStreamProcessors();for(var i in r)if("video"===r[i].getType()){M=r[i].getRepresentationInfo().MSETimeOffset;break}t.on(Qt.default.VIDEO_CHUNK_RECEIVED,O,this),t.on(Qt.default.BUFFER_CLEARED,U,this)}function P(e){A=e}function L(e,t){var n,r,i=new Gt.default,a={subtitle:"subtitles",caption:"captions"};i.captionData=e,i.lang=t.lang,i.labels=t.labels,i.id=t.id?t.id:t.index,i.index=t.index,i.isTTML=(n=!1,t.codec&&t.codec.search(kt.default.STPP)>=0&&(n=!0),t.mimeType&&t.mimeType.search(kt.default.TTML)>=0&&(n=!0),n),i.defaultTrack=function(e){var t=!1;S.length>1&&e.isEmbedded?t=e.id&&e.id===kt.default.CC1:1===S.length?e.id&&"string"==typeof e.id&&"CC"===e.id.substring(0,2)&&(t=!0):0===S.length&&(t=e.index===g[0].index);return t}(t),i.isFragmented=!s.getIsTextTrack(t.mimeType),i.isEmbedded=!!t.isEmbedded,i.kind=r=(r=t.roles.length>0?a[t.roles[0]]:a.caption)===a.caption||r===a.subtitle?r:a.caption,i.roles=t.roles,i.accessibility=t.accessibility;var o=(g?g.length:0)+S.length;h.addTextTrack(i,o)}function F(e,t){var n=void 0,r=void 0,s=void 0,l=void 0,f=void 0,c=void 0,g=void 0,E=t.mediaInfo,y=E.type,D=E.mimeType,C=E.codec||D;if(C){if(y===kt.default.FRAGMENTED_TEXT)if(_||"InitializationSegment"!==t.segmentType){if(!_)return;if(r=(c=a.getSamplesInfo(e)).sampleList,null===T&&r.length>0&&(T=r[0].cts-t.start*m),C.search(kt.default.STPP)>=0)for(d=null!==d?d:x(C),s=0;s<r.length;s++){var O=r[s],w=O.cts,P=w-T;this.buffered.add(P/m,(P+O.duration)/m);var F=new DataView(e,O.offset,O.subSizes[0]);g=zt.default.Utils.dataViewToString(F,kt.default.UTF8);var U=[],B=O.offset+O.subSizes[0];for(l=1;l<O.subSizes.length;l++){var k=new Uint8Array(e,B,O.subSizes[l]),G=String.fromCharCode.apply(null,k);U.push(G),B+=O.subSizes[l]}try{var q=u.getValue().ttmlTimeIsRelative?w/m:0;n=d.parse(g,q,w/m,(w+O.duration)/m,U),h.addCaptions(A,T/m,n)}catch(e){p.removeExecutedRequestsBeforeTime(),this.remove(),i.error("TTML parser error: "+e.message)}}else{var Y=[];for(s=0;s<r.length;s++){var j=r[s];j.cts-=T,this.buffered.add(j.cts/m,(j.cts+j.duration)/m);var H=e.slice(j.offset,j.offset+j.size),K=zt.default.parseBuffer(H);for(l=0;l<K.boxes.length;l++){var V=K.boxes[l];if(i.debug("VTT box1: "+V.type),"vtte"!==V.type&&"vttc"===V.type)for(i.debug("VTT vttc boxes.length = "+V.boxes.length),f=0;f<V.boxes.length;f++){var z=V.boxes[f];if(i.debug("VTT box2: "+z.type),"payl"===z.type){var W=z.cue_text;i.debug("VTT cue_text = "+W);var X=j.cts/m,Q=(j.cts+j.duration)/m;Y.push({start:X,end:Q,data:W,styles:{}}),i.debug("VTT "+X+"-"+Q+" : "+W)}}}}Y.length>0&&h.addCaptions(A,0,Y)}}else _=!0,m=a.getMediaTimescaleFromMoov(e);else if(y===kt.default.TEXT){var Z=new DataView(e,0,e.byteLength);g=zt.default.Utils.dataViewToString(Z,kt.default.UTF8);try{n=x(C).parse(g,0),h.addCaptions(h.getCurrentTrackIdx(),0,n)}catch(e){o.error(new Zt.default($t.default.TIMED_TEXT_ERROR_ID_PARSE_CODE,$t.default.TIMED_TEXT_ERROR_MESSAGE_PARSE+e.message,g))}}else if(y===kt.default.VIDEO)if(t.segmentType===pe.HTTPRequest.INIT_SEGMENT_TYPE){if(0===I)for(I=a.getMediaTimescaleFromMoov(e),s=0;s<S.length;s++)L(null,S[s])}else{if(0===I)return void i.warn("CEA-608: No timescale for embeddedTextTrack yet");var $=function(e,t){return function(e,n,r){var i=null;i=v.getTTMLRenderingDiv()?N.createHTMLCaptionsFromScreen(v.getElement(),e,n,r):[{start:e,end:n,data:r.getDisplayText(),styles:{}}],i&&h.addCaptions(t,0,i)}},J=(c=a.getSamplesInfo(e)).lastSequenceNumber;if(!b[0]&&!b[1]){var ee=void 0,te=void 0;for(s=0;s<S.length;s++){if(S[s].id===kt.default.CC1?te=h.getTrackIdxForId(kt.default.CC1):S[s].id===kt.default.CC3&&(te=h.getTrackIdxForId(kt.default.CC3)),-1===te)return void i.warn("CEA-608: data before track is ready.");ee=$(0,te),b[s]=new Wt.default.Cea608Parser(s+1,{newCue:ee},null)}}if(I){if(null!==R&&J!==R+c.numSequences)for(s=0;s<b.length;s++)b[s]&&b[s].reset();for(var ne=function(e,t){if(0===t.length)return null;for(var n={splits:[],fields:[[],[]]},r=new DataView(e),i=0;i<t.length;i++)for(var a=t[i],o=Wt.default.findCea608Nalus(r,a.offset,a.size),s=null,u=0,l=0;l<o.length;l++)for(var d=Wt.default.extractCea608DataFromRange(r,o[l]),f=0;f<2;f++)d[f].length>0&&(a.cts!==s?u=0:u+=1,n.fields[f].push([a.cts+M*I,d[f],u]),s=a.cts);return n.fields.forEach((function(e){e.sort((function(e,t){return e[0]===t[0]?e[2]-t[2]:e[0]-t[0]}))})),n}(e,c.sampleList),re=0;re<b.length;re++){var ie=ne.fields[re],ae=b[re];if(ae)for(s=0;s<ie.length;s++)ae.addData(ie[s][0]/I,ie[s][1])}R=J}}}else i.error("No text type defined")}function x(e){var t=void 0;return e.search(kt.default.VTT)>=0?t=f:(e.search(kt.default.TTML)>=0||e.search(kt.default.STPP)>=0)&&(t=c),t}function U(e){S.forEach((function(t){var n=h.getTrackIdxForId(t.id);n>=0&&h.deleteCuesFromTrackIdx(n,e.from,e.to)}))}return r={initialize:function(t,i,o,u){n||w(),h.setConfig({videoModel:v}),h.initialize(),a||(a=(0,qt.default)(e).getInstance()),function(t,n,i,a){var o=!s.getIsTextTrack(t);if(g=g.concat(i),o){p=a,r.buffered=(0,Yt.default)(e).create(),E=l.getTracksFor(kt.default.FRAGMENTED_TEXT,n);for(var u=l.getCurrentTrackFor(kt.default.FRAGMENTED_TEXT,n),d=0;d<E.length;d++)if(E[d]===u){P(d);break}}for(var f=0;f<g.length;f++)L(null,g[f])}(t,i,o,u)},append:F,abort:function(){h.deleteAllTextTracks(),D(),a=null,g=[]},addEmbeddedTrack:function(e){if(n||w(),e)if(e.id===kt.default.CC1||e.id===kt.default.CC3){for(var t=0;t<S.length;t++)if(S[t].id===e.id)return;S.push(e)}else i.warn("Embedded track "+e.id+" not supported!")},resetEmbedded:function(){t.off(Qt.default.VIDEO_CHUNK_RECEIVED,O,this),t.off(Qt.default.BUFFER_CLEARED,U,this),h&&h.deleteAllTextTracks(),n=!1,S=[],b=[null,null],R=null},setConfig:function(e){e&&(e.errHandler&&(o=e.errHandler),e.adapter&&(s=e.adapter),e.manifestModel&&(u=e.manifestModel),e.mediaController&&(l=e.mediaController),e.videoModel&&(v=e.videoModel),e.streamController&&(y=e.streamController),e.textTracks&&(h=e.textTracks),e.vttParser&&(f=e.vttParser),e.ttmlParser&&(c=e.ttmlParser))},getConfig:function(){return{fragmentModel:p,fragmentedTracks:E,videoModel:v}},setCurrentFragmentedTrackIdx:P,remove:function(e,t){void 0===e&&e===t&&(e=this.buffered.start(0),t=this.buffered.end(this.buffered.length-1)),this.buffered.remove(e,t)},reset:function(){C(),y=null,v=null,h=null}},i=(0,Ht.default)(e).getInstance().getLogger(r),C(),r}en.__dashjs_factory_name="TextSourceBuffer";var tn=jt.default.getSingletonFactory(en),nn=Object.defineProperty({default:tn},"__esModule",{value:!0}),rn=on(S),an=on(ee);function on(e){return e&&e.__esModule?e:{default:e}}function sn(){var e=this.context,t=void 0,n=void 0,r=void 0,i=void 0,a=void 0,o=void 0;function s(e){var t=e.split(":"),n=t.length-1;return e=60*parseInt(t[n-1],10)+parseFloat(t[n]),2===n&&(e+=3600*parseInt(t[0],10)),e}function u(e){var t=e.split(i),n=t[1].split(o);return n.shift(),t[1]=n[0],n.shift(),{cuePoints:t,styles:l(n)}}function l(e){var t={};return e.forEach((function(e){if(e.split(/:/).length>1){var n=e.split(/:/)[1];n&&-1!=n.search(/%/)&&(n=parseInt(n.replace(/%/,""),10)),(e.match(/align/)||e.match(/A/))&&(t.align=n),(e.match(/line/)||e.match(/L/))&&(t.line=n),(e.match(/position/)||e.match(/P/))&&(t.position=n),(e.match(/size/)||e.match(/S/))&&(t.size=n)}})),t}function d(e,t){for(var n,r=t,a="",o="";""!==e[r]&&r<e.length;)r++;if((n=r-t)>1)for(var s=0;s<n;s++){if((o=e[t+s]).match(i)){a="";break}a+=o,s!==n-1&&(a+="\n")}else(o=e[t]).match(i)||(a=o);return a}return t={parse:function(e){var t,o=[],l=void 0;if(!e)return o;t=(e=e.split(r)).length,l=-1;for(var f=0;f<t;f++){var c=e[f];if(c.length>0&&"WEBVTT"!==c&&c.match(i)){var g=u(c),h=g.cuePoints,p=g.styles,_=d(e,f+1),m=s(h[0].replace(a,"")),E=s(h[1].replace(a,""));!isNaN(m)&&!isNaN(E)&&m>=l&&E>m?""!==_?(l=m,o.push({start:m,end:E,data:_,styles:p})):n.error("Skipping cue due to empty/malformed cue text"):n.error("Skipping cue due to incorrect cue timing")}}return o}},n=(0,an.default)(e).getInstance().getLogger(t),r=/(?:\r\n|\r|\n)/gm,i=/-->/,a=/(^[\s]+|[\s]+$)/g,o=/\s\b/g,t}sn.__dashjs_factory_name="VTTParser";var un=rn.default.getSingletonFactory(sn),ln=Object.defineProperty({default:un},"__esModule",{value:!0}),dn=Object.defineProperty({default:{LEVELS:{SUGGESTION:"Suggestion",WARNING:"Warning",ERROR:"Error"},EVENTS:{NO_UTC_TIMING_ELEMENT:{key:"NO_UTC_TIMING_ELEMENT",message:"No UTCTiming element is present in the manifest. You may experience playback failures. For a detailed validation use https://conformance.dashif.org/"},NON_COMPLIANT_SMPTE_IMAGE_ATTRIBUTE:{key:"NON_COMPLIANT_SMPTE_IMAGE_ATTRIBUTE",message:'SMPTE 2052-1:2013 defines the attribute name as "imageType" and does not define "imagetype"'}}}},"__esModule",{value:!0}),fn=mn(S),cn=mn(ee),gn=mn(x),hn=mn(q),pn=mn(D),_n=mn(dn);function mn(e){return e&&e.__esModule?e:{default:e}}function En(){var e=this.context,t=(0,gn.default)(e).getInstance(),n=void 0,r=void 0,i=0;return n={parse:function(e,n,a,o,s){var u="",l=[],d=void 0,f=void 0,c=void 0,g={},h={},p="",_="",m={onOpenTag:function(e,n,i){if(i[" imagetype"]&&!i[" imageType"]&&(t.trigger(pn.default.CONFORMANCE_VIOLATION,{level:_n.default.LEVELS.ERROR,event:_n.default.EVENTS.NON_COMPLIANT_SMPTE_IMAGE_ATTRIBUTE}),i[" imageType"]=i[" imagetype"]),"image"===n&&("http://www.smpte-ra.org/schemas/2052-1/2010/smpte-tt"===e||"http://www.smpte-ra.org/schemas/2052-1/2013/smpte-tt"===e)){if(!i[" imageType"]||"PNG"!==i[" imageType"].value)return void r.warn("smpte-tt imageType != PNG. Discarded");p=i["http://www.w3.org/XML/1998/namespace id"].value}},onCloseTag:function(){p&&(h[p]=_.trim()),_="",p=""},onText:function(e){p&&(_+=e)}};if(!e)throw u="no ttml data to parse",new Error(u);g.data=e,t.trigger(hn.default.TTML_TO_PARSE,g);var E=vt(g.data,(function(e){u=e}),m);t.trigger(hn.default.TTML_PARSED,{ttmlString:g.data,ttmlDoc:E});var v,y=E.getMediaTimeEvents();for(c=0;c<y.length;c++){var T=Et(E,y[c],(function(e){u=e}));T.contents.some((function(e){return e.contents.length}))&&(d=y[c]+n<a?a:y[c]+n)<(f=y[c+1]+n>o?o:y[c+1]+n)&&l.push({start:d,end:f,type:"html",cueID:(v=void 0,v="cue_TTML_"+i,i++,v),isd:T,images:s,embeddedImages:h})}if(""!==u)throw r.error(u),new Error(u);return l}},r=(0,cn.default)(e).getInstance().getLogger(n),n}En.__dashjs_factory_name="TTMLParser";var vn=fn.default.getSingletonFactory(En),yn=Object.defineProperty({default:vn},"__esModule",{value:!0}),Tn=Dn(p),An=Dn(S),Sn=Dn(nn),In=Dn(Dt),Rn=Dn(ln),bn=Dn(yn),Nn=Dn(x),Mn=Dn(q);function Dn(e){return e&&e.__esModule?e:{default:e}}function Cn(){var e=this.context,t=void 0,n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,u=void 0,l=void 0,d=void 0,f=void 0,c=void 0,g=void 0,h=void 0,p=void 0,_=void 0,m=void 0,E=void 0,v=void 0,y=void 0,T=void 0;function A(e){void 0===T&&null!==e.fromStreamInfo&&(T=this.getCurrentTrackIdx())}function S(){void 0===T&&(T=this.getCurrentTrackIdx())}function I(){void 0!==T&&(this.setTextTrack(T),T=void 0)}function R(e){var t=this,n=e.tracks,r=e.index;g&&n.some((function(e,n){if(o.matchSettings(g,e))return t.setTextTrack(n),r=n,!0})),(!1===_||void 0===_&&!g||y)&&this.setTextTrack(-1),p=r,c.trigger(Mn.default.TEXT_TRACKS_ADDED,{enabled:N(),index:r,tracks:n}),v=!0}function b(e){if(!h&&e&&e.newMediaInfo){var t=e.newMediaInfo;t.type===Tn.default.FRAGMENTED_TEXT&&(g={lang:t.lang,role:t.roles[0],accessibility:t.accessibility[0]})}}function N(){var e=!0;return m&&!E&&(e=!1),e}function M(){m=!0,v=!1,y=!1}return t={setConfig:function(e){e&&(e.errHandler&&(r=e.errHandler),e.adapter&&(i=e.adapter),e.manifestModel&&(a=e.manifestModel),e.mediaController&&(o=e.mediaController),e.videoModel&&(s=e.videoModel),e.streamController&&(u=e.streamController),e.textTracks&&(l=e.textTracks),e.vttParser&&(d=e.vttParser),e.ttmlParser&&(f=e.ttmlParser),n.setConfig({errHandler:r,adapter:i,manifestModel:a,mediaController:o,videoModel:s,streamController:u,textTracks:l,vttParser:d,ttmlParser:f}))},getTextSourceBuffer:function(){return n},getAllTracksAreDisabled:function(){return m},addEmbeddedTrack:function(e){n.addEmbeddedTrack(e)},getTextDefaultLanguage:function(){return g&&g.lang||""},setTextDefaultLanguage:function(e){(0,rt.checkParameterType)(e,"string"),g||(g={}),g.lang=e,h=!0},setTextDefaultEnabled:function(e){(0,rt.checkParameterType)(e,"boolean"),(_=e)?m=!1:this.setTextTrack(-1)},getTextDefaultEnabled:function(){return void 0!==_&&_},setInitialSettings:function(e){g=e,h=!0},enableText:function(e){(0,rt.checkParameterType)(e,"boolean"),!_&&e&&(_=!0),N()!==e&&(e&&this.setTextTrack(p),e||(p=this.getCurrentTrackIdx(),v?this.setTextTrack(-1):y=!0))},isTextEnabled:N,setTextTrack:function(e){var t=n.getConfig(),r=t.fragmentModel,i=t.fragmentedTracks,a=t.videoModel,s=void 0,d=void 0;m=-1===e;var f=l.getCurrentTrackIdx();if(f!==e){m&&o&&o.saveTextSettingsDisabled(),l.setModeForTrackIdx(f,Tn.default.TEXT_HIDDEN),l.setCurrentTrackIdx(e),l.setModeForTrackIdx(e,Tn.default.TEXT_SHOWING);var c=l.getCurrentTrackInfo();if(c&&c.isFragmented&&!c.isEmbedded)for(var g=0;g<i.length;g++){var h=i[g];if(c.lang===h.lang&&c.index===h.index&&(h.id?c.id===h.id:c.id===h.index))if(h!==o.getCurrentTrackFor(Tn.default.FRAGMENTED_TEXT,u.getActiveStreamInfo()))r.abortRequests(),r.removeExecutedRequestsBeforeTime(),n.remove(),l.deleteCuesFromTrackIdx(f),o.setTrack(h),n.setCurrentFragmentedTrackIdx(g);else if(-1===f){for(var p=u.getActiveStreamProcessors(),_=0;_<p.length;_++)if(p[_].getType()===Tn.default.FRAGMENTED_TEXT){d=p[_];break}d.setBufferingTime(a.getTime()),d.getScheduleController().start()}}else if(c&&!c.isFragmented){for(var E=u.getActiveStreamProcessors(),v=0;v<E.length;v++)if(E[v].getType()===Tn.default.TEXT){s=(d=E[v]).getMediaInfoArr();break}if(d&&s)for(var y=0;y<s.length;y++)if(s[y].index===c.index&&s[y].lang===c.lang){d.selectMediaInfo(s[y]);break}}}},getCurrentTrackIdx:function(){return l.getCurrentTrackIdx()},enableForcedTextStreaming:function(e){(0,rt.checkParameterType)(e,"boolean"),E=e},reset:function(){M(),n.resetEmbedded(),n.reset()}},g=null,p=-1,E=!1,v=!1,h=!1,y=!1,l=(0,In.default)(e).getInstance(),d=(0,Rn.default)(e).getInstance(),f=(0,bn.default)(e).getInstance(),n=(0,Sn.default)(e).getInstance(),c=(0,Nn.default)(e).getInstance(),l.initialize(),c.on(Mn.default.TEXT_TRACKS_QUEUE_INITIALIZED,R,t),c.on(Mn.default.CURRENT_TRACK_CHANGED,b,t),c.on(Mn.default.PERIOD_SWITCH_STARTED,A,t),c.on(Mn.default.STREAM_COMPLETED,S,t),c.on(Mn.default.PERIOD_SWITCH_COMPLETED,I,t),M(),t}Cn.__dashjs_factory_name="TextController";var On=An.default.getSingletonFactory(Cn),wn=Object.defineProperty({default:On},"__esModule",{value:!0}),Pn=Gn(ee),Ln=Gn(Me),Fn=Gn(x),xn=Gn(q),Un=Gn(S),Bn=Gn(wn),kn=Gn(Bt);function Gn(e){return e&&e.__esModule?e:{default:e}}function qn(e,t,n,r){var i=this.context,a=(0,Fn.default)(i).getInstance(),o=void 0,s=void 0,u=void 0,l=void 0,d=void 0,f=void 0,c=[],g=[],h=n;function p(){try{return l.buffered}catch(e){return u.error("getAllBufferRanges exception: "+e.message),null}}function _(t){l&&A((function(){try{var n=e.duration,r=0;t&&!isNaN(t.start)&&!isNaN(t.duration)&&isFinite(t.duration)&&(n=t.start+t.duration),t&&!isNaN(t.start)&&(r=t.start),l.appendWindowStart=0,l.appendWindowEnd=n,l.appendWindowStart=r,u.debug("Updated append window. Set start to "+l.appendWindowStart+" and end to "+l.appendWindowEnd)}catch(e){u.warn("Failed to set append window")}}))}function m(){var e=this;if(g.length>0){d=!0;var t=g[0];g.splice(0,1);var n=[],r=function(){var r=p();!function(e,t,n,r){t&&t.length>0&&t.length<n.length&&function(e,t){for(var n=0;n<e.length;n++){var r=Math.round(e.start(n)),i=Math.round(e.end(n));if(i===t.start||r===t.end||t.start>=r&&t.end<=i)return!0}return!1}(t,r)&&a.trigger(xn.default.SOURCEBUFFER_REMOVE_COMPLETED,{buffer:e,from:n.end(n.length-2),to:n.start(n.length-1),unintended:!0})}(e,n,r,t),g.length>0?m.call(this):(d=!1,h&&h({chunk:t}))};try{0===t.bytes.length?r.call(this):(n=p(),l.appendBuffer?l.appendBuffer(t.bytes):l.append(t.bytes,t),A(r.bind(this)))}catch(e){u.fatal('SourceBuffer append failed "'+e+'"'),g.length>0?m():d=!1,h&&h({chunk:t,error:new Ln.default(e.code,e.message)})}}}function E(){if(c.length>0){var e=c.shift();l.updating?A(e):(e(),E())}}function v(){l.updating||E()}function y(){l.updating||E()}function T(){u.error("SourceBufferSink error")}function A(e){c.push(e),l.updating||E()}return o={getType:function(){return s},getAllBufferRanges:p,getBuffer:function(){return l},append:function(e){e?(g.push(e),d||A(m.bind(this))):h({chunk:e,error:new Ln.default(kn.default.APPEND_ERROR_CODE,kn.default.APPEND_ERROR_MESSAGE)})},remove:function(t,n,r){var i=this;A((function(){try{t>=0&&n>t&&(r||"ended"!==e.readyState)&&l.remove(t,n),A((function(){a.trigger(xn.default.SOURCEBUFFER_REMOVE_COMPLETED,{buffer:i,from:t,to:n,unintended:!1})}))}catch(e){a.trigger(xn.default.SOURCEBUFFER_REMOVE_COMPLETED,{buffer:i,from:t,to:n,unintended:!1,error:new Ln.default(e.code,e.message)})}}))},abort:function(){try{("open"===e.readyState||l.setTextTrack&&"ended"===e.readyState)&&l.abort()}catch(e){u.error('SourceBuffer append abort failed: "'+e+'"')}g=[]},reset:function(t){if(l){if("function"==typeof l.removeEventListener&&(l.removeEventListener("updateend",y,!1),l.removeEventListener("error",T,!1),l.removeEventListener("abort",T,!1)),clearInterval(f),c=[],!t){try{l.getClassName&&"TextSourceBuffer"===l.getClassName()||(u.debug("Removing sourcebuffer from media source"),e.removeSourceBuffer(l))}catch(e){u.error("Failed to remove source buffer from media source.")}l=null}d=!1}g=[],h=null},updateTimestampOffset:function(e){l.timestampOffset===e||isNaN(e)||A((function(){e<0&&(e+=.001),l.timestampOffset=e}))},hasDiscontinuitiesAfter:function(e){try{var t=p();if(t&&t.length>1)for(var n=0,r=t.length;n<r;n++)if(n>0&&e<t.start(n)&&t.start(n)>t.end(n-1)+.1)return!0}catch(e){u.error("hasDiscontinuities exception: "+e.message)}return!1},waitForUpdateEnd:A,updateAppendWindow:_},function(){u=(0,Pn.default)(i).getInstance().getLogger(o),d=!1,s=t.type;var n=t.codec;try{if(n.match(/application\/mp4;\s*codecs="(stpp|wvtt).*"/i))throw new Error("not really supported");(l=r||e.addSourceBuffer(n)).changeType&&r&&(u.debug("Doing period transition with changeType"),l.changeType(n)),_();if("function"==typeof l.addEventListener)try{l.addEventListener("updateend",y,!1),l.addEventListener("error",T,!1),l.addEventListener("abort",T,!1)}catch(e){f=setInterval(v,50)}else f=setInterval(v,50)}catch(e){if(!t.isText&&-1===n.indexOf('codecs="stpp')&&-1===n.indexOf('codecs="wvtt'))throw e;var a=(0,Bn.default)(i).getInstance();l=a.getTextSourceBuffer()}}(),o}qn.__dashjs_factory_name="SourceBufferSink";var Yn=Un.default.getClassFactory(qn),jn=Object.defineProperty({default:Yn},"__esModule",{value:!0}),Hn=Vn(ee),Kn=Vn(S);function Vn(e){return e&&e.__esModule?e:{default:e}}function zn(e){var t=this.context,n=void 0,r=void 0,i=void 0,a=[],o=e;function s(e,t){a=a.filter((function(n){return!((isNaN(t)||n.start<t)&&(isNaN(e)||n.end>e))}))}return n={getAllBufferRanges:function(){for(var e=[],t=0;t<a.length;t++){var n=a[t];0===e.length||n.start>e[e.length-1].end?e.push({start:n.start,end:n.end}):e[e.length-1].end=n.end}var r={start:function(t){return e[t].start},end:function(t){return e[t].end}};return Object.defineProperty(r,"length",{get:function(){return e.length}}),r},append:function(e){"InitializationSegment"!==e.segmentType?(a.push(e),a.sort((function(e,t){return e.start-t.start})),i=null):i=e,r.debug("PreBufferSink appended chunk s: "+e.start+"; e: "+e.end),o&&o({chunk:e})},remove:s,abort:function(){},discharge:function(e,t){var n=function(e,t){return a.filter((function(n){return(isNaN(t)||n.start<t)&&(isNaN(e)||n.end>e)}))}(e,t);return i&&(n.push(i),i=null),s(e,t),n},reset:function(){a=[],i=null,o=null},updateTimestampOffset:function(){},hasDiscontinuitiesAfter:function(){return!1},waitForUpdateEnd:function(e){e()},getBuffer:function(){return this}},r=(0,Hn.default)(t).getInstance().getLogger(n),n}zn.__dashjs_factory_name="PreBufferSink";var Wn=Kn.default.getClassFactory(zn),Xn=Object.defineProperty({default:Wn},"__esModule",{value:!0}),Qn=function(e){return e&&e.__esModule?e:{default:e}}(S);var Zn={DEFAULT:.5,STRONG:1,WEAK:0};function $n(e,t,n){return{quality:void 0===e?-1:e,reason:void 0===t?null:t,priority:function(e){var t=Zn.DEFAULT;return e!==Zn.DEFAULT&&e!==Zn.STRONG&&e!==Zn.WEAK||(t=e),t}(n)}}$n.__dashjs_factory_name="SwitchRequest";var Jn=Qn.default.getClassFactory($n);Jn.NO_CHANGE=-1,Jn.PRIORITY=Zn,Qn.default.updateClassFactory($n.__dashjs_factory_name,Jn);var er=Jn,tr=Object.defineProperty({default:er},"__esModule",{value:!0}),nr=sr(S),rr=sr(ee),ir=sr(tr),ar=sr(p),or=sr(T);function sr(e){return e&&e.__esModule?e:{default:e}}function ur(e){e=e||{};var t=this.context,n=e.dashMetrics,r=void 0,i=void 0;return r={getMaxIndex:function(e){var r=(0,ir.default)(t).create();if(!(e&&e.hasOwnProperty("getMediaInfo")&&e.hasOwnProperty("getMediaType")&&e.hasOwnProperty("useBufferOccupancyABR")&&e.hasOwnProperty("getAbrController")&&e.hasOwnProperty("getScheduleController")))return r;!function(){if(!n||!n.hasOwnProperty("getCurrentBufferState"))throw new Error(ar.default.MISSING_CONFIG_ERROR)}();var a=e.getMediaInfo(),o=e.getMediaType(),s=n.getCurrentBufferState(o),u=e.getScheduleController(),l=e.getAbrController(),d=e.getStreamInfo(),f=d&&d.manifestInfo?d.manifestInfo.isDynamic:null,c=l.getThroughputHistory(),g=c.getSafeAverageThroughput(o,f),h=c.getAverageLatency(o),p=e.useBufferOccupancyABR();return isNaN(g)||!s||p||l.getAbandonmentStateFor(o)!==or.default.ABANDON_LOAD&&(s.state===or.default.BUFFER_LOADED||f)&&(r.quality=l.getQualityForBitrate(a,g,h),u.setTimeToLoadDelay(0),i.debug("["+o+"] requesting switch to index: ",r.quality,"Average throughput",Math.round(g),"kbps"),r.reason={throughput:g,latency:h}),r},reset:function(){}},i=(0,rr.default)(t).getInstance().getLogger(r),r}ur.__dashjs_factory_name="ThroughputRule";var lr=nr.default.getClassFactory(ur),dr=Object.defineProperty({default:lr},"__esModule",{value:!0}),fr=Er(x),cr=Er(q),gr=Er(S),hr=Er(ee),pr=Er(tr),_r=Er(p),mr=Er(T);function Er(e){return e&&e.__esModule?e:{default:e}}function vr(e){e=e||{};var t=this.context,n=(0,fr.default)(t).getInstance(),r=e.dashMetrics,i=void 0,a=void 0,o=void 0;function s(){(o={})[_r.default.VIDEO]={ignoreCount:2},o[_r.default.AUDIO]={ignoreCount:2}}function u(){s()}function l(e){isNaN(e.startTime)||e.mediaType!==_r.default.AUDIO&&e.mediaType!==_r.default.VIDEO||o[e.mediaType].ignoreCount>0&&o[e.mediaType].ignoreCount--}return i={getMaxIndex:function(e){var n=(0,pr.default)(t).create();if(!e||!e.hasOwnProperty("getMediaType"))return n;!function(){if(!r||!r.hasOwnProperty("getCurrentBufferLevel")||!r.hasOwnProperty("getCurrentBufferState"))throw new Error(_r.default.MISSING_CONFIG_ERROR)}();var i=e.getMediaType(),s=r.getCurrentBufferState(i),u=e.getRepresentationInfo().fragmentDuration;if(function(e){return o[e].ignoreCount>0}(i)||!u)return n;if(s&&s.state===mr.default.BUFFER_EMPTY)a.debug("["+i+"] Switch to index 0; buffer is empty."),n.quality=0,n.reason="InsufficientBufferRule: Buffer is empty";else{var l=e.getMediaInfo(),d=e.getAbrController(),f=d.getThroughputHistory(),c=r.getCurrentBufferLevel(i),g=f.getAverageThroughput(i),h=f.getAverageLatency(i),p=g*(c/u)*.5;n.quality=d.getQualityForBitrate(l,p,h),n.reason="InsufficientBufferRule: being conservative to avoid immediate rebuffering"}return n},reset:function(){s(),n.off(cr.default.PLAYBACK_SEEKING,u,i),n.off(cr.default.BYTES_APPENDED_END_FRAGMENT,l,i)}},a=(0,hr.default)(t).getInstance().getLogger(i),s(),n.on(cr.default.PLAYBACK_SEEKING,u,i),n.on(cr.default.BYTES_APPENDED_END_FRAGMENT,l,i),i}vr.__dashjs_factory_name="InsufficientBufferRule";var yr=gr.default.getClassFactory(vr),Tr=Object.defineProperty({default:yr},"__esModule",{value:!0}),Ar=Rr(tr),Sr=Rr(S),Ir=Rr(ee);function Rr(e){return e&&e.__esModule?e:{default:e}}function br(e){e=e||{};var t=this.context,n=e.mediaPlayerModel,r=e.dashMetrics,i=e.settings,a=void 0,o=void 0,s=void 0,u=void 0,l=void 0;function d(){s={},u={},l=[]}return a={shouldAbandon:function(e){var a=(0,Ar.default)(t).create(Ar.default.NO_CHANGE,{name:br.__dashjs_factory_name});if(!(e&&e.hasOwnProperty("getMediaInfo")&&e.hasOwnProperty("getMediaType")&&e.hasOwnProperty("getCurrentRequest")&&e.hasOwnProperty("getRepresentationInfo")&&e.hasOwnProperty("getAbrController")))return a;var d,f,c=e.getMediaInfo(),g=e.getMediaType(),h=e.getCurrentRequest();if(!isNaN(h.index)){d=g,f=h.index,s[d]=s[d]||{},s[d][f]=s[d][f]||{};var p=n.getStableBufferTime();if(r.getCurrentBufferLevel(g)>p)return a;var _=s[g][h.index];if(null===_||null===h.firstByteDate||u.hasOwnProperty(_.id))return a;if(void 0===_.firstByteTime&&(l[g]=[],_.firstByteTime=h.firstByteDate.getTime(),_.segmentDuration=h.duration,_.bytesTotal=h.bytesTotal,_.id=h.index),_.bytesLoaded=h.bytesLoaded,_.elapsedTime=(new Date).getTime()-_.firstByteTime,_.bytesLoaded>0&&_.elapsedTime>0&&function(e,t){l[e]=l[e]||[],l[e].push(t)}(g,Math.round(8*_.bytesLoaded/_.elapsedTime)),l[g].length>=5&&_.elapsedTime>500&&_.bytesLoaded<_.bytesTotal){var m=l[g].reduce((function(e,t){return e+t}),0);if(_.measuredBandwidthInKbps=Math.round(m/l[g].length),_.estimatedTimeOfDownload=+(8*_.bytesTotal/_.measuredBandwidthInKbps/1e3).toFixed(2),_.estimatedTimeOfDownload<1.8*_.segmentDuration||0===e.getRepresentationInfo().quality)return a;if(!u.hasOwnProperty(_.id)){var E=e.getAbrController(),v=_.bytesTotal-_.bytesLoaded,y=E.getBitrateList(c),T=E.getQualityForBitrate(c,_.measuredBandwidthInKbps*i.get().streaming.abr.bandwidthSafetyFactor),A=E.getMinAllowedIndexFor(g),S=void 0!==A?Math.max(A,T):T;v>_.bytesTotal*y[S].bitrate/y[E.getQualityFor(g)].bitrate&&(a.quality=S,a.reason.throughput=_.measuredBandwidthInKbps,a.reason.fragmentID=_.id,u[_.id]=_,o.debug("["+g+"] frag id",_.id," is asking to abandon and switch to quality to ",S," measured bandwidth was",_.measuredBandwidthInKbps),delete s[g][_.id])}}else _.bytesLoaded===_.bytesTotal&&delete s[g][_.id]}return a},reset:d},o=(0,Ir.default)(t).getInstance().getLogger(a),d(),a}br.__dashjs_factory_name="AbandonRequestsRule";var Nr=Sr.default.getClassFactory(br),Mr=Object.defineProperty({default:Nr},"__esModule",{value:!0}),Dr=wr(S),Cr=wr(tr),Or=wr(ee);function wr(e){return e&&e.__esModule?e:{default:e}}function Pr(){var e=this.context,t=void 0,n=void 0;return t={getMaxIndex:function(t){var r=(0,Cr.default)(e).create();if(!t||!t.hasOwnProperty("getDroppedFramesHistory"))return r;var i=t.getDroppedFramesHistory();if(i){for(var a=i.getFrameHistory(),o=0,s=0,u=Cr.default.NO_CHANGE,l=1;l<a.length;l++)if(a[l]&&(o=a[l].droppedVideoFrames,(s=a[l].totalVideoFrames)>375&&o/s>.15)){u=l-1,n.debug("index: "+u+" Dropped Frames: "+o+" Total Frames: "+s);break}return(0,Cr.default)(e).create(u,{droppedFrames:o})}return r}},n=(0,Or.default)(e).getInstance().getLogger(t),t}Pr.__dashjs_factory_name="DroppedFramesRule";var Lr=Dr.default.getClassFactory(Pr),Fr=Object.defineProperty({default:Lr},"__esModule",{value:!0}),xr=kr(S),Ur=kr(ee),Br=kr(tr);function kr(e){return e&&e.__esModule?e:{default:e}}function Gr(){var e=this.context,t=void 0,n=void 0;return t={getMaxIndex:function(t){for(var r=t?t.getSwitchHistory():null,i=r?r.getSwitchRequests():[],a=0,o=0,s=0,u=(0,Br.default)(e).create(),l=0;l<i.length;l++)if(void 0!==i[l]&&(a+=i[l].drops,o+=i[l].noDrops,s+=i[l].dropSize,a+o>=6&&a/o>.075)){u.quality=l>0&&i[l].drops>0?l-1:l,u.reason={index:u.quality,drops:a,noDrops:o,dropSize:s},n.debug("Switch history rule index: "+u.quality+" samples: "+(a+o)+" drops: "+a);break}return u}},n=(0,Ur.default)(e).getInstance().getLogger(t),t}Gr.__dashjs_factory_name="SwitchHistoryRule";var qr=xr.default.getClassFactory(Gr),Yr=Object.defineProperty({default:qr},"__esModule",{value:!0}),jr=Xr(T),Hr=Xr(tr),Kr=Xr(S),Vr=Xr(x),zr=Xr(q),Wr=Xr(ee);function Xr(e){return e&&e.__esModule?e:{default:e}}function Qr(e){e=e||{};var t=this.context,n=e.dashMetrics,r=e.mediaPlayerModel,i=(0,Vr.default)(t).getInstance(),a=void 0,o=void 0,s=void 0;function u(e,t,n){var r=n.reduce((function(e,t,r){return t>n[e]?r:e}),0);if(0===r)return null;var i=Math.max(e,10+2*t.length),a=(n[r]-1)/(i/10-1);return{gp:a,Vp:10/a}}function l(e){var t={},n=e.getMediaInfo().bitrateList.map((function(e){return e.bandwidth})),i=function(e){return e.map((function(e){return Math.log(e)}))}(n);i=i.map((function(e){return e-i[0]+1}));var a=r.getStableBufferTime(),o=u(a,n,i);return o?(t.state=1,t.bitrates=n,t.utilities=i,t.stableBufferTime=a,t.Vp=o.Vp,t.gp=o.gp,t.lastQuality=0,d(t)):t.state=0,t}function d(e){e.placeholderBuffer=0,e.mostAdvancedSegmentStart=NaN,e.lastSegmentWasReplacement=!1,e.lastSegmentStart=NaN,e.lastSegmentDurationS=NaN,e.lastSegmentRequestTimeMs=NaN,e.lastSegmentFinishTimeMs=NaN}function f(e,t){var i=r.getStableBufferTime();if(e.stableBufferTime!==i){var a=u(i,e.bitrates,e.utilities);if(a.Vp!==e.Vp||a.gp!==e.gp){var o=n.getCurrentBufferLevel(t),s=o+e.placeholderBuffer;s-=10,s*=a.Vp/e.Vp,s+=10,e.stableBufferTime=i,e.Vp=a.Vp,e.gp=a.gp,e.placeholderBuffer=Math.max(0,s-o)}}}function c(e,t){return e.Vp*(e.utilities[t]+e.gp)}function g(e,t){for(var n=e.bitrates[t],r=e.utilities[t],i=0,a=t-1;a>=0;--a)if(e.utilities[a]<e.utilities[t]){var o=e.bitrates[a],s=e.utilities[a],u=e.Vp*(e.gp+(n*s-o*r)/(n-o));i=Math.max(i,u)}return i}function h(){for(var e in s)s.hasOwnProperty(e)&&2===s[e].state&&(s[e].placeholderBuffer=0)}function p(){for(var e in s)if(s.hasOwnProperty(e)){var t=s[e];0!==t.state&&(t.state=1,d(t))}}function _(e){if(e&&e.chunk&&e.chunk.mediaInfo){var t=s[e.chunk.mediaInfo.type];if(t&&0!==t.state){var n=e.chunk.start;isNaN(t.mostAdvancedSegmentStart)||n>t.mostAdvancedSegmentStart?(t.mostAdvancedSegmentStart=n,t.lastSegmentWasReplacement=!1):t.lastSegmentWasReplacement=!0,t.lastSegmentStart=n,t.lastSegmentDurationS=e.chunk.duration,t.lastQuality=e.chunk.quality,E(t,e.chunk.mediaInfo.type)}}}function m(e){if(e&&e.metric===jr.default.HTTP_REQUEST&&e.value&&e.value.type===pe.HTTPRequest.MEDIA_SEGMENT_TYPE&&e.value.trace&&e.value.trace.length){var t=s[e.mediaType];t&&0!==t.state&&(t.lastSegmentRequestTimeMs=e.value.trequest.getTime(),t.lastSegmentFinishTimeMs=e.value._tfinish.getTime(),E(t,e.mediaType))}}function E(e,t){if(!isNaN(e.lastSegmentStart)&&!isNaN(e.lastSegmentRequestTimeMs)&&!isNaN(e.placeholderBuffer)){if(e.placeholderBuffer*=.99,!isNaN(e.lastSegmentFinishTimeMs)){var r=n.getCurrentBufferLevel(t)+.001*(e.lastSegmentFinishTimeMs-e.lastSegmentRequestTimeMs),i=c(e,e.lastQuality),a=Math.max(0,i-r);e.placeholderBuffer=Math.min(a,e.placeholderBuffer)}e.lastSegmentWasReplacement&&!isNaN(e.lastSegmentDurationS)&&(e.placeholderBuffer+=e.lastSegmentDurationS),e.lastSegmentStart=NaN,e.lastSegmentRequestTimeMs=NaN}}function v(e){if(e){var t=s[e.mediaType];t&&0!==t.state&&(t.abrQuality=e.newQuality)}}function y(e){if(e){var t=s[e.mediaType];if(t&&0!==t.state){var r=n.getCurrentBufferLevel(e.mediaType),i=void 0;i=t.abrQuality>0?g(t,t.abrQuality):10;var a=Math.max(0,i-r);t.placeholderBuffer=Math.min(t.placeholderBuffer,a)}}}function T(){s={}}return a={getMaxIndex:function(e){var r=(0,Hr.default)(t).create();if(!(e&&e.hasOwnProperty("getMediaInfo")&&e.hasOwnProperty("getMediaType")&&e.hasOwnProperty("getScheduleController")&&e.hasOwnProperty("getStreamInfo")&&e.hasOwnProperty("getAbrController")&&e.hasOwnProperty("useBufferOccupancyABR")))return r;var i=e.getMediaInfo(),a=e.getMediaType(),u=e.getScheduleController(),h=e.getStreamInfo(),p=e.getAbrController(),_=p.getThroughputHistory(),m=h?h.id:null,E=h&&h.manifestInfo&&h.manifestInfo.isDynamic,v=e.useBufferOccupancyABR();if(r.reason=r.reason||{},!v)return r;u.setTimeToLoadDelay(0);var y=function(e){var t=e.getMediaType(),n=s[t];return n?0!==n.state&&f(n,t):(n=l(e),s[t]=n),n}(e);if(0===y.state)return r;var T=n.getCurrentBufferLevel(a),A=_.getAverageThroughput(a,E),S=_.getSafeAverageThroughput(a,E),I=_.getAverageLatency(a),R=void 0;if(r.reason.state=y.state,r.reason.throughput=A,r.reason.latency=I,isNaN(A))return r;switch(y.state){case 1:R=p.getQualityForBitrate(i,S,I),r.quality=R,r.reason.throughput=S,y.placeholderBuffer=Math.max(0,g(y,R)-T),y.lastQuality=R,!isNaN(y.lastSegmentDurationS)&&T>=y.lastSegmentDurationS&&(y.state=2);break;case 2:!function(e,t){var n=Date.now();if(isNaN(e.lastSegmentFinishTimeMs)){if(!isNaN(e.lastCallTimeMs)){var r=.001*(n-e.lastCallTimeMs);e.placeholderBuffer+=Math.max(0,r)}}else{var i=.001*(n-e.lastSegmentFinishTimeMs);e.placeholderBuffer+=Math.max(0,i)}e.lastCallTimeMs=n,e.lastSegmentStart=NaN,e.lastSegmentRequestTimeMs=NaN,e.lastSegmentFinishTimeMs=NaN,f(e,t)}(y,a),R=function(e,t){for(var n=e.bitrates.length,r=NaN,i=NaN,a=0;a<n;++a){var o=(e.Vp*(e.utilities[a]+e.gp)-t)/e.bitrates[a];(isNaN(i)||o>=i)&&(i=o,r=a)}return r}(y,T+y.placeholderBuffer);var b=p.getQualityForBitrate(i,S,I);R>y.lastQuality&&R>b&&(R=Math.max(b,y.lastQuality));var N=Math.max(0,T+y.placeholderBuffer-c(y,R));N<=y.placeholderBuffer?(y.placeholderBuffer-=N,N=0):(N-=y.placeholderBuffer,y.placeholderBuffer=0,R<p.getTopQualityIndexFor(a,m)?u.setTimeToLoadDelay(1e3*N):N=0),r.quality=R,r.reason.throughput=A,r.reason.latency=I,r.reason.bufferLevel=T,r.reason.placeholderBuffer=y.placeholderBuffer,r.reason.delay=N,y.lastQuality=R;break;default:o.debug("BOLA ABR rule invoked in bad state."),r.quality=p.getQualityForBitrate(i,S,I),r.reason.state=y.state,r.reason.throughput=S,r.reason.latency=I,y.state=1,d(y)}return r},reset:function(){T(),i.off(zr.default.BUFFER_EMPTY,h,a),i.off(zr.default.PLAYBACK_SEEKING,p,a),i.off(zr.default.MEDIA_FRAGMENT_LOADED,_,a),i.off(zr.default.METRIC_ADDED,m,a),i.off(zr.default.QUALITY_CHANGE_REQUESTED,v,a),i.off(zr.default.FRAGMENT_LOADING_ABANDONED,y,a)}},o=(0,Wr.default)(t).getInstance().getLogger(a),T(),i.on(zr.default.BUFFER_EMPTY,h,a),i.on(zr.default.PLAYBACK_SEEKING,p,a),i.on(zr.default.MEDIA_FRAGMENT_LOADED,_,a),i.on(zr.default.METRIC_ADDED,m,a),i.on(zr.default.QUALITY_CHANGE_REQUESTED,v,a),i.on(zr.default.FRAGMENT_LOADING_ABANDONED,y,a),a}Qr.__dashjs_factory_name="BolaRule";var Zr=Kr.default.getClassFactory(Qr),$r=Object.defineProperty({default:Zr},"__esModule",{value:!0}),Jr=oi(T),ei=oi(tr),ti=oi(S),ni=oi(x),ri=oi(q),ii=oi(ee),ai=oi(p);function oi(e){return e&&e.__esModule?e:{default:e}}function si(e){e=e||{};var t=this.context,n=e.dashMetrics,r=(0,ni.default)(t).getInstance(),i=void 0,a=void 0,o=void 0,s=void 0;function u(e){var t={},n=e.getMediaInfo(),r=n.bitrateList.map((function(e){return e.bandwidth/1e3}));return t.state=1,t.bitrates=r,t.lastQuality=0,function(e){if(!e||!e.type)return;o[e.type]={},o[e.type].w=[],o[e.type].prev_w=[],o[e.type].Q=0,o[e.type].segment_request_start_s=0,o[e.type].segment_download_finish_s=0,o[e.type].B_target=1.5}(n),l(t),t}function l(e){e.placeholderBuffer=0,e.mostAdvancedSegmentStart=NaN,e.lastSegmentWasReplacement=!1,e.lastSegmentStart=NaN,e.lastSegmentDurationS=NaN,e.lastSegmentRequestTimeMs=NaN,e.lastSegmentFinishTimeMs=NaN}function d(){for(var e in a)if(a.hasOwnProperty(e)){var t=a[e];0!==t.state&&(t.state=1,l(t))}}function f(e){if(e&&e.chunk&&e.chunk.mediaInfo){var t=a[e.chunk.mediaInfo.type],n=o[e.chunk.mediaInfo.type];if(t&&0!==t.state){var r=e.chunk.start;isNaN(t.mostAdvancedSegmentStart)||r>t.mostAdvancedSegmentStart?(t.mostAdvancedSegmentStart=r,t.lastSegmentWasReplacement=!1):t.lastSegmentWasReplacement=!0,t.lastSegmentStart=r,t.lastSegmentDurationS=e.chunk.duration,t.lastQuality=e.chunk.quality,g(t,n)}}}function c(e){if(e&&e.metric===Jr.default.HTTP_REQUEST&&e.value&&e.value.type===pe.HTTPRequest.MEDIA_SEGMENT_TYPE&&e.value.trace&&e.value.trace.length){var t=a[e.mediaType],n=o[e.mediaType];t&&0!==t.state&&(t.lastSegmentRequestTimeMs=e.value.trequest.getTime(),t.lastSegmentFinishTimeMs=e.value._tfinish.getTime(),g(t,n))}}function g(e,t){isNaN(e.lastSegmentStart)||isNaN(e.lastSegmentRequestTimeMs)||(t.segment_request_start_s=.001*e.lastSegmentRequestTimeMs,t.segment_download_finish_s=.001*e.lastSegmentFinishTimeMs,e.lastSegmentStart=NaN,e.lastSegmentRequestTimeMs=NaN)}function h(e){if(e&&e.mediaType){var t=a[e.mediaType];t&&0!==t.state&&(t.abrQuality=e.newQuality)}}function p(e,t){if(e.length!==t.length)return-1;for(var n=0,r=0;r<e.length;r++)n+=e[r]*t[r];return n}function _(){a={},o={}}return i={getMaxIndex:function(e){var r=(0,ei.default)(t).create(),i=Math.pow(4,.99),d=Math.max(Math.pow(4,1),i*Math.sqrt(4)),f=e.getMediaInfo(),c=e.getMediaType(),g=f.bitrateList.map((function(e){return e.bandwidth})),h=g.length,_=e.getScheduleController(),m=e.getStreamInfo(),E=e.getAbrController(),v=E.getThroughputHistory(),y=m&&m.manifestInfo&&m.manifestInfo.isDynamic,T=e.useL2AABR(),A=n.getCurrentBufferLevel(c,!0),S=v.getSafeAverageThroughput(c,y),I=v.getAverageThroughput(c,y),R=v.getAverageLatency(c),b=void 0,N=e.getVideoModel().getPlaybackRate();if(!(e&&e.hasOwnProperty("getMediaInfo")&&e.hasOwnProperty("getMediaType")&&e.hasOwnProperty("getScheduleController")&&e.hasOwnProperty("getStreamInfo")&&e.hasOwnProperty("getAbrController")&&e.hasOwnProperty("useL2AABR")))return r;if(r.reason=r.reason||{},!T||c===ai.default.AUDIO)return r;_.setTimeToLoadDelay(0);var M=function(e){var t=e.getMediaType(),n=a[t];return n||(n=u(e),a[t]=n),n}(e);if(0===M.state)return r;var D=o[c];if(!D)return r;if(r.reason.state=M.state,r.reason.throughput=I,r.reason.latency=R,isNaN(I))return r;switch(M.state){case 1:if(b=E.getQualityForBitrate(f,S,R),r.quality=b,r.reason.throughput=S,M.lastQuality=b,!isNaN(M.lastSegmentDurationS)&&A>=D.B_target){M.state=2,D.Q=i;for(var C=0;C<h;++C)C===M.lastQuality?D.prev_w[C]=1:D.prev_w[C]=0}break;case 2:var O=[],w=n.getCurrentHttpRequest(c).trace.reduce((function(e,t){return e+t.d}),0),P=n.getCurrentHttpRequest(c).trace.reduce((function(e,t){return e+t.b[0]}),0),L=Math.round(8*P/w);L<1&&(L=1);for(var F=M.lastSegmentDurationS,x=1,U=0;U<h;++U)g[U]=g[U]/1e3,N*g[U]>L&&(x=-1),D.w[U]=D.prev_w[U]+x*(F/(2*d))*((D.Q+i)*(N*g[U]/L));D.w=function(e){for(var t=e.length,n=!1,r=[],i=0;i<t;++i)r[i]=e[i];for(var a=e.sort((function(e,t){return t-e})),o=0,s=0,u=[],l=0;l<t-1;++l)if((s=((o+=a[l])-1)/(l+1))>=a[l+1]){n=!0;break}n||(s=(o+a[t-1]-1)/t);for(var d=0;d<t;++d)u[d]=Math.max(r[d]-s,0);return u}(D.w);for(var B=0;B<h;++B)O[B]=D.w[B]-D.prev_w[B],D.prev_w[B]=D.w[B];D.Q=Math.max(0,D.Q-F+F*N*((p(g,D.prev_w)+p(g,O))/L));for(var k=[],G=0;G<h;++G)k[G]=Math.abs(g[G]-p(D.w,g));(b=k.indexOf(Math.min.apply(Math,k)))>M.lastQuality&&g[M.lastQuality+1]<=L&&(b=M.lastQuality+1),g[b]>=L&&(D.Q=2*Math.max(i,D.Q)),r.quality=b,r.reason.throughput=I,r.reason.latency=R,r.reason.bufferLevel=A,M.lastQuality=r.quality;break;default:s.debug("L2A ABR rule invoked in bad state."),r.quality=E.getQualityForBitrate(f,S,R),r.reason.state=M.state,r.reason.throughput=S,r.reason.latency=R,M.state=1,l(M)}return r},reset:function(){_(),r.off(ri.default.PLAYBACK_SEEKING,d,i),r.off(ri.default.MEDIA_FRAGMENT_LOADED,f,i),r.off(ri.default.METRIC_ADDED,c,i),r.off(ri.default.QUALITY_CHANGE_REQUESTED,h,i)}},s=(0,ii.default)(t).getInstance().getLogger(i),_(),r.on(ri.default.PLAYBACK_SEEKING,d,i),r.on(ri.default.MEDIA_FRAGMENT_LOADED,f,i),r.on(ri.default.METRIC_ADDED,c,i),r.on(ri.default.QUALITY_CHANGE_REQUESTED,h,i),i}si.__dashjs_factory_name="L2ARule";var ui=ti.default.getClassFactory(si),li=Object.defineProperty({default:ui},"__esModule",{value:!0}),di=ci(S),fi=ci(ee);function ci(e){return e&&e.__esModule?e:{default:e}}var gi="manual_weight_selection",hi="random_weight_selection",pi="dynamic_weight_selection";function _i(){var e=this.context,t=void 0,n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,u=void 0,l=void 0;function d(){r=null,i=1,a=100,o=0,s=null,u=null,l=pi}function f(){var e=0;if(r)for(var t=0;t<r.length;t++){var n=r[t];n.state.throughput>e&&(e=n.state.throughput)}return e}function c(e,t,n){var r=e.map((function(e,r){return n[r]*Math.pow(e-t[r],2)})).reduce((function(e,t){return e+t}));return(r<0?-1:1)*Math.sqrt(Math.abs(r))}function g(e,t){return c([e.state.throughput,e.state.latency,e.state.rebuffer,e.state.switch],[t.state.throughput,t.state.latency,t.state.rebuffer,t.state.switch],[1,1,1,1])}function h(e,t,n){for(var r=0;r<t.length;r++){var i=t[r],a=g(i,e);p(i,n,Math.exp(-1*Math.pow(a,2)/(2*Math.pow(.1,2))))}}function p(e,t,n){var r=e.state,i=[.01,.01,.01,.01];r.throughput=r.throughput+(t[0]-r.throughput)*i[0]*n,r.latency=r.latency+(t[1]-r.latency)*i[1]*n,r.rebuffer=r.rebuffer+(t[2]-r.rebuffer)*i[2]*n,r.switch=r.switch+(t[3]-r.switch)*i[3]*n}function _(e,t,n,r,i,a,o){s||(s=u[u.length-1]);var l=e.findWeightVector(t,n,r,i,a,o);null!==l&&-1!==l&&(s=l)}return t={getNextQuality:function(e,t,d,g,p,m,E){var v=d,y=g,T=t,A=function(e){if(!r){r=[];var t=e.bitrateList,n=[];o=t[0].bandwidth,t.forEach((function(e){n.push(e.bandwidth),e.bandwidth<o&&(o=e.bandwidth)})),l=n.map((function(e){return Math.pow(e,2)})).reduce((function(e,t){return e+t})),i=Math.sqrt(l);for(var a=0;a<t.length;a++){var s={qualityIndex:a,bitrate:t[a].bandwidth,state:{throughput:t[a].bandwidth/i,latency:0,rebuffer:0,switch:0}};r.push(s)}u=function(e){var t=[],n=function(e){for(var t=[],n=0;n<e;n++){var r=[Math.random()*f(),Math.random(),Math.random(),Math.random()];t.push(r)}return t}(Math.pow(e.length,2));t.push(n[0]);for(var r=[1,1,1,1],i=1;i<e.length;i++){for(var a=null,o=null,s=0;s<n.length;s++){for(var u=n[s],l=null,d=0;d<t.length;d++){var g=c(u,t[d],r);(null===l||g<l)&&(l=g)}(null===o||l>o)&&(a=u,o=l)}t.push(a)}for(var h=null,p=null,_=0;_<t.length;_++){for(var m=0,E=0;E<t.length;E++)_!==E&&(m+=c(t[_],t[E],r));(null===h||m>h)&&(h=m,p=_)}var v=[];v.push(t[p]),t.splice(p,1);for(;t.length>0;){for(var y=null,T=null,A=0;A<t.length;A++){var S=c(v[0],t[A],r);(null===y||S<y)&&(y=S,T=A)}v.push(t[T]),t.splice(T,1)}return v}(r)}var l;return r}(e),S=t/i;S>1&&(S=f()),d/=a,n.debug("getNextQuality called throughput:"+S+" latency:"+d+" bufferSize:"+g+" currentQualityIndex:"+m+" playbackRate:"+p);var I=A[m],R=I.bitrate*E.getSegmentDuration()/T,b=Math.max(0,R-y);if(y-R<E.getMinBuffer())return n.debug("Buffer is low for bitrate= "+I.bitrate+" downloadTime="+R+" currentBuffer="+y+" rebuffer="+b),function(e,t){var n=0,i=e;if(r)for(var a=0;a<r.length;a++){var o=r[a];o.bitrate<e.bitrate&&o.bitrate>n&&t>o.bitrate&&(n=o.bitrate,i=o)}return i}(I,T).qualityIndex;switch(l){case gi:s=[.4,.4,.4,.4];break;case hi:!function(e){s=function(e,t){for(var n=[],r=Math.sqrt(2/e),i=0;i<t;i++)n.push(Math.random()*r);return s=n}(e.length,4)}(A);break;case pi:_(E,A,v,y,b,T,p);break;default:_(E,A,v,y,b,T,p)}for(var N=null,M=null,D=null,C=0;C<A.length;C++){var O=A[C],w=O.state,P=[w.throughput,w.latency,w.rebuffer,w.switch],L=s.slice(),F=E.getNextBufferWithBitrate(O.bitrate,y,T),x=F<E.getMinBuffer();x&&n.debug("Buffer is low for bitrate="+O.bitrate+" downloadTime="+R+" currentBuffer="+y+" nextBuffer="+F),(O.bitrate>t-1e4||x)&&O.bitrate!==o&&(L[0]=100);var U=c(P,[S,0,0,0],L);(null===N||U<N)&&(N=U,M=O.qualityIndex,D=O)}var B=Math.abs(I.bitrate-D.bitrate)/i;return h(I,A,[S,d,b,B]),h(D,A,[S,0,0,B]),M},reset:function(){d()}},n=(0,fi.default)(e).getInstance().getLogger(t),d(),t}_i.__dashjs_factory_name="LearningAbrController";var mi=di.default.getClassFactory(_i),Ei=Object.defineProperty({default:mi},"__esModule",{value:!0});var vi=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.type=null,this.lastBitrate=null,this.weights={},this.weights.bitrateReward=null,this.weights.bitrateSwitchPenalty=null,this.weights.rebufferPenalty=null,this.weights.latencyPenalty=null,this.weights.playbackSpeedPenalty=null,this.bitrateWSum=0,this.bitrateSwitchWSum=0,this.rebufferWSum=0,this.latencyWSum=0,this.playbackSpeedWSum=0,this.totalQoe=0},yi=Object.defineProperty({default:vi},"__esModule",{value:!0}),Ti=Si(S),Ai=Si(yi);function Si(e){return e&&e.__esModule?e:{default:e}}function Ii(){var e,t=void 0,n=void 0,r=void 0,i=void 0;function a(){t=null,n=null,r=null,i=null}function o(e,t,n,r){var i=new Ai.default;return i.type=e,i.weights.bitrateReward=t||1,i.weights.bitrateSwitchPenalty=1,i.weights.rebufferPenalty=n||1e3,i.weights.latencyPenalty=[],i.weights.latencyPenalty.push({threshold:1.1,penalty:.05*r}),i.weights.latencyPenalty.push({threshold:1e8,penalty:.1*n}),i.weights.playbackSpeedPenalty=r||200,i}function s(e,t,n,r,i){i.bitrateWSum+=i.weights.bitrateReward*e,i.lastBitrate&&(i.bitrateSwitchWSum+=i.weights.bitrateSwitchPenalty*Math.abs(e-i.lastBitrate)),i.lastBitrate=e,i.rebufferWSum+=i.weights.rebufferPenalty*t;for(var a=0;a<i.weights.latencyPenalty.length;a++){var o=i.weights.latencyPenalty[a];if(n<=o.threshold){i.latencyWSum+=o.penalty*n;break}}i.playbackSpeedWSum+=i.weights.playbackSpeedPenalty*Math.abs(1-r),i.totalQoe=i.bitrateWSum-i.bitrateSwitchWSum-i.rebufferWSum-i.latencyWSum-i.playbackSpeedWSum}return e={setupPerSegmentQoe:function(e,a,s){t=o("segment",e,a,s),n=e,r=a,i=s},logSegmentMetrics:function(e,n,r,i){t&&s(e,n,r,i,t)},getPerSegmentQoe:function(){return t},calculateSingleUseQoe:function(e,t,a,u){var l=null;return n&&r&&i&&(l=o("segment",n,r,i)),l?(s(e,t,a,u,l),l.totalQoe):0},reset:function(){a()}},a(),e}Ii.__dashjs_factory_name="LoLpQoeEvaluator";var Ri=Ti.default.getClassFactory(Ii),bi=Object.defineProperty({default:Ri},"__esModule",{value:!0}),Ni=function(e){return e&&e.__esModule?e:{default:e}}(S);function Mi(e){var t,n,r,i=e.targetLatency,a=e.bufferMin,o=e.segmentDuration,s=e.qoeEvaluator,u=void 0,l=void 0;function d(){return o}function f(e,t){var n=d();return t>n?e-n:e+n-t}return t={getMinBuffer:function(){return a},getSegmentDuration:d,getNextBufferWithBitrate:function(e,t,n){return f(t,e*o/n)},getNextBuffer:f,findWeightVector:function(e,t,n,r,d,c){var g=null,h=null,p=null,_=Math.abs(t-l);return e.forEach((function(e){u.forEach((function(r){r[0];var u=r[1],l=r[2],m=(r[3],e.bitrate*o/d),E=f(n,m),v=(0===l?10:1/l)*Math.max(1e-5,m-E),y=(0===u?10:1/u)*e.state.latency,T=s.calculateSingleUseQoe(e.bitrate,v,y,c);(null===g||T>g)&&function(e,t,n){if(e>i+n)return!1;return t>=a}(t,E,_)&&(g=T,h=r,p=e.bitrate)}))})),null===h&&null===p&&(h=-1),l=t,h}},n=[.2,.4,.6,.8,1],r=4,u=function e(t,r,i){if(i===r)return t;for(var a=t.length,o=0;o<a;o++)for(var s=t.shift(),u=0;u<n.length;u++)t.push(s.concat(n[u]));return e(t,r,i+1)}(n.map((function(e){return[e]})),r,1),l=0,t}Mi.__dashjs_factory_name="LoLpWeightSelector";var Di=Ni.default.getClassFactory(Mi),Ci=Object.defineProperty({default:Di},"__esModule",{value:!0}),Oi=ki(ee),wi=ki(S),Pi=ki(Ei),Li=ki(bi),Fi=ki(tr),xi=ki(T),Ui=ki(Ci),Bi=ki(p);function ki(e){return e&&e.__esModule?e:{default:e}}function Gi(e){var t=(e=e||{}).dashMetrics,n=this.context,r=void 0,i=void 0,a=void 0,o=void 0;return i={getMaxIndex:function(e){try{var i=(0,Fi.default)(n).create(),s=e.getMediaInfo().type,u=e.getAbrController(),l=e.getStreamInfo(),d=u.getQualityFor(s,l),f=e.getMediaInfo(),c=t.getCurrentBufferState(s),g=e.getScheduleController(),h=t.getCurrentBufferLevel(s,!0),p=l&&l.manifestInfo?l.manifestInfo.isDynamic:null,_=g.getPlaybackController(),m=_.getCurrentLiveLatency();if(!e.useLoLPABR()||s===Bi.default.AUDIO)return i;m||(m=0);var E=_.getPlaybackRate(),v=u.getThroughputHistory().getSafeAverageThroughput(s,p);if(r.debug("Throughput "+Math.round(v)+" kbps"),isNaN(v)||!c)return i;if(u.getAbandonmentStateFor(s)===xi.default.ABANDON_LOAD)return i;for(var y=f.bitrateList,T=e.getRepresentationInfo().fragmentDuration,A=y[0].bandwidth/1e3,S=y[y.length-1].bandwidth/1e3,I=0;I<y.length;I++){var R=y[I].bandwidth/1e3;R>S?S=R:R<A&&(A=R)}var b=y[d].bandwidth/1e3,N=t.getCurrentHttpRequest(s,!0),M=(N.tresponse.getTime()-N.trequest.getTime())/1e3,D=M>T?M-T:0;o.setupPerSegmentQoe(T,S,A),o.logSegmentMetrics(b,D,m,E);var C=(0,Ui.default)(n).create({targetLatency:1.5,bufferMin:.3,segmentDuration:T,qoeEvaluator:o});return i.quality=a.getNextQuality(f,1e3*v,m,h,E,d,C),i.reason={throughput:v,latency:m},i.priority=Fi.default.PRIORITY.STRONG,g.setTimeToLoadDelay(0),i.quality!==d&&console.log("[TgcLearningRule]["+s+"] requesting switch to index: ",i.quality,"Average throughput",Math.round(v),"kbps"),i}catch(e){throw e}},reset:function(){a.reset(),o.reset()}},r=(0,Oi.default)(n).getInstance().getLogger(i),a=(0,Pi.default)(n).create(),o=(0,Li.default)(n).create(),i}Gi.__dashjs_factory_name="LoLPRule";var qi=wi.default.getClassFactory(Gi),Yi=Object.defineProperty({default:qi},"__esModule",{value:!0}),ji=ea(dr),Hi=ea(Tr),Ki=ea(Mr),Vi=ea(Fr),zi=ea(Yr),Wi=ea($r),Xi=ea(li),Qi=ea(Yi),Zi=ea(S),$i=ea(tr),Ji=ea(p);function ea(e){return e&&e.__esModule?e:{default:e}}function ta(e){e=e||{};var t=this.context,n=e.mediaPlayerModel,r=e.dashMetrics,i=e.settings,a=void 0,o=void 0;function s(e){return e.filter((function(e){return e.quality>$i.default.NO_CHANGE}))}function u(e){var n,r={},i=null,a=void 0,o=void 0,s=void 0,u=void 0;if(0!==e.length){for(r[$i.default.PRIORITY.STRONG]={quality:$i.default.NO_CHANGE,reason:null},r[$i.default.PRIORITY.WEAK]={quality:$i.default.NO_CHANGE,reason:null},r[$i.default.PRIORITY.DEFAULT]={quality:$i.default.NO_CHANGE,reason:null},a=0,n=e.length;a<n;a+=1)(o=e[a]).quality!==$i.default.NO_CHANGE&&(r[o.priority].quality===$i.default.NO_CHANGE||r[o.priority].quality>o.quality)&&(r[o.priority].quality=o.quality,r[o.priority].reason=o.reason||null);return r[$i.default.PRIORITY.WEAK].quality!==$i.default.NO_CHANGE&&(i=r[$i.default.PRIORITY.WEAK]),r[$i.default.PRIORITY.DEFAULT].quality!==$i.default.NO_CHANGE&&(i=r[$i.default.PRIORITY.DEFAULT]),r[$i.default.PRIORITY.STRONG].quality!==$i.default.NO_CHANGE&&(i=r[$i.default.PRIORITY.STRONG]),i&&(s=i.quality,u=i.reason),(0,$i.default)(t).create(s,u)}}return{initialize:function(){a=[],o=[],i.get().streaming.abr.useDefaultABRRules&&(i.get().streaming.abr.ABRStrategy===Ji.default.ABR_STRATEGY_L2A?a.push((0,Xi.default)(t).create({dashMetrics:r,mediaPlayerModel:n,settings:i})):i.get().streaming.abr.ABRStrategy===Ji.default.ABR_STRATEGY_LoLP?a.push((0,Qi.default)(t).create({dashMetrics:r})):(a.push((0,Wi.default)(t).create({dashMetrics:r,mediaPlayerModel:n,settings:i})),a.push((0,ji.default)(t).create({dashMetrics:r})),a.push((0,Hi.default)(t).create({dashMetrics:r})),a.push((0,zi.default)(t).create()),a.push((0,Vi.default)(t).create()),o.push((0,Ki.default)(t).create({dashMetrics:r,mediaPlayerModel:n,settings:i})))),n.getABRCustomRules().forEach((function(e){"qualitySwitchRules"===e.type&&a.push(e.rule(t).create()),"abandonFragmentRules"===e.type&&o.push(e.rule(t).create())}))},reset:function(){[a,o].forEach((function(e){e&&e.length&&e.forEach((function(e){return e.reset&&e.reset()}))})),a=[],o=[]},getMaxQuality:function(e){return u(s(a.map((function(t){return t.getMaxIndex(e)}))))||(0,$i.default)(t).create()},getMinSwitchRequest:u,shouldAbandonFragment:function(e){return u(s(o.map((function(t){return t.shouldAbandon(e)}))))||(0,$i.default)(t).create()},getQualitySwitchRules:function(){return a}}}ta.__dashjs_factory_name="ABRRulesCollection";var na=Zi.default.getClassFactory(ta);na.QUALITY_SWITCH_RULES="qualitySwitchRules",na.ABANDON_FRAGMENT_RULES="abandonFragmentRules",Zi.default.updateSingletonFactory(ta.__dashjs_factory_name,na);var ra=na,ia=Object.defineProperty({default:ra},"__esModule",{value:!0});var aa=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.mediaType=null,this.bitrate=null,this.width=null,this.height=null,this.scanType=null,this.qualityIndex=NaN},oa=Object.defineProperty({default:aa},"__esModule",{value:!0}),sa=function(e){return e&&e.__esModule?e:{default:e}}(S);function ua(e){var t=(e=e||{}).abrController,n=e.switchHistory,r=e.droppedFramesHistory,i=e.currentRequest,a=e.useBufferOccupancyABR,o=e.useL2AABR,s=e.useLoLPABR,u=e.streamProcessor?e.streamProcessor.getScheduleController():null,l=e.streamProcessor?e.streamProcessor.getRepresentationInfo():null,d=e.videoModel?e.videoModel:null;function f(){return l?l.mediaInfo:null}return{getMediaType:function(){var e=f();return e?e.type:null},getMediaInfo:f,getDroppedFramesHistory:function(){return r},getCurrentRequest:function(){return i},getSwitchHistory:function(){return n},getStreamInfo:function(){var e=f();return e?e.streamInfo:null},getScheduleController:function(){return u},getAbrController:function(){return t},getRepresentationInfo:function(){return l},useBufferOccupancyABR:function(){return a},useL2AABR:function(){return o},useLoLPABR:function(){return s},getVideoModel:function(){return d}}}ua.__dashjs_factory_name="RulesContext";var la=sa.default.getClassFactory(ua),da=Object.defineProperty({default:la},"__esModule",{value:!0}),fa=ga(S),ca=ga(tr);function ga(e){return e&&e.__esModule?e:{default:e}}function ha(){var e=[],t=[];return{push:function(n){n.newValue===ca.default.NO_CHANGE&&(n.newValue=n.oldValue),e[n.oldValue]||(e[n.oldValue]={noDrops:0,drops:0,dropSize:0});var r=n.newValue-n.oldValue,i=r<0?1:0,a=i?-r:0,o=i?0:1;if(e[n.oldValue].drops+=i,e[n.oldValue].dropSize+=a,e[n.oldValue].noDrops+=o,t.push({idx:n.oldValue,noDrop:o,drop:i,dropSize:a}),t.length>8){var s=t.shift();e[s.idx].drops-=s.drop,e[s.idx].dropSize-=s.dropSize,e[s.idx].noDrops-=s.noDrop}},getSwitchRequests:function(){return e},reset:function(){e=[],t=[]}}}ha.__dashjs_factory_name="SwitchRequestHistory";var pa=fa.default.getClassFactory(ha),_a=Object.defineProperty({default:pa},"__esModule",{value:!0}),ma=function(e){return e&&e.__esModule?e:{default:e}}(S);function Ea(){var e=[],t=0,n=0;return{push:function(r,i){var a=i&&i.droppedVideoFrames?i.droppedVideoFrames:0,o=i&&i.totalVideoFrames?i.totalVideoFrames:0,s=a-t;t=a;var u=o-n;n=o,isNaN(r)||(e[r]?(e[r].droppedVideoFrames+=s,e[r].totalVideoFrames+=u):e[r]={droppedVideoFrames:s,totalVideoFrames:u})},getFrameHistory:function(){return e},reset:function(r){e=[],t=r.droppedVideoFrames,n=r.totalVideoFrames}}}Ea.__dashjs_factory_name="DroppedFramesHistory";var va=ma.default.getClassFactory(Ea),ya=Object.defineProperty({default:va},"__esModule",{value:!0}),Ta=Sa(p),Aa=Sa(S);function Sa(e){return e&&e.__esModule?e:{default:e}}function Ia(e){var t=(e=e||{}).settings,n=void 0,r=void 0,i=void 0,a=void 0,o=void 0;function s(e,t,n,r){var i=Math.pow(.5,n/r.fast);e.fastEstimate=(1-i)*t+i*e.fastEstimate;var a=Math.pow(.5,n/r.slow);e.slowEstimate=(1-a)*t+a*e.slowEstimate,e.totalWeight+=n}function u(e,s,u){return t.get().streaming.abr.movingAverageMethod!==Ta.default.MOVING_AVERAGE_SLIDING_WINDOW?function(e,t){var n=e?o.throughputHalfLife:o.latencyHalfLife,r=e?i[t]:a[t];if(!r||r.totalWeight<=0)return NaN;var s=r.fastEstimate/(1-Math.pow(.5,r.totalWeight/n.fast)),u=r.slowEstimate/(1-Math.pow(.5,r.totalWeight/n.slow));return e?Math.min(s,u):Math.max(s,u)}(e,s):function(e,t,i){var a=function(e,t,i){var a=void 0,o=void 0;if(e?(a=n[t],o=i?3:4):(a=r[t],o=4),a){if(o>=a.length)o=a.length;else if(e)for(var s=1;s<o;++s){var u=a[a.length-s]/a[a.length-s-1];if((u>=1.3||u<=1/1.3)&&(o+=1)===a.length)break}}else o=0;return o}(e,t,i),o=(e?n:r)[t];if(0===a||!o||0===o.length)return NaN;return(o=o.slice(-a)).reduce((function(e,t){return e+t}))/o.length}(e,s,u)}function l(e,t){return u(!0,e,t)}function d(e){n[e]=n[e]||[],r[e]=r[e]||[],i[e]=i[e]||{fastEstimate:0,slowEstimate:0,totalWeight:0},a[e]=a[e]||{fastEstimate:0,slowEstimate:0,totalWeight:0}}function f(){n={},r={},i={},a={}}var c={push:function(e,u,l){if(u.trace&&u.trace.length){var f=u.tresponse.getTime()-u.trequest.getTime()||1,c=u._tfinish.getTime()-u.tresponse.getTime()||1,g=u.trace.reduce((function(e,t){return e+t.b[0]}),0),h=void 0;h=t.get().streaming.lowLatencyEnabled?u.trace.reduce((function(e,t){return e+t.d}),0):l?c:f+c;var p=Math.round(8*g/h);if(d(e),function(e,n,r){return e===Ta.default.VIDEO?r<t.get().streaming.cacheLoadThresholds[Ta.default.VIDEO]:e===Ta.default.AUDIO?r<t.get().streaming.cacheLoadThresholds[Ta.default.AUDIO]:void 0}(e,0,c)){if(n[e].length>0&&!n[e].hasCachedEntries)return;n[e].hasCachedEntries=!0}else n[e]&&n[e].hasCachedEntries&&function(e){delete n[e],delete r[e],delete i[e],delete a[e],d(e)}(e);n[e].push(p),n[e].length>20&&n[e].shift(),r[e].push(f),r[e].length>20&&r[e].shift(),s(i[e],p,.001*c,o.throughputHalfLife),s(a[e],f,1,o.latencyHalfLife)}},getAverageThroughput:l,getSafeAverageThroughput:function(e,n){var r=l(e,n);return isNaN(r)||(r*=t.get().streaming.abr.bandwidthSafetyFactor),r},getAverageLatency:function(e){return u(!1,e)},reset:f};return o={throughputHalfLife:{fast:3,slow:8},latencyHalfLife:{fast:1,slow:2}},f(),c}Ia.__dashjs_factory_name="ThroughputHistory";var Ra=Aa.default.getClassFactory(Ia),ba=Object.defineProperty({default:Ra},"__esModule",{value:!0}),Na=qa(ia),Ma=qa(p),Da=qa(T),Ca=qa(oa),Oa=qa(be),wa=qa(x),Pa=qa(q),La=qa(S),Fa=qa(da),xa=qa(tr),Ua=qa(_a),Ba=qa(ya),ka=qa(ba),Ga=qa(ee);function qa(e){return e&&e.__esModule?e:{default:e}}function Ya(){var e=this.context,t=(0,Ga.default)(e).getInstance(),n=(0,wa.default)(e).getInstance(),r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,u=void 0,l=void 0,d=void 0,f=void 0,c=void 0,g=void 0,h=void 0,p=void 0,_=void 0,m=void 0,E=void 0,v=void 0,y=void 0,T=void 0,A=void 0,S=void 0,I=void 0,R=void 0,b=void 0,N=void 0;function M(){(a=(0,Na.default)(e).create({dashMetrics:b,mediaPlayerModel:m,settings:N})).initialize()}function D(){s={},u={},d={},l={},y={},S={},I={},R={},void 0===c&&(c=!1),v=void 0,T=void 0,A=void 0,clearTimeout(f),f=null}function C(e){e.mediaType===Ma.default.VIDEO&&(void 0!==v&&T.push(v,_.getPlaybackQuality()),v=e.newQuality)}function O(e){e.metric!==Da.default.HTTP_REQUEST||!e.value||e.value.type!==pe.HTTPRequest.MEDIA_SEGMENT_TYPE||e.mediaType!==Ma.default.AUDIO&&e.mediaType!==Ma.default.VIDEO||A.push(e.mediaType,e.value,N.get().streaming.abr.useDeadTimeLatency),e.metric!==Da.default.BUFFER_LEVEL||e.mediaType!==Ma.default.AUDIO&&e.mediaType!==Ma.default.VIDEO||function(e,t){var n=N.get().streaming.abr.ABRStrategy;if(n===Ma.default.ABR_STRATEGY_L2A)return S[e]=!1,R[e]=!1,void(I[e]=!0);if(n===Ma.default.ABR_STRATEGY_LoLP)return S[e]=!1,R[e]=!0,void(I[e]=!1);if(n===Ma.default.ABR_STRATEGY_BOLA)return S[e]=!0,R[e]=!1,void(I[e]=!1);if(n===Ma.default.ABR_STRATEGY_THROUGHPUT)return S[e]=!1,R[e]=!1,void(I[e]=!1);!function(e,t){var n=m.getStableBufferTime(),r=n,a=.5*n,o=S[e],s=t>(o?a:r);S[e]=s,s!==o&&(s?i.info("["+e+"] switching from throughput to buffer occupancy ABR rule (buffer: "+t.toFixed(3)+")."):i.info("["+e+"] switching from buffer occupancy to throughput ABR rule (buffer: "+t.toFixed(3)+")."))}(e,t)}(e.mediaType,.001*e.value.level)}function w(e,t){return s[t]=s[t]||{},s[t].hasOwnProperty(e)||(s[t][e]=0),function(e,t){if(t!==Ma.default.VIDEO||!N.get().streaming.abr.limitBitrateByPortal||!l[t])return e;c||H();var n=p.getAdaptationForType(0,t).Representation,r=e;if(g>0&&h>0){for(;r>0&&n[r]&&g<n[r].width&&g-n[r-1].width<n[r].width-g;)r-=1;for(;r<n.length-1&&n[r].width===n[r+1].width;)r+=1}return r}(function(e,t,n){var r=N.get().streaming.abr.maxRepresentationRatio[t];if(isNaN(r)||r>=1||r<0)return e;return Math.min(e,Math.round(n*r))}(function(e,t){var n=e;if(!l[t])return n;var r=L(t);void 0!==r&&(n=Math.max(e,r));var i=P(t);void 0!==i&&(n=Math.min(n,i));return n}(s[t][e],e),e,s[t][e]),e)}function P(e){var t=function(e){return N.get().streaming.abr.maxBitrate[e]}(e);return t>-1?B(l[e].getMediaInfo(),t):void 0}function L(e){var t=function(e){return N.get().streaming.abr.minBitrate[e]}(e);if(t>-1){var n=l[e].getMediaInfo(),r=k(n),i=B(n,t);return r[i]&&i<r.length-1&&r[i].bitrate<1e3*t&&i++,i}}function F(e,t,n,r){var i=t.id,a=j(e);(0,rt.checkInteger)(n);var o=w(e,i);n!==a&&n>=0&&n<=o&&x(e,a,n,o,r)}function x(e,t,r,a,o){if(e&&l[e]){var s=l[e].getStreamInfo(),d=s?s.id:null;if(N.get().debug.logLevel===Ga.default.LOG_LEVEL_DEBUG){var f=b.getCurrentBufferLevel(e);i.info("["+e+"] switch from "+t+" to "+r+"/"+a+" (buffer: "+f+") "+(o?JSON.stringify(o):"."))}!function(e,t,n){u[t]=u[t]||{},u[t][e]=n}(e,d,r),n.trigger(Pa.default.QUALITY_CHANGE_REQUESTED,{oldQuality:t,newQuality:r,reason:o},{streamId:s.id,mediaType:e});var c=A.getAverageThroughput(e);isNaN(c)||E.setSavedBitrateSettings(e,c)}}function U(e,t){d[e].state=t}function B(e,t,n){var r=e&&e.type?l[e.type].getRepresentationInfo():null;if(N.get().streaming.abr.useDeadTimeLatency&&n&&r&&r.fragmentDuration){n/=1e3;var i=r.fragmentDuration;if(n>i)return 0;t*=1-n/i}for(var a=k(e),o=a.length-1;o>=0;o--){if(1e3*t>=a[o].bitrate)return o}return 0}function k(e){var t=[];if(!e||!e.bitrateList)return t;for(var n=e.bitrateList,r=e.type,i=void 0,a=0,o=n.length;a<o;a++)(i=new Ca.default).mediaType=r,i.qualityIndex=a,i.bitrate=n[a].bandwidth,i.width=n[a].width,i.height=n[a].height,i.scanType=n[a].scanType,t.push(i);return t}function G(e){return S[e]}function q(e){return I[e]}function Y(e){return R[e]}function j(e){if(e&&l[e]){var t=l[e].getStreamInfo(),n=t?t.id:null;if(n)return u[n]=u[n]||{},u[n].hasOwnProperty(e)||(u[n][e]=0),u[n][e]}return 0}function H(){if(_){var e=N.get().streaming.abr.usePixelRatioInLimitBitrateByPortal&&window.hasOwnProperty("devicePixelRatio")?window.devicePixelRatio:1;g=_.getClientWidth()*e,h=_.getClientHeight()*e}}function K(t){var n=t.request.mediaType;if(N.get().streaming.abr.autoSwitchBitrate[n]){var i=l[n];if(!i)return;var s=(0,Fa.default)(e).create({abrController:r,streamProcessor:i,currentRequest:t.request,useBufferOccupancyABR:G(n),useL2AABR:q(n),useLoLPABR:Y(n),videoModel:_}),u=a.shouldAbandonFragment(s);if(u.quality>xa.default.NO_CHANGE){var d=i.getFragmentModel();d.getRequests({state:Oa.default.FRAGMENT_MODEL_LOADING,index:t.request.index})[0]&&(d.abortRequests(),U(n,Da.default.ABANDON_LOAD),y[n].reset(),y[n].push({oldValue:j(n),newValue:u.quality,confidence:1,reason:u.reason}),F(n,o.getActiveStreamInfo(),u.quality,u.reason),clearTimeout(f),f=setTimeout((function(){U(n,Da.default.ALLOW_LOAD),f=null}),N.get().streaming.abandonLoadTimeout))}}}return r={isPlayingAtTopQuality:function(e){var t=e?e.id:null,n=j(Ma.default.AUDIO),r=j(Ma.default.VIDEO);return n===w(Ma.default.AUDIO,t)&&r===w(Ma.default.VIDEO,t)},updateTopQualityIndex:function(e){var t=e.type,n=e.streamInfo.id,r=e.representationCount-1;return function(e,t,n){s[t]=s[t]||{},s[t][e]=n}(t,n,r),r},getThroughputHistory:function(){return A},getBitrateList:k,getQualityForBitrate:B,getTopBitrateInfoFor:function(e){if(e&&l&&l[e]){var t=l[e].getStreamInfo();if(t&&t.id){var n=w(e,t.id),r=k(l[e].getMediaInfo());return r[n]?r[n]:null}}return null},getMaxAllowedIndexFor:P,getMinAllowedIndexFor:L,getInitialBitrateFor:function(e){if(function(){if(!E||!E.hasOwnProperty("getSavedBitrateSettings"))throw new Error(Ma.default.MISSING_CONFIG_ERROR)}(),e===Ma.default.TEXT||e===Ma.default.FRAGMENTED_TEXT)return NaN;var t=E.getSavedBitrateSettings(e),n=N.get().streaming.abr.initialBitrate[e],r=N.get().streaming.abr.initialRepresentationRatio[e];if(-1===n)if(r>-1){var i=p.getAdaptationForType(0,e).Representation;if(Array.isArray(i))n=i[Math.max(Math.round(i.length*r)-1,0)].bandwidth;else n=0}else n=isNaN(t)?e===Ma.default.VIDEO?1e3:100:t;return n},getQualityFor:j,getAbandonmentStateFor:function(e){return d[e]?d[e].state:null},setPlaybackQuality:F,checkPlaybackQuality:function(t){if(t&&l&&l[t]){var n=l[t].getStreamInfo(),o=n?n.id:null,s=j(t),u=(0,Fa.default)(e).create({abrController:r,streamProcessor:l[t],currentValue:s,switchHistory:y[t],droppedFramesHistory:T,useBufferOccupancyABR:G(t),useL2AABR:q(t),useLoLPABR:Y(t),videoModel:_});if(T){var f=_.getPlaybackQuality();f&&T.push(v,f)}if(N.get().streaming.abr.autoSwitchBitrate[t]){var c=L(t),g=w(t,o),h=a.getMaxQuality(u),p=h.quality;if(void 0!==c&&(p>xa.default.NO_CHANGE?p:s)<c&&(p=c),p>g&&(p=g),y[t].push({oldValue:s,newValue:p}),p>xa.default.NO_CHANGE&&p!=s)(d[t].state===Da.default.ALLOW_LOAD||p>s)&&x(t,s,p,g,h.reason);else if(N.get().debug.logLevel===Ga.default.LOG_LEVEL_DEBUG){var m=b.getCurrentBufferLevel(t,!0);i.debug("["+t+"] stay on "+s+"/"+g+" (buffer: "+m+")")}}}},getTopQualityIndexFor:w,setElementSize:H,setWindowResizeEventCalled:function(e){c=e},createAbrRulesCollection:M,registerStreamType:function(t,i){y[t]=y[t]||(0,Ua.default)(e).create(),l[t]=i,d[t]=d[t]||{},d[t].state=Da.default.ALLOW_LOAD,S[t]=!1,I[t]=!1,R[t]=!1,n.on(Pa.default.LOADING_PROGRESS,K,r),t===Ma.default.VIDEO&&(n.on(Pa.default.QUALITY_CHANGE_RENDERED,C,r),T=T||(0,Ba.default)(e).create(),H()),n.on(Pa.default.METRIC_ADDED,O,r),n.on(Pa.default.PERIOD_SWITCH_COMPLETED,M,r),A=A||(0,ka.default)(e).create({settings:N})},unRegisterStreamType:function(e){delete l[e]},setConfig:function(e){e&&(e.streamController&&(o=e.streamController),e.domStorage&&(E=e.domStorage),e.mediaPlayerModel&&(m=e.mediaPlayerModel),e.dashMetrics&&(b=e.dashMetrics),e.adapter&&(p=e.adapter),e.videoModel&&(_=e.videoModel),e.settings&&(N=e.settings))},reset:function(){D(),n.off(Pa.default.LOADING_PROGRESS,K,r),n.off(Pa.default.QUALITY_CHANGE_RENDERED,C,r),n.off(Pa.default.METRIC_ADDED,O,r),n.off(Pa.default.PERIOD_SWITCH_COMPLETED,M,r),a&&a.reset()}},i=t.getLogger(r),D(),r}Ya.__dashjs_factory_name="AbrController";var ja=La.default.getSingletonFactory(Ya);ja.QUALITY_DEFAULT=0,La.default.updateSingletonFactory(Ya.__dashjs_factory_name,ja);var Ha=ja,Ka=Object.defineProperty({default:Ha},"__esModule",{value:!0}),Va=function(e){return e&&e.__esModule?e:{default:e}}(S);function za(){var e={};return{save:function(t){var n=t.streamId,r=t.representationId;e[n]=e[n]||{},e[n][r]=t},extract:function(t,n){return e&&e[t]&&e[t][n]?e[t][n]:null},reset:function(){e={}}}}za.__dashjs_factory_name="InitCache";var Wa=Va.default.getSingletonFactory(za),Xa=Object.defineProperty({default:Wa},"__esModule",{value:!0}),Qa=lo(p),Za=lo(T),$a=lo(be),Ja=lo(jn),eo=lo(Xn),to=lo(Ka),no=lo(x),ro=lo(q),io=lo(S),ao=lo(ee),oo=lo(Xa),so=lo(Me),uo=lo(Bt);function lo(e){return e&&e.__esModule?e:{default:e}}function fo(e){e=e||{};var t=this.context,n=(0,no.default)(t).getInstance(),r=e.errHandler,i=e.fragmentModel,a=e.representationController,o=e.mediaController,s=e.adapter,u=e.textController,l=e.abrController,d=e.playbackController,f=e.streamInfo,c=e.type,g=e.settings,h=void 0,p=void 0,_=void 0,m=void 0,E=void 0,v=void 0,y=void 0,T=void 0,A=void 0,S=void 0,I=void 0,R=void 0,b=void 0,N=void 0,M=void 0,D=void 0,C=void 0,O=void 0,w=void 0,P=void 0,L=void 0,F=void 0,x=void 0;function U(e){return s.convertDataToRepresentationInfo(a.getRepresentationForQuality(e))}function B(e,n){if(!O||!e)return null;var a=e[0];if(y)try{S=n&&n[c]?(0,Ja.default)(t).create(y,a,j.bind(this),n[c]):(0,Ja.default)(t).create(y,a,j.bind(this),null),g.get().streaming.useAppendWindow&&S.updateAppendWindow(f),"function"==typeof S.getBuffer().initialize&&S.getBuffer().initialize(c,f,e,i)}catch(e){p.fatal("Caught error on create SourceBuffer: "+e),r.error(new so.default(uo.default.MEDIASOURCE_TYPE_UNSUPPORTED_CODE,uo.default.MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE+c))}else S=(0,eo.default)(t).create(j.bind(this));return ae(U(_)),S}function k(e){p.info("Init fragment finished loading saving to",c+"'s init cache"),O.save(e.chunk),p.debug("Append Init fragment",c," with representationId:",e.chunk.representationId," and quality:",e.chunk.quality,", data size:",e.chunk.bytes.byteLength),q(e.chunk)}function G(e){var t=e.chunk;if(F){x=t;var n=S&&S.getAllBufferRanges();n&&n.length>0&&d.getTimeToStreamEnd()>g.get().streaming.stallThreshold&&(p.debug("Clearing buffer because track changed - "+(n.end(n.length-1)+.5)),ne([{start:0,end:n.end(n.length-1)+.5,force:!0}]))}else q(t)}function q(e){S.append(e),e.mediaInfo.type===Qa.default.VIDEO&&he(ro.default.VIDEO_CHUNK_RECEIVED,{chunk:e})}function Y(e){if(e&&e.length>0)for(var t=0,n=e.length;t<n;t++)p.debug("Buffered range: "+e.start(t)+" - "+e.end(t)+", currentTime = ",d.getTime())}function j(e){if(e.error){if(22===e.error.code&&(C=!0,v=.8*ce(),p.warn("Quota exceeded, Critical Buffer: "+v),v>0)){var t=Math.max(.2*v,1),n=v-t,r=Math.min(g.get().streaming.bufferTimeAtTopQuality,.9*n),i=Math.min(g.get().streaming.bufferTimeAtTopQualityLongForm,.9*n),o={streaming:{bufferToKeep:parseFloat(t.toFixed(5)),bufferTimeAtTopQuality:parseFloat(r.toFixed(5)),bufferTimeAtTopQualityLongForm:parseFloat(i.toFixed(5))}};g.update(o)}22!==e.error.code&&ge()||(p.warn("Clearing playback buffer to overcome quota exceed situation"),he(ro.default.QUOTA_EXCEEDED,{criticalBufferLevel:v,quotaExceededTime:e.chunk.start}),ne(te()))}else{C=!1,(N=e.chunk)&&!isNaN(N.index)&&(T=Math.max(N.index,T),$());var s=S.getAllBufferRanges();if(N.segmentType===pe.HTTPRequest.MEDIA_SEGMENT_TYPE)Y(s),z(),function(){if(c!==Qa.default.AUDIO&&c!==Qa.default.VIDEO)return;if(isNaN(w))return;var e=d.getTime(),t=Q(w,0);if(e===w&&t)return;var n=a.getCurrentRepresentation().segmentDuration;if(!(t=Q(w,n)))return;Math.abs(e-w)>n?w<=t.end&&(d.seek(Math.max(w,t.start),!1,!0),w=NaN):e<t.start&&(d.seek(t.start,!1,!0),w=NaN)}();else if(F){var u=d.getTime();p.debug("AppendToBuffer seek target should be "+u),he(ro.default.SEEK_TARGET,{time:u})}var l=!1;R&&(R.indexOf(N)>0&&(l=!0),R=null),N&&!l&&he(N.endFragment?ro.default.BYTES_APPENDED_END_FRAGMENT:ro.default.BYTES_APPENDED,{quality:N.quality,startTime:N.start,index:N.index,bufferedRanges:s,mediaType:c})}}function H(e){_!==e.newQuality&&(ae(this.getRepresentationInfo(e.newQuality)),_=e.newQuality)}function K(e){S&&(w=e.seekTime,m&&(P=!0,m=!1,A=Number.POSITIVE_INFINITY),c!==Qa.default.FRAGMENTED_TEXT?function(){if(!S)return;S.waitForUpdateEnd((function(){var e=function(){if(!S)return;var e=[],t=S.getAllBufferRanges();if(!t||0===t.length)return e;var n=d.getTime(),r=t.end(t.length-1)+.5,a=i.getRequests({state:$a.default.FRAGMENT_MODEL_EXECUTED,time:n,threshold:.01})[0];if(a){var o={start:0,end:a.startTime-g.get().streaming.stallThreshold},s=i.getRequests({state:$a.default.FRAGMENT_MODEL_EXECUTED,time:a.startTime-a.duration/2,threshold:.01})[0];s&&s.startTime!=a.startTime&&(o.end=s.startTime),o.start<o.end&&o.end>t.start(0)&&e.push(o);var u={start:a.startTime+a.duration+g.get().streaming.stallThreshold,end:r},l=i.getRequests({state:$a.default.FRAGMENT_MODEL_EXECUTED,time:a.startTime+a.duration+g.get().streaming.stallThreshold,threshold:.01})[0];l&&l.startTime!==a.startTime&&(u.start=l.startTime+l.duration+g.get().streaming.stallThreshold),u.start<u.end&&u.start<r&&e.push(u)}else p.debug("getAllRangesWithSafetyFactor - No request found in current time position, removing full buffer 0 -",r),e.push({start:0,end:r});return e}();e&&0!==e.length||z(),ne(e)}))}():z())}function V(){w=NaN}function z(){(!F||c===Qa.default.FRAGMENTED_TEXT&&u.isTextEnabled())&&Z()}function W(){J()}function X(){w=NaN,J()}function Q(e,t){var n=S.getAllBufferRanges(),r=0,i=0,a=null,o=null,s=0,u=void 0,l=void 0,d=isNaN(t)?.15:t;if(null!=n){for(l=0,u=n.length;l<u;l++)if(r=n.start(l),i=n.end(l),null===a)s=Math.abs(r-e),(e>=r&&e<i||s<=d)&&(a=r,o=i);else{if(!((s=r-o)<=d))break;o=i}if(null!==a)return{start:a,end:o}}return null}function Z(){var e,t,n;d&&(e=(isNaN(w)?d.getTime():w)||0,g.get().streaming.jumpGaps&&(t=g.get().streaming.smallGapLimit),E=null===(n=Q(e,t))?0:n.end-e,he(ro.default.BUFFER_LEVEL_UPDATED,{bufferLevel:E}),J())}function $(){T>=A-1&&!m&&void 0===S.discharge&&(m=!0,p.debug("checkIfBufferingCompleted trigger BUFFERING_COMPLETED for "+c),he(ro.default.BUFFERING_COMPLETED))}function J(){c!==Qa.default.AUDIO&&c!==Qa.default.VIDEO||(P&&!m&&E>0&&d&&d.getTimeToStreamEnd()-E<.1&&(P=!1,m=!0,p.debug("checkIfSufficientBuffer trigger BUFFERING_COMPLETED for type "+c),he(ro.default.BUFFERING_COMPLETED)),(!g.get().streaming.lowLatencyEnabled&&E<g.get().streaming.stallThreshold||0===E)&&!m?ee(Za.default.BUFFER_EMPTY):(m||E>=f.manifestInfo.minBufferTime)&&ee(Za.default.BUFFER_LOADED))}function ee(e){b===e||e===Za.default.BUFFER_EMPTY&&0===d.getTime()||c===Qa.default.FRAGMENTED_TEXT&&!u.isTextEnabled()||(b=e,he(ro.default.BUFFER_LEVEL_STATE_CHANGED,{state:e}),he(e===Za.default.BUFFER_LOADED?ro.default.BUFFER_LOADED:ro.default.BUFFER_EMPTY),p.debug(e===Za.default.BUFFER_LOADED?"Got enough buffer to start":"Waiting for more buffer before starting playback"))}function te(){var e=[],t=S.getAllBufferRanges();if(!t||0===t.length)return e;var n=d.getTime(),r=Math.max(0,n-g.get().streaming.bufferToKeep),a=i.getRequests({state:$a.default.FRAGMENT_MODEL_EXECUTED,time:n,threshold:.01})[0];if(a)r=Math.min(a.startTime,r);else if(0===n&&d.getIsDynamic())return[];if(t.start(0)<=r){for(var o={start:0,end:r},s=0;s<t.length&&t.end(s)<=r;s++)o.end=t.end(s);o.start<o.end&&e.push(o)}return e}function ne(e){e&&S&&0!==e.length&&(L.push.apply(L,e),D||re())}function re(){if(0===L.length||!S)return p.debug("Nothing to prune, halt pruning"),L=[],void(D=!1);var e=S.getBuffer();if(!e||!e.buffered||0===e.buffered.length)return p.debug("SourceBuffer is empty (or does not exist), halt pruning"),L=[],void(D=!1);var t=L.shift();p.debug("Removing buffer from:",t.start,"to",t.end),D=!0,d.getTime()<t.end&&(m=!1,T=0),S.remove(t.start,t.end,t.force)}function ie(e){S===e.buffer&&(p.debug("onRemoved buffer from:",e.from,"to",e.to),Y(S.getAllBufferRanges()),0===L.length&&(D=!1),e.unintended&&(p.warn("Detected unintended removal from:",e.from,"to",e.to,"setting index handler time to",e.from),he(ro.default.SEEK_TARGET,{time:e.from,mediaType:c,streamId:f.id})),D?re():(F?(F=!1,x&&q(x)):Z(),he(ro.default.BUFFER_CLEARED,{from:e.from,to:e.to,unintended:e.unintended,hasEnoughSpaceToAppend:ge(),quotaExceeded:C})))}function ae(e){e&&void 0!==e.MSETimeOffset&&S&&S.updateTimestampOffset&&S.updateTimestampOffset(e.MSETimeOffset)}function oe(e){e.error||m||ae(e.currentRepresentation)}function se(e){A=e.request.index,$()}function ue(e){if(e.newMediaInfo.streamInfo.id===f.id&&e.newMediaInfo.type===c){var t=S&&S.getAllBufferRanges();t&&(p.info("Track change asked"),o.getSwitchMode(c)===Qa.default.TRACK_SWITCH_MODE_ALWAYS_REPLACE&&t&&t.length>0&&d.getTimeToStreamEnd()>g.get().streaming.stallThreshold&&(m=!1,A=Number.POSITIVE_INFINITY))}}function le(){++M*(g.get().streaming.wallclockTimeUpdateInterval/1e3)>=g.get().streaming.bufferPruningInterval&&(M=0,S&&c!==Qa.default.FRAGMENTED_TEXT&&(m||ne(te())))}function de(){J()}function fe(e,t){y=e,S&&t&&"function"==typeof S.discharge&&(I=S,B(t))}function ce(){var e,t=S.getAllBufferRanges(),n=0,r=void 0;if(!t)return n;for(r=0,e=t.length;r<e;r++)n+=t.end(r)-t.start(r);return n}function ge(){return ce()<v}function he(e,t){var r=t||{};n.trigger(e,r,{streamId:f.id,mediaType:c})}function _e(e,t){v=Number.POSITIVE_INFINITY,b=void 0,_=to.default.QUALITY_DEFAULT,A=Number.POSITIVE_INFINITY,T=0,N=null,m=!1,D=!1,C=!1,P=!1,E=0,M=0,L=[],w=NaN,S&&(e||S.abort(),S.reset(t),S=null),F=!1}return h={initialize:function(e){fe(e),_=l.getQualityFor(c),n.on(ro.default.DATA_UPDATE_COMPLETED,oe,this),n.on(ro.default.INIT_FRAGMENT_LOADED,k,this),n.on(ro.default.MEDIA_FRAGMENT_LOADED,G,this),n.on(ro.default.QUALITY_CHANGE_REQUESTED,H,this),n.on(ro.default.STREAM_COMPLETED,se,this),n.on(ro.default.PLAYBACK_PLAYING,X,this),n.on(ro.default.PLAYBACK_PROGRESS,z,this),n.on(ro.default.PLAYBACK_TIME_UPDATED,z,this),n.on(ro.default.PLAYBACK_RATE_CHANGED,de,this),n.on(ro.default.PLAYBACK_SEEKING,K,this),n.on(ro.default.PLAYBACK_SEEKED,V,this),n.on(ro.default.PLAYBACK_STALLED,W,this),n.on(ro.default.WALLCLOCK_TIME_UPDATED,le,this),n.on(ro.default.CURRENT_TRACK_CHANGED,ue,this,{priority:no.default.EVENT_PRIORITY_HIGH}),n.on(ro.default.SOURCEBUFFER_REMOVE_COMPLETED,ie,this)},getStreamId:function(){return f.id},getType:function(){return c},getBufferControllerType:function(){return"BufferController"},getRepresentationInfo:U,createBuffer:B,dischargePreBuffer:function(){if(S&&I&&"function"==typeof I.discharge){var e=I.getAllBufferRanges();if(e.length>0){for(var t="Beginning "+c+"PreBuffer discharge, adding buffer for:",n=0;n<e.length;n++)t+=" start: "+e.start(n)+", end: "+e.end(n)+";";p.debug(t)}else p.debug("PreBuffer discharge requested, but there were no media segments in the PreBuffer.");R=[];for(var r=I.discharge(),i=null,a=0;a<r.length;a++){var o=r[a];if("InitializationSegment"!==o.segmentType){var s=O.extract(o.streamId,o.representationId);s&&i!==s&&(R.push(s),S.append(s),i=s)}R.push(o),S.append(o)}I.reset(),I=null}},getBuffer:function(){return S},setBuffer:function(e){S=e},getBufferLevel:function(){return E},getRangeAt:Q,setMediaSource:fe,getMediaSource:function(){return y},appendInitSegment:function(e){var t=O.extract(f.id,e);return!!t&&(p.info("Append Init fragment",c," with representationId:",t.representationId," and quality:",t.quality,", data size:",t.bytes.byteLength),q(t),!0)},replaceBuffer:function(){F=!0},getIsBufferingCompleted:function(){return m},getIsPruningInProgress:function(){return D},reset:function(e,t){n.off(ro.default.DATA_UPDATE_COMPLETED,oe,this),n.off(ro.default.INIT_FRAGMENT_LOADED,k,this),n.off(ro.default.MEDIA_FRAGMENT_LOADED,G,this),n.off(ro.default.QUALITY_CHANGE_REQUESTED,H,this),n.off(ro.default.STREAM_COMPLETED,se,this),n.off(ro.default.PLAYBACK_PLAYING,X,this),n.off(ro.default.PLAYBACK_PROGRESS,z,this),n.off(ro.default.PLAYBACK_TIME_UPDATED,z,this),n.off(ro.default.PLAYBACK_RATE_CHANGED,de,this),n.off(ro.default.PLAYBACK_SEEKING,K,this),n.off(ro.default.PLAYBACK_SEEKED,V,this),n.off(ro.default.PLAYBACK_STALLED,W,this),n.off(ro.default.WALLCLOCK_TIME_UPDATED,le,this),n.off(ro.default.CURRENT_TRACK_CHANGED,ue,this),n.off(ro.default.SOURCEBUFFER_REMOVE_COMPLETED,ie,this),_e(e,t)},updateAppendWindow:function(){S&&!m&&S.updateAppendWindow(f)}},p=(0,ao.default)(t).getInstance().getLogger(h),O=(0,oo.default)(t).getInstance(),_e(),h}fo.__dashjs_factory_name="BufferController";var co=io.default.getClassFactory(fo),go=Object.defineProperty({default:co},"__esModule",{value:!0}),ho=So(p),po=So(x),_o=So(q),mo=So(S),Eo=So(Xa),vo=So(jn),yo=So(wn),To=So(Me),Ao=So(Bt);function So(e){return e&&e.__esModule?e:{default:e}}function Io(e){e=e||{};var t=this.context,n=(0,po.default)(t).getInstance(),r=(0,yo.default)(t).getInstance(),i=e.errHandler,a=e.streamInfo,o=e.type,s=e.mimeType,u=e.fragmentModel,l=void 0,d=void 0,f=void 0,c=void 0,g=void 0,h=void 0;function p(e){c=e}function _(e){null===h.extract(a.id,e.currentRepresentation.id)&&(d=!1,n.trigger(_o.default.INIT_FRAGMENT_NEEDED,{representationId:e.currentRepresentation.id,sender:l},{streamId:a.id,mediaType:o}))}function m(e){e.chunk.bytes&&(h.save(e.chunk),g.append(e.chunk),d=!0,n.trigger(_o.default.STREAM_COMPLETED,{request:e.request},{streamId:a.id,mediaType:o}))}return l={getBufferControllerType:function(){return"NotFragmentedTextBufferController"},initialize:function(e){p(e),h=(0,Eo.default)(t).getInstance()},createBuffer:function(e){var n=e[0];try{if(g=(0,vo.default)(t).create(c,n),!f){var l=g.getBuffer();l.hasOwnProperty(ho.default.INITIALIZE)&&l.initialize(s,a,e,u),f=!0}return g}catch(e){if(n&&(n.isText||-1!==n.codec.indexOf('codecs="stpp')||-1!==n.codec.indexOf('codecs="wvtt')))try{g=r.getTextSourceBuffer()}catch(e){i.error(new To.default(Ao.default.MEDIASOURCE_TYPE_UNSUPPORTED_CODE,Ao.default.MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE+o+" : "+e.message))}else i.error(new To.default(Ao.default.MEDIASOURCE_TYPE_UNSUPPORTED_CODE,Ao.default.MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE+o))}},getStreamId:function(){return a.id},getType:function(){return o},getBuffer:function(){return g},getBufferLevel:function(){return 0},setMediaSource:p,getMediaSource:function(){return c},getIsBufferingCompleted:function(){return d},getIsPruningInProgress:function(){return!1},dischargePreBuffer:function(){},appendInitSegment:function(e){return null!==h.extract(a.id,e)},getRangeAt:function(){return null},reset:function(e){n.off(_o.default.DATA_UPDATE_COMPLETED,_,l),n.off(_o.default.INIT_FRAGMENT_LOADED,m,l),!e&&g&&(g.abort(),g.reset(),g=null)},updateTimestampOffset:function(e){g.timestampOffset===e||isNaN(e)||(g.timestampOffset=e)}},f=!1,c=null,d=!1,n.on(_o.default.DATA_UPDATE_COMPLETED,_,l),n.on(_o.default.INIT_FRAGMENT_LOADED,m,l),l}Io.__dashjs_factory_name="NotFragmentedTextBufferController";var Ro=mo.default.getClassFactory(Io),bo=Object.defineProperty({default:Ro},"__esModule",{value:!0}),No=Oo(p),Mo=Oo(S),Do=Oo(go),Co=Oo(bo);function Oo(e){return e&&e.__esModule?e:{default:e}}function wo(e){e=e||{};var t,n=this.context,r=void 0;function i(){return r.getBuffer()}return t={getBufferControllerType:function(){return r.getBufferControllerType()},initialize:function(e,t){return r.initialize(e,t)},createBuffer:function(e,t){return r.createBuffer(e,t)},getType:function(){return r.getType()},getBuffer:i,setBuffer:function(e){r.setBuffer(e)},getBufferLevel:function(){return r.getBufferLevel()},setMediaSource:function(e){r.setMediaSource(e)},getMediaSource:function(){return r.getMediaSource()},getIsBufferingCompleted:function(){return r.getIsBufferingCompleted()},getIsPruningInProgress:function(){return r.getIsPruningInProgress()},dischargePreBuffer:function(){return r.dischargePreBuffer()},appendInitSegment:function(e){r.appendInitSegment(e)},getRangeAt:function(e){return r.getRangeAt(e)},reset:function(e){r.reset(e)},updateTimestampOffset:function(e){var t=i();t.timestampOffset===e||isNaN(e)||(t.timestampOffset=e)},updateAppendWindow:function(){r.updateAppendWindow()},getRepresentationInfo:function(e){return r.getRepresentationInfo(e)}},r=e.type===No.default.FRAGMENTED_TEXT?(0,Do.default)(n).create({streamInfo:e.streamInfo,type:e.type,mediaPlayerModel:e.mediaPlayerModel,manifestModel:e.manifestModel,fragmentModel:e.fragmentModel,errHandler:e.errHandler,mediaController:e.mediaController,representationController:e.representationController,adapter:e.adapter,textController:e.textController,abrController:e.abrController,playbackController:e.playbackController,settings:e.settings}):(0,Co.default)(n).create({streamInfo:e.streamInfo,type:e.type,mimeType:e.mimeType,fragmentModel:e.fragmentModel,errHandler:e.errHandler}),t}wo.__dashjs_factory_name="TextBufferController";var Po=Mo.default.getClassFactory(wo),Lo=Object.defineProperty({default:Po},"__esModule",{value:!0}),Fo=Bo(p),xo=Bo(S),Uo=Bo(T);function Bo(e){return e&&e.__esModule?e:{default:e}}function ko(e){var t=(e=e||{}).dashMetrics,n=e.mediaPlayerModel,r=e.textController,i=e.abrController,a=e.settings;function o(e,o,s){var u=NaN;if(!e||!o)return u;if(e===Fo.default.FRAGMENTED_TEXT)if(r.isTextEnabled())if(isNaN(o.fragmentDuration)){var l=t.getCurrentSchedulingInfo(Uo.default.SCHEDULING_INFO);u=l?l.duration:0}else u=o.fragmentDuration;else u=0;else if(e===Fo.default.AUDIO&&s){var d=t.getCurrentBufferLevel(Fo.default.VIDEO);u=isNaN(o.fragmentDuration)?d:Math.max(d,o.fragmentDuration)}else{var f=o.mediaInfo.streamInfo;if(i.isPlayingAtTopQuality(f))u=f.manifestInfo.duration>=a.get().streaming.longFormContentDurationThreshold?a.get().streaming.bufferTimeAtTopQualityLongForm:a.get().streaming.bufferTimeAtTopQuality;else u=n.getStableBufferTime()}return u}return{execute:function(e,n,r){return!e||!n||t.getCurrentBufferLevel(e)<o(e,n,r)},getBufferTarget:o}}ko.__dashjs_factory_name="BufferLevelRule";var Go=xo.default.getClassFactory(ko),qo=Object.defineProperty({default:Go},"__esModule",{value:!0}),Yo=Qo(p),jo=Qo(T),Ho=Qo(qo),Ko=Qo(be),Vo=Qo(x),zo=Qo(q),Wo=Qo(S),Xo=Qo(ee);function Qo(e){return e&&e.__esModule?e:{default:e}}function Zo(e){e=e||{};var t=this.context,n=(0,Vo.default)(t).getInstance(),r=e.adapter,i=e.dashMetrics,a=e.mediaPlayerModel,o=e.fragmentModel,s=e.abrController,u=e.playbackController,l=e.textController,d=e.type,f=e.mimeType,c=e.mediaController,g=e.bufferController,h=e.settings,p=void 0,_=void 0,m=void 0,E=void 0,v=void 0,y=void 0,T=void 0,A=void 0,S=void 0,I=void 0,R=void 0,b=void 0,N=void 0,M=void 0,D=void 0,C=void 0,O=void 0,w=void 0,P=void 0,L=void 0;function F(){return!1===v}function x(){_&&(F()||E&&!g.getIsBufferingCompleted()&&(m.debug("Schedule Controller starts"),v=!1,i.createPlaylistTraceMetrics(E.id,1e3*u.getTime(),u.getPlaybackRate()),k(0)))}function U(){v||(m.debug("Schedule Controller stops"),m.debug(d+" Schedule Controller stops"),v=!0,clearTimeout(A))}function B(){if(_)if(v||y||u.isPaused()&&!h.get().streaming.scheduleWhilePaused||(d===Yo.default.FRAGMENTED_TEXT||d===Yo.default.TEXT)&&!l.isTextEnabled()||g.getIsBufferingCompleted())U();else{!function(){if(!isNaN(S))return;if(!M)return;var e=u.getTime(),t=1.5;if(isNaN(M.fragmentDuration)){var n=i.getCurrentSchedulingInfo(E.mediaInfo.type);t=n?1.5*n.duration:1.5}var a=o.getRequests({state:Ko.default.FRAGMENT_MODEL_EXECUTED,time:e+t,threshold:0})[0];if(a&&-1===D.indexOf(a)&&!r.getIsTextTrack(f)){var l=h.get().streaming.fastSwitchEnabled,p=g.getBufferLevel(),_=s.getAbandonmentStateFor(d),v=!c.isCurrentTrack(a.mediaInfo)&&c.getSwitchMode(a.mediaInfo.type)===Yo.default.TRACK_SWITCH_MODE_NEVER_REPLACE,y=a.quality<M.quality;l&&(v||y)&&p>=t&&_!==jo.default.ABANDON_LOAD?(q(a),L=!0,m.debug("Reloading outdated fragment at index: ",a.index)):a.quality>M.quality&&!O&&ne(u.getTime()+p)}}();var e=D.length>0,t=M?M.quality:NaN;if(O||isNaN(t)||C||e||function(e,t){N[t]=N[t]||{};var n=s.getTopQualityIndexFor(e,t);return N[t][e]!=n&&(m.info("Top quality "+e+" index has changed from "+N[t][e]+" to "+n),N[t][e]=n,!0)}(d,_.id)||R.execute(d,E,I)){G(!0),!e&&P&&s.checkPlaybackQuality(d),function(){if(E.quality===t&&!C||O){var e=D.shift();e&&e.isInitializationRequest()?(n.trigger(zo.default.INIT_FRAGMENT_NEEDED,{representationId:e.representationId,sender:p},{streamId:_.id,mediaType:d}),P=!1):(n.trigger(zo.default.MEDIA_FRAGMENT_NEEDED,{seekTarget:S,replacement:e},{streamId:_.id,mediaType:d}),P=!0)}else C?(m.debug("Switch track for "+d+", representation id = "+E.id),(O=c.getSwitchMode(d)===Yo.default.TRACK_SWITCH_MODE_ALWAYS_REPLACE)&&g.replaceBuffer&&g.replaceBuffer(),C=!1):m.debug("Quality has changed, get init request for representationid = "+E.id),n.trigger(zo.default.INIT_FRAGMENT_NEEDED,{representationId:E.id,sender:p},{streamId:_.id,mediaType:d}),P=!1}()}else k(500)}}function k(e){clearTimeout(A),A=setTimeout(B,e)}function G(e){y!==e?y=e:m.debug("isFragmentProcessingInProgress is already equal to",e)}function q(e){D.push(e)}function Y(e){if(u&&o){var t=o.getRequests({state:Ko.default.FRAGMENT_MODEL_EXECUTED,time:u.getTime(),threshold:0})[0];t&&u.getTime()>=t.startTime&&((!b.mediaInfo||t.mediaInfo.type===b.mediaInfo.type&&t.mediaInfo.id!==b.mediaInfo.id)&&e&&n.trigger(zo.default.TRACK_CHANGE_RENDERED,{mediaType:d,oldMediaInfo:b.mediaInfo,newMediaInfo:t.mediaInfo}),t.quality===b.quality&&t.adaptationIndex===b.adaptationIndex||!e||n.trigger(zo.default.QUALITY_CHANGE_RENDERED,{mediaType:d,oldQuality:b.quality,newQuality:t.quality}),b={mediaInfo:t.mediaInfo,quality:t.quality,adaptationIndex:t.adaptationIndex})}}function j(){U(),G(!1),m.info("Stream "+_.id+" is complete")}function H(e){e.request.mediaInfo.streamInfo.id===_.id&&e.request.mediaType===d&&(m.info("OnFragmentLoadingCompleted - Url:",e.request?e.request.url:"undefined",e.request.range?", Range:"+e.request.range:""),r.getIsTextTrack(f)&&G(!1),e.error&&e.request.serviceLocation&&!v&&(q(e.request),G(!1),k(0)),O&&(w=e.request))}function K(){Y(!0)}function V(e){if(O&&!isNaN(e.startTime)&&(O=!1,o.addExecutedRequest(w)),G(!1),isNaN(e.index)&&(M=g.getRepresentationInfo(e.quality),m.info("["+d+"] lastInitializedRepresentationInfo changed to "+e.quality)),L&&!isNaN(e.startTime)){var t=u.getTime(),n=e.startTime+E.fragmentDuration,r=1.5*E.fragmentDuration;k(t+r>=n?0:1e3*(n-(t+r))),L=!1}else k(0)}function z(e){m.info("onFragmentLoadingAbandoned request: "+e.request.url+" has been aborted"),u.isSeeking()||C||(m.info("onFragmentLoadingAbandoned request: "+e.request.url+" has to be downloaded again, origin is not seeking process or switch track call"),q(e.request)),G(!1),k(0)}function W(){}function X(){U()}function Q(e){O&&h.get().streaming.flushBufferAtTrackSwitch&&u.seek(u.getTime()+.001,!1,!0),e.hasEnoughSpaceToAppend&&e.quotaExceeded&&x()}function Z(){U(),G(!1)}function $(){o.abortRequests(),U()}function J(){!v&&h.get().streaming.scheduleWhilePaused||x()}function ee(e){if(_){ne(e.seekTime),re(0),v&&x();var t=E&&E.DVRWindow&&u?E.DVRWindow.end-u.getTime():NaN;i.updateManifestUpdateInfo({latency:t}),y?o.abortRequests():k(0)}}function te(e){i.updatePlayListTraceMetrics({playbackspeed:e.playbackRate.toString()})}function ne(e){S=e}function re(e){T=e}function ie(){P=!0,y=!1,T=0,S=NaN,M=void 0,b={mediaInfo:void 0,quality:NaN,adaptationIndex:NaN},N={},D=[],v=!0,C=!1,O=!1,w=null,L=!1}return p={initialize:function(e){I=e,R=(0,Ho.default)(t).create({abrController:s,dashMetrics:i,mediaPlayerModel:a,textController:l,settings:h}),n.on(zo.default.DATA_UPDATE_STARTED,W,this),n.on(zo.default.FRAGMENT_LOADING_COMPLETED,H,this),n.on(zo.default.STREAM_COMPLETED,j,this),n.on(zo.default.BUFFER_CLEARED,Q,this),n.on(zo.default.BYTES_APPENDED_END_FRAGMENT,V,this),n.on(zo.default.QUOTA_EXCEEDED,Z,this),n.on(zo.default.PLAYBACK_SEEKING,ee,this),n.on(zo.default.PLAYBACK_STARTED,J,this),n.on(zo.default.PLAYBACK_RATE_CHANGED,te,this),n.on(zo.default.PLAYBACK_TIME_UPDATED,K,this),n.on(zo.default.URL_RESOLUTION_FAILED,$,this),n.on(zo.default.FRAGMENT_LOADING_ABANDONED,z,this),n.on(zo.default.BUFFERING_COMPLETED,X,this)},getType:function(){return d},getStreamId:function(){return _.id},setCurrentRepresentation:function(e){E=e},setSeekTarget:ne,setTimeToLoadDelay:re,getTimeToLoadDelay:function(){return T},switchTrackAsked:function(){C=!0},isStarted:F,start:x,stop:U,reset:function(){n.off(zo.default.DATA_UPDATE_STARTED,W,this),n.off(zo.default.FRAGMENT_LOADING_COMPLETED,H,this),n.off(zo.default.STREAM_COMPLETED,j,this),n.off(zo.default.BUFFER_CLEARED,Q,this),n.off(zo.default.BYTES_APPENDED_END_FRAGMENT,V,this),n.off(zo.default.QUOTA_EXCEEDED,Z,this),n.off(zo.default.PLAYBACK_SEEKING,ee,this),n.off(zo.default.PLAYBACK_STARTED,J,this),n.off(zo.default.PLAYBACK_RATE_CHANGED,te,this),n.off(zo.default.PLAYBACK_TIME_UPDATED,K,this),n.off(zo.default.URL_RESOLUTION_FAILED,$,this),n.off(zo.default.FRAGMENT_LOADING_ABANDONED,z,this),n.off(zo.default.BUFFERING_COMPLETED,X,this),U(),Y(!1),ie(),_=null},getBufferTarget:function(){return R.getBufferTarget(d,E,I)},processInitRequest:function(e){e&&(G(!0),o.executeRequest(e))},processMediaRequest:function(e){e?(m.debug("Next fragment request url is "+e.url),o.executeRequest(e)):(u.getIsDynamic()&&m.debug("Next fragment seems to be at the bleeding live edge and is not available yet. Rescheduling."),G(!1),k(h.get().streaming.lowLatencyEnabled?100:500))},getPlaybackController:function(){return u}},m=(0,Xo.default)(t).getInstance().getLogger(p),ie(),_=e.streamInfo,p}Zo.__dashjs_factory_name="ScheduleController";var $o=Wo.default.getClassFactory(Zo),Jo=Object.defineProperty({default:$o},"__esModule",{value:!0}),es=rs(p),ts=rs(Me),ns=rs(S);function rs(e){return e&&e.__esModule?e:{default:e}}function is(e){var t=(e=e||{}).eventBus,n=e.events,r=e.errors,i=e.abrController,a=e.dashMetrics,o=e.playbackController,s=e.timelineConverter,u=e.type,l=e.streamInfo,d=e.dashConstants,f=void 0,c=void 0,g=void 0,h=void 0,p=void 0;function _(){return u}function m(){if(!(i&&a&&o&&s))throw new Error(es.default.MISSING_CONFIG_ERROR)}function E(){return g}function v(){return p}function y(){c=null,g=!0,h=[]}function T(){m();var e=new Date,t=v(),n=1e3*o.getTime();t&&a.addRepresentationSwitch(t.adaptation.type,e,n,t.id)}function A(e){return null==e||e>=h.length?null:h[e]}function S(e,t){var n;(e.segmentAvailabilityRange=s.calcSegmentAvailabilityRange(e,t),e.segmentAvailabilityRange.end<e.segmentAvailabilityRange.start)?b(new ts.default(r.SEGMENTS_UNAVAILABLE_ERROR_CODE,r.SEGMENTS_UNAVAILABLE_ERROR_MESSAGE,{availabilityDelay:e.segmentAvailabilityRange.start-e.segmentAvailabilityRange.end})):t&&(n=e.segmentAvailabilityRange.end,s.setExpectedLiveEdge(n),a.updateManifestUpdateInfo({presentationStartTime:n}))}function I(e,r){m();for(var i=0,a=h.length;i<a;i++)S(h[i],e),r&&t.trigger(n.REPRESENTATION_UPDATE_STARTED,{representation:h[i]},{streamId:l.id,mediaType:u})}function R(){g=!0,t.trigger(n.DATA_UPDATE_STARTED,{},{streamId:l.id,mediaType:u})}function b(e){g=!1,t.trigger(n.DATA_UPDATE_COMPLETED,{data:c,currentRepresentation:p,error:e},{streamId:l.id,mediaType:u})}function N(e){var r=e;t.trigger(n.AST_IN_FUTURE,{delay:r}),setTimeout((function(){E()||(R(),h.forEach((function(e){e.segmentAvailabilityRange=null})),I(o.getIsDynamic(),!0))}),r)}function M(e){if(E())if(e.error)b(e.error);else{var t,n=e.representation,s=a.getCurrentManifestUpdate(),u=!1,f=0,c=void 0;if(n.adaptation.period.mpd.manifest.type===d.DYNAMIC&&!n.adaptation.period.mpd.manifest.ignorePostponeTimePeriod&&o.getStreamController().getStreams().length<=1&&(f=function(e){try{var t=o.getStreamController().getActiveStreamInfo(),n=e.segmentAvailabilityRange.start;t&&t.id&&t.id!==l.id&&(n=Math.min(o.getTime(),n));var r=e.segmentAvailabilityRange.end-n;return 1e3*(o.getLiveDelay()-r)}catch(e){return 0}}(n)),f>0)return N(f),void b(new ts.default(r.SEGMENTS_UPDATE_FAILED_ERROR_CODE,r.SEGMENTS_UPDATE_FAILED_ERROR_MESSAGE));if(s){for(var g=0;g<s.representationInfo.length;g++)if((c=s.representationInfo[g]).index===n.index&&c.mediaType===_()){u=!0;break}u||a.addManifestUpdateRepresentationInfo(n,_())}(function(){for(var e=0,t=h.length;e<t;e++){var n=h[e].segmentInfoType;if(null===h[e].segmentAvailabilityRange||!h[e].hasInitialization()||(n===d.SEGMENT_BASE||n===d.BASE_URL)&&!h[e].segments)return!1}return!0})()&&(i.setPlaybackQuality(_(),l,(t=p,h.indexOf(t))),a.updateManifestUpdateInfo({latency:p.segmentAvailabilityRange.end-o.getTime()}),a.getCurrentRepresentationSwitch(v().adaptation.type)||T(),b())}}function D(e){e.isDynamic&&I(e.isDynamic)}function C(e){p=A(e.newQuality),T()}function O(e){if(e.newDuration){var t=v();if(t&&t.adaptation.period)t.adaptation.period.duration=e.newDuration}}return f={getStreamId:function(){return l.id},getType:_,getData:function(){return c},isUpdating:E,updateData:function(e,t,n,r){m(),R(),h=t,p=A(r),c=e,n===es.default.VIDEO||n===es.default.AUDIO||n===es.default.FRAGMENTED_TEXT?I(o.getIsDynamic(),!0):b()},updateRepresentation:S,getCurrentRepresentation:v,getRepresentationForQuality:A,reset:function(){t.off(n.QUALITY_CHANGE_REQUESTED,C,f),t.off(n.REPRESENTATION_UPDATE_COMPLETED,M,f),t.off(n.WALLCLOCK_TIME_UPDATED,D,f),t.off(n.MANIFEST_VALIDITY_CHANGED,O,f),y()}},y(),t.on(n.QUALITY_CHANGE_REQUESTED,C,f),t.on(n.REPRESENTATION_UPDATE_COMPLETED,M,f),t.on(n.WALLCLOCK_TIME_UPDATED,D,f),t.on(n.MANIFEST_VALIDITY_CHANGED,O,f),f}is.__dashjs_factory_name="RepresentationController";var as=ns.default.getClassFactory(is),os=Object.defineProperty({default:as},"__esModule",{value:!0}),ss=ls(S),us=ls(p);function ls(e){return e&&e.__esModule?e:{default:e}}function ds(e){var t=(e=e||{}).timelineConverter;return{getLiveEdge:function(e){return function(){if(!t||!t.hasOwnProperty("getExpectedLiveEdge"))throw new Error(us.default.MISSING_CONFIG_ERROR)}(),e.DVRWindow?e.DVRWindow.end:0},reset:function(){t=null}}}ds.__dashjs_factory_name="LiveEdgeFinder";var fs=ss.default.getClassFactory(ds),cs=Object.defineProperty({default:fs},"__esModule",{value:!0});var gs=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.indexRange=null,this.index=null,this.mediaRange=null,this.media=null,this.duration=NaN,this.replacementTime=null,this.replacementNumber=NaN,this.mediaStartTime=NaN,this.presentationStartTime=NaN,this.availabilityStartTime=NaN,this.availabilityEndTime=NaN,this.availabilityIdx=NaN,this.wallStartTime=NaN,this.representation=null},hs=Object.defineProperty({default:gs},"__esModule",{value:!0}),ps=function(e){return e?e.split("$$").join("$"):e},_s=function(e,t){if(!t||!e||-1===e.indexOf("$RepresentationID$"))return e;var n=t.toString();return e.split("$RepresentationID$").join(n)},ms=As,Es=function(e,t,n,r){var i,a,o=void 0;o=n.segmentDuration,isNaN(o)&&(o=n.adaptation.period.duration);i=parseFloat((n.adaptation.period.start+r*o).toFixed(5)),a=parseFloat((i+o).toFixed(5));var s=Ss(n,o,i,e.calcMediaTimeFromPresentationTime(i,n),e.calcAvailabilityStartTimeFromPresentationTime(i,n.adaptation.period.mpd,t),e,a,t,r);if(!Is(e,n,s,t))return null;return s},vs=function(e,t,n,r,i,a,o,s,u,l){var d,f,c=r/a,g=Math.min(i/a,n.adaptation.period.mpd.maxSegmentDuration),h=void 0;if(d=e.calcPresentationTimeFromMediaTime(c,n),f=d+g,h=Ss(n,g,d,c,n.adaptation.period.mpd.manifest.loadedTime,e,f,t,u),!Is(e,n,h,t))return null;return h.replacementTime=l||r,o=As(o,"Number",h.replacementNumber),o=As(o,"Time",h.replacementTime),h.media=o,h.mediaRange=s,h},ys=function(e){return e&&e.__esModule?e:{default:e}}(hs);function Ts(e,t){for(;e.length<t;)e="0"+e;return e}function As(e,t,n){var r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,u=void 0,l=t.length,d="%0".length;if(!e)return e;for(;;){if((r=e.indexOf("$"+t))<0)return e;if((i=e.indexOf("$",r+l))<0)return e;if((a=e.indexOf("%0",r+l))>r&&a<i)switch(o=e.charAt(i-1),s=parseInt(e.substring(a+d,i-1),10),o){case"d":case"i":case"u":u=Ts(n.toString(),s);break;case"x":u=Ts(n.toString(16),s);break;case"X":u=Ts(n.toString(16),s).toUpperCase();break;case"o":u=Ts(n.toString(8),s);break;default:return e}else u=n;e=e.substring(0,r)+u+e.substring(i+1)}}function Ss(e,t,n,r,i,a,o,s,u){var l,d=new ys.default;return d.representation=e,d.duration=t,d.presentationStartTime=n,d.mediaStartTime=r,d.availabilityStartTime=i,d.availabilityEndTime=a.calcAvailabilityEndTimeFromPresentationTime(o,e.adaptation.period.mpd,s),d.wallStartTime=a.calcWallTimeForSegment(d,s),d.replacementNumber=(l=u,d.representation.startNumber+l),d.availabilityIdx=u,d}function Is(e,t,n,r){var i=e.getPeriodEnd(t,r),a=e.calcPeriodRelativeTimeFromMpdRelativeTime(t,i);if(e.calcPeriodRelativeTimeFromMpdRelativeTime(t,n.presentationStartTime)>=a){if(!r)return!1;if(t.segmentAvailabilityRange&&n.presentationStartTime>=t.segmentAvailabilityRange.end)return!1}return!0}var Rs=Object.defineProperty({unescapeDollarsInTemplate:ps,replaceIDForTemplate:_s,replaceTokenForTemplate:ms,getIndexBasedSegment:Es,getTimeBasedSegment:vs},"__esModule",{value:!0}),bs=Ms(S),Ns=Ms(p);function Ms(e){return e&&e.__esModule?e:{default:e}}function Ds(e,t){var n=(e=e||{}).timelineConverter;function r(){if(!n||!n.hasOwnProperty("calcMediaTimeFromPresentationTime")||!n.hasOwnProperty("calcSegmentAvailabilityRange"))throw new Error(Ns.default.MISSING_CONFIG_ERROR)}function i(e,r){var i,a,o,s=e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.index].AdaptationSet_asArray[e.adaptation.index].Representation_asArray[e.index].SegmentTemplate||e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.index].AdaptationSet_asArray[e.adaptation.index].Representation_asArray[e.index].SegmentList,u=s.SegmentTimeline,l=s.SegmentURL_asArray,d=0,f=0,c=-1,g=void 0,h=void 0,p=void 0,_=void 0,m=void 0,E=void 0;o=e.timescale;var v=!1;for(h=0,a=(i=u.S_asArray).length;h<a&&!v;h++){if(_=0,(g=i[h]).hasOwnProperty("r")&&(_=g.r),g.hasOwnProperty("t")&&(f=(d=g.t)/o),_<0){if((E=i[h+1])&&E.hasOwnProperty("t"))m=E.t/o;else{var y=e.segmentAvailabilityRange?e.segmentAvailabilityRange.end:n.calcSegmentAvailabilityRange(e,t).end;m=n.calcMediaTimeFromPresentationTime(y,e),e.segmentDuration=g.d/o}_=Math.ceil((m-f)/(g.d/o))-1}for(p=0;p<=_&&!v;p++)(v=r(d,f,s,l,g,o,++c,h))&&(e.segmentDuration=g.d/o,(p<_-1||h<a-1)&&c++),f=(d+=g.d)/o}e.availableSegmentsNumber=c}return{getSegmentByIndex:function(e,a,o){if(r(),!e)return null;var s=null,u=!1;return i(e,(function(r,i,a,l,d,f,c,g){if(u||o<0){var h=a.media,p=d.mediaRange;return l&&(h=l[g].media||"",p=l[g].mediaRange),s=(0,Rs.getTimeBasedSegment)(n,t,e,r,d.d,f,h,p,c,d.tManifest),!0}return i>=o-.5*d.d/f&&(u=!0),!1})),s},getSegmentByTime:function(e,a){if(r(),!e)return null;void 0===a&&(a=null);var o=null,s=n.calcMediaTimeFromPresentationTime(a,e);return i(e,(function(r,i,a,u,l,d,f,c){if(s<i+l.d/d){var g=a.media,h=l.mediaRange;return u&&(g=u[c].media||"",h=u[c].mediaRange),o=(0,Rs.getTimeBasedSegment)(n,t,e,r,l.d,d,g,h,f,l.tManifest),!0}return!1})),o}}}Ds.__dashjs_factory_name="TimelineSegmentsGetter";var Cs=bs.default.getClassFactory(Ds),Os=Object.defineProperty({default:Cs},"__esModule",{value:!0}),ws=Ls(S),Ps=Ls(p);function Ls(e){return e&&e.__esModule?e:{default:e}}function Fs(e,t){var n=(e=e||{}).timelineConverter;function r(){if(!n||!n.hasOwnProperty("calcPeriodRelativeTimeFromMpdRelativeTime"))throw new Error(Ps.default.MISSING_CONFIG_ERROR)}function i(e,i){if(r(),!e)return null;var a=e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.index].AdaptationSet_asArray[e.adaptation.index].Representation_asArray[e.index].SegmentTemplate;i=Math.max(i,0);var o=(0,Rs.getIndexBasedSegment)(n,t,e,i);if(o){o.replacementTime=Math.round((i-1)*e.segmentDuration*e.timescale,10);var s=a.media;s=(0,Rs.replaceTokenForTemplate)(s,"Number",o.replacementNumber),s=(0,Rs.replaceTokenForTemplate)(s,"Time",o.replacementTime),o.media=s}var u=e.segmentDuration,l=e.segmentAvailabilityRange;return isNaN(u)?e.availableSegmentsNumber=1:e.availableSegmentsNumber=Math.ceil((l.end-l.start)/u),o}return{getSegmentByIndex:i,getSegmentByTime:function(e,t){if(r(),!e)return null;var a=e.segmentDuration;if(isNaN(a))return null;var o=n.calcPeriodRelativeTimeFromMpdRelativeTime(e,t);return i(e,Math.floor(o/a))}}}Fs.__dashjs_factory_name="TemplateSegmentsGetter";var xs=ws.default.getClassFactory(Fs),Us=Object.defineProperty({default:xs},"__esModule",{value:!0}),Bs=Gs(S),ks=Gs(p);function Gs(e){return e&&e.__esModule?e:{default:e}}function qs(e,t){var n=(e=e||{}).timelineConverter;function r(){if(!n||!n.hasOwnProperty("calcPeriodRelativeTimeFromMpdRelativeTime"))throw new Error(ks.default.MISSING_CONFIG_ERROR)}function i(e,i){if(r(),!e)return null;var a=e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.index].AdaptationSet_asArray[e.adaptation.index].Representation_asArray[e.index].SegmentList,o=a.SegmentURL_asArray.length,s=e&&!isNaN(e.startNumber)?e.startNumber:1,u=Math.max(s-1,0),l=Math.max(i-u,0),d=null;if(l<o){var f=a.SegmentURL_asArray[l];(d=(0,Rs.getIndexBasedSegment)(n,t,e,i))&&(d.replacementTime=(s+i-1)*e.segmentDuration,d.media=f.media?f.media:"",d.mediaRange=f.mediaRange,d.index=i,d.indexRange=f.indexRange)}return e.availableSegmentsNumber=o,d}return{getSegmentByIndex:i,getSegmentByTime:function(e,t){if(r(),!e)return null;var a=e.segmentDuration;if(isNaN(a))return null;var o=n.calcPeriodRelativeTimeFromMpdRelativeTime(e,t);return i(e,Math.floor(o/a))}}}qs.__dashjs_factory_name="ListSegmentsGetter";var Ys=Bs.default.getClassFactory(qs),js=Object.defineProperty({default:Ys},"__esModule",{value:!0}),Hs=Vs(S),Ks=Vs(p);function Vs(e){return e&&e.__esModule?e:{default:e}}function zs(e){var t=(e=e||{}).timelineConverter;function n(){if(!t||!t.hasOwnProperty("calcPeriodRelativeTimeFromMpdRelativeTime"))throw new Error(Ks.default.MISSING_CONFIG_ERROR)}function r(e,t){if(n(),!e)return null;var r=e.segments?e.segments.length:-1,i=void 0;if(t<r&&(i=e.segments[t])&&i.availabilityIdx===t)return i;for(var a=0;a<r;a++)if((i=e.segments[a])&&i.availabilityIdx===t)return i;return null}return{getSegmentByIndex:r,getSegmentByTime:function(e,t){return n(),r(e,function(e,t){if(!e)return-1;var n=e.segments,r=n?n.length:null,i=-1,a=void 0,o=void 0,s=void 0,u=void 0,l=void 0;if(n&&r>0)for(l=0;l<r;l++)if(o=n[l],s=o.presentationStartTime,u=o.duration,t+(a=u/2)>=s&&t-a<s+u){i=o.availabilityIdx;break}return i}(e,t))}}}zs.__dashjs_factory_name="SegmentBaseGetter";var Ws=Hs.default.getClassFactory(zs),Xs=Object.defineProperty({default:Ws},"__esModule",{value:!0}),Qs=tu(S),Zs=tu(Os),$s=tu(Us),Js=tu(js),eu=tu(Xs);function tu(e){return e&&e.__esModule?e:{default:e}}function nu(e){e=e||{};var t,n=this.context,r=e.events,i=e.eventBus,a=e.dashConstants,o=e.streamInfo,s=e.type,u=void 0;function l(e){return e?e.segments?u[a.SEGMENT_BASE]:u[e.segmentInfoType]:null}return t={initialize:function(t){u[a.SEGMENT_TIMELINE]=(0,Zs.default)(n).create(e,t),u[a.SEGMENT_TEMPLATE]=(0,$s.default)(n).create(e,t),u[a.SEGMENT_LIST]=(0,Js.default)(n).create(e,t),u[a.SEGMENT_BASE]=(0,eu.default)(n).create(e,t)},update:function(e,t,n,a){n||i.trigger(r.SEGMENTBASE_INIT_REQUEST_NEEDED,{streamId:o.id,mediaType:s,mimeType:t,representation:e}),a||i.trigger(r.SEGMENTBASE_SEGMENTSLIST_REQUEST_NEEDED,{streamId:o.id,mediaType:s,mimeType:t,representation:e})},getSegmentByIndex:function(e,t,n){var r=l(e);return r?r.getSegmentByIndex(e,t,n):null},getSegmentByTime:function(e,t){var n=l(e);return n?n.getSegmentByTime(e,t):null}},u={},t}nu.__dashjs_factory_name="SegmentsController";var ru=Qs.default.getClassFactory(nu),iu=Object.defineProperty({default:ru},"__esModule",{value:!0}),au=uu(ve),ou=uu(S),su=uu(iu);function uu(e){return e&&e.__esModule?e:{default:e}}function lu(e){e=e||{};var t=this.context,n=e.eventBus,r=e.events,i=e.debug,a=e.dashConstants,o=e.urlUtils,s=e.type,u=e.streamInfo,l=e.timelineConverter,d=e.dashMetrics,f=e.baseURLController,c=void 0,g=void 0,h=void 0,p=void 0,_=void 0,m=void 0,E=void 0,v=void 0,y=void 0;function T(){return s}function A(){h=-1,p=null}function S(){A(),_=null,y=null,v=null}function I(e,t,n){var r=f.resolve(n.path),i=void 0,a=void 0;return r&&t!==r.url&&o.isRelative(t)?(i=r.url,a=r.serviceLocation,t&&(i=o.resolve(t,i))):i=t,!o.isRelative(i)&&(e.url=i,e.serviceLocation=a,!0)}function R(e){var t,i,a;t=e.representation,i=t.hasInitialization(),a=t.hasSegments(),i&&a?n.trigger(r.REPRESENTATION_UPDATE_COMPLETED,{representation:t},{streamId:u.id,mediaType:s}):y.update(t,v,i,a)}function b(e,t){if(null==t)return null;var n=new au.default,r=t.representation,i=r.adaptation.period.mpd.manifest.Period_asArray[r.adaptation.period.index].AdaptationSet_asArray[r.adaptation.index].Representation_asArray[r.index].bandwidth,a=t.media;return a=(0,Rs.replaceTokenForTemplate)(a,"Number",t.replacementNumber),a=(0,Rs.replaceTokenForTemplate)(a,"Time",t.replacementTime),a=(0,Rs.replaceTokenForTemplate)(a,"Bandwidth",i),a=(0,Rs.replaceIDForTemplate)(a,r.id),a=(0,Rs.unescapeDollarsInTemplate)(a),n.mediaType=T(),n.type=pe.HTTPRequest.MEDIA_SEGMENT_TYPE,n.range=t.mediaRange,n.startTime=t.presentationStartTime,n.mediaStartTime=t.mediaStartTime,n.duration=t.duration,n.timescale=r.timescale,n.availabilityStartTime=t.availabilityStartTime,n.availabilityEndTime=t.availabilityEndTime,n.wallStartTime=t.wallStartTime,n.quality=r.index,n.index=t.availabilityIdx,n.mediaInfo=e,n.adaptationIndex=r.adaptation.index,n.representationId=r.id,I(n,a,r)?n:void 0}function N(e){var t=!1;if(!e)return t;if(m){if(E)t=!0;else if(p){var n=parseFloat((p.presentationStartTime-e.adaptation.period.start).toFixed(5));t=(p.duration>0?n+1.5*p.duration:n)>=e.adaptation.period.duration}}else h>=e.availableSegmentsNumber&&(t=!0);return t}function M(e){var t=e.representation;t.segments&&n.trigger(r.REPRESENTATION_UPDATE_COMPLETED,{representation:t},{streamId:u.id,mediaType:s})}function D(e){if(!e.error){var t,i=e.segments,a=e.representation,o=[],f=0,c=void 0,g=void 0,h=void 0;for(c=0,t=i?i.length:0;c<t;c++)g=i[c],(h=(0,Rs.getTimeBasedSegment)(l,m,a,g.startTime,g.duration,g.timescale,g.media,g.mediaRange,f))&&(o.push(h),h=null,f++);if(o.length>0)if(a.segmentAvailabilityRange={start:o[0].presentationStartTime,end:o[o.length-1].presentationStartTime},a.availableSegmentsNumber=o.length,a.segments=o,m)!function(e){l.setExpectedLiveEdge(e),d.updateManifestUpdateInfo({presentationStartTime:e})}(o[o.length-1].presentationStartTime-8);a.hasInitialization()&&n.trigger(r.REPRESENTATION_UPDATE_COMPLETED,{representation:a},{streamId:u.id,mediaType:s})}}function C(){g.debug("Dynamic stream complete"),E=!0}return c={initialize:function(e){m=e,E=!1,y.initialize(e)},getStreamId:function(){return u.id},getType:T,getStreamInfo:function(){return u},getInitRequest:function(e,t){return t?function(e,t,n){var r=new au.default,i=t.adaptation.period,a=i.start;if(r.mediaType=n,r.type=pe.HTTPRequest.INIT_SEGMENT_TYPE,r.range=t.range,r.availabilityStartTime=l.calcAvailabilityStartTimeFromPresentationTime(a,i.mpd,m),r.availabilityEndTime=l.calcAvailabilityEndTimeFromPresentationTime(a+i.duration,i.mpd,m),r.quality=t.index,r.mediaInfo=e,r.representationId=t.id,I(r,t.initialization,t))return r.url=(0,Rs.replaceTokenForTemplate)(r.url,"Bandwidth",t.bandwidth),r}(e,t,T()):null},getRequestForSegment:b,getSegmentRequestForTime:function(e,t,n,r){var i=null;if(!t||!t.segmentInfoType)return i;var o=h,u=!!r&&r.keepIdx,l=!(!r||!r.ignoreIsFinished);_!==n&&(_=n,g.debug("Getting the request for time : "+n));var d=y.getSegmentByTime(t,n);return d?(h=d.availabilityIdx,p=d,g.debug("Index for time "+n+" is "+h),i=b(e,d)):!l&&N(t)&&((i=new au.default).action=au.default.ACTION_COMPLETE,i.index=h-1,i.mediaType=s,i.mediaInfo=e,g.debug("Signal complete in getSegmentRequestForTime")),u&&o>=0&&(h=t.segmentInfoType===a.SEGMENT_TIMELINE&&m?h:o),i},getNextSegmentRequest:function(e,t){var n=null;if(!t||!t.segmentInfoType)return null;_=null;var r=h+1;g.debug("Getting the next request at index: "+r);var i=y.getSegmentByIndex(t,r,p?p.mediaStartTime:-1);return i||!function(e){return!isFinite(e.adaptation.period.duration)}(t)||E?(i?(n=b(e,i),h=i.availabilityIdx):h=m?r-1:r,i?p=i:N(t)&&((n=new au.default).action=au.default.ACTION_COMPLETE,n.index=h-1,n.mediaType=T(),n.mediaInfo=e,g.debug("Signal complete")),n):(g.debug(T()+" No segment found at index: "+r+". Wait for next loop"),null)},setCurrentIndex:function(e){h=e},getCurrentIndex:function(){return h},isMediaFinished:N,reset:function(){S(),n.off(r.INITIALIZATION_LOADED,M,c),n.off(r.SEGMENTS_LOADED,D,c),n.off(r.REPRESENTATION_UPDATE_STARTED,R,c),n.off(r.DYNAMIC_TO_STATIC,C,c)},resetIndex:A,setMimeType:function(e){v=e},getNextSegmentRequestIdempotent:function(e,t){var n=h+1,r=y.getSegmentByIndex(t,n,p?p.mediaStartTime:-1);return r?b(e,r):null}},g=i.getLogger(c),S(),y=(0,su.default)(t).create(e),n.on(r.INITIALIZATION_LOADED,M,c),n.on(r.SEGMENTS_LOADED,D,c),n.on(r.REPRESENTATION_UPDATE_STARTED,R,c),n.on(r.DYNAMIC_TO_STATIC,C,c),c}lu.__dashjs_factory_name="DashHandler";var du=ou.default.getClassFactory(lu),fu=Object.defineProperty({default:du},"__esModule",{value:!0}),cu=function(e){return e&&e.__esModule?e:{default:e}}(S);function gu(){return{modifyRequestURL:function(e){return e},modifyRequestHeader:function(e){return e}}}gu.__dashjs_factory_name="RequestModifier";var hu=cu.default.getSingletonFactory(gu),pu=Object.defineProperty({default:hu},"__esModule",{value:!0}),_u=function(e){return e&&e.__esModule?e:{default:e}}(S);function mu(){var e=void 0,t=/^[a-z][a-z0-9+\-_.]*:/i,n=/^https?:\/\//i,r=/^https:\/\//i,i=/^([a-z][a-z0-9+\-_.]*:\/\/[^\/]+)\/?/i,a=function(e,t){try{return new window.URL(e,t).toString()}catch(t){return e}},o=function(e,t){var n=s;if(!t)return e;if(!d(e))return e;f(e)&&(n=u),c(e)&&(n=l);var r=n(t),i="/"!==r.charAt(r.length-1)&&"/"!==e.charAt(0)?"/":"";return[r,e].join(i)};function s(e){var t=e.indexOf("/"),n=e.lastIndexOf("/");return-1!==t?n===t+1?e:(-1!==e.indexOf("?")&&(e=e.substring(0,e.indexOf("?"))),e.substring(0,n+1)):""}function u(e){var t=e.match(i);return t?t[1]:""}function l(e){var n=e.match(t);return n?n[0]:""}function d(e){return!t.test(e)}function f(e){return d(e)&&"/"===e.charAt(0)}function c(e){return 0===e.indexOf("//")}return function(){try{new window.URL("x","http://y");e=a}catch(e){}finally{e=e||o}}(),{parseBaseUrl:s,parseOrigin:u,parseScheme:l,isRelative:d,isPathAbsolute:f,isSchemeRelative:c,isHTTPURL:function(e){return n.test(e)},isHTTPS:function(e){return r.test(e)},removeHostname:function(e){return/^(?:\w+\:\/\/)?([^\/]+)(.*)$/.exec(e)[2].substring(1)},resolve:function(t,n){return e(t,n)}}}mu.__dashjs_factory_name="DefaultURLUtils";var Eu=_u.default.getSingletonFactory(mu),vu=Object.defineProperty({default:Eu},"__esModule",{value:!0}),yu=Au(S),Tu=Au(vu);function Au(e){return e&&e.__esModule?e:{default:e}}function Su(){var e=void 0,t=[],n=this.context;function r(n,r,i){var a=function(n){var r=void 0;for(r=0;r<t.length;r++){if(t[r].regex.test(n))return t[r].utils}return e}(i||r);return a&&"function"==typeof a[n]?a[n](r,i):e[n](r,i)}return e=(0,Tu.default)(n).getInstance(),{registerUrlRegex:function(e,n){t.push({regex:e,utils:n})},parseBaseUrl:function(e){return r("parseBaseUrl",e)},parseOrigin:function(e){return r("parseOrigin",e)},parseScheme:function(e){return r("parseScheme",e)},isRelative:function(e){return r("isRelative",e)},isPathAbsolute:function(e){return r("isPathAbsolute",e)},isSchemeRelative:function(e){return r("isSchemeRelative",e)},isHTTPURL:function(e){return r("isHTTPURL",e)},isHTTPS:function(e){return r("isHTTPS",e)},removeHostname:function(e){return r("removeHostname",e)},resolve:function(e,t){return r("resolve",e,t)}}}Su.__dashjs_factory_name="URLUtils";var Iu=yu.default.getSingletonFactory(Su),Ru=Object.defineProperty({default:Iu},"__esModule",{value:!0});function bu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Nu=function e(){bu(this,e),this.start=null,this.mstart=null,this.starttype=null,this.trace=[]};Nu.INITIAL_PLAYOUT_START_REASON="initial_playout",Nu.SEEK_START_REASON="seek",Nu.RESUME_FROM_PAUSE_START_REASON="resume",Nu.METRICS_COLLECTION_START_REASON="metrics_collection_start";var Mu=function e(){bu(this,e),this.representationid=null,this.subreplevel=null,this.start=null,this.mstart=null,this.duration=null,this.playbackspeed=null,this.stopreason=null};Mu.REPRESENTATION_SWITCH_STOP_REASON="representation_switch",Mu.REBUFFERING_REASON="rebuffering",Mu.USER_REQUEST_STOP_REASON="user_request",Mu.END_OF_PERIOD_STOP_REASON="end_of_period",Mu.END_OF_CONTENT_STOP_REASON="end_of_content",Mu.METRICS_COLLECTION_STOP_REASON="metrics_collection_end",Mu.FAILURE_STOP_REASON="failure";var Du=Nu,Cu=Mu,Ou=Object.defineProperty({PlayList:Du,PlayListTrace:Cu},"__esModule",{value:!0}),wu=$u(p),Pu=$u(E),Lu=$u(T),Fu=$u(be),xu=$u(go),Uu=$u(Lo),Bu=$u(Jo),ku=$u(os),Gu=$u(cs),qu=$u(S),Yu=$u(x),ju=$u(q),Hu=$u(fu),Ku=$u(Bt),Vu=$u(Me),zu=$u(ee),Wu=$u(pu),Xu=$u(Ru),Qu=$u(Qe),Zu=$u(ve);function $u(e){return e&&e.__esModule?e:{default:e}}function Ju(e){e=e||{};var t=this.context,n=(0,Yu.default)(t).getInstance(),r=e.streamInfo,i=e.type,a=e.errHandler,o=e.mimeType,s=e.timelineConverter,u=e.adapter,l=e.manifestModel,d=e.mediaPlayerModel,f=e.fragmentModel,c=e.abrController,g=e.playbackController,h=e.mediaController,p=e.textController,_=e.dashMetrics,m=e.settings,E=e.boxParser,v=void 0,y=void 0,T=void 0,A=void 0,S=void 0,I=void 0,R=void 0,b=void 0,N=void 0,M=void 0,D=void 0,C=void 0;function O(){return i}function w(){S=[],A=null,D=0}function P(e){(e.error||R.setCurrentRepresentation(u.convertDataToRepresentationInfo(e.currentRepresentation)),e.error&&e.error.code!==Ku.default.SEGMENTS_UPDATE_FAILED_ERROR_CODE)||g.getStreamController().getActiveStreamInfo().id===r.id&&k()}function L(e){var t=j(e.newQuality);R.setCurrentRepresentation(t),_.pushPlayListTraceMetrics(new Date,Ou.PlayListTrace.REPRESENTATION_SWITCH_STOP_REASON),_.createPlaylistTraceMetrics(t.id,1e3*g.getTime(),g.getPlaybackRate())}function F(e){_.addBufferLevel(i,new Date,1e3*e.bufferLevel);var t=g.getStreamController().getActiveStreamInfo().id;l.getValue().doNotUpdateDVRWindowOnBufferUpdated||r.id!==t||k()}function x(e){_.addBufferState(i,e.state,R.getBufferTarget()),e.state!==Lu.default.BUFFER_EMPTY||g.isSeeking()||_.pushPlayListTraceMetrics(new Date,Ou.PlayListTrace.REBUFFERING_REASON)}function U(e){f.syncExecutedRequestsWithBufferedRange(I.getBuffer().getAllBufferRanges(),r.duration),e.from>g.getTime()&&(D=e.from,C=!0)}function B(e){D=e.quotaExceededTime,C=!0}function k(){var e=r.manifestInfo,t=e.isDynamic,n=s.calcSegmentAvailabilityRange(b.getCurrentRepresentation(),t);_.addDVRInfo(O(),g.getTime(),e,n)}function G(){return I?I.getBuffer():null}function q(){return S}function Y(){return A}function j(e){var t=void 0;return void 0!==e?((0,rt.checkInteger)(e),t=b?b.getRepresentationForQuality(e):null):t=b?b.getCurrentRepresentation():null,u.convertDataToRepresentationInfo(t)}function H(e){if(e.sender&&(!u.getIsTextTrack(o)||p.isTextEnabled())&&I&&e.representationId&&!I.appendInitSegment(e.representationId)){var t=M?M.getInitRequest(Y(),b.getCurrentRepresentation()):null;R.processInitRequest(t)}}function K(e){var t=void 0;I.getIsPruningInProgress()||(t=function(e,t){var n=j(),r=!isNaN(e),i=g.getNormalizedTime(),a=r?e:D,o=!1,s=void 0;if(isNaN(a)||O()===wu.default.FRAGMENTED_TEXT&&!p.isTextEnabled())return null;if(I){var u=I.getRangeAt(a),l=I.getRangeAt(i);if((null!==u||null!==l)&&!r)if(!u||l&&l.start!=u.start&&l.end!=u.end)I.getBuffer().hasDiscontinuitiesAfter(i)&&O()!==wu.default.FRAGMENTED_TEXT&&(f.removeExecutedRequestsAfterTime(l.end),o=!0)}if(t)a=t.startTime+t.duration/2,s=W(n,a,{timeThreshold:0,ignoreIsFinished:!0});else{var d=r||C||o;for(s=W(n,d?a:void 0,{keepIdx:!d}),C=!1;s&&s.action!==Zu.default.ACTION_COMPLETE&&f.isFragmentLoaded(s);)s=W(n)}return s}(e.seekTarget,e.replacement))&&(R.setSeekTarget(NaN),e.replacement||(isNaN(t.startTime+t.duration)||(D=t.startTime+t.duration),t.delayLoadingTime=(new Date).getTime()+R.getTimeToLoadDelay(),R.setTimeToLoadDelay(0))),R.processMediaRequest(t)}function V(e){var i=e.chunk,a=i.bytes,o=i.quality,s=j(o),l=b&&s?b.getRepresentationForQuality(s.quality):null,d=u.getEventsFor(s.mediaInfo),c=u.getEventsFor(s,l);if(d&&d.length>0||c&&c.length>0){var g=function(e,n,r,i){try{for(var a={},o=[],s=r.concat(i),l=0,d=s.length;l<d;l++)a[s[l].schemeIdUri+"/"+s[l].value]=s[l];var f=(0,Qu.default)(t).getInstance().parse(e),c=f.getBoxes("emsg");if(!c||0===c.length)return o;for(var g=f.getBox("sidx"),h=!g||isNaN(g.earliest_presentation_time)||isNaN(g.timescale)?n&&!isNaN(n.mediaStartTime)?n.mediaStartTime:0:g.earliest_presentation_time/g.timescale,p=Math.max(h,0),_=b.getCurrentRepresentation(),m=0,E=c.length;m<E;m++){var v=u.getEvent(c[m],a,p,_);v&&o.push(v)}return o}catch(e){return[]}}(a,f.getRequests({state:Fu.default.FRAGMENT_MODEL_EXECUTED,quality:o,index:i.index})[0],d,c);n.trigger(ju.default.INBAND_EVENTS,{events:g},{streamId:r.id})}}function z(e){D=e.time,R.setSeekTarget(e.time)}function W(e,t,n){var r=null;if(M){var i=b&&e?b.getRepresentationForQuality(e.quality):null;r=void 0!==t&&void 0!==n?M.getSegmentRequestForTime(Y(),i,t,n):M.getNextSegmentRequest(Y(),i)}return r}return v={initialize:function(y,A){M=(0,Hu.default)(t).create({streamInfo:r,type:i,timelineConverter:s,dashMetrics:_,mediaPlayerModel:d,baseURLController:e.baseURLController,errHandler:a,settings:m,boxParser:E,events:ju.default,eventBus:n,errors:Ku.default,debug:(0,zu.default)(t).getInstance(),requestModifier:(0,Wu.default)(t).getInstance(),dashConstants:Pu.default,constants:wu.default,urlUtils:(0,Xu.default)(t).getInstance()}),(T=r.manifestInfo.isDynamic)&&(N=(0,Gu.default)(t).create({timelineConverter:s})),M.initialize(T),c.registerStreamType(i,v),b=(0,ku.default)(t).create({streamInfo:r,type:i,abrController:c,dashMetrics:_,playbackController:g,timelineConverter:s,dashConstants:Pu.default,events:ju.default,eventBus:n,errors:Ku.default}),(I=function(e){var n=null;if(!e)return a.error(new Vu.default(Ku.default.MEDIASOURCE_TYPE_UNSUPPORTED_CODE,Ku.default.MEDIASOURCE_TYPE_UNSUPPORTED_MESSAGE+"not properly defined")),null;n=e===wu.default.VIDEO||e===wu.default.AUDIO?(0,xu.default)(t).create({streamInfo:r,type:e,mediaPlayerModel:d,manifestModel:l,fragmentModel:f,errHandler:a,mediaController:h,representationController:b,adapter:u,textController:p,abrController:c,playbackController:g,settings:m}):(0,Uu.default)(t).create({streamInfo:r,type:e,mimeType:o,mediaPlayerModel:d,manifestModel:l,fragmentModel:f,errHandler:a,mediaController:h,representationController:b,adapter:u,textController:p,abrController:c,playbackController:g,settings:m});return n}(i))&&I.initialize(y),(R=(0,Bu.default)(t).create({streamInfo:r,type:i,mimeType:o,adapter:u,dashMetrics:_,mediaPlayerModel:d,fragmentModel:f,abrController:c,playbackController:g,textController:p,mediaController:h,bufferController:I,settings:m})).initialize(A),D=0,C=!1},getStreamId:function(){return r.id},getType:O,isUpdating:function(){return!!b&&b.isUpdating()},getBufferController:function(){return I},getFragmentModel:function(){return f},getScheduleController:function(){return R},getRepresentationController:function(){return b},getRepresentationInfo:j,getBufferLevel:function(){return I?I.getBufferLevel():0},isBufferingCompleted:function(){return!!I&&I.getIsBufferingCompleted()},createBuffer:function(e){return G()||I?I.createBuffer(S,e):null},updateStreamInfo:function(e){r=e,m.get().streaming.useAppendWindow&&I.updateAppendWindow()},getStreamInfo:function(){return r},selectMediaInfo:function(e){e===A||e&&A&&e.type!==A.type||(A=e);var t=u.getRealAdaptation(r,A),n=u.getVoRepresentations(A);if(b){var a=b.getData(),o=c.getTopQualityIndexFor(i,r.id),s=c.getMinAllowedIndexFor(i),l=void 0,d=null;null!==a&&a.id==t.id||i===wu.default.FRAGMENTED_TEXT?l=c.getQualityFor(i):(d=c.getThroughputHistory().getAverageThroughput(i)||c.getInitialBitrateFor(i),l=c.getQualityForBitrate(A,d)),void 0!==s&&l<s&&(l=s),l>o&&(l=o),M.setMimeType(A?A.mimeType:null),b.updateData(t,n,i,l)}},addMediaInfo:function(e,t){-1===S.indexOf(e)&&S.push(e),t&&this.selectMediaInfo(e)},getLiveStartTime:function(){if(!T)return NaN;if(!N)return NaN;var e=NaN,t=j(),n=N.getLiveEdge(t);if(isNaN(n))return NaN;var i=function(e,t){try{var n=null,i=g.getLiveDelay(),a=isNaN(r.manifestInfo.DVRWindowSize)?i:r.manifestInfo.DVRWindowSize,o=.1*a,s=void 0;if(!isFinite(a)||W(t,e-a+o,{ignoreIsFinished:!0}))for(;!n&&i<=a;)(n=W(t,s=e-i,{ignoreIsFinished:!0}))||(i+=1);return n&&g.setLiveDelay(i,!0),y.debug("live edge: "+e+", live delay: "+i+", live target: "+s),n}catch(e){return null}}(n,t);return i&&(e=m.get().streaming.lowLatencyEnabled?i.duration<d.getLiveDelay()?i.startTime:i.startTime+i.duration-d.getLiveDelay():i.startTime),e},switchTrackAsked:function(){R.switchTrackAsked()},getMediaInfoArr:q,getMediaInfo:Y,getMediaSource:function(){return I.getMediaSource()},setMediaSource:function(e){I.setMediaSource(e,q())},dischargePreBuffer:function(){I.dischargePreBuffer()},getBuffer:G,setBuffer:function(e){I.setBuffer(e)},setBufferingTime:function(e){D=e},resetIndexHandler:function(){M&&M.resetIndex()},getInitRequest:function(e){(0,rt.checkInteger)(e);var t=b?b.getRepresentationForQuality(e):null;return M?M.getInitRequest(Y(),t):null},getFragmentRequest:W,finalisePlayList:function(e,t){_.pushPlayListTraceMetrics(e,t)},probeNextRequest:function(){var e=j(),t=b&&e?b.getRepresentationForQuality(e.quality):null;return M.getNextSegmentRequestIdempotent(Y(),t)},reset:function(e,t){M&&M.reset(),I&&(I.reset(e,t),I=null),R&&(R.reset(),R=null),b&&(b.reset(),b=null),N&&(N.reset(),N=null),c&&!t&&c.unRegisterStreamType(i),n.off(ju.default.DATA_UPDATE_COMPLETED,P,v),n.off(ju.default.QUALITY_CHANGE_REQUESTED,L,v),n.off(ju.default.INIT_FRAGMENT_NEEDED,H,v),n.off(ju.default.MEDIA_FRAGMENT_NEEDED,K,v),n.off(ju.default.MEDIA_FRAGMENT_LOADED,V,v),n.off(ju.default.BUFFER_LEVEL_UPDATED,F,v),n.off(ju.default.BUFFER_LEVEL_STATE_CHANGED,x,v),n.off(ju.default.BUFFER_CLEARED,U,v),n.off(ju.default.SEEK_TARGET,z,v),w(),i=null,r=null}},y=(0,zu.default)(t).getInstance().getLogger(v),w(),n.on(ju.default.DATA_UPDATE_COMPLETED,P,v,{priority:Yu.default.EVENT_PRIORITY_HIGH}),n.on(ju.default.QUALITY_CHANGE_REQUESTED,L,v),n.on(ju.default.INIT_FRAGMENT_NEEDED,H,v),n.on(ju.default.MEDIA_FRAGMENT_NEEDED,K,v),n.on(ju.default.MEDIA_FRAGMENT_LOADED,V,v),n.on(ju.default.BUFFER_LEVEL_UPDATED,F,v),n.on(ju.default.BUFFER_LEVEL_STATE_CHANGED,x,v),n.on(ju.default.BUFFER_CLEARED,U,v),n.on(ju.default.QUOTA_EXCEEDED,B,v),n.on(ju.default.SEEK_TARGET,z,v),v}Ju.__dashjs_factory_name="StreamProcessor";var el=qu.default.getClassFactory(Ju),tl=Object.defineProperty({default:el},"__esModule",{value:!0});var nl=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.streamId=null,this.mediaInfo=null,this.segmentType=null,this.quality=NaN,this.index=NaN,this.bytes=null,this.start=NaN,this.end=NaN,this.duration=NaN,this.representationId=null,this.endFragment=null},rl=Object.defineProperty({default:nl},"__esModule",{value:!0}),il=function(e){return e&&e.__esModule?e:{default:e}}(S);function al(e){var t=(e=e||{}).requestModifier;return{load:function(e){var n=new Date,r=e.request,i=new XMLHttpRequest;if(i.open(e.method,e.url,!0),r.responseType&&(i.responseType=r.responseType),r.range&&i.setRequestHeader("Range","bytes="+r.range),r.requestStartDate||(r.requestStartDate=n),t&&(i=t.modifyRequestHeader(i)),e.headers)for(var a in e.headers){var o=e.headers[a];o&&i.setRequestHeader(a,o)}i.withCredentials=e.withCredentials,i.onload=e.onload,i.onloadend=e.onend,i.onerror=e.onerror,i.onprogress=e.progress,i.onabort=e.onabort,i.ontimeout=e.ontimeout,i.timeout=e.timeout,i.send(),e.response=i},abort:function(e){var t=e.response;t.onloadend=t.onerror=t.onprogress=void 0,t.abort()}}}al.__dashjs_factory_name="XHRLoader";var ol=il.default.getClassFactory(al),sl=Object.defineProperty({default:ol},"__esModule",{value:!0}),ul="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ll=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var dl=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return ll(e,null,[{key:"mixin",value:function(t,n,r){var i=void 0,a={};if(t)for(var o in n)n.hasOwnProperty(o)&&(i=n[o],o in t&&(t[o]===i||o in a&&a[o]===i)||("object"===ul(t[o])&&null!==t[o]?t[o]=e.mixin(t[o],i,r):t[o]=r(i)));return t}},{key:"clone",value:function(t){if(!t||"object"!==(void 0===t?"undefined":ul(t)))return t;var n=void 0;if(t instanceof Array){n=[];for(var r=0,i=t.length;r<i;++r)r in t&&n.push(e.clone(t[r]))}else n={};return e.mixin(n,t,e.clone)}},{key:"addAditionalQueryParameterToUrl",value:function(e,t){try{if(!t||0===t.length)return e;var n=new URL(e);return t.forEach((function(e){e.key&&e.value&&n.searchParams.set(e.key,e.value)})),n.href}catch(t){return e}}},{key:"parseHttpHeaders",value:function(e){var t={};if(!e)return t;for(var n=e.trim().split("\r\n"),r=0,i=n.length;r<i;r++){var a=n[r],o=a.indexOf(": ");o>0&&(t[a.substring(0,o)]=a.substring(o+2))}return t}},{key:"generateUuid",value:function(){var e=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?n:3&n|8).toString(16)}))}},{key:"generateHashCode",value:function(e){var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++){t=(t<<5)-t+e.charCodeAt(n),t|=0}return t}}]),e}(),fl=Object.defineProperty({default:dl},"__esModule",{value:!0}),cl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gl=ml(S),hl=ml(fl),pl=ml(ee),_l=ml(p);function ml(e){return e&&e.__esModule?e:{default:e}}function El(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vl(){var e,t,n={debug:{logLevel:pl.default.LOG_LEVEL_WARNING,dispatchEvent:!1},streaming:{metricsMaxListDepth:1e3,abandonLoadTimeout:1e4,liveDelayFragmentCount:NaN,liveDelay:null,scheduleWhilePaused:!0,fastSwitchEnabled:!1,flushBufferAtTrackSwitch:!1,calcSegmentAvailabilityRangeFromTimeline:!1,reuseExistingSourceBuffers:!0,bufferPruningInterval:10,bufferToKeep:20,jumpGaps:!0,jumpLargeGaps:!0,smallGapLimit:1.5,stableBufferTime:12,bufferTimeAtTopQuality:30,bufferTimeAtTopQualityLongForm:60,longFormContentDurationThreshold:600,wallclockTimeUpdateInterval:50,lowLatencyEnabled:!1,keepProtectionMediaKeys:!1,useManifestDateHeaderTimeSource:!0,useSuggestedPresentationDelay:!0,useAppendWindow:!0,manifestUpdateRetryInterval:100,stallThreshold:.5,filterUnsupportedEssentialProperties:!0,eventControllerRefreshDelay:100,utcSynchronization:{backgroundAttempts:2,timeBetweenSyncAttempts:30,maximumTimeBetweenSyncAttempts:600,minimumTimeBetweenSyncAttempts:2,timeBetweenSyncAttemptsAdjustmentFactor:2,maximumAllowedDrift:100,enableBackgroundSyncAfterSegmentDownloadError:!0,defaultTimingSource:{scheme:"urn:mpeg:dash:utc:http-xsdate:2014",value:"http://time.akamai.com/?iso&ms"}},liveCatchup:{minDrift:.02,maxDrift:0,playbackRate:.5,latencyThreshold:60,playbackBufferMin:.5,enabled:!1,mode:_l.default.LIVE_CATCHUP_MODE_DEFAULT},lastBitrateCachingInfo:{enabled:!0,ttl:36e4},lastMediaSettingsCachingInfo:{enabled:!0,ttl:36e4},cacheLoadThresholds:{video:50,audio:5},trackSwitchMode:{audio:_l.default.TRACK_SWITCH_MODE_ALWAYS_REPLACE,video:_l.default.TRACK_SWITCH_MODE_NEVER_REPLACE},selectionModeForInitialTrack:_l.default.TRACK_SELECTION_MODE_HIGHEST_BITRATE,fragmentRequestTimeout:0,retryIntervals:(e={},El(e,pe.HTTPRequest.MPD_TYPE,500),El(e,pe.HTTPRequest.XLINK_EXPANSION_TYPE,500),El(e,pe.HTTPRequest.MEDIA_SEGMENT_TYPE,1e3),El(e,pe.HTTPRequest.INIT_SEGMENT_TYPE,1e3),El(e,pe.HTTPRequest.BITSTREAM_SWITCHING_SEGMENT_TYPE,1e3),El(e,pe.HTTPRequest.INDEX_SEGMENT_TYPE,1e3),El(e,pe.HTTPRequest.MSS_FRAGMENT_INFO_SEGMENT_TYPE,1e3),El(e,pe.HTTPRequest.OTHER_TYPE,1e3),El(e,"lowLatencyReductionFactor",10),e),retryAttempts:(t={},El(t,pe.HTTPRequest.MPD_TYPE,3),El(t,pe.HTTPRequest.XLINK_EXPANSION_TYPE,1),El(t,pe.HTTPRequest.MEDIA_SEGMENT_TYPE,3),El(t,pe.HTTPRequest.INIT_SEGMENT_TYPE,3),El(t,pe.HTTPRequest.BITSTREAM_SWITCHING_SEGMENT_TYPE,3),El(t,pe.HTTPRequest.INDEX_SEGMENT_TYPE,3),El(t,pe.HTTPRequest.MSS_FRAGMENT_INFO_SEGMENT_TYPE,3),El(t,pe.HTTPRequest.OTHER_TYPE,3),El(t,"lowLatencyMultiplyFactor",5),t),abr:{movingAverageMethod:_l.default.MOVING_AVERAGE_SLIDING_WINDOW,ABRStrategy:_l.default.ABR_STRATEGY_DYNAMIC,bandwidthSafetyFactor:.9,useDefaultABRRules:!0,useDeadTimeLatency:!0,limitBitrateByPortal:!1,usePixelRatioInLimitBitrateByPortal:!1,maxBitrate:{audio:-1,video:-1},minBitrate:{audio:-1,video:-1},maxRepresentationRatio:{audio:1,video:1},initialBitrate:{audio:-1,video:-1},initialRepresentationRatio:{audio:-1,video:-1},autoSwitchBitrate:{audio:!0,video:!0},fetchThroughputCalculationMode:_l.default.ABR_FETCH_THROUGHPUT_CALCULATION_DOWNLOADED_DATA},cmcd:{enabled:!1,sid:null,cid:null,rtp:null,rtpSafetyFactor:5,mode:_l.default.CMCD_MODE_QUERY}}},r=hl.default.clone(n);return{get:function(){return r},update:function(e){"object"===(void 0===e?"undefined":cl(e))&&function e(t,n,r){for(var i in t)t.hasOwnProperty(i)&&n.hasOwnProperty(i)&&("object"===cl(t[i])&&null!==t[i]?e(t[i],n[i],r.slice()+i+"."):n[i]=hl.default.clone(t[i]))}(e,r,"")},reset:function(){r=hl.default.clone(n)}}}vl.__dashjs_factory_name="Settings";var yl=gl.default.getSingletonFactory(vl),Tl=Object.defineProperty({default:yl},"__esModule",{value:!0}),Al=Rl(S),Sl=Rl(Tl),Il=Rl(p);function Rl(e){return e&&e.__esModule?e:{default:e}}function bl(e){e=e||{};var t=this.context,n=e.requestModifier,r=e.boxParser,i=(0,Sl.default)(t).getInstance();function a(e,t){e.reader.read().then(t).catch((function(t){e.onerror&&200===e.response.status&&e.onerror(t)}))}function o(e,t,n,r,i){switch(e){case Il.default.ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING:return function(e,t){try{var n,r;n=e.filter((function(t,n){return n>0&&n<e.length-1})),r=t.filter((function(e,n){return n>0&&n<t.length-1}));var i=0;if(n.length>1){for(var a=0;a<n.length;a++)if(n[a]&&r[a]){var o=r[a].ts-n[a].ts;i+=o}return i}return null}catch(e){return null}}(t,n);case Il.default.ABR_FETCH_THROUGHPUT_CALCULATION_DOWNLOADED_DATA:default:return s(r,i)}}function s(e,t){try{if((e=e.filter((function(n){return n.bytes>t/4/e.length}))).length>1){var n=0,r=(e[e.length-1].ts-e[0].ts)/e.length;return e.forEach((function(t,i){var a=e[i+1];if(a){var o=a.ts-t.ts;n+=o<r?o:0}})),n}return null}catch(e){return null}}return{load:function(e){var t=new Date,s=e.request,u=new Headers;if(s.range&&u.append("Range","bytes="+s.range),e.headers)for(var l in e.headers){var d=e.headers[l];d&&u.append(l,d)}s.requestStartDate||(s.requestStartDate=t),n&&n.modifyRequestHeader({setRequestHeader:function(e,t){u.append(e,t)}});var f=void 0;"function"==typeof window.AbortController&&(f=new AbortController,e.abortController=f,f.signal.onabort=e.onabort);var c={method:e.method,headers:u,credentials:e.withCredentials?"include":void 0,signal:f?f.signal:void 0};fetch(e.url,c).then((function(t){e.response||(e.response={}),e.response.status=t.status,e.response.statusText=t.statusText,e.response.responseURL=t.url,t.ok||e.onerror();var n="",s=!0,u=!1,l=void 0;try{for(var d,f=t.headers.keys()[Symbol.iterator]();!(s=(d=f.next()).done);s=!0){var c=d.value;n+=c+": "+t.headers.get(c)+"\r\n"}}catch(e){u=!0,l=e}finally{try{!s&&f.return&&f.return()}finally{if(u)throw l}}if(e.response.responseHeaders=n,!t.body)return t.arrayBuffer().then((function(t){e.response.response=t;var n={loaded:t.byteLength,total:t.byteLength,stream:!1};e.progress(n),e.onload(),e.onend()}));var g=parseInt(t.headers.get("Content-Length"),10),h=0,p=!1,_=new Uint8Array,m=0;e.reader=t.body.getReader();var E=[],v=[],y=[],T=!0,A=i.get().streaming.abr.fetchThroughputCalculationMode;a(e,(function t(n){var i=n.value;if(n.done)return _&&(e.progress({loaded:h,total:isNaN(g)?h:g,lengthComputable:!0,time:o(A,v,y,E,h),stream:!0}),e.response.response=_.buffer),e.onload(),void e.onend();if(i&&i.length>0){if(_=function(e,t){if(0===e.length)return t;var n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}(_,i),h+=i.length,E.push({ts:Date.now(),bytes:i.length}),A===Il.default.ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING&&T)r.findLastTopIsoBoxCompleted(["moof"],_,m).found&&(T=!1,v.push({ts:performance.now(),bytes:i.length}));var s=r.findLastTopIsoBoxCompleted(["moov","mdat"],_,m);if(s.found){var u=s.lastCompletedOffset+s.size;A===Il.default.ABR_FETCH_THROUGHPUT_CALCULATION_MOOF_PARSING&&(T=!0,y.push({ts:performance.now(),bytes:_.length}));var l=void 0;u===_.length?(l=_,_=new Uint8Array):(l=new Uint8Array(_.subarray(0,u)),_=_.subarray(u)),e.progress({data:l.buffer,lengthComputable:!1,noTrace:!0}),m=0}else m=s.lastCompletedOffset,p||(e.progress({lengthComputable:!1,noTrace:!0}),p=!0)}a(e,t)}))})).catch((function(t){e.onerror&&e.onerror(t)}))},abort:function(e){if(e.abortController)e.abortController.abort();else if(e.reader)try{e.reader.cancel(),e.onabort()}catch(e){}},calculateDownloadedTime:o}}bl.__dashjs_factory_name="FetchLoader";var Nl=Al.default.getClassFactory(bl),Ml=Object.defineProperty({default:Nl},"__esModule",{value:!0});var Dl=new(function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.METRICS_INITIALISATION_COMPLETE="internal_metricsReportingInitialized",e.BECAME_REPORTING_PLAYER="internal_becameReportingPlayer",e.CMCD_DATA_GENERATED="cmcdDataGenerated",e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(function(e){return e&&e.__esModule?e:{default:e}}(N).default)),Cl=Object.defineProperty({default:Dl},"__esModule",{value:!0}),Ol=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),wl=function(e){return e&&e.__esModule?e:{default:e}}(E);var Pl=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.id=null,this.index=-1,this.adaptation=null,this.segmentInfoType=null,this.initialization=null,this.codecs=null,this.codecPrivateData=null,this.segmentDuration=NaN,this.timescale=1,this.startNumber=1,this.indexRange=null,this.range=null,this.presentationTimeOffset=0,this.MSETimeOffset=NaN,this.segmentAvailabilityRange=null,this.availableSegmentsNumber=0,this.bandwidth=NaN,this.width=NaN,this.height=NaN,this.scanType=null,this.maxPlayoutRate=NaN,this.availabilityTimeOffset=0,this.availabilityTimeComplete=!0}return Ol(e,[{key:"hasInitialization",value:function(){return null!==this.initialization||null!==this.range}},{key:"hasSegments",value:function(){return this.segmentInfoType!==wl.default.BASE_URL&&this.segmentInfoType!==wl.default.SEGMENT_BASE&&!this.indexRange}}]),e}(),Ll=Object.defineProperty({default:Pl},"__esModule",{value:!0});var Fl=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.period=null,this.index=-1,this.type=null},xl=Object.defineProperty({default:Fl},"__esModule",{value:!0});var Ul=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.id=null,this.index=-1,this.duration=NaN,this.start=NaN,this.mpd=null};Ul.DEFAULT_ID="defaultId";var Bl=Ul,kl=Object.defineProperty({default:Bl},"__esModule",{value:!0});var Gl=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.manifest=null,this.suggestedPresentationDelay=0,this.availabilityStartTime=null,this.availabilityEndTime=Number.POSITIVE_INFINITY,this.timeShiftBufferDepth=Number.POSITIVE_INFINITY,this.maxSegmentDuration=Number.POSITIVE_INFINITY,this.publishTime=null,this.minimumUpdatePeriod=NaN,this.mediaPresentationDuration=NaN},ql=Object.defineProperty({default:Gl},"__esModule",{value:!0});var Yl=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.schemeIdUri="",this.value=""},jl=Object.defineProperty({default:Yl},"__esModule",{value:!0});var Hl=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.duration=NaN,this.presentationTime=NaN,this.id=NaN,this.messageData="",this.eventStream=null,this.presentationTimeDelta=NaN},Kl=Object.defineProperty({default:Hl},"__esModule",{value:!0});var Vl=function e(t,n,r,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.url=t||"",this.serviceLocation=n||t||"",this.dvb_priority=r||1,this.dvb_weight=i||1,this.availabilityTimeOffset=0,this.availabilityTimeComplete=!0};Vl.DEFAULT_DVB_PRIORITY=1,Vl.DEFAULT_DVB_WEIGHT=1;var zl=Vl,Wl=Object.defineProperty({default:zl},"__esModule",{value:!0});var Xl=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.adaptionSet=null,this.representation=null,this.period=null,this.timescale=1,this.value="",this.schemeIdUri="",this.presentationTimeOffset=0},Ql=Object.defineProperty({default:Xl},"__esModule",{value:!0}),Zl=Array.isArray,$l=Object.keys,Jl=Object.prototype.hasOwnProperty,ed=nd(S),td=nd((function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){var r,i,a,o=Zl(t),s=Zl(n);if(o&&s){if((i=t.length)!=n.length)return!1;for(r=i;0!=r--;)if(!e(t[r],n[r]))return!1;return!0}if(o!=s)return!1;var u=t instanceof Date,l=n instanceof Date;if(u!=l)return!1;if(u&&l)return t.getTime()==n.getTime();var d=t instanceof RegExp,f=n instanceof RegExp;if(d!=f)return!1;if(d&&f)return t.toString()==n.toString();var c=$l(t);if((i=c.length)!==$l(n).length)return!1;for(r=i;0!=r--;)if(!Jl.call(n,c[r]))return!1;for(r=i;0!=r--;)if(!e(t[a=c[r]],n[a]))return!1;return!0}return t!=t&&n!=n}));function nd(e){return e&&e.__esModule?e:{default:e}}function rd(){return{areEqual:function(e,t){return(0,td.default)(e,t)}}}rd.__dashjs_factory_name="ObjectUtils";var id=ed.default.getSingletonFactory(rd),ad=Object.defineProperty({default:id},"__esModule",{value:!0});var od=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.bitrate=0,this.width=0,this.height=0,this.tilesHor=0,this.tilesVert=0,this.widthPerTile=0,this.heightPerTile=0,this.startNumber=0,this.segmentDuration=0,this.timescale=0,this.templateUrl="",this.id=""},sd=Object.defineProperty({default:od},"__esModule",{value:!0}),ud=f((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.THUMBNAILS_SCHEME_ID_URIS=void 0;var n=f(p),r=f(E),i=f(S),a=f(sd),o=f(Ru),s=f(q),u=f(Qe),l=f(sl),d=f(fu);function f(e){return e&&e.__esModule?e:{default:e}}var c=t.THUMBNAILS_SCHEME_ID_URIS=["http://dashif.org/thumbnail_tile","http://dashif.org/guidelines/thumbnail_tile"];function g(e){var t,i=this.context,f=e.adapter,g=e.baseURLController,h=e.streamInfo,p=e.timelineConverter,_=e.debug,m=e.eventBus,E=e.events,v=e.dashConstants,y=(0,o.default)(i).getInstance(),T=void 0,A=void 0,S=void 0,I=void 0,R=void 0,b=void 0;function N(){D(),R=(0,l.default)(i).create({}),b=(0,u.default)(i).getInstance(),(A=(0,d.default)(i).create({streamInfo:h,timelineConverter:p,baseURLController:g,debug:_,eventBus:m,events:E,dashConstants:v,urlUtils:y})).initialize(!!f&&f.getIsDynamic()),function(){if(!h||!f)return;if(!(I=f.getMediaInfoForType(h,n.default.IMAGE)))return;var e=f.getVoRepresentations(I);e&&e.length>0&&e.forEach((function(e){(e.segmentInfoType===r.default.SEGMENT_TEMPLATE&&e.segmentDuration>0&&e.media||e.segmentInfoType===r.default.SEGMENT_TIMELINE)&&M(e),e.segmentInfoType===r.default.SEGMENT_BASE&&M(e,!0)}));T.length>0&&(T.sort((function(e,t){return e.bitrate-t.bitrate})),S=T.length-1)}()}function M(e,t){var r=new a.default;r.id=e.id,r.bitrate=e.bandwidth,r.width=e.width,r.height=e.height,r.tilesHor=1,r.tilesVert=1,e.essentialProperties&&e.essentialProperties.forEach((function(e){if(c.indexOf(e.schemeIdUri)>=0&&e.value){var t=e.value.split("x");2!==t.length||isNaN(t[0])||isNaN(t[1])||(r.tilesHor=parseInt(t[0],10),r.tilesVert=parseInt(t[1],10))}})),t?m.trigger(s.default.SEGMENTBASE_SEGMENTSLIST_REQUEST_NEEDED,{streamId:h.id,mediaType:n.default.IMAGE,mimeType:I.mimeType,representation:e,callback:function(e,t,n,i){var a=[];n=function(e,t){var n,r=[],i=0,a=void 0,o=void 0,s=void 0;for(a=0,n=e.length;a<n;a++)o=e[a],(s=(0,Rs.getTimeBasedSegment)(p,f.getIsDynamic(),t,o.startTime,o.duration,o.timescale,o.media,o.mediaRange,i))&&(r.push(s),s=null,i++);return r}(n,i),r.segmentDuration=n[0].duration,r.readThumbnail=function(e,t){var r=null;a.some((function(t){if(t.start<=e&&t.end>e)return r=t.url,!0})),r?t(r):n.some((function(n){if(n.mediaStartTime<=e&&n.mediaStartTime+n.duration>e){var r=g.resolve(i.path);return R.load({method:"get",url:r.url,request:{range:n.mediaRange,responseType:"arraybuffer"},onload:function(e){var r=b.getSamplesInfo(e.target.response),i=new Blob([e.target.response.slice(r.sampleList[0].offset,r.sampleList[0].offset+r.sampleList[0].size)],{type:"image/jpeg"}),o=window.URL.createObjectURL(i);a.push({start:n.mediaStartTime,end:n.mediaStartTime+n.duration,url:o}),t&&t(o)}}),!0}}))}}}):(r.startNumber=e.startNumber,r.segmentDuration=e.segmentDuration,r.timescale=e.timescale,r.templateUrl=function(e){var t=y.isRelative(e.media)?y.resolve(e.media,g.resolve(e.path).url):e.media;if(!t)return"";return(0,Rs.replaceIDForTemplate)(t,e.id)}(e)),r.tilesHor>0&&r.tilesVert>0&&(r.widthPerTile=r.width/r.tilesHor,r.heightPerTile=r.height/r.tilesVert,T.push(r))}function D(){T=[],S=-1,I=null}return t={initialize:N,getTracks:function(){return T},reset:D,setTrackByIndex:function(e){T&&0!==T.length&&(e>=T.length&&(e=T.length-1),S=e)},getCurrentTrack:function(){return S<0?null:T[S]},getCurrentTrackIndex:function(){return S},getThumbnailRequestForTime:function(e){for(var t=void 0,n=f.getVoRepresentations(I),r=0;r<n.length;r++)if(T[S].id===n[r].id){t=n[r];break}return A.getSegmentRequestForTime(I,t,e)}},N(),t}g.__dashjs_factory_name="ThumbnailTracks",t.default=i.default.getClassFactory(g)})),ld=Rd(p),dd=Rd(E),fd=Rd(Ll),cd=Rd(xl),gd=Rd(kl),hd=Rd(ql),pd=Rd(jl),_d=Rd(Kl),md=Rd(Wl),Ed=Rd(Ql),vd=Rd(ad),yd=Rd(Ru),Td=Rd(S),Ad=Rd(ee),Sd=Rd(Me),Id=Rd(Bt);function Rd(e){return e&&e.__esModule?e:{default:e}}function bd(){var e=void 0,t=void 0,n=void 0,r=void 0,i=this.context,a=(0,yd.default)(i).getInstance(),o=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e};function s(e,t){var n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,u=!1,l=!1;if(!e)throw new Error("adaptation is not defined");if(!t)throw new Error("type is not defined");if(e.hasOwnProperty("ContentComponent_asArray")&&(a=e.ContentComponent_asArray),o=t!==ld.default.TEXT?new RegExp(t):new RegExp("(vtt|ttml)"),e.Representation_asArray&&e.Representation_asArray.length&&e.Representation_asArray.length>0){var d=E(e.Representation_asArray[0]);if(d&&d.length>0&&ud.THUMBNAILS_SCHEME_ID_URIS.indexOf(d[0].schemeIdUri)>=0)return t===ld.default.IMAGE;if(e.Representation_asArray[0].hasOwnProperty(dd.default.CODECS)&&(0===(s=e.Representation_asArray[0].codecs).search(ld.default.STPP)||0===s.search(ld.default.WVTT)))return t===ld.default.FRAGMENTED_TEXT}if(a){if(a.length>1)return t===ld.default.MUXED;a[0]&&a[0].contentType===t&&(u=!0,l=!0)}if(e.hasOwnProperty(dd.default.MIME_TYPE)&&(u=o.test(e.mimeType),l=!0),!l)for(n=0,r=e.Representation_asArray&&e.Representation_asArray.length?e.Representation_asArray.length:0;!l&&n<r;)(i=e.Representation_asArray[n]).hasOwnProperty(dd.default.MIME_TYPE)&&(u=o.test(i.mimeType),l=!0),n++;return u}function u(e){return s(e,ld.default.AUDIO)}function l(e){return s(e,ld.default.VIDEO)}function d(e){return s(e,ld.default.FRAGMENTED_TEXT)}function f(e){return s(e,ld.default.IMAGE)}function c(e){return"text/vtt"===e||"application/ttml+xml"===e}function g(){return function(e,t){return e.bandwidth-t.bandwidth}}function h(e){return e&&Array.isArray(e.Representation_asArray)&&e.Representation_asArray.sort((function(e,t){return e.bandwidth-t.bandwidth})),e}function p(e,t){return e&&e.Period_asArray&&o(t)&&e.Period_asArray[t]?e.Period_asArray[t].AdaptationSet_asArray:[]}function _(e){return e&&e.Period_asArray?e.Period_asArray:[]}function m(e){var t=!1;return e&&e.hasOwnProperty("type")&&(t=e.type===dd.default.DYNAMIC),t}function E(e){return e&&e.EssentialProperty_asArray&&e.EssentialProperty_asArray.length?e.EssentialProperty_asArray.map((function(e){return{schemeIdUri:e.schemeIdUri,value:e.value}})):null}function v(e,t){if(!e)throw new Error("Period cannot be null or undefined");var n=gd.default.DEFAULT_ID+"_"+t;return e.hasOwnProperty(dd.default.ID)&&e.id.length>0&&"__proto__"!==e.id&&(n=e.id),n}function y(e,t){var n=[],r=void 0;if(!e)return n;for(r=0;r<e.length;r++){var i=new Ed.default;if(i.timescale=1,i.representation=t,!e[r].hasOwnProperty(ld.default.SCHEME_ID_URI))throw new Error("Invalid EventStream. SchemeIdUri has to be set");i.schemeIdUri=e[r].schemeIdUri,e[r].hasOwnProperty(dd.default.TIMESCALE)&&(i.timescale=e[r].timescale),e[r].hasOwnProperty(dd.default.VALUE)&&(i.value=e[r].value),n.push(i)}return n}function T(e){var t=[],n=e.BaseURL_asArray||[e.baseUri],r=!1;return n.some((function(n){if(n){var i=new md.default,o=n.__text||n;return a.isRelative(o)&&(r=!0,e.baseUri&&(o=a.resolve(o,e.baseUri))),i.url=o,n.hasOwnProperty(dd.default.SERVICE_LOCATION)&&n.serviceLocation.length?i.serviceLocation=n.serviceLocation:i.serviceLocation=o,n.hasOwnProperty(dd.default.DVB_PRIORITY)&&(i.dvb_priority=n[dd.default.DVB_PRIORITY]),n.hasOwnProperty(dd.default.DVB_WEIGHT)&&(i.dvb_weight=n[dd.default.DVB_WEIGHT]),n.hasOwnProperty(dd.default.AVAILABILITY_TIME_OFFSET)&&(i.availabilityTimeOffset=n[dd.default.AVAILABILITY_TIME_OFFSET]),n.hasOwnProperty(dd.default.AVAILABILITY_TIME_COMPLETE)&&(i.availabilityTimeComplete="false"!==n[dd.default.AVAILABILITY_TIME_COMPLETE]),t.push(i),r}})),t}return e={getIsTypeOf:s,getIsTextTrack:c,getLanguageForAdaptation:function(e){var t="";return e&&e.hasOwnProperty(dd.default.LANG)&&(t=e.lang.replace(/[^A-Za-z0-9-]/g,"")),t},getViewpointForAdaptation:function(e){return e&&e.hasOwnProperty(dd.default.VIEWPOINT)?e.Viewpoint:null},getRolesForAdaptation:function(e){return e&&e.hasOwnProperty(dd.default.ROLE_ASARRAY)?e.Role_asArray:[]},getAccessibilityForAdaptation:function(e){return e&&e.hasOwnProperty(dd.default.ACCESSIBILITY_ASARRAY)?e.Accessibility_asArray:[]},getAudioChannelConfigurationForAdaptation:function(e){return e&&e.hasOwnProperty(dd.default.AUDIOCHANNELCONFIGURATION_ASARRAY)?e.AudioChannelConfiguration_asArray:[]},getAudioChannelConfigurationForRepresentation:function(e){return e&&e.hasOwnProperty(dd.default.AUDIOCHANNELCONFIGURATION_ASARRAY)?e.AudioChannelConfiguration_asArray:[]},getAdaptationForIndex:function(e,t,n){var r=p(t,n);return r.length>0&&o(e)?r[e]:null},getIndexForAdaptation:function(e,t,n){if(!e)return-1;for(var r=p(t,n),a=0;a<r.length;a++){if((0,vd.default)(i).getInstance().areEqual(r[a],e))return a}return-1},getAdaptationForId:function(e,t,n){var r,i=p(t,n),a=void 0;for(a=0,r=i.length;a<r;a++)if(i[a].hasOwnProperty(dd.default.ID)&&i[a].id===e)return i[a];return null},getAdaptationsForType:function(e,t,n){var r,i=p(e,t),a=void 0,o=[];for(a=0,r=i.length;a<r;a++)s(i[a],n)&&o.push(h(i[a]));return o},getRealPeriods:_,getRealPeriodForIndex:function(e,t){var n=_(t);return n.length>0&&o(e)?n[e]:null},getCodec:function(e,t,n){var r=null;if(e&&e.Representation_asArray&&e.Representation_asArray.length>0){var i=o(t)&&t>=0&&t<e.Representation_asArray.length?e.Representation_asArray[t]:e.Representation_asArray[0];i&&(r=i.mimeType+';codecs="'+i.codecs+'"',n&&void 0!==i.width&&(r+=';width="'+i.width+'";height="'+i.height+'"'))}return r&&(r=r.replace(/\sprofiles=[^;]*/g,"")),r},getMimeType:function(e){return e&&e.Representation_asArray&&e.Representation_asArray.length>0?e.Representation_asArray[0].mimeType:null},getKID:function(e){return e&&e.hasOwnProperty(dd.default.CENC_DEFAULT_KID)?e[dd.default.CENC_DEFAULT_KID]:null},getLabelsForAdaptation:function(e){if(!e||!Array.isArray(e.Label_asArray))return[];for(var t=[],n=0;n<e.Label_asArray.length;n++)t.push({lang:e.Label_asArray[n].lang,text:e.Label_asArray[n].__text||e.Label_asArray[n]});return t},getContentProtectionData:function(e){return e&&e.hasOwnProperty(dd.default.CONTENTPROTECTION_ASARRAY)&&0!==e.ContentProtection_asArray.length?e.ContentProtection_asArray:null},getIsDynamic:m,getId:function(e){return e&&e[dd.default.ID]||null},hasProfile:function(e,t){var n=!1;return e&&e.profiles&&e.profiles.length>0&&(n=-1!==e.profiles.indexOf(t)),n},getDuration:function(e){return e&&e.hasOwnProperty(dd.default.MEDIA_PRESENTATION_DURATION)?e.mediaPresentationDuration:e&&"dynamic"==e.type?Number.POSITIVE_INFINITY:Number.MAX_SAFE_INTEGER||Number.MAX_VALUE},getBandwidth:function(e){return e&&e.bandwidth?e.bandwidth:NaN},getManifestUpdatePeriod:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=NaN;return e&&e.hasOwnProperty(dd.default.MINIMUM_UPDATE_PERIOD)&&(n=e.minimumUpdatePeriod),isNaN(n)?n:Math.max(n-t,1)},getPublishTime:function(e){return e&&e.hasOwnProperty(dd.default.PUBLISH_TIME)?new Date(e[dd.default.PUBLISH_TIME]):null},getRepresentationCount:function(e){return e&&Array.isArray(e.Representation_asArray)?e.Representation_asArray.length:0},getBitrateListForAdaptation:function(e){var t=h(e);return(t&&Array.isArray(t.Representation_asArray)?t.Representation_asArray:[]).map((function(e){return{bandwidth:e.bandwidth,width:e.width||0,height:e.height||0,scanType:e.scanType||null,id:e.id||null}}))},getRepresentationFor:function(e,t){return t&&t.Representation_asArray&&t.Representation_asArray.length>0&&o(e)?t.Representation_asArray[e]:null},getRepresentationsForAdaptation:function(e){var t,n,r,i,a,s=[],u=function(e){if(e&&e.period&&o(e.period.index)){var t=e.period.mpd.manifest.Period_asArray[e.period.index];if(t&&t.AdaptationSet_asArray&&o(e.index))return h(t.AdaptationSet_asArray[e.index])}}(e),l=void 0,d=void 0;if(u&&u.Representation_asArray){if(e&&e.period&&o(e.period.index)){var f=T(e.period.mpd.manifest);f&&(d=f[0])}for(var g=0,p=u.Representation_asArray.length;g<p;++g){var _=u.Representation_asArray[g],m=new fd.default;if(m.index=g,m.adaptation=e,_.hasOwnProperty(dd.default.ID)&&(m.id=_.id),_.hasOwnProperty(dd.default.CODECS)&&(m.codecs=_.codecs),_.hasOwnProperty(dd.default.CODEC_PRIVATE_DATA)&&(m.codecPrivateData=_.codecPrivateData),_.hasOwnProperty(dd.default.BANDWITH)&&(m.bandwidth=_.bandwidth),_.hasOwnProperty(dd.default.WIDTH)&&(m.width=_.width),_.hasOwnProperty(dd.default.HEIGHT)&&(m.height=_.height),_.hasOwnProperty(dd.default.SCAN_TYPE)&&(m.scanType=_.scanType),_.hasOwnProperty(dd.default.MAX_PLAYOUT_RATE)&&(m.maxPlayoutRate=_.maxPlayoutRate),_.hasOwnProperty(dd.default.SEGMENT_BASE)?(l=_.SegmentBase,m.segmentInfoType=dd.default.SEGMENT_BASE):_.hasOwnProperty(dd.default.SEGMENT_LIST)?(l=_.SegmentList).hasOwnProperty(dd.default.SEGMENT_TIMELINE)?m.segmentInfoType=dd.default.SEGMENT_TIMELINE:m.segmentInfoType=dd.default.SEGMENT_LIST:_.hasOwnProperty(dd.default.SEGMENT_TEMPLATE)?((l=_.SegmentTemplate).hasOwnProperty(dd.default.SEGMENT_TIMELINE)?m.segmentInfoType=dd.default.SEGMENT_TIMELINE:m.segmentInfoType=dd.default.SEGMENT_TEMPLATE,l.hasOwnProperty(dd.default.INITIALIZATION_MINUS)&&(m.initialization=l.initialization.split("$Bandwidth$").join(_.bandwidth).split("$RepresentationID$").join(_.id))):m.segmentInfoType=dd.default.BASE_URL,m.essentialProperties=E(_),l){if(l.hasOwnProperty(dd.default.INITIALIZATION)){var v=l.Initialization;v.hasOwnProperty(dd.default.SOURCE_URL)&&(m.initialization=v.sourceURL),v.hasOwnProperty(dd.default.RANGE)&&(m.range=v.range)}else _.hasOwnProperty(dd.default.MIME_TYPE)&&c(_.mimeType)&&(m.range=0);l.hasOwnProperty(dd.default.TIMESCALE)&&(m.timescale=l.timescale),l.hasOwnProperty(dd.default.DURATION)?m.segmentDuration=l.duration/m.timescale:_.hasOwnProperty(dd.default.SEGMENT_TEMPLATE)&&(l=_.SegmentTemplate).hasOwnProperty(dd.default.SEGMENT_TIMELINE)&&(m.segmentDuration=(r=l.SegmentTimeline,i=void 0,a=void 0,i=r.S_asArray[0],a=r.S_asArray[1],(i.hasOwnProperty("d")?i.d:a.t-i.t)/m.timescale)),l.hasOwnProperty(dd.default.MEDIA)&&(m.media=l.media),l.hasOwnProperty(dd.default.START_NUMBER)&&(m.startNumber=l.startNumber),l.hasOwnProperty(dd.default.INDEX_RANGE)&&(m.indexRange=l.indexRange),l.hasOwnProperty(dd.default.PRESENTATION_TIME_OFFSET)&&(m.presentationTimeOffset=l.presentationTimeOffset/m.timescale),l.hasOwnProperty(dd.default.AVAILABILITY_TIME_OFFSET)?m.availabilityTimeOffset=l.availabilityTimeOffset:d&&void 0!==d.availabilityTimeOffset&&(m.availabilityTimeOffset=d.availabilityTimeOffset),l.hasOwnProperty(dd.default.AVAILABILITY_TIME_COMPLETE)?m.availabilityTimeComplete="false"!==l.availabilityTimeComplete:d&&void 0!==d.availabilityTimeComplete&&(m.availabilityTimeComplete=d.availabilityTimeComplete)}m.MSETimeOffset=(n=void 0,void 0,n=(t=m).presentationTimeOffset,t.adaptation.period.start-n),m.path=[e.period.index,e.index,g],s.push(m)}}return s},getAdaptationsForPeriod:function(e){var t=e&&o(e.index)?e.mpd.manifest.Period_asArray[e.index]:null,n=[],r=void 0,i=void 0,a=void 0;if(t&&t.AdaptationSet_asArray)for(a=0;a<t.AdaptationSet_asArray.length;a++)i=t.AdaptationSet_asArray[a],r=new cd.default,i.hasOwnProperty(dd.default.ID)&&(r.id=i.id),r.index=a,r.period=e,s(i,ld.default.MUXED)?r.type=ld.default.MUXED:u(i)?r.type=ld.default.AUDIO:l(i)?r.type=ld.default.VIDEO:d(i)?r.type=ld.default.FRAGMENTED_TEXT:f(i)?r.type=ld.default.IMAGE:r.type=ld.default.TEXT,n.push(r);return n},getRegularPeriods:function(e){var r,i=!!e&&m(e.manifest),a=[],o=null,s=null,u=null,l=null,d=void 0;for(d=0,r=e&&e.manifest&&e.manifest.Period_asArray?e.manifest.Period_asArray.length:0;d<r;d++)(s=e.manifest.Period_asArray[d]).hasOwnProperty(dd.default.START)?(l=new gd.default).start=s.start:null!==o&&o.hasOwnProperty(dd.default.DURATION)&&null!==u?(l=new gd.default).start=parseFloat((u.start+u.duration).toFixed(5)):0!==d||i||((l=new gd.default).start=0),null!==u&&isNaN(u.duration)&&(null!==l?u.duration=parseFloat((l.start-u.start).toFixed(5)):t.warn("First period duration could not be calculated because lack of start and duration period properties. This will cause timing issues during playback")),null!==l&&(l.id=v(s,d),l.index=d,l.mpd=e,s.hasOwnProperty(dd.default.DURATION)&&(l.duration=s.duration),a.push(l),o=s,u=l),s=null,l=null;return 0===a.length||null!==u&&isNaN(u.duration)&&(u.duration=parseFloat((function(e){!function(){if(!n||!n.hasOwnProperty("error"))throw new Error(ld.default.MISSING_CONFIG_ERROR)}();var t=m(e.mpd.manifest),r=void 0;e.mpd.manifest.mediaPresentationDuration?r=e.mpd.manifest.mediaPresentationDuration:e.duration?r=e.duration:t?r=Number.POSITIVE_INFINITY:n.error(new Sd.default(Id.default.MANIFEST_ERROR_ID_PARSE_CODE,"Must have @mediaPresentationDuration on MPD or an explicit @duration on the last period.",e));return r}(u)-u.start).toFixed(5))),a},getMpd:function(e){var t=new hd.default;return e&&(t.manifest=e,e.hasOwnProperty(dd.default.AVAILABILITY_START_TIME)?t.availabilityStartTime=new Date(e.availabilityStartTime.getTime()):e.loadedTime&&(t.availabilityStartTime=new Date(e.loadedTime.getTime())),e.hasOwnProperty(dd.default.AVAILABILITY_END_TIME)&&(t.availabilityEndTime=new Date(e.availabilityEndTime.getTime())),e.hasOwnProperty(dd.default.MINIMUM_UPDATE_PERIOD)&&(t.minimumUpdatePeriod=e.minimumUpdatePeriod),e.hasOwnProperty(dd.default.MEDIA_PRESENTATION_DURATION)&&(t.mediaPresentationDuration=e.mediaPresentationDuration),e.hasOwnProperty(dd.default.SUGGESTED_PRESENTATION_DELAY)&&(t.suggestedPresentationDelay=e.suggestedPresentationDelay),e.hasOwnProperty(dd.default.TIMESHIFT_BUFFER_DEPTH)&&(t.timeShiftBufferDepth=e.timeShiftBufferDepth),e.hasOwnProperty(dd.default.MAX_SEGMENT_DURATION)&&(t.maxSegmentDuration=e.maxSegmentDuration),e.hasOwnProperty(dd.default.PUBLISH_TIME)&&(t.publishTime=new Date(e.publishTime))),t},getEventsForPeriod:function(e){var t=e&&e.mpd&&e.mpd.manifest?e.mpd.manifest:null,n=t?t.Period_asArray:null,i=n&&e&&o(e.index)?n[e.index].EventStream_asArray:null,a=[],s=void 0,u=void 0;if(i)for(s=0;s<i.length;s++){var l=new Ed.default;if(l.period=e,l.timescale=1,!i[s].hasOwnProperty(ld.default.SCHEME_ID_URI))throw new Error("Invalid EventStream. SchemeIdUri has to be set");for(l.schemeIdUri=i[s][ld.default.SCHEME_ID_URI],i[s].hasOwnProperty(dd.default.TIMESCALE)&&(l.timescale=i[s][dd.default.TIMESCALE]),i[s].hasOwnProperty(dd.default.VALUE)&&(l.value=i[s][dd.default.VALUE]),i[s].hasOwnProperty(dd.default.PRESENTATION_TIME_OFFSET)&&(l.presentationTimeOffset=i[s][dd.default.PRESENTATION_TIME_OFFSET]),u=0;i[s].Event_asArray&&u<i[s].Event_asArray.length;u++){var d=i[s].Event_asArray[u],f=new _d.default;if(f.presentationTime=0,f.eventStream=l,d.hasOwnProperty(dd.default.PRESENTATION_TIME)){f.presentationTime=d.presentationTime;var c=l.presentationTimeOffset?l.presentationTimeOffset/l.timescale:0;f.calculatedPresentationTime=f.presentationTime/l.timescale+e.start-c}d.hasOwnProperty(dd.default.DURATION)&&(f.duration=d.duration/l.timescale),d.hasOwnProperty(dd.default.ID)&&(f.id=d.id),d.Signal&&d.Signal.Binary?f.messageData=r.decodeArray(d.Signal.Binary.toString()):f.messageData=d.messageData||d.__text,a.push(f)}}return a},getEssentialPropertiesForRepresentation:E,getEventStreamForAdaptationSet:function(e,t){var n=void 0,r=void 0,i=void 0;return e&&e.Period_asArray&&t&&t.period&&o(t.period.index)&&(r=e.Period_asArray[t.period.index])&&r.AdaptationSet_asArray&&o(t.index)&&(i=r.AdaptationSet_asArray[t.index])&&(n=i.InbandEventStream_asArray),y(n,null)},getEventStreamForRepresentation:function(e,t){var n=void 0,r=void 0,i=void 0,a=void 0;return e&&e.Period_asArray&&t&&t.adaptation&&t.adaptation.period&&o(t.adaptation.period.index)&&(r=e.Period_asArray[t.adaptation.period.index])&&r.AdaptationSet_asArray&&o(t.adaptation.index)&&(i=r.AdaptationSet_asArray[t.adaptation.index])&&i.Representation_asArray&&o(t.index)&&(a=i.Representation_asArray[t.index])&&(n=a.InbandEventStream_asArray),y(n,t)},getUTCTimingSources:function(e){var t=m(e),n=!!e&&e.hasOwnProperty(dd.default.AVAILABILITY_START_TIME),r=e?e.UTCTiming_asArray:null,i=[];return(t||n)&&r&&r.forEach((function(e){var t=new pd.default;e.hasOwnProperty(ld.default.SCHEME_ID_URI)&&(t.schemeIdUri=e.schemeIdUri,e.hasOwnProperty(dd.default.VALUE)&&(t.value=e.value.toString(),i.push(t)))})),i},getBaseURLsFromElement:T,getRepresentationSortFunction:g,getLocation:function(e){if(e&&e.hasOwnProperty(ld.default.LOCATION))return e.Location=e.Location_asArray[0],e.Location},getPatchLocation:function(e){if(e&&e.hasOwnProperty(dd.default.PATCH_LOCATION))return e.PatchLocation=e.PatchLocation_asArray[0],e.PatchLocation},getSuggestedPresentationDelay:function(e){return e&&e.hasOwnProperty(dd.default.SUGGESTED_PRESENTATION_DELAY)?e.suggestedPresentationDelay:null},getAvailabilityStartTime:function(e){return e&&e.hasOwnProperty(dd.default.AVAILABILITY_START_TIME)&&null!==e.availabilityStartTime?e.availabilityStartTime.getTime():null},getServiceDescriptions:function(e){var t=[];if(e&&e.hasOwnProperty(dd.default.SERVICE_DESCRIPTION)){var n=!0,r=!1,i=void 0;try{for(var a,o=e.ServiceDescription_asArray[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value,u=void 0,l=void 0,d=void 0,f=void 0;for(var c in s)s.hasOwnProperty(c)&&(c===dd.default.ID?u=s[c]:c===dd.default.SERVICE_DESCRIPTION_SCOPE?l=s[c].schemeIdUri:c===dd.default.SERVICE_DESCRIPTION_LATENCY?d={target:s[c].target,max:s[c].max,min:s[c].min}:c===dd.default.SERVICE_DESCRIPTION_PLAYBACK_RATE&&(f={max:s[c].max,min:s[c].min}));l===ld.default.SERVICE_DESCRIPTION_LL_SCHEME&&(d||f)&&t.push({id:u,schemeIdUri:l,latency:d,playbackRate:f})}}catch(e){r=!0,i=e}finally{try{!n&&o.return&&o.return()}finally{if(r)throw i}}}return t},getSupplementalPropperties:function(e){var t={};if(e&&e.hasOwnProperty(dd.default.SUPPLEMENTAL_PROPERTY)){var n=!0,r=!1,i=void 0;try{for(var a,o=e.SupplementalProperty_asArray[Symbol.iterator]();!(n=(a=o.next()).done);n=!0){var s=a.value;s.hasOwnProperty(ld.default.SCHEME_ID_URI)&&s.hasOwnProperty(dd.default.VALUE)&&(t[s[ld.default.SCHEME_ID_URI]]=s[dd.default.VALUE])}}catch(e){r=!0,i=e}finally{try{!n&&o.return&&o.return()}finally{if(r)throw i}}}return t},setConfig:function(e){e&&(e.errHandler&&(n=e.errHandler),e.BASE64&&(r=e.BASE64))}},t=(0,Ad.default)(i).getInstance().getLogger(e),e}bd.__dashjs_factory_name="DashManifestModel";var Nd=Td.default.getSingletonFactory(bd),Md=Object.defineProperty({default:Nd},"__esModule",{value:!0}),Dd=Bd(x),Cd=Bd(D),Od=Bd(Cl),wd=Bd(S),Pd=Bd(ee),Ld=Bd(Tl),Fd=Bd(p),xd=Bd(Md),Ud=Bd(fl);function Bd(e){return e&&e.__esModule?e:{default:e}}var kd="m",Gd="a",qd="v",Yd="i",jd="c",Hd="tt",Kd="k",Vd="o",zd="d",Wd="s",Xd="v",Qd="l";function Zd(){var e=void 0,t=void 0,n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,u=void 0,l=void 0,d=this.context,f=(0,Dd.default)(d).getInstance(),c=(0,Ld.default)(d).getInstance();function g(){n={pr:1,nor:null,st:null,sf:null,sid:""+Ud.default.generateUuid(),cid:null},u={},s={},l={},p()}function h(){p()}function p(){if(a){var e=a.getStreamController();if(e&&"function"==typeof e.getActiveStream){var t=e.getActiveStream();t&&(o=t.getProcessors())}}}function _(e,t){var n={},r=!0,i=!1,a=void 0;try{for(var o,s=t[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var u=o.value;e[u]&&(n[u]=e[u])}}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}function m(e){try{return e.type===pe.HTTPRequest.MPD_TYPE?((t=E()).ot=""+kd,t):e.type===pe.HTTPRequest.MEDIA_SEGMENT_TYPE?(function(e){l.hasOwnProperty(e)||(l[e]=!1);s.hasOwnProperty(e)||(s[e]=!1);u.hasOwnProperty(e)||(u[e]=!1)}(e.mediaType),function(e){var t=E(),d=function(e){try{var t=e.quality,n=e.mediaInfo.bitrateList;return parseInt(n[t].bandwidth/1e3)}catch(e){return null}}(e),f=function(e){try{return isNaN(e.duration)?null:Math.round(1e3*e.duration)}catch(e){return null}}(e),g=function(e){try{return 100*parseInt(r.getThroughputHistory().getSafeAverageThroughput(e)/100)}catch(e){return null}}(e.mediaType),h=function(e){try{var t=n.pr,r=i.getCurrentBufferLevel(e);return isNaN(t)||isNaN(r)?null:100*parseInt(r/t*10)}catch(e){return null}}(e.mediaType),p=v(e.mediaType),_=function(e){try{var t=r.getTopBitrateInfoFor(e);return Math.round(t.bitrate/1e3)}catch(e){return null}}(e.mediaType),m=n.pr,y=function(e){if(!o||0===o.length)return;var t=!0,n=!1,r=void 0;try{for(var i,a=o[Symbol.iterator]();!(t=(i=a.next()).done);t=!0){var s=i.value;if(s.getType()===e)return s.probeNextRequest()}}catch(e){n=!0,r=e}finally{try{!t&&a.return&&a.return()}finally{if(n)throw r}}}(e.mediaType),T=void 0;e.mediaType===Fd.default.VIDEO&&(T=qd);e.mediaType===Fd.default.AUDIO&&(T=Gd);e.mediaType===Fd.default.FRAGMENTED_TEXT&&(T="application/mp4"===e.mediaInfo.mimeType?Hd:jd);var A=c.get().streaming.cmcd.rtp;A||(A=function(e){var t=a.getPlaybackRate();t||(t=1);var n=e.quality,r=e.mediaType,i=e.mediaInfo,o=e.duration,s=v(r);0===s&&(s=500);var u=i.bitrateList[n].bandwidth*o/1e3/(s/t/1e3),l=c.get().streaming.cmcd.rtpSafetyFactor&&!isNaN(c.get().streaming.cmcd.rtpSafetyFactor)?c.get().streaming.cmcd.rtpSafetyFactor:5;return 100*(parseInt(u*l/100)+1)}(e));if(t.rtp=A,y)if(e.url!==y.url){var S=new URL(y.url);t.nor=S.pathname}else y.range&&(t.nrr=y.range);d&&(t.br=d);T&&(t.ot=T);isNaN(f)||(t.d=f);isNaN(g)||(t.mtp=g);isNaN(h)||(t.dl=h);isNaN(p)||(t.bl=p);isNaN(_)||(t.tb=_);isNaN(m)||1===m||(t.pr=m);u[e.mediaType]&&(t.bs=!0,u[e.mediaType]=!1);!s[e.mediaType]&&l[e.mediaType]||(t.su=!0,s[e.mediaType]=!1,l[e.mediaType]=!0);return t}(e)):e.type===pe.HTTPRequest.INIT_SEGMENT_TYPE?function(){var e=E();return e.ot=""+Yd,e.su=!0,e}():e.type===pe.HTTPRequest.OTHER_TYPE||e.type===pe.HTTPRequest.XLINK_EXPANSION_TYPE?function(){var e=E();return e.ot=""+Vd,e}():e.type===pe.HTTPRequest.LICENSE?function(e){var t=E();return t.ot=Kd,t}():null}catch(e){return null}var t}function E(){var e={},t=c.get().streaming.cmcd.cid?c.get().streaming.cmcd.cid:n.cid;return e.v=1,e.sid=c.get().streaming.cmcd.sid?c.get().streaming.cmcd.sid:n.sid,e.sid=""+e.sid,t&&(e.cid=""+t),isNaN(n.pr)||1===n.pr||null===n.pr||(e.pr=n.pr),n.st&&(e.st=n.st),n.sf&&(e.sf=n.sf),e}function v(e){try{var t=i.getCurrentBufferLevel(e);return isNaN(t)?null:100*parseInt(10*t)}catch(e){return null}}function y(e){try{n.pr=e.playbackRate}catch(e){}}function T(t){try{var r=e.getIsDynamic(t.data)?""+Qd:""+Xd,i=t.protocol&&"MSS"===t.protocol?""+Wd:""+zd;n.st=""+r,n.sf=""+i}catch(e){}}function A(e){try{e.state&&e.mediaType&&e.state===Cd.default.BUFFER_EMPTY&&(u[e.mediaType]||(u[e.mediaType]=!0),s[e.mediaType]||(s[e.mediaType]=!0))}catch(e){}}function S(){for(var e in u)u.hasOwnProperty(e)&&(u[e]=!0);for(var t in s)s.hasOwnProperty(t)&&(s[t]=!0)}function I(e){try{if(!e)return null;var t=Object.keys(e).sort((function(e,t){return e.localeCompare(t)})),n=t.length,r=t.reduce((function(t,r,i){if("v"===r&&1===e[r])return t;"string"!=typeof e[r]||"ot"===r&&"sf"===r&&"st"===r?t+=r+"="+e[r]:t+=r+'="'+e[r].replace(/"/g,'"')+'"';return i<n-1&&(t+=","),t}),"");return r=r.replace(/=true/g,"")}catch(e){return null}}return t={getQueryParameter:function(e){try{if(c.get().streaming.cmcd&&c.get().streaming.cmcd.enabled){var t=m(e),n=I(t);return f.trigger(Od.default.CMCD_DATA_GENERATED,{url:e.url,mediaType:e.mediaType,cmcdData:t,cmcdString:n}),{key:"CMCD",value:n}}return null}catch(e){return null}},getHeaderParameters:function(e){try{if(c.get().streaming.cmcd&&c.get().streaming.cmcd.enabled){var t=m(e),n=_(t,["br","d","ot","tb"]),r=_(t,["bl","dl","mtp","nor","nrr","su"]),i=_(t,["bs","rtp"]),a=_(t,["cid","pr","sf","sid","st","v"]),o={"CMCD-Object":I(n),"CMCD-Request":I(r),"CMCD-Status":I(i),"CMCD-Session":I(a)};return f.trigger(Od.default.CMCD_DATA_GENERATED,{url:e.url,mediaType:e.mediaType,cmcdData:t}),o}return null}catch(e){return null}},setConfig:function(e){e&&(e.abrController&&(r=e.abrController),e.dashMetrics&&(i=e.dashMetrics),e.playbackController&&(a=e.playbackController))},reset:function(){f.off(Cd.default.PLAYBACK_RATE_CHANGED,y,this),f.off(Cd.default.MANIFEST_LOADED,T,this),f.off(Cd.default.BUFFER_LEVEL_STATE_CHANGED,A,t),f.off(Cd.default.PLAYBACK_SEEKED,S,t),g()},initialize:function(){f.on(Cd.default.PLAYBACK_RATE_CHANGED,y,t),f.on(Cd.default.MANIFEST_LOADED,T,t),f.on(Cd.default.BUFFER_LEVEL_STATE_CHANGED,A,t),f.on(Cd.default.PLAYBACK_SEEKED,S,t),f.on(Cd.default.PERIOD_SWITCH_COMPLETED,h,t)}},(0,Pd.default)(d).getInstance().getLogger(t),e=(0,xd.default)(d).getInstance(),g(),t}Zd.__dashjs_factory_name="CmcdModel";var $d=wd.default.getSingletonFactory(Zd),Jd=Object.defineProperty({default:$d},"__esModule",{value:!0}),ef=cf(sl),tf=cf(Ml),nf=cf(S),rf=cf(Me),af=cf(Jd),of=cf(fl),sf=cf(ee),uf=cf(x),lf=cf(q),df=cf(Tl),ff=cf(p);function cf(e){return e&&e.__esModule?e:{default:e}}function gf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hf(e){e=e||{};var t,n=this.context,r=e.errHandler,i=e.dashMetrics,a=e.mediaPlayerModel,o=e.requestModifier,s=e.boxParser,u=e.useFetch||!1,l=e.errors,d=e.requestTimeout||0,f=(0,uf.default)(n).getInstance(),c=(0,df.default)(n).getInstance(),g=void 0,h=void 0,p=void 0,_=void 0,m=void 0,E=void 0,v=void 0;function y(e,t){var l=e.request,g=[],T=!0,A=!0,S=new Date,I=S,R=0,b=void 0;if(!o||!i||!r)throw new Error("config object is not correct or missing");var N=function(e){A=!1,l.requestStartDate=S,l.requestEndDate=new Date,l.firstByteDate=l.firstByteDate||S,l.checkExistenceOnly||(i.addHttpRequest(l,b.response?b.response.responseURL:null,b.response?b.response.status:null,b.response&&b.response.getAllResponseHeaders?b.response.getAllResponseHeaders():b.response?b.response.responseHeaders:[],e?g:null),l.type===pe.HTTPRequest.MPD_TYPE&&i.addManifestUpdate(l))},M=function(){if(-1!==h.indexOf(b)&&(h.splice(h.indexOf(b),1),A))if(N(!1),t>0){try{if(c.get().streaming.utcSynchronization.enableBackgroundSyncAfterSegmentDownloadError&&l.type===pe.HTTPRequest.MEDIA_SEGMENT_TYPE)a.getRetryAttemptsForType(pe.HTTPRequest.MEDIA_SEGMENT_TYPE)===t&&f.trigger(lf.default.ATTEMPT_BACKGROUND_SYNC)}catch(e){}t--;var n={config:e};_.push(n),n.timeout=setTimeout((function(){-1!==_.indexOf(n)&&(_.splice(_.indexOf(n),1),y(e,t))}),a.getRetryIntervalsForType(l.type))}else{if(l.type===pe.HTTPRequest.MSS_FRAGMENT_INFO_SEGMENT_TYPE)return;r.error(new rf.default(m[l.type],l.url+" is not available",{request:l,response:b.response})),e.error&&e.error(l,"error",b.response.statusText),e.complete&&e.complete(l,b.response.statusText)}},D=void 0;D=u&&window.fetch&&"arraybuffer"===l.responseType&&l.type===pe.HTTPRequest.MEDIA_SEGMENT_TYPE?(0,tf.default)(n).create({requestModifier:o,boxParser:s}):(0,ef.default)(n).create({requestModifier:o});var C=null,O=o.modifyRequestURL(l.url);if(c.get().streaming.cmcd&&c.get().streaming.cmcd.enabled){var w=c.get().streaming.cmcd.mode;if(w===ff.default.CMCD_MODE_QUERY){var P=function(e){try{var t=[],n=E.getQueryParameter(e);return n&&t.push(n),t}catch(e){return[]}}(l);O=of.default.addAditionalQueryParameterToUrl(O,P)}else w===ff.default.CMCD_MODE_HEADER&&(C=E.getHeaderParameters(l))}var L=l.checkExistenceOnly?pe.HTTPRequest.HEAD:pe.HTTPRequest.GET,F=a.getXHRWithCredentialsForType(l.type);b={url:O,method:L,withCredentials:F,request:l,onload:function(){b.response.status>=200&&b.response.status<=299&&(N(!0),e.success&&e.success(b.response.response,b.response.statusText,b.response.responseURL),e.complete&&e.complete(l,b.response.statusText))},onend:M,onerror:M,progress:function(t){var n=new Date;T&&(T=!1,(!t.lengthComputable||t.lengthComputable&&t.total!==t.loaded)&&(l.firstByteDate=n)),t.lengthComputable&&(l.bytesLoaded=t.loaded,l.bytesTotal=t.total),t.noTrace||(g.push({s:I,d:t.time?t.time:n.getTime()-I.getTime(),b:[t.loaded?t.loaded-R:0]}),I=n,R=t.loaded),e.progress&&t&&e.progress(t)},onabort:function(){e.abort&&e.abort(l)},ontimeout:function(e){var t=void 0;if(e.lengthComputable){var n=e.loaded/e.total*100;t="Request timeout: loaded: "+e.loaded+", out of: "+e.total+" : "+n.toFixed(3)+"% Completed"}else t="Request timeout: non-computable download size";v.warn(t)},loader:D,timeout:d,headers:C};var x=(new Date).getTime();if(isNaN(l.delayLoadingTime)||x>=l.delayLoadingTime)h.push(b),D.load(b);else{var U={httpRequest:b};p.push(U),U.delayTimeout=setTimeout((function(){if(-1!==p.indexOf(U)){p.splice(p.indexOf(U),1);try{S=new Date,I=S,h.push(U.httpRequest),D.load(U.httpRequest)}catch(e){U.httpRequest.onerror()}}}),l.delayLoadingTime-x)}}return g={load:function(e){e.request?y(e,a.getRetryAttemptsForType(e.request.type)):e.error&&e.error(e.request,"error")},abort:function(){_.forEach((function(e){clearTimeout(e.timeout),e.config.request&&e.config.abort&&e.config.abort(e.config.request)})),_=[],p.forEach((function(e){return clearTimeout(e.delayTimeout)})),p=[],h.forEach((function(e){e.request.type!==pe.HTTPRequest.MSS_FRAGMENT_INFO_SEGMENT_TYPE&&(e.onloadend=e.onerror=e.onprogress=void 0,e.loader.abort(e))})),h=[]}},v=(0,sf.default)(n).getInstance().getLogger(g),h=[],p=[],_=[],E=(0,af.default)(n).getInstance(),gf(t={},pe.HTTPRequest.MPD_TYPE,l.DOWNLOAD_ERROR_ID_MANIFEST_CODE),gf(t,pe.HTTPRequest.XLINK_EXPANSION_TYPE,l.DOWNLOAD_ERROR_ID_XLINK_CODE),gf(t,pe.HTTPRequest.INIT_SEGMENT_TYPE,l.DOWNLOAD_ERROR_ID_INITIALIZATION_CODE),gf(t,pe.HTTPRequest.MEDIA_SEGMENT_TYPE,l.DOWNLOAD_ERROR_ID_CONTENT_CODE),gf(t,pe.HTTPRequest.INDEX_SEGMENT_TYPE,l.DOWNLOAD_ERROR_ID_CONTENT_CODE),gf(t,pe.HTTPRequest.BITSTREAM_SWITCHING_SEGMENT_TYPE,l.DOWNLOAD_ERROR_ID_CONTENT_CODE),gf(t,pe.HTTPRequest.OTHER_TYPE,l.DOWNLOAD_ERROR_ID_CONTENT_CODE),m=t,g}hf.__dashjs_factory_name="HTTPLoader";var pf=nf.default.getClassFactory(hf),_f=Object.defineProperty({default:pf},"__esModule",{value:!0}),mf=vf(S),Ef=vf(_f);function vf(e){return e&&e.__esModule?e:{default:e}}function yf(){var e=void 0;function t(){e={}}function n(){t()}return n(),{getLoader:function(t){for(var n in e)if(e.hasOwnProperty(n)&&t.startsWith(n))return e[n];return Ef.default},registerLoader:function(t,n){e[t]=n},unregisterLoader:function(t){e[t]&&delete e[t]},unregisterAllLoader:t,reset:n}}yf.__dashjs_factory_name="SchemeLoaderFactory";var Tf=mf.default.getSingletonFactory(yf),Af=Object.defineProperty({default:Tf},"__esModule",{value:!0}),Sf=Rf(S),If=Rf(Af);function Rf(e){return e&&e.__esModule?e:{default:e}}function bf(e){e=e||{};var t=this.context,n=void 0,r=void 0;return n=(0,If.default)(t).getInstance(),{load:function(i){var a=n.getLoader(i&&i.request?i.request.url:null);(r=a(t).create({errHandler:e.errHandler,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,useFetch:e.useFetch||null,dashMetrics:e.dashMetrics,boxParser:e.boxParser?e.boxParser:null,constants:e.constants?e.constants:null,dashConstants:e.dashConstants?e.dashConstants:null,urlUtils:e.urlUtils?e.urlUtils:null,requestTimeout:isNaN(e.requestTimeout)?0:e.requestTimeout,errors:e.errors})).load(i)},abort:function(){r&&r.abort()}}}bf.__dashjs_factory_name="URLLoader";var Nf=Sf.default.getClassFactory(bf),Mf=Object.defineProperty({default:Nf},"__esModule",{value:!0});var Df=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.checkForExistenceOnly=!0,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(function(e){return e&&e.__esModule?e:{default:e}}(ve).default),Cf=Object.defineProperty({default:Df},"__esModule",{value:!0}),Of=xf(p),wf=xf(Mf),Pf=xf(Cf),Lf=xf(Me),Ff=xf(S);function xf(e){return e&&e.__esModule?e:{default:e}}function Uf(e){e=e||{};var t=this.context,n=e.eventBus,r=e.events,i=e.urlUtils,a=e.errors,o=void 0,s=void 0;return o={checkForExistence:function(e){var t=function(t){n.trigger(r.CHECK_FOR_EXISTENCE_COMPLETED,{request:e,exists:t})};if(e){var i=new Pf.default(e.url);s.load({request:i,success:function(){t(!0)},error:function(){t(!1)}})}else t(!1)},load:function(e){var t=function(t,i){n.trigger(r.LOADING_COMPLETED,{request:e,response:t||null,error:i||null,sender:o})};e?s.load({request:e,progress:function(t){n.trigger(r.LOADING_PROGRESS,{request:e,stream:t.stream}),t.data&&n.trigger(r.LOADING_DATA_PROGRESS,{request:e,response:t.data||null,error:null,sender:o})},success:function(e){t(e)},error:function(e,n,r){t(void 0,new Lf.default(a.FRAGMENT_LOADER_LOADING_FAILURE_ERROR_CODE,r,n))},abort:function(e){e&&n.trigger(r.LOADING_ABANDONED,{mediaType:e.mediaType,request:e,sender:o})}}):t(void 0,new Lf.default(a.FRAGMENT_LOADER_NULL_REQUEST_ERROR_CODE,a.FRAGMENT_LOADER_NULL_REQUEST_ERROR_MESSAGE))},abort:function(){s&&s.abort()},reset:function(){s&&(s.abort(),s=null)}},s=(0,wf.default)(t).create({errHandler:e.errHandler,errors:a,dashMetrics:e.dashMetrics,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,useFetch:e.settings.get().streaming.lowLatencyEnabled,urlUtils:i,constants:Of.default,boxParser:e.boxParser,dashConstants:e.dashConstants,requestTimeout:e.settings.get().streaming.fragmentRequestTimeout}),o}Uf.__dashjs_factory_name="FragmentLoader";var Bf=Ff.default.getClassFactory(Uf),kf=Object.defineProperty({default:Bf},"__esModule",{value:!0}),Gf=Qf(p),qf=Qf(rl),Yf=Qf(be),jf=Qf(kf),Hf=Qf(pu),Kf=Qf(x),Vf=Qf(q),zf=Qf(Bt),Wf=Qf(S),Xf=Qf(ee);function Qf(e){return e&&e.__esModule?e:{default:e}}function Zf(e){e=e||{};var t=this.context,n=(0,Kf.default)(t).getInstance(),r=e.errHandler,i=e.mediaPlayerModel,a=e.dashMetrics,o=(0,Xf.default)(t).getInstance(),s=e.streamInfo,u=void 0,l=void 0,d=void 0;function f(){for(var e in d)d[e].reset();d={}}function c(e){if(e.sender){var t=e.request,r=e.response,i=t.isInitializationRequest(),a=t.mediaInfo.streamInfo;if(e.error&&(t.mediaType!==Gf.default.AUDIO&&t.mediaType!==Gf.default.VIDEO&&t.mediaType!==Gf.default.FRAGMENTED_TEXT||n.trigger(Vf.default.SERVICE_LOCATION_BLACKLIST_ADD,{entry:e.request.serviceLocation})),r&&a){var o=function(e,t,n,r){var i=new qf.default;return i.streamId=n,i.mediaInfo=t.mediaInfo,i.segmentType=t.type,i.start=t.startTime,i.duration=t.duration,i.end=i.start+i.duration,i.bytes=e,i.index=t.index,i.quality=t.quality,i.representationId=t.representationId,i.endFragment=r,i}(r,t,s.id,e.type!==Vf.default.FRAGMENT_LOADING_PROGRESS);n.trigger(i?Vf.default.INIT_FRAGMENT_LOADED:Vf.default.MEDIA_FRAGMENT_LOADED,{chunk:o,request:t},{streamId:a.id,mediaType:t.mediaType})}else l.warn("No "+t.mediaType+" bytes to push or stream is inactive.")}}return u={getStreamId:function(){return s.id},getModel:function(u){var l=d[u];return l||(l=(0,Yf.default)(t).create({streamInfo:s,type:u,dashMetrics:a,fragmentLoader:(0,jf.default)(t).create({dashMetrics:a,mediaPlayerModel:i,errHandler:r,requestModifier:(0,Hf.default)(t).getInstance(),settings:e.settings,boxParser:e.boxParser,eventBus:n,events:Vf.default,errors:zf.default,dashConstants:e.dashConstants,urlUtils:e.urlUtils}),debug:o,eventBus:n,events:Vf.default}),d[u]=l),l},reset:function(){n.off(Vf.default.FRAGMENT_LOADING_COMPLETED,c,this),n.off(Vf.default.FRAGMENT_LOADING_PROGRESS,c,this),f()}},l=o.getLogger(u),f(),n.on(Vf.default.FRAGMENT_LOADING_COMPLETED,c,u),n.on(Vf.default.FRAGMENT_LOADING_PROGRESS,c,u),u}Zf.__dashjs_factory_name="FragmentController";var $f=Wf.default.getClassFactory(Zf),Jf=Object.defineProperty({default:$f},"__esModule",{value:!0});var ec=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.url=null,this.width=null,this.height=null,this.x=null,this.y=null},tc=Object.defineProperty({default:ec},"__esModule",{value:!0}),nc=sc(S),rc=sc(p),ic=sc(tc),ac=sc(ud),oc=sc(oa);function sc(e){return e&&e.__esModule?e:{default:e}}function uc(e){var t,n=this.context,r=e.streamInfo,i=void 0;function a(){i&&i.reset()}return t={getStreamId:function(){return r.id},provide:function(e,t){if("function"==typeof t){var n,r=i.getCurrentTrack(),a=void 0;if(!r||r.segmentDuration<=0||null==e)t(null);else{isNaN(r.segmentDuration)&&(a=i.getThumbnailRequestForTime(e))&&(r.segmentDuration=a.duration),n=e%r.segmentDuration;var o=Math.floor(n*r.tilesHor*r.tilesVert/r.segmentDuration),s=new ic.default;if(s.width=Math.floor(r.widthPerTile),s.height=Math.floor(r.heightPerTile),s.x=Math.floor(o%r.tilesHor)*r.widthPerTile,s.y=Math.floor(o/r.tilesHor)*r.heightPerTile,"readThumbnail"in r)return r.readThumbnail(e,(function(e){s.url=e,t(s)}));if(a)s.url=a.url,r.segmentDuration=NaN;else{var u=Math.floor(e/r.segmentDuration);s.url=function(e,t){var n=t+e.startNumber,r=(0,Rs.replaceTokenForTemplate)(e.templateUrl,"Number",n);return r=(0,Rs.replaceTokenForTemplate)(r,"Time",(n-1)*e.segmentDuration*e.timescale),r=(0,Rs.replaceTokenForTemplate)(r,"Bandwidth",e.bandwidth),(0,Rs.unescapeDollarsInTemplate)(r)}(r,u)}t(s)}}},setTrackByIndex:function(e){i.setTrackByIndex(e)},getCurrentTrackIndex:function(){return i.getCurrentTrackIndex()},getBitrateList:function(){var e=i.getTracks(),t=0;return e.map((function(e){var n=new oc.default;return n.mediaType=rc.default.IMAGE,n.qualityIndex=t++,n.bitrate=e.bitrate,n.width=e.width,n.height=e.height,n}))},reset:a},a(),i=(0,ac.default)(n).create({streamInfo:r,adapter:e.adapter,baseURLController:e.baseURLController,timelineConverter:e.timelineConverter,debug:e.debug,eventBus:e.eventBus,events:e.events,dashConstants:e.dashConstants}),t}uc.__dashjs_factory_name="ThumbnailController";var lc=nc.default.getClassFactory(uc),dc=Object.defineProperty({default:lc},"__esModule",{value:!0}),fc=Ic(p),cc=Ic(E),gc=Ic(tl),hc=Ic(Jf),pc=Ic(dc),_c=Ic(x),mc=Ic(q),Ec=Ic(ee),vc=Ic(Bt),yc=Ic(S),Tc=Ic(Me),Ac=Ic(Qe),Sc=Ic(Ru);function Ic(e){return e&&e.__esModule?e:{default:e}}function Rc(e){e=e||{};var t=this.context,n=(0,_c.default)(t).getInstance(),r=(0,Sc.default)(t).getInstance(),i=e.manifestModel,a=e.mediaPlayerModel,o=e.manifestUpdater,s=e.adapter,u=e.capabilities,l=e.capabilitiesFilter,d=e.errHandler,f=e.timelineConverter,c=e.dashMetrics,g=e.abrController,h=e.playbackController,p=e.eventController,_=e.mediaController,m=e.textController,E=e.protectionController,v=e.videoModel,y=e.settings,T=e.streamInfo,A=void 0,S=void 0,I=void 0,R=void 0,b=void 0,N=void 0,M=void 0,D=void 0,C=void 0,O=void 0,w=void 0,P=void 0,L=void 0,F=void 0,x=void 0,U=void 0,B=void 0,k=void 0;function G(e){for(var t=I?I.length:0,r=0;r<t;r++){I[r].getFragmentModel().removeExecutedRequestsBeforeTime(H()+j()),I[r].reset(!1,e)}I=[],b=!1,N=!1,de(!1),n.off(mc.default.CURRENT_TRACK_CHANGED,Z,A)}function q(){G(),R=!1,M=!1,D=!1,C={},O=!1,x=!1,B=!1}function Y(){h&&h.pause(),w&&(w.reset(),w=null),T=null,q(),n.off(mc.default.DATA_UPDATE_COMPLETED,re,A),n.off(mc.default.BUFFERING_COMPLETED,ne,A),n.off(mc.default.INBAND_EVENTS,ie,A),E&&(n.off(mc.default.KEY_ERROR,X,A),n.off(mc.default.SERVER_CERTIFICATE_UPDATED,X,A),n.off(mc.default.LICENSE_REQUEST_COMPLETE,X,A),n.off(mc.default.KEY_SYSTEM_SELECTED,X,A),n.off(mc.default.KEY_SESSION_CREATED,X,A),n.off(mc.default.KEY_STATUSES_CHANGED,X,A)),de(!1)}function j(){return T?T.duration:NaN}function H(){return T?T.start:NaN}function K(){if(!T.manifestInfo.isDynamic)return NaN;for(var e=0;e<I.length;e++)if(I[e].getType()===fc.default.AUDIO||I[e].getType()===fc.default.VIDEO)return I[e].getLiveStartTime();return NaN}function V(){return T?T.id:null}function z(){return T}function W(){if(!(v&&g&&g.hasOwnProperty("getBitrateList")&&s&&s.hasOwnProperty("getAllMediaInfoForType")&&s.hasOwnProperty("getEventsFor")))throw new Error(fc.default.MISSING_CONFIG_ERROR)}function X(e){e.error&&(d.error(e.error),S.fatal(e.error.message),Y())}function Q(e){var t,n=e?e.type:null,r=void 0;if(n===fc.default.MUXED)return r="Multiplexed representations are intentionally not supported, as they are not compliant with the DASH-AVC/264 guidelines",S.fatal(r),d.error(new Tc.default(vc.default.MANIFEST_ERROR_ID_MULTIPLEXED_CODE,r,i.getValue())),!1;if(n===fc.default.TEXT||n===fc.default.FRAGMENTED_TEXT||n===fc.default.EMBEDDED_TEXT||n===fc.default.IMAGE)return!0;if(t=e.codec,S.debug(n+" codec: "+t),e.contentProtection&&!u.supportsEncryptedMedia())d.error(new Tc.default(vc.default.CAPABILITY_MEDIAKEYS_ERROR_CODE,vc.default.CAPABILITY_MEDIAKEYS_ERROR_MESSAGE));else if(!u.supportsCodec(t))return r=n+"Codec ("+t+") is not supported.",S.error(r),!1;return!0}function Z(e){if(T&&e.newMediaInfo.streamInfo.id===T.id){var t=e.newMediaInfo,n=i.getValue();s.setCurrentMediaInfo(T.id,t.type,t);var r=ae(t);if(r){var a=h.getTime();S.info("Stream - Process track changed at current time "+a),S.debug("Stream - Update stream controller"),n.refreshManifestOnSwitchTrack?(S.debug("Stream - Refreshing manifest for switch track"),k=e,o.refreshManifest()):(r.selectMediaInfo(t),t.type!==fc.default.FRAGMENTED_TEXT?(g.updateTopQualityIndex(t),r.switchTrackAsked(),r.getFragmentModel().abortRequests()):(r.getScheduleController().setSeekTarget(a),r.setBufferingTime(a),r.resetIndexHandler()))}}}function $(r,o){var u,l=s.getAllMediaInfoForType(T,r),c=null;if(l&&0!==l.length){r===fc.default.VIDEO&&(M=!0),r===fc.default.AUDIO&&(D=!0);for(var p=0,E=l.length;p<E;p++)if(c=l[p],r===fc.default.EMBEDDED_TEXT)m.addEmbeddedTrack(c);else{if(!Q(c))continue;_.addTrack(c)}r!==fc.default.EMBEDDED_TEXT&&0!==_.getTracksFor(r,T).length&&(r!==fc.default.IMAGE?(_.checkInitialMediaSettingsForType(r,T),u=_.getCurrentTrackFor(r,T),n.trigger(mc.default.STREAM_INITIALIZING,{streamInfo:T,mediaInfo:c}),function(n,r,o,u){var l=w.getModel(n?n.type:null),c=(0,gc.default)(t).create({streamInfo:T,type:n?n.type:null,mimeType:n?n.mimeType:null,timelineConverter:f,adapter:s,manifestModel:i,mediaPlayerModel:a,fragmentModel:l,dashMetrics:e.dashMetrics,baseURLController:e.baseURLController,abrController:g,playbackController:h,mediaController:_,textController:m,errHandler:d,settings:y,boxParser:F});if(c.initialize(o,M),g.updateTopQualityIndex(n),u?(c.setBuffer(u.buffer),c.setBufferingTime(u.currentTime),I[u.replaceIdx]=c):I.push(c),!u||!u.ignoreMediaInfo)if(!n||n.type!==fc.default.TEXT&&n.type!==fc.default.FRAGMENTED_TEXT)c.addMediaInfo(n,!0);else{for(var p=void 0,E=0;E<r.length;E++)r[E].index===n.index&&(p=E),c.addMediaInfo(r[E]);c.selectMediaInfo(r[p])}}(u,l,o)):P=(0,pc.default)(t).create({streamInfo:T,adapter:s,baseURLController:e.baseURLController,timelineConverter:e.timelineConverter,debug:U,eventBus:n,events:mc.default,dashConstants:cc.default}))}else S.info("No "+r+" data.")}function J(){if(p){var e=s.getEventsFor(T);p.addInlineEvents(e)}}function ee(){for(var e=I.length,t=!!C.audio||!!C.video?new Tc.default(vc.default.DATA_UPDATE_FAILED_ERROR_CODE,vc.default.DATA_UPDATE_FAILED_ERROR_MESSAGE):null,r=0;r<e;r++)if(I[r].isUpdating()||O)return;if(N){if(E){E.clearMediaInfoArrayByStreamId(V());for(var i=0;i<e&&I[i];i++){var a=I[i].getType();if(a===fc.default.AUDIO||a===fc.default.VIDEO||a===fc.default.FRAGMENTED_TEXT){var o=I[i].getMediaInfo();o&&E.initializeForMedia(o)}}}t?d.error(t):R||(R=!0,n.trigger(mc.default.STREAM_INITIALIZED,{streamInfo:T,liveStartTime:L?NaN:K()}));for(var s=0;s<e&&I[s];s++)I[s].getScheduleController().start()}}function te(e){for(var t={},n=0,r=I.length;n<r;n++){var i=I[n].createBuffer(e);i&&(t[I[n].getType()]=i.getBuffer())}return t}function ne(){var e=oe(),t=e.length;if(0!==t){for(var r=0;r<t;r++)if(!e[r].isBufferingCompleted()&&(e[r].getType()===fc.default.AUDIO||e[r].getType()===fc.default.VIDEO))return void S.warn("onBufferingCompleted - One streamProcessor has finished but",e[r].getType(),"one is not buffering completed");S.debug("onBufferingCompleted - trigger STREAM_BUFFERING_COMPLETED"),n.trigger(mc.default.STREAM_BUFFERING_COMPLETED,{streamInfo:T})}else S.warn("onBufferingCompleted - can't trigger STREAM_BUFFERING_COMPLETED because no streamProcessor is defined")}function re(e){C[e.mediaType]=e.error,ee()}function ie(e){!function(e){p&&p.addInbandEvents(e)}(e.events)}function ae(e){return e?oe().filter((function(t){return t.getType()===e.type}))[0]:null}function oe(){for(var e=[],t=void 0,n=void 0,r=0;r<I.length;r++)(t=(n=I[r]).getType())!==fc.default.AUDIO&&t!==fc.default.VIDEO&&t!==fc.default.FRAGMENTED_TEXT&&t!==fc.default.TEXT||e.push(n);return e}function se(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!e)return!1;var r=e.getStreamInfo(),i=n?n.getStreamInfo():z();if(!r||!i)return!1;var a=s.getAdaptationForType(r.index,t,r),o=s.getAdaptationForType(i.index,t,i);return a&&o?!(!ue(o)&&ue(a)):!a&&!o}function ue(e){return!!e&&!!(e.ContentProtection||e.Representation&&e.Representation.length>0&&e.Representation[0].ContentProtection)}function le(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!e||!e.hasOwnProperty("getStreamInfo"))return!1;var r=e.getStreamInfo(),i=n?n.getStreamInfo():z();if(!r||!i)return!1;var a=s.getAdaptationForType(r.index,t,r),o=s.getAdaptationForType(i.index,t,i);if(!a||!o)return!a&&!o;var l=a&&o&&a.mimeType===o.mimeType,d=o.Representation_asArray.map((function(e){return e.codecs})),f=a.Representation_asArray.map((function(e){return e.codecs})),c=f.some((function(e){return d.indexOf(e)>-1})),g=f.some((function(e){return d.some((function(t){return u.codecRootCompatibleWithCodec(t,e)}))}));return c||g&&l}function de(e){L=e}function fe(){return L}return A={initialize:function(){n.on(mc.default.BUFFERING_COMPLETED,ne,A),n.on(mc.default.DATA_UPDATE_COMPLETED,re,A),n.on(mc.default.INBAND_EVENTS,ie,A),E&&(n.on(mc.default.KEY_ERROR,X,A),n.on(mc.default.SERVER_CERTIFICATE_UPDATED,X,A),n.on(mc.default.LICENSE_REQUEST_COMPLETE,X,A),n.on(mc.default.KEY_SYSTEM_SELECTED,X,A),n.on(mc.default.KEY_SESSION_CREATED,X,A),n.on(mc.default.KEY_STATUSES_CHANGED,X,A)),n.trigger(mc.default.STREAM_UPDATED,{streamInfo:T})},getStreamId:function(){return T?T.id:null},activate:function(e,t){if(!b){var r=void 0;return n.on(mc.default.CURRENT_TRACK_CHANGED,Z,A),fe()?(!function(){if(O=!0,W(),l.filterUnsupportedFeaturesOfPeriod(T),N=!0,O=!1,0===I.length){var e="No streams to play.";d.error(new Tc.default(vc.default.MANIFEST_ERROR_ID_NOSTREAMS_CODE,e,i.getValue())),S.debug(e)}else ee()}(),r=t):r=function(e,t){W();var n=v.getElement();J(),O=!0,l.filterUnsupportedFeaturesOfPeriod(T),(!n||n&&/^VIDEO$/i.test(n.nodeName))&&$(fc.default.VIDEO,e);$(fc.default.AUDIO,e),$(fc.default.TEXT,e),$(fc.default.FRAGMENTED_TEXT,e),$(fc.default.EMBEDDED_TEXT,e),$(fc.default.MUXED,e),$(fc.default.IMAGE,e);var r=te(t);if(N=!0,O=!1,0===I.length){var a="No streams to play.";d.error(new Tc.default(vc.default.MANIFEST_ERROR_ID_NOSTREAMS_CODE,a,i.getValue())),S.fatal(a)}else ee();return r}(e,t),b=!0,r}return t},deactivate:G,isActive:function(){return b},getDuration:j,getStartTime:H,getId:V,getStreamInfo:z,getHasAudioTrack:function(){return D},getHasVideoTrack:function(){return M},preload:function(e,t){if(!fe()){J(),$(fc.default.VIDEO,e),$(fc.default.AUDIO,e),$(fc.default.TEXT,e),$(fc.default.FRAGMENTED_TEXT,e),$(fc.default.EMBEDDED_TEXT,e),$(fc.default.MUXED,e),$(fc.default.IMAGE,e),te(t),n.on(mc.default.CURRENT_TRACK_CHANGED,Z,A);for(var r=0;r<I.length&&I[r];r++)I[r].getScheduleController().start();de(!0)}},getThumbnailController:function(){return P},getBitrateListFor:function(e){if(W(),e===fc.default.IMAGE)return P?P.getBitrateList():[];var t=function(e){for(var t=null,n=0;n<I.length;n++)if((t=I[n]).getType()===e)return t.getMediaInfo();return null}(e);return g.getBitrateList(t)},updateData:function(e){S.info("Manifest updated... updating data system wide."),b=!1,O=!0,T=e,n.trigger(mc.default.STREAM_UPDATED,{streamInfo:T}),p&&J(),l.filterUnsupportedFeaturesOfPeriod(T);for(var t=0,r=I.length;t<r;t++){var i=I[t];i.updateStreamInfo(T);var a=s.getMediaInfoForType(T,i.getType());a&&(g.updateTopQualityIndex(a),i.addMediaInfo(a,!0))}if(k&&k.newMediaInfo.type!==fc.default.FRAGMENTED_TEXT){var o=ae(k.oldMediaInfo);if(!o)return;o.switchTrackAsked(),k=void 0}O=!1,ee()},reset:Y,getProcessors:oe,setMediaSource:function(e){for(var t=0;t<I.length;)Q(I[t].getMediaInfo())?(I[t].setMediaSource(e),t++):(I[t].reset(),I.splice(t,1));for(var n=0;n<I.length;n++)I[n].dischargePreBuffer();if(0===I.length){var r="No streams to play.";d.error(new Tc.default(vc.default.MANIFEST_ERROR_ID_NOSTREAMS_CODE,r+"nostreams",i.getValue())),S.fatal(r)}},isMediaCodecCompatible:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return le(e,fc.default.VIDEO,t)&&le(e,fc.default.AUDIO,t)},isProtectionCompatible:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return se(e,fc.default.VIDEO,t)&&se(e,fc.default.AUDIO,t)},getPreloaded:fe,getPreloadingScheduled:function(){return x},setPreloadingScheduled:function(e){x=e},getIsEndedEventSignaled:function(){return B},setIsEndedEventSignaled:function(e){B=e}},U=(0,Ec.default)(t).getInstance(),S=U.getLogger(A),q(),F=(0,Ac.default)(t).getInstance(),w=(0,hc.default)(t).create({streamInfo:T,mediaPlayerModel:a,dashMetrics:c,errHandler:d,settings:y,boxParser:F,dashConstants:cc.default,urlUtils:r}),A}Rc.__dashjs_factory_name="Stream";var bc=yc.default.getClassFactory(Rc),Nc=Object.defineProperty({default:bc},"__esModule",{value:!0}),Mc=Fc(x),Dc=Fc(q),Cc=Fc(S),Oc=Fc(ee),wc=Fc(Bt),Pc=Fc(E),Lc=Fc(Ru);function Fc(e){return e&&e.__esModule?e:{default:e}}function xc(){var e=this.context,t=(0,Mc.default)(e).getInstance(),n=(0,Lc.default)(e).getInstance(),r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,u=void 0,l=void 0,d=void 0,f=void 0,c=void 0,g=void 0,h=void 0;function p(){a=NaN,l=!1,s=!0,u=!1,_()}function _(){null!==o&&(clearTimeout(o),o=null)}function m(e){_(),u||(isNaN(e)&&!isNaN(a)&&(e=1e3*a),isNaN(e)||(i.debug("Refresh manifest in "+e+" milliseconds."),o=setTimeout(y,e)))}function E(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];l=!0;var t=f.getValue(),r=t.url,i=c.getPatchLocation(t),a=c.getLocation(t);i&&!e?r=i:a&&(r=a),n.isRelative(r)&&(r=n.resolve(r,t.url)),d.load(r)}function v(e){if(e){if(c.getIsPatch(e)){var n=e;e=f.getValue();var r=c.isPatchValid(e,n),o=r;if(r){var d=c.getPublishTime(e);o=c.applyPatchToManifest(e,n);var g=c.getPublishTime(e);o=d.getTime()!=g.getTime()}if(!o)return i.debug("Patch provided is invalid, performing full manifest refresh"),void E(!0);e.loadedTime=new Date}}else(e=f.getValue()).loadedTime=new Date;if(f.getValue()&&f.getValue().type===Pc.default.DYNAMIC&&e.type===Pc.default.STATIC)return t.trigger(Dc.default.DYNAMIC_TO_STATIC),l=!1,void(u=!0);f.setValue(e);var h=new Date,p=(h.getTime()-e.loadedTime.getTime())/1e3;1e3*(a=c.getManifestUpdatePeriod(e,p))>2147483647&&(a=2147483.647),t.trigger(Dc.default.MANIFEST_UPDATED,{manifest:e}),i.info("Manifest has been refreshed at "+h+"["+h.getTime()/1e3+"] "),s||m()}function y(){s||(l?m(h.get().streaming.manifestUpdateRetryInterval):E())}function T(e){e.error?e.error.code===wc.default.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE&&g.error(e.error):v(e.manifest)}function A(){s=!1,m()}function S(){(s=!h.get().streaming.scheduleWhilePaused)&&_()}function I(){l=!1}return r={initialize:function(){p(),t.on(Dc.default.STREAMS_COMPOSED,I,this),t.on(Dc.default.PLAYBACK_STARTED,A,this),t.on(Dc.default.PLAYBACK_PAUSED,S,this),t.on(Dc.default.INTERNAL_MANIFEST_LOADED,T,this)},setManifest:function(e){v(e)},refreshManifest:E,setConfig:function(e){e&&(e.manifestModel&&(f=e.manifestModel),e.adapter&&(c=e.adapter),e.manifestLoader&&(d=e.manifestLoader),e.errHandler&&(g=e.errHandler),e.settings&&(h=e.settings))},reset:function(){t.off(Dc.default.PLAYBACK_STARTED,A,this),t.off(Dc.default.PLAYBACK_PAUSED,S,this),t.off(Dc.default.STREAMS_COMPOSED,I,this),t.off(Dc.default.INTERNAL_MANIFEST_LOADED,T,this),p()}},i=(0,Oc.default)(e).getInstance().getLogger(r),r}xc.__dashjs_factory_name="ManifestUpdater";var Uc=Cc.default.getClassFactory(xc),Bc=Object.defineProperty({default:Uc},"__esModule",{value:!0}),kc=Vc(Me),Gc=Vc(x),qc=Vc(q),Yc=Vc(Bt),jc=Vc(S),Hc=Vc(ee),Kc=Vc(Ru);function Vc(e){return e&&e.__esModule?e:{default:e}}function zc(){var e=this.context,t=(0,Gc.default)(e).getInstance(),n=(0,Kc.default)(e).getInstance(),r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,u=void 0,l=void 0,d=void 0,f=void 0,c=void 0,g=void 0,h=void 0,p=void 0,_=void 0,m=void 0;function E(){d=[],f=[],c=null,g=null,p=null,h=NaN,a=!1,o=!1,_=s.get().streaming.utcSynchronization.timeBetweenSyncAttempts}function v(){a||o||!p||!p.value||!p.schemeIdUri||isNaN(h)||isNaN(s.get().streaming.utcSynchronization.backgroundAttempts)||(g&&(Date.now()-g)/1e3<30||(d=[],o=!0,function e(t){try{if(t<=0)return void O();var n=Date.now();u[p.schemeIdUri](p.value,(function(r){var i=Date.now(),a=y(n,i,r);d.push(a),e(t-1)}),(function(){O()}))}catch(e){O()}}(isNaN(s.get().streaming.utcSynchronization.backgroundAttempts)?2:s.get().streaming.utcSynchronization.backgroundAttempts)))}function y(e,t,n){return n-(t-(t-e)/2)}function T(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:NaN,t=isNaN(e);t&&s.get().streaming.useManifestDateHeaderTimeSource?D():C(t,e)}function A(e){var t=Date.parse(e);return isNaN(t)&&(t=function(e){var t=void 0,n=void 0,r=/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2})(?::([0-9]*)(\.[0-9]*)?)?(?:([+\-])([0-9]{2})([0-9]{2}))?/.exec(e);return t=Date.UTC(parseInt(r[1],10),parseInt(r[2],10)-1,parseInt(r[3],10),parseInt(r[4],10),parseInt(r[5],10),r[6]&&(parseInt(r[6],10)||0),r[7]&&1e3*parseFloat(r[7])||0),r[9]&&r[10]&&(n=60*parseInt(r[9],10)+parseInt(r[10],10),t+=("+"===r[8]?-1:1)*n*60*1e3),new Date(t).getTime()}(e)),t}function S(e){return Date.parse(e)}function I(e){return Date.parse(e)}function R(e,t,n){n()}function b(e,t,n){var r=A(e);isNaN(r)?n():t(r)}function N(e,t,r,i,a){var o,s,u=!1,l=new XMLHttpRequest,d=a?pe.HTTPRequest.HEAD:pe.HTTPRequest.GET,f=t.match(/\S+/g);if(t=f.shift(),o=function(){u||(u=!0,f.length?N(e,f.join(" "),r,i,a):i())},s=function(){var t=void 0,n=void 0;200===l.status&&(t=a?l.getResponseHeader("Date"):l.response,n=e(t),isNaN(n)||(r(n),u=!0))},n.isRelative(t)){var c=m.resolve();c&&(t=n.resolve(t,c.url))}l.open(d,t),l.timeout=5e3,l.onload=s,l.onloadend=o,l.send()}function M(e,t,n){N(I,e,t,n,!0)}function D(){var e=l.getLatestMPDRequestHeaderValueByID("Date"),t=null!==e?new Date(e).getTime():Number.NaN;isNaN(t)?C(!0):C(!1,t-Date.now())}function C(e,n){if(isNaN(h)||isNaN(n)||e||function(e){try{var t=w(e),n=isNaN(_)?30:_,r=isNaN(s.get().streaming.utcSynchronization.timeBetweenSyncAttemptsAdjustmentFactor)?2:s.get().streaming.utcSynchronization.timeBetweenSyncAttemptsAdjustmentFactor,a=isNaN(s.get().streaming.utcSynchronization.maximumTimeBetweenSyncAttempts)?600:s.get().streaming.utcSynchronization.maximumTimeBetweenSyncAttempts,o=isNaN(s.get().streaming.utcSynchronization.minimumTimeBetweenSyncAttempts)?2:s.get().streaming.utcSynchronization.minimumTimeBetweenSyncAttempts,u=void 0;t?(u=Math.min(n*r,a),i.debug("Increasing timeBetweenSyncAttempts to "+u)):(u=Math.max(n/r,o),i.debug("Decreasing timeBetweenSyncAttempts to "+u)),_=u}catch(e){}}(n),!e&&!isNaN(n)){c=Date.now(),a=!1;var r=isNaN(h);h=n,r&&v(),i.debug("Completed UTC sync. Setting client - server offset to "+n)}e&&(p=null),t.trigger(qc.default.UPDATE_TIME_SYNC_OFFSET,{offset:n,error:e?new kc.default(Yc.default.TIME_SYNC_FAILED_ERROR_CODE,Yc.default.TIME_SYNC_FAILED_ERROR_MESSAGE):null}),t.trigger(qc.default.TIME_SYNCHRONIZATION_COMPLETED)}function O(){if(d&&0!==d.length){var e=d.reduce((function(e,t){return e+t}),0)/d.length;w(e)?i.debug("Completed background UTC sync. Offset is within allowed threshold and is not adjusted."):(i.debug("Completed background UTC sync. Setting client - server offset to "+e),h=e,t.trigger(qc.default.UPDATE_TIME_SYNC_OFFSET,{offset:h})),o=!1,g=Date.now()}}function w(e){try{if(isNaN(h))return!0;var t=s.get().streaming.utcSynchronization.maximumAllowedDrift&&!isNaN(s.get().streaming.utcSynchronization.maximumAllowedDrift)?s.get().streaming.utcSynchronization.maximumAllowedDrift:100;return e>=h-t&&e<=h+t}catch(e){return!0}}return r={initialize:function(){E(),u={"urn:mpeg:dash:utc:http-head:2014":M,"urn:mpeg:dash:utc:http-xsdate:2014":N.bind(null,A),"urn:mpeg:dash:utc:http-iso:2014":N.bind(null,S),"urn:mpeg:dash:utc:direct:2014":b,"urn:mpeg:dash:utc:http-head:2012":M,"urn:mpeg:dash:utc:http-xsdate:2012":N.bind(null,A),"urn:mpeg:dash:utc:http-iso:2012":N.bind(null,S),"urn:mpeg:dash:utc:direct:2012":b,"urn:mpeg:dash:utc:http-ntp:2014":R,"urn:mpeg:dash:utc:ntp:2014":R,"urn:mpeg:dash:utc:sntp:2014":R}},attemptSync:function(e){f=e,a||(!function(){try{var e=isNaN(_)?30:_;return!(c&&e&&!isNaN(e))||(Date.now()-c)/1e3>=e}catch(e){return!0}}()?t.trigger(qc.default.TIME_SYNCHRONIZATION_COMPLETED):(a=!0,function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=t||0;if(!f||0===f.length||n>=f.length)return void T();var r=f[n];if(r)if(u.hasOwnProperty(r.schemeIdUri)){var i=(new Date).getTime();u[r.schemeIdUri](r.value,(function(e){var t=(new Date).getTime(),n=y(i,t,e);p=r,T(n)}),(function(){e(n+1)}))}else e(n+1);else T()}()))},setConfig:function(e){e&&(e.dashMetrics&&(l=e.dashMetrics),e.baseURLController&&(m=e.baseURLController),e.settings&&(s=e.settings))},reset:function(){E(),t.off(qc.default.ATTEMPT_BACKGROUND_SYNC,v,r)}},i=(0,Hc.default)(e).getInstance().getLogger(r),t.on(qc.default.ATTEMPT_BACKGROUND_SYNC,v,r),r}zc.__dashjs_factory_name="TimeSyncController";var Wc=jc.default.getSingletonFactory(zc);Wc.HTTP_TIMEOUT_MS=5e3,jc.default.updateSingletonFactory(zc.__dashjs_factory_name,Wc);var Xc=Wc,Qc=Object.defineProperty({default:Xc},"__esModule",{value:!0}),Zc=Jc(S),$c=Jc(ee);function Jc(e){return e&&e.__esModule?e:{default:e}}function eg(){var e=void 0,t=void 0,n=this.context;return e={createMediaSource:function(){var e="WebKitMediaSource"in window;return"MediaSource"in window?new MediaSource:e?new WebKitMediaSource:null},attachMediaSource:function(e,t){var n=window.URL.createObjectURL(e);return t.setSource(n),n},detachMediaSource:function(e){e.setSource(null)},setDuration:function e(n,r){n&&"open"===n.readyState&&(null===r&&isNaN(r)||n.duration!==r&&(!function(e){for(var t=e.sourceBuffers,n=0;n<t.length;n++)if(t[n].updating)return!0;return!1}(n)?(t.info("Set MediaSource duration:"+r),n.duration=r):setTimeout(e.bind(null,n,r),50)))},setSeekable:function(e,t,n){e&&"function"==typeof e.setLiveSeekableRange&&"function"==typeof e.clearLiveSeekableRange&&"open"===e.readyState&&t>=0&&t<n&&(e.clearLiveSeekableRange(),e.setLiveSeekableRange(t,n))},signalEndOfStream:function(e){if(e&&"open"===e.readyState){for(var n=e.sourceBuffers,r=0;r<n.length;r++){if(n[r].updating)return;if(0===n[r].buffered.length)return}t.info("call to mediaSource endOfStream"),e.endOfStream()}}},t=(0,$c.default)(n).getInstance().getLogger(e),e}eg.__dashjs_factory_name="MediaSourceController";var tg=Zc.default.getSingletonFactory(eg),ng=Object.defineProperty({default:tg},"__esModule",{value:!0}),rg=ug(S),ig=ug(ee),ag=ug(x),og=ug(D),sg=ug(sl);function ug(e){return e&&e.__esModule?e:{default:e}}function lg(){var e="discarded",t="updated",n="added",r=this.context,i=(0,ag.default)(r).getInstance(),a=void 0,o=void 0,s=void 0,u=void 0,l=void 0,d=void 0,f=void 0,c=void 0,g=void 0,h=void 0,p=void 0;function _(){if(!f||!c)throw new Error("setConfig function has to be called previously")}function m(){p=!1,s={},u={},l=null,h=!1,d=Date.now()/1e3}function E(){try{null!==l&&p&&(clearInterval(l),l=null,p=!1,function(){try{S(u),S(s)}catch(e){}}())}catch(e){throw e}}function v(r,i){var a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=r.eventStream.schemeIdUri,s=r.eventStream.value,u=r.id,l=e;i[o]||(i[o]=[]);var d=i[o].findIndex((function(e){return(!s||e.eventStream.value&&e.eventStream.value===s)&&e.id===u}));return-1===d?(i[o].push(r),l=n):a&&(i[o][d]=r,l=t),l}function y(e){try{if(1==e.eventStream.value){var t=e.calculatedPresentationTime,n=void 0;n=4294967295==e.calculatedPresentationTime?NaN:e.calculatedPresentationTime+e.duration,i.trigger(og.default.MANIFEST_VALIDITY_CHANGED,{id:e.id,validUntil:t,newDuration:n,newManifestValidAfter:NaN},{mode:og.default.EVENT_MODE_ON_START})}}catch(e){}}function T(){try{if(!h){h=!0;var e=c.getTime(),t=e-d;t=d>0?Math.max(0,t):0,A(u,t,e),A(s,t,e),d=e,h=!1}}catch(e){h=!1}}function A(e,t,n){try{I(e,(function(r){if(void 0!==r){var i=isNaN(r.duration)?0:r.duration;r.calculatedPresentationTime<=n&&r.calculatedPresentationTime+t+i>=n?R(r,e,og.default.EVENT_MODE_ON_START):(function(e,t,n){try{return e-t>n}catch(e){return!1}}(n,i+t,r.calculatedPresentationTime)||function(e){try{var t=e.eventStream.period.start+e.eventStream.period.duration;return e.calculatedPresentationTime>t}catch(e){return!1}}(r))&&(o.debug("Deleting event "+r.id+" as it is expired or invalid"),b(e,r))}}))}catch(e){}}function S(e){try{var t=c.getTime();I(e,function(n){var r=n.eventStream&&n.eventStream.period&&!isNaN(n.eventStream.period.duration)?n.eventStream.period.duration:NaN,i=n.eventStream&&n.eventStream.period&&!isNaN(n.eventStream.period.start)?n.eventStream.period.start:NaN;if(!isNaN(r)&&!isNaN(i)){var a=n.calculatedPresentationTime;Math.abs(a-t)<300&&R(n,e,og.default.EVENT_MODE_ON_START)}}())}catch(e){}}function I(e,t){try{if(e)for(var n=Object.keys(e),r=0;r<n.length;r++){e[n[r]].forEach((function(e){void 0!==e&&t(e)}))}}catch(e){}}function R(e,t,n){try{var a=c.getTime(),s=e.id;if(n===og.default.EVENT_MODE_ON_RECEIVE)return o.debug("Received event "+s),void i.trigger(e.eventStream.schemeIdUri,{event:e},{mode:n});"urn:mpeg:dash:event:2012"===e.eventStream.schemeIdUri&&1===e.eventStream.value?0===e.duration&&0===e.presentationTimeDelta||(o.debug("Starting manifest refresh event "+s+" at "+a),b(t,e),function(){try{_(),f.refreshManifest()}catch(e){}}()):"urn:mpeg:dash:event:callback:2015"===e.eventStream.schemeIdUri&&1===e.eventStream.value?(o.debug("Starting callback event "+s+" at "+a),b(t,e),function(e){try{(0,sg.default)(r).create({}).load({method:"get",url:e,request:{responseType:"arraybuffer"}})}catch(e){throw e}}(e.messageData)):(o.debug("Starting event "+s+" at "+a),b(t,e),i.trigger(e.eventStream.schemeIdUri,{event:e},{mode:n}))}catch(e){}}function b(e,t){var n=t.eventStream.schemeIdUri,r=t.eventStream.value,i=t.id;e[n]=e[n].filter((function(e){return r&&e.eventStream.value&&e.eventStream.value!==r||e.id!==i})),0===e[n].length&&delete e[n]}return a={addInlineEvents:function(e){try{if(_(),e)for(var r=0;r<e.length;r++){var i=e[r],a=v(i,s,!0);a===n?(o.debug("Added inline event with id "+i.id),R(i,e,og.default.EVENT_MODE_ON_RECEIVE)):a===t&&o.debug("Updated inline event with id "+i.id)}o.debug("Added "+e.length+" inline events")}catch(e){throw e}},addInbandEvents:function(e){try{_();for(var t=0;t<e.length;t++){var r=e[t];v(r,u,!1)===n?("urn:mpeg:dash:event:2012"===r.eventStream.schemeIdUri&&void 0===u[r.id]&&y(r),o.debug("Added inband event with id "+r.id),R(r,e,og.default.EVENT_MODE_ON_RECEIVE)):o.debug("Inband event with scheme_id_uri "+r.eventStream.schemeIdUri+", value "+r.eventStream.value+" and id "+r.id+" was ignored because it has been added before.")}T()}catch(e){throw e}},getInbandEvents:function(){return u},getInlineEvents:function(){return s},start:function(){try{_(),o.debug("Start Event Controller");var e=g.get().streaming.eventControllerRefreshDelay;p||isNaN(e)||(p=!0,l=setInterval(T,e))}catch(e){throw e}},setConfig:function(e){try{if(!e)return;e.manifestUpdater&&(f=e.manifestUpdater),e.playbackController&&(c=e.playbackController),e.settings&&(g=e.settings)}catch(e){throw e}},reset:function(){E(),m()}},o=(0,ig.default)(r).getInstance().getLogger(a),m(),a}lg.__dashjs_factory_name="EventController";var dg=rg.default.getSingletonFactory(lg),fg=Object.defineProperty({default:dg},"__esModule",{value:!0}),cg=Dg(p),gg=Dg(T),hg=Dg(Nc),pg=Dg(Bc),_g=Dg(x),mg=Dg(q),Eg=Dg(S),vg=Dg(ee),yg=Dg(Xa),Tg=Dg(Ru),Ag=Dg(D),Sg=Dg(Qc),Ig=Dg(ng),Rg=Dg(Me),bg=Dg(Bt),Ng=Dg(fg),Mg=Dg(dn);function Dg(e){return e&&e.__esModule?e:{default:e}}function Cg(){var e=this.context,t=(0,_g.default)(e).getInstance(),n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,u=void 0,l=void 0,d=void 0,f=void 0,c=void 0,g=void 0,h=void 0,p=void 0,_=void 0,m=void 0,E=void 0,v=void 0,y=void 0,T=void 0,A=void 0,S=void 0,I=void 0,R=void 0,b=void 0,N=void 0,M=void 0,D=void 0,C=void 0,O=void 0,w=void 0,P=void 0,L=void 0,F=void 0,x=void 0,U=void 0,B=void 0,k=void 0,G=void 0,q=void 0;function Y(){if(de()){var e=O.getPlaybackQuality();e&&d.addDroppedFrames(e)}}function j(e){var t=$(e.seekTime);t===S&&k&&k.length>0&&k.forEach((function(e){e.deactivate(!0)})),t&&t!==S?(ce(Ou.PlayListTrace.END_OF_PERIOD_STOP_REASON),ne(t,S,e.seekTime)):ce(Ou.PlayListTrace.USER_REQUEST_STOP_REASON),ge(Ou.PlayList.SEEK_START_REASON)}function H(e){var t=te();ce(Ou.PlayListTrace.END_OF_PERIOD_STOP_REASON),ne(t,S,e.seekTime),ge(Ou.PlayList.SEEK_START_REASON)}function K(){r.debug("[onPlaybackStarted]"),F?(F=!1,ge(Ou.PlayList.INITIAL_PLAYOUT_START_REASON)):L&&(L=!1,ge(Ou.PlayList.RESUME_FROM_PAUSE_START_REASON))}function V(e){r.debug("[onPlaybackPaused]"),e.ended||(L=!0,ce(Ou.PlayListTrace.USER_REQUEST_STOP_REASON))}function z(){x&&(clearInterval(x),x=null)}function W(){U||(U=setInterval((function(){!function(){if(!S||!X(S))return;var e=function(e){try{var t=e||(S||null);if(t){var n=t.getStreamInfo().start;return A.filter((function(e){return e.getStreamInfo().start>n}))}}catch(e){return[]}}(S),t=0,n=function(){var n=e[t],i=0===t?S:e[t-1];if(!n.getPreloadingScheduled()&&X(i)&&C){var a=[cg.default.VIDEO,cg.default.AUDIO],o=!0;a.forEach((function(e){var t=l.getMediaInfoForType(n.getStreamInfo(),e);l.getVoRepresentations(t).forEach((function(e){var t=l.getIsDynamic(),n=T.calcSegmentAvailabilityRange(e,t);n.end<n.start&&(o=!1)}))})),o&&function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(C&&!e.getPreloaded()){var n=Z(e,t);n&&(e.setPreloadingScheduled(!0),r.info("[onStreamCanLoadNext] Preloading next stream with id "+e.getId()),e.preload(C,B),k.push(e),e.getProcessors().forEach((function(t){t.setBufferingTime(e.getStartTime())})))}}(n,i)}t+=1};for(;t<e.length;)n()}()}),500))}function X(e){try{if(!e)return!1;var t=e.getProcessors().filter((function(e){return e.getType()===cg.default.AUDIO||e.getType()===cg.default.VIDEO}));if(!t||0===t.length)return!1;var n=t.filter((function(e){return!e.isBufferingCompleted()}));return n&&0===n.length}catch(e){return!1}}function Q(){var e=pe().isLast;C&&e&&(r.info("[onStreamBufferingCompleted] calls signalEndOfStream of mediaSourceController."),f.signalEndOfStream(C))}function Z(e,t){try{return q.get().streaming.reuseExistingSourceBuffers&&t.isProtectionCompatible(e,t)&&(G||t.isMediaCodecCompatible(e,t))&&!function(e){try{var t=e.getStreamInfo(),n=l.getAdaptationForType(t.index,cg.default.FRAGMENTED_TEXT,t);return!!n&&(-1!==n.codecs.indexOf("stpp")||-1!==n.codecs.indexOf("wvtt"))}catch(e){return!1}}(e)}catch(e){return!1}}function $(e){if(isNaN(e))return null;var t=0,n=null,r=A.length;r>0&&(t+=A[0].getStartTime());for(var i=0;i<r;i++)if(n=A[i],e<(t=parseFloat((t+n.getDuration()).toFixed(5))))return n;return null}function J(){return S?S.getProcessors():[]}function ee(e){if(!S.getIsEndedEventSignaled()){S.setIsEndedEventSignaled(!0);var t=te();t?(r.debug("StreamController onEnded, found next stream with id "+t.getStreamInfo().id),ne(t,S,NaN)):(r.debug("StreamController no next stream found"),S.setIsEndedEventSignaled(!1)),ce(t?Ou.PlayListTrace.END_OF_PERIOD_STOP_REASON:Ou.PlayListTrace.END_OF_CONTENT_STOP_REASON)}e&&e.isLast&&z()}function te(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=e||(S||null);if(t){for(var n=t.getStreamInfo().start,r=t.getStreamInfo().duration,i=parseFloat((n+r).toFixed(5)),a=0,o=-1,s=NaN;a<A.length;){var u=A[a],l=u.getStreamInfo().start-i;l>=0&&(isNaN(s)||l<s)&&(s=l,o=a),a+=1}return o>=0?A[o]:null}return null}function ne(e,n,i){if(!(N||!e||n===e&&e.isActive())){N=!0,t.trigger(mg.default.PERIOD_SWITCH_STARTED,{fromStreamInfo:n?n.getStreamInfo():null,toStreamInfo:e.getStreamInfo()});var a=!1;n&&(a=Z(e,n),n.deactivate(a)),i=isNaN(i)?!a&&n?e.getStreamInfo().start:NaN:i,r.info("Switch to stream "+e.getId()+". Seektime is "+i+", current playback time is "+w.getTime()),r.info("Seamless period switch is set to "+a),S=e,k=k.filter((function(e){return e.getId()!==S.getId()})),w.initialize(pe(),!!n,i),O.getElement()?re(i,null===n,!1,a):ie(i,a)}}function re(e,n,i,a){var o=void 0;function s(){C&&"open"===C.readyState&&(r.debug("MediaSource is open!"),window.URL.revokeObjectURL(o),C.removeEventListener("sourceopen",s),C.removeEventListener("webkitsourceopen",s),ae(),n||t.trigger(mg.default.SOURCE_INITIALIZED),i?S.setMediaSource(C):ie(e,a))}C?a?(ie(e,a),n||t.trigger(mg.default.SOURCE_INITIALIZED)):(f.detachMediaSource(O),C.addEventListener("sourceopen",s,!1),C.addEventListener("webkitsourceopen",s,!1),o=f.attachMediaSource(C,O),r.debug("MediaSource attached to element. Waiting on open...")):((C=f.createMediaSource()).addEventListener("sourceopen",s,!1),C.addEventListener("webkitsourceopen",s,!1),o=f.attachMediaSource(C,O),r.debug("MediaSource attached to element. Waiting on open..."))}function ie(e,n){if(B=S.activate(C,n?B:void 0)){var r=Object.keys(B);r.length>0&&B[r[0]].changeType&&(G=!0)}F||isNaN(e)||(e===w.getTime()?t.trigger(mg.default.SEEK_TARGET,{time:e},{streamId:S.getId()}):w.seek(e)),!b&&F||w.play(),N=!1,t.trigger(mg.default.PERIOD_SWITCH_COMPLETED,{toStreamInfo:pe()})}function ae(e){var t=e||pe().manifestInfo.duration;f.setDuration(C,t)}function oe(e){for(var t=0,n=A.length;t<n;t++)if(A[t].getId()===e.id)return A[t];return null}function se(){try{var n=l.getStreamsInfo();if(0===n.length)throw new Error("There are no streams");d.updateManifestUpdateInfo({currentTime:w.getTime(),buffered:O.getBufferRange(),presentationStartTime:n[0].start,clientTimeOffset:T.getClientTimeOffset()}),A.length>0&&(A=A.filter((function(e){var t=n.filter((function(t){return t.id===e.getId()})).length>0||e.getId()===S.getId();return t||r.debug("Removing stream "+e.getId()),t})));for(var s=0,f=n.length;s<f;s++){var c=n[s],E=oe(c);E?E.updateData(c):(E=(0,hg.default)(e).create({manifestModel:u,mediaPlayerModel:P,dashMetrics:d,manifestUpdater:o,adapter:l,timelineConverter:T,capabilities:i,capabilitiesFilter:a,errHandler:y,baseURLController:g,abrController:h,playbackController:w,eventController:_,mediaController:p,textController:m,protectionController:I,videoModel:O,streamInfo:c,settings:q}),A.push(E),E.initialize()),d.addManifestUpdateStreamInfo(c)}if(!S){if(l.getIsDynamic()&&A.length){var v=n[0].manifestInfo,R=function(e,t){try{var n=NaN;if(t&&!isNaN(t.maxFragmentDuration)&&isFinite(t.maxFragmentDuration))return t.maxFragmentDuration;if(e&&1===e.length){var r=e[0],i=[cg.default.VIDEO,cg.default.AUDIO,cg.default.FRAGMENTED_TEXT].reduce((function(e,t){var n=l.getMediaInfoForType(r,t);return n&&e.push(n),e}),[]).reduce((function(e,t){var n=l.getVoRepresentations(t);return n&&n.length>0&&n.forEach((function(t){t&&e.push(t)})),e}),[]).reduce((function(e,t){var n=l.convertDataToRepresentationInfo(t);return n&&n.fragmentDuration&&!isNaN(n.fragmentDuration)&&e.push(n.fragmentDuration),e}),[]);n=Math.max.apply(Math,function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(i))}return isFinite(n)?n:NaN}catch(e){return NaN}}(n,v);w.computeAndSetLiveDelay(R,v.DVRWindowSize,v.minBufferTime)}var b=null;!(b=$(w.getStartTimeFromUriParameters(l.getIsDynamic())))&&l.getIsDynamic()&&A.length&&(r.debug("Dynamic stream: Trying to find the correct starting period"),b=function(){try{var e=T.calcPresentationTimeFromWallTime(new Date,l.getRegularPeriods()[0]),t=w.getLiveDelay();return $(e-t)}catch(e){return null}}()),ne(null!==b?b:A[0],null,NaN),x||(x=setInterval((function(){!N&&w.getTimeToStreamEnd()<=0&&t.trigger(mg.default.PLAYBACK_ENDED,{isLast:pe().isLast})}),200)),W()}t.trigger(mg.default.STREAMS_COMPOSED)}catch(e){y.error(new Rg.default(bg.default.MANIFEST_ERROR_ID_NOSTREAMS_CODE,e.message+"nostreamscomposed",u.getValue())),D=!0,ve()}}function ue(){var e=u.getValue();I&&(t.trigger(mg.default.PROTECTION_CREATED,{controller:I,manifest:e}),I.setMediaElement(O.getElement()),R&&I.setProtectionData(R)),se()}function le(e){if(e.error)D=!0,ve();else{var n=e.manifest;l.updatePeriods(n);var i=l.getUTCTimingSources();!l.getIsDynamic()||i&&0!==i.length||t.trigger(Ag.default.CONFORMANCE_VIOLATION,{level:Mg.default.LEVELS.WARNING,event:Mg.default.EVENTS.NO_UTC_TIMING_ELEMENT});var a=l.getIsDynamic()?i.concat(P.getUTCTimingSources()):i,o=v.isHTTPS(e.manifest.url);a.forEach((function(e){e.value.replace(/.*?:\/\//g,"")===P.getDefaultUtcTimingSource().value.replace(/.*?:\/\//g,"")&&(e.value=e.value.replace(o?new RegExp(/^(http:)?\/\//i):new RegExp(/^(https:)?\/\//i),o?"https://":"http://"),r.debug("Matching default timing source protocol to manifest protocol: ",e.value))})),g.initialize(n),c.attemptSync(a)}}function de(){return!!S&&S.getHasVideoTrack()}function fe(){return!!S&&S.getHasAudioTrack()}function ce(e,t){t=t||new Date,J().forEach((function(n){n.finalisePlayList(t,e)})),d.addPlayList()}function ge(e){d.createPlaylistMetrics(1e3*w.getTime(),e)}function he(e){if(e.error){var t="";switch(e.error.code){case 1:t="MEDIA_ERR_ABORTED";break;case 2:t="MEDIA_ERR_NETWORK";break;case 3:t="MEDIA_ERR_DECODE";break;case 4:t="MEDIA_ERR_SRC_NOT_SUPPORTED";break;case 5:t="MEDIA_ERR_ENCRYPTED";break;default:t="UNKNOWN"}M=!0,e.error.message&&(t+=" ("+e.error.message+")"),e.error.msExtendedCode&&(t+=" (0x"+(e.error.msExtendedCode>>>0).toString(16).toUpperCase()+")"),r.fatal("Video Element Error: "+t),e.error&&r.fatal(e.error),y.error(new Rg.default(e.error.code,t)),ve()}}function pe(){return S?S.getStreamInfo():null}function _e(){if(!(s&&s.hasOwnProperty("load")&&T&&T.hasOwnProperty("initialize")&&T.hasOwnProperty("reset")&&T.hasOwnProperty("getClientTimeOffset")&&u&&y&&d&&w))throw new Error(cg.default.MISSING_CONFIG_ERROR)}function me(e){isNaN(e.newDuration)||ae(e.newDuration)}function Ee(){A=[],I=null,N=!1,S=null,M=!1,D=!1,F=!0,L=!1,b=!0,x=null,U=null,k=[]}function ve(){_e(),c.reset(),ce(M||D?Ou.PlayListTrace.FAILURE_STOP_REASON:Ou.PlayListTrace.USER_REQUEST_STOP_REASON);for(var e=0,r=A?A.length:0;e<r;e++){A[e].reset(M)}t.off(mg.default.PLAYBACK_TIME_UPDATED,Y,n),t.off(mg.default.PLAYBACK_SEEKING,j,n),t.off(mg.default.GAP_CAUSED_SEEK_TO_PERIOD_END,H,n),t.off(mg.default.PLAYBACK_ERROR,he,n),t.off(mg.default.PLAYBACK_STARTED,K,n),t.off(mg.default.PLAYBACK_PAUSED,V,n),t.off(mg.default.PLAYBACK_ENDED,ee,n),t.off(mg.default.MANIFEST_UPDATED,le,n),t.off(mg.default.STREAM_BUFFERING_COMPLETED,Q,n),t.off(mg.default.MANIFEST_VALIDITY_CHANGED,me,n),t.off(mg.default.TIME_SYNCHRONIZATION_COMPLETED,ue,n),t.off(Ag.default.METRIC_ADDED,ye,n),g.reset(),o.reset(),_.reset(),d.clearAllCurrentMetrics(),u.setValue(null),s.reset(),T.reset(),E.reset(),C&&(f.detachMediaSource(O),C=null),O=null,I&&(I.setMediaElement(null),I=null,R=null,u.getValue()&&t.trigger(mg.default.PROTECTION_DESTROYED,{data:u.getValue().url})),z(),clearInterval(U),U=null,t.trigger(mg.default.STREAM_TEARDOWN_COMPLETE),Ee()}function ye(e){if(e.metric===gg.default.DVR_INFO){var t=fe()?cg.default.AUDIO:cg.default.VIDEO;e.mediaType===t&&f.setSeekable(C,e.value.range.start,e.value.range.end)}}return n={initialize:function(r,i){_e(),b=r,R=i,T.initialize(),(o=(0,pg.default)(e).create()).setConfig({manifestModel:u,adapter:l,manifestLoader:s,errHandler:y,settings:q}),o.initialize(),(_=(0,Ng.default)(e).getInstance()).setConfig({manifestUpdater:o,playbackController:w,settings:q}),_.start(),c.setConfig({dashMetrics:d,baseURLController:g,settings:q}),c.initialize(),t.on(mg.default.PLAYBACK_TIME_UPDATED,Y,n),t.on(mg.default.PLAYBACK_SEEKING,j,n),t.on(mg.default.GAP_CAUSED_SEEK_TO_PERIOD_END,H,n),t.on(mg.default.PLAYBACK_ERROR,he,n),t.on(mg.default.PLAYBACK_STARTED,K,n),t.on(mg.default.PLAYBACK_PAUSED,V,n),t.on(mg.default.PLAYBACK_ENDED,ee,n,{priority:_g.default.EVENT_PRIORITY_HIGH}),t.on(mg.default.MANIFEST_UPDATED,le,n),t.on(mg.default.STREAM_BUFFERING_COMPLETED,Q,n),t.on(mg.default.MANIFEST_VALIDITY_CHANGED,me,n),t.on(mg.default.TIME_SYNCHRONIZATION_COMPLETED,ue,n),t.on(Ag.default.METRIC_ADDED,ye,n)},getActiveStreamInfo:pe,hasVideoTrack:de,hasAudioTrack:fe,switchToVideoElement:function(e){S&&(w.initialize(pe()),re(e,!1,!0,!1))},getStreamById:function(e){return A.filter((function(t){return t.getId()===e}))[0]},getStreamForTime:$,getTimeRelativeToStreamId:function(e,t){for(var n=null,r=0,i=0,a=null,o=0;o<A.length;o++){if(i=(n=A[o]).getStartTime(),a=n.getDuration(),Number.isFinite(i)&&(r=i),n.getId()===t)return e-r;Number.isFinite(a)&&(r+=a)}return null},load:function(e){_e(),s.load(e)},loadWithManifest:function(e){!function(){if(!o||!o.hasOwnProperty("setManifest"))throw new Error("initialize function has to be called previously")}(),o.setManifest(e)},getActiveStreamProcessors:J,setConfig:function(e){e&&(e.capabilities&&(i=e.capabilities),e.capabilitiesFilter&&(a=e.capabilitiesFilter),e.manifestLoader&&(s=e.manifestLoader),e.manifestModel&&(u=e.manifestModel),e.mediaPlayerModel&&(P=e.mediaPlayerModel),e.protectionController&&(I=e.protectionController),e.adapter&&(l=e.adapter),e.dashMetrics&&(d=e.dashMetrics),e.errHandler&&(y=e.errHandler),e.timelineConverter&&(T=e.timelineConverter),e.videoModel&&(O=e.videoModel),e.playbackController&&(w=e.playbackController),e.abrController&&(h=e.abrController),e.mediaController&&(p=e.mediaController),e.textController&&(m=e.textController),e.settings&&(q=e.settings),e.baseURLController&&(g=e.baseURLController))},setProtectionData:function(e){R=e},getIsStreamSwitchInProgress:function(){return N},getHasMediaOrIntialisationError:function(){return M||D},hasStreamFinishedBuffering:X,getStreams:function(){return A},getActiveStream:function(){return S},reset:ve},r=(0,vg.default)(e).getInstance().getLogger(n),c=(0,Sg.default)(e).getInstance(),f=(0,Ig.default)(e).getInstance(),E=(0,yg.default)(e).getInstance(),v=(0,Tg.default)(e).getInstance(),Ee(),n}Cg.__dashjs_factory_name="StreamController";var Og=Eg.default.getSingletonFactory(Cg),wg=Object.defineProperty({default:Og},"__esModule",{value:!0}),Pg=Ug(S),Lg=Ug(ee),Fg=Ug(q),xg=Ug(x);function Ug(e){return e&&e.__esModule?e:{default:e}}function Bg(){var e=this.context,t=(0,xg.default)(e).getInstance(),n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,u=void 0,l=void 0,d=void 0,f=void 0,c=void 0;function g(){c.debug("Stopping the gap controller"),o&&(clearInterval(o),o=null),function(){t.off(Fg.default.WALLCLOCK_TIME_UPDATED,_,this),t.off(Fg.default.PLAYBACK_SEEKING,p,this),t.off(Fg.default.BYTES_APPENDED_END_FRAGMENT,h,n)}(),o=null,s=NaN,a=0,f=null}function h(){o||function(){try{o||(c.debug("Starting the gap controller"),o=setInterval((function(){m()&&v(u.getTime())}),100))}catch(e){}}()}function p(){f&&(clearTimeout(f),f=null)}function _(){if(m()&&++a>=30){var e=u.getTime();r===e?v(e,!0):(r=e,s=NaN),a=0}}function m(){return i.get().streaming.jumpGaps&&l.getActiveStreamProcessors().length>0&&(!u.isSeeking()||l.hasStreamFinishedBuffering(l.getActiveStream()))&&!u.isPaused()&&!l.getIsStreamSwitchInProgress()&&!l.getHasMediaOrIntialisationError()}function E(e,t){try{if(!e||e.length<=1&&t>0)return NaN;for(var n=NaN,r=0;isNaN(n)&&r<e.length;){var i=r>0?e.end(r-1):0;t<e.start(r)&&i-t<.1&&(n=r),r+=1}return n}catch(e){return null}}function v(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=i.get().streaming.smallGapLimit,a=i.get().streaming.jumpLargeGaps,o=d.getBufferRange(),l=void 0,g=NaN,h=!1;if(l=E(o,e),!isNaN(l)){var p=o.start(l),_=p-e;_>0&&(_<=r||a)&&(g=p)}var m=u.getTimeToStreamEnd();if(isNaN(g)&&n&&isFinite(m)&&!isNaN(m)&&m<r&&(g=parseFloat(u.getStreamEndTime().toFixed(5)),h=!0),g>0&&s!==g&&g>e&&!f){var v=g-e;if(h)c.warn("Jumping to end of stream because of gap from "+e+" to "+g+". Gap duration: "+v),t.trigger(Fg.default.GAP_CAUSED_SEEK_TO_PERIOD_END,{seekTime:g,duration:v});else{var y=u.getIsDynamic(),T=l>0?o.end(l-1):e,A=y?1e3*v:0;f=window.setTimeout((function(){u.seek(g,!0,!0),c.warn("Jumping gap starting at "+T+" and ending at "+g+". Jumping by: "+v),t.trigger(Fg.default.GAP_CAUSED_INTERNAL_SEEK,{seekTime:g,duration:v}),f=null}),A)}s=g}}return n={reset:g,setConfig:function(e){e&&(e.settings&&(i=e.settings),e.playbackController&&(u=e.playbackController),e.streamController&&(l=e.streamController),e.videoModel&&(d=e.videoModel),e.timelineConverter&&e.timelineConverter,e.adapter&&e.adapter)},initialize:function(){!function(){t.on(Fg.default.WALLCLOCK_TIME_UPDATED,_,this),t.on(Fg.default.PLAYBACK_SEEKING,p,this),t.on(Fg.default.BYTES_APPENDED_END_FRAGMENT,h,n)}()}},c=(0,Lg.default)(e).getInstance().getLogger(n),g(),n}Bg.__dashjs_factory_name="GapController";var kg=Pg.default.getSingletonFactory(Bg),Gg=Object.defineProperty({default:kg},"__esModule",{value:!0}),qg=Vg(p),Yg=Vg(q),jg=Vg(x),Hg=Vg(S),Kg=Vg(ee);function Vg(e){return e&&e.__esModule?e:{default:e}}function zg(){var e=this.context,t=(0,jg.default)(e).getInstance(),n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,u=[qg.default.TRACK_SWITCH_MODE_ALWAYS_REPLACE,qg.default.TRACK_SWITCH_MODE_NEVER_REPLACE],l=[qg.default.TRACK_SELECTION_MODE_HIGHEST_BITRATE,qg.default.TRACK_SELECTION_MODE_FIRST_TRACK,qg.default.TRACK_SELECTION_MODE_HIGHEST_EFFICIENCY,qg.default.TRACK_SELECTION_MODE_WIDEST_RANGE];function d(e,t){if(!e||!t)return[];var n=t.id;return i[n]&&i[n][e]?i[n][e].list:[]}function f(e,t){return!e||!t||t&&!i[t.id]?null:i[t.id][e].current}function c(e,n){if(e&&e.streamInfo){var r=e.type,a=e.streamInfo,o=a.id,u=f(r,a);if(i[o]&&i[o][r]&&!E(e,u)&&(i[o][r].current=e,!i[o][r].current||n&&r===qg.default.FRAGMENTED_TEXT||t.trigger(Yg.default.CURRENT_TRACK_CHANGED,{oldMediaInfo:u,newMediaInfo:e,switchMode:p(r)}),!n)){var l=function(e){var t={lang:e.lang,viewpoint:e.viewpoint,roles:e.roles,accessibility:e.accessibility,audioChannelConfiguration:e.audioChannelConfiguration};return t.lang||t.viewpoint||t.role||t.accessibility&&t.accessibility.length>0||t.audioChannelConfiguration&&t.audioChannelConfiguration.length>0?t:null}(e);if(!l||!i[o][r].storeLastSettings)return;l.roles&&(l.role=l.roles[0],delete l.roles),l.accessibility&&(l.accessibility=l.accessibility[0]),l.audioChannelConfiguration&&(l.audioChannelConfiguration=l.audioChannelConfiguration[0]),s.setSavedMediaSettings(r,l)}}}function g(e,t){e&&t&&(o[e]=t)}function h(e){return e?o[e]:null}function p(e){return a.get().streaming.trackSwitchMode[e]}function _(){return a.get().streaming.selectionModeForInitialTrack}function m(e){return e===qg.default.AUDIO||e===qg.default.VIDEO||e===qg.default.TEXT||e===qg.default.FRAGMENTED_TEXT||e===qg.default.IMAGE}function E(e,t){if(!e&&!t)return!0;if(!e||!t)return!1;var n=e.id===t.id,r=e.viewpoint===t.viewpoint,i=e.lang===t.lang,a=e.roles.toString()===t.roles.toString(),o=e.accessibility.toString()===t.accessibility.toString(),s=e.audioChannelConfiguration.toString()===t.audioChannelConfiguration.toString();return n&&r&&i&&a&&o&&s}function v(){i={},o={audio:null,video:null,fragmentedText:null}}function y(e,t){var n=!e.lang||t.lang.match(e.lang),r=void 0===e.index||null===e.index||t.index===e.index,i=!e.viewpoint||e.viewpoint===t.viewpoint,a=!e.role||!!t.roles.filter((function(t){return t===e.role}))[0],o=!e.accessibility||!!t.accessibility.filter((function(t){return t===e.accessibility}))[0],s=!e.audioChannelConfiguration||!!t.audioChannelConfiguration.filter((function(t){return t===e.audioChannelConfiguration}))[0];return n&&r&&i&&a&&o&&s}function T(e){var t=0,n=[],r=void 0;return e.forEach((function(e){(r=Math.max.apply(Math,e.bitrateList.map((function(e){return e.bandwidth}))))>t?(t=r,n=[e]):r===t&&n.push(e)})),n}function A(e){var t=1/0,n=[],r=void 0;return e.forEach((function(e){var i=e.bitrateList.reduce((function(e,t){var n=Math.max(1,t.width*t.height);return e+t.bandwidth/n}),0);(r=i/e.bitrateList.length)<t?(t=r,n=[e]):r===t&&n.push(e)})),n}function S(e){var t=0,n=[],r=void 0;return e.forEach((function(e){(r=e.representationCount)>t?(t=r,n=[e]):r===t&&n.push(e)})),n}return n={checkInitialMediaSettingsForType:function(e,t){var n=h(e),r=d(e,t),i=[];n||g(e,n=s.getSavedMediaSettings(e)),r&&0!==r.length&&(n&&r.forEach((function(e){y(n,e)&&i.push(e)})),0===i.length?c(this.selectInitialTrack(e,r),!0):i.length>1?c(this.selectInitialTrack(e,i)):c(i[0]))},addTrack:function(e){if(e){var t=e.type;if(m(t)){var n=e.streamInfo.id;i[n]||(i[n]={audio:{list:[],storeLastSettings:!0,current:null},video:{list:[],storeLastSettings:!0,current:null},text:{list:[],storeLastSettings:!0,current:null},fragmentedText:{list:[],storeLastSettings:!0,current:null},image:{list:[],storeLastSettings:!0,current:null}});for(var r=i[n][t].list,a=0,o=r.length;a<o;++a)if(E(r[a],e))return;r.push(e);var s=h(t);s&&y(s,e)&&!f(t,e.streamInfo)&&c(e)}}},getTracksFor:d,getCurrentTrackFor:f,isCurrentTrack:function(e){if(!e)return!1;var t=e.type,n=e.streamInfo.id;return i[n]&&i[n][t]&&E(i[n][t].current,e)},setTrack:c,setInitialSettings:g,getInitialSettings:h,setSwitchMode:function(e,t){if(r.warn("deprecated: Please use updateSettings({streaming: { trackSwitchMode: mode } }) instead"),-1!==u.indexOf(t)){var n={};n[e]=t,a.update({streaming:{trackSwitchMode:n}})}else r.warn("Track switch mode is not supported: "+t)},getSwitchMode:p,selectInitialTrack:function(e,t){if(e===qg.default.FRAGMENTED_TEXT)return t[0];var n=_(),i=[];switch(n){case qg.default.TRACK_SELECTION_MODE_HIGHEST_BITRATE:(i=T(t)).length>1&&(i=S(i));break;case qg.default.TRACK_SELECTION_MODE_FIRST_TRACK:i.push(t[0]);break;case qg.default.TRACK_SELECTION_MODE_HIGHEST_EFFICIENCY:(i=A(t)).length>1&&(i=T(i));break;case qg.default.TRACK_SELECTION_MODE_WIDEST_RANGE:(i=S(t)).length>1&&(i=T(t));break;default:r.warn("Track selection mode is not supported: "+n)}return i[0]},getTracksWithHighestBitrate:T,getTracksWithHighestEfficiency:A,getTracksWithWidestRange:S,setSelectionModeForInitialTrack:function(e){r.warn("deprecated: Please use updateSettings({streaming: { selectionModeForInitialTrack: mode } }) instead"),-1!==l.indexOf(e)?a.update({streaming:{selectionModeForInitialTrack:e}}):r.warn("Track selection mode is not supported: "+e)},getSelectionModeForInitialTrack:_,isMultiTrackSupportedByType:m,isTracksEqual:E,matchSettings:y,saveTextSettingsDisabled:function(){s.setSavedMediaSettings(qg.default.FRAGMENTED_TEXT,null)},setConfig:function(e){e&&(e.domStorage&&(s=e.domStorage),e.settings&&(a=e.settings))},reset:v},r=(0,Kg.default)(e).getInstance().getLogger(n),v(),n}zg.__dashjs_factory_name="MediaController";var Wg=Hg.default.getSingletonFactory(zg);Hg.default.updateSingletonFactory(zg.__dashjs_factory_name,Wg);var Xg=Wg,Qg=Object.defineProperty({default:Xg},"__esModule",{value:!0}),Zg=Jg(ad),$g=Jg(S);function Jg(e){return e&&e.__esModule?e:{default:e}}var eh=function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.data={baseUrls:t||null,selectedIdx:n||NaN},this.children=[]};function th(){var e,t=void 0,n=void 0,r=this.context,i=(0,Zg.default)(r).getInstance();function a(e,t,r){var a=n.getBaseURLsFromElement(r);e[t]?i.areEqual(a,e[t].data.baseUrls)||(e[t].data.baseUrls=a,e[t].data.selectedIdx=NaN):e[t]=new eh(a)}function o(e){!function(){if(!n||!n.hasOwnProperty("getBaseURLsFromElement")||!n.hasOwnProperty("getRepresentationSortFunction"))throw new Error("setConfig function has to be called previously")}();var r=n.getBaseURLsFromElement(e);i.areEqual(r,t.data.baseUrls)||(t.data.baseUrls=r,t.data.selectedIdx=NaN),e&&e.Period_asArray&&e.Period_asArray.forEach((function(e,r){a(t.children,r,e),e.AdaptationSet_asArray&&e.AdaptationSet_asArray.forEach((function(e,i){a(t.children[r].children,i,e),e.Representation_asArray&&e.Representation_asArray.sort(n.getRepresentationSortFunction()).forEach((function(e,n){a(t.children[r].children[i].children,n,e)}))}))}))}function s(){t=new eh}return e={reset:s,update:function(e){o(e)},getForPath:function(e){var n=t,r=[n.data];return e&&e.forEach((function(e){(n=n.children[e])&&r.push(n.data)})),r.filter((function(e){return e.baseUrls.length}))},invalidateSelectedIndexes:function(e){!function e(n,r){var i=r||t;n(i.data),i.children&&i.children.forEach((function(t){return e(n,t)}))}((function(t){isNaN(t.selectedIdx)||e===t.baseUrls[t.selectedIdx].serviceLocation&&(t.selectedIdx=NaN)}))},setConfig:function(e){e.adapter&&(n=e.adapter)}},s(),e}th.__dashjs_factory_name="BaseURLTreeModel";var nh=$g.default.getClassFactory(th),rh=Object.defineProperty({default:nh},"__esModule",{value:!0}),ih=oh(S),ah=oh(x);function oh(e){return e&&e.__esModule?e:{default:e}}function sh(e){e=e||{};var t=void 0,n=[],r=(0,ah.default)(this.context).getInstance(),i=e.updateEventName,a=e.addBlacklistEventName;function o(e){-1===n.indexOf(e)&&(n.push(e),r.trigger(i,{entry:e}))}function s(e){o(e.entry)}return t={add:o,contains:function(e){return!!(n.length&&e&&e.length)&&-1!==n.indexOf(e)},reset:function(){n=[]}},a&&r.on(a,s,t),t}sh.__dashjs_factory_name="BlackListController";var uh=ih.default.getClassFactory(sh),lh=Object.defineProperty({default:uh},"__esModule",{value:!0}),dh=function(e){return e&&e.__esModule?e:{default:e}}(S);function fh(e){var t=(e=e||{}).blacklistController;return{select:function(e){return e&&function(e){var t=0,n=[],r=0,i=void 0,a=void 0;if((a=e.sort((function(e,t){var n=e.dvb_priority-t.dvb_priority;return isNaN(n)?0:n})).filter((function(e,t,n){return!t||n[0].dvb_priority&&e.dvb_priority&&n[0].dvb_priority===e.dvb_priority}))).length)return a.length>1&&(a.forEach((function(e){t+=e.dvb_weight,n.push(t)})),i=Math.floor(Math.random()*(t-1)),n.every((function(e,t){return r=t,!(i<e)}))),a[r]}((n=[],e.filter((function(e){return!t.contains(e.serviceLocation)||(e.dvb_priority&&n.push(e.dvb_priority),!1)})).filter((function(e){return!n.length||!e.dvb_priority||-1===n.indexOf(e.dvb_priority)}))));var n}}}fh.__dashjs_factory_name="DVBSelector";var ch=dh.default.getClassFactory(fh),gh=Object.defineProperty({default:ch},"__esModule",{value:!0}),hh=function(e){return e&&e.__esModule?e:{default:e}}(S);function ph(e){var t=(e=e||{}).blacklistController;return{select:function(e){var n=0,r=void 0;return e&&e.some((function(e,r){return n=r,!t.contains(e.serviceLocation)}))&&(r=e[n]),r}}}ph.__dashjs_factory_name="BasicSelector";var _h=hh.default.getClassFactory(ph),mh=Object.defineProperty({default:_h},"__esModule",{value:!0}),Eh=bh(Bt),vh=bh(x),yh=bh(q),Th=bh(lh),Ah=bh(gh),Sh=bh(mh),Ih=bh(S),Rh=bh(Me);function bh(e){return e&&e.__esModule?e:{default:e}}function Nh(){var e,t=this.context,n=(0,vh.default)(t).getInstance(),r=void 0,i=void 0,a=void 0,o=void 0;function s(){r.reset()}return e={chooseSelector:function(e){(0,rt.checkParameterType)(e,"boolean"),o=e?a:i},select:function(e){if(e){var t=e.baseUrls,r=e.selectedIdx;if(!isNaN(r))return t[r];var a=o.select(t);return a?(e.selectedIdx=t.indexOf(a),a):(n.trigger(yh.default.URL_RESOLUTION_FAILED,{error:new Rh.default(Eh.default.URL_RESOLUTION_FAILED_GENERIC_ERROR_CODE,Eh.default.URL_RESOLUTION_FAILED_GENERIC_ERROR_MESSAGE)}),void(o===i&&s()))}},reset:s,setConfig:function(e){e.selector&&(o=e.selector)}},r=(0,Th.default)(t).create({updateEventName:yh.default.SERVICE_LOCATION_BLACKLIST_CHANGED,addBlacklistEventName:yh.default.SERVICE_LOCATION_BLACKLIST_ADD}),i=(0,Sh.default)(t).create({blacklistController:r}),a=(0,Ah.default)(t).create({blacklistController:r}),o=i,e}Nh.__dashjs_factory_name="BaseURLSelector";var Mh=Ih.default.getClassFactory(Nh),Dh=Object.defineProperty({default:Mh},"__esModule",{value:!0}),Ch=Uh(rh),Oh=Uh(Dh),wh=Uh(Ru),Ph=Uh(Wl),Lh=Uh(S),Fh=Uh(x),xh=Uh(q);function Uh(e){return e&&e.__esModule?e:{default:e}}function Bh(){var e=void 0,t=void 0,n=this.context,r=(0,Fh.default)(n).getInstance(),i=(0,wh.default)(n).getInstance(),a=void 0,o=void 0;function s(e){a.invalidateSelectedIndexes(e.entry)}return e={reset:function(){a.reset(),o.reset()},initialize:function(e){var n;a.setConfig({adapter:t}),n=e,a.update(n),o.chooseSelector(t.getIsDVB(n))},resolve:function(e){var t=a.getForPath(e).reduce((function(e,t){var n=o.select(t);return n?(i.isRelative(n.url)?e.url=i.resolve(n.url,e.url):(e.url=n.url,e.serviceLocation=n.serviceLocation),e.availabilityTimeOffset=n.availabilityTimeOffset,e.availabilityTimeComplete=n.availabilityTimeComplete,e):new Ph.default}),new Ph.default);if(!i.isRelative(t.url))return t},setConfig:function(e){e.baseURLTreeModel&&(a=e.baseURLTreeModel),e.baseURLSelector&&(o=e.baseURLSelector),e.adapter&&(t=e.adapter)}},a=(0,Ch.default)(n).create(),o=(0,Oh.default)(n).create(),r.on(xh.default.SERVICE_LOCATION_BLACKLIST_CHANGED,s,e),e}Bh.__dashjs_factory_name="BaseURLController";var kh=Lh.default.getClassFactory(Bh),Gh=Object.defineProperty({default:kh},"__esModule",{value:!0}),qh=Yh(p);function Yh(e){return e&&e.__esModule?e:{default:e}}var jh=function(e){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return r.url=e||null,r.type=n||null,r.mediaType=qh.default.STREAM,r.responseType="",r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(Yh(ve).default),Hh=Object.defineProperty({default:jh},"__esModule",{value:!0}),Kh=$h(Me),Vh=$h(Mf),zh=$h(Hh),Wh=$h(x),Xh=$h(q),Qh=$h(S),Zh=$h(Bt);function $h(e){return e&&e.__esModule?e:{default:e}}function Jh(e){e=e||{};var t=this.context,n=(0,Wh.default)(t).getInstance(),r=(0,Vh.default)(t).create({errHandler:e.errHandler,dashMetrics:e.dashMetrics,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,useFetch:e.settings?e.settings.get().streaming.lowLatencyEnabled:null,errors:Zh.default});return{load:function(e,t,i){var a=function(r,a){t.resolved=!0,t.resolvedContent=r||null,n.trigger(Xh.default.XLINK_ELEMENT_LOADED,{element:t,resolveObject:i,error:r||a?null:new Kh.default(Zh.default.XLINK_LOADER_LOADING_FAILURE_ERROR_CODE,Zh.default.XLINK_LOADER_LOADING_FAILURE_ERROR_MESSAGE+e)})};if("urn:mpeg:dash:resolve-to-zero:2013"===e)a(null,!0);else{var o=new zh.default(e,pe.HTTPRequest.XLINK_EXPANSION_TYPE);r.load({request:o,success:function(e){a(e)},error:function(){a(null)}})}},reset:function(){r&&(r.abort(),r=null)}}}Jh.__dashjs_factory_name="XlinkLoader";var ep=Qh.default.getClassFactory(Jh),tp=Object.defineProperty({default:ep},"__esModule",{value:!0});var np=function(e){e=e||{},function(){void 0===e.escapeMode&&(e.escapeMode=!0);void 0===e.attributePrefix&&(e.attributePrefix="_");e.arrayAccessForm=e.arrayAccessForm||"none",e.emptyNodeForm=e.emptyNodeForm||"text",void 0===e.enableToStringFunc&&(e.enableToStringFunc=!0);e.arrayAccessFormPaths=e.arrayAccessFormPaths||[],void 0===e.skipEmptyTextNodesForObj&&(e.skipEmptyTextNodesForObj=!0);void 0===e.stripWhitespaces&&(e.stripWhitespaces=!0);e.datetimeAccessFormPaths=e.datetimeAccessFormPaths||[],void 0===e.useDoubleQuotes&&(e.useDoubleQuotes=!1);e.xmlElementsFilter=e.xmlElementsFilter||[],e.jsonPropertiesFilter=e.jsonPropertiesFilter||[],void 0===e.keepCData&&(e.keepCData=!1);void 0===e.ignoreRoot&&(e.ignoreRoot=!1)}();var t=1,n=3,r=4,i=8,a=9;function o(e){var t=e.localName;return null==t&&(t=e.baseName),null!=t&&""!=t||(t=e.nodeName),t}function s(e){return"string"==typeof e?e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;"):e}function u(e,t,n,r){for(var i=0;i<e.length;i++){var a=e[i];if("string"==typeof a){if(a==r)break}else if(a instanceof RegExp){if(a.test(r))break}else if("function"==typeof a&&a(t,n,r))break}return i!=e.length}function l(t,n,r){switch(e.arrayAccessForm){case"property":t[n]instanceof Array?t[n+"_asArray"]=t[n]:t[n+"_asArray"]=[t[n]]}!(t[n]instanceof Array)&&e.arrayAccessFormPaths.length>0&&u(e.arrayAccessFormPaths,t,n,r)&&(t[n]=[t[n]])}function d(e){var t=e.split(/[-T:+Z]/g),n=new Date(t[0],t[1]-1,t[2]),r=t[5].split(".");if(n.setHours(t[3],t[4],r[0]),r.length>1&&n.setMilliseconds(r[1]),t[6]&&t[7]){var i=60*t[6]+Number(t[7]);i=0+("-"==(/\d\d-\d\d:\d\d$/.test(e)?"-":"+")?-1*i:i),n.setMinutes(n.getMinutes()-i-n.getTimezoneOffset())}else-1!==e.indexOf("Z",e.length-1)&&(n=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds())));return n}function f(n,r,i,a){return!(r==t&&e.xmlElementsFilter.length>0)||u(e.xmlElementsFilter,n,i,a)}function c(s,g){if(s.nodeType==a){for(var h=new Object,p=s.childNodes,_=0;_<p.length;_++){if((E=p[_]).nodeType==t)if(e.ignoreRoot)h=c(E);else(h={})[v=o(E)]=c(E)}return h}if(s.nodeType==t){(h=new Object).__cnt=0;var m=[];for(p=s.childNodes,_=0;_<p.length;_++){var E,v=o(E=p[_]);if(E.nodeType!=i){var y=g+"."+v;if(f(h,E.nodeType,v,y))if(h.__cnt++,null==h[v]){var T=c(E,y);if("#text"!=v||/[^\s]/.test(T))(A={})[v]=T,m.push(A);h[v]=T,l(h,v,y)}else{null!=h[v]&&(h[v]instanceof Array||(h[v]=[h[v]],l(h,v,y)));var A;T=c(E,y);if("#text"!=v||/[^\s]/.test(T))(A={})[v]=T,m.push(A);h[v][h[v].length]=T}}}h.__children=m;for(var S=o(s),I=0;I<s.attributes.length;I++){var R=s.attributes[I];h.__cnt++;for(var b=R.value,N=0,M=e.matchers.length;N<M;N++){var D=e.matchers[N];D.test(R,S)&&(b=D.converter(R.value))}h[e.attributePrefix+R.name]=b}var C=function(e){return e.prefix}(s);return null!=C&&""!=C&&(h.__cnt++,h.__prefix=C),null!=h["#text"]&&(h.__text=h["#text"],h.__text instanceof Array&&(h.__text=h.__text.join("\n")),e.stripWhitespaces&&(h.__text=h.__text.trim()),delete h["#text"],"property"==e.arrayAccessForm&&delete h["#text_asArray"],h.__text=function(t,n,r){if(e.datetimeAccessFormPaths.length>0){var i=r.split(".#")[0];return u(e.datetimeAccessFormPaths,t,n,i)?d(t):t}return t}(h.__text,v,g+"."+v)),null!=h["#cdata-section"]&&(h.__cdata=h["#cdata-section"],delete h["#cdata-section"],"property"==e.arrayAccessForm&&delete h["#cdata-section_asArray"]),0==h.__cnt&&"text"==e.emptyNodeForm?h="":1==h.__cnt&&null!=h.__text?h=h.__text:1!=h.__cnt||null==h.__cdata||e.keepCData?h.__cnt>1&&null!=h.__text&&e.skipEmptyTextNodesForObj&&(e.stripWhitespaces&&""==h.__text||""==h.__text.trim())&&delete h.__text:h=h.__cdata,delete h.__cnt,!e.enableToStringFunc||null==h.__text&&null==h.__cdata||(h.toString=function(){return(null!=this.__text?this.__text:"")+(null!=this.__cdata?this.__cdata:"")}),h}if(s.nodeType==n||s.nodeType==r)return s.nodeValue}function g(t,n,r,i){var a="<"+(null!=t&&null!=t.__prefix?t.__prefix+":":"")+n;if(null!=r)for(var o=0;o<r.length;o++){var u=r[o],l=t[u];e.escapeMode&&(l=s(l)),a+=" "+u.substr(e.attributePrefix.length)+"=",e.useDoubleQuotes?a+='"'+l+'"':a+="'"+l+"'"}return a+=i?"/>":">"}function h(e,t){return"</"+(null!=e.__prefix?e.__prefix+":":"")+t+">"}function p(t,n){return"property"==e.arrayAccessForm&&(r=n.toString(),i="_asArray",-1!==r.indexOf(i,r.length-i.length))||0==n.toString().indexOf(e.attributePrefix)||0==n.toString().indexOf("__")||t[n]instanceof Function;var r,i}function _(e){var t=0;if(e instanceof Object)for(var n in e)p(e,n)||t++;return t}function m(t,n,r){return 0==e.jsonPropertiesFilter.length||""==r||u(e.jsonPropertiesFilter,t,n,r)}function E(t){var n=[];if(t instanceof Object)for(var r in t)-1==r.toString().indexOf("__")&&0==r.toString().indexOf(e.attributePrefix)&&n.push(r);return n}function v(t){var n="";return t instanceof Object?n+=function(t){var n="";return null!=t.__cdata&&(n+="<![CDATA["+t.__cdata+"]]>"),null!=t.__text&&(e.escapeMode?n+=s(t.__text):n+=t.__text),n}(t):null!=t&&(e.escapeMode?n+=s(t):n+=t),n}function y(e,t){return""===e?t:e+"."+t}function T(e,t,n,r){var i="";if(0==e.length)i+=g(e,t,n,!0);else for(var a=0;a<e.length;a++)i+=g(e[a],t,E(e[a]),!1),i+=A(e[a],y(r,t)),i+=h(e[a],t);return i}function A(e,t){var n="";if(_(e)>0)for(var r in e)if(!p(e,r)&&(""==t||m(e,r,y(t,r)))){var i=e[r],a=E(i);if(null==i||null==i)n+=g(i,r,a,!0);else if(i instanceof Object)if(i instanceof Array)n+=T(i,r,a,t);else if(i instanceof Date)n+=g(i,r,a,!1),n+=i.toISOString(),n+=h(i,r);else{_(i)>0||null!=i.__text||null!=i.__cdata?(n+=g(i,r,a,!1),n+=A(i,y(t,r)),n+=h(i,r)):n+=g(i,r,a,!0)}else n+=g(i,r,a,!1),n+=v(i),n+=h(i,r)}return n+=v(e)}this.parseXmlString=function(e){if(void 0===e)return null;var t;if(window.DOMParser){var n=new window.DOMParser;try{(t=n.parseFromString(e,"text/xml")).getElementsByTagNameNS("*","parsererror").length>0&&(t=null)}catch(e){t=null}}else 0==e.indexOf("<?")&&(e=e.substr(e.indexOf("?>")+2)),(t=new ActiveXObject("Microsoft.XMLDOM")).async="false",t.loadXML(e);return t},this.asArray=function(e){return void 0===e||null==e?[]:e instanceof Array?e:[e]},this.toXmlDateTime=function(e){return e instanceof Date?e.toISOString():"number"==typeof e?new Date(e).toISOString():null},this.asDateTime=function(e){return"string"==typeof e?d(e):e},this.xml2json=function(e){return c(e)},this.xml_str2json=function(e){var t=this.parseXmlString(e);return null!=t?this.xml2json(t):null},this.json2xml_str=function(e){return A(e,"")},this.json2xml=function(e){var t=this.json2xml_str(e);return this.parseXmlString(t)},this.getVersion=function(){return"1.2.0"}},rp=Object.defineProperty({default:np},"__esModule",{value:!0}),ip=fp(tp),ap=fp(x),op=fp(q),sp=fp(S),up=fp(rp),lp=fp(Ru),dp=fp(E);function fp(e){return e&&e.__esModule?e:{default:e}}function cp(e){e=e||{};var t=this.context,n=(0,ap.default)(t).getInstance(),r=(0,lp.default)(t).getInstance(),i=void 0,a=void 0,o=void 0,s=void 0,u=void 0,l=void 0;function d(e,t,n){var i={},a=void 0,o=void 0;i.elements=e,i.type=t,i.resolveType=n,0===i.elements.length&&c(i);for(var s=0;s<i.elements.length;s++)a=i.elements[s],o=r.isHTTPURL(a.url)?a.url:a.originalContent.BaseURL+a.url,l.load(o,a,i)}function f(e){var t,n=void 0,r="";if(n=e.element,t=e.resolveObject,n.resolvedContent){var i=0;0===n.resolvedContent.indexOf("<?xml")&&(i=n.resolvedContent.indexOf("?>")+2),r=n.resolvedContent.substr(0,i)+"<response>"+n.resolvedContent.substr(i)+"</response>",n.resolvedContent=u.xml_str2json(r)}(function(e){var t=void 0;for(t=0;t<e.elements.length;t++)if(!1===e.elements[t].resolved)return!1;return!0})(t)&&c(t)}function c(e){var t=[],r=void 0,i=void 0;if(function(e){var t=[],n=void 0,r=void 0,i=void 0,a=void 0,u=void 0,l=void 0;for(a=e.elements.length-1;a>=0;a--){if(n=e.elements[a],r=n.type+"_asArray",n.resolvedContent){if(n.resolvedContent)for(u=0;u<n.resolvedContent[r].length;u++)i=n.resolvedContent[r][u],t.push(i)}else delete n.originalContent["xlink:actuate"],delete n.originalContent["xlink:href"],t.push(n.originalContent);for(n.parentElement[r].splice(n.index,1),l=0;l<t.length;l++)n.parentElement[r].splice(n.index+l,0,t[l]);t=[]}e.elements.length>0&&o.run(s)}(e),"onActuate"===e.resolveType&&n.trigger(op.default.XLINK_READY,{manifest:s}),"onLoad"===e.resolveType)switch(e.type){case dp.default.PERIOD:for(r=0;r<s[dp.default.PERIOD+"_asArray"].length;r++)(i=s[dp.default.PERIOD+"_asArray"][r]).hasOwnProperty(dp.default.ADAPTATION_SET+"_asArray")&&(t=t.concat(g(i[dp.default.ADAPTATION_SET+"_asArray"],i,dp.default.ADAPTATION_SET,"onLoad"))),i.hasOwnProperty(dp.default.EVENT_STREAM+"_asArray")&&(t=t.concat(g(i[dp.default.EVENT_STREAM+"_asArray"],i,dp.default.EVENT_STREAM,"onLoad")));d(t,dp.default.ADAPTATION_SET,"onLoad");break;case dp.default.ADAPTATION_SET:n.trigger(op.default.XLINK_READY,{manifest:s})}}function g(e,t,n,r){var i=[],a=void 0,o=void 0,s=void 0;for(o=e.length-1;o>=0;o--)(a=e[o]).hasOwnProperty("xlink:href")&&"urn:mpeg:dash:resolve-to-zero:2013"===a["xlink:href"]&&e.splice(o,1);for(o=0;o<e.length;o++)(a=e[o]).hasOwnProperty("xlink:href")&&a.hasOwnProperty("xlink:actuate")&&a["xlink:actuate"]===r&&(s=h(a["xlink:href"],t,n,o,r,a),i.push(s));return i}function h(e,t,n,r,i,a){return{url:e,parentElement:t,type:n,index:r,resolveType:i,originalContent:a,resolvedContent:null,resolved:!1}}return i={resolveManifestOnLoad:function(e){u=new up.default({escapeMode:!1,attributePrefix:"",arrayAccessForm:"property",emptyNodeForm:"object",stripWhitespaces:!1,enableToStringFunc:!1,ignoreRoot:!0,matchers:a}),(s=e).Period_asArray?d(g(s.Period_asArray,s,dp.default.PERIOD,"onLoad"),dp.default.PERIOD,"onLoad"):n.trigger(op.default.XLINK_READY,{manifest:s})},setMatchers:function(e){e&&(a=e)},setIron:function(e){e&&(o=e)},reset:function(){n.off(op.default.XLINK_ELEMENT_LOADED,f,i),l&&(l.reset(),l=null)}},n.on(op.default.XLINK_ELEMENT_LOADED,f,i),l=(0,ip.default)(t).create({errHandler:e.errHandler,dashMetrics:e.dashMetrics,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,settings:e.settings}),i}cp.__dashjs_factory_name="XlinkController";var gp=sp.default.getClassFactory(cp),hp=Object.defineProperty({default:gp},"__esModule",{value:!0}),pp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_p=function(e){return e&&e.__esModule?e:{default:e}}(S);function mp(e){function t(e,t){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}function n(e,n,r){for(var i=0,a=e.length;i<a;++i){var o=e[i];if(n[o.name])if(r[o.name]){if(o.merge){var s=n[o.name],u=r[o.name];"object"===(void 0===s?"undefined":pp(s))&&"object"===(void 0===u?"undefined":pp(u))?t(s,u):r[o.name]=s+u}}else r[o.name]=n[o.name]}}function r(e,t){for(var i=0,a=e.children.length;i<a;++i){var o=e.children[i],s=t[o.name+"_asArray"];if(s)for(var u=0,l=s.length;u<l;++u){var d=s[u];n(e.properties,t,d),r(o,d)}}}return{run:function(t){if(null===t||"object"!==(void 0===t?"undefined":pp(t)))return t;if(t.Period_asArray&&"period"in e)for(var n=e.period,i=t.Period_asArray,a=0,o=i.length;a<o;++a){var s=i[a];if(r(n,s),"adaptationset"in e){var u=s.AdaptationSet_asArray;if(u)for(var l=e.adaptationset,d=0,f=u.length;d<f;++d)r(l,u[d])}}return t}}}mp.__dashjs_factory_name="ObjectIron";var Ep=_p.default.getClassFactory(mp),vp=Object.defineProperty({default:Ep},"__esModule",{value:!0}),yp=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var Tp=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._test=t,this._converter=n}return yp(e,[{key:"test",get:function(){return this._test}},{key:"converter",get:function(){return this._converter}}]),e}(),Ap=Object.defineProperty({default:Tp},"__esModule",{value:!0}),Sp=Rp(Ap),Ip=Rp(E);function Rp(e){return e&&e.__esModule?e:{default:e}}function bp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Np=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,(function(e,t){var n,r=(bp(n={},Ip.default.MPD,[Ip.default.ID,Ip.default.PROFILES]),bp(n,Ip.default.PERIOD,[Ip.default.ID]),bp(n,Ip.default.BASE_URL,[Ip.default.SERVICE_LOCATION,Ip.default.BYTE_RANGE]),bp(n,Ip.default.SEGMENT_BASE,[Ip.default.INDEX_RANGE]),bp(n,Ip.default.INITIALIZATION,[Ip.default.RANGE]),bp(n,Ip.default.REPRESENTATION_INDEX,[Ip.default.RANGE]),bp(n,Ip.default.SEGMENT_LIST,[Ip.default.INDEX_RANGE]),bp(n,Ip.default.BITSTREAM_SWITCHING,[Ip.default.RANGE]),bp(n,Ip.default.SEGMENT_URL,[Ip.default.MEDIA_RANGE,Ip.default.INDEX_RANGE]),bp(n,Ip.default.SEGMENT_TEMPLATE,[Ip.default.INDEX_RANGE,Ip.default.MEDIA,Ip.default.INDEX,Ip.default.INITIALIZATION_MINUS,Ip.default.BITSTREAM_SWITCHING_MINUS]),bp(n,Ip.default.ASSET_IDENTIFIER,[Ip.default.VALUE,Ip.default.ID]),bp(n,Ip.default.EVENT_STREAM,[Ip.default.VALUE]),bp(n,Ip.default.ADAPTATION_SET,[Ip.default.PROFILES,Ip.default.MIME_TYPE,Ip.default.SEGMENT_PROFILES,Ip.default.CODECS,Ip.default.CONTENT_TYPE]),bp(n,Ip.default.FRAME_PACKING,[Ip.default.VALUE,Ip.default.ID]),bp(n,Ip.default.AUDIO_CHANNEL_CONFIGURATION,[Ip.default.VALUE,Ip.default.ID]),bp(n,Ip.default.CONTENT_PROTECTION,[Ip.default.VALUE,Ip.default.ID]),bp(n,Ip.default.ESSENTIAL_PROPERTY,[Ip.default.VALUE,Ip.default.ID]),bp(n,Ip.default.SUPPLEMENTAL_PROPERTY,[Ip.default.VALUE,Ip.default.ID]),bp(n,Ip.default.INBAND_EVENT_STREAM,[Ip.default.VALUE,Ip.default.ID]),bp(n,Ip.default.ACCESSIBILITY,[Ip.default.VALUE,Ip.default.ID]),bp(n,Ip.default.ROLE,[Ip.default.VALUE,Ip.default.ID]),bp(n,Ip.default.RATING,[Ip.default.VALUE,Ip.default.ID]),bp(n,Ip.default.VIEWPOINT,[Ip.default.VALUE,Ip.default.ID]),bp(n,Ip.default.CONTENT_COMPONENT,[Ip.default.CONTENT_TYPE]),bp(n,Ip.default.REPRESENTATION,[Ip.default.ID,Ip.default.DEPENDENCY_ID,Ip.default.MEDIA_STREAM_STRUCTURE_ID]),bp(n,Ip.default.SUBSET,[Ip.default.ID]),bp(n,Ip.default.METRICS,[Ip.default.METRICS_MINUS]),bp(n,Ip.default.REPORTING,[Ip.default.VALUE,Ip.default.ID]),n);if(r.hasOwnProperty(t)){var i=r[t];return void 0!==i&&i.indexOf(e.name)>=0}return!1}),(function(e){return String(e)})))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(Sp.default),Mp=Object.defineProperty({default:Np},"__esModule",{value:!0}),Dp=wp(Ap),Cp=wp(p),Op=wp(E);function wp(e){return e&&e.__esModule?e:{default:e}}var Pp=/^([-])?P(([\d.]*)Y)?(([\d.]*)M)?(([\d.]*)D)?T?(([\d.]*)H)?(([\d.]*)M)?(([\d.]*)S)?/,Lp=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,(function(e){for(var t=[Op.default.MIN_BUFFER_TIME,Op.default.MEDIA_PRESENTATION_DURATION,Op.default.MINIMUM_UPDATE_PERIOD,Op.default.TIMESHIFT_BUFFER_DEPTH,Op.default.MAX_SEGMENT_DURATION,Op.default.MAX_SUBSEGMENT_DURATION,Op.default.SUGGESTED_PRESENTATION_DELAY,Op.default.START,Cp.default.START_TIME,Op.default.DURATION],n=t.length,r=0;r<n;r++)if(e.nodeName===t[r])return Pp.test(e.value);return!1}),(function(e){var t=Pp.exec(e),n=31536e3*parseFloat(t[3]||0)+2592e3*parseFloat(t[5]||0)+86400*parseFloat(t[7]||0)+3600*parseFloat(t[9]||0)+60*parseFloat(t[11]||0)+parseFloat(t[13]||0);return void 0!==t[1]&&(n=-n),n})))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(Dp.default),Fp=Object.defineProperty({default:Lp},"__esModule",{value:!0}),xp=function(e){return e&&e.__esModule?e:{default:e}}(Ap);var Up=/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2})(?::([0-9]*)(\.[0-9]*)?)?(?:([+-])([0-9]{2})(?::?)([0-9]{2}))?/,Bp=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,(function(e){return Up.test(e.value)}),(function(e){var t=Up.exec(e),n=void 0;if(n=Date.UTC(parseInt(t[1],10),parseInt(t[2],10)-1,parseInt(t[3],10),parseInt(t[4],10),parseInt(t[5],10),t[6]&&parseInt(t[6],10)||0,t[7]&&1e3*parseFloat(t[7])||0),t[9]&&t[10]){var r=60*parseInt(t[9],10)+parseInt(t[10],10);n+=("+"===t[8]?-1:1)*r*60*1e3}return new Date(n)})))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(xp.default),kp=Object.defineProperty({default:Bp},"__esModule",{value:!0}),Gp=function(e){return e&&e.__esModule?e:{default:e}}(Ap);var qp=/^[-+]?[0-9]+[.]?[0-9]*([eE][-+]?[0-9]+)?$/,Yp=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,(function(e){return qp.test(e.value)}),(function(e){return parseFloat(e)})))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(Gp.default),jp=Object.defineProperty({default:Yp},"__esModule",{value:!0}),Hp=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var Kp=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var n;this._name=t,this._merge=(n=t)&&n.length&&n.charAt(0)===n.charAt(0).toUpperCase()}return Hp(e,[{key:"name",get:function(){return this._name}},{key:"merge",get:function(){return this._merge}}]),e}(),Vp=Object.defineProperty({default:Kp},"__esModule",{value:!0}),zp=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),Wp=function(e){return e&&e.__esModule?e:{default:e}}(Vp);var Xp=function(){function e(t,n,r){var i=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._name=t||"",this._properties=[],this._children=r||[],Array.isArray(n)&&n.forEach((function(e){i._properties.push(new Wp.default(e))}))}return zp(e,[{key:"name",get:function(){return this._name}},{key:"children",get:function(){return this._children}},{key:"properties",get:function(){return this._properties}}]),e}(),Qp=Object.defineProperty({default:Xp},"__esModule",{value:!0}),Zp=Jp(Qp),$p=Jp(E);function Jp(e){return e&&e.__esModule?e:{default:e}}var e_=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=[$p.default.PROFILES,$p.default.WIDTH,$p.default.HEIGHT,$p.default.SAR,$p.default.FRAMERATE,$p.default.AUDIO_SAMPLING_RATE,$p.default.MIME_TYPE,$p.default.SEGMENT_PROFILES,$p.default.CODECS,$p.default.MAXIMUM_SAP_PERIOD,$p.default.START_WITH_SAP,$p.default.MAX_PLAYOUT_RATE,$p.default.CODING_DEPENDENCY,$p.default.SCAN_TYPE,$p.default.FRAME_PACKING,$p.default.AUDIO_CHANNEL_CONFIGURATION,$p.default.CONTENT_PROTECTION,$p.default.ESSENTIAL_PROPERTY,$p.default.SUPPLEMENTAL_PROPERTY,$p.default.INBAND_EVENT_STREAM];return function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,$p.default.ADAPTATION_SET,e,[new Zp.default($p.default.REPRESENTATION,e,[new Zp.default($p.default.SUB_REPRESENTATION,e)])]))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(Zp.default),t_=Object.defineProperty({default:e_},"__esModule",{value:!0}),n_=i_(Qp),r_=i_(E);function i_(e){return e&&e.__esModule?e:{default:e}}var a_=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=[r_.default.SEGMENT_BASE,r_.default.SEGMENT_TEMPLATE,r_.default.SEGMENT_LIST];return function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,r_.default.PERIOD,e,[new n_.default(r_.default.ADAPTATION_SET,e,[new n_.default(r_.default.REPRESENTATION,e)])]))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(n_.default),o_=Object.defineProperty({default:a_},"__esModule",{value:!0}),s_=__(S),u_=__(vp),l_=__(rp),d_=__(Mp),f_=__(Fp),c_=__(kp),g_=__(jp),h_=__(t_),p_=__(o_);function __(e){return e&&e.__esModule?e:{default:e}}function m_(e){e=e||{};var t=this.context,n=e.debug,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0;return r={parse:function(e){var t=void 0,n=window.performance.now();if(!(t=o.xml_str2json(e)))throw new Error("parsing the manifest failed");var r=window.performance.now();t.Patch?((t=t.Patch).add_asArray&&t.add_asArray.forEach((function(e){return s.run(e)})),t.replace_asArray&&t.replace_asArray.forEach((function(e){return s.run(e)}))):(t=t.MPD,s.run(t));var a=window.performance.now();return i.info("Parsing complete: ( xml2json: "+(r-n).toPrecision(3)+"ms, objectiron: "+(a-r).toPrecision(3)+"ms, total: "+((a-n)/1e3).toPrecision(3)+"s)"),t.protocol="DASH",t},getMatchers:function(){return a},getIron:function(){return s}},i=n.getLogger(r),a=[new f_.default,new c_.default,new g_.default,new d_.default],o=new l_.default({escapeMode:!1,attributePrefix:"",arrayAccessForm:"property",emptyNodeForm:"object",stripWhitespaces:!1,enableToStringFunc:!0,ignoreRoot:!1,matchers:a}),s=(0,u_.default)(t).create({adaptationset:new h_.default,period:new p_.default}),r}m_.__dashjs_factory_name="DashParser";var E_=s_.default.getClassFactory(m_),v_=Object.defineProperty({default:E_},"__esModule",{value:!0}),y_=w_(p),T_=w_(E),A_=w_(hp),S_=w_(Mf),I_=w_(Ru),R_=w_(Hh),b_=w_(Me),N_=w_(x),M_=w_(q),D_=w_(Bt),C_=w_(S),O_=w_(v_);function w_(e){return e&&e.__esModule?e:{default:e}}function P_(e){e=e||{};var t=this.context,n=e.debug,r=(0,N_.default)(t).getInstance(),i=(0,I_.default)(t).getInstance(),a=void 0,o=void 0,s=void 0,u=void 0,l=void 0,d=e.mssHandler,f=e.errHandler;function c(e){r.trigger(M_.default.INTERNAL_MANIFEST_LOADED,{manifest:e.manifest})}return a={load:function(e){var a=new R_.default(e,pe.HTTPRequest.MPD_TYPE);s.load({request:a,success:function(a,s,f){if(u){var c=void 0,g=void 0,h=void 0;if(f&&f!==e?(g=i.parseBaseUrl(f),c=f):(i.isRelative(e)&&(e=i.resolve(e,window.location.href)),g=i.parseBaseUrl(e)),"No Content"!=s)if(null===l&&(l=function(e){var r=null;return e.indexOf("SmoothStreamingMedia")>-1?(d&&(r=d.createMssParser(),d.registerEvents()),r):e.indexOf("MPD")>-1||e.indexOf("Patch")>-1?(0,O_.default)(t).create({debug:n}):r}(a)),null!==l){u.setMatchers(l.getMatchers()),u.setIron(l.getIron());try{h=l.parse(a)}catch(t){return void r.trigger(M_.default.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new b_.default(D_.default.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE,D_.default.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE+""+e)})}h?(h.url=c||e,h.originalUrl||(h.originalUrl=h.url),h.hasOwnProperty(y_.default.LOCATION)&&(g=i.parseBaseUrl(h.Location_asArray[0]),o.debug("BaseURI set by Location to: "+g)),h.baseUri=g,h.loadedTime=new Date,u.resolveManifestOnLoad(h),r.trigger(M_.default.ORIGINAL_MANIFEST_LOADED,{originalManifest:a})):r.trigger(M_.default.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new b_.default(D_.default.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE,D_.default.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE+""+e)})}else r.trigger(M_.default.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new b_.default(D_.default.MANIFEST_LOADER_PARSING_FAILURE_ERROR_CODE,D_.default.MANIFEST_LOADER_PARSING_FAILURE_ERROR_MESSAGE+""+e)});else r.trigger(M_.default.INTERNAL_MANIFEST_LOADED,{manifest:null})}},error:function(t,n,i){r.trigger(M_.default.INTERNAL_MANIFEST_LOADED,{manifest:null,error:new b_.default(D_.default.MANIFEST_LOADER_LOADING_FAILURE_ERROR_CODE,D_.default.MANIFEST_LOADER_LOADING_FAILURE_ERROR_MESSAGE+(e+", ")+i)})}})},reset:function(){r.off(M_.default.XLINK_READY,c,a),d&&d.reset(),u&&(u.reset(),u=null),s&&(s.abort(),s=null)}},o=n.getLogger(a),r.on(M_.default.XLINK_READY,c,a),s=(0,S_.default)(t).create({errHandler:e.errHandler,dashMetrics:e.dashMetrics,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,useFetch:e.settings.get().streaming.lowLatencyEnabled,urlUtils:i,constants:y_.default,dashConstants:T_.default,errors:D_.default}),u=(0,A_.default)(t).create({errHandler:f,dashMetrics:e.dashMetrics,mediaPlayerModel:e.mediaPlayerModel,requestModifier:e.requestModifier,settings:e.settings}),l=null,a}P_.__dashjs_factory_name="ManifestLoader";var L_=C_.default.getClassFactory(P_),F_=Object.defineProperty({default:L_},"__esModule",{value:!0}),x_=k_(x),U_=k_(q),B_=k_(S);function k_(e){return e&&e.__esModule?e:{default:e}}function G_(){var e=this.context,t=(0,x_.default)(e).getInstance();return{error:function(e){t.trigger(U_.default.ERROR,{error:e})}}}G_.__dashjs_factory_name="ErrorHandler";var q_=B_.default.getSingletonFactory(G_),Y_=Object.defineProperty({default:q_},"__esModule",{value:!0}),j_=V_,H_=function(e){return e&&e.__esModule?e:{default:e}}(S);var K_=[{codec:"avc1",compatibleCodecs:["avc3"]},{codec:"avc3",compatibleCodecs:["avc1"]}];function V_(){var e="WebKitMediaSource"in window,t="MediaSource"in window;return e||t}function z_(){var e,t=void 0;return e={supportsMediaSource:V_,supportsEncryptedMedia:function(){return t},supportsCodec:function(e){return!(!("MediaSource"in window)||!MediaSource.isTypeSupported(e))||!(!("WebKitMediaSource"in window)||!WebKitMediaSource.isTypeSupported(e))},setEncryptedMediaSupported:function(e){t=e},supportsEssentialProperty:function(e){try{return-1!==ud.THUMBNAILS_SCHEME_ID_URIS.indexOf(e.schemeIdUri)}catch(e){return!0}},codecRootCompatibleWithCodec:function(e,t){for(var n=e.split(".")[0],r=0===t.indexOf(n),i=void 0,a=0;a<K_.length;a++)if(K_[a].codec===n){i=K_[a];break}return i?r||i.compatibleCodecs.some((function(e){return 0===t.indexOf(e)})):r}},t=!1,e}z_.__dashjs_factory_name="Capabilities";var W_=H_.default.getSingletonFactory(z_),X_=Object.defineProperty({supportsMediaSource:j_,default:W_},"__esModule",{value:!0}),Q_=J_(S),Z_=J_(ee),$_=J_(p);function J_(e){return e&&e.__esModule?e:{default:e}}function em(){var e=this.context,t=void 0,n=void 0,r=void 0,i=void 0,a=void 0,o=void 0;function s(e,t){var i=n.getRealPeriodByIndex(t?t.index:null);i&&i.AdaptationSet_asArray&&0!==i.AdaptationSet_asArray.length&&(i.AdaptationSet_asArray=i.AdaptationSet_asArray.filter((function(t){return!t.Representation_asArray||0===t.Representation_asArray.length||!n.getIsTypeOf(t,e)||(t.Representation_asArray=t.Representation_asArray.filter((function(e,i){var o=n.getCodec(t,i,!0);return!!r.supportsCodec(o)||(a.error("[Stream] codec not supported: "+o),!1)})),t.Representation_asArray&&t.Representation_asArray.length>0)})))}return t={setConfig:function(e){e&&(e.adapter&&(n=e.adapter),e.capabilities&&(r=e.capabilities),e.settings&&(i=e.settings))},filterUnsupportedFeaturesOfPeriod:function(e){s($_.default.VIDEO,e),s($_.default.AUDIO,e),i.get().streaming.filterUnsupportedEssentialProperties&&function(e){var t=n.getRealPeriodByIndex(e?e.index:null);if(!t||!t.AdaptationSet_asArray||0===t.AdaptationSet_asArray.length)return;t.AdaptationSet_asArray=t.AdaptationSet_asArray.filter((function(e){return!e.Representation_asArray||0===e.Representation_asArray.length||(e.Representation_asArray=e.Representation_asArray.filter((function(e){var t=n.getEssentialPropertiesForRepresentation(e);if(t&&t.length>0)for(var i=0;i<t.length;){if(!r.supportsEssentialProperty(t[i]))return a.debug("[Stream] EssentialProperty not supported: "+t[i].schemeIdUri),!1;i+=1}return!0})),e.Representation_asArray&&e.Representation_asArray.length>0)}))}(e),function(e){if(!o||0===o.length)return;var t=n.getRealPeriodByIndex(e?e.index:null);if(!t||!t.AdaptationSet_asArray||0===t.AdaptationSet_asArray.length)return;t.AdaptationSet_asArray=t.AdaptationSet_asArray.filter((function(e){return!e.Representation_asArray||0===e.Representation_asArray.length||(e.Representation_asArray=e.Representation_asArray.filter((function(e){return!o.some((function(t){return!t(e)}))})),e.Representation_asArray&&e.Representation_asArray.length>0)}))}(e)},setCustomCapabilitiesFilters:function(e){o=e}},a=(0,Z_.default)(e).getInstance().getLogger(t),t}em.__dashjs_factory_name="CapabilitiesFilter";var tm=Q_.default.getSingletonFactory(em),nm=Object.defineProperty({default:tm},"__esModule",{value:!0});var rm=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.t=null,this.xywh=null,this.track=null,this.id=null,this.s=null,this.r=null},im=om(Object.defineProperty({default:rm},"__esModule",{value:!0})),am=om(S);function om(e){return e&&e.__esModule?e:{default:e}}function sm(){var e=void 0;return{initialize:function(t){if(e=new im.default,!t)return null;var n=t.indexOf("#");if(-1!==n)for(var r=t.substr(n+1).split("&"),i=0,a=r.length;i<a;++i){var o=r[i],s=o.indexOf("=");if(-1!==s){var u=o.substring(0,s);e.hasOwnProperty(u)&&(e[u]=o.substr(s+1))}}},getURIFragmentData:function(){return e}}}sm.__dashjs_factory_name="URIFragmentModel";var um=am.default.getSingletonFactory(sm),lm=Object.defineProperty({default:um},"__esModule",{value:!0}),dm=gm(x),fm=gm(q),cm=gm(S);function gm(e){return e&&e.__esModule?e:{default:e}}function hm(){var e=this.context,t=(0,dm.default)(e).getInstance(),n=void 0;return{getValue:function(){return n},setValue:function(e){n=e,e&&t.trigger(fm.default.MANIFEST_LOADED,{data:e})}}}hm.__dashjs_factory_name="ManifestModel";var pm=cm.default.getSingletonFactory(hm),_m=Object.defineProperty({default:pm},"__esModule",{value:!0}),mm=Am(jl),Em=Am(S),vm=Am(p),ym=Am(ia),Tm=Am(Tl);function Am(e){return e&&e.__esModule?e:{default:e}}function Sm(){var e,t=void 0,n=void 0,r=void 0,i=this.context,a=(0,Tm.default)(i).getInstance();function o(e){var t=void 0;for(t=0;t<r.length;t++)if(r[t].rulename===e)return t;return-1}function s(){return a.get().streaming.lowLatencyEnabled?a.get().streaming.liveDelay||3:a.get().streaming.liveDelay}function u(e,n){l(e,n);var r=new mm.default;r.schemeIdUri=e,r.value=n,t.push(r)}function l(e,n){(0,rt.checkParameterType)(e,"string"),(0,rt.checkParameterType)(n,"string"),t.forEach((function(r,i){r.schemeIdUri===e&&r.value===n&&t.splice(i,1)}))}return e={getABRCustomRules:function(){return r},addABRCustomRule:function(e,t,n){if("string"!=typeof e||e!==ym.default.ABANDON_FRAGMENT_RULES&&e!==ym.default.QUALITY_SWITCH_RULES||"string"!=typeof t)throw vm.default.BAD_ARGUMENT_ERROR;var i=o(t);-1===i?r.push({type:e,rulename:t,rule:n}):(r[i].type=e,r[i].rule=n)},removeABRCustomRule:function(e){if(e){var t=o(e);-1!==t&&r.splice(t,1)}else r=[]},getStableBufferTime:function(){if(a.get().streaming.lowLatencyEnabled)return.6*s();var e=a.get().streaming.stableBufferTime;return e>-1?e:a.get().streaming.fastSwitchEnabled?20:12},getRetryAttemptsForType:function(e){var t=isNaN(a.get().streaming.retryAttempts.lowLatencyMultiplyFactor)?5:a.get().streaming.retryAttempts.lowLatencyMultiplyFactor;return a.get().streaming.lowLatencyEnabled?a.get().streaming.retryAttempts[e]*t:a.get().streaming.retryAttempts[e]},getRetryIntervalsForType:function(e){var t=isNaN(a.get().streaming.retryIntervals.lowLatencyReductionFactor)?10:a.get().streaming.retryIntervals.lowLatencyReductionFactor;return a.get().streaming.lowLatencyEnabled?a.get().streaming.retryIntervals[e]/t:a.get().streaming.retryIntervals[e]},getLiveDelay:s,getLiveCatchupLatencyThreshold:function(){try{var e=a.get().streaming.liveCatchup.latencyThreshold,t=s();if(null!==e&&!isNaN(e))return Math.max(e,t);var n=a.get().streaming.liveCatchup.minDrift,r=!isNaN(t)&&t?isNaN(n)?s():a.get().streaming.liveCatchup.minDrift+s():NaN;return r&&!isNaN(r)?Math.max(4*r,5):NaN}catch(e){return NaN}},addUTCTimingSource:u,removeUTCTimingSource:l,getUTCTimingSources:function(){return t},clearDefaultUTCTimingSources:function(){t=[]},restoreDefaultUTCTimingSources:function(){var e=a.get().streaming.utcSynchronization.defaultTimingSource;u(e.scheme,e.value)},setXHRWithCredentialsForType:function e(t,r){t?n[t]=!!r:Object.keys(n).forEach((function(t){e(t,r)}))},getXHRWithCredentialsForType:function(e){var t=n[e];return void 0===t?n.default:t},getDefaultUtcTimingSource:function(){return a.get().streaming.utcSynchronization.defaultTimingSource},reset:function(){}},t=[],n={default:!1},r=[],e}Sm.__dashjs_factory_name="MediaPlayerModel";var Im=Em.default.getSingletonFactory(Sm),Rm=Object.defineProperty({default:Im},"__esModule",{value:!0}),bm=Cm(S),Nm=Cm(x),Mm=Cm(q),Dm=Cm(ee);function Cm(e){return e&&e.__esModule?e:{default:e}}function Om(){var e=void 0,t=void 0,n=void 0,r=void 0,i=void 0,a=this.context,o=(0,Nm.default)(a).getInstance(),s=[];function u(){n&&(n.playbackRate=i||1,n.removeEventListener("canplay",u))}function l(e){n&&(n.readyState<=2&&e>0?n.addEventListener("canplay",u):n.playbackRate=e)}function d(){return s.length>0}function f(e){var t=s.indexOf(e),r=void 0;null!==e&&(-1!==t&&s.splice(t,1),n&&!1===d()&&0===n.playbackRate&&(l(i||1),n.paused||((r=document.createEvent("Event")).initEvent("playing",!0,!1),n.dispatchEvent(r))))}function c(){if(n&&d()&&0===n.playbackRate){var e=document.createEvent("Event");e.initEvent("waiting",!0,!1),n.dispatchEvent(e)}}function g(){return n?n.buffered:null}function h(e,t,r,i,a){if(n)for(var o=0;o<n.textTracks.length;o++)if(n.textTracks[o].kind===e&&(!t||n.textTracks[o].label==t)&&n.textTracks[o].language===r&&n.textTracks[o].isTTML===i&&n.textTracks[o].isEmbedded===a)return n.textTracks[o];return null}return e={initialize:function(){o.on(Mm.default.PLAYBACK_PLAYING,c,this)},setCurrentTime:function(e,t){if(n){if(n.currentTime==e)return;try{e=t?function(e){var t=g(),n=e,r=9999999999;if(t)for(var i=0;i<t.length;i++){var a=t.start(i),o=t.end(i),s=Math.abs(a-e),u=Math.abs(o-e);if(e>=a&&e<=o)return e;s<r&&(r=s,n=a),u<r&&(r=u,n=o)}return n}(e):e,n.currentTime=e}catch(t){0===n.readyState&&t.code===t.INVALID_STATE_ERR&&setTimeout((function(){n.currentTime=e}),400)}}},play:function(){if(n){n.autoplay=!0;var e=n.play();e&&e.catch&&"undefined"!=typeof Promise&&e.catch((function(e){"NotAllowedError"===e.name&&o.trigger(Mm.default.PLAYBACK_NOT_ALLOWED),t.warn("Caught pending play exception - continuing ("+e+")")}))}},isPaused:function(){return n?n.paused:null},pause:function(){n&&(n.pause(),n.autoplay=!1)},isStalled:d,isSeeking:function(){return n?n.seeking:null},getTime:function(){return n?n.currentTime:null},getPlaybackRate:function(){return n?n.playbackRate:null},setPlaybackRate:l,getPlayedRanges:function(){return n?n.played:null},getEnded:function(){return n?n.ended:null},setStallState:function(e,t){!function(e,t){t?function(e){var t=void 0;if(null===e||!n||n.seeking||-1!==s.indexOf(e))return;s.push(e),n&&1===s.length&&((t=document.createEvent("Event")).initEvent("waiting",!0,!1),i=n.playbackRate,l(0),n.dispatchEvent(t))}(e):f(e)}(e,t)},getElement:function(){return n},setElement:function(e){if(!(null==e||e&&/^(VIDEO|AUDIO)$/i.test(e.nodeName)))throw"element is not video or audio DOM type!";(n=e)&&(n.preload="auto")},setSource:function(e){n&&(e?n.src=e:(n.removeAttribute("src"),n.load()))},getSource:function(){return n?n.src:null},getTTMLRenderingDiv:function(){return r},setTTMLRenderingDiv:function(e){(r=e).style.position="absolute",r.style.display="flex",r.style.overflow="hidden",r.style.pointerEvents="none",r.style.top=0,r.style.left=0},getPlaybackQuality:function(){if(!n)return null;var e="webkitDroppedFrameCount"in n&&"webkitDecodedFrameCount"in n,t=null;return"getVideoPlaybackQuality"in n?t=n.getVideoPlaybackQuality():e&&(t={droppedVideoFrames:n.webkitDroppedFrameCount,totalVideoFrames:n.webkitDroppedFrameCount+n.webkitDecodedFrameCount,creationTime:new Date}),t},addEventListener:function(e,t){n&&n.addEventListener(e,t)},removeEventListener:function(e,t){n&&n.removeEventListener(e,t)},getReadyState:function(){return n?n.readyState:NaN},getBufferRange:g,getClientWidth:function(){return n?n.clientWidth:NaN},getClientHeight:function(){return n?n.clientHeight:NaN},getTextTracks:function(){return n?n.textTracks:[]},getTextTrack:h,addTextTrack:function(e,t,r,i,a){if(!n)return null;var o=h(e,t,r,i,a);return o||((o=n.addTextTrack(e,t,r)).isEmbedded=a,o.isTTML=i),o},appendChild:function(e){n&&(n.appendChild(e),void 0!==e.isTTML&&(n.textTracks[n.textTracks.length-1].isTTML=e.isTTML,n.textTracks[n.textTracks.length-1].isEmbedded=e.isEmbedded))},removeChild:function(e){n&&n.removeChild(e)},getVideoWidth:function(){return n?n.videoWidth:NaN},getVideoHeight:function(){return n?n.videoHeight:NaN},getVideoRelativeOffsetTop:function(){var e=n.parentNode.host||n.parentNode;return e?n.getBoundingClientRect().top-e.getBoundingClientRect().top:NaN},getVideoRelativeOffsetLeft:function(){var e=n.parentNode.host||n.parentNode;return e?n.getBoundingClientRect().left-e.getBoundingClientRect().left:NaN},reset:function(){o.off(Mm.default.PLAYBACK_PLAYING,c,this)}},t=(0,Dm.default)(a).getInstance().getLogger(e),e}Om.__dashjs_factory_name="VideoModel";var wm=bm.default.getSingletonFactory(Om),Pm=Object.defineProperty({default:wm},"__esModule",{value:!0}),Lm=Um(S),Fm=Um(ee),xm=Um(p);function Um(e){return e&&e.__esModule?e:{default:e}}var Bm=[{oldKey:"dashjs_vbitrate",newKey:"dashjs_video_bitrate"},{oldKey:"dashjs_abitrate",newKey:"dashjs_audio_bitrate"},{oldKey:"dashjs_vsettings",newKey:"dashjs_video_settings"},{oldKey:"dashjs_asettings",newKey:"dashjs_audio_settings"}];function km(e){e=e||{};var t=this.context,n=e.settings,r=void 0,i=void 0,a=void 0;function o(e){if(void 0!==a)return a;a=!1;var t=void 0;try{"undefined"!=typeof window&&(t=window[e])}catch(e){return i.warn("DOMStorage access denied: "+e.message),a}if(!t||"localStorage"!==e&&"sessionStorage"!==e)return a;try{t.setItem("1","1"),t.removeItem("1"),a=!0}catch(e){i.warn("DOMStorage is supported, but cannot be used: "+e.message)}return a}function s(){return 6e5*Math.round((new Date).getTime()/6e5)}function u(e,t){return o(e)&&n.get().streaming[t+"CachingInfo"].enabled}function l(){if(!n)throw new Error(xm.default.MISSING_CONFIG_ERROR)}return r={getSavedBitrateSettings:function(e){var t=NaN;if(l(),u("localStorage","lastBitrate")){var r="dashjs_?_bitrate".replace(/\?/,e);try{var a=JSON.parse(localStorage.getItem(r))||{},o=(new Date).getTime()-parseInt(a.timestamp,10)>=n.get().streaming.lastBitrateCachingInfo.ttl||!1,s=parseFloat(a.bitrate);isNaN(s)||o?o&&localStorage.removeItem(r):(t=s,i.debug("Last saved bitrate for "+e+" was "+s))}catch(e){return null}}return t},setSavedBitrateSettings:function(e,t){if(u("localStorage","lastBitrate")&&t){var n="dashjs_?_bitrate".replace(/\?/,e);try{localStorage.setItem(n,JSON.stringify({bitrate:t.toFixed(3),timestamp:s()}))}catch(e){i.error(e.message)}}},getSavedMediaSettings:function(e){var t=null;if(l(),u("localStorage","lastMediaSettings")){var r="dashjs_?_settings".replace(/\?/,e);try{var i=JSON.parse(localStorage.getItem(r))||{},a=(new Date).getTime()-parseInt(i.timestamp,10)>=n.get().streaming.lastMediaSettingsCachingInfo.ttl||!1;t=i.settings,a&&(localStorage.removeItem(r),t=null)}catch(e){return null}}return t},setSavedMediaSettings:function(e,t){if(u("localStorage","lastMediaSettings")){var n="dashjs_?_settings".replace(/\?/,e);try{localStorage.setItem(n,JSON.stringify({settings:t,timestamp:s()}))}catch(e){i.error(e.message)}}}},i=(0,Fm.default)(t).getInstance().getLogger(r),o("localStorage")&&Bm.forEach((function(e){var t=localStorage.getItem(e.oldKey);if(t){localStorage.removeItem(e.oldKey);try{localStorage.setItem(e.newKey,t)}catch(e){i.error(e.message)}}})),r}km.__dashjs_factory_name="DOMStorage";var Gm=Lm.default.getSingletonFactory(km),qm=Object.defineProperty({default:Gm},"__esModule",{value:!0}),Ym=function(){return"3.2.2"};var jm=Object.defineProperty({getVersionString:Ym},"__esModule",{value:!0}),Hm=Xm(hs),Km=Xm(Me),Vm=Xm(S),zm=Xm(ve),Wm=Xm(Mf);function Xm(e){return e&&e.__esModule?e:{default:e}}function Qm(){var e=this.context,t=void 0,n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,u=void 0,l=void 0,d=void 0,f=void 0,c=void 0,g=void 0,h=void 0,p=void 0,_=void 0;function m(){if(!_||!_.hasOwnProperty("resolve"))throw new Error("setConfig function has to be called previously")}function E(e){if(e.url){var t=new zm.default;return t.setInfo(e),t}}function v(e,t,n,r){f.trigger(d.SEGMENTS_LOADED,{segments:n,representation:r,error:n?void 0:new Km.default(c.SEGMENT_BASE_LOADER_ERROR_CODE,c.SEGMENT_BASE_LOADER_ERROR_MESSAGE)},{streamId:e,mediaType:t})}return t={setConfig:function(e){e.baseURLController&&(_=e.baseURLController),e.dashMetrics&&(o=e.dashMetrics),e.mediaPlayerModel&&(u=e.mediaPlayerModel),e.errHandler&&(r=e.errHandler),e.settings&&(s=e.settings),e.boxParser&&(i=e.boxParser),e.events&&(d=e.events),e.eventBus&&(f=e.eventBus),e.debug&&(n=e.debug.getLogger(t)),e.requestModifier&&(a=e.requestModifier),e.errors&&(c=e.errors),e.urlUtils&&(p=e.urlUtils),e.constants&&(g=e.constants),e.dashConstants&&(h=e.dashConstants)},initialize:function(){l=(0,Wm.default)(e).create({errHandler:r,dashMetrics:o,mediaPlayerModel:u,requestModifier:a,useFetch:s?s.get().streaming.lowLatencyEnabled:null,boxParser:i,errors:c,urlUtils:p,constants:g,dashConstants:h})},loadInitialization:function e(t,r,a,o){m();var s=null,u=a?_.resolve(a.path):null,c=o||{init:!0,url:u?u.url:void 0,range:{start:0,end:1500},searching:!1,bytesLoaded:0,bytesToLoad:1500,mediaType:r};n.debug("Start searching for initialization.");var g=E(c);l.load({request:g,success:function(n){c.bytesLoaded=c.range.end,(s=i.findInitRange(n))?(a.range=s,f.trigger(d.INITIALIZATION_LOADED,{representation:a},{streamId:t,mediaType:r})):(c.range.end=c.bytesLoaded+c.bytesToLoad,e(t,r,a,c))},error:function(){f.trigger(d.INITIALIZATION_LOADED,{representation:a},{streamId:t,mediaType:r})}}),n.debug("Perform init search: "+c.url)},loadSegments:function e(t,r,a,o,s,u){if(m(),o&&(void 0===o.start||void 0===o.end)){var d=o?o.toString().split("-"):null;o=d?{start:parseFloat(d[0]),end:parseFloat(d[1])}:null}s=s||v;var f=null,c=null,g=!!o,h=a?_.resolve(a.path):null,p={init:!1,url:h?h.url:void 0,range:g?o:{start:0,end:1500},searching:!g,bytesLoaded:u?u.bytesLoaded:0,bytesToLoad:1500,mediaType:r},y=E(p);l.load({request:y,success:function(o){var u=p.bytesToLoad,l=o.byteLength;if(p.bytesLoaded=p.range.end-p.range.start,f=i.parse(o),(c=f.getBox("sidx"))&&c.isComplete){var d=c.references,g=void 0,h=void 0;if(null!=d&&d.length>0&&(g=1===d[0].reference_type),g){n.debug("Initiate multiple SIDX load."),p.range.end=p.range.start+c.size;var _=void 0,m=void 0,E=void 0,v=void 0,y=[],T=0,A=(c.offset||p.range.start)+c.size,S=function(e,t,n){n?(y=y.concat(n),++T>=m&&(y.sort((function(e,t){return e.startTime-t.startTime<0?-1:0})),s(e,t,y,a))):s(e,t,null,a)};for(_=0,m=d.length;_<m;_++)E=A,v=A+d[_].referenced_size-1,A+=d[_].referenced_size,e(t,r,a,{start:E,end:v},S,p)}else n.debug("Parsing segments from SIDX. representation "+r+" - id: "+a.id+" for range : "+p.range.start+" - "+p.range.end),h=function(e,t){for(var n=e.references,r=n.length,i=e.timescale,a=e.earliest_presentation_time,o=t.range.start+e.offset+e.first_offset+e.size,s=[],u=void 0,l=void 0,d=void 0,f=void 0,c=0;c<r;c++)d=n[c].subsegment_duration,f=n[c].referenced_size,(u=new Hm.default).duration=d,u.startTime=a,u.timescale=i,l=o+f-1,u.mediaRange=o+"-"+l,s.push(u),a+=d,o+=f;return s}(c,p),s(t,r,h,a)}else{if(c)p.range.start=c.offset||p.range.start,p.range.end=p.range.start+(c.size||u);else{if(l<p.bytesLoaded)return void s(t,r,null,a);var I=f.getLastBox();I&&I.size?(p.range.start=I.offset+I.size,p.range.end=p.range.start+u):p.range.end+=u}e(t,r,a,p.range,s,p)}},error:function(){s(t,r,null,a)}}),n.debug("Perform SIDX load: "+p.url+" with range : "+p.range.start+" - "+p.range.end)},reset:function(){l.abort(),l=null,r=null,i=null,a=null}}}Qm.__dashjs_factory_name="SegmentBaseLoader";var Zm=Vm.default.getSingletonFactory(Qm),$m=Object.defineProperty({default:Zm},"__esModule",{value:!0}),Jm=function(e){return e&&e.__esModule?e:{default:e}}(S);function eE(e){e=e||{};var t=void 0,n=new DataView(e.data),r=0;function i(e,t){var i=!0,a=0;if(void 0===t&&(t=!1),e.tag>16777215?(n.getUint32(r)!==e.tag&&(i=!1),a=4):e.tag>65535?(256*n.getUint16(r)+n.getUint8(r+2)!==e.tag&&(i=!1),a=3):e.tag>255?(n.getUint16(r)!==e.tag&&(i=!1),a=2):(n.getUint8(r)!==e.tag&&(i=!1),a=1),!i&&e.required&&!t)throw new Error("required tag not found");return i&&(r+=a),i}function a(e){var t=1,i=128,a=-1,o=0,s=n.getUint8(r),u=0;for(u=0;u<8;u+=1){if((s&i)===i){o=void 0===e?s&~i:s,a=u;break}i>>=1}for(u=0;u<a;u+=1,t+=1)o=o<<8|255&n.getUint8(r+t);return r+=t,o}return t={getPos:function(){return r},setPos:function(e){r=e},consumeTag:i,consumeTagAndSize:function(e,t){var n=i(e,t);return n&&a(),n},parseTag:function(e){var n;return i(e),n=a(),t[e.parse](n)},skipOverElement:function(e,t){var n=i(e,t),o=void 0;return n&&(o=a(),r+=o),n},getMatroskaCodedNum:a,getMatroskaFloat:function(e){var t=void 0;switch(e){case 4:t=n.getFloat32(r),r+=4;break;case 8:t=n.getFloat64(r),r+=8}return t},getMatroskaUint:function(e){for(var t=0,i=0;i<e;i+=1)t<<=8,t|=255&n.getUint8(r+i);return r+=e,t},moreData:function(){return r<n.byteLength}}}eE.__dashjs_factory_name="EBMLParser";var tE=Jm.default.getClassFactory(eE),nE=lE(Object.defineProperty({default:tE},"__esModule",{value:!0})),rE=lE(p),iE=lE(S),aE=lE(hs),oE=lE(ve),sE=lE(Mf),uE=lE(Me);function lE(e){return e&&e.__esModule?e:{default:e}}function dE(){var e=this.context,t=void 0,n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,u=void 0,l=void 0,d=void 0,f=void 0,c=void 0,g=void 0;function h(t,i,a,o){var s,u,l=void 0,d=void 0,f=void 0,c=void 0,g=void 0,h=void 0;for(d=[],c=0,u=(s=function(t){var n=[],i=(0,nE.default)(e).create({data:t}),a=void 0,o=void 0;for(i.consumeTagAndSize(r.Segment.Cues);i.moreData()&&i.consumeTagAndSize(r.Segment.Cues.CuePoint,!0);){for((a={}).CueTime=i.parseTag(r.Segment.Cues.CuePoint.CueTime),a.CueTracks=[];i.moreData()&&i.consumeTag(r.Segment.Cues.CuePoint.CueTrackPositions,!0);){var s=i.getMatroskaCodedNum(),u=i.getPos();if((o={}).Track=i.parseTag(r.Segment.Cues.CuePoint.CueTrackPositions.CueTrack),0===o.Track)throw new Error("Cue track cannot be 0");o.ClusterPosition=i.parseTag(r.Segment.Cues.CuePoint.CueTrackPositions.CueClusterPosition),a.CueTracks.push(o),i.setPos(u+s)}if(0===a.CueTracks.length)throw new Error("Mandatory cuetrack not found");n.push(a)}if(0===n.length)throw new Error("mandatory cuepoint not found");return n}(t)).length;c<u;c+=1)f=new aE.default,l=0,l=c<s.length-1?s[c+1].CueTime-s[c].CueTime:o-s[c].CueTime,f.duration=l,f.startTime=s[c].CueTime,f.timescale=1e3,g=s[c].CueTracks[0].ClusterPosition+i,h=c<s.length-1?s[c+1].CueTracks[0].ClusterPosition+i-1:a-1,f.mediaRange=g+"-"+h,d.push(f);return n.debug("Parsed cues: "+d.length+" cues."),d}function p(){if(!g||!g.hasOwnProperty("resolve"))throw new Error("setConfig function has to be called previously")}function _(e,t,n,r){d.trigger(f.SEGMENTS_LOADED,{segments:n,representation:r,error:n?void 0:new uE.default(c.SEGMENT_BASE_LOADER_ERROR_CODE,c.SEGMENT_BASE_LOADER_ERROR_MESSAGE)},{streamId:e,mediaType:t})}function m(e){var t=new oE.default;return t.setInfo(e),t}return t={setConfig:function(e){if(!(e.baseURLController&&e.dashMetrics&&e.mediaPlayerModel&&e.errHandler))throw new Error(rE.default.MISSING_CONFIG_ERROR);g=e.baseURLController,o=e.dashMetrics,s=e.mediaPlayerModel,i=e.errHandler,l=e.settings,f=e.events,d=e.eventBus,c=e.errors,n=e.debug.getLogger(t),a=e.requestModifier},initialize:function(){u=(0,sE.default)(e).create({errHandler:i,dashMetrics:o,mediaPlayerModel:s,requestModifier:a,useFetch:l?l.get().streaming.lowLatencyEnabled:null,errors:c})},loadInitialization:function(e,t,r,i){p();var a=null,o=r?g.resolve(r.path):null,s=r?r.range.split("-"):null,l=i||{range:{start:s?parseFloat(s[0]):null,end:s?parseFloat(s[1]):null},request:a,url:o?o.url:void 0,init:!0,mediaType:t};n.info("Start loading initialization."),a=m(l),u.load({request:a,success:function(){d.trigger(f.INITIALIZATION_LOADED,{representation:r},{streamId:e,mediaType:t})},error:function(){d.trigger(f.INITIALIZATION_LOADED,{representation:r},{streamId:e,mediaType:t})}}),n.debug("Perform init load: "+l.url)},loadSegments:function(t,i,a,o,s){p();var l=null,d=a?g.resolve(a.path):null,f=d?d.url:void 0;s=s||_,l=m({bytesLoaded:0,bytesToLoad:8192,range:{start:0,end:8192},request:l,url:f,init:!1,mediaType:i}),n.debug("Parsing ebml header"),u.load({request:l,success:function(l){!function(t,i,a,o){if(t&&0!==t.byteLength){var s,l=(0,nE.default)(e).create({data:t}),d=void 0,f=void 0,c=void 0,g=a?a.split("-"):null,p=null,_={url:i,range:{start:g?parseFloat(g[0]):null,end:g?parseFloat(g[1]):null},request:p};for(n.debug("Parse EBML header: "+_.url),l.skipOverElement(r.EBML),l.consumeTag(r.Segment),c=l.getMatroskaCodedNum(),c+=l.getPos(),s=l.getPos();l.moreData()&&!l.consumeTagAndSize(r.Segment.Info,!0);)if(!(l.skipOverElement(r.Segment.SeekHead,!0)||l.skipOverElement(r.Segment.Tracks,!0)||l.skipOverElement(r.Segment.Cues,!0)||l.skipOverElement(r.Void,!0)))throw new Error("no valid top level element found");for(;void 0===d;){var E=l.getMatroskaCodedNum(!0),v=l.getMatroskaCodedNum();switch(E){case r.Segment.Info.Duration.tag:d=l[r.Segment.Info.Duration.parse](v);break;default:l.setPos(l.getPos()+v)}}p=m(_);u.load({request:p,success:function(e){f=h(e,s,c,d),o(f)},error:function(){n.error("Download Error: Cues "+_.url),o(null)}}),n.debug("Perform cues load: "+_.url+" bytes="+_.range.start+"-"+_.range.end)}else o(null)}(l,f,o,(function(e){s(t,i,e,a)}))},error:function(){s(t,i,null,a)}})},reset:function(){i=null,a=null}},r={EBML:{tag:440786851,required:!0},Segment:{tag:408125543,required:!0,SeekHead:{tag:290298740,required:!0},Info:{tag:357149030,required:!0,TimecodeScale:{tag:2807729,required:!0,parse:"getMatroskaUint"},Duration:{tag:17545,required:!0,parse:"getMatroskaFloat"}},Tracks:{tag:374648427,required:!0},Cues:{tag:475249515,required:!0,CuePoint:{tag:187,required:!0,CueTime:{tag:179,required:!0,parse:"getMatroskaUint"},CueTrackPositions:{tag:183,required:!0,CueTrack:{tag:247,required:!0,parse:"getMatroskaUint"},CueClusterPosition:{tag:241,required:!0,parse:"getMatroskaUint"}}}}},Void:{tag:236,required:!0}},t}dE.__dashjs_factory_name="WebmSegmentBaseLoader";var fE=iE.default.getSingletonFactory(dE),cE=Object.defineProperty({default:fE},"__esModule",{value:!0}),gE=_E(S),hE=_E($m),pE=_E(cE);function _E(e){return e&&e.__esModule?e:{default:e}}function mE(e){e=e||{};var t=this.context,n=e.eventBus,r=e.events,i=e.dashMetrics,a=e.mediaPlayerModel,o=e.errHandler,s=e.baseURLController,u=e.debug,l=e.boxParser,d=e.requestModifier,f=e.errors,c=void 0,g=void 0,h=void 0;function p(e){return"webm"===(e?e.split("/")[1]:"").toLowerCase()}function _(e){p(e.mimeType)?h.loadInitialization(e.streamId,e.mediaType,e.representation):g.loadInitialization(e.streamId,e.mediaType,e.representation)}function m(e){p(e.mimeType)?h.loadSegments(e.streamId,e.mediaType,e.representation,e.representation?e.representation.indexRange:null,e.callback):g.loadSegments(e.streamId,e.mediaType,e.representation,e.representation?e.representation.indexRange:null,e.callback)}return c={initialize:function(){n.on(r.SEGMENTBASE_INIT_REQUEST_NEEDED,_,c),n.on(r.SEGMENTBASE_SEGMENTSLIST_REQUEST_NEEDED,m,c),g.initialize(),h.initialize()},reset:function(){n.off(r.SEGMENTBASE_INIT_REQUEST_NEEDED,_,c),n.off(r.SEGMENTBASE_SEGMENTSLIST_REQUEST_NEEDED,m,c)}},g=(0,hE.default)(t).getInstance(),h=(0,pE.default)(t).getInstance(),g.setConfig({baseURLController:s,dashMetrics:i,mediaPlayerModel:a,errHandler:o,eventBus:n,events:r,errors:f,debug:u,boxParser:l,requestModifier:d}),h.setConfig({baseURLController:s,dashMetrics:i,mediaPlayerModel:a,errHandler:o,eventBus:n,events:r,errors:f,debug:u,requestModifier:d}),c}mE.__dashjs_factory_name="SegmentBaseController";var EE=gE.default.getSingletonFactory(mE),vE=Object.defineProperty({default:EE},"__esModule",{value:!0});var yE=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.id=null,this.quality=null,this.DVRWindow=null,this.fragmentDuration=null,this.mediaInfo=null,this.MSETimeOffset=null},TE=Object.defineProperty({default:yE},"__esModule",{value:!0});var AE=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.id=null,this.index=null,this.type=null,this.streamInfo=null,this.representationCount=0,this.lang=null,this.viewpoint=null,this.accessibility=null,this.audioChannelConfiguration=null,this.roles=null,this.codec=null,this.mimeType=null,this.contentProtection=null,this.isText=!1,this.KID=null,this.bitrateList=null},SE=Object.defineProperty({default:AE},"__esModule",{value:!0});var IE=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.id=null,this.index=null,this.start=NaN,this.duration=NaN,this.manifestInfo=null,this.isLast=!0},RE=Object.defineProperty({default:IE},"__esModule",{value:!0});var bE=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.DVRWindowSize=NaN,this.loadedTime=null,this.availableFrom=null,this.minBufferTime=NaN,this.duration=NaN,this.isDynamic=!1,this.maxFragmentDuration=null},NE=Object.defineProperty({default:bE},"__esModule",{value:!0}),ME=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var DE=function(){function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.valid="/"==t[0],this.path=t.split("/").filter((function(e){return 0!==e.length})).map((function(e){var t={name:e},r=e.indexOf("[");if(-1!=r){t.name=e.substring(0,r);var i=e.substring(r+1,e.length-1);n.valid=n.valid&&-1==i.indexOf("[");var a=i.indexOf("=");-1!=a?(t.attribute={name:i.substring(1,a),value:i.substring(a+1)},-1!=["'",'"'].indexOf(t.attribute.value[0])&&(t.attribute.value=t.attribute.value.substring(1,t.attribute.value.length-1))):t.position=parseInt(i,10)-1}return t}))}return ME(e,[{key:"isValid",value:function(){return this.valid}},{key:"findsElement",value:function(){return!this.findsAttribute()}},{key:"findsAttribute",value:function(){return this.path[this.path.length-1].name.startsWith("@")}},{key:"getMpdTarget",value:function(e,t){for(var n=null,r=e,i=1,a="MPD";i<this.path.length&&null!==r;){n=r;var o=this.path[i];if(a=o.name,i!==this.path.length-1||!a.startsWith("@")){var s=n[a+"_asArray"]||[];0===s.length&&n[a]&&s.push(n[a]),o.position?r=s[o.position]||null:o.attribute?function(){var e=o.attribute;r=s.filter((function(t){return t[e.name]==e.value}))[0]||null}():r=s[0]||null}i++}return null===r?null:a.startsWith("@")?{name:a.substring(1),leaf:r,target:r}:{name:a,leaf:r,target:t?n:r}}}]),e}(),CE=Object.defineProperty({default:DE},"__esModule",{value:!0}),OE=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var wE=function(){function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.action=t,this.xpath=n,this.value=r,this.position=null}return OE(e,[{key:"getMpdTarget",value:function(e){var t="remove"===this.action||"replace"===this.action||"before"===this.position||"after"===this.position;return this.xpath.getMpdTarget(e,t)}}]),e}(),PE=Object.defineProperty({default:wE},"__esModule",{value:!0}),LE=kE(E),FE=kE(S),xE=kE(ee),UE=kE(CE),BE=kE(PE);function kE(e){return e&&e.__esModule?e:{default:e}}function GE(){var e=void 0,t=void 0,n=this.context;return e={getIsPatch:function(e){return e&&e.hasOwnProperty(LE.default.ORIGINAL_MPD_ID)||!1},getPublishTime:function(e){return e&&e.hasOwnProperty(LE.default.PUBLISH_TIME)?new Date(e[LE.default.PUBLISH_TIME]):null},getOriginalPublishTime:function(e){return e&&e.hasOwnProperty(LE.default.ORIGINAL_PUBLISH_TIME)?new Date(e[LE.default.ORIGINAL_PUBLISH_TIME]):null},getMpdId:function(e){return e&&e[LE.default.ORIGINAL_MPD_ID]||null},getPatchOperations:function(e){return e?(e.__children||[]).map((function(e){var n=Object.keys(e)[0];if("add"!==n&&"remove"!==n&&"replace"!==n)return t.warn("Ignoring node of invalid action: "+n),null;var r=e[n],i=r.sel;if("add"===n&&r.type){if(!r.type.startsWith("@"))return t.warn("Ignoring add action for prefixed namespace declaration: "+r.type+"="+r.__text),null;i=i+"/"+r.type}var a=new UE.default(i);if(!a.isValid())return t.warn("Ignoring action with invalid selector: "+n+" - "+i),null;var o=null;a.findsAttribute()?o=r.__text||"":"remove"!==n&&(o=r.__children.reduce((function(e,t){var n=Object.keys(t)[0];return"#text"!==n&&(e[n]=e[n]||[],e[n].push(t[n])),e}),{}));var s=new BE.default(n,a,o);return"add"===n&&(s.position=r.pos),s})).filter((function(e){return!!e})):[]}},t=(0,xE.default)(n).getInstance().getLogger(e),e}GE.__dashjs_factory_name="PatchManifestModel";var qE=FE.default.getSingletonFactory(GE),YE=Object.defineProperty({default:qE},"__esModule",{value:!0}),jE=$E(E),HE=$E(TE),KE=$E(SE),VE=$E(RE),zE=$E(NE),WE=$E(Kl),XE=$E(S),QE=$E(Md),ZE=$E(YE);function $E(e){return e&&e.__esModule?e:{default:e}}function JE(){var e,t=void 0,n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,u=this.context;function l(e,n,i){var o,s=t.getAdaptationsForType(r[0].mpd.manifest,e,n);if(!s||0===s.length)return null;if(s.length>1&&i){var u=f(i,n);if(a[i.id]&&a[i.id][n])for(var l=0,c=s.length;l<c;l++)if(d(a[i.id][n],u[l]))return s[l];for(var g=0,h=s.length;g<h;g++)if(o=s[g],t.getRolesForAdaptation(o).filter((function(e){return e.value===jE.default.MAIN}))[0])return s[g]}return s[0]}function d(e,t){if(!e||!t)return!1;var n=e.id===t.id,r=e.viewpoint===t.viewpoint,i=e.lang===t.lang,a=e.roles.toString()===t.roles.toString(),o=e.accessibility.toString()===t.accessibility.toString(),s=e.audioChannelConfiguration.toString()===t.audioChannelConfiguration.toString();return n&&r&&i&&a&&o&&s}function f(e,n,a){var s,u=r,l=a,d=[],f=void 0,g=void 0,h=void 0,p=void 0,_=void 0,y=void 0;if(l)T(),u=c(l);else{if(!(r.length>0))return d;l=r[0].mpd.manifest}var A=m(e,u);A&&(y=A.id);var S=t.getAdaptationsForType(l,e?e.index:null,n!==o.EMBEDDED_TEXT?n:o.VIDEO);if(!S||0===S.length)return d;for(i[y]=i[y]||t.getAdaptationsForPeriod(A),p=0,s=S.length;p<s;p++)if(f=S[p],h=t.getIndexForAdaptation(f,l,e.index),g=E(i[y][h]),n===o.EMBEDDED_TEXT){var I=g.accessibility.length;for(_=0;_<I;_++)if(g){var R=g.accessibility[_];if(0===R.indexOf("cea-608:")){var b=R.substring(8).split(";");if("CC"===b[0].substring(0,2))for(_=0;_<b.length;_++)g||(g=E.call(this,i[y][h])),v(g,b[_].substring(0,3),b[_].substring(4)),d.push(g),g=null;else for(_=0;_<b.length;_++)g||(g=E.call(this,i[y][h])),v(g,"CC"+(_+1),b[_]),d.push(g),g=null}else 0===R.indexOf("cea-608")&&(v(g,o.CC1,"eng"),d.push(g),g=null)}}else n===o.IMAGE?(g.type=o.IMAGE,d.push(g),g=null):g&&d.push(g);return d}function c(e){var n=g(e);return t.getRegularPeriods(n)}function g(e){var n=p(e);return t.getMpd(n)}function h(){r=[],i={},a={}}function p(e){return e||(r.length>0?r[0].mpd.manifest:null)}function _(e){return e&&e.streamInfo&&void 0!==e.streamInfo.id&&i[e.streamInfo.id]?i[e.streamInfo.id][e.index]:null}function m(e,t){for(var n=t.length,r=0;r<n;r++){var i=t[r];if(e&&e.id===i.id)return i}return null}function E(e){if(!e)return null;var n,r=new KE.default,i=e.period.mpd.manifest.Period_asArray[e.period.index].AdaptationSet_asArray[e.index];return r.id=e.id,r.index=e.index,r.type=e.type,r.streamInfo=y(e.period),r.representationCount=t.getRepresentationCount(i),r.labels=t.getLabelsForAdaptation(i),r.lang=t.getLanguageForAdaptation(i),n=t.getViewpointForAdaptation(i),r.viewpoint=n?n.value:void 0,r.accessibility=t.getAccessibilityForAdaptation(i).map((function(e){var t=e.value,n=t;return e.schemeIdUri&&e.schemeIdUri.search("cea-608")>=0&&void 0!==s&&(n=t?"cea-608:"+t:"cea-608",r.embeddedCaptions=!0),n})),r.audioChannelConfiguration=t.getAudioChannelConfigurationForAdaptation(i).map((function(e){return e.value})),0===r.audioChannelConfiguration.length&&Array.isArray(i.Representation_asArray)&&i.Representation_asArray.length>0&&(r.audioChannelConfiguration=t.getAudioChannelConfigurationForRepresentation(i.Representation_asArray[0]).map((function(e){return e.value}))),r.roles=t.getRolesForAdaptation(i).map((function(e){return e.value})),r.codec=t.getCodec(i),r.mimeType=t.getMimeType(i),r.contentProtection=t.getContentProtectionData(i),r.bitrateList=t.getBitrateListForAdaptation(i),r.contentProtection&&r.contentProtection.forEach((function(e){e.KID=t.getKID(e)})),r.isText=t.getIsTextTrack(r.mimeType),r.supplementalProperties=t.getSupplementalPropperties(i),r}function v(e,t,n){e.id=t,e.index=100+parseInt(t.substring(2,3)),e.type=o.EMBEDDED_TEXT,e.codec="cea-608-in-SEI",e.isText=!0,e.isEmbedded=!0,e.lang=n,e.roles=["caption"]}function y(e){var n=new VE.default;return n.id=e.id,n.index=e.index,n.start=e.start,n.duration=e.duration,n.manifestInfo=function(e){var n=new zE.default;return n.DVRWindowSize=e.timeShiftBufferDepth,n.loadedTime=e.manifest.loadedTime,n.availableFrom=e.availabilityStartTime,n.minBufferTime=e.manifest.minBufferTime,n.maxFragmentDuration=e.maxSegmentDuration,n.duration=t.getDuration(e.manifest),n.isDynamic=t.getIsDynamic(e.manifest),n.serviceDescriptions=t.getServiceDescriptions(e.manifest),n.protocol=e.manifest.protocol,n}(e.mpd),n.isLast=1===e.mpd.manifest.Period_asArray.length||Math.abs(n.start+n.duration-n.manifestInfo.duration)<1,n}function T(){if(!o)throw new Error("setConfig function has to be called previously")}function A(e){return r.length>0?r[0].mpd.manifest.Period_asArray[e]:null}function S(e,t,n){var r=void 0,i=void 0,a=void 0,o=void 0,s=void 0;if(e)for(r=e.AdaptationSet_asArray,o=0;o<r.length;o+=1)for(a=r[o].Representation_asArray,s=0;s<a.length;s+=1)if(t===(i=a[s]).id)return n?s:i;return null}return e={getBandwidthForRepresentation:function(e,t){var n;return(n=S(A(t),e))?n.bandwidth:null},getIndexForRepresentation:function(e,t){return function(e,t){var n=S(e,t,!0);return null!==n?n:-1}(A(t),e)},getMaxIndexForBufferType:function(e,n){return function(e,n){var r,i=void 0,a=void 0,o=void 0;if(!e||!n)return-1;for(r=e.AdaptationSet_asArray,o=0;o<r.length;o+=1)if(i=r[o],a=i.Representation_asArray,t.getIsTypeOf(i,n))return a.length;return-1}(A(n),e)},convertDataToRepresentationInfo:function(e){if(e){var n=new HE.default,r=e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.index].AdaptationSet_asArray[e.adaptation.index],i=t.getRepresentationFor(e.index,r);return n.id=e.id,n.quality=e.index,n.bandwidth=t.getBandwidth(i),n.DVRWindow=e.segmentAvailabilityRange,n.fragmentDuration=e.segmentDuration||(e.segments&&e.segments.length>0?e.segments[0].duration:NaN),n.MSETimeOffset=e.MSETimeOffset,n.mediaInfo=E(e.adaptation),n}return null},getDataForMedia:_,getStreamsInfo:function(e,t){var n=[],i=r;if(e&&(T(),i=c(e)),i.length>0){(!t||t>i.length)&&(t=i.length);for(var a=0;a<t;a++)n.push(y(i[a]))}return n},getMediaInfoForType:function(e,n){if(0===r.length||!e)return null;var a=m(e,r);if(!a)return null;var o=a.id;i[o]=i[o]||t.getAdaptationsForPeriod(a);var s=l(e.index,n,e);if(!s)return null;var u=t.getIndexForAdaptation(s,r[0].mpd.manifest,e.index);return E(i[o][u])},getAllMediaInfoForType:f,getAdaptationForType:l,getRealAdaptation:function(e,n){var i,a=void 0,o=m(e,r);return i=n?n.id:null,r.length>0&&o&&(a=i?t.getAdaptationForId(i,r[0].mpd.manifest,o.index):t.getAdaptationForIndex(n?n.index:null,r[0].mpd.manifest,o.index)),a},getRealPeriodByIndex:function(e){return t.getRealPeriodForIndex(e,r[0].mpd.manifest)},getEssentialPropertiesForRepresentation:function(e){try{return t.getEssentialPropertiesForRepresentation(e)}catch(e){return[]}},getVoRepresentations:function(e){var n=_(e);return t.getRepresentationsForAdaptation(n)},getEventsFor:function(e,n){var i=[];if(r.length>0){var a=r[0].mpd.manifest;e instanceof VE.default?i=t.getEventsForPeriod(m(e,r)):e instanceof KE.default?i=t.getEventStreamForAdaptationSet(a,_(e)):e instanceof HE.default&&(i=t.getEventStreamForRepresentation(a,n))}return i},getEvent:function(e,t,n,r){try{if(!e||!t||isNaN(n)||!r)return null;var i=e.scheme_id_uri,a=e.value;if(!t[i+"/"+a])return null;var o=new WE.default,s=e.timescale||1,u=r.adaptation.period.start,l=t[i+"/"+a],d=isNaN(r.presentationTimeOffset)?isNaN(l.presentationTimeOffset)?0:l.presentationTimeOffset:r.presentationTimeOffset,f=e.presentation_time_delta/s,c=void 0;c=0===e.version?u+n-d+f:u-d+f;var g=e.event_duration,h=e.id,p=e.message_data;return o.eventStream=l,o.eventStream.value=a,o.eventStream.timescale=s,o.duration=g,o.id=h,o.calculatedPresentationTime=c,o.messageData=p,o.presentationTimeDelta=f,o}catch(e){return null}},getMpd:g,setConfig:function(e){e&&(e.constants&&(o=e.constants),e.cea608parser&&(s=e.cea608parser),e.errHandler&&t.setConfig({errHandler:e.errHandler}),e.BASE64&&t.setConfig({BASE64:e.BASE64}))},updatePeriods:function(e){if(!e)return null;T(),r=c(e),i={}},getIsTextTrack:function(e){return t.getIsTextTrack(e)},getUTCTimingSources:function(){var e=p();return t.getUTCTimingSources(e)},getSuggestedPresentationDelay:function(){var e=r.length>0?r[0].mpd:null;return t.getSuggestedPresentationDelay(e)},getAvailabilityStartTime:function(e){var n=g(e);return t.getAvailabilityStartTime(n)},getIsTypeOf:function(e,n){return t.getIsTypeOf(e,n)},getIsDynamic:function(e){var n=p(e);return t.getIsDynamic(n)},getDuration:function(e){var n=p(e);return t.getDuration(n)},getRegularPeriods:c,getLocation:function(e){return t.getLocation(e)},getPatchLocation:function(e){var n=t.getPatchLocation(e),r=t.getPublishTime(e);if(!n||!r)return null;if(n.hasOwnProperty("ttl")&&r){var i=1e3*parseFloat(n.ttl);if(r.getTime()+i<=(new Date).getTime())return null}return n.__text},getManifestUpdatePeriod:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return t.getManifestUpdatePeriod(e,n)},getPublishTime:function(e){return t.getPublishTime(e)},getIsDVB:function(e){return t.hasProfile(e,"urn:dvb:dash:profile:dvb-dash:2014")},getIsPatch:function(e){return n.getIsPatch(e)},getBaseURLsFromElement:function(e){return t.getBaseURLsFromElement(e)},getRepresentationSortFunction:function(){return t.getRepresentationSortFunction()},getCodec:function(e,n,r){return t.getCodec(e,n,r)},getVoAdaptations:function(){return i},getVoPeriods:function(){return r},getPeriodById:function(e){if(!e||0===r.length)return null;var t=r.filter((function(t){return t.id===e}));return t&&t.length>0?t[0]:null},setCurrentMediaInfo:function(e,t,n){a[e]=a[e]||{},a[e][t]=a[e][t]||{},a[e][t]=n},isPatchValid:function(e,r){var i=t.getId(e),a=n.getMpdId(r),o=t.getPublishTime(e),s=n.getPublishTime(r),u=n.getOriginalPublishTime(r);return!!(i&&a&&i==a&&o&&u&&o.getTime()==u.getTime()&&s&&o.getTime()<s.getTime())},applyPatchToManifest:function(e,t){n.getPatchOperations(t).forEach((function(t){var n=t.getMpdTarget(e);if(null!==n){var r=n.name,i=n.target,a=n.leaf;if(t.xpath.findsAttribute())switch(t.action){case"add":case"replace":i[r]=t.value;break;case"remove":delete i[r]}else{var o=(i[r+"_asArray"]||[]).indexOf(a),s="prepend"===t.position||"before"===t.position;if(("remove"===t.action||"replace"===t.action)&&(delete i[r],-1!=o)){var u=i[r+"_asArray"];u.splice(o,1),u.length>1?i[r]=u:1==u.length?i[r]=u[0]:delete i[r+"_asArray"]}"add"!==t.action&&"replace"!==t.action||Object.keys(t.value).forEach((function(e){var n=t.value[e],a=i[e+"_asArray"]||[];if(0===a.length&&i[e]&&a.push(i[e]),0===a.length)a=n;else{var u=a.length;u=e==r&&-1!=o?o+(s?0:1)+("replace"==t.action?-1:0):s?0:a.length,a.splice.apply(a,[u,0].concat(n))}i[e+"_asArray"]=a,i[e]=1==a.length?a[0]:a}))}}}))},reset:h},t=(0,QE.default)(u).getInstance(),n=(0,ZE.default)(u).getInstance(),h(),e}JE.__dashjs_factory_name="DashAdapter";var ev=XE.default.getSingletonFactory(JE),tv=Object.defineProperty({default:ev},"__esModule",{value:!0}),nv=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var rv=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return nv(e,null,[{key:"round10",value:function(e,t){return function(e,t,n){if(void 0===n||0==+n)return Math[e](t);if(n=+n,null===(t=+t)||isNaN(t)||!("number"==typeof n&&n%1==0))return NaN;return t=t.toString().split("e"),+((t=(t=Math[e](+(t[0]+"e"+(t[1]?+t[1]-n:-n)))).toString().split("e"))[0]+"e"+(t[1]?+t[1]+n:n))}("round",e,t)}}]),e}();var iv=Object.defineProperty({default:rv},"__esModule",{value:!0});var av=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.TcpList=[],this.HttpList=[],this.RepSwitchList=[],this.BufferLevel=[],this.BufferState=[],this.PlayList=[],this.DroppedFrames=[],this.SchedulingInfo=[],this.DVRInfo=[],this.ManifestUpdate=[],this.RequestsQueue=null,this.DVBErrors=[]},ov=Object.defineProperty({default:av},"__esModule",{value:!0});var sv=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.t=null,this.mt=null,this.to=null,this.lto=null},uv=Object.defineProperty({default:sv},"__esModule",{value:!0});var lv=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.t=null,this.level=null},dv=Object.defineProperty({default:lv},"__esModule",{value:!0}),fv=function(e){return e&&e.__esModule?e:{default:e}}(T);var cv=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.target=null,this.state=fv.default.BUFFER_EMPTY},gv=Object.defineProperty({default:cv},"__esModule",{value:!0});var hv=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.time=null,this.range=null,this.manifestInfo=null},pv=Object.defineProperty({default:hv},"__esModule",{value:!0});var _v=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.time=null,this.droppedFrames=null},mv=Object.defineProperty({default:_v},"__esModule",{value:!0});function Ev(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var vv=function e(){Ev(this,e),this.mediaType=null,this.type=null,this.requestTime=null,this.fetchTime=null,this.availabilityStartTime=null,this.presentationStartTime=0,this.clientTimeOffset=0,this.currentTime=null,this.buffered=null,this.latency=0,this.streamInfo=[],this.representationInfo=[]},yv=function e(){Ev(this,e),this.id=null,this.index=null,this.start=null,this.duration=null},Tv=function e(){Ev(this,e),this.id=null,this.index=null,this.mediaType=null,this.streamIndex=null,this.presentationTimeOffset=null,this.startNumber=null,this.fragmentInfoType=null},Av=Object.defineProperty({ManifestUpdate:vv,ManifestUpdateStreamInfo:yv,ManifestUpdateRepresentationInfo:Tv},"__esModule",{value:!0});var Sv=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.mediaType=null,this.t=null,this.type=null,this.startTime=null,this.availabilityStartTime=null,this.duration=null,this.quality=null,this.range=null,this.state=null},Iv=Object.defineProperty({default:Sv},"__esModule",{value:!0});var Rv=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.loadingRequests=[],this.executedRequests=[]},bv=Object.defineProperty({default:Rv},"__esModule",{value:!0}),Nv=Gv(p),Mv=Gv(T),Dv=Gv(ov),Cv=Gv(uv),Ov=Gv(dv),wv=Gv(gv),Pv=Gv(pv),Lv=Gv(mv),Fv=Gv(Iv),xv=Gv(x),Uv=Gv(bv),Bv=Gv(q),kv=Gv(S);function Gv(e){return e&&e.__esModule?e:{default:e}}function qv(e){var t,n=(e=e||{}).settings,r=this.context,i=(0,xv.default)(r).getInstance(),a=void 0;function o(){i.trigger(Bv.default.METRICS_CHANGED)}function s(e){i.trigger(Bv.default.METRIC_CHANGED,{mediaType:e}),o()}function u(e,t,n){i.trigger(Bv.default.METRIC_UPDATED,{mediaType:e,metric:t,value:n}),s(e)}function l(e,t,n){i.trigger(Bv.default.METRIC_ADDED,{mediaType:e,metric:t,value:n}),s(e)}function d(e,t){var n=null;return e?(a.hasOwnProperty(e)?n=a[e]:t||(n=new Dv.default,a[e]=n),n):n}function f(e,t,r){var i=d(e);null!==i&&(i[t].push(r),i[t].length>n.get().streaming.metricsMaxListDepth&&i[t].shift())}function c(e,t,n){f(e,t,n),l(e,t,n)}return t={clearCurrentMetricsForType:function(e){delete a[e],s(e)},clearAllCurrentMetrics:function(){a={},o()},getMetricsFor:d,addHttpRequest:function e(t,n,r,i,a,o,s,u,l,d,f,g,h,p,_){var m=new pe.HTTPRequest;o&&o!==i&&(e(t,null,r,i,a,null,null,u,l,null,null,null,h,null,null),m.actualurl=o),m.tcpid=n,m.type=r,m.url=i,m.range=u,m.trequest=l,m.tresponse=d,m.responsecode=g,m._tfinish=f,m._stream=t,m._mediaduration=h,m._quality=a,m._responseHeaders=p,m._serviceLocation=s,_?_.forEach((function(e){!function(e,t,n,r){var i=new pe.HTTPRequestTrace;i.s=t,i.d=n,i.b=r,e.trace.push(i),e.interval||(e.interval=0),e.interval+=n}(m,e.s,e.d,e.b)})):(delete m.interval,delete m.trace),c(t,Mv.default.HTTP_REQUEST,m)},addRepresentationSwitch:function(e,t,n,r,i){var a=new Cv.default;a.t=t,a.mt=n,a.to=r,i?a.lto=i:delete a.lto,c(e,Mv.default.TRACK_SWITCH,a)},addBufferLevel:function(e,t,n){var r=new Ov.default;r.t=t,r.level=n,c(e,Mv.default.BUFFER_LEVEL,r)},addBufferState:function(e,t,n){var r=new wv.default;r.target=n,r.state=t,c(e,Mv.default.BUFFER_STATE,r)},addDVRInfo:function(e,t,n,r){var i=new Pv.default;i.time=t,i.range=r,i.manifestInfo=n,c(e,Mv.default.DVR_INFO,i)},addDroppedFrames:function(e,t){var n=new Lv.default,r=d(e).DroppedFrames;t&&(n.time=t.creationTime,n.droppedFrames=t.droppedVideoFrames,r.length>0&&r[r.length-1]==n||c(e,Mv.default.DROPPED_FRAMES,n))},addSchedulingInfo:function(e,t,n,r,i,a,o,s,u){var l=new Fv.default;l.mediaType=e,l.t=t,l.type=n,l.startTime=r,l.availabilityStartTime=i,l.duration=a,l.quality=o,l.range=s,l.state=u,c(e,Mv.default.SCHEDULING_INFO,l)},addRequestsQueue:function(e,t,n){var r=new Uv.default;r.loadingRequests=t,r.executedRequests=n,d(e).RequestsQueue=r,l(e,Mv.default.REQUESTS_QUEUE,r)},addManifestUpdate:function(e,t,n,r,i,a,o,s,u,d){var c=new Av.ManifestUpdate;c.mediaType=e,c.type=t,c.requestTime=n,c.fetchTime=r,c.availabilityStartTime=i,c.presentationStartTime=a,c.clientTimeOffset=o,c.currentTime=s,c.buffered=u,c.latency=d,f(Nv.default.STREAM,Mv.default.MANIFEST_UPDATE,c),l(e,Mv.default.MANIFEST_UPDATE,c)},updateManifestUpdateInfo:function(e,t){if(e){for(var n in t)e[n]=t[n];u(e.mediaType,Mv.default.MANIFEST_UPDATE,e)}},addManifestUpdateStreamInfo:function(e,t,n,r,i){if(e){var a=new Av.ManifestUpdateStreamInfo;a.id=t,a.index=n,a.start=r,a.duration=i,e.streamInfo.push(a),u(e.mediaType,Mv.default.MANIFEST_UPDATE_STREAM_INFO,e)}},addManifestUpdateRepresentationInfo:function(e,t,n,r,i,a,o,s){if(e&&e.representationInfo){var l=new Av.ManifestUpdateRepresentationInfo;l.id=t,l.index=n,l.streamIndex=r,l.mediaType=i,l.startNumber=o,l.fragmentInfoType=s,l.presentationTimeOffset=a,e.representationInfo.push(l),u(e.mediaType,Mv.default.MANIFEST_UPDATE_TRACK_INFO,e)}},addPlayList:function(e){e.trace&&Array.isArray(e.trace)?e.trace.forEach((function(e){e.hasOwnProperty("subreplevel")&&!e.subreplevel&&delete e.subreplevel})):delete e.trace,c(Nv.default.STREAM,Mv.default.PLAY_LIST,e)},addDVBErrors:function(e){c(Nv.default.STREAM,Mv.default.DVB_ERRORS,e)}},a={},t}qv.__dashjs_factory_name="MetricsModel";var Yv=kv.default.getSingletonFactory(qv),jv=Object.defineProperty({default:Yv},"__esModule",{value:!0}),Hv=Qv(p),Kv=Qv(S),Vv=Qv(T),zv=Qv(iv),Wv=Qv(jv),Xv=Qv(fl);function Qv(e){return e&&e.__esModule?e:{default:e}}function Zv(e){e=e||{};var t,n=this.context,r=void 0,i=void 0,a=void 0,o=e.metricsModel;function s(e){var t=o.getMetricsFor(e,!0);if(!t)return null;var n=t.HttpList,r=null,i=void 0;if(!n||n.length<=0)return null;for(i=n.length-1;i>=0;){if(n[i].responsecode){r=n[i];break}i--}return r}function u(e){var t=o.getMetricsFor(e,!0);return t&&t.HttpList?t.HttpList:[]}function l(e,t){if(!e)return null;var n=e[t];return n&&0!==n.length?n[n.length-1]:null}return t={getCurrentRepresentationSwitch:function(e){return l(o.getMetricsFor(e,!0),Vv.default.TRACK_SWITCH)},getCurrentBufferState:function(e){return l(o.getMetricsFor(e,!0),Vv.default.BUFFER_STATE)},getCurrentBufferLevel:function(e){var t=l(o.getMetricsFor(e,!0),Vv.default.BUFFER_LEVEL);return t?zv.default.round10(t.level/1e3,-3):0},getCurrentHttpRequest:s,getHttpRequests:u,getCurrentDroppedFrames:function(){return l(o.getMetricsFor(Hv.default.VIDEO,!0),Vv.default.DROPPED_FRAMES)},getCurrentSchedulingInfo:function(e){return l(o.getMetricsFor(e,!0),Vv.default.SCHEDULING_INFO)},getCurrentDVRInfo:function(e){return l(e?o.getMetricsFor(e,!0):o.getMetricsFor(Hv.default.VIDEO,!0)||o.getMetricsFor(Hv.default.AUDIO,!0),Vv.default.DVR_INFO)},getCurrentManifestUpdate:function(){return l(o.getMetricsFor(Hv.default.STREAM),Vv.default.MANIFEST_UPDATE)},getLatestFragmentRequestHeaderValueByID:function(e,t){var n={},r=s(e);return r&&(n=Xv.default.parseHttpHeaders(r._responseHeaders)),void 0===n[t]?null:n[t]},getLatestMPDRequestHeaderValueByID:function(e){var t,n={},r=void 0,i=void 0;for(i=(t=u(Hv.default.STREAM)).length-1;i>=0;i--)if((r=t[i]).type===pe.HTTPRequest.MPD_TYPE){n=Xv.default.parseHttpHeaders(r._responseHeaders);break}return void 0===n[e]?null:n[e]},addRepresentationSwitch:function(e,t,n,r,i){o.addRepresentationSwitch(e,t,n,r,i)},addDVRInfo:function(e,t,n,r){o.addDVRInfo(e,t,n,r)},updateManifestUpdateInfo:function(e){var t=this.getCurrentManifestUpdate();o.updateManifestUpdateInfo(t,e)},addManifestUpdateStreamInfo:function(e){if(e){var t=this.getCurrentManifestUpdate();o.addManifestUpdateStreamInfo(t,e.id,e.index,e.start,e.duration)}},addManifestUpdateRepresentationInfo:function(e,t){if(e){var n=this.getCurrentManifestUpdate();o.addManifestUpdateRepresentationInfo(n,e.id,e.index,e.streamIndex,t,e.presentationTimeOffset,e.startNumber,e.fragmentInfoType)}},addManifestUpdate:function(e){o.addManifestUpdate(Hv.default.STREAM,e.type,e.requestStartDate,e.requestEndDate)},addHttpRequest:function(e,t,n,r,i){o.addHttpRequest(e.mediaType,null,e.type,e.url,e.quality,t,e.serviceLocation||null,e.range||null,e.requestStartDate,e.firstByteDate,e.requestEndDate,n,e.duration,r,i)},addSchedulingInfo:function(e,t){o.addSchedulingInfo(e.mediaType,new Date,e.type,e.startTime,e.availabilityStartTime,e.duration,e.quality,e.range,t)},addRequestsQueue:function(e,t,n){o.addRequestsQueue(e,t,n)},addBufferLevel:function(e,t,n){o.addBufferLevel(e,t,n)},addBufferState:function(e,t,n){o.addBufferState(e,t,n)},addDroppedFrames:function(e){o.addDroppedFrames(Hv.default.VIDEO,e)},addPlayList:function(){a&&(o.addPlayList(a),a=null)},addDVBErrors:function(e){o.addDVBErrors(e)},createPlaylistMetrics:function(e,t){(a=new Ou.PlayList).start=new Date,a.mstart=e,a.starttype=t},createPlaylistTraceMetrics:function(e,t,n){!0===r&&(r=!1,(i=new Ou.PlayListTrace).representationid=e,i.start=new Date,i.mstart=t,i.playbackspeed=null!==n?n.toString():null)},updatePlayListTraceMetrics:function(e){if(i)for(var t in i)i[t]=e[t]},pushPlayListTraceMetrics:function(e,t){if(!1===r&&a&&i&&i.start){var n=i.start,o=e.getTime()-n.getTime();i.duration=o,i.stopreason=t,a.trace.push(i),r=!0}},clearAllCurrentMetrics:function(){o.clearAllCurrentMetrics()}},o=o||(0,Wv.default)(n).getInstance({settings:e.settings}),r=!0,i=null,a=null,t}Zv.__dashjs_factory_name="DashMetrics";var $v=Kv.default.getSingletonFactory(Zv),Jv=Object.defineProperty({default:$v},"__esModule",{value:!0}),ey=oy(x),ty=oy(q),ny=oy(S),ry=oy(E),iy=oy(Md),ay=oy(Tl);function oy(e){return e&&e.__esModule?e:{default:e}}function sy(){var e,t=this.context,n=(0,ey.default)(t).getInstance(),r=(0,ay.default)(t).getInstance(),i=void 0,a=void 0,o=void 0,s=void 0;function u(e){a=e}function l(e,t,n,r){return r?n&&t.timeShiftBufferDepth!=Number.POSITIVE_INFINITY?new Date(t.availabilityStartTime.getTime()+1e3*(e+t.timeShiftBufferDepth)):t.availabilityEndTime:n?new Date(t.availabilityStartTime.getTime()+1e3*(e-a)):t.availabilityStartTime}function d(e,t){return(e.getTime()-t.mpd.availabilityStartTime.getTime()+1e3*a)/1e3}function f(e,t){return e+(t.adaptation.period.start-t.presentationTimeOffset)}function c(e){void 0!==e.offset&&(u(e.offset/1e3),o=!0)}function g(){a=0,o=!1,s=NaN}function h(){n.off(ty.default.UPDATE_TIME_SYNC_OFFSET,c,this),g()}return e={initialize:function(){g(),n.on(ty.default.UPDATE_TIME_SYNC_OFFSET,c,this)},getClientTimeOffset:function(){return a},setClientTimeOffset:u,getExpectedLiveEdge:function(){return s},setExpectedLiveEdge:function(e){s=e},calcAvailabilityStartTimeFromPresentationTime:function(e,t,n){return l.call(this,e,t,n)},calcAvailabilityEndTimeFromPresentationTime:function(e,t,n){return l.call(this,e,t,n,!0)},calcPresentationTimeFromWallTime:d,calcPresentationTimeFromMediaTime:f,calcPeriodRelativeTimeFromMpdRelativeTime:function(e,t){return t-e.adaptation.period.start},calcMediaTimeFromPresentationTime:function(e,t){return e-t.adaptation.period.start+t.presentationTimeOffset},calcSegmentAvailabilityRange:function(e,t){var n=e.adaptation.period,a={start:n.start,end:n.start+n.duration};if(!t)return a;if(!o&&e.segmentAvailabilityRange)return e.segmentAvailabilityRange;var s=e.segmentDuration||(e.segments&&e.segments.length?e.segments[e.segments.length-1].duration:0);if(e.segmentInfoType===ry.default.SEGMENT_TIMELINE&&r.get().streaming.calcSegmentAvailabilityRangeFromTimeline)return function(e){var t,n=e.adaptation.period.mpd.manifest.Period_asArray[e.adaptation.period.index].AdaptationSet_asArray[e.adaptation.index],r=i.getRepresentationFor(e.index,n),a=r.SegmentTemplate.SegmentTimeline,o=r.SegmentTemplate.timescale,s=a.S_asArray,u={start:0,end:0},l=0,d=void 0,c=void 0,g=void 0;for(u.start=f(s[0].t/o,e),g=0,t=s.length;g<t;g++)d=s[g],c=0,d.hasOwnProperty("r")&&(c=d.r),l+=d.d/o*(1+c);return u.end=u.start+l,u}(e);var u=d(new Date,n),l=n.start+n.duration;a.start=Math.max(u-n.mpd.timeShiftBufferDepth,n.start);var c=void 0!==e.availabilityTimeOffset&&e.availabilityTimeOffset<s?s-e.availabilityTimeOffset:s;return a.end=u>=l&&u-c<l?l:u-c,a},getPeriodEnd:function(e,t){var n=e.adaptation.period;if(!t)return n.start+n.duration;if(!o&&e.segmentAvailabilityRange)return e.segmentAvailabilityRange;var r=e.segmentDuration||(e.segments&&e.segments.length?e.segments[e.segments.length-1].duration:0),i=d(new Date,n),a=n.start+n.duration,s=void 0!==e.availabilityTimeOffset&&e.availabilityTimeOffset<r?r-e.availabilityTimeOffset:r;return Math.min(i-s,a)},calcWallTimeForSegment:function(e,t){var n=void 0,r=void 0,i=void 0;return t&&(n=e.representation.adaptation.period.mpd.suggestedPresentationDelay,r=e.presentationStartTime+n,i=new Date(e.availabilityStartTime.getTime()+1e3*r)),i},reset:h},i=(0,iy.default)(t).getInstance(),h(),e}sy.__dashjs_factory_name="TimelineConverter";var uy=ny.default.getSingletonFactory(sy),ly=Object.defineProperty({default:uy},"__esModule",{value:!0}),dy=f((function(e,t){var n,r,i,o,u,l={encode:function(e){for(var t=[],n=0;n<e.length;++n){var r=e.charCodeAt(n);r<128?t.push(r):r<2048?(t.push(192|r>>6),t.push(128|63&r)):r<65536?(t.push(224|r>>12),t.push(128|63&r>>6),t.push(128|63&r)):(t.push(240|r>>18),t.push(128|63&r>>12),t.push(128|63&r>>6),t.push(128|63&r))}return t},decode:function(e){for(var t=[],n=0;n<e.length;){var r=e[n++];r<128||(r<224?(r=(31&r)<<6,r|=63&e[n++]):r<240?(r=(15&r)<<12,r|=(63&e[n++])<<6,r|=63&e[n++]):(r=(7&r)<<18,r|=(63&e[n++])<<12,r|=(63&e[n++])<<6,r|=63&e[n++])),t.push(String.fromCharCode(r))}return t.join("")}},d={};n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=function(e){for(var t=0,r=[],i=0|e.length/3;0<i--;){var a=(e[t]<<16)+(e[t+1]<<8)+e[t+2];t+=3,r.push(n.charAt(63&a>>18)),r.push(n.charAt(63&a>>12)),r.push(n.charAt(63&a>>6)),r.push(n.charAt(63&a))}return 2==e.length-t?(a=(e[t]<<16)+(e[t+1]<<8),r.push(n.charAt(63&a>>18)),r.push(n.charAt(63&a>>12)),r.push(n.charAt(63&a>>6)),r.push("=")):1==e.length-t&&(a=e[t]<<16,r.push(n.charAt(63&a>>18)),r.push(n.charAt(63&a>>12)),r.push("==")),r.join("")},i=function(){for(var e=[],t=0;t<n.length;++t)e[n.charCodeAt(t)]=t;return e["=".charCodeAt(0)]=0,e}(),o=function(e){for(var t=0,n=[],r=0|e.length/4;0<r--;){var a=(i[e.charCodeAt(t)]<<18)+(i[e.charCodeAt(t+1)]<<12)+(i[e.charCodeAt(t+2)]<<6)+i[e.charCodeAt(t+3)];n.push(255&a>>16),n.push(255&a>>8),n.push(255&a),t+=4}return n&&("="==e.charAt(t-2)?(n.pop(),n.pop()):"="==e.charAt(t-1)&&n.pop()),n},u={encode:function(e){for(var t=[],n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t},decode:function(e){for(var t=0;t<s.length;++t)a[t]=String.fromCharCode(a[t]);return a.join("")}},d.decodeArray=function(e){var t=o(e);return new Uint8Array(t)},d.encodeASCII=function(e){var t=u.encode(e);return r(t)},d.decodeASCII=function(e){var t=o(e);return u.decode(t)},d.encode=function(e){var t=l.encode(e);return r(t)},d.decode=function(e){var t=o(e);return l.decode(t)},t.decode=d.decode,t.decodeArray=d.decodeArray,t.encode=d.encode,t.encodeASCII=d.encodeASCII})),fy=$y(c),cy=$y(p),gy=$y(E),hy=$y(T),py=$y(de),_y=$y(wg),my=$y(Gg),Ey=$y(Qg),vy=$y(Gh),yy=$y(F_),Ty=$y(Y_),Ay=$y(X_),Sy=$y(nm),Iy=$y(Dt),Ry=$y(pu),by=$y(wn),Ny=$y(lm),My=$y(_m),Dy=$y(Rm),Cy=$y(Ka),Oy=$y(Af),wy=$y(Pm),Py=$y(Jd),Ly=$y(qm),Fy=$y(ee),xy=$y(Bt),Uy=$y(x),By=$y(q),ky=$y(D),Gy=$y(S),qy=$y(Tl),Yy=$y(vE),jy=$y(tv),Hy=$y(Jv),Ky=$y(ly),Vy=$y(dy),zy=$y(ke),Wy=$y(Me),Xy=$y(Bc),Qy=$y(Ru),Zy=$y(Qe);function $y(e){return e&&e.__esModule?e:{default:e}}function Jy(){var e="You must first call initialize() and set a source before calling this method",t="You must first call initialize() and set a valid source and view before calling this method",n="You must first call attachView() to set the video element before calling this method",r="You must first call attachSource() with a valid source before calling this method",i=this.context,a=(0,Uy.default)(i).getInstance(),o=(0,qy.default)(i).getInstance(),s=(0,Fy.default)(i).getInstance({settings:o}),u=void 0,l=void 0,d=void 0,f=void 0,c=void 0,g=void 0,h=void 0,p=void 0,_=void 0,m=void 0,E=void 0,v=void 0,y=void 0,T=void 0,A=void 0,S=void 0,I=void 0,R=void 0,b=void 0,N=void 0,M=void 0,D=void 0,C=void 0,O=void 0,w=void 0,P=void 0,L=void 0,F=void 0,x=void 0,U=void 0,B=void 0,k=void 0,G=void 0,q=void 0,Y=void 0,j=void 0;function H(){ie(null),te(null),f=null,y&&(y.reset(),y=null),T&&(T.reset(),T=null),G.reset(),o.reset(),S&&(S.reset(),S=null)}function K(){return!!d&&!!x.getElement()}function V(){return(0,jm.getVersionString)()}function z(){if(!h)throw t;return w.isPaused()}function W(e){var t=P.getCurrentDVRInfo();if(!t)return 0;var n=w.getLiveDelay(),r=t.range.start+e;return r>t.range.end-n&&(r=t.range.end-n),r}function X(e){if(!h)throw t;var n=ee().currentTime;if(void 0!==e)n=C.getTimeRelativeToStreamId(n,e);else if(w.getIsDynamic()){var r=P.getCurrentDVRInfo();n=null===r||0===n?0:Math.max(0,n-r.range.start)}return n}function Q(){if(!h)throw t;var e=ee().duration;if(w.getIsDynamic()){var n=P.getCurrentDVRInfo();e=n?n.range.end-n.range.start:0}return e}function Z(e){(0,rt.checkParameterType)(e,"boolean"),p=e}function $(){R.restoreDefaultUTCTimingSources()}function J(){return P}function ee(){if(!x.getElement())throw n;return x.getElement()}function te(e){if(!c)throw"MediaPlayer not initialized!";x.setElement(e),e&&(ue(),function(){if(T)return;var e=dashjs.MetricsReporting;if("function"==typeof e){var t=e(i).create();T=t.createMetricsReporting({debug:s,eventBus:a,mediaElement:ee(),adapter:I,dashMetrics:P,events:By.default,constants:cy.default,metricsConstants:hy.default})}}(),function(){if(A)return;var e=dashjs.MssHandler;"function"==typeof e&&(xy.default.extend(e.errors),A=e(i).create({eventBus:a,mediaPlayerModel:R,dashMetrics:P,manifestModel:L,playbackController:w,streamController:C,protectionController:y,baseURLController:N,errHandler:b,events:By.default,constants:cy.default,debug:s,initSegmentType:pe.HTTPRequest.INIT_SEGMENT_TYPE,BASE64:Vy.default,ISOBoxer:zy.default,settings:o}))}(),C&&C.switchToVideoElement()),h&&oe(),fe()}function ne(t){if(!g)throw e;var n=C.getActiveStreamInfo();return v.getTracksFor(t,n)}function re(e,t){var n=-1;e.some((function(e,r){if(e===t)return n=r,!0})),n<0||e.splice(n,1)}function ie(e){if(!c)throw"MediaPlayer not initialized!";"string"==typeof e&&B.initialize(e),d=e,(g||h)&&oe(),K()&&fe()}function ae(){if(!g)throw e;var t=C.getActiveStreamInfo();return t?C.getStreamById(t.id):null}function oe(){h=!1,g=!1,I.reset(),C.reset(),O.reset(),w.reset(),_.reset(),v.reset(),U.reset(),y&&(o.get().streaming.keepProtectionMediaKeys?y.stop():(y.reset(),y=null,ue())),F.reset()}function se(){return(0,yy.default)(i).create({debug:s,errHandler:b,dashMetrics:P,mediaPlayerModel:R,requestModifier:(0,Ry.default)(i).getInstance(),mssHandler:A,settings:o})}function ue(){if(y)return y;var e=dashjs.Protection;if("function"==typeof e){var t=e(i).create();return By.default.extend(e.events),ky.default.extend(e.events,{publicOnly:!0}),xy.default.extend(e.errors),M||(M=(0,Ay.default)(i).getInstance()),(y=t.createProtectionSystem({debug:s,errHandler:b,videoModel:x,capabilities:M,eventBus:a,events:By.default,BASE64:Vy.default,constants:cy.default,cmcdModel:F,settings:o}))&&(y.setLicenseRequestFilters(q),y.setLicenseResponseFilters(Y)),y}return null}function le(){if(!c)throw"MediaPlayer not initialized!";if(S)return S;var e=dashjs.OfflineController;if("function"==typeof e){By.default.extend(e.events),ky.default.extend(e.events,{publicOnly:!0}),xy.default.extend(e.errors);var t=se(),n=(0,Xy.default)(i).create();return n.setConfig({manifestModel:L,adapter:I,manifestLoader:t,errHandler:b}),S=e(i).create({debug:s,manifestUpdater:n,baseURLController:N,manifestLoader:t,manifestModel:L,mediaPlayerModel:R,abrController:_,playbackController:w,adapter:I,errHandler:b,dashMetrics:P,timelineConverter:E,schemeLoaderFactory:m,eventBus:a,events:By.default,errors:xy.default,constants:cy.default,settings:o,dashConstants:gy.default,urlUtils:(0,Qy.default)(i).getInstance()})}return null}function de(e){var t=P.getCurrentDVRInfo();return t?e+(t.manifestInfo.availableFrom.getTime()/1e3+t.range.start):0}function fe(){var e;S&&S.resetRecords(),!g&&d&&(g=!0,l.info("Streaming Initialized"),e=se(),C||(C=(0,_y.default)(i).getInstance()),D.setConfig({capabilities:M,adapter:I,settings:o}),D.setCustomCapabilitiesFilters(j),C.setConfig({capabilities:M,capabilitiesFilter:D,manifestLoader:e,manifestModel:L,mediaPlayerModel:R,protectionController:y,adapter:I,dashMetrics:P,errHandler:b,timelineConverter:E,videoModel:x,playbackController:w,abrController:_,mediaController:v,textController:U,settings:o,baseURLController:N}),O.setConfig({settings:o,playbackController:w,streamController:C,videoModel:x,timelineConverter:E,adapter:I}),w.setConfig({streamController:C,dashMetrics:P,mediaPlayerModel:R,adapter:I,videoModel:x,timelineConverter:E,uriFragmentModel:B,settings:o}),_.setConfig({streamController:C,domStorage:k,mediaPlayerModel:R,dashMetrics:P,adapter:I,videoModel:x,settings:o}),U.setConfig({errHandler:b,manifestModel:L,adapter:I,mediaController:v,streamController:C,videoModel:x}),F.setConfig({abrController:_,dashMetrics:P,playbackController:w}),C.initialize(p,f),O.initialize(),F.initialize(),"string"==typeof d?C.load(d):C.loadWithManifest(d)),!h&&K()&&(h=!0,l.info("Playback Initialized"))}return u={initialize:function(e,t,n){M||(M=(0,Ay.default)(i).getInstance()),b=(0,Ty.default)(i).getInstance(),M.supportsMediaSource()?c||(c=!0,E=(0,Ky.default)(i).getInstance(),_||(_=(0,Cy.default)(i).getInstance()).setConfig({settings:o}),m||(m=(0,Oy.default)(i).getInstance()),w||(w=(0,py.default)(i).getInstance()),v||(v=(0,Ey.default)(i).getInstance()),C||(C=(0,_y.default)(i).getInstance()),O||(O=(0,my.default)(i).getInstance()),D||(D=(0,Sy.default)(i).getInstance()),I=(0,jy.default)(i).getInstance(),L=(0,My.default)(i).getInstance(),F=(0,Py.default)(i).getInstance(),P=(0,Hy.default)(i).getInstance({settings:o}),U=(0,by.default)(i).getInstance(),k=(0,Ly.default)(i).getInstance({settings:o}),I.setConfig({constants:cy.default,cea608parser:fy.default,errHandler:b,BASE64:Vy.default}),N||(N=(0,vy.default)(i).create()),N.setConfig({adapter:I}),(G=(0,Yy.default)(i).getInstance({dashMetrics:P,mediaPlayerModel:R,errHandler:b,baseURLController:N,events:By.default,eventBus:a,debug:s,boxParser:(0,Zy.default)(i).getInstance(),requestModifier:(0,Ry.default)(i).getInstance(),errors:xy.default})).initialize(),v.setConfig({domStorage:k,settings:o}),$(),Z(void 0===n||n),le(),e&&te(e),t&&ie(t),l.info("[dash.js "+V()+"] MediaPlayer has been initialized")):b.error(new Wy.default(xy.default.CAPABILITY_MEDIASOURCE_ERROR_CODE,xy.default.CAPABILITY_MEDIASOURCE_ERROR_MESSAGE))},setConfig:function(e){e&&(e.capabilities&&(M=e.capabilities),e.capabilitiesFilter&&(D=e.capabilitiesFilter),e.streamController&&(C=e.streamController),e.gapController&&(O=e.gapController),e.playbackController&&(w=e.playbackController),e.mediaPlayerModel&&(R=e.mediaPlayerModel),e.abrController&&(_=e.abrController),e.schemeLoaderFactory&&(m=e.schemeLoaderFactory),e.mediaController&&(v=e.mediaController),e.settings&&(o=e.settings))},on:function(e,t,n,r){a.on(e,t,n,r)},off:function(e,t,n){a.off(e,t,n)},extend:function(e,t,n){Gy.default.extend(e,t,n,i)},attachView:te,attachSource:ie,isReady:K,preload:function(){if(x.getElement()||g)return!1;if(!d)throw r;fe()},play:function(){if(!h)throw t;(!p||z()&&h)&&w.play()},isPaused:z,pause:function(){if(!h)throw t;w.pause()},isSeeking:function(){if(!h)throw t;return w.isSeeking()},isDynamic:function(){if(!h)throw t;return w.getIsDynamic()},seek:function(e){if(!h)throw t;if((0,rt.checkParameterType)(e,"number"),isNaN(e))throw cy.default.BAD_ARGUMENT_ERROR;var n=w.getIsDynamic()?W(e):e;w.seek(n)},setPlaybackRate:function(e){ee().playbackRate=e},getPlaybackRate:function(){return ee().playbackRate},setMute:function(e){(0,rt.checkParameterType)(e,"boolean"),ee().muted=e},isMuted:function(){return ee().muted},setVolume:function(e){if("number"!=typeof e||isNaN(e)||e<0||e>1)throw cy.default.BAD_ARGUMENT_ERROR;ee().volume=e},getVolume:function(){return ee().volume},time:X,duration:Q,timeAsUTC:function(){if(!h)throw t;return X()<0?NaN:de(X())},durationAsUTC:function(){if(!h)throw t;return de(Q())},getActiveStream:ae,getDVRWindowSize:function(){var e=P.getCurrentDVRInfo();return e?e.manifestInfo.DVRWindowSize:0},getDVRSeekOffset:W,convertToTimeCode:function(e){e=Math.max(e,0);var t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%3600%60);return(0===t?"":t<10?"0"+t.toString()+":":t.toString()+":")+(n<10?"0"+n.toString():n.toString())+":"+(r<10?"0"+r.toString():r.toString())},formatUTC:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=new Date(1e3*e),a=i.toLocaleDateString(t),o=i.toLocaleTimeString(t,{hour12:n});return r?o+" "+a:o},getVersion:V,getDebug:function(){return s},getBufferLength:function(e){var t=[cy.default.VIDEO,cy.default.AUDIO,cy.default.FRAGMENTED_TEXT];if(e){if(-1!==t.indexOf(e)){var n=J().getCurrentBufferLevel(e);return n||NaN}return l.warn("getBufferLength requested for invalid type"),NaN}var r=t.map((function(e){return ne(e).length>0?J().getCurrentBufferLevel(e):Number.MAX_VALUE})).reduce((function(e,t){return Math.min(e,t)}));return r===Number.MAX_VALUE?NaN:r},getTTMLRenderingDiv:function(){return x?x.getTTMLRenderingDiv():null},getVideoElement:ee,getSource:function(){if(!d)throw r;return d},getCurrentLiveLatency:function(){if(!c)throw"MediaPlayer not initialized!";return h?w.getCurrentLiveLatency():NaN},getTopBitrateInfoFor:function(t){if(!g)throw e;return _.getTopBitrateInfoFor(t)},setAutoPlay:Z,getAutoPlay:function(){return p},getDashMetrics:J,getQualityFor:function(t){if(!g)throw e;if(t===cy.default.IMAGE){var n=ae();if(!n)return-1;var r=n.getThumbnailController();return r?r.getCurrentTrackIndex():-1}return _.getQualityFor(t)},setQualityFor:function(t,n){if(!g)throw e;if(t===cy.default.IMAGE){var r=ae();if(!r)return;var i=r.getThumbnailController();i&&i.setTrackByIndex(n)}_.setPlaybackQuality(t,C.getActiveStreamInfo(),n)},updatePortalSize:function(){_.setElementSize(),_.setWindowResizeEventCalled(!0)},setTextDefaultLanguage:function(e){l.warn('setTextDefaultLanguage is deprecated and will be removed in version 3.2.0. Please use setInitialMediaSettingsFor("fragmentedText", { lang: lang }) instead'),void 0===U&&(U=(0,by.default)(i).getInstance()),U.setTextDefaultLanguage(e)},getTextDefaultLanguage:function(){return l.warn('getTextDefaultLanguage is deprecated and will be removed in version 3.2.0. Please use getInitialMediaSettingsFor("fragmentedText").lang instead'),void 0===U&&(U=(0,by.default)(i).getInstance()),U.getTextDefaultLanguage()},setTextDefaultEnabled:function(e){void 0===U&&(U=(0,by.default)(i).getInstance()),U.setTextDefaultEnabled(e)},getTextDefaultEnabled:function(){return void 0===U&&(U=(0,by.default)(i).getInstance()),U.getTextDefaultEnabled()},enableText:function(e){void 0===U&&(U=(0,by.default)(i).getInstance()),U.enableText(e)},enableForcedTextStreaming:function(e){void 0===U&&(U=(0,by.default)(i).getInstance()),U.enableForcedTextStreaming(e)},isTextEnabled:function(){return void 0===U&&(U=(0,by.default)(i).getInstance()),U.isTextEnabled()},setTextTrack:function(e){if(!h)throw t;void 0===U&&(U=(0,by.default)(i).getInstance()),U.setTextTrack(e)},getBitrateInfoListFor:function(t){if(!g)throw e;var n=ae();return n?n.getBitrateListFor(t):[]},getStreamsFromManifest:function(t){if(!g)throw e;return I.getStreamsInfo(t)},getTracksFor:ne,getTracksForTypeFromManifest:function(t,n,r){if(!g)throw e;return(r=r||I.getStreamsInfo(n,1)[0])?I.getAllMediaInfoForType(r,t,n):[]},getCurrentTrackFor:function(t){if(!g)throw e;var n=C.getActiveStreamInfo();return v.getCurrentTrackFor(t,n)},setInitialMediaSettingsFor:function(e,t){if(!c)throw"MediaPlayer not initialized!";v.setInitialSettings(e,t),e===cy.default.FRAGMENTED_TEXT&&U.setInitialSettings(t)},getInitialMediaSettingsFor:function(e){if(!c)throw"MediaPlayer not initialized!";return v.getInitialSettings(e)},setCurrentTrack:function(t){if(!g)throw e;v.setTrack(t)},getTrackSwitchModeFor:function(e){if(!c)throw"MediaPlayer not initialized!";return v.getSwitchMode(e)},setTrackSwitchModeFor:function(e,t){if(!c)throw"MediaPlayer not initialized!";v.setSwitchMode(e,t)},setSelectionModeForInitialTrack:function(e){if(!c)throw"MediaPlayer not initialized!";v.setSelectionModeForInitialTrack(e)},getSelectionModeForInitialTrack:function(){if(!c)throw"MediaPlayer not initialized!";return v.getSelectionModeForInitialTrack()},addABRCustomRule:function(e,t,n){R.addABRCustomRule(e,t,n)},removeABRCustomRule:function(e){R.removeABRCustomRule(e)},removeAllABRCustomRule:function(){R.removeABRCustomRule()},getAverageThroughput:function(e){var t=_.getThroughputHistory();return t?t.getAverageThroughput(e):0},retrieveManifest:function(e,t){var n=se(),r=this;a.on(By.default.INTERNAL_MANIFEST_LOADED,(function e(i){i.error?t(null,i.error):t(i.manifest),a.off(By.default.INTERNAL_MANIFEST_LOADED,e,r),n.reset()}),r),B.initialize(e),n.load(e)},addUTCTimingSource:function(e,t){R.addUTCTimingSource(e,t)},removeUTCTimingSource:function(e,t){R.removeUTCTimingSource(e,t)},clearDefaultUTCTimingSources:function(){R.clearDefaultUTCTimingSources()},restoreDefaultUTCTimingSources:$,setXHRWithCredentialsForType:function(e,t){R.setXHRWithCredentialsForType(e,t)},getXHRWithCredentialsForType:function(e){return R.getXHRWithCredentialsForType(e)},getProtectionController:function(){return ue()},attachProtectionController:function(e){y=e},setProtectionData:function(e){f=e,C&&C.setProtectionData(f)},registerLicenseRequestFilter:function(e){q.push(e),y&&y.setLicenseRequestFilters(q)},registerLicenseResponseFilter:function(e){Y.push(e),y&&y.setLicenseResponseFilters(Y)},unregisterLicenseRequestFilter:function(e){re(q,e),y&&y.setLicenseRequestFilters(q)},unregisterLicenseResponseFilter:function(e){re(Y,e),y&&y.setLicenseResponseFilters(Y)},registerCustomCapabilitiesFilter:function(e){j.push(e),D&&D.setCustomCapabilitiesFilters(j)},unregisterCustomCapabilitiesFilter:function(e){re(j,e),D&&D.setCustomCapabilitiesFilters(j)},displayCaptionsOnTop:function(e){var t=(0,Iy.default)(i).getInstance();t.setConfig({videoModel:x}),t.initialize(),t.setDisplayCConTop(e)},attachTTMLRenderingDiv:function(e){if(!x.getElement())throw n;x.setTTMLRenderingDiv(e)},getCurrentTextTrackIndex:function(){var e=NaN;return U&&(e=U.getCurrentTrackIdx()),e},provideThumbnail:function(e,t){if("function"==typeof t)if(e<0)t(null);else{var n=w.getIsDynamic()?W(e):e,r=C.getStreamForTime(n);if(null!==r){var i=r.getThumbnailController();if(i){var a=C.getTimeRelativeToStreamId(n,r.getId());return i.provide(a,t)}t(null)}else t(null)}},getDashAdapter:function(){return I},getOfflineController:function(){return le()},getSettings:function(){return o.get()},updateSettings:function(e){o.update(e)},resetSettings:function(){o.reset()},reset:H,destroy:function(){H(),q=[],Y=[],j=[],Gy.default.deleteSingletonInstances(i)}},l=s.getLogger(u),c=!1,h=!1,g=!1,p=!0,y=null,S=null,f=null,I=null,G=null,By.default.extend(ky.default),R=(0,Dy.default)(i).getInstance(),x=(0,wy.default)(i).getInstance(),B=(0,Ny.default)(i).getInstance(),q=[],Y=[],j=[],u}Jy.__dashjs_factory_name="MediaPlayer";var eT=Gy.default.getClassFactory(Jy);eT.events=ky.default,eT.errors=xy.default,Gy.default.updateClassFactory(Jy.__dashjs_factory_name,eT);var tT=eT,nT=Object.defineProperty({default:tT},"__esModule",{value:!0}),rT=f((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Debug=t.FactoryMaker=t.MediaPlayer=void 0;var n=a(nT),r=a(S),i=a(ee);function a(e){return e&&e.__esModule?e:{default:e}}var o="undefined"!=typeof window&&window||d,s=o.dashjs;s||(s=o.dashjs={}),s.MediaPlayer=n.default,s.FactoryMaker=r.default,s.Debug=i.default,s.Version=(0,jm.getVersionString)(),t.default=s,t.MediaPlayer=n.default,t.FactoryMaker=r.default,t.Debug=i.default}));var iT=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.mpdurl=null,this.errorcode=null,this.terror=null,this.url=null,this.ipaddress=null,this.servicelocation=null};iT.SSL_CONNECTION_FAILED_PREFIX="SSL",iT.DNS_RESOLUTION_FAILED="C00",iT.HOST_UNREACHABLE="C01",iT.CONNECTION_REFUSED="C02",iT.CONNECTION_ERROR="C03",iT.CORRUPT_MEDIA_ISOBMFF="M00",iT.CORRUPT_MEDIA_OTHER="M01",iT.BASE_URL_CHANGED="F00",iT.BECAME_REPORTER="S00";var aT=iT,oT=uT(Object.defineProperty({default:aT},"__esModule",{value:!0})),sT=uT(Cl);function uT(e){return e&&e.__esModule?e:{default:e}}function lT(e){var t=void 0,n=void 0,r=(e=e||{}).eventBus,i=e.dashMetrics,a=e.metricsConstants,o=e.events;function s(e){var t=new oT.default;if(n){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);t.mpdurl||(t.mpdurl=n.originalUrl||n.url),t.terror||(t.terror=new Date),i.addDVBErrors(t)}}function u(e){e.error||(n=e.manifest)}function l(e){s({errorcode:oT.default.BASE_URL_CHANGED,servicelocation:e.entry})}function d(){s({errorcode:oT.default.BECAME_REPORTER})}function f(e){switch(e.metric){case a.HTTP_REQUEST:(0===(t=e.value).responsecode||t.responsecode>=400||t.responsecode<100||t.responsecode>=600)&&s({errorcode:t.responsecode||oT.default.CONNECTION_ERROR,url:t.url,terror:t.tresponse,servicelocation:t._serviceLocation})}var t}function c(e){var t=void 0;switch(e.error?e.error.code:0){case MediaError.MEDIA_ERR_NETWORK:t=oT.default.CONNECTION_ERROR;break;case MediaError.MEDIA_ERR_DECODE:t=oT.default.CORRUPT_MEDIA_OTHER;break;default:return}s({errorcode:t})}function g(){r.on(o.MANIFEST_UPDATED,u,t),r.on(o.SERVICE_LOCATION_BLACKLIST_CHANGED,l,t),r.on(o.METRIC_ADDED,f,t),r.on(o.METRIC_UPDATED,f,t),r.on(o.PLAYBACK_ERROR,c,t),r.on(sT.default.BECAME_REPORTING_PLAYER,d,t)}return t={initialise:g,reset:function(){r.off(o.MANIFEST_UPDATED,u,t),r.off(o.SERVICE_LOCATION_BLACKLIST_CHANGED,l,t),r.off(o.METRIC_ADDED,f,t),r.off(o.METRIC_UPDATED,f,t),r.off(o.PLAYBACK_ERROR,c,t),r.off(sT.default.BECAME_REPORTING_PLAYER,d,t)}},g(),t}lT.__dashjs_factory_name="DVBErrorsTranslator";var dT=dashjs.FactoryMaker.getSingletonFactory(lT),fT=Object.defineProperty({default:dT},"__esModule",{value:!0}),cT=function(e){return e&&e.__esModule?e:{default:e}}(st);function gT(e){e=e||{};var t,n=!1,r=this.context,i=void 0,a=e.mediaElement;return t={initialize:function(e){e&&e.length&&(e.forEach((function(e){var t=e.starttime,n=t+e.duration;i.add(t,n)})),n=!!e[0]._useWallClockTime)},reset:function(){i.clear()},isEnabled:function(){var e,t=i.length;if(!t)return!0;e=n?(new Date).getTime()/1e3:a.currentTime;for(var r=0;r<t;r+=1){var o=i.start(r),s=i.end(r);if(o<=e&&e<s)return!0}return!1}},i=(0,cT.default)(r).create(),t}gT.__dashjs_factory_name="RangeController";var hT=dashjs.FactoryMaker.getClassFactory(gT),pT=Object.defineProperty({default:hT},"__esModule",{value:!0});function _T(){return{serialise:function e(t){var n=[],r=[],i=void 0,a=void 0;for(i in t)if(t.hasOwnProperty(i)&&0!==i.indexOf("_")){if(null==(a=t[i])&&(a=""),Array.isArray(a)){if(!a.length)continue;r=[],a.forEach((function(t){var n="Object"!==Object.prototype.toString.call(t).slice(8,-1);r.push(n?t:e(t))})),a=r.map(encodeURIComponent).join(",")}else"string"==typeof a?a=encodeURIComponent(a):a instanceof Date?a=a.toISOString():"number"==typeof a&&(a=Math.round(a));n.push(i+"="+a)}return n.join("&")}}}_T.__dashjs_factory_name="MetricSerialiser";var mT=dashjs.FactoryMaker.getSingletonFactory(_T),ET=Object.defineProperty({default:mT},"__esModule",{value:!0});function vT(){var e,t=window.crypto||window.msCrypto,n=Uint32Array,r=Math.pow(2,8*n.BYTES_PER_ELEMENT)-1,i=void 0,a=void 0;function o(){t&&(i||(i=new n(10)),t.getRandomValues(i),a=0)}return e={random:function(e,n){var s=void 0;return e||(e=0),n||(n=1),t?(a===i.length&&o(),s=i[a]/r,a+=1):s=Math.random(),s*(n-e)+e}},o(),e}vT.__dashjs_factory_name="RNG";var yT=dashjs.FactoryMaker.getSingletonFactory(vT),TT=Object.defineProperty({default:yT},"__esModule",{value:!0}),AT=IT(ET),ST=IT(TT);function IT(e){return e&&e.__esModule?e:{default:e}}function RT(e){e=e||{};var t,n=this.context,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,u=void 0,l=[],d=e.metricsConstants;function f(){a=!1,o=!1,s=null,u=null}return t={report:function(e,t){Array.isArray(t)||(t=[t]),o&&u.isEnabled()&&t.forEach((function(t){var n=r.serialise(t);e!==d.DVB_ERRORS&&(n="metricname="+e+"&"+n),function(e,t,n){var r=new XMLHttpRequest,i=function(){var e=l.indexOf(r);-1!==e&&(l.splice(e,1),r.status>=200&&r.status<300?t&&t():n&&n())};l.push(r);try{r.open("GET",e),r.onloadend=i,r.onerror=i,r.send()}catch(e){r.onerror()}}(n=s+"?"+n,null,(function(){o=!1}))}))},initialize:function(e,t){var n=void 0;if(u=t,!(s=e.dvb_reportingUrl))throw new Error("required parameter missing (dvb:reportingUrl)");a||((n=e.dvb_probability)&&(1e3===n||n/1e3>=i.random())&&(o=!0),a=!0)},reset:function(){f()}},r=(0,AT.default)(n).getInstance(),i=(0,ST.default)(n).getInstance(),f(),t}RT.__dashjs_factory_name="DVBReporting";var bT=dashjs.FactoryMaker.getClassFactory(RT),NT=function(e){return e&&e.__esModule?e:{default:e}}(Object.defineProperty({default:bT},"__esModule",{value:!0}));function MT(e){e=e||{};var t={"urn:dvb:dash:reporting:2014":NT.default},n=this.context,r=void 0,i=e.debug?e.debug.getLogger(r):{},a=e.metricsConstants;return r={create:function(e,r){var o=void 0;try{(o=t[e.schemeIdUri](n).create({metricsConstants:a})).initialize(e,r)}catch(t){o=null,i.error("ReportingFactory: could not create Reporting with schemeIdUri "+e.schemeIdUri+" ("+t.message+")")}return o},register:function(e,n){t[e]=n},unregister:function(e){delete t[e]}}}MT.__dashjs_factory_name="ReportingFactory";var DT=dashjs.FactoryMaker.getSingletonFactory(MT),CT=Object.defineProperty({default:DT},"__esModule",{value:!0}),OT=function(e){return e&&e.__esModule?e:{default:e}}(CT);function wT(e){var t=[],n=(0,OT.default)(this.context).getInstance(e);return{initialize:function(e,r){e.some((function(e){var i=n.create(e,r);if(i)return t.push(i),!0}))},reset:function(){t.forEach((function(e){return e.reset()})),t=[]},report:function(e,n){t.forEach((function(t){return t.report(e,n)}))}}}wT.__dashjs_factory_name="ReportingController";var PT=dashjs.FactoryMaker.getClassFactory(wT),LT=Object.defineProperty({default:PT},"__esModule",{value:!0});function FT(){return{reconstructFullMetricName:function(e,t,n){var r=e;return t&&(r+="("+t,n&&n.length&&(r+=","+n),r+=")"),r},validateN:function(e){if(!e)throw new Error("missing n");if(isNaN(e))throw new Error("n is NaN");if(e<0)throw new Error("n must be positive");return e}}}FT.__dashjs_factory_name="HandlerHelpers";var xT=dashjs.FactoryMaker.getSingletonFactory(FT),UT=Object.defineProperty({default:xT},"__esModule",{value:!0}),BT=function(e){return e&&e.__esModule?e:{default:e}}(UT);function kT(e){e=e||{};var t=void 0,n=void 0,r=void 0,i=void 0,a=void 0,o=this.context,s=(0,BT.default)(o).getInstance(),u=[],l=e.metricsConstants;function d(){var e=function(){try{return Object.keys(u).map((function(e){return u[e]})).reduce((function(e,t){return e.level<t.level?e:t}))}catch(e){return}}();e&&a!==e.t&&(a=e.t,t.report(r,e))}return{initialize:function(e,a,o){a&&(n=s.validateN(o),t=a,r=s.reconstructFullMetricName(e,o),i=setInterval(d,n))},reset:function(){clearInterval(i),i=null,n=0,t=null,a=null},handleNewMetric:function(e,t,n){e===l.BUFFER_LEVEL&&(u[n]=t)}}}kT.__dashjs_factory_name="BufferLevelHandler";var GT=dashjs.FactoryMaker.getClassFactory(kT),qT=Object.defineProperty({default:GT},"__esModule",{value:!0}),YT=function(e){return e&&e.__esModule?e:{default:e}}(Cl);var jT=dashjs.FactoryMaker.getClassFactory((function(e){var t=void 0,n=(e=e||{}).eventBus,r=e.metricsConstants;function i(){n.off(YT.default.METRICS_INITIALISATION_COMPLETE,i,this),n.trigger(YT.default.BECAME_REPORTING_PLAYER)}return{initialize:function(e,r){r&&(t=r,n.on(YT.default.METRICS_INITIALISATION_COMPLETE,i,this))},reset:function(){t=null},handleNewMetric:function(e,n){e===r.DVB_ERRORS&&t&&t.report(e,n)}}})),HT=Object.defineProperty({default:jT},"__esModule",{value:!0}),KT=function(e){return e&&e.__esModule?e:{default:e}}(UT);function VT(e){e=e||{};var t=void 0,n=void 0,r=void 0,i=void 0,a=void 0,o=[],s=(0,KT.default)(this.context).getInstance(),u=e.metricsConstants;function l(){var e=o;e.length&&t&&t.report(i,e),o=[]}return{initialize:function(e,o,u,d){o&&(n=s.validateN(u),t=o,d&&d.length&&(r=d),i=s.reconstructFullMetricName(e,u,d),a=setInterval(l,n))},reset:function(){clearInterval(a),a=null,n=null,r=null,o=[],t=null},handleNewMetric:function(e,t){e===u.HTTP_REQUEST&&(r&&r!==t.type||o.push(t))}}}VT.__dashjs_factory_name="HttpListHandler";var zT=dashjs.FactoryMaker.getClassFactory(VT),WT=Object.defineProperty({default:zT},"__esModule",{value:!0});function XT(){var e=void 0,t=void 0;return{initialize:function(n,r){e=n,t=r},reset:function(){t=null,e=void 0},handleNewMetric:function(n,r){n===e&&t&&t.report(e,r)}}}XT.__dashjs_factory_name="GenericMetricHandler";var QT=dashjs.FactoryMaker.getClassFactory(XT),ZT=Object.defineProperty({default:QT},"__esModule",{value:!0}),$T=nA(qT),JT=nA(HT),eA=nA(WT),tA=nA(ZT);function nA(e){return e&&e.__esModule?e:{default:e}}function rA(e){var t=void 0,n=(e=e||{}).debug?e.debug.getLogger(t):{},r=/([a-zA-Z]*)(\(([0-9]*)(\,\s*([a-zA-Z]*))?\))?/,i=this.context,a={BufferLevel:$T.default,DVBErrors:JT.default,HttpList:eA.default,PlayList:tA.default,RepSwitchList:tA.default,TcpList:tA.default};return t={create:function(t,o){var s,u=t.match(r);if(u){try{(s=a[u[1]](i).create({eventBus:e.eventBus,metricsConstants:e.metricsConstants})).initialize(u[1],o,u[3],u[5])}catch(e){s=null,n.error("MetricsHandlerFactory: Could not create handler for type "+u[1]+" with args "+u[3]+", "+u[5]+" ("+e.message+")")}return s}},register:function(e,t){a[e]=t},unregister:function(e){delete a[e]}}}rA.__dashjs_factory_name="MetricsHandlerFactory";var iA=dashjs.FactoryMaker.getSingletonFactory(rA),aA=Object.defineProperty({default:iA},"__esModule",{value:!0}),oA=function(e){return e&&e.__esModule?e:{default:e}}(aA);function sA(e){e=e||{};var t=[],n=void 0,r=this.context,i=e.eventBus,a=e.events,o=(0,oA.default)(r).getInstance({debug:e.debug,eventBus:e.eventBus,metricsConstants:e.metricsConstants});function s(e){t.forEach((function(t){t.handleNewMetric(e.metric,e.value,e.mediaType)}))}return n={initialize:function(e,r){e.split(",").forEach((function(e,n,i){var a;if(-1!==e.indexOf("(")&&-1===e.indexOf(")")){var s=i[n+1];s&&-1===s.indexOf("(")&&-1!==s.indexOf(")")&&(e+=","+s,delete i[n+1])}(a=o.create(e,r))&&t.push(a)})),i.on(a.METRIC_ADDED,s,n),i.on(a.METRIC_UPDATED,s,n)},reset:function(){i.off(a.METRIC_ADDED,s,n),i.off(a.METRIC_UPDATED,s,n),t.forEach((function(e){return e.reset()})),t=[]}}}sA.__dashjs_factory_name="MetricsHandlersController";var uA=dashjs.FactoryMaker.getClassFactory(sA),lA=Object.defineProperty({default:uA},"__esModule",{value:!0}),dA=gA(pT),fA=gA(LT),cA=gA(lA);function gA(e){return e&&e.__esModule?e:{default:e}}function hA(e){e=e||{};var t=void 0,n=void 0,r=void 0,i=this.context;function a(){t&&t.reset(),n&&n.reset(),r&&r.reset()}return{initialize:function(o){try{(r=(0,dA.default)(i).create({mediaElement:e.mediaElement})).initialize(o.Range),(n=(0,fA.default)(i).create({debug:e.debug,metricsConstants:e.metricsConstants})).initialize(o.Reporting,r),(t=(0,cA.default)(i).create({debug:e.debug,eventBus:e.eventBus,metricsConstants:e.metricsConstants,events:e.events})).initialize(o.metrics,n)}catch(e){throw a(),e}},reset:a}}hA.__dashjs_factory_name="MetricsController";var pA=dashjs.FactoryMaker.getClassFactory(hA),_A=Object.defineProperty({default:pA},"__esModule",{value:!0});var mA=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.metrics="",this.Range=[],this.Reporting=[]},EA=Object.defineProperty({default:mA},"__esModule",{value:!0});var vA=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.starttime=0,this.duration=1/0,this._useWallClockTime=!1},yA=Object.defineProperty({default:vA},"__esModule",{value:!0});var TA=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.schemeIdUri="",this.value="",this.dvb_reportingUrl="",this.dvb_probability=1e3},AA=Object.defineProperty({default:TA},"__esModule",{value:!0}),SA=bA(EA),IA=bA(yA),RA=bA(AA);function bA(e){return e&&e.__esModule?e:{default:e}}function NA(e){var t=(e=e||{}).adapter,n=e.constants;return{getMetrics:function(e){var r=[];return e&&e.Metrics_asArray&&e.Metrics_asArray.forEach((function(i){var a=new SA.default,o=t.getIsDynamic(e);i.hasOwnProperty("metrics")&&(a.metrics=i.metrics,i.Range_asArray&&i.Range_asArray.forEach((function(r){var i=new IA.default;i.starttime=function(e,r,i){var a=void 0,o=void 0,s=0;return r?s=t.getAvailabilityStartTime(e)/1e3:(a=t.getRegularPeriods(e)).length&&(s=a[0].start),o=s,i&&i.hasOwnProperty(n.START_TIME)&&(o+=i.starttime),o}(e,o,r),r.hasOwnProperty("duration")?i.duration=r.duration:i.duration=t.getDuration(e),i._useWallClockTime=o,a.Range.push(i)})),i.Reporting_asArray&&(i.Reporting_asArray.forEach((function(e){var t=new RA.default;e.hasOwnProperty(n.SCHEME_ID_URI)&&(t.schemeIdUri=e.schemeIdUri,e.hasOwnProperty("value")&&(t.value=e.value),e.hasOwnProperty(n.DVB_REPORTING_URL)&&(t.dvb_reportingUrl=e[n.DVB_REPORTING_URL]),e.hasOwnProperty(n.DVB_PROBABILITY)&&(t.dvb_probability=e[n.DVB_PROBABILITY]),a.Reporting.push(t))})),r.push(a)))})),r}}}NA.__dashjs_factory_name="ManifestParsing";var MA=dashjs.FactoryMaker.getSingletonFactory(NA),DA=Object.defineProperty({default:MA},"__esModule",{value:!0}),CA=PA(_A),OA=PA(DA),wA=PA(Cl);function PA(e){return e&&e.__esModule?e:{default:e}}function LA(e){e=e||{};var t=void 0,n={},r=this.context,i=e.eventBus,a=e.events;function o(t){if(!t.error){var a=Object.keys(n);(0,OA.default)(r).getInstance({adapter:e.adapter,constants:e.constants}).getMetrics(t.manifest).forEach((function(t){var i=JSON.stringify(t);if(n.hasOwnProperty(i))a.splice(i,1);else try{var o=(0,CA.default)(r).create(e);o.initialize(t),n[i]=o}catch(e){}})),a.forEach((function(e){n[e].reset(),delete n[e]})),i.trigger(wA.default.METRICS_INITIALISATION_COMPLETE)}}function s(){Object.keys(n).forEach((function(e){n[e].reset()})),n={}}return t={reset:function(){i.off(a.MANIFEST_UPDATED,o,t),i.off(a.STREAM_TEARDOWN_COMPLETE,s,t)}},i.on(a.MANIFEST_UPDATED,o,t),i.on(a.STREAM_TEARDOWN_COMPLETE,s,t),t}LA.__dashjs_factory_name="MetricsCollectionController";var FA=dashjs.FactoryMaker.getClassFactory(LA),xA=Object.defineProperty({default:FA},"__esModule",{value:!0}),UA=YA(fT),BA=YA(Cl),kA=YA(xA),GA=YA(aA),qA=YA(CT);function YA(e){return e&&e.__esModule?e:{default:e}}function jA(){var e=this.context;return{createMetricsReporting:function(t){return(0,UA.default)(e).getInstance({eventBus:t.eventBus,dashMetrics:t.dashMetrics,metricsConstants:t.metricsConstants,events:t.events}),(0,kA.default)(e).create(t)},getReportingFactory:function(){return(0,qA.default)(e).getInstance()},getMetricsHandlerFactory:function(){return(0,GA.default)(e).getInstance()}}}jA.__dashjs_factory_name="MetricsReporting";var HA=dashjs.FactoryMaker.getClassFactory(jA);HA.events=BA.default,dashjs.FactoryMaker.updateClassFactory(jA.__dashjs_factory_name,HA);var KA=HA,VA=Object.defineProperty({default:KA},"__esModule",{value:!0}),zA=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var WA=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return zA(e,null,[{key:"findCencContentProtection",value:function(e){for(var t=null,n=0;n<e.length;++n){var r=e[n];"urn:mpeg:dash:mp4protection:2011"!==r.schemeIdUri.toLowerCase()||"cenc"!==r.value.toLowerCase()&&"cbcs"!==r.value.toLowerCase()||(t=r)}return t}},{key:"getPSSHData",value:function(e){var t=8,n=new DataView(e),r=n.getUint8(t);return t+=20,r>0&&(t+=4+16*n.getUint32(t)),t+=4,e.slice(t)}},{key:"getPSSHForKeySystem",value:function(t,n){var r=e.parsePSSHList(n);return t&&r.hasOwnProperty(t.uuid.toLowerCase())?r[t.uuid.toLowerCase()]:null}},{key:"parseInitDataFromContentProtection",value:function(e,t){return"pssh"in e?(e.pssh.__text=e.pssh.__text.replace(/\r?\n|\r/g,"").replace(/\s+/g,""),t.decodeArray(e.pssh.__text).buffer):null}},{key:"parsePSSHList",value:function(e){if(null==e)return[];for(var t=new DataView(e.buffer||e),n={},r=0;;){var i,a,o=void 0,s=r;if(r>=t.buffer.byteLength)break;if(i=r+t.getUint32(r),r+=4,1886614376===t.getUint32(r))if(r+=4,0===(a=t.getUint8(r))||1===a){r++,r+=3,o="";var u=void 0,l=void 0;for(u=0;u<4;u++)o+=1===(l=t.getUint8(r+u).toString(16)).length?"0"+l:l;for(r+=4,o+="-",u=0;u<2;u++)o+=1===(l=t.getUint8(r+u).toString(16)).length?"0"+l:l;for(r+=2,o+="-",u=0;u<2;u++)o+=1===(l=t.getUint8(r+u).toString(16)).length?"0"+l:l;for(r+=2,o+="-",u=0;u<2;u++)o+=1===(l=t.getUint8(r+u).toString(16)).length?"0"+l:l;for(r+=2,o+="-",u=0;u<6;u++)o+=1===(l=t.getUint8(r+u).toString(16)).length?"0"+l:l;r+=6,o=o.toLowerCase(),t.getUint32(r),r+=4,n[o]=t.buffer.slice(s,i),r=i}else r=i;else r=i}return n}}]),e}(),XA=Object.defineProperty({default:WA},"__esModule",{value:!0});var QA=function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.contentType=t,this.robustness=n},ZA=Object.defineProperty({default:QA},"__esModule",{value:!0});var $A=function e(t,n,r,i,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.initDataTypes=["cenc"],t&&t.length&&(this.audioCapabilities=t),n&&n.length&&(this.videoCapabilities=n),this.distinctiveIdentifier=r,this.persistentState=i,this.sessionTypes=a},JA=Object.defineProperty({default:$A},"__esModule",{value:!0});var eS=new(function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.MEDIA_KEYERR_CODE=100,e.MEDIA_KEYERR_UNKNOWN_CODE=101,e.MEDIA_KEYERR_CLIENT_CODE=102,e.MEDIA_KEYERR_SERVICE_CODE=103,e.MEDIA_KEYERR_OUTPUT_CODE=104,e.MEDIA_KEYERR_HARDWARECHANGE_CODE=105,e.MEDIA_KEYERR_DOMAIN_CODE=106,e.MEDIA_KEY_MESSAGE_ERROR_CODE=107,e.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_CODE=108,e.SERVER_CERTIFICATE_UPDATED_ERROR_CODE=109,e.KEY_STATUS_CHANGED_EXPIRED_ERROR_CODE=110,e.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_CODE=111,e.KEY_SYSTEM_ACCESS_DENIED_ERROR_CODE=112,e.KEY_SESSION_CREATED_ERROR_CODE=113,e.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE=114,e.MEDIA_KEYERR_UNKNOWN_MESSAGE="An unspecified error occurred. This value is used for errors that don't match any of the other codes.",e.MEDIA_KEYERR_CLIENT_MESSAGE="The Key System could not be installed or updated.",e.MEDIA_KEYERR_SERVICE_MESSAGE="The message passed into update indicated an error from the license service.",e.MEDIA_KEYERR_OUTPUT_MESSAGE="There is no available output device with the required characteristics for the content protection system.",e.MEDIA_KEYERR_HARDWARECHANGE_MESSAGE="A hardware configuration change caused a content protection error.",e.MEDIA_KEYERR_DOMAIN_MESSAGE="An error occurred in a multi-device domain licensing configuration. The most common error is a failure to join the domain.",e.MEDIA_KEY_MESSAGE_ERROR_MESSAGE="Multiple key sessions were creates with a user-agent that does not support sessionIDs!! Unpredictable behavior ahead!",e.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_MESSAGE="DRM: Empty key message from CDM",e.SERVER_CERTIFICATE_UPDATED_ERROR_MESSAGE="Error updating server certificate -- ",e.KEY_STATUS_CHANGED_EXPIRED_ERROR_MESSAGE="DRM: KeyStatusChange error! -- License has expired",e.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_MESSAGE="DRM: No license server URL specified!",e.KEY_SYSTEM_ACCESS_DENIED_ERROR_MESSAGE="DRM: KeySystem Access Denied! -- ",e.KEY_SESSION_CREATED_ERROR_MESSAGE="DRM: unable to create session! --",e.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE="DRM: licenser error! --",e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(function(e){return e&&e.__esModule?e:{default:e}}(xt).default)),tS=Object.defineProperty({default:eS},"__esModule",{value:!0});var nS=function e(t,n,r,i,a,o,s,u){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.url=t,this.method=n,this.responseType=r,this.headers=i,this.withCredentials=a,this.messageType=o,this.sessionId=s,this.data=u},rS=Object.defineProperty({default:nS},"__esModule",{value:!0});var iS=function e(t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.url=t,this.headers=n,this.data=r},aS=Object.defineProperty({default:iS},"__esModule",{value:!0}),oS="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},sS=_S(XA),uS=_S(ZA),lS=_S(JA),dS=_S(tS),fS=_S(Me),cS=_S(rS),gS=_S(aS),hS=_S(fl),pS=_S(p);function _S(e){return e&&e.__esModule?e:{default:e}}function mS(e){var t=(e=e||{}).protectionKeyController,n=e.protectionModel,r=e.eventBus,i=e.events,a=e.debug,o=e.BASE64,s=e.constants,u=[],l=e.cmcdModel,d=e.settings,f=void 0,c=void 0,g=void 0,h=void 0,p=void 0,_=void 0,m=void 0,E=void 0,v=void 0,y=void 0;function T(){if(!(r&&r.hasOwnProperty("on")&&t&&t.hasOwnProperty("getSupportedKeySystemsFromContentProtection")))throw new Error("Missing config parameter(s)")}function A(e,t){var a=sS.default.getPSSHForKeySystem(E,e),o=b(E);if(a){if(S(a))return;try{n.createKeySession(a,o,M(E),t)}catch(e){r.trigger(i.KEY_SESSION_CREATED,{data:null,error:new fS.default(dS.default.KEY_SESSION_CREATED_ERROR_CODE,dS.default.KEY_SESSION_CREATED_ERROR_MESSAGE+e.message)})}}else e?n.createKeySession(e,o,M(E),t):r.trigger(i.KEY_SESSION_CREATED,{data:null,error:new fS.default(dS.default.KEY_SESSION_CREATED_ERROR_CODE,dS.default.KEY_SESSION_CREATED_ERROR_MESSAGE+"Selected key system is "+(E?E.systemString:null)+". needkey/encrypted event contains no initData corresponding to that key system!")})}function S(e){if(!e)return!1;try{for(var r=n.getAllInitData(),i=0;i<r.length;i++)if(t.initDataEquals(e,r[i]))return c.debug("DRM: Ignoring initData because we have already seen it!"),!0;return!1}catch(e){return!1}}function I(e,t){T(),n.loadKeySession(e,t,M(E))}function R(e){T(),e?(n.setMediaElement(e),r.on(i.NEED_KEY,P,this)):null===e&&(n.setMediaElement(e),r.off(i.NEED_KEY,P,this))}function b(e){var t=null;if(e){var n=e.systemString;p&&(t=n in p?p[n]:null)}return t}function N(e){var t=b(e),n=[],r=[],i=t&&t.audioRobustness&&t.audioRobustness.length>0?t.audioRobustness:m,a=t&&t.videoRobustness&&t.videoRobustness.length>0?t.videoRobustness:m,o=M(e),u=t&&t.distinctiveIdentifier?t.distinctiveIdentifier:"optional",l=t&&t.persistentState?t.persistentState:"temporary"===o?"optional":"required";return h.forEach((function(e){e.type===s.AUDIO?n.push(new uS.default(e.codec,i)):e.type===s.VIDEO&&r.push(new uS.default(e.codec,a))})),new lS.default(n,r,u,l,[o])}function M(e){var t=b(e);return t&&t.sessionType?t.sessionType:_}function D(e,a){e=e.sort((function(t,n){return(p&&p[t.ks.systemString]&&p[t.ks.systemString].priority>=0?p[t.ks.systemString].priority:e.length)-(p&&p[n.ks.systemString]&&p[n.ks.systemString].priority>=0?p[n.ks.systemString].priority:e.length)})),void 0===E?function(e,a){var s=this,u=[],l=void 0;E=null,g.push(e);for(var d=0;d<e.length;d++)u.push({ks:e[d].ks,configs:[N(e[d].ks)]});var f=void 0,h=function e(t){r.off(i.KEY_SYSTEM_ACCESS_COMPLETE,e,s),t.error?(E=void 0,r.off(i.INTERNAL_KEY_SYSTEM_SELECTED,p,s),a||r.trigger(i.KEY_SYSTEM_SELECTED,{data:null,error:new fS.default(dS.default.KEY_SYSTEM_ACCESS_DENIED_ERROR_CODE,dS.default.KEY_SYSTEM_ACCESS_DENIED_ERROR_MESSAGE+t.error)})):(f=t.data,c.info("DRM: KeySystem Access Granted ("+f.keySystem.systemString+")! Selecting key system..."),n.selectKeySystem(f))},p=function e(u){if(r.off(i.INTERNAL_KEY_SYSTEM_SELECTED,e,s),r.off(i.KEY_SYSTEM_ACCESS_COMPLETE,h,s),u.error)E=void 0,a||r.trigger(i.KEY_SYSTEM_SELECTED,{data:null,error:new fS.default(dS.default.KEY_SYSTEM_ACCESS_DENIED_ERROR_CODE,dS.default.KEY_SYSTEM_ACCESS_DENIED_ERROR_MESSAGE+"Error selecting key system! -- "+u.error)});else{if(!n)return;E=n.getKeySystem(),r.trigger(i.KEY_SYSTEM_SELECTED,{data:f});var d=b(E);d&&d.serverCertificate&&d.serverCertificate.length>0&&n.setServerCertificate(o.decodeArray(d.serverCertificate).buffer);for(var c=0;c<g.length;c++)for(l=0;l<g[c].length;l++)if(E===g[c][l].ks){if(t.isClearKey(E)&&d&&d.hasOwnProperty("clearkeys")){var p={kids:Object.keys(d.clearkeys)};g[c][l].initData=(new TextEncoder).encode(JSON.stringify(p))}g[c][l].sessionId?I(g[c][l].sessionId,g[c][l].initData):null!==g[c][l].initData&&A(g[c][l].initData,g[c][l].cdmData);break}}};r.on(i.INTERNAL_KEY_SYSTEM_SELECTED,p,s),r.on(i.KEY_SYSTEM_ACCESS_COMPLETE,h,s),n.requestKeySystemAccess(u)}(e,a):E?function(e,a){var o=this,s=[],u=e.findIndex((function(e){return e.ks===E}));if(-1===u||!e[u].initData)return;if(S(sS.default.getPSSHForKeySystem(E,e[u].initData)))return;s.push({ks:e[u].ks,configs:[N(E)]});r.on(i.KEY_SYSTEM_ACCESS_COMPLETE,(function n(s){if(r.off(i.KEY_SYSTEM_ACCESS_COMPLETE,n,o),s.error)a||r.trigger(i.KEY_SYSTEM_SELECTED,{error:new fS.default(dS.default.KEY_SYSTEM_ACCESS_DENIED_ERROR_CODE,dS.default.KEY_SYSTEM_ACCESS_DENIED_ERROR_MESSAGE+s.error)});else{c.info("DRM: KeySystem Access Granted"),r.trigger(i.KEY_SYSTEM_SELECTED,{data:s.data});var l=b(E);if(t.isClearKey(E)&&l&&l.hasOwnProperty("clearkeys")){var d={kids:Object.keys(l.clearkeys)};e[u].initData=(new TextEncoder).encode(JSON.stringify(d))}e[u].sessionId?I(e[u].sessionId,e[u].initData):e[u].initData&&A(e[u].initData,e[u].cdmData)}}),o),n.requestKeySystemAccess(s)}(e,a):g.push(e)}function C(e,t){r.trigger(i.LICENSE_REQUEST_COMPLETE,{data:e,error:t})}function O(e){e.error?r.trigger(i.KEY_STATUSES_CHANGED,{data:null,error:e.error}):c.debug("DRM: key status = "+e.status)}function w(e){c.debug("DRM: onKeyMessage");var a=e.data;r.trigger(i.KEY_MESSAGE,{data:a});var o=a.messageType?a.messageType:"license-request",s=a.message,u=a.sessionToken,f=b(E),g=E?E.systemString:null,p=t.getLicenseServer(E,f,o),_={sessionToken:u,messageType:o};if(s&&0!==s.byteLength){if(!p)return c.debug("DRM: License server request not required for this message (type = "+e.data.messageType+"). Session ID = "+u.getSessionID()),void C(_);if(t.isClearKey(E)){var m=t.processClearKeyLicenseRequest(E,f,s);if(m)return c.debug("DRM: ClearKey license request handled by application!"),C(_),void n.updateKeySession(u,m)}var T=null;if(f&&f.serverURL){var A=f.serverURL;"string"==typeof A&&""!==A?T=A:"object"===(void 0===A?"undefined":oS(A))&&A.hasOwnProperty(o)&&(T=A[o])}else if(f&&f.laURL&&""!==f.laURL)T=f.laURL;else if(t.isClearKey(E))T=E.getLicenseServerUrlFromMediaInfo(h);else{var S=sS.default.getPSSHData(u.initData);(T=E.getLicenseServerURLFromInitData(S))||(T=e.data.laURL)}if(T=p.getServerURLFromMessage(T,s,o)){var I={},R=!1,N=function(e){if(e)for(var t in e)"authorization"===t.toLowerCase()&&(R=!0),I[t]=e[t]};f&&N(f.httpRequestHeaders),N(E.getRequestHeadersFromMessage(s)),f&&"boolean"==typeof f.withCredentials&&(R=f.withCredentials);var M=function(e,t,n,r){var i=e.response?p.getErrorResponse(e.response,n,r):"NONE";C(t,new fS.default(dS.default.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,dS.default.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE+n+' update, XHR complete. status is "'+e.statusText+'" ('+e.status+"), readyState is "+e.readyState+". Response is "+i))},D=function(e){if(n)if(200===e.status){var t=new gS.default(e.responseURL,hS.default.parseHttpHeaders(e.getAllResponseHeaders?e.getAllResponseHeaders():null),e.response);L(y,t).then((function(){var r=p.getLicenseMessage(t.data,g,o);null!==r?(C(_),n.updateKeySession(u,r)):M(e,_,g,o)}))}else M(e,_,g,o)},O=function(e){C(_,new fS.default(dS.default.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,dS.default.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE+g+' update, XHR aborted. status is "'+e.statusText+'" ('+e.status+"), readyState is "+e.readyState))},w=function(e){C(_,new fS.default(dS.default.MEDIA_KEY_MESSAGE_LICENSER_ERROR_CODE,dS.default.MEDIA_KEY_MESSAGE_LICENSER_ERROR_MESSAGE+g+' update, XHR error. status is "'+e.statusText+'" ('+e.status+"), readyState is "+e.readyState))},P=E.getLicenseRequestFromMessage(s),F=p.getHTTPMethod(o),x=p.getResponseType(g,o),U=f&&!isNaN(f.httpTimeout)?f.httpTimeout:8e3,B=u.getSessionID()||null,k=new cS.default(T,F,x,I,R,o,B,P);L(v,k).then((function(){!function e(t,n,a,o,s,u){var f=new XMLHttpRequest;if(d.get().streaming.cmcd&&d.get().streaming.cmcd.enabled){if(d.get().streaming.cmcd.mode===pS.default.CMCD_MODE_QUERY){var g=l.getQueryParameter({url:t.url,type:pe.HTTPRequest.LICENSE});g&&(t.url=hS.default.addAditionalQueryParameterToUrl(t.url,[g]))}}f.open(t.method,t.url,!0),f.responseType=t.responseType,f.withCredentials=t.withCredentials,a>0&&(f.timeout=a);for(var h in t.headers)f.setRequestHeader(h,t.headers[h]);if(d.get().streaming.cmcd&&d.get().streaming.cmcd.enabled){if(d.get().streaming.cmcd.mode===pS.default.CMCD_MODE_HEADER){var p=l.getHeaderParameters({url:t.url,type:pe.HTTPRequest.LICENSE});if(p)for(var _ in p){var m=p[_];m&&f.setRequestHeader(_,m)}}}var E=function(){n--,setTimeout((function(){e(t,n,a,o,s,u)}),1e3)};f.onload=function(){200===this.status||n<=0?o(this):(c.warn("License request failed ("+this.status+"). Retrying it... Pending retries: "+n),E())},f.ontimeout=f.onerror=function(){n<=0?u(this):(c.warn("License request network request failed . Retrying it... Pending retries: "+n),E())},f.onabort=function(){s(this)},r.trigger(i.LICENSE_REQUEST_SENDING,{url:t.url,headers:t.headers,payload:t.data,sessionId:t.sessionId}),f.send(t.data)}(k,3,U,D,O,w)}))}else C(_,new fS.default(dS.default.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_CODE,dS.default.MEDIA_KEY_MESSAGE_NO_LICENSE_SERVER_URL_ERROR_MESSAGE))}else C(_,new fS.default(dS.default.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_CODE,dS.default.MEDIA_KEY_MESSAGE_NO_CHALLENGE_ERROR_MESSAGE))}function P(e,n){if(c.debug("DRM: onNeedKey"),"cenc"===e.key.initDataType)if(0===h.length&&(c.warn("DRM: onNeedKey called before initializeForMedia, wait until initialized"),(n=void 0===n?1:n+1)<5))u.push(setTimeout((function(){P(e,n)}),500));else{var r=e.key.initData;if(ArrayBuffer.isView(r)&&(r=r.buffer),E){var i=sS.default.getPSSHForKeySystem(E,r);if(i&&S(i))return}c.debug("DRM: initData:",String.fromCharCode.apply(null,new Uint8Array(r)));var a=t.getSupportedKeySystems(r,p);0!==a.length?D(a,!1):c.debug("DRM: Received needkey event with initData, but we don't support any of the key systems!")}else c.warn("DRM: Only 'cenc' initData is supported! Ignoring initData of type: "+e.key.initDataType)}function L(e,t){return e?e.reduce((function(e,n){return e.then((function(){return n(t)}))}),Promise.resolve()):Promise.resolve()}return f={initializeForMedia:function(e){if(!e)throw new Error("mediaInfo can not be null or undefined");T(),r.on(i.INTERNAL_KEY_MESSAGE,w,this),r.on(i.INTERNAL_KEY_STATUS_CHANGED,O,this),h.push(e);var n=t.getSupportedKeySystemsFromContentProtection(e.contentProtection);n&&n.length>0&&D(n,!0)},clearMediaInfoArrayByStreamId:function(e){h=h.filter((function(t){return t.streamInfo.id!==e}))},createKeySession:A,loadKeySession:I,removeKeySession:function(e){T(),n.removeKeySession(e)},closeKeySession:function(e){T(),n.closeKeySession(e)},setServerCertificate:function(e){T(),n.setServerCertificate(e)},setMediaElement:R,setSessionType:function(e){_=e},setRobustnessLevel:function(e){m=e},setProtectionData:function(e){p=e,t.setProtectionData(e)},getSupportedKeySystemsFromContentProtection:function(e){return T(),t.getSupportedKeySystemsFromContentProtection(e)},getKeySystems:function(){return t?t.getKeySystems():[]},setKeySystems:function(e){t&&t.setKeySystems(e)},setLicenseRequestFilters:function(e){v=e},setLicenseResponseFilters:function(e){y=e},stop:function(){n&&n.stop()},reset:function(){T(),v=[],y=[],r.off(i.INTERNAL_KEY_MESSAGE,w,this),r.off(i.INTERNAL_KEY_STATUS_CHANGED,O,this),R(null),E=void 0,n&&(n.reset(),n=null),u.forEach((function(e){return clearTimeout(e)})),u=[],h=[]}},c=a.getLogger(f),g=[],h=[],_="temporary",m="",v=[],y=[],f}mS.__dashjs_factory_name="ProtectionController";var ES=dashjs.FactoryMaker.getClassFactory(mS),vS=Object.defineProperty({default:ES},"__esModule",{value:!0});var yS=function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.keyID=t,this.key=n},TS=Object.defineProperty({default:yS},"__esModule",{value:!0}),AS=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var SS=function(){function e(t,n){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),n&&"persistent"!==n&&"temporary"!==n)throw new Error("Invalid ClearKey key set type! Must be one of 'persistent' or 'temporary'");this.keyPairs=t,this.type=n}return AS(e,[{key:"toJWK",value:function(){var e=void 0,t=this.keyPairs.length,n={keys:[]};for(e=0;e<t;e++){var r={kty:"oct",alg:"A128KW",kid:this.keyPairs[e].keyID,k:this.keyPairs[e].key};n.keys.push(r)}this.type&&(n.type=this.type);var i=JSON.stringify(n),a=i.length,o=new ArrayBuffer(a),s=new Uint8Array(o);for(e=0;e<a;e++)s[e]=i.charCodeAt(e);return o}}]),e}(),IS=Object.defineProperty({default:SS},"__esModule",{value:!0}),RS=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var bS=new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.init()}return RS(e,[{key:"init",value:function(){this.CLEARKEY_KEYSTEM_STRING="org.w3.clearkey",this.WIDEVINE_KEYSTEM_STRING="com.widevine.alpha",this.PLAYREADY_KEYSTEM_STRING="com.microsoft.playready"}}]),e}()),NS=Object.defineProperty({default:bS},"__esModule",{value:!0}),MS=wS(TS),DS=wS(IS),CS=wS(XA),OS=wS(NS);function wS(e){return e&&e.__esModule?e:{default:e}}var PS="e2719d58-a985-b3c9-781a-b030af78d30e",LS=OS.default.CLEARKEY_KEYSTEM_STRING,FS="urn:uuid:"+PS;function xS(e){var t=(e=e||{}).BASE64,n={attributes:["Laurl","laurl"],prefixes:["clearkey","dashif"]};return{uuid:PS,schemeIdURI:FS,systemString:LS,getInitData:function(e,n){try{var r=CS.default.parseInitDataFromContentProtection(e,t);if(!r&&n){var i={kids:[function(e){try{var t=e.replace(/-/g,"");return(t=btoa(t.match(/\w{2}/g).map((function(e){return String.fromCharCode(parseInt(e,16))})).join(""))).replace(/=/g,"")}catch(e){return null}}(n["cenc:default_KID"])]};r=(new TextEncoder).encode(JSON.stringify(i))}return r}catch(e){return null}},getRequestHeadersFromMessage:function(){return{"Content-Type":"application/json"}},getLicenseRequestFromMessage:function(e){return JSON.parse(String.fromCharCode.apply(null,new Uint8Array(e)))},getLicenseServerURLFromInitData:function(){return null},getCDMData:function(){return null},getSessionId:function(){return null},getLicenseServerUrlFromMediaInfo:function(e){try{if(!e||0===e.length)return null;for(var t=0,r=null;t<e.length&&!r;){var i=e[t];if(i&&i.contentProtection&&i.contentProtection.length>0){var a=i.contentProtection.filter((function(e){return e.schemeIdUri&&e.schemeIdUri===FS}));if(a&&a.length>0)for(var o=0;o<a.length&&!r;){for(var s=a[o],u=0;u<n.attributes.length&&!r;){for(var l=0,d=n.attributes[u];l<n.prefixes.length&&!r;){var f=n.prefixes[l];s[d]&&s[d].__prefix&&s[d].__prefix===f&&s[d].__text&&(r=s[d].__text),l+=1}u+=1}o+=1}}t+=1}return r}catch(e){return null}},getClearKeysFromProtectionData:function(e,t){var n=null;if(e){for(var r=JSON.parse(String.fromCharCode.apply(null,new Uint8Array(t))),i=[],a=0;a<r.kids.length;a++){var o=r.kids[a],s=e.clearkeys&&e.clearkeys.hasOwnProperty(o)?e.clearkeys[o]:null;if(!s)throw new Error("DRM: ClearKey keyID ("+o+") is not known!");i.push(new MS.default(o,s))}n=new DS.default(i)}return n}}}xS.__dashjs_factory_name="KeySystemClearKey";var US=dashjs.FactoryMaker.getSingletonFactory(xS),BS=Object.defineProperty({default:US},"__esModule",{value:!0}),kS=jS(TS),GS=jS(IS),qS=jS(XA),YS=jS(NS);function jS(e){return e&&e.__esModule?e:{default:e}}var HS="1077efec-c0b2-4d02-ace3-3c1e52e2fb4b",KS=YS.default.CLEARKEY_KEYSTEM_STRING;function VS(e){var t=void 0,n=e.BASE64,r=e.debug.getLogger(t);return t={uuid:HS,schemeIdURI:"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b",systemString:KS,getInitData:function(e){return qS.default.parseInitDataFromContentProtection(e,n)},getRequestHeadersFromMessage:function(){return null},getLicenseRequestFromMessage:function(e){return new Uint8Array(e)},getLicenseServerURLFromInitData:function(){return null},getCDMData:function(){return null},getSessionId:function(){return null},getClearKeysFromProtectionData:function(e,t){var n=null;if(e){for(var i=JSON.parse(String.fromCharCode.apply(null,new Uint8Array(t))),a=[],o=0;o<i.kids.length;o++){var s=i.kids[o],u=e.clearkeys&&e.clearkeys.hasOwnProperty(s)?e.clearkeys[s]:null;if(!u)throw new Error("DRM: ClearKey keyID ("+s+") is not known!");a.push(new kS.default(s,u))}n=new GS.default(a),r.warn("ClearKey schemeIdURI is using W3C Common PSSH systemID (1077efec-c0b2-4d02-ace3-3c1e52e2fb4b) in Content Protection. See DASH-IF IOP v4.1 section 7.6.2.4")}return n}}}VS.__dashjs_factory_name="KeySystemW3CClearKey";var zS=dashjs.FactoryMaker.getSingletonFactory(VS),WS=Object.defineProperty({default:zS},"__esModule",{value:!0}),XS=ZS(XA),QS=ZS(NS);function ZS(e){return e&&e.__esModule?e:{default:e}}var $S="edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",JS=QS.default.WIDEVINE_KEYSTEM_STRING;function eI(e){var t=null,n=(e=e||{}).BASE64;return{uuid:$S,schemeIdURI:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",systemString:JS,init:function(e){e&&(t=e)},getInitData:function(e){return XS.default.parseInitDataFromContentProtection(e,n)},getRequestHeadersFromMessage:function(){return null},getLicenseRequestFromMessage:function(e){return new Uint8Array(e)},getLicenseServerURLFromInitData:function(){return null},getCDMData:function(){return null},getSessionId:function(e){return t&&t.sessionId?t.sessionId:e&&e.sessionId?e.sessionId:null}}}eI.__dashjs_factory_name="KeySystemWidevine";var tI=dashjs.FactoryMaker.getSingletonFactory(eI),nI=Object.defineProperty({default:tI},"__esModule",{value:!0}),rI=aI(XA),iI=aI(NS);function aI(e){return e&&e.__esModule?e:{default:e}}var oI="9a04f079-9840-4286-ab92-e65be0885f95",sI=iI.default.PLAYREADY_KEYSTEM_STRING,uI=void 0;function lI(e){var t="utf-16",n=(e=e||{}).BASE64;function r(){if(!n||!n.hasOwnProperty("decodeArray")||!n.hasOwnProperty("decodeArray"))throw new Error("Missing config parameter(s)")}return{uuid:oI,schemeIdURI:"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95",systemString:sI,getInitData:function(e){var t,i,a,o=new Uint8Array([112,115,115,104,0,0,0,0]),s=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]),u=0,l=null,d=void 0,f=void 0;if(r(),!e)return null;if("pssh"in e)return rI.default.parseInitDataFromContentProtection(e,n);if("pro"in e)l=n.decodeArray(e.pro.__text);else{if(!("prheader"in e))return null;l=n.decodeArray(e.prheader.__text)}return t=l.length,i=4+o.length+s.length+4+t,a=new ArrayBuffer(i),d=new Uint8Array(a),(f=new DataView(a)).setUint32(u,i),u+=4,d.set(o,u),u+=o.length,d.set(s,u),u+=s.length,f.setUint32(u,t),u+=4,d.set(l,u),u+=t,d.buffer},getRequestHeadersFromMessage:function(e){var n,r=void 0,i={},a=new DOMParser,o="utf-16"===t?new Uint16Array(e):new Uint8Array(e);n=String.fromCharCode.apply(null,o);for(var s=(r=a.parseFromString(n,"application/xml")).getElementsByTagName("name"),u=r.getElementsByTagName("value"),l=0;l<s.length;l++)i[s[l].childNodes[0].nodeValue]=u[l].childNodes[0].nodeValue;return i.hasOwnProperty("Content")&&(i["Content-Type"]=i.Content,delete i.Content),i.hasOwnProperty("Content-Type")||(i["Content-Type"]="text/xml; charset=utf-8"),i},getLicenseRequestFromMessage:function(e){var i=null,a=new DOMParser,o="utf-16"===t?new Uint16Array(e):new Uint8Array(e);r();var s=String.fromCharCode.apply(null,o),u=a.parseFromString(s,"application/xml");if(!u.getElementsByTagName("PlayReadyKeyMessage")[0])return e;var l=u.getElementsByTagName("Challenge")[0].childNodes[0].nodeValue;return l&&(i=n.decode(l)),i},getLicenseServerURLFromInitData:function(e){if(e)for(var t=new DataView(e),n=t.getUint16(4,!0),r=6,i=new DOMParser,a=0;a<n;a++){var o=t.getUint16(r,!0);r+=2;var s=t.getUint16(r,!0);if(r+=2,1===o){var u=e.slice(r,r+s),l=String.fromCharCode.apply(null,new Uint16Array(u)),d=i.parseFromString(l,"application/xml");if(d.getElementsByTagName("LA_URL")[0]){var f=d.getElementsByTagName("LA_URL")[0].childNodes[0].nodeValue;if(f)return f}if(d.getElementsByTagName("LUI_URL")[0]){var c=d.getElementsByTagName("LUI_URL")[0].childNodes[0].nodeValue;if(c)return c}}else r+=s}return null},getCDMData:function(){var e=void 0,t=void 0,i=void 0,a=void 0;if(r(),uI&&uI.cdmData){for(e=[],a=0;a<uI.cdmData.length;++a)e.push(uI.cdmData.charCodeAt(a)),e.push(0);for(e=String.fromCharCode.apply(null,e),e=n.encode(e),t='<PlayReadyCDMData type="LicenseAcquisition"><LicenseAcquisition version="1.0" Proactive="false"><CustomData encoding="base64encoded">%CUSTOMDATA%</CustomData></LicenseAcquisition></PlayReadyCDMData>'.replace("%CUSTOMDATA%",e),i=[],a=0;a<t.length;++a)i.push(t.charCodeAt(a)),i.push(0);return new Uint8Array(i).buffer}return null},getSessionId:function(e){return uI&&uI.sessionId?uI.sessionId:e&&e.sessionId?e.sessionId:null},setPlayReadyMessageFormat:function(e){if("utf-8"!==e&&"utf-16"!==e)throw new Error('Specified message format is not one of "utf-8" or "utf-16"');t=e},init:function(e){e&&(uI=e)}}}lI.__dashjs_factory_name="KeySystemPlayReady";var dI=dashjs.FactoryMaker.getSingletonFactory(lI),fI=Object.defineProperty({default:dI},"__esModule",{value:!0}),cI=function(e){return e&&e.__esModule?e:{default:e}}(NS);function gI(e){var t=(e=e||{}).BASE64,n={};n[cI.default.WIDEVINE_KEYSTEM_STRING]={responseType:"json",getLicenseMessage:function(e){return t.decodeArray(e.license)},getErrorResponse:function(e){return e}},n[cI.default.PLAYREADY_KEYSTEM_STRING]={responseType:"arraybuffer",getLicenseMessage:function(e){return e},getErrorResponse:function(e){return String.fromCharCode.apply(null,new Uint8Array(e))}};return{getServerURLFromMessage:function(e){return e},getHTTPMethod:function(){return"POST"},getResponseType:function(e){return n[e].responseType},getLicenseMessage:function(e,r){return function(){if(!t||!t.hasOwnProperty("decodeArray"))throw new Error("Missing config parameter(s)")}(),n[r].getLicenseMessage(e)},getErrorResponse:function(e,t){return n[t].getErrorResponse(e)}}}gI.__dashjs_factory_name="DRMToday";var hI=dashjs.FactoryMaker.getSingletonFactory(gI),pI=Object.defineProperty({default:hI},"__esModule",{value:!0});function _I(){var e="http://schemas.xmlsoap.org/soap/envelope/";function t(e){var t=String.fromCharCode.apply(null,new Uint8Array(e));return decodeURIComponent(escape(t))}function n(n){if(window.DOMParser){var r=t(n),i=(new window.DOMParser).parseFromString(r,"text/xml"),a=i?i.getElementsByTagNameNS(e,"Envelope")[0]:null,o=a?a.getElementsByTagNameNS(e,"Body")[0]:null;if(o?o.getElementsByTagNameNS(e,"Fault")[0]:null)return null}return n}function r(n){var r="",i="",a="",o=-1,s=-1;if(window.DOMParser){var u=t(n),l=(new window.DOMParser).parseFromString(u,"text/xml"),d=l?l.getElementsByTagNameNS(e,"Envelope")[0]:null,f=d?d.getElementsByTagNameNS(e,"Body")[0]:null,c=f?f.getElementsByTagNameNS(e,"Fault")[0]:null,g=c?c.getElementsByTagName("detail")[0]:null,h=g?g.getElementsByTagName("Exception")[0]:null,p=null;if(null===c)return u;r=(p=c.getElementsByTagName("faultstring")[0].firstChild)?p.nodeValue:null,null!==h&&(i=(p=h.getElementsByTagName("StatusCode")[0])?p.firstChild.nodeValue:null,o=(a=(p=h.getElementsByTagName("Message")[0])?p.firstChild.nodeValue:null)?a.lastIndexOf("[")+1:-1,s=a?a.indexOf("]"):-1,a=a?a.substring(o,s):"")}var _="code: "+i+", name: "+r;return a&&(_+=", message: "+a),_}return{getServerURLFromMessage:function(e){return e},getHTTPMethod:function(){return"POST"},getResponseType:function(){return"arraybuffer"},getLicenseMessage:function(e){return n.call(this,e)},getErrorResponse:function(e){return r.call(this,e)}}}_I.__dashjs_factory_name="PlayReady";var mI=dashjs.FactoryMaker.getSingletonFactory(_I),EI=Object.defineProperty({default:mI},"__esModule",{value:!0});function vI(){return{getServerURLFromMessage:function(e){return e},getHTTPMethod:function(){return"POST"},getResponseType:function(){return"arraybuffer"},getLicenseMessage:function(e){return e},getErrorResponse:function(e){return String.fromCharCode.apply(null,new Uint8Array(e))}}}vI.__dashjs_factory_name="Widevine";var yI=dashjs.FactoryMaker.getSingletonFactory(vI),TI=Object.defineProperty({default:yI},"__esModule",{value:!0}),AI=II(TS),SI=II(IS);function II(e){return e&&e.__esModule?e:{default:e}}function RI(){return{getServerURLFromMessage:function(e){return e},getHTTPMethod:function(){return"POST"},getResponseType:function(){return"json"},getLicenseMessage:function(e){if(!e.hasOwnProperty("keys"))return null;for(var t=[],n=0;n<e.keys.length;n++){var r=e.keys[n],i=r.kid.replace(/=/g,""),a=r.k.replace(/=/g,"");t.push(new AI.default(i,a))}return new SI.default(t)},getErrorResponse:function(e){return String.fromCharCode.apply(null,new Uint8Array(e))}}}RI.__dashjs_factory_name="ClearKey";var bI=dashjs.FactoryMaker.getSingletonFactory(RI),NI=Object.defineProperty({default:bI},"__esModule",{value:!0}),MI=BI(XA),DI=BI(BS),CI=BI(WS),OI=BI(nI),wI=BI(fI),PI=BI(pI),LI=BI(EI),FI=BI(TI),xI=BI(NI),UI=BI(NS);function BI(e){return e&&e.__esModule?e:{default:e}}function kI(){var e=this.context,t=void 0,n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0;return t={initialize:function(){i=[];var t=void 0;t=(0,wI.default)(e).getInstance({BASE64:a}),i.push(t),t=(0,OI.default)(e).getInstance({BASE64:a}),i.push(t),t=(0,DI.default)(e).getInstance({BASE64:a}),i.push(t),o=t,t=(0,CI.default)(e).getInstance({BASE64:a,debug:n}),i.push(t),s=t},setProtectionData:function(e){for(var t=function(t){var n=null;return e&&(n=t in e?e[t]:null),n},n=0;n<i.length;n++){var r=i[n];r.hasOwnProperty("init")&&r.init(t(r.systemString))}},isClearKey:function(e){return e===o||e===s},initDataEquals:function(e,t){if(e.byteLength===t.byteLength){for(var n=new Uint8Array(e),r=new Uint8Array(t),i=0;i<n.length;i++)if(n[i]!==r[i])return!1;return!0}return!1},getKeySystems:function(){return i},setKeySystems:function(e){i=e},getKeySystemBySystemString:function(e){for(var t=0;t<i.length;t++)if(i[t].systemString===e)return i[t];return null},getSupportedKeySystemsFromContentProtection:function(e){var t=void 0,n=void 0,r=void 0,a=void 0,o=[];if(e){var s=MI.default.findCencContentProtection(e);for(r=0;r<i.length;++r)for(n=i[r],a=0;a<e.length;++a)if((t=e[a]).schemeIdUri.toLowerCase()===n.schemeIdURI){var u=n.getInitData(t,s);o.push({ks:i[r],initData:u,cdmData:n.getCDMData(),sessionId:n.getSessionId(t)})}}return o},getSupportedKeySystems:function(e,t){for(var n=[],r=MI.default.parsePSSHList(e),a=void 0,o=void 0,s=void 0,u=0;u<i.length;++u)o=(a=i[u]).systemString,s=!t||o in t,a.uuid in r&&s&&n.push({ks:a,initData:r[a.uuid],cdmData:a.getCDMData(),sessionId:a.getSessionId()});return n},getLicenseServer:function(t,n,r){if("license-release"===r||"individualization-request"===r)return null;var i=null;return n&&n.hasOwnProperty("drmtoday")?i=(0,PI.default)(e).getInstance({BASE64:a}):t.systemString===UI.default.WIDEVINE_KEYSTEM_STRING?i=(0,FI.default)(e).getInstance():t.systemString===UI.default.PLAYREADY_KEYSTEM_STRING?i=(0,LI.default)(e).getInstance():t.systemString===UI.default.CLEARKEY_KEYSTEM_STRING&&(i=(0,xI.default)(e).getInstance()),i},processClearKeyLicenseRequest:function(e,t,n){try{return e.getClearKeysFromProtectionData(t,n)}catch(e){return r.error("Failed to retrieve clearkeys from ProtectionData"),null}},setConfig:function(e){e&&(e.debug&&(n=e.debug,r=n.getLogger(t)),e.BASE64&&(a=e.BASE64))}}}kI.__dashjs_factory_name="ProtectionKeyController";var GI=dashjs.FactoryMaker.getSingletonFactory(kI),qI=Object.defineProperty({default:GI},"__esModule",{value:!0});var YI=new(function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.INTERNAL_KEY_MESSAGE="internalKeyMessage",e.INTERNAL_KEY_SYSTEM_SELECTED="internalKeySystemSelected",e.INTERNAL_KEY_STATUS_CHANGED="internalkeyStatusChanged",e.KEY_ADDED="public_keyAdded",e.KEY_ERROR="public_keyError",e.KEY_MESSAGE="public_keyMessage",e.KEY_SESSION_CLOSED="public_keySessionClosed",e.KEY_SESSION_CREATED="public_keySessionCreated",e.KEY_SESSION_REMOVED="public_keySessionRemoved",e.KEY_STATUSES_CHANGED="public_keyStatusesChanged",e.KEY_SYSTEM_ACCESS_COMPLETE="public_keySystemAccessComplete",e.KEY_SYSTEM_SELECTED="public_keySystemSelected",e.LICENSE_REQUEST_COMPLETE="public_licenseRequestComplete",e.LICENSE_REQUEST_SENDING="public_licenseRequestSending",e.NEED_KEY="needkey",e.PROTECTION_CREATED="public_protectioncreated",e.PROTECTION_DESTROYED="public_protectiondestroyed",e.SERVER_CERTIFICATE_UPDATED="serverCertificateUpdated",e.TEARDOWN_COMPLETE="protectionTeardownComplete",e.VIDEO_ELEMENT_SELECTED="videoElementSelected",e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(function(e){return e&&e.__esModule?e:{default:e}}(N).default)),jI=Object.defineProperty({default:YI},"__esModule",{value:!0});var HI=function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.initData=t,this.initDataType=n},KI=Object.defineProperty({default:HI},"__esModule",{value:!0});var VI=function e(t,n,r,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.sessionToken=t,this.message=n,this.defaultURL=r,this.messageType=i||"license-request"},zI=Object.defineProperty({default:VI},"__esModule",{value:!0});var WI=function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.keySystem=t,this.ksConfiguration=n},XI=Object.defineProperty({default:WI},"__esModule",{value:!0}),QI=rR(qI),ZI=rR(KI),$I=rR(tS),JI=rR(Me),eR=rR(zI),tR=rR(XI),nR=rR(NS);function rR(e){return e&&e.__esModule?e:{default:e}}function iR(e){e=e||{};var t=this.context,n=e.eventBus,r=e.events,i=e.debug,a=void 0,o=void 0,s=void 0,u=void 0,l=void 0,d=void 0,f=void 0,c=void 0;function g(e){var t=e.session;return t.removeEventListener("keystatuseschange",e),t.removeEventListener("message",e),t.close()}function h(e){for(var t=0;t<d.length;t++)if(d[t]===e){d.splice(t,1);break}}function p(e){var t=void 0,n=void 0;return e&&e.length>0&&(e[0]&&("string"==typeof e[0]?t=e[0]:n=e[0]),e[1]&&("string"==typeof e[1]?t=e[1]:n=e[1])),{status:t,keyId:n}}function _(e,t,i,a){var s={session:e,initData:t,sessionId:a,handleEvent:function(e){switch(e.type){case"keystatuseschange":n.trigger(r.KEY_STATUSES_CHANGED,{data:this}),e.target.keyStatuses.forEach((function(){var e=p(arguments);switch(e.status){case"expired":n.trigger(r.INTERNAL_KEY_STATUS_CHANGED,{error:new JI.default($I.default.KEY_STATUS_CHANGED_EXPIRED_ERROR_CODE,$I.default.KEY_STATUS_CHANGED_EXPIRED_ERROR_MESSAGE)});break;default:n.trigger(r.INTERNAL_KEY_STATUS_CHANGED,e)}}));break;case"message":var t=ArrayBuffer.isView(e.message)?e.message.buffer:e.message;n.trigger(r.INTERNAL_KEY_MESSAGE,{data:new eR.default(this,t,void 0,e.messageType)})}},getSessionID:function(){return e.sessionId},getExpirationTime:function(){return e.expiration},getKeyStatuses:function(){return e.keyStatuses},getUsable:function(){var t=!1;return e.keyStatuses.forEach((function(){var e=p(arguments);"usable"===e.status&&(t=!0)})),t},getSessionType:function(){return i}};return e.addEventListener("keystatuseschange",s),e.addEventListener("message",s),e.closed.then((function(){h(s),o.debug("DRM: Session closed. SessionID = "+s.getSessionID()),n.trigger(r.KEY_SESSION_CLOSED,{data:s.getSessionID()})})),d.push(s),s}return a={getAllInitData:function(){for(var e=[],t=0;t<d.length;t++)d[t].initData&&e.push(d[t].initData);return e},requestKeySystemAccess:function(e){!function e(t,i){if(void 0===navigator.requestMediaKeySystemAccess||"function"!=typeof navigator.requestMediaKeySystemAccess)return void n.trigger(r.KEY_SYSTEM_ACCESS_COMPLETE,{error:"Insecure origins are not allowed"});!function(i){var a=t[i].ks,o=t[i].configs,s=a.systemString;s===nR.default.PLAYREADY_KEYSTEM_STRING&&"required"===o[0].persistentState&&(s+=".recommendation"),navigator.requestMediaKeySystemAccess(s,o).then((function(e){var t="function"==typeof e.getConfiguration?e.getConfiguration():null,i=new tR.default(a,t);i.mksa=e,n.trigger(r.KEY_SYSTEM_ACCESS_COMPLETE,{data:i})})).catch((function(a){++i<t.length?e(t,i):n.trigger(r.KEY_SYSTEM_ACCESS_COMPLETE,{error:"Key system access denied! "+a.message})}))}(i)}(e,0)},getKeySystem:function(){return s},selectKeySystem:function(e){e.mksa.createMediaKeys().then((function(t){s=e.keySystem,l=t,u?u.setMediaKeys(l).then((function(){n.trigger(r.INTERNAL_KEY_SYSTEM_SELECTED)})):n.trigger(r.INTERNAL_KEY_SYSTEM_SELECTED)})).catch((function(){n.trigger(r.INTERNAL_KEY_SYSTEM_SELECTED,{error:"Error selecting keys system ("+e.keySystem.systemString+")! Could not create MediaKeys -- TODO"})}))},setMediaElement:function(e){u!==e&&(u&&(u.removeEventListener("encrypted",f),u.setMediaKeys&&u.setMediaKeys(null)),(u=e)&&(u.addEventListener("encrypted",f),u.setMediaKeys&&l&&u.setMediaKeys(l)))},setServerCertificate:function(e){if(!s||!l)throw new Error("Can not set server certificate until you have selected a key system");l.setServerCertificate(e).then((function(){o.info("DRM: License server certificate successfully updated."),n.trigger(r.SERVER_CERTIFICATE_UPDATED)})).catch((function(e){n.trigger(r.SERVER_CERTIFICATE_UPDATED,{error:new JI.default($I.default.SERVER_CERTIFICATE_UPDATED_ERROR_CODE,$I.default.SERVER_CERTIFICATE_UPDATED_ERROR_MESSAGE+e.name)})}))},createKeySession:function(e,t,i){if(!s||!l)throw new Error("Can not create sessions until you have selected a key system");var a=l.createSession(i),u=_(a,e,i),d=this.getKeySystem().systemString===nR.default.CLEARKEY_KEYSTEM_STRING&&(e||t&&t.clearkeys)?"keyids":"cenc";a.generateRequest(d,e).then((function(){o.debug("DRM: Session created. SessionID = "+u.getSessionID()),n.trigger(r.KEY_SESSION_CREATED,{data:u})})).catch((function(e){h(u),n.trigger(r.KEY_SESSION_CREATED,{data:null,error:new JI.default($I.default.KEY_SESSION_CREATED_ERROR_CODE,$I.default.KEY_SESSION_CREATED_ERROR_MESSAGE+"Error generating key request -- "+e.name)})}))},updateKeySession:function(e,t){var i=e.session;c.isClearKey(s)&&(t=t.toJWK()),i.update(t).catch((function(t){n.trigger(r.KEY_ERROR,{data:new JI.default($I.default.MEDIA_KEYERR_CODE,"Error sending update() message! "+t.name,e)})}))},loadKeySession:function(e,t,i){if(!s||!l)throw new Error("Can not load sessions until you have selected a key system");for(var a=0;a<d.length;a++)if(e===d[a].sessionId)return void o.warn("DRM: Ignoring session ID because we have already seen it!");var u=l.createSession(i),f=_(u,t,i,e);u.load(e).then((function(t){t?(o.debug("DRM: Session loaded. SessionID = "+f.getSessionID()),n.trigger(r.KEY_SESSION_CREATED,{data:f})):(h(f),n.trigger(r.KEY_SESSION_CREATED,{data:null,error:new JI.default($I.default.KEY_SESSION_CREATED_ERROR_CODE,$I.default.KEY_SESSION_CREATED_ERROR_MESSAGE+"Could not load session! Invalid Session ID ("+e+")")}))})).catch((function(t){h(f),n.trigger(r.KEY_SESSION_CREATED,{data:null,error:new JI.default($I.default.KEY_SESSION_CREATED_ERROR_CODE,$I.default.KEY_SESSION_CREATED_ERROR_MESSAGE+"Could not load session ("+e+")! "+t.name)})}))},removeKeySession:function(e){e.session.remove().then((function(){o.debug("DRM: Session removed. SessionID = "+e.getSessionID()),n.trigger(r.KEY_SESSION_REMOVED,{data:e.getSessionID()})}),(function(t){n.trigger(r.KEY_SESSION_REMOVED,{data:null,error:"Error removing session ("+e.getSessionID()+"). "+t.name})}))},closeKeySession:function(e){g(e).catch((function(t){h(e),n.trigger(r.KEY_SESSION_CLOSED,{data:null,error:"Error closing session ("+e.getSessionID()+") "+t.name})}))},stop:function(){for(var e=void 0,t=0;t<d.length;t++)(e=d[t]).getUsable()||g(e).catch((function(){h(e)}))},reset:function(){var e=d.length,t=void 0;0!==e?function(){for(var i=function(e){h(e),0===d.length&&(u?(u.removeEventListener("encrypted",f),u.setMediaKeys(null).then((function(){n.trigger(r.TEARDOWN_COMPLETE)}))):n.trigger(r.TEARDOWN_COMPLETE))},a=0;a<e;a++)!function(e){t.session.closed.then((function(){i(e)})),g(t).catch((function(){i(e)}))}(t=d[a])}():n.trigger(r.TEARDOWN_COMPLETE)}},o=i.getLogger(a),s=null,u=null,l=null,d=[],c=(0,QI.default)(t).getInstance(),f={handleEvent:function(e){switch(e.type){case"encrypted":if(e.initData){var t=ArrayBuffer.isView(e.initData)?e.initData.buffer:e.initData;n.trigger(r.NEED_KEY,{key:new ZI.default(t,e.initDataType)})}}}},a}iR.__dashjs_factory_name="ProtectionModel_21Jan2015";var aR=dashjs.FactoryMaker.getClassFactory(iR),oR=Object.defineProperty({default:aR},"__esModule",{value:!0}),sR=hR(qI),uR=hR(KI),lR=hR(Me),dR=hR(tS),fR=hR(zI),cR=hR(JA),gR=hR(XI);function hR(e){return e&&e.__esModule?e:{default:e}}function pR(e){e=e||{};var t=this.context,n=e.eventBus,r=e.events,i=e.debug,a=e.api,o=void 0,s=void 0,u=void 0,l=void 0,d=void 0,f=void 0,c=void 0,g=void 0,h=void 0;function p(){try{for(var e=0;e<c.length;e++)_(c[e]);u&&u.removeEventListener(a.needkey,g),n.trigger(r.TEARDOWN_COMPLETE)}catch(e){n.trigger(r.TEARDOWN_COMPLETE,{error:"Error tearing down key sessions and MediaKeys! -- "+e.message})}}function _(e){var t=e.session;t.removeEventListener(a.error,e),t.removeEventListener(a.message,e),t.removeEventListener(a.ready,e),t.removeEventListener(a.close,e);for(var n=0;n<c.length;n++)if(c[n]===e){c.splice(n,1);break}t[a.release]()}function m(){var e=null,t=function(){u.removeEventListener("loadedmetadata",e),u[a.setMediaKeys](d),n.trigger(r.VIDEO_ELEMENT_SELECTED)};u.readyState>=1?t():(e=t.bind(this),u.addEventListener("loadedmetadata",e))}return o={getAllInitData:function(){for(var e=[],t=0;t<c.length;t++)e.push(c[t].initData);return e},requestKeySystemAccess:function(e){for(var t=!1,i=0;i<e.length;i++)for(var o=e[i].ks.systemString,s=e[i].configs,u=null,l=null,d=0;d<s.length;d++){var f=s[d].audioCapabilities,c=s[d].videoCapabilities;if(f&&0!==f.length){u=[];for(var g=0;g<f.length;g++)window[a.MediaKeys].isTypeSupported(o,f[g].contentType)&&u.push(f[g])}if(c&&0!==c.length){l=[];for(var p=0;p<c.length;p++)window[a.MediaKeys].isTypeSupported(o,c[p].contentType)&&l.push(c[p])}if(!(!u&&!l||u&&0===u.length||l&&0===l.length)){t=!0;var _=new cR.default(u,l),m=h.getKeySystemBySystemString(o);n.trigger(r.KEY_SYSTEM_ACCESS_COMPLETE,{data:new gR.default(m,_)});break}}t||n.trigger(r.KEY_SYSTEM_ACCESS_COMPLETE,{error:"Key system access denied! -- No valid audio/video content configurations detected!"})},getKeySystem:function(){return l},selectKeySystem:function(e){try{d=e.mediaKeys=new window[a.MediaKeys](e.keySystem.systemString),l=e.keySystem,f=e,u&&m(),n.trigger(r.INTERNAL_KEY_SYSTEM_SELECTED)}catch(e){n.trigger(r.INTERNAL_KEY_SYSTEM_SELECTED,{error:"Error selecting keys system ("+l.systemString+")! Could not create MediaKeys -- TODO"})}},setMediaElement:function(e){u!==e&&(u&&u.removeEventListener(a.needkey,g),(u=e)&&(u.addEventListener(a.needkey,g),d&&m()))},createKeySession:function(e,t,i,o){if(!l||!d||!f)throw new Error("Can not create sessions until you have selected a key system");var u=null;if(f.ksConfiguration.videoCapabilities&&f.ksConfiguration.videoCapabilities.length>0&&(u=f.ksConfiguration.videoCapabilities[0]),null===u&&f.ksConfiguration.audioCapabilities&&f.ksConfiguration.audioCapabilities.length>0&&(u=f.ksConfiguration.audioCapabilities[0]),null===u)throw new Error("Can not create sessions for unknown content types.");var g=u.contentType,h=d.createSession(g,new Uint8Array(e),o?new Uint8Array(o):null),p=function(e,t){return{session:e,initData:t,getSessionID:function(){return this.session.sessionId},getExpirationTime:function(){return NaN},getSessionType:function(){return"temporary"},handleEvent:function(e){switch(e.type){case a.error:n.trigger(r.KEY_ERROR,{data:new lR.default(dR.default.MEDIA_KEYERR_CODE,"KeyError",this)});break;case a.message:var t=ArrayBuffer.isView(e.message)?e.message.buffer:e.message;n.trigger(r.INTERNAL_KEY_MESSAGE,{data:new fR.default(this,t,e.destinationURL)});break;case a.ready:s.debug("DRM: Key added."),n.trigger(r.KEY_ADDED);break;case a.close:s.debug("DRM: Session closed. SessionID = "+this.getSessionID()),n.trigger(r.KEY_SESSION_CLOSED,{data:this.getSessionID()})}}}}(h,e);h.addEventListener(a.error,p),h.addEventListener(a.message,p),h.addEventListener(a.ready,p),h.addEventListener(a.close,p),c.push(p),s.debug("DRM: Session created. SessionID = "+p.getSessionID()),n.trigger(r.KEY_SESSION_CREATED,{data:p})},updateKeySession:function(e,t){var n=e.session;h.isClearKey(l)?n.update(new Uint8Array(t.toJWK())):n.update(new Uint8Array(t))},closeKeySession:_,setServerCertificate:function(){},loadKeySession:function(){},removeKeySession:function(){},stop:p,reset:p},s=i.getLogger(o),u=null,l=null,d=null,f=null,c=[],h=(0,sR.default)(t).getInstance(),g={handleEvent:function(e){switch(e.type){case a.needkey:if(e.initData){var t=ArrayBuffer.isView(e.initData)?e.initData.buffer:e.initData;n.trigger(r.NEED_KEY,{key:new uR.default(t,"cenc")})}}}},o}pR.__dashjs_factory_name="ProtectionModel_3Feb2014";var _R=dashjs.FactoryMaker.getClassFactory(pR),mR=Object.defineProperty({default:_R},"__esModule",{value:!0}),ER=RR(qI),vR=RR(KI),yR=RR(Me),TR=RR(zI),AR=RR(JA),SR=RR(XI),IR=RR(tS);function RR(e){return e&&e.__esModule?e:{default:e}}function bR(e){e=e||{};var t=this.context,n=e.eventBus,r=e.events,i=e.debug,a=e.api,o=e.errHandler,s=void 0,u=void 0,l=void 0,d=void 0,f=void 0,c=void 0,g=void 0,h=void 0,p=void 0;function _(){l&&v();for(var e=0;e<g.length;e++)m(g[e]);n.trigger(r.TEARDOWN_COMPLETE)}function m(e){try{l[a.cancelKeyRequest](d.systemString,e.sessionID)}catch(t){n.trigger(r.KEY_SESSION_CLOSED,{data:null,error:"Error closing session ("+e.sessionID+") "+t.message})}}function E(e,t){if(t&&e){for(var n=e.length,r=0;r<n;r++)if(e[r].sessionID==t)return e[r];return null}return null}function v(){l.removeEventListener(a.keyerror,p),l.removeEventListener(a.needkey,p),l.removeEventListener(a.keymessage,p),l.removeEventListener(a.keyadded,p)}return s={getAllInitData:function(){for(var e=[],t=0;t<c.length;t++)e.push(c[t].initData);for(var n=0;n<g.length;n++)e.push(g[n].initData);return e},requestKeySystemAccess:function(e){var t=l;t||(t=document.createElement("video"));for(var i=!1,a=0;a<e.length;a++)for(var o=e[a].ks.systemString,s=e[a].configs,u=null,d=0;d<s.length;d++){var c=s[d].videoCapabilities;if(c&&0!==c.length){u=[];for(var g=0;g<c.length;g++)""!==t.canPlayType(c[g].contentType,o)&&u.push(c[g])}if(u&&(!u||0!==u.length)){i=!0;var h=new AR.default(null,u),p=f.getKeySystemBySystemString(o);n.trigger(r.KEY_SYSTEM_ACCESS_COMPLETE,{data:new SR.default(p,h)});break}}i||n.trigger(r.KEY_SYSTEM_ACCESS_COMPLETE,{error:"Key system access denied! -- No valid audio/video content configurations detected!"})},getKeySystem:function(){return d},selectKeySystem:function(e){d=e.keySystem,n.trigger(r.INTERNAL_KEY_SYSTEM_SELECTED)},setMediaElement:function(e){if(l!==e){if(l){v();for(var t=0;t<g.length;t++)m(g[t]);g=[]}(l=e)&&(l.addEventListener(a.keyerror,p),l.addEventListener(a.needkey,p),l.addEventListener(a.keymessage,p),l.addEventListener(a.keyadded,p),n.trigger(r.VIDEO_ELEMENT_SELECTED))}},createKeySession:function(e){if(!d)throw new Error("Can not create sessions until you have selected a key system");if(h||0===g.length){var t={sessionID:null,initData:e,getSessionID:function(){return this.sessionID},getExpirationTime:function(){return NaN},getSessionType:function(){return"temporary"}};return c.push(t),l[a.generateKeyRequest](d.systemString,new Uint8Array(e)),t}throw new Error("Multiple sessions not allowed!")},updateKeySession:function(e,t){var n=e.sessionID;if(f.isClearKey(d))for(var r=0;r<t.keyPairs.length;r++)l[a.addKey](d.systemString,t.keyPairs[r].key,t.keyPairs[r].keyID,n);else l[a.addKey](d.systemString,new Uint8Array(t),new Uint8Array(e.initData),n)},closeKeySession:m,setServerCertificate:function(){},loadKeySession:function(){},removeKeySession:function(){},stop:_,reset:_},u=i.getLogger(s),l=null,d=null,c=[],g=[],f=(0,ER.default)(t).getInstance(),p={handleEvent:function(e){var t=null;switch(e.type){case a.needkey:var i=ArrayBuffer.isView(e.initData)?e.initData.buffer:e.initData;n.trigger(r.NEED_KEY,{key:new vR.default(i,"cenc")});break;case a.keyerror:if((t=E(g,e.sessionId))||(t=E(c,e.sessionId)),t){var s=IR.default.MEDIA_KEYERR_CODE,l="";switch(e.errorCode.code){case 1:s=IR.default.MEDIA_KEYERR_UNKNOWN_CODE,l+="MEDIA_KEYERR_UNKNOWN - "+IR.default.MEDIA_KEYERR_UNKNOWN_MESSAGE;break;case 2:s=IR.default.MEDIA_KEYERR_CLIENT_CODE,l+="MEDIA_KEYERR_CLIENT - "+IR.default.MEDIA_KEYERR_CLIENT_MESSAGE;break;case 3:s=IR.default.MEDIA_KEYERR_SERVICE_CODE,l+="MEDIA_KEYERR_SERVICE - "+IR.default.MEDIA_KEYERR_SERVICE_MESSAGE;break;case 4:s=IR.default.MEDIA_KEYERR_OUTPUT_CODE,l+="MEDIA_KEYERR_OUTPUT - "+IR.default.MEDIA_KEYERR_OUTPUT_MESSAGE;break;case 5:s=IR.default.MEDIA_KEYERR_HARDWARECHANGE_CODE,l+="MEDIA_KEYERR_HARDWARECHANGE - "+IR.default.MEDIA_KEYERR_HARDWARECHANGE_MESSAGE;break;case 6:s=IR.default.MEDIA_KEYERR_DOMAIN_CODE,l+="MEDIA_KEYERR_DOMAIN - "+IR.default.MEDIA_KEYERR_DOMAIN_MESSAGE}l+=" System Code = "+e.systemCode,n.trigger(r.KEY_ERROR,{data:new yR.default(s,l,t)})}else u.error("No session token found for key error");break;case a.keyadded:(t=E(g,e.sessionId))||(t=E(c,e.sessionId)),t?(u.debug("DRM: Key added."),n.trigger(r.KEY_ADDED,{data:t})):u.debug("No session token found for key added");break;case a.keymessage:if((h=null!==e.sessionId&&void 0!==e.sessionId)?!(t=E(g,e.sessionId))&&c.length>0&&(t=c.shift(),g.push(t),t.sessionID=e.sessionId,n.trigger(r.KEY_SESSION_CREATED,{data:t})):c.length>0&&(t=c.shift(),g.push(t),0!==c.length&&o.error(new yR.default(IR.default.MEDIA_KEY_MESSAGE_ERROR_CODE,IR.default.MEDIA_KEY_MESSAGE_ERROR_MESSAGE))),t){var d=ArrayBuffer.isView(e.message)?e.message.buffer:e.message;t.keyMessage=d,n.trigger(r.INTERNAL_KEY_MESSAGE,{data:new TR.default(t,d,e.defaultURL)})}else u.warn("No session token found for key message")}}},s}bR.__dashjs_factory_name="ProtectionModel_01b";var NR=dashjs.FactoryMaker.getClassFactory(bR),MR=Object.defineProperty({default:NR},"__esModule",{value:!0}),DR=xR(vS),CR=xR(qI),OR=xR(jI),wR=xR(tS),PR=xR(oR),LR=xR(mR),FR=xR(MR);function xR(e){return e&&e.__esModule?e:{default:e}}var UR=[{generateKeyRequest:"generateKeyRequest",addKey:"addKey",cancelKeyRequest:"cancelKeyRequest",needkey:"needkey",keyerror:"keyerror",keyadded:"keyadded",keymessage:"keymessage"},{generateKeyRequest:"webkitGenerateKeyRequest",addKey:"webkitAddKey",cancelKeyRequest:"webkitCancelKeyRequest",needkey:"webkitneedkey",keyerror:"webkitkeyerror",keyadded:"webkitkeyadded",keymessage:"webkitkeymessage"}],BR=[{setMediaKeys:"setMediaKeys",MediaKeys:"MediaKeys",release:"close",needkey:"needkey",error:"keyerror",message:"keymessage",ready:"keyadded",close:"keyclose"},{setMediaKeys:"msSetMediaKeys",MediaKeys:"MSMediaKeys",release:"close",needkey:"msneedkey",error:"mskeyerror",message:"mskeymessage",ready:"mskeyadded",close:"mskeyclose"}];function kR(){var e=void 0,t=this.context;function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];if("function"==typeof e[r[Object.keys(r)[0]]])return r}return null}return e={createProtectionSystem:function(r){var i=null,a=(0,CR.default)(t).getInstance();a.setConfig({debug:r.debug,BASE64:r.BASE64}),a.initialize();var o=function(r){var i=r.debug,a=i.getLogger(e),o=r.eventBus,s=r.errHandler,u=r.videoModel?r.videoModel.getElement():null;return u&&void 0===u.onencrypted||u&&void 0===u.mediaKeys?n(u,BR)?(a.info("EME detected on this user agent! (ProtectionModel_3Feb2014)"),(0,LR.default)(t).create({debug:i,eventBus:o,events:r.events,api:n(u,BR)})):n(u,UR)?(a.info("EME detected on this user agent! (ProtectionModel_01b)"),(0,FR.default)(t).create({debug:i,eventBus:o,errHandler:s,events:r.events,api:n(u,UR)})):(a.warn("No supported version of EME detected on this user agent! - Attempts to play encrypted content will fail!"),null):(a.info("EME detected on this user agent! (ProtectionModel_21Jan2015)"),(0,PR.default)(t).create({debug:i,eventBus:o,events:r.events}))}(r);return!i&&o&&(i=(0,DR.default)(t).create({protectionModel:o,protectionKeyController:a,eventBus:r.eventBus,debug:r.debug,events:r.events,BASE64:r.BASE64,constants:r.constants,cmcdModel:r.cmcdModel,settings:r.settings}),r.capabilities.setEncryptedMediaSupported(!0)),i}}}kR.__dashjs_factory_name="Protection";var GR=dashjs.FactoryMaker.getClassFactory(kR);GR.events=OR.default,GR.errors=wR.default,dashjs.FactoryMaker.updateClassFactory(kR.__dashjs_factory_name,GR);var qR=GR,YR=Object.defineProperty({default:qR},"__esModule",{value:!0}),jR=function(e){return e&&e.__esModule?e:{default:e}}(nT);var HR=function(){var e=void 0;function t(t,n,r){if(!t||!/^VIDEO$/i.test(t.nodeName))return null;if(t._dashjs_player)return t._dashjs_player;var i=void 0,a=t.id||t.name||"video element";if(!(n=n||[].slice.call(t.querySelectorAll("source")).filter((function(e){return"application/dash+xml"==e.type}))[0])&&t.src)(n=document.createElement("source")).src=t.src;else if(!n&&!t.src)return null;return r=r||{},(i=(0,jR.default)(r).create()).initialize(t,n.src,t.autoplay),e||(e=i.getDebug().getLogger()),e.debug("Converted "+a+" to dash.js player and added content: "+n.src),t._dashjs_player=i,i}function n(e){return/^VIDEO$/i.test(e.nodeName)?e:n(e.parentNode)}return{create:t,createAll:function(e,r){var i=[];e=e||"[data-dashjs-player]";for(var a=(r=r||document).querySelectorAll(e),o=0;o<a.length;o++){var s=t(a[o],null);i.push(s)}for(var u=r.querySelectorAll('source[type="application/dash+xml"]'),l=0;l<u.length;l++){var d=t(n(u[l]),null);i.push(d)}return i}}}(),KR=void 0;!("undefined"!=typeof window&&window&&window.dashjs&&window.dashjs.skipAutoCreate)&&"undefined"!=typeof window&&window&&window.addEventListener&&("complete"===window.document.readyState?window.dashjs?HR.createAll():KR=window.setInterval((function(){window.dashjs&&(window.clearInterval(KR),HR.createAll())}),500):window.addEventListener("load",(function e(){window.removeEventListener("load",e),HR.createAll()})));var VR=HR,zR=Object.defineProperty({default:VR},"__esModule",{value:!0}),WR=f((function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.supportsMediaSource=t.Debug=t.MediaPlayerFactory=t.MetricsReporting=t.Protection=t.MediaPlayer=void 0;var n=o(VA),r=o(YR),i=o(zR),a=o(ee);function o(e){return e&&e.__esModule?e:{default:e}}dashjs.Protection=r.default,dashjs.MetricsReporting=n.default,dashjs.MediaPlayerFactory=i.default,dashjs.Debug=a.default,dashjs.supportsMediaSource=X_.supportsMediaSource,t.default=dashjs,t.MediaPlayer=rT.MediaPlayer,t.Protection=r.default,t.MetricsReporting=n.default,t.MediaPlayerFactory=i.default,t.Debug=a.default,t.supportsMediaSource=X_.supportsMediaSource})),XR="audio:set",QR="audio:update",ZR="audio:tracks";function $R(e){var t;null===(t=e.dash)||void 0===t||t.reset()}function JR(e,t,n){if(n.code==WR.MediaPlayer.errors.DOWNLOAD_ERROR_ID_CONTENT_CODE)return;if(t.errored)return;if(t.recover_count<3)return t.recover_count+=1,void eb(e,e.original_src);t.errored=!0;const r=n.error||"playback failed";e.emit("error",{message:r}),$R(e)}function eb(e,t){const n=e.dash;n&&(n.setAutoPlay(!0),n.attachSource(t))}class tb{init(e,t,n){n.on("recover",()=>eb(n,n.original_src)),n.on("src",()=>$R(n)),n.on("reap",()=>{$R(n),this.dash=n.dash=void 0}),n.on("quality:set",(function(e){!function(e,t){var n;const r=e.dash;if(!r)return;const i=null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.qualityIndex;if(!i)return;const a={streaming:{abr:{autoSwitchBitrate:{video:-1===i}}}};r.updateSettings(a),-1!==i&&r.setQualityFor("video",i)}(n,e)})),n.on(XR,(function(e){!function(e,t){var n;t.data&&(null===(n=e.dash)||void 0===n||n.setCurrentTrack(t.data))}(n,e)}))}onload(e,t,n,{src:r}){var i,a;if(this.dash&&this.dash.reset(),this.dash||(this.dash=n.dash=WR.MediaPlayer().create()),null===(i=e.dash)||void 0===i?void 0:i.drm){if("https:"!==location.protocol&&"localhost"!==location.hostname&&"127.0.0.1"!==location.hostname)return void n.emit("error",{message:"Secure page required for DRM"});this.dash.setProtectionData(null===(a=e.dash)||void 0===a?void 0:a.drm)}this.dash.initialize(n,r,!!e.autoplay),this.wireup(n,this.dash,e)}wants(e,t,n){return l(e,t)}wireup(e,t,n){const r="live"in n,i={seek_timer:void 0,initial_stream_init:!0,errored:!1,recover_count:0};t.on(WR.MediaPlayer.events.STREAM_INITIALIZED,(function(){i.initial_stream_init=!0,i.recover_count=0,r&&e.setOpts({live:t.isDynamic()}),function(e){const{dash:t}=e;if(!t)return;const n=(t.getBitrateInfoListFor("video")||[]).sort((e,t)=>t.width-e.width);n.push({text:"AUTO",qualityIndex:-1}),e.emit("qualities",n)}(e),function(e,t){if(!t.initial_stream_init)return;if(!e.dash)return;t.initial_stream_init=!1;const n=(e.dash.getTracksFor("audio")||[]).map((function(e){return e.autoselect=!0,e}));e.emit(ZR,n)}(e,i)})),t.on(WR.MediaPlayer.events.TRACK_CHANGE_RENDERED,(function(t){"audio"===t.mediaType&&t.newMediaInfo&&e.emit(QR,t.newMediaInfo)})),t.on(WR.MediaPlayer.events.PLAYBACK_PROGRESS,(function(){!function(e){const{dash:t}=e;if(!t)return;const n=t.isDynamic();e.opt("live")==n||e.setOpts({live:n})}(e)})),t.on(WR.MediaPlayer.events.ERROR,(function(t){JR(e,i,t)})),t.on(WR.MediaPlayer.events.KEY_ERROR,(function(t){JR(e,i,t)}))}}return tb.MediaPlayer=WR.MediaPlayer,"function"==typeof MediaSource&&function(e,t){if("object"==typeof exports&&"undefined"!=typeof module)return t;"flowplayer"in e||(e.flowplayer={extensions:[]});const n=e.flowplayer;"function"==typeof n?n(t):(Array.isArray(n.extensions)||(n.extensions=[]),~n.extensions.indexOf(t)||n.extensions.push(t))}(window,tb),tb}));