hls-parser
Version:
A simple library to read/write HLS playlists
2 lines • 60.6 kB
JavaScript
/*! For license information please see hls-parser.min.js.LICENSE.txt */
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.HLS=e():t.HLS=e()}(self,(()=>(()=>{"use strict";var t={31:function(t,e,n){function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function a(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?a(Object(n),!0).forEach((function(e){d(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function o(t,e,n){return e=u(e),function(t,e){if(e&&("object"==r(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,s()?Reflect.construct(e,n||[],u(t).constructor):e.apply(t,n))}function s(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(s=function(){return!!t})()}function u(t){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},u(t)}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e)}function l(t,e){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},l(t,e)}function T(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,h(r.key),r)}}function f(t,e,n){return e&&T(t.prototype,e),n&&T(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function E(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function d(t,e,n){return(e=h(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function h(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var a=n.call(t,e||"default");if("object"!=r(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==r(e)?e:e+""}var p,I=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var a=Object.getOwnPropertyDescriptor(e,n);a&&!("get"in a?!e.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,a)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),v=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),A=this&&this.__importStar||(p=function(t){return p=Object.getOwnPropertyNames||function(t){var e=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[e.length]=n);return e},p(t)},function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n=p(t),r=0;r<n.length;r++)"default"!==n[r]&&I(e,t,n[r]);return v(e,t),e});Object.defineProperty(e,"__esModule",{value:!0}),e.ContentSteering=e.RenditionReport=e.PrefetchSegment=e.PartialSegment=e.Segment=e.MediaPlaylist=e.MasterPlaylist=e.Playlist=e.SpliceInfo=e.DateRange=e.MediaInitializationSection=e.Key=e.SessionData=e.Variant=e.Rendition=void 0;var y=A(n(203)),S=f((function t(e){var n=e.type,r=e.uri,a=e.groupId,i=e.language,o=e.assocLanguage,s=e.name,u=e.isDefault,c=e.autoselect,l=e.forced,T=e.instreamId,f=e.characteristics,h=e.channels,p=e.pathwayId;E(this,t),d(this,"type",void 0),d(this,"uri",void 0),d(this,"groupId",void 0),d(this,"language",void 0),d(this,"assocLanguage",void 0),d(this,"name",void 0),d(this,"isDefault",void 0),d(this,"autoselect",void 0),d(this,"forced",void 0),d(this,"instreamId",void 0),d(this,"characteristics",void 0),d(this,"channels",void 0),d(this,"pathwayId",void 0),y.PARAMCHECK(n,a,s),y.CONDITIONALASSERT(["SUBTITLES"===n,r],["CLOSED-CAPTIONS"===n,T],["CLOSED-CAPTIONS"===n,!r],[l,"SUBTITLES"===n]),this.type=n,this.uri=r,this.groupId=a,this.language=i,this.assocLanguage=o,this.name=s,this.isDefault=u,this.autoselect=c,this.forced=l,this.instreamId=T,this.characteristics=f,this.channels=h,this.pathwayId=p}));e.Rendition=S;var N=f((function t(e){var n=e.uri,r=e.isIFrameOnly,a=void 0!==r&&r,i=e.bandwidth,o=e.averageBandwidth,s=e.score,u=e.codecs,c=e.resolution,l=e.frameRate,T=e.hdcpLevel,f=e.allowedCpc,h=e.videoRange,p=e.stableVariantId,I=e.pathwayId,v=e.programId,A=e.audio,S=void 0===A?[]:A,N=e.video,m=void 0===N?[]:N,g=e.subtitles,X=void 0===g?[]:g,b=e.closedCaptions,O=void 0===b?[]:b,R=e.currentRenditions,P=void 0===R?{audio:0,video:0,subtitles:0,closedCaptions:0}:R;E(this,t),d(this,"uri",void 0),d(this,"isIFrameOnly",void 0),d(this,"bandwidth",void 0),d(this,"averageBandwidth",void 0),d(this,"score",void 0),d(this,"codecs",void 0),d(this,"resolution",void 0),d(this,"frameRate",void 0),d(this,"hdcpLevel",void 0),d(this,"allowedCpc",void 0),d(this,"videoRange",void 0),d(this,"stableVariantId",void 0),d(this,"pathwayId",void 0),d(this,"programId",void 0),d(this,"audio",void 0),d(this,"video",void 0),d(this,"subtitles",void 0),d(this,"closedCaptions",void 0),d(this,"currentRenditions",void 0),y.PARAMCHECK(n,i),this.uri=n,this.isIFrameOnly=a,this.bandwidth=i,this.averageBandwidth=o,this.score=s,this.codecs=u,this.resolution=c,this.frameRate=l,this.hdcpLevel=T,this.allowedCpc=f,this.videoRange=h,this.stableVariantId=p,this.pathwayId=I,this.programId=v,this.audio=S,this.video=m,this.subtitles=X,this.closedCaptions=O,this.currentRenditions=P}));e.Variant=N;var m=f((function t(e){var n=e.id,r=e.value,a=e.uri,i=e.language;E(this,t),d(this,"id",void 0),d(this,"value",void 0),d(this,"uri",void 0),d(this,"language",void 0),y.PARAMCHECK(n,r||a),y.ASSERT("SessionData cannot have both value and uri, shoud be either.",!(r&&a)),this.id=n,this.value=r,this.uri=a,this.language=i}));e.SessionData=m;var g=f((function t(e){var n=e.method,r=e.uri,a=e.iv,i=e.format,o=e.formatVersion;E(this,t),d(this,"method",void 0),d(this,"uri",void 0),d(this,"iv",void 0),d(this,"format",void 0),d(this,"formatVersion",void 0),y.PARAMCHECK(n),y.CONDITIONALPARAMCHECK(["NONE"!==n,r]),y.CONDITIONALASSERT(["NONE"===n,!(r||a||i||o)]),this.method=n,this.uri=r,this.iv=a,this.format=i,this.formatVersion=o}));e.Key=g;var X=f((function t(e){var n=e.serverUri,r=e.pathwayId;E(this,t),d(this,"serverUri",void 0),d(this,"pathwayId",void 0),this.serverUri=n,this.pathwayId=r}));e.ContentSteering=X;var b=f((function t(e){var n=e.hint,r=void 0!==n&&n,a=e.uri,i=e.mimeType,o=e.byterange;E(this,t),d(this,"hint",void 0),d(this,"uri",void 0),d(this,"mimeType",void 0),d(this,"byterange",void 0),y.PARAMCHECK(a),this.hint=r,this.uri=a,this.mimeType=i,this.byterange=o}));e.MediaInitializationSection=b;var O=f((function t(e){var n=e.id,r=e.classId,a=e.start,i=e.end,o=e.duration,s=e.plannedDuration,u=e.endOnNext,c=e.attributes,l=void 0===c?{}:c;E(this,t),d(this,"id",void 0),d(this,"classId",void 0),d(this,"start",void 0),d(this,"end",void 0),d(this,"duration",void 0),d(this,"plannedDuration",void 0),d(this,"endOnNext",void 0),d(this,"attributes",void 0),y.PARAMCHECK(n),y.CONDITIONALPARAMCHECK([!0===u,r]),y.CONDITIONALASSERT([i,a],[i,a<=i],[o,o>=0],[s,s>=0]),this.id=n,this.classId=r,this.start=a,this.end=i,this.duration=o,this.plannedDuration=s,this.endOnNext=u,this.attributes=l}));e.DateRange=O;var R=f((function t(e){var n=e.type,r=e.duration,a=e.tagName,i=e.value;E(this,t),d(this,"type",void 0),d(this,"duration",void 0),d(this,"tagName",void 0),d(this,"value",void 0),y.PARAMCHECK(n),y.CONDITIONALPARAMCHECK(["OUT"===n,r]),y.CONDITIONALPARAMCHECK(["RAW"===n,a]),this.type=n,this.duration=r,this.tagName=a,this.value=i}));e.SpliceInfo=R;var P=f((function t(e){E(this,t),d(this,"type",void 0),y.PARAMCHECK(e),this.type=e})),D=function(t){function e(t){var n,r=t.isMasterPlaylist,a=t.uri,i=t.version,s=t.independentSegments,u=void 0!==s&&s,c=t.start,l=t.source;return E(this,e),d(n=o(this,e,["playlist"]),"isMasterPlaylist",void 0),d(n,"uri",void 0),d(n,"version",void 0),d(n,"independentSegments",void 0),d(n,"start",void 0),d(n,"source",void 0),y.PARAMCHECK(r),n.isMasterPlaylist=r,n.uri=a,n.version=i,n.independentSegments=u,n.start=c,n.source=l,n}return c(e,t),f(e)}(P);e.Playlist=D;var L=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};E(this,e),d(t=o(this,e,[i(i({},n),{},{isMasterPlaylist:!0})]),"variants",void 0),d(t,"currentVariant",void 0),d(t,"sessionDataList",void 0),d(t,"sessionKeyList",void 0),d(t,"contentSteering",void 0);var r=n.variants,a=void 0===r?[]:r,s=n.currentVariant,u=n.sessionDataList,c=void 0===u?[]:u,l=n.sessionKeyList,T=void 0===l?[]:l,f=n.contentSteering,h=void 0===f?void 0:f;return t.variants=a,t.currentVariant=s,t.sessionDataList=c,t.sessionKeyList=T,t.contentSteering=h,t}return c(e,t),f(e)}(D);e.MasterPlaylist=L;var C=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};E(this,e),d(t=o(this,e,[i(i({},n),{},{isMasterPlaylist:!1})]),"targetDuration",void 0),d(t,"mediaSequenceBase",void 0),d(t,"discontinuitySequenceBase",void 0),d(t,"endlist",void 0),d(t,"playlistType",void 0),d(t,"isIFrame",void 0),d(t,"segments",void 0),d(t,"prefetchSegments",void 0),d(t,"lowLatencyCompatibility",void 0),d(t,"partTargetDuration",void 0),d(t,"renditionReports",void 0),d(t,"skip",void 0),d(t,"hash",void 0);var r=n.targetDuration,a=n.mediaSequenceBase,s=void 0===a?0:a,u=n.discontinuitySequenceBase,c=void 0===u?0:u,l=n.endlist,T=void 0!==l&&l,f=n.playlistType,h=n.isIFrame,p=n.segments,I=void 0===p?[]:p,v=n.prefetchSegments,A=void 0===v?[]:v,y=n.lowLatencyCompatibility,S=n.partTargetDuration,N=n.renditionReports,m=void 0===N?[]:N,g=n.skip,X=void 0===g?0:g,b=n.hash;return t.targetDuration=r,t.mediaSequenceBase=s,t.discontinuitySequenceBase=c,t.endlist=T,t.playlistType=f,t.isIFrame=h,t.segments=I,t.prefetchSegments=A,t.lowLatencyCompatibility=y,t.partTargetDuration=S,t.renditionReports=m,t.skip=X,t.hash=b,t}return c(e,t),f(e)}(D);e.MediaPlaylist=C;var M=function(t){function e(t){var n,r=t.uri,a=t.mimeType,i=t.data,s=t.duration,u=t.title,c=t.byterange,l=t.discontinuity,T=t.mediaSequenceNumber,f=void 0===T?0:T,h=t.discontinuitySequence,p=void 0===h?0:h,I=t.key,v=t.map,A=t.programDateTime,y=t.dateRange,S=t.markers,N=void 0===S?[]:S,m=t.parts,g=void 0===m?[]:m,X=t.gap;return E(this,e),d(n=o(this,e,["segment"]),"uri",void 0),d(n,"mimeType",void 0),d(n,"data",void 0),d(n,"duration",void 0),d(n,"title",void 0),d(n,"byterange",void 0),d(n,"discontinuity",void 0),d(n,"mediaSequenceNumber",void 0),d(n,"discontinuitySequence",void 0),d(n,"key",void 0),d(n,"map",void 0),d(n,"programDateTime",void 0),d(n,"dateRange",void 0),d(n,"markers",void 0),d(n,"parts",void 0),d(n,"gap",void 0),n.uri=r,n.mimeType=a,n.data=i,n.duration=s,n.title=u,n.byterange=c,n.discontinuity=l,n.mediaSequenceNumber=f,n.discontinuitySequence=p,n.key=I,n.map=v,n.programDateTime=A,n.dateRange=y,n.markers=N,n.parts=g,n.gap=X,n}return c(e,t),f(e)}(P);e.Segment=M;var U=function(t){function e(t){var n,r=t.hint,a=void 0!==r&&r,i=t.uri,s=t.duration,u=t.independent,c=t.byterange,l=t.gap;return E(this,e),d(n=o(this,e,["part"]),"hint",void 0),d(n,"uri",void 0),d(n,"duration",void 0),d(n,"independent",void 0),d(n,"byterange",void 0),d(n,"gap",void 0),y.PARAMCHECK(i),n.hint=a,n.uri=i,n.duration=s,n.independent=u,n.duration=s,n.byterange=c,n.gap=l,n}return c(e,t),f(e)}(P);e.PartialSegment=U;var w=function(t){function e(t){var n,r=t.uri,a=t.discontinuity,i=t.mediaSequenceNumber,s=void 0===i?0:i,u=t.discontinuitySequence,c=void 0===u?0:u,l=t.key;return E(this,e),d(n=o(this,e,["prefetch"]),"uri",void 0),d(n,"discontinuity",void 0),d(n,"mediaSequenceNumber",void 0),d(n,"discontinuitySequence",void 0),d(n,"key",void 0),y.PARAMCHECK(r),n.uri=r,n.discontinuity=a,n.mediaSequenceNumber=s,n.discontinuitySequence=c,n.key=l,n}return c(e,t),f(e)}(P);e.PrefetchSegment=w;var Y=f((function t(e){var n=e.uri,r=e.lastMSN,a=e.lastPart;E(this,t),d(this,"uri",void 0),d(this,"lastMSN",void 0),d(this,"lastPart",void 0),y.PARAMCHECK(n),this.uri=n,this.lastMSN=r,this.lastPart=a}));e.RenditionReport=Y},73:function(t,e,n){var r,a=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var a=Object.getOwnPropertyDescriptor(e,n);a&&!("get"in a?!e.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,a)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),i=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),o=this&&this.__importStar||(r=function(t){return r=Object.getOwnPropertyNames||function(t){var e=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[e.length]=n);return e},r(t)},function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n=r(t),o=0;o<n.length;o++)"default"!==n[o]&&a(e,t,n[o]);return i(e,t),e}),s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.setOptions=e.getOptions=e.types=e.stringify=e.parse=void 0;const u=n(203);Object.defineProperty(e,"getOptions",{enumerable:!0,get:function(){return u.getOptions}}),Object.defineProperty(e,"setOptions",{enumerable:!0,get:function(){return u.setOptions}});const c=s(n(377));e.parse=c.default;const l=s(n(887));e.stringify=l.default;const T=o(n(31));e.types=T},203:(t,e)=>{function n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,a,i,o,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,a=t}finally{try{if(!u&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}return s}}(t,e)||a(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=a(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){u=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(u)throw o}}}}function a(t,e){if(t){if("string"==typeof t)return i(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(t,e):void 0}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}Object.defineProperty(e,"__esModule",{value:!0}),e.THROW=s,e.ASSERT=function(t){for(var e=arguments.length,a=new Array(e>1?e-1:0),i=1;i<e;i++)a[i-1]=arguments[i];var o,u=r(a.entries());try{for(u.s();!(o=u.n()).done;){var c=n(o.value,2),l=c[0];c[1]||s(new Error("".concat(t," : Failed at [").concat(l,"]")))}}catch(t){u.e(t)}finally{u.f()}},e.CONDITIONALASSERT=function(){for(var t=arguments.length,e=new Array(t),a=0;a<t;a++)e[a]=arguments[a];var i,o=r(e.entries());try{for(o.s();!(i=o.n()).done;){var u=n(i.value,2),c=u[0],l=n(u[1],2),T=l[0],f=l[1];T&&(f||s(new Error("Conditional Assert : Failed at [".concat(c,"]"))))}}catch(t){o.e(t)}finally{o.f()}},e.PARAMCHECK=function(){for(var t=arguments.length,e=new Array(t),a=0;a<t;a++)e[a]=arguments[a];var i,o=r(e.entries());try{for(o.s();!(i=o.n()).done;){var u=n(i.value,2),c=u[0];void 0===u[1]&&s(new Error("Param Check : Failed at [".concat(c,"]")))}}catch(t){o.e(t)}finally{o.f()}},e.CONDITIONALPARAMCHECK=function(){for(var t=arguments.length,e=new Array(t),a=0;a<t;a++)e[a]=arguments[a];var i,o=r(e.entries());try{for(o.s();!(i=o.n()).done;){var u=n(i.value,2),c=u[0],l=n(u[1],2),T=l[0],f=l[1];T&&(void 0===f&&s(new Error("Conditional Param Check : Failed at [".concat(c,"]"))))}}catch(t){o.e(t)}finally{o.f()}},e.INVALIDPLAYLIST=function(t){s(new Error("Invalid Playlist : ".concat(t)))},e.toNumber=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;if("number"==typeof t)return t;var n=10===e?Number.parseFloat(t):Number.parseInt(t,e);if(Number.isNaN(n))return 0;return n},e.hexToByteSequence=function(t){(t.startsWith("0x")||t.startsWith("0X"))&&(t=t.slice(2));for(var e=new Uint8Array(t.length/2),n=0;n<t.length;n+=2)e[n/2]=Number.parseInt(t.slice(n,n+2),16);return e},e.byteSequenceToHex=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.byteLength;n<=e&&s(new Error("end must be larger than start : start=".concat(e,", end=").concat(n)));for(var r=[],a=e;a<n;a++)r.push("0".concat((255&t[a]).toString(16).toUpperCase()).slice(-2));return"0x".concat(r.join(""))},e.tryCatch=function(t,e){try{return t()}catch(t){return e(t)}},e.splitAt=function(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=-1,a=0,i=0;a<t.length;a++)if(t[a]===e){if(i++===n)return[t.slice(0,a),t.slice(a+1)];r=a}if(-1!==r)return[t.slice(0,r),t.slice(r+1)];return[t]},e.trim=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ";if(!t)return t;if(t=t.trim()," "===e)return t;t.startsWith(e)&&(t=t.slice(1));t.endsWith(e)&&(t=t.slice(0,-1));return t},e.splitByCommaWithPreservingQuotes=function(t){for(var e=[],n=!0,r=0,a=[],i=0;i<t.length;i++){var o=t[i];n&&","===o?(e.push(t.slice(r,i).trim()),r=i+1):'"'!==o&&"'"!==o||(n?(a.push(o),n=!1):o===a.at(-1)?(a.pop(),n=!0):a.push(o))}return e.push(t.slice(r).trim()),e},e.camelify=function(t){var e,n=[],a=!1,i=r(t);try{for(i.s();!(e=i.n()).done;){var o=e.value;"-"!==o&&"_"!==o?a?(n.push(o.toUpperCase()),a=!1):n.push(o.toLowerCase()):a=!0}}catch(t){i.e(t)}finally{i.f()}return n.join("")},e.formatDate=function(t){var e=t.getUTCFullYear(),n=("0"+(t.getUTCMonth()+1)).slice(-2),r=("0"+t.getUTCDate()).slice(-2),a=("0"+t.getUTCHours()).slice(-2),i=("0"+t.getUTCMinutes()).slice(-2),o=("0"+t.getUTCSeconds()).slice(-2),s=("00"+t.getUTCMilliseconds()).slice(-3);return"".concat(e,"-").concat(n,"-").concat(r,"T").concat(a,":").concat(i,":").concat(o,".").concat(s,"Z")},e.hasOwnProp=function(t,e){return Object.hasOwn(t,e)},e.setOptions=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};o=Object.assign(o,t)},e.getOptions=function(){return Object.assign({},o)};var o={};function s(t){if(o.strictMode)throw t;o.silent||console.error(t.message)}},377:function(t,e,n){function r(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,a,i,o,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,a=t}finally{try{if(!u&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}return s}}(t,e)||i(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=i(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,a=function(){};return{s:a,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){u=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(u)throw o}}}}function i(t,e){if(t){if("string"==typeof t)return o(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?o(t,e):void 0}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}var s,u=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var a=Object.getOwnPropertyDescriptor(e,n);a&&!("get"in a?!e.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,a)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),c=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),l=this&&this.__importStar||(s=function(t){return s=Object.getOwnPropertyNames||function(t){var e=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[e.length]=n);return e},s(t)},function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n=s(t),r=0;r<n.length;r++)"default"!==n[r]&&u(e,t,n[r]);return c(e,t),e});Object.defineProperty(e,"__esModule",{value:!0});var T=l(n(203)),f=n(31);function E(t){return T.trim(t,'"')}function d(t){var e=T.splitAt(t,",");return{duration:T.toNumber(e[0]),title:decodeURIComponent(escape(e[1]))}}function h(t){var e=T.splitAt(t,"@");return{length:T.toNumber(e[0]),offset:e[1]?T.toNumber(e[1]):-1}}function p(t){var e=T.splitAt(t,"x");return{width:T.toNumber(e[0]),height:T.toNumber(e[1])}}function I(t){var e="ALLOWED-CPC: Each entry must consit of KEYFORMAT and Content Protection Configuration",n=t.split(",");0===n.length&&T.INVALIDPLAYLIST(e);var i,o=[],s=a(n);try{for(s.s();!(i=s.n()).done;){var u=i.value,c=r(T.splitAt(u,":"),2),l=c[0],f=c[1];l&&f?o.push({format:l,cpcList:f.split("/")}):T.INVALIDPLAYLIST(e)}}catch(t){s.e(t)}finally{s.f()}return o}function v(t){return t.startsWith('"')?E(t):t.startsWith("0x")||t.startsWith("0X")?T.hexToByteSequence(t):T.toNumber(t)}function A(t,e){e.IV&&t.compatibleVersion<2&&(t.compatibleVersion=2),(e.KEYFORMAT||e.KEYFORMATVERSIONS)&&t.compatibleVersion<5&&(t.compatibleVersion=5)}function y(t){var e,n,i,o={},s=a(T.splitByCommaWithPreservingQuotes(t));try{for(s.s();!(e=s.n()).done;){var u=e.value,c=r(T.splitAt(u,"="),2),l=c[0],f=c[1],d=E(f);switch(l){case"URI":o[l]=d;break;case"START-DATE":case"END-DATE":o[l]=new Date(d);break;case"IV":o[l]=(n=d,i=void 0,16!==(i=T.hexToByteSequence(n)).length&&T.INVALIDPLAYLIST("IV must be a 128-bit unsigned integer"),i);break;case"BYTERANGE":o[l]=h(d);break;case"RESOLUTION":o[l]=p(d);break;case"ALLOWED-CPC":o[l]=I(d);break;case"END-ON-NEXT":case"DEFAULT":case"AUTOSELECT":case"FORCED":case"PRECISE":case"CAN-BLOCK-RELOAD":case"INDEPENDENT":case"GAP":o[l]="YES"===d;break;case"DURATION":case"PLANNED-DURATION":case"BANDWIDTH":case"AVERAGE-BANDWIDTH":case"FRAME-RATE":case"TIME-OFFSET":case"CAN-SKIP-UNTIL":case"HOLD-BACK":case"PART-HOLD-BACK":case"PART-TARGET":case"BYTERANGE-START":case"BYTERANGE-LENGTH":case"LAST-MSN":case"LAST-PART":case"SKIPPED-SEGMENTS":case"SCORE":case"PROGRAM-ID":o[l]=T.toNumber(d);break;default:l.startsWith("SCTE35-")?o[l]=T.hexToByteSequence(d):l.startsWith("X-")?o[l]=v(f):("VIDEO-RANGE"===l&&"SDR"!==d&&"HLG"!==d&&"PQ"!==d&&T.INVALIDPLAYLIST('VIDEO-RANGE: unknown value "'.concat(d,'"')),o[l]=d)}}}catch(t){s.e(t)}finally{s.f()}return o}function S(){T.INVALIDPLAYLIST("The file contains both media and master playlist tags.")}function N(t,e,n){var r,i=(r=e.attributes,new f.Rendition({type:r.TYPE,uri:r.URI,groupId:r["GROUP-ID"],language:r.LANGUAGE,assocLanguage:r["ASSOC-LANGUAGE"],name:r.NAME,isDefault:r.DEFAULT,autoselect:r.AUTOSELECT,forced:r.FORCED,instreamId:r["INSTREAM-ID"],characteristics:r.CHARACTERISTICS,channels:r.CHANNELS,pathwayId:r["PATHWAY-ID"]})),o=t[T.camelify(n)],s=function(t,e){var n,r=!1,i=a(t);try{for(i.s();!(n=i.n()).done;){var o=n.value;if(o.name===e.name)return"All EXT-X-MEDIA tags in the same Group MUST have different NAME attributes.";o.isDefault&&(r=!0)}}catch(t){i.e(t)}finally{i.f()}return r&&e.isDefault?"EXT-X-MEDIA A Group MUST NOT have more than one member with a DEFAULT attribute of YES.":""}(o,i);s&&T.INVALIDPLAYLIST(s),o.push(i),i.isDefault&&(t.currentRenditions[T.camelify(n)]=o.length-1)}function m(t,e,n,r,i){var o,s=new f.Variant({uri:n,bandwidth:e.BANDWIDTH,averageBandwidth:e["AVERAGE-BANDWIDTH"],score:e.SCORE,codecs:e.CODECS,resolution:e.RESOLUTION,frameRate:e["FRAME-RATE"],hdcpLevel:e["HDCP-LEVEL"],allowedCpc:e["ALLOWED-CPC"],videoRange:e["VIDEO-RANGE"],stableVariantId:e["STABLE-VARIANT-ID"],pathwayId:e["STABLE-PATHWAY-ID"],programId:e["PROGRAM-ID"]}),u=a(t);try{for(u.s();!(o=u.n()).done;){var c=o.value;if("EXT-X-MEDIA"===c.name){var l=c.attributes,E=l.TYPE;if(E&&l["GROUP-ID"]||T.INVALIDPLAYLIST("EXT-X-MEDIA TYPE attribute is REQUIRED."),e[E]===l["GROUP-ID"]&&(N(s,c,E),"CLOSED-CAPTIONS"===E)){var d,h=a(s.closedCaptions);try{for(h.s();!(d=h.n()).done;){var p=d.value.instreamId;if(p&&p.startsWith("SERVICE")&&i.compatibleVersion<7){i.compatibleVersion=7;break}}}catch(t){h.e(t)}finally{h.f()}}}}}catch(t){u.e(t)}finally{u.f()}return function(t,e,n){for(var r=function(){var r=i[a];"CLOSED-CAPTIONS"===r&&"NONE"===t[r]?(n.isClosedCaptionsNone=!0,e.closedCaptions=[]):t[r]&&!e[T.camelify(r)].some((function(e){return e.groupId===t[r]}))&&T.INVALIDPLAYLIST("".concat(r," attribute MUST match the value of the GROUP-ID attribute of an EXT-X-MEDIA tag whose TYPE attribute is ").concat(r,"."))},a=0,i=["AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS"];a<i.length;a++)r()}(e,s,i),s.isIFrameOnly=r,s}function g(t,e,n,r,a,i,o){for(var s=new f.Segment({uri:e,mediaSequenceNumber:a,discontinuitySequence:i}),u=!1,c=!1,l=n;l<=r;l++){var E=D(t[l]),d=E.name,h=E.value,p=E.attributes;if("EXTINF"===d)!Number.isInteger(h.duration)&&o.compatibleVersion<3&&(o.compatibleVersion=3),Math.round(h.duration)>o.targetDuration&&T.INVALIDPLAYLIST("EXTINF duration, when rounded to the nearest integer, MUST be less than or equal to the target duration"),s.duration=h.duration,s.title=h.title;else if("EXT-X-BYTERANGE"===d)o.compatibleVersion<4&&(o.compatibleVersion=4),s.byterange=h;else if("EXT-X-DISCONTINUITY"===d)s.parts.length>0&&T.INVALIDPLAYLIST("EXT-X-DISCONTINUITY must appear before the first EXT-X-PART tag of the Parent Segment."),s.discontinuity=!0;else if("EXT-X-GAP"===d)o.compatibleVersion<8&&(o.compatibleVersion=8),s.gap=!0;else if("EXT-X-KEY"===d)s.parts.length>0&&T.INVALIDPLAYLIST("EXT-X-KEY must appear before the first EXT-X-PART tag of the Parent Segment."),A(o,p),s.key=new f.Key({method:p.METHOD,uri:p.URI,iv:p.IV,format:p.KEYFORMAT,formatVersion:p.KEYFORMATVERSIONS});else if("EXT-X-MAP"===d)s.parts.length>0&&T.INVALIDPLAYLIST("EXT-X-MAP must appear before the first EXT-X-PART tag of the Parent Segment."),o.compatibleVersion<5&&(o.compatibleVersion=5),o.hasMap=!0,s.map=new f.MediaInitializationSection({uri:p.URI,byterange:p.BYTERANGE});else if("EXT-X-PROGRAM-DATE-TIME"===d)s.programDateTime=h;else if("EXT-X-DATERANGE"===d){for(var I={},v=0,y=Object.keys(p);v<y.length;v++){var S=y[v];(S.startsWith("SCTE35-")||S.startsWith("X-"))&&(I[S]=p[S])}s.dateRange=new f.DateRange({id:p.ID,classId:p.CLASS,start:p["START-DATE"],end:p["END-DATE"],duration:p.DURATION,plannedDuration:p["PLANNED-DURATION"],endOnNext:p["END-ON-NEXT"],attributes:I})}else if("EXT-X-CUE-OUT"===d)s.markers.push(new f.SpliceInfo({type:"OUT",duration:p&&p.DURATION||h}));else if("EXT-X-CUE-IN"===d)s.markers.push(new f.SpliceInfo({type:"IN"}));else if("EXT-X-CUE-OUT-CONT"===d||"EXT-X-CUE"===d||"EXT-OATCLS-SCTE35"===d||"EXT-X-ASSET"===d||"EXT-X-SCTE35"===d)s.markers.push(new f.SpliceInfo({type:"RAW",tagName:d,value:h}));else if("EXT-X-PRELOAD-HINT"!==d||p.TYPE)if("EXT-X-PRELOAD-HINT"===d&&"PART"===p.TYPE&&c)T.INVALIDPLAYLIST("Servers should not add more than one EXT-X-PRELOAD-HINT tag with the same TYPE attribute to a Playlist.");else if("EXT-X-PART"!==d&&"EXT-X-PRELOAD-HINT"!==d||p.URI){if("EXT-X-PRELOAD-HINT"===d&&"MAP"===p.TYPE)u&&T.INVALIDPLAYLIST("Servers should not add more than one EXT-X-PRELOAD-HINT tag with the same TYPE attribute to a Playlist."),u=!0,o.hasMap=!0,s.map=new f.MediaInitializationSection({hint:!0,uri:p.URI,byterange:{length:p["BYTERANGE-LENGTH"],offset:p["BYTERANGE-START"]||0}});else if("EXT-X-PART"===d||"EXT-X-PRELOAD-HINT"===d&&"PART"===p.TYPE){"EXT-X-PART"!==d||p.DURATION||T.INVALIDPLAYLIST("EXT-X-PART: DURATION attribute is mandatory"),"EXT-X-PRELOAD-HINT"===d&&(c=!0);var N=new f.PartialSegment({hint:"EXT-X-PRELOAD-HINT"===d,uri:p.URI,byterange:"EXT-X-PART"===d?p.BYTERANGE:{length:p["BYTERANGE-LENGTH"],offset:p["BYTERANGE-START"]||0},duration:p.DURATION,independent:p.INDEPENDENT,gap:p.GAP});s.gap&&!N.gap&&T.INVALIDPLAYLIST("Partial segments must have GAP=YES if they are in a gap (EXT-X-GAP)"),s.parts.push(N)}}else T.INVALIDPLAYLIST("EXT-X-PART / EXT-X-PRELOAD-HINT: URI attribute is mandatory");else T.INVALIDPLAYLIST("EXT-X-PRELOAD-HINT: TYPE attribute is mandatory")}return s}function X(t,e,n,r,a,i,o){for(var s=new f.PrefetchSegment({uri:e,mediaSequenceNumber:a,discontinuitySequence:i}),u=n;u<=r;u++){var c=t[u],l=c.name,E=c.attributes;"EXTINF"===l?T.INVALIDPLAYLIST("A prefetch segment must not be advertised with an EXTINF tag."):"EXT-X-DISCONTINUITY"===l?T.INVALIDPLAYLIST("A prefetch segment must not be advertised with an EXT-X-DISCONTINUITY tag."):"EXT-X-PREFETCH-DISCONTINUITY"===l?s.discontinuity=!0:"EXT-X-KEY"===l?(A(o,E),s.key=new f.Key({method:E.METHOD,uri:E.URI,iv:E.IV,format:E.KEYFORMAT,formatVersion:E.KEYFORMATVERSIONS})):"EXT-X-MAP"===l&&T.INVALIDPLAYLIST("Prefetch segments must not be advertised with an EXT-X-MAP tag.")}return s}function b(t,e){var n,i=new f.MediaPlaylist,o=-1,s=0,u=!1,c=!1,l=0,E=null,d=null,h=!1,p=a(t.entries());try{for(p.s();!(n=p.n()).done;){var I=r(n.value,2),v=I[0],A=I[1],y=D(A),S=y.name,N=y.value,m=y.attributes;if("Segment"!==y.category){if("EXT-X-VERSION"===S)void 0===i.version?i.version=N:T.INVALIDPLAYLIST("A Playlist file MUST NOT contain more than one EXT-X-VERSION tag.");else if("EXT-X-TARGETDURATION"===S)i.targetDuration=e.targetDuration=N;else if("EXT-X-MEDIA-SEQUENCE"===S)i.segments.length>0&&T.INVALIDPLAYLIST("The EXT-X-MEDIA-SEQUENCE tag MUST appear before the first Media Segment in the Playlist."),i.mediaSequenceBase=s=N;else if("EXT-X-DISCONTINUITY-SEQUENCE"===S)i.segments.length>0&&T.INVALIDPLAYLIST("The EXT-X-DISCONTINUITY-SEQUENCE tag MUST appear before the first Media Segment in the Playlist."),u&&T.INVALIDPLAYLIST("The EXT-X-DISCONTINUITY-SEQUENCE tag MUST appear before any EXT-X-DISCONTINUITY tag."),i.discontinuitySequenceBase=l=N;else if("EXT-X-ENDLIST"===S)i.endlist=!0;else if("EXT-X-PLAYLIST-TYPE"===S)i.playlistType=N;else if("EXT-X-I-FRAMES-ONLY"===S)e.compatibleVersion<4&&(e.compatibleVersion=4),i.isIFrame=!0;else if("EXT-X-INDEPENDENT-SEGMENTS"===S)i.independentSegments&&T.INVALIDPLAYLIST("EXT-X-INDEPENDENT-SEGMENTS tag MUST NOT appear more than once in a Playlist"),i.independentSegments=!0;else if("EXT-X-START"===S)i.start&&T.INVALIDPLAYLIST("EXT-X-START tag MUST NOT appear more than once in a Playlist"),"number"!=typeof m["TIME-OFFSET"]&&T.INVALIDPLAYLIST("EXT-X-START: TIME-OFFSET attribute is REQUIRED"),i.start={offset:m["TIME-OFFSET"],precise:m.PRECISE||!1};else if("EXT-X-SERVER-CONTROL"===S)m["CAN-BLOCK-RELOAD"]||T.INVALIDPLAYLIST("EXT-X-SERVER-CONTROL: CAN-BLOCK-RELOAD=YES is mandatory for Low-Latency HLS"),i.lowLatencyCompatibility={canBlockReload:m["CAN-BLOCK-RELOAD"],canSkipUntil:m["CAN-SKIP-UNTIL"],holdBack:m["HOLD-BACK"],partHoldBack:m["PART-HOLD-BACK"]};else if("EXT-X-PART-INF"===S)m["PART-TARGET"]||T.INVALIDPLAYLIST("EXT-X-PART-INF: PART-TARGET attribute is mandatory"),i.partTargetDuration=m["PART-TARGET"];else if("EXT-X-RENDITION-REPORT"===S)m.URI||T.INVALIDPLAYLIST("EXT-X-RENDITION-REPORT: URI attribute is mandatory"),0===m.URI.search(/^[a-z]+:/)&&T.INVALIDPLAYLIST("EXT-X-RENDITION-REPORT: URI must be relative to the playlist uri"),i.renditionReports.push(new f.RenditionReport({uri:m.URI,lastMSN:m["LAST-MSN"],lastPart:m["LAST-PART"]}));else if("EXT-X-SKIP"===S)m["SKIPPED-SEGMENTS"]||T.INVALIDPLAYLIST("EXT-X-SKIP: SKIPPED-SEGMENTS attribute is mandatory"),e.compatibleVersion<9&&(e.compatibleVersion=9),i.skip=m["SKIPPED-SEGMENTS"],s+=i.skip;else if("EXT-X-PREFETCH"===S){var b=X(t,N,-1===o?v:o,v-1,s++,l,e);b&&(b.discontinuity&&(b.discontinuitySequence++,l=b.discontinuitySequence),b.key?E=b.key:b.key=E,i.prefetchSegments.push(b)),c=!0,o=-1}else if("string"==typeof A){-1===o&&T.INVALIDPLAYLIST("A URI line is not preceded by any segment tags"),i.targetDuration||T.INVALIDPLAYLIST("The EXT-X-TARGETDURATION tag is REQUIRED"),c&&T.INVALIDPLAYLIST("These segments must appear after all complete segments.");var R=g(t,A,o,v-1,s++,l,e);if(R){var P=r(O(i,R,l,E,d),3);l=P[0],E=P[1],d=P[2],!h&&R.parts.length>0&&(h=!0)}o=-1}}else-1===o&&(o=v),"EXT-X-DISCONTINUITY"===S&&(u=!0)}}catch(t){p.e(t)}finally{p.f()}if(-1!==o){var L=g(t,"",o,t.length-1,s++,l,e);if(L){var C,M=L.parts;!(M.length>0)||i.endlist||null!==(C=M.at(-1))&&void 0!==C&&C.hint||T.INVALIDPLAYLIST("If the Playlist contains EXT-X-PART tags and does not contain an EXT-X-ENDLIST tag, the Playlist must contain an EXT-X-PRELOAD-HINT tag with a TYPE=PART attribute"),O(i,L,E,d),!h&&L.parts.length>0&&(h=!0)}}return function(t){for(var e=new Map,n=new Map,r=!1,i=!1,o=t.length-1;o>=0;o--){var s=t[o],u=s.programDateTime,c=s.dateRange;if(u&&(i=!0),c&&c.start){r=!0,c.endOnNext&&(c.end||c.duration)&&T.INVALIDPLAYLIST("An EXT-X-DATERANGE tag with an END-ON-NEXT=YES attribute MUST NOT contain DURATION or END-DATE attributes.");var l=c.start.getTime(),f=c.duration||0;c.end&&c.duration&&l+1e3*f!==c.end.getTime()&&T.INVALIDPLAYLIST("END-DATE MUST be equal to the value of the START-DATE attribute plus the value of the DURATION"),c.endOnNext&&(c.end=e.get(c.classId)),e.set(c.classId,c.start);var E=c.end?c.end.getTime():c.start.getTime()+1e3*(c.duration||0),d=n.get(c.classId);if(d){var h,p=a(d);try{for(p.s();!(h=p.n()).done;){var I=h.value;(I.start<=l&&I.end>l||I.start>=l&&I.start<E)&&T.INVALIDPLAYLIST("DATERANGE tags with the same CLASS should not overlap")}}catch(t){p.e(t)}finally{p.f()}d.push({start:l,end:E})}else c.classId&&n.set(c.classId,[{start:l,end:E}])}}r&&!i&&T.INVALIDPLAYLIST("If a Playlist contains an EXT-X-DATERANGE tag, it MUST also contain at least one EXT-X-PROGRAM-DATE-TIME tag.")}(i.segments),i.lowLatencyCompatibility&&function(t,e){var n=t.lowLatencyCompatibility,i=t.targetDuration,o=t.partTargetDuration,s=t.segments,u=t.renditionReports,c=n.canSkipUntil,l=n.holdBack,f=n.partHoldBack;c<6*i&&T.INVALIDPLAYLIST("The Skip Boundary must be at least six times the EXT-X-TARGETDURATION.");l<3*i&&T.INVALIDPLAYLIST("HOLD-BACK must be at least three times the EXT-X-TARGETDURATION.");if(e){void 0===o&&T.INVALIDPLAYLIST("EXT-X-PART-INF is required if a Playlist contains one or more EXT-X-PART tags"),void 0===f&&T.INVALIDPLAYLIST("EXT-X-PART: PART-HOLD-BACK attribute is mandatory"),f<o&&T.INVALIDPLAYLIST("PART-HOLD-BACK must be at least PART-TARGET");var E,d=a(s.entries());try{for(d.s();!(E=d.n()).done;){var h=r(E.value,2),p=h[0],I=h[1].parts;I.length>0&&p<s.length-3&&T.INVALIDPLAYLIST("Remove EXT-X-PART tags from the Playlist after they are greater than three target durations from the end of the Playlist.");var v,A=a(I.entries());try{for(A.s();!(v=A.n()).done;){var y=r(v.value,2),S=y[0],N=y[1].duration;void 0!==N&&(N>o&&T.INVALIDPLAYLIST("PART-TARGET is the maximum duration of any Partial Segment"),S<I.length-1&&N<.85*o&&T.INVALIDPLAYLIST("All Partial Segments except the last part of a segment must have a duration of at least 85% of PART-TARGET"))}}catch(t){A.e(t)}finally{A.f()}}}catch(t){d.e(t)}finally{d.f()}}var m,g=a(u);try{for(g.s();!(m=g.n()).done;){var X,b=m.value,O=s.at(-1);null!==(X=b.lastMSN)&&void 0!==X||(b.lastMSN=O.mediaSequenceNumber),(null===b.lastPart||void 0===b.lastPart)&&O.parts.length>0&&(b.lastPart=O.parts.length-1)}}catch(t){g.e(t)}finally{g.f()}}(i,h),i}function O(t,e,n,r,a){var i=e.discontinuity,o=e.key,s=e.map,u=e.byterange,c=e.uri;if(i&&(e.discontinuitySequence=n+1),o||(e.key=r),s||(e.map=a),u&&-1===u.offset){var l=t.segments;if(l.length>0){var f=l.at(-1);f.byterange&&f.uri===c?u.offset=f.byterange.offset+f.byterange.length:T.INVALIDPLAYLIST("If offset of EXT-X-BYTERANGE is not present, a previous Media Segment MUST be a sub-range of the same media resource")}else T.INVALIDPLAYLIST("If offset of EXT-X-BYTERANGE is not present, a previous Media Segment MUST appear in the Playlist file")}return t.segments.push(e),[e.discontinuitySequence,e.key,e.map]}function R(t,e){var n=function(t){var e=t.indexOf(":");return-1===e?[t.slice(1).trim(),null]:[t.slice(1,e).trim(),t.slice(e+1).trim()]}(t),a=r(n,2),i=a[0],o=a[1],s=function(t){switch(t){case"EXTM3U":case"EXT-X-VERSION":case"EXT-X-CONTENT-STEERING":return"Basic";case"EXTINF":case"EXT-X-BYTERANGE":case"EXT-X-DISCONTINUITY":case"EXT-X-PREFETCH-DISCONTINUITY":case"EXT-X-KEY":case"EXT-X-MAP":case"EXT-X-PROGRAM-DATE-TIME":case"EXT-X-DATERANGE":case"EXT-X-CUE-OUT":case"EXT-X-CUE-IN":case"EXT-X-CUE-OUT-CONT":case"EXT-X-CUE":case"EXT-OATCLS-SCTE35":case"EXT-X-ASSET":case"EXT-X-SCTE35":case"EXT-X-PART":case"EXT-X-PRELOAD-HINT":case"EXT-X-GAP":return"Segment";case"EXT-X-TARGETDURATION":case"EXT-X-MEDIA-SEQUENCE":case"EXT-X-DISCONTINUITY-SEQUENCE":case"EXT-X-ENDLIST":case"EXT-X-PLAYLIST-TYPE":case"EXT-X-I-FRAMES-ONLY":case"EXT-X-SERVER-CONTROL":case"EXT-X-PART-INF":case"EXT-X-PREFETCH":case"EXT-X-RENDITION-REPORT":case"EXT-X-SKIP":return"MediaPlaylist";case"EXT-X-MEDIA":case"EXT-X-STREAM-INF":case"EXT-X-I-FRAME-STREAM-INF":case"EXT-X-SESSION-DATA":case"EXT-X-SESSION-KEY":return"MasterPlaylist";case"EXT-X-INDEPENDENT-SEGMENTS":case"EXT-X-START":return"MediaorMasterPlaylist";default:return"Unknown"}}(i);if(function(t,e){if("Segment"===t||"MediaPlaylist"===t)return void 0===e.isMasterPlaylist?void(e.isMasterPlaylist=!1):void(e.isMasterPlaylist&&S());if("MasterPlaylist"===t){if(void 0===e.isMasterPlaylist)return void(e.isMasterPlaylist=!0);!1===e.isMasterPlaylist&&S()}}(s,e),"Unknown"===s)return null;"MediaPlaylist"===s&&"EXT-X-RENDITION-REPORT"!==i&&"EXT-X-PREFETCH"!==i&&(e.hash[i]&&T.INVALIDPLAYLIST("There MUST NOT be more than one Media Playlist tag of each type in any Media Playlist"),e.hash[i]=!0);var u=function(t,e){switch(t){case"EXTM3U":case"EXT-X-DISCONTINUITY":case"EXT-X-ENDLIST":case"EXT-X-I-FRAMES-ONLY":case"EXT-X-INDEPENDENT-SEGMENTS":case"EXT-X-CUE-IN":case"EXT-X-GAP":return[null,null];case"EXT-X-VERSION":case"EXT-X-TARGETDURATION":case"EXT-X-MEDIA-SEQUENCE":case"EXT-X-DISCONTINUITY-SEQUENCE":return[T.toNumber(e),null];case"EXT-X-CUE-OUT":return Number.isNaN(Number(e))?[null,y(e)]:[T.toNumber(e),null];case"EXT-X-KEY":case"EXT-X-MAP":case"EXT-X-DATERANGE":case"EXT-X-MEDIA":case"EXT-X-STREAM-INF":case"EXT-X-I-FRAME-STREAM-INF":case"EXT-X-SESSION-DATA":case"EXT-X-SESSION-KEY":case"EXT-X-START":case"EXT-X-SERVER-CONTROL":case"EXT-X-PART-INF":case"EXT-X-PART":case"EXT-X-PRELOAD-HINT":case"EXT-X-RENDITION-REPORT":case"EXT-X-SKIP":return[null,y(e)];case"EXTINF":return[d(e),null];case"EXT-X-BYTERANGE":return[h(e),null];case"EXT-X-PROGRAM-DATE-TIME":return[new Date(e),null];default:return[e,null]}}(i,o),c=r(u,2);return{name:i,category:s,value:c[0],attributes:c[1]}}function P(t,e){var n;return e.isMasterPlaylist?n=function(t,e){var n,i=new f.MasterPlaylist,o=!1,s=a(t.entries());try{var u=function(){var a=r(n.value,2),s=a[0],u=D(a[1]),c=u.name,l=u.value,E=u.attributes;if("EXT-X-VERSION"===c)i.version=l;else if("EXT-X-CONTENT-STEERING-SERVER"===c){var d=new f.ContentSteering({serverUri:E["SERVER-URI"],pathwayId:E["PATHWAY-ID"]});i.contentSteering=d}else if("EXT-X-STREAM-INF"===c){var h=t[s+1];("string"!=typeof h||h.startsWith("#EXT"))&&T.INVALIDPLAYLIST("EXT-X-STREAM-INF must be followed by a URI line");var p=m(t,E,h,!1,e);p&&("number"==typeof p.score&&(o=!0,p.score<0&&T.INVALIDPLAYLIST("SCORE attribute on EXT-X-STREAM-INF must be positive decimal-floating-point number.")),i.variants.push(p))}else if("EXT-X-I-FRAME-STREAM-INF"===c){var I=m(t,E,E.URI,!0,e);I&&i.variants.push(I)}else if("EXT-X-SESSION-DATA"===c){var v=new f.SessionData({id:E["DATA-ID"],value:E.VALUE,uri:E.URI,language:E.LANGUAGE});i.sessionDataList.some((function(t){return t.id===v.id&&t.language===v.language}))&&T.INVALIDPLAYLIST("A Playlist MUST NOT contain more than one EXT-X-SESSION-DATA tag with the same DATA-ID attribute and the same LANGUAGE attribute."),i.sessionDataList.push(v)}else if("EXT-X-SESSION-KEY"===c){"NONE"===E.METHOD&&T.INVALIDPLAYLIST("EXT-X-SESSION-KEY: The value of the METHOD attribute MUST NOT be NONE");var y=new f.Key({method:E.METHOD,uri:E.URI,iv:E.IV,format:E.KEYFORMAT,formatVersion:E.KEYFORMATVERSIONS});i.sessionKeyList.some((function(t){return function(t,e){if(t.method!==e.method)return!1;if(t.uri!==e.uri)return!1;if(t.iv){if(!e.iv)return!1;if(t.iv.byteLength!==e.iv.byteLength)return!1;for(var n=0;n<t.iv.byteLength;n++)if(t.iv[n]!==e.iv[n])return!1}else if(e.iv)return!1;return t.format===e.format&&t.formatVersion===e.formatVersion}(t,y)}))&&T.INVALIDPLAYLIST("A Master Playlist MUST NOT contain more than one EXT-X-SESSION-KEY tag with the same METHOD, URI, IV, KEYFORMAT, and KEYFORMATVERSIONS attribute values."),A(e,E),i.sessionKeyList.push(y)}else"EXT-X-INDEPENDENT-SEGMENTS"===c?(i.independentSegments&&T.INVALIDPLAYLIST("EXT-X-INDEPENDENT-SEGMENTS tag MUST NOT appear more than once in a Playlist"),i.independentSegments=!0):"EXT-X-START"===c&&(i.start&&T.INVALIDPLAYLIST("EXT-X-START tag MUST NOT appear more than once in a Playlist"),"number"!=typeof E["TIME-OFFSET"]&&T.INVALIDPLAYLIST("EXT-X-START: TIME-OFFSET attribute is REQUIRED"),i.start={offset:E["TIME-OFFSET"],precise:E.PRECISE||!1})};for(s.s();!(n=s.n()).done;)u()}catch(t){s.e(t)}finally{s.f()}if(o){var c,l=a(i.variants);try{for(l.s();!(c=l.n()).done;)"number"!=typeof c.value.score&&T.INVALIDPLAYLIST("If any Variant Stream contains the SCORE attribute, then all Variant Streams in the Master Playlist SHOULD have a SCORE attribute")}catch(t){l.e(t)}finally{l.f()}}if(e.isClosedCaptionsNone){var E,d=a(i.variants);try{for(d.s();!(E=d.n()).done;)E.value.closedCaptions.length>0&&T.INVALIDPLAYLIST("If there is a variant with CLOSED-CAPTIONS attribute of NONE, all EXT-X-STREAM-INF tags MUST have this attribute with a value of NONE")}catch(t){d.e(t)}finally{d.f()}}return i}(t,e):!(n=b(t,e)).isIFrame&&e.hasMap&&e.compatibleVersion<6&&(e.compatibleVersion=6),e.compatibleVersion>1&&(!n.version||n.version<e.compatibleVersion)&&T.INVALIDPLAYLIST("EXT-X-VERSION needs to be ".concat(e.compatibleVersion," or higher.")),n}function D(t){return"string"==typeof t?{}:t}e.default=function(t){var e={version:void 0,isMasterPlaylist:void 0,hasMap:!1,targetDuration:0,compatibleVersion:1,isClosedCaptionsNone:!1,hash:{}},n=P(function(t,e){var n,r=[],i=a(t.split("\n"));try{for(i.s();!(n=i.n()).done;){var o=n.value.trim();if(o)if(o.startsWith("#")){if(o.startsWith("#EXT")){var s=R(o,e);s&&r.push(s)}}else r.push(o)}}catch(t){i.e(t)}finally{i.f()}return 0!==r.length&&"EXTM3U"===r[0].name||T.INVALIDPLAYLIST("The EXTM3U tag MUST be the first line."),r}(t,e),e);return n.source=t,n}},887:function(t,e,n){function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function a(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,a,i,o,s=[],u=!0,c=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,a=t}finally{try{if(!u&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw a}}return s}}(t,e)||o(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=o(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,a=function(){};return{s:a,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){u=!0,i=t},f:function(){try{s||null==n.return||n.return()}finally{if(u)throw i}}}}function o(t,e){if(t){if("string"==typeof t)return s(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(t,e):void 0}}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function u(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,p(r.key),r)}}function c(t,e,n){return e=h(e),function(t,e){if(e&&("object"==r(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,E()?Reflect.construct(e,n||[],h(t).constructor):e.apply(t,n))}function l(t,e,n,r){var a=T(h(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof a?function(t){return a.apply(n,t)}:a}function T(){return T="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=h(t)););return t}(t,e);if(r){var a=Object.getOwnPropertyDescriptor(r,e);return a.get?a.get.call(arguments.length<3?t:n):a.value}},T.apply(null,arguments)}function f(t){var e="function"==typeof Map?new Map:void 0;return f=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return function(t,e,n){if(E())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var a=new(t.bind.apply(t,r));return n&&d(a,n.prototype),a}(t,arguments,h(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),d(n,t)},f(t)}function E(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(E=function(){return!!t})()}function d(t,e){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},d(t,e)}function h(t){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},h(t)}function p(t){var e=function(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var a=n.call(t,e||"default");if("object"!=r(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==r(e)?e:e+""}var I,v=this&&this.__createBinding||(Object.create?function(t,e,n,r){void 0===r&&(r=n);var a=Object.getOwnPropertyDescriptor(e,n);a&&!("get"in a?!e.__esModule:a.writable||a.configurable)||(a={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,r,a)}:function(t,e,n,r){void 0===r&&(r=n),t[r]=e[n]}),A=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),y=this&&this.__importStar||(I=function(t){return I=Object.getOwnPropertyNames||function(t){var e=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[e.length]=n);return e},I(t)},function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n=I(t),r=0;r<n.length;r++)"default"!==n[r]&&v(e,t,n[r]);return A(e,t),e});Object.defineProperty(e,"__esModule",{value:!0});var S=y(n(203)),N=["#EXTINF","#EXT-X-BYTERANGE","#EXT-X-DISCONTINUITY","#EXT-X-STREAM-INF","#EXT-X-CUE-OUT","#EXT-X-CUE-IN","#EXT-X-KEY","#EXT-X-MAP"],m=["#EXT-X-MEDIA"],g=function(t){function e(t){var n,r,a,i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),n=c(this,e),r=n,i=void 0,(a=p(a="baseUri"))in r?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writabl