diff --git a/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/binaries/stremio_core_web_bg.wasm b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/binaries/stremio_core_web_bg.wasm
new file mode 100644
index 000000000..2b186542e
Binary files /dev/null and b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/binaries/stremio_core_web_bg.wasm differ
diff --git a/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/favicons/favicon.ico b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/favicons/favicon.ico
new file mode 100644
index 000000000..17ef6fc70
Binary files /dev/null and b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/favicons/favicon.ico differ
diff --git a/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/favicons/icon_256x256.ico b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/favicons/icon_256x256.ico
new file mode 100644
index 000000000..17ef6fc70
Binary files /dev/null and b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/favicons/icon_256x256.ico differ
diff --git a/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/fonts/PlusJakartaSans.ttf b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/fonts/PlusJakartaSans.ttf
new file mode 100644
index 000000000..b88589a39
Binary files /dev/null and b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/fonts/PlusJakartaSans.ttf differ
diff --git a/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/anonymous.png b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/anonymous.png
new file mode 100644
index 000000000..64dfe240d
Binary files /dev/null and b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/anonymous.png differ
diff --git a/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/background_1.svg b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/background_1.svg
new file mode 100644
index 000000000..3a48df873
--- /dev/null
+++ b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/background_1.svg
@@ -0,0 +1,15 @@
+
diff --git a/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/background_2.svg b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/background_2.svg
new file mode 100644
index 000000000..a1dea35fc
--- /dev/null
+++ b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/background_2.svg
@@ -0,0 +1,13 @@
+
diff --git a/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/calendar_placeholder.png b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/calendar_placeholder.png
new file mode 100644
index 000000000..5ae490b6c
Binary files /dev/null and b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/calendar_placeholder.png differ
diff --git a/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/default_avatar.png b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/default_avatar.png
new file mode 100644
index 000000000..6d4b4092b
Binary files /dev/null and b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/default_avatar.png differ
diff --git a/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/empty.png b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/empty.png
new file mode 100644
index 000000000..7db7324e5
Binary files /dev/null and b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/empty.png differ
diff --git a/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/icon.png b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/icon.png
new file mode 100644
index 000000000..301d114bc
Binary files /dev/null and b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/icon.png differ
diff --git a/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/icon_196x196.png b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/icon_196x196.png
new file mode 100644
index 000000000..d5bc3e90f
Binary files /dev/null and b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/icon_196x196.png differ
diff --git a/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/icon_512x512.png b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/icon_512x512.png
new file mode 100644
index 000000000..9569431ed
Binary files /dev/null and b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/icon_512x512.png differ
diff --git a/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/logo.png b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/logo.png
new file mode 100644
index 000000000..39601b514
Binary files /dev/null and b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/logo.png differ
diff --git a/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/maskable_icon.png b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/maskable_icon.png
new file mode 100644
index 000000000..2259a3263
Binary files /dev/null and b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/maskable_icon.png differ
diff --git a/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/stremio_symbol.png b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/stremio_symbol.png
new file mode 100644
index 000000000..28d3ccb4e
Binary files /dev/null and b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/images/stremio_symbol.png differ
diff --git a/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/screenshots/board_narrow.webp b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/screenshots/board_narrow.webp
new file mode 100644
index 000000000..9f6afe4eb
Binary files /dev/null and b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/screenshots/board_narrow.webp differ
diff --git a/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/screenshots/board_wide.webp b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/screenshots/board_wide.webp
new file mode 100644
index 000000000..211db49ec
Binary files /dev/null and b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/screenshots/board_wide.webp differ
diff --git a/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/scripts/main.js b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/scripts/main.js
new file mode 100644
index 000000000..b2ec44fca
--- /dev/null
+++ b/feat/addons-one-click-actions/865907b7ae01152409fb81a58ef89d7c9c75c046/scripts/main.js
@@ -0,0 +1,2 @@
+(()=>{var e,t,a={72888:(e,t,a)=>{"use strict";var i=a(33112),o=i(a(60326)),n=i(a(37731));e.exports=function(e,t){t.addEventListener("message",(function(){var a=(0,n.default)(o.default.mark((function a(i){var n,r,E,_,T,s,S;return o.default.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(n=i.data.request){a.next=3;break}return a.abrupt("return");case 3:if(r=n.id,E=n.path,_=n.args,a.prev=4,"function"!=typeof(T=E.reduce((function(e,t){return e[t]}),e))){a.next=13;break}return S=E.slice(0,E.length-1).reduce((function(e,t){return e[t]}),e),a.next=10,T.apply(S,_);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:r,result:{data:s}}}),a.next=22;break;case 19:a.prev=19,a.t0=a.catch(4),t.postMessage({response:{id:r,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,n.default)(o.default.mark((function e(a,i){var n;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Math.random().toString(32).slice(2),e.abrupt("return",new Promise((function(e,o){t.addEventListener("message",(function a(i){var r=i.data.response;r&&r.id===n&&(t.removeEventListener("message",a),"error"in r.result?o(r.result.error):e(r.result.data))})),t.postMessage({request:{id:n,path:a,args:i}})})));case 2:case"end":return e.stop()}}),e)})));return function(t,a){return e.apply(this,arguments)}})()}},92255: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 n(e,t,i,n,r){if("function"!=typeof i)throw new TypeError("The listener must be a function");var E=new o(i,n||e,r),_=a?a+t:t;return e._events[_]?e._events[_].fn?e._events[_]=[e._events[_],E]:e._events[_].push(E):(e._events[_]=E,e._eventsCount++),e}function r(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function E(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(a=!1)),E.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},E.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,n=i.length,r=new Array(n);o= 0x80 (not a basic code point)","invalid-input":"Invalid input"},l=Math.floor,I=String.fromCharCode;function u(e){throw RangeError(S[e])}function A(e,t){for(var a=e.length,i=[];a--;)i[a]=t(e[a]);return i}function d(e,t){var a=e.split("@"),i="";return a.length>1&&(i=a[0]+"@",e=a[1]),i+A((e=e.replace(s,".")).split("."),t).join(".")}function O(e){for(var t,a,i=[],o=0,n=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,t){return e+22+75*(e<26)-((0!=t)<<5)}function N(e,t,a){var i=0;for(e=a?l(e/700):e>>1,e+=l(e/t);e>455;i+=E)e=l(e/35);return l(i+36*e/(e+38))}function m(e){var t,a,i,o,n,_,T,s,S,I,A,d=[],O=e.length,R=0,m=128,L=72;for((a=e.lastIndexOf("-"))<0&&(a=0),i=0;i=128&&u("not-basic"),d.push(e.charCodeAt(i));for(o=a>0?a+1:0;o=O&&u("invalid-input"),((s=(A=e.charCodeAt(o++))-48<10?A-22:A-65<26?A-65:A-97<26?A-97:E)>=E||s>l((r-R)/_))&&u("overflow"),R+=s*_,!(s<(S=T<=L?1:T>=L+26?26:T-L));T+=E)_>l(r/(I=E-S))&&u("overflow"),_*=I;L=N(R-n,t=d.length+1,0==n),l(R/t)>r-m&&u("overflow"),m+=l(R/t),R%=t,d.splice(R++,0,m)}return c(d)}function L(e){var t,a,i,o,n,_,T,s,S,A,d,c,m,L,D,p=[];for(c=(e=O(e)).length,t=128,a=0,n=72,_=0;_=t&&dl((r-a)/(m=i+1))&&u("overflow"),a+=(T-t)*m,t=T,_=0;_r&&u("overflow"),d==t){for(s=a,S=E;!(s<(A=S<=n?1:S>=n+26?26:S-n));S+=E)D=s-A,L=E-A,p.push(I(R(A+D%L,0))),s=l(D/L);p.push(I(R(s,0))),n=N(a,m,i==o),a=0,++i}++a,++t}return p.join("")}n={version:"1.3.2",ucs2:{decode:O,encode:c},decode:m,encode:L,toASCII:function(e){return d(e,(function(e){return T.test(e)?"xn--"+L(e):e}))},toUnicode:function(e){return d(e,(function(e){return _.test(e)?m(e.slice(4).toLowerCase()):e}))}},void 0===(i=function(){return n}.call(t,a,t,e))||(e.exports=i)})()},36372:(e,t,a)=>{"use strict";var i=a(11176),o=a(89637);function n(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}t.parse=R,t.resolve=function(e,t){return R(e,!1,!0).resolve(t)},t.resolveObject=function(e,t){return e?R(e,!1,!0).resolveObject(t):t},t.format=function(e){o.isString(e)&&(e=R(e));return e instanceof n?e.format():n.prototype.format.call(e)},t.Url=n;var r=/^([a-z0-9.+-]+:)/i,E=/:[0-9]*$/,_=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,T=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),s=["'"].concat(T),S=["%","/","?",";","#"].concat(s),l=["/","?","#"],I=/^[+a-z0-9A-Z_-]{0,63}$/,u=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,A={javascript:!0,"javascript:":!0},d={javascript:!0,"javascript:":!0},O={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},c=a(47186);function R(e,t,a){if(e&&o.isObject(e)&&e instanceof n)return e;var i=new n;return i.parse(e,t,a),i}n.prototype.parse=function(e,t,a){if(!o.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var n=e.indexOf("?"),E=-1!==n&&n127?W+="x":W+=M[y];if(!W.match(I)){var U=g.slice(0,f),G=g.slice(f+1),k=M.match(u);k&&(U.push(k[1]),G.unshift(k[2])),G.length&&(R="/"+G.join(".")+R),this.hostname=U.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),B||(this.hostname=i.toASCII(this.hostname));var F=this.port?":"+this.port:"",V=this.hostname||"";this.host=V+F,this.href+=this.host,B&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==R[0]&&(R="/"+R))}if(!A[L])for(f=0,v=s.length;f0)&&a.host.split("@"))&&(a.auth=B.shift(),a.host=a.hostname=B.shift());return a.search=e.search,a.query=e.query,o.isNull(a.pathname)&&o.isNull(a.search)||(a.path=(a.pathname?a.pathname:"")+(a.search?a.search:"")),a.href=a.format(),a}if(!D.length)return a.pathname=null,a.search?a.path="/"+a.search:a.path=null,a.href=a.format(),a;for(var h=D.slice(-1)[0],C=(a.host||e.host||D.length>1)&&("."===h||".."===h)||""===h,f=0,P=D.length;P>=0;P--)"."===(h=D[P])?D.splice(P,1):".."===h?(D.splice(P,1),f++):f&&(D.splice(P,1),f--);if(!m&&!L)for(;f--;f)D.unshift("..");!m||""===D[0]||D[0]&&"/"===D[0].charAt(0)||D.unshift(""),C&&"/"!==D.join("/").substr(-1)&&D.push("");var B,g=""===D[0]||D[0]&&"/"===D[0].charAt(0);p&&(a.hostname=a.host=g?"":D.length?D.shift():"",(B=!!(a.host&&a.host.indexOf("@")>0)&&a.host.split("@"))&&(a.auth=B.shift(),a.host=a.hostname=B.shift()));return(m=m||a.host&&D.length)&&!g&&D.unshift(""),D.length?a.pathname=D.join("/"):(a.pathname=null,a.path=null),o.isNull(a.pathname)&&o.isNull(a.search)||(a.path=(a.pathname?a.pathname:"")+(a.search?a.search:"")),a.auth=e.auth||a.auth,a.slashes=a.slashes||e.slashes,a.href=a.format(),a},n.prototype.parseHost=function(){var e=this.host,t=E.exec(e);t&&(":"!==(t=t[0])&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},89637:e=>{"use strict";e.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},47426:(e,t,a)=>{var i=a(92255),o=a(18387);function n(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 n=a.getCastDevice();if(null===n)throw new Error("Chromecast session must be started");var r=document.createElement("div");r.style.display="flex",r.style.flexDirection="row",r.style.alignItems="center",r.style.justifyContent="center",r.style.width="100%",r.style.height="100%",r.style.backgroundColor="black";var E=document.createElement("div");E.style.flex="none",E.style.maxWidth="80%",E.style.fontSize="5vmin",E.style.lineHeight="1.2em",E.style.maxHeight="3.6em",E.style.textAlign="center",E.style.color="#FFFFFF90",E.innerText="Casting to "+n.friendlyName,r.appendChild(E),t.appendChild(r),a.on("message",I),a.on("message-error",l);var _=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){_.emit("error",Object.assign({},o.CHROMECAST_SENDER_VIDEO.MESSAGE_SEND_FAILED,{error:e,action:t}))}function l(e){_.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:[];_.emit.apply(_,[e.event].concat(t))}else l(new Error("Invalid message: "+e))}function u(e,t){s[e]&&_.emit("propChanged",e,t)}this.on=function(e,t){if(T)throw new Error("Video is destroyed");_.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,u("stream",null),u("loaded",null),u("paused",null),u("time",null),u("duration",null),u("buffering",null),u("buffered",null),u("audioTracks",[]),u("selectedAudioTrackId",[]),u("subtitlesTracks",[]),u("selectedSubtitlesTrackId",null),u("subtitlesOffset",null),u("subtitlesSize",null),u("subtitlesTextColor",null),u("subtitlesBackgroundColor",null),u("subtitlesOutlineColor",null),u("volume",null),u("muted",null),u("playbackSpeed",null),u("videoParams",null),u("extraSubtitlesTracks",[]),u("selectedExtraSubtitlesTrackId",null),u("extraSubtitlesDelay",null),u("extraSubtitlesSize",null),u("extraSubtitlesOffset",null),u("extraSubtitlesTextColor",null),u("extraSubtitlesBackgroundColor",null),u("extraSubtitlesOutlineColor",null),_.removeAllListeners(),a.off("message",I),t.removeChild(r)),void a.sendMessage(e).catch((function(t){S(t,e)}))}var i,o;throw new Error("Invalid action dispatched: "+JSON.stringify(e))}}n.canPlayStream=function(){return Promise.resolve(!0)},n.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=n},52369:(e,t,a)=>{var i=a(47426);e.exports=i},7370:(e,t,a)=>{var i=a(92255),o=a(39473),n=a(67193),r=a(52653),E=a(2520),_=a(18387),T=a(78377),s=a(1961);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: rgb(34, 34, 34) 1px 1px 0.1em; }");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(u)return;var e;switch(S.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}N(Object.assign({},e,{critical:!0,error:S.error}))})()},S.onended=function(){I.emit("ended")},S.onpause=function(){m("paused")},S.onplay=function(){m("paused")},S.ontimeupdate=function(){m("time"),m("buffered")},S.ondurationchange=function(){m("duration")},S.onwaiting=function(){m("buffering"),m("buffered")},S.onseeking=function(){m("time"),m("buffering"),m("buffered")},S.onseeked=function(){m("time"),m("buffering"),m("buffered")},S.onstalled=function(){m("buffering"),m("buffered")},S.onplaying=function(){m("time"),m("buffering"),m("buffered")},S.oncanplay=function(){m("buffering"),m("buffered")},S.canplaythrough=function(){m("buffering"),m("buffered")},S.onloadedmetadata=function(){m("loaded")},S.onloadeddata=function(){m("buffering"),m("buffered")},S.onvolumechange=function(){m("volume"),m("muted")},S.onratechange=function(){m("playbackSpeed")},S.textTracks.onchange=function(){m("subtitlesTracks"),m("selectedSubtitlesTrackId"),R(),Array.from(S.textTracks).forEach((function(e){e.oncuechange=R}))},t.appendChild(S);var l=null,I=new i,u=!1,A=null,d=0,O={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 c(e){switch(e){case"stream":return A;case"loaded":return null===A?null:S.readyState>=S.HAVE_METADATA;case"paused":return null===A?null:!!S.paused;case"time":return null!==A&&null!==S.currentTime&&isFinite(S.currentTime)?Math.floor(1e3*S.currentTime):null;case"duration":return null!==A&&null!==S.duration&&isFinite(S.duration)?Math.floor(1e3*S.duration):null;case"buffering":return null===A?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 u||null===S.volume||!isFinite(S.volume)?null:Math.floor(100*S.volume);case"muted":return u?null:!!S.muted;case"playbackSpeed":return u||null===S.playbackRate||!isFinite(S.playbackRate)?null:S.playbackRate;default:return null}}function R(){Array.from(S.textTracks).forEach((function(e){Array.from(e.cues||[]).forEach((function(e){e.snapToLines=!1,e.line=100-d}))}))}function N(e){I.emit("error",e),e.critical&&L("unload")}function m(e){O[e]&&I.emit("propChanged",e,c(e))}function L(e,i){switch(e){case"load":L("unload"),i&&i.stream&&"string"==typeof i.stream.url?(A=i.stream,m("stream"),m("loaded"),S.autoplay="boolean"!=typeof i.autoplay||i.autoplay,S.currentTime=null!==i.time&&isFinite(i.time)?parseInt(i.time,10)/1e3:0,m("paused"),m("time"),m("duration"),m("buffering"),m("buffered"),m("subtitlesTracks"),m("selectedSubtitlesTrackId"),m("audioTracks"),m("selectedAudioTrackId"),T(A).then((function(e){A===i.stream&&("application/vnd.apple.mpegurl"===e&&o.isSupported()?((l=new o(s)).on(o.Events.AUDIO_TRACKS_UPDATED,(function(){m("audioTracks"),m("selectedAudioTrackId")})),l.on(o.Events.AUDIO_TRACK_SWITCHED,(function(){m("audioTracks"),m("selectedAudioTrackId")})),l.loadSource(A.url),l.attachMedia(S)):S.src=A.url)})).catch((function(){A===i.stream&&(S.src=A.url)}))):N(Object.assign({},_.UNSUPPORTED_STREAM,{critical:!0,stream:i?i.stream:null}));break;case"unload":A=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,m("stream"),m("loaded"),m("paused"),m("time"),m("duration"),m("buffering"),m("buffered"),m("subtitlesTracks"),m("selectedSubtitlesTrackId"),m("audioTracks"),m("selectedAudioTrackId");break;case"destroy":L("unload"),u=!0,m("subtitlesOffset"),m("subtitlesSize"),m("subtitlesTextColor"),m("subtitlesBackgroundColor"),m("subtitlesOutlineColor"),m("volume"),m("muted"),m("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(u)throw new Error("Video is destroyed");I.on(e,t)},this.dispatch=function(e){if(u)throw new Error("Video is destroyed");if(e)switch((e=r(n(e))).type){case"observeProp":return t=e.propName,void(O.hasOwnProperty(t)&&(I.emit("propValue",t,c(t)),O[t]=!0));case"setProp":return void(function(e,t){switch(e){case"paused":null!==A&&(t?S.pause():S.play(),m("paused"));break;case"time":null!==A&&null!==t&&isFinite(t)&&(S.currentTime=parseInt(t,10)/1e3,m("time"));break;case"selectedSubtitlesTrackId":if(null!==A){Array.from(S.textTracks).forEach((function(e,a){e.mode="EMBEDDED_"+String(a)===t?"showing":"disabled"}));var i=c("subtitlesTracks").find((function(e){return e.id===t}));i&&(m("selectedSubtitlesTrackId"),I.emit("subtitlesTrackLoaded",i))}break;case"subtitlesOffset":null!==t&&isFinite(t)&&(d=Math.max(0,Math.min(100,parseInt(t,10))),R(),m("subtitlesOffset"));break;case"subtitlesSize":null!==t&&isFinite(t)&&(a.sheet.cssRules[0].style.fontSize=Math.floor(Math.max(0,parseInt(t,10))/25)+"vmin",m("subtitlesSize"));break;case"subtitlesTextColor":if("string"==typeof t){try{a.sheet.cssRules[0].style.color=E(t).rgb().string()}catch(e){console.error("HTMLVideo",e)}m("subtitlesTextColor")}break;case"subtitlesBackgroundColor":if("string"==typeof t){try{a.sheet.cssRules[0].style.backgroundColor=E(t).rgb().string()}catch(e){console.error("HTMLVideo",e)}m("subtitlesBackgroundColor")}break;case"subtitlesOutlineColor":if("string"==typeof t){try{a.sheet.cssRules[0].style.textShadow=E(t).rgb().string()+" 1px 1px 0.1em"}catch(e){console.error("HTMLVideo",e)}m("subtitlesOutlineColor")}break;case"selectedAudioTrackId":if(null!==l){var o=c("audioTracks").find((function(e){return e.id===t}));l.audioTrack=o?parseInt(o.id.split("_").pop(),10):-1,o&&(m("selectedAudioTrackId"),I.emit("audioTrackLoaded",o))}break;case"volume":null!==t&&isFinite(t)&&(S.muted=!1,S.volume=Math.max(0,Math.min(100,parseInt(t,10)))/100,m("muted"),m("volume"));break;case"muted":S.muted=!!t,m("muted");break;case"playbackSpeed":null!==t&&isFinite(t)&&(S.playbackRate=parseFloat(t),m("playbackSpeed"))}})(e.propName,e.propValue);case"command":return void L(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","volume","muted","playbackSpeed"],commands:["load","unload","destroy"],events:["propValue","propChanged","ended","error","subtitlesTrackLoaded","audioTrackLoaded"]},e.exports=S},78377: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!"))}},1961: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}}}}},12430:(e,t,a)=>{var i=a(7370);e.exports=i},14466:(e,t,a)=>{var i=a(92255),o=a(67193),n=a(52653),r=a(18387);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=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 E=new i,_=!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:[];E.emit.apply(E,[i].concat(o))}}}function S(e){a.contentWindow.postMessage(e,"*")}function l(e,t){T[e]&&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({},r.UNSUPPORTED_STREAM,{critical:!0,stream:i?i.stream:null}),E.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"),_=!0,E.removeAllListeners(),t.removeChild(a),!0}var o}this.on=function(e,t){if(_)throw new Error("Video is destroyed");E.on(e,t)},this.dispatch=function(e){if(_)throw new Error("Video is destroyed");if(e)switch((e=n(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))}}E.canPlayStream=function(e){return Promise.resolve(e&&"string"==typeof e.playerFrameUrl)},E.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=E},30113:(e,t,a)=>{var i=a(14466);e.exports=i},90514:(e,t,a)=>{var i=a(92255),o=a(67193),n=a(52653),r=a(18387),E=.0066,_={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",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(_).forEach((function(e){_[e]&&(l[_[e]]=e)}));var I=new Promise((function(e){t=e}));p("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","speed"),a.send("mpv-observe-prop","mpv-version"),a.send("mpv-observe-prop","ffmpeg-version");var u=new i,A=!1,d=null,O=0;function c(t){for(var a=t?"":"transparent",i=e.containerElement;i;i=i.parentElement)i.style.background=a}function R(e){console.log(e.name+": "+e.data)}var N=0;function m(e){return _[e]?S[_[e]]:(console.log("Unsupported prop requested",e),null)}function L(e){u.emit("error",e),e.critical&&p("unload")}function D(e){s[e]&&u.emit("propChanged",e,m(e))}function p(t,i){switch(t){case"load":p("unload"),i&&i.stream&&"string"==typeof i.stream.url?I.then((function(t){d=i.stream,D("stream"),c(!1),a.send("mpv-set-prop",["no-sub-ass"]);var o="Win32"===navigator.platform?"direct3d":"opengl",n=e.mpvSeparateWindow?o:"opengl-cb",r=e.mpvSeparateWindow?"yes":"no";a.send("mpv-set-prop",["vo",n]),a.send("mpv-set-prop",["osc",r]),a.send("mpv-set-prop",["input-defalt-bindings",r]),a.send("mpv-set-prop",["input-vo-keyboard",r]);var E,_,s,l=Math.floor(parseInt(i.time,10)/1e3)||0;0!==l?(E="0.39",_=T(t),s=T(E),_[0]>s[0]||!(_[0]=s[1]?a.send("mpv-command",["loadfile",d.url,"replace","-1","start=+"+l]):a.send("mpv-command",["loadfile",d.url,"replace","start=+"+l])):a.send("mpv-command",["loadfile",d.url]),a.send("mpv-set-prop",["pause",!1]),a.send("mpv-set-prop",["speed",S.speed]),a.send("mpv-set-prop",["aid",S.aid]),a.send("mpv-set-prop",["mute","no"]),D("paused"),D("time"),D("duration"),D("buffering"),D("volume"),D("muted"),D("subtitlesTracks"),D("selectedSubtitlesTrackId")})):L(Object.assign({},r.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},O=0,a.send("mpv-command",["stop"]),D("loaded"),D("stream"),D("paused"),D("time"),D("duration"),D("buffering"),D("volume"),D("muted"),D("subtitlesTracks"),D("selectedSubtitlesTrackId"),c(!0);break;case"destroy":p("unload"),A=!0,u.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&&(!O||a===O)?Math.round(1e3*e.data):null,O=O?O+a>>1:a,S.loaded=a>0,S.loaded&&D("loaded");break;case"time-pos":S[e.name]=Math.round(1e3*e.data);break;case"sub-scale":S[e.name]=Math.round(e.data/E);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?"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&&N===i||!l[e.name]||(i&&(N=i),D(l[e.name]))})),a.on("mpv-event-ended",(function(e){e.error?L(e.error):u.emit("ended")})),this.on=function(e,t){if(A)throw new Error("Video is destroyed");u.on(e,t)},this.dispatch=function(e){if(A)throw new Error("Video is destroyed");if(e)switch((e=n(o(e))).type){case"observeProp":t=e.propName,u.emit("propValue",t,m(t)),s[t]=!0;break;case"setProp":return void(function(e,t){switch(e){case"paused":null!==d&&a.send("mpv-set-prop",["pause",t]);break;case"time":null!==d&&null!==t&&isFinite(t)&&a.send("mpv-set-prop",["time-pos",t/1e3]);break;case"playbackSpeed":null!==d&&null!==t&&isFinite(t)&&a.send("mpv-set-prop",["speed",t]);break;case"volume":null!==d&&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!==d&&(a.send("mpv-set-prop",["mute",t?"yes":"no"]),S.mute=t,D("muted"));break;case"selectedAudioTrackId":if(null!==d){var i=t.slice(9);a.send("mpv-set-prop",["aid",i])}break;case"selectedSubtitlesTrackId":null!==d&&(t?(i=t.slice(9),a.send("mpv-set-prop",["sid",i]),u.emit("subtitlesTrackLoaded",t)):(a.send("mpv-set-prop",["sid","no"]),S.sid=null)),D("selectedSubtitlesTrackId");break;case"subtitlesSize":a.send("mpv-set-prop",[_[e],t*E]);break;case"subtitlesOffset":a.send("mpv-set-prop",[_[e],t]);break;case"subtitlesTextColor":case"subtitlesBackgroundColor":case"subtitlesOutlineColor":var o=t.replace(/^#(\w{6})(\w{2})$/,"#$2$1");a.send("mpv-set-prop",[_[e],o]);break;default:console.log("Unhandled setProp for",e)}})(e.propName,e.propValue);case"command":return void p(e.commandName,e.commandArgs)}var t}}s.canPlayStream=function(){return Promise.resolve(!0)},s.manifest={name:"ShellVideo",external:!1,props:Object.keys(_),commands:["load","unload","destroy"],events:["propValue","propChanged","ended","error","subtitlesTrackLoaded"]},e.exports=s},2843:(e,t,a)=>{var i=a(90514);e.exports=i},50992:(e,t,a)=>{var i=a(92255),o=a(67193),n=a(52653),r=a(40551),E=a(18387);function _(){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,_){if(a)throw new Error("Video is destroyed");if(!i)throw new Error("Invalid action dispatched: "+JSON.stringify(i));if(_=_||{},"command"===(i=n(o(i))).type&&"load"===i.commandName&&i.commandArgs){var T=r(i.commandArgs,_);if(null!==e&&e.constructor!==T&&(e.dispatch({type:"command",commandName:"destroy"}),e=null),null===e){if(null===T)return void t.emit("error",Object.assign({},E.UNSUPPORTED_STREAM,{error:new Error("No video implementation was selected"),critical:!0,stream:i.commandArgs.stream}));(e=new 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)})),T.manifest.external?e.on("implementationChanged",(function(e){t.emit("implementationChanged",e)})):t.emit("implementationChanged",T.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()}}_.ERROR=E,e.exports=_},62030:(e,t,a)=>{var i=a(50992);e.exports=i},40551:(e,t,a)=>{var i=a(52369),o=a(2843),n=a(12430),r=a(22429),E=a(97085),_=a(30113),T=a(7342),s=a(80445),S=a(7068),l=a(39735);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?l(S(T)):"string"==typeof e.stream.playerFrameUrl?l(_):t.shellTransport?s(S(o)):"string"==typeof e.streamingServerURL?"Tizen"===e.platform?s(S(r)):"webOS"===e.platform?s(S(E)):s(S(n)):"string"==typeof e.stream.url?"Tizen"===e.platform?l(S(r)):"webOS"===e.platform?l(S(E)):l(S(n)):null:null}},49388:e=>{const t="AVPlay";e.exports=e=>({getState:()=>e.request(t,"getState"),getCurrentTime:()=>e.request(t,"getCurrentTime"),getDuration:()=>e.request(t,"getDuration"),getTotalTrackInfo:()=>e.request(t,"getTotalTrackInfo"),getCurrentStreamInfo:()=>e.request(t,"getCurrentStreamInfo"),open:a=>e.request(t,"open",a),prepareAsync:async(a,i)=>{const[o,n]=await e.request(t,"prepareAsync","handler:success","handler:error");"handler:success"===o&&a(),"handler:error"===o&&i(...n)},pause:()=>e.request(t,"pause"),play:()=>e.request(t,"play"),stop:()=>e.request(t,"stop"),seekTo:a=>e.request(t,"seekTo",a),setSpeed:a=>e.request(t,"setSpeed",a),setSelectTrack:(a,i)=>e.request(t,"setSelectTrack",a,i),setDisplayRect:(a,i,o,n)=>e.request(t,"setDisplayRect",a,i,o,n),setDisplayMethod:a=>e.request(t,"setDisplayMethod",a),setListener:a=>{const i=Object.keys(a).map((e=>`handler:${e}`));e.listen(t,"setListener",((e,t)=>{const i=e.replace("handler:","");a[i]&&(t?a[i](...t):a[i]())}),...i)}})},898:(e,t,a)=>{var i=a(92255),o=a(67193),n=a(52653),r=a(2520),E=a(18387),_=a(13001),T=a(49388);function s(e){var t=!0,s=1,S=null,l=null,I=(e=e||{}).containerElement;if(!(I instanceof HTMLElement))throw new Error("Container element required to be instance of HTMLElement");var u,A=T(e.transport),d=!1,O=100,c=0,R="rgb(255, 255, 255)",N="rgba(0, 0, 0, 0)",m="rgb(34, 34, 34)",L=1,D=document.createElement("object");D.type="application/avplayer",D.style.width="100%",D.style.height="100%",D.style.backgroundColor="black";var p=!1;async function h(){if(u){var e=await G("time"),t=u.duration-(e-u.now);t>0&&C(t,u.text)}}async function C(e,t){if(!p){var a=await G("time");for(u={duration:e,text:t,now:a},f&&(clearTimeout(f),f=!1);P.hasChildNodes();)P.removeChild(P.lastChild);P.style.bottom=c+"%",P.style.opacity=L;var i=document.createElement("span");i.innerHTML=t,i.style.display="inline-block",i.style.padding="0.2em",i.style.fontSize=Math.floor(O/25)+"vmin",i.style.color=R,i.style.backgroundColor=N,i.style.textShadow="1px 1px 0.1em "+m,P.appendChild(i),P.appendChild(document.createElement("br")),e&&(f=setTimeout((function(){for(;P.hasChildNodes();)P.removeChild(P.lastChild)}),parseInt(e*s)))}}var f=!1;A.setListener({onbufferingstart:function(){t=!0,F("buffering")},onbufferingprogress:function(){t=!0,F("buffering")},onbufferingcomplete:function(){t=!1,F("buffering")},oncurrentplaytime:function(){F("time")},onsubtitlechange:function(e,t){C(e,t)},onstreamcompleted:function(){B.emit("ended")}}),I.appendChild(D);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",I.style.position="relative",I.style.zIndex="0",I.appendChild(P);var B=new i,g=!1,v=null,M=0,W=null,y={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},b=!1,U={audio:[],subs:[]};async function G(e){switch(e){case"stream":return v;case"loaded":return W;case"paused":if(null===v)return null;var a=!("PAUSED"!==await A.getState());return!a&&d&&(A.setSelectTrack("AUDIO",parseInt(d.replace("EMBEDDED_",""))),d=!1),a;case"time":var i=await A.getCurrentTime();return null!==v&&null!==i&&isFinite(i)?Math.floor(i):null;case"duration":var o=await A.getDuration();return null!==v&&null!==o&&isFinite(o)?Math.floor(o):null;case"buffering":return null===v?null:t;case"subtitlesTracks":if(null===v)return[];for(var n=await A.getTotalTrackInfo(),r=[],E=0;E0?I.track_lang.trim():null;if(((U||{}).subs||[]).length)(P=U.subs.find((function(e){return(e||{}).id-1===_.index})))&&(u=P.lang||"eng");r.push({id:T,lang:u,label:u,origin:"EMBEDDED",embedded:!0,mode:p||T!==S?"disabled":"showing"})}return r;case"selectedSubtitlesTrackId":if(null===v||p)return null;var D=await A.getCurrentStreamInfo();for(E=0;E0?I.language:null;if(((U||{}).audio||[]).length)(P=U.audio.find((function(e){return(e||{}).id-1===C.index})))&&(B=P.lang||"eng");h.push({id:f,lang:B,label:B,origin:"EMBEDDED",embedded:!0,mode:f===l?"showing":"disabled"})}return h;case"selectedAudioTrackId":if(null===v)return null;if(d)return d;D=await A.getCurrentStreamInfo();var M=!1;for(E=0;E=6)&&(b||null===v||(b=!0,_(v.url,(function(e){e&&(U=e),((U||{}).subs||[]).length&&F("subtitlesTracks"),((U||{}).audio||[]).length&&F("audioTracks")})))),A.open(v.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(){F("duration"),A.play(),W=!0,F("loaded"),F("stream"),F("paused"),F("time"),F("duration"),F("subtitlesTracks"),F("selectedSubtitlesTrackId"),F("audioTracks"),F("selectedAudioTrackId")}),(function(e){if(M<5){M++;try{A.stop()}catch(e){}V("load",t)}else k(Object.assign({},E.STREAM_FAILED_TO_LOAD,{critical:!0,stream:t?t.stream:null,error:e}))}))}else k(Object.assign({},E.UNSUPPORTED_STREAM,{critical:!0,stream:t?t.stream:null}));break;case"unload":v=null,A.stop(),W=!1,F("loaded"),F("stream"),F("paused"),F("time"),F("duration"),F("buffering"),F("subtitlesTracks"),F("selectedSubtitlesTrackId"),F("audioTracks"),F("selectedAudioTrackId");break;case"destroy":V("unload"),g=!0,A.stop(),F("subtitlesOffset"),F("subtitlesSize"),F("subtitlesTextColor"),F("subtitlesBackgroundColor"),F("subtitlesOutlineColor"),F("subtitlesOpacity"),F("playbackSpeed"),B.removeAllListeners(),I.removeChild(D)}}this.on=function(e,t){if(g)throw new Error("Video is destroyed");B.on(e,t)},this.dispatch=function(e){if(g)throw new Error("Video is destroyed");if(e)switch((e=n(o(e))).type){case"observeProp":return void(async function(e){if(y.hasOwnProperty(e)){var t=await G(e);B.emit("propValue",e,t),y[e]=!0}})(e.propName);case"setProp":return void(async function(e,t){switch(e){case"paused":if(null!==v){var a=!!t;a?A.pause():A.play(),a?f&&clearTimeout(f):h()}F("paused");var i=await G("paused");setTimeout((async function(){await G("paused")!==i&&F("paused")}),1e3);break;case"time":null!==v&&null!==t&&isFinite(t)&&(A.seekTo(parseInt(t,10)),C(1,""),F("time"));break;case"selectedSubtitlesTrackId":if(null!==v)if(0===(S||"").indexOf("EMBEDDED_")){if(-1===(t||"").indexOf("EMBEDDED_"))return C(1,""),p=!0,void F("selectedSubtitlesTrackId");p=!1,S=t;var o=(await G("subtitlesTracks")).find((function(e){return e.id===t}));A.setSelectTrack("TEXT",parseInt(S.replace("EMBEDDED_",""))),o&&(B.emit("subtitlesTrackLoaded",o),F("selectedSubtitlesTrackId"))}else t||(C(1,""),p=!0,F("selectedSubtitlesTrackId"));break;case"subtitlesOffset":null!==t&&isFinite(t)&&(c=Math.max(0,Math.min(100,parseInt(t,10))),h(),F("subtitlesOffset"));break;case"subtitlesSize":null!==t&&isFinite(t)&&(O=Math.max(0,parseInt(t,10)),h(),F("subtitlesSize"));break;case"subtitlesTextColor":if("string"==typeof t){try{R=r(t).rgb().string()}catch(e){console.error("Tizen player with HTML Subtitles",e)}h(),F("subtitlesTextColor")}break;case"subtitlesBackgroundColor":if("string"==typeof t){try{N=r(t).rgb().string()}catch(e){console.error("Tizen player with HTML Subtitles",e)}h(),F("subtitlesBackgroundColor")}break;case"subtitlesOutlineColor":if("string"==typeof t){try{m=r(t).rgb().string()}catch(e){console.error("Tizen player with HTML Subtitles",e)}h(),F("subtitlesOutlineColor")}break;case"subtitlesOpacity":if("number"==typeof t){try{L=Math.min(Math.max(t/100,0),1)}catch(e){console.error("Tizen player with HTML Subtitles",e)}h(),F("subtitlesOpacity")}break;case"selectedAudioTrackId":if(null!==v){l=t;var n=(await G("audioTracks")).find((function(e){return e.id===t}));await G("paused")?(d=t,F("selectedAudioTrackId")):A.setSelectTrack("AUDIO",parseInt(l.replace("EMBEDDED_",""))),n&&(B.emit("audioTrackLoaded",n),F("selectedAudioTrackId"))}break;case"playbackSpeed":if(null!==t&&isFinite(t)){s=parseFloat(t);try{A.setSpeed(s)}catch(e){}F("playbackSpeed")}}})(e.propName,e.propValue);case"command":return void V(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},22429:(e,t,a)=>{var i=a(898);e.exports=i},18786:(e,t,a)=>{var i=a(92255),o=a(67193),n=a(52653),r=a(18387),E=a(13001);function _(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)}function T(e,t,a){window.webOS.service.request("luna://com.webos.applicationManager",{method:"launch",parameters:{id:e.id,params:{payload:[{fullPath:e.url,artist:"",subtitle:"",dlnaInfo:{flagVal:4096,cleartextSize:"-1",contentLength:"-1",opVal:1,protocolInfo:"http-get:*:video/x-matroska:DLNA.ORG_OP=01;DLNA.ORG_CI=0;DLNA.ORG_FLAGS=01700000000000000000000000000000",duration:0},mediaType:"VIDEO",thumbnail:"",deviceType:"DMR",album:"",fileName:e.name,lastPlayPosition:e.position}]}},onSuccess:function(){t&&t()},onFailure:function(){a&&a(new Error("Failed to launch"+e.id)),"com.webos.app.photovideo"===e.id?(e.id="com.webos.app.smartshare",T(e,t,a)):"com.webos.app.smartshare"===e.id&&(e.id="com.webos.app.mediadiscovery",T(e,t,a))}})}var s=["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 l={unsupportedAudio:["DTS","TRUEHD"],unsupportedSubs:["HDMV/PGS","VOBSUB"]},I=!1;function u(){I||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"]){I=!0;var t=e.configs["tv.model.edidType"].toLowerCase();t.includes("dts")&&(l.unsupportedAudio=l.unsupportedAudio.filter((function(e){return"DTS"!==e}))),t.includes("truehd")&&(l.unsupportedAudio=l.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,I=75,A=!0,d=!1,O=!1,c=[],R=[],N={color:"white",font_size:1,bg_color:"none",position:-1,bg_opacity:0,char_opacity:255},m=function(e){D.mediaId&&(A=!e,_({method:"setSubtitleEnable",parameters:{mediaId:D.mediaId,enable:e}}))},L=document.createElement("style");t.appendChild(L),L.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 D=document.createElement("video");D.style.width="100%",D.style.height="100%",D.style.backgroundColor="black",D.controls=!1,D.onerror=function(){!(function(){if(P)return;var e;switch((D.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,T({id:"com.webos.app.photovideo",url:B.url,name:"Stremio",position:-1},null,(function(e){console.error(e)}));break;case 4:e=r.HTML_VIDEO.MEDIA_ERR_SRC_NOT_SUPPORTED,T({id:"com.webos.app.photovideo",url:B.url,name:"Stremio",position:-1},null,(function(e){console.error(e)}));break;default:e=r.UNKNOWN_ERROR}F(Object.assign({},e,{critical:!0,error:D.error}))})()},D.onended=function(){f.emit("ended")},D.onpause=function(){V("paused")},D.onplay=function(){V("paused")},D.ontimeupdate=function(){V("time"),V("buffered")},D.ondurationchange=function(){V("duration")},D.onwaiting=function(){V("buffering"),V("buffered")},D.onseeking=function(){V("buffering"),V("buffered")},D.onseeked=function(){V("buffering"),V("buffered")},D.onstalled=function(){V("buffering"),V("buffered")},D.onplaying=function(){V("buffering"),V("buffered"),a||(a=!0,V("loaded"))},D.oncanplay=function(){V("buffering"),V("buffered")},D.canplaythrough=function(){V("buffering"),V("buffered")},D.onloadeddata=function(){V("buffering"),V("buffered")},D.onloadedmetadata=function(){V("buffering"),V("buffered"),H("time",g)},D.onvolumechange=function(){V("volume"),V("muted")},D.onratechange=function(){V("playbackSpeed")},D.textTracks.onchange=function(){V("subtitlesTracks"),V("selectedSubtitlesTrackId"),k(),Array.from(D.textTracks).forEach((function(e){e.oncuechange=k}))},t.appendChild(D);var p=null,h=null,C=1,f=new i,P=!1,B=null,g=null,v=0,M=100,W={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},y=!1,b={audio:[],subs:[]};function U(){y||null===B||(y=!0,E(B.url,(function(e){var t=0,a=0;c=[],R=[],e&&(b=e),((b||{}).subs||[]).length&&(b.subs.forEach((function(e){if(!l.unsupportedSubs.includes(e.codec||"")){var a=t;t++,d||c.length||(d=a),c.push({id:"EMBEDDED_"+a,lang:e.lang||"eng",label:e.lang||"eng",origin:"EMBEDDED",embedded:!0,mode:a===d?"showing":"disabled"})}})),V("subtitlesTracks"),V("selectedSubtitlesTrackId")),((b||{}).audio||[]).length&&(b.audio.forEach((function(e){if(!l.unsupportedAudio.includes(e.codec||"")){var t=a;a++,O||R.length||(O=t),R.push({id:"EMBEDDED_"+t,lang:e.lang||"eng",label:e.lang||"eng",origin:"EMBEDDED",embedded:!0,mode:t===O?"showing":"disabled"})}})),O="EMBEDDED_0",V("audioTracks"),V("selectedAudioTrackId"))})))}function G(e){switch(e){case"stream":return B;case"loaded":return a;case"paused":return null===B?null:!!D.paused;case"time":return null!==B&&null!==D.currentTime&&isFinite(D.currentTime)?Math.floor(1e3*D.currentTime):null;case"duration":return null!==B&&null!==D.duration&&isFinite(D.duration)?Math.floor(1e3*D.duration):null;case"buffering":return null===B?null:D.readyState=D.HAVE_METADATA&&null!==t&&isFinite(t))try{D.currentTime=parseInt(t,10)/1e3,V("time")}catch(e){}break;case"selectedSubtitlesTrackId":if(D.mediaId&&null!==B&&0===(t||"").indexOf("EMBEDDED_")){m(!0),N.bg_opacity="none"===N.bg_color?0:255,["setSubtitleCharacterColor","setSubtitleBackgroundColor","setSubtitlePosition","setSubtitleFontSize","setSubtitleBackgroundOpacity","setSubtitleCharacterOpacity"].forEach((function(e){_({method:e,parameters:{mediaId:D.mediaId,charColor:N.color,bgColor:"none"===N.bg_color?"black":N.bg_color,position:N.position,fontSize:N.font_size,bgOpacity:N.bg_opacity,charOpacity:N.char_opacity}})})),console.log("WebOS","change subtitles for id: ",D.mediaId," index:",t),d=t;var a=parseInt(t.replace("EMBEDDED_",""));console.log("set subs to track idx: "+a),setTimeout((function(){var e=function(){var e=G("subtitlesTracks").find((function(e){return e.id===t}));c=c.map((function(e){return e.mode=e.id===d?"showing":"disabled",e})),e&&(f.emit("subtitlesTrackLoaded",e),V("selectedSubtitlesTrackId"))};_({method:"selectTrack",parameters:{type:"text",mediaId:D.mediaId,index:a}},e,e)}),500)}-1===(t||"").indexOf("EMBEDDED_")&&(d=null,V("selectedSubtitlesTrackId"),m(!1));break;case"subtitlesOffset":if(null!==t&&isFinite(t)){v=t;var i=(l=Math.max(0,Math.min(100,parseInt(v,10))))<=0?-3:l<=5?-2:l<=10?0:l<=15?2:l<=20&&4;!1===i&&(i=-2),N.position=i,D.mediaId&&_({method:"setSubtitlePosition",parameters:{mediaId:D.mediaId,position:i}}),V("subtitlesOffset")}break;case"subtitlesSize":if(null!==t&&isFinite(t)){I=t;var o=(T=Math.max(0,parseInt(I,10)))<=100?1:T<=125?2:T<=150?3:T<=200&&4;!1===o&&(o=1),N.font_size=o,D.mediaId&&_({method:"setSubtitleFontSize",parameters:{mediaId:D.mediaId,fontSize:o}}),V("subtitlesSize")}break;case"subtitlesTextColor":if("string"==typeof t){var n="white";S[t]&&s.indexOf(S[t])>-1&&(n=S[t]),N.color=n,D.mediaId&&_({method:"setSubtitleCharacterColor",parameters:{mediaId:D.mediaId,charColor:n}}),p=t,V("subtitlesTextColor")}break;case"subtitlesBackgroundColor":"string"==typeof t&&(S[t]&&s.indexOf(S[t])>-1&&(N.bg_color=S[t],D.mediaId&&(_({method:"setSubtitleBackgroundColor",parameters:{mediaId:D.mediaId,bgColor:"none"===S[t]?"black":S[t]}}),_("none"===S[t]?{method:"setSubtitleBackgroundOpacity",parameters:{mediaId:D.mediaId,bgOpacity:0}}:{method:"setSubtitleBackgroundOpacity",parameters:{mediaId:D.mediaId,bgOpacity:255}}))),h=t,V("subtitlesBackgroundColor"));break;case"subtitlesOpacity":if("number"==typeof t){var r=Math.floor(t/100*255);N.char_opacity=r,D.mediaId&&_({method:"setSubtitleCharacterOpacity",parameters:{mediaId:D.mediaId,charOpacity:r}}),M=t,V("subtitlesOpacity")}break;case"selectedAudioTrackId":if(0===(t||"").indexOf("EMBEDDED_")){O=t;a=parseInt(t.replace("EMBEDDED_",""));if(D.mediaId&&_({method:"selectTrack",parameters:{type:"audio",mediaId:D.mediaId,index:a}},(function(){var e=G("audioTracks").find((function(e){return e.id===t}));R=R.map((function(e){return e.mode=e.id===O?"showing":"disabled",e})),e&&(f.emit("audioTrackLoaded",e),V("selectedAudioTrackId"))})),D&&D.audioTracks){for(var E=0;E4&&(clearInterval(n),U(),u(),o())}),300)}else F(Object.assign({},r.UNSUPPORTED_STREAM,{critical:!0,stream:a?a.stream:null}));break;case"unload":B=null,g=null,Array.from(D.textTracks).forEach((function(e){e.oncuechange=null})),D.removeAttribute("src"),D.load(),V("stream"),V("paused"),V("time"),V("duration"),V("buffering"),V("buffered"),V("subtitlesTracks"),V("selectedSubtitlesTrackId"),V("audioTracks"),V("selectedAudioTrackId");break;case"destroy":w("unload"),P=!0,V("subtitlesOffset"),V("subtitlesSize"),V("subtitlesTextColor"),V("subtitlesBackgroundColor"),V("subtitlesOpacity"),V("volume"),V("muted"),V("playbackSpeed"),f.removeAllListeners(),D.onerror=null,D.onended=null,D.onpause=null,D.onplay=null,D.ontimeupdate=null,D.ondurationchange=null,D.onwaiting=null,D.onseeking=null,D.onseeked=null,D.onstalled=null,D.onplaying=null,D.oncanplay=null,D.canplaythrough=null,D.onloadeddata=null,D.onloadedmetadata=null,D.onvolumechange=null,D.onratechange=null,D.textTracks.onchange=null,t.removeChild(D),t.removeChild(L)}var o,n}this.on=function(e,t){if(P)throw new Error("Video is destroyed");f.on(e,t)},this.dispatch=function(e){if(P)throw new Error("Video is destroyed");if(e)switch((e=n(o(e))).type){case"observeProp":return t=e.propName,void(W.hasOwnProperty(t)&&(f.emit("propValue",t,G(t)),W[t]=!0));case"setProp":return void H(e.propName,e.propValue);case"command":return void w(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},97085:(e,t,a)=>{var i=a(18786);e.exports=i},98388:(e,t,a)=>{var i=a(92255),o=a(67193),n=a(52653),r=a(18387);function E(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 E=document.createElement("script");E.type="text/javascript",E.src="https://www.youtube.com/iframe_api",E.onload=function(){if(u)return;if(!YT||"function"!=typeof YT.ready)return void c();YT.ready((function(){u||(YT&&YT.PlayerState&&"function"==typeof YT.Player?s=new YT.Player(_,{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:N,onApiChange:m,onStateChange:L}}):c())}))},E.onerror=c,a.appendChild(E);var _=document.createElement("div");_.style.width="100%",_.style.height="100%",_.style.backgroundColor="black",a.appendChild(_);var T=window.setInterval((function(){h("time"),h("volume"),h("muted"),h("playbackSpeed")}),t),s=null,S=!1,l=null,I=new i,u=!1,A=null,d=null,O={stream:!1,loaded:!1,paused:!1,time:!1,duration:!1,buffering:!1,volume:!1,muted:!1,playbackSpeed:!1,subtitlesTracks:!1,selectedSubtitlesTrackId:!1};function c(){u||p(Object.assign({},r.YOUTUBE_VIDEO.API_LOAD_FAILED,{critical:!0}))}function R(e){if(!u){var t;switch(e.data){case 2:t=r.YOUTUBE_VIDEO.INVALID_PARAMETER;break;case 5:t=r.YOUTUBE_VIDEO.HTML5_VIDEO;break;case 100:t=r.YOUTUBE_VIDEO.VIDEO_NOT_FOUND;break;case 101:case 150:t=r.YOUTUBE_VIDEO.VIDEO_NOT_EMBEDDABLE;break;default:t=r.UNKNOWN_ERROR}p(Object.assign({},t,{critical:!0,error:e}))}}function N(){u||(S=!0,null!==l&&(C("load",l),l=null))}function m(){u||("function"==typeof s.loadModule&&s.loadModule("captions"),"function"==typeof s.setOption&&s.setOption("captions","track",{}),h("paused"),h("time"),h("duration"),h("buffering"),h("volume"),h("muted"),h("playbackSpeed"),h("subtitlesTracks"),h("selectedSubtitlesTrackId"))}function L(e){switch(h("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:h("paused"),h("time"),h("duration")}}function D(e){switch(e){case"stream":return A;case"loaded":return null!==A||null;case"paused":return null===A||"function"!=typeof s.getPlayerState?null:s.getPlayerState()!==YT.PlayerState.PLAYING;case"time":return null!==A&&"function"==typeof s.getCurrentTime&&null!==s.getCurrentTime()&&isFinite(s.getCurrentTime())?Math.floor(1e3*s.getCurrentTime()):null;case"duration":return null!==A&&"function"==typeof s.getDuration&&null!==s.getDuration()&&isFinite(s.getDuration())?Math.floor(1e3*s.getDuration()):null;case"buffering":return null===A||"function"!=typeof s.getPlayerState?null:s.getPlayerState()===YT.PlayerState.BUFFERING;case"volume":return null!==A&&"function"==typeof s.getVolume&&null!==s.getVolume()&&isFinite(s.getVolume())?s.getVolume():null;case"muted":return null===A||"function"!=typeof s.isMuted?null:s.isMuted();case"playbackSpeed":return null!==A&&"function"==typeof s.getPlaybackRate&&null!==s.getPlaybackRate()&&isFinite(s.getPlaybackRate())?s.getPlaybackRate():null;case"subtitlesTracks":return null===A||"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===A?null:d;default:return null}}function p(e){I.emit("error",e),e.critical&&C("unload")}function h(e){O[e]&&I.emit("propChanged",e,D(e))}function C(e,t){switch(e){case"load":if(C("unload"),t&&t.stream&&"string"==typeof t.stream.ytId)if(S){A=t.stream,h("stream"),h("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}),h("paused"),h("time"),h("duration"),h("buffering"),h("volume"),h("muted"),h("playbackSpeed"),h("subtitlesTracks"),h("selectedSubtitlesTrackId")}else l=t;else p(Object.assign({},r.UNSUPPORTED_STREAM,{critical:!0,stream:t?t.stream:null}));break;case"unload":l=null,A=null,h("stream"),h("loaded"),d=null,S&&"function"==typeof s.stopVideo&&s.stopVideo(),h("paused"),h("time"),h("duration"),h("buffering"),h("volume"),h("muted"),h("playbackSpeed"),h("subtitlesTracks"),h("selectedSubtitlesTrackId");break;case"destroy":C("unload"),u=!0,I.removeAllListeners(),clearInterval(T),S&&"function"==typeof s.destroy&&s.destroy(),a.removeChild(E),a.removeChild(_)}}this.on=function(e,t){if(u)throw new Error("Video is destroyed");I.on(e,t)},this.dispatch=function(e){if(u)throw new Error("Video is destroyed");if(e)switch((e=n(o(e))).type){case"observeProp":return t=e.propName,void(O.hasOwnProperty(t)&&(I.emit("propValue",t,D(t)),O[t]=!0));case"setProp":return void(function(e,t){switch(e){case"paused":null!==A&&(t?"function"==typeof s.pauseVideo&&s.pauseVideo():"function"==typeof s.playVideo&&s.playVideo());break;case"time":null!==A&&"function"==typeof s.seekTo&&null!==t&&isFinite(t)&&s.seekTo(parseInt(t,10)/1e3);break;case"volume":null!==A&&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)))),h("muted"),h("volume"));break;case"muted":null!==A&&(t?"function"==typeof s.mute&&s.mute():"function"==typeof s.unMute&&s.unMute(),h("muted"));break;case"playbackSpeed":null!==A&&"function"==typeof s.setPlaybackRate&&isFinite(t)&&(s.setPlaybackRate(t),h("playbackSpeed"));break;case"selectedSubtitlesTrackId":if(null!==A){d=null;var a=D("subtitlesTracks").find((function(e){return e.id===t}));"function"==typeof s.setOption&&(a?(d=a.id,s.setOption("captions","track",{languageCode:a.lang}),I.emit("subtitlesTrackLoaded",a)):s.setOption("captions","track",{})),h("selectedSubtitlesTrackId")}}})(e.propName,e.propValue);case"command":return void C(e.commandName,e.commandArgs)}var t;throw new Error("Invalid action dispatched: "+JSON.stringify(e))}}E.canPlayStream=function(e){return Promise.resolve(e&&"string"==typeof e.ytId)},E.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=E},7342:(e,t,a)=>{var i=a(98388);e.exports=i},18387: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"}}},63009:(e,t,a)=>{var i=a(62030);e.exports=i},22747: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 n(e,t){return e.force||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 n(e,{mediaElement:t})})).reduce((function(e,t){return e.concat(t)}),[]),audioCodecs:o.map((function(e){return n(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})()})},81057:(e,t,a)=>{e.exports=function(){return void 0!==a.g.tizen||void 0!==a.g.webOS||void 0!==window.qt?Promise.resolve(!1):Promise.resolve(!0)}},13001: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)}))}},42703:e=>{e.exports=function(e,t){if(tt?i=n-1:(e[n]{var i=a(60854);e.exports=i},93733: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 n?(t+=n[1]+":"+n[2]+":"+n[3]+"."+n[4]+" --\x3e "+n[5]+":"+n[6]+":"+n[7]+"."+n[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 n=0;n{var i=a(2626),o=a(42703);e.exports={parse:function(e){return new Promise((function(t,a){var n=new i.WebVTT.Parser(window,i.WebVTT.StringDecoder()),r=[],E=[],_={};n.oncue=function(e){var t={startTime:1e3*e.startTime|0,endTime:1e3*e.endTime|0,text:e.text};E.push(t),_[t.startTime]=_[t.startTime]||[],_[t.endTime]=_[t.endTime]||[]},n.onparsingerror=function(e){0===e.code?(n.oncue=null,n.onparsingerror=null,n.onflush=null,a(e)):(console.warn("Subtitles parsing error",e),r.push(e))},n.onflush=function(){_.times=Object.keys(_).map((function(e){return parseInt(e,10)})).sort((function(e,t){return e-t}));for(var e=0;e{var i=a(2626),o=a(42703);e.exports={render:function(e,t){var a=[],n=o(e.times,t);if(-1!==n)for(var r=e[e.times[n]],E=0;E{var i=a(92255),o=a(67193),n=a(52653),r=a(2520),E=a(18387),_=a(70910),T=a(17186),s=a(93733);e.exports=function(e){function t(t){var a=new e(t=t||{});a.on("error",(function(e){A.emit("error",e),e.critical&&M("unload")})),a.on("propValue",P.bind(null,"propValue")),a.on("propChanged",P.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(){A.emit.apply(A,[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},u=null,A=new i,d=!1,O=[],c=null,R=null,N=100,m=0,L="rgb(255, 255, 255)",D="rgba(0, 0, 0, 0)",p="rgb(34, 34, 34)",h=1,C={extraSubtitlesTracks:!1,selectedExtraSubtitlesTrackId:!1,extraSubtitlesDelay:!1,extraSubtitlesSize:!1,extraSubtitlesOffset:!1,extraSubtitlesTextColor:!1,extraSubtitlesBackgroundColor:!1,extraSubtitlesOutlineColor:!1,extraSubtitlesOpacity:!1};function f(){for(;l.hasChildNodes();)l.removeChild(l.lastChild);null!==u&&null!==I.time&&isFinite(I.time)&&(l.style.bottom=m+"%",l.style.opacity=h,T.render(u,I.time-R).forEach((function(e){e.style.display="inline-block",e.style.padding="0.2em",e.style.whiteSpace="pre-wrap",e.style.fontSize=Math.floor(N/25)+"vmin",e.style.color=L,e.style.backgroundColor=D,e.style.textShadow="1px 1px 0.1em "+p,l.appendChild(e),l.appendChild(document.createElement("br"))})))}function P(e,t,a){if("time"===t)I.time=a,f();A.emit(e,t,g(t,a))}function B(e){C[e]&&A.emit("propChanged",e,g(e,null))}function g(e,t){switch(e){case"extraSubtitlesTracks":return d?[]:O.slice();case"selectedExtraSubtitlesTrackId":return d?null:c;case"extraSubtitlesDelay":return d?null:R;case"extraSubtitlesSize":return d?null:N;case"extraSubtitlesOffset":return d?null:m;case"extraSubtitlesTextColor":return d?null:L;case"extraSubtitlesBackgroundColor":return d?null:D;case"extraSubtitlesOutlineColor":return d?null:p;case"extraSubtitlesOpacity":return d?null:h;default:return t}}function v(e,t){switch(e){case"selectedExtraSubtitlesTrackId":u=null,c=null,R=null;var i=O.find((function(e){return e.id===t}));return i&&(c=i.id,R=0,fetch(i.url).then((function(e){if(e.ok)return e.text();throw new Error(e.status+" ("+e.statusText+")")})).then((function(e){return s.convert(e)})).then((function(e){return _.parse(e)})).then((function(e){c===i.id&&(u=e,f(),A.emit("extraSubtitlesTrackLoaded",i))})).catch((function(e){c===i.id&&(function(e){A.emit("error",e),e.critical&&(M("unload"),a.dispatch({type:"command",commandName:"unload"}))})(Object.assign({},E.WITH_HTML_SUBTITLES.LOAD_FAILED,{error:e,track:i,critical:!1}))}))),f(),B("selectedExtraSubtitlesTrackId"),B("extraSubtitlesDelay"),!0;case"extraSubtitlesDelay":return null!==c&&null!==t&&isFinite(t)&&(R=parseInt(t,10),f(),B("extraSubtitlesDelay")),!0;case"extraSubtitlesSize":return null!==t&&isFinite(t)&&(N=Math.max(0,parseInt(t,10)),f(),B("extraSubtitlesSize")),!0;case"extraSubtitlesOffset":return null!==t&&isFinite(t)&&(m=Math.max(0,Math.min(100,parseInt(t,10))),f(),B("extraSubtitlesOffset")),!0;case"extraSubtitlesTextColor":if("string"==typeof t){try{L=r(t).rgb().string()}catch(e){console.error("withHTMLSubtitles",e)}f(),B("extraSubtitlesTextColor")}return!0;case"extraSubtitlesBackgroundColor":if("string"==typeof t){try{D=r(t).rgb().string()}catch(e){console.error("withHTMLSubtitles",e)}f(),B("extraSubtitlesBackgroundColor")}return!0;case"extraSubtitlesOutlineColor":if("string"==typeof t){try{p=r(t).rgb().string()}catch(e){console.error("withHTMLSubtitles",e)}f(),B("extraSubtitlesOutlineColor")}return!0;case"extraSubtitlesOpacity":if("number"==typeof t){try{h=Math.min(Math.max(t/100,0),1)}catch(e){console.error("withHTMLSubtitles",e)}f(),B("extraSubtitlesOpacity")}return!0;default:return!1}}function M(e,t){switch(e){case"addExtraSubtitlesTracks":return t&&Array.isArray(t.tracks)&&(O=O.concat(t.tracks).filter((function(e,t,a){return e&&"string"==typeof e.id&&"string"==typeof e.url&&"string"==typeof e.lang&&"string"==typeof e.label&&"string"==typeof e.origin&&!e.embedded&&t===a.findIndex((function(t){return t.id===e.id}))})),B("extraSubtitlesTracks")),!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 u=null,O=[],c=null,R=null,f(),B("extraSubtitlesTracks"),B("selectedExtraSubtitlesTrackId"),B("extraSubtitlesDelay"),!1;case"destroy":return M("unload"),d=!0,B("extraSubtitlesSize"),B("extraSubtitlesOffset"),B("extraSubtitlesTextColor"),B("extraSubtitlesBackgroundColor"),B("extraSubtitlesOutlineColor"),B("extraSubtitlesOpacity"),a.dispatch({type:"command",commandName:"destroy"}),A.removeAllListeners(),S.removeChild(l),!0;default:return!1}}this.on=function(e,t){if(d)throw new Error("Video is destroyed");A.on(e,t)},this.dispatch=function(e){if(d)throw new Error("Video is destroyed");if(e)switch((e=n(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 A.emit("propValue",e,g(e,null)),C[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"]).filter((function(e,t,a){return a.indexOf(e)===t})),events:e.manifest.events.concat(["propValue","propChanged","error","extraSubtitlesTrackLoaded"]).filter((function(e,t,a){return a.indexOf(e)===t}))},t}},30878:(e,t,a)=>{var i=a(36372),o=a(41968),n=a(28819);function r(e,t,a,o){var n=new URL(t),r=new URLSearchParams;return r.set("d",n.origin),Object.entries(a).forEach((function(e){r.append("h",e[0]+":"+e[1])})),Object.entries(o).forEach((function(e){r.append("r",e[0]+":"+e[1])})),i.resolve(e,"/proxy/"+r.toString()+n.pathname)+n.search}e.exports=function(e,t,a,i){return new Promise((function(E,_){if("string"!=typeof t.url)"string"!=typeof t.infoHash?_(new Error("Stream cannot be converted")):n(e,t.infoHash,t.fileIdx,t.announce,a).then((function(e){E({url:e.url,infoHash:e.infoHash,fileIdx:e.fileIdx})})).catch((function(e){_(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 _(e)}var s=Array.isArray(T.announce)?T.announce.map((function(e){return"tracker:"+e})):[];n(e,T.infoHash,null,s,a).then((function(e){E({url:e.url,infoHash:e.infoHash,fileIdx:e.fileIdx})})).catch((function(e){_(e)}))}else{var S=i&&i.proxyStreamsEnabled,l=t.behaviorHints&&t.behaviorHints.proxyHeaders;if(S||l){var I=l&&l.request?l.request:{},u=l&&l.response?l.response:{};E({url:r(e,t.url,I,u)})}else E({url:t.url})}}))}},28819:(e,t,a)=>{var i=a(36372);function o(e,t,a,o){var n=Array.isArray(o)&&o.length>0?"?"+new URLSearchParams(o.map((function(e){return["tr",e]}))):"";return{url:i.resolve(e,"/"+encodeURIComponent(t)+"/"+encodeURIComponent(a))+n,infoHash:t,fileIdx:a,sources:o}}e.exports=function(e,t,a,n,r){if((!Array.isArray(n)||0===n.length)&&null!==a&&isFinite(a))return Promise.resolve(o(e,t,a,n));var E={torrent:{infoHash:t}};return Array.isArray(n)&&n.length>0&&(E.peerSearch={sources:["dht:"+t].concat(n).filter((function(e,t,a){return a.indexOf(e)===t})),min:40,max:200}),null!==a&&isFinite(a)?E.guessFileIdx=!1:(E.guessFileIdx={},r&&(null!==r.season&&isFinite(r.season)&&(E.guessFileIdx.season=r.season),null!==r.episode&&isFinite(r.episode)&&(E.guessFileIdx.episode=r.episode))),fetch(i.resolve(e,"/"+encodeURIComponent(t)+"/create"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(E)}).then((function(e){if(e.ok)return e.json();throw new Error(e.status+" ("+e.statusText+")")})).then((function(i){return o(e,t,E.guessFileIdx?i.guessedFileIdx:a,E.peerSearch?E.peerSearch.sources:[])}))}},21172:(e,t,a)=>{var i=a(36372);function o(e,t,a){var o=a&&"string"==typeof a.videoHash?a.videoHash:null,n=a&&isFinite(a.videoSize)?a.videoSize:null;if("string"==typeof o&&null!==n&&isFinite(n))return Promise.resolve({hash:o,size:n});var r=new URLSearchParams([["videoUrl",t]]);return fetch(i.resolve(e,"/opensubHash?"+r.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!==n&&isFinite(n)?n:e.result&&(e.result.size,1)?e.result.size:null}}))}function n(e,t,a,o,n){return n&&"string"==typeof n.filename?Promise.resolve(n.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,r){return Promise.allSettled([o(e,t,r),n(e,t,a,i,r)]).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}))}},80445:(e,t,a)=>{var i=a(15826);e.exports=i},47245: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)}},15826:(e,t,a)=>{var i=a(92255),o=a(36372),n=a(39590),r=a(67193),E=a(52653),_=a(22747),T=a(30878),s=a(21172),S=a(47245),l=a(81057),I=a(18387);e.exports=function(e){function t(a){var l=new e(a=a||{});l.on("error",(function(e){R.emit("error",e),e.critical&&C("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 u=this,A=null,d=!1,O=[],c=null,R=new i,N=!1,m={stream:!1,videoParams:!1};function L(e,t,a){R.emit(e,t,h(t,a))}function D(e){m[e]&&R.emit("propChanged",e,h(e,null))}function p(e){R.emit("error",e),e.critical&&(C("unload"),l.dispatch({type:"command",commandName:"unload"}))}function h(e,t){switch(e){case"stream":return null!==A?A.stream:null;case"videoParams":return c;default:return t}}function C(a,i){switch(a){case"load":return i&&i.stream&&"string"==typeof i.streamingServerURL?(C("unload"),l.dispatch({type:"command",commandName:"unload"}),A=i,D("stream"),T(i.streamingServerURL,i.stream,i.seriesInfo,i.streamingServerSettings).then((function(e){var a=e.url,r=e.infoHash,E=e.fileIdx,T=Array.isArray(i.formats)?i.formats:_.formats,s=Array.isArray(i.videoCodecs)?i.videoCodecs:_.videoCodecs,S=Array.isArray(i.audioCodecs)?i.audioCodecs:_.audioCodecs,l=null!==i.maxAudioChannels&&isFinite(i.maxAudioChannels)?i.maxAudioChannels:_.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:r,fileIdx:E,stream:{url:a}};var t=n(),_=new URLSearchParams([["mediaURL",a]]);return i.forceTranscoding&&_.set("forceTranscoding","1"),s.forEach((function(e){_.append("videoCodecs",e)})),S.forEach((function(e){_.append("audioCodecs",e)})),_.set("maxAudioChannels",l),{mediaURL:a,infoHash:r,fileIdx:E,stream:{url:o.resolve(i.streamingServerURL,"/hlsv2/"+t+"/master.m3u8?"+_.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===A&&(l.dispatch({type:"command",commandName:"load",commandArgs:Object.assign({},i,{stream:t.stream})}),d=!0,(function(){for(;O.length>0;){var e=O.shift();u.dispatch.call(u,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===A&&(c=e,D("videoParams"))})).catch((function(e){i===A&&(console.error(e),c={hash:null,size:null,filename:null},D("videoParams"))})))})).catch((function(e){i===A&&p(Object.assign({},I.WITH_STREAMING_SERVER.CONVERT_FAILED,{error:e,critical:!0,stream:i.stream,streamingServerURL:i.streamingServerURL}))}))):p(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 A&&i&&Array.isArray(i.tracks)&&(d?l.dispatch({type:"command",commandName:"addExtraSubtitlesTracks",commandArgs:Object.assign({},i,{tracks:i.tracks.map((function(e){return Object.assign({},e,{url:"string"==typeof e.url?o.resolve(A.streamingServerURL,"/subtitles.vtt?"+new URLSearchParams([["from",e.url]]).toString()):e.url})}))})}):O.push({type:"command",commandName:"addExtraSubtitlesTracks",commandArgs:i})),!0;case"unload":return A=null,d=!1,O=[],c=null,D("stream"),D("videoParams"),!1;case"destroy":return C("unload"),N=!0,l.dispatch({type:"command",commandName:"destroy"}),R.removeAllListeners(),!0;default:return!d&&(O.push({type:"command",commandName:a,commandArgs:i}),!0)}}this.on=function(e,t){if(N)throw new Error("Video is destroyed");R.on(e,t)},this.dispatch=function(e){if(N)throw new Error("Video is destroyed");if(e)switch((e=E(r(e))).type){case"observeProp":if((function(e){switch(e){case"stream":case"videoParams":return R.emit("propValue",e,h(e,null)),m[e]=!0,!0;default:return!1}})(e.propName))return;break;case"command":if(C(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 n=new URLSearchParams([["mediaURL",t.url]]);return fetch(o.resolve(a.streamingServerURL,"/hlsv2/probe?"+n.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}},39735:(e,t,a)=>{var i=a(83662);e.exports=i},83662:(e,t,a)=>{var i=a(92255),o=a(67193),n=a(52653);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(){E.emit.apply(E,[e].concat(Array.from(arguments)))}})(e))}));var r=null,E=new i,_=!1,T={videoParams:!1};function s(e,t,a){"videoParams"!==t&&E.emit(e,t,S(t,a)),"stream"===t&&(r=a,(function(e){T[e]&&E.emit("propChanged",e,S(e,null))})("videoParams"))}function S(e,t){return"videoParams"===e?null===r?null:{hash:r.behaviorHints&&"string"==typeof r.behaviorHints.videoHash?r.behaviorHints.videoHash:null,size:r.behaviorHints&&null!==r.behaviorHints.videoSize&&isFinite(r.behaviorHints.videoSize)?r.behaviorHints.videoSize:null,filename:r.behaviorHints&&"string"==typeof r.behaviorHints.filename?r.behaviorHints.filename:null}:t}this.on=function(e,t){if(_)throw new Error("Video is destroyed");E.on(e,t)},this.dispatch=function(e){if(_)throw new Error("Video is destroyed");if(e)switch((e=n(o(e))).type){case"observeProp":if("videoParams"===(i=e.propName)&&(E.emit("propValue",i,S(i,null)),T[i]=!0,1))return;break;case"command":if(t=e.commandName,e.commandArgs,"destroy"===t&&(_=!0,a.dispatch({type:"command",commandName:"destroy"}),E.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}},21154: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]},u="COLOR",A="RGBA_USER",d="HSLA_USER";function O(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 c(e){var t=e.getContext("2d"),a=+e.width,i=+e.height,r=t.createLinearGradient(1,1,1,i-1);return r.addColorStop(0,"white"),r.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=r,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,r){var E=(0,n.rgbToHsv)(e,t,r),_=o(E,3),T=_[1],s=_[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 N(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=O(t),this.options=Object.assign({},I,a)):t&&(0,r.default)(t)?(this.options=Object.assign({},I,t),t=O(this.options.attachTo)):(this.options=Object.assign({},I),t=O((0,n.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=N(t.getAttribute(a+"sl-bar-size"),I.slBarSize,[232,150])),t.hasAttribute(a+"hue-bar-size")&&(e.hueBarSize=N(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=n.PALETTE_MATERIAL_500;break;case"PALETTE_MATERIAL_CHROME":case"":e.palette=n.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=E.default,t.appendChild(this.element);var i=this.element.querySelector(".a-color-picker-h");this.setupHueCanvas(i),this.hueBarHelper=c(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=c(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(u,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 r=function(a){var i=(0,n.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)},E=function e(){document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",e)};e.addEventListener("mousedown",(function(e){r(e),document.addEventListener("mousemove",r),document.addEventListener("mouseup",E)}))}},{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,n.limit)(a.clientX-e.getBoundingClientRect().left,0,t.options.slBarSize[0]-1),o=(0,n.limit)(a.clientY-e.getBoundingClientRect().top,0,t.options.slBarSize[1]-1),r=t.slBarHelper.grabColor(i,o);t.slPointer.style.left=i-7+"px",t.slPointer.style.top=o-7+"px",t.onValueChanged("RGB",r)},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,n.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)},r=function e(){document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",e)};e.addEventListener("mousedown",(function(e){o(e),document.addEventListener("mousemove",o),document.addEventListener("mouseup",r)}))}},{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(r){"Up"===r.key?(e.value=(0,n.limit)(+e.value+1,a,i),t.onValueChanged(o,e.value),r.returnValue=!1):"Down"===r.key&&(e.value=(0,n.limit)(+e.value-1,a,i),t.onValueChanged(o,e.value),r.returnValue=!1)})),e.addEventListener("change",(function(){var r=+e.value;t.onValueChanged(o,(0,n.limit)(r,a,i))})))}},{key:"setupClipboard",value:function(e){var t=this;e.title="click to copy",e.addEventListener("click",(function(){e.value=(0,n.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=n.PALETTE_MATERIAL_500;break;case"PALETTE_MATERIAL_CHROME":i=n.PALETTE_MATERIAL_CHROME;break;default:i=(0,n.ensureArray)(this.options.palette)}if(this.options.paletteEditable||i.length>0){var o=function(a,i,o){var n=e.querySelector('.a-color-picker-palette-color[data-color="'+a+'"]')||document.createElement("div");n.className="a-color-picker-palette-color",n.style.backgroundColor=a,n.setAttribute("data-color",a),n.title=a,e.insertBefore(n,i),t.palette[a]=!0,o&&t.onPaletteColorAdd(a)},r=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,n.parseColor)(e,a?"rgbcss4":"hex")})).filter((function(e){return!!e})).forEach((function(e){return o(e)})),this.options.paletteEditable){var E=document.createElement("div");E.className="a-color-picker-palette-color a-color-picker-palette-add",E.innerHTML="+",e.appendChild(E),e.addEventListener("click",(function(e){/a-color-picker-palette-add/.test(e.target.className)?e.shiftKey?r(null,!0):o(a?(0,n.parseColor)([t.R,t.G,t.B,t.A],"rgbcss4"):(0,n.rgbToHex)(t.R,t.G,t.B),e.target,!0):/a-color-picker-palette-color/.test(e.target.className)&&(e.shiftKey?r(e.target,!0):t.onValueChanged(u,e.target.getAttribute("data-color")))}))}else e.addEventListener("click",(function(e){/a-color-picker-palette-color/.test(e.target.className)&&t.onValueChanged(u,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,n.hslToRgb)(this.H,this.S,this.L),r=o(i,3);this.R=r[0],this.G=r[1],this.B=r[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 E=(0,n.hslToRgb)(this.H,this.S,this.L),_=o(E,3);this.R=_[0],this.G=_[1],this.B=_[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,n.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,n.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,n.rgbToHsl)(this.R,this.G,this.B),O=o(I,3);this.H=O[0],this.S=O[1],this.L=O[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 c=(0,n.rgbToHsl)(this.R,this.G,this.B),R=o(c,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 N=o(t,3);this.R=N[0],this.G=N[1],this.B=N[2];var m=(0,n.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 A:var D=o(t,4);this.R=D[0],this.G=D[1],this.B=D[2],this.A=D[3];var p=(0,n.rgbToHsl)(this.R,this.G,this.B),h=o(p,3);this.H=h[0],this.S=h[1],this.L=h[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 d:var C=o(t,4);this.H=C[0],this.S=C[1],this.L=C[2],this.A=C[3];var f=(0,n.hslToRgb)(this.H,this.S,this.L),P=o(f,3);this.R=P[0],this.G=P[1],this.B=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"RGBHEX":var B=(0,n.cssColorToRgb)(t)||[this.R,this.G,this.B],g=o(B,3);this.R=g[0],this.G=g[1],this.B=g[2];var v=(0,n.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 u:var W=(0,n.parseColor)(t,"rgba")||[0,0,0,1],y=o(W,4);this.R=y[0],this.G=y[1],this.B=y[2],this.A=y[3];var b=(0,n.rgbToHsl)(this.R,this.G,this.B),U=o(b,3);this.H=U[0],this.S=U[1],this.L=U[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,n.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,n.hslToRgb)(e,t,a),r=o(i,3),E=r[0],_=r[1],T=r[2],s=this.slBarHelper.findColor(E,_,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(u,e,{silent:t})},get all(){if(r){var e=[a.R,a.G,a.B,a.A],t=a.A<1?"rgba("+a.R+","+a.G+","+a.B+","+a.A+")":n.rgbToHex.apply(void 0,e);(E=(0,n.parseColor)(e,E)).toString=function(){return t},r=!1}return Object.assign({},E)},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 p=a(5).toString(),h=document.createElement("style");h.setAttribute("type","text/css"),h.setAttribute("data-source","a-color-picker"),h.innerHTML=p,document.querySelector("head").appendChild(h)}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=n.parseColorToRgb,t.parseColorToRgba=n.parseColorToRgba,t.parseColorToHsl=n.parseColorToHsl,t.parseColorToHsla=n.parseColorToHsla,t.parseColor=n.parseColor,t.rgbToHex=n.rgbToHex,t.hslToRgb=n.hslToRgb,t.rgbToHsl=n.rgbToHsl,t.rgbToHsv=n.rgbToHsv,t.rgbToInt=n.rgbToInt,t.intToRgb=n.intToRgb,t.getLuminance=n.getLuminance,t.COLOR_NAMES=n.COLOR_NAMES,t.PALETTE_MATERIAL_500=n.PALETTE_MATERIAL_500,t.PALETTE_MATERIAL_CHROME=n.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,n=void 0;try{for(var r,E=e[Symbol.iterator]();!(i=(r=E.next()).done)&&(a.push(r.value),!t||a.length!==t);i=!0);}catch(e){o=!0,n=e}finally{try{!i&&E.return&&E.return()}finally{if(o)throw n}}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 n(e){if(Array.isArray(e)){for(var t=0,a=Array(e.length);ta?a:e}function _(e,t){return null==e?t:e}function T(e,t,a){var i=[E(e,0,255),E(t,0,255),E(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,n=void 0,r=[E(e,0,360)/360,E(t,0,100)/100,E(a,0,100)/100];if(e=r[0],a=r[2],0==(t=r[1]))i=o=n=a;else{var _=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=_(s,T,e+1/3),o=_(s,T,e),n=_(s,T,e-1/3)}return[255*i,255*o,255*n].map(Math.round)}function S(e,t,a){var i=[E(e,0,255)/255,E(t,0,255)/255,E(a,0,255)/255];e=i[0],t=i[1],a=i[2];var o=Math.max(e,t,a),n=Math.min(e,t,a),r=void 0,_=void 0,T=(o+n)/2;if(o==n)r=_=0;else{var s=o-n;switch(_=T>.5?s/(2-o-n):s/(o+n),o){case e:r=(t-a)/s+(t>16&255,e>>8&255,255&e]},t.cssColorToRgb=I,t.cssColorToRgba=u,t.cssRgbToRgb=A,t.cssRgbaToRgba=d,t.parseColorToRgb=function(e){return Array.isArray(e)?e=[E(e[0],0,255),E(e[1],0,255),E(e[2],0,255)]:I(e)||A(e)},t.parseColorToRgba=O,t.cssHslToHsl=c,t.cssHslaToHsla=R,t.parseColorToHsl=function(e){return Array.isArray(e)?e=[E(e[0],0,360),E(e[1],0,100),E(e[2],0,100)]:c(e)},t.parseColorToHsla=N,t.parseColor=function(e,t){if(t=t||"rgb",null!=e){var a=void 0;if((a=O(e))||(a=N(e))&&(a=[].concat(n(s.apply(void 0,n(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=E,t.ensureArray=function(e){return e?Array.from(e):[]},t.nvl=_},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),n=i.sources.map((function(e){return"/*# sourceURL="+i.sourceRoot+e+" */"}));return[a].concat(n).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{function i(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,o,n,r,E=[],_=!0,T=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;_=!1}else for(;!(_=(i=n.call(a)).done)&&(E.push(i.value),E.length!==t);_=!0);}catch(e){T=!0,o=e}finally{try{if(!_&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(T)throw o}}return E}})(e,t)||(function(e,t){if(e){if("string"==typeof e)return o(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,t):void 0}})(e,t)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a{function i(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,o,n,r,E=[],_=!0,T=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;_=!1}else for(;!(_=(i=n.call(a)).done)&&(E.push(i.value),E.length!==t);_=!0);}catch(e){T=!0,o=e}finally{try{if(!_&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(T)throw o}}return E}})(e,t)||(function(e,t){if(e){if("string"==typeof e)return o(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,t):void 0}})(e,t)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a{function i(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,o,n,r,E=[],_=!0,T=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;_=!1}else for(;!(_=(i=n.call(a)).done)&&(E.push(i.value),E.length!==t);_=!0);}catch(e){T=!0,o=e}finally{try{if(!_&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(T)throw o}}return E}})(e,t)||(function(e,t){if(e){if("string"==typeof e)return o(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,t):void 0}})(e,t)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a{var i=a(12897);e.exports=i},12644:(e,t,a)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(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 n(e){for(var t=1;te.length)&&(t=e.length);for(var a=0,i=Array(t);a{var i=a(96540),o=a(40851).useServices,n=a(28990).useToast;e.exports=function(){var e=o(),t=e.core,a=e.dragAndDrop,r=n();return i.useEffect((function(){var e=function(e){var t=e.event,a=e.args;switch(t){case"Error":if("UserPulledFromAPI"===a.source.event&&null===a.source.args.uid)break;if("LibrarySyncWithAPIPlanned"===a.source.event&&null===a.source.args.uid)break;if("Other"===a.error.type&&3===a.error.code&&"AddonInstalled"===a.source.event&&a.source.args.transport_url.startsWith("https://www.strem.io/trakt/addon"))break;r.show({type:"error",title:a.source.event,message:a.error.message,timeout:4e3,dataset:{type:"CoreEvent"}});break;case"TorrentParsed":r.show({type:"success",title:"Torrent file parsed",timeout:4e3});break;case"MagnetParsed":r.show({type:"success",title:"Magnet link parsed",timeout:4e3});break;case"PlayingOnDevice":r.show({type:"success",title:"Stream opened in ".concat(a.device),timeout:4e3})}},i=function(e){var t;r.show({type:"error",title:e.message,message:null===(t=e.file)||void 0===t?void 0:t.name,timeout:4e3})};return t.transport.on("CoreEvent",e),a.on("error",i),function(){t.transport.off("CoreEvent",e),a.off("error",i)}}),[]),null}},8234:(e,t,a)=>{var i=a(55841);e.exports=i},18421:(e,t,a)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(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 n(e){for(var t=1;t{function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var i=a(96540),o=a(5556),n=a(46942),r=a(87865).default,E=a(95196),_=a(91236),T=function(e){var t=e.className,a=e.id,o=e.name,T=e.version,s=e.logo,S=e.description,l=e.types,I=e.transportUrl,u=e.official,A=i.useCallback((function(){return i.createElement(r,{className:_.icon,name:"addons"})}),[]);return i.createElement("div",{className:n(t,_["addon-details-container"])},i.createElement("div",{className:_["title-container"]},i.createElement(E,{className:_.logo,src:s,alt:" ",renderFallback:A}),i.createElement("div",{className:_["name-container"]},i.createElement("span",{className:_.name},"string"==typeof o&&o.length>0?o:a),"string"==typeof T&&T.length>0?i.createElement("span",{className:_.version},"v. ",T):null)),"string"==typeof S&&S.length>0?i.createElement("div",{className:_["section-container"]},i.createElement("span",{className:_["section-label"]},S)):null,"string"==typeof I&&I.length>0?i.createElement("div",{className:_["section-container"]},i.createElement("span",{className:_["section-header"]},"URL: "),i.createElement("span",{className:n(_["section-label"],_["transport-url-label"])},I)):null,Array.isArray(l)&&l.length>0?i.createElement("div",{className:_["section-container"]},i.createElement("span",{className:_["section-header"]},"Supported types: "),i.createElement("span",{className:_["section-label"]},1===l.length?l[0]:l.slice(0,-1).join(", ")+" & "+l[l.length-1])):null,u?null:i.createElement("div",{className:_["section-container"]},i.createElement("div",{className:n(_["section-label"],_["disclaimer-label"])},"Using third-party add-ons will always be subject to your responsibility and the governing law of the jurisdiction you are located.")))};T.propTypes={className:o.string,id:o.string,name:o.string,version:o.string,logo:o.string,description:o.string,types:o.arrayOf(o.string),transportUrl:o.string,official:o.bool},e.exports=T},74721:(e,t,a)=>{var i=a(3765);e.exports=i},197:(e,t,a)=>{var i=["remoteAddon","localAddon"];function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var i=a(197);e.exports=i},89643:(e,t,a)=>{var i=a(96540),o=a(47067);e.exports=function(e){var t=i.useMemo((function(){return"string"==typeof e?{action:"Load",args:{model:"AddonDetails",args:{transportUrl:e}}}:{action:"Unload"}}),[e]);return o({model:"addon_details",action:t})}},25347:(e,t,a)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}var o=["className","href","disabled","children","onLongPress","onDoubleClick"];function n(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 r(e){for(var t=1;t0?"a":"div",r(r({tabIndex:0},u),{},{ref:t,className:s(a,S["button-container"],{disabled:n}),href:i,onKeyDown:d,onMouseDown:O,onDoubleClick:I},A()),E)}));I.displayName="Button",I.propTypes={className:T.string,href:T.string,disabled:T.bool,children:T.node,onKeyDown:T.func,onMouseDown:T.func,onLongPress:T.func,onDoubleClick:T.func},e.exports=I},32035:(e,t,a)=>{var i=a(25347);e.exports=i},56911:e=>{var t={movie:10,series:9,channel:8,tv:7,music:6,radio:5,podcast:4,game:3,book:2,adult:1,other:-1/0},a=new Map([["movie","movies"],["series","series"],["channel","channels"],["tv","tv"],["book","ic_book"],["game","ic_games"],["music","ic_music"],["adult","ic_adult"],["radio","ic_radio"],["podcast","ic_podcast"],["other","movies"]]);e.exports={CHROMECAST_RECEIVER_APP_ID:"1634F54B",DEFAULT_STREAMING_SERVER_URL:"http://127.0.0.1:11470/",SUBTITLES_SIZES:[75,100,125,150,175,200,250],SUBTITLES_FONTS:["PlusJakartaSans","Arial","Halvetica","Times New Roman","Verdana","Courier","Lucida Console","sans-serif","serif","monospace"],SEEK_TIME_DURATIONS:[3e3,5e3,1e4,15e3,2e4,3e4],NEXT_VIDEO_POPUP_DURATIONS:[0,5e3,1e4,15e3,2e4,25e3,3e4,35e3,4e4,45e3,5e4,55e3,6e4,65e3,7e4,75e3,8e4,85e3,9e4],CATALOG_PREVIEW_SIZE:10,CATALOG_PAGE_SIZE:100,NONE_EXTRA_VALUE:"None",SKIP_EXTRA_NAME:"skip",META_LINK_CATEGORY:"meta",IMDB_LINK_CATEGORY:"imdb",SHARE_LINK_CATEGORY:"share",WRITERS_LINK_CATEGORY:"Writers",TYPE_PRIORITIES:t,ICON_FOR_TYPE:a,EXTERNAL_PLAYERS:[{label:"EXTERNAL_PLAYER_DISABLED",value:null,platforms:["ios","visionos","android","windows","linux","macos"]},{label:"EXTERNAL_PLAYER_ALLOW_CHOOSING",value:"choose",platforms:["android"]},{label:"VLC",value:"vlc",platforms:["ios","visionos","android"]},{label:"MPV",value:"mpv",platforms:["macos"]},{label:"IINA",value:"iina",platforms:["macos"]},{label:"MX Player",value:"mxplayer",platforms:["android"]},{label:"Just Player",value:"justplayer",platforms:["android"]},{label:"Outplayer",value:"outplayer",platforms:["ios","visionos"]},{label:"Moonplayer (VisionOS)",value:"moonplayer",platforms:["visionos"]},{label:"M3U Playlist",value:"m3u",platforms:["ios","visionos","android","windows","linux","macos"]}],WHITELISTED_HOSTS:["stremio.com","strem.io","stremio.zendesk.com","google.com","youtube.com","twitch.tv","twitter.com","x.com","netflix.com","adex.network","amazon.com","forms.gle"]}},72277:(e,t,a)=>{var i=["className","value","dataset","onChange"];function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var a=0,i=Array(t);a{var i=a(96540),o=a(5556),n=a(46942),r=a(21154),E=a(87939),_=function(e){return r.parseColor(e,"hexcss4")},T=function(e){var t=e.className,a=e.value,o=e.onInput,T=i.useRef(null),s=i.useRef(null);return i.useLayoutEffect((function(){T.current=r.createPicker(s.current,{color:_(a),showHSL:!1,showHEX:!1,showRGB:!1,showAlpha:!0});var e=s.current.querySelector(".a-color-picker-clipbaord");e instanceof HTMLElement&&(e.tabIndex=-1)}),[]),i.useLayoutEffect((function(){return"function"==typeof o&&T.current.on("change",(function(e,t){o({type:"input",value:_(t)})})),function(){T.current.off("change")}}),[o]),i.useLayoutEffect((function(){var e=_(a);e!==_(T.current.color)&&(T.current.color=e)}),[a]),i.createElement("div",{ref:s,className:n(t,E["color-picker-container"])})};T.propTypes={className:o.string,value:o.string,onInput:o.func},e.exports=T},78236:(e,t,a)=>{var i=a(45865);e.exports=i},8422:(e,t,a)=>{var i=a(72277);e.exports=i},82681:(e,t,a)=>{var i=["_id","notifications","deepLinks"];function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var i=a(82681);e.exports=i},28116:(e,t,a)=>{function i(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,o,n,r,E=[],_=!0,T=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;_=!1}else for(;!(_=(i=n.call(a)).done)&&(E.push(i.value),E.length!==t);_=!0);}catch(e){T=!0,o=e}finally{try{if(!_&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(T)throw o}}return E}})(e,t)||(function(e,t){if(e){if("string"==typeof e)return o(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,t):void 0}})(e,t)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a1&&void 0!==arguments[1]?arguments[1]:function(){};return function(a){var o=r().core,s=T(),S=i(n.useState(null===s),2),l=S[0],I=S[1],u=n.useRef({}),A=n.useRef({}),d=n.useCallback((function(e){return u.current[e]||(u.current[e]=_(o.transport.getState(e))),u.current[e].read()}),[]),O=n.useCallback((function(e){return A.current[e]||(A.current[e]=_(o.transport.decodeStream(e))),A.current[e].read()}),[]),c=n.useMemo((function(){return{getState:d,decodeStream:O}}),[]);return n.useLayoutEffect((function(){l||I(!0)}),[]),l?n.createElement(n.Suspense,{fallback:n.createElement(t,a)},n.createElement(E.Provider,{value:c},n.createElement(e,a))):null}},useCoreSuspender:T}},29661:(e,t,a)=>{function i(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,o,n,r,E=[],_=!0,T=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;_=!1}else for(;!(_=(i=n.call(a)).done)&&(E.push(i.value),E.length!==t);_=!0);}catch(e){T=!0,o=e}finally{try{if(!_&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(T)throw o}}return E}})(e,t)||(function(e,t){if(e){if("string"==typeof e)return o(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,t):void 0}})(e,t)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a{var i=a(29661);e.exports=i},82981:(e,t,a)=>{var i=a(96540),o=a(32389).useTranslation,n=a(32035),r=a(42176),E=a(39484),_=a(81373),T=a(87865).default;e.exports=function(){var e,t,a=o().t,s=E(),S=s.events,l=s.pullEvents,I=s.dismissEvent,u=i.useMemo((function(){var e;return"Ready"===(null==S||null===(e=S.modal)||void 0===e?void 0:e.type)?S.modal.content:null}),[S]),A=i.useCallback((function(){(null==u?void 0:u.id)&&I(u.id)}),[u]);return i.useEffect((function(){l()}),[]),null!==u?i.createElement(r,{className:_["event-modal"],onCloseRequest:A},u.imageUrl?i.createElement("img",{className:_.image,src:u.imageUrl}):null,i.createElement("div",{className:_["info-container"]},i.createElement("div",{className:_["title-container"]},u.title?i.createElement("div",{className:_.title},u.title):null,u.message?i.createElement("div",{className:_.label},u.message):null),null!=u&&null!==(e=u.addon)&&void 0!==e&&e.name?i.createElement("div",{className:_["addon-container"]},i.createElement(T,{className:_.icon,name:"addons"}),i.createElement("div",{className:_.name},u.addon.name)):null,null!=u&&null!==(t=u.addon)&&void 0!==t&&t.manifestUrl?i.createElement(n,{className:_["action-button"],href:"#/addons?addon=".concat(encodeURIComponent(u.addon.manifestUrl)),onClick:A},i.createElement("div",{className:_["button-label"]},a("INSTALL_ADDON"))):u.externalUrl?i.createElement(n,{className:_["action-button"],href:u.externalUrl,target:"_blank"},i.createElement("div",{className:_["button-label"]},a("LEARN_MORE"))):null)):null}},43722:(e,t,a)=>{var i=a(82981);e.exports=i},39484:(e,t,a)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(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 n(e,t,a){return(t=(function(e){var t=(function(e,t){if("object"!=i(e)||!e)return e;var a=e[Symbol.toPrimitive];if(void 0!==a){var o=a.call(e,t||"default");if("object"!=i(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)})(e,"string");return"symbol"==i(t)?t:t+""})(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}var r=a(47067),E=a(40851).useServices,_=function(e){return(function(e){for(var t=1;t{var i=["className","src","alt","fallbackSrc","renderFallback"];function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var a=0,i=Array(t);a{var i=a(38713);e.exports=i},3761:(e,t,a)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}var o=["_id","removable","notifications","watched"];function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;t0;case"remove":return"string"==typeof t&&a}})).map((function(e){return E(E({},e),{},{label:I(e.label)})}))}),[t,a,_.progress,_.deepLinks,r]),d=T.useCallback((function(e){if("function"==typeof _.optionOnSelect&&_.optionOnSelect(e),!e.nativeEvent.optionSelectPrevented)switch(e.value){case"play":_.deepLinks&&"string"==typeof _.deepLinks.player&&(window.location=_.deepLinks.player);break;case"details":_.deepLinks&&("string"==typeof _.deepLinks.metaDetailsVideos?window.location=_.deepLinks.metaDetailsVideos:"string"==typeof _.deepLinks.metaDetailsStreams&&(window.location=_.deepLinks.metaDetailsStreams));break;case"watched":"string"==typeof t&&S.transport.dispatch({action:"Ctx",args:{action:"LibraryItemMarkAsWatched",args:{id:t,is_watched:!r}}});break;case"dismiss":"string"==typeof t&&(S.transport.dispatch({action:"Ctx",args:{action:"RewindLibraryItem",args:t}}),S.transport.dispatch({action:"Ctx",args:{action:"DismissNotificationItem",args:t}}));break;case"remove":"string"==typeof t&&S.transport.dispatch({action:"Ctx",args:{action:"RemoveFromLibrary",args:t}})}}),[t,_.deepLinks,_.optionOnSelect]);return T.createElement(l,n({},_,{watched:r,newVideos:u,options:A,optionOnSelect:d}))};u.propTypes={_id:S.string,removable:S.bool,progress:S.number,notifications:S.object,watched:S.bool,deepLinks:S.shape({metaDetailsVideos:S.string,metaDetailsStreams:S.string,player:S.string}),optionOnSelect:S.func},e.exports=u},38245:(e,t,a)=>{var i=a(3761);e.exports=i},47241:(e,t,a)=>{var i=a(96540),o=a(5556),n=a(46942),r=a(98397),E=r.VerticalNavBar,_=r.HorizontalNavBar,T=a(71242),s=[{id:"board",label:"Board",icon:"home",href:"#/"},{id:"discover",label:"Discover",icon:"discover",href:"#/discover"},{id:"library",label:"Library",icon:"library",href:"#/library"},{id:"calendar",label:"Calendar",icon:"calendar",href:"#/calendar"},{id:"addons",label:"ADDONS",icon:"addons",href:"#/addons"},{id:"settings",label:"SETTINGS",icon:"settings",href:"#/settings"}],S=i.memo((function(e){var t=e.className,a=e.route,o=e.query,r=e.children;return i.createElement("div",{className:n(t,T["main-nav-bars-container"])},i.createElement(_,{className:T["horizontal-nav-bar"],route:a,query:o,backButton:!1,searchBar:!0,fullscreenButton:!0,navMenu:!0}),i.createElement(E,{className:T["vertical-nav-bar"],selected:a,tabs:s}),i.createElement("div",{className:T["nav-content-container"]},r))}));S.displayName="MainNavBars",S.propTypes={className:o.string,route:o.string,query:o.string,children:o.node},e.exports=S},10481:(e,t,a)=>{var i=a(47241);e.exports=i},9951:(e,t,a)=>{var i=["className","type","name","poster","posterShape","posterChangeCursor","progress","newVideos","options","deepLinks","dataset","optionOnSelect","onDismissClick","onPlayClick","watched"];function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var a=0,i=Array(t);a0?E.createElement("div",{className:c["progress-bar-layer"]},E.createElement("div",{className:c["progress-bar"],style:{width:"".concat(m,"%")}}),E.createElement("div",{className:c["progress-bar-background"]})):null,L>0?E.createElement("div",{className:c["new-videos"]},E.createElement("div",{className:c.layer}),E.createElement("div",{className:c.layer}),E.createElement("div",{className:c.layer},E.createElement(l,{className:c.icon,name:"add"}),E.createElement("div",{className:c.label},L))):null),"string"==typeof r&&r.length>0||Array.isArray(D)&&D.length>0?E.createElement("div",{className:c["title-bar-container"]},E.createElement("div",{className:c["title-label"]},"string"==typeof r&&r.length>0?r:""),Array.isArray(D)&&D.length>0?E.createElement(A,{className:c["menu-label-container"],renderLabelContent:H,options:D,onOpen:y,onClose:b,onSelect:F,tabIndex:-1,onClick:k}):null):null)}));R.displayName="MetaItem",R.propTypes={className:_.string,type:_.string,name:_.string,poster:_.string,posterShape:_.oneOf(["poster","landscape","square"]),posterChangeCursor:_.bool,progress:_.number,newVideos:_.number,options:_.array,deepLinks:_.shape({metaDetailsVideos:_.string,metaDetailsStreams:_.string,player:_.string}),dataset:_.object,optionOnSelect:_.func,onDismissClick:_.func,onPlayClick:_.func,onClick:_.func,watched:_.bool},e.exports=R},5961:(e,t,a)=>{var i=a(9951);e.exports=i},49095:(e,t,a)=>{var i=["className","icon","label","tooltip"];function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t0?n.createElement("div",{className:s["icon-container"]},n.createElement(_,{className:s.icon,name:a})):null,!l&&"string"==typeof r&&r.length>0?n.createElement("div",{className:s["label-container"]},n.createElement("div",{className:s.label},r)):null)};l.propTypes={className:r.string,icon:r.string,label:r.string,tooltip:r.bool},e.exports=l},69117:(e,t,a)=>{var i=a(49095);e.exports=i},41537:(e,t,a)=>{var i=a(96540),o=a(5556),n=a(46942),r=a(32389).useTranslation,E=a(32035),_=a(83116),T=function(e){var t=e.className,a=e.label,o=e.links,T=r().t;return i.createElement("div",{className:n(t,_["meta-links-container"])},"string"==typeof a&&a.length>0?i.createElement("div",{className:_["label-container"]},T("LINKS_".concat(a.toUpperCase()))):null,Array.isArray(o)&&o.length>0?i.createElement("div",{className:_["links-container"]},o.map((function(e,t){var a=e.label,o=e.href;return i.createElement(E,{key:t,className:_["link-container"],title:a,href:o},T(a))}))):null)};T.propTypes={className:o.string,label:o.string,links:o.arrayOf(o.shape({label:o.string,href:o.string}))},e.exports=T},27163:(e,t,a)=>{var i=a(41537);e.exports=i},40989:(e,t,a)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var a=0,i=Array(t);a0&&(e.has(a)||e.set(a,[]),e.get(a).push({label:i,href:"https://www.stremio.com/warning#".concat(encodeURIComponent(o))})),e}),new Map):new Map}),[B]),F=_.useMemo((function(){return P?"string"==typeof P.player?P.player:"string"==typeof P.metaDetailsStreams?P.metaDetailsStreams:"string"==typeof P.metaDetailsVideos?P.metaDetailsVideos:null:null}),[P]),V=_.useMemo((function(){return Array.isArray(g)&&0!==g.length?g[0].deepLinks.player:null}),[g]),H=_.useCallback((function(){return _.createElement("div",{className:p["logo-placeholder"]},i)}),[i]);return _.createElement("div",{className:s(t,p["meta-preview-container"],n({},p.compact,a))},"string"==typeof T&&T.length>0?_.createElement("div",{className:p["background-image-layer"]},_.createElement(A,{className:p["background-image"],src:T,alt:" "})):null,_.createElement("div",{className:p["meta-info-container"]},"string"==typeof E&&E.length>0?_.createElement(A,{className:p.logo,src:E,alt:" ",title:i,renderFallback:H}):H(),"string"==typeof D&&D.length>0||C instanceof Date&&!isNaN(C.getTime())||"string"==typeof R&&R.length>0||k.has(c.IMDB_LINK_CATEGORY)?_.createElement("div",{className:p["runtime-release-info-container"]},"string"==typeof R&&R.length>0?_.createElement("div",{className:p["runtime-label"]},R):null,"string"==typeof D&&D.length>0?_.createElement("div",{className:p["release-info-label"]},D):C instanceof Date&&!isNaN(C.getTime())?_.createElement("div",{className:p["release-info-label"]},C.getFullYear()):null,k.has(c.IMDB_LINK_CATEGORY)?_.createElement(u,o({className:p["imdb-button-container"],title:k.get(c.IMDB_LINK_CATEGORY).label,href:k.get(c.IMDB_LINK_CATEGORY).href,target:"_blank"},a?{tabIndex:-1}:null),_.createElement("div",{className:p.label},k.get(c.IMDB_LINK_CATEGORY).label),_.createElement(I,{className:p.icon,name:"imdb"})):null):null,a&&"string"==typeof f&&f.length>0?_.createElement("div",{className:p["description-container"]},f):null,Array.from(k.keys()).filter((function(e){return e!==c.IMDB_LINK_CATEGORY&&e!==c.SHARE_LINK_CATEGORY&&e!==c.WRITERS_LINK_CATEGORY})).map((function(e,t){return _.createElement(L,{key:t,className:p["meta-links"],label:e,links:k.get(e)})})),!a&&"string"==typeof f&&f.length>0?_.createElement("div",{className:p["description-container"]},_.createElement("div",{className:p["label-container"]},W("SUMMARY")),f):null),_.createElement("div",{className:p["action-buttons-container"]},"function"==typeof M?_.createElement(m,{className:p["action-button"],icon:v?"remove-from-library":"add-to-library",label:W(v?"REMOVE_FROM_LIB":"ADD_TO_LIB"),tooltip:a,tabIndex:a?-1:0,onClick:M}):null,"string"==typeof V?_.createElement(m,{className:p["action-button"],icon:"trailer",label:W("TRAILER"),tabIndex:a?-1:0,href:V,tooltip:a}):null,"string"==typeof F&&a?_.createElement(m,{className:s(p["action-button"],p["show-button"]),icon:"play",label:W("SHOW"),tabIndex:a?-1:0,href:F}):null,k.has(c.SHARE_LINK_CATEGORY)&&!a?_.createElement(_.Fragment,null,_.createElement(m,{className:p["action-button"],icon:"share",label:W("CTX_SHARE"),tooltip:!0,tabIndex:a?-1:0,onClick:U}),b?_.createElement(d,{title:W("CTX_SHARE"),onCloseRequest:G},_.createElement(O,{className:p["share-prompt"],url:k.get(c.SHARE_LINK_CATEGORY).href})):null):null))};C.Placeholder=D,C.propTypes={className:T.string,compact:T.bool,name:T.string,logo:T.string,background:T.string,runtime:T.string,releaseInfo:T.string,released:T.instanceOf(Date),description:T.string,deepLinks:T.shape({metaDetailsVideos:T.string,metaDetailsStreams:T.string,player:T.string}),links:T.arrayOf(T.shape({category:T.string,name:T.string,url:T.string})),trailerStreams:T.array,inLibrary:T.bool,toggleInLibrary:T.func},e.exports=C},98003:(e,t,a)=>{var i=a(96540),o=a(5556),n=a(46942),r=a(59494),E=function(e){var t=e.className;return i.createElement("div",{className:n(t,r["meta-preview-placeholder-container"])},i.createElement("div",{className:r["meta-info-container"]},i.createElement("div",{className:r["logo-container"]}),i.createElement("div",{className:r["duration-release-info-container"]},i.createElement("div",{className:r["duration-container"]}),i.createElement("div",{className:r["release-info-container"]})),i.createElement("div",{className:r["genres-container"]},i.createElement("div",{className:r["genres-header-container"]}),i.createElement("div",{className:r["genre-label-container"]})),i.createElement("div",{className:r["genres-container"]},i.createElement("div",{className:r["genres-header-container"]}),i.createElement("div",{className:r["genre-label-container"]})),i.createElement("div",{className:r["genres-container"]},i.createElement("div",{className:r["genres-header-container"]}),i.createElement("div",{className:r["genre-label-container"]}))),i.createElement("div",{className:r["action-buttons-container"]}))};E.propTypes={className:o.string},e.exports=E},81067:(e,t,a)=>{var i=a(98003);e.exports=i},66938:(e,t,a)=>{var i=a(40989);e.exports=i},37741:(e,t,a)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(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 n(e){for(var t=1;t0?E.createElement("div",{className:d["title-container"],title:O},O):null,R?E.createElement(l,{className:d["see-all-container"],title:A.string("BUTTON_SEE_ALL"),href:R,tabIndex:-1},E.createElement("div",{className:d.label},A.string("BUTTON_SEE_ALL")),E.createElement(S,{className:d.icon,name:"chevron-forward"})):null),"string"==typeof o&&o.length>0?E.createElement("div",{className:d["message-container"],title:o},o):E.createElement("div",{className:d["meta-items-container"]},_.isValidElementType(r)?c.slice(0,I.CATALOG_PREVIEW_SIZE).map((function(e,t){return E.createElement(r,n(n({},e),{},{key:t,className:s(d["meta-item"],d["poster-shape-poster"],d["poster-shape-".concat(e.posterShape)]),notifications:T}))})):null,Array(Math.max(0,I.CATALOG_PREVIEW_SIZE-c.length)).fill(null).map((function(e,t){return E.createElement("div",{key:t,className:s(d["meta-item"],d["poster-shape-poster"])})}))))};O.Placeholder=A,O.propTypes={className:T.string,title:T.string,message:T.string,catalog:T.shape({id:T.string,name:T.string,type:T.string,addon:T.shape({manifest:T.shape({id:T.string,name:T.string})}),content:T.shape({content:T.oneOfType([T.string,T.arrayOf(T.shape({posterShape:T.string}))])}),items:T.arrayOf(T.shape({posterShape:T.string})),deepLinks:T.shape({discover:T.string,library:T.string})}),itemComponent:T.elementType,notifications:T.object},e.exports=O},84791:(e,t,a)=>{var i=a(96540),o=a(5556),n=a(46942),r=a(32389).useTranslation,E=a(87865).default,_=a(32035),T=a(56911),s=a(85006),S=function(e){var t=e.className,a=e.title,o=e.deepLinks,S=r().t;return i.createElement("div",{className:n(t,s["meta-row-placeholder-container"])},i.createElement("div",{className:s["header-container"]},i.createElement("div",{className:s["title-container"],title:"string"==typeof a&&a.length>0?a:null},"string"==typeof a&&a.length>0?a:null),o&&"string"==typeof o.discover?i.createElement(_,{className:s["see-all-container"],title:S("BUTTON_SEE_ALL"),href:o.discover,tabIndex:-1},i.createElement("div",{className:s.label},S("BUTTON_SEE_ALL")),i.createElement(E,{className:s.icon,name:"chevron-forward"})):null),i.createElement("div",{className:s["meta-items-container"]},Array(T.CATALOG_PREVIEW_SIZE).fill(null).map((function(e,t){return i.createElement("div",{key:t,className:s["meta-item"]},i.createElement("div",{className:s["poster-container"]}),i.createElement("div",{className:s["title-bar-container"]},i.createElement("div",{className:s["title-label"]})))}))))};S.propTypes={className:o.string,title:o.string,deepLinks:o.shape({discover:o.string})},e.exports=S},13723:(e,t,a)=>{var i=a(84791);e.exports=i},6842:(e,t,a)=>{var i=a(37741);e.exports=i},74593:(e,t,a)=>{var i=["className","title","buttons","children","dataset","onCloseRequest","background"];function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t0?n.createElement("div",{className:u["title-container"],title:a},a):null,n.createElement("div",{className:u["body-container"]},_),Array.isArray(r)&&r.length>0?n.createElement("div",{className:u["buttons-container"]},r.map((function(e,t){var a=e.className,i=e.label,r=e.icon,_=e.props;return n.createElement(S,o({title:i},_,{key:t,className:E(a,u["action-button"])}),"string"==typeof r&&r.length>0?n.createElement(l,{className:u.icon,name:r}):null,"string"==typeof i&&i.length>0?n.createElement("div",{className:u.label},i):null)}))):null)))};A.propTypes={className:r.string,title:r.string,background:r.string,buttons:r.arrayOf(r.shape({className:r.string,label:r.string,icon:r.string,props:r.object})),children:r.oneOfType([r.arrayOf(r.node),r.node]),dataset:r.object,onCloseRequest:r.func},e.exports=A},42176:(e,t,a)=>{var i=a(74593);e.exports=i},20845:(e,t,a)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}var o=["className","mode","direction","title","disabled","dataset","renderLabelContent","renderLabelText","onOpen","onClose","onSelect"],n=["children","className"];function r(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 E(e){for(var t=1;te.length)&&(t=e.length);for(var a=0,i=Array(t);a0?M.map((function(e){var t=v.find((function(t){return t.value===e}));return t&&"string"==typeof t.label?t.label:e})).join(", "):r),I.createElement(d,{className:m.icon,name:"caret-down"})),t)}),[P,r,_,v,M,W,u,L]),F=I.useCallback((function(){return I.createElement("div",{className:m["menu-container"],onKeyDown:b,onClick:y},v.length>0?v.map((function(e){var t=e.label,a=e.title,i=e.value;return I.createElement(O,{key:i,className:A(m["option-container"],{selected:M.includes(i)}),title:"string"==typeof a?a:"string"==typeof t?t:i,"data-value":i,onClick:U},I.createElement("div",{className:m.label},"string"==typeof t?t:i),I.createElement("div",{className:m.icon}))})):I.createElement("div",{className:m["no-options-container"]},I.createElement("div",{className:m.label},"No options available")))}),[v,M,b,y,U]),V=I.useMemo((function(){return function(e){return k(E(E(E({},e),C),{},{className:A(t,e.className)}))}}),[C,t,k]);return"modal"===a?k(E(E({},C),{},{className:t,children:P?I.createElement(R,{className:m["modal-container"],title:r,onCloseRequest:B,onKeyDown:b,onClick:y},F()):null})):I.createElement(c,{open:P,direction:i,onCloseRequest:B,renderLabel:V,renderMenu:F})};L.propTypes={className:u.string,mode:u.oneOf(["popup","modal"]),direction:u.any,title:u.string,options:u.arrayOf(u.shape({value:u.string,title:u.string,label:u.string})),selected:u.arrayOf(u.string),disabled:u.bool,dataset:u.object,renderLabelContent:u.func,renderLabelText:u.func,onOpen:u.func,onClose:u.func,onSelect:u.func,onClick:u.func},e.exports=L},50472:(e,t,a)=>{var i=a(20845);e.exports=i},61320:(e,t,a)=>{var i=["className","route","query","title","backButton","searchBar","fullscreenButton","navMenu"];function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var a=0,i=Array(t);a0?E.createElement("h2",{className:O.title},R):null,m&&"addons"!==r?E.createElement(A,{className:O["search-bar"],query:_,active:"search"===r}):null,E.createElement("div",{className:O["buttons-container"]},!g&&L?E.createElement(S,{className:O["button-container"],title:c(f?"EXIT_FULLSCREEN":"ENTER_FULLSCREEN"),tabIndex:-1,onClick:f?B:P},E.createElement(s,{className:O.icon,name:f?"minimize":"maximize"})):null,D?E.createElement(d,{renderLabel:v}):null))}));R.displayName="HorizontalNavBar",R.propTypes={className:_.string,route:_.string,query:_.string,title:_.string,backButton:_.bool,searchBar:_.bool,fullscreenButton:_.bool,navMenu:_.bool},e.exports=R},2643:(e,t,a)=>{function i(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,o,n,r,E=[],_=!0,T=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;_=!1}else for(;!(_=(i=n.call(a)).done)&&(E.push(i.value),E.length!==t);_=!0);}catch(e){T=!0,o=e}finally{try{if(!_&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(T)throw o}}return E}})(e,t)||(function(e,t){if(e){if("string"==typeof e)return o(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,t):void 0}})(e,t)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(){"use strict";o=function(){return t};var e,t={},a=Object.prototype,n=a.hasOwnProperty,r=Object.defineProperty||function(e,t,a){e[t]=a.value},E="function"==typeof Symbol?Symbol:{},_=E.iterator||"@@iterator",T=E.asyncIterator||"@@asyncIterator",s=E.toStringTag||"@@toStringTag";function S(e,t,a){return Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{S({},"")}catch(e){S=function(e,t,a){return e[t]=a}}function l(e,t,a,i){var o=t&&t.prototype instanceof R?t:R,n=Object.create(o.prototype),E=new M(i||[]);return r(n,"_invoke",{value:P(e,a,E)}),n}function I(e,t,a){try{return{type:"normal",arg:e.call(t,a)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var u="suspendedStart",A="suspendedYield",d="executing",O="completed",c={};function R(){}function N(){}function m(){}var L={};S(L,_,(function(){return this}));var D=Object.getPrototypeOf,p=D&&D(D(W([])));p&&p!==a&&n.call(p,_)&&(L=p);var h=m.prototype=R.prototype=Object.create(L);function C(e){["next","throw","return"].forEach((function(t){S(e,t,(function(e){return this._invoke(t,e)}))}))}function f(e,t){function a(o,r,E,_){var T=I(e[o],e,r);if("throw"!==T.type){var s=T.arg,S=s.value;return S&&"object"==i(S)&&n.call(S,"__await")?t.resolve(S.__await).then((function(e){a("next",e,E,_)}),(function(e){a("throw",e,E,_)})):t.resolve(S).then((function(e){s.value=e,E(s)}),(function(e){return a("throw",e,E,_)}))}_(T.arg)}var o;r(this,"_invoke",{value:function(e,i){function n(){return new t((function(t,o){a(e,i,t,o)}))}return o=o?o.then(n,n):n()}})}function P(t,a,i){var o=u;return function(n,r){if(o===d)throw Error("Generator is already running");if(o===O){if("throw"===n)throw r;return{value:e,done:!0}}for(i.method=n,i.arg=r;;){var E=i.delegate;if(E){var _=B(E,i);if(_){if(_===c)continue;return _}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(o===u)throw o=O,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);o=d;var T=I(t,a,i);if("normal"===T.type){if(o=i.done?O:A,T.arg===c)continue;return{value:T.arg,done:i.done}}"throw"===T.type&&(o=O,i.method="throw",i.arg=T.arg)}}}function B(t,a){var i=a.method,o=t.iterator[i];if(o===e)return a.delegate=null,"throw"===i&&t.iterator.return&&(a.method="return",a.arg=e,B(t,a),"throw"===a.method)||"return"!==i&&(a.method="throw",a.arg=new TypeError("The iterator does not provide a '"+i+"' method")),c;var n=I(o,t.iterator,a.arg);if("throw"===n.type)return a.method="throw",a.arg=n.arg,a.delegate=null,c;var r=n.arg;return r?r.done?(a[t.resultName]=r.value,a.next=t.nextLoc,"return"!==a.method&&(a.method="next",a.arg=e),a.delegate=null,c):r:(a.method="throw",a.arg=new TypeError("iterator result is not an object"),a.delegate=null,c)}function g(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function v(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function M(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(g,this),this.reset(!0)}function W(t){if(t||""===t){var a=t[_];if(a)return a.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,r=function a(){for(;++o=0;--o){var r=this.tryEntries[o],E=r.completion;if("root"===r.tryLoc)return i("end");if(r.tryLoc<=this.prev){var _=n.call(r,"catchLoc"),T=n.call(r,"finallyLoc");if(_&&T){if(this.prev=0;--a){var i=this.tryEntries[a];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--t){var a=this.tryEntries[t];if(a.finallyLoc===e)return this.complete(a.completion,a.afterLoc),v(a),c}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var a=this.tryEntries[t];if(a.tryLoc===e){var i=a.completion;if("throw"===i.type){var o=i.arg;v(a)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,a,i){return this.delegate={iterator:W(t),resultName:a,nextLoc:i},"next"===this.method&&(this.arg=e),c}},t}function n(e,t,a,i,o,n,r){try{var E=e[n](r),_=E.value}catch(e){return void a(e)}E.done?t(_):Promise.resolve(_).then(i,o)}function r(e){return function(){var t=this,a=arguments;return new Promise((function(i,o){var r=e.apply(t,a);function E(e){n(r,i,o,E,_,"next",e)}function _(e){n(r,i,o,E,_,"throw",e)}E(void 0)}))}}function E(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,o,n,r,E=[],_=!0,T=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;_=!1}else for(;!(_=(i=n.call(a)).done)&&(E.push(i.value),E.length!==t);_=!0);}catch(e){T=!0,o=e}finally{try{if(!_&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(T)throw o}}return E}})(e,t)||(function(e,t){if(e){if("string"==typeof e)return _(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_(e,t):void 0}})(e,t)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function _(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a{var i=a(2643);e.exports=i},91415:(e,t,a)=>{function i(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,o,n,r,E=[],_=!0,T=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;_=!1}else for(;!(_=(i=n.call(a)).done)&&(E.push(i.value),E.length!==t);_=!0);}catch(e){T=!0,o=e}finally{try{if(!_&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(T)throw o}}return E}})(e,t)||(function(e,t){if(e){if("string"==typeof e)return o(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,t):void 0}})(e,t)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a0?n.createElement(l,{className:O["submit-button-container"],onClick:V},n.createElement(s,{className:O.icon,name:"close"})):n.createElement(l,{className:O["submit-button-container"]},n.createElement(s,{className:O.icon,name:"search"})),P&&(null!=p&&null!==(t=p.items)&&void 0!==t&&t.length||null!=h&&null!==(a=h.items)&&void 0!==a&&a.length)?n.createElement("div",{className:O["menu-container"]},(null==p||null===(o=p.items)||void 0===o?void 0:o.length)>0?n.createElement("div",{className:O.items},n.createElement("div",{className:O.title},n.createElement("div",{className:O.label},L("STREMIO_TV_SEARCH_HISTORY_TITLE")),n.createElement("button",{className:O["search-history-clear"],onClick:p.clear},L("CLEAR_HISTORY"))),p.items.slice(0,8).map((function(e,t){var a=e.query,i=e.deepLinks;return n.createElement(l,{key:t,className:O.item,href:i.search,onClick:g},a)}))):null,null!=h&&null!==(r=h.items)&&void 0!==r&&r.length?n.createElement("div",{className:O.items},n.createElement("div",{className:O.title},n.createElement("div",{className:O.label},L("SEARCH_SUGGESTIONS"))),h.items.map((function(e,t){var a=e.query,i=e.deepLinks;return n.createElement(l,{key:t,className:O.item,href:i.search,onClick:g},a)}))):null):null)}));N.displayName="SearchBar",N.propTypes={className:r.string,query:r.string,active:r.bool};var m=function(e){var t=e.className,a=T().t;return n.createElement("label",{className:E(t,O["search-bar-container"])},n.createElement("div",{className:O["search-input"]},n.createElement("div",{className:O["placeholder-label"]},a("SEARCH_OR_PASTE_LINK"))),n.createElement(l,{className:O["submit-button-container"],tabIndex:-1},n.createElement(s,{className:O.icon,name:"search"})))};m.propTypes=N.propTypes,e.exports=u(N,m)},45454:(e,t,a)=>{var i=a(91415);e.exports=i},56882:(e,t,a)=>{var i=a(96540),o=a(40851).useServices,n=a(47067);e.exports=function(){var e=o().core,t=i.useMemo((function(){return{action:"Load",args:{model:"LocalSearch"}}}),[]);return{items:n({model:"local_search",action:t}).items,search:i.useCallback((function(t){e.transport.dispatch({action:"Search",args:{action:"Search",args:{searchQuery:t,maxResults:5}}})}),[])}}},52809:(e,t,a)=>{var i=a(96540),o=a(47067),n=a(40851).useServices;e.exports=function(){var e=n().core;return{items:o({model:"ctx"}).searchHistory,clear:i.useCallback((function(){e.transport.dispatch({action:"Ctx",args:{action:"ClearSearchHistory"}})}),[])}}},51924:(e,t,a)=>{var i=a(61320);e.exports=i},46923:(e,t,a)=>{var i=a(96540),o=a(5556),n=a(46942),r=a(87865).default,E=a(32035),_=a(95196),T=a(58906),s=function(e){var t=e.className,a=e.logo,o=e.icon,s=e.label,S=e.href,l=e.selected,I=e.onClick,u=i.useCallback((function(){return"string"==typeof o&&o.length>0?i.createElement(r,{className:T.icon,name:o}):null}),[o]);return i.createElement(E,{className:n(t,T["nav-tab-button-container"],{selected:l}),title:s,tabIndex:-1,href:S,onClick:I,onDoubleClick:function(){document.querySelectorAll("div").forEach((function(e){e.scrollTop>0&&e.scrollTo({top:0,behavior:"smooth"})}))}},"string"==typeof a&&a.length>0?i.createElement(_,{className:T.logo,src:a,alt:" ",renderFallback:u}):"string"==typeof o&&o.length>0?i.createElement(r,{className:T.icon,name:l?o:"".concat(o,"-outline")}):null,"string"==typeof s&&s.length>0?i.createElement("div",{className:T.label},s):null)};s.propTypes={className:o.string,logo:o.string,icon:o.string,label:o.string,href:o.string,selected:o.bool,onClick:o.func},e.exports=s},12903:(e,t,a)=>{var i=a(46923);e.exports=i},58288:(e,t,a)=>{var i=a(96540),o=a(5556),n=a(46942),r=a(32389).useTranslation,E=a(12903),_=a(80335),T=i.memo((function(e){var t=e.className,a=e.selected,o=e.tabs,T=r().t;return i.createElement("nav",{className:n(t,_["vertical-nav-bar-container"])},Array.isArray(o)?o.map((function(e,t){return i.createElement(E,{key:t,className:_["nav-tab-button"],selected:e.id===a,href:e.href,logo:e.logo,icon:e.icon,label:T(e.label),onClick:e.onClick})})):null)}));T.displayName="VerticalNavBar",T.propTypes={className:o.string,selected:o.string,tabs:o.arrayOf(o.shape({id:o.string,label:o.string,logo:o.string,icon:o.string,href:o.string,onClick:o.func}))},e.exports=T},44330:(e,t,a)=>{var i=a(58288);e.exports=i},98397:(e,t,a)=>{var i=a(51924),o=a(44330);e.exports={HorizontalNavBar:i,VerticalNavBar:o}},3813:(e,t,a)=>{var i=a(96540),o=a(5556),n=a(54395),r=function(e){var t=e.className;return i.createElement("svg",{className:t,viewBox:"0 0 100 100"},i.createElement("circle",{className:n.background,cx:"50",cy:"50",r:"50"}),i.createElement("svg",{className:n.icon,x:"0",y:"25",width:"100",height:"50",viewBox:"0 0 37.14 32"},i.createElement("path",{d:"M 9.14,0 37.14,16 9.14,32 Z"})))};r.propTypes={className:o.string},e.exports=r},49356:(e,t,a)=>{var i=a(3813);e.exports=i},95453:(e,t,a)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}var o=["open","direction","renderLabel","renderMenu","dataset","onCloseRequest"];function n(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 r(e){for(var t=1;te.length)&&(t=e.length);for(var a=0,i=Array(t);a=n.top?e.push("bottom"):e.push("top"),o.width<=n.right+i.width?e.push("right"):o.width<=n.left+i.width?e.push("left"):n.right>n.left?e.push("right"):e.push("left"),D(e.join("-"))}else D(null)}),[t]),i(r(r({},O),{},{ref:R,className:l(A["label-container"],O.className,{active:t}),children:t?s.createElement(I,{ref:N,className:l(A["menu-container"],E({},A["menu-direction-".concat(L)],!a),E({},A["menu-direction-".concat(a)],a)),autoFocus:!1,lockProps:{onMouseDown:p}},n()):null}))};O.propTypes={open:S.bool,direction:S.oneOf(["top-left","bottom-left","top-right","bottom-right"]),renderLabel:S.func.isRequired,renderMenu:S.func.isRequired,dataset:S.object,onCloseRequest:S.func},e.exports=O},94323:(e,t,a)=>{var i=a(95453);e.exports=i},81745:(e,t,a)=>{var i=a(96540),o=a(5556),n=a(46942),r=a(87865).default,E=a(72154).default,_=a(81415),T=a(77845),s=function(e){var t=e.className,a=e.title,o=e.value,_=e.onChange;return i.createElement("label",{title:a,className:n(t,T["search-bar-container"])},i.createElement(E,{className:T["search-input"],type:"text",placeholder:a,value:o,onChange:_}),i.createElement(r,{className:T.icon,name:"search"}))};s.Placeholder=_,s.propTypes={className:o.string,title:o.string,value:o.string,onChange:o.func},e.exports=s},32229:(e,t,a)=>{var i=a(96540),o=a(5556),n=a(46942),r=a(87865).default,E=a(94874),_=function(e){var t=e.className,a=e.title;return i.createElement("div",{className:n(t,E["search-bar-container"])},i.createElement("div",{className:E["search-input"]},a),i.createElement(r,{className:E.icon,name:"search"}))};_.propTypes={className:o.string,title:o.string},e.exports=_},81415:(e,t,a)=>{var i=a(32229);e.exports=i},52224:(e,t,a)=>{var i=a(81745);e.exports=i},15237:(e,t,a)=>{var i=a(96540),o=a(5556),n=a(46942),r=a(32389).useTranslation,E=a(87865).default,_=a(16834).useRouteFocused,T=a(40851).useServices,s=a(8334),S=a(72154).default,l=a(32035),I=a(2581),u=function(e){var t=e.className,a=e.url,o=r().t,u=T().core,A=s(),d=i.useRef(null),O=_(),c=i.useCallback((function(){null!==d.current&&d.current.select()}),[]),R=i.useCallback((function(){null!==d.current&&(d.current.select(),document.execCommand("copy"),A.show({type:"success",title:"Copied to clipboard",timeout:3e3}))}),[]);return i.useEffect((function(){O&&null!==d.current&&d.current.select()}),[O]),i.useEffect((function(){u.transport.analytics({event:"Share",args:{url:a}})}),[a]),i.createElement("div",{className:n(t,I["share-prompt-container"])},i.createElement("div",{className:I["buttons-container"]},i.createElement(l,{className:n(I["button-container"],I["facebook-button"]),title:"Facebook",href:"https://www.facebook.com/sharer/sharer.php?u=".concat(a),target:"_blank"},i.createElement(E,{className:I.icon,name:"facebook"})),i.createElement(l,{className:n(I["button-container"],I["x-button"]),title:"X (Twitter)",href:"https://twitter.com/intent/tweet?text=".concat(a),target:"_blank"},i.createElement(E,{className:I.icon,name:"x"})),i.createElement(l,{className:n(I["button-container"],I["reddit-button"]),title:"Reddit",href:"https://www.reddit.com/submit?url=".concat(a),target:"_blank"},i.createElement(E,{className:I.icon,name:"reddit"}))),i.createElement("div",{className:I["url-container"]},i.createElement(S,{ref:d,className:I["url-text-input"],type:"text",readOnly:!0,defaultValue:a,onClick:c,tabIndex:-1}),i.createElement(l,{className:I["copy-button"],title:"Copy to clipboard",onClick:R},i.createElement(E,{className:I.icon,name:"link"}),i.createElement("div",{className:I.label},o("COPY")))))};u.propTypes={className:o.string,url:o.string},e.exports=u},23596:(e,t,a)=>{var i=a(15237);e.exports=i},83221:(e,t,a)=>{function i(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,o,n,r,E=[],_=!0,T=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;_=!1}else for(;!(_=(i=n.call(a)).done)&&(E.push(i.value),E.length!==t);_=!0);}catch(e){T=!0,o=e}finally{try{if(!_&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(T)throw o}}return E}})(e,t)||(function(e,t){if(e){if("string"==typeof e)return o(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,t):void 0}})(e,t)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a{var i=a(83221);e.exports=i},3557:(e,t,a)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(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 n(e){for(var t=1;tDate.now()?null:E.createElement("div",{className:s(t,A["warning-container"])},E.createElement("div",{className:A["warning-statement"]},a("SETTINGS_SERVER_UNAVAILABLE")),E.createElement("a",{href:"https://www.stremio.com/download-service",target:"_blank",rel:"noreferrer"},E.createElement(l,{className:A["warning-button"],title:a("SERVICE_INSTALL"),tabIndex:-1},E.createElement("div",{className:A["warning-label"]},a("SERVICE_INSTALL")))),E.createElement(l,{className:A["warning-button"],title:a("WARNING_STREAMING_SERVER_LATER"),onClick:r,tabIndex:-1},E.createElement("div",{className:A["warning-label"]},a("WARNING_STREAMING_SERVER_LATER"))),E.createElement(l,{className:A["warning-button"],title:a("DONT_SHOW_AGAIN"),onClick:T,tabIndex:-1},E.createElement("div",{className:A["warning-label"]},a("DONT_SHOW_AGAIN"))))};d.propTypes={className:T.string},e.exports=u(d)},27142:(e,t,a)=>{var i=a(3557);e.exports=i},40358:(e,t,a)=>{var i=a(96540).createContext({show:function(){},clear:function(){}});i.displayName="ToastContext",e.exports=i},44857:(e,t,a)=>{var i=["title","message","dataset","onSelect","onClose"];var o=a(96540),n=a(5556),r=a(46942),E=a(87865).default,_=a(32035),T=a(86986),s=function(e){var t=e.title,a=e.message,n=e.dataset,s=e.onSelect,S=e.onClose,l=(function(e,t){if(null==e)return{};var a,i,o=(function(e,t){if(null==e)return{};var a={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.includes(i))continue;a[i]=e[i]}return a})(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(i=0;i0?o.createElement("div",{className:T["icon-container"]},o.createElement(E,{className:T.icon,name:u})):null,o.createElement("div",{className:T["info-container"]},"string"==typeof t&&t.length>0?o.createElement("div",{className:T["title-container"]},t):null,"string"==typeof a&&a.length>0?o.createElement("div",{className:T["message-container"]},a):null),o.createElement(_,{className:T["close-button-container"],title:"Close",tabIndex:-1,onClick:d},o.createElement(E,{className:T.icon,name:"close"})))};s.propTypes={type:n.oneOf(["success","alert","info","error"]),title:n.string,message:n.string,icon:n.string,dataset:n.object,onSelect:n.func,onClose:n.func},e.exports=s},86145:(e,t,a)=>{var i=a(44857);e.exports=i},62356:(e,t,a)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var a=0,i=Array(t);a-1&&e.splice(a,1)},show:function(t){if(!e.some((function(e){return e(t)}))){var a="number"!=typeof t.timeout||isNaN(t.timeout)?3e3:t.timeout,i=setTimeout((function(){A({type:"remove",id:i})}),a);A({type:"add",item:r(r({},t),{},{id:i,dataset:r(r({},t.dataset),{},{id:i}),onClose:d})})}},clear:function(){A({type:"clear"})}}}),[]);return s.createElement(I.Provider,{value:O},n instanceof HTMLElement?a:null,s.createElement("div",{ref:E,className:t},u.map((function(e,t){return s.createElement(l,o({key:t},e))}))))};u.propTypes={className:S.string,children:S.node},e.exports=u},65794:(e,t,a)=>{var i=a(62356),o=a(8334);e.exports={ToastProvider:i,useToast:o}},8334:(e,t,a)=>{var i=a(96540),o=a(40358);e.exports=function(){return i.useContext(o)}},16119:(e,t,a)=>{var i=["className","checked","children"];function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var i=a(16119);e.exports=i},39020:(e,t,a)=>{var i=a(96540),o=a(5556),n=a(82933),r=a(20162),E=function(e){var t=e.label,a=e.position,o=e.margin,E=void 0===o?15:o,_=n(),T=i.useRef((Math.random()+1).toString(36).substring(7)),s=i.useRef(null),S=function(){_.update(T.current,{active:!0})},l=function(){_.update(T.current,{active:!1})};return i.useEffect((function(){_.update(T.current,{label:t})}),[t]),i.useLayoutEffect((function(){if(s.current&&s.current.parentElement){var e=s.current.parentElement;_.add({id:T.current,label:t,position:a,margin:E,parent:e}),e.addEventListener("mouseenter",S),e.addEventListener("mouseleave",l)}return function(){if(s.current&&s.current.parentElement){var e=s.current.parentElement;e.removeEventListener("mouseenter",S),e.removeEventListener("mouseleave",l),_.remove(T.current)}}}),[]),i.createElement("div",{ref:s,className:r["tooltip-placeholder"]})};E.propTypes={label:o.string.isRequired,position:o.string.isRequired,margin:o.number},e.exports=E},14703:(e,t,a)=>{var i=a(39020);e.exports=i},73325:(e,t,a)=>{var i=(0,a(96540).createContext)(null);e.exports=i},50824:(e,t,a)=>{function i(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,o,n,r,E=[],_=!0,T=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;_=!1}else for(;!(_=(i=n.call(a)).done)&&(E.push(i.value),E.length!==t);_=!0);}catch(e){T=!0,o=e}finally{try{if(!_&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(T)throw o}}return E}})(e,t)||(function(e,t){if(e){if("string"==typeof e)return o(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,t):void 0}})(e,t)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a{var i=a(50824);e.exports=i},97717:(e,t,a)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}var o=["id"];function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var a=0,i=Array(t);a{var i=a(97717),o=a(14703);e.exports={TooltipProvider:i,Tooltip:o}},82933:(e,t,a)=>{var i=a(96540),o=a(73325);e.exports=function(){return i.useContext(o)}},6581:(e,t,a)=>{var i=["className","id","title","thumbnail","episode","released","upcoming","watched","progress","scheduled","deepLinks","onMarkVideoAsWatched"],o=["className","id","title","thumbnail","episode","released","upcoming","watched","progress","scheduled","children"];function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var a=0,i=Array(t);a0?T.createElement("div",{className:N["thumbnail-container"]},T.createElement(d,{className:N.thumbnail,src:r,alt:" ",renderFallback:function(){return T.createElement(u,{className:N["placeholder-icon"],name:"symbol"})}}),null!==O&&!isNaN(O)&&O>0?T.createElement("div",{className:N["progress-bar-container"]},T.createElement("div",{className:N["progress-bar"],style:{width:"".concat(O,"%")}}),T.createElement("div",{className:N["progress-bar-background"]})):null):null,T.createElement("div",{className:N["info-container"]},T.createElement("div",{className:N["title-container"]},null===E||isNaN(E)?null:"".concat(E,". "),"string"==typeof i&&i.length>0?i:a),T.createElement("div",{className:N["flex-row-container"]},s instanceof Date&&!isNaN(s.getTime())?T.createElement("div",{className:N["released-container"]},s.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric"})):c?T.createElement("div",{className:N["released-container"],title:"To be announced"},"TBA"):null,T.createElement("div",{className:N["upcoming-watched-container"]},l&&!I?T.createElement("div",{className:N["upcoming-container"]},T.createElement("div",{className:N["flag-label"]},"Upcoming")):null,I?T.createElement("div",{className:N["watched-container"]},T.createElement(u,{className:N["flag-icon"],name:"eye"}),T.createElement("div",{className:N["flag-label"]},"Watched")):null))),R)}}),[]),z=T.useMemo((function(){return function(){return T.createElement("div",{className:N["context-menu-content"],onPointerDown:G,onContextMenu:k,onClick:F,onKeyDown:V},T.createElement(A,{className:N["context-menu-option-container"],title:"Watch"},T.createElement("div",{className:N["context-menu-option-label"]},l("CTX_WATCH"))),T.createElement(A,{className:N["context-menu-option-container"],title:D?"Mark as non-watched":"Mark as watched",onClick:H},T.createElement("div",{className:N["context-menu-option-label"]},l(D?"CTX_MARK_NON_WATCHED":"CTX_MARK_WATCHED"))))}}),[D,H]);return T.useEffect((function(){B||M()}),[B]),T.createElement(O,n({className:t,id:a,title:E,thumbnail:s,episode:R,released:m,upcoming:L,watched:D,progress:p,scheduled:h,onClick:w},P,{onMouseUp:y,onLongPress:U,onContextMenu:b,open:v,onCloseRequest:M,renderLabel:Y,renderMenu:z}))};m.Placeholder=R,m.propTypes={className:s.string,id:s.string,title:s.string,thumbnail:s.string,episode:s.number,released:s.instanceOf(Date),upcoming:s.bool,watched:s.bool,progress:s.number,scheduled:s.bool,deepLinks:s.shape({metaDetailsStreams:s.string,player:s.string}),onMarkVideoAsWatched:s.func},e.exports=m},52367:(e,t,a)=>{var i=a(96540),o=a(5556),n=a(46942),r=a(17366),E=function(e){var t=e.className;return i.createElement("div",{className:n(t,r["video-placeholder-container"])},i.createElement("div",{className:r["info-container"]},i.createElement("div",{className:r["name-container"]}),i.createElement("div",{className:r["released-container"]})))};E.propTypes={className:o.string},e.exports=E},42515:(e,t,a)=>{var i=a(52367);e.exports=i},45598:(e,t,a)=>{var i=a(6581);e.exports=i},64908:e=>{e.exports=function(e){return function(t,a){return isNaN(e[t])&&isNaN(e[a])?t.localeCompare(a):isNaN(e[t])?e[a]===Number.NEGATIVE_INFINITY?-1:1:isNaN(e[a])?e[t]===Number.NEGATIVE_INFINITY?1:-1:e[a]-e[t]}}},96964:e=>{e.exports=function(e){return Array.from(e.children).reduce((function(t,a,i){return(function(e,t){var a=t.offsetTop,i=t.offsetTop+t.clientHeight,o=e.scrollTop,n=e.scrollTop+e.clientHeight;return a>=o&&i<=n||a{var i=a(90292),o=a(66373).default,n=a(32035),r=a(19911),E=a(40296).default,_=a(8422),T=a(52892),s=a(35336),S=a(95196),l=a(38245),I=a(10481),u=a(5961),A=a(66938),d=a(6842),O=a(42176),c=a(50472),R=a(77145).default,N=a(98397),m=N.HorizontalNavBar,L=N.VerticalNavBar,D=a(96844).default,p=a(52398),h=p.PlatformProvider,C=p.usePlatform,f=a(49356),P=a(94323),B=a(52224),g=a(27142),v=a(23596),M=a(32538),W=a(72154).default,y=a(65794),b=y.ToastProvider,U=y.useToast,G=a(19595),k=G.TooltipProvider,F=G.Tooltip,V=a(45598),H=a(64908),w=a(56911),Y=a(28116),z=Y.withCoreSuspender,K=Y.useCoreSuspender,j=a(96964),x=a(96859),Q=a(293),X=a(8023),$=a(67994),q=a(94951),J=a(74496),Z=a(38258),ee=a(47067),te=a(13181),ae=a(56019),ie=a(67512),oe=a(79030),ne=a(86967),re=a(28779),Ee=a(43722);e.exports={AddonDetailsModal:i,BottomSheet:o,Button:n,Toggle:r,Chips:E,ColorInput:_,ContinueWatchingItem:T,DelayedRenderer:s,Image:S,LibItem:l,MainNavBars:I,MetaItem:u,MetaPreview:A,MetaRow:d,ModalDialog:O,Multiselect:c,MultiselectMenu:R,HorizontalNavBar:m,HorizontalScroll:D,VerticalNavBar:L,PlatformProvider:h,usePlatform:C,PlayIconCircleCentered:f,Popup:P,SearchBar:B,StreamingServerWarning:g,SharePrompt:v,Slider:M,TextInput:W,ToastProvider:b,useToast:U,TooltipProvider:k,Tooltip:F,Video:V,comparatorWithPriorities:H,CONSTANTS:w,withCoreSuspender:z,useCoreSuspender:K,getVisibleChildrenRange:j,interfaceLanguages:x,languageNames:Q,routesRegexp:X,useAnimationFrame:$,useBinaryState:q,useFullscreen:J,useLiveRef:Z,useModelState:ee,useNotifications:te,useOnScrollToBottom:ae,useProfile:ie,useStreamingServer:oe,useTorrent:ne,useTranslate:re,EventModal:Ee}},8023:e=>{e.exports={intro:{regexp:/^\/intro$/,urlParamsNames:[]},board:{regexp:/^\/?$/,urlParamsNames:[]},discover:{regexp:/^\/discover(?:\/([^/]*)\/([^/]*)\/([^/]*))?$/,urlParamsNames:["transportUrl","type","catalogId"]},library:{regexp:/^\/library(?:\/([^/]*))?$/,urlParamsNames:["type"]},calendar:{regexp:/^\/calendar(?:\/([^/]*)\/([^/]*))?$/,urlParamsNames:["year","month"]},continuewatching:{regexp:/^\/continuewatching(?:\/([^/]*))?$/,urlParamsNames:["type"]},search:{regexp:/^\/search$/,urlParamsNames:[]},metadetails:{regexp:/^\/(?:metadetails|detail)\/([^/]*)\/([^/]*)(?:\/([^/]*))?$/,urlParamsNames:["type","id","videoId"]},addons:{regexp:/^\/addons(?:\/([^/]*)(?:\/([^/]*)\/([^/]*))?)?$/,urlParamsNames:["type","transportUrl","catalogId"]},settings:{regexp:/^\/settings$/,urlParamsNames:[]},player:{regexp:/^\/player\/([^/]*)(?:\/([^/]*)\/([^/]*)\/([^/]*)\/([^/]*)\/([^/]*))?$/,urlParamsNames:["stream","streamTransportUrl","metaTransportUrl","type","id","videoId"]}}},67994:(e,t,a)=>{var i=a(96540);e.exports=function(){var e=i.useRef(null),t=i.useCallback((function(){cancelAnimationFrame(e.current),e.current=null}),[]);return[i.useCallback((function(a){t(),e.current=requestAnimationFrame((function(){a(),e.current=null}))}),[]),t]}},94951:(e,t,a)=>{function i(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,o,n,r,E=[],_=!0,T=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;_=!1}else for(;!(_=(i=n.call(a)).done)&&(E.push(i.value),E.length!==t);_=!0);}catch(e){T=!0,o=e}finally{try{if(!_&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(T)throw o}}return E}})(e,t)||(function(e,t){if(e){if("string"==typeof e)return o(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,t):void 0}})(e,t)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a{function i(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,o,n,r,E=[],_=!0,T=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;_=!1}else for(;!(_=(i=n.call(a)).done)&&(E.push(i.value),E.length!==t);_=!0);}catch(e){T=!0,o=e}finally{try{if(!_&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(T)throw o}}return E}})(e,t)||(function(e,t){if(e){if("string"==typeof e)return o(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,t):void 0}})(e,t)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a{var i=a(96540);e.exports=function(e){var t=i.useRef();return t.current=e,t}},47067:(e,t,a)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}var o=["action"];function n(){"use strict";n=function(){return t};var e,t={},a=Object.prototype,o=a.hasOwnProperty,r=Object.defineProperty||function(e,t,a){e[t]=a.value},E="function"==typeof Symbol?Symbol:{},_=E.iterator||"@@iterator",T=E.asyncIterator||"@@asyncIterator",s=E.toStringTag||"@@toStringTag";function S(e,t,a){return Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{S({},"")}catch(e){S=function(e,t,a){return e[t]=a}}function l(e,t,a,i){var o=t&&t.prototype instanceof R?t:R,n=Object.create(o.prototype),E=new M(i||[]);return r(n,"_invoke",{value:P(e,a,E)}),n}function I(e,t,a){try{return{type:"normal",arg:e.call(t,a)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var u="suspendedStart",A="suspendedYield",d="executing",O="completed",c={};function R(){}function N(){}function m(){}var L={};S(L,_,(function(){return this}));var D=Object.getPrototypeOf,p=D&&D(D(W([])));p&&p!==a&&o.call(p,_)&&(L=p);var h=m.prototype=R.prototype=Object.create(L);function C(e){["next","throw","return"].forEach((function(t){S(e,t,(function(e){return this._invoke(t,e)}))}))}function f(e,t){function a(n,r,E,_){var T=I(e[n],e,r);if("throw"!==T.type){var s=T.arg,S=s.value;return S&&"object"==i(S)&&o.call(S,"__await")?t.resolve(S.__await).then((function(e){a("next",e,E,_)}),(function(e){a("throw",e,E,_)})):t.resolve(S).then((function(e){s.value=e,E(s)}),(function(e){return a("throw",e,E,_)}))}_(T.arg)}var n;r(this,"_invoke",{value:function(e,i){function o(){return new t((function(t,o){a(e,i,t,o)}))}return n=n?n.then(o,o):o()}})}function P(t,a,i){var o=u;return function(n,r){if(o===d)throw Error("Generator is already running");if(o===O){if("throw"===n)throw r;return{value:e,done:!0}}for(i.method=n,i.arg=r;;){var E=i.delegate;if(E){var _=B(E,i);if(_){if(_===c)continue;return _}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(o===u)throw o=O,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);o=d;var T=I(t,a,i);if("normal"===T.type){if(o=i.done?O:A,T.arg===c)continue;return{value:T.arg,done:i.done}}"throw"===T.type&&(o=O,i.method="throw",i.arg=T.arg)}}}function B(t,a){var i=a.method,o=t.iterator[i];if(o===e)return a.delegate=null,"throw"===i&&t.iterator.return&&(a.method="return",a.arg=e,B(t,a),"throw"===a.method)||"return"!==i&&(a.method="throw",a.arg=new TypeError("The iterator does not provide a '"+i+"' method")),c;var n=I(o,t.iterator,a.arg);if("throw"===n.type)return a.method="throw",a.arg=n.arg,a.delegate=null,c;var r=n.arg;return r?r.done?(a[t.resultName]=r.value,a.next=t.nextLoc,"return"!==a.method&&(a.method="next",a.arg=e),a.delegate=null,c):r:(a.method="throw",a.arg=new TypeError("iterator result is not an object"),a.delegate=null,c)}function g(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function v(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function M(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(g,this),this.reset(!0)}function W(t){if(t||""===t){var a=t[_];if(a)return a.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,r=function a(){for(;++n=0;--n){var r=this.tryEntries[n],E=r.completion;if("root"===r.tryLoc)return i("end");if(r.tryLoc<=this.prev){var _=o.call(r,"catchLoc"),T=o.call(r,"finallyLoc");if(_&&T){if(this.prev=0;--a){var i=this.tryEntries[a];if(i.tryLoc<=this.prev&&o.call(i,"finallyLoc")&&this.prev=0;--t){var a=this.tryEntries[t];if(a.finallyLoc===e)return this.complete(a.completion,a.afterLoc),v(a),c}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var a=this.tryEntries[t];if(a.tryLoc===e){var i=a.completion;if("throw"===i.type){var o=i.arg;v(a)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,a,i){return this.delegate={iterator:W(t),resultName:a,nextLoc:i},"next"===this.method&&(this.arg=e),c}},t}function r(e,t,a,i,o,n,r){try{var E=e[n](r),_=E.value}catch(e){return void a(e)}E.done?t(_):Promise.resolve(_).then(i,o)}function E(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,o,n,r,E=[],_=!0,T=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;_=!1}else for(;!(_=(i=n.call(a)).done)&&(E.push(i.value),E.length!==t);_=!0);}catch(e){T=!0,o=e}finally{try{if(!_&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(T)throw o}}return E}})(e,t)||(function(e,t){if(e){if("string"==typeof e)return _(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_(e,t):void 0}})(e,t)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function _(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a{var i=a(47067),o=function(e){return e.notifications};e.exports=function(){return i({model:"ctx",map:o})}},56019:(e,t,a)=>{var i=a(96540);e.exports=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=i.useRef(!1);return i.useCallback((function(i){i.target.scrollTop+i.target.clientHeight>=i.target.scrollHeight-t?a.current||(a.current=!0,"function"==typeof e&&e(i)):a.current=!1}),[e])}},6397:(e,t,a)=>{var i=a(96540);e.exports=function(){return i.useMemo((function(){return[window.navigator.standalone,window.matchMedia("(display-mode: standalone)").matches]}),[])}},67512:(e,t,a)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(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 n(e){for(var t=1;t{var i=a(47067);e.exports=function(){return i({model:"streaming_server"})}},86967:(e,t,a)=>{function i(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,o,n,r,E=[],_=!0,T=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;_=!1}else for(;!(_=(i=n.call(a)).done)&&(E.push(i.value),E.length!==t);_=!0);}catch(e){T=!0,o=e}finally{try{if(!_&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(T)throw o}}return E}})(e,t)||(function(e,t){if(e){if("string"==typeof e)return o(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,t):void 0}})(e,t)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a{var i=a(96540).useCallback,o=a(32389).useTranslation;e.exports=function(){var e=o().t,t=i((function(t){return e(t)}),[e]),a=i((function(t,a){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o="".concat(a).concat(t),n=null!=i?i:t.charAt(0).toUpperCase()+t.slice(1);return e(o,{defaultValue:n})}),[e]),n=i((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.addon,i=e.id,o=e.name,n=e.type,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(t&&i&&o){var E="".concat(t.manifest.id.split(".").join("_"),"_").concat(i),_=a(E,"CATALOG_",o);if(n&&r){var T=a(n,"TYPE_");return"".concat(_," - ").concat(T)}return _}return null}),[a]);return{string:t,stringWithPrefix:a,catalogTitle:n}}},30005:(e,t,a)=>{var i=["className","autoFocus","disabled","children"];var o=a(96540),n=a(40961),r=a(5556),E=a(46942),_=a(39461).Ay,T=a(69799).useModalsContainer,s=o.forwardRef((function(e,t){var a=e.className,r=e.autoFocus,s=e.disabled,S=e.children,l=(function(e,t){if(null==e)return{};var a,i,o=(function(e,t){if(null==e)return{};var a={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(t.includes(i))continue;a[i]=e[i]}return a})(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(i=0;i{var i=a(30005);e.exports=i},57887:(e,t,a)=>{var i=a(96540).createContext(null);i.displayName="ModalsContainerContext",e.exports=i},79071:(e,t,a)=>{function i(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,o,n,r,E=[],_=!0,T=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;_=!1}else for(;!(_=(i=n.call(a)).done)&&(E.push(i.value),E.length!==t);_=!0);}catch(e){T=!0,o=e}finally{try{if(!_&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(T)throw o}}return E}})(e,t)||(function(e,t){if(e){if("string"==typeof e)return o(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,t):void 0}})(e,t)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a{var i=a(79071),o=a(40555);e.exports={ModalsContainerProvider:i,useModalsContainer:o}},40555:(e,t,a)=>{var i=a(96540),o=a(57887);e.exports=function(){return i.useContext(o)}},49729:(e,t,a)=>{var i=a(96540),o=a(5556),n=a(69799).ModalsContainerProvider,r=function(e){var t=e.children;return i.createElement("div",{className:"route-container"},i.createElement(n,null,i.createElement("div",{className:"route-content"},t)))};r.propTypes={children:o.node},e.exports=r},18976:(e,t,a)=>{var i=a(49729);e.exports=i},98357:(e,t,a)=>{var i=a(96540).createContext(!0);i.displayName="RouteFocusedContext",e.exports=i},50096:(e,t,a)=>{var i=a(98357),o=a(33505);e.exports={RouteFocusedProvider:i.Provider,useRouteFocused:o}},33505:(e,t,a)=>{var i=a(96540),o=a(98357);e.exports=function(){return i.useContext(o)}},99113:(e,t,a)=>{var i=["className","onPathNotMatch","onRouteChange"];function o(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,o,n,r,E=[],_=!0,T=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;_=!1}else for(;!(_=(i=n.call(a)).done)&&(E.push(i.value),E.length!==t);_=!0);}catch(e){T=!0,o=e}finally{try{if(!_&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(T)throw o}}return E}})(e,t)||(function(e,t){if(e){if("string"==typeof e)return n(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?n(e,t):void 0}})(e,t)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function n(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a{var i=a(99113);e.exports=i},28321:e=>{function t(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!i){if(Array.isArray(e)||(i=(function(e,t){if(e){if("string"==typeof e)return a(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?a(e,t):void 0}})(e))||t&&e&&"number"==typeof e.length){i&&(e=i);var o=0,n=function(){};return{s:n,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,E=!0,_=!1;return{s:function(){i=i.call(e)},n:function(){var e=i.next();return E=e.done,e},e:function(e){_=!0,r=e},f:function(){try{E||null==i.return||i.return()}finally{if(_)throw r}}}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a{e.exports=function(e,t){var a=t.match(e.regexp);return e.urlParamsNames.reduce((function(e,t,i){return Array.isArray(a)&&"string"==typeof a[i+1]?e[t]=decodeURIComponent(a[i+1]):e[t]=null,e}),{path:t})}},16834:(e,t,a)=>{var i=a(50096).useRouteFocused,o=a(69799).useModalsContainer,n=a(4460),r=a(52698);e.exports={useRouteFocused:i,useModalsContainer:o,Modal:n,Router:r}},21350:(e,t,a)=>{var i=a(96540),o=a(5556),n=a(46942),r=a(32389).useTranslation,E=a(87865).default,_=a(28990),T=_.Button,s=_.Image,S=a(911),l=function(e){var t=e.className,a=e.id,o=e.name,_=e.version,l=e.logo,I=e.description,u=e.types,A=e.behaviorHints,d=e.installed,O=e.onInstall,c=e.onUninstall,R=e.onConfigure,N=e.onOpen,m=e.onShare,L=e.dataset,D=r().t,p=i.useCallback((function(e){e.stopPropagation(),"function"==typeof O&&O({type:"install",nativeEvent:e.nativeEvent,reactEvent:e,dataset:L})}),[O,L]),h=i.useCallback((function(e){e.stopPropagation(),"function"==typeof c&&c({type:"uninstall",nativeEvent:e.nativeEvent,reactEvent:e,dataset:L})}),[c,L]),C=i.useCallback((function(e){e.stopPropagation(),"function"==typeof N&&N({type:"open",nativeEvent:e.nativeEvent,reactEvent:e,dataset:L})}),[N,L]),f=i.useCallback((function(e){e.stopPropagation(),"function"==typeof R&&R({type:"configure",nativeEvent:e.nativeEvent,reactEvent:e,dataset:L})}),[R,L]),P=i.useCallback((function(e){e.stopPropagation(),"function"==typeof m&&m({type:"share",nativeEvent:e.nativeEvent,reactEvent:e,dataset:L})}),[m,L]),B=i.useCallback((function(e){"Enter"===e.key&&C(e)}),[C]),g=i.useCallback((function(){return i.createElement(E,{className:S.icon,name:"addons"})}),[]);return i.createElement(T,{className:n(t,S["addon-container"]),onKeyDown:B,onClick:C},i.createElement("div",{className:S["logo-container"]},i.createElement(s,{className:S.logo,src:l,alt:" ",renderFallback:g})),i.createElement("div",{className:S["info-container"]},i.createElement("div",{className:S["name-container"],title:"string"==typeof o&&o.length>0?o:a},"string"==typeof o&&o.length>0?o:a),"string"==typeof _&&_.length>0?i.createElement("div",{className:S["version-container"],title:"v.".concat(_)},"v.",_):null,Array.isArray(u)&&u.length>0?i.createElement("div",{className:S["types-container"]},1===u.length?u.join(""):u.slice(0,-1).join(", ")+" & "+u[u.length-1]):null,"string"==typeof I&&I.length>0?i.createElement("div",{className:S["description-container"],title:I},I):null),i.createElement("div",{className:S["buttons-container"]},i.createElement("div",{className:S["action-buttons-container"]},!A.configurationRequired&&A.configurable?i.createElement(T,{className:S["configure-button-container"],title:D("ADDON_CONFIGURE"),tabIndex:-1,onClick:f},i.createElement(E,{className:S.icon,name:"settings"})):null,i.createElement(T,{className:d?S["uninstall-button-container"]:S["install-button-container"],title:d?D("ADDON_UNINSTALL"):A.configurationRequired?D("ADDON_CONFIGURE"):D("ADDON_INSTALL"),tabIndex:-1,onClick:d?h:A.configurationRequired?f:p},i.createElement("div",{className:S.label},d?D("ADDON_UNINSTALL"):A.configurationRequired?D("ADDON_CONFIGURE"):D("ADDON_INSTALL")))),i.createElement(T,{className:S["share-button-container"],title:D("SHARE_ADDON"),tabIndex:-1,onClick:P},i.createElement(E,{className:S.icon,name:"share"}),i.createElement("div",{className:S.label},D("SHARE_ADDON")))))};l.propTypes={className:o.string,id:o.string,name:o.string,version:o.string,logo:o.string,description:o.string,types:o.arrayOf(o.string),behaviorHints:o.shape({adult:o.bool,configurable:o.bool,configurationRequired:o.bool,p2p:o.bool}),installed:o.bool,onToggle:o.func,onInstall:o.func,onUninstall:o.func,onConfigure:o.func,onOpen:o.func,onShare:o.func,dataset:o.object},e.exports=l},43616:(e,t,a)=>{var i=a(21350);e.exports=i},13714:(e,t,a)=>{function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var a=0,i=Array(t);a0?Z.manifest.name:Z.manifest.id),"string"==typeof Z.manifest.version&&Z.manifest.version.length>0?r.createElement("span",{className:g.version},"v. ",Z.manifest.version):null)),r.createElement(R,{className:g["share-prompt-container"],url:Z.transportUrl})):null,"string"==typeof y?r.createElement(l,{transportUrl:y,onCloseRequest:Ee}):null)};M.propTypes={urlParams:E.shape({path:E.string,transportUrl:E.string,catalogId:E.string,type:E.string}),queryParams:E.instanceOf(URLSearchParams)};e.exports=D(M,(function(){return r.createElement(d,{className:g["addons-container"],route:"addons"})}))},57437:(e,t,a)=>{var i=a(13714);e.exports=i},75316:(e,t,a)=>{var i=a(96540);e.exports=function(e,t){var a=i.useMemo((function(){return t.get("addon")}),[t]),o=i.useCallback((function(a){var i=new URLSearchParams(t);"string"==typeof a?i.set("addon",a):i.delete("addon"),window.location.replace("#".concat(e.path,"?").concat(i))}),[e,t]);return[a,o]}},53837:(e,t,a)=>{var i=a(96540),o=a(28990).useModelState;e.exports=function(e){var t=i.useMemo((function(){return"string"!=typeof e.transportUrl&&"string"!=typeof e.catalogId?{action:"Load",args:{model:"InstalledAddonsWithFilters",args:{request:{type:"string"==typeof e.type?e.type:null}}}}:{action:"Unload"}}),[e]);return o({model:"installed_addons",action:t})}},97543:(e,t,a)=>{var i=a(96540),o=a(28990).useModelState;e.exports=function(e){var t=i.useMemo((function(){return"string"==typeof e.type&&"string"==typeof e.transportUrl&&"string"==typeof e.catalogId?{action:"Load",args:{model:"CatalogWithFilters",args:{request:{base:e.transportUrl,path:{resource:"addon_catalog",type:e.type,id:e.catalogId,extra:[]}}}}}:{action:"Unload"}}),[e]);return o({model:"remote_addons",action:t,deps:["ctx"]})}},14235:(e,t,a)=>{var i=a(96540),o=a(28990).useTranslate;e.exports=function(e,t){var a=o(),n=i.useMemo((function(){return(function(e,t,a){var i={title:a.string("SELECT_CATALOG"),options:t.selectable.catalogs.concat(e.selectable.catalogs).map((function(e){var t=e.name;return{value:e.deepLinks.addons,label:a.stringWithPrefix(t,"ADDON_"),title:a.stringWithPrefix(t,"ADDON_")}})),selected:t.selectable.catalogs.concat(e.selectable.catalogs).filter((function(e){return e.selected})).map((function(e){return e.deepLinks.addons})),renderLabelText:null!==t.selected?function(){var e=t.selectable.catalogs.find((function(e){return e.id===t.selected.request.path.id}));return e?a.stringWithPrefix(e.name,"ADDON_"):t.selected.request.path.id}:null,onSelect:function(e){window.location=e.value}},o={title:a.string("SELECT_TYPE"),options:null!==e.selected?e.selectable.types.map((function(e){var t=e.type;return{value:e.deepLinks.addons,label:null!==t?a.stringWithPrefix(t,"TYPE_"):a.string("TYPE_ALL")}})):t.selectable.types.map((function(e){var t=e.type;return{value:e.deepLinks.addons,label:a.stringWithPrefix(t,"TYPE_")}})),selected:null!==e.selected?e.selectable.types.filter((function(e){return e.selected})).map((function(e){return e.deepLinks.addons})):t.selectable.types.filter((function(e){return e.selected})).map((function(e){return e.deepLinks.addons})),renderLabelText:function(){return null!==e.selected?null===e.selected.request.type?a.string("TYPE_ALL"):a.stringWithPrefix(e.selected.request.type,"TYPE_"):null!==t.selected?a.stringWithPrefix(t.selected.request.path.type,"TYPE_"):o.title},onSelect:function(e){window.location=e.value}};return[i,o]})(e,t,a)}),[e,t]);return n}},19582:(e,t,a)=>{function i(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,o,n,r,E=[],_=!0,T=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;_=!1}else for(;!(_=(i=n.call(a)).done)&&(E.push(i.value),E.length!==t);_=!0);}catch(e){T=!0,o=e}finally{try{if(!_&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(T)throw o}}return E}})(e,t)||(function(e,t){if(e){if("string"==typeof e)return o(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,t):void 0}})(e,t)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a0?1:0,h=n.useRef(),C=n.useCallback((function(){var e=c(h.current);if(null!==e){var t=Math.max(0,e.start-p-5),a=e.end-p+5;a0?n.createElement(S,{className:r(L["board-row"],L["continue-watching-row"],"animation-fade-in"),title:e("BOARD_CONTINUE_WATCHING"),catalog:a,itemComponent:l,notifications:D}):null,T.catalogs.map((function(e,t){var a;switch(null===(a=e.content)||void 0===a?void 0:a.type){case"Ready":return n.createElement(S,{key:t,className:r(L["board-row"],L["board-row-".concat(e.content.content[0].posterShape)],"animation-fade-in"),catalog:e,itemComponent:I});case"Err":return n.createElement(S,{key:t,className:r(L["board-row"],"animation-fade-in"),catalog:e,message:e.content.content});default:return n.createElement(S.Placeholder,{key:t,className:r(L["board-row"],L["board-row-poster"],"animation-fade-in"),catalog:e})}})))),null!==t.settings&&"Err"===t.settings.type?n.createElement(u,{className:L["board-warning-container"]}):null)}),(function(){return n.createElement("div",{className:L["board-container"]},n.createElement(s,{className:L["board-content-container"],route:"board"}))}))},92286:(e,t,a)=>{var i=a(19582);e.exports=i},7617:(e,t,a)=>{var i=a(96540),o=a(40851).useServices,n=a(28990).useModelState;e.exports=function(){var e=o().core,t=i.useMemo((function(){return{action:"Load",args:{model:"CatalogsWithExtra",args:{extra:[]}}}}),[]),a=i.useCallback((function(t){e.transport.dispatch({action:"CatalogsWithExtra",args:{action:"LoadRange",args:t}},"board")}),[]);return[n({model:"board",action:t}),a]}},68457:(e,t,a)=>{var i=a(28990).useModelState;e.exports=function(){return i({model:"continue_watching_preview"})}},52450:(e,t,a)=>{function i(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,o,n,r,E=[],_=!0,T=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;_=!1}else for(;!(_=(i=n.call(a)).done)&&(E.push(i.value),E.length!==t);_=!0);}catch(e){T=!0,o=e}finally{try{if(!_&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(T)throw o}}return E}})(e,t)||(function(e,t){if(e){if("string"==typeof e)return o(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,t):void 0}})(e,t)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a{var i=a(52450);e.exports=i},13365:(e,t,a)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(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 n(e){for(var t=1;t0?{action:"Load",args:{model:"CatalogWithFilters",args:{request:{base:e.transportUrl,path:{resource:"catalog",type:e.type,id:e.catalogId,extra:Array.from(t.entries())}}}}}:{action:"Unload"}}),[e,t]);return[s({model:"discover",action:o,map:S,deps:["ctx"]}),i]}},44299:(e,t,a)=>{function i(e){return(function(e){if(Array.isArray(e))return o(e)})(e)||(function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)})(e)||(function(e,t){if(e){if("string"==typeof e)return o(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,t):void 0}})(e)||(function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a{var i=["className","label","link","href","onToggle"];function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&"string"==typeof l&&l.length>0?n.createElement(T,{className:S.link,href:l,target:"_blank",tabIndex:-1,onClick:d},_):null))}));l.displayName="ConsentToggle",l.propTypes={className:r.string,checked:r.bool,label:r.string,link:r.string,href:r.string,onToggle:r.func,onClick:r.func},e.exports=l},3713:(e,t,a)=>{var i=a(30735);e.exports=i},33483:(e,t,a)=>{function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var i=a(33483);e.exports=i},6894:(e,t,a)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(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 n(e){for(var t=1;te.length)&&(t=e.length);for(var a=0,i=Array(t);a0&&b.current.scrollIntoView()}),[j.error]),T.useEffect((function(){_&&B.current.focus()}),[j.form,_]),T.useEffect((function(){var e=function(e){var t=e.event,a=e.args;switch(t){case"UserAuthenticated":Y(),_&&(window.location="#/");break;case"Error":"UserAuthenticated"===a.source.event&&Y()}};return i.transport.on("CoreEvent",e),function(){i.transport.off("CoreEvent",e)}}),[_]),T.createElement("div",{className:C["intro-container"]},T.createElement("div",{className:C["background-container"]}),T.createElement("div",{className:C["heading-container"]},T.createElement("div",{className:C["logo-container"]},T.createElement(N,{className:C.logo,src:a(25144),alt:" "})),T.createElement("div",{className:C["title-container"]},"Freedom to Stream"),T.createElement("div",{className:C["slogan-container"]},"All the Video Content You Enjoy in One Place")),T.createElement("div",{className:C["content-container"]},T.createElement("div",{className:C["form-container"]},T.createElement(L,{ref:B,className:C["credentials-text-input"],type:"email",placeholder:"Email",value:j.email,onChange:Z,onSubmit:ee}),T.createElement(L,{ref:g,className:C["credentials-text-input"],type:"password",placeholder:"Password",value:j.password,onChange:te,onSubmit:ae}),j.form===f?T.createElement(T.Fragment,null,T.createElement(L,{ref:v,className:C["credentials-text-input"],type:"password",placeholder:"Confirm Password",value:j.confirmPassword,onChange:ie,onSubmit:oe}),T.createElement(D,{ref:M,className:C["consent-toggle"],label:"I have read and agree with the Stremio",link:"Terms and conditions",href:"https://www.stremio.com/tos",checked:j.termsAccepted,onToggle:ne}),T.createElement(D,{ref:W,className:C["consent-toggle"],label:"I have read and agree with the Stremio",link:"Privacy Policy",href:"https://www.stremio.com/privacy",checked:j.privacyPolicyAccepted,onToggle:re}),T.createElement(D,{ref:y,className:C["consent-toggle"],label:"I agree to receive marketing communications from Stremio",checked:j.marketingAccepted,onToggle:Ee})):T.createElement("div",{className:C["forgot-password-link-container"]},T.createElement(R,{className:C["forgot-password-link"],onClick:k},"Forgot password?")),j.error.length>0?T.createElement("div",{ref:b,className:C["error-message"]},j.error):null,T.createElement(R,{className:l(C["form-button"],C["submit-button"]),onClick:j.form===f?J:$},T.createElement("div",{className:C.label},j.form===f?"Sign up":"Log in"))),T.createElement("div",{className:C["options-container"]},T.createElement(R,{className:l(C["form-button"],C["facebook-button"]),onClick:Q},T.createElement(I,{className:C.icon,name:"facebook"}),T.createElement("div",{className:C.label},"Continue with Facebook")),j.form===f?T.createElement(R,{className:l(C["form-button"],C["login-form-button"]),onClick:_e},T.createElement("div",{className:C.label},"LOG IN")):null,j.form===P?T.createElement(R,{className:l(C["form-button"],C["signup-form-button"]),onClick:_e},T.createElement("div",{className:C.label},"SIGN UP WITH EMAIL")):null,j.form===f?T.createElement(R,{className:l(C["form-button"],C["guest-login-button"]),onClick:q},T.createElement("div",{className:C.label},"GUEST LOGIN")):null)),G?T.createElement(p,{email:j.email,onCloseRequest:F}):null,H?T.createElement(A,{className:C["loading-modal-container"]},T.createElement("div",{className:C["loader-container"]},T.createElement(I,{className:C.icon,name:"person"}),T.createElement("div",{className:C.label},"Authenticating..."),T.createElement(R,{className:C.button,onClick:X},o("BUTTON_CANCEL")))):null)};B.propTypes={queryParams:S.instanceOf(URLSearchParams)},e.exports=B},87883:(e,t,a)=>{function i(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,o,n,r,E=[],_=!0,T=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;_=!1}else for(;!(_=(i=n.call(a)).done)&&(E.push(i.value),E.length!==t);_=!0);}catch(e){T=!0,o=e}finally{try{if(!_&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(T)throw o}}return E}})(e,t)||(function(e,t){if(e){if("string"==typeof e)return o(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,t):void 0}})(e,t)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a0&&A.current.validity.valid?r.openExternal("https://www.strem.io/reset-password/"+A.current.value,"_blank"):u("Invalid email")}),[]),O=n.useMemo((function(){return[{className:l["cancel-button"],label:"Cancel",props:{onClick:a}},{label:"Send",props:{onClick:d}}]}),[a]),c=n.useCallback((function(){u("")}),[]);return n.useEffect((function(){o&&A.current.focus()}),[o]),n.createElement(T,{className:l["password-reset-modal-container"],title:"Password reset",buttons:O,onCloseRequest:a},n.createElement(S,{ref:A,className:l["credentials-text-input"],type:"email",placeholder:"Email",defaultValue:"string"==typeof t?t:"",onChange:c,onSubmit:d}),I.length>0?n.createElement("div",{className:l["error-message"]},I):null)};I.propTypes={email:r.string,onCloseRequest:r.func},e.exports=I},43420:(e,t,a)=>{var i=a(87883);e.exports=i},54372:(e,t,a)=>{var i=a(6894);e.exports=i},9682:(e,t,a)=>{function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var a=0,i=Array(t);a{var i=a(9682);e.exports=i},43419:(e,t,a)=>{var i=a(96540),o=a(40851).useServices,n=a(28990).useModelState;e.exports=function(e,t,a){var r=o().core,E=i.useCallback((function(){r.transport.dispatch({action:"LibraryWithFilters",args:{action:"LoadNextPage"}},"library")}),[]),_=i.useMemo((function(){return{action:"Load",args:{model:"LibraryWithFilters",args:{request:{type:"string"==typeof t.type?t.type:null,sort:a.has("sort")?a.get("sort"):void 0}}}}}),[t,a]);return[n({model:e,action:_}),E]}},21227:(e,t,a)=>{var i=a(96540),o=a(28990).useTranslate;e.exports=function(e){var t=o(),a=i.useMemo((function(){return(function(e,t){return[{title:t.string("SELECT_TYPE"),options:e.selectable.types.map((function(e){var a=e.type;return{value:e.deepLinks.library,label:null===a?t.string("TYPE_ALL"):t.stringWithPrefix(a,"TYPE_")}})),selected:e.selectable.types.filter((function(e){return e.selected})).map((function(e){return e.deepLinks.library})),onSelect:function(e){window.location=e.value}},{options:e.selectable.sorts.map((function(e){var a=e.sort;return{value:e.deepLinks.library,label:t.stringWithPrefix(a.toUpperCase(),"SORT_")}})),selected:e.selectable.sorts.filter((function(e){return e.selected})).map((function(e){return e.deepLinks.library})),onSelect:function(e){window.location=e}},e.selectable.nextPage]})(e,t)}),[e]);return a}},91254:(e,t,a)=>{function i(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,o,n,r,E=[],_=!0,T=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;_=!1}else for(;!(_=(i=n.call(a)).done)&&(E.push(i.value),E.length!==t);_=!0);}catch(e){T=!0,o=e}finally{try{if(!_&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(T)throw o}}return E}})(e,t)||(function(e,t){if(e){if("string"==typeof e)return o(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,t):void 0}})(e,t)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a0?n.createElement(s,{className:L["vertical-nav-bar"],tabs:C,selected:null!==f?f.url:null}):null,null===g?n.createElement(A,{delay:500},n.createElement("div",{className:L["meta-message-container"]},n.createElement(u,{className:L.image,src:a(32706),alt:" "}),n.createElement("div",{className:L["message-label"]},"No meta was selected!"))):null===T.metaItem?n.createElement("div",{className:L["meta-message-container"]},n.createElement(u,{className:L.image,src:a(32706),alt:" "}),n.createElement("div",{className:L["message-label"]},"No addons ware requested for this meta!")):"Err"===T.metaItem.content.type?n.createElement("div",{className:L["meta-message-container"]},n.createElement(u,{className:L.image,src:a(32706),alt:" "}),n.createElement("div",{className:L["message-label"]},"No metadata was found!")):"Loading"===T.metaItem.content.type?n.createElement(l.Placeholder,{className:L["meta-preview"]}):n.createElement(n.Fragment,null,"string"==typeof T.metaItem.content.content.background&&T.metaItem.content.content.background.length>0?n.createElement("div",{className:L["background-image-layer"]},n.createElement(u,{className:L["background-image"],src:T.metaItem.content.content.background,renderFallback:G,alt:" "})):null,n.createElement(l,{className:E(L["meta-preview"],"animation-fade-in"),name:T.metaItem.content.content.name,logo:T.metaItem.content.content.logo,runtime:T.metaItem.content.content.runtime,releaseInfo:T.metaItem.content.content.releaseInfo,released:T.metaItem.content.content.released,description:null!==M&&"string"==typeof M.overview&&M.overview.length>0?M.overview:T.metaItem.content.content.description,links:T.metaItem.content.content.links,trailerStreams:T.metaItem.content.content.trailerStreams,inLibrary:T.metaItem.content.content.inLibrary,toggleInLibrary:T.metaItem.content.content.inLibrary?y:W})),n.createElement("div",{className:L.spacing}),null!==v?n.createElement(O,{className:L["streams-list"],streams:T.streams,video:M}):null!==g?n.createElement(c,{className:L["videos-list"],metaItem:T.metaItem,libraryItem:T.libraryItem,season:D,seasonOnSelect:U,toggleNotifications:b}):null),null!==f?n.createElement(I,{className:L["meta-extension-modal-container"],title:f.name,onCloseRequest:P},n.createElement("iframe",{className:L["meta-extension-modal-iframe"],sandbox:"allow-forms allow-scripts allow-same-origin",src:f.url})):null)};D.propTypes={urlParams:r.shape({type:r.string,id:r.string,videoId:r.string}),queryParams:r.instanceOf(URLSearchParams)};e.exports=d(D,(function(){return n.createElement("div",{className:L["metadetails-container"]},n.createElement(S,{className:L["nav-bar"],backButton:!0,fullscreenButton:!0,navMenu:!0}))}))},49488:(e,t,a)=>{var i=["className","videoId","videoReleased","addonName","name","description","thumbnail","progress","deepLinks"],o=["className","children"];function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var a=0,i=Array(t);a0?T.createElement("div",{className:h["thumbnail-container"],title:u||s},T.createElement(d,{className:h.thumbnail,src:C,alt:" ",renderFallback:Z})):T.createElement("div",{className:h["addon-name-container"],title:u||s},T.createElement("div",{className:h["addon-name"]},u||s)),null!==f&&!isNaN(f)&&f>0?T.createElement("div",{className:h["progress-bar-container"]},T.createElement("div",{className:h["progress-bar"],style:{width:"".concat(f,"%")}}),T.createElement("div",{className:h["progress-bar-background"]})):null),T.createElement("div",{className:h["description-container"],title:p},p),T.createElement(l,{className:h.icon,name:"play"}),a)}}),[C,f,s,u,p,j,Q,x,q]),te=T.useMemo((function(){return function(){return T.createElement("div",{className:h["context-menu-content"],onPointerDown:w,onContextMenu:Y,onClick:z,onKeyDown:K},T.createElement(A,{className:h["context-menu-option-container"],title:I("CTX_PLAY")},T.createElement("div",{className:h["context-menu-option-label"]},I("CTX_PLAY"))),X&&T.createElement(A,{className:h["context-menu-option-container"],title:I("CTX_COPY_STREAM_LINK"),onClick:J},T.createElement("div",{className:h["context-menu-option-label"]},I("CTX_COPY_STREAM_LINK"))))}}),[J,q]);return T.useEffect((function(){y||G()}),[y]),T.createElement(N,{className:t,onMouseUp:F,onLongPress:H,onContextMenu:V,open:U,onCloseRequest:G,renderLabel:ee,renderMenu:te})};C.Placeholder=p,C.propTypes={className:s.string,videoId:s.string,videoReleased:s.instanceOf(Date),addonName:s.string,name:s.string,description:s.string,thumbnail:s.string,progress:s.number,deepLinks:s.shape({player:s.string,externalPlayer:s.shape({download:s.string,streaming:s.string,playlist:s.string,fileName:s.string,web:s.string,openPlayer:s.shape({ios:s.string,android:s.string,windows:s.string,macos:s.string,linux:s.string})})}),onClick:s.func},e.exports=C},76341:(e,t,a)=>{var i=a(96540),o=a(5556),n=a(46942),r=a(49356),E=a(13823),_=function(e){var t=e.className;return i.createElement("div",{className:n(t,E["stream-placeholder-container"])},i.createElement("div",{className:E["addon-container"]},i.createElement("div",{className:E["addon-name"]})),i.createElement("div",{className:E["info-container"]},i.createElement("div",{className:E["description-container"]}),i.createElement("div",{className:E["description-container"]})),i.createElement(r,{className:E["play-icon"]}))};_.propTypes={className:o.string},e.exports=_},35976:(e,t,a)=>{var i=a(76341);e.exports=i},62314:(e,t,a)=>{var i=a(49488);e.exports=i},59180:(e,t,a)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}var o=["className","video"];function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var a=0,i=Array(t);a1?I.createElement(m,n({},v,{className:p["select-input-container"]})):null),0===E.streams.length?I.createElement("div",{className:p["message-container"]},I.createElement(N,{className:p.image,src:a(32706),alt:" "}),I.createElement("div",{className:p.label},"No addons were requested for streams!")):E.streams.every((function(e){return"Err"===e.content.type}))?I.createElement("div",{className:p["message-container"]},I.createElement(N,{className:p.image,src:a(32706),alt:" "}),I.createElement("div",{className:p.label},T("NO_STREAM"))):0===g.length?I.createElement("div",{className:p["streams-container"]},I.createElement(D.Placeholder,null),I.createElement(D.Placeholder,null)):I.createElement(I.Fragment,null,P>0?I.createElement("div",{className:p["addons-loading-container"]},I.createElement("div",{className:p["addons-loading"]},P," ",T("MOBILE_ADDONS_LOADING")),I.createElement("span",{className:p["addons-loading-bar"]})):null,I.createElement("div",{className:p["streams-container"]},g.map((function(e,t){return I.createElement(D,{key:t,videoId:null==i?void 0:i.id,videoReleased:null==i?void 0:i.released,addonName:e.addonName,name:e.name,description:e.description,thumbnail:e.thumbnail,progress:e.progress,deepLinks:e.deepLinks,onClick:e.onClick})})))),I.createElement(R,{className:p["install-button-container"],title:T("ADDON_CATALOGUE_MORE"),href:"#/addons"},I.createElement(O,{className:p.icon,name:"addons"}),I.createElement("div",{className:p.label},T("ADDON_CATALOGUE_MORE"))))};C.propTypes={className:u.string,streams:u.arrayOf(u.object).isRequired,video:u.object},e.exports=C},92869:(e,t,a)=>{var i=a(59180);e.exports=i},76383:(e,t,a)=>{function i(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,o,n,r,E=[],_=!0,T=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;_=!1}else for(;!(_=(i=n.call(a)).done)&&(E.push(i.value),E.length!==t);_=!0);}catch(e){T=!0,o=e}finally{try{if(!_&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(T)throw o}}return E}})(e,t)||(function(e,t){if(e){if("string"==typeof e)return o(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,t):void 0}})(e,t)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a0?"".concat(_("SEASON")," ").concat(e):_("SPECIAL")}}))}),[a]),u=n.useMemo((function(){return{label:String(o),value:String(o)}}),[o]),A=n.useCallback((function(e){if("function"==typeof r){var t=a.indexOf(o),i="next"===e.currentTarget.dataset.action?t+1=0?t-1:0,n=a[i];r({type:"select",value:n,reactEvent:e,nativeEvent:e.nativeEvent})}}),[o,a,r]),d=n.useCallback((function(e){"function"==typeof r&&r({type:"select",value:e,reactEvent:event.reactEvent,nativeEvent:event.nativeEvent})}),[r]),O=i(n.useMemo((function(){var e=a.indexOf(o);return[0===e,e===a.length-1]}),[o,a]),2),c=O[0],R=O[1];return n.createElement("div",{className:E(t,l["seasons-bar-container"])},n.createElement(s,{className:E(l["prev-season-button"],{disabled:c}),title:"Previous season","data-action":"prev",onClick:A},n.createElement(T,{className:l.icon,name:"chevron-back"}),n.createElement("div",{className:l.label},"Prev")),n.createElement(I,{className:l["seasons-popup-label-container"],options:S,title:o>0?"".concat(_("SEASON")," ").concat(o):_("SPECIAL"),selectedOption:u,onSelect:d}),n.createElement(s,{className:E(l["next-season-button"],{disabled:R}),title:"Next season","data-action":"next",onClick:A},n.createElement("div",{className:l.label},"Next"),n.createElement(T,{className:l.icon,name:"chevron-forward"})))};u.Placeholder=S,u.propTypes={className:r.string,seasons:r.arrayOf(r.number).isRequired,season:r.number.isRequired,onSelect:r.func},e.exports=u},48269:(e,t,a)=>{var i=a(96540),o=a(5556),n=a(46942),r=a(87865).default,E=a(31218),_=function(e){var t=e.className;return i.createElement("div",{className:n(t,E["seasons-bar-placeholder-container"])},i.createElement("div",{className:E["prev-season-button"]},i.createElement(r,{className:E.icon,name:"chevron-back"}),i.createElement("div",{className:E.label},"Prev")),i.createElement("div",{className:E["seasons-popup-label-container"]},i.createElement("div",{className:E["seasons-popup-label"]},"Season 1"),i.createElement(r,{className:E["seasons-popup-icon"],name:"caret-down"})),i.createElement("div",{className:E["next-season-button"]},i.createElement("div",{className:E.label},"Next"),i.createElement(r,{className:E.icon,name:"chevron-forward"})))};_.propTypes={className:o.string},e.exports=_},72957:(e,t,a)=>{var i=a(48269);e.exports=i},57082:(e,t,a)=>{var i=a(76383);e.exports=i},95058:(e,t,a)=>{function i(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,o,n,r,E=[],_=!0,T=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;_=!1}else for(;!(_=(i=n.call(a)).done)&&(E.push(i.value),E.length!==t);_=!0);}catch(e){T=!0,o=e}finally{try{if(!_&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(T)throw o}}return E}})(e,t)||(function(e,t){if(e){if("string"==typeof e)return o(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,t):void 0}})(e,t)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a0?e[e.length-1]:L.length>0?L[L.length-1]:null}),[L,s]),p=n.useMemo((function(){return m.filter((function(e){return null===D||e.season===D})).sort((function(e,t){return e.episode-t.episode}))}),[m,D]),h=i(n.useState(""),2),C=h[0],f=h[1],P=n.useCallback((function(e){f(e.currentTarget.value)}),[]),B=function(e,t){R.transport.dispatch({action:"MetaDetails",args:{action:"MarkVideoAsWatched",args:[e,!t]}})};return n.createElement("div",{className:E(t,d["videos-list-container"])},o&&"Loading"!==o.content.type?"Err"===o.content.type||0===p.length?n.createElement("div",{className:d["message-container"]},n.createElement(S,{className:d.image,src:a(32706),alt:" "}),n.createElement("div",{className:d.label},"No videos found for this meta!")):n.createElement(n.Fragment,null,N&&r?n.createElement(I,{className:d["notifications-toggle"],checked:!r.state.noNotif,onClick:c},_("DETAIL_RECEIVE_NOTIF_SERIES")):null,L.length>0?n.createElement(A,{className:d["seasons-bar"],season:D,seasons:L,onSelect:O}):null,n.createElement(l,{className:d["search-bar"],title:_("SEARCH_VIDEOS"),value:C,onChange:P}),n.createElement("div",{className:d["videos-container"]},p.filter((function(e){return 0===C.length||"string"==typeof e.title&&e.title.toLowerCase().includes(C.toLowerCase())||!isNaN(e.released.getTime())&&e.released.toLocaleString(void 0,{year:"2-digit",month:"short",day:"numeric"}).toLowerCase().includes(C.toLowerCase())})).map((function(e,t){return n.createElement(u,{key:t,id:e.id,title:e.title,thumbnail:e.thumbnail,episode:e.episode,released:e.released,upcoming:e.upcoming,watched:e.watched,progress:e.progress,deepLinks:e.deepLinks,scheduled:e.scheduled,onMarkVideoAsWatched:B})})))):n.createElement(n.Fragment,null,n.createElement(A.Placeholder,{className:d["seasons-bar"]}),n.createElement(l.Placeholder,{className:d["search-bar"],title:_("SEARCH_VIDEOS")}),n.createElement("div",{className:d["videos-scroll-container"]},n.createElement(u.Placeholder,null),n.createElement(u.Placeholder,null),n.createElement(u.Placeholder,null),n.createElement(u.Placeholder,null),n.createElement(u.Placeholder,null))))};O.propTypes={className:r.string,metaItem:r.object,libraryItem:r.object,season:r.number,seasonOnSelect:r.func,toggleNotifications:r.func},e.exports=O},10448:(e,t,a)=>{var i=a(95058);e.exports=i},17779:(e,t,a)=>{var i=a(91254);e.exports=i},96163:(e,t,a)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(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 n(e){for(var t=1;t{function i(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,o,n,r,E=[],_=!0,T=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;_=!1}else for(;!(_=(i=n.call(a)).done)&&(E.push(i.value),E.length!==t);_=!0);}catch(e){T=!0,o=e}finally{try{if(!_&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(T)throw o}}return E}})(e,t)||(function(e,t){if(e){if("string"==typeof e)return o(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,t):void 0}})(e,t)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a{var i=a(96540);e.exports=function(e,t){var a=i.useMemo((function(){return t.has("season")&&!isNaN(t.get("season"))?parseInt(t.get("season"),10):null}),[t]),o=i.useCallback((function(a){var i=new URLSearchParams(t);i.set("season",a),window.location.replace("#".concat(e.path,"?").concat(i))}),[e,t]);return[a,o]}},18986:(e,t,a)=>{var i=a(96540),o=a(28990),n=o.Image,r=o.HorizontalNavBar,E=a(25664);e.exports=function(){return i.createElement("div",{className:E["not-found-container"]},i.createElement(r,{className:E["nav-bar"],title:"Page not found",backButton:!0,fullscreenButton:!0,navMenu:!0}),i.createElement("div",{className:E["not-found-content"]},i.createElement(n,{className:E["not-found-image"],src:a(32706),alt:" "}),i.createElement("div",{className:E["not-found-label"]},"Page not found!")))}},47873:(e,t,a)=>{var i=a(18986);e.exports=i},21944:(e,t,a)=>{var i=a(96540),o=a(5556),n=a(46942),r=a(28990).Image,E=a(74756),_=function(e){var t=e.className,o=e.logo;return i.createElement("div",{className:n(t,E["buffering-loader-container"])},i.createElement(r,{className:E["buffering-loader"],src:o,alt:" ",fallbackSrc:a(9387)}))};_.propTypes={className:o.string,logo:o.string},e.exports=_},41765:(e,t,a)=>{var i=a(21944);e.exports=i},90626:(e,t,a)=>{var i=["className","paused","time","duration","buffered","volume","muted","playbackSpeed","subtitlesTracks","audioTracks","metaItem","nextVideo","stream","statistics","onPlayRequested","onPauseRequested","onNextVideoRequested","onMuteRequested","onUnmuteRequested","onVolumeChangeRequested","onSeekRequested","onToggleSubtitlesMenu","onToggleInfoMenu","onToggleSpeedMenu","onToggleVideosMenu","onToggleOptionsMenu","onToggleStatisticsMenu"];function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var a=0,i=Array(t);a0?E.createElement(S,{className:A["control-bar-button"],tabIndex:-1,onMouseDown:Z,onClick:F},E.createElement(s,{className:A.icon,name:"episodes"})):null,E.createElement(S,{className:A["control-bar-button"],tabIndex:-1,onMouseDown:ee,onClick:V},E.createElement(s,{className:A.icon,name:"more-horizontal"})))))};c.propTypes={className:_.string,paused:_.bool,time:_.number,duration:_.number,buffered:_.number,volume:_.number,muted:_.bool,playbackSpeed:_.number,subtitlesTracks:_.array,audioTracks:_.array,metaItem:_.object,nextVideo:_.object,stream:_.object,statistics:_.object,onPlayRequested:_.func,onPauseRequested:_.func,onNextVideoRequested:_.func,onMuteRequested:_.func,onUnmuteRequested:_.func,onVolumeChangeRequested:_.func,onSeekRequested:_.func,onToggleSubtitlesMenu:_.func,onToggleInfoMenu:_.func,onToggleSpeedMenu:_.func,onToggleVideosMenu:_.func,onToggleOptionsMenu:_.func,onToggleStatisticsMenu:_.func},e.exports=c},83185:(e,t,a)=>{function i(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,o,n,r,E=[],_=!0,T=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;_=!1}else for(;!(_=(i=n.call(a)).done)&&(E.push(i.value),E.length!==t);_=!0);}catch(e){T=!0,o=e}finally{try{if(!_&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(T)throw o}}return E}})(e,t)||(function(e,t){if(e){if("string"==typeof e)return o(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,t):void 0}})(e,t)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a{var t=function(e){return("0"+e).slice(-1*Math.max(e.toString().length,2))};e.exports=function(e){var a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(null===e||isNaN(e))return"--:--:--";var i=Math.floor(e/36e5),o=Math.floor(e/6e4%60),n=Math.floor(e/1e3%60);return"".concat(t(i),":").concat(t(o),":").concat(t(n)).concat(a)}},9440:(e,t,a)=>{var i=a(83185);e.exports=i},8877:(e,t,a)=>{function i(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,o,n,r,E=[],_=!0,T=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;_=!1}else for(;!(_=(i=n.call(a)).done)&&(E.push(i.value),E.length!==t);_=!0);}catch(e){T=!0,o=e}finally{try{if(!_&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(T)throw o}}return E}})(e,t)||(function(e,t){if(e){if("string"==typeof e)return o(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,t):void 0}})(e,t)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a{var i=a(8877);e.exports=i},76546:(e,t,a)=>{var i=a(90626);e.exports=i},82068:(e,t,a)=>{function i(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,o,n,r,E=[],_=!0,T=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;_=!1}else for(;!(_=(i=n.call(a)).done)&&(E.push(i.value),E.length!==t);_=!0);}catch(e){T=!0,o=e}finally{try{if(!_&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(T)throw o}}return E}})(e,t)||(function(e,t){if(e){if("string"==typeof e)return o(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,t):void 0}})(e,t)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a{var i=a(82068);e.exports=i},60536:(e,t,a)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}var o=["className"];function n(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 r(e){for(var t=1;t{var i=a(60536);e.exports=i},56874:(e,t,a)=>{function i(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,o,n,r,E=[],_=!0,T=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;_=!1}else for(;!(_=(i=n.call(a)).done)&&(E.push(i.value),E.length!==t);_=!0);}catch(e){T=!0,o=e}finally{try{if(!_&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(T)throw o}}return E}})(e,t)||(function(e,t){if(e){if("string"==typeof e)return o(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,t):void 0}})(e,t)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a{var i=a(56874);e.exports=i},20574:(e,t,a)=>{var i=a(96540),o=a(5556),n=a(46942),r=a(87865).default,E=a(28990).Button,_=a(11460),T=function(e){var t=e.icon,a=e.label,o=e.deviceId,T=e.disabled,s=e.onClick,S=i.useCallback((function(){"function"==typeof s&&s(o)}),[s,o]);return i.createElement(E,{className:n(_["option-container"],{disabled:T}),disabled:T,onClick:S},i.createElement(r,{className:_.icon,name:t}),i.createElement("div",{className:_.label},a))};T.propTypes={icon:o.string,label:o.string,deviceId:o.string,disabled:o.bool,onClick:o.func},e.exports=T},44687:(e,t,a)=>{var i=a(20574);e.exports=i},81420:(e,t,a)=>{function i(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,o,n,r,E=[],_=!0,T=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;_=!1}else for(;!(_=(i=n.call(a)).done)&&(E.push(i.value),E.length!==t);_=!0);}catch(e){T=!0,o=e}finally{try{if(!_&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(T)throw o}}return E}})(e,t)||(function(e,t){if(e){if("string"==typeof e)return o(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,t):void 0}})(e,t)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a{var i=a(81420);e.exports=i},92770:(e,t,a)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var a=0,i=Array(t);a0||Array.isArray(ie.state.extraSubtitlesTracks)&&ie.state.extraSubtitlesTracks.length>0||Array.isArray(ie.state.audioTracks)&&ie.state.audioTracks.length>0)&&pe();break;case"KeyI":je(),null!==K.metaItem&&"Ready"===K.metaItem.type&&Pe();break;case"KeyR":je(),null!==ie.state.playbackSpeed&&Me();break;case"KeyV":var i;je(),null!==K.metaItem&&"Ready"===K.metaItem.type&&(null===(i=K.metaItem)||void 0===i||null===(i=i.content)||void 0===i||null===(i=i.videos)||void 0===i?void 0:i.length)>0&&Ue();break;case"KeyD":je(),null!==te.statistics&&"Err"!==te.statistics.type&&K.selected&&"string"==typeof K.selected.stream.infoHash&&"number"==typeof K.selected.stream.fileIdx&&Ve();break;case"Escape":je()}},t=function(e){"ArrowRight"!==e.code&&"ArrowLeft"!==e.code||_e(!1)},a=function(e){e.deltaY>0?Ke||null===ie.state.volume||St(ie.state.volume-5):Ke||null===ie.state.volume||St(ie.state.volume+5)};return oe&&(window.addEventListener("keydown",e),window.addEventListener("keyup",t),window.addEventListener("wheel",a)),function(){window.removeEventListener("keydown",e),window.removeEventListener("keyup",t),window.removeEventListener("wheel",a)}}),[K.metaItem,K.selected,te.statistics,Z.seekTimeDuration,Z.seekShortTimeDuration,oe,Ke,we,ie.state.paused,ie.state.time,ie.state.volume,ie.state.audioTracks,ie.state.subtitlesTracks,ie.state.extraSubtitlesTracks,ie.state.playbackSpeed,pe,Pe,Ue,Ve]),s.useEffect((function(){return ie.events.on("error",at),ie.events.on("ended",tt),ie.events.on("subtitlesTrackLoaded",it),ie.events.on("extraSubtitlesTrackLoaded",ot),ie.events.on("implementationChanged",et),function(){ie.events.off("error",at),ie.events.off("ended",tt),ie.events.off("subtitlesTrackLoaded",it),ie.events.off("extraSubtitlesTrackLoaded",ot),ie.events.off("implementationChanged",et)}}),[]),s.useLayoutEffect((function(){return function(){Ae.cancel(),rt.cancel(),_t.cancel()}}),[]),s.createElement("div",{className:l(V["player-container"],E({},V.overlayHidden,xe)),onMouseDown:pt,onMouseMove:ht,onMouseOver:ht,onMouseLeave:Ct},s.createElement(H,{ref:ie.containerElement,className:V.layer,onClick:Lt,onDoubleClick:Dt}),ie.state.loaded?null:s.createElement("div",{className:l(V.layer,V["background-layer"])},s.createElement("img",{className:V.image,src:null==K||null===(t=K.metaItem)||void 0===t||null===(t=t.content)||void 0===t?void 0:t.background})),!ie.state.buffering&&ie.state.loaded||Je?null:s.createElement(h,{className:l(V.layer,V["buffering-layer"]),logo:null==K||null===(a=K.metaItem)||void 0===a||null===(a=a.content)||void 0===a?void 0:a.logo}),null!==Je?s.createElement(f,o({className:l(V.layer,V["error-layer"]),stream:ie.state.stream},Je)):null,Ke?s.createElement("div",{className:V.layer}):null,null!==ie.state.volume&&xe?s.createElement(C,{muted:ie.state.muted,volume:ie.state.volume}):null,s.createElement(R,{className:l(V.layer,V["nav-bar-layer"]),title:null!==K.title?K.title:"",backButton:!0,fullscreenButton:!0,onMouseMove:ft,onMouseOver:ft}),s.createElement(P,{className:l(V.layer,V["control-bar-layer"]),paused:ie.state.paused,time:ie.state.time,duration:ie.state.duration,buffered:ie.state.buffered,volume:ie.state.volume,muted:ie.state.muted,playbackSpeed:ie.state.playbackSpeed,subtitlesTracks:ie.state.subtitlesTracks.concat(ie.state.extraSubtitlesTracks),audioTracks:ie.state.audioTracks,metaItem:K.metaItem,nextVideo:K.nextVideo,stream:null!==K.selected?K.selected.stream:null,statistics:ae,onPlayRequested:nt,onPauseRequested:Et,onNextVideoRequested:mt,onMuteRequested:Tt,onUnmuteRequested:st,onVolumeChangeRequested:St,onSeekRequested:lt,onToggleOptionsMenu:Ne,onToggleSubtitlesMenu:pe,onToggleInfoMenu:Pe,onToggleSpeedMenu:Me,onToggleVideosMenu:Ue,onToggleStatisticsMenu:Ve,onMouseMove:ft,onMouseOver:ft}),we?s.createElement(B,{className:l(V.layer,V["menu-layer"]),metaItem:null!==K.metaItem&&"Ready"===K.metaItem.type?K.metaItem.content:null,nextVideo:K.nextVideo,onDismiss:Nt,onNextVideoRequested:mt}):null,ke?s.createElement(g,o({className:l(V.layer,V["menu-layer"])},ae)):null,Le?s.createElement(y,{className:l(V.layer,V["menu-layer"]),audioTracks:ie.state.audioTracks,selectedAudioTrackId:ie.state.selectedAudioTrackId,subtitlesTracks:ie.state.subtitlesTracks,selectedSubtitlesTrackId:ie.state.selectedSubtitlesTrackId,subtitlesOffset:ie.state.subtitlesOffset,subtitlesSize:ie.state.subtitlesSize,extraSubtitlesTracks:ie.state.extraSubtitlesTracks,selectedExtraSubtitlesTrackId:ie.state.selectedExtraSubtitlesTrackId,extraSubtitlesOffset:ie.state.extraSubtitlesOffset,extraSubtitlesDelay:ie.state.extraSubtitlesDelay,extraSubtitlesSize:ie.state.extraSubtitlesSize,onSubtitlesTrackSelected:ut,onExtraSubtitlesTrackSelected:At,onAudioTrackSelected:dt,onSubtitlesOffsetChanged:Rt,onSubtitlesSizeChanged:ct,onExtraSubtitlesOffsetChanged:Rt,onExtraSubtitlesDelayChanged:Ot,onExtraSubtitlesSizeChanged:ct}):null,Ce?s.createElement(v,{className:l(V.layer,V["menu-layer"]),stream:null!==K.selected?K.selected.stream:null,addon:K.addon,metaItem:null!==K.metaItem&&"Ready"===K.metaItem.type?K.metaItem.content:null}):null,ge?s.createElement(b,{className:l(V.layer,V["menu-layer"]),playbackSpeed:ie.state.playbackSpeed,onPlaybackSpeedChanged:It}):null,ye?s.createElement(W,{className:l(V.layer,V["menu-layer"]),metaItem:null!==K.metaItem&&"Ready"===K.metaItem.type?K.metaItem.content:null,seriesInfo:K.seriesInfo}):null,ce?s.createElement(M,{className:l(V.layer,V["menu-layer"]),stream:K.selected.stream,playbackDevices:null!==te.playbackDevices&&"Ready"===te.playbackDevices.type?te.playbackDevices.content:[]}):null)};w.propTypes={urlParams:S.shape({stream:S.string,streamTransportUrl:S.string,metaTransportUrl:S.string,type:S.string,id:S.string,videoId:S.string}),queryParams:S.instanceOf(URLSearchParams)};e.exports=p(w,(function(){return s.createElement("div",{className:l(V["player-container"])})}))},90231:(e,t,a)=>{var i=a(96540),o=a(5556),n=a(46942),r=a(28990).Button,E=a(43129),_=function(e){var t=e.className,a=e.value,o=e.selected,_=e.onSelect,T=i.useCallback((function(){"function"==typeof _&&_(a)}),[_,a]);return i.createElement(r,{className:n(t,E.option,{selected:o}),onClick:T},i.createElement("div",{className:E.label},a,"x"),i.createElement("div",{className:E.icon}))};_.propTypes={className:o.string,value:o.number,selected:o.bool,onSelect:o.func},e.exports=_},9340:(e,t,a)=>{var i=a(90231);e.exports=i},31596:(e,t,a)=>{var i=a(96540),o=a(5556),n=a(46942),r=a(32389).useTranslation,E=a(9340),_=a(66323),T=Array.from(Array(8).keys(),(function(e){return.25*e+.25})).reverse(),s=function(e){var t=e.className,a=e.playbackSpeed,o=e.onPlaybackSpeedChanged,s=r().t,S=i.useCallback((function(e){e.nativeEvent.speedMenuClosePrevented=!0}),[]),l=i.useCallback((function(e){"function"==typeof o&&o(e)}),[o]);return i.createElement("div",{className:n(t,_["speed-menu-container"]),onMouseDown:S},i.createElement("div",{className:_.title},s("PLAYBACK_SPEED")),i.createElement("div",{className:_["options-container"]},T.map((function(e){return i.createElement(E,{className:_.option,key:e,value:e,selected:e===a,onSelect:l})}))))};s.propTypes={className:o.string,playbackSpeed:o.number,onPlaybackSpeedChanged:o.func},e.exports=s},40200:(e,t,a)=>{var i=a(31596);e.exports=i},98830:(e,t,a)=>{var i=a(96540),o=a(46942),n=a(5556),r=a(12909),E=function(e){var t=e.className,a=e.peers,n=e.speed,E=e.completed,_=e.infoHash;return i.createElement("div",{className:o(t,r["statistics-menu-container"])},i.createElement("div",{className:r.title},"Statistics"),i.createElement("div",{className:r.stats},i.createElement("div",{className:r.stat},i.createElement("div",{className:r.label},"Peers"),i.createElement("div",{className:r.value},a)),i.createElement("div",{className:r.stat},i.createElement("div",{className:r.label},"Speed"),i.createElement("div",{className:r.value},n," MB/s")),i.createElement("div",{className:r.stat},i.createElement("div",{className:r.label},"Completed"),i.createElement("div",{className:r.value},E," %"))),i.createElement("div",{className:r["info-hash"]},i.createElement("div",{className:r.label},"Info Hash"),i.createElement("div",{className:r.value},_)))};E.propTypes={className:n.string,peers:n.number,speed:n.number,completed:n.number,infoHash:n.string},e.exports=E},7432:(e,t,a)=>{var i=a(98830);e.exports=i},1425:(e,t,a)=>{var i=a(96540),o=a(5556),n=a(46942),r=a(87865).default,E=a(28990).Button,_=a(88235),T=function(e){var t=e.className,a=e.value,o=e.label,T=e.disabled,s=e.dataset,S=e.onChange,l=i.useCallback((function(e){"function"==typeof S&&S({type:"change",value:e.currentTarget.dataset.type,dataset:s,reactEvent:e,nativeEvent:e.nativeEvent})}),[s,S]);return i.createElement("div",{className:n(t,_["discrete-input-container"],{disabled:T})},i.createElement("div",{className:_.header},o),i.createElement("div",{className:_["input-container"],title:T?"".concat(o," is not configurable"):null},i.createElement(E,{className:n(_["button-container"],{disabled:T}),"data-type":"decrement",onClick:l},i.createElement(r,{className:_.icon,name:"remove"})),i.createElement("div",{className:_["option-label"],title:a},a),i.createElement(E,{className:n(_["button-container"],{disabled:T}),"data-type":"increment",onClick:l},i.createElement(r,{className:_.icon,name:"add"}))))};T.propTypes={className:o.string,value:o.string,label:o.string,disabled:o.bool,dataset:o.object,onChange:o.func},e.exports=T},58912:(e,t,a)=>{var i=a(1425);e.exports=i},11072:(e,t,a)=>{var i=a(96540),o=a(5556),n=a(46942),r=a(28990),E=r.Button,_=r.CONSTANTS,T=r.comparatorWithPriorities,s=r.languageNames,S=a(58912),l=a(94297),I=a(35543).t,u={EMBEDDED:2,EXCLUSIVE:1},A={eng:1},d=i.memo((function(e){var t=i.useMemo((function(){return(Array.isArray(e.subtitlesTracks)?e.subtitlesTracks:[]).concat(Array.isArray(e.extraSubtitlesTracks)?e.extraSubtitlesTracks:[]).reduce((function(e,t){var a=t.lang;return e.includes(a)||e.push(a),e}),[]).sort(T(A))}),[e.subtitlesTracks,e.extraSubtitlesTracks]),a=i.useMemo((function(){return"string"==typeof e.selectedSubtitlesTrackId?(Array.isArray(e.subtitlesTracks)?e.subtitlesTracks:[]).reduce((function(t,a){var i=a.id,o=a.lang;return i===e.selectedSubtitlesTrackId?o:t}),null):"string"==typeof e.selectedExtraSubtitlesTrackId?(Array.isArray(e.extraSubtitlesTracks)?e.extraSubtitlesTracks:[]).reduce((function(t,a){var i=a.id,o=a.lang;return i===e.selectedExtraSubtitlesTrackId?o:t}),null):null}),[e.subtitlesTracks,e.extraSubtitlesTracks,e.selectedSubtitlesTrackId,e.selectedExtraSubtitlesTrackId]),o=i.useMemo((function(){return(Array.isArray(e.subtitlesTracks)?e.subtitlesTracks:[]).concat(Array.isArray(e.extraSubtitlesTracks)?e.extraSubtitlesTracks:[]).filter((function(e){return e.lang===a})).sort((function(e,t){return T(u)(e.origin,t.origin)}))}),[e.subtitlesTracks,e.extraSubtitlesTracks,a]),r=i.useCallback((function(e){e.nativeEvent.subtitlesMenuClosePrevented=!0}),[]),d=i.useCallback((function(t){var a=(Array.isArray(e.subtitlesTracks)?e.subtitlesTracks:[]).concat(Array.isArray(e.extraSubtitlesTracks)?e.extraSubtitlesTracks:[]).filter((function(e){return e.lang===t.currentTarget.dataset.lang})).sort((function(e,t){return T(u)(e.origin,t.origin)})).shift();a?a.embedded?"function"==typeof e.onSubtitlesTrackSelected&&e.onSubtitlesTrackSelected(a.id):"function"==typeof e.onExtraSubtitlesTrackSelected&&e.onExtraSubtitlesTrackSelected(a.id):("function"==typeof e.onSubtitlesTrackSelected&&e.onSubtitlesTrackSelected(null),"function"==typeof e.onExtraSubtitlesTrackSelected&&e.onExtraSubtitlesTrackSelected(null))}),[e.subtitlesTracks,e.extraSubtitlesTracks,e.onSubtitlesTrackSelected,e.onExtraSubtitlesTrackSelected]),O=i.useCallback((function(t){"true"===t.currentTarget.dataset.embedded?"function"==typeof e.onSubtitlesTrackSelected&&e.onSubtitlesTrackSelected(t.currentTarget.dataset.id):"function"==typeof e.onExtraSubtitlesTrackSelected&&e.onExtraSubtitlesTrackSelected(t.currentTarget.dataset.id)}),[e.onSubtitlesTrackSelected,e.onExtraSubtitlesTrackSelected]),c=i.useCallback((function(t){var a="increment"===t.value?250:-250;if("string"==typeof e.selectedExtraSubtitlesTrackId&&null!==e.extraSubtitlesDelay&&!isNaN(e.extraSubtitlesDelay)){var i=e.extraSubtitlesDelay+a;"function"==typeof e.onExtraSubtitlesDelayChanged&&e.onExtraSubtitlesDelayChanged(i)}}),[e.selectedExtraSubtitlesTrackId,e.extraSubtitlesDelay,e.onExtraSubtitlesDelayChanged]),R=i.useCallback((function(t){var a="increment"===t.value?1:-1;if("string"==typeof e.selectedSubtitlesTrackId){if(null!==e.subtitlesSize&&!isNaN(e.subtitlesSize)){var i=_.SUBTITLES_SIZES.indexOf(e.subtitlesSize),o=_.SUBTITLES_SIZES[Math.max(0,Math.min(_.SUBTITLES_SIZES.length-1,i+a))];"function"==typeof e.onSubtitlesSizeChanged&&e.onSubtitlesSizeChanged(o)}}else if("string"==typeof e.selectedExtraSubtitlesTrackId&&null!==e.extraSubtitlesSize&&!isNaN(e.extraSubtitlesSize)){var n=_.SUBTITLES_SIZES.indexOf(e.extraSubtitlesSize),r=_.SUBTITLES_SIZES[Math.max(0,Math.min(_.SUBTITLES_SIZES.length-1,n+a))];"function"==typeof e.onExtraSubtitlesSizeChanged&&e.onExtraSubtitlesSizeChanged(r)}}),[e.selectedSubtitlesTrackId,e.selectedExtraSubtitlesTrackId,e.subtitlesSize,e.extraSubtitlesSize,e.onSubtitlesSizeChanged,e.onExtraSubtitlesSizeChanged]),N=i.useCallback((function(t){var a="increment"===t.value?1:-1;if("string"==typeof e.selectedSubtitlesTrackId){if(null!==e.extraSubtitlesOffset&&!isNaN(e.extraSubtitlesOffset)){var i=Math.max(0,Math.min(100,Math.floor(e.extraSubtitlesOffset+a)));"function"==typeof e.onExtraSubtitlesOffsetChanged&&e.onExtraSubtitlesOffsetChanged(i)}}else if("string"==typeof e.selectedExtraSubtitlesTrackId&&null!==e.subtitlesOffset&&!isNaN(e.subtitlesOffset)){var o=Math.max(0,Math.min(100,Math.floor(e.subtitlesOffset+a)));"function"==typeof e.onSubtitlesOffsetChanged&&e.onSubtitlesOffsetChanged(o)}}),[e.selectedSubtitlesTrackId,e.selectedExtraSubtitlesTrackId,e.subtitlesOffset,e.extraSubtitlesOffset,e.onSubtitlesOffsetChanged,e.onExtraSubtitlesOffsetChanged]),m=i.useCallback((function(t){"function"==typeof e.onAudioTrackSelected&&e.onAudioTrackSelected(t.currentTarget.dataset.id)}),[e.onAudioTrackSelected]);return i.createElement("div",{className:n(e.className,l["subtitles-menu-container"]),onMouseDown:r},Array.isArray(e.audioTracks)&&e.audioTracks.length>1?i.createElement("div",{className:l["languages-container"]},i.createElement("div",{className:l["languages-header"]},"Audio Languages"),i.createElement("div",{className:l["languages-list"]},e.audioTracks.map((function(t,a){var o=t.id,r=t.label,_=t.lang;return i.createElement(E,{key:a,title:r,className:n(l["language-option"],{selected:e.selectedAudioTrackId===o}),"data-id":o,onClick:m},i.createElement("div",{className:l["language-label"]},"string"==typeof s[_]?s[_]:_),e.selectedAudioTrackId===o?i.createElement("div",{className:l.icon}):null)})))):null,i.createElement("div",{className:l["languages-container"]},i.createElement("div",{className:l["languages-header"]},I("PLAYER_SUBTITLES_LANGUAGES")),i.createElement("div",{className:l["languages-list"]},i.createElement(E,{title:I("OFF"),className:n(l["language-option"],{selected:null===a}),onClick:d},i.createElement("div",{className:l["language-label"]},I("OFF")),null===a?i.createElement("div",{className:l.icon}):null),t.map((function(e,t){return i.createElement(E,{key:t,title:"string"==typeof s[e]?s[e]:e,className:n(l["language-option"],{selected:a===e}),"data-lang":e,onClick:d},i.createElement("div",{className:l["language-label"]},"string"==typeof s[e]?s[e]:e),a===e?i.createElement("div",{className:l.icon}):null)})))),i.createElement("div",{className:l["variants-container"]},i.createElement("div",{className:l["variants-header"]},I("PLAYER_SUBTITLES_VARIANTS")),o.length>0?i.createElement("div",{className:l["variants-list"]},o.map((function(t,a){return i.createElement(E,{key:a,title:t.label,className:n(l["variant-option"],{selected:e.selectedSubtitlesTrackId===t.id||e.selectedExtraSubtitlesTrackId===t.id}),"data-id":t.id,"data-origin":t.origin,"data-embedded":t.embedded,onClick:O},i.createElement("div",{className:l["variant-label"]},"string"!=typeof t.label||t.label.startsWith("http")?t.lang:t.label,i.createElement("div",{className:l["variant-origin"]},I(t.origin))),e.selectedSubtitlesTrackId===t.id||e.selectedExtraSubtitlesTrackId===t.id?i.createElement("div",{className:l.icon}):null)}))):i.createElement("div",{className:l["no-variants-container"]},i.createElement("div",{className:l["no-variants-label"]},I("PLAYER_SUBTITLES_DISABLED")))),i.createElement("div",{className:l["subtitles-settings-container"]},i.createElement("div",{className:l["settings-header"]},"Subtitles Settings"),i.createElement(S,{className:l["discrete-input"],label:I("DELAY"),value:"string"!=typeof e.selectedExtraSubtitlesTrackId||null===e.extraSubtitlesDelay||isNaN(e.extraSubtitlesDelay)?"--":"".concat((e.extraSubtitlesDelay/1e3).toFixed(2),"s"),disabled:"string"!=typeof e.selectedExtraSubtitlesTrackId||null===e.extraSubtitlesDelay||isNaN(e.extraSubtitlesDelay),onChange:c}),i.createElement(S,{className:l["discrete-input"],label:I("SIZE"),value:"string"==typeof e.selectedSubtitlesTrackId?null===e.subtitlesSize||isNaN(e.subtitlesSize)?"--":"".concat(e.subtitlesSize,"%"):"string"==typeof e.selectedExtraSubtitlesTrackId?null===e.extraSubtitlesSize||isNaN(e.extraSubtitlesSize)?"--":"".concat(e.extraSubtitlesSize,"%"):"--",disabled:"string"==typeof e.selectedSubtitlesTrackId?null===e.subtitlesSize||isNaN(e.subtitlesSize):"string"!=typeof e.selectedExtraSubtitlesTrackId||(null===e.extraSubtitlesSize||isNaN(e.extraSubtitlesSize)),onChange:R}),i.createElement(S,{className:l["discrete-input"],label:I("PLAYER_SUBTITLES_VERTICAL_POSIITON"),value:"string"==typeof e.selectedSubtitlesTrackId?null===e.subtitlesOffset||isNaN(e.subtitlesOffset)?"--":"".concat(e.subtitlesOffset,"%"):"string"==typeof e.selectedExtraSubtitlesTrackId?null===e.extraSubtitlesOffset||isNaN(e.extraSubtitlesOffset)?"--":"".concat(e.extraSubtitlesOffset,"%"):"--",disabled:"string"==typeof e.selectedSubtitlesTrackId?null===e.subtitlesOffset||isNaN(e.subtitlesOffset):"string"!=typeof e.selectedExtraSubtitlesTrackId||(null===e.extraSubtitlesOffset||isNaN(e.extraSubtitlesOffset)),onChange:N})))}));d.displayName="MainNavBars",d.propTypes={className:o.string,subtitlesTracks:o.arrayOf(o.shape({id:o.string.isRequired,lang:o.string.isRequired,origin:o.string.isRequired})),selectedSubtitlesTrackId:o.string,subtitlesOffset:o.number,subtitlesSize:o.number,extraSubtitlesTracks:o.arrayOf(o.shape({id:o.string.isRequired,lang:o.string.isRequired,origin:o.string.isRequired,label:o.string.isRequired})),selectedExtraSubtitlesTrackId:o.string,extraSubtitlesOffset:o.number,extraSubtitlesDelay:o.number,extraSubtitlesSize:o.number,audioTracks:o.arrayOf(o.shape({id:o.string.isRequired,lang:o.string.isRequired,origin:o.string.isRequired,label:o.string.isRequired})),selectedAudioTrackId:o.string,onSubtitlesTrackSelected:o.func,onExtraSubtitlesTrackSelected:o.func,onAudioTrackSelected:o.func,onSubtitlesOffsetChanged:o.func,onSubtitlesSizeChanged:o.func,onExtraSubtitlesOffsetChanged:o.func,onExtraSubtitlesDelayChanged:o.func,onExtraSubtitlesSizeChanged:o.func},e.exports=d},14802:(e,t,a)=>{var i=a(11072);e.exports=i},88584:(e,t,a)=>{var i=a(96540),o=a(5556),n=a(46942),r=a(49234),E=i.forwardRef((function(e,t){var a=e.className,o=e.onClick,E=e.onDoubleClick;return i.createElement("div",{className:n(a,r["video-container"]),onClick:o,onDoubleClick:E},i.createElement("div",{ref:t,className:r.video}))}));E.displayName="Video",E.propTypes={className:o.string,onClick:o.func,onDoubleClick:o.func},e.exports=E},90875:(e,t,a)=>{var i=a(88584);e.exports=i},9064:(e,t,a)=>{var i=a(96540),o=a(5556),n=a(46942),r=a(40851).useServices,E=a(28990).Video,_=a(16036),T=function(e){var t=e.className,a=e.metaItem,o=e.seriesInfo,T=r().core,s=i.useCallback((function(e){e.nativeEvent.videosMenuClosePrevented=!0}),[]),S=i.useMemo((function(){return o&&"number"==typeof o.season&&Array.isArray(a.videos)?a.videos.filter((function(e){return e.season===o.season})):a.videos}),[a,o]),l=function(e,t){T.transport.dispatch({action:"Player",args:{action:"MarkVideoAsWatched",args:[e,!t]}})};return i.createElement("div",{className:n(t,_["videos-menu-container"]),onMouseDown:s},S.map((function(e,t){return i.createElement(E,{key:t,id:e.id,title:e.title,thumbnail:e.thumbnail,episode:e.episode,released:e.released,upcoming:e.upcoming,watched:e.watched,progress:e.progress,deepLinks:e.deepLinks,scheduled:e.scheduled,onMarkVideoAsWatched:l})})))};T.propTypes={className:o.string,metaItem:o.object,seriesInfo:o.shape({season:o.number,episode:o.number})},e.exports=T},79607:(e,t,a)=>{var i=a(9064);e.exports=i},11248:(e,t,a)=>{function i(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,o,n,r,E=[],_=!0,T=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;_=!1}else for(;!(_=(i=n.call(a)).done)&&(E.push(i.value),E.length!==t);_=!0);}catch(e){T=!0,o=e}finally{try{if(!_&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(T)throw o}}return E}})(e,t)||(function(e,t){if(e){if("string"==typeof e)return o(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,t):void 0}})(e,t)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a{var i=a(11248);e.exports=i},82191:(e,t,a)=>{var i=a(92770);e.exports=i},47137:(e,t,a)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(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 n(e){for(var t=1;t{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(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 n(e){for(var t=1;t{var i=a(96540),o=a(40851).useServices;e.exports=function(e,t){var a=o().core,n=i.useMemo((function(){var t;return null!==(t=e.selected)&&void 0!==t&&t.stream?e.selected.stream:null}),[e.selected]),r=i.useMemo((function(){return null!=n&&n.infoHash?null==n?void 0:n.infoHash:null}),[n]),E=i.useMemo((function(){var e;return"Ready"===(null===(e=t.statistics)||void 0===e?void 0:e.type)?t.statistics.content:null}),[t.statistics]),_=i.useMemo((function(){return null!=E&&E.peers?E.peers:0}),[E]),T=i.useMemo((function(){return null!=E&&E.downloadSpeed?parseFloat((E.downloadSpeed/1e3/1e3).toFixed(2)):0}),[E]),s=i.useMemo((function(){return null!=E&&E.streamProgress?parseFloat((100*E.streamProgress).toFixed(2)):0}),[E]),S=i.useCallback((function(){if(n){var e=n.infoHash,t=n.fileIdx;"string"==typeof e&&"number"==typeof t&&a.transport.dispatch({action:"StreamingServer",args:{action:"GetStatistics",args:{infoHash:e,fileIdx:t}}})}}),[n]);return i.useEffect((function(){S();var e=setInterval(S,5e3);return function(){return clearInterval(e)}}),[S]),{infoHash:r,peers:_,speed:T,completed:s}}},89045:(e,t,a)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(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 n(e){for(var t=1;te.length)&&(t=e.length);for(var a=0,i=Array(t);a{function i(e,t){return(function(e){if(Array.isArray(e))return e})(e)||(function(e,t){var a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var i,o,n,r,E=[],_=!0,T=!1;try{if(n=(a=a.call(e)).next,0===t){if(Object(a)!==a)return;_=!1}else for(;!(_=(i=n.call(a)).done)&&(E.push(i.value),E.length!==t);_=!0);}catch(e){T=!0,o=e}finally{try{if(!_&&null!=a.return&&(r=a.return(),Object(r)!==r))return}finally{if(T)throw o}}return E}})(e,t)||(function(e,t){if(e){if("string"==typeof e)return o(e,t);var a={}.toString.call(e).slice(8,-1);return"Object"===a&&e.constructor&&(a=e.constructor.name),"Map"===a||"Set"===a?Array.from(e):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?o(e,t):void 0}})(e,t)||(function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var a=0,i=Array(t);a{var i=a(17908);e.exports=i},33809:(e,t,a)=>{var i=a(96540),o=a(28990).useModelState,n=a(40851).useServices;e.exports=function(e){var t=n().core,a=i.useMemo((function(){var t,a=null!==(t=e.get("search"))&&void 0!==t?t:e.get("query");return(null==a?void 0:a.length)>0?{action:"Load",args:{model:"CatalogsWithExtra",args:{extra:[["search",a]]}}}:{action:"Unload"}}),[e]),r=i.useCallback((function(e){t.transport.dispatch({action:"CatalogsWithExtra",args:{action:"LoadRange",args:e}},"search")}),[]);return[o({model:"search",action:a}),r]}},61662:(e,t,a)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var a=0,i=Array(t);a=Re.current.scrollHeight-50)fe(pe[pe.length-1].id);else for(var e=pe.length-1;e>=0;e--)if(pe[e].ref.current.offsetTop-Re.current.offsetTop<=Re.current.scrollTop){fe(pe[e].id);break}}),[]),Be=_.useCallback((function(e){var t=pe.find((function(t){return t.id===e.currentTarget.dataset.section}));Re.current.scrollTo({top:t.ref.current.offsetTop-Re.current.offsetTop,behavior:"smooth"})}),[]),ge=_.useCallback(s((function(){Pe()}),50),[]);return _.useEffect((function(){Ie&&Se&&(i.transport.dispatch({action:"Ctx",args:{action:"InstallTraktAddon"}}),le(!1))}),[Ie,Se]),_.useEffect((function(){null!==U.exportUrl&&"string"==typeof U.exportUrl&&F.openExternal(U.exportUrl)}),[U.exportUrl]),_.useLayoutEffect((function(){A&&Pe()}),[A]),_.createElement(c,{className:B["settings-container"],route:"settings"},_.createElement("div",{className:T(B["settings-content"],"animation-fade-in")},_.createElement("div",{className:B["side-menu-container"]},_.createElement(d,{className:T(B["side-menu-button"],n({},B.selected,Ce===v)),title:e("SETTINGS_NAV_GENERAL"),"data-section":v,onClick:Be},e("SETTINGS_NAV_GENERAL")),_.createElement(d,{className:T(B["side-menu-button"],n({},B.selected,Ce===M)),title:e("SETTINGS_NAV_PLAYER"),"data-section":M,onClick:Be},e("SETTINGS_NAV_PLAYER")),_.createElement(d,{className:T(B["side-menu-button"],n({},B.selected,Ce===W)),title:e("SETTINGS_NAV_STREAMING"),"data-section":W,onClick:Be},e("SETTINGS_NAV_STREAMING")),_.createElement(d,{className:T(B["side-menu-button"],n({},B.selected,Ce===y)),title:e("SETTINGS_NAV_SHORTCUTS"),"data-section":y,onClick:Be},e("SETTINGS_NAV_SHORTCUTS")),_.createElement("div",{className:B.spacing}),_.createElement("div",{className:B["version-info-label"],title:"5.0.0-beta.14"},"App Version: ","5.0.0-beta.14"),null!==k.settings&&"Ready"===k.settings.type?_.createElement("div",{className:B["version-info-label"],title:k.settings.content.serverVersion},"Server Version: ",k.settings.content.serverVersion):null),_.createElement("div",{ref:Re,className:B["sections-container"],onScroll:ge},_.createElement("div",{ref:Ne,className:B["section-container"]},_.createElement("div",{className:T(B["option-container"],B["user-info-option-container"])},_.createElement("div",{className:B["user-info-content"]},_.createElement("div",{className:B["avatar-container"],style:{backgroundImage:null===p.auth?"url('".concat(a(92890),"')"):p.auth.user.avatar?"url('".concat(p.auth.user.avatar,"')"):"url('".concat(a(44636),"')")}}),_.createElement("div",{className:B["email-logout-container"]},_.createElement("div",{className:B["email-label-container"],title:null===p.auth?"Anonymous user":p.auth.user.email},_.createElement("div",{className:B["email-label"]},null===p.auth?"Anonymous user":p.auth.user.email)),null!==p.auth?_.createElement(d,{className:B["logout-button-container"],title:e("LOG_OUT"),onClick:ue},_.createElement("div",{className:B["logout-label"]},e("LOG_OUT"))):null))),null===p.auth?_.createElement("div",{className:B["option-container"]},_.createElement(d,{className:T(B["option-input-container"],B["button-container"]),title:"".concat(e("LOG_IN")," / ").concat(e("SIGN_UP")),href:"#/intro"},_.createElement("div",{className:B.label},e("LOG_IN")," / ",e("SIGN_UP")))):null),_.createElement("div",{className:B["section-container"]},_.createElement("div",{className:T(B["option-container"],B["link-container"])},p.auth?_.createElement(d,{className:T(B["option-input-container"],B["link-input-container"]),title:e("SETTINGS_DATA_EXPORT"),tabIndex:-1,onClick:Oe},_.createElement("div",{className:B.label},e("SETTINGS_DATA_EXPORT"))):null),null!==p.auth&&null!==p.auth.user&&"string"==typeof p.auth.user._id?_.createElement("div",{className:T(B["option-container"],B["link-container"])},_.createElement(d,{className:T(B["option-input-container"],B["link-input-container"]),title:e("SETTINGS_SUBSCRIBE_CALENDAR"),tabIndex:-1,onClick:de},_.createElement("div",{className:B.label},e("SETTINGS_SUBSCRIBE_CALENDAR")))):null,_.createElement("div",{className:T(B["option-container"],B["link-container"])},_.createElement(d,{className:T(B["option-input-container"],B["link-input-container"]),title:e("SETTINGS_SUPPORT"),target:"_blank",href:"https://stremio.zendesk.com/hc/en-us"},_.createElement("div",{className:B.label},e("SETTINGS_SUPPORT")))),_.createElement("div",{className:T(B["option-container"],B["link-container"])},_.createElement(d,{className:T(B["option-input-container"],B["link-input-container"]),title:"Source code",target:"_blank",href:"https://github.com/stremio/stremio-web/tree/".concat("865907b7ae01152409fb81a58ef89d7c9c75c046")},_.createElement("div",{className:B.label},"Source code"))),_.createElement("div",{className:T(B["option-container"],B["link-container"])},_.createElement(d,{className:T(B["option-input-container"],B["link-input-container"]),title:e("TERMS_OF_SERVICE"),target:"_blank",href:"https://www.stremio.com/tos"},_.createElement("div",{className:B.label},e("TERMS_OF_SERVICE")))),_.createElement("div",{className:T(B["option-container"],B["link-container"])},_.createElement(d,{className:T(B["option-input-container"],B["link-input-container"]),title:e("PRIVACY_POLICY"),target:"_blank",href:"https://www.stremio.com/privacy"},_.createElement("div",{className:B.label},e("PRIVACY_POLICY")))),null!==p.auth&&null!==p.auth.user?_.createElement("div",{className:T(B["option-container"],B["link-container"])},_.createElement(d,{className:T(B["option-input-container"],B["link-input-container"]),title:e("SETTINGS_ACC_DELETE"),target:"_blank",href:"https://stremio.zendesk.com/hc/en-us/articles/360021428911-How-to-delete-my-account"},_.createElement("div",{className:B.label},e("SETTINGS_ACC_DELETE")))):null,null!==p.auth&&null!==p.auth.user&&"string"==typeof p.auth.user.email?_.createElement("div",{className:B["option-container"]},_.createElement(d,{className:T(B["option-input-container"],B["link-input-container"]),title:e("SETTINGS_CHANGE_PASSWORD"),target:"_blank",href:"https://www.strem.io/reset-password/".concat(p.auth.user.email)},_.createElement("div",{className:B.label},e("SETTINGS_CHANGE_PASSWORD")))):null,_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:T(B["option-name-container"],B["trakt-icon"])},_.createElement(l,{className:B.icon,name:"trakt"}),_.createElement("div",{className:B.label},"Trakt Scrobbling")),_.createElement(d,{className:T(B["option-input-container"],B["button-container"]),title:"Authenticate",disabled:null===p.auth,tabIndex:-1,onClick:Ae},_.createElement("div",{className:B.label},null!==p.auth&&null!==p.auth.user&&null!==p.auth.user.trakt?e("LOG_OUT"):e("SETTINGS_TRAKT_AUTHENTICATE"))))),_.createElement("div",{className:B["section-container"]},_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_UI_LANGUAGE"))),_.createElement(R,o({className:T(B["option-input-container"],B["multiselect-container"]),tabIndex:-1},w)))),_.createElement("div",{ref:me,className:B["section-container"]},_.createElement("div",{className:B["section-title"]},e("SETTINGS_NAV_PLAYER")),_.createElement("div",{className:B["section-category-container"]},_.createElement(l,{className:B.icon,name:"subtitles"}),_.createElement("div",{className:B.label},e("SETTINGS_SECTION_SUBTITLES"))),_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_SUBTITLES_LANGUAGE"))),_.createElement(R,o({className:T(B["option-input-container"],B["multiselect-container"])},Y))),E.active?_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_FULLSCREEN_EXIT"))),_.createElement(O,o({className:T(B["option-input-container"],B["toggle-container"])},J))):null,_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_SUBTITLES_SIZE"))),_.createElement(R,o({className:T(B["option-input-container"],B["multiselect-container"])},z))),_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_SUBTITLES_COLOR"))),_.createElement(N,o({className:T(B["option-input-container"],B["color-input-container"])},K))),_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_SUBTITLES_COLOR_BACKGROUND"))),_.createElement(N,o({className:T(B["option-input-container"],B["color-input-container"])},j))),_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_SUBTITLES_COLOR_OUTLINE"))),_.createElement(N,o({className:T(B["option-input-container"],B["color-input-container"])},x)))),_.createElement("div",{className:B["section-container"]},_.createElement("div",{className:B["section-category-container"]},_.createElement(l,{className:B.icon,name:"volume-medium"}),_.createElement("div",{className:B.label},e("SETTINGS_SECTION_AUDIO"))),_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_DEFAULT_AUDIO_TRACK"))),_.createElement(R,o({className:T(B["option-input-container"],B["multiselect-container"])},Q))),_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_SURROUND_SOUND"))),_.createElement(O,o({className:T(B["option-input-container"],B["toggle-container"]),tabIndex:-1},X)))),_.createElement("div",{className:B["section-container"]},_.createElement("div",{className:B["section-category-container"]},_.createElement(l,{className:B.icon,name:"remote"}),_.createElement("div",{className:B.label},e("SETTINGS_SECTION_CONTROLS"))),_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_SEEK_KEY"))),_.createElement(R,o({className:T(B["option-input-container"],B["multiselect-container"])},$))),_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_SEEK_KEY_SHIFT"))),_.createElement(R,o({className:T(B["option-input-container"],B["multiselect-container"])},q))),_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_PLAY_IN_BACKGROUND"))),_.createElement(O,o({className:T(B["option-input-container"],B["toggle-container"]),disabled:!0,tabIndex:-1},ae)))),_.createElement("div",{className:B["section-container"]},_.createElement("div",{className:B["section-category-container"]},_.createElement(l,{className:B.icon,name:"play"}),_.createElement("div",{className:B.label},e("SETTINGS_SECTION_AUTO_PLAY"))),_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("AUTO_PLAY"))),_.createElement(O,o({className:T(B["option-input-container"],B["toggle-container"])},te))),_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_NEXT_VIDEO_POPUP_DURATION"))),_.createElement(R,o({className:T(B["option-input-container"],B["multiselect-container"]),disabled:!p.settings.bingeWatching},ee)))),_.createElement("div",{className:B["section-container"]},_.createElement("div",{className:B["section-category-container"]},_.createElement(l,{className:B.icon,name:"glasses"}),_.createElement("div",{className:B.label},e("SETTINGS_SECTION_ADVANCED"))),_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_PLAY_IN_EXTERNAL_PLAYER"))),_.createElement(R,o({className:T(B["option-input-container"],B["multiselect-container"])},Z))),_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_HWDEC"))),_.createElement(O,o({className:T(B["option-input-container"],B["toggle-container"]),disabled:!0,tabIndex:-1},ie)))),_.createElement("div",{ref:Le,className:B["section-container"]},_.createElement("div",{className:B["section-title"]},e("SETTINGS_NAV_STREAMING")),_.createElement(g,null),null!==ne.value?_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_REMOTE_URL"))),_.createElement("div",{className:T(B["option-input-container"],B["configure-input-container"])},_.createElement("div",{className:B.label,title:ne.value},ne.value),_.createElement(d,{className:B["configure-button-container"],title:e("SETTINGS_COPY_REMOTE_URL"),onClick:ce},_.createElement(l,{className:B.icon,name:"link"})))):null,null!==p.auth&&null!==p.auth.user&&null!==re?_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_HTTPS_ENDPOINT"))),_.createElement(R,o({className:T(B["option-input-container"],B["multiselect-container"])},re))):null,null!==Ee?_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_SERVER_CACHE_SIZE"))),_.createElement(R,o({className:T(B["option-input-container"],B["multiselect-container"])},Ee))):null,null!==_e?_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_SERVER_TORRENT_PROFILE"))),_.createElement(R,o({className:T(B["option-input-container"],B["multiselect-container"])},_e))):null,null!==Te?_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_TRANSCODE_PROFILE"))),_.createElement(R,o({className:T(B["option-input-container"],B["multiselect-container"])},Te))):null),_.createElement("div",{ref:De,className:B["section-container"]},_.createElement("div",{className:B["section-title"]},e("SETTINGS_NAV_SHORTCUTS")),_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_SHORTCUT_PLAY_PAUSE"))),_.createElement("div",{className:T(B["option-input-container"],B["shortcut-container"])},_.createElement("kbd",null,e("SETTINGS_SHORTCUT_SPACE")))),_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_SHORTCUT_SEEK_FORWARD"))),_.createElement("div",{className:T(B["option-input-container"],B["shortcut-container"])},_.createElement("kbd",null,"→"),_.createElement("div",{className:B.label},e("SETTINGS_SHORTCUT_OR")),_.createElement("kbd",null,"⇧ ",e("SETTINGS_SHORTCUT_SHIFT")),_.createElement("div",{className:B.label},"+"),_.createElement("kbd",null,"→"))),_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_SHORTCUT_SEEK_BACKWARD"))),_.createElement("div",{className:T(B["option-input-container"],B["shortcut-container"])},_.createElement("kbd",null,"←"),_.createElement("div",{className:B.label},e("SETTINGS_SHORTCUT_OR")),_.createElement("kbd",null,"⇧ ",e("SETTINGS_SHORTCUT_SHIFT")),_.createElement("div",{className:B.label},"+"),_.createElement("kbd",null,"←"))),_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_SHORTCUT_VOLUME_UP"))),_.createElement("div",{className:T(B["option-input-container"],B["shortcut-container"])},_.createElement("kbd",null,"↑"))),_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_SHORTCUT_VOLUME_DOWN"))),_.createElement("div",{className:T(B["option-input-container"],B["shortcut-container"])},_.createElement("kbd",null,"↓"))),_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_SHORTCUT_MENU_SUBTITLES"))),_.createElement("div",{className:T(B["option-input-container"],B["shortcut-container"])},_.createElement("kbd",null,"S"))),_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_SHORTCUT_MENU_INFO"))),_.createElement("div",{className:T(B["option-input-container"],B["shortcut-container"])},_.createElement("kbd",null,"I"))),_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_SHORTCUT_MENU_VIDEOS"))),_.createElement("div",{className:T(B["option-input-container"],B["shortcut-container"])},_.createElement("kbd",null,"V"))),_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_SHORTCUT_FULLSCREEN"))),_.createElement("div",{className:T(B["option-input-container"],B["shortcut-container"])},_.createElement("kbd",null,"F"))),_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_SHORTCUT_NAVIGATE_MENUS"))),_.createElement("div",{className:T(B["option-input-container"],B["shortcut-container"])},_.createElement("kbd",null,"1"),_.createElement("div",{className:B.label},e("SETTINGS_SHORTCUT_TO")),_.createElement("kbd",null,"6"))),_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_SHORTCUT_GO_TO_SEARCH"))),_.createElement("div",{className:T(B["option-input-container"],B["shortcut-container"])},_.createElement("kbd",null,"0"))),_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},e("SETTINGS_SHORTCUT_EXIT_BACK"))),_.createElement("div",{className:T(B["option-input-container"],B["shortcut-container"])},_.createElement("kbd",null,e("SETTINGS_SHORTCUT_ESC"))))),_.createElement("div",{className:T(B["section-container"],B["versions-section-container"])},_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},"App Version")),_.createElement("div",{className:T(B["option-input-container"],B["info-container"])},_.createElement("div",{className:B.label},"5.0.0-beta.14"))),null!==k.settings&&"Ready"===k.settings.type?_.createElement("div",{className:B["option-container"]},_.createElement("div",{className:B["option-name-container"]},_.createElement("div",{className:B.label},"Server Version")),_.createElement("div",{className:T(B["option-input-container"],B["info-container"])},_.createElement("div",{className:B.label},k.settings.content.serverVersion))):null))))}),(function(){return _.createElement(c,{className:B["settings-container"],route:"settings"})}))},2077:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>l});var i=a(96540),o=a(28990),n=a(67512),r=a.n(n),E=a(40851);function _(e){return _="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_(e)}function T(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 s(e){for(var t=1;t{var i=a(61662);e.exports=i},35874:(e,t,a)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(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 n(e){for(var t=1;t{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(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 n(e){for(var t=1;t{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(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 n(e){for(var t=1;te.length)&&(t=e.length);for(var a=0,i=Array(t);a{var i=a(57437),o=a(92286),n=a(98125),r=a(28717),E=a(9626).default,_=a(17779),T=a(47873),s=a(42950),S=a(67211),l=a(82191),I=a(54372);e.exports={Addons:i,Board:o,Discover:n,Library:r,Calendar:E,MetaDetails:_,NotFound:T,Search:s,Settings:S,Player:l,Intro:I}},68052:(e,t,a)=>{var i=a(30228),o=a(20387);e.exports=function(){var e=!1,t=null,a=!1,n=null,r=new i;function E(){e=!0,t=null,a=!1,T()}function _(i){console.error(i),e=!1,t=new Error("Google Cast API not available",{cause:i}),a=!1,T(),n=null}function T(){r.emit("stateChanged")}Object.defineProperties(this,{active:{configurable:!1,enumerable:!0,get:function(){return e}},error:{configurable:!1,enumerable:!0,get:function(){return t}},starting:{configurable:!1,enumerable:!0,get:function(){return a}},transport:{configurable:!1,enumerable:!0,get:function(){return n}}}),this.start=function(){e||t instanceof Error||a||(a=!0,(n=new o).on("init",E),n.on("init-error",_),T())},this.stop=function(){e=!1,t=null,a=!1,T(),null!==n&&(n.removeAllListeners(),n=null)},this.on=function(e,t){r.on(e,t)},this.off=function(e,t){r.off(e,t)}}},20387:(e,t,a)=>{var i=a(30228),o=a(39590),n="urn:x-cast:com.stremio",r=2e4,E=null,_=new i;window.__onGCastApiAvailable=function(e){delete window.__onGCastApiAvailable,E=!!e,_.emit("availabilityChanged")};e.exports=function(){var e=new i,t={};function a(a,i){try{var o=JSON.parse(i),n=o.id,r=o.chunk,E=o.index,_=o.length;if(t[n]=t[n]||[],t[n][E]=r,Object.keys(t[n]).length===_){var T=JSON.parse(t[n].join(""));delete t[n],e.emit("message",T)}}catch(t){e.emit("message-error",t)}}function T(t){e.emit(cast.framework.CastSession.APPLICATION_STATUS_CHANGED,t)}function s(t){e.emit(cast.framework.CastSession.APPLICATION_METADATA_CHANGED,t)}function S(t){e.emit(cast.framework.CastSession.ACTIVE_INPUT_STATE_CHANGED,t)}function l(t){e.emit(cast.framework.CastSession.VOLUME_CHANGED,t)}function I(t){e.emit(cast.framework.CastSession.MEDIA_SESSION,t)}function u(t){e.emit(cast.framework.CastContextEventType.CAST_STATE_CHANGED,t)}function A(t){switch(e.emit(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,t),t.sessionState){case cast.framework.SessionState.SESSION_STARTED:t.session.addMessageListener(n,a),t.session.addEventListener(cast.framework.CastSession.APPLICATION_STATUS_CHANGED,T),t.session.addEventListener(cast.framework.CastSession.APPLICATION_METADATA_CHANGED,s),t.session.addEventListener(cast.framework.CastSession.ACTIVE_INPUT_STATE_CHANGED,S),t.session.addEventListener(cast.framework.CastSession.VOLUME_CHANGED,l),t.session.addEventListener(cast.framework.CastSession.MEDIA_SESSION,I);break;case cast.framework.SessionState.SESSION_ENDED:t.session.removeMessageListener(n,a),t.session.removeEventListener(cast.framework.CastSession.APPLICATION_STATUS_CHANGED,T),t.session.removeEventListener(cast.framework.CastSession.APPLICATION_METADATA_CHANGED,s),t.session.removeEventListener(cast.framework.CastSession.ACTIVE_INPUT_STATE_CHANGED,S),t.session.removeEventListener(cast.framework.CastSession.VOLUME_CHANGED,l),t.session.removeEventListener(cast.framework.CastSession.MEDIA_SESSION,I)}}new Promise((function(e,t){function a(){_.off("availabilityChanged",a),E?e():t(new Error("window.cast api not available"))}null!==E?a():_.on("availabilityChanged",a)})).then((function(){cast.framework.CastContext.getInstance().addEventListener(cast.framework.CastContextEventType.CAST_STATE_CHANGED,u),cast.framework.CastContext.getInstance().addEventListener(cast.framework.CastContextEventType.SESSION_STATE_CHANGED,A)})).then((function(){try{e.emit("init")}catch(e){console.error("ChromecastTransport",e)}})).catch((function(t){e.emit("init-error",t)})),this.on=function(t,a){e.on(t,a)},this.off=function(t,a){e.off(t,a)},this.removeAllListeners=function(){e.removeAllListeners()},this.getCastState=function(){return cast.framework.CastContext.getInstance().getCastState()},this.getSessionState=function(){return cast.framework.CastContext.getInstance().getSessionState()},this.getCastDevice=function(){var e=cast.framework.CastContext.getInstance().getCurrentSession();return null!==e?e.getCastDevice():null},this.setOptions=function(e){cast.framework.CastContext.getInstance().setOptions(e)},this.requestSession=function(){return cast.framework.CastContext.getInstance().requestSession()},this.endCurrentSession=function(e){cast.framework.CastContext.getInstance().endCurrentSession(e)},this.sendMessage=function(e){var t=cast.framework.CastContext.getInstance().getCurrentSession();if(null!==t){for(var a=JSON.stringify(e),i=Math.ceil(a.length/r),E=[],_=0;_{var i=a(68052);e.exports=i},1948:(e,t,a)=>{var i=a(30228),o=a(68571);e.exports=function(e){var t=!1,a=null,n=!1,r=null,E=new i;function _(){t=!0,a=null,n=!1,s()}function T(e){console.error(e),t=!1,a=new Error("Stremio Core Transport initialization failed",{cause:e}),n=!1,s(),r=null}function s(){E.emit("stateChanged")}Object.defineProperties(this,{active:{configurable:!1,enumerable:!0,get:function(){return t}},error:{configurable:!1,enumerable:!0,get:function(){return a}},starting:{configurable:!1,enumerable:!0,get:function(){return n}},transport:{configurable:!1,enumerable:!0,get:function(){return r}}}),this.start=function(){t||a instanceof Error||n||(n=!0,(r=new o(e)).on("init",_),r.on("error",T),s())},this.stop=function(){t=!1,a=null,n=!1,s(),null!==r&&(r.removeAllListeners(),r=null)},this.on=function(e,t){E.on(e,t)},this.off=function(e,t){E.off(e,t)}}},68571:(e,t,a)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(){"use strict";o=function(){return t};var e,t={},a=Object.prototype,n=a.hasOwnProperty,r=Object.defineProperty||function(e,t,a){e[t]=a.value},E="function"==typeof Symbol?Symbol:{},_=E.iterator||"@@iterator",T=E.asyncIterator||"@@asyncIterator",s=E.toStringTag||"@@toStringTag";function S(e,t,a){return Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{S({},"")}catch(e){S=function(e,t,a){return e[t]=a}}function l(e,t,a,i){var o=t&&t.prototype instanceof R?t:R,n=Object.create(o.prototype),E=new M(i||[]);return r(n,"_invoke",{value:P(e,a,E)}),n}function I(e,t,a){try{return{type:"normal",arg:e.call(t,a)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var u="suspendedStart",A="suspendedYield",d="executing",O="completed",c={};function R(){}function N(){}function m(){}var L={};S(L,_,(function(){return this}));var D=Object.getPrototypeOf,p=D&&D(D(W([])));p&&p!==a&&n.call(p,_)&&(L=p);var h=m.prototype=R.prototype=Object.create(L);function C(e){["next","throw","return"].forEach((function(t){S(e,t,(function(e){return this._invoke(t,e)}))}))}function f(e,t){function a(o,r,E,_){var T=I(e[o],e,r);if("throw"!==T.type){var s=T.arg,S=s.value;return S&&"object"==i(S)&&n.call(S,"__await")?t.resolve(S.__await).then((function(e){a("next",e,E,_)}),(function(e){a("throw",e,E,_)})):t.resolve(S).then((function(e){s.value=e,E(s)}),(function(e){return a("throw",e,E,_)}))}_(T.arg)}var o;r(this,"_invoke",{value:function(e,i){function n(){return new t((function(t,o){a(e,i,t,o)}))}return o=o?o.then(n,n):n()}})}function P(t,a,i){var o=u;return function(n,r){if(o===d)throw Error("Generator is already running");if(o===O){if("throw"===n)throw r;return{value:e,done:!0}}for(i.method=n,i.arg=r;;){var E=i.delegate;if(E){var _=B(E,i);if(_){if(_===c)continue;return _}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(o===u)throw o=O,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);o=d;var T=I(t,a,i);if("normal"===T.type){if(o=i.done?O:A,T.arg===c)continue;return{value:T.arg,done:i.done}}"throw"===T.type&&(o=O,i.method="throw",i.arg=T.arg)}}}function B(t,a){var i=a.method,o=t.iterator[i];if(o===e)return a.delegate=null,"throw"===i&&t.iterator.return&&(a.method="return",a.arg=e,B(t,a),"throw"===a.method)||"return"!==i&&(a.method="throw",a.arg=new TypeError("The iterator does not provide a '"+i+"' method")),c;var n=I(o,t.iterator,a.arg);if("throw"===n.type)return a.method="throw",a.arg=n.arg,a.delegate=null,c;var r=n.arg;return r?r.done?(a[t.resultName]=r.value,a.next=t.nextLoc,"return"!==a.method&&(a.method="next",a.arg=e),a.delegate=null,c):r:(a.method="throw",a.arg=new TypeError("iterator result is not an object"),a.delegate=null,c)}function g(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function v(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function M(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(g,this),this.reset(!0)}function W(t){if(t||""===t){var a=t[_];if(a)return a.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,r=function a(){for(;++o=0;--o){var r=this.tryEntries[o],E=r.completion;if("root"===r.tryLoc)return i("end");if(r.tryLoc<=this.prev){var _=n.call(r,"catchLoc"),T=n.call(r,"finallyLoc");if(_&&T){if(this.prev=0;--a){var i=this.tryEntries[a];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--t){var a=this.tryEntries[t];if(a.finallyLoc===e)return this.complete(a.completion,a.afterLoc),v(a),c}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var a=this.tryEntries[t];if(a.tryLoc===e){var i=a.completion;if("throw"===i.type){var o=i.arg;v(a)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,a,i){return this.delegate={iterator:W(t),resultName:a,nextLoc:i},"next"===this.method&&(this.arg=e),c}},t}function n(e,t,a,i,o,n,r){try{var E=e[n](r),_=E.value}catch(e){return void a(e)}E.done?t(_):Promise.resolve(_).then(i,o)}function r(e){return function(){var t=this,a=arguments;return new Promise((function(i,o){var r=e.apply(t,a);function E(e){n(r,i,o,E,_,"next",e)}function _(e){n(r,i,o,E,_,"throw",e)}E(void 0)}))}}var E=a(30228),_=a(72888);e.exports=function(e){var t=new E,a=new Worker("".concat("865907b7ae01152409fb81a58ef89d7c9c75c046","/scripts/worker.js")),i=new _(window,a);window.onCoreEvent=function(e){var a=e.name,i=e.args;try{t.emit(a,i)}catch(e){console.error("CoreTransport",e)}},i.call(["init"],[e]).then((function(){try{t.emit("init")}catch(e){console.error("CoreTransport",e)}})).catch((function(e){t.emit("error",e)})),this.on=function(e,a){t.on(e,a)},this.off=function(e,a){t.off(e,a)},this.removeAllListeners=function(){t.removeAllListeners()},this.getState=(function(){var e=r(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",i.call(["getState"],[t]));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}})(),this.getDebugState=r(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",i.call(["getDebugState"],[]));case 1:case"end":return e.stop()}}),e)}))),this.dispatch=(function(){var e=r(o().mark((function e(t,a){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",i.call(["dispatch"],[t,a,location.hash]));case 1:case"end":return e.stop()}}),e)})));return function(t,a){return e.apply(this,arguments)}})(),this.analytics=(function(){var e=r(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",i.call(["analytics"],[t,location.hash]));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}})(),this.decodeStream=(function(){var e=r(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",i.call(["decodeStream"],[t]));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}})()}},33747:(e,t,a)=>{var i=a(1948);e.exports=i},10664:(e,t,a)=>{function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function o(){"use strict";o=function(){return t};var e,t={},a=Object.prototype,n=a.hasOwnProperty,r=Object.defineProperty||function(e,t,a){e[t]=a.value},E="function"==typeof Symbol?Symbol:{},_=E.iterator||"@@iterator",T=E.asyncIterator||"@@asyncIterator",s=E.toStringTag||"@@toStringTag";function S(e,t,a){return Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{S({},"")}catch(e){S=function(e,t,a){return e[t]=a}}function l(e,t,a,i){var o=t&&t.prototype instanceof R?t:R,n=Object.create(o.prototype),E=new M(i||[]);return r(n,"_invoke",{value:P(e,a,E)}),n}function I(e,t,a){try{return{type:"normal",arg:e.call(t,a)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var u="suspendedStart",A="suspendedYield",d="executing",O="completed",c={};function R(){}function N(){}function m(){}var L={};S(L,_,(function(){return this}));var D=Object.getPrototypeOf,p=D&&D(D(W([])));p&&p!==a&&n.call(p,_)&&(L=p);var h=m.prototype=R.prototype=Object.create(L);function C(e){["next","throw","return"].forEach((function(t){S(e,t,(function(e){return this._invoke(t,e)}))}))}function f(e,t){function a(o,r,E,_){var T=I(e[o],e,r);if("throw"!==T.type){var s=T.arg,S=s.value;return S&&"object"==i(S)&&n.call(S,"__await")?t.resolve(S.__await).then((function(e){a("next",e,E,_)}),(function(e){a("throw",e,E,_)})):t.resolve(S).then((function(e){s.value=e,E(s)}),(function(e){return a("throw",e,E,_)}))}_(T.arg)}var o;r(this,"_invoke",{value:function(e,i){function n(){return new t((function(t,o){a(e,i,t,o)}))}return o=o?o.then(n,n):n()}})}function P(t,a,i){var o=u;return function(n,r){if(o===d)throw Error("Generator is already running");if(o===O){if("throw"===n)throw r;return{value:e,done:!0}}for(i.method=n,i.arg=r;;){var E=i.delegate;if(E){var _=B(E,i);if(_){if(_===c)continue;return _}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(o===u)throw o=O,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);o=d;var T=I(t,a,i);if("normal"===T.type){if(o=i.done?O:A,T.arg===c)continue;return{value:T.arg,done:i.done}}"throw"===T.type&&(o=O,i.method="throw",i.arg=T.arg)}}}function B(t,a){var i=a.method,o=t.iterator[i];if(o===e)return a.delegate=null,"throw"===i&&t.iterator.return&&(a.method="return",a.arg=e,B(t,a),"throw"===a.method)||"return"!==i&&(a.method="throw",a.arg=new TypeError("The iterator does not provide a '"+i+"' method")),c;var n=I(o,t.iterator,a.arg);if("throw"===n.type)return a.method="throw",a.arg=n.arg,a.delegate=null,c;var r=n.arg;return r?r.done?(a[t.resultName]=r.value,a.next=t.nextLoc,"return"!==a.method&&(a.method="next",a.arg=e),a.delegate=null,c):r:(a.method="throw",a.arg=new TypeError("iterator result is not an object"),a.delegate=null,c)}function g(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function v(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function M(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(g,this),this.reset(!0)}function W(t){if(t||""===t){var a=t[_];if(a)return a.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,r=function a(){for(;++o=0;--o){var r=this.tryEntries[o],E=r.completion;if("root"===r.tryLoc)return i("end");if(r.tryLoc<=this.prev){var _=n.call(r,"catchLoc"),T=n.call(r,"finallyLoc");if(_&&T){if(this.prev=0;--a){var i=this.tryEntries[a];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--t){var a=this.tryEntries[t];if(a.finallyLoc===e)return this.complete(a.completion,a.afterLoc),v(a),c}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var a=this.tryEntries[t];if(a.tryLoc===e){var i=a.completion;if("throw"===i.type){var o=i.arg;v(a)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,a,i){return this.delegate={iterator:W(t),resultName:a,nextLoc:i},"next"===this.method&&(this.arg=e),c}},t}function n(e,t,a,i,o,n,r){try{var E=e[n](r),_=E.value}catch(e){return void a(e)}E.done?t(_):Promise.resolve(_).then(i,o)}var r=a(30228);e.exports=function(e){var t=e.core,a=!1,i=new r;function E(e){e.preventDefault()}function _(e){return T.apply(this,arguments)}function T(){var e;return e=o().mark((function e(a){var n,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a.preventDefault(),!(a.dataTransfer.files instanceof FileList&&a.dataTransfer.files.length>0)){e.next=18;break}n=a.dataTransfer.files[0],e.t0=n.type,e.next="application/x-bittorrent"===e.t0?6:17;break;case 6:return e.prev=6,e.next=9,n.arrayBuffer();case 9:r=e.sent,t.transport.dispatch({action:"StreamingServer",args:{action:"CreateTorrent",args:Array.from(new Uint8Array(r))}}),e.next=16;break;case 13:e.prev=13,e.t1=e.catch(6),i.emit("error",{message:"Failed to process file",file:{name:n.name,type:n.type}});case 16:return e.abrupt("break",18);case 17:i.emit("error",{message:"Unsupported file",file:{name:n.name,type:n.type}});case 18:case"end":return e.stop()}}),e,null,[[6,13]])})),T=function(){var t=this,a=arguments;return new Promise((function(i,o){var r=e.apply(t,a);function E(e){n(r,i,o,E,_,"next",e)}function _(e){n(r,i,o,E,_,"throw",e)}E(void 0)}))},T.apply(this,arguments)}function s(){i.emit("stateChanged")}Object.defineProperties(this,{active:{configurable:!1,enumerable:!0,get:function(){return a}}}),this.start=function(){a||(window.addEventListener("dragover",E),window.addEventListener("drop",_),a=!0,s())},this.stop=function(){window.removeEventListener("dragover",E),window.removeEventListener("drop",_),a=!1,s()},this.on=function(e,t){i.on(e,t)},this.off=function(e,t){i.off(e,t)}}},270:(e,t,a)=>{var i=a(10664);e.exports=i},40364:(e,t,a)=>{var i=a(30228);e.exports=function(){var e=!1,t=new i;function a(e){if(!(e.keyboardShortcutPrevented||"INPUT"===e.target.tagName||e.ctrlKey||e.altKey||e.shiftKey||e.metaKey))switch(e.code){case"Digit0":e.preventDefault(),window.location="#/search";break;case"Digit1":e.preventDefault(),window.location="#/";break;case"Digit2":e.preventDefault(),window.location="#/discover";break;case"Digit3":e.preventDefault(),window.location="#/library";break;case"Digit4":e.preventDefault(),window.location="#/calendar";break;case"Digit5":e.preventDefault(),window.location="#/addons";break;case"Digit6":e.preventDefault(),window.location="#/settings";break;case"Backspace":e.preventDefault(),e.ctrlKey?window.history.forward():window.history.back();break;case"KeyF":e.preventDefault(),document.fullscreenElement===document.documentElement?document.exitFullscreen():document.documentElement.requestFullscreen()}}function o(){t.emit("stateChanged")}Object.defineProperties(this,{active:{configurable:!1,enumerable:!0,get:function(){return e}}}),this.start=function(){e||(window.addEventListener("keydown",a),e=!0,o())},this.stop=function(){window.removeEventListener("keydown",a),e=!1,o()}}},80400:(e,t,a)=>{var i=a(40364);e.exports=i},86508:(e,t,a)=>{var i=a(96540).createContext({});i.displayName="ServicesContext",e.exports=i},67042:(e,t,a)=>{var i=a(96540),o=a(5556),n=a(86508),r=function(e){var t=e.services,a=void 0===t?{}:t,o=e.children;return i.createElement(n.Provider,{value:a},o)};r.propTypes={services:o.object,children:o.oneOfType([o.arrayOf(o.node),o.node])},e.exports=r},59063:(e,t,a)=>{var i=a(67042),o=a(39776);e.exports={ServicesProvider:i,useServices:o}},39776:(e,t,a)=>{var i=a(96540),o=a(86508);e.exports=function(){return i.useContext(o)}},78160:(e,t,a)=>{var i=a(30228),o=a(91671);e.exports=function(){var e=!1,t=null,a=!1,n=null,r=new i;function E(){e=!0,t=null,a=!1,T()}function _(i){console.error(i),e=!1,t=new Error(i),a=!1,T(),n=null}function T(){r.emit("stateChanged")}Object.defineProperties(this,{active:{configurable:!1,enumerable:!0,get:function(){return e}},error:{configurable:!1,enumerable:!0,get:function(){return t}},starting:{configurable:!1,enumerable:!0,get:function(){return a}},transport:{configurable:!1,enumerable:!0,get:function(){return n}}}),this.start=function(){e||t instanceof Error||a||(e=!1,a=!0,(n=new o).on("init",E),n.on("init-error",_),T())},this.stop=function(){e=!1,t=null,a=!1,T()},this.on=function(e,t){r.on(e,t)},this.off=function(e,t){r.off(e,t)}}},91671:(e,t,a)=>{var i=a(30228),o=!1,n=new i,r=1,E=3,_=6,T=7,s="transport";window.initShellComm=function(){delete window.initShellComm,n.emit("availabilityChanged")};e.exports=function(){var e=new i;this.props={};var t=this;(window.qt?new Promise((function(e){function t(){n.off("availabilityChanged",t),o=!0,e()}o?t():n.on("availabilityChanged",t)})):Promise.reject("Qt API not found")).then((function(){var a=window.qt&&window.qt.webChannelTransport;if(!a)throw"no viable transport found (qt.webChannelTransport)";var i=0;function o(e){e.id=i++,a.send(JSON.stringify(e))}a.onmessage=function(a){var i=JSON.parse(a.data);if(0===i.id){var n=i.data[s];n.properties.slice(1).forEach((function(e){t.props[e[1]]=e[3]})),"string"==typeof t.props.shellVersion&&(t.shellVersionArr=(t.props.shellVersion.match(/(\d+)\.(\d+)\.(\d+)/)||[]).slice(1,4).map(Number)),e.emit("received-props",t.props),n.signals.forEach((function(e){o({type:T,object:s,signal:e[1]})}));var E=n.methods.filter((function(e){return"onEvent"===e[0]}))[0];t.send=function(e,t){o({type:_,object:s,method:E[1],args:[e,t||{}]})},t.send("app-ready",{})}i.object===s&&i.type===r&&e.emit(i.args[0],i.args[1]),e.emit("init")},o({type:E})})).catch((function(t){e.emit("init-error",t)})),this.on=function(t,a){e.on(t,a)},this.off=function(t,a){e.off(t,a)},this.removeAllListeners=function(){e.removeAllListeners()}}},37934:(e,t,a)=>{var i=a(78160);e.exports=i},40851:(e,t,a)=>{var i=a(75969),o=a(33747),n=a(270),r=a(80400),E=a(59063),_=E.ServicesProvider,T=E.useServices,s=a(37934);e.exports={Chromecast:i,Core:o,DragAndDrop:n,KeyboardShortcuts:r,ServicesProvider:_,useServices:T,Shell:s}},67526:(e,t)=>{"use strict";t.byteLength=function(e){var t=E(e),a=t[0],i=t[1];return 3*(a+i)/4-i},t.toByteArray=function(e){var t,a,n=E(e),r=n[0],_=n[1],T=new o((function(e,t,a){return 3*(t+a)/4-a})(0,r,_)),s=0,S=_>0?r-4:r;for(a=0;a>16&255,T[s++]=t>>8&255,T[s++]=255&t;2===_&&(t=i[e.charCodeAt(a)]<<2|i[e.charCodeAt(a+1)]>>4,T[s++]=255&t);1===_&&(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,n=[],r=16383,E=0,T=i-o;ET?T:E+r));1===o?(t=e[i-1],n.push(a[t>>2]+a[t<<4&63]+"==")):2===o&&(t=(e[i-2]<<8)+e[i-1],n.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return n.join("")};for(var a=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0;r<64;++r)a[r]=n[r],i[n.charCodeAt(r)]=r;function E(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 _(e,t,i){for(var o,n,r=[],E=t;E>18&63]+a[n>>12&63]+a[n>>6&63]+a[63&n]);return r.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},13960: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]}`))}},46880: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),n=e.getVersionPrecision(a),r=Math.max(o,n),E=0,_=e.map([t,a],(function(t){var a=r-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&&(E=r-Math.min(o,n)),r-=1;r>=E;){if(_[0][r]>_[1][r])return 1;if(_[0][r]===_[1][r]){if(r===E)return 0;r-=1}else if(_[0][r]<_[1][r])return-1}},e.map=function(e,t){var a,i=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(a=0;a1?o-1:0),r=1;r0){var r=Object.keys(a),_=E.default.find(r,(function(e){return t.isOS(e)}));if(_){var T=this.satisfies(a[_]);if(void 0!==T)return T}var s=E.default.find(r,(function(e){return t.isPlatform(e)}));if(s){var S=this.satisfies(a[s]);if(void 0!==S)return S}}if(n>0){var l=Object.keys(o),I=E.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=E.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(E.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},n=/version\/(\d+(\.?_?\d+)+)/i,r=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},a=o.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||o.default.getFirstMatch(n,e);return a&&(t.version=a),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},a=o.default.getFirstMatch(n,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(n,e);return a&&(t.version=a),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},a=o.default.getFirstMatch(n,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(n,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(n,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(n,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(n,e);return a&&(t.version=a),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},a=o.default.getFirstMatch(n,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(n,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(n,e);return a&&(t.version=a),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},a=o.default.getFirstMatch(n,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(n,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(n,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(n,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(n,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(n,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(n,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(n,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(n,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(n,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(n,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(n,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(n,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(n,e);return a&&(t.version=a),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},a=o.default.getFirstMatch(n,e);return a&&(t.version=a),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},a=o.default.getFirstMatch(n,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=r,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},n=a(18),r=[{test:[/Roku\/DVP/],describe:function(e){var t=o.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:n.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:n.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:n.OS_MAP.Windows,version:t,versionName:a}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:n.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:n.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:n.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:n.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:n.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:n.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=o.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:n.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=o.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:n.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:n.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:n.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=o.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:n.OS_MAP.PlayStation4,version:t}}}];t.default=r,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},n=a(18),r=[{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:n.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(a.model=t),a}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:n.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:n.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:n.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:n.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:n.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:n.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:n.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:n.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:n.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:n.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:n.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:n.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:n.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:n.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:n.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:n.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:n.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:n.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:n.PLATFORMS_MAP.tv}}}];t.default=r,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},n=a(18),r=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:n.ENGINE_MAP.Blink};var t=o.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:n.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:n.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:n.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:n.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:n.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:n.ENGINE_MAP.WebKit},a=o.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return a&&(t.version=a),t}}];t.default=r,e.exports=t.default}})},48287:(e,t,a)=>{"use strict";const i=a(67526),o=a(251),n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.hp=_,t.IS=50;const r=2147483647;function E(e){if(e>r)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,_.prototype),t}function _(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(!_.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const a=0|A(e,t);let i=E(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 _.from(i,t,a);const o=(function(e){if(_.isBuffer(e)){const t=0|u(e.length),a=E(t);return 0===a.length||e.copy(a,0,0,t),a}if(void 0!==e.length)return"number"!=typeof e.length||$(e.length)?E(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 _.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(e<0?0:0|u(e))}function l(e){const t=e.length<0?0:0|u(e.length),a=E(t);for(let i=0;i=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|e}function A(e,t){if(_.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 d(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 C(this,t,a);case"ascii":return P(this,t,a);case"latin1":case"binary":return B(this,t,a);case"base64":return h(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 O(e,t,a){const i=e[t];e[t]=e[a],e[a]=i}function c(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=_.from(t,i)),_.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 n,r=1,E=e.length,_=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;r=2,E/=2,_/=2,a/=2}function T(e,t){return 1===r?e[t]:e.readUInt16BE(t*r)}if(o){let i=-1;for(n=a;nE&&(a=E-_),n=a;n>=0;n--){let a=!0;for(let i=0;i<_;i++)if(T(e,n+i)!==T(t,i)){a=!1;break}if(a)return n}return-1}function N(e,t,a,i){a=Number(a)||0;const o=e.length-a;i?(i=Number(i))>o&&(i=o):i=o;const n=t.length;let r;for(i>n/2&&(i=n/2),r=0;r>8,o=a%256,n.push(o),n.push(i);return n})(t,e.length-a),e,a,i)}function h(e,t,a){return 0===t&&a===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,a))}function C(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+r<=a){let a,i,E,_;switch(r){case 1:t<128&&(n=t);break;case 2:a=e[o+1],128==(192&a)&&(_=(31&t)<<6|63&a,_>127&&(n=_));break;case 3:a=e[o+1],i=e[o+2],128==(192&a)&&128==(192&i)&&(_=(15&t)<<12|(63&a)<<6|63&i,_>2047&&(_<55296||_>57343)&&(n=_));break;case 4:a=e[o+1],i=e[o+2],E=e[o+3],128==(192&a)&&128==(192&i)&&128==(192&E)&&(_=(15&t)<<18|(63&a)<<12|(63&i)<<6|63&E,_>65535&&_<1114112&&(n=_))}}null===n?(n=65533,r=1):n>65535&&(n-=65536,i.push(n>>>10&1023|55296),n=56320|1023&n),i.push(n),o+=r}return(function(e){const t=e.length;if(t<=f)return String.fromCharCode.apply(String,e);let a="",i=0;for(;ii.length?(_.isBuffer(t)||(t=_.from(t)),t.copy(i,o)):Uint8Array.prototype.set.call(i,t,o);else{if(!_.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(i,o)}o+=t.length}return i},_.byteLength=A,_.prototype._isBuffer=!0,_.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+=" ... "),""},n&&(_.prototype[n]=_.prototype.inspect),_.prototype.compare=function(e,t,a,i,o){if(X(e,Uint8Array)&&(e=_.from(e,e.offset,e.byteLength)),!_.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 n=(o>>>=0)-(i>>>=0),r=(a>>>=0)-(t>>>=0);const E=Math.min(n,r),T=this.slice(i,o),s=e.slice(t,a);for(let e=0;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 n=!1;for(;;)switch(i){case"hex":return N(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 p(this,e,t,a);default:if(n)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),n=!0}},_.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const f=4096;function P(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,n){if(!_.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 y(e,t,a,i,o){w(t,i,o,e,a,7);let n=Number(t&BigInt(4294967295));e[a++]=n,n>>=8,e[a++]=n,n>>=8,e[a++]=n,n>>=8,e[a++]=n;let r=Number(t>>BigInt(32)&BigInt(4294967295));return e[a++]=r,r>>=8,e[a++]=r,r>>=8,e[a++]=r,r>>=8,e[a++]=r,a}function b(e,t,a,i,o){w(t,i,o,e,a,7);let n=Number(t&BigInt(4294967295));e[a+7]=n,n>>=8,e[a+6]=n,n>>=8,e[a+5]=n,n>>=8,e[a+4]=n;let r=Number(t>>BigInt(32)&BigInt(4294967295));return e[a+3]=r,r>>=8,e[a+2]=r,r>>=8,e[a+1]=r,r>>=8,e[a]=r,a+8}function U(e,t,a,i,o,n){if(a+i>e.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("Index out of range")}function G(e,t,a,i,n){return t=+t,a>>>=0,n||U(e,0,a,4),o.write(e,t,a,i,23,4),a+4}function k(e,t,a,i,n){return t=+t,a>>>=0,n||U(e,0,a,8),o.write(e,t,a,i,52,8),a+8}_.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,n=0;for(;++n>>=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},_.prototype.readUint8=_.prototype.readUInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),this[e]},_.prototype.readUint16LE=_.prototype.readUInt16LE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]|this[e+1]<<8},_.prototype.readUint16BE=_.prototype.readUInt16BE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]<<8|this[e+1]},_.prototype.readUint32LE=_.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]},_.prototype.readUint32BE=_.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])},_.prototype.readBigUInt64LE=J((function(e){Y(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,n=0;for(;++n=o&&(i-=Math.pow(2,8*t)),i},_.prototype.readIntBE=function(e,t,a){e>>>=0,t>>>=0,a||M(e,t,this.length);let i=t,o=1,n=this[e+--i];for(;i>0&&(o*=256);)n+=this[e+--i]*o;return o*=128,n>=o&&(n-=Math.pow(2,8*t)),n},_.prototype.readInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},_.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},_.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},_.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},_.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]},_.prototype.readBigInt64LE=J((function(e){Y(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)},_.prototype.readFloatBE=function(e,t){return e>>>=0,t||M(e,4,this.length),o.read(this,e,!1,23,4)},_.prototype.readDoubleLE=function(e,t){return e>>>=0,t||M(e,8,this.length),o.read(this,e,!0,52,8)},_.prototype.readDoubleBE=function(e,t){return e>>>=0,t||M(e,8,this.length),o.read(this,e,!1,52,8)},_.prototype.writeUintLE=_.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,n=0;for(this[t]=255&e;++n>>=0,a>>>=0,!i){W(this,e,t,a,Math.pow(2,8*a)-1,0)}let o=a-1,n=1;for(this[t+o]=255&e;--o>=0&&(n*=256);)this[t+o]=e/n&255;return t+a},_.prototype.writeUint8=_.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},_.prototype.writeUint16LE=_.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},_.prototype.writeUint16BE=_.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},_.prototype.writeUint32LE=_.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},_.prototype.writeUint32BE=_.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},_.prototype.writeBigUInt64LE=J((function(e,t=0){return y(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),_.prototype.writeBigUInt64BE=J((function(e,t=0){return b(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),_.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,n=1,r=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,n=1,r=0;for(this[t+o]=255&e;--o>=0&&(n*=256);)e<0&&0===r&&0!==this[t+o+1]&&(r=1),this[t+o]=(e/n|0)-r&255;return t+a},_.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},_.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},_.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},_.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},_.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},_.prototype.writeBigInt64LE=J((function(e,t=0){return y(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),_.prototype.writeBigInt64BE=J((function(e,t=0){return b(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),_.prototype.writeFloatLE=function(e,t,a){return G(this,e,t,!0,a)},_.prototype.writeFloatBE=function(e,t,a){return G(this,e,t,!1,a)},_.prototype.writeDoubleLE=function(e,t,a){return k(this,e,t,!0,a)},_.prototype.writeDoubleBE=function(e,t,a){return k(this,e,t,!1,a)},_.prototype.copy=function(e,t,a,i){if(!_.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 w(e,t,a,i,o,n){if(e>a||e3?0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(n+1)}${i}`:`>= -(2${i} ** ${8*(n+1)-1}${i}) and < 2 ** ${8*(n+1)-1}${i}`:`>= ${t}${i} and <= ${a}${i}`,new F.ERR_OUT_OF_RANGE("value",o,e)}!(function(e,t,a){Y(t,"offset"),void 0!==e[t]&&void 0!==e[t+a]||z(t,e.length-(a+1))})(i,o,n)}function Y(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 Y(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 n=[];for(let r=0;r55295&&a<57344){if(!o){if(a>56319){(t-=3)>-1&&n.push(239,191,189);continue}if(r+1===i){(t-=3)>-1&&n.push(239,191,189);continue}o=a;continue}if(a<56320){(t-=3)>-1&&n.push(239,191,189),o=a;continue}a=65536+(o-55296<<10|a-56320)}else o&&(t-=3)>-1&&n.push(239,191,189);if(o=null,a<128){if((t-=1)<0)break;n.push(a)}else if(a<2048){if((t-=2)<0)break;n.push(a>>6|192,63&a|128)}else if(a<65536){if((t-=3)<0)break;n.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;n.push(a>>18|240,a>>12&63|128,a>>6&63|128,63&a|128)}}return n}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")}},38075:(e,t,a)=>{"use strict";var i=a(70453),o=a(10487),n=o(i("String.prototype.indexOf"));e.exports=function(e,t){var a=i(e,!!t);return"function"==typeof a&&n(e,".prototype.")>-1?o(a):a}},10487:(e,t,a)=>{"use strict";var i=a(66743),o=a(70453),n=a(96897),r=a(69675),E=o("%Function.prototype.apply%"),_=o("%Function.prototype.call%"),T=o("%Reflect.apply%",!0)||i.call(_,E),s=a(30655),S=o("%Math.max%");e.exports=function(e){if("function"!=typeof e)throw new r("a function is required");var t=T(i,_,arguments);return n(t,1+S(0,e.length-(arguments.length-1)),!0)};var l=function(){return T(i,E,arguments)};s?s(e.exports,"apply",{value:l}):e.exports.apply=l},15659:(e,t,a)=>{const i=a(8156),o={};for(const e of Object.keys(i))o[i[e]]=e;const n={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=n;for(const e of Object.keys(n)){if(!("channels"in n[e]))throw new Error("missing channels property: "+e);if(!("labels"in n[e]))throw new Error("missing channel labels property: "+e);if(n[e].labels.length!==n[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:t,labels:a}=n[e];delete n[e].channels,delete n[e].labels,Object.defineProperty(n[e],"channels",{value:t}),Object.defineProperty(n[e],"labels",{value:a})}n.rgb.hsl=function(e){const t=e[0]/255,a=e[1]/255,i=e[2]/255,o=Math.min(t,a,i),n=Math.max(t,a,i),r=n-o;let E,_;n===o?E=0:t===n?E=(a-i)/r:a===n?E=2+(i-t)/r:i===n&&(E=4+(t-a)/r),E=Math.min(60*E,360),E<0&&(E+=360);const T=(o+n)/2;return _=n===o?0:T<=.5?r/(n+o):r/(2-n-o),[E,100*_,100*T]},n.rgb.hsv=function(e){let t,a,i,o,n;const r=e[0]/255,E=e[1]/255,_=e[2]/255,T=Math.max(r,E,_),s=T-Math.min(r,E,_),S=function(e){return(T-e)/6/s+.5};return 0===s?(o=0,n=0):(n=s/T,t=S(r),a=S(E),i=S(_),r===T?o=i-a:E===T?o=1/3+t-i:_===T&&(o=2/3+a-t),o<0?o+=1:o>1&&(o-=1)),[360*o,100*n,100*T]},n.rgb.hwb=function(e){const t=e[0],a=e[1];let i=e[2];const o=n.rgb.hsl(e)[0],r=1/255*Math.min(t,Math.min(a,i));return i=1-1/255*Math.max(t,Math.max(a,i)),[o,100*r,100*i]},n.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]},n.rgb.keyword=function(e){const t=o[e];if(t)return t;let a,n=1/0;for(const t of Object.keys(i)){const o=i[t],_=(E=o,((r=e)[0]-E[0])**2+(r[1]-E[1])**2+(r[2]-E[2])**2);_.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)]},n.rgb.lab=function(e){const t=n.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)]},n.hsl.rgb=function(e){const t=e[0]/360,a=e[1]/100,i=e[2]/100;let o,n,r;if(0===a)return r=255*i,[r,r,r];o=i<.5?i*(1+a):i+a-i*a;const E=2*i-o,_=[0,0,0];for(let e=0;e<3;e++)n=t+1/3*-(e-1),n<0&&n++,n>1&&n--,r=6*n<1?E+6*(o-E)*n:2*n<1?o:3*n<2?E+(o-E)*(2/3-n)*6:E,_[e]=255*r;return _},n.hsl.hsv=function(e){const t=e[0];let a=e[1]/100,i=e[2]/100,o=a;const n=Math.max(i,.01);i*=2,a*=i<=1?i:2-i,o*=n<=1?n:2-n;return[t,100*(0===i?2*o/(n+o):2*a/(i+a)),100*((i+a)/2)]},n.hsv.rgb=function(e){const t=e[0]/60,a=e[1]/100;let i=e[2]/100;const o=Math.floor(t)%6,n=t-Math.floor(t),r=255*i*(1-a),E=255*i*(1-a*n),_=255*i*(1-a*(1-n));switch(i*=255,o){case 0:return[i,_,r];case 1:return[E,i,r];case 2:return[r,i,_];case 3:return[r,E,i];case 4:return[_,r,i];case 5:return[i,r,E]}},n.hsv.hsl=function(e){const t=e[0],a=e[1]/100,i=e[2]/100,o=Math.max(i,.01);let n,r;r=(2-a)*i;const E=(2-a)*o;return n=a*o,n/=E<=1?E:2-E,n=n||0,r/=2,[t,100*n,100*r]},n.hwb.rgb=function(e){const t=e[0]/360;let a=e[1]/100,i=e[2]/100;const o=a+i;let n;o>1&&(a/=o,i/=o);const r=Math.floor(6*t),E=1-i;n=6*t-r,1&r&&(n=1-n);const _=a+n*(E-a);let T,s,S;switch(r){default:case 6:case 0:T=E,s=_,S=a;break;case 1:T=_,s=E,S=a;break;case 2:T=a,s=E,S=_;break;case 3:T=a,s=_,S=E;break;case 4:T=_,s=a,S=E;break;case 5:T=E,s=a,S=_}return[255*T,255*s,255*S]},n.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))]},n.xyz.rgb=function(e){const t=e[0]/100,a=e[1]/100,i=e[2]/100;let o,n,r;return o=3.2406*t+-1.5372*a+-.4986*i,n=-.9689*t+1.8758*a+.0415*i,r=.0557*t+-.204*a+1.057*i,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,n=n>.0031308?1.055*n**(1/2.4)-.055:12.92*n,r=r>.0031308?1.055*r**(1/2.4)-.055:12.92*r,o=Math.min(Math.max(0,o),1),n=Math.min(Math.max(0,n),1),r=Math.min(Math.max(0,r),1),[255*o,255*n,255*r]},n.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)]},n.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,n=t**3,r=i**3;return a=o>.008856?o:(a-16/116)/7.787,t=n>.008856?n:(t-16/116)/7.787,i=r>.008856?r:(i-16/116)/7.787,t*=95.047,a*=100,i*=108.883,[t,a,i]},n.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]},n.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)]},n.rgb.ansi16=function(e,t=null){const[a,i,o]=e;let r=null===t?n.rgb.hsv(e)[2]:t;if(r=Math.round(r/50),0===r)return 30;let E=30+(Math.round(o/255)<<2|Math.round(i/255)<<1|Math.round(a/255));return 2===r&&(E+=60),E},n.hsv.ansi16=function(e){return n.rgb.ansi16(n.hsv.rgb(e),e[2])},n.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)},n.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]},n.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]},n.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},n.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]},n.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),n=Math.min(Math.min(t,a),i),r=o-n;let E,_;return E=r<1?n/(1-r):0,_=r<=0?0:o===t?(a-i)/r%6:o===a?2+(i-t)/r:4+(t-a)/r,_/=6,_%=1,[360*_,100*r,100*E]},n.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]},n.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]},n.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],n=t%1*6,r=n%1,E=1-r;let _=0;switch(Math.floor(n)){case 0:o[0]=1,o[1]=r,o[2]=0;break;case 1:o[0]=E,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=r;break;case 3:o[0]=0,o[1]=E,o[2]=1;break;case 4:o[0]=r,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=E}return _=(1-a)*i,[255*(a*o[0]+_),255*(a*o[1]+_),255*(a*o[2]+_)]},n.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]},n.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]},n.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)]},n.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]},n.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},n.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},n.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},n.gray.hsl=function(e){return[0,0,e[0]]},n.gray.hsv=n.gray.hsl,n.gray.hwb=function(e){return[0,100,e[0]]},n.gray.cmyk=function(e){return[0,0,0,e[0]]},n.gray.lab=function(e){return[e[0],0,0]},n.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},n.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]}},10734:(e,t,a)=>{const i=a(15659),o=a(8507),n={};Object.keys(i).forEach((e=>{n[e]={},Object.defineProperty(n[e],"channels",{value:i[e].channels}),Object.defineProperty(n[e],"labels",{value:i[e].labels});const t=o(e);Object.keys(t).forEach((a=>{const i=t[a];n[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=n},8507:(e,t,a)=>{const i=a(15659);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]}},28854:(e,t,a)=>{var i=a(8156),o=a(19872),n=Object.hasOwnProperty,r=Object.create(null);for(var E in i)n.call(i,E)&&(r[i[E]]=E);var _=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}_.get=function(e){var t,a;switch(e.substring(0,3).toLowerCase()){case"hsl":t=_.get.hsl(e),a="hsl";break;case"hwb":t=_.get.hwb(e),a="hwb";break;default:t=_.get.rgb(e),a="rgb"}return t?{model:a,value:t}:null},_.get.rgb=function(e){if(!e)return null;var t,a,o,r=[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 E=2*a;r[a]=parseInt(t.slice(E,E+2),16)}o&&(r[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++)r[a]=parseInt(t[a]+t[a],16);o&&(r[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++)r[a]=parseInt(t[a+1],0);t[4]&&(t[5]?r[3]=.01*parseFloat(t[4]):r[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]:n.call(i,t[1])?((r=i[t[1]])[3]=1,r):null:null;for(a=0;a<3;a++)r[a]=Math.round(2.55*parseFloat(t[a+1]));t[4]&&(t[5]?r[3]=.01*parseFloat(t[4]):r[3]=parseFloat(t[4]))}for(a=0;a<3;a++)r[a]=T(r[a],0,255);return r[3]=T(r[3],0,1),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},_.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},_.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])):"")},_.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]+")"},_.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]+")"},_.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]+")"},_.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+")"},_.to.keyword=function(e){return r[e.slice(0,3)]}},2520:(e,t,a)=>{const i=a(28854),o=a(10734),n=["keyword","gray","hex"],r={};for(const e of Object.keys(o))r[[...o[e].labels].sort().join("")]=e;const E={};function _(e,t){if(!(this instanceof _))return new _(e,t);if(t&&t in n&&(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 _)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 r))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=r[i];const{labels:n}=o[this.model],E=[];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 _(e):o[this.model].keyword(this.color)},hex(e){return void 0!==e?new _(e):i.to.hex(this.rgb().round().color)},hexa(e){if(void 0!==e)return new _(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 _.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,n=2*o-1,r=a.alpha()-i.alpha(),E=((n*r==-1?n:(n+r)/(1+n*r))+1)/2,T=1-E;return _.rgb(E*a.red()+T*i.red(),E*a.green()+T*i.green(),E*a.blue()+T*i.blue(),a.alpha()*o+i.alpha()*(1-o))}};for(const e of Object.keys(o)){if(n.includes(e))continue;const{channels:t}=o[e];_.prototype[e]=function(...t){return this.model===e?new _(this):t.length>0?new _(t,e):new _([...(a=o[this.model][e].raw(this.color),Array.isArray(a)?a:[a]),this.valpha],e);var a},_[e]=function(...a){let i=a[0];return"number"==typeof i&&(i=l(a,t)),new _(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)(E[i]||(E[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}},30041:(e,t,a)=>{"use strict";var i=a(30655),o=a(58068),n=a(69675),r=a(75795);e.exports=function(e,t,a){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new n("`obj` must be an object or a function`");if("string"!=typeof t&&"symbol"!=typeof t)throw new n("`property` must be a string or a symbol`");if(arguments.length>3&&"boolean"!=typeof arguments[3]&&null!==arguments[3])throw new n("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&"boolean"!=typeof arguments[4]&&null!==arguments[4])throw new n("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&"boolean"!=typeof arguments[5]&&null!==arguments[5])throw new n("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&"boolean"!=typeof arguments[6])throw new n("`loose`, if provided, must be a boolean");var E=arguments.length>3?arguments[3]:null,_=arguments.length>4?arguments[4]:null,T=arguments.length>5?arguments[5]:null,s=arguments.length>6&&arguments[6],S=!!r&&r(e,t);if(i)i(e,t,{configurable:null===T&&S?S.configurable:!T,enumerable:null===E&&S?S.enumerable:!E,value:a,writable:null===_&&S?S.writable:!_});else{if(!s&&(E||_||T))throw new o("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");e[t]=a}}},30655:(e,t,a)=>{"use strict";var i=a(70453)("%Object.defineProperty%",!0)||!1;if(i)try{i({},"a",{value:1})}catch(e){i=!1}e.exports=i},41237:e=>{"use strict";e.exports=EvalError},69383:e=>{"use strict";e.exports=Error},79290:e=>{"use strict";e.exports=RangeError},79538:e=>{"use strict";e.exports=ReferenceError},58068:e=>{"use strict";e.exports=SyntaxError},69675:e=>{"use strict";e.exports=TypeError},35345:e=>{"use strict";e.exports=URIError},30228: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 n(e,t,i,n,r){if("function"!=typeof i)throw new TypeError("The listener must be a function");var E=new o(i,n||e,r),_=a?a+t:t;return e._events[_]?e._events[_].fn?e._events[_]=[e._events[_],E]:e._events[_].push(E):(e._events[_]=E,e._eventsCount++),e}function r(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function E(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(a=!1)),E.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},E.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,n=i.length,r=new Array(n);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)}},89353: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(89353);e.exports=Function.prototype.bind||i},70453:(e,t,a)=>{"use strict";var i,o=a(69383),n=a(41237),r=a(79290),E=a(79538),_=a(58068),T=a(69675),s=a(35345),S=Function,l=function(e){try{return S('"use strict"; return ('+e+").constructor;")()}catch(e){}},I=Object.getOwnPropertyDescriptor;if(I)try{I({},"")}catch(e){I=null}var u=function(){throw new T},A=I?(function(){try{return u}catch(e){try{return I(arguments,"callee").get}catch(e){return u}}})():u,d=a(64039)(),O=a(80024)(),c=Object.getPrototypeOf||(O?function(e){return e.__proto__}:null),R={},N="undefined"!=typeof Uint8Array&&c?c(Uint8Array):i,m={__proto__:null,"%AggregateError%":"undefined"==typeof AggregateError?i:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?i:ArrayBuffer,"%ArrayIteratorPrototype%":d&&c?c([][Symbol.iterator]()):i,"%AsyncFromSyncIteratorPrototype%":i,"%AsyncFunction%":R,"%AsyncGenerator%":R,"%AsyncGeneratorFunction%":R,"%AsyncIteratorPrototype%":R,"%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%":o,"%eval%":eval,"%EvalError%":n,"%Float32Array%":"undefined"==typeof Float32Array?i:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?i:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?i:FinalizationRegistry,"%Function%":S,"%GeneratorFunction%":R,"%Int8Array%":"undefined"==typeof Int8Array?i:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?i:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?i:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":d&&c?c(c([][Symbol.iterator]())):i,"%JSON%":"object"==typeof JSON?JSON:i,"%Map%":"undefined"==typeof Map?i:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&d&&c?c((new Map)[Symbol.iterator]()):i,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?i:Promise,"%Proxy%":"undefined"==typeof Proxy?i:Proxy,"%RangeError%":r,"%ReferenceError%":E,"%Reflect%":"undefined"==typeof Reflect?i:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?i:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&d&&c?c((new Set)[Symbol.iterator]()):i,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?i:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":d&&c?c(""[Symbol.iterator]()):i,"%Symbol%":d?Symbol:i,"%SyntaxError%":_,"%ThrowTypeError%":A,"%TypedArray%":N,"%TypeError%":T,"%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};if(c)try{null.error}catch(e){var L=c(c(e));m["%Error.prototype%"]=L}var D=function e(t){var a;if("%AsyncFunction%"===t)a=l("async function () {}");else if("%GeneratorFunction%"===t)a=l("function* () {}");else if("%AsyncGeneratorFunction%"===t)a=l("async function* () {}");else if("%AsyncGenerator%"===t){var i=e("%AsyncGeneratorFunction%");i&&(a=i.prototype)}else if("%AsyncIteratorPrototype%"===t){var o=e("%AsyncGenerator%");o&&c&&(a=c(o.prototype))}return m[t]=a,a},p={__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"]},h=a(66743),C=a(9957),f=h.call(Function.call,Array.prototype.concat),P=h.call(Function.apply,Array.prototype.splice),B=h.call(Function.call,String.prototype.replace),g=h.call(Function.call,String.prototype.slice),v=h.call(Function.call,RegExp.prototype.exec),M=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,W=/\\(\\)?/g,y=function(e,t){var a,i=e;if(C(p,i)&&(i="%"+(a=p[i])[0]+"%"),C(m,i)){var o=m[i];if(o===R&&(o=D(i)),void 0===o&&!t)throw new T("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:a,name:i,value:o}}throw new _("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new T("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new T('"allowMissing" argument must be a boolean');if(null===v(/^%?[^%]*%?$/,e))throw new _("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var a=(function(e){var t=g(e,0,1),a=g(e,-1);if("%"===t&&"%"!==a)throw new _("invalid intrinsic syntax, expected closing `%`");if("%"===a&&"%"!==t)throw new _("invalid intrinsic syntax, expected opening `%`");var i=[];return B(e,M,(function(e,t,a,o){i[i.length]=a?B(o,W,"$1"):t||e})),i})(e),i=a.length>0?a[0]:"",o=y("%"+i+"%",t),n=o.name,r=o.value,E=!1,s=o.alias;s&&(i=s[0],P(a,f([0,1],s)));for(var S=1,l=!0;S=a.length){var O=I(r,u);r=(l=!!O)&&"get"in O&&!("originalValue"in O.get)?O.get:r[u]}else l=C(r,u),r=r[u];l&&!E&&(m[n]=r)}}return r}},75795:(e,t,a)=>{"use strict";var i=a(70453)("%Object.getOwnPropertyDescriptor%",!0);if(i)try{i([],"length")}catch(e){i=null}e.exports=i},30592:(e,t,a)=>{"use strict";var i=a(30655),o=function(){return!!i};o.hasArrayLengthDefineBug=function(){if(!i)return null;try{return 1!==i([],"length",{value:1}).length}catch(e){return!0}},e.exports=o},80024:e=>{"use strict";var t={__proto__:null,foo:{}},a=Object;e.exports=function(){return{__proto__:t}.foo===t.foo&&!(t instanceof a)}},64039:(e,t,a)=>{"use strict";var i="undefined"!=typeof Symbol&&Symbol,o=a(41333);e.exports=function(){return"function"==typeof i&&("function"==typeof Symbol&&("symbol"==typeof i("foo")&&("symbol"==typeof Symbol("bar")&&o())))}},41333: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(t 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 i=Object.getOwnPropertySymbols(e);if(1!==i.length||i[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var o=Object.getOwnPropertyDescriptor(e,t);if(42!==o.value||!0!==o.enumerable)return!1}return!0}},9957:(e,t,a)=>{"use strict";var i=Function.prototype.call,o=Object.prototype.hasOwnProperty,n=a(66743);e.exports=n.call(i,o)},39590: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 n=i-Math.floor(i),r="";for(o=0;o=Math.pow(2,e)?t(e,a):r};t.rack=function(e,a,i){var o=function(o){var r=0;do{if(r++>10){if(!i)throw new Error("too many ID collisions, use more bits");e+=i}var E=t(e,a)}while(Object.hasOwnProperty.call(n,E));return n[E]=o,E},n=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}},39473: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,n;t=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,a=/^(?=([^\/?#]*))\1([^]*)$/,i=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,n={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var o=n.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");return o.path=n.normalizePath(o.path),n.buildURLFromParts(o)}var r=n.parseURL(t);if(!r)throw new Error("Error trying to parse relative URL.");if(r.scheme)return i.alwaysNormalize?(r.path=n.normalizePath(r.path),n.buildURLFromParts(r)):t;var E=n.parseURL(e);if(!E)throw new Error("Error trying to parse base URL.");if(!E.netLoc&&E.path&&"/"!==E.path[0]){var _=a.exec(E.path);E.netLoc=_[1],E.path=_[2]}E.netLoc&&!E.path&&(E.path="/");var T={scheme:E.scheme,netLoc:r.netLoc,path:null,params:r.params,query:r.query,fragment:r.fragment};if(!r.netLoc&&(T.netLoc=E.netLoc,"/"!==r.path[0]))if(r.path){var s=E.path,S=s.substring(0,s.lastIndexOf("/")+1)+r.path;T.path=n.normalizePath(S)}else T.path=E.path,r.params||(T.params=E.params,r.query||(T.query=E.query));return null===T.path&&(T.path=i.alwaysNormalize?n.normalizePath(r.path):r.path),n.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=n})(L);var D=L.exports,p=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},h=Number.isSafeInteger||function(e){return"number"==typeof e&&Math.abs(e)<=C},C=Number.MAX_SAFE_INTEGER||9007199254740991,f=(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})({}),P=(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})({}),B=(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 y(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=G.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(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 w=(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]){U.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"]);p(o.getTime())&&(this._endDate=o)}}return E(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(p(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&&p(this.startDate.getTime())&&(null===this.duration||this.duration>=0)&&(!this.endOnNext||!!this.class)}}]),e})(),Y=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(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 Y,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,n){void 0===n&&(n=!1);var r=this.elementaryStreams,E=r[e];E?(E.startPTS=Math.min(E.startPTS,t),E.endPTS=Math.max(E.endPTS,a),E.startDTS=Math.min(E.startDTS,i),E.endDTS=Math.max(E.endDTS,o)):r[e]={startPTS:t,endPTS:a,startDTS:i,endDTS:o,partial:n}},a.clearElementaryStreamInfo=function(){var e=this.elementaryStreams;e[z.AUDIO]=null,e[z.VIDEO]=null,e[z.AUDIOVIDEO]=null},E(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(!p(this.programDateTime))return null;var e=p(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,n){var r;(r=e.call(this,i)||this).fragOffset=0,r.duration=0,r.gap=!1,r.independent=!1,r.relurl=void 0,r.fragment=void 0,r.index=void 0,r.stats=new Y,r.duration=t.decimalFloatingPoint("DURATION"),r.gap=t.bool("GAP"),r.independent=t.bool("INDEPENDENT"),r.relurl=t.enumeratedString("URI"),r.fragment=a,r.index=o;var E=t.enumeratedString("BYTERANGE");return E&&r.setByteRange(E,n),n&&(r.fragOffset=n.fragOffset+n.duration),r}return s(t,e),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(e,[{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&p(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 n="base64"===o[0],r=o[1];n?(i.splice(-1,1),a=$(r)):a=q(r)}}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 ne={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function re(e){if(e===ne.WIDEVINE)return ae.WIDEVINE}function Ee(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 _e(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 ue,Ae=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},de=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},Oe=function(e,t){for(var a=t,i=0;Ae(e,t);)i+=10,i+=ce(e,t+6),de(e,t+10)&&(i+=10),t+=i;if(i>0)return e.subarray(a,a+i)},ce=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 Ae(e,t)&&ce(e,t+6)+10<=e.length-t},Ne=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(n);break;case 12:case 13:r=e[s++],T+=String.fromCharCode((31&n)<<6|63&r);break;case 14:r=e[s++],E=e[s++],T+=String.fromCharCode((15&n)<<12|(63&r)<<6|63&E)}}return T};function ge(){if(!navigator.userAgent.includes("PlayStation 4"))return ue||void 0===self.TextDecoder||(ue=new self.TextDecoder("utf-8")),ue}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 we(e,t){var a=[];if(!t.length)return a;for(var i=e.byteLength,o=0;o1?o+n:i;if(be(e.subarray(o+4,o+8))===t[0])if(1===t.length)a.push(e.subarray(o+8,r));else{var E=we(e.subarray(o+8,r),t.slice(1));E.length&&We.apply(a,E)}o=r}return a}function Ye(e){var t=[],a=e[0],i=8,o=Ge(e,i);i+=4;var n=0,r=0;0===a?(n=Ge(e,i),r=Ge(e,i+4),i+=8):(n=ke(e,i),r=ke(e,i+8),i+=16),i+=2;var E=e.length+r,_=Ue(e,i);i+=2;for(var T=0;T<_;T++){var s=i,S=Ge(e,s);s+=4;var l=2147483647&S;if(1==(2147483648&S)>>>31)return U.warn("SIDX has hierarchical references (not supported)"),null;var I=Ge(e,s);s+=4,t.push({referenceSize:l,subsegmentDuration:I,info:{duration:I/o,start:E,end:E+l-1}}),E+=l,i=s+=4}return{earliestPresentationTime:n,timescale:o,version:a,referencesCount:_,references:t}}function ze(e){for(var t=[],a=we(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++],u=(248&I)>>3;31===u&&(u+=1+((7&I)<<3)+((224&T[s])>>5)),o+="."+u}break;case"hvc1":case"hev1":var A=we(a,["hvcC"])[0],d=A[1],O=["","A","B","C"][d>>6],c=31&d,R=Ge(A,2),N=(32&d)>>5?"H":"L",m=A[12],L=A.subarray(6,12);o+="."+O+c,o+="."+R.toString(16).toUpperCase(),o+="."+N+m;for(var D="",p=L.length;p--;){var h=L[p];(h||D)&&(D="."+h.toString(16).toUpperCase()+D)}o+=D;break;case"dvh1":case"dvhe":var C=we(a,["dvcC"])[0],f=C[2]>>1&127,P=C[2]<<5&32|C[3]>>3&31;o+="."+Qe(f)+"."+Qe(P);break;case"vp09":var B=we(a,["vpcC"])[0],g=B[4],v=B[5],M=B[6]>>4&15;o+="."+Qe(g)+"."+Qe(v)+"."+Qe(M);break;case"av01":var W=we(a,["av1C"])[0],y=W[1]>>>5,b=31&W[1],U=W[2]>>>7?"H":"M",G=(64&W[2])>>6,k=(32&W[2])>>5,F=2===y&&G?k?12:10:G?10:8,V=(16&W[2])>>4,H=(8&W[2])>>3,w=(4&W[2])>>2,Y=3&W[2],z=1,K=1,j=1,x=0;o+="."+y+"."+Qe(b)+U+"."+Qe(F)+"."+V+"."+H+w+Y+"."+Qe(z)+"."+Qe(K)+"."+Qe(j)+"."+x}return{codec:o,encrypted:n}}function je(e,t){for(var a=t+5;128&e[t++]&&t0;o||(i=we(t,["encv"])),i.forEach((function(e){we(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}))||(U.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=we(e,["schm"])[0];if(t){var a=be(t.subarray(4,8));if("cbcs"===a||"cenc"===a)return we(e,["schi","tenc"])[0]}return U.error("[eme] missing 'schm' box"),null}function qe(e,t){return we(t,["moof","traf"]).reduce((function(t,a){var i=we(a,["tfdt"])[0],o=i[0],n=we(a,["tfhd"]).reduce((function(t,a){var n=Ge(a,4),r=e[n];if(r){var E=Ge(i,4);if(1===o){if(E===Me)return U.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),t;E*=Me+1,E+=Ge(i,8)}var _=E/(r.timescale||9e4);if(p(_)&&(null===t||_>1&63;return 39===a||40===a}return 6==(31&t)}function rt(e,t,a,i){var o=Et(e),n=0;n+=t;for(var r=0,E=0,_=0;n=o.length)break;r+=_=o[n++]}while(255===_);E=0;do{if(n>=o.length)break;E+=_=o[n++]}while(255===_);var T=o.length-n,s=n;if(ET){U.error("Malformed SEI payload. "+E+" is too small, only "+T+" bytes left to parse.");break}if(4===r){if(181===o[s++]){var S=Ue(o,s);if(s+=2,49===S){var l=Ge(o,s);if(s+=4,1195456820===l){var I=o[s++];if(3===I){var u=o[s++],A=64&u,d=A?2+3*(31&u):0,O=new Uint8Array(d);if(A){O[0]=u;for(var c=1;c16){for(var R=[],N=0;N<16;N++){var m=o[s++].toString(16);R.push(1==m.length?"0"+m:m),3!==N&&5!==N&&7!==N&&9!==N||R.push("-")}for(var L=E-16,D=new Uint8Array(L),p=0;p1?t-1:0),i=1;i>24&255,E[1]=n>>16&255,E[2]=n>>8&255,E[3]=255&n,E.set(e,4),r=0,n=8;r0?(n=new Uint8Array(4),t.length>0&&new DataView(n.buffer).setUint32(0,t.length,!1)):n=new Uint8Array;var _=new Uint8Array(4);return a&&a.byteLength>0&&new DataView(_.buffer).setUint32(0,a.byteLength,!1),Tt([112,115,115,104],new Uint8Array([i,0,0,0]),e,n,o,_,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 n=new Uint16Array(i.buffer,i.byteOffset,i.byteLength/2),r=String.fromCharCode.apply(null,Array.from(n)),E=r.substring(r.indexOf("<"),r.length),_=(new DOMParser).parseFromString(E,"text/xml").getElementsByTagName("KID")[0];if(_){var T=_.childNodes[0]?_.childNodes[0].nodeValue:_.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 u=Object.keys(lt).length%Number.MAX_SAFE_INTEGER;I=new Uint8Array(16),new DataView(I.buffer,12,4).setUint32(0,u),lt[this.uri]=I}this.keyId=I}return this},e})();function ut(e){for(var t=new Uint8Array(16),a=12;a<16;a++)t[a]=e>>8*(15-a)&255;return t}var At=/\{\$([a-zA-Z0-9-_]+)\}/g;function dt(e){return At.test(e)}function Ot(e,t,a){if(null!==e.variableList||e.hasVariableRefs)for(var i=a.length;i--;){var o=a[i],n=t[o];n&&(t[o]=ct(e,n))}}function ct(e,t){if(null!==e.variableList||e.hasVariableRefs){var a=e.variableList;return t.replace(At,(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,n=e.variableList;if(n||(e.variableList=n={}),"QUERYPARAM"in t){i=t.QUERYPARAM;try{var r=new self.URL(a).searchParams;if(!r.has(i))throw new Error('"'+i+'" does not match any query parameter in URI: "'+a+'"');o=r.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 n?e.playlistParsingError||(e.playlistParsingError=new Error('EXT-X-DEFINE duplicate Variable Name declarations: "'+i+'"')):n[i]=o||""}function Nt(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 pt(e,t,a){return void 0===a&&(a=!0),!e.split(",").some((function(e){return!ht(e,t,a)}))}function ht(e,t,a){var i;void 0===a&&(a=!0);var o=mt(a);return null!=(i=null==o?void 0:o.isTypeSupported(Ct(e,t)))&&i}function Ct(e,t){return t+'/mp4;codecs="'+e+'"'}function ft(e){if(e){var t=e.substring(0,4);return Lt.video[t]}return 2}function Pt(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 Bt={};function gt(e,t){if(void 0===t&&(t=!0),Bt[e])return Bt[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 bt=/#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,Ut=/#EXT-X-MEDIA:(.*)/g,Gt=/^#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&&n.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(P);s.partTarget=Q.decimalFloatingPoint("PART-TARGET");break;case"PART":var $=s.partList;$||($=s.partList=[]);var q=u>0?$[$.length-1]:void 0,J=u++,Z=new F(P);Ot(s,Z,["BYTERANGE","URI"]);var ee=new x(Z,c,t,J,q);$.push(ee),c.duration+=ee.duration;break;case"PRELOAD-HINT":var te=new F(P);Ot(s,te,["URI"]),s.preloadHint=te;break;case"RENDITION-REPORT":var ae=new F(P);Ot(s,ae,["URI"]),s.renditionReports=s.renditionReports||[],s.renditionReports.push(ae);break;default:U.warn("line parsed but not handled: "+r)}}}O&&!O.relurl?(S.pop(),A-=O.duration,s.partList&&(s.fragmentHint=O)):s.partList&&(jt(c,O),c.cc=d,s.fragmentHint=c,_&&Qt(c,_,s));var ie=S.length,oe=S[0],ne=S[ie-1];if((A+=s.skippedSegments*s.targetduration)>0&&ie&&ne){s.averagetargetduration=A/ie;var re=ne.sn;s.endSN="initSegment"!==re?re:0,s.live||(ne.endList=!0),oe&&(s.startCC=oe.cc)}else s.endSN=0,s.startCC=0;return s.fragmentHint&&(A+=s.fragmentHint.duration),s.totalduration=A,s.endCC=d,R>0&&Kt(S,R),s},e})();function Ht(e,t,a){var i,o,n=new F(e);Ot(a,n,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);var r=null!=(i=n.METHOD)?i:"",E=n.URI,_=n.hexadecimalInteger("IV"),T=n.KEYFORMATVERSIONS,s=null!=(o=n.KEYFORMAT)?o:"identity";E&&n.IV&&!_&&U.error("Invalid IV: "+n.IV);var S=E?Vt.resolve(E,t):"",l=(T||"1").split("/").map(Number).filter(Number.isFinite);return new It(r,S,s,l,_)}function wt(e){var t=new F(e).decimalFloatingPoint("TIME-OFFSET");return p(t)?t:null}function Yt(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),p(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(f.MANIFEST_LOADING,this.onManifestLoading,this),e.on(f.LEVEL_LOADING,this.onLevelLoading,this),e.on(f.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(f.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},t.unregisterListeners=function(){var e=this.hls;e.off(f.MANIFEST_LOADING,this.onManifestLoading,this),e.off(f.LEVEL_LOADING,this.onLevelLoading,this),e.off(f.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(f.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,n=t.url,r=t.deliveryDirectives;this.load({id:a,level:i,pathwayId:o,responseType:"text",type:Xt.LEVEL,url:n,deliveryDirectives:r})},t.onAudioTrackLoading=function(e,t){var a=t.id,i=t.groupId,o=t.url,n=t.deliveryDirectives;this.load({id:a,groupId:i,level:null,responseType:"text",type:Xt.AUDIO_TRACK,url:o,deliveryDirectives:n})},t.onSubtitleTrackLoading=function(e,t){var a=t.id,i=t.groupId,o=t.url,n=t.deliveryDirectives;this.load({id:a,groupId:i,level:null,responseType:"text",type:Xt.SUBTITLE_TRACK,url:o,deliveryDirectives:n})},t.load=function(e){var t,a,i,o=this,n=this.hls.config,r=this.getInternalLoader(e);if(r){var E=r.context;if(E&&E.url===e.url&&E.level===e.level)return void U.trace("[playlist-loader]: playlist request ongoing");U.log("[playlist-loader]: aborting previous loader for type: "+e.type),r.abort()}if(a=e.type===Xt.MANIFEST?n.manifestLoadPolicy.default:T({},n.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),r=this.createInternalLoader(e),p(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 _=i.partTarget,s=i.targetduration;if(_&&s){var S=1e3*Math.max(3*_,.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},u={onSuccess:function(e,t,a,i){var n=o.getInternalLoader(a);o.resetInternalLoader(a.type);var r=e.data;0===r.indexOf("#EXTM3U")?(t.parsing.start=performance.now(),Vt.isMediaPlaylist(r)?o.handleTrackOrLevelPlaylist(e,t,a,i||null,n):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)}};r.load(e,I,u)},t.handleMasterPlaylist=function(e,t,a,i){var o=this.hls,n=e.data,r=Jt(e,a),E=Vt.parseMasterPlaylist(n,r);if(E.playlistParsingError)this.handleManifestParsingError(e,a,E.playlistParsingError,i,t);else{var _=E.contentSteering,T=E.levels,s=E.sessionData,S=E.sessionKeys,l=E.startTimeOffset,I=E.variableList;this.variableList=I;var u=Vt.parseMasterPlaylistMedia(n,r,E),A=u.AUDIO,d=void 0===A?[]:A,O=u.SUBTITLES,c=u["CLOSED-CAPTIONS"];d.length&&(d.some((function(e){return!e.url}))||!T[0].audioCodec||T[0].attrs.AUDIO||(U.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),d.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new F({}),bitrate:0,url:""}))),o.trigger(f.MANIFEST_LOADED,{levels:T,audioTracks:d,subtitles:O,captions:c,contentSteering:_,url:r,stats:t,networkDetails:i,sessionData:s,sessionKeys:S,startTimeOffset:l,variableList:I})}},t.handleTrackOrLevelPlaylist=function(e,t,a,i,o){var n=this.hls,r=a.id,E=a.level,_=a.type,T=Jt(e,a),s=0,S=p(E)?E:p(r)?r:0,l=qt(a),I=Vt.parseLevelPlaylist(e.data,T,S,l,s,this.variableList);if(_===Xt.MANIFEST){var u={attrs:new F({}),bitrate:0,details:I,name:"",url:T};n.trigger(f.MANIFEST_LOADED,{levels:[u],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(f.ERROR,{type:P.NETWORK_ERROR,details:B.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,n){void 0===a&&(a=!1);var r="A network "+(a?"timeout":"error"+(o?" (status "+o.code+")":""))+" occurred while loading "+e.type;e.type===Xt.LEVEL?r+=": "+e.level+" id: "+e.id:e.type!==Xt.AUDIO_TRACK&&e.type!==Xt.SUBTITLE_TRACK||(r+=" id: "+e.id+' group-id: "'+e.groupId+'"');var E=new Error(r);U.warn("[playlist-loader]: "+r);var _=B.UNKNOWN,T=!1,s=this.getInternalLoader(e);switch(e.type){case Xt.MANIFEST:_=a?B.MANIFEST_LOAD_TIMEOUT:B.MANIFEST_LOAD_ERROR,T=!0;break;case Xt.LEVEL:_=a?B.LEVEL_LOAD_TIMEOUT:B.LEVEL_LOAD_ERROR,T=!1;break;case Xt.AUDIO_TRACK:_=a?B.AUDIO_TRACK_LOAD_TIMEOUT:B.AUDIO_TRACK_LOAD_ERROR,T=!1;break;case Xt.SUBTITLE_TRACK:_=a?B.SUBTITLE_TRACK_LOAD_TIMEOUT:B.SUBTITLE_LOAD_ERROR,T=!1}s&&this.resetInternalLoader(e.type);var S={type:P.NETWORK_ERROR,details:_,fatal:T,url:e.url,loader:s,context:e,error:E,networkDetails:t,stats:n};if(o){var l=(null==t?void 0:t.url)||e.url;S.response=i({url:l,data:void 0},o)}this.hls.trigger(f.ERROR,S)},t.handlePlaylistLoaded=function(e,t,a,i,o,n){var r=this.hls,E=i.type,_=i.level,T=i.id,s=i.groupId,S=i.deliveryDirectives,l=Jt(t,i),I=qt(i),u="number"==typeof i.level&&I===$t.MAIN?_:void 0;if(e.fragments.length){e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));var A=e.playlistParsingError;if(A)r.trigger(f.ERROR,{type:P.NETWORK_ERROR,details:B.LEVEL_PARSING_ERROR,fatal:!1,url:l,error:A,reason:A.message,response:t,context:i,level:u,parent:I,networkDetails:o,stats:a});else switch(e.live&&n&&(n.getCacheAge&&(e.ageHeader=n.getCacheAge()||0),n.getCacheAge&&!isNaN(e.ageHeader)||(e.ageHeader=0)),E){case Xt.MANIFEST:case Xt.LEVEL:r.trigger(f.LEVEL_LOADED,{details:e,level:u||0,id:T||0,stats:a,networkDetails:o,deliveryDirectives:S});break;case Xt.AUDIO_TRACK:r.trigger(f.AUDIO_TRACK_LOADED,{details:e,id:T||0,groupId:s||"",stats:a,networkDetails:o,deliveryDirectives:S});break;case Xt.SUBTITLE_TRACK:r.trigger(f.SUBTITLE_TRACK_LOADED,{details:e,id:T||0,groupId:s||"",stats:a,networkDetails:o,deliveryDirectives:S})}}else{var d=new Error("No Segments found in Playlist");r.trigger(f.ERROR,{type:P.NETWORK_ERROR,details:B.LEVEL_EMPTY_ERROR,fatal:!1,url:l,error:d,reason:d.message,response:t,context:i,level:u,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){U.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){U.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 n=na(e.cues,t,a),r=0;re[a].endTime)return-1;for(var i=0,o=a;i<=o;){var n=Math.floor((o+i)/2);if(te[n].startTime&&i-1)for(var n=o,r=e.length;n=t&&E.endTime<=a)i.push(E);else if(E.startTime>a)return i}return i}function ra(e){for(var t=[],a=0;aSa&&(S=Sa),S-s<=0&&(S=s+_a);for(var l=0;lt.startDate&&(!e||t.startDate.05&&this.forwardBufferLength>1){var _=Math.min(2,Math.max(1,n)),T=Math.round(2/(1+Math.exp(-.75*E-this.edgeStalled))*20)/20;e.playbackRate=Math.min(_,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(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,n=o.liveSyncDuration,r=o.liveSyncDurationCount,E=o.lowLatencyMode,_=this.hls.userConfig,T=E&&a||t;(_.liveSyncDuration||_.liveSyncDurationCount||0===T)&&(T=void 0!==n?n:r*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,n=i-a.totalduration,r=i-(this.config.lowLatencyMode&&a.partTarget||a.targetduration);return Math.min(Math.max(n,o),r)}},{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})(),da=["NONE","TYPE-0","TYPE-1",null];function Oa(e){return da.indexOf(e)>-1}var ca=["SDR","PQ","HLG"];function Ra(e){return!!e&&ca.indexOf(e)>-1}var Na={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 Ca(e,t,a,i,o,n){i-a<=0&&(U.warn("Fragment should have a positive duration",t),i=a+t.duration,n=o+t.duration);var r=a,E=i,_=t.startPTS,T=t.endPTS;if(p(_)){var s=Math.abs(_-a);p(t.deltaPTS)?t.deltaPTS=Math.max(s,t.deltaPTS):t.deltaPTS=s,r=Math.max(a,_),a=Math.min(a,_),o=Math.min(o,t.startDTS),E=Math.min(i,T),i=Math.max(i,T),n=Math.max(n,t.endDTS)}var S=a-t.start;0!==t.start&&(t.start=a),t.duration=i-t.start,t.startPTS=a,t.maxStartPTS=r,t.startDTS=o,t.endPTS=i,t.minEndPTS=E,t.endDTS=n;var l,I=t.sn;if(!e||Ie.endSN)return 0;var u=I-e.startSN,A=e.fragments;for(A[u]=t,l=u;l>0;l--)ha(A[l],A[l-1]);for(l=u;l=0;o--){var n=i[o].initSegment;if(n){a=n;break}}e.fragmentHint&&delete e.fragmentHint.endPTS;var r,E=0;if(ga(e,t,(function(e,i){e.relurl&&(E=e.cc-i.cc),p(e.startPTS)&&p(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&&(r=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){U.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var _=t.skippedSegments;_--;)t.fragments.shift();t.startSN=t.fragments[0].sn,t.startCC=t.fragments[0].cc}else t.canSkipDateRanges&&(t.dateRanges=Pa(e.dateRanges,t.dateRanges,t.recentlyRemovedDateranges));var T=t.fragments;if(E){U.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 n=1e3*i[i.length-1].duration;n499)}var za={search:function(e,t){for(var a=0,i=e.length-1,o=null,n=null;a<=i;){var r=t(n=e[o=(a+i)/2|0]);if(r>0)a=o+1;else{if(!(r<0))return n;i=o-1}}return null}};function Ka(e,t,a){if(null===t||!Array.isArray(e)||!e.length||!p(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&&n<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 r=za.search(t,xa.bind(null,a,i));return!r||r===e&&o?o:r}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=U.log.bind(U,"[info]:"),this.warn=U.warn.bind(U,"[warning]:"),this.error=U.error.bind(U,"[error]:"),this.registerListeners()}var t=e.prototype;return t.registerListeners=function(){var e=this.hls;e.on(f.ERROR,this.onError,this),e.on(f.MANIFEST_LOADING,this.onManifestLoading,this),e.on(f.LEVEL_UPDATED,this.onLevelUpdated,this)},t.unregisterListeners=function(){var e=this.hls;e&&(e.off(f.ERROR,this.onError,this),e.off(f.ERROR,this.onErrorOut,this),e.off(f.MANIFEST_LOADING,this.onManifestLoading,this),e.off(f.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,n=t.context;switch(t.details){case B.FRAG_LOAD_ERROR:case B.FRAG_LOAD_TIMEOUT:case B.KEY_LOAD_ERROR:case B.KEY_LOAD_TIMEOUT:return void(t.errorAction=this.getFragRetryOrSwitchAction(t));case B.FRAG_PARSING_ERROR:if(null!=(a=t.frag)&&a.gap)return void(t.errorAction={action:$a.DoNothing,flags:qa.None});case B.FRAG_GAP:case B.FRAG_DECRYPT_ERROR:return t.errorAction=this.getFragRetryOrSwitchAction(t),void(t.errorAction.action=$a.SendAlternateToPenaltyBox);case B.LEVEL_EMPTY_ERROR:case B.LEVEL_PARSING_ERROR:var r,E,_=t.parent===$t.MAIN?t.level:o.loadLevel;return void(t.details===B.LEVEL_EMPTY_ERROR&&null!=(r=t.context)&&null!=(E=r.levelDetails)&&E.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,_):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,_)));case B.LEVEL_LOAD_ERROR:case B.LEVEL_LOAD_TIMEOUT:return void("number"==typeof(null==n?void 0:n.level)&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.level)));case B.AUDIO_TRACK_LOAD_ERROR:case B.AUDIO_TRACK_LOAD_TIMEOUT:case B.SUBTITLE_LOAD_ERROR:case B.SUBTITLE_TRACK_LOAD_TIMEOUT:if(n){var T=o.levels[o.loadLevel];if(T&&(n.type===Xt.AUDIO_TRACK&&T.hasAudioGroup(n.groupId)||n.type===Xt.SUBTITLE_TRACK&&T.hasSubtitleGroup(n.groupId)))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o.loadLevel),t.errorAction.action=$a.SendAlternateToPenaltyBox,void(t.errorAction.flags=qa.MoveAllAlternatesMatchingHost)}return;case B.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 B.BUFFER_ADD_CODEC_ERROR:case B.REMUX_ALLOC_ERROR:case B.BUFFER_APPEND_ERROR:return void(t.errorAction=this.getLevelSwitchAction(t,null!=(i=t.level)?i:o.loadLevel));case B.INTERNAL_EXCEPTION:case B.BUFFER_APPENDING_ERROR:case B.BUFFER_FULL_ERROR:case B.LEVEL_SWITCH_ERROR:case B.BUFFER_STALLED_ERROR:case B.BUFFER_SEEK_OVER_HOLE:case B.BUFFER_NUDGE_ON_STALL:return void(t.errorAction={action:$a.DoNothing,flags:qa.None})}t.type===P.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(wa(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,n=o.fragLoadPolicy,r=o.keyLoadPolicy,E=Fa(e.details.startsWith("key")?r:n,e),_=t.levels.reduce((function(e,t){return e+t.fragmentError}),0);if(i&&(e.details!==B.FRAG_GAP&&i.fragmentError++,wa(E,_,ka(e),e.response)))return{action:$a.RetryRequest,flags:qa.None,retryConfig:E,retryCount:_};var T=this.getLevelSwitchAction(e,a);return E&&(T.retryConfig=E,T.retryCount=_),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,n,r=e.details;i.loadError++,r===B.BUFFER_APPEND_ERROR&&i.fragmentError++;var E=-1,_=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,u=(I===$t.AUDIO&&r===B.FRAG_PARSING_ERROR||"audio"===e.sourceBufferName&&(r===B.BUFFER_ADD_CODEC_ERROR||r===B.BUFFER_APPEND_ERROR))&&_.some((function(e){var t=e.audioCodec;return i.audioCodec!==t})),A="video"===e.sourceBufferName&&(r===B.BUFFER_ADD_CODEC_ERROR||r===B.BUFFER_APPEND_ERROR)&&_.some((function(e){var t=e.codecSet,a=e.audioCodec;return i.codecSet!==t&&i.audioCodec===a})),d=null!=(n=e.context)?n:{},O=d.type,c=d.groupId,R=function(){var t=(N+T)%_.length;if(t!==T&&t>=s&&t<=S&&0===_[t].loadError){var a,o,n=_[t];if(r===B.FRAG_GAP&&e.frag){var l=_[t].details;if(l){var d=ja(e.frag,l.fragments,e.frag.start);if(null!=d&&d.gap)return 0}}else{if(O===Xt.AUDIO_TRACK&&n.hasAudioGroup(c)||O===Xt.SUBTITLE_TRACK&&n.hasSubtitleGroup(c))return 0;if(I===$t.AUDIO&&null!=(a=i.audioGroups)&&a.some((function(e){return n.hasAudioGroup(e)}))||I===$t.SUBTITLE&&null!=(o=i.subtitleGroups)&&o.some((function(e){return n.hasSubtitleGroup(e)}))||u&&i.audioCodec===n.audioCodec||!u&&i.audioCodec!==n.audioCodec||A&&i.codecSet===n.codecSet)return 0}return E=t,1}},N=_.length;N--&&(0===(l=R())||1!==l););if(E>-1&&a.loadLevel!==E)return e.levelRetry=!0,this.playlistError=0,{action:$a.SendAlternateToPenaltyBox,flags:qa.None,nextAutoLevel:E}}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===B.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,n=a.nextAutoLevel;switch(i){case qa.None:this.switchLevel(e,n);break;case qa.MoveAllAlternatesMatchingHDCP:o&&(t.maxHdcpLevel=da[da.indexOf(o)-1],a.resolved=!0),this.warn('Restricting playback to HDCP-LEVEL of "'+t.maxHdcpLevel+'" or lower')}a.resolved||this.switchLevel(e,n)}},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=U.log.bind(U,t+":"),this.warn=U.warn.bind(U,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(_,T>=0?T:void 0,Na.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,n=t.stats,r=self.performance.now(),E=n.loading.first?Math.max(0,r-n.loading.first):0;if(o.advancedDateTime=Date.now()-E,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&&fa(a,o),!this.canLoad||!o.live)return;var _,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,u=o.lastPartIndex,A=l===I;-1!==u?(T=A?I+1:l,s=A?S?0:u:u+1):T=I+1;var d=o.age,O=d+o.ageHeader,c=Math.min(O-o.partTarget,1.5*o.targetduration);if(c>0){if(a&&c>a.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+a.tuneInGoal+" to: "+c+" with playlist age: "+o.age),c=0;else{var R=Math.floor(c/o.targetduration);T+=R,void 0!==s&&(s+=Math.round(c%o.targetduration/o.partTarget)),this.log("CDN Tune-in age: "+o.ageHeader+"s last advanced "+d.toFixed(2)+"s goal: "+c+" skip sn "+R+" to part "+s)}o.tuneInGoal=c}if(_=this.getDeliveryDirectives(o,t.deliveryDirectives,T,s),S||!A)return void this.loadPlaylist(_)}else(o.canBlockReload||o.canSkipUntil)&&(_=this.getDeliveryDirectives(o,t.deliveryDirectives,T,s));var N=this.hls.mainForwardBufferInfo,m=N?N.end-N.len:0,L=Wa(o,1e3*(o.edge-m));o.updated&&r>this.requestScheduled+L&&(this.requestScheduled=n.loading.start),void 0!==T&&o.canBlockReload?this.requestScheduled=n.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 "+(_+1)+"/"+T.maxNumRetry+' after "'+a+'" without delivery-directives'),this.loadPlaylist();else{var l=Va(T,_);this.timer=self.setTimeout((function(){return t.loadPlaylist()}),l),this.warn("Retrying playlist loading "+(_+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,n){var r=e.audioCodec?e.audioGroups:null,E=null==n?void 0:n.audioCodec,_=null==n?void 0:n.channels,T=_?parseInt(_):E?1/0:2,s=null;if(null!=r&&r.length)try{s=1===r.length&&r[0]?t.groups[r[0]].channels:r.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&&p(T)&&Object.keys(s).some((function(e){return parseInt(e)>T}))}function ni(e,t,a){var o=e.videoCodec,n=e.audioCodec;if(!o||!n||!a)return Promise.resolve(ai);var r={width:e.width,height:e.height,bitrate:Math.ceil(Math.max(.9*e.bitrate,e.averageBitrate)),framerate:e.frameRate||30},E=e.videoRange;"SDR"!==E&&(r.transferFunction=E.toLowerCase());var _=o.split(",").map((function(e){return{type:"media-source",video:i(i({},r),{},{contentType:Ct(e,"video")})}}));return n&&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);p(i)&&i>2&&_.push.apply(_,n.split(",").map((function(e){return{type:"media-source",audio:{contentType:Ct(e,"audio"),channels:""+i}}})))}})))})),Promise.all(_.map((function(e){var t=ri(e);return ii[t]||(ii[t]=a.decodingInfo(e))}))).then((function(e){return{supported:!e.some((function(e){return!e.supported})),configurations:_,decodingInfoResults:e}})).catch((function(e){return{supported:!1,configurations:_,decodingInfoResults:[],error:e}}))}function ri(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 Ei(){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 _i(e,t){var a=!1,i=[];return e&&(a="SDR"!==e,i=[e]),t&&(i=t.allowedVideoRanges||ca.slice(0),i=(a=void 0!==t.preferHDR?t.preferHDR:Ei())?i.filter((function(e){return"SDR"!==e})):["SDR"]),{preferHDR:a,allowedVideoRanges:i}}function Ti(e,t,a,i,o){for(var n=Object.keys(e),r=null==i?void 0:i.channels,E=null==i?void 0:i.audioCodec,_=r&&2===parseInt(r),T=!0,s=!1,S=1/0,l=1/0,I=1/0,u=0,A=[],d=_i(t,o),O=d.preferHDR,c=d.allowedVideoRanges,R=function(){var t=e[n[N]];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=c.filter((function(e){return t.videoRanges[e]>0}));a.length>0&&(s=!0,A=a)},N=n.length;N--;)R();S=p(S)?S:0,l=p(l)?l:0;var m=Math.max(1080,S),L=Math.max(30,l);return I=p(I)?I:a,a=Math.max(I,a),s||(t=void 0,A=[]),{codecSet:n.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(E&&i.indexOf(E.substring(0,4))%5!=0)return si(i,'audio codec preference "'+E+'" not found'),t;if(r&&!_){if(!o.channels[r])return si(i,"no renditions with "+r+" channel sound found (channels options: "+Object.keys(o.channels)+")"),t}else if((!E||_)&&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):A.some((function(e){return o.videoRanges[e]>0}))?o.maxScore=Pt(t)||o.fragmentError>e[t].fragmentError)?t:(u=o.maxScore,i):(si(i,"no variants with VIDEO-RANGE of "+JSON.stringify(A)+" found"),t)}),void 0),videoRanges:A,preferHDR:O,minFramerate:l,minBitrate:I}}function si(e,t){U.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 n=Math.min(a.height,a.width);return o.minHeight=Math.min(o.minHeight,n),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,r));var E=n.videoRange,_=n.frameRate,T=n.codecSet.substring(0,4),s=ci(t,i,(function(t){if(t.videoRange!==E||t.frameRate!==_||t.codecSet.substring(0,4)!==T)return!1;var i=t.audioGroups,n=a.filter((function(e){return!i||-1!==i.indexOf(e.groupId)}));return Ii(e,n,o)>-1}));return s>-1?s:ci(t,i,(function(t){var i=t.audioGroups,n=a.filter((function(e){return!i||-1!==i.indexOf(e.groupId)}));return Ii(e,n,o)>-1}))}function ci(e,t,a){for(var i=t;i;i--)if(a(e[i]))return i;for(var o=t+1;o-1,O=t.getBwEstimate(),c=i.levels,R=c[e.level],N=E.total||Math.max(E.loaded,Math.round(_*R.averageBitrate/8)),m=d?T-A:T;m<1&&d&&(m=Math.min(T,8*E.loaded/O));var L=d?1e3*E.loaded/m:0,D=L?(N-E.loaded)/L:8*N/O+l/1e3;if(!(D<=u)){var h,C=L?8*L:O,P=Number.POSITIVE_INFINITY;for(h=e.level-1;h>s;h--){var B=c[h].maxBitrate;if((P=t.getTimeToLoadFrag(l/1e3,C,_*B,!c[h].details))=D||P>10*_)){i.nextLoadLevel=i.nextAutoLevel=h,d?t.bwEstimator.sample(T-Math.min(l,A),E.loaded):t.bwEstimator.sampleTTFB(T);var g=c[h].maxBitrate;t.getBwEstimate()*t.hls.config.abrBandWidthUpFactor>g&&t.resetEstimator(g),t.clearTimer(),U.warn("[abr] Fragment "+e.sn+(a?" part "+a.index:"")+" of level "+e.level+" is loading too slowly;\n Time to underbuffer: "+u.toFixed(3)+" s\n Estimated load time for current fragment: "+D.toFixed(3)+" s\n Estimated load time for down switch fragment: "+P.toFixed(3)+" s\n TTFB estimate: "+(0|A)+" ms\n Current BW estimate: "+(p(O)?0|O:"Unknown")+" bps\n New BW estimate: "+(0|t.getBwEstimate())+" bps\n Switching to level "+h+" @ "+(0|g)+" bps"),i.trigger(f.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:a,stats:E})}}}}}}},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}var t=e.prototype;return t.resetEstimator=function(e){e&&(U.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(f.MANIFEST_LOADING,this.onManifestLoading,this),e.on(f.FRAG_LOADING,this.onFragLoading,this),e.on(f.FRAG_LOADED,this.onFragLoaded,this),e.on(f.FRAG_BUFFERED,this.onFragBuffered,this),e.on(f.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(f.LEVEL_LOADED,this.onLevelLoaded,this),e.on(f.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(f.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(f.ERROR,this.onError,this)},t.unregisterListeners=function(){var e=this.hls;e&&(e.off(f.MANIFEST_LOADING,this.onManifestLoading,this),e.off(f.FRAG_LOADING,this.onFragLoading,this),e.off(f.FRAG_LOADED,this.onFragLoaded,this),e.off(f.FRAG_BUFFERED,this.onFragBuffered,this),e.off(f.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(f.LEVEL_LOADED,this.onLevelLoaded,this),e.off(f.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(f.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(f.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 B.BUFFER_ADD_CODEC_ERROR:case B.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case B.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 n=performance.now(),r=o?o.stats:a.stats,E=n-r.loading.start,_=r.loading.first?r.loading.first-r.loading.start:-1;if(r.loaded&&_>-1){var T=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(E-Math.min(T,_),r.loaded)}else this.bwEstimator.sampleTTFB(E)}}},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;p(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 n=i?i.duration:a.duration,r=this.hls.levels[a.level],E=(r.loaded?r.loaded.bytes:0)+o.loaded,_=(r.loaded?r.loaded.duration:0)+n;r.loaded={bytes:E,duration:_},r.realBitrate=Math.round(8*E/_)}if(a.bitrateTest){var T={stats:o,frag:a,part:i,id:a.type};this.onFragBuffered(f.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 n=o.parsing.end-o.loading.start-Math.min(o.loading.first-o.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(n,o.loaded),o.bwEstimate=this.getBwEstimate(),a.bitrateTest?this.bitrateTestDelay=n/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,n=a.minAutoLevel,r=a.media,E=t?t.duration:e?e.duration:0,_=r&&0!==r.playbackRate?Math.abs(r.playbackRate):1,T=this.getBwEstimate(),s=a.mainForwardBufferInfo,S=(s?s.len:0)/_,l=o.abrBandWidthFactor,I=o.abrBandWidthUpFactor;if(S){var u=this.findBestLevel(T,n,i,S,0,l,I);if(u>=0)return u}var A=E?Math.min(E,o.maxStarvationDelay):o.maxStarvationDelay;if(!S){var d=this.bitrateTestDelay;d&&(A=(E?Math.min(E,o.maxLoadingDelay):o.maxLoadingDelay)-d,U.info("[abr] bitrate test took "+Math.round(1e3*d)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*A)+" ms"),l=I=1)}var O=this.findBestLevel(T,n,i,S,A,l,I);if(U.info("[abr] "+(S?"rebuffering expected":"buffer is empty")+", optimal quality level "+O),O>-1)return O;var c=a.levels[n],R=a.levels[a.loadLevel];return(null==c?void 0:c.bitrate)<(null==R?void 0:R.bitrate)?n:a.loadLevel},t.getBwEstimate=function(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate},t.findBestLevel=function(e,t,a,i,o,n,r){var E,_=this,T=i+o,s=this.lastLoadedFragLevel,S=-1===s?this.hls.firstLevel:s,l=this.fragCurrent,I=this.partCurrent,u=this.hls,A=u.levels,d=u.allAudioTracks,O=u.loadLevel,c=u.config;if(1===A.length)return 0;var R,N=A[S],m=!(null==N||null==(E=N.details)||!E.live),L=-1===O||-1===s,D="SDR",h=(null==N?void 0:N.frameRate)||0,C=c.audioPreference,f=c.videoPreference,P=this.audioTracksByGroup||(this.audioTracksByGroup=Si(d));if(L){if(-1!==this.firstSelection)return this.firstSelection;var B=Ti(this.codecTiers||(this.codecTiers=li(A,P,t,a)),D,e,C,f),g=B.codecSet,v=B.videoRanges,M=B.minFramerate,W=B.minBitrate,y=B.preferHDR;R=g,D=y?v[v.length-1]:v[0],h=M,e=Math.max(e,W),U.log("[abr] picked start tier "+JSON.stringify(B))}else R=null==N?void 0:N.codecSet,D=null==N?void 0:N.videoRange;for(var b,G=I?I.duration:l?l.duration:0,k=this.bwEstimator.getEstimateTTFB()/1e3,F=[],V=function(){var t,E=A[H],l=H>S;if(!E)return 0;if(c.useMediaCapabilities&&!E.supportedResult&&!E.supportedPromise){var u=navigator.mediaCapabilities;"function"==typeof(null==u?void 0:u.decodingInfo)&&oi(E,P,D,h,e,C)?(E.supportedPromise=ni(E,P,u),E.supportedPromise.then((function(e){E.supportedResult=e;var t=_.hls.levels,a=t.indexOf(E);e.error?U.warn('[abr] MediaCapabilities decodingInfo error: "'+e.error+'" for level '+a+" "+JSON.stringify(e)):e.supported||(U.warn("[abr] Unsupported MediaCapabilities decodingInfo result for level "+a+" "+JSON.stringify(e)),a>-1&&t.length>1&&(U.log("[abr] Removing unsupported level "+a),_.hls.removeLevel(a)))}))):E.supportedResult=ai}if(R&&E.codecSet!==R||D&&E.videoRange!==D||l&&h>E.frameRate||!l&&h>0&&h=2*G&&0===o?A[H].averageBitrate:A[H].maxBitrate,v=_.getTimeToLoadFrag(k,d,g*B,void 0===f);if(d>=g&&(H===s||0===E.loadError&&0===E.fragmentError)&&(v<=k||!p(v)||m&&!_.bitrateTestDelay||v"+H+" adjustedbw("+Math.round(d)+")-bitrate="+Math.round(d-g)+" ttfb:"+k.toFixed(1)+" avgDuration:"+B.toFixed(1)+" maxFetchDuration:"+T.toFixed(1)+" fetchDuration:"+v.toFixed(1)+" firstSelection:"+L+" codecSet:"+R+" videoRange:"+D+" hls.loadLevel:"+O)),L&&(_.firstSelection=H),{v:H}}},H=a;H>=t;H--)if(0!==(b=V())&&b)return b.v;return-1},E(e,[{key:"firstAutoLevel",get:function(){var e=this.hls,t=e.maxAutoLevel,a=e.minAutoLevel,i=this.getBwEstimate(),o=this.hls.config.maxStarvationDelay,n=this.findBestLevel(i,a,t,0,o,1,1);if(n>-1)return n;var r=this.hls.firstLevel,E=Math.min(Math.max(r,a),t);return U.warn("[abr] Could not find best starting auto level. Defaulting to first in playlist "+r+" clamped to "+E),E}},{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})(),Ni=(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(f.BUFFER_APPENDED,this.onBufferAppended,this),e.on(f.FRAG_BUFFERED,this.onFragBuffered,this),e.on(f.FRAG_LOADED,this.onFragLoaded,this)},t._unregisterListeners=function(){var e=this.hls;e.off(f.BUFFER_APPENDED,this.onBufferAppended,this),e.off(f.FRAG_BUFFERED,this.onFragBuffered,this),e.off(f.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 n=o.end;if(o.start<=e&&null!==n&&e<=n)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 n=a[i[o]];if((null==n?void 0:n.body.type)===t&&n.buffered){var r=n.body;if(r.start<=e&&e<=r.end)return r}}return null},t.detectEvictedFragments=function(e,t,a,i){var o=this;this.timeRanges&&(this.timeRanges[e]=t);var n=(null==i?void 0:i.fragment.sn)||-1;Object.keys(this.fragments).forEach((function(i){var r=o.fragments[i];if(r&&!(n>=r.body.sn))if(r.buffered||r.loaded){var E=r.range[e];E&&E.time.some((function(e){var a=!o.isTimeBuffered(e.startPTS,e.endPTS,t);return a&&o.removeFragment(r.body),a}))}else r.body.type===a&&o.removeFragment(r.body)}))},t.detectPartialFragments=function(e){var t=this,a=this.timeRanges,i=e.frag,o=e.part;if(a&&"initSegment"!==i.sn){var n=pi(i),r=this.fragments[n];if(!(!r||r.buffered&&i.gap)){var E=!i.relurl;Object.keys(a).forEach((function(e){var n=i.elementaryStreams[e];if(n){var _=a[e],T=E||!0===n.partial;r.range[e]=t.getBufferedTimes(i,o,T,_)}})),r.loaded=null,Object.keys(r.range).length?(r.buffered=!0,(r.body.endList=i.endList||r.body.endList)&&(this.endListFragments[r.body.type]=r),Di(r)||this.removeParts(i.sn-1,i.type)):this.removeFragment(r.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=pi(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},n=e.start,r=e.end,E=e.minEndPTS||r,_=e.maxStartPTS||n,T=0;T=s&&E<=S){o.time.push({startPTS:Math.max(n,i.start(T)),endPTS:Math.min(r,i.end(T))});break}if(ns){var l=Math.max(n,i.start(T)),I=Math.min(r,i.end(T));I>l&&(o.partial=!0,o.time.push({startPTS:l,endPTS:I}))}else if(r<=s)break}return o},t.getPartialFragment=function(e){var t,a,i,o=null,n=0,r=this.bufferPadding,E=this.fragments;return Object.keys(E).forEach((function(_){var T=E[_];T&&Di(T)&&(a=T.body.start-r,i=T.body.end+r,e>=a&&e<=i&&(t=Math.min(e-a,i-e),n<=t&&(o=T.body,n=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=pi(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,n=0;n=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,n=pi(a);this.fragments[n]={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,n=t.timeRanges;if("initSegment"!==i.sn){var r=i.type;if(o){var E=this.activePartLists[r];E||(this.activePartLists[r]=E=[]),E.push(o)}this.timeRanges=n,Object.keys(n).forEach((function(e){var t=n[e];a.detectEvictedFragments(e,t,r,o)}))}},t.onFragBuffered=function(e,t){this.detectPartialFragments(t)},t.hasFragment=function(e){var t=pi(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 n=this;i&&!this.hasGaps||Object.keys(this.fragments).forEach((function(r){var E=n.fragments[r];if(E){var _=E.body;_.type!==a||i&&!_.gap||_.starte&&(E.buffered||o)&&n.removeFragment(_)}}))},t.removeFragment=function(e){var t=pi(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 pi(e){return e.type+"_"+e.level+"_"+e.sn}var hi={length:0,start:function(){return 0},end:function(){return 0}},Ci=(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,n=e.getBuffered(t),r=[];for(o=0;or&&(i[n-1].end=e[o].end):i.push(e[o])}else i.push(e[o])}else i=e;for(var E,_=0,T=t,s=t,S=0;S=l&&ta.startCC||e&&e.cc>>8^255&d^99,e[I]=d,t[d]=I;var O=l[I],c=l[O],R=l[c],N=257*l[d]^16843008*d;i[I]=N<<24|N>>>8,o[I]=N<<16|N>>>16,n[I]=N<<8|N>>>24,r[I]=N,N=16843009*R^65537*c^257*O^16843008*I,_[d]=N<<24|N>>>8,T[d]=N<<16|N>>>16,s[d]=N<<8|N>>>24,S[d]=N,I?(I=O^l[l[l[R^O]]],u^=l[l[u]]):I=u=1}},t.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),a=!0,i=0;ir.end){var s=n>T;(n<_||s)&&(s&&t.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),t.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}a&&(this.fragmentTracker.removeFragmentsInRange(n,1/0,this.playlistType,!0),this.lastCurrentTime=n),this.loadedmetadata||r.len||(this.nextLoadPosition=this.startPosition=n),this.tickImmediate()},a.onMediaEnded=function(){this.startPosition=this.lastCurrentTime=0},a.onManifestLoaded=function(e,t){this.startTimeOffset=t.startTimeOffset,this.initPTS=[]},a.onHandlerDestroying=function(){this.hls.off(f.MANIFEST_LOADED,this.onManifestLoaded,this),this.stopLoad(),e.prototype.onHandlerDestroying.call(this),this.hls=null},a.onHandlerDestroyed=function(){this.state=Xi.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,e.prototype.onHandlerDestroyed.call(this)},a.loadFragment=function(e,t,a){this._loadFragForPlayback(e,t,a)},a._loadFragForPlayback=function(e,t,a){var i=this,o=function(t){if(i.fragContextChanged(e))return i.warn("Fragment "+e.sn+(t.part?" p: "+t.part.index:"")+" of level "+e.level+" was dropped during download."),void i.fragmentTracker.removeFragment(e);e.stats.chunkCount++,i._handleFragmentLoadProgress(t)};this._doFragLoad(e,t,a,o).then((function(t){if(t){var a=i.state;i.fragContextChanged(e)?(a===Xi.FRAG_LOADING||!i.fragCurrent&&a===Xi.PARSING)&&(i.fragmentTracker.removeFragment(e),i.state=Xi.IDLE):("payload"in t&&(i.log("Loaded fragment "+e.sn+" of level "+e.level),i.hls.trigger(f.FRAG_LOADED,t)),i._handleFragmentLoadComplete(t))}})).catch((function(t){i.state!==Xi.STOPPED&&i.state!==Xi.ERROR&&(i.warn(t),i.resetFragmentLoading(e))}))},a.clearTrackerIfNeeded=function(e){var t,a=this.fragmentTracker;if(a.getState(e)===mi.APPENDING){var i=e.type,o=this.getFwdBufferInfo(this.mediaBuffer,i),n=Math.max(e.duration,o?o.len:this.config.maxBufferLength);this.reduceMaxBufferLength(n)&&a.removeFragment(e)}else 0===(null==(t=this.mediaBuffer)?void 0:t.buffered.length)?a.removeAllFragments():a.hasParts(e.type)&&(a.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),a.getState(e)===mi.PARTIAL&&a.removeFragment(e))},a.checkLiveUpdate=function(e){if(e.updated&&!e.live){var t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)},a.flushMainBuffer=function(e,t,a){if(void 0===a&&(a=null),e-t){var i={startOffset:e,endOffset:t,type:a};this.hls.trigger(f.BUFFER_FLUSHING,i)}},a._loadInitSegment=function(e,t){var a=this;this._doFragLoad(e,t).then((function(t){if(!t||a.fragContextChanged(e)||!a.levels)throw new Error("init load aborted");return t})).then((function(t){var i=a.hls,o=t.payload,n=e.decryptdata;if(o&&o.byteLength>0&&null!=n&&n.key&&n.iv&&"AES-128"===n.method){var r=self.performance.now();return a.decrypter.decrypt(new Uint8Array(o),n.key.buffer,n.iv.buffer).catch((function(t){throw i.trigger(f.ERROR,{type:P.MEDIA_ERROR,details:B.FRAG_DECRYPT_ERROR,fatal:!1,error:t,reason:t.message,frag:e}),t})).then((function(o){var n=self.performance.now();return i.trigger(f.FRAG_DECRYPTED,{frag:e,payload:o,stats:{tstart:r,tdecrypt:n}}),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,n,r=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:"+(r?Qi.toString(Ci.getBuffered(r)):"(detached)")+")"),"initSegment"!==e.sn){var E;if(e.type!==$t.SUBTITLE){var _=e.elementaryStreams;if(!Object.keys(_).some((function(e){return!!_[e]})))return void(this.state=Xi.IDLE)}var T=null==(E=this.levels)?void 0:E[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,r&&(!this.loadedmetadata&&e.type==$t.MAIN&&r.buffered.length&&(null==(o=this.fragCurrent)?void 0:o.sn)===(null==(n=this.fragPrevious)?void 0:n.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,n=!o||0===o.length||o.some((function(e){return!e})),r=new fi(a.level,a.sn,a.stats.chunkCount+1,0,i?i.index:-1,!n);t.flush(r)}},a._handleFragmentLoadProgress=function(e){},a._doFragLoad=function(e,t,a,i){var o,n=this;void 0===a&&(a=null);var r=null==t?void 0:t.details;if(!this.levels||!r)throw new Error("frag load aborted, missing level"+(r?"":" detail")+"s");var E=null;if(!e.encrypted||null!=(o=e.decryptdata)&&o.key?!e.encrypted&&r.encryptedFragments.length&&this.keyLoader.loadClear(e,r.encryptedFragments):(this.log("Loading key for "+e.sn+" of ["+r.startSN+"-"+r.endSN+"], "+("[stream-controller]"===this.logPrefix?"level":"track")+" "+e.level),this.state=Xi.KEY_LOADING,this.fragCurrent=e,E=this.keyLoader.load(e).then((function(e){if(!n.fragContextChanged(e.frag))return n.hls.trigger(f.KEY_LOADED,e),n.state===Xi.KEY_LOADING&&(n.state=Xi.IDLE),e})),this.hls.trigger(f.KEY_LOADING,{frag:e}),null===this.fragCurrent&&(E=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.partList;if(_&&i){a>e.end&&r.fragmentHint&&(e=r.fragmentHint);var T=this.getNextPart(_,e,a);if(T>-1){var s,S=_[T];return this.log("Loading part sn: "+e.sn+" p: "+S.index+" cc: "+e.cc+" of playlist ["+r.startSN+"-"+r.endSN+"] parts [0-"+T+"-"+(_.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=E?E.then((function(a){return!a||n.fragContextChanged(a.frag)?null:n.doFragPartsLoad(e,S,t,i)})).catch((function(e){return n.handleFragLoadError(e)})):this.doFragPartsLoad(e,S,t,i).catch((function(e){return n.handleFragLoadError(e)})),this.hls.trigger(f.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(_,a))return Promise.resolve(null)}}this.log("Loading fragment "+e.sn+" cc: "+e.cc+" "+(r?"of ["+r.startSN+"-"+r.endSN+"] ":"")+("[stream-controller]"===this.logPrefix?"level":"track")+": "+e.level+", target: "+parseFloat(a.toFixed(3))),p(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=Xi.FRAG_LOADING;var l,I=this.config.progressive;return l=I&&E?E.then((function(t){return!t||n.fragContextChanged(null==t?void 0:t.frag)?null:n.fragmentLoader.load(e,i)})).catch((function(e){return n.handleFragLoadError(e)})):Promise.all([this.fragmentLoader.load(e,I?i:void 0),E]).then((function(e){var t=e[0];return!I&&t&&i&&i(t),t})).catch((function(e){return n.handleFragLoadError(e)})),this.hls.trigger(f.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(n,r){var E,_=[],T=null==(E=a.details)?void 0:E.partList;!(function t(E){o.fragmentLoader.loadPart(e,E,i).then((function(i){_[E.index]=i;var r=i.part;o.hls.trigger(f.FRAG_LOADED,i);var s=ba(a,e.sn,E.index+1)||Ua(T,e.sn,E.index+1);if(!s)return n({frag:e,part:r,partsLoaded:_});t(s)})).catch(r)})(t)}))},a.handleFragLoadError=function(e){if("data"in e){var t=e.data;e.data&&t.details===B.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(f.ERROR,t)}else this.hls.trigger(f.ERROR,{type:P.OTHER_ERROR,details:B.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,n=self.performance.now();a.stats.parsing.end=n,i&&(i.stats.parsing.end=n),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,n=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 r=t[i],E=n>-1?ba(r,o,n):null,_=E?E.fragment:ya(r,o,a);return _?(a&&a!==_&&(_.stats=a.stats),{frag:_,part:E,level:r}):null},a.bufferFragmentData=function(e,t,a,i,o){var n;if(e&&this.state===Xi.PARSING){var r=e.data1,E=e.data2,_=r;if(r&&E&&(_=at(r,E)),null!=(n=_)&&n.length){var T={type:e.type,frag:t,part:a,chunkMeta:i,parent:t.type,data:_};if(this.hls.trigger(f.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(Ci.isBuffered(t,t.currentTime)){var a=t.currentTime,i=Ci.bufferInfo(t,a,0),o=e.duration,n=Math.min(2*this.config.maxFragLookUpTolerance,.25*o),r=Math.max(Math.min(e.start-n,i.end-n),a+n);e.start-r>n&&this.flushMainBuffer(r,e.start)}else this.flushMainBuffer(0,e.start)},a.getFwdBufferInfo=function(e,t){var a=this.getLoadPosition();return p(a)?this.getFwdBufferInfoAtPos(e,a,t):null},a.getFwdBufferInfoAtPos=function(e,t,a){var i=this.config.maxBufferHole,o=Ci.bufferInfo(e,t,i);if(0===o.len&&void 0!==o.nextStart){var n=this.fragmentTracker.getBufferedFrag(t,a);if(n&&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,n=this.config,r=a[0].start;if(t.live){var E=n.initialLiveManifestSize;if(it},a.getNextFragmentLoopLoading=function(e,t,a,i,o){var n=e.gap,r=this.getNextFragment(this.nextLoadPosition,t);if(null===r)return r;if(e=r,n&&e&&!e.gap&&a.nextStart){var E=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,a.nextStart,i);if(null!==E&&a.len+E.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,n=!0,r=0,E=e.length;r-1&&a<_.start)break;var T=_.loaded;T?i=-1:(o||_.independent||n)&&_.fragment===t&&(i=r),o=T}return i},a.loadedEndOfParts=function(e,t){var a=e[e.length-1];return a&&t>a.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 n=t[o-e.startSN];a.cc===n.cc&&(i=n,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 r=this.hls.liveSyncPosition;null!==r&&(i=this.getFragmentAtPosition(r,this.bitrateTest?e.fragmentEnd:e.edge,e))}return i},a.getFragmentAtPosition=function(e,t,a){var i,o=this.config,n=this.fragPrevious,r=a.fragments,E=a.endSN,_=a.fragmentHint,T=o.maxFragLookUpTolerance,s=a.partList,S=!!(o.lowLatencyMode&&null!=s&&s.length&&_);if(S&&_&&!this.bitrateTest&&(r=r.concat(_),E=_.sn),i=et-T?0:T):r[r.length-1]){var l=i.sn-a.startSN,I=this.fragmentTracker.getState(i);if((I===mi.OK||I===mi.PARTIAL&&i.gap)&&(n=i),n&&i.sn===n.sn&&(!S||s[0].fragment.sn>i.sn)&&n&&i.level===n.level){var u=r[l+1];i=i.sn=n-t.maxFragLookUpTolerance&&o<=r;if(null!==i&&a.duration>i&&(o"+e.startSN+" prev-sn: "+(E?E.sn:"na")+" fragments: "+i),_}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 n=t.details===B.FRAG_GAP;n&&this.fragmentTracker.fragBuffered(i,!0);var r=t.errorAction,E=r||{},_=E.action,T=E.retryCount,s=void 0===T?0:T,S=E.retryConfig;if(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"),r.resolved=!0,this.retryDate=self.performance.now()+l,this.state=Xi.FRAG_LOADING_WAITING_RETRY}else if(S&&r){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=Ci.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,n=this,r=a.details;if(r){if(!Object.keys(e.elementaryStreams).reduce((function(t,o){var E=e.elementaryStreams[o];if(E){var _=E.endPTS-E.startPTS;if(_<=0)return n.warn("Could not parse fragment "+e.sn+" "+o+" duration reliably ("+_+")"),t||!1;var T=i?0:Ca(r,e,E.startPTS,E.endPTS,E.startDTS,E.endDTS);return n.hls.trigger(f.LEVEL_PTS_UPDATED,{details:r,level:a,drift:T,type:o,frag:e,start:E.startPTS,end:E.endPTS}),!0}return t}),!1)&&null===(null==(o=this.transmuxer)?void 0:o.error)){var E=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(E.message),this.hls.trigger(f.ERROR,{type:P.MEDIA_ERROR,details:B.FRAG_PARSING_ERROR,fatal:!1,error:E,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(f.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())},E(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})(Ni),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&&r.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Ea.audioId3,duration:Number.POSITIVE_INFINITY});o<_;){if(this.canParse(e,o)){var T=this.appendFrame(n,e,o);T?(this.frameIndex++,this.lastPTS=T.sample.pts,a=o+=T.length):o=_}else Re(e,o)?(i=Oe(e,o),r.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:i,type:Ea.audioId3,duration:Number.POSITIVE_INFINITY}),a=o+=i.length):o++;if(o===_&&a!==_){var s=Ie(e,a);this.cachedData?this.cachedData=at(this.cachedData,s):this.cachedData=s}}return{audioTrack:n,videoTrack:Zi(),id3Track:r,textTrack:Zi()}},t.demuxSampleAes=function(e,t,a){return Promise.reject(new Error("["+this+"] This demuxer does not support Sample-AES decryption"))},t.flush=function(e){var t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:Zi(),id3Track:this._id3Track,textTrack:Zi()}},t.destroy=function(){},e})(),to=function(e,t,a){return p(e)?90*e:9e4*t+(a?9e4*a.baseTime/a.timescale:0)};function ao(e,t,a,i){var o,n,r,E,_=navigator.userAgent.toLowerCase(),T=i,s=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];o=1+((192&t[a+2])>>>6);var S=(60&t[a+2])>>>2;if(!(S>s.length-1))return r=(1&t[a+2])<<2,r|=(192&t[a+3])>>>6,U.log("manifest codec:"+i+", ADTS type:"+o+", samplingIndex:"+S),/firefox/i.test(_)?S>=6?(o=5,E=new Array(4),n=S-3):(o=2,E=new Array(2),n=S):-1!==_.indexOf("android")?(o=2,E=new Array(2),n=S):(o=5,E=new Array(4),i&&(-1!==i.indexOf("mp4a.40.29")||-1!==i.indexOf("mp4a.40.5"))||!i&&S>=6?n=S-3:((i&&-1!==i.indexOf("mp4a.40.2")&&(S>=6&&1===r||/vivaldi/i.test(_))||!i&&1===r)&&(o=2,E=new Array(2)),n=S)),E[0]=o<<3,E[0]|=(14&S)>>1,E[1]|=(1&S)<<7,E[1]|=r<<3,5===o&&(E[1]|=(14&n)>>1,E[2]=(1&n)<<7,E[2]|=8,E[3]=0),{config:E,samplerate:s[S],channelCount:r,codec:"mp4a.40."+o,manifestCodec:T};var l=new Error("invalid ADTS sampling index:"+S);e.emit(f.ERROR,f.ERROR,{type:P.MEDIA_ERROR,details:B.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 no(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function ro(e,t){return t+5=e.length)return!1;var i=no(e,t);if(i<=a)return!1;var o=t+i;return o===e.length||Eo(e,o)}return!1}function so(e,t,a,i,o){if(!e.samplerate){var n=ao(t,a,i,o);if(!n)return;e.config=n.config,e.samplerate=n.samplerate,e.channelCount=n.channelCount,e.codec=n.codec,e.manifestCodec=n.manifestCodec,U.log("parsed codec:"+e.codec+", rate:"+n.samplerate+", channels:"+n.channelCount)}}function So(e){return 9216e4/e}function lo(e,t){var a=oo(e,t);if(t+a<=e.length){var i=no(e,t)-a;if(i>0)return{headerLength:a,frameLength:i}}}function Io(e,t,a,i,o){var n,r=i+o*So(e.samplerate),E=lo(t,a);if(E){var _=E.frameLength,T=E.headerLength,s=T+_,S=Math.max(0,a+s-t.length);S?(n=new Uint8Array(s-T)).set(t.subarray(a+T,t.length),0):n=t.subarray(a+T,a+s);var l={unit:n,pts:r};return S||e.samples.push(l),{sample:l,length:s,missing:S}}var I=t.length-a;return(n=new Uint8Array(I)).set(t.subarray(a,t.length),0),{sample:{unit:n,pts:r},length:I,missing:-1}}var uo=null,Ao=[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],Oo=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],co=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Ro=[0,1,1,4];function No(e,t,a,i,o){if(!(a+24>t.length)){var n=mo(t,a);if(n&&a+n.frameLength<=t.length){var r=i+o*(9e4*n.samplesPerFrame/n.sampleRate),E={unit:t.subarray(a,a+n.frameLength),pts:r,dts:r};return e.config=[],e.channelCount=n.channelCount,e.samplerate=n.sampleRate,e.samples.push(E),{sample:E,length:n.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,n=e[t+2]>>2&3;if(1!==a&&0!==o&&15!==o&&3!==n){var r=e[t+2]>>1&1,E=e[t+3]>>6,_=1e3*Ao[14*(3===a?3-i:3===i?3:4)+o-1],T=Oo[3*(3===a?0:2===a?1:2)+n],s=3===E?1:2,S=co[a][i],l=Ro[i],I=8*S*l,u=Math.floor(S*_/T+r)*l;if(null===uo){var A=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);uo=A?parseInt(A[1]):0}return!!uo&&uo<=87&&2===i&&_>=224e3&&0===E&&(e[t+3]=128|e[t+3]),{sampleRate:T,channelCount:s,frameLength:u,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;){r[0]=e[t];var E=Math.min(i,8),_=8-E;n[0]=4278190080>>>24+_<<_,o[0]=(r[0]&n[0])>>_,a=a?a<t.length)return-1;if(11!==t[a]||119!==t[a+1])return-1;var n=t[a+4]>>6;if(n>=3)return-1;var r=[48e3,44100,32e3][n],E=63&t[a+4],_=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+n];if(a+_>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,u=7&t[a+5],A=new Uint8Array([n<<6|I<<1|u>>2,(3&u)<<6|T<<3|S<<2|E>>4,E<<4&224]),d=i+o*(1536/r*9e4),O=t.subarray(a,a+_);return e.config=A,e.channelCount=l,e.samplerate=r,e.samples.push({unit:O,pts:d}),_}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&&U.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&&U.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=_)&&S.frame&&!_.key&&(r.pushAccessUnit(_,e),_=r.VideoSample=null),_||(_=r.VideoSample=r.createVideoSample(!0,a.pts,a.dts,"")),_.frame=!0,_.key=s;break;case 5:n=!0,null!=(E=_)&&E.frame&&!_.key&&(r.pushAccessUnit(_,e),_=r.VideoSample=null),_||(_=r.VideoSample=r.createVideoSample(!0,a.pts,a.dts,"")),_.key=!0,_.frame=!0;break;case 6:n=!0,rt(i.data,1,a.pts,t.samples);break;case 7:var u,A;n=!0,T=!0;var d=i.data,O=new Wo(d).readSPS();if(!e.sps||e.width!==O.width||e.height!==O.height||(null==(u=e.pixelRatio)?void 0:u[0])!==O.pixelRatio[0]||(null==(A=e.pixelRatio)?void 0:A[1])!==O.pixelRatio[1]){e.width=O.width,e.height=O.height,e.pixelRatio=O.pixelRatio,e.sps=[d],e.duration=o;for(var c=d.subarray(1,4),R="avc1.",N=0;N<3;N++){var m=c[N].toString(16);m.length<2&&(m="0"+m),R+=m}e.codec=R}break;case 8:n=!0,e.pps=[i.data];break;case 9:n=!0,e.audFound=!0,_&&r.pushAccessUnit(_,e),_=r.VideoSample=r.createVideoSample(!1,a.pts,a.dts,"");break;case 12:n=!0;break;default:n=!1,_&&(_.debug+="unknown NAL "+i.type+" ")}_&&n&&_.units.push(i)})),i&&_&&(this.pushAccessUnit(_,e),this.VideoSample=null)},a.parseAVCNALu=function(e,t){var a,i,o=t.byteLength,n=e.naluState||0,r=n,E=[],_=0,T=-1,s=0;for(-1===n&&(T=0,s=31&t[0],n=0,_=1);_=0){var S={data:t.subarray(T,i),type:s};E.push(S)}else{var l=this.getLastNalUnit(e.samples);l&&(r&&_<=4-r&&l.state&&(l.data=l.data.subarray(0,l.data.byteLength-r)),i>0&&(l.data=at(l.data,t.subarray(0,i)),l.state=0))}_=0&&n>=0){var I={data:t.subarray(T,o),type:s,state:n};E.push(I)}if(0===E.length){var u=this.getLastNalUnit(e.samples);u&&(u.data=at(u.data,t))}return e.naluState=n,E},t})(Mo),bo=(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 n=o.subarray(16,o.length-o.length%16),r=n.buffer.slice(n.byteOffset,n.byteOffset+n.length);this.decryptBuffer(r).then((function(n){var r=new Uint8Array(n);o.set(r,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 n=o[a];if(!(n.data.length<=48||1!==n.type&&5!==n.type||(this.decryptAvcSample(e,t,a,i,n),this.decrypter.isSync())))return}}},e})(),Uo=188,Go=(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 yo}e.probe=function(t){var a=e.syncOffset(t);return a>0&&U.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*Uo,t-Uo)+1,i=0;i1&&(0===n&&r>2||E+Uo>a))return n}i++}return-1},e.createTrack=function(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:ye[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 n;void 0===i&&(i=!1),void 0===o&&(o=!1),i||(this.sampleAes=null);var r=this._videoTrack,E=this._audioTrack,_=this._id3Track,T=this._txtTrack,s=r.pid,S=r.pesData,l=E.pid,I=_.pid,u=E.pesData,A=_.pesData,d=null,O=this.pmtParsed,c=this._pmtId,R=t.length;if(this.remainderData&&(R=(t=at(this.remainderData,t)).length,this.remainderData=null),R>4>1){if((h=L+5+t[L+4])===L+Uo)continue}else h=L+4;switch(p){case s:D&&(S&&(n=wo(S))&&this.videoParser.parseAVCPES(r,T,n,!1,this._duration),S={data:[],size:0}),S&&(S.data.push(t.subarray(h,L+Uo)),S.size+=L+Uo-h);break;case l:if(D){if(u&&(n=wo(u)))switch(E.segmentCodec){case"aac":this.parseAACPES(E,n);break;case"mp3":this.parseMPEGPES(E,n);break;case"ac3":this.parseAC3PES(E,n)}u={data:[],size:0}}u&&(u.data.push(t.subarray(h,L+Uo)),u.size+=L+Uo-h);break;case I:D&&(A&&(n=wo(A))&&this.parseID3PES(_,n),A={data:[],size:0}),A&&(A.data.push(t.subarray(h,L+Uo)),A.size+=L+Uo-h);break;case 0:D&&(h+=t[h]+1),c=this._pmtId=Fo(t,h);break;case c:D&&(h+=t[h]+1);var C=Vo(t,h,this.typeSupported,i);(s=C.videoPid)>0&&(r.pid=s,r.segmentCodec=C.segmentVideoCodec),(l=C.audioPid)>0&&(E.pid=l,E.segmentCodec=C.segmentAudioCodec),(I=C.id3Pid)>0&&(_.pid=I),null===d||O||(U.warn("MPEG-TS PMT found at "+L+" after unknown PID '"+d+"'. Backtracking to sync byte @"+N+" to parse all TS packets."),d=null,L=N-188),O=this.pmtParsed=!0;break;case 17:case 8191:break;default:d=p}}else m++;if(m>0){var g=new Error("Found "+m+" TS packet/s that do not start with 0x47");this.observer.emit(f.ERROR,f.ERROR,{type:P.MEDIA_ERROR,details:B.FRAG_PARSING_ERROR,fatal:!1,error:g,reason:g.message})}r.pesData=S,E.pesData=u,_.pesData=A;var v={audioTrack:E,videoTrack:r,id3Track:_,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,n=e.textTrack,r=i.pesData,E=a.pesData,_=o.pesData;if(r&&(t=wo(r))?(this.videoParser.parseAVCPES(i,n,t,!0,this._duration),i.pesData=null):i.pesData=r,E&&(t=wo(E))){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!=E&&E.size&&U.log("last AAC PES packet truncated,might overlap between fragments"),a.pesData=E;_&&(t=wo(_))?(this.parseID3PES(o,t),o.pesData=null):o.pesData=_},t.demuxSampleAes=function(e,t,a){var i=this.demux(e,a,!0,!this.config.progressive),o=this.sampleAes=new bo(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,n=0,r=this.aacOverFlow,E=t.data;if(r){this.aacOverFlow=null;var _=r.missing,T=r.sample.unit.byteLength;if(-1===_)E=at(r.sample.unit,E);else{var s=T-_;r.sample.unit.set(E.subarray(0,_),s),e.samples.push(r.sample),n=r.missing}}for(a=n,i=E.length;a