From 20e694d20f108b6327d57300a45fe42e0f150223 Mon Sep 17 00:00:00 2001 From: kKaskak Date: Sat, 25 Jul 2026 11:30:32 +0000 Subject: [PATCH] deploy: daf74b0ec973054c94de9f0f8271b3234bd26c43 --- .../binaries/stremio_core_web_bg.wasm | Bin .../scripts/main.js | 2 +- .../scripts/main.js.map | 2 +- .../scripts/worker.js | 2 +- .../scripts/worker.js.map | 2 +- .../styles/main.css | 0 .../styles/main.css.map | 2 +- development/index.html | 2 +- development/service-worker.js | 2 +- development/service-worker.js.map | 2 +- 10 files changed, 8 insertions(+), 8 deletions(-) rename development/{b843cb88dad2c3e0a24730f3cb5d4def2c6eb35e => daf74b0ec973054c94de9f0f8271b3234bd26c43}/binaries/stremio_core_web_bg.wasm (100%) rename development/{b843cb88dad2c3e0a24730f3cb5d4def2c6eb35e => daf74b0ec973054c94de9f0f8271b3234bd26c43}/scripts/main.js (99%) rename development/{b843cb88dad2c3e0a24730f3cb5d4def2c6eb35e => daf74b0ec973054c94de9f0f8271b3234bd26c43}/scripts/main.js.map (99%) rename development/{b843cb88dad2c3e0a24730f3cb5d4def2c6eb35e => daf74b0ec973054c94de9f0f8271b3234bd26c43}/scripts/worker.js (99%) rename development/{b843cb88dad2c3e0a24730f3cb5d4def2c6eb35e => daf74b0ec973054c94de9f0f8271b3234bd26c43}/scripts/worker.js.map (99%) rename development/{b843cb88dad2c3e0a24730f3cb5d4def2c6eb35e => daf74b0ec973054c94de9f0f8271b3234bd26c43}/styles/main.css (100%) rename development/{b843cb88dad2c3e0a24730f3cb5d4def2c6eb35e => daf74b0ec973054c94de9f0f8271b3234bd26c43}/styles/main.css.map (99%) diff --git a/development/b843cb88dad2c3e0a24730f3cb5d4def2c6eb35e/binaries/stremio_core_web_bg.wasm b/development/daf74b0ec973054c94de9f0f8271b3234bd26c43/binaries/stremio_core_web_bg.wasm similarity index 100% rename from development/b843cb88dad2c3e0a24730f3cb5d4def2c6eb35e/binaries/stremio_core_web_bg.wasm rename to development/daf74b0ec973054c94de9f0f8271b3234bd26c43/binaries/stremio_core_web_bg.wasm diff --git a/development/b843cb88dad2c3e0a24730f3cb5d4def2c6eb35e/scripts/main.js b/development/daf74b0ec973054c94de9f0f8271b3234bd26c43/scripts/main.js similarity index 99% rename from development/b843cb88dad2c3e0a24730f3cb5d4def2c6eb35e/scripts/main.js rename to development/daf74b0ec973054c94de9f0f8271b3234bd26c43/scripts/main.js index cfdf3dce3..2a44ec6bb 100644 --- a/development/b843cb88dad2c3e0a24730f3cb5d4def2c6eb35e/scripts/main.js +++ b/development/daf74b0ec973054c94de9f0f8271b3234bd26c43/scripts/main.js @@ -1,2 +1,2 @@ -(()=>{var e,t,E,a,i={64969(e,t,E){"use strict";function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t=1;tl,B6:()=>f,G3:()=>oe,Gh:()=>y,HC:()=>Q,HS:()=>b,HW:()=>ie,Oi:()=>S,Pq:()=>H,RO:()=>W,Rr:()=>A,Sk:()=>x,TM:()=>r,V2:()=>j,VV:()=>X,aE:()=>Se,o1:()=>M,pX:()=>$,pb:()=>g,rc:()=>i,ro:()=>L,sC:()=>_,tH:()=>Y,tW:()=>h,ue:()=>d,v6:()=>z,yD:()=>G,zR:()=>n}),(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(i||(i={}));const o="popstate";function _(e){void 0===e&&(e={});let t,{initialEntries:E=["/"],initialIndex:a,v5Compat:o=!1}=e;t=E.map((e,t)=>O(e,"string"==typeof e?null:e.state,0===t?"default":void 0));let _=S(null==a?t.length-1:a),n=i.Pop,r=null;function S(e){return Math.min(Math.max(e,0),t.length-1)}function s(){return t[_]}function O(e,E,a){void 0===E&&(E=null);let i=I(t?s().pathname:"/",e,E,a);return T("/"===i.pathname.charAt(0),"relative pathnames are not supported in memory history: "+JSON.stringify(e)),i}function u(e){return"string"==typeof e?e:l(e)}return{get index(){return _},get action(){return n},get location(){return s()},createHref:u,createURL(e){return new URL(u(e),"http://localhost")},encodeLocation(e){let t="string"==typeof e?A(e):e;return{pathname:t.pathname||"",search:t.search||"",hash:t.hash||""}},push(e,E){n=i.Push;let a=O(e,E);_+=1,t.splice(_,t.length,a),o&&r&&r({action:n,location:a,delta:1})},replace(e,E){n=i.Replace;let a=O(e,E);t[_]=a,o&&r&&r({action:n,location:a,delta:0})},go(e){n=i.Pop;let E=S(_+e),a=t[E];_=E,r&&r({action:n,location:a,delta:e})},listen(e){return r=e,()=>{r=null}}}}function n(e){return void 0===e&&(e={}),O(function(e,t){let{pathname:E,search:a,hash:i}=e.location;return I("",{pathname:E,search:a,hash:i},t.state&&t.state.usr||null,t.state&&t.state.key||"default")},function(e,t){return"string"==typeof t?t:l(t)},null,e)}function r(e){return void 0===e&&(e={}),O(function(e,t){let{pathname:E="/",search:a="",hash:i=""}=A(e.location.hash.substr(1));return E.startsWith("/")||E.startsWith(".")||(E="/"+E),I("",{pathname:E,search:a,hash:i},t.state&&t.state.usr||null,t.state&&t.state.key||"default")},function(e,t){let E=e.document.querySelector("base"),a="";if(E&&E.getAttribute("href")){let t=e.location.href,E=t.indexOf("#");a=-1===E?t:t.slice(0,E)}return a+"#"+("string"==typeof t?t:l(t))},function(e,t){T("/"===e.pathname.charAt(0),"relative pathnames are not supported in hash history.push("+JSON.stringify(t)+")")},e)}function S(e,t){if(!1===e||null==e)throw new Error(t)}function T(e,t){if(!e){"undefined"!=typeof console&&console.warn(t);try{throw new Error(t)}catch(e){}}}function s(e,t){return{usr:e.state,key:e.key,idx:t}}function I(e,t,E,i){return void 0===E&&(E=null),a({pathname:"string"==typeof e?e:e.pathname,search:"",hash:""},"string"==typeof t?A(t):t,{state:E,key:t&&t.key||i||Math.random().toString(36).substr(2,8)})}function l(e){let{pathname:t="/",search:E="",hash:a=""}=e;return E&&"?"!==E&&(t+="?"===E.charAt(0)?E:"?"+E),a&&"#"!==a&&(t+="#"===a.charAt(0)?a:"#"+a),t}function A(e){let t={};if(e){let E=e.indexOf("#");E>=0&&(t.hash=e.substr(E),e=e.substr(0,E));let a=e.indexOf("?");a>=0&&(t.search=e.substr(a),e=e.substr(0,a)),e&&(t.pathname=e)}return t}function O(e,t,E,_){void 0===_&&(_={});let{window:n=document.defaultView,v5Compat:r=!1}=_,T=n.history,A=i.Pop,O=null,u=R();function R(){return(T.state||{idx:null}).idx}function N(){A=i.Pop;let e=R(),t=null==e?null:e-u;u=e,O&&O({action:A,location:c.location,delta:t})}function d(e){let t="null"!==n.location.origin?n.location.origin:n.location.href,E="string"==typeof e?e:l(e);return E=E.replace(/ $/,"%20"),S(t,"No window.location.(origin|href) available to create URL for href: "+E),new URL(E,t)}null==u&&(u=0,T.replaceState(a({},T.state,{idx:u}),""));let c={get action(){return A},get location(){return e(n,T)},listen(e){if(O)throw new Error("A history only accepts one active listener");return n.addEventListener(o,N),O=e,()=>{n.removeEventListener(o,N),O=null}},createHref(e){return t(n,e)},createURL:d,encodeLocation(e){let t=d(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){A=i.Push;let a=I(c.location,e,t);E&&E(a,e),u=R()+1;let o=s(a,u),_=c.createHref(a);try{T.pushState(o,"",_)}catch(e){if(e instanceof DOMException&&"DataCloneError"===e.name)throw e;n.location.assign(_)}r&&O&&O({action:A,location:c.location,delta:1})},replace:function(e,t){A=i.Replace;let a=I(c.location,e,t);E&&E(a,e),u=R();let o=s(a,u),_=c.createHref(a);T.replaceState(o,"",_),r&&O&&O({action:A,location:c.location,delta:0})},go(e){return T.go(e)}};return c}var u;!(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(u||(u={}));const R=new Set(["lazy","caseSensitive","path","id","index","children"]);function N(e,t,E,i){return void 0===E&&(E=[]),void 0===i&&(i={}),e.map((e,o)=>{let _=[...E,String(o)],n="string"==typeof e.id?e.id:_.join("-");if(S(!0!==e.index||!e.children,"Cannot specify children on an index route"),S(!i[n],'Found a route id collision on id "'+n+"\". Route id's must be globally unique within Data Router usages"),(function(e){return!0===e.index})(e)){let E=a({},e,t(e),{id:n});return i[n]=E,E}{let E=a({},e,t(e),{id:n,children:void 0});return i[n]=E,e.children&&(E.children=N(e.children,t,_,i)),E}})}function d(e,t,E){return void 0===E&&(E="/"),c(e,t,E,!1)}function c(e,t,E,a){let i=g(("string"==typeof t?A(t):t).pathname||"/",E);if(null==i)return null;let o=m(e);!(function(e){e.sort((e,t)=>e.score!==t.score?t.score-e.score:(function(e,t){let E=e.length===t.length&&e.slice(0,-1).every((e,E)=>e===t[E]);return E?e[e.length-1]-t[t.length-1]:0})(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)))})(o);let _=null;for(let e=0;null==_&&e{let _={relativePath:void 0===o?e.path||"":o,caseSensitive:!0===e.caseSensitive,childrenIndex:i,route:e};_.relativePath.startsWith("/")&&(S(_.relativePath.startsWith(a),'Absolute route path "'+_.relativePath+'" nested under path "'+a+'" is not valid. An absolute child route path must start with the combined path of all its parent routes.'),_.relativePath=_.relativePath.slice(a.length));let n=b([a,_.relativePath]),r=E.concat(_);e.children&&e.children.length>0&&(S(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+n+'".'),m(e.children,t,r,n)),(null!=e.path||e.index)&&t.push({path:n,score:P(n,e.index),routesMeta:r})};return e.forEach((e,t)=>{var E;if(""!==e.path&&null!=(E=e.path)&&E.includes("?"))for(let E of D(e.path))i(e,t,E);else i(e,t)}),t}function D(e){let t=e.split("/");if(0===t.length)return[];let[E,...a]=t,i=E.endsWith("?"),o=E.replace(/\?$/,"");if(0===a.length)return i?[o,""]:[o];let _=D(a.join("/")),n=[];return n.push(..._.map(e=>""===e?o:[o,e].join("/"))),i&&n.push(..._),n.map(t=>e.startsWith("/")&&""===t?"/":t)}const C=/^:[\w-]+$/,p=e=>"*"===e;function P(e,t){let E=e.split("/"),a=E.length;return E.some(p)&&(a+=-2),t&&(a+=2),E.filter(e=>!p(e)).reduce((e,t)=>e+(C.test(t)?3:""===t?1:10),a)}function B(e,t,E){void 0===E&&(E=!1);let{routesMeta:a}=e,i={},o="/",_=[];for(let e=0;enull==e?"":"string"==typeof e?e:String(e);return a+E.split(/\/+/).map((e,E,a)=>{if(E===a.length-1&&"*"===e){return i(t["*"])}const o=e.match(/^:([\w-]+)(\??)$/);if(o){const[,e,E]=o;let a=t[e];return S("?"===E||null!=a,'Missing ":'+e+'" param'),i(a)}return e.replace(/\?$/g,"")}).filter(e=>!!e).join("/")}function f(e,t){"string"==typeof e&&(e={path:e,caseSensitive:!1,end:!0});let[E,a]=(function(e,t,E){void 0===t&&(t=!1);void 0===E&&(E=!0);T("*"===e||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were "'+e.replace(/\*$/,"/*")+'" because the `*` character must always follow a `/` in the pattern. To get rid of this warning, please change the route path to "'+e.replace(/\*$/,"/*")+'".');let a=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(e,t,E)=>(a.push({paramName:t,isOptional:null!=E}),E?"/?([^\\/]+)?":"/([^\\/]+)"));e.endsWith("*")?(a.push({paramName:"*"}),i+="*"===e||"/*"===e?"(.*)$":"(?:\\/(.+)|\\/*)$"):E?i+="\\/*$":""!==e&&"/"!==e&&(i+="(?:(?=\\/|$))");let o=new RegExp(i,t?void 0:"i");return[o,a]})(e.path,e.caseSensitive,e.end),i=t.match(E);if(!i)return null;let o=i[0],_=o.replace(/(.)\/+$/,"$1"),n=i.slice(1);return{params:a.reduce((e,t,E)=>{let{paramName:a,isOptional:i}=t;if("*"===a){let e=n[E]||"";_=o.slice(0,o.length-e.length).replace(/(.)\/+$/,"$1")}const r=n[E];return e[a]=i&&!r?void 0:(r||"").replace(/%2F/g,"/"),e},{}),pathname:o,pathnameBase:_,pattern:e}}function W(e){try{return e.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(t){return T(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding ('+t+")."),e}}function g(e,t){if("/"===t)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let E=t.endsWith("/")?t.length-1:t.length,a=e.charAt(E);return a&&"/"!==a?null:e.slice(E)||"/"}function M(e,t){void 0===t&&(t="/");let{pathname:E,search:a="",hash:i=""}="string"==typeof e?A(e):e,o=E?E.startsWith("/")?E:(function(e,t){let E=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(e=>{".."===e?E.length>1&&E.pop():"."!==e&&E.push(e)}),E.length>1?E.join("/"):"/"})(E,t):t;return{pathname:o,search:F(a),hash:V(i)}}function v(e,t,E,a){return"Cannot include a '"+e+"' character in a manually specified `to."+t+"` field ["+JSON.stringify(a)+"]. Please separate it out to the `to."+E+'` field. Alternatively you may provide the full path as a string in and the router will parse it for you.'}function U(e){return e.filter((e,t)=>0===t||e.route.path&&e.route.path.length>0)}function G(e,t){let E=U(e);return t?E.map((e,t)=>t===E.length-1?e.pathname:e.pathnameBase):E.map(e=>e.pathnameBase)}function y(e,t,E,i){let o;void 0===i&&(i=!1),"string"==typeof e?o=A(e):(o=a({},e),S(!o.pathname||!o.pathname.includes("?"),v("?","pathname","search",o)),S(!o.pathname||!o.pathname.includes("#"),v("#","pathname","hash",o)),S(!o.search||!o.search.includes("#"),v("#","search","hash",o)));let _,n=""===e||""===o.pathname,r=n?"/":o.pathname;if(null==r)_=E;else{let e=t.length-1;if(!i&&r.startsWith("..")){let t=r.split("/");for(;".."===t[0];)t.shift(),e-=1;o.pathname=t.join("/")}_=e>=0?t[e]:"/"}let T=M(o,_),s=r&&"/"!==r&&r.endsWith("/"),I=(n||"."===r)&&E.endsWith("/");return T.pathname.endsWith("/")||!s&&!I||(T.pathname+="/"),T}const b=e=>e.join("/").replace(/\/\/+/g,"/"),k=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),F=e=>e&&"?"!==e?e.startsWith("?")?e:"?"+e:"",V=e=>e&&"#"!==e?e.startsWith("#")?e:"#"+e:"",H=function(e,t){void 0===t&&(t={});let E="number"==typeof t?{status:t}:t,i=new Headers(E.headers);return i.has("Content-Type")||i.set("Content-Type","application/json; charset=utf-8"),new Response(JSON.stringify(e),a({},E,{headers:i}))};class Y extends Error{}class w{constructor(e,t){let E;this.pendingKeysSet=new Set,this.subscribers=new Set,this.deferredKeys=[],S(e&&"object"==typeof e&&!Array.isArray(e),"defer() only accepts plain objects"),this.abortPromise=new Promise((e,t)=>E=t),this.controller=new AbortController;let a=()=>E(new Y("Deferred data aborted"));this.unlistenAbortSignal=()=>this.controller.signal.removeEventListener("abort",a),this.controller.signal.addEventListener("abort",a),this.data=Object.entries(e).reduce((e,t)=>{let[E,a]=t;return Object.assign(e,{[E]:this.trackPromise(E,a)})},{}),this.done&&this.unlistenAbortSignal(),this.init=t}trackPromise(e,t){if(!(t instanceof Promise))return t;this.deferredKeys.push(e),this.pendingKeysSet.add(e);let E=Promise.race([t,this.abortPromise]).then(t=>this.onSettle(E,e,void 0,t),t=>this.onSettle(E,e,t));return E.catch(()=>{}),Object.defineProperty(E,"_tracked",{get:()=>!0}),E}onSettle(e,t,E,a){if(this.controller.signal.aborted&&E instanceof Y)return this.unlistenAbortSignal(),Object.defineProperty(e,"_error",{get:()=>E}),Promise.reject(E);if(this.pendingKeysSet.delete(t),this.done&&this.unlistenAbortSignal(),void 0===E&&void 0===a){let E=new Error('Deferred data for key "'+t+'" resolved/rejected with `undefined`, you must resolve/reject with a value or `null`.');return Object.defineProperty(e,"_error",{get:()=>E}),this.emit(!1,t),Promise.reject(E)}return void 0===a?(Object.defineProperty(e,"_error",{get:()=>E}),this.emit(!1,t),Promise.reject(E)):(Object.defineProperty(e,"_data",{get:()=>a}),this.emit(!1,t),a)}emit(e,t){this.subscribers.forEach(E=>E(e,t))}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}cancel(){this.controller.abort(),this.pendingKeysSet.forEach((e,t)=>this.pendingKeysSet.delete(t)),this.emit(!0)}async resolveData(e){let t=!1;if(!this.done){let E=()=>this.cancel();e.addEventListener("abort",E),t=await new Promise(t=>{this.subscribe(a=>{e.removeEventListener("abort",E),(a||this.done)&&t(a)})})}return t}get done(){return 0===this.pendingKeysSet.size}get unwrappedData(){return S(null!==this.data&&this.done,"Can only unwrap data on initialized and settled deferreds"),Object.entries(this.data).reduce((e,t)=>{let[E,a]=t;return Object.assign(e,{[E]:K(a)})},{})}get pendingKeys(){return Array.from(this.pendingKeysSet)}}function K(e){if(!(function(e){return e instanceof Promise&&!0===e._tracked})(e))return e;if(e._error)throw e._error;return e._data}const z=function(e,t){return void 0===t&&(t={}),new w(e,"number"==typeof t?{status:t}:t)},j=function(e,t){void 0===t&&(t=302);let E=t;"number"==typeof E?E={status:E}:void 0===E.status&&(E.status=302);let i=new Headers(E.headers);return i.set("Location",e),new Response(null,a({},E,{headers:i}))},x=(e,t)=>{let E=j(e,t);return E.headers.set("X-Remix-Reload-Document","true"),E},Q=(e,t)=>{let E=j(e,t);return E.headers.set("X-Remix-Replace","true"),E};class X{constructor(e,t,E,a){void 0===a&&(a=!1),this.status=e,this.statusText=t||"",this.internal=a,E instanceof Error?(this.data=E.toString(),this.error=E):this.data=E}}function $(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"boolean"==typeof e.internal&&"data"in e}const q=["post","put","patch","delete"],J=new Set(q),Z=["get",...q],ee=new Set(Z),te=new Set([301,302,303,307,308]),Ee=new Set([307,308]),ae={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},ie={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},oe={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},_e=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ne=e=>({hasErrorBoundary:Boolean(e.hasErrorBoundary)}),re="remix-router-transitions";function Se(e){const t=e.window?e.window:"undefined"!=typeof window?window:void 0,E=void 0!==t&&void 0!==t.document&&void 0!==t.document.createElement,o=!E;let _;if(S(e.routes.length>0,"You must provide a non-empty routes array to createRouter"),e.mapRouteProperties)_=e.mapRouteProperties;else if(e.detectErrorBoundary){let t=e.detectErrorBoundary;_=e=>({hasErrorBoundary:t(e)})}else _=ne;let n,r,s,l={},A=N(e.routes,_,void 0,l),O=e.basename||"/",R=e.dataStrategy||de,m=e.patchRoutesOnNavigation,D=a({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),C=null,p=new Set,P=null,B=null,h=null,f=null!=e.hydrationData,W=d(A,e.history.location,O),M=!1,v=null;if(null==W&&!m){let t=ve(404,{pathname:e.history.location.pathname}),{matches:E,route:a}=Me(A);W=E,v={[a.id]:t}}if(W&&!e.hydrationData){Tt(W,A,e.history.location.pathname).active&&(W=null)}if(W)if(W.some(e=>e.route.lazy))r=!1;else if(W.some(e=>e.route.loader))if(D.v7_partialHydration){let t=e.hydrationData?e.hydrationData.loaderData:null,E=e.hydrationData?e.hydrationData.errors:null;if(E){let e=W.findIndex(e=>void 0!==E[e.route.id]);r=W.slice(0,e+1).every(e=>!Ae(e.route,t,E))}else r=W.every(e=>!Ae(e.route,t,E))}else r=null!=e.hydrationData;else r=!0;else if(r=!1,W=[],D.v7_partialHydration){let t=Tt(null,A,e.history.location.pathname);t.active&&t.matches&&(M=!0,W=t.matches)}let U,G,y={historyAction:e.history.action,location:e.history.location,matches:W,initialized:r,navigation:ae,restoreScrollPosition:null==e.hydrationData&&null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||v,fetchers:new Map,blockers:new Map},b=i.Pop,k=!1,F=!1,V=new Map,H=null,Y=!1,w=!1,K=[],z=new Set,j=new Map,x=0,Q=-1,X=new Map,q=new Set,J=new Map,Z=new Map,ee=new Set,te=new Map,Se=new Map;function Ie(e,t){void 0===t&&(t={}),y=a({},y,e);let E=[],i=[];D.v7_fetcherPersist&&y.fetchers.forEach((e,t)=>{"idle"===e.state&&(ee.has(t)?i.push(t):E.push(t))}),ee.forEach(e=>{y.fetchers.has(e)||j.has(e)||i.push(e)}),[...p].forEach(e=>e(y,{deletedFetchers:i,viewTransitionOpts:t.viewTransitionOpts,flushSync:!0===t.flushSync})),D.v7_fetcherPersist?(E.forEach(e=>y.fetchers.delete(e)),i.forEach(e=>xe(e))):i.forEach(e=>ee.delete(e))}function Oe(t,E,o){var _,r;let S,{flushSync:T}=void 0===o?{}:o,s=null!=y.actionData&&null!=y.navigation.formMethod&&we(y.navigation.formMethod)&&"loading"===y.navigation.state&&!0!==(null==(_=t.state)?void 0:_._isRedirect);S=E.actionData?Object.keys(E.actionData).length>0?E.actionData:null:s?y.actionData:null;let I=E.loaderData?fe(y.loaderData,E.loaderData,E.matches||[],E.errors):y.loaderData,l=y.blockers;l.size>0&&(l=new Map(l),l.forEach((e,t)=>l.set(t,oe)));let O,u=!0===k||null!=y.navigation.formMethod&&we(y.navigation.formMethod)&&!0!==(null==(r=t.state)?void 0:r._isRedirect);if(n&&(A=n,n=void 0),Y||b===i.Pop||(b===i.Push?e.history.push(t,t.state):b===i.Replace&&e.history.replace(t,t.state)),b===i.Pop){let e=V.get(y.location.pathname);e&&e.has(t.pathname)?O={currentLocation:y.location,nextLocation:t}:V.has(t.pathname)&&(O={currentLocation:t,nextLocation:y.location})}else if(F){let e=V.get(y.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),V.set(y.location.pathname,e)),O={currentLocation:y.location,nextLocation:t}}Ie(a({},E,{actionData:S,loaderData:I,historyAction:b,location:t,initialized:!0,navigation:ae,revalidation:"idle",restoreScrollPosition:St(t,E.matches||y.matches),preventScrollReset:u,blockers:l}),{viewTransitionOpts:O,flushSync:!0===T}),b=i.Pop,k=!1,F=!1,Y=!1,w=!1,K=[]}async function ue(t,E,o){U&&U.abort(),U=null,b=t,Y=!0===(o&&o.startUninterruptedRevalidation),(function(e,t){if(P&&h){let E=rt(e,t);P[E]=h()}})(y.location,y.matches),k=!0===(o&&o.preventScrollReset),F=!0===(o&&o.enableViewTransition);let _=n||A,r=o&&o.overrideNavigation,S=null!=o&&o.initialHydration&&y.matches&&y.matches.length>0&&!M?y.matches:d(_,E,O),T=!0===(o&&o.flushSync);if(S&&y.initialized&&!w&&(function(e,t){if(e.pathname!==t.pathname||e.search!==t.search)return!1;if(""===e.hash)return""!==t.hash;if(e.hash===t.hash)return!0;if(""!==t.hash)return!0;return!1})(y.location,E)&&!(o&&o.submission&&we(o.submission.formMethod)))return void Oe(E,{matches:S},{flushSync:T});let s=Tt(S,_,E.pathname);if(s.active&&s.matches&&(S=s.matches),!S){let{error:e,notFoundMatches:t,route:a}=_t(E.pathname);return void Oe(E,{matches:t,loaderData:{},errors:{[a.id]:e}},{flushSync:T})}U=new AbortController;let I,l=Ce(e.history,E,U.signal,o&&o.submission);if(o&&o.pendingError)I=[ge(S).route.id,{type:u.error,error:o.pendingError}];else if(o&&o.submission&&we(o.submission.formMethod)){let t=await(async function(e,t,E,a,o,_){void 0===_&&(_={});Ge();let n,r=(function(e,t){let E={state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text};return E})(t,E);if(Ie({navigation:r},{flushSync:!0===_.flushSync}),o){let E=await st(a,t.pathname,e.signal);if("aborted"===E.type)return{shortCircuited:!0};if("error"===E.type){let e=ge(E.partialMatches).route.id;return{matches:E.partialMatches,pendingActionResult:[e,{type:u.error,error:E.error}]}}if(!E.matches){let{notFoundMatches:e,error:E,route:a}=_t(t.pathname);return{matches:e,pendingActionResult:[a.id,{type:u.error,error:E}]}}a=E.matches}let S=Qe(a,t);if(S.route.action||S.route.lazy){if(n=(await Pe("action",y,e,[S],a,null))[S.route.id],e.signal.aborted)return{shortCircuited:!0}}else n={type:u.error,error:ve(405,{method:e.method,pathname:t.pathname,routeId:S.route.id})};if(Fe(n)){let t;if(_&&null!=_.replace)t=_.replace;else{t=De(n.response.headers.get("Location"),new URL(e.url),O)===y.location.pathname+y.location.search}return await pe(e,n,!0,{submission:E,replace:t}),{shortCircuited:!0}}if(be(n))throw ve(400,{type:"defer-action"});if(ke(n)){let e=ge(a,S.route.id);return!0!==(_&&_.replace)&&(b=i.Push),{matches:a,pendingActionResult:[e.route.id,n]}}return{matches:a,pendingActionResult:[S.route.id,n]}})(l,E,o.submission,S,s.active,{replace:o.replace,flushSync:T});if(t.shortCircuited)return;if(t.pendingActionResult){let[e,a]=t.pendingActionResult;if(ke(a)&&$(a.error)&&404===a.error.status)return U=null,void Oe(E,{matches:t.matches,loaderData:{},errors:{[e]:a.error}})}S=t.matches||S,I=t.pendingActionResult,r=$e(E,o.submission),T=!1,s.active=!1,l=Ce(e.history,l.url,l.signal)}let{shortCircuited:R,matches:N,loaderData:c,errors:L}=await(async function(t,E,i,o,_,r,S,T,s,I,l){let u=_||$e(E,r),R=r||S||Xe(u),N=!(Y||D.v7_partialHydration&&s);if(o){if(N){let e=Ne(l);Ie(a({navigation:u},void 0!==e?{actionData:e}:{}),{flushSync:I})}let e=await st(i,E.pathname,t.signal);if("aborted"===e.type)return{shortCircuited:!0};if("error"===e.type){let t=ge(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}if(!e.matches){let{error:e,notFoundMatches:t,route:a}=_t(E.pathname);return{matches:t,loaderData:{},errors:{[a.id]:e}}}i=e.matches}let d=n||A,[c,L]=le(e.history,y,i,R,E,D.v7_partialHydration&&!0===s,D.v7_skipActionErrorRevalidation,w,K,z,ee,J,q,d,O,l);if(nt(e=>!(i&&i.some(t=>t.route.id===e))||c&&c.some(t=>t.route.id===e)),Q=++x,0===c.length&&0===L.length){let e=tt();return Oe(E,a({matches:i,loaderData:{},errors:l&&ke(l[1])?{[l[0]]:l[1].error}:null},We(l),e?{fetchers:new Map(y.fetchers)}:{}),{flushSync:I}),{shortCircuited:!0}}if(N){let e={};if(!o){e.navigation=u;let t=Ne(l);void 0!==t&&(e.actionData=t)}L.length>0&&(e.fetchers=(function(e){return e.forEach(e=>{let t=y.fetchers.get(e.key),E=qe(void 0,t?t.data:void 0);y.fetchers.set(e.key,E)}),new Map(y.fetchers)})(L)),Ie(e,{flushSync:I})}L.forEach(e=>{Ze(e.key),e.controller&&j.set(e.key,e.controller)});let m=()=>L.forEach(e=>Ze(e.key));U&&U.signal.addEventListener("abort",m);let{loaderResults:C,fetcherResults:p}=await Be(y,i,c,L,t);if(t.signal.aborted)return{shortCircuited:!0};U&&U.signal.removeEventListener("abort",m);L.forEach(e=>j.delete(e.key));let P=Ue(C);if(P)return await pe(t,P.result,!0,{replace:T}),{shortCircuited:!0};if(P=Ue(p),P)return q.add(P.key),await pe(t,P.result,!0,{replace:T}),{shortCircuited:!0};let{loaderData:B,errors:h}=he(y,i,C,l,L,p,te);te.forEach((e,t)=>{e.subscribe(E=>{(E||e.done)&&te.delete(t)})}),D.v7_partialHydration&&s&&y.errors&&(h=a({},y.errors,h));let f=tt(),W=Et(Q),g=f||W||L.length>0;return a({matches:i,loaderData:B,errors:h},g?{fetchers:new Map(y.fetchers)}:{})})(l,E,S,s.active,r,o&&o.submission,o&&o.fetcherSubmission,o&&o.replace,o&&!0===o.initialHydration,T,I);R||(U=null,Oe(E,a({matches:N||S},We(I),{loaderData:c,errors:L})))}function Ne(e){return e&&!ke(e[1])?{[e[0]]:e[1].data}:y.actionData?0===Object.keys(y.actionData).length?null:y.actionData:void 0}async function pe(o,_,n,r){let{submission:T,fetcherSubmission:s,preventScrollReset:l,replace:A}=void 0===r?{}:r;_.response.headers.has("X-Remix-Revalidate")&&(w=!0);let u=_.response.headers.get("Location");S(u,"Expected a Location header on the redirect Response"),u=De(u,new URL(o.url),O);let R=I(y.location,u,{_isRedirect:!0});if(E){let E=!1;if(_.response.headers.has("X-Remix-Reload-Document"))E=!0;else if(_e.test(u)){const a=e.history.createURL(u);E=a.origin!==t.location.origin||null==g(a.pathname,O)}if(E)return void(A?t.location.replace(u):t.location.assign(u))}U=null;let N=!0===A||_.response.headers.has("X-Remix-Replace")?i.Replace:i.Push,{formMethod:d,formAction:c,formEncType:L}=y.navigation;!T&&!s&&d&&c&&L&&(T=Xe(y.navigation));let m=T||s;if(Ee.has(_.response.status)&&m&&we(m.formMethod))await ue(N,R,{submission:a({},m,{formAction:u}),preventScrollReset:l||k,enableViewTransition:n?F:void 0});else{let e=$e(R,T);await ue(N,R,{overrideNavigation:e,fetcherSubmission:s,preventScrollReset:l||k,enableViewTransition:n?F:void 0})}}async function Pe(e,t,E,a,i,o){let n,r={};try{n=await ce(R,e,t,E,a,i,o,l,_)}catch(e){return a.forEach(t=>{r[t.route.id]={type:u.error,error:e}}),r}for(let[e,t]of Object.entries(n))if(ye(t)){let a=t.result;r[e]={type:u.redirect,response:me(a,E,e,i,O,D.v7_relativeSplatPath)}}else r[e]=await Le(t);return r}async function Be(t,E,a,i,o){let _=t.matches,n=Pe("loader",t,o,a,E,null),r=Promise.all(i.map(async E=>{if(E.matches&&E.match&&E.controller){let a=(await Pe("loader",t,Ce(e.history,E.path,E.controller.signal),[E.match],E.matches,E.key))[E.match.route.id];return{[E.key]:a}}return Promise.resolve({[E.key]:{type:u.error,error:ve(404,{pathname:E.path})}})})),S=await n,T=(await r).reduce((e,t)=>Object.assign(e,t),{});return await Promise.all([Ke(E,S,o.signal,_,t.loaderData),ze(E,T,i)]),{loaderResults:S,fetcherResults:T}}function Ge(){w=!0,K.push(...nt()),J.forEach((e,t)=>{j.has(t)&&z.add(t),Ze(t)})}function Ve(e,t,E){void 0===E&&(E={}),y.fetchers.set(e,t),Ie({fetchers:new Map(y.fetchers)},{flushSync:!0===(E&&E.flushSync)})}function He(e,t,E,a){void 0===a&&(a={});let i=ge(y.matches,t);xe(e),Ie({errors:{[i.route.id]:E},fetchers:new Map(y.fetchers)},{flushSync:!0===(a&&a.flushSync)})}function Ye(e){return Z.set(e,(Z.get(e)||0)+1),ee.has(e)&&ee.delete(e),y.fetchers.get(e)||ie}function xe(e){let t=y.fetchers.get(e);!j.has(e)||t&&"loading"===t.state&&X.has(e)||Ze(e),J.delete(e),X.delete(e),q.delete(e),D.v7_fetcherPersist&&ee.delete(e),z.delete(e),y.fetchers.delete(e)}function Ze(e){let t=j.get(e);t&&(t.abort(),j.delete(e))}function et(e){for(let t of e){let e=Je(Ye(t).data);y.fetchers.set(t,e)}}function tt(){let e=[],t=!1;for(let E of q){let a=y.fetchers.get(E);S(a,"Expected fetcher: "+E),"loading"===a.state&&(q.delete(E),e.push(E),t=!0)}return et(e),t}function Et(e){let t=[];for(let[E,a]of X)if(a0}function at(e){y.blockers.delete(e),Se.delete(e)}function it(e,t){let E=y.blockers.get(e)||oe;S("unblocked"===E.state&&"blocked"===t.state||"blocked"===E.state&&"blocked"===t.state||"blocked"===E.state&&"proceeding"===t.state||"blocked"===E.state&&"unblocked"===t.state||"proceeding"===E.state&&"unblocked"===t.state,"Invalid blocker state transition: "+E.state+" -> "+t.state);let a=new Map(y.blockers);a.set(e,t),Ie({blockers:a})}function ot(e){let{currentLocation:t,nextLocation:E,historyAction:a}=e;if(0===Se.size)return;Se.size>1&&T(!1,"A router only supports one blocker at a time");let i=Array.from(Se.entries()),[o,_]=i[i.length-1],n=y.blockers.get(o);return n&&"proceeding"===n.state?void 0:_({currentLocation:t,nextLocation:E,historyAction:a})?o:void 0}function _t(e){let t=ve(404,{pathname:e}),E=n||A,{matches:a,route:i}=Me(E);return nt(),{notFoundMatches:a,route:i,error:t}}function nt(e){let t=[];return te.forEach((E,a)=>{e&&!e(a)||(E.cancel(),t.push(a),te.delete(a))}),t}function rt(e,t){if(B){return B(e,t.map(e=>L(e,y.loaderData)))||e.key}return e.key}function St(e,t){if(P){let E=rt(e,t),a=P[E];if("number"==typeof a)return a}return null}function Tt(e,t,E){if(m){if(!e){return{active:!0,matches:c(t,E,O,!0)||[]}}if(Object.keys(e[0].params).length>0){return{active:!0,matches:c(t,E,O,!0)}}}return{active:!1,matches:null}}async function st(e,t,E,a){if(!m)return{type:"success",matches:e};let i=e;for(;;){let e=null==n,o=n||A,r=l;try{await m({signal:E,path:t,matches:i,fetcherKey:a,patch:(e,t)=>{E.aborted||Re(e,t,o,r,_)}})}catch(e){return{type:"error",error:e,partialMatches:i}}finally{e&&!E.aborted&&(A=[...A])}if(E.aborted)return{type:"aborted"};let S=d(o,t,O);if(S)return{type:"success",matches:S};let T=c(o,t,O,!0);if(!T||i.length===T.length&&i.every((e,t)=>e.route.id===T[t].route.id))return{type:"success",matches:null};i=T}}return s={get basename(){return O},get future(){return D},get state(){return y},get routes(){return A},get window(){return t},initialize:function(){if(C=e.history.listen(t=>{let{action:E,location:a,delta:i}=t;if(G)return G(),void(G=void 0);T(0===Se.size||null!=i,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let o=ot({currentLocation:y.location,nextLocation:a,historyAction:E});if(o&&null!=i){let t=new Promise(e=>{G=e});return e.history.go(-1*i),void it(o,{state:"blocked",location:a,proceed(){it(o,{state:"proceeding",proceed:void 0,reset:void 0,location:a}),t.then(()=>e.history.go(i))},reset(){let e=new Map(y.blockers);e.set(o,oe),Ie({blockers:e})}})}return ue(E,a)}),E){!(function(e,t){try{let E=e.sessionStorage.getItem(re);if(E){let e=JSON.parse(E);for(let[E,a]of Object.entries(e||{}))a&&Array.isArray(a)&&t.set(E,new Set(a||[]))}}catch(e){}})(t,V);let e=()=>(function(e,t){if(t.size>0){let E={};for(let[e,a]of t)E[e]=[...a];try{e.sessionStorage.setItem(re,JSON.stringify(E))}catch(e){T(!1,"Failed to save applied view transitions in sessionStorage ("+e+").")}}})(t,V);t.addEventListener("pagehide",e),H=()=>t.removeEventListener("pagehide",e)}return y.initialized||ue(i.Pop,y.location,{initialHydration:!0}),s},subscribe:function(e){return p.add(e),()=>p.delete(e)},enableScrollRestoration:function(e,t,E){if(P=e,h=t,B=E||null,!f&&y.navigation===ae){f=!0;let e=St(y.location,y.matches);null!=e&&Ie({restoreScrollPosition:e})}return()=>{P=null,h=null,B=null}},navigate:async function t(E,o){if("number"==typeof E)return void e.history.go(E);let _=Te(y.location,y.matches,O,D.v7_prependBasename,E,D.v7_relativeSplatPath,null==o?void 0:o.fromRouteId,null==o?void 0:o.relative),{path:n,submission:r,error:S}=se(D.v7_normalizeFormMethod,!1,_,o),T=y.location,s=I(y.location,n,o&&o.state);s=a({},s,e.history.encodeLocation(s));let l=o&&null!=o.replace?o.replace:void 0,A=i.Push;!0===l?A=i.Replace:!1===l||null!=r&&we(r.formMethod)&&r.formAction===y.location.pathname+y.location.search&&(A=i.Replace);let u=o&&"preventScrollReset"in o?!0===o.preventScrollReset:void 0,R=!0===(o&&o.flushSync),N=ot({currentLocation:T,nextLocation:s,historyAction:A});if(!N)return await ue(A,s,{submission:r,pendingError:S,preventScrollReset:u,replace:o&&o.replace,enableViewTransition:o&&o.viewTransition,flushSync:R});it(N,{state:"blocked",location:s,proceed(){it(N,{state:"proceeding",proceed:void 0,reset:void 0,location:s}),t(E,o)},reset(){let e=new Map(y.blockers);e.set(N,oe),Ie({blockers:e})}})},fetch:function(t,E,a,i){if(o)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");Ze(t);let _=!0===(i&&i.flushSync),r=n||A,T=Te(y.location,y.matches,O,D.v7_prependBasename,a,D.v7_relativeSplatPath,E,null==i?void 0:i.relative),s=d(r,T,O),I=Tt(s,r,T);if(I.active&&I.matches&&(s=I.matches),!s)return void He(t,E,ve(404,{pathname:T}),{flushSync:_});let{path:l,submission:u,error:R}=se(D.v7_normalizeFormMethod,!0,T,i);if(R)return void He(t,E,R,{flushSync:_});let N=Qe(s,l),c=!0===(i&&i.preventScrollReset);u&&we(u.formMethod)?(async function(t,E,a,i,o,_,r,T,s){function I(e){if(!e.route.action&&!e.route.lazy){let e=ve(405,{method:s.formMethod,pathname:a,routeId:E});return He(t,E,e,{flushSync:r}),!0}return!1}if(Ge(),J.delete(t),!_&&I(i))return;let l=y.fetchers.get(t);Ve(t,(function(e,t){let E={state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0};return E})(s,l),{flushSync:r});let u=new AbortController,R=Ce(e.history,a,u.signal,s);if(_){let e=await st(o,new URL(R.url).pathname,R.signal,t);if("aborted"===e.type)return;if("error"===e.type)return void He(t,E,e.error,{flushSync:r});if(!e.matches)return void He(t,E,ve(404,{pathname:a}),{flushSync:r});if(I(i=Qe(o=e.matches,a)))return}j.set(t,u);let N=x,c=await Pe("action",y,R,[i],o,t),L=c[i.route.id];if(R.signal.aborted)return void(j.get(t)===u&&j.delete(t));if(D.v7_fetcherPersist&&ee.has(t)){if(Fe(L)||ke(L))return void Ve(t,Je(void 0))}else{if(Fe(L))return j.delete(t),Q>N?void Ve(t,Je(void 0)):(q.add(t),Ve(t,qe(s)),pe(R,L,!1,{fetcherSubmission:s,preventScrollReset:T}));if(ke(L))return void He(t,E,L.error)}if(be(L))throw ve(400,{type:"defer-action"});let m=y.navigation.location||y.location,C=Ce(e.history,m,u.signal),p=n||A,P="idle"!==y.navigation.state?d(p,y.navigation.location,O):y.matches;S(P,"Didn't find any matches after fetcher action");let B=++x;X.set(t,B);let h=qe(s,L.data);y.fetchers.set(t,h);let[f,W]=le(e.history,y,P,s,m,!1,D.v7_skipActionErrorRevalidation,w,K,z,ee,J,q,p,O,[i.route.id,L]);W.filter(e=>e.key!==t).forEach(e=>{let t=e.key,E=y.fetchers.get(t),a=qe(void 0,E?E.data:void 0);y.fetchers.set(t,a),Ze(t),e.controller&&j.set(t,e.controller)}),Ie({fetchers:new Map(y.fetchers)});let g=()=>W.forEach(e=>Ze(e.key));u.signal.addEventListener("abort",g);let{loaderResults:M,fetcherResults:v}=await Be(y,P,f,W,C);if(u.signal.aborted)return;u.signal.removeEventListener("abort",g),X.delete(t),j.delete(t),W.forEach(e=>j.delete(e.key));let G=Ue(M);if(G)return pe(C,G.result,!1,{preventScrollReset:T});if(G=Ue(v),G)return q.add(G.key),pe(C,G.result,!1,{preventScrollReset:T});let{loaderData:k,errors:F}=he(y,P,M,void 0,W,v,te);if(y.fetchers.has(t)){let e=Je(L.data);y.fetchers.set(t,e)}Et(B),"loading"===y.navigation.state&&B>Q?(S(b,"Expected pending action"),U&&U.abort(),Oe(y.navigation.location,{matches:P,loaderData:k,errors:F,fetchers:new Map(y.fetchers)})):(Ie({errors:F,loaderData:fe(y.loaderData,k,P,F),fetchers:new Map(y.fetchers)}),w=!1)})(t,E,l,N,s,I.active,_,c,u):(J.set(t,{routeId:E,path:l}),(async function(t,E,a,i,o,_,n,r,T){let s=y.fetchers.get(t);Ve(t,qe(T,s?s.data:void 0),{flushSync:n});let I=new AbortController,l=Ce(e.history,a,I.signal);if(_){let e=await st(o,new URL(l.url).pathname,l.signal,t);if("aborted"===e.type)return;if("error"===e.type)return void He(t,E,e.error,{flushSync:n});if(!e.matches)return void He(t,E,ve(404,{pathname:a}),{flushSync:n});i=Qe(o=e.matches,a)}j.set(t,I);let A=x,O=await Pe("loader",y,l,[i],o,t),u=O[i.route.id];be(u)&&(u=await je(u,l.signal,!0)||u);j.get(t)===I&&j.delete(t);if(l.signal.aborted)return;if(ee.has(t))return void Ve(t,Je(void 0));if(Fe(u))return Q>A?void Ve(t,Je(void 0)):(q.add(t),void await pe(l,u,!1,{preventScrollReset:r}));if(ke(u))return void He(t,E,u.error);S(!be(u),"Unhandled fetcher deferred data"),Ve(t,Je(u.data))})(t,E,l,N,s,I.active,_,c,u))},revalidate:function(){Ge(),Ie({revalidation:"loading"}),"submitting"!==y.navigation.state&&("idle"!==y.navigation.state?ue(b||y.historyAction,y.navigation.location,{overrideNavigation:y.navigation,enableViewTransition:!0===F}):ue(y.historyAction,y.location,{startUninterruptedRevalidation:!0}))},createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:Ye,deleteFetcher:function(e){let t=(Z.get(e)||0)-1;t<=0?(Z.delete(e),ee.add(e),D.v7_fetcherPersist||xe(e)):Z.set(e,t),Ie({fetchers:new Map(y.fetchers)})},dispose:function(){C&&C(),H&&H(),p.clear(),U&&U.abort(),y.fetchers.forEach((e,t)=>xe(t)),y.blockers.forEach((e,t)=>at(t))},getBlocker:function(e,t){let E=y.blockers.get(e)||oe;return Se.get(e)!==t&&Se.set(e,t),E},deleteBlocker:at,patchRoutes:function(e,t){let E=null==n;Re(e,t,n||A,l,_),E&&(A=[...A],Ie({}))},_internalFetchControllers:j,_internalActiveDeferreds:te,_internalSetRoutes:function(e){l={},n=N(e,_,void 0,l)}},s}Symbol("deferred");function Te(e,t,E,a,i,o,_,n){let r,S;if(_){r=[];for(let e of t)if(r.push(e),e.route.id===_){S=e;break}}else r=t,S=t[t.length-1];let T=y(i||".",G(r,o),g(e.pathname,E)||e.pathname,"path"===n);if(null==i&&(T.search=e.search,T.hash=e.hash),(null==i||""===i||"."===i)&&S){let e=xe(T.search);if(S.route.index&&!e)T.search=T.search?T.search.replace(/^\?/,"?index&"):"?index";else if(!S.route.index&&e){let e=new URLSearchParams(T.search),t=e.getAll("index");e.delete("index"),t.filter(e=>e).forEach(t=>e.append("index",t));let E=e.toString();T.search=E?"?"+E:""}}return a&&"/"!==E&&(T.pathname="/"===T.pathname?E:b([E,T.pathname])),l(T)}function se(e,t,E,a){if(!a||!(function(e){return null!=e&&("formData"in e&&null!=e.formData||"body"in e&&void 0!==e.body)})(a))return{path:E};if(a.formMethod&&!Ye(a.formMethod))return{path:E,error:ve(405,{method:a.formMethod})};let i,o,_=()=>({path:E,error:ve(400,{type:"invalid-body"})}),n=a.formMethod||"get",r=e?n.toUpperCase():n.toLowerCase(),T=Ge(E);if(void 0!==a.body){if("text/plain"===a.formEncType){if(!we(r))return _();let e="string"==typeof a.body?a.body:a.body instanceof FormData||a.body instanceof URLSearchParams?Array.from(a.body.entries()).reduce((e,t)=>{let[E,a]=t;return""+e+E+"="+a+"\n"},""):String(a.body);return{path:E,submission:{formMethod:r,formAction:T,formEncType:a.formEncType,formData:void 0,json:void 0,text:e}}}if("application/json"===a.formEncType){if(!we(r))return _();try{let e="string"==typeof a.body?JSON.parse(a.body):a.body;return{path:E,submission:{formMethod:r,formAction:T,formEncType:a.formEncType,formData:void 0,json:e,text:void 0}}}catch(e){return _()}}}if(S("function"==typeof FormData,"FormData is not available in this environment"),a.formData)i=pe(a.formData),o=a.formData;else if(a.body instanceof FormData)i=pe(a.body),o=a.body;else if(a.body instanceof URLSearchParams)i=a.body,o=Pe(i);else if(null==a.body)i=new URLSearchParams,o=new FormData;else try{i=new URLSearchParams(a.body),o=Pe(i)}catch(e){return _()}let s={formMethod:r,formAction:T,formEncType:a&&a.formEncType||"application/x-www-form-urlencoded",formData:o,json:void 0,text:void 0};if(we(s.formMethod))return{path:E,submission:s};let I=A(E);return t&&I.search&&xe(I.search)&&i.append("index",""),I.search="?"+i,{path:l(I),submission:s}}function Ie(e,t,E){void 0===E&&(E=!1);let a=e.findIndex(e=>e.route.id===t);return a>=0?e.slice(0,E?a+1:a):e}function le(e,t,E,i,o,_,n,r,S,T,s,I,l,A,O,u){let R=u?ke(u[1])?u[1].error:u[1].data:void 0,N=e.createURL(t.location),c=e.createURL(o),L=E;_&&t.errors?L=Ie(E,Object.keys(t.errors)[0],!0):u&&ke(u[1])&&(L=Ie(E,u[0]));let m=u?u[1].statusCode:void 0,D=n&&m&&m>=400,C=L.filter((e,E)=>{let{route:o}=e;if(o.lazy)return!0;if(null==o.loader)return!1;if(_)return Ae(o,t.loaderData,t.errors);if((function(e,t,E){let a=!t||E.route.id!==t.route.id,i=void 0===e[E.route.id];return a||i})(t.loaderData,t.matches[E],e)||S.some(t=>t===e.route.id))return!0;let n=t.matches[E],T=e;return ue(e,a({currentUrl:N,currentParams:n.params,nextUrl:c,nextParams:T.params},i,{actionResult:R,actionStatus:m,defaultShouldRevalidate:!D&&(r||N.pathname+N.search===c.pathname+c.search||N.search!==c.search||Oe(n,T))}))}),p=[];return I.forEach((e,o)=>{if(_||!E.some(t=>t.route.id===e.routeId)||s.has(o))return;let n=d(A,e.path,O);if(!n)return void p.push({key:o,routeId:e.routeId,path:e.path,matches:null,match:null,controller:null});let S=t.fetchers.get(o),I=Qe(n,e.path),u=!1;l.has(o)?u=!1:T.has(o)?(T.delete(o),u=!0):u=S&&"idle"!==S.state&&void 0===S.data?r:ue(I,a({currentUrl:N,currentParams:t.matches[t.matches.length-1].params,nextUrl:c,nextParams:E[E.length-1].params},i,{actionResult:R,actionStatus:m,defaultShouldRevalidate:!D&&r})),u&&p.push({key:o,routeId:e.routeId,path:e.path,matches:n,match:I,controller:new AbortController})}),[C,p]}function Ae(e,t,E){if(e.lazy)return!0;if(!e.loader)return!1;let a=null!=t&&void 0!==t[e.id],i=null!=E&&void 0!==E[e.id];return!(!a&&i)&&("function"==typeof e.loader&&!0===e.loader.hydrate||!a&&!i)}function Oe(e,t){let E=e.route.path;return e.pathname!==t.pathname||null!=E&&E.endsWith("*")&&e.params["*"]!==t.params["*"]}function ue(e,t){if(e.route.shouldRevalidate){let E=e.route.shouldRevalidate(t);if("boolean"==typeof E)return E}return t.defaultShouldRevalidate}function Re(e,t,E,a,i){var o;let _;if(e){let t=a[e];S(t,"No route found to patch children into: routeId = "+e),t.children||(t.children=[]),_=t.children}else _=E;let n=N(t.filter(e=>!_.some(t=>Ne(e,t))),i,[e||"_","patch",String((null==(o=_)?void 0:o.length)||"0")],a);_.push(...n)}function Ne(e,t){return"id"in e&&"id"in t&&e.id===t.id||e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive&&(!(e.children&&0!==e.children.length||t.children&&0!==t.children.length)||e.children.every((e,E)=>{var a;return null==(a=t.children)?void 0:a.some(t=>Ne(e,t))}))}async function de(e){let{matches:t}=e,E=t.filter(e=>e.shouldLoad);return(await Promise.all(E.map(e=>e.resolve()))).reduce((e,t,a)=>Object.assign(e,{[E[a].route.id]:t}),{})}async function ce(e,t,E,i,o,_,n,r,s,I){let l=_.map(e=>e.route.lazy?(async function(e,t,E){if(!e.lazy)return;let i=await e.lazy();if(!e.lazy)return;let o=E[e.id];S(o,"No route found in manifest");let _={};for(let e in i){let t=void 0!==o[e]&&"hasErrorBoundary"!==e;T(!t,'Route "'+o.id+'" has a static property "'+e+'" defined but its lazy function is also returning a value for this property. The lazy route property "'+e+'" will be ignored.'),t||R.has(e)||(_[e]=i[e])}Object.assign(o,_),Object.assign(o,a({},t(o),{lazy:void 0}))})(e.route,s,r):void 0),A=_.map((e,E)=>{let _=l[E],n=o.some(t=>t.route.id===e.route.id);return a({},e,{shouldLoad:n,resolve:async E=>(E&&"GET"===i.method&&(e.route.lazy||e.route.loader)&&(n=!0),n?(async function(e,t,E,a,i,o){let _,n,r=a=>{let _,r=new Promise((e,t)=>_=t);n=()=>_(),t.signal.addEventListener("abort",n);let S=i=>"function"!=typeof a?Promise.reject(new Error('You cannot call the handler for a route which defines a boolean "'+e+'" [routeId: '+E.route.id+"]")):a({request:t,params:E.params,context:o},...void 0!==i?[i]:[]),T=(async()=>{try{return{type:"data",result:await(i?i(e=>S(e)):S())}}catch(e){return{type:"error",result:e}}})();return Promise.race([T,r])};try{let i=E.route[e];if(a)if(i){let e,[t]=await Promise.all([r(i).catch(t=>{e=t}),a]);if(void 0!==e)throw e;_=t}else{if(await a,i=E.route[e],!i){if("action"===e){let e=new URL(t.url),a=e.pathname+e.search;throw ve(405,{method:t.method,pathname:a,routeId:E.route.id})}return{type:u.data,result:void 0}}_=await r(i)}else{if(!i){let e=new URL(t.url);throw ve(404,{pathname:e.pathname+e.search})}_=await r(i)}S(void 0!==_.result,"You defined "+("action"===e?"an action":"a loader")+' for route "'+E.route.id+"\" but didn't return anything from your `"+e+"` function. Please return a value or `null`.")}catch(e){return{type:u.error,result:e}}finally{n&&t.signal.removeEventListener("abort",n)}return _})(t,i,e,_,E,I):Promise.resolve({type:u.data,result:void 0}))})}),O=await e({matches:A,request:i,params:_[0].params,fetcherKey:n,context:I});try{await Promise.all(l)}catch(e){}return O}async function Le(e){let{result:t,type:E}=e;if(He(t)){let e;try{let E=t.headers.get("Content-Type");e=E&&/\bapplication\/json\b/.test(E)?null==t.body?null:await t.json():await t.text()}catch(e){return{type:u.error,error:e}}return E===u.error?{type:u.error,error:new X(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:u.data,data:e,statusCode:t.status,headers:t.headers}}var a,i,o,_,n,r,S,T;return E===u.error?Ve(t)?t.data instanceof Error?{type:u.error,error:t.data,statusCode:null==(o=t.init)?void 0:o.status,headers:null!=(_=t.init)&&_.headers?new Headers(t.init.headers):void 0}:{type:u.error,error:new X((null==(a=t.init)?void 0:a.status)||500,void 0,t.data),statusCode:$(t)?t.status:void 0,headers:null!=(i=t.init)&&i.headers?new Headers(t.init.headers):void 0}:{type:u.error,error:t,statusCode:$(t)?t.status:void 0}:(function(e){let t=e;return t&&"object"==typeof t&&"object"==typeof t.data&&"function"==typeof t.subscribe&&"function"==typeof t.cancel&&"function"==typeof t.resolveData})(t)?{type:u.deferred,deferredData:t,statusCode:null==(n=t.init)?void 0:n.status,headers:(null==(r=t.init)?void 0:r.headers)&&new Headers(t.init.headers)}:Ve(t)?{type:u.data,data:t.data,statusCode:null==(S=t.init)?void 0:S.status,headers:null!=(T=t.init)&&T.headers?new Headers(t.init.headers):void 0}:{type:u.data,data:t}}function me(e,t,E,a,i,o){let _=e.headers.get("Location");if(S(_,"Redirects returned/thrown from loaders/actions must have a Location header"),!_e.test(_)){let n=a.slice(0,a.findIndex(e=>e.route.id===E)+1);_=Te(new URL(t.url),n,i,!0,_,o),e.headers.set("Location",_)}return e}function De(e,t,E){if(_e.test(e)){let a=e,i=a.startsWith("//")?new URL(t.protocol+a):new URL(a),o=null!=g(i.pathname,E);if(i.origin===t.origin&&o)return i.pathname+i.search+i.hash}return e}function Ce(e,t,E,a){let i=e.createURL(Ge(t)).toString(),o={signal:E};if(a&&we(a.formMethod)){let{formMethod:e,formEncType:t}=a;o.method=e.toUpperCase(),"application/json"===t?(o.headers=new Headers({"Content-Type":t}),o.body=JSON.stringify(a.json)):"text/plain"===t?o.body=a.text:"application/x-www-form-urlencoded"===t&&a.formData?o.body=pe(a.formData):o.body=a.formData}return new Request(i,o)}function pe(e){let t=new URLSearchParams;for(let[E,a]of e.entries())t.append(E,"string"==typeof a?a:a.name);return t}function Pe(e){let t=new FormData;for(let[E,a]of e.entries())t.append(E,a);return t}function Be(e,t,E,a,i){let o,_={},n=null,r=!1,T={},s=E&&ke(E[1])?E[1].error:void 0;return e.forEach(E=>{if(!(E.route.id in t))return;let I=E.route.id,l=t[I];if(S(!Fe(l),"Cannot handle redirect results in processLoaderData"),ke(l)){let t=l.error;if(void 0!==s&&(t=s,s=void 0),n=n||{},i)n[I]=t;else{let E=ge(e,I);null==n[E.route.id]&&(n[E.route.id]=t)}_[I]=void 0,r||(r=!0,o=$(l.error)?l.error.status:500),l.headers&&(T[I]=l.headers)}else be(l)?(a.set(I,l.deferredData),_[I]=l.deferredData.data,null==l.statusCode||200===l.statusCode||r||(o=l.statusCode),l.headers&&(T[I]=l.headers)):(_[I]=l.data,l.statusCode&&200!==l.statusCode&&!r&&(o=l.statusCode),l.headers&&(T[I]=l.headers))}),void 0!==s&&E&&(n={[E[0]]:s},_[E[0]]=void 0),{loaderData:_,errors:n,statusCode:o||200,loaderHeaders:T}}function he(e,t,E,i,o,_,n){let{loaderData:r,errors:T}=Be(t,E,i,n,!1);return o.forEach(t=>{let{key:E,match:i,controller:o}=t,n=_[E];if(S(n,"Did not find corresponding fetcher result"),!o||!o.signal.aborted)if(ke(n)){let t=ge(e.matches,null==i?void 0:i.route.id);T&&T[t.route.id]||(T=a({},T,{[t.route.id]:n.error})),e.fetchers.delete(E)}else if(Fe(n))S(!1,"Unhandled fetcher revalidation redirect");else if(be(n))S(!1,"Unhandled fetcher deferred data");else{let t=Je(n.data);e.fetchers.set(E,t)}}),{loaderData:r,errors:T}}function fe(e,t,E,i){let o=a({},t);for(let a of E){let E=a.route.id;if(t.hasOwnProperty(E)?void 0!==t[E]&&(o[E]=t[E]):void 0!==e[E]&&a.route.loader&&(o[E]=e[E]),i&&i.hasOwnProperty(E))break}return o}function We(e){return e?ke(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function ge(e,t){return(t?e.slice(0,e.findIndex(e=>e.route.id===t)+1):[...e]).reverse().find(e=>!0===e.route.hasErrorBoundary)||e[0]}function Me(e){let t=1===e.length?e[0]:e.find(e=>e.index||!e.path||"/"===e.path)||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function ve(e,t){let{pathname:E,routeId:a,method:i,type:o,message:_}=void 0===t?{}:t,n="Unknown Server Error",r="Unknown @remix-run/router error";return 400===e?(n="Bad Request",i&&E&&a?r="You made a "+i+' request to "'+E+'" but did not provide a `loader` for route "'+a+'", so there is no way to handle the request.':"defer-action"===o?r="defer() is not supported in actions":"invalid-body"===o&&(r="Unable to encode submission body")):403===e?(n="Forbidden",r='Route "'+a+'" does not match URL "'+E+'"'):404===e?(n="Not Found",r='No route matches URL "'+E+'"'):405===e&&(n="Method Not Allowed",i&&E&&a?r="You made a "+i.toUpperCase()+' request to "'+E+'" but did not provide an `action` for route "'+a+'", so there is no way to handle the request.':i&&(r='Invalid request method "'+i.toUpperCase()+'"')),new X(e||500,n,new Error(r),!0)}function Ue(e){let t=Object.entries(e);for(let e=t.length-1;e>=0;e--){let[E,a]=t[e];if(Fe(a))return{key:E,result:a}}}function Ge(e){return l(a({},"string"==typeof e?A(e):e,{hash:""}))}function ye(e){return He(e.result)&&te.has(e.result.status)}function be(e){return e.type===u.deferred}function ke(e){return e.type===u.error}function Fe(e){return(e&&e.type)===u.redirect}function Ve(e){return"object"==typeof e&&null!=e&&"type"in e&&"data"in e&&"init"in e&&"DataWithResponseInit"===e.type}function He(e){return null!=e&&"number"==typeof e.status&&"string"==typeof e.statusText&&"object"==typeof e.headers&&void 0!==e.body}function Ye(e){return ee.has(e.toLowerCase())}function we(e){return J.has(e.toLowerCase())}async function Ke(e,t,E,a,i){let o=Object.entries(t);for(let _=0;_(null==e?void 0:e.route.id)===n);if(!S)continue;let T=a.find(e=>e.route.id===S.route.id),s=null!=T&&!Oe(T,S)&&void 0!==(i&&i[S.route.id]);be(r)&&s&&await je(r,E,!1).then(e=>{e&&(t[n]=e)})}}async function ze(e,t,E){for(let a=0;a(null==e?void 0:e.route.id)===o)&&(be(n)&&(S(_,"Expected an AbortController for revalidating fetcher deferred result"),await je(n,_.signal,!0).then(e=>{e&&(t[i]=e)})))}}async function je(e,t,E){if(void 0===E&&(E=!1),!await e.deferredData.resolveData(t)){if(E)try{return{type:u.data,data:e.deferredData.unwrappedData}}catch(e){return{type:u.error,error:e}}return{type:u.data,data:e.deferredData.data}}}function xe(e){return new URLSearchParams(e).getAll("index").some(e=>""===e)}function Qe(e,t){let E="string"==typeof t?A(t).search:t.search;if(e[e.length-1].route.index&&xe(E||""))return e[e.length-1];let a=U(e);return a[a.length-1]}function Xe(e){let{formMethod:t,formAction:E,formEncType:a,text:i,formData:o,json:_}=e;if(t&&E&&a)return null!=i?{formMethod:t,formAction:E,formEncType:a,formData:void 0,json:void 0,text:i}:null!=o?{formMethod:t,formAction:E,formEncType:a,formData:o,json:void 0,text:void 0}:void 0!==_?{formMethod:t,formAction:E,formEncType:a,formData:void 0,json:_,text:void 0}:void 0}function $e(e,t){if(t){return{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}return{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function qe(e,t){if(e){return{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}}return{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function Je(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}},56948(e,t,E){"use strict";var a=E(28161),i=a(E(49507)),o=a(E(68048));function _(){return Math.random().toString(32).slice(2)}e.exports=function(e,t){t.addEventListener("message",(function(){var E=(0,o.default)(i.default.mark(function E(a){var o,_,n,r,S,T,s;return i.default.wrap(function(E){for(;;)switch(E.prev=E.next){case 0:if(o=a.data.request){E.next=3;break}return E.abrupt("return");case 3:if(_=o.id,n=o.path,r=o.args,E.prev=4,"function"!=typeof(S=n.reduce(function(e,t){return e[t]},e))){E.next=13;break}return s=n.slice(0,n.length-1).reduce(function(e,t){return e[t]},e),E.next=10,S.apply(s,r);case 10:T=E.sent,E.next=16;break;case 13:return E.next=15,S;case 15:T=E.sent;case 16:t.postMessage({response:{id:_,result:{data:T}}}),E.next=22;break;case 19:E.prev=19,E.t0=E.catch(4),t.postMessage({response:{id:_,result:{error:E.t0}}});case 22:case"end":return E.stop()}},E,null,[[4,19]])}));return function(e){return E.apply(this,arguments)}})()),this.call=(function(){var e=(0,o.default)(i.default.mark(function e(E,a){var o;return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o=_(),e.abrupt("return",new Promise(function(e,i){t.addEventListener("message",function E(a){var _=a.data.response;_&&_.id===o&&(t.removeEventListener("message",E),"error"in _.result?i(_.result.error):e(_.result.data))}),t.postMessage({request:{id:o,path:E,args:a}})}));case 2:case"end":return e.stop()}},e)}));return function(t,E){return e.apply(this,arguments)}})()}},68206(e,t,E){var a=E(55852),i=E(35975);function o(e){var t=(e=e||{}).containerElement;if(!(t instanceof HTMLElement))throw new Error("Container element required to be instance of HTMLElement");var E=e.chromecastTransport;if(!E)throw new Error("Chromecast transport required");var o=E.getCastDevice();if(null===o)throw new Error("Chromecast session must be started");var _=document.createElement("div");_.style.display="flex",_.style.flexDirection="row",_.style.alignItems="center",_.style.justifyContent="center",_.style.width="100%",_.style.height="100%",_.style.backgroundColor="black";var n=document.createElement("div");n.style.flex="none",n.style.maxWidth="80%",n.style.fontSize="5vmin",n.style.lineHeight="1.2em",n.style.maxHeight="3.6em",n.style.textAlign="center",n.style.color="#FFFFFF90",n.innerText="Casting to "+o.friendlyName,_.appendChild(n),t.appendChild(_),E.on("message",l),E.on("message-error",I);var r=new a,S=!1,T={stream:!1,loaded:!1,paused:!1,time:!1,duration:!1,buffering:!1,buffered:!1,audioTracks:!1,selectedAudioTrackId:!1,subtitlesTracks:!1,selectedSubtitlesTrackId:!1,subtitlesOffset:!1,subtitlesSize:!1,subtitlesTextColor:!1,subtitlesBackgroundColor:!1,subtitlesOutlineColor:!1,volume:!1,muted:!1,playbackSpeed:!1,videoParams:!1,extraSubtitlesTracks:!1,selectedExtraSubtitlesTrackId:!1,extraSubtitlesDelay:!1,extraSubtitlesSize:!1,extraSubtitlesOffset:!1,extraSubtitlesTextColor:!1,extraSubtitlesBackgroundColor:!1,extraSubtitlesOutlineColor:!1};function s(e,t){r.emit("error",Object.assign({},i.CHROMECAST_SENDER_VIDEO.MESSAGE_SEND_FAILED,{error:e,action:t}))}function I(e){r.emit("error",Object.assign({},i.CHROMECAST_SENDER_VIDEO.INVALID_MESSAGE_RECEIVED,{error:e}))}function l(e){if(e&&"string"==typeof e.event){var t=Array.isArray(e.args)?e.args:[];r.emit.apply(r,[e.event].concat(t))}else I(new Error("Invalid message: "+e))}function A(e,t){T[e]&&r.emit("propChanged",e,t)}this.on=function(e,t){if(S)throw new Error("Video is destroyed");r.on(e,t)},this.dispatch=function(e){if(S)throw new Error("Video is destroyed");if(e)switch(e.type){case"observeProp":return i=e.propName,T.hasOwnProperty(i)&&(T[i]=!0),void E.sendMessage(e).catch(function(t){s(t,e)});case"setProp":return void E.sendMessage(e).catch(function(t){s(t,e)});case"command":return a=e.commandName,e.commandArgs,"destroy"===a&&(S=!0,A("stream",null),A("loaded",null),A("paused",null),A("time",null),A("duration",null),A("buffering",null),A("buffered",null),A("audioTracks",[]),A("selectedAudioTrackId",[]),A("subtitlesTracks",[]),A("selectedSubtitlesTrackId",null),A("subtitlesOffset",null),A("subtitlesSize",null),A("subtitlesTextColor",null),A("subtitlesBackgroundColor",null),A("subtitlesOutlineColor",null),A("volume",null),A("muted",null),A("playbackSpeed",null),A("videoParams",null),A("extraSubtitlesTracks",[]),A("selectedExtraSubtitlesTrackId",null),A("extraSubtitlesDelay",null),A("extraSubtitlesSize",null),A("extraSubtitlesOffset",null),A("extraSubtitlesTextColor",null),A("extraSubtitlesBackgroundColor",null),A("extraSubtitlesOutlineColor",null),r.removeAllListeners(),E.off("message",l),t.removeChild(_)),void E.sendMessage(e).catch(function(t){s(t,e)})}var a,i;throw new Error("Invalid action dispatched: "+JSON.stringify(e))}}o.canPlayStream=function(){return Promise.resolve(!0)},o.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=o},76933(e,t,E){var a=E(68206);e.exports=a},26102(e,t,E){var a=E(55852),i=E(53683),o=E(55126),_=E(68816),n=E(38742),r=E(35975),S=E(75677),T=E(41461);function s(e){var t=(e=e||{}).containerElement;if(!(t instanceof HTMLElement))throw new Error("Container element required to be instance of HTMLElement");var E=document.createElement("style");t.appendChild(E),E.sheet.insertRule("video::cue { font-size: 4vmin; color: rgb(255, 255, 255); background-color: rgba(0, 0, 0, 0); text-shadow: -0.15rem -0.15rem 0.15rem rgb(34, 34, 34), 0px -0.15rem 0.15rem rgb(34, 34, 34), 0.15rem -0.15rem 0.15rem rgb(34, 34, 34), -0.15rem 0px 0.15rem rgb(34, 34, 34), 0.15rem 0px 0.15rem rgb(34, 34, 34), -0.15rem 0.15rem 0.15rem rgb(34, 34, 34), 0px 0.15rem 0.15rem rgb(34, 34, 34), 0.15rem 0.15rem 0.15rem rgb(34, 34, 34); }");var s=document.createElement("video");function I(){D("fullscreen")}s.style.width="100%",s.style.height="100%",s.style.backgroundColor="black",s.style.objectFit="contain",s.controls=!1,s.playsInline=!0,s.onerror=function(){!(function(){if(O)return;var e;switch(s.error.code){case 1:e=r.HTML_VIDEO.MEDIA_ERR_ABORTED;break;case 2:e=r.HTML_VIDEO.MEDIA_ERR_NETWORK;break;case 3:e=r.HTML_VIDEO.MEDIA_ERR_DECODE;break;case 4:e=r.HTML_VIDEO.MEDIA_ERR_SRC_NOT_SUPPORTED;break;default:e=r.UNKNOWN_ERROR}m(Object.assign({},e,{critical:!0,error:s.error}))})()},s.onended=function(){A.emit("ended")},s.onpause=function(){D("paused")},s.onplay=function(){D("paused")},s.ontimeupdate=function(){D("time"),D("buffered")},s.ondurationchange=function(){D("duration")},s.onwaiting=function(){D("buffering"),D("buffered")},s.onseeking=function(){D("time"),D("buffering"),D("buffered")},s.onseeked=function(){D("time"),D("buffering"),D("buffered")},s.onstalled=function(){D("buffering"),D("buffered")},s.onplaying=function(){D("time"),D("buffering"),D("buffered")},s.oncanplay=function(){D("buffering"),D("buffered")},s.canplaythrough=function(){D("buffering"),D("buffered")},s.onloadedmetadata=function(){D("loaded")},s.onloadeddata=function(){D("buffering"),D("buffered")},s.onvolumechange=function(){D("volume"),D("muted")},s.onratechange=function(){D("playbackSpeed")},s.textTracks.onchange=function(){D("subtitlesTracks"),D("selectedSubtitlesTrackId"),L(),Array.from(s.textTracks).forEach(function(e){e.oncuechange=L})},t.appendChild(s),s.addEventListener("webkitbeginfullscreen",I),s.addEventListener("webkitendfullscreen",I),s.addEventListener("fullscreenchange",I);var l=null,A=new a,O=!1,u=null,R=0,N=1,d={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,videoScale:!1,fullscreen:!1};function c(e){switch(e){case"stream":return u;case"loaded":return null===u?null:s.readyState>=s.HAVE_METADATA;case"paused":return null===u?null:!!s.paused;case"time":return null!==u&&null!==s.currentTime&&isFinite(s.currentTime)?Math.floor(1e3*s.currentTime):null;case"duration":return null!==u&&null!==s.duration&&isFinite(s.duration)?Math.floor(1e3*s.duration):null;case"buffering":return null===u?null:s.readyState0?e.lang:"string"==typeof e.name&&e.name.length>0?e.name:String(t),label:"string"==typeof e.name&&e.name.length>0?e.name:"string"==typeof e.lang&&e.lang.length>0?e.lang:String(t),origin:"EMBEDDED",embedded:!0})}):[];case"selectedAudioTrackId":if(null===l||-1===l.audioTrack)return null;var i=l.audioTracks[l.audioTrack];if(!i)return null;var o=l.allAudioTracks.indexOf(i);return-1===o?null:"EMBEDDED_"+String(o);case"volume":return O||null===s.volume||!isFinite(s.volume)?null:Math.floor(100*s.volume);case"muted":return O?null:!!s.muted;case"playbackSpeed":return O||null===s.playbackRate||!isFinite(s.playbackRate)?null:s.playbackRate;case"videoScale":return s.style.objectFit||"contain";case"fullscreen":return null===u?null:!0===s.webkitDisplayingFullscreen||document.fullscreenElement===s;default:return null}}function L(){Array.from(s.textTracks).forEach(function(e){Array.from(e.cues||[]).forEach(function(e){e.snapToLines=!1,e.line=100-R})})}function m(e){A.emit("error",e),e.critical&&C("unload")}function D(e){d[e]&&A.emit("propChanged",e,c(e))}function C(e,a){switch(e){case"load":C("unload"),a&&a.stream&&"string"==typeof a.stream.url?(u=a.stream,D("stream"),D("loaded"),s.autoplay="boolean"!=typeof a.autoplay||a.autoplay,s.currentTime=null!==a.time&&isFinite(a.time)?parseInt(a.time,10)/1e3:0,D("paused"),D("time"),D("duration"),D("buffering"),D("buffered"),D("subtitlesTracks"),D("selectedSubtitlesTrackId"),D("audioTracks"),D("selectedAudioTrackId"),D("fullscreen"),S(u).then(function(e){u===a.stream&&("application/vnd.apple.mpegurl"===e&&i.isSupported()?((l=new i(T)).on(i.Events.AUDIO_TRACKS_UPDATED,function(){D("audioTracks"),D("selectedAudioTrackId")}),l.on(i.Events.AUDIO_TRACK_SWITCHED,function(){D("audioTracks"),D("selectedAudioTrackId")}),l.on(i.Events.MANIFEST_LOADING,function(){l.subtitleTrack=-1}),l.loadSource(u.url),l.attachMedia(s)):s.src=u.url)}).catch(function(){u===a.stream&&(s.src=u.url)})):m(Object.assign({},r.UNSUPPORTED_STREAM,{critical:!0,stream:a?a.stream:null}));break;case"unload":u=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,D("stream"),D("loaded"),D("paused"),D("time"),D("duration"),D("buffering"),D("buffered"),D("subtitlesTracks"),D("selectedSubtitlesTrackId"),D("audioTracks"),D("selectedAudioTrackId"),D("fullscreen");break;case"destroy":C("unload"),O=!0,D("subtitlesOffset"),D("subtitlesSize"),D("subtitlesTextColor"),D("subtitlesBackgroundColor"),D("subtitlesOutlineColor"),D("subtitlesOpacity"),D("volume"),D("muted"),D("playbackSpeed"),A.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,s.removeEventListener("webkitbeginfullscreen",I),s.removeEventListener("webkitendfullscreen",I),s.removeEventListener("fullscreenchange",I),t.removeChild(s),t.removeChild(E)}}this.on=function(e,t){if(O)throw new Error("Video is destroyed");A.on(e,t)},this.dispatch=function(e){if(O)throw new Error("Video is destroyed");if(e)switch((e=_(o(e))).type){case"observeProp":return t=e.propName,void(d.hasOwnProperty(t)&&(A.emit("propValue",t,c(t)),d[t]=!0));case"setProp":return void(function(e,t){switch(e){case"paused":null!==u&&(t?s.pause():s.play(),D("paused"));break;case"time":null!==u&&null!==t&&isFinite(t)&&(s.currentTime=parseInt(t,10)/1e3,D("time"));break;case"selectedSubtitlesTrackId":if(null!==u){Array.from(s.textTracks).forEach(function(e,E){e.mode="EMBEDDED_"+String(E)===t?"showing":"disabled"});var a=c("subtitlesTracks").find(function(e){return e.id===t});D("selectedSubtitlesTrackId"),a&&A.emit("subtitlesTrackLoaded",a)}break;case"subtitlesOffset":null!==t&&isFinite(t)&&(R=Math.max(0,Math.min(100,parseInt(t,10))),L(),D("subtitlesOffset"));break;case"subtitlesSize":null!==t&&isFinite(t)&&(E.sheet.cssRules[0].style.fontSize=Math.floor(Math.max(0,parseInt(t,10))/25)+"vmin",D("subtitlesSize"));break;case"subtitlesTextColor":if("string"==typeof t){try{E.sheet.cssRules[0].style.color=n(t).rgb().string()}catch(e){console.error("HTMLVideo",e)}D("subtitlesTextColor")}break;case"subtitlesBackgroundColor":if("string"==typeof t){try{E.sheet.cssRules[0].style.backgroundColor=n(t).rgb().string()}catch(e){console.error("HTMLVideo",e)}D("subtitlesBackgroundColor")}break;case"subtitlesOutlineColor":if("string"==typeof t){try{var i=n(t).rgb().string();E.sheet.cssRules[0].style.textShadow="-0.15rem -0.15rem 0.15rem "+i+", 0px -0.15rem 0.15rem "+i+", 0.15rem -0.15rem 0.15rem "+i+", -0.15rem 0px 0.15rem "+i+", 0.15rem 0px 0.15rem "+i+", -0.15rem 0.15rem 0.15rem "+i+", 0px 0.15rem 0.15rem "+i+", 0.15rem 0.15rem 0.15rem "+i}catch(e){console.error("HTMLVideo",e)}D("subtitlesOutlineColor")}break;case"subtitlesOpacity":if("number"==typeof t){try{N=Math.min(Math.max(t/100,0),1),E.sheet.cssRules[0].style.opacity=N+""}catch(e){console.error("VVideo with HTML Subtitles",e)}D("subtitlesOpacity")}break;case"selectedAudioTrackId":if(null!==l){var o=c("audioTracks").find(function(e){return e.id===t});if(o){var _=parseInt(o.id.split("_").pop(),10),r=l.allAudioTracks;_>=0&&_l[0]||!(I[0]=l[1]?E.send("mpv-command",["loadfile",u.url,"replace","-1","start=+"+A]):E.send("mpv-command",["loadfile",u.url,"replace","start=+"+A])):E.send("mpv-command",["loadfile",u.url]),E.send("mpv-set-prop",["sid","no"]),E.send("mpv-set-prop",["pause",!1]),E.send("mpv-set-prop",["speed",s.speed]),s.aid&&("string"==typeof s.aid&&s.aid.startsWith("EMBEDDED_")?E.send("mpv-set-prop",["aid",s.aid.slice(9)]):E.send("mpv-set-prop",["aid",s.aid])),E.send("mpv-set-prop",["mute","no"]),C("paused"),C("time"),C("duration"),C("buffering"),C("buffered"),C("muted"),C("subtitlesTracks"),C("selectedSubtitlesTrackId")}):D(Object.assign({},_.UNSUPPORTED_STREAM,{critical:!0,stream:a?a.stream:null}));break;case"unload":N=null,s={loaded:!1,pause:!1,mute:!1,speed:1,subtitlesTracks:[],audioTracks:[],buffering:!1,buffered:null,aid:null,sid:null},R=0,E.send("mpv-command",["stop"]),C("loaded"),C("stream"),C("paused"),C("time"),C("duration"),C("buffering"),C("buffered"),C("muted"),C("subtitlesTracks"),C("selectedSubtitlesTrackId"),d(!0);break;case"destroy":p("unload"),O=!0,A.removeAllListeners()}}E.on("mpv-prop-change",function(e){switch(e.name){case"mpv-version":t(e.data),s[e.name]=c(e);break;case"ffmpeg-version":s[e.name]=c(e);break;case"duration":var E=0|e.data;s[e.name]=e.data>=30&&(!R||E===R)?Math.round(1e3*e.data):null,R=R?R+E>>1:E;break;case"time-pos":case"sub-delay":s[e.name]=Math.round(1e3*e.data);break;case"sub-scale":s[e.name]=Math.round(e.data/n);break;case"sub-pos":s[e.name]=100-e.data;break;case"volume":"number"==typeof e.data&&isFinite(e.data)&&(s[e.name]=e.data,C("volume"));break;case"paused-for-cache":case"seeking":s.buffering!==e.data&&(s.buffering=e.data,C("buffering"));break;case"demuxer-cache-time":var a=e.data||0;s[e.name]=a>0?Math.floor(1e3*a):null,C("buffered");break;case"aid":case"sid":case"vid":s[e.name]=(function(e){return e.data&&"no"!==e.data?"EMBEDDED_"+e.data.toString():null})(e);break;case"video-params":s[e.name]=e.data;var i=e.data||{},o="string"==typeof i.gamma?i.gamma:null;s.hdrInfo="pq"===o||"hlg"===o?{gamma:o,primaries:"string"==typeof i.primaries?i.primaries:null,maxCll:"number"==typeof i["max-cll"]?i["max-cll"]:null,maxLuma:"number"==typeof i["max-luma"]?i["max-luma"]:null}:null,C("hdrInfo");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"}}),C("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"}}),C("subtitlesTracks");break;default:s[e.name]=e.data}var _="time-pos"===e.name?Math.floor(s["time-pos"]/1e3):null;_&&L===_||!I[e.name]||(_&&(L=_),C(I[e.name]))}),E.on("mpv-event-ended",function(e){var t,E;e.error?D(e.error):e.reason&&"eof"!==e.reason&&"other"!==e.reason||(t=s["time-pos"],E=s.duration,"number"==typeof t&&isFinite(t)&&"number"==typeof E&&isFinite(E)&&t+6e4N)&&(N=e.loadId))}),this.on=function(e,t){if(O)throw new Error("Video is destroyed");A.on(e,t)},this.dispatch=function(e){if(O)throw new Error("Video is destroyed");if(e)switch((e=o(i(e))).type){case"observeProp":t=e.propName,A.emit("propValue",t,m(t)),T[t]=!0;break;case"setProp":return void(function(e,t){switch(e){case"paused":null!==u&&E.send("mpv-set-prop",["pause",t]);break;case"time":null!==u&&null!==t&&isFinite(t)&&E.send("mpv-set-prop",["time-pos",t/1e3]);break;case"playbackSpeed":null!==u&&null!==t&&isFinite(t)&&E.send("mpv-set-prop",["speed",t]);break;case"videoScale":if(null!==u){switch(t){case"cover":E.send("mpv-set-prop",["keepaspect",!0]),E.send("mpv-set-prop",["panscan",1]);break;case"fill":E.send("mpv-set-prop",["keepaspect",!1]),E.send("mpv-set-prop",["panscan",0]);break;default:E.send("mpv-set-prop",["keepaspect",!0]),E.send("mpv-set-prop",["panscan",0])}s.videoScale=t,C("videoScale")}break;case"volume":null!==u&&null!==t&&isFinite(t)&&(s.mute=!1,E.send("mpv-set-prop",["mute","no"]),E.send("mpv-set-prop",["volume",t]),C("muted"),C("volume"));break;case"muted":null!==u&&(E.send("mpv-set-prop",["mute",t?"yes":"no"]),s.mute=t,C("muted"));break;case"selectedAudioTrackId":if(null!==u){var a=t.slice(9);E.send("mpv-set-prop",["aid",a])}break;case"selectedSubtitlesTrackId":null!==u&&(t?(a=t.slice(9),E.send("mpv-set-prop",["sid",a]),A.emit("subtitlesTrackLoaded",t)):(E.send("mpv-set-prop",["sid","no"]),s.sid=null)),C("selectedSubtitlesTrackId");break;case"subtitlesSize":E.send("mpv-set-prop",[r[e],t*n]);break;case"subtitlesDelay":E.send("mpv-set-prop",[r[e],t]);break;case"subtitlesOffset":E.send("mpv-set-prop",[r[e],100-t]);break;case"subtitlesTextColor":case"subtitlesBackgroundColor":case"subtitlesOutlineColor":var i=t.replace(/^#(\w{6})(\w{2})$/,"#$2$1");E.send("mpv-set-prop",[r[e],i]);break;default:console.log("Unhandled setProp for",e)}})(e.propName,e.propValue);case"command":return void p(e.commandName,e.commandArgs)}var t}}T.canPlayStream=function(){return Promise.resolve(!0)},T.manifest={name:"ShellVideo",external:!1,props:Object.keys(r),commands:["load","unload","destroy"],events:["propValue","propChanged","ended","error","subtitlesTrackLoaded"]},e.exports=T},37439(e,t,E){var a=E(90990);e.exports=a},23564(e,t,E){var a=E(55852),i=E(55126),o=E(68816),_=E(10683),n=E(68046),r=E(35975);function S(){var e=null,t=new a,E=!1;this.on=function(e,a){if(E)throw new Error("Video is destroyed");t.on(e,a)},this.dispatch=function(a,S){if(E)throw new Error("Video is destroyed");if(!a)throw new Error("Invalid action dispatched: "+JSON.stringify(a));if(S=S||{},"command"===(a=o(i(a))).type&&"load"===a.commandName&&a.commandArgs){a.commandArgs.platform&&n.set(a.commandArgs.platform);var T=_(a.commandArgs,S);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({},r.UNSUPPORTED_STREAM,{error:new Error("No video implementation was selected"),critical:!0,stream:a.commandArgs.stream}));(e=new T(S)).on("ended",function(){t.emit("ended")}),e.on("error",function(e){t.emit("error",e)}),e.on("propValue",function(e,E){t.emit("propValue",e,E)}),e.on("propChanged",function(e,E){t.emit("propChanged",e,E)}),e.on("subtitlesTrackLoaded",function(e){t.emit("subtitlesTrackLoaded",e)}),e.on("audioTrackLoaded",function(e){t.emit("audioTrackLoaded",e)}),e.on("extraSubtitlesTrackLoaded",function(e){t.emit("extraSubtitlesTrackLoaded",e)}),e.on("extraSubtitlesTrackAdded",function(e){t.emit("extraSubtitlesTrackAdded",e)}),T.manifest.external?e.on("implementationChanged",function(e){t.emit("implementationChanged",e)}):t.emit("implementationChanged",T.manifest)}}if(null!==e)try{e.dispatch(a)}catch(t){console.error(e.constructor.manifest.name,t)}"command"===a.type&&"destroy"===a.commandName&&(e=null)},this.destroy=function(){E=!0,null!==e&&(e.dispatch({type:"command",commandName:"destroy"}),e=null),t.removeAllListeners()}}S.ERROR=r,e.exports=S},37354(e,t,E){var a=E(23564);e.exports=a},10683(e,t,E){var a=E(76933),i=E(37439),o=E(67066),_=E(12129),n=E(70519),r=E(36110),S=E(72801),T=E(22861),s=E(58962),I=E(52913),l=E(5280),A=E(37651);e.exports=function(e,t){return e.stream&&"string"!=typeof e.stream.externalUrl?t.chromecastTransport&&t.chromecastTransport.getCastState()===cast.framework.CastState.CONNECTED?a:"string"==typeof e.stream.ytId?A(l(s)):"string"==typeof e.stream.playerFrameUrl?A(T):t.shellTransport?I(l(i)):"string"==typeof e.streamingServerURL?"Tizen"===e.platform?I(l(_)):"webOS"===e.platform?I(l(S)):"Titan"===e.platform||"NetTV"===e.platform?I(l(n)):"Vidaa"===e.platform?I(l(r)):I(l(o)):"string"==typeof e.stream.url?"Tizen"===e.platform?A(l(_)):"webOS"===e.platform?A(l(S)):"Titan"===e.platform||"NetTV"===e.platform?A(l(n)):"Vidaa"===e.platform?A(l(r)):A(l(o)):null:null}},36302(e,t,E){var a=E(55852),i=E(55126),o=E(68816),_=E(38742),n=E(35975),r=/^\{(\\an[1-8])+\}/i;function S(e){var t=100,E=0,S="rgb(255, 255, 255)",T="rgba(0, 0, 0, 0)",s="rgb(34, 34, 34)",I=1,l=(e=e||{}).containerElement;if(!(l instanceof HTMLElement))throw new Error("Container element required to be instance of HTMLElement");var A=document.createElement("video");A.style.width="100%",A.style.height="100%",A.style.backgroundColor="black",A.controls=!1,A.playsInline=!0,A.onerror=function(){!(function(){if(N)return;var e;switch(A.error.code){case 1:e=n.HTML_VIDEO.MEDIA_ERR_ABORTED;break;case 2:e=n.HTML_VIDEO.MEDIA_ERR_NETWORK;break;case 3:e=n.HTML_VIDEO.MEDIA_ERR_DECODE;break;case 4:e=n.HTML_VIDEO.MEDIA_ERR_SRC_NOT_SUPPORTED;break;default:e=n.UNKNOWN_ERROR}p(Object.assign({},e,{critical:!0,error:A.error}))})()},A.onended=function(){R.emit("ended")},A.onpause=function(){P("paused")},A.onplay=function(){P("paused")},A.ontimeupdate=function(){P("time")},A.ondurationchange=function(){P("duration")},A.onwaiting=function(){P("buffering")},A.onseeking=function(){P("time"),P("buffering")},A.onseeked=function(){P("time"),P("buffering")},A.onstalled=function(){P("buffering")},A.onplaying=function(){P("time"),P("buffering")},A.oncanplay=function(){P("buffering")},A.canplaythrough=function(){P("buffering")},A.onloadedmetadata=function(){P("loaded")},A.onloadeddata=function(){P("buffering")},A.onvolumechange=function(){P("volume"),P("muted")},A.onratechange=function(){P("playbackSpeed")},A.textTracks.onchange=function(){P("subtitlesTracks"),P("selectedSubtitlesTrackId")},l.appendChild(A);var O=document.createElement("div");O.style.position="absolute",O.style.right="0",O.style.bottom="0",O.style.left="0",O.style.zIndex="1",O.style.textAlign="center",l.style.position="relative",l.style.zIndex="0",l.appendChild(O);var u,R=new a,N=!1,d=null,c={stream:!1,loaded:!1,paused:!1,time:!1,duration:!1,buffering:!1,subtitlesTracks:!1,selectedSubtitlesTrackId:!1,subtitlesOffset:!1,subtitlesSize:!1,subtitlesTextColor:!1,subtitlesBackgroundColor:!1,subtitlesOutlineColor:!1,audioTracks:!1,selectedAudioTrackId:!1,volume:!1,muted:!1,playbackSpeed:!1};async function L(){u&&m(u.text,"show")}async function m(e,a){if("hide"!==a){for(u={text:e};O.hasChildNodes();)O.removeChild(O.lastChild);O.style.bottom=E+"%",O.style.opacity=I;var i=document.createElement("span");i.innerHTML=e,i.style.display="inline-block",i.style.padding="0.2em",i.style.fontSize=Math.floor(t/25)+"vmin",i.style.color=S,i.style.backgroundColor=T,i.style.textShadow="1px 1px 0.1em "+s,i.style.whiteSpace="pre-wrap",O.appendChild(i),O.appendChild(document.createElement("br"))}else{for(;O.hasChildNodes();)O.removeChild(O.lastChild);u=null}}function D(e){var t=(e.target||{}).activeCues;if(t.length){if(t.length>3)return e.target.removeEventListener("cuechange",D),void m("","hide");var E="";for(var a in t){var i=t[a];if(i.text)E+=(E?"\n":"")+i.text.replace(r,"")}m(E,"show")}else m("","hide")}function C(e){switch(e){case"stream":return d;case"loaded":return null===d?null:A.readyState>=A.HAVE_METADATA;case"paused":return null===d?null:!!A.paused;case"time":return null!==d&&null!==A.currentTime&&isFinite(A.currentTime)?Math.floor(1e3*A.currentTime):null;case"duration":return null!==d&&null!==A.duration&&isFinite(A.duration)?Math.floor(1e3*A.duration):null;case"buffering":return null===d?null:A.readyState0&&p(t,l.text)}}function p(e,t){if(!D){var a=y("time"),i=t.replace(S,"");for(l={duration:e,text:i,now:a},P&&(clearTimeout(P),P=!1);B.hasChildNodes();)B.removeChild(B.lastChild);B.style.bottom=R+"%",B.style.opacity=L;var o=document.createElement("span");o.innerHTML=i,o.style.display="inline-block",o.style.padding="0.2em",o.style.fontSize=Math.floor(u/25)+"vmin",o.style.color=N,o.style.backgroundColor=d,o.style.textShadow="1px 1px 0.1em "+c,B.appendChild(o),B.appendChild(document.createElement("br")),e&&(P=setTimeout(function(){for(;B.hasChildNodes();)B.removeChild(B.lastChild)},parseInt(e*E)))}}var P=!1;A.setListener({onbufferingstart:function(){t=!0,k("buffering")},onbufferingprogress:function(){t=!0,k("buffering")},onbufferingcomplete:function(){t=!1,k("buffering")},oncurrentplaytime:function(){k("time")},onsubtitlechange:function(e,t){p(e,t)},onstreamcompleted:function(){h.emit("ended")}}),I.appendChild(m);var B=document.createElement("div");B.style.position="absolute",B.style.right="0",B.style.bottom="0",B.style.left="0",B.style.zIndex="1",B.style.textAlign="center",I.style.position="relative",I.style.zIndex="0",I.appendChild(B);var h=new a,f=!1,W=null,g=0,M=null,v={stream:!1,loaded:!1,paused:!1,time:!1,duration:!1,buffering:!1,subtitlesTracks:!1,selectedSubtitlesTrackId:!1,subtitlesOffset:!1,subtitlesSize:!1,subtitlesTextColor:!1,subtitlesBackgroundColor:!1,subtitlesOutlineColor:!1,subtitlesOpacity:!1,audioTracks:!1,selectedAudioTrackId:!1,playbackSpeed:!1},U=!1,G={audio:[],subs:[]};function y(e){switch(e){case"stream":return W;case"loaded":return M;case"paused":if(null===W)return null;var a=!("PAUSED"!==A.getState());return!a&&O&&(A.setSelectTrack("AUDIO",parseInt(O.replace("EMBEDDED_",""))),O=!1),a;case"time":var i=A.getCurrentTime();return null!==W&&null!==i&&isFinite(i)?Math.floor(i):null;case"duration":var o=A.getDuration();return null!==W&&null!==o&&isFinite(o)?Math.floor(o):null;case"buffering":return null===W?null:t;case"subtitlesTracks":if(null===W)return[];for(var _=A.getTotalTrackInfo(),n=[],r=0;r<_.length;r++)if("TEXT"===_[r].type){var S=_[r],I="EMBEDDED_"+String(S.index),l={};try{l=JSON.parse(S.extra_info)}catch(e){}var m="string"==typeof l.track_lang&&l.track_lang.length>0?l.track_lang.trim():null,C=null;if(((G||{}).subs||[]).length)(g=G.subs.find(function(e){return(e||{}).id-1===S.index}))&&(m=g.lang||"eng",C=g.label||null);n.push({id:I,lang:m,label:C,origin:"EMBEDDED",embedded:!0,mode:D||I!==T?"disabled":"showing"})}return n;case"selectedSubtitlesTrackId":if(null===W||D)return null;var p=A.getCurrentStreamInfo();for(r=0;r0?l.language:null,U=null;if(((G||{}).audio||[]).length)(g=G.audio.find(function(e){return(e||{}).id-1===B.index}))&&(v=g.lang||"eng",U=g.label||null);P.push({id:h,lang:v,label:U,origin:"EMBEDDED",embedded:!0,mode:h===s?"showing":"disabled"})}return P;case"selectedAudioTrackId":if(null===W)return null;if(O)return O;p=A.getCurrentStreamInfo();var y=!1;for(r=0;r=6)&&(U||null===W||(U=!0,r(W.url,function(e){e&&(G=e),((G||{}).subs||[]).length&&k("subtitlesTracks"),((G||{}).audio||[]).length&&k("audioTracks")}))),A.open(W.url),A.setDisplayRect(0,0,window.innerWidth,window.innerHeight),A.setDisplayMethod("PLAYER_DISPLAY_MODE_LETTER_BOX"),A.seekTo(null!==t.time&&isFinite(t.time)?parseInt(t.time,10):0),A.prepareAsync(function(){k("duration"),A.play(),M=!0,k("loaded"),k("stream"),k("paused"),k("time"),k("duration"),k("subtitlesTracks"),k("selectedSubtitlesTrackId"),k("audioTracks"),k("selectedAudioTrackId")},function(e){if(g<5){g++;try{A.stop()}catch(e){}F("load",t)}else b(Object.assign({},n.STREAM_FAILED_TO_LOAD,{critical:!0,stream:t?t.stream:null,error:e}))})}else b(Object.assign({},n.UNSUPPORTED_STREAM,{critical:!0,stream:t?t.stream:null}));break;case"unload":W=null,A.stop(),M=!1,k("loaded"),k("stream"),k("paused"),k("time"),k("duration"),k("buffering"),k("subtitlesTracks"),k("selectedSubtitlesTrackId"),k("audioTracks"),k("selectedAudioTrackId");break;case"destroy":F("unload"),f=!0,A.stop(),k("subtitlesOffset"),k("subtitlesSize"),k("subtitlesTextColor"),k("subtitlesBackgroundColor"),k("subtitlesOutlineColor"),k("subtitlesOpacity"),k("playbackSpeed"),h.removeAllListeners(),I.removeChild(m)}}this.on=function(e,t){if(f)throw new Error("Video is destroyed");h.on(e,t)},this.dispatch=function(e){if(f)throw new Error("Video is destroyed");if(e)switch((e=o(i(e))).type){case"observeProp":return void(function(e){if(v.hasOwnProperty(e)){var t=y(e);h.emit("propValue",e,t),v[e]=!0}})(e.propName);case"setProp":return void(function(e,t){switch(e){case"paused":if(null!==W){var a=!!t;a?A.pause():A.play(),a?P&&clearTimeout(P):C()}k("paused");var i=y("paused");setTimeout(function(){y("paused")!==i&&k("paused")},1e3);break;case"time":null!==W&&null!==t&&isFinite(t)&&(A.seekTo(parseInt(t,10)),p(1,""),k("time"));break;case"selectedSubtitlesTrackId":if(null!==W){if(-1===(t||"").indexOf("EMBEDDED_")||!t)return p(1,""),D=!0,void k("selectedSubtitlesTrackId");var o=y("subtitlesTracks").find(function(e){return e.id===t});o&&(D=!1,T=t,A.setSelectTrack("TEXT",parseInt(o.id.replace("EMBEDDED_",""))),h.emit("subtitlesTrackLoaded",o),k("selectedSubtitlesTrackId"))}break;case"subtitlesOffset":null!==t&&isFinite(t)&&(R=Math.max(0,Math.min(100,parseInt(t,10))),C(),k("subtitlesOffset"));break;case"subtitlesSize":null!==t&&isFinite(t)&&(u=Math.max(0,parseInt(t,10)),C(),k("subtitlesSize"));break;case"subtitlesTextColor":if("string"==typeof t){try{N=_(t).rgb().string()}catch(e){console.error("Tizen player with HTML Subtitles",e)}C(),k("subtitlesTextColor")}break;case"subtitlesBackgroundColor":if("string"==typeof t){try{d=_(t).rgb().string()}catch(e){console.error("Tizen player with HTML Subtitles",e)}C(),k("subtitlesBackgroundColor")}break;case"subtitlesOutlineColor":if("string"==typeof t){try{c=_(t).rgb().string()}catch(e){console.error("Tizen player with HTML Subtitles",e)}C(),k("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)}C(),k("subtitlesOpacity")}break;case"selectedAudioTrackId":if(null!==W){s=t;var n=y("audioTracks").find(function(e){return e.id===t});y("paused")?(O=t,k("selectedAudioTrackId")):A.setSelectTrack("AUDIO",parseInt(s.replace("EMBEDDED_",""))),n&&(h.emit("audioTrackLoaded",n),k("selectedAudioTrackId"))}break;case"playbackSpeed":if(null!==t&&isFinite(t)){E=parseFloat(t);try{A.setSpeed(E)}catch(e){}k("playbackSpeed")}}})(e.propName,e.propValue);case"command":return void F(e.commandName,e.commandArgs)}throw new Error("Invalid action dispatched: "+JSON.stringify(e))}}T.canPlayStream=function(){return Promise.resolve(!0)},T.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=T},12129(e,t,E){var a=E(44910);e.exports=a},98796(e,t,E){var a=E(55852),i=E(55126),o=E(68816),_=E(35975);function n(e){var t=(e=e||{}).containerElement;if(!(t instanceof HTMLElement))throw new Error("Container element required to be instance of HTMLElement");var E=document.createElement("video");E.style.width="100%",E.style.height="100%",E.style.backgroundColor="black",E.controls=!1,E.playsInline=!0,E.onerror=function(){!(function(){if(S)return;var e;switch(E.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}A(Object.assign({},e,{critical:!0,error:E.error}))})()},E.onended=function(){r.emit("ended")},E.onpause=function(){O("paused")},E.onplay=function(){O("paused")},E.ontimeupdate=function(){O("time")},E.ondurationchange=function(){O("duration")},E.onwaiting=function(){O("buffering")},E.onseeking=function(){O("time"),O("buffering")},E.onseeked=function(){O("time"),O("buffering")},E.onstalled=function(){O("buffering")},E.onplaying=function(){O("time"),O("buffering")},E.oncanplay=function(){O("buffering")},E.canplaythrough=function(){O("buffering")},E.onloadedmetadata=function(){O("loaded")},E.onloadeddata=function(){O("buffering")},E.onvolumechange=function(){O("volume"),O("muted")},E.onratechange=function(){O("playbackSpeed")},E.textTracks.onchange=function(){O("subtitlesTracks"),O("selectedSubtitlesTrackId"),l(),Array.from(E.textTracks).forEach(function(e){e.oncuechange=l})},t.appendChild(E);var n=document.createElement("div");n.style.position="absolute",n.style.right="0",n.style.bottom="0",n.style.left="0",n.style.zIndex="1",n.style.textAlign="center",t.style.position="relative",t.style.zIndex="0",t.appendChild(n);var r=new a,S=!1,T=null,s={stream:!1,loaded:!1,paused:!1,time:!1,duration:!1,buffering:!1,subtitlesTracks:!1,selectedSubtitlesTrackId:!1,audioTracks:!1,selectedAudioTrackId:!1,volume:!1,muted:!1,playbackSpeed:!1};function I(e){switch(e){case"stream":return T;case"loaded":return null===T?null:E.readyState>=E.HAVE_METADATA;case"paused":return null===T?null:!!E.paused;case"time":return null!==T&&null!==E.currentTime&&isFinite(E.currentTime)?Math.floor(1e3*E.currentTime):null;case"duration":return null!==T&&null!==E.duration&&isFinite(E.duration)?Math.floor(1e3*E.duration):null;case"buffering":return null===T?null:E.readyState=m.HAVE_METADATA&&null!==t&&isFinite(t))try{m.currentTime=parseInt(t,10)/1e3,F("time")}catch(e){}break;case"selectedSubtitlesTrackId":if(m.mediaId&&null!==h&&0===(t||"").indexOf("EMBEDDED_")){c(!0),d.bg_opacity="none"===d.bg_color?0:255,["setSubtitleCharacterColor","setSubtitleBackgroundColor","setSubtitlePosition","setSubtitleFontSize","setSubtitleBackgroundOpacity","setSubtitleCharacterOpacity"].forEach(function(e){r({method:e,parameters:{mediaId:m.mediaId,charColor:d.color,bgColor:"none"===d.bg_color?"black":d.bg_color,position:d.position,fontSize:d.font_size,bgOpacity:d.bg_opacity,charOpacity:d.char_opacity}})}),console.log("WebOS","change subtitles for id: ",m.mediaId," index:",t),O=t;var E=parseInt(t.replace("EMBEDDED_",""));console.log("set subs to track idx: "+E),setTimeout(function(){var e=function(){var e=y("subtitlesTracks").find(function(e){return e.id===t});R=R.map(function(e){return e.mode=e.id===O?"showing":"disabled",e}),e&&(P.emit("subtitlesTrackLoaded",e),F("selectedSubtitlesTrackId"))};r({method:"selectTrack",parameters:{type:"text",mediaId:m.mediaId,index:E}},e,e)},500)}-1===(t||"").indexOf("EMBEDDED_")&&(O=null,F("selectedSubtitlesTrackId"),c(!1));break;case"subtitlesOffset":if(null!==t&&isFinite(t)){W=t;var a=(l=Math.max(0,Math.min(100,parseInt(W,10))))<=0?-3:l<=5?-2:l<=10?0:l<=15?2:l<=20&&4;!1===a&&(a=-2),d.position=a,m.mediaId&&r({method:"setSubtitlePosition",parameters:{mediaId:m.mediaId,position:a}}),F("subtitlesOffset")}break;case"subtitlesSize":if(null!==t&&isFinite(t)){I=t;var i=(s=Math.max(0,parseInt(I,10)))<=25?0:s<=100?1:s<=125?2:s<=150?3:s<=200&&4;!1===i&&(i=1),d.font_size=i,m.mediaId&&r({method:"setSubtitleFontSize",parameters:{mediaId:m.mediaId,fontSize:i}}),F("subtitlesSize")}break;case"subtitlesTextColor":if("string"==typeof t){var o="white";T[t]&&S.indexOf(T[t])>-1&&(o=T[t]),d.color=o,m.mediaId&&r({method:"setSubtitleCharacterColor",parameters:{mediaId:m.mediaId,charColor:o}}),D=t,F("subtitlesTextColor")}break;case"subtitlesBackgroundColor":"string"==typeof t&&(T[t]&&S.indexOf(T[t])>-1&&(d.bg_color=T[t],m.mediaId&&(r({method:"setSubtitleBackgroundColor",parameters:{mediaId:m.mediaId,bgColor:"none"===T[t]?"black":T[t]}}),r("none"===T[t]?{method:"setSubtitleBackgroundOpacity",parameters:{mediaId:m.mediaId,bgOpacity:0}}:{method:"setSubtitleBackgroundOpacity",parameters:{mediaId:m.mediaId,bgOpacity:255}}))),C=t,F("subtitlesBackgroundColor"));break;case"subtitlesOpacity":if("number"==typeof t){var _=Math.floor(t/100*255);d.char_opacity=_,m.mediaId&&r({method:"setSubtitleCharacterOpacity",parameters:{mediaId:m.mediaId,charOpacity:_}}),g=t,F("subtitlesOpacity")}break;case"selectedAudioTrackId":if(0===(t||"").indexOf("EMBEDDED_")){u=t;E=parseInt(t.replace("EMBEDDED_",""));if(m.mediaId&&r({method:"selectTrack",parameters:{type:"audio",mediaId:m.mediaId,index:E}},function(){var e=y("audioTracks").find(function(e){return e.id===t});N=N.map(function(e){return e.mode=e.id===u?"showing":"disabled",e}),e&&(P.emit("audioTrackLoaded",e),F("selectedAudioTrackId"))}),m&&m.audioTracks){for(var n=0;n4&&(clearInterval(o),G(),l(),i())},300)}else k(Object.assign({},_.UNSUPPORTED_STREAM,{critical:!0,stream:E?E.stream:null}));break;case"unload":h=null,f=null,Array.from(m.textTracks).forEach(function(e){e.oncuechange=null}),m.removeAttribute("src"),m.load(),F("stream"),F("paused"),F("time"),F("duration"),F("buffering"),F("buffered"),F("subtitlesTracks"),F("selectedSubtitlesTrackId"),F("audioTracks"),F("selectedAudioTrackId");break;case"destroy":H("unload"),B=!0,F("subtitlesOffset"),F("subtitlesSize"),F("subtitlesTextColor"),F("subtitlesBackgroundColor"),F("subtitlesOpacity"),F("volume"),F("muted"),F("playbackSpeed"),P.removeAllListeners(),m.onerror=null,m.onended=null,m.onpause=null,m.onplay=null,m.ontimeupdate=null,m.ondurationchange=null,m.onwaiting=null,m.onseeking=null,m.onseeked=null,m.onstalled=null,m.onplaying=null,m.oncanplay=null,m.canplaythrough=null,m.onloadeddata=null,m.onloadedmetadata=null,m.onvolumechange=null,m.onratechange=null,m.textTracks.onchange=null,t.removeChild(m),t.removeChild(L)}var i,o}this.on=function(e,t){if(B)throw new Error("Video is destroyed");P.on(e,t)},this.dispatch=function(e){if(B)throw new Error("Video is destroyed");if(e)switch((e=o(i(e))).type){case"observeProp":return t=e.propName,void(M.hasOwnProperty(t)&&(P.emit("propValue",t,y(t)),M[t]=!0));case"setProp":return void V(e.propName,e.propValue);case"command":return void H(e.commandName,e.commandArgs)}var t;throw new Error("Invalid action dispatched: "+JSON.stringify(e))}}A.canPlayStream=function(){return Promise.resolve(!0)},A.manifest={name:"WebOsVideo",external:!1,props:["stream","loaded","paused","time","duration","buffering","buffered","audioTracks","selectedAudioTrackId","subtitlesTracks","selectedSubtitlesTrackId","subtitlesOffset","subtitlesSize","subtitlesTextColor","subtitlesBackgroundColor","subtitlesOpacity","volume","muted","playbackSpeed"],commands:["load","unload","destroy"],events:["propValue","propChanged","ended","error","subtitlesTrackLoaded","audioTrackLoaded"]},e.exports=A},72801(e,t,E){var a=E(83694);e.exports=a},58928(e,t,E){var a=E(55852),i=E(55126),o=E(68816),_=E(35975);function n(e){var t=null!==(e=e||{}).timeChangedTimeout&&isFinite(e.timeChangedTimeout)?parseInt(e.timeChangedTimeout,10):100,E=e.containerElement;if(!(E instanceof HTMLElement))throw new Error("Container element required to be instance of HTMLElement");var n=document.createElement("script");n.type="text/javascript",n.src="https://www.youtube.com/iframe_api",n.onload=function(){if(A)return;if(!YT||"function"!=typeof YT.ready)return void N();YT.ready(function(){A||(YT&&YT.PlayerState&&"function"==typeof YT.Player?T=new YT.Player(r,{width:"100%",height:"100%",playerVars:{autoplay:1,cc_load_policy:3,controls:0,disablekb:1,enablejsapi:1,fs:0,iv_load_policy:3,loop:0,modestbranding:1,playsinline:1,rel:0},events:{onError:d,onReady:c,onApiChange:L,onStateChange:m}}):N())})},n.onerror=N,E.appendChild(n);var r=document.createElement("div");r.style.width="100%",r.style.height="100%",r.style.backgroundColor="black",E.appendChild(r);var S=window.setInterval(function(){p("time"),p("volume"),p("muted"),p("playbackSpeed")},t),T=null,s=!1,I=null,l=new a,A=!1,O=null,u=null,R={stream:!1,loaded:!1,paused:!1,time:!1,duration:!1,buffering:!1,volume:!1,muted:!1,playbackSpeed:!1,subtitlesTracks:!1,selectedSubtitlesTrackId:!1};function N(){A||C(Object.assign({},_.YOUTUBE_VIDEO.API_LOAD_FAILED,{critical:!0}))}function d(e){if(!A){var t;switch(e.data){case 2:t=_.YOUTUBE_VIDEO.INVALID_PARAMETER;break;case 5:t=_.YOUTUBE_VIDEO.HTML5_VIDEO;break;case 100:t=_.YOUTUBE_VIDEO.VIDEO_NOT_FOUND;break;case 101:case 150:t=_.YOUTUBE_VIDEO.VIDEO_NOT_EMBEDDABLE;break;default:t=_.UNKNOWN_ERROR}C(Object.assign({},t,{critical:!0,error:e}))}}function c(){A||(s=!0,null!==I&&(P("load",I),I=null))}function L(){A||("function"==typeof T.loadModule&&T.loadModule("captions"),"function"==typeof T.setOption&&T.setOption("captions","track",{}),p("paused"),p("time"),p("duration"),p("buffering"),p("volume"),p("muted"),p("playbackSpeed"),p("subtitlesTracks"),p("selectedSubtitlesTrackId"))}function m(e){switch(p("buffering"),e.data){case YT.PlayerState.ENDED:l.emit("ended");break;case YT.PlayerState.CUED:case YT.PlayerState.UNSTARTED:case YT.PlayerState.PAUSED:case YT.PlayerState.PLAYING:p("paused"),p("time"),p("duration")}}function D(e){switch(e){case"stream":return O;case"loaded":return null!==O||null;case"paused":return null===O||"function"!=typeof T.getPlayerState?null:T.getPlayerState()!==YT.PlayerState.PLAYING;case"time":return null!==O&&"function"==typeof T.getCurrentTime&&null!==T.getCurrentTime()&&isFinite(T.getCurrentTime())?Math.floor(1e3*T.getCurrentTime()):null;case"duration":return null!==O&&"function"==typeof T.getDuration&&null!==T.getDuration()&&isFinite(T.getDuration())?Math.floor(1e3*T.getDuration()):null;case"buffering":return null===O||"function"!=typeof T.getPlayerState?null:T.getPlayerState()===YT.PlayerState.BUFFERING;case"volume":return null!==O&&"function"==typeof T.getVolume&&null!==T.getVolume()&&isFinite(T.getVolume())?T.getVolume():null;case"muted":return null===O||"function"!=typeof T.isMuted?null:T.isMuted();case"playbackSpeed":return null!==O&&"function"==typeof T.getPlaybackRate&&null!==T.getPlaybackRate()&&isFinite(T.getPlaybackRate())?T.getPlaybackRate():null;case"subtitlesTracks":return null===O||"function"!=typeof T.getOption?[]:(T.getOption("captions","tracklist")||[]).filter(function(e){return e&&"string"==typeof e.languageCode}).map(function(e,t){return Object.freeze({id:"EMBEDDED_"+String(t),lang:e.languageCode,label:"string"==typeof e.displayName?e.displayName:e.languageCode,origin:"EMBEDDED",embedded:!0})});case"selectedSubtitlesTrackId":return null===O?null:u;default:return null}}function C(e){l.emit("error",e),e.critical&&P("unload")}function p(e){R[e]&&l.emit("propChanged",e,D(e))}function P(e,t){switch(e){case"load":if(P("unload"),t&&t.stream&&"string"==typeof t.stream.ytId)if(s){O=t.stream,p("stream"),p("loaded");var a="boolean"!=typeof t.autoplay||t.autoplay,i=null!==t.time&&isFinite(t.time)?parseInt(t.time,10)/1e3:0;a&&"function"==typeof T.loadVideoById?T.loadVideoById({videoId:t.stream.ytId,startSeconds:i}):"function"==typeof T.cueVideoById&&T.cueVideoById({videoId:t.stream.ytId,startSeconds:i}),p("paused"),p("time"),p("duration"),p("buffering"),p("volume"),p("muted"),p("playbackSpeed"),p("subtitlesTracks"),p("selectedSubtitlesTrackId")}else I=t;else C(Object.assign({},_.UNSUPPORTED_STREAM,{critical:!0,stream:t?t.stream:null}));break;case"unload":I=null,O=null,p("stream"),p("loaded"),u=null,s&&"function"==typeof T.stopVideo&&T.stopVideo(),p("paused"),p("time"),p("duration"),p("buffering"),p("volume"),p("muted"),p("playbackSpeed"),p("subtitlesTracks"),p("selectedSubtitlesTrackId");break;case"destroy":P("unload"),A=!0,l.removeAllListeners(),clearInterval(S),s&&"function"==typeof T.destroy&&T.destroy(),E.removeChild(n),E.removeChild(r)}}this.on=function(e,t){if(A)throw new Error("Video is destroyed");l.on(e,t)},this.dispatch=function(e){if(A)throw new Error("Video is destroyed");if(e)switch((e=o(i(e))).type){case"observeProp":return t=e.propName,void(R.hasOwnProperty(t)&&(l.emit("propValue",t,D(t)),R[t]=!0));case"setProp":return void(function(e,t){switch(e){case"paused":null!==O&&(t?"function"==typeof T.pauseVideo&&T.pauseVideo():"function"==typeof T.playVideo&&T.playVideo());break;case"time":null!==O&&"function"==typeof T.seekTo&&null!==t&&isFinite(t)&&T.seekTo(parseInt(t,10)/1e3);break;case"volume":null!==O&&null!==t&&isFinite(t)&&("function"==typeof T.unMute&&T.unMute(),"function"==typeof T.setVolume&&T.setVolume(Math.max(0,Math.min(100,parseInt(t,10)))),p("muted"),p("volume"));break;case"muted":null!==O&&(t?"function"==typeof T.mute&&T.mute():"function"==typeof T.unMute&&T.unMute(),p("muted"));break;case"playbackSpeed":null!==O&&"function"==typeof T.setPlaybackRate&&isFinite(t)&&(T.setPlaybackRate(t),p("playbackSpeed"));break;case"selectedSubtitlesTrackId":if(null!==O){u=null;var E=D("subtitlesTracks").find(function(e){return e.id===t});"function"==typeof T.setOption&&(E?(u=E.id,T.setOption("captions","track",{languageCode:E.lang}),l.emit("subtitlesTrackLoaded",E)):T.setOption("captions","track",{})),p("selectedSubtitlesTrackId")}}})(e.propName,e.propValue);case"command":return void P(e.commandName,e.commandArgs)}var t;throw new Error("Invalid action dispatched: "+JSON.stringify(e))}}n.canPlayStream=function(e){return Promise.resolve(e&&"string"==typeof e.ytId)},n.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=n},58962(e,t,E){var a=E(58928);e.exports=a},35975(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"}}},52957(e,t,E){var a=E(37354);e.exports=a},40399(e){var t,E,a=[{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"'}],i=[{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 o(e,t){return e.force||"function"==typeof t.mediaElement.canPlayType&&t.mediaElement.canPlayType(e.mime)?[e.codec].concat(e.aliases||[]):[]}e.exports=(t=document.createElement("video"),E=["mp4"],(window.chrome||window.cast)&&E.push("matroska,webm"),{formats:E,videoCodecs:a.map(function(e){return o(e,{mediaElement:t})}).reduce(function(e,t){return e.concat(t)},[]),audioCodecs:i.map(function(e){return o(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})()})},68046(e){var t=null;e.exports={set:function(e){t=e},get:function(){return t}}},13517(e,t,E){var a=E(68046);e.exports=function(){return["Tizen","webOS","Titan","NetTV"].includes(a.get())||void 0!==window.qt?Promise.resolve(!1):Promise.resolve(!0)}},35725(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 E=e.filter(function(e){return"audio"===(e||{}).type}),a=e.filter(function(e){return"text"===(e||{}).type});t({audio:E,subs:a})}).catch(function(e){console.error(e),t(!1)})}},32787(e){e.exports=function(e,t){if(tt?a=o-1:(e[o]]*>/g,"")).split(/\n/);E.length>3;){for(var a=3;a\s*(\d+):(\d+):(\d+)(?:,(\d+))?/);return o?(t+=o[1]+":"+o[2]+":"+o[3]+"."+o[4]+" --\x3e "+o[5]+":"+o[6]+":"+o[7]+"."+o[8]+"\n",E[i+=1]&&(t+=E[i]+"\n\n"),t):""}e.exports={convert:function(e){if(e.includes("WEBVTT"))return e;try{return(function(e){var E=e.replace(/\r+/g,""),a=(E=E.replace(/^\s+|\s+$/g,"")).split("\n\n"),i="";if(a.length>0){i+="WEBVTT\n\n";for(var o=0;oe.startTime>=t&&e.endTime<=E).map(({startTime:t,endTime:E,text:a})=>({startTime:t,endTime:E,text:a,isCurrent:t<=e&&E>=e})),$("extraSubtitlesPreview")}function X(e,t,E){switch(t){case"time":C.time=E,C.lastSyncAt=Date.now(),Q();break;case"paused":!E||C.paused||C.buffering||null===C.lastSyncAt||null===C.time?!E&&C.paused&&(C.lastSyncAt=Date.now()):(C.time=C.time+(Date.now()-C.lastSyncAt)*C.playbackSpeed,C.lastSyncAt=Date.now()),C.paused=E;break;case"buffering":!E||C.buffering||C.paused||null===C.lastSyncAt||null===C.time?!E&&C.buffering&&(C.lastSyncAt=Date.now()):(C.time=C.time+(Date.now()-C.lastSyncAt)*C.playbackSpeed,C.lastSyncAt=Date.now()),C.buffering=E;break;case"playbackSpeed":null!==E&&isFinite(E)&&(C.paused||C.buffering||null===C.lastSyncAt||null===C.time||(C.time=C.time+(Date.now()-C.lastSyncAt)*C.playbackSpeed,C.lastSyncAt=Date.now()),C.playbackSpeed=E)}f.emit(e,t,q(t,E)),"selectedSubtitlesTrackId"===t&&null!==E&&null!==M&&null===u&&J("selectedExtraSubtitlesTrackId",null)}function $(e){w[e]&&f.emit("propChanged",e,q(e,null))}function q(e,t){switch(e){case"subtitlesOffset":return W?null:G;case"subtitlesOffsetMinimum":return W?null:b;case"extraSubtitlesTracks":return W?[]:g.slice();case"selectedExtraSubtitlesTrackId":return W?null:M;case"extraSubtitlesDelay":return W?null:v;case"extraSubtitlesSize":return W?null:U;case"extraSubtitlesOffset":return W?null:y;case"extraSubtitlesTextColor":return W?null:k;case"extraSubtitlesBackgroundColor":return W?null:F;case"extraSubtitlesOutlineColor":return W?null:V;case"extraSubtitlesOpacity":return W?null:H;case"extraSubtitlesPreview":return W?[]:Y;case"subtitlesTracks":return Array.isArray(t)&&O&&O.textTracks?t.filter(function(e){var t=L(e.id);return null===t||!c(O.textTracks[t])}):t;case"selectedSubtitlesTrackId":if("string"==typeof t&&O&&O.textTracks){var E=L(t);return null!==E&&c(O.textTracks[E])?null:t}return t;default:return t}}function J(e,t){switch(e){case"subtitlesOffset":return null!==t&&isFinite(t)&&(G=Math.max(0,Math.min(100,parseInt(t,10))),z(),$("subtitlesOffset")),!0;case"subtitlesOffsetMinimum":if(null!==t&&isFinite(t)){var a=Math.max(0,Math.min(100,parseInt(t,10)));a!==b&&(b=a,z(),$("subtitlesOffsetMinimum"))}return!0;case"selectedExtraSubtitlesTrackId":if(null!==t&&E.dispatch({type:"setProp",propName:"selectedSubtitlesTrackId",propValue:null}),null!==t&&M===t)return!0;h=null,M=null,v=null;var i=g.find(function(e){return e.id===t});if(i||j(),i){M=i.id,v=0,(function e(t,a){(function(e,t){var E=t?e.fallbackUrl:e.url;if("string"==typeof E)return fetch(E).then(function(e){if(e.ok)return e.text();throw new Error(e.status+" ("+e.statusText+")")});if(e.buffer instanceof ArrayBuffer)try{const t=new Uint8Array(e.buffer),E=(new TextDecoder).decode(t);return Promise.resolve(E)}catch(e){return Promise.reject(e)}return Promise.reject("No `url` or `buffer` field available for this track")})(t,a).then(function(e){return s.convert(e)}).then(function(e){return S.parse(e)}).then(function(e){M===i.id&&(h=e,null===p&&(function e(){x(),p=requestAnimationFrame(e)})(),Q(),O&&!0===O.webkitDisplayingFullscreen&&null===u&&N(),f.emit("extraSubtitlesTrackLoaded",i))}).catch(function(t){M===i.id&&(a||"string"!=typeof i.fallbackUrl?(function(e){f.emit("error",e),e.critical&&(Z("unload"),E.dispatch({type:"command",commandName:"unload"}))})(Object.assign({},n.WITH_HTML_SUBTITLES.LOAD_FAILED,{error:t,track:i,critical:!1})):e(i,!0))})})(i)}return x(),$("selectedExtraSubtitlesTrackId"),$("extraSubtitlesDelay"),!0;case"extraSubtitlesDelay":return null!==M&&null!==t&&isFinite(t)&&(v=parseInt(t,10),B=!0,x(),$("extraSubtitlesDelay")),!0;case"extraSubtitlesSize":return null!==t&&isFinite(t)&&(U=Math.max(0,parseInt(t,10)),B=!0,x(),$("extraSubtitlesSize")),!0;case"extraSubtitlesOffset":return null!==t&&isFinite(t)&&(y=Math.max(0,Math.min(100,parseInt(t,10))),B=!0,x(),$("extraSubtitlesOffset")),!0;case"extraSubtitlesTextColor":if("string"==typeof t){try{k=_(t).rgb().string()}catch(e){console.error("withHTMLSubtitles",e)}B=!0,x(),$("extraSubtitlesTextColor")}return!0;case"extraSubtitlesBackgroundColor":if("string"==typeof t){try{F=_(t).rgb().string()}catch(e){console.error("withHTMLSubtitles",e)}B=!0,x(),$("extraSubtitlesBackgroundColor")}return!0;case"extraSubtitlesOutlineColor":if("string"==typeof t){try{V=_(t).rgb().string()}catch(e){console.error("withHTMLSubtitles",e)}B=!0,x(),$("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)}B=!0,x(),$("extraSubtitlesOpacity")}return!0;default:return!1}}function Z(e,t){switch(e){case"addExtraSubtitlesTracks":return t&&Array.isArray(t.tracks)&&(g=g.concat(t.tracks).filter(function(e,t,E){return e&&"string"==typeof e.id&&"string"==typeof e.lang&&"string"==typeof e.label&&"string"==typeof e.origin&&!e.embedded&&t===E.findIndex(function(t){return t.id===e.id})}),$("extraSubtitlesTracks")),!0;case"addLocalSubtitles":if(t&&"string"==typeof t.filename&&t.buffer instanceof ArrayBuffer){var a="LOCAL_"+g.filter(function(e){return e.local}).length,i={id:a,url:null,buffer:t.buffer,lang:"local",label:t.filename,origin:"LOCAL",local:!0,embedded:!1};g.push(i),$("extraSubtitlesTracks"),f.emit("extraSubtitlesTrackAdded",i)}return!0;case"load":return Z("unload"),t.stream&&Array.isArray(t.stream.subtitles)&&Z("addExtraSubtitlesTracks",{tracks:t.stream.subtitles.map(function(e){return Object.assign({},e,{origin:"EXCLUSIVE",exclusive:!0,embedded:!1})})}),!1;case"unload":return d(),j(),P=null,h=null,g=[],M=null,v=null,x(),$("extraSubtitlesTracks"),$("selectedExtraSubtitlesTrackId"),$("extraSubtitlesDelay"),!1;case"destroy":return Z("unload"),W=!0,O&&(O.removeEventListener("webkitbeginfullscreen",m),O.removeEventListener("webkitendfullscreen",D)),$("subtitlesOffset"),$("subtitlesOffsetMinimum"),$("extraSubtitlesSize"),$("extraSubtitlesOffset"),$("extraSubtitlesTextColor"),$("extraSubtitlesBackgroundColor"),$("extraSubtitlesOutlineColor"),$("extraSubtitlesOpacity"),$("extraSubtitlesPreview"),E.dispatch({type:"command",commandName:"destroy"}),f.removeAllListeners(),l.removeChild(A),!0;default:return!1}}this.on=function(e,t){if(W)throw new Error("Video is destroyed");f.on(e,t)},this.dispatch=function(e){if(W)throw new Error("Video is destroyed");if(e)switch((e=o(i(e))).type){case"observeProp":if((function(e){switch(e){case"subtitlesOffset":case"subtitlesOffsetMinimum":case"extraSubtitlesTracks":case"selectedExtraSubtitlesTrackId":case"extraSubtitlesDelay":case"extraSubtitlesSize":case"extraSubtitlesOffset":case"extraSubtitlesTextColor":case"extraSubtitlesBackgroundColor":case"extraSubtitlesOutlineColor":case"extraSubtitlesOpacity":case"extraSubtitlesPreview":return f.emit("propValue",e,q(e,null)),w[e]=!0,!0;default:return!1}})(e.propName))return;break;case"setProp":if(J(e.propName,e.propValue))return;break;case"command":if(Z(e.commandName,e.commandArgs))return}E.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(["subtitlesOffsetMinimum","extraSubtitlesTracks","selectedExtraSubtitlesTrackId","extraSubtitlesDelay","extraSubtitlesSize","extraSubtitlesOffset","extraSubtitlesTextColor","extraSubtitlesBackgroundColor","extraSubtitlesOutlineColor","extraSubtitlesOpacity","extraSubtitlesPreview"]).filter(function(e,t,E){return E.indexOf(e)===t}),commands:e.manifest.commands.concat(["load","unload","destroy","addExtraSubtitlesTracks","addLocalSubtitles"]).filter(function(e,t,E){return E.indexOf(e)===t}),events:e.manifest.events.concat(["propValue","propChanged","error","extraSubtitlesTrackLoaded","extraSubtitlesTrackAdded"]).filter(function(e,t,E){return E.indexOf(e)===t})},t}},51946(e,t,E){var a=E(32168),i=E(53909),o=E(73007);function _(e,t,E,i){var o=new URL(t),_=new URLSearchParams;return _.set("d",o.origin),Object.entries(E).forEach(function(e){_.append("h",e[0]+":"+e[1])}),Object.entries(i).forEach(function(e){_.append("r",e[0]+":"+e[1])}),a.resolve(e,"/proxy/"+_.toString()+o.pathname)+o.search}e.exports=function(e,t,E,a){return new Promise(function(n,r){if("string"!=typeof t.url)"string"!=typeof t.infoHash?r(new Error("Stream cannot be converted")):o(e,t.infoHash,t.fileIdx,t.announce,E).then(function(e){n({url:e.url,infoHash:e.infoHash,fileIdx:e.fileIdx})}).catch(function(e){r(e)});else if(0===t.url.indexOf("magnet:")){var S;try{if(!(S=i.decode(t.url))||"string"!=typeof S.infoHash)throw new Error("Failed to decode magnet url")}catch(e){return void r(e)}var T=Array.isArray(S.announce)?S.announce.map(function(e){return"tracker:"+e}):[];o(e,S.infoHash,null,T,E).then(function(e){n({url:e.url,infoHash:e.infoHash,fileIdx:e.fileIdx})}).catch(function(e){r(e)})}else{var s,I=a&&a.proxyStreamsEnabled,l=t.behaviorHints&&t.behaviorHints.proxyHeaders;if(I||l){var A=l&&l.request?l.request:{},O=l&&l.response?l.response:{};s={url:_(e,t.url,A,O)}}else s={url:t.url};if("string"==typeof t.infoHash&&t.infoHash.length>0)s.infoHash=t.infoHash.toLowerCase(),null!==t.fileIdx&&void 0!==t.fileIdx&&isFinite(t.fileIdx)&&(s.fileIdx=t.fileIdx);else try{var u=new URL(t.url).pathname.split("/").filter(Boolean);2===u.length&&/^[a-f0-9]{40}$/i.test(u[0])&&/^-?\d+$/.test(u[1])&&(s.infoHash=u[0].toLowerCase(),s.fileIdx=parseInt(u[1],10))}catch(e){}n(s)}})}},73007(e,t,E){var a=E(32168);function i(e,t,E,i){var o=Array.isArray(i)&&i.length>0?"?"+new URLSearchParams(i.map(function(e){return["tr",e]})):"";return{url:a.resolve(e,"/"+encodeURIComponent(t)+"/"+encodeURIComponent(E))+o,infoHash:t,fileIdx:E,sources:i}}e.exports=function(e,t,E,o,_){if((!Array.isArray(o)||0===o.length)&&null!==E&&isFinite(E))return Promise.resolve(i(e,t,E,o));var n={torrent:{infoHash:t}};return Array.isArray(o)&&o.length>0&&(n.peerSearch={sources:["dht:"+t].concat(o.map(function(e){return e.startsWith("tracker:")||e.startsWith("dht:")?e:"tracker:"+e})).filter(function(e,t,E){return E.indexOf(e)===t}),min:40,max:200}),null!==E&&isFinite(E)?n.guessFileIdx=!1:(n.guessFileIdx={},_&&(null!==_.season&&isFinite(_.season)&&(n.guessFileIdx.season=_.season),null!==_.episode&&isFinite(_.episode)&&(n.guessFileIdx.episode=_.episode))),fetch(a.resolve(e,"/"+encodeURIComponent(t)+"/create"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)}).then(function(e){if(e.ok)return e.json();throw new Error(e.status+" ("+e.statusText+")")}).then(function(a){return i(e,t,n.guessFileIdx?a.guessedFileIdx:E,n.peerSearch?n.peerSearch.sources:[])})}},19528(e,t,E){var a=E(32168);function i(e,t,E){var i=E&&"string"==typeof E.videoHash?E.videoHash:null,o=E&&isFinite(E.videoSize)?E.videoSize:null;if("string"==typeof i&&null!==o&&isFinite(o))return Promise.resolve({hash:i,size:o});var _=new URLSearchParams([["videoUrl",t]]);return fetch(a.resolve(e,"/opensubHash?"+_.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 i?i:e.result&&"string"==typeof e.result.hash?e.result.hash:null,size:null!==o&&isFinite(o)?o:e.result&&(e.result.size,1)?e.result.size:null}})}function o(e,t,E,i,o){if(o&&"string"==typeof o.filename)return Promise.resolve(o.filename);if(E){var _="string"==typeof i?parseInt(i,10):i;return null!==_&&-1!==_&&isFinite(_)?fetch(a.resolve(e,"/"+encodeURIComponent(E)+"/"+encodeURIComponent(i)+"/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}):fetch(a.resolve(e,"/"+encodeURIComponent(E)+"/stats.json")).then(function(e){if(e.ok)return e.json();throw new Error(e.status+" ("+e.statusText+")")}).then(function(e){if(!e||!Array.isArray(e.files))throw new Error("Could not retrieve file list from torrent");var t="number"==typeof e.guessedFileIdx?e.files[e.guessedFileIdx]:null;if(t&&"string"==typeof t.name)return t.name;var E=/\.(mp4|mkv|avi|mov|wmv|flv|webm|m4v|mpg|mpeg|ts|m2ts)$/i,a=e.files.filter(function(e){return e&&"string"==typeof e.name&&E.test(e.name)});0===a.length&&(a=e.files.filter(function(e){return e&&"string"==typeof e.name}));var i=a.reduce(function(e,t){return!e||(t.length||0)>(e.length||0)?t:e},null);if(i&&"string"==typeof i.name)return i.name;throw new Error("Could not retrieve filename from torrent")})}return Promise.resolve(decodeURIComponent(t.split("/").pop()))}e.exports=function(e,t,E,a,_){return Promise.allSettled([i(e,t,_),o(e,t,E,a,_)]).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})}},52913(e,t,E){var a=E(15870);e.exports=a},44697(e){e.exports=function(e,t){return t.includes("loaded")?new Promise(function(t,E){var a=null;e.on("propChanged",function(e,i){"loaded"===e&&null!==i&&null===a&&(a=i,!0===i?t(!0):!1===i&&E(Error("Player failed to load, will not retrieve video params")))}),e.dispatch({type:"observeProp",propName:"loaded"})}):Promise.resolve(!0)}},15870(e,t,E){var a=E(55852),i=E(32168),o=E(77444),_=E(55126),n=E(68816),r=E(40399),S=E(51946),T=E(19528),s=E(44697),I=E(13517),l=E(35975);e.exports=function(e){function t(E){var I=new e(E=E||{});I.on("error",function(e){d.emit("error",e),e.critical&&P("unload")}),I.on("propValue",m.bind(null,"propValue")),I.on("propChanged",m.bind(null,"propChanged")),e.manifest.events.filter(function(e){return!["error","propValue","propChanged"].includes(e)}).forEach(function(e){I.on(e,(function(e){return function(){d.emit.apply(d,[e].concat(Array.from(arguments)))}})(e))});var A=this,O=null,u=!1,R=[],N=null,d=new a,c=!1,L={stream:!1,videoParams:!1};function m(e,t,E){d.emit(e,t,p(t,E))}function D(e){L[e]&&d.emit("propChanged",e,p(e,null))}function C(e){d.emit("error",e),e.critical&&(P("unload"),I.dispatch({type:"command",commandName:"unload"}))}function p(e,t){switch(e){case"stream":return null!==O?O.stream:null;case"videoParams":return N;default:return t}}function P(E,a){switch(E){case"load":return a&&a.stream&&"string"==typeof a.streamingServerURL?(P("unload"),I.dispatch({type:"command",commandName:"unload"}),O=a,D("stream"),S(a.streamingServerURL,a.stream,a.seriesInfo,a.streamingServerSettings).then(function(e){var E=e.url,_=e.infoHash,n=e.fileIdx,S=Array.isArray(a.formats)?a.formats:r.formats,T=Array.isArray(a.videoCodecs)?a.videoCodecs:r.videoCodecs,s=Array.isArray(a.audioCodecs)?a.audioCodecs:r.audioCodecs,I=null!==a.maxAudioChannels&&isFinite(a.maxAudioChannels)?a.maxAudioChannels:r.maxAudioChannels,l=Object.assign({},a,{formats:S,videoCodecs:T,audioCodecs:s,maxAudioChannels:I});return(a.forceTranscoding?Promise.resolve(!1):t.canPlayStream({url:E},l)).catch(function(e){return console.warn("Media probe error",e),!1}).then(function(e){if(e)return{mediaURL:E,infoHash:_,fileIdx:n,stream:{url:E}};var t=o(),r=new URLSearchParams([["mediaURL",E]]);return a.forceTranscoding&&r.set("forceTranscoding","1"),T.forEach(function(e){r.append("videoCodecs",e)}),s.forEach(function(e){r.append("audioCodecs",e)}),r.set("maxAudioChannels",I),{mediaURL:E,infoHash:_,fileIdx:n,stream:{url:i.resolve(a.streamingServerURL,"/hlsv2/"+t+"/master.m3u8?"+r.toString()),subtitles:Array.isArray(a.stream.subtitles)?a.stream.subtitles.map(function(e){return Object.assign({},e,{url:"string"==typeof e.url?i.resolve(a.streamingServerURL,"/subtitles.vtt?"+new URLSearchParams([["from",e.url]]).toString()):e.url})}):[],behaviorHints:{headers:{"content-type":"application/vnd.apple.mpegurl"}}}}})}).then(function(t){a===O&&(I.dispatch({type:"command",commandName:"load",commandArgs:Object.assign({},a,{stream:t.stream})}),u=!0,(function(){for(;R.length>0;){var e=R.shift();A.dispatch.call(A,e)}})(),s(I,e.manifest.props).then(function(){return T(a.streamingServerURL,t.mediaURL,t.infoHash,t.fileIdx,a.stream.behaviorHints)}).then(function(e){a===O&&(N=e,D("videoParams"))}).catch(function(e){a===O&&(console.error(e),N={hash:null,size:null,filename:null},D("videoParams"))}))}).catch(function(e){a===O&&C(Object.assign({},l.WITH_STREAMING_SERVER.CONVERT_FAILED,{error:e,critical:!0,stream:a.stream,streamingServerURL:a.streamingServerURL}))})):C(Object.assign({},l.UNSUPPORTED_STREAM,{critical:!0,stream:a?a.stream:null,streamingServerURL:a&&"string"==typeof a.streamingServerURL?a.streamingServerURL:null})),!0;case"addExtraSubtitlesTracks":return O&&a&&Array.isArray(a.tracks)&&(u?I.dispatch({type:"command",commandName:"addExtraSubtitlesTracks",commandArgs:Object.assign({},a,{tracks:a.tracks.map(function(e){return Object.assign({},e,{fallbackUrl:e.url,url:"string"==typeof e.url?i.resolve(O.streamingServerURL,"/subtitles.vtt?"+new URLSearchParams([["from",e.url]]).toString()):e.url})})})}):R.push({type:"command",commandName:"addExtraSubtitlesTracks",commandArgs:a})),!0;case"unload":return O=null,u=!1,R=[],N=null,D("stream"),D("videoParams"),!1;case"destroy":return P("unload"),c=!0,I.dispatch({type:"command",commandName:"destroy"}),d.removeAllListeners(),!0;default:return!u&&(R.push({type:"command",commandName:E,commandArgs:a}),!0)}}this.on=function(e,t){if(c)throw new Error("Video is destroyed");d.on(e,t)},this.dispatch=function(e){if(c)throw new Error("Video is destroyed");if(e)switch((e=n(_(e))).type){case"observeProp":if((function(e){switch(e){case"stream":case"videoParams":return d.emit("propValue",e,p(e,null)),L[e]=!0,!0;default:return!1}})(e.propName))return;break;case"command":if(P(e.commandName,e.commandArgs))return}I.dispatch(e)}}return t.canPlayStream=function(t,E){return I().then(function(a){if(!a)return e.canPlayStream(t);var o=new URLSearchParams([["mediaURL",t.url]]);return fetch(i.resolve(E.streamingServerURL,"/hlsv2/probe?"+o.toString())).then(function(e){return e.json()}).then(function(e){var t=E.formats.some(function(t){return-1!==e.format.name.indexOf(t)}),a=e.streams.every(function(e){return"audio"===e.track?e.channels<=E.maxAudioChannels&&-1!==E.audioCodecs.indexOf(e.codec):"video"!==e.track||-1!==E.videoCodecs.indexOf(e.codec)}),i=e.streams.some(function(e){return"subtitle"===e.track}),o=e.streams.filter(function(e){return"audio"===e.track&&-1!==E.audioCodecs.indexOf(e.codec)});return t&&a&&!i&&o.length<2}).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,E){return E.indexOf(e)===t}),commands:e.manifest.commands.concat(["load","unload","destroy","addExtraSubtitlesTracks"]).filter(function(e,t,E){return E.indexOf(e)===t}),events:e.manifest.events.concat(["propValue","propChanged","error"]).filter(function(e,t,E){return E.indexOf(e)===t})},t}},37651(e,t,E){var a=E(20234);e.exports=a},20234(e,t,E){var a=E(55852),i=E(55126),o=E(68816);e.exports=function(e){function t(t){var E=new e(t=t||{});E.on("propValue",T.bind(null,"propValue")),E.on("propChanged",T.bind(null,"propChanged")),e.manifest.events.filter(function(e){return!["propValue","propChanged"].includes(e)}).forEach(function(e){E.on(e,(function(e){return function(){n.emit.apply(n,[e].concat(Array.from(arguments)))}})(e))});var _=null,n=new a,r=!1,S={videoParams:!1};function T(e,t,E){"videoParams"!==t&&n.emit(e,t,s(t,E)),"stream"===t&&(_=E,(function(e){S[e]&&n.emit("propChanged",e,s(e,null))})("videoParams"))}function s(e,t){return"videoParams"===e?null===_?null:{hash:_.behaviorHints&&"string"==typeof _.behaviorHints.videoHash?_.behaviorHints.videoHash:null,size:_.behaviorHints&&null!==_.behaviorHints.videoSize&&isFinite(_.behaviorHints.videoSize)?_.behaviorHints.videoSize:null,filename:_.behaviorHints&&"string"==typeof _.behaviorHints.filename?_.behaviorHints.filename:null}:t}this.on=function(e,t){if(r)throw new Error("Video is destroyed");n.on(e,t)},this.dispatch=function(e){if(r)throw new Error("Video is destroyed");if(e)switch((e=o(i(e))).type){case"observeProp":if("videoParams"===(a=e.propName)&&(n.emit("propValue",a,s(a,null)),S[a]=!0,1))return;break;case"command":if(t=e.commandName,e.commandArgs,"destroy"===t&&(r=!0,E.dispatch({type:"command",commandName:"destroy"}),n.removeAllListeners(),1))return}var t,a;E.dispatch(e)}}return t.canPlayStream=function(t,E){return e.canPlayStream(t,E)},t.manifest={name:e.manifest.name+"WithVideoParams",external:e.manifest.external,props:e.manifest.props.concat(["videoParams"]).filter(function(e,t,E){return E.indexOf(e)===t}),commands:e.manifest.commands.concat(["destroy"]).filter(function(e,t,E){return E.indexOf(e)===t}),events:e.manifest.events.concat(["propValue","propChanged"]).filter(function(e,t,E){return E.indexOf(e)===t})},t}},38250(e){"undefined"!=typeof self&&self,e.exports=(function(e){var t={};function E(a){if(t[a])return t[a].exports;var i=t[a]={i:a,l:!1,exports:{}};return e[a].call(i.exports,i,i.exports,E),i.l=!0,i.exports}return E.m=e,E.c=t,E.d=function(e,t,a){E.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},E.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},E.t=function(e,t){if(1&t&&(e=E(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(E.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)E.d(a,i,function(t){return e[t]}.bind(null,i));return a},E.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return E.d(t,"a",t),t},E.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},E.p="",E(E.s=1)})([function(e,t,E){"use strict";var a=E(3);function i(e){return!0===a(e)&&"[object Object]"===Object.prototype.toString.call(e)}e.exports=function(e){var t,E;return!1!==i(e)&&"function"==typeof(t=e.constructor)&&!1!==i(E=t.prototype)&&!1!==E.hasOwnProperty("isPrototypeOf")}},function(e,t,E){"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 a=(function(){function e(e,t){for(var E=0;E-1,I="undefined"!=typeof window&&window.navigator.userAgent.indexOf("rv:")>-1,l={id:null,attachTo:"body",showHSL:!0,showRGB:!0,showHEX:!0,showAlpha:!1,color:"#ff0000",palette:null,paletteEditable:!1,useAlphaInPalette:"auto",slBarSize:[232,150],hueBarSize:[150,11],alphaBarSize:[150,11]},A="COLOR",O="RGBA_USER",u="HSLA_USER";function R(e,t,E){return e?e instanceof HTMLElement?e:e instanceof NodeList?e[0]:"string"==typeof e?document.querySelector(e):e.jquery?e.get(0):E?t:null:t}function N(e){var t=e.getContext("2d"),E=+e.width,a=+e.height,_=t.createLinearGradient(1,1,1,a-1);return _.addColorStop(0,"white"),_.addColorStop(1,"black"),{setHue:function(e){var i=t.createLinearGradient(1,0,E-1,0);i.addColorStop(0,"hsla("+e+", 100%, 50%, 0)"),i.addColorStop(1,"hsla("+e+", 100%, 50%, 1)"),t.fillStyle=_,t.fillRect(0,0,E,a),t.fillStyle=i,t.globalCompositeOperation="multiply",t.fillRect(0,0,E,a),t.globalCompositeOperation="source-over"},grabColor:function(e,E){return t.getImageData(e,E,1,1).data},findColor:function(e,t,_){var n=(0,o.rgbToHsv)(e,t,_),r=i(n,3),S=r[1],T=r[2];return[S*E,a-T*a]}}}function d(e,t,E){return null===e?t:/^\s*$/.test(e)?E:!!/true|yes|1/i.test(e)||!/false|no|0/i.test(e)&&t}function c(e,t,E){if(null===e)return t;if(/^\s*$/.test(e))return E;var a=e.split(",").map(Number);return 2===a.length&&a[0]&&a[1]?a:t}var L=(function(){function e(t,E){if(S(this,e),E?(t=R(t),this.options=Object.assign({},l,E)):t&&(0,_.default)(t)?(this.options=Object.assign({},l,t),t=R(this.options.attachTo)):(this.options=Object.assign({},l),t=R((0,o.nvl)(t,this.options.attachTo))),!t)throw new Error("Container not found: "+this.options.attachTo);!(function(e,t){var E=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"acp-";if(t.hasAttribute(E+"show-hsl")&&(e.showHSL=d(t.getAttribute(E+"show-hsl"),l.showHSL,!0)),t.hasAttribute(E+"show-rgb")&&(e.showRGB=d(t.getAttribute(E+"show-rgb"),l.showRGB,!0)),t.hasAttribute(E+"show-hex")&&(e.showHEX=d(t.getAttribute(E+"show-hex"),l.showHEX,!0)),t.hasAttribute(E+"show-alpha")&&(e.showAlpha=d(t.getAttribute(E+"show-alpha"),l.showAlpha,!0)),t.hasAttribute(E+"palette-editable")&&(e.paletteEditable=d(t.getAttribute(E+"palette-editable"),l.paletteEditable,!0)),t.hasAttribute(E+"sl-bar-size")&&(e.slBarSize=c(t.getAttribute(E+"sl-bar-size"),l.slBarSize,[232,150])),t.hasAttribute(E+"hue-bar-size")&&(e.hueBarSize=c(t.getAttribute(E+"hue-bar-size"),l.hueBarSize,[150,11]),e.alphaBarSize=e.hueBarSize),t.hasAttribute(E+"palette")){var a=t.getAttribute(E+"palette");switch(a){case"PALETTE_MATERIAL_500":e.palette=o.PALETTE_MATERIAL_500;break;case"PALETTE_MATERIAL_CHROME":case"":e.palette=o.PALETTE_MATERIAL_CHROME;break;default:e.palette=a.split(/[;|]/)}}t.hasAttribute(E+"color")&&(e.color=t.getAttribute(E+"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=n.default,t.appendChild(this.element);var a=this.element.querySelector(".a-color-picker-h");this.setupHueCanvas(a),this.hueBarHelper=N(a),this.huePointer=this.element.querySelector(".a-color-picker-h+.a-color-picker-dot");var i=this.element.querySelector(".a-color-picker-sl");this.setupSlCanvas(i),this.slBarHelper=N(i),this.slPointer=this.element.querySelector(".a-color-picker-sl+.a-color-picker-dot"),this.preview=this.element.querySelector(".a-color-picker-preview"),this.setupClipboard(this.preview.querySelector(".a-color-picker-clipbaord")),this.options.showHSL?(this.setupInput(this.inputH=this.element.querySelector(".a-color-picker-hsl>input[nameref=H]")),this.setupInput(this.inputS=this.element.querySelector(".a-color-picker-hsl>input[nameref=S]")),this.setupInput(this.inputL=this.element.querySelector(".a-color-picker-hsl>input[nameref=L]"))):this.element.querySelector(".a-color-picker-hsl").remove(),this.options.showRGB?(this.setupInput(this.inputR=this.element.querySelector(".a-color-picker-rgb>input[nameref=R]")),this.setupInput(this.inputG=this.element.querySelector(".a-color-picker-rgb>input[nameref=G]")),this.setupInput(this.inputB=this.element.querySelector(".a-color-picker-rgb>input[nameref=B]"))):this.element.querySelector(".a-color-picker-rgb").remove(),this.options.showHEX?this.setupInput(this.inputRGBHEX=this.element.querySelector("input[nameref=RGBHEX]")):this.element.querySelector(".a-color-picker-rgbhex").remove(),this.options.paletteEditable||this.options.palette&&this.options.palette.length>0?this.setPalette(this.paletteRow=this.element.querySelector(".a-color-picker-palette")):(this.paletteRow=this.element.querySelector(".a-color-picker-palette"),this.paletteRow.remove()),this.options.showAlpha?(this.setupAlphaCanvas(this.element.querySelector(".a-color-picker-a")),this.alphaPointer=this.element.querySelector(".a-color-picker-a+.a-color-picker-dot")):this.element.querySelector(".a-color-picker-alpha").remove(),this.element.style.width=this.options.slBarSize[0]+"px",this.onValueChanged(A,this.options.color)}return a(e,[{key:"setupHueCanvas",value:function(e){var t=this;e.width=this.options.hueBarSize[0],e.height=this.options.hueBarSize[1];for(var E=e.getContext("2d"),a=E.createLinearGradient(0,0,this.options.hueBarSize[0],0),i=0;i<=1;i+=1/360)a.addColorStop(i,"hsl("+360*i+", 100%, 50%)");E.fillStyle=a,E.fillRect(0,0,this.options.hueBarSize[0],this.options.hueBarSize[1]);var _=function(E){var a=(0,o.limit)(E.clientX-e.getBoundingClientRect().left,0,t.options.hueBarSize[0]),i=Math.round(360*a/t.options.hueBarSize[0]);t.huePointer.style.left=a-7+"px",t.onValueChanged("H",i)},n=function e(){document.removeEventListener("mousemove",_),document.removeEventListener("mouseup",e)};e.addEventListener("mousedown",function(e){_(e),document.addEventListener("mousemove",_),document.addEventListener("mouseup",n)})}},{key:"setupSlCanvas",value:function(e){var t=this;e.width=this.options.slBarSize[0],e.height=this.options.slBarSize[1];var E=function(E){var a=(0,o.limit)(E.clientX-e.getBoundingClientRect().left,0,t.options.slBarSize[0]-1),i=(0,o.limit)(E.clientY-e.getBoundingClientRect().top,0,t.options.slBarSize[1]-1),_=t.slBarHelper.grabColor(a,i);t.slPointer.style.left=a-7+"px",t.slPointer.style.top=i-7+"px",t.onValueChanged("RGB",_)},a=function e(){document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",e)};e.addEventListener("mousedown",function(e){E(e),document.addEventListener("mousemove",E),document.addEventListener("mouseup",a)})}},{key:"setupAlphaCanvas",value:function(e){var t=this;e.width=this.options.alphaBarSize[0],e.height=this.options.alphaBarSize[1];var E=e.getContext("2d"),a=E.createLinearGradient(0,0,e.width-1,0);a.addColorStop(0,"hsla(0, 0%, 50%, 0)"),a.addColorStop(1,"hsla(0, 0%, 50%, 1)"),E.fillStyle=a,E.fillRect(0,0,this.options.alphaBarSize[0],this.options.alphaBarSize[1]);var i=function(E){var a=(0,o.limit)(E.clientX-e.getBoundingClientRect().left,0,t.options.alphaBarSize[0]),i=+(a/t.options.alphaBarSize[0]).toFixed(2);t.alphaPointer.style.left=a-7+"px",t.onValueChanged("ALPHA",i)},_=function e(){document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",e)};e.addEventListener("mousedown",function(e){i(e),document.addEventListener("mousemove",i),document.addEventListener("mouseup",_)})}},{key:"setupInput",value:function(e){var t=this,E=+e.min,a=+e.max,i=e.getAttribute("nameref");e.hasAttribute("select-on-focus")&&e.addEventListener("focus",function(){e.select()}),"text"===e.type?e.addEventListener("change",function(){t.onValueChanged(i,e.value)}):((s||I)&&e.addEventListener("keydown",function(_){"Up"===_.key?(e.value=(0,o.limit)(+e.value+1,E,a),t.onValueChanged(i,e.value),_.returnValue=!1):"Down"===_.key&&(e.value=(0,o.limit)(+e.value-1,E,a),t.onValueChanged(i,e.value),_.returnValue=!1)}),e.addEventListener("change",function(){var _=+e.value;t.onValueChanged(i,(0,o.limit)(_,E,a))}))}},{key:"setupClipboard",value:function(e){var t=this;e.title="click to copy",e.addEventListener("click",function(){e.value=(0,o.parseColor)([t.R,t.G,t.B,t.A],"hexcss4"),e.select(),document.execCommand("copy")})}},{key:"setPalette",value:function(e){var t=this,E="auto"===this.options.useAlphaInPalette?this.options.showAlpha:this.options.useAlphaInPalette,a=null;switch(this.options.palette){case"PALETTE_MATERIAL_500":a=o.PALETTE_MATERIAL_500;break;case"PALETTE_MATERIAL_CHROME":a=o.PALETTE_MATERIAL_CHROME;break;default:a=(0,o.ensureArray)(this.options.palette)}if(this.options.paletteEditable||a.length>0){var i=function(E,a,i){var o=e.querySelector('.a-color-picker-palette-color[data-color="'+E+'"]')||document.createElement("div");o.className="a-color-picker-palette-color",o.style.backgroundColor=E,o.setAttribute("data-color",E),o.title=E,e.insertBefore(o,a),t.palette[E]=!0,i&&t.onPaletteColorAdd(E)},_=function(E,a){E?(e.removeChild(E),t.palette[E.getAttribute("data-color")]=!1,a&&t.onPaletteColorRemove(E.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}),a&&t.onPaletteColorRemove())};if(a.map(function(e){return(0,o.parseColor)(e,E?"rgbcss4":"hex")}).filter(function(e){return!!e}).forEach(function(e){return i(e)}),this.options.paletteEditable){var n=document.createElement("div");n.className="a-color-picker-palette-color a-color-picker-palette-add",n.innerHTML="+",e.appendChild(n),e.addEventListener("click",function(e){/a-color-picker-palette-add/.test(e.target.className)?e.shiftKey?_(null,!0):i(E?(0,o.parseColor)([t.R,t.G,t.B,t.A],"rgbcss4"):(0,o.rgbToHex)(t.R,t.G,t.B),e.target,!0):/a-color-picker-palette-color/.test(e.target.className)&&(e.shiftKey?_(e.target,!0):t.onValueChanged(A,e.target.getAttribute("data-color")))})}else e.addEventListener("click",function(e){/a-color-picker-palette-color/.test(e.target.className)&&t.onValueChanged(A,e.target.getAttribute("data-color"))})}else e.style.display="none"}},{key:"updatePalette",value:function(e){this.paletteRow.innerHTML="",this.palette={},this.paletteRow.parentElement||this.element.appendChild(this.paletteRow),this.options.palette=e,this.setPalette(this.paletteRow)}},{key:"onValueChanged",value:function(e,t){var E=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{silent:!1};switch(e){case"H":this.H=t;var a=(0,o.hslToRgb)(this.H,this.S,this.L),_=i(a,3);this.R=_[0],this.G=_[1],this.B=_[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 n=(0,o.hslToRgb)(this.H,this.S,this.L),r=i(n,3);this.R=r[0],this.G=r[1],this.B=r[2],this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B);break;case"L":this.L=t;var S=(0,o.hslToRgb)(this.H,this.S,this.L),T=i(S,3);this.R=T[0],this.G=T[1],this.B=T[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,o.rgbToHsl)(this.R,this.G,this.B),I=i(s,3);this.H=I[0],this.S=I[1],this.L=I[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 l=(0,o.rgbToHsl)(this.R,this.G,this.B),R=i(l,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"B":this.B=t;var N=(0,o.rgbToHsl)(this.R,this.G,this.B),d=i(N,3);this.H=d[0],this.S=d[1],this.L=d[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGBHEX(this.R,this.G,this.B);break;case"RGB":var c=i(t,3);this.R=c[0],this.G=c[1],this.B=c[2];var L=(0,o.rgbToHsl)(this.R,this.G,this.B),m=i(L,3);this.H=m[0],this.S=m[1],this.L=m[2],this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B);break;case O:var D=i(t,4);this.R=D[0],this.G=D[1],this.B=D[2],this.A=D[3];var C=(0,o.rgbToHsl)(this.R,this.G,this.B),p=i(C,3);this.H=p[0],this.S=p[1],this.L=p[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B),this.updatePointerA(this.A);break;case u:var P=i(t,4);this.H=P[0],this.S=P[1],this.L=P[2],this.A=P[3];var B=(0,o.hslToRgb)(this.H,this.S,this.L),h=i(B,3);this.R=h[0],this.G=h[1],this.B=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"RGBHEX":var f=(0,o.cssColorToRgb)(t)||[this.R,this.G,this.B],W=i(f,3);this.R=W[0],this.G=W[1],this.B=W[2];var g=(0,o.rgbToHsl)(this.R,this.G,this.B),M=i(g,3);this.H=M[0],this.S=M[1],this.L=M[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B);break;case A:var v=(0,o.parseColor)(t,"rgba")||[0,0,0,1],U=i(v,4);this.R=U[0],this.G=U[1],this.B=U[2],this.A=U[3];var G=(0,o.rgbToHsl)(this.R,this.G,this.B),y=i(G,3);this.H=y[0],this.S=y[1],this.L=y[2],this.slBarHelper.setHue(this.H),this.updatePointerH(this.H),this.updatePointerSL(this.H,this.S,this.L),this.updateInputHSL(this.H,this.S,this.L),this.updateInputRGB(this.R,this.G,this.B),this.updateInputRGBHEX(this.R,this.G,this.B),this.updatePointerA(this.A);break;case"ALPHA":this.A=t}1===this.A?this.preview.style.backgroundColor="rgb("+this.R+","+this.G+","+this.B+")":this.preview.style.backgroundColor="rgba("+this.R+","+this.G+","+this.B+","+this.A+")",E&&E.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,E){this.options.showHSL&&(this.inputH.value=e,this.inputS.value=t,this.inputL.value=E)}},{key:"updateInputRGB",value:function(e,t,E){this.options.showRGB&&(this.inputR.value=e,this.inputG.value=t,this.inputB.value=E)}},{key:"updateInputRGBHEX",value:function(e,t,E){this.options.showHEX&&(this.inputRGBHEX.value=(0,o.rgbToHex)(e,t,E))}},{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,E){var a=(0,o.hslToRgb)(e,t,E),_=i(a,3),n=_[0],r=_[1],S=_[2],T=this.slBarHelper.findColor(n,r,S),s=i(T,2),I=s[0],l=s[1];I>=0&&(this.slPointer.style.left=I-7+"px",this.slPointer.style.top=l-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})(),m=(function(){function e(t){S(this,e),this.name=t,this.listeners=[]}return a(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 E=this.listeners.slice(0),a=0;a1&&void 0!==arguments[1]&&arguments[1];E.onValueChanged(A,e,{silent:t})},get all(){if(_){var e=[E.R,E.G,E.B,E.A],t=E.A<1?"rgba("+E.R+","+E.G+","+E.B+","+E.A+")":o.rgbToHex.apply(void 0,e);(n=(0,o.parseColor)(e,n)).toString=function(){return t},_=!1}return Object.assign({},n)},get onchange(){return a.change&&a.change.listeners[0]},set onchange(e){this.off("change").on("change",e)},get oncoloradd(){return a.coloradd&&a.coloradd.listeners[0]},set oncoloradd(e){this.off("coloradd").on("coloradd",e)},get oncolorremove(){return a.colorremove&&a.colorremove.listeners[0]},set oncolorremove(e){this.off("colorremove").on("colorremove",e)},get palette(){return Object.keys(E.palette).filter(function(e){return E.palette[e]})},set palette(e){E.updatePalette(e)},show:function(){E.element.classList.remove("hidden")},hide:function(){E.element.classList.add("hidden")},toggle:function(){E.element.classList.toggle("hidden")},on:function(e,t){return e&&a[e]&&a[e].on(t),this},off:function(e,t){return e&&a[e]&&a[e].off(t),this},destroy:function(){a.change.off(),a.coloradd.off(),a.colorremove.off(),E.element.remove(),a=null,E=null}};return E.onchange=function(){for(var e=arguments.length,t=Array(e),E=0;Estyle[data-source="a-color-picker"]')){var C=E(5).toString(),p=document.createElement("style");p.setAttribute("type","text/css"),p.setAttribute("data-source","a-color-picker"),p.innerHTML=C,document.querySelector("head").appendChild(p)}t.createPicker=D,t.from=function(e,t){var E=(function(e){return e?Array.isArray(e)?e:e instanceof HTMLElement?[e]:e instanceof NodeList?[].concat(T(e)):"string"==typeof e?[].concat(T(document.querySelectorAll(e))):e.jquery?e.get():[]:[]})(e).map(function(e,E){var a=D(e,t);return a.index=E,a});return E.on=function(e,t){return E.forEach(function(E){return E.on(e,t)}),this},E.off=function(e){return E.forEach(function(t){return t.off(e)}),this},E},t.parseColorToRgb=o.parseColorToRgb,t.parseColorToRgba=o.parseColorToRgba,t.parseColorToHsl=o.parseColorToHsl,t.parseColorToHsla=o.parseColorToHsla,t.parseColor=o.parseColor,t.rgbToHex=o.rgbToHex,t.hslToRgb=o.hslToRgb,t.rgbToHsl=o.rgbToHsl,t.rgbToHsv=o.rgbToHsv,t.rgbToInt=o.rgbToInt,t.intToRgb=o.intToRgb,t.getLuminance=o.getLuminance,t.COLOR_NAMES=o.COLOR_NAMES,t.PALETTE_MATERIAL_500=o.PALETTE_MATERIAL_500,t.PALETTE_MATERIAL_CHROME=o.PALETTE_MATERIAL_CHROME,t.VERSION="1.2.1"},function(e,t,E){"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 a=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return(function(e,t){var E=[],a=!0,i=!1,o=void 0;try{for(var _,n=e[Symbol.iterator]();!(a=(_=n.next()).done)&&(E.push(_.value),!t||E.length!==t);a=!0);}catch(e){i=!0,o=e}finally{try{!a&&n.return&&n.return()}finally{if(i)throw o}}return E})(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},i=(function(e){return e&&e.__esModule?e:{default:e}})(E(0));function o(e){if(Array.isArray(e)){for(var t=0,E=Array(e.length);tE?E:e}function r(e,t){return null==e?t:e}function S(e,t,E){var a=[n(e,0,255),n(t,0,255),n(E,0,255)];return"#"+("000000"+((e=a[0])<<16|(t=a[1])<<8|(E=a[2])).toString(16)).slice(-6)}function T(e,t,E){var a=void 0,i=void 0,o=void 0,_=[n(e,0,360)/360,n(t,0,100)/100,n(E,0,100)/100];if(e=_[0],E=_[2],0==(t=_[1]))a=i=o=E;else{var r=function(e,t,E){return E<0&&(E+=1),E>1&&(E-=1),E<1/6?e+6*(t-e)*E:E<.5?t:E<2/3?e+(t-e)*(2/3-E)*6:e},S=E<.5?E*(1+t):E+t-E*t,T=2*E-S;a=r(T,S,e+1/3),i=r(T,S,e),o=r(T,S,e-1/3)}return[255*a,255*i,255*o].map(Math.round)}function s(e,t,E){var a=[n(e,0,255)/255,n(t,0,255)/255,n(E,0,255)/255];e=a[0],t=a[1],E=a[2];var i=Math.max(e,t,E),o=Math.min(e,t,E),_=void 0,r=void 0,S=(i+o)/2;if(i==o)_=r=0;else{var T=i-o;switch(r=S>.5?T/(2-i-o):T/(i+o),i){case e:_=(t-E)/T+(t>16&255,e>>8&255,255&e]},t.cssColorToRgb=l,t.cssColorToRgba=A,t.cssRgbToRgb=O,t.cssRgbaToRgba=u,t.parseColorToRgb=function(e){return Array.isArray(e)?e=[n(e[0],0,255),n(e[1],0,255),n(e[2],0,255)]:l(e)||O(e)},t.parseColorToRgba=R,t.cssHslToHsl=N,t.cssHslaToHsla=d,t.parseColorToHsl=function(e){return Array.isArray(e)?e=[n(e[0],0,360),n(e[1],0,100),n(e[2],0,100)]:N(e)},t.parseColorToHsla=c,t.parseColor=function(e,t){if(t=t||"rgb",null!=e){var E=void 0;if((E=R(e))||(E=c(e))&&(E=[].concat(o(T.apply(void 0,o(E))),[E[3]])))return(0,i.default)(t)?["rgb","rgbcss","rgbcss4","rgba","rgbacss","hsl","hslcss","hslcss4","hsla","hslacss","hex","hexcss4","int"].reduce(function(e,t){return e[t]=L(E,t),e},t||{}):L(E,t.toString().toLowerCase())}},t.getLuminance=function(e,t,E){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*((E/=255)<.03928?E/12.92:Math.pow((E+.055)/1.055,2.4))},t.limit=n,t.ensureArray=function(e){return e?Array.from(e):[]},t.nvl=r},function(e,t,E){"use strict";e.exports=function(e){return null!=e&&"object"==typeof e&&!1===Array.isArray(e)}},function(e,t){e.exports='
'},function(e,t,E){var a=E(6);e.exports="string"==typeof a?a:a.toString()},function(e,t,E){(e.exports=E(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 E=(function(e,t){var E=e[1]||"",a=e[3];if(!a)return E;if(t&&"function"==typeof btoa){var i=(function(e){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(e))))+" */"})(a),o=a.sources.map(function(e){return"/*# sourceURL="+a.sourceRoot+e+" */"});return[E].concat(o).concat([i]).join("\n")}return[E].join("\n")})(t,e);return t[2]?"@media "+t[2]+"{"+E+"}":E}).join("")},t.i=function(e,E){"string"==typeof e&&(e=[[null,e,""]]);for(var a={},i=0;i0?_-4:_;for(E=0;E>16&255,S[T++]=t>>8&255,S[T++]=255&t;2===r&&(t=a[e.charCodeAt(E)]<<2|a[e.charCodeAt(E+1)]>>4,S[T++]=255&t);1===r&&(t=a[e.charCodeAt(E)]<<10|a[e.charCodeAt(E+1)]<<4|a[e.charCodeAt(E+2)]>>2,S[T++]=t>>8&255,S[T++]=255&t);return S},t.fromByteArray=function(e){for(var t,a=e.length,i=a%3,o=[],_=16383,n=0,r=a-i;nr?r:n+_));1===i?(t=e[a-1],o.push(E[t>>2]+E[t<<4&63]+"==")):2===i&&(t=(e[a-2]<<8)+e[a-1],o.push(E[t>>10]+E[t>>4&63]+E[t<<2&63]+"="));return o.join("")};for(var E=[],a=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_=0;_<64;++_)E[_]=o[_],a[o.charCodeAt(_)]=_;function n(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var E=e.indexOf("=");return-1===E&&(E=t),[E,E===t?0:4-E%4]}function r(e){return E[e>>18&63]+E[e>>12&63]+E[e>>6&63]+E[63&e]}function S(e,t,E){for(var a,i=[],o=t;o{const i=t.split("-").map(e=>parseInt(e));return e.concat(((e,t=e)=>Array.from({length:t-e+1},(t,E)=>E+e))(...i))},[])}e.exports=t,e.exports.parse=t,e.exports.compose=function(e){return e.reduce((e,t,E,a)=>(0!==E&&t===a[E-1]+1||e.push([]),e[e.length-1].push(t),e),[]).map(e=>e.length>1?`${e[0]}-${e[e.length-1]}`:`${e[0]}`)}},91704(e){e.exports=(function(e){var t={};function E(a){if(t[a])return t[a].exports;var i=t[a]={i:a,l:!1,exports:{}};return e[a].call(i.exports,i,i.exports,E),i.l=!0,i.exports}return E.m=e,E.c=t,E.d=function(e,t,a){E.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},E.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},E.t=function(e,t){if(1&t&&(e=E(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(E.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)E.d(a,i,function(t){return e[t]}.bind(null,i));return a},E.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return E.d(t,"a",t),t},E.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},E.p="",E(E.s=90)})({17:function(e,t,E){"use strict";t.__esModule=!0,t.default=void 0;var a=E(18),i=(function(){function e(){}return e.getFirstMatch=function(e,t){var E=t.match(e);return E&&E.length>0&&E[1]||""},e.getSecondMatch=function(e,t){var E=t.match(e);return E&&E.length>1&&E[2]||""},e.matchAndReturnConst=function(e,t,E){if(e.test(t))return E},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});t.push(0);var E=t[0],a=t[1];if(10===E)switch(a){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}switch(E){case 11:return"Big Sur";case 12:return"Monterey";case 13:return"Ventura";case 14:return"Sonoma";case 15:return"Sequoia";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,E,a){void 0===a&&(a=!1);var i=e.getVersionPrecision(t),o=e.getVersionPrecision(E),_=Math.max(i,o),n=0,r=e.map([t,E],function(t){var E=_-e.getVersionPrecision(t),a=t+new Array(E+1).join(".0");return e.map(a.split("."),function(e){return new Array(20-e.length).join("0")+e}).reverse()});for(a&&(n=_-Math.min(i,o)),_-=1;_>=n;){if(r[0][_]>r[1][_])return 1;if(r[0][_]===r[1][_]){if(_===n)return 0;_-=1}else if(r[0][_]1?i-1:0),_=1;_0){var _=Object.keys(E),r=n.default.find(_,function(e){return t.isOS(e)});if(r){var S=this.satisfies(E[r]);if(void 0!==S)return S}var T=n.default.find(_,function(e){return t.isPlatform(e)});if(T){var s=this.satisfies(E[T]);if(void 0!==s)return s}}if(o>0){var I=Object.keys(i),l=n.default.find(I,function(e){return t.isBrowser(e,!0)});if(void 0!==l)return this.compareVersion(i[l])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var E=this.getBrowserName().toLowerCase(),a=e.toLowerCase(),i=n.default.getBrowserTypeByAlias(a);return t&&i&&(a=i.toLowerCase()),a===E},t.compareVersion=function(e){var t=[0],E=e,a=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(E=e.substr(1),"="===e[1]?(a=!0,E=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?E=e.substr(1):"~"===e[0]&&(a=!0,E=e.substr(1)),t.indexOf(n.default.compareVersions(i,E,a))>-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=S,e.exports=t.default},92:function(e,t,E){"use strict";t.__esModule=!0,t.default=void 0;var a,i=(a=E(17))&&a.__esModule?a:{default:a},o=/version\/(\d+(\.?_?\d+)+)/i,_=[{test:[/gptbot/i],describe:function(e){var t={name:"GPTBot"},E=i.default.getFirstMatch(/gptbot\/(\d+(\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/chatgpt-user/i],describe:function(e){var t={name:"ChatGPT-User"},E=i.default.getFirstMatch(/chatgpt-user\/(\d+(\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/oai-searchbot/i],describe:function(e){var t={name:"OAI-SearchBot"},E=i.default.getFirstMatch(/oai-searchbot\/(\d+(\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe:function(e){var t={name:"ClaudeBot"},E=i.default.getFirstMatch(/(?:claudebot|claude-web|claude-user|claude-searchbot)\/(\d+(\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/omgilibot/i,/webzio-extended/i],describe:function(e){var t={name:"Omgilibot"},E=i.default.getFirstMatch(/(?:omgilibot|webzio-extended)\/(\d+(\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/diffbot/i],describe:function(e){var t={name:"Diffbot"},E=i.default.getFirstMatch(/diffbot\/(\d+(\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/perplexitybot/i],describe:function(e){var t={name:"PerplexityBot"},E=i.default.getFirstMatch(/perplexitybot\/(\d+(\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/perplexity-user/i],describe:function(e){var t={name:"Perplexity-User"},E=i.default.getFirstMatch(/perplexity-user\/(\d+(\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/youbot/i],describe:function(e){var t={name:"YouBot"},E=i.default.getFirstMatch(/youbot\/(\d+(\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/meta-webindexer/i],describe:function(e){var t={name:"Meta-WebIndexer"},E=i.default.getFirstMatch(/meta-webindexer\/(\d+(\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/meta-externalads/i],describe:function(e){var t={name:"Meta-ExternalAds"},E=i.default.getFirstMatch(/meta-externalads\/(\d+(\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/meta-externalagent/i],describe:function(e){var t={name:"Meta-ExternalAgent"},E=i.default.getFirstMatch(/meta-externalagent\/(\d+(\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/meta-externalfetcher/i],describe:function(e){var t={name:"Meta-ExternalFetcher"},E=i.default.getFirstMatch(/meta-externalfetcher\/(\d+(\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},E=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/linespider/i],describe:function(e){var t={name:"Linespider"},E=i.default.getFirstMatch(/(?:linespider)(?:-[-\w]+)?[\s/](\d+(\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/amazonbot/i],describe:function(e){var t={name:"AmazonBot"},E=i.default.getFirstMatch(/amazonbot\/(\d+(\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/bingbot/i],describe:function(e){var t={name:"BingCrawler"},E=i.default.getFirstMatch(/bingbot\/(\d+(\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/baiduspider/i],describe:function(e){var t={name:"BaiduSpider"},E=i.default.getFirstMatch(/baiduspider\/(\d+(\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/duckduckbot/i],describe:function(e){var t={name:"DuckDuckBot"},E=i.default.getFirstMatch(/duckduckbot\/(\d+(\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/ia_archiver/i],describe:function(e){var t={name:"InternetArchiveCrawler"},E=i.default.getFirstMatch(/ia_archiver\/(\d+(\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe:function(){return{name:"FacebookExternalHit"}}},{test:[/slackbot/i,/slack-imgProxy/i],describe:function(e){var t={name:"SlackBot"},E=i.default.getFirstMatch(/(?:slackbot|slack-imgproxy)(?:-[-\w]+)?[\s/](\d+(\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/yahoo!?[\s/]*slurp/i],describe:function(){return{name:"YahooSlurp"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe:function(){return{name:"YandexBot"}}},{test:[/pingdom/i],describe:function(){return{name:"PingdomBot"}}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},E=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return E&&(t.version=E),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},E=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},E=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return E&&(t.version=E),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},E=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return E&&(t.version=E),t}},{test:[/PaleMoon/i],describe:function(e){var t={name:"Pale Moon"},E=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:PaleMoon)[\s/](\d+(?:\.\d+)+)/i,e);return E&&(t.version=E),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},E=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},E=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},E=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},E=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return E&&(t.version=E),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},E=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},E=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},E=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return E&&(t.version=E),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},E=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return E&&(t.version=E),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},E=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return E&&(t.version=E),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},E=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return E&&(t.version=E),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},E=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return E&&(t.version=E),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},E=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return E&&(t.version=E),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},E=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},E=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},E=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return E&&(t.version=E),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},E=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return E&&(t.version=E),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},E=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return E&&(t.version=E),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},E=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return E&&(t.version=E),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},E=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return E&&(t.version=E),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},E=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return E&&(t.version=E),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},E=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return E&&(t.version=E),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},E=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return E&&(t.version=E),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},E=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return E&&(t.version=E),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},E=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return E&&(t.version=E),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},E=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return E&&(t.version=E),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},E=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return E&&(t.version=E),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},E=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},E=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/librewolf/i],describe:function(e){var t={name:"LibreWolf"},E=i.default.getFirstMatch(/(?:librewolf)[\s/](\d+(\.?_?\d+)+)/i,e);return E&&(t.version=E),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},E=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return E&&(t.version=E),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},E=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return E&&(t.version=E),t}},{test:[/sogoumobilebrowser/i,/metasr/i,/se 2\.[x]/i],describe:function(e){var t={name:"Sogou Browser"},E=i.default.getFirstMatch(/(?:sogoumobilebrowser)[\s/](\d+(\.?_?\d+)+)/i,e),a=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e),o=i.default.getFirstMatch(/se ([\d.]+)x/i,e),_=E||a||o;return _&&(t.version=_),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},E=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return E&&(t.version=E),t}},{test:function(e){return!!e.hasBrand("DuckDuckGo")||e.test(/\sDdg\/[\d.]+$/i)},describe:function(e,t){var E={name:"DuckDuckGo"};if(t){var a=t.getBrandVersion("DuckDuckGo");if(a)return E.version=a,E}var o=i.default.getFirstMatch(/\sDdg\/([\d.]+)$/i,e);return o&&(E.version=o),E}},{test:function(e){return e.hasBrand("Brave")},describe:function(e,t){var E={name:"Brave"};if(t){var a=t.getBrandVersion("Brave");if(a)return E.version=a,E}return E}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},E=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},E=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return E&&(t.version=E),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},E=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return E&&(t.version=E),t}},{test:function(e){var t=!e.test(/like android/i),E=e.test(/android/i);return t&&E},describe:function(e){var t={name:"Android Browser"},E=i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},E=i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},E=i.default.getFirstMatch(o,e);return E&&(t.version=E),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=_,e.exports=t.default},93:function(e,t,E){"use strict";t.__esModule=!0,t.default=void 0;var a,i=(a=E(17))&&a.__esModule?a:{default:a},o=E(18),_=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),E=i.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:E}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},E=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return E&&(t.version=E),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),E=i.default.getMacOSVersionName(t),a={name:o.OS_MAP.MacOS,version:t};return E&&(a.versionName=E),a}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:[/OpenHarmony/i],describe:function(e){var t=i.default.getFirstMatch(/OpenHarmony\s+(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.HarmonyOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),E=e.test(/android/i);return t&&E},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),E=i.default.getAndroidVersionName(t),a={name:o.OS_MAP.Android,version:t};return E&&(a.versionName=E),a}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),E={name:o.OS_MAP.WebOS};return t&&t.length&&(E.version=t),E}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=_,e.exports=t.default},94:function(e,t,E){"use strict";t.__esModule=!0,t.default=void 0;var a,i=(a=E(17))&&a.__esModule?a:{default:a},o=E(18),_=[{test:[/googlebot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Google"}}},{test:[/linespider/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Line"}}},{test:[/amazonbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Amazon"}}},{test:[/gptbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/chatgpt-user/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/oai-searchbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"OpenAI"}}},{test:[/baiduspider/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Baidu"}}},{test:[/bingbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Bing"}}},{test:[/duckduckbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"DuckDuckGo"}}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Anthropic"}}},{test:[/omgilibot/i,/webzio-extended/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Webz.io"}}},{test:[/diffbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Diffbot"}}},{test:[/perplexitybot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Perplexity AI"}}},{test:[/perplexity-user/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Perplexity AI"}}},{test:[/youbot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"You.com"}}},{test:[/ia_archiver/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Internet Archive"}}},{test:[/meta-webindexer/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalads/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalagent/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/meta-externalfetcher/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Meta"}}},{test:[/slackbot/i,/slack-imgProxy/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Slack"}}},{test:[/yahoo/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Yahoo"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Yandex"}}},{test:[/pingdom/i],describe:function(){return{type:o.PLATFORMS_MAP.bot,vendor:"Pingdom"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",E={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(E.model=t),E}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),E=e.test(/like (ipod|iphone)/i);return t&&!E},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/Nokia/i],describe:function(e){var t=i.default.getFirstMatch(/Nokia\s+([0-9]+(\.[0-9]+)?)/i,e),E={type:o.PLATFORMS_MAP.mobile,vendor:"Nokia"};return t&&(E.model=t),E}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.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:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:[/smart-?tv|smarttv/i],describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:[/netcast/i],describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=_,e.exports=t.default},95:function(e,t,E){"use strict";t.__esModule=!0,t.default=void 0;var a,i=(a=E(17))&&a.__esModule?a:{default:a},o=E(18),_=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},E=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return E&&(t.version=E),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},E=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return E&&(t.version=E),t}},{test:function(e){var t=e.test(/gecko/i),E=e.test(/like gecko/i);return t&&!E},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},E=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return E&&(t.version=E),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},E=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return E&&(t.version=E),t}}];t.default=_,e.exports=t.default}})},84686(e,t,E){"use strict";const a=E(35350),i=E(77947),o="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.hp=r,t.IS=50;const _=2147483647;function n(e){if(e>_)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,r.prototype),t}function r(e,t,E){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 S(e,t,E)}function S(e,t,E){if("string"==typeof e)return(function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!r.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const E=0|O(e,t);let a=n(E);const i=a.write(e,t);i!==E&&(a=a.slice(0,i));return a})(e,t);if(ArrayBuffer.isView(e))return(function(e){if(X(e,Uint8Array)){const t=new Uint8Array(e);return l(t.buffer,t.byteOffset,t.byteLength)}return I(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 l(e,t,E);if("undefined"!=typeof SharedArrayBuffer&&(X(e,SharedArrayBuffer)||e&&X(e.buffer,SharedArrayBuffer)))return l(e,t,E);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const a=e.valueOf&&e.valueOf();if(null!=a&&a!==e)return r.from(a,t,E);const i=(function(e){if(r.isBuffer(e)){const t=0|A(e.length),E=n(t);return 0===E.length||e.copy(E,0,0,t),E}if(void 0!==e.length)return"number"!=typeof e.length||$(e.length)?n(0):I(e);if("Buffer"===e.type&&Array.isArray(e.data))return I(e.data)})(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return r.from(e[Symbol.toPrimitive]("string"),t,E);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function T(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 T(e),n(e<0?0:0|A(e))}function I(e){const t=e.length<0?0:0|A(e.length),E=n(t);for(let a=0;a=_)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+_.toString(16)+" bytes");return 0|e}function O(e,t){if(r.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||X(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const E=e.length,a=arguments.length>2&&!0===arguments[2];if(!a&&0===E)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return E;case"utf8":case"utf-8":return j(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*E;case"hex":return E>>>1;case"base64":return x(e).length;default:if(i)return a?-1:j(e).length;t=(""+t).toLowerCase(),i=!0}}function u(e,t,E){let a=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===E||E>this.length)&&(E=this.length),E<=0)return"";if((E>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return W(this,t,E);case"utf8":case"utf-8":return P(this,t,E);case"ascii":return h(this,t,E);case"latin1":case"binary":return f(this,t,E);case"base64":return p(this,t,E);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return g(this,t,E);default:if(a)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0}}function R(e,t,E){const a=e[t];e[t]=e[E],e[E]=a}function N(e,t,E,a,i){if(0===e.length)return-1;if("string"==typeof E?(a=E,E=0):E>2147483647?E=2147483647:E<-2147483648&&(E=-2147483648),$(E=+E)&&(E=i?0:e.length-1),E<0&&(E=e.length+E),E>=e.length){if(i)return-1;E=e.length-1}else if(E<0){if(!i)return-1;E=0}if("string"==typeof t&&(t=r.from(t,a)),r.isBuffer(t))return 0===t.length?-1:d(e,t,E,a,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,E):Uint8Array.prototype.lastIndexOf.call(e,t,E):d(e,[t],E,a,i);throw new TypeError("val must be string, number or Buffer")}function d(e,t,E,a,i){let o,_=1,n=e.length,r=t.length;if(void 0!==a&&("ucs2"===(a=String(a).toLowerCase())||"ucs-2"===a||"utf16le"===a||"utf-16le"===a)){if(e.length<2||t.length<2)return-1;_=2,n/=2,r/=2,E/=2}function S(e,t){return 1===_?e[t]:e.readUInt16BE(t*_)}if(i){let a=-1;for(o=E;on&&(E=n-r),o=E;o>=0;o--){let E=!0;for(let a=0;ai&&(a=i):a=i;const o=t.length;let _;for(a>o/2&&(a=o/2),_=0;_>8,i=E%256,o.push(i),o.push(a);return o})(t,e.length-E),e,E,a)}function p(e,t,E){return 0===t&&E===e.length?a.fromByteArray(e):a.fromByteArray(e.slice(t,E))}function P(e,t,E){E=Math.min(e.length,E);const a=[];let i=t;for(;i239?4:t>223?3:t>191?2:1;if(i+_<=E){let E,a,n,r;switch(_){case 1:t<128&&(o=t);break;case 2:E=e[i+1],128==(192&E)&&(r=(31&t)<<6|63&E,r>127&&(o=r));break;case 3:E=e[i+1],a=e[i+2],128==(192&E)&&128==(192&a)&&(r=(15&t)<<12|(63&E)<<6|63&a,r>2047&&(r<55296||r>57343)&&(o=r));break;case 4:E=e[i+1],a=e[i+2],n=e[i+3],128==(192&E)&&128==(192&a)&&128==(192&n)&&(r=(15&t)<<18|(63&E)<<12|(63&a)<<6|63&n,r>65535&&r<1114112&&(o=r))}}null===o?(o=65533,_=1):o>65535&&(o-=65536,a.push(o>>>10&1023|55296),o=56320|1023&o),a.push(o),i+=_}return(function(e){const t=e.length;if(t<=B)return String.fromCharCode.apply(String,e);let E="",a=0;for(;aa.length?(r.isBuffer(t)||(t=r.from(t)),t.copy(a,i)):Uint8Array.prototype.set.call(a,t,i);else{if(!r.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(a,i)}i+=t.length}return a},r.byteLength=O,r.prototype._isBuffer=!0,r.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tE&&(e+=" ... "),""},o&&(r.prototype[o]=r.prototype.inspect),r.prototype.compare=function(e,t,E,a,i){if(X(e,Uint8Array)&&(e=r.from(e,e.offset,e.byteLength)),!r.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===E&&(E=e?e.length:0),void 0===a&&(a=0),void 0===i&&(i=this.length),t<0||E>e.length||a<0||i>this.length)throw new RangeError("out of range index");if(a>=i&&t>=E)return 0;if(a>=i)return-1;if(t>=E)return 1;if(this===e)return 0;let o=(i>>>=0)-(a>>>=0),_=(E>>>=0)-(t>>>=0);const n=Math.min(o,_),S=this.slice(a,i),T=e.slice(t,E);for(let e=0;e>>=0,isFinite(E)?(E>>>=0,void 0===a&&(a="utf8")):(a=E,E=void 0)}const i=this.length-t;if((void 0===E||E>i)&&(E=i),e.length>0&&(E<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");a||(a="utf8");let o=!1;for(;;)switch(a){case"hex":return c(this,e,t,E);case"utf8":case"utf-8":return L(this,e,t,E);case"ascii":case"latin1":case"binary":return m(this,e,t,E);case"base64":return D(this,e,t,E);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,t,E);default:if(o)throw new TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),o=!0}},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const B=4096;function h(e,t,E){let a="";E=Math.min(e.length,E);for(let i=t;ia)&&(E=a);let i="";for(let a=t;aE)throw new RangeError("Trying to access beyond buffer length")}function v(e,t,E,a,i,o){if(!r.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function U(e,t,E,a,i){Y(t,a,i,e,E,7);let o=Number(t&BigInt(4294967295));e[E++]=o,o>>=8,e[E++]=o,o>>=8,e[E++]=o,o>>=8,e[E++]=o;let _=Number(t>>BigInt(32)&BigInt(4294967295));return e[E++]=_,_>>=8,e[E++]=_,_>>=8,e[E++]=_,_>>=8,e[E++]=_,E}function G(e,t,E,a,i){Y(t,a,i,e,E,7);let o=Number(t&BigInt(4294967295));e[E+7]=o,o>>=8,e[E+6]=o,o>>=8,e[E+5]=o,o>>=8,e[E+4]=o;let _=Number(t>>BigInt(32)&BigInt(4294967295));return e[E+3]=_,_>>=8,e[E+2]=_,_>>=8,e[E+1]=_,_>>=8,e[E]=_,E+8}function y(e,t,E,a,i,o){if(E+a>e.length)throw new RangeError("Index out of range");if(E<0)throw new RangeError("Index out of range")}function b(e,t,E,a,o){return t=+t,E>>>=0,o||y(e,0,E,4),i.write(e,t,E,a,23,4),E+4}function k(e,t,E,a,o){return t=+t,E>>>=0,o||y(e,0,E,8),i.write(e,t,E,a,52,8),E+8}r.prototype.slice=function(e,t){const E=this.length;(e=~~e)<0?(e+=E)<0&&(e=0):e>E&&(e=E),(t=void 0===t?E:~~t)<0?(t+=E)<0&&(t=0):t>E&&(t=E),t>>=0,t>>>=0,E||M(e,t,this.length);let a=this[e],i=1,o=0;for(;++o>>=0,t>>>=0,E||M(e,t,this.length);let a=this[e+--t],i=1;for(;t>0&&(i*=256);)a+=this[e+--t]*i;return a},r.prototype.readUint8=r.prototype.readUInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),this[e]},r.prototype.readUint16LE=r.prototype.readUInt16LE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]|this[e+1]<<8},r.prototype.readUint16BE=r.prototype.readUInt16BE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]<<8|this[e+1]},r.prototype.readUint32LE=r.prototype.readUInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},r.prototype.readUint32BE=r.prototype.readUInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},r.prototype.readBigUInt64LE=J(function(e){w(e>>>=0,"offset");const t=this[e],E=this[e+7];void 0!==t&&void 0!==E||K(e,this.length-8);const a=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+E*2**24;return BigInt(a)+(BigInt(i)<>>=0,"offset");const t=this[e],E=this[e+7];void 0!==t&&void 0!==E||K(e,this.length-8);const a=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+E;return(BigInt(a)<>>=0,t>>>=0,E||M(e,t,this.length);let a=this[e],i=1,o=0;for(;++o=i&&(a-=Math.pow(2,8*t)),a},r.prototype.readIntBE=function(e,t,E){e>>>=0,t>>>=0,E||M(e,t,this.length);let a=t,i=1,o=this[e+--a];for(;a>0&&(i*=256);)o+=this[e+--a]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},r.prototype.readInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},r.prototype.readInt16LE=function(e,t){e>>>=0,t||M(e,2,this.length);const E=this[e]|this[e+1]<<8;return 32768&E?4294901760|E:E},r.prototype.readInt16BE=function(e,t){e>>>=0,t||M(e,2,this.length);const E=this[e+1]|this[e]<<8;return 32768&E?4294901760|E:E},r.prototype.readInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},r.prototype.readInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},r.prototype.readBigInt64LE=J(function(e){w(e>>>=0,"offset");const t=this[e],E=this[e+7];void 0!==t&&void 0!==E||K(e,this.length-8);const a=this[e+4]+256*this[e+5]+65536*this[e+6]+(E<<24);return(BigInt(a)<>>=0,"offset");const t=this[e],E=this[e+7];void 0!==t&&void 0!==E||K(e,this.length-8);const a=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(a)<>>=0,t||M(e,4,this.length),i.read(this,e,!0,23,4)},r.prototype.readFloatBE=function(e,t){return e>>>=0,t||M(e,4,this.length),i.read(this,e,!1,23,4)},r.prototype.readDoubleLE=function(e,t){return e>>>=0,t||M(e,8,this.length),i.read(this,e,!0,52,8)},r.prototype.readDoubleBE=function(e,t){return e>>>=0,t||M(e,8,this.length),i.read(this,e,!1,52,8)},r.prototype.writeUintLE=r.prototype.writeUIntLE=function(e,t,E,a){if(e=+e,t>>>=0,E>>>=0,!a){v(this,e,t,E,Math.pow(2,8*E)-1,0)}let i=1,o=0;for(this[t]=255&e;++o>>=0,E>>>=0,!a){v(this,e,t,E,Math.pow(2,8*E)-1,0)}let i=E-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+E},r.prototype.writeUint8=r.prototype.writeUInt8=function(e,t,E){return e=+e,t>>>=0,E||v(this,e,t,1,255,0),this[t]=255&e,t+1},r.prototype.writeUint16LE=r.prototype.writeUInt16LE=function(e,t,E){return e=+e,t>>>=0,E||v(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},r.prototype.writeUint16BE=r.prototype.writeUInt16BE=function(e,t,E){return e=+e,t>>>=0,E||v(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},r.prototype.writeUint32LE=r.prototype.writeUInt32LE=function(e,t,E){return e=+e,t>>>=0,E||v(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},r.prototype.writeUint32BE=r.prototype.writeUInt32BE=function(e,t,E){return e=+e,t>>>=0,E||v(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},r.prototype.writeBigUInt64LE=J(function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),r.prototype.writeBigUInt64BE=J(function(e,t=0){return G(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),r.prototype.writeIntLE=function(e,t,E,a){if(e=+e,t>>>=0,!a){const a=Math.pow(2,8*E-1);v(this,e,t,E,a-1,-a)}let i=0,o=1,_=0;for(this[t]=255&e;++i>>=0,!a){const a=Math.pow(2,8*E-1);v(this,e,t,E,a-1,-a)}let i=E-1,o=1,_=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===_&&0!==this[t+i+1]&&(_=1),this[t+i]=(e/o|0)-_&255;return t+E},r.prototype.writeInt8=function(e,t,E){return e=+e,t>>>=0,E||v(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},r.prototype.writeInt16LE=function(e,t,E){return e=+e,t>>>=0,E||v(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},r.prototype.writeInt16BE=function(e,t,E){return e=+e,t>>>=0,E||v(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},r.prototype.writeInt32LE=function(e,t,E){return e=+e,t>>>=0,E||v(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},r.prototype.writeInt32BE=function(e,t,E){return e=+e,t>>>=0,E||v(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},r.prototype.writeBigInt64LE=J(function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),r.prototype.writeBigInt64BE=J(function(e,t=0){return G(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),r.prototype.writeFloatLE=function(e,t,E){return b(this,e,t,!0,E)},r.prototype.writeFloatBE=function(e,t,E){return b(this,e,t,!1,E)},r.prototype.writeDoubleLE=function(e,t,E){return k(this,e,t,!0,E)},r.prototype.writeDoubleBE=function(e,t,E){return k(this,e,t,!1,E)},r.prototype.copy=function(e,t,E,a){if(!r.isBuffer(e))throw new TypeError("argument should be a Buffer");if(E||(E=0),a||0===a||(a=this.length),t>=e.length&&(t=e.length),t||(t=0),a>0&&a=this.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),e.length-t>>=0,E=void 0===E?this.length:E>>>0,e||(e=0),"number"==typeof e)for(i=t;i=a+4;E-=3)t=`_${e.slice(E-3,E)}${t}`;return`${e.slice(0,E)}${t}`}function Y(e,t,E,a,i,o){if(e>E||e3?0===t||t===BigInt(0)?`>= 0${a} and < 2${a} ** ${8*(o+1)}${a}`:`>= -(2${a} ** ${8*(o+1)-1}${a}) and < 2 ** ${8*(o+1)-1}${a}`:`>= ${t}${a} and <= ${E}${a}`,new F.ERR_OUT_OF_RANGE("value",i,e)}!(function(e,t,E){w(t,"offset"),void 0!==e[t]&&void 0!==e[t+E]||K(t,e.length-(E+1))})(a,i,o)}function w(e,t){if("number"!=typeof e)throw new F.ERR_INVALID_ARG_TYPE(t,"number",e)}function K(e,t,E){if(Math.floor(e)!==e)throw w(e,E),new F.ERR_OUT_OF_RANGE(E||"offset","an integer",e);if(t<0)throw new F.ERR_BUFFER_OUT_OF_BOUNDS;throw new F.ERR_OUT_OF_RANGE(E||"offset",`>= ${E?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,E){let a=`The value of "${e}" is out of range.`,i=E;return Number.isInteger(E)&&Math.abs(E)>2**32?i=H(String(E)):"bigint"==typeof E&&(i=String(E),(E>BigInt(2)**BigInt(32)||E<-(BigInt(2)**BigInt(32)))&&(i=H(i)),i+="n"),a+=` It must be ${t}. Received ${i}`,a},RangeError);const z=/[^+/0-9A-Za-z-_]/g;function j(e,t){let E;t=t||1/0;const a=e.length;let i=null;const o=[];for(let _=0;_55295&&E<57344){if(!i){if(E>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(_+1===a){(t-=3)>-1&&o.push(239,191,189);continue}i=E;continue}if(E<56320){(t-=3)>-1&&o.push(239,191,189),i=E;continue}E=65536+(i-55296<<10|E-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,E<128){if((t-=1)<0)break;o.push(E)}else if(E<2048){if((t-=2)<0)break;o.push(E>>6|192,63&E|128)}else if(E<65536){if((t-=3)<0)break;o.push(E>>12|224,E>>6&63|128,63&E|128)}else{if(!(E<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(E>>18|240,E>>12&63|128,E>>6&63|128,63&E|128)}}return o}function x(e){return a.toByteArray((function(e){if((e=(e=e.split("=")[0]).trim().replace(z,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e})(e))}function Q(e,t,E,a){let i;for(i=0;i=t.length||i>=e.length);++i)t[i+E]=e[i];return i}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 E=0;E<16;++E){const a=16*E;for(let i=0;i<16;++i)t[a+i]=e[E]+e[i]}return t})();function J(e){return"undefined"==typeof BigInt?Z:e}function Z(){throw new Error("BigInt not supported")}},75674(e,t,E){"use strict";var a=E(13583),i=E(81948),o=E(32878),_=E(20741);e.exports=_||a.call(o,i)},81948(e){"use strict";e.exports=Function.prototype.apply},32878(e){"use strict";e.exports=Function.prototype.call},45312(e,t,E){"use strict";var a=E(13583),i=E(57379),o=E(32878),_=E(75674);e.exports=function(e){if(e.length<1||"function"!=typeof e[0])throw new i("a function is required");return _(a,o,e)}},20741(e){"use strict";e.exports="undefined"!=typeof Reflect&&Reflect&&Reflect.apply},15298(e,t,E){"use strict";var a=E(40703),i=E(45312),o=i([a("%String.prototype.indexOf%")]);e.exports=function(e,t){var E=a(e,!!t);return"function"==typeof E&&o(e,".prototype.")>-1?i([E]):E}},52165(e,t,E){const a=E(14877),i={};for(const e of Object.keys(a))i[a[e]]=e;const o={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=o;for(const e of Object.keys(o)){if(!("channels"in o[e]))throw new Error("missing channels property: "+e);if(!("labels"in o[e]))throw new Error("missing channel labels property: "+e);if(o[e].labels.length!==o[e].channels)throw new Error("channel and label counts mismatch: "+e);const{channels:t,labels:E}=o[e];delete o[e].channels,delete o[e].labels,Object.defineProperty(o[e],"channels",{value:t}),Object.defineProperty(o[e],"labels",{value:E})}function _(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}o.rgb.hsl=function(e){const t=e[0]/255,E=e[1]/255,a=e[2]/255,i=Math.min(t,E,a),o=Math.max(t,E,a),_=o-i;let n,r;o===i?n=0:t===o?n=(E-a)/_:E===o?n=2+(a-t)/_:a===o&&(n=4+(t-E)/_),n=Math.min(60*n,360),n<0&&(n+=360);const S=(i+o)/2;return r=o===i?0:S<=.5?_/(o+i):_/(2-o-i),[n,100*r,100*S]},o.rgb.hsv=function(e){let t,E,a,i,o;const _=e[0]/255,n=e[1]/255,r=e[2]/255,S=Math.max(_,n,r),T=S-Math.min(_,n,r),s=function(e){return(S-e)/6/T+.5};return 0===T?(i=0,o=0):(o=T/S,t=s(_),E=s(n),a=s(r),_===S?i=a-E:n===S?i=1/3+t-a:r===S&&(i=2/3+E-t),i<0?i+=1:i>1&&(i-=1)),[360*i,100*o,100*S]},o.rgb.hwb=function(e){const t=e[0],E=e[1];let a=e[2];const i=o.rgb.hsl(e)[0],_=1/255*Math.min(t,Math.min(E,a));return a=1-1/255*Math.max(t,Math.max(E,a)),[i,100*_,100*a]},o.rgb.cmyk=function(e){const t=e[0]/255,E=e[1]/255,a=e[2]/255,i=Math.min(1-t,1-E,1-a);return[100*((1-t-i)/(1-i)||0),100*((1-E-i)/(1-i)||0),100*((1-a-i)/(1-i)||0),100*i]},o.rgb.keyword=function(e){const t=i[e];if(t)return t;let E,o=1/0;for(const t of Object.keys(a)){const i=_(e,a[t]);i.04045?((t+.055)/1.055)**2.4:t/12.92,E=E>.04045?((E+.055)/1.055)**2.4:E/12.92,a=a>.04045?((a+.055)/1.055)**2.4:a/12.92;return[100*(.4124*t+.3576*E+.1805*a),100*(.2126*t+.7152*E+.0722*a),100*(.0193*t+.1192*E+.9505*a)]},o.rgb.lab=function(e){const t=o.rgb.xyz(e);let E=t[0],a=t[1],i=t[2];E/=95.047,a/=100,i/=108.883,E=E>.008856?E**(1/3):7.787*E+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*(E-a),200*(a-i)]},o.hsl.rgb=function(e){const t=e[0]/360,E=e[1]/100,a=e[2]/100;let i,o,_;if(0===E)return _=255*a,[_,_,_];i=a<.5?a*(1+E):a+E-a*E;const n=2*a-i,r=[0,0,0];for(let e=0;e<3;e++)o=t+1/3*-(e-1),o<0&&o++,o>1&&o--,_=6*o<1?n+6*(i-n)*o:2*o<1?i:3*o<2?n+(i-n)*(2/3-o)*6:n,r[e]=255*_;return r},o.hsl.hsv=function(e){const t=e[0];let E=e[1]/100,a=e[2]/100,i=E;const o=Math.max(a,.01);a*=2,E*=a<=1?a:2-a,i*=o<=1?o:2-o;return[t,100*(0===a?2*i/(o+i):2*E/(a+E)),100*((a+E)/2)]},o.hsv.rgb=function(e){const t=e[0]/60,E=e[1]/100;let a=e[2]/100;const i=Math.floor(t)%6,o=t-Math.floor(t),_=255*a*(1-E),n=255*a*(1-E*o),r=255*a*(1-E*(1-o));switch(a*=255,i){case 0:return[a,r,_];case 1:return[n,a,_];case 2:return[_,a,r];case 3:return[_,n,a];case 4:return[r,_,a];case 5:return[a,_,n]}},o.hsv.hsl=function(e){const t=e[0],E=e[1]/100,a=e[2]/100,i=Math.max(a,.01);let o,_;_=(2-E)*a;const n=(2-E)*i;return o=E*i,o/=n<=1?n:2-n,o=o||0,_/=2,[t,100*o,100*_]},o.hwb.rgb=function(e){const t=e[0]/360;let E=e[1]/100,a=e[2]/100;const i=E+a;let o;i>1&&(E/=i,a/=i);const _=Math.floor(6*t),n=1-a;o=6*t-_,1&_&&(o=1-o);const r=E+o*(n-E);let S,T,s;switch(_){default:case 6:case 0:S=n,T=r,s=E;break;case 1:S=r,T=n,s=E;break;case 2:S=E,T=n,s=r;break;case 3:S=E,T=r,s=n;break;case 4:S=r,T=E,s=n;break;case 5:S=n,T=E,s=r}return[255*S,255*T,255*s]},o.cmyk.rgb=function(e){const t=e[0]/100,E=e[1]/100,a=e[2]/100,i=e[3]/100;return[255*(1-Math.min(1,t*(1-i)+i)),255*(1-Math.min(1,E*(1-i)+i)),255*(1-Math.min(1,a*(1-i)+i))]},o.xyz.rgb=function(e){const t=e[0]/100,E=e[1]/100,a=e[2]/100;let i,o,_;return i=3.2406*t+-1.5372*E+-.4986*a,o=-.9689*t+1.8758*E+.0415*a,_=.0557*t+-.204*E+1.057*a,i=i>.0031308?1.055*i**(1/2.4)-.055:12.92*i,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,_=_>.0031308?1.055*_**(1/2.4)-.055:12.92*_,i=Math.min(Math.max(0,i),1),o=Math.min(Math.max(0,o),1),_=Math.min(Math.max(0,_),1),[255*i,255*o,255*_]},o.xyz.lab=function(e){let t=e[0],E=e[1],a=e[2];t/=95.047,E/=100,a/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,E=E>.008856?E**(1/3):7.787*E+16/116,a=a>.008856?a**(1/3):7.787*a+16/116;return[116*E-16,500*(t-E),200*(E-a)]},o.lab.xyz=function(e){let t,E,a;E=(e[0]+16)/116,t=e[1]/500+E,a=E-e[2]/200;const i=E**3,o=t**3,_=a**3;return E=i>.008856?i:(E-16/116)/7.787,t=o>.008856?o:(t-16/116)/7.787,a=_>.008856?_:(a-16/116)/7.787,t*=95.047,E*=100,a*=108.883,[t,E,a]},o.lab.lch=function(e){const t=e[0],E=e[1],a=e[2];let i;i=360*Math.atan2(a,E)/2/Math.PI,i<0&&(i+=360);return[t,Math.sqrt(E*E+a*a),i]},o.lch.lab=function(e){const t=e[0],E=e[1],a=e[2]/360*2*Math.PI;return[t,E*Math.cos(a),E*Math.sin(a)]},o.rgb.ansi16=function(e,t=null){const[E,a,i]=e;let _=null===t?o.rgb.hsv(e)[2]:t;if(_=Math.round(_/50),0===_)return 30;let n=30+(Math.round(i/255)<<2|Math.round(a/255)<<1|Math.round(E/255));return 2===_&&(n+=60),n},o.hsv.ansi16=function(e){return o.rgb.ansi16(o.hsv.rgb(e),e[2])},o.rgb.ansi256=function(e){const t=e[0],E=e[1],a=e[2];if(t===E&&E===a)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(E/255*5)+Math.round(a/255*5)},o.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 E=.5*(1+~~(e>50));return[(1&t)*E*255,(t>>1&1)*E*255,(t>>2&1)*E*255]},o.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]},o.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},o.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 E=t[0];3===t[0].length&&(E=E.split("").map(e=>e+e).join(""));const a=parseInt(E,16);return[a>>16&255,a>>8&255,255&a]},o.rgb.hcg=function(e){const t=e[0]/255,E=e[1]/255,a=e[2]/255,i=Math.max(Math.max(t,E),a),o=Math.min(Math.min(t,E),a),_=i-o;let n,r;return n=_<1?o/(1-_):0,r=_<=0?0:i===t?(E-a)/_%6:i===E?2+(a-t)/_:4+(t-E)/_,r/=6,r%=1,[360*r,100*_,100*n]},o.hsl.hcg=function(e){const t=e[1]/100,E=e[2]/100,a=E<.5?2*t*E:2*t*(1-E);let i=0;return a<1&&(i=(E-.5*a)/(1-a)),[e[0],100*a,100*i]},o.hsv.hcg=function(e){const t=e[1]/100,E=e[2]/100,a=t*E;let i=0;return a<1&&(i=(E-a)/(1-a)),[e[0],100*a,100*i]},o.hcg.rgb=function(e){const t=e[0]/360,E=e[1]/100,a=e[2]/100;if(0===E)return[255*a,255*a,255*a];const i=[0,0,0],o=t%1*6,_=o%1,n=1-_;let r=0;switch(Math.floor(o)){case 0:i[0]=1,i[1]=_,i[2]=0;break;case 1:i[0]=n,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=_;break;case 3:i[0]=0,i[1]=n,i[2]=1;break;case 4:i[0]=_,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=n}return r=(1-E)*a,[255*(E*i[0]+r),255*(E*i[1]+r),255*(E*i[2]+r)]},o.hcg.hsv=function(e){const t=e[1]/100,E=t+e[2]/100*(1-t);let a=0;return E>0&&(a=t/E),[e[0],100*a,100*E]},o.hcg.hsl=function(e){const t=e[1]/100,E=e[2]/100*(1-t)+.5*t;let a=0;return E>0&&E<.5?a=t/(2*E):E>=.5&&E<1&&(a=t/(2*(1-E))),[e[0],100*a,100*E]},o.hcg.hwb=function(e){const t=e[1]/100,E=t+e[2]/100*(1-t);return[e[0],100*(E-t),100*(1-E)]},o.hwb.hcg=function(e){const t=e[1]/100,E=1-e[2]/100,a=E-t;let i=0;return a<1&&(i=(E-a)/(1-a)),[e[0],100*a,100*i]},o.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},o.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},o.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},o.gray.hsl=function(e){return[0,0,e[0]]},o.gray.hsv=o.gray.hsl,o.gray.hwb=function(e){return[0,100,e[0]]},o.gray.cmyk=function(e){return[0,0,0,e[0]]},o.gray.lab=function(e){return[e[0],0,0]},o.gray.hex=function(e){const t=255&Math.round(e[0]/100*255),E=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(E.length)+E},o.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]}},61880(e,t,E){const a=E(52165),i=E(985),o={};Object.keys(a).forEach(e=>{o[e]={},Object.defineProperty(o[e],"channels",{value:a[e].channels}),Object.defineProperty(o[e],"labels",{value:a[e].labels});const t=i(e);Object.keys(t).forEach(E=>{const a=t[E];o[e][E]=(function(e){const t=function(...t){const E=t[0];if(null==E)return E;E.length>1&&(t=E);const a=e(t);if("object"==typeof a)for(let e=a.length,t=0;t1&&(t=E),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t})(a)})}),e.exports=o},985(e,t,E){const a=E(52165);function i(e){const t=(function(){const e={},t=Object.keys(a);for(let E=t.length,a=0;a=4&&1!==e[3]&&(t=", "+e[3]),"hwb("+e[0]+", "+e[1]+"%, "+e[2]+"%"+t+")"},r.to.keyword=function(e){return _[e.slice(0,3)]}},38742(e,t,E){const a=E(66138),i=E(61880),o=["keyword","gray","hex"],_={};for(const e of Object.keys(i))_[[...i[e].labels].sort().join("")]=e;const n={};function r(e,t){if(!(this instanceof r))return new r(e,t);if(t&&t in o&&(t=null),t&&!(t in i))throw new Error("Unknown model: "+t);let E,S;if(null==e)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(e instanceof r)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if("string"==typeof e){const t=a.get(e);if(null===t)throw new Error("Unable to parse color from string: "+e);this.model=t.model,S=i[this.model].channels,this.color=t.value.slice(0,S),this.valpha="number"==typeof t.value[S]?t.value[S]:1}else if(e.length>0){this.model=t||"rgb",S=i[this.model].channels;const E=Array.prototype.slice.call(e,0,S);this.color=I(E,S),this.valpha="number"==typeof e[S]?e[S]: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 a=t.sort().join("");if(!(a in _))throw new Error("Unable to parse color from object: "+JSON.stringify(e));this.model=_[a];const{labels:o}=i[this.model],n=[];for(E=0;E(e%360+360)%360),saturationl:T("hsl",1,s(100)),lightness:T("hsl",2,s(100)),saturationv:T("hsv",1,s(100)),value:T("hsv",2,s(100)),chroma:T("hcg",1,s(100)),gray:T("hcg",2,s(100)),white:T("hwb",1,s(100)),wblack:T("hwb",2,s(100)),cyan:T("cmyk",0,s(100)),magenta:T("cmyk",1,s(100)),yellow:T("cmyk",2,s(100)),black:T("cmyk",3,s(100)),x:T("xyz",0,s(95.047)),y:T("xyz",1,s(100)),z:T("xyz",2,s(108.833)),l:T("lab",0,s(100)),a:T("lab",1),b:T("lab",2),keyword(e){return void 0!==e?new r(e):i[this.model].keyword(this.color)},hex(e){return void 0!==e?new r(e):a.to.hex(this.rgb().round().color)},hexa(e){if(void 0!==e)return new r(e);const t=this.rgb().round().color;let E=Math.round(255*this.valpha).toString(16).toUpperCase();return 1===E.length&&(E="0"+E),a.to.hex(t)+E},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[E,a]of e.entries()){const e=a/255;t[E]=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(),E=e.luminosity();return t>E?(t+.05)/(E+.05):(E+.05)/(t+.05)},level(e){const t=this.contrast(e);return t>=7?"AAA":t>=4.5?"AA":""},isDark(){const e=this.rgb().color;return(2126*e[0]+7152*e[1]+722*e[2])/1e4<128},isLight(){return!this.isDark()},negate(){const e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){const t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){const t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){const t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){const t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){const t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){const t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){const e=this.rgb().color,t=.3*e[0]+.59*e[1]+.11*e[2];return r.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){const t=this.hsl();let E=t.color[0];return E=(E+e)%360,E=E<0?360+E:E,t.color[0]=E,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 E=e.rgb(),a=this.rgb(),i=void 0===t?.5:t,o=2*i-1,_=E.alpha()-a.alpha(),n=((o*_===-1?o:(o+_)/(1+o*_))+1)/2,S=1-n;return r.rgb(n*E.red()+S*a.red(),n*E.green()+S*a.green(),n*E.blue()+S*a.blue(),E.alpha()*i+a.alpha()*(1-i))}};for(const e of Object.keys(i)){if(o.includes(e))continue;const{channels:t}=i[e];r.prototype[e]=function(...t){return this.model===e?new r(this):t.length>0?new r(t,e):new r([...(E=i[this.model][e].raw(this.color),Array.isArray(E)?E:[E]),this.valpha],e);var E},r[e]=function(...E){let a=E[0];return"number"==typeof a&&(a=I(E,t)),new r(a,e)}}function S(e){return function(t){return(function(e,t){return Number(e.toFixed(t))})(t,e)}}function T(e,t,E){e=Array.isArray(e)?e:[e];for(const a of e)(n[a]||(n[a]=[]))[t]=E;return e=e[0],function(a){let i;return void 0!==a?(E&&(a=E(a)),i=this[e](),i.color[t]=a,i):(i=this[e]().color[t],E&&(i=E(i)),i)}}function s(e){return function(t){return Math.max(0,Math.min(e,t))}}function I(e,t){for(let E=0;E1&&"boolean"!=typeof t)throw new T('"allowMissing" argument must be a boolean');if(null===w(/^%?[^%]*%?$/,e))throw new S("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var E=(function(e){var t=Y(e,0,1),E=Y(e,-1);if("%"===t&&"%"!==E)throw new S("invalid intrinsic syntax, expected closing `%`");if("%"===E&&"%"!==t)throw new S("invalid intrinsic syntax, expected opening `%`");var a=[];return H(e,K,function(e,t,E,i){a[a.length]=E?H(i,z,"$1"):t||e}),a})(e),a=E.length>0?E[0]:"",i=j("%"+a+"%",t),o=i.name,_=i.value,n=!1,r=i.alias;r&&(a=r[0],V(E,F([0,1],r)));for(var s=1,I=!0;s=E.length){var u=L(_,l);_=(I=!!u)&&"get"in u&&!("originalValue"in u.get)?u.get:_[l]}else I=k(_,l),_=_[l];I&&!n&&(v[o]=_)}}return _}},48819(e,t,E){"use strict";var a=E(32410);e.exports=a.getPrototypeOf||null},22517(e){"use strict";e.exports="undefined"!=typeof Reflect&&Reflect.getPrototypeOf||null},31611(e,t,E){"use strict";var a=E(22517),i=E(48819),o=E(61449);e.exports=a?function(e){return a(e)}:i?function(e){if(!e||"object"!=typeof e&&"function"!=typeof e)throw new TypeError("getProto: not an object");return i(e)}:o?function(e){return o(e)}:null},64656(e){"use strict";e.exports=Object.getOwnPropertyDescriptor},3492(e,t,E){"use strict";var a=E(64656);if(a)try{a([],"length")}catch(e){a=null}e.exports=a},87657(e,t,E){"use strict";var a="undefined"!=typeof Symbol&&Symbol,i=E(38123);e.exports=function(){return"function"==typeof a&&("function"==typeof Symbol&&("symbol"==typeof a("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},38123(e){"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),E=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(E))return!1;for(var a 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}},75334(e,t,E){"use strict";var a=Function.prototype.call,i=Object.prototype.hasOwnProperty,o=E(13583);e.exports=o.call(a,i)},77444(e){var t=e.exports=function(e,E){if(E||(E=16),void 0===e&&(e=128),e<=0)return"0";for(var a=Math.log(Math.pow(2,e))/Math.log(E),i=2;a===1/0;i*=2)a=Math.log(Math.pow(2,e/i))/Math.log(E)*i;var o=a-Math.floor(a),_="";for(i=0;i=Math.pow(2,e)?t(e,E):_};t.rack=function(e,E,a){var i=function(i){var _=0;do{if(_++>10){if(!a)throw new Error("too many ID collisions, use more bits");e+=a}var n=t(e,E)}while(Object.hasOwnProperty.call(o,n));return o[n]=i,n},o=i.hats={};return i.get=function(e){return i.hats[e]},i.set=function(e,t){return i.hats[e]=t,i},i.bits=e||128,i.base=E||16,i}},53683(e){!(function t(E){e.exports=(function(){"use strict";function e(e,t){var E=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),E.push.apply(E,a)}return E}function a(t){for(var E=1;Ee.length)&&(t=e.length);for(var E=0,a=new Array(t);E=e.length?{done:!0}:{done:!1,value:e[a++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function L(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var m={exports:{}};!(function(e){var t,E,a,i,o;t=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,E=/^(?=([^\/?#]*))\1([^]*)$/,a=/(?:\/|^)\.(?=\/)/g,i=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(e,t,a){if(a=a||{},e=e.trim(),!(t=t.trim())){if(!a.alwaysNormalize)return e;var i=o.parseURL(e);if(!i)throw new Error("Error trying to parse base URL.");return i.path=o.normalizePath(i.path),o.buildURLFromParts(i)}var _=o.parseURL(t);if(!_)throw new Error("Error trying to parse relative URL.");if(_.scheme)return a.alwaysNormalize?(_.path=o.normalizePath(_.path),o.buildURLFromParts(_)):t;var n=o.parseURL(e);if(!n)throw new Error("Error trying to parse base URL.");if(!n.netLoc&&n.path&&"/"!==n.path[0]){var r=E.exec(n.path);n.netLoc=r[1],n.path=r[2]}n.netLoc&&!n.path&&(n.path="/");var S={scheme:n.scheme,netLoc:_.netLoc,path:null,params:_.params,query:_.query,fragment:_.fragment};if(!_.netLoc&&(S.netLoc=n.netLoc,"/"!==_.path[0]))if(_.path){var T=n.path,s=T.substring(0,T.lastIndexOf("/")+1)+_.path;S.path=o.normalizePath(s)}else S.path=n.path,_.params||(S.params=n.params,_.query||(S.query=n.query));return null===S.path&&(S.path=a.alwaysNormalize?o.normalizePath(_.path):_.path),o.buildURLFromParts(S)},parseURL:function(e){var E=t.exec(e);return E?{scheme:E[1]||"",netLoc:E[2]||"",path:E[3]||"",params:E[4]||"",query:E[5]||"",fragment:E[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(a,"");e.length!==(e=e.replace(i,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=o})(m);var D=m.exports,C=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},p=Number.isSafeInteger||function(e){return"number"==typeof e&&Math.abs(e)<=P},P=Number.MAX_SAFE_INTEGER||9007199254740991,B=(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})({}),h=(function(e){return e.NETWORK_ERROR="networkError",e.MEDIA_ERROR="mediaError",e.KEY_SYSTEM_ERROR="keySystemError",e.MUX_ERROR="muxError",e.OTHER_ERROR="otherError",e})({}),f=(function(e){return e.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",e.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",e.KEY_SYSTEM_NO_SESSION="keySystemNoSession",e.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",e.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",e.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",e.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",e.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",e.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",e.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",e.MANIFEST_LOAD_ERROR="manifestLoadError",e.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",e.MANIFEST_PARSING_ERROR="manifestParsingError",e.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",e.LEVEL_EMPTY_ERROR="levelEmptyError",e.LEVEL_LOAD_ERROR="levelLoadError",e.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",e.LEVEL_PARSING_ERROR="levelParsingError",e.LEVEL_SWITCH_ERROR="levelSwitchError",e.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",e.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",e.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",e.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",e.FRAG_LOAD_ERROR="fragLoadError",e.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",e.FRAG_DECRYPT_ERROR="fragDecryptError",e.FRAG_PARSING_ERROR="fragParsingError",e.FRAG_GAP="fragGap",e.REMUX_ALLOC_ERROR="remuxAllocError",e.KEY_LOAD_ERROR="keyLoadError",e.KEY_LOAD_TIMEOUT="keyLoadTimeOut",e.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",e.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",e.BUFFER_APPEND_ERROR="bufferAppendError",e.BUFFER_APPENDING_ERROR="bufferAppendingError",e.BUFFER_STALLED_ERROR="bufferStalledError",e.BUFFER_FULL_ERROR="bufferFullError",e.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",e.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",e.INTERNAL_EXCEPTION="internalException",e.INTERNAL_ABORTED="aborted",e.UNKNOWN="unknown",e})({}),W=function(){},g={trace:W,debug:W,log:W,warn:W,info:W,error:W},M=g;function v(e){var t=self.console[e];return t?t.bind(self.console,"["+e+"] >"):W}function U(e){for(var t=arguments.length,E=new Array(t>1?t-1:0),a=1;aNumber.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 E=new Uint8Array(t.length/2),a=0;aNumber.MAX_SAFE_INTEGER?1/0:t},t.decimalFloatingPoint=function(e){return parseFloat(this[e])},t.optionalFloat=function(e,t){var E=this[e];return E?parseFloat(E):t},t.enumeratedString=function(e){return this[e]},t.bool=function(e){return"YES"===this[e]},t.decimalResolution=function(e){var t=b.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}},e.parseAttrList=function(e){var t,E={},a='"';for(k.lastIndex=0;null!==(t=k.exec(e));){var i=t[2];0===i.indexOf(a)&&i.lastIndexOf(a)===i.length-1&&(i=i.slice(1,-1)),E[t[1].trim()]=i}return E},n(e,[{key:"clientAttrs",get:function(){return Object.keys(this).filter(function(e){return"X-"===e.substring(0,2)})}}]),e})();function V(e){return"ID"!==e&&"CLASS"!==e&&"START-DATE"!==e&&"DURATION"!==e&&"END-DATE"!==e&&"END-ON-NEXT"!==e}function H(e){return"SCTE35-OUT"===e||"SCTE35-IN"===e}var Y=(function(){function e(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){var E=t.attr;for(var a in E)if(Object.prototype.hasOwnProperty.call(e,a)&&e[a]!==E[a]){y.warn('DATERANGE tag attribute: "'+a+'" does not match for tags with ID: "'+e.ID+'"'),this._badValueForSameId=a;break}e=S(new F({}),E,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){var i=new Date(this.attr["END-DATE"]);C(i.getTime())&&(this._endDate=i)}}return n(e,[{key:"id",get:function(){return this.attr.ID}},{key:"class",get:function(){return this.attr.CLASS}},{key:"startDate",get:function(){return this._startDate}},{key:"endDate",get:function(){if(this._endDate)return this._endDate;var e=this.duration;return null!==e?new Date(this._startDate.getTime()+1e3*e):null}},{key:"duration",get:function(){if("DURATION"in this.attr){var e=this.attr.decimalFloatingPoint("DURATION");if(C(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}},{key:"plannedDuration",get:function(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}},{key:"endOnNext",get:function(){return this.attr.bool("END-ON-NEXT")}},{key:"isValid",get:function(){return!!this.id&&!this._badValueForSameId&&C(this.startDate.getTime())&&(null===this.duration||this.duration>=0)&&(!this.endOnNext||!!this.class)}}]),e})(),w=function(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}},K={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"},z=(function(){function e(e){var t;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=((t={})[K.AUDIO]=null,t[K.VIDEO]=null,t[K.AUDIOVIDEO]=null,t),this.baseurl=e}return e.prototype.setByteRange=function(e,t){var E,a=e.split("@",2);E=1===a.length?(null==t?void 0:t.byteRangeEndOffset)||0:parseInt(a[1]),this._byteRange=[E,parseInt(a[0])+E]},n(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,E){var a;return(a=e.call(this,E)||this)._decryptdata=null,a.rawProgramDateTime=null,a.programDateTime=null,a.tagList=[],a.duration=0,a.sn=0,a.levelkeys=void 0,a.type=void 0,a.loader=null,a.keyLoader=null,a.level=-1,a.cc=0,a.startPTS=void 0,a.endPTS=void 0,a.startDTS=void 0,a.endDTS=void 0,a.start=0,a.deltaPTS=void 0,a.maxStartPTS=void 0,a.minEndPTS=void 0,a.stats=new w,a.data=void 0,a.bitrateTest=!1,a.title=null,a.initSegment=null,a.endList=void 0,a.gap=void 0,a.urlId=0,a.type=t,a}T(t,e);var E=t.prototype;return E.setKeyFormat=function(e){if(this.levelkeys){var t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}},E.abortRequests=function(){var e,t;null==(e=this.loader)||e.abort(),null==(t=this.keyLoader)||t.abort()},E.setElementaryStreamInfo=function(e,t,E,a,i,o){void 0===o&&(o=!1);var _=this.elementaryStreams,n=_[e];n?(n.startPTS=Math.min(n.startPTS,t),n.endPTS=Math.max(n.endPTS,E),n.startDTS=Math.min(n.startDTS,a),n.endDTS=Math.max(n.endDTS,i)):_[e]={startPTS:t,endPTS:E,startDTS:a,endDTS:i,partial:o}},E.clearElementaryStreamInfo=function(){var e=this.elementaryStreams;e[K.AUDIO]=null,e[K.VIDEO]=null,e[K.AUDIOVIDEO]=null},n(t,[{key:"decryptdata",get:function(){if(!this.levelkeys&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){var e=this.levelkeys.identity;if(e)this._decryptdata=e.getDecryptData(this.sn);else{var t=Object.keys(this.levelkeys);if(1===t.length)return this._decryptdata=this.levelkeys[t[0]].getDecryptData(this.sn)}}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(null===this.programDateTime)return null;if(!C(this.programDateTime))return null;var e=C(this.duration)?this.duration:0;return this.programDateTime+1e3*e}},{key:"encrypted",get:function(){var e;if(null!=(e=this._decryptdata)&&e.encrypted)return!0;if(this.levelkeys){var t=Object.keys(this.levelkeys),E=t.length;if(E>1||1===E&&this.levelkeys[t[0]].encrypted)return!0}return!1}}]),t})(z),x=(function(e){function t(t,E,a,i,o){var _;(_=e.call(this,a)||this).fragOffset=0,_.duration=0,_.gap=!1,_.independent=!1,_.relurl=void 0,_.fragment=void 0,_.index=void 0,_.stats=new w,_.duration=t.decimalFloatingPoint("DURATION"),_.gap=t.bool("GAP"),_.independent=t.bool("INDEPENDENT"),_.relurl=t.enumeratedString("URI"),_.fragment=E,_.index=i;var n=t.enumeratedString("BYTERANGE");return n&&_.setByteRange(n,o),o&&(_.fragOffset=o.fragOffset+o.duration),_}return T(t,e),n(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})(z),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,E=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!E||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||0===t&&E>0,this.updated||this.advanced?this.misses=Math.floor(.6*e.misses):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay},n(e,[{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&C(this.fragments[this.fragments.length-1].programDateTime)}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||Q}},{key:"drift",get:function(){var e=this.driftEndTime-this.driftStartTime;return e>0?1e3*(this.driftEnd-this.driftStart)/e:1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var e;return null!=(e=this.fragments)&&e.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),e})();function $(e){return Uint8Array.from(atob(e),function(e){return e.charCodeAt(0)})}function q(e){var t=ee(e).subarray(0,16),E=new Uint8Array(16);return E.set(t,16-t.length),E}function J(e){var t=function(e,t,E){var a=e[t];e[t]=e[E],e[E]=a};t(e,0,3),t(e,1,2),t(e,4,5),t(e,6,7)}function Z(e){var t=e.split(":"),E=null;if("data"===t[0]&&2===t.length){var a=t[1].split(";"),i=a[a.length-1].split(",");if(2===i.length){var o="base64"===i[0],_=i[1];o?(a.splice(-1,1),E=$(_)):E=q(_)}}return E}function ee(e){return Uint8Array.from(unescape(encodeURIComponent(e)),function(e){return e.charCodeAt(0)})}var te="undefined"!=typeof self?self:void 0,Ee={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},ae={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function ie(e){switch(e){case ae.FAIRPLAY:return Ee.FAIRPLAY;case ae.PLAYREADY:return Ee.PLAYREADY;case ae.WIDEVINE:return Ee.WIDEVINE;case ae.CLEARKEY:return Ee.CLEARKEY}}var oe={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function _e(e){if(e===oe.WIDEVINE)return Ee.WIDEVINE}function ne(e){switch(e){case Ee.FAIRPLAY:return ae.FAIRPLAY;case Ee.PLAYREADY:return ae.PLAYREADY;case Ee.WIDEVINE:return ae.WIDEVINE;case Ee.CLEARKEY:return ae.CLEARKEY}}function re(e){var t=e.drmSystems,E=e.widevineLicenseUrl,a=t?[Ee.FAIRPLAY,Ee.WIDEVINE,Ee.PLAYREADY,Ee.CLEARKEY].filter(function(e){return!!t[e]}):[];return!a[Ee.WIDEVINE]&&E&&a.push(Ee.WIDEVINE),a}var Se,Te=null!=te&&null!=(Se=te.navigator)&&Se.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;function se(e,t,E,a){var i;switch(e){case Ee.FAIRPLAY:i=["cenc","sinf"];break;case Ee.WIDEVINE:case Ee.PLAYREADY:i=["cenc"];break;case Ee.CLEARKEY:i=["cenc","keyids"];break;default:throw new Error("Unknown key-system: "+e)}return Ie(i,t,E,a)}function Ie(e,t,E,a){return[{initDataTypes:e,persistentState:a.persistentState||"optional",distinctiveIdentifier:a.distinctiveIdentifier||"optional",sessionTypes:a.sessionTypes||[a.sessionType||"temporary"],audioCapabilities:t.map(function(e){return{contentType:'audio/mp4; codecs="'+e+'"',robustness:a.audioRobustness||"",encryptionScheme:a.audioEncryptionScheme||null}}),videoCapabilities:E.map(function(e){return{contentType:'video/mp4; codecs="'+e+'"',robustness:a.videoRobustness||"",encryptionScheme:a.videoEncryptionScheme||null}})}]}function le(e,t,E){return Uint8Array.prototype.slice?e.slice(t,E):new Uint8Array(Array.prototype.slice.call(e,t,E))}var Ae,Oe=function(e,t){return t+10<=e.length&&73===e[t]&&68===e[t+1]&&51===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128},ue=function(e,t){return t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128},Re=function(e,t){for(var E=t,a=0;Oe(e,t);)a+=10,a+=Ne(e,t+6),ue(e,t+10)&&(a+=10),t+=a;if(a>0)return e.subarray(E,E+a)},Ne=function(e,t){var E=0;return E=(127&e[t])<<21,E|=(127&e[t+1])<<14,E|=(127&e[t+2])<<7,E|=127&e[t+3]},de=function(e,t){return Oe(e,t)&&Ne(e,t+6)+10<=e.length-t},ce=function(e){for(var t=De(e),E=0;E>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:S+=String.fromCharCode(o);break;case 12:case 13:_=e[T++],S+=String.fromCharCode((31&o)<<6|63&_);break;case 14:_=e[T++],n=e[T++],S+=String.fromCharCode((15&o)<<12|(63&_)<<6|63&n)}}return S};function We(){if(!navigator.userAgent.includes("PlayStation 4"))return Ae||void 0===self.TextDecoder||(Ae=new self.TextDecoder("utf-8")),Ae}var ge={hexDump:function(e){for(var t="",E=0;E>24,e[t+1]=E>>16&255,e[t+2]=E>>8&255,e[t+3]=255&E}function He(e){for(var t=e.byteLength,E=0;E8&&109===e[E+4]&&111===e[E+5]&&111===e[E+6]&&102===e[E+7])return!0;E=a>1?E+a:t}return!1}function Ye(e,t){var E=[];if(!t.length)return E;for(var a=e.byteLength,i=0;i1?i+o:a;if(Ge(e.subarray(i+4,i+8))===t[0])if(1===t.length)E.push(e.subarray(i+8,_));else{var n=Ye(e.subarray(i+8,_),t.slice(1));n.length&&ve.apply(E,n)}i=_}return E}function we(e){var t=[],E=e[0],a=8,i=be(e,a);a+=4;var o=0,_=0;0===E?(o=be(e,a),_=be(e,a+4),a+=8):(o=ke(e,a),_=ke(e,a+8),a+=16),a+=2;var n=e.length+_,r=ye(e,a);a+=2;for(var S=0;S>>31)return y.warn("SIDX has hierarchical references (not supported)"),null;var l=be(e,T);T+=4,t.push({referenceSize:I,subsegmentDuration:l,info:{duration:l/i,start:n,end:n+I-1}}),n+=I,a=T+=4}return{earliestPresentationTime:o,timescale:i,version:E,referencesCount:r,references:t}}function Ke(e){for(var t=[],E=Ye(e,["moov","trak"]),i=0;i12){var T=4;if(3!==S[T++])break;T=je(S,T),T+=2;var s=S[T++];if(128&s&&(T+=2),64&s&&(T+=S[T++]),4!==S[T++])break;T=je(S,T);var I=S[T++];if(64!==I)break;if(i+="."+xe(I),T+=12,5!==S[T++])break;T=je(S,T);var l=S[T++],A=(248&l)>>3;31===A&&(A+=1+((7&l)<<3)+((224&S[T])>>5)),i+="."+A}break;case"hvc1":case"hev1":var O=Ye(E,["hvcC"])[0],u=O[1],R=["","A","B","C"][u>>6],N=31&u,d=be(O,2),c=(32&u)>>5?"H":"L",L=O[12],m=O.subarray(6,12);i+="."+R+N,i+="."+d.toString(16).toUpperCase(),i+="."+c+L;for(var D="",C=m.length;C--;){var p=m[C];(p||D)&&(D="."+p.toString(16).toUpperCase()+D)}i+=D;break;case"dvh1":case"dvhe":var P=Ye(E,["dvcC"])[0],B=P[2]>>1&127,h=P[2]<<5&32|P[3]>>3&31;i+="."+Qe(B)+"."+Qe(h);break;case"vp09":var f=Ye(E,["vpcC"])[0],W=f[4],g=f[5],M=f[6]>>4&15;i+="."+Qe(W)+"."+Qe(g)+"."+Qe(M);break;case"av01":var v=Ye(E,["av1C"])[0],U=v[1]>>>5,G=31&v[1],y=v[2]>>>7?"H":"M",b=(64&v[2])>>6,k=(32&v[2])>>5,F=2===U&&b?k?12:10:b?10:8,V=(16&v[2])>>4,H=(8&v[2])>>3,Y=(4&v[2])>>2,w=3&v[2],K=1,z=1,j=1,x=0;i+="."+U+"."+Qe(G)+y+"."+Qe(F)+"."+V+"."+H+Y+w+"."+Qe(K)+"."+Qe(z)+"."+Qe(j)+"."+x}return{codec:i,encrypted:o}}function je(e,t){for(var E=t+5;128&e[t++]&&t0;i||(a=Ye(t,["encv"])),a.forEach(function(e){Ye(i?e.subarray(28):e.subarray(78),["sinf"]).forEach(function(e){var t=$e(e);if(t){var a=t.subarray(8,24);a.some(function(e){return 0!==e})||(y.log("[eme] Patching keyId in 'enc"+(i?"a":"v")+">sinf>>tenc' box: "+ge.hexDump(a)+" -> "+ge.hexDump(E)),t.set(E,8))}})})}),e}function $e(e){var t=Ye(e,["schm"])[0];if(t){var E=Ge(t.subarray(4,8));if("cbcs"===E||"cenc"===E)return Ye(e,["schi","tenc"])[0]}return y.error("[eme] missing 'schm' box"),null}function qe(e,t){return Ye(t,["moof","traf"]).reduce(function(t,E){var a=Ye(E,["tfdt"])[0],i=a[0],o=Ye(E,["tfhd"]).reduce(function(t,E){var o=be(E,4),_=e[o];if(_){var n=be(a,4);if(1===i){if(n===Me)return y.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),t;n*=Me+1,n+=be(a,8)}var r=n/(_.timescale||9e4);if(C(r)&&(null===t||r>1&63;return 39===E||40===E}return 6==(31&t)}function _t(e,t,E,a){var i=nt(e),o=0;o+=t;for(var _=0,n=0,r=0;o=i.length)break;_+=r=i[o++]}while(255===r);n=0;do{if(o>=i.length)break;n+=r=i[o++]}while(255===r);var S=i.length-o,T=o;if(nS){y.error("Malformed SEI payload. "+n+" is too small, only "+S+" bytes left to parse.");break}if(4===_){if(181===i[T++]){var s=ye(i,T);if(T+=2,49===s){var I=be(i,T);if(T+=4,1195456820===I){var l=i[T++];if(3===l){var A=i[T++],O=64&A,u=O?2+3*(31&A):0,R=new Uint8Array(u);if(O){R[0]=A;for(var N=1;N16){for(var d=[],c=0;c<16;c++){var L=i[T++].toString(16);d.push(1==L.length?"0"+L:L),3!==c&&5!==c&&7!==c&&9!==c||d.push("-")}for(var m=n-16,D=new Uint8Array(m),C=0;C1?t-1:0),a=1;a>24&255,n[1]=o>>16&255,n[2]=o>>8&255,n[3]=255&o,n.set(e,4),_=0,o=8;_0?(o=new Uint8Array(4),t.length>0&&new DataView(o.buffer).setUint32(0,t.length,!1)):o=new Uint8Array;var r=new Uint8Array(4);return E&&E.byteLength>0&&new DataView(r.buffer).setUint32(0,E.byteLength,!1),St([112,115,115,104],new Uint8Array([a,0,0,0]),e,o,i,r,E||new Uint8Array)}function st(e){if(!(e instanceof ArrayBuffer)||e.byteLength<32)return null;var t={version:0,systemId:"",kids:null,data:null},E=new DataView(e),a=E.getUint32(0);if(e.byteLength!==a&&a>44)return null;if(1886614376!==E.getUint32(4))return null;if(t.version=E.getUint32(8)>>>24,t.version>1)return null;t.systemId=ge.hexDump(new Uint8Array(e,12,16));var i=E.getUint32(28);if(0===t.version){if(a-32=22&&(this.keyId=a.subarray(a.length-22,a.length-6));break;case ae.PLAYREADY:var i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Tt(i,null,a);var o=new Uint16Array(a.buffer,a.byteOffset,a.byteLength/2),_=String.fromCharCode.apply(null,Array.from(o)),n=_.substring(_.indexOf("<"),_.length),r=(new DOMParser).parseFromString(n,"text/xml").getElementsByTagName("KID")[0];if(r){var S=r.childNodes[0]?r.childNodes[0].nodeValue:r.getAttribute("VALUE");if(S){var T=$(S).subarray(0,16);J(T),this.keyId=T}}break;default:var s=a.subarray(0,16);if(16!==s.length){var I=new Uint8Array(16);I.set(s,16-s.length),s=I}this.keyId=s}if(!this.keyId||16!==this.keyId.byteLength){var l=It[this.uri];if(!l){var A=Object.keys(It).length%Number.MAX_SAFE_INTEGER;l=new Uint8Array(16),new DataView(l.buffer,12,4).setUint32(0,A),It[this.uri]=l}this.keyId=l}return this},e})();function At(e){for(var t=new Uint8Array(16),E=12;E<16;E++)t[E]=e>>8*(15-E)&255;return t}var Ot=/\{\$([a-zA-Z0-9-_]+)\}/g;function ut(e){return Ot.test(e)}function Rt(e,t,E){if(null!==e.variableList||e.hasVariableRefs)for(var a=E.length;a--;){var i=E[a],o=t[i];o&&(t[i]=Nt(e,o))}}function Nt(e,t){if(null!==e.variableList||e.hasVariableRefs){var E=e.variableList;return t.replace(Ot,function(t){var a=t.substring(2,t.length-1),i=null==E?void 0:E[a];return void 0===i?(e.playlistParsingError||(e.playlistParsingError=new Error('Missing preceding EXT-X-DEFINE tag for Variable Reference: "'+a+'"')),t):i})}return t}function dt(e,t,E){var a,i,o=e.variableList;if(o||(e.variableList=o={}),"QUERYPARAM"in t){a=t.QUERYPARAM;try{var _=new self.URL(E).searchParams;if(!_.has(a))throw new Error('"'+a+'" does not match any query parameter in URI: "'+E+'"');i=_.get(a)}catch(t){e.playlistParsingError||(e.playlistParsingError=new Error("EXT-X-DEFINE QUERYPARAM: "+t.message))}}else a=t.NAME,i=t.VALUE;a in o?e.playlistParsingError||(e.playlistParsingError=new Error('EXT-X-DEFINE duplicate Variable Name declarations: "'+a+'"')):o[a]=i||""}function ct(e,t,E){var a=t.IMPORT;if(E&&a in E){var i=e.variableList;i||(e.variableList=i={}),i[a]=E[a]}else e.playlistParsingError||(e.playlistParsingError=new Error('EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "'+a+'"'))}function Lt(e){if(void 0===e&&(e=!0),"undefined"!=typeof self)return(e||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}var mt={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 E=mt[t];return!!E&&!!E[e.slice(0,4)]}function Ct(e,t,E){return void 0===E&&(E=!0),!e.split(",").some(function(e){return!pt(e,t,E)})}function pt(e,t,E){var a;void 0===E&&(E=!0);var i=Lt(E);return null!=(a=null==i?void 0:i.isTypeSupported(Pt(e,t)))&&a}function Pt(e,t){return t+'/mp4;codecs="'+e+'"'}function Bt(e){if(e){var t=e.substring(0,4);return mt.video[t]}return 2}function ht(e){return e.split(",").reduce(function(e,t){var E=mt.video[t];return E?(2*E+e)/(e?3:2):(mt.audio[t]+e)/(e?2:1)},0)}var ft={};function Wt(e,t){if(void 0===t&&(t=!0),ft[e])return ft[e];for(var E={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[e],a=0;a2){var E=t.shift()+".";return E+=parseInt(t.shift()).toString(16),E+=("000"+parseInt(t.shift()).toString(16)).slice(-4)}return e}var Gt=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,yt=/#EXT-X-MEDIA:(.*)/g,bt=/^#EXT(?:INF|-X-TARGETDURATION):/m,kt=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[\S ]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),Ft=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),Vt=(function(){function e(){}return e.findGroup=function(e,t){for(var E=0;E0&&o.length0&&z.bool("CAN-SKIP-DATERANGES"),T.partHoldBack=z.optionalFloat("PART-HOLD-BACK",0),T.holdBack=z.optionalFloat("HOLD-BACK",0);break;case"PART-INF":var Q=new F(h);T.partTarget=Q.decimalFloatingPoint("PART-TARGET");break;case"PART":var $=T.partList;$||($=T.partList=[]);var q=A>0?$[$.length-1]:void 0,J=A++,Z=new F(h);Rt(T,Z,["BYTERANGE","URI"]);var ee=new x(Z,N,t,J,q);$.push(ee),N.duration+=ee.duration;break;case"PRELOAD-HINT":var te=new F(h);Rt(T,te,["URI"]),T.preloadHint=te;break;case"RENDITION-REPORT":var Ee=new F(h);Rt(T,Ee,["URI"]),T.renditionReports=T.renditionReports||[],T.renditionReports.push(Ee);break;default:y.warn("line parsed but not handled: "+_)}}}R&&!R.relurl?(s.pop(),O-=R.duration,T.partList&&(T.fragmentHint=R)):T.partList&&(jt(N,R),N.cc=u,T.fragmentHint=N,r&&Qt(N,r,T));var ae=s.length,ie=s[0],oe=s[ae-1];if((O+=T.skippedSegments*T.targetduration)>0&&ae&&oe){T.averagetargetduration=O/ae;var _e=oe.sn;T.endSN="initSegment"!==_e?_e:0,T.live||(oe.endList=!0),ie&&(T.startCC=ie.cc)}else T.endSN=0,T.startCC=0;return T.fragmentHint&&(O+=T.fragmentHint.duration),T.totalduration=O,T.endCC=u,d>0&&zt(s,d),T},e})();function Ht(e,t,E){var a,i,o=new F(e);Rt(E,o,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);var _=null!=(a=o.METHOD)?a:"",n=o.URI,r=o.hexadecimalInteger("IV"),S=o.KEYFORMATVERSIONS,T=null!=(i=o.KEYFORMAT)?i:"identity";n&&o.IV&&!r&&y.error("Invalid IV: "+o.IV);var s=n?Vt.resolve(n,t):"",I=(S||"1").split("/").map(Number).filter(Number.isFinite);return new lt(_,s,T,I,r)}function Yt(e){var t=new F(e).decimalFloatingPoint("TIME-OFFSET");return C(t)?t:null}function wt(e,t){var E=(e||"").split(/[ ,]+/).filter(function(e){return e});["video","audio","text"].forEach(function(e){var a=E.filter(function(t){return Dt(t,e)});a.length&&(t[e+"Codec"]=a.join(","),E=E.filter(function(e){return-1===a.indexOf(e)}))}),t.unknownCodecs=E}function Kt(e,t,E){var a=t[E];a&&(e[E]=a)}function zt(e,t){for(var E=e[t],a=t;a--;){var i=e[a];if(!i)return;i.programDateTime=E.programDateTime-1e3*i.duration,E=i}}function jt(e,t){e.rawProgramDateTime?e.programDateTime=Date.parse(e.rawProgramDateTime):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime),C(e.programDateTime)||(e.programDateTime=null,e.rawProgramDateTime=null)}function xt(e,t,E,a){e.relurl=t.URI,t.BYTERANGE&&e.setByteRange(t.BYTERANGE),e.level=E,e.sn="initSegment",a&&(e.levelkeys=a),e.initSegment=null}function Qt(e,t,E){e.levelkeys=t;var a=E.encryptedFragments;a.length&&a[a.length-1].levelkeys===t||!Object.keys(t).some(function(e){return t[e].isCommonEncryption})||a.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 E=e.url;return void 0!==E&&0!==E.indexOf("data:")||(E=t.url),E}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(B.MANIFEST_LOADING,this.onManifestLoading,this),e.on(B.LEVEL_LOADING,this.onLevelLoading,this),e.on(B.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(B.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},t.unregisterListeners=function(){var e=this.hls;e.off(B.MANIFEST_LOADING,this.onManifestLoading,this),e.off(B.LEVEL_LOADING,this.onLevelLoading,this),e.off(B.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(B.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},t.createInternalLoader=function(e){var t=this.hls.config,E=t.pLoader,a=t.loader,i=new(E||a)(t);return this.loaders[e.type]=i,i},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 E=t.url;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Xt.MANIFEST,url:E,deliveryDirectives:null})},t.onLevelLoading=function(e,t){var E=t.id,a=t.level,i=t.pathwayId,o=t.url,_=t.deliveryDirectives;this.load({id:E,level:a,pathwayId:i,responseType:"text",type:Xt.LEVEL,url:o,deliveryDirectives:_})},t.onAudioTrackLoading=function(e,t){var E=t.id,a=t.groupId,i=t.url,o=t.deliveryDirectives;this.load({id:E,groupId:a,level:null,responseType:"text",type:Xt.AUDIO_TRACK,url:i,deliveryDirectives:o})},t.onSubtitleTrackLoading=function(e,t){var E=t.id,a=t.groupId,i=t.url,o=t.deliveryDirectives;this.load({id:E,groupId:a,level:null,responseType:"text",type:Xt.SUBTITLE_TRACK,url:i,deliveryDirectives:o})},t.load=function(e){var t,E,a,i=this,o=this.hls.config,_=this.getInternalLoader(e);if(_){var n=_.context;if(n&&n.url===e.url&&n.level===e.level)return void y.trace("[playlist-loader]: playlist request ongoing");y.log("[playlist-loader]: aborting previous loader for type: "+e.type),_.abort()}if(E=e.type===Xt.MANIFEST?o.manifestLoadPolicy.default:S({},o.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),_=this.createInternalLoader(e),C(null==(t=e.deliveryDirectives)?void 0:t.part)&&(e.type===Xt.LEVEL&&null!==e.level?a=this.hls.levels[e.level].details:e.type===Xt.AUDIO_TRACK&&null!==e.id?a=this.hls.audioTracks[e.id].details:e.type===Xt.SUBTITLE_TRACK&&null!==e.id&&(a=this.hls.subtitleTracks[e.id].details),a)){var r=a.partTarget,T=a.targetduration;if(r&&T){var s=1e3*Math.max(3*r,.8*T);E=S({},E,{maxTimeToFirstByteMs:Math.min(s,E.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(s,E.maxTimeToFirstByteMs)})}}var I=E.errorRetry||E.timeoutRetry||{},l={loadPolicy:E,timeout:E.maxLoadTimeMs,maxRetry:I.maxNumRetry||0,retryDelay:I.retryDelayMs||0,maxRetryDelay:I.maxRetryDelayMs||0},A={onSuccess:function(e,t,E,a){var o=i.getInternalLoader(E);i.resetInternalLoader(E.type);var _=e.data;0===_.indexOf("#EXTM3U")?(t.parsing.start=performance.now(),Vt.isMediaPlaylist(_)?i.handleTrackOrLevelPlaylist(e,t,E,a||null,o):i.handleMasterPlaylist(e,t,E,a)):i.handleManifestParsingError(e,E,new Error("no EXTM3U delimiter"),a||null,t)},onError:function(e,t,E,a){i.handleNetworkError(t,E,!1,e,a)},onTimeout:function(e,t,E){i.handleNetworkError(t,E,!0,void 0,e)}};_.load(e,l,A)},t.handleMasterPlaylist=function(e,t,E,a){var i=this.hls,o=e.data,_=Jt(e,E),n=Vt.parseMasterPlaylist(o,_);if(n.playlistParsingError)this.handleManifestParsingError(e,E,n.playlistParsingError,a,t);else{var r=n.contentSteering,S=n.levels,T=n.sessionData,s=n.sessionKeys,I=n.startTimeOffset,l=n.variableList;this.variableList=l;var A=Vt.parseMasterPlaylistMedia(o,_,n),O=A.AUDIO,u=void 0===O?[]:O,R=A.SUBTITLES,N=A["CLOSED-CAPTIONS"];u.length&&(u.some(function(e){return!e.url})||!S[0].audioCodec||S[0].attrs.AUDIO||(y.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),u.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new F({}),bitrate:0,url:""}))),i.trigger(B.MANIFEST_LOADED,{levels:S,audioTracks:u,subtitles:R,captions:N,contentSteering:r,url:_,stats:t,networkDetails:a,sessionData:T,sessionKeys:s,startTimeOffset:I,variableList:l})}},t.handleTrackOrLevelPlaylist=function(e,t,E,a,i){var o=this.hls,_=E.id,n=E.level,r=E.type,S=Jt(e,E),T=0,s=C(n)?n:C(_)?_:0,I=qt(E),l=Vt.parseLevelPlaylist(e.data,S,s,I,T,this.variableList);if(r===Xt.MANIFEST){var A={attrs:new F({}),bitrate:0,details:l,name:"",url:S};o.trigger(B.MANIFEST_LOADED,{levels:[A],audioTracks:[],url:S,stats:t,networkDetails:a,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),E.levelDetails=l,this.handlePlaylistLoaded(l,e,t,E,a,i)},t.handleManifestParsingError=function(e,t,E,a,i){this.hls.trigger(B.ERROR,{type:h.NETWORK_ERROR,details:f.MANIFEST_PARSING_ERROR,fatal:t.type===Xt.MANIFEST,url:e.url,err:E,error:E,reason:E.message,response:e,context:t,networkDetails:a,stats:i})},t.handleNetworkError=function(e,t,E,i,o){void 0===E&&(E=!1);var _="A network "+(E?"timeout":"error"+(i?" (status "+i.code+")":""))+" occurred while loading "+e.type;e.type===Xt.LEVEL?_+=": "+e.level+" id: "+e.id:e.type!==Xt.AUDIO_TRACK&&e.type!==Xt.SUBTITLE_TRACK||(_+=" id: "+e.id+' group-id: "'+e.groupId+'"');var n=new Error(_);y.warn("[playlist-loader]: "+_);var r=f.UNKNOWN,S=!1,T=this.getInternalLoader(e);switch(e.type){case Xt.MANIFEST:r=E?f.MANIFEST_LOAD_TIMEOUT:f.MANIFEST_LOAD_ERROR,S=!0;break;case Xt.LEVEL:r=E?f.LEVEL_LOAD_TIMEOUT:f.LEVEL_LOAD_ERROR,S=!1;break;case Xt.AUDIO_TRACK:r=E?f.AUDIO_TRACK_LOAD_TIMEOUT:f.AUDIO_TRACK_LOAD_ERROR,S=!1;break;case Xt.SUBTITLE_TRACK:r=E?f.SUBTITLE_TRACK_LOAD_TIMEOUT:f.SUBTITLE_LOAD_ERROR,S=!1}T&&this.resetInternalLoader(e.type);var s={type:h.NETWORK_ERROR,details:r,fatal:S,url:e.url,loader:T,context:e,error:n,networkDetails:t,stats:o};if(i){var I=(null==t?void 0:t.url)||e.url;s.response=a({url:I,data:void 0},i)}this.hls.trigger(B.ERROR,s)},t.handlePlaylistLoaded=function(e,t,E,a,i,o){var _=this.hls,n=a.type,r=a.level,S=a.id,T=a.groupId,s=a.deliveryDirectives,I=Jt(t,a),l=qt(a),A="number"==typeof a.level&&l===$t.MAIN?r:void 0;if(e.fragments.length){e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));var O=e.playlistParsingError;if(O)_.trigger(B.ERROR,{type:h.NETWORK_ERROR,details:f.LEVEL_PARSING_ERROR,fatal:!1,url:I,error:O,reason:O.message,response:t,context:a,level:A,parent:l,networkDetails:i,stats:E});else switch(e.live&&o&&(o.getCacheAge&&(e.ageHeader=o.getCacheAge()||0),o.getCacheAge&&!isNaN(e.ageHeader)||(e.ageHeader=0)),n){case Xt.MANIFEST:case Xt.LEVEL:_.trigger(B.LEVEL_LOADED,{details:e,level:A||0,id:S||0,stats:E,networkDetails:i,deliveryDirectives:s});break;case Xt.AUDIO_TRACK:_.trigger(B.AUDIO_TRACK_LOADED,{details:e,id:S||0,groupId:T||"",stats:E,networkDetails:i,deliveryDirectives:s});break;case Xt.SUBTITLE_TRACK:_.trigger(B.SUBTITLE_TRACK_LOADED,{details:e,id:S||0,groupId:T||"",stats:E,networkDetails:i,deliveryDirectives:s})}}else{var u=new Error("No Segments found in Playlist");_.trigger(B.ERROR,{type:h.NETWORK_ERROR,details:f.LEVEL_EMPTY_ERROR,fatal:!1,url:I,error:u,reason:u.message,response:t,context:a,level:A,parent:l,networkDetails:i,stats:E})}},e})();function eE(e,t){var E;try{E=new Event("addtrack")}catch(e){(E=document.createEvent("Event")).initEvent("addtrack",!1,!1)}E.track=e,t.dispatchEvent(E)}function tE(e,t){var E=e.mode;if("disabled"===E&&(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(E){y.debug("[texttrack-utils]: "+E);try{var a=new self.TextTrackCue(t.startTime,t.endTime,t.text);a.id=t.id,e.addCue(a)}catch(e){y.debug("[texttrack-utils]: Legacy TextTrackCue fallback failed: "+e)}}"disabled"===E&&(e.mode=E)}function EE(e){var t=e.mode;if("disabled"===t&&(e.mode="hidden"),e.cues)for(var E=e.cues.length;E--;)e.removeCue(e.cues[E]);"disabled"===t&&(e.mode=t)}function aE(e,t,E,a){var i=e.mode;if("disabled"===i&&(e.mode="hidden"),e.cues&&e.cues.length>0)for(var o=oE(e.cues,t,E),_=0;_e[E].endTime)return-1;for(var a=0,i=E;a<=i;){var o=Math.floor((i+a)/2);if(te[o].startTime&&a-1)for(var o=i,_=e.length;o<_;o++){var n=e[o];if(n.startTime>=t&&n.endTime<=E)a.push(n);else if(n.startTime>E)return a}return a}function _E(e){for(var t=[],E=0;EsE&&(s=sE),s-T<=0&&(s=T+rE);for(var I=0;It.startDate&&(!e||t.startDate.05&&this.forwardBufferLength>1){var r=Math.min(2,Math.max(1,o)),S=Math.round(2/(1+Math.exp(-.75*n-this.edgeStalled))*20)/20;e.playbackRate=Math.min(r,Math.max(1,S))}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},n(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,E=e.partHoldBack,a=e.targetduration,i=this.config,o=i.liveSyncDuration,_=i.liveSyncDurationCount,n=i.lowLatencyMode,r=this.hls.userConfig,S=n&&E||t;(r.liveSyncDuration||r.liveSyncDurationCount||0===S)&&(S=void 0!==o?o:_*a);var T=a,s=1;return S+Math.min(this.stallCount*s,T)}},{key:"liveSyncPosition",get:function(){var e=this.estimateLiveEdge(),t=this.targetLatency,E=this.levelDetails;if(null===e||null===t||null===E)return null;var a=E.edge,i=e-t-this.edgeStalled,o=a-E.totalduration,_=a-(this.config.lowLatencyMode&&E.partTarget||E.targetduration);return Math.min(Math.max(o,i),_)}},{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 E=e.buffered.length;return(E?e.buffered.end(E-1):t.edge)-this.currentTime}}]),e})(),uE=["NONE","TYPE-0","TYPE-1",null];function RE(e){return uE.indexOf(e)>-1}var NE=["SDR","PQ","HLG"];function dE(e){return!!e&&NE.indexOf(e)>-1}var cE={No:"",Yes:"YES",v2:"v2"};function LE(e,t){var E=e.canSkipUntil,a=e.canSkipDateRanges,i=e.endSN;return E&&(void 0!==t?t-i:0)e.sn?(i=E-e.start,a=e):(i=e.start-E,a=t),a.duration!==i&&(a.duration=i)}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 PE(e,t,E,a,i,o){a-E<=0&&(y.warn("Fragment should have a positive duration",t),a=E+t.duration,o=i+t.duration);var _=E,n=a,r=t.startPTS,S=t.endPTS;if(C(r)){var T=Math.abs(r-E);C(t.deltaPTS)?t.deltaPTS=Math.max(T,t.deltaPTS):t.deltaPTS=T,_=Math.max(E,r),E=Math.min(E,r),i=Math.min(i,t.startDTS),n=Math.min(a,S),a=Math.max(a,S),o=Math.max(o,t.endDTS)}var s=E-t.start;0!==t.start&&(t.start=E),t.duration=a-t.start,t.startPTS=E,t.maxStartPTS=_,t.startDTS=i,t.endPTS=a,t.minEndPTS=n,t.endDTS=o;var I,l=t.sn;if(!e||le.endSN)return 0;var A=l-e.startSN,O=e.fragments;for(O[A]=t,I=A;I>0;I--)pE(O[I],O[I-1]);for(I=A;I=0;i--){var o=a[i].initSegment;if(o){E=o;break}}e.fragmentHint&&delete e.fragmentHint.endPTS;var _,n=0;if(WE(e,t,function(e,a){e.relurl&&(n=e.cc-a.cc),C(e.startPTS)&&C(e.endPTS)&&(a.start=a.startPTS=e.startPTS,a.startDTS=e.startDTS,a.maxStartPTS=e.maxStartPTS,a.endPTS=e.endPTS,a.endDTS=e.endDTS,a.minEndPTS=e.minEndPTS,a.duration=e.endPTS-e.startPTS,a.duration&&(_=a),t.PTSKnown=t.alignedSliding=!0),a.elementaryStreams=e.elementaryStreams,a.loader=e.loader,a.stats=e.stats,e.initSegment&&(a.initSegment=e.initSegment,E=e.initSegment)}),E&&(t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments).forEach(function(e){var t;!e||e.initSegment&&e.initSegment.relurl!==(null==(t=E)?void 0:t.relurl)||(e.initSegment=E)}),t.skippedSegments)if(t.deltaUpdateFailed=t.fragments.some(function(e){return!e}),t.deltaUpdateFailed){y.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var r=t.skippedSegments;r--;)t.fragments.shift();t.startSN=t.fragments[0].sn,t.startCC=t.fragments[0].cc}else t.canSkipDateRanges&&(t.dateRanges=hE(e.dateRanges,t.dateRanges,t.recentlyRemovedDateranges));var S=t.fragments;if(n){y.warn("discontinuity sliding from playlist, take drift into account");for(var T=0;T=a.length||ME(t,a[E].start)}function ME(e,t){if(t){for(var E=e.fragments,a=e.skippedSegments;at){var o=1e3*a[a.length-1].duration;o499)}var KE={search:function(e,t){for(var E=0,a=e.length-1,i=null,o=null;E<=a;){var _=t(o=e[i=(E+a)/2|0]);if(_>0)E=i+1;else{if(!(_<0))return o;a=i-1}}return null}};function zE(e,t,E){if(null===t||!Array.isArray(e)||!e.length||!C(t))return null;if(t<(e[0].programDateTime||0))return null;if(t>=(e[e.length-1].endProgramDateTime||0))return null;E=E||0;for(var a=0;a0&&o<15e-7&&(E+=15e-7)}else 0===E&&0===t[0].start&&(i=t[0]);if(i&&(!e||e.level===i.level)&&0===xE(E,a,i))return i;var _=KE.search(t,xE.bind(null,E,a));return!_||_===e&&i?i:_}function xE(e,t,E){if(void 0===e&&(e=0),void 0===t&&(t=0),E.start<=e&&E.start+E.duration>e)return 0;var a=Math.min(t,E.duration+(E.deltaPTS?E.deltaPTS:0));return E.start+E.duration-a<=e?1:E.start-a>e&&E.start?-1:0}function QE(e,t,E){var a=1e3*Math.min(t,E.duration+(E.deltaPTS?E.deltaPTS:0));return(E.endProgramDateTime||0)-a>e}function XE(e,t){return KE.search(e,function(e){return e.cct?-1:0})}var $E={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},qE={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,SwitchToSDR:4},JE=(function(){function e(e){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=e,this.log=y.log.bind(y,"[info]:"),this.warn=y.warn.bind(y,"[warning]:"),this.error=y.error.bind(y,"[error]:"),this.registerListeners()}var t=e.prototype;return t.registerListeners=function(){var e=this.hls;e.on(B.ERROR,this.onError,this),e.on(B.MANIFEST_LOADING,this.onManifestLoading,this),e.on(B.LEVEL_UPDATED,this.onLevelUpdated,this)},t.unregisterListeners=function(){var e=this.hls;e&&(e.off(B.ERROR,this.onError,this),e.off(B.ERROR,this.onErrorOut,this),e.off(B.MANIFEST_LOADING,this.onManifestLoading,this),e.off(B.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 E,a;if(!t.fatal){var i=this.hls,o=t.context;switch(t.details){case f.FRAG_LOAD_ERROR:case f.FRAG_LOAD_TIMEOUT:case f.KEY_LOAD_ERROR:case f.KEY_LOAD_TIMEOUT:return void(t.errorAction=this.getFragRetryOrSwitchAction(t));case f.FRAG_PARSING_ERROR:if(null!=(E=t.frag)&&E.gap)return void(t.errorAction={action:$E.DoNothing,flags:qE.None});case f.FRAG_GAP:case f.FRAG_DECRYPT_ERROR:return t.errorAction=this.getFragRetryOrSwitchAction(t),void(t.errorAction.action=$E.SendAlternateToPenaltyBox);case f.LEVEL_EMPTY_ERROR:case f.LEVEL_PARSING_ERROR:var _,n,r=t.parent===$t.MAIN?t.level:i.loadLevel;return void(t.details===f.LEVEL_EMPTY_ERROR&&null!=(_=t.context)&&null!=(n=_.levelDetails)&&n.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,r):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,r)));case f.LEVEL_LOAD_ERROR:case f.LEVEL_LOAD_TIMEOUT:return void("number"==typeof(null==o?void 0:o.level)&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,o.level)));case f.AUDIO_TRACK_LOAD_ERROR:case f.AUDIO_TRACK_LOAD_TIMEOUT:case f.SUBTITLE_LOAD_ERROR:case f.SUBTITLE_TRACK_LOAD_TIMEOUT:if(o){var S=i.levels[i.loadLevel];if(S&&(o.type===Xt.AUDIO_TRACK&&S.hasAudioGroup(o.groupId)||o.type===Xt.SUBTITLE_TRACK&&S.hasSubtitleGroup(o.groupId)))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,i.loadLevel),t.errorAction.action=$E.SendAlternateToPenaltyBox,void(t.errorAction.flags=qE.MoveAllAlternatesMatchingHost)}return;case f.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:var T=i.levels[i.loadLevel],s=null==T?void 0:T.attrs["HDCP-LEVEL"];return void(s?t.errorAction={action:$E.SendAlternateToPenaltyBox,flags:qE.MoveAllAlternatesMatchingHDCP,hdcpLevel:s}:this.keySystemError(t));case f.BUFFER_ADD_CODEC_ERROR:case f.REMUX_ALLOC_ERROR:case f.BUFFER_APPEND_ERROR:return void(t.errorAction=this.getLevelSwitchAction(t,null!=(a=t.level)?a:i.loadLevel));case f.INTERNAL_EXCEPTION:case f.BUFFER_APPENDING_ERROR:case f.BUFFER_FULL_ERROR:case f.LEVEL_SWITCH_ERROR:case f.BUFFER_STALLED_ERROR:case f.BUFFER_SEEK_OVER_HOLE:case f.BUFFER_NUDGE_ON_STALL:return void(t.errorAction={action:$E.DoNothing,flags:qE.None})}t.type===h.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 E=FE(this.hls.config.playlistLoadPolicy,e),a=this.playlistError++;if(YE(E,a,kE(e),e.response))return{action:$E.RetryRequest,flags:qE.None,retryConfig:E,retryCount:a};var i=this.getLevelSwitchAction(e,t);return E&&(i.retryConfig=E,i.retryCount=a),i},t.getFragRetryOrSwitchAction=function(e){var t=this.hls,E=this.getVariantLevelIndex(e.frag),a=t.levels[E],i=t.config,o=i.fragLoadPolicy,_=i.keyLoadPolicy,n=FE(e.details.startsWith("key")?_:o,e),r=t.levels.reduce(function(e,t){return e+t.fragmentError},0);if(a&&(e.details!==f.FRAG_GAP&&a.fragmentError++,YE(n,r,kE(e),e.response)))return{action:$E.RetryRequest,flags:qE.None,retryConfig:n,retryCount:r};var S=this.getLevelSwitchAction(e,E);return n&&(S.retryConfig=n,S.retryCount=r),S},t.getLevelSwitchAction=function(e,t){var E=this.hls;null==t&&(t=E.loadLevel);var a=this.hls.levels[t];if(a){var i,o,_=e.details;a.loadError++,_===f.BUFFER_APPEND_ERROR&&a.fragmentError++;var n=-1,r=E.levels,S=E.loadLevel,T=E.minAutoLevel,s=E.maxAutoLevel;E.autoLevelEnabled||(E.loadLevel=-1);for(var I,l=null==(i=e.frag)?void 0:i.type,A=(l===$t.AUDIO&&_===f.FRAG_PARSING_ERROR||"audio"===e.sourceBufferName&&(_===f.BUFFER_ADD_CODEC_ERROR||_===f.BUFFER_APPEND_ERROR))&&r.some(function(e){var t=e.audioCodec;return a.audioCodec!==t}),O="video"===e.sourceBufferName&&(_===f.BUFFER_ADD_CODEC_ERROR||_===f.BUFFER_APPEND_ERROR)&&r.some(function(e){var t=e.codecSet,E=e.audioCodec;return a.codecSet!==t&&a.audioCodec===E}),u=null!=(o=e.context)?o:{},R=u.type,N=u.groupId,d=function(){var t=(c+S)%r.length;if(t!==S&&t>=T&&t<=s&&0===r[t].loadError){var E,i,o=r[t];if(_===f.FRAG_GAP&&e.frag){var I=r[t].details;if(I){var u=jE(e.frag,I.fragments,e.frag.start);if(null!=u&&u.gap)return 0}}else{if(R===Xt.AUDIO_TRACK&&o.hasAudioGroup(N)||R===Xt.SUBTITLE_TRACK&&o.hasSubtitleGroup(N))return 0;if(l===$t.AUDIO&&null!=(E=a.audioGroups)&&E.some(function(e){return o.hasAudioGroup(e)})||l===$t.SUBTITLE&&null!=(i=a.subtitleGroups)&&i.some(function(e){return o.hasSubtitleGroup(e)})||A&&a.audioCodec===o.audioCodec||!A&&a.audioCodec!==o.audioCodec||O&&a.codecSet===o.codecSet)return 0}return n=t,1}},c=r.length;c--&&(0===(I=d())||1!==I););if(n>-1&&E.loadLevel!==n)return e.levelRetry=!0,this.playlistError=0,{action:$E.SendAlternateToPenaltyBox,flags:qE.None,nextAutoLevel:n}}return{action:$E.SendAlternateToPenaltyBox,flags:qE.MoveAllAlternatesMatchingHost}},t.onErrorOut=function(e,t){var E;switch(null==(E=t.errorAction)?void 0:E.action){case $E.DoNothing:break;case $E.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===f.FRAG_GAP?/MediaSource readyState: ended/.test(t.error.message)&&(this.warn('MediaSource ended after "'+t.sourceBufferName+'" sourceBuffer append error. Attempting to recover from media error.'),this.hls.recoverMediaError()):t.fatal=!0}t.fatal&&this.hls.stopLoad()},t.sendAlternateToPenaltyBox=function(e){var t=this.hls,E=e.errorAction;if(E){var a=E.flags,i=E.hdcpLevel,o=E.nextAutoLevel;switch(a){case qE.None:this.switchLevel(e,o);break;case qE.MoveAllAlternatesMatchingHDCP:i&&(t.maxHdcpLevel=uE[uE.indexOf(i)-1],E.resolved=!0),this.warn('Restricting playback to HDCP-LEVEL of "'+t.maxHdcpLevel+'" or lower')}E.resolved||this.switchLevel(e,o)}},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})(),ZE=(function(){function e(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=y.log.bind(y,t+":"),this.warn=y.warn.bind(y,t+":"),this.hls=e}var t=e.prototype;return t.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},t.clearTimer=function(){-1!==this.timer&&(self.clearTimeout(this.timer),this.timer=-1)},t.startLoad=function(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()},t.stopLoad=function(){this.canLoad=!1,this.clearTimer()},t.switchParams=function(e,t){var E=null==t?void 0:t.renditionReports;if(E){for(var a=-1,i=0;i=0&&T>t.partTarget&&(S+=1)}return new mE(r,S>=0?S:void 0,cE.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,E){var a=this,i=t.details,o=t.stats,_=self.performance.now(),n=o.loading.first?Math.max(0,_-o.loading.first):0;if(i.advancedDateTime=Date.now()-n,i.live||null!=E&&E.live){if(i.reloaded(E),E&&this.log("live playlist "+e+" "+(i.advanced?"REFRESHED "+i.lastPartSn+"-"+i.lastPartIndex:i.updated?"UPDATED":"MISSED")),E&&i.fragments.length>0&&BE(E,i),!this.canLoad||!i.live)return;var r,S=void 0,T=void 0;if(i.canBlockReload&&i.endSN&&i.advanced){var s=this.hls.config.lowLatencyMode,I=i.lastPartSn,l=i.endSN,A=i.lastPartIndex,O=I===l;-1!==A?(S=O?l+1:I,T=O?s?0:A:A+1):S=l+1;var u=i.age,R=u+i.ageHeader,N=Math.min(R-i.partTarget,1.5*i.targetduration);if(N>0){if(E&&N>E.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+E.tuneInGoal+" to: "+N+" with playlist age: "+i.age),N=0;else{var d=Math.floor(N/i.targetduration);S+=d,void 0!==T&&(T+=Math.round(N%i.targetduration/i.partTarget)),this.log("CDN Tune-in age: "+i.ageHeader+"s last advanced "+u.toFixed(2)+"s goal: "+N+" skip sn "+d+" to part "+T)}i.tuneInGoal=N}if(r=this.getDeliveryDirectives(i,t.deliveryDirectives,S,T),s||!O)return void this.loadPlaylist(r)}else(i.canBlockReload||i.canSkipUntil)&&(r=this.getDeliveryDirectives(i,t.deliveryDirectives,S,T));var c=this.hls.mainForwardBufferInfo,L=c?c.end-c.len:0,m=vE(i,1e3*(i.edge-L));i.updated&&_>this.requestScheduled+m&&(this.requestScheduled=o.loading.start),void 0!==S&&i.canBlockReload?this.requestScheduled=o.loading.first+m-(1e3*i.partTarget||1e3):-1===this.requestScheduled||this.requestScheduled+m<_?this.requestScheduled=_:this.requestScheduled-_<=0&&(this.requestScheduled+=m);var D=this.requestScheduled-_;D=Math.max(0,D),this.log("reload live playlist "+e+" in "+Math.round(D)+" ms"),this.timer=self.setTimeout(function(){return a.loadPlaylist(r)},D)}else this.clearTimer()},t.getDeliveryDirectives=function(e,t,E,a){var i=LE(e,E);return null!=t&&t.skip&&e.deltaUpdateFailed&&(E=t.msn,a=t.part,i=cE.No),new mE(E,a,i)},t.checkRetry=function(e){var t=this,E=e.details,a=kE(e),i=e.errorAction,o=i||{},_=o.action,n=o.retryCount,r=void 0===n?0:n,S=o.retryConfig,T=!!i&&!!S&&(_===$E.RetryRequest||!i.resolved&&_===$E.SendAlternateToPenaltyBox);if(T){var s;if(this.requestScheduled=-1,r>=S.maxNumRetry)return!1;if(a&&null!=(s=e.context)&&s.deliveryDirectives)this.warn("Retrying playlist loading "+(r+1)+"/"+S.maxNumRetry+' after "'+E+'" without delivery-directives'),this.loadPlaylist();else{var I=VE(S,r);this.timer=self.setTimeout(function(){return t.loadPlaylist()},I),this.warn("Retrying playlist loading "+(r+1)+"/"+S.maxNumRetry+' after "'+E+'" in '+I+"ms")}e.levelRetry=!0,i.resolved=!0}return T},e})(),ea=(function(){function e(e,t,E){void 0===t&&(t=0),void 0===E&&(E=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_=E}var t=e.prototype;return t.sample=function(e,t){var E=Math.pow(this.alpha_,e);this.estimate_=t*(1-E)+E*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})(),ta=(function(){function e(e,t,E,a){void 0===a&&(a=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_=E,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new ea(e),this.fast_=new ea(t),this.defaultTTFB_=a,this.ttfb_=new ea(e)}var t=e.prototype;return t.update=function(e,t){var E=this.slow_,a=this.fast_,i=this.ttfb_;E.halfLife!==e&&(this.slow_=new ea(e,E.getEstimate(),E.getTotalWeight())),a.halfLife!==t&&(this.fast_=new ea(t,a.getEstimate(),a.getTotalWeight())),i.halfLife!==e&&(this.ttfb_=new ea(e,i.getEstimate(),i.getTotalWeight()))},t.sample=function(e,t){var E=(e=Math.max(e,this.minDelayMs_))/1e3,a=8*t/E;this.fast_.sample(E,a),this.slow_.sample(E,a)},t.sampleTTFB=function(e){var t=e/1e3,E=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(E,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})(),Ea={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},aa={};function ia(e,t,E,a,i,o){var _=e.audioCodec?e.audioGroups:null,n=null==o?void 0:o.audioCodec,r=null==o?void 0:o.channels,S=r?parseInt(r):n?1/0:2,T=null;if(null!=_&&_.length)try{T=1===_.length&&_[0]?t.groups[_[0]].channels:_.reduce(function(e,E){if(E){var a=t.groups[E];if(!a)throw new Error("Audio track group "+E+" not found");Object.keys(a.channels).forEach(function(t){e[t]=(e[t]||0)+a.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(a,30)||"SDR"!==e.videoRange&&e.videoRange!==E||e.bitrate>Math.max(i,8e6))||!!T&&C(S)&&Object.keys(T).some(function(e){return parseInt(e)>S})}function oa(e,t,E){var i=e.videoCodec,o=e.audioCodec;if(!i||!o||!E)return Promise.resolve(Ea);var _={width:e.width,height:e.height,bitrate:Math.ceil(Math.max(.9*e.bitrate,e.averageBitrate)),framerate:e.frameRate||30},n=e.videoRange;"SDR"!==n&&(_.transferFunction=n.toLowerCase());var r=i.split(",").map(function(e){return{type:"media-source",video:a(a({},_),{},{contentType:Pt(e,"video")})}});return o&&e.audioGroups&&e.audioGroups.forEach(function(e){var E;e&&(null==(E=t.groups[e])||E.tracks.forEach(function(t){if(t.groupId===e){var E=t.channels||"",a=parseFloat(E);C(a)&&a>2&&r.push.apply(r,o.split(",").map(function(e){return{type:"media-source",audio:{contentType:Pt(e,"audio"),channels:""+a}}}))}}))}),Promise.all(r.map(function(e){var t=_a(e);return aa[t]||(aa[t]=E.decodingInfo(e))})).then(function(e){return{supported:!e.some(function(e){return!e.supported}),configurations:r,decodingInfoResults:e}}).catch(function(e){return{supported:!1,configurations:r,decodingInfoResults:[],error:e}})}function _a(e){var t=e.audio,E=e.video,a=E||t;if(a){var i=a.contentType.split('"')[1];if(E)return"r"+E.height+"x"+E.width+"f"+Math.ceil(E.framerate)+(E.transferFunction||"sd")+"_"+i+"_"+Math.ceil(E.bitrate/1e5);if(t)return"c"+t.channels+(t.spatialRendering?"s":"n")+"_"+i}return""}function na(){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 ra(e,t){var E=!1,a=[];return e&&(E="SDR"!==e,a=[e]),t&&(a=t.allowedVideoRanges||NE.slice(0),a=(E=void 0!==t.preferHDR?t.preferHDR:na())?a.filter(function(e){return"SDR"!==e}):["SDR"]),{preferHDR:E,allowedVideoRanges:a}}function Sa(e,t,E,a,i){for(var o=Object.keys(e),_=null==a?void 0:a.channels,n=null==a?void 0:a.audioCodec,r=_&&2===parseInt(_),S=!0,T=!1,s=1/0,I=1/0,l=1/0,A=0,O=[],u=ra(t,i),R=u.preferHDR,N=u.allowedVideoRanges,d=function(){var t=e[o[c]];S=t.channels[2]>0,s=Math.min(s,t.minHeight),I=Math.min(I,t.minFramerate),l=Math.min(l,t.minBitrate);var E=N.filter(function(e){return t.videoRanges[e]>0});E.length>0&&(T=!0,O=E)},c=o.length;c--;)d();s=C(s)?s:0,I=C(I)?I:0;var L=Math.max(1080,s),m=Math.max(30,I);return l=C(l)?l:E,E=Math.max(l,E),T||(t=void 0,O=[]),{codecSet:o.reduce(function(t,a){var i=e[a];if(a===t)return t;if(i.minBitrate>E)return Ta(a,"min bitrate of "+i.minBitrate+" > current estimate of "+E),t;if(!i.hasDefaultAudio)return Ta(a,"no renditions with default or auto-select sound found"),t;if(n&&a.indexOf(n.substring(0,4))%5!=0)return Ta(a,'audio codec preference "'+n+'" not found'),t;if(_&&!r){if(!i.channels[_])return Ta(a,"no renditions with "+_+" channel sound found (channels options: "+Object.keys(i.channels)+")"),t}else if((!n||r)&&S&&0===i.channels[2])return Ta(a,"no renditions with stereo sound found"),t;return i.minHeight>L?(Ta(a,"min resolution of "+i.minHeight+" > maximum of "+L),t):i.minFramerate>m?(Ta(a,"min framerate of "+i.minFramerate+" > maximum of "+m),t):O.some(function(e){return i.videoRanges[e]>0})?i.maxScore=ht(t)||i.fragmentError>e[t].fragmentError)?t:(A=i.maxScore,a):(Ta(a,"no variants with VIDEO-RANGE of "+JSON.stringify(O)+" found"),t)},void 0),videoRanges:O,preferHDR:R,minFramerate:I,minBitrate:l}}function Ta(e,t){y.log('[abr] start candidates with "'+e+'" ignored because '+t)}function sa(e){return e.reduce(function(e,t){var E=e.groups[t.groupId];E||(E=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),E.tracks.push(t);var a=t.channels||"2";return E.channels[a]=(E.channels[a]||0)+1,E.hasDefault=E.hasDefault||t.default,E.hasAutoSelect=E.hasAutoSelect||t.autoselect,E.hasDefault&&(e.hasDefaultAudio=!0),E.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function Ia(e,t,E,a){return e.slice(E,a+1).reduce(function(e,E){if(!E.codecSet)return e;var a=E.audioGroups,i=e[E.codecSet];i||(e[E.codecSet]=i={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!a,fragmentError:0}),i.minBitrate=Math.min(i.minBitrate,E.bitrate);var o=Math.min(E.height,E.width);return i.minHeight=Math.min(i.minHeight,o),i.minFramerate=Math.min(i.minFramerate,E.frameRate),i.maxScore=Math.max(i.maxScore,E.score),i.fragmentError+=E.fragmentError,i.videoRanges[E.videoRange]=(i.videoRanges[E.videoRange]||0)+1,a&&a.forEach(function(e){if(e){var E=t.groups[e];i.hasDefaultAudio=i.hasDefaultAudio||t.hasDefaultAudio?E.hasDefault:E.hasAutoSelect||!t.hasDefaultAudio&&!t.hasAutoSelectAudio,Object.keys(E.channels).forEach(function(e){i.channels[e]=(i.channels[e]||0)+E.channels[e]})}}),e},{})}function la(e,t,E){if("attrs"in e){var a=t.indexOf(e);if(-1!==a)return a}for(var i=0;i1&&(a=Math.max.apply(Math,_));var n=o.videoRange,r=o.frameRate,S=o.codecSet.substring(0,4),T=Na(t,a,function(t){if(t.videoRange!==n||t.frameRate!==r||t.codecSet.substring(0,4)!==S)return!1;var a=t.audioGroups,o=E.filter(function(e){return!a||-1!==a.indexOf(e.groupId)});return la(e,o,i)>-1});return T>-1?T:Na(t,a,function(t){var a=t.audioGroups,o=E.filter(function(e){return!a||-1!==a.indexOf(e.groupId)});return la(e,o,i)>-1})}function Na(e,t,E){for(var a=t;a;a--)if(E(e[a]))return a;for(var i=t+1;i-1,R=t.getBwEstimate(),N=a.levels,d=N[e.level],c=n.total||Math.max(n.loaded,Math.round(r*d.averageBitrate/8)),L=u?S-O:S;L<1&&u&&(L=Math.min(S,8*n.loaded/R));var m=u?1e3*n.loaded/L:0,D=m?(c-n.loaded)/m:8*c/R+I/1e3;if(!(D<=A)){var p,P=m?8*m:R,h=Number.POSITIVE_INFINITY;for(p=e.level-1;p>T;p--){var f=N[p].maxBitrate;if((h=t.getTimeToLoadFrag(I/1e3,P,r*f,!N[p].details))=D||h>10*r)){a.nextLoadLevel=a.nextAutoLevel=p,u?t.bwEstimator.sample(S-Math.min(I,O),n.loaded):t.bwEstimator.sampleTTFB(S);var W=N[p].maxBitrate;t.getBwEstimate()*t.hls.config.abrBandWidthUpFactor>W&&t.resetEstimator(W),t.clearTimer(),y.warn("[abr] Fragment "+e.sn+(E?" part "+E.index:"")+" of level "+e.level+" is loading too slowly;\n Time to underbuffer: "+A.toFixed(3)+" s\n Estimated load time for current fragment: "+D.toFixed(3)+" s\n Estimated load time for down switch fragment: "+h.toFixed(3)+" s\n TTFB estimate: "+(0|O)+" ms\n Current BW estimate: "+(C(R)?0|R:"Unknown")+" bps\n New BW estimate: "+(0|t.getBwEstimate())+" bps\n Switching to level "+p+" @ "+(0|W)+" bps"),a.trigger(B.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e,part:E,stats:n})}}}}}}},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}var t=e.prototype;return t.resetEstimator=function(e){e&&(y.log("setting initial bwe to "+e),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()},t.initEstimator=function(){var e=this.hls.config;return new ta(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)},t.registerListeners=function(){var e=this.hls;e.on(B.MANIFEST_LOADING,this.onManifestLoading,this),e.on(B.FRAG_LOADING,this.onFragLoading,this),e.on(B.FRAG_LOADED,this.onFragLoaded,this),e.on(B.FRAG_BUFFERED,this.onFragBuffered,this),e.on(B.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(B.LEVEL_LOADED,this.onLevelLoaded,this),e.on(B.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(B.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(B.ERROR,this.onError,this)},t.unregisterListeners=function(){var e=this.hls;e&&(e.off(B.MANIFEST_LOADING,this.onManifestLoading,this),e.off(B.FRAG_LOADING,this.onFragLoading,this),e.off(B.FRAG_LOADED,this.onFragLoaded,this),e.off(B.FRAG_BUFFERED,this.onFragBuffered,this),e.off(B.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(B.LEVEL_LOADED,this.onLevelLoaded,this),e.off(B.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(B.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(B.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 E,a=t.frag;this.ignoreFragment(a)||(a.bitrateTest||(this.fragCurrent=a,this.partCurrent=null!=(E=t.part)?E:null),this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100))},t.onLevelSwitching=function(e,t){this.clearTimer()},t.onError=function(e,t){if(!t.fatal)switch(t.details){case f.BUFFER_ADD_CODEC_ERROR:case f.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case f.FRAG_LOAD_TIMEOUT:var E=t.frag,a=this.fragCurrent,i=this.partCurrent;if(E&&a&&E.sn===a.sn&&E.level===a.level){var o=performance.now(),_=i?i.stats:E.stats,n=o-_.loading.start,r=_.loading.first?_.loading.first-_.loading.start:-1;if(_.loaded&&r>-1){var S=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(n-Math.min(S,r),_.loaded)}else this.bwEstimator.sampleTTFB(n)}}},t.getTimeToLoadFrag=function(e,t,E,a){return e+E/t+(a?this.lastLevelLoadSec:0)},t.onLevelLoaded=function(e,t){var E=this.hls.config,a=t.stats.loading,i=a.end-a.start;C(i)&&(this.lastLevelLoadSec=i/1e3),t.details.live?this.bwEstimator.update(E.abrEwmaSlowLive,E.abrEwmaFastLive):this.bwEstimator.update(E.abrEwmaSlowVoD,E.abrEwmaFastVoD)},t.onFragLoaded=function(e,t){var E=t.frag,a=t.part,i=a?a.stats:E.stats;if(E.type===$t.MAIN&&this.bwEstimator.sampleTTFB(i.loading.first-i.loading.start),!this.ignoreFragment(E)){if(this.clearTimer(),E.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){var o=a?a.duration:E.duration,_=this.hls.levels[E.level],n=(_.loaded?_.loaded.bytes:0)+i.loaded,r=(_.loaded?_.loaded.duration:0)+o;_.loaded={bytes:n,duration:r},_.realBitrate=Math.round(8*n/r)}if(E.bitrateTest){var S={stats:i,frag:E,part:a,id:E.type};this.onFragBuffered(B.FRAG_BUFFERED,S),E.bitrateTest=!1}else this.lastLoadedFragLevel=E.level}},t.onFragBuffered=function(e,t){var E=t.frag,a=t.part,i=null!=a&&a.stats.loaded?a.stats:E.stats;if(!i.aborted&&!this.ignoreFragment(E)){var o=i.parsing.end-i.loading.start-Math.min(i.loading.first-i.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(o,i.loaded),i.bwEstimate=this.getBwEstimate(),E.bitrateTest?this.bitrateTestDelay=o/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,E=this.hls,a=E.maxAutoLevel,i=E.config,o=E.minAutoLevel,_=E.media,n=t?t.duration:e?e.duration:0,r=_&&0!==_.playbackRate?Math.abs(_.playbackRate):1,S=this.getBwEstimate(),T=E.mainForwardBufferInfo,s=(T?T.len:0)/r,I=i.abrBandWidthFactor,l=i.abrBandWidthUpFactor;if(s){var A=this.findBestLevel(S,o,a,s,0,I,l);if(A>=0)return A}var O=n?Math.min(n,i.maxStarvationDelay):i.maxStarvationDelay;if(!s){var u=this.bitrateTestDelay;u&&(O=(n?Math.min(n,i.maxLoadingDelay):i.maxLoadingDelay)-u,y.info("[abr] bitrate test took "+Math.round(1e3*u)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*O)+" ms"),I=l=1)}var R=this.findBestLevel(S,o,a,s,O,I,l);if(y.info("[abr] "+(s?"rebuffering expected":"buffer is empty")+", optimal quality level "+R),R>-1)return R;var N=E.levels[o],d=E.levels[E.loadLevel];return(null==N?void 0:N.bitrate)<(null==d?void 0:d.bitrate)?o:E.loadLevel},t.getBwEstimate=function(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate},t.findBestLevel=function(e,t,E,a,i,o,_){var n,r=this,S=a+i,T=this.lastLoadedFragLevel,s=-1===T?this.hls.firstLevel:T,I=this.fragCurrent,l=this.partCurrent,A=this.hls,O=A.levels,u=A.allAudioTracks,R=A.loadLevel,N=A.config;if(1===O.length)return 0;var d,c=O[s],L=!(null==c||null==(n=c.details)||!n.live),m=-1===R||-1===T,D="SDR",p=(null==c?void 0:c.frameRate)||0,P=N.audioPreference,B=N.videoPreference,h=this.audioTracksByGroup||(this.audioTracksByGroup=sa(u));if(m){if(-1!==this.firstSelection)return this.firstSelection;var f=Sa(this.codecTiers||(this.codecTiers=Ia(O,h,t,E)),D,e,P,B),W=f.codecSet,g=f.videoRanges,M=f.minFramerate,v=f.minBitrate,U=f.preferHDR;d=W,D=U?g[g.length-1]:g[0],p=M,e=Math.max(e,v),y.log("[abr] picked start tier "+JSON.stringify(f))}else d=null==c?void 0:c.codecSet,D=null==c?void 0:c.videoRange;for(var G,b=l?l.duration:I?I.duration:0,k=this.bwEstimator.getEstimateTTFB()/1e3,F=[],V=function(){var t,n=O[H],I=H>s;if(!n)return 0;if(N.useMediaCapabilities&&!n.supportedResult&&!n.supportedPromise){var A=navigator.mediaCapabilities;"function"==typeof(null==A?void 0:A.decodingInfo)&&ia(n,h,D,p,e,P)?(n.supportedPromise=oa(n,h,A),n.supportedPromise.then(function(e){n.supportedResult=e;var t=r.hls.levels,E=t.indexOf(n);e.error?y.warn('[abr] MediaCapabilities decodingInfo error: "'+e.error+'" for level '+E+" "+JSON.stringify(e)):e.supported||(y.warn("[abr] Unsupported MediaCapabilities decodingInfo result for level "+E+" "+JSON.stringify(e)),E>-1&&t.length>1&&(y.log("[abr] Removing unsupported level "+E),r.hls.removeLevel(E)))})):n.supportedResult=Ea}if(d&&n.codecSet!==d||D&&n.videoRange!==D||I&&p>n.frameRate||!I&&p>0&&p=2*b&&0===i?O[H].averageBitrate:O[H].maxBitrate,g=r.getTimeToLoadFrag(k,u,W*f,void 0===B);if(u>=W&&(H===T||0===n.loadError&&0===n.fragmentError)&&(g<=k||!C(g)||L&&!r.bitrateTestDelay||g"+H+" adjustedbw("+Math.round(u)+")-bitrate="+Math.round(u-W)+" ttfb:"+k.toFixed(1)+" avgDuration:"+f.toFixed(1)+" maxFetchDuration:"+S.toFixed(1)+" fetchDuration:"+g.toFixed(1)+" firstSelection:"+m+" codecSet:"+d+" videoRange:"+D+" hls.loadLevel:"+R)),m&&(r.firstSelection=H),{v:H}}},H=E;H>=t;H--)if(0!==(G=V())&&G)return G.v;return-1},n(e,[{key:"firstAutoLevel",get:function(){var e=this.hls,t=e.maxAutoLevel,E=e.minAutoLevel,a=this.getBwEstimate(),i=this.hls.config.maxStarvationDelay,o=this.findBestLevel(a,E,t,0,i,1,1);if(o>-1)return o;var _=this.hls.firstLevel,n=Math.min(Math.max(_,E),t);return y.warn("[abr] Could not find best starting auto level. Defaulting to first in playlist "+_+" clamped to "+n),n}},{key:"forcedAutoLevel",get:function(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}},{key:"nextAutoLevel",get:function(){var e=this.forcedAutoLevel,t=this.bwEstimator.canEstimate(),E=this.lastLoadedFragLevel>-1;if(!(-1===e||t&&E&&this.nextAutoLevelKey!==this.getAutoLevelKey()))return e;var a=t&&E?this.getNextABRAutoLevel():this.firstAutoLevel;if(-1!==e){var i=this.hls.levels;if(i.length>Math.max(e,a)&&i[e].loadError<=i[a].loadError)return e}return this._nextAutoLevel=a,this.nextAutoLevelKey=this.getAutoLevelKey(),a},set:function(e){var t=this.hls,E=t.maxAutoLevel,a=t.minAutoLevel,i=Math.min(Math.max(e,a),E);this._nextAutoLevel!==i&&(this.nextAutoLevelKey="",this._nextAutoLevel=i)}}]),e})(),ca=(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})(),La={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"},ma=(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(B.BUFFER_APPENDED,this.onBufferAppended,this),e.on(B.FRAG_BUFFERED,this.onFragBuffered,this),e.on(B.FRAG_LOADED,this.onFragLoaded,this)},t._unregisterListeners=function(){var e=this.hls;e.off(B.BUFFER_APPENDED,this.onBufferAppended,this),e.off(B.FRAG_BUFFERED,this.onFragBuffered,this),e.off(B.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 E=this.activePartLists[t];if(E)for(var a=E.length;a--;){var i=E[a];if(!i)break;var o=i.end;if(i.start<=e&&null!==o&&e<=o)return i}return this.getBufferedFrag(e,t)},t.getBufferedFrag=function(e,t){for(var E=this.fragments,a=Object.keys(E),i=a.length;i--;){var o=E[a[i]];if((null==o?void 0:o.body.type)===t&&o.buffered){var _=o.body;if(_.start<=e&&e<=_.end)return _}}return null},t.detectEvictedFragments=function(e,t,E,a){var i=this;this.timeRanges&&(this.timeRanges[e]=t);var o=(null==a?void 0:a.fragment.sn)||-1;Object.keys(this.fragments).forEach(function(a){var _=i.fragments[a];if(_&&!(o>=_.body.sn))if(_.buffered||_.loaded){var n=_.range[e];n&&n.time.some(function(e){var E=!i.isTimeBuffered(e.startPTS,e.endPTS,t);return E&&i.removeFragment(_.body),E})}else _.body.type===E&&i.removeFragment(_.body)})},t.detectPartialFragments=function(e){var t=this,E=this.timeRanges,a=e.frag,i=e.part;if(E&&"initSegment"!==a.sn){var o=Ca(a),_=this.fragments[o];if(!(!_||_.buffered&&a.gap)){var n=!a.relurl;Object.keys(E).forEach(function(e){var o=a.elementaryStreams[e];if(o){var r=E[e],S=n||!0===o.partial;_.range[e]=t.getBufferedTimes(a,i,S,r)}}),_.loaded=null,Object.keys(_.range).length?(_.buffered=!0,(_.body.endList=a.endList||_.body.endList)&&(this.endListFragments[_.body.type]=_),Da(_)||this.removeParts(a.sn-1,a.type)):this.removeFragment(_.body)}}},t.removeParts=function(e,t){var E=this.activePartLists[t];E&&(this.activePartLists[t]=E.filter(function(t){return t.fragment.sn>=e}))},t.fragBuffered=function(e,t){var E=Ca(e),a=this.fragments[E];!a&&t&&(a=this.fragments[E]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),a&&(a.loaded=null,a.buffered=!0)},t.getBufferedTimes=function(e,t,E,a){for(var i={time:[],partial:E},o=e.start,_=e.end,n=e.minEndPTS||_,r=e.maxStartPTS||o,S=0;S=T&&n<=s){i.time.push({startPTS:Math.max(o,a.start(S)),endPTS:Math.min(_,a.end(S))});break}if(oT){var I=Math.max(o,a.start(S)),l=Math.min(_,a.end(S));l>I&&(i.partial=!0,i.time.push({startPTS:I,endPTS:l}))}else if(_<=T)break}return i},t.getPartialFragment=function(e){var t,E,a,i=null,o=0,_=this.bufferPadding,n=this.fragments;return Object.keys(n).forEach(function(r){var S=n[r];S&&Da(S)&&(E=S.body.start-_,a=S.body.end+_,e>=E&&e<=a&&(t=Math.min(e-E,a-e),o<=t&&(i=S.body,o=t)))}),i},t.isEndListAppended=function(e){var t=this.endListFragments[e];return void 0!==t&&(t.buffered||Da(t))},t.getState=function(e){var t=Ca(e),E=this.fragments[t];return E?E.buffered?Da(E)?La.PARTIAL:La.OK:La.APPENDING:La.NOT_LOADED},t.isTimeBuffered=function(e,t,E){for(var a,i,o=0;o=a&&t<=i)return!0;if(t<=a)return!1}return!1},t.onFragLoaded=function(e,t){var E=t.frag,a=t.part;if("initSegment"!==E.sn&&!E.bitrateTest){var i=a?null:t,o=Ca(E);this.fragments[o]={body:E,appendedPTS:null,loaded:i,buffered:!1,range:Object.create(null)}}},t.onBufferAppended=function(e,t){var E=this,a=t.frag,i=t.part,o=t.timeRanges;if("initSegment"!==a.sn){var _=a.type;if(i){var n=this.activePartLists[_];n||(this.activePartLists[_]=n=[]),n.push(i)}this.timeRanges=o,Object.keys(o).forEach(function(e){var t=o[e];E.detectEvictedFragments(e,t,_,i)})}},t.onFragBuffered=function(e,t){this.detectPartialFragments(t)},t.hasFragment=function(e){var t=Ca(e);return!!this.fragments[t]},t.hasParts=function(e){var t;return!(null==(t=this.activePartLists[e])||!t.length)},t.removeFragmentsInRange=function(e,t,E,a,i){var o=this;a&&!this.hasGaps||Object.keys(this.fragments).forEach(function(_){var n=o.fragments[_];if(n){var r=n.body;r.type!==E||a&&!r.gap||r.starte&&(n.buffered||i)&&o.removeFragment(r)}})},t.removeFragment=function(e){var t=Ca(e);e.stats.loaded=0,e.clearElementaryStreamInfo();var E=this.activePartLists[e.type];if(E){var a=e.sn;this.activePartLists[e.type]=E.filter(function(e){return e.fragment.sn!==a})}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 Da(e){var t,E,a;return e.buffered&&(e.body.gap||(null==(t=e.range.video)?void 0:t.partial)||(null==(E=e.range.audio)?void 0:E.partial)||(null==(a=e.range.audiovideo)?void 0:a.partial))}function Ca(e){return e.type+"_"+e.level+"_"+e.sn}var pa={length:0,start:function(){return 0},end:function(){return 0}},Pa=(function(){function e(){}return e.isBuffered=function(t,E){try{if(t)for(var a=e.getBuffered(t),i=0;i=a.start(i)&&E<=a.end(i))return!0}catch(e){}return!1},e.bufferInfo=function(t,E,a){try{if(t){var i,o=e.getBuffered(t),_=[];for(i=0;i_&&(a[o-1].end=e[i].end):a.push(e[i])}else a.push(e[i])}else a=e;for(var n,r=0,S=t,T=t,s=0;s=I&&tE.startCC||e&&e.cc>>8^255&u^99,e[l]=u,t[u]=l;var R=I[l],N=I[R],d=I[N],c=257*I[u]^16843008*u;a[l]=c<<24|c>>>8,i[l]=c<<16|c>>>16,o[l]=c<<8|c>>>24,_[l]=c,c=16843009*d^65537*N^257*R^16843008*l,r[u]=c<<24|c>>>8,S[u]=c<<16|c>>>16,T[u]=c<<8|c>>>24,s[u]=c,l?(l=R^I[I[I[d^R]]],A^=I[I[A]]):l=A=1}},t.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),E=!0,a=0;a_.end){var T=o>S;(o0&&null!=o&&o.key&&o.iv&&"AES-128"===o.method){var _=self.performance.now();return E.decrypter.decrypt(new Uint8Array(i),o.key.buffer,o.iv.buffer).catch(function(t){throw a.trigger(B.ERROR,{type:h.MEDIA_ERROR,details:f.FRAG_DECRYPT_ERROR,fatal:!1,error:t,reason:t.message,frag:e}),t}).then(function(i){var o=self.performance.now();return a.trigger(B.FRAG_DECRYPTED,{frag:e,payload:i,stats:{tstart:_,tdecrypt:o}}),t.payload=i,E.completeInitSegmentLoad(t)})}return E.completeInitSegmentLoad(t)}).catch(function(t){E.state!==Xa.STOPPED&&E.state!==Xa.ERROR&&(E.warn(t),E.resetFragmentLoading(e))})},E.completeInitSegmentLoad=function(e){if(!this.levels)throw new Error("init load aborted, missing levels");var t=e.frag.stats;this.state=Xa.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()},E.fragContextChanged=function(e){var t=this.fragCurrent;return!e||!t||e.sn!==t.sn||e.level!==t.level},E.fragBufferedComplete=function(e,t){var E,a,i,o,_=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!=(E=e.startPTS)?E:NaN).toFixed(3)+"-"+(null!=(a=e.endPTS)?a:NaN).toFixed(3)+"] > buffer:"+(_?Qa.toString(Pa.getBuffered(_)):"(detached)")+")"),"initSegment"!==e.sn){var n;if(e.type!==$t.SUBTITLE){var r=e.elementaryStreams;if(!Object.keys(r).some(function(e){return!!r[e]}))return void(this.state=Xa.IDLE)}var S=null==(n=this.levels)?void 0:n[e.level];null!=S&&S.fragmentError&&(this.log("Resetting level fragment error count of "+S.fragmentError+" on frag buffered"),S.fragmentError=0)}this.state=Xa.IDLE,_&&(!this.loadedmetadata&&e.type==$t.MAIN&&_.buffered.length&&(null==(i=this.fragCurrent)?void 0:i.sn)===(null==(o=this.fragPrevious)?void 0:o.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())},E.seekToStartPos=function(){},E._handleFragmentLoadComplete=function(e){var t=this.transmuxer;if(t){var E=e.frag,a=e.part,i=e.partsLoaded,o=!i||0===i.length||i.some(function(e){return!e}),_=new Ba(E.level,E.sn,E.stats.chunkCount+1,0,a?a.index:-1,!o);t.flush(_)}},E._handleFragmentLoadProgress=function(e){},E._doFragLoad=function(e,t,E,a){var i,o=this;void 0===E&&(E=null);var _=null==t?void 0:t.details;if(!this.levels||!_)throw new Error("frag load aborted, missing level"+(_?"":" detail")+"s");var n=null;if(!e.encrypted||null!=(i=e.decryptdata)&&i.key?!e.encrypted&&_.encryptedFragments.length&&this.keyLoader.loadClear(e,_.encryptedFragments):(this.log("Loading key for "+e.sn+" of ["+_.startSN+"-"+_.endSN+"], "+("[stream-controller]"===this.logPrefix?"level":"track")+" "+e.level),this.state=Xa.KEY_LOADING,this.fragCurrent=e,n=this.keyLoader.load(e).then(function(e){if(!o.fragContextChanged(e.frag))return o.hls.trigger(B.KEY_LOADED,e),o.state===Xa.KEY_LOADING&&(o.state=Xa.IDLE),e}),this.hls.trigger(B.KEY_LOADING,{frag:e}),null===this.fragCurrent&&(n=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))),E=Math.max(e.start,E||0),this.config.lowLatencyMode&&"initSegment"!==e.sn){var r=_.partList;if(r&&a){E>e.end&&_.fragmentHint&&(e=_.fragmentHint);var S=this.getNextPart(r,e,E);if(S>-1){var T,s=r[S];return this.log("Loading part sn: "+e.sn+" p: "+s.index+" cc: "+e.cc+" of playlist ["+_.startSN+"-"+_.endSN+"] parts [0-"+S+"-"+(r.length-1)+"] "+("[stream-controller]"===this.logPrefix?"level":"track")+": "+e.level+", target: "+parseFloat(E.toFixed(3))),this.nextLoadPosition=s.start+s.duration,this.state=Xa.FRAG_LOADING,T=n?n.then(function(E){return!E||o.fragContextChanged(E.frag)?null:o.doFragPartsLoad(e,s,t,a)}).catch(function(e){return o.handleFragLoadError(e)}):this.doFragPartsLoad(e,s,t,a).catch(function(e){return o.handleFragLoadError(e)}),this.hls.trigger(B.FRAG_LOADING,{frag:e,part:s,targetBufferTime:E}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):T}if(!e.url||this.loadedEndOfParts(r,E))return Promise.resolve(null)}}this.log("Loading fragment "+e.sn+" cc: "+e.cc+" "+(_?"of ["+_.startSN+"-"+_.endSN+"] ":"")+("[stream-controller]"===this.logPrefix?"level":"track")+": "+e.level+", target: "+parseFloat(E.toFixed(3))),C(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=Xa.FRAG_LOADING;var I,l=this.config.progressive;return I=l&&n?n.then(function(t){return!t||o.fragContextChanged(null==t?void 0:t.frag)?null:o.fragmentLoader.load(e,a)}).catch(function(e){return o.handleFragLoadError(e)}):Promise.all([this.fragmentLoader.load(e,l?a:void 0),n]).then(function(e){var t=e[0];return!l&&t&&a&&a(t),t}).catch(function(e){return o.handleFragLoadError(e)}),this.hls.trigger(B.FRAG_LOADING,{frag:e,targetBufferTime:E}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):I},E.doFragPartsLoad=function(e,t,E,a){var i=this;return new Promise(function(o,_){var n,r=[],S=null==(n=E.details)?void 0:n.partList;!(function t(n){i.fragmentLoader.loadPart(e,n,a).then(function(a){r[n.index]=a;var _=a.part;i.hls.trigger(B.FRAG_LOADED,a);var T=GE(E,e.sn,n.index+1)||yE(S,e.sn,n.index+1);if(!T)return o({frag:e,part:_,partsLoaded:r});t(T)}).catch(_)})(t)})},E.handleFragLoadError=function(e){if("data"in e){var t=e.data;e.data&&t.details===f.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(B.ERROR,t)}else this.hls.trigger(B.ERROR,{type:h.OTHER_ERROR,details:f.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null},E._handleTransmuxerFlush=function(e){var t=this.getCurrentContext(e);if(t&&this.state===Xa.PARSING){var E=t.frag,a=t.part,i=t.level,o=self.performance.now();E.stats.parsing.end=o,a&&(a.stats.parsing.end=o),this.updateLevelTiming(E,a,i,e.partial)}else this.fragCurrent||this.state===Xa.STOPPED||this.state===Xa.ERROR||(this.state=Xa.IDLE)},E.getCurrentContext=function(e){var t=this.levels,E=this.fragCurrent,a=e.level,i=e.sn,o=e.part;if(null==t||!t[a])return this.warn("Levels object was unset while buffering fragment "+i+" of level "+a+". The current chunk will not be buffered."),null;var _=t[a],n=o>-1?GE(_,i,o):null,r=n?n.fragment:UE(_,i,E);return r?(E&&E!==r&&(r.stats=E.stats),{frag:r,part:n,level:_}):null},E.bufferFragmentData=function(e,t,E,a,i){var o;if(e&&this.state===Xa.PARSING){var _=e.data1,n=e.data2,r=_;if(_&&n&&(r=Et(_,n)),null!=(o=r)&&o.length){var S={type:e.type,frag:t,part:E,chunkMeta:a,parent:t.type,data:r};if(this.hls.trigger(B.BUFFER_APPENDING,S),e.dropped&&e.independent&&!E){if(i)return;this.flushBufferGap(t)}}}},E.flushBufferGap=function(e){var t=this.media;if(t)if(Pa.isBuffered(t,t.currentTime)){var E=t.currentTime,a=Pa.bufferInfo(t,E,0),i=e.duration,o=Math.min(2*this.config.maxFragLookUpTolerance,.25*i),_=Math.max(Math.min(e.start-o,a.end-o),E+o);e.start-_>o&&this.flushMainBuffer(_,e.start)}else this.flushMainBuffer(0,e.start)},E.getFwdBufferInfo=function(e,t){var E=this.getLoadPosition();return C(E)?this.getFwdBufferInfoAtPos(e,E,t):null},E.getFwdBufferInfoAtPos=function(e,t,E){var a=this.config.maxBufferHole,i=Pa.bufferInfo(e,t,a);if(0===i.len&&void 0!==i.nextStart){var o=this.fragmentTracker.getBufferedFrag(t,E);if(o&&i.nextStart=E&&(t.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+t.maxMaxBufferLength+"s"),!0)},E.getAppendedFrag=function(e,t){var E=this.fragmentTracker.getAppendedFrag(e,$t.MAIN);return E&&"fragment"in E?E.fragment:E},E.getNextFragment=function(e,t){var E=t.fragments,a=E.length;if(!a)return null;var i,o=this.config,_=E[0].start;if(t.live){var n=o.initialLiveManifestSize;if(at},E.getNextFragmentLoopLoading=function(e,t,E,a,i){var o=e.gap,_=this.getNextFragment(this.nextLoadPosition,t);if(null===_)return _;if(e=_,o&&e&&!e.gap&&E.nextStart){var n=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,E.nextStart,a);if(null!==n&&E.len+n.len>=i)return this.log('buffer full after gaps in "'+a+'" playlist starting at sn: '+e.sn),null}return e},E.mapToInitFragWhenRequired=function(e){return null==e||!e.initSegment||null!=e&&e.initSegment.data||this.bitrateTest?e:e.initSegment},E.getNextPart=function(e,t,E){for(var a=-1,i=!1,o=!0,_=0,n=e.length;_-1&&EE.start&&E.loaded},E.getInitialLiveFragment=function(e,t){var E=this.fragPrevious,a=null;if(E){if(e.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+E.programDateTime),a=zE(t,E.endProgramDateTime,this.config.maxFragLookUpTolerance)),!a){var i=E.sn+1;if(i>=e.startSN&&i<=e.endSN){var o=t[i-e.startSN];E.cc===o.cc&&(a=o,this.log("Live playlist, switching playlist, load frag with next SN: "+a.sn))}a||(a=XE(t,E.cc))&&this.log("Live playlist, switching playlist, load frag with same CC: "+a.sn)}}else{var _=this.hls.liveSyncPosition;null!==_&&(a=this.getFragmentAtPosition(_,this.bitrateTest?e.fragmentEnd:e.edge,e))}return a},E.getFragmentAtPosition=function(e,t,E){var a,i=this.config,o=this.fragPrevious,_=E.fragments,n=E.endSN,r=E.fragmentHint,S=i.maxFragLookUpTolerance,T=E.partList,s=!!(i.lowLatencyMode&&null!=T&&T.length&&r);if(s&&r&&!this.bitrateTest&&(_=_.concat(r),n=r.sn),a=et-S?0:S):_[_.length-1]){var I=a.sn-E.startSN,l=this.fragmentTracker.getState(a);if((l===La.OK||l===La.PARTIAL&&a.gap)&&(o=a),o&&a.sn===o.sn&&(!s||T[0].fragment.sn>a.sn)&&o&&a.level===o.level){var A=_[I+1];a=a.sn=o-t.maxFragLookUpTolerance&&i<=_;if(null!==a&&E.duration>a&&(i"+e.startSN+" prev-sn: "+(n?n.sn:"na")+" fragments: "+a),r}return i},E.waitForCdnTuneIn=function(e){var t=3;return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*t)},E.setStartPosition=function(e,t){var E=this.startPosition;if(E "+(null==(i=this.fragCurrent)?void 0:i.url))}else{var o=t.details===f.FRAG_GAP;o&&this.fragmentTracker.fragBuffered(a,!0);var _=t.errorAction,n=_||{},r=n.action,S=n.retryCount,T=void 0===S?0:S,s=n.retryConfig;if(_&&r===$E.RetryRequest&&s){this.resetStartWhenNotLoaded(this.levelLastLoaded);var I=VE(s,T);this.warn("Fragment "+a.sn+" of "+e+" "+a.level+" errored with "+t.details+", retrying loading "+(T+1)+"/"+s.maxNumRetry+" in "+I+"ms"),_.resolved=!0,this.retryDate=self.performance.now()+I,this.state=Xa.FRAG_LOADING_WAITING_RETRY}else if(s&&_){if(this.resetFragmentErrors(e),!(T.5;a&&this.reduceMaxBufferLength(E.len);var i=!a;return i&&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(),i}return!1},E.resetFragmentErrors=function(e){e===$t.AUDIO&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==Xa.STOPPED&&(this.state=Xa.IDLE)},E.afterBufferFlushed=function(e,t,E){if(e){var a=Pa.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,a,E),this.state===Xa.ENDED&&this.resetLoadingState()}},E.resetLoadingState=function(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=Xa.IDLE},E.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}},E.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()},E.removeUnbufferedFrags=function(e){void 0===e&&(e=0),this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)},E.updateLevelTiming=function(e,t,E,a){var i,o=this,_=E.details;if(_){if(!Object.keys(e.elementaryStreams).reduce(function(t,i){var n=e.elementaryStreams[i];if(n){var r=n.endPTS-n.startPTS;if(r<=0)return o.warn("Could not parse fragment "+e.sn+" "+i+" duration reliably ("+r+")"),t||!1;var S=a?0:PE(_,e,n.startPTS,n.endPTS,n.startDTS,n.endDTS);return o.hls.trigger(B.LEVEL_PTS_UPDATED,{details:_,level:E,drift:S,type:i,frag:e,start:n.startPTS,end:n.endPTS}),!0}return t},!1)&&null===(null==(i=this.transmuxer)?void 0:i.error)){var n=new Error("Found no media in fragment "+e.sn+" of level "+e.level+" resetting transmuxer to fallback to playlist timing");if(0===E.fragmentError&&(E.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(n.message),this.hls.trigger(B.ERROR,{type:h.MEDIA_ERROR,details:f.FRAG_PARSING_ERROR,fatal:!1,error:n,frag:e,reason:"Found no media in msn "+e.sn+' of level "'+E.url+'"'}),!this.hls)return;this.resetTransmuxer()}this.state=Xa.PARSED,this.hls.trigger(B.FRAG_PARSED,{frag:e,part:t})}else this.warn("level.details undefined")},E.resetTransmuxer=function(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)},E.recoverWorkerError=function(e){"demuxerWorker"===e.event&&(this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())},n(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})(ca),qa=(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,E=this.dataLength;return t.length?(e=1===t.length?t[0]:Ja(t,E),this.reset(),e):new Uint8Array(0)},t.reset=function(){this.chunks.length=0,this.dataLength=0},e})();function Ja(e,t){for(var E=new Uint8Array(t),a=0,i=0;i0&&_.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:a,type:nE.audioId3,duration:Number.POSITIVE_INFINITY});i>>6)+1;var s=(60&t[E+2])>>>2;if(!(s>T.length-1))return _=(1&t[E+2])<<2,_|=(192&t[E+3])>>>6,y.log("manifest codec:"+a+", ADTS type:"+i+", samplingIndex:"+s),/firefox/i.test(r)?s>=6?(i=5,n=new Array(4),o=s-3):(i=2,n=new Array(2),o=s):-1!==r.indexOf("android")?(i=2,n=new Array(2),o=s):(i=5,n=new Array(4),a&&(-1!==a.indexOf("mp4a.40.29")||-1!==a.indexOf("mp4a.40.5"))||!a&&s>=6?o=s-3:((a&&-1!==a.indexOf("mp4a.40.2")&&(s>=6&&1===_||/vivaldi/i.test(r))||!a&&1===_)&&(i=2,n=new Array(2)),o=s)),n[0]=i<<3,n[0]|=(14&s)>>1,n[1]|=(1&s)<<7,n[1]|=_<<3,5===i&&(n[1]|=(14&o)>>1,n[2]=(1&o)<<7,n[2]|=8,n[3]=0),{config:n,samplerate:T[s],channelCount:_,codec:"mp4a.40."+i,manifestCodec:S};var I=new Error("invalid ADTS sampling index:"+s);e.emit(B.ERROR,B.ERROR,{type:h.MEDIA_ERROR,details:f.FRAG_PARSING_ERROR,fatal:!0,error:I,reason:I.message})}function ai(e,t){return 255===e[t]&&240==(246&e[t+1])}function ii(e,t){return 1&e[t+1]?7:9}function oi(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function _i(e,t){return t+5=e.length)return!1;var a=oi(e,t);if(a<=E)return!1;var i=t+a;return i===e.length||ni(e,i)}return!1}function Ti(e,t,E,a,i){if(!e.samplerate){var o=Ei(t,E,a,i);if(!o)return;e.config=o.config,e.samplerate=o.samplerate,e.channelCount=o.channelCount,e.codec=o.codec,e.manifestCodec=o.manifestCodec,y.log("parsed codec:"+e.codec+", rate:"+o.samplerate+", channels:"+o.channelCount)}}function si(e){return 9216e4/e}function Ii(e,t){var E=ii(e,t);if(t+E<=e.length){var a=oi(e,t)-E;if(a>0)return{headerLength:E,frameLength:a}}}function li(e,t,E,a,i){var o,_=a+i*si(e.samplerate),n=Ii(t,E);if(n){var r=n.frameLength,S=n.headerLength,T=S+r,s=Math.max(0,E+T-t.length);s?(o=new Uint8Array(T-S)).set(t.subarray(E+S,t.length),0):o=t.subarray(E+S,E+T);var I={unit:o,pts:_};return s||e.samples.push(I),{sample:I,length:T,missing:s}}var l=t.length-E;return(o=new Uint8Array(l)).set(t.subarray(E,t.length),0),{sample:{unit:o,pts:_},length:l,missing:-1}}var Ai=null,Oi=[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],ui=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Ri=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Ni=[0,1,1,4];function di(e,t,E,a,i){if(!(E+24>t.length)){var o=ci(t,E);if(o&&E+o.frameLength<=t.length){var _=a+i*(9e4*o.samplesPerFrame/o.sampleRate),n={unit:t.subarray(E,E+o.frameLength),pts:_,dts:_};return e.config=[],e.channelCount=o.channelCount,e.samplerate=o.sampleRate,e.samples.push(n),{sample:n,length:o.frameLength,missing:0}}}}function ci(e,t){var E=e[t+1]>>3&3,a=e[t+1]>>1&3,i=e[t+2]>>4&15,o=e[t+2]>>2&3;if(1!==E&&0!==i&&15!==i&&3!==o){var _=e[t+2]>>1&1,n=e[t+3]>>6,r=1e3*Oi[14*(3===E?3-a:3===a?3:4)+i-1],S=ui[3*(3===E?0:2===E?1:2)+o],T=3===n?1:2,s=Ri[E][a],I=Ni[a],l=8*s*I,A=Math.floor(s*r/S+_)*I;if(null===Ai){var O=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Ai=O?parseInt(O[1]):0}return!!Ai&&Ai<=87&&2===a&&r>=224e3&&0===n&&(e[t+3]=128|e[t+3]),{sampleRate:S,channelCount:T,frameLength:A,samplesPerFrame:l}}}function Li(e,t){return!(255!==e[t]||224&~e[t+1]||!(6&e[t+1]))}function mi(e,t){return t+10;){_[0]=e[t];var n=Math.min(a,8),r=8-n;o[0]=4278190080>>>24+r<>r,E=E?E<t.length)return-1;if(11!==t[E]||119!==t[E+1])return-1;var o=t[E+4]>>6;if(o>=3)return-1;var _=[48e3,44100,32e3][o],n=63&t[E+4],r=2*[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][3*n+o];if(E+r>t.length)return-1;var S=t[E+6]>>5,T=0;2===S?T+=2:(1&S&&1!==S&&(T+=2),4&S&&(T+=2));var s=(t[E+6]<<8|t[E+7])>>12-T&1,I=[2,1,2,3,3,4,4,5][S]+s,l=t[E+5]>>3,A=7&t[E+5],O=new Uint8Array([o<<6|l<<1|A>>2,(3&A)<<6|S<<3|s<<2|n>>4,n<<4&224]),u=a+i*(1536/_*9e4),R=t.subarray(E,E+r);return e.config=O,e.channelCount=I,e.samplerate=_,e.samples.push({unit:R,pts:u}),r}var gi=(function(){function e(){this.VideoSample=null}var t=e.prototype;return t.createVideoSample=function(e,t,E,a){return{key:e,frame:!1,pts:t,dts:E,units:[],debug:a,length:0}},t.getLastNalUnit=function(e){var t,E,a=this.VideoSample;if(a&&0!==a.units.length||(a=e[e.length-1]),null!=(t=a)&&t.units){var i=a.units;E=i[i.length-1]}return E},t.pushAccessUnit=function(e,t){if(e.units.length&&e.frame){if(void 0===e.pts){var E=t.samples,a=E.length;if(!a)return void t.dropped++;var i=E[a-1];e.pts=i.pts,e.dts=i.dts}t.samples.push(e)}e.debug.length&&y.log(e.pts+"/"+e.dts+":"+e.debug)},e})(),Mi=(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,E=e.byteLength-t,a=new Uint8Array(4),i=Math.min(4,t);if(0===i)throw new Error("no bytes available");a.set(e.subarray(E,E+i)),this.word=new DataView(a.buffer).getUint32(0),this.bitsAvailable=8*i,this.bytesAvailable-=i},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),E=this.word>>>32-t;if(e>32&&y.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return(t=e-t)>0&&this.bitsAvailable?E<>>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,E=8,a=0;a4){var l=new Mi(I).readSliceType();2!==l&&4!==l&&7!==l&&9!==l||(T=!0)}T&&null!=(s=r)&&s.frame&&!r.key&&(_.pushAccessUnit(r,e),r=_.VideoSample=null),r||(r=_.VideoSample=_.createVideoSample(!0,E.pts,E.dts,"")),r.frame=!0,r.key=T;break;case 5:o=!0,null!=(n=r)&&n.frame&&!r.key&&(_.pushAccessUnit(r,e),r=_.VideoSample=null),r||(r=_.VideoSample=_.createVideoSample(!0,E.pts,E.dts,"")),r.key=!0,r.frame=!0;break;case 6:o=!0,_t(a.data,1,E.pts,t.samples);break;case 7:var A,O;o=!0,S=!0;var u=a.data,R=new Mi(u).readSPS();if(!e.sps||e.width!==R.width||e.height!==R.height||(null==(A=e.pixelRatio)?void 0:A[0])!==R.pixelRatio[0]||(null==(O=e.pixelRatio)?void 0:O[1])!==R.pixelRatio[1]){e.width=R.width,e.height=R.height,e.pixelRatio=R.pixelRatio,e.sps=[u],e.duration=i;for(var N=u.subarray(1,4),d="avc1.",c=0;c<3;c++){var L=N[c].toString(16);L.length<2&&(L="0"+L),d+=L}e.codec=d}break;case 8:o=!0,e.pps=[a.data];break;case 9:o=!0,e.audFound=!0,r&&_.pushAccessUnit(r,e),r=_.VideoSample=_.createVideoSample(!1,E.pts,E.dts,"");break;case 12:o=!0;break;default:o=!1,r&&(r.debug+="unknown NAL "+a.type+" ")}r&&o&&r.units.push(a)}),a&&r&&(this.pushAccessUnit(r,e),this.VideoSample=null)},E.parseAVCNALu=function(e,t){var E,a,i=t.byteLength,o=e.naluState||0,_=o,n=[],r=0,S=-1,T=0;for(-1===o&&(S=0,T=31&t[0],o=0,r=1);r=0){var s={data:t.subarray(S,a),type:T};n.push(s)}else{var I=this.getLastNalUnit(e.samples);I&&(_&&r<=4-_&&I.state&&(I.data=I.data.subarray(0,I.data.byteLength-_)),a>0&&(I.data=Et(I.data,t.subarray(0,a)),I.state=0))}r=0&&o>=0){var l={data:t.subarray(S,i),type:T,state:o};n.push(l)}if(0===n.length){var A=this.getLastNalUnit(e.samples);A&&(A.data=Et(A.data,t))}return e.naluState=o,n},t})(gi),Ui=(function(){function e(e,t,E){this.keyData=void 0,this.decrypter=void 0,this.keyData=E,this.decrypter=new xa(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,E){var a=this,i=e[t].unit;if(!(i.length<=16)){var o=i.subarray(16,i.length-i.length%16),_=o.buffer.slice(o.byteOffset,o.byteOffset+o.length);this.decryptBuffer(_).then(function(o){var _=new Uint8Array(o);i.set(_,16),a.decrypter.isSync()||a.decryptAacSamples(e,t+1,E)})}},t.decryptAacSamples=function(e,t,E){for(;;t++){if(t>=e.length)return void E();if(!(e[t].unit.length<32||(this.decryptAacSample(e,t,E),this.decrypter.isSync())))return}},t.getAvcEncryptedData=function(e){for(var t=16*Math.floor((e.length-48)/160)+16,E=new Int8Array(t),a=0,i=32;i=e.length)return void a();for(var i=e[t].units;!(E>=i.length);E++){var o=i[E];if(!(o.data.length<=48||1!==o.type&&5!==o.type||(this.decryptAvcSample(e,t,E,a,o),this.decrypter.isSync())))return}}},e})(),Gi=188,yi=(function(){function e(e,t,E){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=E,this.videoParser=new vi}e.probe=function(t){var E=e.syncOffset(t);return E>0&&y.warn("MPEG2-TS detected but first sync word found @ offset "+E),-1!==E},e.syncOffset=function(e){for(var t=e.length,E=Math.min(5*Gi,t-Gi)+1,a=0;a1&&(0===o&&_>2||n+Gi>E))return o}a++}return-1},e.createTrack=function(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:Ue[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===e?t:void 0}};var t=e.prototype;return t.resetInitSegment=function(t,E,a,i){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=e.createTrack("video"),this._audioTrack=e.createTrack("audio",i),this._id3Track=e.createTrack("id3"),this._txtTrack=e.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=E,this.videoCodec=a,this._duration=i},t.resetTimeStamp=function(){},t.resetContiguity=function(){var e=this._audioTrack,t=this._videoTrack,E=this._id3Track;e&&(e.pesData=null),t&&(t.pesData=null),E&&(E.pesData=null),this.aacOverFlow=null,this.remainderData=null},t.demux=function(t,E,a,i){var o;void 0===a&&(a=!1),void 0===i&&(i=!1),a||(this.sampleAes=null);var _=this._videoTrack,n=this._audioTrack,r=this._id3Track,S=this._txtTrack,T=_.pid,s=_.pesData,I=n.pid,l=r.pid,A=n.pesData,O=r.pesData,u=null,R=this.pmtParsed,N=this._pmtId,d=t.length;if(this.remainderData&&(d=(t=Et(this.remainderData,t)).length,this.remainderData=null),d>4>1){if((p=m+5+t[m+4])===m+Gi)continue}else p=m+4;switch(C){case T:D&&(s&&(o=Hi(s))&&this.videoParser.parseAVCPES(_,S,o,!1,this._duration),s={data:[],size:0}),s&&(s.data.push(t.subarray(p,m+Gi)),s.size+=m+Gi-p);break;case I:if(D){if(A&&(o=Hi(A)))switch(n.segmentCodec){case"aac":this.parseAACPES(n,o);break;case"mp3":this.parseMPEGPES(n,o);break;case"ac3":this.parseAC3PES(n,o)}A={data:[],size:0}}A&&(A.data.push(t.subarray(p,m+Gi)),A.size+=m+Gi-p);break;case l:D&&(O&&(o=Hi(O))&&this.parseID3PES(r,o),O={data:[],size:0}),O&&(O.data.push(t.subarray(p,m+Gi)),O.size+=m+Gi-p);break;case 0:D&&(p+=t[p]+1),N=this._pmtId=ki(t,p);break;case N:D&&(p+=t[p]+1);var P=Fi(t,p,this.typeSupported,a);(T=P.videoPid)>0&&(_.pid=T,_.segmentCodec=P.segmentVideoCodec),(I=P.audioPid)>0&&(n.pid=I,n.segmentCodec=P.segmentAudioCodec),(l=P.id3Pid)>0&&(r.pid=l),null===u||R||(y.warn("MPEG-TS PMT found at "+m+" after unknown PID '"+u+"'. Backtracking to sync byte @"+c+" to parse all TS packets."),u=null,m=c-188),R=this.pmtParsed=!0;break;case 17:case 8191:break;default:u=C}}else L++;if(L>0){var W=new Error("Found "+L+" TS packet/s that do not start with 0x47");this.observer.emit(B.ERROR,B.ERROR,{type:h.MEDIA_ERROR,details:f.FRAG_PARSING_ERROR,fatal:!1,error:W,reason:W.message})}_.pesData=s,n.pesData=A,r.pesData=O;var g={audioTrack:n,videoTrack:_,id3Track:r,textTrack:S};return i&&this.extractRemainingSamples(g),g},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,E=e.audioTrack,a=e.videoTrack,i=e.id3Track,o=e.textTrack,_=a.pesData,n=E.pesData,r=i.pesData;if(_&&(t=Hi(_))?(this.videoParser.parseAVCPES(a,o,t,!0,this._duration),a.pesData=null):a.pesData=_,n&&(t=Hi(n))){switch(E.segmentCodec){case"aac":this.parseAACPES(E,t);break;case"mp3":this.parseMPEGPES(E,t);break;case"ac3":this.parseAC3PES(E,t)}E.pesData=null}else null!=n&&n.size&&y.log("last AAC PES packet truncated,might overlap between fragments"),E.pesData=n;r&&(t=Hi(r))?(this.parseID3PES(i,t),i.pesData=null):i.pesData=r},t.demuxSampleAes=function(e,t,E){var a=this.demux(e,E,!0,!this.config.progressive),i=this.sampleAes=new Ui(this.observer,this.config,t);return this.decrypt(a,i)},t.decrypt=function(e,t){return new Promise(function(E){var a=e.audioTrack,i=e.videoTrack;a.samples&&"aac"===a.segmentCodec?t.decryptAacSamples(a.samples,0,function(){i.samples?t.decryptAvcSamples(i.samples,0,0,function(){E(e)}):E(e)}):i.samples&&t.decryptAvcSamples(i.samples,0,0,function(){E(e)})})},t.destroy=function(){this._duration=0},t.parseAACPES=function(e,t){var E,a,i,o=0,_=this.aacOverFlow,n=t.data;if(_){this.aacOverFlow=null;var r=_.missing,S=_.sample.unit.byteLength;if(-1===r)n=Et(_.sample.unit,n);else{var T=S-r;_.sample.unit.set(n.subarray(0,r),T),e.samples.push(_.sample),o=_.missing}}for(E=o,a=n.length;E0;)n+=i;else y.warn("[tsdemuxer]: AC3 PES unknown PTS")},t.parseID3PES=function(e,t){if(void 0!==t.pts){var E=S({},t,{type:this._videoTrack?nE.emsg:nE.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(E)}else y.warn("[tsdemuxer]: ID3 PES unknown PTS")},e})();function bi(e,t){return((31&e[t+1])<<8)+e[t+2]}function ki(e,t){return(31&e[t+10])<<8|e[t+11]}function Fi(e,t,E,a){var i={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},o=t+3+((15&e[t+1])<<8|e[t+2])-4;for(t+=12+((15&e[t+10])<<8|e[t+11]);t0)for(var r=t+5,S=n;S>2;){106===e[r]&&(!0!==E.ac3?y.log("AC-3 audio found, not supported in this browser for now"):(i.audioPid=_,i.segmentAudioCodec="ac3"));var T=e[r+1]+2;r+=T,S-=T}break;case 194:case 135:y.warn("Unsupported EC-3 in M2TS found");break;case 36:y.warn("Unsupported HEVC in M2TS found")}t+=n+5}return i}function Vi(e){y.log(e+" with AES-128-CBC encryption found in unencrypted stream")}function Hi(e){var t,E,a,i,o,_=0,n=e.data;if(!e||0===e.size)return null;for(;n[0].length<19&&n.length>1;)n[0]=Et(n[0],n[1]),n.splice(1,1);if(1===((t=n[0])[0]<<16)+(t[1]<<8)+t[2]){if((E=(t[4]<<8)+t[5])&&E>e.size-6)return null;var r=t[7];192&r&&(i=536870912*(14&t[9])+4194304*(255&t[10])+16384*(254&t[11])+128*(255&t[12])+(254&t[13])/2,64&r?i-(o=536870912*(14&t[14])+4194304*(255&t[15])+16384*(254&t[16])+128*(255&t[17])+(254&t[18])/2)>54e5&&(y.warn(Math.round((i-o)/9e4)+"s delta between PTS and DTS, align them"),i=o):o=i);var S=(a=t[8])+9;if(e.size<=S)return null;e.size-=S;for(var T=new Uint8Array(e.size),s=0,I=n.length;sl){S-=l;continue}t=t.subarray(S),l-=S,S=0}T.set(t,_),_+=l}return E&&(E-=a+3),{data:T,pts:i,dts:o,len:E}}return null}var Yi=(function(e){function t(){return e.apply(this,arguments)||this}T(t,e);var E=t.prototype;return E.resetInitSegment=function(t,E,a,i){e.prototype.resetInitSegment.call(this,t,E,a,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:E,duration:i,inputTimeScale:9e4,dropped:0}},t.probe=function(e){if(!e)return!1;var t=Re(e,0),E=(null==t?void 0:t.length)||0;if(t&&11===e[E]&&119===e[E+1]&&void 0!==ce(t)&&hi(e,E)<=16)return!1;for(var a=e.length;E1?E-1:0),i=1;i>24&255,n[1]=t>>16&255,n[2]=t>>8&255,n[3]=255&t,n.set(e,4),o=0,t=8;o<_;o++)n.set(a[o],t),t+=a[o].byteLength;return n},e.hdlr=function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])},e.mdat=function(t){return e.box(e.types.mdat,t)},e.mdhd=function(t,E){E*=t;var a=Math.floor(E/(Ki+1)),i=Math.floor(E%(Ki+1));return e.box(e.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,a>>24,a>>16&255,a>>8&255,255&a,i>>24,i>>16&255,i>>8&255,255&i,85,196,0,0]))},e.mdia=function(t){return e.box(e.types.mdia,e.mdhd(t.timescale,t.duration),e.hdlr(t.type),e.minf(t))},e.mfhd=function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))},e.minf=function(t){return"audio"===t.type?e.box(e.types.minf,e.box(e.types.smhd,e.SMHD),e.DINF,e.stbl(t)):e.box(e.types.minf,e.box(e.types.vmhd,e.VMHD),e.DINF,e.stbl(t))},e.moof=function(t,E,a){return e.box(e.types.moof,e.mfhd(t),e.traf(a,E))},e.moov=function(t){for(var E=t.length,a=[];E--;)a[E]=e.trak(t[E]);return e.box.apply(null,[e.types.moov,e.mvhd(t[0].timescale,t[0].duration)].concat(a).concat(e.mvex(t)))},e.mvex=function(t){for(var E=t.length,a=[];E--;)a[E]=e.trex(t[E]);return e.box.apply(null,[e.types.mvex].concat(a))},e.mvhd=function(t,E){E*=t;var a=Math.floor(E/(Ki+1)),i=Math.floor(E%(Ki+1)),o=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,a>>24,a>>16&255,a>>8&255,255&a,i>>24,i>>16&255,i>>8&255,255&i,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return e.box(e.types.mvhd,o)},e.sdtp=function(t){var E,a,i=t.samples||[],o=new Uint8Array(4+i.length);for(E=0;E>>8&255),o.push(255&i),o=o.concat(Array.prototype.slice.call(a));for(E=0;E>>8&255),_.push(255&i),_=_.concat(Array.prototype.slice.call(a));var n=e.box(e.types.avcC,new Uint8Array([1,o[3],o[4],o[5],255,224|t.sps.length].concat(o).concat([t.pps.length]).concat(_))),r=t.width,S=t.height,T=t.pixelRatio[0],s=t.pixelRatio[1];return e.box(e.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,r>>8&255,255&r,S>>8&255,255&S,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),n,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),e.box(e.types.pasp,new Uint8Array([T>>24,T>>16&255,T>>8&255,255&T,s>>24,s>>16&255,s>>8&255,255&s])))},e.esds=function(e){var t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))},e.audioStsd=function(e){var t=e.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,255&t,0,0])},e.mp4a=function(t){return e.box(e.types.mp4a,e.audioStsd(t),e.box(e.types.esds,e.esds(t)))},e.mp3=function(t){return e.box(e.types[".mp3"],e.audioStsd(t))},e.ac3=function(t){return e.box(e.types["ac-3"],e.audioStsd(t),e.box(e.types.dac3,t.config))},e.stsd=function(t){return"audio"===t.type?"mp3"===t.segmentCodec&&"mp3"===t.codec?e.box(e.types.stsd,e.STSD,e.mp3(t)):"ac3"===t.segmentCodec?e.box(e.types.stsd,e.STSD,e.ac3(t)):e.box(e.types.stsd,e.STSD,e.mp4a(t)):e.box(e.types.stsd,e.STSD,e.avc1(t))},e.tkhd=function(t){var E=t.id,a=t.duration*t.timescale,i=t.width,o=t.height,_=Math.floor(a/(Ki+1)),n=Math.floor(a%(Ki+1));return e.box(e.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,E>>24&255,E>>16&255,E>>8&255,255&E,0,0,0,0,_>>24,_>>16&255,_>>8&255,255&_,n>>24,n>>16&255,n>>8&255,255&n,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>8&255,255&i,0,0,o>>8&255,255&o,0,0]))},e.traf=function(t,E){var a=e.sdtp(t),i=t.id,o=Math.floor(E/(Ki+1)),_=Math.floor(E%(Ki+1));return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])),e.box(e.types.tfdt,new Uint8Array([1,0,0,0,o>>24,o>>16&255,o>>8&255,255&o,_>>24,_>>16&255,_>>8&255,255&_])),e.trun(t,a.length+16+20+8+16+8+8),a)},e.trak=function(t){return t.duration=t.duration||4294967295,e.box(e.types.trak,e.tkhd(t),e.mdia(t))},e.trex=function(t){var E=t.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,E>>24,E>>16&255,E>>8&255,255&E,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},e.trun=function(t,E){var a,i,o,_,n,r,S=t.samples||[],T=S.length,s=12+16*T,I=new Uint8Array(s);for(E+=8+s,I.set(["video"===t.type?1:0,0,15,1,T>>>24&255,T>>>16&255,T>>>8&255,255&T,E>>>24&255,E>>>16&255,E>>>8&255,255&E],0),a=0;a>>24&255,o>>>16&255,o>>>8&255,255&o,_>>>24&255,_>>>16&255,_>>>8&255,255&_,n.isLeading<<2|n.dependsOn,n.isDependedOn<<6|n.hasRedundancy<<4|n.paddingValue<<1|n.isNonSync,61440&n.degradPrio,15&n.degradPrio,r>>>24&255,r>>>16&255,r>>>8&255,255&r],12+16*a);return e.box(e.types.trun,I)},e.initSegment=function(t){e.types||e.init();var E=e.moov(t);return Et(e.FTYP,E)},e})();zi.types=void 0,zi.HDLR_TYPES=void 0,zi.STTS=void 0,zi.STSC=void 0,zi.STCO=void 0,zi.STSZ=void 0,zi.VMHD=void 0,zi.SMHD=void 0,zi.STSD=void 0,zi.FTYP=void 0,zi.DINF=void 0;var ji=9e4;function xi(e,t,E,a){void 0===E&&(E=1),void 0===a&&(a=!1);var i=e*t*E;return a?Math.round(i):i}function Qi(e,t,E,a){return void 0===E&&(E=1),void 0===a&&(a=!1),xi(e,t,1/E,a)}function Xi(e,t){return void 0===t&&(t=!1),xi(e,1e3,1/ji,t)}function $i(e,t){return void 0===t&&(t=1),xi(e,ji,1/t)}var qi=1e4,Ji=1024,Zi=1152,eo=1536,to=null,Eo=null,ao=(function(){function e(e,t,E,a){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=E,this.ISGenerated=!1,null===to){var i=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);to=i?parseInt(i[1]):0}if(null===Eo){var o=navigator.userAgent.match(/Safari\/(\d+)/i);Eo=o?parseInt(o[1]):0}}var t=e.prototype;return t.destroy=function(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null},t.resetTimeStamp=function(e){y.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e},t.resetNextTimestamp=function(){y.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},t.resetInitSegment=function(){y.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0},t.getVideoStartPts=function(e){var t=!1,E=e.reduce(function(e,E){var a=E.pts-e;return a<-4294967296?(t=!0,io(e,E.pts)):a>0?e:E.pts},e[0].pts);return t&&y.debug("PTS rollover detected"),E},t.remux=function(e,t,E,a,i,o,_,n){var r,S,T,s,I,l,A=i,O=i,u=e.pid>-1,R=t.pid>-1,N=t.samples.length,d=e.samples.length>0,c=_&&N>0||N>1;if((!u||d)&&(!R||c)||this.ISGenerated||_){if(this.ISGenerated){var L,m,D,C,p=this.videoTrackConfig;!p||t.width===p.width&&t.height===p.height&&(null==(L=t.pixelRatio)?void 0:L[0])===(null==(m=p.pixelRatio)?void 0:m[0])&&(null==(D=t.pixelRatio)?void 0:D[1])===(null==(C=p.pixelRatio)?void 0:C[1])||this.resetInitSegment()}else T=this.generateIS(e,t,i,o);var P,B=this.isVideoContiguous,h=-1;if(c&&(h=oo(t.samples),!B&&this.config.forceKeyFrameOnDiscontinuity))if(l=!0,h>0){y.warn("[mp4-remuxer]: Dropped "+h+" out of "+N+" video samples due to a missing keyframe");var f=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(h),t.dropped+=h,P=O+=(t.samples[0].pts-f)/t.inputTimeScale}else-1===h&&(y.warn("[mp4-remuxer]: No keyframe found out of "+N+" video samples"),l=!1);if(this.ISGenerated){if(d&&c){var W=this.getVideoStartPts(t.samples),g=(io(e.samples[0].pts,W)-W)/t.inputTimeScale;A+=Math.max(0,g),O+=Math.max(0,-g)}if(d){if(e.samplerate||(y.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),T=this.generateIS(e,t,i,o)),S=this.remuxAudio(e,A,this.isAudioContiguous,o,R||c||n===$t.AUDIO?O:void 0),c){var M=S?S.endPTS-S.startPTS:0;t.inputTimeScale||(y.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),T=this.generateIS(e,t,i,o)),r=this.remuxVideo(t,O,B,M)}}else c&&(r=this.remuxVideo(t,O,B,0));r&&(r.firstKeyFrame=h,r.independent=-1!==h,r.firstKeyFramePTS=P)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(E.samples.length&&(I=_o(E,i,this._initPTS,this._initDTS)),a.samples.length&&(s=no(a,i,this._initPTS))),{audio:S,video:r,initSegment:T,independent:l,text:s,id3:I}},t.generateIS=function(e,t,E,a){var i,o,_,n=e.samples,r=t.samples,S=this.typeSupported,T={},s=this._initPTS,I=!s||a,l="audio/mp4";if(I&&(i=o=1/0),e.config&&n.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":S.mpeg?(l="audio/mpeg",e.codec=""):S.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3"}T.audio={id:"audio",container:l,codec:e.codec,initSegment:"mp3"===e.segmentCodec&&S.mpeg?new Uint8Array(0):zi.initSegment([e]),metadata:{channelCount:e.channelCount}},I&&(_=e.inputTimeScale,s&&_===s.timescale?I=!1:i=o=n[0].pts-Math.round(_*E))}if(t.sps&&t.pps&&r.length){if(t.timescale=t.inputTimeScale,T.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:zi.initSegment([t]),metadata:{width:t.width,height:t.height}},I)if(_=t.inputTimeScale,s&&_===s.timescale)I=!1;else{var A=this.getVideoStartPts(r),O=Math.round(_*E);o=Math.min(o,io(r[0].dts,A)-O),i=Math.min(i,A-O)}this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(T).length)return this.ISGenerated=!0,I?(this._initPTS={baseTime:i,timescale:_},this._initDTS={baseTime:o,timescale:_}):i=_=void 0,{tracks:T,initPTS:i,timescale:_}},t.remuxVideo=function(e,t,E,a){var i,o,_=e.inputTimeScale,n=e.samples,r=[],T=n.length,s=this._initPTS,I=this.nextAvcDts,l=8,A=this.videoSampleDuration,O=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY,R=!1;if(!E||null===I){var N=t*_,d=n[0].pts-io(n[0].dts,n[0].pts);to&&null!==I&&Math.abs(N-d-I)<15e3?E=!0:I=N-d}for(var c=s.baseTime*_/s.timescale,L=0;L0?L-1:L].dts&&(R=!0)}R&&n.sort(function(e,t){var E=e.dts-t.dts,a=e.pts-t.pts;return E||a}),i=n[0].dts;var D=(o=n[n.length-1].dts)-i,C=D?Math.round(D/(T-1)):A||e.inputTimeScale/30;if(E){var p=i-I,P=p>C,W=p<-1;if((P||W)&&(P?y.warn("AVC: "+Xi(p,!0)+" ms ("+p+"dts) hole between fragments detected at "+t.toFixed(3)):y.warn("AVC: "+Xi(-p,!0)+" ms ("+p+"dts) overlapping between fragments detected at "+t.toFixed(3)),!W||I>=n[0].pts||to)){i=I;var g=n[0].pts-p;if(P)n[0].dts=i,n[0].pts=g;else for(var M=0;Mg);M++)n[M].dts-=p,n[M].pts-=p;y.log("Video: Initial PTS/DTS adjusted: "+Xi(g,!0)+"/"+Xi(i,!0)+", delta: "+Xi(p,!0)+" ms")}}for(var v=0,U=0,G=i=Math.max(0,i),b=0;b0?J.dts-n[q-1].dts:C;if(_e=q>0?J.pts-n[q-1].pts:C,ne.stretchShortVideoTrack&&null!==this.nextAudioPts){var Se=Math.floor(ne.maxBufferHole*_),Te=(a?O+a*_:this.nextAudioPts)-J.pts;Te>Se?((A=Te-re)<0?A=re:j=!0,y.log("[mp4-remuxer]: It is approximately "+Te/90+" ms to the next segment; using duration "+A/90+" ms for the last video frame.")):A=re}else A=re}var se=Math.round(J.pts-J.dts);x=Math.min(x,A),X=Math.max(X,A),Q=Math.min(Q,_e),$=Math.max($,_e),r.push(new So(J.key,A,ee,se))}if(r.length)if(to){if(to<70){var Ie=r[0].flags;Ie.dependsOn=2,Ie.isNonSync=0}}else if(Eo&&$-Q0&&(a&&Math.abs(R-u)<9e3||Math.abs(io(A[0].pts-N,R)-u)<20*r),A.forEach(function(e){e.pts=io(e.pts-N,R)}),!E||u<0){if(A=A.filter(function(e){return e.pts>=0}),!A.length)return;u=0===i?0:a&&!l?Math.max(0,R):A[0].pts}if("aac"===e.segmentCodec)for(var d=this.config.maxAudioFramesDrift,c=0,L=u;c=d*r&&p0))return;b+=O;try{v=new Uint8Array(b)}catch(e){return void this.observer.emit(B.ERROR,B.ERROR,{type:h.MUX_ERROR,details:f.REMUX_ALLOC_ERROR,fatal:!1,error:e,bytes:b,reason:"fail allocating audio mdat "+b})}s||(new DataView(v.buffer).setUint32(0,b),v.set(zi.types.mdat,4))}v.set(Y,O);var K=Y.byteLength;O+=K,I.push(new So(!0,n,K,0)),G=w}var z=I.length;if(z){var j=I[I.length-1];this.nextAudioPts=u=G+_*j.duration;var x=s?new Uint8Array(0):zi.moof(e.sequenceNumber++,U/_,S({},e,{samples:I}));e.samples=[];var Q=U/o,X=u/o,$={data1:x,data2:v,startPTS:Q,endPTS:X,startDTS:Q,endDTS:X,type:"audio",hasAudio:!0,hasVideo:!1,nb:z};return this.isAudioContiguous=!0,$}},t.remuxEmptyAudio=function(e,t,E,a){var i=e.inputTimeScale,o=i/(e.samplerate?e.samplerate:i),_=this.nextAudioPts,n=this._initDTS,r=9e4*n.baseTime/n.timescale,S=(null!==_?_:a.startDTS*i)+r,T=a.endDTS*i+r,s=o*Ji,I=Math.ceil((T-S)/s),l=wi.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(y.warn("[mp4-remuxer]: remux empty Audio"),l){for(var A=[],O=0;O4294967296;)e+=E;return e}function oo(e){for(var t=0;t0?this.lastEndTime=N:(y.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var d=!!l.audio,c=!!l.video,L="";d&&(L+="audio"),c&&(L+="video");var m={data1:s,startPTS:R,startDTS:R,endPTS:N,endDTS:N,type:L,hasAudio:d,hasVideo:c,nb:1,dropped:0};return T.audio="audio"===m.type?m:void 0,T.video="audio"!==m.type?m:void 0,T.initSegment=I,T.id3=_o(E,i,r,r),a.samples.length&&(T.text=no(a,i,r)),T},e})();function so(e,t,E,a){if(null===e)return!0;var i=Math.max(a,1),o=t-e.baseTime/e.timescale;return Math.abs(o-E)>i}function Io(e,t){var E=null==e?void 0:e.codec;if(E&&E.length>4)return E;if(t===K.AUDIO){if("ec-3"===E||"ac-3"===E||"alac"===E)return E;if("fLaC"===E||"Opus"===E)return Mt(E,!1);var a="mp4a.40.5";return y.info('Parsed audio codec "'+E+'" or audio object type not handled. Using "'+a+'"'),a}return y.warn('Unhandled video codec "'+E+'"'),"hvc1"===E||"hev1"===E?"hvc1.1.6.L120.90":"av01"===E?"av01.0.04M.08":"avc1.42e01e"}try{ro=self.performance.now.bind(self.performance)}catch(e){y.debug("Unable to use Performance API on this environment"),ro=null==te?void 0:te.Date.now}var lo=[{demux:Bi,remux:To},{demux:yi,remux:ao},{demux:pi,remux:ao},{demux:Yi,remux:ao}];lo.splice(2,0,{demux:fi,remux:ao});var Ao=(function(){function e(e,t,E,a,i){this.async=!1,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=E,this.vendor=a,this.id=i}var t=e.prototype;return t.configure=function(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()},t.push=function(e,t,E,a){var i=this,o=E.transmuxing;o.executeStart=ro();var _=new Uint8Array(e),n=this.currentTransmuxState,r=this.transmuxConfig;a&&(this.currentTransmuxState=a);var S=a||n,T=S.contiguous,s=S.discontinuity,I=S.trackSwitch,l=S.accurateTimeOffset,A=S.timeOffset,O=S.initSegmentChange,u=r.audioCodec,R=r.videoCodec,N=r.defaultInitPts,d=r.duration,c=r.initSegmentData,L=Oo(_,t);if(L&&"AES-128"===L.method){var m=this.getDecrypter();if(!m.isSync())return this.decryptionPromise=m.webCryptoDecrypt(_,L.key.buffer,L.iv.buffer).then(function(e){var t=i.push(e,null,E);return i.decryptionPromise=null,t}),this.decryptionPromise;var D=m.softwareDecrypt(_,L.key.buffer,L.iv.buffer);if(E.part>-1&&(D=m.flush()),!D)return o.executeEnd=ro(),uo(E);_=new Uint8Array(D)}var C=this.needsProbing(s,I);if(C){var p=this.configureTransmuxer(_);if(p)return y.warn("[transmuxer] "+p.message),this.observer.emit(B.ERROR,B.ERROR,{type:h.MEDIA_ERROR,details:f.FRAG_PARSING_ERROR,fatal:!1,error:p,reason:p.message}),o.executeEnd=ro(),uo(E)}(s||I||O||C)&&this.resetInitSegment(c,u,R,d,t),(s||O||C)&&this.resetInitialTimestamp(N),T||this.resetContiguity();var P=this.transmux(_,L,A,l,E),W=this.currentTransmuxState;return W.contiguous=!0,W.discontinuity=!1,W.trackSwitch=!1,o.executeEnd=ro(),P},t.flush=function(e){var t=this,E=e.transmuxing;E.executeStart=ro();var a=this.decrypter,i=this.currentTransmuxState,o=this.decryptionPromise;if(o)return o.then(function(){return t.flush(e)});var _=[],n=i.timeOffset;if(a){var r=a.flush();r&&_.push(this.push(r,null,e))}var S=this.demuxer,T=this.remuxer;if(!S||!T)return E.executeEnd=ro(),[uo(e)];var s=S.flush(n);return Ro(s)?s.then(function(E){return t.flushRemux(_,E,e),_}):(this.flushRemux(_,s,e),_)},t.flushRemux=function(e,t,E){var a=t.audioTrack,i=t.videoTrack,o=t.id3Track,_=t.textTrack,n=this.currentTransmuxState,r=n.accurateTimeOffset,S=n.timeOffset;y.log("[transmuxer.ts]: Flushed fragment "+E.sn+(E.part>-1?" p: "+E.part:"")+" of level "+E.level);var T=this.remuxer.remux(a,i,o,_,S,r,!0,this.id);e.push({remuxResult:T,chunkMeta:E}),E.transmuxing.executeEnd=ro()},t.resetInitialTimestamp=function(e){var t=this.demuxer,E=this.remuxer;t&&E&&(t.resetTimeStamp(e),E.resetTimeStamp(e))},t.resetContiguity=function(){var e=this.demuxer,t=this.remuxer;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())},t.resetInitSegment=function(e,t,E,a,i){var o=this.demuxer,_=this.remuxer;o&&_&&(o.resetInitSegment(e,t,E,a),_.resetInitSegment(e,t,E,i))},t.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},t.transmux=function(e,t,E,a,i){return t&&"SAMPLE-AES"===t.method?this.transmuxSampleAes(e,t,E,a,i):this.transmuxUnencrypted(e,E,a,i)},t.transmuxUnencrypted=function(e,t,E,a){var i=this.demuxer.demux(e,t,!1,!this.config.progressive),o=i.audioTrack,_=i.videoTrack,n=i.id3Track,r=i.textTrack;return{remuxResult:this.remuxer.remux(o,_,n,r,t,E,!1,this.id),chunkMeta:a}},t.transmuxSampleAes=function(e,t,E,a,i){var o=this;return this.demuxer.demuxSampleAes(e,t,E).then(function(e){return{remuxResult:o.remuxer.remux(e.audioTrack,e.videoTrack,e.id3Track,e.textTrack,E,a,!1,o.id),chunkMeta:i}})},t.configureTransmuxer=function(e){for(var t,E=this.config,a=this.observer,i=this.typeSupported,o=this.vendor,_=0,n=lo.length;_0&&null!=(null==t?void 0:t.key)&&null!==t.iv&&null!=t.method&&(E=t),E}var uo=function(e){return{remuxResult:{},chunkMeta:e}};function Ro(e){return"then"in e&&e.then instanceof Function}var No=function(e,t,E,a,i){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=E,this.duration=a,this.defaultInitPts=i||null},co=function(e,t,E,a,i,o){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=E,this.trackSwitch=a,this.timeOffset=i,this.initSegmentChange=o},Lo={exports:{}};!(function(e){var t=Object.prototype.hasOwnProperty,E="~";function a(){}function i(e,t,E){this.fn=e,this.context=t,this.once=E||!1}function o(e,t,a,o,_){if("function"!=typeof a)throw new TypeError("The listener must be a function");var n=new i(a,o||e,_),r=E?E+t:t;return e._events[r]?e._events[r].fn?e._events[r]=[e._events[r],n]:e._events[r].push(n):(e._events[r]=n,e._eventsCount++),e}function _(e,t){0===--e._eventsCount?e._events=new a:delete e._events[t]}function n(){this._events=new a,this._eventsCount=0}Object.create&&(a.prototype=Object.create(null),(new a).__proto__||(E=!1)),n.prototype.eventNames=function(){var e,a,i=[];if(0===this._eventsCount)return i;for(a in e=this._events)t.call(e,a)&&i.push(E?a.slice(1):a);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},n.prototype.listeners=function(e){var t=E?E+e:e,a=this._events[t];if(!a)return[];if(a.fn)return[a.fn];for(var i=0,o=a.length,_=new Array(o);i1&&r.id===(null==u?void 0:u.stats.chunkCount),m=!N&&(1===d||0===d&&(1===c||L&&c<=0)),D=self.performance.now();(N||d||0===i.stats.parsing.start)&&(i.stats.parsing.start=D),!o||!c&&m||(o.stats.parsing.start=D);var C=!(u&&(null==(T=i.initSegment)?void 0:T.url)===(null==(s=u.initSegment)?void 0:s.url)),p=new co(R,m,n,N,A,C);if(!m||R||C){y.log("[transmuxer-interface, "+i.type+"]: Starting new transmux session for sn: "+r.sn+" p: "+r.part+" level: "+r.level+" id: "+r.id+"\n discontinuity: "+R+"\n trackSwitch: "+N+"\n contiguous: "+m+"\n accurateTimeOffset: "+n+"\n timeOffset: "+A+"\n initSegmentChange: "+C);var P=new No(E,a,t,_,S);this.configureTransmuxer(P)}if(this.frag=i,this.part=o,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:O,chunkMeta:r,state:p},e instanceof ArrayBuffer?[e]:[]);else if(l){var B=l.push(e,O,r,p);Ro(B)?(l.async=!0,B.then(function(e){I.handleTransmuxComplete(e)}).catch(function(e){I.transmuxerError(e,r,"transmuxer-interface push error")})):(l.async=!1,this.handleTransmuxComplete(B))}},t.flush=function(e){var t=this;e.transmuxing.start=self.performance.now();var E=this.transmuxer;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e});else if(E){var a=E.flush(e);Ro(a)||E.async?(Ro(a)||(a=Promise.resolve(a)),a.then(function(E){t.handleFlushResult(E,e)}).catch(function(E){t.transmuxerError(E,e,"transmuxer-interface flush error")})):this.handleFlushResult(a,e)}},t.transmuxerError=function(e,t,E){this.hls&&(this.error=e,this.hls.trigger(B.ERROR,{type:h.MEDIA_ERROR,details:f.FRAG_PARSING_ERROR,chunkMeta:t,fatal:!1,error:e,err:e,reason:E}))},t.handleFlushResult=function(e,t){var E=this;e.forEach(function(e){E.handleTransmuxComplete(e)}),this.onFlush(t)},t.onWorkerMessage=function(e){var t=e.data,E=this.hls;switch(t.event){case"init":var a,i=null==(a=this.workerContext)?void 0:a.objectURL;i&&self.URL.revokeObjectURL(i);break;case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;case"workerLog":y[t.data.logType]&&y[t.data.logType](t.data.message);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,E.trigger(t.event,t.data)}},t.configureTransmuxer=function(e){var t=this.transmuxer;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)},t.handleTransmuxComplete=function(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)},e})();function Mo(e,t){if(e.length!==t.length)return!1;for(var E=0;E0&&-1===e?(this.log("Override startPosition with lastCurrentTime @"+t.toFixed(3)),e=t,this.state=Xa.IDLE):(this.loadedmetadata=!1,this.state=Xa.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()},E.doTick=function(){switch(this.state){case Xa.IDLE:this.doTickIdle();break;case Xa.WAITING_TRACK:var t,E=this.levels,a=this.trackId,i=null==E||null==(t=E[a])?void 0:t.details;if(i){if(this.waitForCdnTuneIn(i))break;this.state=Xa.WAITING_INIT_PTS}break;case Xa.FRAG_LOADING_WAITING_RETRY:var o,_=performance.now(),n=this.retryDate;if(!n||_>=n||null!=(o=this.media)&&o.seeking){var r=this.levels,S=this.trackId;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((null==r?void 0:r[S])||null),this.state=Xa.IDLE}break;case Xa.WAITING_INIT_PTS:var T=this.waitingData;if(T){var s=T.frag,I=T.part,l=T.cache,A=T.complete;if(void 0!==this.initPTS[s.cc]){this.waitingData=null,this.waitingVideoCC=-1,this.state=Xa.FRAG_LOADING;var O={frag:s,part:I,payload:l.flush(),networkDetails:null};this._handleFragmentLoadProgress(O),A&&e.prototype._handleFragmentLoadComplete.call(this,O)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log("Waiting fragment cc ("+s.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var u=this.getLoadPosition(),R=Pa.bufferInfo(this.mediaBuffer,u,this.config.maxBufferHole);xE(R.end,this.config.maxFragLookUpTolerance,s)<0&&(this.log("Waiting fragment cc ("+s.cc+") @ "+s.start+" cancelled because another fragment at "+R.end+" is needed"),this.clearWaitingFragment())}}else this.state=Xa.IDLE}this.onTickEnd()},E.clearWaitingFragment=function(){var e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=Xa.IDLE)},E.resetLoadingState=function(){this.clearWaitingFragment(),e.prototype.resetLoadingState.call(this)},E.onTickEnd=function(){var e=this.media;null!=e&&e.readyState&&(this.lastCurrentTime=e.currentTime)},E.doTickIdle=function(){var e=this.hls,t=this.levels,E=this.media,a=this.trackId,i=e.config;if((E||!this.startFragRequested&&i.startFragPrefetch)&&null!=t&&t[a]){var o=t[a],_=o.details;if(!_||_.live&&this.levelLastLoaded!==o||this.waitForCdnTuneIn(_))this.state=Xa.WAITING_TRACK;else{var n=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&n&&(this.bufferFlushed=!1,this.afterBufferFlushed(n,K.AUDIO,$t.AUDIO));var r=this.getFwdBufferInfo(n,$t.AUDIO);if(null!==r){var S=this.bufferedTrack,T=this.switchingTrack;if(!T&&this._streamEnded(r,_))return e.trigger(B.BUFFER_EOS,{type:"audio"}),void(this.state=Xa.ENDED);var s=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,$t.MAIN),I=r.len,l=this.getMaxBufferLength(null==s?void 0:s.len),A=_.fragments,O=A[0].start,u=this.flushing?this.getLoadPosition():r.end;if(T&&E){var R=this.getLoadPosition();S&&!vo(T.attrs,S.attrs)&&(u=R),_.PTSKnown&&RO||r.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),E.currentTime=O+.05)}if(!(I>=l&&!T&&us.end+_.targetduration;if(c||(null==s||!s.len)&&r.len){var L=this.getAppendedFrag(N.start,$t.MAIN);if(null===L)return;if(d||(d=!!L.gap||!!c&&0===s.len),c&&!d||d&&r.nextStart&&r.nextStart-1)i=o[n];else{var r=la(_,this.tracks);i=this.tracks[r]}}var S=this.findTrackId(i);-1===S&&i&&(S=this.findTrackId(null));var T={audioTracks:o};this.log("Updating audio tracks, "+o.length+" track(s) found in group(s): "+(null==E?void 0:E.join(","))),this.hls.trigger(B.AUDIO_TRACKS_UPDATED,T);var s=this.trackId;if(-1!==S&&-1===s)this.setAudioTrack(S);else if(o.length&&-1===s){var I,l=new Error("No audio track selected for current audio group-ID(s): "+(null==(I=this.groupIds)?void 0:I.join(","))+" track count: "+o.length);this.warn(l.message),this.hls.trigger(B.ERROR,{type:h.MEDIA_ERROR,details:f.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:l})}}else this.shouldReloadPlaylist(i)&&this.setAudioTrack(this.trackId)}},E.onError=function(e,t){!t.fatal&&t.context&&(t.context.type!==Xt.AUDIO_TRACK||t.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(t.context.groupId)||(this.requestScheduled=-1,this.checkRetry(t)))},E.setAudioOption=function(e){var t=this.hls;if(t.config.audioPreference=e,e){var E=this.allAudioTracks;if(this.selectDefaultTrack=!1,E.length){var a=this.currentTrack;if(a&&Aa(e,a,ua))return a;var i=la(e,this.tracksInGroup,ua);if(i>-1){var o=this.tracksInGroup[i];return this.setAudioTrack(i),o}if(a){var _=t.loadLevel;-1===_&&(_=t.firstAutoLevel);var n=Ra(e,t.levels,E,_,ua);if(-1===n)return null;t.nextLoadLevel=n}if(e.channels||e.audioCodec){var r=la(e,E);if(r>-1)return E[r]}}}return null},E.setAudioTrack=function(e){var t=this.tracksInGroup;if(e<0||e>=t.length)this.warn("Invalid audio track id: "+e);else{this.clearTimer(),this.selectDefaultTrack=!1;var E=this.currentTrack,i=t[e],o=i.details&&!i.details.live;if(!(e===this.trackId&&i===E&&o||(this.log("Switching to audio-track "+e+' "'+i.name+'" lang:'+i.lang+" group:"+i.groupId+" channels:"+i.channels),this.trackId=e,this.currentTrack=i,this.hls.trigger(B.AUDIO_TRACK_SWITCHING,a({},i)),o))){var _=this.switchParams(i.url,null==E?void 0:E.details);this.loadPlaylist(_)}}},E.findTrackId=function(e){for(var t=this.tracksInGroup,E=0;E=i[n].start&&_<=i[n].end){o=i[n];break}var r=E.start+E.duration;o?o.end=r:(o={start:_,end:r},i.push(o)),this.fragmentTracker.fragBuffered(E),this.fragBufferedComplete(E,null)}}},E.onBufferFlushing=function(e,t){var E=t.startOffset,a=t.endOffset;if(0===E&&a!==Number.POSITIVE_INFINITY){var i=a-1;if(i<=0)return;t.endOffsetSubtitles=Math.max(0,i),this.tracksBuffered.forEach(function(e){for(var t=0;t=i.length||_!==a)&&n){this.log("Subtitle track "+_+" loaded ["+o.startSN+","+o.endSN+"]"+(o.lastPartSn?"[part-"+o.lastPartSn+"-"+o.lastPartIndex+"]":"")+",duration:"+o.totalduration),this.mediaBuffer=this.mediaBufferTimeRanges;var r=0;if(o.live||null!=(E=n.details)&&E.live){var S=this.mainDetails;if(o.deltaUpdateFailed||!S)return;var T,s=S.fragments[0];n.details?0===(r=this.alignPlaylists(o,n.details,null==(T=this.levelLastLoaded)?void 0:T.details))&&s&&ME(o,r=s.start):o.hasProgramDateTime&&S.hasProgramDateTime?(ya(o,S),r=o.fragments[0].start):s&&ME(o,r=s.start)}n.details=o,this.levelLastLoaded=n,this.startFragRequested||!this.mainDetails&&o.live||this.setStartPosition(this.mainDetails||o,r),this.tick(),o.live&&!this.fragCurrent&&this.media&&this.state===Xa.IDLE&&(jE(null,o.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),n.details=void 0))}}else this.warn("Subtitle tracks were reset while loading level "+_)},E._handleFragmentLoadComplete=function(e){var t=this,E=e.frag,a=e.payload,i=E.decryptdata,o=this.hls;if(!this.fragContextChanged(E)&&a&&a.byteLength>0&&null!=i&&i.key&&i.iv&&"AES-128"===i.method){var _=performance.now();this.decrypter.decrypt(new Uint8Array(a),i.key.buffer,i.iv.buffer).catch(function(e){throw o.trigger(B.ERROR,{type:h.MEDIA_ERROR,details:f.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:E}),e}).then(function(e){var t=performance.now();o.trigger(B.FRAG_DECRYPTED,{frag:E,payload:e,stats:{tstart:_,tdecrypt:t}})}).catch(function(e){t.warn(e.name+": "+e.message),t.state=Xa.IDLE})}},E.doTick=function(){if(this.media){if(this.state===Xa.IDLE){var e=this.currentTrackId,t=this.levels,E=null==t?void 0:t[e];if(!E||!t.length||!E.details)return;var a=this.config,i=this.getLoadPosition(),o=Pa.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],i,a.maxBufferHole),_=o.end,n=o.len,r=this.getFwdBufferInfo(this.media,$t.MAIN),S=E.details;if(n>this.getMaxBufferLength(null==r?void 0:r.len)+S.levelTargetDuration)return;var T=S.fragments,s=T.length,I=S.edge,l=null,A=this.fragPrevious;if(_I-O?0:O;!(l=jE(A,T,Math.max(T[0].start,_),u))&&A&&A.start>>=0)>a-1)throw new DOMException("Failed to execute '"+t+"' on 'TimeRanges': The index provided ("+E+") is greater than the maximum bound ("+a+")");return e[E][t]};this.buffered={get length(){return e.length},end:function(E){return t("end",E,e.length)},start:function(E){return t("start",E,e.length)}}},Ho=(function(e){function t(t){var E;return(E=e.call(this,t,"[subtitle-track-controller]")||this).media=null,E.tracks=[],E.groupIds=null,E.tracksInGroup=[],E.trackId=-1,E.currentTrack=null,E.selectDefaultTrack=!0,E.queuedDefaultTrack=-1,E.asyncPollTrackChange=function(){return E.pollTrackChange(0)},E.useTextTrackPolling=!1,E.subtitlePollingInterval=-1,E._subtitleDisplay=!0,E.onTextTracksChanged=function(){if(E.useTextTrackPolling||self.clearInterval(E.subtitlePollingInterval),E.media&&E.hls.config.renderTextTracksNatively){for(var e=null,t=_E(E.media.textTracks),a=0;a-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))},E.pollTrackChange=function(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)},E.onMediaDetaching=function(){this.media&&(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),_E(this.media.textTracks).forEach(function(e){EE(e)}),this.subtitleTrack=-1,this.media=null)},E.onManifestLoading=function(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0},E.onManifestParsed=function(e,t){this.tracks=t.subtitleTracks},E.onSubtitleTrackLoaded=function(e,t){var E=t.id,a=t.groupId,i=t.details,o=this.tracksInGroup[E];if(o&&o.groupId===a){var _=o.details;o.details=t.details,this.log("Subtitle track "+E+' "'+o.name+'" lang:'+o.lang+" group:"+a+" loaded ["+i.startSN+"-"+i.endSN+"]"),E===this.trackId&&this.playlistLoaded(E,t,_)}else this.warn("Subtitle track with id:"+E+" and group:"+a+" not found in active group "+(null==o?void 0:o.groupId))},E.onLevelLoading=function(e,t){this.switchLevel(t.level)},E.onLevelSwitching=function(e,t){this.switchLevel(t.level)},E.switchLevel=function(e){var t=this.hls.levels[e];if(t){var E=t.subtitleGroups||null,a=this.groupIds,i=this.currentTrack;if(!E||(null==a?void 0:a.length)!==(null==E?void 0:E.length)||null!=E&&E.some(function(e){return-1===(null==a?void 0:a.indexOf(e))})){this.groupIds=E,this.trackId=-1,this.currentTrack=null;var o=this.tracks.filter(function(e){return!E||-1!==E.indexOf(e.groupId)});if(o.length)this.selectDefaultTrack&&!o.some(function(e){return e.default})&&(this.selectDefaultTrack=!1),o.forEach(function(e,t){e.id=t});else if(!i&&!this.tracksInGroup.length)return;this.tracksInGroup=o;var _=this.hls.config.subtitlePreference;if(!i&&_){this.selectDefaultTrack=!1;var n=la(_,o);if(n>-1)i=o[n];else{var r=la(_,this.tracks);i=this.tracks[r]}}var S=this.findTrackId(i);-1===S&&i&&(S=this.findTrackId(null));var T={subtitleTracks:o};this.log("Updating subtitle tracks, "+o.length+' track(s) found in "'+(null==E?void 0:E.join(","))+'" group-id'),this.hls.trigger(B.SUBTITLE_TRACKS_UPDATED,T),-1!==S&&-1===this.trackId&&this.setSubtitleTrack(S)}else this.shouldReloadPlaylist(i)&&this.setSubtitleTrack(this.trackId)}},E.findTrackId=function(e){for(var t=this.tracksInGroup,E=this.selectDefaultTrack,a=0;a-1){var i=this.tracksInGroup[a];return this.setSubtitleTrack(a),i}if(E)return null;var o=la(e,t);if(o>-1)return t[o]}}return null},E.loadPlaylist=function(t){e.prototype.loadPlaylist.call(this);var E=this.currentTrack;if(this.shouldLoadPlaylist(E)&&E){var a=E.id,i=E.groupId,o=E.url;if(t)try{o=t.addDirectives(o)}catch(e){this.warn("Could not construct new URL with HLS Delivery Directives: "+e)}this.log("Loading subtitle playlist for id "+a),this.hls.trigger(B.SUBTITLE_TRACK_LOADING,{url:o,id:a,groupId:i,deliveryDirectives:t||null})}},E.toggleTrackModes=function(){var e=this.media;if(e){var t,E=_E(e.textTracks),a=this.currentTrack;if(a&&((t=E.filter(function(e){return Uo(a,e)})[0])||this.warn('Unable to find subtitle TextTrack with name "'+a.name+'" and language "'+a.lang+'"')),[].slice.call(E).forEach(function(e){"disabled"!==e.mode&&e!==t&&(e.mode="disabled")}),t){var i=this.subtitleDisplay?"showing":"hidden";t.mode!==i&&(t.mode=i)}}},E.setSubtitleTrack=function(e){var t=this.tracksInGroup;if(this.media)if(e<-1||e>=t.length||!C(e))this.warn("Invalid subtitle track id: "+e);else{this.clearTimer(),this.selectDefaultTrack=!1;var E=this.currentTrack,a=t[e]||null;if(this.trackId=e,this.currentTrack=a,this.toggleTrackModes(),a){var i=!!a.details&&!a.details.live;if(e!==this.trackId||a!==E||!i){this.log("Switching to subtitle-track "+e+(a?' "'+a.name+'" lang:'+a.lang+" group:"+a.groupId:""));var o=a.id,_=a.groupId,n=void 0===_?"":_,r=a.name,S=a.type,T=a.url;this.hls.trigger(B.SUBTITLE_TRACK_SWITCH,{id:o,groupId:n,name:r,type:S,url:T});var s=this.switchParams(a.url,null==E?void 0:E.details);this.loadPlaylist(s)}}else this.hls.trigger(B.SUBTITLE_TRACK_SWITCH,{id:e})}else this.queuedDefaultTrack=e},n(t,[{key:"subtitleDisplay",get:function(){return this._subtitleDisplay},set:function(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}},{key:"allSubtitleTracks",get:function(){return this.tracks}},{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}}]),t})(ZE),Yo=(function(){function e(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}var t=e.prototype;return t.append=function(e,t,E){var a=this.queues[t];a.push(e),1!==a.length||E||this.executeNext(t)},t.insertAbort=function(e,t){this.queues[t].unshift(e),this.executeNext(t)},t.appendBlocker=function(e){var t,E=new Promise(function(e){t=e}),a={execute:t,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(a,e),E},t.executeNext=function(e){var t=this.queues[e];if(t.length){var E=t[0];try{E.execute()}catch(t){y.warn('[buffer-operation-queue]: Exception executing "'+e+'" SourceBuffer operation: '+t),E.onError(t);var a=this.buffers[e];null!=a&&a.updating||this.shiftAndExecuteNext(e)}}},t.shiftAndExecuteNext=function(e){this.queues[e].shift(),this.executeNext(e)},t.current=function(e){return this.queues[e][0]},e})(),wo=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,Ko=(function(){function e(e){var t=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendSource=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this.log=void 0,this.warn=void 0,this.error=void 0,this._onEndStreaming=function(e){t.hls&&t.hls.pauseBuffering()},this._onStartStreaming=function(e){t.hls&&t.hls.resumeBuffering()},this._onMediaSourceOpen=function(){var e=t.media,E=t.mediaSource;t.log("Media source opened"),e&&(e.removeEventListener("emptied",t._onMediaEmptied),t.updateMediaElementDuration(),t.hls.trigger(B.MEDIA_ATTACHED,{media:e,mediaSource:E})),E&&E.removeEventListener("sourceopen",t._onMediaSourceOpen),t.checkPendingTracks()},this._onMediaSourceClose=function(){t.log("Media source closed")},this._onMediaSourceEnded=function(){t.log("Media source ended")},this._onMediaEmptied=function(){var e=t.mediaSrc,E=t._objectUrl;e!==E&&y.error("Media element src was set while attaching MediaSource ("+E+" > "+e+")")},this.hls=e;var E="[buffer-controller]";this.appendSource=e.config.preferManagedMediaSource,this.log=y.log.bind(y,E),this.warn=y.warn.bind(y,E),this.error=y.error.bind(y,E),this._initSourceBuffer(),this.registerListeners()}var t=e.prototype;return t.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},t.destroy=function(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.hls=null},t.registerListeners=function(){var e=this.hls;e.on(B.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(B.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(B.MANIFEST_LOADING,this.onManifestLoading,this),e.on(B.MANIFEST_PARSED,this.onManifestParsed,this),e.on(B.BUFFER_RESET,this.onBufferReset,this),e.on(B.BUFFER_APPENDING,this.onBufferAppending,this),e.on(B.BUFFER_CODECS,this.onBufferCodecs,this),e.on(B.BUFFER_EOS,this.onBufferEos,this),e.on(B.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(B.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(B.FRAG_PARSED,this.onFragParsed,this),e.on(B.FRAG_CHANGED,this.onFragChanged,this)},t.unregisterListeners=function(){var e=this.hls;e.off(B.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(B.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(B.MANIFEST_LOADING,this.onManifestLoading,this),e.off(B.MANIFEST_PARSED,this.onManifestParsed,this),e.off(B.BUFFER_RESET,this.onBufferReset,this),e.off(B.BUFFER_APPENDING,this.onBufferAppending,this),e.off(B.BUFFER_CODECS,this.onBufferCodecs,this),e.off(B.BUFFER_EOS,this.onBufferEos,this),e.off(B.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(B.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(B.FRAG_PARSED,this.onFragParsed,this),e.off(B.FRAG_CHANGED,this.onFragChanged,this)},t._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new Yo(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},this.lastMpegAudioChunk=null},t.onManifestLoading=function(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null},t.onManifestParsed=function(e,t){var E=2;(t.audio&&!t.video||!t.altAudio)&&(E=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=E,this.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},t.onMediaAttaching=function(e,t){var E=this.media=t.media,a=Lt(this.appendSource);if(E&&a){var i,o=this.mediaSource=new a;this.log("created media source: "+(null==(i=o.constructor)?void 0:i.name)),o.addEventListener("sourceopen",this._onMediaSourceOpen),o.addEventListener("sourceended",this._onMediaSourceEnded),o.addEventListener("sourceclose",this._onMediaSourceClose),o.addEventListener("startstreaming",this._onStartStreaming),o.addEventListener("endstreaming",this._onEndStreaming);var _=this._objectUrl=self.URL.createObjectURL(o);if(this.appendSource)try{E.removeAttribute("src");var n=self.ManagedMediaSource;E.disableRemotePlayback=E.disableRemotePlayback||n&&o instanceof n,zo(E),jo(E,_),E.load()}catch(e){E.src=_}else E.src=_;E.addEventListener("emptied",this._onMediaEmptied)}},t.onMediaDetaching=function(){var e=this.media,t=this.mediaSource,E=this._objectUrl;if(t){if(this.log("media source detaching"),"open"===t.readyState)try{t.endOfStream()}catch(e){this.warn("onMediaDetaching: "+e.message+" while calling endOfStream")}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming),e&&(e.removeEventListener("emptied",this._onMediaEmptied),E&&self.URL.revokeObjectURL(E),this.mediaSrc===E?(e.removeAttribute("src"),this.appendSource&&zo(e),e.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(B.MEDIA_DETACHED,void 0)},t.onBufferReset=function(){var e=this;this.getSourceBufferTypes().forEach(function(t){e.resetBuffer(t)}),this._initSourceBuffer()},t.resetBuffer=function(e){var t=this.sourceBuffer[e];try{var E;t&&(this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,null!=(E=this.mediaSource)&&E.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t))}catch(t){this.warn("onBufferReset "+e,t)}},t.onBufferCodecs=function(e,t){var E=this,a=this.getSourceBufferTypes().length,i=Object.keys(t);if(i.forEach(function(e){if(a){var i=E.tracks[e];if(i&&"function"==typeof i.buffer.changeType){var o,_=t[e],n=_.id,r=_.codec,S=_.levelCodec,T=_.container,s=_.metadata,I=vt(i.codec,i.levelCodec),l=null==I?void 0:I.replace(wo,"$1"),A=vt(r,S),O=null==(o=A)?void 0:o.replace(wo,"$1");if(A&&l!==O){"audio"===e.slice(0,5)&&(A=Mt(A,E.hls.config.preferManagedMediaSource));var u=T+";codecs="+A;E.appendChangeType(e,u),E.log("switching codec "+I+" to "+A),E.tracks[e]={buffer:i.buffer,codec:r,container:T,levelCodec:S,metadata:s,id:n}}}}else E.pendingTracks[e]=t[e]}),!a){var o=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==o&&(this.log(o+" bufferCodec event(s) expected "+i.join(",")),this.bufferCodecEventsExpected=o),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks()}},t.appendChangeType=function(e,t){var E=this,a=this.operationQueue,i={execute:function(){var i=E.sourceBuffer[e];i&&(E.log("changing "+e+" sourceBuffer type to "+t),i.changeType(t)),a.shiftAndExecuteNext(e)},onStart:function(){},onComplete:function(){},onError:function(t){E.warn("Failed to change "+e+" SourceBuffer type",t)}};a.append(i,e,!!this.pendingTracks[e])},t.onBufferAppending=function(e,t){var E=this,a=this.hls,i=this.operationQueue,o=this.tracks,_=t.data,n=t.type,r=t.frag,S=t.part,T=t.chunkMeta,s=T.buffering[n],I=self.performance.now();s.start=I;var l=r.stats.buffering,A=S?S.stats.buffering:null;0===l.start&&(l.start=I),A&&0===A.start&&(A.start=I);var O=o.audio,u=!1;"audio"===n&&"audio/mpeg"===(null==O?void 0:O.container)&&(u=!this.lastMpegAudioChunk||1===T.id||this.lastMpegAudioChunk.sn!==T.sn,this.lastMpegAudioChunk=T);var R=r.start,N={execute:function(){if(s.executeStart=self.performance.now(),u){var e=E.sourceBuffer[n];if(e){var t=R-e.timestampOffset;Math.abs(t)>=.1&&(E.log("Updating audio SourceBuffer timestampOffset to "+R+" (delta: "+t+") sn: "+r.sn+")"),e.timestampOffset=R)}}E.appendExecutor(_,n)},onStart:function(){},onComplete:function(){var e=self.performance.now();s.executeEnd=s.end=e,0===l.first&&(l.first=e),A&&0===A.first&&(A.first=e);var t=E.sourceBuffer,a={};for(var i in t)a[i]=Pa.getBuffered(t[i]);E.appendErrors[n]=0,"audio"===n||"video"===n?E.appendErrors.audiovideo=0:(E.appendErrors.audio=0,E.appendErrors.video=0),E.hls.trigger(B.BUFFER_APPENDED,{type:n,frag:r,part:S,chunkMeta:T,parent:r.type,timeRanges:a})},onError:function(e){var t={type:h.MEDIA_ERROR,parent:r.type,details:f.BUFFER_APPEND_ERROR,sourceBufferName:n,frag:r,part:S,chunkMeta:T,error:e,err:e,fatal:!1};if(e.code===DOMException.QUOTA_EXCEEDED_ERR)t.details=f.BUFFER_FULL_ERROR;else{var i=++E.appendErrors[n];t.details=f.BUFFER_APPEND_ERROR,E.warn("Failed "+i+"/"+a.config.appendErrorMaxRetry+' times to append segment in "'+n+'" sourceBuffer'),i>=a.config.appendErrorMaxRetry&&(t.fatal=!0)}a.trigger(B.ERROR,t)}};i.append(N,n,!!this.pendingTracks[n])},t.onBufferFlushing=function(e,t){var E=this,a=this.operationQueue,i=function(e){return{execute:E.removeExecutor.bind(E,e,t.startOffset,t.endOffset),onStart:function(){},onComplete:function(){E.hls.trigger(B.BUFFER_FLUSHED,{type:e})},onError:function(t){E.warn("Failed to remove from "+e+" SourceBuffer",t)}}};t.type?a.append(i(t.type),t.type):this.getSourceBufferTypes().forEach(function(e){a.append(i(e),e)})},t.onFragParsed=function(e,t){var E=this,a=t.frag,i=t.part,o=[],_=i?i.elementaryStreams:a.elementaryStreams;_[K.AUDIOVIDEO]?o.push("audiovideo"):(_[K.AUDIO]&&o.push("audio"),_[K.VIDEO]&&o.push("video"));var n=function(){var e=self.performance.now();a.stats.buffering.end=e,i&&(i.stats.buffering.end=e);var t=i?i.stats:a.stats;E.hls.trigger(B.FRAG_BUFFERED,{frag:a,part:i,stats:t,id:a.type})};0===o.length&&this.warn("Fragments must have at least one ElementaryStreamType set. type: "+a.type+" level: "+a.level+" sn: "+a.sn),this.blockBuffers(n,o)},t.onFragChanged=function(e,t){this.trimBuffers()},t.onBufferEos=function(e,t){var E=this;this.getSourceBufferTypes().reduce(function(e,a){var i=E.sourceBuffer[a];return!i||t.type&&t.type!==a||(i.ending=!0,i.ended||(i.ended=!0,E.log(a+" sourceBuffer now EOS"))),e&&!(i&&!i.ended)},!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers(function(){E.getSourceBufferTypes().forEach(function(e){var t=E.sourceBuffer[e];t&&(t.ending=!1)});var e=E.mediaSource;e&&"open"===e.readyState?(E.log("Calling mediaSource.endOfStream()"),e.endOfStream()):e&&E.log("Could not call mediaSource.endOfStream(). mediaSource.readyState: "+e.readyState)}))},t.onLevelUpdated=function(e,t){var E=t.details;E.fragments.length&&(this.details=E,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())},t.trimBuffers=function(){var e=this.hls,t=this.details,E=this.media;if(E&&null!==t&&this.getSourceBufferTypes().length){var a=e.config,i=E.currentTime,o=t.levelTargetDuration,_=t.live&&null!==a.liveBackBufferLength?a.liveBackBufferLength:a.backBufferLength;if(C(_)&&_>0){var n=Math.max(_,o),r=Math.floor(i/o)*o-n;this.flushBackBuffer(i,o,r)}if(C(a.frontBufferFlushThreshold)&&a.frontBufferFlushThreshold>0){var S=Math.max(a.maxBufferLength,a.frontBufferFlushThreshold),T=Math.max(S,o),s=Math.floor(i/o)*o+T;this.flushFrontBuffer(i,o,s)}}},t.flushBackBuffer=function(e,t,E){var a=this,i=this.details,o=this.sourceBuffer;this.getSourceBufferTypes().forEach(function(_){var n=o[_];if(n){var r=Pa.getBuffered(n);if(r.length>0&&E>r.start(0)){if(a.hls.trigger(B.BACK_BUFFER_REACHED,{bufferEnd:E}),null!=i&&i.live)a.hls.trigger(B.LIVE_BACK_BUFFER_REACHED,{bufferEnd:E});else if(n.ended&&r.end(r.length-1)-e<2*t)return void a.log("Cannot flush "+_+" back buffer while SourceBuffer is in ended state");a.hls.trigger(B.BUFFER_FLUSHING,{startOffset:0,endOffset:E,type:_})}}})},t.flushFrontBuffer=function(e,t,E){var a=this,i=this.sourceBuffer;this.getSourceBufferTypes().forEach(function(o){var _=i[o];if(_){var n=Pa.getBuffered(_),r=n.length;if(r<2)return;var S=n.start(r-1),T=n.end(r-1);if(E>S||e>=S&&e<=T)return;if(_.ended&&e-T<2*t)return void a.log("Cannot flush "+o+" front buffer while SourceBuffer is in ended state");a.hls.trigger(B.BUFFER_FLUSHING,{startOffset:S,endOffset:1/0,type:o})}})},t.updateMediaElementDuration=function(){if(this.details&&this.media&&this.mediaSource&&"open"===this.mediaSource.readyState){var e=this.details,t=this.hls,E=this.media,a=this.mediaSource,i=e.fragments[0].start+e.totalduration,o=E.duration,_=C(a.duration)?a.duration:0;e.live&&t.config.liveDurationInfinity?(a.duration=1/0,this.updateSeekableRange(e)):(i>_&&i>o||!C(o))&&(this.log("Updating Media Source duration to "+i.toFixed(3)),a.duration=i)}},t.updateSeekableRange=function(e){var t=this.mediaSource,E=e.fragments;if(E.length&&e.live&&null!=t&&t.setLiveSeekableRange){var a=Math.max(0,E[0].start),i=Math.max(a,a+e.totalduration);this.log("Media Source duration is set to "+t.duration+". Setting seekable range to "+a+"-"+i+"."),t.setLiveSeekableRange(a,i)}},t.checkPendingTracks=function(){var e=this.bufferCodecEventsExpected,t=this.operationQueue,E=this.pendingTracks,a=Object.keys(E).length;if(a&&(!e||2===a||"audiovideo"in E)){this.createSourceBuffers(E),this.pendingTracks={};var i=this.getSourceBufferTypes();if(i.length)this.hls.trigger(B.BUFFER_CREATED,{tracks:this.tracks}),i.forEach(function(e){t.executeNext(e)});else{var o=new Error("could not create source buffer for media codec(s)");this.hls.trigger(B.ERROR,{type:h.MEDIA_ERROR,details:f.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:o,reason:o.message})}}},t.createSourceBuffers=function(e){var t=this,E=this.sourceBuffer,a=this.mediaSource;if(!a)throw Error("createSourceBuffers called when mediaSource was null");var i=function(i){if(!E[i]){var o=e[i];if(!o)throw Error("source buffer exists for track "+i+", however track does not");var _=o.levelCodec||o.codec;_&&"audio"===i.slice(0,5)&&(_=Mt(_,t.hls.config.preferManagedMediaSource));var n=o.container+";codecs="+_;t.log("creating sourceBuffer("+n+")");try{var r=E[i]=a.addSourceBuffer(n),S=i;t.addBufferListener(S,"updatestart",t._onSBUpdateStart),t.addBufferListener(S,"updateend",t._onSBUpdateEnd),t.addBufferListener(S,"error",t._onSBUpdateError),t.addBufferListener(S,"bufferedchange",function(e,E){var a=E.removedRanges;null!=a&&a.length&&t.hls.trigger(B.BUFFER_FLUSHED,{type:i})}),t.tracks[i]={buffer:r,codec:_,container:o.container,levelCodec:o.levelCodec,metadata:o.metadata,id:o.id}}catch(e){t.error("error while trying to add sourceBuffer: "+e.message),t.hls.trigger(B.ERROR,{type:h.MEDIA_ERROR,details:f.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,sourceBufferName:i,mimeType:n})}}};for(var o in e)i(o)},t._onSBUpdateStart=function(e){this.operationQueue.current(e).onStart()},t._onSBUpdateEnd=function(e){var t;if("closed"!==(null==(t=this.mediaSource)?void 0:t.readyState)){var E=this.operationQueue;E.current(e).onComplete(),E.shiftAndExecuteNext(e)}else this.resetBuffer(e)},t._onSBUpdateError=function(e,t){var E,a=new Error(e+" SourceBuffer error. MediaSource readyState: "+(null==(E=this.mediaSource)?void 0:E.readyState));this.error(""+a,t),this.hls.trigger(B.ERROR,{type:h.MEDIA_ERROR,details:f.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:a,fatal:!1});var i=this.operationQueue.current(e);i&&i.onError(a)},t.removeExecutor=function(e,t,E){var a=this.media,i=this.mediaSource,o=this.operationQueue,_=this.sourceBuffer[e];if(!a||!i||!_)return this.warn("Attempting to remove from the "+e+" SourceBuffer, but it does not exist"),void o.shiftAndExecuteNext(e);var n=C(a.duration)?a.duration:1/0,r=C(i.duration)?i.duration:1/0,S=Math.max(0,t),T=Math.min(E,n,r);T>S&&(!_.ending||_.ended)?(_.ended=!1,this.log("Removing ["+S+","+T+"] from the "+e+" SourceBuffer"),_.remove(S,T)):o.shiftAndExecuteNext(e)},t.appendExecutor=function(e,t){var E=this.sourceBuffer[t];if(E)E.ended=!1,E.appendBuffer(e);else if(!this.pendingTracks[t])throw new Error("Attempting to append to the "+t+" SourceBuffer, but it does not exist")},t.blockBuffers=function(e,t){var E=this;if(void 0===t&&(t=this.getSourceBufferTypes()),!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve().then(e);var a=this.operationQueue,i=t.map(function(e){return a.appendBlocker(e)});Promise.all(i).then(function(){e(),t.forEach(function(e){var t=E.sourceBuffer[e];null!=t&&t.updating||a.shiftAndExecuteNext(e)})})},t.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},t.addBufferListener=function(e,t,E){var a=this.sourceBuffer[e];if(a){var i=E.bind(this,e);this.listeners[e].push({event:t,listener:i}),a.addEventListener(t,i)}},t.removeBufferListeners=function(e){var t=this.sourceBuffer[e];t&&this.listeners[e].forEach(function(e){t.removeEventListener(e.event,e.listener)})},n(e,[{key:"mediaSrc",get:function(){var e,t=(null==(e=this.media)?void 0:e.firstChild)||this.media;return null==t?void 0:t.src}}]),e})();function zo(e){var t=e.querySelectorAll("source");[].slice.call(t).forEach(function(t){e.removeChild(t)})}function jo(e,t){var E=self.document.createElement("source");E.type="video/mp4",E.src=t,e.appendChild(E)}var xo={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},Qo=function(e){var t=e;return xo.hasOwnProperty(e)&&(t=xo[e]),String.fromCharCode(t)},Xo=15,$o=100,qo={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Jo={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Zo={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},e_={25:2,26:4,29:6,30:8,31:10,27:13,28:15},t_=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],E_=(function(){function e(){this.time=null,this.verboseLevel=0}return e.prototype.log=function(e,t){if(this.verboseLevel>=e){var E="function"==typeof t?t():t;y.log(this.time+" ["+e+"] "+E)}},e})(),a_=function(e){for(var t=[],E=0;E$o&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=$o)},t.moveCursor=function(e){var t=this.pos+e;if(e>1)for(var E=this.pos+1;E=144&&this.backSpace();var E=Qo(e);this.pos>=$o?this.logger.log(0,function(){return"Cannot insert "+e.toString(16)+" ("+E+") at position "+t.pos+". Skipping it!"}):(this.chars[this.pos].setChar(E,this.currPenState),this.moveCursor(1))},t.clearFromPos=function(e){var t;for(t=e;t<$o;t++)this.chars[t].reset()},t.clear=function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()},t.clearToEndOfRow=function(){this.clearFromPos(this.pos)},t.getTextString=function(){for(var e=[],t=!0,E=0;E<$o;E++){var a=this.chars[E].uchar;" "!==a&&(t=!1),e.push(a)}return t?"":e.join("")},t.setPenStyles=function(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)},e})(),n_=(function(){function e(e){this.rows=[],this.currRow=Xo-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(var t=0;t0&&(E=e?"["+t.join(" | ")+"]":t.join("\n")),E},t.getTextAndFormat=function(){return this.rows},e})(),r_=(function(){function e(e,t,E){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new n_(E),this.nonDisplayedMemory=new n_(E),this.lastOutputScreen=new n_(E),this.currRollUpRow=this.displayedMemory.rows[Xo-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=E}var t=e.prototype;return t.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[Xo-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},t.getHandler=function(){return this.outputFilter},t.setHandler=function(e){this.outputFilter=e},t.setPAC=function(e){this.writeScreen.setPAC(e)},t.setBkgData=function(e){this.writeScreen.setBkgData(e)},t.setMode=function(e){e!==this.mode&&(this.mode=e,this.logger.log(2,function(){return"MODE="+e}),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)},t.insertChars=function(e){for(var t=this,E=0;E=46,t.italics)t.foreground="white";else{var E=Math.floor(e/2)-16,a=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=a[E]}this.logger.log(2,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)},t.outputDataUpdate=function(e){void 0===e&&(e=!1);var t=this.logger.time;null!==t&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))},t.cueSplitAtTime=function(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))},e})(),S_=(function(){function e(e,t,E){this.channels=void 0,this.currentChannel=0,this.cmdHistory=I_(),this.logger=void 0;var a=this.logger=new E_;this.channels=[null,new r_(e,t,a),new r_(e+1,E,a)]}var t=e.prototype;return t.getHandler=function(e){return this.channels[e].getHandler()},t.setHandler=function(e,t){this.channels[e].setHandler(t)},t.addData=function(e,t){var E,a,i,o=!1;this.logger.time=e;for(var _=0;_ ("+a_([a,i])+")"),(E=this.parseCmd(a,i))||(E=this.parseMidrow(a,i)),E||(E=this.parsePAC(a,i)),E||(E=this.parseBackgroundAttributes(a,i)),!E&&(o=this.parseChars(a,i))){var n=this.currentChannel;n&&n>0?this.channels[n].insertChars(o):this.logger.log(2,"No channel found yet. TEXT-MODE?")}E||o||this.logger.log(2,"Couldn't parse cleaned data "+a_([a,i])+" orig: "+a_([t[_],t[_+1]]))}},t.parseCmd=function(e,t){var E=this.cmdHistory;if(!((20===e||28===e||21===e||29===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=33&&t<=35))return!1;if(s_(e,t,E))return T_(null,null,E),this.logger.log(3,"Repeated command ("+a_([e,t])+") is dropped"),!0;var a=20===e||21===e||23===e?1:2,i=this.channels[a];return 20===e||21===e||28===e||29===e?32===t?i.ccRCL():33===t?i.ccBS():34===t?i.ccAOF():35===t?i.ccAON():36===t?i.ccDER():37===t?i.ccRU(2):38===t?i.ccRU(3):39===t?i.ccRU(4):40===t?i.ccFON():41===t?i.ccRDC():42===t?i.ccTR():43===t?i.ccRTD():44===t?i.ccEDM():45===t?i.ccCR():46===t?i.ccENM():47===t&&i.ccEOC():i.ccTO(t-32),T_(e,t,E),this.currentChannel=a,!0},t.parseMidrow=function(e,t){var E=0;if((17===e||25===e)&&t>=32&&t<=47){if((E=17===e?1:2)!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;var a=this.channels[E];return!!a&&(a.ccMIDROW(t),this.logger.log(3,"MIDROW ("+a_([e,t])+")"),!0)}return!1},t.parsePAC=function(e,t){var E,a=this.cmdHistory;if(!((e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127||(16===e||24===e)&&t>=64&&t<=95))return!1;if(s_(e,t,a))return T_(null,null,a),!0;var i=e<=23?1:2;E=t>=64&&t<=95?1===i?qo[e]:Zo[e]:1===i?Jo[e]:e_[e];var o=this.channels[i];return!!o&&(o.setPAC(this.interpretPAC(E,t)),T_(e,t,a),this.currentChannel=i,!0)},t.interpretPAC=function(e,t){var E,a={color:null,italics:!1,indent:null,underline:!1,row:e};return E=t>95?t-96:t-64,a.underline=!(1&~E),E<=13?a.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(E/2)]:E<=15?(a.italics=!0,a.color="white"):a.indent=4*Math.floor((E-16)/2),a},t.parseChars=function(e,t){var E,a,i=null,o=null;if(e>=25?(E=2,o=e-8):(E=1,o=e),o>=17&&o<=19?(a=17===o?t+80:18===o?t+112:t+144,this.logger.log(2,"Special char '"+Qo(a)+"' in channel "+E),i=[a]):e>=32&&e<=127&&(i=0===t?[e]:[e,t]),i){var _=a_(i);this.logger.log(3,"Char codes = "+_.join(",")),T_(e,t,this.cmdHistory)}return i},t.parseBackgroundAttributes=function(e,t){var E;if(!((16===e||24===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=45&&t<=47))return!1;var a={};16===e||24===e?(E=Math.floor((t-32)/2),a.background=t_[E],t%2==1&&(a.background=a.background+"_semi")):45===t?a.background="transparent":(a.foreground="black",47===t&&(a.underline=!0));var i=e<=23?1:2;return this.channels[i].setBkgData(a),T_(e,t,this.cmdHistory),!0},t.reset=function(){for(var e=0;ee)&&(this.startTime=e),this.endTime=t,this.screen=E,this.timelineController.createCaptionsTrack(this.trackName)},t.reset=function(){this.cueRanges=[],this.startTime=null},e})(),A_=(function(){if(null!=te&&te.VTTCue)return self.VTTCue;var e=["","lr","rl"],t=["start","middle","end","left","right"];function E(e,t){if("string"!=typeof t)return!1;if(!Array.isArray(e))return!1;var E=t.toLowerCase();return!!~e.indexOf(E)&&E}function a(t){return E(e,t)}function i(e){return E(t,e)}function o(e){for(var t=arguments.length,E=new Array(t>1?t-1:0),a=1;a100)throw new Error("Position must be between 0 and 100.");N=e,this.hasBeenReset=!0}})),Object.defineProperty(_,"positionAlign",o({},n,{get:function(){return d},set:function(e){var t=i(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");d=t,this.hasBeenReset=!0}})),Object.defineProperty(_,"size",o({},n,{get:function(){return c},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");c=e,this.hasBeenReset=!0}})),Object.defineProperty(_,"align",o({},n,{get:function(){return L},set:function(e){var t=i(e);if(!t)throw new SyntaxError("An invalid or illegal string was specified.");L=t,this.hasBeenReset=!0}})),_.displayState=void 0}return _.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},_})(),O_=(function(){function e(){}return e.prototype.decode=function(e,t){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))},e})();function u_(e){function t(e,t,E,a){return 3600*(0|e)+60*(0|t)+(0|E)+parseFloat(a||0)}var E=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return E?parseFloat(E[2])>59?t(E[2],E[3],0,E[4]):t(E[1],E[2],E[3],E[4]):null}var R_=(function(){function e(){this.values=Object.create(null)}var t=e.prototype;return t.set=function(e,t){this.get(e)||""===t||(this.values[e]=t)},t.get=function(e,t,E){return E?this.has(e)?this.values[e]:t[E]:this.has(e)?this.values[e]:t},t.has=function(e){return e in this.values},t.alt=function(e,t,E){for(var a=0;a=0&&E<=100)return this.set(e,E),!0}return!1},e})();function N_(e,t,E,a){var i=a?e.split(a):[e];for(var o in i)if("string"==typeof i[o]){var _=i[o].split(E);2===_.length&&t(_[0],_[1])}}var d_=new A_(0,0,""),c_="middle"===d_.align?"middle":"center";function L_(e,t,E){var a=e;function i(){var t=u_(e);if(null===t)throw new Error("Malformed timestamp: "+a);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function o(e,t){var a=new R_;N_(e,function(e,t){var i;switch(e){case"region":for(var o=E.length-1;o>=0;o--)if(E[o].id===t){a.set(e,E[o].region);break}break;case"vertical":a.alt(e,t,["rl","lr"]);break;case"line":i=t.split(","),a.integer(e,i[0]),a.percent(e,i[0])&&a.set("snapToLines",!1),a.alt(e,i[0],["auto"]),2===i.length&&a.alt("lineAlign",i[1],["start",c_,"end"]);break;case"position":i=t.split(","),a.percent(e,i[0]),2===i.length&&a.alt("positionAlign",i[1],["start",c_,"end","line-left","line-right","auto"]);break;case"size":a.percent(e,t);break;case"align":a.alt(e,t,["start",c_,"end","left","right"])}},/:/,/\s/),t.region=a.get("region",null),t.vertical=a.get("vertical","");var i=a.get("line","auto");"auto"===i&&-1===d_.line&&(i=-1),t.line=i,t.lineAlign=a.get("lineAlign","start"),t.snapToLines=a.get("snapToLines",!0),t.size=a.get("size",100),t.align=a.get("align",c_);var o=a.get("position","auto");"auto"===o&&50===d_.position&&(o="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=o}function _(){e=e.replace(/^\s+/,"")}if(_(),t.startTime=i(),_(),"--\x3e"!==e.slice(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+a);e=e.slice(3),_(),t.endTime=i(),_(),o(e,t)}function m_(e){return e.replace(//gi,"\n")}var D_=(function(){function e(){this.state="INITIAL",this.buffer="",this.decoder=new O_,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var t=e.prototype;return t.parse=function(e){var t=this;function E(){var e=t.buffer,E=0;for(e=m_(e);E9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!(C(t)&&C(E)&&C(a)&&C(i)))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+e);return t+=1e3*E,t+=6e4*a,t+=36e5*i},B_=function(e){for(var t=5381,E=e.length;E;)t=33*t^e.charCodeAt(--E);return(t>>>0).toString()};function h_(e,t,E){return B_(e.toString())+B_(t.toString())+B_(E)}var f_=function(e,t,E){var a=e[t],i=e[a.prevCC];if(!i||!i.new&&a.new)return e.ccOffset=e.presentationOffset=a.start,void(a.new=!1);for(;null!=(o=i)&&o.new;){var o;e.ccOffset+=a.start-i.start,a.new=!1,i=e[(a=i).prevCC]}e.presentationOffset=E};function W_(e,t,E,a,i,o,_){var n,r=new D_,S=fe(new Uint8Array(e)).trim().replace(C_,"\n").split("\n"),T=[],s=t?$i(t.baseTime,t.timescale):0,I="00:00.000",l=0,A=0,O=!0;r.oncue=function(e){var o=E[a],_=E.ccOffset,r=(l-s)/9e4;if(null!=o&&o.new&&(void 0!==A?_=E.ccOffset=o.start:f_(E,a,r)),r){if(!t)return void(n=new Error("Missing initPTS for VTT MPEGTS"));_=r-E.presentationOffset}var S=e.endTime-e.startTime,I=io(9e4*(e.startTime+_-A),9e4*i)/9e4;e.startTime=Math.max(I,0),e.endTime=Math.max(I+S,0);var O=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(O)),e.id||(e.id=h_(e.startTime,e.endTime,O)),e.endTime>0&&T.push(e)},r.onparsingerror=function(e){n=e},r.onflush=function(){n?_(n):o(T)},S.forEach(function(e){if(O){if(p_(e,"X-TIMESTAMP-MAP=")){O=!1,e.slice(16).split(",").forEach(function(e){p_(e,"LOCAL:")?I=e.slice(6):p_(e,"MPEGTS:")&&(l=parseInt(e.slice(7)))});try{A=P_(I)/1e3}catch(e){n=e}return}""===e&&(O=!1)}r.parse(e+"\n")}),r.flush()}var g_="stpp.ttml.im1t",M_=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,v_=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,U_={left:"start",center:"center",right:"end",start:"start",end:"end"};function G_(e,t,E,a){var i=Ye(new Uint8Array(e),["mdat"]);if(0!==i.length){var o=i.map(function(e){return fe(e)}),_=Qi(t.baseTime,1,t.timescale);try{o.forEach(function(e){return E(y_(e,_))})}catch(e){a(e)}}else a(new Error("Could not parse IMSC1 mdat"))}function y_(e,t){var E=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("tt")[0];if(!E)throw new Error("Invalid ttml");var a={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},i=Object.keys(a).reduce(function(e,t){return e[t]=E.getAttribute("ttp:"+t)||a[t],e},{}),o="preserve"!==E.getAttribute("xml:space"),_=k_(b_(E,"styling","style")),n=k_(b_(E,"layout","region")),r=b_(E,"body","[begin]");return[].map.call(r,function(e){var E=F_(e,o);if(!E||!e.hasAttribute("begin"))return null;var a=w_(e.getAttribute("begin"),i),r=w_(e.getAttribute("dur"),i),T=w_(e.getAttribute("end"),i);if(null===a)throw Y_(e);if(null===T){if(null===r)throw Y_(e);T=a+r}var s=new A_(a-t,T-t,E);s.id=h_(s.startTime,s.endTime,s.text);var I=V_(n[e.getAttribute("region")],_[e.getAttribute("style")],_),l=I.textAlign;if(l){var A=U_[l];A&&(s.lineAlign=A),s.align=l}return S(s,I),s}).filter(function(e){return null!==e})}function b_(e,t,E){var a=e.getElementsByTagName(t)[0];return a?[].slice.call(a.querySelectorAll(E)):[]}function k_(e){return e.reduce(function(e,t){var E=t.getAttribute("xml:id");return E&&(e[E]=t),e},{})}function F_(e,t){return[].slice.call(e.childNodes).reduce(function(e,E,a){var i;return"br"===E.nodeName&&a?e+"\n":null!=(i=E.childNodes)&&i.length?F_(E,t):t?e+E.textContent.trim().replace(/\s+/g," "):e+E.textContent},"")}function V_(e,t,E){var a="http://www.w3.org/ns/ttml#styling",i=null,o=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],_=null!=e&&e.hasAttribute("style")?e.getAttribute("style"):null;return _&&E.hasOwnProperty(_)&&(i=E[_]),o.reduce(function(E,o){var _=H_(t,a,o)||H_(e,a,o)||H_(i,a,o);return _&&(E[o]=_),E},{})}function H_(e,t,E){return e&&e.hasAttributeNS(t,E)?e.getAttributeNS(t,E):null}function Y_(e){return new Error("Could not parse ttml timestamp "+e)}function w_(e,t){if(!e)return null;var E=u_(e);return null===E&&(M_.test(e)?E=K_(e,t):v_.test(e)&&(E=z_(e,t))),E}function K_(e,t){var E=M_.exec(e),a=(0|E[4])+(0|E[5])/t.subFrameRate;return 3600*(0|E[1])+60*(0|E[2])+(0|E[3])+a/t.frameRate}function z_(e,t){var E=v_.exec(e),a=Number(E[1]);switch(E[2]){case"h":return 3600*a;case"m":return 60*a;case"ms":return 1e3*a;case"f":return a/t.frameRate;case"t":return a/t.tickRate}return a}var j_=(function(){function e(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=$_(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(B.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(B.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(B.MANIFEST_LOADING,this.onManifestLoading,this),e.on(B.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(B.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(B.FRAG_LOADING,this.onFragLoading,this),e.on(B.FRAG_LOADED,this.onFragLoaded,this),e.on(B.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(B.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(B.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(B.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(B.BUFFER_FLUSHING,this.onBufferFlushing,this)}var t=e.prototype;return t.destroy=function(){var e=this.hls;e.off(B.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(B.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(B.MANIFEST_LOADING,this.onManifestLoading,this),e.off(B.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(B.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(B.FRAG_LOADING,this.onFragLoading,this),e.off(B.FRAG_LOADED,this.onFragLoaded,this),e.off(B.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(B.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(B.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(B.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(B.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=null,this.cea608Parser1=this.cea608Parser2=void 0},t.initCea608Parsers=function(){if(this.config.enableCEA708Captions&&(!this.cea608Parser1||!this.cea608Parser2)){var e=new l_(this,"textTrack1"),t=new l_(this,"textTrack2"),E=new l_(this,"textTrack3"),a=new l_(this,"textTrack4");this.cea608Parser1=new S_(1,e,t),this.cea608Parser2=new S_(3,E,a)}},t.addCues=function(e,t,E,a,i){for(var o=!1,_=i.length;_--;){var n=i[_],r=X_(n[0],n[1],t,E);if(r>=0&&(n[0]=Math.min(n[0],t),n[1]=Math.max(n[1],E),o=!0,r/(E-t)>.5))return}if(o||i.push([t,E]),this.config.renderTextTracksNatively){var S=this.captionsTracks[e];this.Cues.newCue(S,t,E,a)}else{var T=this.Cues.newCue(null,t,E,a);this.hls.trigger(B.CUES_PARSED,{type:"captions",cues:T,track:e})}},t.onInitPtsFound=function(e,t){var E=this,a=t.frag,i=t.id,o=t.initPTS,_=t.timescale,n=this.unparsedVttFrags;"main"===i&&(this.initPTS[a.cc]={baseTime:o,timescale:_}),n.length&&(this.unparsedVttFrags=[],n.forEach(function(e){E.onFragLoaded(B.FRAG_LOADED,e)}))},t.getExistingTrack=function(e,t){var E=this.media;if(E)for(var a=0;aa.cc||r.trigger(B.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:a,error:t})})}else _.push(e)},t._fallbackToIMSC1=function(e,t){var E=this,a=this.tracks[e.level];a.textCodec||G_(t,this.initPTS[e.cc],function(){a.textCodec=g_,E._parseIMSC1(e,t)},function(){a.textCodec="wvtt"})},t._appendCues=function(e,t){var E=this.hls;if(this.config.renderTextTracksNatively){var a=this.textTracks[t];if(!a||"disabled"===a.mode)return;e.forEach(function(e){return tE(a,e)})}else{var i=this.tracks[t];if(!i)return;var o=i.default?"default":"subtitles"+t;E.trigger(B.CUES_PARSED,{type:"subtitles",cues:e,track:o})}},t.onFragDecrypted=function(e,t){t.frag.type===$t.SUBTITLE&&this.onFragLoaded(B.FRAG_LOADED,t)},t.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},t.onFragParsingUserdata=function(e,t){this.initCea608Parsers();var E=this.cea608Parser1,a=this.cea608Parser2;if(this.enabled&&E&&a){var i=t.frag,o=t.samples;if(i.type!==$t.MAIN||"NONE"!==this.closedCaptionsForLevel(i))for(var _=0;_this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}},t.getMaxLevel=function(t){var E=this,a=this.hls.levels;if(!a.length)return-1;var i=a.filter(function(e,a){return E.isLevelAllowed(e)&&a<=t});return this.clientRect=null,e.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)},t.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},t.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},t.getDimensions=function(){if(this.clientRect)return this.clientRect;var e=this.media,t={width:0,height:0};if(e){var E=e.getBoundingClientRect();t.width=E.width,t.height=E.height,t.width||t.height||(t.width=E.right-E.left||e.width||0,t.height=E.bottom-E.top||e.height||0)}return this.clientRect=t,t},t.isLevelAllowed=function(e){return!this.restrictedLevels.some(function(t){return e.bitrate===t.bitrate&&e.width===t.width&&e.height===t.height})},e.getMaxLevelByMediaSize=function(e,t,E){if(null==e||!e.length)return-1;for(var a=function(e,t){return!t||e.width!==t.width||e.height!==t.height},i=e.length-1,o=Math.max(t,E),_=0;_=o||n.height>=o)&&a(n,e[_+1])){i=_;break}}return i},n(e,[{key:"mediaWidth",get:function(){return this.getDimensions().width*this.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*this.contentScaleFactor}},{key:"contentScaleFactor",get:function(){var e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch(e){}return e}}]),e})(),J_=(function(){function e(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}var t=e.prototype;return t.setStreamController=function(e){this.streamController=e},t.registerListeners=function(){this.hls.on(B.MEDIA_ATTACHING,this.onMediaAttaching,this)},t.unregisterListeners=function(){this.hls.off(B.MEDIA_ATTACHING,this.onMediaAttaching,this)},t.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},t.onMediaAttaching=function(e,t){var E=this.hls.config;if(E.capLevelOnFPSDrop){var a=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=a,a&&"function"==typeof a.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),E.fpsDroppedMonitoringPeriod)}},t.checkFPS=function(e,t,E){var a=performance.now();if(t){if(this.lastTime){var i=a-this.lastTime,o=E-this.lastDroppedFrames,_=t-this.lastDecodedFrames,n=1e3*o/i,r=this.hls;if(r.trigger(B.FPS_DROP,{currentDropped:o,currentDecoded:_,totalDroppedFrames:E}),n>0&&o>r.config.fpsDroppedMonitoringThreshold*_){var S=r.currentLevel;y.warn("drop FPS ratio greater than max allowed value for currentLevel: "+S),S>0&&(-1===r.autoLevelCapping||r.autoLevelCapping>=S)&&(S-=1,r.trigger(B.FPS_DROP_LEVEL_CAPPING,{level:S,droppedLevel:r.currentLevel}),r.autoLevelCapping=S,this.streamController.nextLevelSwitch())}}this.lastTime=a,this.lastDroppedFrames=E,this.lastDecodedFrames=t}},t.checkFPSInterval=function(){var e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){var t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)},e})(),Z_="[eme]",en=(function(){function e(t){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=e.CDMCleanupPromise?[e.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=y.debug.bind(y,Z_),this.log=y.log.bind(y,Z_),this.warn=y.warn.bind(y,Z_),this.error=y.error.bind(y,Z_),this.hls=t,this.config=t.config,this.registerListeners()}var t=e.prototype;return t.destroy=function(){this.unregisterListeners(),this.onMediaDetached();var e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.onMediaEncrypted=this.onWaitingForKey=this.keyIdToKeySessionPromise=null,this.config=null},t.registerListeners=function(){this.hls.on(B.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(B.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(B.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(B.MANIFEST_LOADED,this.onManifestLoaded,this)},t.unregisterListeners=function(){this.hls.off(B.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(B.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(B.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(B.MANIFEST_LOADED,this.onManifestLoaded,this)},t.getLicenseServerUrl=function(e){var t=this.config,E=t.drmSystems,a=t.widevineLicenseUrl,i=E[e];if(i)return i.licenseUrl;if(e===Ee.WIDEVINE&&a)return a;throw new Error('no license server URL configured for key-system "'+e+'"')},t.getServerCertificateUrl=function(e){var t=this.config.drmSystems[e];if(t)return t.serverCertificateUrl;this.log('No Server Certificate in config.drmSystems["'+e+'"]')},t.attemptKeySystemAccess=function(e){var t=this,E=this.hls.levels,a=function(e,t,E){return!!e&&E.indexOf(e)===t},i=E.map(function(e){return e.audioCodec}).filter(a),o=E.map(function(e){return e.videoCodec}).filter(a);return i.length+o.length===0&&o.push("avc1.42e01e"),new Promise(function(E,a){!(function e(_){var n=_.shift();t.getMediaKeysPromise(n,i,o).then(function(e){return E({keySystem:n,mediaKeys:e})}).catch(function(t){_.length?e(_):a(t instanceof _n?t:new _n({type:h.KEY_SYSTEM_ERROR,details:f.KEY_SYSTEM_NO_ACCESS,error:t,fatal:!0},t.message))})})(e)})},t.requestMediaKeySystemAccess=function(e,t){var E=this.config.requestMediaKeySystemAccessFunc;if("function"!=typeof E){var a="Configured requestMediaKeySystemAccess is not a function "+E;return null===Te&&"http:"===self.location.protocol&&(a="navigator.requestMediaKeySystemAccess is not available over insecure protocol "+location.protocol),Promise.reject(new Error(a))}return E(e,t)},t.getMediaKeysPromise=function(e,t,E){var a=this,i=se(e,t,E,this.config.drmSystemOptions),o=this.keySystemAccessPromises[e],_=null==o?void 0:o.keySystemAccess;if(!_){this.log('Requesting encrypted media "'+e+'" key-system access with config: '+JSON.stringify(i)),_=this.requestMediaKeySystemAccess(e,i);var n=this.keySystemAccessPromises[e]={keySystemAccess:_};return _.catch(function(t){a.log('Failed to obtain access to key-system "'+e+'": '+t)}),_.then(function(t){a.log('Access for key-system "'+t.keySystem+'" obtained');var E=a.fetchServerCertificate(e);return a.log('Create media-keys for "'+e+'"'),n.mediaKeys=t.createMediaKeys().then(function(t){return a.log('Media-keys created for "'+e+'"'),E.then(function(E){return E?a.setMediaKeysServerCertificate(t,e,E):t})}),n.mediaKeys.catch(function(t){a.error('Failed to create media-keys for "'+e+'"}: '+t)}),n.mediaKeys})}return _.then(function(){return o.mediaKeys})},t.createMediaKeySessionContext=function(e){var t=e.decryptdata,E=e.keySystem,a=e.mediaKeys;this.log('Creating key-system session "'+E+'" keyId: '+ge.hexDump(t.keyId||[]));var i=a.createSession(),o={decryptdata:t,keySystem:E,mediaKeys:a,mediaKeysSession:i,keyStatus:"status-pending"};return this.mediaKeySessions.push(o),o},t.renewKeySession=function(e){var t=e.decryptdata;if(t.pssh){var E=this.createMediaKeySessionContext(e),a=this.getKeyIdString(t),i="cenc";this.keyIdToKeySessionPromise[a]=this.generateRequestWithPreferredKeySession(E,i,t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)},t.getKeyIdString=function(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(null===e.keyId)throw new Error("keyId is null");return ge.hexDump(e.keyId)},t.updateKeySession=function(e,t){var E,a=e.mediaKeysSession;return this.log('Updating key-session "'+a.sessionId+'" for keyID '+ge.hexDump((null==(E=e.decryptdata)?void 0:E.keyId)||[])+"\n } (data length: "+(t?t.byteLength:t)+")"),a.update(t)},t.selectKeySystemFormat=function(e){var t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log("Selecting key-system from fragment (sn: "+e.sn+" "+e.type+": "+e.level+") key formats "+t.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise},t.getKeyFormatPromise=function(e){var t=this;return new Promise(function(E,a){var i=re(t.config),o=e.map(ie).filter(function(e){return!!e&&-1!==i.indexOf(e)});return t.getKeySystemSelectionPromise(o).then(function(e){var t=e.keySystem,i=ne(t);i?E(i):a(new Error('Unable to find format for key-system "'+t+'"'))}).catch(a)})},t.loadKey=function(e){var t=this,E=e.keyInfo.decryptdata,a=this.getKeyIdString(E),i="(keyId: "+a+' format: "'+E.keyFormat+'" method: '+E.method+" uri: "+E.uri+")";this.log("Starting session for key "+i);var o=this.keyIdToKeySessionPromise[a];return o||(o=this.keyIdToKeySessionPromise[a]=this.getKeySystemForKeyPromise(E).then(function(a){var o=a.keySystem,_=a.mediaKeys;return t.throwIfDestroyed(),t.log("Handle encrypted media sn: "+e.frag.sn+" "+e.frag.type+": "+e.frag.level+" using key "+i),t.attemptSetMediaKeys(o,_).then(function(){t.throwIfDestroyed();var e=t.createMediaKeySessionContext({keySystem:o,mediaKeys:_,decryptdata:E}),a="cenc";return t.generateRequestWithPreferredKeySession(e,a,E.pssh,"playlist-key")})})).catch(function(e){return t.handleError(e)}),o},t.throwIfDestroyed=function(e){if(!this.hls)throw new Error("invalid state")},t.handleError=function(e){this.hls&&(this.error(e.message),e instanceof _n?this.hls.trigger(B.ERROR,e.data):this.hls.trigger(B.ERROR,{type:h.KEY_SYSTEM_ERROR,details:f.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))},t.getKeySystemForKeyPromise=function(e){var t=this.getKeyIdString(e),E=this.keyIdToKeySessionPromise[t];if(!E){var a=ie(e.keyFormat),i=a?[a]:re(this.config);return this.attemptKeySystemAccess(i)}return E},t.getKeySystemSelectionPromise=function(e){if(e.length||(e=re(this.config)),0===e.length)throw new _n({type:h.KEY_SYSTEM_ERROR,details:f.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},"Missing key-system license configuration options "+JSON.stringify({drmSystems:this.config.drmSystems}));return this.attemptKeySystemAccess(e)},t._onMediaEncrypted=function(e){var t=this,E=e.initDataType,a=e.initData;if(this.debug('"'+e.type+'" event: init data type: "'+E+'"'),null!==a){var i,o;if("sinf"===E&&this.config.drmSystems[Ee.FAIRPLAY]){var _=Ge(new Uint8Array(a));try{var n=$(JSON.parse(_).sinf),r=$e(new Uint8Array(n));if(!r)return;i=r.subarray(8,24),o=Ee.FAIRPLAY}catch(e){return void this.warn('Failed to parse sinf "encrypted" event message initData')}}else{var S=st(a);if(null===S)return;0===S.version&&S.systemId===oe.WIDEVINE&&S.data&&(i=S.data.subarray(8,24)),o=_e(S.systemId)}if(o&&i){for(var T,s=ge.hexDump(i),I=this.keyIdToKeySessionPromise,l=this.mediaKeySessions,A=I[s],O=function(){var e=l[u],o=e.decryptdata;if(o.pssh||!o.keyId)return 0;var _=ge.hexDump(o.keyId);return s===_||-1!==o.uri.replace(/-/g,"").indexOf(s)?(A=I[_],delete I[_],o.pssh=new Uint8Array(a),o.keyId=i,A=I[s]=A.then(function(){return t.generateRequestWithPreferredKeySession(e,E,a,"encrypted-event-key-match")}),1):void 0},u=0;u0)for(var o,_=0,n=i.length;_ in key message");return ee(atob(l))},t.setupLicenseXHR=function(e,t,E,a){var i=this,o=this.config.licenseXhrSetup;return o?Promise.resolve().then(function(){if(!E.decryptdata)throw new Error("Key removed");return o.call(i.hls,e,t,E,a)}).catch(function(_){if(!E.decryptdata)throw _;return e.open("POST",t,!0),o.call(i.hls,e,t,E,a)}).then(function(E){return e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:E||a}}):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:a}))},t.requestLicense=function(e,t){var E=this,a=this.config.keyLoadPolicy.default;return new Promise(function(i,o){var _=E.getLicenseServerUrl(e.keySystem);E.log("Sending license request to URL: "+_);var n=new XMLHttpRequest;n.responseType="arraybuffer",n.onreadystatechange=function(){if(!E.hls||!e.mediaKeysSession)return o(new Error("invalid state"));if(4===n.readyState)if(200===n.status){E._requestLicenseFailureCount=0;var r=n.response;E.log("License received "+(r instanceof ArrayBuffer?r.byteLength:r));var S=E.config.licenseResponseCallback;if(S)try{r=S.call(E.hls,n,_,e)}catch(e){E.error(e)}i(r)}else{var T=a.errorRetry,s=T?T.maxNumRetry:0;if(E._requestLicenseFailureCount++,E._requestLicenseFailureCount>s||n.status>=400&&n.status<500)o(new _n({type:h.KEY_SYSTEM_ERROR,details:f.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:n,response:{url:_,data:void 0,code:n.status,text:n.statusText}},"License Request XHR failed ("+_+"). Status: "+n.status+" ("+n.statusText+")"));else{var I=s-E._requestLicenseFailureCount+1;E.warn("Retrying license request, "+I+" attempts left"),E.requestLicense(e,t).then(i,o)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=n,E.setupLicenseXHR(n,_,e,t).then(function(t){var a=t.xhr,i=t.licenseChallenge;e.keySystem==Ee.PLAYREADY&&(i=E.unpackPlayReadyKeyMessage(a,i)),a.send(i)})})},t.onMediaAttached=function(e,t){if(this.config.emeEnabled){var E=t.media;this.media=E,E.addEventListener("encrypted",this.onMediaEncrypted),E.addEventListener("waitingforkey",this.onWaitingForKey)}},t.onMediaDetached=function(){var t=this,E=this.media,a=this.mediaKeySessions;E&&(E.removeEventListener("encrypted",this.onMediaEncrypted),E.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},lt.clearKeyUriToKeyIdMap();var i=a.length;e.CDMCleanupPromise=Promise.all(a.map(function(e){return t.removeSession(e)}).concat(null==E?void 0:E.setMediaKeys(null).catch(function(e){t.log("Could not clear media keys: "+e)}))).then(function(){i&&(t.log("finished closing key sessions and clearing media keys"),a.length=0)}).catch(function(e){t.log("Could not close sessions and clear media keys: "+e)})},t.onManifestLoading=function(){this.keyFormatPromise=null},t.onManifestLoaded=function(e,t){var E=t.sessionKeys;if(E&&this.config.emeEnabled&&!this.keyFormatPromise){var a=E.reduce(function(e,t){return-1===e.indexOf(t.keyFormat)&&e.push(t.keyFormat),e},[]);this.log("Selecting key-system from session-keys "+a.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(a)}},t.removeSession=function(e){var t=this,E=e.mediaKeysSession,a=e.licenseXhr;if(E){this.log("Remove licenses and keys and close session "+E.sessionId),e._onmessage&&(E.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(E.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),a&&a.readyState!==XMLHttpRequest.DONE&&a.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;var i=this.mediaKeySessions.indexOf(e);return i>-1&&this.mediaKeySessions.splice(i,1),E.remove().catch(function(e){t.log("Could not remove session: "+e)}).then(function(){return E.close()}).catch(function(e){t.log("Could not close session: "+e)})}},e})();en.CDMCleanupPromise=void 0;var tn,En,an,on,_n=(function(e){function t(t,E){var a;return(a=e.call(this,E)||this).data=void 0,t.error||(t.error=new Error(E)),a.data=t,t.err=t.error,a}return T(t,e),t})(u(Error));(function(e){e.MANIFEST="m",e.AUDIO="a",e.VIDEO="v",e.MUXED="av",e.INIT="i",e.CAPTION="c",e.TIMED_TEXT="tt",e.KEY="k",e.OTHER="o"})(tn||(tn={})),(function(e){e.DASH="d",e.HLS="h",e.SMOOTH="s",e.OTHER="o"})(En||(En={})),(function(e){e.OBJECT="CMCD-Object",e.REQUEST="CMCD-Request",e.SESSION="CMCD-Session",e.STATUS="CMCD-Status"})(an||(an={}));var nn=((on={})[an.OBJECT]=["br","d","ot","tb"],on[an.REQUEST]=["bl","dl","mtp","nor","nrr","su"],on[an.SESSION]=["cid","pr","sf","sid","st","v"],on[an.STATUS]=["bs","rtp"],on),rn=function e(t,E){this.value=void 0,this.params=void 0,Array.isArray(t)&&(t=t.map(function(t){return t instanceof e?t:new e(t)})),this.value=t,this.params=E},Sn=function(e){this.description=void 0,this.description=e},Tn="Dict";function sn(e){return Array.isArray(e)?JSON.stringify(e):e instanceof Map?"Map{}":e instanceof Set?"Set{}":"object"==typeof e?JSON.stringify(e):String(e)}function In(e,t,E,a){return new Error("failed to "+e+' "'+sn(t)+'" as '+E,{cause:a})}var ln="Bare Item",An="Boolean",On="Byte Sequence",un="Decimal",Rn="Integer";function Nn(e){return e<-999999999999999||99999999999999912)throw mn(e,un);var E=t.toString();return E.includes(".")?E:E+".0"}var Wn="String";function gn(e){if(dn.test(e))throw mn(e,Wn);return'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'}function Mn(e){return e.description||e.toString().slice(7,-1)}function vn(e){var t=Mn(e);if(!1===/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(t))throw mn(t,cn);return t}function Un(e){switch(typeof e){case"number":if(!C(e))throw mn(e,ln);return Number.isInteger(e)?Pn(e):fn(e);case"string":return gn(e);case"symbol":return vn(e);case"boolean":return Dn(e);case"object":if(e instanceof Date)return Bn(e);if(e instanceof Uint8Array)return pn(e);if(e instanceof Sn)return vn(e);default:throw mn(e,ln)}}function Gn(e){if(!1===/^[a-z*][a-z0-9\-_.*]*$/.test(e))throw mn(e,Ln);return e}function yn(e){return null==e?"":Object.entries(e).map(function(e){var t=e[0],E=e[1];return!0===E?";"+Gn(t):";"+Gn(t)+"="+Un(E)}).join("")}function bn(e){return e instanceof rn?""+Un(e.value)+yn(e.params):Un(e)}function kn(e){return"("+e.value.map(bn).join(" ")+")"+yn(e.params)}function Fn(e,t){var E;if(void 0===t&&(t={whitespace:!0}),"object"!=typeof e)throw mn(e,Tn);var a=e instanceof Map?e.entries():Object.entries(e),i=null!=(E=t)&&E.whitespace?" ":"";return Array.from(a).map(function(e){var t=e[0],E=e[1];E instanceof rn==0&&(E=new rn(E));var a=Gn(t);return!0===E.value?a+=yn(E.params):(a+="=",Array.isArray(E.value)?a+=kn(E):a+=bn(E)),a}).join(","+i)}function Vn(e,t){return Fn(e,t)}var Hn=function(e){return"ot"===e||"sf"===e||"st"===e},Yn=function(e){return"number"==typeof e?C(e):null!=e&&""!==e&&!1!==e};function wn(e,t){var E=new URL(e),a=new URL(t);if(E.origin!==a.origin)return e;for(var i=E.pathname.split("/").slice(1),o=a.pathname.split("/").slice(1,-1);i[0]===o[0];)i.shift(),o.shift();for(;o.length;)o.shift(),i.unshift("..");return i.join("/")}function Kn(){try{return crypto.randomUUID()}catch(a){try{var e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch(e){var E=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=(E+16*Math.random())%16|0;return E=Math.floor(E/16),("x"==e?t:3&t|8).toString(16)})}}}var zn=function(e){return Math.round(e)},jn=function(e){return 100*zn(e/100)},xn={br:zn,d:zn,bl:jn,dl:jn,mtp:jn,nor:function(e,t){return null!=t&&t.baseUrl&&(e=wn(e,t.baseUrl)),encodeURIComponent(e)},rtp:jn,tb:zn};function Qn(e,t){var E={};if(null==e||"object"!=typeof e)return E;var a=Object.keys(e).sort(),i=S({},xn,null==t?void 0:t.formatters),o=null==t?void 0:t.filter;return a.forEach(function(a){if(null==o||!o(a)){var _=e[a],n=i[a];n&&(_=n(_,t)),"v"===a&&1===_||"pr"==a&&1===_||Yn(_)&&(Hn(a)&&"string"==typeof _&&(_=new Sn(_)),E[a]=_)}}),E}function Xn(e,t){return void 0===t&&(t={}),e?Vn(Qn(e,t),S({whitespace:!1},t)):""}function $n(e,t){var E;if(void 0===t&&(t={}),!e)return{};var a=Object.entries(e),i=Object.entries(nn).concat(Object.entries((null==(E=t)?void 0:E.customHeaderMap)||{})),o=a.reduce(function(e,t){var E,a=t[0],o=t[1],_=(null==(E=i.find(function(e){return e[1].includes(a)}))?void 0:E[0])||an.REQUEST;return null!=e[_]||(e[_]={}),e[_][a]=o,e},{});return Object.entries(o).reduce(function(e,E){var a=E[0],i=E[1];return e[a]=Xn(i,t),e},{})}function qn(e,t,E){return S(e,$n(t,E))}var Jn="CMCD";function Zn(e,t){if(void 0===t&&(t={}),!e)return"";var E=Xn(e,t);return Jn+"="+encodeURIComponent(E)}var er=/CMCD=[^&#]+/;function tr(e,t,E){var a=Zn(t,E);if(!a)return e;if(er.test(e))return e.replace(er,a);var i=e.includes("?")?"&":"?";return""+e+i+a}var Er=(function(){function e(e){var t=this;this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){t.initialized&&(t.starved=!0),t.buffering=!0},this.onPlaying=function(){t.initialized||(t.initialized=!0),t.buffering=!1},this.applyPlaylistData=function(e){try{t.apply(e,{ot:tn.MANIFEST,su:!t.initialized})}catch(e){y.warn("Could not generate manifest CMCD data.",e)}},this.applyFragmentData=function(e){try{var E=e.frag,a=t.hls.levels[E.level],i=t.getObjectType(E),o={d:1e3*E.duration,ot:i};i!==tn.VIDEO&&i!==tn.AUDIO&&i!=tn.MUXED||(o.br=a.bitrate/1e3,o.tb=t.getTopBandwidth(i)/1e3,o.bl=t.getBufferLength(i)),t.apply(e,o)}catch(e){y.warn("Could not generate segment CMCD data.",e)}},this.hls=e;var E=this.config=e.config,a=E.cmcd;null!=a&&(E.pLoader=this.createPlaylistLoader(),E.fLoader=this.createFragmentLoader(),this.sid=a.sessionId||Kn(),this.cid=a.contentId,this.useHeaders=!0===a.useHeaders,this.includeKeys=a.includeKeys,this.registerListeners())}var t=e.prototype;return t.registerListeners=function(){var e=this.hls;e.on(B.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(B.MEDIA_DETACHED,this.onMediaDetached,this),e.on(B.BUFFER_CREATED,this.onBufferCreated,this)},t.unregisterListeners=function(){var e=this.hls;e.off(B.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(B.MEDIA_DETACHED,this.onMediaDetached,this),e.off(B.BUFFER_CREATED,this.onBufferCreated,this)},t.destroy=function(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=null},t.onMediaAttached=function(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)},t.onMediaDetached=function(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)},t.onBufferCreated=function(e,t){var E,a;this.audioBuffer=null==(E=t.tracks.audio)?void 0:E.buffer,this.videoBuffer=null==(a=t.tracks.video)?void 0:a.buffer},t.createData=function(){var e;return{v:1,sf:En.HLS,sid:this.sid,cid:this.cid,pr:null==(e=this.media)?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},t.apply=function(e,t){void 0===t&&(t={}),S(t,this.createData());var E=t.ot===tn.INIT||t.ot===tn.VIDEO||t.ot===tn.MUXED;this.starved&&E&&(t.bs=!0,t.su=!0,this.starved=!1),null==t.su&&(t.su=this.buffering);var a=this.includeKeys;a&&(t=Object.keys(t).reduce(function(e,E){return a.includes(E)&&(e[E]=t[E]),e},{})),this.useHeaders?(e.headers||(e.headers={}),qn(e.headers,t)):e.url=tr(e.url,t)},t.getObjectType=function(e){var t=e.type;return"subtitle"===t?tn.TIMED_TEXT:"initSegment"===e.sn?tn.INIT:"audio"===t?tn.AUDIO:"main"===t?this.hls.audioTracks.length?tn.VIDEO:tn.MUXED:void 0},t.getTopBandwidth=function(e){var t,E=0,a=this.hls;if(e===tn.AUDIO)t=a.audioTracks;else{var i=a.maxAutoLevel,o=i>-1?i+1:a.levels.length;t=a.levels.slice(0,o)}for(var _,n=c(t);!(_=n()).done;){var r=_.value;r.bitrate>E&&(E=r.bitrate)}return E>0?E:NaN},t.getBufferLength=function(e){var t=this.hls.media,E=e===tn.AUDIO?this.audioBuffer:this.videoBuffer;return E&&t?1e3*Pa.bufferInfo(E,t.currentTime,this.config.maxBufferHole).len:NaN},t.createPlaylistLoader=function(){var e=this.config.pLoader,t=this.applyPlaylistData,E=e||this.config.loader;return(function(){function e(e){this.loader=void 0,this.loader=new E(e)}var a=e.prototype;return a.destroy=function(){this.loader.destroy()},a.abort=function(){this.loader.abort()},a.load=function(e,E,a){t(e),this.loader.load(e,E,a)},n(e,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),e})()},t.createFragmentLoader=function(){var e=this.config.fLoader,t=this.applyFragmentData,E=e||this.config.loader;return(function(){function e(e){this.loader=void 0,this.loader=new E(e)}var a=e.prototype;return a.destroy=function(){this.loader.destroy()},a.abort=function(){this.loader.abort()},a.load=function(e,E,a){t(e),this.loader.load(e,E,a)},n(e,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),e})()},e})(),ar=3e5,ir=(function(){function e(e){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.log=y.log.bind(y,"[content-steering]:"),this.registerListeners()}var t=e.prototype;return t.registerListeners=function(){var e=this.hls;e.on(B.MANIFEST_LOADING,this.onManifestLoading,this),e.on(B.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(B.MANIFEST_PARSED,this.onManifestParsed,this),e.on(B.ERROR,this.onError,this)},t.unregisterListeners=function(){var e=this.hls;e&&(e.off(B.MANIFEST_LOADING,this.onManifestLoading,this),e.off(B.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(B.MANIFEST_PARSED,this.onManifestParsed,this),e.off(B.ERROR,this.onError,this))},t.startLoad=function(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){var e=1e3*this.timeToLoad-(performance.now()-this.updated);if(e>0)return void this.scheduleRefresh(this.uri,e)}this.loadSteeringManifest(this.uri)}},t.stopLoad=function(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()},t.clearTimeout=function(){-1!==this.reloadTimer&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)},t.destroy=function(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null},t.removeLevel=function(e){var t=this.levels;t&&(this.levels=t.filter(function(t){return t!==e}))},t.onManifestLoading=function(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null},t.onManifestLoaded=function(e,t){var E=t.contentSteering;null!==E&&(this.pathwayId=E.pathwayId,this.uri=E.uri,this.started&&this.startLoad())},t.onManifestParsed=function(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks},t.onError=function(e,t){var E=t.errorAction;if((null==E?void 0:E.action)===$E.SendAlternateToPenaltyBox&&E.flags===qE.MoveAllAlternatesMatchingHost){var a=this.levels,i=this.pathwayPriority,o=this.pathwayId;if(t.context){var _=t.context,n=_.groupId,r=_.pathwayId,S=_.type;n&&a?o=this.getPathwayForGroupId(n,S,o):r&&(o=r)}o in this.penalizedPathways||(this.penalizedPathways[o]=performance.now()),!i&&a&&(i=a.reduce(function(e,t){return-1===e.indexOf(t.pathwayId)&&e.push(t.pathwayId),e},[])),i&&i.length>1&&(this.updatePathwayPriority(i),E.resolved=this.pathwayId!==o),E.resolved||y.warn("Could not resolve "+t.details+' ("'+t.error.message+'") with content-steering for Pathway: '+o+" levels: "+(a?a.length:a)+" priorities: "+JSON.stringify(i)+" penalized: "+JSON.stringify(this.penalizedPathways))}},t.filterParsedLevels=function(e){this.levels=e;var t=this.getLevelsForPathway(this.pathwayId);if(0===t.length){var E=e[0].pathwayId;this.log("No levels found in Pathway "+this.pathwayId+'. Setting initial Pathway to "'+E+'"'),t=this.getLevelsForPathway(E),this.pathwayId=E}return t.length!==e.length?(this.log("Found "+t.length+"/"+e.length+' levels in Pathway "'+this.pathwayId+'"'),t):e},t.getLevelsForPathway=function(e){return null===this.levels?[]:this.levels.filter(function(t){return e===t.pathwayId})},t.updatePathwayPriority=function(e){var t;this.pathwayPriority=e;var E=this.penalizedPathways,a=performance.now();Object.keys(E).forEach(function(e){a-E[e]>ar&&delete E[e]});for(var i=0;i0){this.log('Setting Pathway to "'+o+'"'),this.pathwayId=o,bE(t),this.hls.trigger(B.LEVELS_UPDATED,{levels:t});var r=this.hls.levels[_];n&&r&&this.levels&&(r.attrs["STABLE-VARIANT-ID"]!==n.attrs["STABLE-VARIANT-ID"]&&r.bitrate!==n.bitrate&&this.log("Unstable Pathways change from bitrate "+n.bitrate+" to "+r.bitrate),this.hls.nextLoadLevel=_);break}}}},t.getPathwayForGroupId=function(e,t,E){for(var a=this.getLevelsForPathway(E).concat(this.levels||[]),i=0;i=2&&(0===E.loading.first&&(E.loading.first=Math.max(self.performance.now(),E.loading.start),i.timeout!==i.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),i.timeout=i.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.loadPolicy.maxLoadTimeMs-(E.loading.first-E.loading.start)))),4===a)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;var o=t.status,_="text"!==t.responseType;if(o>=200&&o<300&&(_&&t.response||null!==t.responseText)){E.loading.end=Math.max(self.performance.now(),E.loading.first);var n=_?t.response:t.responseText,r="arraybuffer"===t.responseType?n.byteLength:n.length;if(E.loaded=E.total=r,E.bwEstimate=8e3*E.total/(E.loading.end-E.loading.first),!this.callbacks)return;var S=this.callbacks.onProgress;if(S&&S(E,e,n,t),!this.callbacks)return;var T={url:t.responseURL,data:n,code:o};this.callbacks.onSuccess(T,E,e,t)}else{var s=i.loadPolicy.errorRetry;YE(s,E.retry,!1,{url:e.url,data:void 0,code:o})?this.retry(s):(y.error(o+" while loading "+e.url),this.callbacks.onError({code:o,text:t.statusText},e,t,E))}}}},t.loadtimeout=function(){var e,t=null==(e=this.config)?void 0:e.loadPolicy.timeoutRetry;if(YE(t,this.stats.retry,!0))this.retry(t);else{var E;y.warn("timeout while loading "+(null==(E=this.context)?void 0:E.url));var a=this.callbacks;a&&(this.abortInternal(),a.onTimeout(this.stats,this.context,this.loader))}},t.retry=function(e){var t=this.context,E=this.stats;this.retryDelay=VE(e,E.retry),E.retry++,y.warn((status?"HTTP Status "+status:"Timeout")+" while loading "+(null==t?void 0:t.url)+", retrying "+E.retry+"/"+e.maxNumRetry+" in "+this.retryDelay+"ms"),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)},t.loadprogress=function(e){var t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)},t.getCacheAge=function(){var e=null;if(this.loader&&nr.test(this.loader.getAllResponseHeaders())){var t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e},t.getResponseHeader=function(e){return this.loader&&new RegExp("^"+e+":\\s*[\\d.]+\\s*$","im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null},e})();function Sr(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(e){}return!1}var Tr=/(\d+)-(\d+)\/(\d+)/,sr=(function(){function e(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||Or,this.controller=new self.AbortController,this.stats=new w}var t=e.prototype;return t.destroy=function(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null},t.abortInternal=function(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())},t.abort=function(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)},t.load=function(e,t,E){var a=this,i=this.stats;if(i.loading.start)throw new Error("Loader can only be used once.");i.loading.start=self.performance.now();var o=Ir(e,this.controller.signal),_=E.onProgress,n="arraybuffer"===e.responseType,r=n?"byteLength":"length",S=t.loadPolicy,T=S.maxTimeToFirstByteMs,s=S.maxLoadTimeMs;this.context=e,this.config=t,this.callbacks=E,this.request=this.fetchSetup(e,o),self.clearTimeout(this.requestTimeout),t.timeout=T&&C(T)?T:s,this.requestTimeout=self.setTimeout(function(){a.abortInternal(),E.onTimeout(i,e,a.response)},t.timeout),self.fetch(this.request).then(function(o){a.response=a.loader=o;var r=Math.max(self.performance.now(),i.loading.start);if(self.clearTimeout(a.requestTimeout),t.timeout=s,a.requestTimeout=self.setTimeout(function(){a.abortInternal(),E.onTimeout(i,e,a.response)},s-(r-i.loading.start)),!o.ok){var S=o.status,T=o.statusText;throw new Rr(T||"fetch, bad network response",S,o)}return i.loading.first=r,i.total=Ar(o.headers)||i.total,_&&C(t.highWaterMark)?a.loadProgressively(o,i,e,t.highWaterMark,_):n?o.arrayBuffer():"json"===e.responseType?o.json():o.text()}).then(function(o){var n=a.response;if(!n)throw new Error("loader destroyed");self.clearTimeout(a.requestTimeout),i.loading.end=Math.max(self.performance.now(),i.loading.first);var S=o[r];S&&(i.loaded=i.total=S);var T={url:n.url,data:o,code:n.status};_&&!C(t.highWaterMark)&&_(i,e,o,n),E.onSuccess(T,i,e,n)}).catch(function(t){if(self.clearTimeout(a.requestTimeout),!i.aborted){var o=t&&t.code||0,_=t?t.message:null;E.onError({code:o,text:_},e,t?t.details:null,i)}})},t.getCacheAge=function(){var e=null;if(this.response){var t=this.response.headers.get("age");e=t?parseFloat(t):null}return e},t.getResponseHeader=function(e){return this.response?this.response.headers.get(e):null},t.loadProgressively=function(e,t,E,a,i){void 0===a&&(a=0);var o=new qa,_=e.body.getReader();return(function n(){return _.read().then(function(_){if(_.done)return o.dataLength&&i(t,E,o.flush(),e),Promise.resolve(new ArrayBuffer(0));var r=_.value,S=r.length;return t.loaded+=S,S=a&&i(t,E,o.flush(),e)):i(t,E,r,e),n()}).catch(function(){return Promise.reject()})})()},e})();function Ir(e,t){var E={method:"GET",mode:"cors",credentials:"same-origin",signal:t,headers:new self.Headers(S({},e.headers))};return e.rangeEnd&&E.headers.set("Range","bytes="+e.rangeStart+"-"+String(e.rangeEnd-1)),E}function lr(e){var t=Tr.exec(e);if(t)return parseInt(t[2])-parseInt(t[1])+1}function Ar(e){var t=e.get("Content-Range");if(t){var E=lr(t);if(C(E))return E}var a=e.get("Content-Length");if(a)return parseInt(a)}function Or(e,t){return new self.Request(e.url,t)}var ur,Rr=(function(e){function t(t,E,a){var i;return(i=e.call(this,t)||this).code=void 0,i.details=void 0,i.code=E,i.details=a,i}return T(t,e),t})(u(Error)),Nr=/\s/,dr={newCue:function(e,t,E,a){for(var i,o,_,n,r,S=[],T=self.VTTCue||self.TextTrackCue,s=0;s=16?n--:n++;var A=m_(r.trim()),O=h_(t,E,A);null!=e&&null!=(I=e.cues)&&I.getCueById(O)||((o=new T(t,E,A)).id=O,o.line=s+1,o.align="left",o.position=10+Math.min(80,10*Math.floor(8*n/32)),S.push(o))}return e&&S.length&&(S.sort(function(e,t){return"auto"===e.line||"auto"===t.line?0:e.line>8&&t.line>8?t.line-e.line:e.line-t.line}),S.forEach(function(t){return tE(e,t)})),S}},cr=a(a({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:rr,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:da,bufferController:Ko,capLevelController:q_,errorController:JE,fpsController:J_,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:Te,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},Lr()),{},{subtitleStreamController:Fo,subtitleTrackController:Ho,timelineController:j_,audioStreamController:yo,audioTrackController:bo,emeController:en,cmcdController:Er,contentSteeringController:ir});function Lr(){return{cueHandler:dr,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function mr(e,t){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==t.liveMaxLatencyDurationCount&&(void 0===t.liveSyncDurationCount||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(void 0===t.liveSyncDuration||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');var E=Dr(e),i=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach(function(e){var a=("level"===e?"playlist":e)+"LoadPolicy",o=void 0===t[a],_=[];i.forEach(function(i){var n=e+"Loading"+i,r=t[n];if(void 0!==r&&o){_.push(n);var S=E[a].default;switch(t[a]={default:S},i){case"TimeOut":S.maxLoadTimeMs=r,S.maxTimeToFirstByteMs=r;break;case"MaxRetry":S.errorRetry.maxNumRetry=r,S.timeoutRetry.maxNumRetry=r;break;case"RetryDelay":S.errorRetry.retryDelayMs=r,S.timeoutRetry.retryDelayMs=r;break;case"MaxRetryTimeout":S.errorRetry.maxRetryDelayMs=r,S.timeoutRetry.maxRetryDelayMs=r}}}),_.length&&y.warn('hls.js config: "'+_.join('", "')+'" setting(s) are deprecated, use "'+a+'": '+JSON.stringify(t[a]))}),a(a({},E),t)}function Dr(e){return e&&"object"==typeof e?Array.isArray(e)?e.map(Dr):Object.keys(e).reduce(function(t,E){return t[E]=Dr(e[E]),t},{}):e}function Cr(e){var t=e.loader;t!==sr&&t!==rr?(y.log("[config]: Custom loader detected, cannot enable progressive streaming"),e.progressive=!1):Sr()&&(e.loader=sr,e.progressive=!0,e.enableSoftwareAES=!0,y.log("[config]: Progressive streaming enabled, using FetchLoader"))}var pr=(function(e){function t(t,E){var a;return(a=e.call(this,t,"[level-controller]")||this)._levels=[],a._firstLevel=-1,a._maxAutoLevel=-1,a._startLevel=void 0,a.currentLevel=null,a.currentLevelIndex=-1,a.manualLevelIndex=-1,a.steering=void 0,a.onParsedComplete=void 0,a.steering=E,a._registerListeners(),a}T(t,e);var E=t.prototype;return E._registerListeners=function(){var e=this.hls;e.on(B.MANIFEST_LOADING,this.onManifestLoading,this),e.on(B.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(B.LEVEL_LOADED,this.onLevelLoaded,this),e.on(B.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(B.FRAG_BUFFERED,this.onFragBuffered,this),e.on(B.ERROR,this.onError,this)},E._unregisterListeners=function(){var e=this.hls;e.off(B.MANIFEST_LOADING,this.onManifestLoading,this),e.off(B.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(B.LEVEL_LOADED,this.onLevelLoaded,this),e.off(B.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(B.FRAG_BUFFERED,this.onFragBuffered,this),e.off(B.ERROR,this.onError,this)},E.destroy=function(){this._unregisterListeners(),this.steering=null,this.resetLevels(),e.prototype.destroy.call(this)},E.stopLoad=function(){this._levels.forEach(function(e){e.loadError=0,e.fragmentError=0}),e.prototype.stopLoad.call(this)},E.resetLevels=function(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1},E.onManifestLoading=function(e,t){this.resetLevels()},E.onManifestLoaded=function(e,t){var E=this.hls.config.preferManagedMediaSource,a=[],i={},o={},_=!1,n=!1,r=!1;t.levels.forEach(function(e){var t,S,T=e.attrs,s=e.audioCodec,I=e.videoCodec;-1!==(null==(t=s)?void 0:t.indexOf("mp4a.40.34"))&&(ur||(ur=/chrome|firefox/i.test(navigator.userAgent)),ur&&(e.audioCodec=s=void 0)),s&&(e.audioCodec=s=Mt(s,E)),0===(null==(S=I)?void 0:S.indexOf("avc1"))&&(I=e.videoCodec=Ut(I));var l=e.width,A=e.height,O=e.unknownCodecs;if(_||(_=!(!l||!A)),n||(n=!!I),r||(r=!!s),!(null!=O&&O.length||s&&!Ct(s,"audio",E)||I&&!Ct(I,"video",E))){var u=T.CODECS,R=T["FRAME-RATE"],N=T["HDCP-LEVEL"],d=T["PATHWAY-ID"],c=T.RESOLUTION,L=T["VIDEO-RANGE"],m=(d||".")+"-"+e.bitrate+"-"+c+"-"+R+"-"+u+"-"+L+"-"+N;if(i[m])if(i[m].uri===e.url||e.attrs["PATHWAY-ID"])i[m].addGroupId("audio",T.AUDIO),i[m].addGroupId("text",T.SUBTITLES);else{var D=o[m]+=1;e.attrs["PATHWAY-ID"]=new Array(D+1).join(".");var C=new DE(e);i[m]=C,a.push(C)}else{var p=new DE(e);i[m]=p,o[m]=1,a.push(p)}}}),this.filterAndSortMediaOptions(a,t,_,n,r)},E.filterAndSortMediaOptions=function(e,t,E,a,i){var o=this,_=[],n=[],r=e;if((E||a)&&i&&(r=r.filter(function(e){var t=e.videoCodec,E=e.videoRange,a=e.width,i=e.height;return(!!t||!(!a||!i))&&dE(E)})),0!==r.length){if(t.audioTracks){var S=this.hls.config.preferManagedMediaSource;Pr(_=t.audioTracks.filter(function(e){return!e.audioCodec||Ct(e.audioCodec,"audio",S)}))}t.subtitles&&Pr(n=t.subtitles);var T=r.slice(0);r.sort(function(e,t){if(e.attrs["HDCP-LEVEL"]!==t.attrs["HDCP-LEVEL"])return(e.attrs["HDCP-LEVEL"]||"")>(t.attrs["HDCP-LEVEL"]||"")?1:-1;if(E&&e.height!==t.height)return e.height-t.height;if(e.frameRate!==t.frameRate)return e.frameRate-t.frameRate;if(e.videoRange!==t.videoRange)return NE.indexOf(e.videoRange)-NE.indexOf(t.videoRange);if(e.videoCodec!==t.videoCodec){var a=Bt(e.videoCodec),i=Bt(t.videoCodec);if(a!==i)return i-a}if(e.uri===t.uri&&e.codecSet!==t.codecSet){var o=ht(e.codecSet),_=ht(t.codecSet);if(o!==_)return _-o}return e.averageBitrate!==t.averageBitrate?e.averageBitrate-t.averageBitrate:0});var s=T[0];if(this.steering&&(r=this.steering.filterParsedLevels(r)).length!==T.length)for(var I=0;Iu&&u===cr.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=R)}break}var N=i&&!a,d={levels:r,audioTracks:_,subtitleTracks:n,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:i,video:a,altAudio:!N&&_.some(function(e){return!!e.url})};this.hls.trigger(B.MANIFEST_PARSED,d),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else Promise.resolve().then(function(){if(o.hls){t.levels.length&&o.warn("One or more CODECS in variant not supported: "+JSON.stringify(t.levels[0].attrs));var e=new Error("no level with compatible codecs found in manifest");o.hls.trigger(B.ERROR,{type:h.MEDIA_ERROR,details:f.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:e,reason:e.message})}})},E.onError=function(e,t){!t.fatal&&t.context&&t.context.type===Xt.LEVEL&&t.context.level===this.level&&this.checkRetry(t)},E.onFragBuffered=function(e,t){var E=t.frag;if(void 0!==E&&E.type===$t.MAIN){var a=E.elementaryStreams;if(!Object.keys(a).some(function(e){return!!a[e]}))return;var i=this._levels[E.level];null!=i&&i.loadError&&(this.log("Resetting level error count of "+i.loadError+" on frag buffered"),i.loadError=0)}},E.onLevelLoaded=function(e,t){var E,a,i=t.level,o=t.details,_=this._levels[i];if(!_)return this.warn("Invalid level index "+i),void(null!=(a=t.deliveryDirectives)&&a.skip&&(o.deltaUpdateFailed=!0));i===this.currentLevelIndex?(0===_.fragmentError&&(_.loadError=0),this.playlistLoaded(i,t,_.details)):null!=(E=t.deliveryDirectives)&&E.skip&&(o.deltaUpdateFailed=!0)},E.loadPlaylist=function(t){e.prototype.loadPlaylist.call(this);var E=this.currentLevelIndex,a=this.currentLevel;if(a&&this.shouldLoadPlaylist(a)){var i=a.uri;if(t)try{i=t.addDirectives(i)}catch(e){this.warn("Could not construct new URL with HLS Delivery Directives: "+e)}var o=a.attrs["PATHWAY-ID"];this.log("Loading level index "+E+(void 0!==(null==t?void 0:t.msn)?" at sn "+t.msn+" part "+t.part:"")+" with"+(o?" Pathway "+o:"")+" "+i),this.clearTimer(),this.hls.trigger(B.LEVEL_LOADING,{url:i,level:E,pathwayId:a.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}},E.removeLevel=function(e){var t,E=this,a=this._levels.filter(function(t,a){return a!==e||(E.steering&&E.steering.removeLevel(t),t===E.currentLevel&&(E.currentLevel=null,E.currentLevelIndex=-1,t.details&&t.details.fragments.forEach(function(e){return e.level=-1})),!1)});bE(a),this._levels=a,this.currentLevelIndex>-1&&null!=(t=this.currentLevel)&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(B.LEVELS_UPDATED,{levels:a})},E.onLevelsUpdated=function(e,t){var E=t.levels;this._levels=E},E.checkMaxAutoUpdated=function(){var e=this.hls,t=e.autoLevelCapping,E=e.maxAutoLevel,a=e.maxHdcpLevel;this._maxAutoLevel!==E&&(this._maxAutoLevel=E,this.hls.trigger(B.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:t,levels:this.levels,maxAutoLevel:E,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:a}))},n(t,[{key:"levels",get:function(){return 0===this._levels.length?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(e){var t=this._levels;if(0!==t.length){if(e<0||e>=t.length){var E=new Error("invalid level idx"),a=e<0;if(this.hls.trigger(B.ERROR,{type:h.OTHER_ERROR,details:f.LEVEL_SWITCH_ERROR,level:e,fatal:a,error:E,reason:E.message}),a)return;e=Math.min(e,t.length-1)}var i=this.currentLevelIndex,o=this.currentLevel,_=o?o.attrs["PATHWAY-ID"]:void 0,n=t[e],r=n.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=n,i!==e||!n.details||!o||_!==r){this.log("Switching to level "+e+" ("+(n.height?n.height+"p ":"")+(n.videoRange?n.videoRange+" ":"")+(n.codecSet?n.codecSet+" ":"")+"@"+n.bitrate+")"+(r?" with Pathway "+r:"")+" from level "+i+(_?" with Pathway "+_:""));var S={level:e,attrs:n.attrs,details:n.details,bitrate:n.bitrate,averageBitrate:n.averageBitrate,maxBitrate:n.maxBitrate,realBitrate:n.realBitrate,width:n.width,height:n.height,codecSet:n.codecSet,audioCodec:n.audioCodec,videoCodec:n.videoCodec,audioGroups:n.audioGroups,subtitleGroups:n.subtitleGroups,loaded:n.loaded,loadError:n.loadError,fragmentError:n.fragmentError,name:n.name,id:n.id,uri:n.uri,url:n.url,urlId:0,audioGroupIds:n.audioGroupIds,textGroupIds:n.textGroupIds};this.hls.trigger(B.LEVEL_SWITCHING,S);var T=n.details;if(!T||T.live){var s=this.switchParams(n.uri,null==o?void 0:o.details);this.loadPlaylist(s)}}}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(e){this._firstLevel=e}},{key:"startLevel",get:function(){if(void 0===this._startLevel){var e=this.hls.config.startLevel;return void 0!==e?e:this.hls.firstAutoLevel}return this._startLevel},set:function(e){this._startLevel=e}},{key:"nextLoadLevel",get:function(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(e){this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}}]),t})(ZE);function Pr(e){var t={};e.forEach(function(e){var E=e.groupId||"";e.id=t[E]=t[E]||0,t[E]++})}var Br=(function(){function e(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}var t=e.prototype;return t.abort=function(e){for(var t in this.keyUriToKeyInfo){var E=this.keyUriToKeyInfo[t].loader;if(E){var a;if(e&&e!==(null==(a=E.context)?void 0:a.frag.type))return;E.abort()}}},t.detach=function(){for(var e in this.keyUriToKeyInfo){var t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}},t.destroy=function(){for(var e in this.detach(),this.keyUriToKeyInfo){var t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}},t.createKeyLoadError=function(e,t,E,a,i){return void 0===t&&(t=f.KEY_LOAD_ERROR),new Ha({type:h.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:i,error:E,networkDetails:a})},t.loadClear=function(e,t){var E=this;if(this.emeController&&this.config.emeEnabled)for(var a=e.sn,i=e.cc,o=function(){var e=t[_];if(i<=e.cc&&("initSegment"===a||"initSegment"===e.sn||avr,I=!T||t&&t.start<=o||T-o>vr&&!this.fragmentTracker.getPartialFragment(o);if(s||I)return;this.moved=!1}if(!this.moved&&null!==this.stalled){var l;if(!(S.len>0||T))return;var A=Math.max(T,S.start||0)-o,O=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,u=(null==O||null==(l=O.details)?void 0:l.live)?2*O.details.targetduration:vr,R=this.fragmentTracker.getPartialFragment(o);if(A>0&&(A<=u||R))return void(a.paused||this._trySkipBufferHole(R))}var N=self.performance.now();if(null!==i){var d=N-i;if(_||!(d>=Mr)||(this._reportStall(S),this.media)){var c=Pa.bufferInfo(a,o,E.maxBufferHole);this._tryFixBufferStall(c,d)}}else this.stalled=N}else if(this.moved=!0,_||(this.nudgeRetry=0),null!==i){if(this.stallReported){var L=self.performance.now()-i;y.warn("playback not stuck anymore @"+o+", after "+Math.round(L)+"ms"),this.stallReported=!1}this.stalled=null}}},t._tryFixBufferStall=function(e,t){var E=this.config,a=this.fragmentTracker,i=this.media;if(null!==i){var o=i.currentTime,_=a.getPartialFragment(o);if(_&&(this._trySkipBufferHole(_)||!this.media))return;(e.len>E.maxBufferHole||e.nextStart&&e.nextStart-o1e3*E.highBufferWatchdogPeriod&&(y.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}},t._reportStall=function(e){var t=this.hls,E=this.media;if(!this.stallReported&&E){this.stallReported=!0;var a=new Error("Playback stalling at @"+E.currentTime+" due to low buffer ("+JSON.stringify(e)+")");y.warn(a.message),t.trigger(B.ERROR,{type:h.MEDIA_ERROR,details:f.BUFFER_STALLED_ERROR,fatal:!1,error:a,buffer:e.len})}},t._trySkipBufferHole=function(e){var t=this.config,E=this.hls,a=this.media;if(null===a)return 0;var i=a.currentTime,o=Pa.bufferInfo(a,i,0),_=i0&&o.len<1&&a.readyState<3,S=_-i;if(S>0&&(n||r)){if(S>t.maxBufferHole){var T=this.fragmentTracker,s=!1;if(0===i){var I=T.getAppendedFrag(0,$t.MAIN);I&&_1?(a=0,this.bitrateTest=!0):a=E.firstAutoLevel),E.nextLoadLevel=a,this.level=E.loadLevel,this.loadedmetadata=!1}t>0&&-1===e&&(this.log("Override startPosition with lastCurrentTime @"+t.toFixed(3)),e=t),this.state=Xa.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=Xa.STOPPED},E.stopLoad=function(){this._forceStartLoad=!1,e.prototype.stopLoad.call(this)},E.doTick=function(){switch(this.state){case Xa.WAITING_LEVEL:var e=this.levels,t=this.level,E=null==e?void 0:e[t],a=null==E?void 0:E.details;if(a&&(!a.live||this.levelLastLoaded===E)){if(this.waitForCdnTuneIn(a))break;this.state=Xa.IDLE;break}if(this.hls.nextLoadLevel!==this.level){this.state=Xa.IDLE;break}break;case Xa.FRAG_LOADING_WAITING_RETRY:var i,o=self.performance.now(),_=this.retryDate;if(!_||o>=_||null!=(i=this.media)&&i.seeking){var n=this.levels,r=this.level,S=null==n?void 0:n[r];this.resetStartWhenNotLoaded(S||null),this.state=Xa.IDLE}}this.state===Xa.IDLE&&this.doTickIdle(),this.onTickEnd()},E.onTickEnd=function(){e.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},E.doTickIdle=function(){var e=this.hls,t=this.levelLastLoaded,E=this.levels,a=this.media,i=e.config,o=e.nextLoadLevel;if(null!==t&&(a||!this.startFragRequested&&i.startFragPrefetch)&&(!this.altAudio||!this.audioOnly)&&null!=E&&E[o]){var _=E[o],n=this.getMainFwdBufferInfo();if(null!==n){var r=this.getLevelDetails();if(r&&this._streamEnded(n,r)){var S={};return this.altAudio&&(S.type="video"),this.hls.trigger(B.BUFFER_EOS,S),void(this.state=Xa.ENDED)}e.loadLevel!==o&&-1===e.manualLevel&&this.log("Adapting to level "+o+" from level "+this.level),this.level=e.nextLoadLevel=o;var T=_.details;if(!T||this.state===Xa.WAITING_LEVEL||T.live&&this.levelLastLoaded!==_)return this.level=o,void(this.state=Xa.WAITING_LEVEL);var s=n.len,I=this.getMaxBufferLength(_.maxBitrate);if(!(s>=I)){this.backtrackFragment&&this.backtrackFragment.start>n.end&&(this.backtrackFragment=null);var l=this.backtrackFragment?this.backtrackFragment.start:n.end,A=this.getNextFragment(l,T);if(this.couldBacktrack&&!this.fragPrevious&&A&&"initSegment"!==A.sn&&this.fragmentTracker.getState(A)!==La.OK){var O,u=(null!=(O=this.backtrackFragment)?O:A).sn-T.startSN,R=T.fragments[u-1];R&&A.cc===R.cc&&(A=R,this.fragmentTracker.removeFragment(R))}else this.backtrackFragment&&n.len&&(this.backtrackFragment=null);if(A&&this.isLoopLoading(A,l)){if(!A.gap){var N=this.audioOnly&&!this.altAudio?K.AUDIO:K.VIDEO,d=(N===K.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;d&&this.afterBufferFlushed(d,N,$t.MAIN)}A=this.getNextFragmentLoopLoading(A,T,n,$t.MAIN,I)}A&&(!A.initSegment||A.initSegment.data||this.bitrateTest||(A=A.initSegment),this.loadFragment(A,_,l))}}}},E.loadFragment=function(t,E,a){var i=this.fragmentTracker.getState(t);this.fragCurrent=t,i===La.NOT_LOADED||i===La.PARTIAL?"initSegment"===t.sn?this._loadInitSegment(t,E):this.bitrateTest?(this.log("Fragment "+t.sn+" of level "+t.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(t,E)):(this.startFragRequested=!0,e.prototype.loadFragment.call(this,t,E,a)):this.clearTrackerIfNeeded(t)},E.getBufferedFrag=function(e){return this.fragmentTracker.getBufferedFrag(e,$t.MAIN)},E.followingBufferedFrag=function(e){return e?this.getBufferedFrag(e.end+.5):null},E.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},E.nextLevelSwitch=function(){var e=this.levels,t=this.media;if(null!=t&&t.readyState){var E,a=this.getAppendedFrag(t.currentTime);a&&a.start>1&&this.flushMainBuffer(0,a.start-1);var i=this.getLevelDetails();if(null!=i&&i.live){var o=this.getMainFwdBufferInfo();if(!o||o.len<2*i.targetduration)return}if(!t.paused&&e){var _=e[this.hls.nextLoadLevel],n=this.fragLastKbps;E=n&&this.fragCurrent?this.fragCurrent.duration*_.maxBitrate/(1e3*n)+1:0}else E=0;var r=this.getBufferedFrag(t.currentTime+E);if(r){var S=this.followingBufferedFrag(r);if(S){this.abortCurrentFrag();var T=S.maxStartPTS?S.maxStartPTS:S.start,s=S.duration,I=Math.max(r.end,T+Math.min(Math.max(s-this.config.maxFragLookUpTolerance,s*(this.couldBacktrack?.5:.125)),s*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(I,Number.POSITIVE_INFINITY)}}}},E.abortCurrentFrag=function(){var e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case Xa.KEY_LOADING:case Xa.FRAG_LOADING:case Xa.FRAG_LOADING_WAITING_RETRY:case Xa.PARSING:case Xa.PARSED:this.state=Xa.IDLE}this.nextLoadPosition=this.getLoadPosition()},E.flushMainBuffer=function(t,E){e.prototype.flushMainBuffer.call(this,t,E,this.altAudio?"video":null)},E.onMediaAttached=function(t,E){e.prototype.onMediaAttached.call(this,t,E);var a=E.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),a.addEventListener("playing",this.onvplaying),a.addEventListener("seeked",this.onvseeked),this.gapController=new yr(this.config,a,this.fragmentTracker,this.hls)},E.onMediaDetaching=function(){var t=this.media;t&&this.onvplaying&&this.onvseeked&&(t.removeEventListener("playing",this.onvplaying),t.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),e.prototype.onMediaDetaching.call(this)},E.onMediaPlaying=function(){this.tick()},E.onMediaSeeked=function(){var e=this.media,t=e?e.currentTime:null;C(t)&&this.log("Media seeked to "+t.toFixed(3));var E=this.getMainFwdBufferInfo();null!==E&&0!==E.len?this.tick():this.warn('Main forward buffer length on "seeked" event '+(E?E.len:"empty")+")")},E.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(B.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1},E.onManifestParsed=function(e,t){var E=!1,a=!1;t.levels.forEach(function(e){var t=e.audioCodec;t&&(E=E||-1!==t.indexOf("mp4a.40.2"),a=a||-1!==t.indexOf("mp4a.40.5"))}),this.audioCodecSwitch=E&&a&&!gr(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1},E.onLevelLoading=function(e,t){var E=this.levels;if(E&&this.state===Xa.IDLE){var a=E[t.level];(!a.details||a.details.live&&this.levelLastLoaded!==a||this.waitForCdnTuneIn(a.details))&&(this.state=Xa.WAITING_LEVEL)}},E.onLevelLoaded=function(e,t){var E,a=this.levels,i=t.level,o=t.details,_=o.totalduration;if(a){this.log("Level "+i+" loaded ["+o.startSN+","+o.endSN+"]"+(o.lastPartSn?"[part-"+o.lastPartSn+"-"+o.lastPartIndex+"]":"")+", cc ["+o.startCC+", "+o.endCC+"] duration:"+_);var n=a[i],r=this.fragCurrent;!r||this.state!==Xa.FRAG_LOADING&&this.state!==Xa.FRAG_LOADING_WAITING_RETRY||r.level!==t.level&&r.loader&&this.abortCurrentFrag();var S=0;if(o.live||null!=(E=n.details)&&E.live){var T;if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;S=this.alignPlaylists(o,n.details,null==(T=this.levelLastLoaded)?void 0:T.details)}if(n.details=o,this.levelLastLoaded=n,this.hls.trigger(B.LEVEL_UPDATED,{details:o,level:i}),this.state===Xa.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=Xa.IDLE}this.startFragRequested?o.live&&this.synchronizeToLiveEdge(o):this.setStartPosition(o,S),this.tick()}else this.warn("Levels were reset while loading level "+i)},E._handleFragmentLoadProgress=function(e){var t,E=e.frag,a=e.part,i=e.payload,o=this.levels;if(o){var _=o[E.level],n=_.details;if(!n)return this.warn("Dropping fragment "+E.sn+" of level "+E.level+" after level details were reset"),void this.fragmentTracker.removeFragment(E);var r=_.videoCodec,S=n.PTSKnown||!n.live,T=null==(t=E.initSegment)?void 0:t.data,s=this._getAudioCodec(_),I=this.transmuxer=this.transmuxer||new go(this.hls,$t.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),l=a?a.index:-1,A=-1!==l,O=new Ba(E.level,E.sn,E.stats.chunkCount,i.byteLength,l,A),u=this.initPTS[E.cc];I.push(i,T,s,r,E,a,n.totalduration,S,O,u)}else this.warn("Levels were reset while fragment load was in progress. Fragment "+E.sn+" of level "+E.level+" will not be buffered")},E.onAudioTrackSwitching=function(e,t){var E=this.altAudio;if(!t.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var a=this.fragCurrent;a&&(this.log("Switching to main audio track, cancel main fragment load"),a.abortRequests(),this.fragmentTracker.removeFragment(a)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var i=this.hls;E&&(i.trigger(B.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),i.trigger(B.AUDIO_TRACK_SWITCHED,t)}},E.onAudioTrackSwitched=function(e,t){var E=t.id,a=!!this.hls.audioTracks[E].url;if(a){var i=this.videoBuffer;i&&this.mediaBuffer!==i&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=i)}this.altAudio=a,this.tick()},E.onBufferCreated=function(e,t){var E,a,i=t.tracks,o=!1;for(var _ in i){var n=i[_];if("main"===n.id){if(a=_,E=n,"video"===_){var r=i[_];r&&(this.videoBuffer=r.buffer)}}else o=!0}o&&E?(this.log("Alternate track found, use "+a+".buffered to schedule main fragment loading"),this.mediaBuffer=E.buffer):this.mediaBuffer=this.media},E.onFragBuffered=function(e,t){var E=t.frag,a=t.part;if(!E||E.type===$t.MAIN){if(this.fragContextChanged(E))return this.warn("Fragment "+E.sn+(a?" p: "+a.index:"")+" of level "+E.level+" finished buffering, but was aborted. state: "+this.state),void(this.state===Xa.PARSED&&(this.state=Xa.IDLE));var i=a?a.stats:E.stats;this.fragLastKbps=Math.round(8*i.total/(i.buffering.end-i.loading.first)),"initSegment"!==E.sn&&(this.fragPrevious=E),this.fragBufferedComplete(E,a)}},E.onError=function(e,t){var E;if(t.fatal)this.state=Xa.ERROR;else switch(t.details){case f.FRAG_GAP:case f.FRAG_PARSING_ERROR:case f.FRAG_DECRYPT_ERROR:case f.FRAG_LOAD_ERROR:case f.FRAG_LOAD_TIMEOUT:case f.KEY_LOAD_ERROR:case f.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError($t.MAIN,t);break;case f.LEVEL_LOAD_ERROR:case f.LEVEL_LOAD_TIMEOUT:case f.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==Xa.WAITING_LEVEL||(null==(E=t.context)?void 0:E.type)!==Xt.LEVEL||(this.state=Xa.IDLE);break;case f.BUFFER_APPEND_ERROR:case f.BUFFER_FULL_ERROR:if(!t.parent||"main"!==t.parent)return;if(t.details===f.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case f.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}},E.checkBuffer=function(){var e=this.media,t=this.gapController;if(e&&t&&e.readyState){if(this.loadedmetadata||!Pa.getBuffered(e).length){var E=this.state!==Xa.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,E)}this.lastCurrentTime=e.currentTime}},E.onFragLoadEmergencyAborted=function(){this.state=Xa.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},E.onBufferFlushed=function(e,t){var E=t.type;if(E!==K.AUDIO||this.audioOnly&&!this.altAudio){var a=(E===K.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(a,E,$t.MAIN),this.tick()}},E.onLevelsUpdated=function(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=t.levels},E.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},E.seekToStartPos=function(){var e=this.media;if(e){var t=e.currentTime,E=this.startPosition;if(E>=0&&t0&&(id.cc;if(!1!==i.independent){var m=T.startPTS,D=T.endPTS,p=T.startDTS,P=T.endDTS;if(r)r.elementaryStreams[T.type]={startPTS:m,endPTS:D,startDTS:p,endDTS:P};else if(T.firstKeyFrame&&T.independent&&1===o.id&&!L&&(this.couldBacktrack=!0),T.dropped&&T.independent){var h=this.getMainFwdBufferInfo(),f=(h?h.end:this.getLoadPosition())+this.config.maxBufferHole,W=T.firstKeyFramePTS?T.firstKeyFramePTS:m;if(!c&&fvr&&(n.gap=!0);n.setElementaryStreamInfo(T.type,m,D,p,P),this.backtrackFragment&&(this.backtrackFragment=n),this.bufferFragmentData(T,n,r,o,c||L)}else{if(!c&&!L)return void this.backtrack(n);n.gap=!0}}if(O){var g=O.startPTS,M=O.endPTS,v=O.startDTS,U=O.endDTS;r&&(r.elementaryStreams[K.AUDIO]={startPTS:g,endPTS:M,startDTS:v,endDTS:U}),n.setElementaryStreamInfo(K.AUDIO,g,M,v,U),this.bufferFragmentData(O,n,r,o)}if(A&&null!=I&&null!=(t=I.samples)&&t.length){var G={id:E,frag:n,details:A,samples:I.samples};a.trigger(B.FRAG_PARSING_METADATA,G)}if(A&&s){var y={id:E,frag:n,details:A,samples:s.samples};a.trigger(B.FRAG_PARSING_USERDATA,y)}}}else this.resetWhenMissingContext(o)},E._bufferInitSegment=function(e,t,E,a){var i=this;if(this.state===Xa.PARSING){this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;var o=t.audio,_=t.video,n=t.audiovideo;if(o){var r=e.audioCodec,S=navigator.userAgent.toLowerCase();this.audioCodecSwitch&&(r&&(r=-1!==r.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),1!==o.metadata.channelCount&&-1===S.indexOf("firefox")&&(r="mp4a.40.5")),r&&-1!==r.indexOf("mp4a.40.5")&&-1!==S.indexOf("android")&&"audio/mpeg"!==o.container&&(r="mp4a.40.2",this.log("Android: force audio codec to "+r)),e.audioCodec&&e.audioCodec!==r&&this.log('Swapping manifest audio codec "'+e.audioCodec+'" for "'+r+'"'),o.levelCodec=r,o.id="main",this.log("Init audio buffer, container:"+o.container+", codecs[selected/level/parsed]=["+(r||"")+"/"+(e.audioCodec||"")+"/"+o.codec+"]")}_&&(_.levelCodec=e.videoCodec,_.id="main",this.log("Init video buffer, container:"+_.container+", codecs[level/parsed]=["+(e.videoCodec||"")+"/"+_.codec+"]")),n&&this.log("Init audiovideo buffer, container:"+n.container+", codecs[level/parsed]=["+e.codecs+"/"+n.codec+"]"),this.hls.trigger(B.BUFFER_CODECS,t),Object.keys(t).forEach(function(e){var o=t[e].initSegment;null!=o&&o.byteLength&&i.hls.trigger(B.BUFFER_APPENDING,{type:e,data:o,frag:E,part:null,chunkMeta:a,parent:E.type})}),this.tickImmediate()}},E.getMainFwdBufferInfo=function(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,$t.MAIN)},E.backtrack=function(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=Xa.IDLE},E.checkFragmentChanged=function(){var e=this.media,t=null;if(e&&e.readyState>1&&!1===e.seeking){var E=e.currentTime;if(Pa.isBuffered(e,E)?t=this.getAppendedFrag(E):Pa.isBuffered(e,E+.1)&&(t=this.getAppendedFrag(E+.1)),t){this.backtrackFragment=null;var a=this.fragPlaying,i=t.level;a&&t.sn===a.sn&&a.level===i||(this.fragPlaying=t,this.hls.trigger(B.FRAG_CHANGED,{frag:t}),a&&a.level===i||this.hls.trigger(B.LEVEL_SWITCHED,{level:i}))}}},n(t,[{key:"nextLevel",get:function(){var e=this.nextBufferedFrag;return e?e.level:-1}},{key:"currentFrag",get:function(){var e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}},{key:"currentProgramDateTime",get:function(){var e=this.media;if(e){var t=e.currentTime,E=this.currentFrag;if(E&&C(t)&&C(E.programDateTime)){var a=E.programDateTime+1e3*(t-E.start);return new Date(a)}}return null}},{key:"currentLevel",get:function(){var e=this.currentFrag;return e?e.level:-1}},{key:"nextBufferedFrag",get:function(){var e=this.currentFrag;return e?this.followingBufferedFrag(e):null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}]),t})($a),Fr=(function(){function e(t){void 0===t&&(t={}),this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new mo,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,G(t.debug||!1,"Hls instance");var E=this.config=mr(e.DefaultConfig,t);this.userConfig=t,E.progressive&&Cr(E);var a=E.abrController,i=E.bufferController,o=E.capLevelController,_=E.errorController,n=E.fpsController,r=new _(this),S=this.abrController=new a(this),T=this.bufferController=new i(this),s=this.capLevelController=new o(this),I=new n(this),l=new Zt(this),A=new AE(this),O=E.contentSteeringController,u=O?new O(this):null,R=this.levelController=new pr(this,u),N=new ma(this),d=new Br(this.config),c=this.streamController=new kr(this,N,d);s.setStreamController(c),I.setStreamController(c);var L=[l,R,c];u&&L.splice(1,0,u),this.networkControllers=L;var m=[S,T,s,I,A,N];this.audioTrackController=this.createController(E.audioTrackController,L);var D=E.audioStreamController;D&&L.push(new D(this,N,d)),this.subtitleTrackController=this.createController(E.subtitleTrackController,L);var C=E.subtitleStreamController;C&&L.push(new C(this,N,d)),this.createController(E.timelineController,m),d.emeController=this.emeController=this.createController(E.emeController,m),this.cmcdController=this.createController(E.cmcdController,m),this.latencyController=this.createController(OE,m),this.coreComponents=m,L.push(r);var p=r.onErrorOut;"function"==typeof p&&this.on(B.ERROR,p,r)}e.isMSESupported=function(){return fr()},e.isSupported=function(){return Wr()},e.getMediaSource=function(){return Lt()};var t=e.prototype;return t.createController=function(e,t){if(e){var E=new e(this);return t&&t.push(E),E}return null},t.on=function(e,t,E){void 0===E&&(E=this),this._emitter.on(e,t,E)},t.once=function(e,t,E){void 0===E&&(E=this),this._emitter.once(e,t,E)},t.removeAllListeners=function(e){this._emitter.removeAllListeners(e)},t.off=function(e,t,E,a){void 0===E&&(E=this),this._emitter.off(e,t,E,a)},t.listeners=function(e){return this._emitter.listeners(e)},t.emit=function(e,t,E){return this._emitter.emit(e,t,E)},t.trigger=function(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(t){if(y.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),!this.triggeringException){this.triggeringException=!0;var E=e===B.ERROR;this.trigger(B.ERROR,{type:h.OTHER_ERROR,details:f.INTERNAL_EXCEPTION,fatal:E,event:e,error:t}),this.triggeringException=!1}}return!1},t.listenerCount=function(e){return this._emitter.listenerCount(e)},t.destroy=function(){y.log("destroy"),this.trigger(B.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(function(e){return e.destroy()}),this.networkControllers.length=0,this.coreComponents.forEach(function(e){return e.destroy()}),this.coreComponents.length=0;var e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null},t.attachMedia=function(e){y.log("attachMedia"),this._media=e,this.trigger(B.MEDIA_ATTACHING,{media:e})},t.detachMedia=function(){y.log("detachMedia"),this.trigger(B.MEDIA_DETACHING,void 0),this._media=null},t.loadSource=function(e){this.stopLoad();var t=this.media,E=this.url,a=this.url=D.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,y.log("loadSource:"+a),t&&E&&(E!==a||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(B.MANIFEST_LOADING,{url:e})},t.startLoad=function(e){void 0===e&&(e=-1),y.log("startLoad("+e+")"),this.started=!0,this.networkControllers.forEach(function(t){t.startLoad(e)})},t.stopLoad=function(){y.log("stopLoad"),this.started=!1,this.networkControllers.forEach(function(e){e.stopLoad()})},t.resumeBuffering=function(){this.started&&this.networkControllers.forEach(function(e){"fragmentLoader"in e&&e.startLoad(-1)})},t.pauseBuffering=function(){this.networkControllers.forEach(function(e){"fragmentLoader"in e&&e.stopLoad()})},t.swapAudioCodec=function(){y.log("swapAudioCodec"),this.streamController.swapAudioCodec()},t.recoverMediaError=function(){y.log("recoverMediaError");var e=this._media;this.detachMedia(),e&&this.attachMedia(e)},t.removeLevel=function(e){this.levelController.removeLevel(e)},t.setAudioOption=function(e){var t;return null==(t=this.audioTrackController)?void 0:t.setAudioOption(e)},t.setSubtitleOption=function(e){var t;return null==(t=this.subtitleTrackController)||t.setSubtitleOption(e),null},n(e,[{key:"levels",get:function(){var e=this.levelController.levels;return e||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(e){y.log("set currentLevel:"+e),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(e){y.log("set nextLevel:"+e),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(e){y.log("set loadLevel:"+e),this.levelController.manualLevel=e}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e}},{key:"firstLevel",get:function(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)},set:function(e){y.log("set firstLevel:"+e),this.levelController.firstLevel=e}},{key:"startLevel",get:function(){var e=this.levelController.startLevel;return-1===e&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e},set:function(e){y.log("set startLevel:"+e),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}},{key:"capLevelToPlayerSize",get:function(){return this.config.capLevelToPlayerSize},set:function(e){var t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){this._autoLevelCapping!==e&&(y.log("set autoLevelCapping:"+e),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}},{key:"bandwidthEstimate",get:function(){var e=this.abrController.bwEstimator;return e?e.getEstimate():NaN},set:function(e){this.abrController.resetEstimator(e)}},{key:"ttfbEstimate",get:function(){var e=this.abrController.bwEstimator;return e?e.getEstimateTTFB():NaN}},{key:"maxHdcpLevel",get:function(){return this._maxHdcpLevel},set:function(e){RE(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var e=this.levels,t=this.config.minAutoBitrate;if(!e)return 0;for(var E=e.length,a=0;a=t)return a;return 0}},{key:"maxAutoLevel",get:function(){var e,t=this.levels,E=this.autoLevelCapping,a=this.maxHdcpLevel;if(e=-1===E&&null!=t&&t.length?t.length-1:E,a)for(var i=e;i--;){var o=t[i].attrs["HDCP-LEVEL"];if(o&&o<=a)return i}return e}},{key:"firstAutoLevel",get:function(){return this.abrController.firstAutoLevel}},{key:"nextAutoLevel",get:function(){return this.abrController.nextAutoLevel},set:function(e){this.abrController.nextAutoLevel=e}},{key:"playingDate",get:function(){return this.streamController.currentProgramDateTime}},{key:"mainForwardBufferInfo",get:function(){return this.streamController.getMainFwdBufferInfo()}},{key:"allAudioTracks",get:function(){var e=this.audioTrackController;return e?e.allAudioTracks:[]}},{key:"audioTracks",get:function(){var e=this.audioTrackController;return e?e.audioTracks:[]}},{key:"audioTrack",get:function(){var e=this.audioTrackController;return e?e.audioTrack:-1},set:function(e){var t=this.audioTrackController;t&&(t.audioTrack=e)}},{key:"allSubtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}},{key:"subtitleTracks",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var e=this.subtitleTrackController;return e?e.subtitleTrack:-1},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var e=this.subtitleTrackController;return!!e&&e.subtitleDisplay},set:function(e){var t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(e){this.config.lowLatencyMode=e}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}],[{key:"version",get:function(){return"1.5.5-0.canary.9893"}},{key:"Events",get:function(){return B}},{key:"ErrorTypes",get:function(){return h}},{key:"ErrorDetails",get:function(){return f}},{key:"DefaultConfig",get:function(){return e.defaultConfig?e.defaultConfig:cr},set:function(t){e.defaultConfig=t}}]),e})();return Fr.defaultConfig=void 0,Fr})()})(!1)},32462(e){"use strict";const t=e=>"string"==typeof e,E=()=>{let e,t;const E=new Promise((E,a)=>{e=E,t=a});return E.resolve=e,E.reject=t,E},a=e=>null==e?"":""+e,i=/###/g,o=e=>e&&e.indexOf("###")>-1?e.replace(i,"."):e,_=e=>!e||t(e),n=(e,E,a)=>{const i=t(E)?E.split("."):E;let n=0;for(;n{const{obj:a,k:i}=n(e,t,Object);if(void 0!==a||1===t.length)return void(a[i]=E);let o=t[t.length-1],_=t.slice(0,t.length-1),r=n(e,_,Object);for(;void 0===r.obj&&_.length;)o=`${_[_.length-1]}.${o}`,_=_.slice(0,_.length-1),r=n(e,_,Object),r?.obj&&void 0!==r.obj[`${r.k}.${o}`]&&(r.obj=void 0);r.obj[`${r.k}.${o}`]=E},S=(e,t)=>{const{obj:E,k:a}=n(e,t);if(E&&Object.prototype.hasOwnProperty.call(E,a))return E[a]},T=(e,E,a)=>{for(const i in E)"__proto__"!==i&&"constructor"!==i&&(i in e?t(e[i])||e[i]instanceof String||t(E[i])||E[i]instanceof String?a&&(e[i]=E[i]):T(e[i],E[i],a):e[i]=E[i]);return e},s=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var I={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const l=e=>t(e)?e.replace(/[&<>"'\/]/g,e=>I[e]):e;const A=[" ",",","?","!",";"],O=new class{constructor(e){this.capacity=e,this.regExpMap=new Map,this.regExpQueue=[]}getRegExp(e){const t=this.regExpMap.get(e);if(void 0!==t)return t;const E=new RegExp(e);return this.regExpQueue.length===this.capacity&&this.regExpMap.delete(this.regExpQueue.shift()),this.regExpMap.set(e,E),this.regExpQueue.push(e),E}}(20),u=function(e,t){let E=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".";if(!e)return;if(e[t]){if(!Object.prototype.hasOwnProperty.call(e,t))return;return e[t]}const a=t.split(E);let i=e;for(let e=0;e-1&&_e?.replace("_","-"),N={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console?.[e]?.apply?.(console,t)}};class d{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.init(e,t)}init(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=t.prefix||"i18next:",this.logger=e||N,this.options=t,this.debug=t.debug}log(){for(var e=arguments.length,t=new Array(e),E=0;E{this.observers[e]||(this.observers[e]=new Map);const E=this.observers[e].get(t)||0;this.observers[e].set(t,E+1)}),this}off(e,t){this.observers[e]&&(t?this.observers[e].delete(t):delete this.observers[e])}emit(e){for(var t=arguments.length,E=new Array(t>1?t-1:0),a=1;a{let[t,a]=e;for(let e=0;e{let[a,i]=t;for(let t=0;t1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=e||{},this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),void 0===this.options.ignoreJSONStructure&&(this.options.ignoreJSONStructure=!0)}addNamespaces(e){this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}removeNamespaces(e){const t=this.options.ns.indexOf(e);t>-1&&this.options.ns.splice(t,1)}getResource(e,E,a){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o=void 0!==i.keySeparator?i.keySeparator:this.options.keySeparator,_=void 0!==i.ignoreJSONStructure?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let n;e.indexOf(".")>-1?n=e.split("."):(n=[e,E],a&&(Array.isArray(a)?n.push(...a):t(a)&&o?n.push(...a.split(o)):n.push(a)));const r=S(this.data,n);return!r&&!E&&!a&&e.indexOf(".")>-1&&(e=n[0],E=n[1],a=n.slice(2).join(".")),!r&&_&&t(a)?u(this.data?.[e]?.[E],a,o):r}addResource(e,t,E,a){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1};const o=void 0!==i.keySeparator?i.keySeparator:this.options.keySeparator;let _=[e,t];E&&(_=_.concat(o?E.split(o):E)),e.indexOf(".")>-1&&(_=e.split("."),a=t,t=_[1]),this.addNamespaces(t),r(this.data,_,a),i.silent||this.emit("added",e,t,E,a)}addResources(e,E,a){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(const i in a)(t(a[i])||Array.isArray(a[i]))&&this.addResource(e,E,i,a[i],{silent:!0});i.silent||this.emit("added",e,E,a)}addResourceBundle(e,t,E,a,i){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1,skipCopy:!1},_=[e,t];e.indexOf(".")>-1&&(_=e.split("."),a=E,E=t,t=_[1]),this.addNamespaces(t);let n=S(this.data,_)||{};o.skipCopy||(E=JSON.parse(JSON.stringify(E))),a?T(n,E,i):n={...n,...E},r(this.data,_,n),o.silent||this.emit("added",e,t,E)}removeResourceBundle(e,t){this.hasResourceBundle(e,t)&&delete this.data[e][t],this.removeNamespaces(t),this.emit("removed",e,t)}hasResourceBundle(e,t){return void 0!==this.getResource(e,t)}getResourceBundle(e,t){return t||(t=this.options.defaultNS),this.getResource(e,t)}getDataByLanguage(e){return this.data[e]}hasLanguageSomeTranslations(e){const t=this.getDataByLanguage(e);return!!(t&&Object.keys(t)||[]).find(e=>t[e]&&Object.keys(t[e]).length>0)}toJSON(){return this.data}}var D={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,E,a,i){return e.forEach(e=>{t=this.processors[e]?.process(t,E,a,i)??t}),t}};const C={},p=e=>!t(e)&&"boolean"!=typeof e&&"number"!=typeof e;class P extends L{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var E,a;super(),E=e,a=this,["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"].forEach(e=>{E[e]&&(a[e]=E[e])}),this.options=t,void 0===this.options.keySeparator&&(this.options.keySeparator="."),this.logger=c.create("translator")}changeLanguage(e){e&&(this.language=e)}exists(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};if(null==e)return!1;const E=this.resolve(e,t);return void 0!==E?.res}extractFromKey(e,E){let a=void 0!==E.nsSeparator?E.nsSeparator:this.options.nsSeparator;void 0===a&&(a=":");const i=void 0!==E.keySeparator?E.keySeparator:this.options.keySeparator;let o=E.ns||this.options.defaultNS||[];const _=a&&e.indexOf(a)>-1,n=!(this.options.userDefinedKeySeparator||E.keySeparator||this.options.userDefinedNsSeparator||E.nsSeparator||((e,t,E)=>{t=t||"",E=E||"";const a=A.filter(e=>t.indexOf(e)<0&&E.indexOf(e)<0);if(0===a.length)return!0;const i=O.getRegExp(`(${a.map(e=>"?"===e?"\\?":e).join("|")})`);let o=!i.test(e);if(!o){const t=e.indexOf(E);t>0&&!i.test(e.substring(0,t))&&(o=!0)}return o})(e,a,i));if(_&&!n){const E=e.match(this.interpolator.nestingRegexp);if(E&&E.length>0)return{key:e,namespaces:t(o)?[o]:o};const _=e.split(a);(a!==i||a===i&&this.options.ns.indexOf(_[0])>-1)&&(o=_.shift()),e=_.join(i)}return{key:e,namespaces:t(o)?[o]:o}}translate(e,E,a){if("object"!=typeof E&&this.options.overloadTranslationOptionHandler&&(E=this.options.overloadTranslationOptionHandler(arguments)),"object"==typeof E&&(E={...E}),E||(E={}),null==e)return"";Array.isArray(e)||(e=[String(e)]);const i=void 0!==E.returnDetails?E.returnDetails:this.options.returnDetails,o=void 0!==E.keySeparator?E.keySeparator:this.options.keySeparator,{key:_,namespaces:n}=this.extractFromKey(e[e.length-1],E),r=n[n.length-1],S=E.lng||this.language,T=E.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if("cimode"===S?.toLowerCase()){if(T){const e=E.nsSeparator||this.options.nsSeparator;return i?{res:`${r}${e}${_}`,usedKey:_,exactUsedKey:_,usedLng:S,usedNS:r,usedParams:this.getUsedParamsDetails(E)}:`${r}${e}${_}`}return i?{res:_,usedKey:_,exactUsedKey:_,usedLng:S,usedNS:r,usedParams:this.getUsedParamsDetails(E)}:_}const s=this.resolve(e,E);let I=s?.res;const l=s?.usedKey||_,A=s?.exactUsedKey||_,O=void 0!==E.joinArrays?E.joinArrays:this.options.joinArrays,u=!this.i18nFormat||this.i18nFormat.handleAsObject,R=void 0!==E.count&&!t(E.count),N=P.hasDefaultValue(E),d=R?this.pluralResolver.getSuffix(S,E.count,E):"",c=E.ordinal&&R?this.pluralResolver.getSuffix(S,E.count,{ordinal:!1}):"",L=R&&!E.ordinal&&0===E.count,m=L&&E[`defaultValue${this.options.pluralSeparator}zero`]||E[`defaultValue${d}`]||E[`defaultValue${c}`]||E.defaultValue;let D=I;u&&!I&&N&&(D=m);const C=p(D),B=Object.prototype.toString.apply(D);if(!(u&&D&&C&&["[object Number]","[object Function]","[object RegExp]"].indexOf(B)<0)||t(O)&&Array.isArray(D))if(u&&t(O)&&Array.isArray(I))I=I.join(O),I&&(I=this.extendTranslation(I,e,E,a));else{let t=!1,i=!1;!this.isValidLookup(I)&&N&&(t=!0,I=m),this.isValidLookup(I)||(i=!0,I=_);const n=(E.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&i?void 0:I,T=N&&m!==I&&this.options.updateMissing;if(i||t||T){if(this.logger.log(T?"updateKey":"missingKey",S,r,_,T?m:I),o){const e=this.resolve(_,{...E,keySeparator:!1});e&&e.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let e=[];const t=this.languageUtils.getFallbackCodes(this.options.fallbackLng,E.lng||this.language);if("fallback"===this.options.saveMissingTo&&t&&t[0])for(let E=0;E{const i=N&&a!==I?a:n;this.options.missingKeyHandler?this.options.missingKeyHandler(e,r,t,i,T,E):this.backendConnector?.saveMissing&&this.backendConnector.saveMissing(e,r,t,i,T,E),this.emit("missingKey",e,r,t,I)};this.options.saveMissing&&(this.options.saveMissingPlurals&&R?e.forEach(e=>{const t=this.pluralResolver.getSuffixes(e,E);L&&E[`defaultValue${this.options.pluralSeparator}zero`]&&t.indexOf(`${this.options.pluralSeparator}zero`)<0&&t.push(`${this.options.pluralSeparator}zero`),t.forEach(t=>{a([e],_+t,E[`defaultValue${t}`]||m)})}):a(e,_,m))}I=this.extendTranslation(I,e,E,s,a),i&&I===_&&this.options.appendNamespaceToMissingKey&&(I=`${r}:${_}`),(i||t)&&this.options.parseMissingKeyHandler&&(I=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${r}:${_}`:_,t?I:void 0))}else{if(!E.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const e=this.options.returnedObjectHandler?this.options.returnedObjectHandler(l,D,{...E,ns:n}):`key '${_} (${this.language})' returned an object instead of string.`;return i?(s.res=e,s.usedParams=this.getUsedParamsDetails(E),s):e}if(o){const e=Array.isArray(D),t=e?[]:{},a=e?A:l;for(const e in D)if(Object.prototype.hasOwnProperty.call(D,e)){const i=`${a}${o}${e}`;t[e]=N&&!I?this.translate(i,{...E,defaultValue:p(m)?m[e]:void 0,joinArrays:!1,ns:n}):this.translate(i,{...E,joinArrays:!1,ns:n}),t[e]===i&&(t[e]=D[e])}I=t}}return i?(s.res=I,s.usedParams=this.getUsedParamsDetails(E),s):I}extendTranslation(e,E,a,i,o){var _=this;if(this.i18nFormat?.parse)e=this.i18nFormat.parse(e,{...this.options.interpolation.defaultVariables,...a},a.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!a.skipInterpolation){a.interpolation&&this.interpolator.init({...a,interpolation:{...this.options.interpolation,...a.interpolation}});const n=t(e)&&(void 0!==a?.interpolation?.skipOnVariables?a.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let r;if(n){const t=e.match(this.interpolator.nestingRegexp);r=t&&t.length}let S=a.replace&&!t(a.replace)?a.replace:a;if(this.options.interpolation.defaultVariables&&(S={...this.options.interpolation.defaultVariables,...S}),e=this.interpolator.interpolate(e,S,a.lng||this.language||i.usedLng,a),n){const t=e.match(this.interpolator.nestingRegexp);r<(t&&t.length)&&(a.nest=!1)}!a.lng&&i&&i.res&&(a.lng=this.language||i.usedLng),!1!==a.nest&&(e=this.interpolator.nest(e,function(){for(var e=arguments.length,t=new Array(e),i=0;i1&&void 0!==arguments[1]?arguments[1]:{};return t(e)&&(e=[e]),e.forEach(e=>{if(this.isValidLookup(E))return;const r=this.extractFromKey(e,n),S=r.key;a=S;let T=r.namespaces;this.options.fallbackNS&&(T=T.concat(this.options.fallbackNS));const s=void 0!==n.count&&!t(n.count),I=s&&!n.ordinal&&0===n.count,l=void 0!==n.context&&(t(n.context)||"number"==typeof n.context)&&""!==n.context,A=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);T.forEach(e=>{this.isValidLookup(E)||(_=e,C[`${A[0]}-${e}`]||!this.utils?.hasLoadedNamespace||this.utils?.hasLoadedNamespace(_)||(C[`${A[0]}-${e}`]=!0,this.logger.warn(`key "${a}" for languages "${A.join(", ")}" won't get resolved as namespace "${_}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),A.forEach(t=>{if(this.isValidLookup(E))return;o=t;const a=[S];if(this.i18nFormat?.addLookupKeys)this.i18nFormat.addLookupKeys(a,S,t,e,n);else{let e;s&&(e=this.pluralResolver.getSuffix(t,n.count,n));const E=`${this.options.pluralSeparator}zero`,i=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(s&&(a.push(S+e),n.ordinal&&0===e.indexOf(i)&&a.push(S+e.replace(i,this.options.pluralSeparator)),I&&a.push(S+E)),l){const t=`${S}${this.options.contextSeparator}${n.context}`;a.push(t),s&&(a.push(t+e),n.ordinal&&0===e.indexOf(i)&&a.push(t+e.replace(i,this.options.pluralSeparator)),I&&a.push(t+E))}}let _;for(;_=a.pop();)this.isValidLookup(E)||(i=_,E=this.getResource(t,e,_,n))}))})}),{res:E,usedKey:a,exactUsedKey:i,usedLng:o,usedNS:_}}isValidLookup(e){return!(void 0===e||!this.options.returnNull&&null===e||!this.options.returnEmptyString&&""===e)}getResource(e,t,E){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat?.getResource?this.i18nFormat.getResource(e,t,E,a):this.resourceStore.getResource(e,t,E,a)}getUsedParamsDetails(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const E=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],a=e.replace&&!t(e.replace);let i=a?e.replace:e;if(a&&void 0!==e.count&&(i.count=e.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!a){i={...i};for(const e of E)delete i[e]}return i}static hasDefaultValue(e){const t="defaultValue";for(const E in e)if(Object.prototype.hasOwnProperty.call(e,E)&&t===E.substring(0,12)&&void 0!==e[E])return!0;return!1}}class B{constructor(e){this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=c.create("languageUtils")}getScriptPartFromCode(e){if(!(e=R(e))||e.indexOf("-")<0)return null;const t=e.split("-");return 2===t.length?null:(t.pop(),"x"===t[t.length-1].toLowerCase()?null:this.formatLanguageCode(t.join("-")))}getLanguagePartFromCode(e){if(!(e=R(e))||e.indexOf("-")<0)return e;const t=e.split("-");return this.formatLanguageCode(t[0])}formatLanguageCode(e){if(t(e)&&e.indexOf("-")>-1){let t;try{t=Intl.getCanonicalLocales(e)[0]}catch(e){}return t&&this.options.lowerCaseLng&&(t=t.toLowerCase()),t||(this.options.lowerCaseLng?e.toLowerCase():e)}return this.options.cleanCode||this.options.lowerCaseLng?e.toLowerCase():e}isSupportedCode(e){return("languageOnly"===this.options.load||this.options.nonExplicitSupportedLngs)&&(e=this.getLanguagePartFromCode(e)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(e)>-1}getBestMatchFromCodes(e){if(!e)return null;let t;return e.forEach(e=>{if(t)return;const E=this.formatLanguageCode(e);this.options.supportedLngs&&!this.isSupportedCode(E)||(t=E)}),!t&&this.options.supportedLngs&&e.forEach(e=>{if(t)return;const E=this.getLanguagePartFromCode(e);if(this.isSupportedCode(E))return t=E;t=this.options.supportedLngs.find(e=>e===E?e:e.indexOf("-")<0&&E.indexOf("-")<0?void 0:e.indexOf("-")>0&&E.indexOf("-")<0&&e.substring(0,e.indexOf("-"))===E||0===e.indexOf(E)&&E.length>1?e:void 0)}),t||(t=this.getFallbackCodes(this.options.fallbackLng)[0]),t}getFallbackCodes(e,E){if(!e)return[];if("function"==typeof e&&(e=e(E)),t(e)&&(e=[e]),Array.isArray(e))return e;if(!E)return e.default||[];let a=e[E];return a||(a=e[this.getScriptPartFromCode(E)]),a||(a=e[this.formatLanguageCode(E)]),a||(a=e[this.getLanguagePartFromCode(E)]),a||(a=e.default),a||[]}toResolveHierarchy(e,E){const a=this.getFallbackCodes(E||this.options.fallbackLng||[],e),i=[],o=e=>{e&&(this.isSupportedCode(e)?i.push(e):this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`))};return t(e)&&(e.indexOf("-")>-1||e.indexOf("_")>-1)?("languageOnly"!==this.options.load&&o(this.formatLanguageCode(e)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&o(this.getScriptPartFromCode(e)),"currentOnly"!==this.options.load&&o(this.getLanguagePartFromCode(e))):t(e)&&o(this.formatLanguageCode(e)),a.forEach(e=>{i.indexOf(e)<0&&o(this.formatLanguageCode(e))}),i}}const h={zero:0,one:1,two:2,few:3,many:4,other:5},f={select:e=>1===e?"one":"other",resolvedOptions:()=>({pluralCategories:["one","other"]})};class W{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.languageUtils=e,this.options=t,this.logger=c.create("pluralResolver"),this.pluralRulesCache={}}addRule(e,t){this.rules[e]=t}clearCache(){this.pluralRulesCache={}}getRule(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const E=R("dev"===e?"en":e),a=t.ordinal?"ordinal":"cardinal",i=JSON.stringify({cleanedCode:E,type:a});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let o;try{o=new Intl.PluralRules(E,{type:a})}catch(E){if(!Intl)return this.logger.error("No Intl support, please use an Intl polyfill!"),f;if(!e.match(/-|_/))return f;const a=this.languageUtils.getLanguagePartFromCode(e);o=this.getRule(a,t)}return this.pluralRulesCache[i]=o,o}needsPlural(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},E=this.getRule(e,t);return E||(E=this.getRule("dev",t)),E?.resolvedOptions().pluralCategories.length>1}getPluralFormsOfKey(e,t){let E=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.getSuffixes(e,E).map(e=>`${t}${e}`)}getSuffixes(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},E=this.getRule(e,t);return E||(E=this.getRule("dev",t)),E?E.resolvedOptions().pluralCategories.sort((e,t)=>h[e]-h[t]).map(e=>`${this.options.prepend}${t.ordinal?`ordinal${this.options.prepend}`:""}${e}`):[]}getSuffix(e,t){let E=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const a=this.getRule(e,E);return a?`${this.options.prepend}${E.ordinal?`ordinal${this.options.prepend}`:""}${a.select(t)}`:(this.logger.warn(`no plural rule found for: ${e}`),this.getSuffix("dev",t,E))}}const g=function(e,E,a){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:".",o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],_=((e,t,E)=>{const a=S(e,E);return void 0!==a?a:S(t,E)})(e,E,a);return!_&&o&&t(a)&&(_=u(e,a,i),void 0===_&&(_=u(E,a,i))),_},M=e=>e.replace(/\$/g,"$$$$");class v{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=c.create("interpolator"),this.options=e,this.format=e?.interpolation?.format||(e=>e),this.init(e)}init(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.interpolation||(e.interpolation={escapeValue:!0});const{escape:t,escapeValue:E,useRawValueToEscape:a,prefix:i,prefixEscaped:o,suffix:_,suffixEscaped:n,formatSeparator:r,unescapeSuffix:S,unescapePrefix:T,nestingPrefix:I,nestingPrefixEscaped:A,nestingSuffix:O,nestingSuffixEscaped:u,nestingOptionsSeparator:R,maxReplaces:N,alwaysFormat:d}=e.interpolation;this.escape=void 0!==t?t:l,this.escapeValue=void 0===E||E,this.useRawValueToEscape=void 0!==a&&a,this.prefix=i?s(i):o||"{{",this.suffix=_?s(_):n||"}}",this.formatSeparator=r||",",this.unescapePrefix=S?"":T||"-",this.unescapeSuffix=this.unescapePrefix?"":S||"",this.nestingPrefix=I?s(I):A||s("$t("),this.nestingSuffix=O?s(O):u||s(")"),this.nestingOptionsSeparator=R||",",this.maxReplaces=N||1e3,this.alwaysFormat=void 0!==d&&d,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const e=(e,t)=>e?.source===t?(e.lastIndex=0,e):new RegExp(t,"g");this.regexp=e(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=e(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=e(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(e,E,i,o){let _,n,r;const S=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},T=e=>{if(e.indexOf(this.formatSeparator)<0){const t=g(E,S,e,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(t,void 0,i,{...o,...E,interpolationkey:e}):t}const t=e.split(this.formatSeparator),a=t.shift().trim(),_=t.join(this.formatSeparator).trim();return this.format(g(E,S,a,this.options.keySeparator,this.options.ignoreJSONStructure),_,i,{...o,...E,interpolationkey:a})};this.resetRegExp();const s=o?.missingInterpolationHandler||this.options.missingInterpolationHandler,I=void 0!==o?.interpolation?.skipOnVariables?o.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:e=>M(e)},{regex:this.regexp,safeValue:e=>this.escapeValue?M(this.escape(e)):M(e)}].forEach(E=>{for(r=0;_=E.regex.exec(e);){const i=_[1].trim();if(n=T(i),void 0===n)if("function"==typeof s){const E=s(e,_,o);n=t(E)?E:""}else if(o&&Object.prototype.hasOwnProperty.call(o,i))n="";else{if(I){n=_[0];continue}this.logger.warn(`missed to pass in variable ${i} for interpolating ${e}`),n=""}else t(n)||this.useRawValueToEscape||(n=a(n));const S=E.safeValue(n);if(e=e.replace(_[0],S),I?(E.regex.lastIndex+=n.length,E.regex.lastIndex-=_[0].length):E.regex.lastIndex=0,r++,r>=this.maxReplaces)break}}),e}nest(e,E){let i,o,_,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=(e,t)=>{const E=this.nestingOptionsSeparator;if(e.indexOf(E)<0)return e;const a=e.split(new RegExp(`${E}[ ]*{`));let i=`{${a[1]}`;e=a[0],i=this.interpolate(i,_);const o=i.match(/'/g),n=i.match(/"/g);((o?.length??0)%2==0&&!n||n.length%2!=0)&&(i=i.replace(/'/g,'"'));try{_=JSON.parse(i),t&&(_={...t,..._})}catch(t){return this.logger.warn(`failed parsing options string in nesting for key ${e}`,t),`${e}${E}${i}`}return _.defaultValue&&_.defaultValue.indexOf(this.prefix)>-1&&delete _.defaultValue,e};for(;i=this.nestingRegexp.exec(e);){let S=[];_={...n},_=_.replace&&!t(_.replace)?_.replace:_,_.applyPostProcessor=!1,delete _.defaultValue;let T=!1;if(-1!==i[0].indexOf(this.formatSeparator)&&!/{.*}/.test(i[1])){const e=i[1].split(this.formatSeparator).map(e=>e.trim());i[1]=e.shift(),S=e,T=!0}if(o=E(r.call(this,i[1].trim(),_),_),o&&i[0]===e&&!t(o))return o;t(o)||(o=a(o)),o||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`),o=""),T&&(o=S.reduce((e,t)=>this.format(e,t,n.lng,{...n,interpolationkey:i[1].trim()}),o.trim())),e=e.replace(i[0],o),this.regexp.lastIndex=0}return e}}const U=e=>{const t={};return(E,a,i)=>{let o=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(o={...o,[i.interpolationkey]:void 0});const _=a+JSON.stringify(o);let n=t[_];return n||(n=e(R(a),i),t[_]=n),n(E)}};class G{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=c.create("formatter"),this.options=e,this.formats={number:U((e,t)=>{const E=new Intl.NumberFormat(e,{...t});return e=>E.format(e)}),currency:U((e,t)=>{const E=new Intl.NumberFormat(e,{...t,style:"currency"});return e=>E.format(e)}),datetime:U((e,t)=>{const E=new Intl.DateTimeFormat(e,{...t});return e=>E.format(e)}),relativetime:U((e,t)=>{const E=new Intl.RelativeTimeFormat(e,{...t});return e=>E.format(e,t.range||"day")}),list:U((e,t)=>{const E=new Intl.ListFormat(e,{...t});return e=>E.format(e)})},this.init(e)}init(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}};this.formatSeparator=t.interpolation.formatSeparator||","}add(e,t){this.formats[e.toLowerCase().trim()]=t}addCached(e,t){this.formats[e.toLowerCase().trim()]=U(t)}format(e,t,E){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const i=t.split(this.formatSeparator);if(i.length>1&&i[0].indexOf("(")>1&&i[0].indexOf(")")<0&&i.find(e=>e.indexOf(")")>-1)){const e=i.findIndex(e=>e.indexOf(")")>-1);i[0]=[i[0],...i.splice(1,e)].join(this.formatSeparator)}return i.reduce((e,t)=>{const{formatName:i,formatOptions:o}=(e=>{let t=e.toLowerCase().trim();const E={};if(e.indexOf("(")>-1){const a=e.split("(");t=a[0].toLowerCase().trim();const i=a[1].substring(0,a[1].length-1);"currency"===t&&i.indexOf(":")<0?E.currency||(E.currency=i.trim()):"relativetime"===t&&i.indexOf(":")<0?E.range||(E.range=i.trim()):i.split(";").forEach(e=>{if(e){const[t,...a]=e.split(":"),i=a.join(":").trim().replace(/^'+|'+$/g,""),o=t.trim();E[o]||(E[o]=i),"false"===i&&(E[o]=!1),"true"===i&&(E[o]=!0),isNaN(i)||(E[o]=parseInt(i,10))}})}return{formatName:t,formatOptions:E}})(t);if(this.formats[i]){let t=e;try{const _=a?.formatParams?.[a.interpolationkey]||{},n=_.locale||_.lng||a.locale||a.lng||E;t=this.formats[i](e,n,{...o,...a,..._})}catch(e){this.logger.warn(e)}return t}return this.logger.warn(`there was no format function for ${i}`),e},e)}}class y extends L{constructor(e,t,E){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};super(),this.backend=e,this.store=t,this.services=E,this.languageUtils=E.languageUtils,this.options=a,this.logger=c.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=a.maxParallelReads||10,this.readingCalls=0,this.maxRetries=a.maxRetries>=0?a.maxRetries:5,this.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,this.state={},this.queue=[],this.backend?.init?.(E,a.backend,a)}queueLoad(e,t,E,a){const i={},o={},_={},n={};return e.forEach(e=>{let a=!0;t.forEach(t=>{const _=`${e}|${t}`;!E.reload&&this.store.hasResourceBundle(e,t)?this.state[_]=2:this.state[_]<0||(1===this.state[_]?void 0===o[_]&&(o[_]=!0):(this.state[_]=1,a=!1,void 0===o[_]&&(o[_]=!0),void 0===i[_]&&(i[_]=!0),void 0===n[t]&&(n[t]=!0)))}),a||(_[e]=!0)}),(Object.keys(i).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:a}),{toLoad:Object.keys(i),pending:Object.keys(o),toLoadLanguages:Object.keys(_),toLoadNamespaces:Object.keys(n)}}loaded(e,t,E){const a=e.split("|"),i=a[0],o=a[1];t&&this.emit("failedLoading",i,o,t),!t&&E&&this.store.addResourceBundle(i,o,E,void 0,void 0,{skipCopy:!0}),this.state[e]=t?-1:2,t&&E&&(this.state[e]=0);const _={};this.queue.forEach(E=>{((e,t,E)=>{const{obj:a,k:i}=n(e,t,Object);a[i]=a[i]||[],a[i].push(E)})(E.loaded,[i],o),((e,t)=>{void 0!==e.pending[t]&&(delete e.pending[t],e.pendingCount--)})(E,e),t&&E.errors.push(t),0!==E.pendingCount||E.done||(Object.keys(E.loaded).forEach(e=>{_[e]||(_[e]={});const t=E.loaded[e];t.length&&t.forEach(t=>{void 0===_[e][t]&&(_[e][t]=!0)})}),E.done=!0,E.errors.length?E.callback(E.errors):E.callback())}),this.emit("loaded",_),this.queue=this.queue.filter(e=>!e.done)}read(e,t,E){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:this.retryTimeout,o=arguments.length>5?arguments[5]:void 0;if(!e.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads)return void this.waitingReads.push({lng:e,ns:t,fcName:E,tried:a,wait:i,callback:o});this.readingCalls++;const _=(_,n)=>{if(this.readingCalls--,this.waitingReads.length>0){const e=this.waitingReads.shift();this.read(e.lng,e.ns,e.fcName,e.tried,e.wait,e.callback)}_&&n&&a{this.read.call(this,e,t,E,a+1,2*i,o)},i):o(_,n)},n=this.backend[E].bind(this.backend);if(2!==n.length)return n(e,t,_);try{const E=n(e,t);E&&"function"==typeof E.then?E.then(e=>_(null,e)).catch(_):_(null,E)}catch(e){_(e)}}prepareLoading(e,E){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();t(e)&&(e=this.languageUtils.toResolveHierarchy(e)),t(E)&&(E=[E]);const o=this.queueLoad(e,E,a,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach(e=>{this.loadOne(e)})}load(e,t,E){this.prepareLoading(e,t,{},E)}reload(e,t,E){this.prepareLoading(e,t,{reload:!0},E)}loadOne(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const E=e.split("|"),a=E[0],i=E[1];this.read(a,i,"read",void 0,void 0,(E,o)=>{E&&this.logger.warn(`${t}loading namespace ${i} for language ${a} failed`,E),!E&&o&&this.logger.log(`${t}loaded namespace ${i} for language ${a}`,o),this.loaded(e,E,o)})}saveMissing(e,t,E,a,i){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},_=arguments.length>6&&void 0!==arguments[6]?arguments[6]:()=>{};if(!this.services?.utils?.hasLoadedNamespace||this.services?.utils?.hasLoadedNamespace(t)){if(null!=E&&""!==E){if(this.backend?.create){const n={...o,isUpdate:i},r=this.backend.create.bind(this.backend);if(r.length<6)try{let i;i=5===r.length?r(e,t,E,a,n):r(e,t,E,a),i&&"function"==typeof i.then?i.then(e=>_(null,e)).catch(_):_(null,i)}catch(e){_(e)}else r(e,t,E,a,_,n)}e&&e[0]&&this.store.addResource(e[0],t,E,a)}}else this.logger.warn(`did not save key "${E}" as the namespace "${t}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")}}const b=()=>({debug:!1,initAsync:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let E={};if("object"==typeof e[1]&&(E=e[1]),t(e[1])&&(E.defaultValue=e[1]),t(e[2])&&(E.tDescription=e[2]),"object"==typeof e[2]||"object"==typeof e[3]){const t=e[3]||e[2];Object.keys(t).forEach(e=>{E[e]=t[e]})}return E},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),k=e=>(t(e.ns)&&(e.ns=[e.ns]),t(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),t(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs?.indexOf?.("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),"boolean"==typeof e.initImmediate&&(e.initAsync=e.initImmediate),e),F=()=>{};class V extends L{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;var E;if(super(),this.options=k(e),this.services={},this.logger=c,this.modules={external:[]},E=this,Object.getOwnPropertyNames(Object.getPrototypeOf(E)).forEach(e=>{"function"==typeof E[e]&&(E[e]=E[e].bind(E))}),t&&!this.isInitialized&&!e.isClone){if(!this.options.initAsync)return this.init(e,t),this;setTimeout(()=>{this.init(e,t)},0)}}init(){var e=this;let a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,"function"==typeof a&&(i=a,a={}),null==a.defaultNS&&a.ns&&(t(a.ns)?a.defaultNS=a.ns:a.ns.indexOf("translation")<0&&(a.defaultNS=a.ns[0]));const o=b();this.options={...o,...this.options,...k(a)},this.options.interpolation={...o.interpolation,...this.options.interpolation},void 0!==a.keySeparator&&(this.options.userDefinedKeySeparator=a.keySeparator),void 0!==a.nsSeparator&&(this.options.userDefinedNsSeparator=a.nsSeparator);const _=e=>e?"function"==typeof e?new e:e:null;if(!this.options.isClone){let t;this.modules.logger?c.init(_(this.modules.logger),this.options):c.init(null,this.options),t=this.modules.formatter?this.modules.formatter:G;const E=new B(this.options);this.store=new m(this.options.resources,this.options);const a=this.services;a.logger=c,a.resourceStore=this.store,a.languageUtils=E,a.pluralResolver=new W(E,{prepend:this.options.pluralSeparator,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),!t||this.options.interpolation.format&&this.options.interpolation.format!==o.interpolation.format||(a.formatter=_(t),a.formatter.init(a,this.options),this.options.interpolation.format=a.formatter.format.bind(a.formatter)),a.interpolator=new v(this.options),a.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},a.backendConnector=new y(_(this.modules.backend),a.resourceStore,a,this.options),a.backendConnector.on("*",function(t){for(var E=arguments.length,a=new Array(E>1?E-1:0),i=1;i1?E-1:0),i=1;i{e.init&&e.init(this)})}if(this.format=this.options.interpolation.format,i||(i=F),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const e=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);e.length>0&&"dev"!==e[0]&&(this.options.lng=e[0])}this.services.languageDetector||this.options.lng||this.logger.warn("init: no languageDetector is used and no lng is defined");["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(t=>{this[t]=function(){return e.store[t](...arguments)}});["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(t=>{this[t]=function(){return e.store[t](...arguments),e}});const n=E(),r=()=>{const e=(e,t)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),n.resolve(t),i(e,t)};if(this.languages&&!this.isInitialized)return e(null,this.t.bind(this));this.changeLanguage(this.options.lng,e)};return this.options.resources||!this.options.initAsync?r():setTimeout(r,0),n}loadResources(e){let E=arguments.length>1&&void 0!==arguments[1]?arguments[1]:F;const a=t(e)?e:this.language;if("function"==typeof e&&(E=e),!this.options.resources||this.options.partialBundledLanguages){if("cimode"===a?.toLowerCase()&&(!this.options.preload||0===this.options.preload.length))return E();const e=[],t=t=>{if(!t)return;if("cimode"===t)return;this.services.languageUtils.toResolveHierarchy(t).forEach(t=>{"cimode"!==t&&e.indexOf(t)<0&&e.push(t)})};if(a)t(a);else{this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(e=>t(e))}this.options.preload?.forEach?.(e=>t(e)),this.services.backendConnector.load(e,this.options.ns,e=>{e||this.resolvedLanguage||!this.language||this.setResolvedLanguage(this.language),E(e)})}else E(null)}reloadResources(e,t,a){const i=E();return"function"==typeof e&&(a=e,e=void 0),"function"==typeof t&&(a=t,t=void 0),e||(e=this.languages),t||(t=this.options.ns),a||(a=F),this.services.backendConnector.reload(e,t,e=>{i.resolve(),a(e)}),i}use(e){if(!e)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!e.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return"backend"===e.type&&(this.modules.backend=e),("logger"===e.type||e.log&&e.warn&&e.error)&&(this.modules.logger=e),"languageDetector"===e.type&&(this.modules.languageDetector=e),"i18nFormat"===e.type&&(this.modules.i18nFormat=e),"postProcessor"===e.type&&D.addPostProcessor(e),"formatter"===e.type&&(this.modules.formatter=e),"3rdParty"===e.type&&this.modules.external.push(e),this}setResolvedLanguage(e){if(e&&this.languages&&!(["cimode","dev"].indexOf(e)>-1))for(let e=0;e-1)&&this.store.hasLanguageSomeTranslations(t)){this.resolvedLanguage=t;break}}}changeLanguage(e,a){var i=this;this.isLanguageChangingTo=e;const o=E();this.emit("languageChanging",e);const _=e=>{this.language=e,this.languages=this.services.languageUtils.toResolveHierarchy(e),this.resolvedLanguage=void 0,this.setResolvedLanguage(e)},n=(e,t)=>{t?(_(t),this.translator.changeLanguage(t),this.isLanguageChangingTo=void 0,this.emit("languageChanged",t),this.logger.log("languageChanged",t)):this.isLanguageChangingTo=void 0,o.resolve(function(){return i.t(...arguments)}),a&&a(e,function(){return i.t(...arguments)})},r=E=>{e||E||!this.services.languageDetector||(E=[]);const a=t(E)?E:this.services.languageUtils.getBestMatchFromCodes(E);a&&(this.language||_(a),this.translator.language||this.translator.changeLanguage(a),this.services.languageDetector?.cacheUserLanguage?.(a)),this.loadResources(a,e=>{n(e,a)})};return e||!this.services.languageDetector||this.services.languageDetector.async?!e&&this.services.languageDetector&&this.services.languageDetector.async?0===this.services.languageDetector.detect.length?this.services.languageDetector.detect().then(r):this.services.languageDetector.detect(r):r(e):r(this.services.languageDetector.detect()),o}getFixedT(e,E,a){var i=this;const o=function(e,t){let E;if("object"!=typeof t){for(var _=arguments.length,n=new Array(_>2?_-2:0),r=2;r<_;r++)n[r-2]=arguments[r];E=i.options.overloadTranslationOptionHandler([e,t].concat(n))}else E={...t};E.lng=E.lng||o.lng,E.lngs=E.lngs||o.lngs,E.ns=E.ns||o.ns,""!==E.keyPrefix&&(E.keyPrefix=E.keyPrefix||a||o.keyPrefix);const S=i.options.keySeparator||".";let T;return T=E.keyPrefix&&Array.isArray(e)?e.map(e=>`${E.keyPrefix}${S}${e}`):E.keyPrefix?`${E.keyPrefix}${S}${e}`:e,i.t(T,E)};return t(e)?o.lng=e:o.lngs=e,o.ns=E,o.keyPrefix=a,o}t(){for(var e=arguments.length,t=new Array(e),E=0;E1&&void 0!==arguments[1]?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const E=t.lng||this.resolvedLanguage||this.languages[0],a=!!this.options&&this.options.fallbackLng,i=this.languages[this.languages.length-1];if("cimode"===E.toLowerCase())return!0;const o=(e,t)=>{const E=this.services.backendConnector.state[`${e}|${t}`];return-1===E||0===E||2===E};if(t.precheck){const e=t.precheck(this,o);if(void 0!==e)return e}return!!this.hasResourceBundle(E,e)||(!(this.services.backendConnector.backend&&(!this.options.resources||this.options.partialBundledLanguages))||!(!o(E,e)||a&&!o(i,e)))}loadNamespaces(e,a){const i=E();return this.options.ns?(t(e)&&(e=[e]),e.forEach(e=>{this.options.ns.indexOf(e)<0&&this.options.ns.push(e)}),this.loadResources(e=>{i.resolve(),a&&a(e)}),i):(a&&a(),Promise.resolve())}loadLanguages(e,a){const i=E();t(e)&&(e=[e]);const o=this.options.preload||[],_=e.filter(e=>o.indexOf(e)<0&&this.services.languageUtils.isSupportedCode(e));return _.length?(this.options.preload=o.concat(_),this.loadResources(e=>{i.resolve(),a&&a(e)}),i):(a&&a(),Promise.resolve())}dir(e){if(e||(e=this.resolvedLanguage||(this.languages?.length>0?this.languages[0]:this.language)),!e)return"rtl";const t=this.services?.languageUtils||new B(b());return["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"].indexOf(t.getLanguagePartFromCode(e))>-1||e.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){return new V(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments.length>1?arguments[1]:void 0)}cloneInstance(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:F;const E=e.forkResourceStore;E&&delete e.forkResourceStore;const a={...this.options,...e,isClone:!0},i=new V(a);void 0===e.debug&&void 0===e.prefix||(i.logger=i.logger.clone(e));if(["store","services","language"].forEach(e=>{i[e]=this[e]}),i.services={...this.services},i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},E){const e=Object.keys(this.store.data).reduce((e,t)=>(e[t]={...this.store.data[t]},Object.keys(e[t]).reduce((E,a)=>(E[a]={...e[t][a]},E),{})),{});i.store=new m(e,a),i.services.resourceStore=i.store}return i.translator=new P(i.services,a),i.translator.on("*",function(e){for(var t=arguments.length,E=new Array(t>1?t-1:0),a=1;a>1,T=-7,s=E?i-1:0,I=E?-1:1,l=e[t+s];for(s+=I,o=l&(1<<-T)-1,l>>=-T,T+=n;T>0;o=256*o+e[t+s],s+=I,T-=8);for(_=o&(1<<-T)-1,o>>=-T,T+=a;T>0;_=256*_+e[t+s],s+=I,T-=8);if(0===o)o=1-S;else{if(o===r)return _?NaN:1/0*(l?-1:1);_+=Math.pow(2,a),o-=S}return(l?-1:1)*_*Math.pow(2,o-a)},t.write=function(e,t,E,a,i,o){var _,n,r,S=8*o-i-1,T=(1<>1,I=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,l=a?0:o-1,A=a?1:-1,O=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(n=isNaN(t)?1:0,_=T):(_=Math.floor(Math.log(t)/Math.LN2),t*(r=Math.pow(2,-_))<1&&(_--,r*=2),(t+=_+s>=1?I/r:I*Math.pow(2,1-s))*r>=2&&(_++,r/=2),_+s>=T?(n=0,_=T):_+s>=1?(n=(t*r-1)*Math.pow(2,i),_+=s):(n=t*Math.pow(2,s-1)*Math.pow(2,i),_=0));i>=8;e[E+l]=255&n,l+=A,n/=256,i-=8);for(_=_<0;e[E+l]=255&_,l+=A,_/=256,S-=8);e[E+l-A]|=128*O}},12094(e){e.exports=function(e){return!(!e||"string"==typeof e)&&(e instanceof Array||Array.isArray(e)||e.length>=0&&(e.splice instanceof Function||Object.getOwnPropertyDescriptor(e,e.length-1)&&"String"!==e.constructor.name))}},29365(e){e.exports=[{name:"Abkhaz",local:"Аҧсуа",1:"ab",2:"abk","2T":"abk","2B":"abk",3:"abk"},{name:"Afar",local:"Afaraf",1:"aa",2:"aar","2T":"aar","2B":"aar",3:"aar"},{name:"Afrikaans",local:"Afrikaans",1:"af",2:"afr","2T":"afr","2B":"afr",3:"afr"},{name:"Akan",local:"Akan",1:"ak",2:"aka","2T":"aka","2B":"aka",3:"aka"},{name:"Albanian",local:"Shqip",1:"sq",2:"sqi","2T":"sqi","2B":"alb",3:"sqi"},{name:"Amharic",local:"አማርኛ",1:"am",2:"amh","2T":"amh","2B":"amh",3:"amh"},{name:"Arabic",local:"العربية",1:"ar",2:"ara","2T":"ara","2B":"ara",3:"ara"},{name:"Aragonese",local:"Aragonés",1:"an",2:"arg","2T":"arg","2B":"arg",3:"arg"},{name:"Armenian",local:"Հայերեն",1:"hy",2:"hye","2T":"hye","2B":"arm",3:"hye"},{name:"Assamese",local:"অসমীয়া",1:"as",2:"asm","2T":"asm","2B":"asm",3:"asm"},{name:"Avaric",local:"Авар",1:"av",2:"ava","2T":"ava","2B":"ava",3:"ava"},{name:"Avestan",local:"avesta",1:"ae",2:"ave","2T":"ave","2B":"ave",3:"ave"},{name:"Aymara",local:"Aymar",1:"ay",2:"aym","2T":"aym","2B":"aym",3:"aym"},{name:"Azerbaijani",local:"Azərbaycanca",1:"az",2:"aze","2T":"aze","2B":"aze",3:"aze"},{name:"Bambara",local:"Bamanankan",1:"bm",2:"bam","2T":"bam","2B":"bam",3:"bam"},{name:"Bashkir",local:"Башҡортса",1:"ba",2:"bak","2T":"bak","2B":"bak",3:"bak"},{name:"Basque",local:"Euskara",1:"eu",2:"eus","2T":"eus","2B":"baq",3:"eus"},{name:"Belarusian",local:"Беларуская",1:"be",2:"bel","2T":"bel","2B":"bel",3:"bel"},{name:"Bengali",local:"বাংলা",1:"bn",2:"ben","2T":"ben","2B":"ben",3:"ben",ietf:"bn-BD"},{name:"Bihari",local:"भोजपुरी",1:"bh",2:"bih","2T":"bih","2B":"bih",3:"bih"},{name:"Bislama",local:"Bislama",1:"bi",2:"bis","2T":"bis","2B":"bis",3:"bis"},{name:"Bosnian",local:"Bosanski",1:"bs",2:"bos","2T":"bos","2B":"bos",3:"bos"},{name:"Breton",local:"Brezhoneg",1:"br",2:"bre","2T":"bre","2B":"bre",3:"bre"},{name:"Bulgarian",local:"Български",1:"bg",2:"bul","2T":"bul","2B":"bul",3:"bul"},{name:"Burmese",local:"မြန်မာဘာသာ",1:"my",2:"mya","2T":"mya","2B":"bur",3:"mya"},{name:"Catalan",local:"Català",1:"ca",2:"cat","2T":"cat","2B":"cat",3:"cat"},{name:"Chamorro",local:"Chamoru",1:"ch",2:"cha","2T":"cha","2B":"cha",3:"cha"},{name:"Chechen",local:"Нохчийн",1:"ce",2:"che","2T":"che","2B":"che",3:"che"},{name:"Chichewa",local:"Chichewa",1:"ny",2:"nya","2T":"nya","2B":"nya",3:"nya"},{name:"Chinese",local:"中文",1:"zh",2:"zho","2T":"zho","2B":"chi",3:"zho",ietf:"zh-CN"},{name:"Chinese (Simplified)",local:"中文(簡體)",1:"zh",2:"zhe","2T":"zhe","2B":"chi",3:"zhe",ietf:"zh-Hans"},{name:"Chinese (Traditional)",local:"中文(繁體)",1:"zh",2:"zht","2T":"zht","2B":"chi",3:"zht",ietf:"zh-Hant"},{name:"Chuvash",local:"Чӑвашла",1:"cv",2:"chv","2T":"chv","2B":"chv",3:"chv"},{name:"Cornish",local:"Kernewek",1:"kw",2:"cor","2T":"cor","2B":"cor",3:"cor"},{name:"Corsican",local:"Corsu",1:"co",2:"cos","2T":"cos","2B":"cos",3:"cos"},{name:"Cree",local:"ᓀᐦᐃᔭᐍᐏᐣ",1:"cr",2:"cre","2T":"cre","2B":"cre",3:"cre"},{name:"Croatian",local:"Hrvatski",1:"hr",2:"hrv","2T":"hrv","2B":"hrv",3:"hrv"},{name:"Czech",local:"Čeština",1:"cs",2:"ces","2T":"ces","2B":"cze",3:"ces"},{name:"Danish",local:"Dansk",1:"da",2:"dan","2T":"dan","2B":"dan",3:"dan"},{name:"Divehi",local:"Divehi",1:"dv",2:"div","2T":"div","2B":"div",3:"div"},{name:"Dutch",local:"Nederlands",1:"nl",2:"nld","2T":"nld","2B":"dut",3:"nld"},{name:"Dzongkha",local:"རྫོང་ཁ",1:"dz",2:"dzo","2T":"dzo","2B":"dzo",3:"dzo"},{name:"English",local:"English",1:"en",2:"eng","2T":"eng","2B":"eng",3:"eng",ietf:"en-US"},{name:"Esperanto",local:"Esperanto",1:"eo",2:"epo","2T":"epo","2B":"epo",3:"epo"},{name:"Estonian",local:"Eesti",1:"et",2:"est","2T":"est","2B":"est",3:"est",ietf:"et-EE"},{name:"Ewe",local:"Eʋegbe",1:"ee",2:"ewe","2T":"ewe","2B":"ewe",3:"ewe"},{name:"Faroese",local:"Føroyskt",1:"fo",2:"fao","2T":"fao","2B":"fao",3:"fao"},{name:"Fijian",local:"Na Vosa Vaka-Viti",1:"fj",2:"fij","2T":"fij","2B":"fij",3:"fij"},{name:"Finnish",local:"Suomi",1:"fi",2:"fin","2T":"fin","2B":"fin",3:"fin"},{name:"French",local:"Français",1:"fr",2:"fra","2T":"fra","2B":"fre",3:"fra",ietf:"fr-FR"},{name:"Fula",local:"Fulfulde",1:"ff",2:"ful","2T":"ful","2B":"ful",3:"ful"},{name:"Galician",local:"Galego",1:"gl",2:"glg","2T":"glg","2B":"glg",3:"glg"},{name:"Georgian",local:"ქართული",1:"ka",2:"kat","2T":"kat","2B":"geo",3:"kat"},{name:"German",local:"Deutsch",1:"de",2:"deu","2T":"deu","2B":"ger",3:"deu"},{name:"Greek",local:"Ελληνικά",1:"el",2:"ell","2T":"ell","2B":"gre",3:"ell"},{name:"Guaraní",local:"Avañe'ẽ",1:"gn",2:"grn","2T":"grn","2B":"grn",3:"grn"},{name:"Gujarati",local:"ગુજરાતી",1:"gu",2:"guj","2T":"guj","2B":"guj",3:"guj"},{name:"Haitian",local:"Kreyòl Ayisyen",1:"ht",2:"hat","2T":"hat","2B":"hat",3:"hat"},{name:"Hausa",local:"هَوُسَ",1:"ha",2:"hau","2T":"hau","2B":"hau",3:"hau"},{name:"Hebrew",local:"עברית",1:"he",2:"heb","2T":"heb","2B":"heb",3:"heb"},{name:"Herero",local:"Otjiherero",1:"hz",2:"her","2T":"her","2B":"her",3:"her"},{name:"Hindi",local:"हिन्दी",1:"hi",2:"hin","2T":"hin","2B":"hin",3:"hin"},{name:"Hiri Motu",local:"Hiri Motu",1:"ho",2:"hmo","2T":"hmo","2B":"hmo",3:"hmo"},{name:"Hungarian",local:"Magyar",1:"hu",2:"hun","2T":"hun","2B":"hun",3:"hun"},{name:"Interlingua",local:"Interlingua",1:"ia",2:"ina","2T":"ina","2B":"ina",3:"ina"},{name:"Indonesian",local:"Bahasa Indonesia",1:"id",2:"ind","2T":"ind","2B":"ind",3:"ind"},{name:"Interlingue",local:"Interlingue",1:"ie",2:"ile","2T":"ile","2B":"ile",3:"ile"},{name:"Irish",local:"Gaeilge",1:"ga",2:"gle","2T":"gle","2B":"gle",3:"gle"},{name:"Igbo",local:"Igbo",1:"ig",2:"ibo","2T":"ibo","2B":"ibo",3:"ibo"},{name:"Inupiaq",local:"Iñupiak",1:"ik",2:"ipk","2T":"ipk","2B":"ipk",3:"ipk"},{name:"Ido",local:"Ido",1:"io",2:"ido","2T":"ido","2B":"ido",3:"ido"},{name:"Icelandic",local:"Íslenska",1:"is",2:"isl","2T":"isl","2B":"ice",3:"isl"},{name:"Italian",local:"Italiano",1:"it",2:"ita","2T":"ita","2B":"ita",3:"ita",ietf:"it-IT"},{name:"Inuktitut",local:"ᐃᓄᒃᑎᑐᑦ",1:"iu",2:"iku","2T":"iku","2B":"iku",3:"iku"},{name:"Japanese",local:"日本語",1:"ja",2:"jpn","2T":"jpn","2B":"jpn",3:"jpn",ietf:"ja-JP"},{name:"Javanese",local:"Basa Jawa",1:"jv",2:"jav","2T":"jav","2B":"jav",3:"jav"},{name:"Kalaallisut",local:"Kalaallisut",1:"kl",2:"kal","2T":"kal","2B":"kal",3:"kal"},{name:"Kannada",local:"ಕನ್ನಡ",1:"kn",2:"kan","2T":"kan","2B":"kan",3:"kan"},{name:"Kanuri",local:"Kanuri",1:"kr",2:"kau","2T":"kau","2B":"kau",3:"kau"},{name:"Kashmiri",local:"كشميري",1:"ks",2:"kas","2T":"kas","2B":"kas",3:"kas"},{name:"Kazakh",local:"Қазақша",1:"kk",2:"kaz","2T":"kaz","2B":"kaz",3:"kaz"},{name:"Khmer",local:"ភាសាខ្មែរ",1:"km",2:"khm","2T":"khm","2B":"khm",3:"khm"},{name:"Kikuyu",local:"Gĩkũyũ",1:"ki",2:"kik","2T":"kik","2B":"kik",3:"kik"},{name:"Kinyarwanda",local:"Kinyarwanda",1:"rw",2:"kin","2T":"kin","2B":"kin",3:"kin"},{name:"Kyrgyz",local:"Кыргызча",1:"ky",2:"kir","2T":"kir","2B":"kir",3:"kir"},{name:"Komi",local:"Коми",1:"kv",2:"kom","2T":"kom","2B":"kom",3:"kom"},{name:"Kongo",local:"Kongo",1:"kg",2:"kon","2T":"kon","2B":"kon",3:"kon"},{name:"Korean",local:"한국어",1:"ko",2:"kor","2T":"kor","2B":"kor",3:"kor"},{name:"Kurdish",local:"Kurdî",1:"ku",2:"kur","2T":"kur","2B":"kur",3:"kur"},{name:"Kwanyama",local:"Kuanyama",1:"kj",2:"kua","2T":"kua","2B":"kua",3:"kua"},{name:"Latin",local:"Latina",1:"la",2:"lat","2T":"lat","2B":"lat",3:"lat"},{name:"Luxembourgish",local:"Lëtzebuergesch",1:"lb",2:"ltz","2T":"ltz","2B":"ltz",3:"ltz"},{name:"Ganda",local:"Luganda",1:"lg",2:"lug","2T":"lug","2B":"lug",3:"lug"},{name:"Limburgish",local:"Limburgs",1:"li",2:"lim","2T":"lim","2B":"lim",3:"lim"},{name:"Lingala",local:"Lingála",1:"ln",2:"lin","2T":"lin","2B":"lin",3:"lin"},{name:"Lao",local:"ພາສາລາວ",1:"lo",2:"lao","2T":"lao","2B":"lao",3:"lao"},{name:"Lithuanian",local:"Lietuvių",1:"lt",2:"lit","2T":"lit","2B":"lit",3:"lit"},{name:"Luba-Katanga",local:"Tshiluba",1:"lu",2:"lub","2T":"lub","2B":"lub",3:"lub"},{name:"Latvian",local:"Latviešu",1:"lv",2:"lav","2T":"lav","2B":"lav",3:"lav"},{name:"Manx",local:"Gaelg",1:"gv",2:"glv","2T":"glv","2B":"glv",3:"glv"},{name:"Macedonian",local:"Македонски",1:"mk",2:"mkd","2T":"mkd","2B":"mac",3:"mkd"},{name:"Malagasy",local:"Malagasy",1:"mg",2:"mlg","2T":"mlg","2B":"mlg",3:"mlg"},{name:"Malay",local:"Bahasa Melayu",1:"ms",2:"msa","2T":"msa","2B":"may",3:"msa"},{name:"Malayalam",local:"മലയാളം",1:"ml",2:"mal","2T":"mal","2B":"mal",3:"mal"},{name:"Maltese",local:"Malti",1:"mt",2:"mlt","2T":"mlt","2B":"mlt",3:"mlt"},{name:"Māori",local:"Māori",1:"mi",2:"mri","2T":"mri","2B":"mao",3:"mri"},{name:"Marathi",local:"मराठी",1:"mr",2:"mar","2T":"mar","2B":"mar",3:"mar"},{name:"Marshallese",local:"Kajin M̧ajeļ",1:"mh",2:"mah","2T":"mah","2B":"mah",3:"mah"},{name:"Mongolian",local:"Монгол",1:"mn",2:"mon","2T":"mon","2B":"mon",3:"mon"},{name:"Nauru",local:"Dorerin Naoero",1:"na",2:"nau","2T":"nau","2B":"nau",3:"nau"},{name:"Navajo",local:"Diné Bizaad",1:"nv",2:"nav","2T":"nav","2B":"nav",3:"nav"},{name:"Northern Ndebele",local:"isiNdebele",1:"nd",2:"nde","2T":"nde","2B":"nde",3:"nde"},{name:"Nepali",local:"नेपाली",1:"ne",2:"nep","2T":"nep","2B":"nep",3:"nep"},{name:"Ndonga",local:"Owambo",1:"ng",2:"ndo","2T":"ndo","2B":"ndo",3:"ndo"},{name:"Norwegian Bokmål",local:"Norsk (Bokmål)",1:"nb",2:"nob","2T":"nob","2B":"nob",3:"nob",ietf:"nb-NO"},{name:"Norwegian Nynorsk",local:"Norsk (Nynorsk)",1:"nn",2:"nno","2T":"nno","2B":"nno",3:"nno",ietf:"nn-NO"},{name:"Norwegian",local:"Norsk",1:"no",2:"nor","2T":"nor","2B":"nor",3:"nor",ietf:"no-NO"},{name:"Nuosu",local:"ꆈꌠ꒿ Nuosuhxop",1:"ii",2:"iii","2T":"iii","2B":"iii",3:"iii"},{name:"Southern Ndebele",local:"isiNdebele",1:"nr",2:"nbl","2T":"nbl","2B":"nbl",3:"nbl"},{name:"Occitan",local:"Occitan",1:"oc",2:"oci","2T":"oci","2B":"oci",3:"oci"},{name:"Ojibwe",local:"ᐊᓂᔑᓈᐯᒧᐎᓐ",1:"oj",2:"oji","2T":"oji","2B":"oji",3:"oji"},{name:"Old Church Slavonic",local:"Словѣ́ньскъ",1:"cu",2:"chu","2T":"chu","2B":"chu",3:"chu"},{name:"Oromo",local:"Afaan Oromoo",1:"om",2:"orm","2T":"orm","2B":"orm",3:"orm"},{name:"Oriya",local:"ଓଡି଼ଆ",1:"or",2:"ori","2T":"ori","2B":"ori",3:"ori"},{name:"Ossetian",local:"Ирон æвзаг",1:"os",2:"oss","2T":"oss","2B":"oss",3:"oss"},{name:"Panjabi",local:"ਪੰਜਾਬੀ",1:"pa",2:"pan","2T":"pan","2B":"pan",3:"pan",ietf:"pa-IN"},{name:"Pāli",local:"पाऴि",1:"pi",2:"pli","2T":"pli","2B":"pli",3:"pli"},{name:"Persian",local:"فارسی",1:"fa",2:"fas","2T":"fas","2B":"per",3:"fas"},{name:"Polish",local:"Polski",1:"pl",2:"pol","2T":"pol","2B":"pol",3:"pol"},{name:"Pashto",local:"پښتو",1:"ps",2:"pus","2T":"pus","2B":"pus",3:"pus"},{name:"Portuguese",local:"Português",1:"pt",2:"por","2T":"por","2B":"por",3:"por",ietf:"pt-PT"},{name:"Portuguese (Brazil)",local:"Português (Brasil)",1:"pb",2:"pob","2T":"pob","2B":"pob",3:"pob",ietf:"pt-BR"},{name:"Quechua",local:"Runa Simi",1:"qu",2:"que","2T":"que","2B":"que",3:"que"},{name:"Romansh",local:"Rumantsch",1:"rm",2:"roh","2T":"roh","2B":"roh",3:"roh"},{name:"Kirundi",local:"Kirundi",1:"rn",2:"run","2T":"run","2B":"run",3:"run"},{name:"Romanian",local:"Română",1:"ro",2:"ron","2T":"ron","2B":"rum",3:"ron"},{name:"Russian",local:"Русский",1:"ru",2:"rus","2T":"rus","2B":"rus",3:"rus"},{name:"Sanskrit",local:"संस्कृतम्",1:"sa",2:"san","2T":"san","2B":"san",3:"san"},{name:"Sardinian",local:"Sardu",1:"sc",2:"srd","2T":"srd","2B":"srd",3:"srd"},{name:"Sindhi",local:"سنڌي‎",1:"sd",2:"snd","2T":"snd","2B":"snd",3:"snd"},{name:"Northern Sami",local:"Sámegiella",1:"se",2:"sme","2T":"sme","2B":"sme",3:"sme"},{name:"Samoan",local:"Gagana Sāmoa",1:"sm",2:"smo","2T":"smo","2B":"smo",3:"smo"},{name:"Sango",local:"Sängö",1:"sg",2:"sag","2T":"sag","2B":"sag",3:"sag"},{name:"Serbian",local:"Српски",1:"sr",2:"srp","2T":"srp","2B":"srp",3:"srp"},{name:"Gaelic",local:"Gàidhlig",1:"gd",2:"gla","2T":"gla","2B":"gla",3:"gla"},{name:"Shona",local:"ChiShona",1:"sn",2:"sna","2T":"sna","2B":"sna",3:"sna"},{name:"Sinhala",local:"සිංහල",1:"si",2:"sin","2T":"sin","2B":"sin",3:"sin"},{name:"Slovak",local:"Slovenčina",1:"sk",2:"slk","2T":"slk","2B":"slo",3:"slk"},{name:"Slovene",local:"Slovenščina",1:"sl",2:"slv","2T":"slv","2B":"slv",3:"slv"},{name:"Somali",local:"Soomaaliga",1:"so",2:"som","2T":"som","2B":"som",3:"som"},{name:"Southern Sotho",local:"Sesotho",1:"st",2:"sot","2T":"sot","2B":"sot",3:"sot"},{name:"Spanish",local:"Español",1:"es",2:"spa","2T":"spa","2B":"spa",3:"spa",ietf:"es-ES"},{name:"Spanish (Latin America)",local:"Español (América Latina)",1:"es",2:"spl","2T":"spl","2B":"spl",3:"spl",ietf:"es-419"},{name:"Sundanese",local:"Basa Sunda",1:"su",2:"sun","2T":"sun","2B":"sun",3:"sun"},{name:"Swahili",local:"Kiswahili",1:"sw",2:"swa","2T":"swa","2B":"swa",3:"swa"},{name:"Swati",local:"SiSwati",1:"ss",2:"ssw","2T":"ssw","2B":"ssw",3:"ssw"},{name:"Swedish",local:"Svenska",1:"sv",2:"swe","2T":"swe","2B":"swe",3:"swe"},{name:"Tamil",local:"தமிழ்",1:"ta",2:"tam","2T":"tam","2B":"tam",3:"tam"},{name:"Telugu",local:"తెలుగు",1:"te",2:"tel","2T":"tel","2B":"tel",3:"tel"},{name:"Tajik",local:"Тоҷикӣ",1:"tg",2:"tgk","2T":"tgk","2B":"tgk",3:"tgk"},{name:"Thai",local:"ภาษาไทย",1:"th",2:"tha","2T":"tha","2B":"tha",3:"tha"},{name:"Tigrinya",local:"ትግርኛ",1:"ti",2:"tir","2T":"tir","2B":"tir",3:"tir"},{name:"Tibetan Standard",local:"བོད་ཡིག",1:"bo",2:"bod","2T":"bod","2B":"tib",3:"bod"},{name:"Turkmen",local:"Türkmençe",1:"tk",2:"tuk","2T":"tuk","2B":"tuk",3:"tuk"},{name:"Tagalog",local:"Tagalog",1:"tl",2:"tgl","2T":"tgl","2B":"tgl",3:"tgl"},{name:"Tswana",local:"Setswana",1:"tn",2:"tsn","2T":"tsn","2B":"tsn",3:"tsn"},{name:"Tonga",local:"faka Tonga",1:"to",2:"ton","2T":"ton","2B":"ton",3:"ton"},{name:"Turkish",local:"Türkçe",1:"tr",2:"tur","2T":"tur","2B":"tur",3:"tur"},{name:"Tsonga",local:"Xitsonga",1:"ts",2:"tso","2T":"tso","2B":"tso",3:"tso"},{name:"Tatar",local:"Татарча",1:"tt",2:"tat","2T":"tat","2B":"tat",3:"tat"},{name:"Twi",local:"Twi",1:"tw",2:"twi","2T":"twi","2B":"twi",3:"twi"},{name:"Tahitian",local:"Reo Mā’ohi",1:"ty",2:"tah","2T":"tah","2B":"tah",3:"tah"},{name:"Uyghur",local:"ئۇيغۇرچه",1:"ug",2:"uig","2T":"uig","2B":"uig",3:"uig"},{name:"Ukrainian",local:"Українська",1:"uk",2:"ukr","2T":"ukr","2B":"ukr",3:"ukr"},{name:"Urdu",local:"اردو",1:"ur",2:"urd","2T":"urd","2B":"urd",3:"urd"},{name:"Uzbek",local:"O‘zbek",1:"uz",2:"uzb","2T":"uzb","2B":"uzb",3:"uzb"},{name:"Venda",local:"Tshivenḓa",1:"ve",2:"ven","2T":"ven","2B":"ven",3:"ven"},{name:"Vietnamese",local:"Tiếng Việt",1:"vi",2:"vie","2T":"vie","2B":"vie",3:"vie"},{name:"Volapük",local:"Volapük",1:"vo",2:"vol","2T":"vol","2B":"vol",3:"vol"},{name:"Walloon",local:"Walon",1:"wa",2:"wln","2T":"wln","2B":"wln",3:"wln"},{name:"Welsh",local:"Cymraeg",1:"cy",2:"cym","2T":"cym","2B":"wel",3:"cym"},{name:"Wolof",local:"Wolof",1:"wo",2:"wol","2T":"wol","2B":"wol",3:"wol"},{name:"Western Frisian",local:"Frysk",1:"fy",2:"fry","2T":"fry","2B":"fry",3:"fry"},{name:"Xhosa",local:"isiXhosa",1:"xh",2:"xho","2T":"xho","2B":"xho",3:"xho"},{name:"Yiddish",local:"ייִדיש",1:"yi",2:"yid","2T":"yid","2B":"yid",3:"yid"},{name:"Yoruba",local:"Yorùbá",1:"yo",2:"yor","2T":"yor","2B":"yor",3:"yor"},{name:"Zhuang",local:"Cuengh",1:"za",2:"zha","2T":"zha","2B":"zha",3:"zha"},{name:"Zulu",local:"isiZulu",1:"zu",2:"zul","2T":"zul","2B":"zul",3:"zul"}]},58321(e,t,E){var a=E(29365),i={all:function(){return a},has:function(e,t){return void 0!==o(e,t)},codes:function(e){if((function(e){return-1!==[1,2,3,"1","2","2B","2T","3"].indexOf(e)})(e))return _(a,function(t){return t[e]})},names:function(e){return _(a,function(t){return e?t.local:t.name})},where:o};function o(e,t){for(var E=0;E-1},Be.prototype.set=function(e,t){var E=this.__data__,a=Me(E,e);return a<0?E.push([e,t]):E[a][1]=t,this},he.prototype.clear=function(){this.__data__={hash:new Pe,map:new(Ae||Be),string:new Pe}},he.prototype.delete=function(e){return be(this,e).delete(e)},he.prototype.get=function(e){return be(this,e).get(e)},he.prototype.has=function(e){return be(this,e).has(e)},he.prototype.set=function(e,t){return be(this,e).set(e,t),this},fe.prototype.clear=function(){this.__data__=new Be},fe.prototype.delete=function(e){return this.__data__.delete(e)},fe.prototype.get=function(e){return this.__data__.get(e)},fe.prototype.has=function(e){return this.__data__.has(e)},fe.prototype.set=function(e,t){var E=this.__data__;if(E instanceof Be){var a=E.__data__;if(!Ae||a.length<199)return a.push([e,t]),this;E=this.__data__=new he(a)}return E.set(e,t),this};var Fe=Te?z(Te,Object):function(){return[]},Ve=function(e){return te.call(e)};function He(e,t){return!!(t=null==t?i:t)&&("number"==typeof e||M.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=i})(e.length)&&!Qe(e)}var xe=se||function(){return!1};function Qe(e){var t=Xe(e)?te.call(e):"";return t==r||t==S}function Xe(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function $e(e){return je(e)?We(e):(function(e){if(!Ye(e))return Ie(e);var t=[];for(var E in Object(e))ee.call(e,E)&&"constructor"!=E&&t.push(E);return t})(e)}e.exports=function(e){return ve(e,!0,!0)}},32889(e,t,E){var a=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,_=/^0o[0-7]+$/i,n=parseInt,r="object"==typeof E.g&&E.g&&E.g.Object===Object&&E.g,S="object"==typeof self&&self&&self.Object===Object&&self,T=r||S||Function("return this")(),s=Object.prototype.toString,I=Math.max,l=Math.min,A=function(){return T.Date.now()};function O(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function u(e){if("number"==typeof e)return e;if((function(e){return"symbol"==typeof e||(function(e){return!!e&&"object"==typeof e})(e)&&"[object Symbol]"==s.call(e)})(e))return NaN;if(O(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=O(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(a,"");var E=o.test(e);return E||_.test(e)?n(e.slice(2),E?2:8):i.test(e)?NaN:+e}e.exports=function(e,t,E){var a,i,o,_,n,r,S=0,T=!1,s=!1,R=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function N(t){var E=a,o=i;return a=i=void 0,S=t,_=e.apply(o,E)}function d(e){var E=e-r;return void 0===r||E>=t||E<0||s&&e-S>=o}function c(){var e=A();if(d(e))return L(e);n=setTimeout(c,(function(e){var E=t-(e-r);return s?l(E,o-(e-S)):E})(e))}function L(e){return n=void 0,R&&a?N(e):(a=i=void 0,_)}function m(){var e=A(),E=d(e);if(a=arguments,i=this,r=e,E){if(void 0===n)return(function(e){return S=e,n=setTimeout(c,t),T?N(e):_})(r);if(s)return n=setTimeout(c,t),N(r)}return void 0===n&&(n=setTimeout(c,t)),_}return t=u(t)||0,O(E)&&(T=!!E.leading,o=(s="maxWait"in E)?I(u(E.maxWait)||0,t):o,R="trailing"in E?!!E.trailing:R),m.cancel=function(){void 0!==n&&clearTimeout(n),S=0,a=r=i=n=void 0},m.flush=function(){return void 0===n?_:L(A())},m}},87597(e,t,E){var a="__lodash_hash_undefined__",i=9007199254740991,o=/^\[object .+?Constructor\]$/,_="object"==typeof E.g&&E.g&&E.g.Object===Object&&E.g,n="object"==typeof self&&self&&self.Object===Object&&self,r=_||n||Function("return this")();function S(e,t){return!!(e?e.length:0)&&(function(e,t,E){if(t!=t)return(function(e,t,E,a){var i=e.length,o=E+(a?1:-1);for(;a?o--:++o-1}function T(e,t,E){for(var a=-1,i=e?e.length:0;++a-1&&e%1==0&&e<=i})(e.length)&&!w(e)})(e)})(e)?e:[]}function b(e,t){var E,a,i=e.__data__;return("string"==(a=typeof(E=t))||"number"==a||"symbol"==a||"boolean"==a?"__proto__"!==E:null===E)?i["string"==typeof t?"string":"hash"]:i.map}function k(e,t){var E=(function(e,t){return null==e?void 0:e[t]})(e,t);return G(E)?E:void 0}W.prototype.clear=function(){this.__data__=f?f(null):{}},W.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},W.prototype.get=function(e){var t=this.__data__;if(f){var E=t[e];return E===a?void 0:E}return m.call(t,e)?t[e]:void 0},W.prototype.has=function(e){var t=this.__data__;return f?void 0!==t[e]:m.call(t,e)},W.prototype.set=function(e,t){return this.__data__[e]=f&&void 0===t?a:t,this},g.prototype.clear=function(){this.__data__=[]},g.prototype.delete=function(e){var t=this.__data__,E=U(t,e);return!(E<0)&&(E==t.length-1?t.pop():p.call(t,E,1),!0)},g.prototype.get=function(e){var t=this.__data__,E=U(t,e);return E<0?void 0:t[E][1]},g.prototype.has=function(e){return U(this.__data__,e)>-1},g.prototype.set=function(e,t){var E=this.__data__,a=U(E,e);return a<0?E.push([e,t]):E[a][1]=t,this},M.prototype.clear=function(){this.__data__={hash:new W,map:new(h||g),string:new W}},M.prototype.delete=function(e){return b(this,e).delete(e)},M.prototype.get=function(e){return b(this,e).get(e)},M.prototype.has=function(e){return b(this,e).has(e)},M.prototype.set=function(e,t){return b(this,e).set(e,t),this},v.prototype.add=v.prototype.push=function(e){return this.__data__.set(e,a),this},v.prototype.has=function(e){return this.__data__.has(e)};var F,V,H=(F=function(e){var t=s(e,y);return t.length&&t[0]===e[0]?(function(e,t,E){for(var a=E?T:S,i=e[0].length,o=e.length,_=o,n=Array(o),r=1/0,I=[];_--;){var O=e[_];_&&t&&(O=s(O,l(t))),r=B(O.length,r),n[_]=!E&&(t||i>=120&&O.length>=120)?new v(_&&O):void 0}O=e[0];var u=-1,R=n[0];e:for(;++u=t||E<0||I&&e-T>=_}function L(){var e=O();if(c(e))return m(e);r=setTimeout(L,(function(e){var E=t-(e-S);return I?A(E,_-(e-T)):E})(e))}function m(e){return r=void 0,u&&i?d(e):(i=o=void 0,n)}function D(){var e=O(),E=c(e);if(i=arguments,o=this,S=e,E){if(void 0===r)return(function(e){return T=e,r=setTimeout(L,t),s?d(e):n})(S);if(I)return r=setTimeout(L,t),d(S)}return void 0===r&&(r=setTimeout(L,t)),n}return t=N(t)||0,R(E)&&(s=!!E.leading,_=(I="maxWait"in E)?l(N(E.maxWait)||0,t):_,u="trailing"in E?!!E.trailing:u),D.cancel=function(){void 0!==r&&clearTimeout(r),T=0,i=S=o=r=void 0},D.flush=function(){return void 0===r?n:m(O())},D}function R(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function N(e){if("number"==typeof e)return e;if((function(e){return"symbol"==typeof e||(function(e){return!!e&&"object"==typeof e})(e)&&"[object Symbol]"==I.call(e)})(e))return NaN;if(R(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=R(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(i,"");var E=_.test(e);return E||n.test(e)?r(e.slice(2),E?2:8):o.test(e)?NaN:+e}e.exports=function(e,t,E){var i=!0,o=!0;if("function"!=typeof e)throw new TypeError(a);return R(E)&&(i="leading"in E?!!E.leading:i,o="trailing"in E?!!E.trailing:o),u(e,t,{leading:i,maxWait:t,trailing:o})}},53909(e,t,E){var a=E(84686).hp;e.exports=_,e.exports.decode=_,e.exports.encode=function(e){e=Object.assign({},e);let t=new Set;e.xt&&"string"==typeof e.xt&&t.add(e.xt);e.xt&&Array.isArray(e.xt)&&(t=new Set(e.xt));e.infoHashBuffer&&t.add(`urn:btih:${e.infoHashBuffer.toString("hex")}`);e.infoHash&&t.add(`urn:btih:${e.infoHash}`);e.infoHashV2Buffer&&t.add(e.xt=`urn:btmh:1220${e.infoHashV2Buffer.toString("hex")}`);e.infoHashV2&&t.add(`urn:btmh:1220${e.infoHashV2}`);const E=Array.from(t);1===E.length&&(e.xt=E[0]);E.length>1&&(e.xt=E);e.publicKeyBuffer&&(e.xs=`urn:btpk:${e.publicKeyBuffer.toString("hex")}`);e.publicKey&&(e.xs=`urn:btpk:${e.publicKey}`);e.name&&(e.dn=e.name);e.keywords&&(e.kt=e.keywords);e.announce&&(e.tr=e.announce);e.urlList&&(e.ws=e.urlList,delete e.as);e.peerAddresses&&(e["x.pe"]=e.peerAddresses);let a="magnet:?";return Object.keys(e).filter(e=>2===e.length||"x.pe"===e).forEach((t,E)=>{const i=Array.isArray(e[t])?e[t]:[e[t]];i.forEach((e,i)=>{(E>0||i>0)&&("kt"!==t&&"so"!==t||0===i)&&(a+="&"),"dn"===t&&(e=encodeURIComponent(e).replace(/%20/g,"+")),"tr"!==t&&"as"!==t&&"ws"!==t||(e=encodeURIComponent(e)),"xs"!==t||e.startsWith("urn:btpk:")||(e=encodeURIComponent(e)),"kt"===t&&(e=encodeURIComponent(e)),"so"!==t&&(a+="kt"===t&&i>0?`+${e}`:`${t}=${e}`)}),"so"===t&&(a+=`${t}=${o.compose(i)}`)}),a};const i=E(942),o=E(51042);function _(e){const t={},E=e.split("magnet:?")[1];let _;if((E&&E.length>=0?E.split("&"):[]).forEach(e=>{const E=e.split("=");if(2!==E.length)return;const a=E[0];let i=E[1];"dn"===a&&(i=decodeURIComponent(i).replace(/\+/g," ")),"tr"!==a&&"xs"!==a&&"as"!==a&&"ws"!==a||(i=decodeURIComponent(i)),"kt"===a&&(i=decodeURIComponent(i).split("+")),"ix"===a&&(i=Number(i)),"so"===a&&(i=o.parse(decodeURIComponent(i).split(","))),t[a]?(Array.isArray(t[a])||(t[a]=[t[a]]),t[a].push(i)):t[a]=i}),t.xt){(Array.isArray(t.xt)?t.xt:[t.xt]).forEach(e=>{if(_=e.match(/^urn:btih:(.{40})/))t.infoHash=_[1].toLowerCase();else if(_=e.match(/^urn:btih:(.{32})/)){const e=i.decode(_[1]);t.infoHash=a.from(e,"binary").toString("hex")}else(_=e.match(/^urn:btmh:1220(.{64})/))&&(t.infoHashV2=_[1].toLowerCase())})}if(t.xs){(Array.isArray(t.xs)?t.xs:[t.xs]).forEach(e=>{(_=e.match(/^urn:btpk:(.{64})/))&&(t.publicKey=_[1].toLowerCase())})}return t.infoHash&&(t.infoHashBuffer=a.from(t.infoHash,"hex")),t.infoHashV2&&(t.infoHashV2Buffer=a.from(t.infoHashV2,"hex")),t.publicKey&&(t.publicKeyBuffer=a.from(t.publicKey,"hex")),t.dn&&(t.name=t.dn),t.kt&&(t.keywords=t.kt),t.announce=[],("string"==typeof t.tr||Array.isArray(t.tr))&&(t.announce=t.announce.concat(t.tr)),t.urlList=[],("string"==typeof t.as||Array.isArray(t.as))&&(t.urlList=t.urlList.concat(t.as)),("string"==typeof t.ws||Array.isArray(t.ws))&&(t.urlList=t.urlList.concat(t.ws)),t.peerAddresses=[],("string"==typeof t["x.pe"]||Array.isArray(t["x.pe"]))&&(t.peerAddresses=t.peerAddresses.concat(t["x.pe"])),t.announce=Array.from(new Set(t.announce)),t.urlList=Array.from(new Set(t.urlList)),t.peerAddresses=Array.from(new Set(t.peerAddresses)),t}},29895(e){"use strict";e.exports=Math.abs},72153(e){"use strict";e.exports=Math.floor},15518(e){"use strict";e.exports=Number.isNaN||function(e){return e!=e}},90457(e){"use strict";e.exports=Math.max},21179(e){"use strict";e.exports=Math.min},55985(e){"use strict";e.exports=Math.pow},88639(e){"use strict";e.exports=Math.round},55738(e,t,E){"use strict";var a=E(15518);e.exports=function(e){return a(e)||0===e?e:e<0?-1:1}},63992(e){e.exports={"gamepad-modal":"gamepad-modal-Qawlq",backdrop:"backdrop-LYhNk",container:"container-RTZor",header:"header-dZZ7W",title:"title-VSCBV","close-button":"close-button-CnaWr",icon:"icon-IBKco",content:"content-LwIAE",diagram:"diagram-Jlr11","anim-body":"anim-body-wsElB","draw-stroke":"draw-stroke-CwxEV","anim-controls":"anim-controls-NQGnF","fade-in":"fade-in-AjdhF","anim-lines":"anim-lines-E5YUF","draw-line":"draw-line-tR_JU","anim-labels":"anim-labels-ZwvAF",sections:"sections-oDwuV",section:"section-EYjRH","section-title":"section-title-svA6u",mapping:"mapping-pOqvt",kbd:"kbd-A5Qhp",dir:"dir-lD4k_",action:"action-BaO8j"}},71392(e){e.exports={"shortcuts-modal":"shortcuts-modal-A5Jm_",backdrop:"backdrop-RVNbP",container:"container-OawCB",header:"header-JUh2c",title:"title-SaDFr","close-button":"close-button-zS10s",icon:"icon-gr21P",content:"content-X0GHX"}},46036(e){e.exports={"updater-banner":"updater-banner-MjMLN",button:"button-ixcOU",close:"close-Quid9",icon:"icon-N2Lyd"}},55817(e){e.exports={"fade-in":"fade-in-pFkt_","fade-in-no-motion":"fade-in-no-motion-lYmxL","slide-up":"slide-up-lSxrC","toasts-container":"toasts-container-oKECy","tooltip-container":"tooltip-container-Qpse8","updater-banner-container":"updater-banner-container-Bk1mq"}},76115(e){e.exports={"file-drop-container":"file-drop-container-hPBXO","file-input":"file-input-ZVnG0"}},59746(e){e.exports={"toast-item-container":"toast-item-container-nG0uk",success:"success-eIDTa","icon-container":"icon-container-rjAiH",icon:"icon-Y4I_O",error:"error-quyOd",info:"info-KEWq8","info-container":"info-container-xD9V6","title-container":"title-container-VFReJ","message-container":"message-container-znkCj","close-button-container":"close-button-container-YtyYE"}},39914(e){e.exports={"tooltip-placeholder":"tooltip-placeholder-niioe"}},24055(e){e.exports={"tooltip-item":"tooltip-item-gfYXu"}},76189(e){e.exports={"group-container":"group-container-OKT01","icon-container":"icon-container-Vs4TN",icon:"icon-TpQFr",disabled:"disabled-rlj6R"}},31789(e){e.exports={"addon-details-container":"addon-details-container-tUlp2","title-container":"title-container-Ca076",logo:"logo-Nynh9",icon:"icon-ZYXtC","name-container":"name-container-XxPAj",name:"name-i0o3Y",version:"version-FdUq6","section-container":"section-container-N6QHW","section-header":"section-header-tbXCb","section-label":"section-label-_R7gz","transport-url-label":"transport-url-label-upr4V","disclaimer-label":"disclaimer-label-I7kvM"}},98430(e){e.exports={"addon-details-modal-container":"addon-details-modal-container-aBFaQ","addon-details-container":"addon-details-container-VdGrt","addon-details-message-container":"addon-details-message-container-X2sRf","cancel-button":"cancel-button-zuUX6","cancel-button-label":"cancel-button-label-ZOQUJ","uninstall-button":"uninstall-button-iLxLs"}},97751(e){e.exports={"bottom-sheet":"bottom-sheet-VtqY2",backdrop:"backdrop-Doe6y",container:"container-yiLtz",dragging:"dragging-ML0cp",heading:"heading-xf2ct",handle:"handle-TCLds",title:"title-QtERv",content:"content-ElxXl"}},93365(e){e.exports={"button-container":"button-container-zVLH6"}},97719(e){e.exports={checkbox:"checkbox-_AF32",label:"label-UHMAy",link:"link-ih0xx","checkbox-container":"checkbox-container-O5cy3","checkbox-icon":"checkbox-icon-viDqg",disabled:"disabled-oxpfi",error:"error-LWgU0",checked:"checked-cf9YT"}},88157(e){e.exports={chip:"chip-L3r9A",active:"active-jnhyP"}},3183(e){e.exports={chips:"chips-Uw41c"}},75951(e){e.exports={"color-input-container":"color-input-container-FAQiP","transparent-label-container":"transparent-label-container-uuGMx","transparent-label":"transparent-label-NxKvi","color-picker-container":"color-picker-container-szQfD"}},31046(e){e.exports={"color-picker-container":"color-picker-container-Cny5U"}},89223(e){e.exports={"context-menu-container":"context-menu-container-TdwXy","context-menu":"context-menu-kWx7C"}},12052(e){e.exports={"event-modal":"event-modal-lIGmX","body-container":"body-container-x9t4v",image:"image-iUBVI","info-container":"info-container-ewqxH","title-container":"title-container-tBMsA",title:"title-lE2cq",label:"label-KwjpM","addon-container":"addon-container-YNNkt",icon:"icon-n54me",name:"name-DVEMC","action-button":"action-button-QSvOg","button-label":"button-label-hRZRW"}},7527(e){e.exports={"horizontal-scroll":"horizontal-scroll-pGtUW",left:"left-MCk5v",right:"right-bxsRb",center:"center-J9E02"}},19811(e){e.exports={"main-nav-bars-container":"main-nav-bars-container-wNjS5","horizontal-nav-bar":"horizontal-nav-bar-ji5GB","vertical-nav-bar":"vertical-nav-bar-qGRze","nav-content-container":"nav-content-container-zl9hQ"}},73965(e){e.exports={"meta-item-container":"meta-item-container-Tj0Ib","poster-container":"poster-container-qkw48","dismiss-icon-layer":"dismiss-icon-layer-BWztF","poster-image-layer":"poster-image-layer-KimPZ","play-icon-layer":"play-icon-layer-vpQIo","play-icon-outer":"play-icon-outer-r3iKR","play-icon-background":"play-icon-background-Uazjh","title-bar-container":"title-bar-container-1Ba0x","menu-label-container":"menu-label-container-ChuX8","poster-shape-poster":"poster-shape-poster-MEhNx","poster-shape-square":"poster-shape-square-meMeN","poster-shape-landscape":"poster-shape-landscape-kF6i8","dismiss-icon":"dismiss-icon-db3fv","dismiss-icon-backdrop":"dismiss-icon-backdrop-MkuLQ","watched-icon-layer":"watched-icon-layer-bi3DO","watched-icon":"watched-icon-zuUdK","poster-image":"poster-image-NiV7O","placeholder-icon":"placeholder-icon-xttvb","play-icon":"play-icon-QmEEA","progress-bar-layer":"progress-bar-layer-LVYYi","progress-bar":"progress-bar-w1rNN","progress-bar-background":"progress-bar-background-kyRgp","new-videos":"new-videos-cwuD9",layer:"layer-dQmEe",icon:"icon-gh1t9",label:"label-ZZ2m7","title-label":"title-label-VnEAc"}},409(e){e.exports={"action-button-container":"action-button-container-sVyRr","icon-container":"icon-container-rQBA0",icon:"icon-RouVG","label-container":"label-container-xslEF",label:"label-WCWIO"}},33767(e){e.exports={"meta-links-container":"meta-links-container-dh69_","label-container":"label-container-dYN2B","links-container":"links-container-C8Mw9","link-container":"link-container-gHxPW"}},33695(e){e.exports={"meta-preview-placeholder-container":"meta-preview-placeholder-container-IVU4R","meta-info-container":"meta-info-container-zVaVX","logo-container":"logo-container-CES89","duration-release-info-container":"duration-release-info-container-JQE0f","duration-container":"duration-container-tVH7K","release-info-container":"release-info-container-dbZja","genres-container":"genres-container-MkCtO","genres-header-container":"genres-header-container-XNnjL","genre-label-container":"genre-label-container-r3gbk","action-buttons-container":"action-buttons-container-FHoD2"}},44588(e){e.exports={"meta-preview-container":"meta-preview-container-o22hc",compact:"compact-ii1zu","meta-info-container":"meta-info-container-ub8AH",logo:"logo-X3hTV","logo-placeholder":"logo-placeholder-rE1ld","runtime-release-info-container":"runtime-release-info-container-BGd_r","runtime-label":"runtime-label-TzAGI","release-info-label":"release-info-label-LPJMB","description-container":"description-container-yi8iU","action-buttons-container":"action-buttons-container-XbKVa","action-button":"action-button-XIZa3","group-container":"group-container-jnAoE","background-image-layer":"background-image-layer-kk_WI","background-image":"background-image-9zToE","imdb-button-container":"imdb-button-container-gGjxp",label:"label-MXv72",icon:"icon-N_uIU","label-container":"label-container-_VXZt","meta-links":"meta-links-Xiao3","show-button":"show-button-_yuOF","share-prompt":"share-prompt-QbhIA"}},81583(e){e.exports={"meta-row-placeholder-container":"meta-row-placeholder-container-x8ykQ","header-container":"header-container-LRLpi","title-container":"title-container-RuV2b","see-all-container":"see-all-container-GtLII",label:"label-FP9bt",icon:"icon-U2Gj8","meta-items-container":"meta-items-container-M4vN4","meta-item":"meta-item-iOgzp","poster-container":"poster-container-WX2KD","title-bar-container":"title-bar-container-U0ZAT","title-label":"title-label-mb1GR"}},42236(e){e.exports={"meta-row-container":"meta-row-container-xtlB1","header-container":"header-container-tR3Ev","title-container":"title-container-Mkwnq","see-all-container":"see-all-container-MoOtW",label:"label-bytni",icon:"icon-Sj7HO","message-container":"message-container-KWmlO","meta-items-container":"meta-items-container-qcuUA","meta-item":"meta-item-QFHCh","poster-shape-poster":"poster-shape-poster-LKBza","poster-shape-square":"poster-shape-square-g5a1z","poster-shape-landscape":"poster-shape-landscape-KmmRZ"}},16754(e){e.exports={"modal-container":"modal-container-OuxEF","modal-dialog-container":"modal-dialog-container-DZMKq","modal-dialog-background":"modal-dialog-background-vZpB_","close-button-container":"close-button-container-cmxAp",icon:"icon-OYzlV","modal-dialog-content":"modal-dialog-content-Xgv7Z","title-container":"title-container-v2mmF","body-container":"body-container-H80dD","buttons-container":"buttons-container-e_JoR","action-button":"action-button-eprQG",label:"label-wbfsE"}},53418(e){e.exports={"label-container":"label-container-dhjQS",icon:"icon-jg2il",label:"label-AR_l8","modal-container":"modal-container-WaYOG","menu-container":"menu-container-qiz0X","option-container":"option-container-mO9yW","no-options-container":"no-options-container-z47Tg"}},14674(e){e.exports={dropdown:"dropdown-MWaxp",open:"open-yuN4f","back-button":"back-button-dGLHu","back-button-icon":"back-button-icon-VdHBJ"}},80724(e){e.exports={option:"option-HcOSE",label:"label-IR8xX",icon:"icon-I_g2q"}},8335(e){e.exports={"multiselect-menu":"multiselect-menu-qMdaj",disabled:"disabled-RaqL9","multiselect-button":"multiselect-button-XXdgA",label:"label-SoEGc",icon:"icon-gQU96",open:"open-TvFQd",active:"active-gKhO5"}},39981(e){e.exports={"nav-menu-popup-label":"nav-menu-popup-label-XmUBo","nav-menu-container":"nav-menu-container-Pl25j","with-warning":"with-warning-SNmXK","user-info-container":"user-info-container-uigVE","avatar-container":"avatar-container-f6ino","user-info-details":"user-info-details-XJ5OH","email-container":"email-container-LNcms","email-label":"email-label-IFT0d","logout-button-container":"logout-button-container-prHdW","logout-label":"logout-label-HhwtK","nav-menu-section":"nav-menu-section-j87xd","nav-menu-option-container":"nav-menu-option-container-Qj9Xh",icon:"icon-MRjOP","nav-menu-option-label":"nav-menu-option-label-d7fgK"}},58448(e){e.exports={"search-bar-container":"search-bar-container-asfq1","search-input":"search-input-IQ0ZW","placeholder-label":"placeholder-label-XyrN_","submit-button-container":"submit-button-container-MImNa",icon:"icon-TkvAO","menu-container":"menu-container-GcXNG",label:"label-J908i",title:"title-s74ty","search-history-clear":"search-history-clear-ap0h8",items:"items-P1xS5",item:"item-TgYCX"}},49118(e){e.exports={"horizontal-nav-bar-container":"horizontal-nav-bar-container-Y_zvK","logo-container":"logo-container-jteMT",logo:"logo-oPx1q","back-button-container":"back-button-container-lDB1N",title:"title-DGh6h","search-bar":"search-bar-h60ja","buttons-container":"buttons-container-Oc5z1","hdr-indicator":"hdr-indicator-wqNXc",icon:"icon-T8MU6","button-container":"button-container-xT9_L","menu-button-container":"menu-button-container-DtW4v"}},7419(e){e.exports={"nav-tab-button-container":"nav-tab-button-container-dYhs0",label:"label-BCz2f",icon:"icon-TzPrK",logo:"logo-xJBE9"}},52620(e){e.exports={"vertical-nav-bar-container":"vertical-nav-bar-container-UPAkA","nav-tab-button":"nav-tab-button-tW6qT"}},73743(e){e.exports={"number-input":"number-input-igJ35",button:"button-GWY2o",icon:"icon-EndAk","number-display":"number-display-hLJ72",label:"label-y4qDZ",value:"value-Y2xdx"}},34279(e){e.exports={"label-container":"label-container-XOyzm","menu-container":"menu-container-B6cqK","menu-direction-top-left":"menu-direction-top-left-ongjn","menu-direction-bottom-left":"menu-direction-bottom-left-Dvtqk","menu-direction-top-right":"menu-direction-top-right-tmrFG","menu-direction-bottom-right":"menu-direction-bottom-right-aJ89V"}},51631(e){e.exports={"radio-button":"radio-button-SGEc1","radio-container":"radio-container-wPddo","inner-circle":"inner-circle-vdtUP",disabled:"disabled-ZzMU9",error:"error-_vY0h",selected:"selected-M_zHA"}},90259(e){e.exports={"search-bar-container":"search-bar-container-sTkGP","search-input":"search-input-Q18HV",icon:"icon-M3jX0"}},95402(e){e.exports={"search-bar-container":"search-bar-container-p4tSt","search-input":"search-input-bAgAh",icon:"icon-QOYfJ"}},70870(e){e.exports={"share-prompt-container":"share-prompt-container-EXOaj","buttons-container":"buttons-container-fiSbJ","button-container":"button-container-KJoeC",icon:"icon-OX8pK","facebook-button":"facebook-button-La6ud","x-button":"x-button-pA7ym","reddit-button":"reddit-button-sd07c","url-container":"url-container-OKpfh","url-text-input":"url-text-input-nqDsC","copy-button":"copy-button-XmXGg",label:"label-gMoQ8"}},46708(e){e.exports={combos:"combos-TF23d",combo:"combo-i2l7g",separator:"separator-KiYac"}},31110(e){e.exports={separator:"separator-uSn0j"}},33321(e){e.exports={"shortcuts-group":"shortcuts-group-LbRfT",title:"title-eToYZ",shortcuts:"shortcuts-tQ93G",shortcut:"shortcut-swbky",label:"label-WnVj8"}},60852(e){e.exports={"active-slider-within":"active-slider-within-NcgYf","slider-container":"slider-container-nJz5F",layer:"layer-aC5Vt",track:"track-gItfW","audio-boost":"audio-boost-AyRq0","track-before":"track-before-kJzIb","track-after":"track-after-pUXC0",thumb:"thumb-PiTF5"}},8086(e){e.exports={"text-input":"text-input-hnLiz"}},59881(e){e.exports={"toggle-container":"toggle-container-lZfHP",toggle:"toggle-toOWM"}},22871(e){e.exports={"video-placeholder-container":"video-placeholder-container-DgoIs","info-container":"info-container-BATmf","name-container":"name-container-N4C39","released-container":"released-container-egHHb"}},15040(e){e.exports={"video-container":"video-container-ezBpK","thumbnail-container":"thumbnail-container-Zm8Cl",thumbnail:"thumbnail-J81W3",blurred:"blurred-ZmA2z","placeholder-icon":"placeholder-icon-GNOI3","progress-bar-container":"progress-bar-container-w8eFT","progress-bar":"progress-bar-E23CT","progress-bar-background":"progress-bar-background-Q7aEH","info-container":"info-container-xyynk","title-container":"title-container-NcfV9","flex-row-container":"flex-row-container-CAyQu","released-container":"released-container-XLPqf","upcoming-watched-container":"upcoming-watched-container-msCaq","upcoming-container":"upcoming-container-LXfQ7","watched-container":"watched-container-gvzs3","flag-icon":"flag-icon-RDrvf","flag-label":"flag-label-zJloD","play-button-container":"play-button-container-FY3_A","play-icon":"play-icon-RqfT9",selected:"selected-AfK31",border:"border-nc19J","context-menu-content":"context-menu-content-ItIFy","context-menu-option-container":"context-menu-option-container-KNVWj","context-menu-option-label":"context-menu-option-label-dy2nc"}},72214(e){e.exports={"error-container":"error-container-EbAve","error-image":"error-image-RT6Ay",info:"info-u9EcS",title:"title-wBlEH",message:"message-k1ogE","buttons-container":"buttons-container-FbMbf","button-container":"button-container-MrlQO",label:"label-y8clC"}},10743(e){e.exports={"addon-container":"addon-container-lC5KN","logo-container":"logo-container-ZcSSC",logo:"logo-WrsGF",icon:"icon-GxVbY","info-container":"info-container-AdMB6","name-container":"name-container-qIAg8","version-container":"version-container-zdPyN","types-container":"types-container-DaOrg","description-container":"description-container-v7Jhe","buttons-container":"buttons-container-g0xXr","action-buttons-container":"action-buttons-container-xMVmz","install-button-container":"install-button-container-yfcq5","configure-button-container":"configure-button-container-VwVAQ","uninstall-button-container":"uninstall-button-container-oV4Yo","share-button-container":"share-button-container-s3gwP",label:"label-OnWh2"}},25627(e){e.exports={"addon-container":"addon-container-A53Om",content:"content-gjK8A","logo-container":"logo-container-uixVa","info-container":"info-container-EuwPe","placeholder-pill":"placeholder-pill-OmvfW","buttons-container":"buttons-container-_S1YF","action-buttons-container":"action-buttons-container-bYZoV"}},3164(e){e.exports={"addons-container":"addons-container-ogGYu","addons-content":"addons-content-zhFBl","addons-list-container":"addons-list-container-Ovr2Z","selectable-inputs-container":"selectable-inputs-container-tUul1","add-button-container":"add-button-container-SkafT",icon:"icon-HsyZS","add-button-label":"add-button-label-NN6bu","select-input-container":"select-input-container-KqG8N",spacing:"spacing-wH1w5","search-bar":"search-bar-k7MXd","filter-button":"filter-button-lLJ1X","filter-icon":"filter-icon-LUDTS","message-container":"message-container-GBw0P",addon:"addon-whmdO","filters-modal":"filters-modal-w6oWY","add-addon-modal-container":"add-addon-modal-container-KR5ny",notice:"notice-UQkO1","addon-url-input":"addon-url-input-ucetZ","cancel-button":"cancel-button-R2AxR","share-modal-container":"share-modal-container-DkzPM","title-container":"title-container-La49g",logo:"logo-PmYDP","name-container":"name-container-m_Sz0",name:"name-YD0xd",version:"version-wuAFB","share-prompt-container":"share-prompt-container-vaK4P"}},89194(e){e.exports={"warning-container":"warning-container-_GJlx","warning-statement":"warning-statement-MQjVq",actions:"actions-IOe34",action:"action-t06kj",label:"label-PkwRv"}},559(e){e.exports={"board-container":"board-container-DTN_b","board-content-container":"board-content-container-ToQTz","board-content":"board-content-nPWv1","board-row":"board-row-CoJrZ","board-warning-container":"board-warning-container-a4m04","board-row-poster":"board-row-poster-QPQqC","board-row-square":"board-row-square-pgaZ3","continue-watching-row":"continue-watching-row-ZiNSa","board-row-landscape":"board-row-landscape-FRGXx"}},11631(e){e.exports={calendar:"calendar-cH2jw",content:"content-wBwrQ",main:"main-vWt7d"}},14466(e){e.exports={details:"details-EuHwi",video:"video-BIs3a",name:"name-vpn8u",info:"info-n1Tz1",icon:"icon-Di3yP",placeholder:"placeholder-Kigxt"}},87193(e){e.exports={item:"item-PwXPg",heading:"heading-aqSxF",body:"body-pUnX4",video:"video-XnjiE",name:"name-tepO3",info:"info-dnUvu",icon:"icon-bz23A",placeholder:"placeholder-NxxV1",text:"text-x3anZ",today:"today-JJfHO",active:"active-ymNy0"}},47852(e){e.exports={list:"list-fa_2a"}},53154(e){e.exports={placeholder:"placeholder-pCQTz",title:"title-bE4zd","image-container":"image-container-DOkaE",image:"image-qgtvg",overview:"overview-RGglv",point:"point-iTc1_",icon:"icon-Y5Zkw",text:"text-Pa9GN","button-container":"button-container-fBjqZ",button:"button-DsyS9"}},16194(e){e.exports={selector:"selector-uRGQ6",prev:"prev-__2gh",next:"next-t6hvT",label:"label-xSEWG",icon:"icon-ixEYr",selected:"selected-lBBwk",year:"year-jHuog",month:"month-VlFJ6"}},39971(e){e.exports={cell:"cell-l3eWl",heading:"heading-TYXvp",day:"day-nttmc",items:"items-ZZ9Jt",item:"item-qsUNQ",icon:"icon-F3Uu8",poster:"poster-goLqZ",more:"more-gGKzA",today:"today-G8kuO",active:"active-KC8sV"}},2946(e){e.exports={table:"table-QbfK0",week:"week-mTZNI",day:"day-LPW9e",long:"long-UpX3r",short:"short-MoF9_",grid:"grid-cUaUg"}},15664(e){e.exports={"discover-container":"discover-container-L6OGL","discover-content":"discover-content-CRsRg","catalog-container":"catalog-container-VNK_T","meta-items-container":"meta-items-container-n8vNz","selectable-inputs-container":"selectable-inputs-container-IRz50","select-input":"select-input-CHDbe","filter-container":"filter-container-BVkqT","filter-button":"filter-button-GU_n0","filter-icon":"filter-icon-zlFnX","missing-addon-warning-container":"missing-addon-warning-container-IXGuv","warning-label":"warning-label-f19Jg","install-button":"install-button-SmJe1",label:"label-ToW4S","message-container":"message-container-Zv9eF",image:"image-txC9E","message-label":"message-label-mRyRX","meta-item-placeholder":"meta-item-placeholder-wxG4I","poster-container":"poster-container-Dch4R","title-bar-container":"title-bar-container-dtDnk","title-label":"title-label-vHdQd","meta-preview-container":"meta-preview-container-CoWs5","selectable-inputs-modal":"selectable-inputs-modal-ChpOa"}},25459(e){e.exports={"password-reset-modal-container":"password-reset-modal-container-KzJPQ","credentials-text-input":"credentials-text-input-ncrIR","error-message":"error-message-DkekN","cancel-button":"cancel-button-AneJE"}},90201(e){e.exports={"intro-container":"intro-container-tkNS6","background-container":"background-container-aYKCH","heading-container":"heading-container-oI70m","logo-container":"logo-container-W49kt",logo:"logo-WJ36F","title-container":"title-container-CbIkM","slogan-container":"slogan-container-UlcYd","content-container":"content-container-A1Drn","form-button":"form-button-vyqqj",icon:"icon-L_6b6",label:"label-uHD7L","submit-button":"submit-button-x3L8z","guest-login-button":"guest-login-button-D8DWZ","signup-form-button":"signup-form-button-UGmSk","login-form-button":"login-form-button-DqJUV","form-container":"form-container-HMlEh","credentials-text-input":"credentials-text-input-QMCZz","forgot-password-link-container":"forgot-password-link-container-ygZqb","forgot-password-link":"forgot-password-link-NxNUD","error-message":"error-message-cKdzB","options-container":"options-container-qxboQ","facebook-button":"facebook-button-LZ_kG","apple-button":"apple-button-V5nEI","loading-modal-container":"loading-modal-container-eLyTm","loader-container":"loader-container-oe8rU",flash:"flash-wUFXY",button:"button-ryGtP"}},91961(e){e.exports={placeholder:"placeholder-XbuMS",title:"title-eBwtZ","image-container":"image-container-YnqQ_",image:"image-yTheT",overview:"overview-nYi3n",point:"point-vQhRj",icon:"icon-RD7Oa",text:"text-NNOtt","button-container":"button-container-HU08c",button:"button-GHZkA"}},84206(e){e.exports={"library-container":"library-container-zM_bj","library-content":"library-content-PgX4O","meta-items-container":"meta-items-container-IKrND","selectable-inputs-container":"selectable-inputs-container-hR3or","select-input-container":"select-input-container-H1VZ1","message-container":"message-container-MhY5t",image:"image-csRHm","message-label":"message-label-UExl3","selectable-inputs-modal":"selectable-inputs-modal-rHlo7"}},64119(e){e.exports={"button-container":"button-container-PmUa2",label:"label-sAyL4"}},36243(e){e.exports={background:"background-Xro_t",icon:"icon-UFaeB"}},73095(e){e.exports={"stream-placeholder-container":"stream-placeholder-container-T1nxv","addon-container":"addon-container-pm1P0","addon-name":"addon-name-zAOKP","info-container":"info-container-Z1Dl6","description-container":"description-container-ZOMcn","play-icon":"play-icon-MXqj3"}},28573(e){e.exports={"stream-container":"stream-container-JPdah",icon:"icon-rAZvO","info-container":"info-container-TihQo",thumbnail:"thumbnail-whoms","placeholder-icon":"placeholder-icon-znYz0","addon-name":"addon-name-tC8PX","progress-bar-container":"progress-bar-container-ADRp_","progress-bar":"progress-bar-XrEBL","progress-bar-background":"progress-bar-background-HueVQ","description-container":"description-container-vW_De","menu-icon":"menu-icon-JD2rP","context-menu-content":"context-menu-content-Xe_lN","context-menu-title":"context-menu-title-aoWE4","context-menu-option-container":"context-menu-option-container-BZGla","context-menu-option-label":"context-menu-option-label-EbNNz"}},11182(e){e.exports={"streams-list-container":"streams-list-container-xYMJo","message-container":"message-container-f9_L4",search:"search-Bo8nu",image:"image-rIyu6",label:"label-luvnO","addons-loading-container":"addons-loading-container-Vkwp3","addons-loading":"addons-loading-zhdQr","addons-loading-bar":"addons-loading-bar-MqT59","select-choices-wrapper":"select-choices-wrapper-xGzfs","back-button-container":"back-button-container-cJ4bk",icon:"icon-SoFgF","episode-title":"episode-title-dln_c","select-input-container":"select-input-container-irGn_","streams-container":"streams-container-bbSc4","install-button-container":"install-button-container-Q60yJ"}},58010(e){e.exports={"seasons-bar-placeholder-container":"seasons-bar-placeholder-container-M81RN","prev-season-button":"prev-season-button-TCbOq","next-season-button":"next-season-button-oGnlT",icon:"icon-UzQjF",label:"label-lmBnj","seasons-popup-label-container":"seasons-popup-label-container-r2UDB","seasons-popup-label":"seasons-popup-label-xBinL","seasons-popup-icon":"seasons-popup-icon-p1T5d"}},98607(e){e.exports={"seasons-bar-container":"seasons-bar-container-nOZjG","prev-season-button":"prev-season-button-bs1GQ","next-season-button":"next-season-button-RrYAq",disabled:"disabled-WJy2x",label:"label-uJbfD",icon:"icon-_ZBEE","seasons-popup-label-container":"seasons-popup-label-container-fZcu4"}},24859(e){e.exports={"videos-list-container":"videos-list-container-NepX5","message-container":"message-container-_hhmQ","episode-picker":"episode-picker-JPpsC",image:"image-_xAbP",label:"label-Ff1_X","notifications-toggle":"notifications-toggle-PaWY3","seasons-bar":"seasons-bar-Ma8vp","search-bar":"search-bar-mZHWa","videos-container":"videos-container-msX8s"}},11472(e){e.exports={"metadetails-container":"metadetails-container-K_Dqa","background-image-layer":"background-image-layer-wJa90","background-image":"background-image-tSjYu","nav-bar":"nav-bar-MH6Vk","metadetails-content":"metadetails-content-Uz5EV","vertical-nav-bar":"vertical-nav-bar-B39nq","meta-message-container":"meta-message-container-MJZN5",image:"image-R1LcJ","message-label":"message-label-Uz4_P","meta-preview":"meta-preview-ES0h3",spacing:"spacing-rgIYg","videos-list":"videos-list-nE0LJ","streams-list":"streams-list-Y1lCM","meta-extension-modal-container":"meta-extension-modal-container-gHjqy","meta-extension-modal-iframe":"meta-extension-modal-iframe-GGHlm"}},85720(e){e.exports={"not-found-container":"not-found-container-Q1qsP","nav-bar":"nav-bar-Eu3_y","not-found-content":"not-found-content-z_Eza","not-found-image":"not-found-image-Qab4G","not-found-label":"not-found-label-mmwyZ"}},89181(e){e.exports={"audio-menu":"audio-menu-qB4SQ",container:"container-lNRgG",header:"header-yT4vp",list:"list-lt_h8",option:"option-COcvW",info:"info-BPG2q",lang:"lang-EXxoG",label:"label-_DvDN",icon:"icon-DebLV"}},71173(e){e.exports={buffering:"buffering-IgMNi",logo:"logo-GBPtk",pulse:"pulse-Aqwp7",background:"background-G3FHq"}},2696(e){e.exports={"cast-devices-menu-container":"cast-devices-menu-container-iiyf6",message:"message-NFgL6"}},58821(e){e.exports={"seek-bar-container":"seek-bar-container-JGGTa",label:"label-QFbsS",slider:"slider-hBDOf"}},27707(e){e.exports={"volume-slider":"volume-slider-G_xAt"}},98483(e){e.exports={"control-bar-container":"control-bar-container-xsWA7","seek-bar":"seek-bar-I7WeY","control-bar-buttons-container":"control-bar-buttons-container-SWhkU","control-bar-button":"control-bar-button-FQUsj",icon:"icon-qy6I6","volume-slider":"volume-slider-U9jfo",spacing:"spacing-p8NJQ","control-bar-buttons-menu-button":"control-bar-buttons-menu-button-h0MWd","control-bar-buttons-menu-container":"control-bar-buttons-menu-container-M6L0_"}},83830(e){e.exports={error:"error-ty_iB","error-label":"error-label-lyLDv","error-sub":"error-sub-rdwAf","playlist-button":"playlist-button-tZTCo",icon:"icon-fIGRf",label:"label-Z7jSJ"}},5077(e){e.exports={"indicator-container":"indicator-container-wgAZn",indicator:"indicator-jM65y"}},1247(e){e.exports={"next-video-popup-container":"next-video-popup-container-H4wnL","slide-fade-in":"slide-fade-in-rk2M8","poster-container":"poster-container-tXZjA","poster-image":"poster-image-2D6wg",blurred:"blurred-rcoS5","placeholder-icon":"placeholder-icon-fu1rK","info-container":"info-container-KLOMx","details-container":"details-container-bUOTZ",name:"name-sIiDL",label:"label-zOq_w",title:"title-Z5Kgo","buttons-container":"buttons-container-iYrpZ",spacing:"spacing-iFwsN","button-container":"button-container-i4F7t","play-button":"play-button-Dluk6",icon:"icon-N3Ewm",dismiss:"dismiss-IvEL_"}},33292(e){e.exports={"option-container":"option-container-m_jZq",icon:"icon-krR0X",label:"label-cmqqu"}},87852(e){e.exports={"options-menu-container":"options-menu-container-qlzLt"}},32411(e){e.exports={"side-drawer":"side-drawer-r9EuA","close-button":"close-button-ruzkn",icon:"icon-k44IU",info:"info-hhNTg","side-drawer-meta-preview":"side-drawer-meta-preview-pB8v6","series-content":"series-content-VkYHB",videos:"videos-nRM2D"}},28051(e){e.exports={"side-drawer-button":"side-drawer-button-lVLKS",icon:"icon-g5Oo_"}},15803(e){e.exports={"speed-menu-container":"speed-menu-container-ABjzc",title:"title-Hu2Dm","main-container":"main-container-D0ixM","options-container":"options-container-DNn3D","speed-button":"speed-button-J9OVM",active:"active-X_CV7","top-container":"top-container-Ecn1T","speed-title":"speed-title-k0DqM",slider:"slider-4MJyM"}},37573(e){e.exports={"statistics-menu-container":"statistics-menu-container-DhiHn",title:"title-NCwWH",label:"label-h6nN_",value:"value-E8Ftb",stats:"stats-Tr37t",stat:"stat-zoq5A","info-hash":"info-hash-GT1Cv"}},32372(e){e.exports={stepper:"stepper-OL8zv",header:"header-fEtxa",content:"content-A6qIn",button:"button-fisbt",icon:"icon-zdvuT",value:"value-Z6LnU"}},24800(e){e.exports={"variant-option":"variant-option-RT1Op",info:"info-B5NXN","variant-label":"variant-label-J6D51","variant-origin":"variant-origin-tr6Os",icon:"icon-D8Ps2","context-menu-option":"context-menu-option-na6Oz","menu-icon":"menu-icon-kOThr","context-menu-option-label":"context-menu-option-label-YJcQv"}},79105(e){e.exports={"subtitles-menu-container":"subtitles-menu-container-PxBRZ","languages-container":"languages-container-NS7H9","variants-container":"variants-container-XglzH","subtitles-settings-container":"subtitles-settings-container-LhRGS","languages-header":"languages-header-jGNcK","variants-header":"variants-header-TsVSR","settings-header":"settings-header-eaWnm","languages-list":"languages-list-sxIwI","variants-list":"variants-list-yZo6B","language-option":"language-option-O1Yr9","language-label":"language-label-FjjqA",icon:"icon-I1Ruh","no-variants-container":"no-variants-container-q6u1Q","no-variants-label":"no-variants-label-RmDKZ","settings-list":"settings-list-mhZV6",spacing:"spacing-AWJpt",stepper:"stepper-FTDeY"}},87930(e){e.exports={"video-container":"video-container-v9_vA",video:"video-tkpQm"}},73846(e){e.exports={"volume-change-indicator":"volume-change-indicator-EWypD","volume-icon":"volume-icon-zn9zT","volume-slider":"volume-slider-FKN0X"}},38254(e){e.exports={"player-container":"player-container-wIELK",overlayHidden:"overlayHidden-gyjIy","nav-bar-layer":"nav-bar-layer-r9HT5","control-bar-layer":"control-bar-layer-m2jto","menu-layer":"menu-layer-HZFG9","side-drawer-button-layer":"side-drawer-button-layer-RrB8k",layer:"layer-qalDW","buffering-layer":"buffering-layer-ZZCYp","error-layer":"error-layer-RCEZC","background-layer":"background-layer-ldsp8",image:"image-XxZuJ","indicator-layer":"indicator-layer-EpiA6","side-drawer-layer":"side-drawer-layer-CZtJ1"}},70809(e){e.exports={"search-container":"search-container-uXEFf","search-content":"search-content-LX6un","search-row":"search-row-EQLaD","search-hints-wrapper":"search-hints-wrapper-IjhmE","search-hints-title-container":"search-hints-title-container-MXt8W","search-hints-title":"search-hints-title-cigX3","search-hints-container":"search-hints-container-FHpPM","search-hint-container":"search-hint-container-kd8iX",icon:"icon-fOZZl",label:"label-l6wxz","message-container":"message-container-YAunr",image:"image-Xuwya","message-label":"message-label-K8LPz","search-row-poster":"search-row-poster-m7CUE","search-row-square":"search-row-square-VesJA","search-row-landscape":"search-row-landscape-o3Lfv"}},77257(e){e.exports={"trakt-container":"trakt-container-wWlM8","discord-container":"discord-container-yJt0d"}},89618(e){e.exports={user:"user-qhCA4","user-info-content":"user-info-content-uzAvu","avatar-container":"avatar-container-DeGD6","email-logout-container":"email-logout-container-YPJlN","email-label-container":"email-label-container-NEqIq","email-label":"email-label-LXltS","user-panel-container":"user-panel-container-WxLTU","user-panel-label":"user-panel-label-KmZCD"}},69919(e){e.exports={info:"info-nBG5H",label:"label-ldqPK"}},55949(e){e.exports={menu:"menu-xeE06",button:"button-DNmYL",selected:"selected-S7SeK",spacing:"spacing-PVpEn","version-info-label":"version-info-label-rSTCy"}},86669(e){e.exports={"settings-container":"settings-container-_g1tS","settings-content":"settings-content-co5eU","sections-container":"sections-container-ZaZpD"}},81589(e){e.exports={"shortcuts-group":"shortcuts-group-lFLEk"}},19433(e){e.exports={"configure-input-container":"configure-input-container-IqUdN",label:"label-bkapj","configure-button-container":"configure-button-container-tJJ5b",icon:"icon-DoVQm"}},21076(e){e.exports={"add-item":"add-item-EBrwa",input:"input-iITch",actions:"actions-a9mxc",add:"add-IsY_6",cancel:"cancel-gSD5_",icon:"icon-lYjLQ"}},42148(e){e.exports={item:"item-A9qrP",content:"content-SRbPn",selectable:"selectable-qF2vl",label:"label-WLvfI",actions:"actions-QcMQ_",status:"status-crByJ",icon:"icon-aswqE",ready:"ready-VKkmT",error:"error-sL3We",delete:"delete-mV6G_"}},85678(e){e.exports={wrapper:"wrapper-mdG7D",header:"header-epxi0",label:"label-Yi3xl",content:"content-XG6N_",item:"item-hsmmX",footer:"footer-Bo7gV","add-url":"add-url-fEacA",icon:"icon-L0f3e",reload:"reload-OVkwB"}},96666(e){e.exports={category:"category-GP0hI",heading:"heading-XePFl",label:"label-N_O2v",icon:"icon-oZoyV"}},5082(e){e.exports={link:"link-FrL1t",label:"label-PJvSJ"}},29436(e){e.exports={option:"option-vFOAS",heading:"heading-dYMDt",content:"content-P2T0i",icon:"icon-fE4hv",label:"label-qI6Vh"}},72756(e){e.exports={section:"section-hcYuV",label:"label-wXG3e"}},24922(e,t,E){var a="function"==typeof Map&&Map.prototype,i=Object.getOwnPropertyDescriptor&&a?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,o=a&&i&&"function"==typeof i.get?i.get:null,_=a&&Map.prototype.forEach,n="function"==typeof Set&&Set.prototype,r=Object.getOwnPropertyDescriptor&&n?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,S=n&&r&&"function"==typeof r.get?r.get:null,T=n&&Set.prototype.forEach,s="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,I="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,l="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,A=Boolean.prototype.valueOf,O=Object.prototype.toString,u=Function.prototype.toString,R=String.prototype.match,N=String.prototype.slice,d=String.prototype.replace,c=String.prototype.toUpperCase,L=String.prototype.toLowerCase,m=RegExp.prototype.test,D=Array.prototype.concat,C=Array.prototype.join,p=Array.prototype.slice,P=Math.floor,B="function"==typeof BigInt?BigInt.prototype.valueOf:null,h=Object.getOwnPropertySymbols,f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,W="function"==typeof Symbol&&"object"==typeof Symbol.iterator,g="function"==typeof Symbol&&Symbol.toStringTag&&(typeof Symbol.toStringTag===W||"symbol")?Symbol.toStringTag:null,M=Object.prototype.propertyIsEnumerable,v=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function U(e,t){if(e===1/0||e===-1/0||e!=e||e&&e>-1e3&&e<1e3||m.call(/e/,t))return t;var E=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if("number"==typeof e){var a=e<0?-P(-e):P(e);if(a!==e){var i=String(a),o=N.call(t,i.length+1);return d.call(i,E,"$&_")+"."+d.call(d.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return d.call(t,E,"$&_")}var G=E(22179),y=G.custom,b=z(y)?y:null,k={__proto__:null,double:'"',single:"'"},F={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};function V(e,t,E){var a=E.quoteStyle||t,i=k[a];return i+e+i}function H(e){return d.call(String(e),/"/g,""")}function Y(e){return!g||!("object"==typeof e&&(g in e||void 0!==e[g]))}function w(e){return"[object Array]"===Q(e)&&Y(e)}function K(e){return"[object RegExp]"===Q(e)&&Y(e)}function z(e){if(W)return e&&"object"==typeof e&&e instanceof Symbol;if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!f)return!1;try{return f.call(e),!0}catch(e){}return!1}e.exports=function e(t,a,i,n){var r=a||{};if(x(r,"quoteStyle")&&!x(k,r.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(x(r,"maxStringLength")&&("number"==typeof r.maxStringLength?r.maxStringLength<0&&r.maxStringLength!==1/0:null!==r.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var O=!x(r,"customInspect")||r.customInspect;if("boolean"!=typeof O&&"symbol"!==O)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(x(r,"indent")&&null!==r.indent&&"\t"!==r.indent&&!(parseInt(r.indent,10)===r.indent&&r.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(x(r,"numericSeparator")&&"boolean"!=typeof r.numericSeparator)throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var c=r.numericSeparator;if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return $(t,r);if("number"==typeof t){if(0===t)return 1/0/t>0?"0":"-0";var m=String(t);return c?U(t,m):m}if("bigint"==typeof t){var P=String(t)+"n";return c?U(t,P):P}var h=void 0===r.depth?5:r.depth;if(void 0===i&&(i=0),i>=h&&h>0&&"object"==typeof t)return w(t)?"[Array]":"[Object]";var y=(function(e,t){var E;if("\t"===e.indent)E="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;E=C.call(Array(e.indent+1)," ")}return{base:E,prev:C.call(Array(t+1),E)}})(r,i);if(void 0===n)n=[];else if(X(n,t)>=0)return"[Circular]";function F(t,E,a){if(E&&(n=p.call(n)).push(E),a){var o={depth:r.depth};return x(r,"quoteStyle")&&(o.quoteStyle=r.quoteStyle),e(t,o,i+1,n)}return e(t,r,i+1,n)}if("function"==typeof t&&!K(t)){var j=(function(e){if(e.name)return e.name;var t=R.call(u.call(e),/^function\s*([\w$]+)/);if(t)return t[1];return null})(t),q=Ee(t,F);return"[Function"+(j?": "+j:" (anonymous)")+"]"+(q.length>0?" { "+C.call(q,", ")+" }":"")}if(z(t)){var ae=W?d.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):f.call(t);return"object"!=typeof t||W?ae:J(ae)}if((function(e){if(!e||"object"!=typeof e)return!1;if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement)return!0;return"string"==typeof e.nodeName&&"function"==typeof e.getAttribute})(t)){for(var ie="<"+L.call(String(t.nodeName)),oe=t.attributes||[],_e=0;_e"}if(w(t)){if(0===t.length)return"[]";var ne=Ee(t,F);return y&&!(function(e){for(var t=0;t=0)return!1;return!0})(ne)?"["+te(ne,y)+"]":"[ "+C.call(ne,", ")+" ]"}if((function(e){return"[object Error]"===Q(e)&&Y(e)})(t)){var re=Ee(t,F);return"cause"in Error.prototype||!("cause"in t)||M.call(t,"cause")?0===re.length?"["+String(t)+"]":"{ ["+String(t)+"] "+C.call(re,", ")+" }":"{ ["+String(t)+"] "+C.call(D.call("[cause]: "+F(t.cause),re),", ")+" }"}if("object"==typeof t&&O){if(b&&"function"==typeof t[b]&&G)return G(t,{depth:h-i});if("symbol"!==O&&"function"==typeof t.inspect)return t.inspect()}if((function(e){if(!o||!e||"object"!=typeof e)return!1;try{o.call(e);try{S.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1})(t)){var Se=[];return _&&_.call(t,function(e,E){Se.push(F(E,t,!0)+" => "+F(e,t))}),ee("Map",o.call(t),Se,y)}if((function(e){if(!S||!e||"object"!=typeof e)return!1;try{S.call(e);try{o.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1})(t)){var Te=[];return T&&T.call(t,function(e){Te.push(F(e,t))}),ee("Set",S.call(t),Te,y)}if((function(e){if(!s||!e||"object"!=typeof e)return!1;try{s.call(e,s);try{I.call(e,I)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1})(t))return Z("WeakMap");if((function(e){if(!I||!e||"object"!=typeof e)return!1;try{I.call(e,I);try{s.call(e,s)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1})(t))return Z("WeakSet");if((function(e){if(!l||!e||"object"!=typeof e)return!1;try{return l.call(e),!0}catch(e){}return!1})(t))return Z("WeakRef");if((function(e){return"[object Number]"===Q(e)&&Y(e)})(t))return J(F(Number(t)));if((function(e){if(!e||"object"!=typeof e||!B)return!1;try{return B.call(e),!0}catch(e){}return!1})(t))return J(F(B.call(t)));if((function(e){return"[object Boolean]"===Q(e)&&Y(e)})(t))return J(A.call(t));if((function(e){return"[object String]"===Q(e)&&Y(e)})(t))return J(F(String(t)));if("undefined"!=typeof window&&t===window)return"{ [object Window] }";if("undefined"!=typeof globalThis&&t===globalThis||void 0!==E.g&&t===E.g)return"{ [object globalThis] }";if(!(function(e){return"[object Date]"===Q(e)&&Y(e)})(t)&&!K(t)){var se=Ee(t,F),Ie=v?v(t)===Object.prototype:t instanceof Object||t.constructor===Object,le=t instanceof Object?"":"null prototype",Ae=!Ie&&g&&Object(t)===t&&g in t?N.call(Q(t),8,-1):le?"Object":"",Oe=(Ie||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(Ae||le?"["+C.call(D.call([],Ae||[],le||[]),": ")+"] ":"");return 0===se.length?Oe+"{}":y?Oe+"{"+te(se,y)+"}":Oe+"{ "+C.call(se,", ")+" }"}return String(t)};var j=Object.prototype.hasOwnProperty||function(e){return e in this};function x(e,t){return j.call(e,t)}function Q(e){return O.call(e)}function X(e,t){if(e.indexOf)return e.indexOf(t);for(var E=0,a=e.length;Et.maxStringLength){var E=e.length-t.maxStringLength,a="... "+E+" more character"+(E>1?"s":"");return $(N.call(e,0,t.maxStringLength),t)+a}var i=F[t.quoteStyle||"single"];return i.lastIndex=0,V(d.call(d.call(e,i,"\\$1"),/[\x00-\x1f]/g,q),"single",t)}function q(e){var t=e.charCodeAt(0),E={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return E?"\\"+E:"\\x"+(t<16?"0":"")+c.call(t.toString(16))}function J(e){return"Object("+e+")"}function Z(e){return e+" { ? }"}function ee(e,t,E,a){return e+" ("+t+") {"+(a?te(E,a):C.call(E,", "))+"}"}function te(e,t){if(0===e.length)return"";var E="\n"+t.prev+t.base;return E+C.call(e,","+E)+"\n"+t.prev}function Ee(e,t){var E=w(e),a=[];if(E){a.length=e.length;for(var i=0;i= 0x80 (not a basic code point)","invalid-input":"Invalid input"},I=Math.floor,l=String.fromCharCode;function A(e){throw new RangeError(s[e])}function O(e,t){for(var E=e.length,a=[];E--;)a[E]=t(e[E]);return a}function u(e,t){var E=e.split("@"),a="";return E.length>1&&(a=E[0]+"@",e=E[1]),a+O((e=e.replace(T,".")).split("."),t).join(".")}function R(e){for(var t,E,a=[],i=0,o=e.length;i=55296&&t<=56319&&i65535&&(t+=l((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=l(e)}).join("")}function d(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:n}function c(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function L(e,t,E){var a=0;for(e=E?I(e/700):e>>1,e+=I(e/t);e>455;a+=n)e=I(e/35);return I(a+36*e/(e+38))}function m(e){var t,E,a,i,o,r,S,T,s,l,O=[],u=e.length,R=0,c=128,m=72;for((E=e.lastIndexOf("-"))<0&&(E=0),a=0;a=128&&A("not-basic"),O.push(e.charCodeAt(a));for(i=E>0?E+1:0;i=u&&A("invalid-input"),((T=d(e.charCodeAt(i++)))>=n||T>I((_-R)/r))&&A("overflow"),R+=T*r,!(T<(s=S<=m?1:S>=m+26?26:S-m));S+=n)r>I(_/(l=n-s))&&A("overflow"),r*=l;m=L(R-o,t=O.length+1,0==o),I(R/t)>_-c&&A("overflow"),c+=I(R/t),R%=t,O.splice(R++,0,c)}return N(O)}function D(e){var t,E,a,i,o,r,S,T,s,O,u,N,d,m,D,C=[];for(N=(e=R(e)).length,t=128,E=0,o=72,r=0;r=t&&uI((_-E)/(d=a+1))&&A("overflow"),E+=(S-t)*d,t=S,r=0;r_&&A("overflow"),u==t){for(T=E,s=n;!(T<(O=s<=o?1:s>=o+26?26:s-o));s+=n)D=T-O,m=n-O,C.push(l(c(O+D%m,0))),T=I(D/m);C.push(l(c(T,0))),o=L(E,d,a==i),E=0,++a}++E,++t}return C.join("")}o={version:"1.4.1",ucs2:{decode:R,encode:N},decode:m,encode:D,toASCII:function(e){return u(e,function(e){return S.test(e)?"xn--"+D(e):e})},toUnicode:function(e){return u(e,function(e){return r.test(e)?m(e.slice(4).toLowerCase()):e})}},void 0===(a=function(){return o}.call(t,E,t,e))||(e.exports=a)})()},33136(e){"use strict";var t=String.prototype.replace,E=/%20/g,a="RFC1738",i="RFC3986";e.exports={default:i,formatters:{RFC1738:function(e){return t.call(e,E,"+")},RFC3986:function(e){return String(e)}},RFC1738:a,RFC3986:i}},55504(e,t,E){"use strict";var a=E(58653),i=E(94355),o=E(33136);e.exports={formats:o,parse:i,stringify:a}},94355(e,t,E){"use strict";var a=E(56841),i=Object.prototype.hasOwnProperty,o=Array.isArray,_={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:a.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictMerge:!0,strictNullHandling:!1,throwOnLimitExceeded:!1},n=function(e){return e.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},r=function(e,t,E){if(e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1)return e.split(",");if(t.throwOnLimitExceeded&&E>=t.arrayLimit)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");return e},S=function(e,t,E,o){if(e){var _=(function(e,t){var E=t.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e;if(t.depth<=0){if(!t.plainObjects&&i.call(Object.prototype,E)&&!t.allowPrototypes)return;return[E]}var a=/(\[[^[\]]*])/g,o=/(\[[^[\]]*])/.exec(E),_=o?E.slice(0,o.index):E,n=[];if(_){if(!t.plainObjects&&i.call(Object.prototype,_)&&!t.allowPrototypes)return;n[n.length]=_}for(var r=0;null!==(o=a.exec(E))&&r0&&"[]"===e[e.length-1]){var _=e.slice(0,-1).join("");o=Array.isArray(t)&&t[_]?t[_].length:0}for(var n=i?t:r(t,E,o),S=e.length-1;S>=0;--S){var T,s=e[S];if("[]"===s&&E.parseArrays)T=a.isOverflow(n)?n:E.allowEmptyArrays&&(""===n||E.strictNullHandling&&null===n)?[]:a.combine([],n,E.arrayLimit,E.plainObjects);else{T=E.plainObjects?{__proto__:null}:{};var I="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,l=E.decodeDotInKeys?I.replace(/%2E/g,"."):I,A=parseInt(l,10),O=!isNaN(A)&&s!==l&&String(A)===l&&A>=0&&E.parseArrays;if(E.parseArrays||""!==l)if(O&&AT)throw new RangeError("Parameter limit exceeded. Only "+T+" parameter"+(1===T?"":"s")+" allowed.");var I,l=-1,A=t.charset;if(t.charsetSentinel)for(I=0;I-1&&(u=o(u)?[u]:u),t.comma&&o(u)&&u.length>t.arrayLimit){if(t.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(1===t.arrayLimit?"":"s")+" allowed in an array.");u=a.combine([],u,t.arrayLimit,t.plainObjects)}if(null!==O){var c=i.call(E,O);c&&("combine"===t.duplicates||R.indexOf("[]=")>-1)?E[O]=a.combine(E[O],u,t.arrayLimit,t.plainObjects):c&&"last"!==t.duplicates||(E[O]=u)}}return E})(e,E):e,s=E.plainObjects?{__proto__:null}:{},I=Object.keys(T),l=0;l0?P.join(",")||null:void 0}];else if(r(u))g=u;else{var v=Object.keys(P);g=R?v.sort(R):v}var U=I?String(E).replace(/\./g,"%2E"):String(E),G=_&&r(P)&&1===P.length?U+"[]":U;if(n&&r(P)&&0===P.length)return G+"[]";for(var y=0;y0?L+c:""}},56841(e,t,E){"use strict";var a=E(33136),i=E(15717),o=Object.prototype.hasOwnProperty,_=Array.isArray,n=i(),r=function(e,t){return n.set(e,t),e},S=function(e){return n.has(e)},T=function(e){return n.get(e)},s=function(e,t){n.set(e,t)},I=(function(){for(var e=[],t=0;t<256;++t)e[e.length]="%"+((t<16?"0":"")+t.toString(16)).toUpperCase();return e})(),l=function(e,t){for(var E=t&&t.plainObjects?{__proto__:null}:{},a=0;aE?r(l(o,{plainObjects:a}),o.length-1):o},compact:function(e){for(var t=[{obj:{o:e},prop:"o"}],E=[],a=0;a1;){var t=e.pop(),E=t.obj[t.prop];if(_(E)){for(var a=[],i=0;i=A?_.slice(r,r+A):_,T=[],s=0;s=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||o===a.RFC1738&&(40===l||41===l)?T[T.length]=S.charAt(s):l<128?T[T.length]=I[l]:l<2048?T[T.length]=I[192|l>>6]+I[128|63&l]:l<55296||l>=57344?T[T.length]=I[224|l>>12]+I[128|l>>6&63]+I[128|63&l]:(s+=1,l=65536+((1023&l)<<10|1023&S.charCodeAt(s)),T[T.length]=I[240|l>>18]+I[128|l>>12&63]+I[128|l>>6&63]+I[128|63&l])}n+=T.join("")}return n},isBuffer:function(e){return!(!e||"object"!=typeof e)&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},isOverflow:S,isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},markOverflow:r,maybeMap:function(e,t){if(_(e)){for(var E=[],a=0;aa.arrayLimit)return r(l(t.concat(E),a),i);t[i]=E}else{if(!t||"object"!=typeof t)return[t,E];if(S(t)){var n=T(t)+1;t[n]=E,s(t,n)}else{if(a&&a.strictMerge)return[t,E];(a&&(a.plainObjects||a.allowPrototypes)||!o.call(Object.prototype,E))&&(t[E]=!0)}}return t}if(!t||"object"!=typeof t){if(S(E)){for(var I=Object.keys(E),A=a&&a.plainObjects?{__proto__:null,0:t}:{0:t},O=0;Oa.arrayLimit?r(l(u,a),u.length-1):u}var R=t;return _(t)&&!_(E)&&(R=l(t,a)),_(t)&&_(E)?(E.forEach(function(E,i){if(o.call(t,i)){var _=t[i];_&&"object"==typeof _&&E&&"object"==typeof E?t[i]=e(_,E,a):t[t.length]=E}else t[i]=E}),t):Object.keys(E).reduce(function(t,i){var _=E[i];if(o.call(t,i)?t[i]=e(t[i],_,a):t[i]=_,S(E)&&!S(t)&&r(t,T(E)),S(t)){var n=parseInt(i,10);String(n)===i&&n>=0&&n>T(t)&&s(t,n)}return t},R)}}},19481(e,t,E){"use strict";var a=E(30758),i=E(31896);function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,E=1;E