u),this.customParsers.push(u=>{if(e.exec(u))return this.trigger("data",{type:"custom",data:r(u),customType:i,segment:o}),!0})}addTagMapper({expression:e,map:i}){const r=o=>e.test(o)?i(o):o;this.tagMappers.push(r)}}const Ik=s=>s.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),_a=function(s){const e={};return Object.keys(s).forEach(function(i){e[Ik(i)]=s[i]}),e},$g=function(s){const{serverControl:e,targetDuration:i,partTargetDuration:r}=s;if(!e)return;const o="#EXT-X-SERVER-CONTROL",u="holdBack",c="partHoldBack",p=i&&i*3,g=r&&r*2;i&&!e.hasOwnProperty(u)&&(e[u]=p,this.trigger("info",{message:`${o} defaulting HOLD-BACK to targetDuration * 3 (${p}).`})),p&&e[u]{o.uri||!o.parts&&!o.preloadHints||(!o.map&&u&&(o.map=u),!o.key&&c&&(o.key=c),!o.timeline&&typeof E=="number"&&(o.timeline=E),this.manifest.preloadSegment=o)}),this.parseStream.on("data",function(D){let z,H;if(i.manifest.definitions){for(const Y in i.manifest.definitions)if(D.uri&&(D.uri=D.uri.replace(`{$${Y}}`,i.manifest.definitions[Y])),D.attributes)for(const V in D.attributes)typeof D.attributes[V]=="string"&&(D.attributes[V]=D.attributes[V].replace(`{$${Y}}`,i.manifest.definitions[Y]))}({tag(){({version(){D.version&&(this.manifest.version=D.version)},"allow-cache"(){this.manifest.allowCache=D.allowed,"allowed"in D||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const Y={};"length"in D&&(o.byterange=Y,Y.length=D.length,"offset"in D||(D.offset=A)),"offset"in D&&(o.byterange=Y,Y.offset=D.offset),A=Y.offset+Y.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),D.title&&(o.title=D.title),D.duration>0&&(o.duration=D.duration),D.duration===0&&(o.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=r},key(){if(!D.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(D.attributes.METHOD==="NONE"){c=null;return}if(!D.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(D.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:D.attributes};return}if(D.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:D.attributes.URI};return}if(D.attributes.KEYFORMAT===S){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(D.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(D.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),D.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(D.attributes.KEYID&&D.attributes.KEYID.substring(0,2)==="0x")){this.trigger("warn",{message:"invalid key ID provided for Widevine"});return}this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:D.attributes.KEYFORMAT,keyId:D.attributes.KEYID.substring(2)},pssh:Z_(D.attributes.URI.split(",")[1])};return}D.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),c={method:D.attributes.METHOD||"AES-128",uri:D.attributes.URI},typeof D.attributes.IV<"u"&&(c.iv=D.attributes.IV)},"media-sequence"(){if(!isFinite(D.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+D.number});return}this.manifest.mediaSequence=D.number},"discontinuity-sequence"(){if(!isFinite(D.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+D.number});return}this.manifest.discontinuitySequence=D.number,E=D.number},"playlist-type"(){if(!/VOD|EVENT/.test(D.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+D.playlist});return}this.manifest.playlistType=D.playlistType},map(){u={},D.uri&&(u.uri=D.uri),D.byterange&&(u.byterange=D.byterange),c&&(u.key=c)},"stream-inf"(){if(this.manifest.playlists=r,this.manifest.mediaGroups=this.manifest.mediaGroups||b,!D.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}o.attributes||(o.attributes={}),Ft(o.attributes,D.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||b,!(D.attributes&&D.attributes.TYPE&&D.attributes["GROUP-ID"]&&D.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}const Y=this.manifest.mediaGroups[D.attributes.TYPE];Y[D.attributes["GROUP-ID"]]=Y[D.attributes["GROUP-ID"]]||{},z=Y[D.attributes["GROUP-ID"]],H={default:/yes/i.test(D.attributes.DEFAULT)},H.default?H.autoselect=!0:H.autoselect=/yes/i.test(D.attributes.AUTOSELECT),D.attributes.LANGUAGE&&(H.language=D.attributes.LANGUAGE),D.attributes.URI&&(H.uri=D.attributes.URI),D.attributes["INSTREAM-ID"]&&(H.instreamId=D.attributes["INSTREAM-ID"]),D.attributes.CHARACTERISTICS&&(H.characteristics=D.attributes.CHARACTERISTICS),D.attributes.FORCED&&(H.forced=/yes/i.test(D.attributes.FORCED)),z[D.attributes.NAME]=H},discontinuity(){E+=1,o.discontinuity=!0,this.manifest.discontinuityStarts.push(r.length)},"program-date-time"(){typeof this.manifest.dateTimeString>"u"&&(this.manifest.dateTimeString=D.dateTimeString,this.manifest.dateTimeObject=D.dateTimeObject),o.dateTimeString=D.dateTimeString,o.dateTimeObject=D.dateTimeObject;const{lastProgramDateTime:Y}=this;this.lastProgramDateTime=new Date(D.dateTimeString).getTime(),Y===null&&this.manifest.segments.reduceRight((V,Q)=>(Q.programDateTime=V-Q.duration*1e3,Q.programDateTime),this.lastProgramDateTime)},targetduration(){if(!isFinite(D.duration)||D.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+D.duration});return}this.manifest.targetDuration=D.duration,$g.call(this,this.manifest)},start(){if(!D.attributes||isNaN(D.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:D.attributes["TIME-OFFSET"],precise:D.attributes.PRECISE}},"cue-out"(){o.cueOut=D.data},"cue-out-cont"(){o.cueOutCont=D.data},"cue-in"(){o.cueIn=D.data},skip(){this.manifest.skip=_a(D.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",D.attributes,["SKIPPED-SEGMENTS"])},part(){p=!0;const Y=this.manifest.segments.length,V=_a(D.attributes);o.parts=o.parts||[],o.parts.push(V),V.byterange&&(V.byterange.hasOwnProperty("offset")||(V.byterange.offset=M),M=V.byterange.offset+V.byterange.length);const Q=o.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${Q} for segment #${Y}`,D.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((Z,W)=>{Z.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${W} lacks required attribute(s): LAST-PART`})})},"server-control"(){const Y=this.manifest.serverControl=_a(D.attributes);Y.hasOwnProperty("canBlockReload")||(Y.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),$g.call(this,this.manifest),Y.canSkipDateranges&&!Y.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){const Y=this.manifest.segments.length,V=_a(D.attributes),Q=V.type&&V.type==="PART";o.preloadHints=o.preloadHints||[],o.preloadHints.push(V),V.byterange&&(V.byterange.hasOwnProperty("offset")||(V.byterange.offset=Q?M:0,Q&&(M=V.byterange.offset+V.byterange.length)));const Z=o.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${Z} for segment #${Y}`,D.attributes,["TYPE","URI"]),!!V.type)for(let W=0;WW.id===V.id);this.manifest.dateRanges[Z]=Ft(this.manifest.dateRanges[Z],V),U[V.id]=Ft(U[V.id],V),this.manifest.dateRanges.pop()}},"independent-segments"(){this.manifest.independentSegments=!0},"i-frames-only"(){this.manifest.iFramesOnly=!0,this.requiredCompatibilityversion(this.manifest.version,4)},"content-steering"(){this.manifest.contentSteering=_a(D.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",D.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};const Y=(V,Q)=>{if(V in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${V}`});return}this.manifest.definitions[V]=Q};if("QUERYPARAM"in D.attributes){if("NAME"in D.attributes||"IMPORT"in D.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}const V=this.params.get(D.attributes.QUERYPARAM);if(!V){this.trigger("error",{message:`EXT-X-DEFINE: No query param ${D.attributes.QUERYPARAM}`});return}Y(D.attributes.QUERYPARAM,decodeURIComponent(V));return}if("NAME"in D.attributes){if("IMPORT"in D.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}if(!("VALUE"in D.attributes)||typeof D.attributes.VALUE!="string"){this.trigger("error",{message:`EXT-X-DEFINE: No value for ${D.attributes.NAME}`});return}Y(D.attributes.NAME,D.attributes.VALUE);return}if("IMPORT"in D.attributes){if(!this.mainDefinitions[D.attributes.IMPORT]){this.trigger("error",{message:`EXT-X-DEFINE: No value ${D.attributes.IMPORT} to import, or IMPORT used on main playlist`});return}Y(D.attributes.IMPORT,this.mainDefinitions[D.attributes.IMPORT]);return}this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:D.attributes,uri:D.uri,timeline:E}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",D.attributes,["BANDWIDTH","URI"])}}[D.tagType]||g).call(i)},uri(){o.uri=D.uri,r.push(o),this.manifest.targetDuration&&!("duration"in o)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),o.duration=this.manifest.targetDuration),c&&(o.key=c),o.timeline=E,u&&(o.map=u),M=0,this.lastProgramDateTime!==null&&(o.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=o.duration*1e3),o={}},comment(){},custom(){D.segment?(o.custom=o.custom||{},o.custom[D.customType]=D.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[D.customType]=D.data)}})[D.type].call(i)})}requiredCompatibilityversion(e,i){(eE&&(S-=E,S-=E,S-=bi(2))}return Number(S)},Gk=function(e,i){var r=i===void 0?{}:i,o=r.le,u=o===void 0?!1:o;(typeof e!="bigint"&&typeof e!="number"||typeof e=="number"&&e!==e)&&(e=0),e=bi(e);for(var c=qk(e),p=new Uint8Array(new ArrayBuffer(c)),g=0;g=i.length&&b.call(i,function(S,E){var A=g[E]?g[E]&e[c+E]:e[c+E];return S===A})},Yk=function(e,i,r){i.forEach(function(o){for(var u in e.mediaGroups[o])for(var c in e.mediaGroups[o][u]){var p=e.mediaGroups[o][u][c];r(p,o,u,c)}})},Ta={},Cr={};function Wk(s,e,i){if(i===void 0&&(i=Array.prototype),s&&typeof i.find=="function")return i.find.call(s,e);for(var r=0;r=0&&s=0){for(var o=e.length-1;r0},lookupPrefix:function(s){for(var e=this;e;){var i=e._nsMap;if(i){for(var r in i)if(Object.prototype.hasOwnProperty.call(i,r)&&i[r]===s)return r}e=e.nodeType==zl?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(s){for(var e=this;e;){var i=e._nsMap;if(i&&Object.prototype.hasOwnProperty.call(i,s))return i[s];e=e.nodeType==zl?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(s){var e=this.lookupPrefix(s);return e==null}};function xT(s){return s=="<"&&"<"||s==">"&&">"||s=="&"&&"&"||s=='"'&&"""||""+s.charCodeAt()+";"}sd(sn,yt),sd(sn,yt.prototype);function rd(s,e){if(e(s))return!0;if(s=s.firstChild)do if(rd(s,e))return!0;while(s=s.nextSibling)}function ad(){this.ownerDocument=this}function nO(s,e,i){s&&s._inc++;var r=i.namespaceURI;r===nd.XMLNS&&(e._nsMap[i.prefix?i.localName:""]=i.value)}function ET(s,e,i,r){s&&s._inc++;var o=i.namespaceURI;o===nd.XMLNS&&delete e._nsMap[i.prefix?i.localName:""]}function Qg(s,e,i){if(s&&s._inc){s._inc++;var r=e.childNodes;if(i)r[r.length++]=i;else{for(var o=e.firstChild,u=0;o;)r[u++]=o,o=o.nextSibling;r.length=u,delete r[r.length]}}}function CT(s,e){var i=e.previousSibling,r=e.nextSibling;return i?i.nextSibling=r:s.firstChild=r,r?r.previousSibling=i:s.lastChild=i,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,Qg(s.ownerDocument,s),e}function sO(s){return s&&(s.nodeType===yt.DOCUMENT_NODE||s.nodeType===yt.DOCUMENT_FRAGMENT_NODE||s.nodeType===yt.ELEMENT_NODE)}function rO(s){return s&&(Ls(s)||Kg(s)||wr(s)||s.nodeType===yt.DOCUMENT_FRAGMENT_NODE||s.nodeType===yt.COMMENT_NODE||s.nodeType===yt.PROCESSING_INSTRUCTION_NODE)}function wr(s){return s&&s.nodeType===yt.DOCUMENT_TYPE_NODE}function Ls(s){return s&&s.nodeType===yt.ELEMENT_NODE}function Kg(s){return s&&s.nodeType===yt.TEXT_NODE}function AT(s,e){var i=s.childNodes||[];if(Ms(i,Ls)||wr(e))return!1;var r=Ms(i,wr);return!(e&&r&&i.indexOf(r)>i.indexOf(e))}function DT(s,e){var i=s.childNodes||[];function r(u){return Ls(u)&&u!==e}if(Ms(i,r))return!1;var o=Ms(i,wr);return!(e&&o&&i.indexOf(o)>i.indexOf(e))}function aO(s,e,i){if(!sO(s))throw new Xt(rn,"Unexpected parent node type "+s.nodeType);if(i&&i.parentNode!==s)throw new Xt(yT,"child not in parent");if(!rO(e)||wr(e)&&s.nodeType!==yt.DOCUMENT_NODE)throw new Xt(rn,"Unexpected node type "+e.nodeType+" for parent node type "+s.nodeType)}function oO(s,e,i){var r=s.childNodes||[],o=e.childNodes||[];if(e.nodeType===yt.DOCUMENT_FRAGMENT_NODE){var u=o.filter(Ls);if(u.length>1||Ms(o,Kg))throw new Xt(rn,"More than one element or text in fragment");if(u.length===1&&!AT(s,i))throw new Xt(rn,"Element in fragment can not be inserted before doctype")}if(Ls(e)&&!AT(s,i))throw new Xt(rn,"Only one element can be added and only after doctype");if(wr(e)){if(Ms(r,wr))throw new Xt(rn,"Only one doctype is allowed");var c=Ms(r,Ls);if(i&&r.indexOf(c)1||Ms(o,Kg))throw new Xt(rn,"More than one element or text in fragment");if(u.length===1&&!DT(s,i))throw new Xt(rn,"Element in fragment can not be inserted before doctype")}if(Ls(e)&&!DT(s,i))throw new Xt(rn,"Only one element can be added and only after doctype");if(wr(e)){if(Ms(r,function(g){return wr(g)&&g!==i}))throw new Xt(rn,"Only one doctype is allowed");var c=Ms(r,Ls);if(i&&r.indexOf(c)0&&rd(i.documentElement,function(o){if(o!==i&&o.nodeType===cs){var u=o.getAttribute("class");if(u){var c=s===u;if(!c){var p=cT(u);c=e.every(eO(p))}c&&r.push(o)}}}),r})},createElement:function(s){var e=new Co;e.ownerDocument=this,e.nodeName=s,e.tagName=s,e.localName=s,e.childNodes=new Dr;var i=e.attributes=new Uf;return i._ownerElement=e,e},createDocumentFragment:function(){var s=new zf;return s.ownerDocument=this,s.childNodes=new Dr,s},createTextNode:function(s){var e=new Zg;return e.ownerDocument=this,e.appendData(s),e},createComment:function(s){var e=new Jg;return e.ownerDocument=this,e.appendData(s),e},createCDATASection:function(s){var e=new e0;return e.ownerDocument=this,e.appendData(s),e},createProcessingInstruction:function(s,e){var i=new i0;return i.ownerDocument=this,i.tagName=i.nodeName=i.target=s,i.nodeValue=i.data=e,i},createAttribute:function(s){var e=new Ff;return e.ownerDocument=this,e.name=s,e.nodeName=s,e.localName=s,e.specified=!0,e},createEntityReference:function(s){var e=new t0;return e.ownerDocument=this,e.nodeName=s,e},createElementNS:function(s,e){var i=new Co,r=e.split(":"),o=i.attributes=new Uf;return i.childNodes=new Dr,i.ownerDocument=this,i.nodeName=e,i.tagName=e,i.namespaceURI=s,r.length==2?(i.prefix=r[0],i.localName=r[1]):i.localName=e,o._ownerElement=i,i},createAttributeNS:function(s,e){var i=new Ff,r=e.split(":");return i.ownerDocument=this,i.nodeName=e,i.name=e,i.namespaceURI=s,i.specified=!0,r.length==2?(i.prefix=r[0],i.localName=r[1]):i.localName=e,i}},nn(ad,yt);function Co(){this._nsMap={}}Co.prototype={nodeType:cs,hasAttribute:function(s){return this.getAttributeNode(s)!=null},getAttribute:function(s){var e=this.getAttributeNode(s);return e&&e.value||""},getAttributeNode:function(s){return this.attributes.getNamedItem(s)},setAttribute:function(s,e){var i=this.ownerDocument.createAttribute(s);i.value=i.nodeValue=""+e,this.setAttributeNode(i)},removeAttribute:function(s){var e=this.getAttributeNode(s);e&&this.removeAttributeNode(e)},appendChild:function(s){return s.nodeType===Ar?this.insertBefore(s,null):lO(this,s)},setAttributeNode:function(s){return this.attributes.setNamedItem(s)},setAttributeNodeNS:function(s){return this.attributes.setNamedItemNS(s)},removeAttributeNode:function(s){return this.attributes.removeNamedItem(s.nodeName)},removeAttributeNS:function(s,e){var i=this.getAttributeNodeNS(s,e);i&&this.removeAttributeNode(i)},hasAttributeNS:function(s,e){return this.getAttributeNodeNS(s,e)!=null},getAttributeNS:function(s,e){var i=this.getAttributeNodeNS(s,e);return i&&i.value||""},setAttributeNS:function(s,e,i){var r=this.ownerDocument.createAttributeNS(s,e);r.value=r.nodeValue=""+i,this.setAttributeNode(r)},getAttributeNodeNS:function(s,e){return this.attributes.getNamedItemNS(s,e)},getElementsByTagName:function(s){return new jl(this,function(e){var i=[];return rd(e,function(r){r!==e&&r.nodeType==cs&&(s==="*"||r.tagName==s)&&i.push(r)}),i})},getElementsByTagNameNS:function(s,e){return new jl(this,function(i){var r=[];return rd(i,function(o){o!==i&&o.nodeType===cs&&(s==="*"||o.namespaceURI===s)&&(e==="*"||o.localName==e)&&r.push(o)}),r})}},ad.prototype.getElementsByTagName=Co.prototype.getElementsByTagName,ad.prototype.getElementsByTagNameNS=Co.prototype.getElementsByTagNameNS,nn(Co,yt);function Ff(){}Ff.prototype.nodeType=zl,nn(Ff,yt);function od(){}od.prototype={data:"",substringData:function(s,e){return this.data.substring(s,s+e)},appendData:function(s){s=this.data+s,this.nodeValue=this.data=s,this.length=s.length},insertData:function(s,e){this.replaceData(s,0,e)},appendChild:function(s){throw new Error(ci[rn])},deleteData:function(s,e){this.replaceData(s,e,"")},replaceData:function(s,e,i){var r=this.data.substring(0,s),o=this.data.substring(s+e);i=r+i+o,this.nodeValue=this.data=i,this.length=i.length}},nn(od,yt);function Zg(){}Zg.prototype={nodeName:"#text",nodeType:Pf,splitText:function(s){var e=this.data,i=e.substring(s);e=e.substring(0,s),this.data=this.nodeValue=e,this.length=e.length;var r=this.ownerDocument.createTextNode(i);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}},nn(Zg,od);function Jg(){}Jg.prototype={nodeName:"#comment",nodeType:pT},nn(Jg,od);function e0(){}e0.prototype={nodeName:"#cdata-section",nodeType:dT},nn(e0,od);function Hf(){}Hf.prototype.nodeType=gT,nn(Hf,yt);function kT(){}kT.prototype.nodeType=iO,nn(kT,yt);function OT(){}OT.prototype.nodeType=tO,nn(OT,yt);function t0(){}t0.prototype.nodeType=hT,nn(t0,yt);function zf(){}zf.prototype.nodeName="#document-fragment",zf.prototype.nodeType=Ar,nn(zf,yt);function i0(){}i0.prototype.nodeType=fT,nn(i0,yt);function RT(){}RT.prototype.serializeToString=function(s,e,i){return MT.call(s,e,i)},yt.prototype.toString=MT;function MT(s,e){var i=[],r=this.nodeType==9&&this.documentElement||this,o=r.prefix,u=r.namespaceURI;if(u&&o==null){var o=r.lookupPrefix(u);if(o==null)var c=[{namespace:u,prefix:null}]}return ql(this,i,s,e,c),i.join("")}function LT(s,e,i){var r=s.prefix||"",o=s.namespaceURI;if(!o||r==="xml"&&o===nd.XML||o===nd.XMLNS)return!1;for(var u=i.length;u--;){var c=i[u];if(c.prefix===r)return c.namespace!==o}return!0}function n0(s,e,i){s.push(" ",e,'="',i.replace(/[<>&"\t\n\r]/g,xT),'"')}function ql(s,e,i,r,o){if(o||(o=[]),r)if(s=r(s),s){if(typeof s=="string"){e.push(s);return}}else return;switch(s.nodeType){case cs:var u=s.attributes,c=u.length,H=s.firstChild,p=s.tagName;i=nd.isHTML(s.namespaceURI)||i;var g=p;if(!i&&!s.prefix&&s.namespaceURI){for(var b,S=0;S=0;E--){var A=o[E];if(A.prefix===""&&A.namespace===s.namespaceURI){b=A.namespace;break}}if(b!==s.namespaceURI)for(var E=o.length-1;E>=0;E--){var A=o[E];if(A.namespace===s.namespaceURI){A.prefix&&(g=A.prefix+":"+p);break}}}e.push("<",g);for(var M=0;M"),i&&/^script$/i.test(p))for(;H;)H.data?e.push(H.data):ql(H,e,i,r,o.slice()),H=H.nextSibling;else for(;H;)ql(H,e,i,r,o.slice()),H=H.nextSibling;e.push("",g,">")}else e.push("/>");return;case mT:case Ar:for(var H=s.firstChild;H;)ql(H,e,i,r,o.slice()),H=H.nextSibling;return;case zl:return n0(e,s.name,s.value);case Pf:return e.push(s.data.replace(/[<&>]/g,xT));case dT:return e.push("");case pT:return e.push("");case gT:var Y=s.publicId,V=s.systemId;if(e.push("");else if(V&&V!=".")e.push(" SYSTEM ",V,">");else{var Q=s.internalSubset;Q&&e.push(" [",Q,"]"),e.push(">")}return;case fT:return e.push("",s.target," ",s.data,"?>");case hT:return e.push("&",s.nodeName,";");default:e.push("??",s.nodeName)}}function IT(s,e,i){var r;switch(e.nodeType){case cs:r=e.cloneNode(!1),r.ownerDocument=s;case Ar:break;case zl:i=!0;break}if(r||(r=e.cloneNode(!1)),r.ownerDocument=s,r.parentNode=null,i)for(var o=e.firstChild;o;)r.appendChild(IT(s,o,i)),o=o.nextSibling;return r}function s0(s,e,i){var r=new e.constructor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var u=e[o];typeof u!="object"&&u!=r[o]&&(r[o]=u)}switch(e.childNodes&&(r.childNodes=new Dr),r.ownerDocument=s,r.nodeType){case cs:var c=e.attributes,p=r.attributes=new Uf,g=c.length;p._ownerElement=r;for(var b=0;b",lt:"<",quot:'"'}),s.HTML_ENTITIES=e({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:`
-`,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"",zwnj:""}),s.entityMap=s.HTML_ENTITIES})(PT);var r0={},ld=Cr.NAMESPACE,a0=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,UT=new RegExp("[\\-\\.0-9"+a0.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),BT=new RegExp("^"+a0.source+UT.source+"*(?::"+a0.source+UT.source+"*)?$"),ud=0,Sa=1,Vl=2,cd=3,$l=4,Gl=5,dd=6,qf=7;function Xl(s,e){this.message=s,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,Xl)}Xl.prototype=new Error,Xl.prototype.name=Xl.name;function FT(){}FT.prototype={parse:function(s,e,i){var r=this.domBuilder;r.startDocument(),jT(e,e={}),uO(s,e,i,r,this.errorHandler),r.endDocument()}};function uO(s,e,i,r,o){function u(de){if(de>65535){de-=65536;var Ee=55296+(de>>10),Re=56320+(de&1023);return String.fromCharCode(Ee,Re)}else return String.fromCharCode(de)}function c(de){var Ee=de.slice(1,-1);return Object.hasOwnProperty.call(i,Ee)?i[Ee]:Ee.charAt(0)==="#"?u(parseInt(Ee.substr(1).replace("x","0x"))):(o.error("entity not found:"+de),de)}function p(de){if(de>D){var Ee=s.substring(D,de).replace(/?\w+;/g,c);A&&g(D),r.characters(Ee,0,de-D),D=de}}function g(de,Ee){for(;de>=S&&(Ee=E.exec(s));)b=Ee.index,S=b+Ee[0].length,A.lineNumber++;A.columnNumber=de-b+1}for(var b=0,S=0,E=/.*(?:\r\n?|\n)|.*$/g,A=r.locator,M=[{currentNSMap:e}],U={},D=0;;){try{var z=s.indexOf("<",D);if(z<0){if(!s.substr(D).match(/^\s*$/)){var H=r.doc,Y=H.createTextNode(s.substr(D));H.appendChild(Y),r.currentElement=Y}return}switch(z>D&&p(z),s.charAt(z+1)){case"/":var fe=s.indexOf(">",z+3),V=s.substring(z+2,fe).replace(/[ \t\n\r]+$/g,""),Q=M.pop();fe<0?(V=s.substring(z+2).replace(/[\s<].*/,""),o.error("end tag name: "+V+" is not complete:"+Q.tagName),fe=z+1+V.length):V.match(/\s)&&(V=V.replace(/[\s<].*/,""),o.error("end tag name: "+V+" maybe not complete"),fe=z+1+V.length);var Z=Q.localNSMap,W=Q.tagName==V,G=W||Q.tagName&&Q.tagName.toLowerCase()==V.toLowerCase();if(G){if(r.endElement(Q.uri,Q.localName,V),Z)for(var ee in Z)Object.prototype.hasOwnProperty.call(Z,ee)&&r.endPrefixMapping(ee);W||o.fatalError("end tag name: "+V+" is not match the current start tagName:"+Q.tagName)}else M.push(Q);fe++;break;case"?":A&&g(z),fe=pO(s,z,r);break;case"!":A&&g(z),fe=fO(s,z,r,o);break;default:A&&g(z);var oe=new qT,_e=M[M.length-1].currentNSMap,fe=cO(s,z,oe,_e,c,o),xe=oe.length;if(!oe.closed&&hO(s,fe,oe.tagName,U)&&(oe.closed=!0,i.nbsp||o.warning("unclosed xml attribute")),A&&xe){for(var ve=HT(A,{}),Ne=0;NeD?D=fe:p(Math.max(z,D)+1)}}function HT(s,e){return e.lineNumber=s.lineNumber,e.columnNumber=s.columnNumber,e}function cO(s,e,i,r,o,u){function c(A,M,U){i.attributeNames.hasOwnProperty(A)&&u.fatalError("Attribute "+A+" redefined"),i.addValue(A,M.replace(/[\t\n\r]/g," ").replace(/?\w+;/g,o),U)}for(var p,g,b=++e,S=ud;;){var E=s.charAt(b);switch(E){case"=":if(S===Sa)p=s.slice(e,b),S=cd;else if(S===Vl)S=cd;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(S===cd||S===Sa)if(S===Sa&&(u.warning('attribute value must after "="'),p=s.slice(e,b)),e=b+1,b=s.indexOf(E,e),b>0)g=s.slice(e,b),c(p,g,e-1),S=Gl;else throw new Error("attribute value no end '"+E+"' match");else if(S==$l)g=s.slice(e,b),c(p,g,e),u.warning('attribute "'+p+'" missed start quot('+E+")!!"),e=b+1,S=Gl;else throw new Error('attribute value must after "="');break;case"/":switch(S){case ud:i.setTagName(s.slice(e,b));case Gl:case dd:case qf:S=qf,i.closed=!0;case $l:case Sa:break;case Vl:i.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return u.error("unexpected end of input"),S==ud&&i.setTagName(s.slice(e,b)),b;case">":switch(S){case ud:i.setTagName(s.slice(e,b));case Gl:case dd:case qf:break;case $l:case Sa:g=s.slice(e,b),g.slice(-1)==="/"&&(i.closed=!0,g=g.slice(0,-1));case Vl:S===Vl&&(g=p),S==$l?(u.warning('attribute "'+g+'" missed quot(")!'),c(p,g,e)):((!ld.isHTML(r[""])||!g.match(/^(?:disabled|checked|selected)$/i))&&u.warning('attribute "'+g+'" missed value!! "'+g+'" instead!!'),c(g,g,e));break;case cd:throw new Error("attribute value missed!!")}return b;case"":E=" ";default:if(E<=" ")switch(S){case ud:i.setTagName(s.slice(e,b)),S=dd;break;case Sa:p=s.slice(e,b),S=Vl;break;case $l:var g=s.slice(e,b);u.warning('attribute "'+g+'" missed quot(")!!'),c(p,g,e);case Gl:S=dd;break}else switch(S){case Vl:i.tagName,(!ld.isHTML(r[""])||!p.match(/^(?:disabled|checked|selected)$/i))&&u.warning('attribute "'+p+'" missed value!! "'+p+'" instead2!!'),c(p,p,e),e=b,S=Sa;break;case Gl:u.warning('attribute space is required"'+p+'"!!');case dd:S=Sa,e=b;break;case cd:S=$l,e=b;break;case qf:throw new Error("elements closed character '/' and '>' must be connected to")}}b++}}function zT(s,e,i){for(var r=s.tagName,o=null,E=s.length;E--;){var u=s[E],c=u.qName,p=u.value,A=c.indexOf(":");if(A>0)var g=u.prefix=c.slice(0,A),b=c.slice(A+1),S=g==="xmlns"&&b;else b=c,g=null,S=c==="xmlns"&&"";u.localName=b,S!==!1&&(o==null&&(o={},jT(i,i={})),i[S]=o[S]=p,u.uri=ld.XMLNS,e.startPrefixMapping(S,p))}for(var E=s.length;E--;){u=s[E];var g=u.prefix;g&&(g==="xml"&&(u.uri=ld.XML),g!=="xmlns"&&(u.uri=i[g||""]))}var A=r.indexOf(":");A>0?(g=s.prefix=r.slice(0,A),b=s.localName=r.slice(A+1)):(g=null,b=s.localName=r);var M=s.uri=i[g||""];if(e.startElement(M,b,r,s),s.closed){if(e.endElement(M,b,r),o)for(g in o)Object.prototype.hasOwnProperty.call(o,g)&&e.endPrefixMapping(g)}else return s.currentNSMap=i,s.localNSMap=o,!0}function dO(s,e,i,r,o){if(/^(?:script|textarea)$/i.test(i)){var u=s.indexOf(""+i+">",e),c=s.substring(e+1,u);if(/[&<]/.test(c))return/^script$/i.test(i)?(o.characters(c,0,c.length),u):(c=c.replace(/?\w+;/g,r),o.characters(c,0,c.length),u)}return e+1}function hO(s,e,i,r){var o=r[i];return o==null&&(o=s.lastIndexOf(""+i+">"),o",e+4);return u>e?(i.comment(s,e+4,u-e-4),u+3):(r.error("Unclosed comment"),-1)}else return-1;default:if(s.substr(e+3,6)=="CDATA["){var u=s.indexOf("]]>",e+9);return i.startCDATA(),i.characters(s,e+9,u-e-9),i.endCDATA(),u+3}var c=mO(s,e),p=c.length;if(p>1&&/!doctype/i.test(c[0][0])){var g=c[1][0],b=!1,S=!1;p>3&&(/^public$/i.test(c[2][0])?(b=c[3][0],S=p>4&&c[4][0]):/^system$/i.test(c[2][0])&&(S=c[3][0]));var E=c[p-1];return i.startDTD(g,b,S),i.endDTD(),E.index+E[0].length}}return-1}function pO(s,e,i){var r=s.indexOf("?>",e);if(r){var o=s.substring(e,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return o?(o[0].length,i.processingInstruction(o[1],o[2]),r+2):-1}return-1}function qT(){this.attributeNames={}}qT.prototype={setTagName:function(s){if(!BT.test(s))throw new Error("invalid tagName:"+s);this.tagName=s},addValue:function(s,e,i){if(!BT.test(s))throw new Error("invalid attribute:"+s);this.attributeNames[s]=this.length,this[this.length++]={qName:s,value:e,offset:i}},length:0,getLocalName:function(s){return this[s].localName},getLocator:function(s){return this[s].locator},getQName:function(s){return this[s].qName},getURI:function(s){return this[s].uri},getValue:function(s){return this[s].value}};function mO(s,e){var i,r=[],o=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(o.lastIndex=e,o.exec(s);i=o.exec(s);)if(r.push(i),i[1])return r}r0.XMLReader=FT,r0.ParseError=Xl;var gO=Cr,yO=Ta,VT=PT,$T=r0,vO=yO.DOMImplementation,GT=gO.NAMESPACE,bO=$T.ParseError,_O=$T.XMLReader;function XT(s){return s.replace(/\r[\n\u0085]/g,`
+`))this.trigger("data",this.buffer.substring(0,i)),this.buffer=this.buffer.substring(i+1)}}const Rk=String.fromCharCode(9),Vg=function(s){const e=/([0-9.]*)?@?([0-9.]*)?/.exec(s||""),i={};return e[1]&&(i.length=parseInt(e[1],10)),e[2]&&(i.offset=parseInt(e[2],10)),i},Mk=function(){const s="[^=]*",e='"[^"]*"|[^,]*',i="(?:"+s+")=(?:"+e+")";return new RegExp("(?:^|,)("+i+")")},qi=function(s){const e={};if(!s)return e;const i=s.split(Mk());let r=i.length,o;for(;r--;)i[r]!==""&&(o=/([^=]*)=(.*)/.exec(i[r]).slice(1),o[0]=o[0].replace(/^\s+|\s+$/g,""),o[1]=o[1].replace(/^\s+|\s+$/g,""),o[1]=o[1].replace(/^['"](.*)['"]$/g,"$1"),e[o[0]]=o[1]);return e},J_=s=>{const e=s.split("x"),i={};return e[0]&&(i.width=parseInt(e[0],10)),e[1]&&(i.height=parseInt(e[1],10)),i};class Lk extends qg{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let i,r;if(e=e.trim(),e.length===0)return;if(e[0]!=="#"){this.trigger("data",{type:"uri",uri:e});return}this.tagMappers.reduce((u,c)=>{const p=c(e);return p===e?u:u.concat([p])},[e]).forEach(u=>{for(let c=0;cu),this.customParsers.push(u=>{if(e.exec(u))return this.trigger("data",{type:"custom",data:r(u),customType:i,segment:o}),!0})}addTagMapper({expression:e,map:i}){const r=o=>e.test(o)?i(o):o;this.tagMappers.push(r)}}const Ik=s=>s.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),_a=function(s){const e={};return Object.keys(s).forEach(function(i){e[Ik(i)]=s[i]}),e},$g=function(s){const{serverControl:e,targetDuration:i,partTargetDuration:r}=s;if(!e)return;const o="#EXT-X-SERVER-CONTROL",u="holdBack",c="partHoldBack",p=i&&i*3,g=r&&r*2;i&&!e.hasOwnProperty(u)&&(e[u]=p,this.trigger("info",{message:`${o} defaulting HOLD-BACK to targetDuration * 3 (${p}).`})),p&&e[u]{o.uri||!o.parts&&!o.preloadHints||(!o.map&&u&&(o.map=u),!o.key&&c&&(o.key=c),!o.timeline&&typeof E=="number"&&(o.timeline=E),this.manifest.preloadSegment=o)}),this.parseStream.on("data",function(D){let z,H;if(i.manifest.definitions){for(const Y in i.manifest.definitions)if(D.uri&&(D.uri=D.uri.replace(`{$${Y}}`,i.manifest.definitions[Y])),D.attributes)for(const $ in D.attributes)typeof D.attributes[$]=="string"&&(D.attributes[$]=D.attributes[$].replace(`{$${Y}}`,i.manifest.definitions[Y]))}({tag(){({version(){D.version&&(this.manifest.version=D.version)},"allow-cache"(){this.manifest.allowCache=D.allowed,"allowed"in D||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const Y={};"length"in D&&(o.byterange=Y,Y.length=D.length,"offset"in D||(D.offset=A)),"offset"in D&&(o.byterange=Y,Y.offset=D.offset),A=Y.offset+Y.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),D.title&&(o.title=D.title),D.duration>0&&(o.duration=D.duration),D.duration===0&&(o.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=r},key(){if(!D.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(D.attributes.METHOD==="NONE"){c=null;return}if(!D.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(D.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:D.attributes};return}if(D.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:D.attributes.URI};return}if(D.attributes.KEYFORMAT===S){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(D.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(D.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),D.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(D.attributes.KEYID&&D.attributes.KEYID.substring(0,2)==="0x")){this.trigger("warn",{message:"invalid key ID provided for Widevine"});return}this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:D.attributes.KEYFORMAT,keyId:D.attributes.KEYID.substring(2)},pssh:Z_(D.attributes.URI.split(",")[1])};return}D.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),c={method:D.attributes.METHOD||"AES-128",uri:D.attributes.URI},typeof D.attributes.IV<"u"&&(c.iv=D.attributes.IV)},"media-sequence"(){if(!isFinite(D.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+D.number});return}this.manifest.mediaSequence=D.number},"discontinuity-sequence"(){if(!isFinite(D.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+D.number});return}this.manifest.discontinuitySequence=D.number,E=D.number},"playlist-type"(){if(!/VOD|EVENT/.test(D.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+D.playlist});return}this.manifest.playlistType=D.playlistType},map(){u={},D.uri&&(u.uri=D.uri),D.byterange&&(u.byterange=D.byterange),c&&(u.key=c)},"stream-inf"(){if(this.manifest.playlists=r,this.manifest.mediaGroups=this.manifest.mediaGroups||b,!D.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}o.attributes||(o.attributes={}),Ft(o.attributes,D.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||b,!(D.attributes&&D.attributes.TYPE&&D.attributes["GROUP-ID"]&&D.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}const Y=this.manifest.mediaGroups[D.attributes.TYPE];Y[D.attributes["GROUP-ID"]]=Y[D.attributes["GROUP-ID"]]||{},z=Y[D.attributes["GROUP-ID"]],H={default:/yes/i.test(D.attributes.DEFAULT)},H.default?H.autoselect=!0:H.autoselect=/yes/i.test(D.attributes.AUTOSELECT),D.attributes.LANGUAGE&&(H.language=D.attributes.LANGUAGE),D.attributes.URI&&(H.uri=D.attributes.URI),D.attributes["INSTREAM-ID"]&&(H.instreamId=D.attributes["INSTREAM-ID"]),D.attributes.CHARACTERISTICS&&(H.characteristics=D.attributes.CHARACTERISTICS),D.attributes.FORCED&&(H.forced=/yes/i.test(D.attributes.FORCED)),z[D.attributes.NAME]=H},discontinuity(){E+=1,o.discontinuity=!0,this.manifest.discontinuityStarts.push(r.length)},"program-date-time"(){typeof this.manifest.dateTimeString>"u"&&(this.manifest.dateTimeString=D.dateTimeString,this.manifest.dateTimeObject=D.dateTimeObject),o.dateTimeString=D.dateTimeString,o.dateTimeObject=D.dateTimeObject;const{lastProgramDateTime:Y}=this;this.lastProgramDateTime=new Date(D.dateTimeString).getTime(),Y===null&&this.manifest.segments.reduceRight(($,Q)=>(Q.programDateTime=$-Q.duration*1e3,Q.programDateTime),this.lastProgramDateTime)},targetduration(){if(!isFinite(D.duration)||D.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+D.duration});return}this.manifest.targetDuration=D.duration,$g.call(this,this.manifest)},start(){if(!D.attributes||isNaN(D.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:D.attributes["TIME-OFFSET"],precise:D.attributes.PRECISE}},"cue-out"(){o.cueOut=D.data},"cue-out-cont"(){o.cueOutCont=D.data},"cue-in"(){o.cueIn=D.data},skip(){this.manifest.skip=_a(D.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",D.attributes,["SKIPPED-SEGMENTS"])},part(){p=!0;const Y=this.manifest.segments.length,$=_a(D.attributes);o.parts=o.parts||[],o.parts.push($),$.byterange&&($.byterange.hasOwnProperty("offset")||($.byterange.offset=M),M=$.byterange.offset+$.byterange.length);const Q=o.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${Q} for segment #${Y}`,D.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((Z,W)=>{Z.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${W} lacks required attribute(s): LAST-PART`})})},"server-control"(){const Y=this.manifest.serverControl=_a(D.attributes);Y.hasOwnProperty("canBlockReload")||(Y.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),$g.call(this,this.manifest),Y.canSkipDateranges&&!Y.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){const Y=this.manifest.segments.length,$=_a(D.attributes),Q=$.type&&$.type==="PART";o.preloadHints=o.preloadHints||[],o.preloadHints.push($),$.byterange&&($.byterange.hasOwnProperty("offset")||($.byterange.offset=Q?M:0,Q&&(M=$.byterange.offset+$.byterange.length)));const Z=o.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${Z} for segment #${Y}`,D.attributes,["TYPE","URI"]),!!$.type)for(let W=0;WW.id===$.id);this.manifest.dateRanges[Z]=Ft(this.manifest.dateRanges[Z],$),U[$.id]=Ft(U[$.id],$),this.manifest.dateRanges.pop()}},"independent-segments"(){this.manifest.independentSegments=!0},"i-frames-only"(){this.manifest.iFramesOnly=!0,this.requiredCompatibilityversion(this.manifest.version,4)},"content-steering"(){this.manifest.contentSteering=_a(D.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",D.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};const Y=($,Q)=>{if($ in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${$}`});return}this.manifest.definitions[$]=Q};if("QUERYPARAM"in D.attributes){if("NAME"in D.attributes||"IMPORT"in D.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}const $=this.params.get(D.attributes.QUERYPARAM);if(!$){this.trigger("error",{message:`EXT-X-DEFINE: No query param ${D.attributes.QUERYPARAM}`});return}Y(D.attributes.QUERYPARAM,decodeURIComponent($));return}if("NAME"in D.attributes){if("IMPORT"in D.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}if(!("VALUE"in D.attributes)||typeof D.attributes.VALUE!="string"){this.trigger("error",{message:`EXT-X-DEFINE: No value for ${D.attributes.NAME}`});return}Y(D.attributes.NAME,D.attributes.VALUE);return}if("IMPORT"in D.attributes){if(!this.mainDefinitions[D.attributes.IMPORT]){this.trigger("error",{message:`EXT-X-DEFINE: No value ${D.attributes.IMPORT} to import, or IMPORT used on main playlist`});return}Y(D.attributes.IMPORT,this.mainDefinitions[D.attributes.IMPORT]);return}this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:D.attributes,uri:D.uri,timeline:E}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",D.attributes,["BANDWIDTH","URI"])}}[D.tagType]||g).call(i)},uri(){o.uri=D.uri,r.push(o),this.manifest.targetDuration&&!("duration"in o)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),o.duration=this.manifest.targetDuration),c&&(o.key=c),o.timeline=E,u&&(o.map=u),M=0,this.lastProgramDateTime!==null&&(o.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=o.duration*1e3),o={}},comment(){},custom(){D.segment?(o.custom=o.custom||{},o.custom[D.customType]=D.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[D.customType]=D.data)}})[D.type].call(i)})}requiredCompatibilityversion(e,i){(eE&&(S-=E,S-=E,S-=bi(2))}return Number(S)},Gk=function(e,i){var r=i===void 0?{}:i,o=r.le,u=o===void 0?!1:o;(typeof e!="bigint"&&typeof e!="number"||typeof e=="number"&&e!==e)&&(e=0),e=bi(e);for(var c=qk(e),p=new Uint8Array(new ArrayBuffer(c)),g=0;g=i.length&&b.call(i,function(S,E){var A=g[E]?g[E]&e[c+E]:e[c+E];return S===A})},Yk=function(e,i,r){i.forEach(function(o){for(var u in e.mediaGroups[o])for(var c in e.mediaGroups[o][u]){var p=e.mediaGroups[o][u][c];r(p,o,u,c)}})},Ta={},Cr={};function Wk(s,e,i){if(i===void 0&&(i=Array.prototype),s&&typeof i.find=="function")return i.find.call(s,e);for(var r=0;r=0&&s=0){for(var o=e.length-1;r0},lookupPrefix:function(s){for(var e=this;e;){var i=e._nsMap;if(i){for(var r in i)if(Object.prototype.hasOwnProperty.call(i,r)&&i[r]===s)return r}e=e.nodeType==zl?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(s){for(var e=this;e;){var i=e._nsMap;if(i&&Object.prototype.hasOwnProperty.call(i,s))return i[s];e=e.nodeType==zl?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(s){var e=this.lookupPrefix(s);return e==null}};function xT(s){return s=="<"&&"<"||s==">"&&">"||s=="&"&&"&"||s=='"'&&"""||""+s.charCodeAt()+";"}sd(sn,yt),sd(sn,yt.prototype);function rd(s,e){if(e(s))return!0;if(s=s.firstChild)do if(rd(s,e))return!0;while(s=s.nextSibling)}function ad(){this.ownerDocument=this}function nO(s,e,i){s&&s._inc++;var r=i.namespaceURI;r===nd.XMLNS&&(e._nsMap[i.prefix?i.localName:""]=i.value)}function ET(s,e,i,r){s&&s._inc++;var o=i.namespaceURI;o===nd.XMLNS&&delete e._nsMap[i.prefix?i.localName:""]}function Qg(s,e,i){if(s&&s._inc){s._inc++;var r=e.childNodes;if(i)r[r.length++]=i;else{for(var o=e.firstChild,u=0;o;)r[u++]=o,o=o.nextSibling;r.length=u,delete r[r.length]}}}function CT(s,e){var i=e.previousSibling,r=e.nextSibling;return i?i.nextSibling=r:s.firstChild=r,r?r.previousSibling=i:s.lastChild=i,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,Qg(s.ownerDocument,s),e}function sO(s){return s&&(s.nodeType===yt.DOCUMENT_NODE||s.nodeType===yt.DOCUMENT_FRAGMENT_NODE||s.nodeType===yt.ELEMENT_NODE)}function rO(s){return s&&(Ls(s)||Kg(s)||wr(s)||s.nodeType===yt.DOCUMENT_FRAGMENT_NODE||s.nodeType===yt.COMMENT_NODE||s.nodeType===yt.PROCESSING_INSTRUCTION_NODE)}function wr(s){return s&&s.nodeType===yt.DOCUMENT_TYPE_NODE}function Ls(s){return s&&s.nodeType===yt.ELEMENT_NODE}function Kg(s){return s&&s.nodeType===yt.TEXT_NODE}function AT(s,e){var i=s.childNodes||[];if(Ms(i,Ls)||wr(e))return!1;var r=Ms(i,wr);return!(e&&r&&i.indexOf(r)>i.indexOf(e))}function DT(s,e){var i=s.childNodes||[];function r(u){return Ls(u)&&u!==e}if(Ms(i,r))return!1;var o=Ms(i,wr);return!(e&&o&&i.indexOf(o)>i.indexOf(e))}function aO(s,e,i){if(!sO(s))throw new Xt(rn,"Unexpected parent node type "+s.nodeType);if(i&&i.parentNode!==s)throw new Xt(yT,"child not in parent");if(!rO(e)||wr(e)&&s.nodeType!==yt.DOCUMENT_NODE)throw new Xt(rn,"Unexpected node type "+e.nodeType+" for parent node type "+s.nodeType)}function oO(s,e,i){var r=s.childNodes||[],o=e.childNodes||[];if(e.nodeType===yt.DOCUMENT_FRAGMENT_NODE){var u=o.filter(Ls);if(u.length>1||Ms(o,Kg))throw new Xt(rn,"More than one element or text in fragment");if(u.length===1&&!AT(s,i))throw new Xt(rn,"Element in fragment can not be inserted before doctype")}if(Ls(e)&&!AT(s,i))throw new Xt(rn,"Only one element can be added and only after doctype");if(wr(e)){if(Ms(r,wr))throw new Xt(rn,"Only one doctype is allowed");var c=Ms(r,Ls);if(i&&r.indexOf(c)1||Ms(o,Kg))throw new Xt(rn,"More than one element or text in fragment");if(u.length===1&&!DT(s,i))throw new Xt(rn,"Element in fragment can not be inserted before doctype")}if(Ls(e)&&!DT(s,i))throw new Xt(rn,"Only one element can be added and only after doctype");if(wr(e)){if(Ms(r,function(g){return wr(g)&&g!==i}))throw new Xt(rn,"Only one doctype is allowed");var c=Ms(r,Ls);if(i&&r.indexOf(c)0&&rd(i.documentElement,function(o){if(o!==i&&o.nodeType===cs){var u=o.getAttribute("class");if(u){var c=s===u;if(!c){var p=cT(u);c=e.every(eO(p))}c&&r.push(o)}}}),r})},createElement:function(s){var e=new Co;e.ownerDocument=this,e.nodeName=s,e.tagName=s,e.localName=s,e.childNodes=new Dr;var i=e.attributes=new Uf;return i._ownerElement=e,e},createDocumentFragment:function(){var s=new zf;return s.ownerDocument=this,s.childNodes=new Dr,s},createTextNode:function(s){var e=new Zg;return e.ownerDocument=this,e.appendData(s),e},createComment:function(s){var e=new Jg;return e.ownerDocument=this,e.appendData(s),e},createCDATASection:function(s){var e=new e0;return e.ownerDocument=this,e.appendData(s),e},createProcessingInstruction:function(s,e){var i=new i0;return i.ownerDocument=this,i.tagName=i.nodeName=i.target=s,i.nodeValue=i.data=e,i},createAttribute:function(s){var e=new Ff;return e.ownerDocument=this,e.name=s,e.nodeName=s,e.localName=s,e.specified=!0,e},createEntityReference:function(s){var e=new t0;return e.ownerDocument=this,e.nodeName=s,e},createElementNS:function(s,e){var i=new Co,r=e.split(":"),o=i.attributes=new Uf;return i.childNodes=new Dr,i.ownerDocument=this,i.nodeName=e,i.tagName=e,i.namespaceURI=s,r.length==2?(i.prefix=r[0],i.localName=r[1]):i.localName=e,o._ownerElement=i,i},createAttributeNS:function(s,e){var i=new Ff,r=e.split(":");return i.ownerDocument=this,i.nodeName=e,i.name=e,i.namespaceURI=s,i.specified=!0,r.length==2?(i.prefix=r[0],i.localName=r[1]):i.localName=e,i}},nn(ad,yt);function Co(){this._nsMap={}}Co.prototype={nodeType:cs,hasAttribute:function(s){return this.getAttributeNode(s)!=null},getAttribute:function(s){var e=this.getAttributeNode(s);return e&&e.value||""},getAttributeNode:function(s){return this.attributes.getNamedItem(s)},setAttribute:function(s,e){var i=this.ownerDocument.createAttribute(s);i.value=i.nodeValue=""+e,this.setAttributeNode(i)},removeAttribute:function(s){var e=this.getAttributeNode(s);e&&this.removeAttributeNode(e)},appendChild:function(s){return s.nodeType===Ar?this.insertBefore(s,null):lO(this,s)},setAttributeNode:function(s){return this.attributes.setNamedItem(s)},setAttributeNodeNS:function(s){return this.attributes.setNamedItemNS(s)},removeAttributeNode:function(s){return this.attributes.removeNamedItem(s.nodeName)},removeAttributeNS:function(s,e){var i=this.getAttributeNodeNS(s,e);i&&this.removeAttributeNode(i)},hasAttributeNS:function(s,e){return this.getAttributeNodeNS(s,e)!=null},getAttributeNS:function(s,e){var i=this.getAttributeNodeNS(s,e);return i&&i.value||""},setAttributeNS:function(s,e,i){var r=this.ownerDocument.createAttributeNS(s,e);r.value=r.nodeValue=""+i,this.setAttributeNode(r)},getAttributeNodeNS:function(s,e){return this.attributes.getNamedItemNS(s,e)},getElementsByTagName:function(s){return new jl(this,function(e){var i=[];return rd(e,function(r){r!==e&&r.nodeType==cs&&(s==="*"||r.tagName==s)&&i.push(r)}),i})},getElementsByTagNameNS:function(s,e){return new jl(this,function(i){var r=[];return rd(i,function(o){o!==i&&o.nodeType===cs&&(s==="*"||o.namespaceURI===s)&&(e==="*"||o.localName==e)&&r.push(o)}),r})}},ad.prototype.getElementsByTagName=Co.prototype.getElementsByTagName,ad.prototype.getElementsByTagNameNS=Co.prototype.getElementsByTagNameNS,nn(Co,yt);function Ff(){}Ff.prototype.nodeType=zl,nn(Ff,yt);function od(){}od.prototype={data:"",substringData:function(s,e){return this.data.substring(s,s+e)},appendData:function(s){s=this.data+s,this.nodeValue=this.data=s,this.length=s.length},insertData:function(s,e){this.replaceData(s,0,e)},appendChild:function(s){throw new Error(ci[rn])},deleteData:function(s,e){this.replaceData(s,e,"")},replaceData:function(s,e,i){var r=this.data.substring(0,s),o=this.data.substring(s+e);i=r+i+o,this.nodeValue=this.data=i,this.length=i.length}},nn(od,yt);function Zg(){}Zg.prototype={nodeName:"#text",nodeType:Pf,splitText:function(s){var e=this.data,i=e.substring(s);e=e.substring(0,s),this.data=this.nodeValue=e,this.length=e.length;var r=this.ownerDocument.createTextNode(i);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}},nn(Zg,od);function Jg(){}Jg.prototype={nodeName:"#comment",nodeType:pT},nn(Jg,od);function e0(){}e0.prototype={nodeName:"#cdata-section",nodeType:dT},nn(e0,od);function Hf(){}Hf.prototype.nodeType=gT,nn(Hf,yt);function kT(){}kT.prototype.nodeType=iO,nn(kT,yt);function OT(){}OT.prototype.nodeType=tO,nn(OT,yt);function t0(){}t0.prototype.nodeType=hT,nn(t0,yt);function zf(){}zf.prototype.nodeName="#document-fragment",zf.prototype.nodeType=Ar,nn(zf,yt);function i0(){}i0.prototype.nodeType=fT,nn(i0,yt);function RT(){}RT.prototype.serializeToString=function(s,e,i){return MT.call(s,e,i)},yt.prototype.toString=MT;function MT(s,e){var i=[],r=this.nodeType==9&&this.documentElement||this,o=r.prefix,u=r.namespaceURI;if(u&&o==null){var o=r.lookupPrefix(u);if(o==null)var c=[{namespace:u,prefix:null}]}return ql(this,i,s,e,c),i.join("")}function LT(s,e,i){var r=s.prefix||"",o=s.namespaceURI;if(!o||r==="xml"&&o===nd.XML||o===nd.XMLNS)return!1;for(var u=i.length;u--;){var c=i[u];if(c.prefix===r)return c.namespace!==o}return!0}function n0(s,e,i){s.push(" ",e,'="',i.replace(/[<>&"\t\n\r]/g,xT),'"')}function ql(s,e,i,r,o){if(o||(o=[]),r)if(s=r(s),s){if(typeof s=="string"){e.push(s);return}}else return;switch(s.nodeType){case cs:var u=s.attributes,c=u.length,H=s.firstChild,p=s.tagName;i=nd.isHTML(s.namespaceURI)||i;var g=p;if(!i&&!s.prefix&&s.namespaceURI){for(var b,S=0;S=0;E--){var A=o[E];if(A.prefix===""&&A.namespace===s.namespaceURI){b=A.namespace;break}}if(b!==s.namespaceURI)for(var E=o.length-1;E>=0;E--){var A=o[E];if(A.namespace===s.namespaceURI){A.prefix&&(g=A.prefix+":"+p);break}}}e.push("<",g);for(var M=0;M"),i&&/^script$/i.test(p))for(;H;)H.data?e.push(H.data):ql(H,e,i,r,o.slice()),H=H.nextSibling;else for(;H;)ql(H,e,i,r,o.slice()),H=H.nextSibling;e.push("",g,">")}else e.push("/>");return;case mT:case Ar:for(var H=s.firstChild;H;)ql(H,e,i,r,o.slice()),H=H.nextSibling;return;case zl:return n0(e,s.name,s.value);case Pf:return e.push(s.data.replace(/[<&>]/g,xT));case dT:return e.push("");case pT:return e.push("");case gT:var Y=s.publicId,$=s.systemId;if(e.push("");else if($&&$!=".")e.push(" SYSTEM ",$,">");else{var Q=s.internalSubset;Q&&e.push(" [",Q,"]"),e.push(">")}return;case fT:return e.push("",s.target," ",s.data,"?>");case hT:return e.push("&",s.nodeName,";");default:e.push("??",s.nodeName)}}function IT(s,e,i){var r;switch(e.nodeType){case cs:r=e.cloneNode(!1),r.ownerDocument=s;case Ar:break;case zl:i=!0;break}if(r||(r=e.cloneNode(!1)),r.ownerDocument=s,r.parentNode=null,i)for(var o=e.firstChild;o;)r.appendChild(IT(s,o,i)),o=o.nextSibling;return r}function s0(s,e,i){var r=new e.constructor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var u=e[o];typeof u!="object"&&u!=r[o]&&(r[o]=u)}switch(e.childNodes&&(r.childNodes=new Dr),r.ownerDocument=s,r.nodeType){case cs:var c=e.attributes,p=r.attributes=new Uf,g=c.length;p._ownerElement=r;for(var b=0;b",lt:"<",quot:'"'}),s.HTML_ENTITIES=e({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:`
+`,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"",zwnj:""}),s.entityMap=s.HTML_ENTITIES})(PT);var r0={},ld=Cr.NAMESPACE,a0=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,UT=new RegExp("[\\-\\.0-9"+a0.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),BT=new RegExp("^"+a0.source+UT.source+"*(?::"+a0.source+UT.source+"*)?$"),ud=0,Sa=1,Vl=2,cd=3,$l=4,Gl=5,dd=6,qf=7;function Xl(s,e){this.message=s,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,Xl)}Xl.prototype=new Error,Xl.prototype.name=Xl.name;function FT(){}FT.prototype={parse:function(s,e,i){var r=this.domBuilder;r.startDocument(),jT(e,e={}),uO(s,e,i,r,this.errorHandler),r.endDocument()}};function uO(s,e,i,r,o){function u(de){if(de>65535){de-=65536;var Ee=55296+(de>>10),Re=56320+(de&1023);return String.fromCharCode(Ee,Re)}else return String.fromCharCode(de)}function c(de){var Ee=de.slice(1,-1);return Object.hasOwnProperty.call(i,Ee)?i[Ee]:Ee.charAt(0)==="#"?u(parseInt(Ee.substr(1).replace("x","0x"))):(o.error("entity not found:"+de),de)}function p(de){if(de>D){var Ee=s.substring(D,de).replace(/?\w+;/g,c);A&&g(D),r.characters(Ee,0,de-D),D=de}}function g(de,Ee){for(;de>=S&&(Ee=E.exec(s));)b=Ee.index,S=b+Ee[0].length,A.lineNumber++;A.columnNumber=de-b+1}for(var b=0,S=0,E=/.*(?:\r\n?|\n)|.*$/g,A=r.locator,M=[{currentNSMap:e}],U={},D=0;;){try{var z=s.indexOf("<",D);if(z<0){if(!s.substr(D).match(/^\s*$/)){var H=r.doc,Y=H.createTextNode(s.substr(D));H.appendChild(Y),r.currentElement=Y}return}switch(z>D&&p(z),s.charAt(z+1)){case"/":var fe=s.indexOf(">",z+3),$=s.substring(z+2,fe).replace(/[ \t\n\r]+$/g,""),Q=M.pop();fe<0?($=s.substring(z+2).replace(/[\s<].*/,""),o.error("end tag name: "+$+" is not complete:"+Q.tagName),fe=z+1+$.length):$.match(/\s)&&($=$.replace(/[\s<].*/,""),o.error("end tag name: "+$+" maybe not complete"),fe=z+1+$.length);var Z=Q.localNSMap,W=Q.tagName==$,G=W||Q.tagName&&Q.tagName.toLowerCase()==$.toLowerCase();if(G){if(r.endElement(Q.uri,Q.localName,$),Z)for(var ee in Z)Object.prototype.hasOwnProperty.call(Z,ee)&&r.endPrefixMapping(ee);W||o.fatalError("end tag name: "+$+" is not match the current start tagName:"+Q.tagName)}else M.push(Q);fe++;break;case"?":A&&g(z),fe=pO(s,z,r);break;case"!":A&&g(z),fe=fO(s,z,r,o);break;default:A&&g(z);var oe=new qT,_e=M[M.length-1].currentNSMap,fe=cO(s,z,oe,_e,c,o),xe=oe.length;if(!oe.closed&&hO(s,fe,oe.tagName,U)&&(oe.closed=!0,i.nbsp||o.warning("unclosed xml attribute")),A&&xe){for(var ve=HT(A,{}),Ne=0;NeD?D=fe:p(Math.max(z,D)+1)}}function HT(s,e){return e.lineNumber=s.lineNumber,e.columnNumber=s.columnNumber,e}function cO(s,e,i,r,o,u){function c(A,M,U){i.attributeNames.hasOwnProperty(A)&&u.fatalError("Attribute "+A+" redefined"),i.addValue(A,M.replace(/[\t\n\r]/g," ").replace(/?\w+;/g,o),U)}for(var p,g,b=++e,S=ud;;){var E=s.charAt(b);switch(E){case"=":if(S===Sa)p=s.slice(e,b),S=cd;else if(S===Vl)S=cd;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(S===cd||S===Sa)if(S===Sa&&(u.warning('attribute value must after "="'),p=s.slice(e,b)),e=b+1,b=s.indexOf(E,e),b>0)g=s.slice(e,b),c(p,g,e-1),S=Gl;else throw new Error("attribute value no end '"+E+"' match");else if(S==$l)g=s.slice(e,b),c(p,g,e),u.warning('attribute "'+p+'" missed start quot('+E+")!!"),e=b+1,S=Gl;else throw new Error('attribute value must after "="');break;case"/":switch(S){case ud:i.setTagName(s.slice(e,b));case Gl:case dd:case qf:S=qf,i.closed=!0;case $l:case Sa:break;case Vl:i.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return u.error("unexpected end of input"),S==ud&&i.setTagName(s.slice(e,b)),b;case">":switch(S){case ud:i.setTagName(s.slice(e,b));case Gl:case dd:case qf:break;case $l:case Sa:g=s.slice(e,b),g.slice(-1)==="/"&&(i.closed=!0,g=g.slice(0,-1));case Vl:S===Vl&&(g=p),S==$l?(u.warning('attribute "'+g+'" missed quot(")!'),c(p,g,e)):((!ld.isHTML(r[""])||!g.match(/^(?:disabled|checked|selected)$/i))&&u.warning('attribute "'+g+'" missed value!! "'+g+'" instead!!'),c(g,g,e));break;case cd:throw new Error("attribute value missed!!")}return b;case"":E=" ";default:if(E<=" ")switch(S){case ud:i.setTagName(s.slice(e,b)),S=dd;break;case Sa:p=s.slice(e,b),S=Vl;break;case $l:var g=s.slice(e,b);u.warning('attribute "'+g+'" missed quot(")!!'),c(p,g,e);case Gl:S=dd;break}else switch(S){case Vl:i.tagName,(!ld.isHTML(r[""])||!p.match(/^(?:disabled|checked|selected)$/i))&&u.warning('attribute "'+p+'" missed value!! "'+p+'" instead2!!'),c(p,p,e),e=b,S=Sa;break;case Gl:u.warning('attribute space is required"'+p+'"!!');case dd:S=Sa,e=b;break;case cd:S=$l,e=b;break;case qf:throw new Error("elements closed character '/' and '>' must be connected to")}}b++}}function zT(s,e,i){for(var r=s.tagName,o=null,E=s.length;E--;){var u=s[E],c=u.qName,p=u.value,A=c.indexOf(":");if(A>0)var g=u.prefix=c.slice(0,A),b=c.slice(A+1),S=g==="xmlns"&&b;else b=c,g=null,S=c==="xmlns"&&"";u.localName=b,S!==!1&&(o==null&&(o={},jT(i,i={})),i[S]=o[S]=p,u.uri=ld.XMLNS,e.startPrefixMapping(S,p))}for(var E=s.length;E--;){u=s[E];var g=u.prefix;g&&(g==="xml"&&(u.uri=ld.XML),g!=="xmlns"&&(u.uri=i[g||""]))}var A=r.indexOf(":");A>0?(g=s.prefix=r.slice(0,A),b=s.localName=r.slice(A+1)):(g=null,b=s.localName=r);var M=s.uri=i[g||""];if(e.startElement(M,b,r,s),s.closed){if(e.endElement(M,b,r),o)for(g in o)Object.prototype.hasOwnProperty.call(o,g)&&e.endPrefixMapping(g)}else return s.currentNSMap=i,s.localNSMap=o,!0}function dO(s,e,i,r,o){if(/^(?:script|textarea)$/i.test(i)){var u=s.indexOf(""+i+">",e),c=s.substring(e+1,u);if(/[&<]/.test(c))return/^script$/i.test(i)?(o.characters(c,0,c.length),u):(c=c.replace(/?\w+;/g,r),o.characters(c,0,c.length),u)}return e+1}function hO(s,e,i,r){var o=r[i];return o==null&&(o=s.lastIndexOf(""+i+">"),o",e+4);return u>e?(i.comment(s,e+4,u-e-4),u+3):(r.error("Unclosed comment"),-1)}else return-1;default:if(s.substr(e+3,6)=="CDATA["){var u=s.indexOf("]]>",e+9);return i.startCDATA(),i.characters(s,e+9,u-e-9),i.endCDATA(),u+3}var c=mO(s,e),p=c.length;if(p>1&&/!doctype/i.test(c[0][0])){var g=c[1][0],b=!1,S=!1;p>3&&(/^public$/i.test(c[2][0])?(b=c[3][0],S=p>4&&c[4][0]):/^system$/i.test(c[2][0])&&(S=c[3][0]));var E=c[p-1];return i.startDTD(g,b,S),i.endDTD(),E.index+E[0].length}}return-1}function pO(s,e,i){var r=s.indexOf("?>",e);if(r){var o=s.substring(e,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return o?(o[0].length,i.processingInstruction(o[1],o[2]),r+2):-1}return-1}function qT(){this.attributeNames={}}qT.prototype={setTagName:function(s){if(!BT.test(s))throw new Error("invalid tagName:"+s);this.tagName=s},addValue:function(s,e,i){if(!BT.test(s))throw new Error("invalid attribute:"+s);this.attributeNames[s]=this.length,this[this.length++]={qName:s,value:e,offset:i}},length:0,getLocalName:function(s){return this[s].localName},getLocator:function(s){return this[s].locator},getQName:function(s){return this[s].qName},getURI:function(s){return this[s].uri},getValue:function(s){return this[s].value}};function mO(s,e){var i,r=[],o=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(o.lastIndex=e,o.exec(s);i=o.exec(s);)if(r.push(i),i[1])return r}r0.XMLReader=FT,r0.ParseError=Xl;var gO=Cr,yO=Ta,VT=PT,$T=r0,vO=yO.DOMImplementation,GT=gO.NAMESPACE,bO=$T.ParseError,_O=$T.XMLReader;function XT(s){return s.replace(/\r[\n\u0085]/g,`
`).replace(/[\r\u0085\u2028]/g,`
`)}function YT(s){this.options=s||{locator:{}}}YT.prototype.parseFromString=function(s,e){var i=this.options,r=new _O,o=i.domBuilder||new hd,u=i.errorHandler,c=i.locator,p=i.xmlns||{},g=/\/x?html?$/.test(e),b=g?VT.HTML_ENTITIES:VT.XML_ENTITIES;c&&o.setDocumentLocator(c),r.errorHandler=TO(u,o,c),r.domBuilder=i.domBuilder||o,g&&(p[""]=GT.HTML),p.xml=p.xml||GT.XML;var S=i.normalizeLineEndings||XT;return s&&typeof s=="string"?r.parse(S(s),p,b):r.errorHandler.error("invalid doc source"),o.doc};function TO(s,e,i){if(!s){if(e instanceof hd)return e;s=e}var r={},o=s instanceof Function;i=i||{};function u(c){var p=s[c];!p&&o&&(p=s.length==2?function(g){s(c,g)}:s),r[c]=p&&function(g){p("[xmldom "+c+"] "+g+o0(i))}||function(){}}return u("warning"),u("error"),u("fatalError"),r}function hd(){this.cdata=!1}function Yl(s,e){e.lineNumber=s.lineNumber,e.columnNumber=s.columnNumber}hd.prototype={startDocument:function(){this.doc=new vO().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(s,e,i,r){var o=this.doc,u=o.createElementNS(s,i||e),c=r.length;Vf(this,u),this.currentElement=u,this.locator&&Yl(this.locator,u);for(var p=0;p=e+i||e?new java.lang.String(s,e,i)+"":s}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(s){hd.prototype[s]=function(){return null}});function Vf(s,e){s.currentElement?s.currentElement.appendChild(e):s.doc.appendChild(e)}jf.__DOMHandler=hd,jf.normalizeLineEndings=XT,jf.DOMParser=YT;var SO=jf.DOMParser;/*! @name mpd-parser @version 1.3.1 @license Apache-2.0 */const QT=s=>!!s&&typeof s=="object",di=(...s)=>s.reduce((e,i)=>(typeof i!="object"||Object.keys(i).forEach(r=>{Array.isArray(e[r])&&Array.isArray(i[r])?e[r]=e[r].concat(i[r]):QT(e[r])&&QT(i[r])?e[r]=di(e[r],i[r]):e[r]=i[r]}),e),{}),KT=s=>Object.keys(s).map(e=>s[e]),xO=(s,e)=>{const i=[];for(let r=s;rs.reduce((e,i)=>e.concat(i),[]),ZT=s=>{if(!s.length)return[];const e=[];for(let i=0;is.reduce((i,r,o)=>(r[e]&&i.push(o),i),[]),CO=(s,e)=>KT(s.reduce((i,r)=>(r.forEach(o=>{i[e(o)]=o}),i),{}));var Ql={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",INVALID_NUMBER_OF_CONTENT_STEERING:"INVALID_NUMBER_OF_CONTENT_STEERING",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",MISSING_SEGMENT_INFORMATION:"MISSING_SEGMENT_INFORMATION",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};const fd=({baseUrl:s="",source:e="",range:i="",indexRange:r=""})=>{const o={uri:e,resolvedUri:Nf(s||"",e)};if(i||r){const c=(i||r).split("-");let p=P.BigInt?P.BigInt(c[0]):parseInt(c[0],10),g=P.BigInt?P.BigInt(c[1]):parseInt(c[1],10);p{let e;return typeof s.offset=="bigint"||typeof s.length=="bigint"?e=P.BigInt(s.offset)+P.BigInt(s.length)-P.BigInt(1):e=s.offset+s.length-1,`${s.offset}-${e}`},JT=s=>(s&&typeof s!="number"&&(s=parseInt(s,10)),isNaN(s)?null:s),DO={static(s){const{duration:e,timescale:i=1,sourceDuration:r,periodDuration:o}=s,u=JT(s.endNumber),c=e/i;return typeof u=="number"?{start:0,end:u}:typeof o=="number"?{start:0,end:o/c}:{start:0,end:r/c}},dynamic(s){const{NOW:e,clientOffset:i,availabilityStartTime:r,timescale:o=1,duration:u,periodStart:c=0,minimumUpdatePeriod:p=0,timeShiftBufferDepth:g=1/0}=s,b=JT(s.endNumber),S=(e+i)/1e3,E=r+c,M=S+p-E,U=Math.ceil(M*o/u),D=Math.floor((S-E-g)*o/u),z=Math.floor((S-E)*o/u);return{start:Math.max(0,D),end:typeof b=="number"?b:Math.min(U,z)}}},wO=s=>e=>{const{duration:i,timescale:r=1,periodStart:o,startNumber:u=1}=s;return{number:u+e,duration:i/r,timeline:o,time:e*i}},l0=s=>{const{type:e,duration:i,timescale:r=1,periodDuration:o,sourceDuration:u}=s,{start:c,end:p}=DO[e](s),g=xO(c,p).map(wO(s));if(e==="static"){const b=g.length-1,S=typeof o=="number"?o:u;g[b].duration=S-i/r*b}return g},e1=s=>{const{baseUrl:e,initialization:i={},sourceDuration:r,indexRange:o="",periodStart:u,presentationTime:c,number:p=0,duration:g}=s;if(!e)throw new Error(Ql.NO_BASE_URL);const b=fd({baseUrl:e,source:i.sourceURL,range:i.range}),S=fd({baseUrl:e,source:e,indexRange:o});if(S.map=b,g){const E=l0(s);E.length&&(S.duration=E[0].duration,S.timeline=E[0].timeline)}else r&&(S.duration=r,S.timeline=u);return S.presentationTime=c||u,S.number=p,[S]},u0=(s,e,i)=>{const r=s.sidx.map?s.sidx.map:null,o=s.sidx.duration,u=s.timeline||0,c=s.sidx.byterange,p=c.offset+c.length,g=e.timescale,b=e.references.filter(z=>z.referenceType!==1),S=[],E=s.endList?"static":"dynamic",A=s.sidx.timeline;let M=A,U=s.mediaSequence||0,D;typeof e.firstOffset=="bigint"?D=P.BigInt(p)+e.firstOffset:D=p+e.firstOffset;for(let z=0;zCO(s,({timeline:e})=>e).sort((e,i)=>e.timeline>i.timeline?1:-1),RO=(s,e)=>{for(let i=0;i{let e=[];return Yk(s,kO,(i,r,o,u)=>{e=e.concat(i.playlists||[])}),e},n1=({playlist:s,mediaSequence:e})=>{s.mediaSequence=e,s.segments.forEach((i,r)=>{i.number=s.mediaSequence+r})},MO=({oldPlaylists:s,newPlaylists:e,timelineStarts:i})=>{e.forEach(r=>{r.discontinuitySequence=i.findIndex(function({timeline:g}){return g===r.timeline});const o=RO(s,r.attributes.NAME);if(!o||r.sidx)return;const u=r.segments[0],c=o.segments.findIndex(function(g){return Math.abs(g.presentationTime-u.presentationTime)o.timeline||o.segments.length&&r.timeline>o.segments[o.segments.length-1].timeline)&&r.discontinuitySequence--;return}o.segments[c].discontinuity&&!u.discontinuity&&(u.discontinuity=!0,r.discontinuityStarts.unshift(0),r.discontinuitySequence--),n1({playlist:r,mediaSequence:o.segments[c].number})})},LO=({oldManifest:s,newManifest:e})=>{const i=s.playlists.concat(i1(s)),r=e.playlists.concat(i1(e));return e.timelineStarts=t1([s.timelineStarts,e.timelineStarts]),MO({oldPlaylists:i,newPlaylists:r,timelineStarts:e.timelineStarts}),e},$f=s=>s&&s.uri+"-"+AO(s.byterange),c0=s=>{const e=s.reduce(function(r,o){return r[o.attributes.baseUrl]||(r[o.attributes.baseUrl]=[]),r[o.attributes.baseUrl].push(o),r},{});let i=[];return Object.values(e).forEach(r=>{const o=KT(r.reduce((u,c)=>{const p=c.attributes.id+(c.attributes.lang||"");return u[p]?(c.segments&&(c.segments[0]&&(c.segments[0].discontinuity=!0),u[p].segments.push(...c.segments)),c.attributes.contentProtection&&(u[p].attributes.contentProtection=c.attributes.contentProtection)):(u[p]=c,u[p].attributes.timelineStarts=[]),u[p].attributes.timelineStarts.push({start:c.attributes.periodStart,timeline:c.attributes.periodStart}),u},{}));i=i.concat(o)}),i.map(r=>(r.discontinuityStarts=EO(r.segments||[],"discontinuity"),r))},d0=(s,e)=>{const i=$f(s.sidx),r=i&&e[i]&&e[i].sidx;return r&&u0(s,r,s.sidx.resolvedUri),s},IO=(s,e={})=>{if(!Object.keys(e).length)return s;for(const i in s)s[i]=d0(s[i],e);return s},NO=({attributes:s,segments:e,sidx:i,mediaSequence:r,discontinuitySequence:o,discontinuityStarts:u},c)=>{const p={attributes:{NAME:s.id,BANDWIDTH:s.bandwidth,CODECS:s.codecs,"PROGRAM-ID":1},uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,discontinuitySequence:o,discontinuityStarts:u,timelineStarts:s.timelineStarts,mediaSequence:r,segments:e};return s.contentProtection&&(p.contentProtection=s.contentProtection),s.serviceLocation&&(p.attributes.serviceLocation=s.serviceLocation),i&&(p.sidx=i),c&&(p.attributes.AUDIO="audio",p.attributes.SUBTITLES="subs"),p},PO=({attributes:s,segments:e,mediaSequence:i,discontinuityStarts:r,discontinuitySequence:o})=>{typeof e>"u"&&(e=[{uri:s.baseUrl,timeline:s.periodStart,resolvedUri:s.baseUrl||"",duration:s.sourceDuration,number:0}],s.duration=s.sourceDuration);const u={NAME:s.id,BANDWIDTH:s.bandwidth,"PROGRAM-ID":1};s.codecs&&(u.CODECS=s.codecs);const c={attributes:u,uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,timelineStarts:s.timelineStarts,discontinuityStarts:r,discontinuitySequence:o,mediaSequence:i,segments:e};return s.serviceLocation&&(c.attributes.serviceLocation=s.serviceLocation),c},UO=(s,e={},i=!1)=>{let r;const o=s.reduce((u,c)=>{const p=c.attributes.role&&c.attributes.role.value||"",g=c.attributes.lang||"";let b=c.attributes.label||"main";if(g&&!c.attributes.label){const E=p?` (${p})`:"";b=`${c.attributes.lang}${E}`}u[b]||(u[b]={language:g,autoselect:!0,default:p==="main",playlists:[],uri:""});const S=d0(NO(c,i),e);return u[b].playlists.push(S),typeof r>"u"&&p==="main"&&(r=c,r.default=!0),u},{});if(!r){const u=Object.keys(o)[0];o[u].default=!0}return o},BO=(s,e={})=>s.reduce((i,r)=>{const o=r.attributes.label||r.attributes.lang||"text",u=r.attributes.lang||"und";return i[o]||(i[o]={language:u,default:!1,autoselect:!1,playlists:[],uri:""}),i[o].playlists.push(d0(PO(r),e)),i},{}),FO=s=>s.reduce((e,i)=>(i&&i.forEach(r=>{const{channel:o,language:u}=r;e[u]={autoselect:!1,default:!1,instreamId:o,language:u},r.hasOwnProperty("aspectRatio")&&(e[u].aspectRatio=r.aspectRatio),r.hasOwnProperty("easyReader")&&(e[u].easyReader=r.easyReader),r.hasOwnProperty("3D")&&(e[u]["3D"]=r["3D"])}),e),{}),HO=({attributes:s,segments:e,sidx:i,discontinuityStarts:r})=>{const o={attributes:{NAME:s.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:s.width,height:s.height},CODECS:s.codecs,BANDWIDTH:s.bandwidth,"PROGRAM-ID":1},uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,discontinuityStarts:r,timelineStarts:s.timelineStarts,segments:e};return s.frameRate&&(o.attributes["FRAME-RATE"]=s.frameRate),s.contentProtection&&(o.contentProtection=s.contentProtection),s.serviceLocation&&(o.attributes.serviceLocation=s.serviceLocation),i&&(o.sidx=i),o},zO=({attributes:s})=>s.mimeType==="video/mp4"||s.mimeType==="video/webm"||s.contentType==="video",jO=({attributes:s})=>s.mimeType==="audio/mp4"||s.mimeType==="audio/webm"||s.contentType==="audio",qO=({attributes:s})=>s.mimeType==="text/vtt"||s.contentType==="text",VO=(s,e)=>{s.forEach(i=>{i.mediaSequence=0,i.discontinuitySequence=e.findIndex(function({timeline:r}){return r===i.timeline}),i.segments&&i.segments.forEach((r,o)=>{r.number=o})})},s1=s=>s?Object.keys(s).reduce((e,i)=>{const r=s[i];return e.concat(r.playlists)},[]):[],$O=({dashPlaylists:s,locations:e,contentSteering:i,sidxMapping:r={},previousManifest:o,eventStream:u})=>{if(!s.length)return{};const{sourceDuration:c,type:p,suggestedPresentationDelay:g,minimumUpdatePeriod:b}=s[0].attributes,S=c0(s.filter(zO)).map(HO),E=c0(s.filter(jO)),A=c0(s.filter(qO)),M=s.map(Q=>Q.attributes.captionServices).filter(Boolean),U={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:c,playlists:IO(S,r)};b>=0&&(U.minimumUpdatePeriod=b*1e3),e&&(U.locations=e),i&&(U.contentSteering=i),p==="dynamic"&&(U.suggestedPresentationDelay=g),u&&u.length>0&&(U.eventStream=u);const D=U.playlists.length===0,z=E.length?UO(E,r,D):null,H=A.length?BO(A,r):null,Y=S.concat(s1(z),s1(H)),V=Y.map(({timelineStarts:Q})=>Q);return U.timelineStarts=t1(V),VO(Y,U.timelineStarts),z&&(U.mediaGroups.AUDIO.audio=z),H&&(U.mediaGroups.SUBTITLES.subs=H),M.length&&(U.mediaGroups["CLOSED-CAPTIONS"].cc=FO(M)),o?LO({oldManifest:o,newManifest:U}):U},GO=(s,e,i)=>{const{NOW:r,clientOffset:o,availabilityStartTime:u,timescale:c=1,periodStart:p=0,minimumUpdatePeriod:g=0}=s,b=(r+o)/1e3,S=u+p,A=b+g-S;return Math.ceil((A*c-e)/i)},r1=(s,e)=>{const{type:i,minimumUpdatePeriod:r=0,media:o="",sourceDuration:u,timescale:c=1,startNumber:p=1,periodStart:g}=s,b=[];let S=-1;for(let E=0;ES&&(S=D);let z;if(U<0){const V=E+1;V===e.length?i==="dynamic"&&r>0&&o.indexOf("$Number$")>0?z=GO(s,S,M):z=(u*c-S)/M:z=(e[V].t-S)/M}else z=U+1;const H=p+b.length+z;let Y=p+b.length;for(;Y(e,i,r,o)=>{if(e==="$$")return"$";if(typeof s[i]>"u")return e;const u=""+s[i];return i==="RepresentationID"||(r?o=parseInt(o,10):o=1,u.length>=o)?u:`${new Array(o-u.length+1).join("0")}${u}`},a1=(s,e)=>s.replace(XO,YO(e)),WO=(s,e)=>!s.duration&&!e?[{number:s.startNumber||1,duration:s.sourceDuration,time:0,timeline:s.periodStart}]:s.duration?l0(s):r1(s,e),QO=(s,e)=>{const i={RepresentationID:s.id,Bandwidth:s.bandwidth||0},{initialization:r={sourceURL:"",range:""}}=s,o=fd({baseUrl:s.baseUrl,source:a1(r.sourceURL,i),range:r.range});return WO(s,e).map(c=>{i.Number=c.number,i.Time=c.time;const p=a1(s.media||"",i),g=s.timescale||1,b=s.presentationTimeOffset||0,S=s.periodStart+(c.time-b)/g;return{uri:p,timeline:c.timeline,duration:c.duration,resolvedUri:Nf(s.baseUrl||"",p),map:o,number:c.number,presentationTime:S}})},KO=(s,e)=>{const{baseUrl:i,initialization:r={}}=s,o=fd({baseUrl:i,source:r.sourceURL,range:r.range}),u=fd({baseUrl:i,source:e.media,range:e.mediaRange});return u.map=o,u},ZO=(s,e)=>{const{duration:i,segmentUrls:r=[],periodStart:o}=s;if(!i&&!e||i&&e)throw new Error(Ql.SEGMENT_TIME_UNSPECIFIED);const u=r.map(g=>KO(s,g));let c;return i&&(c=l0(s)),e&&(c=r1(s,e)),c.map((g,b)=>{if(u[b]){const S=u[b],E=s.timescale||1,A=s.presentationTimeOffset||0;return S.timeline=g.timeline,S.duration=g.duration,S.number=g.number,S.presentationTime=o+(g.time-A)/E,S}}).filter(g=>g)},JO=({attributes:s,segmentInfo:e})=>{let i,r;e.template?(r=QO,i=di(s,e.template)):e.base?(r=e1,i=di(s,e.base)):e.list&&(r=ZO,i=di(s,e.list));const o={attributes:s};if(!r)return o;const u=r(i,e.segmentTimeline);if(i.duration){const{duration:c,timescale:p=1}=i;i.duration=c/p}else u.length?i.duration=u.reduce((c,p)=>Math.max(c,Math.ceil(p.duration)),0):i.duration=0;return o.attributes=i,o.segments=u,e.base&&i.indexRange&&(o.sidx=u[0],o.segments=[]),o},eR=s=>s.map(JO),Lt=(s,e)=>ZT(s.childNodes).filter(({tagName:i})=>i===e),pd=s=>s.textContent.trim(),tR=s=>parseFloat(s.split("/").reduce((e,i)=>e/i)),Kl=s=>{const p=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(s);if(!p)return 0;const[g,b,S,E,A,M]=p.slice(1);return parseFloat(g||0)*31536e3+parseFloat(b||0)*2592e3+parseFloat(S||0)*86400+parseFloat(E||0)*3600+parseFloat(A||0)*60+parseFloat(M||0)},iR=s=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(s)&&(s+="Z"),Date.parse(s)),o1={mediaPresentationDuration(s){return Kl(s)},availabilityStartTime(s){return iR(s)/1e3},minimumUpdatePeriod(s){return Kl(s)},suggestedPresentationDelay(s){return Kl(s)},type(s){return s},timeShiftBufferDepth(s){return Kl(s)},start(s){return Kl(s)},width(s){return parseInt(s,10)},height(s){return parseInt(s,10)},bandwidth(s){return parseInt(s,10)},frameRate(s){return tR(s)},startNumber(s){return parseInt(s,10)},timescale(s){return parseInt(s,10)},presentationTimeOffset(s){return parseInt(s,10)},duration(s){const e=parseInt(s,10);return isNaN(e)?Kl(s):e},d(s){return parseInt(s,10)},t(s){return parseInt(s,10)},r(s){return parseInt(s,10)},presentationTime(s){return parseInt(s,10)},DEFAULT(s){return s}},Jt=s=>s&&s.attributes?ZT(s.attributes).reduce((e,i)=>{const r=o1[i.name]||o1.DEFAULT;return e[i.name]=r(i.value),e},{}):{},nR={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime","urn:mpeg:dash:mp4protection:2011":"mp4protection"},Gf=(s,e)=>e.length?Wl(s.map(function(i){return e.map(function(r){const o=pd(r),u=Nf(i.baseUrl,o),c=di(Jt(r),{baseUrl:u});return u!==o&&!c.serviceLocation&&i.serviceLocation&&(c.serviceLocation=i.serviceLocation),c})})):s,h0=s=>{const e=Lt(s,"SegmentTemplate")[0],i=Lt(s,"SegmentList")[0],r=i&&Lt(i,"SegmentURL").map(E=>di({tag:"SegmentURL"},Jt(E))),o=Lt(s,"SegmentBase")[0],u=i||e,c=u&&Lt(u,"SegmentTimeline")[0],p=i||o||e,g=p&&Lt(p,"Initialization")[0],b=e&&Jt(e);b&&g?b.initialization=g&&Jt(g):b&&b.initialization&&(b.initialization={sourceURL:b.initialization});const S={template:b,segmentTimeline:c&&Lt(c,"S").map(E=>Jt(E)),list:i&&di(Jt(i),{segmentUrls:r,initialization:Jt(g)}),base:o&&di(Jt(o),{initialization:Jt(g)})};return Object.keys(S).forEach(E=>{S[E]||delete S[E]}),S},sR=(s,e,i)=>r=>{const o=Lt(r,"BaseURL"),u=Gf(e,o),c=di(s,Jt(r)),p=h0(r);return u.map(g=>({segmentInfo:di(i,p),attributes:di(c,g)}))},rR=s=>s.reduce((e,i)=>{const r=Jt(i);r.schemeIdUri&&(r.schemeIdUri=r.schemeIdUri.toLowerCase());const o=nR[r.schemeIdUri];if(o){e[o]={attributes:r};const u=Lt(i,"cenc:pssh")[0];if(u){const c=pd(u);e[o].pssh=c&&Z_(c)}}return e},{}),aR=s=>{if(s.schemeIdUri==="urn:scte:dash:cc:cea-608:2015")return(typeof s.value!="string"?[]:s.value.split(";")).map(i=>{let r,o;return o=i,/^CC\d=/.test(i)?[r,o]=i.split("="):/^CC\d$/.test(i)&&(r=i),{channel:r,language:o}});if(s.schemeIdUri==="urn:scte:dash:cc:cea-708:2015")return(typeof s.value!="string"?[]:s.value.split(";")).map(i=>{const r={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(i)){const[o,u=""]=i.split("=");r.channel=o,r.language=i,u.split(",").forEach(c=>{const[p,g]=c.split(":");p==="lang"?r.language=g:p==="er"?r.easyReader=Number(g):p==="war"?r.aspectRatio=Number(g):p==="3D"&&(r["3D"]=Number(g))})}else r.language=i;return r.channel&&(r.channel="SERVICE"+r.channel),r})},oR=s=>Wl(Lt(s.node,"EventStream").map(e=>{const i=Jt(e),r=i.schemeIdUri;return Lt(e,"Event").map(o=>{const u=Jt(o),c=u.presentationTime||0,p=i.timescale||1,g=u.duration||0,b=c/p+s.attributes.start;return{schemeIdUri:r,value:i.value,id:u.id,start:b,end:b+g/p,messageData:pd(o)||u.messageData,contentEncoding:i.contentEncoding,presentationTimeOffset:i.presentationTimeOffset||0}})})),lR=(s,e,i)=>r=>{const o=Jt(r),u=Gf(e,Lt(r,"BaseURL")),c=Lt(r,"Role")[0],p={role:Jt(c)};let g=di(s,o,p);const b=Lt(r,"Accessibility")[0],S=aR(Jt(b));S&&(g=di(g,{captionServices:S}));const E=Lt(r,"Label")[0];if(E&&E.childNodes.length){const z=E.childNodes[0].nodeValue.trim();g=di(g,{label:z})}const A=rR(Lt(r,"ContentProtection"));Object.keys(A).length&&(g=di(g,{contentProtection:A}));const M=h0(r),U=Lt(r,"Representation"),D=di(i,M);return Wl(U.map(sR(g,u,D)))},uR=(s,e)=>(i,r)=>{const o=Gf(e,Lt(i.node,"BaseURL")),u=di(s,{periodStart:i.attributes.start});typeof i.attributes.duration=="number"&&(u.periodDuration=i.attributes.duration);const c=Lt(i.node,"AdaptationSet"),p=h0(i.node);return Wl(c.map(lR(u,o,p)))},cR=(s,e)=>{if(s.length>1&&e({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),!s.length)return null;const i=di({serverURL:pd(s[0])},Jt(s[0]));return i.queryBeforeStart=i.queryBeforeStart==="true",i},dR=({attributes:s,priorPeriodAttributes:e,mpdType:i})=>typeof s.start=="number"?s.start:e&&typeof e.start=="number"&&typeof e.duration=="number"?e.start+e.duration:!e&&i==="static"?0:null,hR=(s,e={})=>{const{manifestUri:i="",NOW:r=Date.now(),clientOffset:o=0,eventHandler:u=function(){}}=e,c=Lt(s,"Period");if(!c.length)throw new Error(Ql.INVALID_NUMBER_OF_PERIOD);const p=Lt(s,"Location"),g=Jt(s),b=Gf([{baseUrl:i}],Lt(s,"BaseURL")),S=Lt(s,"ContentSteering");g.type=g.type||"static",g.sourceDuration=g.mediaPresentationDuration||0,g.NOW=r,g.clientOffset=o,p.length&&(g.locations=p.map(pd));const E=[];return c.forEach((A,M)=>{const U=Jt(A),D=E[M-1];U.start=dR({attributes:U,priorPeriodAttributes:D?D.attributes:null,mpdType:g.type}),E.push({node:A,attributes:U})}),{locations:g.locations,contentSteeringInfo:cR(S,u),representationInfo:Wl(E.map(uR(g,b))),eventStream:Wl(E.map(oR))}},l1=s=>{if(s==="")throw new Error(Ql.DASH_EMPTY_MANIFEST);const e=new SO;let i,r;try{i=e.parseFromString(s,"application/xml"),r=i&&i.documentElement.tagName==="MPD"?i.documentElement:null}catch{}if(!r||r&&r.getElementsByTagName("parsererror").length>0)throw new Error(Ql.DASH_INVALID_XML);return r},fR=s=>{const e=Lt(s,"UTCTiming")[0];if(!e)return null;const i=Jt(e);switch(i.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":i.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":i.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":i.method="DIRECT",i.value=Date.parse(i.value);break;case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:throw new Error(Ql.UNSUPPORTED_UTC_TIMING_SCHEME)}return i},pR=(s,e={})=>{const i=hR(l1(s),e),r=eR(i.representationInfo);return $O({dashPlaylists:r,locations:i.locations,contentSteering:i.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:i.eventStream})},mR=s=>fR(l1(s));var u1=Math.pow(2,32),gR=function(s){var e=new DataView(s.buffer,s.byteOffset,s.byteLength),i;return e.getBigUint64?(i=e.getBigUint64(0),i0;r+=12,o--)i.references.push({referenceType:(s[r]&128)>>>7,referencedSize:e.getUint32(r)&2147483647,subsegmentDuration:e.getUint32(r+4),startsWithSap:!!(s[r+8]&128),sapType:(s[r+8]&112)>>>4,sapDeltaTime:e.getUint32(r+8)&268435455});return i},bR=vR;const _R=Xc(bR);var TR=Ie([73,68,51]),SR=function(e,i){i===void 0&&(i=0),e=Ie(e);var r=e[i+5],o=e[i+6]<<21|e[i+7]<<14|e[i+8]<<7|e[i+9],u=(r&16)>>4;return u?o+20:o+10},md=function s(e,i){return i===void 0&&(i=0),e=Ie(e),e.length-i<10||!Mt(e,TR,{offset:i})?i:(i+=SR(e,i),s(e,i))},d1=function(e){return typeof e=="string"?aT(e):e},xR=function(e){return Array.isArray(e)?e.map(function(i){return d1(i)}):[d1(e)]},ER=function s(e,i,r){r===void 0&&(r=!1),i=xR(i),e=Ie(e);var o=[];if(!i.length)return o;for(var u=0;u>>0,p=e.subarray(u+4,u+8);if(c===0)break;var g=u+c;if(g>e.length){if(r)break;g=e.length}var b=e.subarray(u+8,g);Mt(p,i[0])&&(i.length===1?o.push(b):o.push.apply(o,s(b,i.slice(1),r))),u=g}return o},Xf={EBML:Ie([26,69,223,163]),DocType:Ie([66,130]),Segment:Ie([24,83,128,103]),SegmentInfo:Ie([21,73,169,102]),Tracks:Ie([22,84,174,107]),Track:Ie([174]),TrackNumber:Ie([215]),DefaultDuration:Ie([35,227,131]),TrackEntry:Ie([174]),TrackType:Ie([131]),FlagDefault:Ie([136]),CodecID:Ie([134]),CodecPrivate:Ie([99,162]),VideoTrack:Ie([224]),AudioTrack:Ie([225]),Cluster:Ie([31,67,182,117]),Timestamp:Ie([231]),TimestampScale:Ie([42,215,177]),BlockGroup:Ie([160]),BlockDuration:Ie([155]),Block:Ie([161]),SimpleBlock:Ie([163])},f0=[128,64,32,16,8,4,2,1],CR=function(e){for(var i=1,r=0;r=i.length)return i.length;var o=Yf(i,r,!1);if(Mt(e.bytes,o.bytes))return r;var u=Yf(i,r+o.length);return s(e,i,r+u.length+u.value+o.length)},f1=function s(e,i){i=AR(i),e=Ie(e);var r=[];if(!i.length)return r;for(var o=0;oe.length?e.length:p+c.value,b=e.subarray(p,g);Mt(i[0],u.bytes)&&(i.length===1?r.push(b):r=r.concat(s(b,i.slice(1))));var S=u.length+c.length+b.length;o+=S}return r},wR=Ie([0,0,0,1]),kR=Ie([0,0,1]),OR=Ie([0,0,3]),RR=function(e){for(var i=[],r=1;r>1&63),r.indexOf(b)!==-1&&(c=u+g),u+=g+(i==="h264"?1:2)}return e.subarray(0,0)},MR=function(e,i,r){return p1(e,"h264",i,r)},LR=function(e,i,r){return p1(e,"h265",i,r)},Vi={webm:Ie([119,101,98,109]),matroska:Ie([109,97,116,114,111,115,107,97]),flac:Ie([102,76,97,67]),ogg:Ie([79,103,103,83]),ac3:Ie([11,119]),riff:Ie([82,73,70,70]),avi:Ie([65,86,73]),wav:Ie([87,65,86,69]),"3gp":Ie([102,116,121,112,51,103]),mp4:Ie([102,116,121,112]),fmp4:Ie([115,116,121,112]),mov:Ie([102,116,121,112,113,116]),moov:Ie([109,111,111,118]),moof:Ie([109,111,111,102])},Zl={aac:function(e){var i=md(e);return Mt(e,[255,16],{offset:i,mask:[255,22]})},mp3:function(e){var i=md(e);return Mt(e,[255,2],{offset:i,mask:[255,6]})},webm:function(e){var i=f1(e,[Xf.EBML,Xf.DocType])[0];return Mt(i,Vi.webm)},mkv:function(e){var i=f1(e,[Xf.EBML,Xf.DocType])[0];return Mt(i,Vi.matroska)},mp4:function(e){if(Zl["3gp"](e)||Zl.mov(e))return!1;if(Mt(e,Vi.mp4,{offset:4})||Mt(e,Vi.fmp4,{offset:4})||Mt(e,Vi.moof,{offset:4})||Mt(e,Vi.moov,{offset:4}))return!0},mov:function(e){return Mt(e,Vi.mov,{offset:4})},"3gp":function(e){return Mt(e,Vi["3gp"],{offset:4})},ac3:function(e){var i=md(e);return Mt(e,Vi.ac3,{offset:i})},ts:function(e){if(e.length<189&&e.length>=1)return e[0]===71;for(var i=0;i+1880},g0=9e4,y0,v0,Wf,b0,m1,g1,y1;y0=function(s){return s*g0},v0=function(s,e){return s*e},Wf=function(s){return s/g0},b0=function(s,e){return s/e},m1=function(s,e){return y0(b0(s,e))},g1=function(s,e){return v0(Wf(s),e)},y1=function(s,e,i){return Wf(i?s:s-e)};var Ao={ONE_SECOND_IN_TS:g0,secondsToVideoTs:y0,secondsToAudioTs:v0,videoTsToSeconds:Wf,audioTsToSeconds:b0,audioTsToVideoTs:m1,videoTsToAudioTs:g1,metadataTsToSeconds:y1};/**
+@`+(s.systemId||"")+"#[line:"+s.lineNumber+",col:"+s.columnNumber+"]"}function WT(s,e,i){return typeof s=="string"?s.substr(e,i):s.length>=e+i||e?new java.lang.String(s,e,i)+"":s}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(s){hd.prototype[s]=function(){return null}});function Vf(s,e){s.currentElement?s.currentElement.appendChild(e):s.doc.appendChild(e)}jf.__DOMHandler=hd,jf.normalizeLineEndings=XT,jf.DOMParser=YT;var SO=jf.DOMParser;/*! @name mpd-parser @version 1.3.1 @license Apache-2.0 */const QT=s=>!!s&&typeof s=="object",di=(...s)=>s.reduce((e,i)=>(typeof i!="object"||Object.keys(i).forEach(r=>{Array.isArray(e[r])&&Array.isArray(i[r])?e[r]=e[r].concat(i[r]):QT(e[r])&&QT(i[r])?e[r]=di(e[r],i[r]):e[r]=i[r]}),e),{}),KT=s=>Object.keys(s).map(e=>s[e]),xO=(s,e)=>{const i=[];for(let r=s;rs.reduce((e,i)=>e.concat(i),[]),ZT=s=>{if(!s.length)return[];const e=[];for(let i=0;is.reduce((i,r,o)=>(r[e]&&i.push(o),i),[]),CO=(s,e)=>KT(s.reduce((i,r)=>(r.forEach(o=>{i[e(o)]=o}),i),{}));var Ql={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",INVALID_NUMBER_OF_CONTENT_STEERING:"INVALID_NUMBER_OF_CONTENT_STEERING",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",MISSING_SEGMENT_INFORMATION:"MISSING_SEGMENT_INFORMATION",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};const fd=({baseUrl:s="",source:e="",range:i="",indexRange:r=""})=>{const o={uri:e,resolvedUri:Nf(s||"",e)};if(i||r){const c=(i||r).split("-");let p=P.BigInt?P.BigInt(c[0]):parseInt(c[0],10),g=P.BigInt?P.BigInt(c[1]):parseInt(c[1],10);p{let e;return typeof s.offset=="bigint"||typeof s.length=="bigint"?e=P.BigInt(s.offset)+P.BigInt(s.length)-P.BigInt(1):e=s.offset+s.length-1,`${s.offset}-${e}`},JT=s=>(s&&typeof s!="number"&&(s=parseInt(s,10)),isNaN(s)?null:s),DO={static(s){const{duration:e,timescale:i=1,sourceDuration:r,periodDuration:o}=s,u=JT(s.endNumber),c=e/i;return typeof u=="number"?{start:0,end:u}:typeof o=="number"?{start:0,end:o/c}:{start:0,end:r/c}},dynamic(s){const{NOW:e,clientOffset:i,availabilityStartTime:r,timescale:o=1,duration:u,periodStart:c=0,minimumUpdatePeriod:p=0,timeShiftBufferDepth:g=1/0}=s,b=JT(s.endNumber),S=(e+i)/1e3,E=r+c,M=S+p-E,U=Math.ceil(M*o/u),D=Math.floor((S-E-g)*o/u),z=Math.floor((S-E)*o/u);return{start:Math.max(0,D),end:typeof b=="number"?b:Math.min(U,z)}}},wO=s=>e=>{const{duration:i,timescale:r=1,periodStart:o,startNumber:u=1}=s;return{number:u+e,duration:i/r,timeline:o,time:e*i}},l0=s=>{const{type:e,duration:i,timescale:r=1,periodDuration:o,sourceDuration:u}=s,{start:c,end:p}=DO[e](s),g=xO(c,p).map(wO(s));if(e==="static"){const b=g.length-1,S=typeof o=="number"?o:u;g[b].duration=S-i/r*b}return g},e1=s=>{const{baseUrl:e,initialization:i={},sourceDuration:r,indexRange:o="",periodStart:u,presentationTime:c,number:p=0,duration:g}=s;if(!e)throw new Error(Ql.NO_BASE_URL);const b=fd({baseUrl:e,source:i.sourceURL,range:i.range}),S=fd({baseUrl:e,source:e,indexRange:o});if(S.map=b,g){const E=l0(s);E.length&&(S.duration=E[0].duration,S.timeline=E[0].timeline)}else r&&(S.duration=r,S.timeline=u);return S.presentationTime=c||u,S.number=p,[S]},u0=(s,e,i)=>{const r=s.sidx.map?s.sidx.map:null,o=s.sidx.duration,u=s.timeline||0,c=s.sidx.byterange,p=c.offset+c.length,g=e.timescale,b=e.references.filter(z=>z.referenceType!==1),S=[],E=s.endList?"static":"dynamic",A=s.sidx.timeline;let M=A,U=s.mediaSequence||0,D;typeof e.firstOffset=="bigint"?D=P.BigInt(p)+e.firstOffset:D=p+e.firstOffset;for(let z=0;zCO(s,({timeline:e})=>e).sort((e,i)=>e.timeline>i.timeline?1:-1),RO=(s,e)=>{for(let i=0;i{let e=[];return Yk(s,kO,(i,r,o,u)=>{e=e.concat(i.playlists||[])}),e},n1=({playlist:s,mediaSequence:e})=>{s.mediaSequence=e,s.segments.forEach((i,r)=>{i.number=s.mediaSequence+r})},MO=({oldPlaylists:s,newPlaylists:e,timelineStarts:i})=>{e.forEach(r=>{r.discontinuitySequence=i.findIndex(function({timeline:g}){return g===r.timeline});const o=RO(s,r.attributes.NAME);if(!o||r.sidx)return;const u=r.segments[0],c=o.segments.findIndex(function(g){return Math.abs(g.presentationTime-u.presentationTime)o.timeline||o.segments.length&&r.timeline>o.segments[o.segments.length-1].timeline)&&r.discontinuitySequence--;return}o.segments[c].discontinuity&&!u.discontinuity&&(u.discontinuity=!0,r.discontinuityStarts.unshift(0),r.discontinuitySequence--),n1({playlist:r,mediaSequence:o.segments[c].number})})},LO=({oldManifest:s,newManifest:e})=>{const i=s.playlists.concat(i1(s)),r=e.playlists.concat(i1(e));return e.timelineStarts=t1([s.timelineStarts,e.timelineStarts]),MO({oldPlaylists:i,newPlaylists:r,timelineStarts:e.timelineStarts}),e},$f=s=>s&&s.uri+"-"+AO(s.byterange),c0=s=>{const e=s.reduce(function(r,o){return r[o.attributes.baseUrl]||(r[o.attributes.baseUrl]=[]),r[o.attributes.baseUrl].push(o),r},{});let i=[];return Object.values(e).forEach(r=>{const o=KT(r.reduce((u,c)=>{const p=c.attributes.id+(c.attributes.lang||"");return u[p]?(c.segments&&(c.segments[0]&&(c.segments[0].discontinuity=!0),u[p].segments.push(...c.segments)),c.attributes.contentProtection&&(u[p].attributes.contentProtection=c.attributes.contentProtection)):(u[p]=c,u[p].attributes.timelineStarts=[]),u[p].attributes.timelineStarts.push({start:c.attributes.periodStart,timeline:c.attributes.periodStart}),u},{}));i=i.concat(o)}),i.map(r=>(r.discontinuityStarts=EO(r.segments||[],"discontinuity"),r))},d0=(s,e)=>{const i=$f(s.sidx),r=i&&e[i]&&e[i].sidx;return r&&u0(s,r,s.sidx.resolvedUri),s},IO=(s,e={})=>{if(!Object.keys(e).length)return s;for(const i in s)s[i]=d0(s[i],e);return s},NO=({attributes:s,segments:e,sidx:i,mediaSequence:r,discontinuitySequence:o,discontinuityStarts:u},c)=>{const p={attributes:{NAME:s.id,BANDWIDTH:s.bandwidth,CODECS:s.codecs,"PROGRAM-ID":1},uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,discontinuitySequence:o,discontinuityStarts:u,timelineStarts:s.timelineStarts,mediaSequence:r,segments:e};return s.contentProtection&&(p.contentProtection=s.contentProtection),s.serviceLocation&&(p.attributes.serviceLocation=s.serviceLocation),i&&(p.sidx=i),c&&(p.attributes.AUDIO="audio",p.attributes.SUBTITLES="subs"),p},PO=({attributes:s,segments:e,mediaSequence:i,discontinuityStarts:r,discontinuitySequence:o})=>{typeof e>"u"&&(e=[{uri:s.baseUrl,timeline:s.periodStart,resolvedUri:s.baseUrl||"",duration:s.sourceDuration,number:0}],s.duration=s.sourceDuration);const u={NAME:s.id,BANDWIDTH:s.bandwidth,"PROGRAM-ID":1};s.codecs&&(u.CODECS=s.codecs);const c={attributes:u,uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,timelineStarts:s.timelineStarts,discontinuityStarts:r,discontinuitySequence:o,mediaSequence:i,segments:e};return s.serviceLocation&&(c.attributes.serviceLocation=s.serviceLocation),c},UO=(s,e={},i=!1)=>{let r;const o=s.reduce((u,c)=>{const p=c.attributes.role&&c.attributes.role.value||"",g=c.attributes.lang||"";let b=c.attributes.label||"main";if(g&&!c.attributes.label){const E=p?` (${p})`:"";b=`${c.attributes.lang}${E}`}u[b]||(u[b]={language:g,autoselect:!0,default:p==="main",playlists:[],uri:""});const S=d0(NO(c,i),e);return u[b].playlists.push(S),typeof r>"u"&&p==="main"&&(r=c,r.default=!0),u},{});if(!r){const u=Object.keys(o)[0];o[u].default=!0}return o},BO=(s,e={})=>s.reduce((i,r)=>{const o=r.attributes.label||r.attributes.lang||"text",u=r.attributes.lang||"und";return i[o]||(i[o]={language:u,default:!1,autoselect:!1,playlists:[],uri:""}),i[o].playlists.push(d0(PO(r),e)),i},{}),FO=s=>s.reduce((e,i)=>(i&&i.forEach(r=>{const{channel:o,language:u}=r;e[u]={autoselect:!1,default:!1,instreamId:o,language:u},r.hasOwnProperty("aspectRatio")&&(e[u].aspectRatio=r.aspectRatio),r.hasOwnProperty("easyReader")&&(e[u].easyReader=r.easyReader),r.hasOwnProperty("3D")&&(e[u]["3D"]=r["3D"])}),e),{}),HO=({attributes:s,segments:e,sidx:i,discontinuityStarts:r})=>{const o={attributes:{NAME:s.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:s.width,height:s.height},CODECS:s.codecs,BANDWIDTH:s.bandwidth,"PROGRAM-ID":1},uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,discontinuityStarts:r,timelineStarts:s.timelineStarts,segments:e};return s.frameRate&&(o.attributes["FRAME-RATE"]=s.frameRate),s.contentProtection&&(o.contentProtection=s.contentProtection),s.serviceLocation&&(o.attributes.serviceLocation=s.serviceLocation),i&&(o.sidx=i),o},zO=({attributes:s})=>s.mimeType==="video/mp4"||s.mimeType==="video/webm"||s.contentType==="video",jO=({attributes:s})=>s.mimeType==="audio/mp4"||s.mimeType==="audio/webm"||s.contentType==="audio",qO=({attributes:s})=>s.mimeType==="text/vtt"||s.contentType==="text",VO=(s,e)=>{s.forEach(i=>{i.mediaSequence=0,i.discontinuitySequence=e.findIndex(function({timeline:r}){return r===i.timeline}),i.segments&&i.segments.forEach((r,o)=>{r.number=o})})},s1=s=>s?Object.keys(s).reduce((e,i)=>{const r=s[i];return e.concat(r.playlists)},[]):[],$O=({dashPlaylists:s,locations:e,contentSteering:i,sidxMapping:r={},previousManifest:o,eventStream:u})=>{if(!s.length)return{};const{sourceDuration:c,type:p,suggestedPresentationDelay:g,minimumUpdatePeriod:b}=s[0].attributes,S=c0(s.filter(zO)).map(HO),E=c0(s.filter(jO)),A=c0(s.filter(qO)),M=s.map(Q=>Q.attributes.captionServices).filter(Boolean),U={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:c,playlists:IO(S,r)};b>=0&&(U.minimumUpdatePeriod=b*1e3),e&&(U.locations=e),i&&(U.contentSteering=i),p==="dynamic"&&(U.suggestedPresentationDelay=g),u&&u.length>0&&(U.eventStream=u);const D=U.playlists.length===0,z=E.length?UO(E,r,D):null,H=A.length?BO(A,r):null,Y=S.concat(s1(z),s1(H)),$=Y.map(({timelineStarts:Q})=>Q);return U.timelineStarts=t1($),VO(Y,U.timelineStarts),z&&(U.mediaGroups.AUDIO.audio=z),H&&(U.mediaGroups.SUBTITLES.subs=H),M.length&&(U.mediaGroups["CLOSED-CAPTIONS"].cc=FO(M)),o?LO({oldManifest:o,newManifest:U}):U},GO=(s,e,i)=>{const{NOW:r,clientOffset:o,availabilityStartTime:u,timescale:c=1,periodStart:p=0,minimumUpdatePeriod:g=0}=s,b=(r+o)/1e3,S=u+p,A=b+g-S;return Math.ceil((A*c-e)/i)},r1=(s,e)=>{const{type:i,minimumUpdatePeriod:r=0,media:o="",sourceDuration:u,timescale:c=1,startNumber:p=1,periodStart:g}=s,b=[];let S=-1;for(let E=0;ES&&(S=D);let z;if(U<0){const $=E+1;$===e.length?i==="dynamic"&&r>0&&o.indexOf("$Number$")>0?z=GO(s,S,M):z=(u*c-S)/M:z=(e[$].t-S)/M}else z=U+1;const H=p+b.length+z;let Y=p+b.length;for(;Y(e,i,r,o)=>{if(e==="$$")return"$";if(typeof s[i]>"u")return e;const u=""+s[i];return i==="RepresentationID"||(r?o=parseInt(o,10):o=1,u.length>=o)?u:`${new Array(o-u.length+1).join("0")}${u}`},a1=(s,e)=>s.replace(XO,YO(e)),WO=(s,e)=>!s.duration&&!e?[{number:s.startNumber||1,duration:s.sourceDuration,time:0,timeline:s.periodStart}]:s.duration?l0(s):r1(s,e),QO=(s,e)=>{const i={RepresentationID:s.id,Bandwidth:s.bandwidth||0},{initialization:r={sourceURL:"",range:""}}=s,o=fd({baseUrl:s.baseUrl,source:a1(r.sourceURL,i),range:r.range});return WO(s,e).map(c=>{i.Number=c.number,i.Time=c.time;const p=a1(s.media||"",i),g=s.timescale||1,b=s.presentationTimeOffset||0,S=s.periodStart+(c.time-b)/g;return{uri:p,timeline:c.timeline,duration:c.duration,resolvedUri:Nf(s.baseUrl||"",p),map:o,number:c.number,presentationTime:S}})},KO=(s,e)=>{const{baseUrl:i,initialization:r={}}=s,o=fd({baseUrl:i,source:r.sourceURL,range:r.range}),u=fd({baseUrl:i,source:e.media,range:e.mediaRange});return u.map=o,u},ZO=(s,e)=>{const{duration:i,segmentUrls:r=[],periodStart:o}=s;if(!i&&!e||i&&e)throw new Error(Ql.SEGMENT_TIME_UNSPECIFIED);const u=r.map(g=>KO(s,g));let c;return i&&(c=l0(s)),e&&(c=r1(s,e)),c.map((g,b)=>{if(u[b]){const S=u[b],E=s.timescale||1,A=s.presentationTimeOffset||0;return S.timeline=g.timeline,S.duration=g.duration,S.number=g.number,S.presentationTime=o+(g.time-A)/E,S}}).filter(g=>g)},JO=({attributes:s,segmentInfo:e})=>{let i,r;e.template?(r=QO,i=di(s,e.template)):e.base?(r=e1,i=di(s,e.base)):e.list&&(r=ZO,i=di(s,e.list));const o={attributes:s};if(!r)return o;const u=r(i,e.segmentTimeline);if(i.duration){const{duration:c,timescale:p=1}=i;i.duration=c/p}else u.length?i.duration=u.reduce((c,p)=>Math.max(c,Math.ceil(p.duration)),0):i.duration=0;return o.attributes=i,o.segments=u,e.base&&i.indexRange&&(o.sidx=u[0],o.segments=[]),o},eR=s=>s.map(JO),Lt=(s,e)=>ZT(s.childNodes).filter(({tagName:i})=>i===e),pd=s=>s.textContent.trim(),tR=s=>parseFloat(s.split("/").reduce((e,i)=>e/i)),Kl=s=>{const p=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(s);if(!p)return 0;const[g,b,S,E,A,M]=p.slice(1);return parseFloat(g||0)*31536e3+parseFloat(b||0)*2592e3+parseFloat(S||0)*86400+parseFloat(E||0)*3600+parseFloat(A||0)*60+parseFloat(M||0)},iR=s=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(s)&&(s+="Z"),Date.parse(s)),o1={mediaPresentationDuration(s){return Kl(s)},availabilityStartTime(s){return iR(s)/1e3},minimumUpdatePeriod(s){return Kl(s)},suggestedPresentationDelay(s){return Kl(s)},type(s){return s},timeShiftBufferDepth(s){return Kl(s)},start(s){return Kl(s)},width(s){return parseInt(s,10)},height(s){return parseInt(s,10)},bandwidth(s){return parseInt(s,10)},frameRate(s){return tR(s)},startNumber(s){return parseInt(s,10)},timescale(s){return parseInt(s,10)},presentationTimeOffset(s){return parseInt(s,10)},duration(s){const e=parseInt(s,10);return isNaN(e)?Kl(s):e},d(s){return parseInt(s,10)},t(s){return parseInt(s,10)},r(s){return parseInt(s,10)},presentationTime(s){return parseInt(s,10)},DEFAULT(s){return s}},Jt=s=>s&&s.attributes?ZT(s.attributes).reduce((e,i)=>{const r=o1[i.name]||o1.DEFAULT;return e[i.name]=r(i.value),e},{}):{},nR={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime","urn:mpeg:dash:mp4protection:2011":"mp4protection"},Gf=(s,e)=>e.length?Wl(s.map(function(i){return e.map(function(r){const o=pd(r),u=Nf(i.baseUrl,o),c=di(Jt(r),{baseUrl:u});return u!==o&&!c.serviceLocation&&i.serviceLocation&&(c.serviceLocation=i.serviceLocation),c})})):s,h0=s=>{const e=Lt(s,"SegmentTemplate")[0],i=Lt(s,"SegmentList")[0],r=i&&Lt(i,"SegmentURL").map(E=>di({tag:"SegmentURL"},Jt(E))),o=Lt(s,"SegmentBase")[0],u=i||e,c=u&&Lt(u,"SegmentTimeline")[0],p=i||o||e,g=p&&Lt(p,"Initialization")[0],b=e&&Jt(e);b&&g?b.initialization=g&&Jt(g):b&&b.initialization&&(b.initialization={sourceURL:b.initialization});const S={template:b,segmentTimeline:c&&Lt(c,"S").map(E=>Jt(E)),list:i&&di(Jt(i),{segmentUrls:r,initialization:Jt(g)}),base:o&&di(Jt(o),{initialization:Jt(g)})};return Object.keys(S).forEach(E=>{S[E]||delete S[E]}),S},sR=(s,e,i)=>r=>{const o=Lt(r,"BaseURL"),u=Gf(e,o),c=di(s,Jt(r)),p=h0(r);return u.map(g=>({segmentInfo:di(i,p),attributes:di(c,g)}))},rR=s=>s.reduce((e,i)=>{const r=Jt(i);r.schemeIdUri&&(r.schemeIdUri=r.schemeIdUri.toLowerCase());const o=nR[r.schemeIdUri];if(o){e[o]={attributes:r};const u=Lt(i,"cenc:pssh")[0];if(u){const c=pd(u);e[o].pssh=c&&Z_(c)}}return e},{}),aR=s=>{if(s.schemeIdUri==="urn:scte:dash:cc:cea-608:2015")return(typeof s.value!="string"?[]:s.value.split(";")).map(i=>{let r,o;return o=i,/^CC\d=/.test(i)?[r,o]=i.split("="):/^CC\d$/.test(i)&&(r=i),{channel:r,language:o}});if(s.schemeIdUri==="urn:scte:dash:cc:cea-708:2015")return(typeof s.value!="string"?[]:s.value.split(";")).map(i=>{const r={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(i)){const[o,u=""]=i.split("=");r.channel=o,r.language=i,u.split(",").forEach(c=>{const[p,g]=c.split(":");p==="lang"?r.language=g:p==="er"?r.easyReader=Number(g):p==="war"?r.aspectRatio=Number(g):p==="3D"&&(r["3D"]=Number(g))})}else r.language=i;return r.channel&&(r.channel="SERVICE"+r.channel),r})},oR=s=>Wl(Lt(s.node,"EventStream").map(e=>{const i=Jt(e),r=i.schemeIdUri;return Lt(e,"Event").map(o=>{const u=Jt(o),c=u.presentationTime||0,p=i.timescale||1,g=u.duration||0,b=c/p+s.attributes.start;return{schemeIdUri:r,value:i.value,id:u.id,start:b,end:b+g/p,messageData:pd(o)||u.messageData,contentEncoding:i.contentEncoding,presentationTimeOffset:i.presentationTimeOffset||0}})})),lR=(s,e,i)=>r=>{const o=Jt(r),u=Gf(e,Lt(r,"BaseURL")),c=Lt(r,"Role")[0],p={role:Jt(c)};let g=di(s,o,p);const b=Lt(r,"Accessibility")[0],S=aR(Jt(b));S&&(g=di(g,{captionServices:S}));const E=Lt(r,"Label")[0];if(E&&E.childNodes.length){const z=E.childNodes[0].nodeValue.trim();g=di(g,{label:z})}const A=rR(Lt(r,"ContentProtection"));Object.keys(A).length&&(g=di(g,{contentProtection:A}));const M=h0(r),U=Lt(r,"Representation"),D=di(i,M);return Wl(U.map(sR(g,u,D)))},uR=(s,e)=>(i,r)=>{const o=Gf(e,Lt(i.node,"BaseURL")),u=di(s,{periodStart:i.attributes.start});typeof i.attributes.duration=="number"&&(u.periodDuration=i.attributes.duration);const c=Lt(i.node,"AdaptationSet"),p=h0(i.node);return Wl(c.map(lR(u,o,p)))},cR=(s,e)=>{if(s.length>1&&e({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),!s.length)return null;const i=di({serverURL:pd(s[0])},Jt(s[0]));return i.queryBeforeStart=i.queryBeforeStart==="true",i},dR=({attributes:s,priorPeriodAttributes:e,mpdType:i})=>typeof s.start=="number"?s.start:e&&typeof e.start=="number"&&typeof e.duration=="number"?e.start+e.duration:!e&&i==="static"?0:null,hR=(s,e={})=>{const{manifestUri:i="",NOW:r=Date.now(),clientOffset:o=0,eventHandler:u=function(){}}=e,c=Lt(s,"Period");if(!c.length)throw new Error(Ql.INVALID_NUMBER_OF_PERIOD);const p=Lt(s,"Location"),g=Jt(s),b=Gf([{baseUrl:i}],Lt(s,"BaseURL")),S=Lt(s,"ContentSteering");g.type=g.type||"static",g.sourceDuration=g.mediaPresentationDuration||0,g.NOW=r,g.clientOffset=o,p.length&&(g.locations=p.map(pd));const E=[];return c.forEach((A,M)=>{const U=Jt(A),D=E[M-1];U.start=dR({attributes:U,priorPeriodAttributes:D?D.attributes:null,mpdType:g.type}),E.push({node:A,attributes:U})}),{locations:g.locations,contentSteeringInfo:cR(S,u),representationInfo:Wl(E.map(uR(g,b))),eventStream:Wl(E.map(oR))}},l1=s=>{if(s==="")throw new Error(Ql.DASH_EMPTY_MANIFEST);const e=new SO;let i,r;try{i=e.parseFromString(s,"application/xml"),r=i&&i.documentElement.tagName==="MPD"?i.documentElement:null}catch{}if(!r||r&&r.getElementsByTagName("parsererror").length>0)throw new Error(Ql.DASH_INVALID_XML);return r},fR=s=>{const e=Lt(s,"UTCTiming")[0];if(!e)return null;const i=Jt(e);switch(i.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":i.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":i.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":i.method="DIRECT",i.value=Date.parse(i.value);break;case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:throw new Error(Ql.UNSUPPORTED_UTC_TIMING_SCHEME)}return i},pR=(s,e={})=>{const i=hR(l1(s),e),r=eR(i.representationInfo);return $O({dashPlaylists:r,locations:i.locations,contentSteering:i.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:i.eventStream})},mR=s=>fR(l1(s));var u1=Math.pow(2,32),gR=function(s){var e=new DataView(s.buffer,s.byteOffset,s.byteLength),i;return e.getBigUint64?(i=e.getBigUint64(0),i0;r+=12,o--)i.references.push({referenceType:(s[r]&128)>>>7,referencedSize:e.getUint32(r)&2147483647,subsegmentDuration:e.getUint32(r+4),startsWithSap:!!(s[r+8]&128),sapType:(s[r+8]&112)>>>4,sapDeltaTime:e.getUint32(r+8)&268435455});return i},bR=vR;const _R=Xc(bR);var TR=Ie([73,68,51]),SR=function(e,i){i===void 0&&(i=0),e=Ie(e);var r=e[i+5],o=e[i+6]<<21|e[i+7]<<14|e[i+8]<<7|e[i+9],u=(r&16)>>4;return u?o+20:o+10},md=function s(e,i){return i===void 0&&(i=0),e=Ie(e),e.length-i<10||!Mt(e,TR,{offset:i})?i:(i+=SR(e,i),s(e,i))},d1=function(e){return typeof e=="string"?aT(e):e},xR=function(e){return Array.isArray(e)?e.map(function(i){return d1(i)}):[d1(e)]},ER=function s(e,i,r){r===void 0&&(r=!1),i=xR(i),e=Ie(e);var o=[];if(!i.length)return o;for(var u=0;u>>0,p=e.subarray(u+4,u+8);if(c===0)break;var g=u+c;if(g>e.length){if(r)break;g=e.length}var b=e.subarray(u+8,g);Mt(p,i[0])&&(i.length===1?o.push(b):o.push.apply(o,s(b,i.slice(1),r))),u=g}return o},Xf={EBML:Ie([26,69,223,163]),DocType:Ie([66,130]),Segment:Ie([24,83,128,103]),SegmentInfo:Ie([21,73,169,102]),Tracks:Ie([22,84,174,107]),Track:Ie([174]),TrackNumber:Ie([215]),DefaultDuration:Ie([35,227,131]),TrackEntry:Ie([174]),TrackType:Ie([131]),FlagDefault:Ie([136]),CodecID:Ie([134]),CodecPrivate:Ie([99,162]),VideoTrack:Ie([224]),AudioTrack:Ie([225]),Cluster:Ie([31,67,182,117]),Timestamp:Ie([231]),TimestampScale:Ie([42,215,177]),BlockGroup:Ie([160]),BlockDuration:Ie([155]),Block:Ie([161]),SimpleBlock:Ie([163])},f0=[128,64,32,16,8,4,2,1],CR=function(e){for(var i=1,r=0;r=i.length)return i.length;var o=Yf(i,r,!1);if(Mt(e.bytes,o.bytes))return r;var u=Yf(i,r+o.length);return s(e,i,r+u.length+u.value+o.length)},f1=function s(e,i){i=AR(i),e=Ie(e);var r=[];if(!i.length)return r;for(var o=0;oe.length?e.length:p+c.value,b=e.subarray(p,g);Mt(i[0],u.bytes)&&(i.length===1?r.push(b):r=r.concat(s(b,i.slice(1))));var S=u.length+c.length+b.length;o+=S}return r},wR=Ie([0,0,0,1]),kR=Ie([0,0,1]),OR=Ie([0,0,3]),RR=function(e){for(var i=[],r=1;r>1&63),r.indexOf(b)!==-1&&(c=u+g),u+=g+(i==="h264"?1:2)}return e.subarray(0,0)},MR=function(e,i,r){return p1(e,"h264",i,r)},LR=function(e,i,r){return p1(e,"h265",i,r)},Vi={webm:Ie([119,101,98,109]),matroska:Ie([109,97,116,114,111,115,107,97]),flac:Ie([102,76,97,67]),ogg:Ie([79,103,103,83]),ac3:Ie([11,119]),riff:Ie([82,73,70,70]),avi:Ie([65,86,73]),wav:Ie([87,65,86,69]),"3gp":Ie([102,116,121,112,51,103]),mp4:Ie([102,116,121,112]),fmp4:Ie([115,116,121,112]),mov:Ie([102,116,121,112,113,116]),moov:Ie([109,111,111,118]),moof:Ie([109,111,111,102])},Zl={aac:function(e){var i=md(e);return Mt(e,[255,16],{offset:i,mask:[255,22]})},mp3:function(e){var i=md(e);return Mt(e,[255,2],{offset:i,mask:[255,6]})},webm:function(e){var i=f1(e,[Xf.EBML,Xf.DocType])[0];return Mt(i,Vi.webm)},mkv:function(e){var i=f1(e,[Xf.EBML,Xf.DocType])[0];return Mt(i,Vi.matroska)},mp4:function(e){if(Zl["3gp"](e)||Zl.mov(e))return!1;if(Mt(e,Vi.mp4,{offset:4})||Mt(e,Vi.fmp4,{offset:4})||Mt(e,Vi.moof,{offset:4})||Mt(e,Vi.moov,{offset:4}))return!0},mov:function(e){return Mt(e,Vi.mov,{offset:4})},"3gp":function(e){return Mt(e,Vi["3gp"],{offset:4})},ac3:function(e){var i=md(e);return Mt(e,Vi.ac3,{offset:i})},ts:function(e){if(e.length<189&&e.length>=1)return e[0]===71;for(var i=0;i+1880},g0=9e4,y0,v0,Wf,b0,m1,g1,y1;y0=function(s){return s*g0},v0=function(s,e){return s*e},Wf=function(s){return s/g0},b0=function(s,e){return s/e},m1=function(s,e){return y0(b0(s,e))},g1=function(s,e){return v0(Wf(s),e)},y1=function(s,e,i){return Wf(i?s:s-e)};var Ao={ONE_SECOND_IN_TS:g0,secondsToVideoTs:y0,secondsToAudioTs:v0,videoTsToSeconds:Wf,audioTsToSeconds:b0,audioTsToVideoTs:m1,videoTsToAudioTs:g1,metadataTsToSeconds:y1};/**
* @license
* Video.js 8.23.3
* Copyright Brightcove, Inc.
@@ -454,7 +454,7 @@ This may prevent text tracks from loading.`),this.restoreMetadataTracksInIOSNati
}
`)}loadTech_(e,i){this.tech_&&this.unloadTech_();const r=Ht(e),o=e.charAt(0).toLowerCase()+e.slice(1);r!=="Html5"&&this.tag&&(Ve.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=r,this.isReady_=!1;let u=this.autoplay();(typeof this.autoplay()=="string"||this.autoplay()===!0&&this.options_.normalizeAutoplay)&&(u=!1);const c={source:i,autoplay:u,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:`${this.id()}_${o}_api`,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};Gi.names.forEach(g=>{const b=Gi[g];c[b.getterName]=this[b.privateName]}),Object.assign(c,this.options_[r]),Object.assign(c,this.options_[o]),Object.assign(c,this.options_[e.toLowerCase()]),this.tag&&(c.tag=this.tag),i&&i.src===this.cache_.src&&this.cache_.currentTime>0&&(c.startTime=this.cache_.currentTime);const p=Ve.getTech(e);if(!p)throw new Error(`No Tech named '${r}' exists! '${r}' should be registered using videojs.registerTech()'`);this.tech_=new p(c),this.tech_.ready(Dt(this,this.handleTechReady_),!0),U0.jsonToTextTracks(this.textTracksJson_||[],this.tech_),sS.forEach(g=>{this.on(this.tech_,g,b=>this[`handleTech${Ht(g)}_`](b))}),Object.keys(fy).forEach(g=>{this.on(this.tech_,g,b=>{if(this.tech_.playbackRate()===0&&this.tech_.seeking()){this.queuedCallbacks_.push({callback:this[`handleTech${fy[g]}_`].bind(this),event:b});return}this[`handleTech${fy[g]}_`](b)})}),this.on(this.tech_,"loadstart",g=>this.handleTechLoadStart_(g)),this.on(this.tech_,"sourceset",g=>this.handleTechSourceset_(g)),this.on(this.tech_,"waiting",g=>this.handleTechWaiting_(g)),this.on(this.tech_,"ended",g=>this.handleTechEnded_(g)),this.on(this.tech_,"seeking",g=>this.handleTechSeeking_(g)),this.on(this.tech_,"play",g=>this.handleTechPlay_(g)),this.on(this.tech_,"pause",g=>this.handleTechPause_(g)),this.on(this.tech_,"durationchange",g=>this.handleTechDurationChange_(g)),this.on(this.tech_,"fullscreenchange",(g,b)=>this.handleTechFullscreenChange_(g,b)),this.on(this.tech_,"fullscreenerror",(g,b)=>this.handleTechFullscreenError_(g,b)),this.on(this.tech_,"enterpictureinpicture",g=>this.handleTechEnterPictureInPicture_(g)),this.on(this.tech_,"leavepictureinpicture",g=>this.handleTechLeavePictureInPicture_(g)),this.on(this.tech_,"error",g=>this.handleTechError_(g)),this.on(this.tech_,"posterchange",g=>this.handleTechPosterChange_(g)),this.on(this.tech_,"textdata",g=>this.handleTechTextData_(g)),this.on(this.tech_,"ratechange",g=>this.handleTechRateChange_(g)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode!==this.el()&&(r!=="Html5"||!this.tag)&&E0(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){Gi.names.forEach(e=>{const i=Gi[e];this[i.privateName]=this[i.getterName]()}),this.textTracksJson_=U0.textTracksToJson(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return e===void 0&&Ke.warn(`Using the tech directly can be dangerous. I hope you know what you're doing.
See https://github.com/videojs/video.js/issues/2617 for more info.
-`),this.tech_}version(){return{"video.js":_0}}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):this.trigger("loadstart"),this.manualAutoplay_(this.autoplay()===!0&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(e){if(!this.tech_||typeof e!="string")return;const i=()=>{const o=this.muted();this.muted(!0);const u=()=>{this.muted(o)};this.playTerminatedQueue_.push(u);const c=this.play();if(xd(c))return c.catch(p=>{throw u(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${p||""}`)})};let r;if(e==="any"&&!this.muted()?(r=this.play(),xd(r)&&(r=r.catch(i))):e==="muted"&&!this.muted()?r=i():r=this.play(),!!xd(r))return r.then(()=>{this.trigger({type:"autoplay-success",autoplay:e})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:e})})}updateSourceCaches_(e=""){let i=e,r="";typeof i!="string"&&(i=e.src,r=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],i&&!r&&(r=v3(this,i)),this.cache_.source=vt({},e,{src:i,type:r});const o=this.cache_.sources.filter(g=>g.src&&g.src===i),u=[],c=this.$$("source"),p=[];for(let g=0;gthis.updateSourceCaches_(u);const r=this.currentSource().src,o=e.src;r&&!/^blob:/.test(r)&&/^blob:/.test(o)&&(!this.lastSource_||this.lastSource_.tech!==o&&this.lastSource_.player!==r)&&(i=()=>{}),i(o),e.src||this.tech_.any(["sourceset","loadstart"],u=>{if(u.type==="sourceset")return;const c=this.techGet_("currentSrc");this.lastSource_.tech=c,this.updateSourceCaches_(c)})}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})}hasStarted(e){if(e===void 0)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){this.tech_.playbackRate()>0&&this.cache_.lastPlaybackRate===0&&(this.queuedCallbacks_.forEach(e=>e.callback(e.event)),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const e=this.currentTime(),i=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",i))};this.on("timeupdate",i)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){this.controls_&&(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.click===void 0||this.options_.userActions.click!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.click=="function"?this.options_.userActions.click.call(this,e):this.paused()?Us(this.play()):this.pause())}handleTechDoubleClick_(e){if(!this.controls_)return;Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),r=>r.contains(e.target))||(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.doubleClick===void 0||this.options_.userActions.doubleClick!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.doubleClick=="function"?this.options_.userActions.doubleClick.call(this,e):this.isInPictureInPicture()&&!pe.pictureInPictureElement?this.exitPictureInPicture():this.isFullscreen()?this.exitFullscreen():this.requestFullscreen())}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(e){const i=e.target.player;if(i&&i!==this)return;const r=this.el();let o=pe[this.fsApi_.fullscreenElement]===r;!o&&r.matches&&(o=r.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(o)}handleTechFullscreenChange_(e,i){i&&(i.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")})),this.isFullscreen(i.isFullscreen))}handleTechFullscreenError_(e,i){this.trigger("fullscreenerror",i)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){const e=this.tech_.error();e&&this.error(e)}handleTechTextData_(){let e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)}getCache(){return this.cache_}resetCache_(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}}techCall_(e,i){this.ready(function(){if(e in f3)return d3(this.middleware_,this.tech_,e,i);if(e in h2)return d2(this.middleware_,this.tech_,e,i);try{this.tech_&&this.tech_[e](i)}catch(r){throw Ke(r),r}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in h3)return c3(this.middleware_,this.tech_,e);if(e in h2)return d2(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(i){throw this.tech_[e]===void 0?(Ke(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,i),i):i.name==="TypeError"?(Ke(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,i),this.tech_.isReady_=!1,i):(Ke(i),i)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=Us){this.playCallbacks_.push(e);const i=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),r=!!(op||Ii);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!i){this.waitToPlay_=c=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!i&&r&&this.load();return}const o=this.techGet_("play");r&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),o===null?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(o)}runPlayTerminatedQueue_(){const e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(i){i()})}runPlayCallbacks_(e){const i=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],i.forEach(function(r){r(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")!==!1}played(){return this.techGet_("played")||hs(0,0)}scrubbing(e){if(typeof e>"u")return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){if(e===void 0)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;if(e<0&&(e=0),!this.isReady_||this.changingSrc_||!this.tech_||!this.tech_.isReady_){this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_);return}this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e)&&(this.cache_.currentTime=Number(e))}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(e===void 0)return this.cache_.duration!==void 0?this.cache_.duration:NaN;e=parseFloat(e),e<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");return(!e||!e.length)&&(e=hs(0,0)),e}seekable(){let e=this.techGet_("seekable");return(!e||!e.length)&&(e=hs(0,0)),e}seeking(){return this.techGet_("seeking")}ended(){return this.techGet_("ended")}networkState(){return this.techGet_("networkState")}readyState(){return this.techGet_("readyState")}bufferedPercent(){return i2(this.buffered(),this.duration())}bufferedEnd(){const e=this.buffered(),i=this.duration();let r=e.end(e.length-1);return r>i&&(r=i),r}volume(e){let i;if(e!==void 0){i=Math.max(0,Math.min(1,e)),this.cache_.volume=i,this.techCall_("setVolume",i),i>0&&this.lastVolume_(i);return}return i=parseFloat(this.techGet_("volume")),isNaN(i)?1:i}muted(e){if(e!==void 0){this.techCall_("setMuted",e);return}return this.techGet_("muted")||!1}defaultMuted(e){return e!==void 0&&this.techCall_("setDefaultMuted",e),this.techGet_("defaultMuted")||!1}lastVolume_(e){if(e!==void 0&&e!==0){this.cache_.lastVolume=e;return}return this.cache_.lastVolume}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(e){if(e!==void 0){const i=this.isFullscreen_;this.isFullscreen_=!!e,this.isFullscreen_!==i&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),this.toggleFullscreenClass_();return}return this.isFullscreen_}requestFullscreen(e){this.isInPictureInPicture()&&this.exitPictureInPicture();const i=this;return new Promise((r,o)=>{function u(){i.off("fullscreenerror",p),i.off("fullscreenchange",c)}function c(){u(),r()}function p(b,S){u(),o(S)}i.one("fullscreenchange",c),i.one("fullscreenerror",p);const g=i.requestFullscreenHelper_(e);g&&(g.then(u,u),g.then(r,o))})}requestFullscreenHelper_(e){let i;if(this.fsApi_.prefixed||(i=this.options_.fullscreen&&this.options_.fullscreen.options||{},e!==void 0&&(i=e)),this.fsApi_.requestFullscreen){const r=this.el_[this.fsApi_.requestFullscreen](i);return r&&r.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),r}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise((i,r)=>{function o(){e.off("fullscreenerror",c),e.off("fullscreenchange",u)}function u(){o(),i()}function c(g,b){o(),r(b)}e.one("fullscreenchange",u),e.one("fullscreenerror",c);const p=e.exitFullscreenHelper_();p&&(p.then(o,o),p.then(i,r))})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=pe[this.fsApi_.exitFullscreen]();return e&&Us(e.then(()=>this.isFullscreen(!1))),e}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=pe.documentElement.style.overflow,Sn(pe,"keydown",this.boundFullWindowOnEscKey_),pe.documentElement.style.overflow="hidden",Do(pe.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){e.key==="Escape"&&this.isFullscreen()===!0&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,Ni(pe,"keydown",this.boundFullWindowOnEscKey_),pe.documentElement.style.overflow=this.docOrigOverflow,lp(pe.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(e===void 0)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(e!==void 0){this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_();return}return!!this.isInPictureInPicture_}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&P.documentPictureInPicture){const e=pe.createElement(this.el().tagName);return e.classList=this.el().classList,e.classList.add("vjs-pip-container"),this.posterImage&&e.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&e.appendChild(this.titleBar.el().cloneNode(!0)),e.appendChild(Ue("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),P.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(i=>(z1(i),this.el_.parentNode.insertBefore(e,this.el_),i.document.body.appendChild(this.el_),i.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger({type:"enterpictureinpicture",pipWindow:i}),i.addEventListener("pagehide",r=>{const o=r.target.querySelector(".video-js");e.parentNode.replaceChild(o,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),i))}return"pictureInPictureEnabled"in pe&&this.disablePictureInPicture()===!1?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(P.documentPictureInPicture&&P.documentPictureInPicture.window)return P.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in pe)return pe.exitPictureInPicture()}handleKeyDown(e){const{userActions:i}=this.options_;!i||!i.hotkeys||(o=>{const u=o.tagName.toLowerCase();if(o.isContentEditable)return!0;const c=["button","checkbox","hidden","radio","reset","submit"];return u==="input"?c.indexOf(o.type)===-1:["textarea"].indexOf(u)!==-1})(this.el_.ownerDocument.activeElement)||(typeof i.hotkeys=="function"?i.hotkeys.call(this,e):this.handleHotkeys(e))}handleHotkeys(e){const i=this.options_.userActions?this.options_.userActions.hotkeys:{},{fullscreenKey:r=c=>e.key.toLowerCase()==="f",muteKey:o=c=>e.key.toLowerCase()==="m",playPauseKey:u=c=>e.key.toLowerCase()==="k"||e.key.toLowerCase()===" "}=i;if(r.call(this,e)){e.preventDefault(),e.stopPropagation();const c=ce.getComponent("FullscreenToggle");pe[this.fsApi_.fullscreenEnabled]!==!1&&c.prototype.handleClick.call(this,e)}else o.call(this,e)?(e.preventDefault(),e.stopPropagation(),ce.getComponent("MuteToggle").prototype.handleClick.call(this,e)):u.call(this,e)&&(e.preventDefault(),e.stopPropagation(),ce.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let i;for(let r=0,o=this.options_.techOrder;r[p,Ve.getTech(p)]).filter(([p,g])=>g?g.isSupported():(Ke.error(`The "${p}" tech is undefined. Skipped browser support check for that tech.`),!1)),r=function(p,g,b){let S;return p.some(E=>g.some(A=>{if(S=b(E,A),S)return!0})),S};let o;const u=p=>(g,b)=>p(b,g),c=([p,g],b)=>{if(g.canPlaySource(b,this.options_[p.toLowerCase()]))return{source:b,tech:p}};return this.options_.sourceOrder?o=r(e,i,u(c)):o=r(i,e,c),o||!1}handleSrc_(e,i){if(typeof e>"u")return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const r=f2(e);if(!r.length){this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0);return}if(this.changingSrc_=!0,i||(this.cache_.sources=r),this.updateSourceCaches_(r[0]),l3(this,r[0],(o,u)=>{if(this.middleware_=u,i||(this.cache_.sources=r),this.updateSourceCaches_(o),this.src_(o)){if(r.length>1)return this.handleSrc_(r.slice(1));this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),this.triggerReady();return}u3(u,this.tech_)}),r.length>1){const o=()=>{this.error(null),this.handleSrc_(r.slice(1),!0)},u=()=>{this.off("error",o)};this.one("error",o),this.one("playing",u),this.resetRetryOnError_=()=>{this.off("error",o),this.off("playing",u)}}}src(e){return this.handleSrc_(e,!1)}src_(e){const i=this.selectSource([e]);return i?K1(i.tech,this.techName_)?(this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0),!1):(this.changingSrc_=!0,this.loadTech_(i.tech,i.source),this.tech_.ready(()=>{this.changingSrc_=!1}),!1):!0}addSourceElement(e,i){return this.tech_?this.tech_.addSourceElement(e,i):!1}removeSourceElement(e){return this.tech_?this.tech_.removeSourceElement(e):!1}load(){if(this.tech_&&this.tech_.vhs){this.src(this.currentSource());return}this.techCall_("load")}reset(){if(this.paused())this.doReset_();else{const e=this.play();Us(e.then(()=>this.doReset_()))}}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),this.error(null),this.titleBar&&this.titleBar.update({title:void 0,description:void 0}),Or(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{currentTimeDisplay:e,durationDisplay:i,progressControl:r,remainingTimeDisplay:o}=this.controlBar||{},{seekBar:u}=r||{};e&&e.updateContent(),i&&i.updateContent(),o&&o.updateContent(),u&&(u.update(),u.loadProgressBar&&u.loadProgressBar.update())}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){const e=this.currentSource(),i=[];return Object.keys(e).length!==0&&i.push(e),this.cache_.sources||i}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(e!==void 0){this.techCall_("setPreload",e),this.options_.preload=e;return}return this.techGet_("preload")}autoplay(e){if(e===void 0)return this.options_.autoplay||!1;let i;typeof e=="string"&&/(any|play|muted)/.test(e)||e===!0&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_(typeof e=="string"?e:"play"),i=!1):e?this.options_.autoplay=!0:this.options_.autoplay=!1,i=typeof i>"u"?this.options_.autoplay:i,this.tech_&&this.techCall_("setAutoplay",i)}playsinline(e){return e!==void 0&&(this.techCall_("setPlaysinline",e),this.options_.playsinline=e),this.techGet_("playsinline")}loop(e){if(e!==void 0){this.techCall_("setLoop",e),this.options_.loop=e;return}return this.techGet_("loop")}poster(e){if(e===void 0)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}handleTechPosterChange_(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){const e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}}controls(e){if(e===void 0)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))}usingNativeControls(e){if(e===void 0)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(e){if(e===void 0)return this.error_||null;if(xa("beforeerror").forEach(i=>{const r=i(this,e);if(!(Is(r)&&!Array.isArray(r)||typeof r=="string"||typeof r=="number"||r===null)){this.log.error("please return a value that MediaError expects in beforeerror hooks");return}e=r}),this.options_.suppressNotSupportedError&&e&&e.code===4){const i=function(){this.error(e)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],i),this.one("loadstart",function(){this.off(["click","touchstart"],i)});return}if(e===null){this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close();return}this.error_=new Nt(e),this.addClass("vjs-error"),Ke.error(`(CODE:${this.error_.code} ${Nt.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),xa("error").forEach(i=>i(this,this.error_))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(e===void 0)return this.userActive_;if(e=!!e,e!==this.userActive_){if(this.userActive_=e,this.userActive_){this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive");return}this.tech_&&this.tech_.one("mousemove",function(i){i.stopPropagation(),i.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}}listenForUserActivity_(){let e,i,r;const o=Dt(this,this.reportUserActivity),u=function(E){(E.screenX!==i||E.screenY!==r)&&(i=E.screenX,r=E.screenY,o())},c=function(){o(),this.clearInterval(e),e=this.setInterval(o,250)},p=function(E){o(),this.clearInterval(e)};this.on("mousedown",c),this.on("mousemove",u),this.on("mouseup",p),this.on("mouseleave",p);const g=this.getChild("controlBar");g&&!Ii&&!ds&&(g.on("mouseenter",function(E){this.player().options_.inactivityTimeout!==0&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),g.on("mouseleave",function(E){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",o),this.on("keyup",o);let b;const S=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(b);const E=this.options_.inactivityTimeout;E<=0||(b=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},E))};this.setInterval(S,250)}playbackRate(e){if(e!==void 0){this.techCall_("setPlaybackRate",e);return}return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1}defaultPlaybackRate(e){return e!==void 0?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(e!==void 0){this.isAudio_=!!e;return}return!!this.isAudio_}updatePlayerHeightOnAudioOnlyMode_(){const e=this.getChild("ControlBar");!e||this.audioOnlyCache_.controlBarHeight===e.currentHeight()||(this.audioOnlyCache_.controlBarHeight=e.currentHeight(),this.height(this.audioOnlyCache_.controlBarHeight))}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");const e=this.children(),i=this.getChild("ControlBar"),r=i&&i.currentHeight();e.forEach(o=>{o!==i&&o.el_&&!o.hasClass("vjs-hidden")&&(o.hide(),this.audioOnlyCache_.hiddenChildren.push(o))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.audioOnlyCache_.controlBarHeight=r,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(r),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.off("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){if(typeof e!="boolean"||e===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=e,e){const i=[];return this.isInPictureInPicture()&&i.push(this.exitPictureInPicture()),this.isFullscreen()&&i.push(this.exitFullscreen()),this.audioPosterMode()&&i.push(this.audioPosterMode(!1)),Promise.all(i).then(()=>this.enableAudioOnlyUI_())}return Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return typeof e!="boolean"||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e,e?this.audioOnlyMode()?this.audioOnlyMode(!1).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()}))}addTextTrack(e,i,r){if(this.tech_)return this.tech_.addTextTrack(e,i,r)}addRemoteTextTrack(e,i){if(this.tech_)return this.tech_.addRemoteTextTrack(e,i)}removeRemoteTextTrack(e={}){let{track:i}=e;if(i||(i=e),this.tech_)return this.tech_.removeRemoteTextTrack(i)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(e===void 0)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),Or(this)&&this.trigger("languagechange"))}languages(){return vt(ft.prototype.options_.languages,this.languages_)}toJSON(){const e=vt(this.options_),i=e.tracks;e.tracks=[];for(let r=0;r{this.removeChild(r)}),r.open(),r}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),i=this.currentWidth();for(let r=0;rthis.addRemoteTextTrack(E,!1)),this.titleBar&&this.titleBar.update({title:S,description:c||o||""}),this.ready(i)}getMedia(){if(!this.cache_.media){const e=this.poster(),i=this.currentSources(),r=Array.prototype.map.call(this.remoteTextTracks(),u=>({kind:u.kind,label:u.label,language:u.language,src:u.src})),o={src:i,textTracks:r};return e&&(o.poster=e,o.artwork=[{src:o.poster,type:Tp(o.poster)}]),o}return vt(this.cache_.media)}static getTagSettings(e){const i={sources:[],tracks:[]},r=Aa(e),o=r["data-setup"];if(vd(e,"vjs-fill")&&(r.fill=!0),vd(e,"vjs-fluid")&&(r.fluid=!0),o!==null)try{Object.assign(r,JSON.parse(o||"{}"))}catch(u){Ke.error("data-setup",u)}if(Object.assign(i,r),e.hasChildNodes()){const u=e.childNodes;for(let c=0,p=u.length;ctypeof i=="number")&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}ft.prototype.videoTracks=()=>{},ft.prototype.audioTracks=()=>{},ft.prototype.textTracks=()=>{},ft.prototype.remoteTextTracks=()=>{},ft.prototype.remoteTextTrackEls=()=>{},Gi.names.forEach(function(s){const e=Gi[s];ft.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}}),ft.prototype.crossorigin=ft.prototype.crossOrigin,ft.players={};const wd=P.navigator;ft.prototype.options_={techOrder:Ve.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:wd&&(wd.languages&&wd.languages[0]||wd.userLanguage||wd.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1,spatialNavigation:{enabled:!1,horizontalSeek:!1},enableSmoothSeeking:!1,disableSeekWhileScrubbingOnMobile:!1,disableSeekWhileScrubbingOnSTV:!1},sS.forEach(function(s){ft.prototype[`handleTech${Ht(s)}_`]=function(){return this.trigger(s)}}),ce.registerComponent("Player",ft);const Ap="plugin",pu="activePlugins_",mu={},Dp=s=>mu.hasOwnProperty(s),wp=s=>Dp(s)?mu[s]:void 0,rS=(s,e)=>{s[pu]=s[pu]||{},s[pu][e]=!0},kp=(s,e,i)=>{const r=(i?"before":"")+"pluginsetup";s.trigger(r,e),s.trigger(r+":"+e.name,e)},K3=function(s,e){const i=function(){kp(this,{name:s,plugin:e,instance:null},!0);const r=e.apply(this,arguments);return rS(this,s),kp(this,{name:s,plugin:e,instance:r}),r};return Object.keys(e).forEach(function(r){i[r]=e[r]}),i},aS=(s,e)=>(e.prototype.name=s,function(...i){kp(this,{name:s,plugin:e,instance:null},!0);const r=new e(this,...i);return this[s]=()=>r,kp(this,r.getEventHash()),r});class on{constructor(e){if(this.constructor===on)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),L0(this),delete this.trigger,Q1(this,this.constructor.defaultState),rS(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,i={}){return lu(this.eventBusEl_,e,this.getEventHash(i))}handleStateChanged(e){}dispose(){const{name:e,player:i}=this;this.trigger("dispose"),this.off(),i.off("dispose",this.dispose),i[pu][e]=!1,this.player=this.state=null,i[e]=aS(e,mu[e])}static isBasic(e){const i=typeof e=="string"?wp(e):e;return typeof i=="function"&&!on.prototype.isPrototypeOf(i.prototype)}static registerPlugin(e,i){if(typeof e!="string")throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(Dp(e))Ke.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(ft.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if(typeof i!="function")throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof i}.`);return mu[e]=i,e!==Ap&&(on.isBasic(i)?ft.prototype[e]=K3(e,i):ft.prototype[e]=aS(e,i)),i}static deregisterPlugin(e){if(e===Ap)throw new Error("Cannot de-register base plugin.");Dp(e)&&(delete mu[e],delete ft.prototype[e])}static getPlugins(e=Object.keys(mu)){let i;return e.forEach(r=>{const o=wp(r);o&&(i=i||{},i[r]=o)}),i}static getPluginVersion(e){const i=wp(e);return i&&i.VERSION||""}}on.getPlugin=wp,on.BASE_PLUGIN_NAME=Ap,on.registerPlugin(Ap,on),ft.prototype.usingPlugin=function(s){return!!this[pu]&&this[pu][s]===!0},ft.prototype.hasPlugin=function(s){return!!Dp(s)};function Z3(s,e){let i=!1;return function(...r){return i||Ke.warn(s),i=!0,e.apply(this,r)}}function fs(s,e,i,r){return Z3(`${e} is deprecated and will be removed in ${s}.0; please use ${i} instead.`,r)}var J3={NetworkBadStatus:"networkbadstatus",NetworkRequestFailed:"networkrequestfailed",NetworkRequestAborted:"networkrequestaborted",NetworkRequestTimeout:"networkrequesttimeout",NetworkBodyParserFailed:"networkbodyparserfailed",StreamingHlsPlaylistParserError:"streaminghlsplaylistparsererror",StreamingDashManifestParserError:"streamingdashmanifestparsererror",StreamingContentSteeringParserError:"streamingcontentsteeringparsererror",StreamingVttParserError:"streamingvttparsererror",StreamingFailedToSelectNextSegment:"streamingfailedtoselectnextsegment",StreamingFailedToDecryptSegment:"streamingfailedtodecryptsegment",StreamingFailedToTransmuxSegment:"streamingfailedtotransmuxsegment",StreamingFailedToAppendSegment:"streamingfailedtoappendsegment",StreamingCodecsChangeError:"streamingcodecschangeerror"};const oS=s=>s.indexOf("#")===0?s.slice(1):s;function $(s,e,i){let r=$.getPlayer(s);if(r)return e&&Ke.warn(`Player "${s}" is already initialised. Options will not be applied.`),i&&r.ready(i),r;const o=typeof s=="string"?Da("#"+oS(s)):s;if(!su(o))throw new TypeError("The element or ID supplied is not valid. (videojs)");const c=("getRootNode"in o?o.getRootNode()instanceof P.ShadowRoot:!1)?o.getRootNode():o.ownerDocument.body;(!o.ownerDocument.defaultView||!c.contains(o))&&Ke.warn("The element supplied is not included in the DOM"),e=e||{},e.restoreEl===!0&&(e.restoreEl=(o.parentNode&&o.parentNode.hasAttribute&&o.parentNode.hasAttribute("data-vjs-player")?o.parentNode:o).cloneNode(!0)),xa("beforesetup").forEach(g=>{const b=g(o,vt(e));if(!Is(b)||Array.isArray(b)){Ke.error("please return an object in beforesetup hooks");return}e=vt(e,b)});const p=ce.getComponent("Player");return r=new p(o,e,i),xa("setup").forEach(g=>g(r)),r}if($.hooks_=kr,$.hooks=xa,$.hook=PR,$.hookOnce=UR,$.removeHook=v1,P.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&nu()){let s=Da(".vjs-styles-defaults");if(!s){s=V1("vjs-styles-defaults");const e=Da("head");e&&e.insertBefore(s,e.firstChild),$1(s,`
+`),this.tech_}version(){return{"video.js":_0}}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):this.trigger("loadstart"),this.manualAutoplay_(this.autoplay()===!0&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(e){if(!this.tech_||typeof e!="string")return;const i=()=>{const o=this.muted();this.muted(!0);const u=()=>{this.muted(o)};this.playTerminatedQueue_.push(u);const c=this.play();if(xd(c))return c.catch(p=>{throw u(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${p||""}`)})};let r;if(e==="any"&&!this.muted()?(r=this.play(),xd(r)&&(r=r.catch(i))):e==="muted"&&!this.muted()?r=i():r=this.play(),!!xd(r))return r.then(()=>{this.trigger({type:"autoplay-success",autoplay:e})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:e})})}updateSourceCaches_(e=""){let i=e,r="";typeof i!="string"&&(i=e.src,r=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],i&&!r&&(r=v3(this,i)),this.cache_.source=vt({},e,{src:i,type:r});const o=this.cache_.sources.filter(g=>g.src&&g.src===i),u=[],c=this.$$("source"),p=[];for(let g=0;gthis.updateSourceCaches_(u);const r=this.currentSource().src,o=e.src;r&&!/^blob:/.test(r)&&/^blob:/.test(o)&&(!this.lastSource_||this.lastSource_.tech!==o&&this.lastSource_.player!==r)&&(i=()=>{}),i(o),e.src||this.tech_.any(["sourceset","loadstart"],u=>{if(u.type==="sourceset")return;const c=this.techGet_("currentSrc");this.lastSource_.tech=c,this.updateSourceCaches_(c)})}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})}hasStarted(e){if(e===void 0)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){this.tech_.playbackRate()>0&&this.cache_.lastPlaybackRate===0&&(this.queuedCallbacks_.forEach(e=>e.callback(e.event)),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const e=this.currentTime(),i=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",i))};this.on("timeupdate",i)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){this.controls_&&(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.click===void 0||this.options_.userActions.click!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.click=="function"?this.options_.userActions.click.call(this,e):this.paused()?Us(this.play()):this.pause())}handleTechDoubleClick_(e){if(!this.controls_)return;Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),r=>r.contains(e.target))||(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.doubleClick===void 0||this.options_.userActions.doubleClick!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.doubleClick=="function"?this.options_.userActions.doubleClick.call(this,e):this.isInPictureInPicture()&&!pe.pictureInPictureElement?this.exitPictureInPicture():this.isFullscreen()?this.exitFullscreen():this.requestFullscreen())}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(e){const i=e.target.player;if(i&&i!==this)return;const r=this.el();let o=pe[this.fsApi_.fullscreenElement]===r;!o&&r.matches&&(o=r.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(o)}handleTechFullscreenChange_(e,i){i&&(i.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")})),this.isFullscreen(i.isFullscreen))}handleTechFullscreenError_(e,i){this.trigger("fullscreenerror",i)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){const e=this.tech_.error();e&&this.error(e)}handleTechTextData_(){let e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)}getCache(){return this.cache_}resetCache_(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}}techCall_(e,i){this.ready(function(){if(e in f3)return d3(this.middleware_,this.tech_,e,i);if(e in h2)return d2(this.middleware_,this.tech_,e,i);try{this.tech_&&this.tech_[e](i)}catch(r){throw Ke(r),r}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in h3)return c3(this.middleware_,this.tech_,e);if(e in h2)return d2(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(i){throw this.tech_[e]===void 0?(Ke(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,i),i):i.name==="TypeError"?(Ke(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,i),this.tech_.isReady_=!1,i):(Ke(i),i)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=Us){this.playCallbacks_.push(e);const i=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),r=!!(op||Ii);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!i){this.waitToPlay_=c=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!i&&r&&this.load();return}const o=this.techGet_("play");r&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),o===null?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(o)}runPlayTerminatedQueue_(){const e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(i){i()})}runPlayCallbacks_(e){const i=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],i.forEach(function(r){r(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")!==!1}played(){return this.techGet_("played")||hs(0,0)}scrubbing(e){if(typeof e>"u")return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){if(e===void 0)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;if(e<0&&(e=0),!this.isReady_||this.changingSrc_||!this.tech_||!this.tech_.isReady_){this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_);return}this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e)&&(this.cache_.currentTime=Number(e))}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(e===void 0)return this.cache_.duration!==void 0?this.cache_.duration:NaN;e=parseFloat(e),e<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");return(!e||!e.length)&&(e=hs(0,0)),e}seekable(){let e=this.techGet_("seekable");return(!e||!e.length)&&(e=hs(0,0)),e}seeking(){return this.techGet_("seeking")}ended(){return this.techGet_("ended")}networkState(){return this.techGet_("networkState")}readyState(){return this.techGet_("readyState")}bufferedPercent(){return i2(this.buffered(),this.duration())}bufferedEnd(){const e=this.buffered(),i=this.duration();let r=e.end(e.length-1);return r>i&&(r=i),r}volume(e){let i;if(e!==void 0){i=Math.max(0,Math.min(1,e)),this.cache_.volume=i,this.techCall_("setVolume",i),i>0&&this.lastVolume_(i);return}return i=parseFloat(this.techGet_("volume")),isNaN(i)?1:i}muted(e){if(e!==void 0){this.techCall_("setMuted",e);return}return this.techGet_("muted")||!1}defaultMuted(e){return e!==void 0&&this.techCall_("setDefaultMuted",e),this.techGet_("defaultMuted")||!1}lastVolume_(e){if(e!==void 0&&e!==0){this.cache_.lastVolume=e;return}return this.cache_.lastVolume}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(e){if(e!==void 0){const i=this.isFullscreen_;this.isFullscreen_=!!e,this.isFullscreen_!==i&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),this.toggleFullscreenClass_();return}return this.isFullscreen_}requestFullscreen(e){this.isInPictureInPicture()&&this.exitPictureInPicture();const i=this;return new Promise((r,o)=>{function u(){i.off("fullscreenerror",p),i.off("fullscreenchange",c)}function c(){u(),r()}function p(b,S){u(),o(S)}i.one("fullscreenchange",c),i.one("fullscreenerror",p);const g=i.requestFullscreenHelper_(e);g&&(g.then(u,u),g.then(r,o))})}requestFullscreenHelper_(e){let i;if(this.fsApi_.prefixed||(i=this.options_.fullscreen&&this.options_.fullscreen.options||{},e!==void 0&&(i=e)),this.fsApi_.requestFullscreen){const r=this.el_[this.fsApi_.requestFullscreen](i);return r&&r.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),r}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise((i,r)=>{function o(){e.off("fullscreenerror",c),e.off("fullscreenchange",u)}function u(){o(),i()}function c(g,b){o(),r(b)}e.one("fullscreenchange",u),e.one("fullscreenerror",c);const p=e.exitFullscreenHelper_();p&&(p.then(o,o),p.then(i,r))})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=pe[this.fsApi_.exitFullscreen]();return e&&Us(e.then(()=>this.isFullscreen(!1))),e}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=pe.documentElement.style.overflow,Sn(pe,"keydown",this.boundFullWindowOnEscKey_),pe.documentElement.style.overflow="hidden",Do(pe.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){e.key==="Escape"&&this.isFullscreen()===!0&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,Ni(pe,"keydown",this.boundFullWindowOnEscKey_),pe.documentElement.style.overflow=this.docOrigOverflow,lp(pe.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(e===void 0)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(e!==void 0){this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_();return}return!!this.isInPictureInPicture_}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&P.documentPictureInPicture){const e=pe.createElement(this.el().tagName);return e.classList=this.el().classList,e.classList.add("vjs-pip-container"),this.posterImage&&e.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&e.appendChild(this.titleBar.el().cloneNode(!0)),e.appendChild(Ue("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),P.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(i=>(z1(i),this.el_.parentNode.insertBefore(e,this.el_),i.document.body.appendChild(this.el_),i.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger({type:"enterpictureinpicture",pipWindow:i}),i.addEventListener("pagehide",r=>{const o=r.target.querySelector(".video-js");e.parentNode.replaceChild(o,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),i))}return"pictureInPictureEnabled"in pe&&this.disablePictureInPicture()===!1?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(P.documentPictureInPicture&&P.documentPictureInPicture.window)return P.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in pe)return pe.exitPictureInPicture()}handleKeyDown(e){const{userActions:i}=this.options_;!i||!i.hotkeys||(o=>{const u=o.tagName.toLowerCase();if(o.isContentEditable)return!0;const c=["button","checkbox","hidden","radio","reset","submit"];return u==="input"?c.indexOf(o.type)===-1:["textarea"].indexOf(u)!==-1})(this.el_.ownerDocument.activeElement)||(typeof i.hotkeys=="function"?i.hotkeys.call(this,e):this.handleHotkeys(e))}handleHotkeys(e){const i=this.options_.userActions?this.options_.userActions.hotkeys:{},{fullscreenKey:r=c=>e.key.toLowerCase()==="f",muteKey:o=c=>e.key.toLowerCase()==="m",playPauseKey:u=c=>e.key.toLowerCase()==="k"||e.key.toLowerCase()===" "}=i;if(r.call(this,e)){e.preventDefault(),e.stopPropagation();const c=ce.getComponent("FullscreenToggle");pe[this.fsApi_.fullscreenEnabled]!==!1&&c.prototype.handleClick.call(this,e)}else o.call(this,e)?(e.preventDefault(),e.stopPropagation(),ce.getComponent("MuteToggle").prototype.handleClick.call(this,e)):u.call(this,e)&&(e.preventDefault(),e.stopPropagation(),ce.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let i;for(let r=0,o=this.options_.techOrder;r[p,Ve.getTech(p)]).filter(([p,g])=>g?g.isSupported():(Ke.error(`The "${p}" tech is undefined. Skipped browser support check for that tech.`),!1)),r=function(p,g,b){let S;return p.some(E=>g.some(A=>{if(S=b(E,A),S)return!0})),S};let o;const u=p=>(g,b)=>p(b,g),c=([p,g],b)=>{if(g.canPlaySource(b,this.options_[p.toLowerCase()]))return{source:b,tech:p}};return this.options_.sourceOrder?o=r(e,i,u(c)):o=r(i,e,c),o||!1}handleSrc_(e,i){if(typeof e>"u")return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const r=f2(e);if(!r.length){this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0);return}if(this.changingSrc_=!0,i||(this.cache_.sources=r),this.updateSourceCaches_(r[0]),l3(this,r[0],(o,u)=>{if(this.middleware_=u,i||(this.cache_.sources=r),this.updateSourceCaches_(o),this.src_(o)){if(r.length>1)return this.handleSrc_(r.slice(1));this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),this.triggerReady();return}u3(u,this.tech_)}),r.length>1){const o=()=>{this.error(null),this.handleSrc_(r.slice(1),!0)},u=()=>{this.off("error",o)};this.one("error",o),this.one("playing",u),this.resetRetryOnError_=()=>{this.off("error",o),this.off("playing",u)}}}src(e){return this.handleSrc_(e,!1)}src_(e){const i=this.selectSource([e]);return i?K1(i.tech,this.techName_)?(this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0),!1):(this.changingSrc_=!0,this.loadTech_(i.tech,i.source),this.tech_.ready(()=>{this.changingSrc_=!1}),!1):!0}addSourceElement(e,i){return this.tech_?this.tech_.addSourceElement(e,i):!1}removeSourceElement(e){return this.tech_?this.tech_.removeSourceElement(e):!1}load(){if(this.tech_&&this.tech_.vhs){this.src(this.currentSource());return}this.techCall_("load")}reset(){if(this.paused())this.doReset_();else{const e=this.play();Us(e.then(()=>this.doReset_()))}}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),this.error(null),this.titleBar&&this.titleBar.update({title:void 0,description:void 0}),Or(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{currentTimeDisplay:e,durationDisplay:i,progressControl:r,remainingTimeDisplay:o}=this.controlBar||{},{seekBar:u}=r||{};e&&e.updateContent(),i&&i.updateContent(),o&&o.updateContent(),u&&(u.update(),u.loadProgressBar&&u.loadProgressBar.update())}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){const e=this.currentSource(),i=[];return Object.keys(e).length!==0&&i.push(e),this.cache_.sources||i}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(e!==void 0){this.techCall_("setPreload",e),this.options_.preload=e;return}return this.techGet_("preload")}autoplay(e){if(e===void 0)return this.options_.autoplay||!1;let i;typeof e=="string"&&/(any|play|muted)/.test(e)||e===!0&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_(typeof e=="string"?e:"play"),i=!1):e?this.options_.autoplay=!0:this.options_.autoplay=!1,i=typeof i>"u"?this.options_.autoplay:i,this.tech_&&this.techCall_("setAutoplay",i)}playsinline(e){return e!==void 0&&(this.techCall_("setPlaysinline",e),this.options_.playsinline=e),this.techGet_("playsinline")}loop(e){if(e!==void 0){this.techCall_("setLoop",e),this.options_.loop=e;return}return this.techGet_("loop")}poster(e){if(e===void 0)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}handleTechPosterChange_(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){const e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}}controls(e){if(e===void 0)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))}usingNativeControls(e){if(e===void 0)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(e){if(e===void 0)return this.error_||null;if(xa("beforeerror").forEach(i=>{const r=i(this,e);if(!(Is(r)&&!Array.isArray(r)||typeof r=="string"||typeof r=="number"||r===null)){this.log.error("please return a value that MediaError expects in beforeerror hooks");return}e=r}),this.options_.suppressNotSupportedError&&e&&e.code===4){const i=function(){this.error(e)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],i),this.one("loadstart",function(){this.off(["click","touchstart"],i)});return}if(e===null){this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close();return}this.error_=new Nt(e),this.addClass("vjs-error"),Ke.error(`(CODE:${this.error_.code} ${Nt.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),xa("error").forEach(i=>i(this,this.error_))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(e===void 0)return this.userActive_;if(e=!!e,e!==this.userActive_){if(this.userActive_=e,this.userActive_){this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive");return}this.tech_&&this.tech_.one("mousemove",function(i){i.stopPropagation(),i.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}}listenForUserActivity_(){let e,i,r;const o=Dt(this,this.reportUserActivity),u=function(E){(E.screenX!==i||E.screenY!==r)&&(i=E.screenX,r=E.screenY,o())},c=function(){o(),this.clearInterval(e),e=this.setInterval(o,250)},p=function(E){o(),this.clearInterval(e)};this.on("mousedown",c),this.on("mousemove",u),this.on("mouseup",p),this.on("mouseleave",p);const g=this.getChild("controlBar");g&&!Ii&&!ds&&(g.on("mouseenter",function(E){this.player().options_.inactivityTimeout!==0&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),g.on("mouseleave",function(E){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",o),this.on("keyup",o);let b;const S=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(b);const E=this.options_.inactivityTimeout;E<=0||(b=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},E))};this.setInterval(S,250)}playbackRate(e){if(e!==void 0){this.techCall_("setPlaybackRate",e);return}return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1}defaultPlaybackRate(e){return e!==void 0?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(e!==void 0){this.isAudio_=!!e;return}return!!this.isAudio_}updatePlayerHeightOnAudioOnlyMode_(){const e=this.getChild("ControlBar");!e||this.audioOnlyCache_.controlBarHeight===e.currentHeight()||(this.audioOnlyCache_.controlBarHeight=e.currentHeight(),this.height(this.audioOnlyCache_.controlBarHeight))}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");const e=this.children(),i=this.getChild("ControlBar"),r=i&&i.currentHeight();e.forEach(o=>{o!==i&&o.el_&&!o.hasClass("vjs-hidden")&&(o.hide(),this.audioOnlyCache_.hiddenChildren.push(o))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.audioOnlyCache_.controlBarHeight=r,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(r),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.off("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){if(typeof e!="boolean"||e===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=e,e){const i=[];return this.isInPictureInPicture()&&i.push(this.exitPictureInPicture()),this.isFullscreen()&&i.push(this.exitFullscreen()),this.audioPosterMode()&&i.push(this.audioPosterMode(!1)),Promise.all(i).then(()=>this.enableAudioOnlyUI_())}return Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return typeof e!="boolean"||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e,e?this.audioOnlyMode()?this.audioOnlyMode(!1).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()}))}addTextTrack(e,i,r){if(this.tech_)return this.tech_.addTextTrack(e,i,r)}addRemoteTextTrack(e,i){if(this.tech_)return this.tech_.addRemoteTextTrack(e,i)}removeRemoteTextTrack(e={}){let{track:i}=e;if(i||(i=e),this.tech_)return this.tech_.removeRemoteTextTrack(i)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(e===void 0)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),Or(this)&&this.trigger("languagechange"))}languages(){return vt(ft.prototype.options_.languages,this.languages_)}toJSON(){const e=vt(this.options_),i=e.tracks;e.tracks=[];for(let r=0;r{this.removeChild(r)}),r.open(),r}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),i=this.currentWidth();for(let r=0;rthis.addRemoteTextTrack(E,!1)),this.titleBar&&this.titleBar.update({title:S,description:c||o||""}),this.ready(i)}getMedia(){if(!this.cache_.media){const e=this.poster(),i=this.currentSources(),r=Array.prototype.map.call(this.remoteTextTracks(),u=>({kind:u.kind,label:u.label,language:u.language,src:u.src})),o={src:i,textTracks:r};return e&&(o.poster=e,o.artwork=[{src:o.poster,type:Tp(o.poster)}]),o}return vt(this.cache_.media)}static getTagSettings(e){const i={sources:[],tracks:[]},r=Aa(e),o=r["data-setup"];if(vd(e,"vjs-fill")&&(r.fill=!0),vd(e,"vjs-fluid")&&(r.fluid=!0),o!==null)try{Object.assign(r,JSON.parse(o||"{}"))}catch(u){Ke.error("data-setup",u)}if(Object.assign(i,r),e.hasChildNodes()){const u=e.childNodes;for(let c=0,p=u.length;ctypeof i=="number")&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}ft.prototype.videoTracks=()=>{},ft.prototype.audioTracks=()=>{},ft.prototype.textTracks=()=>{},ft.prototype.remoteTextTracks=()=>{},ft.prototype.remoteTextTrackEls=()=>{},Gi.names.forEach(function(s){const e=Gi[s];ft.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}}),ft.prototype.crossorigin=ft.prototype.crossOrigin,ft.players={};const wd=P.navigator;ft.prototype.options_={techOrder:Ve.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:wd&&(wd.languages&&wd.languages[0]||wd.userLanguage||wd.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1,spatialNavigation:{enabled:!1,horizontalSeek:!1},enableSmoothSeeking:!1,disableSeekWhileScrubbingOnMobile:!1,disableSeekWhileScrubbingOnSTV:!1},sS.forEach(function(s){ft.prototype[`handleTech${Ht(s)}_`]=function(){return this.trigger(s)}}),ce.registerComponent("Player",ft);const Ap="plugin",pu="activePlugins_",mu={},Dp=s=>mu.hasOwnProperty(s),wp=s=>Dp(s)?mu[s]:void 0,rS=(s,e)=>{s[pu]=s[pu]||{},s[pu][e]=!0},kp=(s,e,i)=>{const r=(i?"before":"")+"pluginsetup";s.trigger(r,e),s.trigger(r+":"+e.name,e)},K3=function(s,e){const i=function(){kp(this,{name:s,plugin:e,instance:null},!0);const r=e.apply(this,arguments);return rS(this,s),kp(this,{name:s,plugin:e,instance:r}),r};return Object.keys(e).forEach(function(r){i[r]=e[r]}),i},aS=(s,e)=>(e.prototype.name=s,function(...i){kp(this,{name:s,plugin:e,instance:null},!0);const r=new e(this,...i);return this[s]=()=>r,kp(this,r.getEventHash()),r});class on{constructor(e){if(this.constructor===on)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),L0(this),delete this.trigger,Q1(this,this.constructor.defaultState),rS(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,i={}){return lu(this.eventBusEl_,e,this.getEventHash(i))}handleStateChanged(e){}dispose(){const{name:e,player:i}=this;this.trigger("dispose"),this.off(),i.off("dispose",this.dispose),i[pu][e]=!1,this.player=this.state=null,i[e]=aS(e,mu[e])}static isBasic(e){const i=typeof e=="string"?wp(e):e;return typeof i=="function"&&!on.prototype.isPrototypeOf(i.prototype)}static registerPlugin(e,i){if(typeof e!="string")throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(Dp(e))Ke.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(ft.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if(typeof i!="function")throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof i}.`);return mu[e]=i,e!==Ap&&(on.isBasic(i)?ft.prototype[e]=K3(e,i):ft.prototype[e]=aS(e,i)),i}static deregisterPlugin(e){if(e===Ap)throw new Error("Cannot de-register base plugin.");Dp(e)&&(delete mu[e],delete ft.prototype[e])}static getPlugins(e=Object.keys(mu)){let i;return e.forEach(r=>{const o=wp(r);o&&(i=i||{},i[r]=o)}),i}static getPluginVersion(e){const i=wp(e);return i&&i.VERSION||""}}on.getPlugin=wp,on.BASE_PLUGIN_NAME=Ap,on.registerPlugin(Ap,on),ft.prototype.usingPlugin=function(s){return!!this[pu]&&this[pu][s]===!0},ft.prototype.hasPlugin=function(s){return!!Dp(s)};function Z3(s,e){let i=!1;return function(...r){return i||Ke.warn(s),i=!0,e.apply(this,r)}}function fs(s,e,i,r){return Z3(`${e} is deprecated and will be removed in ${s}.0; please use ${i} instead.`,r)}var J3={NetworkBadStatus:"networkbadstatus",NetworkRequestFailed:"networkrequestfailed",NetworkRequestAborted:"networkrequestaborted",NetworkRequestTimeout:"networkrequesttimeout",NetworkBodyParserFailed:"networkbodyparserfailed",StreamingHlsPlaylistParserError:"streaminghlsplaylistparsererror",StreamingDashManifestParserError:"streamingdashmanifestparsererror",StreamingContentSteeringParserError:"streamingcontentsteeringparsererror",StreamingVttParserError:"streamingvttparsererror",StreamingFailedToSelectNextSegment:"streamingfailedtoselectnextsegment",StreamingFailedToDecryptSegment:"streamingfailedtodecryptsegment",StreamingFailedToTransmuxSegment:"streamingfailedtotransmuxsegment",StreamingFailedToAppendSegment:"streamingfailedtoappendsegment",StreamingCodecsChangeError:"streamingcodecschangeerror"};const oS=s=>s.indexOf("#")===0?s.slice(1):s;function V(s,e,i){let r=V.getPlayer(s);if(r)return e&&Ke.warn(`Player "${s}" is already initialised. Options will not be applied.`),i&&r.ready(i),r;const o=typeof s=="string"?Da("#"+oS(s)):s;if(!su(o))throw new TypeError("The element or ID supplied is not valid. (videojs)");const c=("getRootNode"in o?o.getRootNode()instanceof P.ShadowRoot:!1)?o.getRootNode():o.ownerDocument.body;(!o.ownerDocument.defaultView||!c.contains(o))&&Ke.warn("The element supplied is not included in the DOM"),e=e||{},e.restoreEl===!0&&(e.restoreEl=(o.parentNode&&o.parentNode.hasAttribute&&o.parentNode.hasAttribute("data-vjs-player")?o.parentNode:o).cloneNode(!0)),xa("beforesetup").forEach(g=>{const b=g(o,vt(e));if(!Is(b)||Array.isArray(b)){Ke.error("please return an object in beforesetup hooks");return}e=vt(e,b)});const p=ce.getComponent("Player");return r=new p(o,e,i),xa("setup").forEach(g=>g(r)),r}if(V.hooks_=kr,V.hooks=xa,V.hook=PR,V.hookOnce=UR,V.removeHook=v1,P.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&nu()){let s=Da(".vjs-styles-defaults");if(!s){s=V1("vjs-styles-defaults");const e=Da("head");e&&e.insertBefore(s,e.firstChild),$1(s,`
.video-js {
width: 300px;
height: 150px;
@@ -463,12 +463,12 @@ See https://github.com/videojs/video.js/issues/2617 for more info.
.vjs-fluid:not(.vjs-audio-only-mode) {
padding-top: 56.25%
}
- `)}}D0(1,$),$.VERSION=_0,$.options=ft.prototype.options_,$.getPlayers=()=>ft.players,$.getPlayer=s=>{const e=ft.players;let i;if(typeof s=="string"){const r=oS(s),o=e[r];if(o)return o;i=Da("#"+r)}else i=s;if(su(i)){const{player:r,playerId:o}=i;if(r||e[o])return r||e[o]}},$.getAllPlayers=()=>Object.keys(ft.players).map(s=>ft.players[s]).filter(Boolean),$.players=ft.players,$.getComponent=ce.getComponent,$.registerComponent=(s,e)=>(Ve.isTech(e)&&Ke.warn(`The ${s} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),ce.registerComponent.call(ce,s,e)),$.getTech=Ve.getTech,$.registerTech=Ve.registerTech,$.use=o3,Object.defineProperty($,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty($.middleware,"TERMINATOR",{value:_p,writeable:!1,enumerable:!0}),$.browser=w1,$.obj=HR,$.mergeOptions=fs(9,"videojs.mergeOptions","videojs.obj.merge",vt),$.defineLazyProperty=fs(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",Zf),$.bind=fs(9,"videojs.bind","native Function.prototype.bind",Dt),$.registerPlugin=on.registerPlugin,$.deregisterPlugin=on.deregisterPlugin,$.plugin=(s,e)=>(Ke.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),on.registerPlugin(s,e)),$.getPlugins=on.getPlugins,$.getPlugin=on.getPlugin,$.getPluginVersion=on.getPluginVersion,$.addLanguage=function(s,e){return s=(""+s).toLowerCase(),$.options.languages=vt($.options.languages,{[s]:e}),$.options.languages[s]},$.log=Ke,$.createLogger=_1,$.time=e3,$.createTimeRange=fs(9,"videojs.createTimeRange","videojs.time.createTimeRanges",hs),$.createTimeRanges=fs(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",hs),$.formatTime=fs(9,"videojs.formatTime","videojs.time.formatTime",ko),$.setFormatTime=fs(9,"videojs.setFormatTime","videojs.time.setFormatTime",e2),$.resetFormatTime=fs(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",t2),$.parseUrl=fs(9,"videojs.parseUrl","videojs.url.parseUrl",q0),$.isCrossOrigin=fs(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",vp),$.EventTarget=xn,$.any=O0,$.on=Sn,$.one=pp,$.off=Ni,$.trigger=lu,$.xhr=j_,$.TrackList=Oo,$.TextTrack=Ed,$.TextTrackList=z0,$.AudioTrack=u2,$.AudioTrackList=n2,$.VideoTrack=c2,$.VideoTrackList=s2,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(s=>{$[s]=function(){return Ke.warn(`videojs.${s}() is deprecated; use videojs.dom.${s}() instead`),j1[s].apply(null,arguments)}}),$.computedStyle=fs(9,"videojs.computedStyle","videojs.dom.computedStyle",ou),$.dom=j1,$.fn=YR,$.num=w3,$.str=ZR,$.url=r3,$.Error=J3;/*! @name videojs-contrib-quality-levels @version 4.1.0 @license Apache-2.0 */class e4{constructor(e){let i=this;return i.id=e.id,i.label=i.id,i.width=e.width,i.height=e.height,i.bitrate=e.bandwidth,i.frameRate=e.frameRate,i.enabled_=e.enabled,Object.defineProperty(i,"enabled",{get(){return i.enabled_()},set(r){i.enabled_(r)}}),i}}class Op extends $.EventTarget{constructor(){super();let e=this;return e.levels_=[],e.selectedIndex_=-1,Object.defineProperty(e,"selectedIndex",{get(){return e.selectedIndex_}}),Object.defineProperty(e,"length",{get(){return e.levels_.length}}),e[Symbol.iterator]=()=>e.levels_.values(),e}addQualityLevel(e){let i=this.getQualityLevelById(e.id);if(i)return i;const r=this.levels_.length;return i=new e4(e),""+r in this||Object.defineProperty(this,r,{get(){return this.levels_[r]}}),this.levels_.push(i),this.trigger({qualityLevel:i,type:"addqualitylevel"}),i}removeQualityLevel(e){let i=null;for(let r=0,o=this.length;rr&&this.selectedIndex_--;break}return i&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),i}getQualityLevelById(e){for(let i=0,r=this.length;ir,s.qualityLevels.VERSION=lS,r},uS=function(s){return t4(this,$.obj.merge({},s))};$.registerPlugin("qualityLevels",uS),uS.VERSION=lS;/*! @name @videojs/http-streaming @version 3.17.0 @license Apache-2.0 */const ln=Nf,Rp=(s,e)=>e&&e.responseURL&&s!==e.responseURL?e.responseURL:s,$n=s=>$.log.debug?$.log.debug.bind($,"VHS:",`${s} >`):function(){};function pt(...s){const e=$.obj||$;return(e.merge||e.mergeOptions).apply(e,s)}function hi(...s){const e=$.time||$;return(e.createTimeRanges||e.createTimeRanges).apply(e,s)}function i4(s){if(s.length===0)return"Buffered Ranges are empty";let e=`Buffered Ranges:
+ `)}}D0(1,V),V.VERSION=_0,V.options=ft.prototype.options_,V.getPlayers=()=>ft.players,V.getPlayer=s=>{const e=ft.players;let i;if(typeof s=="string"){const r=oS(s),o=e[r];if(o)return o;i=Da("#"+r)}else i=s;if(su(i)){const{player:r,playerId:o}=i;if(r||e[o])return r||e[o]}},V.getAllPlayers=()=>Object.keys(ft.players).map(s=>ft.players[s]).filter(Boolean),V.players=ft.players,V.getComponent=ce.getComponent,V.registerComponent=(s,e)=>(Ve.isTech(e)&&Ke.warn(`The ${s} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),ce.registerComponent.call(ce,s,e)),V.getTech=Ve.getTech,V.registerTech=Ve.registerTech,V.use=o3,Object.defineProperty(V,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(V.middleware,"TERMINATOR",{value:_p,writeable:!1,enumerable:!0}),V.browser=w1,V.obj=HR,V.mergeOptions=fs(9,"videojs.mergeOptions","videojs.obj.merge",vt),V.defineLazyProperty=fs(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",Zf),V.bind=fs(9,"videojs.bind","native Function.prototype.bind",Dt),V.registerPlugin=on.registerPlugin,V.deregisterPlugin=on.deregisterPlugin,V.plugin=(s,e)=>(Ke.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),on.registerPlugin(s,e)),V.getPlugins=on.getPlugins,V.getPlugin=on.getPlugin,V.getPluginVersion=on.getPluginVersion,V.addLanguage=function(s,e){return s=(""+s).toLowerCase(),V.options.languages=vt(V.options.languages,{[s]:e}),V.options.languages[s]},V.log=Ke,V.createLogger=_1,V.time=e3,V.createTimeRange=fs(9,"videojs.createTimeRange","videojs.time.createTimeRanges",hs),V.createTimeRanges=fs(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",hs),V.formatTime=fs(9,"videojs.formatTime","videojs.time.formatTime",ko),V.setFormatTime=fs(9,"videojs.setFormatTime","videojs.time.setFormatTime",e2),V.resetFormatTime=fs(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",t2),V.parseUrl=fs(9,"videojs.parseUrl","videojs.url.parseUrl",q0),V.isCrossOrigin=fs(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",vp),V.EventTarget=xn,V.any=O0,V.on=Sn,V.one=pp,V.off=Ni,V.trigger=lu,V.xhr=j_,V.TrackList=Oo,V.TextTrack=Ed,V.TextTrackList=z0,V.AudioTrack=u2,V.AudioTrackList=n2,V.VideoTrack=c2,V.VideoTrackList=s2,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(s=>{V[s]=function(){return Ke.warn(`videojs.${s}() is deprecated; use videojs.dom.${s}() instead`),j1[s].apply(null,arguments)}}),V.computedStyle=fs(9,"videojs.computedStyle","videojs.dom.computedStyle",ou),V.dom=j1,V.fn=YR,V.num=w3,V.str=ZR,V.url=r3,V.Error=J3;/*! @name videojs-contrib-quality-levels @version 4.1.0 @license Apache-2.0 */class e4{constructor(e){let i=this;return i.id=e.id,i.label=i.id,i.width=e.width,i.height=e.height,i.bitrate=e.bandwidth,i.frameRate=e.frameRate,i.enabled_=e.enabled,Object.defineProperty(i,"enabled",{get(){return i.enabled_()},set(r){i.enabled_(r)}}),i}}class Op extends V.EventTarget{constructor(){super();let e=this;return e.levels_=[],e.selectedIndex_=-1,Object.defineProperty(e,"selectedIndex",{get(){return e.selectedIndex_}}),Object.defineProperty(e,"length",{get(){return e.levels_.length}}),e[Symbol.iterator]=()=>e.levels_.values(),e}addQualityLevel(e){let i=this.getQualityLevelById(e.id);if(i)return i;const r=this.levels_.length;return i=new e4(e),""+r in this||Object.defineProperty(this,r,{get(){return this.levels_[r]}}),this.levels_.push(i),this.trigger({qualityLevel:i,type:"addqualitylevel"}),i}removeQualityLevel(e){let i=null;for(let r=0,o=this.length;rr&&this.selectedIndex_--;break}return i&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),i}getQualityLevelById(e){for(let i=0,r=this.length;ir,s.qualityLevels.VERSION=lS,r},uS=function(s){return t4(this,V.obj.merge({},s))};V.registerPlugin("qualityLevels",uS),uS.VERSION=lS;/*! @name @videojs/http-streaming @version 3.17.0 @license Apache-2.0 */const ln=Nf,Rp=(s,e)=>e&&e.responseURL&&s!==e.responseURL?e.responseURL:s,$n=s=>V.log.debug?V.log.debug.bind(V,"VHS:",`${s} >`):function(){};function pt(...s){const e=V.obj||V;return(e.merge||e.mergeOptions).apply(e,s)}function hi(...s){const e=V.time||V;return(e.createTimeRanges||e.createTimeRanges).apply(e,s)}function i4(s){if(s.length===0)return"Buffered Ranges are empty";let e=`Buffered Ranges:
`;for(let i=0;i ${o}. Duration (${o-r})
-`}return e}const Fs=1/30,Hs=Fs*3,cS=function(s,e){const i=[];let r;if(s&&s.length)for(r=0;r=e})},Mp=function(s,e){return cS(s,function(i){return i-Fs>=e})},n4=function(s){if(s.length<2)return hi();const e=[];for(let i=1;i{const e=[];if(!s||!s.length)return"";for(let i=0;i "+s.end(i));return e.join(", ")},r4=function(s,e,i=1){return((s.length?s.end(s.length-1):0)-e)/i},Io=s=>{const e=[];for(let i=0;iu)){if(e>o&&e<=u){i+=u-e;continue}i+=u-o}}return i},yy=(s,e)=>{if(!e.preload)return e.duration;let i=0;return(e.parts||[]).forEach(function(r){i+=r.duration}),(e.preloadHints||[]).forEach(function(r){r.type==="PART"&&(i+=s.partTargetDuration)}),i},vy=s=>(s.segments||[]).reduce((e,i,r)=>(i.parts?i.parts.forEach(function(o,u){e.push({duration:o.duration,segmentIndex:r,partIndex:u,part:o,segment:i})}):e.push({duration:i.duration,segmentIndex:r,partIndex:null,segment:i,part:null}),e),[]),hS=s=>{const e=s.segments&&s.segments.length&&s.segments[s.segments.length-1];return e&&e.parts||[]},fS=({preloadSegment:s})=>{if(!s)return;const{parts:e,preloadHints:i}=s;let r=(i||[]).reduce((o,u)=>o+(u.type==="PART"?1:0),0);return r+=e&&e.length?e.length:0,r},pS=(s,e)=>{if(e.endList)return 0;if(s&&s.suggestedPresentationDelay)return s.suggestedPresentationDelay;const i=hS(e).length>0;return i&&e.serverControl&&e.serverControl.partHoldBack?e.serverControl.partHoldBack:i&&e.partTargetDuration?e.partTargetDuration*3:e.serverControl&&e.serverControl.holdBack?e.serverControl.holdBack:e.targetDuration?e.targetDuration*3:0},o4=function(s,e){let i=0,r=e-s.mediaSequence,o=s.segments[r];if(o){if(typeof o.start<"u")return{result:o.start,precise:!0};if(typeof o.end<"u")return{result:o.end-o.duration,precise:!0}}for(;r--;){if(o=s.segments[r],typeof o.end<"u")return{result:i+o.end,precise:!0};if(i+=yy(s,o),typeof o.start<"u")return{result:i+o.start,precise:!0}}return{result:i,precise:!1}},l4=function(s,e){let i=0,r,o=e-s.mediaSequence;for(;o"u"&&(e=s.mediaSequence+s.segments.length),e"u"){if(s.totalDuration)return s.totalDuration;if(!s.endList)return P.Infinity}return mS(s,e,i)},kd=function({defaultDuration:s,durationList:e,startIndex:i,endIndex:r}){let o=0;if(i>r&&([i,r]=[r,i]),i<0){for(let u=i;u0)for(let b=g-1;b>=0;b--){const S=p[b];if(c+=S.duration,u){if(c<0)continue}else if(c+Fs<=0)continue;return{partIndex:S.partIndex,segmentIndex:S.segmentIndex,startTime:o-kd({defaultDuration:s.targetDuration,durationList:p,startIndex:g,endIndex:b})}}return{partIndex:p[0]&&p[0].partIndex||null,segmentIndex:p[0]&&p[0].segmentIndex||0,startTime:e}}if(g<0){for(let b=g;b<0;b++)if(c-=s.targetDuration,c<0)return{partIndex:p[0]&&p[0].partIndex||null,segmentIndex:p[0]&&p[0].segmentIndex||0,startTime:e};g=0}for(let b=g;bFs,A=c===0,M=E&&c+Fs>=0;if(!((A||M)&&b!==p.length-1)){if(u){if(c>0)continue}else if(c-Fs>=0)continue;return{partIndex:S.partIndex,segmentIndex:S.segmentIndex,startTime:o+kd({defaultDuration:s.targetDuration,durationList:p,startIndex:g,endIndex:b})}}}return{segmentIndex:p[p.length-1].segmentIndex,partIndex:p[p.length-1].partIndex,startTime:e}},vS=function(s){return s.excludeUntil&&s.excludeUntil>Date.now()},by=function(s){return s.excludeUntil&&s.excludeUntil===1/0},Lp=function(s){const e=vS(s);return!s.disabled&&!e},d4=function(s){return s.disabled},h4=function(s){for(let e=0;e{if(s.playlists.length===1)return!0;const i=e.attributes.BANDWIDTH||Number.MAX_VALUE;return s.playlists.filter(r=>Lp(r)?(r.attributes.BANDWIDTH||0)!s&&!e||!s&&e||s&&!e?!1:!!(s===e||s.id&&e.id&&s.id===e.id||s.resolvedUri&&e.resolvedUri&&s.resolvedUri===e.resolvedUri||s.uri&&e.uri&&s.uri===e.uri),_S=function(s,e){const i=s&&s.mediaGroups&&s.mediaGroups.AUDIO||{};let r=!1;for(const o in i){for(const u in i[o])if(r=e(i[o][u]),r)break;if(r)break}return!!r},Od=s=>{if(!s||!s.playlists||!s.playlists.length)return _S(s,i=>i.playlists&&i.playlists.length||i.uri);for(let e=0;eiT(u))||_S(s,u=>Ty(i,u))))return!1}return!0};var un={liveEdgeDelay:pS,duration:gS,seekable:u4,getMediaInfoForTime:c4,isEnabled:Lp,isDisabled:d4,isExcluded:vS,isIncompatible:by,playlistEnd:yS,isAes:h4,hasAttribute:bS,estimateSegmentRequestTime:f4,isLowestEnabledRendition:_y,isAudioOnly:Od,playlistMatch:Ty,segmentDurationWithParts:yy};const{log:TS}=$,yu=(s,e)=>`${s}-${e}`,SS=(s,e,i)=>`placeholder-uri-${s}-${e}-${i}`,p4=({onwarn:s,oninfo:e,manifestString:i,customTagParsers:r=[],customTagMappers:o=[],llhls:u})=>{const c=new Nk;s&&c.on("warn",s),e&&c.on("info",e),r.forEach(b=>c.addParser(b)),o.forEach(b=>c.addTagMapper(b)),c.push(i),c.end();const p=c.manifest;if(u||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(b){p.hasOwnProperty(b)&&delete p[b]}),p.segments&&p.segments.forEach(function(b){["parts","preloadHints"].forEach(function(S){b.hasOwnProperty(S)&&delete b[S]})})),!p.targetDuration){let b=10;p.segments&&p.segments.length&&(b=p.segments.reduce((S,E)=>Math.max(S,E.duration),0)),s&&s({message:`manifest has no targetDuration defaulting to ${b}`}),p.targetDuration=b}const g=hS(p);if(g.length&&!p.partTargetDuration){const b=g.reduce((S,E)=>Math.max(S,E.duration),0);s&&(s({message:`manifest has no partTargetDuration defaulting to ${b}`}),TS.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),p.partTargetDuration=b}return p},vu=(s,e)=>{s.mediaGroups&&["AUDIO","SUBTITLES"].forEach(i=>{if(s.mediaGroups[i])for(const r in s.mediaGroups[i])for(const o in s.mediaGroups[i][r]){const u=s.mediaGroups[i][r][o];e(u,i,r,o)}})},xS=({playlist:s,uri:e,id:i})=>{s.id=i,s.playlistErrors_=0,e&&(s.uri=e),s.attributes=s.attributes||{}},m4=s=>{let e=s.playlists.length;for(;e--;){const i=s.playlists[e];xS({playlist:i,id:yu(e,i.uri)}),i.resolvedUri=ln(s.uri,i.uri),s.playlists[i.id]=i,s.playlists[i.uri]=i,i.attributes.BANDWIDTH||TS.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},g4=s=>{vu(s,e=>{e.uri&&(e.resolvedUri=ln(s.uri,e.uri))})},y4=(s,e)=>{const i=yu(0,e),r={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:P.location.href,resolvedUri:P.location.href,playlists:[{uri:e,id:i,resolvedUri:e,attributes:{}}]};return r.playlists[i]=r.playlists[0],r.playlists[e]=r.playlists[0],r},ES=(s,e,i=SS)=>{s.uri=e;for(let o=0;o{if(!o.playlists||!o.playlists.length){if(r&&u==="AUDIO"&&!o.uri)for(let g=0;g(o.set(u.id,u),o),new Map)}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(this.offset_===null)return[];const e={},i=[];this.pendingDateRanges_.forEach((r,o)=>{if(!this.processedDateRanges_.has(o)&&(r.startTime=r.startDate.getTime()/1e3-this.offset_,r.processDateRange=()=>this.processDateRange(r),i.push(r),!!r.class))if(e[r.class]){const u=e[r.class].push(r);r.classListIndex=u-1}else e[r.class]=[r],r.classListIndex=0});for(const r of i){const o=e[r.class]||[];r.endDate?r.endTime=r.endDate.getTime()/1e3-this.offset_:r.endOnNext&&o[r.classListIndex+1]?r.endTime=o[r.classListIndex+1].startTime:r.duration?r.endTime=r.startTime+r.duration:r.plannedDuration?r.endTime=r.startTime+r.plannedDuration:r.endTime=r.startTime}return i}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach((r,o)=>{r.startDate.getTime(){const o=e.status<200||e.status>299,u=e.status>=400&&e.status<=499,c={uri:e.uri,requestType:s},p=o&&!u||r;if(i&&u)c.error=Ft({},i),c.errorType=$.Error.NetworkRequestFailed;else if(e.aborted)c.errorType=$.Error.NetworkRequestAborted;else if(e.timedout)c.erroType=$.Error.NetworkRequestTimeout;else if(p){const g=r?$.Error.NetworkBodyParserFailed:$.Error.NetworkBadStatus;c.errorType=g,c.status=e.status,c.headers=e.headers}return c},v4=$n("CodecUtils"),DS=function(s){const e=s.attributes||{};if(e.CODECS)return Rs(e.CODECS)},wS=(s,e)=>{const i=e.attributes||{};return s&&s.mediaGroups&&s.mediaGroups.AUDIO&&i.AUDIO&&s.mediaGroups.AUDIO[i.AUDIO]},b4=(s,e)=>{if(!wS(s,e))return!0;const i=e.attributes||{},r=s.mediaGroups.AUDIO[i.AUDIO];for(const o in r)if(!r[o].uri&&!r[o].playlists)return!0;return!1},Rd=function(s){const e={};return s.forEach(({mediaType:i,type:r,details:o})=>{e[i]=e[i]||[],e[i].push(tT(`${r}${o}`))}),Object.keys(e).forEach(function(i){if(e[i].length>1){v4(`multiple ${i} codecs found as attributes: ${e[i].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`),e[i]=null;return}e[i]=e[i][0]}),e},kS=function(s){let e=0;return s.audio&&e++,s.video&&e++,e},Md=function(s,e){const i=e.attributes||{},r=Rd(DS(e)||[]);if(wS(s,e)&&!r.audio&&!b4(s,e)){const o=Rd(Uk(s,i.AUDIO)||[]);o.audio&&(r.audio=o.audio)}return r},{EventTarget:_4}=$,T4=(s,e)=>{if(e.endList||!e.serverControl)return s;const i={};if(e.serverControl.canBlockReload){const{preloadSegment:r}=e;let o=e.mediaSequence+e.segments.length;if(r){const u=r.parts||[],c=fS(e)-1;c>-1&&c!==u.length-1&&(i._HLS_part=c),(c>-1||u.length)&&o--}i._HLS_msn=o}if(e.serverControl&&e.serverControl.canSkipUntil&&(i._HLS_skip=e.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(i).length){const r=new P.URL(s);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(o){i.hasOwnProperty(o)&&r.searchParams.set(o,i[o])}),s=r.toString()}return s},S4=(s,e)=>{if(!s)return e;const i=pt(s,e);if(s.preloadHints&&!e.preloadHints&&delete i.preloadHints,s.parts&&!e.parts)delete i.parts;else if(s.parts&&e.parts)for(let r=0;r{const r=s.slice(),o=e.slice();i=i||0;const u=[];let c;for(let p=0;p{!s.resolvedUri&&s.uri&&(s.resolvedUri=ln(e,s.uri)),s.key&&!s.key.resolvedUri&&(s.key.resolvedUri=ln(e,s.key.uri)),s.map&&!s.map.resolvedUri&&(s.map.resolvedUri=ln(e,s.map.uri)),s.map&&s.map.key&&!s.map.key.resolvedUri&&(s.map.key.resolvedUri=ln(e,s.map.key.uri)),s.parts&&s.parts.length&&s.parts.forEach(i=>{i.resolvedUri||(i.resolvedUri=ln(e,i.uri))}),s.preloadHints&&s.preloadHints.length&&s.preloadHints.forEach(i=>{i.resolvedUri||(i.resolvedUri=ln(e,i.uri))})},RS=function(s){const e=s.segments||[],i=s.preloadSegment;if(i&&i.parts&&i.parts.length){if(i.preloadHints){for(let r=0;rs===e||s.segments&&e.segments&&s.segments.length===e.segments.length&&s.endList===e.endList&&s.mediaSequence===e.mediaSequence&&s.preloadSegment===e.preloadSegment,Sy=(s,e,i=MS)=>{const r=pt(s,{}),o=r.playlists[e.id];if(!o||i(o,e))return null;e.segments=RS(e);const u=pt(o,e);if(u.preloadSegment&&!e.preloadSegment&&delete u.preloadSegment,o.segments){if(e.skip){e.segments=e.segments||[];for(let c=0;c{OS(c,u.resolvedUri)});for(let c=0;c{if(c.playlists)for(let S=0;S{const i=s.segments||[],r=i[i.length-1],o=r&&r.parts&&r.parts[r.parts.length-1],u=o&&o.duration||r&&r.duration;return e&&u?u*1e3:(s.partTargetDuration||s.targetDuration||10)*500},LS=(s,e,i)=>{if(!s)return;const r=[];return s.forEach(o=>{if(!o.attributes)return;const{BANDWIDTH:u,RESOLUTION:c,CODECS:p}=o.attributes;r.push({id:o.id,bandwidth:u,resolution:c,codecs:p})}),{type:e,isLive:i,renditions:r}};class bu extends _4{constructor(e,i,r={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=$n("PlaylistLoader");const{withCredentials:o=!1}=r;this.src=e,this.vhs_=i,this.withCredentials=o,this.addDateRangesToTextTrack_=r.addDateRangesToTextTrack;const u=i.options_;this.customTagParsers=u&&u.customTagParsers||[],this.customTagMappers=u&&u.customTagMappers||[],this.llhls=u&&u.llhls,this.dateRangesStorage_=new CS,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){const e=this.media();if(!e)return;this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges);const i=this.dateRangesStorage_.getDateRangesToProcess();!i.length||!this.addDateRangesToTextTrack_||this.addDateRangesToTextTrack_(i)}handleMediaupdatetimeout_(){if(this.state!=="HAVE_METADATA")return;const e=this.media();let i=ln(this.main.uri,e.uri);this.llhls&&(i=T4(i,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:i,withCredentials:this.withCredentials,requestType:"hls-playlist"},(r,o)=>{if(this.request){if(r)return this.playlistRequestError(this.request,this.media(),"HAVE_METADATA");this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})}})}playlistRequestError(e,i,r){const{uri:o,id:u}=i;this.request=null,r&&(this.state=r),this.error={playlist:this.main.playlists[u],status:e.status,message:`HLS playlist request error at URL: ${o}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:No({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:i}){try{const r=p4({onwarn:({message:o})=>this.logger_(`m3u8-parser warn for ${e}: ${o}`),oninfo:({message:o})=>this.logger_(`m3u8-parser info for ${e}: ${o}`),manifestString:i,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls});return!r.playlists||!r.playlists.length||this.excludeAudioOnlyVariants(r.playlists),r}catch(r){this.error=r,this.error.metadata={errorType:$.Error.StreamingHlsPlaylistParserError,error:r}}}excludeAudioOnlyVariants(e){const i=r=>{const o=r.attributes||{},{width:u,height:c}=o.RESOLUTION||{};if(u&&c)return!0;const p=DS(r)||[];return!!Rd(p).video};e.some(i)&&e.forEach(r=>{i(r)||(r.excludeUntil=1/0)})}haveMetadata({playlistString:e,playlistObject:i,url:r,id:o}){this.request=null,this.state="HAVE_METADATA";const u={playlistInfo:{type:"media",uri:r}};this.trigger({type:"playlistparsestart",metadata:u});const c=i||this.parseManifest_({url:r,manifestString:e});c.lastRequest=Date.now(),xS({playlist:c,uri:r,id:o});const p=Sy(this.main,c);this.targetDuration=c.partTargetDuration||c.targetDuration,this.pendingMedia_=null,p?(this.main=p,this.media_=this.main.playlists[o]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(xy(this.media(),!!p)),u.parsedPlaylist=LS(this.main.playlists,u.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:u}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),P.clearTimeout(this.mediaUpdateTimeout),P.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new CS,this.off()}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e,i){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);if(typeof e=="string"){if(!this.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.main.playlists[e]}if(P.clearTimeout(this.finalRenditionTimeout),i){const p=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=P.setTimeout(this.media.bind(this,e,!1),p);return}const r=this.state,o=!this.media_||e.id!==this.media_.id,u=this.main.playlists[e.id];if(u&&u.endList||e.endList&&e.segments.length){this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,o&&(this.trigger("mediachanging"),r==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_(xy(e,!0)),!o)return;if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e;const c={playlistInfo:{type:"media",uri:e.uri}};this.trigger({type:"playlistrequeststart",metadata:c}),this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials,requestType:"hls-playlist"},(p,g)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=Rp(e.resolvedUri,g),p)return this.playlistRequestError(this.request,e,r);this.trigger({type:"playlistrequestcomplete",metadata:c}),this.haveMetadata({playlistString:g.responseText,url:e.uri,id:e.id}),r==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}pause(){this.mediaUpdateTimeout&&(P.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),this.state==="HAVE_NOTHING"&&(this.started=!1),this.state==="SWITCHING_MEDIA"?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":this.state==="HAVE_CURRENT_METADATA"&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(P.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const i=this.media();if(e){const r=i?(i.partTargetDuration||i.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=P.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},r);return}if(!this.started){this.start();return}i&&!i.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(P.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=P.setTimeout(()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)},e))}start(){if(this.started=!0,typeof this.src=="object"){this.src.uri||(this.src.uri=P.location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0);return}const e={playlistInfo:{type:"multivariant",uri:this.src}};this.trigger({type:"playlistrequeststart",metadata:e}),this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials,requestType:"hls-playlist"},(i,r)=>{if(!this.request)return;if(this.request=null,i)return this.error={status:r.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:r.responseText,code:2,metadata:No({requestType:r.requestType,request:r,error:i})},this.state==="HAVE_NOTHING"&&(this.started=!1),this.trigger("error");this.trigger({type:"playlistrequestcomplete",metadata:e}),this.src=Rp(this.src,r),this.trigger({type:"playlistparsestart",metadata:e});const o=this.parseManifest_({manifestString:r.responseText,url:this.src});e.parsedPlaylist=LS(o.playlists,e.playlistInfo.type,!1),this.trigger({type:"playlistparsecomplete",metadata:e}),this.setupInitialPlaylist(o)})}srcUri(){return typeof this.src=="string"?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists){this.main=e,ES(this.main,this.srcUri()),e.playlists.forEach(r=>{r.segments=RS(r),r.segments.forEach(o=>{OS(o,r.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const i=this.srcUri()||P.location.href;this.main=y4(e,i),this.haveMetadata({playlistObject:e,url:i,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,i){const r=this.main,o=e.ID;let u=r.playlists.length;for(;u--;){const c=r.playlists[u];if(c.attributes["PATHWAY-ID"]===o){const p=c.resolvedUri,g=c.id;if(i){const b=this.createCloneURI_(c.resolvedUri,e),S=yu(o,b),E=this.createCloneAttributes_(o,c.attributes),A=this.createClonePlaylist_(c,S,e,E);r.playlists[u]=A,r.playlists[S]=A,r.playlists[b]=A}else r.playlists.splice(u,1);delete r.playlists[g],delete r.playlists[p]}}this.updateOrDeleteCloneMedia(e,i)}updateOrDeleteCloneMedia(e,i){const r=this.main,o=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(u=>{if(!(!r.mediaGroups[u]||!r.mediaGroups[u][o])){for(const c in r.mediaGroups[u])if(c===o){for(const p in r.mediaGroups[u][c])r.mediaGroups[u][c][p].playlists.forEach((b,S)=>{const E=r.playlists[b.id],A=E.id,M=E.resolvedUri;delete r.playlists[A],delete r.playlists[M]});delete r.mediaGroups[u][c]}}}),i&&this.createClonedMediaGroups_(e)}addClonePathway(e,i={}){const r=this.main,o=r.playlists.length,u=this.createCloneURI_(i.resolvedUri,e),c=yu(e.ID,u),p=this.createCloneAttributes_(e.ID,i.attributes),g=this.createClonePlaylist_(i,c,e,p);r.playlists[o]=g,r.playlists[c]=g,r.playlists[u]=g,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){const i=e.ID,r=e["BASE-ID"],o=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(u=>{if(!(!o.mediaGroups[u]||o.mediaGroups[u][i]))for(const c in o.mediaGroups[u]){if(c===r)o.mediaGroups[u][i]={};else continue;for(const p in o.mediaGroups[u][c]){const g=o.mediaGroups[u][c][p];o.mediaGroups[u][i][p]=Ft({},g);const b=o.mediaGroups[u][i][p],S=this.createCloneURI_(g.resolvedUri,e);b.resolvedUri=S,b.uri=S,b.playlists=[],g.playlists.forEach((E,A)=>{const M=o.playlists[E.id],U=SS(u,i,p),D=yu(i,U);if(M&&!o.playlists[D]){const z=this.createClonePlaylist_(M,D,e),H=z.resolvedUri;o.playlists[D]=z,o.playlists[H]=z}b.playlists[A]=this.createClonePlaylist_(E,D,e)})}}})}createClonePlaylist_(e,i,r,o){const u=this.createCloneURI_(e.resolvedUri,r),c={resolvedUri:u,uri:u,id:i};return e.segments&&(c.segments=[]),o&&(c.attributes=o),pt(e,c)}createCloneURI_(e,i){const r=new URL(e);r.hostname=i["URI-REPLACEMENT"].HOST;const o=i["URI-REPLACEMENT"].PARAMS;for(const u of Object.keys(o))r.searchParams.set(u,o[u]);return r.href}createCloneAttributes_(e,i){const r={"PATHWAY-ID":e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(o=>{i[o]&&(r[o]=e)}),r}getKeyIdSet(e){if(e.contentProtection){const i=new Set;for(const r in e.contentProtection){const o=e.contentProtection[r].attributes.keyId;o&&i.add(o.toLowerCase())}return i}}}const Ey=function(s,e,i,r){const o=s.responseType==="arraybuffer"?s.response:s.responseText;!e&&o&&(s.responseTime=Date.now(),s.roundTripTime=s.responseTime-s.requestTime,s.bytesReceived=o.byteLength||o.length,s.bandwidth||(s.bandwidth=Math.floor(s.bytesReceived/s.roundTripTime*8*1e3))),i.headers&&(s.responseHeaders=i.headers),e&&e.code==="ETIMEDOUT"&&(s.timedout=!0),!e&&!s.aborted&&i.statusCode!==200&&i.statusCode!==206&&i.statusCode!==0&&(e=new Error("XHR Failed with a response of: "+(s&&(o||s.responseText)))),r(e,s)},E4=(s,e)=>{if(!s||!s.size)return;let i=e;return s.forEach(r=>{i=r(i)}),i},C4=(s,e,i,r)=>{!s||!s.size||s.forEach(o=>{o(e,i,r)})},IS=function(){const s=function e(i,r){i=pt({timeout:45e3},i);const o=e.beforeRequest||$.Vhs.xhr.beforeRequest,u=e._requestCallbackSet||$.Vhs.xhr._requestCallbackSet||new Set,c=e._responseCallbackSet||$.Vhs.xhr._responseCallbackSet;o&&typeof o=="function"&&($.log.warn("beforeRequest is deprecated, use onRequest instead."),u.add(o));const p=$.Vhs.xhr.original===!0?$.xhr:$.Vhs.xhr,g=E4(u,i);u.delete(o);const b=p(g||i,function(E,A){return C4(c,b,E,A),Ey(b,E,A,r)}),S=b.abort;return b.abort=function(){return b.aborted=!0,S.apply(b,arguments)},b.uri=i.uri,b.requestType=i.requestType,b.requestTime=Date.now(),b};return s.original=!0,s},A4=function(s){let e;const i=s.offset;return typeof s.offset=="bigint"||typeof s.length=="bigint"?e=P.BigInt(s.offset)+P.BigInt(s.length)-P.BigInt(1):e=s.offset+s.length-1,"bytes="+i+"-"+e},Cy=function(s){const e={};return s.byterange&&(e.Range=A4(s.byterange)),e},D4=function(s,e){return s.start(e)+"-"+s.end(e)},w4=function(s,e){const i=s.toString(16);return"00".substring(0,2-i.length)+i+(e%2?" ":"")},k4=function(s){return s>=32&&s<126?String.fromCharCode(s):"."},NS=function(s){const e={};return Object.keys(s).forEach(i=>{const r=s[i];rT(r)?e[i]={bytes:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}:e[i]=r}),e},Ip=function(s){const e=s.byterange||{length:1/0,offset:0};return[e.length,e.offset,s.resolvedUri].join(",")},PS=function(s){return s.resolvedUri},US=s=>{const e=Array.prototype.slice.call(s),i=16;let r="",o,u;for(let c=0;cUS(s),textRanges:s=>{let e="",i;for(i=0;i{if(!e.dateTimeObject)return null;const i=e.videoTimingInfo.transmuxerPrependedSeconds,o=e.videoTimingInfo.transmuxedPresentationStart+i,u=s-o;return new Date(e.dateTimeObject.getTime()+u*1e3)},M4=s=>s.transmuxedPresentationEnd-s.transmuxedPresentationStart-s.transmuxerPrependedSeconds,L4=(s,e)=>{let i;try{i=new Date(s)}catch{return null}if(!e||!e.segments||e.segments.length===0)return null;let r=e.segments[0];if(ip?null:(i>new Date(u)&&(r=o),{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:un.duration(e,e.mediaSequence+e.segments.indexOf(r)),type:r.videoTimingInfo?"accurate":"estimate"})},I4=(s,e)=>{if(!e||!e.segments||e.segments.length===0)return null;let i=0,r;for(let u=0;ui){if(s>i+o.duration*BS)return null;r=o}return{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:i-r.duration,type:r.videoTimingInfo?"accurate":"estimate"}},N4=(s,e)=>{let i,r;try{i=new Date(s),r=new Date(e)}catch{}const o=i.getTime();return(r.getTime()-o)/1e3},P4=s=>{if(!s.segments||s.segments.length===0)return!1;for(let e=0;e{if(!i)throw new Error("getProgramTime: callback must be provided");if(!s||e===void 0)return i({message:"getProgramTime: playlist and time must be provided"});const r=I4(e,s);if(!r)return i({message:"valid programTime was not found"});if(r.type==="estimate")return i({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:r.estimatedStart});const o={mediaSeconds:e},u=R4(e,r.segment);return u&&(o.programDateTime=u.toISOString()),i(null,o)},FS=({programTime:s,playlist:e,retryCount:i=2,seekTo:r,pauseAfterSeek:o=!0,tech:u,callback:c})=>{if(!c)throw new Error("seekToProgramTime: callback must be provided");if(typeof s>"u"||!e||!r)return c({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!e.endList&&!u.hasStarted_)return c({message:"player must be playing a live stream to start buffering"});if(!P4(e))return c({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const p=L4(s,e);if(!p)return c({message:`${s} was not found in the stream`});const g=p.segment,b=N4(g.dateTimeObject,s);if(p.type==="estimate"){if(i===0)return c({message:`${s} is not buffered yet. Try again`});r(p.estimatedStart+b),u.one("seeked",()=>{FS({programTime:s,playlist:e,retryCount:i-1,seekTo:r,pauseAfterSeek:o,tech:u,callback:c})});return}const S=g.start+b,E=()=>c(null,u.currentTime());u.one("seeked",E),o&&u.pause(),r(S)},Ay=(s,e)=>{if(s.readyState===4)return e()},B4=(s,e,i,r)=>{let o=[],u,c=!1;const p=function(E,A,M,U){return A.abort(),c=!0,i(E,A,M,U)},g=function(E,A){if(c)return;if(E)return E.metadata=No({requestType:r,request:A,error:E}),p(E,A,"",o);const M=A.responseText.substring(o&&o.byteLength||0,A.responseText.length);if(o=Xk(o,aT(M,!0)),u=u||md(o),o.length<10||u&&o.lengthp(E,A,"",o));const U=m0(o);return U==="ts"&&o.length<188?Ay(A,()=>p(E,A,"",o)):!U&&o.length<376?Ay(A,()=>p(E,A,"",o)):p(null,A,U,o)},S=e({uri:s,beforeSend(E){E.overrideMimeType("text/plain; charset=x-user-defined"),E.addEventListener("progress",function({total:A,loaded:M}){return Ey(E,null,{statusCode:E.status},g)})}},function(E,A){return Ey(S,E,A,g)});return S},{EventTarget:F4}=$,HS=function(s,e){if(!MS(s,e)||s.sidx&&e.sidx&&(s.sidx.offset!==e.sidx.offset||s.sidx.length!==e.sidx.length))return!1;if(!s.sidx&&e.sidx||s.sidx&&!e.sidx||s.segments&&!e.segments||!s.segments&&e.segments)return!1;if(!s.segments&&!e.segments)return!0;for(let i=0;i{const o=r.attributes.NAME||i;return`placeholder-uri-${s}-${e}-${o}`},z4=({mainXml:s,srcUrl:e,clientOffset:i,sidxMapping:r,previousManifest:o})=>{const u=pR(s,{manifestUri:e,clientOffset:i,sidxMapping:r,previousManifest:o});return ES(u,e,H4),u},j4=(s,e)=>{vu(s,(i,r,o,u)=>{(!e.mediaGroups[r][o]||!(u in e.mediaGroups[r][o]))&&delete s.mediaGroups[r][o][u]})},q4=(s,e,i)=>{let r=!0,o=pt(s,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod,timelineStarts:e.timelineStarts});for(let u=0;u{if(u.playlists&&u.playlists.length){const b=u.playlists[0].id,S=Sy(o,u.playlists[0],HS);S&&(o=S,g in o.mediaGroups[c][p]||(o.mediaGroups[c][p][g]=u),o.mediaGroups[c][p][g].playlists[0]=o.playlists[b],r=!1)}}),j4(o,e),e.minimumUpdatePeriod!==s.minimumUpdatePeriod&&(r=!1),r?null:o},V4=(s,e)=>(!s.map&&!e.map||!!(s.map&&e.map&&s.map.byterange.offset===e.map.byterange.offset&&s.map.byterange.length===e.map.byterange.length))&&s.uri===e.uri&&s.byterange.offset===e.byterange.offset&&s.byterange.length===e.byterange.length,zS=(s,e)=>{const i={};for(const r in s){const u=s[r].sidx;if(u){const c=$f(u);if(!e[c])break;const p=e[c].sidxInfo;V4(p,u)&&(i[c]=e[c])}}return i},$4=(s,e)=>{let r=zS(s.playlists,e);return vu(s,(o,u,c,p)=>{if(o.playlists&&o.playlists.length){const g=o.playlists;r=pt(r,zS(g,e))}}),r};class Dy extends F4{constructor(e,i,r={},o){super(),this.isPaused_=!0,this.mainPlaylistLoader_=o||this,o||(this.isMain_=!0);const{withCredentials:u=!1}=r;if(this.vhs_=i,this.withCredentials=u,this.addMetadataToTextTrack=r.addMetadataToTextTrack,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=$n("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}get isPaused(){return this.isPaused_}requestErrored_(e,i,r){if(!this.request)return!0;if(this.request=null,e)return this.error=typeof e=="object"&&!(e instanceof Error)?e:{status:i.status,message:"DASH request error at URL: "+i.uri,response:i.response,code:2,metadata:e.metadata},r&&(this.state=r),this.trigger("error"),!0}addSidxSegments_(e,i,r){const o=e.sidx&&$f(e.sidx);if(!e.sidx||!o||this.mainPlaylistLoader_.sidxMapping_[o]){P.clearTimeout(this.mediaRequest_),this.mediaRequest_=P.setTimeout(()=>r(!1),0);return}const u=Rp(e.sidx.resolvedUri),c=(g,b)=>{if(this.requestErrored_(g,b,i))return;const S=this.mainPlaylistLoader_.sidxMapping_,{requestType:E}=b;let A;try{A=_R(Ie(b.response).subarray(8))}catch(M){M.metadata=No({requestType:E,request:b,parseFailure:!0}),this.requestErrored_(M,b,i);return}return S[o]={sidxInfo:e.sidx,sidx:A},u0(e,A,e.sidx.resolvedUri),r(!0)},p="dash-sidx";this.request=B4(u,this.vhs_.xhr,(g,b,S,E)=>{if(g)return c(g,b);if(!S||S!=="mp4"){const U=S||"unknown";return c({status:b.status,message:`Unsupported ${U} container type for sidx segment at URL: ${u}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},b)}const{offset:A,length:M}=e.sidx.byterange;if(E.length>=M+A)return c(g,{response:E.subarray(A,A+M),status:b.status,uri:b.uri});this.request=this.vhs_.xhr({uri:u,responseType:"arraybuffer",requestType:"dash-sidx",headers:Cy({byterange:e.sidx.byterange})},c)},p)}dispose(){this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},P.clearTimeout(this.minimumUpdatePeriodTimeout_),P.clearTimeout(this.mediaRequest_),P.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);const i=this.state;if(typeof e=="string"){if(!this.mainPlaylistLoader_.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}const r=!this.media_||e.id!==this.media_.id;if(r&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){this.state="HAVE_METADATA",this.media_=e,r&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}r&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,i,o=>{this.haveMetadata({startingState:i,playlist:e})}))}haveMetadata({startingState:e,playlist:i}){this.state="HAVE_METADATA",this.loadedPlaylists_[i.id]=i,P.clearTimeout(this.mediaRequest_),this.mediaRequest_=null,this.refreshMedia_(i.id),e==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.isPaused_=!0,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),P.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(P.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){this.isPaused_=!1,P.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const i=this.media();if(e){const r=i?i.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=P.setTimeout(()=>this.load(),r);return}if(!this.started){this.start();return}i&&!i.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist")}start(){if(this.started=!0,!this.isMain_){P.clearTimeout(this.mediaRequest_),this.mediaRequest_=P.setTimeout(()=>this.haveMain_(),0);return}this.requestMain_((e,i)=>{this.haveMain_(),!this.hasPendingRequest()&&!this.media_&&this.media(this.mainPlaylistLoader_.main.playlists[0])})}requestMain_(e){const i={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestrequeststart",metadata:i}),this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},(r,o)=>{if(r){const{requestType:c}=o;r.metadata=No({requestType:c,request:o,error:r})}if(this.requestErrored_(r,o)){this.state==="HAVE_NOTHING"&&(this.started=!1);return}this.trigger({type:"manifestrequestcomplete",metadata:i});const u=o.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=o.responseText,o.responseHeaders&&o.responseHeaders.date?this.mainLoaded_=Date.parse(o.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=Rp(this.mainPlaylistLoader_.srcUrl,o),u){this.handleMain_(),this.syncClientServerClock_(()=>e(o,u));return}return e(o,u)})}syncClientServerClock_(e){const i=mR(this.mainPlaylistLoader_.mainXml_);if(i===null)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();if(i.method==="DIRECT")return this.mainPlaylistLoader_.clientOffset_=i.value-Date.now(),e();this.request=this.vhs_.xhr({uri:ln(this.mainPlaylistLoader_.srcUrl,i.value),method:i.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(r,o)=>{if(!this.request)return;if(r){const{requestType:c}=o;return this.error.metadata=No({requestType:c,request:o,error:r}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()}let u;i.method==="HEAD"?!o.responseHeaders||!o.responseHeaders.date?u=this.mainLoaded_:u=Date.parse(o.responseHeaders.date):u=Date.parse(o.responseText),this.mainPlaylistLoader_.clientOffset_=u-Date.now(),e()})}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){P.clearTimeout(this.mediaRequest_),this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main,i={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:i});let r;try{r=z4({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e})}catch(u){this.error=u,this.error.metadata={errorType:$.Error.StreamingDashManifestParserError,error:u},this.trigger("error")}e&&(r=q4(e,r,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=r||e;const o=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(o&&o!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=o),(!e||r&&r.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(r),r){const{duration:u,endList:c}=r,p=[];r.playlists.forEach(b=>{p.push({id:b.id,bandwidth:b.attributes.BANDWIDTH,resolution:b.attributes.RESOLUTION,codecs:b.attributes.CODECS})});const g={duration:u,isLive:!c,renditions:p};i.parsedManifest=g,this.trigger({type:"manifestparsecomplete",metadata:i})}return!!r}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(P.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let i=e.main&&e.main.minimumUpdatePeriod;if(i===0&&(e.media()?i=e.media().targetDuration*1e3:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),typeof i!="number"||i<=0){i<0&&this.logger_(`found invalid minimumUpdatePeriod of ${i}, not setting a timeout`);return}this.createMUPTimeout_(i)}createMUPTimeout_(e){const i=this.mainPlaylistLoader_;i.minimumUpdatePeriodTimeout_=P.setTimeout(()=>{i.minimumUpdatePeriodTimeout_=null,i.trigger("minimumUpdatePeriod"),i.createMUPTimeout_(e)},e)}refreshXml_(){this.requestMain_((e,i)=>{i&&(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=$4(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,r=>{this.refreshMedia_(this.media().id)}))})}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();const i=this.mainPlaylistLoader_.main.playlists,r=!this.media_||this.media_!==i[e];if(r?this.media_=i[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const o=()=>{this.media().endList||(this.mediaUpdateTimeout=P.setTimeout(()=>{this.trigger("mediaupdatetimeout"),o()},xy(this.media(),!!r)))};o()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){const i=this.mainPlaylistLoader_.main.eventStream.map(r=>({cueTime:r.start,frames:[{data:r.messageData}]}));this.addMetadataToTextTrack("EventStream",i,this.mainPlaylistLoader_.main.duration)}}getKeyIdSet(e){if(e.contentProtection){const i=new Set;for(const r in e.contentProtection){const o=e.contentProtection[r].attributes["cenc:default_KID"];o&&i.add(o.replace(/-/g,"").toLowerCase())}return i}}}var fi={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30};const G4=s=>{const e=new Uint8Array(new ArrayBuffer(s.length));for(let i=0;i=e})},Mp=function(s,e){return cS(s,function(i){return i-Fs>=e})},n4=function(s){if(s.length<2)return hi();const e=[];for(let i=1;i{const e=[];if(!s||!s.length)return"";for(let i=0;i "+s.end(i));return e.join(", ")},r4=function(s,e,i=1){return((s.length?s.end(s.length-1):0)-e)/i},Io=s=>{const e=[];for(let i=0;iu)){if(e>o&&e<=u){i+=u-e;continue}i+=u-o}}return i},yy=(s,e)=>{if(!e.preload)return e.duration;let i=0;return(e.parts||[]).forEach(function(r){i+=r.duration}),(e.preloadHints||[]).forEach(function(r){r.type==="PART"&&(i+=s.partTargetDuration)}),i},vy=s=>(s.segments||[]).reduce((e,i,r)=>(i.parts?i.parts.forEach(function(o,u){e.push({duration:o.duration,segmentIndex:r,partIndex:u,part:o,segment:i})}):e.push({duration:i.duration,segmentIndex:r,partIndex:null,segment:i,part:null}),e),[]),hS=s=>{const e=s.segments&&s.segments.length&&s.segments[s.segments.length-1];return e&&e.parts||[]},fS=({preloadSegment:s})=>{if(!s)return;const{parts:e,preloadHints:i}=s;let r=(i||[]).reduce((o,u)=>o+(u.type==="PART"?1:0),0);return r+=e&&e.length?e.length:0,r},pS=(s,e)=>{if(e.endList)return 0;if(s&&s.suggestedPresentationDelay)return s.suggestedPresentationDelay;const i=hS(e).length>0;return i&&e.serverControl&&e.serverControl.partHoldBack?e.serverControl.partHoldBack:i&&e.partTargetDuration?e.partTargetDuration*3:e.serverControl&&e.serverControl.holdBack?e.serverControl.holdBack:e.targetDuration?e.targetDuration*3:0},o4=function(s,e){let i=0,r=e-s.mediaSequence,o=s.segments[r];if(o){if(typeof o.start<"u")return{result:o.start,precise:!0};if(typeof o.end<"u")return{result:o.end-o.duration,precise:!0}}for(;r--;){if(o=s.segments[r],typeof o.end<"u")return{result:i+o.end,precise:!0};if(i+=yy(s,o),typeof o.start<"u")return{result:i+o.start,precise:!0}}return{result:i,precise:!1}},l4=function(s,e){let i=0,r,o=e-s.mediaSequence;for(;o"u"&&(e=s.mediaSequence+s.segments.length),e"u"){if(s.totalDuration)return s.totalDuration;if(!s.endList)return P.Infinity}return mS(s,e,i)},kd=function({defaultDuration:s,durationList:e,startIndex:i,endIndex:r}){let o=0;if(i>r&&([i,r]=[r,i]),i<0){for(let u=i;u0)for(let b=g-1;b>=0;b--){const S=p[b];if(c+=S.duration,u){if(c<0)continue}else if(c+Fs<=0)continue;return{partIndex:S.partIndex,segmentIndex:S.segmentIndex,startTime:o-kd({defaultDuration:s.targetDuration,durationList:p,startIndex:g,endIndex:b})}}return{partIndex:p[0]&&p[0].partIndex||null,segmentIndex:p[0]&&p[0].segmentIndex||0,startTime:e}}if(g<0){for(let b=g;b<0;b++)if(c-=s.targetDuration,c<0)return{partIndex:p[0]&&p[0].partIndex||null,segmentIndex:p[0]&&p[0].segmentIndex||0,startTime:e};g=0}for(let b=g;bFs,A=c===0,M=E&&c+Fs>=0;if(!((A||M)&&b!==p.length-1)){if(u){if(c>0)continue}else if(c-Fs>=0)continue;return{partIndex:S.partIndex,segmentIndex:S.segmentIndex,startTime:o+kd({defaultDuration:s.targetDuration,durationList:p,startIndex:g,endIndex:b})}}}return{segmentIndex:p[p.length-1].segmentIndex,partIndex:p[p.length-1].partIndex,startTime:e}},vS=function(s){return s.excludeUntil&&s.excludeUntil>Date.now()},by=function(s){return s.excludeUntil&&s.excludeUntil===1/0},Lp=function(s){const e=vS(s);return!s.disabled&&!e},d4=function(s){return s.disabled},h4=function(s){for(let e=0;e{if(s.playlists.length===1)return!0;const i=e.attributes.BANDWIDTH||Number.MAX_VALUE;return s.playlists.filter(r=>Lp(r)?(r.attributes.BANDWIDTH||0)!s&&!e||!s&&e||s&&!e?!1:!!(s===e||s.id&&e.id&&s.id===e.id||s.resolvedUri&&e.resolvedUri&&s.resolvedUri===e.resolvedUri||s.uri&&e.uri&&s.uri===e.uri),_S=function(s,e){const i=s&&s.mediaGroups&&s.mediaGroups.AUDIO||{};let r=!1;for(const o in i){for(const u in i[o])if(r=e(i[o][u]),r)break;if(r)break}return!!r},Od=s=>{if(!s||!s.playlists||!s.playlists.length)return _S(s,i=>i.playlists&&i.playlists.length||i.uri);for(let e=0;eiT(u))||_S(s,u=>Ty(i,u))))return!1}return!0};var un={liveEdgeDelay:pS,duration:gS,seekable:u4,getMediaInfoForTime:c4,isEnabled:Lp,isDisabled:d4,isExcluded:vS,isIncompatible:by,playlistEnd:yS,isAes:h4,hasAttribute:bS,estimateSegmentRequestTime:f4,isLowestEnabledRendition:_y,isAudioOnly:Od,playlistMatch:Ty,segmentDurationWithParts:yy};const{log:TS}=V,yu=(s,e)=>`${s}-${e}`,SS=(s,e,i)=>`placeholder-uri-${s}-${e}-${i}`,p4=({onwarn:s,oninfo:e,manifestString:i,customTagParsers:r=[],customTagMappers:o=[],llhls:u})=>{const c=new Nk;s&&c.on("warn",s),e&&c.on("info",e),r.forEach(b=>c.addParser(b)),o.forEach(b=>c.addTagMapper(b)),c.push(i),c.end();const p=c.manifest;if(u||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(b){p.hasOwnProperty(b)&&delete p[b]}),p.segments&&p.segments.forEach(function(b){["parts","preloadHints"].forEach(function(S){b.hasOwnProperty(S)&&delete b[S]})})),!p.targetDuration){let b=10;p.segments&&p.segments.length&&(b=p.segments.reduce((S,E)=>Math.max(S,E.duration),0)),s&&s({message:`manifest has no targetDuration defaulting to ${b}`}),p.targetDuration=b}const g=hS(p);if(g.length&&!p.partTargetDuration){const b=g.reduce((S,E)=>Math.max(S,E.duration),0);s&&(s({message:`manifest has no partTargetDuration defaulting to ${b}`}),TS.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),p.partTargetDuration=b}return p},vu=(s,e)=>{s.mediaGroups&&["AUDIO","SUBTITLES"].forEach(i=>{if(s.mediaGroups[i])for(const r in s.mediaGroups[i])for(const o in s.mediaGroups[i][r]){const u=s.mediaGroups[i][r][o];e(u,i,r,o)}})},xS=({playlist:s,uri:e,id:i})=>{s.id=i,s.playlistErrors_=0,e&&(s.uri=e),s.attributes=s.attributes||{}},m4=s=>{let e=s.playlists.length;for(;e--;){const i=s.playlists[e];xS({playlist:i,id:yu(e,i.uri)}),i.resolvedUri=ln(s.uri,i.uri),s.playlists[i.id]=i,s.playlists[i.uri]=i,i.attributes.BANDWIDTH||TS.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},g4=s=>{vu(s,e=>{e.uri&&(e.resolvedUri=ln(s.uri,e.uri))})},y4=(s,e)=>{const i=yu(0,e),r={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:P.location.href,resolvedUri:P.location.href,playlists:[{uri:e,id:i,resolvedUri:e,attributes:{}}]};return r.playlists[i]=r.playlists[0],r.playlists[e]=r.playlists[0],r},ES=(s,e,i=SS)=>{s.uri=e;for(let o=0;o{if(!o.playlists||!o.playlists.length){if(r&&u==="AUDIO"&&!o.uri)for(let g=0;g(o.set(u.id,u),o),new Map)}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(this.offset_===null)return[];const e={},i=[];this.pendingDateRanges_.forEach((r,o)=>{if(!this.processedDateRanges_.has(o)&&(r.startTime=r.startDate.getTime()/1e3-this.offset_,r.processDateRange=()=>this.processDateRange(r),i.push(r),!!r.class))if(e[r.class]){const u=e[r.class].push(r);r.classListIndex=u-1}else e[r.class]=[r],r.classListIndex=0});for(const r of i){const o=e[r.class]||[];r.endDate?r.endTime=r.endDate.getTime()/1e3-this.offset_:r.endOnNext&&o[r.classListIndex+1]?r.endTime=o[r.classListIndex+1].startTime:r.duration?r.endTime=r.startTime+r.duration:r.plannedDuration?r.endTime=r.startTime+r.plannedDuration:r.endTime=r.startTime}return i}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach((r,o)=>{r.startDate.getTime(){const o=e.status<200||e.status>299,u=e.status>=400&&e.status<=499,c={uri:e.uri,requestType:s},p=o&&!u||r;if(i&&u)c.error=Ft({},i),c.errorType=V.Error.NetworkRequestFailed;else if(e.aborted)c.errorType=V.Error.NetworkRequestAborted;else if(e.timedout)c.erroType=V.Error.NetworkRequestTimeout;else if(p){const g=r?V.Error.NetworkBodyParserFailed:V.Error.NetworkBadStatus;c.errorType=g,c.status=e.status,c.headers=e.headers}return c},v4=$n("CodecUtils"),DS=function(s){const e=s.attributes||{};if(e.CODECS)return Rs(e.CODECS)},wS=(s,e)=>{const i=e.attributes||{};return s&&s.mediaGroups&&s.mediaGroups.AUDIO&&i.AUDIO&&s.mediaGroups.AUDIO[i.AUDIO]},b4=(s,e)=>{if(!wS(s,e))return!0;const i=e.attributes||{},r=s.mediaGroups.AUDIO[i.AUDIO];for(const o in r)if(!r[o].uri&&!r[o].playlists)return!0;return!1},Rd=function(s){const e={};return s.forEach(({mediaType:i,type:r,details:o})=>{e[i]=e[i]||[],e[i].push(tT(`${r}${o}`))}),Object.keys(e).forEach(function(i){if(e[i].length>1){v4(`multiple ${i} codecs found as attributes: ${e[i].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`),e[i]=null;return}e[i]=e[i][0]}),e},kS=function(s){let e=0;return s.audio&&e++,s.video&&e++,e},Md=function(s,e){const i=e.attributes||{},r=Rd(DS(e)||[]);if(wS(s,e)&&!r.audio&&!b4(s,e)){const o=Rd(Uk(s,i.AUDIO)||[]);o.audio&&(r.audio=o.audio)}return r},{EventTarget:_4}=V,T4=(s,e)=>{if(e.endList||!e.serverControl)return s;const i={};if(e.serverControl.canBlockReload){const{preloadSegment:r}=e;let o=e.mediaSequence+e.segments.length;if(r){const u=r.parts||[],c=fS(e)-1;c>-1&&c!==u.length-1&&(i._HLS_part=c),(c>-1||u.length)&&o--}i._HLS_msn=o}if(e.serverControl&&e.serverControl.canSkipUntil&&(i._HLS_skip=e.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(i).length){const r=new P.URL(s);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(o){i.hasOwnProperty(o)&&r.searchParams.set(o,i[o])}),s=r.toString()}return s},S4=(s,e)=>{if(!s)return e;const i=pt(s,e);if(s.preloadHints&&!e.preloadHints&&delete i.preloadHints,s.parts&&!e.parts)delete i.parts;else if(s.parts&&e.parts)for(let r=0;r{const r=s.slice(),o=e.slice();i=i||0;const u=[];let c;for(let p=0;p{!s.resolvedUri&&s.uri&&(s.resolvedUri=ln(e,s.uri)),s.key&&!s.key.resolvedUri&&(s.key.resolvedUri=ln(e,s.key.uri)),s.map&&!s.map.resolvedUri&&(s.map.resolvedUri=ln(e,s.map.uri)),s.map&&s.map.key&&!s.map.key.resolvedUri&&(s.map.key.resolvedUri=ln(e,s.map.key.uri)),s.parts&&s.parts.length&&s.parts.forEach(i=>{i.resolvedUri||(i.resolvedUri=ln(e,i.uri))}),s.preloadHints&&s.preloadHints.length&&s.preloadHints.forEach(i=>{i.resolvedUri||(i.resolvedUri=ln(e,i.uri))})},RS=function(s){const e=s.segments||[],i=s.preloadSegment;if(i&&i.parts&&i.parts.length){if(i.preloadHints){for(let r=0;rs===e||s.segments&&e.segments&&s.segments.length===e.segments.length&&s.endList===e.endList&&s.mediaSequence===e.mediaSequence&&s.preloadSegment===e.preloadSegment,Sy=(s,e,i=MS)=>{const r=pt(s,{}),o=r.playlists[e.id];if(!o||i(o,e))return null;e.segments=RS(e);const u=pt(o,e);if(u.preloadSegment&&!e.preloadSegment&&delete u.preloadSegment,o.segments){if(e.skip){e.segments=e.segments||[];for(let c=0;c{OS(c,u.resolvedUri)});for(let c=0;c{if(c.playlists)for(let S=0;S{const i=s.segments||[],r=i[i.length-1],o=r&&r.parts&&r.parts[r.parts.length-1],u=o&&o.duration||r&&r.duration;return e&&u?u*1e3:(s.partTargetDuration||s.targetDuration||10)*500},LS=(s,e,i)=>{if(!s)return;const r=[];return s.forEach(o=>{if(!o.attributes)return;const{BANDWIDTH:u,RESOLUTION:c,CODECS:p}=o.attributes;r.push({id:o.id,bandwidth:u,resolution:c,codecs:p})}),{type:e,isLive:i,renditions:r}};class bu extends _4{constructor(e,i,r={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=$n("PlaylistLoader");const{withCredentials:o=!1}=r;this.src=e,this.vhs_=i,this.withCredentials=o,this.addDateRangesToTextTrack_=r.addDateRangesToTextTrack;const u=i.options_;this.customTagParsers=u&&u.customTagParsers||[],this.customTagMappers=u&&u.customTagMappers||[],this.llhls=u&&u.llhls,this.dateRangesStorage_=new CS,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){const e=this.media();if(!e)return;this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges);const i=this.dateRangesStorage_.getDateRangesToProcess();!i.length||!this.addDateRangesToTextTrack_||this.addDateRangesToTextTrack_(i)}handleMediaupdatetimeout_(){if(this.state!=="HAVE_METADATA")return;const e=this.media();let i=ln(this.main.uri,e.uri);this.llhls&&(i=T4(i,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:i,withCredentials:this.withCredentials,requestType:"hls-playlist"},(r,o)=>{if(this.request){if(r)return this.playlistRequestError(this.request,this.media(),"HAVE_METADATA");this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})}})}playlistRequestError(e,i,r){const{uri:o,id:u}=i;this.request=null,r&&(this.state=r),this.error={playlist:this.main.playlists[u],status:e.status,message:`HLS playlist request error at URL: ${o}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:No({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:i}){try{const r=p4({onwarn:({message:o})=>this.logger_(`m3u8-parser warn for ${e}: ${o}`),oninfo:({message:o})=>this.logger_(`m3u8-parser info for ${e}: ${o}`),manifestString:i,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls});return!r.playlists||!r.playlists.length||this.excludeAudioOnlyVariants(r.playlists),r}catch(r){this.error=r,this.error.metadata={errorType:V.Error.StreamingHlsPlaylistParserError,error:r}}}excludeAudioOnlyVariants(e){const i=r=>{const o=r.attributes||{},{width:u,height:c}=o.RESOLUTION||{};if(u&&c)return!0;const p=DS(r)||[];return!!Rd(p).video};e.some(i)&&e.forEach(r=>{i(r)||(r.excludeUntil=1/0)})}haveMetadata({playlistString:e,playlistObject:i,url:r,id:o}){this.request=null,this.state="HAVE_METADATA";const u={playlistInfo:{type:"media",uri:r}};this.trigger({type:"playlistparsestart",metadata:u});const c=i||this.parseManifest_({url:r,manifestString:e});c.lastRequest=Date.now(),xS({playlist:c,uri:r,id:o});const p=Sy(this.main,c);this.targetDuration=c.partTargetDuration||c.targetDuration,this.pendingMedia_=null,p?(this.main=p,this.media_=this.main.playlists[o]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(xy(this.media(),!!p)),u.parsedPlaylist=LS(this.main.playlists,u.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:u}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),P.clearTimeout(this.mediaUpdateTimeout),P.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new CS,this.off()}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e,i){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);if(typeof e=="string"){if(!this.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.main.playlists[e]}if(P.clearTimeout(this.finalRenditionTimeout),i){const p=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=P.setTimeout(this.media.bind(this,e,!1),p);return}const r=this.state,o=!this.media_||e.id!==this.media_.id,u=this.main.playlists[e.id];if(u&&u.endList||e.endList&&e.segments.length){this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,o&&(this.trigger("mediachanging"),r==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_(xy(e,!0)),!o)return;if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e;const c={playlistInfo:{type:"media",uri:e.uri}};this.trigger({type:"playlistrequeststart",metadata:c}),this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials,requestType:"hls-playlist"},(p,g)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=Rp(e.resolvedUri,g),p)return this.playlistRequestError(this.request,e,r);this.trigger({type:"playlistrequestcomplete",metadata:c}),this.haveMetadata({playlistString:g.responseText,url:e.uri,id:e.id}),r==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}pause(){this.mediaUpdateTimeout&&(P.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),this.state==="HAVE_NOTHING"&&(this.started=!1),this.state==="SWITCHING_MEDIA"?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":this.state==="HAVE_CURRENT_METADATA"&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(P.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const i=this.media();if(e){const r=i?(i.partTargetDuration||i.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=P.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},r);return}if(!this.started){this.start();return}i&&!i.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(P.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=P.setTimeout(()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)},e))}start(){if(this.started=!0,typeof this.src=="object"){this.src.uri||(this.src.uri=P.location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0);return}const e={playlistInfo:{type:"multivariant",uri:this.src}};this.trigger({type:"playlistrequeststart",metadata:e}),this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials,requestType:"hls-playlist"},(i,r)=>{if(!this.request)return;if(this.request=null,i)return this.error={status:r.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:r.responseText,code:2,metadata:No({requestType:r.requestType,request:r,error:i})},this.state==="HAVE_NOTHING"&&(this.started=!1),this.trigger("error");this.trigger({type:"playlistrequestcomplete",metadata:e}),this.src=Rp(this.src,r),this.trigger({type:"playlistparsestart",metadata:e});const o=this.parseManifest_({manifestString:r.responseText,url:this.src});e.parsedPlaylist=LS(o.playlists,e.playlistInfo.type,!1),this.trigger({type:"playlistparsecomplete",metadata:e}),this.setupInitialPlaylist(o)})}srcUri(){return typeof this.src=="string"?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists){this.main=e,ES(this.main,this.srcUri()),e.playlists.forEach(r=>{r.segments=RS(r),r.segments.forEach(o=>{OS(o,r.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const i=this.srcUri()||P.location.href;this.main=y4(e,i),this.haveMetadata({playlistObject:e,url:i,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,i){const r=this.main,o=e.ID;let u=r.playlists.length;for(;u--;){const c=r.playlists[u];if(c.attributes["PATHWAY-ID"]===o){const p=c.resolvedUri,g=c.id;if(i){const b=this.createCloneURI_(c.resolvedUri,e),S=yu(o,b),E=this.createCloneAttributes_(o,c.attributes),A=this.createClonePlaylist_(c,S,e,E);r.playlists[u]=A,r.playlists[S]=A,r.playlists[b]=A}else r.playlists.splice(u,1);delete r.playlists[g],delete r.playlists[p]}}this.updateOrDeleteCloneMedia(e,i)}updateOrDeleteCloneMedia(e,i){const r=this.main,o=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(u=>{if(!(!r.mediaGroups[u]||!r.mediaGroups[u][o])){for(const c in r.mediaGroups[u])if(c===o){for(const p in r.mediaGroups[u][c])r.mediaGroups[u][c][p].playlists.forEach((b,S)=>{const E=r.playlists[b.id],A=E.id,M=E.resolvedUri;delete r.playlists[A],delete r.playlists[M]});delete r.mediaGroups[u][c]}}}),i&&this.createClonedMediaGroups_(e)}addClonePathway(e,i={}){const r=this.main,o=r.playlists.length,u=this.createCloneURI_(i.resolvedUri,e),c=yu(e.ID,u),p=this.createCloneAttributes_(e.ID,i.attributes),g=this.createClonePlaylist_(i,c,e,p);r.playlists[o]=g,r.playlists[c]=g,r.playlists[u]=g,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){const i=e.ID,r=e["BASE-ID"],o=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(u=>{if(!(!o.mediaGroups[u]||o.mediaGroups[u][i]))for(const c in o.mediaGroups[u]){if(c===r)o.mediaGroups[u][i]={};else continue;for(const p in o.mediaGroups[u][c]){const g=o.mediaGroups[u][c][p];o.mediaGroups[u][i][p]=Ft({},g);const b=o.mediaGroups[u][i][p],S=this.createCloneURI_(g.resolvedUri,e);b.resolvedUri=S,b.uri=S,b.playlists=[],g.playlists.forEach((E,A)=>{const M=o.playlists[E.id],U=SS(u,i,p),D=yu(i,U);if(M&&!o.playlists[D]){const z=this.createClonePlaylist_(M,D,e),H=z.resolvedUri;o.playlists[D]=z,o.playlists[H]=z}b.playlists[A]=this.createClonePlaylist_(E,D,e)})}}})}createClonePlaylist_(e,i,r,o){const u=this.createCloneURI_(e.resolvedUri,r),c={resolvedUri:u,uri:u,id:i};return e.segments&&(c.segments=[]),o&&(c.attributes=o),pt(e,c)}createCloneURI_(e,i){const r=new URL(e);r.hostname=i["URI-REPLACEMENT"].HOST;const o=i["URI-REPLACEMENT"].PARAMS;for(const u of Object.keys(o))r.searchParams.set(u,o[u]);return r.href}createCloneAttributes_(e,i){const r={"PATHWAY-ID":e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(o=>{i[o]&&(r[o]=e)}),r}getKeyIdSet(e){if(e.contentProtection){const i=new Set;for(const r in e.contentProtection){const o=e.contentProtection[r].attributes.keyId;o&&i.add(o.toLowerCase())}return i}}}const Ey=function(s,e,i,r){const o=s.responseType==="arraybuffer"?s.response:s.responseText;!e&&o&&(s.responseTime=Date.now(),s.roundTripTime=s.responseTime-s.requestTime,s.bytesReceived=o.byteLength||o.length,s.bandwidth||(s.bandwidth=Math.floor(s.bytesReceived/s.roundTripTime*8*1e3))),i.headers&&(s.responseHeaders=i.headers),e&&e.code==="ETIMEDOUT"&&(s.timedout=!0),!e&&!s.aborted&&i.statusCode!==200&&i.statusCode!==206&&i.statusCode!==0&&(e=new Error("XHR Failed with a response of: "+(s&&(o||s.responseText)))),r(e,s)},E4=(s,e)=>{if(!s||!s.size)return;let i=e;return s.forEach(r=>{i=r(i)}),i},C4=(s,e,i,r)=>{!s||!s.size||s.forEach(o=>{o(e,i,r)})},IS=function(){const s=function e(i,r){i=pt({timeout:45e3},i);const o=e.beforeRequest||V.Vhs.xhr.beforeRequest,u=e._requestCallbackSet||V.Vhs.xhr._requestCallbackSet||new Set,c=e._responseCallbackSet||V.Vhs.xhr._responseCallbackSet;o&&typeof o=="function"&&(V.log.warn("beforeRequest is deprecated, use onRequest instead."),u.add(o));const p=V.Vhs.xhr.original===!0?V.xhr:V.Vhs.xhr,g=E4(u,i);u.delete(o);const b=p(g||i,function(E,A){return C4(c,b,E,A),Ey(b,E,A,r)}),S=b.abort;return b.abort=function(){return b.aborted=!0,S.apply(b,arguments)},b.uri=i.uri,b.requestType=i.requestType,b.requestTime=Date.now(),b};return s.original=!0,s},A4=function(s){let e;const i=s.offset;return typeof s.offset=="bigint"||typeof s.length=="bigint"?e=P.BigInt(s.offset)+P.BigInt(s.length)-P.BigInt(1):e=s.offset+s.length-1,"bytes="+i+"-"+e},Cy=function(s){const e={};return s.byterange&&(e.Range=A4(s.byterange)),e},D4=function(s,e){return s.start(e)+"-"+s.end(e)},w4=function(s,e){const i=s.toString(16);return"00".substring(0,2-i.length)+i+(e%2?" ":"")},k4=function(s){return s>=32&&s<126?String.fromCharCode(s):"."},NS=function(s){const e={};return Object.keys(s).forEach(i=>{const r=s[i];rT(r)?e[i]={bytes:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}:e[i]=r}),e},Ip=function(s){const e=s.byterange||{length:1/0,offset:0};return[e.length,e.offset,s.resolvedUri].join(",")},PS=function(s){return s.resolvedUri},US=s=>{const e=Array.prototype.slice.call(s),i=16;let r="",o,u;for(let c=0;cUS(s),textRanges:s=>{let e="",i;for(i=0;i{if(!e.dateTimeObject)return null;const i=e.videoTimingInfo.transmuxerPrependedSeconds,o=e.videoTimingInfo.transmuxedPresentationStart+i,u=s-o;return new Date(e.dateTimeObject.getTime()+u*1e3)},M4=s=>s.transmuxedPresentationEnd-s.transmuxedPresentationStart-s.transmuxerPrependedSeconds,L4=(s,e)=>{let i;try{i=new Date(s)}catch{return null}if(!e||!e.segments||e.segments.length===0)return null;let r=e.segments[0];if(ip?null:(i>new Date(u)&&(r=o),{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:un.duration(e,e.mediaSequence+e.segments.indexOf(r)),type:r.videoTimingInfo?"accurate":"estimate"})},I4=(s,e)=>{if(!e||!e.segments||e.segments.length===0)return null;let i=0,r;for(let u=0;ui){if(s>i+o.duration*BS)return null;r=o}return{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:i-r.duration,type:r.videoTimingInfo?"accurate":"estimate"}},N4=(s,e)=>{let i,r;try{i=new Date(s),r=new Date(e)}catch{}const o=i.getTime();return(r.getTime()-o)/1e3},P4=s=>{if(!s.segments||s.segments.length===0)return!1;for(let e=0;e{if(!i)throw new Error("getProgramTime: callback must be provided");if(!s||e===void 0)return i({message:"getProgramTime: playlist and time must be provided"});const r=I4(e,s);if(!r)return i({message:"valid programTime was not found"});if(r.type==="estimate")return i({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:r.estimatedStart});const o={mediaSeconds:e},u=R4(e,r.segment);return u&&(o.programDateTime=u.toISOString()),i(null,o)},FS=({programTime:s,playlist:e,retryCount:i=2,seekTo:r,pauseAfterSeek:o=!0,tech:u,callback:c})=>{if(!c)throw new Error("seekToProgramTime: callback must be provided");if(typeof s>"u"||!e||!r)return c({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!e.endList&&!u.hasStarted_)return c({message:"player must be playing a live stream to start buffering"});if(!P4(e))return c({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const p=L4(s,e);if(!p)return c({message:`${s} was not found in the stream`});const g=p.segment,b=N4(g.dateTimeObject,s);if(p.type==="estimate"){if(i===0)return c({message:`${s} is not buffered yet. Try again`});r(p.estimatedStart+b),u.one("seeked",()=>{FS({programTime:s,playlist:e,retryCount:i-1,seekTo:r,pauseAfterSeek:o,tech:u,callback:c})});return}const S=g.start+b,E=()=>c(null,u.currentTime());u.one("seeked",E),o&&u.pause(),r(S)},Ay=(s,e)=>{if(s.readyState===4)return e()},B4=(s,e,i,r)=>{let o=[],u,c=!1;const p=function(E,A,M,U){return A.abort(),c=!0,i(E,A,M,U)},g=function(E,A){if(c)return;if(E)return E.metadata=No({requestType:r,request:A,error:E}),p(E,A,"",o);const M=A.responseText.substring(o&&o.byteLength||0,A.responseText.length);if(o=Xk(o,aT(M,!0)),u=u||md(o),o.length<10||u&&o.lengthp(E,A,"",o));const U=m0(o);return U==="ts"&&o.length<188?Ay(A,()=>p(E,A,"",o)):!U&&o.length<376?Ay(A,()=>p(E,A,"",o)):p(null,A,U,o)},S=e({uri:s,beforeSend(E){E.overrideMimeType("text/plain; charset=x-user-defined"),E.addEventListener("progress",function({total:A,loaded:M}){return Ey(E,null,{statusCode:E.status},g)})}},function(E,A){return Ey(S,E,A,g)});return S},{EventTarget:F4}=V,HS=function(s,e){if(!MS(s,e)||s.sidx&&e.sidx&&(s.sidx.offset!==e.sidx.offset||s.sidx.length!==e.sidx.length))return!1;if(!s.sidx&&e.sidx||s.sidx&&!e.sidx||s.segments&&!e.segments||!s.segments&&e.segments)return!1;if(!s.segments&&!e.segments)return!0;for(let i=0;i{const o=r.attributes.NAME||i;return`placeholder-uri-${s}-${e}-${o}`},z4=({mainXml:s,srcUrl:e,clientOffset:i,sidxMapping:r,previousManifest:o})=>{const u=pR(s,{manifestUri:e,clientOffset:i,sidxMapping:r,previousManifest:o});return ES(u,e,H4),u},j4=(s,e)=>{vu(s,(i,r,o,u)=>{(!e.mediaGroups[r][o]||!(u in e.mediaGroups[r][o]))&&delete s.mediaGroups[r][o][u]})},q4=(s,e,i)=>{let r=!0,o=pt(s,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod,timelineStarts:e.timelineStarts});for(let u=0;u{if(u.playlists&&u.playlists.length){const b=u.playlists[0].id,S=Sy(o,u.playlists[0],HS);S&&(o=S,g in o.mediaGroups[c][p]||(o.mediaGroups[c][p][g]=u),o.mediaGroups[c][p][g].playlists[0]=o.playlists[b],r=!1)}}),j4(o,e),e.minimumUpdatePeriod!==s.minimumUpdatePeriod&&(r=!1),r?null:o},V4=(s,e)=>(!s.map&&!e.map||!!(s.map&&e.map&&s.map.byterange.offset===e.map.byterange.offset&&s.map.byterange.length===e.map.byterange.length))&&s.uri===e.uri&&s.byterange.offset===e.byterange.offset&&s.byterange.length===e.byterange.length,zS=(s,e)=>{const i={};for(const r in s){const u=s[r].sidx;if(u){const c=$f(u);if(!e[c])break;const p=e[c].sidxInfo;V4(p,u)&&(i[c]=e[c])}}return i},$4=(s,e)=>{let r=zS(s.playlists,e);return vu(s,(o,u,c,p)=>{if(o.playlists&&o.playlists.length){const g=o.playlists;r=pt(r,zS(g,e))}}),r};class Dy extends F4{constructor(e,i,r={},o){super(),this.isPaused_=!0,this.mainPlaylistLoader_=o||this,o||(this.isMain_=!0);const{withCredentials:u=!1}=r;if(this.vhs_=i,this.withCredentials=u,this.addMetadataToTextTrack=r.addMetadataToTextTrack,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=$n("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}get isPaused(){return this.isPaused_}requestErrored_(e,i,r){if(!this.request)return!0;if(this.request=null,e)return this.error=typeof e=="object"&&!(e instanceof Error)?e:{status:i.status,message:"DASH request error at URL: "+i.uri,response:i.response,code:2,metadata:e.metadata},r&&(this.state=r),this.trigger("error"),!0}addSidxSegments_(e,i,r){const o=e.sidx&&$f(e.sidx);if(!e.sidx||!o||this.mainPlaylistLoader_.sidxMapping_[o]){P.clearTimeout(this.mediaRequest_),this.mediaRequest_=P.setTimeout(()=>r(!1),0);return}const u=Rp(e.sidx.resolvedUri),c=(g,b)=>{if(this.requestErrored_(g,b,i))return;const S=this.mainPlaylistLoader_.sidxMapping_,{requestType:E}=b;let A;try{A=_R(Ie(b.response).subarray(8))}catch(M){M.metadata=No({requestType:E,request:b,parseFailure:!0}),this.requestErrored_(M,b,i);return}return S[o]={sidxInfo:e.sidx,sidx:A},u0(e,A,e.sidx.resolvedUri),r(!0)},p="dash-sidx";this.request=B4(u,this.vhs_.xhr,(g,b,S,E)=>{if(g)return c(g,b);if(!S||S!=="mp4"){const U=S||"unknown";return c({status:b.status,message:`Unsupported ${U} container type for sidx segment at URL: ${u}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},b)}const{offset:A,length:M}=e.sidx.byterange;if(E.length>=M+A)return c(g,{response:E.subarray(A,A+M),status:b.status,uri:b.uri});this.request=this.vhs_.xhr({uri:u,responseType:"arraybuffer",requestType:"dash-sidx",headers:Cy({byterange:e.sidx.byterange})},c)},p)}dispose(){this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},P.clearTimeout(this.minimumUpdatePeriodTimeout_),P.clearTimeout(this.mediaRequest_),P.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);const i=this.state;if(typeof e=="string"){if(!this.mainPlaylistLoader_.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}const r=!this.media_||e.id!==this.media_.id;if(r&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){this.state="HAVE_METADATA",this.media_=e,r&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}r&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,i,o=>{this.haveMetadata({startingState:i,playlist:e})}))}haveMetadata({startingState:e,playlist:i}){this.state="HAVE_METADATA",this.loadedPlaylists_[i.id]=i,P.clearTimeout(this.mediaRequest_),this.mediaRequest_=null,this.refreshMedia_(i.id),e==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.isPaused_=!0,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),P.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(P.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){this.isPaused_=!1,P.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const i=this.media();if(e){const r=i?i.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=P.setTimeout(()=>this.load(),r);return}if(!this.started){this.start();return}i&&!i.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist")}start(){if(this.started=!0,!this.isMain_){P.clearTimeout(this.mediaRequest_),this.mediaRequest_=P.setTimeout(()=>this.haveMain_(),0);return}this.requestMain_((e,i)=>{this.haveMain_(),!this.hasPendingRequest()&&!this.media_&&this.media(this.mainPlaylistLoader_.main.playlists[0])})}requestMain_(e){const i={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestrequeststart",metadata:i}),this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},(r,o)=>{if(r){const{requestType:c}=o;r.metadata=No({requestType:c,request:o,error:r})}if(this.requestErrored_(r,o)){this.state==="HAVE_NOTHING"&&(this.started=!1);return}this.trigger({type:"manifestrequestcomplete",metadata:i});const u=o.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=o.responseText,o.responseHeaders&&o.responseHeaders.date?this.mainLoaded_=Date.parse(o.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=Rp(this.mainPlaylistLoader_.srcUrl,o),u){this.handleMain_(),this.syncClientServerClock_(()=>e(o,u));return}return e(o,u)})}syncClientServerClock_(e){const i=mR(this.mainPlaylistLoader_.mainXml_);if(i===null)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();if(i.method==="DIRECT")return this.mainPlaylistLoader_.clientOffset_=i.value-Date.now(),e();this.request=this.vhs_.xhr({uri:ln(this.mainPlaylistLoader_.srcUrl,i.value),method:i.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(r,o)=>{if(!this.request)return;if(r){const{requestType:c}=o;return this.error.metadata=No({requestType:c,request:o,error:r}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()}let u;i.method==="HEAD"?!o.responseHeaders||!o.responseHeaders.date?u=this.mainLoaded_:u=Date.parse(o.responseHeaders.date):u=Date.parse(o.responseText),this.mainPlaylistLoader_.clientOffset_=u-Date.now(),e()})}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){P.clearTimeout(this.mediaRequest_),this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main,i={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:i});let r;try{r=z4({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e})}catch(u){this.error=u,this.error.metadata={errorType:V.Error.StreamingDashManifestParserError,error:u},this.trigger("error")}e&&(r=q4(e,r,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=r||e;const o=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(o&&o!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=o),(!e||r&&r.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(r),r){const{duration:u,endList:c}=r,p=[];r.playlists.forEach(b=>{p.push({id:b.id,bandwidth:b.attributes.BANDWIDTH,resolution:b.attributes.RESOLUTION,codecs:b.attributes.CODECS})});const g={duration:u,isLive:!c,renditions:p};i.parsedManifest=g,this.trigger({type:"manifestparsecomplete",metadata:i})}return!!r}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(P.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let i=e.main&&e.main.minimumUpdatePeriod;if(i===0&&(e.media()?i=e.media().targetDuration*1e3:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),typeof i!="number"||i<=0){i<0&&this.logger_(`found invalid minimumUpdatePeriod of ${i}, not setting a timeout`);return}this.createMUPTimeout_(i)}createMUPTimeout_(e){const i=this.mainPlaylistLoader_;i.minimumUpdatePeriodTimeout_=P.setTimeout(()=>{i.minimumUpdatePeriodTimeout_=null,i.trigger("minimumUpdatePeriod"),i.createMUPTimeout_(e)},e)}refreshXml_(){this.requestMain_((e,i)=>{i&&(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=$4(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,r=>{this.refreshMedia_(this.media().id)}))})}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();const i=this.mainPlaylistLoader_.main.playlists,r=!this.media_||this.media_!==i[e];if(r?this.media_=i[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const o=()=>{this.media().endList||(this.mediaUpdateTimeout=P.setTimeout(()=>{this.trigger("mediaupdatetimeout"),o()},xy(this.media(),!!r)))};o()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){const i=this.mainPlaylistLoader_.main.eventStream.map(r=>({cueTime:r.start,frames:[{data:r.messageData}]}));this.addMetadataToTextTrack("EventStream",i,this.mainPlaylistLoader_.main.duration)}}getKeyIdSet(e){if(e.contentProtection){const i=new Set;for(const r in e.contentProtection){const o=e.contentProtection[r].attributes["cenc:default_KID"];o&&i.add(o.replace(/-/g,"").toLowerCase())}return i}}}var fi={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30};const G4=s=>{const e=new Uint8Array(new ArrayBuffer(s.length));for(let i=0;i-1):!1},this.trigger=function(m){var y,v,_,x;if(y=h[m],!!y)if(arguments.length===2)for(_=y.length,v=0;v<_;++v)y[v].call(this,arguments[1]);else{for(x=[],v=arguments.length,v=1;v"u")){for(h in ve)ve.hasOwnProperty(h)&&(ve[h]=[h.charCodeAt(0),h.charCodeAt(1),h.charCodeAt(2),h.charCodeAt(3)]);Ne=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),de=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),at=new Uint8Array([0,0,0,1]),Ee=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),Re=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),Ye={video:Ee,audio:Re},Ae=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),Me=new Uint8Array([0,0,0,0,0,0,0,0]),rt=new Uint8Array([0,0,0,0,0,0,0,0]),xt=rt,Ut=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),nt=rt,le=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),p=function(h){var m=[],y=0,v,_,x;for(v=1;v>>1,h.samplingfrequencyindex<<7|h.channelcount<<3,6,1,2]))},S=function(){return p(ve.ftyp,Ne,at,Ne,de)},W=function(h){return p(ve.hdlr,Ye[h])},E=function(h){return p(ve.mdat,h)},Z=function(h){var m=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,h.duration>>>24&255,h.duration>>>16&255,h.duration>>>8&255,h.duration&255,85,196,0,0]);return h.samplerate&&(m[12]=h.samplerate>>>24&255,m[13]=h.samplerate>>>16&255,m[14]=h.samplerate>>>8&255,m[15]=h.samplerate&255),p(ve.mdhd,m)},Q=function(h){return p(ve.mdia,Z(h),W(h.type),M(h))},A=function(h){return p(ve.mfhd,new Uint8Array([0,0,0,0,(h&4278190080)>>24,(h&16711680)>>16,(h&65280)>>8,h&255]))},M=function(h){return p(ve.minf,h.type==="video"?p(ve.vmhd,le):p(ve.smhd,Me),g(),ee(h))},U=function(h,m){for(var y=[],v=m.length;v--;)y[v]=_e(m[v]);return p.apply(null,[ve.moof,A(h)].concat(y))},D=function(h){for(var m=h.length,y=[];m--;)y[m]=Y(h[m]);return p.apply(null,[ve.moov,H(4294967295)].concat(y).concat(z(h)))},z=function(h){for(var m=h.length,y=[];m--;)y[m]=fe(h[m]);return p.apply(null,[ve.mvex].concat(y))},H=function(h){var m=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(h&4278190080)>>24,(h&16711680)>>16,(h&65280)>>8,h&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return p(ve.mvhd,m)},G=function(h){var m=h.samples||[],y=new Uint8Array(4+m.length),v,_;for(_=0;_>>8),x.push(v[R].byteLength&255),x=x.concat(Array.prototype.slice.call(v[R]));for(R=0;R<_.length;R++)k.push((_[R].byteLength&65280)>>>8),k.push(_[R].byteLength&255),k=k.concat(Array.prototype.slice.call(_[R]));if(I=[ve.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(y.width&65280)>>8,y.width&255,(y.height&65280)>>8,y.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),p(ve.avcC,new Uint8Array([1,y.profileIdc,y.profileCompatibility,y.levelIdc,255].concat([v.length],x,[_.length],k))),p(ve.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],y.sarRatio){var N=y.sarRatio[0],j=y.sarRatio[1];I.push(p(ve.pasp,new Uint8Array([(N&4278190080)>>24,(N&16711680)>>16,(N&65280)>>8,N&255,(j&4278190080)>>24,(j&16711680)>>16,(j&65280)>>8,j&255])))}return p.apply(null,I)},m=function(y){return p(ve.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(y.channelcount&65280)>>8,y.channelcount&255,(y.samplesize&65280)>>8,y.samplesize&255,0,0,0,0,(y.samplerate&65280)>>8,y.samplerate&255,0,0]),b(y))}}(),V=function(h){var m=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(h.id&4278190080)>>24,(h.id&16711680)>>16,(h.id&65280)>>8,h.id&255,0,0,0,0,(h.duration&4278190080)>>24,(h.duration&16711680)>>16,(h.duration&65280)>>8,h.duration&255,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(h.width&65280)>>8,h.width&255,0,0,(h.height&65280)>>8,h.height&255,0,0]);return p(ve.tkhd,m)},_e=function(h){var m,y,v,_,x,k,R;return m=p(ve.tfhd,new Uint8Array([0,0,0,58,(h.id&4278190080)>>24,(h.id&16711680)>>16,(h.id&65280)>>8,h.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),k=Math.floor(h.baseMediaDecodeTime/c),R=Math.floor(h.baseMediaDecodeTime%c),y=p(ve.tfdt,new Uint8Array([1,0,0,0,k>>>24&255,k>>>16&255,k>>>8&255,k&255,R>>>24&255,R>>>16&255,R>>>8&255,R&255])),x=32+20+8+16+8+8,h.type==="audio"?(v=xe(h,x),p(ve.traf,m,y,v)):(_=G(h),v=xe(h,_.length+x),p(ve.traf,m,y,v,_))},Y=function(h){return h.duration=h.duration||4294967295,p(ve.trak,V(h),Q(h))},fe=function(h){var m=new Uint8Array([0,0,0,0,(h.id&4278190080)>>24,(h.id&16711680)>>16,(h.id&65280)>>8,h.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return h.type!=="video"&&(m[m.length-1]=0),p(ve.trex,m)},function(){var h,m,y;y=function(v,_){var x=0,k=0,R=0,I=0;return v.length&&(v[0].duration!==void 0&&(x=1),v[0].size!==void 0&&(k=2),v[0].flags!==void 0&&(R=4),v[0].compositionTimeOffset!==void 0&&(I=8)),[0,0,x|k|R|I,1,(v.length&4278190080)>>>24,(v.length&16711680)>>>16,(v.length&65280)>>>8,v.length&255,(_&4278190080)>>>24,(_&16711680)>>>16,(_&65280)>>>8,_&255]},m=function(v,_){var x,k,R,I,N,j;for(I=v.samples||[],_+=8+12+16*I.length,R=y(I,_),k=new Uint8Array(R.length+I.length*16),k.set(R),x=R.length,j=0;j>>24,k[x++]=(N.duration&16711680)>>>16,k[x++]=(N.duration&65280)>>>8,k[x++]=N.duration&255,k[x++]=(N.size&4278190080)>>>24,k[x++]=(N.size&16711680)>>>16,k[x++]=(N.size&65280)>>>8,k[x++]=N.size&255,k[x++]=N.flags.isLeading<<2|N.flags.dependsOn,k[x++]=N.flags.isDependedOn<<6|N.flags.hasRedundancy<<4|N.flags.paddingValue<<1|N.flags.isNonSyncSample,k[x++]=N.flags.degradationPriority&61440,k[x++]=N.flags.degradationPriority&15,k[x++]=(N.compositionTimeOffset&4278190080)>>>24,k[x++]=(N.compositionTimeOffset&16711680)>>>16,k[x++]=(N.compositionTimeOffset&65280)>>>8,k[x++]=N.compositionTimeOffset&255;return p(ve.trun,k)},h=function(v,_){var x,k,R,I,N,j;for(I=v.samples||[],_+=8+12+8*I.length,R=y(I,_),x=new Uint8Array(R.length+I.length*8),x.set(R),k=R.length,j=0;j>>24,x[k++]=(N.duration&16711680)>>>16,x[k++]=(N.duration&65280)>>>8,x[k++]=N.duration&255,x[k++]=(N.size&4278190080)>>>24,x[k++]=(N.size&16711680)>>>16,x[k++]=(N.size&65280)>>>8,x[k++]=N.size&255;return p(ve.trun,x)},xe=function(v,_){return v.type==="audio"?h(v,_):m(v,_)}}();var Lr={ftyp:S,mdat:E,moof:U,moov:D,initSegment:function(h){var m=S(),y=D(h),v;return v=new Uint8Array(m.byteLength+y.byteLength),v.set(m),v.set(y,m.byteLength),v}},Rt=function(h){var m,y,v=[],_=[];for(_.byteLength=0,_.nalCount=0,_.duration=0,v.byteLength=0,m=0;m1&&(m=h.shift(),h.byteLength-=m.byteLength,h.nalCount-=m.nalCount,h[0][0].dts=m.dts,h[0][0].pts=m.pts,h[0][0].duration+=m.duration),h},Ir=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},Ra=function(h,m){var y=Ir();return y.dataOffset=m,y.compositionTimeOffset=h.pts-h.dts,y.duration=h.duration,y.size=4*h.length,y.size+=h.byteLength,h.keyFrame&&(y.flags.dependsOn=2,y.flags.isNonSyncSample=0),y},qs=function(h,m){var y,v,_,x,k,R=m||0,I=[];for(y=0;yUi.ONE_SECOND_IN_TS/2))){for(N=Xs()[h.samplerate],N||(N=m[0].data),j=0;j=y?h:(m.minSegmentDts=1/0,h.filter(function(v){return v.dts>=y?(m.minSegmentDts=Math.min(m.minSegmentDts,v.dts),m.minSegmentPts=m.minSegmentDts,!0):!1}))},X=function(h){var m,y,v=[];for(m=0;m-1):!1},this.trigger=function(m){var y,v,_,x;if(y=h[m],!!y)if(arguments.length===2)for(_=y.length,v=0;v<_;++v)y[v].call(this,arguments[1]);else{for(x=[],v=arguments.length,v=1;v"u")){for(h in ve)ve.hasOwnProperty(h)&&(ve[h]=[h.charCodeAt(0),h.charCodeAt(1),h.charCodeAt(2),h.charCodeAt(3)]);Ne=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),de=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),at=new Uint8Array([0,0,0,1]),Ee=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),Re=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),Ye={video:Ee,audio:Re},Ae=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),Me=new Uint8Array([0,0,0,0,0,0,0,0]),rt=new Uint8Array([0,0,0,0,0,0,0,0]),xt=rt,Ut=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),nt=rt,le=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),p=function(h){var m=[],y=0,v,_,x;for(v=1;v>>1,h.samplingfrequencyindex<<7|h.channelcount<<3,6,1,2]))},S=function(){return p(ve.ftyp,Ne,at,Ne,de)},W=function(h){return p(ve.hdlr,Ye[h])},E=function(h){return p(ve.mdat,h)},Z=function(h){var m=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,h.duration>>>24&255,h.duration>>>16&255,h.duration>>>8&255,h.duration&255,85,196,0,0]);return h.samplerate&&(m[12]=h.samplerate>>>24&255,m[13]=h.samplerate>>>16&255,m[14]=h.samplerate>>>8&255,m[15]=h.samplerate&255),p(ve.mdhd,m)},Q=function(h){return p(ve.mdia,Z(h),W(h.type),M(h))},A=function(h){return p(ve.mfhd,new Uint8Array([0,0,0,0,(h&4278190080)>>24,(h&16711680)>>16,(h&65280)>>8,h&255]))},M=function(h){return p(ve.minf,h.type==="video"?p(ve.vmhd,le):p(ve.smhd,Me),g(),ee(h))},U=function(h,m){for(var y=[],v=m.length;v--;)y[v]=_e(m[v]);return p.apply(null,[ve.moof,A(h)].concat(y))},D=function(h){for(var m=h.length,y=[];m--;)y[m]=Y(h[m]);return p.apply(null,[ve.moov,H(4294967295)].concat(y).concat(z(h)))},z=function(h){for(var m=h.length,y=[];m--;)y[m]=fe(h[m]);return p.apply(null,[ve.mvex].concat(y))},H=function(h){var m=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(h&4278190080)>>24,(h&16711680)>>16,(h&65280)>>8,h&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return p(ve.mvhd,m)},G=function(h){var m=h.samples||[],y=new Uint8Array(4+m.length),v,_;for(_=0;_>>8),x.push(v[R].byteLength&255),x=x.concat(Array.prototype.slice.call(v[R]));for(R=0;R<_.length;R++)k.push((_[R].byteLength&65280)>>>8),k.push(_[R].byteLength&255),k=k.concat(Array.prototype.slice.call(_[R]));if(I=[ve.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(y.width&65280)>>8,y.width&255,(y.height&65280)>>8,y.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),p(ve.avcC,new Uint8Array([1,y.profileIdc,y.profileCompatibility,y.levelIdc,255].concat([v.length],x,[_.length],k))),p(ve.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],y.sarRatio){var N=y.sarRatio[0],j=y.sarRatio[1];I.push(p(ve.pasp,new Uint8Array([(N&4278190080)>>24,(N&16711680)>>16,(N&65280)>>8,N&255,(j&4278190080)>>24,(j&16711680)>>16,(j&65280)>>8,j&255])))}return p.apply(null,I)},m=function(y){return p(ve.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(y.channelcount&65280)>>8,y.channelcount&255,(y.samplesize&65280)>>8,y.samplesize&255,0,0,0,0,(y.samplerate&65280)>>8,y.samplerate&255,0,0]),b(y))}}(),$=function(h){var m=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(h.id&4278190080)>>24,(h.id&16711680)>>16,(h.id&65280)>>8,h.id&255,0,0,0,0,(h.duration&4278190080)>>24,(h.duration&16711680)>>16,(h.duration&65280)>>8,h.duration&255,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(h.width&65280)>>8,h.width&255,0,0,(h.height&65280)>>8,h.height&255,0,0]);return p(ve.tkhd,m)},_e=function(h){var m,y,v,_,x,k,R;return m=p(ve.tfhd,new Uint8Array([0,0,0,58,(h.id&4278190080)>>24,(h.id&16711680)>>16,(h.id&65280)>>8,h.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),k=Math.floor(h.baseMediaDecodeTime/c),R=Math.floor(h.baseMediaDecodeTime%c),y=p(ve.tfdt,new Uint8Array([1,0,0,0,k>>>24&255,k>>>16&255,k>>>8&255,k&255,R>>>24&255,R>>>16&255,R>>>8&255,R&255])),x=32+20+8+16+8+8,h.type==="audio"?(v=xe(h,x),p(ve.traf,m,y,v)):(_=G(h),v=xe(h,_.length+x),p(ve.traf,m,y,v,_))},Y=function(h){return h.duration=h.duration||4294967295,p(ve.trak,$(h),Q(h))},fe=function(h){var m=new Uint8Array([0,0,0,0,(h.id&4278190080)>>24,(h.id&16711680)>>16,(h.id&65280)>>8,h.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return h.type!=="video"&&(m[m.length-1]=0),p(ve.trex,m)},function(){var h,m,y;y=function(v,_){var x=0,k=0,R=0,I=0;return v.length&&(v[0].duration!==void 0&&(x=1),v[0].size!==void 0&&(k=2),v[0].flags!==void 0&&(R=4),v[0].compositionTimeOffset!==void 0&&(I=8)),[0,0,x|k|R|I,1,(v.length&4278190080)>>>24,(v.length&16711680)>>>16,(v.length&65280)>>>8,v.length&255,(_&4278190080)>>>24,(_&16711680)>>>16,(_&65280)>>>8,_&255]},m=function(v,_){var x,k,R,I,N,j;for(I=v.samples||[],_+=8+12+16*I.length,R=y(I,_),k=new Uint8Array(R.length+I.length*16),k.set(R),x=R.length,j=0;j>>24,k[x++]=(N.duration&16711680)>>>16,k[x++]=(N.duration&65280)>>>8,k[x++]=N.duration&255,k[x++]=(N.size&4278190080)>>>24,k[x++]=(N.size&16711680)>>>16,k[x++]=(N.size&65280)>>>8,k[x++]=N.size&255,k[x++]=N.flags.isLeading<<2|N.flags.dependsOn,k[x++]=N.flags.isDependedOn<<6|N.flags.hasRedundancy<<4|N.flags.paddingValue<<1|N.flags.isNonSyncSample,k[x++]=N.flags.degradationPriority&61440,k[x++]=N.flags.degradationPriority&15,k[x++]=(N.compositionTimeOffset&4278190080)>>>24,k[x++]=(N.compositionTimeOffset&16711680)>>>16,k[x++]=(N.compositionTimeOffset&65280)>>>8,k[x++]=N.compositionTimeOffset&255;return p(ve.trun,k)},h=function(v,_){var x,k,R,I,N,j;for(I=v.samples||[],_+=8+12+8*I.length,R=y(I,_),x=new Uint8Array(R.length+I.length*8),x.set(R),k=R.length,j=0;j>>24,x[k++]=(N.duration&16711680)>>>16,x[k++]=(N.duration&65280)>>>8,x[k++]=N.duration&255,x[k++]=(N.size&4278190080)>>>24,x[k++]=(N.size&16711680)>>>16,x[k++]=(N.size&65280)>>>8,x[k++]=N.size&255;return p(ve.trun,x)},xe=function(v,_){return v.type==="audio"?h(v,_):m(v,_)}}();var Lr={ftyp:S,mdat:E,moof:U,moov:D,initSegment:function(h){var m=S(),y=D(h),v;return v=new Uint8Array(m.byteLength+y.byteLength),v.set(m),v.set(y,m.byteLength),v}},Rt=function(h){var m,y,v=[],_=[];for(_.byteLength=0,_.nalCount=0,_.duration=0,v.byteLength=0,m=0;m1&&(m=h.shift(),h.byteLength-=m.byteLength,h.nalCount-=m.nalCount,h[0][0].dts=m.dts,h[0][0].pts=m.pts,h[0][0].duration+=m.duration),h},Ir=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},Ra=function(h,m){var y=Ir();return y.dataOffset=m,y.compositionTimeOffset=h.pts-h.dts,y.duration=h.duration,y.size=4*h.length,y.size+=h.byteLength,h.keyFrame&&(y.flags.dependsOn=2,y.flags.isNonSyncSample=0),y},qs=function(h,m){var y,v,_,x,k,R=m||0,I=[];for(y=0;yUi.ONE_SECOND_IN_TS/2))){for(N=Xs()[h.samplerate],N||(N=m[0].data),j=0;j=y?h:(m.minSegmentDts=1/0,h.filter(function(v){return v.dts>=y?(m.minSegmentDts=Math.min(m.minSegmentDts,v.dts),m.minSegmentPts=m.minSegmentDts,!0):!1}))},X=function(h){var m,y,v=[];for(m=0;m=this.virtualRowCount&&typeof this.beforeRowOverflow=="function"&&this.beforeRowOverflow(h),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},Dn.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1},Dn.prototype.addText=function(h){this.rows[this.rowIdx]+=h},Dn.prototype.backspace=function(){if(!this.isEmpty()){var h=this.rows[this.rowIdx];this.rows[this.rowIdx]=h.substr(0,h.length-1)}};var Si=function(h,m,y){this.serviceNum=h,this.text="",this.currentWindow=new Dn(-1),this.windows=[],this.stream=y,typeof m=="string"&&this.createTextDecoder(m)};Si.prototype.init=function(h,m){this.startPts=h;for(var y=0;y<8;y++)this.windows[y]=new Dn(y),typeof m=="function"&&(this.windows[y].beforeRowOverflow=m)},Si.prototype.setCurrentWindow=function(h){this.currentWindow=this.windows[h]},Si.prototype.createTextDecoder=function(h){if(typeof TextDecoder>"u")this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(h)}catch(m){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+h+" encoding. "+m})}};var mt=function(h){h=h||{},mt.prototype.init.call(this);var m=this,y=h.captionServices||{},v={},_;Object.keys(y).forEach(x=>{_=y[x],/^SERVICE/.test(x)&&(v[x]=_.encoding)}),this.serviceEncodings=v,this.current708Packet=null,this.services={},this.push=function(x){x.type===3?(m.new708Packet(),m.add708Bytes(x)):(m.current708Packet===null&&m.new708Packet(),m.add708Bytes(x))}};mt.prototype=new Fd,mt.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},mt.prototype.add708Bytes=function(h){var m=h.ccData,y=m>>>8,v=m&255;this.current708Packet.ptsVals.push(h.pts),this.current708Packet.data.push(y),this.current708Packet.data.push(v)},mt.prototype.push708Packet=function(){var h=this.current708Packet,m=h.data,y=null,v=null,_=0,x=m[_++];for(h.seq=x>>6,h.sizeCode=x&63;_>5,v=x&31,y===7&&v>0&&(x=m[_++],y=x),this.pushServiceBlock(y,_,v),v>0&&(_+=v-1)},mt.prototype.pushServiceBlock=function(h,m,y){var v,_=m,x=this.current708Packet.data,k=this.services[h];for(k||(k=this.initService(h,_));_("0"+(Le&255).toString(16)).slice(-2)).join("")}if(_?(te=[R,I],h++):te=[R],m.textDecoder_&&!v)j=m.textDecoder_.decode(new Uint8Array(te));else if(_){const ue=ge(te);j=String.fromCharCode(parseInt(ue,16))}else j=Hy(k|R);return N.pendingNewLine&&!N.isEmpty()&&N.newLine(this.getPts(h)),N.pendingNewLine=!1,N.addText(j),h},mt.prototype.multiByteCharacter=function(h,m){var y=this.current708Packet.data,v=y[h+1],_=y[h+2];return ke(v)&&ke(_)&&(h=this.handleText(++h,m,{isMultiByte:!0})),h},mt.prototype.setCurrentWindow=function(h,m){var y=this.current708Packet.data,v=y[h],_=v&7;return m.setCurrentWindow(_),h},mt.prototype.defineWindow=function(h,m){var y=this.current708Packet.data,v=y[h],_=v&7;m.setCurrentWindow(_);var x=m.currentWindow;return v=y[++h],x.visible=(v&32)>>5,x.rowLock=(v&16)>>4,x.columnLock=(v&8)>>3,x.priority=v&7,v=y[++h],x.relativePositioning=(v&128)>>7,x.anchorVertical=v&127,v=y[++h],x.anchorHorizontal=v,v=y[++h],x.anchorPoint=(v&240)>>4,x.rowCount=v&15,v=y[++h],x.columnCount=v&63,v=y[++h],x.windowStyle=(v&56)>>3,x.penStyle=v&7,x.virtualRowCount=x.rowCount+1,h},mt.prototype.setWindowAttributes=function(h,m){var y=this.current708Packet.data,v=y[h],_=m.currentWindow.winAttr;return v=y[++h],_.fillOpacity=(v&192)>>6,_.fillRed=(v&48)>>4,_.fillGreen=(v&12)>>2,_.fillBlue=v&3,v=y[++h],_.borderType=(v&192)>>6,_.borderRed=(v&48)>>4,_.borderGreen=(v&12)>>2,_.borderBlue=v&3,v=y[++h],_.borderType+=(v&128)>>5,_.wordWrap=(v&64)>>6,_.printDirection=(v&48)>>4,_.scrollDirection=(v&12)>>2,_.justify=v&3,v=y[++h],_.effectSpeed=(v&240)>>4,_.effectDirection=(v&12)>>2,_.displayEffect=v&3,h},mt.prototype.flushDisplayed=function(h,m){for(var y=[],v=0;v<8;v++)m.windows[v].visible&&!m.windows[v].isEmpty()&&y.push(m.windows[v].getText());m.endPts=h,m.text=y.join(`
`),this.pushCaption(m),m.startPts=h},mt.prototype.pushCaption=function(h){h.text!==""&&(this.trigger("data",{startPts:h.startPts,endPts:h.endPts,text:h.text,stream:"cc708_"+h.serviceNum}),h.text="",h.startPts=h.endPts)},mt.prototype.displayWindows=function(h,m){var y=this.current708Packet.data,v=y[++h],_=this.getPts(h);this.flushDisplayed(_,m);for(var x=0;x<8;x++)v&1<>4,_.offset=(v&12)>>2,_.penSize=v&3,v=y[++h],_.italics=(v&128)>>7,_.underline=(v&64)>>6,_.edgeType=(v&56)>>3,_.fontStyle=v&7,h},mt.prototype.setPenColor=function(h,m){var y=this.current708Packet.data,v=y[h],_=m.currentWindow.penColor;return v=y[++h],_.fgOpacity=(v&192)>>6,_.fgRed=(v&48)>>4,_.fgGreen=(v&12)>>2,_.fgBlue=v&3,v=y[++h],_.bgOpacity=(v&192)>>6,_.bgRed=(v&48)>>4,_.bgGreen=(v&12)>>2,_.bgBlue=v&3,v=y[++h],_.edgeRed=(v&48)>>4,_.edgeGreen=(v&12)>>2,_.edgeBlue=v&3,h},mt.prototype.setPenLocation=function(h,m){var y=this.current708Packet.data,v=y[h],_=m.currentWindow.penLoc;return m.currentWindow.pendingNewLine=!0,v=y[++h],_.row=v&15,v=y[++h],_.column=v&63,h},mt.prototype.reset=function(h,m){var y=this.getPts(h);return this.flushDisplayed(y,m),this.initService(m.serviceNum,h)};var zy={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},Fr=function(h){return h===null?"":(h=zy[h]||h,String.fromCharCode(h))},Ho=14,Du=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],ei=function(){for(var h=[],m=Ho+1;m--;)h.push({text:"",indent:0,offset:0});return h},Et=function(h,m){Et.prototype.init.call(this),this.field_=h||0,this.dataChannel_=m||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(y){var v,_,x,k,R;if(v=y.ccData&32639,v===this.lastControlCode_){this.lastControlCode_=null;return}if((v&61440)===4096?this.lastControlCode_=v:v!==this.PADDING_&&(this.lastControlCode_=null),x=v>>>8,k=v&255,v!==this.PADDING_)if(v===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(v===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(y.pts),this.flushDisplayed(y.pts),_=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=_,this.startPts_=y.pts;else if(v===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(y.pts);else if(v===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(y.pts);else if(v===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(y.pts);else if(v===this.CARRIAGE_RETURN_)this.clearFormatting(y.pts),this.flushDisplayed(y.pts),this.shiftRowsUp_(),this.startPts_=y.pts;else if(v===this.BACKSPACE_)this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);else if(v===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(y.pts),this.displayed_=ei();else if(v===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=ei();else if(v===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(y.pts),this.displayed_=ei()),this.mode_="paintOn",this.startPts_=y.pts;else if(this.isSpecialCharacter(x,k))x=(x&3)<<8,R=Fr(x|k),this[this.mode_](y.pts,R),this.column_++;else if(this.isExtCharacter(x,k))this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),x=(x&3)<<8,R=Fr(x|k),this[this.mode_](y.pts,R),this.column_++;else if(this.isMidRowCode(x,k))this.clearFormatting(y.pts),this[this.mode_](y.pts," "),this.column_++,(k&14)===14&&this.addFormatting(y.pts,["i"]),(k&1)===1&&this.addFormatting(y.pts,["u"]);else if(this.isOffsetControlCode(x,k)){const N=k&3;this.nonDisplayed_[this.row_].offset=N,this.column_+=N}else if(this.isPAC(x,k)){var I=Du.indexOf(v&7968);if(this.mode_==="rollUp"&&(I-this.rollUpRows_+1<0&&(I=this.rollUpRows_-1),this.setRollUp(y.pts,I)),I!==this.row_&&I>=0&&I<=14&&(this.clearFormatting(y.pts),this.row_=I),k&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(y.pts,["u"]),(v&16)===16){const N=(v&14)>>1;this.column_=N*4,this.nonDisplayed_[this.row_].indent+=N}this.isColorPAC(k)&&(k&14)===14&&this.addFormatting(y.pts,["i"])}else this.isNormalChar(x)&&(k===0&&(k=null),R=Fr(x),R+=Fr(k),this[this.mode_](y.pts,R),this.column_+=R.length)}};Et.prototype=new Fd,Et.prototype.flushDisplayed=function(h){const m=v=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+v+"."})},y=[];this.displayed_.forEach((v,_)=>{if(v&&v.text&&v.text.length){try{v.text=v.text.trim()}catch{m(_)}v.text.length&&y.push({text:v.text,line:_+1,position:10+Math.min(70,v.indent*10)+v.offset*2.5})}else v==null&&m(_)}),y.length&&this.trigger("data",{startPts:this.startPts_,endPts:h,content:y,stream:this.name_})},Et.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=ei(),this.nonDisplayed_=ei(),this.lastControlCode_=null,this.column_=0,this.row_=Ho,this.rollUpRows_=2,this.formatting_=[]},Et.prototype.setConstants=function(){this.dataChannel_===0?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):this.dataChannel_===1&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=this.CONTROL_|32,this.END_OF_CAPTION_=this.CONTROL_|47,this.ROLL_UP_2_ROWS_=this.CONTROL_|37,this.ROLL_UP_3_ROWS_=this.CONTROL_|38,this.ROLL_UP_4_ROWS_=this.CONTROL_|39,this.CARRIAGE_RETURN_=this.CONTROL_|45,this.RESUME_DIRECT_CAPTIONING_=this.CONTROL_|41,this.BACKSPACE_=this.CONTROL_|33,this.ERASE_DISPLAYED_MEMORY_=this.CONTROL_|44,this.ERASE_NON_DISPLAYED_MEMORY_=this.CONTROL_|46},Et.prototype.isSpecialCharacter=function(h,m){return h===this.EXT_&&m>=48&&m<=63},Et.prototype.isExtCharacter=function(h,m){return(h===this.EXT_+1||h===this.EXT_+2)&&m>=32&&m<=63},Et.prototype.isMidRowCode=function(h,m){return h===this.EXT_&&m>=32&&m<=47},Et.prototype.isOffsetControlCode=function(h,m){return h===this.OFFSET_&&m>=33&&m<=35},Et.prototype.isPAC=function(h,m){return h>=this.BASE_&&h=64&&m<=127},Et.prototype.isColorPAC=function(h){return h>=64&&h<=79||h>=96&&h<=127},Et.prototype.isNormalChar=function(h){return h>=32&&h<=127},Et.prototype.setRollUp=function(h,m){if(this.mode_!=="rollUp"&&(this.row_=Ho,this.mode_="rollUp",this.flushDisplayed(h),this.nonDisplayed_=ei(),this.displayed_=ei()),m!==void 0&&m!==this.row_)for(var y=0;y"},"");this[this.mode_](h,y)},Et.prototype.clearFormatting=function(h){if(this.formatting_.length){var m=this.formatting_.reverse().reduce(function(y,v){return y+""+v+">"},"");this.formatting_=[],this[this.mode_](h,m)}},Et.prototype.popOn=function(h,m){var y=this.nonDisplayed_[this.row_].text;y+=m,this.nonDisplayed_[this.row_].text=y},Et.prototype.rollUp=function(h,m){var y=this.displayed_[this.row_].text;y+=m,this.displayed_[this.row_].text=y},Et.prototype.shiftRowsUp_=function(){var h;for(h=0;hm&&(y=-1);Math.abs(m-h)>Hp;)h+=y*Fp;return h},Ou=function(h){var m,y;Ou.prototype.init.call(this),this.type_=h||Hr,this.push=function(v){if(v.type==="metadata"){this.trigger("data",v);return}this.type_!==Hr&&v.type!==this.type_||(y===void 0&&(y=v.dts),v.dts=ku(v.dts,y),v.pts=ku(v.pts,y),m=v.dts,this.trigger("data",v))},this.flush=function(){y=m,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){y=void 0,m=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};Ou.prototype=new Hd;var zd={TimestampRolloverStream:Ou,handleRollover:ku},zp=(h,m,y)=>{if(!h)return-1;for(var v=y;v";h.data[0]===gs.Utf8&&(y=pi(h.data,0,m),!(y<0)&&(h.mimeType=ys(h.data,m,y),m=y+1,h.pictureType=h.data[m],m++,v=pi(h.data,0,m),!(v<0)&&(h.description=Pa(h.data,m,v),m=v+1,h.mimeType===_?h.url=ys(h.data,m,h.data.length):h.pictureData=h.data.subarray(m,h.data.length))))},"T*":function(h){h.data[0]===gs.Utf8&&(h.value=Pa(h.data,1,h.data.length).replace(/\0*$/,""),h.values=h.value.split("\0"))},TXXX:function(h){var m;h.data[0]===gs.Utf8&&(m=pi(h.data,0,1),m!==-1&&(h.description=Pa(h.data,1,m),h.value=Pa(h.data,m+1,h.data.length).replace(/\0*$/,""),h.data=h.value))},"W*":function(h){h.url=ys(h.data,0,h.data.length).replace(/\0.*$/,"")},WXXX:function(h){var m;h.data[0]===gs.Utf8&&(m=pi(h.data,0,1),m!==-1&&(h.description=Pa(h.data,1,m),h.url=ys(h.data,m+1,h.data.length).replace(/\0.*$/,"")))},PRIV:function(h){var m;for(m=0;m>>2;Le*=4,Le+=ue[7]&3,j.timeStamp=Le,R.pts===void 0&&R.dts===void 0&&(R.pts=j.timeStamp,R.dts=j.timeStamp),this.trigger("timestamp",j)}R.frames.push(j),I+=10,I+=N}while(I>>4>1&&(k+=_[k]+1),x.pid===0)x.type="pat",h(_.subarray(k),x),this.trigger("data",x);else if(x.pid===this.pmtPid)for(x.type="pmt",h(_.subarray(k),x),this.trigger("data",x);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([_,k,x]):this.processPes_(_,k,x)},this.processPes_=function(_,x,k){k.pid===this.programMapTable.video?k.streamType=hn.H264_STREAM_TYPE:k.pid===this.programMapTable.audio?k.streamType=hn.ADTS_STREAM_TYPE:k.streamType=this.programMapTable["timed-metadata"][k.pid],k.type="pes",k.data=_.subarray(x),this.trigger("data",k)}},Ua.prototype=new Vo,Ua.STREAM_TYPES={h264:27,adts:15},Ba=function(){var h=this,m=!1,y={data:[],size:0},v={data:[],size:0},_={data:[],size:0},x,k=function(I,N){var j;const te=I[0]<<16|I[1]<<8|I[2];N.data=new Uint8Array,te===1&&(N.packetLength=6+(I[4]<<8|I[5]),N.dataAlignmentIndicator=(I[6]&4)!==0,j=I[7],j&192&&(N.pts=(I[9]&14)<<27|(I[10]&255)<<20|(I[11]&254)<<12|(I[12]&255)<<5|(I[13]&254)>>>3,N.pts*=4,N.pts+=(I[13]&6)>>>1,N.dts=N.pts,j&64&&(N.dts=(I[14]&14)<<27|(I[15]&255)<<20|(I[16]&254)<<12|(I[17]&255)<<5|(I[18]&254)>>>3,N.dts*=4,N.dts+=(I[18]&6)>>>1)),N.data=I.subarray(9+I[8]))},R=function(I,N,j){var te=new Uint8Array(I.size),ge={type:N},ue=0,Le=0,Pe=!1,qt;if(!(!I.data.length||I.size<9)){for(ge.trackId=I.data[0].pid,ue=0;ue>5,I=((m[_+6]&3)+1)*1024,N=I*Gp/Xp[(m[_+2]&60)>>>2],m.byteLength-_>>6&3)+1,channelcount:(m[_+2]&1)<<2|(m[_+3]&192)>>>6,samplerate:Xp[(m[_+2]&60)>>>2],samplingfrequencyindex:(m[_+2]&60)>>>2,samplesize:16,data:m.subarray(_+7+k,_+x)}),y++,_+=x}typeof j=="number"&&(this.skipWarn_(j,_),j=null),m=m.subarray(_)}},this.flush=function(){y=0,this.trigger("done")},this.reset=function(){m=void 0,this.trigger("reset")},this.endTimeline=function(){m=void 0,this.trigger("endedtimeline")}},Iu.prototype=new $o;var qy=Iu,Yp;Yp=function(h){var m=h.byteLength,y=0,v=0;this.length=function(){return 8*m},this.bitsAvailable=function(){return 8*m+v},this.loadWord=function(){var _=h.byteLength-m,x=new Uint8Array(4),k=Math.min(4,m);if(k===0)throw new Error("no bytes available");x.set(h.subarray(_,_+k)),y=new DataView(x.buffer).getUint32(0),v=k*8,m-=k},this.skipBits=function(_){var x;v>_?(y<<=_,v-=_):(_-=v,x=Math.floor(_/8),_-=x*8,m-=x,this.loadWord(),y<<=_,v-=_)},this.readBits=function(_){var x=Math.min(v,_),k=y>>>32-x;return v-=x,v>0?y<<=x:m>0&&this.loadWord(),x=_-x,x>0?k<>>_)return y<<=_,v-=_,_;return this.loadWord(),_+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var _=this.skipLeadingZeros();return this.readBits(_+1)-1},this.readExpGolomb=function(){var _=this.readUnsignedExpGolomb();return 1&_?1+_>>>1:-1*(_>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var Go=Yp,Nu=i,Wp=Go,Xo,bs,Vd;bs=function(){var h=0,m,y;bs.prototype.init.call(this),this.push=function(v){var _;y?(_=new Uint8Array(y.byteLength+v.data.byteLength),_.set(y),_.set(v.data,y.byteLength),y=_):y=v.data;for(var x=y.byteLength;h3&&this.trigger("data",y.subarray(h+3)),y=null,h=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},bs.prototype=new Nu,Vd={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},Xo=function(){var h=new bs,m,y,v,_,x,k,R;Xo.prototype.init.call(this),m=this,this.push=function(I){I.type==="video"&&(y=I.trackId,v=I.pts,_=I.dts,h.push(I))},h.on("data",function(I){var N={trackId:y,pts:v,dts:_,data:I,nalUnitTypeCode:I[0]&31};switch(N.nalUnitTypeCode){case 5:N.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:N.nalUnitType="sei_rbsp",N.escapedRBSP=x(I.subarray(1));break;case 7:N.nalUnitType="seq_parameter_set_rbsp",N.escapedRBSP=x(I.subarray(1)),N.config=k(N.escapedRBSP);break;case 8:N.nalUnitType="pic_parameter_set_rbsp";break;case 9:N.nalUnitType="access_unit_delimiter_rbsp";break}m.trigger("data",N)}),h.on("done",function(){m.trigger("done")}),h.on("partialdone",function(){m.trigger("partialdone")}),h.on("reset",function(){m.trigger("reset")}),h.on("endedtimeline",function(){m.trigger("endedtimeline")}),this.flush=function(){h.flush()},this.partialFlush=function(){h.partialFlush()},this.reset=function(){h.reset()},this.endTimeline=function(){h.endTimeline()},R=function(I,N){var j=8,te=8,ge,ue;for(ge=0;ge>4;return y=y>=0?y:0,_?y+20:y+10},xi=function(h,m){return h.length-m<10||h[m]!=="I".charCodeAt(0)||h[m+1]!=="D".charCodeAt(0)||h[m+2]!=="3".charCodeAt(0)?m:(m+=$d(h,m),xi(h,m))},Vy=function(h){var m=xi(h,0);return h.length>=m+2&&(h[m]&255)===255&&(h[m+1]&240)===240&&(h[m+1]&22)===16},Bu=function(h){return h[0]<<21|h[1]<<14|h[2]<<7|h[3]},Qp=function(h,m,y){var v,_="";for(v=m;v>5,v=h[m+4]<<3,_=h[m+3]&6144;return _|v|y},Gy=function(h,m){return h[m]==="I".charCodeAt(0)&&h[m+1]==="D".charCodeAt(0)&&h[m+2]==="3".charCodeAt(0)?"timed-metadata":h[m]&!0&&(h[m+1]&240)===240?"audio":null},Zp=function(h){for(var m=0;m+5>>2]}return null},Xy=function(h){var m,y,v,_;m=10,h[5]&64&&(m+=4,m+=Bu(h.subarray(10,14)));do{if(y=Bu(h.subarray(m+4,m+8)),y<1)return null;if(_=String.fromCharCode(h[m],h[m+1],h[m+2],h[m+3]),_==="PRIV"){v=h.subarray(m+10,m+y+10);for(var x=0;x>>2;return I*=4,I+=R[7]&3,I}break}}m+=10,m+=y}while(m=3;){if(h[_]==="I".charCodeAt(0)&&h[_+1]==="D".charCodeAt(0)&&h[_+2]==="3".charCodeAt(0)){if(h.length-_<10||(v=Yo.parseId3TagSize(h,_),_+v>h.length))break;k={type:"timed-metadata",data:h.subarray(_,_+v)},this.trigger("data",k),_+=v;continue}else if((h[_]&255)===255&&(h[_+1]&240)===240){if(h.length-_<7||(v=Yo.parseAdtsSize(h,_),_+v>h.length))break;R={type:"audio",data:h.subarray(_,_+v),pts:m,dts:m},this.trigger("data",R),_+=v;continue}_++}x=h.length-_,x>0?h=h.subarray(_):h=new Uint8Array},this.reset=function(){h=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){h=new Uint8Array,this.trigger("endedtimeline")}},Wo.prototype=new Yy;var Jp=Wo,em=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],Wy=em,Qy=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],Ky=Qy,Hu=i,Qo=Lr,_s=ps,Ko=be,fn=ze,Gn=$p,Zo=ot,zu=qy,tm=Pu.H264Stream,Vr=Jp,$r=Fu.isLikelyAacData,wn=ot.ONE_SECOND_IN_TS,Ei=Wy,Fa=Ky,Zs,Js,ri,er,ju=function(h,m){m.stream=h,this.trigger("log",m)},tr=function(h,m){for(var y=Object.keys(m),v=0;v=-N&&te<=I&&(!ge||j>te)&&(ge=Le,j=te)));return ge?ge.gop:null},this.alignGopsAtStart_=function(R){var I,N,j,te,ge,ue,Le,Pe;for(ge=R.byteLength,ue=R.nalCount,Le=R.duration,I=N=0;I<_.length&&Nj.pts){I++;continue}N++,ge-=te.byteLength,ue-=te.nalCount,Le-=te.duration}return N===0?R:N===R.length?null:(Pe=R.slice(N),Pe.byteLength=ge,Pe.duration=Le,Pe.nalCount=ue,Pe.pts=Pe[0].pts,Pe.dts=Pe[0].dts,Pe)},this.alignGopsAtEnd_=function(R){var I,N,j,te,ge,ue;for(I=_.length-1,N=R.length-1,ge=null,ue=!1;I>=0&&N>=0;){if(j=_[I],te=R[N],j.pts===te.pts){ue=!0;break}if(j.pts>te.pts){I--;continue}I===_.length-1&&(ge=N),N--}if(!ue&&ge===null)return null;var Le;if(ue?Le=N:Le=ge,Le===0)return R;var Pe=R.slice(Le),qt=Pe.reduce(function(mi,Wn){return mi.byteLength+=Wn.byteLength,mi.duration+=Wn.duration,mi.nalCount+=Wn.nalCount,mi},{byteLength:0,duration:0,nalCount:0});return Pe.byteLength=qt.byteLength,Pe.duration=qt.duration,Pe.nalCount=qt.nalCount,Pe.pts=Pe[0].pts,Pe.dts=Pe[0].dts,Pe},this.alignGopsWith=function(R){_=R}},Zs.prototype=new Hu,er=function(h,m){this.numberOfTracks=0,this.metadataStream=m,h=h||{},typeof h.remux<"u"?this.remuxTracks=!!h.remux:this.remuxTracks=!0,typeof h.keepOriginalTimestamps=="boolean"?this.keepOriginalTimestamps=h.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,er.prototype.init.call(this),this.push=function(y){if(y.content||y.text)return this.pendingCaptions.push(y);if(y.frames)return this.pendingMetadata.push(y);this.pendingTracks.push(y.track),this.pendingBytes+=y.boxes.byteLength,y.track.type==="video"&&(this.videoTrack=y.track,this.pendingBoxes.push(y.boxes)),y.track.type==="audio"&&(this.audioTrack=y.track,this.pendingBoxes.unshift(y.boxes))}},er.prototype=new Hu,er.prototype.flush=function(h){var m=0,y={captions:[],captionStreams:{},metadata:[],info:{}},v,_,x,k=0,R;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0);return}}if(this.videoTrack?(k=this.videoTrack.timelineStartInfo.pts,Fa.forEach(function(I){y.info[I]=this.videoTrack[I]},this)):this.audioTrack&&(k=this.audioTrack.timelineStartInfo.pts,Ei.forEach(function(I){y.info[I]=this.audioTrack[I]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?y.type=this.pendingTracks[0].type:y.type="combined",this.emittedTracks+=this.pendingTracks.length,x=Qo.initSegment(this.pendingTracks),y.initSegment=new Uint8Array(x.byteLength),y.initSegment.set(x),y.data=new Uint8Array(this.pendingBytes),R=0;R=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},er.prototype.setRemux=function(h){this.remuxTracks=h},ri=function(h){var m=this,y=!0,v,_;ri.prototype.init.call(this),h=h||{},this.baseMediaDecodeTime=h.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var x={};this.transmuxPipeline_=x,x.type="aac",x.metadataStream=new Gn.MetadataStream,x.aacStream=new Vr,x.audioTimestampRolloverStream=new Gn.TimestampRolloverStream("audio"),x.timedMetadataTimestampRolloverStream=new Gn.TimestampRolloverStream("timed-metadata"),x.adtsStream=new zu,x.coalesceStream=new er(h,x.metadataStream),x.headOfPipeline=x.aacStream,x.aacStream.pipe(x.audioTimestampRolloverStream).pipe(x.adtsStream),x.aacStream.pipe(x.timedMetadataTimestampRolloverStream).pipe(x.metadataStream).pipe(x.coalesceStream),x.metadataStream.on("timestamp",function(k){x.aacStream.setTimestamp(k.timeStamp)}),x.aacStream.on("data",function(k){k.type!=="timed-metadata"&&k.type!=="audio"||x.audioSegmentStream||(_=_||{timelineStartInfo:{baseMediaDecodeTime:m.baseMediaDecodeTime},codec:"adts",type:"audio"},x.coalesceStream.numberOfTracks++,x.audioSegmentStream=new Js(_,h),x.audioSegmentStream.on("log",m.getLogTrigger_("audioSegmentStream")),x.audioSegmentStream.on("timingInfo",m.trigger.bind(m,"audioTimingInfo")),x.adtsStream.pipe(x.audioSegmentStream).pipe(x.coalesceStream),m.trigger("trackinfo",{hasAudio:!!_,hasVideo:!!v}))}),x.coalesceStream.on("data",this.trigger.bind(this,"data")),x.coalesceStream.on("done",this.trigger.bind(this,"done")),tr(this,x)},this.setupTsPipeline=function(){var x={};this.transmuxPipeline_=x,x.type="ts",x.metadataStream=new Gn.MetadataStream,x.packetStream=new Gn.TransportPacketStream,x.parseStream=new Gn.TransportParseStream,x.elementaryStream=new Gn.ElementaryStream,x.timestampRolloverStream=new Gn.TimestampRolloverStream,x.adtsStream=new zu,x.h264Stream=new tm,x.captionStream=new Gn.CaptionStream(h),x.coalesceStream=new er(h,x.metadataStream),x.headOfPipeline=x.packetStream,x.packetStream.pipe(x.parseStream).pipe(x.elementaryStream).pipe(x.timestampRolloverStream),x.timestampRolloverStream.pipe(x.h264Stream),x.timestampRolloverStream.pipe(x.adtsStream),x.timestampRolloverStream.pipe(x.metadataStream).pipe(x.coalesceStream),x.h264Stream.pipe(x.captionStream).pipe(x.coalesceStream),x.elementaryStream.on("data",function(k){var R;if(k.type==="metadata"){for(R=k.tracks.length;R--;)!v&&k.tracks[R].type==="video"?(v=k.tracks[R],v.timelineStartInfo.baseMediaDecodeTime=m.baseMediaDecodeTime):!_&&k.tracks[R].type==="audio"&&(_=k.tracks[R],_.timelineStartInfo.baseMediaDecodeTime=m.baseMediaDecodeTime);v&&!x.videoSegmentStream&&(x.coalesceStream.numberOfTracks++,x.videoSegmentStream=new Zs(v,h),x.videoSegmentStream.on("log",m.getLogTrigger_("videoSegmentStream")),x.videoSegmentStream.on("timelineStartInfo",function(I){_&&!h.keepOriginalTimestamps&&(_.timelineStartInfo=I,x.audioSegmentStream.setEarliestDts(I.dts-m.baseMediaDecodeTime))}),x.videoSegmentStream.on("processedGopsInfo",m.trigger.bind(m,"gopInfo")),x.videoSegmentStream.on("segmentTimingInfo",m.trigger.bind(m,"videoSegmentTimingInfo")),x.videoSegmentStream.on("baseMediaDecodeTime",function(I){_&&x.audioSegmentStream.setVideoBaseMediaDecodeTime(I)}),x.videoSegmentStream.on("timingInfo",m.trigger.bind(m,"videoTimingInfo")),x.h264Stream.pipe(x.videoSegmentStream).pipe(x.coalesceStream)),_&&!x.audioSegmentStream&&(x.coalesceStream.numberOfTracks++,x.audioSegmentStream=new Js(_,h),x.audioSegmentStream.on("log",m.getLogTrigger_("audioSegmentStream")),x.audioSegmentStream.on("timingInfo",m.trigger.bind(m,"audioTimingInfo")),x.audioSegmentStream.on("segmentTimingInfo",m.trigger.bind(m,"audioSegmentTimingInfo")),x.adtsStream.pipe(x.audioSegmentStream).pipe(x.coalesceStream)),m.trigger("trackinfo",{hasAudio:!!_,hasVideo:!!v})}}),x.coalesceStream.on("data",this.trigger.bind(this,"data")),x.coalesceStream.on("id3Frame",function(k){k.dispatchType=x.metadataStream.dispatchType,m.trigger("id3Frame",k)}),x.coalesceStream.on("caption",this.trigger.bind(this,"caption")),x.coalesceStream.on("done",this.trigger.bind(this,"done")),tr(this,x)},this.setBaseMediaDecodeTime=function(x){var k=this.transmuxPipeline_;h.keepOriginalTimestamps||(this.baseMediaDecodeTime=x),_&&(_.timelineStartInfo.dts=void 0,_.timelineStartInfo.pts=void 0,fn.clearDtsInfo(_),k.audioTimestampRolloverStream&&k.audioTimestampRolloverStream.discontinuity()),v&&(k.videoSegmentStream&&(k.videoSegmentStream.gopCache_=[]),v.timelineStartInfo.dts=void 0,v.timelineStartInfo.pts=void 0,fn.clearDtsInfo(v),k.captionStream.reset()),k.timestampRolloverStream&&k.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(x){_&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(x)},this.setRemux=function(x){var k=this.transmuxPipeline_;h.remux=x,k&&k.coalesceStream&&k.coalesceStream.setRemux(x)},this.alignGopsWith=function(x){v&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(x)},this.getLogTrigger_=function(x){var k=this;return function(R){R.stream=x,k.trigger("log",R)}},this.push=function(x){if(y){var k=$r(x);k&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!k&&this.transmuxPipeline_.type!=="ts"&&this.setupTsPipeline(),y=!1}this.transmuxPipeline_.headOfPipeline.push(x)},this.flush=function(){y=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}},ri.prototype=new Hu;var im={Transmuxer:ri,VideoSegmentStream:Zs,AudioSegmentStream:Js,AUDIO_PROPERTIES:Ei,VIDEO_PROPERTIES:Fa,generateSegmentTimingInfo:Vu},Gd=function(h){return h>>>0},Zy=function(h){return("00"+h.toString(16)).slice(-2)},Ha={toUnsigned:Gd,toHexString:Zy},Ts=function(h){var m="";return m+=String.fromCharCode(h[0]),m+=String.fromCharCode(h[1]),m+=String.fromCharCode(h[2]),m+=String.fromCharCode(h[3]),m},$u=Ts,Xd=Ha.toUnsigned,Gu=$u,ir=function(h,m){var y=[],v,_,x,k,R;if(!m.length)return null;for(v=0;v1?v+_:h.byteLength,x===m[0]&&(m.length===1?y.push(h.subarray(v+8,k)):(R=ir(h.subarray(v+8,k),m.slice(1)),R.length&&(y=y.concat(R)))),v=k;return y},za=ir,Yd=Ha.toUnsigned,Gr=u.getUint64,nm=function(h){var m={version:h[0],flags:new Uint8Array(h.subarray(1,4))};return m.version===1?m.baseMediaDecodeTime=Gr(h.subarray(4)):m.baseMediaDecodeTime=Yd(h[4]<<24|h[5]<<16|h[6]<<8|h[7]),m},Jo=nm,Wd=function(h){var m=new DataView(h.buffer,h.byteOffset,h.byteLength),y={version:h[0],flags:new Uint8Array(h.subarray(1,4)),trackId:m.getUint32(4)},v=y.flags[2]&1,_=y.flags[2]&2,x=y.flags[2]&8,k=y.flags[2]&16,R=y.flags[2]&32,I=y.flags[0]&65536,N=y.flags[0]&131072,j;return j=8,v&&(j+=4,y.baseDataOffset=m.getUint32(12),j+=4),_&&(y.sampleDescriptionIndex=m.getUint32(j),j+=4),x&&(y.defaultSampleDuration=m.getUint32(j),j+=4),k&&(y.defaultSampleSize=m.getUint32(j),j+=4),R&&(y.defaultSampleFlags=m.getUint32(j)),I&&(y.durationIsEmpty=!0),!v&&N&&(y.baseDataOffsetIsMoof=!0),y},Ss=Wd,nr=u.getUint64,Qd=function(h){var m=new DataView(h.buffer,h.byteOffset,h.byteLength),y={version:h[0],flags:new Uint8Array(h.subarray(1,4)),references:[],referenceId:m.getUint32(4),timescale:m.getUint32(8)},v=12;y.version===0?(y.earliestPresentationTime=m.getUint32(v),y.firstOffset=m.getUint32(v+4),v+=8):(y.earliestPresentationTime=nr(h.subarray(v)),y.firstOffset=nr(h.subarray(v+8)),v+=16),v+=2;var _=m.getUint16(v);for(v+=2;_>0;v+=12,_--)y.references.push({referenceType:(h[v]&128)>>>7,referencedSize:m.getUint32(v)&2147483647,subsegmentDuration:m.getUint32(v+4),startsWithSap:!!(h[v+8]&128),sapType:(h[v+8]&112)>>>4,sapDeltaTime:m.getUint32(v+8)&268435455});return y},Xr=Qd,sm=function(h){return{isLeading:(h[0]&12)>>>2,dependsOn:h[0]&3,isDependedOn:(h[1]&192)>>>6,hasRedundancy:(h[1]&48)>>>4,paddingValue:(h[1]&14)>>>1,isNonSyncSample:h[1]&1,degradationPriority:h[2]<<8|h[3]}},rm=sm,ja=rm,el=function(h){var m={version:h[0],flags:new Uint8Array(h.subarray(1,4)),samples:[]},y=new DataView(h.buffer,h.byteOffset,h.byteLength),v=m.flags[2]&1,_=m.flags[2]&4,x=m.flags[1]&1,k=m.flags[1]&2,R=m.flags[1]&4,I=m.flags[1]&8,N=y.getUint32(4),j=8,te;for(v&&(m.dataOffset=y.getInt32(j),j+=4),_&&N&&(te={flags:ja(h.subarray(j,j+4))},j+=4,x&&(te.duration=y.getUint32(j),j+=4),k&&(te.size=y.getUint32(j),j+=4),I&&(m.version===1?te.compositionTimeOffset=y.getInt32(j):te.compositionTimeOffset=y.getUint32(j),j+=4),m.samples.push(te),N--);N--;)te={},x&&(te.duration=y.getUint32(j),j+=4),k&&(te.size=y.getUint32(j),j+=4),R&&(te.flags=ja(h.subarray(j,j+4)),j+=4),I&&(m.version===1?te.compositionTimeOffset=y.getInt32(j):te.compositionTimeOffset=y.getUint32(j),j+=4),m.samples.push(te);return m},Kd=el,tl=u,Zd=tl.getUint64,Wt,Xn,jt=function(h){return new Date(h*1e3-20828448e5)},Yr=$u,Jd=za,il=function(h){var m=new DataView(h.buffer,h.byteOffset,h.byteLength),y=[],v,_;for(v=0;v+4MALFORMED DATA");continue}switch(h[v]&31){case 1:y.push("slice_layer_without_partitioning_rbsp");break;case 5:y.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:y.push("sei_rbsp");break;case 7:y.push("seq_parameter_set_rbsp");break;case 8:y.push("pic_parameter_set_rbsp");break;case 9:y.push("access_unit_delimiter_rbsp");break;default:y.push("UNKNOWN NAL - "+h[v]&31);break}}return y},kn={avc1:function(h){var m=new DataView(h.buffer,h.byteOffset,h.byteLength);return{dataReferenceIndex:m.getUint16(6),width:m.getUint16(24),height:m.getUint16(26),horizresolution:m.getUint16(28)+m.getUint16(30)/16,vertresolution:m.getUint16(32)+m.getUint16(34)/16,frameCount:m.getUint16(40),depth:m.getUint16(74),config:Wt(h.subarray(78,h.byteLength))}},avcC:function(h){var m=new DataView(h.buffer,h.byteOffset,h.byteLength),y={configurationVersion:h[0],avcProfileIndication:h[1],profileCompatibility:h[2],avcLevelIndication:h[3],lengthSizeMinusOne:h[4]&3,sps:[],pps:[]},v=h[5]&31,_,x,k,R;for(k=6,R=0;R>>2&63,bufferSize:h[13]<<16|h[14]<<8|h[15],maxBitrate:h[16]<<24|h[17]<<16|h[18]<<8|h[19],avgBitrate:h[20]<<24|h[21]<<16|h[22]<<8|h[23],decoderConfigDescriptor:{tag:h[24],length:h[25],audioObjectType:h[26]>>>3&31,samplingFrequencyIndex:(h[26]&7)<<1|h[27]>>>7&1,channelConfiguration:h[27]>>>3&15}}}},ftyp:function(h){for(var m=new DataView(h.buffer,h.byteOffset,h.byteLength),y={majorBrand:Yr(h.subarray(0,4)),minorVersion:m.getUint32(4),compatibleBrands:[]},v=8;v>10)+96),_.language+=String.fromCharCode(((v&992)>>5)+96),_.language+=String.fromCharCode((v&31)+96),_},mdia:function(h){return{boxes:Wt(h)}},mfhd:function(h){return{version:h[0],flags:new Uint8Array(h.subarray(1,4)),sequenceNumber:h[4]<<24|h[5]<<16|h[6]<<8|h[7]}},minf:function(h){return{boxes:Wt(h)}},mp4a:function(h){var m=new DataView(h.buffer,h.byteOffset,h.byteLength),y={dataReferenceIndex:m.getUint16(6),channelcount:m.getUint16(16),samplesize:m.getUint16(18),samplerate:m.getUint16(24)+m.getUint16(26)/65536};return h.byteLength>28&&(y.streamDescriptor=Wt(h.subarray(28))[0]),y},moof:function(h){return{boxes:Wt(h)}},moov:function(h){return{boxes:Wt(h)}},mvex:function(h){return{boxes:Wt(h)}},mvhd:function(h){var m=new DataView(h.buffer,h.byteOffset,h.byteLength),y=4,v={version:m.getUint8(0),flags:new Uint8Array(h.subarray(1,4))};return v.version===1?(y+=4,v.creationTime=jt(m.getUint32(y)),y+=8,v.modificationTime=jt(m.getUint32(y)),y+=4,v.timescale=m.getUint32(y),y+=8,v.duration=m.getUint32(y)):(v.creationTime=jt(m.getUint32(y)),y+=4,v.modificationTime=jt(m.getUint32(y)),y+=4,v.timescale=m.getUint32(y),y+=4,v.duration=m.getUint32(y)),y+=4,v.rate=m.getUint16(y)+m.getUint16(y+2)/16,y+=4,v.volume=m.getUint8(y)+m.getUint8(y+1)/8,y+=2,y+=2,y+=2*4,v.matrix=new Uint32Array(h.subarray(y,y+9*4)),y+=9*4,y+=6*4,v.nextTrackId=m.getUint32(y),v},pdin:function(h){var m=new DataView(h.buffer,h.byteOffset,h.byteLength);return{version:m.getUint8(0),flags:new Uint8Array(h.subarray(1,4)),rate:m.getUint32(4),initialDelay:m.getUint32(8)}},sdtp:function(h){var m={version:h[0],flags:new Uint8Array(h.subarray(1,4)),samples:[]},y;for(y=4;y>4,isDependedOn:(h[y]&12)>>2,hasRedundancy:h[y]&3});return m},sidx:Xr,smhd:function(h){return{version:h[0],flags:new Uint8Array(h.subarray(1,4)),balance:h[4]+h[5]/256}},stbl:function(h){return{boxes:Wt(h)}},ctts:function(h){var m=new DataView(h.buffer,h.byteOffset,h.byteLength),y={version:m.getUint8(0),flags:new Uint8Array(h.subarray(1,4)),compositionOffsets:[]},v=m.getUint32(4),_;for(_=8;v;_+=8,v--)y.compositionOffsets.push({sampleCount:m.getUint32(_),sampleOffset:m[y.version===0?"getUint32":"getInt32"](_+4)});return y},stss:function(h){var m=new DataView(h.buffer,h.byteOffset,h.byteLength),y={version:m.getUint8(0),flags:new Uint8Array(h.subarray(1,4)),syncSamples:[]},v=m.getUint32(4),_;for(_=8;v;_+=4,v--)y.syncSamples.push(m.getUint32(_));return y},stco:function(h){var m=new DataView(h.buffer,h.byteOffset,h.byteLength),y={version:h[0],flags:new Uint8Array(h.subarray(1,4)),chunkOffsets:[]},v=m.getUint32(4),_;for(_=8;v;_+=4,v--)y.chunkOffsets.push(m.getUint32(_));return y},stsc:function(h){var m=new DataView(h.buffer,h.byteOffset,h.byteLength),y=m.getUint32(4),v={version:h[0],flags:new Uint8Array(h.subarray(1,4)),sampleToChunks:[]},_;for(_=8;y;_+=12,y--)v.sampleToChunks.push({firstChunk:m.getUint32(_),samplesPerChunk:m.getUint32(_+4),sampleDescriptionIndex:m.getUint32(_+8)});return v},stsd:function(h){return{version:h[0],flags:new Uint8Array(h.subarray(1,4)),sampleDescriptions:Wt(h.subarray(8))}},stsz:function(h){var m=new DataView(h.buffer,h.byteOffset,h.byteLength),y={version:h[0],flags:new Uint8Array(h.subarray(1,4)),sampleSize:m.getUint32(4),entries:[]},v;for(v=12;v>6,sampleHasRedundancy:(h[21]&48)>>4,samplePaddingValue:(h[21]&14)>>1,sampleIsDifferenceSample:!!(h[21]&1),sampleDegradationPriority:m.getUint16(22)}},trun:Kd,"url ":function(h){return{version:h[0],flags:new Uint8Array(h.subarray(1,4))}},vmhd:function(h){var m=new DataView(h.buffer,h.byteOffset,h.byteLength);return{version:h[0],flags:new Uint8Array(h.subarray(1,4)),graphicsmode:m.getUint16(4),opcolor:new Uint16Array([m.getUint16(6),m.getUint16(8),m.getUint16(10)])}}};Wt=function(h){for(var m=0,y=[],v,_,x,k,R,I=new ArrayBuffer(h.length),N=new Uint8Array(I),j=0;j1?m+_:h.byteLength,R=(kn[x]||function(te){return{data:te}})(h.subarray(m+8,k)),R.size=_,R.type=x,y.push(R),m=k;return y},Xn=function(h,m){var y;return m=m||0,y=new Array(m*2+1).join(" "),h.map(function(v,_){return y+v.type+`
@@ -480,7 +480,7 @@ browserWorkerPolyFill(self);
`)}).join(`
`)+(v.boxes?`
`+Xn(v.boxes,m+1):"")}).join(`
-`)};var sr={inspect:Wt,textify:Xn,parseType:Yr,findBox:Jd,parseTraf:kn.traf,parseTfdt:kn.tfdt,parseHdlr:kn.hdlr,parseTfhd:kn.tfhd,parseTrun:kn.trun,parseSidx:kn.sidx},wt=function(h){for(var m=0,y=String.fromCharCode(h[m]),v="";y!=="\0";)v+=y,m++,y=String.fromCharCode(h[m]);return v+=y,v},Xu={uint8ToCString:wt},nl=Xu.uint8ToCString,eh=u.getUint64,Wr=function(h){var m=4,y=h[0],v,_,x,k,R,I,N,j;if(y===0){v=nl(h.subarray(m)),m+=v.length,_=nl(h.subarray(m)),m+=_.length;var te=new DataView(h.buffer);x=te.getUint32(m),m+=4,R=te.getUint32(m),m+=4,I=te.getUint32(m),m+=4,N=te.getUint32(m),m+=4}else if(y===1){var te=new DataView(h.buffer);x=te.getUint32(m),m+=4,k=eh(h.subarray(m)),m+=8,I=te.getUint32(m),m+=4,N=te.getUint32(m),m+=4,v=nl(h.subarray(m)),m+=v.length,_=nl(h.subarray(m)),m+=_.length}j=new Uint8Array(h.subarray(m,h.byteLength));var ge={scheme_id_uri:v,value:_,timescale:x||1,presentation_time:k,presentation_time_delta:R,event_duration:I,id:N,message_data:j};return xs(y,ge)?ge:void 0},sl=function(h,m,y,v){return h||h===0?h/m:v+y/m},xs=function(h,m){var y=m.scheme_id_uri!=="\0",v=h===0&&rl(m.presentation_time_delta)&&y,_=h===1&&rl(m.presentation_time)&&y;return!(h>1)&&v||_},rl=function(h){return h!==void 0||h!==null},al={parseEmsgBox:Wr,scaleTime:sl},Qr;typeof window<"u"?Qr=window:typeof s<"u"?Qr=s:typeof self<"u"?Qr=self:Qr={};var Yu=Qr,ol=Ha.toUnsigned,Bi=Ha.toHexString,lt=za,Es=$u,th=al,am=Ss,Jy=Kd,ih=Jo,Wu=u.getUint64,nh,sh,rh,ll,ah,Qu,oh,ul=Yu,lh=jr.parseId3Frames;nh=function(h){var m={},y=lt(h,["moov","trak"]);return y.reduce(function(v,_){var x,k,R,I,N;return x=lt(_,["tkhd"])[0],!x||(k=x[0],R=k===0?12:20,I=ol(x[R]<<24|x[R+1]<<16|x[R+2]<<8|x[R+3]),N=lt(_,["mdia","mdhd"])[0],!N)?null:(k=N[0],R=k===0?12:20,v[I]=ol(N[R]<<24|N[R+1]<<16|N[R+2]<<8|N[R+3]),v)},m)},sh=function(h,m){var y;y=lt(m,["moof","traf"]);var v=y.reduce(function(_,x){var k=lt(x,["tfhd"])[0],R=ol(k[4]<<24|k[5]<<16|k[6]<<8|k[7]),I=h[R]||9e4,N=lt(x,["tfdt"])[0],j=new DataView(N.buffer,N.byteOffset,N.byteLength),te;N[0]===1?te=Wu(N.subarray(4,12)):te=j.getUint32(4);let ge;return typeof te=="bigint"?ge=te/ul.BigInt(I):typeof te=="number"&&!isNaN(te)&&(ge=te/I),ge11?(_.codec+=".",_.codec+=Bi(ue[9]),_.codec+=Bi(ue[10]),_.codec+=Bi(ue[11])):_.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(_.codec)?(ue=ge.subarray(28),Le=Es(ue.subarray(4,8)),Le==="esds"&&ue.length>20&&ue[19]!==0?(_.codec+="."+Bi(ue[19]),_.codec+="."+Bi(ue[20]>>>2&63).replace(/^0/,"")):_.codec="mp4a.40.2"):_.codec=_.codec.toLowerCase())}var Pe=lt(v,["mdia","mdhd"])[0];Pe&&(_.timescale=Qu(Pe)),y.push(_)}),y},oh=function(h,m=0){var y=lt(h,["emsg"]);return y.map(v=>{var _=th.parseEmsgBox(new Uint8Array(v)),x=lh(_.message_data);return{cueTime:th.scaleTime(_.presentation_time,_.timescale,_.presentation_time_delta,m),duration:th.scaleTime(_.event_duration,_.timescale),frames:x}})};var pn={findBox:lt,parseType:Es,timescale:nh,startTime:sh,compositionStartTime:rh,videoTrackIds:ll,tracks:ah,getTimescaleFromMediaHeader:Qu,getEmsgID3:oh};const{parseTrun:rr}=sr,{findBox:qa}=pn;var cl=Yu,dl=function(h){var m=qa(h,["moof","traf"]),y=qa(h,["mdat"]),v=[];return y.forEach(function(_,x){var k=m[x];v.push({mdat:_,traf:k})}),v},hl=function(h,m,y){var v=m,_=y.defaultSampleDuration||0,x=y.defaultSampleSize||0,k=y.trackId,R=[];return h.forEach(function(I){var N=rr(I),j=N.samples;j.forEach(function(te){te.duration===void 0&&(te.duration=_),te.size===void 0&&(te.size=x),te.trackId=k,te.dts=v,te.compositionTimeOffset===void 0&&(te.compositionTimeOffset=0),typeof v=="bigint"?(te.pts=v+cl.BigInt(te.compositionTimeOffset),v+=cl.BigInt(te.duration)):(te.pts=v+te.compositionTimeOffset,v+=te.duration)}),R=R.concat(j)}),R},uh={getMdatTrafPairs:dl,parseSamples:hl},ev=Bd.discardEmulationPreventionBytes,om=wu.CaptionStream,Ku=za,ch=Jo,dh=Ss,{getMdatTrafPairs:We,parseSamples:he}=uh,Va=function(h,m){for(var y=h,v=0;v0?ch(j[0]).baseMediaDecodeTime:0,ge=Ku(k,["trun"]),ue,Le;m===N&&ge.length>0&&(ue=he(ge,te,I),Le=Zu(x,ue,N),y[N]||(y[N]={seiNals:[],logs:[]}),y[N].seiNals=y[N].seiNals.concat(Le.seiNals),y[N].logs=y[N].logs.concat(Le.logs))}),y},hh=function(h,m,y){var v;if(m===null)return null;v=Bt(h,m);var _=v[m]||{};return{seiNals:_.seiNals,logs:_.logs,timescale:y}},fh=function(){var h=!1,m,y,v,_,x,k;this.isInitialized=function(){return h},this.init=function(R){m=new om,h=!0,k=R?R.isPartial:!1,m.on("data",function(I){I.startTime=I.startPts/_,I.endTime=I.endPts/_,x.captions.push(I),x.captionStreams[I.stream]=!0}),m.on("log",function(I){x.logs.push(I)})},this.isNewInit=function(R,I){return R&&R.length===0||I&&typeof I=="object"&&Object.keys(I).length===0?!1:v!==R[0]||_!==I[v]},this.parse=function(R,I,N){var j;if(this.isInitialized()){if(!I||!N)return null;if(this.isNewInit(I,N))v=I[0],_=N[v];else if(v===null||!_)return y.push(R),null}else return null;for(;y.length>0;){var te=y.shift();this.parse(te,I,N)}return j=hh(R,v,_),j&&j.logs&&(x.logs=x.logs.concat(j.logs)),j===null||!j.seiNals?x.logs.length?{logs:x.logs,captions:[],captionStreams:[]}:null:(this.pushNals(j.seiNals),this.flushStream(),x)},this.pushNals=function(R){if(!this.isInitialized()||!R||R.length===0)return null;R.forEach(function(I){m.push(I)})},this.flushStream=function(){if(!this.isInitialized())return null;k?m.partialFlush():m.flush()},this.clearParsedCaptions=function(){x.captions=[],x.captionStreams={},x.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;m.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){y=[],v=null,_=null,x?this.clearParsedCaptions():x={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},lm=fh;const{parseTfdt:ph}=sr,ar=za,{getTimescaleFromMediaHeader:mh}=pn,{parseSamples:gh,getMdatTrafPairs:yh}=uh;var ut=function(){let h=9e4;this.init=function(m){const y=ar(m,["moov","trak","mdia","mdhd"])[0];y&&(h=mh(y))},this.parseSegment=function(m){const y=[],v=yh(m);let _=0;return v.forEach(function(x){const k=x.mdat,R=x.traf,I=ar(R,["tfdt"])[0],N=ar(R,["tfhd"])[0],j=ar(R,["trun"]);if(I&&(_=ph(I).baseMediaDecodeTime),j.length&&N){const te=gh(j,_,N);let ge=0;te.forEach(function(ue){const Le="utf-8",Pe=new TextDecoder(Le),qt=k.slice(ge,ge+ue.size);if(ar(qt,["vtte"])[0]){ge+=ue.size;return}ar(qt,["vttc"]).forEach(function(lr){const Zr=ar(lr,["payl"])[0],Xa=ar(lr,["sttg"])[0],Ya=ue.pts/h,Wa=(ue.pts+ue.duration)/h;let bt,Qa;if(Zr)try{bt=Pe.decode(Zr)}catch(Yi){console.error(Yi)}if(Xa)try{Qa=Pe.decode(Xa)}catch(Yi){console.error(Yi)}ue.duration&&bt&&y.push({cueText:bt,start:Ya,end:Wa,settings:Qa})}),ge+=ue.size})}}),y}},fl=zo,$a=function(h){var m=h[1]&31;return m<<=8,m|=h[2],m},On=function(h){return!!(h[1]&64)},Yn=function(h){var m=0;return(h[3]&48)>>>4>1&&(m+=h[4]+1),m},Rn=function(h,m){var y=$a(h);return y===0?"pat":y===m?"pmt":m?"pes":null},vh=function(h){var m=On(h),y=4+Yn(h);return m&&(y+=h[y]+1),(h[y+10]&31)<<8|h[y+11]},Ga=function(h){var m={},y=On(h),v=4+Yn(h);if(y&&(v+=h[v]+1),!!(h[v+5]&1)){var _,x,k;_=(h[v+1]&15)<<8|h[v+2],x=3+_-4,k=(h[v+10]&15)<<8|h[v+11];for(var R=12+k;R=h.byteLength)return null;var v=null,_;return _=h[y+7],_&192&&(v={},v.pts=(h[y+9]&14)<<27|(h[y+10]&255)<<20|(h[y+11]&254)<<12|(h[y+12]&255)<<5|(h[y+13]&254)>>>3,v.pts*=4,v.pts+=(h[y+13]&6)>>>1,v.dts=v.pts,_&64&&(v.dts=(h[y+14]&14)<<27|(h[y+15]&255)<<20|(h[y+16]&254)<<12|(h[y+17]&255)<<5|(h[y+18]&254)>>>3,v.dts*=4,v.dts+=(h[y+18]&6)>>>1)),v},ml=function(h){switch(h){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},Ju=function(h){for(var m=4+Yn(h),y=h.subarray(m),v=0,_=0,x=!1,k;_3&&(k=ml(y[_+3]&31),k==="slice_layer_without_partitioning_rbsp_idr"&&(x=!0)),x},um={parseType:Rn,parsePat:vh,parsePmt:Ga,parsePayloadUnitStartIndicator:On,parsePesType:bh,parsePesTime:pl,videoPacketContainsKeyFrame:Ju},_h=zo,Kr=zd.handleRollover,ct={};ct.ts=um,ct.aac=Fu;var or=ot.ONE_SECOND_IN_TS,ai=188,mn=71,Th=function(h,m){for(var y=0,v=ai,_,x;v=0;){if(h[v]===mn&&(h[_]===mn||_===h.byteLength)){switch(x=h.subarray(v,_),k=ct.ts.parseType(x,m.pid),k){case"pes":R=ct.ts.parsePesType(x,m.table),I=ct.ts.parsePayloadUnitStartIndicator(x),R==="audio"&&I&&(N=ct.ts.parsePesTime(x),N&&(N.type="audio",y.audio.push(N),j=!0));break}if(j)break;v-=ai,_-=ai;continue}v--,_--}},cm=function(h,m,y){for(var v=0,_=ai,x,k,R,I,N,j,te,ge,ue=!1,Le={data:[],size:0};_=0;){if(h[v]===mn&&h[_]===mn){switch(x=h.subarray(v,_),k=ct.ts.parseType(x,m.pid),k){case"pes":R=ct.ts.parsePesType(x,m.table),I=ct.ts.parsePayloadUnitStartIndicator(x),R==="video"&&I&&(N=ct.ts.parsePesTime(x),N&&(N.type="video",y.video.push(N),ue=!0));break}if(ue)break;v-=ai,_-=ai;continue}v--,_--}},dm=function(h,m){if(h.audio&&h.audio.length){var y=m;(typeof y>"u"||isNaN(y))&&(y=h.audio[0].dts),h.audio.forEach(function(x){x.dts=Kr(x.dts,y),x.pts=Kr(x.pts,y),x.dtsTime=x.dts/or,x.ptsTime=x.pts/or})}if(h.video&&h.video.length){var v=m;if((typeof v>"u"||isNaN(v))&&(v=h.video[0].dts),h.video.forEach(function(x){x.dts=Kr(x.dts,v),x.pts=Kr(x.pts,v),x.dtsTime=x.dts/or,x.ptsTime=x.pts/or}),h.firstKeyFrame){var _=h.firstKeyFrame;_.dts=Kr(_.dts,v),_.pts=Kr(_.pts,v),_.dtsTime=_.dts/or,_.ptsTime=_.pts/or}}},tv=function(h){for(var m=!1,y=0,v=null,_=null,x=0,k=0,R;h.length-k>=3;){var I=ct.aac.parseType(h,k);switch(I){case"timed-metadata":if(h.length-k<10){m=!0;break}if(x=ct.aac.parseId3TagSize(h,k),x>h.length){m=!0;break}_===null&&(R=h.subarray(k,k+x),_=ct.aac.parseAacTimestamp(R)),k+=x;break;case"audio":if(h.length-k<7){m=!0;break}if(x=ct.aac.parseAdtsSize(h,k),x>h.length){m=!0;break}v===null&&(R=h.subarray(k,k+x),v=ct.aac.parseSampleRate(R)),y++,k+=x;break;default:k++;break}if(m)return null}if(v===null||_===null)return null;var N=or/v,j={audio:[{type:"audio",dts:_,pts:_},{type:"audio",dts:_+y*1024*N,pts:_+y*1024*N}]};return j},hm=function(h){var m={pid:null,table:null},y={};Th(h,m);for(var v in m.table)if(m.table.hasOwnProperty(v)){var _=m.table[v];switch(_){case _h.H264_STREAM_TYPE:y.video=[],cm(h,m,y),y.video.length===0&&delete y.video;break;case _h.ADTS_STREAM_TYPE:y.audio=[],Sh(h,m,y),y.audio.length===0&&delete y.audio;break}}return y},fm=function(h,m){var y=ct.aac.isLikelyAacData(h),v;return y?v=tv(h):v=hm(h),!v||!v.audio&&!v.video?null:(dm(v,m),v)},pm={inspect:fm,parseAudioPes_:Sh};const xh=function(h,m){m.on("data",function(y){const v=y.initSegment;y.initSegment={data:v.buffer,byteOffset:v.byteOffset,byteLength:v.byteLength};const _=y.data;y.data=_.buffer,h.postMessage({action:"data",segment:y,byteOffset:_.byteOffset,byteLength:_.byteLength},[y.data])}),m.on("done",function(y){h.postMessage({action:"done"})}),m.on("gopInfo",function(y){h.postMessage({action:"gopInfo",gopInfo:y})}),m.on("videoSegmentTimingInfo",function(y){const v={start:{decode:ot.videoTsToSeconds(y.start.dts),presentation:ot.videoTsToSeconds(y.start.pts)},end:{decode:ot.videoTsToSeconds(y.end.dts),presentation:ot.videoTsToSeconds(y.end.pts)},baseMediaDecodeTime:ot.videoTsToSeconds(y.baseMediaDecodeTime)};y.prependedContentDuration&&(v.prependedContentDuration=ot.videoTsToSeconds(y.prependedContentDuration)),h.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:v})}),m.on("audioSegmentTimingInfo",function(y){const v={start:{decode:ot.videoTsToSeconds(y.start.dts),presentation:ot.videoTsToSeconds(y.start.pts)},end:{decode:ot.videoTsToSeconds(y.end.dts),presentation:ot.videoTsToSeconds(y.end.pts)},baseMediaDecodeTime:ot.videoTsToSeconds(y.baseMediaDecodeTime)};y.prependedContentDuration&&(v.prependedContentDuration=ot.videoTsToSeconds(y.prependedContentDuration)),h.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:v})}),m.on("id3Frame",function(y){h.postMessage({action:"id3Frame",id3Frame:y})}),m.on("caption",function(y){h.postMessage({action:"caption",caption:y})}),m.on("trackinfo",function(y){h.postMessage({action:"trackinfo",trackInfo:y})}),m.on("audioTimingInfo",function(y){h.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:ot.videoTsToSeconds(y.start),end:ot.videoTsToSeconds(y.end)}})}),m.on("videoTimingInfo",function(y){h.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:ot.videoTsToSeconds(y.start),end:ot.videoTsToSeconds(y.end)}})}),m.on("log",function(y){h.postMessage({action:"log",log:y})})};class Eh{constructor(m,y){this.options=y||{},this.self=m,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new im.Transmuxer(this.options),xh(this.self,this.transmuxer)}pushMp4Captions(m){this.captionParser||(this.captionParser=new lm,this.captionParser.init());const y=new Uint8Array(m.data,m.byteOffset,m.byteLength),v=this.captionParser.parse(y,m.trackIds,m.timescales);this.self.postMessage({action:"mp4Captions",captions:v&&v.captions||[],logs:v&&v.logs||[],data:y.buffer},[y.buffer])}initMp4WebVttParser(m){this.webVttParser||(this.webVttParser=new ut);const y=new Uint8Array(m.data,m.byteOffset,m.byteLength);this.webVttParser.init(y)}getMp4WebVttText(m){this.webVttParser||(this.webVttParser=new ut);const y=new Uint8Array(m.data,m.byteOffset,m.byteLength),v=this.webVttParser.parseSegment(y);this.self.postMessage({action:"getMp4WebVttText",mp4VttCues:v||[],data:y.buffer},[y.buffer])}probeMp4StartTime({timescales:m,data:y}){const v=pn.startTime(m,y);this.self.postMessage({action:"probeMp4StartTime",startTime:v,data:y},[y.buffer])}probeMp4Tracks({data:m}){const y=pn.tracks(m);this.self.postMessage({action:"probeMp4Tracks",tracks:y,data:m},[m.buffer])}probeEmsgID3({data:m,offset:y}){const v=pn.getEmsgID3(m,y);this.self.postMessage({action:"probeEmsgID3",id3Frames:v,emsgData:m},[m.buffer])}probeTs({data:m,baseStartTime:y}){const v=typeof y=="number"&&!isNaN(y)?y*ot.ONE_SECOND_IN_TS:void 0,_=pm.inspect(m,v);let x=null;_&&(x={hasVideo:_.video&&_.video.length===2||!1,hasAudio:_.audio&&_.audio.length===2||!1},x.hasVideo&&(x.videoStart=_.video[0].ptsTime),x.hasAudio&&(x.audioStart=_.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:x,data:m},[m.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(m){const y=new Uint8Array(m.data,m.byteOffset,m.byteLength);this.transmuxer.push(y)}reset(){this.transmuxer.reset()}setTimestampOffset(m){const y=m.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(ot.secondsToVideoTs(y)))}setAudioAppendStart(m){this.transmuxer.setAudioAppendStart(Math.ceil(ot.secondsToVideoTs(m.appendStart)))}setRemux(m){this.transmuxer.setRemux(m.remux)}flush(m){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(m){this.transmuxer.alignGopsWith(m.gopsToAlignWith.slice())}}self.onmessage=function(h){if(h.data.action==="init"&&h.data.options){this.messageHandlers=new Eh(self,h.data.options);return}this.messageHandlers||(this.messageHandlers=new Eh(self)),h.data&&h.data.action&&h.data.action!=="init"&&this.messageHandlers[h.data.action]&&this.messageHandlers[h.data.action](h.data)}}));var W4=qS(Y4);const Q4=(s,e,i)=>{const{type:r,initSegment:o,captions:u,captionStreams:c,metadata:p,videoFrameDtsTime:g,videoFramePtsTime:b}=s.data.segment;e.buffer.push({captions:u,captionStreams:c,metadata:p});const S=s.data.segment.boxes||{data:s.data.segment.data},E={type:r,data:new Uint8Array(S.data,S.data.byteOffset,S.data.byteLength),initSegment:new Uint8Array(o.data,o.byteOffset,o.byteLength)};typeof g<"u"&&(E.videoFrameDtsTime=g),typeof b<"u"&&(E.videoFramePtsTime=b),i(E)},K4=({transmuxedData:s,callback:e})=>{s.buffer=[],e(s)},Z4=(s,e)=>{e.gopInfo=s.data.gopInfo},GS=s=>{const{transmuxer:e,bytes:i,audioAppendStart:r,gopsToAlignWith:o,remux:u,onData:c,onTrackInfo:p,onAudioTimingInfo:g,onVideoTimingInfo:b,onVideoSegmentTimingInfo:S,onAudioSegmentTimingInfo:E,onId3:A,onCaptions:M,onDone:U,onEndedTimeline:D,onTransmuxerLog:z,isEndOfTimeline:H,segment:Y,triggerSegmentEventFn:V}=s,Q={buffer:[]};let Z=H;const W=ee=>{e.currentTransmux===s&&(ee.data.action==="data"&&Q4(ee,Q,c),ee.data.action==="trackinfo"&&p(ee.data.trackInfo),ee.data.action==="gopInfo"&&Z4(ee,Q),ee.data.action==="audioTimingInfo"&&g(ee.data.audioTimingInfo),ee.data.action==="videoTimingInfo"&&b(ee.data.videoTimingInfo),ee.data.action==="videoSegmentTimingInfo"&&S(ee.data.videoSegmentTimingInfo),ee.data.action==="audioSegmentTimingInfo"&&E(ee.data.audioSegmentTimingInfo),ee.data.action==="id3Frame"&&A([ee.data.id3Frame],ee.data.id3Frame.dispatchType),ee.data.action==="caption"&&M(ee.data.caption),ee.data.action==="endedtimeline"&&(Z=!1,D()),ee.data.action==="log"&&z(ee.data.log),ee.data.type==="transmuxed"&&(Z||(e.onmessage=null,K4({transmuxedData:Q,callback:U}),XS(e))))},G=()=>{const ee={message:"Received an error message from the transmuxer worker",metadata:{errorType:$.Error.StreamingFailedToTransmuxSegment,segmentInfo:Po({segment:Y})}};U(null,ee)};if(e.onmessage=W,e.onerror=G,r&&e.postMessage({action:"setAudioAppendStart",appendStart:r}),Array.isArray(o)&&e.postMessage({action:"alignGopsWith",gopsToAlignWith:o}),typeof u<"u"&&e.postMessage({action:"setRemux",remux:u}),i.byteLength){const ee=i instanceof ArrayBuffer?i:i.buffer,oe=i instanceof ArrayBuffer?0:i.byteOffset;V({type:"segmenttransmuxingstart",segment:Y}),e.postMessage({action:"push",data:ee,byteOffset:oe,byteLength:i.byteLength},[ee])}H&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},XS=s=>{s.currentTransmux=null,s.transmuxQueue.length&&(s.currentTransmux=s.transmuxQueue.shift(),typeof s.currentTransmux=="function"?s.currentTransmux():GS(s.currentTransmux))},YS=(s,e)=>{s.postMessage({action:e}),XS(s)},WS=(s,e)=>{if(!e.currentTransmux){e.currentTransmux=s,YS(e,s);return}e.transmuxQueue.push(YS.bind(null,e,s))},J4=s=>{WS("reset",s)},eM=s=>{WS("endTimeline",s)},QS=s=>{if(!s.transmuxer.currentTransmux){s.transmuxer.currentTransmux=s,GS(s);return}s.transmuxer.transmuxQueue.push(s)};var wy={reset:J4,endTimeline:eM,transmux:QS,createTransmuxer:s=>{const e=new W4;e.currentTransmux=null,e.transmuxQueue=[];const i=e.terminate;return e.terminate=()=>(e.currentTransmux=null,e.transmuxQueue.length=0,i.call(e)),e.postMessage({action:"init",options:s}),e}};const _u=function(s){const e=s.transmuxer,i=s.endAction||s.action,r=s.callback,o=Ft({},s,{endAction:null,transmuxer:null,callback:null}),u=c=>{c.data.action===i&&(e.removeEventListener("message",u),c.data.data&&(c.data.data=new Uint8Array(c.data.data,s.byteOffset||0,s.byteLength||c.data.data.byteLength),s.data&&(s.data=c.data.data)),r(c.data))};if(e.addEventListener("message",u),s.data){const c=s.data instanceof ArrayBuffer;o.byteOffset=c?0:s.data.byteOffset,o.byteLength=s.data.byteLength;const p=[c?s.data:s.data.buffer];e.postMessage(o,p)}else e.postMessage(o)},zs={FAILURE:2,TIMEOUT:-101,ABORTED:-102},KS="wvtt",ky=s=>{s.forEach(e=>{e.abort()})},tM=s=>({bandwidth:s.bandwidth,bytesReceived:s.bytesReceived||0,roundTripTime:s.roundTripTime||0}),iM=s=>{const e=s.target,r={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-e.requestTime||0};return r.bytesReceived=s.loaded,r.bandwidth=Math.floor(r.bytesReceived/r.roundTripTime*8*1e3),r},Oy=(s,e)=>{const{requestType:i}=e,r=No({requestType:i,request:e,error:s});return e.timedout?{status:e.status,message:"HLS request timed-out at URL: "+e.uri,code:zs.TIMEOUT,xhr:e,metadata:r}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:zs.ABORTED,xhr:e,metadata:r}:s?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:zs.FAILURE,xhr:e,metadata:r}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:zs.FAILURE,xhr:e,metadata:r}:null},ZS=(s,e,i,r)=>(o,u)=>{const c=u.response,p=Oy(o,u);if(p)return i(p,s);if(c.byteLength!==16)return i({status:u.status,message:"Invalid HLS key at URL: "+u.uri,code:zs.FAILURE,xhr:u},s);const g=new DataView(c),b=new Uint32Array([g.getUint32(0),g.getUint32(4),g.getUint32(8),g.getUint32(12)]);for(let E=0;E{e===KS&&s.transmuxer.postMessage({action:"initMp4WebVttParser",data:s.map.bytes})},sM=(s,e,i)=>{e===KS&&_u({action:"getMp4WebVttText",data:s.bytes,transmuxer:s.transmuxer,callback:({data:r,mp4VttCues:o})=>{s.bytes=r,i(null,s,{mp4VttCues:o})}})},JS=(s,e)=>{const i=m0(s.map.bytes);if(i!=="mp4"){const r=s.map.resolvedUri||s.map.uri,o=i||"unknown";return e({internal:!0,message:`Found unsupported ${o} container for initialization segment at URL: ${r}`,code:zs.FAILURE,metadata:{mediaType:o}})}_u({action:"probeMp4Tracks",data:s.map.bytes,transmuxer:s.transmuxer,callback:({tracks:r,data:o})=>(s.map.bytes=o,r.forEach(function(u){s.map.tracks=s.map.tracks||{},!s.map.tracks[u.type]&&(s.map.tracks[u.type]=u,typeof u.id=="number"&&u.timescale&&(s.map.timescales=s.map.timescales||{},s.map.timescales[u.id]=u.timescale),u.type==="text"&&nM(s,u.codec))}),e(null))})},rM=({segment:s,finishProcessingFn:e,triggerSegmentEventFn:i})=>(r,o)=>{const u=Oy(r,o);if(u)return e(u,s);const c=new Uint8Array(o.response);if(i({type:"segmentloaded",segment:s}),s.map.key)return s.map.encryptedBytes=c,e(null,s);s.map.bytes=c,JS(s,function(p){if(p)return p.xhr=o,p.status=o.status,e(p,s);e(null,s)})},aM=({segment:s,finishProcessingFn:e,responseType:i,triggerSegmentEventFn:r})=>(o,u)=>{const c=Oy(o,u);if(c)return e(c,s);r({type:"segmentloaded",segment:s});const p=i==="arraybuffer"||!u.responseText?u.response:G4(u.responseText.substring(s.lastReachedChar||0));return s.stats=tM(u),s.key?s.encryptedBytes=new Uint8Array(p):s.bytes=new Uint8Array(p),e(null,s)},oM=({segment:s,bytes:e,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M})=>{const U=s.map&&s.map.tracks||{},D=!!(U.audio&&U.video);let z=r.bind(null,s,"audio","start");const H=r.bind(null,s,"audio","end");let Y=r.bind(null,s,"video","start");const V=r.bind(null,s,"video","end"),Q=()=>QS({bytes:e,transmuxer:s.transmuxer,audioAppendStart:s.audioAppendStart,gopsToAlignWith:s.gopsToAlignWith,remux:D,onData:Z=>{Z.type=Z.type==="combined"?"video":Z.type,S(s,Z)},onTrackInfo:Z=>{i&&(D&&(Z.isMuxed=!0),i(s,Z))},onAudioTimingInfo:Z=>{z&&typeof Z.start<"u"&&(z(Z.start),z=null),H&&typeof Z.end<"u"&&H(Z.end)},onVideoTimingInfo:Z=>{Y&&typeof Z.start<"u"&&(Y(Z.start),Y=null),V&&typeof Z.end<"u"&&V(Z.end)},onVideoSegmentTimingInfo:Z=>{const W={pts:{start:Z.start.presentation,end:Z.end.presentation},dts:{start:Z.start.decode,end:Z.end.decode}};M({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:W}),o(Z)},onAudioSegmentTimingInfo:Z=>{const W={pts:{start:Z.start.pts,end:Z.end.pts},dts:{start:Z.start.dts,end:Z.end.dts}};M({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:W}),u(Z)},onId3:(Z,W)=>{c(s,Z,W)},onCaptions:Z=>{p(s,[Z])},isEndOfTimeline:g,onEndedTimeline:()=>{b()},onTransmuxerLog:A,onDone:(Z,W)=>{E&&(Z.type=Z.type==="combined"?"video":Z.type,M({type:"segmenttransmuxingcomplete",segment:s}),E(W,s,Z))},segment:s,triggerSegmentEventFn:M});_u({action:"probeTs",transmuxer:s.transmuxer,data:e,baseStartTime:s.baseStartTime,callback:Z=>{s.bytes=e=Z.data;const W=Z.result;W&&(i(s,{hasAudio:W.hasAudio,hasVideo:W.hasVideo,isMuxed:D}),i=null),Q()}})},ex=({segment:s,bytes:e,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M})=>{let U=new Uint8Array(e);if(NR(U)){s.isFmp4=!0;const{tracks:D}=s.map;if(D.text&&(!D.audio||!D.video)){S(s,{data:U,type:"text"}),sM(s,D.text.codec,E);return}const H={isFmp4:!0,hasVideo:!!D.video,hasAudio:!!D.audio};D.audio&&D.audio.codec&&D.audio.codec!=="enca"&&(H.audioCodec=D.audio.codec),D.video&&D.video.codec&&D.video.codec!=="encv"&&(H.videoCodec=D.video.codec),D.video&&D.audio&&(H.isMuxed=!0),i(s,H);const Y=(V,Q)=>{S(s,{data:U,type:H.hasAudio&&!H.isMuxed?"audio":"video"}),Q&&Q.length&&c(s,Q),V&&V.length&&p(s,V),E(null,s,{})};_u({action:"probeMp4StartTime",timescales:s.map.timescales,data:U,transmuxer:s.transmuxer,callback:({data:V,startTime:Q})=>{e=V.buffer,s.bytes=U=V,H.hasAudio&&!H.isMuxed&&r(s,"audio","start",Q),H.hasVideo&&r(s,"video","start",Q),_u({action:"probeEmsgID3",data:U,transmuxer:s.transmuxer,offset:Q,callback:({emsgData:Z,id3Frames:W})=>{if(e=Z.buffer,s.bytes=U=Z,!D.video||!Z.byteLength||!s.transmuxer){Y(void 0,W);return}_u({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:s.transmuxer,data:U,timescales:s.map.timescales,trackIds:[D.video.id],callback:G=>{e=G.data.buffer,s.bytes=U=G.data,G.logs.forEach(function(ee){A(pt(ee,{stream:"mp4CaptionParser"}))}),Y(G.captions,W)}})}})}});return}if(!s.transmuxer){E(null,s,{});return}if(typeof s.container>"u"&&(s.container=m0(U)),s.container!=="ts"&&s.container!=="aac"){i(s,{hasAudio:!1,hasVideo:!1}),E(null,s,{});return}oM({segment:s,bytes:e,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M})},tx=function({id:s,key:e,encryptedBytes:i,decryptionWorker:r,segment:o,doneFn:u},c){const p=b=>{if(b.data.source===s){r.removeEventListener("message",p);const S=b.data.decrypted;c(new Uint8Array(S.bytes,S.byteOffset,S.byteLength))}};r.onerror=()=>{const b="An error occurred in the decryption worker",S=Po({segment:o}),E={message:b,metadata:{error:new Error(b),errorType:$.Error.StreamingFailedToDecryptSegment,segmentInfo:S,keyInfo:{uri:o.key.resolvedUri||o.map.key.resolvedUri}}};u(E,o)},r.addEventListener("message",p);let g;e.bytes.slice?g=e.bytes.slice():g=new Uint32Array(Array.prototype.slice.call(e.bytes)),r.postMessage(NS({source:s,encrypted:i,key:g,iv:e.iv}),[i.buffer,g.buffer])},lM=({decryptionWorker:s,segment:e,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M})=>{M({type:"segmentdecryptionstart"}),tx({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:s,segment:e,doneFn:E},U=>{e.bytes=U,M({type:"segmentdecryptioncomplete",segment:e}),ex({segment:e,bytes:e.bytes,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M})})},uM=({activeXhrs:s,decryptionWorker:e,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M})=>{let U=0,D=!1;return(z,H)=>{if(!D){if(z)return D=!0,ky(s),E(z,H);if(U+=1,U===s.length){const Y=function(){if(H.encryptedBytes)return lM({decryptionWorker:e,segment:H,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M});ex({segment:H,bytes:H.bytes,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M})};if(H.endOfAllRequests=Date.now(),H.map&&H.map.encryptedBytes&&!H.map.bytes)return M({type:"segmentdecryptionstart",segment:H}),tx({decryptionWorker:e,id:H.requestId+"-init",encryptedBytes:H.map.encryptedBytes,key:H.map.key,segment:H,doneFn:E},V=>{H.map.bytes=V,M({type:"segmentdecryptioncomplete",segment:H}),JS(H,Q=>{if(Q)return ky(s),E(Q,H);Y()})});Y()}}}},cM=({loadendState:s,abortFn:e})=>i=>{i.target.aborted&&e&&!s.calledAbortFn&&(e(),s.calledAbortFn=!0)},dM=({segment:s,progressFn:e,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S})=>E=>{if(!E.target.aborted)return s.stats=pt(s.stats,iM(E)),!s.stats.firstBytesReceivedAt&&s.stats.bytesReceived&&(s.stats.firstBytesReceivedAt=Date.now()),e(E,s)},hM=({xhr:s,xhrOptions:e,decryptionWorker:i,segment:r,abortFn:o,progressFn:u,trackInfoFn:c,timingInfoFn:p,videoSegmentTimingInfoFn:g,audioSegmentTimingInfoFn:b,id3Fn:S,captionsFn:E,isEndOfTimeline:A,endedTimelineFn:M,dataFn:U,doneFn:D,onTransmuxerLog:z,triggerSegmentEventFn:H})=>{const Y=[],V=uM({activeXhrs:Y,decryptionWorker:i,trackInfoFn:c,timingInfoFn:p,videoSegmentTimingInfoFn:g,audioSegmentTimingInfoFn:b,id3Fn:S,captionsFn:E,isEndOfTimeline:A,endedTimelineFn:M,dataFn:U,doneFn:D,onTransmuxerLog:z,triggerSegmentEventFn:H});if(r.key&&!r.key.bytes){const ee=[r.key];r.map&&!r.map.bytes&&r.map.key&&r.map.key.resolvedUri===r.key.resolvedUri&&ee.push(r.map.key);const oe=pt(e,{uri:r.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),_e=ZS(r,ee,V,H),fe={uri:r.key.resolvedUri};H({type:"segmentkeyloadstart",segment:r,keyInfo:fe});const xe=s(oe,_e);Y.push(xe)}if(r.map&&!r.map.bytes){if(r.map.key&&(!r.key||r.key.resolvedUri!==r.map.key.resolvedUri)){const xe=pt(e,{uri:r.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),ve=ZS(r,[r.map.key],V,H),Ne={uri:r.map.key.resolvedUri};H({type:"segmentkeyloadstart",segment:r,keyInfo:Ne});const at=s(xe,ve);Y.push(at)}const oe=pt(e,{uri:r.map.resolvedUri,responseType:"arraybuffer",headers:Cy(r.map),requestType:"segment-media-initialization"}),_e=rM({segment:r,finishProcessingFn:V,triggerSegmentEventFn:H});H({type:"segmentloadstart",segment:r});const fe=s(oe,_e);Y.push(fe)}const Q=pt(e,{uri:r.part&&r.part.resolvedUri||r.resolvedUri,responseType:"arraybuffer",headers:Cy(r),requestType:"segment"}),Z=aM({segment:r,finishProcessingFn:V,responseType:Q.responseType,triggerSegmentEventFn:H});H({type:"segmentloadstart",segment:r});const W=s(Q,Z);W.addEventListener("progress",dM({segment:r,progressFn:u,trackInfoFn:c,timingInfoFn:p,videoSegmentTimingInfoFn:g,audioSegmentTimingInfoFn:b,id3Fn:S,captionsFn:E,isEndOfTimeline:A,endedTimelineFn:M,dataFn:U})),Y.push(W);const G={};return Y.forEach(ee=>{ee.addEventListener("loadend",cM({loadendState:G,abortFn:o}))}),()=>ky(Y)},Np=$n("PlaylistSelector"),ix=function(s){if(!s||!s.playlist)return;const e=s.playlist;return JSON.stringify({id:e.id,bandwidth:s.bandwidth,width:s.width,height:s.height,codecs:e.attributes&&e.attributes.CODECS||""})},Tu=function(s,e){if(!s)return"";const i=P.getComputedStyle(s);return i?i[e]:""},Su=function(s,e){const i=s.slice();s.sort(function(r,o){const u=e(r,o);return u===0?i.indexOf(r)-i.indexOf(o):u})},Ry=function(s,e){let i,r;return s.attributes.BANDWIDTH&&(i=s.attributes.BANDWIDTH),i=i||P.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(r=e.attributes.BANDWIDTH),r=r||P.Number.MAX_VALUE,i-r},fM=function(s,e){let i,r;return s.attributes.RESOLUTION&&s.attributes.RESOLUTION.width&&(i=s.attributes.RESOLUTION.width),i=i||P.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(r=e.attributes.RESOLUTION.width),r=r||P.Number.MAX_VALUE,i===r&&s.attributes.BANDWIDTH&&e.attributes.BANDWIDTH?s.attributes.BANDWIDTH-e.attributes.BANDWIDTH:i-r};let nx=function(s){const{main:e,bandwidth:i,playerWidth:r,playerHeight:o,playerObjectFit:u,limitRenditionByPlayerDimensions:c,playlistController:p}=s;if(!e)return;const g={bandwidth:i,width:r,height:o,limitRenditionByPlayerDimensions:c};let b=e.playlists;un.isAudioOnly(e)&&(b=p.getAudioTrackPlaylists_(),g.audioOnly=!0);let S=b.map(G=>{let ee;const oe=G.attributes&&G.attributes.RESOLUTION&&G.attributes.RESOLUTION.width,_e=G.attributes&&G.attributes.RESOLUTION&&G.attributes.RESOLUTION.height;return ee=G.attributes&&G.attributes.BANDWIDTH,ee=ee||P.Number.MAX_VALUE,{bandwidth:ee,width:oe,height:_e,playlist:G}});Su(S,(G,ee)=>G.bandwidth-ee.bandwidth),S=S.filter(G=>!un.isIncompatible(G.playlist));let E=S.filter(G=>un.isEnabled(G.playlist));E.length||(E=S.filter(G=>!un.isDisabled(G.playlist)));const A=E.filter(G=>G.bandwidth*fi.BANDWIDTH_VARIANCEG.bandwidth===M.bandwidth)[0];if(c===!1){const G=U||E[0]||S[0];if(G&&G.playlist){let ee="sortedPlaylistReps";return U&&(ee="bandwidthBestRep"),E[0]&&(ee="enabledPlaylistReps"),Np(`choosing ${ix(G)} using ${ee} with options`,g),G.playlist}return Np("could not choose a playlist with options",g),null}const D=A.filter(G=>G.width&&G.height);Su(D,(G,ee)=>G.width-ee.width);const z=D.filter(G=>G.width===r&&G.height===o);M=z[z.length-1];const H=z.filter(G=>G.bandwidth===M.bandwidth)[0];let Y,V,Q;H||(Y=D.filter(G=>u==="cover"?G.width>r&&G.height>o:G.width>r||G.height>o),V=Y.filter(G=>G.width===Y[0].width&&G.height===Y[0].height),M=V[V.length-1],Q=V.filter(G=>G.bandwidth===M.bandwidth)[0]);let Z;if(p.leastPixelDiffSelector){const G=D.map(ee=>(ee.pixelDiff=Math.abs(ee.width-r)+Math.abs(ee.height-o),ee));Su(G,(ee,oe)=>ee.pixelDiff===oe.pixelDiff?oe.bandwidth-ee.bandwidth:ee.pixelDiff-oe.pixelDiff),Z=G[0]}const W=Z||Q||H||U||E[0]||S[0];if(W&&W.playlist){let G="sortedPlaylistReps";return Z?G="leastPixelDiffRep":Q?G="resolutionPlusOneRep":H?G="resolutionBestRep":U?G="bandwidthBestRep":E[0]&&(G="enabledPlaylistReps"),Np(`choosing ${ix(W)} using ${G} with options`,g),W.playlist}return Np("could not choose a playlist with options",g),null};const sx=function(){let s=this.useDevicePixelRatio&&P.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(s=this.customPixelRatio),nx({main:this.playlists.main,bandwidth:this.systemBandwidth,playerWidth:parseInt(Tu(this.tech_.el(),"width"),10)*s,playerHeight:parseInt(Tu(this.tech_.el(),"height"),10)*s,playerObjectFit:this.usePlayerObjectFit?Tu(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})},pM=function(s){let e=-1,i=-1;if(s<0||s>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let r=this.useDevicePixelRatio&&P.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(r=this.customPixelRatio),e<0&&(e=this.systemBandwidth,i=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==i&&(e=s*this.systemBandwidth+(1-s)*e,i=this.systemBandwidth),nx({main:this.playlists.main,bandwidth:e,playerWidth:parseInt(Tu(this.tech_.el(),"width"),10)*r,playerHeight:parseInt(Tu(this.tech_.el(),"height"),10)*r,playerObjectFit:this.usePlayerObjectFit?Tu(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})}},mM=function(s){const{main:e,currentTime:i,bandwidth:r,duration:o,segmentDuration:u,timeUntilRebuffer:c,currentTimeline:p,syncController:g}=s,b=e.playlists.filter(U=>!un.isIncompatible(U));let S=b.filter(un.isEnabled);S.length||(S=b.filter(U=>!un.isDisabled(U)));const A=S.filter(un.hasAttribute.bind(null,"BANDWIDTH")).map(U=>{const z=g.getSyncPoint(U,o,p,i)?1:2,Y=un.estimateSegmentRequestTime(u,r,U)*z-c;return{playlist:U,rebufferingImpact:Y}}),M=A.filter(U=>U.rebufferingImpact<=0);return Su(M,(U,D)=>Ry(D.playlist,U.playlist)),M.length?M[0]:(Su(A,(U,D)=>U.rebufferingImpact-D.rebufferingImpact),A[0]||null)},gM=function(){const s=this.playlists.main.playlists.filter(un.isEnabled);return Su(s,(i,r)=>Ry(i,r)),s.filter(i=>!!Md(this.playlists.main,i).video)[0]||null},yM=s=>{let e=0,i;return s.bytes&&(i=new Uint8Array(s.bytes),s.segments.forEach(r=>{i.set(r,e),e+=r.byteLength})),i};function rx(s){try{return new URL(s).pathname.split("/").slice(-2).join("/")}catch{return""}}const vM=function(s,e,i){if(!s[i]){e.trigger({type:"usage",name:"vhs-608"});let r=i;/^cc708_/.test(i)&&(r="SERVICE"+i.split("_")[1]);const o=e.textTracks().getTrackById(r);if(o)s[i]=o;else{const u=e.options_.vhs&&e.options_.vhs.captionServices||{};let c=i,p=i,g=!1;const b=u[r];b&&(c=b.label,p=b.language,g=b.default),s[i]=e.addRemoteTextTrack({kind:"captions",id:r,default:g,label:c,language:p},!1).track}}},bM=function({inbandTextTracks:s,captionArray:e,timestampOffset:i}){if(!e)return;const r=P.WebKitDataCue||P.VTTCue;e.forEach(o=>{const u=o.stream;o.content?o.content.forEach(c=>{const p=new r(o.startTime+i,o.endTime+i,c.text);p.line=c.line,p.align="left",p.position=c.position,p.positionAlign="line-left",s[u].addCue(p)}):s[u].addCue(new r(o.startTime+i,o.endTime+i,o.text))})},_M=function(s){Object.defineProperties(s.frame,{id:{get(){return $.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),s.value.key}},value:{get(){return $.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),s.value.data}},privateData:{get(){return $.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),s.value.data}}})},TM=({inbandTextTracks:s,metadataArray:e,timestampOffset:i,videoDuration:r})=>{if(!e)return;const o=P.WebKitDataCue||P.VTTCue,u=s.metadataTrack_;if(!u||(e.forEach(S=>{const E=S.cueTime+i;typeof E!="number"||P.isNaN(E)||E<0||!(E<1/0)||!S.frames||!S.frames.length||S.frames.forEach(A=>{const M=new o(E,E,A.value||A.url||A.data||"");M.frame=A,M.value=A,_M(M),u.addCue(M)})}),!u.cues||!u.cues.length))return;const c=u.cues,p=[];for(let S=0;S{const A=S[E.startTime]||[];return A.push(E),S[E.startTime]=A,S},{}),b=Object.keys(g).sort((S,E)=>Number(S)-Number(E));b.forEach((S,E)=>{const A=g[S],M=isFinite(r)?r:S,U=Number(b[E+1])||M;A.forEach(D=>{D.endTime=U})})},SM={id:"ID",class:"CLASS",startDate:"START-DATE",duration:"DURATION",endDate:"END-DATE",endOnNext:"END-ON-NEXT",plannedDuration:"PLANNED-DURATION",scte35Out:"SCTE35-OUT",scte35In:"SCTE35-IN"},xM=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),EM=({inbandTextTracks:s,dateRanges:e})=>{const i=s.metadataTrack_;if(!i)return;const r=P.WebKitDataCue||P.VTTCue;e.forEach(o=>{for(const u of Object.keys(o)){if(xM.has(u))continue;const c=new r(o.startTime,o.endTime,"");c.id=o.id,c.type="com.apple.quicktime.HLS",c.value={key:SM[u],data:o[u]},(u==="scte35Out"||u==="scte35In")&&(c.value.data=new Uint8Array(c.value.data.match(/[\da-f]{2}/gi)).buffer),i.addCue(c)}o.processDateRange()})},ax=(s,e,i)=>{s.metadataTrack_||(s.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,$.browser.IS_ANY_SAFARI||(s.metadataTrack_.inBandMetadataTrackDispatchType=e))},Ld=function(s,e,i){let r,o;if(i&&i.cues)for(r=i.cues.length;r--;)o=i.cues[r],o.startTime>=s&&o.endTime<=e&&i.removeCue(o)},CM=function(s){const e=s.cues;if(!e)return;const i={};for(let r=e.length-1;r>=0;r--){const o=e[r],u=`${o.startTime}-${o.endTime}-${o.text}`;i[u]?s.removeCue(o):i[u]=o}},AM=(s,e,i)=>{if(typeof e>"u"||e===null||!s.length)return[];const r=Math.ceil((e-i+3)*Ao.ONE_SECOND_IN_TS);let o;for(o=0;or);o++);return s.slice(o)},DM=(s,e,i)=>{if(!e.length)return s;if(i)return e.slice();const r=e[0].pts;let o=0;for(o;o=r);o++);return s.slice(0,o).concat(e)},wM=(s,e,i,r)=>{const o=Math.ceil((e-r)*Ao.ONE_SECOND_IN_TS),u=Math.ceil((i-r)*Ao.ONE_SECOND_IN_TS),c=s.slice();let p=s.length;for(;p--&&!(s[p].pts<=u););if(p===-1)return c;let g=p+1;for(;g--&&!(s[g].pts<=o););return g=Math.max(g,0),c.splice(g,p-g+1),c},kM=function(s,e){if(!s&&!e||!s&&e||s&&!e)return!1;if(s===e)return!0;const i=Object.keys(s).sort(),r=Object.keys(e).sort();if(i.length!==r.length)return!1;for(let o=0;oi))return u}return r.length===0?0:r[r.length-1]},Id=1,RM=500,ox=s=>typeof s=="number"&&isFinite(s),Pp=1/60,MM=(s,e,i)=>s!=="main"||!e||!i?null:!i.hasAudio&&!i.hasVideo?"Neither audio nor video found in segment.":e.hasVideo&&!i.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!e.hasVideo&&i.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null,LM=(s,e,i)=>{let r=e-fi.BACK_BUFFER_LENGTH;s.length&&(r=Math.max(r,s.start(0)));const o=e-i;return Math.min(o,r)},xu=s=>{const{startOfSegment:e,duration:i,segment:r,part:o,playlist:{mediaSequence:u,id:c,segments:p=[]},mediaIndex:g,partIndex:b,timeline:S}=s,E=p.length-1;let A="mediaIndex/partIndex increment";s.getMediaInfoForTime?A=`getMediaInfoForTime (${s.getMediaInfoForTime})`:s.isSyncRequest&&(A="getSyncSegmentCandidate (isSyncRequest)"),s.independent&&(A+=` with independent ${s.independent}`);const M=typeof b=="number",U=s.segment.uri?"segment":"pre-segment",D=M?fS({preloadSegment:r})-1:0;return`${U} [${u+g}/${u+E}]`+(M?` part [${b}/${D}]`:"")+` segment start/end [${r.start} => ${r.end}]`+(M?` part start/end [${o.start} => ${o.end}]`:"")+` startOfSegment [${e}] duration [${i}] timeline [${S}] selected by [${A}] playlist [${c}]`},lx=s=>`${s}TimingInfo`,IM=({segmentTimeline:s,currentTimeline:e,startOfSegment:i,buffered:r,overrideCheck:o})=>!o&&s===e?null:s{if(e===i)return!1;if(r==="audio"){const u=s.lastTimelineChange({type:"main"});return!u||u.to!==i}if(r==="main"&&o){const u=s.pendingTimelineChange({type:"audio"});return!(u&&u.to===i)}return!1},NM=s=>{if(!s)return!1;const e=s.pendingTimelineChange({type:"audio"}),i=s.pendingTimelineChange({type:"main"}),r=e&&i,o=r&&e.to!==i.to;return!!(r&&e.from!==-1&&i.from!==-1&&o)},PM=s=>{const e=s.timelineChangeController_.pendingTimelineChange({type:"audio"}),i=s.timelineChangeController_.pendingTimelineChange({type:"main"});return e&&i&&e.to{const e=s.pendingSegment_;if(!e)return;if(My({timelineChangeController:s.timelineChangeController_,currentTimeline:s.currentTimeline_,segmentTimeline:e.timeline,loaderType:s.loaderType_,audioDisabled:s.audioDisabled_})&&NM(s.timelineChangeController_)){if(PM(s)){s.timelineChangeController_.trigger("audioTimelineBehind");return}s.timelineChangeController_.trigger("fixBadTimelineChange")}},UM=s=>{let e=0;return["video","audio"].forEach(function(i){const r=s[`${i}TimingInfo`];if(!r)return;const{start:o,end:u}=r;let c;typeof o=="bigint"||typeof u=="bigint"?c=P.BigInt(u)-P.BigInt(o):typeof o=="number"&&typeof u=="number"&&(c=u-o),typeof c<"u"&&c>e&&(e=c)}),typeof e=="bigint"&&es?Math.round(s)>e+Fs:!1,BM=(s,e)=>{if(e!=="hls")return null;const i=UM({audioTimingInfo:s.audioTimingInfo,videoTimingInfo:s.videoTimingInfo});if(!i)return null;const r=s.playlist.targetDuration,o=ux({segmentDuration:i,maxDuration:r*2}),u=ux({segmentDuration:i,maxDuration:r}),c=`Segment with index ${s.mediaIndex} from playlist ${s.playlist.id} has a duration of ${i} when the reported duration is ${s.duration} and the target duration is ${r}. For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1`;return o||u?{severity:o?"warn":"info",message:c}:null},Po=({type:s,segment:e})=>{if(!e)return;const i=!!(e.key||e.map&&e.map.ke),r=!!(e.map&&!e.map.bytes),o=e.startOfSegment===void 0?e.start:e.startOfSegment;return{type:s||e.type,uri:e.resolvedUri||e.uri,start:o,duration:e.duration,isEncrypted:i,isMediaInitialization:r}};class Ly extends $.EventTarget{constructor(e,i={}){if(super(),!e)throw new TypeError("Initialization settings are required");if(typeof e.currentTime!="function")throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");this.bandwidth=e.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.partIndex=null,this.hasPlayed_=e.hasPlayed,this.currentTime_=e.currentTime,this.seekable_=e.seekable,this.seeking_=e.seeking,this.duration_=e.duration,this.mediaSource_=e.mediaSource,this.vhs_=e.vhs,this.loaderType_=e.loaderType,this.currentMediaInfo_=void 0,this.startingMediaInfo_=void 0,this.segmentMetadataTrack_=e.segmentMetadataTrack,this.goalBufferLength_=e.goalBufferLength,this.sourceType_=e.sourceType,this.sourceUpdater_=e.sourceUpdater,this.inbandTextTracks_=e.inbandTextTracks,this.state_="INIT",this.timelineChangeController_=e.timelineChangeController,this.shouldSaveSegmentTimingInfo_=!0,this.parse708captions_=e.parse708captions,this.useDtsForTimestampOffset_=e.useDtsForTimestampOffset,this.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,this.addMetadataToTextTrack=e.addMetadataToTextTrack,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.shouldForceTimestampOffsetAfterResync_=!1,this.pendingSegment_=null,this.xhrOptions_=null,this.pendingSegments_=[],this.audioDisabled_=!1,this.isPendingTimestampOffset_=!1,this.gopBuffer_=[],this.timeMapping_=0,this.safeAppend_=!1,this.appendInitSegment_={audio:!0,video:!0},this.playlistOfLastInitSegment_={audio:null,video:null},this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_={id3:[],caption:[]},this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=null,this.activeInitSegmentId_=null,this.initSegments_={},this.cacheEncryptionKeys_=e.cacheEncryptionKeys,this.keyCache_={},this.decrypter_=e.decrypter,this.syncController_=e.syncController,this.syncPoint_={segmentIndex:0,time:0},this.transmuxer_=this.createTransmuxer_(),this.triggerSyncInfoUpdate_=()=>this.trigger("syncinfoupdate"),this.syncController_.on("syncinfoupdate",this.triggerSyncInfoUpdate_),this.mediaSource_.addEventListener("sourceopen",()=>{this.isEndOfStream_()||(this.ended_=!1)}),this.fetchAtBuffer_=!1,this.logger_=$n(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(r){r!==this.state_&&(this.logger_(`${this.state_} -> ${r}`),this.state_=r,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():ka(this)}),this.sourceUpdater_.on("codecschange",r=>{this.trigger(Ft({type:"codecschange"},r))}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():ka(this)}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",r=>{this.trigger(Ft({type:"timelinechange"},r)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():ka(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():ka(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return wy.createTransmuxer({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}resetStats_(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0}dispose(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&P.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}setAudio(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())}abort(){if(this.state!=="WAITING"){this.pendingSegment_&&(this.pendingSegment_=null),this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_);return}this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()}abort_(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,P.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return this.state==="APPENDING"&&!this.pendingSegment_?(this.state="READY",!0):!this.pendingSegment_||this.pendingSegment_.requestId!==e}error(e){return typeof e<"u"&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&wy.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return hi();if(this.loaderType_==="main"){const{hasAudio:i,hasVideo:r,isMuxed:o}=e;if(r&&i&&!this.audioDisabled_&&!o)return this.sourceUpdater_.buffered();if(r)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,i=!1){if(!e)return null;const r=Ip(e);let o=this.initSegments_[r];return i&&!o&&e.bytes&&(this.initSegments_[r]=o={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),o||e}segmentKey(e,i=!1){if(!e)return null;const r=PS(e);let o=this.keyCache_[r];this.cacheEncryptionKeys_&&i&&!o&&e.bytes&&(this.keyCache_[r]=o={resolvedUri:e.resolvedUri,bytes:e.bytes});const u={resolvedUri:(o||e).resolvedUri};return o&&(u.bytes=o.bytes),u}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),!!this.playlist_){if(this.state==="INIT"&&this.couldBeginLoading_())return this.init_();!this.couldBeginLoading_()||this.state!=="READY"&&this.state!=="INIT"||(this.state="READY")}}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(e,i={}){if(!e||this.playlist_&&this.playlist_.endList&&e.endList&&this.playlist_.uri===e.uri)return;const r=this.playlist_,o=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=i,this.state==="INIT"&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},this.loaderType_==="main"&&this.syncController_.setDateTimeMappingForStart(e));let u=null;if(r&&(r.id?u=r.id:r.uri&&(u=r.uri)),this.logger_(`playlist update [${u} => ${e.id||e.uri}]`),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_(`Playlist update:
+`)};var sr={inspect:Wt,textify:Xn,parseType:Yr,findBox:Jd,parseTraf:kn.traf,parseTfdt:kn.tfdt,parseHdlr:kn.hdlr,parseTfhd:kn.tfhd,parseTrun:kn.trun,parseSidx:kn.sidx},wt=function(h){for(var m=0,y=String.fromCharCode(h[m]),v="";y!=="\0";)v+=y,m++,y=String.fromCharCode(h[m]);return v+=y,v},Xu={uint8ToCString:wt},nl=Xu.uint8ToCString,eh=u.getUint64,Wr=function(h){var m=4,y=h[0],v,_,x,k,R,I,N,j;if(y===0){v=nl(h.subarray(m)),m+=v.length,_=nl(h.subarray(m)),m+=_.length;var te=new DataView(h.buffer);x=te.getUint32(m),m+=4,R=te.getUint32(m),m+=4,I=te.getUint32(m),m+=4,N=te.getUint32(m),m+=4}else if(y===1){var te=new DataView(h.buffer);x=te.getUint32(m),m+=4,k=eh(h.subarray(m)),m+=8,I=te.getUint32(m),m+=4,N=te.getUint32(m),m+=4,v=nl(h.subarray(m)),m+=v.length,_=nl(h.subarray(m)),m+=_.length}j=new Uint8Array(h.subarray(m,h.byteLength));var ge={scheme_id_uri:v,value:_,timescale:x||1,presentation_time:k,presentation_time_delta:R,event_duration:I,id:N,message_data:j};return xs(y,ge)?ge:void 0},sl=function(h,m,y,v){return h||h===0?h/m:v+y/m},xs=function(h,m){var y=m.scheme_id_uri!=="\0",v=h===0&&rl(m.presentation_time_delta)&&y,_=h===1&&rl(m.presentation_time)&&y;return!(h>1)&&v||_},rl=function(h){return h!==void 0||h!==null},al={parseEmsgBox:Wr,scaleTime:sl},Qr;typeof window<"u"?Qr=window:typeof s<"u"?Qr=s:typeof self<"u"?Qr=self:Qr={};var Yu=Qr,ol=Ha.toUnsigned,Bi=Ha.toHexString,lt=za,Es=$u,th=al,am=Ss,Jy=Kd,ih=Jo,Wu=u.getUint64,nh,sh,rh,ll,ah,Qu,oh,ul=Yu,lh=jr.parseId3Frames;nh=function(h){var m={},y=lt(h,["moov","trak"]);return y.reduce(function(v,_){var x,k,R,I,N;return x=lt(_,["tkhd"])[0],!x||(k=x[0],R=k===0?12:20,I=ol(x[R]<<24|x[R+1]<<16|x[R+2]<<8|x[R+3]),N=lt(_,["mdia","mdhd"])[0],!N)?null:(k=N[0],R=k===0?12:20,v[I]=ol(N[R]<<24|N[R+1]<<16|N[R+2]<<8|N[R+3]),v)},m)},sh=function(h,m){var y;y=lt(m,["moof","traf"]);var v=y.reduce(function(_,x){var k=lt(x,["tfhd"])[0],R=ol(k[4]<<24|k[5]<<16|k[6]<<8|k[7]),I=h[R]||9e4,N=lt(x,["tfdt"])[0],j=new DataView(N.buffer,N.byteOffset,N.byteLength),te;N[0]===1?te=Wu(N.subarray(4,12)):te=j.getUint32(4);let ge;return typeof te=="bigint"?ge=te/ul.BigInt(I):typeof te=="number"&&!isNaN(te)&&(ge=te/I),ge11?(_.codec+=".",_.codec+=Bi(ue[9]),_.codec+=Bi(ue[10]),_.codec+=Bi(ue[11])):_.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(_.codec)?(ue=ge.subarray(28),Le=Es(ue.subarray(4,8)),Le==="esds"&&ue.length>20&&ue[19]!==0?(_.codec+="."+Bi(ue[19]),_.codec+="."+Bi(ue[20]>>>2&63).replace(/^0/,"")):_.codec="mp4a.40.2"):_.codec=_.codec.toLowerCase())}var Pe=lt(v,["mdia","mdhd"])[0];Pe&&(_.timescale=Qu(Pe)),y.push(_)}),y},oh=function(h,m=0){var y=lt(h,["emsg"]);return y.map(v=>{var _=th.parseEmsgBox(new Uint8Array(v)),x=lh(_.message_data);return{cueTime:th.scaleTime(_.presentation_time,_.timescale,_.presentation_time_delta,m),duration:th.scaleTime(_.event_duration,_.timescale),frames:x}})};var pn={findBox:lt,parseType:Es,timescale:nh,startTime:sh,compositionStartTime:rh,videoTrackIds:ll,tracks:ah,getTimescaleFromMediaHeader:Qu,getEmsgID3:oh};const{parseTrun:rr}=sr,{findBox:qa}=pn;var cl=Yu,dl=function(h){var m=qa(h,["moof","traf"]),y=qa(h,["mdat"]),v=[];return y.forEach(function(_,x){var k=m[x];v.push({mdat:_,traf:k})}),v},hl=function(h,m,y){var v=m,_=y.defaultSampleDuration||0,x=y.defaultSampleSize||0,k=y.trackId,R=[];return h.forEach(function(I){var N=rr(I),j=N.samples;j.forEach(function(te){te.duration===void 0&&(te.duration=_),te.size===void 0&&(te.size=x),te.trackId=k,te.dts=v,te.compositionTimeOffset===void 0&&(te.compositionTimeOffset=0),typeof v=="bigint"?(te.pts=v+cl.BigInt(te.compositionTimeOffset),v+=cl.BigInt(te.duration)):(te.pts=v+te.compositionTimeOffset,v+=te.duration)}),R=R.concat(j)}),R},uh={getMdatTrafPairs:dl,parseSamples:hl},ev=Bd.discardEmulationPreventionBytes,om=wu.CaptionStream,Ku=za,ch=Jo,dh=Ss,{getMdatTrafPairs:We,parseSamples:he}=uh,Va=function(h,m){for(var y=h,v=0;v0?ch(j[0]).baseMediaDecodeTime:0,ge=Ku(k,["trun"]),ue,Le;m===N&&ge.length>0&&(ue=he(ge,te,I),Le=Zu(x,ue,N),y[N]||(y[N]={seiNals:[],logs:[]}),y[N].seiNals=y[N].seiNals.concat(Le.seiNals),y[N].logs=y[N].logs.concat(Le.logs))}),y},hh=function(h,m,y){var v;if(m===null)return null;v=Bt(h,m);var _=v[m]||{};return{seiNals:_.seiNals,logs:_.logs,timescale:y}},fh=function(){var h=!1,m,y,v,_,x,k;this.isInitialized=function(){return h},this.init=function(R){m=new om,h=!0,k=R?R.isPartial:!1,m.on("data",function(I){I.startTime=I.startPts/_,I.endTime=I.endPts/_,x.captions.push(I),x.captionStreams[I.stream]=!0}),m.on("log",function(I){x.logs.push(I)})},this.isNewInit=function(R,I){return R&&R.length===0||I&&typeof I=="object"&&Object.keys(I).length===0?!1:v!==R[0]||_!==I[v]},this.parse=function(R,I,N){var j;if(this.isInitialized()){if(!I||!N)return null;if(this.isNewInit(I,N))v=I[0],_=N[v];else if(v===null||!_)return y.push(R),null}else return null;for(;y.length>0;){var te=y.shift();this.parse(te,I,N)}return j=hh(R,v,_),j&&j.logs&&(x.logs=x.logs.concat(j.logs)),j===null||!j.seiNals?x.logs.length?{logs:x.logs,captions:[],captionStreams:[]}:null:(this.pushNals(j.seiNals),this.flushStream(),x)},this.pushNals=function(R){if(!this.isInitialized()||!R||R.length===0)return null;R.forEach(function(I){m.push(I)})},this.flushStream=function(){if(!this.isInitialized())return null;k?m.partialFlush():m.flush()},this.clearParsedCaptions=function(){x.captions=[],x.captionStreams={},x.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;m.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){y=[],v=null,_=null,x?this.clearParsedCaptions():x={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},lm=fh;const{parseTfdt:ph}=sr,ar=za,{getTimescaleFromMediaHeader:mh}=pn,{parseSamples:gh,getMdatTrafPairs:yh}=uh;var ut=function(){let h=9e4;this.init=function(m){const y=ar(m,["moov","trak","mdia","mdhd"])[0];y&&(h=mh(y))},this.parseSegment=function(m){const y=[],v=yh(m);let _=0;return v.forEach(function(x){const k=x.mdat,R=x.traf,I=ar(R,["tfdt"])[0],N=ar(R,["tfhd"])[0],j=ar(R,["trun"]);if(I&&(_=ph(I).baseMediaDecodeTime),j.length&&N){const te=gh(j,_,N);let ge=0;te.forEach(function(ue){const Le="utf-8",Pe=new TextDecoder(Le),qt=k.slice(ge,ge+ue.size);if(ar(qt,["vtte"])[0]){ge+=ue.size;return}ar(qt,["vttc"]).forEach(function(lr){const Zr=ar(lr,["payl"])[0],Xa=ar(lr,["sttg"])[0],Ya=ue.pts/h,Wa=(ue.pts+ue.duration)/h;let bt,Qa;if(Zr)try{bt=Pe.decode(Zr)}catch(Yi){console.error(Yi)}if(Xa)try{Qa=Pe.decode(Xa)}catch(Yi){console.error(Yi)}ue.duration&&bt&&y.push({cueText:bt,start:Ya,end:Wa,settings:Qa})}),ge+=ue.size})}}),y}},fl=zo,$a=function(h){var m=h[1]&31;return m<<=8,m|=h[2],m},On=function(h){return!!(h[1]&64)},Yn=function(h){var m=0;return(h[3]&48)>>>4>1&&(m+=h[4]+1),m},Rn=function(h,m){var y=$a(h);return y===0?"pat":y===m?"pmt":m?"pes":null},vh=function(h){var m=On(h),y=4+Yn(h);return m&&(y+=h[y]+1),(h[y+10]&31)<<8|h[y+11]},Ga=function(h){var m={},y=On(h),v=4+Yn(h);if(y&&(v+=h[v]+1),!!(h[v+5]&1)){var _,x,k;_=(h[v+1]&15)<<8|h[v+2],x=3+_-4,k=(h[v+10]&15)<<8|h[v+11];for(var R=12+k;R=h.byteLength)return null;var v=null,_;return _=h[y+7],_&192&&(v={},v.pts=(h[y+9]&14)<<27|(h[y+10]&255)<<20|(h[y+11]&254)<<12|(h[y+12]&255)<<5|(h[y+13]&254)>>>3,v.pts*=4,v.pts+=(h[y+13]&6)>>>1,v.dts=v.pts,_&64&&(v.dts=(h[y+14]&14)<<27|(h[y+15]&255)<<20|(h[y+16]&254)<<12|(h[y+17]&255)<<5|(h[y+18]&254)>>>3,v.dts*=4,v.dts+=(h[y+18]&6)>>>1)),v},ml=function(h){switch(h){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},Ju=function(h){for(var m=4+Yn(h),y=h.subarray(m),v=0,_=0,x=!1,k;_3&&(k=ml(y[_+3]&31),k==="slice_layer_without_partitioning_rbsp_idr"&&(x=!0)),x},um={parseType:Rn,parsePat:vh,parsePmt:Ga,parsePayloadUnitStartIndicator:On,parsePesType:bh,parsePesTime:pl,videoPacketContainsKeyFrame:Ju},_h=zo,Kr=zd.handleRollover,ct={};ct.ts=um,ct.aac=Fu;var or=ot.ONE_SECOND_IN_TS,ai=188,mn=71,Th=function(h,m){for(var y=0,v=ai,_,x;v=0;){if(h[v]===mn&&(h[_]===mn||_===h.byteLength)){switch(x=h.subarray(v,_),k=ct.ts.parseType(x,m.pid),k){case"pes":R=ct.ts.parsePesType(x,m.table),I=ct.ts.parsePayloadUnitStartIndicator(x),R==="audio"&&I&&(N=ct.ts.parsePesTime(x),N&&(N.type="audio",y.audio.push(N),j=!0));break}if(j)break;v-=ai,_-=ai;continue}v--,_--}},cm=function(h,m,y){for(var v=0,_=ai,x,k,R,I,N,j,te,ge,ue=!1,Le={data:[],size:0};_=0;){if(h[v]===mn&&h[_]===mn){switch(x=h.subarray(v,_),k=ct.ts.parseType(x,m.pid),k){case"pes":R=ct.ts.parsePesType(x,m.table),I=ct.ts.parsePayloadUnitStartIndicator(x),R==="video"&&I&&(N=ct.ts.parsePesTime(x),N&&(N.type="video",y.video.push(N),ue=!0));break}if(ue)break;v-=ai,_-=ai;continue}v--,_--}},dm=function(h,m){if(h.audio&&h.audio.length){var y=m;(typeof y>"u"||isNaN(y))&&(y=h.audio[0].dts),h.audio.forEach(function(x){x.dts=Kr(x.dts,y),x.pts=Kr(x.pts,y),x.dtsTime=x.dts/or,x.ptsTime=x.pts/or})}if(h.video&&h.video.length){var v=m;if((typeof v>"u"||isNaN(v))&&(v=h.video[0].dts),h.video.forEach(function(x){x.dts=Kr(x.dts,v),x.pts=Kr(x.pts,v),x.dtsTime=x.dts/or,x.ptsTime=x.pts/or}),h.firstKeyFrame){var _=h.firstKeyFrame;_.dts=Kr(_.dts,v),_.pts=Kr(_.pts,v),_.dtsTime=_.dts/or,_.ptsTime=_.pts/or}}},tv=function(h){for(var m=!1,y=0,v=null,_=null,x=0,k=0,R;h.length-k>=3;){var I=ct.aac.parseType(h,k);switch(I){case"timed-metadata":if(h.length-k<10){m=!0;break}if(x=ct.aac.parseId3TagSize(h,k),x>h.length){m=!0;break}_===null&&(R=h.subarray(k,k+x),_=ct.aac.parseAacTimestamp(R)),k+=x;break;case"audio":if(h.length-k<7){m=!0;break}if(x=ct.aac.parseAdtsSize(h,k),x>h.length){m=!0;break}v===null&&(R=h.subarray(k,k+x),v=ct.aac.parseSampleRate(R)),y++,k+=x;break;default:k++;break}if(m)return null}if(v===null||_===null)return null;var N=or/v,j={audio:[{type:"audio",dts:_,pts:_},{type:"audio",dts:_+y*1024*N,pts:_+y*1024*N}]};return j},hm=function(h){var m={pid:null,table:null},y={};Th(h,m);for(var v in m.table)if(m.table.hasOwnProperty(v)){var _=m.table[v];switch(_){case _h.H264_STREAM_TYPE:y.video=[],cm(h,m,y),y.video.length===0&&delete y.video;break;case _h.ADTS_STREAM_TYPE:y.audio=[],Sh(h,m,y),y.audio.length===0&&delete y.audio;break}}return y},fm=function(h,m){var y=ct.aac.isLikelyAacData(h),v;return y?v=tv(h):v=hm(h),!v||!v.audio&&!v.video?null:(dm(v,m),v)},pm={inspect:fm,parseAudioPes_:Sh};const xh=function(h,m){m.on("data",function(y){const v=y.initSegment;y.initSegment={data:v.buffer,byteOffset:v.byteOffset,byteLength:v.byteLength};const _=y.data;y.data=_.buffer,h.postMessage({action:"data",segment:y,byteOffset:_.byteOffset,byteLength:_.byteLength},[y.data])}),m.on("done",function(y){h.postMessage({action:"done"})}),m.on("gopInfo",function(y){h.postMessage({action:"gopInfo",gopInfo:y})}),m.on("videoSegmentTimingInfo",function(y){const v={start:{decode:ot.videoTsToSeconds(y.start.dts),presentation:ot.videoTsToSeconds(y.start.pts)},end:{decode:ot.videoTsToSeconds(y.end.dts),presentation:ot.videoTsToSeconds(y.end.pts)},baseMediaDecodeTime:ot.videoTsToSeconds(y.baseMediaDecodeTime)};y.prependedContentDuration&&(v.prependedContentDuration=ot.videoTsToSeconds(y.prependedContentDuration)),h.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:v})}),m.on("audioSegmentTimingInfo",function(y){const v={start:{decode:ot.videoTsToSeconds(y.start.dts),presentation:ot.videoTsToSeconds(y.start.pts)},end:{decode:ot.videoTsToSeconds(y.end.dts),presentation:ot.videoTsToSeconds(y.end.pts)},baseMediaDecodeTime:ot.videoTsToSeconds(y.baseMediaDecodeTime)};y.prependedContentDuration&&(v.prependedContentDuration=ot.videoTsToSeconds(y.prependedContentDuration)),h.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:v})}),m.on("id3Frame",function(y){h.postMessage({action:"id3Frame",id3Frame:y})}),m.on("caption",function(y){h.postMessage({action:"caption",caption:y})}),m.on("trackinfo",function(y){h.postMessage({action:"trackinfo",trackInfo:y})}),m.on("audioTimingInfo",function(y){h.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:ot.videoTsToSeconds(y.start),end:ot.videoTsToSeconds(y.end)}})}),m.on("videoTimingInfo",function(y){h.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:ot.videoTsToSeconds(y.start),end:ot.videoTsToSeconds(y.end)}})}),m.on("log",function(y){h.postMessage({action:"log",log:y})})};class Eh{constructor(m,y){this.options=y||{},this.self=m,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new im.Transmuxer(this.options),xh(this.self,this.transmuxer)}pushMp4Captions(m){this.captionParser||(this.captionParser=new lm,this.captionParser.init());const y=new Uint8Array(m.data,m.byteOffset,m.byteLength),v=this.captionParser.parse(y,m.trackIds,m.timescales);this.self.postMessage({action:"mp4Captions",captions:v&&v.captions||[],logs:v&&v.logs||[],data:y.buffer},[y.buffer])}initMp4WebVttParser(m){this.webVttParser||(this.webVttParser=new ut);const y=new Uint8Array(m.data,m.byteOffset,m.byteLength);this.webVttParser.init(y)}getMp4WebVttText(m){this.webVttParser||(this.webVttParser=new ut);const y=new Uint8Array(m.data,m.byteOffset,m.byteLength),v=this.webVttParser.parseSegment(y);this.self.postMessage({action:"getMp4WebVttText",mp4VttCues:v||[],data:y.buffer},[y.buffer])}probeMp4StartTime({timescales:m,data:y}){const v=pn.startTime(m,y);this.self.postMessage({action:"probeMp4StartTime",startTime:v,data:y},[y.buffer])}probeMp4Tracks({data:m}){const y=pn.tracks(m);this.self.postMessage({action:"probeMp4Tracks",tracks:y,data:m},[m.buffer])}probeEmsgID3({data:m,offset:y}){const v=pn.getEmsgID3(m,y);this.self.postMessage({action:"probeEmsgID3",id3Frames:v,emsgData:m},[m.buffer])}probeTs({data:m,baseStartTime:y}){const v=typeof y=="number"&&!isNaN(y)?y*ot.ONE_SECOND_IN_TS:void 0,_=pm.inspect(m,v);let x=null;_&&(x={hasVideo:_.video&&_.video.length===2||!1,hasAudio:_.audio&&_.audio.length===2||!1},x.hasVideo&&(x.videoStart=_.video[0].ptsTime),x.hasAudio&&(x.audioStart=_.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:x,data:m},[m.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(m){const y=new Uint8Array(m.data,m.byteOffset,m.byteLength);this.transmuxer.push(y)}reset(){this.transmuxer.reset()}setTimestampOffset(m){const y=m.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(ot.secondsToVideoTs(y)))}setAudioAppendStart(m){this.transmuxer.setAudioAppendStart(Math.ceil(ot.secondsToVideoTs(m.appendStart)))}setRemux(m){this.transmuxer.setRemux(m.remux)}flush(m){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(m){this.transmuxer.alignGopsWith(m.gopsToAlignWith.slice())}}self.onmessage=function(h){if(h.data.action==="init"&&h.data.options){this.messageHandlers=new Eh(self,h.data.options);return}this.messageHandlers||(this.messageHandlers=new Eh(self)),h.data&&h.data.action&&h.data.action!=="init"&&this.messageHandlers[h.data.action]&&this.messageHandlers[h.data.action](h.data)}}));var W4=qS(Y4);const Q4=(s,e,i)=>{const{type:r,initSegment:o,captions:u,captionStreams:c,metadata:p,videoFrameDtsTime:g,videoFramePtsTime:b}=s.data.segment;e.buffer.push({captions:u,captionStreams:c,metadata:p});const S=s.data.segment.boxes||{data:s.data.segment.data},E={type:r,data:new Uint8Array(S.data,S.data.byteOffset,S.data.byteLength),initSegment:new Uint8Array(o.data,o.byteOffset,o.byteLength)};typeof g<"u"&&(E.videoFrameDtsTime=g),typeof b<"u"&&(E.videoFramePtsTime=b),i(E)},K4=({transmuxedData:s,callback:e})=>{s.buffer=[],e(s)},Z4=(s,e)=>{e.gopInfo=s.data.gopInfo},GS=s=>{const{transmuxer:e,bytes:i,audioAppendStart:r,gopsToAlignWith:o,remux:u,onData:c,onTrackInfo:p,onAudioTimingInfo:g,onVideoTimingInfo:b,onVideoSegmentTimingInfo:S,onAudioSegmentTimingInfo:E,onId3:A,onCaptions:M,onDone:U,onEndedTimeline:D,onTransmuxerLog:z,isEndOfTimeline:H,segment:Y,triggerSegmentEventFn:$}=s,Q={buffer:[]};let Z=H;const W=ee=>{e.currentTransmux===s&&(ee.data.action==="data"&&Q4(ee,Q,c),ee.data.action==="trackinfo"&&p(ee.data.trackInfo),ee.data.action==="gopInfo"&&Z4(ee,Q),ee.data.action==="audioTimingInfo"&&g(ee.data.audioTimingInfo),ee.data.action==="videoTimingInfo"&&b(ee.data.videoTimingInfo),ee.data.action==="videoSegmentTimingInfo"&&S(ee.data.videoSegmentTimingInfo),ee.data.action==="audioSegmentTimingInfo"&&E(ee.data.audioSegmentTimingInfo),ee.data.action==="id3Frame"&&A([ee.data.id3Frame],ee.data.id3Frame.dispatchType),ee.data.action==="caption"&&M(ee.data.caption),ee.data.action==="endedtimeline"&&(Z=!1,D()),ee.data.action==="log"&&z(ee.data.log),ee.data.type==="transmuxed"&&(Z||(e.onmessage=null,K4({transmuxedData:Q,callback:U}),XS(e))))},G=()=>{const ee={message:"Received an error message from the transmuxer worker",metadata:{errorType:V.Error.StreamingFailedToTransmuxSegment,segmentInfo:Po({segment:Y})}};U(null,ee)};if(e.onmessage=W,e.onerror=G,r&&e.postMessage({action:"setAudioAppendStart",appendStart:r}),Array.isArray(o)&&e.postMessage({action:"alignGopsWith",gopsToAlignWith:o}),typeof u<"u"&&e.postMessage({action:"setRemux",remux:u}),i.byteLength){const ee=i instanceof ArrayBuffer?i:i.buffer,oe=i instanceof ArrayBuffer?0:i.byteOffset;$({type:"segmenttransmuxingstart",segment:Y}),e.postMessage({action:"push",data:ee,byteOffset:oe,byteLength:i.byteLength},[ee])}H&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},XS=s=>{s.currentTransmux=null,s.transmuxQueue.length&&(s.currentTransmux=s.transmuxQueue.shift(),typeof s.currentTransmux=="function"?s.currentTransmux():GS(s.currentTransmux))},YS=(s,e)=>{s.postMessage({action:e}),XS(s)},WS=(s,e)=>{if(!e.currentTransmux){e.currentTransmux=s,YS(e,s);return}e.transmuxQueue.push(YS.bind(null,e,s))},J4=s=>{WS("reset",s)},eM=s=>{WS("endTimeline",s)},QS=s=>{if(!s.transmuxer.currentTransmux){s.transmuxer.currentTransmux=s,GS(s);return}s.transmuxer.transmuxQueue.push(s)};var wy={reset:J4,endTimeline:eM,transmux:QS,createTransmuxer:s=>{const e=new W4;e.currentTransmux=null,e.transmuxQueue=[];const i=e.terminate;return e.terminate=()=>(e.currentTransmux=null,e.transmuxQueue.length=0,i.call(e)),e.postMessage({action:"init",options:s}),e}};const _u=function(s){const e=s.transmuxer,i=s.endAction||s.action,r=s.callback,o=Ft({},s,{endAction:null,transmuxer:null,callback:null}),u=c=>{c.data.action===i&&(e.removeEventListener("message",u),c.data.data&&(c.data.data=new Uint8Array(c.data.data,s.byteOffset||0,s.byteLength||c.data.data.byteLength),s.data&&(s.data=c.data.data)),r(c.data))};if(e.addEventListener("message",u),s.data){const c=s.data instanceof ArrayBuffer;o.byteOffset=c?0:s.data.byteOffset,o.byteLength=s.data.byteLength;const p=[c?s.data:s.data.buffer];e.postMessage(o,p)}else e.postMessage(o)},zs={FAILURE:2,TIMEOUT:-101,ABORTED:-102},KS="wvtt",ky=s=>{s.forEach(e=>{e.abort()})},tM=s=>({bandwidth:s.bandwidth,bytesReceived:s.bytesReceived||0,roundTripTime:s.roundTripTime||0}),iM=s=>{const e=s.target,r={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-e.requestTime||0};return r.bytesReceived=s.loaded,r.bandwidth=Math.floor(r.bytesReceived/r.roundTripTime*8*1e3),r},Oy=(s,e)=>{const{requestType:i}=e,r=No({requestType:i,request:e,error:s});return e.timedout?{status:e.status,message:"HLS request timed-out at URL: "+e.uri,code:zs.TIMEOUT,xhr:e,metadata:r}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:zs.ABORTED,xhr:e,metadata:r}:s?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:zs.FAILURE,xhr:e,metadata:r}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:zs.FAILURE,xhr:e,metadata:r}:null},ZS=(s,e,i,r)=>(o,u)=>{const c=u.response,p=Oy(o,u);if(p)return i(p,s);if(c.byteLength!==16)return i({status:u.status,message:"Invalid HLS key at URL: "+u.uri,code:zs.FAILURE,xhr:u},s);const g=new DataView(c),b=new Uint32Array([g.getUint32(0),g.getUint32(4),g.getUint32(8),g.getUint32(12)]);for(let E=0;E{e===KS&&s.transmuxer.postMessage({action:"initMp4WebVttParser",data:s.map.bytes})},sM=(s,e,i)=>{e===KS&&_u({action:"getMp4WebVttText",data:s.bytes,transmuxer:s.transmuxer,callback:({data:r,mp4VttCues:o})=>{s.bytes=r,i(null,s,{mp4VttCues:o})}})},JS=(s,e)=>{const i=m0(s.map.bytes);if(i!=="mp4"){const r=s.map.resolvedUri||s.map.uri,o=i||"unknown";return e({internal:!0,message:`Found unsupported ${o} container for initialization segment at URL: ${r}`,code:zs.FAILURE,metadata:{mediaType:o}})}_u({action:"probeMp4Tracks",data:s.map.bytes,transmuxer:s.transmuxer,callback:({tracks:r,data:o})=>(s.map.bytes=o,r.forEach(function(u){s.map.tracks=s.map.tracks||{},!s.map.tracks[u.type]&&(s.map.tracks[u.type]=u,typeof u.id=="number"&&u.timescale&&(s.map.timescales=s.map.timescales||{},s.map.timescales[u.id]=u.timescale),u.type==="text"&&nM(s,u.codec))}),e(null))})},rM=({segment:s,finishProcessingFn:e,triggerSegmentEventFn:i})=>(r,o)=>{const u=Oy(r,o);if(u)return e(u,s);const c=new Uint8Array(o.response);if(i({type:"segmentloaded",segment:s}),s.map.key)return s.map.encryptedBytes=c,e(null,s);s.map.bytes=c,JS(s,function(p){if(p)return p.xhr=o,p.status=o.status,e(p,s);e(null,s)})},aM=({segment:s,finishProcessingFn:e,responseType:i,triggerSegmentEventFn:r})=>(o,u)=>{const c=Oy(o,u);if(c)return e(c,s);r({type:"segmentloaded",segment:s});const p=i==="arraybuffer"||!u.responseText?u.response:G4(u.responseText.substring(s.lastReachedChar||0));return s.stats=tM(u),s.key?s.encryptedBytes=new Uint8Array(p):s.bytes=new Uint8Array(p),e(null,s)},oM=({segment:s,bytes:e,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M})=>{const U=s.map&&s.map.tracks||{},D=!!(U.audio&&U.video);let z=r.bind(null,s,"audio","start");const H=r.bind(null,s,"audio","end");let Y=r.bind(null,s,"video","start");const $=r.bind(null,s,"video","end"),Q=()=>QS({bytes:e,transmuxer:s.transmuxer,audioAppendStart:s.audioAppendStart,gopsToAlignWith:s.gopsToAlignWith,remux:D,onData:Z=>{Z.type=Z.type==="combined"?"video":Z.type,S(s,Z)},onTrackInfo:Z=>{i&&(D&&(Z.isMuxed=!0),i(s,Z))},onAudioTimingInfo:Z=>{z&&typeof Z.start<"u"&&(z(Z.start),z=null),H&&typeof Z.end<"u"&&H(Z.end)},onVideoTimingInfo:Z=>{Y&&typeof Z.start<"u"&&(Y(Z.start),Y=null),$&&typeof Z.end<"u"&&$(Z.end)},onVideoSegmentTimingInfo:Z=>{const W={pts:{start:Z.start.presentation,end:Z.end.presentation},dts:{start:Z.start.decode,end:Z.end.decode}};M({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:W}),o(Z)},onAudioSegmentTimingInfo:Z=>{const W={pts:{start:Z.start.pts,end:Z.end.pts},dts:{start:Z.start.dts,end:Z.end.dts}};M({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:W}),u(Z)},onId3:(Z,W)=>{c(s,Z,W)},onCaptions:Z=>{p(s,[Z])},isEndOfTimeline:g,onEndedTimeline:()=>{b()},onTransmuxerLog:A,onDone:(Z,W)=>{E&&(Z.type=Z.type==="combined"?"video":Z.type,M({type:"segmenttransmuxingcomplete",segment:s}),E(W,s,Z))},segment:s,triggerSegmentEventFn:M});_u({action:"probeTs",transmuxer:s.transmuxer,data:e,baseStartTime:s.baseStartTime,callback:Z=>{s.bytes=e=Z.data;const W=Z.result;W&&(i(s,{hasAudio:W.hasAudio,hasVideo:W.hasVideo,isMuxed:D}),i=null),Q()}})},ex=({segment:s,bytes:e,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M})=>{let U=new Uint8Array(e);if(NR(U)){s.isFmp4=!0;const{tracks:D}=s.map;if(D.text&&(!D.audio||!D.video)){S(s,{data:U,type:"text"}),sM(s,D.text.codec,E);return}const H={isFmp4:!0,hasVideo:!!D.video,hasAudio:!!D.audio};D.audio&&D.audio.codec&&D.audio.codec!=="enca"&&(H.audioCodec=D.audio.codec),D.video&&D.video.codec&&D.video.codec!=="encv"&&(H.videoCodec=D.video.codec),D.video&&D.audio&&(H.isMuxed=!0),i(s,H);const Y=($,Q)=>{S(s,{data:U,type:H.hasAudio&&!H.isMuxed?"audio":"video"}),Q&&Q.length&&c(s,Q),$&&$.length&&p(s,$),E(null,s,{})};_u({action:"probeMp4StartTime",timescales:s.map.timescales,data:U,transmuxer:s.transmuxer,callback:({data:$,startTime:Q})=>{e=$.buffer,s.bytes=U=$,H.hasAudio&&!H.isMuxed&&r(s,"audio","start",Q),H.hasVideo&&r(s,"video","start",Q),_u({action:"probeEmsgID3",data:U,transmuxer:s.transmuxer,offset:Q,callback:({emsgData:Z,id3Frames:W})=>{if(e=Z.buffer,s.bytes=U=Z,!D.video||!Z.byteLength||!s.transmuxer){Y(void 0,W);return}_u({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:s.transmuxer,data:U,timescales:s.map.timescales,trackIds:[D.video.id],callback:G=>{e=G.data.buffer,s.bytes=U=G.data,G.logs.forEach(function(ee){A(pt(ee,{stream:"mp4CaptionParser"}))}),Y(G.captions,W)}})}})}});return}if(!s.transmuxer){E(null,s,{});return}if(typeof s.container>"u"&&(s.container=m0(U)),s.container!=="ts"&&s.container!=="aac"){i(s,{hasAudio:!1,hasVideo:!1}),E(null,s,{});return}oM({segment:s,bytes:e,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M})},tx=function({id:s,key:e,encryptedBytes:i,decryptionWorker:r,segment:o,doneFn:u},c){const p=b=>{if(b.data.source===s){r.removeEventListener("message",p);const S=b.data.decrypted;c(new Uint8Array(S.bytes,S.byteOffset,S.byteLength))}};r.onerror=()=>{const b="An error occurred in the decryption worker",S=Po({segment:o}),E={message:b,metadata:{error:new Error(b),errorType:V.Error.StreamingFailedToDecryptSegment,segmentInfo:S,keyInfo:{uri:o.key.resolvedUri||o.map.key.resolvedUri}}};u(E,o)},r.addEventListener("message",p);let g;e.bytes.slice?g=e.bytes.slice():g=new Uint32Array(Array.prototype.slice.call(e.bytes)),r.postMessage(NS({source:s,encrypted:i,key:g,iv:e.iv}),[i.buffer,g.buffer])},lM=({decryptionWorker:s,segment:e,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M})=>{M({type:"segmentdecryptionstart"}),tx({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:s,segment:e,doneFn:E},U=>{e.bytes=U,M({type:"segmentdecryptioncomplete",segment:e}),ex({segment:e,bytes:e.bytes,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M})})},uM=({activeXhrs:s,decryptionWorker:e,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M})=>{let U=0,D=!1;return(z,H)=>{if(!D){if(z)return D=!0,ky(s),E(z,H);if(U+=1,U===s.length){const Y=function(){if(H.encryptedBytes)return lM({decryptionWorker:e,segment:H,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M});ex({segment:H,bytes:H.bytes,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S,doneFn:E,onTransmuxerLog:A,triggerSegmentEventFn:M})};if(H.endOfAllRequests=Date.now(),H.map&&H.map.encryptedBytes&&!H.map.bytes)return M({type:"segmentdecryptionstart",segment:H}),tx({decryptionWorker:e,id:H.requestId+"-init",encryptedBytes:H.map.encryptedBytes,key:H.map.key,segment:H,doneFn:E},$=>{H.map.bytes=$,M({type:"segmentdecryptioncomplete",segment:H}),JS(H,Q=>{if(Q)return ky(s),E(Q,H);Y()})});Y()}}}},cM=({loadendState:s,abortFn:e})=>i=>{i.target.aborted&&e&&!s.calledAbortFn&&(e(),s.calledAbortFn=!0)},dM=({segment:s,progressFn:e,trackInfoFn:i,timingInfoFn:r,videoSegmentTimingInfoFn:o,audioSegmentTimingInfoFn:u,id3Fn:c,captionsFn:p,isEndOfTimeline:g,endedTimelineFn:b,dataFn:S})=>E=>{if(!E.target.aborted)return s.stats=pt(s.stats,iM(E)),!s.stats.firstBytesReceivedAt&&s.stats.bytesReceived&&(s.stats.firstBytesReceivedAt=Date.now()),e(E,s)},hM=({xhr:s,xhrOptions:e,decryptionWorker:i,segment:r,abortFn:o,progressFn:u,trackInfoFn:c,timingInfoFn:p,videoSegmentTimingInfoFn:g,audioSegmentTimingInfoFn:b,id3Fn:S,captionsFn:E,isEndOfTimeline:A,endedTimelineFn:M,dataFn:U,doneFn:D,onTransmuxerLog:z,triggerSegmentEventFn:H})=>{const Y=[],$=uM({activeXhrs:Y,decryptionWorker:i,trackInfoFn:c,timingInfoFn:p,videoSegmentTimingInfoFn:g,audioSegmentTimingInfoFn:b,id3Fn:S,captionsFn:E,isEndOfTimeline:A,endedTimelineFn:M,dataFn:U,doneFn:D,onTransmuxerLog:z,triggerSegmentEventFn:H});if(r.key&&!r.key.bytes){const ee=[r.key];r.map&&!r.map.bytes&&r.map.key&&r.map.key.resolvedUri===r.key.resolvedUri&&ee.push(r.map.key);const oe=pt(e,{uri:r.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),_e=ZS(r,ee,$,H),fe={uri:r.key.resolvedUri};H({type:"segmentkeyloadstart",segment:r,keyInfo:fe});const xe=s(oe,_e);Y.push(xe)}if(r.map&&!r.map.bytes){if(r.map.key&&(!r.key||r.key.resolvedUri!==r.map.key.resolvedUri)){const xe=pt(e,{uri:r.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),ve=ZS(r,[r.map.key],$,H),Ne={uri:r.map.key.resolvedUri};H({type:"segmentkeyloadstart",segment:r,keyInfo:Ne});const at=s(xe,ve);Y.push(at)}const oe=pt(e,{uri:r.map.resolvedUri,responseType:"arraybuffer",headers:Cy(r.map),requestType:"segment-media-initialization"}),_e=rM({segment:r,finishProcessingFn:$,triggerSegmentEventFn:H});H({type:"segmentloadstart",segment:r});const fe=s(oe,_e);Y.push(fe)}const Q=pt(e,{uri:r.part&&r.part.resolvedUri||r.resolvedUri,responseType:"arraybuffer",headers:Cy(r),requestType:"segment"}),Z=aM({segment:r,finishProcessingFn:$,responseType:Q.responseType,triggerSegmentEventFn:H});H({type:"segmentloadstart",segment:r});const W=s(Q,Z);W.addEventListener("progress",dM({segment:r,progressFn:u,trackInfoFn:c,timingInfoFn:p,videoSegmentTimingInfoFn:g,audioSegmentTimingInfoFn:b,id3Fn:S,captionsFn:E,isEndOfTimeline:A,endedTimelineFn:M,dataFn:U})),Y.push(W);const G={};return Y.forEach(ee=>{ee.addEventListener("loadend",cM({loadendState:G,abortFn:o}))}),()=>ky(Y)},Np=$n("PlaylistSelector"),ix=function(s){if(!s||!s.playlist)return;const e=s.playlist;return JSON.stringify({id:e.id,bandwidth:s.bandwidth,width:s.width,height:s.height,codecs:e.attributes&&e.attributes.CODECS||""})},Tu=function(s,e){if(!s)return"";const i=P.getComputedStyle(s);return i?i[e]:""},Su=function(s,e){const i=s.slice();s.sort(function(r,o){const u=e(r,o);return u===0?i.indexOf(r)-i.indexOf(o):u})},Ry=function(s,e){let i,r;return s.attributes.BANDWIDTH&&(i=s.attributes.BANDWIDTH),i=i||P.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(r=e.attributes.BANDWIDTH),r=r||P.Number.MAX_VALUE,i-r},fM=function(s,e){let i,r;return s.attributes.RESOLUTION&&s.attributes.RESOLUTION.width&&(i=s.attributes.RESOLUTION.width),i=i||P.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(r=e.attributes.RESOLUTION.width),r=r||P.Number.MAX_VALUE,i===r&&s.attributes.BANDWIDTH&&e.attributes.BANDWIDTH?s.attributes.BANDWIDTH-e.attributes.BANDWIDTH:i-r};let nx=function(s){const{main:e,bandwidth:i,playerWidth:r,playerHeight:o,playerObjectFit:u,limitRenditionByPlayerDimensions:c,playlistController:p}=s;if(!e)return;const g={bandwidth:i,width:r,height:o,limitRenditionByPlayerDimensions:c};let b=e.playlists;un.isAudioOnly(e)&&(b=p.getAudioTrackPlaylists_(),g.audioOnly=!0);let S=b.map(G=>{let ee;const oe=G.attributes&&G.attributes.RESOLUTION&&G.attributes.RESOLUTION.width,_e=G.attributes&&G.attributes.RESOLUTION&&G.attributes.RESOLUTION.height;return ee=G.attributes&&G.attributes.BANDWIDTH,ee=ee||P.Number.MAX_VALUE,{bandwidth:ee,width:oe,height:_e,playlist:G}});Su(S,(G,ee)=>G.bandwidth-ee.bandwidth),S=S.filter(G=>!un.isIncompatible(G.playlist));let E=S.filter(G=>un.isEnabled(G.playlist));E.length||(E=S.filter(G=>!un.isDisabled(G.playlist)));const A=E.filter(G=>G.bandwidth*fi.BANDWIDTH_VARIANCEG.bandwidth===M.bandwidth)[0];if(c===!1){const G=U||E[0]||S[0];if(G&&G.playlist){let ee="sortedPlaylistReps";return U&&(ee="bandwidthBestRep"),E[0]&&(ee="enabledPlaylistReps"),Np(`choosing ${ix(G)} using ${ee} with options`,g),G.playlist}return Np("could not choose a playlist with options",g),null}const D=A.filter(G=>G.width&&G.height);Su(D,(G,ee)=>G.width-ee.width);const z=D.filter(G=>G.width===r&&G.height===o);M=z[z.length-1];const H=z.filter(G=>G.bandwidth===M.bandwidth)[0];let Y,$,Q;H||(Y=D.filter(G=>u==="cover"?G.width>r&&G.height>o:G.width>r||G.height>o),$=Y.filter(G=>G.width===Y[0].width&&G.height===Y[0].height),M=$[$.length-1],Q=$.filter(G=>G.bandwidth===M.bandwidth)[0]);let Z;if(p.leastPixelDiffSelector){const G=D.map(ee=>(ee.pixelDiff=Math.abs(ee.width-r)+Math.abs(ee.height-o),ee));Su(G,(ee,oe)=>ee.pixelDiff===oe.pixelDiff?oe.bandwidth-ee.bandwidth:ee.pixelDiff-oe.pixelDiff),Z=G[0]}const W=Z||Q||H||U||E[0]||S[0];if(W&&W.playlist){let G="sortedPlaylistReps";return Z?G="leastPixelDiffRep":Q?G="resolutionPlusOneRep":H?G="resolutionBestRep":U?G="bandwidthBestRep":E[0]&&(G="enabledPlaylistReps"),Np(`choosing ${ix(W)} using ${G} with options`,g),W.playlist}return Np("could not choose a playlist with options",g),null};const sx=function(){let s=this.useDevicePixelRatio&&P.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(s=this.customPixelRatio),nx({main:this.playlists.main,bandwidth:this.systemBandwidth,playerWidth:parseInt(Tu(this.tech_.el(),"width"),10)*s,playerHeight:parseInt(Tu(this.tech_.el(),"height"),10)*s,playerObjectFit:this.usePlayerObjectFit?Tu(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})},pM=function(s){let e=-1,i=-1;if(s<0||s>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let r=this.useDevicePixelRatio&&P.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(r=this.customPixelRatio),e<0&&(e=this.systemBandwidth,i=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==i&&(e=s*this.systemBandwidth+(1-s)*e,i=this.systemBandwidth),nx({main:this.playlists.main,bandwidth:e,playerWidth:parseInt(Tu(this.tech_.el(),"width"),10)*r,playerHeight:parseInt(Tu(this.tech_.el(),"height"),10)*r,playerObjectFit:this.usePlayerObjectFit?Tu(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})}},mM=function(s){const{main:e,currentTime:i,bandwidth:r,duration:o,segmentDuration:u,timeUntilRebuffer:c,currentTimeline:p,syncController:g}=s,b=e.playlists.filter(U=>!un.isIncompatible(U));let S=b.filter(un.isEnabled);S.length||(S=b.filter(U=>!un.isDisabled(U)));const A=S.filter(un.hasAttribute.bind(null,"BANDWIDTH")).map(U=>{const z=g.getSyncPoint(U,o,p,i)?1:2,Y=un.estimateSegmentRequestTime(u,r,U)*z-c;return{playlist:U,rebufferingImpact:Y}}),M=A.filter(U=>U.rebufferingImpact<=0);return Su(M,(U,D)=>Ry(D.playlist,U.playlist)),M.length?M[0]:(Su(A,(U,D)=>U.rebufferingImpact-D.rebufferingImpact),A[0]||null)},gM=function(){const s=this.playlists.main.playlists.filter(un.isEnabled);return Su(s,(i,r)=>Ry(i,r)),s.filter(i=>!!Md(this.playlists.main,i).video)[0]||null},yM=s=>{let e=0,i;return s.bytes&&(i=new Uint8Array(s.bytes),s.segments.forEach(r=>{i.set(r,e),e+=r.byteLength})),i};function rx(s){try{return new URL(s).pathname.split("/").slice(-2).join("/")}catch{return""}}const vM=function(s,e,i){if(!s[i]){e.trigger({type:"usage",name:"vhs-608"});let r=i;/^cc708_/.test(i)&&(r="SERVICE"+i.split("_")[1]);const o=e.textTracks().getTrackById(r);if(o)s[i]=o;else{const u=e.options_.vhs&&e.options_.vhs.captionServices||{};let c=i,p=i,g=!1;const b=u[r];b&&(c=b.label,p=b.language,g=b.default),s[i]=e.addRemoteTextTrack({kind:"captions",id:r,default:g,label:c,language:p},!1).track}}},bM=function({inbandTextTracks:s,captionArray:e,timestampOffset:i}){if(!e)return;const r=P.WebKitDataCue||P.VTTCue;e.forEach(o=>{const u=o.stream;o.content?o.content.forEach(c=>{const p=new r(o.startTime+i,o.endTime+i,c.text);p.line=c.line,p.align="left",p.position=c.position,p.positionAlign="line-left",s[u].addCue(p)}):s[u].addCue(new r(o.startTime+i,o.endTime+i,o.text))})},_M=function(s){Object.defineProperties(s.frame,{id:{get(){return V.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),s.value.key}},value:{get(){return V.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),s.value.data}},privateData:{get(){return V.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),s.value.data}}})},TM=({inbandTextTracks:s,metadataArray:e,timestampOffset:i,videoDuration:r})=>{if(!e)return;const o=P.WebKitDataCue||P.VTTCue,u=s.metadataTrack_;if(!u||(e.forEach(S=>{const E=S.cueTime+i;typeof E!="number"||P.isNaN(E)||E<0||!(E<1/0)||!S.frames||!S.frames.length||S.frames.forEach(A=>{const M=new o(E,E,A.value||A.url||A.data||"");M.frame=A,M.value=A,_M(M),u.addCue(M)})}),!u.cues||!u.cues.length))return;const c=u.cues,p=[];for(let S=0;S