diff --git a/development/54b017c39fb7386fcfd807f5049c9dcd5c8247d4/binaries/stremio_core_web_bg.wasm b/development/9503e90e54893bd23a1dcd4ba51b7f6427c29002/binaries/stremio_core_web_bg.wasm similarity index 100% rename from development/54b017c39fb7386fcfd807f5049c9dcd5c8247d4/binaries/stremio_core_web_bg.wasm rename to development/9503e90e54893bd23a1dcd4ba51b7f6427c29002/binaries/stremio_core_web_bg.wasm diff --git a/development/54b017c39fb7386fcfd807f5049c9dcd5c8247d4/scripts/main.js b/development/9503e90e54893bd23a1dcd4ba51b7f6427c29002/scripts/main.js similarity index 54% rename from development/54b017c39fb7386fcfd807f5049c9dcd5c8247d4/scripts/main.js rename to development/9503e90e54893bd23a1dcd4ba51b7f6427c29002/scripts/main.js index b63401418..66b744c32 100644 --- a/development/54b017c39fb7386fcfd807f5049c9dcd5c8247d4/scripts/main.js +++ b/development/9503e90e54893bd23a1dcd4ba51b7f6427c29002/scripts/main.js @@ -1,2 +1,2 @@ -(()=>{var e,t,a={43957:(e,t,a)=>{"use strict";var i=a(28161),o=i(a(49507)),E=i(a(68048));function n(){return Math.random().toString(32).slice(2)}e.exports=function(e,t){t.addEventListener("message",(function(){var a=(0,E.default)(o.default.mark(function a(i){var E,n,_,r,T,S,s;return o.default.wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(E=i.data.request){a.next=3;break}return a.abrupt("return");case 3:if(n=E.id,_=E.path,r=E.args,a.prev=4,"function"!=typeof(T=_.reduce(function(e,t){return e[t]},e))){a.next=13;break}return s=_.slice(0,_.length-1).reduce(function(e,t){return e[t]},e),a.next=10,T.apply(s,r);case 10:S=a.sent,a.next=16;break;case 13:return a.next=15,T;case 15:S=a.sent;case 16:t.postMessage({response:{id:n,result:{data:S}}}),a.next=22;break;case 19:a.prev=19,a.t0=a.catch(4),t.postMessage({response:{id:n,result:{error:a.t0}}});case 22:case"end":return a.stop()}},a,null,[[4,19]])}));return function(e){return a.apply(this,arguments)}})()),this.call=(function(){var e=(0,E.default)(o.default.mark(function e(a,i){var E;return o.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return E=n(),e.abrupt("return",new Promise(function(e,o){t.addEventListener("message",function a(i){var n=i.data.response;n&&n.id===E&&(t.removeEventListener("message",a),"error"in n.result?o(n.result.error):e(n.result.data))}),t.postMessage({request:{id:E,path:a,args:i}})}));case 2:case"end":return e.stop()}},e)}));return function(t,a){return e.apply(this,arguments)}})()}},78012:(e,t,a)=>{var i=a(55852),o=a(88265);function E(e){var t=(e=e||{}).containerElement;if(!(t instanceof HTMLElement))throw new Error("Container element required to be instance of HTMLElement");var a=e.chromecastTransport;if(!a)throw new Error("Chromecast transport required");var E=a.getCastDevice();if(null===E)throw new Error("Chromecast session must be started");var n=document.createElement("div");n.style.display="flex",n.style.flexDirection="row",n.style.alignItems="center",n.style.justifyContent="center",n.style.width="100%",n.style.height="100%",n.style.backgroundColor="black";var _=document.createElement("div");_.style.flex="none",_.style.maxWidth="80%",_.style.fontSize="5vmin",_.style.lineHeight="1.2em",_.style.maxHeight="3.6em",_.style.textAlign="center",_.style.color="#FFFFFF90",_.innerText="Casting to "+E.friendlyName,n.appendChild(_),t.appendChild(n),a.on("message",I),a.on("message-error",l);var r=new i,T=!1,S={stream:!1,loaded:!1,paused:!1,time:!1,duration:!1,buffering:!1,buffered:!1,audioTracks:!1,selectedAudioTrackId:!1,subtitlesTracks:!1,selectedSubtitlesTrackId:!1,subtitlesOffset:!1,subtitlesSize:!1,subtitlesTextColor:!1,subtitlesBackgroundColor:!1,subtitlesOutlineColor:!1,volume:!1,muted:!1,playbackSpeed:!1,videoParams:!1,extraSubtitlesTracks:!1,selectedExtraSubtitlesTrackId:!1,extraSubtitlesDelay:!1,extraSubtitlesSize:!1,extraSubtitlesOffset:!1,extraSubtitlesTextColor:!1,extraSubtitlesBackgroundColor:!1,extraSubtitlesOutlineColor:!1};function s(e,t){r.emit("error",Object.assign({},o.CHROMECAST_SENDER_VIDEO.MESSAGE_SEND_FAILED,{error:e,action:t}))}function l(e){r.emit("error",Object.assign({},o.CHROMECAST_SENDER_VIDEO.INVALID_MESSAGE_RECEIVED,{error:e}))}function I(e){if(e&&"string"==typeof e.event){var t=Array.isArray(e.args)?e.args:[];r.emit.apply(r,[e.event].concat(t))}else l(new Error("Invalid message: "+e))}function A(e,t){S[e]&&r.emit("propChanged",e,t)}this.on=function(e,t){if(T)throw new Error("Video is destroyed");r.on(e,t)},this.dispatch=function(e){if(T)throw new Error("Video is destroyed");if(e)switch(e.type){case"observeProp":return o=e.propName,S.hasOwnProperty(o)&&(S[o]=!0),void a.sendMessage(e).catch(function(t){s(t,e)});case"setProp":return void a.sendMessage(e).catch(function(t){s(t,e)});case"command":return i=e.commandName,e.commandArgs,"destroy"===i&&(T=!0,A("stream",null),A("loaded",null),A("paused",null),A("time",null),A("duration",null),A("buffering",null),A("buffered",null),A("audioTracks",[]),A("selectedAudioTrackId",[]),A("subtitlesTracks",[]),A("selectedSubtitlesTrackId",null),A("subtitlesOffset",null),A("subtitlesSize",null),A("subtitlesTextColor",null),A("subtitlesBackgroundColor",null),A("subtitlesOutlineColor",null),A("volume",null),A("muted",null),A("playbackSpeed",null),A("videoParams",null),A("extraSubtitlesTracks",[]),A("selectedExtraSubtitlesTrackId",null),A("extraSubtitlesDelay",null),A("extraSubtitlesSize",null),A("extraSubtitlesOffset",null),A("extraSubtitlesTextColor",null),A("extraSubtitlesBackgroundColor",null),A("extraSubtitlesOutlineColor",null),r.removeAllListeners(),a.off("message",I),t.removeChild(n)),void a.sendMessage(e).catch(function(t){s(t,e)})}var i,o;throw new Error("Invalid action dispatched: "+JSON.stringify(e))}}E.canPlayStream=function(){return Promise.resolve(!0)},E.manifest={name:"ChromecastSenderVideo",external:!0,props:["stream","loaded","paused","time","duration","buffering","buffered","audioTracks","selectedAudioTrackId","subtitlesTracks","selectedSubtitlesTrackId","subtitlesOffset","subtitlesSize","subtitlesTextColor","subtitlesBackgroundColor","subtitlesOutlineColor","volume","muted","playbackSpeed","videoParams","extraSubtitlesTracks","selectedExtraSubtitlesTrackId","extraSubtitlesDelay","extraSubtitlesSize","extraSubtitlesOffset","extraSubtitlesTextColor","extraSubtitlesBackgroundColor","extraSubtitlesOutlineColor"],commands:["load","unload","destroy","addExtraSubtitlesTracks"],events:["propValue","propChanged","ended","error","subtitlesTrackLoaded","audioTrackLoaded","extraSubtitlesTrackLoaded","implementationChanged"]},e.exports=E},22271:(e,t,a)=>{var i=a(78012);e.exports=i},99332:(e,t,a)=>{var i=a(55852),o=a(53683),E=a(55126),n=a(68816),_=a(38742),r=a(88265),T=a(61555),S=a(54171);function s(e){var t=(e=e||{}).containerElement;if(!(t instanceof HTMLElement))throw new Error("Container element required to be instance of HTMLElement");var a=document.createElement("style");t.appendChild(a),a.sheet.insertRule("video::cue { font-size: 4vmin; color: rgb(255, 255, 255); background-color: rgba(0, 0, 0, 0); text-shadow: -0.15rem -0.15rem 0.15rem rgb(34, 34, 34), 0px -0.15rem 0.15rem rgb(34, 34, 34), 0.15rem -0.15rem 0.15rem rgb(34, 34, 34), -0.15rem 0px 0.15rem rgb(34, 34, 34), 0.15rem 0px 0.15rem rgb(34, 34, 34), -0.15rem 0.15rem 0.15rem rgb(34, 34, 34), 0px 0.15rem 0.15rem rgb(34, 34, 34), 0.15rem 0.15rem 0.15rem rgb(34, 34, 34); }");var s=document.createElement("video");s.style.width="100%",s.style.height="100%",s.style.backgroundColor="black",s.controls=!1,s.playsInline=!0,s.onerror=function(){!(function(){if(A)return;var e;switch(s.error.code){case 1:e=r.HTML_VIDEO.MEDIA_ERR_ABORTED;break;case 2:e=r.HTML_VIDEO.MEDIA_ERR_NETWORK;break;case 3:e=r.HTML_VIDEO.MEDIA_ERR_DECODE;break;case 4:e=r.HTML_VIDEO.MEDIA_ERR_SRC_NOT_SUPPORTED;break;default:e=r.UNKNOWN_ERROR}m(Object.assign({},e,{critical:!0,error:s.error}))})()},s.onended=function(){I.emit("ended")},s.onpause=function(){L("paused")},s.onplay=function(){L("paused")},s.ontimeupdate=function(){L("time"),L("buffered")},s.ondurationchange=function(){L("duration")},s.onwaiting=function(){L("buffering"),L("buffered")},s.onseeking=function(){L("time"),L("buffering"),L("buffered")},s.onseeked=function(){L("time"),L("buffering"),L("buffered")},s.onstalled=function(){L("buffering"),L("buffered")},s.onplaying=function(){L("time"),L("buffering"),L("buffered")},s.oncanplay=function(){L("buffering"),L("buffered")},s.canplaythrough=function(){L("buffering"),L("buffered")},s.onloadedmetadata=function(){L("loaded")},s.onloadeddata=function(){L("buffering"),L("buffered")},s.onvolumechange=function(){L("volume"),L("muted")},s.onratechange=function(){L("playbackSpeed")},s.textTracks.onchange=function(){L("subtitlesTracks"),L("selectedSubtitlesTrackId"),c(),Array.from(s.textTracks).forEach(function(e){e.oncuechange=c})},t.appendChild(s);var l=null,I=new i,A=!1,O=null,u=0,d=1,N={stream:!1,loaded:!1,paused:!1,time:!1,duration:!1,buffering:!1,buffered:!1,subtitlesTracks:!1,selectedSubtitlesTrackId:!1,subtitlesOffset:!1,subtitlesSize:!1,subtitlesTextColor:!1,subtitlesBackgroundColor:!1,subtitlesOutlineColor:!1,audioTracks:!1,selectedAudioTrackId:!1,volume:!1,muted:!1,playbackSpeed:!1};function R(e){switch(e){case"stream":return O;case"loaded":return null===O?null:s.readyState>=s.HAVE_METADATA;case"paused":return null===O?null:!!s.paused;case"time":return null!==O&&null!==s.currentTime&&isFinite(s.currentTime)?Math.floor(1e3*s.currentTime):null;case"duration":return null!==O&&null!==s.duration&&isFinite(s.duration)?Math.floor(1e3*s.duration):null;case"buffering":return null===O?null:s.readyState0?e.lang:"string"==typeof e.name&&e.name.length>0?e.name:String(e.id),label:"string"==typeof e.name&&e.name.length>0?e.name:"string"==typeof e.lang&&e.lang.length>0?e.lang:String(e.id),origin:"EMBEDDED",embedded:!0})}):[];case"selectedAudioTrackId":return null!==l&&null!==l.audioTrack&&isFinite(l.audioTrack)&&-1!==l.audioTrack?"EMBEDDED_"+String(l.audioTrack):null;case"volume":return A||null===s.volume||!isFinite(s.volume)?null:Math.floor(100*s.volume);case"muted":return A?null:!!s.muted;case"playbackSpeed":return A||null===s.playbackRate||!isFinite(s.playbackRate)?null:s.playbackRate;default:return null}}function c(){Array.from(s.textTracks).forEach(function(e){Array.from(e.cues||[]).forEach(function(e){e.snapToLines=!1,e.line=100-u})})}function m(e){I.emit("error",e),e.critical&&D("unload")}function L(e){N[e]&&I.emit("propChanged",e,R(e))}function D(e,i){switch(e){case"load":D("unload"),i&&i.stream&&"string"==typeof i.stream.url?(O=i.stream,L("stream"),L("loaded"),s.autoplay="boolean"!=typeof i.autoplay||i.autoplay,s.currentTime=null!==i.time&&isFinite(i.time)?parseInt(i.time,10)/1e3:0,L("paused"),L("time"),L("duration"),L("buffering"),L("buffered"),L("subtitlesTracks"),L("selectedSubtitlesTrackId"),L("audioTracks"),L("selectedAudioTrackId"),T(O).then(function(e){O===i.stream&&("application/vnd.apple.mpegurl"===e&&o.isSupported()?((l=new o(S)).on(o.Events.AUDIO_TRACKS_UPDATED,function(){L("audioTracks"),L("selectedAudioTrackId")}),l.on(o.Events.AUDIO_TRACK_SWITCHED,function(){L("audioTracks"),L("selectedAudioTrackId")}),l.loadSource(O.url),l.attachMedia(s)):s.src=O.url)}).catch(function(){O===i.stream&&(s.src=O.url)})):m(Object.assign({},r.UNSUPPORTED_STREAM,{critical:!0,stream:i?i.stream:null}));break;case"unload":O=null,Array.from(s.textTracks).forEach(function(e){e.oncuechange=null}),null!==l&&(l.removeAllListeners(),l.detachMedia(s),l.destroy(),l=null),s.removeAttribute("src"),s.load(),s.currentTime=0,L("stream"),L("loaded"),L("paused"),L("time"),L("duration"),L("buffering"),L("buffered"),L("subtitlesTracks"),L("selectedSubtitlesTrackId"),L("audioTracks"),L("selectedAudioTrackId");break;case"destroy":D("unload"),A=!0,L("subtitlesOffset"),L("subtitlesSize"),L("subtitlesTextColor"),L("subtitlesBackgroundColor"),L("subtitlesOutlineColor"),L("subtitlesOpacity"),L("volume"),L("muted"),L("playbackSpeed"),I.removeAllListeners(),s.onerror=null,s.onended=null,s.onpause=null,s.onplay=null,s.ontimeupdate=null,s.ondurationchange=null,s.onwaiting=null,s.onseeking=null,s.onseeked=null,s.onstalled=null,s.onplaying=null,s.oncanplay=null,s.canplaythrough=null,s.onloadeddata=null,s.onvolumechange=null,s.onratechange=null,s.textTracks.onchange=null,t.removeChild(s),t.removeChild(a)}}this.on=function(e,t){if(A)throw new Error("Video is destroyed");I.on(e,t)},this.dispatch=function(e){if(A)throw new Error("Video is destroyed");if(e)switch((e=n(E(e))).type){case"observeProp":return t=e.propName,void(N.hasOwnProperty(t)&&(I.emit("propValue",t,R(t)),N[t]=!0));case"setProp":return void(function(e,t){switch(e){case"paused":null!==O&&(t?s.pause():s.play(),L("paused"));break;case"time":null!==O&&null!==t&&isFinite(t)&&(s.currentTime=parseInt(t,10)/1e3,L("time"));break;case"selectedSubtitlesTrackId":if(null!==O){Array.from(s.textTracks).forEach(function(e,a){e.mode="EMBEDDED_"+String(a)===t?"showing":"disabled"});var i=R("subtitlesTracks").find(function(e){return e.id===t});i&&(L("selectedSubtitlesTrackId"),I.emit("subtitlesTrackLoaded",i))}break;case"subtitlesOffset":null!==t&&isFinite(t)&&(u=Math.max(0,Math.min(100,parseInt(t,10))),c(),L("subtitlesOffset"));break;case"subtitlesSize":null!==t&&isFinite(t)&&(a.sheet.cssRules[0].style.fontSize=Math.floor(Math.max(0,parseInt(t,10))/25)+"vmin",L("subtitlesSize"));break;case"subtitlesTextColor":if("string"==typeof t){try{a.sheet.cssRules[0].style.color=_(t).rgb().string()}catch(e){console.error("HTMLVideo",e)}L("subtitlesTextColor")}break;case"subtitlesBackgroundColor":if("string"==typeof t){try{a.sheet.cssRules[0].style.backgroundColor=_(t).rgb().string()}catch(e){console.error("HTMLVideo",e)}L("subtitlesBackgroundColor")}break;case"subtitlesOutlineColor":if("string"==typeof t){try{var o=_(t).rgb().string();a.sheet.cssRules[0].style.textShadow="-0.15rem -0.15rem 0.15rem "+o+", 0px -0.15rem 0.15rem "+o+", 0.15rem -0.15rem 0.15rem "+o+", -0.15rem 0px 0.15rem "+o+", 0.15rem 0px 0.15rem "+o+", -0.15rem 0.15rem 0.15rem "+o+", 0px 0.15rem 0.15rem "+o+", 0.15rem 0.15rem 0.15rem "+o}catch(e){console.error("HTMLVideo",e)}L("subtitlesOutlineColor")}break;case"subtitlesOpacity":if("number"==typeof t){try{d=Math.min(Math.max(t/100,0),1),a.sheet.cssRules[0].style.opacity=d+""}catch(e){console.error("VVideo with HTML Subtitles",e)}L("subtitlesOpacity")}break;case"selectedAudioTrackId":if(null!==l){var E=R("audioTracks").find(function(e){return e.id===t});l.audioTrack=E?parseInt(E.id.split("_").pop(),10):-1,E&&(L("selectedAudioTrackId"),I.emit("audioTrackLoaded",E))}break;case"volume":null!==t&&isFinite(t)&&(s.muted=!1,s.volume=Math.max(0,Math.min(100,parseInt(t,10)))/100,L("muted"),L("volume"));break;case"muted":s.muted=!!t,L("muted");break;case"playbackSpeed":null!==t&&isFinite(t)&&(s.playbackRate=parseFloat(t),L("playbackSpeed"))}})(e.propName,e.propValue);case"command":return void D(e.commandName,e.commandArgs)}var t;throw new Error("Invalid action dispatched: "+JSON.stringify(e))}}s.canPlayStream=function(e){return!e||e.behaviorHints&&e.behaviorHints.notWebReady?Promise.resolve(!1):T(e).then(function(e){return!!document.createElement("video").canPlayType(e)||"application/vnd.apple.mpegurl"===e&&o.isSupported()}).catch(function(){return!1})},s.manifest={name:"HTMLVideo",external:!1,props:["stream","loaded","paused","time","duration","buffering","buffered","audioTracks","selectedAudioTrackId","subtitlesTracks","selectedSubtitlesTrackId","subtitlesOffset","subtitlesSize","subtitlesTextColor","subtitlesBackgroundColor","subtitlesOutlineColor","subtitlesOpacity","volume","muted","playbackSpeed"],commands:["load","unload","destroy"],events:["propValue","propChanged","ended","error","subtitlesTrackLoaded","audioTrackLoaded"]},e.exports=s},61555:e=>{e.exports=function(e){return e&&"string"==typeof e.url?e.behaviorHints&&e.behaviorHints.proxyHeaders&&e.behaviorHints.proxyHeaders.response&&"string"==typeof e.behaviorHints.proxyHeaders.response["content-type"]?Promise.resolve(e.behaviorHints.proxyHeaders.response["content-type"]):fetch(e.url,{method:"HEAD"}).then(function(e){if(e.ok)return e.headers.get("content-type");throw new Error(e.status+" ("+e.statusText+")")}):Promise.reject(new Error("Invalid stream parameter!"))}},54171:e=>{e.exports={debug:!1,enableWorker:!0,lowLatencyMode:!1,backBufferLength:30,maxBufferLength:50,maxMaxBufferLength:80,maxFragLookUpTolerance:0,maxBufferHole:0,appendErrorMaxRetry:20,nudgeMaxRetry:20,manifestLoadingTimeOut:3e4,manifestLoadingMaxRetry:10,fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:20,retryDelayMs:0,maxRetryDelayMs:15},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:15}}}}},60956:(e,t,a)=>{var i=a(99332);e.exports=i},98436:(e,t,a)=>{var i=a(55852),o=a(55126),E=a(68816),n=a(88265);function _(e){var t=(e=e||{}).containerElement;if(!(t instanceof HTMLElement))throw new Error("Container element required to be instance of HTMLElement");var a=document.createElement("iframe");a.style.width="100%",a.style.height="100%",a.style.border=0,a.style.backgroundColor="black",a.allowFullscreen=!1,a.allow="autoplay",t.appendChild(a);var _=new i,r=!1,T={stream:!1,loaded:!1,paused:!1,time:!1,duration:!1,buffering:!1,buffered:!1,volume:!1,muted:!1,playbackSpeed:!1};function S(e){if(e.source===a.contentWindow){var t=e.data||e.message;if(t&&"string"==typeof t.event){var i=t.event,o=Array.isArray(t.args)?t.args:[];_.emit.apply(_,[i].concat(o))}}}function s(e){a.contentWindow.postMessage(e,"*")}function l(e,t){T[e]&&_.emit("propChanged",e,t)}function I(e,i){switch(e){case"load":return I("unload"),i&&i.stream&&"string"==typeof i.stream.playerFrameUrl?(window.addEventListener("message",S,!1),a.onload=function(){s({type:"command",commandName:e,commandArgs:i})},a.src=i.stream.playerFrameUrl):(o=Object.assign({},n.UNSUPPORTED_STREAM,{critical:!0,stream:i?i.stream:null}),_.emit("error",o),o.critical&&I("unload")),!0;case"unload":return window.removeEventListener("message",S),a.onload=null,a.removeAttribute("src"),l("stream",null),l("loaded",null),l("paused",null),l("time",null),l("duration",null),l("buffering",null),l("buffered",null),l("volume",null),l("muted",null),l("playbackSpeed",null),!0;case"destroy":return I("unload"),r=!0,_.removeAllListeners(),t.removeChild(a),!0}var o}this.on=function(e,t){if(r)throw new Error("Video is destroyed");_.on(e,t)},this.dispatch=function(e){if(r)throw new Error("Video is destroyed");if(e)switch((e=E(o(e))).type){case"observeProp":return t=e.propName,T.hasOwnProperty(t)&&(T[t]=!0),void s(e);case"setProp":return void s(e);case"command":return void(I(e.commandName,e.commandArgs)||s(e))}var t;throw new Error("Invalid action dispatched: "+JSON.stringify(e))}}_.canPlayStream=function(e){return Promise.resolve(e&&"string"==typeof e.playerFrameUrl)},_.manifest={name:"IFrameVideo",external:!0,props:["stream","loaded","paused","time","duration","buffering","buffered","audioTracks","selectedAudioTrackId","subtitlesTracks","selectedSubtitlesTrackId","subtitlesOffset","subtitlesSize","subtitlesTextColor","subtitlesBackgroundColor","subtitlesOutlineColor","volume","muted","playbackSpeed","extraSubtitlesTracks","selectedExtraSubtitlesTrackId","extraSubtitlesDelay","extraSubtitlesSize","extraSubtitlesOffset","extraSubtitlesTextColor","extraSubtitlesBackgroundColor","extraSubtitlesOutlineColor"],commands:["load","unload","destroy","addExtraSubtitlesTracks"],events:["propValue","propChanged","ended","error","subtitlesTrackLoaded","audioTrackLoaded","extraSubtitlesTrackLoaded","implementationChanged"]},e.exports=_},58751:(e,t,a)=>{var i=a(98436);e.exports=i},13340:(e,t,a)=>{var i=a(55852),o=a(55126),E=a(68816),n=a(88265),_=.0066,r={loaded:"loaded",stream:null,paused:"pause",time:"time-pos",duration:"duration",buffering:"buffering",volume:"volume",muted:"mute",playbackSpeed:"speed",audioTracks:"audioTracks",selectedAudioTrackId:"aid",subtitlesTracks:"subtitlesTracks",selectedSubtitlesTrackId:"sid",subtitlesSize:"sub-scale",subtitlesOffset:"sub-pos",subtitlesDelay:"sub-delay",subtitlesTextColor:"sub-color",subtitlesBackgroundColor:"sub-back-color",subtitlesOutlineColor:"sub-border-color"};function T(e){return e.split(".").slice(0,2).map(function(e){return parseInt(e)})}function S(e){var t,a=(e=e||{}).shellTransport,S={},s={},l={};Object.keys(r).forEach(function(e){r[e]&&(l[r[e]]=e)});var I=new Promise(function(e){t=e});C("unload"),a.send("mpv-command",["stop"]),a.send("mpv-observe-prop","path"),a.send("mpv-observe-prop","time-pos"),a.send("mpv-observe-prop","volume"),a.send("mpv-observe-prop","pause"),a.send("mpv-observe-prop","seeking"),a.send("mpv-observe-prop","eof-reached"),a.send("mpv-observe-prop","duration"),a.send("mpv-observe-prop","metadata"),a.send("mpv-observe-prop","video-params"),a.send("mpv-observe-prop","track-list"),a.send("mpv-observe-prop","paused-for-cache"),a.send("mpv-observe-prop","cache-buffering-state"),a.send("mpv-observe-prop","aid"),a.send("mpv-observe-prop","vid"),a.send("mpv-observe-prop","sid"),a.send("mpv-observe-prop","sub-scale"),a.send("mpv-observe-prop","sub-pos"),a.send("mpv-observe-prop","sub-delay"),a.send("mpv-observe-prop","speed"),a.send("mpv-observe-prop","mpv-version"),a.send("mpv-observe-prop","ffmpeg-version");var A=new i,O=!1,u=null,d=0;function N(t){for(var a=t?"":"transparent",i=e.containerElement;i;i=i.parentElement)i.style.background=a;if(((window||{}).document||{}).getElementsByTagName){var o=window.document.getElementsByTagName("body");(o||[])[0]&&(o[0].style.background=a)}}function R(e){console.log(e.name+": "+e.data)}var c=0;function m(e){return r[e]?s[r[e]]:(console.log("Unsupported prop requested",e),null)}function L(e){A.emit("error",e),e.critical&&C("unload")}function D(e){S[e]&&A.emit("propChanged",e,m(e))}function C(t,i){switch(t){case"load":C("unload"),i&&i.stream&&"string"==typeof i.stream.url?I.then(function(t){u=i.stream,D("stream");var o=i.assSubtitlesStyling?"strip":"no";a.send("mpv-set-prop",["sub-ass-override",o]);var E=i.hardwareDecoding?"auto-copy":"no";a.send("mpv-set-prop",["hwdec",E]);var n="windows"===i.platform?null===i.videoMode?"gpu-next":"gpu":"libmpv";a.send("mpv-set-prop",["vo",n]);var _=e.mpvSeparateWindow?"yes":"no";a.send("mpv-set-prop",["osc",_]),a.send("mpv-set-prop",["input-default-bindings",_]),a.send("mpv-set-prop",["input-vo-keyboard",_]);var r,S,l,I=Math.floor(parseInt(i.time,10)/1e3)||0;0!==I?(r="0.39",S=T(t),l=T(r),S[0]>l[0]||!(S[0]=l[1]?a.send("mpv-command",["loadfile",u.url,"replace","-1","start=+"+I]):a.send("mpv-command",["loadfile",u.url,"replace","start=+"+I])):a.send("mpv-command",["loadfile",u.url]),a.send("mpv-set-prop",["pause",!1]),a.send("mpv-set-prop",["speed",s.speed]),s.aid&&("string"==typeof s.aid&&s.aid.startsWith("EMBEDDED_")?a.send("mpv-set-prop",["aid",s.aid.slice(9)]):a.send("mpv-set-prop",["aid",s.aid])),a.send("mpv-set-prop",["mute","no"]),D("paused"),D("time"),D("duration"),D("buffering"),D("muted"),D("subtitlesTracks"),D("selectedSubtitlesTrackId")}):L(Object.assign({},n.UNSUPPORTED_STREAM,{critical:!0,stream:i?i.stream:null}));break;case"unload":s={loaded:!1,pause:!1,mute:!1,speed:1,subtitlesTracks:[],audioTracks:[],buffering:!1,aid:null,sid:null},d=0,a.send("mpv-command",["stop"]),D("loaded"),D("stream"),D("paused"),D("time"),D("duration"),D("buffering"),D("muted"),D("subtitlesTracks"),D("selectedSubtitlesTrackId"),N(!0);break;case"destroy":C("unload"),O=!0,A.removeAllListeners()}}a.on("mpv-prop-change",function(e){switch(e.name){case"mpv-version":t(e.data),s[e.name]=R(e);break;case"ffmpeg-version":s[e.name]=R(e);break;case"duration":var a=0|e.data;s[e.name]=e.data>=30&&(!d||a===d)?Math.round(1e3*e.data):null,d=d?d+a>>1:a,s.loaded=a>0,s.loaded&&(N(!1),D("loaded"));break;case"time-pos":case"sub-delay":s[e.name]=Math.round(1e3*e.data);break;case"sub-scale":s[e.name]=Math.round(e.data/_);break;case"sub-pos":s[e.name]=100-e.data;break;case"volume":"number"==typeof e.data&&isFinite(e.data)&&(s[e.name]=e.data,D("volume"));break;case"paused-for-cache":case"seeking":s.buffering!==e.data&&(s.buffering=e.data,D("buffering"));break;case"aid":case"sid":case"vid":s[e.name]=(function(e){return e.data&&"no"!==e.data?"EMBEDDED_"+e.data.toString():null})(e);break;case"track-list":s.audioTracks=e.data.filter(function(e){return"audio"===e.type}).map(function(e,t){return{id:"EMBEDDED_"+e.id,lang:void 0===e.lang?"Track"+(t+1):e.lang,label:void 0===e.title||void 0===e.lang?"":e.title||e.lang,origin:"EMBEDDED",embedded:!0,mode:e.id===s.aid?"showing":"disabled"}}),D("audioTracks"),s.subtitlesTracks=e.data.filter(function(e){return"sub"===e.type}).map(function(e,t){return{id:"EMBEDDED_"+e.id,lang:void 0===e.lang?"Track "+(t+1):e.lang,label:void 0===e.title||void 0===e.lang?"":e.title||e.lang,origin:"EMBEDDED",embedded:!0,mode:e.id===s.sid?"showing":"disabled"}}),D("subtitlesTracks");break;default:s[e.name]=e.data}var i="time-pos"===e.name?Math.floor(s["time-pos"]/1e3):null;i&&c===i||!l[e.name]||(i&&(c=i),D(l[e.name]))}),a.on("mpv-event-ended",function(e){e.error?L(e.error):A.emit("ended")}),this.on=function(e,t){if(O)throw new Error("Video is destroyed");A.on(e,t)},this.dispatch=function(e){if(O)throw new Error("Video is destroyed");if(e)switch((e=E(o(e))).type){case"observeProp":t=e.propName,A.emit("propValue",t,m(t)),S[t]=!0;break;case"setProp":return void(function(e,t){switch(e){case"paused":null!==u&&a.send("mpv-set-prop",["pause",t]);break;case"time":null!==u&&null!==t&&isFinite(t)&&a.send("mpv-set-prop",["time-pos",t/1e3]);break;case"playbackSpeed":null!==u&&null!==t&&isFinite(t)&&a.send("mpv-set-prop",["speed",t]);break;case"volume":null!==u&&null!==t&&isFinite(t)&&(s.mute=!1,a.send("mpv-set-prop",["mute","no"]),a.send("mpv-set-prop",["volume",t]),D("muted"),D("volume"));break;case"muted":null!==u&&(a.send("mpv-set-prop",["mute",t?"yes":"no"]),s.mute=t,D("muted"));break;case"selectedAudioTrackId":if(null!==u){var i=t.slice(9);a.send("mpv-set-prop",["aid",i])}break;case"selectedSubtitlesTrackId":null!==u&&(t?(i=t.slice(9),a.send("mpv-set-prop",["sid",i]),A.emit("subtitlesTrackLoaded",t)):(a.send("mpv-set-prop",["sid","no"]),s.sid=null)),D("selectedSubtitlesTrackId");break;case"subtitlesSize":a.send("mpv-set-prop",[r[e],t*_]);break;case"subtitlesDelay":a.send("mpv-set-prop",[r[e],t]);break;case"subtitlesOffset":a.send("mpv-set-prop",[r[e],100-t]);break;case"subtitlesTextColor":case"subtitlesBackgroundColor":case"subtitlesOutlineColor":var o=t.replace(/^#(\w{6})(\w{2})$/,"#$2$1");a.send("mpv-set-prop",[r[e],o]);break;default:console.log("Unhandled setProp for",e)}})(e.propName,e.propValue);case"command":return void C(e.commandName,e.commandArgs)}var t}}S.canPlayStream=function(){return Promise.resolve(!0)},S.manifest={name:"ShellVideo",external:!1,props:Object.keys(r),commands:["load","unload","destroy"],events:["propValue","propChanged","ended","error","subtitlesTrackLoaded"]},e.exports=S},73545:(e,t,a)=>{var i=a(13340);e.exports=i},58058:(e,t,a)=>{var i=a(55852),o=a(55126),E=a(68816),n=a(8693),_=a(19576),r=a(88265);function T(){var e=null,t=new i,a=!1;this.on=function(e,i){if(a)throw new Error("Video is destroyed");t.on(e,i)},this.dispatch=function(i,T){if(a)throw new Error("Video is destroyed");if(!i)throw new Error("Invalid action dispatched: "+JSON.stringify(i));if(T=T||{},"command"===(i=E(o(i))).type&&"load"===i.commandName&&i.commandArgs){i.commandArgs.platform&&_.set(i.commandArgs.platform);var S=n(i.commandArgs,T);if(null!==e&&e.constructor!==S&&(e.dispatch({type:"command",commandName:"destroy"}),e=null),null===e){if(null===S)return void t.emit("error",Object.assign({},r.UNSUPPORTED_STREAM,{error:new Error("No video implementation was selected"),critical:!0,stream:i.commandArgs.stream}));(e=new S(T)).on("ended",function(){t.emit("ended")}),e.on("error",function(e){t.emit("error",e)}),e.on("propValue",function(e,a){t.emit("propValue",e,a)}),e.on("propChanged",function(e,a){t.emit("propChanged",e,a)}),e.on("subtitlesTrackLoaded",function(e){t.emit("subtitlesTrackLoaded",e)}),e.on("audioTrackLoaded",function(e){t.emit("audioTrackLoaded",e)}),e.on("extraSubtitlesTrackLoaded",function(e){t.emit("extraSubtitlesTrackLoaded",e)}),e.on("extraSubtitlesTrackAdded",function(e){t.emit("extraSubtitlesTrackAdded",e)}),S.manifest.external?e.on("implementationChanged",function(e){t.emit("implementationChanged",e)}):t.emit("implementationChanged",S.manifest)}}if(null!==e)try{e.dispatch(i)}catch(t){console.error(e.constructor.manifest.name,t)}"command"===i.type&&"destroy"===i.commandName&&(e=null)},this.destroy=function(){a=!0,null!==e&&(e.dispatch({type:"command",commandName:"destroy"}),e=null),t.removeAllListeners()}}T.ERROR=r,e.exports=T},37748:(e,t,a)=>{var i=a(58058);e.exports=i},8693:(e,t,a)=>{var i=a(22271),o=a(73545),E=a(60956),n=a(50263),_=a(34625),r=a(12840),T=a(6143),S=a(58751),s=a(76784),l=a(5247),I=a(37618),A=a(45209);e.exports=function(e,t){return e.stream&&"string"!=typeof e.stream.externalUrl?t.chromecastTransport&&t.chromecastTransport.getCastState()===cast.framework.CastState.CONNECTED?i:"string"==typeof e.stream.ytId?A(I(s)):"string"==typeof e.stream.playerFrameUrl?A(S):t.shellTransport?l(I(o)):"string"==typeof e.streamingServerURL?"Tizen"===e.platform?l(I(n)):"webOS"===e.platform?l(I(T)):"Titan"===e.platform||"NetTV"===e.platform?l(I(_)):"Vidaa"===e.platform?l(I(r)):l(I(E)):"string"==typeof e.stream.url?"Tizen"===e.platform?A(I(n)):"webOS"===e.platform?A(I(T)):"Titan"===e.platform||"NetTV"===e.platform?A(I(_)):"Vidaa"===e.platform?A(I(r)):A(I(E)):null:null}},74316:(e,t,a)=>{var i=a(55852),o=a(55126),E=a(68816),n=a(38742),_=a(88265),r=/^\{(\\an[1-8])+\}/i;function T(e){var t=100,a=0,T="rgb(255, 255, 255)",S="rgba(0, 0, 0, 0)",s="rgb(34, 34, 34)",l=1,I=(e=e||{}).containerElement;if(!(I instanceof HTMLElement))throw new Error("Container element required to be instance of HTMLElement");var A=document.createElement("video");A.style.width="100%",A.style.height="100%",A.style.backgroundColor="black",A.controls=!1,A.playsInline=!0,A.onerror=function(){!(function(){if(N)return;var e;switch(A.error.code){case 1:e=_.HTML_VIDEO.MEDIA_ERR_ABORTED;break;case 2:e=_.HTML_VIDEO.MEDIA_ERR_NETWORK;break;case 3:e=_.HTML_VIDEO.MEDIA_ERR_DECODE;break;case 4:e=_.HTML_VIDEO.MEDIA_ERR_SRC_NOT_SUPPORTED;break;default:e=_.UNKNOWN_ERROR}p(Object.assign({},e,{critical:!0,error:A.error}))})()},A.onended=function(){d.emit("ended")},A.onpause=function(){h("paused")},A.onplay=function(){h("paused")},A.ontimeupdate=function(){h("time")},A.ondurationchange=function(){h("duration")},A.onwaiting=function(){h("buffering")},A.onseeking=function(){h("time"),h("buffering")},A.onseeked=function(){h("time"),h("buffering")},A.onstalled=function(){h("buffering")},A.onplaying=function(){h("time"),h("buffering")},A.oncanplay=function(){h("buffering")},A.canplaythrough=function(){h("buffering")},A.onloadedmetadata=function(){h("loaded")},A.onloadeddata=function(){h("buffering")},A.onvolumechange=function(){h("volume"),h("muted")},A.onratechange=function(){h("playbackSpeed")},A.textTracks.onchange=function(){h("subtitlesTracks"),h("selectedSubtitlesTrackId")},I.appendChild(A);var O=document.createElement("div");O.style.position="absolute",O.style.right="0",O.style.bottom="0",O.style.left="0",O.style.zIndex="1",O.style.textAlign="center",I.style.position="relative",I.style.zIndex="0",I.appendChild(O);var u,d=new i,N=!1,R=null,c={stream:!1,loaded:!1,paused:!1,time:!1,duration:!1,buffering:!1,subtitlesTracks:!1,selectedSubtitlesTrackId:!1,subtitlesOffset:!1,subtitlesSize:!1,subtitlesTextColor:!1,subtitlesBackgroundColor:!1,subtitlesOutlineColor:!1,audioTracks:!1,selectedAudioTrackId:!1,volume:!1,muted:!1,playbackSpeed:!1};async function m(){u&&L(u.text,"show")}async function L(e,i){if("hide"!==i){for(u={text:e};O.hasChildNodes();)O.removeChild(O.lastChild);O.style.bottom=a+"%",O.style.opacity=l;var o=document.createElement("span");o.innerHTML=e,o.style.display="inline-block",o.style.padding="0.2em",o.style.fontSize=Math.floor(t/25)+"vmin",o.style.color=T,o.style.backgroundColor=S,o.style.textShadow="1px 1px 0.1em "+s,o.style.whiteSpace="pre-wrap",O.appendChild(o),O.appendChild(document.createElement("br"))}else{for(;O.hasChildNodes();)O.removeChild(O.lastChild);u=null}}function D(e){var t=(e.target||{}).activeCues;if(t.length){if(t.length>3)return e.target.removeEventListener("cuechange",D),void L("","hide");var a="";for(var i in t){var o=t[i];if(o.text)a+=(a?"\n":"")+o.text.replace(r,"")}L(a,"show")}else L("","hide")}function C(e){switch(e){case"stream":return R;case"loaded":return null===R?null:A.readyState>=A.HAVE_METADATA;case"paused":return null===R?null:!!A.paused;case"time":return null!==R&&null!==A.currentTime&&isFinite(A.currentTime)?Math.floor(1e3*A.currentTime):null;case"duration":return null!==R&&null!==A.duration&&isFinite(A.duration)?Math.floor(1e3*A.duration):null;case"buffering":return null===R?null:A.readyState{var i=a(74316);e.exports=i},30860:(e,t,a)=>{var i=a(55852),o=a(55126),E=a(68816),n=a(38742),_=a(88265),r=a(41779),T=/^\{(\\an[1-8])+\}/i;function S(e){var t=!0,a=1,S=null,s=null,l=(e=e||{}).containerElement;if(!(l instanceof HTMLElement))throw new Error("Container element required to be instance of HTMLElement");var I,A=window.webapis.avplay,O=!1,u=100,d=0,N="rgb(255, 255, 255)",R="rgba(0, 0, 0, 0)",c="rgb(34, 34, 34)",m=1,L=document.createElement("object");L.type="application/avplayer",L.style.width="100%",L.style.height="100%",L.style.backgroundColor="black";var D=!0;function C(){if(I){var e=y("time"),t=I.duration-(e-I.now);t>0&&p(t,I.text)}}function p(e,t){if(!D){var i=y("time"),o=t.replace(T,"");for(I={duration:e,text:o,now:i},h&&(clearTimeout(h),h=!1);P.hasChildNodes();)P.removeChild(P.lastChild);P.style.bottom=d+"%",P.style.opacity=m;var E=document.createElement("span");E.innerHTML=o,E.style.display="inline-block",E.style.padding="0.2em",E.style.fontSize=Math.floor(u/25)+"vmin",E.style.color=N,E.style.backgroundColor=R,E.style.textShadow="1px 1px 0.1em "+c,P.appendChild(E),P.appendChild(document.createElement("br")),e&&(h=setTimeout(function(){for(;P.hasChildNodes();)P.removeChild(P.lastChild)},parseInt(e*a)))}}var h=!1;A.setListener({onbufferingstart:function(){t=!0,k("buffering")},onbufferingprogress:function(){t=!0,k("buffering")},onbufferingcomplete:function(){t=!1,k("buffering")},oncurrentplaytime:function(){k("time")},onsubtitlechange:function(e,t){p(e,t)},onstreamcompleted:function(){B.emit("ended")}}),l.appendChild(L);var P=document.createElement("div");P.style.position="absolute",P.style.right="0",P.style.bottom="0",P.style.left="0",P.style.zIndex="1",P.style.textAlign="center",l.style.position="relative",l.style.zIndex="0",l.appendChild(P);var B=new i,f=!1,g=null,v=0,M=null,W={stream:!1,loaded:!1,paused:!1,time:!1,duration:!1,buffering:!1,subtitlesTracks:!1,selectedSubtitlesTrackId:!1,subtitlesOffset:!1,subtitlesSize:!1,subtitlesTextColor:!1,subtitlesBackgroundColor:!1,subtitlesOutlineColor:!1,subtitlesOpacity:!1,audioTracks:!1,selectedAudioTrackId:!1,playbackSpeed:!1},U=!1,G={audio:[],subs:[]};function y(e){switch(e){case"stream":return g;case"loaded":return M;case"paused":if(null===g)return null;var i=!("PAUSED"!==A.getState());return!i&&O&&(A.setSelectTrack("AUDIO",parseInt(O.replace("EMBEDDED_",""))),O=!1),i;case"time":var o=A.getCurrentTime();return null!==g&&null!==o&&isFinite(o)?Math.floor(o):null;case"duration":var E=A.getDuration();return null!==g&&null!==E&&isFinite(E)?Math.floor(E):null;case"buffering":return null===g?null:t;case"subtitlesTracks":if(null===g)return[];for(var n=A.getTotalTrackInfo(),_=[],r=0;r0?I.track_lang.trim():null,C=null;if(((G||{}).subs||[]).length)(v=G.subs.find(function(e){return(e||{}).id-1===T.index}))&&(L=v.lang||"eng",C=v.label||null);_.push({id:l,lang:L,label:C,origin:"EMBEDDED",embedded:!0,mode:D||l!==S?"disabled":"showing"})}return _;case"selectedSubtitlesTrackId":if(null===g||D)return null;var p=A.getCurrentStreamInfo();for(r=0;r0?I.language:null,U=null;if(((G||{}).audio||[]).length)(v=G.audio.find(function(e){return(e||{}).id-1===P.index}))&&(W=v.lang||"eng",U=v.label||null);h.push({id:B,lang:W,label:U,origin:"EMBEDDED",embedded:!0,mode:B===s?"showing":"disabled"})}return h;case"selectedAudioTrackId":if(null===g)return null;if(O)return O;p=A.getCurrentStreamInfo();var y=!1;for(r=0;r=6)&&(U||null===g||(U=!0,r(g.url,function(e){e&&(G=e),((G||{}).subs||[]).length&&k("subtitlesTracks"),((G||{}).audio||[]).length&&k("audioTracks")}))),A.open(g.url),A.setDisplayRect(0,0,window.innerWidth,window.innerHeight),A.setDisplayMethod("PLAYER_DISPLAY_MODE_LETTER_BOX"),A.seekTo(null!==t.time&&isFinite(t.time)?parseInt(t.time,10):0),A.prepareAsync(function(){k("duration"),A.play(),M=!0,k("loaded"),k("stream"),k("paused"),k("time"),k("duration"),k("subtitlesTracks"),k("selectedSubtitlesTrackId"),k("audioTracks"),k("selectedAudioTrackId")},function(e){if(v<5){v++;try{A.stop()}catch(e){}F("load",t)}else b(Object.assign({},_.STREAM_FAILED_TO_LOAD,{critical:!0,stream:t?t.stream:null,error:e}))})}else b(Object.assign({},_.UNSUPPORTED_STREAM,{critical:!0,stream:t?t.stream:null}));break;case"unload":g=null,A.stop(),M=!1,k("loaded"),k("stream"),k("paused"),k("time"),k("duration"),k("buffering"),k("subtitlesTracks"),k("selectedSubtitlesTrackId"),k("audioTracks"),k("selectedAudioTrackId");break;case"destroy":F("unload"),f=!0,A.stop(),k("subtitlesOffset"),k("subtitlesSize"),k("subtitlesTextColor"),k("subtitlesBackgroundColor"),k("subtitlesOutlineColor"),k("subtitlesOpacity"),k("playbackSpeed"),B.removeAllListeners(),l.removeChild(L)}}this.on=function(e,t){if(f)throw new Error("Video is destroyed");B.on(e,t)},this.dispatch=function(e){if(f)throw new Error("Video is destroyed");if(e)switch((e=E(o(e))).type){case"observeProp":return void(function(e){if(W.hasOwnProperty(e)){var t=y(e);B.emit("propValue",e,t),W[e]=!0}})(e.propName);case"setProp":return void(function(e,t){switch(e){case"paused":if(null!==g){var i=!!t;i?A.pause():A.play(),i?h&&clearTimeout(h):C()}k("paused");var o=y("paused");setTimeout(function(){y("paused")!==o&&k("paused")},1e3);break;case"time":null!==g&&null!==t&&isFinite(t)&&(A.seekTo(parseInt(t,10)),p(1,""),k("time"));break;case"selectedSubtitlesTrackId":if(null!==g){if(-1===(t||"").indexOf("EMBEDDED_")||!t)return p(1,""),D=!0,void k("selectedSubtitlesTrackId");var E=y("subtitlesTracks").find(function(e){return e.id===t});E&&(D=!1,S=t,A.setSelectTrack("TEXT",parseInt(E.id.replace("EMBEDDED_",""))),B.emit("subtitlesTrackLoaded",E),k("selectedSubtitlesTrackId"))}break;case"subtitlesOffset":null!==t&&isFinite(t)&&(d=Math.max(0,Math.min(100,parseInt(t,10))),C(),k("subtitlesOffset"));break;case"subtitlesSize":null!==t&&isFinite(t)&&(u=Math.max(0,parseInt(t,10)),C(),k("subtitlesSize"));break;case"subtitlesTextColor":if("string"==typeof t){try{N=n(t).rgb().string()}catch(e){console.error("Tizen player with HTML Subtitles",e)}C(),k("subtitlesTextColor")}break;case"subtitlesBackgroundColor":if("string"==typeof t){try{R=n(t).rgb().string()}catch(e){console.error("Tizen player with HTML Subtitles",e)}C(),k("subtitlesBackgroundColor")}break;case"subtitlesOutlineColor":if("string"==typeof t){try{c=n(t).rgb().string()}catch(e){console.error("Tizen player with HTML Subtitles",e)}C(),k("subtitlesOutlineColor")}break;case"subtitlesOpacity":if("number"==typeof t){try{m=Math.min(Math.max(t/100,0),1)}catch(e){console.error("Tizen player with HTML Subtitles",e)}C(),k("subtitlesOpacity")}break;case"selectedAudioTrackId":if(null!==g){s=t;var _=y("audioTracks").find(function(e){return e.id===t});y("paused")?(O=t,k("selectedAudioTrackId")):A.setSelectTrack("AUDIO",parseInt(s.replace("EMBEDDED_",""))),_&&(B.emit("audioTrackLoaded",_),k("selectedAudioTrackId"))}break;case"playbackSpeed":if(null!==t&&isFinite(t)){a=parseFloat(t);try{A.setSpeed(a)}catch(e){}k("playbackSpeed")}}})(e.propName,e.propValue);case"command":return void F(e.commandName,e.commandArgs)}throw new Error("Invalid action dispatched: "+JSON.stringify(e))}}S.canPlayStream=function(){return Promise.resolve(!0)},S.manifest={name:"TizenVideo",external:!1,props:["stream","loaded","paused","time","duration","buffering","audioTracks","selectedAudioTrackId","subtitlesTracks","selectedSubtitlesTrackId","subtitlesOffset","subtitlesSize","subtitlesTextColor","subtitlesBackgroundColor","subtitlesOutlineColor","subtitlesOpacity","playbackSpeed"],commands:["load","unload","destroy"],events:["propValue","propChanged","ended","error","subtitlesTrackLoaded","audioTrackLoaded"]},e.exports=S},50263:(e,t,a)=>{var i=a(30860);e.exports=i},10650:(e,t,a)=>{var i=a(55852),o=a(55126),E=a(68816),n=a(88265);function _(e){var t=(e=e||{}).containerElement;if(!(t instanceof HTMLElement))throw new Error("Container element required to be instance of HTMLElement");var a=document.createElement("video");a.style.width="100%",a.style.height="100%",a.style.backgroundColor="black",a.controls=!1,a.playsInline=!0,a.onerror=function(){!(function(){if(T)return;var e;switch(a.error.code){case 1:e=n.HTML_VIDEO.MEDIA_ERR_ABORTED;break;case 2:e=n.HTML_VIDEO.MEDIA_ERR_NETWORK;break;case 3:e=n.HTML_VIDEO.MEDIA_ERR_DECODE;break;case 4:e=n.HTML_VIDEO.MEDIA_ERR_SRC_NOT_SUPPORTED;break;default:e=n.UNKNOWN_ERROR}A(Object.assign({},e,{critical:!0,error:a.error}))})()},a.onended=function(){r.emit("ended")},a.onpause=function(){O("paused")},a.onplay=function(){O("paused")},a.ontimeupdate=function(){O("time")},a.ondurationchange=function(){O("duration")},a.onwaiting=function(){O("buffering")},a.onseeking=function(){O("time"),O("buffering")},a.onseeked=function(){O("time"),O("buffering")},a.onstalled=function(){O("buffering")},a.onplaying=function(){O("time"),O("buffering")},a.oncanplay=function(){O("buffering")},a.canplaythrough=function(){O("buffering")},a.onloadedmetadata=function(){O("loaded")},a.onloadeddata=function(){O("buffering")},a.onvolumechange=function(){O("volume"),O("muted")},a.onratechange=function(){O("playbackSpeed")},a.textTracks.onchange=function(){O("subtitlesTracks"),O("selectedSubtitlesTrackId"),I(),Array.from(a.textTracks).forEach(function(e){e.oncuechange=I})},t.appendChild(a);var _=document.createElement("div");_.style.position="absolute",_.style.right="0",_.style.bottom="0",_.style.left="0",_.style.zIndex="1",_.style.textAlign="center",t.style.position="relative",t.style.zIndex="0",t.appendChild(_);var r=new i,T=!1,S=null,s={stream:!1,loaded:!1,paused:!1,time:!1,duration:!1,buffering:!1,subtitlesTracks:!1,selectedSubtitlesTrackId:!1,audioTracks:!1,selectedAudioTrackId:!1,volume:!1,muted:!1,playbackSpeed:!1};function l(e){switch(e){case"stream":return S;case"loaded":return null===S?null:a.readyState>=a.HAVE_METADATA;case"paused":return null===S?null:!!a.paused;case"time":return null!==S&&null!==a.currentTime&&isFinite(a.currentTime)?Math.floor(1e3*a.currentTime):null;case"duration":return null!==S&&null!==a.duration&&isFinite(a.duration)?Math.floor(1e3*a.duration):null;case"buffering":return null===S?null:a.readyState{var i=a(10650);e.exports=i},80860:(e,t,a)=>{var i=a(55852),o=a(55126),E=a(68816),n=a(88265),_=a(41779);function r(e,t,a,i){t&&(e.onSuccess=t||function(){}),e.onFailure=function(t){console.log("WebOS",(e.method||i)+" [fail]["+t.errorCode+"] "+t.errorText),console.log("fail result",JSON.stringify(t)),a&&a()},window.webOS.service.request(i||"luna://com.webos.media",e)}var T=["none","black","white","yellow","red","green","blue"],S={"rgba(0, 0, 0, 0)":"none","rgba(0, 0, 0, 255)":"black","rgba(255, 255, 255, 255)":"white","rgba(255, 255, 0, 255)":"yellow","rgba(255, 0, 0, 255)":"red","rgba(0, 255, 0, 255)":"green","rgba(0, 0, 255, 255)":"blue","rgba(0, 0, 0, 1)":"black","rgba(255, 255, 255, 1)":"white","rgba(255, 255, 0, 1)":"yellow","rgba(255, 0, 0, 1)":"red","rgba(0, 255, 0, 1)":"green","rgba(0, 0, 255, 1)":"blue","rgb(0, 0, 0)":"black","rgb(255, 255, 255)":"white","rgb(255, 255, 0)":"yellow","rgb(255, 0, 0)":"red","rgb(0, 255, 0)":"green","rgb(0, 0, 255)":"blue","#000000FF":"black","#FFFFFFFF":"white","#FFFF00FF":"yellow","#FF0000FF":"red","#00FF00FF":"green","#0000FFFF":"blue","#000000":"black","#FFFFFF":"white","#FFFF00":"yellow","#FF0000":"red","#00FF00":"green","#0000FF":"blue"};var s={unsupportedAudio:["DTS","TRUEHD"],unsupportedSubs:["HDMV/PGS","VOBSUB"]},l=!1;function I(){l||window.webOS.service.request("luna://com.webos.service.config",{method:"getConfigs",parameters:{configNames:["tv.model.edidType"]},onSuccess:function(e){if(((e||{}).configs||{})["tv.model.edidType"]){l=!0;var t=e.configs["tv.model.edidType"].toLowerCase();t.includes("dts")&&(s.unsupportedAudio=s.unsupportedAudio.filter(function(e){return"DTS"!==e})),t.includes("truehd")&&(s.unsupportedAudio=s.unsupportedAudio.filter(function(e){return"TRUEHD"!==e}))}},onFailure:function(e){console.log("could not get deviceInfo",e)}})}function A(e){var t=(e=e||{}).containerElement;if(!(t instanceof HTMLElement))throw new Error("Container element required to be instance of HTMLElement");var a=null,l=75,A=!0,O=!1,u=!1,d=[],N=[],R={color:"white",font_size:1,bg_color:"none",position:-1,bg_opacity:0,char_opacity:255},c=function(e){L.mediaId&&(A=!e,r({method:"setSubtitleEnable",parameters:{mediaId:L.mediaId,enable:e}}))},m=document.createElement("style");t.appendChild(m),m.sheet.insertRule("video::cue { font-size: 4vmin; color: rgb(255, 255, 255); background-color: rgba(0, 0, 0, 0); text-shadow: rgb(34, 34, 34) 1px 1px 0.1em; }");var L=document.createElement("video");L.style.width="100%",L.style.height="100%",L.style.backgroundColor="black",L.controls=!1,L.onerror=function(){!(function(){if(P)return;var e;switch((L.error||{}).code){case 1:e=n.HTML_VIDEO.MEDIA_ERR_ABORTED;break;case 2:e=n.HTML_VIDEO.MEDIA_ERR_NETWORK;break;case 3:e=n.HTML_VIDEO.MEDIA_ERR_DECODE;break;case 4:e=n.HTML_VIDEO.MEDIA_ERR_SRC_NOT_SUPPORTED;break;default:e=n.UNKNOWN_ERROR}k(Object.assign({},e,{critical:!0,error:L.error}))})()},L.onended=function(){h.emit("ended")},L.onpause=function(){F("paused")},L.onplay=function(){F("paused")},L.ontimeupdate=function(){F("time"),F("buffered")},L.ondurationchange=function(){F("duration")},L.onwaiting=function(){F("buffering"),F("buffered")},L.onseeking=function(){F("buffering"),F("buffered")},L.onseeked=function(){F("buffering"),F("buffered")},L.onstalled=function(){F("buffering"),F("buffered")},L.onplaying=function(){F("buffering"),F("buffered"),a||(a=!0,F("loaded"))},L.oncanplay=function(){F("buffering"),F("buffered")},L.canplaythrough=function(){F("buffering"),F("buffered")},L.onloadeddata=function(){F("buffering"),F("buffered")},L.onloadedmetadata=function(){F("buffering"),F("buffered"),V("time",f)},L.onvolumechange=function(){F("volume"),F("muted")},L.onratechange=function(){F("playbackSpeed")},L.textTracks.onchange=function(){F("subtitlesTracks"),F("selectedSubtitlesTrackId"),b(),Array.from(L.textTracks).forEach(function(e){e.oncuechange=b})},t.appendChild(L);var D=null,C=null,p=1,h=new i,P=!1,B=null,f=null,g=0,v=100,M={stream:!1,loaded:!1,paused:!1,time:!1,duration:!1,buffering:!1,buffered:!1,subtitlesTracks:!1,selectedSubtitlesTrackId:!1,subtitlesOffset:!1,subtitlesSize:!1,subtitlesTextColor:!1,subtitlesBackgroundColor:!1,subtitlesOpacity:!1,audioTracks:!1,selectedAudioTrackId:!1,volume:!1,muted:!1,playbackSpeed:!1},W=!1,U={audio:[],subs:[]};function G(){W||null===B||(W=!0,_(B.url,function(e){var t=0,a=0;d=[],N=[],e&&(U=e),((U||{}).subs||[]).length&&(U.subs.forEach(function(e){if(!s.unsupportedSubs.includes(e.codec||"")){var a=t;t++,O||d.length||(O=a),d.push({id:"EMBEDDED_"+a,lang:e.lang||"eng",label:e.label||null,origin:"EMBEDDED",embedded:!0,mode:a===O?"showing":"disabled"})}}),F("subtitlesTracks"),F("selectedSubtitlesTrackId")),((U||{}).audio||[]).length&&(U.audio.forEach(function(e){if(!s.unsupportedAudio.includes(e.codec||"")){var t=a;a++,u||N.length||(u=t),N.push({id:"EMBEDDED_"+t,lang:e.lang||"eng",label:e.label||null,origin:"EMBEDDED",embedded:!0,mode:t===u?"showing":"disabled"})}}),u="EMBEDDED_0",F("audioTracks"),F("selectedAudioTrackId"))}))}function y(e){switch(e){case"stream":return B;case"loaded":return a;case"paused":return null===B?null:!!L.paused;case"time":return null!==B&&null!==L.currentTime&&isFinite(L.currentTime)?Math.floor(1e3*L.currentTime):null;case"duration":return null!==B&&null!==L.duration&&isFinite(L.duration)?Math.floor(1e3*L.duration):null;case"buffering":return null===B?null:L.readyState=L.HAVE_METADATA&&null!==t&&isFinite(t))try{L.currentTime=parseInt(t,10)/1e3,F("time")}catch(e){}break;case"selectedSubtitlesTrackId":if(L.mediaId&&null!==B&&0===(t||"").indexOf("EMBEDDED_")){c(!0),R.bg_opacity="none"===R.bg_color?0:255,["setSubtitleCharacterColor","setSubtitleBackgroundColor","setSubtitlePosition","setSubtitleFontSize","setSubtitleBackgroundOpacity","setSubtitleCharacterOpacity"].forEach(function(e){r({method:e,parameters:{mediaId:L.mediaId,charColor:R.color,bgColor:"none"===R.bg_color?"black":R.bg_color,position:R.position,fontSize:R.font_size,bgOpacity:R.bg_opacity,charOpacity:R.char_opacity}})}),console.log("WebOS","change subtitles for id: ",L.mediaId," index:",t),O=t;var a=parseInt(t.replace("EMBEDDED_",""));console.log("set subs to track idx: "+a),setTimeout(function(){var e=function(){var e=y("subtitlesTracks").find(function(e){return e.id===t});d=d.map(function(e){return e.mode=e.id===O?"showing":"disabled",e}),e&&(h.emit("subtitlesTrackLoaded",e),F("selectedSubtitlesTrackId"))};r({method:"selectTrack",parameters:{type:"text",mediaId:L.mediaId,index:a}},e,e)},500)}-1===(t||"").indexOf("EMBEDDED_")&&(O=null,F("selectedSubtitlesTrackId"),c(!1));break;case"subtitlesOffset":if(null!==t&&isFinite(t)){g=t;var i=(I=Math.max(0,Math.min(100,parseInt(g,10))))<=0?-3:I<=5?-2:I<=10?0:I<=15?2:I<=20&&4;!1===i&&(i=-2),R.position=i,L.mediaId&&r({method:"setSubtitlePosition",parameters:{mediaId:L.mediaId,position:i}}),F("subtitlesOffset")}break;case"subtitlesSize":if(null!==t&&isFinite(t)){l=t;var o=(s=Math.max(0,parseInt(l,10)))<=100?1:s<=125?2:s<=150?3:s<=200&&4;!1===o&&(o=1),R.font_size=o,L.mediaId&&r({method:"setSubtitleFontSize",parameters:{mediaId:L.mediaId,fontSize:o}}),F("subtitlesSize")}break;case"subtitlesTextColor":if("string"==typeof t){var E="white";S[t]&&T.indexOf(S[t])>-1&&(E=S[t]),R.color=E,L.mediaId&&r({method:"setSubtitleCharacterColor",parameters:{mediaId:L.mediaId,charColor:E}}),D=t,F("subtitlesTextColor")}break;case"subtitlesBackgroundColor":"string"==typeof t&&(S[t]&&T.indexOf(S[t])>-1&&(R.bg_color=S[t],L.mediaId&&(r({method:"setSubtitleBackgroundColor",parameters:{mediaId:L.mediaId,bgColor:"none"===S[t]?"black":S[t]}}),r("none"===S[t]?{method:"setSubtitleBackgroundOpacity",parameters:{mediaId:L.mediaId,bgOpacity:0}}:{method:"setSubtitleBackgroundOpacity",parameters:{mediaId:L.mediaId,bgOpacity:255}}))),C=t,F("subtitlesBackgroundColor"));break;case"subtitlesOpacity":if("number"==typeof t){var n=Math.floor(t/100*255);R.char_opacity=n,L.mediaId&&r({method:"setSubtitleCharacterOpacity",parameters:{mediaId:L.mediaId,charOpacity:n}}),v=t,F("subtitlesOpacity")}break;case"selectedAudioTrackId":if(0===(t||"").indexOf("EMBEDDED_")){u=t;a=parseInt(t.replace("EMBEDDED_",""));if(L.mediaId&&r({method:"selectTrack",parameters:{type:"audio",mediaId:L.mediaId,index:a}},function(){var e=y("audioTracks").find(function(e){return e.id===t});N=N.map(function(e){return e.mode=e.id===u?"showing":"disabled",e}),e&&(h.emit("audioTrackLoaded",e),F("selectedAudioTrackId"))}),L&&L.audioTracks){for(var _=0;_4&&(clearInterval(E),G(),I(),o())},300)}else k(Object.assign({},n.UNSUPPORTED_STREAM,{critical:!0,stream:a?a.stream:null}));break;case"unload":B=null,f=null,Array.from(L.textTracks).forEach(function(e){e.oncuechange=null}),L.removeAttribute("src"),L.load(),F("stream"),F("paused"),F("time"),F("duration"),F("buffering"),F("buffered"),F("subtitlesTracks"),F("selectedSubtitlesTrackId"),F("audioTracks"),F("selectedAudioTrackId");break;case"destroy":H("unload"),P=!0,F("subtitlesOffset"),F("subtitlesSize"),F("subtitlesTextColor"),F("subtitlesBackgroundColor"),F("subtitlesOpacity"),F("volume"),F("muted"),F("playbackSpeed"),h.removeAllListeners(),L.onerror=null,L.onended=null,L.onpause=null,L.onplay=null,L.ontimeupdate=null,L.ondurationchange=null,L.onwaiting=null,L.onseeking=null,L.onseeked=null,L.onstalled=null,L.onplaying=null,L.oncanplay=null,L.canplaythrough=null,L.onloadeddata=null,L.onloadedmetadata=null,L.onvolumechange=null,L.onratechange=null,L.textTracks.onchange=null,t.removeChild(L),t.removeChild(m)}var o,E}this.on=function(e,t){if(P)throw new Error("Video is destroyed");h.on(e,t)},this.dispatch=function(e){if(P)throw new Error("Video is destroyed");if(e)switch((e=E(o(e))).type){case"observeProp":return t=e.propName,void(M.hasOwnProperty(t)&&(h.emit("propValue",t,y(t)),M[t]=!0));case"setProp":return void V(e.propName,e.propValue);case"command":return void H(e.commandName,e.commandArgs)}var t;throw new Error("Invalid action dispatched: "+JSON.stringify(e))}}A.canPlayStream=function(){return Promise.resolve(!0)},A.manifest={name:"WebOsVideo",external:!1,props:["stream","loaded","paused","time","duration","buffering","buffered","audioTracks","selectedAudioTrackId","subtitlesTracks","selectedSubtitlesTrackId","subtitlesOffset","subtitlesSize","subtitlesTextColor","subtitlesBackgroundColor","subtitlesOpacity","volume","muted","playbackSpeed"],commands:["load","unload","destroy"],events:["propValue","propChanged","ended","error","subtitlesTrackLoaded","audioTrackLoaded"]},e.exports=A},6143:(e,t,a)=>{var i=a(80860);e.exports=i},5286:(e,t,a)=>{var i=a(55852),o=a(55126),E=a(68816),n=a(88265);function _(e){var t=null!==(e=e||{}).timeChangedTimeout&&isFinite(e.timeChangedTimeout)?parseInt(e.timeChangedTimeout,10):100,a=e.containerElement;if(!(a instanceof HTMLElement))throw new Error("Container element required to be instance of HTMLElement");var _=document.createElement("script");_.type="text/javascript",_.src="https://www.youtube.com/iframe_api",_.onload=function(){if(A)return;if(!YT||"function"!=typeof YT.ready)return void N();YT.ready(function(){A||(YT&&YT.PlayerState&&"function"==typeof YT.Player?S=new YT.Player(r,{width:"100%",height:"100%",playerVars:{autoplay:1,cc_load_policy:3,controls:0,disablekb:1,enablejsapi:1,fs:0,iv_load_policy:3,loop:0,modestbranding:1,playsinline:1,rel:0},events:{onError:R,onReady:c,onApiChange:m,onStateChange:L}}):N())})},_.onerror=N,a.appendChild(_);var r=document.createElement("div");r.style.width="100%",r.style.height="100%",r.style.backgroundColor="black",a.appendChild(r);var T=window.setInterval(function(){p("time"),p("volume"),p("muted"),p("playbackSpeed")},t),S=null,s=!1,l=null,I=new i,A=!1,O=null,u=null,d={stream:!1,loaded:!1,paused:!1,time:!1,duration:!1,buffering:!1,volume:!1,muted:!1,playbackSpeed:!1,subtitlesTracks:!1,selectedSubtitlesTrackId:!1};function N(){A||C(Object.assign({},n.YOUTUBE_VIDEO.API_LOAD_FAILED,{critical:!0}))}function R(e){if(!A){var t;switch(e.data){case 2:t=n.YOUTUBE_VIDEO.INVALID_PARAMETER;break;case 5:t=n.YOUTUBE_VIDEO.HTML5_VIDEO;break;case 100:t=n.YOUTUBE_VIDEO.VIDEO_NOT_FOUND;break;case 101:case 150:t=n.YOUTUBE_VIDEO.VIDEO_NOT_EMBEDDABLE;break;default:t=n.UNKNOWN_ERROR}C(Object.assign({},t,{critical:!0,error:e}))}}function c(){A||(s=!0,null!==l&&(h("load",l),l=null))}function m(){A||("function"==typeof S.loadModule&&S.loadModule("captions"),"function"==typeof S.setOption&&S.setOption("captions","track",{}),p("paused"),p("time"),p("duration"),p("buffering"),p("volume"),p("muted"),p("playbackSpeed"),p("subtitlesTracks"),p("selectedSubtitlesTrackId"))}function L(e){switch(p("buffering"),e.data){case YT.PlayerState.ENDED:I.emit("ended");break;case YT.PlayerState.CUED:case YT.PlayerState.UNSTARTED:case YT.PlayerState.PAUSED:case YT.PlayerState.PLAYING:p("paused"),p("time"),p("duration")}}function D(e){switch(e){case"stream":return O;case"loaded":return null!==O||null;case"paused":return null===O||"function"!=typeof S.getPlayerState?null:S.getPlayerState()!==YT.PlayerState.PLAYING;case"time":return null!==O&&"function"==typeof S.getCurrentTime&&null!==S.getCurrentTime()&&isFinite(S.getCurrentTime())?Math.floor(1e3*S.getCurrentTime()):null;case"duration":return null!==O&&"function"==typeof S.getDuration&&null!==S.getDuration()&&isFinite(S.getDuration())?Math.floor(1e3*S.getDuration()):null;case"buffering":return null===O||"function"!=typeof S.getPlayerState?null:S.getPlayerState()===YT.PlayerState.BUFFERING;case"volume":return null!==O&&"function"==typeof S.getVolume&&null!==S.getVolume()&&isFinite(S.getVolume())?S.getVolume():null;case"muted":return null===O||"function"!=typeof S.isMuted?null:S.isMuted();case"playbackSpeed":return null!==O&&"function"==typeof S.getPlaybackRate&&null!==S.getPlaybackRate()&&isFinite(S.getPlaybackRate())?S.getPlaybackRate():null;case"subtitlesTracks":return null===O||"function"!=typeof S.getOption?[]:(S.getOption("captions","tracklist")||[]).filter(function(e){return e&&"string"==typeof e.languageCode}).map(function(e,t){return Object.freeze({id:"EMBEDDED_"+String(t),lang:e.languageCode,label:"string"==typeof e.displayName?e.displayName:e.languageCode,origin:"EMBEDDED",embedded:!0})});case"selectedSubtitlesTrackId":return null===O?null:u;default:return null}}function C(e){I.emit("error",e),e.critical&&h("unload")}function p(e){d[e]&&I.emit("propChanged",e,D(e))}function h(e,t){switch(e){case"load":if(h("unload"),t&&t.stream&&"string"==typeof t.stream.ytId)if(s){O=t.stream,p("stream"),p("loaded");var i="boolean"!=typeof t.autoplay||t.autoplay,o=null!==t.time&&isFinite(t.time)?parseInt(t.time,10)/1e3:0;i&&"function"==typeof S.loadVideoById?S.loadVideoById({videoId:t.stream.ytId,startSeconds:o}):"function"==typeof S.cueVideoById&&S.cueVideoById({videoId:t.stream.ytId,startSeconds:o}),p("paused"),p("time"),p("duration"),p("buffering"),p("volume"),p("muted"),p("playbackSpeed"),p("subtitlesTracks"),p("selectedSubtitlesTrackId")}else l=t;else C(Object.assign({},n.UNSUPPORTED_STREAM,{critical:!0,stream:t?t.stream:null}));break;case"unload":l=null,O=null,p("stream"),p("loaded"),u=null,s&&"function"==typeof S.stopVideo&&S.stopVideo(),p("paused"),p("time"),p("duration"),p("buffering"),p("volume"),p("muted"),p("playbackSpeed"),p("subtitlesTracks"),p("selectedSubtitlesTrackId");break;case"destroy":h("unload"),A=!0,I.removeAllListeners(),clearInterval(T),s&&"function"==typeof S.destroy&&S.destroy(),a.removeChild(_),a.removeChild(r)}}this.on=function(e,t){if(A)throw new Error("Video is destroyed");I.on(e,t)},this.dispatch=function(e){if(A)throw new Error("Video is destroyed");if(e)switch((e=E(o(e))).type){case"observeProp":return t=e.propName,void(d.hasOwnProperty(t)&&(I.emit("propValue",t,D(t)),d[t]=!0));case"setProp":return void(function(e,t){switch(e){case"paused":null!==O&&(t?"function"==typeof S.pauseVideo&&S.pauseVideo():"function"==typeof S.playVideo&&S.playVideo());break;case"time":null!==O&&"function"==typeof S.seekTo&&null!==t&&isFinite(t)&&S.seekTo(parseInt(t,10)/1e3);break;case"volume":null!==O&&null!==t&&isFinite(t)&&("function"==typeof S.unMute&&S.unMute(),"function"==typeof S.setVolume&&S.setVolume(Math.max(0,Math.min(100,parseInt(t,10)))),p("muted"),p("volume"));break;case"muted":null!==O&&(t?"function"==typeof S.mute&&S.mute():"function"==typeof S.unMute&&S.unMute(),p("muted"));break;case"playbackSpeed":null!==O&&"function"==typeof S.setPlaybackRate&&isFinite(t)&&(S.setPlaybackRate(t),p("playbackSpeed"));break;case"selectedSubtitlesTrackId":if(null!==O){u=null;var a=D("subtitlesTracks").find(function(e){return e.id===t});"function"==typeof S.setOption&&(a?(u=a.id,S.setOption("captions","track",{languageCode:a.lang}),I.emit("subtitlesTrackLoaded",a)):S.setOption("captions","track",{})),p("selectedSubtitlesTrackId")}}})(e.propName,e.propValue);case"command":return void h(e.commandName,e.commandArgs)}var t;throw new Error("Invalid action dispatched: "+JSON.stringify(e))}}_.canPlayStream=function(e){return Promise.resolve(e&&"string"==typeof e.ytId)},_.manifest={name:"YouTubeVideo",external:!1,props:["stream","loaded","paused","time","duration","buffering","volume","muted","playbackSpeed","subtitlesTracks","selectedSubtitlesTrackId"],commands:["load","unload","destroy"],events:["propValue","propChanged","ended","error","subtitlesTrackLoaded"]},e.exports=_},76784:(e,t,a)=>{var i=a(5286);e.exports=i},88265:e=>{e.exports={CHROMECAST_SENDER_VIDEO:{INVALID_MESSAGE_RECEIVED:{code:100,message:"Invalid message received"},MESSAGE_SEND_FAILED:{code:101,message:"Failed to send message"}},YOUTUBE_VIDEO:{API_LOAD_FAILED:{code:90,message:"YouTube player iframe API failed to load"},INVALID_PARAMETER:{code:91,message:"The request contains an invalid parameter value"},HTML5_VIDEO:{code:92,message:"The requested content cannot be played in an HTML5 player"},VIDEO_NOT_FOUND:{code:93,message:"The video requested was not found"},VIDEO_NOT_EMBEDDABLE:{code:94,message:"The owner of the requested video does not allow it to be played in embedded players"}},HTML_VIDEO:{MEDIA_ERR_ABORTED:{code:80,message:"Fetching process aborted"},MEDIA_ERR_NETWORK:{code:81,message:"Error occurred when downloading"},MEDIA_ERR_DECODE:{code:82,message:"Error occurred when decoding"},MEDIA_ERR_SRC_NOT_SUPPORTED:{code:83,message:"Video is not supported"}},WITH_HTML_SUBTITLES:{LOAD_FAILED:{code:70,message:"Failed to load external subtitles"}},WITH_STREAMING_SERVER:{CONVERT_FAILED:{code:60,message:"Your device does not support the stream"}},UNKNOWN_ERROR:{code:1,message:"Unknown error"},UNSUPPORTED_STREAM:{code:2,message:"Stream is not supported"},STREAM_FAILED_TO_LOAD:{code:3,message:"Stream failed to load"}}},25187:(e,t,a)=>{var i=a(37748);e.exports=i},73501:e=>{var t,a,i=[{codec:"h264",force:window.chrome||window.cast,mime:'video/mp4; codecs="avc1.42E01E"'},{codec:"h265",mime:'video/mp4; codecs="hev1.1.6.L150.B0"',aliases:["hevc"]},{codec:"vp8",mime:'video/mp4; codecs="vp8"'},{codec:"vp9",mime:'video/mp4; codecs="vp9"'}],o=[{codec:"aac",mime:'audio/mp4; codecs="mp4a.40.2"'},{codec:"mp3",mime:'audio/mp4; codecs="mp3"'},{codec:"ac3",mime:'audio/mp4; codecs="ac-3"'},{codec:"eac3",mime:'audio/mp4; codecs="ec-3"'},{codec:"vorbis",mime:'audio/mp4; codecs="vorbis"'},{codec:"opus",mime:'audio/mp4; codecs="opus"'}];function E(e,t){return e.force||"function"==typeof t.mediaElement.canPlayType&&t.mediaElement.canPlayType(e.mime)?[e.codec].concat(e.aliases||[]):[]}e.exports=(t=document.createElement("video"),a=["mp4"],(window.chrome||window.cast)&&a.push("matroska,webm"),{formats:a,videoCodecs:i.map(function(e){return E(e,{mediaElement:t})}).reduce(function(e,t){return e.concat(t)},[]),audioCodecs:o.map(function(e){return E(e,{mediaElement:t})}).reduce(function(e,t){return e.concat(t)},[]),maxAudioChannels:(function(){if(/firefox/i.test(window.navigator.userAgent))return 6;if(!window.AudioContext||window.chrome||window.cast)return 2;var e=(new AudioContext).destination.maxChannelCount;return e>0?e:2})()})},19576:e=>{var t=null;e.exports={set:function(e){t=e},get:function(){return t}}},63611:(e,t,a)=>{var i=a(19576);e.exports=function(){return["Tizen","webOS","Titan","NetTV"].includes(i.get())||void 0!==window.qt?Promise.resolve(!1):Promise.resolve(!0)}},41779:e=>{e.exports=function(e,t){fetch("http://127.0.0.1:11470/tracks/"+encodeURIComponent(e)).then(function(e){return e.json()}).then(function(e){var a=e.filter(function(e){return"audio"===(e||{}).type}),i=e.filter(function(e){return"text"===(e||{}).type});t({audio:a,subs:i})}).catch(function(e){console.error(e),t(!1)})}},61653:e=>{e.exports=function(e,t){if(tt?i=E-1:(e[E]{var i=a(76656);e.exports=i},94407:e=>{function t(e){for(var t="",a=(e=e.replace(/<[a-zA-Z/][^>]*>/g,"")).split(/\n/);a.length>3;){for(var i=3;i\s*(\d+):(\d+):(\d+)(?:,(\d+))?/);return E?(t+=E[1]+":"+E[2]+":"+E[3]+"."+E[4]+" --\x3e "+E[5]+":"+E[6]+":"+E[7]+"."+E[8]+"\n",a[o+=1]&&(t+=a[o]+"\n\n"),t):""}e.exports={convert:function(e){if(e.includes("WEBVTT"))return e;try{return(function(e){var a=e.replace(/\r+/g,""),i=(a=a.replace(/^\s+|\s+$/g,"")).split("\n\n"),o="";if(i.length>0){o+="WEBVTT\n\n";for(var E=0;E{var i=a(21417),o=a(61653);e.exports={parse:function(e){return new Promise(function(t,a){var E=new i.WebVTT.Parser(window,i.WebVTT.StringDecoder()),n=[],_=[],r={};E.oncue=function(e){var t={startTime:1e3*e.startTime|0,endTime:1e3*e.endTime|0,text:e.text};_.push(t),r[t.startTime]=r[t.startTime]||[],r[t.endTime]=r[t.endTime]||[]},E.onparsingerror=function(e){0===e.code?(E.oncue=null,E.onparsingerror=null,E.onflush=null,a(e)):(console.warn("Subtitles parsing error",e),n.push(e))},E.onflush=function(){r.times=Object.keys(r).map(function(e){return parseInt(e,10)}).sort(function(e,t){return e-t});for(var e=0;e<_.length;e++){r[_[e].startTime].push(_[e]);for(var i=o(r.times,_[e].startTime)+1;i{var i=a(21417),o=a(61653);e.exports={render:function(e,t){var a=[],E=o(e.times,t);if(-1!==E)for(var n=e[e.times[E]],_=0;_{var i=a(55852),o=a(55126),E=a(68816),n=a(38742),_=a(88265),r=a(31328),T=a(67520),S=a(94407);e.exports=function(e){function t(t){var a=new e(t=t||{});a.on("error",function(e){O.emit("error",e),e.critical&&M("unload")}),a.on("propValue",B.bind(null,"propValue")),a.on("propChanged",B.bind(null,"propChanged")),e.manifest.events.filter(function(e){return!["error","propValue","propChanged"].includes(e)}).forEach(function(e){a.on(e,(function(e){return function(){O.emit.apply(O,[e].concat(Array.from(arguments)))}})(e))});var s=t.containerElement;if(!(s instanceof HTMLElement))throw new Error("Container element required to be instance of HTMLElement");var l=document.createElement("div");l.style.position="absolute",l.style.right="0",l.style.bottom="0",l.style.left="0",l.style.zIndex="1",l.style.textAlign="center",s.style.position="relative",s.style.zIndex="0",s.appendChild(l);var I={time:null},A=null,O=new i,u=!1,d=[],N=null,R=null,c=100,m=0,L="rgb(255, 255, 255)",D="rgba(0, 0, 0, 0)",C="rgb(34, 34, 34)",p=1,h={extraSubtitlesTracks:!1,selectedExtraSubtitlesTrackId:!1,extraSubtitlesDelay:!1,extraSubtitlesSize:!1,extraSubtitlesOffset:!1,extraSubtitlesTextColor:!1,extraSubtitlesBackgroundColor:!1,extraSubtitlesOutlineColor:!1,extraSubtitlesOpacity:!1};function P(){for(;l.hasChildNodes();)l.removeChild(l.lastChild);null!==A&&null!==I.time&&isFinite(I.time)&&(l.style.bottom=m+"%",l.style.opacity=p,T.render(A,I.time-R).forEach(function(e){e.style.display="inline-block",e.style.padding="0.2em",e.style.whiteSpace="pre-wrap";var t=window.screen720p?1.538:1;e.style.fontSize=Math.floor(c/25*t)+"vmin",e.style.color=L,e.style.backgroundColor=D,e.style.textShadow="-0.15rem -0.15rem 0.15rem "+C+", 0px -0.15rem 0.15rem "+C+", 0.15rem -0.15rem 0.15rem "+C+", -0.15rem 0px 0.15rem "+C+", 0.15rem 0px 0.15rem "+C+", -0.15rem 0.15rem 0.15rem "+C+", 0px 0.15rem 0.15rem "+C+", 0.15rem 0.15rem 0.15rem "+C,l.appendChild(e),l.appendChild(document.createElement("br"))}))}function B(e,t,a){if("time"===t)I.time=a,P();O.emit(e,t,g(t,a))}function f(e){h[e]&&O.emit("propChanged",e,g(e,null))}function g(e,t){switch(e){case"extraSubtitlesTracks":return u?[]:d.slice();case"selectedExtraSubtitlesTrackId":return u?null:N;case"extraSubtitlesDelay":return u?null:R;case"extraSubtitlesSize":return u?null:c;case"extraSubtitlesOffset":return u?null:m;case"extraSubtitlesTextColor":return u?null:L;case"extraSubtitlesBackgroundColor":return u?null:D;case"extraSubtitlesOutlineColor":return u?null:C;case"extraSubtitlesOpacity":return u?null:p;default:return t}}function v(e,t){switch(e){case"selectedExtraSubtitlesTrackId":A=null,N=null,R=null;var i=d.find(function(e){return e.id===t});if(i){N=i.id,R=0,(function e(t,o){(function(e,t){var a=t?e.fallbackUrl:e.url;if("string"==typeof a)return fetch(a).then(function(e){if(e.ok)return e.text();throw new Error(e.status+" ("+e.statusText+")")});if(e.buffer instanceof ArrayBuffer)try{const t=new Uint8Array(e.buffer),a=(new TextDecoder).decode(t);return Promise.resolve(a)}catch(e){return Promise.reject(e)}return Promise.reject("No `url` or `buffer` field available for this track")})(t,o).then(function(e){return S.convert(e)}).then(function(e){return r.parse(e)}).then(function(e){N===i.id&&(A=e,P(),O.emit("extraSubtitlesTrackLoaded",i))}).catch(function(t){N===i.id&&(o||"string"!=typeof i.fallbackUrl?(function(e){O.emit("error",e),e.critical&&(M("unload"),a.dispatch({type:"command",commandName:"unload"}))})(Object.assign({},_.WITH_HTML_SUBTITLES.LOAD_FAILED,{error:t,track:i,critical:!1})):e(i,!0))})})(i)}return P(),f("selectedExtraSubtitlesTrackId"),f("extraSubtitlesDelay"),!0;case"extraSubtitlesDelay":return null!==N&&null!==t&&isFinite(t)&&(R=parseInt(t,10),P(),f("extraSubtitlesDelay")),!0;case"extraSubtitlesSize":return null!==t&&isFinite(t)&&(c=Math.max(0,parseInt(t,10)),P(),f("extraSubtitlesSize")),!0;case"extraSubtitlesOffset":return null!==t&&isFinite(t)&&(m=Math.max(0,Math.min(100,parseInt(t,10))),P(),f("extraSubtitlesOffset")),!0;case"extraSubtitlesTextColor":if("string"==typeof t){try{L=n(t).rgb().string()}catch(e){console.error("withHTMLSubtitles",e)}P(),f("extraSubtitlesTextColor")}return!0;case"extraSubtitlesBackgroundColor":if("string"==typeof t){try{D=n(t).rgb().string()}catch(e){console.error("withHTMLSubtitles",e)}P(),f("extraSubtitlesBackgroundColor")}return!0;case"extraSubtitlesOutlineColor":if("string"==typeof t){try{C=n(t).rgb().string()}catch(e){console.error("withHTMLSubtitles",e)}P(),f("extraSubtitlesOutlineColor")}return!0;case"extraSubtitlesOpacity":if("number"==typeof t){try{p=Math.min(Math.max(t/100,0),1)}catch(e){console.error("withHTMLSubtitles",e)}P(),f("extraSubtitlesOpacity")}return!0;default:return!1}}function M(e,t){switch(e){case"addExtraSubtitlesTracks":return t&&Array.isArray(t.tracks)&&(d=d.concat(t.tracks).filter(function(e,t,a){return e&&"string"==typeof e.id&&"string"==typeof e.lang&&"string"==typeof e.label&&"string"==typeof e.origin&&!e.embedded&&t===a.findIndex(function(t){return t.id===e.id})}),f("extraSubtitlesTracks")),!0;case"addLocalSubtitles":if(t&&"string"==typeof t.filename&&t.buffer instanceof ArrayBuffer){var i="LOCAL_"+d.filter(function(e){return e.local}).length,o={id:i,url:null,buffer:t.buffer,lang:"local",label:t.filename,origin:"LOCAL",local:!0,embedded:!1};d.push(o),f("extraSubtitlesTracks"),O.emit("extraSubtitlesTrackAdded",o)}return!0;case"load":return M("unload"),t.stream&&Array.isArray(t.stream.subtitles)&&M("addExtraSubtitlesTracks",{tracks:t.stream.subtitles.map(function(e){return Object.assign({},e,{origin:"EXCLUSIVE",exclusive:!0,embedded:!1})})}),!1;case"unload":return A=null,d=[],N=null,R=null,P(),f("extraSubtitlesTracks"),f("selectedExtraSubtitlesTrackId"),f("extraSubtitlesDelay"),!1;case"destroy":return M("unload"),u=!0,f("extraSubtitlesSize"),f("extraSubtitlesOffset"),f("extraSubtitlesTextColor"),f("extraSubtitlesBackgroundColor"),f("extraSubtitlesOutlineColor"),f("extraSubtitlesOpacity"),a.dispatch({type:"command",commandName:"destroy"}),O.removeAllListeners(),s.removeChild(l),!0;default:return!1}}this.on=function(e,t){if(u)throw new Error("Video is destroyed");O.on(e,t)},this.dispatch=function(e){if(u)throw new Error("Video is destroyed");if(e)switch((e=E(o(e))).type){case"observeProp":if((function(e){switch(e){case"extraSubtitlesTracks":case"selectedExtraSubtitlesTrackId":case"extraSubtitlesDelay":case"extraSubtitlesSize":case"extraSubtitlesOffset":case"extraSubtitlesTextColor":case"extraSubtitlesBackgroundColor":case"extraSubtitlesOutlineColor":case"extraSubtitlesOpacity":return O.emit("propValue",e,g(e,null)),h[e]=!0,!0;default:return!1}})(e.propName))return;break;case"setProp":if(v(e.propName,e.propValue))return;break;case"command":if(M(e.commandName,e.commandArgs))return}a.dispatch(e)}}return t.canPlayStream=function(t){return e.canPlayStream(t)},t.manifest={name:e.manifest.name+"WithHTMLSubtitles",external:e.manifest.external,props:e.manifest.props.concat(["extraSubtitlesTracks","selectedExtraSubtitlesTrackId","extraSubtitlesDelay","extraSubtitlesSize","extraSubtitlesOffset","extraSubtitlesTextColor","extraSubtitlesBackgroundColor","extraSubtitlesOutlineColor","extraSubtitlesOpacity"]).filter(function(e,t,a){return a.indexOf(e)===t}),commands:e.manifest.commands.concat(["load","unload","destroy","addExtraSubtitlesTracks","addLocalSubtitles"]).filter(function(e,t,a){return a.indexOf(e)===t}),events:e.manifest.events.concat(["propValue","propChanged","error","extraSubtitlesTrackLoaded","extraSubtitlesTrackAdded"]).filter(function(e,t,a){return a.indexOf(e)===t})},t}},32584:(e,t,a)=>{var i=a(32168),o=a(53909),E=a(72097);function n(e,t,a,o){var E=new URL(t),n=new URLSearchParams;return n.set("d",E.origin),Object.entries(a).forEach(function(e){n.append("h",e[0]+":"+e[1])}),Object.entries(o).forEach(function(e){n.append("r",e[0]+":"+e[1])}),i.resolve(e,"/proxy/"+n.toString()+E.pathname)+E.search}e.exports=function(e,t,a,i){return new Promise(function(_,r){if("string"!=typeof t.url)"string"!=typeof t.infoHash?r(new Error("Stream cannot be converted")):E(e,t.infoHash,t.fileIdx,t.announce,a).then(function(e){_({url:e.url,infoHash:e.infoHash,fileIdx:e.fileIdx})}).catch(function(e){r(e)});else if(0===t.url.indexOf("magnet:")){var T;try{if(!(T=o.decode(t.url))||"string"!=typeof T.infoHash)throw new Error("Failed to decode magnet url")}catch(e){return void r(e)}var S=Array.isArray(T.announce)?T.announce.map(function(e){return"tracker:"+e}):[];E(e,T.infoHash,null,S,a).then(function(e){_({url:e.url,infoHash:e.infoHash,fileIdx:e.fileIdx})}).catch(function(e){r(e)})}else{var s=i&&i.proxyStreamsEnabled,l=t.behaviorHints&&t.behaviorHints.proxyHeaders;if(s||l){var I=l&&l.request?l.request:{},A=l&&l.response?l.response:{};_({url:n(e,t.url,I,A)})}else _({url:t.url})}})}},72097:(e,t,a)=>{var i=a(32168);function o(e,t,a,o){var E=Array.isArray(o)&&o.length>0?"?"+new URLSearchParams(o.map(function(e){return["tr",e]})):"";return{url:i.resolve(e,"/"+encodeURIComponent(t)+"/"+encodeURIComponent(a))+E,infoHash:t,fileIdx:a,sources:o}}e.exports=function(e,t,a,E,n){if((!Array.isArray(E)||0===E.length)&&null!==a&&isFinite(a))return Promise.resolve(o(e,t,a,E));var _={torrent:{infoHash:t}};return Array.isArray(E)&&E.length>0&&(_.peerSearch={sources:["dht:"+t].concat(E).filter(function(e,t,a){return a.indexOf(e)===t}),min:40,max:200}),null!==a&&isFinite(a)?_.guessFileIdx=!1:(_.guessFileIdx={},n&&(null!==n.season&&isFinite(n.season)&&(_.guessFileIdx.season=n.season),null!==n.episode&&isFinite(n.episode)&&(_.guessFileIdx.episode=n.episode))),fetch(i.resolve(e,"/"+encodeURIComponent(t)+"/create"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(_)}).then(function(e){if(e.ok)return e.json();throw new Error(e.status+" ("+e.statusText+")")}).then(function(i){return o(e,t,_.guessFileIdx?i.guessedFileIdx:a,_.peerSearch?_.peerSearch.sources:[])})}},62694:(e,t,a)=>{var i=a(32168);function o(e,t,a){var o=a&&"string"==typeof a.videoHash?a.videoHash:null,E=a&&isFinite(a.videoSize)?a.videoSize:null;if("string"==typeof o&&null!==E&&isFinite(E))return Promise.resolve({hash:o,size:E});var n=new URLSearchParams([["videoUrl",t]]);return fetch(i.resolve(e,"/opensubHash?"+n.toString())).then(function(e){if(e.ok)return e.json();throw new Error(e.status+" ("+e.statusText+")")}).then(function(e){if(e.error)throw new Error(e.error);return{hash:"string"==typeof o?o:e.result&&"string"==typeof e.result.hash?e.result.hash:null,size:null!==E&&isFinite(E)?E:e.result&&(e.result.size,1)?e.result.size:null}})}function E(e,t,a,o,E){return E&&"string"==typeof E.filename?Promise.resolve(E.filename):a?fetch(i.resolve(e,"/"+encodeURIComponent(a)+"/"+encodeURIComponent(o)+"/stats.json")).then(function(e){if(e.ok)return e.json();throw new Error(e.status+" ("+e.statusText+")")}).then(function(e){if(!e||"string"!=typeof e.streamName)throw new Error("Could not retrieve filename from torrent");return e.streamName}):Promise.resolve(decodeURIComponent(t.split("/").pop()))}e.exports=function(e,t,a,i,n){return Promise.allSettled([o(e,t,n),E(e,t,a,i,n)]).then(function(e){var t={hash:null,size:null,filename:null};return"fulfilled"===e[0].status?(t.hash=e[0].value.hash,t.size=e[0].value.size):e[0].reason&&console.error(e[0].reason),"fulfilled"===e[1].status?t.filename=e[1].value:e[1].reason&&console.error(e[1].reason),t})}},5247:(e,t,a)=>{var i=a(3452);e.exports=i},44643:e=>{e.exports=function(e,t){return t.includes("loaded")?new Promise(function(t,a){var i=null;e.on("propChanged",function(e,o){"loaded"===e&&null!==o&&null===i&&(i=o,!0===o?t(!0):!1===o&&a(Error("Player failed to load, will not retrieve video params")))}),e.dispatch({type:"observeProp",propName:"loaded"})}):Promise.resolve(!0)}},3452:(e,t,a)=>{var i=a(55852),o=a(32168),E=a(77444),n=a(55126),_=a(68816),r=a(73501),T=a(32584),S=a(62694),s=a(44643),l=a(63611),I=a(88265);e.exports=function(e){function t(a){var l=new e(a=a||{});l.on("error",function(e){R.emit("error",e),e.critical&&h("unload")}),l.on("propValue",L.bind(null,"propValue")),l.on("propChanged",L.bind(null,"propChanged")),e.manifest.events.filter(function(e){return!["error","propValue","propChanged"].includes(e)}).forEach(function(e){l.on(e,(function(e){return function(){R.emit.apply(R,[e].concat(Array.from(arguments)))}})(e))});var A=this,O=null,u=!1,d=[],N=null,R=new i,c=!1,m={stream:!1,videoParams:!1};function L(e,t,a){R.emit(e,t,p(t,a))}function D(e){m[e]&&R.emit("propChanged",e,p(e,null))}function C(e){R.emit("error",e),e.critical&&(h("unload"),l.dispatch({type:"command",commandName:"unload"}))}function p(e,t){switch(e){case"stream":return null!==O?O.stream:null;case"videoParams":return N;default:return t}}function h(a,i){switch(a){case"load":return i&&i.stream&&"string"==typeof i.streamingServerURL?(h("unload"),l.dispatch({type:"command",commandName:"unload"}),O=i,D("stream"),T(i.streamingServerURL,i.stream,i.seriesInfo,i.streamingServerSettings).then(function(e){var a=e.url,n=e.infoHash,_=e.fileIdx,T=Array.isArray(i.formats)?i.formats:r.formats,S=Array.isArray(i.videoCodecs)?i.videoCodecs:r.videoCodecs,s=Array.isArray(i.audioCodecs)?i.audioCodecs:r.audioCodecs,l=null!==i.maxAudioChannels&&isFinite(i.maxAudioChannels)?i.maxAudioChannels:r.maxAudioChannels,I=Object.assign({},i,{formats:T,videoCodecs:S,audioCodecs:s,maxAudioChannels:l});return(i.forceTranscoding?Promise.resolve(!1):t.canPlayStream({url:a},I)).catch(function(e){return console.warn("Media probe error",e),!1}).then(function(e){if(e)return{mediaURL:a,infoHash:n,fileIdx:_,stream:{url:a}};var t=E(),r=new URLSearchParams([["mediaURL",a]]);return i.forceTranscoding&&r.set("forceTranscoding","1"),S.forEach(function(e){r.append("videoCodecs",e)}),s.forEach(function(e){r.append("audioCodecs",e)}),r.set("maxAudioChannels",l),{mediaURL:a,infoHash:n,fileIdx:_,stream:{url:o.resolve(i.streamingServerURL,"/hlsv2/"+t+"/master.m3u8?"+r.toString()),subtitles:Array.isArray(i.stream.subtitles)?i.stream.subtitles.map(function(e){return Object.assign({},e,{url:"string"==typeof e.url?o.resolve(i.streamingServerURL,"/subtitles.vtt?"+new URLSearchParams([["from",e.url]]).toString()):e.url})}):[],behaviorHints:{headers:{"content-type":"application/vnd.apple.mpegurl"}}}}})}).then(function(t){i===O&&(l.dispatch({type:"command",commandName:"load",commandArgs:Object.assign({},i,{stream:t.stream})}),u=!0,(function(){for(;d.length>0;){var e=d.shift();A.dispatch.call(A,e)}})(),s(l,e.manifest.props).then(function(){return S(i.streamingServerURL,t.mediaURL,t.infoHash,t.fileIdx,i.stream.behaviorHints)}).then(function(e){i===O&&(N=e,D("videoParams"))}).catch(function(e){i===O&&(console.error(e),N={hash:null,size:null,filename:null},D("videoParams"))}))}).catch(function(e){i===O&&C(Object.assign({},I.WITH_STREAMING_SERVER.CONVERT_FAILED,{error:e,critical:!0,stream:i.stream,streamingServerURL:i.streamingServerURL}))})):C(Object.assign({},I.UNSUPPORTED_STREAM,{critical:!0,stream:i?i.stream:null,streamingServerURL:i&&"string"==typeof i.streamingServerURL?i.streamingServerURL:null})),!0;case"addExtraSubtitlesTracks":return O&&i&&Array.isArray(i.tracks)&&(u?l.dispatch({type:"command",commandName:"addExtraSubtitlesTracks",commandArgs:Object.assign({},i,{tracks:i.tracks.map(function(e){return Object.assign({},e,{fallbackUrl:e.url,url:"string"==typeof e.url?o.resolve(O.streamingServerURL,"/subtitles.vtt?"+new URLSearchParams([["from",e.url]]).toString()):e.url})})})}):d.push({type:"command",commandName:"addExtraSubtitlesTracks",commandArgs:i})),!0;case"unload":return O=null,u=!1,d=[],N=null,D("stream"),D("videoParams"),!1;case"destroy":return h("unload"),c=!0,l.dispatch({type:"command",commandName:"destroy"}),R.removeAllListeners(),!0;default:return!u&&(d.push({type:"command",commandName:a,commandArgs:i}),!0)}}this.on=function(e,t){if(c)throw new Error("Video is destroyed");R.on(e,t)},this.dispatch=function(e){if(c)throw new Error("Video is destroyed");if(e)switch((e=_(n(e))).type){case"observeProp":if((function(e){switch(e){case"stream":case"videoParams":return R.emit("propValue",e,p(e,null)),m[e]=!0,!0;default:return!1}})(e.propName))return;break;case"command":if(h(e.commandName,e.commandArgs))return}l.dispatch(e)}}return t.canPlayStream=function(t,a){return l().then(function(i){if(!i)return e.canPlayStream(t);var E=new URLSearchParams([["mediaURL",t.url]]);return fetch(o.resolve(a.streamingServerURL,"/hlsv2/probe?"+E.toString())).then(function(e){return e.json()}).then(function(e){var t=a.formats.some(function(t){return-1!==e.format.name.indexOf(t)}),i=e.streams.every(function(e){return"audio"===e.track?e.channels<=a.maxAudioChannels&&-1!==a.audioCodecs.indexOf(e.codec):"video"!==e.track||-1!==a.videoCodecs.indexOf(e.codec)});return t&&i}).catch(function(){return e.canPlayStream(t)})})},t.manifest={name:e.manifest.name+"WithStreamingServer",external:e.manifest.external,props:e.manifest.props.concat(["stream","videoParams"]).filter(function(e,t,a){return a.indexOf(e)===t}),commands:e.manifest.commands.concat(["load","unload","destroy","addExtraSubtitlesTracks"]).filter(function(e,t,a){return a.indexOf(e)===t}),events:e.manifest.events.concat(["propValue","propChanged","error"]).filter(function(e,t,a){return a.indexOf(e)===t})},t}},45209:(e,t,a)=>{var i=a(66712);e.exports=i},66712:(e,t,a)=>{var i=a(55852),o=a(55126),E=a(68816);e.exports=function(e){function t(t){var a=new e(t=t||{});a.on("propValue",S.bind(null,"propValue")),a.on("propChanged",S.bind(null,"propChanged")),e.manifest.events.filter(function(e){return!["propValue","propChanged"].includes(e)}).forEach(function(e){a.on(e,(function(e){return function(){_.emit.apply(_,[e].concat(Array.from(arguments)))}})(e))});var n=null,_=new i,r=!1,T={videoParams:!1};function S(e,t,a){"videoParams"!==t&&_.emit(e,t,s(t,a)),"stream"===t&&(n=a,(function(e){T[e]&&_.emit("propChanged",e,s(e,null))})("videoParams"))}function s(e,t){return"videoParams"===e?null===n?null:{hash:n.behaviorHints&&"string"==typeof n.behaviorHints.videoHash?n.behaviorHints.videoHash:null,size:n.behaviorHints&&null!==n.behaviorHints.videoSize&&isFinite(n.behaviorHints.videoSize)?n.behaviorHints.videoSize:null,filename:n.behaviorHints&&"string"==typeof n.behaviorHints.filename?n.behaviorHints.filename:null}:t}this.on=function(e,t){if(r)throw new Error("Video is destroyed");_.on(e,t)},this.dispatch=function(e){if(r)throw new Error("Video is destroyed");if(e)switch((e=E(o(e))).type){case"observeProp":if("videoParams"===(i=e.propName)&&(_.emit("propValue",i,s(i,null)),T[i]=!0,1))return;break;case"command":if(t=e.commandName,e.commandArgs,"destroy"===t&&(r=!0,a.dispatch({type:"command",commandName:"destroy"}),_.removeAllListeners(),1))return}var t,i;a.dispatch(e)}}return t.canPlayStream=function(t,a){return e.canPlayStream(t,a)},t.manifest={name:e.manifest.name+"WithVideoParams",external:e.manifest.external,props:e.manifest.props.concat(["videoParams"]).filter(function(e,t,a){return a.indexOf(e)===t}),commands:e.manifest.commands.concat(["destroy"]).filter(function(e,t,a){return a.indexOf(e)===t}),events:e.manifest.events.concat(["propValue","propChanged"]).filter(function(e,t,a){return a.indexOf(e)===t})},t}},38250:function(e){"undefined"!=typeof self&&self,e.exports=(function(e){var t={};function a(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,a),o.l=!0,o.exports}return a.m=e,a.c=t,a.d=function(e,t,i){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(a.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)a.d(i,o,function(t){return e[t]}.bind(null,o));return i},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=1)})([function(e,t,a){"use strict";var i=a(3);function o(e){return!0===i(e)&&"[object Object]"===Object.prototype.toString.call(e)}e.exports=function(e){var t,a;return!1!==o(e)&&"function"==typeof(t=e.constructor)&&!1!==o(a=t.prototype)&&!1!==a.hasOwnProperty("isPrototypeOf")}},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VERSION=t.PALETTE_MATERIAL_CHROME=t.PALETTE_MATERIAL_500=t.COLOR_NAMES=t.getLuminance=t.intToRgb=t.rgbToInt=t.rgbToHsv=t.rgbToHsl=t.hslToRgb=t.rgbToHex=t.parseColor=t.parseColorToHsla=t.parseColorToHsl=t.parseColorToRgba=t.parseColorToRgb=t.from=t.createPicker=void 0;var i=(function(){function e(e,t){for(var a=0;a-1,l="undefined"!=typeof window&&window.navigator.userAgent.indexOf("rv:")>-1,I={id:null,attachTo:"body",showHSL:!0,showRGB:!0,showHEX:!0,showAlpha:!1,color:"#ff0000",palette:null,paletteEditable:!1,useAlphaInPalette:"auto",slBarSize:[232,150],hueBarSize:[150,11],alphaBarSize:[150,11]},A="COLOR",O="RGBA_USER",u="HSLA_USER";function d(e,t,a){return e?e instanceof HTMLElement?e:e instanceof NodeList?e[0]:"string"==typeof e?document.querySelector(e):e.jquery?e.get(0):a?t:null:t}function N(e){var t=e.getContext("2d"),a=+e.width,i=+e.height,n=t.createLinearGradient(1,1,1,i-1);return n.addColorStop(0,"white"),n.addColorStop(1,"black"),{setHue:function(e){var o=t.createLinearGradient(1,0,a-1,0);o.addColorStop(0,"hsla("+e+", 100%, 50%, 0)"),o.addColorStop(1,"hsla("+e+", 100%, 50%, 1)"),t.fillStyle=n,t.fillRect(0,0,a,i),t.fillStyle=o,t.globalCompositeOperation="multiply",t.fillRect(0,0,a,i),t.globalCompositeOperation="source-over"},grabColor:function(e,a){return t.getImageData(e,a,1,1).data},findColor:function(e,t,n){var _=(0,E.rgbToHsv)(e,t,n),r=o(_,3),T=r[1],S=r[2];return[T*a,i-S*i]}}}function R(e,t,a){return null===e?t:/^\s*$/.test(e)?a:!!/true|yes|1/i.test(e)||!/false|no|0/i.test(e)&&t}function c(e,t,a){if(null===e)return t;if(/^\s*$/.test(e))return a;var i=e.split(",").map(Number);return 2===i.length&&i[0]&&i[1]?i:t}var m=(function(){function e(t,a){if(T(this,e),a?(t=d(t),this.options=Object.assign({},I,a)):t&&(0,n.default)(t)?(this.options=Object.assign({},I,t),t=d(this.options.attachTo)):(this.options=Object.assign({},I),t=d((0,E.nvl)(t,this.options.attachTo))),!t)throw new Error("Container not found: "+this.options.attachTo);!(function(e,t){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"acp-";if(t.hasAttribute(a+"show-hsl")&&(e.showHSL=R(t.getAttribute(a+"show-hsl"),I.showHSL,!0)),t.hasAttribute(a+"show-rgb")&&(e.showRGB=R(t.getAttribute(a+"show-rgb"),I.showRGB,!0)),t.hasAttribute(a+"show-hex")&&(e.showHEX=R(t.getAttribute(a+"show-hex"),I.showHEX,!0)),t.hasAttribute(a+"show-alpha")&&(e.showAlpha=R(t.getAttribute(a+"show-alpha"),I.showAlpha,!0)),t.hasAttribute(a+"palette-editable")&&(e.paletteEditable=R(t.getAttribute(a+"palette-editable"),I.paletteEditable,!0)),t.hasAttribute(a+"sl-bar-size")&&(e.slBarSize=c(t.getAttribute(a+"sl-bar-size"),I.slBarSize,[232,150])),t.hasAttribute(a+"hue-bar-size")&&(e.hueBarSize=c(t.getAttribute(a+"hue-bar-size"),I.hueBarSize,[150,11]),e.alphaBarSize=e.hueBarSize),t.hasAttribute(a+"palette")){var i=t.getAttribute(a+"palette");switch(i){case"PALETTE_MATERIAL_500":e.palette=E.PALETTE_MATERIAL_500;break;case"PALETTE_MATERIAL_CHROME":case"":e.palette=E.PALETTE_MATERIAL_CHROME;break;default:e.palette=i.split(/[;|]/)}}t.hasAttribute(a+"color")&&(e.color=t.getAttribute(a+"color"))})(this.options,t),this.H=0,this.S=0,this.L=0,this.R=0,this.G=0,this.B=0,this.A=1,this.palette={},this.element=document.createElement("div"),this.options.id&&(this.element.id=this.options.id),this.element.className="a-color-picker",this.element.innerHTML=_.default,t.appendChild(this.element);var i=this.element.querySelector(".a-color-picker-h");this.setupHueCanvas(i),this.hueBarHelper=N(i),this.huePointer=this.element.querySelector(".a-color-picker-h+.a-color-picker-dot");var o=this.element.querySelector(".a-color-picker-sl");this.setupSlCanvas(o),this.slBarHelper=N(o),this.slPointer=this.element.querySelector(".a-color-picker-sl+.a-color-picker-dot"),this.preview=this.element.querySelector(".a-color-picker-preview"),this.setupClipboard(this.preview.querySelector(".a-color-picker-clipbaord")),this.options.showHSL?(this.setupInput(this.inputH=this.element.querySelector(".a-color-picker-hsl>input[nameref=H]")),this.setupInput(this.inputS=this.element.querySelector(".a-color-picker-hsl>input[nameref=S]")),this.setupInput(this.inputL=this.element.querySelector(".a-color-picker-hsl>input[nameref=L]"))):this.element.querySelector(".a-color-picker-hsl").remove(),this.options.showRGB?(this.setupInput(this.inputR=this.element.querySelector(".a-color-picker-rgb>input[nameref=R]")),this.setupInput(this.inputG=this.element.querySelector(".a-color-picker-rgb>input[nameref=G]")),this.setupInput(this.inputB=this.element.querySelector(".a-color-picker-rgb>input[nameref=B]"))):this.element.querySelector(".a-color-picker-rgb").remove(),this.options.showHEX?this.setupInput(this.inputRGBHEX=this.element.querySelector("input[nameref=RGBHEX]")):this.element.querySelector(".a-color-picker-rgbhex").remove(),this.options.paletteEditable||this.options.palette&&this.options.palette.length>0?this.setPalette(this.paletteRow=this.element.querySelector(".a-color-picker-palette")):(this.paletteRow=this.element.querySelector(".a-color-picker-palette"),this.paletteRow.remove()),this.options.showAlpha?(this.setupAlphaCanvas(this.element.querySelector(".a-color-picker-a")),this.alphaPointer=this.element.querySelector(".a-color-picker-a+.a-color-picker-dot")):this.element.querySelector(".a-color-picker-alpha").remove(),this.element.style.width=this.options.slBarSize[0]+"px",this.onValueChanged(A,this.options.color)}return i(e,[{key:"setupHueCanvas",value:function(e){var t=this;e.width=this.options.hueBarSize[0],e.height=this.options.hueBarSize[1];for(var a=e.getContext("2d"),i=a.createLinearGradient(0,0,this.options.hueBarSize[0],0),o=0;o<=1;o+=1/360)i.addColorStop(o,"hsl("+360*o+", 100%, 50%)");a.fillStyle=i,a.fillRect(0,0,this.options.hueBarSize[0],this.options.hueBarSize[1]);var n=function(a){var i=(0,E.limit)(a.clientX-e.getBoundingClientRect().left,0,t.options.hueBarSize[0]),o=Math.round(360*i/t.options.hueBarSize[0]);t.huePointer.style.left=i-7+"px",t.onValueChanged("H",o)},_=function e(){document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",e)};e.addEventListener("mousedown",function(e){n(e),document.addEventListener("mousemove",n),document.addEventListener("mouseup",_)})}},{key:"setupSlCanvas",value:function(e){var t=this;e.width=this.options.slBarSize[0],e.height=this.options.slBarSize[1];var a=function(a){var i=(0,E.limit)(a.clientX-e.getBoundingClientRect().left,0,t.options.slBarSize[0]-1),o=(0,E.limit)(a.clientY-e.getBoundingClientRect().top,0,t.options.slBarSize[1]-1),n=t.slBarHelper.grabColor(i,o);t.slPointer.style.left=i-7+"px",t.slPointer.style.top=o-7+"px",t.onValueChanged("RGB",n)},i=function e(){document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",e)};e.addEventListener("mousedown",function(e){a(e),document.addEventListener("mousemove",a),document.addEventListener("mouseup",i)})}},{key:"setupAlphaCanvas",value:function(e){var t=this;e.width=this.options.alphaBarSize[0],e.height=this.options.alphaBarSize[1];var a=e.getContext("2d"),i=a.createLinearGradient(0,0,e.width-1,0);i.addColorStop(0,"hsla(0, 0%, 50%, 0)"),i.addColorStop(1,"hsla(0, 0%, 50%, 1)"),a.fillStyle=i,a.fillRect(0,0,this.options.alphaBarSize[0],this.options.alphaBarSize[1]);var o=function(a){var i=(0,E.limit)(a.clientX-e.getBoundingClientRect().left,0,t.options.alphaBarSize[0]),o=+(i/t.options.alphaBarSize[0]).toFixed(2);t.alphaPointer.style.left=i-7+"px",t.onValueChanged("ALPHA",o)},n=function e(){document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",e)};e.addEventListener("mousedown",function(e){o(e),document.addEventListener("mousemove",o),document.addEventListener("mouseup",n)})}},{key:"setupInput",value:function(e){var t=this,a=+e.min,i=+e.max,o=e.getAttribute("nameref");e.hasAttribute("select-on-focus")&&e.addEventListener("focus",function(){e.select()}),"text"===e.type?e.addEventListener("change",function(){t.onValueChanged(o,e.value)}):((s||l)&&e.addEventListener("keydown",function(n){"Up"===n.key?(e.value=(0,E.limit)(+e.value+1,a,i),t.onValueChanged(o,e.value),n.returnValue=!1):"Down"===n.key&&(e.value=(0,E.limit)(+e.value-1,a,i),t.onValueChanged(o,e.value),n.returnValue=!1)}),e.addEventListener("change",function(){var n=+e.value;t.onValueChanged(o,(0,E.limit)(n,a,i))}))}},{key:"setupClipboard",value:function(e){var t=this;e.title="click to copy",e.addEventListener("click",function(){e.value=(0,E.parseColor)([t.R,t.G,t.B,t.A],"hexcss4"),e.select(),document.execCommand("copy")})}},{key:"setPalette",value:function(e){var t=this,a="auto"===this.options.useAlphaInPalette?this.options.showAlpha:this.options.useAlphaInPalette,i=null;switch(this.options.palette){case"PALETTE_MATERIAL_500":i=E.PALETTE_MATERIAL_500;break;case"PALETTE_MATERIAL_CHROME":i=E.PALETTE_MATERIAL_CHROME;break;default:i=(0,E.ensureArray)(this.options.palette)}if(this.options.paletteEditable||i.length>0){var o=function(a,i,o){var E=e.querySelector('.a-color-picker-palette-color[data-color="'+a+'"]')||document.createElement("div");E.className="a-color-picker-palette-color",E.style.backgroundColor=a,E.setAttribute("data-color",a),E.title=a,e.insertBefore(E,i),t.palette[a]=!0,o&&t.onPaletteColorAdd(a)},n=function(a,i){a?(e.removeChild(a),t.palette[a.getAttribute("data-color")]=!1,i&&t.onPaletteColorRemove(a.getAttribute("data-color"))):(e.querySelectorAll(".a-color-picker-palette-color[data-color]").forEach(function(t){e.removeChild(t)}),Object.keys(t.palette).forEach(function(e){t.palette[e]=!1}),i&&t.onPaletteColorRemove())};if(i.map(function(e){return(0,E.parseColor)(e,a?"rgbcss4":"hex")}).filter(function(e){return!!e}).forEach(function(e){return o(e)}),this.options.paletteEditable){var _=document.createElement("div");_.className="a-color-picker-palette-color a-color-picker-palette-add",_.innerHTML="+",e.appendChild(_),e.addEventListener("click",function(e){/a-color-picker-palette-add/.test(e.target.className)?e.shiftKey?n(null,!0):o(a?(0,E.parseColor)([t.R,t.G,t.B,t.A],"rgbcss4"):(0,E.rgbToHex)(t.R,t.G,t.B),e.target,!0):/a-color-picker-palette-color/.test(e.target.className)&&(e.shiftKey?n(e.target,!0):t.onValueChanged(A,e.target.getAttribute("data-color")))})}else e.addEventListener("click",function(e){/a-color-picker-palette-color/.test(e.target.className)&&t.onValueChanged(A,e.target.getAttribute("data-color"))})}else e.style.display="none"}},{key:"updatePalette",value:function(e){this.paletteRow.innerHTML="",this.palette={},this.paletteRow.parentElement||this.element.appendChild(this.paletteRow),this.options.palette=e,this.setPalette(this.paletteRow)}},{key:"onValueChanged",value:function(e,t){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{silent:!1};switch(e){case"H":this.H=t;var i=(0,E.hslToRgb)(this.H,this.S,this.L),n=o(i,3);this.R=n[0],this.G=n[1],this.B=n[2],this.slBarHelper.setHue(t),this.updatePointerH(this.H),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B);break;case"S":this.S=t;var _=(0,E.hslToRgb)(this.H,this.S,this.L),r=o(_,3);this.R=r[0],this.G=r[1],this.B=r[2],this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B);break;case"L":this.L=t;var T=(0,E.hslToRgb)(this.H,this.S,this.L),S=o(T,3);this.R=S[0],this.G=S[1],this.B=S[2],this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B);break;case"R":this.R=t;var s=(0,E.rgbToHsl)(this.R,this.G,this.B),l=o(s,3);this.H=l[0],this.S=l[1],this.L=l[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGBHEX(this.R,this.G,this.B);break;case"G":this.G=t;var I=(0,E.rgbToHsl)(this.R,this.G,this.B),d=o(I,3);this.H=d[0],this.S=d[1],this.L=d[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGBHEX(this.R,this.G,this.B);break;case"B":this.B=t;var N=(0,E.rgbToHsl)(this.R,this.G,this.B),R=o(N,3);this.H=R[0],this.S=R[1],this.L=R[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGBHEX(this.R,this.G,this.B);break;case"RGB":var c=o(t,3);this.R=c[0],this.G=c[1],this.B=c[2];var m=(0,E.rgbToHsl)(this.R,this.G,this.B),L=o(m,3);this.H=L[0],this.S=L[1],this.L=L[2],this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B);break;case O:var D=o(t,4);this.R=D[0],this.G=D[1],this.B=D[2],this.A=D[3];var C=(0,E.rgbToHsl)(this.R,this.G,this.B),p=o(C,3);this.H=p[0],this.S=p[1],this.L=p[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B),this.updatePointerA(this.A);break;case u:var h=o(t,4);this.H=h[0],this.S=h[1],this.L=h[2],this.A=h[3];var P=(0,E.hslToRgb)(this.H,this.S,this.L),B=o(P,3);this.R=B[0],this.G=B[1],this.B=B[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B),this.updatePointerA(this.A);break;case"RGBHEX":var f=(0,E.cssColorToRgb)(t)||[this.R,this.G,this.B],g=o(f,3);this.R=g[0],this.G=g[1],this.B=g[2];var v=(0,E.rgbToHsl)(this.R,this.G,this.B),M=o(v,3);this.H=M[0],this.S=M[1],this.L=M[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B);break;case A:var W=(0,E.parseColor)(t,"rgba")||[0,0,0,1],U=o(W,4);this.R=U[0],this.G=U[1],this.B=U[2],this.A=U[3];var G=(0,E.rgbToHsl)(this.R,this.G,this.B),y=o(G,3);this.H=y[0],this.S=y[1],this.L=y[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B),this.updatePointerA(this.A);break;case"ALPHA":this.A=t}1===this.A?this.preview.style.backgroundColor="rgb("+this.R+","+this.G+","+this.B+")":this.preview.style.backgroundColor="rgba("+this.R+","+this.G+","+this.B+","+this.A+")",a&&a.silent||this.onchange&&this.onchange(this.preview.style.backgroundColor)}},{key:"onPaletteColorAdd",value:function(e){this.oncoloradd&&this.oncoloradd(e)}},{key:"onPaletteColorRemove",value:function(e){this.oncolorremove&&this.oncolorremove(e)}},{key:"updateInputHSL",value:function(e,t,a){this.options.showHSL&&(this.inputH.value=e,this.inputS.value=t,this.inputL.value=a)}},{key:"updateInputRGB",value:function(e,t,a){this.options.showRGB&&(this.inputR.value=e,this.inputG.value=t,this.inputB.value=a)}},{key:"updateInputRGBHEX",value:function(e,t,a){this.options.showHEX&&(this.inputRGBHEX.value=(0,E.rgbToHex)(e,t,a))}},{key:"updatePointerH",value:function(e){var t=this.options.hueBarSize[0]*e/360;this.huePointer.style.left=t-7+"px"}},{key:"updatePointerSL",value:function(e,t,a){var i=(0,E.hslToRgb)(e,t,a),n=o(i,3),_=n[0],r=n[1],T=n[2],S=this.slBarHelper.findColor(_,r,T),s=o(S,2),l=s[0],I=s[1];l>=0&&(this.slPointer.style.left=l-7+"px",this.slPointer.style.top=I-7+"px")}},{key:"updatePointerA",value:function(e){if(this.options.showAlpha){var t=this.options.alphaBarSize[0]*e;this.alphaPointer.style.left=t-7+"px"}}}]),e})(),L=(function(){function e(t){T(this,e),this.name=t,this.listeners=[]}return i(e,[{key:"on",value:function(e){e&&this.listeners.push(e)}},{key:"off",value:function(e){this.listeners=e?this.listeners.filter(function(t){return t!==e}):[]}},{key:"emit",value:function(e,t){for(var a=this.listeners.slice(0),i=0;i1&&void 0!==arguments[1]&&arguments[1];a.onValueChanged(A,e,{silent:t})},get all(){if(n){var e=[a.R,a.G,a.B,a.A],t=a.A<1?"rgba("+a.R+","+a.G+","+a.B+","+a.A+")":E.rgbToHex.apply(void 0,e);(_=(0,E.parseColor)(e,_)).toString=function(){return t},n=!1}return Object.assign({},_)},get onchange(){return i.change&&i.change.listeners[0]},set onchange(e){this.off("change").on("change",e)},get oncoloradd(){return i.coloradd&&i.coloradd.listeners[0]},set oncoloradd(e){this.off("coloradd").on("coloradd",e)},get oncolorremove(){return i.colorremove&&i.colorremove.listeners[0]},set oncolorremove(e){this.off("colorremove").on("colorremove",e)},get palette(){return Object.keys(a.palette).filter(function(e){return a.palette[e]})},set palette(e){a.updatePalette(e)},show:function(){a.element.classList.remove("hidden")},hide:function(){a.element.classList.add("hidden")},toggle:function(){a.element.classList.toggle("hidden")},on:function(e,t){return e&&i[e]&&i[e].on(t),this},off:function(e,t){return e&&i[e]&&i[e].off(t),this},destroy:function(){i.change.off(),i.coloradd.off(),i.colorremove.off(),a.element.remove(),i=null,a=null}};return a.onchange=function(){for(var e=arguments.length,t=Array(e),a=0;astyle[data-source="a-color-picker"]')){var C=a(5).toString(),p=document.createElement("style");p.setAttribute("type","text/css"),p.setAttribute("data-source","a-color-picker"),p.innerHTML=C,document.querySelector("head").appendChild(p)}t.createPicker=D,t.from=function(e,t){var a=(function(e){return e?Array.isArray(e)?e:e instanceof HTMLElement?[e]:e instanceof NodeList?[].concat(S(e)):"string"==typeof e?[].concat(S(document.querySelectorAll(e))):e.jquery?e.get():[]:[]})(e).map(function(e,a){var i=D(e,t);return i.index=a,i});return a.on=function(e,t){return a.forEach(function(a){return a.on(e,t)}),this},a.off=function(e){return a.forEach(function(t){return t.off(e)}),this},a},t.parseColorToRgb=E.parseColorToRgb,t.parseColorToRgba=E.parseColorToRgba,t.parseColorToHsl=E.parseColorToHsl,t.parseColorToHsla=E.parseColorToHsla,t.parseColor=E.parseColor,t.rgbToHex=E.rgbToHex,t.hslToRgb=E.hslToRgb,t.rgbToHsl=E.rgbToHsl,t.rgbToHsv=E.rgbToHsv,t.rgbToInt=E.rgbToInt,t.intToRgb=E.intToRgb,t.getLuminance=E.getLuminance,t.COLOR_NAMES=E.COLOR_NAMES,t.PALETTE_MATERIAL_500=E.PALETTE_MATERIAL_500,t.PALETTE_MATERIAL_CHROME=E.PALETTE_MATERIAL_CHROME,t.VERSION="1.2.1"},function(e,t,a){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.nvl=t.ensureArray=t.limit=t.getLuminance=t.parseColor=t.parseColorToHsla=t.parseColorToHsl=t.cssHslaToHsla=t.cssHslToHsl=t.parseColorToRgba=t.parseColorToRgb=t.cssRgbaToRgba=t.cssRgbToRgb=t.cssColorToRgba=t.cssColorToRgb=t.intToRgb=t.rgbToInt=t.rgbToHsv=t.rgbToHsl=t.hslToRgb=t.rgbToHex=t.PALETTE_MATERIAL_CHROME=t.PALETTE_MATERIAL_500=t.COLOR_NAMES=void 0;var i=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return(function(e,t){var a=[],i=!0,o=!1,E=void 0;try{for(var n,_=e[Symbol.iterator]();!(i=(n=_.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){o=!0,E=e}finally{try{!i&&_.return&&_.return()}finally{if(o)throw E}}return a})(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=(function(e){return e&&e.__esModule?e:{default:e}})(a(0));function E(e){if(Array.isArray(e)){for(var t=0,a=Array(e.length);ta?a:e}function r(e,t){return null==e?t:e}function T(e,t,a){var i=[_(e,0,255),_(t,0,255),_(a,0,255)];return"#"+("000000"+((e=i[0])<<16|(t=i[1])<<8|(a=i[2])).toString(16)).slice(-6)}function S(e,t,a){var i=void 0,o=void 0,E=void 0,n=[_(e,0,360)/360,_(t,0,100)/100,_(a,0,100)/100];if(e=n[0],a=n[2],0==(t=n[1]))i=o=E=a;else{var r=function(e,t,a){return a<0&&(a+=1),a>1&&(a-=1),a<1/6?e+6*(t-e)*a:a<.5?t:a<2/3?e+(t-e)*(2/3-a)*6:e},T=a<.5?a*(1+t):a+t-a*t,S=2*a-T;i=r(S,T,e+1/3),o=r(S,T,e),E=r(S,T,e-1/3)}return[255*i,255*o,255*E].map(Math.round)}function s(e,t,a){var i=[_(e,0,255)/255,_(t,0,255)/255,_(a,0,255)/255];e=i[0],t=i[1],a=i[2];var o=Math.max(e,t,a),E=Math.min(e,t,a),n=void 0,r=void 0,T=(o+E)/2;if(o==E)n=r=0;else{var S=o-E;switch(r=T>.5?S/(2-o-E):S/(o+E),o){case e:n=(t-a)/S+(t>16&255,e>>8&255,255&e]},t.cssColorToRgb=I,t.cssColorToRgba=A,t.cssRgbToRgb=O,t.cssRgbaToRgba=u,t.parseColorToRgb=function(e){return Array.isArray(e)?e=[_(e[0],0,255),_(e[1],0,255),_(e[2],0,255)]:I(e)||O(e)},t.parseColorToRgba=d,t.cssHslToHsl=N,t.cssHslaToHsla=R,t.parseColorToHsl=function(e){return Array.isArray(e)?e=[_(e[0],0,360),_(e[1],0,100),_(e[2],0,100)]:N(e)},t.parseColorToHsla=c,t.parseColor=function(e,t){if(t=t||"rgb",null!=e){var a=void 0;if((a=d(e))||(a=c(e))&&(a=[].concat(E(S.apply(void 0,E(a))),[a[3]])))return(0,o.default)(t)?["rgb","rgbcss","rgbcss4","rgba","rgbacss","hsl","hslcss","hslcss4","hsla","hslacss","hex","hexcss4","int"].reduce(function(e,t){return e[t]=m(a,t),e},t||{}):m(a,t.toString().toLowerCase())}},t.getLuminance=function(e,t,a){return.2126*(e=(e/=255)<.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.7152*(t=(t/=255)<.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.0722*((a/=255)<.03928?a/12.92:Math.pow((a+.055)/1.055,2.4))},t.limit=_,t.ensureArray=function(e){return e?Array.from(e):[]},t.nvl=r},function(e,t,a){"use strict";e.exports=function(e){return null!=e&&"object"==typeof e&&!1===Array.isArray(e)}},function(e,t){e.exports='
'},function(e,t,a){var i=a(6);e.exports="string"==typeof i?i:i.toString()},function(e,t,a){(e.exports=a(7)(!1)).push([e.i,"/*!\n * a-color-picker\n * https://github.com/narsenico/a-color-picker\n *\n * Copyright (c) 2017-2018, Gianfranco Caldi.\n * Released under the MIT License.\n */.a-color-picker{background-color:#fff;padding:0;display:inline-flex;flex-direction:column;user-select:none;width:232px;font:400 10px Helvetica,Arial,sans-serif;border-radius:3px;box-shadow:0 0 0 1px rgba(0,0,0,.05),0 2px 4px rgba(0,0,0,.25)}.a-color-picker,.a-color-picker-row,.a-color-picker input{box-sizing:border-box}.a-color-picker-row{padding:15px;display:flex;flex-direction:row;align-items:center;justify-content:space-between;user-select:none}.a-color-picker-row-top{padding:0}.a-color-picker-row:not(:first-child){border-top:1px solid #f5f5f5}.a-color-picker-column{display:flex;flex-direction:column}.a-color-picker-cell{flex:1 1 auto;margin-bottom:4px}.a-color-picker-cell:last-child{margin-bottom:0}.a-color-picker-stack{position:relative}.a-color-picker-dot{position:absolute;width:14px;height:14px;top:0;left:0;background:#fff;pointer-events:none;border-radius:50px;z-index:1000;box-shadow:0 1px 2px rgba(0,0,0,.75)}.a-color-picker-a,.a-color-picker-h,.a-color-picker-sl{cursor:cell}.a-color-picker-a+.a-color-picker-dot,.a-color-picker-h+.a-color-picker-dot{top:-2px}.a-color-picker-a,.a-color-picker-h{border-radius:2px}.a-color-picker-preview{box-sizing:border-box;width:30px;height:30px;user-select:none;border-radius:15px}.a-color-picker-circle{border-radius:50px;border:1px solid #eee}.a-color-picker-hsl,.a-color-picker-rgb,.a-color-picker-single-input{justify-content:space-evenly}.a-color-picker-hsl>label,.a-color-picker-rgb>label,.a-color-picker-single-input>label{padding:0 8px;flex:0 0 auto;color:#969696}.a-color-picker-hsl>input,.a-color-picker-rgb>input,.a-color-picker-single-input>input{text-align:center;padding:2px 0;width:0;flex:1 1 auto;border:1px solid #e0e0e0;line-height:20px}.a-color-picker-hsl>input::-webkit-inner-spin-button,.a-color-picker-rgb>input::-webkit-inner-spin-button,.a-color-picker-single-input>input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.a-color-picker-hsl>input:focus,.a-color-picker-rgb>input:focus,.a-color-picker-single-input>input:focus{border-color:#04a9f4;outline:none}.a-color-picker-transparent{background-image:linear-gradient(-45deg,#cdcdcd 25%,transparent 0),linear-gradient(45deg,#cdcdcd 25%,transparent 0),linear-gradient(-45deg,transparent 75%,#cdcdcd 0),linear-gradient(45deg,transparent 75%,#cdcdcd 0);background-size:11px 11px;background-position:0 0,0 -5.5px,-5.5px 5.5px,5.5px 0}.a-color-picker-sl{border-radius:3px 3px 0 0}.a-color-picker.hide-alpha [show-on-alpha],.a-color-picker.hide-hsl [show-on-hsl],.a-color-picker.hide-rgb [show-on-rgb],.a-color-picker.hide-single-input [show-on-single-input]{display:none}.a-color-picker-clipbaord{width:100%;height:100%;opacity:0;cursor:pointer}.a-color-picker-palette{flex-flow:wrap;flex-direction:row;justify-content:flex-start;padding:10px}.a-color-picker-palette-color{width:15px;height:15px;flex:0 1 15px;margin:3px;box-sizing:border-box;cursor:pointer;border-radius:3px;box-shadow:inset 0 0 0 1px rgba(0,0,0,.1)}.a-color-picker-palette-add{text-align:center;line-height:13px;color:#607d8b}.a-color-picker.hidden{display:none}",""])},function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var a=(function(e,t){var a=e[1]||"",i=e[3];if(!i)return a;if(t&&"function"==typeof btoa){var o=(function(e){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(e))))+" */"})(i),E=i.sources.map(function(e){return"/*# sourceURL="+i.sourceRoot+e+" */"});return[a].concat(E).concat([o]).join("\n")}return[a].join("\n")})(t,e);return t[2]?"@media "+t[2]+"{"+a+"}":a}).join("")},t.i=function(e,a){"string"==typeof e&&(e=[[null,e,""]]);for(var i={},o=0;o{"use strict";t.byteLength=function(e){var t=_(e),a=t[0],i=t[1];return 3*(a+i)/4-i},t.toByteArray=function(e){var t,a,E=_(e),n=E[0],r=E[1],T=new o((function(e,t,a){return 3*(t+a)/4-a})(0,n,r)),S=0,s=r>0?n-4:n;for(a=0;a>16&255,T[S++]=t>>8&255,T[S++]=255&t;2===r&&(t=i[e.charCodeAt(a)]<<2|i[e.charCodeAt(a+1)]>>4,T[S++]=255&t);1===r&&(t=i[e.charCodeAt(a)]<<10|i[e.charCodeAt(a+1)]<<4|i[e.charCodeAt(a+2)]>>2,T[S++]=t>>8&255,T[S++]=255&t);return T},t.fromByteArray=function(e){for(var t,i=e.length,o=i%3,E=[],n=16383,_=0,r=i-o;_r?r:_+n));1===o?(t=e[i-1],E.push(a[t>>2]+a[t<<4&63]+"==")):2===o&&(t=(e[i-2]<<8)+e[i-1],E.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return E.join("")};for(var a=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,E="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=0;n<64;++n)a[n]=E[n],i[E.charCodeAt(n)]=n;function _(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var a=e.indexOf("=");return-1===a&&(a=t),[a,a===t?0:4-a%4]}function r(e){return a[e>>18&63]+a[e>>12&63]+a[e>>6&63]+a[63&e]}function T(e,t,a){for(var i,o=[],E=t;E{function t(e){return e.reduce((e,t,a,i)=>{const o=t.split("-").map(e=>parseInt(e));return e.concat(((e,t=e)=>Array.from({length:t-e+1},(t,a)=>a+e))(...o))},[])}e.exports=t,e.exports.parse=t,e.exports.compose=function(e){return e.reduce((e,t,a,i)=>(0!==a&&t===i[a-1]+1||e.push([]),e[e.length-1].push(t),e),[]).map(e=>e.length>1?`${e[0]}-${e[e.length-1]}`:`${e[0]}`)}},9856:function(e){e.exports=(function(e){var t={};function a(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,a),o.l=!0,o.exports}return a.m=e,a.c=t,a.d=function(e,t,i){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(a.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)a.d(i,o,function(t){return e[t]}.bind(null,o));return i},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=90)})({17:function(e,t,a){"use strict";t.__esModule=!0,t.default=void 0;var i=a(18),o=(function(){function e(){}return e.getFirstMatch=function(e,t){var a=t.match(e);return a&&a.length>0&&a[1]||""},e.getSecondMatch=function(e,t){var a=t.match(e);return a&&a.length>1&&a[2]||""},e.matchAndReturnConst=function(e,t,a){if(e.test(t))return a},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map(function(e){return parseInt(e,10)||0});if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map(function(e){return parseInt(e,10)||0});if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,a,i){void 0===i&&(i=!1);var o=e.getVersionPrecision(t),E=e.getVersionPrecision(a),n=Math.max(o,E),_=0,r=e.map([t,a],function(t){var a=n-e.getVersionPrecision(t),i=t+new Array(a+1).join(".0");return e.map(i.split("."),function(e){return new Array(20-e.length).join("0")+e}).reverse()});for(i&&(_=n-Math.min(o,E)),n-=1;n>=_;){if(r[0][n]>r[1][n])return 1;if(r[0][n]===r[1][n]){if(n===_)return 0;n-=1}else if(r[0][n]1?o-1:0),n=1;n0){var n=Object.keys(a),r=_.default.find(n,function(e){return t.isOS(e)});if(r){var T=this.satisfies(a[r]);if(void 0!==T)return T}var S=_.default.find(n,function(e){return t.isPlatform(e)});if(S){var s=this.satisfies(a[S]);if(void 0!==s)return s}}if(E>0){var l=Object.keys(o),I=_.default.find(l,function(e){return t.isBrowser(e,!0)});if(void 0!==I)return this.compareVersion(o[I])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var a=this.getBrowserName().toLowerCase(),i=e.toLowerCase(),o=_.default.getBrowserTypeByAlias(i);return t&&o&&(i=o.toLowerCase()),i===a},t.compareVersion=function(e){var t=[0],a=e,i=!1,o=this.getBrowserVersion();if("string"==typeof o)return">"===e[0]||"<"===e[0]?(a=e.substr(1),"="===e[1]?(i=!0,a=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?a=e.substr(1):"~"===e[0]&&(i=!0,a=e.substr(1)),t.indexOf(_.default.compareVersions(o,a,i))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some(function(e){return t.is(e)})},e})();t.default=T,e.exports=t.default},92:function(e,t,a){"use strict";t.__esModule=!0,t.default=void 0;var i,o=(i=a(17))&&i.__esModule?i:{default:i},E=/version\/(\d+(\.?_?\d+)+)/i,n=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},a=o.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||o.default.getFirstMatch(E,e);return a&&(t.version=a),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},a=o.default.getFirstMatch(E,e)||o.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},a=o.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||o.default.getFirstMatch(E,e);return a&&(t.version=a),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},a=o.default.getFirstMatch(E,e)||o.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},a=o.default.getFirstMatch(E,e)||o.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},a=o.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||o.default.getFirstMatch(E,e);return a&&(t.version=a),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},a=o.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||o.default.getFirstMatch(E,e);return a&&(t.version=a),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},a=o.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||o.default.getFirstMatch(E,e);return a&&(t.version=a),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},a=o.default.getFirstMatch(E,e)||o.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},a=o.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||o.default.getFirstMatch(E,e);return a&&(t.version=a),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},a=o.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||o.default.getFirstMatch(E,e);return a&&(t.version=a),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},a=o.default.getFirstMatch(E,e)||o.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},a=o.default.getFirstMatch(E,e)||o.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},a=o.default.getFirstMatch(E,e)||o.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},a=o.default.getFirstMatch(E,e)||o.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},a=o.default.getFirstMatch(E,e)||o.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},a=o.default.getFirstMatch(E,e)||o.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},a=o.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||o.default.getFirstMatch(E,e);return a&&(t.version=a),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},a=o.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||o.default.getFirstMatch(E,e);return a&&(t.version=a),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},a=o.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},a=o.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},a=o.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},a=o.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},a=o.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},a=o.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return a&&(t.version=a),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},a=o.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},a=o.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},a=o.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},a=o.default.getFirstMatch(E,e)||o.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},a=o.default.getFirstMatch(E,e)||o.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},a=o.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},a=o.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||o.default.getFirstMatch(E,e);return a&&(t.version=a),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},a=o.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||o.default.getFirstMatch(E,e);return a&&(t.version=a),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},a=o.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},a=o.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},a=o.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},a=o.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||o.default.getFirstMatch(E,e);return a&&(t.version=a),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},a=o.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},a=o.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:function(e){var t=!e.test(/like android/i),a=e.test(/android/i);return t&&a},describe:function(e){var t={name:"Android Browser"},a=o.default.getFirstMatch(E,e);return a&&(t.version=a),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},a=o.default.getFirstMatch(E,e);return a&&(t.version=a),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},a=o.default.getFirstMatch(E,e);return a&&(t.version=a),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:o.default.getFirstMatch(t,e),version:o.default.getSecondMatch(t,e)}}}];t.default=n,e.exports=t.default},93:function(e,t,a){"use strict";t.__esModule=!0,t.default=void 0;var i,o=(i=a(17))&&i.__esModule?i:{default:i},E=a(18),n=[{test:[/Roku\/DVP/],describe:function(e){var t=o.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:E.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=o.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:E.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=o.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),a=o.default.getWindowsVersionName(t);return{name:E.OS_MAP.Windows,version:t,versionName:a}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:E.OS_MAP.iOS},a=o.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return a&&(t.version=a),t}},{test:[/macintosh/i],describe:function(e){var t=o.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),a=o.default.getMacOSVersionName(t),i={name:E.OS_MAP.MacOS,version:t};return a&&(i.versionName=a),i}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=o.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:E.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),a=e.test(/android/i);return t&&a},describe:function(e){var t=o.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),a=o.default.getAndroidVersionName(t),i={name:E.OS_MAP.Android,version:t};return a&&(i.versionName=a),i}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=o.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),a={name:E.OS_MAP.WebOS};return t&&t.length&&(a.version=t),a}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=o.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||o.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||o.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:E.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=o.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:E.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=o.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:E.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:E.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:E.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=o.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:E.OS_MAP.PlayStation4,version:t}}}];t.default=n,e.exports=t.default},94:function(e,t,a){"use strict";t.__esModule=!0,t.default=void 0;var i,o=(i=a(17))&&i.__esModule?i:{default:i},E=a(18),n=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=o.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",a={type:E.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(a.model=t),a}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:E.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:E.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:E.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:E.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:E.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:E.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),a=e.test(/like (ipod|iphone)/i);return t&&!a},describe:function(e){var t=o.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:E.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:E.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:E.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:E.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:E.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:E.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:E.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:E.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:E.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:E.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:E.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:E.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:E.PLATFORMS_MAP.tv}}}];t.default=n,e.exports=t.default},95:function(e,t,a){"use strict";t.__esModule=!0,t.default=void 0;var i,o=(i=a(17))&&i.__esModule?i:{default:i},E=a(18),n=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:E.ENGINE_MAP.Blink};var t=o.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:E.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:E.ENGINE_MAP.Trident},a=o.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:E.ENGINE_MAP.Presto},a=o.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:function(e){var t=e.test(/gecko/i),a=e.test(/like gecko/i);return t&&!a},describe:function(e){var t={name:E.ENGINE_MAP.Gecko},a=o.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:E.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:E.ENGINE_MAP.WebKit},a=o.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}}];t.default=n,e.exports=t.default}})},84686:(e,t,a)=>{"use strict";const i=a(35350),o=a(77947),E="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.hp=r,t.IS=50;const n=2147483647;function _(e){if(e>n)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,r.prototype),t}function r(e,t,a){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return s(e)}return T(e,t,a)}function T(e,t,a){if("string"==typeof e)return(function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!r.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const a=0|O(e,t);let i=_(a);const o=i.write(e,t);o!==a&&(i=i.slice(0,o));return i})(e,t);if(ArrayBuffer.isView(e))return(function(e){if(X(e,Uint8Array)){const t=new Uint8Array(e);return I(t.buffer,t.byteOffset,t.byteLength)}return l(e)})(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(X(e,ArrayBuffer)||e&&X(e.buffer,ArrayBuffer))return I(e,t,a);if("undefined"!=typeof SharedArrayBuffer&&(X(e,SharedArrayBuffer)||e&&X(e.buffer,SharedArrayBuffer)))return I(e,t,a);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const i=e.valueOf&&e.valueOf();if(null!=i&&i!==e)return r.from(i,t,a);const o=(function(e){if(r.isBuffer(e)){const t=0|A(e.length),a=_(t);return 0===a.length||e.copy(a,0,0,t),a}if(void 0!==e.length)return"number"!=typeof e.length||$(e.length)?_(0):l(e);if("Buffer"===e.type&&Array.isArray(e.data))return l(e.data)})(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return r.from(e[Symbol.toPrimitive]("string"),t,a);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function S(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function s(e){return S(e),_(e<0?0:0|A(e))}function l(e){const t=e.length<0?0:0|A(e.length),a=_(t);for(let i=0;i=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return 0|e}function O(e,t){if(r.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||X(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const a=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===a)return 0;let o=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return a;case"utf8":case"utf-8":return j(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*a;case"hex":return a>>>1;case"base64":return x(e).length;default:if(o)return i?-1:j(e).length;t=(""+t).toLowerCase(),o=!0}}function u(e,t,a){let i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===a||a>this.length)&&(a=this.length),a<=0)return"";if((a>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return g(this,t,a);case"utf8":case"utf-8":return h(this,t,a);case"ascii":return B(this,t,a);case"latin1":case"binary":return f(this,t,a);case"base64":return p(this,t,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return v(this,t,a);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function d(e,t,a){const i=e[t];e[t]=e[a],e[a]=i}function N(e,t,a,i,o){if(0===e.length)return-1;if("string"==typeof a?(i=a,a=0):a>2147483647?a=2147483647:a<-2147483648&&(a=-2147483648),$(a=+a)&&(a=o?0:e.length-1),a<0&&(a=e.length+a),a>=e.length){if(o)return-1;a=e.length-1}else if(a<0){if(!o)return-1;a=0}if("string"==typeof t&&(t=r.from(t,i)),r.isBuffer(t))return 0===t.length?-1:R(e,t,a,i,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,a):Uint8Array.prototype.lastIndexOf.call(e,t,a):R(e,[t],a,i,o);throw new TypeError("val must be string, number or Buffer")}function R(e,t,a,i,o){let E,n=1,_=e.length,r=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;n=2,_/=2,r/=2,a/=2}function T(e,t){return 1===n?e[t]:e.readUInt16BE(t*n)}if(o){let i=-1;for(E=a;E<_;E++)if(T(e,E)===T(t,-1===i?0:E-i)){if(-1===i&&(i=E),E-i+1===r)return i*n}else-1!==i&&(E-=E-i),i=-1}else for(a+r>_&&(a=_-r),E=a;E>=0;E--){let a=!0;for(let i=0;io&&(i=o):i=o;const E=t.length;let n;for(i>E/2&&(i=E/2),n=0;n>8,o=a%256,E.push(o),E.push(i);return E})(t,e.length-a),e,a,i)}function p(e,t,a){return 0===t&&a===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,a))}function h(e,t,a){a=Math.min(e.length,a);const i=[];let o=t;for(;o239?4:t>223?3:t>191?2:1;if(o+n<=a){let a,i,_,r;switch(n){case 1:t<128&&(E=t);break;case 2:a=e[o+1],128==(192&a)&&(r=(31&t)<<6|63&a,r>127&&(E=r));break;case 3:a=e[o+1],i=e[o+2],128==(192&a)&&128==(192&i)&&(r=(15&t)<<12|(63&a)<<6|63&i,r>2047&&(r<55296||r>57343)&&(E=r));break;case 4:a=e[o+1],i=e[o+2],_=e[o+3],128==(192&a)&&128==(192&i)&&128==(192&_)&&(r=(15&t)<<18|(63&a)<<12|(63&i)<<6|63&_,r>65535&&r<1114112&&(E=r))}}null===E?(E=65533,n=1):E>65535&&(E-=65536,i.push(E>>>10&1023|55296),E=56320|1023&E),i.push(E),o+=n}return(function(e){const t=e.length;if(t<=P)return String.fromCharCode.apply(String,e);let a="",i=0;for(;ii.length?(r.isBuffer(t)||(t=r.from(t)),t.copy(i,o)):Uint8Array.prototype.set.call(i,t,o);else{if(!r.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(i,o)}o+=t.length}return i},r.byteLength=O,r.prototype._isBuffer=!0,r.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;ta&&(e+=" ... "),""},E&&(r.prototype[E]=r.prototype.inspect),r.prototype.compare=function(e,t,a,i,o){if(X(e,Uint8Array)&&(e=r.from(e,e.offset,e.byteLength)),!r.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===a&&(a=e?e.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),t<0||a>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&t>=a)return 0;if(i>=o)return-1;if(t>=a)return 1;if(this===e)return 0;let E=(o>>>=0)-(i>>>=0),n=(a>>>=0)-(t>>>=0);const _=Math.min(E,n),T=this.slice(i,o),S=e.slice(t,a);for(let e=0;e<_;++e)if(T[e]!==S[e]){E=T[e],n=S[e];break}return E>>=0,isFinite(a)?(a>>>=0,void 0===i&&(i="utf8")):(i=a,a=void 0)}const o=this.length-t;if((void 0===a||a>o)&&(a=o),e.length>0&&(a<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let E=!1;for(;;)switch(i){case"hex":return c(this,e,t,a);case"utf8":case"utf-8":return m(this,e,t,a);case"ascii":case"latin1":case"binary":return L(this,e,t,a);case"base64":return D(this,e,t,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,t,a);default:if(E)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),E=!0}},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const P=4096;function B(e,t,a){let i="";a=Math.min(e.length,a);for(let o=t;oi)&&(a=i);let o="";for(let i=t;ia)throw new RangeError("Trying to access beyond buffer length")}function W(e,t,a,i,o,E){if(!r.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function U(e,t,a,i,o){Y(t,i,o,e,a,7);let E=Number(t&BigInt(4294967295));e[a++]=E,E>>=8,e[a++]=E,E>>=8,e[a++]=E,E>>=8,e[a++]=E;let n=Number(t>>BigInt(32)&BigInt(4294967295));return e[a++]=n,n>>=8,e[a++]=n,n>>=8,e[a++]=n,n>>=8,e[a++]=n,a}function G(e,t,a,i,o){Y(t,i,o,e,a,7);let E=Number(t&BigInt(4294967295));e[a+7]=E,E>>=8,e[a+6]=E,E>>=8,e[a+5]=E,E>>=8,e[a+4]=E;let n=Number(t>>BigInt(32)&BigInt(4294967295));return e[a+3]=n,n>>=8,e[a+2]=n,n>>=8,e[a+1]=n,n>>=8,e[a]=n,a+8}function y(e,t,a,i,o,E){if(a+i>e.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("Index out of range")}function b(e,t,a,i,E){return t=+t,a>>>=0,E||y(e,0,a,4),o.write(e,t,a,i,23,4),a+4}function k(e,t,a,i,E){return t=+t,a>>>=0,E||y(e,0,a,8),o.write(e,t,a,i,52,8),a+8}r.prototype.slice=function(e,t){const a=this.length;(e=~~e)<0?(e+=a)<0&&(e=0):e>a&&(e=a),(t=void 0===t?a:~~t)<0?(t+=a)<0&&(t=0):t>a&&(t=a),t>>=0,t>>>=0,a||M(e,t,this.length);let i=this[e],o=1,E=0;for(;++E>>=0,t>>>=0,a||M(e,t,this.length);let i=this[e+--t],o=1;for(;t>0&&(o*=256);)i+=this[e+--t]*o;return i},r.prototype.readUint8=r.prototype.readUInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),this[e]},r.prototype.readUint16LE=r.prototype.readUInt16LE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]|this[e+1]<<8},r.prototype.readUint16BE=r.prototype.readUInt16BE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]<<8|this[e+1]},r.prototype.readUint32LE=r.prototype.readUInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},r.prototype.readUint32BE=r.prototype.readUInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},r.prototype.readBigUInt64LE=J(function(e){w(e>>>=0,"offset");const t=this[e],a=this[e+7];void 0!==t&&void 0!==a||z(e,this.length-8);const i=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,o=this[++e]+256*this[++e]+65536*this[++e]+a*2**24;return BigInt(i)+(BigInt(o)<>>=0,"offset");const t=this[e],a=this[e+7];void 0!==t&&void 0!==a||z(e,this.length-8);const i=t*2**24+65536*this[++e]+256*this[++e]+this[++e],o=this[++e]*2**24+65536*this[++e]+256*this[++e]+a;return(BigInt(i)<>>=0,t>>>=0,a||M(e,t,this.length);let i=this[e],o=1,E=0;for(;++E=o&&(i-=Math.pow(2,8*t)),i},r.prototype.readIntBE=function(e,t,a){e>>>=0,t>>>=0,a||M(e,t,this.length);let i=t,o=1,E=this[e+--i];for(;i>0&&(o*=256);)E+=this[e+--i]*o;return o*=128,E>=o&&(E-=Math.pow(2,8*t)),E},r.prototype.readInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},r.prototype.readInt16LE=function(e,t){e>>>=0,t||M(e,2,this.length);const a=this[e]|this[e+1]<<8;return 32768&a?4294901760|a:a},r.prototype.readInt16BE=function(e,t){e>>>=0,t||M(e,2,this.length);const a=this[e+1]|this[e]<<8;return 32768&a?4294901760|a:a},r.prototype.readInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},r.prototype.readInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},r.prototype.readBigInt64LE=J(function(e){w(e>>>=0,"offset");const t=this[e],a=this[e+7];void 0!==t&&void 0!==a||z(e,this.length-8);const i=this[e+4]+256*this[e+5]+65536*this[e+6]+(a<<24);return(BigInt(i)<>>=0,"offset");const t=this[e],a=this[e+7];void 0!==t&&void 0!==a||z(e,this.length-8);const i=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(i)<>>=0,t||M(e,4,this.length),o.read(this,e,!0,23,4)},r.prototype.readFloatBE=function(e,t){return e>>>=0,t||M(e,4,this.length),o.read(this,e,!1,23,4)},r.prototype.readDoubleLE=function(e,t){return e>>>=0,t||M(e,8,this.length),o.read(this,e,!0,52,8)},r.prototype.readDoubleBE=function(e,t){return e>>>=0,t||M(e,8,this.length),o.read(this,e,!1,52,8)},r.prototype.writeUintLE=r.prototype.writeUIntLE=function(e,t,a,i){if(e=+e,t>>>=0,a>>>=0,!i){W(this,e,t,a,Math.pow(2,8*a)-1,0)}let o=1,E=0;for(this[t]=255&e;++E>>=0,a>>>=0,!i){W(this,e,t,a,Math.pow(2,8*a)-1,0)}let o=a-1,E=1;for(this[t+o]=255&e;--o>=0&&(E*=256);)this[t+o]=e/E&255;return t+a},r.prototype.writeUint8=r.prototype.writeUInt8=function(e,t,a){return e=+e,t>>>=0,a||W(this,e,t,1,255,0),this[t]=255&e,t+1},r.prototype.writeUint16LE=r.prototype.writeUInt16LE=function(e,t,a){return e=+e,t>>>=0,a||W(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},r.prototype.writeUint16BE=r.prototype.writeUInt16BE=function(e,t,a){return e=+e,t>>>=0,a||W(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},r.prototype.writeUint32LE=r.prototype.writeUInt32LE=function(e,t,a){return e=+e,t>>>=0,a||W(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},r.prototype.writeUint32BE=r.prototype.writeUInt32BE=function(e,t,a){return e=+e,t>>>=0,a||W(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},r.prototype.writeBigUInt64LE=J(function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),r.prototype.writeBigUInt64BE=J(function(e,t=0){return G(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),r.prototype.writeIntLE=function(e,t,a,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*a-1);W(this,e,t,a,i-1,-i)}let o=0,E=1,n=0;for(this[t]=255&e;++o>>=0,!i){const i=Math.pow(2,8*a-1);W(this,e,t,a,i-1,-i)}let o=a-1,E=1,n=0;for(this[t+o]=255&e;--o>=0&&(E*=256);)e<0&&0===n&&0!==this[t+o+1]&&(n=1),this[t+o]=(e/E|0)-n&255;return t+a},r.prototype.writeInt8=function(e,t,a){return e=+e,t>>>=0,a||W(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},r.prototype.writeInt16LE=function(e,t,a){return e=+e,t>>>=0,a||W(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},r.prototype.writeInt16BE=function(e,t,a){return e=+e,t>>>=0,a||W(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},r.prototype.writeInt32LE=function(e,t,a){return e=+e,t>>>=0,a||W(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},r.prototype.writeInt32BE=function(e,t,a){return e=+e,t>>>=0,a||W(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},r.prototype.writeBigInt64LE=J(function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),r.prototype.writeBigInt64BE=J(function(e,t=0){return G(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),r.prototype.writeFloatLE=function(e,t,a){return b(this,e,t,!0,a)},r.prototype.writeFloatBE=function(e,t,a){return b(this,e,t,!1,a)},r.prototype.writeDoubleLE=function(e,t,a){return k(this,e,t,!0,a)},r.prototype.writeDoubleBE=function(e,t,a){return k(this,e,t,!1,a)},r.prototype.copy=function(e,t,a,i){if(!r.isBuffer(e))throw new TypeError("argument should be a Buffer");if(a||(a=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t>>=0,a=void 0===a?this.length:a>>>0,e||(e=0),"number"==typeof e)for(o=t;o=i+4;a-=3)t=`_${e.slice(a-3,a)}${t}`;return`${e.slice(0,a)}${t}`}function Y(e,t,a,i,o,E){if(e>a||e3?0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(E+1)}${i}`:`>= -(2${i} ** ${8*(E+1)-1}${i}) and < 2 ** ${8*(E+1)-1}${i}`:`>= ${t}${i} and <= ${a}${i}`,new F.ERR_OUT_OF_RANGE("value",o,e)}!(function(e,t,a){w(t,"offset"),void 0!==e[t]&&void 0!==e[t+a]||z(t,e.length-(a+1))})(i,o,E)}function w(e,t){if("number"!=typeof e)throw new F.ERR_INVALID_ARG_TYPE(t,"number",e)}function z(e,t,a){if(Math.floor(e)!==e)throw w(e,a),new F.ERR_OUT_OF_RANGE(a||"offset","an integer",e);if(t<0)throw new F.ERR_BUFFER_OUT_OF_BOUNDS;throw new F.ERR_OUT_OF_RANGE(a||"offset",`>= ${a?1:0} and <= ${t}`,e)}V("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),V("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),V("ERR_OUT_OF_RANGE",function(e,t,a){let i=`The value of "${e}" is out of range.`,o=a;return Number.isInteger(a)&&Math.abs(a)>2**32?o=H(String(a)):"bigint"==typeof a&&(o=String(a),(a>BigInt(2)**BigInt(32)||a<-(BigInt(2)**BigInt(32)))&&(o=H(o)),o+="n"),i+=` It must be ${t}. Received ${o}`,i},RangeError);const K=/[^+/0-9A-Za-z-_]/g;function j(e,t){let a;t=t||1/0;const i=e.length;let o=null;const E=[];for(let n=0;n55295&&a<57344){if(!o){if(a>56319){(t-=3)>-1&&E.push(239,191,189);continue}if(n+1===i){(t-=3)>-1&&E.push(239,191,189);continue}o=a;continue}if(a<56320){(t-=3)>-1&&E.push(239,191,189),o=a;continue}a=65536+(o-55296<<10|a-56320)}else o&&(t-=3)>-1&&E.push(239,191,189);if(o=null,a<128){if((t-=1)<0)break;E.push(a)}else if(a<2048){if((t-=2)<0)break;E.push(a>>6|192,63&a|128)}else if(a<65536){if((t-=3)<0)break;E.push(a>>12|224,a>>6&63|128,63&a|128)}else{if(!(a<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;E.push(a>>18|240,a>>12&63|128,a>>6&63|128,63&a|128)}}return E}function x(e){return i.toByteArray((function(e){if((e=(e=e.split("=")[0]).trim().replace(K,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e})(e))}function Q(e,t,a,i){let o;for(o=0;o=t.length||o>=e.length);++o)t[o+a]=e[o];return o}function X(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function $(e){return e!=e}const q=(function(){const e="0123456789abcdef",t=new Array(256);for(let a=0;a<16;++a){const i=16*a;for(let o=0;o<16;++o)t[i+o]=e[a]+e[o]}return t})();function J(e){return"undefined"==typeof BigInt?Z:e}function Z(){throw new Error("BigInt not supported")}},75674:(e,t,a)=>{"use strict";var i=a(13583),o=a(81948),E=a(32878),n=a(20741);e.exports=n||i.call(E,o)},81948:e=>{"use strict";e.exports=Function.prototype.apply},32878:e=>{"use strict";e.exports=Function.prototype.call},45312:(e,t,a)=>{"use strict";var i=a(13583),o=a(57379),E=a(32878),n=a(75674);e.exports=function(e){if(e.length<1||"function"!=typeof e[0])throw new o("a function is required");return n(i,E,e)}},20741:e=>{"use strict";e.exports="undefined"!=typeof Reflect&&Reflect&&Reflect.apply},15298:(e,t,a)=>{"use strict";var i=a(40703),o=a(45312),E=o([i("%String.prototype.indexOf%")]);e.exports=function(e,t){var a=i(e,!!t);return"function"==typeof a&&E(e,".prototype.")>-1?o([a]):a}},52165:(e,t,a)=>{const i=a(14877),o={};for(const e of Object.keys(i))o[i[e]]=e;const E={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};e.exports=E;for(const e of Object.keys(E)){if(!("channels"in E[e]))throw new Error("missing channels property: "+e);if(!("labels"in E[e]))throw new Error("missing channel labels property: "+e);if(E[e].labels.length!==E[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:t,labels:a}=E[e];delete E[e].channels,delete E[e].labels,Object.defineProperty(E[e],"channels",{value:t}),Object.defineProperty(E[e],"labels",{value:a})}function n(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}E.rgb.hsl=function(e){const t=e[0]/255,a=e[1]/255,i=e[2]/255,o=Math.min(t,a,i),E=Math.max(t,a,i),n=E-o;let _,r;E===o?_=0:t===E?_=(a-i)/n:a===E?_=2+(i-t)/n:i===E&&(_=4+(t-a)/n),_=Math.min(60*_,360),_<0&&(_+=360);const T=(o+E)/2;return r=E===o?0:T<=.5?n/(E+o):n/(2-E-o),[_,100*r,100*T]},E.rgb.hsv=function(e){let t,a,i,o,E;const n=e[0]/255,_=e[1]/255,r=e[2]/255,T=Math.max(n,_,r),S=T-Math.min(n,_,r),s=function(e){return(T-e)/6/S+.5};return 0===S?(o=0,E=0):(E=S/T,t=s(n),a=s(_),i=s(r),n===T?o=i-a:_===T?o=1/3+t-i:r===T&&(o=2/3+a-t),o<0?o+=1:o>1&&(o-=1)),[360*o,100*E,100*T]},E.rgb.hwb=function(e){const t=e[0],a=e[1];let i=e[2];const o=E.rgb.hsl(e)[0],n=1/255*Math.min(t,Math.min(a,i));return i=1-1/255*Math.max(t,Math.max(a,i)),[o,100*n,100*i]},E.rgb.cmyk=function(e){const t=e[0]/255,a=e[1]/255,i=e[2]/255,o=Math.min(1-t,1-a,1-i);return[100*((1-t-o)/(1-o)||0),100*((1-a-o)/(1-o)||0),100*((1-i-o)/(1-o)||0),100*o]},E.rgb.keyword=function(e){const t=o[e];if(t)return t;let a,E=1/0;for(const t of Object.keys(i)){const o=n(e,i[t]);o.04045?((t+.055)/1.055)**2.4:t/12.92,a=a>.04045?((a+.055)/1.055)**2.4:a/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92;return[100*(.4124*t+.3576*a+.1805*i),100*(.2126*t+.7152*a+.0722*i),100*(.0193*t+.1192*a+.9505*i)]},E.rgb.lab=function(e){const t=E.rgb.xyz(e);let a=t[0],i=t[1],o=t[2];a/=95.047,i/=100,o/=108.883,a=a>.008856?a**(1/3):7.787*a+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,o=o>.008856?o**(1/3):7.787*o+16/116;return[116*i-16,500*(a-i),200*(i-o)]},E.hsl.rgb=function(e){const t=e[0]/360,a=e[1]/100,i=e[2]/100;let o,E,n;if(0===a)return n=255*i,[n,n,n];o=i<.5?i*(1+a):i+a-i*a;const _=2*i-o,r=[0,0,0];for(let e=0;e<3;e++)E=t+1/3*-(e-1),E<0&&E++,E>1&&E--,n=6*E<1?_+6*(o-_)*E:2*E<1?o:3*E<2?_+(o-_)*(2/3-E)*6:_,r[e]=255*n;return r},E.hsl.hsv=function(e){const t=e[0];let a=e[1]/100,i=e[2]/100,o=a;const E=Math.max(i,.01);i*=2,a*=i<=1?i:2-i,o*=E<=1?E:2-E;return[t,100*(0===i?2*o/(E+o):2*a/(i+a)),100*((i+a)/2)]},E.hsv.rgb=function(e){const t=e[0]/60,a=e[1]/100;let i=e[2]/100;const o=Math.floor(t)%6,E=t-Math.floor(t),n=255*i*(1-a),_=255*i*(1-a*E),r=255*i*(1-a*(1-E));switch(i*=255,o){case 0:return[i,r,n];case 1:return[_,i,n];case 2:return[n,i,r];case 3:return[n,_,i];case 4:return[r,n,i];case 5:return[i,n,_]}},E.hsv.hsl=function(e){const t=e[0],a=e[1]/100,i=e[2]/100,o=Math.max(i,.01);let E,n;n=(2-a)*i;const _=(2-a)*o;return E=a*o,E/=_<=1?_:2-_,E=E||0,n/=2,[t,100*E,100*n]},E.hwb.rgb=function(e){const t=e[0]/360;let a=e[1]/100,i=e[2]/100;const o=a+i;let E;o>1&&(a/=o,i/=o);const n=Math.floor(6*t),_=1-i;E=6*t-n,1&n&&(E=1-E);const r=a+E*(_-a);let T,S,s;switch(n){default:case 6:case 0:T=_,S=r,s=a;break;case 1:T=r,S=_,s=a;break;case 2:T=a,S=_,s=r;break;case 3:T=a,S=r,s=_;break;case 4:T=r,S=a,s=_;break;case 5:T=_,S=a,s=r}return[255*T,255*S,255*s]},E.cmyk.rgb=function(e){const t=e[0]/100,a=e[1]/100,i=e[2]/100,o=e[3]/100;return[255*(1-Math.min(1,t*(1-o)+o)),255*(1-Math.min(1,a*(1-o)+o)),255*(1-Math.min(1,i*(1-o)+o))]},E.xyz.rgb=function(e){const t=e[0]/100,a=e[1]/100,i=e[2]/100;let o,E,n;return o=3.2406*t+-1.5372*a+-.4986*i,E=-.9689*t+1.8758*a+.0415*i,n=.0557*t+-.204*a+1.057*i,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,E=E>.0031308?1.055*E**(1/2.4)-.055:12.92*E,n=n>.0031308?1.055*n**(1/2.4)-.055:12.92*n,o=Math.min(Math.max(0,o),1),E=Math.min(Math.max(0,E),1),n=Math.min(Math.max(0,n),1),[255*o,255*E,255*n]},E.xyz.lab=function(e){let t=e[0],a=e[1],i=e[2];t/=95.047,a/=100,i/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,a=a>.008856?a**(1/3):7.787*a+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;return[116*a-16,500*(t-a),200*(a-i)]},E.lab.xyz=function(e){let t,a,i;a=(e[0]+16)/116,t=e[1]/500+a,i=a-e[2]/200;const o=a**3,E=t**3,n=i**3;return a=o>.008856?o:(a-16/116)/7.787,t=E>.008856?E:(t-16/116)/7.787,i=n>.008856?n:(i-16/116)/7.787,t*=95.047,a*=100,i*=108.883,[t,a,i]},E.lab.lch=function(e){const t=e[0],a=e[1],i=e[2];let o;o=360*Math.atan2(i,a)/2/Math.PI,o<0&&(o+=360);return[t,Math.sqrt(a*a+i*i),o]},E.lch.lab=function(e){const t=e[0],a=e[1],i=e[2]/360*2*Math.PI;return[t,a*Math.cos(i),a*Math.sin(i)]},E.rgb.ansi16=function(e,t=null){const[a,i,o]=e;let n=null===t?E.rgb.hsv(e)[2]:t;if(n=Math.round(n/50),0===n)return 30;let _=30+(Math.round(o/255)<<2|Math.round(i/255)<<1|Math.round(a/255));return 2===n&&(_+=60),_},E.hsv.ansi16=function(e){return E.rgb.ansi16(E.hsv.rgb(e),e[2])},E.rgb.ansi256=function(e){const t=e[0],a=e[1],i=e[2];if(t===a&&a===i)return t<8?16:t>248?231:Math.round((t-8)/247*24)+232;return 16+36*Math.round(t/255*5)+6*Math.round(a/255*5)+Math.round(i/255*5)},E.ansi16.rgb=function(e){let t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];const a=.5*(1+~~(e>50));return[(1&t)*a*255,(t>>1&1)*a*255,(t>>2&1)*a*255]},E.ansi256.rgb=function(e){if(e>=232){const t=10*(e-232)+8;return[t,t,t]}let t;e-=16;return[Math.floor(e/36)/5*255,Math.floor((t=e%36)/6)/5*255,t%6/5*255]},E.rgb.hex=function(e){const t=(((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},E.hex.rgb=function(e){const t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let a=t[0];3===t[0].length&&(a=a.split("").map(e=>e+e).join(""));const i=parseInt(a,16);return[i>>16&255,i>>8&255,255&i]},E.rgb.hcg=function(e){const t=e[0]/255,a=e[1]/255,i=e[2]/255,o=Math.max(Math.max(t,a),i),E=Math.min(Math.min(t,a),i),n=o-E;let _,r;return _=n<1?E/(1-n):0,r=n<=0?0:o===t?(a-i)/n%6:o===a?2+(i-t)/n:4+(t-a)/n,r/=6,r%=1,[360*r,100*n,100*_]},E.hsl.hcg=function(e){const t=e[1]/100,a=e[2]/100,i=a<.5?2*t*a:2*t*(1-a);let o=0;return i<1&&(o=(a-.5*i)/(1-i)),[e[0],100*i,100*o]},E.hsv.hcg=function(e){const t=e[1]/100,a=e[2]/100,i=t*a;let o=0;return i<1&&(o=(a-i)/(1-i)),[e[0],100*i,100*o]},E.hcg.rgb=function(e){const t=e[0]/360,a=e[1]/100,i=e[2]/100;if(0===a)return[255*i,255*i,255*i];const o=[0,0,0],E=t%1*6,n=E%1,_=1-n;let r=0;switch(Math.floor(E)){case 0:o[0]=1,o[1]=n,o[2]=0;break;case 1:o[0]=_,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=n;break;case 3:o[0]=0,o[1]=_,o[2]=1;break;case 4:o[0]=n,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=_}return r=(1-a)*i,[255*(a*o[0]+r),255*(a*o[1]+r),255*(a*o[2]+r)]},E.hcg.hsv=function(e){const t=e[1]/100,a=t+e[2]/100*(1-t);let i=0;return a>0&&(i=t/a),[e[0],100*i,100*a]},E.hcg.hsl=function(e){const t=e[1]/100,a=e[2]/100*(1-t)+.5*t;let i=0;return a>0&&a<.5?i=t/(2*a):a>=.5&&a<1&&(i=t/(2*(1-a))),[e[0],100*i,100*a]},E.hcg.hwb=function(e){const t=e[1]/100,a=t+e[2]/100*(1-t);return[e[0],100*(a-t),100*(1-a)]},E.hwb.hcg=function(e){const t=e[1]/100,a=1-e[2]/100,i=a-t;let o=0;return i<1&&(o=(a-i)/(1-i)),[e[0],100*i,100*o]},E.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},E.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},E.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},E.gray.hsl=function(e){return[0,0,e[0]]},E.gray.hsv=E.gray.hsl,E.gray.hwb=function(e){return[0,100,e[0]]},E.gray.cmyk=function(e){return[0,0,0,e[0]]},E.gray.lab=function(e){return[e[0],0,0]},E.gray.hex=function(e){const t=255&Math.round(e[0]/100*255),a=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(a.length)+a},E.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]}},61880:(e,t,a)=>{const i=a(52165),o=a(985),E={};Object.keys(i).forEach(e=>{E[e]={},Object.defineProperty(E[e],"channels",{value:i[e].channels}),Object.defineProperty(E[e],"labels",{value:i[e].labels});const t=o(e);Object.keys(t).forEach(a=>{const i=t[a];E[e][a]=(function(e){const t=function(...t){const a=t[0];if(null==a)return a;a.length>1&&(t=a);const i=e(t);if("object"==typeof i)for(let e=i.length,t=0;t1&&(t=a),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t})(i)})}),e.exports=E},985:(e,t,a)=>{const i=a(52165);function o(e){const t=(function(){const e={},t=Object.keys(i);for(let a=t.length,i=0;i{"use strict";e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},66138:(e,t,a)=>{var i=a(14877),o=a(83403),E=Object.hasOwnProperty,n=Object.create(null);for(var _ in i)E.call(i,_)&&(n[i[_]]=_);var r=e.exports={to:{},get:{}};function T(e,t,a){return Math.min(Math.max(t,e),a)}function S(e){var t=Math.round(e).toString(16).toUpperCase();return t.length<2?"0"+t:t}r.get=function(e){var t,a;switch(e.substring(0,3).toLowerCase()){case"hsl":t=r.get.hsl(e),a="hsl";break;case"hwb":t=r.get.hwb(e),a="hwb";break;default:t=r.get.rgb(e),a="rgb"}return t?{model:a,value:t}:null},r.get.rgb=function(e){if(!e)return null;var t,a,o,n=[0,0,0,1];if(t=e.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(o=t[2],t=t[1],a=0;a<3;a++){var _=2*a;n[a]=parseInt(t.slice(_,_+2),16)}o&&(n[3]=parseInt(o,16)/255)}else if(t=e.match(/^#([a-f0-9]{3,4})$/i)){for(o=(t=t[1])[3],a=0;a<3;a++)n[a]=parseInt(t[a]+t[a],16);o&&(n[3]=parseInt(o+o,16)/255)}else if(t=e.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(a=0;a<3;a++)n[a]=parseInt(t[a+1],0);t[4]&&(t[5]?n[3]=.01*parseFloat(t[4]):n[3]=parseFloat(t[4]))}else{if(!(t=e.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(t=e.match(/^(\w+)$/))?"transparent"===t[1]?[0,0,0,0]:E.call(i,t[1])?((n=i[t[1]])[3]=1,n):null:null;for(a=0;a<3;a++)n[a]=Math.round(2.55*parseFloat(t[a+1]));t[4]&&(t[5]?n[3]=.01*parseFloat(t[4]):n[3]=parseFloat(t[4]))}for(a=0;a<3;a++)n[a]=T(n[a],0,255);return n[3]=T(n[3],0,1),n},r.get.hsl=function(e){if(!e)return null;var t=e.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(t){var a=parseFloat(t[4]);return[(parseFloat(t[1])%360+360)%360,T(parseFloat(t[2]),0,100),T(parseFloat(t[3]),0,100),T(isNaN(a)?1:a,0,1)]}return null},r.get.hwb=function(e){if(!e)return null;var t=e.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(t){var a=parseFloat(t[4]);return[(parseFloat(t[1])%360+360)%360,T(parseFloat(t[2]),0,100),T(parseFloat(t[3]),0,100),T(isNaN(a)?1:a,0,1)]}return null},r.to.hex=function(){var e=o(arguments);return"#"+S(e[0])+S(e[1])+S(e[2])+(e[3]<1?S(Math.round(255*e[3])):"")},r.to.rgb=function(){var e=o(arguments);return e.length<4||1===e[3]?"rgb("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+")":"rgba("+Math.round(e[0])+", "+Math.round(e[1])+", "+Math.round(e[2])+", "+e[3]+")"},r.to.rgb.percent=function(){var e=o(arguments),t=Math.round(e[0]/255*100),a=Math.round(e[1]/255*100),i=Math.round(e[2]/255*100);return e.length<4||1===e[3]?"rgb("+t+"%, "+a+"%, "+i+"%)":"rgba("+t+"%, "+a+"%, "+i+"%, "+e[3]+")"},r.to.hsl=function(){var e=o(arguments);return e.length<4||1===e[3]?"hsl("+e[0]+", "+e[1]+"%, "+e[2]+"%)":"hsla("+e[0]+", "+e[1]+"%, "+e[2]+"%, "+e[3]+")"},r.to.hwb=function(){var e=o(arguments),t="";return e.length>=4&&1!==e[3]&&(t=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"},r.to.keyword=function(e){return n[e.slice(0,3)]}},38742:(e,t,a)=>{const i=a(66138),o=a(61880),E=["keyword","gray","hex"],n={};for(const e of Object.keys(o))n[[...o[e].labels].sort().join("")]=e;const _={};function r(e,t){if(!(this instanceof r))return new r(e,t);if(t&&t in E&&(t=null),t&&!(t in o))throw new Error("Unknown model: "+t);let a,T;if(null==e)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof r)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if("string"==typeof e){const t=i.get(e);if(null===t)throw new Error("Unable to parse color from string: "+e);this.model=t.model,T=o[this.model].channels,this.color=t.value.slice(0,T),this.valpha="number"==typeof t.value[T]?t.value[T]:1}else if(e.length>0){this.model=t||"rgb",T=o[this.model].channels;const a=Array.prototype.slice.call(e,0,T);this.color=l(a,T),this.valpha="number"==typeof e[T]?e[T]:1}else if("number"==typeof e)this.model="rgb",this.color=[e>>16&255,e>>8&255,255&e],this.valpha=1;else{this.valpha=1;const t=Object.keys(e);"alpha"in e&&(t.splice(t.indexOf("alpha"),1),this.valpha="number"==typeof e.alpha?e.alpha:0);const i=t.sort().join("");if(!(i in n))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=n[i];const{labels:E}=o[this.model],_=[];for(a=0;a(e%360+360)%360),saturationl:S("hsl",1,s(100)),lightness:S("hsl",2,s(100)),saturationv:S("hsv",1,s(100)),value:S("hsv",2,s(100)),chroma:S("hcg",1,s(100)),gray:S("hcg",2,s(100)),white:S("hwb",1,s(100)),wblack:S("hwb",2,s(100)),cyan:S("cmyk",0,s(100)),magenta:S("cmyk",1,s(100)),yellow:S("cmyk",2,s(100)),black:S("cmyk",3,s(100)),x:S("xyz",0,s(95.047)),y:S("xyz",1,s(100)),z:S("xyz",2,s(108.833)),l:S("lab",0,s(100)),a:S("lab",1),b:S("lab",2),keyword(e){return void 0!==e?new r(e):o[this.model].keyword(this.color)},hex(e){return void 0!==e?new r(e):i.to.hex(this.rgb().round().color)},hexa(e){if(void 0!==e)return new r(e);const t=this.rgb().round().color;let a=Math.round(255*this.valpha).toString(16).toUpperCase();return 1===a.length&&(a="0"+a),i.to.hex(t)+a},rgbNumber(){const e=this.rgb().color;return(255&e[0])<<16|(255&e[1])<<8|255&e[2]},luminosity(){const e=this.rgb().color,t=[];for(const[a,i]of e.entries()){const e=i/255;t[a]=e<=.04045?e/12.92:((e+.055)/1.055)**2.4}return.2126*t[0]+.7152*t[1]+.0722*t[2]},contrast(e){const t=this.luminosity(),a=e.luminosity();return t>a?(t+.05)/(a+.05):(a+.05)/(t+.05)},level(e){const t=this.contrast(e);return t>=7?"AAA":t>=4.5?"AA":""},isDark(){const e=this.rgb().color;return(2126*e[0]+7152*e[1]+722*e[2])/1e4<128},isLight(){return!this.isDark()},negate(){const e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){const t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){const t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){const t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){const t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){const t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){const t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){const e=this.rgb().color,t=.3*e[0]+.59*e[1]+.11*e[2];return r.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){const t=this.hsl();let a=t.color[0];return a=(a+e)%360,a=a<0?360+a:a,t.color[0]=a,t},mix(e,t){if(!e||!e.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof e);const a=e.rgb(),i=this.rgb(),o=void 0===t?.5:t,E=2*o-1,n=a.alpha()-i.alpha(),_=((E*n===-1?E:(E+n)/(1+E*n))+1)/2,T=1-_;return r.rgb(_*a.red()+T*i.red(),_*a.green()+T*i.green(),_*a.blue()+T*i.blue(),a.alpha()*o+i.alpha()*(1-o))}};for(const e of Object.keys(o)){if(E.includes(e))continue;const{channels:t}=o[e];r.prototype[e]=function(...t){return this.model===e?new r(this):t.length>0?new r(t,e):new r([...(a=o[this.model][e].raw(this.color),Array.isArray(a)?a:[a]),this.valpha],e);var a},r[e]=function(...a){let i=a[0];return"number"==typeof i&&(i=l(a,t)),new r(i,e)}}function T(e){return function(t){return(function(e,t){return Number(e.toFixed(t))})(t,e)}}function S(e,t,a){e=Array.isArray(e)?e:[e];for(const i of e)(_[i]||(_[i]=[]))[t]=a;return e=e[0],function(i){let o;return void 0!==i?(a&&(i=a(i)),o=this[e](),o.color[t]=i,o):(o=this[e]().color[t],a&&(o=a(o)),o)}}function s(e){return function(t){return Math.max(0,Math.min(e,t))}}function l(e,t){for(let a=0;a{e.exports=function e(t){return Object.freeze(t),Object.getOwnPropertyNames(t).forEach(function(a){!t.hasOwnProperty(a)||null===t[a]||"object"!=typeof t[a]&&"function"!=typeof t[a]||Object.isFrozen(t[a])||e(t[a])}),t}},61449:(e,t,a)=>{"use strict";var i,o=a(45312),E=a(3492);try{i=[].__proto__===Array.prototype}catch(e){if(!e||"object"!=typeof e||!("code"in e)||"ERR_PROTO_ACCESS"!==e.code)throw e}var n=!!i&&E&&E(Object.prototype,"__proto__"),_=Object,r=_.getPrototypeOf;e.exports=n&&"function"==typeof n.get?o([n.get]):"function"==typeof r&&function(e){return r(null==e?e:_(e))}},29173:e=>{"use strict";var t=Object.defineProperty||!1;if(t)try{t({},"a",{value:1})}catch(e){t=!1}e.exports=t},81101:e=>{"use strict";e.exports=EvalError},99183:e=>{"use strict";e.exports=Error},17570:e=>{"use strict";e.exports=RangeError},9898:e=>{"use strict";e.exports=ReferenceError},17388:e=>{"use strict";e.exports=SyntaxError},57379:e=>{"use strict";e.exports=TypeError},74585:e=>{"use strict";e.exports=URIError},32410:e=>{"use strict";e.exports=Object},55852:e=>{"use strict";var t=Object.prototype.hasOwnProperty,a="~";function i(){}function o(e,t,a){this.fn=e,this.context=t,this.once=a||!1}function E(e,t,i,E,n){if("function"!=typeof i)throw new TypeError("The listener must be a function");var _=new o(i,E||e,n),r=a?a+t:t;return e._events[r]?e._events[r].fn?e._events[r]=[e._events[r],_]:e._events[r].push(_):(e._events[r]=_,e._eventsCount++),e}function n(e,t){0===--e._eventsCount?e._events=new i:delete e._events[t]}function _(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(a=!1)),_.prototype.eventNames=function(){var e,i,o=[];if(0===this._eventsCount)return o;for(i in e=this._events)t.call(e,i)&&o.push(a?i.slice(1):i);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},_.prototype.listeners=function(e){var t=a?a+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var o=0,E=i.length,n=new Array(E);o{"use strict";var t=Object.prototype.hasOwnProperty,a="~";function i(){}function o(e,t,a){this.fn=e,this.context=t,this.once=a||!1}function E(e,t,i,E,n){if("function"!=typeof i)throw new TypeError("The listener must be a function");var _=new o(i,E||e,n),r=a?a+t:t;return e._events[r]?e._events[r].fn?e._events[r]=[e._events[r],_]:e._events[r].push(_):(e._events[r]=_,e._eventsCount++),e}function n(e,t){0===--e._eventsCount?e._events=new i:delete e._events[t]}function _(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(a=!1)),_.prototype.eventNames=function(){var e,i,o=[];if(0===this._eventsCount)return o;for(i in e=this._events)t.call(e,i)&&o.push(a?i.slice(1):i);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},_.prototype.listeners=function(e){var t=a?a+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var o=0,E=i.length,n=new Array(E);o{"use strict";t.A=function(e){var t={};for(var a in e)e.hasOwnProperty(a)&&o(a)&&(t[a]=e[a]);return t};var a={onCopy:!0,onCut:!0,onPaste:!0,onLoad:!0,onError:!0,onWheel:!0,onScroll:!0,onCompositionEnd:!0,onCompositionStart:!0,onCompositionUpdate:!0,onKeyDown:!0,onKeyPress:!0,onKeyUp:!0,onFocus:!0,onBlur:!0,onChange:!0,onInput:!0,onSubmit:!0,onClick:!0,onContextMenu:!0,onDoubleClick:!0,onDrag:!0,onDragEnd:!0,onDragEnter:!0,onDragExit:!0,onDragLeave:!0,onDragOver:!0,onDragStart:!0,onDrop:!0,onMouseDown:!0,onMouseEnter:!0,onMouseLeave:!0,onMouseMove:!0,onMouseOut:!0,onMouseOver:!0,onMouseUp:!0,onSelect:!0,onTouchCancel:!0,onTouchEnd:!0,onTouchMove:!0,onTouchStart:!0,onAnimationStart:!0,onAnimationEnd:!0,onAnimationIteration:!0,onTransitionEnd:!0},i={abbr:"abbr",accept:"accept",acceptCharset:"accept-charset",accessKey:"accesskey",action:"action",allowFullScreen:"allowfullscreen",allowTransparency:"allowtransparency",alt:"alt",async:"async",autoComplete:"autocomplete",autoFocus:"autofocus",autoPlay:"autoplay",cellPadding:"cellpadding",cellSpacing:"cellspacing",challenge:"challenge",charset:"charset",checked:"checked",cite:"cite",class:"class",className:"class",cols:"cols",colSpan:"colspan",command:"command",content:"content",contentEditable:"contenteditable",contextMenu:"contextmenu",controls:"controls",coords:"coords",crossOrigin:"crossorigin",data:"data",dateTime:"datetime",default:"default",defer:"defer",dir:"dir",disabled:"disabled",download:"download",draggable:"draggable",dropzone:"dropzone",encType:"enctype",for:"for",form:"form",formAction:"formaction",formEncType:"formenctype",formMethod:"formmethod",formNoValidate:"formnovalidate",formTarget:"formtarget",frameBorder:"frameBorder",headers:"headers",height:"height",hidden:"hidden",high:"high",href:"href",hrefLang:"hreflang",htmlFor:"for",httpEquiv:"http-equiv",icon:"icon",id:"id",inputMode:"inputmode",isMap:"ismap",itemId:"itemid",itemProp:"itemprop",itemRef:"itemref",itemScope:"itemscope",itemType:"itemtype",kind:"kind",label:"label",lang:"lang",list:"list",loop:"loop",manifest:"manifest",max:"max",maxLength:"maxlength",media:"media",mediaGroup:"mediagroup",method:"method",min:"min",minLength:"minlength",multiple:"multiple",muted:"muted",name:"name",noValidate:"novalidate",open:"open",optimum:"optimum",pattern:"pattern",ping:"ping",placeholder:"placeholder",poster:"poster",preload:"preload",radioGroup:"radiogroup",readOnly:"readonly",rel:"rel",required:"required",role:"role",rows:"rows",rowSpan:"rowspan",sandbox:"sandbox",scope:"scope",scoped:"scoped",scrolling:"scrolling",seamless:"seamless",selected:"selected",shape:"shape",size:"size",sizes:"sizes",sortable:"sortable",span:"span",spellCheck:"spellcheck",src:"src",srcDoc:"srcdoc",srcSet:"srcset",start:"start",step:"step",style:"style",tabIndex:"tabindex",target:"target",title:"title",translate:"translate",type:"type",typeMustMatch:"typemustmatch",useMap:"usemap",value:"value",width:"width",wmode:"wmode",wrap:"wrap"};function o(e){return a[e]||i[e]||/^(data|aria)-/.test(e)}},51777:e=>{"use strict";var t=Object.prototype.toString,a=Math.max,i=function(e,t){for(var a=[],i=0;i{"use strict";var i=a(51777);e.exports=Function.prototype.bind||i},40703:(e,t,a)=>{"use strict";var i,o=a(32410),E=a(99183),n=a(81101),_=a(17570),r=a(9898),T=a(17388),S=a(57379),s=a(74585),l=a(29895),I=a(72153),A=a(90457),O=a(21179),u=a(55985),d=a(88639),N=a(55738),R=Function,c=function(e){try{return R('"use strict"; return ('+e+").constructor;")()}catch(e){}},m=a(3492),L=a(29173),D=function(){throw new S},C=m?(function(){try{return D}catch(e){try{return m(arguments,"callee").get}catch(e){return D}}})():D,p=a(87657)(),h=a(31611),P=a(48819),B=a(22517),f=a(81948),g=a(32878),v={},M="undefined"!=typeof Uint8Array&&h?h(Uint8Array):i,W={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?i:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?i:ArrayBuffer,"%ArrayIteratorPrototype%":p&&h?h([][Symbol.iterator]()):i,"%AsyncFromSyncIteratorPrototype%":i,"%AsyncFunction%":v,"%AsyncGenerator%":v,"%AsyncGeneratorFunction%":v,"%AsyncIteratorPrototype%":v,"%Atomics%":"undefined"==typeof Atomics?i:Atomics,"%BigInt%":"undefined"==typeof BigInt?i:BigInt,"%BigInt64Array%":"undefined"==typeof BigInt64Array?i:BigInt64Array,"%BigUint64Array%":"undefined"==typeof BigUint64Array?i:BigUint64Array,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?i:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":E,"%eval%":eval,"%EvalError%":n,"%Float16Array%":"undefined"==typeof Float16Array?i:Float16Array,"%Float32Array%":"undefined"==typeof Float32Array?i:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?i:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?i:FinalizationRegistry,"%Function%":R,"%GeneratorFunction%":v,"%Int8Array%":"undefined"==typeof Int8Array?i:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?i:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?i:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":p&&h?h(h([][Symbol.iterator]())):i,"%JSON%":"object"==typeof JSON?JSON:i,"%Map%":"undefined"==typeof Map?i:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&p&&h?h((new Map)[Symbol.iterator]()):i,"%Math%":Math,"%Number%":Number,"%Object%":o,"%Object.getOwnPropertyDescriptor%":m,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?i:Promise,"%Proxy%":"undefined"==typeof Proxy?i:Proxy,"%RangeError%":_,"%ReferenceError%":r,"%Reflect%":"undefined"==typeof Reflect?i:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?i:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&p&&h?h((new Set)[Symbol.iterator]()):i,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?i:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":p&&h?h(""[Symbol.iterator]()):i,"%Symbol%":p?Symbol:i,"%SyntaxError%":T,"%ThrowTypeError%":C,"%TypedArray%":M,"%TypeError%":S,"%Uint8Array%":"undefined"==typeof Uint8Array?i:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?i:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?i:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?i:Uint32Array,"%URIError%":s,"%WeakMap%":"undefined"==typeof WeakMap?i:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?i:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?i:WeakSet,"%Function.prototype.call%":g,"%Function.prototype.apply%":f,"%Object.defineProperty%":L,"%Object.getPrototypeOf%":P,"%Math.abs%":l,"%Math.floor%":I,"%Math.max%":A,"%Math.min%":O,"%Math.pow%":u,"%Math.round%":d,"%Math.sign%":N,"%Reflect.getPrototypeOf%":B};if(h)try{null.error}catch(e){var U=h(h(e));W["%Error.prototype%"]=U}var G=function e(t){var a;if("%AsyncFunction%"===t)a=c("async function () {}");else if("%GeneratorFunction%"===t)a=c("function* () {}");else if("%AsyncGeneratorFunction%"===t)a=c("async function* () {}");else if("%AsyncGenerator%"===t){var i=e("%AsyncGeneratorFunction%");i&&(a=i.prototype)}else if("%AsyncIteratorPrototype%"===t){var o=e("%AsyncGenerator%");o&&h&&(a=h(o.prototype))}return W[t]=a,a},y={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},b=a(13583),k=a(37533),F=b.call(g,Array.prototype.concat),V=b.call(f,Array.prototype.splice),H=b.call(g,String.prototype.replace),Y=b.call(g,String.prototype.slice),w=b.call(g,RegExp.prototype.exec),z=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,K=/\\(\\)?/g,j=function(e,t){var a,i=e;if(k(y,i)&&(i="%"+(a=y[i])[0]+"%"),k(W,i)){var o=W[i];if(o===v&&(o=G(i)),void 0===o&&!t)throw new S("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:a,name:i,value:o}}throw new T("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new S("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new S('"allowMissing" argument must be a boolean');if(null===w(/^%?[^%]*%?$/,e))throw new T("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var a=(function(e){var t=Y(e,0,1),a=Y(e,-1);if("%"===t&&"%"!==a)throw new T("invalid intrinsic syntax, expected closing `%`");if("%"===a&&"%"!==t)throw new T("invalid intrinsic syntax, expected opening `%`");var i=[];return H(e,z,function(e,t,a,o){i[i.length]=a?H(o,K,"$1"):t||e}),i})(e),i=a.length>0?a[0]:"",o=j("%"+i+"%",t),E=o.name,n=o.value,_=!1,r=o.alias;r&&(i=r[0],V(a,F([0,1],r)));for(var s=1,l=!0;s=a.length){var u=m(n,I);n=(l=!!u)&&"get"in u&&!("originalValue"in u.get)?u.get:n[I]}else l=k(n,I),n=n[I];l&&!_&&(W[E]=n)}}return n}},48819:(e,t,a)=>{"use strict";var i=a(32410);e.exports=i.getPrototypeOf||null},22517:e=>{"use strict";e.exports="undefined"!=typeof Reflect&&Reflect.getPrototypeOf||null},31611:(e,t,a)=>{"use strict";var i=a(22517),o=a(48819),E=a(61449);e.exports=i?function(e){return i(e)}:o?function(e){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new TypeError("getProto: not an object");return o(e)}:E?function(e){return E(e)}:null},64656:e=>{"use strict";e.exports=Object.getOwnPropertyDescriptor},3492:(e,t,a)=>{"use strict";var i=a(64656);if(i)try{i([],"length")}catch(e){i=null}e.exports=i},87657:(e,t,a)=>{"use strict";var i="undefined"!=typeof Symbol&&Symbol,o=a(38123);e.exports=function(){return"function"==typeof i&&("function"==typeof Symbol&&("symbol"==typeof i("foo")&&("symbol"==typeof Symbol("bar")&&o())))}},38123:e=>{"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),a=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(a))return!1;for(var i in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var o=Object.getOwnPropertySymbols(e);if(1!==o.length||o[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var E=Object.getOwnPropertyDescriptor(e,t);if(42!==E.value||!0!==E.enumerable)return!1}return!0}},37533:(e,t,a)=>{"use strict";var i=Function.prototype.call,o=Object.prototype.hasOwnProperty,E=a(13583);e.exports=E.call(i,o)},77444:e=>{var t=e.exports=function(e,a){if(a||(a=16),void 0===e&&(e=128),e<=0)return"0";for(var i=Math.log(Math.pow(2,e))/Math.log(a),o=2;i===1/0;o*=2)i=Math.log(Math.pow(2,e/o))/Math.log(a)*o;var E=i-Math.floor(i),n="";for(o=0;o=Math.pow(2,e)?t(e,a):n};t.rack=function(e,a,i){var o=function(o){var n=0;do{if(n++>10){if(!i)throw new Error("too many ID collisions, use more bits");e+=i}var _=t(e,a)}while(Object.hasOwnProperty.call(E,_));return E[_]=o,_},E=o.hats={};return o.get=function(e){return o.hats[e]},o.set=function(e,t){return o.hats[e]=t,o},o.bits=e||128,o.base=a||16,o}},53683:e=>{!(function t(a){e.exports=(function(){"use strict";function e(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),a.push.apply(a,i)}return a}function i(t){for(var a=1;ae.length)&&(t=e.length);for(var a=0,i=new Array(t);a=e.length?{done:!0}:{done:!1,value:e[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.")}function m(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var L={exports:{}};!(function(e){var t,a,i,o,E;t=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,a=/^(?=([^\/?#]*))\1([^]*)$/,i=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,E={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var o=E.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");return o.path=E.normalizePath(o.path),E.buildURLFromParts(o)}var n=E.parseURL(t);if(!n)throw new Error("Error trying to parse relative URL.");if(n.scheme)return i.alwaysNormalize?(n.path=E.normalizePath(n.path),E.buildURLFromParts(n)):t;var _=E.parseURL(e);if(!_)throw new Error("Error trying to parse base URL.");if(!_.netLoc&&_.path&&"/"!==_.path[0]){var r=a.exec(_.path);_.netLoc=r[1],_.path=r[2]}_.netLoc&&!_.path&&(_.path="/");var T={scheme:_.scheme,netLoc:n.netLoc,path:null,params:n.params,query:n.query,fragment:n.fragment};if(!n.netLoc&&(T.netLoc=_.netLoc,"/"!==n.path[0]))if(n.path){var S=_.path,s=S.substring(0,S.lastIndexOf("/")+1)+n.path;T.path=E.normalizePath(s)}else T.path=_.path,n.params||(T.params=_.params,n.query||(T.query=_.query));return null===T.path&&(T.path=i.alwaysNormalize?E.normalizePath(n.path):n.path),E.buildURLFromParts(T)},parseURL:function(e){var a=t.exec(e);return a?{scheme:a[1]||"",netLoc:a[2]||"",path:a[3]||"",params:a[4]||"",query:a[5]||"",fragment:a[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(i,"");e.length!==(e=e.replace(o,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=E})(L);var D=L.exports,C=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},p=Number.isSafeInteger||function(e){return"number"==typeof e&&Math.abs(e)<=h},h=Number.MAX_SAFE_INTEGER||9007199254740991,P=(function(e){return e.MEDIA_ATTACHING="hlsMediaAttaching",e.MEDIA_ATTACHED="hlsMediaAttached",e.MEDIA_DETACHING="hlsMediaDetaching",e.MEDIA_DETACHED="hlsMediaDetached",e.BUFFER_RESET="hlsBufferReset",e.BUFFER_CODECS="hlsBufferCodecs",e.BUFFER_CREATED="hlsBufferCreated",e.BUFFER_APPENDING="hlsBufferAppending",e.BUFFER_APPENDED="hlsBufferAppended",e.BUFFER_EOS="hlsBufferEos",e.BUFFER_FLUSHING="hlsBufferFlushing",e.BUFFER_FLUSHED="hlsBufferFlushed",e.MANIFEST_LOADING="hlsManifestLoading",e.MANIFEST_LOADED="hlsManifestLoaded",e.MANIFEST_PARSED="hlsManifestParsed",e.LEVEL_SWITCHING="hlsLevelSwitching",e.LEVEL_SWITCHED="hlsLevelSwitched",e.LEVEL_LOADING="hlsLevelLoading",e.LEVEL_LOADED="hlsLevelLoaded",e.LEVEL_UPDATED="hlsLevelUpdated",e.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",e.LEVELS_UPDATED="hlsLevelsUpdated",e.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",e.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",e.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",e.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",e.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",e.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",e.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",e.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",e.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",e.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",e.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",e.CUES_PARSED="hlsCuesParsed",e.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",e.INIT_PTS_FOUND="hlsInitPtsFound",e.FRAG_LOADING="hlsFragLoading",e.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",e.FRAG_LOADED="hlsFragLoaded",e.FRAG_DECRYPTED="hlsFragDecrypted",e.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",e.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",e.FRAG_PARSING_METADATA="hlsFragParsingMetadata",e.FRAG_PARSED="hlsFragParsed",e.FRAG_BUFFERED="hlsFragBuffered",e.FRAG_CHANGED="hlsFragChanged",e.FPS_DROP="hlsFpsDrop",e.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",e.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",e.ERROR="hlsError",e.DESTROYING="hlsDestroying",e.KEY_LOADING="hlsKeyLoading",e.KEY_LOADED="hlsKeyLoaded",e.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",e.BACK_BUFFER_REACHED="hlsBackBufferReached",e.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",e})({}),B=(function(e){return e.NETWORK_ERROR="networkError",e.MEDIA_ERROR="mediaError",e.KEY_SYSTEM_ERROR="keySystemError",e.MUX_ERROR="muxError",e.OTHER_ERROR="otherError",e})({}),f=(function(e){return e.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",e.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",e.KEY_SYSTEM_NO_SESSION="keySystemNoSession",e.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",e.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",e.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",e.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",e.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",e.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",e.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",e.MANIFEST_LOAD_ERROR="manifestLoadError",e.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",e.MANIFEST_PARSING_ERROR="manifestParsingError",e.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",e.LEVEL_EMPTY_ERROR="levelEmptyError",e.LEVEL_LOAD_ERROR="levelLoadError",e.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",e.LEVEL_PARSING_ERROR="levelParsingError",e.LEVEL_SWITCH_ERROR="levelSwitchError",e.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",e.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",e.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",e.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",e.FRAG_LOAD_ERROR="fragLoadError",e.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",e.FRAG_DECRYPT_ERROR="fragDecryptError",e.FRAG_PARSING_ERROR="fragParsingError",e.FRAG_GAP="fragGap",e.REMUX_ALLOC_ERROR="remuxAllocError",e.KEY_LOAD_ERROR="keyLoadError",e.KEY_LOAD_TIMEOUT="keyLoadTimeOut",e.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",e.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",e.BUFFER_APPEND_ERROR="bufferAppendError",e.BUFFER_APPENDING_ERROR="bufferAppendingError",e.BUFFER_STALLED_ERROR="bufferStalledError",e.BUFFER_FULL_ERROR="bufferFullError",e.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",e.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",e.INTERNAL_EXCEPTION="internalException",e.INTERNAL_ABORTED="aborted",e.UNKNOWN="unknown",e})({}),g=function(){},v={trace:g,debug:g,log:g,warn:g,info:g,error:g},M=v;function W(e){var t=self.console[e];return t?t.bind(self.console,"["+e+"] >"):g}function U(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),i=1;iNumber.MAX_SAFE_INTEGER?1/0:t},t.hexadecimalInteger=function(e){if(this[e]){var t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;for(var a=new Uint8Array(t.length/2),i=0;iNumber.MAX_SAFE_INTEGER?1/0:t},t.decimalFloatingPoint=function(e){return parseFloat(this[e])},t.optionalFloat=function(e,t){var a=this[e];return a?parseFloat(a):t},t.enumeratedString=function(e){return this[e]},t.bool=function(e){return"YES"===this[e]},t.decimalResolution=function(e){var t=b.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}},e.parseAttrList=function(e){var t,a={},i='"';for(k.lastIndex=0;null!==(t=k.exec(e));){var o=t[2];0===o.indexOf(i)&&o.lastIndexOf(i)===o.length-1&&(o=o.slice(1,-1)),a[t[1].trim()]=o}return a},_(e,[{key:"clientAttrs",get:function(){return Object.keys(this).filter(function(e){return"X-"===e.substring(0,2)})}}]),e})();function V(e){return"ID"!==e&&"CLASS"!==e&&"START-DATE"!==e&&"DURATION"!==e&&"END-DATE"!==e&&"END-ON-NEXT"!==e}function H(e){return"SCTE35-OUT"===e||"SCTE35-IN"===e}var Y=(function(){function e(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){var a=t.attr;for(var i in a)if(Object.prototype.hasOwnProperty.call(e,i)&&e[i]!==a[i]){y.warn('DATERANGE tag attribute: "'+i+'" does not match for tags with ID: "'+e.ID+'"'),this._badValueForSameId=i;break}e=T(new F({}),a,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){var o=new Date(this.attr["END-DATE"]);C(o.getTime())&&(this._endDate=o)}}return _(e,[{key:"id",get:function(){return this.attr.ID}},{key:"class",get:function(){return this.attr.CLASS}},{key:"startDate",get:function(){return this._startDate}},{key:"endDate",get:function(){if(this._endDate)return this._endDate;var e=this.duration;return null!==e?new Date(this._startDate.getTime()+1e3*e):null}},{key:"duration",get:function(){if("DURATION"in this.attr){var e=this.attr.decimalFloatingPoint("DURATION");if(C(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}},{key:"plannedDuration",get:function(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}},{key:"endOnNext",get:function(){return this.attr.bool("END-ON-NEXT")}},{key:"isValid",get:function(){return!!this.id&&!this._badValueForSameId&&C(this.startDate.getTime())&&(null===this.duration||this.duration>=0)&&(!this.endOnNext||!!this.class)}}]),e})(),w=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}},z={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"},K=(function(){function e(e){var t;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=((t={})[z.AUDIO]=null,t[z.VIDEO]=null,t[z.AUDIOVIDEO]=null,t),this.baseurl=e}return e.prototype.setByteRange=function(e,t){var a,i=e.split("@",2);a=1===i.length?(null==t?void 0:t.byteRangeEndOffset)||0:parseInt(i[1]),this._byteRange=[a,parseInt(i[0])+a]},_(e,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=D.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(e){this._url=e}}]),e})(),j=(function(e){function t(t,a){var i;return(i=e.call(this,a)||this)._decryptdata=null,i.rawProgramDateTime=null,i.programDateTime=null,i.tagList=[],i.duration=0,i.sn=0,i.levelkeys=void 0,i.type=void 0,i.loader=null,i.keyLoader=null,i.level=-1,i.cc=0,i.startPTS=void 0,i.endPTS=void 0,i.startDTS=void 0,i.endDTS=void 0,i.start=0,i.deltaPTS=void 0,i.maxStartPTS=void 0,i.minEndPTS=void 0,i.stats=new w,i.data=void 0,i.bitrateTest=!1,i.title=null,i.initSegment=null,i.endList=void 0,i.gap=void 0,i.urlId=0,i.type=t,i}S(t,e);var a=t.prototype;return a.setKeyFormat=function(e){if(this.levelkeys){var t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}},a.abortRequests=function(){var e,t;null==(e=this.loader)||e.abort(),null==(t=this.keyLoader)||t.abort()},a.setElementaryStreamInfo=function(e,t,a,i,o,E){void 0===E&&(E=!1);var n=this.elementaryStreams,_=n[e];_?(_.startPTS=Math.min(_.startPTS,t),_.endPTS=Math.max(_.endPTS,a),_.startDTS=Math.min(_.startDTS,i),_.endDTS=Math.max(_.endDTS,o)):n[e]={startPTS:t,endPTS:a,startDTS:i,endDTS:o,partial:E}},a.clearElementaryStreamInfo=function(){var e=this.elementaryStreams;e[z.AUDIO]=null,e[z.VIDEO]=null,e[z.AUDIOVIDEO]=null},_(t,[{key:"decryptdata",get:function(){if(!this.levelkeys&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){var e=this.levelkeys.identity;if(e)this._decryptdata=e.getDecryptData(this.sn);else{var t=Object.keys(this.levelkeys);if(1===t.length)return this._decryptdata=this.levelkeys[t[0]].getDecryptData(this.sn)}}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(null===this.programDateTime)return null;if(!C(this.programDateTime))return null;var e=C(this.duration)?this.duration:0;return this.programDateTime+1e3*e}},{key:"encrypted",get:function(){var e;if(null!=(e=this._decryptdata)&&e.encrypted)return!0;if(this.levelkeys){var t=Object.keys(this.levelkeys),a=t.length;if(a>1||1===a&&this.levelkeys[t[0]].encrypted)return!0}return!1}}]),t})(K),x=(function(e){function t(t,a,i,o,E){var n;(n=e.call(this,i)||this).fragOffset=0,n.duration=0,n.gap=!1,n.independent=!1,n.relurl=void 0,n.fragment=void 0,n.index=void 0,n.stats=new w,n.duration=t.decimalFloatingPoint("DURATION"),n.gap=t.bool("GAP"),n.independent=t.bool("INDEPENDENT"),n.relurl=t.enumeratedString("URI"),n.fragment=a,n.index=o;var _=t.enumeratedString("BYTERANGE");return _&&n.setByteRange(_,E),E&&(n.fragOffset=E.fragOffset+E.duration),n}return S(t,e),_(t,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var e=this.elementaryStreams;return!!(e.audio||e.video||e.audiovideo)}}]),t})(K),Q=10,X=(function(){function e(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}return e.prototype.reloaded=function(e){if(!e)return this.advanced=!0,void(this.updated=!0);var t=this.lastPartSn-e.lastPartSn,a=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!a||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||0===t&&a>0,this.updated||this.advanced?this.misses=Math.floor(.6*e.misses):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay},_(e,[{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&C(this.fragments[this.fragments.length-1].programDateTime)}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||Q}},{key:"drift",get:function(){var e=this.driftEndTime-this.driftStartTime;return e>0?1e3*(this.driftEnd-this.driftStart)/e:1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var e;return null!=(e=this.fragments)&&e.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),e})();function $(e){return Uint8Array.from(atob(e),function(e){return e.charCodeAt(0)})}function q(e){var t=ee(e).subarray(0,16),a=new Uint8Array(16);return a.set(t,16-t.length),a}function J(e){var t=function(e,t,a){var i=e[t];e[t]=e[a],e[a]=i};t(e,0,3),t(e,1,2),t(e,4,5),t(e,6,7)}function Z(e){var t=e.split(":"),a=null;if("data"===t[0]&&2===t.length){var i=t[1].split(";"),o=i[i.length-1].split(",");if(2===o.length){var E="base64"===o[0],n=o[1];E?(i.splice(-1,1),a=$(n)):a=q(n)}}return a}function ee(e){return Uint8Array.from(unescape(encodeURIComponent(e)),function(e){return e.charCodeAt(0)})}var te="undefined"!=typeof self?self:void 0,ae={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},ie={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function oe(e){switch(e){case ie.FAIRPLAY:return ae.FAIRPLAY;case ie.PLAYREADY:return ae.PLAYREADY;case ie.WIDEVINE:return ae.WIDEVINE;case ie.CLEARKEY:return ae.CLEARKEY}}var Ee={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function ne(e){if(e===Ee.WIDEVINE)return ae.WIDEVINE}function _e(e){switch(e){case ae.FAIRPLAY:return ie.FAIRPLAY;case ae.PLAYREADY:return ie.PLAYREADY;case ae.WIDEVINE:return ie.WIDEVINE;case ae.CLEARKEY:return ie.CLEARKEY}}function re(e){var t=e.drmSystems,a=e.widevineLicenseUrl,i=t?[ae.FAIRPLAY,ae.WIDEVINE,ae.PLAYREADY,ae.CLEARKEY].filter(function(e){return!!t[e]}):[];return!i[ae.WIDEVINE]&&a&&i.push(ae.WIDEVINE),i}var Te,Se=null!=te&&null!=(Te=te.navigator)&&Te.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;function se(e,t,a,i){var o;switch(e){case ae.FAIRPLAY:o=["cenc","sinf"];break;case ae.WIDEVINE:case ae.PLAYREADY:o=["cenc"];break;case ae.CLEARKEY:o=["cenc","keyids"];break;default:throw new Error("Unknown key-system: "+e)}return le(o,t,a,i)}function le(e,t,a,i){return[{initDataTypes:e,persistentState:i.persistentState||"optional",distinctiveIdentifier:i.distinctiveIdentifier||"optional",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:t.map(function(e){return{contentType:'audio/mp4; codecs="'+e+'"',robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null}}),videoCapabilities:a.map(function(e){return{contentType:'video/mp4; codecs="'+e+'"',robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}})}]}function Ie(e,t,a){return Uint8Array.prototype.slice?e.slice(t,a):new Uint8Array(Array.prototype.slice.call(e,t,a))}var Ae,Oe=function(e,t){return t+10<=e.length&&73===e[t]&&68===e[t+1]&&51===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128},ue=function(e,t){return t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128},de=function(e,t){for(var a=t,i=0;Oe(e,t);)i+=10,i+=Ne(e,t+6),ue(e,t+10)&&(i+=10),t+=i;if(i>0)return e.subarray(a,a+i)},Ne=function(e,t){var a=0;return a=(127&e[t])<<21,a|=(127&e[t+1])<<14,a|=(127&e[t+2])<<7,a|=127&e[t+3]},Re=function(e,t){return Oe(e,t)&&Ne(e,t+6)+10<=e.length-t},ce=function(e){for(var t=De(e),a=0;a>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:T+=String.fromCharCode(E);break;case 12:case 13:n=e[S++],T+=String.fromCharCode((31&E)<<6|63&n);break;case 14:n=e[S++],_=e[S++],T+=String.fromCharCode((15&E)<<12|(63&n)<<6|63&_)}}return T};function ge(){if(!navigator.userAgent.includes("PlayStation 4"))return Ae||void 0===self.TextDecoder||(Ae=new self.TextDecoder("utf-8")),Ae}var ve={hexDump:function(e){for(var t="",a=0;a>24,e[t+1]=a>>16&255,e[t+2]=a>>8&255,e[t+3]=255&a}function He(e){for(var t=e.byteLength,a=0;a8&&109===e[a+4]&&111===e[a+5]&&111===e[a+6]&&102===e[a+7])return!0;a=i>1?a+i:t}return!1}function Ye(e,t){var a=[];if(!t.length)return a;for(var i=e.byteLength,o=0;o1?o+E:i;if(Ge(e.subarray(o+4,o+8))===t[0])if(1===t.length)a.push(e.subarray(o+8,n));else{var _=Ye(e.subarray(o+8,n),t.slice(1));_.length&&We.apply(a,_)}o=n}return a}function we(e){var t=[],a=e[0],i=8,o=be(e,i);i+=4;var E=0,n=0;0===a?(E=be(e,i),n=be(e,i+4),i+=8):(E=ke(e,i),n=ke(e,i+8),i+=16),i+=2;var _=e.length+n,r=ye(e,i);i+=2;for(var T=0;T>>31)return y.warn("SIDX has hierarchical references (not supported)"),null;var I=be(e,S);S+=4,t.push({referenceSize:l,subsegmentDuration:I,info:{duration:I/o,start:_,end:_+l-1}}),_+=l,i=S+=4}return{earliestPresentationTime:E,timescale:o,version:a,referencesCount:r,references:t}}function ze(e){for(var t=[],a=Ye(e,["moov","trak"]),o=0;o12){var S=4;if(3!==T[S++])break;S=je(T,S),S+=2;var s=T[S++];if(128&s&&(S+=2),64&s&&(S+=T[S++]),4!==T[S++])break;S=je(T,S);var l=T[S++];if(64!==l)break;if(o+="."+xe(l),S+=12,5!==T[S++])break;S=je(T,S);var I=T[S++],A=(248&I)>>3;31===A&&(A+=1+((7&I)<<3)+((224&T[S])>>5)),o+="."+A}break;case"hvc1":case"hev1":var O=Ye(a,["hvcC"])[0],u=O[1],d=["","A","B","C"][u>>6],N=31&u,R=be(O,2),c=(32&u)>>5?"H":"L",m=O[12],L=O.subarray(6,12);o+="."+d+N,o+="."+R.toString(16).toUpperCase(),o+="."+c+m;for(var D="",C=L.length;C--;){var p=L[C];(p||D)&&(D="."+p.toString(16).toUpperCase()+D)}o+=D;break;case"dvh1":case"dvhe":var h=Ye(a,["dvcC"])[0],P=h[2]>>1&127,B=h[2]<<5&32|h[3]>>3&31;o+="."+Qe(P)+"."+Qe(B);break;case"vp09":var f=Ye(a,["vpcC"])[0],g=f[4],v=f[5],M=f[6]>>4&15;o+="."+Qe(g)+"."+Qe(v)+"."+Qe(M);break;case"av01":var W=Ye(a,["av1C"])[0],U=W[1]>>>5,G=31&W[1],y=W[2]>>>7?"H":"M",b=(64&W[2])>>6,k=(32&W[2])>>5,F=2===U&&b?k?12:10:b?10:8,V=(16&W[2])>>4,H=(8&W[2])>>3,Y=(4&W[2])>>2,w=3&W[2],z=1,K=1,j=1,x=0;o+="."+U+"."+Qe(G)+y+"."+Qe(F)+"."+V+"."+H+Y+w+"."+Qe(z)+"."+Qe(K)+"."+Qe(j)+"."+x}return{codec:o,encrypted:E}}function je(e,t){for(var a=t+5;128&e[t++]&&t0;o||(i=Ye(t,["encv"])),i.forEach(function(e){Ye(o?e.subarray(28):e.subarray(78),["sinf"]).forEach(function(e){var t=$e(e);if(t){var i=t.subarray(8,24);i.some(function(e){return 0!==e})||(y.log("[eme] Patching keyId in 'enc"+(o?"a":"v")+">sinf>>tenc' box: "+ve.hexDump(i)+" -> "+ve.hexDump(a)),t.set(a,8))}})})}),e}function $e(e){var t=Ye(e,["schm"])[0];if(t){var a=Ge(t.subarray(4,8));if("cbcs"===a||"cenc"===a)return Ye(e,["schi","tenc"])[0]}return y.error("[eme] missing 'schm' box"),null}function qe(e,t){return Ye(t,["moof","traf"]).reduce(function(t,a){var i=Ye(a,["tfdt"])[0],o=i[0],E=Ye(a,["tfhd"]).reduce(function(t,a){var E=be(a,4),n=e[E];if(n){var _=be(i,4);if(1===o){if(_===Me)return y.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),t;_*=Me+1,_+=be(i,8)}var r=_/(n.timescale||9e4);if(C(r)&&(null===t||r>1&63;return 39===a||40===a}return 6==(31&t)}function nt(e,t,a,i){var o=_t(e),E=0;E+=t;for(var n=0,_=0,r=0;E=o.length)break;n+=r=o[E++]}while(255===r);_=0;do{if(E>=o.length)break;_+=r=o[E++]}while(255===r);var T=o.length-E,S=E;if(_T){y.error("Malformed SEI payload. "+_+" is too small, only "+T+" bytes left to parse.");break}if(4===n){if(181===o[S++]){var s=ye(o,S);if(S+=2,49===s){var l=be(o,S);if(S+=4,1195456820===l){var I=o[S++];if(3===I){var A=o[S++],O=64&A,u=O?2+3*(31&A):0,d=new Uint8Array(u);if(O){d[0]=A;for(var N=1;N16){for(var R=[],c=0;c<16;c++){var m=o[S++].toString(16);R.push(1==m.length?"0"+m:m),3!==c&&5!==c&&7!==c&&9!==c||R.push("-")}for(var L=_-16,D=new Uint8Array(L),C=0;C1?t-1:0),i=1;i>24&255,_[1]=E>>16&255,_[2]=E>>8&255,_[3]=255&E,_.set(e,4),n=0,E=8;n0?(E=new Uint8Array(4),t.length>0&&new DataView(E.buffer).setUint32(0,t.length,!1)):E=new Uint8Array;var r=new Uint8Array(4);return a&&a.byteLength>0&&new DataView(r.buffer).setUint32(0,a.byteLength,!1),Tt([112,115,115,104],new Uint8Array([i,0,0,0]),e,E,o,r,a||new Uint8Array)}function st(e){if(!(e instanceof ArrayBuffer)||e.byteLength<32)return null;var t={version:0,systemId:"",kids:null,data:null},a=new DataView(e),i=a.getUint32(0);if(e.byteLength!==i&&i>44)return null;if(1886614376!==a.getUint32(4))return null;if(t.version=a.getUint32(8)>>>24,t.version>1)return null;t.systemId=ve.hexDump(new Uint8Array(e,12,16));var o=a.getUint32(28);if(0===t.version){if(i-32=22&&(this.keyId=i.subarray(i.length-22,i.length-6));break;case ie.PLAYREADY:var o=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=St(o,null,i);var E=new Uint16Array(i.buffer,i.byteOffset,i.byteLength/2),n=String.fromCharCode.apply(null,Array.from(E)),_=n.substring(n.indexOf("<"),n.length),r=(new DOMParser).parseFromString(_,"text/xml").getElementsByTagName("KID")[0];if(r){var T=r.childNodes[0]?r.childNodes[0].nodeValue:r.getAttribute("VALUE");if(T){var S=$(T).subarray(0,16);J(S),this.keyId=S}}break;default:var s=i.subarray(0,16);if(16!==s.length){var l=new Uint8Array(16);l.set(s,16-s.length),s=l}this.keyId=s}if(!this.keyId||16!==this.keyId.byteLength){var I=lt[this.uri];if(!I){var A=Object.keys(lt).length%Number.MAX_SAFE_INTEGER;I=new Uint8Array(16),new DataView(I.buffer,12,4).setUint32(0,A),lt[this.uri]=I}this.keyId=I}return this},e})();function At(e){for(var t=new Uint8Array(16),a=12;a<16;a++)t[a]=e>>8*(15-a)&255;return t}var Ot=/\{\$([a-zA-Z0-9-_]+)\}/g;function ut(e){return Ot.test(e)}function dt(e,t,a){if(null!==e.variableList||e.hasVariableRefs)for(var i=a.length;i--;){var o=a[i],E=t[o];E&&(t[o]=Nt(e,E))}}function Nt(e,t){if(null!==e.variableList||e.hasVariableRefs){var a=e.variableList;return t.replace(Ot,function(t){var i=t.substring(2,t.length-1),o=null==a?void 0:a[i];return void 0===o?(e.playlistParsingError||(e.playlistParsingError=new Error('Missing preceding EXT-X-DEFINE tag for Variable Reference: "'+i+'"')),t):o})}return t}function Rt(e,t,a){var i,o,E=e.variableList;if(E||(e.variableList=E={}),"QUERYPARAM"in t){i=t.QUERYPARAM;try{var n=new self.URL(a).searchParams;if(!n.has(i))throw new Error('"'+i+'" does not match any query parameter in URI: "'+a+'"');o=n.get(i)}catch(t){e.playlistParsingError||(e.playlistParsingError=new Error("EXT-X-DEFINE QUERYPARAM: "+t.message))}}else i=t.NAME,o=t.VALUE;i in E?e.playlistParsingError||(e.playlistParsingError=new Error('EXT-X-DEFINE duplicate Variable Name declarations: "'+i+'"')):E[i]=o||""}function ct(e,t,a){var i=t.IMPORT;if(a&&i in a){var o=e.variableList;o||(e.variableList=o={}),o[i]=a[i]}else e.playlistParsingError||(e.playlistParsingError=new Error('EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "'+i+'"'))}function mt(e){if(void 0===e&&(e=!0),"undefined"!=typeof self)return(e||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}var Lt={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function Dt(e,t){var a=Lt[t];return!!a&&!!a[e.slice(0,4)]}function Ct(e,t,a){return void 0===a&&(a=!0),!e.split(",").some(function(e){return!pt(e,t,a)})}function pt(e,t,a){var i;void 0===a&&(a=!0);var o=mt(a);return null!=(i=null==o?void 0:o.isTypeSupported(ht(e,t)))&&i}function ht(e,t){return t+'/mp4;codecs="'+e+'"'}function Pt(e){if(e){var t=e.substring(0,4);return Lt.video[t]}return 2}function Bt(e){return e.split(",").reduce(function(e,t){var a=Lt.video[t];return a?(2*a+e)/(e?3:2):(Lt.audio[t]+e)/(e?2:1)},0)}var ft={};function gt(e,t){if(void 0===t&&(t=!0),ft[e])return ft[e];for(var a={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[e],i=0;i2){var a=t.shift()+".";return a+=parseInt(t.shift()).toString(16),a+=("000"+parseInt(t.shift()).toString(16)).slice(-4)}return e}var Gt=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,yt=/#EXT-X-MEDIA:(.*)/g,bt=/^#EXT(?:INF|-X-TARGETDURATION):/m,kt=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),Ft=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),Vt=(function(){function e(){}return e.findGroup=function(e,t){for(var a=0;a0&&E.length0&&K.bool("CAN-SKIP-DATERANGES"),S.partHoldBack=K.optionalFloat("PART-HOLD-BACK",0),S.holdBack=K.optionalFloat("HOLD-BACK",0);break;case"PART-INF":var Q=new F(B);S.partTarget=Q.decimalFloatingPoint("PART-TARGET");break;case"PART":var $=S.partList;$||($=S.partList=[]);var q=A>0?$[$.length-1]:void 0,J=A++,Z=new F(B);dt(S,Z,["BYTERANGE","URI"]);var ee=new x(Z,N,t,J,q);$.push(ee),N.duration+=ee.duration;break;case"PRELOAD-HINT":var te=new F(B);dt(S,te,["URI"]),S.preloadHint=te;break;case"RENDITION-REPORT":var ae=new F(B);dt(S,ae,["URI"]),S.renditionReports=S.renditionReports||[],S.renditionReports.push(ae);break;default:y.warn("line parsed but not handled: "+n)}}}d&&!d.relurl?(s.pop(),O-=d.duration,S.partList&&(S.fragmentHint=d)):S.partList&&(jt(N,d),N.cc=u,S.fragmentHint=N,r&&Qt(N,r,S));var ie=s.length,oe=s[0],Ee=s[ie-1];if((O+=S.skippedSegments*S.targetduration)>0&&ie&&Ee){S.averagetargetduration=O/ie;var ne=Ee.sn;S.endSN="initSegment"!==ne?ne:0,S.live||(Ee.endList=!0),oe&&(S.startCC=oe.cc)}else S.endSN=0,S.startCC=0;return S.fragmentHint&&(O+=S.fragmentHint.duration),S.totalduration=O,S.endCC=u,R>0&&Kt(s,R),S},e})();function Ht(e,t,a){var i,o,E=new F(e);dt(a,E,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);var n=null!=(i=E.METHOD)?i:"",_=E.URI,r=E.hexadecimalInteger("IV"),T=E.KEYFORMATVERSIONS,S=null!=(o=E.KEYFORMAT)?o:"identity";_&&E.IV&&!r&&y.error("Invalid IV: "+E.IV);var s=_?Vt.resolve(_,t):"",l=(T||"1").split("/").map(Number).filter(Number.isFinite);return new It(n,s,S,l,r)}function Yt(e){var t=new F(e).decimalFloatingPoint("TIME-OFFSET");return C(t)?t:null}function wt(e,t){var a=(e||"").split(/[ ,]+/).filter(function(e){return e});["video","audio","text"].forEach(function(e){var i=a.filter(function(t){return Dt(t,e)});i.length&&(t[e+"Codec"]=i.join(","),a=a.filter(function(e){return-1===i.indexOf(e)}))}),t.unknownCodecs=a}function zt(e,t,a){var i=t[a];i&&(e[a]=i)}function Kt(e,t){for(var a=e[t],i=t;i--;){var o=e[i];if(!o)return;o.programDateTime=a.programDateTime-1e3*o.duration,a=o}}function jt(e,t){e.rawProgramDateTime?e.programDateTime=Date.parse(e.rawProgramDateTime):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime),C(e.programDateTime)||(e.programDateTime=null,e.rawProgramDateTime=null)}function xt(e,t,a,i){e.relurl=t.URI,t.BYTERANGE&&e.setByteRange(t.BYTERANGE),e.level=a,e.sn="initSegment",i&&(e.levelkeys=i),e.initSegment=null}function Qt(e,t,a){e.levelkeys=t;var i=a.encryptedFragments;i.length&&i[i.length-1].levelkeys===t||!Object.keys(t).some(function(e){return t[e].isCommonEncryption})||i.push(e)}var Xt={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},$t={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function qt(e){switch(e.type){case Xt.AUDIO_TRACK:return $t.AUDIO;case Xt.SUBTITLE_TRACK:return $t.SUBTITLE;default:return $t.MAIN}}function Jt(e,t){var a=e.url;return void 0!==a&&0!==a.indexOf("data:")||(a=t.url),a}var Zt=(function(){function e(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}var t=e.prototype;return t.startLoad=function(e){},t.stopLoad=function(){this.destroyInternalLoaders()},t.registerListeners=function(){var e=this.hls;e.on(P.MANIFEST_LOADING,this.onManifestLoading,this),e.on(P.LEVEL_LOADING,this.onLevelLoading,this),e.on(P.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(P.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},t.unregisterListeners=function(){var e=this.hls;e.off(P.MANIFEST_LOADING,this.onManifestLoading,this),e.off(P.LEVEL_LOADING,this.onLevelLoading,this),e.off(P.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(P.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},t.createInternalLoader=function(e){var t=this.hls.config,a=t.pLoader,i=t.loader,o=new(a||i)(t);return this.loaders[e.type]=o,o},t.getInternalLoader=function(e){return this.loaders[e.type]},t.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},t.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},t.destroy=function(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()},t.onManifestLoading=function(e,t){var a=t.url;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Xt.MANIFEST,url:a,deliveryDirectives:null})},t.onLevelLoading=function(e,t){var a=t.id,i=t.level,o=t.pathwayId,E=t.url,n=t.deliveryDirectives;this.load({id:a,level:i,pathwayId:o,responseType:"text",type:Xt.LEVEL,url:E,deliveryDirectives:n})},t.onAudioTrackLoading=function(e,t){var a=t.id,i=t.groupId,o=t.url,E=t.deliveryDirectives;this.load({id:a,groupId:i,level:null,responseType:"text",type:Xt.AUDIO_TRACK,url:o,deliveryDirectives:E})},t.onSubtitleTrackLoading=function(e,t){var a=t.id,i=t.groupId,o=t.url,E=t.deliveryDirectives;this.load({id:a,groupId:i,level:null,responseType:"text",type:Xt.SUBTITLE_TRACK,url:o,deliveryDirectives:E})},t.load=function(e){var t,a,i,o=this,E=this.hls.config,n=this.getInternalLoader(e);if(n){var _=n.context;if(_&&_.url===e.url&&_.level===e.level)return void y.trace("[playlist-loader]: playlist request ongoing");y.log("[playlist-loader]: aborting previous loader for type: "+e.type),n.abort()}if(a=e.type===Xt.MANIFEST?E.manifestLoadPolicy.default:T({},E.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),n=this.createInternalLoader(e),C(null==(t=e.deliveryDirectives)?void 0:t.part)&&(e.type===Xt.LEVEL&&null!==e.level?i=this.hls.levels[e.level].details:e.type===Xt.AUDIO_TRACK&&null!==e.id?i=this.hls.audioTracks[e.id].details:e.type===Xt.SUBTITLE_TRACK&&null!==e.id&&(i=this.hls.subtitleTracks[e.id].details),i)){var r=i.partTarget,S=i.targetduration;if(r&&S){var s=1e3*Math.max(3*r,.8*S);a=T({},a,{maxTimeToFirstByteMs:Math.min(s,a.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(s,a.maxTimeToFirstByteMs)})}}var l=a.errorRetry||a.timeoutRetry||{},I={loadPolicy:a,timeout:a.maxLoadTimeMs,maxRetry:l.maxNumRetry||0,retryDelay:l.retryDelayMs||0,maxRetryDelay:l.maxRetryDelayMs||0},A={onSuccess:function(e,t,a,i){var E=o.getInternalLoader(a);o.resetInternalLoader(a.type);var n=e.data;0===n.indexOf("#EXTM3U")?(t.parsing.start=performance.now(),Vt.isMediaPlaylist(n)?o.handleTrackOrLevelPlaylist(e,t,a,i||null,E):o.handleMasterPlaylist(e,t,a,i)):o.handleManifestParsingError(e,a,new Error("no EXTM3U delimiter"),i||null,t)},onError:function(e,t,a,i){o.handleNetworkError(t,a,!1,e,i)},onTimeout:function(e,t,a){o.handleNetworkError(t,a,!0,void 0,e)}};n.load(e,I,A)},t.handleMasterPlaylist=function(e,t,a,i){var o=this.hls,E=e.data,n=Jt(e,a),_=Vt.parseMasterPlaylist(E,n);if(_.playlistParsingError)this.handleManifestParsingError(e,a,_.playlistParsingError,i,t);else{var r=_.contentSteering,T=_.levels,S=_.sessionData,s=_.sessionKeys,l=_.startTimeOffset,I=_.variableList;this.variableList=I;var A=Vt.parseMasterPlaylistMedia(E,n,_),O=A.AUDIO,u=void 0===O?[]:O,d=A.SUBTITLES,N=A["CLOSED-CAPTIONS"];u.length&&(u.some(function(e){return!e.url})||!T[0].audioCodec||T[0].attrs.AUDIO||(y.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),u.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new F({}),bitrate:0,url:""}))),o.trigger(P.MANIFEST_LOADED,{levels:T,audioTracks:u,subtitles:d,captions:N,contentSteering:r,url:n,stats:t,networkDetails:i,sessionData:S,sessionKeys:s,startTimeOffset:l,variableList:I})}},t.handleTrackOrLevelPlaylist=function(e,t,a,i,o){var E=this.hls,n=a.id,_=a.level,r=a.type,T=Jt(e,a),S=0,s=C(_)?_:C(n)?n:0,l=qt(a),I=Vt.parseLevelPlaylist(e.data,T,s,l,S,this.variableList);if(r===Xt.MANIFEST){var A={attrs:new F({}),bitrate:0,details:I,name:"",url:T};E.trigger(P.MANIFEST_LOADED,{levels:[A],audioTracks:[],url:T,stats:t,networkDetails:i,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),a.levelDetails=I,this.handlePlaylistLoaded(I,e,t,a,i,o)},t.handleManifestParsingError=function(e,t,a,i,o){this.hls.trigger(P.ERROR,{type:B.NETWORK_ERROR,details:f.MANIFEST_PARSING_ERROR,fatal:t.type===Xt.MANIFEST,url:e.url,err:a,error:a,reason:a.message,response:e,context:t,networkDetails:i,stats:o})},t.handleNetworkError=function(e,t,a,o,E){void 0===a&&(a=!1);var n="A network "+(a?"timeout":"error"+(o?" (status "+o.code+")":""))+" occurred while loading "+e.type;e.type===Xt.LEVEL?n+=": "+e.level+" id: "+e.id:e.type!==Xt.AUDIO_TRACK&&e.type!==Xt.SUBTITLE_TRACK||(n+=" id: "+e.id+' group-id: "'+e.groupId+'"');var _=new Error(n);y.warn("[playlist-loader]: "+n);var r=f.UNKNOWN,T=!1,S=this.getInternalLoader(e);switch(e.type){case Xt.MANIFEST:r=a?f.MANIFEST_LOAD_TIMEOUT:f.MANIFEST_LOAD_ERROR,T=!0;break;case Xt.LEVEL:r=a?f.LEVEL_LOAD_TIMEOUT:f.LEVEL_LOAD_ERROR,T=!1;break;case Xt.AUDIO_TRACK:r=a?f.AUDIO_TRACK_LOAD_TIMEOUT:f.AUDIO_TRACK_LOAD_ERROR,T=!1;break;case Xt.SUBTITLE_TRACK:r=a?f.SUBTITLE_TRACK_LOAD_TIMEOUT:f.SUBTITLE_LOAD_ERROR,T=!1}S&&this.resetInternalLoader(e.type);var s={type:B.NETWORK_ERROR,details:r,fatal:T,url:e.url,loader:S,context:e,error:_,networkDetails:t,stats:E};if(o){var l=(null==t?void 0:t.url)||e.url;s.response=i({url:l,data:void 0},o)}this.hls.trigger(P.ERROR,s)},t.handlePlaylistLoaded=function(e,t,a,i,o,E){var n=this.hls,_=i.type,r=i.level,T=i.id,S=i.groupId,s=i.deliveryDirectives,l=Jt(t,i),I=qt(i),A="number"==typeof i.level&&I===$t.MAIN?r:void 0;if(e.fragments.length){e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));var O=e.playlistParsingError;if(O)n.trigger(P.ERROR,{type:B.NETWORK_ERROR,details:f.LEVEL_PARSING_ERROR,fatal:!1,url:l,error:O,reason:O.message,response:t,context:i,level:A,parent:I,networkDetails:o,stats:a});else switch(e.live&&E&&(E.getCacheAge&&(e.ageHeader=E.getCacheAge()||0),E.getCacheAge&&!isNaN(e.ageHeader)||(e.ageHeader=0)),_){case Xt.MANIFEST:case Xt.LEVEL:n.trigger(P.LEVEL_LOADED,{details:e,level:A||0,id:T||0,stats:a,networkDetails:o,deliveryDirectives:s});break;case Xt.AUDIO_TRACK:n.trigger(P.AUDIO_TRACK_LOADED,{details:e,id:T||0,groupId:S||"",stats:a,networkDetails:o,deliveryDirectives:s});break;case Xt.SUBTITLE_TRACK:n.trigger(P.SUBTITLE_TRACK_LOADED,{details:e,id:T||0,groupId:S||"",stats:a,networkDetails:o,deliveryDirectives:s})}}else{var u=new Error("No Segments found in Playlist");n.trigger(P.ERROR,{type:B.NETWORK_ERROR,details:f.LEVEL_EMPTY_ERROR,fatal:!1,url:l,error:u,reason:u.message,response:t,context:i,level:A,parent:I,networkDetails:o,stats:a})}},e})();function ea(e,t){var a;try{a=new Event("addtrack")}catch(e){(a=document.createEvent("Event")).initEvent("addtrack",!1,!1)}a.track=e,t.dispatchEvent(a)}function ta(e,t){var a=e.mode;if("disabled"===a&&(e.mode="hidden"),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw new Error("addCue is failed for: "+t)}catch(a){y.debug("[texttrack-utils]: "+a);try{var i=new self.TextTrackCue(t.startTime,t.endTime,t.text);i.id=t.id,e.addCue(i)}catch(e){y.debug("[texttrack-utils]: Legacy TextTrackCue fallback failed: "+e)}}"disabled"===a&&(e.mode=a)}function aa(e){var t=e.mode;if("disabled"===t&&(e.mode="hidden"),e.cues)for(var a=e.cues.length;a--;)e.removeCue(e.cues[a]);"disabled"===t&&(e.mode=t)}function ia(e,t,a,i){var o=e.mode;if("disabled"===o&&(e.mode="hidden"),e.cues&&e.cues.length>0)for(var E=Ea(e.cues,t,a),n=0;ne[a].endTime)return-1;for(var i=0,o=a;i<=o;){var E=Math.floor((o+i)/2);if(te[E].startTime&&i-1)for(var E=o,n=e.length;E=t&&_.endTime<=a)i.push(_);else if(_.startTime>a)return i}return i}function na(e){for(var t=[],a=0;asa&&(s=sa),s-S<=0&&(s=S+ra);for(var l=0;lt.startDate&&(!e||t.startDate.05&&this.forwardBufferLength>1){var r=Math.min(2,Math.max(1,E)),T=Math.round(2/(1+Math.exp(-.75*_-this.edgeStalled))*20)/20;e.playbackRate=Math.min(r,Math.max(1,T))}else 1!==e.playbackRate&&0!==e.playbackRate&&(e.playbackRate=1)}}}}},t.estimateLiveEdge=function(){var e=this.levelDetails;return null===e?null:e.edge+e.age},t.computeLatency=function(){var e=this.estimateLiveEdge();return null===e?null:e-this.currentTime},_(e,[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var e=this.config,t=this.levelDetails;return void 0!==e.liveMaxLatencyDuration?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}},{key:"targetLatency",get:function(){var e=this.levelDetails;if(null===e)return null;var t=e.holdBack,a=e.partHoldBack,i=e.targetduration,o=this.config,E=o.liveSyncDuration,n=o.liveSyncDurationCount,_=o.lowLatencyMode,r=this.hls.userConfig,T=_&&a||t;(r.liveSyncDuration||r.liveSyncDurationCount||0===T)&&(T=void 0!==E?E:n*i);var S=i,s=1;return T+Math.min(this.stallCount*s,S)}},{key:"liveSyncPosition",get:function(){var e=this.estimateLiveEdge(),t=this.targetLatency,a=this.levelDetails;if(null===e||null===t||null===a)return null;var i=a.edge,o=e-t-this.edgeStalled,E=i-a.totalduration,n=i-(this.config.lowLatencyMode&&a.partTarget||a.targetduration);return Math.min(Math.max(E,o),n)}},{key:"drift",get:function(){var e=this.levelDetails;return null===e?1:e.drift}},{key:"edgeStalled",get:function(){var e=this.levelDetails;if(null===e)return 0;var t=3*(this.config.lowLatencyMode&&e.partTarget||e.targetduration);return Math.max(e.age-t,0)}},{key:"forwardBufferLength",get:function(){var e=this.media,t=this.levelDetails;if(!e||!t)return 0;var a=e.buffered.length;return(a?e.buffered.end(a-1):t.edge)-this.currentTime}}]),e})(),ua=["NONE","TYPE-0","TYPE-1",null];function da(e){return ua.indexOf(e)>-1}var Na=["SDR","PQ","HLG"];function Ra(e){return!!e&&Na.indexOf(e)>-1}var ca={No:"",Yes:"YES",v2:"v2"};function ma(e,t){var a=e.canSkipUntil,i=e.canSkipDateRanges,o=e.endSN;return a&&(void 0!==t?t-o:0)e.sn?(o=a-e.start,i=e):(o=e.start-a,i=t),i.duration!==o&&(i.duration=o)}else t.sn>e.sn?e.cc===t.cc&&e.minEndPTS?t.start=e.start+(e.minEndPTS-e.start):t.start=e.start+e.duration:t.start=Math.max(e.start-t.duration,0)}function ha(e,t,a,i,o,E){i-a<=0&&(y.warn("Fragment should have a positive duration",t),i=a+t.duration,E=o+t.duration);var n=a,_=i,r=t.startPTS,T=t.endPTS;if(C(r)){var S=Math.abs(r-a);C(t.deltaPTS)?t.deltaPTS=Math.max(S,t.deltaPTS):t.deltaPTS=S,n=Math.max(a,r),a=Math.min(a,r),o=Math.min(o,t.startDTS),_=Math.min(i,T),i=Math.max(i,T),E=Math.max(E,t.endDTS)}var s=a-t.start;0!==t.start&&(t.start=a),t.duration=i-t.start,t.startPTS=a,t.maxStartPTS=n,t.startDTS=o,t.endPTS=i,t.minEndPTS=_,t.endDTS=E;var l,I=t.sn;if(!e||Ie.endSN)return 0;var A=I-e.startSN,O=e.fragments;for(O[A]=t,l=A;l>0;l--)pa(O[l],O[l-1]);for(l=A;l=0;o--){var E=i[o].initSegment;if(E){a=E;break}}e.fragmentHint&&delete e.fragmentHint.endPTS;var n,_=0;if(ga(e,t,function(e,i){e.relurl&&(_=e.cc-i.cc),C(e.startPTS)&&C(e.endPTS)&&(i.start=i.startPTS=e.startPTS,i.startDTS=e.startDTS,i.maxStartPTS=e.maxStartPTS,i.endPTS=e.endPTS,i.endDTS=e.endDTS,i.minEndPTS=e.minEndPTS,i.duration=e.endPTS-e.startPTS,i.duration&&(n=i),t.PTSKnown=t.alignedSliding=!0),i.elementaryStreams=e.elementaryStreams,i.loader=e.loader,i.stats=e.stats,e.initSegment&&(i.initSegment=e.initSegment,a=e.initSegment)}),a&&(t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments).forEach(function(e){var t;!e||e.initSegment&&e.initSegment.relurl!==(null==(t=a)?void 0:t.relurl)||(e.initSegment=a)}),t.skippedSegments)if(t.deltaUpdateFailed=t.fragments.some(function(e){return!e}),t.deltaUpdateFailed){y.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var r=t.skippedSegments;r--;)t.fragments.shift();t.startSN=t.fragments[0].sn,t.startCC=t.fragments[0].cc}else t.canSkipDateRanges&&(t.dateRanges=Ba(e.dateRanges,t.dateRanges,t.recentlyRemovedDateranges));var T=t.fragments;if(_){y.warn("discontinuity sliding from playlist, take drift into account");for(var S=0;S=i.length||Ma(t,i[a].start)}function Ma(e,t){if(t){for(var a=e.fragments,i=e.skippedSegments;it){var E=1e3*i[i.length-1].duration;E499)}var za={search:function(e,t){for(var a=0,i=e.length-1,o=null,E=null;a<=i;){var n=t(E=e[o=(a+i)/2|0]);if(n>0)a=o+1;else{if(!(n<0))return E;i=o-1}}return null}};function Ka(e,t,a){if(null===t||!Array.isArray(e)||!e.length||!C(t))return null;if(t<(e[0].programDateTime||0))return null;if(t>=(e[e.length-1].endProgramDateTime||0))return null;a=a||0;for(var i=0;i0&&E<15e-7&&(a+=15e-7)}else 0===a&&0===t[0].start&&(o=t[0]);if(o&&(!e||e.level===o.level)&&0===xa(a,i,o))return o;var n=za.search(t,xa.bind(null,a,i));return!n||n===e&&o?o:n}function xa(e,t,a){if(void 0===e&&(e=0),void 0===t&&(t=0),a.start<=e&&a.start+a.duration>e)return 0;var i=Math.min(t,a.duration+(a.deltaPTS?a.deltaPTS:0));return a.start+a.duration-i<=e?1:a.start-i>e&&a.start?-1:0}function Qa(e,t,a){var i=1e3*Math.min(t,a.duration+(a.deltaPTS?a.deltaPTS:0));return(a.endProgramDateTime||0)-i>e}function Xa(e,t){return za.search(e,function(e){return e.cct?-1:0})}var $a={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},qa={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4},Ja=(function(){function e(e){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=e,this.log=y.log.bind(y,"[info]:"),this.warn=y.warn.bind(y,"[warning]:"),this.error=y.error.bind(y,"[error]:"),this.registerListeners()}var t=e.prototype;return t.registerListeners=function(){var e=this.hls;e.on(P.ERROR,this.onError,this),e.on(P.MANIFEST_LOADING,this.onManifestLoading,this),e.on(P.LEVEL_UPDATED,this.onLevelUpdated,this)},t.unregisterListeners=function(){var e=this.hls;e&&(e.off(P.ERROR,this.onError,this),e.off(P.ERROR,this.onErrorOut,this),e.off(P.MANIFEST_LOADING,this.onManifestLoading,this),e.off(P.LEVEL_UPDATED,this.onLevelUpdated,this))},t.destroy=function(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}},t.startLoad=function(e){},t.stopLoad=function(){this.playlistError=0},t.getVariantLevelIndex=function(e){return(null==e?void 0:e.type)===$t.MAIN?e.level:this.hls.loadLevel},t.onManifestLoading=function(){this.playlistError=0,this.penalizedRenditions={}},t.onLevelUpdated=function(){this.playlistError=0},t.onError=function(e,t){var a,i;if(!t.fatal){var o=this.hls,E=t.context;switch(t.details){case f.FRAG_LOAD_ERROR:case f.FRAG_LOAD_TIMEOUT:case f.KEY_LOAD_ERROR:case f.KEY_LOAD_TIMEOUT:return void(t.errorAction=this.getFragRetryOrSwitchAction(t));case f.FRAG_PARSING_ERROR:if(null!=(a=t.frag)&&a.gap)return void(t.errorAction={action:$a.DoNothing,flags:qa.None});case f.FRAG_GAP:case f.FRAG_DECRYPT_ERROR:return t.errorAction=this.getFragRetryOrSwitchAction(t),void(t.errorAction.action=$a.SendAlternateToPenaltyBox);case f.LEVEL_EMPTY_ERROR:case f.LEVEL_PARSING_ERROR:var n,_,r=t.parent===$t.MAIN?t.level:o.loadLevel;return void(t.details===f.LEVEL_EMPTY_ERROR&&null!=(n=t.context)&&null!=(_=n.levelDetails)&&_.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,r)));case f.LEVEL_LOAD_ERROR:case f.LEVEL_LOAD_TIMEOUT:return void("number"==typeof(null==E?void 0:E.level)&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,E.level)));case f.AUDIO_TRACK_LOAD_ERROR:case f.AUDIO_TRACK_LOAD_TIMEOUT:case f.SUBTITLE_LOAD_ERROR:case f.SUBTITLE_TRACK_LOAD_TIMEOUT:if(E){var T=o.levels[o.loadLevel];if(T&&(E.type===Xt.AUDIO_TRACK&&T.hasAudioGroup(E.groupId)||E.type===Xt.SUBTITLE_TRACK&&T.hasSubtitleGroup(E.groupId)))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o.loadLevel),t.errorAction.action=$a.SendAlternateToPenaltyBox,void(t.errorAction.flags=qa.MoveAllAlternatesMatchingHost)}return;case f.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:var S=o.levels[o.loadLevel],s=null==S?void 0:S.attrs["HDCP-LEVEL"];return void(s?t.errorAction={action:$a.SendAlternateToPenaltyBox,flags:qa.MoveAllAlternatesMatchingHDCP,hdcpLevel:s}:this.keySystemError(t));case f.BUFFER_ADD_CODEC_ERROR:case f.REMUX_ALLOC_ERROR:case f.BUFFER_APPEND_ERROR:return void(t.errorAction=this.getLevelSwitchAction(t,null!=(i=t.level)?i:o.loadLevel));case f.INTERNAL_EXCEPTION:case f.BUFFER_APPENDING_ERROR:case f.BUFFER_FULL_ERROR:case f.LEVEL_SWITCH_ERROR:case f.BUFFER_STALLED_ERROR:case f.BUFFER_SEEK_OVER_HOLE:case f.BUFFER_NUDGE_ON_STALL:return void(t.errorAction={action:$a.DoNothing,flags:qa.None})}t.type===B.KEY_SYSTEM_ERROR&&this.keySystemError(t)}},t.keySystemError=function(e){var t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)},t.getPlaylistRetryOrSwitchAction=function(e,t){var a=Fa(this.hls.config.playlistLoadPolicy,e),i=this.playlistError++;if(Ya(a,i,ka(e),e.response))return{action:$a.RetryRequest,flags:qa.None,retryConfig:a,retryCount:i};var o=this.getLevelSwitchAction(e,t);return a&&(o.retryConfig=a,o.retryCount=i),o},t.getFragRetryOrSwitchAction=function(e){var t=this.hls,a=this.getVariantLevelIndex(e.frag),i=t.levels[a],o=t.config,E=o.fragLoadPolicy,n=o.keyLoadPolicy,_=Fa(e.details.startsWith("key")?n:E,e),r=t.levels.reduce(function(e,t){return e+t.fragmentError},0);if(i&&(e.details!==f.FRAG_GAP&&i.fragmentError++,Ya(_,r,ka(e),e.response)))return{action:$a.RetryRequest,flags:qa.None,retryConfig:_,retryCount:r};var T=this.getLevelSwitchAction(e,a);return _&&(T.retryConfig=_,T.retryCount=r),T},t.getLevelSwitchAction=function(e,t){var a=this.hls;null==t&&(t=a.loadLevel);var i=this.hls.levels[t];if(i){var o,E,n=e.details;i.loadError++,n===f.BUFFER_APPEND_ERROR&&i.fragmentError++;var _=-1,r=a.levels,T=a.loadLevel,S=a.minAutoLevel,s=a.maxAutoLevel;a.autoLevelEnabled||(a.loadLevel=-1);for(var l,I=null==(o=e.frag)?void 0:o.type,A=(I===$t.AUDIO&&n===f.FRAG_PARSING_ERROR||"audio"===e.sourceBufferName&&(n===f.BUFFER_ADD_CODEC_ERROR||n===f.BUFFER_APPEND_ERROR))&&r.some(function(e){var t=e.audioCodec;return i.audioCodec!==t}),O="video"===e.sourceBufferName&&(n===f.BUFFER_ADD_CODEC_ERROR||n===f.BUFFER_APPEND_ERROR)&&r.some(function(e){var t=e.codecSet,a=e.audioCodec;return i.codecSet!==t&&i.audioCodec===a}),u=null!=(E=e.context)?E:{},d=u.type,N=u.groupId,R=function(){var t=(c+T)%r.length;if(t!==T&&t>=S&&t<=s&&0===r[t].loadError){var a,o,E=r[t];if(n===f.FRAG_GAP&&e.frag){var l=r[t].details;if(l){var u=ja(e.frag,l.fragments,e.frag.start);if(null!=u&&u.gap)return 0}}else{if(d===Xt.AUDIO_TRACK&&E.hasAudioGroup(N)||d===Xt.SUBTITLE_TRACK&&E.hasSubtitleGroup(N))return 0;if(I===$t.AUDIO&&null!=(a=i.audioGroups)&&a.some(function(e){return E.hasAudioGroup(e)})||I===$t.SUBTITLE&&null!=(o=i.subtitleGroups)&&o.some(function(e){return E.hasSubtitleGroup(e)})||A&&i.audioCodec===E.audioCodec||!A&&i.audioCodec!==E.audioCodec||O&&i.codecSet===E.codecSet)return 0}return _=t,1}},c=r.length;c--&&(0===(l=R())||1!==l););if(_>-1&&a.loadLevel!==_)return e.levelRetry=!0,this.playlistError=0,{action:$a.SendAlternateToPenaltyBox,flags:qa.None,nextAutoLevel:_}}return{action:$a.SendAlternateToPenaltyBox,flags:qa.MoveAllAlternatesMatchingHost}},t.onErrorOut=function(e,t){var a;switch(null==(a=t.errorAction)?void 0:a.action){case $a.DoNothing:break;case $a.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===f.FRAG_GAP?/MediaSource readyState: ended/.test(t.error.message)&&(this.warn('MediaSource ended after "'+t.sourceBufferName+'" sourceBuffer append error. Attempting to recover from media error.'),this.hls.recoverMediaError()):t.fatal=!0}t.fatal&&this.hls.stopLoad()},t.sendAlternateToPenaltyBox=function(e){var t=this.hls,a=e.errorAction;if(a){var i=a.flags,o=a.hdcpLevel,E=a.nextAutoLevel;switch(i){case qa.None:this.switchLevel(e,E);break;case qa.MoveAllAlternatesMatchingHDCP:o&&(t.maxHdcpLevel=ua[ua.indexOf(o)-1],a.resolved=!0),this.warn('Restricting playback to HDCP-LEVEL of "'+t.maxHdcpLevel+'" or lower')}a.resolved||this.switchLevel(e,E)}},t.switchLevel=function(e,t){void 0!==t&&e.errorAction&&(this.warn("switching to level "+t+" after "+e.details),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)},e})(),Za=(function(){function e(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=y.log.bind(y,t+":"),this.warn=y.warn.bind(y,t+":"),this.hls=e}var t=e.prototype;return t.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},t.clearTimer=function(){-1!==this.timer&&(self.clearTimeout(this.timer),this.timer=-1)},t.startLoad=function(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()},t.stopLoad=function(){this.canLoad=!1,this.clearTimer()},t.switchParams=function(e,t){var a=null==t?void 0:t.renditionReports;if(a){for(var i=-1,o=0;o=0&&S>t.partTarget&&(T+=1)}return new La(r,T>=0?T:void 0,ca.No)}}},t.loadPlaylist=function(e){-1===this.requestScheduled&&(this.requestScheduled=self.performance.now())},t.shouldLoadPlaylist=function(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)},t.shouldReloadPlaylist=function(e){return-1===this.timer&&-1===this.requestScheduled&&this.shouldLoadPlaylist(e)},t.playlistLoaded=function(e,t,a){var i=this,o=t.details,E=t.stats,n=self.performance.now(),_=E.loading.first?Math.max(0,n-E.loading.first):0;if(o.advancedDateTime=Date.now()-_,o.live||null!=a&&a.live){if(o.reloaded(a),a&&this.log("live playlist "+e+" "+(o.advanced?"REFRESHED "+o.lastPartSn+"-"+o.lastPartIndex:o.updated?"UPDATED":"MISSED")),a&&o.fragments.length>0&&Pa(a,o),!this.canLoad||!o.live)return;var r,T=void 0,S=void 0;if(o.canBlockReload&&o.endSN&&o.advanced){var s=this.hls.config.lowLatencyMode,l=o.lastPartSn,I=o.endSN,A=o.lastPartIndex,O=l===I;-1!==A?(T=O?I+1:l,S=O?s?0:A:A+1):T=I+1;var u=o.age,d=u+o.ageHeader,N=Math.min(d-o.partTarget,1.5*o.targetduration);if(N>0){if(a&&N>a.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+a.tuneInGoal+" to: "+N+" with playlist age: "+o.age),N=0;else{var R=Math.floor(N/o.targetduration);T+=R,void 0!==S&&(S+=Math.round(N%o.targetduration/o.partTarget)),this.log("CDN Tune-in age: "+o.ageHeader+"s last advanced "+u.toFixed(2)+"s goal: "+N+" skip sn "+R+" to part "+S)}o.tuneInGoal=N}if(r=this.getDeliveryDirectives(o,t.deliveryDirectives,T,S),s||!O)return void this.loadPlaylist(r)}else(o.canBlockReload||o.canSkipUntil)&&(r=this.getDeliveryDirectives(o,t.deliveryDirectives,T,S));var c=this.hls.mainForwardBufferInfo,m=c?c.end-c.len:0,L=Wa(o,1e3*(o.edge-m));o.updated&&n>this.requestScheduled+L&&(this.requestScheduled=E.loading.start),void 0!==T&&o.canBlockReload?this.requestScheduled=E.loading.first+L-(1e3*o.partTarget||1e3):-1===this.requestScheduled||this.requestScheduled+L=T.maxNumRetry)return!1;if(i&&null!=(s=e.context)&&s.deliveryDirectives)this.warn("Retrying playlist loading "+(r+1)+"/"+T.maxNumRetry+' after "'+a+'" without delivery-directives'),this.loadPlaylist();else{var l=Va(T,r);this.timer=self.setTimeout(function(){return t.loadPlaylist()},l),this.warn("Retrying playlist loading "+(r+1)+"/"+T.maxNumRetry+' after "'+a+'" in '+l+"ms")}e.levelRetry=!0,o.resolved=!0}return S},e})(),ei=(function(){function e(e,t,a){void 0===t&&(t=0),void 0===a&&(a=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=a}var t=e.prototype;return t.sample=function(e,t){var a=Math.pow(this.alpha_,e);this.estimate_=t*(1-a)+a*this.estimate_,this.totalWeight_+=e},t.getTotalWeight=function(){return this.totalWeight_},t.getEstimate=function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_},e})(),ti=(function(){function e(e,t,a,i){void 0===i&&(i=100),this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=a,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new ei(e),this.fast_=new ei(t),this.defaultTTFB_=i,this.ttfb_=new ei(e)}var t=e.prototype;return t.update=function(e,t){var a=this.slow_,i=this.fast_,o=this.ttfb_;a.halfLife!==e&&(this.slow_=new ei(e,a.getEstimate(),a.getTotalWeight())),i.halfLife!==t&&(this.fast_=new ei(t,i.getEstimate(),i.getTotalWeight())),o.halfLife!==e&&(this.ttfb_=new ei(e,o.getEstimate(),o.getTotalWeight()))},t.sample=function(e,t){var a=(e=Math.max(e,this.minDelayMs_))/1e3,i=8*t/a;this.fast_.sample(a,i),this.slow_.sample(a,i)},t.sampleTTFB=function(e){var t=e/1e3,a=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(a,Math.max(e,5))},t.canEstimate=function(){return this.fast_.getTotalWeight()>=this.minWeight_},t.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},t.getEstimateTTFB=function(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_},t.destroy=function(){},e})(),ai={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},ii={};function oi(e,t,a,i,o,E){var n=e.audioCodec?e.audioGroups:null,_=null==E?void 0:E.audioCodec,r=null==E?void 0:E.channels,T=r?parseInt(r):_?1/0:2,S=null;if(null!=n&&n.length)try{S=1===n.length&&n[0]?t.groups[n[0]].channels:n.reduce(function(e,a){if(a){var i=t.groups[a];if(!i)throw new Error("Audio track group "+a+" not found");Object.keys(i.channels).forEach(function(t){e[t]=(e[t]||0)+i.channels[t]})}return e},{2:0})}catch(e){return!0}return void 0!==e.videoCodec&&(e.width>1920&&e.height>1088||e.height>1920&&e.width>1088||e.frameRate>Math.max(i,30)||"SDR"!==e.videoRange&&e.videoRange!==a||e.bitrate>Math.max(o,8e6))||!!S&&C(T)&&Object.keys(S).some(function(e){return parseInt(e)>T})}function Ei(e,t,a){var o=e.videoCodec,E=e.audioCodec;if(!o||!E||!a)return Promise.resolve(ai);var n={width:e.width,height:e.height,bitrate:Math.ceil(Math.max(.9*e.bitrate,e.averageBitrate)),framerate:e.frameRate||30},_=e.videoRange;"SDR"!==_&&(n.transferFunction=_.toLowerCase());var r=o.split(",").map(function(e){return{type:"media-source",video:i(i({},n),{},{contentType:ht(e,"video")})}});return E&&e.audioGroups&&e.audioGroups.forEach(function(e){var a;e&&(null==(a=t.groups[e])||a.tracks.forEach(function(t){if(t.groupId===e){var a=t.channels||"",i=parseFloat(a);C(i)&&i>2&&r.push.apply(r,E.split(",").map(function(e){return{type:"media-source",audio:{contentType:ht(e,"audio"),channels:""+i}}}))}}))}),Promise.all(r.map(function(e){var t=ni(e);return ii[t]||(ii[t]=a.decodingInfo(e))})).then(function(e){return{supported:!e.some(function(e){return!e.supported}),configurations:r,decodingInfoResults:e}}).catch(function(e){return{supported:!1,configurations:r,decodingInfoResults:[],error:e}})}function ni(e){var t=e.audio,a=e.video,i=a||t;if(i){var o=i.contentType.split('"')[1];if(a)return"r"+a.height+"x"+a.width+"f"+Math.ceil(a.framerate)+(a.transferFunction||"sd")+"_"+o+"_"+Math.ceil(a.bitrate/1e5);if(t)return"c"+t.channels+(t.spatialRendering?"s":"n")+"_"+o}return""}function _i(){if("function"==typeof matchMedia){var e=matchMedia("(dynamic-range: high)"),t=matchMedia("bad query");if(e.media!==t.media)return!0===e.matches}return!1}function ri(e,t){var a=!1,i=[];return e&&(a="SDR"!==e,i=[e]),t&&(i=t.allowedVideoRanges||Na.slice(0),i=(a=void 0!==t.preferHDR?t.preferHDR:_i())?i.filter(function(e){return"SDR"!==e}):["SDR"]),{preferHDR:a,allowedVideoRanges:i}}function Ti(e,t,a,i,o){for(var E=Object.keys(e),n=null==i?void 0:i.channels,_=null==i?void 0:i.audioCodec,r=n&&2===parseInt(n),T=!0,S=!1,s=1/0,l=1/0,I=1/0,A=0,O=[],u=ri(t,o),d=u.preferHDR,N=u.allowedVideoRanges,R=function(){var t=e[E[c]];T=t.channels[2]>0,s=Math.min(s,t.minHeight),l=Math.min(l,t.minFramerate),I=Math.min(I,t.minBitrate);var a=N.filter(function(e){return t.videoRanges[e]>0});a.length>0&&(S=!0,O=a)},c=E.length;c--;)R();s=C(s)?s:0,l=C(l)?l:0;var m=Math.max(1080,s),L=Math.max(30,l);return I=C(I)?I:a,a=Math.max(I,a),S||(t=void 0,O=[]),{codecSet:E.reduce(function(t,i){var o=e[i];if(i===t)return t;if(o.minBitrate>a)return Si(i,"min bitrate of "+o.minBitrate+" > current estimate of "+a),t;if(!o.hasDefaultAudio)return Si(i,"no renditions with default or auto-select sound found"),t;if(_&&i.indexOf(_.substring(0,4))%5!=0)return Si(i,'audio codec preference "'+_+'" not found'),t;if(n&&!r){if(!o.channels[n])return Si(i,"no renditions with "+n+" channel sound found (channels options: "+Object.keys(o.channels)+")"),t}else if((!_||r)&&T&&0===o.channels[2])return Si(i,"no renditions with stereo sound found"),t;return o.minHeight>m?(Si(i,"min resolution of "+o.minHeight+" > maximum of "+m),t):o.minFramerate>L?(Si(i,"min framerate of "+o.minFramerate+" > maximum of "+L),t):O.some(function(e){return o.videoRanges[e]>0})?o.maxScore=Bt(t)||o.fragmentError>e[t].fragmentError)?t:(A=o.maxScore,i):(Si(i,"no variants with VIDEO-RANGE of "+JSON.stringify(O)+" found"),t)},void 0),videoRanges:O,preferHDR:d,minFramerate:l,minBitrate:I}}function Si(e,t){y.log('[abr] start candidates with "'+e+'" ignored because '+t)}function si(e){return e.reduce(function(e,t){var a=e.groups[t.groupId];a||(a=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),a.tracks.push(t);var i=t.channels||"2";return a.channels[i]=(a.channels[i]||0)+1,a.hasDefault=a.hasDefault||t.default,a.hasAutoSelect=a.hasAutoSelect||t.autoselect,a.hasDefault&&(e.hasDefaultAudio=!0),a.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function li(e,t,a,i){return e.slice(a,i+1).reduce(function(e,a){if(!a.codecSet)return e;var i=a.audioGroups,o=e[a.codecSet];o||(e[a.codecSet]=o={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!i,fragmentError:0}),o.minBitrate=Math.min(o.minBitrate,a.bitrate);var E=Math.min(a.height,a.width);return o.minHeight=Math.min(o.minHeight,E),o.minFramerate=Math.min(o.minFramerate,a.frameRate),o.maxScore=Math.max(o.maxScore,a.score),o.fragmentError+=a.fragmentError,o.videoRanges[a.videoRange]=(o.videoRanges[a.videoRange]||0)+1,i&&i.forEach(function(e){if(e){var a=t.groups[e];o.hasDefaultAudio=o.hasDefaultAudio||t.hasDefaultAudio?a.hasDefault:a.hasAutoSelect||!t.hasDefaultAudio&&!t.hasAutoSelectAudio,Object.keys(a.channels).forEach(function(e){o.channels[e]=(o.channels[e]||0)+a.channels[e]})}}),e},{})}function Ii(e,t,a){if("attrs"in e){var i=t.indexOf(e);if(-1!==i)return i}for(var o=0;o1&&(i=Math.max.apply(Math,n));var _=E.videoRange,r=E.frameRate,T=E.codecSet.substring(0,4),S=Ni(t,i,function(t){if(t.videoRange!==_||t.frameRate!==r||t.codecSet.substring(0,4)!==T)return!1;var i=t.audioGroups,E=a.filter(function(e){return!i||-1!==i.indexOf(e.groupId)});return Ii(e,E,o)>-1});return S>-1?S:Ni(t,i,function(t){var i=t.audioGroups,E=a.filter(function(e){return!i||-1!==i.indexOf(e.groupId)});return Ii(e,E,o)>-1})}function Ni(e,t,a){for(var i=t;i;i--)if(a(e[i]))return i;for(var o=t+1;o-1,d=t.getBwEstimate(),N=i.levels,R=N[e.level],c=_.total||Math.max(_.loaded,Math.round(r*R.averageBitrate/8)),m=u?T-O:T;m<1&&u&&(m=Math.min(T,8*_.loaded/d));var L=u?1e3*_.loaded/m:0,D=L?(c-_.loaded)/L:8*c/d+l/1e3;if(!(D<=A)){var p,h=L?8*L:d,B=Number.POSITIVE_INFINITY;for(p=e.level-1;p>S;p--){var f=N[p].maxBitrate;if((B=t.getTimeToLoadFrag(l/1e3,h,r*f,!N[p].details))=D||B>10*r)){i.nextLoadLevel=i.nextAutoLevel=p,u?t.bwEstimator.sample(T-Math.min(l,O),_.loaded):t.bwEstimator.sampleTTFB(T);var g=N[p].maxBitrate;t.getBwEstimate()*t.hls.config.abrBandWidthUpFactor>g&&t.resetEstimator(g),t.clearTimer(),y.warn("[abr] Fragment "+e.sn+(a?" part "+a.index:"")+" of level "+e.level+" is loading too slowly;\n Time to underbuffer: "+A.toFixed(3)+" s\n Estimated load time for current fragment: "+D.toFixed(3)+" s\n Estimated load time for down switch fragment: "+B.toFixed(3)+" s\n TTFB estimate: "+(0|O)+" ms\n Current BW estimate: "+(C(d)?0|d:"Unknown")+" bps\n New BW estimate: "+(0|t.getBwEstimate())+" bps\n Switching to level "+p+" @ "+(0|g)+" bps"),i.trigger(P.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:a,stats:_})}}}}}}},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}var t=e.prototype;return t.resetEstimator=function(e){e&&(y.log("setting initial bwe to "+e),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()},t.initEstimator=function(){var e=this.hls.config;return new ti(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)},t.registerListeners=function(){var e=this.hls;e.on(P.MANIFEST_LOADING,this.onManifestLoading,this),e.on(P.FRAG_LOADING,this.onFragLoading,this),e.on(P.FRAG_LOADED,this.onFragLoaded,this),e.on(P.FRAG_BUFFERED,this.onFragBuffered,this),e.on(P.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(P.LEVEL_LOADED,this.onLevelLoaded,this),e.on(P.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(P.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(P.ERROR,this.onError,this)},t.unregisterListeners=function(){var e=this.hls;e&&(e.off(P.MANIFEST_LOADING,this.onManifestLoading,this),e.off(P.FRAG_LOADING,this.onFragLoading,this),e.off(P.FRAG_LOADED,this.onFragLoaded,this),e.off(P.FRAG_BUFFERED,this.onFragBuffered,this),e.off(P.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(P.LEVEL_LOADED,this.onLevelLoaded,this),e.off(P.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(P.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(P.ERROR,this.onError,this))},t.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null},t.onManifestLoading=function(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()},t.onLevelsUpdated=function(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null},t.onMaxAutoLevelUpdated=function(){this.firstSelection=-1,this.nextAutoLevelKey=""},t.onFragLoading=function(e,t){var a,i=t.frag;this.ignoreFragment(i)||(i.bitrateTest||(this.fragCurrent=i,this.partCurrent=null!=(a=t.part)?a:null),this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100))},t.onLevelSwitching=function(e,t){this.clearTimer()},t.onError=function(e,t){if(!t.fatal)switch(t.details){case f.BUFFER_ADD_CODEC_ERROR:case f.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case f.FRAG_LOAD_TIMEOUT:var a=t.frag,i=this.fragCurrent,o=this.partCurrent;if(a&&i&&a.sn===i.sn&&a.level===i.level){var E=performance.now(),n=o?o.stats:a.stats,_=E-n.loading.start,r=n.loading.first?n.loading.first-n.loading.start:-1;if(n.loaded&&r>-1){var T=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(_-Math.min(T,r),n.loaded)}else this.bwEstimator.sampleTTFB(_)}}},t.getTimeToLoadFrag=function(e,t,a,i){return e+a/t+(i?this.lastLevelLoadSec:0)},t.onLevelLoaded=function(e,t){var a=this.hls.config,i=t.stats.loading,o=i.end-i.start;C(o)&&(this.lastLevelLoadSec=o/1e3),t.details.live?this.bwEstimator.update(a.abrEwmaSlowLive,a.abrEwmaFastLive):this.bwEstimator.update(a.abrEwmaSlowVoD,a.abrEwmaFastVoD)},t.onFragLoaded=function(e,t){var a=t.frag,i=t.part,o=i?i.stats:a.stats;if(a.type===$t.MAIN&&this.bwEstimator.sampleTTFB(o.loading.first-o.loading.start),!this.ignoreFragment(a)){if(this.clearTimer(),a.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){var E=i?i.duration:a.duration,n=this.hls.levels[a.level],_=(n.loaded?n.loaded.bytes:0)+o.loaded,r=(n.loaded?n.loaded.duration:0)+E;n.loaded={bytes:_,duration:r},n.realBitrate=Math.round(8*_/r)}if(a.bitrateTest){var T={stats:o,frag:a,part:i,id:a.type};this.onFragBuffered(P.FRAG_BUFFERED,T),a.bitrateTest=!1}else this.lastLoadedFragLevel=a.level}},t.onFragBuffered=function(e,t){var a=t.frag,i=t.part,o=null!=i&&i.stats.loaded?i.stats:a.stats;if(!o.aborted&&!this.ignoreFragment(a)){var E=o.parsing.end-o.loading.start-Math.min(o.loading.first-o.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(E,o.loaded),o.bwEstimate=this.getBwEstimate(),a.bitrateTest?this.bitrateTestDelay=E/1e3:this.bitrateTestDelay=0}},t.ignoreFragment=function(e){return e.type!==$t.MAIN||"initSegment"===e.sn},t.clearTimer=function(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)},t.getAutoLevelKey=function(){var e;return this.getBwEstimate()+"_"+(null==(e=this.hls.mainForwardBufferInfo)?void 0:e.len)},t.getNextABRAutoLevel=function(){var e=this.fragCurrent,t=this.partCurrent,a=this.hls,i=a.maxAutoLevel,o=a.config,E=a.minAutoLevel,n=a.media,_=t?t.duration:e?e.duration:0,r=n&&0!==n.playbackRate?Math.abs(n.playbackRate):1,T=this.getBwEstimate(),S=a.mainForwardBufferInfo,s=(S?S.len:0)/r,l=o.abrBandWidthFactor,I=o.abrBandWidthUpFactor;if(s){var A=this.findBestLevel(T,E,i,s,0,l,I);if(A>=0)return A}var O=_?Math.min(_,o.maxStarvationDelay):o.maxStarvationDelay;if(!s){var u=this.bitrateTestDelay;u&&(O=(_?Math.min(_,o.maxLoadingDelay):o.maxLoadingDelay)-u,y.info("[abr] bitrate test took "+Math.round(1e3*u)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*O)+" ms"),l=I=1)}var d=this.findBestLevel(T,E,i,s,O,l,I);if(y.info("[abr] "+(s?"rebuffering expected":"buffer is empty")+", optimal quality level "+d),d>-1)return d;var N=a.levels[E],R=a.levels[a.loadLevel];return(null==N?void 0:N.bitrate)<(null==R?void 0:R.bitrate)?E:a.loadLevel},t.getBwEstimate=function(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate},t.findBestLevel=function(e,t,a,i,o,E,n){var _,r=this,T=i+o,S=this.lastLoadedFragLevel,s=-1===S?this.hls.firstLevel:S,l=this.fragCurrent,I=this.partCurrent,A=this.hls,O=A.levels,u=A.allAudioTracks,d=A.loadLevel,N=A.config;if(1===O.length)return 0;var R,c=O[s],m=!(null==c||null==(_=c.details)||!_.live),L=-1===d||-1===S,D="SDR",p=(null==c?void 0:c.frameRate)||0,h=N.audioPreference,P=N.videoPreference,B=this.audioTracksByGroup||(this.audioTracksByGroup=si(u));if(L){if(-1!==this.firstSelection)return this.firstSelection;var f=Ti(this.codecTiers||(this.codecTiers=li(O,B,t,a)),D,e,h,P),g=f.codecSet,v=f.videoRanges,M=f.minFramerate,W=f.minBitrate,U=f.preferHDR;R=g,D=U?v[v.length-1]:v[0],p=M,e=Math.max(e,W),y.log("[abr] picked start tier "+JSON.stringify(f))}else R=null==c?void 0:c.codecSet,D=null==c?void 0:c.videoRange;for(var G,b=I?I.duration:l?l.duration:0,k=this.bwEstimator.getEstimateTTFB()/1e3,F=[],V=function(){var t,_=O[H],l=H>s;if(!_)return 0;if(N.useMediaCapabilities&&!_.supportedResult&&!_.supportedPromise){var A=navigator.mediaCapabilities;"function"==typeof(null==A?void 0:A.decodingInfo)&&oi(_,B,D,p,e,h)?(_.supportedPromise=Ei(_,B,A),_.supportedPromise.then(function(e){_.supportedResult=e;var t=r.hls.levels,a=t.indexOf(_);e.error?y.warn('[abr] MediaCapabilities decodingInfo error: "'+e.error+'" for level '+a+" "+JSON.stringify(e)):e.supported||(y.warn("[abr] Unsupported MediaCapabilities decodingInfo result for level "+a+" "+JSON.stringify(e)),a>-1&&t.length>1&&(y.log("[abr] Removing unsupported level "+a),r.hls.removeLevel(a)))})):_.supportedResult=ai}if(R&&_.codecSet!==R||D&&_.videoRange!==D||l&&p>_.frameRate||!l&&p>0&&p<_.frameRate||_.supportedResult&&(null==(t=_.supportedResult.decodingInfoResults)||!t[0].smooth))return F.push(H),0;var u,P=_.details,f=(I?null==P?void 0:P.partTarget:null==P?void 0:P.averagetargetduration)||b;u=l?n*e:E*e;var g=b&&i>=2*b&&0===o?O[H].averageBitrate:O[H].maxBitrate,v=r.getTimeToLoadFrag(k,u,g*f,void 0===P);if(u>=g&&(H===S||0===_.loadError&&0===_.fragmentError)&&(v<=k||!C(v)||m&&!r.bitrateTestDelay||v"+H+" adjustedbw("+Math.round(u)+")-bitrate="+Math.round(u-g)+" ttfb:"+k.toFixed(1)+" avgDuration:"+f.toFixed(1)+" maxFetchDuration:"+T.toFixed(1)+" fetchDuration:"+v.toFixed(1)+" firstSelection:"+L+" codecSet:"+R+" videoRange:"+D+" hls.loadLevel:"+d)),L&&(r.firstSelection=H),{v:H}}},H=a;H>=t;H--)if(0!==(G=V())&&G)return G.v;return-1},_(e,[{key:"firstAutoLevel",get:function(){var e=this.hls,t=e.maxAutoLevel,a=e.minAutoLevel,i=this.getBwEstimate(),o=this.hls.config.maxStarvationDelay,E=this.findBestLevel(i,a,t,0,o,1,1);if(E>-1)return E;var n=this.hls.firstLevel,_=Math.min(Math.max(n,a),t);return y.warn("[abr] Could not find best starting auto level. Defaulting to first in playlist "+n+" clamped to "+_),_}},{key:"forcedAutoLevel",get:function(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}},{key:"nextAutoLevel",get:function(){var e=this.forcedAutoLevel,t=this.bwEstimator.canEstimate(),a=this.lastLoadedFragLevel>-1;if(!(-1===e||t&&a&&this.nextAutoLevelKey!==this.getAutoLevelKey()))return e;var i=t&&a?this.getNextABRAutoLevel():this.firstAutoLevel;if(-1!==e){var o=this.hls.levels;if(o.length>Math.max(e,i)&&o[e].loadError<=o[i].loadError)return e}return this._nextAutoLevel=i,this.nextAutoLevelKey=this.getAutoLevelKey(),i},set:function(e){var t=this.hls,a=t.maxAutoLevel,i=t.minAutoLevel,o=Math.min(Math.max(e,i),a);this._nextAutoLevel!==o&&(this.nextAutoLevelKey="",this._nextAutoLevel=o)}}]),e})(),ci=(function(){function e(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var t=e.prototype;return t.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},t.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},t.onHandlerDestroyed=function(){},t.hasInterval=function(){return!!this._tickInterval},t.hasNextTick=function(){return!!this._tickTimer},t.setInterval=function(e){return!this._tickInterval&&(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)},t.clearInterval=function(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)},t.clearNextTick=function(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)},t.tick=function(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},t.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},t.doTick=function(){},e})(),mi={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"},Li=(function(){function e(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}var t=e.prototype;return t._registerListeners=function(){var e=this.hls;e.on(P.BUFFER_APPENDED,this.onBufferAppended,this),e.on(P.FRAG_BUFFERED,this.onFragBuffered,this),e.on(P.FRAG_LOADED,this.onFragLoaded,this)},t._unregisterListeners=function(){var e=this.hls;e.off(P.BUFFER_APPENDED,this.onBufferAppended,this),e.off(P.FRAG_BUFFERED,this.onFragBuffered,this),e.off(P.FRAG_LOADED,this.onFragLoaded,this)},t.destroy=function(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null},t.getAppendedFrag=function(e,t){var a=this.activePartLists[t];if(a)for(var i=a.length;i--;){var o=a[i];if(!o)break;var E=o.end;if(o.start<=e&&null!==E&&e<=E)return o}return this.getBufferedFrag(e,t)},t.getBufferedFrag=function(e,t){for(var a=this.fragments,i=Object.keys(a),o=i.length;o--;){var E=a[i[o]];if((null==E?void 0:E.body.type)===t&&E.buffered){var n=E.body;if(n.start<=e&&e<=n.end)return n}}return null},t.detectEvictedFragments=function(e,t,a,i){var o=this;this.timeRanges&&(this.timeRanges[e]=t);var E=(null==i?void 0:i.fragment.sn)||-1;Object.keys(this.fragments).forEach(function(i){var n=o.fragments[i];if(n&&!(E>=n.body.sn))if(n.buffered||n.loaded){var _=n.range[e];_&&_.time.some(function(e){var a=!o.isTimeBuffered(e.startPTS,e.endPTS,t);return a&&o.removeFragment(n.body),a})}else n.body.type===a&&o.removeFragment(n.body)})},t.detectPartialFragments=function(e){var t=this,a=this.timeRanges,i=e.frag,o=e.part;if(a&&"initSegment"!==i.sn){var E=Ci(i),n=this.fragments[E];if(!(!n||n.buffered&&i.gap)){var _=!i.relurl;Object.keys(a).forEach(function(e){var E=i.elementaryStreams[e];if(E){var r=a[e],T=_||!0===E.partial;n.range[e]=t.getBufferedTimes(i,o,T,r)}}),n.loaded=null,Object.keys(n.range).length?(n.buffered=!0,(n.body.endList=i.endList||n.body.endList)&&(this.endListFragments[n.body.type]=n),Di(n)||this.removeParts(i.sn-1,i.type)):this.removeFragment(n.body)}}},t.removeParts=function(e,t){var a=this.activePartLists[t];a&&(this.activePartLists[t]=a.filter(function(t){return t.fragment.sn>=e}))},t.fragBuffered=function(e,t){var a=Ci(e),i=this.fragments[a];!i&&t&&(i=this.fragments[a]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),i&&(i.loaded=null,i.buffered=!0)},t.getBufferedTimes=function(e,t,a,i){for(var o={time:[],partial:a},E=e.start,n=e.end,_=e.minEndPTS||n,r=e.maxStartPTS||E,T=0;T=S&&_<=s){o.time.push({startPTS:Math.max(E,i.start(T)),endPTS:Math.min(n,i.end(T))});break}if(ES){var l=Math.max(E,i.start(T)),I=Math.min(n,i.end(T));I>l&&(o.partial=!0,o.time.push({startPTS:l,endPTS:I}))}else if(n<=S)break}return o},t.getPartialFragment=function(e){var t,a,i,o=null,E=0,n=this.bufferPadding,_=this.fragments;return Object.keys(_).forEach(function(r){var T=_[r];T&&Di(T)&&(a=T.body.start-n,i=T.body.end+n,e>=a&&e<=i&&(t=Math.min(e-a,i-e),E<=t&&(o=T.body,E=t)))}),o},t.isEndListAppended=function(e){var t=this.endListFragments[e];return void 0!==t&&(t.buffered||Di(t))},t.getState=function(e){var t=Ci(e),a=this.fragments[t];return a?a.buffered?Di(a)?mi.PARTIAL:mi.OK:mi.APPENDING:mi.NOT_LOADED},t.isTimeBuffered=function(e,t,a){for(var i,o,E=0;E=i&&t<=o)return!0;if(t<=i)return!1}return!1},t.onFragLoaded=function(e,t){var a=t.frag,i=t.part;if("initSegment"!==a.sn&&!a.bitrateTest){var o=i?null:t,E=Ci(a);this.fragments[E]={body:a,appendedPTS:null,loaded:o,buffered:!1,range:Object.create(null)}}},t.onBufferAppended=function(e,t){var a=this,i=t.frag,o=t.part,E=t.timeRanges;if("initSegment"!==i.sn){var n=i.type;if(o){var _=this.activePartLists[n];_||(this.activePartLists[n]=_=[]),_.push(o)}this.timeRanges=E,Object.keys(E).forEach(function(e){var t=E[e];a.detectEvictedFragments(e,t,n,o)})}},t.onFragBuffered=function(e,t){this.detectPartialFragments(t)},t.hasFragment=function(e){var t=Ci(e);return!!this.fragments[t]},t.hasParts=function(e){var t;return!(null==(t=this.activePartLists[e])||!t.length)},t.removeFragmentsInRange=function(e,t,a,i,o){var E=this;i&&!this.hasGaps||Object.keys(this.fragments).forEach(function(n){var _=E.fragments[n];if(_){var r=_.body;r.type!==a||i&&!r.gap||r.starte&&(_.buffered||o)&&E.removeFragment(r)}})},t.removeFragment=function(e){var t=Ci(e);e.stats.loaded=0,e.clearElementaryStreamInfo();var a=this.activePartLists[e.type];if(a){var i=e.sn;this.activePartLists[e.type]=a.filter(function(e){return e.fragment.sn!==i})}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]},t.removeAllFragments=function(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1},e})();function Di(e){var t,a,i;return e.buffered&&(e.body.gap||(null==(t=e.range.video)?void 0:t.partial)||(null==(a=e.range.audio)?void 0:a.partial)||(null==(i=e.range.audiovideo)?void 0:i.partial))}function Ci(e){return e.type+"_"+e.level+"_"+e.sn}var pi={length:0,start:function(){return 0},end:function(){return 0}},hi=(function(){function e(){}return e.isBuffered=function(t,a){try{if(t)for(var i=e.getBuffered(t),o=0;o=i.start(o)&&a<=i.end(o))return!0}catch(e){}return!1},e.bufferInfo=function(t,a,i){try{if(t){var o,E=e.getBuffered(t),n=[];for(o=0;on&&(i[E-1].end=e[o].end):i.push(e[o])}else i.push(e[o])}else i=e;for(var _,r=0,T=t,S=t,s=0;s=l&&ta.startCC||e&&e.cc>>8^255&u^99,e[I]=u,t[u]=I;var d=l[I],N=l[d],R=l[N],c=257*l[u]^16843008*u;i[I]=c<<24|c>>>8,o[I]=c<<16|c>>>16,E[I]=c<<8|c>>>24,n[I]=c,c=16843009*R^65537*N^257*d^16843008*I,r[u]=c<<24|c>>>8,T[u]=c<<16|c>>>16,S[u]=c<<8|c>>>24,s[u]=c,I?(I=d^l[l[l[R^d]]],A^=l[l[A]]):I=A=1}},t.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),a=!0,i=0;in.end){var S=E>T;(E0&&null!=E&&E.key&&E.iv&&"AES-128"===E.method){var n=self.performance.now();return a.decrypter.decrypt(new Uint8Array(o),E.key.buffer,E.iv.buffer).catch(function(t){throw i.trigger(P.ERROR,{type:B.MEDIA_ERROR,details:f.FRAG_DECRYPT_ERROR,fatal:!1,error:t,reason:t.message,frag:e}),t}).then(function(o){var E=self.performance.now();return i.trigger(P.FRAG_DECRYPTED,{frag:e,payload:o,stats:{tstart:n,tdecrypt:E}}),t.payload=o,a.completeInitSegmentLoad(t)})}return a.completeInitSegmentLoad(t)}).catch(function(t){a.state!==Xi.STOPPED&&a.state!==Xi.ERROR&&(a.warn(t),a.resetFragmentLoading(e))})},a.completeInitSegmentLoad=function(e){if(!this.levels)throw new Error("init load aborted, missing levels");var t=e.frag.stats;this.state=Xi.IDLE,e.frag.data=new Uint8Array(e.payload),t.parsing.start=t.buffering.start=self.performance.now(),t.parsing.end=t.buffering.end=self.performance.now(),this.tick()},a.fragContextChanged=function(e){var t=this.fragCurrent;return!e||!t||e.sn!==t.sn||e.level!==t.level},a.fragBufferedComplete=function(e,t){var a,i,o,E,n=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log("Buffered "+e.type+" sn: "+e.sn+(t?" part: "+t.index:"")+" of "+(this.playlistType===$t.MAIN?"level":"track")+" "+e.level+" (frag:["+(null!=(a=e.startPTS)?a:NaN).toFixed(3)+"-"+(null!=(i=e.endPTS)?i:NaN).toFixed(3)+"] > buffer:"+(n?Qi.toString(hi.getBuffered(n)):"(detached)")+")"),"initSegment"!==e.sn){var _;if(e.type!==$t.SUBTITLE){var r=e.elementaryStreams;if(!Object.keys(r).some(function(e){return!!r[e]}))return void(this.state=Xi.IDLE)}var T=null==(_=this.levels)?void 0:_[e.level];null!=T&&T.fragmentError&&(this.log("Resetting level fragment error count of "+T.fragmentError+" on frag buffered"),T.fragmentError=0)}this.state=Xi.IDLE,n&&(!this.loadedmetadata&&e.type==$t.MAIN&&n.buffered.length&&(null==(o=this.fragCurrent)?void 0:o.sn)===(null==(E=this.fragPrevious)?void 0:E.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())},a.seekToStartPos=function(){},a._handleFragmentLoadComplete=function(e){var t=this.transmuxer;if(t){var a=e.frag,i=e.part,o=e.partsLoaded,E=!o||0===o.length||o.some(function(e){return!e}),n=new Pi(a.level,a.sn,a.stats.chunkCount+1,0,i?i.index:-1,!E);t.flush(n)}},a._handleFragmentLoadProgress=function(e){},a._doFragLoad=function(e,t,a,i){var o,E=this;void 0===a&&(a=null);var n=null==t?void 0:t.details;if(!this.levels||!n)throw new Error("frag load aborted, missing level"+(n?"":" detail")+"s");var _=null;if(!e.encrypted||null!=(o=e.decryptdata)&&o.key?!e.encrypted&&n.encryptedFragments.length&&this.keyLoader.loadClear(e,n.encryptedFragments):(this.log("Loading key for "+e.sn+" of ["+n.startSN+"-"+n.endSN+"], "+("[stream-controller]"===this.logPrefix?"level":"track")+" "+e.level),this.state=Xi.KEY_LOADING,this.fragCurrent=e,_=this.keyLoader.load(e).then(function(e){if(!E.fragContextChanged(e.frag))return E.hls.trigger(P.KEY_LOADED,e),E.state===Xi.KEY_LOADING&&(E.state=Xi.IDLE),e}),this.hls.trigger(P.KEY_LOADING,{frag:e}),null===this.fragCurrent&&(_=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))),a=Math.max(e.start,a||0),this.config.lowLatencyMode&&"initSegment"!==e.sn){var r=n.partList;if(r&&i){a>e.end&&n.fragmentHint&&(e=n.fragmentHint);var T=this.getNextPart(r,e,a);if(T>-1){var S,s=r[T];return this.log("Loading part sn: "+e.sn+" p: "+s.index+" cc: "+e.cc+" of playlist ["+n.startSN+"-"+n.endSN+"] parts [0-"+T+"-"+(r.length-1)+"] "+("[stream-controller]"===this.logPrefix?"level":"track")+": "+e.level+", target: "+parseFloat(a.toFixed(3))),this.nextLoadPosition=s.start+s.duration,this.state=Xi.FRAG_LOADING,S=_?_.then(function(a){return!a||E.fragContextChanged(a.frag)?null:E.doFragPartsLoad(e,s,t,i)}).catch(function(e){return E.handleFragLoadError(e)}):this.doFragPartsLoad(e,s,t,i).catch(function(e){return E.handleFragLoadError(e)}),this.hls.trigger(P.FRAG_LOADING,{frag:e,part:s,targetBufferTime:a}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):S}if(!e.url||this.loadedEndOfParts(r,a))return Promise.resolve(null)}}this.log("Loading fragment "+e.sn+" cc: "+e.cc+" "+(n?"of ["+n.startSN+"-"+n.endSN+"] ":"")+("[stream-controller]"===this.logPrefix?"level":"track")+": "+e.level+", target: "+parseFloat(a.toFixed(3))),C(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=Xi.FRAG_LOADING;var l,I=this.config.progressive;return l=I&&_?_.then(function(t){return!t||E.fragContextChanged(null==t?void 0:t.frag)?null:E.fragmentLoader.load(e,i)}).catch(function(e){return E.handleFragLoadError(e)}):Promise.all([this.fragmentLoader.load(e,I?i:void 0),_]).then(function(e){var t=e[0];return!I&&t&&i&&i(t),t}).catch(function(e){return E.handleFragLoadError(e)}),this.hls.trigger(P.FRAG_LOADING,{frag:e,targetBufferTime:a}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):l},a.doFragPartsLoad=function(e,t,a,i){var o=this;return new Promise(function(E,n){var _,r=[],T=null==(_=a.details)?void 0:_.partList;!(function t(_){o.fragmentLoader.loadPart(e,_,i).then(function(i){r[_.index]=i;var n=i.part;o.hls.trigger(P.FRAG_LOADED,i);var S=Ga(a,e.sn,_.index+1)||ya(T,e.sn,_.index+1);if(!S)return E({frag:e,part:n,partsLoaded:r});t(S)}).catch(n)})(t)})},a.handleFragLoadError=function(e){if("data"in e){var t=e.data;e.data&&t.details===f.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(P.ERROR,t)}else this.hls.trigger(P.ERROR,{type:B.OTHER_ERROR,details:f.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null},a._handleTransmuxerFlush=function(e){var t=this.getCurrentContext(e);if(t&&this.state===Xi.PARSING){var a=t.frag,i=t.part,o=t.level,E=self.performance.now();a.stats.parsing.end=E,i&&(i.stats.parsing.end=E),this.updateLevelTiming(a,i,o,e.partial)}else this.fragCurrent||this.state===Xi.STOPPED||this.state===Xi.ERROR||(this.state=Xi.IDLE)},a.getCurrentContext=function(e){var t=this.levels,a=this.fragCurrent,i=e.level,o=e.sn,E=e.part;if(null==t||!t[i])return this.warn("Levels object was unset while buffering fragment "+o+" of level "+i+". The current chunk will not be buffered."),null;var n=t[i],_=E>-1?Ga(n,o,E):null,r=_?_.fragment:Ua(n,o,a);return r?(a&&a!==r&&(r.stats=a.stats),{frag:r,part:_,level:n}):null},a.bufferFragmentData=function(e,t,a,i,o){var E;if(e&&this.state===Xi.PARSING){var n=e.data1,_=e.data2,r=n;if(n&&_&&(r=at(n,_)),null!=(E=r)&&E.length){var T={type:e.type,frag:t,part:a,chunkMeta:i,parent:t.type,data:r};if(this.hls.trigger(P.BUFFER_APPENDING,T),e.dropped&&e.independent&&!a){if(o)return;this.flushBufferGap(t)}}}},a.flushBufferGap=function(e){var t=this.media;if(t)if(hi.isBuffered(t,t.currentTime)){var a=t.currentTime,i=hi.bufferInfo(t,a,0),o=e.duration,E=Math.min(2*this.config.maxFragLookUpTolerance,.25*o),n=Math.max(Math.min(e.start-E,i.end-E),a+E);e.start-n>E&&this.flushMainBuffer(n,e.start)}else this.flushMainBuffer(0,e.start)},a.getFwdBufferInfo=function(e,t){var a=this.getLoadPosition();return C(a)?this.getFwdBufferInfoAtPos(e,a,t):null},a.getFwdBufferInfoAtPos=function(e,t,a){var i=this.config.maxBufferHole,o=hi.bufferInfo(e,t,i);if(0===o.len&&void 0!==o.nextStart){var E=this.fragmentTracker.getBufferedFrag(t,a);if(E&&o.nextStart=a&&(t.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+t.maxMaxBufferLength+"s"),!0)},a.getAppendedFrag=function(e,t){var a=this.fragmentTracker.getAppendedFrag(e,$t.MAIN);return a&&"fragment"in a?a.fragment:a},a.getNextFragment=function(e,t){var a=t.fragments,i=a.length;if(!i)return null;var o,E=this.config,n=a[0].start;if(t.live){var _=E.initialLiveManifestSize;if(i<_)return this.warn("Not enough fragments to start playback (have: "+i+", need: "+_+")"),null;(!t.PTSKnown&&!this.startFragRequested&&-1===this.startPosition||et},a.getNextFragmentLoopLoading=function(e,t,a,i,o){var E=e.gap,n=this.getNextFragment(this.nextLoadPosition,t);if(null===n)return n;if(e=n,E&&e&&!e.gap&&a.nextStart){var _=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,a.nextStart,i);if(null!==_&&a.len+_.len>=o)return this.log('buffer full after gaps in "'+i+'" playlist starting at sn: '+e.sn),null}return e},a.mapToInitFragWhenRequired=function(e){return null==e||!e.initSegment||null!=e&&e.initSegment.data||this.bitrateTest?e:e.initSegment},a.getNextPart=function(e,t,a){for(var i=-1,o=!1,E=!0,n=0,_=e.length;n<_;n++){var r=e[n];if(E=E&&!r.independent,i>-1&&aa.start&&a.loaded},a.getInitialLiveFragment=function(e,t){var a=this.fragPrevious,i=null;if(a){if(e.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+a.programDateTime),i=Ka(t,a.endProgramDateTime,this.config.maxFragLookUpTolerance)),!i){var o=a.sn+1;if(o>=e.startSN&&o<=e.endSN){var E=t[o-e.startSN];a.cc===E.cc&&(i=E,this.log("Live playlist, switching playlist, load frag with next SN: "+i.sn))}i||(i=Xa(t,a.cc))&&this.log("Live playlist, switching playlist, load frag with same CC: "+i.sn)}}else{var n=this.hls.liveSyncPosition;null!==n&&(i=this.getFragmentAtPosition(n,this.bitrateTest?e.fragmentEnd:e.edge,e))}return i},a.getFragmentAtPosition=function(e,t,a){var i,o=this.config,E=this.fragPrevious,n=a.fragments,_=a.endSN,r=a.fragmentHint,T=o.maxFragLookUpTolerance,S=a.partList,s=!!(o.lowLatencyMode&&null!=S&&S.length&&r);if(s&&r&&!this.bitrateTest&&(n=n.concat(r),_=r.sn),i=et-T?0:T):n[n.length-1]){var l=i.sn-a.startSN,I=this.fragmentTracker.getState(i);if((I===mi.OK||I===mi.PARTIAL&&i.gap)&&(E=i),E&&i.sn===E.sn&&(!s||S[0].fragment.sn>i.sn)&&E&&i.level===E.level){var A=n[l+1];i=i.sn<_&&this.fragmentTracker.getState(A)!==mi.OK?A:null}}return i},a.synchronizeToLiveEdge=function(e){var t=this.config,a=this.media;if(a){var i=this.hls.liveSyncPosition,o=a.currentTime,E=e.fragments[0].start,n=e.edge,_=o>=E-t.maxFragLookUpTolerance&&o<=n;if(null!==i&&a.duration>i&&(o"+e.startSN+" prev-sn: "+(_?_.sn:"na")+" fragments: "+i),r}return o},a.waitForCdnTuneIn=function(e){var t=3;return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*t)},a.setStartPosition=function(e,t){var a=this.startPosition;if(a "+(null==(o=this.fragCurrent)?void 0:o.url))}else{var E=t.details===f.FRAG_GAP;E&&this.fragmentTracker.fragBuffered(i,!0);var n=t.errorAction,_=n||{},r=_.action,T=_.retryCount,S=void 0===T?0:T,s=_.retryConfig;if(n&&r===$a.RetryRequest&&s){this.resetStartWhenNotLoaded(this.levelLastLoaded);var l=Va(s,S);this.warn("Fragment "+i.sn+" of "+e+" "+i.level+" errored with "+t.details+", retrying loading "+(S+1)+"/"+s.maxNumRetry+" in "+l+"ms"),n.resolved=!0,this.retryDate=self.performance.now()+l,this.state=Xi.FRAG_LOADING_WAITING_RETRY}else if(s&&n){if(this.resetFragmentErrors(e),!(S.5;i&&this.reduceMaxBufferLength(a.len);var o=!i;return o&&this.warn("Buffer full error while media.currentTime is not buffered, flush "+t+" buffer"),e.frag&&(this.fragmentTracker.removeFragment(e.frag),this.nextLoadPosition=e.frag.start),this.resetLoadingState(),o}return!1},a.resetFragmentErrors=function(e){e===$t.AUDIO&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==Xi.STOPPED&&(this.state=Xi.IDLE)},a.afterBufferFlushed=function(e,t,a){if(e){var i=hi.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,i,a),this.state===Xi.ENDED&&this.resetLoadingState()}},a.resetLoadingState=function(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=Xi.IDLE},a.resetStartWhenNotLoaded=function(e){if(!this.loadedmetadata){this.startFragRequested=!1;var t=e?e.details:null;null!=t&&t.live?(this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}},a.resetWhenMissingContext=function(e){this.warn("The loading context changed while buffering fragment "+e.sn+" of level "+e.level+". This chunk will not be buffered."),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()},a.removeUnbufferedFrags=function(e){void 0===e&&(e=0),this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)},a.updateLevelTiming=function(e,t,a,i){var o,E=this,n=a.details;if(n){if(!Object.keys(e.elementaryStreams).reduce(function(t,o){var _=e.elementaryStreams[o];if(_){var r=_.endPTS-_.startPTS;if(r<=0)return E.warn("Could not parse fragment "+e.sn+" "+o+" duration reliably ("+r+")"),t||!1;var T=i?0:ha(n,e,_.startPTS,_.endPTS,_.startDTS,_.endDTS);return E.hls.trigger(P.LEVEL_PTS_UPDATED,{details:n,level:a,drift:T,type:o,frag:e,start:_.startPTS,end:_.endPTS}),!0}return t},!1)&&null===(null==(o=this.transmuxer)?void 0:o.error)){var _=new Error("Found no media in fragment "+e.sn+" of level "+e.level+" resetting transmuxer to fallback to playlist timing");if(0===a.fragmentError&&(a.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(_.message),this.hls.trigger(P.ERROR,{type:B.MEDIA_ERROR,details:f.FRAG_PARSING_ERROR,fatal:!1,error:_,frag:e,reason:"Found no media in msn "+e.sn+' of level "'+a.url+'"'}),!this.hls)return;this.resetTransmuxer()}this.state=Xi.PARSED,this.hls.trigger(P.FRAG_PARSED,{frag:e,part:t})}else this.warn("level.details undefined")},a.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},a.recoverWorkerError=function(e){"demuxerWorker"===e.event&&(this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())},_(t,[{key:"state",get:function(){return this._state},set:function(e){var t=this._state;t!==e&&(this._state=e,this.log(t+"->"+e))}}]),t})(ci),qi=(function(){function e(){this.chunks=[],this.dataLength=0}var t=e.prototype;return t.push=function(e){this.chunks.push(e),this.dataLength+=e.length},t.flush=function(){var e,t=this.chunks,a=this.dataLength;return t.length?(e=1===t.length?t[0]:Ji(t,a),this.reset(),e):new Uint8Array(0)},t.reset=function(){this.chunks.length=0,this.dataLength=0},e})();function Ji(e,t){for(var a=new Uint8Array(t),i=0,o=0;o0&&n.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:_a.audioId3,duration:Number.POSITIVE_INFINITY});o>>6)+1;var s=(60&t[a+2])>>>2;if(!(s>S.length-1))return n=(1&t[a+2])<<2,n|=(192&t[a+3])>>>6,y.log("manifest codec:"+i+", ADTS type:"+o+", samplingIndex:"+s),/firefox/i.test(r)?s>=6?(o=5,_=new Array(4),E=s-3):(o=2,_=new Array(2),E=s):-1!==r.indexOf("android")?(o=2,_=new Array(2),E=s):(o=5,_=new Array(4),i&&(-1!==i.indexOf("mp4a.40.29")||-1!==i.indexOf("mp4a.40.5"))||!i&&s>=6?E=s-3:((i&&-1!==i.indexOf("mp4a.40.2")&&(s>=6&&1===n||/vivaldi/i.test(r))||!i&&1===n)&&(o=2,_=new Array(2)),E=s)),_[0]=o<<3,_[0]|=(14&s)>>1,_[1]|=(1&s)<<7,_[1]|=n<<3,5===o&&(_[1]|=(14&E)>>1,_[2]=(1&E)<<7,_[2]|=8,_[3]=0),{config:_,samplerate:S[s],channelCount:n,codec:"mp4a.40."+o,manifestCodec:T};var l=new Error("invalid ADTS sampling index:"+s);e.emit(P.ERROR,P.ERROR,{type:B.MEDIA_ERROR,details:f.FRAG_PARSING_ERROR,fatal:!0,error:l,reason:l.message})}function io(e,t){return 255===e[t]&&240==(246&e[t+1])}function oo(e,t){return 1&e[t+1]?7:9}function Eo(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function no(e,t){return t+5=e.length)return!1;var i=Eo(e,t);if(i<=a)return!1;var o=t+i;return o===e.length||_o(e,o)}return!1}function So(e,t,a,i,o){if(!e.samplerate){var E=ao(t,a,i,o);if(!E)return;e.config=E.config,e.samplerate=E.samplerate,e.channelCount=E.channelCount,e.codec=E.codec,e.manifestCodec=E.manifestCodec,y.log("parsed codec:"+e.codec+", rate:"+E.samplerate+", channels:"+E.channelCount)}}function so(e){return 9216e4/e}function lo(e,t){var a=oo(e,t);if(t+a<=e.length){var i=Eo(e,t)-a;if(i>0)return{headerLength:a,frameLength:i}}}function Io(e,t,a,i,o){var E,n=i+o*so(e.samplerate),_=lo(t,a);if(_){var r=_.frameLength,T=_.headerLength,S=T+r,s=Math.max(0,a+S-t.length);s?(E=new Uint8Array(S-T)).set(t.subarray(a+T,t.length),0):E=t.subarray(a+T,a+S);var l={unit:E,pts:n};return s||e.samples.push(l),{sample:l,length:S,missing:s}}var I=t.length-a;return(E=new Uint8Array(I)).set(t.subarray(a,t.length),0),{sample:{unit:E,pts:n},length:I,missing:-1}}var Ao=null,Oo=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],uo=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],No=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Ro=[0,1,1,4];function co(e,t,a,i,o){if(!(a+24>t.length)){var E=mo(t,a);if(E&&a+E.frameLength<=t.length){var n=i+o*(9e4*E.samplesPerFrame/E.sampleRate),_={unit:t.subarray(a,a+E.frameLength),pts:n,dts:n};return e.config=[],e.channelCount=E.channelCount,e.samplerate=E.sampleRate,e.samples.push(_),{sample:_,length:E.frameLength,missing:0}}}}function mo(e,t){var a=e[t+1]>>3&3,i=e[t+1]>>1&3,o=e[t+2]>>4&15,E=e[t+2]>>2&3;if(1!==a&&0!==o&&15!==o&&3!==E){var n=e[t+2]>>1&1,_=e[t+3]>>6,r=1e3*Oo[14*(3===a?3-i:3===i?3:4)+o-1],T=uo[3*(3===a?0:2===a?1:2)+E],S=3===_?1:2,s=No[a][i],l=Ro[i],I=8*s*l,A=Math.floor(s*r/T+n)*l;if(null===Ao){var O=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Ao=O?parseInt(O[1]):0}return!!Ao&&Ao<=87&&2===i&&r>=224e3&&0===_&&(e[t+3]=128|e[t+3]),{sampleRate:T,channelCount:S,frameLength:A,samplesPerFrame:I}}}function Lo(e,t){return!(255!==e[t]||224&~e[t+1]||!(6&e[t+1]))}function Do(e,t){return t+10;){n[0]=e[t];var _=Math.min(i,8),r=8-_;E[0]=4278190080>>>24+r<>r,a=a?a<<_|o[0]:o[0],t+=1,i-=_}return a},go=(function(e){function t(t){var a;return(a=e.call(this)||this).observer=void 0,a.observer=t,a}S(t,e);var a=t.prototype;return a.resetInitSegment=function(t,a,i,o){e.prototype.resetInitSegment.call(this,t,a,i,o),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:a,duration:o,inputTimeScale:9e4,dropped:0}},a.canParse=function(e,t){return t+64t.length)return-1;if(11!==t[a]||119!==t[a+1])return-1;var E=t[a+4]>>6;if(E>=3)return-1;var n=[48e3,44100,32e3][E],_=63&t[a+4],r=2*[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][3*_+E];if(a+r>t.length)return-1;var T=t[a+6]>>5,S=0;2===T?S+=2:(1&T&&1!==T&&(S+=2),4&T&&(S+=2));var s=(t[a+6]<<8|t[a+7])>>12-S&1,l=[2,1,2,3,3,4,4,5][T]+s,I=t[a+5]>>3,A=7&t[a+5],O=new Uint8Array([E<<6|I<<1|A>>2,(3&A)<<6|T<<3|s<<2|_>>4,_<<4&224]),u=i+o*(1536/n*9e4),d=t.subarray(a,a+r);return e.config=O,e.channelCount=l,e.samplerate=n,e.samples.push({unit:d,pts:u}),r}var Mo=(function(){function e(){this.VideoSample=null}var t=e.prototype;return t.createVideoSample=function(e,t,a,i){return{key:e,frame:!1,pts:t,dts:a,units:[],debug:i,length:0}},t.getLastNalUnit=function(e){var t,a,i=this.VideoSample;if(i&&0!==i.units.length||(i=e[e.length-1]),null!=(t=i)&&t.units){var o=i.units;a=o[o.length-1]}return a},t.pushAccessUnit=function(e,t){if(e.units.length&&e.frame){if(void 0===e.pts){var a=t.samples,i=a.length;if(!i)return void t.dropped++;var o=a[i-1];e.pts=o.pts,e.dts=o.dts}t.samples.push(e)}e.debug.length&&y.log(e.pts+"/"+e.dts+":"+e.debug)},e})(),Wo=(function(){function e(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}var t=e.prototype;return t.loadWord=function(){var e=this.data,t=this.bytesAvailable,a=e.byteLength-t,i=new Uint8Array(4),o=Math.min(4,t);if(0===o)throw new Error("no bytes available");i.set(e.subarray(a,a+o)),this.word=new DataView(i.buffer).getUint32(0),this.bitsAvailable=8*o,this.bytesAvailable-=o},t.skipBits=function(e){var t;e=Math.min(e,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,e-=(t=e>>3)<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)},t.readBits=function(e){var t=Math.min(this.bitsAvailable,e),a=this.word>>>32-t;if(e>32&&y.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return(t=e-t)>0&&this.bitsAvailable?a<>>e)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()},t.skipUEG=function(){this.skipBits(1+this.skipLZ())},t.skipEG=function(){this.skipBits(1+this.skipLZ())},t.readUEG=function(){var e=this.skipLZ();return this.readBits(e+1)-1},t.readEG=function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)},t.readBoolean=function(){return 1===this.readBits(1)},t.readUByte=function(){return this.readBits(8)},t.readUShort=function(){return this.readBits(16)},t.readUInt=function(){return this.readBits(32)},t.skipScalingList=function(e){for(var t=8,a=8,i=0;i4){var I=new Wo(l).readSliceType();2!==I&&4!==I&&7!==I&&9!==I||(S=!0)}S&&null!=(s=r)&&s.frame&&!r.key&&(n.pushAccessUnit(r,e),r=n.VideoSample=null),r||(r=n.VideoSample=n.createVideoSample(!0,a.pts,a.dts,"")),r.frame=!0,r.key=S;break;case 5:E=!0,null!=(_=r)&&_.frame&&!r.key&&(n.pushAccessUnit(r,e),r=n.VideoSample=null),r||(r=n.VideoSample=n.createVideoSample(!0,a.pts,a.dts,"")),r.key=!0,r.frame=!0;break;case 6:E=!0,nt(i.data,1,a.pts,t.samples);break;case 7:var A,O;E=!0,T=!0;var u=i.data,d=new Wo(u).readSPS();if(!e.sps||e.width!==d.width||e.height!==d.height||(null==(A=e.pixelRatio)?void 0:A[0])!==d.pixelRatio[0]||(null==(O=e.pixelRatio)?void 0:O[1])!==d.pixelRatio[1]){e.width=d.width,e.height=d.height,e.pixelRatio=d.pixelRatio,e.sps=[u],e.duration=o;for(var N=u.subarray(1,4),R="avc1.",c=0;c<3;c++){var m=N[c].toString(16);m.length<2&&(m="0"+m),R+=m}e.codec=R}break;case 8:E=!0,e.pps=[i.data];break;case 9:E=!0,e.audFound=!0,r&&n.pushAccessUnit(r,e),r=n.VideoSample=n.createVideoSample(!1,a.pts,a.dts,"");break;case 12:E=!0;break;default:E=!1,r&&(r.debug+="unknown NAL "+i.type+" ")}r&&E&&r.units.push(i)}),i&&r&&(this.pushAccessUnit(r,e),this.VideoSample=null)},a.parseAVCNALu=function(e,t){var a,i,o=t.byteLength,E=e.naluState||0,n=E,_=[],r=0,T=-1,S=0;for(-1===E&&(T=0,S=31&t[0],E=0,r=1);r=0){var s={data:t.subarray(T,i),type:S};_.push(s)}else{var l=this.getLastNalUnit(e.samples);l&&(n&&r<=4-n&&l.state&&(l.data=l.data.subarray(0,l.data.byteLength-n)),i>0&&(l.data=at(l.data,t.subarray(0,i)),l.state=0))}r=0&&E>=0){var I={data:t.subarray(T,o),type:S,state:E};_.push(I)}if(0===_.length){var A=this.getLastNalUnit(e.samples);A&&(A.data=at(A.data,t))}return e.naluState=E,_},t})(Mo),Go=(function(){function e(e,t,a){this.keyData=void 0,this.decrypter=void 0,this.keyData=a,this.decrypter=new xi(t,{removePKCS7Padding:!1})}var t=e.prototype;return t.decryptBuffer=function(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)},t.decryptAacSample=function(e,t,a){var i=this,o=e[t].unit;if(!(o.length<=16)){var E=o.subarray(16,o.length-o.length%16),n=E.buffer.slice(E.byteOffset,E.byteOffset+E.length);this.decryptBuffer(n).then(function(E){var n=new Uint8Array(E);o.set(n,16),i.decrypter.isSync()||i.decryptAacSamples(e,t+1,a)})}},t.decryptAacSamples=function(e,t,a){for(;;t++){if(t>=e.length)return void a();if(!(e[t].unit.length<32||(this.decryptAacSample(e,t,a),this.decrypter.isSync())))return}},t.getAvcEncryptedData=function(e){for(var t=16*Math.floor((e.length-48)/160)+16,a=new Int8Array(t),i=0,o=32;o=e.length)return void i();for(var o=e[t].units;!(a>=o.length);a++){var E=o[a];if(!(E.data.length<=48||1!==E.type&&5!==E.type||(this.decryptAvcSample(e,t,a,i,E),this.decrypter.isSync())))return}}},e})(),yo=188,bo=(function(){function e(e,t,a){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=a,this.videoParser=new Uo}e.probe=function(t){var a=e.syncOffset(t);return a>0&&y.warn("MPEG2-TS detected but first sync word found @ offset "+a),-1!==a},e.syncOffset=function(e){for(var t=e.length,a=Math.min(5*yo,t-yo)+1,i=0;i1&&(0===E&&n>2||_+yo>a))return E}i++}return-1},e.createTrack=function(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:Ue[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===e?t:void 0}};var t=e.prototype;return t.resetInitSegment=function(t,a,i,o){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=e.createTrack("video"),this._audioTrack=e.createTrack("audio",o),this._id3Track=e.createTrack("id3"),this._txtTrack=e.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=a,this.videoCodec=i,this._duration=o},t.resetTimeStamp=function(){},t.resetContiguity=function(){var e=this._audioTrack,t=this._videoTrack,a=this._id3Track;e&&(e.pesData=null),t&&(t.pesData=null),a&&(a.pesData=null),this.aacOverFlow=null,this.remainderData=null},t.demux=function(t,a,i,o){var E;void 0===i&&(i=!1),void 0===o&&(o=!1),i||(this.sampleAes=null);var n=this._videoTrack,_=this._audioTrack,r=this._id3Track,T=this._txtTrack,S=n.pid,s=n.pesData,l=_.pid,I=r.pid,A=_.pesData,O=r.pesData,u=null,d=this.pmtParsed,N=this._pmtId,R=t.length;if(this.remainderData&&(R=(t=at(this.remainderData,t)).length,this.remainderData=null),R>4>1){if((p=L+5+t[L+4])===L+yo)continue}else p=L+4;switch(C){case S:D&&(s&&(E=Yo(s))&&this.videoParser.parseAVCPES(n,T,E,!1,this._duration),s={data:[],size:0}),s&&(s.data.push(t.subarray(p,L+yo)),s.size+=L+yo-p);break;case l:if(D){if(A&&(E=Yo(A)))switch(_.segmentCodec){case"aac":this.parseAACPES(_,E);break;case"mp3":this.parseMPEGPES(_,E);break;case"ac3":this.parseAC3PES(_,E)}A={data:[],size:0}}A&&(A.data.push(t.subarray(p,L+yo)),A.size+=L+yo-p);break;case I:D&&(O&&(E=Yo(O))&&this.parseID3PES(r,E),O={data:[],size:0}),O&&(O.data.push(t.subarray(p,L+yo)),O.size+=L+yo-p);break;case 0:D&&(p+=t[p]+1),N=this._pmtId=Fo(t,p);break;case N:D&&(p+=t[p]+1);var h=Vo(t,p,this.typeSupported,i);(S=h.videoPid)>0&&(n.pid=S,n.segmentCodec=h.segmentVideoCodec),(l=h.audioPid)>0&&(_.pid=l,_.segmentCodec=h.segmentAudioCodec),(I=h.id3Pid)>0&&(r.pid=I),null===u||d||(y.warn("MPEG-TS PMT found at "+L+" after unknown PID '"+u+"'. Backtracking to sync byte @"+c+" to parse all TS packets."),u=null,L=c-188),d=this.pmtParsed=!0;break;case 17:case 8191:break;default:u=C}}else m++;if(m>0){var g=new Error("Found "+m+" TS packet/s that do not start with 0x47");this.observer.emit(P.ERROR,P.ERROR,{type:B.MEDIA_ERROR,details:f.FRAG_PARSING_ERROR,fatal:!1,error:g,reason:g.message})}n.pesData=s,_.pesData=A,r.pesData=O;var v={audioTrack:_,videoTrack:n,id3Track:r,textTrack:T};return o&&this.extractRemainingSamples(v),v},t.flush=function(){var e,t=this.remainderData;return this.remainderData=null,e=t?this.demux(t,-1,!1,!0):{videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(e),this.sampleAes?this.decrypt(e,this.sampleAes):e},t.extractRemainingSamples=function(e){var t,a=e.audioTrack,i=e.videoTrack,o=e.id3Track,E=e.textTrack,n=i.pesData,_=a.pesData,r=o.pesData;if(n&&(t=Yo(n))?(this.videoParser.parseAVCPES(i,E,t,!0,this._duration),i.pesData=null):i.pesData=n,_&&(t=Yo(_))){switch(a.segmentCodec){case"aac":this.parseAACPES(a,t);break;case"mp3":this.parseMPEGPES(a,t);break;case"ac3":this.parseAC3PES(a,t)}a.pesData=null}else null!=_&&_.size&&y.log("last AAC PES packet truncated,might overlap between fragments"),a.pesData=_;r&&(t=Yo(r))?(this.parseID3PES(o,t),o.pesData=null):o.pesData=r},t.demuxSampleAes=function(e,t,a){var i=this.demux(e,a,!0,!this.config.progressive),o=this.sampleAes=new Go(this.observer,this.config,t);return this.decrypt(i,o)},t.decrypt=function(e,t){return new Promise(function(a){var i=e.audioTrack,o=e.videoTrack;i.samples&&"aac"===i.segmentCodec?t.decryptAacSamples(i.samples,0,function(){o.samples?t.decryptAvcSamples(o.samples,0,0,function(){a(e)}):a(e)}):o.samples&&t.decryptAvcSamples(o.samples,0,0,function(){a(e)})})},t.destroy=function(){this._duration=0},t.parseAACPES=function(e,t){var a,i,o,E=0,n=this.aacOverFlow,_=t.data;if(n){this.aacOverFlow=null;var r=n.missing,T=n.sample.unit.byteLength;if(-1===r)_=at(n.sample.unit,_);else{var S=T-r;n.sample.unit.set(_.subarray(0,r),S),e.samples.push(n.sample),E=n.missing}}for(a=E,i=_.length;a0;)_+=o;else y.warn("[tsdemuxer]: AC3 PES unknown PTS")},t.parseID3PES=function(e,t){if(void 0!==t.pts){var a=T({},t,{type:this._videoTrack?_a.emsg:_a.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(a)}else y.warn("[tsdemuxer]: ID3 PES unknown PTS")},e})();function ko(e,t){return((31&e[t+1])<<8)+e[t+2]}function Fo(e,t){return(31&e[t+10])<<8|e[t+11]}function Vo(e,t,a,i){var o={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},E=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);t0)for(var r=t+5,T=_;T>2;){106===e[r]&&(!0!==a.ac3?y.log("AC-3 audio found, not supported in this browser for now"):(o.audioPid=n,o.segmentAudioCodec="ac3"));var S=e[r+1]+2;r+=S,T-=S}break;case 194:case 135:y.warn("Unsupported EC-3 in M2TS found");break;case 36:y.warn("Unsupported HEVC in M2TS found")}t+=_+5}return o}function Ho(e){y.log(e+" with AES-128-CBC encryption found in unencrypted stream")}function Yo(e){var t,a,i,o,E,n=0,_=e.data;if(!e||0===e.size)return null;for(;_[0].length<19&&_.length>1;)_[0]=at(_[0],_[1]),_.splice(1,1);if(1===((t=_[0])[0]<<16)+(t[1]<<8)+t[2]){if((a=(t[4]<<8)+t[5])&&a>e.size-6)return null;var r=t[7];192&r&&(o=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,64&r?o-(E=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2)>54e5&&(y.warn(Math.round((o-E)/9e4)+"s delta between PTS and DTS, align them"),o=E):E=o);var T=(i=t[8])+9;if(e.size<=T)return null;e.size-=T;for(var S=new Uint8Array(e.size),s=0,l=_.length;sI){T-=I;continue}t=t.subarray(T),I-=T,T=0}S.set(t,n),n+=I}return a&&(a-=i+3),{data:S,pts:o,dts:E,len:a}}return null}var wo=(function(e){function t(){return e.apply(this,arguments)||this}S(t,e);var a=t.prototype;return a.resetInitSegment=function(t,a,i,o){e.prototype.resetInitSegment.call(this,t,a,i,o),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:a,duration:o,inputTimeScale:9e4,dropped:0}},t.probe=function(e){if(!e)return!1;var t=de(e,0),a=(null==t?void 0:t.length)||0;if(t&&11===e[a]&&119===e[a+1]&&void 0!==ce(t)&&fo(e,a)<=16)return!1;for(var i=e.length;a1?a-1:0),o=1;o>24&255,_[1]=t>>16&255,_[2]=t>>8&255,_[3]=255&t,_.set(e,4),E=0,t=8;E>24&255,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,o>>24,o>>16&255,o>>8&255,255&o,85,196,0,0]))},e.mdia=function(t){return e.box(e.types.mdia,e.mdhd(t.timescale,t.duration),e.hdlr(t.type),e.minf(t))},e.mfhd=function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))},e.minf=function(t){return"audio"===t.type?e.box(e.types.minf,e.box(e.types.smhd,e.SMHD),e.DINF,e.stbl(t)):e.box(e.types.minf,e.box(e.types.vmhd,e.VMHD),e.DINF,e.stbl(t))},e.moof=function(t,a,i){return e.box(e.types.moof,e.mfhd(t),e.traf(i,a))},e.moov=function(t){for(var a=t.length,i=[];a--;)i[a]=e.trak(t[a]);return e.box.apply(null,[e.types.moov,e.mvhd(t[0].timescale,t[0].duration)].concat(i).concat(e.mvex(t)))},e.mvex=function(t){for(var a=t.length,i=[];a--;)i[a]=e.trex(t[a]);return e.box.apply(null,[e.types.mvex].concat(i))},e.mvhd=function(t,a){a*=t;var i=Math.floor(a/(Ko+1)),o=Math.floor(a%(Ko+1)),E=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,i>>24,i>>16&255,i>>8&255,255&i,o>>24,o>>16&255,o>>8&255,255&o,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return e.box(e.types.mvhd,E)},e.sdtp=function(t){var a,i,o=t.samples||[],E=new Uint8Array(4+o.length);for(a=0;a>>8&255),E.push(255&o),E=E.concat(Array.prototype.slice.call(i));for(a=0;a>>8&255),n.push(255&o),n=n.concat(Array.prototype.slice.call(i));var _=e.box(e.types.avcC,new Uint8Array([1,E[3],E[4],E[5],255,224|t.sps.length].concat(E).concat([t.pps.length]).concat(n))),r=t.width,T=t.height,S=t.pixelRatio[0],s=t.pixelRatio[1];return e.box(e.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>8&255,255&r,T>>8&255,255&T,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),_,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),e.box(e.types.pasp,new Uint8Array([S>>24,S>>16&255,S>>8&255,255&S,s>>24,s>>16&255,s>>8&255,255&s])))},e.esds=function(e){var t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))},e.audioStsd=function(e){var t=e.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,255&t,0,0])},e.mp4a=function(t){return e.box(e.types.mp4a,e.audioStsd(t),e.box(e.types.esds,e.esds(t)))},e.mp3=function(t){return e.box(e.types[".mp3"],e.audioStsd(t))},e.ac3=function(t){return e.box(e.types["ac-3"],e.audioStsd(t),e.box(e.types.dac3,t.config))},e.stsd=function(t){return"audio"===t.type?"mp3"===t.segmentCodec&&"mp3"===t.codec?e.box(e.types.stsd,e.STSD,e.mp3(t)):"ac3"===t.segmentCodec?e.box(e.types.stsd,e.STSD,e.ac3(t)):e.box(e.types.stsd,e.STSD,e.mp4a(t)):e.box(e.types.stsd,e.STSD,e.avc1(t))},e.tkhd=function(t){var a=t.id,i=t.duration*t.timescale,o=t.width,E=t.height,n=Math.floor(i/(Ko+1)),_=Math.floor(i%(Ko+1));return e.box(e.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,a>>24&255,a>>16&255,a>>8&255,255&a,0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,_>>24,_>>16&255,_>>8&255,255&_,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,o>>8&255,255&o,0,0,E>>8&255,255&E,0,0]))},e.traf=function(t,a){var i=e.sdtp(t),o=t.id,E=Math.floor(a/(Ko+1)),n=Math.floor(a%(Ko+1));return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,o>>24,o>>16&255,o>>8&255,255&o])),e.box(e.types.tfdt,new Uint8Array([1,0,0,0,E>>24,E>>16&255,E>>8&255,255&E,n>>24,n>>16&255,n>>8&255,255&n])),e.trun(t,i.length+16+20+8+16+8+8),i)},e.trak=function(t){return t.duration=t.duration||4294967295,e.box(e.types.trak,e.tkhd(t),e.mdia(t))},e.trex=function(t){var a=t.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},e.trun=function(t,a){var i,o,E,n,_,r,T=t.samples||[],S=T.length,s=12+16*S,l=new Uint8Array(s);for(a+=8+s,l.set(["video"===t.type?1:0,0,15,1,S>>>24&255,S>>>16&255,S>>>8&255,255&S,a>>>24&255,a>>>16&255,a>>>8&255,255&a],0),i=0;i>>24&255,E>>>16&255,E>>>8&255,255&E,n>>>24&255,n>>>16&255,n>>>8&255,255&n,_.isLeading<<2|_.dependsOn,_.isDependedOn<<6|_.hasRedundancy<<4|_.paddingValue<<1|_.isNonSync,61440&_.degradPrio,15&_.degradPrio,r>>>24&255,r>>>16&255,r>>>8&255,255&r],12+16*i);return e.box(e.types.trun,l)},e.initSegment=function(t){e.types||e.init();var a=e.moov(t);return at(e.FTYP,a)},e})();jo.types=void 0,jo.HDLR_TYPES=void 0,jo.STTS=void 0,jo.STSC=void 0,jo.STCO=void 0,jo.STSZ=void 0,jo.VMHD=void 0,jo.SMHD=void 0,jo.STSD=void 0,jo.FTYP=void 0,jo.DINF=void 0;var xo=9e4;function Qo(e,t,a,i){void 0===a&&(a=1),void 0===i&&(i=!1);var o=e*t*a;return i?Math.round(o):o}function Xo(e,t,a,i){return void 0===a&&(a=1),void 0===i&&(i=!1),Qo(e,t,1/a,i)}function $o(e,t){return void 0===t&&(t=!1),Qo(e,1e3,1/xo,t)}function qo(e,t){return void 0===t&&(t=1),Qo(e,xo,1/t)}var Jo=1e4,Zo=1024,eE=1152,tE=1536,aE=null,iE=null,oE=(function(){function e(e,t,a,i){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=a,this.ISGenerated=!1,null===aE){var o=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);aE=o?parseInt(o[1]):0}if(null===iE){var E=navigator.userAgent.match(/Safari\/(\d+)/i);iE=E?parseInt(E[1]):0}}var t=e.prototype;return t.destroy=function(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null},t.resetTimeStamp=function(e){y.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e},t.resetNextTimestamp=function(){y.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},t.resetInitSegment=function(){y.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0},t.getVideoStartPts=function(e){var t=!1,a=e.reduce(function(e,a){var i=a.pts-e;return i<-4294967296?(t=!0,EE(e,a.pts)):i>0?e:a.pts},e[0].pts);return t&&y.debug("PTS rollover detected"),a},t.remux=function(e,t,a,i,o,E,n,_){var r,T,S,s,l,I,A=o,O=o,u=e.pid>-1,d=t.pid>-1,N=t.samples.length,R=e.samples.length>0,c=n&&N>0||N>1;if((!u||R)&&(!d||c)||this.ISGenerated||n){if(this.ISGenerated){var m,L,D,C,p=this.videoTrackConfig;!p||t.width===p.width&&t.height===p.height&&(null==(m=t.pixelRatio)?void 0:m[0])===(null==(L=p.pixelRatio)?void 0:L[0])&&(null==(D=t.pixelRatio)?void 0:D[1])===(null==(C=p.pixelRatio)?void 0:C[1])||this.resetInitSegment()}else S=this.generateIS(e,t,o,E);var h,P=this.isVideoContiguous,B=-1;if(c&&(B=nE(t.samples),!P&&this.config.forceKeyFrameOnDiscontinuity))if(I=!0,B>0){y.warn("[mp4-remuxer]: Dropped "+B+" out of "+N+" video samples due to a missing keyframe");var f=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(B),t.dropped+=B,h=O+=(t.samples[0].pts-f)/t.inputTimeScale}else-1===B&&(y.warn("[mp4-remuxer]: No keyframe found out of "+N+" video samples"),I=!1);if(this.ISGenerated){if(R&&c){var g=this.getVideoStartPts(t.samples),v=(EE(e.samples[0].pts,g)-g)/t.inputTimeScale;A+=Math.max(0,v),O+=Math.max(0,-v)}if(R){if(e.samplerate||(y.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),S=this.generateIS(e,t,o,E)),T=this.remuxAudio(e,A,this.isAudioContiguous,E,d||c||_===$t.AUDIO?O:void 0),c){var M=T?T.endPTS-T.startPTS:0;t.inputTimeScale||(y.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),S=this.generateIS(e,t,o,E)),r=this.remuxVideo(t,O,P,M)}}else c&&(r=this.remuxVideo(t,O,P,0));r&&(r.firstKeyFrame=B,r.independent=-1!==B,r.firstKeyFramePTS=h)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(a.samples.length&&(l=_E(a,o,this._initPTS,this._initDTS)),i.samples.length&&(s=rE(i,o,this._initPTS))),{audio:T,video:r,initSegment:S,independent:I,text:s,id3:l}},t.generateIS=function(e,t,a,i){var o,E,n,_=e.samples,r=t.samples,T=this.typeSupported,S={},s=this._initPTS,l=!s||i,I="audio/mp4";if(l&&(o=E=1/0),e.config&&_.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":T.mpeg?(I="audio/mpeg",e.codec=""):T.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3"}S.audio={id:"audio",container:I,codec:e.codec,initSegment:"mp3"===e.segmentCodec&&T.mpeg?new Uint8Array(0):jo.initSegment([e]),metadata:{channelCount:e.channelCount}},l&&(n=e.inputTimeScale,s&&n===s.timescale?l=!1:o=E=_[0].pts-Math.round(n*a))}if(t.sps&&t.pps&&r.length){if(t.timescale=t.inputTimeScale,S.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:jo.initSegment([t]),metadata:{width:t.width,height:t.height}},l)if(n=t.inputTimeScale,s&&n===s.timescale)l=!1;else{var A=this.getVideoStartPts(r),O=Math.round(n*a);E=Math.min(E,EE(r[0].dts,A)-O),o=Math.min(o,A-O)}this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(S).length)return this.ISGenerated=!0,l?(this._initPTS={baseTime:o,timescale:n},this._initDTS={baseTime:E,timescale:n}):o=n=void 0,{tracks:S,initPTS:o,timescale:n}},t.remuxVideo=function(e,t,a,i){var o,E,n=e.inputTimeScale,_=e.samples,r=[],S=_.length,s=this._initPTS,l=this.nextAvcDts,I=8,A=this.videoSampleDuration,O=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY,d=!1;if(!a||null===l){var N=t*n,R=_[0].pts-EE(_[0].dts,_[0].pts);aE&&null!==l&&Math.abs(N-R-l)<15e3?a=!0:l=N-R}for(var c=s.baseTime*n/s.timescale,m=0;m0?m-1:m].dts&&(d=!0)}d&&_.sort(function(e,t){var a=e.dts-t.dts,i=e.pts-t.pts;return a||i}),o=_[0].dts;var D=(E=_[_.length-1].dts)-o,C=D?Math.round(D/(S-1)):A||e.inputTimeScale/30;if(a){var p=o-l,h=p>C,g=p<-1;if((h||g)&&(h?y.warn("AVC: "+$o(p,!0)+" ms ("+p+"dts) hole between fragments detected at "+t.toFixed(3)):y.warn("AVC: "+$o(-p,!0)+" ms ("+p+"dts) overlapping between fragments detected at "+t.toFixed(3)),!g||l>=_[0].pts||aE)){o=l;var v=_[0].pts-p;if(h)_[0].dts=o,_[0].pts=v;else for(var M=0;M<_.length&&!(_[M].dts>v);M++)_[M].dts-=p,_[M].pts-=p;y.log("Video: Initial PTS/DTS adjusted: "+$o(v,!0)+"/"+$o(o,!0)+", delta: "+$o(p,!0)+" ms")}}for(var W=0,U=0,G=o=Math.max(0,o),b=0;b0?J.dts-_[q-1].dts:C;if(ne=q>0?J.pts-_[q-1].pts:C,_e.stretchShortVideoTrack&&null!==this.nextAudioPts){var Te=Math.floor(_e.maxBufferHole*n),Se=(i?O+i*n:this.nextAudioPts)-J.pts;Se>Te?((A=Se-re)<0?A=re:j=!0,y.log("[mp4-remuxer]: It is approximately "+Se/90+" ms to the next segment; using duration "+A/90+" ms for the last video frame.")):A=re}else A=re}var se=Math.round(J.pts-J.dts);x=Math.min(x,A),X=Math.max(X,A),Q=Math.min(Q,ne),$=Math.max($,ne),r.push(new SE(J.key,A,ee,se))}if(r.length)if(aE){if(aE<70){var le=r[0].flags;le.dependsOn=2,le.isNonSync=0}}else if(iE&&$-Q0&&(i&&Math.abs(d-u)<9e3||Math.abs(EE(A[0].pts-N,d)-u)<20*r),A.forEach(function(e){e.pts=EE(e.pts-N,d)}),!a||u<0){if(A=A.filter(function(e){return e.pts>=0}),!A.length)return;u=0===o?0:i&&!I?Math.max(0,d):A[0].pts}if("aac"===e.segmentCodec)for(var R=this.config.maxAudioFramesDrift,c=0,m=u;c=R*r&&p0))return;b+=O;try{W=new Uint8Array(b)}catch(e){return void this.observer.emit(P.ERROR,P.ERROR,{type:B.MUX_ERROR,details:f.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:b,reason:"fail allocating audio mdat "+b})}s||(new DataView(W.buffer).setUint32(0,b),W.set(jo.types.mdat,4))}W.set(Y,O);var z=Y.byteLength;O+=z,l.push(new SE(!0,_,z,0)),G=w}var K=l.length;if(K){var j=l[l.length-1];this.nextAudioPts=u=G+n*j.duration;var x=s?new Uint8Array(0):jo.moof(e.sequenceNumber++,U/n,T({},e,{samples:l}));e.samples=[];var Q=U/E,X=u/E,$={data1:x,data2:W,startPTS:Q,endPTS:X,startDTS:Q,endDTS:X,type:"audio",hasAudio:!0,hasVideo:!1,nb:K};return this.isAudioContiguous=!0,$}},t.remuxEmptyAudio=function(e,t,a,i){var o=e.inputTimeScale,E=o/(e.samplerate?e.samplerate:o),n=this.nextAudioPts,_=this._initDTS,r=9e4*_.baseTime/_.timescale,T=(null!==n?n:i.startDTS*o)+r,S=i.endDTS*o+r,s=E*Zo,l=Math.ceil((S-T)/s),I=zo.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(y.warn("[mp4-remuxer]: remux empty Audio"),I){for(var A=[],O=0;O4294967296;)e+=a;return e}function nE(e){for(var t=0;t0?this.lastEndTime=N:(y.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var R=!!I.audio,c=!!I.video,m="";R&&(m+="audio"),c&&(m+="video");var L={data1:s,startPTS:d,startDTS:d,endPTS:N,endDTS:N,type:m,hasAudio:R,hasVideo:c,nb:1,dropped:0};return S.audio="audio"===L.type?L:void 0,S.video="audio"!==L.type?L:void 0,S.initSegment=l,S.id3=_E(a,o,r,r),i.samples.length&&(S.text=rE(i,o,r)),S},e})();function lE(e,t,a,i){if(null===e)return!0;var o=Math.max(i,1),E=t-e.baseTime/e.timescale;return Math.abs(E-a)>o}function IE(e,t){var a=null==e?void 0:e.codec;if(a&&a.length>4)return a;if(t===z.AUDIO){if("ec-3"===a||"ac-3"===a||"alac"===a)return a;if("fLaC"===a||"Opus"===a)return Mt(a,!1);var i="mp4a.40.5";return y.info('Parsed audio codec "'+a+'" or audio object type not handled. Using "'+i+'"'),i}return y.warn('Unhandled video codec "'+a+'"'),"hvc1"===a||"hev1"===a?"hvc1.1.6.L120.90":"av01"===a?"av01.0.04M.08":"avc1.42e01e"}try{TE=self.performance.now.bind(self.performance)}catch(e){y.debug("Unable to use Performance API on this environment"),TE=null==te?void 0:te.Date.now}var AE=[{demux:Bo,remux:sE},{demux:bo,remux:oE},{demux:ho,remux:oE},{demux:wo,remux:oE}];AE.splice(2,0,{demux:go,remux:oE});var OE=(function(){function e(e,t,a,i,o){this.async=!1,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=a,this.vendor=i,this.id=o}var t=e.prototype;return t.configure=function(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()},t.push=function(e,t,a,i){var o=this,E=a.transmuxing;E.executeStart=TE();var n=new Uint8Array(e),_=this.currentTransmuxState,r=this.transmuxConfig;i&&(this.currentTransmuxState=i);var T=i||_,S=T.contiguous,s=T.discontinuity,l=T.trackSwitch,I=T.accurateTimeOffset,A=T.timeOffset,O=T.initSegmentChange,u=r.audioCodec,d=r.videoCodec,N=r.defaultInitPts,R=r.duration,c=r.initSegmentData,m=uE(n,t);if(m&&"AES-128"===m.method){var L=this.getDecrypter();if(!L.isSync())return this.decryptionPromise=L.webCryptoDecrypt(n,m.key.buffer,m.iv.buffer).then(function(e){var t=o.push(e,null,a);return o.decryptionPromise=null,t}),this.decryptionPromise;var D=L.softwareDecrypt(n,m.key.buffer,m.iv.buffer);if(a.part>-1&&(D=L.flush()),!D)return E.executeEnd=TE(),dE(a);n=new Uint8Array(D)}var C=this.needsProbing(s,l);if(C){var p=this.configureTransmuxer(n);if(p)return y.warn("[transmuxer] "+p.message),this.observer.emit(P.ERROR,P.ERROR,{type:B.MEDIA_ERROR,details:f.FRAG_PARSING_ERROR,fatal:!1,error:p,reason:p.message}),E.executeEnd=TE(),dE(a)}(s||l||O||C)&&this.resetInitSegment(c,u,d,R,t),(s||O||C)&&this.resetInitialTimestamp(N),S||this.resetContiguity();var h=this.transmux(n,m,A,I,a),g=this.currentTransmuxState;return g.contiguous=!0,g.discontinuity=!1,g.trackSwitch=!1,E.executeEnd=TE(),h},t.flush=function(e){var t=this,a=e.transmuxing;a.executeStart=TE();var i=this.decrypter,o=this.currentTransmuxState,E=this.decryptionPromise;if(E)return E.then(function(){return t.flush(e)});var n=[],_=o.timeOffset;if(i){var r=i.flush();r&&n.push(this.push(r,null,e))}var T=this.demuxer,S=this.remuxer;if(!T||!S)return a.executeEnd=TE(),[dE(e)];var s=T.flush(_);return NE(s)?s.then(function(a){return t.flushRemux(n,a,e),n}):(this.flushRemux(n,s,e),n)},t.flushRemux=function(e,t,a){var i=t.audioTrack,o=t.videoTrack,E=t.id3Track,n=t.textTrack,_=this.currentTransmuxState,r=_.accurateTimeOffset,T=_.timeOffset;y.log("[transmuxer.ts]: Flushed fragment "+a.sn+(a.part>-1?" p: "+a.part:"")+" of level "+a.level);var S=this.remuxer.remux(i,o,E,n,T,r,!0,this.id);e.push({remuxResult:S,chunkMeta:a}),a.transmuxing.executeEnd=TE()},t.resetInitialTimestamp=function(e){var t=this.demuxer,a=this.remuxer;t&&a&&(t.resetTimeStamp(e),a.resetTimeStamp(e))},t.resetContiguity=function(){var e=this.demuxer,t=this.remuxer;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())},t.resetInitSegment=function(e,t,a,i,o){var E=this.demuxer,n=this.remuxer;E&&n&&(E.resetInitSegment(e,t,a,i),n.resetInitSegment(e,t,a,o))},t.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},t.transmux=function(e,t,a,i,o){return t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,a,i,o):this.transmuxUnencrypted(e,a,i,o)},t.transmuxUnencrypted=function(e,t,a,i){var o=this.demuxer.demux(e,t,!1,!this.config.progressive),E=o.audioTrack,n=o.videoTrack,_=o.id3Track,r=o.textTrack;return{remuxResult:this.remuxer.remux(E,n,_,r,t,a,!1,this.id),chunkMeta:i}},t.transmuxSampleAes=function(e,t,a,i,o){var E=this;return this.demuxer.demuxSampleAes(e,t,a).then(function(e){return{remuxResult:E.remuxer.remux(e.audioTrack,e.videoTrack,e.id3Track,e.textTrack,a,i,!1,E.id),chunkMeta:o}})},t.configureTransmuxer=function(e){for(var t,a=this.config,i=this.observer,o=this.typeSupported,E=this.vendor,n=0,_=AE.length;n<_;n++){var r;if(null!=(r=AE[n].demux)&&r.probe(e)){t=AE[n];break}}if(!t)return new Error("Failed to find demuxer by probing fragment data");var T=this.demuxer,S=this.remuxer,s=t.remux,l=t.demux;S&&S instanceof s||(this.remuxer=new s(i,a,o,E)),T&&T instanceof l||(this.demuxer=new l(i,a,o),this.probe=l.probe)},t.needsProbing=function(e,t){return!this.demuxer||!this.remuxer||e||t},t.getDecrypter=function(){var e=this.decrypter;return e||(e=this.decrypter=new xi(this.config)),e},e})();function uE(e,t){var a=null;return e.byteLength>0&&null!=(null==t?void 0:t.key)&&null!==t.iv&&null!=t.method&&(a=t),a}var dE=function(e){return{remuxResult:{},chunkMeta:e}};function NE(e){return"then"in e&&e.then instanceof Function}var RE=function(e,t,a,i,o){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=a,this.duration=i,this.defaultInitPts=o||null},cE=function(e,t,a,i,o,E){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=a,this.trackSwitch=i,this.timeOffset=o,this.initSegmentChange=E},mE={exports:{}};!(function(e){var t=Object.prototype.hasOwnProperty,a="~";function i(){}function o(e,t,a){this.fn=e,this.context=t,this.once=a||!1}function E(e,t,i,E,n){if("function"!=typeof i)throw new TypeError("The listener must be a function");var _=new o(i,E||e,n),r=a?a+t:t;return e._events[r]?e._events[r].fn?e._events[r]=[e._events[r],_]:e._events[r].push(_):(e._events[r]=_,e._eventsCount++),e}function n(e,t){0===--e._eventsCount?e._events=new i:delete e._events[t]}function _(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(a=!1)),_.prototype.eventNames=function(){var e,i,o=[];if(0===this._eventsCount)return o;for(i in e=this._events)t.call(e,i)&&o.push(a?i.slice(1):i);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},_.prototype.listeners=function(e){var t=a?a+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var o=0,E=i.length,n=new Array(E);o1&&r.id===(null==u?void 0:u.stats.chunkCount),L=!N&&(1===R||0===R&&(1===c||m&&c<=0)),D=self.performance.now();(N||R||0===o.stats.parsing.start)&&(o.stats.parsing.start=D),!E||!c&&L||(E.stats.parsing.start=D);var C=!(u&&(null==(S=o.initSegment)?void 0:S.url)===(null==(s=u.initSegment)?void 0:s.url)),p=new cE(d,L,_,N,A,C);if(!L||d||C){y.log("[transmuxer-interface, "+o.type+"]: Starting new transmux session for sn: "+r.sn+" p: "+r.part+" level: "+r.level+" id: "+r.id+"\n discontinuity: "+d+"\n trackSwitch: "+N+"\n contiguous: "+L+"\n accurateTimeOffset: "+_+"\n timeOffset: "+A+"\n initSegmentChange: "+C);var h=new RE(a,i,t,n,T);this.configureTransmuxer(h)}if(this.frag=o,this.part=E,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:O,chunkMeta:r,state:p},e instanceof ArrayBuffer?[e]:[]);else if(I){var P=I.push(e,O,r,p);NE(P)?(I.async=!0,P.then(function(e){l.handleTransmuxComplete(e)}).catch(function(e){l.transmuxerError(e,r,"transmuxer-interface push error")})):(I.async=!1,this.handleTransmuxComplete(P))}},t.flush=function(e){var t=this;e.transmuxing.start=self.performance.now();var a=this.transmuxer;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e});else if(a){var i=a.flush(e);NE(i)||a.async?(NE(i)||(i=Promise.resolve(i)),i.then(function(a){t.handleFlushResult(a,e)}).catch(function(a){t.transmuxerError(a,e,"transmuxer-interface flush error")})):this.handleFlushResult(i,e)}},t.transmuxerError=function(e,t,a){this.hls&&(this.error=e,this.hls.trigger(P.ERROR,{type:B.MEDIA_ERROR,details:f.FRAG_PARSING_ERROR,chunkMeta:t,fatal:!1,error:e,err:e,reason:a}))},t.handleFlushResult=function(e,t){var a=this;e.forEach(function(e){a.handleTransmuxComplete(e)}),this.onFlush(t)},t.onWorkerMessage=function(e){var t=e.data,a=this.hls;switch(t.event){case"init":var i,o=null==(i=this.workerContext)?void 0:i.objectURL;o&&self.URL.revokeObjectURL(o);break;case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;case"workerLog":y[t.data.logType]&&y[t.data.logType](t.data.message);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,a.trigger(t.event,t.data)}},t.configureTransmuxer=function(e){var t=this.transmuxer;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)},t.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},e})();function ME(e,t){if(e.length!==t.length)return!1;for(var a=0;a0&&-1===e?(this.log("Override startPosition with lastCurrentTime @"+t.toFixed(3)),e=t,this.state=Xi.IDLE):(this.loadedmetadata=!1,this.state=Xi.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()},a.doTick=function(){switch(this.state){case Xi.IDLE:this.doTickIdle();break;case Xi.WAITING_TRACK:var t,a=this.levels,i=this.trackId,o=null==a||null==(t=a[i])?void 0:t.details;if(o){if(this.waitForCdnTuneIn(o))break;this.state=Xi.WAITING_INIT_PTS}break;case Xi.FRAG_LOADING_WAITING_RETRY:var E,n=performance.now(),_=this.retryDate;if(!_||n>=_||null!=(E=this.media)&&E.seeking){var r=this.levels,T=this.trackId;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((null==r?void 0:r[T])||null),this.state=Xi.IDLE}break;case Xi.WAITING_INIT_PTS:var S=this.waitingData;if(S){var s=S.frag,l=S.part,I=S.cache,A=S.complete;if(void 0!==this.initPTS[s.cc]){this.waitingData=null,this.waitingVideoCC=-1,this.state=Xi.FRAG_LOADING;var O={frag:s,part:l,payload:I.flush(),networkDetails:null};this._handleFragmentLoadProgress(O),A&&e.prototype._handleFragmentLoadComplete.call(this,O)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log("Waiting fragment cc ("+s.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var u=this.getLoadPosition(),d=hi.bufferInfo(this.mediaBuffer,u,this.config.maxBufferHole);xa(d.end,this.config.maxFragLookUpTolerance,s)<0&&(this.log("Waiting fragment cc ("+s.cc+") @ "+s.start+" cancelled because another fragment at "+d.end+" is needed"),this.clearWaitingFragment())}}else this.state=Xi.IDLE}this.onTickEnd()},a.clearWaitingFragment=function(){var e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=Xi.IDLE)},a.resetLoadingState=function(){this.clearWaitingFragment(),e.prototype.resetLoadingState.call(this)},a.onTickEnd=function(){var e=this.media;null!=e&&e.readyState&&(this.lastCurrentTime=e.currentTime)},a.doTickIdle=function(){var e=this.hls,t=this.levels,a=this.media,i=this.trackId,o=e.config;if((a||!this.startFragRequested&&o.startFragPrefetch)&&null!=t&&t[i]){var E=t[i],n=E.details;if(!n||n.live&&this.levelLastLoaded!==E||this.waitForCdnTuneIn(n))this.state=Xi.WAITING_TRACK;else{var _=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&_&&(this.bufferFlushed=!1,this.afterBufferFlushed(_,z.AUDIO,$t.AUDIO));var r=this.getFwdBufferInfo(_,$t.AUDIO);if(null!==r){var T=this.bufferedTrack,S=this.switchingTrack;if(!S&&this._streamEnded(r,n))return e.trigger(P.BUFFER_EOS,{type:"audio"}),void(this.state=Xi.ENDED);var s=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,$t.MAIN),l=r.len,I=this.getMaxBufferLength(null==s?void 0:s.len),A=n.fragments,O=A[0].start,u=this.flushing?this.getLoadPosition():r.end;if(S&&a){var d=this.getLoadPosition();T&&!WE(S.attrs,T.attrs)&&(u=d),n.PTSKnown&&dO||r.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),a.currentTime=O+.05)}if(!(l>=I&&!S&&us.end+n.targetduration;if(c||(null==s||!s.len)&&r.len){var m=this.getAppendedFrag(N.start,$t.MAIN);if(null===m)return;if(R||(R=!!m.gap||!!c&&0===s.len),c&&!R||R&&r.nextStart&&r.nextStart-1)o=E[_];else{var r=Ii(n,this.tracks);o=this.tracks[r]}}var T=this.findTrackId(o);-1===T&&o&&(T=this.findTrackId(null));var S={audioTracks:E};this.log("Updating audio tracks, "+E.length+" track(s) found in group(s): "+(null==a?void 0:a.join(","))),this.hls.trigger(P.AUDIO_TRACKS_UPDATED,S);var s=this.trackId;if(-1!==T&&-1===s)this.setAudioTrack(T);else if(E.length&&-1===s){var l,I=new Error("No audio track selected for current audio group-ID(s): "+(null==(l=this.groupIds)?void 0:l.join(","))+" track count: "+E.length);this.warn(I.message),this.hls.trigger(P.ERROR,{type:B.MEDIA_ERROR,details:f.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:I})}}else this.shouldReloadPlaylist(o)&&this.setAudioTrack(this.trackId)}},a.onError=function(e,t){!t.fatal&&t.context&&(t.context.type!==Xt.AUDIO_TRACK||t.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(t.context.groupId)||(this.requestScheduled=-1,this.checkRetry(t)))},a.setAudioOption=function(e){var t=this.hls;if(t.config.audioPreference=e,e){var a=this.allAudioTracks;if(this.selectDefaultTrack=!1,a.length){var i=this.currentTrack;if(i&&Ai(e,i,ui))return i;var o=Ii(e,this.tracksInGroup,ui);if(o>-1){var E=this.tracksInGroup[o];return this.setAudioTrack(o),E}if(i){var n=t.loadLevel;-1===n&&(n=t.firstAutoLevel);var _=di(e,t.levels,a,n,ui);if(-1===_)return null;t.nextLoadLevel=_}if(e.channels||e.audioCodec){var r=Ii(e,a);if(r>-1)return a[r]}}}return null},a.setAudioTrack=function(e){var t=this.tracksInGroup;if(e<0||e>=t.length)this.warn("Invalid audio track id: "+e);else{this.clearTimer(),this.selectDefaultTrack=!1;var a=this.currentTrack,o=t[e],E=o.details&&!o.details.live;if(!(e===this.trackId&&o===a&&E||(this.log("Switching to audio-track "+e+' "'+o.name+'" lang:'+o.lang+" group:"+o.groupId+" channels:"+o.channels),this.trackId=e,this.currentTrack=o,this.hls.trigger(P.AUDIO_TRACK_SWITCHING,i({},o)),E))){var n=this.switchParams(o.url,null==a?void 0:a.details);this.loadPlaylist(n)}}},a.findTrackId=function(e){for(var t=this.tracksInGroup,a=0;a=o[_].start&&n<=o[_].end){E=o[_];break}var r=a.start+a.duration;E?E.end=r:(E={start:n,end:r},o.push(E)),this.fragmentTracker.fragBuffered(a),this.fragBufferedComplete(a,null)}}},a.onBufferFlushing=function(e,t){var a=t.startOffset,i=t.endOffset;if(0===a&&i!==Number.POSITIVE_INFINITY){var o=i-1;if(o<=0)return;t.endOffsetSubtitles=Math.max(0,o),this.tracksBuffered.forEach(function(e){for(var t=0;t=o.length||n!==i)&&_){this.log("Subtitle track "+n+" loaded ["+E.startSN+","+E.endSN+"]"+(E.lastPartSn?"[part-"+E.lastPartSn+"-"+E.lastPartIndex+"]":"")+",duration:"+E.totalduration),this.mediaBuffer=this.mediaBufferTimeRanges;var r=0;if(E.live||null!=(a=_.details)&&a.live){var T=this.mainDetails;if(E.deltaUpdateFailed||!T)return;var S,s=T.fragments[0];_.details?0===(r=this.alignPlaylists(E,_.details,null==(S=this.levelLastLoaded)?void 0:S.details))&&s&&Ma(E,r=s.start):E.hasProgramDateTime&&T.hasProgramDateTime?(yi(E,T),r=E.fragments[0].start):s&&Ma(E,r=s.start)}_.details=E,this.levelLastLoaded=_,this.startFragRequested||!this.mainDetails&&E.live||this.setStartPosition(this.mainDetails||E,r),this.tick(),E.live&&!this.fragCurrent&&this.media&&this.state===Xi.IDLE&&(ja(null,E.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),_.details=void 0))}}else this.warn("Subtitle tracks were reset while loading level "+n)},a._handleFragmentLoadComplete=function(e){var t=this,a=e.frag,i=e.payload,o=a.decryptdata,E=this.hls;if(!this.fragContextChanged(a)&&i&&i.byteLength>0&&null!=o&&o.key&&o.iv&&"AES-128"===o.method){var n=performance.now();this.decrypter.decrypt(new Uint8Array(i),o.key.buffer,o.iv.buffer).catch(function(e){throw E.trigger(P.ERROR,{type:B.MEDIA_ERROR,details:f.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:a}),e}).then(function(e){var t=performance.now();E.trigger(P.FRAG_DECRYPTED,{frag:a,payload:e,stats:{tstart:n,tdecrypt:t}})}).catch(function(e){t.warn(e.name+": "+e.message),t.state=Xi.IDLE})}},a.doTick=function(){if(this.media){if(this.state===Xi.IDLE){var e=this.currentTrackId,t=this.levels,a=null==t?void 0:t[e];if(!a||!t.length||!a.details)return;var i=this.config,o=this.getLoadPosition(),E=hi.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],o,i.maxBufferHole),n=E.end,_=E.len,r=this.getFwdBufferInfo(this.media,$t.MAIN),T=a.details;if(_>this.getMaxBufferLength(null==r?void 0:r.len)+T.levelTargetDuration)return;var S=T.fragments,s=S.length,l=T.edge,I=null,A=this.fragPrevious;if(nl-O?0:O;!(I=ja(A,S,Math.max(S[0].start,n),u))&&A&&A.start>>=0)>i-1)throw new DOMException("Failed to execute '"+t+"' on 'TimeRanges': The index provided ("+a+") is greater than the maximum bound ("+i+")");return e[a][t]};this.buffered={get length(){return e.length},end:function(a){return t("end",a,e.length)},start:function(a){return t("start",a,e.length)}}},HE=(function(e){function t(t){var a;return(a=e.call(this,t,"[subtitle-track-controller]")||this).media=null,a.tracks=[],a.groupIds=null,a.tracksInGroup=[],a.trackId=-1,a.currentTrack=null,a.selectDefaultTrack=!0,a.queuedDefaultTrack=-1,a.asyncPollTrackChange=function(){return a.pollTrackChange(0)},a.useTextTrackPolling=!1,a.subtitlePollingInterval=-1,a._subtitleDisplay=!0,a.onTextTracksChanged=function(){if(a.useTextTrackPolling||self.clearInterval(a.subtitlePollingInterval),a.media&&a.hls.config.renderTextTracksNatively){for(var e=null,t=na(a.media.textTracks),i=0;i-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))},a.pollTrackChange=function(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)},a.onMediaDetaching=function(){this.media&&(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),na(this.media.textTracks).forEach(function(e){aa(e)}),this.subtitleTrack=-1,this.media=null)},a.onManifestLoading=function(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0},a.onManifestParsed=function(e,t){this.tracks=t.subtitleTracks},a.onSubtitleTrackLoaded=function(e,t){var a=t.id,i=t.groupId,o=t.details,E=this.tracksInGroup[a];if(E&&E.groupId===i){var n=E.details;E.details=t.details,this.log("Subtitle track "+a+' "'+E.name+'" lang:'+E.lang+" group:"+i+" loaded ["+o.startSN+"-"+o.endSN+"]"),a===this.trackId&&this.playlistLoaded(a,t,n)}else this.warn("Subtitle track with id:"+a+" and group:"+i+" not found in active group "+(null==E?void 0:E.groupId))},a.onLevelLoading=function(e,t){this.switchLevel(t.level)},a.onLevelSwitching=function(e,t){this.switchLevel(t.level)},a.switchLevel=function(e){var t=this.hls.levels[e];if(t){var a=t.subtitleGroups||null,i=this.groupIds,o=this.currentTrack;if(!a||(null==i?void 0:i.length)!==(null==a?void 0:a.length)||null!=a&&a.some(function(e){return-1===(null==i?void 0:i.indexOf(e))})){this.groupIds=a,this.trackId=-1,this.currentTrack=null;var E=this.tracks.filter(function(e){return!a||-1!==a.indexOf(e.groupId)});if(E.length)this.selectDefaultTrack&&!E.some(function(e){return e.default})&&(this.selectDefaultTrack=!1),E.forEach(function(e,t){e.id=t});else if(!o&&!this.tracksInGroup.length)return;this.tracksInGroup=E;var n=this.hls.config.subtitlePreference;if(!o&&n){this.selectDefaultTrack=!1;var _=Ii(n,E);if(_>-1)o=E[_];else{var r=Ii(n,this.tracks);o=this.tracks[r]}}var T=this.findTrackId(o);-1===T&&o&&(T=this.findTrackId(null));var S={subtitleTracks:E};this.log("Updating subtitle tracks, "+E.length+' track(s) found in "'+(null==a?void 0:a.join(","))+'" group-id'),this.hls.trigger(P.SUBTITLE_TRACKS_UPDATED,S),-1!==T&&-1===this.trackId&&this.setSubtitleTrack(T)}else this.shouldReloadPlaylist(o)&&this.setSubtitleTrack(this.trackId)}},a.findTrackId=function(e){for(var t=this.tracksInGroup,a=this.selectDefaultTrack,i=0;i-1){var o=this.tracksInGroup[i];return this.setSubtitleTrack(i),o}if(a)return null;var E=Ii(e,t);if(E>-1)return t[E]}}return null},a.loadPlaylist=function(t){e.prototype.loadPlaylist.call(this);var a=this.currentTrack;if(this.shouldLoadPlaylist(a)&&a){var i=a.id,o=a.groupId,E=a.url;if(t)try{E=t.addDirectives(E)}catch(e){this.warn("Could not construct new URL with HLS Delivery Directives: "+e)}this.log("Loading subtitle playlist for id "+i),this.hls.trigger(P.SUBTITLE_TRACK_LOADING,{url:E,id:i,groupId:o,deliveryDirectives:t||null})}},a.toggleTrackModes=function(){var e=this.media;if(e){var t,a=na(e.textTracks),i=this.currentTrack;if(i&&((t=a.filter(function(e){return UE(i,e)})[0])||this.warn('Unable to find subtitle TextTrack with name "'+i.name+'" and language "'+i.lang+'"')),[].slice.call(a).forEach(function(e){"disabled"!==e.mode&&e!==t&&(e.mode="disabled")}),t){var o=this.subtitleDisplay?"showing":"hidden";t.mode!==o&&(t.mode=o)}}},a.setSubtitleTrack=function(e){var t=this.tracksInGroup;if(this.media)if(e<-1||e>=t.length||!C(e))this.warn("Invalid subtitle track id: "+e);else{this.clearTimer(),this.selectDefaultTrack=!1;var a=this.currentTrack,i=t[e]||null;if(this.trackId=e,this.currentTrack=i,this.toggleTrackModes(),i){var o=!!i.details&&!i.details.live;if(e!==this.trackId||i!==a||!o){this.log("Switching to subtitle-track "+e+(i?' "'+i.name+'" lang:'+i.lang+" group:"+i.groupId:""));var E=i.id,n=i.groupId,_=void 0===n?"":n,r=i.name,T=i.type,S=i.url;this.hls.trigger(P.SUBTITLE_TRACK_SWITCH,{id:E,groupId:_,name:r,type:T,url:S});var s=this.switchParams(i.url,null==a?void 0:a.details);this.loadPlaylist(s)}}else this.hls.trigger(P.SUBTITLE_TRACK_SWITCH,{id:e})}else this.queuedDefaultTrack=e},_(t,[{key:"subtitleDisplay",get:function(){return this._subtitleDisplay},set:function(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}},{key:"allSubtitleTracks",get:function(){return this.tracks}},{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}}]),t})(Za),YE=(function(){function e(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}var t=e.prototype;return t.append=function(e,t,a){var i=this.queues[t];i.push(e),1!==i.length||a||this.executeNext(t)},t.insertAbort=function(e,t){this.queues[t].unshift(e),this.executeNext(t)},t.appendBlocker=function(e){var t,a=new Promise(function(e){t=e}),i={execute:t,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(i,e),a},t.executeNext=function(e){var t=this.queues[e];if(t.length){var a=t[0];try{a.execute()}catch(t){y.warn('[buffer-operation-queue]: Exception executing "'+e+'" SourceBuffer operation: '+t),a.onError(t);var i=this.buffers[e];null!=i&&i.updating||this.shiftAndExecuteNext(e)}}},t.shiftAndExecuteNext=function(e){this.queues[e].shift(),this.executeNext(e)},t.current=function(e){return this.queues[e][0]},e})(),wE=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,zE=(function(){function e(e){var t=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendSource=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this.log=void 0,this.warn=void 0,this.error=void 0,this._onEndStreaming=function(e){t.hls&&t.hls.pauseBuffering()},this._onStartStreaming=function(e){t.hls&&t.hls.resumeBuffering()},this._onMediaSourceOpen=function(){var e=t.media,a=t.mediaSource;t.log("Media source opened"),e&&(e.removeEventListener("emptied",t._onMediaEmptied),t.updateMediaElementDuration(),t.hls.trigger(P.MEDIA_ATTACHED,{media:e,mediaSource:a})),a&&a.removeEventListener("sourceopen",t._onMediaSourceOpen),t.checkPendingTracks()},this._onMediaSourceClose=function(){t.log("Media source closed")},this._onMediaSourceEnded=function(){t.log("Media source ended")},this._onMediaEmptied=function(){var e=t.mediaSrc,a=t._objectUrl;e!==a&&y.error("Media element src was set while attaching MediaSource ("+a+" > "+e+")")},this.hls=e;var a="[buffer-controller]";this.appendSource=e.config.preferManagedMediaSource,this.log=y.log.bind(y,a),this.warn=y.warn.bind(y,a),this.error=y.error.bind(y,a),this._initSourceBuffer(),this.registerListeners()}var t=e.prototype;return t.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},t.destroy=function(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.hls=null},t.registerListeners=function(){var e=this.hls;e.on(P.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(P.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(P.MANIFEST_LOADING,this.onManifestLoading,this),e.on(P.MANIFEST_PARSED,this.onManifestParsed,this),e.on(P.BUFFER_RESET,this.onBufferReset,this),e.on(P.BUFFER_APPENDING,this.onBufferAppending,this),e.on(P.BUFFER_CODECS,this.onBufferCodecs,this),e.on(P.BUFFER_EOS,this.onBufferEos,this),e.on(P.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(P.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(P.FRAG_PARSED,this.onFragParsed,this),e.on(P.FRAG_CHANGED,this.onFragChanged,this)},t.unregisterListeners=function(){var e=this.hls;e.off(P.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(P.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(P.MANIFEST_LOADING,this.onManifestLoading,this),e.off(P.MANIFEST_PARSED,this.onManifestParsed,this),e.off(P.BUFFER_RESET,this.onBufferReset,this),e.off(P.BUFFER_APPENDING,this.onBufferAppending,this),e.off(P.BUFFER_CODECS,this.onBufferCodecs,this),e.off(P.BUFFER_EOS,this.onBufferEos,this),e.off(P.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(P.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(P.FRAG_PARSED,this.onFragParsed,this),e.off(P.FRAG_CHANGED,this.onFragChanged,this)},t._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new YE(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},this.lastMpegAudioChunk=null},t.onManifestLoading=function(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null},t.onManifestParsed=function(e,t){var a=2;(t.audio&&!t.video||!t.altAudio)&&(a=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=a,this.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},t.onMediaAttaching=function(e,t){var a=this.media=t.media,i=mt(this.appendSource);if(a&&i){var o,E=this.mediaSource=new i;this.log("created media source: "+(null==(o=E.constructor)?void 0:o.name)),E.addEventListener("sourceopen",this._onMediaSourceOpen),E.addEventListener("sourceended",this._onMediaSourceEnded),E.addEventListener("sourceclose",this._onMediaSourceClose),E.addEventListener("startstreaming",this._onStartStreaming),E.addEventListener("endstreaming",this._onEndStreaming);var n=this._objectUrl=self.URL.createObjectURL(E);if(this.appendSource)try{a.removeAttribute("src");var _=self.ManagedMediaSource;a.disableRemotePlayback=a.disableRemotePlayback||_&&E instanceof _,KE(a),jE(a,n),a.load()}catch(e){a.src=n}else a.src=n;a.addEventListener("emptied",this._onMediaEmptied)}},t.onMediaDetaching=function(){var e=this.media,t=this.mediaSource,a=this._objectUrl;if(t){if(this.log("media source detaching"),"open"===t.readyState)try{t.endOfStream()}catch(e){this.warn("onMediaDetaching: "+e.message+" while calling endOfStream")}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming),e&&(e.removeEventListener("emptied",this._onMediaEmptied),a&&self.URL.revokeObjectURL(a),this.mediaSrc===a?(e.removeAttribute("src"),this.appendSource&&KE(e),e.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(P.MEDIA_DETACHED,void 0)},t.onBufferReset=function(){var e=this;this.getSourceBufferTypes().forEach(function(t){e.resetBuffer(t)}),this._initSourceBuffer()},t.resetBuffer=function(e){var t=this.sourceBuffer[e];try{var a;t&&(this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,null!=(a=this.mediaSource)&&a.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t))}catch(t){this.warn("onBufferReset "+e,t)}},t.onBufferCodecs=function(e,t){var a=this,i=this.getSourceBufferTypes().length,o=Object.keys(t);if(o.forEach(function(e){if(i){var o=a.tracks[e];if(o&&"function"==typeof o.buffer.changeType){var E,n=t[e],_=n.id,r=n.codec,T=n.levelCodec,S=n.container,s=n.metadata,l=Wt(o.codec,o.levelCodec),I=null==l?void 0:l.replace(wE,"$1"),A=Wt(r,T),O=null==(E=A)?void 0:E.replace(wE,"$1");if(A&&I!==O){"audio"===e.slice(0,5)&&(A=Mt(A,a.hls.config.preferManagedMediaSource));var u=S+";codecs="+A;a.appendChangeType(e,u),a.log("switching codec "+l+" to "+A),a.tracks[e]={buffer:o.buffer,codec:r,container:S,levelCodec:T,metadata:s,id:_}}}}else a.pendingTracks[e]=t[e]}),!i){var E=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==E&&(this.log(E+" bufferCodec event(s) expected "+o.join(",")),this.bufferCodecEventsExpected=E),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks()}},t.appendChangeType=function(e,t){var a=this,i=this.operationQueue,o={execute:function(){var o=a.sourceBuffer[e];o&&(a.log("changing "+e+" sourceBuffer type to "+t),o.changeType(t)),i.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(t){a.warn("Failed to change "+e+" SourceBuffer type",t)}};i.append(o,e,!!this.pendingTracks[e])},t.onBufferAppending=function(e,t){var a=this,i=this.hls,o=this.operationQueue,E=this.tracks,n=t.data,_=t.type,r=t.frag,T=t.part,S=t.chunkMeta,s=S.buffering[_],l=self.performance.now();s.start=l;var I=r.stats.buffering,A=T?T.stats.buffering:null;0===I.start&&(I.start=l),A&&0===A.start&&(A.start=l);var O=E.audio,u=!1;"audio"===_&&"audio/mpeg"===(null==O?void 0:O.container)&&(u=!this.lastMpegAudioChunk||1===S.id||this.lastMpegAudioChunk.sn!==S.sn,this.lastMpegAudioChunk=S);var d=r.start,N={execute:function(){if(s.executeStart=self.performance.now(),u){var e=a.sourceBuffer[_];if(e){var t=d-e.timestampOffset;Math.abs(t)>=.1&&(a.log("Updating audio SourceBuffer timestampOffset to "+d+" (delta: "+t+") sn: "+r.sn+")"),e.timestampOffset=d)}}a.appendExecutor(n,_)},onStart:function(){},onComplete:function(){var e=self.performance.now();s.executeEnd=s.end=e,0===I.first&&(I.first=e),A&&0===A.first&&(A.first=e);var t=a.sourceBuffer,i={};for(var o in t)i[o]=hi.getBuffered(t[o]);a.appendErrors[_]=0,"audio"===_||"video"===_?a.appendErrors.audiovideo=0:(a.appendErrors.audio=0,a.appendErrors.video=0),a.hls.trigger(P.BUFFER_APPENDED,{type:_,frag:r,part:T,chunkMeta:S,parent:r.type,timeRanges:i})},onError:function(e){var t={type:B.MEDIA_ERROR,parent:r.type,details:f.BUFFER_APPEND_ERROR,sourceBufferName:_,frag:r,part:T,chunkMeta:S,error:e,err:e,fatal:!1};if(e.code===DOMException.QUOTA_EXCEEDED_ERR)t.details=f.BUFFER_FULL_ERROR;else{var o=++a.appendErrors[_];t.details=f.BUFFER_APPEND_ERROR,a.warn("Failed "+o+"/"+i.config.appendErrorMaxRetry+' times to append segment in "'+_+'" sourceBuffer'),o>=i.config.appendErrorMaxRetry&&(t.fatal=!0)}i.trigger(P.ERROR,t)}};o.append(N,_,!!this.pendingTracks[_])},t.onBufferFlushing=function(e,t){var a=this,i=this.operationQueue,o=function(e){return{execute:a.removeExecutor.bind(a,e,t.startOffset,t.endOffset),onStart:function(){},onComplete:function(){a.hls.trigger(P.BUFFER_FLUSHED,{type:e})},onError:function(t){a.warn("Failed to remove from "+e+" SourceBuffer",t)}}};t.type?i.append(o(t.type),t.type):this.getSourceBufferTypes().forEach(function(e){i.append(o(e),e)})},t.onFragParsed=function(e,t){var a=this,i=t.frag,o=t.part,E=[],n=o?o.elementaryStreams:i.elementaryStreams;n[z.AUDIOVIDEO]?E.push("audiovideo"):(n[z.AUDIO]&&E.push("audio"),n[z.VIDEO]&&E.push("video"));var _=function(){var e=self.performance.now();i.stats.buffering.end=e,o&&(o.stats.buffering.end=e);var t=o?o.stats:i.stats;a.hls.trigger(P.FRAG_BUFFERED,{frag:i,part:o,stats:t,id:i.type})};0===E.length&&this.warn("Fragments must have at least one ElementaryStreamType set. type: "+i.type+" level: "+i.level+" sn: "+i.sn),this.blockBuffers(_,E)},t.onFragChanged=function(e,t){this.trimBuffers()},t.onBufferEos=function(e,t){var a=this;this.getSourceBufferTypes().reduce(function(e,i){var o=a.sourceBuffer[i];return!o||t.type&&t.type!==i||(o.ending=!0,o.ended||(o.ended=!0,a.log(i+" sourceBuffer now EOS"))),e&&!(o&&!o.ended)},!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers(function(){a.getSourceBufferTypes().forEach(function(e){var t=a.sourceBuffer[e];t&&(t.ending=!1)});var e=a.mediaSource;e&&"open"===e.readyState?(a.log("Calling mediaSource.endOfStream()"),e.endOfStream()):e&&a.log("Could not call mediaSource.endOfStream(). mediaSource.readyState: "+e.readyState)}))},t.onLevelUpdated=function(e,t){var a=t.details;a.fragments.length&&(this.details=a,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())},t.trimBuffers=function(){var e=this.hls,t=this.details,a=this.media;if(a&&null!==t&&this.getSourceBufferTypes().length){var i=e.config,o=a.currentTime,E=t.levelTargetDuration,n=t.live&&null!==i.liveBackBufferLength?i.liveBackBufferLength:i.backBufferLength;if(C(n)&&n>0){var _=Math.max(n,E),r=Math.floor(o/E)*E-_;this.flushBackBuffer(o,E,r)}if(C(i.frontBufferFlushThreshold)&&i.frontBufferFlushThreshold>0){var T=Math.max(i.maxBufferLength,i.frontBufferFlushThreshold),S=Math.max(T,E),s=Math.floor(o/E)*E+S;this.flushFrontBuffer(o,E,s)}}},t.flushBackBuffer=function(e,t,a){var i=this,o=this.details,E=this.sourceBuffer;this.getSourceBufferTypes().forEach(function(n){var _=E[n];if(_){var r=hi.getBuffered(_);if(r.length>0&&a>r.start(0)){if(i.hls.trigger(P.BACK_BUFFER_REACHED,{bufferEnd:a}),null!=o&&o.live)i.hls.trigger(P.LIVE_BACK_BUFFER_REACHED,{bufferEnd:a});else if(_.ended&&r.end(r.length-1)-e<2*t)return void i.log("Cannot flush "+n+" back buffer while SourceBuffer is in ended state");i.hls.trigger(P.BUFFER_FLUSHING,{startOffset:0,endOffset:a,type:n})}}})},t.flushFrontBuffer=function(e,t,a){var i=this,o=this.sourceBuffer;this.getSourceBufferTypes().forEach(function(E){var n=o[E];if(n){var _=hi.getBuffered(n),r=_.length;if(r<2)return;var T=_.start(r-1),S=_.end(r-1);if(a>T||e>=T&&e<=S)return;if(n.ended&&e-S<2*t)return void i.log("Cannot flush "+E+" front buffer while SourceBuffer is in ended state");i.hls.trigger(P.BUFFER_FLUSHING,{startOffset:T,endOffset:1/0,type:E})}})},t.updateMediaElementDuration=function(){if(this.details&&this.media&&this.mediaSource&&"open"===this.mediaSource.readyState){var e=this.details,t=this.hls,a=this.media,i=this.mediaSource,o=e.fragments[0].start+e.totalduration,E=a.duration,n=C(i.duration)?i.duration:0;e.live&&t.config.liveDurationInfinity?(i.duration=1/0,this.updateSeekableRange(e)):(o>n&&o>E||!C(E))&&(this.log("Updating Media Source duration to "+o.toFixed(3)),i.duration=o)}},t.updateSeekableRange=function(e){var t=this.mediaSource,a=e.fragments;if(a.length&&e.live&&null!=t&&t.setLiveSeekableRange){var i=Math.max(0,a[0].start),o=Math.max(i,i+e.totalduration);this.log("Media Source duration is set to "+t.duration+". Setting seekable range to "+i+"-"+o+"."),t.setLiveSeekableRange(i,o)}},t.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.operationQueue,a=this.pendingTracks,i=Object.keys(a).length;if(i&&(!e||2===i||"audiovideo"in a)){this.createSourceBuffers(a),this.pendingTracks={};var o=this.getSourceBufferTypes();if(o.length)this.hls.trigger(P.BUFFER_CREATED,{tracks:this.tracks}),o.forEach(function(e){t.executeNext(e)});else{var E=new Error("could not create source buffer for media codec(s)");this.hls.trigger(P.ERROR,{type:B.MEDIA_ERROR,details:f.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:E,reason:E.message})}}},t.createSourceBuffers=function(e){var t=this,a=this.sourceBuffer,i=this.mediaSource;if(!i)throw Error("createSourceBuffers called when mediaSource was null");var o=function(o){if(!a[o]){var E=e[o];if(!E)throw Error("source buffer exists for track "+o+", however track does not");var n=E.levelCodec||E.codec;n&&"audio"===o.slice(0,5)&&(n=Mt(n,t.hls.config.preferManagedMediaSource));var _=E.container+";codecs="+n;t.log("creating sourceBuffer("+_+")");try{var r=a[o]=i.addSourceBuffer(_),T=o;t.addBufferListener(T,"updatestart",t._onSBUpdateStart),t.addBufferListener(T,"updateend",t._onSBUpdateEnd),t.addBufferListener(T,"error",t._onSBUpdateError),t.addBufferListener(T,"bufferedchange",function(e,a){var i=a.removedRanges;null!=i&&i.length&&t.hls.trigger(P.BUFFER_FLUSHED,{type:o})}),t.tracks[o]={buffer:r,codec:n,container:E.container,levelCodec:E.levelCodec,metadata:E.metadata,id:E.id}}catch(e){t.error("error while trying to add sourceBuffer: "+e.message),t.hls.trigger(P.ERROR,{type:B.MEDIA_ERROR,details:f.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,sourceBufferName:o,mimeType:_})}}};for(var E in e)o(E)},t._onSBUpdateStart=function(e){this.operationQueue.current(e).onStart()},t._onSBUpdateEnd=function(e){var t;if("closed"!==(null==(t=this.mediaSource)?void 0:t.readyState)){var a=this.operationQueue;a.current(e).onComplete(),a.shiftAndExecuteNext(e)}else this.resetBuffer(e)},t._onSBUpdateError=function(e,t){var a,i=new Error(e+" SourceBuffer error. MediaSource readyState: "+(null==(a=this.mediaSource)?void 0:a.readyState));this.error(""+i,t),this.hls.trigger(P.ERROR,{type:B.MEDIA_ERROR,details:f.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:i,fatal:!1});var o=this.operationQueue.current(e);o&&o.onError(i)},t.removeExecutor=function(e,t,a){var i=this.media,o=this.mediaSource,E=this.operationQueue,n=this.sourceBuffer[e];if(!i||!o||!n)return this.warn("Attempting to remove from the "+e+" SourceBuffer, but it does not exist"),void E.shiftAndExecuteNext(e);var _=C(i.duration)?i.duration:1/0,r=C(o.duration)?o.duration:1/0,T=Math.max(0,t),S=Math.min(a,_,r);S>T&&(!n.ending||n.ended)?(n.ended=!1,this.log("Removing ["+T+","+S+"] from the "+e+" SourceBuffer"),n.remove(T,S)):E.shiftAndExecuteNext(e)},t.appendExecutor=function(e,t){var a=this.sourceBuffer[t];if(a)a.ended=!1,a.appendBuffer(e);else if(!this.pendingTracks[t])throw new Error("Attempting to append to the "+t+" SourceBuffer, but it does not exist")},t.blockBuffers=function(e,t){var a=this;if(void 0===t&&(t=this.getSourceBufferTypes()),!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve().then(e);var i=this.operationQueue,o=t.map(function(e){return i.appendBlocker(e)});Promise.all(o).then(function(){e(),t.forEach(function(e){var t=a.sourceBuffer[e];null!=t&&t.updating||i.shiftAndExecuteNext(e)})})},t.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},t.addBufferListener=function(e,t,a){var i=this.sourceBuffer[e];if(i){var o=a.bind(this,e);this.listeners[e].push({event:t,listener:o}),i.addEventListener(t,o)}},t.removeBufferListeners=function(e){var t=this.sourceBuffer[e];t&&this.listeners[e].forEach(function(e){t.removeEventListener(e.event,e.listener)})},_(e,[{key:"mediaSrc",get:function(){var e,t=(null==(e=this.media)?void 0:e.firstChild)||this.media;return null==t?void 0:t.src}}]),e})();function KE(e){var t=e.querySelectorAll("source");[].slice.call(t).forEach(function(t){e.removeChild(t)})}function jE(e,t){var a=self.document.createElement("source");a.type="video/mp4",a.src=t,e.appendChild(a)}var xE={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},QE=function(e){var t=e;return xE.hasOwnProperty(e)&&(t=xE[e]),String.fromCharCode(t)},XE=15,$E=100,qE={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},JE={17:2,18:4,21:6,22:8,23:10,19:13,20:15},ZE={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},en={25:2,26:4,29:6,30:8,31:10,27:13,28:15},tn=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],an=(function(){function e(){this.time=null,this.verboseLevel=0}return e.prototype.log=function(e,t){if(this.verboseLevel>=e){var a="function"==typeof t?t():t;y.log(this.time+" ["+e+"] "+a)}},e})(),on=function(e){for(var t=[],a=0;a$E&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=$E)},t.moveCursor=function(e){var t=this.pos+e;if(e>1)for(var a=this.pos+1;a=144&&this.backSpace();var a=QE(e);this.pos>=$E?this.logger.log(0,function(){return"Cannot insert "+e.toString(16)+" ("+a+") at position "+t.pos+". Skipping it!"}):(this.chars[this.pos].setChar(a,this.currPenState),this.moveCursor(1))},t.clearFromPos=function(e){var t;for(t=e;t<$E;t++)this.chars[t].reset()},t.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},t.clearToEndOfRow=function(){this.clearFromPos(this.pos)},t.getTextString=function(){for(var e=[],t=!0,a=0;a<$E;a++){var i=this.chars[a].uchar;" "!==i&&(t=!1),e.push(i)}return t?"":e.join("")},t.setPenStyles=function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)},e})(),rn=(function(){function e(e){this.rows=[],this.currRow=XE-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(var t=0;t0&&(a=e?"["+t.join(" | ")+"]":t.join("\n")),a},t.getTextAndFormat=function(){return this.rows},e})(),Tn=(function(){function e(e,t,a){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new rn(a),this.nonDisplayedMemory=new rn(a),this.lastOutputScreen=new rn(a),this.currRollUpRow=this.displayedMemory.rows[XE-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=a}var t=e.prototype;return t.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[XE-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},t.getHandler=function(){return this.outputFilter},t.setHandler=function(e){this.outputFilter=e},t.setPAC=function(e){this.writeScreen.setPAC(e)},t.setBkgData=function(e){this.writeScreen.setBkgData(e)},t.setMode=function(e){e!==this.mode&&(this.mode=e,this.logger.log(2,function(){return"MODE="+e}),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)},t.insertChars=function(e){for(var t=this,a=0;a=46,t.italics)t.foreground="white";else{var a=Math.floor(e/2)-16,i=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=i[a]}this.logger.log(2,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)},t.outputDataUpdate=function(e){void 0===e&&(e=!1);var t=this.logger.time;null!==t&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))},t.cueSplitAtTime=function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))},e})(),Sn=(function(){function e(e,t,a){this.channels=void 0,this.currentChannel=0,this.cmdHistory=In(),this.logger=void 0;var i=this.logger=new an;this.channels=[null,new Tn(e,t,i),new Tn(e+1,a,i)]}var t=e.prototype;return t.getHandler=function(e){return this.channels[e].getHandler()},t.setHandler=function(e,t){this.channels[e].setHandler(t)},t.addData=function(e,t){var a,i,o,E=!1;this.logger.time=e;for(var n=0;n ("+on([i,o])+")"),(a=this.parseCmd(i,o))||(a=this.parseMidrow(i,o)),a||(a=this.parsePAC(i,o)),a||(a=this.parseBackgroundAttributes(i,o)),!a&&(E=this.parseChars(i,o))){var _=this.currentChannel;_&&_>0?this.channels[_].insertChars(E):this.logger.log(2,"No channel found yet. TEXT-MODE?")}a||E||this.logger.log(2,"Couldn't parse cleaned data "+on([i,o])+" orig: "+on([t[n],t[n+1]]))}},t.parseCmd=function(e,t){var a=this.cmdHistory;if(!((20===e||28===e||21===e||29===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=33&&t<=35))return!1;if(ln(e,t,a))return sn(null,null,a),this.logger.log(3,"Repeated command ("+on([e,t])+") is dropped"),!0;var i=20===e||21===e||23===e?1:2,o=this.channels[i];return 20===e||21===e||28===e||29===e?32===t?o.ccRCL():33===t?o.ccBS():34===t?o.ccAOF():35===t?o.ccAON():36===t?o.ccDER():37===t?o.ccRU(2):38===t?o.ccRU(3):39===t?o.ccRU(4):40===t?o.ccFON():41===t?o.ccRDC():42===t?o.ccTR():43===t?o.ccRTD():44===t?o.ccEDM():45===t?o.ccCR():46===t?o.ccENM():47===t&&o.ccEOC():o.ccTO(t-32),sn(e,t,a),this.currentChannel=i,!0},t.parseMidrow=function(e,t){var a=0;if((17===e||25===e)&&t>=32&&t<=47){if((a=17===e?1:2)!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;var i=this.channels[a];return!!i&&(i.ccMIDROW(t),this.logger.log(3,"MIDROW ("+on([e,t])+")"),!0)}return!1},t.parsePAC=function(e,t){var a,i=this.cmdHistory;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127||(16===e||24===e)&&t>=64&&t<=95))return!1;if(ln(e,t,i))return sn(null,null,i),!0;var o=e<=23?1:2;a=t>=64&&t<=95?1===o?qE[e]:ZE[e]:1===o?JE[e]:en[e];var E=this.channels[o];return!!E&&(E.setPAC(this.interpretPAC(a,t)),sn(e,t,i),this.currentChannel=o,!0)},t.interpretPAC=function(e,t){var a,i={color:null,italics:!1,indent:null,underline:!1,row:e};return a=t>95?t-96:t-64,i.underline=!(1&~a),a<=13?i.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(a/2)]:a<=15?(i.italics=!0,i.color="white"):i.indent=4*Math.floor((a-16)/2),i},t.parseChars=function(e,t){var a,i,o=null,E=null;if(e>=25?(a=2,E=e-8):(a=1,E=e),E>=17&&E<=19?(i=17===E?t+80:18===E?t+112:t+144,this.logger.log(2,"Special char '"+QE(i)+"' in channel "+a),o=[i]):e>=32&&e<=127&&(o=0===t?[e]:[e,t]),o){var n=on(o);this.logger.log(3,"Char codes = "+n.join(",")),sn(e,t,this.cmdHistory)}return o},t.parseBackgroundAttributes=function(e,t){var a;if(!((16===e||24===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=45&&t<=47))return!1;var i={};16===e||24===e?(a=Math.floor((t-32)/2),i.background=tn[a],t%2==1&&(i.background=i.background+"_semi")):45===t?i.background="transparent":(i.foreground="black",47===t&&(i.underline=!0));var o=e<=23?1:2;return this.channels[o].setBkgData(i),sn(e,t,this.cmdHistory),!0},t.reset=function(){for(var e=0;ee)&&(this.startTime=e),this.endTime=t,this.screen=a,this.timelineController.createCaptionsTrack(this.trackName)},t.reset=function(){this.cueRanges=[],this.startTime=null},e})(),On=(function(){if(null!=te&&te.VTTCue)return self.VTTCue;var e=["","lr","rl"],t=["start","middle","end","left","right"];function a(e,t){if("string"!=typeof t)return!1;if(!Array.isArray(e))return!1;var a=t.toLowerCase();return!!~e.indexOf(a)&&a}function i(t){return a(e,t)}function o(e){return a(t,e)}function E(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),i=1;i100)throw new Error("Position must be between 0 and 100.");N=e,this.hasBeenReset=!0}})),Object.defineProperty(n,"positionAlign",E({},_,{get:function(){return R},set:function(e){var t=o(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");R=t,this.hasBeenReset=!0}})),Object.defineProperty(n,"size",E({},_,{get:function(){return c},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");c=e,this.hasBeenReset=!0}})),Object.defineProperty(n,"align",E({},_,{get:function(){return m},set:function(e){var t=o(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");m=t,this.hasBeenReset=!0}})),n.displayState=void 0}return n.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},n})(),un=(function(){function e(){}return e.prototype.decode=function(e,t){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))},e})();function dn(e){function t(e,t,a,i){return 3600*(0|e)+60*(0|t)+(0|a)+parseFloat(i||0)}var a=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return a?parseFloat(a[2])>59?t(a[2],a[3],0,a[4]):t(a[1],a[2],a[3],a[4]):null}var Nn=(function(){function e(){this.values=Object.create(null)}var t=e.prototype;return t.set=function(e,t){this.get(e)||""===t||(this.values[e]=t)},t.get=function(e,t,a){return a?this.has(e)?this.values[e]:t[a]:this.has(e)?this.values[e]:t},t.has=function(e){return e in this.values},t.alt=function(e,t,a){for(var i=0;i=0&&a<=100)return this.set(e,a),!0}return!1},e})();function Rn(e,t,a,i){var o=i?e.split(i):[e];for(var E in o)if("string"==typeof o[E]){var n=o[E].split(a);2===n.length&&t(n[0],n[1])}}var cn=new On(0,0,""),mn="middle"===cn.align?"middle":"center";function Ln(e,t,a){var i=e;function o(){var t=dn(e);if(null===t)throw new Error("Malformed timestamp: "+i);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function E(e,t){var i=new Nn;Rn(e,function(e,t){var o;switch(e){case"region":for(var E=a.length-1;E>=0;E--)if(a[E].id===t){i.set(e,a[E].region);break}break;case"vertical":i.alt(e,t,["rl","lr"]);break;case"line":o=t.split(","),i.integer(e,o[0]),i.percent(e,o[0])&&i.set("snapToLines",!1),i.alt(e,o[0],["auto"]),2===o.length&&i.alt("lineAlign",o[1],["start",mn,"end"]);break;case"position":o=t.split(","),i.percent(e,o[0]),2===o.length&&i.alt("positionAlign",o[1],["start",mn,"end","line-left","line-right","auto"]);break;case"size":i.percent(e,t);break;case"align":i.alt(e,t,["start",mn,"end","left","right"])}},/:/,/\s/),t.region=i.get("region",null),t.vertical=i.get("vertical","");var o=i.get("line","auto");"auto"===o&&-1===cn.line&&(o=-1),t.line=o,t.lineAlign=i.get("lineAlign","start"),t.snapToLines=i.get("snapToLines",!0),t.size=i.get("size",100),t.align=i.get("align",mn);var E=i.get("position","auto");"auto"===E&&50===cn.position&&(E="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=E}function n(){e=e.replace(/^\s+/,"")}if(n(),t.startTime=o(),n(),"--\x3e"!==e.slice(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+i);e=e.slice(3),n(),t.endTime=o(),n(),E(e,t)}function Dn(e){return e.replace(//gi,"\n")}var Cn=(function(){function e(){this.state="INITIAL",this.buffer="",this.decoder=new un,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var t=e.prototype;return t.parse=function(e){var t=this;function a(){var e=t.buffer,a=0;for(e=Dn(e);a9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!(C(t)&&C(a)&&C(i)&&C(o)))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+e);return t+=1e3*a,t+=6e4*i,t+=36e5*o},Bn=function(e){for(var t=5381,a=e.length;a;)t=33*t^e.charCodeAt(--a);return(t>>>0).toString()};function fn(e,t,a){return Bn(e.toString())+Bn(t.toString())+Bn(a)}var gn=function(e,t,a){var i=e[t],o=e[i.prevCC];if(!o||!o.new&&i.new)return e.ccOffset=e.presentationOffset=i.start,void(i.new=!1);for(;null!=(E=o)&&E.new;){var E;e.ccOffset+=i.start-o.start,i.new=!1,o=e[(i=o).prevCC]}e.presentationOffset=a};function vn(e,t,a,i,o,E,n){var _,r=new Cn,T=fe(new Uint8Array(e)).trim().replace(pn,"\n").split("\n"),S=[],s=t?qo(t.baseTime,t.timescale):0,l="00:00.000",I=0,A=0,O=!0;r.oncue=function(e){var E=a[i],n=a.ccOffset,r=(I-s)/9e4;if(null!=E&&E.new&&(void 0!==A?n=a.ccOffset=E.start:gn(a,i,r)),r){if(!t)return void(_=new Error("Missing initPTS for VTT MPEGTS"));n=r-a.presentationOffset}var T=e.endTime-e.startTime,l=EE(9e4*(e.startTime+n-A),9e4*o)/9e4;e.startTime=Math.max(l,0),e.endTime=Math.max(l+T,0);var O=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(O)),e.id||(e.id=fn(e.startTime,e.endTime,O)),e.endTime>0&&S.push(e)},r.onparsingerror=function(e){_=e},r.onflush=function(){_?n(_):E(S)},T.forEach(function(e){if(O){if(hn(e,"X-TIMESTAMP-MAP=")){O=!1,e.slice(16).split(",").forEach(function(e){hn(e,"LOCAL:")?l=e.slice(6):hn(e,"MPEGTS:")&&(I=parseInt(e.slice(7)))});try{A=Pn(l)/1e3}catch(e){_=e}return}""===e&&(O=!1)}r.parse(e+"\n")}),r.flush()}var Mn="stpp.ttml.im1t",Wn=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Un=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Gn={left:"start",center:"center",right:"end",start:"start",end:"end"};function yn(e,t,a,i){var o=Ye(new Uint8Array(e),["mdat"]);if(0!==o.length){var E=o.map(function(e){return fe(e)}),n=Xo(t.baseTime,1,t.timescale);try{E.forEach(function(e){return a(bn(e,n))})}catch(e){i(e)}}else i(new Error("Could not parse IMSC1 mdat"))}function bn(e,t){var a=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("tt")[0];if(!a)throw new Error("Invalid ttml");var i={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},o=Object.keys(i).reduce(function(e,t){return e[t]=a.getAttribute("ttp:"+t)||i[t],e},{}),E="preserve"!==a.getAttribute("xml:space"),n=Fn(kn(a,"styling","style")),_=Fn(kn(a,"layout","region")),r=kn(a,"body","[begin]");return[].map.call(r,function(e){var a=Vn(e,E);if(!a||!e.hasAttribute("begin"))return null;var i=zn(e.getAttribute("begin"),o),r=zn(e.getAttribute("dur"),o),S=zn(e.getAttribute("end"),o);if(null===i)throw wn(e);if(null===S){if(null===r)throw wn(e);S=i+r}var s=new On(i-t,S-t,a);s.id=fn(s.startTime,s.endTime,s.text);var l=Hn(_[e.getAttribute("region")],n[e.getAttribute("style")],n),I=l.textAlign;if(I){var A=Gn[I];A&&(s.lineAlign=A),s.align=I}return T(s,l),s}).filter(function(e){return null!==e})}function kn(e,t,a){var i=e.getElementsByTagName(t)[0];return i?[].slice.call(i.querySelectorAll(a)):[]}function Fn(e){return e.reduce(function(e,t){var a=t.getAttribute("xml:id");return a&&(e[a]=t),e},{})}function Vn(e,t){return[].slice.call(e.childNodes).reduce(function(e,a,i){var o;return"br"===a.nodeName&&i?e+"\n":null!=(o=a.childNodes)&&o.length?Vn(a,t):t?e+a.textContent.trim().replace(/\s+/g," "):e+a.textContent},"")}function Hn(e,t,a){var i="http://www.w3.org/ns/ttml#styling",o=null,E=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],n=null!=e&&e.hasAttribute("style")?e.getAttribute("style"):null;return n&&a.hasOwnProperty(n)&&(o=a[n]),E.reduce(function(a,E){var n=Yn(t,i,E)||Yn(e,i,E)||Yn(o,i,E);return n&&(a[E]=n),a},{})}function Yn(e,t,a){return e&&e.hasAttributeNS(t,a)?e.getAttributeNS(t,a):null}function wn(e){return new Error("Could not parse ttml timestamp "+e)}function zn(e,t){if(!e)return null;var a=dn(e);return null===a&&(Wn.test(e)?a=Kn(e,t):Un.test(e)&&(a=jn(e,t))),a}function Kn(e,t){var a=Wn.exec(e),i=(0|a[4])+(0|a[5])/t.subFrameRate;return 3600*(0|a[1])+60*(0|a[2])+(0|a[3])+i/t.frameRate}function jn(e,t){var a=Un.exec(e),i=Number(a[1]);switch(a[2]){case"h":return 3600*i;case"m":return 60*i;case"ms":return 1e3*i;case"f":return i/t.frameRate;case"t":return i/t.tickRate}return i}var xn=(function(){function e(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=qn(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(P.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(P.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(P.MANIFEST_LOADING,this.onManifestLoading,this),e.on(P.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(P.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(P.FRAG_LOADING,this.onFragLoading,this),e.on(P.FRAG_LOADED,this.onFragLoaded,this),e.on(P.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(P.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(P.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(P.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(P.BUFFER_FLUSHING,this.onBufferFlushing,this)}var t=e.prototype;return t.destroy=function(){var e=this.hls;e.off(P.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(P.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(P.MANIFEST_LOADING,this.onManifestLoading,this),e.off(P.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(P.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(P.FRAG_LOADING,this.onFragLoading,this),e.off(P.FRAG_LOADED,this.onFragLoaded,this),e.off(P.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(P.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(P.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(P.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(P.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=null,this.cea608Parser1=this.cea608Parser2=void 0},t.initCea608Parsers=function(){if(this.config.enableCEA708Captions&&(!this.cea608Parser1||!this.cea608Parser2)){var e=new An(this,"textTrack1"),t=new An(this,"textTrack2"),a=new An(this,"textTrack3"),i=new An(this,"textTrack4");this.cea608Parser1=new Sn(1,e,t),this.cea608Parser2=new Sn(3,a,i)}},t.addCues=function(e,t,a,i,o){for(var E=!1,n=o.length;n--;){var _=o[n],r=$n(_[0],_[1],t,a);if(r>=0&&(_[0]=Math.min(_[0],t),_[1]=Math.max(_[1],a),E=!0,r/(a-t)>.5))return}if(E||o.push([t,a]),this.config.renderTextTracksNatively){var T=this.captionsTracks[e];this.Cues.newCue(T,t,a,i)}else{var S=this.Cues.newCue(null,t,a,i);this.hls.trigger(P.CUES_PARSED,{type:"captions",cues:S,track:e})}},t.onInitPtsFound=function(e,t){var a=this,i=t.frag,o=t.id,E=t.initPTS,n=t.timescale,_=this.unparsedVttFrags;"main"===o&&(this.initPTS[i.cc]={baseTime:E,timescale:n}),_.length&&(this.unparsedVttFrags=[],_.forEach(function(e){a.onFragLoaded(P.FRAG_LOADED,e)}))},t.getExistingTrack=function(e,t){var a=this.media;if(a)for(var i=0;ii.cc||r.trigger(P.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,error:t})})}else n.push(e)},t._fallbackToIMSC1=function(e,t){var a=this,i=this.tracks[e.level];i.textCodec||yn(t,this.initPTS[e.cc],function(){i.textCodec=Mn,a._parseIMSC1(e,t)},function(){i.textCodec="wvtt"})},t._appendCues=function(e,t){var a=this.hls;if(this.config.renderTextTracksNatively){var i=this.textTracks[t];if(!i||"disabled"===i.mode)return;e.forEach(function(e){return ta(i,e)})}else{var o=this.tracks[t];if(!o)return;var E=o.default?"default":"subtitles"+t;a.trigger(P.CUES_PARSED,{type:"subtitles",cues:e,track:E})}},t.onFragDecrypted=function(e,t){t.frag.type===$t.SUBTITLE&&this.onFragLoaded(P.FRAG_LOADED,t)},t.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},t.onFragParsingUserdata=function(e,t){this.initCea608Parsers();var a=this.cea608Parser1,i=this.cea608Parser2;if(this.enabled&&a&&i){var o=t.frag,E=t.samples;if(o.type!==$t.MAIN||"NONE"!==this.closedCaptionsForLevel(o))for(var n=0;nthis.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}},t.getMaxLevel=function(t){var a=this,i=this.hls.levels;if(!i.length)return-1;var o=i.filter(function(e,i){return a.isLevelAllowed(e)&&i<=t});return this.clientRect=null,e.getMaxLevelByMediaSize(o,this.mediaWidth,this.mediaHeight)},t.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},t.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},t.getDimensions=function(){if(this.clientRect)return this.clientRect;var e=this.media,t={width:0,height:0};if(e){var a=e.getBoundingClientRect();t.width=a.width,t.height=a.height,t.width||t.height||(t.width=a.right-a.left||e.width||0,t.height=a.bottom-a.top||e.height||0)}return this.clientRect=t,t},t.isLevelAllowed=function(e){return!this.restrictedLevels.some(function(t){return e.bitrate===t.bitrate&&e.width===t.width&&e.height===t.height})},e.getMaxLevelByMediaSize=function(e,t,a){if(null==e||!e.length)return-1;for(var i=function(e,t){return!t||e.width!==t.width||e.height!==t.height},o=e.length-1,E=Math.max(t,a),n=0;n=E||_.height>=E)&&i(_,e[n+1])){o=n;break}}return o},_(e,[{key:"mediaWidth",get:function(){return this.getDimensions().width*this.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*this.contentScaleFactor}},{key:"contentScaleFactor",get:function(){var e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch(e){}return e}}]),e})(),Zn=(function(){function e(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}var t=e.prototype;return t.setStreamController=function(e){this.streamController=e},t.registerListeners=function(){this.hls.on(P.MEDIA_ATTACHING,this.onMediaAttaching,this)},t.unregisterListeners=function(){this.hls.off(P.MEDIA_ATTACHING,this.onMediaAttaching,this)},t.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},t.onMediaAttaching=function(e,t){var a=this.hls.config;if(a.capLevelOnFPSDrop){var i=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=i,i&&"function"==typeof i.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),a.fpsDroppedMonitoringPeriod)}},t.checkFPS=function(e,t,a){var i=performance.now();if(t){if(this.lastTime){var o=i-this.lastTime,E=a-this.lastDroppedFrames,n=t-this.lastDecodedFrames,_=1e3*E/o,r=this.hls;if(r.trigger(P.FPS_DROP,{currentDropped:E,currentDecoded:n,totalDroppedFrames:a}),_>0&&E>r.config.fpsDroppedMonitoringThreshold*n){var T=r.currentLevel;y.warn("drop FPS ratio greater than max allowed value for currentLevel: "+T),T>0&&(-1===r.autoLevelCapping||r.autoLevelCapping>=T)&&(T-=1,r.trigger(P.FPS_DROP_LEVEL_CAPPING,{level:T,droppedLevel:r.currentLevel}),r.autoLevelCapping=T,this.streamController.nextLevelSwitch())}}this.lastTime=i,this.lastDroppedFrames=a,this.lastDecodedFrames=t}},t.checkFPSInterval=function(){var e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){var t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)},e})(),e_="[eme]",t_=(function(){function e(t){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=e.CDMCleanupPromise?[e.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=y.debug.bind(y,e_),this.log=y.log.bind(y,e_),this.warn=y.warn.bind(y,e_),this.error=y.error.bind(y,e_),this.hls=t,this.config=t.config,this.registerListeners()}var t=e.prototype;return t.destroy=function(){this.unregisterListeners(),this.onMediaDetached();var e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null},t.registerListeners=function(){this.hls.on(P.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(P.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(P.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(P.MANIFEST_LOADED,this.onManifestLoaded,this)},t.unregisterListeners=function(){this.hls.off(P.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(P.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(P.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(P.MANIFEST_LOADED,this.onManifestLoaded,this)},t.getLicenseServerUrl=function(e){var t=this.config,a=t.drmSystems,i=t.widevineLicenseUrl,o=a[e];if(o)return o.licenseUrl;if(e===ae.WIDEVINE&&i)return i;throw new Error('no license server URL configured for key-system "'+e+'"')},t.getServerCertificateUrl=function(e){var t=this.config.drmSystems[e];if(t)return t.serverCertificateUrl;this.log('No Server Certificate in config.drmSystems["'+e+'"]')},t.attemptKeySystemAccess=function(e){var t=this,a=this.hls.levels,i=function(e,t,a){return!!e&&a.indexOf(e)===t},o=a.map(function(e){return e.audioCodec}).filter(i),E=a.map(function(e){return e.videoCodec}).filter(i);return o.length+E.length===0&&E.push("avc1.42e01e"),new Promise(function(a,i){!(function e(n){var _=n.shift();t.getMediaKeysPromise(_,o,E).then(function(e){return a({keySystem:_,mediaKeys:e})}).catch(function(t){n.length?e(n):i(t instanceof n_?t:new n_({type:B.KEY_SYSTEM_ERROR,details:f.KEY_SYSTEM_NO_ACCESS,error:t,fatal:!0},t.message))})})(e)})},t.requestMediaKeySystemAccess=function(e,t){var a=this.config.requestMediaKeySystemAccessFunc;if("function"!=typeof a){var i="Configured requestMediaKeySystemAccess is not a function "+a;return null===Se&&"http:"===self.location.protocol&&(i="navigator.requestMediaKeySystemAccess is not available over insecure protocol "+location.protocol),Promise.reject(new Error(i))}return a(e,t)},t.getMediaKeysPromise=function(e,t,a){var i=this,o=se(e,t,a,this.config.drmSystemOptions),E=this.keySystemAccessPromises[e],n=null==E?void 0:E.keySystemAccess;if(!n){this.log('Requesting encrypted media "'+e+'" key-system access with config: '+JSON.stringify(o)),n=this.requestMediaKeySystemAccess(e,o);var _=this.keySystemAccessPromises[e]={keySystemAccess:n};return n.catch(function(t){i.log('Failed to obtain access to key-system "'+e+'": '+t)}),n.then(function(t){i.log('Access for key-system "'+t.keySystem+'" obtained');var a=i.fetchServerCertificate(e);return i.log('Create media-keys for "'+e+'"'),_.mediaKeys=t.createMediaKeys().then(function(t){return i.log('Media-keys created for "'+e+'"'),a.then(function(a){return a?i.setMediaKeysServerCertificate(t,e,a):t})}),_.mediaKeys.catch(function(t){i.error('Failed to create media-keys for "'+e+'"}: '+t)}),_.mediaKeys})}return n.then(function(){return E.mediaKeys})},t.createMediaKeySessionContext=function(e){var t=e.decryptdata,a=e.keySystem,i=e.mediaKeys;this.log('Creating key-system session "'+a+'" keyId: '+ve.hexDump(t.keyId||[]));var o=i.createSession(),E={decryptdata:t,keySystem:a,mediaKeys:i,mediaKeysSession:o,keyStatus:"status-pending"};return this.mediaKeySessions.push(E),E},t.renewKeySession=function(e){var t=e.decryptdata;if(t.pssh){var a=this.createMediaKeySessionContext(e),i=this.getKeyIdString(t),o="cenc";this.keyIdToKeySessionPromise[i]=this.generateRequestWithPreferredKeySession(a,o,t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)},t.getKeyIdString=function(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(null===e.keyId)throw new Error("keyId is null");return ve.hexDump(e.keyId)},t.updateKeySession=function(e,t){var a,i=e.mediaKeysSession;return this.log('Updating key-session "'+i.sessionId+'" for keyID '+ve.hexDump((null==(a=e.decryptdata)?void 0:a.keyId)||[])+"\n } (data length: "+(t?t.byteLength:t)+")"),i.update(t)},t.selectKeySystemFormat=function(e){var t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log("Selecting key-system from fragment (sn: "+e.sn+" "+e.type+": "+e.level+") key formats "+t.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise},t.getKeyFormatPromise=function(e){var t=this;return new Promise(function(a,i){var o=re(t.config),E=e.map(oe).filter(function(e){return!!e&&-1!==o.indexOf(e)});return t.getKeySystemSelectionPromise(E).then(function(e){var t=e.keySystem,o=_e(t);o?a(o):i(new Error('Unable to find format for key-system "'+t+'"'))}).catch(i)})},t.loadKey=function(e){var t=this,a=e.keyInfo.decryptdata,i=this.getKeyIdString(a),o="(keyId: "+i+' format: "'+a.keyFormat+'" method: '+a.method+" uri: "+a.uri+")";this.log("Starting session for key "+o);var E=this.keyIdToKeySessionPromise[i];return E||(E=this.keyIdToKeySessionPromise[i]=this.getKeySystemForKeyPromise(a).then(function(i){var E=i.keySystem,n=i.mediaKeys;return t.throwIfDestroyed(),t.log("Handle encrypted media sn: "+e.frag.sn+" "+e.frag.type+": "+e.frag.level+" using key "+o),t.attemptSetMediaKeys(E,n).then(function(){t.throwIfDestroyed();var e=t.createMediaKeySessionContext({keySystem:E,mediaKeys:n,decryptdata:a}),i="cenc";return t.generateRequestWithPreferredKeySession(e,i,a.pssh,"playlist-key")})})).catch(function(e){return t.handleError(e)}),E},t.throwIfDestroyed=function(e){if(!this.hls)throw new Error("invalid state")},t.handleError=function(e){this.hls&&(this.error(e.message),e instanceof n_?this.hls.trigger(P.ERROR,e.data):this.hls.trigger(P.ERROR,{type:B.KEY_SYSTEM_ERROR,details:f.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))},t.getKeySystemForKeyPromise=function(e){var t=this.getKeyIdString(e),a=this.keyIdToKeySessionPromise[t];if(!a){var i=oe(e.keyFormat),o=i?[i]:re(this.config);return this.attemptKeySystemAccess(o)}return a},t.getKeySystemSelectionPromise=function(e){if(e.length||(e=re(this.config)),0===e.length)throw new n_({type:B.KEY_SYSTEM_ERROR,details:f.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},"Missing key-system license configuration options "+JSON.stringify({drmSystems:this.config.drmSystems}));return this.attemptKeySystemAccess(e)},t._onMediaEncrypted=function(e){var t=this,a=e.initDataType,i=e.initData;if(this.debug('"'+e.type+'" event: init data type: "'+a+'"'),null!==i){var o,E;if("sinf"===a&&this.config.drmSystems[ae.FAIRPLAY]){var n=Ge(new Uint8Array(i));try{var _=$(JSON.parse(n).sinf),r=$e(new Uint8Array(_));if(!r)return;o=r.subarray(8,24),E=ae.FAIRPLAY}catch(e){return void this.warn('Failed to parse sinf "encrypted" event message initData')}}else{var T=st(i);if(null===T)return;0===T.version&&T.systemId===Ee.WIDEVINE&&T.data&&(o=T.data.subarray(8,24)),E=ne(T.systemId)}if(E&&o){for(var S,s=ve.hexDump(o),l=this.keyIdToKeySessionPromise,I=this.mediaKeySessions,A=l[s],O=function(){var e=I[u],E=e.decryptdata;if(E.pssh||!E.keyId)return 0;var n=ve.hexDump(E.keyId);return s===n||-1!==E.uri.replace(/-/g,"").indexOf(s)?(A=l[n],delete l[n],E.pssh=new Uint8Array(i),E.keyId=o,A=l[s]=A.then(function(){return t.generateRequestWithPreferredKeySession(e,a,i,"encrypted-event-key-match")}),1):void 0},u=0;u0)for(var E,n=0,_=o.length;n<_;n++){var r,T,S=null==(r=(E=o[n]).querySelector("name"))?void 0:r.textContent,s=null==(T=E.querySelector("value"))?void 0:T.textContent;S&&s&&e.setRequestHeader(S,s)}var l=i.querySelector("Challenge"),I=null==l?void 0:l.textContent;if(!I)throw new Error("Cannot find in key message");return ee(atob(I))},t.setupLicenseXHR=function(e,t,a,i){var o=this,E=this.config.licenseXhrSetup;return E?Promise.resolve().then(function(){if(!a.decryptdata)throw new Error("Key removed");return E.call(o.hls,e,t,a,i)}).catch(function(n){if(!a.decryptdata)throw n;return e.open("POST",t,!0),E.call(o.hls,e,t,a,i)}).then(function(a){return e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:a||i}}):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:i}))},t.requestLicense=function(e,t){var a=this,i=this.config.keyLoadPolicy.default;return new Promise(function(o,E){var n=a.getLicenseServerUrl(e.keySystem);a.log("Sending license request to URL: "+n);var _=new XMLHttpRequest;_.responseType="arraybuffer",_.onreadystatechange=function(){if(!a.hls||!e.mediaKeysSession)return E(new Error("invalid state"));if(4===_.readyState)if(200===_.status){a._requestLicenseFailureCount=0;var r=_.response;a.log("License received "+(r instanceof ArrayBuffer?r.byteLength:r));var T=a.config.licenseResponseCallback;if(T)try{r=T.call(a.hls,_,n,e)}catch(e){a.error(e)}o(r)}else{var S=i.errorRetry,s=S?S.maxNumRetry:0;if(a._requestLicenseFailureCount++,a._requestLicenseFailureCount>s||_.status>=400&&_.status<500)E(new n_({type:B.KEY_SYSTEM_ERROR,details:f.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:_,response:{url:n,data:void 0,code:_.status,text:_.statusText}},"License Request XHR failed ("+n+"). Status: "+_.status+" ("+_.statusText+")"));else{var l=s-a._requestLicenseFailureCount+1;a.warn("Retrying license request, "+l+" attempts left"),a.requestLicense(e,t).then(o,E)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=_,a.setupLicenseXHR(_,n,e,t).then(function(t){var i=t.xhr,o=t.licenseChallenge;e.keySystem==ae.PLAYREADY&&(o=a.unpackPlayReadyKeyMessage(i,o)),i.send(o)})})},t.onMediaAttached=function(e,t){if(this.config.emeEnabled){var a=t.media;this.media=a,a.addEventListener("encrypted",this.onMediaEncrypted),a.addEventListener("waitingforkey",this.onWaitingForKey)}},t.onMediaDetached=function(){var t=this,a=this.media,i=this.mediaKeySessions;a&&(a.removeEventListener("encrypted",this.onMediaEncrypted),a.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},It.clearKeyUriToKeyIdMap();var o=i.length;e.CDMCleanupPromise=Promise.all(i.map(function(e){return t.removeSession(e)}).concat(null==a?void 0:a.setMediaKeys(null).catch(function(e){t.log("Could not clear media keys: "+e)}))).then(function(){o&&(t.log("finished closing key sessions and clearing media keys"),i.length=0)}).catch(function(e){t.log("Could not close sessions and clear media keys: "+e)})},t.onManifestLoading=function(){this.keyFormatPromise=null},t.onManifestLoaded=function(e,t){var a=t.sessionKeys;if(a&&this.config.emeEnabled&&!this.keyFormatPromise){var i=a.reduce(function(e,t){return-1===e.indexOf(t.keyFormat)&&e.push(t.keyFormat),e},[]);this.log("Selecting key-system from session-keys "+i.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(i)}},t.removeSession=function(e){var t=this,a=e.mediaKeysSession,i=e.licenseXhr;if(a){this.log("Remove licenses and keys and close session "+a.sessionId),e._onmessage&&(a.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(a.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),i&&i.readyState!==XMLHttpRequest.DONE&&i.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;var o=this.mediaKeySessions.indexOf(e);return o>-1&&this.mediaKeySessions.splice(o,1),a.remove().catch(function(e){t.log("Could not remove session: "+e)}).then(function(){return a.close()}).catch(function(e){t.log("Could not close session: "+e)})}},e})();t_.CDMCleanupPromise=void 0;var a_,i_,o_,E_,n_=(function(e){function t(t,a){var i;return(i=e.call(this,a)||this).data=void 0,t.error||(t.error=new Error(a)),i.data=t,t.err=t.error,i}return S(t,e),t})(u(Error));(function(e){e.MANIFEST="m",e.AUDIO="a",e.VIDEO="v",e.MUXED="av",e.INIT="i",e.CAPTION="c",e.TIMED_TEXT="tt",e.KEY="k",e.OTHER="o"})(a_||(a_={})),(function(e){e.DASH="d",e.HLS="h",e.SMOOTH="s",e.OTHER="o"})(i_||(i_={})),(function(e){e.OBJECT="CMCD-Object",e.REQUEST="CMCD-Request",e.SESSION="CMCD-Session",e.STATUS="CMCD-Status"})(o_||(o_={}));var __=((E_={})[o_.OBJECT]=["br","d","ot","tb"],E_[o_.REQUEST]=["bl","dl","mtp","nor","nrr","su"],E_[o_.SESSION]=["cid","pr","sf","sid","st","v"],E_[o_.STATUS]=["bs","rtp"],E_),r_=function e(t,a){this.value=void 0,this.params=void 0,Array.isArray(t)&&(t=t.map(function(t){return t instanceof e?t:new e(t)})),this.value=t,this.params=a},T_=function(e){this.description=void 0,this.description=e},S_="Dict";function s_(e){return Array.isArray(e)?JSON.stringify(e):e instanceof Map?"Map{}":e instanceof Set?"Set{}":"object"==typeof e?JSON.stringify(e):String(e)}function l_(e,t,a,i){return new Error("failed to "+e+' "'+s_(t)+'" as '+a,{cause:i})}var I_="Bare Item",A_="Boolean",O_="Byte Sequence",u_="Decimal",d_="Integer";function N_(e){return e<-999999999999999||99999999999999912)throw L_(e,u_);var a=t.toString();return a.includes(".")?a:a+".0"}var g_="String";function v_(e){if(R_.test(e))throw L_(e,g_);return'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'}function M_(e){return e.description||e.toString().slice(7,-1)}function W_(e){var t=M_(e);if(!1===/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(t))throw L_(t,c_);return t}function U_(e){switch(typeof e){case"number":if(!C(e))throw L_(e,I_);return Number.isInteger(e)?h_(e):f_(e);case"string":return v_(e);case"symbol":return W_(e);case"boolean":return D_(e);case"object":if(e instanceof Date)return P_(e);if(e instanceof Uint8Array)return p_(e);if(e instanceof T_)return W_(e);default:throw L_(e,I_)}}function G_(e){if(!1===/^[a-z*][a-z0-9\-_.*]*$/.test(e))throw L_(e,m_);return e}function y_(e){return null==e?"":Object.entries(e).map(function(e){var t=e[0],a=e[1];return!0===a?";"+G_(t):";"+G_(t)+"="+U_(a)}).join("")}function b_(e){return e instanceof r_?""+U_(e.value)+y_(e.params):U_(e)}function k_(e){return"("+e.value.map(b_).join(" ")+")"+y_(e.params)}function F_(e,t){var a;if(void 0===t&&(t={whitespace:!0}),"object"!=typeof e)throw L_(e,S_);var i=e instanceof Map?e.entries():Object.entries(e),o=null!=(a=t)&&a.whitespace?" ":"";return Array.from(i).map(function(e){var t=e[0],a=e[1];a instanceof r_==0&&(a=new r_(a));var i=G_(t);return!0===a.value?i+=y_(a.params):(i+="=",Array.isArray(a.value)?i+=k_(a):i+=b_(a)),i}).join(","+o)}function V_(e,t){return F_(e,t)}var H_=function(e){return"ot"===e||"sf"===e||"st"===e},Y_=function(e){return"number"==typeof e?C(e):null!=e&&""!==e&&!1!==e};function w_(e,t){var a=new URL(e),i=new URL(t);if(a.origin!==i.origin)return e;for(var o=a.pathname.split("/").slice(1),E=i.pathname.split("/").slice(1,-1);o[0]===E[0];)o.shift(),E.shift();for(;E.length;)E.shift(),o.unshift("..");return o.join("/")}function z_(){try{return crypto.randomUUID()}catch(i){try{var e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch(e){var a=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=(a+16*Math.random())%16|0;return a=Math.floor(a/16),("x"==e?t:3&t|8).toString(16)})}}}var K_=function(e){return Math.round(e)},j_=function(e){return 100*K_(e/100)},x_={br:K_,d:K_,bl:j_,dl:j_,mtp:j_,nor:function(e,t){return null!=t&&t.baseUrl&&(e=w_(e,t.baseUrl)),encodeURIComponent(e)},rtp:j_,tb:K_};function Q_(e,t){var a={};if(null==e||"object"!=typeof e)return a;var i=Object.keys(e).sort(),o=T({},x_,null==t?void 0:t.formatters),E=null==t?void 0:t.filter;return i.forEach(function(i){if(null==E||!E(i)){var n=e[i],_=o[i];_&&(n=_(n,t)),"v"===i&&1===n||"pr"==i&&1===n||Y_(n)&&(H_(i)&&"string"==typeof n&&(n=new T_(n)),a[i]=n)}}),a}function X_(e,t){return void 0===t&&(t={}),e?V_(Q_(e,t),T({whitespace:!1},t)):""}function $_(e,t){var a;if(void 0===t&&(t={}),!e)return{};var i=Object.entries(e),o=Object.entries(__).concat(Object.entries((null==(a=t)?void 0:a.customHeaderMap)||{})),E=i.reduce(function(e,t){var a,i=t[0],E=t[1],n=(null==(a=o.find(function(e){return e[1].includes(i)}))?void 0:a[0])||o_.REQUEST;return null!=e[n]||(e[n]={}),e[n][i]=E,e},{});return Object.entries(E).reduce(function(e,a){var i=a[0],o=a[1];return e[i]=X_(o,t),e},{})}function q_(e,t,a){return T(e,$_(t,a))}var J_="CMCD";function Z_(e,t){if(void 0===t&&(t={}),!e)return"";var a=X_(e,t);return J_+"="+encodeURIComponent(a)}var er=/CMCD=[^&#]+/;function tr(e,t,a){var i=Z_(t,a);if(!i)return e;if(er.test(e))return e.replace(er,i);var o=e.includes("?")?"&":"?";return""+e+o+i}var ar=(function(){function e(e){var t=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){t.initialized&&(t.starved=!0),t.buffering=!0},this.onPlaying=function(){t.initialized||(t.initialized=!0),t.buffering=!1},this.applyPlaylistData=function(e){try{t.apply(e,{ot:a_.MANIFEST,su:!t.initialized})}catch(e){y.warn("Could not generate manifest CMCD data.",e)}},this.applyFragmentData=function(e){try{var a=e.frag,i=t.hls.levels[a.level],o=t.getObjectType(a),E={d:1e3*a.duration,ot:o};o!==a_.VIDEO&&o!==a_.AUDIO&&o!=a_.MUXED||(E.br=i.bitrate/1e3,E.tb=t.getTopBandwidth(o)/1e3,E.bl=t.getBufferLength(o)),t.apply(e,E)}catch(e){y.warn("Could not generate segment CMCD data.",e)}},this.hls=e;var a=this.config=e.config,i=a.cmcd;null!=i&&(a.pLoader=this.createPlaylistLoader(),a.fLoader=this.createFragmentLoader(),this.sid=i.sessionId||z_(),this.cid=i.contentId,this.useHeaders=!0===i.useHeaders,this.includeKeys=i.includeKeys,this.registerListeners())}var t=e.prototype;return t.registerListeners=function(){var e=this.hls;e.on(P.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(P.MEDIA_DETACHED,this.onMediaDetached,this),e.on(P.BUFFER_CREATED,this.onBufferCreated,this)},t.unregisterListeners=function(){var e=this.hls;e.off(P.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(P.MEDIA_DETACHED,this.onMediaDetached,this),e.off(P.BUFFER_CREATED,this.onBufferCreated,this)},t.destroy=function(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=null},t.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},t.onMediaDetached=function(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)},t.onBufferCreated=function(e,t){var a,i;this.audioBuffer=null==(a=t.tracks.audio)?void 0:a.buffer,this.videoBuffer=null==(i=t.tracks.video)?void 0:i.buffer},t.createData=function(){var e;return{v:1,sf:i_.HLS,sid:this.sid,cid:this.cid,pr:null==(e=this.media)?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},t.apply=function(e,t){void 0===t&&(t={}),T(t,this.createData());var a=t.ot===a_.INIT||t.ot===a_.VIDEO||t.ot===a_.MUXED;this.starved&&a&&(t.bs=!0,t.su=!0,this.starved=!1),null==t.su&&(t.su=this.buffering);var i=this.includeKeys;i&&(t=Object.keys(t).reduce(function(e,a){return i.includes(a)&&(e[a]=t[a]),e},{})),this.useHeaders?(e.headers||(e.headers={}),q_(e.headers,t)):e.url=tr(e.url,t)},t.getObjectType=function(e){var t=e.type;return"subtitle"===t?a_.TIMED_TEXT:"initSegment"===e.sn?a_.INIT:"audio"===t?a_.AUDIO:"main"===t?this.hls.audioTracks.length?a_.VIDEO:a_.MUXED:void 0},t.getTopBandwidth=function(e){var t,a=0,i=this.hls;if(e===a_.AUDIO)t=i.audioTracks;else{var o=i.maxAutoLevel,E=o>-1?o+1:i.levels.length;t=i.levels.slice(0,E)}for(var n,_=c(t);!(n=_()).done;){var r=n.value;r.bitrate>a&&(a=r.bitrate)}return a>0?a:NaN},t.getBufferLength=function(e){var t=this.hls.media,a=e===a_.AUDIO?this.audioBuffer:this.videoBuffer;return a&&t?1e3*hi.bufferInfo(a,t.currentTime,this.config.maxBufferHole).len:NaN},t.createPlaylistLoader=function(){var e=this.config.pLoader,t=this.applyPlaylistData,a=e||this.config.loader;return(function(){function e(e){this.loader=void 0,this.loader=new a(e)}var i=e.prototype;return i.destroy=function(){this.loader.destroy()},i.abort=function(){this.loader.abort()},i.load=function(e,a,i){t(e),this.loader.load(e,a,i)},_(e,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),e})()},t.createFragmentLoader=function(){var e=this.config.fLoader,t=this.applyFragmentData,a=e||this.config.loader;return(function(){function e(e){this.loader=void 0,this.loader=new a(e)}var i=e.prototype;return i.destroy=function(){this.loader.destroy()},i.abort=function(){this.loader.abort()},i.load=function(e,a,i){t(e),this.loader.load(e,a,i)},_(e,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),e})()},e})(),ir=3e5,or=(function(){function e(e){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.log=y.log.bind(y,"[content-steering]:"),this.registerListeners()}var t=e.prototype;return t.registerListeners=function(){var e=this.hls;e.on(P.MANIFEST_LOADING,this.onManifestLoading,this),e.on(P.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(P.MANIFEST_PARSED,this.onManifestParsed,this),e.on(P.ERROR,this.onError,this)},t.unregisterListeners=function(){var e=this.hls;e&&(e.off(P.MANIFEST_LOADING,this.onManifestLoading,this),e.off(P.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(P.MANIFEST_PARSED,this.onManifestParsed,this),e.off(P.ERROR,this.onError,this))},t.startLoad=function(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){var e=1e3*this.timeToLoad-(performance.now()-this.updated);if(e>0)return void this.scheduleRefresh(this.uri,e)}this.loadSteeringManifest(this.uri)}},t.stopLoad=function(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()},t.clearTimeout=function(){-1!==this.reloadTimer&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)},t.destroy=function(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null},t.removeLevel=function(e){var t=this.levels;t&&(this.levels=t.filter(function(t){return t!==e}))},t.onManifestLoading=function(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null},t.onManifestLoaded=function(e,t){var a=t.contentSteering;null!==a&&(this.pathwayId=a.pathwayId,this.uri=a.uri,this.started&&this.startLoad())},t.onManifestParsed=function(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks},t.onError=function(e,t){var a=t.errorAction;if((null==a?void 0:a.action)===$a.SendAlternateToPenaltyBox&&a.flags===qa.MoveAllAlternatesMatchingHost){var i=this.levels,o=this.pathwayPriority,E=this.pathwayId;if(t.context){var n=t.context,_=n.groupId,r=n.pathwayId,T=n.type;_&&i?E=this.getPathwayForGroupId(_,T,E):r&&(E=r)}E in this.penalizedPathways||(this.penalizedPathways[E]=performance.now()),!o&&i&&(o=i.reduce(function(e,t){return-1===e.indexOf(t.pathwayId)&&e.push(t.pathwayId),e},[])),o&&o.length>1&&(this.updatePathwayPriority(o),a.resolved=this.pathwayId!==E),a.resolved||y.warn("Could not resolve "+t.details+' ("'+t.error.message+'") with content-steering for Pathway: '+E+" levels: "+(i?i.length:i)+" priorities: "+JSON.stringify(o)+" penalized: "+JSON.stringify(this.penalizedPathways))}},t.filterParsedLevels=function(e){this.levels=e;var t=this.getLevelsForPathway(this.pathwayId);if(0===t.length){var a=e[0].pathwayId;this.log("No levels found in Pathway "+this.pathwayId+'. Setting initial Pathway to "'+a+'"'),t=this.getLevelsForPathway(a),this.pathwayId=a}return t.length!==e.length?(this.log("Found "+t.length+"/"+e.length+' levels in Pathway "'+this.pathwayId+'"'),t):e},t.getLevelsForPathway=function(e){return null===this.levels?[]:this.levels.filter(function(t){return e===t.pathwayId})},t.updatePathwayPriority=function(e){var t;this.pathwayPriority=e;var a=this.penalizedPathways,i=performance.now();Object.keys(a).forEach(function(e){i-a[e]>ir&&delete a[e]});for(var o=0;o0){this.log('Setting Pathway to "'+E+'"'),this.pathwayId=E,ba(t),this.hls.trigger(P.LEVELS_UPDATED,{levels:t});var r=this.hls.levels[n];_&&r&&this.levels&&(r.attrs["STABLE-VARIANT-ID"]!==_.attrs["STABLE-VARIANT-ID"]&&r.bitrate!==_.bitrate&&this.log("Unstable Pathways change from bitrate "+_.bitrate+" to "+r.bitrate),this.hls.nextLoadLevel=n);break}}}},t.getPathwayForGroupId=function(e,t,a){for(var i=this.getLevelsForPathway(a).concat(this.levels||[]),o=0;o=2&&(0===a.loading.first&&(a.loading.first=Math.max(self.performance.now(),a.loading.start),o.timeout!==o.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),o.timeout=o.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),o.loadPolicy.maxLoadTimeMs-(a.loading.first-a.loading.start)))),4===i)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;var E=t.status,n="text"!==t.responseType;if(E>=200&&E<300&&(n&&t.response||null!==t.responseText)){a.loading.end=Math.max(self.performance.now(),a.loading.first);var _=n?t.response:t.responseText,r="arraybuffer"===t.responseType?_.byteLength:_.length;if(a.loaded=a.total=r,a.bwEstimate=8e3*a.total/(a.loading.end-a.loading.first),!this.callbacks)return;var T=this.callbacks.onProgress;if(T&&T(a,e,_,t),!this.callbacks)return;var S={url:t.responseURL,data:_,code:E};this.callbacks.onSuccess(S,a,e,t)}else{var s=o.loadPolicy.errorRetry;Ya(s,a.retry,!1,{url:e.url,data:void 0,code:E})?this.retry(s):(y.error(E+" while loading "+e.url),this.callbacks.onError({code:E,text:t.statusText},e,t,a))}}}},t.loadtimeout=function(){var e,t=null==(e=this.config)?void 0:e.loadPolicy.timeoutRetry;if(Ya(t,this.stats.retry,!0))this.retry(t);else{var a;y.warn("timeout while loading "+(null==(a=this.context)?void 0:a.url));var i=this.callbacks;i&&(this.abortInternal(),i.onTimeout(this.stats,this.context,this.loader))}},t.retry=function(e){var t=this.context,a=this.stats;this.retryDelay=Va(e,a.retry),a.retry++,y.warn((status?"HTTP Status "+status:"Timeout")+" while loading "+(null==t?void 0:t.url)+", retrying "+a.retry+"/"+e.maxNumRetry+" in "+this.retryDelay+"ms"),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)},t.loadprogress=function(e){var t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)},t.getCacheAge=function(){var e=null;if(this.loader&&_r.test(this.loader.getAllResponseHeaders())){var t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e},t.getResponseHeader=function(e){return this.loader&&new RegExp("^"+e+":\\s*[\\d.]+\\s*$","im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null},e})();function Tr(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(e){}return!1}var Sr=/(\d+)-(\d+)\/(\d+)/,sr=(function(){function e(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||Or,this.controller=new self.AbortController,this.stats=new w}var t=e.prototype;return t.destroy=function(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null},t.abortInternal=function(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())},t.abort=function(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},t.load=function(e,t,a){var i=this,o=this.stats;if(o.loading.start)throw new Error("Loader can only be used once.");o.loading.start=self.performance.now();var E=lr(e,this.controller.signal),n=a.onProgress,_="arraybuffer"===e.responseType,r=_?"byteLength":"length",T=t.loadPolicy,S=T.maxTimeToFirstByteMs,s=T.maxLoadTimeMs;this.context=e,this.config=t,this.callbacks=a,this.request=this.fetchSetup(e,E),self.clearTimeout(this.requestTimeout),t.timeout=S&&C(S)?S:s,this.requestTimeout=self.setTimeout(function(){i.abortInternal(),a.onTimeout(o,e,i.response)},t.timeout),self.fetch(this.request).then(function(E){i.response=i.loader=E;var r=Math.max(self.performance.now(),o.loading.start);if(self.clearTimeout(i.requestTimeout),t.timeout=s,i.requestTimeout=self.setTimeout(function(){i.abortInternal(),a.onTimeout(o,e,i.response)},s-(r-o.loading.start)),!E.ok){var T=E.status,S=E.statusText;throw new dr(S||"fetch, bad network response",T,E)}return o.loading.first=r,o.total=Ar(E.headers)||o.total,n&&C(t.highWaterMark)?i.loadProgressively(E,o,e,t.highWaterMark,n):_?E.arrayBuffer():"json"===e.responseType?E.json():E.text()}).then(function(E){var _=i.response;if(!_)throw new Error("loader destroyed");self.clearTimeout(i.requestTimeout),o.loading.end=Math.max(self.performance.now(),o.loading.first);var T=E[r];T&&(o.loaded=o.total=T);var S={url:_.url,data:E,code:_.status};n&&!C(t.highWaterMark)&&n(o,e,E,_),a.onSuccess(S,o,e,_)}).catch(function(t){if(self.clearTimeout(i.requestTimeout),!o.aborted){var E=t&&t.code||0,n=t?t.message:null;a.onError({code:E,text:n},e,t?t.details:null,o)}})},t.getCacheAge=function(){var e=null;if(this.response){var t=this.response.headers.get("age");e=t?parseFloat(t):null}return e},t.getResponseHeader=function(e){return this.response?this.response.headers.get(e):null},t.loadProgressively=function(e,t,a,i,o){void 0===i&&(i=0);var E=new qi,n=e.body.getReader();return(function _(){return n.read().then(function(n){if(n.done)return E.dataLength&&o(t,a,E.flush(),e),Promise.resolve(new ArrayBuffer(0));var r=n.value,T=r.length;return t.loaded+=T,T=i&&o(t,a,E.flush(),e)):o(t,a,r,e),_()}).catch(function(){return Promise.reject()})})()},e})();function lr(e,t){var a={method:"GET",mode:"cors",credentials:"same-origin",signal:t,headers:new self.Headers(T({},e.headers))};return e.rangeEnd&&a.headers.set("Range","bytes="+e.rangeStart+"-"+String(e.rangeEnd-1)),a}function Ir(e){var t=Sr.exec(e);if(t)return parseInt(t[2])-parseInt(t[1])+1}function Ar(e){var t=e.get("Content-Range");if(t){var a=Ir(t);if(C(a))return a}var i=e.get("Content-Length");if(i)return parseInt(i)}function Or(e,t){return new self.Request(e.url,t)}var ur,dr=(function(e){function t(t,a,i){var o;return(o=e.call(this,t)||this).code=void 0,o.details=void 0,o.code=a,o.details=i,o}return S(t,e),t})(u(Error)),Nr=/\s/,Rr={newCue:function(e,t,a,i){for(var o,E,n,_,r,T=[],S=self.VTTCue||self.TextTrackCue,s=0;s=16?_--:_++;var A=Dn(r.trim()),O=fn(t,a,A);null!=e&&null!=(l=e.cues)&&l.getCueById(O)||((E=new S(t,a,A)).id=O,E.line=s+1,E.align="left",E.position=10+Math.min(80,10*Math.floor(8*_/32)),T.push(E))}return e&&T.length&&(T.sort(function(e,t){return"auto"===e.line||"auto"===t.line?0:e.line>8&&t.line>8?t.line-e.line:e.line-t.line}),T.forEach(function(t){return ta(e,t)})),T}},cr=i(i({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:rr,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Ri,bufferController:zE,capLevelController:Jn,errorController:Ja,fpsController:Zn,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:Se,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},mr()),{},{subtitleStreamController:FE,subtitleTrackController:HE,timelineController:xn,audioStreamController:yE,audioTrackController:bE,emeController:t_,cmcdController:ar,contentSteeringController:or});function mr(){return{cueHandler:Rr,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function Lr(e,t){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==t.liveMaxLatencyDurationCount&&(void 0===t.liveSyncDurationCount||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(void 0===t.liveSyncDuration||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');var a=Dr(e),o=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach(function(e){var i=("level"===e?"playlist":e)+"LoadPolicy",E=void 0===t[i],n=[];o.forEach(function(o){var _=e+"Loading"+o,r=t[_];if(void 0!==r&&E){n.push(_);var T=a[i].default;switch(t[i]={default:T},o){case"TimeOut":T.maxLoadTimeMs=r,T.maxTimeToFirstByteMs=r;break;case"MaxRetry":T.errorRetry.maxNumRetry=r,T.timeoutRetry.maxNumRetry=r;break;case"RetryDelay":T.errorRetry.retryDelayMs=r,T.timeoutRetry.retryDelayMs=r;break;case"MaxRetryTimeout":T.errorRetry.maxRetryDelayMs=r,T.timeoutRetry.maxRetryDelayMs=r}}}),n.length&&y.warn('hls.js config: "'+n.join('", "')+'" setting(s) are deprecated, use "'+i+'": '+JSON.stringify(t[i]))}),i(i({},a),t)}function Dr(e){return e&&"object"==typeof e?Array.isArray(e)?e.map(Dr):Object.keys(e).reduce(function(t,a){return t[a]=Dr(e[a]),t},{}):e}function Cr(e){var t=e.loader;t!==sr&&t!==rr?(y.log("[config]: Custom loader detected, cannot enable progressive streaming"),e.progressive=!1):Tr()&&(e.loader=sr,e.progressive=!0,e.enableSoftwareAES=!0,y.log("[config]: Progressive streaming enabled, using FetchLoader"))}var pr=(function(e){function t(t,a){var i;return(i=e.call(this,t,"[level-controller]")||this)._levels=[],i._firstLevel=-1,i._maxAutoLevel=-1,i._startLevel=void 0,i.currentLevel=null,i.currentLevelIndex=-1,i.manualLevelIndex=-1,i.steering=void 0,i.onParsedComplete=void 0,i.steering=a,i._registerListeners(),i}S(t,e);var a=t.prototype;return a._registerListeners=function(){var e=this.hls;e.on(P.MANIFEST_LOADING,this.onManifestLoading,this),e.on(P.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(P.LEVEL_LOADED,this.onLevelLoaded,this),e.on(P.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(P.FRAG_BUFFERED,this.onFragBuffered,this),e.on(P.ERROR,this.onError,this)},a._unregisterListeners=function(){var e=this.hls;e.off(P.MANIFEST_LOADING,this.onManifestLoading,this),e.off(P.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(P.LEVEL_LOADED,this.onLevelLoaded,this),e.off(P.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(P.FRAG_BUFFERED,this.onFragBuffered,this),e.off(P.ERROR,this.onError,this)},a.destroy=function(){this._unregisterListeners(),this.steering=null,this.resetLevels(),e.prototype.destroy.call(this)},a.stopLoad=function(){this._levels.forEach(function(e){e.loadError=0,e.fragmentError=0}),e.prototype.stopLoad.call(this)},a.resetLevels=function(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1},a.onManifestLoading=function(e,t){this.resetLevels()},a.onManifestLoaded=function(e,t){var a=this.hls.config.preferManagedMediaSource,i=[],o={},E={},n=!1,_=!1,r=!1;t.levels.forEach(function(e){var t,T,S=e.attrs,s=e.audioCodec,l=e.videoCodec;-1!==(null==(t=s)?void 0:t.indexOf("mp4a.40.34"))&&(ur||(ur=/chrome|firefox/i.test(navigator.userAgent)),ur&&(e.audioCodec=s=void 0)),s&&(e.audioCodec=s=Mt(s,a)),0===(null==(T=l)?void 0:T.indexOf("avc1"))&&(l=e.videoCodec=Ut(l));var I=e.width,A=e.height,O=e.unknownCodecs;if(n||(n=!(!I||!A)),_||(_=!!l),r||(r=!!s),!(null!=O&&O.length||s&&!Ct(s,"audio",a)||l&&!Ct(l,"video",a))){var u=S.CODECS,d=S["FRAME-RATE"],N=S["HDCP-LEVEL"],R=S["PATHWAY-ID"],c=S.RESOLUTION,m=S["VIDEO-RANGE"],L=(R||".")+"-"+e.bitrate+"-"+c+"-"+d+"-"+u+"-"+m+"-"+N;if(o[L])if(o[L].uri===e.url||e.attrs["PATHWAY-ID"])o[L].addGroupId("audio",S.AUDIO),o[L].addGroupId("text",S.SUBTITLES);else{var D=E[L]+=1;e.attrs["PATHWAY-ID"]=new Array(D+1).join(".");var C=new Da(e);o[L]=C,i.push(C)}else{var p=new Da(e);o[L]=p,E[L]=1,i.push(p)}}}),this.filterAndSortMediaOptions(i,t,n,_,r)},a.filterAndSortMediaOptions=function(e,t,a,i,o){var E=this,n=[],_=[],r=e;if((a||i)&&o&&(r=r.filter(function(e){var t=e.videoCodec,a=e.videoRange,i=e.width,o=e.height;return(!!t||!(!i||!o))&&Ra(a)})),0!==r.length){if(t.audioTracks){var T=this.hls.config.preferManagedMediaSource;hr(n=t.audioTracks.filter(function(e){return!e.audioCodec||Ct(e.audioCodec,"audio",T)}))}t.subtitles&&hr(_=t.subtitles);var S=r.slice(0);r.sort(function(e,t){if(e.attrs["HDCP-LEVEL"]!==t.attrs["HDCP-LEVEL"])return(e.attrs["HDCP-LEVEL"]||"")>(t.attrs["HDCP-LEVEL"]||"")?1:-1;if(a&&e.height!==t.height)return e.height-t.height;if(e.frameRate!==t.frameRate)return e.frameRate-t.frameRate;if(e.videoRange!==t.videoRange)return Na.indexOf(e.videoRange)-Na.indexOf(t.videoRange);if(e.videoCodec!==t.videoCodec){var i=Pt(e.videoCodec),o=Pt(t.videoCodec);if(i!==o)return o-i}if(e.uri===t.uri&&e.codecSet!==t.codecSet){var E=Bt(e.codecSet),n=Bt(t.codecSet);if(E!==n)return n-E}return e.averageBitrate!==t.averageBitrate?e.averageBitrate-t.averageBitrate:0});var s=S[0];if(this.steering&&(r=this.steering.filterParsedLevels(r)).length!==S.length)for(var l=0;lu&&u===cr.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=d)}break}var N=o&&!i,R={levels:r,audioTracks:n,subtitleTracks:_,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:o,video:i,altAudio:!N&&n.some(function(e){return!!e.url})};this.hls.trigger(P.MANIFEST_PARSED,R),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else Promise.resolve().then(function(){if(E.hls){t.levels.length&&E.warn("One or more CODECS in variant not supported: "+JSON.stringify(t.levels[0].attrs));var e=new Error("no level with compatible codecs found in manifest");E.hls.trigger(P.ERROR,{type:B.MEDIA_ERROR,details:f.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:e,reason:e.message})}})},a.onError=function(e,t){!t.fatal&&t.context&&t.context.type===Xt.LEVEL&&t.context.level===this.level&&this.checkRetry(t)},a.onFragBuffered=function(e,t){var a=t.frag;if(void 0!==a&&a.type===$t.MAIN){var i=a.elementaryStreams;if(!Object.keys(i).some(function(e){return!!i[e]}))return;var o=this._levels[a.level];null!=o&&o.loadError&&(this.log("Resetting level error count of "+o.loadError+" on frag buffered"),o.loadError=0)}},a.onLevelLoaded=function(e,t){var a,i,o=t.level,E=t.details,n=this._levels[o];if(!n)return this.warn("Invalid level index "+o),void(null!=(i=t.deliveryDirectives)&&i.skip&&(E.deltaUpdateFailed=!0));o===this.currentLevelIndex?(0===n.fragmentError&&(n.loadError=0),this.playlistLoaded(o,t,n.details)):null!=(a=t.deliveryDirectives)&&a.skip&&(E.deltaUpdateFailed=!0)},a.loadPlaylist=function(t){e.prototype.loadPlaylist.call(this);var a=this.currentLevelIndex,i=this.currentLevel;if(i&&this.shouldLoadPlaylist(i)){var o=i.uri;if(t)try{o=t.addDirectives(o)}catch(e){this.warn("Could not construct new URL with HLS Delivery Directives: "+e)}var E=i.attrs["PATHWAY-ID"];this.log("Loading level index "+a+(void 0!==(null==t?void 0:t.msn)?" at sn "+t.msn+" part "+t.part:"")+" with"+(E?" Pathway "+E:"")+" "+o),this.clearTimer(),this.hls.trigger(P.LEVEL_LOADING,{url:o,level:a,pathwayId:i.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}},a.removeLevel=function(e){var t,a=this,i=this._levels.filter(function(t,i){return i!==e||(a.steering&&a.steering.removeLevel(t),t===a.currentLevel&&(a.currentLevel=null,a.currentLevelIndex=-1,t.details&&t.details.fragments.forEach(function(e){return e.level=-1})),!1)});ba(i),this._levels=i,this.currentLevelIndex>-1&&null!=(t=this.currentLevel)&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(P.LEVELS_UPDATED,{levels:i})},a.onLevelsUpdated=function(e,t){var a=t.levels;this._levels=a},a.checkMaxAutoUpdated=function(){var e=this.hls,t=e.autoLevelCapping,a=e.maxAutoLevel,i=e.maxHdcpLevel;this._maxAutoLevel!==a&&(this._maxAutoLevel=a,this.hls.trigger(P.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:t,levels:this.levels,maxAutoLevel:a,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))},_(t,[{key:"levels",get:function(){return 0===this._levels.length?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(e){var t=this._levels;if(0!==t.length){if(e<0||e>=t.length){var a=new Error("invalid level idx"),i=e<0;if(this.hls.trigger(P.ERROR,{type:B.OTHER_ERROR,details:f.LEVEL_SWITCH_ERROR,level:e,fatal:i,error:a,reason:a.message}),i)return;e=Math.min(e,t.length-1)}var o=this.currentLevelIndex,E=this.currentLevel,n=E?E.attrs["PATHWAY-ID"]:void 0,_=t[e],r=_.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=_,o!==e||!_.details||!E||n!==r){this.log("Switching to level "+e+" ("+(_.height?_.height+"p ":"")+(_.videoRange?_.videoRange+" ":"")+(_.codecSet?_.codecSet+" ":"")+"@"+_.bitrate+")"+(r?" with Pathway "+r:"")+" from level "+o+(n?" with Pathway "+n:""));var T={level:e,attrs:_.attrs,details:_.details,bitrate:_.bitrate,averageBitrate:_.averageBitrate,maxBitrate:_.maxBitrate,realBitrate:_.realBitrate,width:_.width,height:_.height,codecSet:_.codecSet,audioCodec:_.audioCodec,videoCodec:_.videoCodec,audioGroups:_.audioGroups,subtitleGroups:_.subtitleGroups,loaded:_.loaded,loadError:_.loadError,fragmentError:_.fragmentError,name:_.name,id:_.id,uri:_.uri,url:_.url,urlId:0,audioGroupIds:_.audioGroupIds,textGroupIds:_.textGroupIds};this.hls.trigger(P.LEVEL_SWITCHING,T);var S=_.details;if(!S||S.live){var s=this.switchParams(_.uri,null==E?void 0:E.details);this.loadPlaylist(s)}}}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(e){this._firstLevel=e}},{key:"startLevel",get:function(){if(void 0===this._startLevel){var e=this.hls.config.startLevel;return void 0!==e?e:this.hls.firstAutoLevel}return this._startLevel},set:function(e){this._startLevel=e}},{key:"nextLoadLevel",get:function(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}}]),t})(Za);function hr(e){var t={};e.forEach(function(e){var a=e.groupId||"";e.id=t[a]=t[a]||0,t[a]++})}var Pr=(function(){function e(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}var t=e.prototype;return t.abort=function(e){for(var t in this.keyUriToKeyInfo){var a=this.keyUriToKeyInfo[t].loader;if(a){var i;if(e&&e!==(null==(i=a.context)?void 0:i.frag.type))return;a.abort()}}},t.detach=function(){for(var e in this.keyUriToKeyInfo){var t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}},t.destroy=function(){for(var e in this.detach(),this.keyUriToKeyInfo){var t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}},t.createKeyLoadError=function(e,t,a,i,o){return void 0===t&&(t=f.KEY_LOAD_ERROR),new Hi({type:B.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:o,error:a,networkDetails:i})},t.loadClear=function(e,t){var a=this;if(this.emeController&&this.config.emeEnabled)for(var i=e.sn,o=e.cc,E=function(){var e=t[n];if(o<=e.cc&&("initSegment"===i||"initSegment"===e.sn||iWr,l=!S||t&&t.start<=E||S-E>Wr&&!this.fragmentTracker.getPartialFragment(E);if(s||l)return;this.moved=!1}if(!this.moved&&null!==this.stalled){var I;if(!(T.len>0||S))return;var A=Math.max(S,T.start||0)-E,O=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,u=(null==O||null==(I=O.details)?void 0:I.live)?2*O.details.targetduration:Wr,d=this.fragmentTracker.getPartialFragment(E);if(A>0&&(A<=u||d))return void(i.paused||this._trySkipBufferHole(d))}var N=self.performance.now();if(null!==o){var R=N-o;if(n||!(R>=Mr)||(this._reportStall(T),this.media)){var c=hi.bufferInfo(i,E,a.maxBufferHole);this._tryFixBufferStall(c,R)}}else this.stalled=N}else if(this.moved=!0,n||(this.nudgeRetry=0),null!==o){if(this.stallReported){var m=self.performance.now()-o;y.warn("playback not stuck anymore @"+E+", after "+Math.round(m)+"ms"),this.stallReported=!1}this.stalled=null}}},t._tryFixBufferStall=function(e,t){var a=this.config,i=this.fragmentTracker,o=this.media;if(null!==o){var E=o.currentTime,n=i.getPartialFragment(E);if(n&&(this._trySkipBufferHole(n)||!this.media))return;(e.len>a.maxBufferHole||e.nextStart&&e.nextStart-E1e3*a.highBufferWatchdogPeriod&&(y.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}},t._reportStall=function(e){var t=this.hls,a=this.media;if(!this.stallReported&&a){this.stallReported=!0;var i=new Error("Playback stalling at @"+a.currentTime+" due to low buffer ("+JSON.stringify(e)+")");y.warn(i.message),t.trigger(P.ERROR,{type:B.MEDIA_ERROR,details:f.BUFFER_STALLED_ERROR,fatal:!1,error:i,buffer:e.len})}},t._trySkipBufferHole=function(e){var t=this.config,a=this.hls,i=this.media;if(null===i)return 0;var o=i.currentTime,E=hi.bufferInfo(i,o,0),n=o0&&E.len<1&&i.readyState<3,T=n-o;if(T>0&&(_||r)){if(T>t.maxBufferHole){var S=this.fragmentTracker,s=!1;if(0===o){var l=S.getAppendedFrag(0,$t.MAIN);l&&n1?(i=0,this.bitrateTest=!0):i=a.firstAutoLevel),a.nextLoadLevel=i,this.level=a.loadLevel,this.loadedmetadata=!1}t>0&&-1===e&&(this.log("Override startPosition with lastCurrentTime @"+t.toFixed(3)),e=t),this.state=Xi.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=Xi.STOPPED},a.stopLoad=function(){this._forceStartLoad=!1,e.prototype.stopLoad.call(this)},a.doTick=function(){switch(this.state){case Xi.WAITING_LEVEL:var e=this.levels,t=this.level,a=null==e?void 0:e[t],i=null==a?void 0:a.details;if(i&&(!i.live||this.levelLastLoaded===a)){if(this.waitForCdnTuneIn(i))break;this.state=Xi.IDLE;break}if(this.hls.nextLoadLevel!==this.level){this.state=Xi.IDLE;break}break;case Xi.FRAG_LOADING_WAITING_RETRY:var o,E=self.performance.now(),n=this.retryDate;if(!n||E>=n||null!=(o=this.media)&&o.seeking){var _=this.levels,r=this.level,T=null==_?void 0:_[r];this.resetStartWhenNotLoaded(T||null),this.state=Xi.IDLE}}this.state===Xi.IDLE&&this.doTickIdle(),this.onTickEnd()},a.onTickEnd=function(){e.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},a.doTickIdle=function(){var e=this.hls,t=this.levelLastLoaded,a=this.levels,i=this.media,o=e.config,E=e.nextLoadLevel;if(null!==t&&(i||!this.startFragRequested&&o.startFragPrefetch)&&(!this.altAudio||!this.audioOnly)&&null!=a&&a[E]){var n=a[E],_=this.getMainFwdBufferInfo();if(null!==_){var r=this.getLevelDetails();if(r&&this._streamEnded(_,r)){var T={};return this.altAudio&&(T.type="video"),this.hls.trigger(P.BUFFER_EOS,T),void(this.state=Xi.ENDED)}e.loadLevel!==E&&-1===e.manualLevel&&this.log("Adapting to level "+E+" from level "+this.level),this.level=e.nextLoadLevel=E;var S=n.details;if(!S||this.state===Xi.WAITING_LEVEL||S.live&&this.levelLastLoaded!==n)return this.level=E,void(this.state=Xi.WAITING_LEVEL);var s=_.len,l=this.getMaxBufferLength(n.maxBitrate);if(!(s>=l)){this.backtrackFragment&&this.backtrackFragment.start>_.end&&(this.backtrackFragment=null);var I=this.backtrackFragment?this.backtrackFragment.start:_.end,A=this.getNextFragment(I,S);if(this.couldBacktrack&&!this.fragPrevious&&A&&"initSegment"!==A.sn&&this.fragmentTracker.getState(A)!==mi.OK){var O,u=(null!=(O=this.backtrackFragment)?O:A).sn-S.startSN,d=S.fragments[u-1];d&&A.cc===d.cc&&(A=d,this.fragmentTracker.removeFragment(d))}else this.backtrackFragment&&_.len&&(this.backtrackFragment=null);if(A&&this.isLoopLoading(A,I)){if(!A.gap){var N=this.audioOnly&&!this.altAudio?z.AUDIO:z.VIDEO,R=(N===z.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;R&&this.afterBufferFlushed(R,N,$t.MAIN)}A=this.getNextFragmentLoopLoading(A,S,_,$t.MAIN,l)}A&&(!A.initSegment||A.initSegment.data||this.bitrateTest||(A=A.initSegment),this.loadFragment(A,n,I))}}}},a.loadFragment=function(t,a,i){var o=this.fragmentTracker.getState(t);this.fragCurrent=t,o===mi.NOT_LOADED||o===mi.PARTIAL?"initSegment"===t.sn?this._loadInitSegment(t,a):this.bitrateTest?(this.log("Fragment "+t.sn+" of level "+t.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(t,a)):(this.startFragRequested=!0,e.prototype.loadFragment.call(this,t,a,i)):this.clearTrackerIfNeeded(t)},a.getBufferedFrag=function(e){return this.fragmentTracker.getBufferedFrag(e,$t.MAIN)},a.followingBufferedFrag=function(e){return e?this.getBufferedFrag(e.end+.5):null},a.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},a.nextLevelSwitch=function(){var e=this.levels,t=this.media;if(null!=t&&t.readyState){var a,i=this.getAppendedFrag(t.currentTime);i&&i.start>1&&this.flushMainBuffer(0,i.start-1);var o=this.getLevelDetails();if(null!=o&&o.live){var E=this.getMainFwdBufferInfo();if(!E||E.len<2*o.targetduration)return}if(!t.paused&&e){var n=e[this.hls.nextLoadLevel],_=this.fragLastKbps;a=_&&this.fragCurrent?this.fragCurrent.duration*n.maxBitrate/(1e3*_)+1:0}else a=0;var r=this.getBufferedFrag(t.currentTime+a);if(r){var T=this.followingBufferedFrag(r);if(T){this.abortCurrentFrag();var S=T.maxStartPTS?T.maxStartPTS:T.start,s=T.duration,l=Math.max(r.end,S+Math.min(Math.max(s-this.config.maxFragLookUpTolerance,s*(this.couldBacktrack?.5:.125)),s*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(l,Number.POSITIVE_INFINITY)}}}},a.abortCurrentFrag=function(){var e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case Xi.KEY_LOADING:case Xi.FRAG_LOADING:case Xi.FRAG_LOADING_WAITING_RETRY:case Xi.PARSING:case Xi.PARSED:this.state=Xi.IDLE}this.nextLoadPosition=this.getLoadPosition()},a.flushMainBuffer=function(t,a){e.prototype.flushMainBuffer.call(this,t,a,this.altAudio?"video":null)},a.onMediaAttached=function(t,a){e.prototype.onMediaAttached.call(this,t,a);var i=a.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),i.addEventListener("playing",this.onvplaying),i.addEventListener("seeked",this.onvseeked),this.gapController=new yr(this.config,i,this.fragmentTracker,this.hls)},a.onMediaDetaching=function(){var t=this.media;t&&this.onvplaying&&this.onvseeked&&(t.removeEventListener("playing",this.onvplaying),t.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),e.prototype.onMediaDetaching.call(this)},a.onMediaPlaying=function(){this.tick()},a.onMediaSeeked=function(){var e=this.media,t=e?e.currentTime:null;C(t)&&this.log("Media seeked to "+t.toFixed(3));var a=this.getMainFwdBufferInfo();null!==a&&0!==a.len?this.tick():this.warn('Main forward buffer length on "seeked" event '+(a?a.len:"empty")+")")},a.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(P.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1},a.onManifestParsed=function(e,t){var a=!1,i=!1;t.levels.forEach(function(e){var t=e.audioCodec;t&&(a=a||-1!==t.indexOf("mp4a.40.2"),i=i||-1!==t.indexOf("mp4a.40.5"))}),this.audioCodecSwitch=a&&i&&!vr(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1},a.onLevelLoading=function(e,t){var a=this.levels;if(a&&this.state===Xi.IDLE){var i=a[t.level];(!i.details||i.details.live&&this.levelLastLoaded!==i||this.waitForCdnTuneIn(i.details))&&(this.state=Xi.WAITING_LEVEL)}},a.onLevelLoaded=function(e,t){var a,i=this.levels,o=t.level,E=t.details,n=E.totalduration;if(i){this.log("Level "+o+" loaded ["+E.startSN+","+E.endSN+"]"+(E.lastPartSn?"[part-"+E.lastPartSn+"-"+E.lastPartIndex+"]":"")+", cc ["+E.startCC+", "+E.endCC+"] duration:"+n);var _=i[o],r=this.fragCurrent;!r||this.state!==Xi.FRAG_LOADING&&this.state!==Xi.FRAG_LOADING_WAITING_RETRY||r.level!==t.level&&r.loader&&this.abortCurrentFrag();var T=0;if(E.live||null!=(a=_.details)&&a.live){var S;if(this.checkLiveUpdate(E),E.deltaUpdateFailed)return;T=this.alignPlaylists(E,_.details,null==(S=this.levelLastLoaded)?void 0:S.details)}if(_.details=E,this.levelLastLoaded=_,this.hls.trigger(P.LEVEL_UPDATED,{details:E,level:o}),this.state===Xi.WAITING_LEVEL){if(this.waitForCdnTuneIn(E))return;this.state=Xi.IDLE}this.startFragRequested?E.live&&this.synchronizeToLiveEdge(E):this.setStartPosition(E,T),this.tick()}else this.warn("Levels were reset while loading level "+o)},a._handleFragmentLoadProgress=function(e){var t,a=e.frag,i=e.part,o=e.payload,E=this.levels;if(E){var n=E[a.level],_=n.details;if(!_)return this.warn("Dropping fragment "+a.sn+" of level "+a.level+" after level details were reset"),void this.fragmentTracker.removeFragment(a);var r=n.videoCodec,T=_.PTSKnown||!_.live,S=null==(t=a.initSegment)?void 0:t.data,s=this._getAudioCodec(n),l=this.transmuxer=this.transmuxer||new vE(this.hls,$t.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),I=i?i.index:-1,A=-1!==I,O=new Pi(a.level,a.sn,a.stats.chunkCount,o.byteLength,I,A),u=this.initPTS[a.cc];l.push(o,S,s,r,a,i,_.totalduration,T,O,u)}else this.warn("Levels were reset while fragment load was in progress. Fragment "+a.sn+" of level "+a.level+" will not be buffered")},a.onAudioTrackSwitching=function(e,t){var a=this.altAudio;if(!t.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var i=this.fragCurrent;i&&(this.log("Switching to main audio track, cancel main fragment load"),i.abortRequests(),this.fragmentTracker.removeFragment(i)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var o=this.hls;a&&(o.trigger(P.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),o.trigger(P.AUDIO_TRACK_SWITCHED,t)}},a.onAudioTrackSwitched=function(e,t){var a=t.id,i=!!this.hls.audioTracks[a].url;if(i){var o=this.videoBuffer;o&&this.mediaBuffer!==o&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=o)}this.altAudio=i,this.tick()},a.onBufferCreated=function(e,t){var a,i,o=t.tracks,E=!1;for(var n in o){var _=o[n];if("main"===_.id){if(i=n,a=_,"video"===n){var r=o[n];r&&(this.videoBuffer=r.buffer)}}else E=!0}E&&a?(this.log("Alternate track found, use "+i+".buffered to schedule main fragment loading"),this.mediaBuffer=a.buffer):this.mediaBuffer=this.media},a.onFragBuffered=function(e,t){var a=t.frag,i=t.part;if(!a||a.type===$t.MAIN){if(this.fragContextChanged(a))return this.warn("Fragment "+a.sn+(i?" p: "+i.index:"")+" of level "+a.level+" finished buffering, but was aborted. state: "+this.state),void(this.state===Xi.PARSED&&(this.state=Xi.IDLE));var o=i?i.stats:a.stats;this.fragLastKbps=Math.round(8*o.total/(o.buffering.end-o.loading.first)),"initSegment"!==a.sn&&(this.fragPrevious=a),this.fragBufferedComplete(a,i)}},a.onError=function(e,t){var a;if(t.fatal)this.state=Xi.ERROR;else switch(t.details){case f.FRAG_GAP:case f.FRAG_PARSING_ERROR:case f.FRAG_DECRYPT_ERROR:case f.FRAG_LOAD_ERROR:case f.FRAG_LOAD_TIMEOUT:case f.KEY_LOAD_ERROR:case f.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError($t.MAIN,t);break;case f.LEVEL_LOAD_ERROR:case f.LEVEL_LOAD_TIMEOUT:case f.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==Xi.WAITING_LEVEL||(null==(a=t.context)?void 0:a.type)!==Xt.LEVEL||(this.state=Xi.IDLE);break;case f.BUFFER_APPEND_ERROR:case f.BUFFER_FULL_ERROR:if(!t.parent||"main"!==t.parent)return;if(t.details===f.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case f.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}},a.checkBuffer=function(){var e=this.media,t=this.gapController;if(e&&t&&e.readyState){if(this.loadedmetadata||!hi.getBuffered(e).length){var a=this.state!==Xi.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,a)}this.lastCurrentTime=e.currentTime}},a.onFragLoadEmergencyAborted=function(){this.state=Xi.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},a.onBufferFlushed=function(e,t){var a=t.type;if(a!==z.AUDIO||this.audioOnly&&!this.altAudio){var i=(a===z.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(i,a,$t.MAIN),this.tick()}},a.onLevelsUpdated=function(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=t.levels},a.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},a.seekToStartPos=function(){var e=this.media;if(e){var t=e.currentTime,a=this.startPosition;if(a>=0&&t0&&(oR.cc;if(!1!==o.independent){var L=S.startPTS,D=S.endPTS,p=S.startDTS,h=S.endDTS;if(r)r.elementaryStreams[S.type]={startPTS:L,endPTS:D,startDTS:p,endDTS:h};else if(S.firstKeyFrame&&S.independent&&1===E.id&&!m&&(this.couldBacktrack=!0),S.dropped&&S.independent){var B=this.getMainFwdBufferInfo(),f=(B?B.end:this.getLoadPosition())+this.config.maxBufferHole,g=S.firstKeyFramePTS?S.firstKeyFramePTS:L;if(!c&&fWr&&(_.gap=!0);_.setElementaryStreamInfo(S.type,L,D,p,h),this.backtrackFragment&&(this.backtrackFragment=_),this.bufferFragmentData(S,_,r,E,c||m)}else{if(!c&&!m)return void this.backtrack(_);_.gap=!0}}if(O){var v=O.startPTS,M=O.endPTS,W=O.startDTS,U=O.endDTS;r&&(r.elementaryStreams[z.AUDIO]={startPTS:v,endPTS:M,startDTS:W,endDTS:U}),_.setElementaryStreamInfo(z.AUDIO,v,M,W,U),this.bufferFragmentData(O,_,r,E)}if(A&&null!=l&&null!=(t=l.samples)&&t.length){var G={id:a,frag:_,details:A,samples:l.samples};i.trigger(P.FRAG_PARSING_METADATA,G)}if(A&&s){var y={id:a,frag:_,details:A,samples:s.samples};i.trigger(P.FRAG_PARSING_USERDATA,y)}}}else this.resetWhenMissingContext(E)},a._bufferInitSegment=function(e,t,a,i){var o=this;if(this.state===Xi.PARSING){this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;var E=t.audio,n=t.video,_=t.audiovideo;if(E){var r=e.audioCodec,T=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(r&&(r=-1!==r.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),1!==E.metadata.channelCount&&-1===T.indexOf("firefox")&&(r="mp4a.40.5")),r&&-1!==r.indexOf("mp4a.40.5")&&-1!==T.indexOf("android")&&"audio/mpeg"!==E.container&&(r="mp4a.40.2",this.log("Android: force audio codec to "+r)),e.audioCodec&&e.audioCodec!==r&&this.log('Swapping manifest audio codec "'+e.audioCodec+'" for "'+r+'"'),E.levelCodec=r,E.id="main",this.log("Init audio buffer, container:"+E.container+", codecs[selected/level/parsed]=["+(r||"")+"/"+(e.audioCodec||"")+"/"+E.codec+"]")}n&&(n.levelCodec=e.videoCodec,n.id="main",this.log("Init video buffer, container:"+n.container+", codecs[level/parsed]=["+(e.videoCodec||"")+"/"+n.codec+"]")),_&&this.log("Init audiovideo buffer, container:"+_.container+", codecs[level/parsed]=["+e.codecs+"/"+_.codec+"]"),this.hls.trigger(P.BUFFER_CODECS,t),Object.keys(t).forEach(function(e){var E=t[e].initSegment;null!=E&&E.byteLength&&o.hls.trigger(P.BUFFER_APPENDING,{type:e,data:E,frag:a,part:null,chunkMeta:i,parent:a.type})}),this.tickImmediate()}},a.getMainFwdBufferInfo=function(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,$t.MAIN)},a.backtrack=function(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=Xi.IDLE},a.checkFragmentChanged=function(){var e=this.media,t=null;if(e&&e.readyState>1&&!1===e.seeking){var a=e.currentTime;if(hi.isBuffered(e,a)?t=this.getAppendedFrag(a):hi.isBuffered(e,a+.1)&&(t=this.getAppendedFrag(a+.1)),t){this.backtrackFragment=null;var i=this.fragPlaying,o=t.level;i&&t.sn===i.sn&&i.level===o||(this.fragPlaying=t,this.hls.trigger(P.FRAG_CHANGED,{frag:t}),i&&i.level===o||this.hls.trigger(P.LEVEL_SWITCHED,{level:o}))}}},_(t,[{key:"nextLevel",get:function(){var e=this.nextBufferedFrag;return e?e.level:-1}},{key:"currentFrag",get:function(){var e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}},{key:"currentProgramDateTime",get:function(){var e=this.media;if(e){var t=e.currentTime,a=this.currentFrag;if(a&&C(t)&&C(a.programDateTime)){var i=a.programDateTime+1e3*(t-a.start);return new Date(i)}}return null}},{key:"currentLevel",get:function(){var e=this.currentFrag;return e?e.level:-1}},{key:"nextBufferedFrag",get:function(){var e=this.currentFrag;return e?this.followingBufferedFrag(e):null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),t})($i),Fr=(function(){function e(t){void 0===t&&(t={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new LE,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,G(t.debug||!1,"Hls instance");var a=this.config=Lr(e.DefaultConfig,t);this.userConfig=t,a.progressive&&Cr(a);var i=a.abrController,o=a.bufferController,E=a.capLevelController,n=a.errorController,_=a.fpsController,r=new n(this),T=this.abrController=new i(this),S=this.bufferController=new o(this),s=this.capLevelController=new E(this),l=new _(this),I=new Zt(this),A=new Aa(this),O=a.contentSteeringController,u=O?new O(this):null,d=this.levelController=new pr(this,u),N=new Li(this),R=new Pr(this.config),c=this.streamController=new kr(this,N,R);s.setStreamController(c),l.setStreamController(c);var m=[I,d,c];u&&m.splice(1,0,u),this.networkControllers=m;var L=[T,S,s,l,A,N];this.audioTrackController=this.createController(a.audioTrackController,m);var D=a.audioStreamController;D&&m.push(new D(this,N,R)),this.subtitleTrackController=this.createController(a.subtitleTrackController,m);var C=a.subtitleStreamController;C&&m.push(new C(this,N,R)),this.createController(a.timelineController,L),R.emeController=this.emeController=this.createController(a.emeController,L),this.cmcdController=this.createController(a.cmcdController,L),this.latencyController=this.createController(Oa,L),this.coreComponents=L,m.push(r);var p=r.onErrorOut;"function"==typeof p&&this.on(P.ERROR,p,r)}e.isMSESupported=function(){return fr()},e.isSupported=function(){return gr()},e.getMediaSource=function(){return mt()};var t=e.prototype;return t.createController=function(e,t){if(e){var a=new e(this);return t&&t.push(a),a}return null},t.on=function(e,t,a){void 0===a&&(a=this),this._emitter.on(e,t,a)},t.once=function(e,t,a){void 0===a&&(a=this),this._emitter.once(e,t,a)},t.removeAllListeners=function(e){this._emitter.removeAllListeners(e)},t.off=function(e,t,a,i){void 0===a&&(a=this),this._emitter.off(e,t,a,i)},t.listeners=function(e){return this._emitter.listeners(e)},t.emit=function(e,t,a){return this._emitter.emit(e,t,a)},t.trigger=function(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(t){if(y.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),!this.triggeringException){this.triggeringException=!0;var a=e===P.ERROR;this.trigger(P.ERROR,{type:B.OTHER_ERROR,details:f.INTERNAL_EXCEPTION,fatal:a,event:e,error:t}),this.triggeringException=!1}}return!1},t.listenerCount=function(e){return this._emitter.listenerCount(e)},t.destroy=function(){y.log("destroy"),this.trigger(P.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(e){return e.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(e){return e.destroy()}),this.coreComponents.length=0;var e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null},t.attachMedia=function(e){y.log("attachMedia"),this._media=e,this.trigger(P.MEDIA_ATTACHING,{media:e})},t.detachMedia=function(){y.log("detachMedia"),this.trigger(P.MEDIA_DETACHING,void 0),this._media=null},t.loadSource=function(e){this.stopLoad();var t=this.media,a=this.url,i=this.url=D.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,y.log("loadSource:"+i),t&&a&&(a!==i||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(P.MANIFEST_LOADING,{url:e})},t.startLoad=function(e){void 0===e&&(e=-1),y.log("startLoad("+e+")"),this.started=!0,this.networkControllers.forEach(function(t){t.startLoad(e)})},t.stopLoad=function(){y.log("stopLoad"),this.started=!1,this.networkControllers.forEach(function(e){e.stopLoad()})},t.resumeBuffering=function(){this.started&&this.networkControllers.forEach(function(e){"fragmentLoader"in e&&e.startLoad(-1)})},t.pauseBuffering=function(){this.networkControllers.forEach(function(e){"fragmentLoader"in e&&e.stopLoad()})},t.swapAudioCodec=function(){y.log("swapAudioCodec"),this.streamController.swapAudioCodec()},t.recoverMediaError=function(){y.log("recoverMediaError");var e=this._media;this.detachMedia(),e&&this.attachMedia(e)},t.removeLevel=function(e){this.levelController.removeLevel(e)},t.setAudioOption=function(e){var t;return null==(t=this.audioTrackController)?void 0:t.setAudioOption(e)},t.setSubtitleOption=function(e){var t;return null==(t=this.subtitleTrackController)||t.setSubtitleOption(e),null},_(e,[{key:"levels",get:function(){var e=this.levelController.levels;return e||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(e){y.log("set currentLevel:"+e),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(e){y.log("set nextLevel:"+e),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(e){y.log("set loadLevel:"+e),this.levelController.manualLevel=e}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(e){y.log("set firstLevel:"+e),this.levelController.firstLevel=e}},{key:"startLevel",get:function(){var e=this.levelController.startLevel;return-1===e&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e},set:function(e){y.log("set startLevel:"+e),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(e){var t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){this._autoLevelCapping!==e&&(y.log("set autoLevelCapping:"+e),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}},{key:"bandwidthEstimate",get:function(){var e=this.abrController.bwEstimator;return e?e.getEstimate():NaN},set:function(e){this.abrController.resetEstimator(e)}},{key:"ttfbEstimate",get:function(){var e=this.abrController.bwEstimator;return e?e.getEstimateTTFB():NaN}},{key:"maxHdcpLevel",get:function(){return this._maxHdcpLevel},set:function(e){da(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var e=this.levels,t=this.config.minAutoBitrate;if(!e)return 0;for(var a=e.length,i=0;i=t)return i;return 0}},{key:"maxAutoLevel",get:function(){var e,t=this.levels,a=this.autoLevelCapping,i=this.maxHdcpLevel;if(e=-1===a&&null!=t&&t.length?t.length-1:a,i)for(var o=e;o--;){var E=t[o].attrs["HDCP-LEVEL"];if(E&&E<=i)return o}return e}},{key:"firstAutoLevel",get:function(){return this.abrController.firstAutoLevel}},{key:"nextAutoLevel",get:function(){return this.abrController.nextAutoLevel},set:function(e){this.abrController.nextAutoLevel=e}},{key:"playingDate",get:function(){return this.streamController.currentProgramDateTime}},{key:"mainForwardBufferInfo",get:function(){return this.streamController.getMainFwdBufferInfo()}},{key:"allAudioTracks",get:function(){var e=this.audioTrackController;return e?e.allAudioTracks:[]}},{key:"audioTracks",get:function(){var e=this.audioTrackController;return e?e.audioTracks:[]}},{key:"audioTrack",get:function(){var e=this.audioTrackController;return e?e.audioTrack:-1},set:function(e){var t=this.audioTrackController;t&&(t.audioTrack=e)}},{key:"allSubtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}},{key:"subtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTrack:-1},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var e=this.subtitleTrackController;return!!e&&e.subtitleDisplay},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(e){this.config.lowLatencyMode=e}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.5.5-0.canary.9893"}},{key:"Events",get:function(){return P}},{key:"ErrorTypes",get:function(){return B}},{key:"ErrorDetails",get:function(){return f}},{key:"DefaultConfig",get:function(){return e.defaultConfig?e.defaultConfig:cr},set:function(t){e.defaultConfig=t}}]),e})();return Fr.defaultConfig=void 0,Fr})()})(!1)},68305:e=>{"use strict";const t=e=>"string"==typeof e,a=()=>{let e,t;const a=new Promise((a,i)=>{e=a,t=i});return a.resolve=e,a.reject=t,a},i=e=>null==e?"":""+e,o=/###/g,E=e=>e&&e.indexOf("###")>-1?e.replace(o,"."):e,n=e=>!e||t(e),_=(e,a,i)=>{const o=t(a)?a.split("."):a;let _=0;for(;_{const{obj:i,k:o}=_(e,t,Object);if(void 0!==i||1===t.length)return void(i[o]=a);let E=t[t.length-1],n=t.slice(0,t.length-1),r=_(e,n,Object);for(;void 0===r.obj&&n.length;)E=`${n[n.length-1]}.${E}`,n=n.slice(0,n.length-1),r=_(e,n,Object),r?.obj&&void 0!==r.obj[`${r.k}.${E}`]&&(r.obj=void 0);r.obj[`${r.k}.${E}`]=a},T=(e,t)=>{const{obj:a,k:i}=_(e,t);if(a&&Object.prototype.hasOwnProperty.call(a,i))return a[i]},S=(e,a,i)=>{for(const o in a)"__proto__"!==o&&"constructor"!==o&&(o in e?t(e[o])||e[o]instanceof String||t(a[o])||a[o]instanceof String?i&&(e[o]=a[o]):S(e[o],a[o],i):e[o]=a[o]);return e},s=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var l={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const I=e=>t(e)?e.replace(/[&<>"'\/]/g,e=>l[e]):e;const A=[" ",",","?","!",";"],O=new class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(void 0!==t)return t;const a=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,a),this.regExpQueue.push(e),a}}(20),u=function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(!e)return;if(e[t]){if(!Object.prototype.hasOwnProperty.call(e,t))return;return e[t]}const i=t.split(a);let o=e;for(let e=0;e-1&&ne?.replace("_","-"),N={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}};class R{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.init(e,t)}init(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||N,this.options=t,this.debug=t.debug}log(){for(var e=arguments.length,t=new Array(e),a=0;a{this.observers[e]||(this.observers[e]=new Map);const a=this.observers[e].get(t)||0;this.observers[e].set(t,a+1)}),this}off(e,t){this.observers[e]&&(t?this.observers[e].delete(t):delete this.observers[e])}emit(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),i=1;i{let[t,i]=e;for(let e=0;e{let[i,o]=t;for(let t=0;t1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,a,i){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const E=void 0!==o.keySeparator?o.keySeparator:this.options.keySeparator,n=void 0!==o.ignoreJSONStructure?o.ignoreJSONStructure:this.options.ignoreJSONStructure;let _;e.indexOf(".")>-1?_=e.split("."):(_=[e,a],i&&(Array.isArray(i)?_.push(...i):t(i)&&E?_.push(...i.split(E)):_.push(i)));const r=T(this.data,_);return!r&&!a&&!i&&e.indexOf(".")>-1&&(e=_[0],a=_[1],i=_.slice(2).join(".")),!r&&n&&t(i)?u(this.data?.[e]?.[a],i,E):r}addResource(e,t,a,i){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1};const E=void 0!==o.keySeparator?o.keySeparator:this.options.keySeparator;let n=[e,t];a&&(n=n.concat(E?a.split(E):a)),e.indexOf(".")>-1&&(n=e.split("."),i=t,t=n[1]),this.addNamespaces(t),r(this.data,n,i),o.silent||this.emit("added",e,t,a,i)}addResources(e,a,i){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(const o in i)(t(i[o])||Array.isArray(i[o]))&&this.addResource(e,a,o,i[o],{silent:!0});o.silent||this.emit("added",e,a,i)}addResourceBundle(e,t,a,i,o){let E=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1,skipCopy:!1},n=[e,t];e.indexOf(".")>-1&&(n=e.split("."),i=a,a=t,t=n[1]),this.addNamespaces(t);let _=T(this.data,n)||{};E.skipCopy||(a=JSON.parse(JSON.stringify(a))),i?S(_,a,o):_={..._,...a},r(this.data,n,_),E.silent||this.emit("added",e,t,a)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return void 0!==this.getResource(e,t)}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}}var D={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,a,i,o){return e.forEach(e=>{t=this.processors[e]?.process(t,a,i,o)??t}),t}};const C={},p=e=>!t(e)&&"boolean"!=typeof e&&"number"!=typeof e;class h extends m{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var a,i;super(),a=e,i=this,["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"].forEach(e=>{a[e]&&(i[e]=a[e])}),this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=c.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;const a=this.resolve(e,t);return void 0!==a?.res}extractFromKey(e,a){let i=void 0!==a.nsSeparator?a.nsSeparator:this.options.nsSeparator;void 0===i&&(i=":");const o=void 0!==a.keySeparator?a.keySeparator:this.options.keySeparator;let E=a.ns||this.options.defaultNS||[];const n=i&&e.indexOf(i)>-1,_=!(this.options.userDefinedKeySeparator||a.keySeparator||this.options.userDefinedNsSeparator||a.nsSeparator||((e,t,a)=>{t=t||"",a=a||"";const i=A.filter(e=>t.indexOf(e)<0&&a.indexOf(e)<0);if(0===i.length)return!0;const o=O.getRegExp(`(${i.map(e=>"?"===e?"\\?":e).join("|")})`);let E=!o.test(e);if(!E){const t=e.indexOf(a);t>0&&!o.test(e.substring(0,t))&&(E=!0)}return E})(e,i,o));if(n&&!_){const a=e.match(this.interpolator.nestingRegexp);if(a&&a.length>0)return{key:e,namespaces:t(E)?[E]:E};const n=e.split(i);(i!==o||i===o&&this.options.ns.indexOf(n[0])>-1)&&(E=n.shift()),e=n.join(o)}return{key:e,namespaces:t(E)?[E]:E}}translate(e,a,i){if("object"!=typeof a&&this.options.overloadTranslationOptionHandler&&(a=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof a&&(a={...a}),a||(a={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);const o=void 0!==a.returnDetails?a.returnDetails:this.options.returnDetails,E=void 0!==a.keySeparator?a.keySeparator:this.options.keySeparator,{key:n,namespaces:_}=this.extractFromKey(e[e.length-1],a),r=_[_.length-1],T=a.lng||this.language,S=a.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if("cimode"===T?.toLowerCase()){if(S){const e=a.nsSeparator||this.options.nsSeparator;return o?{res:`${r}${e}${n}`,usedKey:n,exactUsedKey:n,usedLng:T,usedNS:r,usedParams:this.getUsedParamsDetails(a)}:`${r}${e}${n}`}return o?{res:n,usedKey:n,exactUsedKey:n,usedLng:T,usedNS:r,usedParams:this.getUsedParamsDetails(a)}:n}const s=this.resolve(e,a);let l=s?.res;const I=s?.usedKey||n,A=s?.exactUsedKey||n,O=void 0!==a.joinArrays?a.joinArrays:this.options.joinArrays,u=!this.i18nFormat||this.i18nFormat.handleAsObject,d=void 0!==a.count&&!t(a.count),N=h.hasDefaultValue(a),R=d?this.pluralResolver.getSuffix(T,a.count,a):"",c=a.ordinal&&d?this.pluralResolver.getSuffix(T,a.count,{ordinal:!1}):"",m=d&&!a.ordinal&&0===a.count,L=m&&a[`defaultValue${this.options.pluralSeparator}zero`]||a[`defaultValue${R}`]||a[`defaultValue${c}`]||a.defaultValue;let D=l;u&&!l&&N&&(D=L);const C=p(D),P=Object.prototype.toString.apply(D);if(!(u&&D&&C&&["[object Number]","[object Function]","[object RegExp]"].indexOf(P)<0)||t(O)&&Array.isArray(D))if(u&&t(O)&&Array.isArray(l))l=l.join(O),l&&(l=this.extendTranslation(l,e,a,i));else{let t=!1,o=!1;!this.isValidLookup(l)&&N&&(t=!0,l=L),this.isValidLookup(l)||(o=!0,l=n);const _=(a.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&o?void 0:l,S=N&&L!==l&&this.options.updateMissing;if(o||t||S){if(this.logger.log(S?"updateKey":"missingKey",T,r,n,S?L:l),E){const e=this.resolve(n,{...a,keySeparator:!1});e&&e.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let e=[];const t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,a.lng||this.language);if("fallback"===this.options.saveMissingTo&&t&&t[0])for(let a=0;a{const o=N&&i!==l?i:_;this.options.missingKeyHandler?this.options.missingKeyHandler(e,r,t,o,S,a):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,r,t,o,S,a),this.emit("missingKey",e,r,t,l)};this.options.saveMissing&&(this.options.saveMissingPlurals&&d?e.forEach(e=>{const t=this.pluralResolver.getSuffixes(e,a);m&&a[`defaultValue${this.options.pluralSeparator}zero`]&&t.indexOf(`${this.options.pluralSeparator}zero`)<0&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{i([e],n+t,a[`defaultValue${t}`]||L)})}):i(e,n,L))}l=this.extendTranslation(l,e,a,s,i),o&&l===n&&this.options.appendNamespaceToMissingKey&&(l=`${r}:${n}`),(o||t)&&this.options.parseMissingKeyHandler&&(l=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${r}:${n}`:n,t?l:void 0))}else{if(!a.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(I,D,{...a,ns:_}):`key '${n} (${this.language})' returned an object instead of string.`;return o?(s.res=e,s.usedParams=this.getUsedParamsDetails(a),s):e}if(E){const e=Array.isArray(D),t=e?[]:{},i=e?A:I;for(const e in D)if(Object.prototype.hasOwnProperty.call(D,e)){const o=`${i}${E}${e}`;t[e]=N&&!l?this.translate(o,{...a,defaultValue:p(L)?L[e]:void 0,joinArrays:!1,ns:_}):this.translate(o,{...a,joinArrays:!1,ns:_}),t[e]===o&&(t[e]=D[e])}l=t}}return o?(s.res=l,s.usedParams=this.getUsedParamsDetails(a),s):l}extendTranslation(e,a,i,o,E){var n=this;if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...i},i.lng||this.language||o.usedLng,o.usedNS,o.usedKey,{resolved:o});else if(!i.skipInterpolation){i.interpolation&&this.interpolator.init({...i,interpolation:{...this.options.interpolation,...i.interpolation}});const _=t(e)&&(void 0!==i?.interpolation?.skipOnVariables?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let r;if(_){const t=e.match(this.interpolator.nestingRegexp);r=t&&t.length}let T=i.replace&&!t(i.replace)?i.replace:i;if(this.options.interpolation.defaultVariables&&(T={...this.options.interpolation.defaultVariables,...T}),e=this.interpolator.interpolate(e,T,i.lng||this.language||o.usedLng,i),_){const t=e.match(this.interpolator.nestingRegexp);r<(t&&t.length)&&(i.nest=!1)}!i.lng&&o&&o.res&&(i.lng=this.language||o.usedLng),!1!==i.nest&&(e=this.interpolator.nest(e,function(){for(var e=arguments.length,t=new Array(e),o=0;o1&&void 0!==arguments[1]?arguments[1]:{};return t(e)&&(e=[e]),e.forEach(e=>{if(this.isValidLookup(a))return;const r=this.extractFromKey(e,_),T=r.key;i=T;let S=r.namespaces;this.options.fallbackNS&&(S=S.concat(this.options.fallbackNS));const s=void 0!==_.count&&!t(_.count),l=s&&!_.ordinal&&0===_.count,I=void 0!==_.context&&(t(_.context)||"number"==typeof _.context)&&""!==_.context,A=_.lngs?_.lngs:this.languageUtils.toResolveHierarchy(_.lng||this.language,_.fallbackLng);S.forEach(e=>{this.isValidLookup(a)||(n=e,C[`${A[0]}-${e}`]||!this.utils?.hasLoadedNamespace||this.utils?.hasLoadedNamespace(n)||(C[`${A[0]}-${e}`]=!0,this.logger.warn(`key "${i}" for languages "${A.join(", ")}" won't get resolved as namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),A.forEach(t=>{if(this.isValidLookup(a))return;E=t;const i=[T];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(i,T,t,e,_);else{let e;s&&(e=this.pluralResolver.getSuffix(t,_.count,_));const a=`${this.options.pluralSeparator}zero`,o=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(s&&(i.push(T+e),_.ordinal&&0===e.indexOf(o)&&i.push(T+e.replace(o,this.options.pluralSeparator)),l&&i.push(T+a)),I){const t=`${T}${this.options.contextSeparator}${_.context}`;i.push(t),s&&(i.push(t+e),_.ordinal&&0===e.indexOf(o)&&i.push(t+e.replace(o,this.options.pluralSeparator)),l&&i.push(t+a))}}let n;for(;n=i.pop();)this.isValidLookup(a)||(o=n,a=this.getResource(t,e,n,_))}))})}),{res:a,usedKey:i,exactUsedKey:o,usedLng:E,usedNS:n}}isValidLookup(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}getResource(e,t,a){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,a,i):this.resourceStore.getResource(e,t,a,i)}getUsedParamsDetails(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const a=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],i=e.replace&&!t(e.replace);let o=i?e.replace:e;if(i&&void 0!==e.count&&(o.count=e.count),this.options.interpolation.defaultVariables&&(o={...this.options.interpolation.defaultVariables,...o}),!i){o={...o};for(const e of a)delete o[e]}return o}static hasDefaultValue(e){const t="defaultValue";for(const a in e)if(Object.prototype.hasOwnProperty.call(e,a)&&t===a.substring(0,12)&&void 0!==e[a])return!0;return!1}}class P{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=c.create("languageUtils")}getScriptPartFromCode(e){if(!(e=d(e))||e.indexOf("-")<0)return null;const t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}getLanguagePartFromCode(e){if(!(e=d(e))||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(t(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch(e){}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;const a=this.formatLanguageCode(e);this.options.supportedLngs&&!this.isSupportedCode(a)||(t=a)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;const a=this.getLanguagePartFromCode(e);if(this.isSupportedCode(a))return t=a;t=this.options.supportedLngs.find(e=>e===a?e:e.indexOf("-")<0&&a.indexOf("-")<0?void 0:e.indexOf("-")>0&&a.indexOf("-")<0&&e.substring(0,e.indexOf("-"))===a||0===e.indexOf(a)&&a.length>1?e:void 0)}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,a){if(!e)return[];if("function"==typeof e&&(e=e(a)),t(e)&&(e=[e]),Array.isArray(e))return e;if(!a)return e.default||[];let i=e[a];return i||(i=e[this.getScriptPartFromCode(a)]),i||(i=e[this.formatLanguageCode(a)]),i||(i=e[this.getLanguagePartFromCode(a)]),i||(i=e.default),i||[]}toResolveHierarchy(e,a){const i=this.getFallbackCodes(a||this.options.fallbackLng||[],e),o=[],E=e=>{e&&(this.isSupportedCode(e)?o.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return t(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?("languageOnly"!==this.options.load&&E(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&E(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&E(this.getLanguagePartFromCode(e))):t(e)&&E(this.formatLanguageCode(e)),i.forEach(e=>{o.indexOf(e)<0&&E(this.formatLanguageCode(e))}),o}}const B={zero:0,one:1,two:2,few:3,many:4,other:5},f={select:e=>1===e?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class g{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.languageUtils=e,this.options=t,this.logger=c.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const a=d("dev"===e?"en":e),i=t.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:a,type:i});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];let E;try{E=new Intl.PluralRules(a,{type:i})}catch(a){if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),f;if(!e.match(/-|_/))return f;const i=this.languageUtils.getLanguagePartFromCode(e);E=this.getRule(i,t)}return this.pluralRulesCache[o]=E,E}needsPlural(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=this.getRule(e,t);return a||(a=this.getRule("dev",t)),a?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,a).map(e=>`${t}${e}`)}getSuffixes(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=this.getRule(e,t);return a||(a=this.getRule("dev",t)),a?a.resolvedOptions().pluralCategories.sort((e,t)=>B[e]-B[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e}`):[]}getSuffix(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=this.getRule(e,a);return i?`${this.options.prepend}${a.ordinal?`ordinal${this.options.prepend}`:""}${i.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,a))}}const v=function(e,a,i){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:".",E=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=((e,t,a)=>{const i=T(e,a);return void 0!==i?i:T(t,a)})(e,a,i);return!n&&E&&t(i)&&(n=u(e,i,o),void 0===n&&(n=u(a,i,o))),n},M=e=>e.replace(/\$/g,"$$$$");class W{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=c.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:a,useRawValueToEscape:i,prefix:o,prefixEscaped:E,suffix:n,suffixEscaped:_,formatSeparator:r,unescapeSuffix:T,unescapePrefix:S,nestingPrefix:l,nestingPrefixEscaped:A,nestingSuffix:O,nestingSuffixEscaped:u,nestingOptionsSeparator:d,maxReplaces:N,alwaysFormat:R}=e.interpolation;this.escape=void 0!==t?t:I,this.escapeValue=void 0===a||a,this.useRawValueToEscape=void 0!==i&&i,this.prefix=o?s(o):E||"{{",this.suffix=n?s(n):_||"}}",this.formatSeparator=r||",",this.unescapePrefix=T?"":S||"-",this.unescapeSuffix=this.unescapePrefix?"":T||"",this.nestingPrefix=l?s(l):A||s("$t("),this.nestingSuffix=O?s(O):u||s(")"),this.nestingOptionsSeparator=d||",",this.maxReplaces=N||1e3,this.alwaysFormat=void 0!==R&&R,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,a,o,E){let n,_,r;const T=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},S=e=>{if(e.indexOf(this.formatSeparator)<0){const t=v(a,T,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(t,void 0,o,{...E,...a,interpolationkey:e}):t}const t=e.split(this.formatSeparator),i=t.shift().trim(),n=t.join(this.formatSeparator).trim();return this.format(v(a,T,i,this.options.keySeparator,this.options.ignoreJSONStructure),n,o,{...E,...a,interpolationkey:i})};this.resetRegExp();const s=E?.missingInterpolationHandler||this.options.missingInterpolationHandler,l=void 0!==E?.interpolation?.skipOnVariables?E.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>M(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?M(this.escape(e)):M(e)}].forEach(a=>{for(r=0;n=a.regex.exec(e);){const o=n[1].trim();if(_=S(o),void 0===_)if("function"==typeof s){const a=s(e,n,E);_=t(a)?a:""}else if(E&&Object.prototype.hasOwnProperty.call(E,o))_="";else{if(l){_=n[0];continue}this.logger.warn(`missed to pass in variable ${o} for interpolating ${e}`),_=""}else t(_)||this.useRawValueToEscape||(_=i(_));const T=a.safeValue(_);if(e=e.replace(n[0],T),l?(a.regex.lastIndex+=_.length,a.regex.lastIndex-=n[0].length):a.regex.lastIndex=0,r++,r>=this.maxReplaces)break}}),e}nest(e,a){let o,E,n,_=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=(e,t)=>{const a=this.nestingOptionsSeparator;if(e.indexOf(a)<0)return e;const i=e.split(new RegExp(`${a}[ ]*{`));let o=`{${i[1]}`;e=i[0],o=this.interpolate(o,n);const E=o.match(/'/g),_=o.match(/"/g);((E?.length??0)%2==0&&!_||_.length%2!=0)&&(o=o.replace(/'/g,'"'));try{n=JSON.parse(o),t&&(n={...t,...n})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${a}${o}`}return n.defaultValue&&n.defaultValue.indexOf(this.prefix)>-1&&delete n.defaultValue,e};for(;o=this.nestingRegexp.exec(e);){let T=[];n={..._},n=n.replace&&!t(n.replace)?n.replace:n,n.applyPostProcessor=!1,delete n.defaultValue;let S=!1;if(-1!==o[0].indexOf(this.formatSeparator)&&!/{.*}/.test(o[1])){const e=o[1].split(this.formatSeparator).map(e=>e.trim());o[1]=e.shift(),T=e,S=!0}if(E=a(r.call(this,o[1].trim(),n),n),E&&o[0]===e&&!t(E))return E;t(E)||(E=i(E)),E||(this.logger.warn(`missed to resolve ${o[1]} for nesting ${e}`),E=""),S&&(E=T.reduce((e,t)=>this.format(e,t,_.lng,{..._,interpolationkey:o[1].trim()}),E.trim())),e=e.replace(o[0],E),this.regexp.lastIndex=0}return e}}const U=e=>{const t={};return(a,i,o)=>{let E=o;o&&o.interpolationkey&&o.formatParams&&o.formatParams[o.interpolationkey]&&o[o.interpolationkey]&&(E={...E,[o.interpolationkey]:void 0});const n=i+JSON.stringify(E);let _=t[n];return _||(_=e(d(i),o),t[n]=_),_(a)}};class G{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=c.create("formatter"),this.options=e,this.formats={number:U((e,t)=>{const a=new Intl.NumberFormat(e,{...t});return e=>a.format(e)}),currency:U((e,t)=>{const a=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>a.format(e)}),datetime:U((e,t)=>{const a=new Intl.DateTimeFormat(e,{...t});return e=>a.format(e)}),relativetime:U((e,t)=>{const a=new Intl.RelativeTimeFormat(e,{...t});return e=>a.format(e,t.range||"day")}),list:U((e,t)=>{const a=new Intl.ListFormat(e,{...t});return e=>a.format(e)})},this.init(e)}init(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};this.formatSeparator=t.interpolation.formatSeparator||","}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=U(t)}format(e,t,a){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o=t.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&o[0].indexOf(")")<0&&o.find(e=>e.indexOf(")")>-1)){const e=o.findIndex(e=>e.indexOf(")")>-1);o[0]=[o[0],...o.splice(1,e)].join(this.formatSeparator)}return o.reduce((e,t)=>{const{formatName:o,formatOptions:E}=(e=>{let t=e.toLowerCase().trim();const a={};if(e.indexOf("(")>-1){const i=e.split("(");t=i[0].toLowerCase().trim();const o=i[1].substring(0,i[1].length-1);"currency"===t&&o.indexOf(":")<0?a.currency||(a.currency=o.trim()):"relativetime"===t&&o.indexOf(":")<0?a.range||(a.range=o.trim()):o.split(";").forEach(e=>{if(e){const[t,...i]=e.split(":"),o=i.join(":").trim().replace(/^'+|'+$/g,""),E=t.trim();a[E]||(a[E]=o),"false"===o&&(a[E]=!1),"true"===o&&(a[E]=!0),isNaN(o)||(a[E]=parseInt(o,10))}})}return{formatName:t,formatOptions:a}})(t);if(this.formats[o]){let t=e;try{const n=i?.formatParams?.[i.interpolationkey]||{},_=n.locale||n.lng||i.locale||i.lng||a;t=this.formats[o](e,_,{...E,...i,...n})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${o}`),e},e)}}class y extends m{constructor(e,t,a){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};super(),this.backend=e,this.store=t,this.services=a,this.languageUtils=a.languageUtils,this.options=i,this.logger=c.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(a,i.backend,i)}queueLoad(e,t,a,i){const o={},E={},n={},_={};return e.forEach(e=>{let i=!0;t.forEach(t=>{const n=`${e}|${t}`;!a.reload&&this.store.hasResourceBundle(e,t)?this.state[n]=2:this.state[n]<0||(1===this.state[n]?void 0===E[n]&&(E[n]=!0):(this.state[n]=1,i=!1,void 0===E[n]&&(E[n]=!0),void 0===o[n]&&(o[n]=!0),void 0===_[t]&&(_[t]=!0)))}),i||(n[e]=!0)}),(Object.keys(o).length||Object.keys(E).length)&&this.queue.push({pending:E,pendingCount:Object.keys(E).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(o),pending:Object.keys(E),toLoadLanguages:Object.keys(n),toLoadNamespaces:Object.keys(_)}}loaded(e,t,a){const i=e.split("|"),o=i[0],E=i[1];t&&this.emit("failedLoading",o,E,t),!t&&a&&this.store.addResourceBundle(o,E,a,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&a&&(this.state[e]=0);const n={};this.queue.forEach(a=>{((e,t,a)=>{const{obj:i,k:o}=_(e,t,Object);i[o]=i[o]||[],i[o].push(a)})(a.loaded,[o],E),((e,t)=>{void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)})(a,e),t&&a.errors.push(t),0!==a.pendingCount||a.done||(Object.keys(a.loaded).forEach(e=>{n[e]||(n[e]={});const t=a.loaded[e];t.length&&t.forEach(t=>{void 0===n[e][t]&&(n[e][t]=!0)})}),a.done=!0,a.errors.length?a.callback(a.errors):a.callback())}),this.emit("loaded",n),this.queue=this.queue.filter(e=>!e.done)}read(e,t,a){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,E=arguments.length>5?arguments[5]:void 0;if(!e.length)return E(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:t,fcName:a,tried:i,wait:o,callback:E});this.readingCalls++;const n=(n,_)=>{if(this.readingCalls--,this.waitingReads.length>0){const e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}n&&_&&i{this.read.call(this,e,t,a,i+1,2*o,E)},o):E(n,_)},_=this.backend[a].bind(this.backend);if(2!==_.length)return _(e,t,n);try{const a=_(e,t);a&&"function"==typeof a.then?a.then(e=>n(null,e)).catch(n):n(null,a)}catch(e){n(e)}}prepareLoading(e,a){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),o&&o();t(e)&&(e=this.languageUtils.toResolveHierarchy(e)),t(a)&&(a=[a]);const E=this.queueLoad(e,a,i,o);if(!E.toLoad.length)return E.pending.length||o(),null;E.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,a){this.prepareLoading(e,t,{},a)}reload(e,t,a){this.prepareLoading(e,t,{reload:!0},a)}loadOne(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const a=e.split("|"),i=a[0],o=a[1];this.read(i,o,"read",void 0,void 0,(a,E)=>{a&&this.logger.warn(`${t}loading namespace ${o} for language ${i} failed`,a),!a&&E&&this.logger.log(`${t}loaded namespace ${o} for language ${i}`,E),this.loaded(e,a,E)})}saveMissing(e,t,a,i,o){let E=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},n=arguments.length>6&&void 0!==arguments[6]?arguments[6]:()=>{};if(!this.services?.utils?.hasLoadedNamespace||this.services?.utils?.hasLoadedNamespace(t)){if(null!=a&&""!==a){if(this.backend?.create){const _={...E,isUpdate:o},r=this.backend.create.bind(this.backend);if(r.length<6)try{let o;o=5===r.length?r(e,t,a,i,_):r(e,t,a,i),o&&"function"==typeof o.then?o.then(e=>n(null,e)).catch(n):n(null,o)}catch(e){n(e)}else r(e,t,a,i,n,_)}e&&e[0]&&this.store.addResource(e[0],t,a,i)}}else this.logger.warn(`did not save key "${a}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")}}const b=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let a={};if("object"==typeof e[1]&&(a=e[1]),t(e[1])&&(a.defaultValue=e[1]),t(e[2])&&(a.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){const t=e[3]||e[2];Object.keys(t).forEach(e=>{a[e]=t[e]})}return a},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),k=e=>(t(e.ns)&&(e.ns=[e.ns]),t(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),t(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),"boolean"==typeof e.initImmediate&&(e.initAsync=e.initImmediate),e),F=()=>{};class V extends m{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;var a;if(super(),this.options=k(e),this.services={},this.logger=c,this.modules={external:[]},a=this,Object.getOwnPropertyNames(Object.getPrototypeOf(a)).forEach(e=>{"function"==typeof a[e]&&(a[e]=a[e].bind(a))}),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(){var e=this;let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,"function"==typeof i&&(o=i,i={}),null==i.defaultNS&&i.ns&&(t(i.ns)?i.defaultNS=i.ns:i.ns.indexOf("translation")<0&&(i.defaultNS=i.ns[0]));const E=b();this.options={...E,...this.options,...k(i)},this.options.interpolation={...E.interpolation,...this.options.interpolation},void 0!==i.keySeparator&&(this.options.userDefinedKeySeparator=i.keySeparator),void 0!==i.nsSeparator&&(this.options.userDefinedNsSeparator=i.nsSeparator);const n=e=>e?"function"==typeof e?new e:e:null;if(!this.options.isClone){let t;this.modules.logger?c.init(n(this.modules.logger),this.options):c.init(null,this.options),t=this.modules.formatter?this.modules.formatter:G;const a=new P(this.options);this.store=new L(this.options.resources,this.options);const i=this.services;i.logger=c,i.resourceStore=this.store,i.languageUtils=a,i.pluralResolver=new g(a,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!t||this.options.interpolation.format&&this.options.interpolation.format!==E.interpolation.format||(i.formatter=n(t),i.formatter.init(i,this.options),this.options.interpolation.format=i.formatter.format.bind(i.formatter)),i.interpolator=new W(this.options),i.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},i.backendConnector=new y(n(this.modules.backend),i.resourceStore,i,this.options),i.backendConnector.on("*",function(t){for(var a=arguments.length,i=new Array(a>1?a-1:0),o=1;o1?a-1:0),o=1;o{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,o||(o=F),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&"dev"!==e[0]&&(this.options.lng=e[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(t=>{this[t]=function(){return e.store[t](...arguments)}});["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(t=>{this[t]=function(){return e.store[t](...arguments),e}});const _=a(),r=()=>{const e=(e,t)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),_.resolve(t),o(e,t)};if(this.languages&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?r():setTimeout(r,0),_}loadResources(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:F;const i=t(e)?e:this.language;if("function"==typeof e&&(a=e),!this.options.resources||this.options.partialBundledLanguages){if("cimode"===i?.toLowerCase()&&(!this.options.preload||0===this.options.preload.length))return a();const e=[],t=t=>{if(!t)return;if("cimode"===t)return;this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{"cimode"!==t&&e.indexOf(t)<0&&e.push(t)})};if(i)t(i);else{this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e))}this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{e||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),a(e)})}else a(null)}reloadResources(e,t,i){const o=a();return"function"==typeof e&&(i=e,e=void 0),"function"==typeof t&&(i=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),i||(i=F),this.services.backendConnector.reload(e,t,e=>{o.resolve(),i(e)}),o}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&D.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(let e=0;e-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}}changeLanguage(e,i){var o=this;this.isLanguageChangingTo=e;const E=a();this.emit("languageChanging",e);const n=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},_=(e,t)=>{t?(n(t),this.translator.changeLanguage(t),this.isLanguageChangingTo=void 0,this.emit("languageChanged",t),this.logger.log("languageChanged",t)):this.isLanguageChangingTo=void 0,E.resolve(function(){return o.t(...arguments)}),i&&i(e,function(){return o.t(...arguments)})},r=a=>{e||a||!this.services.languageDetector||(a=[]);const i=t(a)?a:this.services.languageUtils.getBestMatchFromCodes(a);i&&(this.language||n(i),this.translator.language||this.translator.changeLanguage(i),this.services.languageDetector?.cacheUserLanguage?.(i)),this.loadResources(i,e=>{_(e,i)})};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(r):this.services.languageDetector.detect(r):r(e):r(this.services.languageDetector.detect()),E}getFixedT(e,a,i){var o=this;const E=function(e,t){let a;if("object"!=typeof t){for(var n=arguments.length,_=new Array(n>2?n-2:0),r=2;r`${a.keyPrefix}${T}${e}`):a.keyPrefix?`${a.keyPrefix}${T}${e}`:e,o.t(S,a)};return t(e)?E.lng=e:E.lngs=e,E.ns=a,E.keyPrefix=i,E}t(){for(var e=arguments.length,t=new Array(e),a=0;a1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const a=t.lng||this.resolvedLanguage||this.languages[0],i=!!this.options&&this.options.fallbackLng,o=this.languages[this.languages.length-1];if("cimode"===a.toLowerCase())return!0;const E=(e,t)=>{const a=this.services.backendConnector.state[`${e}|${t}`];return-1===a||0===a||2===a};if(t.precheck){const e=t.precheck(this,E);if(void 0!==e)return e}return!!this.hasResourceBundle(a,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!E(a,e)||i&&!E(o,e)))}loadNamespaces(e,i){const o=a();return this.options.ns?(t(e)&&(e=[e]),e.forEach(e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}),this.loadResources(e=>{o.resolve(),i&&i(e)}),o):(i&&i(),Promise.resolve())}loadLanguages(e,i){const o=a();t(e)&&(e=[e]);const E=this.options.preload||[],n=e.filter(e=>E.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e));return n.length?(this.options.preload=E.concat(n),this.loadResources(e=>{o.resolve(),i&&i(e)}),o):(i&&i(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";const t=this.services?.languageUtils||new P(b());return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){return new V(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}cloneInstance(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:F;const a=e.forkResourceStore;a&&delete e.forkResourceStore;const i={...this.options,...e,isClone:!0},o=new V(i);void 0===e.debug&&void 0===e.prefix||(o.logger=o.logger.clone(e));if(["store","services","language"].forEach(e=>{o[e]=this[e]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},a){const e=Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},Object.keys(e[t]).reduce((a,i)=>(a[i]={...e[t][i]},a),{})),{});o.store=new L(e,i),o.services.resourceStore=o.store}return o.translator=new h(o.services,i),o.translator.on("*",function(e){for(var t=arguments.length,a=new Array(t>1?t-1:0),i=1;i{t.read=function(e,t,a,i,o){var E,n,_=8*o-i-1,r=(1<<_)-1,T=r>>1,S=-7,s=a?o-1:0,l=a?-1:1,I=e[t+s];for(s+=l,E=I&(1<<-S)-1,I>>=-S,S+=_;S>0;E=256*E+e[t+s],s+=l,S-=8);for(n=E&(1<<-S)-1,E>>=-S,S+=i;S>0;n=256*n+e[t+s],s+=l,S-=8);if(0===E)E=1-T;else{if(E===r)return n?NaN:1/0*(I?-1:1);n+=Math.pow(2,i),E-=T}return(I?-1:1)*n*Math.pow(2,E-i)},t.write=function(e,t,a,i,o,E){var n,_,r,T=8*E-o-1,S=(1<>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,I=i?0:E-1,A=i?1:-1,O=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(_=isNaN(t)?1:0,n=S):(n=Math.floor(Math.log(t)/Math.LN2),t*(r=Math.pow(2,-n))<1&&(n--,r*=2),(t+=n+s>=1?l/r:l*Math.pow(2,1-s))*r>=2&&(n++,r/=2),n+s>=S?(_=0,n=S):n+s>=1?(_=(t*r-1)*Math.pow(2,o),n+=s):(_=t*Math.pow(2,s-1)*Math.pow(2,o),n=0));o>=8;e[a+I]=255&_,I+=A,_/=256,o-=8);for(n=n<0;e[a+I]=255&n,I+=A,n/=256,T-=8);e[a+I-A]|=128*O}},12094:e=>{e.exports=function(e){return!(!e||"string"==typeof e)&&(e instanceof Array||Array.isArray(e)||e.length>=0&&(e.splice instanceof Function||Object.getOwnPropertyDescriptor(e,e.length-1)&&"String"!==e.constructor.name))}},67677:e=>{e.exports=[{name:"Abkhaz",local:"Аҧсуа",1:"ab",2:"abk","2T":"abk","2B":"abk",3:"abk"},{name:"Afar",local:"Afaraf",1:"aa",2:"aar","2T":"aar","2B":"aar",3:"aar"},{name:"Afrikaans",local:"Afrikaans",1:"af",2:"afr","2T":"afr","2B":"afr",3:"afr"},{name:"Akan",local:"Akan",1:"ak",2:"aka","2T":"aka","2B":"aka",3:"aka"},{name:"Albanian",local:"Shqip",1:"sq",2:"sqi","2T":"sqi","2B":"alb",3:"sqi"},{name:"Amharic",local:"አማርኛ",1:"am",2:"amh","2T":"amh","2B":"amh",3:"amh"},{name:"Arabic",local:"العربية",1:"ar",2:"ara","2T":"ara","2B":"ara",3:"ara"},{name:"Aragonese",local:"Aragonés",1:"an",2:"arg","2T":"arg","2B":"arg",3:"arg"},{name:"Armenian",local:"Հայերեն",1:"hy",2:"hye","2T":"hye","2B":"arm",3:"hye"},{name:"Assamese",local:"অসমীয়া",1:"as",2:"asm","2T":"asm","2B":"asm",3:"asm"},{name:"Avaric",local:"Авар",1:"av",2:"ava","2T":"ava","2B":"ava",3:"ava"},{name:"Avestan",local:"avesta",1:"ae",2:"ave","2T":"ave","2B":"ave",3:"ave"},{name:"Aymara",local:"Aymar",1:"ay",2:"aym","2T":"aym","2B":"aym",3:"aym"},{name:"Azerbaijani",local:"Azərbaycanca",1:"az",2:"aze","2T":"aze","2B":"aze",3:"aze"},{name:"Bambara",local:"Bamanankan",1:"bm",2:"bam","2T":"bam","2B":"bam",3:"bam"},{name:"Bashkir",local:"Башҡортса",1:"ba",2:"bak","2T":"bak","2B":"bak",3:"bak"},{name:"Basque",local:"Euskara",1:"eu",2:"eus","2T":"eus","2B":"baq",3:"eus"},{name:"Belarusian",local:"Беларуская",1:"be",2:"bel","2T":"bel","2B":"bel",3:"bel"},{name:"Bengali",local:"বাংলা",1:"bn",2:"ben","2T":"ben","2B":"ben",3:"ben",locale:"bn-BD"},{name:"Bihari",local:"भोजपुरी",1:"bh",2:"bih","2T":"bih","2B":"bih",3:"bih"},{name:"Bislama",local:"Bislama",1:"bi",2:"bis","2T":"bis","2B":"bis",3:"bis"},{name:"Bosnian",local:"Bosanski",1:"bs",2:"bos","2T":"bos","2B":"bos",3:"bos"},{name:"Breton",local:"Brezhoneg",1:"br",2:"bre","2T":"bre","2B":"bre",3:"bre"},{name:"Bulgarian",local:"Български",1:"bg",2:"bul","2T":"bul","2B":"bul",3:"bul"},{name:"Burmese",local:"မြန်မာဘာသာ",1:"my",2:"mya","2T":"mya","2B":"bur",3:"mya"},{name:"Catalan",local:"Català",1:"ca",2:"cat","2T":"cat","2B":"cat",3:"cat"},{name:"Chamorro",local:"Chamoru",1:"ch",2:"cha","2T":"cha","2B":"cha",3:"cha"},{name:"Chechen",local:"Нохчийн",1:"ce",2:"che","2T":"che","2B":"che",3:"che"},{name:"Chichewa",local:"Chichewa",1:"ny",2:"nya","2T":"nya","2B":"nya",3:"nya"},{name:"Chinese",local:"中文",1:"zh",2:"zho","2T":"zho","2B":"chi",3:"zho",locale:"zh-CN"},{name:"Chinese (Simplified)",local:"中文(簡體)",1:"zh",2:"zhe","2T":"zhe","2B":"chi",3:"zhe",locale:"zh-Hans"},{name:"Chinese (Traditional)",local:"中文(繁體)",1:"zh",2:"zht","2T":"zht","2B":"chi",3:"zht",locale:"zh-Hant"},{name:"Chuvash",local:"Чӑвашла",1:"cv",2:"chv","2T":"chv","2B":"chv",3:"chv"},{name:"Cornish",local:"Kernewek",1:"kw",2:"cor","2T":"cor","2B":"cor",3:"cor"},{name:"Corsican",local:"Corsu",1:"co",2:"cos","2T":"cos","2B":"cos",3:"cos"},{name:"Cree",local:"ᓀᐦᐃᔭᐍᐏᐣ",1:"cr",2:"cre","2T":"cre","2B":"cre",3:"cre"},{name:"Croatian",local:"Hrvatski",1:"hr",2:"hrv","2T":"hrv","2B":"hrv",3:"hrv"},{name:"Czech",local:"Čeština",1:"cs",2:"ces","2T":"ces","2B":"cze",3:"ces"},{name:"Danish",local:"Dansk",1:"da",2:"dan","2T":"dan","2B":"dan",3:"dan"},{name:"Divehi",local:"Divehi",1:"dv",2:"div","2T":"div","2B":"div",3:"div"},{name:"Dutch",local:"Nederlands",1:"nl",2:"nld","2T":"nld","2B":"dut",3:"nld"},{name:"Dzongkha",local:"རྫོང་ཁ",1:"dz",2:"dzo","2T":"dzo","2B":"dzo",3:"dzo"},{name:"English",local:"English",1:"en",2:"eng","2T":"eng","2B":"eng",3:"eng",locale:"en-US"},{name:"Esperanto",local:"Esperanto",1:"eo",2:"epo","2T":"epo","2B":"epo",3:"epo"},{name:"Estonian",local:"Eesti",1:"et",2:"est","2T":"est","2B":"est",3:"est",locale:"et-EE"},{name:"Ewe",local:"Eʋegbe",1:"ee",2:"ewe","2T":"ewe","2B":"ewe",3:"ewe"},{name:"Faroese",local:"Føroyskt",1:"fo",2:"fao","2T":"fao","2B":"fao",3:"fao"},{name:"Fijian",local:"Na Vosa Vaka-Viti",1:"fj",2:"fij","2T":"fij","2B":"fij",3:"fij"},{name:"Finnish",local:"Suomi",1:"fi",2:"fin","2T":"fin","2B":"fin",3:"fin"},{name:"French",local:"Français",1:"fr",2:"fra","2T":"fra","2B":"fre",3:"fra",locale:"fr-FR"},{name:"Fula",local:"Fulfulde",1:"ff",2:"ful","2T":"ful","2B":"ful",3:"ful"},{name:"Galician",local:"Galego",1:"gl",2:"glg","2T":"glg","2B":"glg",3:"glg"},{name:"Georgian",local:"ქართული",1:"ka",2:"kat","2T":"kat","2B":"geo",3:"kat"},{name:"German",local:"Deutsch",1:"de",2:"deu","2T":"deu","2B":"ger",3:"deu"},{name:"Greek",local:"Ελληνικά",1:"el",2:"ell","2T":"ell","2B":"gre",3:"ell"},{name:"Guaraní",local:"Avañe'ẽ",1:"gn",2:"grn","2T":"grn","2B":"grn",3:"grn"},{name:"Gujarati",local:"ગુજરાતી",1:"gu",2:"guj","2T":"guj","2B":"guj",3:"guj"},{name:"Haitian",local:"Kreyòl Ayisyen",1:"ht",2:"hat","2T":"hat","2B":"hat",3:"hat"},{name:"Hausa",local:"هَوُسَ",1:"ha",2:"hau","2T":"hau","2B":"hau",3:"hau"},{name:"Hebrew",local:"עברית",1:"he",2:"heb","2T":"heb","2B":"heb",3:"heb"},{name:"Herero",local:"Otjiherero",1:"hz",2:"her","2T":"her","2B":"her",3:"her"},{name:"Hindi",local:"हिन्दी",1:"hi",2:"hin","2T":"hin","2B":"hin",3:"hin"},{name:"Hiri Motu",local:"Hiri Motu",1:"ho",2:"hmo","2T":"hmo","2B":"hmo",3:"hmo"},{name:"Hungarian",local:"Magyar",1:"hu",2:"hun","2T":"hun","2B":"hun",3:"hun"},{name:"Interlingua",local:"Interlingua",1:"ia",2:"ina","2T":"ina","2B":"ina",3:"ina"},{name:"Indonesian",local:"Bahasa Indonesia",1:"id",2:"ind","2T":"ind","2B":"ind",3:"ind"},{name:"Interlingue",local:"Interlingue",1:"ie",2:"ile","2T":"ile","2B":"ile",3:"ile"},{name:"Irish",local:"Gaeilge",1:"ga",2:"gle","2T":"gle","2B":"gle",3:"gle"},{name:"Igbo",local:"Igbo",1:"ig",2:"ibo","2T":"ibo","2B":"ibo",3:"ibo"},{name:"Inupiaq",local:"Iñupiak",1:"ik",2:"ipk","2T":"ipk","2B":"ipk",3:"ipk"},{name:"Ido",local:"Ido",1:"io",2:"ido","2T":"ido","2B":"ido",3:"ido"},{name:"Icelandic",local:"Íslenska",1:"is",2:"isl","2T":"isl","2B":"ice",3:"isl"},{name:"Italian",local:"Italiano",1:"it",2:"ita","2T":"ita","2B":"ita",3:"ita",locale:"it-IT"},{name:"Inuktitut",local:"ᐃᓄᒃᑎᑐᑦ",1:"iu",2:"iku","2T":"iku","2B":"iku",3:"iku"},{name:"Japanese",local:"日本語",1:"ja",2:"jpn","2T":"jpn","2B":"jpn",3:"jpn",locale:"ja-JP"},{name:"Javanese",local:"Basa Jawa",1:"jv",2:"jav","2T":"jav","2B":"jav",3:"jav"},{name:"Kalaallisut",local:"Kalaallisut",1:"kl",2:"kal","2T":"kal","2B":"kal",3:"kal"},{name:"Kannada",local:"ಕನ್ನಡ",1:"kn",2:"kan","2T":"kan","2B":"kan",3:"kan"},{name:"Kanuri",local:"Kanuri",1:"kr",2:"kau","2T":"kau","2B":"kau",3:"kau"},{name:"Kashmiri",local:"كشميري",1:"ks",2:"kas","2T":"kas","2B":"kas",3:"kas"},{name:"Kazakh",local:"Қазақша",1:"kk",2:"kaz","2T":"kaz","2B":"kaz",3:"kaz"},{name:"Khmer",local:"ភាសាខ្មែរ",1:"km",2:"khm","2T":"khm","2B":"khm",3:"khm"},{name:"Kikuyu",local:"Gĩkũyũ",1:"ki",2:"kik","2T":"kik","2B":"kik",3:"kik"},{name:"Kinyarwanda",local:"Kinyarwanda",1:"rw",2:"kin","2T":"kin","2B":"kin",3:"kin"},{name:"Kyrgyz",local:"Кыргызча",1:"ky",2:"kir","2T":"kir","2B":"kir",3:"kir"},{name:"Komi",local:"Коми",1:"kv",2:"kom","2T":"kom","2B":"kom",3:"kom"},{name:"Kongo",local:"Kongo",1:"kg",2:"kon","2T":"kon","2B":"kon",3:"kon"},{name:"Korean",local:"한국어",1:"ko",2:"kor","2T":"kor","2B":"kor",3:"kor"},{name:"Kurdish",local:"Kurdî",1:"ku",2:"kur","2T":"kur","2B":"kur",3:"kur"},{name:"Kwanyama",local:"Kuanyama",1:"kj",2:"kua","2T":"kua","2B":"kua",3:"kua"},{name:"Latin",local:"Latina",1:"la",2:"lat","2T":"lat","2B":"lat",3:"lat"},{name:"Luxembourgish",local:"Lëtzebuergesch",1:"lb",2:"ltz","2T":"ltz","2B":"ltz",3:"ltz"},{name:"Ganda",local:"Luganda",1:"lg",2:"lug","2T":"lug","2B":"lug",3:"lug"},{name:"Limburgish",local:"Limburgs",1:"li",2:"lim","2T":"lim","2B":"lim",3:"lim"},{name:"Lingala",local:"Lingála",1:"ln",2:"lin","2T":"lin","2B":"lin",3:"lin"},{name:"Lao",local:"ພາສາລາວ",1:"lo",2:"lao","2T":"lao","2B":"lao",3:"lao"},{name:"Lithuanian",local:"Lietuvių",1:"lt",2:"lit","2T":"lit","2B":"lit",3:"lit"},{name:"Luba-Katanga",local:"Tshiluba",1:"lu",2:"lub","2T":"lub","2B":"lub",3:"lub"},{name:"Latvian",local:"Latviešu",1:"lv",2:"lav","2T":"lav","2B":"lav",3:"lav"},{name:"Manx",local:"Gaelg",1:"gv",2:"glv","2T":"glv","2B":"glv",3:"glv"},{name:"Macedonian",local:"Македонски",1:"mk",2:"mkd","2T":"mkd","2B":"mac",3:"mkd"},{name:"Malagasy",local:"Malagasy",1:"mg",2:"mlg","2T":"mlg","2B":"mlg",3:"mlg"},{name:"Malay",local:"Bahasa Melayu",1:"ms",2:"msa","2T":"msa","2B":"may",3:"msa"},{name:"Malayalam",local:"മലയാളം",1:"ml",2:"mal","2T":"mal","2B":"mal",3:"mal"},{name:"Maltese",local:"Malti",1:"mt",2:"mlt","2T":"mlt","2B":"mlt",3:"mlt"},{name:"Māori",local:"Māori",1:"mi",2:"mri","2T":"mri","2B":"mao",3:"mri"},{name:"Marathi",local:"मराठी",1:"mr",2:"mar","2T":"mar","2B":"mar",3:"mar"},{name:"Marshallese",local:"Kajin M̧ajeļ",1:"mh",2:"mah","2T":"mah","2B":"mah",3:"mah"},{name:"Mongolian",local:"Монгол",1:"mn",2:"mon","2T":"mon","2B":"mon",3:"mon"},{name:"Nauru",local:"Dorerin Naoero",1:"na",2:"nau","2T":"nau","2B":"nau",3:"nau"},{name:"Navajo",local:"Diné Bizaad",1:"nv",2:"nav","2T":"nav","2B":"nav",3:"nav"},{name:"Northern Ndebele",local:"isiNdebele",1:"nd",2:"nde","2T":"nde","2B":"nde",3:"nde"},{name:"Nepali",local:"नेपाली",1:"ne",2:"nep","2T":"nep","2B":"nep",3:"nep"},{name:"Ndonga",local:"Owambo",1:"ng",2:"ndo","2T":"ndo","2B":"ndo",3:"ndo"},{name:"Norwegian Bokmål",local:"Norsk (Bokmål)",1:"nb",2:"nob","2T":"nob","2B":"nob",3:"nob",locale:"nb-NO"},{name:"Norwegian Nynorsk",local:"Norsk (Nynorsk)",1:"nn",2:"nno","2T":"nno","2B":"nno",3:"nno",locale:"nn-NO"},{name:"Norwegian",local:"Norsk",1:"no",2:"nor","2T":"nor","2B":"nor",3:"nor",locale:"no-NO"},{name:"Nuosu",local:"ꆈꌠ꒿ Nuosuhxop",1:"ii",2:"iii","2T":"iii","2B":"iii",3:"iii"},{name:"Southern Ndebele",local:"isiNdebele",1:"nr",2:"nbl","2T":"nbl","2B":"nbl",3:"nbl"},{name:"Occitan",local:"Occitan",1:"oc",2:"oci","2T":"oci","2B":"oci",3:"oci"},{name:"Ojibwe",local:"ᐊᓂᔑᓈᐯᒧᐎᓐ",1:"oj",2:"oji","2T":"oji","2B":"oji",3:"oji"},{name:"Old Church Slavonic",local:"Словѣ́ньскъ",1:"cu",2:"chu","2T":"chu","2B":"chu",3:"chu"},{name:"Oromo",local:"Afaan Oromoo",1:"om",2:"orm","2T":"orm","2B":"orm",3:"orm"},{name:"Oriya",local:"ଓଡି଼ଆ",1:"or",2:"ori","2T":"ori","2B":"ori",3:"ori"},{name:"Ossetian",local:"Ирон æвзаг",1:"os",2:"oss","2T":"oss","2B":"oss",3:"oss"},{name:"Panjabi",local:"ਪੰਜਾਬੀ",1:"pa",2:"pan","2T":"pan","2B":"pan",3:"pan",locale:"pa-IN"},{name:"Pāli",local:"पाऴि",1:"pi",2:"pli","2T":"pli","2B":"pli",3:"pli"},{name:"Persian",local:"فارسی",1:"fa",2:"fas","2T":"fas","2B":"per",3:"fas"},{name:"Polish",local:"Polski",1:"pl",2:"pol","2T":"pol","2B":"pol",3:"pol"},{name:"Pashto",local:"پښتو",1:"ps",2:"pus","2T":"pus","2B":"pus",3:"pus"},{name:"Portuguese",local:"Português",1:"pt",2:"por","2T":"por","2B":"por",3:"por",locale:"pt-PT"},{name:"Portuguese (Brazil)",local:"Português (Brasil)",1:"pb",2:"pob","2T":"pob","2B":"pob",3:"pob",locale:"pt-BR"},{name:"Quechua",local:"Runa Simi",1:"qu",2:"que","2T":"que","2B":"que",3:"que"},{name:"Romansh",local:"Rumantsch",1:"rm",2:"roh","2T":"roh","2B":"roh",3:"roh"},{name:"Kirundi",local:"Kirundi",1:"rn",2:"run","2T":"run","2B":"run",3:"run"},{name:"Romanian",local:"Română",1:"ro",2:"ron","2T":"ron","2B":"rum",3:"ron"},{name:"Russian",local:"Русский",1:"ru",2:"rus","2T":"rus","2B":"rus",3:"rus"},{name:"Sanskrit",local:"संस्कृतम्",1:"sa",2:"san","2T":"san","2B":"san",3:"san"},{name:"Sardinian",local:"Sardu",1:"sc",2:"srd","2T":"srd","2B":"srd",3:"srd"},{name:"Sindhi",local:"سنڌي‎",1:"sd",2:"snd","2T":"snd","2B":"snd",3:"snd"},{name:"Northern Sami",local:"Sámegiella",1:"se",2:"sme","2T":"sme","2B":"sme",3:"sme"},{name:"Samoan",local:"Gagana Sāmoa",1:"sm",2:"smo","2T":"smo","2B":"smo",3:"smo"},{name:"Sango",local:"Sängö",1:"sg",2:"sag","2T":"sag","2B":"sag",3:"sag"},{name:"Serbian",local:"Српски",1:"sr",2:"srp","2T":"srp","2B":"srp",3:"srp"},{name:"Gaelic",local:"Gàidhlig",1:"gd",2:"gla","2T":"gla","2B":"gla",3:"gla"},{name:"Shona",local:"ChiShona",1:"sn",2:"sna","2T":"sna","2B":"sna",3:"sna"},{name:"Sinhala",local:"සිංහල",1:"si",2:"sin","2T":"sin","2B":"sin",3:"sin"},{name:"Slovak",local:"Slovenčina",1:"sk",2:"slk","2T":"slk","2B":"slo",3:"slk"},{name:"Slovene",local:"Slovenščina",1:"sl",2:"slv","2T":"slv","2B":"slv",3:"slv"},{name:"Somali",local:"Soomaaliga",1:"so",2:"som","2T":"som","2B":"som",3:"som"},{name:"Southern Sotho",local:"Sesotho",1:"st",2:"sot","2T":"sot","2B":"sot",3:"sot"},{name:"Spanish",local:"Español",1:"es",2:"spa","2T":"spa","2B":"spa",3:"spa",locale:"es-ES"},{name:"Spanish (Latin America)",local:"Español (América Latina)",1:"es",2:"spl","2T":"spl","2B":"spl",3:"spl",locale:"es-419"},{name:"Sundanese",local:"Basa Sunda",1:"su",2:"sun","2T":"sun","2B":"sun",3:"sun"},{name:"Swahili",local:"Kiswahili",1:"sw",2:"swa","2T":"swa","2B":"swa",3:"swa"},{name:"Swati",local:"SiSwati",1:"ss",2:"ssw","2T":"ssw","2B":"ssw",3:"ssw"},{name:"Swedish",local:"Svenska",1:"sv",2:"swe","2T":"swe","2B":"swe",3:"swe"},{name:"Tamil",local:"தமிழ்",1:"ta",2:"tam","2T":"tam","2B":"tam",3:"tam"},{name:"Telugu",local:"తెలుగు",1:"te",2:"tel","2T":"tel","2B":"tel",3:"tel"},{name:"Tajik",local:"Тоҷикӣ",1:"tg",2:"tgk","2T":"tgk","2B":"tgk",3:"tgk"},{name:"Thai",local:"ภาษาไทย",1:"th",2:"tha","2T":"tha","2B":"tha",3:"tha"},{name:"Tigrinya",local:"ትግርኛ",1:"ti",2:"tir","2T":"tir","2B":"tir",3:"tir"},{name:"Tibetan Standard",local:"བོད་ཡིག",1:"bo",2:"bod","2T":"bod","2B":"tib",3:"bod"},{name:"Turkmen",local:"Türkmençe",1:"tk",2:"tuk","2T":"tuk","2B":"tuk",3:"tuk"},{name:"Tagalog",local:"Tagalog",1:"tl",2:"tgl","2T":"tgl","2B":"tgl",3:"tgl"},{name:"Tswana",local:"Setswana",1:"tn",2:"tsn","2T":"tsn","2B":"tsn",3:"tsn"},{name:"Tonga",local:"faka Tonga",1:"to",2:"ton","2T":"ton","2B":"ton",3:"ton"},{name:"Turkish",local:"Türkçe",1:"tr",2:"tur","2T":"tur","2B":"tur",3:"tur"},{name:"Tsonga",local:"Xitsonga",1:"ts",2:"tso","2T":"tso","2B":"tso",3:"tso"},{name:"Tatar",local:"Татарча",1:"tt",2:"tat","2T":"tat","2B":"tat",3:"tat"},{name:"Twi",local:"Twi",1:"tw",2:"twi","2T":"twi","2B":"twi",3:"twi"},{name:"Tahitian",local:"Reo Mā’ohi",1:"ty",2:"tah","2T":"tah","2B":"tah",3:"tah"},{name:"Uyghur",local:"ئۇيغۇرچه",1:"ug",2:"uig","2T":"uig","2B":"uig",3:"uig"},{name:"Ukrainian",local:"Українська",1:"uk",2:"ukr","2T":"ukr","2B":"ukr",3:"ukr"},{name:"Urdu",local:"اردو",1:"ur",2:"urd","2T":"urd","2B":"urd",3:"urd"},{name:"Uzbek",local:"O‘zbek",1:"uz",2:"uzb","2T":"uzb","2B":"uzb",3:"uzb"},{name:"Venda",local:"Tshivenḓa",1:"ve",2:"ven","2T":"ven","2B":"ven",3:"ven"},{name:"Vietnamese",local:"Tiếng Việt",1:"vi",2:"vie","2T":"vie","2B":"vie",3:"vie"},{name:"Volapük",local:"Volapük",1:"vo",2:"vol","2T":"vol","2B":"vol",3:"vol"},{name:"Walloon",local:"Walon",1:"wa",2:"wln","2T":"wln","2B":"wln",3:"wln"},{name:"Welsh",local:"Cymraeg",1:"cy",2:"cym","2T":"cym","2B":"wel",3:"cym"},{name:"Wolof",local:"Wolof",1:"wo",2:"wol","2T":"wol","2B":"wol",3:"wol"},{name:"Western Frisian",local:"Frysk",1:"fy",2:"fry","2T":"fry","2B":"fry",3:"fry"},{name:"Xhosa",local:"isiXhosa",1:"xh",2:"xho","2T":"xho","2B":"xho",3:"xho"},{name:"Yiddish",local:"ייִדיש",1:"yi",2:"yid","2T":"yid","2B":"yid",3:"yid"},{name:"Yoruba",local:"Yorùbá",1:"yo",2:"yor","2T":"yor","2B":"yor",3:"yor"},{name:"Zhuang",local:"Cuengh",1:"za",2:"zha","2T":"zha","2B":"zha",3:"zha"},{name:"Zulu",local:"isiZulu",1:"zu",2:"zul","2T":"zul","2B":"zul",3:"zul"}]},68601:(e,t,a)=>{var i=a(67677),o={all:function(){return i},has:function(e,t){return void 0!==E(e,t)},codes:function(e){if((function(e){return-1!==[1,2,3,"1","2","2B","2T","3"].indexOf(e)})(e))return n(i,function(t){return t[e]})},names:function(e){return n(i,function(t){return e?t.local:t.name})},where:E};function E(e,t){for(var a=0;a{e=a.nmd(e);var i="__lodash_hash_undefined__",o=9007199254740991,E="[object Arguments]",n="[object Boolean]",_="[object Date]",r="[object Function]",T="[object GeneratorFunction]",S="[object Map]",s="[object Number]",l="[object Object]",I="[object Promise]",A="[object RegExp]",O="[object Set]",u="[object String]",d="[object Symbol]",N="[object WeakMap]",R="[object ArrayBuffer]",c="[object DataView]",m="[object Float32Array]",L="[object Float64Array]",D="[object Int8Array]",C="[object Int16Array]",p="[object Int32Array]",h="[object Uint8Array]",P="[object Uint8ClampedArray]",B="[object Uint16Array]",f="[object Uint32Array]",g=/\w*$/,v=/^\[object .+?Constructor\]$/,M=/^(?:0|[1-9]\d*)$/,W={};W[E]=W["[object Array]"]=W[R]=W[c]=W[n]=W[_]=W[m]=W[L]=W[D]=W[C]=W[p]=W[S]=W[s]=W[l]=W[A]=W[O]=W[u]=W[d]=W[h]=W[P]=W[B]=W[f]=!0,W["[object Error]"]=W[r]=W[N]=!1;var U="object"==typeof a.g&&a.g&&a.g.Object===Object&&a.g,G="object"==typeof self&&self&&self.Object===Object&&self,y=U||G||Function("return this")(),b=t&&!t.nodeType&&t,k=b&&e&&!e.nodeType&&e,F=k&&k.exports===b;function V(e,t){return e.set(t[0],t[1]),e}function H(e,t){return e.add(t),e}function Y(e,t,a,i){var o=-1,E=e?e.length:0;for(i&&E&&(a=e[++o]);++o-1},Pe.prototype.set=function(e,t){var a=this.__data__,i=Me(a,e);return i<0?a.push([e,t]):a[i][1]=t,this},Be.prototype.clear=function(){this.__data__={hash:new he,map:new(Ae||Pe),string:new he}},Be.prototype.delete=function(e){return be(this,e).delete(e)},Be.prototype.get=function(e){return be(this,e).get(e)},Be.prototype.has=function(e){return be(this,e).has(e)},Be.prototype.set=function(e,t){return be(this,e).set(e,t),this},fe.prototype.clear=function(){this.__data__=new Pe},fe.prototype.delete=function(e){return this.__data__.delete(e)},fe.prototype.get=function(e){return this.__data__.get(e)},fe.prototype.has=function(e){return this.__data__.has(e)},fe.prototype.set=function(e,t){var a=this.__data__;if(a instanceof Pe){var i=a.__data__;if(!Ae||i.length<199)return i.push([e,t]),this;a=this.__data__=new Be(i)}return a.set(e,t),this};var Fe=Se?K(Se,Object):function(){return[]},Ve=function(e){return te.call(e)};function He(e,t){return!!(t=null==t?o:t)&&("number"==typeof e||M.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=o})(e.length)&&!Qe(e)}var xe=se||function(){return!1};function Qe(e){var t=Xe(e)?te.call(e):"";return t==r||t==T}function Xe(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function $e(e){return je(e)?ge(e):(function(e){if(!Ye(e))return le(e);var t=[];for(var a in Object(e))ee.call(e,a)&&"constructor"!=a&&t.push(a);return t})(e)}e.exports=function(e){return We(e,!0,!0)}},32889:(e,t,a)=>{var i=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,E=/^0b[01]+$/i,n=/^0o[0-7]+$/i,_=parseInt,r="object"==typeof a.g&&a.g&&a.g.Object===Object&&a.g,T="object"==typeof self&&self&&self.Object===Object&&self,S=r||T||Function("return this")(),s=Object.prototype.toString,l=Math.max,I=Math.min,A=function(){return S.Date.now()};function O(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function u(e){if("number"==typeof e)return e;if((function(e){return"symbol"==typeof e||(function(e){return!!e&&"object"==typeof e})(e)&&"[object Symbol]"==s.call(e)})(e))return NaN;if(O(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=O(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(i,"");var a=E.test(e);return a||n.test(e)?_(e.slice(2),a?2:8):o.test(e)?NaN:+e}e.exports=function(e,t,a){var i,o,E,n,_,r,T=0,S=!1,s=!1,d=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function N(t){var a=i,E=o;return i=o=void 0,T=t,n=e.apply(E,a)}function R(e){var a=e-r;return void 0===r||a>=t||a<0||s&&e-T>=E}function c(){var e=A();if(R(e))return m(e);_=setTimeout(c,(function(e){var a=t-(e-r);return s?I(a,E-(e-T)):a})(e))}function m(e){return _=void 0,d&&i?N(e):(i=o=void 0,n)}function L(){var e=A(),a=R(e);if(i=arguments,o=this,r=e,a){if(void 0===_)return(function(e){return T=e,_=setTimeout(c,t),S?N(e):n})(r);if(s)return _=setTimeout(c,t),N(r)}return void 0===_&&(_=setTimeout(c,t)),n}return t=u(t)||0,O(a)&&(S=!!a.leading,E=(s="maxWait"in a)?l(u(a.maxWait)||0,t):E,d="trailing"in a?!!a.trailing:d),L.cancel=function(){void 0!==_&&clearTimeout(_),T=0,i=r=o=_=void 0},L.flush=function(){return void 0===_?n:m(A())},L}},87597:(e,t,a)=>{var i="__lodash_hash_undefined__",o=9007199254740991,E=/^\[object .+?Constructor\]$/,n="object"==typeof a.g&&a.g&&a.g.Object===Object&&a.g,_="object"==typeof self&&self&&self.Object===Object&&self,r=n||_||Function("return this")();function T(e,t){return!!(e?e.length:0)&&(function(e,t,a){if(t!=t)return(function(e,t,a,i){var o=e.length,E=a+(i?1:-1);for(;i?E--:++E-1}function S(e,t,a){for(var i=-1,o=e?e.length:0;++i-1&&e%1==0&&e<=o})(e.length)&&!w(e)})(e)})(e)?e:[]}function b(e,t){var a,i,o=e.__data__;return("string"==(i=typeof(a=t))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==a:null===a)?o["string"==typeof t?"string":"hash"]:o.map}function k(e,t){var a=(function(e,t){return null==e?void 0:e[t]})(e,t);return G(a)?a:void 0}g.prototype.clear=function(){this.__data__=f?f(null):{}},g.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},g.prototype.get=function(e){var t=this.__data__;if(f){var a=t[e];return a===i?void 0:a}return L.call(t,e)?t[e]:void 0},g.prototype.has=function(e){var t=this.__data__;return f?void 0!==t[e]:L.call(t,e)},g.prototype.set=function(e,t){return this.__data__[e]=f&&void 0===t?i:t,this},v.prototype.clear=function(){this.__data__=[]},v.prototype.delete=function(e){var t=this.__data__,a=U(t,e);return!(a<0)&&(a==t.length-1?t.pop():p.call(t,a,1),!0)},v.prototype.get=function(e){var t=this.__data__,a=U(t,e);return a<0?void 0:t[a][1]},v.prototype.has=function(e){return U(this.__data__,e)>-1},v.prototype.set=function(e,t){var a=this.__data__,i=U(a,e);return i<0?a.push([e,t]):a[i][1]=t,this},M.prototype.clear=function(){this.__data__={hash:new g,map:new(B||v),string:new g}},M.prototype.delete=function(e){return b(this,e).delete(e)},M.prototype.get=function(e){return b(this,e).get(e)},M.prototype.has=function(e){return b(this,e).has(e)},M.prototype.set=function(e,t){return b(this,e).set(e,t),this},W.prototype.add=W.prototype.push=function(e){return this.__data__.set(e,i),this},W.prototype.has=function(e){return this.__data__.has(e)};var F,V,H=(F=function(e){var t=s(e,y);return t.length&&t[0]===e[0]?(function(e,t,a){for(var i=a?S:T,o=e[0].length,E=e.length,n=E,_=Array(E),r=1/0,l=[];n--;){var O=e[n];n&&t&&(O=s(O,I(t))),r=P(O.length,r),_[n]=!a&&(t||o>=120&&O.length>=120)?new W(n&&O):void 0}O=e[0];var u=-1,d=_[0];e:for(;++u{var i="Expected a function",o=/^\s+|\s+$/g,E=/^[-+]0x[0-9a-f]+$/i,n=/^0b[01]+$/i,_=/^0o[0-7]+$/i,r=parseInt,T="object"==typeof a.g&&a.g&&a.g.Object===Object&&a.g,S="object"==typeof self&&self&&self.Object===Object&&self,s=T||S||Function("return this")(),l=Object.prototype.toString,I=Math.max,A=Math.min,O=function(){return s.Date.now()};function u(e,t,a){var o,E,n,_,r,T,S=0,s=!1,l=!1,u=!0;if("function"!=typeof e)throw new TypeError(i);function R(t){var a=o,i=E;return o=E=void 0,S=t,_=e.apply(i,a)}function c(e){var a=e-T;return void 0===T||a>=t||a<0||l&&e-S>=n}function m(){var e=O();if(c(e))return L(e);r=setTimeout(m,(function(e){var a=t-(e-T);return l?A(a,n-(e-S)):a})(e))}function L(e){return r=void 0,u&&o?R(e):(o=E=void 0,_)}function D(){var e=O(),a=c(e);if(o=arguments,E=this,T=e,a){if(void 0===r)return(function(e){return S=e,r=setTimeout(m,t),s?R(e):_})(T);if(l)return r=setTimeout(m,t),R(T)}return void 0===r&&(r=setTimeout(m,t)),_}return t=N(t)||0,d(a)&&(s=!!a.leading,n=(l="maxWait"in a)?I(N(a.maxWait)||0,t):n,u="trailing"in a?!!a.trailing:u),D.cancel=function(){void 0!==r&&clearTimeout(r),S=0,o=T=E=r=void 0},D.flush=function(){return void 0===r?_:L(O())},D}function d(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function N(e){if("number"==typeof e)return e;if((function(e){return"symbol"==typeof e||(function(e){return!!e&&"object"==typeof e})(e)&&"[object Symbol]"==l.call(e)})(e))return NaN;if(d(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=d(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(o,"");var a=n.test(e);return a||_.test(e)?r(e.slice(2),a?2:8):E.test(e)?NaN:+e}e.exports=function(e,t,a){var o=!0,E=!0;if("function"!=typeof e)throw new TypeError(i);return d(a)&&(o="leading"in a?!!a.leading:o,E="trailing"in a?!!a.trailing:E),u(e,t,{leading:o,maxWait:t,trailing:E})}},53909:(e,t,a)=>{var i=a(84686).hp;e.exports=n,e.exports.decode=n,e.exports.encode=function(e){e=Object.assign({},e);let t=new Set;e.xt&&"string"==typeof e.xt&&t.add(e.xt);e.xt&&Array.isArray(e.xt)&&(t=new Set(e.xt));e.infoHashBuffer&&t.add(`urn:btih:${e.infoHashBuffer.toString("hex")}`);e.infoHash&&t.add(`urn:btih:${e.infoHash}`);e.infoHashV2Buffer&&t.add(e.xt=`urn:btmh:1220${e.infoHashV2Buffer.toString("hex")}`);e.infoHashV2&&t.add(`urn:btmh:1220${e.infoHashV2}`);const a=Array.from(t);1===a.length&&(e.xt=a[0]);a.length>1&&(e.xt=a);e.publicKeyBuffer&&(e.xs=`urn:btpk:${e.publicKeyBuffer.toString("hex")}`);e.publicKey&&(e.xs=`urn:btpk:${e.publicKey}`);e.name&&(e.dn=e.name);e.keywords&&(e.kt=e.keywords);e.announce&&(e.tr=e.announce);e.urlList&&(e.ws=e.urlList,delete e.as);e.peerAddresses&&(e["x.pe"]=e.peerAddresses);let i="magnet:?";return Object.keys(e).filter(e=>2===e.length||"x.pe"===e).forEach((t,a)=>{const o=Array.isArray(e[t])?e[t]:[e[t]];o.forEach((e,o)=>{(a>0||o>0)&&("kt"!==t&&"so"!==t||0===o)&&(i+="&"),"dn"===t&&(e=encodeURIComponent(e).replace(/%20/g,"+")),"tr"!==t&&"as"!==t&&"ws"!==t||(e=encodeURIComponent(e)),"xs"!==t||e.startsWith("urn:btpk:")||(e=encodeURIComponent(e)),"kt"===t&&(e=encodeURIComponent(e)),"so"!==t&&(i+="kt"===t&&o>0?`+${e}`:`${t}=${e}`)}),"so"===t&&(i+=`${t}=${E.compose(o)}`)}),i};const o=a(942),E=a(51042);function n(e){const t={},a=e.split("magnet:?")[1];let n;if((a&&a.length>=0?a.split("&"):[]).forEach(e=>{const a=e.split("=");if(2!==a.length)return;const i=a[0];let o=a[1];"dn"===i&&(o=decodeURIComponent(o).replace(/\+/g," ")),"tr"!==i&&"xs"!==i&&"as"!==i&&"ws"!==i||(o=decodeURIComponent(o)),"kt"===i&&(o=decodeURIComponent(o).split("+")),"ix"===i&&(o=Number(o)),"so"===i&&(o=E.parse(decodeURIComponent(o).split(","))),t[i]?(Array.isArray(t[i])||(t[i]=[t[i]]),t[i].push(o)):t[i]=o}),t.xt){(Array.isArray(t.xt)?t.xt:[t.xt]).forEach(e=>{if(n=e.match(/^urn:btih:(.{40})/))t.infoHash=n[1].toLowerCase();else if(n=e.match(/^urn:btih:(.{32})/)){const e=o.decode(n[1]);t.infoHash=i.from(e,"binary").toString("hex")}else(n=e.match(/^urn:btmh:1220(.{64})/))&&(t.infoHashV2=n[1].toLowerCase())})}if(t.xs){(Array.isArray(t.xs)?t.xs:[t.xs]).forEach(e=>{(n=e.match(/^urn:btpk:(.{64})/))&&(t.publicKey=n[1].toLowerCase())})}return t.infoHash&&(t.infoHashBuffer=i.from(t.infoHash,"hex")),t.infoHashV2&&(t.infoHashV2Buffer=i.from(t.infoHashV2,"hex")),t.publicKey&&(t.publicKeyBuffer=i.from(t.publicKey,"hex")),t.dn&&(t.name=t.dn),t.kt&&(t.keywords=t.kt),t.announce=[],("string"==typeof t.tr||Array.isArray(t.tr))&&(t.announce=t.announce.concat(t.tr)),t.urlList=[],("string"==typeof t.as||Array.isArray(t.as))&&(t.urlList=t.urlList.concat(t.as)),("string"==typeof t.ws||Array.isArray(t.ws))&&(t.urlList=t.urlList.concat(t.ws)),t.peerAddresses=[],("string"==typeof t["x.pe"]||Array.isArray(t["x.pe"]))&&(t.peerAddresses=t.peerAddresses.concat(t["x.pe"])),t.announce=Array.from(new Set(t.announce)),t.urlList=Array.from(new Set(t.urlList)),t.peerAddresses=Array.from(new Set(t.peerAddresses)),t}},29895:e=>{"use strict";e.exports=Math.abs},72153:e=>{"use strict";e.exports=Math.floor},15518:e=>{"use strict";e.exports=Number.isNaN||function(e){return e!=e}},90457:e=>{"use strict";e.exports=Math.max},21179:e=>{"use strict";e.exports=Math.min},55985:e=>{"use strict";e.exports=Math.pow},88639:e=>{"use strict";e.exports=Math.round},55738:(e,t,a)=>{"use strict";var i=a(15518);e.exports=function(e){return i(e)||0===e?e:e<0?-1:1}},63810:e=>{e.exports={"error-container":"error-container-OJnoc","error-image":"error-image-qU9Qo","error-message":"error-message-kW59Z","buttons-container":"buttons-container-tQonN","button-container":"button-container-vLSQK",label:"label-Up_te"}},45568:e=>{e.exports={"shortcuts-modal":"shortcuts-modal-A5Jm_",backdrop:"backdrop-RVNbP",container:"container-OawCB",header:"header-JUh2c",title:"title-SaDFr","close-button":"close-button-zS10s",icon:"icon-gr21P",content:"content-X0GHX"}},70036:e=>{e.exports={"updater-banner":"updater-banner-MjMLN",button:"button-ixcOU",close:"close-Quid9",icon:"icon-N2Lyd"}},36329:e=>{e.exports={"fade-in":"fade-in-pFkt_","fade-in-no-motion":"fade-in-no-motion-lYmxL","slide-up":"slide-up-lSxrC","toasts-container":"toasts-container-oKECy","tooltip-container":"tooltip-container-Qpse8","file-drop-container":"file-drop-container-gHJoy","updater-banner-container":"updater-banner-container-Bk1mq",router:"router-_65XU","loader-container":"loader-container-vwvnb","error-container":"error-container-VZXwH"}},68738:e=>{e.exports={"toast-item-container":"toast-item-container-nG0uk",success:"success-eIDTa","icon-container":"icon-container-rjAiH",icon:"icon-Y4I_O",error:"error-quyOd",info:"info-KEWq8","info-container":"info-container-xD9V6","title-container":"title-container-VFReJ","message-container":"message-container-znkCj","close-button-container":"close-button-container-YtyYE"}},96906:e=>{e.exports={"tooltip-placeholder":"tooltip-placeholder-niioe"}},25495:e=>{e.exports={"tooltip-item":"tooltip-item-gfYXu"}},33325:e=>{e.exports={"addon-details-container":"addon-details-container-tUlp2","title-container":"title-container-Ca076",logo:"logo-Nynh9",icon:"icon-ZYXtC","name-container":"name-container-XxPAj",name:"name-i0o3Y",version:"version-FdUq6","section-container":"section-container-N6QHW","section-header":"section-header-tbXCb","section-label":"section-label-_R7gz","transport-url-label":"transport-url-label-upr4V","disclaimer-label":"disclaimer-label-I7kvM"}},82910:e=>{e.exports={"addon-details-modal-container":"addon-details-modal-container-aBFaQ","addon-details-container":"addon-details-container-VdGrt","addon-details-message-container":"addon-details-message-container-X2sRf","cancel-button":"cancel-button-zuUX6","cancel-button-label":"cancel-button-label-ZOQUJ","uninstall-button":"uninstall-button-iLxLs"}},43351:e=>{e.exports={"bottom-sheet":"bottom-sheet-VtqY2",backdrop:"backdrop-Doe6y",container:"container-yiLtz",dragging:"dragging-ML0cp",heading:"heading-xf2ct",handle:"handle-TCLds",title:"title-QtERv",content:"content-ElxXl"}},5077:e=>{e.exports={"button-container":"button-container-zVLH6"}},62871:e=>{e.exports={checkbox:"checkbox-_AF32",label:"label-UHMAy",link:"link-ih0xx","checkbox-container":"checkbox-container-O5cy3","checkbox-icon":"checkbox-icon-viDqg",disabled:"disabled-oxpfi",error:"error-LWgU0",checked:"checked-cf9YT"}},24189:e=>{e.exports={chip:"chip-L3r9A",active:"active-jnhyP"}},37359:e=>{e.exports={chips:"chips-Uw41c"}},3599:e=>{e.exports={"color-input-container":"color-input-container-FAQiP","transparent-label-container":"transparent-label-container-uuGMx","transparent-label":"transparent-label-NxKvi","color-picker-container":"color-picker-container-szQfD"}},79846:e=>{e.exports={"color-picker-container":"color-picker-container-Cny5U"}},72775:e=>{e.exports={"context-menu-container":"context-menu-container-TdwXy","context-menu":"context-menu-kWx7C"}},60788:e=>{e.exports={"event-modal":"event-modal-lIGmX","body-container":"body-container-x9t4v",image:"image-iUBVI","info-container":"info-container-ewqxH","title-container":"title-container-tBMsA",title:"title-lE2cq",label:"label-KwjpM","addon-container":"addon-container-YNNkt",icon:"icon-n54me",name:"name-DVEMC","action-button":"action-button-QSvOg","button-label":"button-label-hRZRW"}},5639:e=>{e.exports={"horizontal-scroll":"horizontal-scroll-pGtUW",left:"left-MCk5v",right:"right-bxsRb",center:"center-J9E02"}},99715:e=>{e.exports={"main-nav-bars-container":"main-nav-bars-container-wNjS5","horizontal-nav-bar":"horizontal-nav-bar-ji5GB","vertical-nav-bar":"vertical-nav-bar-qGRze","nav-content-container":"nav-content-container-zl9hQ"}},81965:e=>{e.exports={"meta-item-container":"meta-item-container-Tj0Ib","poster-container":"poster-container-qkw48","dismiss-icon-layer":"dismiss-icon-layer-BWztF","poster-image-layer":"poster-image-layer-KimPZ","play-icon-layer":"play-icon-layer-vpQIo","play-icon-outer":"play-icon-outer-r3iKR","play-icon-background":"play-icon-background-Uazjh","title-bar-container":"title-bar-container-1Ba0x","menu-label-container":"menu-label-container-ChuX8","poster-shape-poster":"poster-shape-poster-MEhNx","poster-shape-square":"poster-shape-square-meMeN","poster-shape-landscape":"poster-shape-landscape-kF6i8","dismiss-icon":"dismiss-icon-db3fv","dismiss-icon-backdrop":"dismiss-icon-backdrop-MkuLQ","watched-icon-layer":"watched-icon-layer-bi3DO","watched-icon":"watched-icon-zuUdK","poster-image":"poster-image-NiV7O","placeholder-icon":"placeholder-icon-xttvb","play-icon":"play-icon-QmEEA","progress-bar-layer":"progress-bar-layer-LVYYi","progress-bar":"progress-bar-w1rNN","progress-bar-background":"progress-bar-background-kyRgp","new-videos":"new-videos-cwuD9",layer:"layer-dQmEe",icon:"icon-gh1t9",label:"label-ZZ2m7","title-label":"title-label-VnEAc"}},10681:e=>{e.exports={"action-button-container":"action-button-container-sVyRr","icon-container":"icon-container-rQBA0",icon:"icon-RouVG","label-container":"label-container-xslEF",label:"label-WCWIO"}},47047:e=>{e.exports={"meta-links-container":"meta-links-container-dh69_","label-container":"label-container-dYN2B","links-container":"links-container-C8Mw9","link-container":"link-container-gHxPW"}},75327:e=>{e.exports={"meta-preview-placeholder-container":"meta-preview-placeholder-container-IVU4R","meta-info-container":"meta-info-container-zVaVX","logo-container":"logo-container-CES89","duration-release-info-container":"duration-release-info-container-JQE0f","duration-container":"duration-container-tVH7K","release-info-container":"release-info-container-dbZja","genres-container":"genres-container-MkCtO","genres-header-container":"genres-header-container-XNnjL","genre-label-container":"genre-label-container-r3gbk","action-buttons-container":"action-buttons-container-FHoD2"}},3419:e=>{e.exports={"ratings-container":"ratings-container-eQRLs","icon-container":"icon-container-kow_q",icon:"icon-QwGlD",disabled:"disabled-W7ks1"}},18700:e=>{e.exports={"meta-preview-container":"meta-preview-container-o22hc",compact:"compact-ii1zu","meta-info-container":"meta-info-container-ub8AH",logo:"logo-X3hTV","logo-placeholder":"logo-placeholder-rE1ld","runtime-release-info-container":"runtime-release-info-container-BGd_r","runtime-label":"runtime-label-TzAGI","release-info-label":"release-info-label-LPJMB","description-container":"description-container-yi8iU","action-buttons-container":"action-buttons-container-XbKVa","action-button":"action-button-XIZa3","background-image-layer":"background-image-layer-kk_WI","background-image":"background-image-9zToE","imdb-button-container":"imdb-button-container-gGjxp",label:"label-MXv72",icon:"icon-N_uIU","label-container":"label-container-_VXZt","meta-links":"meta-links-Xiao3","show-button":"show-button-_yuOF",ratings:"ratings-zUtHH","share-prompt":"share-prompt-QbhIA"}},85039:e=>{e.exports={"meta-row-placeholder-container":"meta-row-placeholder-container-x8ykQ","header-container":"header-container-LRLpi","title-container":"title-container-RuV2b","see-all-container":"see-all-container-GtLII",label:"label-FP9bt",icon:"icon-U2Gj8","meta-items-container":"meta-items-container-M4vN4","meta-item":"meta-item-iOgzp","poster-container":"poster-container-WX2KD","title-bar-container":"title-bar-container-U0ZAT","title-label":"title-label-mb1GR"}},444:e=>{e.exports={"meta-row-container":"meta-row-container-xtlB1","header-container":"header-container-tR3Ev","title-container":"title-container-Mkwnq","see-all-container":"see-all-container-MoOtW",label:"label-bytni",icon:"icon-Sj7HO","message-container":"message-container-KWmlO","meta-items-container":"meta-items-container-qcuUA","meta-item":"meta-item-QFHCh","poster-shape-poster":"poster-shape-poster-LKBza","poster-shape-square":"poster-shape-square-g5a1z","poster-shape-landscape":"poster-shape-landscape-KmmRZ"}},15314:e=>{e.exports={"modal-container":"modal-container-OuxEF","modal-dialog-container":"modal-dialog-container-DZMKq","modal-dialog-background":"modal-dialog-background-vZpB_","close-button-container":"close-button-container-cmxAp",icon:"icon-OYzlV","modal-dialog-content":"modal-dialog-content-Xgv7Z","title-container":"title-container-v2mmF","body-container":"body-container-H80dD","buttons-container":"buttons-container-e_JoR","action-button":"action-button-eprQG",label:"label-wbfsE"}},18634:e=>{e.exports={"label-container":"label-container-dhjQS",icon:"icon-jg2il",label:"label-AR_l8","modal-container":"modal-container-WaYOG","menu-container":"menu-container-qiz0X","option-container":"option-container-mO9yW","no-options-container":"no-options-container-z47Tg"}},97778:e=>{e.exports={dropdown:"dropdown-MWaxp",open:"open-yuN4f","back-button":"back-button-dGLHu","back-button-icon":"back-button-icon-VdHBJ"}},82484:e=>{e.exports={option:"option-HcOSE",label:"label-IR8xX",icon:"icon-I_g2q"}},78351:e=>{e.exports={"multiselect-menu":"multiselect-menu-qMdaj",disabled:"disabled-RaqL9","multiselect-button":"multiselect-button-XXdgA",label:"label-SoEGc",icon:"icon-gQU96",open:"open-TvFQd",active:"active-gKhO5"}},43661:e=>{e.exports={"nav-menu-popup-label":"nav-menu-popup-label-XmUBo","nav-menu-container":"nav-menu-container-Pl25j","with-warning":"with-warning-SNmXK","user-info-container":"user-info-container-uigVE","avatar-container":"avatar-container-f6ino","user-info-details":"user-info-details-XJ5OH","email-container":"email-container-LNcms","email-label":"email-label-IFT0d","logout-button-container":"logout-button-container-prHdW","logout-label":"logout-label-HhwtK","nav-menu-section":"nav-menu-section-j87xd","nav-menu-option-container":"nav-menu-option-container-Qj9Xh",icon:"icon-MRjOP","nav-menu-option-label":"nav-menu-option-label-d7fgK"}},78608:e=>{e.exports={"search-bar-container":"search-bar-container-asfq1","search-input":"search-input-IQ0ZW","placeholder-label":"placeholder-label-XyrN_","submit-button-container":"submit-button-container-MImNa",icon:"icon-TkvAO","menu-container":"menu-container-GcXNG",label:"label-J908i",title:"title-s74ty","search-history-clear":"search-history-clear-ap0h8",items:"items-P1xS5",item:"item-TgYCX"}},47518:e=>{e.exports={"horizontal-nav-bar-container":"horizontal-nav-bar-container-Y_zvK","logo-container":"logo-container-jteMT",logo:"logo-oPx1q","back-button-container":"back-button-container-lDB1N",title:"title-DGh6h","search-bar":"search-bar-h60ja","buttons-container":"buttons-container-Oc5z1","button-container":"button-container-xT9_L",icon:"icon-T8MU6","menu-button-container":"menu-button-container-DtW4v"}},9371:e=>{e.exports={"nav-tab-button-container":"nav-tab-button-container-dYhs0",label:"label-BCz2f",icon:"icon-TzPrK",logo:"logo-xJBE9"}},67564:e=>{e.exports={"vertical-nav-bar-container":"vertical-nav-bar-container-UPAkA","nav-tab-button":"nav-tab-button-tW6qT"}},93583:e=>{e.exports={"number-input":"number-input-igJ35",button:"button-GWY2o",icon:"icon-EndAk","number-display":"number-display-hLJ72",label:"label-y4qDZ",value:"value-Y2xdx"}},17319:e=>{e.exports={"label-container":"label-container-XOyzm","menu-container":"menu-container-B6cqK","menu-direction-top-left":"menu-direction-top-left-ongjn","menu-direction-bottom-left":"menu-direction-bottom-left-Dvtqk","menu-direction-top-right":"menu-direction-top-right-tmrFG","menu-direction-bottom-right":"menu-direction-bottom-right-aJ89V"}},76559:e=>{e.exports={"radio-button":"radio-button-SGEc1","radio-container":"radio-container-wPddo","inner-circle":"inner-circle-vdtUP",disabled:"disabled-ZzMU9",error:"error-_vY0h",selected:"selected-M_zHA"}},58515:e=>{e.exports={"search-bar-container":"search-bar-container-sTkGP","search-input":"search-input-Q18HV",icon:"icon-M3jX0"}},59242:e=>{e.exports={"search-bar-container":"search-bar-container-p4tSt","search-input":"search-input-bAgAh",icon:"icon-QOYfJ"}},4662:e=>{e.exports={"share-prompt-container":"share-prompt-container-EXOaj","buttons-container":"buttons-container-fiSbJ","button-container":"button-container-KJoeC",icon:"icon-OX8pK","facebook-button":"facebook-button-La6ud","x-button":"x-button-pA7ym","reddit-button":"reddit-button-sd07c","url-container":"url-container-OKpfh","url-text-input":"url-text-input-nqDsC","copy-button":"copy-button-XmXGg",label:"label-gMoQ8"}},68084:e=>{e.exports={combos:"combos-TF23d",combo:"combo-i2l7g",separator:"separator-KiYac"}},88422:e=>{e.exports={separator:"separator-uSn0j"}},45833:e=>{e.exports={"shortcuts-group":"shortcuts-group-LbRfT",title:"title-eToYZ",shortcuts:"shortcuts-tQ93G",shortcut:"shortcut-swbky",label:"label-WnVj8"}},44020:e=>{e.exports={"active-slider-within":"active-slider-within-NcgYf","slider-container":"slider-container-nJz5F",layer:"layer-aC5Vt",track:"track-gItfW","audio-boost":"audio-boost-AyRq0","track-before":"track-before-kJzIb","track-after":"track-after-pUXC0",thumb:"thumb-PiTF5"}},87318:e=>{e.exports={"text-input":"text-input-hnLiz"}},6825:e=>{e.exports={"toggle-container":"toggle-container-lZfHP",toggle:"toggle-toOWM"}},8759:e=>{e.exports={"video-placeholder-container":"video-placeholder-container-DgoIs","info-container":"info-container-BATmf","name-container":"name-container-N4C39","released-container":"released-container-egHHb"}},12416:e=>{e.exports={"video-container":"video-container-ezBpK","thumbnail-container":"thumbnail-container-Zm8Cl",thumbnail:"thumbnail-J81W3",blurred:"blurred-ZmA2z","placeholder-icon":"placeholder-icon-GNOI3","progress-bar-container":"progress-bar-container-w8eFT","progress-bar":"progress-bar-E23CT","progress-bar-background":"progress-bar-background-Q7aEH","info-container":"info-container-xyynk","title-container":"title-container-NcfV9","flex-row-container":"flex-row-container-CAyQu","released-container":"released-container-XLPqf","upcoming-watched-container":"upcoming-watched-container-msCaq","upcoming-container":"upcoming-container-LXfQ7","watched-container":"watched-container-gvzs3","flag-icon":"flag-icon-RDrvf","flag-label":"flag-label-zJloD",selected:"selected-AfK31",border:"border-nc19J","context-menu-content":"context-menu-content-ItIFy","context-menu-option-container":"context-menu-option-container-KNVWj","context-menu-option-label":"context-menu-option-label-dy2nc"}},3063:e=>{e.exports={"addon-container":"addon-container-lC5KN","logo-container":"logo-container-ZcSSC",logo:"logo-WrsGF",icon:"icon-GxVbY","info-container":"info-container-AdMB6","name-container":"name-container-qIAg8","version-container":"version-container-zdPyN","types-container":"types-container-DaOrg","description-container":"description-container-v7Jhe","buttons-container":"buttons-container-g0xXr","action-buttons-container":"action-buttons-container-xMVmz","install-button-container":"install-button-container-yfcq5","configure-button-container":"configure-button-container-VwVAQ","uninstall-button-container":"uninstall-button-container-oV4Yo","share-button-container":"share-button-container-s3gwP",label:"label-OnWh2"}},14267:e=>{e.exports={"addon-container":"addon-container-A53Om",content:"content-gjK8A","logo-container":"logo-container-uixVa","info-container":"info-container-EuwPe","placeholder-pill":"placeholder-pill-OmvfW","buttons-container":"buttons-container-_S1YF","action-buttons-container":"action-buttons-container-bYZoV"}},67644:e=>{e.exports={"addons-container":"addons-container-ogGYu","addons-content":"addons-content-zhFBl","addons-list-container":"addons-list-container-Ovr2Z","selectable-inputs-container":"selectable-inputs-container-tUul1","add-button-container":"add-button-container-SkafT",icon:"icon-HsyZS","add-button-label":"add-button-label-NN6bu","select-input-container":"select-input-container-KqG8N",spacing:"spacing-wH1w5","search-bar":"search-bar-k7MXd","filter-button":"filter-button-lLJ1X","filter-icon":"filter-icon-LUDTS","message-container":"message-container-GBw0P",addon:"addon-whmdO","filters-modal":"filters-modal-w6oWY","add-addon-modal-container":"add-addon-modal-container-KR5ny",notice:"notice-UQkO1","addon-url-input":"addon-url-input-ucetZ","cancel-button":"cancel-button-R2AxR","share-modal-container":"share-modal-container-DkzPM","title-container":"title-container-La49g",logo:"logo-PmYDP","name-container":"name-container-m_Sz0",name:"name-YD0xd",version:"version-wuAFB","share-prompt-container":"share-prompt-container-vaK4P"}},69098:e=>{e.exports={"warning-container":"warning-container-_GJlx","warning-statement":"warning-statement-MQjVq",actions:"actions-IOe34",action:"action-t06kj",label:"label-PkwRv"}},78447:e=>{e.exports={"board-container":"board-container-DTN_b","board-content-container":"board-content-container-ToQTz","board-content":"board-content-nPWv1","board-row":"board-row-CoJrZ","board-warning-container":"board-warning-container-a4m04","board-row-poster":"board-row-poster-QPQqC","board-row-square":"board-row-square-pgaZ3","continue-watching-row":"continue-watching-row-ZiNSa","board-row-landscape":"board-row-landscape-FRGXx"}},67279:e=>{e.exports={calendar:"calendar-cH2jw",content:"content-wBwrQ",main:"main-vWt7d"}},12770:e=>{e.exports={details:"details-EuHwi",video:"video-BIs3a",name:"name-vpn8u",info:"info-n1Tz1",icon:"icon-Di3yP",placeholder:"placeholder-Kigxt"}},93721:e=>{e.exports={item:"item-PwXPg",heading:"heading-aqSxF",body:"body-pUnX4",video:"video-XnjiE",name:"name-tepO3",info:"info-dnUvu",icon:"icon-bz23A",placeholder:"placeholder-NxxV1",text:"text-x3anZ",today:"today-JJfHO",active:"active-ymNy0"}},72716:e=>{e.exports={list:"list-fa_2a"}},10434:e=>{e.exports={placeholder:"placeholder-pCQTz",title:"title-bE4zd","image-container":"image-container-DOkaE",image:"image-qgtvg",overview:"overview-RGglv",point:"point-iTc1_",icon:"icon-Y5Zkw",text:"text-Pa9GN","button-container":"button-container-fBjqZ",button:"button-DsyS9"}},92642:e=>{e.exports={selector:"selector-uRGQ6",prev:"prev-__2gh",next:"next-t6hvT",label:"label-xSEWG",icon:"icon-ixEYr",selected:"selected-lBBwk",year:"year-jHuog",month:"month-VlFJ6"}},32931:e=>{e.exports={cell:"cell-l3eWl",heading:"heading-TYXvp",day:"day-nttmc",items:"items-ZZ9Jt",item:"item-qsUNQ",icon:"icon-F3Uu8",poster:"poster-goLqZ",more:"more-gGKzA",today:"today-G8kuO",active:"active-KC8sV"}},67490:e=>{e.exports={table:"table-QbfK0",week:"week-mTZNI",day:"day-LPW9e",long:"long-UpX3r",short:"short-MoF9_",grid:"grid-cUaUg"}},71888:e=>{e.exports={"discover-container":"discover-container-L6OGL","discover-content":"discover-content-CRsRg","catalog-container":"catalog-container-VNK_T","meta-items-container":"meta-items-container-n8vNz","selectable-inputs-container":"selectable-inputs-container-IRz50","select-input":"select-input-CHDbe","filter-container":"filter-container-BVkqT","filter-button":"filter-button-GU_n0","filter-icon":"filter-icon-zlFnX","missing-addon-warning-container":"missing-addon-warning-container-IXGuv","warning-label":"warning-label-f19Jg","install-button":"install-button-SmJe1",label:"label-ToW4S","message-container":"message-container-Zv9eF",image:"image-txC9E","message-label":"message-label-mRyRX","meta-item-placeholder":"meta-item-placeholder-wxG4I","poster-container":"poster-container-Dch4R","title-bar-container":"title-bar-container-dtDnk","title-label":"title-label-vHdQd","meta-preview-container":"meta-preview-container-CoWs5","selectable-inputs-modal":"selectable-inputs-modal-ChpOa"}},58195:e=>{e.exports={"password-reset-modal-container":"password-reset-modal-container-KzJPQ","credentials-text-input":"credentials-text-input-ncrIR","error-message":"error-message-DkekN","cancel-button":"cancel-button-AneJE"}},10873:e=>{e.exports={"intro-container":"intro-container-tkNS6","background-container":"background-container-aYKCH","heading-container":"heading-container-oI70m","logo-container":"logo-container-W49kt",logo:"logo-WJ36F","title-container":"title-container-CbIkM","slogan-container":"slogan-container-UlcYd","content-container":"content-container-A1Drn","form-button":"form-button-vyqqj",icon:"icon-L_6b6",label:"label-uHD7L","submit-button":"submit-button-x3L8z","guest-login-button":"guest-login-button-D8DWZ","signup-form-button":"signup-form-button-UGmSk","login-form-button":"login-form-button-DqJUV","form-container":"form-container-HMlEh","credentials-text-input":"credentials-text-input-QMCZz","forgot-password-link-container":"forgot-password-link-container-ygZqb","forgot-password-link":"forgot-password-link-NxNUD","error-message":"error-message-cKdzB","options-container":"options-container-qxboQ","facebook-button":"facebook-button-LZ_kG","apple-button":"apple-button-V5nEI","loading-modal-container":"loading-modal-container-eLyTm","loader-container":"loader-container-oe8rU",flash:"flash-wUFXY",button:"button-ryGtP"}},32441:e=>{e.exports={placeholder:"placeholder-XbuMS",title:"title-eBwtZ","image-container":"image-container-YnqQ_",image:"image-yTheT",overview:"overview-nYi3n",point:"point-vQhRj",icon:"icon-RD7Oa",text:"text-NNOtt","button-container":"button-container-HU08c",button:"button-GHZkA"}},41486:e=>{e.exports={"library-container":"library-container-zM_bj","library-content":"library-content-PgX4O","meta-items-container":"meta-items-container-IKrND","selectable-inputs-container":"selectable-inputs-container-hR3or","select-input-container":"select-input-container-H1VZ1","message-container":"message-container-MhY5t",image:"image-csRHm","message-label":"message-label-UExl3","selectable-inputs-modal":"selectable-inputs-modal-rHlo7"}},7671:e=>{e.exports={"button-container":"button-container-PmUa2",label:"label-sAyL4"}},34803:e=>{e.exports={background:"background-Xro_t",icon:"icon-UFaeB"}},11495:e=>{e.exports={"stream-placeholder-container":"stream-placeholder-container-T1nxv","addon-container":"addon-container-pm1P0","addon-name":"addon-name-zAOKP","info-container":"info-container-Z1Dl6","description-container":"description-container-ZOMcn","play-icon":"play-icon-MXqj3"}},90237:e=>{e.exports={"stream-container":"stream-container-JPdah",icon:"icon-rAZvO","info-container":"info-container-TihQo",thumbnail:"thumbnail-whoms","placeholder-icon":"placeholder-icon-znYz0","addon-name":"addon-name-tC8PX","progress-bar-container":"progress-bar-container-ADRp_","progress-bar":"progress-bar-XrEBL","progress-bar-background":"progress-bar-background-HueVQ","description-container":"description-container-vW_De","menu-icon":"menu-icon-JD2rP","context-menu-content":"context-menu-content-Xe_lN","context-menu-title":"context-menu-title-aoWE4","context-menu-option-container":"context-menu-option-container-BZGla","context-menu-option-label":"context-menu-option-label-EbNNz"}},52654:e=>{e.exports={"streams-list-container":"streams-list-container-xYMJo","message-container":"message-container-f9_L4",search:"search-Bo8nu",image:"image-rIyu6",label:"label-luvnO","addons-loading-container":"addons-loading-container-Vkwp3","addons-loading":"addons-loading-zhdQr","addons-loading-bar":"addons-loading-bar-MqT59","select-choices-wrapper":"select-choices-wrapper-xGzfs","back-button-container":"back-button-container-cJ4bk",icon:"icon-SoFgF","episode-title":"episode-title-dln_c","select-input-container":"select-input-container-irGn_","streams-container":"streams-container-bbSc4","install-button-container":"install-button-container-Q60yJ"}},25690:e=>{e.exports={"seasons-bar-placeholder-container":"seasons-bar-placeholder-container-M81RN","prev-season-button":"prev-season-button-TCbOq","next-season-button":"next-season-button-oGnlT",icon:"icon-UzQjF",label:"label-lmBnj","seasons-popup-label-container":"seasons-popup-label-container-r2UDB","seasons-popup-label":"seasons-popup-label-xBinL","seasons-popup-icon":"seasons-popup-icon-p1T5d"}},98287:e=>{e.exports={"seasons-bar-container":"seasons-bar-container-nOZjG","prev-season-button":"prev-season-button-bs1GQ","next-season-button":"next-season-button-RrYAq",disabled:"disabled-WJy2x",label:"label-uJbfD",icon:"icon-_ZBEE","seasons-popup-label-container":"seasons-popup-label-container-fZcu4"}},5019:e=>{e.exports={"videos-list-container":"videos-list-container-NepX5","message-container":"message-container-_hhmQ","episode-picker":"episode-picker-JPpsC",image:"image-_xAbP",label:"label-Ff1_X","notifications-toggle":"notifications-toggle-PaWY3","seasons-bar":"seasons-bar-Ma8vp","search-bar":"search-bar-mZHWa","videos-container":"videos-container-msX8s"}},77712:e=>{e.exports={"metadetails-container":"metadetails-container-K_Dqa","background-image-layer":"background-image-layer-wJa90","background-image":"background-image-tSjYu","nav-bar":"nav-bar-MH6Vk","metadetails-content":"metadetails-content-Uz5EV","vertical-nav-bar":"vertical-nav-bar-B39nq","meta-message-container":"meta-message-container-MJZN5",image:"image-R1LcJ","message-label":"message-label-Uz4_P","meta-preview":"meta-preview-ES0h3",spacing:"spacing-rgIYg","videos-list":"videos-list-nE0LJ","streams-list":"streams-list-Y1lCM","meta-extension-modal-container":"meta-extension-modal-container-gHjqy","meta-extension-modal-iframe":"meta-extension-modal-iframe-GGHlm"}},76152:e=>{e.exports={"not-found-container":"not-found-container-Q1qsP","nav-bar":"nav-bar-Eu3_y","not-found-content":"not-found-content-z_Eza","not-found-image":"not-found-image-Qab4G","not-found-label":"not-found-label-mmwyZ"}},93917:e=>{e.exports={"audio-menu":"audio-menu-qB4SQ",container:"container-lNRgG",header:"header-yT4vp",list:"list-lt_h8",option:"option-COcvW",info:"info-BPG2q",lang:"lang-EXxoG",label:"label-_DvDN",icon:"icon-DebLV"}},56044:e=>{e.exports={"buffering-loader-container":"buffering-loader-container-P7S0m","buffering-loader":"buffering-loader-fMSpb",fadeInOut:"fadeInOut-WS5RD"}},78565:e=>{e.exports={"seek-bar-container":"seek-bar-container-JGGTa",label:"label-QFbsS",slider:"slider-hBDOf"}},99995:e=>{e.exports={"volume-slider":"volume-slider-G_xAt"}},54675:e=>{e.exports={"control-bar-container":"control-bar-container-xsWA7","seek-bar":"seek-bar-I7WeY","control-bar-buttons-container":"control-bar-buttons-container-SWhkU","control-bar-button":"control-bar-button-FQUsj",icon:"icon-qy6I6","volume-slider":"volume-slider-U9jfo",spacing:"spacing-p8NJQ","control-bar-buttons-menu-button":"control-bar-buttons-menu-button-h0MWd","control-bar-buttons-menu-container":"control-bar-buttons-menu-container-M6L0_"}},33929:e=>{e.exports={error:"error-ty_iB","error-label":"error-label-lyLDv","error-sub":"error-sub-rdwAf","playlist-button":"playlist-button-tZTCo",icon:"icon-fIGRf",label:"label-Z7jSJ"}},38901:e=>{e.exports={"indicator-container":"indicator-container-wgAZn",indicator:"indicator-jM65y"}},1631:e=>{e.exports={"next-video-popup-container":"next-video-popup-container-H4wnL","slide-fade-in":"slide-fade-in-rk2M8","poster-container":"poster-container-tXZjA","poster-image":"poster-image-2D6wg",blurred:"blurred-rcoS5","placeholder-icon":"placeholder-icon-fu1rK","info-container":"info-container-KLOMx","details-container":"details-container-bUOTZ",name:"name-sIiDL",label:"label-zOq_w",title:"title-Z5Kgo","buttons-container":"buttons-container-iYrpZ",spacing:"spacing-iFwsN","button-container":"button-container-i4F7t","play-button":"play-button-Dluk6",icon:"icon-N3Ewm",dismiss:"dismiss-IvEL_"}},9484:e=>{e.exports={"option-container":"option-container-m_jZq",icon:"icon-krR0X",label:"label-cmqqu"}},44236:e=>{e.exports={"options-menu-container":"options-menu-container-qlzLt"}},86587:e=>{e.exports={"side-drawer":"side-drawer-r9EuA","close-button":"close-button-ruzkn",icon:"icon-k44IU",info:"info-hhNTg","side-drawer-meta-preview":"side-drawer-meta-preview-pB8v6","series-content":"series-content-VkYHB",videos:"videos-nRM2D"}},61395:e=>{e.exports={"side-drawer-button":"side-drawer-button-lVLKS",icon:"icon-g5Oo_"}},53665:e=>{e.exports={option:"option-_O96j",icon:"icon-kqaPF",label:"label-FEOiu"}},6491:e=>{e.exports={"speed-menu-container":"speed-menu-container-ABjzc",title:"title-Hu2Dm","options-container":"options-container-DNn3D",option:"option-GcPlB"}},3493:e=>{e.exports={"statistics-menu-container":"statistics-menu-container-DhiHn",title:"title-NCwWH",label:"label-h6nN_",value:"value-E8Ftb",stats:"stats-Tr37t",stat:"stat-zoq5A","info-hash":"info-hash-GT1Cv"}},51732:e=>{e.exports={stepper:"stepper-OL8zv",header:"header-fEtxa",content:"content-A6qIn",button:"button-fisbt",icon:"icon-zdvuT",value:"value-Z6LnU"}},8769:e=>{e.exports={"subtitles-menu-container":"subtitles-menu-container-PxBRZ","languages-container":"languages-container-NS7H9","variants-container":"variants-container-XglzH","subtitles-settings-container":"subtitles-settings-container-LhRGS","languages-header":"languages-header-jGNcK","variants-header":"variants-header-TsVSR","settings-header":"settings-header-eaWnm","languages-list":"languages-list-sxIwI","variants-list":"variants-list-yZo6B","language-option":"language-option-O1Yr9","variant-option":"variant-option-t7_LA","language-label":"language-label-FjjqA","variant-label":"variant-label-opjnP","variant-origin":"variant-origin-SVnd1",icon:"icon-I1Ruh",info:"info-mxjJh","no-variants-container":"no-variants-container-q6u1Q","no-variants-label":"no-variants-label-RmDKZ","settings-list":"settings-list-mhZV6",spacing:"spacing-AWJpt",stepper:"stepper-FTDeY"}},9562:e=>{e.exports={"video-container":"video-container-v9_vA",video:"video-tkpQm"}},57526:e=>{e.exports={"volume-change-indicator":"volume-change-indicator-EWypD","volume-icon":"volume-icon-zn9zT","volume-slider":"volume-slider-FKN0X"}},35406:e=>{e.exports={"player-container":"player-container-wIELK",overlayHidden:"overlayHidden-gyjIy","nav-bar-layer":"nav-bar-layer-r9HT5","control-bar-layer":"control-bar-layer-m2jto","menu-layer":"menu-layer-HZFG9","side-drawer-button-layer":"side-drawer-button-layer-RrB8k",layer:"layer-qalDW","buffering-layer":"buffering-layer-ZZCYp","error-layer":"error-layer-RCEZC","background-layer":"background-layer-ldsp8",image:"image-XxZuJ","indicator-layer":"indicator-layer-EpiA6","side-drawer-layer":"side-drawer-layer-CZtJ1"}},47641:e=>{e.exports={"search-container":"search-container-uXEFf","search-content":"search-content-LX6un","search-row":"search-row-EQLaD","search-hints-wrapper":"search-hints-wrapper-IjhmE","search-hints-title-container":"search-hints-title-container-MXt8W","search-hints-title":"search-hints-title-cigX3","search-hints-container":"search-hints-container-FHpPM","search-hint-container":"search-hint-container-kd8iX",icon:"icon-fOZZl",label:"label-l6wxz","message-container":"message-container-YAunr",image:"image-Xuwya","message-label":"message-label-K8LPz","search-row-poster":"search-row-poster-m7CUE","search-row-square":"search-row-square-VesJA","search-row-landscape":"search-row-landscape-o3Lfv"}},47049:e=>{e.exports={"trakt-container":"trakt-container-wWlM8"}},22002:e=>{e.exports={user:"user-qhCA4","user-info-content":"user-info-content-uzAvu","avatar-container":"avatar-container-DeGD6","email-logout-container":"email-logout-container-YPJlN","email-label-container":"email-label-container-NEqIq","email-label":"email-label-LXltS","user-panel-container":"user-panel-container-WxLTU","user-panel-label":"user-panel-label-KmZCD"}},19935:e=>{e.exports={info:"info-nBG5H",label:"label-ldqPK"}},25837:e=>{e.exports={menu:"menu-xeE06",button:"button-DNmYL",selected:"selected-S7SeK",spacing:"spacing-PVpEn","version-info-label":"version-info-label-rSTCy"}},40685:e=>{e.exports={"settings-container":"settings-container-_g1tS","settings-content":"settings-content-co5eU","sections-container":"sections-container-ZaZpD"}},70805:e=>{e.exports={"shortcuts-group":"shortcuts-group-lFLEk"}},82217:e=>{e.exports={"configure-input-container":"configure-input-container-IqUdN",label:"label-bkapj","configure-button-container":"configure-button-container-tJJ5b",icon:"icon-DoVQm"}},7956:e=>{e.exports={"add-item":"add-item-EBrwa",input:"input-iITch",actions:"actions-a9mxc",add:"add-IsY_6",cancel:"cancel-gSD5_",icon:"icon-lYjLQ"}},44612:e=>{e.exports={item:"item-A9qrP",content:"content-SRbPn",selectable:"selectable-qF2vl",label:"label-WLvfI",actions:"actions-QcMQ_",status:"status-crByJ",icon:"icon-aswqE",ready:"ready-VKkmT",error:"error-sL3We",delete:"delete-mV6G_"}},31310:e=>{e.exports={wrapper:"wrapper-mdG7D",header:"header-epxi0",label:"label-Yi3xl",content:"content-XG6N_",item:"item-hsmmX",footer:"footer-Bo7gV","add-url":"add-url-fEacA",icon:"icon-L0f3e",reload:"reload-OVkwB"}},98170:e=>{e.exports={category:"category-GP0hI",heading:"heading-XePFl",label:"label-N_O2v",icon:"icon-oZoyV"}},58106:e=>{e.exports={link:"link-FrL1t",label:"label-PJvSJ"}},89628:e=>{e.exports={option:"option-vFOAS",heading:"heading-dYMDt",content:"content-P2T0i",icon:"icon-fE4hv",label:"label-qI6Vh"}},29972:e=>{e.exports={section:"section-hcYuV",label:"label-wXG3e"}},24922:(e,t,a)=>{var i="function"==typeof Map&&Map.prototype,o=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,E=i&&o&&"function"==typeof o.get?o.get:null,n=i&&Map.prototype.forEach,_="function"==typeof Set&&Set.prototype,r=Object.getOwnPropertyDescriptor&&_?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,T=_&&r&&"function"==typeof r.get?r.get:null,S=_&&Set.prototype.forEach,s="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,l="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,I="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,A=Boolean.prototype.valueOf,O=Object.prototype.toString,u=Function.prototype.toString,d=String.prototype.match,N=String.prototype.slice,R=String.prototype.replace,c=String.prototype.toUpperCase,m=String.prototype.toLowerCase,L=RegExp.prototype.test,D=Array.prototype.concat,C=Array.prototype.join,p=Array.prototype.slice,h=Math.floor,P="function"==typeof BigInt?BigInt.prototype.valueOf:null,B=Object.getOwnPropertySymbols,f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,g="function"==typeof Symbol&&"object"==typeof Symbol.iterator,v="function"==typeof Symbol&&Symbol.toStringTag&&(typeof Symbol.toStringTag===g||"symbol")?Symbol.toStringTag:null,M=Object.prototype.propertyIsEnumerable,W=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function U(e,t){if(e===1/0||e===-1/0||e!=e||e&&e>-1e3&&e<1e3||L.call(/e/,t))return t;var a=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof e){var i=e<0?-h(-e):h(e);if(i!==e){var o=String(i),E=N.call(t,o.length+1);return R.call(o,a,"$&_")+"."+R.call(R.call(E,/([0-9]{3})/g,"$&_"),/_$/,"")}}return R.call(t,a,"$&_")}var G=a(22179),y=G.custom,b=K(y)?y:null,k={__proto__:null,double:'"',single:"'"},F={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};function V(e,t,a){var i=a.quoteStyle||t,o=k[i];return o+e+o}function H(e){return R.call(String(e),/"/g,""")}function Y(e){return!v||!("object"==typeof e&&(v in e||void 0!==e[v]))}function w(e){return"[object Array]"===Q(e)&&Y(e)}function z(e){return"[object RegExp]"===Q(e)&&Y(e)}function K(e){if(g)return e&&"object"==typeof e&&e instanceof Symbol;if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!f)return!1;try{return f.call(e),!0}catch(e){}return!1}e.exports=function e(t,i,o,_){var r=i||{};if(x(r,"quoteStyle")&&!x(k,r.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(x(r,"maxStringLength")&&("number"==typeof r.maxStringLength?r.maxStringLength<0&&r.maxStringLength!==1/0:null!==r.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var O=!x(r,"customInspect")||r.customInspect;if("boolean"!=typeof O&&"symbol"!==O)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(x(r,"indent")&&null!==r.indent&&"\t"!==r.indent&&!(parseInt(r.indent,10)===r.indent&&r.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(x(r,"numericSeparator")&&"boolean"!=typeof r.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var c=r.numericSeparator;if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return $(t,r);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var L=String(t);return c?U(t,L):L}if("bigint"==typeof t){var h=String(t)+"n";return c?U(t,h):h}var B=void 0===r.depth?5:r.depth;if(void 0===o&&(o=0),o>=B&&B>0&&"object"==typeof t)return w(t)?"[Array]":"[Object]";var y=(function(e,t){var a;if("\t"===e.indent)a="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;a=C.call(Array(e.indent+1)," ")}return{base:a,prev:C.call(Array(t+1),a)}})(r,o);if(void 0===_)_=[];else if(X(_,t)>=0)return"[Circular]";function F(t,a,i){if(a&&(_=p.call(_)).push(a),i){var E={depth:r.depth};return x(r,"quoteStyle")&&(E.quoteStyle=r.quoteStyle),e(t,E,o+1,_)}return e(t,r,o+1,_)}if("function"==typeof t&&!z(t)){var j=(function(e){if(e.name)return e.name;var t=d.call(u.call(e),/^function\s*([\w$]+)/);if(t)return t[1];return null})(t),q=ae(t,F);return"[Function"+(j?": "+j:" (anonymous)")+"]"+(q.length>0?" { "+C.call(q,", ")+" }":"")}if(K(t)){var ie=g?R.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):f.call(t);return"object"!=typeof t||g?ie:J(ie)}if((function(e){if(!e||"object"!=typeof e)return!1;if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement)return!0;return"string"==typeof e.nodeName&&"function"==typeof e.getAttribute})(t)){for(var oe="<"+m.call(String(t.nodeName)),Ee=t.attributes||[],ne=0;ne"}if(w(t)){if(0===t.length)return"[]";var _e=ae(t,F);return y&&!(function(e){for(var t=0;t=0)return!1;return!0})(_e)?"["+te(_e,y)+"]":"[ "+C.call(_e,", ")+" ]"}if((function(e){return"[object Error]"===Q(e)&&Y(e)})(t)){var re=ae(t,F);return"cause"in Error.prototype||!("cause"in t)||M.call(t,"cause")?0===re.length?"["+String(t)+"]":"{ ["+String(t)+"] "+C.call(re,", ")+" }":"{ ["+String(t)+"] "+C.call(D.call("[cause]: "+F(t.cause),re),", ")+" }"}if("object"==typeof t&&O){if(b&&"function"==typeof t[b]&&G)return G(t,{depth:B-o});if("symbol"!==O&&"function"==typeof t.inspect)return t.inspect()}if((function(e){if(!E||!e||"object"!=typeof e)return!1;try{E.call(e);try{T.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1})(t)){var Te=[];return n&&n.call(t,function(e,a){Te.push(F(a,t,!0)+" => "+F(e,t))}),ee("Map",E.call(t),Te,y)}if((function(e){if(!T||!e||"object"!=typeof e)return!1;try{T.call(e);try{E.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1})(t)){var Se=[];return S&&S.call(t,function(e){Se.push(F(e,t))}),ee("Set",T.call(t),Se,y)}if((function(e){if(!s||!e||"object"!=typeof e)return!1;try{s.call(e,s);try{l.call(e,l)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1})(t))return Z("WeakMap");if((function(e){if(!l||!e||"object"!=typeof e)return!1;try{l.call(e,l);try{s.call(e,s)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1})(t))return Z("WeakSet");if((function(e){if(!I||!e||"object"!=typeof e)return!1;try{return I.call(e),!0}catch(e){}return!1})(t))return Z("WeakRef");if((function(e){return"[object Number]"===Q(e)&&Y(e)})(t))return J(F(Number(t)));if((function(e){if(!e||"object"!=typeof e||!P)return!1;try{return P.call(e),!0}catch(e){}return!1})(t))return J(F(P.call(t)));if((function(e){return"[object Boolean]"===Q(e)&&Y(e)})(t))return J(A.call(t));if((function(e){return"[object String]"===Q(e)&&Y(e)})(t))return J(F(String(t)));if("undefined"!=typeof window&&t===window)return"{ [object Window] }";if("undefined"!=typeof globalThis&&t===globalThis||void 0!==a.g&&t===a.g)return"{ [object globalThis] }";if(!(function(e){return"[object Date]"===Q(e)&&Y(e)})(t)&&!z(t)){var se=ae(t,F),le=W?W(t)===Object.prototype:t instanceof Object||t.constructor===Object,Ie=t instanceof Object?"":"null prototype",Ae=!le&&v&&Object(t)===t&&v in t?N.call(Q(t),8,-1):Ie?"Object":"",Oe=(le||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(Ae||Ie?"["+C.call(D.call([],Ae||[],Ie||[]),": ")+"] ":"");return 0===se.length?Oe+"{}":y?Oe+"{"+te(se,y)+"}":Oe+"{ "+C.call(se,", ")+" }"}return String(t)};var j=Object.prototype.hasOwnProperty||function(e){return e in this};function x(e,t){return j.call(e,t)}function Q(e){return O.call(e)}function X(e,t){if(e.indexOf)return e.indexOf(t);for(var a=0,i=e.length;at.maxStringLength){var a=e.length-t.maxStringLength,i="... "+a+" more character"+(a>1?"s":"");return $(N.call(e,0,t.maxStringLength),t)+i}var o=F[t.quoteStyle||"single"];return o.lastIndex=0,V(R.call(R.call(e,o,"\\$1"),/[\x00-\x1f]/g,q),"single",t)}function q(e){var t=e.charCodeAt(0),a={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return a?"\\"+a:"\\x"+(t<16?"0":"")+c.call(t.toString(16))}function J(e){return"Object("+e+")"}function Z(e){return e+" { ? }"}function ee(e,t,a,i){return e+" ("+t+") {"+(i?te(a,i):C.call(a,", "))+"}"}function te(e,t){if(0===e.length)return"";var a="\n"+t.prev+t.base;return a+C.call(e,","+a)+"\n"+t.prev}function ae(e,t){var a=w(e),i=[];if(a){i.length=e.length;for(var o=0;o{"use strict";var i=a(62985);function o(){}function E(){}E.resetWarningCache=o,e.exports=function(){function e(e,t,a,o,E,n){if(n!==i){var _=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw _.name="Invariant Violation",_}}function t(){return e}e.isRequired=e;var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:E,resetWarningCache:o};return a.PropTypes=a,a}},2736:(e,t,a)=>{e.exports=a(16186)()},62985:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},65846:function(e,t,a){var i;e=a.nmd(e),(function(){t&&t.nodeType,e&&e.nodeType;var o="object"==typeof a.g&&a.g;o.global!==o&&o.window!==o&&o.self;var E,n=2147483647,_=36,r=/^xn--/,T=/[^\x20-\x7E]/,S=/[\x2E\u3002\uFF0E\uFF61]/g,s={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},l=Math.floor,I=String.fromCharCode;function A(e){throw new RangeError(s[e])}function O(e,t){for(var a=e.length,i=[];a--;)i[a]=t(e[a]);return i}function u(e,t){var a=e.split("@"),i="";return a.length>1&&(i=a[0]+"@",e=a[1]),i+O((e=e.replace(S,".")).split("."),t).join(".")}function d(e){for(var t,a,i=[],o=0,E=e.length;o=55296&&t<=56319&&o65535&&(t+=I((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=I(e)}).join("")}function R(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:_}function c(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function m(e,t,a){var i=0;for(e=a?l(e/700):e>>1,e+=l(e/t);e>455;i+=_)e=l(e/35);return l(i+36*e/(e+38))}function L(e){var t,a,i,o,E,r,T,S,s,I,O=[],u=e.length,d=0,c=128,L=72;for((a=e.lastIndexOf("-"))<0&&(a=0),i=0;i=128&&A("not-basic"),O.push(e.charCodeAt(i));for(o=a>0?a+1:0;o=u&&A("invalid-input"),((S=R(e.charCodeAt(o++)))>=_||S>l((n-d)/r))&&A("overflow"),d+=S*r,!(S<(s=T<=L?1:T>=L+26?26:T-L));T+=_)r>l(n/(I=_-s))&&A("overflow"),r*=I;L=m(d-E,t=O.length+1,0==E),l(d/t)>n-c&&A("overflow"),c+=l(d/t),d%=t,O.splice(d++,0,c)}return N(O)}function D(e){var t,a,i,o,E,r,T,S,s,O,u,N,R,L,D,C=[];for(N=(e=d(e)).length,t=128,a=0,E=72,r=0;r=t&&ul((n-a)/(R=i+1))&&A("overflow"),a+=(T-t)*R,t=T,r=0;rn&&A("overflow"),u==t){for(S=a,s=_;!(S<(O=s<=E?1:s>=E+26?26:s-E));s+=_)D=S-O,L=_-O,C.push(I(c(O+D%L,0))),S=l(D/L);C.push(I(c(S,0))),E=m(a,R,i==o),a=0,++i}++a,++t}return C.join("")}E={version:"1.4.1",ucs2:{decode:d,encode:N},decode:L,encode:D,toASCII:function(e){return u(e,function(e){return T.test(e)?"xn--"+D(e):e})},toUnicode:function(e){return u(e,function(e){return r.test(e)?L(e.slice(4).toLowerCase()):e})}},void 0===(i=function(){return E}.call(t,a,t,e))||(e.exports=i)})()},76260:e=>{"use strict";var t=String.prototype.replace,a=/%20/g,i="RFC1738",o="RFC3986";e.exports={default:o,formatters:{RFC1738:function(e){return t.call(e,a,"+")},RFC3986:function(e){return String(e)}},RFC1738:i,RFC3986:o}},75004:(e,t,a)=>{"use strict";var i=a(66833),o=a(25167),E=a(76260);e.exports={formats:E,parse:o,stringify:i}},25167:(e,t,a)=>{"use strict";var i=a(36693),o=Object.prototype.hasOwnProperty,E=Array.isArray,n={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:i.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},_=function(e){return e.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},r=function(e,t,a){if(e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1)return e.split(",");if(t.throwOnLimitExceeded&&a>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");return e},T=function(e,t,a,E){if(e){var n=a.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,_=/(\[[^[\]]*])/g,T=a.depth>0&&/(\[[^[\]]*])/.exec(n),S=T?n.slice(0,T.index):n,s=[];if(S){if(!a.plainObjects&&o.call(Object.prototype,S)&&!a.allowPrototypes)return;s.push(S)}for(var l=0;a.depth>0&&null!==(T=_.exec(n))&&l0&&"[]"===e[e.length-1]){var n=e.slice(0,-1).join("");E=Array.isArray(t)&&t[n]?t[n].length:0}for(var _=o?t:r(t,a,E),T=e.length-1;T>=0;--T){var S,s=e[T];if("[]"===s&&a.parseArrays)S=a.allowEmptyArrays&&(""===_||a.strictNullHandling&&null===_)?[]:i.combine([],_);else{S=a.plainObjects?{__proto__:null}:{};var l="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,I=a.decodeDotInKeys?l.replace(/%2E/g,"."):l,A=parseInt(I,10);a.parseArrays||""!==I?!isNaN(A)&&s!==I&&String(A)===I&&A>=0&&a.parseArrays&&A<=a.arrayLimit?(S=[])[A]=_:"__proto__"!==I&&(S[I]=_):S={0:_}}_=S}return _})(s,t,a,E)}};e.exports=function(e,t){var a=(function(e){if(!e)return n;if(void 0!==e.allowEmptyArrays&&"boolean"!=typeof e.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==e.decodeDotInKeys&&"boolean"!=typeof e.decodeDotInKeys)throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(void 0!==e.throwOnLimitExceeded&&"boolean"!=typeof e.throwOnLimitExceeded)throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var t=void 0===e.charset?n.charset:e.charset,a=void 0===e.duplicates?n.duplicates:e.duplicates;if("combine"!==a&&"first"!==a&&"last"!==a)throw new TypeError("The duplicates option must be either combine, first, or last");return{allowDots:void 0===e.allowDots?!0===e.decodeDotInKeys||n.allowDots:!!e.allowDots,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:n.allowEmptyArrays,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:n.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:n.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:n.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:n.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:n.comma,decodeDotInKeys:"boolean"==typeof e.decodeDotInKeys?e.decodeDotInKeys:n.decodeDotInKeys,decoder:"function"==typeof e.decoder?e.decoder:n.decoder,delimiter:"string"==typeof e.delimiter||i.isRegExp(e.delimiter)?e.delimiter:n.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:n.depth,duplicates:a,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:n.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:n.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:n.plainObjects,strictDepth:"boolean"==typeof e.strictDepth?!!e.strictDepth:n.strictDepth,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:n.strictNullHandling,throwOnLimitExceeded:"boolean"==typeof e.throwOnLimitExceeded&&e.throwOnLimitExceeded}})(t);if(""===e||null==e)return a.plainObjects?{__proto__:null}:{};for(var S="string"==typeof e?(function(e,t){var a={__proto__:null},T=t.ignoreQueryPrefix?e.replace(/^\?/,""):e;T=T.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var S=t.parameterLimit===1/0?void 0:t.parameterLimit,s=T.split(t.delimiter,t.throwOnLimitExceeded?S+1:S);if(t.throwOnLimitExceeded&&s.length>S)throw new RangeError("Parameter limit exceeded. Only "+S+" parameter"+(1===S?"":"s")+" allowed.");var l,I=-1,A=t.charset;if(t.charsetSentinel)for(l=0;l-1&&(u=E(u)?[u]:u);var c=o.call(a,O);c&&"combine"===t.duplicates?a[O]=i.combine(a[O],u):c&&"last"!==t.duplicates||(a[O]=u)}return a})(e,a):e,s=a.plainObjects?{__proto__:null}:{},l=Object.keys(S),I=0;I{"use strict";var i=a(15717),o=a(36693),E=a(76260),n=Object.prototype.hasOwnProperty,_={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},r=Array.isArray,T=Array.prototype.push,S=function(e,t){T.apply(e,r(t)?t:[t])},s=Date.prototype.toISOString,l=E.default,I={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:o.encode,encodeValuesOnly:!1,filter:void 0,format:l,formatter:E.formatters[l],indices:!1,serializeDate:function(e){return s.call(e)},skipNulls:!1,strictNullHandling:!1},A={},O=function e(t,a,E,n,_,T,s,l,O,u,d,N,R,c,m,L,D,C){for(var p,h=t,P=C,B=0,f=!1;void 0!==(P=P.get(A))&&!f;){var g=P.get(t);if(B+=1,void 0!==g){if(g===B)throw new RangeError("Cyclic object value");f=!0}void 0===P.get(A)&&(B=0)}if("function"==typeof u?h=u(a,h):h instanceof Date?h=R(h):"comma"===E&&r(h)&&(h=o.maybeMap(h,function(e){return e instanceof Date?R(e):e})),null===h){if(T)return O&&!L?O(a,I.encoder,D,"key",c):a;h=""}if("string"==typeof(p=h)||"number"==typeof p||"boolean"==typeof p||"symbol"==typeof p||"bigint"==typeof p||o.isBuffer(h))return O?[m(L?a:O(a,I.encoder,D,"key",c))+"="+m(O(h,I.encoder,D,"value",c))]:[m(a)+"="+m(String(h))];var v,M=[];if(void 0===h)return M;if("comma"===E&&r(h))L&&O&&(h=o.maybeMap(h,O)),v=[{value:h.length>0?h.join(",")||null:void 0}];else if(r(u))v=u;else{var W=Object.keys(h);v=d?W.sort(d):W}var U=l?String(a).replace(/\./g,"%2E"):String(a),G=n&&r(h)&&1===h.length?U+"[]":U;if(_&&r(h)&&0===h.length)return G+"[]";for(var y=0;y0?m+c:""}},36693:(e,t,a)=>{"use strict";var i=a(76260),o=Object.prototype.hasOwnProperty,E=Array.isArray,n=(function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e})(),_=function(e,t){for(var a=t&&t.plainObjects?{__proto__:null}:{},i=0;i1;){var t=e.pop(),a=t.obj[t.prop];if(E(a)){for(var i=[],o=0;o=r?_.slice(S,S+r):_,l=[],I=0;I=48&&A<=57||A>=65&&A<=90||A>=97&&A<=122||E===i.RFC1738&&(40===A||41===A)?l[l.length]=s.charAt(I):A<128?l[l.length]=n[A]:A<2048?l[l.length]=n[192|A>>6]+n[128|63&A]:A<55296||A>=57344?l[l.length]=n[224|A>>12]+n[128|A>>6&63]+n[128|63&A]:(I+=1,A=65536+((1023&A)<<10|1023&s.charCodeAt(I)),l[l.length]=n[240|A>>18]+n[128|A>>12&63]+n[128|A>>6&63]+n[128|63&A])}T+=l.join("")}return T},isBuffer:function(e){return!(!e||"object"!=typeof e)&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function(e,t){if(E(e)){for(var a=[],i=0;i{"use strict";var i=a(30758),o=a(31896);function E(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,a=1;a