(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('.video-player{background-color:#000;display:flex;position:relative}.video-player-image-wrapper{position:absolute;top:0;left:0;width:100%;height:100%;z-index:1000;object-fit:cover}@media (max-width: 600px){.video-player[data-item-type=true]{width:100%!important}}.video-player-play-button{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);background-color:#3a3636;opacity:1;border-radius:50%;width:60px;height:60px;border:none;display:flex;justify-content:center;align-items:center;cursor:pointer;z-index:1}.video-player-play-button:hover{background-color:#3a3636;opacity:1}.video-player-play-icon{color:#fff;font-size:24px;margin-left:5px;padding-top:3px}.video-player-play-button:before{content:"";display:inline-block;width:0;height:0;border-style:solid;border-width:10px 0 10px 16px;border-color:transparent transparent transparent #fff;margin-left:10px}.video-player-error{position:absolute;top:0;left:0;width:100%;height:100%;background-color:#000;display:flex;justify-content:center;align-items:center;color:#fff;font-size:16px;z-index:1000}.video-player-error-message{font-family:Noto Sans JP,Kaku Gothic ProN,YuGothic,Meiryo,sans-serif;padding:16px}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
var f3=Object.defineProperty;var X2=In=>{throw TypeError(In)};var p3=(In,Cn,Wr)=>Cn in In?f3(In,Cn,{enumerable:!0,configurable:!0,writable:!0,value:Wr}):In[Cn]=Wr;var Mr=(In,Cn,Wr)=>p3(In,typeof Cn!="symbol"?Cn+"":Cn,Wr),iw=(In,Cn,Wr)=>Cn.has(In)||X2("Cannot "+Wr);var Re=(In,Cn,Wr)=>(iw(In,Cn,"read from private field"),Wr?Wr.call(In):Cn.get(In)),on=(In,Cn,Wr)=>Cn.has(In)?X2("Cannot add the same private member more than once"):Cn instanceof WeakSet?Cn.add(In):Cn.set(In,Wr),Dt=(In,Cn,Wr,Sf)=>(iw(In,Cn,"write to private field"),Sf?Sf.call(In,Wr):Cn.set(In,Wr),Wr),Xn=(In,Cn,Wr)=>(iw(In,Cn,"access private method"),Wr);var Rb=(In,Cn,Wr,Sf)=>({set _($v){Dt(In,Cn,$v,Wr)},get _(){return Re(In,Cn,Sf)}});try{(function(){var In=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},Cn=new In.Error().stack;Cn&&(In.t=In.t||{},In.t[Cn]="66ce0c7f-fc88-4286-8425-c48c3f4c59be",In._="sentry-dbid-66ce0c7f-fc88-4286-8425-c48c3f4c59be")})()}catch{}(function(In){typeof define=="function"&&define.amd?define(In):In()})(function(){"use strict";var th,Mc,Jf,ML,Zf,Oc,ep,OL,nh,NL,tp,np,Ua,qi,Rm,rh,So,yc,_L,fl,FL,pl,ms,ih,gl,Fd,UL,ha,Cm,BL,Gr,Nc,_c,rp,ip,Fc,sp,ap,$L,Bs,Vn,Dm,ys,sh,op,Uc,ml,Pm,lp,up,ah,oh,Bc,cp,sr,Bv,sw,aw,ow,lw,uw,cw,dw,J2,jL,yl;var In=document.createElement("style");In.textContent=`.video-player{background-color:#000;display:flex;position:relative}.video-player-image-wrapper{position:absolute;top:0;left:0;width:100%;height:100%;z-index:1000;object-fit:cover}@media (max-width: 600px){.video-player[data-item-type=true]{width:100%!important}}.video-player-play-button{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);background-color:#3a3636;opacity:1;border-radius:50%;width:60px;height:60px;border:none;display:flex;justify-content:center;align-items:center;cursor:pointer;z-index:1}.video-player-play-button:hover{background-color:#3a3636;opacity:1}.video-player-play-icon{color:#fff;font-size:24px;margin-left:5px;padding-top:3px}.video-player-play-button:before{content:"";display:inline-block;width:0;height:0;border-style:solid;border-width:10px 0 10px 16px;border-color:transparent transparent transparent #fff;margin-left:10px}.video-player-error{position:absolute;top:0;left:0;width:100%;height:100%;background-color:#000;display:flex;justify-content:center;align-items:center;color:#fff;font-size:16px;z-index:1000}.video-player-error-message{font-family:Noto Sans JP,Kaku Gothic ProN,YuGothic,Meiryo,sans-serif;padding:16px}
/*$vite$:1*/`,document.head.appendChild(In);var Cn=typeof document<"u"?document.currentScript:null,Wr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Sf(a){return a&&a.q&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var $v,hw,fw={exports:{}},em={},pw,gw,ki=(hw||(hw=1,fw.exports=function(){if($v)return em;$v=1;var a=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(s,u,f){var c=null;if(f!==void 0&&(c=""+f),u.key!==void 0&&(c=""+u.key),"key"in u)for(var v in f={},u)v!=="key"&&(f[v]=u[v]);else f=u;return u=f.ref,{$$typeof:a,type:s,key:c,ref:u!==void 0?u:null,props:f}}return em.Fragment=t,em.jsx=r,em.jsxs=r,em}()),fw.exports),mw={exports:{}},tm={},yw={exports:{}},vw={};function Z2(){return gw||(gw=1,yw.exports=(pw||(pw=1,function(a){function t(J,ue){var de=J.length;J.push(ue);e:for(;0<de;){var W=de-1>>>1,Ke=J[W];if(!(0<u(Ke,ue)))break e;J[W]=ue,J[de]=Ke,de=W}}function r(J){return J.length===0?null:J[0]}function s(J){if(J.length===0)return null;var ue=J[0],de=J.pop();if(de!==ue){J[0]=de;e:for(var W=0,Ke=J.length,nt=Ke>>>1;W<nt;){var mt=2*(W+1)-1,ot=J[mt],lt=mt+1,nn=J[lt];if(0>u(ot,de))lt<Ke&&0>u(nn,ot)?(J[W]=nn,J[lt]=de,W=lt):(J[W]=ot,J[mt]=de,W=mt);else{if(!(lt<Ke&&0>u(nn,de)))break e;J[W]=nn,J[lt]=de,W=lt}}}return ue}function u(J,ue){var de=J.sortIndex-ue.sortIndex;return de!==0?de:J.id-ue.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;a.unstable_now=function(){return f.now()}}else{var c=Date,v=c.now();a.unstable_now=function(){return c.now()-v}}var y=[],E=[],A=1,L=null,T=3,M=!1,O=!1,U=!1,$=typeof setTimeout=="function"?setTimeout:null,z=typeof clearTimeout=="function"?clearTimeout:null,Q=typeof setImmediate<"u"?setImmediate:null;function Z(J){for(var ue=r(E);ue!==null;){if(ue.callback===null)s(E);else{if(!(ue.startTime<=J))break;s(E),ue.sortIndex=ue.expirationTime,t(y,ue)}ue=r(E)}}function ie(J){if(U=!1,Z(J),!O)if(r(y)!==null)O=!0,xe();else{var ue=r(E);ue!==null&&Ce(ie,ue.startTime-J)}}var se,ye=!1,N=-1,re=5,ne=-1;function Se(){return!(a.unstable_now()-ne<re)}function ce(){if(ye){var J=a.unstable_now();ne=J;var ue=!0;try{e:{O=!1,U&&(U=!1,z(N),N=-1),M=!0;var de=T;try{t:{for(Z(J),L=r(y);L!==null&&!(L.expirationTime>J&&Se());){var W=L.callback;if(typeof W=="function"){L.callback=null,T=L.priorityLevel;var Ke=W(L.expirationTime<=J);if(J=a.unstable_now(),typeof Ke=="function"){L.callback=Ke,Z(J),ue=!0;break t}L===r(y)&&s(y),Z(J)}else s(y);L=r(y)}if(L!==null)ue=!0;else{var nt=r(E);nt!==null&&Ce(ie,nt.startTime-J),ue=!1}}break e}finally{L=null,T=de,M=!1}ue=void 0}}finally{ue?se():ye=!1}}}if(typeof Q=="function")se=function(){Q(ce)};else if(typeof MessageChannel<"u"){var we=new MessageChannel,ze=we.port2;we.port1.onmessage=ce,se=function(){ze.postMessage(null)}}else se=function(){$(ce,0)};function xe(){ye||(ye=!0,se())}function Ce(J,ue){N=$(function(){J(a.unstable_now())},ue)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(J){J.callback=null},a.unstable_continueExecution=function(){O||M||(O=!0,xe())},a.unstable_forceFrameRate=function(J){0>J||125<J||(re=0<J?Math.floor(1e3/J):5)},a.unstable_getCurrentPriorityLevel=function(){return T},a.unstable_getFirstCallbackNode=function(){return r(y)},a.unstable_next=function(J){switch(T){case 1:case 2:case 3:var ue=3;break;default:ue=T}var de=T;T=ue;try{return J()}finally{T=de}},a.unstable_pauseExecution=function(){},a.unstable_requestPaint=function(){},a.unstable_runWithPriority=function(J,ue){switch(J){case 1:case 2:case 3:case 4:case 5:break;default:J=3}var de=T;T=J;try{return ue()}finally{T=de}},a.unstable_scheduleCallback=function(J,ue,de){var W=a.unstable_now();switch(de=typeof de=="object"&&de!==null&&typeof(de=de.delay)=="number"&&0<de?W+de:W,J){case 1:var Ke=-1;break;case 2:Ke=250;break;case 5:Ke=1073741823;break;case 4:Ke=1e4;break;default:Ke=5e3}return J={id:A++,callback:ue,priorityLevel:J,startTime:de,expirationTime:Ke=de+Ke,sortIndex:-1},de>W?(J.sortIndex=de,t(E,J),r(y)===null&&J===r(E)&&(U?(z(N),N=-1):U=!0,Ce(ie,de-W))):(J.sortIndex=Ke,t(y,J),O||M||(O=!0,xe())),J},a.unstable_shouldYield=Se,a.unstable_wrapCallback=function(J){var ue=T;return function(){var de=T;T=ue;try{return J.apply(this,arguments)}finally{T=de}}}}(vw)),vw)),yw.exports}var bw,Ew,Tw={exports:{}},yn={};function eD(){if(bw)return yn;bw=1;var a=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),c=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),E=Symbol.for("react.memo"),A=Symbol.for("react.lazy"),L=Symbol.iterator,T={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},M=Object.assign,O={};function U(J,ue,de){this.props=J,this.context=ue,this.refs=O,this.updater=de||T}function $(){}function z(J,ue,de){this.props=J,this.context=ue,this.refs=O,this.updater=de||T}U.prototype.isReactComponent={},U.prototype.setState=function(J,ue){if(typeof J!="object"&&typeof J!="function"&&J!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,J,ue,"setState")},U.prototype.forceUpdate=function(J){this.updater.enqueueForceUpdate(this,J,"forceUpdate")},$.prototype=U.prototype;var Q=z.prototype=new $;Q.constructor=z,M(Q,U.prototype),Q.isPureReactComponent=!0;var Z=Array.isArray,ie={H:null,A:null,T:null,S:null},se=Object.prototype.hasOwnProperty;function ye(J,ue,de,W,Ke,nt){return de=nt.ref,{$$typeof:a,type:J,key:ue,ref:de!==void 0?de:null,props:nt}}function N(J){return typeof J=="object"&&J!==null&&J.$$typeof===a}var re=/\/+/g;function ne(J,ue){return typeof J=="object"&&J!==null&&J.key!=null?(de=""+J.key,W={"=":"=0",":":"=2"},"$"+de.replace(/[=:]/g,function(Ke){return W[Ke]})):ue.toString(36);var de,W}function Se(){}function ce(J,ue,de,W,Ke){var nt=typeof J;nt!=="undefined"&&nt!=="boolean"||(J=null);var mt,ot,lt=!1;if(J===null)lt=!0;else switch(nt){case"bigint":case"string":case"number":lt=!0;break;case"object":switch(J.$$typeof){case a:case t:lt=!0;break;case A:return ce((lt=J.tt)(J.et),ue,de,W,Ke)}}if(lt)return Ke=Ke(J),lt=W===""?"."+ne(J,0):W,Z(Ke)?(de="",lt!=null&&(de=lt.replace(re,"$&/")+"/"),ce(Ke,ue,de,"",function(Ot){return Ot})):Ke!=null&&(N(Ke)&&(mt=Ke,ot=de+(Ke.key==null||J&&J.key===Ke.key?"":(""+Ke.key).replace(re,"$&/")+"/")+lt,Ke=ye(mt.type,ot,void 0,0,0,mt.props)),ue.push(Ke)),1;lt=0;var nn,pn=W===""?".":W+":";if(Z(J))for(var We=0;We<J.length;We++)lt+=ce(W=J[We],ue,de,nt=pn+ne(W,We),Ke);else if(typeof(We=(nn=J)===null||typeof nn!="object"?null:typeof(nn=L&&nn[L]||nn["@@iterator"])=="function"?nn:null)=="function")for(J=We.call(J),We=0;!(W=J.next()).done;)lt+=ce(W=W.value,ue,de,nt=pn+ne(W,We++),Ke);else if(nt==="object"){if(typeof J.then=="function")return ce(function(Ot){switch(Ot.status){case"fulfilled":return Ot.value;case"rejected":throw Ot.reason;default:switch(typeof Ot.status=="string"?Ot.then(Se,Se):(Ot.status="pending",Ot.then(function(gn){Ot.status==="pending"&&(Ot.status="fulfilled",Ot.value=gn)},function(gn){Ot.status==="pending"&&(Ot.status="rejected",Ot.reason=gn)})),Ot.status){case"fulfilled":return Ot.value;case"rejected":throw Ot.reason}}throw Ot}(J),ue,de,W,Ke);throw ue=String(J),Error("Objects are not valid as a React child (found: "+(ue==="[object Object]"?"object with keys {"+Object.keys(J).join(", ")+"}":ue)+"). If you meant to render a collection of children, use an array instead.")}return lt}function we(J,ue,de){if(J==null)return J;var W=[],Ke=0;return ce(J,W,"","",function(nt){return ue.call(de,nt,Ke++)}),W}function ze(J){if(J.nt===-1){var ue=J.it;(ue=ue()).then(function(de){J.nt!==0&&J.nt!==-1||(J.nt=1,J.it=de)},function(de){J.nt!==0&&J.nt!==-1||(J.nt=2,J.it=de)}),J.nt===-1&&(J.nt=0,J.it=ue)}if(J.nt===1)return J.it.default;throw J.it}var xe=typeof reportError=="function"?reportError:function(J){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var ue=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof J=="object"&&J!==null&&typeof J.message=="string"?String(J.message):String(J),error:J});if(!window.dispatchEvent(ue))return}else if(typeof process=="object"&&typeof process.emit=="function")return void process.emit("uncaughtException",J)};function Ce(){}return yn.Children={map:we,forEach:function(J,ue,de){we(J,function(){ue.apply(this,arguments)},de)},count:function(J){var ue=0;return we(J,function(){ue++}),ue},toArray:function(J){return we(J,function(ue){return ue})||[]},only:function(J){if(!N(J))throw Error("React.Children.only expected to receive a single React element child.");return J}},yn.Component=U,yn.Fragment=r,yn.Profiler=u,yn.PureComponent=z,yn.StrictMode=s,yn.Suspense=y,yn.rt=ie,yn.act=function(){throw Error("act(...) is not supported in production builds of React.")},yn.cache=function(J){return function(){return J.apply(null,arguments)}},yn.cloneElement=function(J,ue,de){if(J==null)throw Error("The argument must be a React element, but you passed "+J+".");var W=M({},J.props),Ke=J.key;if(ue!=null)for(nt in ue.ref,ue.key!==void 0&&(Ke=""+ue.key),ue)!se.call(ue,nt)||nt==="key"||nt==="__self"||nt==="__source"||nt==="ref"&&ue.ref===void 0||(W[nt]=ue[nt]);var nt=arguments.length-2;if(nt===1)W.children=de;else if(1<nt){for(var mt=Array(nt),ot=0;ot<nt;ot++)mt[ot]=arguments[ot+2];W.children=mt}return ye(J.type,Ke,void 0,0,0,W)},yn.createContext=function(J){return(J={$$typeof:c,ut:J,lt:J,ct:0,Provider:null,Consumer:null}).Provider=J,J.Consumer={$$typeof:f,ht:J},J},yn.createElement=function(J,ue,de){var W,Ke={},nt=null;if(ue!=null)for(W in ue.key!==void 0&&(nt=""+ue.key),ue)se.call(ue,W)&&W!=="key"&&W!=="__self"&&W!=="__source"&&(Ke[W]=ue[W]);var mt=arguments.length-2;if(mt===1)Ke.children=de;else if(1<mt){for(var ot=Array(mt),lt=0;lt<mt;lt++)ot[lt]=arguments[lt+2];Ke.children=ot}if(J&&J.defaultProps)for(W in mt=J.defaultProps)Ke[W]===void 0&&(Ke[W]=mt[W]);return ye(J,nt,void 0,0,0,Ke)},yn.createRef=function(){return{current:null}},yn.forwardRef=function(J){return{$$typeof:v,render:J}},yn.isValidElement=N,yn.lazy=function(J){return{$$typeof:A,et:{nt:-1,it:J},tt:ze}},yn.memo=function(J,ue){return{$$typeof:E,type:J,compare:ue===void 0?null:ue}},yn.startTransition=function(J){var ue=ie.T,de={};ie.T=de;try{var W=J(),Ke=ie.S;Ke!==null&&Ke(de,W),typeof W=="object"&&W!==null&&typeof W.then=="function"&&W.then(Ce,xe)}catch(nt){xe(nt)}finally{ie.T=ue}},yn.unstable_useCacheRefresh=function(){return ie.H.useCacheRefresh()},yn.use=function(J){return ie.H.use(J)},yn.useActionState=function(J,ue,de){return ie.H.useActionState(J,ue,de)},yn.useCallback=function(J,ue){return ie.H.useCallback(J,ue)},yn.useContext=function(J){return ie.H.useContext(J)},yn.useDebugValue=function(){},yn.useDeferredValue=function(J,ue){return ie.H.useDeferredValue(J,ue)},yn.useEffect=function(J,ue){return ie.H.useEffect(J,ue)},yn.useId=function(){return ie.H.useId()},yn.useImperativeHandle=function(J,ue,de){return ie.H.useImperativeHandle(J,ue,de)},yn.useInsertionEffect=function(J,ue){return ie.H.useInsertionEffect(J,ue)},yn.useLayoutEffect=function(J,ue){return ie.H.useLayoutEffect(J,ue)},yn.useMemo=function(J,ue){return ie.H.useMemo(J,ue)},yn.useOptimistic=function(J,ue){return ie.H.useOptimistic(J,ue)},yn.useReducer=function(J,ue,de){return ie.H.useReducer(J,ue,de)},yn.useRef=function(J){return ie.H.useRef(J)},yn.useState=function(J){return ie.H.useState(J)},yn.useSyncExternalStore=function(J,ue,de){return ie.H.useSyncExternalStore(J,ue,de)},yn.useTransition=function(){return ie.H.useTransition()},yn.version="19.0.0",yn}function Cb(){return Ew||(Ew=1,Tw.exports=eD()),Tw.exports}var Sw,ww,Aw,kw,xw={exports:{}},Ki={};function tD(){if(Sw)return Ki;Sw=1;var a=Cb();function t(v){var y="https://react.dev/errors/"+v;if(1<arguments.length){y+="?args[]="+encodeURIComponent(arguments[1]);for(var E=2;E<arguments.length;E++)y+="&args[]="+encodeURIComponent(arguments[E])}return"Minified React error #"+v+"; visit "+y+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var s={d:{f:r,r:function(){throw Error(t(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},u=Symbol.for("react.portal"),f=a.rt;function c(v,y){return v==="font"?"":typeof y=="string"?y==="use-credentials"?y:"":void 0}return Ki.ft=s,Ki.createPortal=function(v,y){var E=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!y||y.nodeType!==1&&y.nodeType!==9&&y.nodeType!==11)throw Error(t(299));return function(A,L,T){var M=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:u,key:M==null?null:""+M,children:A,containerInfo:L,implementation:T}}(v,y,null,E)},Ki.flushSync=function(v){var y=f.T,E=s.p;try{if(f.T=null,s.p=2,v)return v()}finally{f.T=y,s.p=E,s.d.f()}},Ki.preconnect=function(v,y){typeof v=="string"&&(y?y=typeof(y=y.crossOrigin)=="string"?y==="use-credentials"?y:"":void 0:y=null,s.d.C(v,y))},Ki.prefetchDNS=function(v){typeof v=="string"&&s.d.D(v)},Ki.preinit=function(v,y){if(typeof v=="string"&&y&&typeof y.as=="string"){var E=y.as,A=c(E,y.crossOrigin),L=typeof y.integrity=="string"?y.integrity:void 0,T=typeof y.fetchPriority=="string"?y.fetchPriority:void 0;E==="style"?s.d.S(v,typeof y.precedence=="string"?y.precedence:void 0,{crossOrigin:A,integrity:L,fetchPriority:T}):E==="script"&&s.d.X(v,{crossOrigin:A,integrity:L,fetchPriority:T,nonce:typeof y.nonce=="string"?y.nonce:void 0})}},Ki.preinitModule=function(v,y){if(typeof v=="string")if(typeof y=="object"&&y!==null){if(y.as==null||y.as==="script"){var E=c(y.as,y.crossOrigin);s.d.M(v,{crossOrigin:E,integrity:typeof y.integrity=="string"?y.integrity:void 0,nonce:typeof y.nonce=="string"?y.nonce:void 0})}}else y==null&&s.d.M(v)},Ki.preload=function(v,y){if(typeof v=="string"&&typeof y=="object"&&y!==null&&typeof y.as=="string"){var E=y.as,A=c(E,y.crossOrigin);s.d.L(v,E,{crossOrigin:A,integrity:typeof y.integrity=="string"?y.integrity:void 0,nonce:typeof y.nonce=="string"?y.nonce:void 0,type:typeof y.type=="string"?y.type:void 0,fetchPriority:typeof y.fetchPriority=="string"?y.fetchPriority:void 0,referrerPolicy:typeof y.referrerPolicy=="string"?y.referrerPolicy:void 0,imageSrcSet:typeof y.imageSrcSet=="string"?y.imageSrcSet:void 0,imageSizes:typeof y.imageSizes=="string"?y.imageSizes:void 0,media:typeof y.media=="string"?y.media:void 0})}},Ki.preloadModule=function(v,y){if(typeof v=="string")if(y){var E=c(y.as,y.crossOrigin);s.d.m(v,{as:typeof y.as=="string"&&y.as!=="script"?y.as:void 0,crossOrigin:E,integrity:typeof y.integrity=="string"?y.integrity:void 0})}else s.d.m(v)},Ki.requestFormReset=function(v){s.d.r(v)},Ki.unstable_batchedUpdates=function(v,y){return v(y)},Ki.useFormState=function(v,y,E){return f.H.useFormState(v,y,E)},Ki.useFormStatus=function(){return f.H.useHostTransitionStatus()},Ki.version="19.0.0",Ki}function nD(){if(Aw)return tm;Aw=1;var a=Z2(),t=Cb(),r=(ww||(ww=1,function l(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE=="function")try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch{}}(),xw.exports=tD()),xw.exports);function s(l){var d="https://react.dev/errors/"+l;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)d+="&args[]="+encodeURIComponent(arguments[m])}return"Minified React error #"+l+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function u(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}var f=Symbol.for("react.element"),c=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),L=Symbol.for("react.provider"),T=Symbol.for("react.consumer"),M=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),Q=Symbol.for("react.lazy"),Z=Symbol.for("react.offscreen"),ie=Symbol.for("react.memo_cache_sentinel"),se=Symbol.iterator;function ye(l){return l===null||typeof l!="object"?null:typeof(l=se&&l[se]||l["@@iterator"])=="function"?l:null}var N=Symbol.for("react.client.reference");function re(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===N?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case y:return"Fragment";case v:return"Portal";case A:return"Profiler";case E:return"StrictMode";case U:return"Suspense";case $:return"SuspenseList"}if(typeof l=="object")switch(l.$$typeof){case M:return(l.displayName||"Context")+".Provider";case T:return(l.ht.displayName||"Context")+".Consumer";case O:var d=l.render;return(l=l.displayName)||(l=(l=d.displayName||d.name||"")!==""?"ForwardRef("+l+")":"ForwardRef"),l;case z:return(d=l.displayName||null)!==null?d:re(l.type)||"Memo";case Q:d=l.et,l=l.tt;try{return re(l(d))}catch{}}return null}var ne,Se,ce=t.rt,we=Object.assign;function ze(l){if(ne===void 0)try{throw Error()}catch(m){var d=m.stack.trim().match(/\n( *(at )?)/);ne=d&&d[1]||"",Se=-1<m.stack.indexOf(`
    at`)?" (<anonymous>)":-1<m.stack.indexOf("@")?"@unknown:0:0":""}return`
`+ne+l+Se}var xe=!1;function Ce(l,d){if(!l||xe)return"";xe=!0;var m=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var S={DetermineComponentFrameRoot:function(){try{if(d){var qe=function(){throw Error()};if(Object.defineProperty(qe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(qe,[])}catch(Ze){var Ue=Ze}Reflect.construct(l,[],qe)}else{try{qe.call()}catch(Ze){Ue=Ze}l.call(qe.prototype)}}else{try{throw Error()}catch(Ze){Ue=Ze}(qe=l())&&typeof qe.catch=="function"&&qe.catch(function(){})}}catch(Ze){if(Ze&&Ue&&typeof Ze.stack=="string")return[Ze.stack,Ue.stack]}return[null,null]}};S.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var R=Object.getOwnPropertyDescriptor(S.DetermineComponentFrameRoot,"name");R&&R.configurable&&Object.defineProperty(S.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var P=S.DetermineComponentFrameRoot(),V=P[0],K=P[1];if(V&&K){var ee=V.split(`
`),pe=K.split(`
`);for(R=S=0;S<ee.length&&!ee[S].includes("DetermineComponentFrameRoot");)S++;for(;R<pe.length&&!pe[R].includes("DetermineComponentFrameRoot");)R++;if(S===ee.length||R===pe.length)for(S=ee.length-1,R=pe.length-1;1<=S&&0<=R&&ee[S]!==pe[R];)R--;for(;1<=S&&0<=R;S--,R--)if(ee[S]!==pe[R]){if(S!==1||R!==1)do if(S--,0>--R||ee[S]!==pe[R]){var Ne=`
`+ee[S].replace(" at new "," at ");return l.displayName&&Ne.includes("<anonymous>")&&(Ne=Ne.replace("<anonymous>",l.displayName)),Ne}while(1<=S&&0<=R);break}}}finally{xe=!1,Error.prepareStackTrace=m}return(m=l?l.displayName||l.name:"")?ze(m):""}function J(l){switch(l.tag){case 26:case 27:case 5:return ze(l.type);case 16:return ze("Lazy");case 13:return ze("Suspense");case 19:return ze("SuspenseList");case 0:case 15:return l=Ce(l.type,!1);case 11:return l=Ce(l.type.render,!1);case 1:return l=Ce(l.type,!0);default:return""}}function ue(l){try{var d="";do d+=J(l),l=l.return;while(l);return d}catch(m){return`
Error generating stack: `+m.message+`
`+m.stack}}function de(l){var d=l,m=l;if(l.alternate)for(;d.return;)d=d.return;else{l=d;do 4098&(d=l).flags&&(m=d.return),l=d.return;while(l)}return d.tag===3?m:null}function W(l){if(l.tag===13){var d=l.memoizedState;if(d===null&&(l=l.alternate)!==null&&(d=l.memoizedState),d!==null)return d.dehydrated}return null}function Ke(l){if(de(l)!==l)throw Error(s(188))}function nt(l){var d=l.tag;if(d===5||d===26||d===27||d===6)return l;for(l=l.child;l!==null;){if((d=nt(l))!==null)return d;l=l.sibling}return null}var mt=Array.isArray,ot=r.ft,lt={pending:!1,data:null,method:null,action:null},nn=[],pn=-1;function We(l){return{current:l}}function Ot(l){0>pn||(l.current=nn[pn],nn[pn]=null,pn--)}function gn(l,d){pn++,nn[pn]=l.current,l.current=d}var bt=We(null),Wt=We(null),Un=We(null),Ir=We(null);function Kn(l,d){switch(gn(Un,d),gn(Wt,l),gn(bt,null),l=d.nodeType){case 9:case 11:d=(d=d.documentElement)&&(d=d.namespaceURI)?Cs(d):0;break;default:if(d=(l=l===8?d.parentNode:d).tagName,l=l.namespaceURI)d=af(l=Cs(l),d);else switch(d){case"svg":d=1;break;case"math":d=2;break;default:d=0}}Ot(bt),gn(bt,d)}function Rt(){Ot(bt),Ot(Wt),Ot(Un)}function Lr(l){l.memoizedState!==null&&gn(Ir,l);var d=bt.current,m=af(d,l.type);d!==m&&(gn(Wt,l),gn(bt,m))}function $s(l){Wt.current===l&&(Ot(bt),Ot(Wt)),Ir.current===l&&(Ot(Ir),Dd.ut=lt)}var hu=Object.prototype.hasOwnProperty,Ba=a.unstable_scheduleCallback,mn=a.unstable_cancelCallback,dp=a.unstable_shouldYield,lh=a.unstable_requestPaint,Dn=a.unstable_now,$a=a.unstable_getCurrentPriorityLevel,fu=a.unstable_ImmediatePriority,fr=a.unstable_UserBlockingPriority,ar=a.unstable_NormalPriority,pr=a.unstable_LowPriority,vs=a.unstable_IdlePriority,Mm=a.log,bs=a.unstable_setDisableYieldValue,Nt=null,Wi=null;function Nr(l){if(typeof Mm=="function"&&bs(l),Wi&&typeof Wi.setStrictMode=="function")try{Wi.setStrictMode(Nt,l)}catch{}}var Fi=Math.clz32?Math.clz32:function(l){return(l>>>=0)===0?32:31-(uh(l)/Yi|0)|0},uh=Math.log,Yi=Math.LN2,vl=128,bl=4194304;function El(l){var d=42&l;if(d!==0)return d;switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194176&l;case 4194304:case 8388608:case 16777216:case 33554432:return 62914560&l;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return l}}function Qi(l,d){var m=l.pendingLanes;if(m===0)return 0;var S=0,R=l.suspendedLanes,P=l.pingedLanes,V=l.warmLanes;l=l.finishedLanes!==0;var K=134217727&m;return K!==0?(m=K&~R)!==0?S=El(m):(P&=K)!==0?S=El(P):l||(V=K&~V)!==0&&(S=El(V)):(K=m&~R)!==0?S=El(K):P!==0?S=El(P):l||(V=m&~V)!==0&&(S=El(V)),S===0?0:d!==0&&d!==S&&!(d&R)&&((R=S&-S)>=(V=d&-d)||R===32&&4194176&V)?d:S}function $c(l,d){return!(l.pendingLanes&~(l.suspendedLanes&~l.pingedLanes)&d)}function Om(l,d){switch(l){case 1:case 2:case 4:case 8:return d+250;case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return d+5e3;default:return-1}}function Bn(){var l=vl;return!(4194176&(vl<<=1))&&(vl=128),l}function Nm(){var l=bl;return!(62914560&(bl<<=1))&&(bl=4194304),l}function ch(l){for(var d=[],m=0;31>m;m++)d.push(l);return d}function Tl(l,d){l.pendingLanes|=d,d!==268435456&&(l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0)}function ja(l,d,m){l.pendingLanes|=d,l.suspendedLanes&=~d;var S=31-Fi(d);l.entangledLanes|=d,l.entanglements[S]=1073741824|l.entanglements[S]|4194218&m}function hp(l,d){var m=l.entangledLanes|=d;for(l=l.entanglements;m;){var S=31-Fi(m),R=1<<S;R&d|l[S]&d&&(l[S]|=d),m&=~R}}function jc(l){return 2<(l&=-l)?8<l?134217727&l?32:268435456:8:2}function _m(){var l=ot.p;return l!==0?l:(l=window.event)===void 0?32:N1(l.type)}var js=Math.random().toString(36).slice(2),Hr="__reactFiber$"+js,mi="__reactProps$"+js,Gs="__reactContainer$"+js,dh="__reactEvents$"+js,H0="__reactListeners$"+js,V0="__reactHandles$"+js,Fm="__reactResources$"+js,pu="__reactMarker$"+js;function fp(l){delete l[Hr],delete l[mi],delete l[dh],delete l[H0],delete l[V0]}function Es(l){var d=l[Hr];if(d)return d;for(var m=l.parentNode;m;){if(d=m[Gs]||m[Hr]){if(m=d.alternate,d.child!==null||m!==null&&m.child!==null)for(l=qr(l);l!==null;){if(m=l[Hr])return m;l=qr(l)}return d}m=(l=m).parentNode}return null}function ii(l){if(l=l[Hr]||l[Gs]){var d=l.tag;if(d===5||d===6||d===13||d===26||d===27||d===3)return l}return null}function Gc(l){var d=l.tag;if(d===5||d===26||d===27||d===6)return l.stateNode;throw Error(s(33))}function Ts(l){var d=l[Fm];return d||(d=l[Fm]={hoistableStyles:new Map,hoistableScripts:new Map}),d}function gr(l){l[pu]=!0}var wo=new Set,pp={};function Xi(l,d){Sl(l,d),Sl(l+"Capture",d)}function Sl(l,d){for(pp[l]=d,l=0;l<d.length;l++)wo.add(d[l])}var fa=!(typeof window>"u"||window.document===void 0||window.document.createElement===void 0),K0=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),z0={},mr={};function gu(l,d,m){if(R=d,hu.call(mr,R)||!hu.call(z0,R)&&(K0.test(R)?mr[R]=!0:(z0[R]=!0,0)))if(m===null)l.removeAttribute(d);else{switch(typeof m){case"undefined":case"function":case"symbol":return void l.removeAttribute(d);case"boolean":var S=d.toLowerCase().slice(0,5);if(S!=="data-"&&S!=="aria-")return void l.removeAttribute(d)}l.setAttribute(d,""+m)}var R}function mu(l,d,m){if(m===null)l.removeAttribute(d);else{switch(typeof m){case"undefined":case"function":case"symbol":case"boolean":return void l.removeAttribute(d)}l.setAttribute(d,""+m)}}function pa(l,d,m,S){if(S===null)l.removeAttribute(m);else{switch(typeof S){case"undefined":case"function":case"symbol":case"boolean":return void l.removeAttribute(m)}l.setAttributeNS(d,m,""+S)}}function Ii(l){switch(typeof l){case"bigint":case"boolean":case"number":case"string":case"undefined":case"object":return l;default:return""}}function Hc(l){var d=l.type;return(l=l.nodeName)&&l.toLowerCase()==="input"&&(d==="checkbox"||d==="radio")}function wl(l){l.dt||(l.dt=function(d){var m=Hc(d)?"checked":"value",S=Object.getOwnPropertyDescriptor(d.constructor.prototype,m),R=""+d[m];if(!d.hasOwnProperty(m)&&S!==void 0&&typeof S.get=="function"&&typeof S.set=="function"){var P=S.get,V=S.set;return Object.defineProperty(d,m,{configurable:!0,get:function(){return P.call(this)},set:function(K){R=""+K,V.call(this,K)}}),Object.defineProperty(d,m,{enumerable:S.enumerable}),{getValue:function(){return R},setValue:function(K){R=""+K},stopTracking:function(){d.dt=null,delete d[m]}}}}(l))}function q0(l){if(!l)return!1;var d=l.dt;if(!d)return!0;var m=d.getValue(),S="";return l&&(S=Hc(l)?l.checked?"true":"false":l.value),(l=S)!==m&&(d.setValue(l),!0)}function hh(l){if((l=l||(typeof document<"u"?document:void 0))===void 0)return null;try{return l.activeElement||l.body}catch{return l.body}}var KT=/[\n"\\]/g;function ga(l){return l.replace(KT,function(d){return"\\"+d.charCodeAt(0).toString(16)+" "})}function Um(l,d,m,S,R,P,V,K){l.name="",V!=null&&typeof V!="function"&&typeof V!="symbol"&&typeof V!="boolean"?l.type=V:l.removeAttribute("type"),d!=null?V==="number"?(d===0&&l.value===""||l.value!=d)&&(l.value=""+Ii(d)):l.value!==""+Ii(d)&&(l.value=""+Ii(d)):V!=="submit"&&V!=="reset"||l.removeAttribute("value"),d!=null?yu(l,V,Ii(d)):m!=null?yu(l,V,Ii(m)):S!=null&&l.removeAttribute("value"),R==null&&P!=null&&(l.defaultChecked=!!P),R!=null&&(l.checked=R&&typeof R!="function"&&typeof R!="symbol"),K!=null&&typeof K!="function"&&typeof K!="symbol"&&typeof K!="boolean"?l.name=""+Ii(K):l.removeAttribute("name")}function W0(l,d,m,S,R,P,V,K){if(P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"&&(l.type=P),d!=null||m!=null){if((P==="submit"||P==="reset")&&d==null)return;m=m!=null?""+Ii(m):"",d=d!=null?""+Ii(d):m,K||d===l.value||(l.value=d),l.defaultValue=d}S=typeof(S=S??R)!="function"&&typeof S!="symbol"&&!!S,l.checked=K?l.checked:!!S,l.defaultChecked=!!S,V!=null&&typeof V!="function"&&typeof V!="symbol"&&typeof V!="boolean"&&(l.name=V)}function yu(l,d,m){d==="number"&&hh(l.ownerDocument)===l||l.defaultValue===""+m||(l.defaultValue=""+m)}function Ao(l,d,m,S){if(l=l.options,d){d={};for(var R=0;R<m.length;R++)d["$"+m[R]]=!0;for(m=0;m<l.length;m++)R=d.hasOwnProperty("$"+l[m].value),l[m].selected!==R&&(l[m].selected=R),R&&S&&(l[m].defaultSelected=!0)}else{for(m=""+Ii(m),d=null,R=0;R<l.length;R++){if(l[R].value===m)return l[R].selected=!0,void(S&&(l[R].defaultSelected=!0));d!==null||l[R].disabled||(d=l[R])}d!==null&&(d.selected=!0)}}function Bm(l,d,m){d==null||((d=""+Ii(d))!==l.value&&(l.value=d),m!=null)?l.defaultValue=m!=null?""+Ii(m):"":l.defaultValue!==d&&(l.defaultValue=d)}function fe(l,d,m,S){if(d==null){if(S!=null){if(m!=null)throw Error(s(92));if(mt(S)){if(1<S.length)throw Error(s(93));S=S[0]}m=S}m==null&&(m=""),d=m}m=Ii(d),l.defaultValue=m,(S=l.textContent)===m&&S!==""&&S!==null&&(l.value=S)}function Rr(l,d){if(d){var m=l.firstChild;if(m&&m===l.lastChild&&m.nodeType===3)return void(m.nodeValue=d)}l.textContent=d}var Al=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function vu(l,d,m){var S=d.indexOf("--")===0;m==null||typeof m=="boolean"||m===""?S?l.setProperty(d,""):d==="float"?l.cssFloat="":l[d]="":S?l.setProperty(d,m):typeof m!="number"||m===0||Al.has(d)?d==="float"?l.cssFloat=m:l[d]=(""+m).trim():l[d]=m+"px"}function Li(l,d,m){if(d!=null&&typeof d!="object")throw Error(s(62));if(l=l.style,m!=null){for(var S in m)!m.hasOwnProperty(S)||d!=null&&d.hasOwnProperty(S)||(S.indexOf("--")===0?l.setProperty(S,""):S==="float"?l.cssFloat="":l[S]="");for(var R in d)S=d[R],d.hasOwnProperty(R)&&m[R]!==S&&vu(l,R,S)}else for(var P in d)d.hasOwnProperty(P)&&vu(l,P,d[P])}function en(l){if(l.indexOf("-")===-1)return!1;switch(l){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var _r=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),zT=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Vc(l){return zT.test(""+l)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":l}var Er=null;function ko(l){return(l=l.target||l.srcElement||window).correspondingUseElement&&(l=l.correspondingUseElement),l.nodeType===3?l.parentNode:l}var ma=null,Kc=null;function fh(l){var d=ii(l);if(d&&(l=d.stateNode)){var m=l[mi]||null;e:switch(l=d.stateNode,d.type){case"input":if(Um(l,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name),d=m.name,m.type==="radio"&&d!=null){for(m=l;m.parentNode;)m=m.parentNode;for(m=m.querySelectorAll('input[name="'+ga(""+d)+'"][type="radio"]'),d=0;d<m.length;d++){var S=m[d];if(S!==l&&S.form===l.form){var R=S[mi]||null;if(!R)throw Error(s(90));Um(S,R.value,R.defaultValue,R.defaultValue,R.checked,R.defaultChecked,R.type,R.name)}}for(d=0;d<m.length;d++)(S=m[d]).form===l.form&&q0(S)}break e;case"textarea":Bm(l,m.value,m.defaultValue);break e;case"select":(d=m.value)!=null&&Ao(l,!!m.multiple,d,!1)}}}var Ji=!1;function Hs(l,d,m){if(Ji)return l(d,m);Ji=!0;try{return l(d)}finally{if(Ji=!1,(ma!==null||Kc!==null)&&(Ei(),ma&&(d=ma,l=Kc,Kc=ma=null,fh(d),l)))for(d=0;d<l.length;d++)fh(l[d])}}function Ri(l,d){var m=l.stateNode;if(m===null)return null;var S=m[mi]||null;if(S===null)return null;m=S[d];e:switch(d){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(S=!S.disabled)||(S=!((l=l.type)==="button"||l==="input"||l==="select"||l==="textarea")),l=!S;break e;default:l=!1}if(l)return null;if(m&&typeof m!="function")throw Error(s(231,d,typeof m));return m}var Ci=!1;if(fa)try{var zc={};Object.defineProperty(zc,"passive",{get:function(){Ci=!0}}),window.addEventListener("test",zc,zc),window.removeEventListener("test",zc,zc)}catch{Ci=!1}var kl=null,$m=null,Ga=null;function Ha(){if(Ga)return Ga;var l,d,m=$m,S=m.length,R="value"in kl?kl.value:kl.textContent,P=R.length;for(l=0;l<S&&m[l]===R[l];l++);var V=S-l;for(d=1;d<=V&&m[S-d]===R[P-d];d++);return Ga=R.slice(l,1<d?1-d:void 0)}function xl(l){var d=l.keyCode;return"charCode"in l?(l=l.charCode)===0&&d===13&&(l=13):l=d,l===10&&(l=13),32<=l||l===13?l:0}function ph(){return!0}function jm(){return!1}function zn(l){function d(m,S,R,P,V){for(var K in this.vt=m,this.gt=R,this.type=S,this.nativeEvent=P,this.target=V,this.currentTarget=null,l)l.hasOwnProperty(K)&&(m=l[K],this[K]=m?m(P):P[K]);return this.isDefaultPrevented=(P.defaultPrevented!=null?P.defaultPrevented:P.returnValue===!1)?ph:jm,this.isPropagationStopped=jm,this}return we(d.prototype,{preventDefault:function(){this.defaultPrevented=!0;var m=this.nativeEvent;m&&(m.preventDefault?m.preventDefault():typeof m.returnValue!="unknown"&&(m.returnValue=!1),this.isDefaultPrevented=ph)},stopPropagation:function(){var m=this.nativeEvent;m&&(m.stopPropagation?m.stopPropagation():typeof m.cancelBubble!="unknown"&&(m.cancelBubble=!0),this.isPropagationStopped=ph)},persist:function(){},isPersistent:ph}),d}var Gm,gp,Va,si={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(l){return l.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},bu=zn(si),xo=we({},si,{view:0,detail:0}),Hm=zn(xo),dn=we({},xo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Eu,button:0,buttons:0,relatedTarget:function(l){return l.relatedTarget===void 0?l.fromElement===l.srcElement?l.toElement:l.fromElement:l.relatedTarget},movementX:function(l){return"movementX"in l?l.movementX:(l!==Va&&(Va&&l.type==="mousemove"?(Gm=l.screenX-Va.screenX,gp=l.screenY-Va.screenY):gp=Gm=0,Va=l),Gm)},movementY:function(l){return"movementY"in l?l.movementY:gp}}),Il=zn(dn),Vm=zn(we({},dn,{dataTransfer:0})),gh=zn(we({},xo,{relatedTarget:0})),mp=zn(we({},si,{animationName:0,elapsedTime:0,pseudoElement:0})),Y0=zn(we({},si,{clipboardData:function(l){return"clipboardData"in l?l.clipboardData:window.clipboardData}})),Ll=zn(we({},si,{data:0})),Km={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},mh={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Qt={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ya(l){var d=this.nativeEvent;return d.getModifierState?d.getModifierState(l):!!(l=Qt[l])&&!!d[l]}function Eu(){return ya}var zm=zn(we({},xo,{key:function(l){if(l.key){var d=Km[l.key]||l.key;if(d!=="Unidentified")return d}return l.type==="keypress"?(l=xl(l))===13?"Enter":String.fromCharCode(l):l.type==="keydown"||l.type==="keyup"?mh[l.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Eu,charCode:function(l){return l.type==="keypress"?xl(l):0},keyCode:function(l){return l.type==="keydown"||l.type==="keyup"?l.keyCode:0},which:function(l){return l.type==="keypress"?xl(l):l.type==="keydown"||l.type==="keyup"?l.keyCode:0}})),yp=zn(we({},dn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),qc=zn(we({},xo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Eu})),Tu=zn(we({},si,{propertyName:0,elapsedTime:0,pseudoElement:0})),yh=zn(we({},dn,{deltaX:function(l){return"deltaX"in l?l.deltaX:"wheelDeltaX"in l?-l.wheelDeltaX:0},deltaY:function(l){return"deltaY"in l?l.deltaY:"wheelDeltaY"in l?-l.wheelDeltaY:"wheelDelta"in l?-l.wheelDelta:0},deltaZ:0,deltaMode:0})),vp=zn(we({},si,{newState:0,oldState:0})),Su=[9,13,27,32],Wc=fa&&"CompositionEvent"in window,Zi=null;fa&&"documentMode"in document&&(Zi=document.documentMode);var qm=fa&&"TextEvent"in window&&!Zi,vh=fa&&(!Wc||Zi&&8<Zi&&11>=Zi),wu=" ",Au=!1;function Nn(l,d){switch(l){case"keyup":return Su.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Wm(l){return typeof(l=l.detail)=="object"&&"data"in l?l.data:null}var Rl=!1,bh={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Ym(l){var d=l&&l.nodeName&&l.nodeName.toLowerCase();return d==="input"?!!bh[l.type]:d==="textarea"}function Qm(l,d,m,S){ma?Kc?Kc.push(S):Kc=[S]:ma=S,0<(d=Id(d,"onChange")).length&&(m=new bu("onChange","change",null,m,S),l.push({event:m,listeners:d}))}var ku=null,Yc=null;function qT(l){rv(l,0)}function Eh(l){if(q0(Gc(l)))return l}function Xm(l,d){if(l==="change")return d}var Jm=!1;if(fa){var Zm;if(fa){var bp="oninput"in document;if(!bp){var ey=document.createElement("div");ey.setAttribute("oninput","return;"),bp=typeof ey.oninput=="function"}Zm=bp}else Zm=!1;Jm=Zm&&(!document.documentMode||9<document.documentMode)}function xu(){ku&&(ku.detachEvent("onpropertychange",Qc),Yc=ku=null)}function Qc(l){if(l.propertyName==="value"&&Eh(Yc)){var d=[];Qm(d,Yc,l,ko(l)),Hs(qT,d)}}function Xc(l,d,m){l==="focusin"?(xu(),Yc=m,(ku=d).attachEvent("onpropertychange",Qc)):l==="focusout"&&xu()}function Ep(l){if(l==="selectionchange"||l==="keyup"||l==="keydown")return Eh(Yc)}function ty(l,d){if(l==="click")return Eh(d)}function ny(l,d){if(l==="input"||l==="change")return Eh(d)}var es=typeof Object.is=="function"?Object.is:function(l,d){return l===d&&(l!==0||1/l==1/d)||l!=l&&d!=d};function Iu(l,d){if(es(l,d))return!0;if(typeof l!="object"||l===null||typeof d!="object"||d===null)return!1;var m=Object.keys(l),S=Object.keys(d);if(m.length!==S.length)return!1;for(S=0;S<m.length;S++){var R=m[S];if(!hu.call(d,R)||!es(l[R],d[R]))return!1}return!0}function ry(l){for(;l&&l.firstChild;)l=l.firstChild;return l}function Th(l,d){var m,S=ry(l);for(l=0;S;){if(S.nodeType===3){if(m=l+S.textContent.length,l<=d&&m>=d)return{node:S,offset:d-l};l=m}e:{for(;S;){if(S.nextSibling){S=S.nextSibling;break e}S=S.parentNode}S=void 0}S=ry(S)}}function Tp(l,d){return!(!l||!d)&&(l===d||(!l||l.nodeType!==3)&&(d&&d.nodeType===3?Tp(l,d.parentNode):"contains"in l?l.contains(d):!!l.compareDocumentPosition&&!!(16&l.compareDocumentPosition(d))))}function Jc(l){for(var d=hh((l=l!=null&&l.ownerDocument!=null&&l.ownerDocument.defaultView!=null?l.ownerDocument.defaultView:window).document);d instanceof l.HTMLIFrameElement;){try{var m=typeof d.contentWindow.location.href=="string"}catch{m=!1}if(!m)break;d=hh((l=d.contentWindow).document)}return d}function Sp(l){var d=l&&l.nodeName&&l.nodeName.toLowerCase();return d&&(d==="input"&&(l.type==="text"||l.type==="search"||l.type==="tel"||l.type==="url"||l.type==="password")||d==="textarea"||l.contentEditable==="true")}function Q0(l,d){var m=Jc(d);d=l.focusedElem;var S=l.selectionRange;if(m!==d&&d&&d.ownerDocument&&Tp(d.ownerDocument.documentElement,d)){if(S!==null&&Sp(d)){if(l=S.start,(m=S.end)===void 0&&(m=l),"selectionStart"in d)d.selectionStart=l,d.selectionEnd=Math.min(m,d.value.length);else if((m=(l=d.ownerDocument||document)&&l.defaultView||window).getSelection){m=m.getSelection();var R=d.textContent.length,P=Math.min(S.start,R);S=S.end===void 0?P:Math.min(S.end,R),!m.extend&&P>S&&(R=S,S=P,P=R),R=Th(d,P);var V=Th(d,S);R&&V&&(m.rangeCount!==1||m.anchorNode!==R.node||m.anchorOffset!==R.offset||m.focusNode!==V.node||m.focusOffset!==V.offset)&&((l=l.createRange()).setStart(R.node,R.offset),m.removeAllRanges(),P>S?(m.addRange(l),m.extend(V.node,V.offset)):(l.setEnd(V.node,V.offset),m.addRange(l)))}}for(l=[],m=d;m=m.parentNode;)m.nodeType===1&&l.push({element:m,left:m.scrollLeft,top:m.scrollTop});for(typeof d.focus=="function"&&d.focus(),d=0;d<l.length;d++)(m=l[d]).element.scrollLeft=m.left,m.element.scrollTop=m.top}}var WT=fa&&"documentMode"in document&&11>=document.documentMode,Zc=null,ed=null,Sh=null,qn=!1;function iy(l,d,m){var S=m.window===m?m.document:m.nodeType===9?m:m.ownerDocument;qn||Zc==null||Zc!==hh(S)||("selectionStart"in(S=Zc)&&Sp(S)?S={start:S.selectionStart,end:S.selectionEnd}:S={anchorNode:(S=(S.ownerDocument&&S.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:S.anchorOffset,focusNode:S.focusNode,focusOffset:S.focusOffset},Sh&&Iu(Sh,S)||(Sh=S,0<(S=Id(ed,"onSelect")).length&&(d=new bu("onSelect","select",null,d,m),l.push({event:d,listeners:S}),d.target=Zc)))}function Io(l,d){var m={};return m[l.toLowerCase()]=d.toLowerCase(),m["Webkit"+l]="webkit"+d,m["Moz"+l]="moz"+d,m}var td={animationend:Io("Animation","AnimationEnd"),animationiteration:Io("Animation","AnimationIteration"),animationstart:Io("Animation","AnimationStart"),transitionrun:Io("Transition","TransitionRun"),transitionstart:Io("Transition","TransitionStart"),transitioncancel:Io("Transition","TransitionCancel"),transitionend:Io("Transition","TransitionEnd")},wh={},Ss={};function Lu(l){if(wh[l])return wh[l];if(!td[l])return l;var d,m=td[l];for(d in m)if(m.hasOwnProperty(d)&&d in Ss)return wh[l]=m[d];return l}fa&&(Ss=document.createElement("div").style,"AnimationEvent"in window||(delete td.animationend.animation,delete td.animationiteration.animation,delete td.animationstart.animation),"TransitionEvent"in window||delete td.transitionend.transition);var X0=Lu("animationend"),sy=Lu("animationiteration"),Ah=Lu("animationstart"),J0=Lu("transitionrun"),Z0=Lu("transitionstart"),e1=Lu("transitioncancel"),ay=Lu("transitionend"),Ru=new Map,t1="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll scrollEnd toggle touchMove waiting wheel".split(" ");function Vs(l,d){Ru.set(l,d),Xi(d,[l])}var yi=[],Lo=0,wp=0;function kh(){for(var l=Lo,d=wp=Lo=0;d<l;){var m=yi[d];yi[d++]=null;var S=yi[d];yi[d++]=null;var R=yi[d];yi[d++]=null;var P=yi[d];if(yi[d++]=null,S!==null&&R!==null){var V=S.pending;V===null?R.next=R:(R.next=V.next,V.next=R),S.pending=R}P!==0&&Ap(m,R,P)}}function Pn(l,d,m,S){yi[Lo++]=l,yi[Lo++]=d,yi[Lo++]=m,yi[Lo++]=S,wp|=S,l.lanes|=S,(l=l.alternate)!==null&&(l.lanes|=S)}function or(l,d,m,S){return Pn(l,d,m,S),Ro(l)}function ts(l,d){return Pn(l,null,null,d),Ro(l)}function Ap(l,d,m){l.lanes|=m;var S=l.alternate;S!==null&&(S.lanes|=m);for(var R=!1,P=l.return;P!==null;)P.childLanes|=m,(S=P.alternate)!==null&&(S.childLanes|=m),P.tag===22&&((l=P.stateNode)===null||1&l.yt||(R=!0)),l=P,P=P.return;R&&d!==null&&l.tag===3&&(P=l.stateNode,R=31-Fi(m),(l=(P=P.hiddenUpdates)[R])===null?P[R]=[d]:l.push(d),d.lane=536870912|m)}function Ro(l){if(50<nc)throw nc=0,gg=null,Error(s(185));for(var d=l.return;d!==null;)d=(l=d).return;return l.tag===3?l.stateNode:null}var Cu={},oy=new WeakMap;function dt(l,d){if(typeof l=="object"&&l!==null){var m=oy.get(l);return m!==void 0?m:(d={value:l,source:d,stack:ue(d)},oy.set(l,d),d)}return{value:l,source:d,stack:ue(d)}}var Du=[],Co=0,hn=null,Do=0,ai=[],ln=0,Ui=null,lr=1,Ka="";function Cl(l,d){Du[Co++]=Do,Du[Co++]=hn,hn=l,Do=d}function ly(l,d,m){ai[ln++]=lr,ai[ln++]=Ka,ai[ln++]=Ui,Ui=l;var S=lr;l=Ka;var R=32-Fi(S)-1;S&=~(1<<R),m+=1;var P=32-Fi(d)+R;if(30<P){var V=R-R%5;P=(S&(1<<V)-1).toString(32),S>>=V,R-=V,lr=1<<32-Fi(d)+R|m<<R|S,Ka=P+l}else lr=1<<P|m<<R|S,Ka=l}function nd(l){l.return!==null&&(Cl(l,1),ly(l,1,0))}function Ks(l){for(;l===hn;)hn=Du[--Co],Du[Co]=null,Do=Du[--Co],Du[Co]=null;for(;l===Ui;)Ui=ai[--ln],ai[ln]=null,Ka=ai[--ln],ai[ln]=null,lr=ai[--ln],ai[ln]=null}var Di=null,Vr=null,Ln=!1,rn=null,zs=!1,Dl=Error(s(519));function va(l){throw qs(dt(Error(s(418,"")),l)),Dl}function kp(l){var d=l.stateNode,m=l.type,S=l.memoizedProps;switch(d[Hr]=l,d[mi]=S,m){case"dialog":Rn("cancel",d),Rn("close",d);break;case"iframe":case"object":case"embed":Rn("load",d);break;case"video":case"audio":for(m=0;m<ct.length;m++)Rn(ct[m],d);break;case"source":Rn("error",d);break;case"img":case"image":case"link":Rn("error",d),Rn("load",d);break;case"details":Rn("toggle",d);break;case"input":Rn("invalid",d),W0(d,S.value,S.defaultValue,S.checked,S.defaultChecked,S.type,S.name,!0),wl(d);break;case"select":Rn("invalid",d);break;case"textarea":Rn("invalid",d),fe(d,S.value,S.defaultValue,S.children),wl(d)}typeof(m=S.children)!="string"&&typeof m!="number"&&typeof m!="bigint"||d.textContent===""+m||S.suppressHydrationWarning===!0||nf(d.textContent,m)?(S.popover!=null&&(Rn("beforetoggle",d),Rn("toggle",d)),S.onScroll!=null&&Rn("scroll",d),S.onScrollEnd!=null&&Rn("scrollend",d),S.onClick!=null&&(d.onclick=rf),d=!0):d=!1,d||va(l)}function Pl(l){for(Di=l.return;Di;)switch(Di.tag){case 3:case 27:return void(zs=!0);case 5:case 13:return void(zs=!1);default:Di=Di.return}}function Wn(l){if(l!==Di)return!1;if(!Ln)return Pl(l),Ln=!0,!1;var d,m=!1;if((d=l.tag!==3&&l.tag!==27)&&((d=l.tag===5)&&(d=!((d=l.type)!=="form"&&d!=="button")||dc(l.type,l.memoizedProps)),d=!d),d&&(m=!0),m&&Vr&&va(l),Pl(l),l.tag===13){if(!(l=(l=l.memoizedState)!==null?l.dehydrated:null))throw Error(s(317));e:{for(l=l.nextSibling,m=0;l;){if(l.nodeType===8)if((d=l.data)==="/$"){if(m===0){Vr=ea(l.nextSibling);break e}m--}else d!=="$"&&d!=="$!"&&d!=="$?"||m++;l=l.nextSibling}Vr=null}}else Vr=Di?ea(l.stateNode.nextSibling):null;return!0}function ws(){Vr=Di=null,Ln=!1}function qs(l){rn===null?rn=[l]:rn.push(l)}var As=Error(s(460)),xp=Error(s(474)),xh={then:function(){}};function uy(l){return(l=l.status)==="fulfilled"||l==="rejected"}function xn(){}function za(l,d,m){switch((m=l[m])===void 0?l.push(d):m!==d&&(d.then(xn,xn),d=m),d.status){case"fulfilled":return d.value;case"rejected":throw(l=d.reason)===As?Error(s(483)):l;default:if(typeof d.status=="string")d.then(xn,xn);else{if((l=yr)!==null&&100<l.shellSuspendCounter)throw Error(s(482));(l=d).status="pending",l.then(function(S){if(d.status==="pending"){var R=d;R.status="fulfilled",R.value=S}},function(S){if(d.status==="pending"){var R=d;R.status="rejected",R.reason=S}})}switch(d.status){case"fulfilled":return d.value;case"rejected":throw(l=d.reason)===As?Error(s(483)):l}throw rd=d,As}}var rd=null;function _n(){if(rd===null)throw Error(s(459));var l=rd;return rd=null,l}var cn=null,qa=0;function id(l){var d=qa;return qa+=1,cn===null&&(cn=[]),za(cn,l,d)}function sd(l,d){d=d.props.ref,l.ref=d!==void 0?d:null}function Po(l,d){throw d.$$typeof===f?Error(s(525)):(l=Object.prototype.toString.call(d),Error(s(31,l==="[object Object]"?"object with keys {"+Object.keys(d).join(", ")+"}":l)))}function cy(l){return(0,l.tt)(l.et)}function Ih(l){function d(Le,Te){if(l){var Ie=Le.deletions;Ie===null?(Le.deletions=[Te],Le.flags|=16):Ie.push(Te)}}function m(Le,Te){if(!l)return null;for(;Te!==null;)d(Le,Te),Te=Te.sibling;return null}function S(Le){for(var Te=new Map;Le!==null;)Le.key!==null?Te.set(Le.key,Le):Te.set(Le.index,Le),Le=Le.sibling;return Te}function R(Le,Te){return(Le=$o(Le,Te)).index=0,Le.sibling=null,Le}function P(Le,Te,Ie){return Le.index=Ie,l?(Ie=Le.alternate)!==null?(Ie=Ie.index)<Te?(Le.flags|=33554434,Te):Ie:(Le.flags|=33554434,Te):(Le.flags|=1048576,Te)}function V(Le){return l&&Le.alternate===null&&(Le.flags|=33554434),Le}function K(Le,Te,Ie,Je){return Te===null||Te.tag!==6?((Te=Td(Ie,Le.mode,Je)).return=Le,Te):((Te=R(Te,Ie)).return=Le,Te)}function ee(Le,Te,Ie,Je){var kt=Ie.type;return kt===y?Ne(Le,Te,Ie.props.children,Je,Ie.key):Te!==null&&(Te.elementType===kt||typeof kt=="object"&&kt!==null&&kt.$$typeof===Q&&cy(kt)===Te.type)?(sd(Te=R(Te,Ie.props),Ie),Te.return=Le,Te):(sd(Te=Ed(Ie.type,Ie.key,Ie.props,null,Le.mode,Je),Ie),Te.return=Le,Te)}function pe(Le,Te,Ie,Je){return Te===null||Te.tag!==4||Te.stateNode.containerInfo!==Ie.containerInfo||Te.stateNode.implementation!==Ie.implementation?((Te=dg(Ie,Le.mode,Je)).return=Le,Te):((Te=R(Te,Ie.children||[])).return=Le,Te)}function Ne(Le,Te,Ie,Je,kt){return Te===null||Te.tag!==7?((Te=jo(Ie,Le.mode,Je,kt)).return=Le,Te):((Te=R(Te,Ie)).return=Le,Te)}function qe(Le,Te,Ie){if(typeof Te=="string"&&Te!==""||typeof Te=="number"||typeof Te=="bigint")return(Te=Td(""+Te,Le.mode,Ie)).return=Le,Te;if(typeof Te=="object"&&Te!==null){switch(Te.$$typeof){case c:return sd(Ie=Ed(Te.type,Te.key,Te.props,null,Le.mode,Ie),Te),Ie.return=Le,Ie;case v:return(Te=dg(Te,Le.mode,Ie)).return=Le,Te;case Q:return qe(Le,Te=(0,Te.tt)(Te.et),Ie)}if(mt(Te)||ye(Te))return(Te=jo(Te,Le.mode,Ie,null)).return=Le,Te;if(typeof Te.then=="function")return qe(Le,id(Te),Ie);if(Te.$$typeof===M)return qe(Le,hd(Le,Te),Ie);Po(Le,Te)}return null}function Ue(Le,Te,Ie,Je){var kt=Te!==null?Te.key:null;if(typeof Ie=="string"&&Ie!==""||typeof Ie=="number"||typeof Ie=="bigint")return kt!==null?null:K(Le,Te,""+Ie,Je);if(typeof Ie=="object"&&Ie!==null){switch(Ie.$$typeof){case c:return Ie.key===kt?ee(Le,Te,Ie,Je):null;case v:return Ie.key===kt?pe(Le,Te,Ie,Je):null;case Q:return Ue(Le,Te,Ie=(kt=Ie.tt)(Ie.et),Je)}if(mt(Ie)||ye(Ie))return kt!==null?null:Ne(Le,Te,Ie,Je,null);if(typeof Ie.then=="function")return Ue(Le,Te,id(Ie),Je);if(Ie.$$typeof===M)return Ue(Le,Te,hd(Le,Ie),Je);Po(Le,Ie)}return null}function Ze(Le,Te,Ie,Je,kt){if(typeof Je=="string"&&Je!==""||typeof Je=="number"||typeof Je=="bigint")return K(Te,Le=Le.get(Ie)||null,""+Je,kt);if(typeof Je=="object"&&Je!==null){switch(Je.$$typeof){case c:return ee(Te,Le=Le.get(Je.key===null?Ie:Je.key)||null,Je,kt);case v:return pe(Te,Le=Le.get(Je.key===null?Ie:Je.key)||null,Je,kt);case Q:return Ze(Le,Te,Ie,Je=(0,Je.tt)(Je.et),kt)}if(mt(Je)||ye(Je))return Ne(Te,Le=Le.get(Ie)||null,Je,kt,null);if(typeof Je.then=="function")return Ze(Le,Te,Ie,id(Je),kt);if(Je.$$typeof===M)return Ze(Le,Te,Ie,hd(Te,Je),kt);Po(Te,Je)}return null}function Xe(Le,Te,Ie,Je){if(typeof Ie=="object"&&Ie!==null&&Ie.type===y&&Ie.key===null&&(Ie=Ie.props.children),typeof Ie=="object"&&Ie!==null){switch(Ie.$$typeof){case c:e:{for(var kt=Ie.key;Te!==null;){if(Te.key===kt){if((kt=Ie.type)===y){if(Te.tag===7){m(Le,Te.sibling),(Je=R(Te,Ie.props.children)).return=Le,Le=Je;break e}}else if(Te.elementType===kt||typeof kt=="object"&&kt!==null&&kt.$$typeof===Q&&cy(kt)===Te.type){m(Le,Te.sibling),sd(Je=R(Te,Ie.props),Ie),Je.return=Le,Le=Je;break e}m(Le,Te);break}d(Le,Te),Te=Te.sibling}Ie.type===y?((Je=jo(Ie.props.children,Le.mode,Je,Ie.key)).return=Le,Le=Je):(sd(Je=Ed(Ie.type,Ie.key,Ie.props,null,Le.mode,Je),Ie),Je.return=Le,Le=Je)}return V(Le);case v:e:{for(kt=Ie.key;Te!==null;){if(Te.key===kt){if(Te.tag===4&&Te.stateNode.containerInfo===Ie.containerInfo&&Te.stateNode.implementation===Ie.implementation){m(Le,Te.sibling),(Je=R(Te,Ie.children||[])).return=Le,Le=Je;break e}m(Le,Te);break}d(Le,Te),Te=Te.sibling}(Je=dg(Ie,Le.mode,Je)).return=Le,Le=Je}return V(Le);case Q:return Xe(Le,Te,Ie=(kt=Ie.tt)(Ie.et),Je)}if(mt(Ie))return function(St,zt,ut,Qn){for(var It=null,jt=null,ft=zt,Gt=zt=0,kn=null;ft!==null&&Gt<ut.length;Gt++){ft.index>Gt?(kn=ft,ft=null):kn=ft.sibling;var Ht=Ue(St,ft,ut[Gt],Qn);if(Ht===null){ft===null&&(ft=kn);break}l&&ft&&Ht.alternate===null&&d(St,ft),zt=P(Ht,zt,Gt),jt===null?It=Ht:jt.sibling=Ht,jt=Ht,ft=kn}if(Gt===ut.length)return m(St,ft),Ln&&Cl(St,Gt),It;if(ft===null){for(;Gt<ut.length;Gt++)(ft=qe(St,ut[Gt],Qn))!==null&&(zt=P(ft,zt,Gt),jt===null?It=ft:jt.sibling=ft,jt=ft);return Ln&&Cl(St,Gt),It}for(ft=S(ft);Gt<ut.length;Gt++)(kn=Ze(ft,St,Gt,ut[Gt],Qn))!==null&&(l&&kn.alternate!==null&&ft.delete(kn.key===null?Gt:kn.key),zt=P(kn,zt,Gt),jt===null?It=kn:jt.sibling=kn,jt=kn);return l&&ft.forEach(function(Ar){return d(St,Ar)}),Ln&&Cl(St,Gt),It}(Le,Te,Ie,Je);if(ye(Ie)){if(typeof(kt=ye(Ie))!="function")throw Error(s(150));return function(St,zt,ut,Qn){if(ut==null)throw Error(s(151));for(var It=null,jt=null,ft=zt,Gt=zt=0,kn=null,Ht=ut.next();ft!==null&&!Ht.done;Gt++,Ht=ut.next()){ft.index>Gt?(kn=ft,ft=null):kn=ft.sibling;var Ar=Ue(St,ft,Ht.value,Qn);if(Ar===null){ft===null&&(ft=kn);break}l&&ft&&Ar.alternate===null&&d(St,ft),zt=P(Ar,zt,Gt),jt===null?It=Ar:jt.sibling=Ar,jt=Ar,ft=kn}if(Ht.done)return m(St,ft),Ln&&Cl(St,Gt),It;if(ft===null){for(;!Ht.done;Gt++,Ht=ut.next())(Ht=qe(St,Ht.value,Qn))!==null&&(zt=P(Ht,zt,Gt),jt===null?It=Ht:jt.sibling=Ht,jt=Ht);return Ln&&Cl(St,Gt),It}for(ft=S(ft);!Ht.done;Gt++,Ht=ut.next())(Ht=Ze(ft,St,Gt,Ht.value,Qn))!==null&&(l&&Ht.alternate!==null&&ft.delete(Ht.key===null?Gt:Ht.key),zt=P(Ht,zt,Gt),jt===null?It=Ht:jt.sibling=Ht,jt=Ht);return l&&ft.forEach(function(ji){return d(St,ji)}),Ln&&Cl(St,Gt),It}(Le,Te,Ie=kt.call(Ie),Je)}if(typeof Ie.then=="function")return Xe(Le,Te,id(Ie),Je);if(Ie.$$typeof===M)return Xe(Le,Te,hd(Le,Ie),Je);Po(Le,Ie)}return typeof Ie=="string"&&Ie!==""||typeof Ie=="number"||typeof Ie=="bigint"?(Ie=""+Ie,Te!==null&&Te.tag===6?(m(Le,Te.sibling),(Je=R(Te,Ie)).return=Le,Le=Je):(m(Le,Te),(Je=Td(Ie,Le.mode,Je)).return=Le,Le=Je),V(Le)):m(Le,Te)}return function(Le,Te,Ie,Je){try{qa=0;var kt=Xe(Le,Te,Ie,Je);return cn=null,kt}catch(zt){if(zt===As)throw zt;var St=Ls(29,zt,null,Le.mode);return St.lanes=Je,St.return=Le,St}}}var Ws=Ih(!0),n1=Ih(!1),Pu=We(null),Kr=We(0);function dy(l,d){gn(Kr,l=Aa),gn(Pu,d),Aa=l|d.baseLanes}function Mo(){gn(Kr,Aa),gn(Pu,Pu.current)}function ns(){Aa=Kr.current,Ot(Pu),Ot(Kr)}var oi=We(null),rs=null;function $n(l){var d=l.alternate;gn(dr,1&dr.current),gn(oi,l),rs===null&&(d===null||Pu.current!==null||d.memoizedState!==null)&&(rs=l)}function hy(l){if(l.tag===22){if(gn(dr,dr.current),gn(oi,l),rs===null){var d=l.alternate;d!==null&&d.memoizedState!==null&&(rs=l)}}else ba()}function ba(){gn(dr,dr.current),gn(oi,oi.current)}function zr(l){Ot(oi),rs===l&&(rs=null),Ot(dr)}var dr=We(0);function jn(l){for(var d=l;d!==null;){if(d.tag===13){var m=d.memoizedState;if(m!==null&&((m=m.dehydrated)===null||m.data==="$?"||m.data==="$!"))return d}else if(d.tag===19&&d.memoizedProps.revealOrder!==void 0){if(128&d.flags)return d}else if(d.child!==null){d.child.return=d,d=d.child;continue}if(d===l)break;for(;d.sibling===null;){if(d.return===null||d.return===l)return null;d=d.return}d.sibling.return=d.return,d=d.sibling}return null}var r1=typeof AbortController<"u"?AbortController:function(){var l=[],d=this.signal={aborted:!1,addEventListener:function(m,S){l.push(S)}};this.abort=function(){d.aborted=!0,l.forEach(function(m){return m()})}},Mu=a.unstable_scheduleCallback,Wa=a.unstable_NormalPriority,Tr={$$typeof:M,Consumer:null,Provider:null,ut:null,lt:null,ct:0};function Lh(){return{controller:new r1,data:new Map,refCount:0}}function Vt(l){l.refCount--,l.refCount===0&&Mu(Wa,function(){l.controller.abort()})}var ad=null,Ea=0,Ya=0,Qa=null;function Xa(){if(--Ea==0&&ad!==null){Qa!==null&&(Qa.status="fulfilled");var l=ad;ad=null,Ya=0,Qa=null;for(var d=0;d<l.length;d++)(0,l[d])()}}var vi=ce.S;ce.S=function(l,d){typeof d=="object"&&d!==null&&typeof d.then=="function"&&function(m,S){if(ad===null){var R=ad=[];Ea=0,Ya=ql(),Qa={status:"pending",value:void 0,then:function(P){R.push(P)}}}Ea++,S.then(Xa,Xa)}(0,d),vi!==null&&vi(l,d)};var Ja=We(null);function Rh(){var l=Ja.current;return l!==null?l:yr.pooledCache}function Ip(l,d){gn(Ja,d===null?Ja.current:d.pool)}function Ou(){var l=Rh();return l===null?null:{parent:Tr.ut,pool:l}}var Za=0,Tn=null,ur=null,Ur=null,Ch=!1,Nu=!1,Ml=!1,Ol=0,od=0,_u=null,i1=0;function Cr(){throw Error(s(321))}function Lp(l,d){if(d===null)return!1;for(var m=0;m<d.length&&m<l.length;m++)if(!es(l[m],d[m]))return!1;return!0}function Rp(l,d,m,S,R,P){return Za=P,Tn=d,d.memoizedState=null,d.updateQueue=null,d.lanes=0,ce.H=l===null||l.memoizedState===null?ju:Fl,Ml=!1,P=m(S,R),Ml=!1,Nu&&(P=fy(d,m,S,R)),Cp(l),P}function Cp(l){ce.H=to;var d=ur!==null&&ur.next!==null;if(Za=0,Ur=ur=Tn=null,Ch=!1,od=0,_u=null,d)throw Error(s(300));l===null||Sn||(l=l.dependencies)!==null&&Gh(l)&&(Sn=!0)}function fy(l,d,m,S){Tn=l;var R=0;do{if(Nu&&(_u=null),od=0,Nu=!1,25<=R)throw Error(s(301));if(R+=1,Ur=ur=null,l.updateQueue!=null){var P=l.updateQueue;P.lastEffect=null,P.events=null,P.stores=null,P.memoCache!=null&&(P.memoCache.index=0)}ce.H=Gu,P=d(m,S)}while(Nu);return P}function s1(){var l=ce.H,d=l.useState()[0];return d=typeof d.then=="function"?Ph(d):d,l=l.useState()[0],(ur!==null?ur.memoizedState:null)!==l&&(Tn.flags|=1024),d}function Dp(){var l=Ol!==0;return Ol=0,l}function Dh(l,d,m){d.updateQueue=l.updateQueue,d.flags&=-2053,l.lanes&=~m}function Pp(l){if(Ch){for(l=l.memoizedState;l!==null;){var d=l.queue;d!==null&&(d.pending=null),l=l.next}Ch=!1}Za=0,Ur=ur=Tn=null,Nu=!1,od=Ol=0,_u=null}function li(){var l={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ur===null?Tn.memoizedState=Ur=l:Ur=Ur.next=l,Ur}function Br(){if(ur===null){var l=Tn.alternate;l=l!==null?l.memoizedState:null}else l=ur.next;var d=Ur===null?Tn.memoizedState:Ur.next;if(d!==null)Ur=d,ur=l;else{if(l===null)throw Tn.alternate===null?Error(s(467)):Error(s(310));l={memoizedState:(ur=l).memoizedState,baseState:ur.baseState,baseQueue:ur.baseQueue,queue:ur.queue,next:null},Ur===null?Tn.memoizedState=Ur=l:Ur=Ur.next=l}return Ur}function Ph(l){var d=od;return od+=1,_u===null&&(_u=[]),l=za(_u,l,d),d=Tn,(Ur===null?d.memoizedState:Ur.next)===null&&(d=d.alternate,ce.H=d===null||d.memoizedState===null?ju:Fl),l}function Mp(l){if(l!==null&&typeof l=="object"){if(typeof l.then=="function")return Ph(l);if(l.$$typeof===M)return Qr(l)}throw Error(s(438,String(l)))}function py(l){var d=null,m=Tn.updateQueue;if(m!==null&&(d=m.memoCache),d==null){var S=Tn.alternate;S!==null&&(S=S.updateQueue)!==null&&(S=S.memoCache)!=null&&(d={data:S.data.map(function(R){return R.slice()}),index:0})}if(d==null&&(d={data:[],index:0}),m===null&&(m={lastEffect:null,events:null,stores:null,memoCache:null},Tn.updateQueue=m),m.memoCache=d,(m=d.data[d.index])===void 0)for(m=d.data[d.index]=Array(l),S=0;S<l;S++)m[S]=ie;return d.index++,m}function Oo(l,d){return typeof d=="function"?d(l):d}function Fu(l){return Uu(Br(),ur,l)}function Uu(l,d,m){var S=l.queue;if(S===null)throw Error(s(311));S.lastRenderedReducer=m;var R=l.baseQueue,P=S.pending;if(P!==null){if(R!==null){var V=R.next;R.next=P.next,P.next=V}d.baseQueue=R=P,S.pending=null}if(P=l.baseState,R===null)l.memoizedState=P;else{var K=V=null,ee=null,pe=d=R.next,Ne=!1;do{var qe=-536870913&pe.lane;if(qe!==pe.lane?(Fn&qe)===qe:(Za&qe)===qe){var Ue=pe.revertLane;if(Ue===0)ee!==null&&(ee=ee.next={lane:0,revertLane:0,action:pe.action,hasEagerState:pe.hasEagerState,eagerState:pe.eagerState,next:null}),qe===Ya&&(Ne=!0);else{if((Za&Ue)===Ue){pe=pe.next,Ue===Ya&&(Ne=!0);continue}qe={lane:0,revertLane:pe.revertLane,action:pe.action,hasEagerState:pe.hasEagerState,eagerState:pe.eagerState,next:null},ee===null?(K=ee=qe,V=P):ee=ee.next=qe,Tn.lanes|=Ue,Ho|=Ue}qe=pe.action,Ml&&m(P,qe),P=pe.hasEagerState?pe.eagerState:m(P,qe)}else Ue={lane:qe,revertLane:pe.revertLane,action:pe.action,hasEagerState:pe.hasEagerState,eagerState:pe.eagerState,next:null},ee===null?(K=ee=Ue,V=P):ee=ee.next=Ue,Tn.lanes|=qe,Ho|=qe;pe=pe.next}while(pe!==null&&pe!==d);if(ee===null?V=P:ee.next=K,!es(P,l.memoizedState)&&(Sn=!0,Ne&&(m=Qa)!==null))throw m;l.memoizedState=P,l.baseState=V,l.baseQueue=ee,S.lastRenderedState=P}return R===null&&(S.lanes=0),[l.memoizedState,S.dispatch]}function Op(l){var d=Br(),m=d.queue;if(m===null)throw Error(s(311));m.lastRenderedReducer=l;var S=m.dispatch,R=m.pending,P=d.memoizedState;if(R!==null){m.pending=null;var V=R=R.next;do P=l(P,V.action),V=V.next;while(V!==R);es(P,d.memoizedState)||(Sn=!0),d.memoizedState=P,d.baseQueue===null&&(d.baseState=P),m.lastRenderedState=P}return[P,S]}function ks(l,d,m){var S=Tn,R=Br(),P=Ln;if(P){if(m===void 0)throw Error(s(407));m=m()}else m=d();var V=!es((ur||R).memoizedState,m);if(V&&(R.memoizedState=m,Sn=!0),R=R.queue,$p(o1.bind(null,S,R,l),[l]),R.getSnapshot!==d||V||Ur!==null&&1&Ur.memoizedState.tag){if(S.flags|=2048,Ta(9,gy.bind(null,S,R,m,d),{destroy:void 0},null),yr===null)throw Error(s(349));P||60&Za||a1(S,d,m)}return m}function a1(l,d,m){l.flags|=16384,l={getSnapshot:d,value:m},(d=Tn.updateQueue)===null?(d={lastEffect:null,events:null,stores:null,memoCache:null},Tn.updateQueue=d,d.stores=[l]):(m=d.stores)===null?d.stores=[l]:m.push(l)}function gy(l,d,m,S){d.value=m,d.getSnapshot=S,is(d)&&my(l)}function o1(l,d,m){return m(function(){is(d)&&my(l)})}function is(l){var d=l.getSnapshot;l=l.value;try{var m=d();return!es(l,m)}catch{return!0}}function my(l){var d=ts(l,2);d!==null&&di(d,l,2)}function wt(l){var d=li();if(typeof l=="function"){var m=l;if(l=m(),Ml){Nr(!0);try{m()}finally{Nr(!1)}}}return d.memoizedState=d.baseState=l,d.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oo,lastRenderedState:l},d}function yy(l,d,m,S){return l.baseState=m,Uu(l,ur,typeof S=="function"?S:Oo)}function Nl(l,d,m,S,R){if(Mh(l))throw Error(s(485));if((l=d.action)!==null){var P={payload:R,action:l,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(V){P.listeners.push(V)}};ce.T!==null?m(!0):P.isTransition=!1,S(P),(m=d.pending)===null?(P.next=d.pending=P,vy(d,P)):(P.next=m.next,d.pending=m.next=P)}}function vy(l,d){var m=d.action,S=d.payload,R=l.state;if(d.isTransition){var P=ce.T,V={};ce.T=V;try{var K=m(R,S),ee=ce.S;ee!==null&&ee(V,K),Np(l,d,K)}catch(pe){Fp(l,d,pe)}finally{ce.T=P}}else try{Np(l,d,P=m(R,S))}catch(pe){Fp(l,d,pe)}}function Np(l,d,m){m!==null&&typeof m=="object"&&typeof m.then=="function"?m.then(function(S){_p(l,d,S)},function(S){return Fp(l,d,S)}):_p(l,d,m)}function _p(l,d,m){d.status="fulfilled",d.value=m,No(d),l.state=m,(d=l.pending)!==null&&((m=d.next)===d?l.pending=null:(m=m.next,d.next=m,vy(l,m)))}function Fp(l,d,m){var S=l.pending;if(l.pending=null,S!==null){S=S.next;do d.status="rejected",d.reason=m,No(d),d=d.next;while(d!==S)}l.action=null}function No(l){l=l.listeners;for(var d=0;d<l.length;d++)(0,l[d])()}function Up(l,d){return d}function by(l,d){if(Ln){var m=yr.formState;if(m!==null){e:{var S=Tn;if(Ln){if(Vr){t:{for(var R=Vr,P=zs;R.nodeType!==8;){if(!P){R=null;break t}if((R=ea(R.nextSibling))===null){R=null;break t}}R=(P=R.data)==="F!"||P==="F"?R:null}if(R){Vr=ea(R.nextSibling),S=R.data==="F!";break e}}va(S)}S=!1}S&&(d=m[0])}}return(m=li()).memoizedState=m.baseState=d,S={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Up,lastRenderedState:d},m.queue=S,m=u1.bind(null,Tn,S),S.dispatch=m,S=wt(!1),P=Kp.bind(null,Tn,!1,S.queue),R={state:d,dispatch:null,action:l,pending:null},(S=li()).queue=R,m=Nl.bind(null,Tn,R,P,m),R.dispatch=m,S.memoizedState=l,[d,m,!1]}function Ey(l){return Bp(Br(),ur,l)}function Bp(l,d,m){d=Uu(l,d,Up)[0],l=Fu(Oo)[0],d=typeof d=="object"&&d!==null&&typeof d.then=="function"?Ph(d):d;var S=Br(),R=S.queue,P=R.dispatch;return m!==S.memoizedState&&(Tn.flags|=2048,Ta(9,YT.bind(null,R,m),{destroy:void 0},null)),[d,P,l]}function YT(l,d){l.action=d}function _l(l){var d=Br(),m=ur;if(m!==null)return Bp(d,m,l);Br(),d=d.memoizedState;var S=(m=Br()).queue.dispatch;return m.memoizedState=l,[d,S,!1]}function Ta(l,d,m,S){return l={tag:l,create:d,inst:m,deps:S,next:null},(d=Tn.updateQueue)===null&&(d={lastEffect:null,events:null,stores:null,memoCache:null},Tn.updateQueue=d),(m=d.lastEffect)===null?d.lastEffect=l.next=l:(S=m.next,m.next=l,l.next=S,d.lastEffect=l),l}function Ty(){return Br().memoizedState}function ld(l,d,m,S){var R=li();Tn.flags|=l,R.memoizedState=Ta(1|d,m,{destroy:void 0},S===void 0?null:S)}function Bu(l,d,m,S){var R=Br();S=S===void 0?null:S;var P=R.memoizedState.inst;ur!==null&&S!==null&&Lp(S,ur.memoizedState.deps)?R.memoizedState=Ta(d,m,P,S):(Tn.flags|=l,R.memoizedState=Ta(1|d,m,P,S))}function Sy(l,d){ld(8390656,8,l,d)}function $p(l,d){Bu(2048,8,l,d)}function wy(l,d){return Bu(4,2,l,d)}function Ay(l,d){return Bu(4,4,l,d)}function eo(l,d){if(typeof d=="function"){l=l();var m=d(l);return function(){typeof m=="function"?m():d(null)}}if(d!=null)return l=l(),d.current=l,function(){d.current=null}}function jp(l,d,m){m=m!=null?m.concat([l]):null,Bu(4,4,eo.bind(null,d,l),m)}function bi(){}function Ut(l,d){var m=Br();d=d===void 0?null:d;var S=m.memoizedState;return d!==null&&Lp(d,S[1])?S[0]:(m.memoizedState=[l,d],l)}function Gp(l,d){var m=Br();d=d===void 0?null:d;var S=m.memoizedState;if(d!==null&&Lp(d,S[1]))return S[0];if(S=l(),Ml){Nr(!0);try{l()}finally{Nr(!1)}}return m.memoizedState=[S,d],S}function ui(l,d,m){return m===void 0||1073741824&Za?l.memoizedState=d:(l.memoizedState=m,l=Ky(),Tn.lanes|=l,Ho|=l,m)}function tt(l,d,m,S){return es(m,d)?m:Pu.current!==null?(l=ui(l,m,S),es(l,d)||(Sn=!0),l):42&Za?(l=Ky(),Tn.lanes|=l,Ho|=l,d):(Sn=!0,l.memoizedState=m)}function $u(l,d,m,S,R){var P=ot.p;ot.p=P!==0&&8>P?P:8;var V,K,ee,pe=ce.T,Ne={};ce.T=Ne,Kp(l,!1,d,m);try{var qe=R(),Ue=ce.S;if(Ue!==null&&Ue(Ne,qe),qe!==null&&typeof qe=="object"&&typeof qe.then=="function"){var Ze=(V=S,K=[],ee={status:"pending",value:null,reason:null,then:function(Xe){K.push(Xe)}},qe.then(function(){ee.status="fulfilled",ee.value=V;for(var Xe=0;Xe<K.length;Xe++)(0,K[Xe])(V)},function(Xe){for(ee.status="rejected",ee.reason=Xe,Xe=0;Xe<K.length;Xe++)(0,K[Xe])(void 0)}),ee);_o(l,d,Ze,Mi())}else _o(l,d,S,Mi())}catch(Xe){_o(l,d,{then:function(){},status:"rejected",reason:Xe},Mi())}finally{ot.p=P,ce.T=pe}}function ht(){}function sn(l,d,m,S){if(l.tag!==5)throw Error(s(476));var R=ky(l).queue;$u(l,R,d,lt,m===null?ht:function(){return l1(l),m(S)})}function ky(l){var d=l.memoizedState;if(d!==null)return d;var m={};return(d={memoizedState:lt,baseState:lt,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oo,lastRenderedState:lt},next:null}).next={memoizedState:m,baseState:m,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oo,lastRenderedState:m},next:null},l.memoizedState=d,(l=l.alternate)!==null&&(l.memoizedState=d),d}function l1(l){_o(l,ky(l).next.queue,{},Mi())}function Mn(){return Qr(Dd)}function Hp(){return Br().memoizedState}function xy(){return Br().memoizedState}function Vp(l){for(var d=l.return;d!==null;){switch(d.tag){case 24:case 3:var m=Mi(),S=Hl(d,l=Ys(m),m);return S!==null&&(di(S,d,m),Wu(S,d,m)),d={cache:Lh()},void(l.payload=d)}d=d.return}}function Iy(l,d,m){var S=Mi();m={lane:S,revertLane:0,action:m,hasEagerState:!1,eagerState:null,next:null},Mh(l)?c1(d,m):(m=or(l,d,m,S))!==null&&(di(m,l,S),d1(m,d,S))}function u1(l,d,m){_o(l,d,m,Mi())}function _o(l,d,m,S){var R={lane:S,revertLane:0,action:m,hasEagerState:!1,eagerState:null,next:null};if(Mh(l))c1(d,R);else{var P=l.alternate;if(l.lanes===0&&(P===null||P.lanes===0)&&(P=d.lastRenderedReducer)!==null)try{var V=d.lastRenderedState,K=P(V,m);if(R.hasEagerState=!0,R.eagerState=K,es(K,V))return Pn(l,d,R,0),yr===null&&kh(),!1}catch{}if((m=or(l,d,R,S))!==null)return di(m,l,S),d1(m,d,S),!0}return!1}function Kp(l,d,m,S){if(S={lane:2,revertLane:ql(),action:S,hasEagerState:!1,eagerState:null,next:null},Mh(l)){if(d)throw Error(s(479))}else(d=or(l,m,S,2))!==null&&di(d,l,2)}function Mh(l){var d=l.alternate;return l===Tn||d!==null&&d===Tn}function c1(l,d){Nu=Ch=!0;var m=l.pending;m===null?d.next=d:(d.next=m.next,m.next=d),l.pending=d}function d1(l,d,m){if(4194176&m){var S=d.lanes;m|=S&=l.pendingLanes,d.lanes=m,hp(l,m)}}var to={readContext:Qr,use:Mp,useCallback:Cr,useContext:Cr,useEffect:Cr,useImperativeHandle:Cr,useLayoutEffect:Cr,useInsertionEffect:Cr,useMemo:Cr,useReducer:Cr,useRef:Cr,useState:Cr,useDebugValue:Cr,useDeferredValue:Cr,useTransition:Cr,useSyncExternalStore:Cr,useId:Cr};to.useCacheRefresh=Cr,to.useMemoCache=Cr,to.useHostTransitionStatus=Cr,to.useFormState=Cr,to.useActionState=Cr,to.useOptimistic=Cr;var ju={readContext:Qr,use:Mp,useCallback:function(l,d){return li().memoizedState=[l,d===void 0?null:d],l},useContext:Qr,useEffect:Sy,useImperativeHandle:function(l,d,m){m=m!=null?m.concat([l]):null,ld(4194308,4,eo.bind(null,d,l),m)},useLayoutEffect:function(l,d){return ld(4194308,4,l,d)},useInsertionEffect:function(l,d){ld(4,2,l,d)},useMemo:function(l,d){var m=li();d=d===void 0?null:d;var S=l();if(Ml){Nr(!0);try{l()}finally{Nr(!1)}}return m.memoizedState=[S,d],S},useReducer:function(l,d,m){var S=li();if(m!==void 0){var R=m(d);if(Ml){Nr(!0);try{m(d)}finally{Nr(!1)}}}else R=d;return S.memoizedState=S.baseState=R,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:l,lastRenderedState:R},S.queue=l,l=l.dispatch=Iy.bind(null,Tn,l),[S.memoizedState,l]},useRef:function(l){return l={current:l},li().memoizedState=l},useState:function(l){var d=(l=wt(l)).queue,m=u1.bind(null,Tn,d);return d.dispatch=m,[l.memoizedState,m]},useDebugValue:bi,useDeferredValue:function(l,d){return ui(li(),l,d)},useTransition:function(){var l=wt(!1);return l=$u.bind(null,Tn,l.queue,!0,!1),li().memoizedState=l,[!1,l]},useSyncExternalStore:function(l,d,m){var S=Tn,R=li();if(Ln){if(m===void 0)throw Error(s(407));m=m()}else{if(m=d(),yr===null)throw Error(s(349));60&Fn||a1(S,d,m)}R.memoizedState=m;var P={value:m,getSnapshot:d};return R.queue=P,Sy(o1.bind(null,S,P,l),[l]),S.flags|=2048,Ta(9,gy.bind(null,S,P,m,d),{destroy:void 0},null),m},useId:function(){var l=li(),d=yr.identifierPrefix;if(Ln){var m=Ka;d=":"+d+"R"+(m=(lr&~(1<<32-Fi(lr)-1)).toString(32)+m),0<(m=Ol++)&&(d+="H"+m.toString(32)),d+=":"}else d=":"+d+"r"+(m=i1++).toString(32)+":";return l.memoizedState=d},useCacheRefresh:function(){return li().memoizedState=Vp.bind(null,Tn)}};ju.useMemoCache=py,ju.useHostTransitionStatus=Mn,ju.useFormState=by,ju.useActionState=by,ju.useOptimistic=function(l){var d=li();d.memoizedState=d.baseState=l;var m={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return d.queue=m,d=Kp.bind(null,Tn,!0,m),m.dispatch=d,[l,d]};var Fl={readContext:Qr,use:Mp,useCallback:Ut,useContext:Qr,useEffect:$p,useImperativeHandle:jp,useInsertionEffect:wy,useLayoutEffect:Ay,useMemo:Gp,useReducer:Fu,useRef:Ty,useState:function(){return Fu(Oo)},useDebugValue:bi,useDeferredValue:function(l,d){return tt(Br(),ur.memoizedState,l,d)},useTransition:function(){var l=Fu(Oo)[0],d=Br().memoizedState;return[typeof l=="boolean"?l:Ph(l),d]},useSyncExternalStore:ks,useId:Hp};Fl.useCacheRefresh=xy,Fl.useMemoCache=py,Fl.useHostTransitionStatus=Mn,Fl.useFormState=Ey,Fl.useActionState=Ey,Fl.useOptimistic=function(l,d){return yy(Br(),0,l,d)};var Gu={readContext:Qr,use:Mp,useCallback:Ut,useContext:Qr,useEffect:$p,useImperativeHandle:jp,useInsertionEffect:wy,useLayoutEffect:Ay,useMemo:Gp,useReducer:Op,useRef:Ty,useState:function(){return Op(Oo)},useDebugValue:bi,useDeferredValue:function(l,d){var m=Br();return ur===null?ui(m,l,d):tt(m,ur.memoizedState,l,d)},useTransition:function(){var l=Op(Oo)[0],d=Br().memoizedState;return[typeof l=="boolean"?l:Ph(l),d]},useSyncExternalStore:ks,useId:Hp};function zp(l,d,m,S){m=(m=m(S,d=l.memoizedState))==null?d:we({},d,m),l.memoizedState=m,l.lanes===0&&(l.updateQueue.baseState=m)}Gu.useCacheRefresh=xy,Gu.useMemoCache=py,Gu.useHostTransitionStatus=Mn,Gu.useFormState=_l,Gu.useActionState=_l,Gu.useOptimistic=function(l,d){var m=Br();return ur!==null?yy(m,0,l,d):(m.baseState=l,[l,m.queue.dispatch])};var qp={isMounted:function(l){return!!(l=l.wt)&&de(l)===l},enqueueSetState:function(l,d,m){l=l.wt;var S=Mi(),R=Ys(S);R.payload=d,m!=null&&(R.callback=m),(d=Hl(l,R,S))!==null&&(di(d,l,S),Wu(d,l,S))},enqueueReplaceState:function(l,d,m){l=l.wt;var S=Mi(),R=Ys(S);R.tag=1,R.payload=d,m!=null&&(R.callback=m),(d=Hl(l,R,S))!==null&&(di(d,l,S),Wu(d,l,S))},enqueueForceUpdate:function(l,d){l=l.wt;var m=Mi(),S=Ys(m);S.tag=2,d!=null&&(S.callback=d),(d=Hl(l,S,m))!==null&&(di(d,l,m),Wu(d,l,m))}};function Oh(l,d,m,S,R,P,V){return typeof(l=l.stateNode).shouldComponentUpdate=="function"?l.shouldComponentUpdate(S,P,V):!d.prototype||!d.prototype.isPureReactComponent||!Iu(m,S)||!Iu(R,P)}function Nh(l,d,m,S){l=d.state,typeof d.componentWillReceiveProps=="function"&&d.componentWillReceiveProps(m,S),typeof d.UNSAFE_componentWillReceiveProps=="function"&&d.UNSAFE_componentWillReceiveProps(m,S),d.state!==l&&qp.enqueueReplaceState(d,d.state,null)}function Ul(l,d){var m=d;if("ref"in d)for(var S in m={},d)S!=="ref"&&(m[S]=d[S]);if(l=l.defaultProps)for(var R in m===d&&(m=we({},m)),l)m[R]===void 0&&(m[R]=l[R]);return m}var ud=typeof reportError=="function"?reportError:function(l){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var d=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof l=="object"&&l!==null&&typeof l.message=="string"?String(l.message):String(l),error:l});if(!window.dispatchEvent(d))return}else if(typeof process=="object"&&typeof process.emit=="function")return void process.emit("uncaughtException",l)};function _h(l){ud(l)}function Hu(l){}function Fh(l){ud(l)}function Uh(l,d){try{(0,l.onUncaughtError)(d.value,{componentStack:d.stack})}catch(m){setTimeout(function(){throw m})}}function h1(l,d,m){try{(0,l.onCaughtError)(m.value,{componentStack:m.stack,errorBoundary:d.tag===1?d.stateNode:null})}catch(S){setTimeout(function(){throw S})}}function cd(l,d,m){return(m=Ys(m)).tag=3,m.payload={element:null},m.callback=function(){Uh(l,d)},m}function Vu(l){return(l=Ys(l)).tag=3,l}function Ku(l,d,m,S){var R=m.type.getDerivedStateFromError;if(typeof R=="function"){var P=S.value;l.payload=function(){return R(P)},l.callback=function(){h1(d,m,S)}}var V=m.stateNode;V!==null&&typeof V.componentDidCatch=="function"&&(l.callback=function(){h1(d,m,S),typeof R!="function"&&(oo===null?oo=new Set([this]):oo.add(this));var K=S.stack;this.componentDidCatch(S.value,{componentStack:K!==null?K:""})})}var no=Error(s(461)),Sn=!1;function ci(l,d,m,S){d.child=l===null?n1(d,null,m,S):Ws(d,l.child,m,S)}function Wp(l,d,m,S,R){m=m.render;var P=d.ref;if("ref"in S){var V={};for(var K in S)K!=="ref"&&(V[K]=S[K])}else V=S;return jl(d),S=Rp(l,d,m,V,P,R),K=Dp(),l===null||Sn?(Ln&&K&&nd(d),d.flags|=1,ci(l,d,S,R),d.child):(Dh(l,d,R),ro(l,d,R))}function Ly(l,d,m,S,R){if(l===null){var P=m.type;return typeof P!="function"||ug(P)||P.defaultProps!==void 0||m.compare!==null?((l=Ed(m.type,null,S,d,d.mode,R)).ref=d.ref,l.return=d,d.child=l):(d.tag=15,d.type=P,Ry(l,d,P,S,R))}if(P=l.child,!eg(l,R)){var V=P.memoizedProps;if((m=(m=m.compare)!==null?m:Iu)(V,S)&&l.ref===d.ref)return ro(l,d,R)}return d.flags|=1,(l=$o(P,S)).ref=d.ref,l.return=d,d.child=l}function Ry(l,d,m,S,R){if(l!==null){var P=l.memoizedProps;if(Iu(P,S)&&l.ref===d.ref){if(Sn=!1,d.pendingProps=S=P,!eg(l,R))return d.lanes=l.lanes,ro(l,d,R);131072&l.flags&&(Sn=!0)}}return Yp(l,d,m,S,R)}function Bh(l,d,m){var S=d.pendingProps,R=S.children,P=!!(2&d.stateNode.bt),V=l!==null?l.memoizedState:null;if(Tt(l,d),S.mode==="hidden"||P){if(128&d.flags){if(S=V!==null?V.baseLanes|m:m,l!==null){for(R=d.child=l.child,P=0;R!==null;)P=P|R.lanes|R.childLanes,R=R.sibling;d.childLanes=P&~S}else d.childLanes=0,d.child=null;return f1(l,d,S,m)}if(!(536870912&m))return d.lanes=d.childLanes=536870912,f1(l,d,V!==null?V.baseLanes|m:m,m);d.memoizedState={baseLanes:0,cachePool:null},l!==null&&Ip(0,V!==null?V.cachePool:null),V!==null?dy(d,V):Mo(),hy(d)}else V!==null?(Ip(0,V.cachePool),dy(d,V),ba(),d.memoizedState=null):(l!==null&&Ip(0,null),Mo(),ba());return ci(l,d,R,m),d.child}function f1(l,d,m,S){var R=Rh();return R=R===null?null:{parent:Tr.ut,pool:R},d.memoizedState={baseLanes:m,cachePool:R},l!==null&&Ip(0,null),Mo(),hy(d),l!==null&&dd(l,d,S,!0),null}function Tt(l,d){var m=d.ref;if(m===null)l!==null&&l.ref!==null&&(d.flags|=2097664);else{if(typeof m!="function"&&typeof m!="object")throw Error(s(284));l!==null&&l.ref===m||(d.flags|=2097664)}}function Yp(l,d,m,S,R){return jl(d),m=Rp(l,d,m,S,void 0,R),S=Dp(),l===null||Sn?(Ln&&S&&nd(d),d.flags|=1,ci(l,d,m,R),d.child):(Dh(l,d,R),ro(l,d,R))}function p1(l,d,m,S,R,P){return jl(d),d.updateQueue=null,m=fy(d,S,m,R),Cp(l),S=Dp(),l===null||Sn?(Ln&&S&&nd(d),d.flags|=1,ci(l,d,m,P),d.child):(Dh(l,d,P),ro(l,d,P))}function Cy(l,d,m,S,R){if(jl(d),d.stateNode===null){var P=Cu,V=m.contextType;typeof V=="object"&&V!==null&&(P=Qr(V)),P=new m(S,P),d.memoizedState=P.state!==null&&P.state!==void 0?P.state:null,P.updater=qp,d.stateNode=P,P.wt=d,(P=d.stateNode).props=S,P.state=d.memoizedState,P.refs={},qu(d),V=m.contextType,P.context=typeof V=="object"&&V!==null?Qr(V):Cu,P.state=d.memoizedState,typeof(V=m.getDerivedStateFromProps)=="function"&&(zp(d,m,V,S),P.state=d.memoizedState),typeof m.getDerivedStateFromProps=="function"||typeof P.getSnapshotBeforeUpdate=="function"||typeof P.UNSAFE_componentWillMount!="function"&&typeof P.componentWillMount!="function"||(V=P.state,typeof P.componentWillMount=="function"&&P.componentWillMount(),typeof P.UNSAFE_componentWillMount=="function"&&P.UNSAFE_componentWillMount(),V!==P.state&&qp.enqueueReplaceState(P,P.state,null),fd(d,S,P,R),Yu(),P.state=d.memoizedState),typeof P.componentDidMount=="function"&&(d.flags|=4194308),S=!0}else if(l===null){P=d.stateNode;var K=d.memoizedProps,ee=Ul(m,K);P.props=ee;var pe=P.context,Ne=m.contextType;V=Cu,typeof Ne=="object"&&Ne!==null&&(V=Qr(Ne));var qe=m.getDerivedStateFromProps;Ne=typeof qe=="function"||typeof P.getSnapshotBeforeUpdate=="function",K=d.pendingProps!==K,Ne||typeof P.UNSAFE_componentWillReceiveProps!="function"&&typeof P.componentWillReceiveProps!="function"||(K||pe!==V)&&Nh(d,P,S,V),ss=!1;var Ue=d.memoizedState;P.state=Ue,fd(d,S,P,R),Yu(),pe=d.memoizedState,K||Ue!==pe||ss?(typeof qe=="function"&&(zp(d,m,qe,S),pe=d.memoizedState),(ee=ss||Oh(d,m,ee,S,Ue,pe,V))?(Ne||typeof P.UNSAFE_componentWillMount!="function"&&typeof P.componentWillMount!="function"||(typeof P.componentWillMount=="function"&&P.componentWillMount(),typeof P.UNSAFE_componentWillMount=="function"&&P.UNSAFE_componentWillMount()),typeof P.componentDidMount=="function"&&(d.flags|=4194308)):(typeof P.componentDidMount=="function"&&(d.flags|=4194308),d.memoizedProps=S,d.memoizedState=pe),P.props=S,P.state=pe,P.context=V,S=ee):(typeof P.componentDidMount=="function"&&(d.flags|=4194308),S=!1)}else{P=d.stateNode,Gl(l,d),Ne=Ul(m,V=d.memoizedProps),P.props=Ne,qe=d.pendingProps,Ue=P.context,pe=m.contextType,ee=Cu,typeof pe=="object"&&pe!==null&&(ee=Qr(pe)),(pe=typeof(K=m.getDerivedStateFromProps)=="function"||typeof P.getSnapshotBeforeUpdate=="function")||typeof P.UNSAFE_componentWillReceiveProps!="function"&&typeof P.componentWillReceiveProps!="function"||(V!==qe||Ue!==ee)&&Nh(d,P,S,ee),ss=!1,Ue=d.memoizedState,P.state=Ue,fd(d,S,P,R),Yu();var Ze=d.memoizedState;V!==qe||Ue!==Ze||ss||l!==null&&l.dependencies!==null&&Gh(l.dependencies)?(typeof K=="function"&&(zp(d,m,K,S),Ze=d.memoizedState),(Ne=ss||Oh(d,m,Ne,S,Ue,Ze,ee)||l!==null&&l.dependencies!==null&&Gh(l.dependencies))?(pe||typeof P.UNSAFE_componentWillUpdate!="function"&&typeof P.componentWillUpdate!="function"||(typeof P.componentWillUpdate=="function"&&P.componentWillUpdate(S,Ze,ee),typeof P.UNSAFE_componentWillUpdate=="function"&&P.UNSAFE_componentWillUpdate(S,Ze,ee)),typeof P.componentDidUpdate=="function"&&(d.flags|=4),typeof P.getSnapshotBeforeUpdate=="function"&&(d.flags|=1024)):(typeof P.componentDidUpdate!="function"||V===l.memoizedProps&&Ue===l.memoizedState||(d.flags|=4),typeof P.getSnapshotBeforeUpdate!="function"||V===l.memoizedProps&&Ue===l.memoizedState||(d.flags|=1024),d.memoizedProps=S,d.memoizedState=Ze),P.props=S,P.state=Ze,P.context=ee,S=Ne):(typeof P.componentDidUpdate!="function"||V===l.memoizedProps&&Ue===l.memoizedState||(d.flags|=4),typeof P.getSnapshotBeforeUpdate!="function"||V===l.memoizedProps&&Ue===l.memoizedState||(d.flags|=1024),S=!1)}return P=S,Tt(l,d),S=!!(128&d.flags),P||S?(P=d.stateNode,m=S&&typeof m.getDerivedStateFromError!="function"?null:P.render(),d.flags|=1,l!==null&&S?(d.child=Ws(d,l.child,null,R),d.child=Ws(d,null,m,R)):ci(l,d,m,R),d.memoizedState=P.state,l=d.child):l=ro(l,d,R),l}function Qp(l,d,m,S){return ws(),d.flags|=256,ci(l,d,m,S),d.child}var $h={dehydrated:null,treeContext:null,retryLane:0};function Bl(l){return{baseLanes:l,cachePool:Ou()}}function Dy(l,d,m){return l=l!==null?l.childLanes&~m:0,d&&(l|=Rs),l}function Py(l,d,m){var S,R=d.pendingProps,P=!1,V=!!(128&d.flags);if((S=V)||(S=(l===null||l.memoizedState!==null)&&!!(2&dr.current)),S&&(P=!0,d.flags&=-129),S=!!(32&d.flags),d.flags&=-33,l===null){if(Ln){if(P?$n(d):ba(),Ln){var K,ee=Vr;if(K=ee){e:{for(K=ee,ee=zs;K.nodeType!==8;){if(!ee){ee=null;break e}if((K=ea(K.nextSibling))===null){ee=null;break e}}ee=K}ee!==null?(d.memoizedState={dehydrated:ee,treeContext:Ui!==null?{id:lr,overflow:Ka}:null,retryLane:536870912},(K=Ls(18,null,null,0)).stateNode=ee,K.return=d,d.child=K,Di=d,Vr=null,K=!0):K=!1}K||va(d)}if((ee=d.memoizedState)!==null&&(ee=ee.dehydrated)!==null)return ee.data==="$!"?d.lanes=16:d.lanes=536870912,null;zr(d)}return ee=R.children,R=R.fallback,P?(ba(),ee=Xp({mode:"hidden",children:ee},P=d.mode),R=jo(R,P,m,null),ee.return=d,R.return=d,ee.sibling=R,d.child=ee,(P=d.child).memoizedState=Bl(m),P.childLanes=Dy(l,S,m),d.memoizedState=$h,R):($n(d),jh(d,ee))}if((K=l.memoizedState)!==null&&(ee=K.dehydrated)!==null){if(V)256&d.flags?($n(d),d.flags&=-257,d=Jp(l,d,m)):d.memoizedState!==null?(ba(),d.child=l.child,d.flags|=128,d=null):(ba(),P=R.fallback,ee=d.mode,R=Xp({mode:"visible",children:R.children},ee),(P=jo(P,ee,m,null)).flags|=2,R.return=d,P.return=d,R.sibling=P,d.child=R,Ws(d,l.child,null,m),(R=d.child).memoizedState=Bl(m),R.childLanes=Dy(l,S,m),d.memoizedState=$h,d=P);else if($n(d),ee.data==="$!"){if(S=ee.nextSibling&&ee.nextSibling.dataset)var pe=S.dgst;S=pe,(R=Error(s(419))).stack="",R.digest=S,qs({value:R,source:null,stack:null}),d=Jp(l,d,m)}else if(Sn||dd(l,d,m,!1),S=!!(m&l.childLanes),Sn||S){if((S=yr)!==null){if(42&(R=m&-m))R=1;else switch(R){case 2:R=1;break;case 8:R=4;break;case 32:R=16;break;case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:R=64;break;case 268435456:R=134217728;break;default:R=0}if((R=R&(S.suspendedLanes|m)?0:R)!==0&&R!==K.retryLane)throw K.retryLane=R,ts(l,R),di(S,l,R),no}ee.data==="$?"||Ko(),d=Jp(l,d,m)}else ee.data==="$?"?(d.flags|=128,d.child=l.child,d=wg.bind(null,l),ee.Et=d,d=null):(l=K.treeContext,Vr=ea(ee.nextSibling),Di=d,Ln=!0,rn=null,zs=!1,l!==null&&(ai[ln++]=lr,ai[ln++]=Ka,ai[ln++]=Ui,lr=l.id,Ka=l.overflow,Ui=d),(d=jh(d,R.children)).flags|=4096);return d}return P?(ba(),P=R.fallback,ee=d.mode,pe=(K=l.child).sibling,(R=$o(K,{mode:"hidden",children:R.children})).subtreeFlags=31457280&K.subtreeFlags,pe!==null?P=$o(pe,P):(P=jo(P,ee,m,null)).flags|=2,P.return=d,R.return=d,R.sibling=P,d.child=R,R=P,P=d.child,(ee=l.child.memoizedState)===null?ee=Bl(m):((K=ee.cachePool)!==null?(pe=Tr.ut,K=K.parent!==pe?{parent:pe,pool:pe}:K):K=Ou(),ee={baseLanes:ee.baseLanes|m,cachePool:K}),P.memoizedState=ee,P.childLanes=Dy(l,S,m),d.memoizedState=$h,R):($n(d),l=(m=l.child).sibling,(m=$o(m,{mode:"visible",children:R.children})).return=d,m.sibling=null,l!==null&&((S=d.deletions)===null?(d.deletions=[l],d.flags|=16):S.push(l)),d.child=m,d.memoizedState=null,m)}function jh(l,d){return(d=Xp({mode:"visible",children:d},l.mode)).return=l,l.child=d}function Xp(l,d){return cg(l,d,0,null)}function Jp(l,d,m){return Ws(d,l.child,null,m),(l=jh(d,d.pendingProps.children)).flags|=2,d.memoizedState=null,l}function My(l,d,m){l.lanes|=d;var S=l.alternate;S!==null&&(S.lanes|=d),Jn(l.return,d,m)}function Zp(l,d,m,S,R){var P=l.memoizedState;P===null?l.memoizedState={isBackwards:d,rendering:null,renderingStartTime:0,last:S,tail:m,tailMode:R}:(P.isBackwards=d,P.rendering=null,P.renderingStartTime=0,P.last=S,P.tail=m,P.tailMode=R)}function Oy(l,d,m){var S=d.pendingProps,R=S.revealOrder,P=S.tail;if(ci(l,d,S.children,m),2&(S=dr.current))S=1&S|2,d.flags|=128;else{if(l!==null&&128&l.flags)e:for(l=d.child;l!==null;){if(l.tag===13)l.memoizedState!==null&&My(l,m,d);else if(l.tag===19)My(l,m,d);else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===d)break e;for(;l.sibling===null;){if(l.return===null||l.return===d)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}S&=1}switch(gn(dr,S),R){case"forwards":for(m=d.child,R=null;m!==null;)(l=m.alternate)!==null&&jn(l)===null&&(R=m),m=m.sibling;(m=R)===null?(R=d.child,d.child=null):(R=m.sibling,m.sibling=null),Zp(d,!1,R,m,P);break;case"backwards":for(m=null,R=d.child,d.child=null;R!==null;){if((l=R.alternate)!==null&&jn(l)===null){d.child=R;break}l=R.sibling,R.sibling=m,m=R,R=l}Zp(d,!0,m,null,P);break;case"together":Zp(d,!1,null,null,void 0);break;default:d.memoizedState=null}return d.child}function ro(l,d,m){if(l!==null&&(d.dependencies=l.dependencies),Ho|=d.lanes,!(m&d.childLanes)&&(l===null||(dd(l,d,m,!1),!(m&d.childLanes))))return null;if(l!==null&&d.child!==l.child)throw Error(s(153));if(d.child!==null){for(m=$o(l=d.child,l.pendingProps),d.child=m,m.return=d;l.sibling!==null;)l=l.sibling,(m=m.sibling=$o(l,l.pendingProps)).return=d;m.sibling=null}return d.child}function eg(l,d){return!!(l.lanes&d)||!((l=l.dependencies)===null||!Gh(l))}function Ny(l,d,m){if(l!==null)if(l.memoizedProps!==d.pendingProps)Sn=!0;else{if(!(eg(l,m)||128&d.flags))return Sn=!1,function(K,ee,pe){switch(ee.tag){case 3:Kn(ee,ee.stateNode.containerInfo),io(ee,Tr,K.memoizedState.cache),ws();break;case 27:case 5:Lr(ee);break;case 4:Kn(ee,ee.stateNode.containerInfo);break;case 10:io(ee,ee.type,ee.memoizedProps.value);break;case 13:var Ne=ee.memoizedState;if(Ne!==null)return Ne.dehydrated!==null?($n(ee),ee.flags|=128,null):pe&ee.child.childLanes?Py(K,ee,pe):($n(ee),(K=ro(K,ee,pe))!==null?K.sibling:null);$n(ee);break;case 19:var qe=!!(128&K.flags);if((Ne=!!(pe&ee.childLanes))||(dd(K,ee,pe,!1),Ne=!!(pe&ee.childLanes)),qe){if(Ne)return Oy(K,ee,pe);ee.flags|=128}if((qe=ee.memoizedState)!==null&&(qe.rendering=null,qe.tail=null,qe.lastEffect=null),gn(dr,dr.current),Ne)break;return null;case 22:case 23:return ee.lanes=0,Bh(K,ee,pe);case 24:io(ee,Tr,K.memoizedState.cache)}return ro(K,ee,pe)}(l,d,m);Sn=!!(131072&l.flags)}else Sn=!1,Ln&&1048576&d.flags&&ly(d,Do,d.index);switch(d.lanes=0,d.tag){case 16:e:{l=d.pendingProps;var S=d.elementType,R=S.tt;if(S=R(S.et),d.type=S,typeof S!="function"){if(S!=null){if((R=S.$$typeof)===O){d.tag=11,d=Wp(null,d,S,l,m);break e}if(R===z){d.tag=14,d=Ly(null,d,S,l,m);break e}}throw d=re(S)||S,Error(s(306,d,""))}ug(S)?(l=Ul(S,l),d.tag=1,d=Cy(null,d,S,l,m)):(d.tag=0,d=Yp(null,d,S,l,m))}return d;case 0:return Yp(l,d,d.type,d.pendingProps,m);case 1:return Cy(l,d,S=d.type,R=Ul(S,d.pendingProps),m);case 3:e:{if(Kn(d,d.stateNode.containerInfo),l===null)throw Error(s(387));var P=d.pendingProps;S=(R=d.memoizedState).element,Gl(l,d),fd(d,P,null,m);var V=d.memoizedState;if(P=V.cache,io(d,Tr,P),P!==R.cache&&zu(d,[Tr],m,!0),Yu(),P=V.element,R.isDehydrated){if(R={element:P,isDehydrated:!1,cache:V.cache},d.updateQueue.baseState=R,d.memoizedState=R,256&d.flags){d=Qp(l,d,P,m);break e}if(P!==S){qs(S=dt(Error(s(424)),d)),d=Qp(l,d,P,m);break e}for(Vr=ea(d.stateNode.containerInfo.firstChild),Di=d,Ln=!0,rn=null,zs=!0,m=n1(d,null,P,m),d.child=m;m;)m.flags=-3&m.flags|4096,m=m.sibling}else{if(ws(),P===S){d=ro(l,d,m);break e}ci(l,d,P,m)}d=d.child}return d;case 26:return Tt(l,d),l===null?(m=ho(d.type,null,d.pendingProps,null))?d.memoizedState=m:Ln||(m=d.type,l=d.pendingProps,(S=cc(Un.current).createElement(m))[Hr]=d,S[mi]=l,Zr(S,m,l),gr(S),d.stateNode=S):d.memoizedState=ho(d.type,l.memoizedProps,d.pendingProps,l.memoizedState),null;case 27:return Lr(d),l===null&&Ln&&(S=d.stateNode=lv(d.type,d.pendingProps,Un.current),Di=d,zs=!0,Vr=ea(S.firstChild)),S=d.pendingProps.children,l!==null||Ln?ci(l,d,S,m):d.child=Ws(d,null,S,m),Tt(l,d),d.child;case 5:return l===null&&Ln&&((R=S=Vr)&&((S=function(K,ee,pe,Ne){for(;K.nodeType===1;){var qe=pe;if(K.nodeName.toLowerCase()!==ee.toLowerCase()){if(!Ne&&(K.nodeName!=="INPUT"||K.type!=="hidden"))break}else if(Ne){if(!K[pu])switch(ee){case"meta":if(!K.hasAttribute("itemprop"))break;return K;case"link":if((Ue=K.getAttribute("rel"))==="stylesheet"&&K.hasAttribute("data-precedence")||Ue!==qe.rel||K.getAttribute("href")!==(qe.href==null?null:qe.href)||K.getAttribute("crossorigin")!==(qe.crossOrigin==null?null:qe.crossOrigin)||K.getAttribute("title")!==(qe.title==null?null:qe.title))break;return K;case"style":if(K.hasAttribute("data-precedence"))break;return K;case"script":if(((Ue=K.getAttribute("src"))!==(qe.src==null?null:qe.src)||K.getAttribute("type")!==(qe.type==null?null:qe.type)||K.getAttribute("crossorigin")!==(qe.crossOrigin==null?null:qe.crossOrigin))&&Ue&&K.hasAttribute("async")&&!K.hasAttribute("itemprop"))break;return K;default:return K}}else{if(ee!=="input"||K.type!=="hidden")return K;var Ue=qe.name==null?null:""+qe.name;if(qe.type==="hidden"&&K.getAttribute("name")===Ue)return K}if((K=ea(K.nextSibling))===null)break}return null}(S,d.type,d.pendingProps,zs))!==null?(d.stateNode=S,Di=d,Vr=ea(S.firstChild),zs=!1,R=!0):R=!1),R||va(d)),Lr(d),R=d.type,P=d.pendingProps,V=l!==null?l.memoizedProps:null,S=P.children,dc(R,P)?S=null:V!==null&&dc(R,V)&&(d.flags|=32),d.memoizedState!==null&&(R=Rp(l,d,s1,null,null,m),Dd.ut=R),Tt(l,d),ci(l,d,S,m),d.child;case 6:return l===null&&Ln&&((l=m=Vr)&&((m=function(K,ee,pe){if(ee==="")return null;for(;K.nodeType!==3;)if((K.nodeType!==1||K.nodeName!=="INPUT"||K.type!=="hidden")&&!pe||(K=ea(K.nextSibling))===null)return null;return K}(m,d.pendingProps,zs))!==null?(d.stateNode=m,Di=d,Vr=null,l=!0):l=!1),l||va(d)),null;case 13:return Py(l,d,m);case 4:return Kn(d,d.stateNode.containerInfo),S=d.pendingProps,l===null?d.child=Ws(d,null,S,m):ci(l,d,S,m),d.child;case 11:return Wp(l,d,d.type,d.pendingProps,m);case 7:return ci(l,d,d.pendingProps,m),d.child;case 8:case 12:return ci(l,d,d.pendingProps.children,m),d.child;case 10:return S=d.pendingProps,io(d,d.type,S.value),ci(l,d,S.children,m),d.child;case 9:return R=d.type.ht,S=d.pendingProps.children,jl(d),S=S(R=Qr(R)),d.flags|=1,ci(l,d,S,m),d.child;case 14:return Ly(l,d,d.type,d.pendingProps,m);case 15:return Ry(l,d,d.type,d.pendingProps,m);case 19:return Oy(l,d,m);case 22:return Bh(l,d,m);case 24:return jl(d),S=Qr(Tr),l===null?((R=Rh())===null&&(R=yr,P=Lh(),R.pooledCache=P,P.refCount++,P!==null&&(R.pooledCacheLanes|=m),R=P),d.memoizedState={parent:S,cache:R},qu(d),io(d,Tr,R)):(l.lanes&m&&(Gl(l,d),fd(d,null,null,m),Yu()),R=l.memoizedState,P=d.memoizedState,R.parent!==S?(R={parent:S,cache:S},d.memoizedState=R,d.lanes===0&&(d.memoizedState=d.updateQueue.baseState=R),io(d,Tr,S)):(S=P.cache,io(d,Tr,S),S!==R.cache&&zu(d,[Tr],m,!0))),ci(l,d,d.pendingProps.children,m),d.child;case 29:throw d.pendingProps}throw Error(s(156,d.tag))}var tg=We(null),$l=null,Xt=null;function io(l,d,m){gn(tg,d.ut),d.ut=m}function Yr(l){l.ut=tg.current,Ot(tg)}function Jn(l,d,m){for(;l!==null;){var S=l.alternate;if((l.childLanes&d)!==d?(l.childLanes|=d,S!==null&&(S.childLanes|=d)):S!==null&&(S.childLanes&d)!==d&&(S.childLanes|=d),l===m)break;l=l.return}}function zu(l,d,m,S){var R=l.child;for(R!==null&&(R.return=l);R!==null;){var P=R.dependencies;if(P!==null){var V=R.child;P=P.firstContext;e:for(;P!==null;){var K=P;P=R;for(var ee=0;ee<d.length;ee++)if(K.context===d[ee]){P.lanes|=m,(K=P.alternate)!==null&&(K.lanes|=m),Jn(P.return,m,l),S||(V=null);break e}P=K.next}}else if(R.tag===18){if((V=R.return)===null)throw Error(s(341));V.lanes|=m,(P=V.alternate)!==null&&(P.lanes|=m),Jn(V,m,l),V=null}else V=R.child;if(V!==null)V.return=R;else for(V=R;V!==null;){if(V===l){V=null;break}if((R=V.sibling)!==null){R.return=V.return,V=R;break}V=V.return}R=V}}function dd(l,d,m,S){l=null;for(var R=d,P=!1;R!==null;){if(!P){if(524288&R.flags)P=!0;else if(262144&R.flags)break}if(R.tag===10){var V=R.alternate;if(V===null)throw Error(s(387));if((V=V.memoizedProps)!==null){var K=R.type;es(R.pendingProps.value,V.value)||(l!==null?l.push(K):l=[K])}}else if(R===Ir.current){if((V=R.alternate)===null)throw Error(s(387));V.memoizedState.memoizedState!==R.memoizedState.memoizedState&&(l!==null?l.push(Dd):l=[Dd])}R=R.return}l!==null&&zu(d,l,m,S),d.flags|=262144}function Gh(l){for(l=l.firstContext;l!==null;){if(!es(l.context.ut,l.memoizedValue))return!0;l=l.next}return!1}function jl(l){$l=l,Xt=null,(l=l.dependencies)!==null&&(l.firstContext=null)}function Qr(l){return Hh($l,l)}function hd(l,d){return $l===null&&jl(l),Hh(l,d)}function Hh(l,d){var m=d.ut;if(d={context:d,memoizedValue:m,next:null},Xt===null){if(l===null)throw Error(s(308));Xt=d,l.dependencies={lanes:0,firstContext:d},l.flags|=524288}else Xt=Xt.next=d;return m}var ss=!1;function qu(l){l.updateQueue={baseState:l.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Gl(l,d){l=l.updateQueue,d.updateQueue===l&&(d.updateQueue={baseState:l.baseState,firstBaseUpdate:l.firstBaseUpdate,lastBaseUpdate:l.lastBaseUpdate,shared:l.shared,callbacks:null})}function Ys(l){return{lane:l,tag:0,payload:null,callback:null,next:null}}function Hl(l,d,m){var S=l.updateQueue;if(S===null)return null;if(S=S.shared,2&Sr){var R=S.pending;return R===null?d.next=d:(d.next=R.next,R.next=d),S.pending=d,d=Ro(l),Ap(l,null,m),d}return Pn(l,S,d,m),Ro(l)}function Wu(l,d,m){if((d=d.updateQueue)!==null&&(d=d.shared,4194176&m)){var S=d.lanes;m|=S&=l.pendingLanes,d.lanes=m,hp(l,m)}}function ng(l,d){var m=l.updateQueue,S=l.alternate;if(S!==null&&m===(S=S.updateQueue)){var R=null,P=null;if((m=m.firstBaseUpdate)!==null){do{var V={lane:m.lane,tag:m.tag,payload:m.payload,callback:null,next:null};P===null?R=P=V:P=P.next=V,m=m.next}while(m!==null);P===null?R=P=d:P=P.next=d}else R=P=d;return m={baseState:S.baseState,firstBaseUpdate:R,lastBaseUpdate:P,shared:S.shared,callbacks:S.callbacks},void(l.updateQueue=m)}(l=m.lastBaseUpdate)===null?m.firstBaseUpdate=d:l.next=d,m.lastBaseUpdate=d}var rg=!1;function Yu(){if(rg&&Qa!==null)throw Qa}function fd(l,d,m,S){rg=!1;var R=l.updateQueue;ss=!1;var P=R.firstBaseUpdate,V=R.lastBaseUpdate,K=R.shared.pending;if(K!==null){R.shared.pending=null;var ee=K,pe=ee.next;ee.next=null,V===null?P=pe:V.next=pe,V=ee;var Ne=l.alternate;Ne!==null&&(K=(Ne=Ne.updateQueue).lastBaseUpdate)!==V&&(K===null?Ne.firstBaseUpdate=pe:K.next=pe,Ne.lastBaseUpdate=ee)}if(P!==null){var qe=R.baseState;for(V=0,Ne=pe=ee=null,K=P;;){var Ue=-536870913&K.lane,Ze=Ue!==K.lane;if(Ze?(Fn&Ue)===Ue:(S&Ue)===Ue){Ue!==0&&Ue===Ya&&(rg=!0),Ne!==null&&(Ne=Ne.next={lane:0,tag:K.tag,payload:K.payload,callback:null,next:null});e:{var Xe=l,Le=K;Ue=d;var Te=m;switch(Le.tag){case 1:if(typeof(Xe=Le.payload)=="function"){qe=Xe.call(Te,qe,Ue);break e}qe=Xe;break e;case 3:Xe.flags=-65537&Xe.flags|128;case 0:if((Ue=typeof(Xe=Le.payload)=="function"?Xe.call(Te,qe,Ue):Xe)==null)break e;qe=we({},qe,Ue);break e;case 2:ss=!0}}(Ue=K.callback)!==null&&(l.flags|=64,Ze&&(l.flags|=8192),(Ze=R.callbacks)===null?R.callbacks=[Ue]:Ze.push(Ue))}else Ze={lane:Ue,tag:K.tag,payload:K.payload,callback:K.callback,next:null},Ne===null?(pe=Ne=Ze,ee=qe):Ne=Ne.next=Ze,V|=Ue;if((K=K.next)===null){if((K=R.shared.pending)===null)break;K=(Ze=K).next,Ze.next=null,R.lastBaseUpdate=Ze,R.shared.pending=null}}Ne===null&&(ee=qe),R.baseState=ee,R.firstBaseUpdate=pe,R.lastBaseUpdate=Ne,P===null&&(R.shared.lanes=0),Ho|=V,l.lanes=V,l.memoizedState=qe}}function pd(l,d){if(typeof l!="function")throw Error(s(191,l));l.call(d)}function _y(l,d){var m=l.callbacks;if(m!==null)for(l.callbacks=null,l=0;l<m.length;l++)pd(m[l],d)}function gd(l,d){try{var m=d.updateQueue,S=m!==null?m.lastEffect:null;if(S!==null){var R=S.next;m=R;do{if((m.tag&l)===l){S=void 0;var P=m.create,V=m.inst;S=P(),V.destroy=S}m=m.next}while(m!==R)}}catch(K){fn(d,d.return,K)}}function Fo(l,d,m){try{var S=d.updateQueue,R=S!==null?S.lastEffect:null;if(R!==null){var P=R.next;S=P;do{if((S.tag&l)===l){var V=S.inst,K=V.destroy;if(K!==void 0){V.destroy=void 0,R=d;var ee=m;try{K()}catch(pe){fn(R,ee,pe)}}}S=S.next}while(S!==P)}}catch(pe){fn(d,d.return,pe)}}function Vh(l){var d=l.updateQueue;if(d!==null){var m=l.stateNode;try{_y(d,m)}catch(S){fn(l,l.return,S)}}}function Qu(l,d,m){m.props=Ul(l.type,l.memoizedProps),m.state=l.memoizedState;try{m.componentWillUnmount()}catch(S){fn(l,d,S)}}function so(l,d){try{var m=l.ref;if(m!==null){var S=l.stateNode;switch(l.tag){case 26:case 27:case 5:var R=S;break;default:R=S}typeof m=="function"?l.refCleanup=m(R):m.current=R}}catch(P){fn(l,d,P)}}function as(l,d){var m=l.ref,S=l.refCleanup;if(m!==null)if(typeof S=="function")try{S()}catch(R){fn(l,d,R)}finally{l.refCleanup=null,(l=l.alternate)!=null&&(l.refCleanup=null)}else if(typeof m=="function")try{m(null)}catch(R){fn(l,d,R)}else m.current=null}function Fy(l){var d=l.type,m=l.memoizedProps,S=l.stateNode;try{e:switch(d){case"button":case"input":case"select":case"textarea":m.autoFocus&&S.focus();break e;case"img":m.src?S.src=m.src:m.srcSet&&(S.srcset=m.srcSet)}}catch(R){fn(l,l.return,R)}}function g1(l,d,m){try{var S=l.stateNode;(function(R,P,V,K){switch(P){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var ee=null,pe=null,Ne=null,qe=null,Ue=null,Ze=null,Xe=null;for(Ie in V){var Le=V[Ie];if(V.hasOwnProperty(Ie)&&Le!=null)switch(Ie){case"checked":case"value":break;case"defaultValue":Ue=Le;default:K.hasOwnProperty(Ie)||Zn(R,P,Ie,null,K,Le)}}for(var Te in K){var Ie=K[Te];if(Le=V[Te],K.hasOwnProperty(Te)&&(Ie!=null||Le!=null))switch(Te){case"type":pe=Ie;break;case"name":ee=Ie;break;case"checked":Ze=Ie;break;case"defaultChecked":Xe=Ie;break;case"value":Ne=Ie;break;case"defaultValue":qe=Ie;break;case"children":case"dangerouslySetInnerHTML":if(Ie!=null)throw Error(s(137,P));break;default:Ie!==Le&&Zn(R,P,Te,Ie,K,Le)}}return void Um(R,Ne,qe,Ue,Ze,Xe,pe,ee);case"select":for(pe in Ie=Ne=qe=Te=null,V)if(Ue=V[pe],V.hasOwnProperty(pe)&&Ue!=null)switch(pe){case"value":break;case"multiple":Ie=Ue;default:K.hasOwnProperty(pe)||Zn(R,P,pe,null,K,Ue)}for(ee in K)if(pe=K[ee],Ue=V[ee],K.hasOwnProperty(ee)&&(pe!=null||Ue!=null))switch(ee){case"value":Te=pe;break;case"defaultValue":qe=pe;break;case"multiple":Ne=pe;default:pe!==Ue&&Zn(R,P,ee,pe,K,Ue)}return P=qe,V=Ne,K=Ie,void(Te!=null?Ao(R,!!V,Te,!1):!!K!=!!V&&(P!=null?Ao(R,!!V,P,!0):Ao(R,!!V,V?[]:"",!1)));case"textarea":for(qe in Ie=Te=null,V)if(ee=V[qe],V.hasOwnProperty(qe)&&ee!=null&&!K.hasOwnProperty(qe))switch(qe){case"value":case"children":break;default:Zn(R,P,qe,null,K,ee)}for(Ne in K)if(ee=K[Ne],pe=V[Ne],K.hasOwnProperty(Ne)&&(ee!=null||pe!=null))switch(Ne){case"value":Te=ee;break;case"defaultValue":Ie=ee;break;case"children":break;case"dangerouslySetInnerHTML":if(ee!=null)throw Error(s(91));break;default:ee!==pe&&Zn(R,P,Ne,ee,K,pe)}return void Bm(R,Te,Ie);case"option":for(var Je in V)Te=V[Je],V.hasOwnProperty(Je)&&Te!=null&&!K.hasOwnProperty(Je)&&(Je==="selected"?R.selected=!1:Zn(R,P,Je,null,K,Te));for(Ue in K)Te=K[Ue],Ie=V[Ue],K.hasOwnProperty(Ue)&&Te!==Ie&&(Te!=null||Ie!=null)&&(Ue==="selected"?R.selected=Te&&typeof Te!="function"&&typeof Te!="symbol":Zn(R,P,Ue,Te,K,Ie));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var kt in V)Te=V[kt],V.hasOwnProperty(kt)&&Te!=null&&!K.hasOwnProperty(kt)&&Zn(R,P,kt,null,K,Te);for(Ze in K)if(Te=K[Ze],Ie=V[Ze],K.hasOwnProperty(Ze)&&Te!==Ie&&(Te!=null||Ie!=null))switch(Ze){case"children":case"dangerouslySetInnerHTML":if(Te!=null)throw Error(s(137,P));break;default:Zn(R,P,Ze,Te,K,Ie)}return;default:if(en(P)){for(var St in V)Te=V[St],V.hasOwnProperty(St)&&Te!==void 0&&!K.hasOwnProperty(St)&&sf(R,P,St,void 0,K,Te);for(Xe in K)Te=K[Xe],Ie=V[Xe],!K.hasOwnProperty(Xe)||Te===Ie||Te===void 0&&Ie===void 0||sf(R,P,Xe,Te,K,Ie);return}}for(var zt in V)Te=V[zt],V.hasOwnProperty(zt)&&Te!=null&&!K.hasOwnProperty(zt)&&Zn(R,P,zt,null,K,Te);for(Le in K)Te=K[Le],Ie=V[Le],!K.hasOwnProperty(Le)||Te===Ie||Te==null&&Ie==null||Zn(R,P,Le,Te,K,Ie)})(S,l.type,m,d),S[mi]=d}catch(R){fn(l,l.return,R)}}function ig(l){return l.tag===5||l.tag===3||l.tag===26||l.tag===27||l.tag===4}function Kh(l){e:for(;;){for(;l.sibling===null;){if(l.return===null||ig(l.return))return null;l=l.return}for(l.sibling.return=l.return,l=l.sibling;l.tag!==5&&l.tag!==6&&l.tag!==27&&l.tag!==18;){if(2&l.flags||l.child===null||l.tag===4)continue e;l.child.return=l,l=l.child}if(!(2&l.flags))return l.stateNode}}function zh(l,d,m){var S=l.tag;if(S===5||S===6)l=l.stateNode,d?m.nodeType===8?m.parentNode.insertBefore(l,d):m.insertBefore(l,d):(m.nodeType===8?(d=m.parentNode).insertBefore(l,m):(d=m).appendChild(l),(m=m.kt)!=null||d.onclick!==null||(d.onclick=rf));else if(S!==4&&S!==27&&(l=l.child)!==null)for(zh(l,d,m),l=l.sibling;l!==null;)zh(l,d,m),l=l.sibling}function qh(l,d,m){var S=l.tag;if(S===5||S===6)l=l.stateNode,d?m.insertBefore(l,d):m.appendChild(l);else if(S!==4&&S!==27&&(l=l.child)!==null)for(qh(l,d,m),l=l.sibling;l!==null;)qh(l,d,m),l=l.sibling}var Sa=!1,Yn=!1,Xu=!1,md=typeof WeakSet=="function"?WeakSet:Set,Xr=null,sg=!1;function m1(l,d,m){var S=m.flags;switch(m.tag){case 0:case 11:case 15:Is(l,m),4&S&&gd(5,m);break;case 1:if(Is(l,m),4&S)if(l=m.stateNode,d===null)try{l.componentDidMount()}catch(K){fn(m,m.return,K)}else{var R=Ul(m.type,d.memoizedProps);d=d.memoizedState;try{l.componentDidUpdate(R,d,l.St)}catch(K){fn(m,m.return,K)}}64&S&&Vh(m),512&S&&so(m,m.return);break;case 3:if(Is(l,m),64&S&&(S=m.updateQueue)!==null){if(l=null,m.child!==null)switch(m.child.tag){case 27:case 5:case 1:l=m.child.stateNode}try{_y(S,l)}catch(K){fn(m,m.return,K)}}break;case 26:Is(l,m),512&S&&so(m,m.return);break;case 27:case 5:Is(l,m),d===null&&4&S&&Fy(m),512&S&&so(m,m.return);break;case 12:default:Is(l,m);break;case 13:Is(l,m),4&S&&By(l,m);break;case 22:if(!(R=m.memoizedState!==null||Sa)){d=d!==null&&d.memoizedState!==null||Yn;var P=Sa,V=Yn;Sa=R,(Yn=d)&&!V?Uo(l,m,!!(8772&m.subtreeFlags)):Is(l,m),Sa=P,Yn=V}512&S&&(m.memoizedProps.mode==="manual"?so(m,m.return):as(m,m.return))}}function Uy(l){var d=l.alternate;d!==null&&(l.alternate=null,Uy(d)),l.child=null,l.deletions=null,l.sibling=null,l.tag===5&&(d=l.stateNode)!==null&&fp(d),l.stateNode=null,l.return=null,l.dependencies=null,l.memoizedProps=null,l.memoizedState=null,l.pendingProps=null,l.stateNode=null,l.updateQueue=null}var Jr=null,os=!1;function $r(l,d,m){for(m=m.child;m!==null;)y1(l,d,m),m=m.sibling}function y1(l,d,m){if(Wi&&typeof Wi.onCommitFiberUnmount=="function")try{Wi.onCommitFiberUnmount(Nt,m)}catch{}switch(m.tag){case 26:Yn||as(m,d),$r(l,d,m),m.memoizedState?m.memoizedState.count--:m.stateNode&&(m=m.stateNode).parentNode.removeChild(m);break;case 27:Yn||as(m,d);var S=Jr,R=os;for(Jr=m.stateNode,$r(l,d,m),d=(m=m.stateNode).attributes;d.length;)m.removeAttributeNode(d[0]);fp(m),Jr=S,os=R;break;case 5:Yn||as(m,d);case 6:R=Jr;var P=os;if(Jr=null,$r(l,d,m),os=P,(Jr=R)!==null)if(os)try{l=Jr,S=m.stateNode,l.nodeType===8?l.parentNode.removeChild(S):l.removeChild(S)}catch(V){fn(m,d,V)}else try{Jr.removeChild(m.stateNode)}catch(V){fn(m,d,V)}break;case 18:Jr!==null&&(os?(d=Jr,m=m.stateNode,d.nodeType===8?Dg(d.parentNode,m):d.nodeType===1&&Dg(d,m),gf(d)):Dg(Jr,m.stateNode));break;case 4:S=Jr,R=os,Jr=m.stateNode.containerInfo,os=!0,$r(l,d,m),Jr=S,os=R;break;case 0:case 11:case 14:case 15:Yn||Fo(2,m,d),Yn||Fo(4,m,d),$r(l,d,m);break;case 1:Yn||(as(m,d),typeof(S=m.stateNode).componentWillUnmount=="function"&&Qu(m,d,S)),$r(l,d,m);break;case 21:$r(l,d,m);break;case 22:Yn||as(m,d),Yn=(S=Yn)||m.memoizedState!==null,$r(l,d,m),Yn=S;break;default:$r(l,d,m)}}function By(l,d){if(d.memoizedState===null&&(l=d.alternate)!==null&&(l=l.memoizedState)!==null&&(l=l.dehydrated)!==null)try{gf(l)}catch(m){fn(d,d.return,m)}}function Bi(l,d){var m=function(S){switch(S.tag){case 13:case 19:var R=S.stateNode;return R===null&&(R=S.stateNode=new md),R;case 22:return(R=(S=S.stateNode).Tt)===null&&(R=S.Tt=new md),R;default:throw Error(s(435,S.tag))}}(l);d.forEach(function(S){var R=T1.bind(null,l,S);m.has(S)||(m.add(S),S.then(R,R))})}function xs(l,d){var m=d.deletions;if(m!==null)for(var S=0;S<m.length;S++){var R=m[S],P=l,V=d,K=V;e:for(;K!==null;){switch(K.tag){case 27:case 5:Jr=K.stateNode,os=!1;break e;case 3:case 4:Jr=K.stateNode.containerInfo,os=!0;break e}K=K.return}if(Jr===null)throw Error(s(160));y1(P,V,R),Jr=null,os=!1,(P=R.alternate)!==null&&(P.return=null),R.return=null}if(13878&d.subtreeFlags)for(d=d.child;d!==null;)ls(d,l),d=d.sibling}var $i=null;function ls(l,d){var m=l.alternate,S=l.flags;switch(l.tag){case 0:case 11:case 14:case 15:xs(d,l),Qs(l),4&S&&(Fo(3,l,l.return),gd(3,l),Fo(5,l,l.return));break;case 1:xs(d,l),Qs(l),512&S&&(Yn||m===null||as(m,m.return)),64&S&&Sa&&(l=l.updateQueue)!==null&&(S=l.callbacks)!==null&&(m=l.shared.hiddenCallbacks,l.shared.hiddenCallbacks=m===null?S:m.concat(S));break;case 26:var R=$i;if(xs(d,l),Qs(l),512&S&&(Yn||m===null||as(m,m.return)),4&S){var P=m!==null?m.memoizedState:null;if(S=l.memoizedState,m===null)if(S===null)if(l.stateNode===null){e:{S=l.type,m=l.memoizedProps,R=R.ownerDocument||R;t:switch(S){case"title":(!(P=R.getElementsByTagName("title")[0])||P[pu]||P[Hr]||P.namespaceURI==="http://www.w3.org/2000/svg"||P.hasAttribute("itemprop"))&&(P=R.createElement(S),R.head.insertBefore(P,R.querySelector("head > title"))),Zr(P,S,m),P[Hr]=l,gr(P),S=P;break e;case"link":var V=dv("link","href",R).get(S+(m.href||""));if(V){for(var K=0;K<V.length;K++)if((P=V[K]).getAttribute("href")===(m.href==null?null:m.href)&&P.getAttribute("rel")===(m.rel==null?null:m.rel)&&P.getAttribute("title")===(m.title==null?null:m.title)&&P.getAttribute("crossorigin")===(m.crossOrigin==null?null:m.crossOrigin)){V.splice(K,1);break t}}Zr(P=R.createElement(S),S,m),R.head.appendChild(P);break;case"meta":if(V=dv("meta","content",R).get(S+(m.content||""))){for(K=0;K<V.length;K++)if((P=V[K]).getAttribute("content")===(m.content==null?null:""+m.content)&&P.getAttribute("name")===(m.name==null?null:m.name)&&P.getAttribute("property")===(m.property==null?null:m.property)&&P.getAttribute("http-equiv")===(m.httpEquiv==null?null:m.httpEquiv)&&P.getAttribute("charset")===(m.charSet==null?null:m.charSet)){V.splice(K,1);break t}}Zr(P=R.createElement(S),S,m),R.head.appendChild(P);break;default:throw Error(s(468,S))}P[Hr]=l,gr(P),S=P}l.stateNode=S}else Og(R,l.type,l.stateNode);else l.stateNode=I1(R,S,l.memoizedProps);else P!==S?(P===null?m.stateNode!==null&&(m=m.stateNode).parentNode.removeChild(m):P.count--,S===null?Og(R,l.type,l.stateNode):I1(R,S,l.memoizedProps)):S===null&&l.stateNode!==null&&g1(l,l.memoizedProps,m.memoizedProps)}break;case 27:if(4&S&&l.alternate===null){R=l.stateNode,P=l.memoizedProps;try{for(var ee=R.firstChild;ee;){var pe=ee.nextSibling,Ne=ee.nodeName;ee[pu]||Ne==="HEAD"||Ne==="BODY"||Ne==="SCRIPT"||Ne==="STYLE"||Ne==="LINK"&&ee.rel.toLowerCase()==="stylesheet"||R.removeChild(ee),ee=pe}for(var qe=l.type,Ue=R.attributes;Ue.length;)R.removeAttributeNode(Ue[0]);Zr(R,qe,P),R[Hr]=l,R[mi]=P}catch(Xe){fn(l,l.return,Xe)}}case 5:if(xs(d,l),Qs(l),512&S&&(Yn||m===null||as(m,m.return)),32&l.flags){R=l.stateNode;try{Rr(R,"")}catch(Xe){fn(l,l.return,Xe)}}4&S&&l.stateNode!=null&&g1(l,R=l.memoizedProps,m!==null?m.memoizedProps:R),1024&S&&(Xu=!0);break;case 6:if(xs(d,l),Qs(l),4&S){if(l.stateNode===null)throw Error(s(162));S=l.memoizedProps,m=l.stateNode;try{m.nodeValue=S}catch(Xe){fn(l,l.return,Xe)}}break;case 3:if(cf=null,R=$i,$i=Ld(d.containerInfo),xs(d,l),$i=R,Qs(l),4&S&&m!==null&&m.memoizedState.isDehydrated)try{gf(d.containerInfo)}catch(Xe){fn(l,l.return,Xe)}Xu&&(Xu=!1,$y(l));break;case 4:S=$i,$i=Ld(l.stateNode.containerInfo),xs(d,l),Qs(l),$i=S;break;case 12:xs(d,l),Qs(l);break;case 13:xs(d,l),Qs(l),8192&l.child.flags&&l.memoizedState!==null!=(m!==null&&m.memoizedState!==null)&&(fg=Dn()),4&S&&(S=l.updateQueue)!==null&&(l.updateQueue=null,Bi(l,S));break;case 22:if(512&S&&(Yn||m===null||as(m,m.return)),ee=l.memoizedState!==null,pe=m!==null&&m.memoizedState!==null,Sa=(Ne=Sa)||ee,Yn=(qe=Yn)||pe,xs(d,l),Yn=qe,Sa=Ne,Qs(l),(d=l.stateNode).At=l,d.yt&=-3,d.yt|=2&d.bt,8192&S&&(d.yt=ee?-2&d.yt:1|d.yt,ee&&(d=Sa||Yn,m===null||pe||d||yd(l)),l.memoizedProps===null||l.memoizedProps.mode!=="manual"))e:for(m=null,d=l;;){if(d.tag===5||d.tag===26||d.tag===27){if(m===null){pe=m=d;try{if(R=pe.stateNode,ee)typeof(P=R.style).setProperty=="function"?P.setProperty("display","none","important"):P.display="none";else{V=pe.stateNode;var Ze=(K=pe.memoizedProps.style)!=null&&K.hasOwnProperty("display")?K.display:null;V.style.display=Ze==null||typeof Ze=="boolean"?"":(""+Ze).trim()}}catch(Xe){fn(pe,pe.return,Xe)}}}else if(d.tag===6){if(m===null){pe=d;try{pe.stateNode.nodeValue=ee?"":pe.memoizedProps}catch(Xe){fn(pe,pe.return,Xe)}}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===l)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===l)break e;for(;d.sibling===null;){if(d.return===null||d.return===l)break e;m===d&&(m=null),d=d.return}m===d&&(m=null),d.sibling.return=d.return,d=d.sibling}4&S&&(S=l.updateQueue)!==null&&(m=S.retryQueue)!==null&&(S.retryQueue=null,Bi(l,m));break;case 19:xs(d,l),Qs(l),4&S&&(S=l.updateQueue)!==null&&(l.updateQueue=null,Bi(l,S));break;case 21:break;default:xs(d,l),Qs(l)}}function Qs(l){var d=l.flags;if(2&d){try{if(l.tag!==27){e:{for(var m=l.return;m!==null;){if(ig(m)){var S=m;break e}m=m.return}throw Error(s(160))}switch(S.tag){case 27:var R=S.stateNode;qh(l,Kh(l),R);break;case 5:var P=S.stateNode;32&S.flags&&(Rr(P,""),S.flags&=-33),qh(l,Kh(l),P);break;case 3:case 4:var V=S.stateNode.containerInfo;zh(l,Kh(l),V);break;default:throw Error(s(161))}}}catch(K){fn(l,l.return,K)}l.flags&=-3}4096&d&&(l.flags&=-4097)}function $y(l){if(1024&l.subtreeFlags)for(l=l.child;l!==null;){var d=l;$y(d),d.tag===5&&1024&d.flags&&d.stateNode.reset(),l=l.sibling}}function Is(l,d){if(8772&d.subtreeFlags)for(d=d.child;d!==null;)m1(l,d.alternate,d),d=d.sibling}function yd(l){for(l=l.child;l!==null;){var d=l;switch(d.tag){case 0:case 11:case 14:case 15:Fo(4,d,d.return),yd(d);break;case 1:as(d,d.return);var m=d.stateNode;typeof m.componentWillUnmount=="function"&&Qu(d,d.return,m),yd(d);break;case 26:case 27:case 5:as(d,d.return),yd(d);break;case 22:as(d,d.return),d.memoizedState===null&&yd(d);break;default:yd(d)}l=l.sibling}}function Uo(l,d,m){for(m=m&&!!(8772&d.subtreeFlags),d=d.child;d!==null;){var S=d.alternate,R=l,P=d,V=P.flags;switch(P.tag){case 0:case 11:case 15:Uo(R,P,m),gd(4,P);break;case 1:if(Uo(R,P,m),typeof(R=(S=P).stateNode).componentDidMount=="function")try{R.componentDidMount()}catch(pe){fn(S,S.return,pe)}if((R=(S=P).updateQueue)!==null){var K=S.stateNode;try{var ee=R.shared.hiddenCallbacks;if(ee!==null)for(R.shared.hiddenCallbacks=null,R=0;R<ee.length;R++)pd(ee[R],K)}catch(pe){fn(S,S.return,pe)}}m&&64&V&&Vh(P),so(P,P.return);break;case 26:case 27:case 5:Uo(R,P,m),m&&S===null&&4&V&&Fy(P),so(P,P.return);break;case 12:default:Uo(R,P,m);break;case 13:Uo(R,P,m),m&&4&V&&By(R,P);break;case 22:P.memoizedState===null&&Uo(R,P,m),so(P,P.return)}d=d.sibling}}function ag(l,d){var m=null;l!==null&&l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(m=l.memoizedState.cachePool.pool),l=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(l=d.memoizedState.cachePool.pool),l!==m&&(l!=null&&l.refCount++,m!=null&&Vt(m))}function og(l,d){l=null,d.alternate!==null&&(l=d.alternate.memoizedState.cache),(d=d.memoizedState.cache)!==l&&(d.refCount++,l!=null&&Vt(l))}function ao(l,d,m,S){if(10256&d.subtreeFlags)for(d=d.child;d!==null;)Ju(l,d,m,S),d=d.sibling}function Ju(l,d,m,S){var R=d.flags;switch(d.tag){case 0:case 11:case 15:ao(l,d,m,S),2048&R&&gd(9,d);break;case 3:ao(l,d,m,S),2048&R&&(l=null,d.alternate!==null&&(l=d.alternate.memoizedState.cache),(d=d.memoizedState.cache)!==l&&(d.refCount++,l!=null&&Vt(l)));break;case 12:if(2048&R){ao(l,d,m,S),l=d.stateNode;try{var P=d.memoizedProps,V=P.id,K=P.onPostCommit;typeof K=="function"&&K(V,d.alternate===null?"mount":"update",l.passiveEffectDuration,-0)}catch(ee){fn(d,d.return,ee)}}else ao(l,d,m,S);break;case 23:break;case 22:P=d.stateNode,d.memoizedState!==null?4&P.yt?ao(l,d,m,S):Zu(l,d):4&P.yt?ao(l,d,m,S):(P.yt|=4,Bo(l,d,m,S,!!(10256&d.subtreeFlags))),2048&R&&ag(d.alternate,d);break;case 24:ao(l,d,m,S),2048&R&&og(d.alternate,d);break;default:ao(l,d,m,S)}}function Bo(l,d,m,S,R){for(R=R&&!!(10256&d.subtreeFlags),d=d.child;d!==null;){var P=l,V=d,K=m,ee=S,pe=V.flags;switch(V.tag){case 0:case 11:case 15:Bo(P,V,K,ee,R),gd(8,V);break;case 23:break;case 22:var Ne=V.stateNode;V.memoizedState!==null?4&Ne.yt?Bo(P,V,K,ee,R):Zu(P,V):(Ne.yt|=4,Bo(P,V,K,ee,R)),R&&2048&pe&&ag(V.alternate,V);break;case 24:Bo(P,V,K,ee,R),R&&2048&pe&&og(V.alternate,V);break;default:Bo(P,V,K,ee,R)}d=d.sibling}}function Zu(l,d){if(10256&d.subtreeFlags)for(d=d.child;d!==null;){var m=l,S=d,R=S.flags;switch(S.tag){case 22:Zu(m,S),2048&R&&ag(S.alternate,S);break;case 24:Zu(m,S),2048&R&&og(S.alternate,S);break;default:Zu(m,S)}d=d.sibling}}var vd=8192;function Vl(l){if(l.subtreeFlags&vd)for(l=l.child;l!==null;)Wh(l),l=l.sibling}function Wh(l){switch(l.tag){case 26:Vl(l),l.flags&vd&&l.memoizedState!==null&&function(m,S,R){if(Yo===null)throw Error(s(475));var P=Yo;if(!(S.type!=="stylesheet"||typeof R.media=="string"&&matchMedia(R.media).matches===!1||4&S.state.loading)){if(S.instance===null){var V=hs(R.href),K=m.querySelector(of(V));if(K)return(m=K.Mt)!==null&&typeof m=="object"&&typeof m.then=="function"&&(P.count++,P=hf.bind(P),m.then(P,P)),S.state.loading|=4,S.instance=K,void gr(K);K=m.ownerDocument||m,R=x1(R),(V=Ti.get(V))&&Mg(R,V),gr(K=K.createElement("link"));var ee=K;ee.Mt=new Promise(function(pe,Ne){ee.onload=pe,ee.onerror=Ne}),Zr(K,"link",R),S.instance=K}P.stylesheets===null&&(P.stylesheets=new Map),P.stylesheets.set(S,m),(m=S.state.preload)&&!(3&S.state.loading)&&(P.count++,S=hf.bind(P),m.addEventListener("load",S),m.addEventListener("error",S))}}($i,l.memoizedState,l.memoizedProps);break;case 5:default:Vl(l);break;case 3:case 4:var d=$i;$i=Ld(l.stateNode.containerInfo),Vl(l),$i=d;break;case 22:l.memoizedState===null&&((d=l.alternate)!==null&&d.memoizedState!==null?(d=vd,vd=16777216,Vl(l),vd=d):Vl(l))}}function Yh(l){var d=l.alternate;if(d!==null&&(l=d.child)!==null){d.child=null;do d=l.sibling,l.sibling=null,l=d;while(l!==null)}}function jy(l){var d=l.deletions;if(16&l.flags){if(d!==null)for(var m=0;m<d.length;m++){var S=d[m];Xr=S,us(S,l)}Yh(l)}if(10256&l.subtreeFlags)for(l=l.child;l!==null;)lg(l),l=l.sibling}function lg(l){switch(l.tag){case 0:case 11:case 15:jy(l),2048&l.flags&&Fo(9,l,l.return);break;case 3:case 12:default:jy(l);break;case 22:var d=l.stateNode;l.memoizedState!==null&&4&d.yt&&(l.return===null||l.return.tag!==13)?(d.yt&=-5,bd(l)):jy(l)}}function bd(l){var d=l.deletions;if(16&l.flags){if(d!==null)for(var m=0;m<d.length;m++){var S=d[m];Xr=S,us(S,l)}Yh(l)}for(l=l.child;l!==null;){switch((d=l).tag){case 0:case 11:case 15:Fo(8,d,d.return),bd(d);break;case 22:4&(m=d.stateNode).yt&&(m.yt&=-5,bd(d));break;default:bd(d)}l=l.sibling}}function us(l,d){for(;Xr!==null;){var m=Xr;switch(m.tag){case 0:case 11:case 15:Fo(8,m,d);break;case 23:case 22:if(m.memoizedState!==null&&m.memoizedState.cachePool!==null){var S=m.memoizedState.cachePool.pool;S!=null&&S.refCount++}break;case 24:Vt(m.memoizedState.cache)}if((S=m.child)!==null)S.return=m,Xr=S;else e:for(m=l;Xr!==null;){var R=(S=Xr).sibling,P=S.return;if(Uy(S),S===m){Xr=null;break e}if(R!==null){R.return=P,Xr=R;break e}Xr=P}}}function v1(l,d,m,S){this.tag=l,this.key=m,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=S,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ls(l,d,m,S){return new v1(l,d,m,S)}function ug(l){return!(!(l=l.prototype)||!l.isReactComponent)}function $o(l,d){var m=l.alternate;return m===null?((m=Ls(l.tag,d,l.key,l.mode)).elementType=l.elementType,m.type=l.type,m.stateNode=l.stateNode,m.alternate=l,l.alternate=m):(m.pendingProps=d,m.type=l.type,m.flags=0,m.subtreeFlags=0,m.deletions=null),m.flags=31457280&l.flags,m.childLanes=l.childLanes,m.lanes=l.lanes,m.child=l.child,m.memoizedProps=l.memoizedProps,m.memoizedState=l.memoizedState,m.updateQueue=l.updateQueue,d=l.dependencies,m.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},m.sibling=l.sibling,m.index=l.index,m.ref=l.ref,m.refCleanup=l.refCleanup,m}function Gy(l,d){l.flags&=31457282;var m=l.alternate;return m===null?(l.childLanes=0,l.lanes=d,l.child=null,l.subtreeFlags=0,l.memoizedProps=null,l.memoizedState=null,l.updateQueue=null,l.dependencies=null,l.stateNode=null):(l.childLanes=m.childLanes,l.lanes=m.lanes,l.child=m.child,l.subtreeFlags=0,l.deletions=null,l.memoizedProps=m.memoizedProps,l.memoizedState=m.memoizedState,l.updateQueue=m.updateQueue,l.type=m.type,d=m.dependencies,l.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext}),l}function Ed(l,d,m,S,R,P){var V=0;if(S=l,typeof l=="function")ug(l)&&(V=1);else if(typeof l=="string")V=function(K,ee,pe){if(pe===1||ee.itemProp!=null)return!1;switch(K){case"meta":case"title":return!0;case"style":if(typeof ee.precedence!="string"||typeof ee.href!="string"||ee.href==="")break;return!0;case"link":if(typeof ee.rel!="string"||typeof ee.href!="string"||ee.href===""||ee.onLoad||ee.onError)break;return ee.rel!=="stylesheet"||(K=ee.disabled,typeof ee.precedence=="string"&&K==null);case"script":if(ee.async&&typeof ee.async!="function"&&typeof ee.async!="symbol"&&!ee.onLoad&&!ee.onError&&ee.src&&typeof ee.src=="string")return!0}return!1}(l,m,bt.current)?26:l==="html"||l==="head"||l==="body"?27:5;else e:switch(l){case y:return jo(m.children,R,P,d);case E:V=8,R|=24;break;case A:return(l=Ls(12,m,d,2|R)).elementType=A,l.lanes=P,l;case U:return(l=Ls(13,m,d,R)).elementType=U,l.lanes=P,l;case $:return(l=Ls(19,m,d,R)).elementType=$,l.lanes=P,l;case Z:return cg(m,R,P,d);default:if(typeof l=="object"&&l!==null)switch(l.$$typeof){case L:case M:V=10;break e;case T:V=9;break e;case O:V=11;break e;case z:V=14;break e;case Q:V=16,S=null;break e}V=29,m=Error(s(130,l===null?"null":typeof l,"")),S=null}return(d=Ls(V,m,d,R)).elementType=l,d.type=S,d.lanes=P,d}function jo(l,d,m,S){return(l=Ls(7,l,S,d)).lanes=m,l}function cg(l,d,m,S){(l=Ls(22,l,S,d)).elementType=Z,l.lanes=m;var R={yt:1,bt:1,It:null,Tt:null,Lt:null,At:null,detach:function(){var P=R.At;if(P===null)throw Error(s(456));if(!(2&R.bt)){var V=ts(P,2);V!==null&&(R.bt|=2,di(V,P,2))}},attach:function(){var P=R.At;if(P===null)throw Error(s(456));if(2&R.bt){var V=ts(P,2);V!==null&&(R.bt&=-3,di(V,P,2))}}};return l.stateNode=R,l}function Td(l,d,m){return(l=Ls(6,l,null,d)).lanes=m,l}function dg(l,d,m){return(d=Ls(4,l.children!==null?l.children:[],l.key,d)).lanes=m,d.stateNode={containerInfo:l.containerInfo,pendingChildren:null,implementation:l.implementation},d}function wa(l){l.flags|=4}function cs(l,d){if(d.type!=="stylesheet"||4&d.state.loading)l.flags&=-16777217;else if(l.flags|=16777216,!df(d)){if((d=oi.current)!==null&&((4194176&Fn)===Fn?rs!==null:(62914560&Fn)!==Fn&&!(536870912&Fn)||d!==rs))throw rd=xh,xp;l.flags|=8192}}function Qh(l,d){d!==null&&(l.flags|=4),16384&l.flags&&(d=l.tag!==22?Nm():536870912,l.lanes|=d,Xs|=d)}function Go(l,d){if(!Ln)switch(l.tailMode){case"hidden":d=l.tail;for(var m=null;d!==null;)d.alternate!==null&&(m=d),d=d.sibling;m===null?l.tail=null:m.sibling=null;break;case"collapsed":m=l.tail;for(var S=null;m!==null;)m.alternate!==null&&(S=m),m=m.sibling;S===null?d||l.tail===null?l.tail=null:l.tail.sibling=null:S.sibling=null}}function Dr(l){var d=l.alternate!==null&&l.alternate.child===l.child,m=0,S=0;if(d)for(var R=l.child;R!==null;)m|=R.lanes|R.childLanes,S|=31457280&R.subtreeFlags,S|=31457280&R.flags,R.return=l,R=R.sibling;else for(R=l.child;R!==null;)m|=R.lanes|R.childLanes,S|=R.subtreeFlags,S|=R.flags,R.return=l,R=R.sibling;return l.subtreeFlags|=S,l.childLanes=m,d}function Hy(l,d,m){var S=d.pendingProps;switch(Ks(d),d.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:case 1:return Dr(d),null;case 3:return m=d.stateNode,S=null,l!==null&&(S=l.memoizedState.cache),d.memoizedState.cache!==S&&(d.flags|=2048),Yr(Tr),Rt(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),l!==null&&l.child!==null||(Wn(d)?wa(d):l===null||l.memoizedState.isDehydrated&&!(256&d.flags)||(d.flags|=1024,rn!==null&&(mg(rn),rn=null))),Dr(d),null;case 26:return m=d.memoizedState,l===null?(wa(d),m!==null?(Dr(d),cs(d,m)):(Dr(d),d.flags&=-16777217)):m?m!==l.memoizedState?(wa(d),Dr(d),cs(d,m)):(Dr(d),d.flags&=-16777217):(l.memoizedProps!==S&&wa(d),Dr(d),d.flags&=-16777217),null;case 27:$s(d),m=Un.current;var R=d.type;if(l!==null&&d.stateNode!=null)l.memoizedProps!==S&&wa(d);else{if(!S){if(d.stateNode===null)throw Error(s(166));return Dr(d),null}l=bt.current,Wn(d)?kp(d):(l=lv(R,S,m),d.stateNode=l,wa(d))}return Dr(d),null;case 5:if($s(d),m=d.type,l!==null&&d.stateNode!=null)l.memoizedProps!==S&&wa(d);else{if(!S){if(d.stateNode===null)throw Error(s(166));return Dr(d),null}if(l=bt.current,Wn(d))kp(d);else{switch(R=cc(Un.current),l){case 1:l=R.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:l=R.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":l=R.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":l=R.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":(l=R.createElement("div")).innerHTML="<script><\/script>",l=l.removeChild(l.firstChild);break;case"select":l=typeof S.is=="string"?R.createElement("select",{is:S.is}):R.createElement("select"),S.multiple?l.multiple=!0:S.size&&(l.size=S.size);break;default:l=typeof S.is=="string"?R.createElement(m,{is:S.is}):R.createElement(m)}}l[Hr]=d,l[mi]=S;e:for(R=d.child;R!==null;){if(R.tag===5||R.tag===6)l.appendChild(R.stateNode);else if(R.tag!==4&&R.tag!==27&&R.child!==null){R.child.return=R,R=R.child;continue}if(R===d)break e;for(;R.sibling===null;){if(R.return===null||R.return===d)break e;R=R.return}R.sibling.return=R.return,R=R.sibling}d.stateNode=l;e:switch(Zr(l,m,S),m){case"button":case"input":case"select":case"textarea":l=!!S.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&wa(d)}}return Dr(d),d.flags&=-16777217,null;case 6:if(l&&d.stateNode!=null)l.memoizedProps!==S&&wa(d);else{if(typeof S!="string"&&d.stateNode===null)throw Error(s(166));if(l=Un.current,Wn(d)){if(l=d.stateNode,m=d.memoizedProps,S=null,(R=Di)!==null)switch(R.tag){case 27:case 5:S=R.memoizedProps}l[Hr]=d,(l=!!(l.nodeValue===m||S!==null&&S.suppressHydrationWarning===!0||nf(l.nodeValue,m)))||va(d)}else(l=cc(l).createTextNode(S))[Hr]=d,d.stateNode=l}return Dr(d),null;case 13:if(S=d.memoizedState,l===null||l.memoizedState!==null&&l.memoizedState.dehydrated!==null){if(R=Wn(d),S!==null&&S.dehydrated!==null){if(l===null){if(!R)throw Error(s(318));if(!(R=(R=d.memoizedState)!==null?R.dehydrated:null))throw Error(s(317));R[Hr]=d}else ws(),!(128&d.flags)&&(d.memoizedState=null),d.flags|=4;Dr(d),R=!1}else rn!==null&&(mg(rn),rn=null),R=!0;if(!R)return 256&d.flags?(zr(d),d):(zr(d),null)}if(zr(d),128&d.flags)return d.lanes=m,d;if(m=S!==null,l=l!==null&&l.memoizedState!==null,m){R=null,(S=d.child).alternate!==null&&S.alternate.memoizedState!==null&&S.alternate.memoizedState.cachePool!==null&&(R=S.alternate.memoizedState.cachePool.pool);var P=null;S.memoizedState!==null&&S.memoizedState.cachePool!==null&&(P=S.memoizedState.cachePool.pool),P!==R&&(S.flags|=2048)}return m!==l&&m&&(d.child.flags|=8192),Qh(d,d.updateQueue),Dr(d),null;case 4:return Rt(),l===null&&tf(d.stateNode.containerInfo),Dr(d),null;case 10:return Yr(d.type),Dr(d),null;case 19:if(Ot(dr),(R=d.memoizedState)===null)return Dr(d),null;if(S=!!(128&d.flags),(P=R.rendering)===null)if(S)Go(R,!1);else{if(Pr!==0||l!==null&&128&l.flags)for(l=d.child;l!==null;){if((P=jn(l))!==null){for(d.flags|=128,Go(R,!1),l=P.updateQueue,d.updateQueue=l,Qh(d,l),d.subtreeFlags=0,l=m,m=d.child;m!==null;)Gy(m,l),m=m.sibling;return gn(dr,1&dr.current|2),d.child}l=l.sibling}R.tail!==null&&Dn()>Ad&&(d.flags|=128,S=!0,Go(R,!1),d.lanes=4194304)}else{if(!S)if((l=jn(P))!==null){if(d.flags|=128,S=!0,l=l.updateQueue,d.updateQueue=l,Qh(d,l),Go(R,!0),R.tail===null&&R.tailMode==="hidden"&&!P.alternate&&!Ln)return Dr(d),null}else 2*Dn()-R.renderingStartTime>Ad&&m!==536870912&&(d.flags|=128,S=!0,Go(R,!1),d.lanes=4194304);R.isBackwards?(P.sibling=d.child,d.child=P):((l=R.last)!==null?l.sibling=P:d.child=P,R.last=P)}return R.tail!==null?(d=R.tail,R.rendering=d,R.tail=d.sibling,R.renderingStartTime=Dn(),d.sibling=null,l=dr.current,gn(dr,S?1&l|2:1&l),d):(Dr(d),null);case 22:case 23:return zr(d),ns(),S=d.memoizedState!==null,l!==null?l.memoizedState!==null!==S&&(d.flags|=8192):S&&(d.flags|=8192),S?536870912&m&&!(128&d.flags)&&(Dr(d),6&d.subtreeFlags&&(d.flags|=8192)):Dr(d),(m=d.updateQueue)!==null&&Qh(d,m.retryQueue),m=null,l!==null&&l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(m=l.memoizedState.cachePool.pool),S=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(S=d.memoizedState.cachePool.pool),S!==m&&(d.flags|=2048),l!==null&&Ot(Ja),null;case 24:return m=null,l!==null&&(m=l.memoizedState.cache),d.memoizedState.cache!==m&&(d.flags|=2048),Yr(Tr),Dr(d),null;case 25:return null}throw Error(s(156,d.tag))}function Vy(l,d){switch(Ks(d),d.tag){case 1:return 65536&(l=d.flags)?(d.flags=-65537&l|128,d):null;case 3:return Yr(Tr),Rt(),65536&(l=d.flags)&&!(128&l)?(d.flags=-65537&l|128,d):null;case 26:case 27:case 5:return $s(d),null;case 13:if(zr(d),(l=d.memoizedState)!==null&&l.dehydrated!==null){if(d.alternate===null)throw Error(s(340));ws()}return 65536&(l=d.flags)?(d.flags=-65537&l|128,d):null;case 19:return Ot(dr),null;case 4:return Rt(),null;case 10:return Yr(d.type),null;case 22:case 23:return zr(d),ns(),l!==null&&Ot(Ja),65536&(l=d.flags)?(d.flags=-65537&l|128,d):null;case 24:return Yr(Tr),null;default:return null}}function ec(l,d){switch(Ks(d),d.tag){case 3:Yr(Tr),Rt();break;case 26:case 27:case 5:$s(d);break;case 4:Rt();break;case 13:zr(d);break;case 19:Ot(dr);break;case 10:Yr(d.type);break;case 22:case 23:zr(d),ns(),l!==null&&Ot(Ja);break;case 24:Yr(Tr)}}var Sd={getCacheForType:function(l){var d=Qr(Tr),m=d.data.get(l);return m===void 0&&(m=l(),d.data.set(l,m)),m}},QT=typeof WeakMap=="function"?WeakMap:Map,Sr=0,yr=null,wn=null,Fn=0,Oe=0,Pi=null,An=!1,ds=!1,Xh=!1,Aa=0,Pr=0,Ho=0,Kl=0,hg=0,Rs=0,Xs=0,wd=null,ka=null,tc=!1,fg=0,Ad=1/0,Jh=null,oo=null,Zh=!1,Js=null,kd=0,pg=0,ef=null,nc=0,gg=null;function Mi(){return 2&Sr&&Fn!==0?Fn&-Fn:ce.T!==null?Ya!==0?Ya:ql():_m()}function Ky(){Rs===0&&(Rs=536870912&Fn&&!Ln?536870912:Bn());var l=oi.current;return l!==null&&(l.flags|=32),Rs}function di(l,d,m){(l===yr&&Oe===2||l.cancelPendingCommit!==null)&&(Vo(l,0),lo(l,Fn,Rs,!1)),Tl(l,m),2&Sr&&l===yr||(l===yr&&(!(2&Sr)&&(Kl|=m),Pr===4&&lo(l,Fn,Rs,!1)),pt(l))}function rc(l,d,m){if(6&Sr)throw Error(s(327));for(var S=!m&&!(60&d)&&!(d&l.expiredLanes)||$c(l,d),R=S?function(pe,Ne){var qe=Sr;Sr|=2;var Ue=qy(),Ze=bg();yr!==pe||Fn!==Ne?(Jh=null,Ad=Dn()+500,Vo(pe,Ne)):ds=$c(pe,Ne);e:for(;;)try{if(Oe!==0&&wn!==null){Ne=wn;var Xe=Pi;t:switch(Oe){case 1:Oe=0,Pi=null,ac(pe,Ne,Xe,1);break;case 2:if(uy(Xe)){Oe=0,Pi=null,Eg(Ne);break}Ne=function(){Oe===2&&yr===pe&&(Oe=7),pt(pe)},Xe.then(Ne,Ne);break e;case 3:Oe=7;break e;case 4:Oe=5;break e;case 7:uy(Xe)?(Oe=0,Pi=null,Eg(Ne)):(Oe=0,Pi=null,ac(pe,Ne,Xe,7));break;case 5:var Le=null;switch(wn.tag){case 26:Le=wn.memoizedState;case 5:case 27:var Te=wn;if(!Le||df(Le)){Oe=0,Pi=null;var Ie=Te.sibling;if(Ie!==null)wn=Ie;else{var Je=Te.return;Je!==null?(wn=Je,zo(Je)):wn=null}break t}}Oe=0,Pi=null,ac(pe,Ne,Xe,5);break;case 6:Oe=0,Pi=null,ac(pe,Ne,Xe,6);break;case 8:vg(),Pr=6;break e;default:throw Error(s(462))}}b1();break}catch(kt){zy(pe,kt)}return Xt=$l=null,ce.H=Ue,ce.A=Ze,Sr=qe,wn!==null?0:(yr=null,Fn=0,kh(),Pr)}(l,d):sc(l,d,!0),P=S;;){if(R===0){ds&&!S&&lo(l,d,0,!1);break}if(R===6)lo(l,d,0,!An);else{if(m=l.current.alternate,P&&!yg(m)){R=sc(l,d,!1),P=!1;continue}if(R===2){if(P=d,l.errorRecoveryDisabledLanes&P)var V=0;else V=(V=-536870913&l.pendingLanes)!==0?V:536870912&V?536870912:0;if(V!==0){d=V;e:{var K=l;R=wd;var ee=K.current.memoizedState.isDehydrated;if(ee&&(Vo(K,V).flags|=256),(V=sc(K,V,!1))!==2){if(Xh&&!ee){K.errorRecoveryDisabledLanes|=P,Kl|=P,R=4;break e}P=ka,ka=R,P!==null&&mg(P)}R=V}if(P=!1,R!==2)continue}}if(R===1){Vo(l,0),lo(l,d,0,!0);break}e:{switch(S=l,R){case 0:case 1:throw Error(s(345));case 4:if((4194176&d)===d){lo(S,d,Rs,!An);break e}break;case 2:ka=null;break;case 3:case 5:break;default:throw Error(s(329))}if(S.finishedWork=m,S.finishedLanes=d,(62914560&d)===d&&10<(P=fg+300-Dn())){if(lo(S,d,Rs,!An),Qi(S,0)!==0)break e;S.timeoutHandle=vr(ic.bind(null,S,m,ka,Jh,tc,d,Rs,Kl,Xs,An,2,-0,0),P)}else ic(S,m,ka,Jh,tc,d,Rs,Kl,Xs,An,0,-0,0)}}break}pt(l)}function mg(l){ka===null?ka=l:ka.push.apply(ka,l)}function ic(l,d,m,S,R,P,V,K,ee,pe,Ne,qe,Ue){var Ze=d.subtreeFlags;if((8192&Ze||!(16785408&~Ze))&&(Yo={stylesheets:null,count:0,unsuspend:Cd},Wh(d),(d=function(){if(Yo===null)throw Error(s(475));var Xe=Yo;return Xe.stylesheets&&Xe.count===0&&hc(Xe,Xe.stylesheets),0<Xe.count?function(Le){var Te=setTimeout(function(){if(Xe.stylesheets&&hc(Xe,Xe.stylesheets),Xe.unsuspend){var Ie=Xe.unsuspend;Xe.unsuspend=null,Ie()}},6e4);return Xe.unsuspend=Le,function(){Xe.unsuspend=null,clearTimeout(Te)}}:null}())!==null))return l.cancelPendingCommit=d(Xy.bind(null,l,m,S,R,V,K,ee,1,qe,Ue)),void lo(l,P,V,!pe);Xy(l,m,S,R,V,K,ee,Ne,qe,Ue)}function yg(l){for(var d=l;;){var m=d.tag;if((m===0||m===11||m===15)&&16384&d.flags&&(m=d.updateQueue)!==null&&(m=m.stores)!==null)for(var S=0;S<m.length;S++){var R=m[S],P=R.getSnapshot;R=R.value;try{if(!es(P(),R))return!1}catch{return!1}}if(m=d.child,16384&d.subtreeFlags&&m!==null)m.return=d,d=m;else{if(d===l)break;for(;d.sibling===null;){if(d.return===null||d.return===l)return!0;d=d.return}d.sibling.return=d.return,d=d.sibling}}return!0}function lo(l,d,m,S){d&=~hg,d&=~Kl,l.suspendedLanes|=d,l.pingedLanes&=~d,S&&(l.warmLanes|=d),S=l.expirationTimes;for(var R=d;0<R;){var P=31-Fi(R),V=1<<P;S[P]=-1,R&=~V}m!==0&&ja(l,m,d)}function Ei(){return!!(6&Sr)||(Wo(0),!1)}function vg(){if(wn!==null){if(Oe===0)var l=wn.return;else Xt=$l=null,Pp(l=wn),cn=null,qa=0,l=wn;for(;l!==null;)ec(l.alternate,l),l=l.return;wn=null}}function Vo(l,d){l.finishedWork=null,l.finishedLanes=0;var m=l.timeoutHandle;m!==-1&&(l.timeoutHandle=-1,w1(m)),(m=l.cancelPendingCommit)!==null&&(l.cancelPendingCommit=null,m()),vg(),yr=l,wn=m=$o(l.current,null),Fn=d,Oe=0,Pi=null,An=!1,ds=$c(l,d),Xh=!1,Xs=Rs=hg=Kl=Ho=Pr=0,ka=wd=null,tc=!1,8&d&&(d|=32&d);var S=l.entangledLanes;if(S!==0)for(l=l.entanglements,S&=d;0<S;){var R=31-Fi(S),P=1<<R;d|=l[R],S&=~P}return Aa=d,kh(),m}function zy(l,d){Tn=null,ce.H=to,d===As?(d=_n(),Oe=3):d===xp?(d=_n(),Oe=4):Oe=d===no?8:d!==null&&typeof d=="object"&&typeof d.then=="function"?6:1,Pi=d,wn===null&&(Pr=1,Uh(l,dt(d,l.current)))}function qy(){var l=ce.H;return ce.H=to,l===null?to:l}function bg(){var l=ce.A;return ce.A=Sd,l}function Ko(){Pr=4,An||(4194176&Fn)!==Fn&&oi.current!==null||(ds=!0),!(134217727&Ho)&&!(134217727&Kl)||yr===null||lo(yr,Fn,Rs,!1)}function sc(l,d,m){var S=Sr;Sr|=2;var R=qy(),P=bg();yr===l&&Fn===d||(Jh=null,Vo(l,d)),d=!1;var V=Pr;e:for(;;)try{if(Oe!==0&&wn!==null){var K=wn,ee=Pi;switch(Oe){case 8:vg(),V=6;break e;case 3:case 2:case 6:oi.current===null&&(d=!0);var pe=Oe;if(Oe=0,Pi=null,ac(l,K,ee,pe),m&&ds){V=0;break e}break;default:pe=Oe,Oe=0,Pi=null,ac(l,K,ee,pe)}}Wy(),V=Pr;break}catch(Ne){zy(l,Ne)}return d&&l.shellSuspendCounter++,Xt=$l=null,Sr=S,ce.H=R,ce.A=P,wn===null&&(yr=null,Fn=0,kh()),V}function Wy(){for(;wn!==null;)Yy(wn)}function b1(){for(;wn!==null&&!dp();)Yy(wn)}function Yy(l){var d=Ny(l.alternate,l,Aa);l.memoizedProps=l.pendingProps,d===null?zo(l):wn=d}function Eg(l){var d=l,m=d.alternate;switch(d.tag){case 15:case 0:d=p1(m,d,d.pendingProps,d.type,void 0,Fn);break;case 11:d=p1(m,d,d.pendingProps,d.type.render,d.ref,Fn);break;case 5:Pp(d);default:ec(m,d),d=Ny(m,d=wn=Gy(d,Aa),Aa)}l.memoizedProps=l.pendingProps,d===null?zo(l):wn=d}function ac(l,d,m,S){Xt=$l=null,Pp(d),cn=null,qa=0;var R=d.return;try{if(function(P,V,K,ee,pe){if(K.flags|=32768,ee!==null&&typeof ee=="object"&&typeof ee.then=="function"){if((V=K.alternate)!==null&&dd(V,K,pe,!0),(K=oi.current)!==null){switch(K.tag){case 13:return rs===null?Ko():K.alternate===null&&Pr===0&&(Pr=3),K.flags&=-257,K.flags|=65536,K.lanes=pe,ee===xh?K.flags|=16384:((V=K.updateQueue)===null?K.updateQueue=new Set([ee]):V.add(ee),Tg(P,ee,pe)),!1;case 22:return K.flags|=65536,ee===xh?K.flags|=16384:((V=K.updateQueue)===null?(V={transitions:null,markerInstances:null,retryQueue:new Set([ee])},K.updateQueue=V):(K=V.retryQueue)===null?V.retryQueue=new Set([ee]):K.add(ee),Tg(P,ee,pe)),!1}throw Error(s(435,K.tag))}return Tg(P,ee,pe),Ko(),!1}if(Ln)return(V=oi.current)!==null?(!(65536&V.flags)&&(V.flags|=256),V.flags|=65536,V.lanes=pe,ee!==Dl&&qs(dt(P=Error(s(422),{cause:ee}),K))):(ee!==Dl&&qs(dt(V=Error(s(423),{cause:ee}),K)),(P=P.current.alternate).flags|=65536,pe&=-pe,P.lanes|=pe,ee=dt(ee,K),ng(P,pe=cd(P.stateNode,ee,pe)),Pr!==4&&(Pr=2)),!1;var Ne=Error(s(520),{cause:ee});if(Ne=dt(Ne,K),wd===null?wd=[Ne]:wd.push(Ne),Pr!==4&&(Pr=2),V===null)return!0;ee=dt(ee,K),K=V;do{switch(K.tag){case 3:return K.flags|=65536,P=pe&-pe,K.lanes|=P,ng(K,P=cd(K.stateNode,ee,P)),!1;case 1:if(V=K.type,Ne=K.stateNode,!(128&K.flags||typeof V.getDerivedStateFromError!="function"&&(Ne===null||typeof Ne.componentDidCatch!="function"||oo!==null&&oo.has(Ne))))return K.flags|=65536,pe&=-pe,K.lanes|=pe,Ku(pe=Vu(pe),P,K,ee),ng(K,pe),!1}K=K.return}while(K!==null);return!1}(l,R,d,m,Fn))return Pr=1,Uh(l,dt(m,l.current)),void(wn=null)}catch(P){if(R!==null)throw wn=R,P;return Pr=1,Uh(l,dt(m,l.current)),void(wn=null)}32768&d.flags?(Ln||S===1?l=!0:ds||536870912&Fn?l=!1:(An=l=!0,(S===2||S===3||S===6)&&(S=oi.current)!==null&&S.tag===13&&(S.flags|=16384)),Qy(d,l)):zo(d)}function zo(l){var d=l;do{if(32768&d.flags)return void Qy(d,An);l=d.return;var m=Hy(d.alternate,d,Aa);if(m!==null)return void(wn=m);if((d=d.sibling)!==null)return void(wn=d);wn=d=l}while(d!==null);Pr===0&&(Pr=5)}function Qy(l,d){do{var m=Vy(l.alternate,l);if(m!==null)return m.flags&=32767,void(wn=m);if((m=l.return)!==null&&(m.flags|=32768,m.subtreeFlags=0,m.deletions=null),!d&&(l=l.sibling)!==null)return void(wn=l);wn=l=m}while(l!==null);Pr=6,wn=null}function Xy(l,d,m,S,R,P,V,K,ee,pe){var Ne=ce.T,qe=ot.p;try{ot.p=2,ce.T=null,function(Ue,Ze,Xe,Le,Te,Ie,Je,kt){do zl();while(Js!==null);if(6&Sr)throw Error(s(327));var St=Ue.finishedWork;if(Le=Ue.finishedLanes,St===null)return null;if(Ue.finishedWork=null,Ue.finishedLanes=0,St===Ue.current)throw Error(s(177));Ue.callbackNode=null,Ue.callbackPriority=0,Ue.cancelPendingCommit=null;var zt=St.lanes|St.childLanes;if(function(ut,Qn,It,jt,ft,Gt){var kn=ut.pendingLanes;ut.pendingLanes=It,ut.suspendedLanes=0,ut.pingedLanes=0,ut.warmLanes=0,ut.expiredLanes&=It,ut.entangledLanes&=It,ut.errorRecoveryDisabledLanes&=It,ut.shellSuspendCounter=0;var Ht=ut.entanglements,Ar=ut.expirationTimes,ji=ut.hiddenUpdates;for(It=kn&~It;0<It;){var jr=31-Fi(It),er=1<<jr;Ht[jr]=0,Ar[jr]=-1;var go=ji[jr];if(go!==null)for(ji[jr]=null,jr=0;jr<go.length;jr++){var gc=go[jr];gc!==null&&(gc.lane&=-536870913)}It&=~er}jt!==0&&ja(ut,jt,0),Gt!==0&&ft===0&&ut.tag!==0&&(ut.suspendedLanes|=Gt&~(kn&~Qn))}(Ue,Le,zt|=wp,Ie,Je,kt),Ue===yr&&(wn=yr=null,Fn=0),!(10256&St.subtreeFlags)&&!(10256&St.flags)||Zh||(Zh=!0,pg=zt,ef=Xe,function(ut,Qn){Ba(ut,Qn)}(ar,function(){return zl(),null})),Xe=!!(15990&St.flags),15990&St.subtreeFlags||Xe?(Xe=ce.T,ce.T=null,Ie=ot.p,ot.p=2,Je=Sr,Sr|=4,function(ut,Qn){if(ut=ut.containerInfo,uc=Pd,Sp(ut=Jc(ut))){if("selectionStart"in ut)var It={start:ut.selectionStart,end:ut.selectionEnd};else e:{var jt=(It=(It=ut.ownerDocument)&&It.defaultView||window).getSelection&&It.getSelection();if(jt&&jt.rangeCount!==0){It=jt.anchorNode;var ft=jt.anchorOffset,Gt=jt.focusNode;jt=jt.focusOffset;try{It.nodeType,Gt.nodeType}catch{It=null;break e}var kn=0,Ht=-1,Ar=-1,ji=0,jr=0,er=ut,go=null;t:for(;;){for(var gc;er!==It||ft!==0&&er.nodeType!==3||(Ht=kn+ft),er!==Gt||jt!==0&&er.nodeType!==3||(Ar=kn+jt),er.nodeType===3&&(kn+=er.nodeValue.length),(gc=er.firstChild)!==null;)go=er,er=gc;for(;;){if(er===ut)break t;if(go===It&&++ji===ft&&(Ht=kn),go===Gt&&++jr===jt&&(Ar=kn),(gc=er.nextSibling)!==null)break;go=(er=go).parentNode}er=gc}It=Ht===-1||Ar===-1?null:{start:Ht,end:Ar}}else It=null}It=It||{start:0,end:0}}else It=null;for(sv={focusedElem:ut,selectionRange:It},Pd=!1,Xr=Qn;Xr!==null;)if(ut=(Qn=Xr).child,1028&Qn.subtreeFlags&&ut!==null)ut.return=Qn,Xr=ut;else for(;Xr!==null;){switch(Gt=(Qn=Xr).alternate,ut=Qn.flags,Qn.tag){case 0:case 11:case 15:case 5:case 26:case 27:case 6:case 4:case 17:break;case 1:if(1024&ut&&Gt!==null){ut=void 0,It=Qn,ft=Gt.memoizedProps,Gt=Gt.memoizedState,jt=It.stateNode;try{var j1=Ul(It.type,ft,(It.elementType,It.type));ut=jt.getSnapshotBeforeUpdate(j1,Gt),jt.St=ut}catch(Gg){fn(It,It.return,Gg)}}break;case 3:if(1024&ut){if((It=(ut=Qn.stateNode.containerInfo).nodeType)===9)ov(ut);else if(It===1)switch(ut.nodeName){case"HEAD":case"HTML":case"BODY":ov(ut);break;default:ut.textContent=""}}break;default:if(1024&ut)throw Error(s(163))}if((ut=Qn.sibling)!==null){ut.return=Qn.return,Xr=ut;break}Xr=Qn.return}j1=sg,sg=!1}(Ue,St),ls(St,Ue),Q0(sv,Ue.containerInfo),Pd=!!uc,sv=uc=null,Ue.current=St,m1(Ue,St.alternate,St),lh(),Sr=Je,ot.p=Ie,ce.T=Xe):Ue.current=St,Zh?(Zh=!1,Js=Ue,kd=Le):Zs(Ue,zt),zt=Ue.pendingLanes,zt===0&&(oo=null),function(ut){if(Wi&&typeof Wi.onCommitFiberRoot=="function")try{Wi.onCommitFiberRoot(Nt,ut,void 0,!(128&~ut.current.flags))}catch{}}(St.stateNode),pt(Ue),Ze!==null)for(Te=Ue.onRecoverableError,St=0;St<Ze.length;St++)zt=Ze[St],Te(zt.value,{componentStack:zt.stack});3&kd&&zl(),zt=Ue.pendingLanes,4194218&Le&&42&zt?Ue===gg?nc++:(nc=0,gg=Ue):nc=0,Wo(0)}(l,d,m,S,qe,R,P,V)}finally{ce.T=Ne,ot.p=qe}}function Zs(l,d){(l.pooledCacheLanes&=d)==0&&(d=l.pooledCache)!=null&&(l.pooledCache=null,Vt(d))}function zl(){if(Js!==null){var l=Js,d=pg;pg=0;var m=jc(kd),S=ce.T,R=ot.p;try{if(ot.p=32>m?32:m,ce.T=null,Js===null)var P=!1;else{m=ef,ef=null;var V=Js,K=kd;if(Js=null,kd=0,6&Sr)throw Error(s(331));var ee=Sr;if(Sr|=4,lg(V.current),Ju(V,V.current,K,m),Sr=ee,Wo(0,!1),Wi&&typeof Wi.onPostCommitFiberRoot=="function")try{Wi.onPostCommitFiberRoot(Nt,V)}catch{}P=!0}return P}finally{ot.p=R,ce.T=S,Zs(l,d)}}return!1}function hi(l,d,m){d=dt(m,d),(l=Hl(l,d=cd(l.stateNode,d,2),2))!==null&&(Tl(l,2),pt(l))}function fn(l,d,m){if(l.tag===3)hi(l,l,m);else for(;d!==null;){if(d.tag===3){hi(d,l,m);break}if(d.tag===1){var S=d.stateNode;if(typeof d.type.getDerivedStateFromError=="function"||typeof S.componentDidCatch=="function"&&(oo===null||!oo.has(S))){l=dt(m,l),(S=Hl(d,m=Vu(2),2))!==null&&(Ku(m,S,d,l),Tl(S,2),pt(S));break}}d=d.return}}function Tg(l,d,m){var S=l.pingCache;if(S===null){S=l.pingCache=new QT;var R=new Set;S.set(d,R)}else(R=S.get(d))===void 0&&(R=new Set,S.set(d,R));R.has(m)||(Xh=!0,R.add(m),l=E1.bind(null,l,d,m),d.then(l,l))}function E1(l,d,m){var S=l.pingCache;S!==null&&S.delete(d),l.pingedLanes|=l.suspendedLanes&m,l.warmLanes&=~m,yr===l&&(Fn&m)===m&&(Pr===4||Pr===3&&(62914560&Fn)===Fn&&300>Dn()-fg?!(2&Sr)&&Vo(l,0):hg|=m,Xs===Fn&&(Xs=0)),pt(l)}function Sg(l,d){d===0&&(d=Nm()),(l=ts(l,d))!==null&&(Tl(l,d),pt(l))}function wg(l){var d=l.memoizedState,m=0;d!==null&&(m=d.retryLane),Sg(l,m)}function T1(l,d){var m=0;switch(l.tag){case 13:var S=l.stateNode,R=l.memoizedState;R!==null&&(m=R.retryLane);break;case 19:S=l.stateNode;break;case 22:S=l.stateNode.Tt;break;default:throw Error(s(314))}S!==null&&S.delete(d),Sg(l,m)}var At=null,qo=null,Ag=!1,oc=!1,kg=!1,uo=0;function pt(l){var d;l!==qo&&l.next===null&&(qo===null?At=qo=l:qo=qo.next=l),oc=!0,Ag||(Ag=!0,d=XT,A1(function(){6&Sr?Ba(fu,d):d()}))}function Wo(l,d){if(!kg&&oc){kg=!0;do for(var m=!1,S=At;S!==null;){if(l!==0){var R=S.pendingLanes;if(R===0)var P=0;else{var V=S.suspendedLanes,K=S.pingedLanes;P=(1<<31-Fi(42|l)+1)-1,P=201326677&(P&=R&~(V&~K))?201326677&P|1:P?2|P:0}P!==0&&(m=!0,ev(S,P))}else P=Fn,!(3&(P=Qi(S,S===yr?P:0)))||$c(S,P)||(m=!0,ev(S,P));S=S.next}while(m);kg=!1}}function XT(){oc=Ag=!1;var l=0;uo!==0&&(function(){var V=window.event;return V&&V.type==="popstate"?V!==Cg&&(Cg=V,!0):(Cg=null,!1)}()&&(l=uo),uo=0);for(var d=Dn(),m=null,S=At;S!==null;){var R=S.next,P=Jy(S,d);P===0?(S.next=null,m===null?At=R:m.next=R,R===null&&(qo=m)):(m=S,(l!==0||3&P)&&(oc=!0)),S=R}Wo(l)}function Jy(l,d){for(var m=l.suspendedLanes,S=l.pingedLanes,R=l.expirationTimes,P=-62914561&l.pendingLanes;0<P;){var V=31-Fi(P),K=1<<V,ee=R[V];ee===-1?K&m&&!(K&S)||(R[V]=Om(K,d)):ee<=d&&(l.expiredLanes|=K),P&=~K}if(m=Fn,m=Qi(l,l===(d=yr)?m:0),S=l.callbackNode,m===0||l===d&&Oe===2||l.cancelPendingCommit!==null)return S!==null&&S!==null&&mn(S),l.callbackNode=null,l.callbackPriority=0;if(!(3&m)||$c(l,m)){if((d=m&-m)===l.callbackPriority)return d;switch(S!==null&&mn(S),jc(m)){case 2:case 8:m=fr;break;case 32:default:m=ar;break;case 268435456:m=vs}return S=Zy.bind(null,l),m=Ba(m,S),l.callbackPriority=d,l.callbackNode=m,d}return S!==null&&S!==null&&mn(S),l.callbackPriority=2,l.callbackNode=null,2}function Zy(l,d){var m=l.callbackNode;if(zl()&&l.callbackNode!==m)return null;var S=Fn;return(S=Qi(l,l===yr?S:0))===0?null:(rc(l,S,d),Jy(l,Dn()),l.callbackNode!=null&&l.callbackNode===m?Zy.bind(null,l):null)}function ev(l,d){if(zl())return null;rc(l,d,!0)}function ql(){return uo===0&&(uo=Bn()),uo}function tv(l){return l==null||typeof l=="symbol"||typeof l=="boolean"?null:typeof l=="function"?l:Vc(""+l)}function Oi(l,d){var m=d.ownerDocument.createElement("input");return m.name=d.name,m.value=d.value,l.id&&m.setAttribute("form",l.id),d.parentNode.insertBefore(m,d),l=new FormData(l),m.parentNode.removeChild(m),l}for(var xt=0;xt<t1.length;xt++){var xg=t1[xt];Vs(xg.toLowerCase(),"on"+(xg[0].toUpperCase()+xg.slice(1)))}Vs(X0,"onAnimationEnd"),Vs(sy,"onAnimationIteration"),Vs(Ah,"onAnimationStart"),Vs("dblclick","onDoubleClick"),Vs("focusin","onFocus"),Vs("focusout","onBlur"),Vs(J0,"onTransitionRun"),Vs(Z0,"onTransitionStart"),Vs(e1,"onTransitionCancel"),Vs(ay,"onTransitionEnd"),Sl("onMouseEnter",["mouseout","mouseover"]),Sl("onMouseLeave",["mouseout","mouseover"]),Sl("onPointerEnter",["pointerout","pointerover"]),Sl("onPointerLeave",["pointerout","pointerover"]),Xi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Xi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Xi("onBeforeInput",["compositionend","keypress","textInput","paste"]),Xi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Xi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Xi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ct="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),nv=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ct));function rv(l,d){d=!!(4&d);for(var m=0;m<l.length;m++){var S=l[m],R=S.event;S=S.listeners;e:{var P=void 0;if(d)for(var V=S.length-1;0<=V;V--){var K=S[V],ee=K.instance,pe=K.currentTarget;if(K=K.listener,ee!==P&&R.isPropagationStopped())break e;P=K,R.currentTarget=pe;try{P(R)}catch(Ne){ud(Ne)}R.currentTarget=null,P=ee}else for(V=0;V<S.length;V++){if(ee=(K=S[V]).instance,pe=K.currentTarget,K=K.listener,ee!==P&&R.isPropagationStopped())break e;P=K,R.currentTarget=pe;try{P(R)}catch(Ne){ud(Ne)}R.currentTarget=null,P=ee}}}}function Rn(l,d){var m=d[dh];m===void 0&&(m=d[dh]=new Set);var S=l+"__bubble";m.has(S)||(S1(d,l,2,!1),m.add(S))}function Ig(l,d,m){var S=0;d&&(S|=4),S1(m,l,S,d)}var Lg="_reactListening"+Math.random().toString(36).slice(2);function tf(l){if(!l[Lg]){l[Lg]=!0,wo.forEach(function(m){m!=="selectionchange"&&(nv.has(m)||Ig(m,!1,l),Ig(m,!0,l))});var d=l.nodeType===9?l:l.ownerDocument;d===null||d[Lg]||(d[Lg]=!0,Ig("selectionchange",!1,d))}}function S1(l,d,m,S){switch(N1(d)){case 2:var R=M1;break;case 8:R=O1;break;default:R=Ng}m=R.bind(null,d,m,l),R=void 0,!Ci||d!=="touchstart"&&d!=="touchmove"&&d!=="wheel"||(R=!0),S?R!==void 0?l.addEventListener(d,m,{capture:!0,passive:R}):l.addEventListener(d,m,!0):R!==void 0?l.addEventListener(d,m,{passive:R}):l.addEventListener(d,m,!1)}function xd(l,d,m,S,R){var P=S;if(!(1&d||2&d||S===null))e:for(;;){if(S===null)return;var V=S.tag;if(V===3||V===4){var K=S.stateNode.containerInfo;if(K===R||K.nodeType===8&&K.parentNode===R)break;if(V===4)for(V=S.return;V!==null;){var ee=V.tag;if((ee===3||ee===4)&&((ee=V.stateNode.containerInfo)===R||ee.nodeType===8&&ee.parentNode===R))return;V=V.return}for(;K!==null;){if((V=Es(K))===null)return;if((ee=V.tag)===5||ee===6||ee===26||ee===27){S=P=V;continue e}K=K.parentNode}}S=S.return}Hs(function(){var pe=P,Ne=ko(m),qe=[];e:{var Ue=Ru.get(l);if(Ue!==void 0){var Ze=bu,Xe=l;switch(l){case"keypress":if(xl(m)===0)break e;case"keydown":case"keyup":Ze=zm;break;case"focusin":Xe="focus",Ze=gh;break;case"focusout":Xe="blur",Ze=gh;break;case"beforeblur":case"afterblur":Ze=gh;break;case"click":if(m.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ze=Il;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ze=Vm;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ze=qc;break;case X0:case sy:case Ah:Ze=mp;break;case ay:Ze=Tu;break;case"scroll":case"scrollend":Ze=Hm;break;case"wheel":Ze=yh;break;case"copy":case"cut":case"paste":Ze=Y0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ze=yp;break;case"toggle":case"beforetoggle":Ze=vp}var Le=!!(4&d),Te=!Le&&(l==="scroll"||l==="scrollend"),Ie=Le?Ue!==null?Ue+"Capture":null:Ue;Le=[];for(var Je,kt=pe;kt!==null;){var St=kt;if(Je=St.stateNode,(St=St.tag)!==5&&St!==26&&St!==27||Je===null||Ie===null||(St=Ri(kt,Ie))!=null&&Le.push(Wl(kt,St,Je)),Te)break;kt=kt.return}0<Le.length&&(Ue=new Ze(Ue,Xe,null,m,Ne),qe.push({event:Ue,listeners:Le}))}}if(!(7&d)){if(Ze=l==="mouseout"||l==="pointerout",(!(Ue=l==="mouseover"||l==="pointerover")||m===Er||!(Xe=m.relatedTarget||m.fromElement)||!Es(Xe)&&!Xe[Gs])&&(Ze||Ue)&&(Ue=Ne.window===Ne?Ne:(Ue=Ne.ownerDocument)?Ue.defaultView||Ue.parentWindow:window,Ze?(Ze=pe,(Xe=(Xe=m.relatedTarget||m.toElement)?Es(Xe):null)!==null&&(Te=de(Xe),Le=Xe.tag,Xe!==Te||Le!==5&&Le!==27&&Le!==6)&&(Xe=null)):(Ze=null,Xe=pe),Ze!==Xe)){if(Le=Il,St="onMouseLeave",Ie="onMouseEnter",kt="mouse",l!=="pointerout"&&l!=="pointerover"||(Le=yp,St="onPointerLeave",Ie="onPointerEnter",kt="pointer"),Te=Ze==null?Ue:Gc(Ze),Je=Xe==null?Ue:Gc(Xe),(Ue=new Le(St,kt+"leave",Ze,m,Ne)).target=Te,Ue.relatedTarget=Je,St=null,Es(Ne)===pe&&((Le=new Le(Ie,kt+"enter",Xe,m,Ne)).target=Je,Le.relatedTarget=Te,St=Le),Te=St,Ze&&Xe)e:{for(Ie=Xe,kt=0,Je=Le=Ze;Je;Je=lc(Je))kt++;for(Je=0,St=Ie;St;St=lc(St))Je++;for(;0<kt-Je;)Le=lc(Le),kt--;for(;0<Je-kt;)Ie=lc(Ie),Je--;for(;kt--;){if(Le===Ie||Ie!==null&&Le===Ie.alternate)break e;Le=lc(Le),Ie=lc(Ie)}Le=null}else Le=null;Ze!==null&&iv(qe,Ue,Ze,Le,!1),Xe!==null&&Te!==null&&iv(qe,Te,Xe,Le,!0)}if((Ze=(Ue=pe?Gc(pe):window).nodeName&&Ue.nodeName.toLowerCase())==="select"||Ze==="input"&&Ue.type==="file")var zt=Xm;else if(Ym(Ue))if(Jm)zt=ny;else{zt=Ep;var ut=Xc}else!(Ze=Ue.nodeName)||Ze.toLowerCase()!=="input"||Ue.type!=="checkbox"&&Ue.type!=="radio"?pe&&en(pe.elementType)&&(zt=Xm):zt=ty;switch(zt&&(zt=zt(l,pe))?Qm(qe,zt,m,Ne):(ut&&ut(l,Ue,pe),l==="focusout"&&pe&&Ue.type==="number"&&pe.memoizedProps.value!=null&&yu(Ue,"number",Ue.value)),ut=pe?Gc(pe):window,l){case"focusin":(Ym(ut)||ut.contentEditable==="true")&&(Zc=ut,ed=pe,Sh=null);break;case"focusout":Sh=ed=Zc=null;break;case"mousedown":qn=!0;break;case"contextmenu":case"mouseup":case"dragend":qn=!1,iy(qe,m,Ne);break;case"selectionchange":if(WT)break;case"keydown":case"keyup":iy(qe,m,Ne)}var Qn;if(Wc)e:{switch(l){case"compositionstart":var It="onCompositionStart";break e;case"compositionend":It="onCompositionEnd";break e;case"compositionupdate":It="onCompositionUpdate";break e}It=void 0}else Rl?Nn(l,m)&&(It="onCompositionEnd"):l==="keydown"&&m.keyCode===229&&(It="onCompositionStart");It&&(vh&&m.locale!=="ko"&&(Rl||It!=="onCompositionStart"?It==="onCompositionEnd"&&Rl&&(Qn=Ha()):($m="value"in(kl=Ne)?kl.value:kl.textContent,Rl=!0)),0<(ut=Id(pe,It)).length&&(It=new Ll(It,l,null,m,Ne),qe.push({event:It,listeners:ut}),(Qn||(Qn=Wm(m))!==null)&&(It.data=Qn))),(Qn=qm?function(jt,ft){switch(jt){case"compositionend":return Wm(ft);case"keypress":return ft.which!==32?null:(Au=!0,wu);case"textInput":return(jt=ft.data)===wu&&Au?null:jt;default:return null}}(l,m):function(jt,ft){if(Rl)return jt==="compositionend"||!Wc&&Nn(jt,ft)?(jt=Ha(),Ga=$m=kl=null,Rl=!1,jt):null;switch(jt){case"paste":default:return null;case"keypress":if(!(ft.ctrlKey||ft.altKey||ft.metaKey)||ft.ctrlKey&&ft.altKey){if(ft.char&&1<ft.char.length)return ft.char;if(ft.which)return String.fromCharCode(ft.which)}return null;case"compositionend":return vh&&ft.locale!=="ko"?null:ft.data}}(l,m))&&0<(It=Id(pe,"onBeforeInput")).length&&(ut=new Ll("onBeforeInput","beforeinput",null,m,Ne),qe.push({event:ut,listeners:It}),ut.data=Qn),function(jt,ft,Gt,kn,Ht){if(ft==="submit"&&Gt&&Gt.stateNode===Ht){var Ar=tv((Ht[mi]||null).action),ji=kn.submitter;ji&&(ft=(ft=ji[mi]||null)?tv(ft.formAction):ji.getAttribute("formAction"))!==null&&(Ar=ft,ji=null);var jr=new bu("action","action",null,kn,Ht);jt.push({event:jr,listeners:[{instance:null,listener:function(){if(kn.defaultPrevented){if(uo!==0){var er=ji?Oi(Ht,ji):new FormData(Ht);sn(Gt,{pending:!0,data:er,method:Ht.method,action:Ar},null,er)}}else typeof Ar=="function"&&(jr.preventDefault(),er=ji?Oi(Ht,ji):new FormData(Ht),sn(Gt,{pending:!0,data:er,method:Ht.method,action:Ar},Ar,er))},currentTarget:Ht}]})}}(qe,l,pe,m,Ne)}rv(qe,d)})}function Wl(l,d,m){return{instance:l,listener:d,currentTarget:m}}function Id(l,d){for(var m=d+"Capture",S=[];l!==null;){var R=l,P=R.stateNode;(R=R.tag)!==5&&R!==26&&R!==27||P===null||((R=Ri(l,m))!=null&&S.unshift(Wl(l,R,P)),(R=Ri(l,d))!=null&&S.push(Wl(l,R,P))),l=l.return}return S}function lc(l){if(l===null)return null;do l=l.return;while(l&&l.tag!==5&&l.tag!==27);return l||null}function iv(l,d,m,S,R){for(var P=d.vt,V=[];m!==null&&m!==S;){var K=m,ee=K.alternate,pe=K.stateNode;if(K=K.tag,ee!==null&&ee===S)break;K!==5&&K!==26&&K!==27||pe===null||(ee=pe,R?(pe=Ri(m,P))!=null&&V.unshift(Wl(m,pe,ee)):R||(pe=Ri(m,P))!=null&&V.push(Wl(m,pe,ee))),m=m.return}V.length!==0&&l.push({event:d,listeners:V})}var JT=/\r\n?/g,ZT=/\u0000|\uFFFD/g;function Rg(l){return(typeof l=="string"?l:""+l).replace(JT,`
`).replace(ZT,"")}function nf(l,d){return d=Rg(d),Rg(l)===d}function rf(){}function Zn(l,d,m,S,R,P){switch(m){case"children":typeof S=="string"?d==="body"||d==="textarea"&&S===""||Rr(l,S):(typeof S=="number"||typeof S=="bigint")&&d!=="body"&&Rr(l,""+S);break;case"className":mu(l,"class",S);break;case"tabIndex":mu(l,"tabindex",S);break;case"dir":case"role":case"viewBox":case"width":case"height":mu(l,m,S);break;case"style":Li(l,S,P);break;case"data":if(d!=="object"){mu(l,"data",S);break}case"src":case"href":if(S===""&&(d!=="a"||m!=="href")){l.removeAttribute(m);break}if(S==null||typeof S=="function"||typeof S=="symbol"||typeof S=="boolean"){l.removeAttribute(m);break}S=Vc(""+S),l.setAttribute(m,S);break;case"action":case"formAction":if(typeof S=="function"){l.setAttribute(m,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}if(typeof P=="function"&&(m==="formAction"?(d!=="input"&&Zn(l,d,"name",R.name,R,null),Zn(l,d,"formEncType",R.formEncType,R,null),Zn(l,d,"formMethod",R.formMethod,R,null),Zn(l,d,"formTarget",R.formTarget,R,null)):(Zn(l,d,"encType",R.encType,R,null),Zn(l,d,"method",R.method,R,null),Zn(l,d,"target",R.target,R,null))),S==null||typeof S=="symbol"||typeof S=="boolean"){l.removeAttribute(m);break}S=Vc(""+S),l.setAttribute(m,S);break;case"onClick":S!=null&&(l.onclick=rf);break;case"onScroll":S!=null&&Rn("scroll",l);break;case"onScrollEnd":S!=null&&Rn("scrollend",l);break;case"dangerouslySetInnerHTML":if(S!=null){if(typeof S!="object"||!("xt"in S))throw Error(s(61));if((m=S.xt)!=null){if(R.children!=null)throw Error(s(60));l.innerHTML=m}}break;case"multiple":l.multiple=S&&typeof S!="function"&&typeof S!="symbol";break;case"muted":l.muted=S&&typeof S!="function"&&typeof S!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":case"autoFocus":break;case"xlinkHref":if(S==null||typeof S=="function"||typeof S=="boolean"||typeof S=="symbol"){l.removeAttribute("xlink:href");break}m=Vc(""+S),l.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",m);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":S!=null&&typeof S!="function"&&typeof S!="symbol"?l.setAttribute(m,""+S):l.removeAttribute(m);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":S&&typeof S!="function"&&typeof S!="symbol"?l.setAttribute(m,""):l.removeAttribute(m);break;case"capture":case"download":S===!0?l.setAttribute(m,""):S!==!1&&S!=null&&typeof S!="function"&&typeof S!="symbol"?l.setAttribute(m,S):l.removeAttribute(m);break;case"cols":case"rows":case"size":case"span":S!=null&&typeof S!="function"&&typeof S!="symbol"&&!isNaN(S)&&1<=S?l.setAttribute(m,S):l.removeAttribute(m);break;case"rowSpan":case"start":S==null||typeof S=="function"||typeof S=="symbol"||isNaN(S)?l.removeAttribute(m):l.setAttribute(m,S);break;case"popover":Rn("beforetoggle",l),Rn("toggle",l),gu(l,"popover",S);break;case"xlinkActuate":pa(l,"http://www.w3.org/1999/xlink","xlink:actuate",S);break;case"xlinkArcrole":pa(l,"http://www.w3.org/1999/xlink","xlink:arcrole",S);break;case"xlinkRole":pa(l,"http://www.w3.org/1999/xlink","xlink:role",S);break;case"xlinkShow":pa(l,"http://www.w3.org/1999/xlink","xlink:show",S);break;case"xlinkTitle":pa(l,"http://www.w3.org/1999/xlink","xlink:title",S);break;case"xlinkType":pa(l,"http://www.w3.org/1999/xlink","xlink:type",S);break;case"xmlBase":pa(l,"http://www.w3.org/XML/1998/namespace","xml:base",S);break;case"xmlLang":pa(l,"http://www.w3.org/XML/1998/namespace","xml:lang",S);break;case"xmlSpace":pa(l,"http://www.w3.org/XML/1998/namespace","xml:space",S);break;case"is":gu(l,"is",S);break;case"innerText":case"textContent":break;default:(!(2<m.length)||m[0]!=="o"&&m[0]!=="O"||m[1]!=="n"&&m[1]!=="N")&&gu(l,m=_r.get(m)||m,S)}}function sf(l,d,m,S,R,P){switch(m){case"style":Li(l,S,P);break;case"dangerouslySetInnerHTML":if(S!=null){if(typeof S!="object"||!("xt"in S))throw Error(s(61));if((m=S.xt)!=null){if(R.children!=null)throw Error(s(60));l.innerHTML=m}}break;case"children":typeof S=="string"?Rr(l,S):(typeof S=="number"||typeof S=="bigint")&&Rr(l,""+S);break;case"onScroll":S!=null&&Rn("scroll",l);break;case"onScrollEnd":S!=null&&Rn("scrollend",l);break;case"onClick":S!=null&&(l.onclick=rf);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":case"innerText":case"textContent":break;default:pp.hasOwnProperty(m)||(m[0]!=="o"||m[1]!=="n"||(R=m.endsWith("Capture"),d=m.slice(2,R?m.length-7:void 0),typeof(P=(P=l[mi]||null)!=null?P[m]:null)=="function"&&l.removeEventListener(d,P,R),typeof S!="function")?m in l?l[m]=S:S===!0?l.setAttribute(m,""):gu(l,m,S):(typeof P!="function"&&P!==null&&(m in l?l[m]=null:l.hasAttribute(m)&&l.removeAttribute(m)),l.addEventListener(d,S,R)))}}function Zr(l,d,m){switch(d){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Rn("error",l),Rn("load",l);var S,R=!1,P=!1;for(S in m)if(m.hasOwnProperty(S)){var V=m[S];if(V!=null)switch(S){case"src":R=!0;break;case"srcSet":P=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,d));default:Zn(l,d,S,V,m,null)}}return P&&Zn(l,d,"srcSet",m.srcSet,m,null),void(R&&Zn(l,d,"src",m.src,m,null));case"input":Rn("invalid",l);var K=S=V=P=null,ee=null,pe=null;for(R in m)if(m.hasOwnProperty(R)){var Ne=m[R];if(Ne!=null)switch(R){case"name":P=Ne;break;case"type":V=Ne;break;case"checked":ee=Ne;break;case"defaultChecked":pe=Ne;break;case"value":S=Ne;break;case"defaultValue":K=Ne;break;case"children":case"dangerouslySetInnerHTML":if(Ne!=null)throw Error(s(137,d));break;default:Zn(l,d,R,Ne,m,null)}}return W0(l,S,K,ee,pe,V,P,!1),void wl(l);case"select":for(P in Rn("invalid",l),R=V=S=null,m)if(m.hasOwnProperty(P)&&(K=m[P])!=null)switch(P){case"value":S=K;break;case"defaultValue":V=K;break;case"multiple":R=K;default:Zn(l,d,P,K,m,null)}return d=S,m=V,l.multiple=!!R,void(d!=null?Ao(l,!!R,d,!1):m!=null&&Ao(l,!!R,m,!0));case"textarea":for(V in Rn("invalid",l),S=P=R=null,m)if(m.hasOwnProperty(V)&&(K=m[V])!=null)switch(V){case"value":R=K;break;case"defaultValue":P=K;break;case"children":S=K;break;case"dangerouslySetInnerHTML":if(K!=null)throw Error(s(91));break;default:Zn(l,d,V,K,m,null)}return fe(l,R,P,S),void wl(l);case"option":for(ee in m)m.hasOwnProperty(ee)&&(R=m[ee])!=null&&(ee==="selected"?l.selected=R&&typeof R!="function"&&typeof R!="symbol":Zn(l,d,ee,R,m,null));return;case"dialog":Rn("cancel",l),Rn("close",l);break;case"iframe":case"object":Rn("load",l);break;case"video":case"audio":for(R=0;R<ct.length;R++)Rn(ct[R],l);break;case"image":Rn("error",l),Rn("load",l);break;case"details":Rn("toggle",l);break;case"embed":case"source":case"link":Rn("error",l),Rn("load",l);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(pe in m)if(m.hasOwnProperty(pe)&&(R=m[pe])!=null)switch(pe){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,d));default:Zn(l,d,pe,R,m,null)}return;default:if(en(d)){for(Ne in m)m.hasOwnProperty(Ne)&&(R=m[Ne])!==void 0&&sf(l,d,Ne,R,m,void 0);return}}for(K in m)m.hasOwnProperty(K)&&(R=m[K])!=null&&Zn(l,d,K,R,m,null)}var uc=null,sv=null;function cc(l){return l.nodeType===9?l:l.ownerDocument}function Cs(l){switch(l){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function af(l,d){if(l===0)switch(d){case"svg":return 1;case"math":return 2;default:return 0}return l===1&&d==="foreignObject"?0:l}function dc(l,d){return l==="textarea"||l==="noscript"||typeof d.children=="string"||typeof d.children=="number"||typeof d.children=="bigint"||typeof d.dangerouslySetInnerHTML=="object"&&d.dangerouslySetInnerHTML!==null&&d.dangerouslySetInnerHTML.xt!=null}var Cg=null,vr=typeof setTimeout=="function"?setTimeout:void 0,w1=typeof clearTimeout=="function"?clearTimeout:void 0,av=typeof Promise=="function"?Promise:void 0,A1=typeof queueMicrotask=="function"?queueMicrotask:av!==void 0?function(l){return av.resolve(null).then(l).catch(k1)}:vr;function k1(l){setTimeout(function(){throw l})}function Dg(l,d){var m=d,S=0;do{var R=m.nextSibling;if(l.removeChild(m),R&&R.nodeType===8)if((m=R.data)==="/$"){if(S===0)return l.removeChild(R),void gf(d);S--}else m!=="$"&&m!=="$?"&&m!=="$!"||S++;m=R}while(m);gf(d)}function ov(l){var d=l.firstChild;for(d&&d.nodeType===10&&(d=d.nextSibling);d;){var m=d;switch(d=d.nextSibling,m.nodeName){case"HTML":case"HEAD":case"BODY":ov(m),fp(m);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(m.rel.toLowerCase()==="stylesheet")continue}l.removeChild(m)}}function ea(l){for(;l!=null;l=l.nextSibling){var d=l.nodeType;if(d===1||d===3)break;if(d===8){if((d=l.data)==="$"||d==="$!"||d==="$?"||d==="F!"||d==="F")break;if(d==="/$")return null}}return l}function qr(l){l=l.previousSibling;for(var d=0;l;){if(l.nodeType===8){var m=l.data;if(m==="$"||m==="$!"||m==="$?"){if(d===0)return l;d--}else m==="/$"&&d++}l=l.previousSibling}return null}function lv(l,d,m){switch(d=cc(m),l){case"html":if(!(l=d.documentElement))throw Error(s(452));return l;case"head":if(!(l=d.head))throw Error(s(453));return l;case"body":if(!(l=d.body))throw Error(s(454));return l;default:throw Error(s(451))}}var Ti=new Map,uv=new Set;function Ld(l){return typeof l.getRootNode=="function"?l.getRootNode():l.ownerDocument}var co=ot.d;ot.d={f:function(){var l=co.f(),d=Ei();return l||d},r:function(l){var d=ii(l);d!==null&&d.tag===5&&d.type==="form"?l1(d):co.r(l)},D:function(l){co.D(l),cv("dns-prefetch",l,null)},C:function(l,d){co.C(l,d),cv("preconnect",l,d)},L:function(l,d,m){co.L(l,d,m);var S=Yl;if(S&&l&&d){var R='link[rel="preload"][as="'+ga(d)+'"]';d==="image"&&m&&m.imageSrcSet?(R+='[imagesrcset="'+ga(m.imageSrcSet)+'"]',typeof m.imageSizes=="string"&&(R+='[imagesizes="'+ga(m.imageSizes)+'"]')):R+='[href="'+ga(l)+'"]';var P=R;switch(d){case"style":P=hs(l);break;case"script":P=Rd(l)}Ti.has(P)||(l=we({rel:"preload",href:d==="image"&&m&&m.imageSrcSet?void 0:l,as:d},m),Ti.set(P,l),S.querySelector(R)!==null||d==="style"&&S.querySelector(of(P))||d==="script"&&S.querySelector(lf(P))||(Zr(d=S.createElement("link"),"link",l),gr(d),S.head.appendChild(d)))}},m:function(l,d){co.m(l,d);var m=Yl;if(m&&l){var S=d&&typeof d.as=="string"?d.as:"script",R='link[rel="modulepreload"][as="'+ga(S)+'"][href="'+ga(l)+'"]',P=R;switch(S){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":P=Rd(l)}if(!Ti.has(P)&&(l=we({rel:"modulepreload",href:l},d),Ti.set(P,l),m.querySelector(R)===null)){switch(S){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(m.querySelector(lf(P)))return}Zr(S=m.createElement("link"),"link",l),gr(S),m.head.appendChild(S)}}},X:function(l,d){co.X(l,d);var m=Yl;if(m&&l){var S=Ts(m).hoistableScripts,R=Rd(l),P=S.get(R);P||((P=m.querySelector(lf(R)))||(l=we({src:l,async:!0},d),(d=Ti.get(R))&&uf(l,d),gr(P=m.createElement("script")),Zr(P,"link",l),m.head.appendChild(P)),P={type:"script",instance:P,count:1,state:null},S.set(R,P))}},S:function(l,d,m){co.S(l,d,m);var S=Yl;if(S&&l){var R=Ts(S).hoistableStyles,P=hs(l);d=d||"default";var V=R.get(P);if(!V){var K={loading:0,preload:null};if(V=S.querySelector(of(P)))K.loading=5;else{l=we({rel:"stylesheet",href:l,"data-precedence":d},m),(m=Ti.get(P))&&Mg(l,m);var ee=V=S.createElement("link");gr(ee),Zr(ee,"link",l),ee.Mt=new Promise(function(pe,Ne){ee.onload=pe,ee.onerror=Ne}),ee.addEventListener("load",function(){K.loading|=1}),ee.addEventListener("error",function(){K.loading|=2}),K.loading|=4,Pg(V,d,S)}V={type:"stylesheet",instance:V,count:1,state:K},R.set(P,V)}}},M:function(l,d){co.M(l,d);var m=Yl;if(m&&l){var S=Ts(m).hoistableScripts,R=Rd(l),P=S.get(R);P||((P=m.querySelector(lf(R)))||(l=we({src:l,async:!0,type:"module"},d),(d=Ti.get(R))&&uf(l,d),gr(P=m.createElement("script")),Zr(P,"link",l),m.head.appendChild(P)),P={type:"script",instance:P,count:1,state:null},S.set(R,P))}}};var Yl=typeof document>"u"?null:document;function cv(l,d,m){var S=Yl;if(S&&typeof d=="string"&&d){var R=ga(d);R='link[rel="'+l+'"][href="'+R+'"]',typeof m=="string"&&(R+='[crossorigin="'+m+'"]'),uv.has(R)||(uv.add(R),l={rel:l,crossOrigin:m,href:d},S.querySelector(R)===null&&(Zr(d=S.createElement("link"),"link",l),gr(d),S.head.appendChild(d)))}}function ho(l,d,m,S){var R,P,V,K,ee=(ee=Un.current)?Ld(ee):null;if(!ee)throw Error(s(446));switch(l){case"meta":case"title":return null;case"style":return typeof m.precedence=="string"&&typeof m.href=="string"?(d=hs(m.href),(S=(m=Ts(ee).hoistableStyles).get(d))||(S={type:"style",instance:null,count:0,state:null},m.set(d,S)),S):{type:"void",instance:null,count:0,state:null};case"link":if(m.rel==="stylesheet"&&typeof m.href=="string"&&typeof m.precedence=="string"){l=hs(m.href);var pe=Ts(ee).hoistableStyles,Ne=pe.get(l);if(Ne||(ee=ee.ownerDocument||ee,Ne={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},pe.set(l,Ne),(pe=ee.querySelector(of(l)))&&!pe.Mt&&(Ne.instance=pe,Ne.state.loading=5),Ti.has(l)||(m={rel:"preload",as:"style",href:m.href,crossOrigin:m.crossOrigin,integrity:m.integrity,media:m.media,hrefLang:m.hrefLang,referrerPolicy:m.referrerPolicy},Ti.set(l,m),pe||(R=ee,P=l,V=m,K=Ne.state,R.querySelector('link[rel="preload"][as="style"]['+P+"]")?K.loading=1:(P=R.createElement("link"),K.preload=P,P.addEventListener("load",function(){return K.loading|=1}),P.addEventListener("error",function(){return K.loading|=2}),Zr(P,"link",V),gr(P),R.head.appendChild(P))))),d&&S===null)throw Error(s(528,""));return Ne}if(d&&S!==null)throw Error(s(529,""));return null;case"script":return d=m.async,typeof(m=m.src)=="string"&&d&&typeof d!="function"&&typeof d!="symbol"?(d=Rd(m),(S=(m=Ts(ee).hoistableScripts).get(d))||(S={type:"script",instance:null,count:0,state:null},m.set(d,S)),S):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,l))}}function hs(l){return'href="'+ga(l)+'"'}function of(l){return'link[rel="stylesheet"]['+l+"]"}function x1(l){return we({},l,{"data-precedence":l.precedence,precedence:null})}function Rd(l){return'[src="'+ga(l)+'"]'}function lf(l){return"script[async]"+l}function I1(l,d,m){if(d.count++,d.instance===null)switch(d.type){case"style":var S=l.querySelector('style[data-href~="'+ga(m.href)+'"]');if(S)return d.instance=S,gr(S),S;var R=we({},m,{"data-href":m.href,"data-precedence":m.precedence,href:null,precedence:null});return gr(S=(l.ownerDocument||l).createElement("style")),Zr(S,"style",R),Pg(S,m.precedence,l),d.instance=S;case"stylesheet":R=hs(m.href);var P=l.querySelector(of(R));if(P)return d.state.loading|=4,d.instance=P,gr(P),P;S=x1(m),(R=Ti.get(R))&&Mg(S,R),gr(P=(l.ownerDocument||l).createElement("link"));var V=P;return V.Mt=new Promise(function(K,ee){V.onload=K,V.onerror=ee}),Zr(P,"link",S),d.state.loading|=4,Pg(P,m.precedence,l),d.instance=P;case"script":return P=Rd(m.src),(R=l.querySelector(lf(P)))?(d.instance=R,gr(R),R):(S=m,(R=Ti.get(P))&&uf(S=we({},m),R),gr(R=(l=l.ownerDocument||l).createElement("script")),Zr(R,"link",S),l.head.appendChild(R),d.instance=R);case"void":return null;default:throw Error(s(443,d.type))}else d.type==="stylesheet"&&!(4&d.state.loading)&&(S=d.instance,d.state.loading|=4,Pg(S,m.precedence,l));return d.instance}function Pg(l,d,m){for(var S=m.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),R=S.length?S[S.length-1]:null,P=R,V=0;V<S.length;V++){var K=S[V];if(K.dataset.precedence===d)P=K;else if(P!==R)break}P?P.parentNode.insertBefore(l,P.nextSibling):(d=m.nodeType===9?m.head:m).insertBefore(l,d.firstChild)}function Mg(l,d){l.crossOrigin==null&&(l.crossOrigin=d.crossOrigin),l.referrerPolicy==null&&(l.referrerPolicy=d.referrerPolicy),l.title==null&&(l.title=d.title)}function uf(l,d){l.crossOrigin==null&&(l.crossOrigin=d.crossOrigin),l.referrerPolicy==null&&(l.referrerPolicy=d.referrerPolicy),l.integrity==null&&(l.integrity=d.integrity)}var cf=null;function dv(l,d,m){if(cf===null){var S=new Map,R=cf=new Map;R.set(m,S)}else(S=(R=cf).get(m))||(S=new Map,R.set(m,S));if(S.has(l))return S;for(S.set(l,null),m=m.getElementsByTagName(l),R=0;R<m.length;R++){var P=m[R];if(!(P[pu]||P[Hr]||l==="link"&&P.getAttribute("rel")==="stylesheet")&&P.namespaceURI!=="http://www.w3.org/2000/svg"){var V=P.getAttribute(d)||"";V=l+V;var K=S.get(V);K?K.push(P):S.set(V,[P])}}return S}function Og(l,d,m){(l=l.ownerDocument||l).head.insertBefore(m,d==="title"?l.querySelector("head > title"):null)}function df(l){return!!(l.type!=="stylesheet"||3&l.state.loading)}var Yo=null;function Cd(){}function hf(){if(this.count--,this.count===0){if(this.stylesheets)hc(this,this.stylesheets);else if(this.unsuspend){var l=this.unsuspend;this.unsuspend=null,l()}}}var ta=null;function hc(l,d){l.stylesheets=null,l.unsuspend!==null&&(l.count++,ta=new Map,d.forEach(L1,l),ta=null,hf.call(l))}function L1(l,d){if(!(4&d.state.loading)){var m=ta.get(l);if(m)var S=m.get(null);else{m=new Map,ta.set(l,m);for(var R=l.querySelectorAll("link[data-precedence],style[data-precedence]"),P=0;P<R.length;P++){var V=R[P];V.nodeName!=="LINK"&&V.getAttribute("media")==="not all"||(m.set(V.dataset.precedence,V),S=V)}S&&m.set(null,S)}V=(R=d.instance).getAttribute("data-precedence"),(P=m.get(V)||S)===S&&m.set(null,R),m.set(V,R),this.count++,S=hf.bind(this),R.addEventListener("load",S),R.addEventListener("error",S),P?P.parentNode.insertBefore(R,P.nextSibling):(l=l.nodeType===9?l.head:l).insertBefore(R,l.firstChild),d.state.loading|=4}}var Dd={$$typeof:M,Provider:null,Consumer:null,ut:lt,lt,ct:0};function R1(l,d,m,S,R,P,V,K){this.tag=1,this.containerInfo=l,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ch(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.finishedLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ch(0),this.hiddenUpdates=ch(null),this.identifierPrefix=S,this.onUncaughtError=R,this.onCaughtError=P,this.onRecoverableError=V,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=K,this.incompleteTransitions=new Map}function hv(l,d,m,S,R,P,V,K,ee,pe,Ne,qe){return l=new R1(l,d,m,V,K,ee,pe,qe),d=1,P===!0&&(d|=24),P=Ls(3,null,null,d),l.current=P,P.stateNode=l,(d=Lh()).refCount++,l.pooledCache=d,d.refCount++,P.memoizedState={element:S,isDehydrated:m,cache:d},qu(P),l}function C1(l){return l?l=Cu:Cu}function D1(l,d,m,S,R,P){R=C1(R),S.context===null?S.context=R:S.pendingContext=R,(S=Ys(d)).payload={element:m},(P=P===void 0?null:P)!==null&&(S.callback=P),(m=Hl(l,S,d))!==null&&(di(m,0,d),Wu(m,l,d))}function P1(l,d){if((l=l.memoizedState)!==null&&l.dehydrated!==null){var m=l.retryLane;l.retryLane=m!==0&&m<d?m:d}}function fv(l,d){P1(l,d),(l=l.alternate)&&P1(l,d)}function ff(l){if(l.tag===13){var d=ts(l,67108864);d!==null&&di(d,0,67108864),fv(l,67108864)}}var Pd=!0;function M1(l,d,m,S){var R=ce.T;ce.T=null;var P=ot.p;try{ot.p=2,Ng(l,d,m,S)}finally{ot.p=P,ce.T=R}}function O1(l,d,m,S){var R=ce.T;ce.T=null;var P=ot.p;try{ot.p=8,Ng(l,d,m,S)}finally{ot.p=P,ce.T=R}}function Ng(l,d,m,S){if(Pd){var R=pv(S);if(R===null)xd(l,d,S,fc,m),_1(l,S);else if(function(pe,Ne,qe,Ue,Ze){switch(Ne){case"focusin":return Qo=pf(Qo,pe,Ne,qe,Ue,Ze),!0;case"dragenter":return fo=pf(fo,pe,Ne,qe,Ue,Ze),!0;case"mouseover":return po=pf(po,pe,Ne,qe,Ue,Ze),!0;case"pointerover":var Xe=Ze.pointerId;return Xo.set(Xe,pf(Xo.get(Xe)||null,pe,Ne,qe,Ue,Ze)),!0;case"gotpointercapture":return Xe=Ze.pointerId,Md.set(Xe,pf(Md.get(Xe)||null,pe,Ne,qe,Ue,Ze)),!0}return!1}(R,l,d,m,S))S.stopPropagation();else if(_1(l,S),4&d&&-1<eS.indexOf(l)){for(;R!==null;){var P=ii(R);if(P!==null)switch(P.tag){case 3:if((P=P.stateNode).current.memoizedState.isDehydrated){var V=El(P.pendingLanes);if(V!==0){var K=P;for(K.pendingLanes|=2,K.entangledLanes|=2;V;){var ee=1<<31-Fi(V);K.entanglements[1]|=ee,V&=~ee}pt(P),!(6&Sr)&&(Ad=Dn()+500,Wo(0))}}break;case 13:(K=ts(P,2))!==null&&di(K,0,2),Ei(),fv(P,2)}if((P=pv(S))===null&&xd(l,d,S,fc,m),P===R)break;R=P}R!==null&&S.stopPropagation()}else xd(l,d,S,null,m)}}function pv(l){return pc(l=ko(l))}var fc=null;function pc(l){if(fc=null,(l=Es(l))!==null){var d=de(l);if(d===null)l=null;else{var m=d.tag;if(m===13){if((l=W(d))!==null)return l;l=null}else if(m===3){if(d.stateNode.current.memoizedState.isDehydrated)return d.tag===3?d.stateNode.containerInfo:null;l=null}else d!==l&&(l=null)}}return fc=l,null}function N1(l){switch(l){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch($a()){case fu:return 2;case fr:return 8;case ar:case pr:return 32;case vs:return 268435456;default:return 32}default:return 32}}var _g=!1,Qo=null,fo=null,po=null,Xo=new Map,Md=new Map,fs=[],eS="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function _1(l,d){switch(l){case"focusin":case"focusout":Qo=null;break;case"dragenter":case"dragleave":fo=null;break;case"mouseover":case"mouseout":po=null;break;case"pointerover":case"pointerout":Xo.delete(d.pointerId);break;case"gotpointercapture":case"lostpointercapture":Md.delete(d.pointerId)}}function pf(l,d,m,S,R,P){return l===null||l.nativeEvent!==P?(l={blockedOn:d,domEventName:m,eventSystemFlags:S,nativeEvent:P,targetContainers:[R]},d!==null&&(d=ii(d))!==null&&ff(d),l):(l.eventSystemFlags|=S,d=l.targetContainers,R!==null&&d.indexOf(R)===-1&&d.push(R),l)}function F1(l){var d=Es(l.target);if(d!==null){var m=de(d);if(m!==null){if((d=m.tag)===13){if((d=W(m))!==null)return l.blockedOn=d,void function(S,R){var P=ot.p;try{return ot.p=S,R()}finally{ot.p=P}}(l.priority,function(){if(m.tag===13){var S=Mi(),R=ts(m,S);R!==null&&di(R,0,S),fv(m,S)}})}else if(d===3&&m.stateNode.current.memoizedState.isDehydrated)return void(l.blockedOn=m.tag===3?m.stateNode.containerInfo:null)}}l.blockedOn=null}function Fg(l){if(l.blockedOn!==null)return!1;for(var d=l.targetContainers;0<d.length;){var m=pv(l.nativeEvent);if(m!==null)return(d=ii(m))!==null&&ff(d),l.blockedOn=m,!1;var S=new(m=l.nativeEvent).constructor(m.type,m);Er=S,m.target.dispatchEvent(S),Er=null,d.shift()}return!0}function U1(l,d,m){Fg(l)&&m.delete(d)}function tS(){_g=!1,Qo!==null&&Fg(Qo)&&(Qo=null),fo!==null&&Fg(fo)&&(fo=null),po!==null&&Fg(po)&&(po=null),Xo.forEach(U1),Md.forEach(U1)}function Ug(l,d){l.blockedOn===d&&(l.blockedOn=null,_g||(_g=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,tS)))}var Bg=null;function B1(l){Bg!==l&&(Bg=l,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){Bg===l&&(Bg=null);for(var d=0;d<l.length;d+=3){var m=l[d],S=l[d+1],R=l[d+2];if(typeof S!="function"){if(pc(S||m)===null)continue;break}var P=ii(m);P!==null&&(l.splice(d,3),d-=3,sn(P,{pending:!0,data:R,method:m.method,action:S},S,R))}}))}function gf(l){function d(ee){return Ug(ee,l)}Qo!==null&&Ug(Qo,l),fo!==null&&Ug(fo,l),po!==null&&Ug(po,l),Xo.forEach(d),Md.forEach(d);for(var m=0;m<fs.length;m++){var S=fs[m];S.blockedOn===l&&(S.blockedOn=null)}for(;0<fs.length&&(m=fs[0]).blockedOn===null;)F1(m),m.blockedOn===null&&fs.shift();if((m=(l.ownerDocument||l).$$reactFormReplay)!=null)for(S=0;S<m.length;S+=3){var R=m[S],P=m[S+1],V=R[mi]||null;if(typeof P=="function")V||B1(m);else if(V){var K=null;if(P&&P.hasAttribute("formAction")){if(R=P,V=P[mi]||null)K=V.formAction;else if(pc(R)!==null)continue}else K=V.action;typeof K=="function"?m[S+1]=K:(m.splice(S,3),S-=3),B1(m)}}}function gv(l){this.Dt=l}function $g(l){this.Dt=l}$g.prototype.render=gv.prototype.render=function(l){var d=this.Dt;if(d===null)throw Error(s(409));D1(d.current,Mi(),l,d,null,null)},$g.prototype.unmount=gv.prototype.unmount=function(){var l=this.Dt;if(l!==null){this.Dt=null;var d=l.containerInfo;l.tag===0&&zl(),D1(l.current,2,null,l,null,null),Ei(),d[Gs]=null}},$g.prototype.unstable_scheduleHydration=function(l){if(l){var d=_m();l={blockedOn:null,target:l,priority:d};for(var m=0;m<fs.length&&d!==0&&d<fs[m].priority;m++);fs.splice(m,0,l),m===0&&F1(l)}};var $1=t.version;if($1!=="19.0.0")throw Error(s(527,$1,"19.0.0"));ot.findDOMNode=function(l){var d=l.wt;if(d===void 0)throw typeof l.render=="function"?Error(s(188)):(l=Object.keys(l).join(","),Error(s(268,l)));return l=function(m){var S=m.alternate;if(!S){if((S=de(m))===null)throw Error(s(188));return S!==m?null:m}for(var R=m,P=S;;){var V=R.return;if(V===null)break;var K=V.alternate;if(K===null){if((P=V.return)!==null){R=P;continue}break}if(V.child===K.child){for(K=V.child;K;){if(K===R)return Ke(V),m;if(K===P)return Ke(V),S;K=K.sibling}throw Error(s(188))}if(R.return!==P.return)R=V,P=K;else{for(var ee=!1,pe=V.child;pe;){if(pe===R){ee=!0,R=V,P=K;break}if(pe===P){ee=!0,P=V,R=K;break}pe=pe.sibling}if(!ee){for(pe=K.child;pe;){if(pe===R){ee=!0,R=K,P=V;break}if(pe===P){ee=!0,P=K,R=V;break}pe=pe.sibling}if(!ee)throw Error(s(189))}}if(R.alternate!==P)throw Error(s(190))}if(R.tag!==3)throw Error(s(188));return R.stateNode.current===R?m:S}(d),l=(l=l!==null?nt(l):null)===null?null:l.stateNode};var jg={bundleType:0,version:"19.0.0",rendererPackageName:"react-dom",currentDispatcherRef:ce,findFiberByHostInstance:Es,reconcilerVersion:"19.0.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var wr=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!wr.isDisabled&&wr.supportsFiber)try{Nt=wr.inject(jg),Wi=wr}catch{}}return tm.createRoot=function(l,d){if(!u(l))throw Error(s(299));var m=!1,S="",R=_h,P=Hu,V=Fh;return d!=null&&(d.unstable_strictMode===!0&&(m=!0),d.identifierPrefix!==void 0&&(S=d.identifierPrefix),d.onUncaughtError!==void 0&&(R=d.onUncaughtError),d.onCaughtError!==void 0&&(P=d.onCaughtError),d.onRecoverableError!==void 0&&(V=d.onRecoverableError),d.unstable_transitionCallbacks!==void 0&&d.unstable_transitionCallbacks),d=hv(l,1,!1,null,0,m,S,R,P,V,0,null),l[Gs]=d.current,tf(l.nodeType===8?l.parentNode:l),new gv(d)},tm.hydrateRoot=function(l,d,m){if(!u(l))throw Error(s(299));var S=!1,R="",P=_h,V=Hu,K=Fh,ee=null;return m!=null&&(m.unstable_strictMode===!0&&(S=!0),m.identifierPrefix!==void 0&&(R=m.identifierPrefix),m.onUncaughtError!==void 0&&(P=m.onUncaughtError),m.onCaughtError!==void 0&&(V=m.onCaughtError),m.onRecoverableError!==void 0&&(K=m.onRecoverableError),m.unstable_transitionCallbacks!==void 0&&m.unstable_transitionCallbacks,m.formState!==void 0&&(ee=m.formState)),(d=hv(l,1,!0,d,0,S,R,P,V,K,0,ee)).context=C1(null),m=d.current,(R=Ys(S=Mi())).callback=null,Hl(m,R,S),d.current.lanes=S,Tl(d,S),pt(d),l[Gs]=d.current,tf(l),new $g(d)},tm.version="19.0.0",tm}var rD=(kw||(kw=1,function a(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE=="function")try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch{}}(),mw.exports=nD()),mw.exports),nm=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(a){return this.listeners.add(a),this.onSubscribe(),()=>{this.listeners.delete(a),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Ud=typeof window>"u"||"Deno"in globalThis;function Pa(){}function Db(a){return typeof a=="number"&&a>=0&&a!==1/0}function Iw(a,t){return Math.max(a+(t||0)-Date.now(),0)}function wf(a,t){return typeof a=="function"?a(t):a}function yo(a,t){return typeof a=="function"?a(t):a}function Lw(a,t){const{type:r="all",exact:s,fetchStatus:u,predicate:f,queryKey:c,stale:v}=a;if(c){if(s){if(t.queryHash!==Pb(c,t.options))return!1}else if(!im(t.queryKey,c))return!1}if(r!=="all"){const y=t.isActive();if(r==="active"&&!y||r==="inactive"&&y)return!1}return(typeof v!="boolean"||t.isStale()===v)&&(!u||u===t.state.fetchStatus)&&!(f&&!f(t))}function Rw(a,t){const{exact:r,status:s,predicate:u,mutationKey:f}=a;if(f){if(!t.options.mutationKey)return!1;if(r){if(rm(t.options.mutationKey)!==rm(f))return!1}else if(!im(t.options.mutationKey,f))return!1}return(!s||t.state.status===s)&&!(u&&!u(t))}function Pb(a,t){return((t==null?void 0:t.queryKeyHashFn)||rm)(a)}function rm(a){return JSON.stringify(a,(t,r)=>Ob(r)?Object.keys(r).sort().reduce((s,u)=>(s[u]=r[u],s),{}):r)}function im(a,t){return a===t||typeof a==typeof t&&!(!a||!t||typeof a!="object"||typeof t!="object")&&!Object.keys(t).some(r=>!im(a[r],t[r]))}function Cw(a,t){if(a===t)return a;const r=Dw(a)&&Dw(t);if(r||Ob(a)&&Ob(t)){const s=r?a:Object.keys(a),u=s.length,f=r?t:Object.keys(t),c=f.length,v=r?[]:{};let y=0;for(let E=0;E<c;E++){const A=r?E:f[E];(!r&&s.includes(A)||r)&&a[A]===void 0&&t[A]===void 0?(v[A]=void 0,y++):(v[A]=Cw(a[A],t[A]),v[A]===a[A]&&a[A]!==void 0&&y++)}return u===c&&y===u?a:v}return t}function Mb(a,t){if(!t||Object.keys(a).length!==Object.keys(t).length)return!1;for(const r in a)if(a[r]!==t[r])return!1;return!0}function Dw(a){return Array.isArray(a)&&a.length===Object.keys(a).length}function Ob(a){if(!Pw(a))return!1;const t=a.constructor;if(t===void 0)return!0;const r=t.prototype;return!!Pw(r)&&!!r.hasOwnProperty("isPrototypeOf")&&Object.getPrototypeOf(a)===Object.prototype}function Pw(a){return Object.prototype.toString.call(a)==="[object Object]"}function Nb(a,t,r){return typeof r.structuralSharing=="function"?r.structuralSharing(a,t):r.structuralSharing!==!1?Cw(a,t):t}function iD(a,t,r=0){const s=[...a,t];return r&&s.length>r?s.slice(1):s}function sD(a,t,r=0){const s=[t,...a];return r&&s.length>r?s.slice(0,-1):s}var _b=Symbol();function Mw(a,t){return!a.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:a.queryFn&&a.queryFn!==_b?a.queryFn:()=>Promise.reject(new Error(`Missing queryFn: '${a.queryHash}'`))}var Fb=new(ML=class extends nm{constructor(){super();on(this,th);on(this,Mc);on(this,Jf);Dt(this,Jf,t=>{if(!Ud&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){Re(this,Mc)||this.setEventListener(Re(this,Jf))}onUnsubscribe(){var t;this.hasListeners()||((t=Re(this,Mc))==null||t.call(this),Dt(this,Mc,void 0))}setEventListener(t){var r;Dt(this,Jf,t),(r=Re(this,Mc))==null||r.call(this),Dt(this,Mc,t(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(t){Re(this,th)!==t&&(Dt(this,th,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof Re(this,th)=="boolean"?Re(this,th):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},th=new WeakMap,Mc=new WeakMap,Jf=new WeakMap,ML),jv=new(OL=class extends nm{constructor(){super();on(this,Zf,!0);on(this,Oc);on(this,ep);Dt(this,ep,t=>{if(!Ud&&window.addEventListener){const r=()=>t(!0),s=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",s)}}})}onSubscribe(){Re(this,Oc)||this.setEventListener(Re(this,ep))}onUnsubscribe(){var t;this.hasListeners()||((t=Re(this,Oc))==null||t.call(this),Dt(this,Oc,void 0))}setEventListener(t){var r;Dt(this,ep,t),(r=Re(this,Oc))==null||r.call(this),Dt(this,Oc,t(this.setOnline.bind(this)))}setOnline(t){Re(this,Zf)!==t&&(Dt(this,Zf,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return Re(this,Zf)}},Zf=new WeakMap,Oc=new WeakMap,ep=new WeakMap,OL);function Ub(){let a,t;const r=new Promise((u,f)=>{a=u,t=f});function s(u){Object.assign(r,u),delete r.resolve,delete r.reject}return r.status="pending",r.catch(()=>{}),r.resolve=u=>{s({status:"fulfilled",value:u}),a(u)},r.reject=u=>{s({status:"rejected",reason:u}),t(u)},r}function aD(a){return Math.min(1e3*2**a,3e4)}function Ow(a){return(a??"online")!=="online"||jv.isOnline()}var Nw=class extends Error{constructor(a){super("CancelledError"),this.revert=a==null?void 0:a.revert,this.silent=a==null?void 0:a.silent}};function Bb(a){return a instanceof Nw}function _w(a){let t,r=!1,s=0,u=!1;const f=Ub(),c=()=>Fb.isFocused()&&(a.networkMode==="always"||jv.isOnline())&&a.canRun(),v=()=>Ow(a.networkMode)&&a.canRun(),y=T=>{var M;u||(u=!0,(M=a.onSuccess)==null||M.call(a,T),t==null||t(),f.resolve(T))},E=T=>{var M;u||(u=!0,(M=a.onError)==null||M.call(a,T),t==null||t(),f.reject(T))},A=()=>new Promise(T=>{var M;t=O=>{(u||c())&&T(O)},(M=a.onPause)==null||M.call(a)}).then(()=>{var T;t=void 0,u||((T=a.onContinue)==null||T.call(a))}),L=()=>{if(u)return;let T;const M=s===0?a.initialPromise:void 0;try{T=M??a.fn()}catch(O){T=Promise.reject(O)}Promise.resolve(T).then(y).catch(O=>{var ie;if(u)return;const U=a.retry??(Ud?0:3),$=a.retryDelay??aD,z=typeof $=="function"?$(s,O):$,Q=U===!0||typeof U=="number"&&s<U||typeof U=="function"&&U(s,O);var Z;!r&&Q?(s++,(ie=a.onFail)==null||ie.call(a,s,O),(Z=z,new Promise(se=>{setTimeout(se,Z)})).then(()=>c()?void 0:A()).then(()=>{r?E(O):L()})):E(O)})};return{promise:f,cancel:T=>{var M;u||(E(new Nw(T)),(M=a.abort)==null||M.call(a))},continue:()=>(t==null||t(),f),cancelRetry:()=>{r=!0},continueRetry:()=>{r=!1},canStart:v,start:()=>(v()?L():A().then(L),f)}}var Ni=function(){let a=[],t=0,r=c=>{c()},s=c=>{c()},u=c=>setTimeout(c,0);const f=c=>{t?a.push(c):u(()=>{r(c)})};return{batch:c=>{let v;t++;try{v=c()}finally{t--,t||(()=>{const y=a;a=[],y.length&&u(()=>{s(()=>{y.forEach(E=>{r(E)})})})})()}return v},batchCalls:c=>(...v)=>{f(()=>{c(...v)})},schedule:f,setNotifyFunction:c=>{r=c},setBatchNotifyFunction:c=>{s=c},setScheduler:c=>{u=c}}}(),Fw=(NL=class{constructor(){on(this,nh)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Db(this.gcTime)&&Dt(this,nh,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(a){this.gcTime=Math.max(this.gcTime||0,a??(Ud?1/0:3e5))}clearGcTimeout(){Re(this,nh)&&(clearTimeout(Re(this,nh)),Dt(this,nh,void 0))}},nh=new WeakMap,NL),oD=(_L=class extends Fw{constructor(t){super();on(this,So);on(this,tp);on(this,np);on(this,Ua);on(this,qi);on(this,Rm);on(this,rh);Dt(this,rh,!1),Dt(this,Rm,t.defaultOptions),this.setOptions(t.options),this.observers=[],Dt(this,Ua,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Dt(this,tp,function(r){const s=typeof r.initialData=="function"?r.initialData():r.initialData,u=s!==void 0,f=u?typeof r.initialDataUpdatedAt=="function"?r.initialDataUpdatedAt():r.initialDataUpdatedAt:0;return{data:s,dataUpdateCount:0,dataUpdatedAt:u?f??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:u?"success":"pending",fetchStatus:"idle"}}(this.options)),this.state=t.state??Re(this,tp),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=Re(this,qi))==null?void 0:t.promise}setOptions(t){this.options={...Re(this,Rm),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){this.observers.length||this.state.fetchStatus!=="idle"||Re(this,Ua).remove(this)}setData(t,r){const s=Nb(this.state.data,t,this.options);return Xn(this,So,yc).call(this,{data:s,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),s}setState(t,r){Xn(this,So,yc).call(this,{type:"setState",state:t,setStateOptions:r})}cancel(t){var s,u;const r=(s=Re(this,qi))==null?void 0:s.promise;return(u=Re(this,qi))==null||u.cancel(t),r?r.then(Pa).catch(Pa):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(Re(this,tp))}isActive(){return this.observers.some(t=>yo(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===_b||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return!!this.state.isInvalidated||(this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0)}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!Iw(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(s=>s.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=Re(this,qi))==null||r.continue()}onOnline(){var r;const t=this.observers.find(s=>s.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=Re(this,qi))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),Re(this,Ua).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(Re(this,qi)&&(Re(this,rh)?Re(this,qi).cancel({revert:!0}):Re(this,qi).cancelRetry()),this.scheduleGc()),Re(this,Ua).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Xn(this,So,yc).call(this,{type:"invalidate"})}fetch(t,r){var v,y,E;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(Re(this,qi))return Re(this,qi).continueRetry(),Re(this,qi).promise}if(t&&this.setOptions(t),!this.options.queryFn){const A=this.observers.find(L=>L.options.queryFn);A&&this.setOptions(A.options)}const s=new AbortController,u=A=>{Object.defineProperty(A,"signal",{enumerable:!0,get:()=>(Dt(this,rh,!0),s.signal)})},f={fetchOptions:r,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:()=>{const A=Mw(this.options,r),L={queryKey:this.queryKey,meta:this.meta};return u(L),Dt(this,rh,!1),this.options.persister?this.options.persister(A,L,this):A(L)}};u(f),(v=this.options.behavior)==null||v.onFetch(f,this),Dt(this,np,this.state),this.state.fetchStatus!=="idle"&&this.state.fetchMeta===((y=f.fetchOptions)==null?void 0:y.meta)||Xn(this,So,yc).call(this,{type:"fetch",meta:(E=f.fetchOptions)==null?void 0:E.meta});const c=A=>{var L,T,M,O;Bb(A)&&A.silent||Xn(this,So,yc).call(this,{type:"error",error:A}),Bb(A)||((T=(L=Re(this,Ua).config).onError)==null||T.call(L,A,this),(O=(M=Re(this,Ua).config).onSettled)==null||O.call(M,this.state.data,A,this)),this.scheduleGc()};return Dt(this,qi,_w({initialPromise:r==null?void 0:r.initialPromise,fn:f.fetchFn,abort:s.abort.bind(s),onSuccess:A=>{var L,T,M,O;if(A!==void 0){try{this.setData(A)}catch(U){return void c(U)}(T=(L=Re(this,Ua).config).onSuccess)==null||T.call(L,A,this),(O=(M=Re(this,Ua).config).onSettled)==null||O.call(M,A,this.state.error,this),this.scheduleGc()}else c(new Error(`${this.queryHash} data is undefined`))},onError:c,onFail:(A,L)=>{Xn(this,So,yc).call(this,{type:"failed",failureCount:A,error:L})},onPause:()=>{Xn(this,So,yc).call(this,{type:"pause"})},onContinue:()=>{Xn(this,So,yc).call(this,{type:"continue"})},retry:f.options.retry,retryDelay:f.options.retryDelay,networkMode:f.options.networkMode,canRun:()=>!0})),Re(this,qi).start()}},tp=new WeakMap,np=new WeakMap,Ua=new WeakMap,qi=new WeakMap,Rm=new WeakMap,rh=new WeakMap,So=new WeakSet,yc=function(t){this.state=(r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Uw(r.data,this.options),fetchMeta:t.meta??null};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const s=t.error;return Bb(s)&&s.revert&&Re(this,np)?{...Re(this,np),fetchStatus:"idle"}:{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}})(this.state),Ni.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),Re(this,Ua).notify({query:this,type:"updated",action:t})})},_L);function Uw(a,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Ow(t.networkMode)?"fetching":"paused",...a===void 0&&{error:null,status:"pending"}}}var lD=(FL=class extends nm{constructor(t={}){super();on(this,fl);this.config=t,Dt(this,fl,new Map)}build(t,r,s){const u=r.queryKey,f=r.queryHash??Pb(u,r);let c=this.get(f);return c||(c=new oD({cache:this,queryKey:u,queryHash:f,options:t.defaultQueryOptions(r),state:s,defaultOptions:t.getQueryDefaults(u)}),this.add(c)),c}add(t){Re(this,fl).has(t.queryHash)||(Re(this,fl).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=Re(this,fl).get(t.queryHash);r&&(t.destroy(),r===t&&Re(this,fl).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ni.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return Re(this,fl).get(t)}getAll(){return[...Re(this,fl).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(s=>Lw(r,s))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(s=>Lw(t,s)):r}notify(t){Ni.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){Ni.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Ni.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},fl=new WeakMap,FL),uD=(UL=class extends Fw{constructor(t){super();on(this,gl);on(this,pl);on(this,ms);on(this,ih);this.mutationId=t.mutationId,Dt(this,ms,t.mutationCache),Dt(this,pl,[]),this.state=t.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){Re(this,pl).includes(t)||(Re(this,pl).push(t),this.clearGcTimeout(),Re(this,ms).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Dt(this,pl,Re(this,pl).filter(r=>r!==t)),this.scheduleGc(),Re(this,ms).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){Re(this,pl).length||(this.state.status==="pending"?this.scheduleGc():Re(this,ms).remove(this))}continue(){var t;return((t=Re(this,ih))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var u,f,c,v,y,E,A,L,T,M,O,U,$,z,Q,Z,ie,se,ye,N;Dt(this,ih,_w({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(re,ne)=>{Xn(this,gl,Fd).call(this,{type:"failed",failureCount:re,error:ne})},onPause:()=>{Xn(this,gl,Fd).call(this,{type:"pause"})},onContinue:()=>{Xn(this,gl,Fd).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Re(this,ms).canRun(this)}));const r=this.state.status==="pending",s=!Re(this,ih).canStart();try{if(!r){Xn(this,gl,Fd).call(this,{type:"pending",variables:t,isPaused:s}),await((f=(u=Re(this,ms).config).onMutate)==null?void 0:f.call(u,t,this));const ne=await((v=(c=this.options).onMutate)==null?void 0:v.call(c,t));ne!==this.state.context&&Xn(this,gl,Fd).call(this,{type:"pending",context:ne,variables:t,isPaused:s})}const re=await Re(this,ih).start();return await((E=(y=Re(this,ms).config).onSuccess)==null?void 0:E.call(y,re,t,this.state.context,this)),await((L=(A=this.options).onSuccess)==null?void 0:L.call(A,re,t,this.state.context)),await((M=(T=Re(this,ms).config).onSettled)==null?void 0:M.call(T,re,null,this.state.variables,this.state.context,this)),await((U=(O=this.options).onSettled)==null?void 0:U.call(O,re,null,t,this.state.context)),Xn(this,gl,Fd).call(this,{type:"success",data:re}),re}catch(re){try{throw await((z=($=Re(this,ms).config).onError)==null?void 0:z.call($,re,t,this.state.context,this)),await((Z=(Q=this.options).onError)==null?void 0:Z.call(Q,re,t,this.state.context)),await((se=(ie=Re(this,ms).config).onSettled)==null?void 0:se.call(ie,void 0,re,this.state.variables,this.state.context,this)),await((N=(ye=this.options).onSettled)==null?void 0:N.call(ye,void 0,re,t,this.state.context)),re}finally{Xn(this,gl,Fd).call(this,{type:"error",error:re})}}finally{Re(this,ms).runNext(this)}}},pl=new WeakMap,ms=new WeakMap,ih=new WeakMap,gl=new WeakSet,Fd=function(t){this.state=(r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}})(this.state),Ni.batch(()=>{Re(this,pl).forEach(r=>{r.onMutationUpdate(t)}),Re(this,ms).notify({mutation:this,type:"updated",action:t})})},UL),cD=(BL=class extends nm{constructor(t={}){super();on(this,ha);on(this,Cm);this.config=t,Dt(this,ha,new Map),Dt(this,Cm,Date.now())}build(t,r,s){const u=new uD({mutationCache:this,mutationId:++Rb(this,Cm)._,options:t.defaultMutationOptions(r),state:s});return this.add(u),u}add(t){const r=Gv(t),s=Re(this,ha).get(r)??[];s.push(t),Re(this,ha).set(r,s),this.notify({type:"added",mutation:t})}remove(t){var s;const r=Gv(t);if(Re(this,ha).has(r)){const u=(s=Re(this,ha).get(r))==null?void 0:s.filter(f=>f!==t);u&&(u.length===0?Re(this,ha).delete(r):Re(this,ha).set(r,u))}this.notify({type:"removed",mutation:t})}canRun(t){var s;const r=(s=Re(this,ha).get(Gv(t)))==null?void 0:s.find(u=>u.state.status==="pending");return!r||r===t}runNext(t){var s;const r=(s=Re(this,ha).get(Gv(t)))==null?void 0:s.find(u=>u!==t&&u.state.isPaused);return(r==null?void 0:r.continue())??Promise.resolve()}clear(){Ni.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}getAll(){return[...Re(this,ha).values()].flat()}find(t){const r={exact:!0,...t};return this.getAll().find(s=>Rw(r,s))}findAll(t={}){return this.getAll().filter(r=>Rw(t,r))}notify(t){Ni.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return Ni.batch(()=>Promise.all(t.map(r=>r.continue().catch(Pa))))}},ha=new WeakMap,Cm=new WeakMap,BL);function Gv(a){var t;return((t=a.options.scope)==null?void 0:t.id)??String(a.mutationId)}function Bw(a){return{onFetch:(t,r)=>{var A,L,T,M,O;const s=t.options,u=(T=(L=(A=t.fetchOptions)==null?void 0:A.meta)==null?void 0:L.fetchMore)==null?void 0:T.direction,f=((M=t.state.data)==null?void 0:M.pages)||[],c=((O=t.state.data)==null?void 0:O.pageParams)||[];let v={pages:[],pageParams:[]},y=0;const E=async()=>{let U=!1;const $=Mw(t.options,t.fetchOptions),z=async(Q,Z,ie)=>{if(U)return Promise.reject();if(Z==null&&Q.pages.length)return Promise.resolve(Q);const se={queryKey:t.queryKey,pageParam:Z,direction:ie?"backward":"forward",meta:t.options.meta};var ye;ye=se,Object.defineProperty(ye,"signal",{enumerable:!0,get:()=>(t.signal.aborted?U=!0:t.signal.addEventListener("abort",()=>{U=!0}),t.signal)});const N=await $(se),{maxPages:re}=t.options,ne=ie?sD:iD;return{pages:ne(Q.pages,N,re),pageParams:ne(Q.pageParams,Z,re)}};if(u&&f.length){const Q=u==="backward",Z={pages:f,pageParams:c},ie=(Q?dD:$w)(s,Z);v=await z(Z,ie,Q)}else{const Q=a??f.length;do{const Z=y===0?c[0]??s.initialPageParam:$w(s,v);if(y>0&&Z==null)break;v=await z(v,Z),y++}while(y<Q)}return v};t.options.persister?t.fetchFn=()=>{var U,$;return($=(U=t.options).persister)==null?void 0:$.call(U,E,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=E}}}function $w(a,{pages:t,pageParams:r}){const s=t.length-1;return t.length>0?a.getNextPageParam(t[s],t,r[s],r):void 0}function dD(a,{pages:t,pageParams:r}){var s;return t.length>0?(s=a.getPreviousPageParam)==null?void 0:s.call(a,t[0],t,r[0],r):void 0}var hD=($L=class{constructor(a={}){on(this,Gr);on(this,Nc);on(this,_c);on(this,rp);on(this,ip);on(this,Fc);on(this,sp);on(this,ap);Dt(this,Gr,a.queryCache||new lD),Dt(this,Nc,a.mutationCache||new cD),Dt(this,_c,a.defaultOptions||{}),Dt(this,rp,new Map),Dt(this,ip,new Map),Dt(this,Fc,0)}mount(){Rb(this,Fc)._++,Re(this,Fc)===1&&(Dt(this,sp,Fb.subscribe(async a=>{a&&(await this.resumePausedMutations(),Re(this,Gr).onFocus())})),Dt(this,ap,jv.subscribe(async a=>{a&&(await this.resumePausedMutations(),Re(this,Gr).onOnline())})))}unmount(){var a,t;Rb(this,Fc)._--,Re(this,Fc)===0&&((a=Re(this,sp))==null||a.call(this),Dt(this,sp,void 0),(t=Re(this,ap))==null||t.call(this),Dt(this,ap,void 0))}isFetching(a){return Re(this,Gr).findAll({...a,fetchStatus:"fetching"}).length}isMutating(a){return Re(this,Nc).findAll({...a,status:"pending"}).length}getQueryData(a){var r;const t=this.defaultQueryOptions({queryKey:a});return(r=Re(this,Gr).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(a){const t=this.defaultQueryOptions(a),r=Re(this,Gr).build(this,t),s=r.state.data;return s===void 0?this.fetchQuery(a):(a.revalidateIfStale&&r.isStaleByTime(wf(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(s))}getQueriesData(a){return Re(this,Gr).findAll(a).map(({queryKey:t,state:r})=>[t,r.data])}setQueryData(a,t,r){const s=this.defaultQueryOptions({queryKey:a}),u=Re(this,Gr).get(s.queryHash),f=u==null?void 0:u.state.data,c=function(v,y){return typeof v=="function"?v(y):v}(t,f);if(c!==void 0)return Re(this,Gr).build(this,s).setData(c,{...r,manual:!0})}setQueriesData(a,t,r){return Ni.batch(()=>Re(this,Gr).findAll(a).map(({queryKey:s})=>[s,this.setQueryData(s,t,r)]))}getQueryState(a){var r;const t=this.defaultQueryOptions({queryKey:a});return(r=Re(this,Gr).get(t.queryHash))==null?void 0:r.state}removeQueries(a){const t=Re(this,Gr);Ni.batch(()=>{t.findAll(a).forEach(r=>{t.remove(r)})})}resetQueries(a,t){const r=Re(this,Gr),s={type:"active",...a};return Ni.batch(()=>(r.findAll(a).forEach(u=>{u.reset()}),this.refetchQueries(s,t)))}cancelQueries(a,t={}){const r={revert:!0,...t},s=Ni.batch(()=>Re(this,Gr).findAll(a).map(u=>u.cancel(r)));return Promise.all(s).then(Pa).catch(Pa)}invalidateQueries(a,t={}){return Ni.batch(()=>{if(Re(this,Gr).findAll(a).forEach(s=>{s.invalidate()}),(a==null?void 0:a.refetchType)==="none")return Promise.resolve();const r={...a,type:(a==null?void 0:a.refetchType)??(a==null?void 0:a.type)??"active"};return this.refetchQueries(r,t)})}refetchQueries(a,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},s=Ni.batch(()=>Re(this,Gr).findAll(a).filter(u=>!u.isDisabled()).map(u=>{let f=u.fetch(void 0,r);return r.throwOnError||(f=f.catch(Pa)),u.state.fetchStatus==="paused"?Promise.resolve():f}));return Promise.all(s).then(Pa)}fetchQuery(a){const t=this.defaultQueryOptions(a);t.retry===void 0&&(t.retry=!1);const r=Re(this,Gr).build(this,t);return r.isStaleByTime(wf(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(a){return this.fetchQuery(a).then(Pa).catch(Pa)}fetchInfiniteQuery(a){return a.behavior=Bw(a.pages),this.fetchQuery(a)}prefetchInfiniteQuery(a){return this.fetchInfiniteQuery(a).then(Pa).catch(Pa)}ensureInfiniteQueryData(a){return a.behavior=Bw(a.pages),this.ensureQueryData(a)}resumePausedMutations(){return jv.isOnline()?Re(this,Nc).resumePausedMutations():Promise.resolve()}getQueryCache(){return Re(this,Gr)}getMutationCache(){return Re(this,Nc)}getDefaultOptions(){return Re(this,_c)}setDefaultOptions(a){Dt(this,_c,a)}setQueryDefaults(a,t){Re(this,rp).set(rm(a),{queryKey:a,defaultOptions:t})}getQueryDefaults(a){const t=[...Re(this,rp).values()],r={};return t.forEach(s=>{im(a,s.queryKey)&&Object.assign(r,s.defaultOptions)}),r}setMutationDefaults(a,t){Re(this,ip).set(rm(a),{mutationKey:a,defaultOptions:t})}getMutationDefaults(a){const t=[...Re(this,ip).values()];let r={};return t.forEach(s=>{im(a,s.mutationKey)&&(r={...r,...s.defaultOptions})}),r}defaultQueryOptions(a){if(a.Ct)return a;const t={...Re(this,_c).queries,...this.getQueryDefaults(a.queryKey),...a,Ct:!0};return t.queryHash||(t.queryHash=Pb(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===_b&&(t.enabled=!1),t}defaultMutationOptions(a){return a!=null&&a.Ct?a:{...Re(this,_c).mutations,...(a==null?void 0:a.mutationKey)&&this.getMutationDefaults(a.mutationKey),...a,Ct:!0}}clear(){Re(this,Gr).clear(),Re(this,Nc).clear()}},Gr=new WeakMap,Nc=new WeakMap,_c=new WeakMap,rp=new WeakMap,ip=new WeakMap,Fc=new WeakMap,sp=new WeakMap,ap=new WeakMap,$L),fD=(jL=class extends nm{constructor(t,r){super();on(this,sr);on(this,Bs);on(this,Vn);on(this,Dm);on(this,ys);on(this,sh);on(this,op);on(this,Uc);on(this,ml);on(this,Pm);on(this,lp);on(this,up);on(this,ah);on(this,oh);on(this,Bc);on(this,cp,new Set);this.options=r,Dt(this,Bs,t),Dt(this,ml,null),Dt(this,Uc,Ub()),this.options.experimental_prefetchInRender||Re(this,Uc).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(Re(this,Vn).addObserver(this),jw(Re(this,Vn),this.options)?Xn(this,sr,Bv).call(this):this.updateResult(),Xn(this,sr,lw).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return $b(Re(this,Vn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return $b(Re(this,Vn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Xn(this,sr,uw).call(this),Xn(this,sr,cw).call(this),Re(this,Vn).removeObserver(this)}setOptions(t,r){const s=this.options,u=Re(this,Vn);if(this.options=Re(this,Bs).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof yo(this.options.enabled,Re(this,Vn))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Xn(this,sr,dw).call(this),Re(this,Vn).setOptions(this.options),s.Ct&&!Mb(this.options,s)&&Re(this,Bs).getQueryCache().notify({type:"observerOptionsUpdated",query:Re(this,Vn),observer:this});const f=this.hasListeners();f&&Gw(Re(this,Vn),u,this.options,s)&&Xn(this,sr,Bv).call(this),this.updateResult(r),!f||Re(this,Vn)===u&&yo(this.options.enabled,Re(this,Vn))===yo(s.enabled,Re(this,Vn))&&wf(this.options.staleTime,Re(this,Vn))===wf(s.staleTime,Re(this,Vn))||Xn(this,sr,sw).call(this);const c=Xn(this,sr,aw).call(this);!f||Re(this,Vn)===u&&yo(this.options.enabled,Re(this,Vn))===yo(s.enabled,Re(this,Vn))&&c===Re(this,Bc)||Xn(this,sr,ow).call(this,c)}getOptimisticResult(t){const r=Re(this,Bs).getQueryCache().build(Re(this,Bs),t),s=this.createResult(r,t);return function(u,f){return!Mb(u.getCurrentResult(),f)}(this,s)&&(Dt(this,ys,s),Dt(this,op,this.options),Dt(this,sh,Re(this,Vn).state)),s}getCurrentResult(){return Re(this,ys)}trackResult(t,r){const s={};return Object.keys(t).forEach(u=>{Object.defineProperty(s,u,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(u),r==null||r(u),t[u])})}),s}trackProp(t){Re(this,cp).add(t)}getCurrentQuery(){return Re(this,Vn)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=Re(this,Bs).defaultQueryOptions(t),s=Re(this,Bs).getQueryCache().build(Re(this,Bs),r);return s.fetch().then(()=>this.createResult(s,r))}fetch(t){return Xn(this,sr,Bv).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),Re(this,ys)))}createResult(t,r){var ye;const s=Re(this,Vn),u=this.options,f=Re(this,ys),c=Re(this,sh),v=Re(this,op),y=t!==s?t.state:Re(this,Dm),{state:E}=t;let A,L={...E},T=!1;if(r.$t){const N=this.hasListeners(),re=!N&&jw(t,r),ne=N&&Gw(t,s,r,u);(re||ne)&&(L={...L,...Uw(E.data,t.options)}),r.$t==="isRestoring"&&(L.fetchStatus="idle")}let{error:M,errorUpdatedAt:O,status:U}=L;if(r.select&&L.data!==void 0)if(f&&L.data===(c==null?void 0:c.data)&&r.select===Re(this,Pm))A=Re(this,lp);else try{Dt(this,Pm,r.select),A=r.select(L.data),A=Nb(f==null?void 0:f.data,A,r),Dt(this,lp,A),Dt(this,ml,null)}catch(N){Dt(this,ml,N)}else A=L.data;if(r.placeholderData!==void 0&&A===void 0&&U==="pending"){let N;if(f!=null&&f.isPlaceholderData&&r.placeholderData===(v==null?void 0:v.placeholderData))N=f.data;else if(N=typeof r.placeholderData=="function"?r.placeholderData((ye=Re(this,up))==null?void 0:ye.state.data,Re(this,up)):r.placeholderData,r.select&&N!==void 0)try{N=r.select(N),Dt(this,ml,null)}catch(re){Dt(this,ml,re)}N!==void 0&&(U="success",A=Nb(f==null?void 0:f.data,N,r),T=!0)}Re(this,ml)&&(M=Re(this,ml),A=Re(this,lp),O=Date.now(),U="error");const $=L.fetchStatus==="fetching",z=U==="pending",Q=U==="error",Z=z&&$,ie=A!==void 0,se={status:U,fetchStatus:L.fetchStatus,isPending:z,isSuccess:U==="success",isError:Q,isInitialLoading:Z,isLoading:Z,data:A,dataUpdatedAt:L.dataUpdatedAt,error:M,errorUpdatedAt:O,failureCount:L.fetchFailureCount,failureReason:L.fetchFailureReason,errorUpdateCount:L.errorUpdateCount,isFetched:L.dataUpdateCount>0||L.errorUpdateCount>0,isFetchedAfterMount:L.dataUpdateCount>y.dataUpdateCount||L.errorUpdateCount>y.errorUpdateCount,isFetching:$,isRefetching:$&&!z,isLoadingError:Q&&!ie,isPaused:L.fetchStatus==="paused",isPlaceholderData:T,isRefetchError:Q&&ie,isStale:jb(t,r),refetch:this.refetch,promise:Re(this,Uc)};if(this.options.experimental_prefetchInRender){const N=Se=>{se.status==="error"?Se.reject(se.error):se.data!==void 0&&Se.resolve(se.data)},re=()=>{const Se=Dt(this,Uc,se.promise=Ub());N(Se)},ne=Re(this,Uc);switch(ne.status){case"pending":t.queryHash===s.queryHash&&N(ne);break;case"fulfilled":se.status!=="error"&&se.data===ne.value||re();break;case"rejected":se.status==="error"&&se.error===ne.reason||re()}}return se}updateResult(t){const r=Re(this,ys),s=this.createResult(Re(this,Vn),this.options);if(Dt(this,sh,Re(this,Vn).state),Dt(this,op,this.options),Re(this,sh).data!==void 0&&Dt(this,up,Re(this,Vn)),Mb(s,r))return;Dt(this,ys,s);const u={};(t==null?void 0:t.listeners)!==!1&&(()=>{if(!r)return!0;const{notifyOnChangeProps:f}=this.options,c=typeof f=="function"?f():f;if(c==="all"||!c&&!Re(this,cp).size)return!0;const v=new Set(c??Re(this,cp));return this.options.throwOnError&&v.add("error"),Object.keys(Re(this,ys)).some(y=>{const E=y;return Re(this,ys)[E]!==r[E]&&v.has(E)})})()&&(u.listeners=!0),Xn(this,sr,J2).call(this,{...u,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Xn(this,sr,lw).call(this)}},Bs=new WeakMap,Vn=new WeakMap,Dm=new WeakMap,ys=new WeakMap,sh=new WeakMap,op=new WeakMap,Uc=new WeakMap,ml=new WeakMap,Pm=new WeakMap,lp=new WeakMap,up=new WeakMap,ah=new WeakMap,oh=new WeakMap,Bc=new WeakMap,cp=new WeakMap,sr=new WeakSet,Bv=function(t){Xn(this,sr,dw).call(this);let r=Re(this,Vn).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(Pa)),r},sw=function(){Xn(this,sr,uw).call(this);const t=wf(this.options.staleTime,Re(this,Vn));if(Ud||Re(this,ys).isStale||!Db(t))return;const r=Iw(Re(this,ys).dataUpdatedAt,t)+1;Dt(this,ah,setTimeout(()=>{Re(this,ys).isStale||this.updateResult()},r))},aw=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(Re(this,Vn)):this.options.refetchInterval)??!1},ow=function(t){Xn(this,sr,cw).call(this),Dt(this,Bc,t),!Ud&&yo(this.options.enabled,Re(this,Vn))!==!1&&Db(Re(this,Bc))&&Re(this,Bc)!==0&&Dt(this,oh,setInterval(()=>{(this.options.refetchIntervalInBackground||Fb.isFocused())&&Xn(this,sr,Bv).call(this)},Re(this,Bc)))},lw=function(){Xn(this,sr,sw).call(this),Xn(this,sr,ow).call(this,Xn(this,sr,aw).call(this))},uw=function(){Re(this,ah)&&(clearTimeout(Re(this,ah)),Dt(this,ah,void 0))},cw=function(){Re(this,oh)&&(clearInterval(Re(this,oh)),Dt(this,oh,void 0))},dw=function(){const t=Re(this,Bs).getQueryCache().build(Re(this,Bs),this.options);if(t===Re(this,Vn))return;const r=Re(this,Vn);Dt(this,Vn,t),Dt(this,Dm,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},J2=function(t){Ni.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(Re(this,ys))}),Re(this,Bs).getQueryCache().notify({query:Re(this,Vn),type:"observerResultsUpdated"})})},jL);function jw(a,t){return function(r,s){return yo(s.enabled,r)!==!1&&r.state.data===void 0&&!(r.state.status==="error"&&s.retryOnMount===!1)}(a,t)||a.state.data!==void 0&&$b(a,t,t.refetchOnMount)}function $b(a,t,r){if(yo(t.enabled,a)!==!1){const s=typeof r=="function"?r(a):r;return s==="always"||s!==!1&&jb(a,t)}return!1}function Gw(a,t,r,s){return(a!==t||yo(s.enabled,a)===!1)&&(!r.suspense||a.state.status!=="error")&&jb(a,r)}function jb(a,t){return yo(t.enabled,a)!==!1&&a.isStaleByTime(wf(t.staleTime,a))}var nr=Cb(),Hw=nr.createContext(void 0),pD=({client:a,children:t})=>(nr.useEffect(()=>(a.mount(),()=>{a.unmount()}),[a]),ki.jsx(Hw.Provider,{value:a,children:t})),Vw=nr.createContext(!1);Vw.Provider;var gD=nr.createContext(function(){let a=!1;return{clearReset:()=>{a=!1},reset:()=>{a=!0},isReset:()=>a}}());function Kw(){}var zw=(a,t,r)=>t.fetchOptimistic(a).catch(()=>{r.clearReset()});function mD(a,t,r){var A,L,T,M,O;const s=(()=>{const U=nr.useContext(Hw);if(!U)throw new Error("No QueryClient set, use QueryClientProvider to set one");return U})(),u=nr.useContext(Vw),f=nr.useContext(gD),c=s.defaultQueryOptions(a);(L=(A=s.getDefaultOptions().queries)==null?void 0:A.Rt)==null||L.call(A,c),c.$t=u?"isRestoring":"optimistic",(U=>{U.suspense&&(U.staleTime===void 0&&(U.staleTime=1e3),typeof U.gcTime=="number"&&(U.gcTime=Math.max(U.gcTime,1e3)))})(c),((U,$)=>{(U.suspense||U.throwOnError||U.experimental_prefetchInRender)&&($.isReset()||(U.retryOnMount=!1))})(c,f),(U=>{nr.useEffect(()=>{U.clearReset()},[U])})(f);const v=!s.getQueryCache().get(c.queryHash),[y]=nr.useState(()=>new t(s,c)),E=y.getOptimisticResult(c);if(nr.useSyncExternalStore(nr.useCallback(U=>{const $=u?Kw:y.subscribe(Ni.batchCalls(U));return y.updateResult(),$},[y,u]),()=>y.getCurrentResult(),()=>y.getCurrentResult()),nr.useEffect(()=>{y.setOptions(c,{listeners:!1})},[c,y]),((U,$)=>(U==null?void 0:U.suspense)&&$.isPending)(c,E))throw zw(c,y,f);if((({result:U,errorResetBoundary:$,throwOnError:z,query:Q})=>U.isError&&!$.isReset()&&!U.isFetching&&Q&&function(Z,ie){return typeof Z=="function"?Z(...ie):!!Z}(z,[U.error,Q]))({result:E,errorResetBoundary:f,throwOnError:c.throwOnError,query:s.getQueryCache().get(c.queryHash)}))throw E.error;if((M=(T=s.getDefaultOptions().queries)==null?void 0:T.Pt)==null||M.call(T,c,E),c.experimental_prefetchInRender&&!Ud&&((U,$)=>U.isLoading&&U.isFetching&&!$)(E,u)){const U=v?zw(c,y,f):(O=s.getQueryCache().get(c.queryHash))==null?void 0:O.promise;U==null||U.catch(Kw).finally(()=>{y.updateResult()})}return c.notifyOnChangeProps?E:y.trackResult(E)}function qw(a,t){return mD(a,fD)}var Xl=(a=>(a.DEBUG="debug",a.INFO="info",a.WARN="warn",a.ERROR="error",a))(Xl||{});const Ns=(yl=class{constructor(){}static getInstance(){return yl.instance||(yl.instance=new yl),yl.instance}log({level:t,message:r,context:s,data:u}){switch(new Date().toISOString(),t.toUpperCase(),t){case Xl.DEBUG:case Xl.INFO:case Xl.WARN:case Xl.ERROR:}}debug(t,r,s){this.log({level:Xl.DEBUG,message:t,context:r,data:s})}info(t,r,s){this.log({level:Xl.INFO,message:t,context:r,data:s})}warn(t,r,s){this.log({level:Xl.WARN,message:t,context:r,data:s})}error(t,r,s){this.log({level:Xl.ERROR,message:t,context:r,data:s})}},Mr(yl,"instance"),yl).getInstance(),Hv={TRAVEL:[1200000001],REVIEW:[12e7,1200000006]},Gb=1,sm=3,yD=4,vc=1,Bd=2,Hb=3,el=4,Ww=({serviceId:a,movieId:t,refId:r})=>{if(!a)throw new Error("serviceId is required");return`${Hv.REVIEW.includes(a)||Hv.TRAVEL.includes(a)?"https://api.cms.rakuten.co.jp/platform/movie/playback":"https://stream.cms.rakuten.co.jp/movie/playback"}?serviceId=${a}&${t?`movieId=${t}`:`ref_id=${r}`}`};function tl(a){if(a===null)return null;const t=Number(a);return isNaN(t)?null:t}function Vv(a){if(a===null)return"";const t=document.createElement("div");return t.textContent=a,t.innerHTML}const vD="現在この動画は再生できません",bD="ApiError",Vb="AppError",ED=a=>{let t;a.movieId?t=Ww({serviceId:a.serviceId,movieId:a.movieId}):a.refId&&(t=Ww({serviceId:a.serviceId,refId:a.refId}));const{data:r,error:s,isLoading:u}=qw({queryKey:["manifest",t],queryFn:()=>(async f=>{const c=await fetch(f);if(!c.ok){const y=`Error fetching manifest: ${c.status} ${c.statusText}`;throw new Error(y)}const v=await c.json();if(v.errorInfo&&v.errorInfo.errorCode)throw{errorCode:v.errorInfo.errorCode,errorMessage:v.errorInfo.errorMessage};return v})(t),enabled:!!t,retry:1});return{manifestData:r,manifestLoading:u,manifestError:s}};let TD=0;const SD=async a=>{const{playerType:t,type:r,movieId:s,referrerUrl:u}=a,f=((E,A)=>`${E===Bd?"ShopRVideoPF_Network_APIClient":"RVideoPF_Network_APIClient"}_${A}_${crypto.getRandomValues(new Uint32Array(1))[0].toString(36)}`)(t,++TD),c=new Date().getTime(),v=document.createElement("script"),y=encodeURIComponent(u);return new Promise((E,A)=>{v.src=(({callback:L,movieId:T,type:M,ch:O,referrerUrl:U})=>`https://stream.cms.rakuten.co.jp/play/?callback=${L}&movie_id=${T}&player_id=${M}&_cmid=0&ch=${O}&_ref=${U}`)({callback:f,movieId:s,type:r,ch:c,referrerUrl:y}),v.setAttribute("async","true"),v.addEventListener("error",()=>{Yw(v,f),A(new Error("PlayLog api request failed"))}),window[f]=L=>{Yw(v,f),E(L)},document.body.appendChild(v)})},Yw=(a,t)=>{a.parentNode&&a.parentNode.removeChild(a),delete window[t]};var Qw,Xw={},Jw,wD=(Qw||(Qw=1,Jw=Xw,function(){var a=typeof window<"u"?window:Wr,t={};for(var r in(function(s,u,f){var c;function v(e){var n=0;return function(){return n<e.length?{done:!1,value:e[n++]}:{done:!0}}}var y=typeof Object.defineProperties=="function"?Object.defineProperty:function(e,n,i){return e==Array.prototype||e==Object.prototype||(e[n]=i.value),e},E=function(e){e=[typeof globalThis=="object"&&globalThis,e,typeof s=="object"&&s,typeof self=="object"&&self,typeof u=="object"&&u];for(var n=0;n<e.length;++n){var i=e[n];if(i&&i.Math==Math)return i}throw Error("Cannot find global object")}(this);function A(e,n){if(n)e:{var i=E;e=e.split(".");for(var o=0;o<e.length-1;o++){var h=e[o];if(!(h in i))break e;i=i[h]}(n=n(o=i[e=e[e.length-1]]))!=o&&n!=null&&y(i,e,{configurable:!0,writable:!0,value:n})}}function L(e){return(e={next:e})[Symbol.iterator]=function(){return this},e}function T(e){var n=typeof Symbol<"u"&&Symbol.iterator&&e[Symbol.iterator];return n?n.call(e):{next:v(e)}}function M(e){if(!(e instanceof Array)){e=T(e);for(var n,i=[];!(n=e.next()).done;)i.push(n.value);e=i}return e}A("Symbol",function(e){function n(h,p){this.g=h,y(this,"description",{configurable:!0,writable:!0,value:p})}if(e)return e;n.prototype.toString=function(){return this.g};var i="jscomp_symbol_"+(1e9*Math.random()>>>0)+"_",o=0;return function h(p){if(this instanceof h)throw new TypeError("Symbol is not a constructor");return new n(i+(p||"")+"_"+o++,p)}}),A("Symbol.iterator",function(e){if(e)return e;e=Symbol("Symbol.iterator");for(var n="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),i=0;i<n.length;i++){var o=E[n[i]];typeof o=="function"&&typeof o.prototype[e]!="function"&&y(o.prototype,e,{configurable:!0,writable:!0,value:function(){return L(v(this))}})}return e});var O,U=typeof Object.create=="function"?Object.create:function(e){function n(){}return n.prototype=e,new n};if(typeof Object.setPrototypeOf=="function")O=Object.setPrototypeOf;else{var $;e:{var z={};try{z.__proto__={a:!0},$=z.a;break e}catch{}$=!1}O=$?function(e,n){if(e.__proto__=n,e.__proto__!==n)throw new TypeError(e+" is not extensible");return e}:null}var Q=O;function Z(e,n){if(e.prototype=U(n.prototype),e.prototype.constructor=e,Q)Q(e,n);else for(var i in n)if(i!="prototype")if(Object.defineProperties){var o=Object.getOwnPropertyDescriptor(n,i);o&&Object.defineProperty(e,i,o)}else e[i]=n[i];e.fj=n.prototype}function ie(){this.o=!1,this.l=null,this.h=void 0,this.g=1,this.j=this.m=0,this.u=this.i=null}function se(e){if(e.o)throw new TypeError("Generator is already running");e.o=!0}function ye(e,n){e.i={Mf:n,Xf:!0},e.g=e.m||e.j}function N(e,n,i){return e.g=i,{value:n}}function re(e){e.g=0}function ne(e,n,i){e.m=n,i!=null&&(e.j=i)}function Se(e,n){e.m=0,e.j=n||0}function ce(e,n,i){e.g=n,e.m=i||0}function we(e,n){return e.m=n||0,n=e.i.Mf,e.i=null,n}function ze(e){e.u=[e.i],e.m=0,e.j=0}function xe(e,n){var i=e.u.splice(0)[0];(i=e.i=e.i||i)?i.Xf?e.g=e.m||e.j:i.B!=null&&e.j<i.B?(e.g=i.B,e.i=null):e.g=e.j:e.g=n}function Ce(e){this.g=new ie,this.h=e}function J(e,n,i,o){try{var h=n.call(e.g.l,i);if(!(h instanceof Object))throw new TypeError("Iterator result "+h+" is not an object");if(!h.done)return e.g.o=!1,h;var p=h.value}catch(g){return e.g.l=null,ye(e.g,g),ue(e)}return e.g.l=null,o.call(e.g,p),ue(e)}function ue(e){for(;e.g.g;)try{var n=e.h(e.g);if(n)return e.g.o=!1,{value:n.value,done:!1}}catch(i){e.g.h=void 0,ye(e.g,i)}if(e.g.o=!1,e.g.i){if(n=e.g.i,e.g.i=null,n.Xf)throw n.Mf;return{value:n.return,done:!0}}return{value:void 0,done:!0}}function de(e){this.next=function(n){return se(e.g),e.g.l?n=J(e,e.g.l.next,n,e.g.s):(e.g.s(n),n=ue(e)),n},this.throw=function(n){return se(e.g),e.g.l?n=J(e,e.g.l.throw,n,e.g.s):(ye(e.g,n),n=ue(e)),n},this.return=function(n){return function(i,o){se(i.g);var h=i.g.l;return h?J(i,"return"in h?h.return:function(p){return{value:p,done:!0}},o,i.g.return):(i.g.return(o),ue(i))}(e,n)},this[Symbol.iterator]=function(){return this}}function W(e){return function(n){function i(h){return n.next(h)}function o(h){return n.throw(h)}return new Promise(function(h,p){(function g(b){b.done?h(b.value):Promise.resolve(b.value).then(i,o).then(g,p)})(n.next())})}(new de(new Ce(e)))}function Ke(){for(var e=Number(this),n=[],i=e;i<arguments.length;i++)n[i-e]=arguments[i];return n}function nt(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function mt(e,n){e instanceof String&&(e+="");var i=0,o=!1,h={next:function(){if(!o&&i<e.length){var p=i++;return{value:n(p,e[p]),done:!1}}return o=!0,{done:!0,value:void 0}}};return h[Symbol.iterator]=function(){return h},h}function ot(e,n,i){e instanceof String&&(e=String(e));for(var o=e.length,h=0;h<o;h++){var p=e[h];if(n.call(i,p,h,e))return{Uf:h,v:p}}return{Uf:-1,v:void 0}}function lt(e,n,i){if(e==null)throw new TypeError("The 'this' value for String.prototype."+i+" must not be null or undefined");if(n instanceof RegExp)throw new TypeError("First argument to String.prototype."+i+" must not be a regular expression");return e+""}ie.prototype.s=function(e){this.h=e},ie.prototype.return=function(e){this.i={return:e},this.g=this.j},ie.prototype.B=function(e){this.g=e},A("Promise",function(e){function n(g){this.h=0,this.i=void 0,this.g=[],this.o=!1;var b=this.j();try{g(b.resolve,b.reject)}catch(w){b.reject(w)}}function i(){this.g=null}function o(g){return g instanceof n?g:new n(function(b){b(g)})}if(e)return e;i.prototype.h=function(g){if(this.g==null){this.g=[];var b=this;this.i(function(){b.l()})}this.g.push(g)};var h=E.setTimeout;i.prototype.i=function(g){h(g,0)},i.prototype.l=function(){for(;this.g&&this.g.length;){var g=this.g;this.g=[];for(var b=0;b<g.length;++b){var w=g[b];g[b]=null;try{w()}catch(k){this.j(k)}}}this.g=null},i.prototype.j=function(g){this.i(function(){throw g})},n.prototype.j=function(){function g(k){return function(I){w||(w=!0,k.call(b,I))}}var b=this,w=!1;return{resolve:g(this.F),reject:g(this.l)}},n.prototype.F=function(g){if(g===this)this.l(new TypeError("A Promise cannot resolve to itself"));else if(g instanceof n)this.H(g);else{e:switch(typeof g){case"object":var b=g!=null;break e;case"function":b=!0;break e;default:b=!1}b?this.C(g):this.m(g)}},n.prototype.C=function(g){var b=void 0;try{b=g.then}catch(w){return void this.l(w)}typeof b=="function"?this.J(b,g):this.m(g)},n.prototype.l=function(g){this.s(2,g)},n.prototype.m=function(g){this.s(1,g)},n.prototype.s=function(g,b){if(this.h!=0)throw Error("Cannot settle("+g+", "+b+"): Promise already settled in state"+this.h);this.h=g,this.i=b,this.h===2&&this.G(),this.u()},n.prototype.G=function(){var g=this;h(function(){if(g.A()){var b=E.console;b!==void 0&&b.error(g.i)}},1)},n.prototype.A=function(){if(this.o)return!1;var g=E.CustomEvent,b=E.Event,w=E.dispatchEvent;return w===void 0||(typeof g=="function"?g=new g("unhandledrejection",{cancelable:!0}):typeof b=="function"?g=new b("unhandledrejection",{cancelable:!0}):(g=E.document.createEvent("CustomEvent")).initCustomEvent("unhandledrejection",!1,!0,g),g.promise=this,g.reason=this.i,w(g))},n.prototype.u=function(){if(this.g!=null){for(var g=0;g<this.g.length;++g)p.h(this.g[g]);this.g=null}};var p=new i;return n.prototype.H=function(g){var b=this.j();g.rd(b.resolve,b.reject)},n.prototype.J=function(g,b){var w=this.j();try{g.call(b,w.resolve,w.reject)}catch(k){w.reject(k)}},n.prototype.then=function(g,b){function w(C,D){return typeof C=="function"?function(_){try{k(C(_))}catch(j){I(j)}}:D}var k,I,x=new n(function(C,D){k=C,I=D});return this.rd(w(g,k),w(b,I)),x},n.prototype.catch=function(g){return this.then(void 0,g)},n.prototype.rd=function(g,b){function w(){switch(k.h){case 1:g(k.i);break;case 2:b(k.i);break;default:throw Error("Unexpected state: "+k.h)}}var k=this;this.g==null?p.h(w):this.g.push(w),this.o=!0},n.resolve=o,n.reject=function(g){return new n(function(b,w){w(g)})},n.race=function(g){return new n(function(b,w){for(var k=T(g),I=k.next();!I.done;I=k.next())o(I.value).rd(b,w)})},n.all=function(g){var b=T(g),w=b.next();return w.done?o([]):new n(function(k,I){function x(_){return function(j){C[_]=j,--D==0&&k(C)}}var C=[],D=0;do C.push(void 0),D++,o(w.value).rd(x(C.length-1),I),w=b.next();while(!w.done)})},n}),A("WeakMap",function(e){function n(w){if(this.g=(b+=Math.random()+1).toString(),w){w=T(w);for(var k;!(k=w.next()).done;)k=k.value,this.set(k[0],k[1])}}function i(){}function o(w){var k=typeof w;return k==="object"&&w!==null||k==="function"}function h(w){if(!nt(w,g)){var k=new i;y(w,g,{value:k})}}function p(w){var k=Object[w];k&&(Object[w]=function(I){return I instanceof i?I:(Object.isExtensible(I)&&h(I),k(I))})}if(function(){if(!e||!Object.seal)return!1;try{var w=Object.seal({}),k=Object.seal({}),I=new e([[w,2],[k,3]]);return I.get(w)==2&&I.get(k)==3&&(I.delete(w),I.set(k,4),!I.has(w)&&I.get(k)==4)}catch{return!1}}())return e;var g="$jscomp_hidden_"+Math.random();p("freeze"),p("preventExtensions"),p("seal");var b=0;return n.prototype.set=function(w,k){if(!o(w))throw Error("Invalid WeakMap key");if(h(w),!nt(w,g))throw Error("WeakMap key fail: "+w);return w[g][this.g]=k,this},n.prototype.get=function(w){return o(w)&&nt(w,g)?w[g][this.g]:void 0},n.prototype.has=function(w){return o(w)&&nt(w,g)&&nt(w[g],this.g)},n.prototype.delete=function(w){return!!(o(w)&&nt(w,g)&&nt(w[g],this.g))&&delete w[g][this.g]},n}),A("Map",function(e){function n(){var b={};return b.qb=b.next=b.head=b}function i(b,w){var k=b.g;return L(function(){if(k){for(;k.head!=b.g;)k=k.qb;for(;k.next!=k.head;)return k=k.next,{done:!1,value:w(k)};k=null}return{done:!0,value:void 0}})}function o(b,w){var k=w&&typeof w;k=="object"||k=="function"?p.has(w)?k=p.get(w):(k=""+ ++g,p.set(w,k)):k="p_"+w;var I=b.h[k];if(I&&nt(b.h,k))for(b=0;b<I.length;b++){var x=I[b];if(w!=w&&x.key!=x.key||w===x.key)return{id:k,list:I,index:b,entry:x}}return{id:k,list:I,index:-1,entry:void 0}}function h(b){if(this.h={},this.g=n(),this.size=0,b){b=T(b);for(var w;!(w=b.next()).done;)w=w.value,this.set(w[0],w[1])}}if(function(){if(!e||typeof e!="function"||!e.prototype.entries||typeof Object.seal!="function")return!1;try{var b=Object.seal({x:4}),w=new e(T([[b,"s"]]));if(w.get(b)!="s"||w.size!=1||w.get({x:4})||w.set({x:4},"t")!=w||w.size!=2)return!1;var k=w.entries(),I=k.next();return!I.done&&I.value[0]==b&&I.value[1]=="s"&&!((I=k.next()).done||I.value[0].x!=4||I.value[1]!="t"||!k.next().done)}catch{return!1}}())return e;var p=new WeakMap;h.prototype.set=function(b,w){var k=o(this,b=b===0?0:b);return k.list||(k.list=this.h[k.id]=[]),k.entry?k.entry.value=w:(k.entry={next:this.g,qb:this.g.qb,head:this.g,key:b,value:w},k.list.push(k.entry),this.g.qb.next=k.entry,this.g.qb=k.entry,this.size++),this},h.prototype.delete=function(b){return!(!(b=o(this,b)).entry||!b.list||(b.list.splice(b.index,1),b.list.length||delete this.h[b.id],b.entry.qb.next=b.entry.next,b.entry.next.qb=b.entry.qb,b.entry.head=null,this.size--,0))},h.prototype.clear=function(){this.h={},this.g=this.g.qb=n(),this.size=0},h.prototype.has=function(b){return!!o(this,b).entry},h.prototype.get=function(b){return(b=o(this,b).entry)&&b.value},h.prototype.entries=function(){return i(this,function(b){return[b.key,b.value]})},h.prototype.keys=function(){return i(this,function(b){return b.key})},h.prototype.values=function(){return i(this,function(b){return b.value})},h.prototype.forEach=function(b,w){for(var k,I=this.entries();!(k=I.next()).done;)k=k.value,b.call(w,k[1],k[0],this)},h.prototype[Symbol.iterator]=h.prototype.entries;var g=0;return h}),A("Set",function(e){function n(i){if(this.g=new Map,i){i=T(i);for(var o;!(o=i.next()).done;)this.add(o.value)}this.size=this.g.size}return function(){if(!e||typeof e!="function"||!e.prototype.entries||typeof Object.seal!="function")return!1;try{var i=Object.seal({x:4}),o=new e(T([i]));if(!o.has(i)||o.size!=1||o.add(i)!=o||o.size!=1||o.add({x:4})!=o||o.size!=2)return!1;var h=o.entries(),p=h.next();return!p.done&&p.value[0]==i&&p.value[1]==i&&!(p=h.next()).done&&p.value[0]!=i&&p.value[0].x==4&&p.value[1]==p.value[0]&&h.next().done}catch{return!1}}()?e:(n.prototype.add=function(i){return i=i===0?0:i,this.g.set(i,i),this.size=this.g.size,this},n.prototype.delete=function(i){return i=this.g.delete(i),this.size=this.g.size,i},n.prototype.clear=function(){this.g.clear(),this.size=0},n.prototype.has=function(i){return this.g.has(i)},n.prototype.entries=function(){return this.g.entries()},n.prototype.values=function(){return this.g.values()},n.prototype.keys=n.prototype.values,n.prototype[Symbol.iterator]=n.prototype.values,n.prototype.forEach=function(i,o){var h=this;this.g.forEach(function(p){return i.call(o,p,p,h)})},n)}),A("Array.prototype.keys",function(e){return e||function(){return mt(this,function(n){return n})}}),A("Array.prototype.findIndex",function(e){return e||function(n,i){return ot(this,n,i).Uf}}),A("Object.is",function(e){return e||function(n,i){return n===i?n!==0||1/n==1/i:n!=n&&i!=i}}),A("Array.prototype.includes",function(e){return e||function(n,i){var o=this;o instanceof String&&(o=String(o));var h=o.length;for(0>(i=i||0)&&(i=Math.max(i+h,0));i<h;i++){var p=o[i];if(p===n||Object.is(p,n))return!0}return!1}}),A("String.prototype.includes",function(e){return e||function(n,i){return lt(this,n,"includes").indexOf(n,i||0)!==-1}}),A("Array.prototype.find",function(e){return e||function(n,i){return ot(this,n,i).v}}),A("String.prototype.startsWith",function(e){return e||function(n,i){var o=lt(this,n,"startsWith"),h=o.length,p=n.length;i=Math.max(0,Math.min(0|i,o.length));for(var g=0;g<p&&i<h;)if(o[i++]!=n[g++])return!1;return g>=p}}),A("WeakSet",function(e){function n(i){if(this.g=new WeakMap,i){i=T(i);for(var o;!(o=i.next()).done;)this.add(o.value)}}return function(){if(!e||!Object.seal)return!1;try{var i=Object.seal({}),o=Object.seal({}),h=new e([i]);return!(!h.has(i)||h.has(o))&&(h.delete(i),h.add(o),!h.has(i)&&h.has(o))}catch{return!1}}()?e:(n.prototype.add=function(i){return this.g.set(i,!0),this},n.prototype.has=function(i){return this.g.has(i)},n.prototype.delete=function(i){return this.g.delete(i)},n)}),A("Array.from",function(e){return e||function(n,i,o){i=i??function(b){return b};var h=[],p=typeof Symbol<"u"&&Symbol.iterator&&n[Symbol.iterator];if(typeof p=="function"){n=p.call(n);for(var g=0;!(p=n.next()).done;)h.push(i.call(o,p.value,g++))}else for(p=n.length,g=0;g<p;g++)h.push(i.call(o,n[g],g));return h}});var nn=typeof Object.assign=="function"?Object.assign:function(e,n){for(var i=1;i<arguments.length;i++){var o=arguments[i];if(o)for(var h in o)nt(o,h)&&(e[h]=o[h])}return e};A("Object.assign",function(e){return e||nn}),A("Array.prototype.values",function(e){return e||function(){return mt(this,function(n,i){return i})}}),A("Promise.prototype.finally",function(e){return e||function(n){return this.then(function(i){return Promise.resolve(n()).then(function(){return i})},function(i){return Promise.resolve(n()).then(function(){throw i})})}}),A("Array.prototype.entries",function(e){return e||function(){return mt(this,function(n,i){return[n,i]})}}),A("String.prototype.repeat",function(e){return e||function(n){var i=lt(this,null,"repeat");if(0>n||1342177279<n)throw new RangeError("Invalid count value");n|=0;for(var o="";n;)1&n&&(o+=i),(n>>>=1)&&(i+=i);return o}}),A("Number.isNaN",function(e){return e||function(n){return typeof n=="number"&&isNaN(n)}}),A("Number.isFinite",function(e){return e||function(n){return typeof n=="number"&&!isNaN(n)&&n!==1/0&&n!==-1/0}}),A("Object.values",function(e){return e||function(n){var i,o=[];for(i in n)nt(n,i)&&o.push(n[i]);return o}}),A("Math.log2",function(e){return e||function(n){return Math.log(n)/Math.LN2}}),A("Number.MAX_SAFE_INTEGER",function(){return 9007199254740991}),A("Math.trunc",function(e){return e||function(n){if(n=Number(n),isNaN(n)||n===1/0||n===-1/0||n===0)return n;var i=Math.floor(Math.abs(n));return 0>n?-i:i}}),A("Object.entries",function(e){return e||function(n){var i,o=[];for(i in n)nt(n,i)&&o.push([i,n[i]]);return o}});var pn=this||self;function We(e,n){e=e.split(".");var i,o=pn;for((e[0]in o)||o.execScript===void 0||o.execScript("var "+e[0]);e.length&&(i=e.shift());)e.length||n===void 0?o=o[i]&&o[i]!==Object.prototype[i]?o[i]:o[i]={}:o[i]=n}function Ot(){}function gn(){}function bt(e){this.g=Math.exp(Math.log(.5)/e),this.i=this.h=0}function Wt(e){return e.h/(1-Math.pow(e.g,e.i))}function Un(){this.h=new bt(2),this.j=new bt(5),this.g=0,this.i=128e3,this.l=16e3}function Ir(){}function Kn(){}function Rt(){}function Lr(e){var n=Ke.apply(1,arguments);hu.has(e)||(hu.add(e),Rt.apply(Ir,M(n)))}function $s(){}bt.prototype.sample=function(e,n){var i=Math.pow(this.g,e);n=n*(1-i)+i*this.h,isNaN(n)||(this.h=n,this.i+=e)},Un.prototype.configure=function(e){this.i=e.minTotalBytes,this.l=e.minBytes,this.h.g=Math.exp(Math.log(.5)/e.fastHalfLife),this.j.g=Math.exp(Math.log(.5)/e.slowHalfLife)},Un.prototype.sample=function(e,n){if(!(n<this.l)){var i=8e3*n/e;e/=1e3,this.g+=n,this.h.sample(e,i),this.j.sample(e,i)}},Un.prototype.getBandwidthEstimate=function(e){return this.g<this.i?e:Math.min(Wt(this.h),Wt(this.j))};var hu=new Set;function Ba(){this.g={}}function mn(){this.g=new Ba}function dp(e,n,i,o){this.target=e,this.type=n,this.listener=i,this.g=function(h,p){if(p==null)return!1;if(typeof p=="boolean")return p;var g=new Set(["passive","capture"]);return Object.keys(p).filter(function(b){return!g.has(b)}),function(b){var w=lh;if(w==null){w=!1;try{var k={},I={get:function(){return w=!0,!1}};Object.defineProperty(k,"passive",I),Object.defineProperty(k,"capture",I),I=function(){},b.addEventListener("test",I,k),b.removeEventListener("test",I,k)}catch{w=!1}lh=w}return w||!1}(h)?p:p.capture||!1}(e,o),this.target.addEventListener(n,i,this.g)}s.console&&(Rt=function(){},Kn=function(){}),(c=Ba.prototype).push=function(e,n){this.g.hasOwnProperty(e)?this.g[e].push(n):this.g[e]=[n]},c.get=function(e){return(e=this.g[e])?e.slice():null},c.remove=function(e,n){e in this.g&&(this.g[e]=this.g[e].filter(function(i){return i!=n}),this.g[e].length==0&&delete this.g[e])},c.forEach=function(e){for(var n in this.g)e(n,this.g[n])},c.size=function(){return Object.keys(this.g).length},c.keys=function(){return Object.keys(this.g)},(c=mn.prototype).release=function(){this.$a(),this.g=null},c.D=function(e,n,i,o){this.g&&(e=new dp(e,n,i,o),this.g.push(n,e))},c.ka=function(e,n,i,o){var h=this;this.D(e,n,function p(g){h.Db(e,n,p),i(g)},o)},c.Db=function(e,n,i){if(this.g)for(var o=this.g.get(n)||[],h=(o=T(o)).next();!h.done;h=o.next())(h=h.value).target!=e||i!=h.listener&&i||(h.Db(),this.g.remove(n,h))},c.$a=function(){if(this.g){var e,n=this.g,i=[];for(e in n.g)i.push.apply(i,M(n.g[e]));for(i=(n=T(i)).next();!i.done;i=n.next())i.value.Db();this.g.g={}}},We("shaka.util.EventManager",mn),mn.prototype.removeAll=mn.prototype.$a,mn.prototype.unlisten=mn.prototype.Db,mn.prototype.listenOnce=mn.prototype.ka,mn.prototype.listen=mn.prototype.D,mn.prototype.release=mn.prototype.release,dp.prototype.Db=function(){this.target.removeEventListener(this.type,this.listener,this.g),this.listener=this.target=null,this.g=!1};var lh=void 0;function Dn(e){if(fu.has(e))return fu.get(e);if(s.ManagedMediaSource){var n=ManagedMediaSource.isTypeSupported(e);return fu.set(e,n),n}return!!s.MediaSource&&(n=MediaSource.isTypeSupported(e),fu.set(e,n),n)}function $a(){return!!s.SourceBuffer&&!!SourceBuffer.prototype&&!!SourceBuffer.prototype.changeType}var fu=new Map;function fr(){}function ar(){}function pr(){}function vs(e,n){if(!e&&!n)return!0;if(!e||!n||e.byteLength!=n.byteLength)return!1;if(Mm(e)==Mm(n)&&(e.byteOffset||0)==(n.byteOffset||0))return!0;var i=Nt(e);n=Nt(n);for(var o=0;o<e.byteLength;o++)if(i[o]!=n[o])return!1;return!0}function Mm(e){return e instanceof ArrayBuffer?e:e.buffer}function bs(e){return e instanceof ArrayBuffer?e:e.byteOffset==0&&e.byteLength==e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer}function Nt(e,n,i){return Fi(e,n===void 0?0:n,i=i===void 0?1/0:i,Uint8Array)}function Wi(e,n,i){return Fi(e,n===void 0?0:n,i=i===void 0?1/0:i,Uint16Array)}function Nr(e,n,i){return Fi(e,n===void 0?0:n,i=i===void 0?1/0:i,DataView)}function Fi(e,n,i,o){var h=Mm(e),p=1;"BYTES_PER_ELEMENT"in o&&(p=o.BYTES_PER_ELEMENT);var g=((e.byteOffset||0)+e.byteLength)/p;return new o(h,e=Math.floor(Math.max(0,Math.min(((e.byteOffset||0)+n)/p,g))),Math.floor(Math.min(e+Math.max(i,0),g))-e)}function uh(){}function Yi(e){this.l=new ar,(e=vl[e.toLowerCase()])&&(this.l=e()),this.h=new fr,(e=bl)&&(this.h=e())}fr.prototype.extract=function(){},fr.prototype.decode=function(){return[]},fr.prototype.clear=function(){},fr.prototype.getStreams=function(){return[]},ar.prototype.init=function(){},ar.prototype.parse=function(){return[]},We("shaka.util.BufferUtils",pr),pr.toDataView=Nr,pr.toUint16=Wi,pr.toUint8=Nt,pr.toArrayBuffer=bs,pr.equal=vs,uh.prototype.init=function(){},uh.prototype.i=function(){},uh.prototype.g=function(){},uh.prototype.j=function(){},We("shaka.media.IClosedCaptionParser",uh),Yi.prototype.init=function(e,n){n!==void 0&&n||(this.g(),this.l.init(e))},Yi.prototype.i=function(e){for(var n=(e=T(e=this.l.parse(e))).next();!n.done;n=e.next()){var i=Nt((n=n.value).packet);0<i.length&&this.h.extract(i,n.pts)}return this.h.decode()},Yi.prototype.g=function(){this.h.clear()},Yi.prototype.j=function(){return this.h.getStreams()},We("shaka.media.ClosedCaptionParser",Yi),Yi.findDecoder=function(){return bl},Yi.unregisterDecoder=function(){bl=null},Yi.registerDecoder=function(e){bl=e},Yi.findParser=function(e){return vl[e]},Yi.unregisterParser=function(e){delete vl[e]},Yi.registerParser=function(e,n){vl[e]=n};var vl={},bl=null;function El(e,n){return!(typeof e!="number"||typeof n!="number"||!isNaN(e)||!isNaN(n))||e===n}function Qi(e,n){-1<(n=e.indexOf(n))&&e.splice(n,1)}function $c(e,n,i){if(i||(i=El),e.length!=n.length)return!1;n=n.slice();for(var o={},h=(e=T(e)).next();!h.done;o={be:o.be},h=e.next()){if(o.be=h.value,(h=n.findIndex(function(p){return function(g){return i(p.be,g)}}(o)))==-1)return!1;n[h]=n[n.length-1],n.pop()}return n.length==0}function Om(e,n,i){if(i||(i=El),e.length!=n.length)return!1;for(var o=0;o<e.length;o++)if(!i(e[o],n[o]))return!1;return!0}function Bn(e,n,i){this.startTime=e,this.endTime=n,this.payload=i,this.region=new Es,this.position=null,this.positionAlign=Tl,this.size=0,this.textAlign=ja,this.direction=js,this.writingMode=Hr,this.lineInterpretation=mi,this.line=null,this.lineHeight="",this.lineAlign=Gs,this.displayAlign=jc,this.fontSize=this.border=this.backgroundImage=this.backgroundColor=this.color="",this.fontWeight=Fm,this.fontStyle=pu,this.linePadding=this.letterSpacing=this.fontFamily="",this.opacity=1,this.textCombineUpright="",this.textDecoration=[],this.textStrokeWidth=this.textStrokeColor=this.textShadow="",this.wrapLine=!0,this.id="",this.nestedCues=[],this.lineBreak=this.isContainer=!1,this.rubyTag=null,this.cellResolution={Jb:32,rows:15}}function Nm(e,n){return(e=new Bn(e,n,"")).lineBreak=!0,e}function ch(e,n){if(e.startTime!=n.startTime||e.endTime!=n.endTime||e.payload!=n.payload)return!1;for(var i in e)if(i!="startTime"&&i!="endTime"&&i!="payload"){if(i=="nestedCues"){if(!Om(e.nestedCues,n.nestedCues,ch))return!1}else if(i=="region"||i=="cellResolution"){for(var o in e[i])if(e[i][o]!=n[i][o])return!1}else if(Array.isArray(e[i])){if(!Om(e[i],n[i]))return!1}else if(e[i]!=n[i])return!1}return!0}Bn.prototype.clone=function(){var e,n=new Bn(0,0,"");for(e in this)n[e]=this[e],n[e]&&n[e].constructor==Array&&(n[e]=n[e].slice());return n},We("shaka.text.Cue",Bn),Bn.equal=ch,Bn.prototype.clone=Bn.prototype.clone;var Tl="auto";Bn.positionAlign={LEFT:"line-left",RIGHT:"line-right",CENTER:"center",AUTO:Tl};var ja="center",hp={LEFT:"left",RIGHT:"right",CENTER:ja,START:"start",END:"end"};Bn.textAlign=hp;var jc="after",_m={BEFORE:"before",CENTER:"center",AFTER:jc};Bn.displayAlign=_m;var js="ltr";Bn.direction={HORIZONTAL_LEFT_TO_RIGHT:js,HORIZONTAL_RIGHT_TO_LEFT:"rtl"};var Hr="horizontal-tb";Bn.writingMode={HORIZONTAL_TOP_TO_BOTTOM:Hr,VERTICAL_LEFT_TO_RIGHT:"vertical-lr",VERTICAL_RIGHT_TO_LEFT:"vertical-rl"};var mi=0;Bn.lineInterpretation={LINE_NUMBER:mi,PERCENTAGE:1};var Gs="start",dh={CENTER:"center",START:Gs,END:"end"};Bn.lineAlign=dh;var H0={white:"white",lime:"lime",cyan:"cyan",red:"red",yellow:"yellow",magenta:"magenta",blue:"blue",black:"black"};Bn.defaultTextColor=H0;var V0={bg_white:"white",bg_lime:"lime",bg_cyan:"cyan",bg_red:"red",bg_yellow:"yellow",bg_magenta:"magenta",bg_blue:"blue",bg_black:"black"};Bn.defaultTextBackgroundColor=V0;var Fm=400;Bn.fontWeight={NORMAL:Fm,BOLD:700};var pu="normal",fp={NORMAL:pu,ITALIC:"italic",OBLIQUE:"oblique"};function Es(){this.id="",this.regionAnchorY=this.regionAnchorX=this.viewportAnchorY=this.viewportAnchorX=0,this.height=this.width=100,this.viewportAnchorUnits=this.widthUnits=this.heightUnits=ii,this.scroll=Gc}Bn.fontStyle=fp,Bn.textDecoration={UNDERLINE:"underline",LINE_THROUGH:"lineThrough",OVERLINE:"overline"},We("shaka.text.CueRegion",Es);var ii=1;Es.units={PX:0,PERCENTAGE:ii,LINES:2};var Gc="";function Ts(){}function gr(e,n,i){pp[e.toLowerCase().split(";")[0]+"-"+i]={priority:i,Wd:n}}function wo(e,n){for(var i=e.toLowerCase().split(";")[0],o=T([K0,fa,Sl,Xi]),h=o.next();!h.done;h=o.next())if(h=pp[i+"-"+h.value]){var p=h.Wd(),g=p.isSupported(e,n);if(p.destroy(),g)return h.Wd}return null}Es.scrollMode={NONE:Gc,UP:"up"},Ts.prototype.destroy=function(){},We("shaka.transmuxer.TransmuxerEngine",Ts),Ts.findTransmuxer=wo,Ts.unregisterTransmuxer=function(e,n){delete pp[e.toLowerCase().split(";")[0]+"-"+n]},Ts.registerTransmuxer=gr,Ts.prototype.destroy=Ts.prototype.destroy;var pp={},Xi=1,Sl=2,fa=3,K0=4;Ts.PluginPriority={FALLBACK:Xi,PREFERRED_SECONDARY:Sl,PREFERRED:fa,APPLICATION:K0};var z0=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#(.*))?$");function mr(e){var n;e instanceof mr?(gu(this,e.ab),this.Wb=e.Wb,mu(this,e.mb),pa(this,e.nc),this.Da=e.Da,Ii(this,e.g.clone()),this.Kb=e.Kb):e&&(n=String(e).match(z0))?(gu(this,n[1]||"",!0),this.Wb=Hc(n[2]||""),mu(this,n[3]||"",!0),pa(this,n[4]),this.Da=Hc(n[5]||"",!0),Ii(this,n[6]||"",!0),this.Kb=Hc(n[7]||"")):this.g=new yu(null)}function gu(e,n,i){e.ab=i?Hc(n,!0):n,e.ab&&(e.ab=e.ab.replace(/:$/,""))}function mu(e,n,i){e.mb=i?Hc(n,!0):n}function pa(e,n){if(n){if(n=Number(n),isNaN(n)||0>n)throw Error("Bad port number "+n);e.nc=n}else e.nc=null}function Ii(e,n,i){n instanceof yu?e.g=n:(i||(n=wl(n,Um)),e.g=new yu(n))}function Hc(e,n){return e?n?decodeURI(e):decodeURIComponent(e):""}function wl(e,n,i){return e!=null?(e=encodeURI(e).replace(n,q0),i&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function q0(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}(c=mr.prototype).ab="",c.Wb="",c.mb="",c.nc=null,c.Da="",c.Kb="",c.toString=function(){var e=[],n=this.ab;if(n&&e.push(wl(n,hh,!0),":"),n=this.mb){e.push("//");var i=this.Wb;i&&e.push(wl(i,hh,!0),"@"),e.push(encodeURIComponent(n).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),(n=this.nc)!=null&&e.push(":",String(n))}return(n=this.Da)&&(this.mb&&n.charAt(0)!="/"&&e.push("/"),e.push(wl(n,n.charAt(0)=="/"?ga:KT,!0))),(n=this.g.toString())&&e.push("?",n),(n=this.Kb)&&e.push("#",wl(n,W0)),e.join("")},c.resolve=function(e){var n=this.clone();n.ab==="data"&&(n=new mr);var i=!!e.ab;i?gu(n,e.ab):i=!!e.Wb,i?n.Wb=e.Wb:i=!!e.mb,i?mu(n,e.mb):i=e.nc!=null;var o=e.Da;if(i)pa(n,e.nc);else if(i=!!e.Da){if(o.charAt(0)!="/")if(this.mb&&!this.Da)o="/"+o;else{var h=n.Da.lastIndexOf("/");h!=-1&&(o=n.Da.substr(0,h+1)+o)}if(o==".."||o==".")o="";else if(o.indexOf("./")!=-1||o.indexOf("/.")!=-1){h=o.lastIndexOf("/",0)==0,o=o.split("/");for(var p=[],g=0;g<o.length;){var b=o[g++];b=="."?h&&g==o.length&&p.push(""):b==".."?((1<p.length||p.length==1&&p[0]!="")&&p.pop(),h&&g==o.length&&p.push("")):(p.push(b),h=!0)}o=p.join("/")}}return i?n.Da=o:i=e.g.toString()!=="",i?Ii(n,e.g.clone()):i=!!e.Kb,i&&(n.Kb=e.Kb),n},c.clone=function(){return new mr(this)};var hh=/[#\/\?@]/g,KT=/[#\?:]/g,ga=/[#\?]/g,Um=/[#\?@]/g,W0=/#/g;function yu(e){this.g=e||null}function Ao(e){if(!e.va&&(e.va={},e.Pc=0,e.g))for(var n=e.g.split("&"),i=0;i<n.length;i++){var o=n[i].indexOf("="),h=null;if(0<=o){var p=n[i].substring(0,o);h=n[i].substring(o+1)}else p=n[i];p=decodeURIComponent(p.replace(/\+/g," ")),h=h||"",e.add(p,decodeURIComponent(h.replace(/\+/g," ")))}}function Bm(e){return Ao(e),e.Pc}function fe(e,n,i){var o=Ke.apply(3,arguments);this.severity=e,this.category=n,this.code=i,this.data=o,this.handled=!1,this.message="Shaka Error "+this.code;try{throw Error(this.message||"Shaka Error")}catch(h){this.stack=h.stack}}function Rr(e,n){if(n.length==0)return e;if(e.length==1&&n.length==1){var i=new mr(e[0]);return n=new mr(n[0]),[i.resolve(n).toString()]}n=n.map(function(g){return new mr(g)}),i=[];for(var o=(e=T(e)).next();!o.done;o=e.next()){o=new mr(o.value);for(var h=T(n),p=h.next();!p.done;p=h.next())i.push(o.resolve(p.value).toString())}return i}function Al(e,n){return{keySystem:e,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,serverCertificateUri:"",sessionType:"",initData:n||[],keyIds:new Set}}function vu(e,n){if(n.length==1)return n[0];if((e=Li(e,n))!=null)return e;throw new fe(2,4,4025,n)}function Li(e,n){for(var i=T(zT[e]),o=i.next();!o.done;o=i.next()){o=o.value;for(var h=T(n),p=h.next();!p.done;p=h.next())if(p=p.value,o.test(p.trim()))return p.trim()}return e==en?"":null}(c=yu.prototype).va=null,c.Pc=null,c.add=function(e,n){Ao(this),this.g=null;var i=this.va.hasOwnProperty(e)?this.va[e]:null;return i||(this.va[e]=i=[]),i.push(n),this.Pc++,this},c.set=function(e,n){return Ao(this),this.g=null,this.va.hasOwnProperty(e)?this.va[e]=[n]:this.add(e,n),this},c.get=function(e){return Ao(this),this.va[e]||[]},c.toString=function(){if(this.g)return this.g;if(!this.va)return"";var e,n=[];for(e in this.va)for(var i=encodeURIComponent(e),o=this.va[e],h=0;h<o.length;h++){var p=i;o[h]!==""&&(p+="="+encodeURIComponent(o[h])),n.push(p)}return this.g=n.join("&")},c.clone=function(){var e=new yu;if(e.g=this.g,this.va){var n,i={};for(n in this.va)i[n]=this.va[n].concat();e.va=i,e.Pc=this.Pc}return e},fe.prototype.toString=function(){return"shaka.util.Error "+JSON.stringify(this,null,"  ")},We("shaka.util.Error",fe),fe.Severity={RECOVERABLE:1,CRITICAL:2},fe.Category={NETWORK:1,TEXT:2,MEDIA:3,MANIFEST:4,STREAMING:5,DRM:6,PLAYER:7,CAST:8,STORAGE:9,ADS:10},fe.Code={UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,REQUEST_FILTER_ERROR:1006,RESPONSE_FILTER_ERROR:1007,MALFORMED_TEST_URI:1008,UNEXPECTED_TEST_REQUEST:1009,ATTEMPTS_EXHAUSTED:1010,SEGMENT_MISSING:1011,INVALID_TEXT_HEADER:2e3,INVALID_TEXT_CUE:2001,UNABLE_TO_DETECT_ENCODING:2003,BAD_ENCODING:2004,INVALID_XML:2005,INVALID_MP4_TTML:2007,INVALID_MP4_VTT:2008,UNABLE_TO_EXTRACT_CUE_START_TIME:2009,INVALID_MP4_CEA:2010,TEXT_COULD_NOT_GUESS_MIME_TYPE:2011,CANNOT_ADD_EXTERNAL_TEXT_TO_SRC_EQUALS:2012,TEXT_ONLY_WEBVTT_SRC_EQUALS:2013,MISSING_TEXT_PLUGIN:2014,CHAPTERS_TRACK_FAILED:2015,UNSUPPORTED_EXTERNAL_THUMBNAILS_URI:2017,BUFFER_READ_OUT_OF_BOUNDS:3e3,JS_INTEGER_OVERFLOW:3001,EBML_OVERFLOW:3002,EBML_BAD_FLOATING_POINT_SIZE:3003,MP4_SIDX_WRONG_BOX_TYPE:3004,MP4_SIDX_INVALID_TIMESCALE:3005,MP4_SIDX_TYPE_NOT_SUPPORTED:3006,WEBM_CUES_ELEMENT_MISSING:3007,WEBM_EBML_HEADER_ELEMENT_MISSING:3008,WEBM_SEGMENT_ELEMENT_MISSING:3009,WEBM_INFO_ELEMENT_MISSING:3010,WEBM_DURATION_ELEMENT_MISSING:3011,WEBM_CUE_TRACK_POSITIONS_ELEMENT_MISSING:3012,WEBM_CUE_TIME_ELEMENT_MISSING:3013,MEDIA_SOURCE_OPERATION_FAILED:3014,MEDIA_SOURCE_OPERATION_THREW:3015,VIDEO_ERROR:3016,QUOTA_EXCEEDED_ERROR:3017,TRANSMUXING_FAILED:3018,CONTENT_TRANSFORMATION_FAILED:3019,MSS_MISSING_DATA_FOR_TRANSMUXING:3020,MSS_TRANSMUXING_CODEC_UNKNOWN:3021,MSS_TRANSMUXING_FAILED:3022,TRANSMUXING_NO_VIDEO_DATA:3023,UNABLE_TO_GUESS_MANIFEST_TYPE:4e3,DASH_INVALID_XML:4001,DASH_NO_SEGMENT_INFO:4002,DASH_EMPTY_ADAPTATION_SET:4003,DASH_EMPTY_PERIOD:4004,DASH_WEBM_MISSING_INIT:4005,DASH_UNSUPPORTED_CONTAINER:4006,DASH_PSSH_BAD_ENCODING:4007,DASH_NO_COMMON_KEY_SYSTEM:4008,DASH_MULTIPLE_KEY_IDS_NOT_SUPPORTED:4009,DASH_CONFLICTING_KEY_IDS:4010,RESTRICTIONS_CANNOT_BE_MET:4012,HLS_PLAYLIST_HEADER_MISSING:4015,INVALID_HLS_TAG:4016,HLS_INVALID_PLAYLIST_HIERARCHY:4017,DASH_DUPLICATE_REPRESENTATION_ID:4018,HLS_MULTIPLE_MEDIA_INIT_SECTIONS_FOUND:4020,HLS_REQUIRED_ATTRIBUTE_MISSING:4023,HLS_REQUIRED_TAG_MISSING:4024,HLS_COULD_NOT_GUESS_CODECS:4025,HLS_KEYFORMATS_NOT_SUPPORTED:4026,DASH_UNSUPPORTED_XLINK_ACTUATE:4027,DASH_XLINK_DEPTH_LIMIT:4028,CONTENT_UNSUPPORTED_BY_BROWSER:4032,CANNOT_ADD_EXTERNAL_TEXT_TO_LIVE_STREAM:4033,NO_VARIANTS:4036,PERIOD_FLATTENING_FAILED:4037,INCONSISTENT_DRM_ACROSS_PERIODS:4038,HLS_VARIABLE_NOT_FOUND:4039,HLS_MSE_ENCRYPTED_MP2T_NOT_SUPPORTED:4040,HLS_MSE_ENCRYPTED_LEGACY_APPLE_MEDIA_KEYS_NOT_SUPPORTED:4041,NO_WEB_CRYPTO_API:4042,CANNOT_ADD_EXTERNAL_THUMBNAILS_TO_LIVE_STREAM:4045,MSS_INVALID_XML:4046,MSS_LIVE_CONTENT_NOT_SUPPORTED:4047,AES_128_INVALID_IV_LENGTH:4048,AES_128_INVALID_KEY_LENGTH:4049,DASH_CONFLICTING_AES_128:4050,DASH_UNSUPPORTED_AES_128:4051,STREAMING_ENGINE_STARTUP_INVALID_STATE:5006,NO_RECOGNIZED_KEY_SYSTEMS:6e3,REQUESTED_KEY_SYSTEM_CONFIG_UNAVAILABLE:6001,FAILED_TO_CREATE_CDM:6002,FAILED_TO_ATTACH_TO_VIDEO:6003,INVALID_SERVER_CERTIFICATE:6004,FAILED_TO_CREATE_SESSION:6005,FAILED_TO_GENERATE_LICENSE_REQUEST:6006,LICENSE_REQUEST_FAILED:6007,LICENSE_RESPONSE_REJECTED:6008,ENCRYPTED_CONTENT_WITHOUT_DRM_INFO:6010,NO_LICENSE_SERVER_GIVEN:6012,OFFLINE_SESSION_REMOVED:6013,EXPIRED:6014,SERVER_CERTIFICATE_REQUIRED:6015,INIT_DATA_TRANSFORM_ERROR:6016,SERVER_CERTIFICATE_REQUEST_FAILED:6017,MIN_HDCP_VERSION_NOT_MATCH:6018,ERROR_CHECKING_HDCP_VERSION:6019,LOAD_INTERRUPTED:7e3,OPERATION_ABORTED:7001,NO_VIDEO_ELEMENT:7002,OBJECT_DESTROYED:7003,CONTENT_NOT_LOADED:7004,CAST_API_UNAVAILABLE:8e3,NO_CAST_RECEIVERS:8001,ALREADY_CASTING:8002,UNEXPECTED_CAST_ERROR:8003,CAST_CANCELED_BY_USER:8004,CAST_CONNECTION_TIMED_OUT:8005,CAST_RECEIVER_APP_UNAVAILABLE:8006,STORAGE_NOT_SUPPORTED:9e3,INDEXED_DB_ERROR:9001,DEPRECATED_OPERATION_ABORTED:9002,REQUESTED_ITEM_NOT_FOUND:9003,MALFORMED_OFFLINE_URI:9004,CANNOT_STORE_LIVE_OFFLINE:9005,NO_INIT_DATA_FOR_OFFLINE:9007,LOCAL_PLAYER_INSTANCE_REQUIRED:9008,NEW_KEY_OPERATION_NOT_SUPPORTED:9011,KEY_NOT_FOUND:9012,MISSING_STORAGE_CELL:9013,STORAGE_LIMIT_REACHED:9014,DOWNLOAD_SIZE_CALLBACK_ERROR:9015,MODIFY_OPERATION_NOT_SUPPORTED:9016,INDEXED_DB_INIT_TIMED_OUT:9017,CS_IMA_SDK_MISSING:1e4,CS_AD_MANAGER_NOT_INITIALIZED:10001,SS_IMA_SDK_MISSING:10002,SS_AD_MANAGER_NOT_INITIALIZED:10003,CURRENT_DAI_REQUEST_NOT_FINISHED:10004,MT_AD_MANAGER_NOT_INITIALIZED:10005};var en="text",_r={$:"video",P:"audio",ia:en,ie:"image",gi:"application"},zT={audio:[/^vorbis$/,/^Opus$/,/^opus$/,/^fLaC$/,/^flac$/,/^mp4a/,/^[ae]c-3$/,/^ac-4$/,/^dts[cex]$/,/^iamf/],video:[/^avc/,/^hev/,/^hvc/,/^vvc/,/^vvi/,/^vp0?[89]/,/^av01/,/^dvh/],text:[/^vtt$/,/^wvtt/,/^stpp/]};function Vc(){}function Er(e,n){var i=e;return n&&!Ga.includes(e)&&(i+='; codecs="'+n+'"'),i}function ko(e,n){return n&&(e+='; codecs="'+n+'"'),e}function ma(e,n,i){var o=Er(e,n);return wo(n=ko(e,n))?(e=wo(n))?(i=(e=e()).convertCodecs(i,n),e.destroy()):i=n:i=e!="video/mp2t"&&i=="audio"?o.replace("video","audio"):o,i}function Kc(e,n,i){var o=[n];return $m.forEach(function(h,p){var g=e[p];p=="codecs"?Ga.includes(e.mimeType)||o.push('codecs="'+i+'"'):g&&o.push(h+'="'+g+'"')}),e.hdr=="PQ"&&o.push('eotf="smpte2084"'),o.join(";")}function fh(e){return e.split(";")[0].split("/")[1]}function Ji(e){var n=kl(e);switch(e=n[0],n=n[1].toLowerCase(),!0){case(e==="mp4a"&&n==="69"):case(e==="mp4a"&&n==="6b"):case(e==="mp4a"&&n==="40.34"):return"mp3";case(e==="mp4a"&&n==="66"):case(e==="mp4a"&&n==="67"):case(e==="mp4a"&&n==="68"):case(e==="mp4a"&&n==="40.2"):case(e==="mp4a"&&n==="40.02"):case(e==="mp4a"&&n==="40.5"):case(e==="mp4a"&&n==="40.05"):case(e==="mp4a"&&n==="40.29"):case(e==="mp4a"&&n==="40.42"):return"aac";case(e==="mp4a"&&n==="a5"):return"ac-3";case(e==="mp4a"&&n==="a6"):return"ec-3";case(e==="mp4a"&&n==="b2"):return"dtsx";case(e==="mp4a"&&n==="a9"):return"dtsc";case e==="avc1":case e==="avc3":return"avc";case e==="hvc1":case e==="hev1":return"hevc";case e==="dvh1":case e==="dvhe":return"dovi"}return e}function Hs(e){for(var n=[],i=(e=T(e.split(","))).next();!i.done;i=e.next())i=kl(i.value),n.push(i[0]);return n.sort().join(",")}function Ri(e){return e.split(";")[0]}function Ci(e){return(e=e.split(/ *; */)).shift(),(e=e.find(function(n){return n.startsWith("codecs=")}))?e.split("=")[1].replace(/^"|"$/g,""):""}function zc(e){return e==="application/x-mpegurl"||e==="application/vnd.apple.mpegurl"}function kl(e){var n=(e=e.split("."))[0];return e.shift(),[n,e.join(".")]}We("shaka.util.MimeUtils",Vc),Vc.getFullTypeWithAllCodecs=ko,Vc.getFullType=Er;var $m=new Map().set("codecs","codecs").set("frameRate","framerate").set("bandwidth","bitrate").set("width","width").set("height","height").set("channelsCount","channels"),Ga=["audio/aac","audio/ac3","audio/ec3","audio/mpeg"];function Ha(e){this.i=null,this.j=e,this.u=!1,this.l=this.s=0,this.m=1/0,this.h=this.g=null,this.A="",this.o=new Map}function xl(e){return!!zn[e]||(e=="application/cea-608"||e=="application/cea-708")&&!!bl}function ph(e,n,i){if(e.A=n,n=e.o.get(n))for(var o=T(n.keys()),h=o.next();!h.done;h=o.next())(h=n.get(h.value).filter(function(p){return p.endTime<=i}))&&e.j.append(h)}function jm(e,n,i){n.startTime+=i,n.endTime+=i;for(var o=(n=T(n.nestedCues)).next();!o.done;o=n.next())jm(e,o.value,i)}Ha.prototype.destroy=function(){return this.j=this.i=null,this.o.clear(),Promise.resolve()},Ha.prototype.remove=function(e,n){var i=this;return W(function(o){if(o.g==1)return N(o,Promise.resolve(),2);!i.j||!i.j.remove(e,n)||i.g==null||n<=i.g||e>=i.h||(e<=i.g&&n>=i.h?i.g=i.h=null:e<=i.g&&n<i.h?i.g=n:e>i.g&&n>=i.h&&(i.h=e)),re(o)})},We("shaka.text.TextEngine",Ha),Ha.prototype.destroy=Ha.prototype.destroy,Ha.findParser=function(e){return zn[e]},Ha.unregisterParser=function(e){delete zn[e]},Ha.registerParser=function(e,n){zn[e]=n};var zn={};function Gm(e,n){return e.concat(n)}function gp(){}function Va(e){return e!=null}function si(){}function bu(e,n){return e=dn(e),n=dn(n),e.split("-")[0]==n.split("-")[0]}function xo(e,n){return e=dn(e),n=dn(n),e=e.split("-"),n=n.split("-"),e[0]==n[0]&&e.length==1&&n.length==2}function Hm(e,n){return e=dn(e),n=dn(n),e=e.split("-"),n=n.split("-"),e.length==2&&n.length==2&&e[0]==n[0]}function dn(e){var n=(e=T(e.split("-x-"))).next().value;n=n===void 0?"":n,e=(e=e.next().value)===void 0?"":e;var i=T(n.split("-"));return n=(n=i.next().value)===void 0?"":n,i=(i=i.next().value)===void 0?"":i,e=e?"x-"+e:"",n=n.toLowerCase(),n=Y0.get(n)||n,((i=i.toUpperCase())?n+"-"+i:n)+(e?"-"+e:"")}function Il(e,n){return e=dn(e),(n=dn(n))==e?4:xo(n,e)?3:Hm(n,e)?2:xo(e,n)?1:0}function Vm(e){var n=e.indexOf("-");return e=(e=0<=n?e.substring(0,n):e).toLowerCase(),Y0.get(e)||e}function gh(e){return e.language?dn(e.language):e.audio&&e.audio.language?dn(e.audio.language):e.video&&e.video.language?dn(e.video.language):"und"}function mp(e,n){e=dn(e);var i=new Set,o=T(n);for(n=o.next();!n.done;n=o.next())i.add(dn(n.value));for(n=(o=T(i)).next();!n.done;n=o.next())if((n=n.value)==e)return n;for(n=(o=T(i)).next();!n.done;n=o.next())if(xo(n=n.value,e))return n;for(n=(o=T(i)).next();!n.done;n=o.next())if(Hm(n=n.value,e))return n;for(n=(i=T(i)).next();!n.done;n=i.next())if(xo(e,n=n.value))return n;return null}We("shaka.util.LanguageUtils",si),si.findClosestLocale=mp,si.getLocaleForVariant=gh,si.getLocaleForText=function(e){return dn(e.language||"und")},si.getBase=Vm,si.relatedness=Il,si.areSiblings=function(e,n){var i=Vm(e),o=Vm(n);return e!=i&&n!=o&&i==o},si.normalize=dn,si.isSiblingOf=Hm,si.isParentOf=xo,si.areLanguageCompatible=bu,si.areLocaleCompatible=function(e,n){return(e=dn(e))==(n=dn(n))};var Y0=new Map([["aar","aa"],["abk","ab"],["afr","af"],["aka","ak"],["alb","sq"],["amh","am"],["ara","ar"],["arg","an"],["arm","hy"],["asm","as"],["ava","av"],["ave","ae"],["aym","ay"],["aze","az"],["bak","ba"],["bam","bm"],["baq","eu"],["bel","be"],["ben","bn"],["bih","bh"],["bis","bi"],["bod","bo"],["bos","bs"],["bre","br"],["bul","bg"],["bur","my"],["cat","ca"],["ces","cs"],["cha","ch"],["che","ce"],["chi","zh"],["chu","cu"],["chv","cv"],["cor","kw"],["cos","co"],["cre","cr"],["cym","cy"],["cze","cs"],["dan","da"],["deu","de"],["div","dv"],["dut","nl"],["dzo","dz"],["ell","el"],["eng","en"],["epo","eo"],["est","et"],["eus","eu"],["ewe","ee"],["fao","fo"],["fas","fa"],["fij","fj"],["fin","fi"],["fra","fr"],["fre","fr"],["fry","fy"],["ful","ff"],["geo","ka"],["ger","de"],["gla","gd"],["gle","ga"],["glg","gl"],["glv","gv"],["gre","el"],["grn","gn"],["guj","gu"],["hat","ht"],["hau","ha"],["heb","he"],["her","hz"],["hin","hi"],["hmo","ho"],["hrv","hr"],["hun","hu"],["hye","hy"],["ibo","ig"],["ice","is"],["ido","io"],["iii","ii"],["iku","iu"],["ile","ie"],["ina","ia"],["ind","id"],["ipk","ik"],["isl","is"],["ita","it"],["jav","jv"],["jpn","ja"],["kal","kl"],["kan","kn"],["kas","ks"],["kat","ka"],["kau","kr"],["kaz","kk"],["khm","km"],["kik","ki"],["kin","rw"],["kir","ky"],["kom","kv"],["kon","kg"],["kor","ko"],["kua","kj"],["kur","ku"],["lao","lo"],["lat","la"],["lav","lv"],["lim","li"],["lin","ln"],["lit","lt"],["ltz","lb"],["lub","lu"],["lug","lg"],["mac","mk"],["mah","mh"],["mal","ml"],["mao","mi"],["mar","mr"],["may","ms"],["mkd","mk"],["mlg","mg"],["mlt","mt"],["mon","mn"],["mri","mi"],["msa","ms"],["mya","my"],["nau","na"],["nav","nv"],["nbl","nr"],["nde","nd"],["ndo","ng"],["nep","ne"],["nld","nl"],["nno","nn"],["nob","nb"],["nor","no"],["nya","ny"],["oci","oc"],["oji","oj"],["ori","or"],["orm","om"],["oss","os"],["pan","pa"],["per","fa"],["pli","pi"],["pol","pl"],["por","pt"],["pus","ps"],["que","qu"],["roh","rm"],["ron","ro"],["rum","ro"],["run","rn"],["rus","ru"],["sag","sg"],["san","sa"],["sin","si"],["slk","sk"],["slo","sk"],["slv","sl"],["sme","se"],["smo","sm"],["sna","sn"],["snd","sd"],["som","so"],["sot","st"],["spa","es"],["sqi","sq"],["srd","sc"],["srp","sr"],["ssw","ss"],["sun","su"],["swa","sw"],["swe","sv"],["tah","ty"],["tam","ta"],["tat","tt"],["tel","te"],["tgk","tg"],["tgl","tl"],["tha","th"],["tib","bo"],["tir","ti"],["ton","to"],["tsn","tn"],["tso","ts"],["tuk","tk"],["tur","tr"],["twi","tw"],["uig","ug"],["ukr","uk"],["urd","ur"],["uzb","uz"],["ven","ve"],["vie","vi"],["vol","vo"],["wel","cy"],["wln","wa"],["wol","wo"],["xho","xh"],["yid","yi"],["yor","yo"],["zha","za"],["zho","zh"],["zul","zu"]]);function Ll(e){var n=new WeakSet;return function i(o){switch(typeof o){case"undefined":case"boolean":case"number":case"string":case"symbol":case"function":return o;default:if(!o||o.buffer instanceof ArrayBuffer)return o;if(n.has(o))return null;var h=o.constructor==Array;if(o.constructor!=Object&&!h)return null;n.add(o);var p,g=h?[]:{};for(p in o)g[p]=i(o[p]);return h&&(g.length=o.length),g}}(e)}function Km(e){var n,i={};for(n in e)i[n]=e[n];return i}function mh(e){this.h=e,this.g=null}function Qt(e){this.h=e,this.g=null}function ya(){var e=s.ManagedMediaSource||s.MediaSource;return!(!e||!e.isTypeSupported)}function Eu(e){return Wm().canPlayType(e)!=""}function zm(){return!!navigator.userAgent.match(/Edge?\//)}function yp(){return!!navigator.userAgent.match(/Edge\//)}function qc(){return Nn("Xbox One")}function Tu(){return Nn("Tizen")}function yh(){return Nn("Tizen 3")}function vp(){return Nn("Tizen 2")}function Su(){return Nn("Web0S")}function Wc(){return Su()&&qm()===38}function Zi(){return Nn("CrKey")}function qm(){if(!Nn("Chrome")||yp())return null;var e=navigator.userAgent.match(/Chrome\/(\d+)/);return e?parseInt(e[1],10):null}function vh(){return!!navigator.vendor&&navigator.vendor.includes("Apple")&&!Tu()&&!Nn("PC=EOS")&&!Nn("PC=APL")&&!Nn("VirginMedia")&&!Nn("SOPOpenBrowser")&&!wu()&&!Nn("AFT")&&!Nn("WPE")}function wu(){return Nn("PlayStation 4")}function Au(){if(!vh())return null;var e=navigator.userAgent.match(/Version\/(\d+)/);return e||(e=navigator.userAgent.match(/OS (\d+)(?:_\d+)?/))?parseInt(e[1],10):null}function Nn(e){return(navigator.userAgent||"").includes(e)}function Wm(){return bh||(Rl||(Rl=new Qt(function(){bh=null})),(bh=document.getElementsByTagName("video")[0]||document.getElementsByTagName("audio")[0])||(bh=document.createElement("video")),Rl.U(1),bh)}mh.prototype.U=function(e){var n=this;this.stop();var i=!0,o=null;return this.g=function(){s.clearTimeout(o),i=!1},o=s.setTimeout(function(){i&&n.h()},1e3*e),this},mh.prototype.stop=function(){this.g&&(this.g(),this.g=null)},Qt.prototype.qc=function(){return this.stop(),this.h(),this},Qt.prototype.U=function(e){var n=this;return this.stop(),this.g=new mh(function(){n.h()}).U(e),this},Qt.prototype.Ra=function(e){var n=this;return this.stop(),this.g=new mh(function(){n.g.U(e),n.h()}).U(e),this},Qt.prototype.stop=function(){this.g&&(this.g.stop(),this.g=null)},We("shaka.util.Timer",Qt),Qt.prototype.stop=Qt.prototype.stop,Qt.prototype.tickEvery=Qt.prototype.Ra,Qt.prototype.tickAfter=Qt.prototype.U,Qt.prototype.tickNow=Qt.prototype.qc;var Rl=null,bh=null;function Ym(){}function Qm(e,n,i,o){var h=e.variants;if((n.length||i.length)&&(h=function(_,j,F){for(var B={},H=(j=T(j)).next();!H.done;B={he:B.he},H=j.next())if(B.he=H.value,H=_.filter(function(Y){return function(te){return te.video&&te.video.codecs.startsWith(Y.he)}}(B)),H.length){_=H;break}for(B={},F=T(F),j=F.next();!j.done;B={ae:B.ae},j=F.next())if(B.ae=j.value,j=_.filter(function(Y){return function(te){return te.audio&&te.audio.codecs.startsWith(Y.ae)}}(B)),j.length){_=j;break}return _}(h,n,i)),o.length){for(n=new Ba,h=(i=T(h)).next();!h.done;h=i.next())h=h.value,n.push(String(h.video.width||0),h);var p=[];n.forEach(function(_,j){_=0;for(var F=[],B={},H=(j=T(j)).next();!H.done;B={Ic:B.Ic},H=j.next())B.Ic=H.value,(H=o.filter(function(Y){return function(te){return Y.Ic.decodingInfos[0][te]}}(B)).length)>_?(_=H,F=[B.Ic]):H==_&&F.push(B.Ic);p.push.apply(p,M(F))}),h=p}i=new Set,n=new Set;var g=T(h);for(h=g.next();!h.done;h=g.next())(h=h.value).audio&&i.add(h.audio),h.video&&n.add(h.video);i=Array.from(i).sort(function(_,j){return _.bandwidth-j.bandwidth});var b=[];for(h=new Map,g=(i=T(i)).next();!g.done;g=i.next()){var w=(g=g.value).language+(g.channelsCount||0)+(g.audioSamplingRate||0)+g.roles.join(",")+g.label+g.groupId+g.fastSwitching,k=h.get(w)||[];if(k.length){var I=k[k.length-1],x=Ji(I.codecs),C=Ji(g.codecs);x==C&&g.bandwidth>I.bandwidth&&(k.push(g),b.push(g.id))}else k.push(g),b.push(g.id);h.set(w,k)}i=Array.from(n).sort(function(_,j){return _.bandwidth&&j.bandwidth?_.bandwidth-j.bandwidth:_.width-j.width}),n=$a();var D=[];for(h=new Map,g=(i=T(i)).next();!g.done;g=i.next()){if(g=g.value,w=Math.round(g.frameRate||0)+(g.hdr||"")+g.fastSwitching,(k=h.get(w)||[]).length){if(I=k[k.length-1],!n&&(x=Ji(I.codecs))!==(C=Ji(g.codecs)))continue;(g.width>I.width||g.height>I.height||g.width==I.width&&g.height==I.height&&(x=Ji(I.codecs))==(C=Ji(g.codecs))&&g.bandwidth>I.bandwidth)&&(k.push(g),D.push(g.id))}else k.push(g),D.push(g.id);h.set(w,k)}e.variants=e.variants.filter(function(_){var j=_.audio;return _=_.video,!(j&&!b.includes(j.id)||_&&!D.includes(_.id))})}function ku(e,n,i){function o(p,g,b){return p>=g&&p<=b}var h=e.video;return!(h&&h.width&&h.height&&(!o(h.width,n.minWidth,Math.min(n.maxWidth,i.width))||!o(h.height,n.minHeight,Math.min(n.maxHeight,i.height))||!o(h.width*h.height,n.minPixels,n.maxPixels))||e&&e.video&&e.video.frameRate&&!o(e.video.frameRate,n.minFrameRate,n.maxFrameRate)||!o(e.bandwidth,n.minBandwidth,n.maxBandwidth))}function Yc(e,n,i){for(var o=!1,h=(e=T(e)).next();!h.done;h=e.next()){var p=(h=h.value).allowedByApplication;h.allowedByApplication=ku(h,n,i),p!=h.allowedByApplication&&(o=!0)}return o}function qT(e,n){return W(function(i){return i.g==1?N(i,Eh(e,n,0<n.offlineSessionIds.length),2):(function(o){o.textStreams=o.textStreams.filter(function(h){return xl(h=Er(h.mimeType,h.codecs))})}(n),N(i,function(o){var h,p,g,b,w,k,I;return W(function(x){switch(x.g){case 1:h=[],p=T(o.imageStreams),g=p.next();case 2:if(g.done){x.B(4);break}if(b=g.value,(w=b.mimeType)=="application/mp4"&&b.codecs=="mjpg"&&(w="image/jpg"),ed.has(w)){x.B(5);break}if(!(k=Sh.get(w))){ed.set(w,!1),x.B(5);break}return N(x,function(C){return new Promise(function(D){var _=new Image;_.src=C,"decode"in _?_.decode().then(function(){D(!0)}).catch(function(){D(!1)}):_.onload=_.onerror=function(){D(_.height===2)}})}(k),7);case 7:I=x.h,ed.set(w,I);case 5:ed.get(w)&&h.push(b),g=p.next(),x.B(2);break;case 4:o.imageStreams=h,re(x)}})}(n),0))})}function Eh(e,n,i){var o,h;return W(function(p){if(p.g==1)return N(p,bp(n.variants,i,!1,[]),2);o=null,e&&(h=e.g)&&(o=h.keySystem),n.variants=n.variants.filter(function(g){var b=function(k,I){var x=qc(),C=Nn("Firefox")&&Nn("Android"),D=k.video,_=D&&D.width||0,j=D&&D.height||0;if(x&&D&&(1920<_||1080<j)&&(D.codecs.includes("avc1.")||D.codecs.includes("avc3.")))return!1;if(D){if(x=Qc(D.codecs),D.codecs.includes(",")){if(x=Qc(x=vu("video",_=D.codecs.split(","))),_=xu(_=vu("audio",_),D.mimeType),!Dn(j=ma(D.mimeType,_,"audio")))return!1;x=[x,_].join()}if(!Dn(_=ma(D.mimeType,x,"video")))return!1;D.codecs=x}if(D=k.audio,C&&D&&D.encrypted&&D.codecs.toLowerCase().includes("opus"))return!1;if(D){if(C=xu(D.codecs,D.mimeType),!Dn(x=ma(D.mimeType,C,"audio")))return!1;D.codecs=C}return k.decodingInfos.some(function(F){return!(!F.supported||I&&(F=F.keySystemAccess)&&F.keySystem!=I)})}(g,o);if(!b){var w=[];g.audio&&w.push(Q0(g.audio)),g.video&&w.push(Q0(g.video))}return b}),re(p)})}function Xm(e){var n=[];for(i in e)n.push(i);n.sort();for(var i=[],o=(n=T(n)).next();!o.done;o=n.next()){var h=o.value;o=JSON.stringify(h),(h=e[h])instanceof Object?(h=Xm(h),i.push(o+":"+h)):(h=JSON.stringify(h),i.push(o+":"+h))}return"{"+i.join(",")+"}"}function Jm(e,n){var i,o,h,p,g,b,w;return W(function(k){if(k.g==1){for(i=function(I,x){if(I){var C=Km(I);return C.supported=I.supported&&x.supported,C.powerEfficient=I.powerEfficient&&x.powerEfficient,C.smooth=I.smooth&&x.smooth,x.keySystemAccess&&!C.keySystemAccess&&(C.keySystemAccess=x.keySystemAccess),C}return x},o=null,h=[],p={},g=T(n),b=g.next();!b.done;p={uc:p.uc,vc:p.vc},b=g.next())w=b.value,p.vc=Xm(w),p.uc=WT,p.uc[p.vc]?o=i(o,p.uc[p.vc]):h.push(Zm(w).then(function(I){return function(x){for(var C=null,D=(x=T(x||[])).next();!D.done;D=x.next())C=i(C,D.value);C&&(I.uc[I.vc]=C,o=i(o,C))}}(p)));return N(k,Promise.all(h),2)}o&&e.decodingInfos.push(o),re(k)})}function Zm(e){var n=[""];e.video&&(n=Ci(e.video.contentType).split(","));var i=[""];e.audio&&(i=Ci(e.audio.contentType).split(","));for(var o=[],h=(n=T(n)).next();!h.done;h=n.next()){h=h.value;for(var p={},g=T(i),b=g.next();!b.done;p={Fb:p.Fb},b=g.next())b=b.value,p.Fb=Ll(e),e.video&&(p.Fb.video.contentType=Er(Ri(p.Fb.video.contentType),h)),e.audio&&(p.Fb.audio.contentType=Er(Ri(p.Fb.audio.contentType),b)),o.push(new Promise(function(w){return function(k,I){navigator.mediaCapabilities.decodingInfo(w.Fb).then(function(x){k(x)}).catch(I)}}(p)))}return Promise.all(o).catch(function(){return JSON.stringify(e),null})}function bp(e,n,i,o){var h,p,g,b,w,k,I,x,C,D,_,j,F,B,H,Y;return W(function(te){switch(te.g){case 1:if(e.some(function(X){return X.decodingInfos.length}))return te.return();h={},p=T(o),g=p.next();case 2:if(g.done){te.B(4);break}h.ce=g.value,b=!1,w=T(e),k=w.next();case 5:if(k.done){te.B(7);break}I=k.value,x=ey(I,n,i).filter((q=h,function(X){return((X=X[0]).keySystemConfiguration&&X.keySystemConfiguration.keySystem)===q.ce})),C=T(x),D=C.next();case 8:if(D.done){te.B(10);break}return _=D.value,N(te,Jm(I,_),9);case 9:D=C.next(),te.B(8);break;case 10:I.decodingInfos.length&&(b=!0),k=w.next(),te.B(5);break;case 7:if(b)return te.return();h={ce:h.ce},g=p.next(),te.B(2);break;case 4:j=T(e),k=j.next();case 12:if(k.done){te.B(0);break}F=k.value,B=ey(F,n,i).filter(function(X){return!(X=(X=X[0]).keySystemConfiguration&&X.keySystemConfiguration.keySystem)||!o.includes(X)}),H=T(B),D=H.next();case 15:if(D.done){k=j.next(),te.B(12);break}return Y=D.value,N(te,Jm(F,Y),16);case 16:D=H.next(),te.B(15)}var q})}function ey(e,n,i){var o=e.audio,h=e.video,p=[],g=[];if(h)for(var b=T(h.fullMimeTypes),w=b.next();!w.done;w=b.next()){var k=Ci(w=w.value);if(k.includes(",")&&!o){var I=k.split(","),x=Ri(w);k=vu("video",I),x=ma(x,I=xu(I=vu("audio",I),x),"audio"),g.push({contentType:x,channels:2,bitrate:e.bandwidth||1,samplerate:1,spatialRendering:!1})}if(k=Qc(k),w={contentType:ma(Ri(w),k,"video"),width:h.width||64,height:h.height||64,bitrate:h.bandwidth||e.bandwidth||1,framerate:h.frameRate||1},h.hdr)switch(h.hdr){case"SDR":w.transferFunction="srgb";break;case"PQ":w.transferFunction="pq";break;case"HLG":w.transferFunction="hlg"}p.push(w)}if(o)for(w=(b=T(o.fullMimeTypes)).next();!w.done;w=b.next())w=ma(w=Ri(k=w.value),k=xu(Ci(k),w),"audio"),g.push({contentType:w,channels:o.channelsCount||2,bitrate:o.bandwidth||e.bandwidth||1,samplerate:o.audioSamplingRate||1,spatialRendering:o.spatialAudio});for(b=[],p.length==0&&p.push(null),g.length==0&&g.push(null),w=(p=T(p)).next();!w.done;w=p.next())for(w=w.value,x=(k=T(g)).next();!x.done;x=k.next())x=x.value,I={type:i?"file":"media-source"},w&&(I.video=w),x&&(I.audio=x),b.push(I);if(!(g=(e.video?e.video.drmInfos:[]).concat(e.audio?e.audio.drmInfos:[])).length)return[b];e=[],i=new Map;for(var C=(g=T(g)).next();!C.done;C=g.next())p=C.value,i.get(p.keySystem)||i.set(p.keySystem,[]),i.get(p.keySystem).push(p);for(g=n?"required":"optional",n=n?["persistent-license"]:["temporary"],w=(p=T(i.keys())).next();!w.done;w=p.next()){for(w=w.value,k=[],I=(x=T(b)).next();!I.done;I=x.next()){I=Object.assign({},I.value);var D=i.get(w),_={keySystem:w,initDataType:"cenc",persistentState:g,distinctiveIdentifier:"optional",sessionTypes:n};for(C=(D=T(D)).next();!C.done;C=D.next()){if((C=C.value).initData&&C.initData.length){for(var j=new Set,F=T(C.initData),B=F.next();!B.done;B=F.next())j.add(B.value.initDataType);_.initDataType=C.initData[0].initDataType}C.distinctiveIdentifierRequired&&(_.distinctiveIdentifier="required"),C.persistentStateRequired&&(_.persistentState="required"),C.sessionType&&(_.sessionTypes=[C.sessionType]),o&&(C.audioRobustness!=""?_.audio?_.audio.robustness=_.audio.robustness||C.audioRobustness:_.audio={robustness:C.audioRobustness}:_.audio||(_.audio={})),h&&(C.videoRobustness!=""?_.video?_.video.robustness=_.video.robustness||C.videoRobustness:_.video={robustness:C.videoRobustness}:_.video||(_.video={}))}I.keySystemConfiguration=_,k.push(I)}e.push(k)}return e}function xu(e,n){return e.toLowerCase()=="flac"?Au()?"fLaC":"flac":e.toLowerCase()==="opus"?Au()&&fh(n)=="mp4"?"Opus":"opus":e}function Qc(e){if(e.includes("avc1")){var n=e.split(".");if(n.length==3)return e=n.shift()+".",(e+=parseInt(n.shift(),10).toString(16))+("000"+parseInt(n.shift(),10).toString(16)).slice(-4)}else if(e=="vp9")return"vp09.00.41.08";return e}function Xc(e){var n=e.audio,i=e.video,o=n?n.mimeType:null,h=i?i.mimeType:null,p=n?n.codecs:null,g=i?i.codecs:null,b=[];g&&b.push(g),p&&b.push(p);var w=[];i&&w.push(i.mimeType),n&&w.push(n.mimeType),w=w[0]||null;var k=[];n&&k.push(n.kind),i&&k.push(i.kind),k=k[0]||null;var I=new Set;if(n)for(var x=T(n.roles),C=x.next();!C.done;C=x.next())I.add(C.value);if(i)for(C=(x=T(i.roles)).next();!C.done;C=x.next())I.add(C.value);return e={id:e.id,active:!1,type:"variant",bandwidth:e.bandwidth,language:e.language,label:null,kind:k,width:null,height:null,frameRate:null,pixelAspectRatio:null,hdr:null,videoLayout:null,mimeType:w,audioMimeType:o,videoMimeType:h,codecs:b.join(", "),audioCodec:p,videoCodec:g,primary:e.primary,roles:Array.from(I),audioRoles:null,forced:!1,videoId:null,audioId:null,channelsCount:null,audioSamplingRate:null,spatialAudio:!1,tilesLayout:null,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:null,originalImageId:null,accessibilityPurpose:null,originalLanguage:null},i&&(e.videoId=i.id,e.originalVideoId=i.originalId,e.width=i.width||null,e.height=i.height||null,e.frameRate=i.frameRate||null,e.pixelAspectRatio=i.pixelAspectRatio||null,e.videoBandwidth=i.bandwidth||null,e.hdr=i.hdr||null,e.videoLayout=i.videoLayout||null),n&&(e.audioId=n.id,e.originalAudioId=n.originalId,e.channelsCount=n.channelsCount,e.audioSamplingRate=n.audioSamplingRate,e.audioBandwidth=n.bandwidth||null,e.spatialAudio=n.spatialAudio,e.label=n.label,e.audioRoles=n.roles,e.accessibilityPurpose=n.accessibilityPurpose,e.originalLanguage=n.originalLanguage),e}function Ep(e){return{id:e.id,active:!1,type:en,bandwidth:0,language:e.language,label:e.label,kind:e.kind||null,width:null,height:null,frameRate:null,pixelAspectRatio:null,hdr:null,videoLayout:null,mimeType:e.mimeType,audioMimeType:null,videoMimeType:null,codecs:e.codecs||null,audioCodec:null,videoCodec:null,primary:e.primary,roles:e.roles,audioRoles:null,forced:e.forced,videoId:null,audioId:null,channelsCount:null,audioSamplingRate:null,spatialAudio:!1,tilesLayout:null,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:e.originalId,originalImageId:null,accessibilityPurpose:e.accessibilityPurpose,originalLanguage:e.originalLanguage}}function ty(e){var n=e.width||null,i=e.height||null,o=null;e.segmentIndex&&(o=e.segmentIndex.get(0));var h=e.tilesLayout;return o&&(h=o.tilesLayout||h),h&&n!=null&&(n/=Number(h.split("x")[0])),h&&i!=null&&(i/=Number(h.split("x")[1])),{id:e.id,active:!1,type:"image",bandwidth:e.bandwidth||0,language:"",label:null,kind:null,width:n,height:i,frameRate:null,pixelAspectRatio:null,hdr:null,videoLayout:null,mimeType:e.mimeType,audioMimeType:null,videoMimeType:null,codecs:e.codecs||null,audioCodec:null,videoCodec:null,primary:!1,roles:[],audioRoles:null,forced:!1,videoId:null,audioId:null,channelsCount:null,audioSamplingRate:null,spatialAudio:!1,tilesLayout:h||null,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:null,originalImageId:e.originalId,accessibilityPurpose:null,originalLanguage:null}}function ny(e){return e.Nt||(e.Nt=Zc++),e.Nt}function es(e){var n=ry(e);return n.active=e.mode!="disabled",n.type="text",n.originalTextId=e.id,e.kind=="captions"&&(n.mimeType="unknown"),e.kind=="subtitles"&&(n.mimeType="text/vtt"),e.kind&&(n.roles=[e.kind]),e.kind=="forced"&&(n.forced=!0),n}function Iu(e){var n=ry(e);return n.active=e.enabled,n.type="variant",n.originalAudioId=e.id,e.kind=="main"&&(n.primary=!0),e.kind&&(n.roles=[e.kind],n.audioRoles=[e.kind],n.label=e.label),n}function ry(e){var n=e.language;return{id:ny(e),active:!1,type:"",bandwidth:0,language:dn(n||"und"),label:e.label,kind:e.kind,width:null,height:null,frameRate:null,pixelAspectRatio:null,hdr:null,videoLayout:null,mimeType:null,audioMimeType:null,videoMimeType:null,codecs:null,audioCodec:null,videoCodec:null,primary:!1,roles:[],forced:!1,audioRoles:null,videoId:null,audioId:null,channelsCount:null,audioSamplingRate:null,spatialAudio:!1,tilesLayout:null,audioBandwidth:null,videoBandwidth:null,originalVideoId:null,originalAudioId:null,originalTextId:null,originalImageId:null,accessibilityPurpose:null,originalLanguage:n}}function Th(e){return e.allowedByApplication&&e.allowedByKeySystem&&e.disabledUntilTime==0}function Tp(e){return e.filter(function(n){return Th(n)})}function Jc(e,n,i,o){var h=e,p=e.filter(function(w){return w.primary});p.length&&(h=p);var g=h.length?h[0].language:"";if(h=h.filter(function(w){return w.language==g}),n){var b=mp(dn(n),e.map(function(w){return w.language}));b&&(h=e.filter(function(w){return dn(w.language)==b}))}if(h=h.filter(function(w){return w.forced==o}),i){if((e=Sp(h,i)).length)return e}else if(e=h.filter(function(w){return w.roles.length==0}),e.length)return e;return e=h.map(function(w){return w.roles}).reduce(Gm,[]),e.length?Sp(h,e[0]):h}function Sp(e,n){return e.filter(function(i){return i.roles.includes(n)})}function Q0(e){return e.type=="audio"?"type=audio codecs="+e.codecs+" bandwidth="+e.bandwidth+" channelsCount="+e.channelsCount+" audioSamplingRate="+e.audioSamplingRate:e.type=="video"?"type=video codecs="+e.codecs+" bandwidth="+e.bandwidth+" frameRate="+e.frameRate+" width="+e.width+" height="+e.height:"unexpected stream type"}We("shaka.util.StreamUtils",Ym),Ym.meetsRestrictions=ku;var WT={},Zc=0,ed=new Map().set("image/svg+xml",!0).set("image/png",!0).set("image/jpeg",!0).set("image/jpg",!0),Sh=new Map().set("image/webp","data:image/webp;base64,UklGRjoAAABXRUJQVlA4IC4AAACyAgCdASoCAAIALmk0mk0iIiIiIgBoSygABc6WWgAA/veff/0PP8bA//LwYAAA").set("image/avif","data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=");function qn(){var e=this;this.s=null,this.o=!1,this.i=new Un,this.F=new mn,navigator.connection&&navigator.connection.addEventListener&&this.F.D(navigator.connection,"change",function(){if(e.o&&e.g.useNetworkInformation){e.i=new Un,e.g&&e.i.configure(e.g.advanced);var n=e.chooseVariant();n&&navigator.onLine&&e.s(n,e.g.clearBufferSwitch,e.g.safeMarginSwitch)}}),this.m=[],this.A=1,this.G=!1,this.h=this.l=this.g=this.u=null,this.C=new Qt(function(){if(e.g.restrictToElementSize){var n=e.chooseVariant();n&&e.s(n,e.g.clearBufferSwitch,e.g.safeMarginSwitch)}}),this.j=null}function iy(e){if(e.G){if(Date.now()-e.u<1e3*e.g.switchInterval)return}else{var n=e.i;if(!(n.g>=n.i))return;e.G=!0}n=e.chooseVariant(),e.getBandwidthEstimate(),n&&e.s(n,e.g.clearBufferSwitch,e.g.safeMarginSwitch)}function Io(e,n,i,o,h){if(e.j){var p=e.j.Rf();p&&(i=i.filter(function(g){return!g.bandwidth||!p||g.bandwidth<=p}))}return n&&(i=i.filter(function(g){return ku(g,n,{width:h,height:o})})),i.sort(function(g,b){return g.bandwidth-b.bandwidth})}(c=qn.prototype).stop=function(){this.s=null,this.o=!1,this.m=[],this.A=1,this.l=this.u=null,this.h&&(this.h.disconnect(),this.h=null),this.C.stop(),this.j=null},c.release=function(){this.F.release(),this.C=null},c.init=function(e){this.s=e},c.chooseVariant=function(e){e=e!==void 0&&e;var n=1/0,i=1/0;if(this.g.restrictToScreenSize&&(i=this.g.ignoreDevicePixelRatio?1:s.devicePixelRatio,n=s.screen.height*i,i*=s.screen.width),this.h&&this.g.restrictToElementSize){var o=this.g.ignoreDevicePixelRatio?1:s.devicePixelRatio;n=Math.min(n,this.l.clientHeight*o),i=Math.min(i,this.l.clientWidth*o)}var h=this.m.filter(function(k){return!(k.audio&&k.audio.fastSwitching||k.video&&k.video.fastSwitching)});if(h.length||(h=this.m),o=h,e&&h.length!=this.m.length&&(o=this.m.filter(function(k){return!!(k.audio&&k.audio.fastSwitching||k.video&&k.video.fastSwitching)})),e=Io(this,this.g.restrictions,o,1/0,1/0),n!=1/0||i!=1/0){for(e=function(k){for(var I=[],x=(k=T(k)).next();!x.done;x=k.next())(x=x.value.video)&&x.height&&x.width&&I.push({height:x.height,width:x.width});return I.sort(function(C,D){return C.width-D.width})}(e),h=(e=T(e)).next();!h.done;h=e.next())if((h=h.value).height>=n&&h.width>=i){n=h.height,i=h.width;break}e=Io(this,this.g.restrictions,o,n,i)}for(n=this.getBandwidthEstimate(),o.length&&!e.length&&(e=[(e=Io(this,null,o,1/0,1/0))[0]]),i=e[0]||null,o=0;o<e.length;o++){h=e[o];for(var p=isNaN(this.A)?1:Math.abs(this.A),g=p*h.bandwidth/this.g.bandwidthDowngradeTarget,b={bandwidth:1/0},w=o+1;w<e.length;w++)if(h.bandwidth!=e[w].bandwidth){b=e[w];break}p=p*b.bandwidth/this.g.bandwidthUpgradeTarget,n>=g&&n<=p&&i.bandwidth!=h.bandwidth&&(i=h)}return this.u=Date.now(),i},c.enable=function(){this.o=!0},c.disable=function(){this.o=!1},c.segmentDownloaded=function(e,n,i){this.i.sample(e,n),i&&this.u!=null&&this.o&&iy(this)},c.trySuggestStreams=function(){this.u!=null&&this.o&&iy(this)},c.getBandwidthEstimate=function(){var e=this.g.defaultBandwidthEstimate;return navigator.connection&&navigator.connection.downlink&&this.g.useNetworkInformation&&(e=1e6*navigator.connection.downlink),e=this.i.getBandwidthEstimate(e),this.j?this.j.getBandwidthEstimate(e):e},c.setVariants=function(e){this.m=e},c.playbackRateChanged=function(e){this.A=e},c.setMediaElement=function(e){var n=this;this.l=e,this.h&&(this.h.disconnect(),this.h=null),this.l&&"ResizeObserver"in s&&(this.h=new ResizeObserver(function(){n.C.U(td)}),this.h.observe(this.l))},c.setCmsdManager=function(e){this.j=e},c.configure=function(e){this.g=e,this.i&&this.g&&this.i.configure(this.g.advanced)},We("shaka.abr.SimpleAbrManager",qn),qn.prototype.configure=qn.prototype.configure,qn.prototype.setCmsdManager=qn.prototype.setCmsdManager,qn.prototype.setMediaElement=qn.prototype.setMediaElement,qn.prototype.playbackRateChanged=qn.prototype.playbackRateChanged,qn.prototype.setVariants=qn.prototype.setVariants,qn.prototype.getBandwidthEstimate=qn.prototype.getBandwidthEstimate,qn.prototype.trySuggestStreams=qn.prototype.trySuggestStreams,qn.prototype.segmentDownloaded=qn.prototype.segmentDownloaded,qn.prototype.disable=qn.prototype.disable,qn.prototype.enable=qn.prototype.enable,qn.prototype.chooseVariant=qn.prototype.chooseVariant,qn.prototype.init=qn.prototype.init,qn.prototype.release=qn.prototype.release,qn.prototype.stop=qn.prototype.stop;var td=1;function wh(e,n){this.g=e,this.h=n}function Ss(e,n){var i=new wh(5,0),o=sy,h=o.g,p=i.h-h.h;(0<(i.g-h.g||p)?o.i:o.h)(o.g,i,e,n)}function Lu(e,n,i,o){Rt([i,"has been deprecated and will be removed in",n,". We are currently at version",e,". Additional information:",o].join(" "))}function X0(e,n,i,o){Kn([i,"has been deprecated and has been removed in",n,". We are now at version",e,". Additional information:",o].join(" "))}wh.prototype.toString=function(){return"v"+this.g+"."+this.h};var sy=null;function Ah(e,n,i,o){for(i=i===void 0||i,o=o!==void 0&&o,this.h=e,this.g=new Set([e]),n=(e=T(n=n||[])).next();!n.done;n=e.next())this.add(n.value,i,o)}function J0(e,n,i,o){var h;if(!(h=!!e.audio!=!!n.audio||!!e.video!=!!n.video||e.language!=n.language)&&(h=e.audio&&n.audio)){h=e.audio;var p=n.audio;h=!!((!h.channelsCount||!p.channelsCount||2<h.channelsCount||2<p.channelsCount)&&h.channelsCount!=p.channelsCount||i&&!Z0(h,p)||!e1(h.roles,p.roles)||o&&h.groupId!==p.groupId)}return!(o=h)&&(o=e.video&&n.video)&&(e=e.video,n=n.video,o=!((!i||Z0(e,n))&&e1(e.roles,n.roles))),!o}function Z0(e,n){if(e.mimeType!=n.mimeType||(e=e.codecs.split(",").map(function(o){return Hs(o)}),n=n.codecs.split(",").map(function(o){return Hs(o)}),e.length!=n.length))return!1;e.sort(),n.sort();for(var i=0;i<e.length;i++)if(e[i]!=n[i])return!1;return!0}function e1(e,n){if(e=new Set(e),n=new Set(n),e.delete("main"),n.delete("main"),e.size!=n.size)return!1;for(var i=(e=T(e)).next();!i.done;i=e.next())if(!n.has(i.value))return!1;return!0}function ay(e,n,i){n=n===void 0?"reload":n,i=i!==void 0&&i,this.i=e,this.h=n,this.g=i,this.j=new Ru(e.language,"",e.audio&&e.audio.channelsCount?e.audio.channelsCount:0,"",!1,"","","",n,i)}function Ru(e,n,i,o,h,p,g,b,w,k){this.s=e,this.u=n,this.h=i,this.i=o,this.A=h,this.l=p,this.g=g===void 0?"":g,this.j=b===void 0?"":b,this.m=w===void 0?"reload":w,this.o=k!==void 0&&k}function t1(){this.g=Lo,this.h=new Map().set(Lo,2).set(yi,1)}function Vs(e,n,i){e.h.set(Lo,i).set(yi,n)}We("shaka.config.AutoShowText",{NEVER:0,ALWAYS:1,IF_PREFERRED_TEXT_LANGUAGE:2,IF_SUBTITLES_MAY_BE_NEEDED:3}),We("shaka.config.CodecSwitchingStrategy",{Ii:"reload",zg:"smooth"}),Ah.prototype.add=function(e,n,i){return!!J0(this.h,e,n===void 0||n,i!==void 0&&i)&&(this.g.add(e),!0)},Ah.prototype.values=function(){return this.g.values()},ay.prototype.create=function(e){var n=this,i=this.h=="smooth"&&$a(),o=e.filter(function(h){return J0(n.i,h,!i,n.g)});return o.length?new Ah(o[0],o,!i,this.g):this.j.create(e)},Ru.prototype.create=function(e){var n=[];n=function(o,h){var p=mp(h=dn(h),o.map(function(g){return gh(g)}));return p?o.filter(function(g){return p==gh(g)}):[]}(e,this.s);var i=e.filter(function(o){return o.primary});return e=function(o,h){return o.filter(function(p){return!!p.audio&&(h?p.audio.roles.includes(h):p.audio.roles.length==0)})}(n=n.length?n:i.length?i:e,this.u),e.length&&(n=e),this.l&&(e=function(o,h){return o.filter(function(p){return!p.video||!p.video.videoLayout||p.video.videoLayout==h})}(n,this.l),e.length&&(n=e)),this.i&&(e=function(o,h){return h=="AUTO"&&(h=s.matchMedia("(color-gamut: p3)").matches?"PQ":"SDR"),o.filter(function(p){return!p.video||!p.video.hdr||p.video.hdr==h})}(n,this.i),e.length&&(n=e)),this.h&&(e=function(o,h){return o.filter(function(p){return!p.audio||!p.audio.channelsCount||p.audio.channelsCount==h})}(n,this.h),e.length&&(n=e)),this.g&&(e=function(o,h){return o.filter(function(p){return!(!p.audio||!p.audio.label)&&p.audio.label.toLowerCase()==h.toLowerCase()})}(n,this.g),e.length&&(n=e)),this.j&&(e=function(o,h){return o.filter(function(p){return!(!p.video||!p.video.label)&&p.video.label.toLowerCase()==h.toLowerCase()})}(n,this.j),e.length&&(n=e)),e=function(o,h){return o.filter(function(p){return!p.audio||p.audio.spatialAudio==h})}(n,this.A),e.length&&(n=e),new Ah(n[0],n,!(this.m=="smooth"&&$a()),this.o)};var yi=0,Lo=1;function wp(e,n){var i={maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:3e4,stallTimeout:5e3,connectionTimeout:1e4};this.l=e.maxAttempts==null?i.maxAttempts:e.maxAttempts,this.j=e.baseDelay==null?i.baseDelay:e.baseDelay,this.o=e.fuzzFactor==null?i.fuzzFactor:e.fuzzFactor,this.m=e.backoffFactor==null?i.backoffFactor:e.backoffFactor,this.g=0,this.h=this.j,(this.i=n!==void 0&&n)&&(this.g=1)}function kh(e){var n,i;return W(function(o){if(o.g==1){if(e.g>=e.l){if(!e.i)throw new fe(2,7,1010);e.g=1,e.h=e.j}return n=e.g,e.g++,n==0?o.return():(i=e.h*(1+(2*Math.random()-1)*e.o),N(o,new Promise(function(h){new Qt(h).U(i/1e3)}),2))}e.h*=e.m,re(o)})}function Pn(){var e,n,i=new Promise(function(o,h){e=o,n=h});return i.resolve=e,i.reject=n,i}function or(e,n){this.promise=e,this.i=n,this.g=!1}function ts(e){return new or(Promise.reject(e),function(){return Promise.resolve()})}function Ap(){var e=Promise.reject(new fe(2,7,7001));return e.catch(function(){}),new or(e,function(){return Promise.resolve()})}function Ro(e){return new or(Promise.resolve(e),function(){return Promise.resolve()})}function Cu(e){return new or(e,function(){return e.catch(function(){})})}function oy(e){return new or(Promise.all(e.map(function(n){return n.promise})),function(){return Promise.all(e.map(function(n){return n.abort()}))})}function dt(e,n){if(n)if(n instanceof Map)for(var i=T(n.keys()),o=i.next();!o.done;o=i.next())o=o.value,Object.defineProperty(this,o,{value:n.get(o),writable:!0,enumerable:!0});else for(i in n)Object.defineProperty(this,i,{value:n[i],writable:!0,enumerable:!0});this.defaultPrevented=this.cancelable=this.bubbles=!1,this.timeStamp=s.performance&&s.performance.now?s.performance.now():Date.now(),this.type=e,this.isTrusted=!1,this.target=this.currentTarget=null,this.g=!1}function Du(e){var n,i=new dt(e.type);for(n in e)Object.defineProperty(i,n,{value:e[n],writable:!0,enumerable:!0});return i}Pn.prototype.resolve=function(){},Pn.prototype.reject=function(){},or.prototype.abort=function(){return this.g=!0,this.i()},or.prototype.finally=function(e){return this.promise.then(function(){return e(!0)},function(){return e(!1)}),this},or.prototype.na=function(e,n){function i(b){return function(w){if(h.g&&b)p.reject(g);else{var k=b?e:n;k?o=function(I,x,C){try{var D=I(x);return D&&D.promise&&D.abort?(C.resolve(D.promise),function(){return D.abort()}):(C.resolve(D),function(){return Promise.resolve(D).then(function(){},function(){})})}catch(_){return C.reject(_),function(){return Promise.resolve()}}}(k,w,p):(b?p.resolve:p.reject)(w)}}}function o(){return p.reject(g),h.abort()}var h=this,p=new Pn,g=new fe(2,7,7001);return this.promise.then(i(!0),i(!1)),new or(p,function(){return o()})},We("shaka.util.AbortableOperation",or),or.prototype.chain=or.prototype.na,or.prototype.finally=or.prototype.finally,or.all=oy,or.prototype.abort=or.prototype.abort,or.notAbortable=Cu,or.completed=Ro,or.aborted=Ap,or.failed=ts,dt.prototype.preventDefault=function(){this.cancelable&&(this.defaultPrevented=!0)},dt.prototype.stopImmediatePropagation=function(){this.g=!0},dt.prototype.stopPropagation=function(){},We("shaka.util.FakeEvent",dt);var Co={ii:"abrstatuschanged",ji:"adaptation",ki:"buffering",li:"complete",mi:"downloadfailed",ni:"downloadheadersreceived",oi:"drmsessionupdate",ri:"emsg",Hi:"prft",Error:"error",si:"expirationupdated",ti:"firstquartile",ui:"gapjumped",xi:"keystatuschanged",zi:"loaded",Ai:"loading",Ci:"manifestparsed",Di:"manifestupdated",Ei:"mediaqualitychanged",Metadata:"metadata",Fi:"midpoint",Gi:"onstatechange",Ji:"ratechange",Ki:"segmentappended",Li:"sessiondata",Mi:"stalldetected",Ni:"started",Oi:"statechanged",Pi:"streaming",Qi:"textchanged",Ri:"texttrackvisibility",Si:"thirdquartile",Ti:"timelineregionadded",Ui:"timelineregionenter",Vi:"timelineregionexit",Wi:"trackschanged",Yi:"unloading",$i:"variantchanged"};function hn(){this.ha=new Ba,this.Gd=this}function Do(){this.g=[]}function ai(e,n){e.g.push(n.finally(function(){Qi(e.g,n)}))}function ln(e,n,i,o,h){hn.call(this),this.i=!1,this.m=new Do,this.g=new Set,this.h=new Set,this.l=e||null,this.j=n||null,this.s=i||null,this.u=o||null,this.A=h||null,this.o=!1}function Ui(e,n,i,o){i=i||Di;var h=Vr[e];(!h||i>=h.priority)&&(Vr[e]={priority:i,Wd:n,Jh:o!==void 0&&o})}function lr(e,n,i){return{uris:e,method:"GET",body:null,headers:{},allowCrossSiteCredentials:!1,retryParameters:n,licenseRequestType:null,sessionId:null,drmInfo:null,initData:null,initDataType:null,streamDataCallback:i===void 0?null:i}}function Ka(e,n,i,o,h,p,g,b){e.o&&(i.uris[p]=i.uris[p].replace("http://","https://")),0<p&&e.A&&e.A(n,o,i.uris[p],i.uris[p-1]);var w=new mr(i.uris[p]),k=w.ab,I=!1;k||(gu(w,k=(k=location.protocol).slice(0,-1)),i.uris[p]=w.toString()),k=k.toLowerCase();var x=(k=Vr[k])?k.Wd:null;if(!x)return ts(new fe(2,1,1e3,w));var C,D=k.Jh,_=null,j=null,F=!1,B=!1;return Cu(kh(h)).na(function(){if(e.i)return Ap();C=Date.now();var H=x(i.uris[p],i,n,function(q,X,he){_&&_.stop(),j&&j.U(te/1e3),e.l&&n==Ks&&(e.l(q,X,Cl(o)),I=!0,b.g=he)},function(q){e.j&&e.j(q,i,n),B=!0});if(!D)return H;var Y=i.retryParameters.connectionTimeout;Y&&(_=new Qt(function(){F=!0,H.abort()})).U(Y/1e3);var te=i.retryParameters.stallTimeout;return te&&(j=new Qt(function(){F=!0,H.abort()})),H}).na(function(H){_&&_.stop(),j&&j.stop(),H.timeMs==null&&(H.timeMs=Date.now()-C);var Y={response:H,rh:I};return!B&&e.j&&e.j(H.headers,i,n),Y},function(H){if(_&&_.stop(),j&&j.stop(),e.s){var Y=null,te=0;H instanceof fe&&(Y=H,H.code==1001&&(te=H.data[1])),e.s(i,Y,te,F)}if(e.i)return Ap();if(F&&(H=new fe(1,1,1003,i.uris[p],n)),H instanceof fe){if(H.code==7001)throw H;if(H.code==1010)throw g;if(H.severity==1)return Y=new dt("retry",Y=new Map().set("error",H)),e.dispatchEvent(Y),p=(p+1)%i.uris.length,Ka(e,n,i,o,h,p,H,b)}throw H})}function Cl(e){if(e){var n=e.segment;if(e=e.stream,n&&e&&e.fastSwitching&&n.$c)return!1}return!0}function ly(){this.g=0}function nd(e,n,i){or.call(this,e,n),this.h=i}hn.prototype.addEventListener=function(e,n){this.ha&&this.ha.push(e,n)},hn.prototype.removeEventListener=function(e,n){this.ha&&this.ha.remove(e,n)},hn.prototype.dispatchEvent=function(e){if(!this.ha)return!0;var n=this.ha.get(e.type)||[],i=this.ha.get("All");for(i&&(n=n.concat(i)),i=(n=T(n)).next();!i.done;i=n.next()){i=i.value,e.target=this.Gd,e.currentTarget=this.Gd;try{i.handleEvent?i.handleEvent(e):i.call(this,e)}catch{}if(e.g)break}return e.defaultPrevented},hn.prototype.release=function(){this.ha=null},Do.prototype.destroy=function(){for(var e=[],n=T(this.g),i=n.next();!i.done;i=n.next())(i=i.value).promise.catch(function(){}),e.push(i.abort());return this.g=[],Promise.all(e)},Z(ln,hn),(c=ln.prototype).pf=function(e){this.o=e},c.Kh=function(e){this.g.add(e)},c.ci=function(e){this.g.delete(e)},c.Ig=function(){this.g.clear()},c.Lh=function(e){this.h.add(e)},c.di=function(e){this.h.delete(e)},c.Jg=function(){this.h.clear()},c.destroy=function(){return this.i=!0,this.g.clear(),this.h.clear(),hn.prototype.release.call(this),this.m.destroy()},c.request=function(e,n,i){var o=this,h=new ly;if(this.i){var p=Promise.reject(new fe(2,7,7001));return p.catch(function(){}),new nd(p,function(){return Promise.resolve()},h)}n.method=n.method||"GET",n.headers=n.headers||{},n.retryParameters=n.retryParameters?Ll(n.retryParameters):{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:3e4,stallTimeout:5e3,connectionTimeout:1e4},n.uris=Ll(n.uris),p=function(C,D,_,j){function F(Y){B=B.na(function(){return _.body&&(_.body=bs(_.body)),Y(D,_,j)})}var B=Ro(void 0);C.u&&F(C.u);for(var H=(C=T(C.g)).next();!H.done;H=C.next())F(H.value);return B.na(void 0,function(Y){throw Y instanceof fe&&Y.code==7001?Y:new fe(2,1,1006,Y)})}(this,e,n,i);var g=p.na(function(){return Ka(o,e,n,i,new wp(n.retryParameters,!1),0,null,h)}),b=g.na(function(C){return function(D,_,j,F){for(var B=Ro(void 0),H={},Y=(D=T(D.h)).next();!Y.done;H={ee:H.ee},Y=D.next())H.ee=Y.value,B=B.na(function(te){return function(){var q=j.response;return q.data&&(q.data=bs(q.data)),te.ee(_,q,F)}}(H));return B.na(function(){return j},function(te){var q=2;if(te instanceof fe){if(te.code==7001)throw te;q=te.severity}throw new fe(q,1,1007,te)})}(o,e,C,i)}),w=Date.now(),k=0;p.promise.then(function(){k=Date.now()-w},function(){});var I=0;g.promise.then(function(){I=Date.now()},function(){});var x=b.na(function(C){var D=Date.now()-I,_=C.response;return _.timeMs+=k,_.timeMs+=D,C.rh||!o.l||_.fromCache||n.method=="HEAD"||e!=Ks||o.l(_.timeMs,_.data.byteLength,Cl(i)),_},function(C){throw C&&(C.severity=2),C});return p=new nd(x.promise,function(){return x.abort()},h),ai(this.m,p),p},We("shaka.net.NetworkingEngine",ln),ln.prototype.request=ln.prototype.request,ln.prototype.destroy=ln.prototype.destroy,ln.makeRequest=lr,ln.defaultRetryParameters=function(){return{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:3e4,stallTimeout:5e3,connectionTimeout:1e4}},ln.prototype.clearAllResponseFilters=ln.prototype.Jg,ln.prototype.unregisterResponseFilter=ln.prototype.di,ln.prototype.registerResponseFilter=ln.prototype.Lh,ln.prototype.clearAllRequestFilters=ln.prototype.Ig,ln.prototype.unregisterRequestFilter=ln.prototype.ci,ln.prototype.registerRequestFilter=ln.prototype.Kh,ln.unregisterScheme=function(e){delete Vr[e]},ln.registerScheme=Ui,ln.prototype.setForceHTTPS=ln.prototype.pf,ln.NumBytesRemainingClass=ly,Z(nd,or),ln.PendingRequest=nd;var Ks=1;ln.RequestType={MANIFEST:0,SEGMENT:Ks,LICENSE:2,APP:3,TIMING:4,SERVER_CERTIFICATE:5,KEY:6,ADS:7,CONTENT_STEERING:8},ln.AdvancedRequestType={INIT_SEGMENT:0,MEDIA_SEGMENT:1,MEDIA_PLAYLIST:2,MASTER_PLAYLIST:3,MPD:4,MSS:5};var Di=3;ln.PluginPriority={FALLBACK:1,PREFERRED:2,APPLICATION:Di};var Vr={};function Ln(e){this.g=!1,this.h=new Pn,this.i=e}function rn(e,n){if(e.g)throw n instanceof fe&&n.code==7003?n:new fe(2,7,7003,n)}function zs(e,n){for(var i=[],o=(e=T(e)).next();!o.done;o=e.next())i.push(n(o.value));return i}function Dl(e){this.h=e,this.g=void 0}function va(e){for(var n=new Map,i=T(Object.keys(e)),o=i.next();!o.done;o=i.next())o=o.value,n.set(o,e[o]);return n}function kp(e){var n={};return e.forEach(function(i,o){n[o]=i}),n}function Pl(){}function Wn(e){if(!e)return"";if((e=Nt(e))[0]==239&&e[1]==187&&e[2]==191&&(e=e.subarray(3)),s.TextDecoder&&!wu())return(e=new TextDecoder().decode(e)).includes("�")&&Kn('Decoded string contains an "unknown character" codepoint.  That probably means the UTF8 encoding was incorrect!'),e;for(var n="",i=0;i<e.length;++i){var o=65533;if(128&e[i]?e.length>=i+2&&(224&e[i])==192&&(192&e[i+1])==128?(o=(31&e[i])<<6|63&e[i+1],i+=1):e.length>=i+3&&(240&e[i])==224&&(192&e[i+1])==128&&(192&e[i+2])==128?(o=(15&e[i])<<12|(63&e[i+1])<<6|63&e[i+2],i+=2):e.length>=i+4&&(241&e[i])==240&&(192&e[i+1])==128&&(192&e[i+2])==128&&(192&e[i+3])==128&&(o=(7&e[i])<<18|(63&e[i+1])<<12|(63&e[i+2])<<6|63&e[i+3],i+=3):o=e[i],65535>=o)n+=String.fromCharCode(o);else{var h=1023&(o-=65536);n+=String.fromCharCode(55296+(o>>10)),n+=String.fromCharCode(56320+h)}}return n}function ws(e,n,i){if(!e)return"";if(!i&&e.byteLength%2!=0)throw new fe(2,2,2004);i=Math.floor(e.byteLength/2);var o=new Uint16Array(i);e=Nr(e);for(var h=0;h<i;h++)o[h]=e.getUint16(2*h,n);return xh(o)}function qs(e){function n(o){return i.byteLength<=o||32<=i[o]&&126>=i[o]}if(!e)return"";var i=Nt(e);if(i[0]==239&&i[1]==187&&i[2]==191)return Wn(i);if(i[0]==254&&i[1]==255)return ws(i.subarray(2),!1);if(i[0]==255&&i[1]==254)return ws(i.subarray(2),!0);if(i[0]==0&&i[2]==0)return ws(e,!1);if(i[1]==0&&i[3]==0)return ws(e,!0);if(n(0)&&n(1)&&n(2)&&n(3))return Wn(e);throw new fe(2,2,2003)}function As(e){if(s.TextEncoder&&!wu()){var n=new TextEncoder;return bs(n.encode(e))}e=encodeURIComponent(e),e=unescape(e),n=new Uint8Array(e.length);for(var i=0;i<e.length;i++)n[i]=e[i].charCodeAt(0);return bs(n)}function xp(e,n){for(var i=new ArrayBuffer(2*e.length),o=new DataView(i),h=0;h<e.length;++h)o.setUint16(2*h,e.charCodeAt(h),n);return i}function xh(e){return uy.value()(e)}Ln.prototype.destroy=function(){var e=this;return this.g?this.h:(this.g=!0,this.i().then(function(){e.h.resolve()},function(){e.h.resolve()}))},Dl.prototype.value=function(){return this.g==null&&(this.g=this.h()),this.g},We("shaka.util.StringUtils",Pl),Pl.resetFromCharCode=function(){uy.g=void 0},Pl.toUTF16=xp,Pl.toUTF8=As,Pl.fromBytesAutoDetect=qs,Pl.fromUTF16=ws,Pl.fromUTF8=Wn;var uy=new Dl(function(){function e(i){try{var o=new Uint8Array(i);return 0<String.fromCharCode.apply(null,o).length}catch{return!1}}for(var n={vb:65536};0<n.vb;(n={vb:n.vb}).vb/=2)if(e(n.vb))return function(i){return function(o){for(var h="",p=0;p<o.length;p+=i.vb)h+=String.fromCharCode.apply(null,o.subarray(p,p+i.vb));return h}}(n);return null});function xn(e,n){this.h=Nr(e),this.i=n==rd,this.g=0}function za(){return new fe(2,3,3e3)}(c=xn.prototype).ea=function(){return this.g<this.h.byteLength},c.oa=function(){return this.g},c.getLength=function(){return this.h.byteLength},c.fa=function(){try{var e=this.h.getUint8(this.g);return this.g+=1,e}catch{throw za()}},c.wa=function(){try{var e=this.h.getUint16(this.g,this.i);return this.g+=2,e}catch{throw za()}},c.M=function(){try{var e=this.h.getUint32(this.g,this.i);return this.g+=4,e}catch{throw za()}},c.fg=function(){try{var e=this.h.getInt32(this.g,this.i);return this.g+=4,e}catch{throw za()}},c.oc=function(){try{if(this.i)var e=this.h.getUint32(this.g,!0),n=this.h.getUint32(this.g+4,!0);else n=this.h.getUint32(this.g,!1),e=this.h.getUint32(this.g+4,!1)}catch{throw za()}if(2097151<n)throw new fe(2,3,3001);return this.g+=8,n*Math.pow(2,32)+e},c.rb=function(e){if(this.g+e>this.h.byteLength)throw za();var n=Nt(this.h,this.g,e);return this.g+=e,n},c.skip=function(e){if(this.g+e>this.h.byteLength)throw za();this.g+=e},c.Sh=function(e){if(this.g<e)throw za();this.g-=e},c.seek=function(e){if(0>e||e>this.h.byteLength)throw za();this.g=e},c.bd=function(){for(var e=this.g;this.ea()&&this.h.getUint8(this.g)!=0;)this.g+=1;return e=Nt(this.h,e,this.g-e),this.g+=1,Wn(e)},We("shaka.util.DataViewReader",xn),xn.prototype.readTerminatedString=xn.prototype.bd,xn.prototype.seek=xn.prototype.seek,xn.prototype.rewind=xn.prototype.Sh,xn.prototype.skip=xn.prototype.skip,xn.prototype.readBytes=xn.prototype.rb,xn.prototype.readUint64=xn.prototype.oc,xn.prototype.readInt32=xn.prototype.fg,xn.prototype.readUint32=xn.prototype.M,xn.prototype.readUint16=xn.prototype.wa,xn.prototype.readUint8=xn.prototype.fa,xn.prototype.getLength=xn.prototype.getLength,xn.prototype.getPosition=xn.prototype.oa,xn.prototype.hasMoreData=xn.prototype.ea;var rd=1;function _n(){this.i=[],this.h=[],this.g=!1}function cn(e){for(var n=Ws(e);e.reader.ea()&&!e.parser.g;)e.parser.mc(e.start+n,e.reader,e.partialOkay)}function qa(e){for(var n=Ws(e),i=e.reader.M(),o=0;o<i&&(e.parser.mc(e.start+n,e.reader,e.partialOkay),!e.parser.g);o++);}function id(e){var n=Ws(e);for(e.reader.skip(78);e.reader.ea()&&!e.parser.g;)e.parser.mc(e.start+n,e.reader,e.partialOkay)}function sd(e){var n=Ws(e);e.reader.skip(8);var i=e.reader.wa();for(e.reader.skip(6),i==2?e.reader.skip(48):e.reader.skip(12),i==1&&e.reader.skip(16);e.reader.ea()&&!e.parser.g;)e.parser.mc(e.start+n,e.reader,e.partialOkay)}function Po(e){return function(n){e(n.reader.rb(n.reader.getLength()-n.reader.oa()))}}function cy(e){for(var n=0,i=(e=T(e)).next();!i.done;i=e.next())n=n<<8|i.value.charCodeAt(0);return n}function Ih(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)}function Ws(e){return 8+(e.has64BitSize?8:0)+(e.flags!=null?4:0)}xn.Endianness={BIG_ENDIAN:0,LITTLE_ENDIAN:rd},(c=_n.prototype).box=function(e,n){return e=cy(e),this.i[e]=n1,this.h[e]=n,this},c.O=function(e,n){return e=cy(e),this.i[e]=Pu,this.h[e]=n,this},c.stop=function(){this.g=!0},c.parse=function(e,n,i){for(e=new xn(e,0),this.g=!1;e.ea()&&!this.g;)this.mc(0,e,n,i)},c.mc=function(e,n,i,o){var h=n.oa();if(o&&h+8>n.getLength())this.g=!0;else{var p=n.M(),g=n.M(),b=Ih(g),w=!1;switch(p){case 0:p=n.getLength()-h;break;case 1:if(o&&n.oa()+8>n.getLength())return void(this.g=!0);p=n.oc(),w=!0}var k=this.h[g];if(k){var I=null,x=null;if(this.i[g]==Pu){if(o&&n.oa()+4>n.getLength())return void(this.g=!0);I=(x=n.M())>>>24,x&=16777215}g=h+p,i&&g>n.getLength()&&(g=n.getLength()),o&&g>n.getLength()?this.g=!0:(o=g-n.oa(),k({name:b,parser:this,partialOkay:i||!1,version:I,flags:x,reader:n=new xn(n=0<o?n.rb(o):new Uint8Array(0),0),size:p,start:h+e,has64BitSize:w}))}else n.skip(Math.min(h+p-n.oa(),n.getLength()-n.oa()))}},We("shaka.util.Mp4Parser",_n),_n.headerSize=Ws,_n.typeToString=Ih,_n.allData=Po,_n.audioSampleEntry=sd,_n.visualSampleEntry=id,_n.sampleDescription=qa,_n.children=cn,_n.prototype.parseNext=_n.prototype.mc,_n.prototype.parse=_n.prototype.parse,_n.prototype.stop=_n.prototype.stop,_n.prototype.fullBox=_n.prototype.O,_n.prototype.box=_n.prototype.box;var n1=0,Pu=1;function Kr(){}function dy(e){return e=xh(Nt(e)),btoa(e)}function Mo(e,n){return n=n==null||n,e=dy(e).replace(/\+/g,"-").replace(/\//g,"_"),n?e:e.replace(/[=]*$/,"")}function ns(e){e=s.atob(e.replace(/-/g,"+").replace(/_/g,"/"));for(var n=new Uint8Array(e.length),i=0;i<e.length;++i)n[i]=e.charCodeAt(i);return n}function oi(e){for(var n=e.length/2,i=new Uint8Array(n),o=0;o<n;o++)i[o]=s.parseInt(e.substr(2*o,2),16);return i}function rs(e){var n=Nt(e);e="";for(var i=(n=T(n)).next();!i.done;i=n.next())(i=(i=i.value).toString(16)).length==1&&(i="0"+i),e+=i;return e}function $n(){for(var e=Ke.apply(0,arguments),n=0,i=0;i<e.length;++i)n+=e[i].byteLength;n=new Uint8Array(n);for(var o=i=0;o<e.length;++o){var h=e[o];h instanceof Uint8Array?n.set(h,i):n.set(Nt(h),i),i+=h.byteLength}return n}function hy(e){var n=this;this.g=[],this.h=[],this.data=[],new _n().box("moov",cn).box("moof",cn).O("pssh",function(i){if(!(1<i.version)){var o=Nt(i.reader.h,-12,i.size);if(n.data.push(o),n.g.push(rs(i.reader.rb(16))),0<i.version){o=i.reader.M();for(var h=0;h<o;h++){var p=rs(i.reader.rb(16));n.h.push(p)}}}}).parse(e)}function ba(e,n,i,o){var h=e.length,p=n.length+16+h;0<o&&(p+=4+16*i.size);var g=new Uint8Array(p),b=Nr(g),w=0;if(b.setUint32(w,p),w+=4,b.setUint32(w,1886614376),w+=4,1>o?b.setUint32(w,0):b.setUint32(w,16777216),w+=4,g.set(n,w),w+=n.length,0<o)for(b.setUint32(w,i.size),w+=4,i=(n=T(i)).next();!i.done;i=n.next())i=oi(i.value),g.set(i,w),w+=i.length;return b.setUint32(w,h),g.set(e,w+4),g}function zr(e,n){return(e=jn(e,n)).length!=1?null:e[0]}function dr(e,n,i){return(e=r1(e,n,i)).length!=1?null:e[0]}function jn(e,n){for(var i=[],o=(e=T(e.childNodes)).next();!o.done;o=e.next())(o=o.value)instanceof Element&&o.tagName==n&&i.push(o);return i}function r1(e,n,i){for(var o=[],h=(e=T(e.childNodes)).next();!h.done;h=e.next())(h=h.value)instanceof Element&&h.localName==i&&h.namespaceURI==n&&o.push(h);return o}function Mu(e,n,i){return e.hasAttributeNS(n,i)?e.getAttributeNS(n,i):null}function Wa(e,n,i){for(var o=(n=T(n)).next();!o.done;o=n.next())if(o=o.value,e.hasAttributeNS(o,i))return e.getAttributeNS(o,i);return null}function Tr(e){return Array.from(e.childNodes).every(Lh)?e.textContent.trim():null}function Lh(e){return e.nodeType==Node.TEXT_NODE||e.nodeType==Node.CDATA_SECTION_NODE}function Vt(e,n,i,o){o=o===void 0?null:o;var h=null;return(e=e.getAttribute(n))!=null&&(h=i(e)),h??o}function ad(e){return e?(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(e)&&(e+="Z"),e=Date.parse(e),isNaN(e)?null:e/1e3):null}function Ea(e){return e&&(e=RegExp("^P(?:([0-9]*)Y)?(?:([0-9]*)M)?(?:([0-9]*)D)?(?:T(?:([0-9]*)H)?(?:([0-9]*)M)?(?:([0-9.]*)S)?)?$").exec(e))?(e=31536e3*Number(e[1]||null)+2592e3*Number(e[2]||null)+86400*Number(e[3]||null)+3600*Number(e[4]||null)+60*Number(e[5]||null)+Number(e[6]||null),isFinite(e)?e:null):null}function Ya(e){var n=/([0-9]+)-([0-9]+)/.exec(e);return n?(e=Number(n[1]),isFinite(e)?(n=Number(n[2]),isFinite(n)?{start:e,end:n}:null):null):null}function Qa(e){return(e=Number(e))%1==0?e:null}function Xa(e){return(e=Number(e))%1==0&&0<e?e:null}function vi(e){return(e=Number(e))%1==0&&0<=e?e:null}function Ja(e){return e=Number(e),isNaN(e)?null:e}function Rh(e){return!!e&&e.toLowerCase()==="true"}function Ip(e){var n,i=(n=e.match(/^(\d+)\/(\d+)$/))?Number(n[1])/Number(n[2]):Number(e);return isNaN(i)?null:i}function Ou(e,n){var i=new DOMParser,o=Tn.value()(e);e=null;try{e=i.parseFromString(o,"text/xml")}catch{return null}if(!(i=e.documentElement)||i.getElementsByTagName("parsererror").length||i.tagName!=n)return null;if(!("createNodeIterator"in document))return i;for(n=document.createNodeIterator(e,NodeFilter.SHOW_ALL);e=n.nextNode();)if(e instanceof HTMLElement||e instanceof SVGElement)return null;return i}function Za(e,n){try{return Ou(qs(e),n)}catch{return null}}We("shaka.util.Uint8ArrayUtils",Kr),Kr.concat=$n,Kr.toHex=rs,Kr.fromHex=oi,Kr.fromBase64=ns,Kr.toBase64=Mo,Kr.toStandardBase64=dy;var Tn=new Dl(function(){if(typeof trustedTypes<"u"){var e=trustedTypes.createPolicy("shaka-player#xml",{createHTML:function(n){return n}});return function(n){return e.createHTML(n)}}return function(n){return n}});function ur(e,n){var i=this;n=n===void 0?1:n,this.C=e,this.H=new Set,this.m=this.s=null,this.ha=this.ba=!1,this.J=0,this.g=null,this.A=new mn,this.i=new Map,this.u=new Map,this.l=new Pn,this.h=null,this.o=function(o){o.severity==2&&i.l.reject(o),e.onError(o)},this.W=new Map,this.ca=new Map,this.K=new Qt(function(){return function(o){var h=o.W,p=o.ca;p.clear(),h.forEach(function(g,b){return p.set(b,g)}),(h=Array.from(p.values())).length&&h.every(function(g){return g=="expired"})&&o.o(new fe(2,6,6014)),o.C.Vd(kp(p))}(i)}),this.N=!1,this.L=[],this.V=!1,this.ga=new Qt(function(){(function(o){o.i.forEach(function(h,p){var g=h.$e,b=p.expiration;isNaN(b)&&(b=1/0),b!=g&&(o.C.onExpirationUpdated(p.sessionId,b),h.$e=b)})})(i)}).Ra(n),this.l.catch(function(){}),this.j=new Ln(function(){return function(o){return W(function(h){switch(h.g){case 1:return o.A.release(),o.A=null,o.l.reject(),o.ga.stop(),o.ga=null,o.K.stop(),o.K=null,N(h,s1(o),2);case 2:if(!o.m){h.B(3);break}return ne(h,4),N(h,o.m.setMediaKeys(null),6);case 6:ce(h,5);break;case 4:we(h);case 5:o.m=null;case 3:o.g=null,o.H.clear(),o.s=null,o.u=new Map,o.h=null,o.o=function(){},o.C=null,o.Y=!1,o.G=null,re(h)}})}(i)}),this.Y=!1,this.F=this.G=null}function Ur(e,n,i){e.u=new Map;for(var o=(i=T(i)).next();!o.done;o=i.next())e.u.set(o.value,{initData:null,initDataType:null});for(o=(i=T(e.h.persistentSessionsMetadata)).next();!o.done;o=i.next())o=o.value,e.u.set(o.sessionId,{initData:o.initData,initDataType:o.initDataType});return e.N=0<e.u.size,Ch(e,n)}function Ch(e,n){var i,o,h,p,g,b,w,k,I,x,C,D,_,j,F;return W(function(B){if(B.g==1){if(i=function(H){if((H=va(H.h.clearKeys)).size==0)return null;var Y=[],te=[];H.forEach(function(X,he){var ae=he;ae.length!=22&&(ae=Mo(oi(he),!1)),(he=X).length!=22&&(he=Mo(oi(X),!1)),X={kty:"oct",kid:ae,k:he},Y.push(X),te.push(X.kid)}),H=JSON.stringify({keys:Y});var q=JSON.stringify({kids:te});return q=[{initData:Nt(As(q)),initDataType:"keyids"}],{keySystem:"org.w3.clearkey",licenseServerUri:"data:application/json;base64,"+s.btoa(H),distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,serverCertificateUri:"",sessionType:"",initData:q,keyIds:new Set(te)}}(e))for(o=T(n),h=o.next();!h.done;h=o.next())(p=h.value).video&&(p.video.drmInfos=[i]),p.audio&&(p.audio.drmInfos=[i]);for((g=n.some(function(H){return!!(H.video&&H.video.drmInfos.length||H.audio&&H.audio.drmInfos.length)}))||(b=va(e.h.servers),function(H,Y){var te=[];for(Y.forEach(function(q,X){te.push({keySystem:X,licenseServerUri:q,distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,serverCertificateUri:"",initData:[],keyIds:new Set})}),H=T(H),Y=H.next();!Y.done;Y=H.next())(Y=Y.value).video&&(Y.video.drmInfos=te),Y.audio&&(Y.audio.drmInfos=te)}(n,b)),w=new Set,k=T(n),h=k.next();!h.done;h=k.next())for(I=h.value,x=Pp(I),C=T(x),D=C.next();!D.done;D=C.next())_=D.value,w.add(_);for(j=T(w),D=j.next();!D.done;D=j.next())Ph(D.value,va(e.h.servers),va(e.h.advanced||{}),e.h.keySystemsMapping);return N(B,bp(n,e.N,e.Y,e.h.preferredKeySystems),2)}return g||Object.keys(e.h.servers).length?(F=i1(e,void 0,n),B.return(g?F:F.catch(function(){}))):(e.ba=!0,B.return(Promise.resolve()))})}function Nu(e){var n;return W(function(i){switch(i.g){case 1:if(e.m.mediaKeys)return i.return();if(!e.G){i.B(2);break}return N(i,e.G,3);case 3:return rn(e.j),i.return();case 2:return ne(i,4),e.G=e.m.setMediaKeys(e.s),N(i,e.G,6);case 6:ce(i,5);break;case 4:n=we(i),e.o(new fe(2,6,6003,n.message));case 5:rn(e.j),re(i)}})}function Ml(e){var n,i,o,h;return W(function(p){if(p.g==1)return e.u.size?(e.u.forEach(function(g,b){Rp(e,b,g)}),N(p,e.l,3)):p.B(2);if(p.g!=2){if(0<(e.g&&e.g.keyIds||new Set([])).size&&function(g){for(var b=T(g.g&&g.g.keyIds||new Set([])),w=b.next();!w.done;w=b.next())if(g.W.get(w.value)!=="usable")return!1;return!0}(e))return p.return(e.l);e.l=new Pn,e.l.catch(function(){})}for(n=(e.g?e.g.initData:[])||[],i=T(n),o=i.next();!o.done;o=i.next())h=o.value,Ol(e,h.initDataType,h.initData);return li(e)&&e.l.resolve(),p.return(e.l)})}function Ol(e,n,i){if(i.length){for(var o=e.i.values(),h=(o=T(o)).next();!h.done;h=o.next())if(vs(i,h.value.initData)&&e.h.ignoreDuplicateInitData)return;0<e.i.size&&li(e)&&(e.l.resolve(),e.l=new Pn,e.l.catch(function(){})),function(p,g,b,w){try{var k=p.s.createSession(w)}catch(I){return void p.o(new fe(2,6,6005,I.message))}p.A.D(k,"message",function(I){p.m&&p.h.delayLicenseRequestUntilPlayed&&p.m.paused&&!p.V?p.L.push(I):Cp(p,I)}),p.A.D(k,"keystatuseschange",function(I){return fy(p,I)}),p.i.set(k,{initData:b,initDataType:g,loaded:!1,$e:1/0,Sa:null,type:w});try{b=p.h.initDataTransform(b,g,p.g)}catch(I){return g=I,I instanceof fe||(g=new fe(2,6,6016,I)),void p.o(g)}p.h.logLicenseExchange&&Mo(b),k.generateRequest(g,b).catch(function(I){if(!p.j.g){p.i.delete(k);var x=I.errorCode;if(x&&x.systemCode){var C=x.systemCode;0>C&&(C+=Math.pow(2,32)),C="0x"+C.toString(16)}p.o(new fe(2,6,6006,I.message,I,C))}})}(e,n,i,e.g.sessionType)}}function od(e){return!!e&&!!e.match(/^com\.(microsoft|chromecast)\.playready/)}function _u(e){return e=zs(e=e.i.keys(),function(n){return n.sessionId}),Array.from(e)}function i1(e,n,i){var o,h,p,g,b,w,k,I,x,C,D,_,j,F;return W(function(B){switch(B.g){case 1:if(o=new Map,i.length){h=function(oe,ge,le){for(var Ee=T(ge),ve=Ee.next();!ve.done;ve=Ee.next()){var Be=T(Pp(ve.value));for(ve=Be.next();!ve.done;ve=Be.next())ve=ve.value,le.has(ve.keySystem)||le.set(ve.keySystem,[]),le.get(ve.keySystem).push(ve)}if(le.size==1&&le.has(""))throw new fe(2,6,6e3);for(Ee={},oe=T(oe.h.preferredKeySystems),ve=oe.next();!ve.done;Ee={de:Ee.de},ve=oe.next())for(Ee.de=ve.value,Be=T(ge),ve=Be.next();!ve.done;ve=Be.next())if(ve=ve.value.decodingInfos.find(function(be){return function(ke){return ke.supported&&ke.keySystemAccess!=null&&ke.keySystemAccess.keySystem==be.de}}(Ee)))return ve.keySystemAccess;for(oe=T([!0,!1]),ve=oe.next();!ve.done;ve=oe.next())for(Ee=ve.value,Be=T(ge),ve=Be.next();!ve.done;ve=Be.next()){var _e=T(ve.value.decodingInfos);for(ve=_e.next();!ve.done;ve=_e.next()){var Ye=ve.value;if(Ye.supported&&Ye.keySystemAccess){var Ve=T(ve=le.get(Ye.keySystemAccess.keySystem));for(ve=Ve.next();!ve.done;ve=Ve.next())if(!!ve.value.licenseServerUri==Ee)return Ye.keySystemAccess}}}return null}(e,i,o),B.B(2);break}return N(B,function(oe,ge){var le,Ee,ve,Be,_e,Ye,Ve,be,ke,Ae,He,De,$e,je,Ge;return W(function(Fe){switch(Fe.g){case 1:if(ge.size==1&&ge.has(""))throw new fe(2,6,6e3);for(Ee=T(ge.values()),ve=Ee.next();!ve.done;ve=Ee.next())(Be=ve.value).audioCapabilities.length==0&&delete Be.audioCapabilities,Be.videoCapabilities.length==0&&delete Be.videoCapabilities;_e=T(oe.h.preferredKeySystems),Ye=_e.next();case 2:if(Ye.done){Fe.B(4);break}if(Ve=Ye.value,!ge.has(Ve)){Fe.B(3);break}return be=ge.get(Ve),ne(Fe,6),N(Fe,navigator.requestMediaKeySystemAccess(Ve,[be]),8);case 8:return le=Fe.h,Fe.return(le);case 6:we(Fe);case 7:rn(oe.j);case 3:Ye=_e.next(),Fe.B(2);break;case 4:ke=T([!0,!1]),Ae=ke.next();case 9:if(Ae.done){Fe.B(11);break}He=Ae.value,De=T(ge.keys()),Ye=De.next();case 12:if(Ye.done){Ae=ke.next(),Fe.B(9);break}if($e=Ye.value,je=ge.get($e),Ge=je.drmInfos.some(function(rt){return!!rt.licenseServerUri}),Ge!=He){Fe.B(13);break}return ne(Fe,15),N(Fe,navigator.requestMediaKeySystemAccess($e,[je]),17);case 17:return le=Fe.h,Fe.return(le);case 15:we(Fe);case 16:rn(oe.j);case 13:Ye=De.next(),Fe.B(12);break;case 11:return Fe.return(le)}})}(e,n),3);case 3:h=B.h;case 2:if(!(p=h))throw new fe(2,6,6001);for(rn(e.j),ne(B,4),e.H.clear(),g=p.getConfiguration(),b=g.audioCapabilities||[],w=g.videoCapabilities||[],k=T(b),I=k.next();!I.done;I=k.next())x=I.value,e.H.add(x.contentType.toLowerCase());for(C=T(w),I=C.next();!I.done;I=C.next())D=I.value,e.H.add(D.contentType.toLowerCase());if(i.length){var H=p.keySystem,Y=o.get(p.keySystem),te=[],q=[],X=[],he=[],ae=new Set;Br(Y,te,X,q,he,ae);var me=e.N?"persistent-license":"temporary";for(H={keySystem:H,licenseServerUri:te[0],distinctiveIdentifierRequired:Y[0].distinctiveIdentifierRequired,persistentStateRequired:Y[0].persistentStateRequired,sessionType:Y[0].sessionType||me,audioRobustness:Y[0].audioRobustness||"",videoRobustness:Y[0].videoRobustness||"",serverCertificate:X[0],serverCertificateUri:q[0],initData:he,keyIds:ae},te=(Y=T(Y)).next();!te.done;te=Y.next())(te=te.value).distinctiveIdentifierRequired&&(H.distinctiveIdentifierRequired=te.distinctiveIdentifierRequired),te.persistentStateRequired&&(H.persistentStateRequired=te.persistentStateRequired);Y=H}else Y=p.keySystem,H=n.get(p.keySystem),te=[],q=[],X=[],he=[],ae=new Set,Br(H.drmInfos,te,X,q,he,ae),Y={keySystem:Y,licenseServerUri:te[0],distinctiveIdentifierRequired:H.distinctiveIdentifier=="required",persistentStateRequired:H.persistentState=="required",sessionType:H.sessionTypes[0]||"temporary",audioRobustness:(H.audioCapabilities?H.audioCapabilities[0].robustness:"")||"",videoRobustness:(H.videoCapabilities?H.videoCapabilities[0].robustness:"")||"",serverCertificate:X[0],serverCertificateUri:q[0],initData:he,keyIds:ae};if(e.g=Y,!e.g.licenseServerUri)throw new fe(2,6,6012,e.g.keySystem);return N(B,p.createMediaKeys(),6);case 6:if(_=B.h,rn(e.j),e.s=_,e.h.minHdcpVersion==""||!("getStatusForPolicy"in e.s)){B.B(7);break}return ne(B,8),N(B,e.s.getStatusForPolicy({minHdcpVersion:e.h.minHdcpVersion}),10);case 10:if(B.h!="usable")throw new fe(2,6,6018);rn(e.j),ce(B,7,4);break;case 8:throw(j=we(B,4))instanceof fe?j:new fe(2,6,6019,j.message);case 7:return e.ba=!0,N(B,function(oe){var ge,le;return W(function(Ee){switch(Ee.g){case 1:if(!oe.s||!oe.g)return Ee.return();if(!oe.g.serverCertificateUri||oe.g.serverCertificate&&oe.g.serverCertificate.length){Ee.B(2);break}return ge=lr([oe.g.serverCertificateUri],oe.h.retryParameters),ne(Ee,3),N(Ee,oe.C.Tb.request(5,ge).promise,5);case 5:le=Ee.h,oe.g.serverCertificate=Nt(le.data),ce(Ee,4);break;case 3:throw new fe(2,6,6017,we(Ee));case 4:if(oe.j.g)return Ee.return();case 2:return oe.g.serverCertificate&&oe.g.serverCertificate.length?(ne(Ee,6),N(Ee,oe.s.setServerCertificate(oe.g.serverCertificate),8)):Ee.return();case 8:ce(Ee,0);break;case 6:throw new fe(2,6,6004,we(Ee).message)}})}(e),11);case 11:rn(e.j),ce(B,0);break;case 4:throw F=we(B),rn(e.j,F),e.g=null,e.H.clear(),F instanceof fe?F:new fe(2,6,6002,F.message)}})}function Cr(e){li(e)&&e.l.resolve()}function Lp(e,n){new Qt(function(){n.loaded=!0,Cr(e)}).U(py)}function Rp(e,n,i){var o,h,p,g,b,w,k;return W(function(I){switch(I.g){case 1:try{o=e.s.createSession("persistent-license")}catch(x){return h=new fe(2,6,6005,x.message),e.o(h),I.return(Promise.reject(h))}return e.A.D(o,"message",function(x){e.m&&e.h.delayLicenseRequestUntilPlayed&&e.m.paused&&!e.V?e.L.push(x):Cp(e,x)}),e.A.D(o,"keystatuseschange",function(x){return fy(e,x)}),p={initData:i.initData,initDataType:i.initDataType,loaded:!1,$e:1/0,Sa:null,type:"persistent-license"},e.i.set(o,p),ne(I,2),N(I,o.load(n),4);case 4:return g=I.h,rn(e.j),g||(e.i.delete(o),b=e.h.persistentSessionOnlinePlayback?1:2,e.o(new fe(b,6,6013)),p.loaded=!0),Lp(e,p),Cr(e),I.return(o);case 2:w=we(I),rn(e.j,w),e.i.delete(o),k=e.h.persistentSessionOnlinePlayback?1:2,e.o(new fe(k,6,6005,w.message)),p.loaded=!0,Cr(e);case 3:return I.return(Promise.resolve())}})}function Cp(e,n){var i,o,h,p,g,b,w,k,I,x,C,D;W(function(_){switch(_.g){case 1:if(i=n.target,e.h.logLicenseExchange&&Mo(n.message),o=e.i.get(i),h=e.g.licenseServerUri,p=e.h.advanced[e.g.keySystem],n.messageType=="individualization-request"&&p&&p.individualizationServer&&(h=p.individualizationServer),(g=lr([h],e.h.retryParameters)).body=n.message,g.method="POST",g.licenseRequestType=n.messageType,g.sessionId=i.sessionId,g.drmInfo=e.g,o&&(g.initData=o.initData,g.initDataType=o.initDataType),od(e.g.keySystem)){var j=ws(g.body,!0,!0);if(j.includes("PlayReadyKeyMessage")){for(var F=T((j=Ou(j,"PlayReadyKeyMessage")).getElementsByTagName("HttpHeader")),B=F.next();!B.done;B=F.next())B=B.value,g.headers[B.getElementsByTagName("name")[0].textContent]=B.getElementsByTagName("value")[0].textContent;g.body=ns(j.getElementsByTagName("Challenge")[0].textContent)}else g.headers["Content-Type"]="text/xml; charset=utf-8"}return b=Date.now(),ne(_,2),N(_,e.C.Tb.request(2,g).promise,4);case 4:w=_.h,ce(_,3);break;case 2:return k=we(_),e.j.g||(I=new fe(2,6,6007,k),e.i.size==1?(e.o(I),o&&o.Sa&&o.Sa.reject(I)):(o&&o.Sa&&o.Sa.reject(I),e.i.delete(i),li(e)&&(e.l.resolve(),e.K.U(.1)))),_.return();case 3:return e.j.g?_.return():(e.J+=(Date.now()-b)/1e3,e.h.logLicenseExchange&&Mo(w.data),ne(_,5),N(_,i.update(w.data),7));case 7:ce(_,6);break;case 5:return x=we(_),C=new fe(2,6,6008,x.message),e.o(C),o&&o.Sa&&o.Sa.reject(C),_.return();case 6:if(e.j.g)return _.return();D=new dt("drmsessionupdate"),e.C.onEvent(D),o&&(o.Sa&&o.Sa.resolve(),Lp(e,o)),re(_)}})}function fy(e,n){n=n.target;var i=e.i.get(n),o=!1;n.keyStatuses.forEach(function(p,g){if(typeof g=="string"){var b=g;g=p,p=b}if(od(e.g.keySystem)&&g.byteLength==16&&(zm()||wu())){var w=(b=Nr(g)).getUint32(0,!0),k=b.getUint16(4,!0),I=b.getUint16(6,!0);b.setUint32(0,w,!1),b.setUint16(4,k,!1),b.setUint16(6,I,!1)}p!="status-pending"&&(i.loaded=!0),p=="expired"&&(o=!0),g=rs(g).slice(0,32),e.W.set(g,p)});var h=n.expiration-Date.now();(0>h||o&&1e3>h)&&i&&!i.Sa&&(e.i.delete(n),n.close().catch(function(){})),li(e)&&(e.l.resolve(),e.K.U(Oo))}function s1(e){var n;return W(function(i){return n=Array.from(e.i.entries()),e.i.clear(),N(i,Promise.all(n.map(function(o){var h=(o=T(o)).next().value,p=o.next().value;return W(function(g){return g.g==1?(ne(g,2),e.ha||e.u.has(h.sessionId)||p.type!=="persistent-license"||e.h.persistentSessionOnlinePlayback?N(g,function(b){var w;return W(function(k){return k.g==1?(w=new Promise(function(I,x){new Qt(x).U(Mp)}),ne(k,2),N(k,Promise.race([Promise.all([b.close(),b.closed]),w]),4)):k.g!=2?ce(k,0):(we(k),void re(k))})}(h),5):N(g,h.remove(),5)):g.g!=2?ce(g,0):(we(g),void re(g))})})),0)})}function Dp(e,n){return!e.length||!n.length||e===n||0<Dh(e,n).length}function Dh(e,n){if(!e.length)return n;if(!n.length)return e;for(var i=[],o=(e=T(e)).next();!o.done;o=e.next()){o=o.value;for(var h=T(n),p=h.next();!p.done;p=h.next())if(p=p.value,o.keySystem==p.keySystem){h=new Map;for(var g=T((o.initData||[]).concat(p.initData||[])),b=g.next();!b.done;b=g.next())b=b.value,h.set(b.keyId,b);h=Array.from(h.values()),g=o.keyIds&&p.keyIds?new Set([].concat(M(o.keyIds),M(p.keyIds))):o.keyIds||p.keyIds,i.push({keySystem:o.keySystem,licenseServerUri:o.licenseServerUri||p.licenseServerUri,distinctiveIdentifierRequired:o.distinctiveIdentifierRequired||p.distinctiveIdentifierRequired,persistentStateRequired:o.persistentStateRequired||p.persistentStateRequired,videoRobustness:o.videoRobustness||p.videoRobustness,audioRobustness:o.audioRobustness||p.audioRobustness,serverCertificate:o.serverCertificate||p.serverCertificate,serverCertificateUri:o.serverCertificateUri||p.serverCertificateUri,initData:h,keyIds:g});break}}return i}function Pp(e){return(e.video?e.video.drmInfos:[]).concat(e.audio?e.audio.drmInfos:[])}function li(e){return function(n,i){for(var o=(n=T(n)).next();!o.done;o=n.next())if(!i(o.value))return!1;return!0}(e=e.i.values(),function(n){return n.loaded})}function Br(e,n,i,o,h,p){for(var g={},b=(e=T(e)).next();!b.done;g={Ca:g.Ca},b=e.next()){if(g.Ca=b.value,n.includes(g.Ca.licenseServerUri)||n.push(g.Ca.licenseServerUri),o.includes(g.Ca.serverCertificateUri)||o.push(g.Ca.serverCertificateUri),g.Ca.serverCertificate&&(i.some(function(I){return function(x){return vs(x,I.Ca.serverCertificate)}}(g))||i.push(g.Ca.serverCertificate)),g.Ca.initData){b={};for(var w=T(g.Ca.initData),k=w.next();!k.done;b={kd:b.kd},k=w.next())b.kd=k.value,h.some(function(I){return function(x){var C=I.kd;return!(!x.keyId||x.keyId!=C.keyId)||x.initDataType==C.initDataType&&vs(x.initData,C.initData)}}(b))||h.push(b.kd)}if(g.Ca.keyIds)for(w=(b=T(g.Ca.keyIds)).next();!w.done;w=b.next())p.add(w.value)}}function Ph(e,n,i,o){var h=e.keySystem;!h||h=="org.w3.clearkey"&&e.licenseServerUri||(n.size&&(n=n.get(h)||"",e.licenseServerUri=n),e.keyIds||(e.keyIds=new Set),(i=i.get(h))&&(e.distinctiveIdentifierRequired||(e.distinctiveIdentifierRequired=i.distinctiveIdentifierRequired),e.persistentStateRequired||(e.persistentStateRequired=i.persistentStateRequired),e.videoRobustness||(e.videoRobustness=i.videoRobustness),e.audioRobustness||(e.audioRobustness=i.audioRobustness),e.serverCertificate||(e.serverCertificate=i.serverCertificate),i.sessionType&&(e.sessionType=i.sessionType),e.serverCertificateUri||(e.serverCertificateUri=i.serverCertificateUri)),o[h]&&(e.keySystem=o[h]),s.cast&&s.cast.Ot&&h=="com.microsoft.playready"&&(e.keySystem="com.chromecast.playready"))}(c=ur.prototype).destroy=function(){return this.j.destroy()},c.configure=function(e){this.h=e},c.Kc=function(e){var n=this;return W(function(i){if(i.g==1)return n.s?(n.m=e,n.A.ka(n.m,"play",function(){for(var o=T(n.L),h=o.next();!h.done;h=o.next())Cp(n,h.value);n.V=!0,n.L=[]}),"webkitCurrentPlaybackTargetIsWireless"in n.m&&n.A.D(n.m,"webkitcurrentplaybacktargetiswirelesschanged",function(){return s1(n)}),n.F=n.g&&n.g.initData.find(function(o){return 0<o.initData.length})||null,n.F||n.g.keySystem!=="com.apple.fps"||n.u.size?N(i,Nu(n),2):i.B(2)):(n.A.ka(e,"encrypted",function(){n.o(new fe(2,6,6010))}),i.return());Ml(n).catch(function(){}),n.F||n.u.size||n.h.parseInbandPsshEnabled||n.A.D(n.m,"encrypted",function(o){return function(h,p){return W(function(g){if(g.g==1)return N(g,Nu(h),2);Ol(h,p.initDataType,Nt(p.initData)),re(g)})}(n,o)}),re(i)})},c.Ge=function(){var e=this,n=this.i.keys();return n=zs(n,function(i){var o=e.i.get(i);return{sessionId:i.sessionId,sessionType:o.type,initData:o.initData,initDataType:o.initDataType}}),Array.from(n)},c.Sc=function(){for(var e=1/0,n=this.i.keys(),i=(n=T(n)).next();!i.done;i=n.next())i=i.value,isNaN(i.expiration)||(e=Math.min(e,i.expiration));return e},c.Bd=function(){return kp(this.ca)};var Mp=1,py=5,Oo=.5,Fu=new Dl(function(){return bs(new Uint8Array([0]))});function Uu(){}function Op(e,n){if(n){var i=ks[n.toLowerCase()];if(i)return i}throw new fe(2,4,4e3,e,n)}We("shaka.media.ManifestParser",Uu),Uu.unregisterParserByMime=function(e){delete ks[e]},Uu.registerParserByMime=function(e,n){ks[e]=n},Uu.registerParserByExtension=function(){Ss("ManifestParser.registerParserByExtension","Please use an ManifestParser with registerParserByMime function.")},Uu.AccessibilityPurpose={Zi:"visually impaired",vi:"hard of hearing"};var ks={};function a1(e,n,i,o,h){var p=o1.value(),g=e.subarray(i.start,i.start+i.size),b=Nr(g),w=new Uint8Array(i.size+p.byteLength);for(w.set(g,0),(g=Nr(w)).setUint32(4,h),w.set(p,i.size),h=b.getUint32(4),g.setUint32(i.size+16,h),gy(w,0,w.byteLength),h=new Uint8Array(e.byteLength+w.byteLength),i=qc()?i.start:i.start+i.size,p=e.subarray(i),h.set(e.subarray(0,i)),h.set(w,i),h.set(p,i+w.byteLength),o=(e=T(o)).next();!o.done;o=e.next())gy(h,(o=o.value).start,o.size+w.byteLength);return w=Nr(h,n.start),n=Ws(n),e=w.getUint32(n),w.setUint32(n,e+1),h}function gy(e,n,i){(n=(e=Nr(e,n)).getUint32(0))!=0&&(n==1?(e.setUint32(8,i>>32),e.setUint32(12,4294967295&i)):e.setUint32(0,i))}var o1=new Dl(function(){return new Uint8Array([0,0,0,80,115,105,110,102,0,0,0,12,102,114,109,97,0,0,0,0,0,0,0,20,115,99,104,109,0,0,0,0,99,101,110,99,0,1,0,0,0,0,0,40,115,99,104,105,0,0,0,32,116,101,110,99,0,0,0,0,0,0,1,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])});function is(e,n,i,o,h,p,g){this.Z=e,this.Qa=n,this.ua=i,this.Ve=o===void 0?null:o,this.timescale=h===void 0?null:h,this.g=p===void 0?null:p,this.aes128Key=g===void 0?null:g,this.mimeType=this.codecs=null}function my(e,n){return e===n||(e&&n?e.hc()==n.hc()&&e.fc()==n.fc()&&Om(e.Z().sort(),n.Z().sort())&&vs(e.g,n.g):e==n)}function wt(e,n,i,o,h,p,g,b,w,k,I,x,C,D,_,j){for(k=k===void 0?[]:k,D=D===void 0?Nl:D,this.startTime=e,this.j=this.endTime=n,this.F=i,this.Qa=o,this.ua=h,this.h=p,this.timestampOffset=g,this.appendWindowStart=b,this.appendWindowEnd=w,this.i=k,this.tilesLayout=I===void 0?"":I,this.C=x===void 0?null:x,this.g=C===void 0?null:C,this.status=D,this.o=!1,this.m=!0,this.s=!1,this.aes128Key=_===void 0?null:_,this.A=null,this.l=0,this.u=j!==void 0&&j,this.Nd=this.$c=!1,n=(e=T(this.i)).next();!n.done;n=e.next())n.value.ag();this.u&&this.i.length&&this.i[this.i.length-1].$f(),this.mimeType=this.codecs=null}function yy(e,n){e.h=n;for(var i=(e=T(e.i)).next();!i.done;i=e.next())yy(i.value,n)}is.prototype.hc=function(){return this.Qa},is.prototype.fc=function(){return this.ua},We("shaka.media.InitSegmentReference",is),is.prototype.getEndByte=is.prototype.fc,is.prototype.getStartByte=is.prototype.hc,(c=wt.prototype).Z=function(){return this.F()},c.getStartTime=function(){return this.startTime},c.Ug=function(){return this.endTime},c.hc=function(){return this.Qa},c.fc=function(){return this.ua},c.mh=function(){return this.tilesLayout},c.lh=function(){return this.C},c.Pb=function(){return this.status},c.Ch=function(){this.status=vy},c.Ue=function(){this.o=!0},c.yh=function(){return this.o},c.Pd=function(){this.m=!1},c.vh=function(){return this.m},c.ag=function(){this.$c=!0},c.xh=function(){return this.$c},c.$f=function(){this.Nd=!0},c.wh=function(){return this.Nd},c.Zf=function(){this.s=!0},c.sh=function(){return this.s},c.qg=function(e){this.A=e},c.kh=function(){return this.A},c.offset=function(e){this.startTime+=e,this.endTime+=e,this.j+=e;for(var n=T(this.i),i=n.next();!i.done;i=n.next())(i=i.value).startTime+=e,i.endTime+=e,i.j+=e},c.tf=function(e){this.g==null?Kn("Sync attempted without sync time!"):(e=this.g-e-this.startTime,.001<=Math.abs(e)&&this.offset(e))},We("shaka.media.SegmentReference",wt),wt.prototype.syncAgainst=wt.prototype.tf,wt.prototype.offset=wt.prototype.offset,wt.prototype.getThumbnailSprite=wt.prototype.kh,wt.prototype.setThumbnailSprite=wt.prototype.qg,wt.prototype.hasByterangeOptimization=wt.prototype.sh,wt.prototype.markAsByterangeOptimization=wt.prototype.Zf,wt.prototype.isLastPartial=wt.prototype.wh,wt.prototype.markAsLastPartial=wt.prototype.$f,wt.prototype.isPartial=wt.prototype.xh,wt.prototype.markAsPartial=wt.prototype.ag,wt.prototype.isIndependent=wt.prototype.vh,wt.prototype.markAsNonIndependent=wt.prototype.Pd,wt.prototype.isPreload=wt.prototype.yh,wt.prototype.markAsPreload=wt.prototype.Ue,wt.prototype.markAsUnavailable=wt.prototype.Ch,wt.prototype.getStatus=wt.prototype.Pb,wt.prototype.getTileDuration=wt.prototype.lh,wt.prototype.getTilesLayout=wt.prototype.mh,wt.prototype.getEndByte=wt.prototype.fc,wt.prototype.getStartByte=wt.prototype.hc,wt.prototype.getEndTime=wt.prototype.Ug,wt.prototype.getStartTime=wt.prototype.getStartTime,wt.prototype.getUris=wt.prototype.Z;var Nl=0,vy=1;function Np(e){return!e||e.length==1&&1e-6>e.end(0)-e.start(0)?null:e.length?e.end(e.length-1):null}function _p(e,n){return!(!e||!e.length||e.length==1&&1e-6>e.end(0)-e.start(0)||n>e.end(e.length-1))&&n>=e.start(0)}function Fp(e,n){if(!e||!e.length||e.length==1&&1e-6>e.end(0)-e.start(0))return 0;for(var i=0,o=(e=T(No(e))).next();!o.done;o=e.next()){var h=o.value;o=h.start,(h=h.end)>n&&(i+=h-Math.max(o,n))}return i}function No(e){if(!e)return[];for(var n=[],i=0;i<e.length;i++)n.push({start:e.start(i),end:e.end(i)});return n}function Up(){}function by(e,n){return n+10<=e.length&&e[n]===73&&e[n+1]===68&&e[n+2]===51&&255>e[n+3]&&255>e[n+4]&&128>e[n+6]&&128>e[n+7]&&128>e[n+8]&&128>e[n+9]}function Ey(e,n){return n+10<=e.length&&e[n]===51&&e[n+1]===68&&e[n+2]===73&&255>e[n+3]&&255>e[n+4]&&128>e[n+6]&&128>e[n+7]&&128>e[n+8]&&128>e[n+9]}function Bp(e,n){var i=(127&e[n])<<21;return i|=(127&e[n+1])<<14,(i|=(127&e[n+2])<<7)|127&e[n+3]}function YT(e){var n={key:e.type,description:"",data:"",mimeType:null,pictureType:null};if(e.type==="APIC"){if(2>e.size||e.data[0]!==3)return null;var i=e.data.subarray(1).indexOf(0);if(i===-1)return null;var o=Wn(Nt(e.data,1,i)),h=e.data[2+i],p=e.data.subarray(3+i).indexOf(0);if(p===-1)return null;var g,b=Wn(Nt(e.data,3+i,p));return g=o==="-->"?Wn(Nt(e.data,4+i+p)):bs(e.data.subarray(4+i+p)),n.mimeType=o,n.pictureType=h,n.description=b,n.data=g,n}return e.type==="TXXX"||e.type==="WXXX"?2>e.size||e.data[0]!==3||(o=e.data.subarray(1).indexOf(0))===-1?null:(i=Wn(Nt(e.data,1,o)),e=Wn(Nt(e.data,2+o)).replace(/\0*$/,""),n.description=i,n.data=e,n):e.type==="PRIV"?2>e.size||(i=e.data.indexOf(0))===-1?null:(i=Wn(Nt(e.data,0,i)),n.description=i,i=="com.apple.streaming.transportStreamTimestamp"?(i=e.data.subarray(i.length+1),e=1&i[3],i=(i[4]<<23)+(i[5]<<15)+(i[6]<<7)+i[7],i/=45,e&&(i+=4772185884e-2),n.data=i):(e=bs(e.data.subarray(i.length+1)),n.data=e),n):e.type[0]==="T"?2>e.size||e.data[0]!==3?null:(e=Wn(e.data.subarray(1)).replace(/\0*$/,""),n.data=e,n):e.type[0]==="W"?(e=Wn(e.data).replace(/\0*$/,""),n.data=e,n):e.data?(n.data=bs(e.data),n):null}function _l(e){for(var n=0,i=[];by(e,n);){var o=Bp(e,n+6);for(e[n+5]>>6&1&&(n+=10),o=(n+=10)+o;n+10<o;){var h=e.subarray(n),p=Bp(h,4);(p=YT(h={type:String.fromCharCode(h[0],h[1],h[2],h[3]),size:p,data:h.subarray(10,10+p)}))&&i.push(p),n+=h.size+10}Ey(e,n)&&(n+=10)}return i}function Ta(e,n){for(var i=n=n===void 0?0:n,o=0;by(e,n);)e[n+5]>>6&1&&(o+=10),o+=10,o+=Bp(e,n+6),Ey(e,n+10)&&(o+=10),n+=o;return 0<o?e.subarray(i,i+o):new Uint8Array([])}function Ty(e,n){var i=null,o=null,h=null,p=e.M();return 1&n&&(h=e.oc()),2&n&&e.skip(4),8&n&&(i=e.M()),16&n&&(o=e.M()),{trackId:p,Kf:i,Ng:o,aj:h}}function ld(e,n){return n==1?(n=e.M(),e=e.M(),{baseMediaDecodeTime:n*Math.pow(2,32)+e}):{baseMediaDecodeTime:e.M()}}function Bu(e,n){return n==1?(e.skip(8),e.skip(8)):(e.skip(4),e.skip(4)),n=e.M(),e.skip(4),e=e.wa(),{timescale:n,language:String.fromCharCode(96+(e>>10))+String.fromCharCode(96+((960&e)>>5))+String.fromCharCode(96+(31&e))}}function Sy(e,n,i){var o=e.M(),h=[],p=null;1&i&&(p=e.M()),4&i&&e.skip(4);for(var g=0;g<o;g++){var b={hf:null,sampleSize:null,Xd:null};256&i&&(b.hf=e.M()),512&i&&(b.sampleSize=e.M()),1024&i&&e.skip(4),2048&i&&(b.Xd=n==0?e.M():e.fg()),h.push(b)}return{ej:o,ig:h,Mg:p}}function $p(e,n){n==1?(e.skip(8),e.skip(8)):(e.skip(4),e.skip(4));var i=e.M();return n==1?e.skip(8):e.skip(4),e.skip(4),e.skip(8),e.skip(2),e.skip(2),e.skip(2),e.skip(2),e.skip(36),{trackId:i,width:n=e.wa()+e.wa()/16,height:e=e.wa()+e.wa()/16}}function wy(e,n){return e.skip(87),{ja:n+"."+this.g(e.fa())+this.g(e.fa())+this.g(e.fa())}}function Ay(e){return{ja:Ih(e=e.M())}}function eo(e,n){if(this.j=e,n!==void 0&&n){n=new Uint8Array(e.byteLength);for(var i=0,o=0;o<e.byteLength;o++)2<=o&&e[o]==3&&e[o-1]==0&&e[o-2]==0||(n[i]=e[o],i++);this.j=Nt(n,0,i)}this.i=this.j.byteLength,this.g=this.h=0}function jp(e){var n=e.j.byteLength-e.i,i=new Uint8Array(4),o=Math.min(4,e.i);o!==0&&(i.set(e.j.subarray(n,n+o)),e.h=new xn(i,0).M(),e.g=8*o,e.i-=o)}function bi(e,n){if(e.g<=n){n-=e.g;var i=Math.floor(n/8);n-=8*i,e.g-=i,jp(e)}e.h<<=n,e.g-=n}function Ut(e,n){var i=Math.min(e.g,n),o=e.h>>>32-i;return e.g-=i,0<e.g?e.h<<=i:0<e.i&&jp(e),0<(i=n-i)?o<<i|Ut(e,i):o}function Gp(e){var n;for(n=0;n<e.g;++n)if(e.h&2147483648>>>n)return e.h<<=n,e.g-=n,n;return jp(e),n+Gp(e)}function ui(e){bi(e,1+Gp(e))}function tt(e){return Ut(e,Gp(e)+1)-1}function $u(e){return 1&(e=tt(e))?1+e>>>1:-1*(e>>>1)}function ht(e){return Ut(e,1)===1}function sn(e){return Ut(e,8)}function ky(e,n){for(var i=8,o=8,h=0;h<n;h++)o!==0&&(o=(i+(o=$u(e))+256)%256),i=o===0?i:o}function l1(e){return sn(e),tt(e),tt(e)}function Mn(){this.F=null,this.G=!1,this.m=this.H=null,this.j=[],this.g=[],this.u=this.A=null,this.i=[],this.h=[],this.C=null,this.l=[],this.o=this.s=null}function Hp(e,n){if((n[0]<<16|n[1]<<8|n[2])!=1)return null;var i={data:new Uint8Array(0),packetLength:n[4]<<8|n[5],pts:null,dts:null,nalus:[]};if(i.packetLength&&i.packetLength>n.byteLength-6)return null;var o=n[7];if(192&o){var h=536870912*(14&n[9])+4194304*(255&n[10])+16384*(254&n[11])+128*(255&n[12])+(254&n[13])/2;e.s==null&&(e.s=h),i.pts=xy(h,e.s),e.s=i.pts,i.dts=i.pts,64&o&&(o=536870912*(14&n[14])+4194304*(255&n[15])+16384*(254&n[16])+128*(255&n[17])+(254&n[18])/2,e.o==null&&(e.o=o),i.dts=xy(o,e.o)),e.o=i.dts}return e=n[8]+9,n.byteLength<=e?null:(i.data=n.subarray(e),i)}function xy(e,n){var i=1;for(e>n&&(i=-1);4294967296<Math.abs(n-e);)e+=8589934592*i;return e}function Vp(e){return!(0>Iy(e))}function Iy(e){for(var n=Math.min(1e3,e.length-564),i=0;i<n;){if(e[i]==71&&e[i+188]==71&&e[i+376]==71)return i;i++}return-1}wt.Status={hi:Nl,Xi:vy,Bi:2},We("shaka.util.Id3Utils",Up),Up.getID3Data=Ta,Up.getID3Frames=_l,We("shaka.util.ExpGolomb",eo),(c=Mn.prototype).clearData=function(){this.j=[],this.g=[],this.i=[],this.h=[],this.l=[]},c.parse=function(e){if(564>e.length)return this;for(var n=Math.max(0,Iy(e)),i=e.length-(e.length+n)%188,o=!1,h=n;h<i;h+=188)if(e[h]==71){var p=!!(64&e[h+1]),g=((31&e[h+1])<<8)+e[h+2];if(1<(48&e[h+3])>>4){var b=h+5+e[h+4];if(b==h+188)continue}else b=h+4;switch(g){case 0:p&&(b+=e[b]+1),this.F=(31&e[b+10])<<8|e[b+11];break;case 17:case 8191:break;case this.F:p&&(b+=e[b]+1),g={audio:-1,video:-1,Jd:-1,audioCodec:"",videoCodec:""};var w=b+3+((15&(p=e)[b+1])<<8|p[b+2])-4;for(b+=12+((15&p[b+10])<<8|p[b+11]);b<w;){var k=(31&p[b+1])<<8|p[b+2],I=(15&p[b+3])<<8|p[b+4];switch(p[b]){case 6:if(0<I)for(var x=b+5,C=I;2<C;){var D=p[x+1]+2;switch(p[x]){case 5:var _=xh(p.subarray(x+2,x+D));g.audio==-1&&_==="Opus"?(g.audio=k,g.audioCodec="opus"):g.video==-1&&_==="AV01"&&(g.video=k,g.videoCodec="av1");break;case 106:g.audio==-1&&(g.audio=k,g.audioCodec="ac3");break;case 122:g.audio==-1&&(g.audio=k,g.audioCodec="ec3");break;case 124:g.audio==-1&&(g.audio=k,g.audioCodec="aac")}x+=D,C-=D}break;case 15:g.audio==-1&&(g.audio=k,g.audioCodec="aac");break;case 17:g.audio==-1&&(g.audio=k,g.audioCodec="aac-loas");break;case 21:g.Jd==-1&&(g.Jd=k);break;case 27:g.video==-1&&(g.video=k,g.videoCodec="avc");break;case 3:case 4:g.audio==-1&&(g.audio=k,g.audioCodec="mp3");break;case 36:g.video==-1&&(g.video=k,g.videoCodec="hvc");break;case 129:g.audio==-1&&(g.audio=k,g.audioCodec="ac3");break;case 132:case 135:g.audio==-1&&(g.audio=k,g.audioCodec="ec3")}b+=I+5}(p=g).video!=-1&&(this.H=p.video,this.m=p.videoCodec),p.audio!=-1&&(this.A=p.audio,this.u=p.audioCodec),p.Jd!=-1&&(this.C=p.Jd),o&&!this.G&&(o=!1,h=n-188),this.G=!0;break;case this.H:b=e.subarray(b,h+188),p?this.j.push([b]):this.j.length&&this.j[this.j.length-1]&&this.j[this.j.length-1].push(b);break;case this.A:b=e.subarray(b,h+188),p?this.i.push([b]):this.i.length&&this.i[this.i.length-1]&&this.i[this.i.length-1].push(b);break;case this.C:b=e.subarray(b,h+188),p?this.l.push([b]):this.l.length&&this.l[this.l.length-1]&&this.l[this.l.length-1].push(b);break;default:o=!0}}return this},c.Ih=function(e){return Ss("TsParser.parseAvcNalus","Please use parseNalus function instead."),this.cf(e)},c.cf=function(e,n,i){var o=e.pts?e.pts/9e4:null,h=(e=e.data).byteLength,p=1;this.m=="hvc"&&(p=2);for(var g,b=i||0,w=[],k=-1,I=0,x=0;x<h;++x){var C=e[x];if(C){if(2<=b&&C==1){if(n&&!w.length&&k==-1&&(C=x-(3<b?3:b),i&&C!=0&&(C=e.subarray(0,C),n.data=$n(n.data,C),n.fullData=$n(n.fullData,C))),0<=k?(b=x-((3<b?3:b)+1),w.push({data:e.subarray(k+p,b+1),fullData:e.subarray(k,b+1),type:I,time:o})):n&&!w.length&&0<(k=x-b)&&(k=e.subarray(0,k),n.data=$n(n.data,k),n.fullData=$n(n.fullData,k)),x>=h-p)return w;k=++x,I=this.m=="hvc"?e[x]>>1&63:31&e[x]}b=0}else b++;x>=h-1&&0<=k&&0<=b&&(g={data:e.subarray(k+p,h),fullData:e.subarray(k,h),type:I,time:o})}return g&&w.push(g),!w.length&&n&&(n.data=$n(n.data,e),n.fullData=$n(n.fullData,e)),w},c.getMetadata=function(){for(var e=[],n=T(this.l),i=n.next();!i.done;i=n.next())(i=Hp(this,i=$n.apply(Kr,M(i.value))))&&e.push({cueTime:i.pts?i.pts/9e4:null,data:i.data,frames:_l(i.data),dts:i.dts,pts:i.pts});return e},c.Lb=function(){if(this.i.length&&!this.h.length){for(var e=!1,n=T(this.i),i=n.next();!i.done;i=n.next()){var o=$n.apply(Kr,M(i.value)),h=Hp(this,o);i=this.h.length?this.h[this.h.length-1]:null,h&&h.pts!=null&&h.dts!=null&&(!i||i.pts!=h.pts&&i.dts!=h.dts)?(this.h.length&&h.dts<(i.dts||0)&&(e=!0),this.h.push(h)):this.h.length&&(o=h?h.data:o)&&((i=this.h.pop()).data=$n(i.data,o),this.h.push(i))}e&&(this.h=this.h.sort(function(p,g){var b=(p.pts||0)-(g.pts||0);return(p.dts||0)-(g.dts||0)||b}))}return this.h},c.jc=function(e){if(e=e===void 0||e,this.j.length&&!this.g.length){for(var n=!1,i=T(this.j),o=i.next();!o.done;o=i.next()){var h=$n.apply(Kr,M(o.value)),p=Hp(this,h);o=this.g.length?this.g[this.g.length-1]:null,p&&p.pts!=null&&p.dts!=null&&(!o||o.pts!=p.pts&&o.dts!=p.dts)?(this.g.length&&p.dts<(o.dts||0)&&(n=!0),this.g.push(p)):this.g.length&&(h=p?p.data:h)&&((o=this.g.pop()).data=$n(o.data,h),this.g.push(o))}if(e){var g;for(o=(i=T(this.g)).next();!o.done;o=i.next())(o=o.value).nalus=this.cf(o,g,void 0),o.nalus.length&&(g=o.nalus[o.nalus.length-1]);this.g=this.g.filter(function(b){return b.nalus.length})}n&&(this.g=this.g.sort(function(b,w){var k=(b.pts||0)-(w.pts||0);return(b.dts||0)-(w.dts||0)||k}))}return e?this.g:(e=this.g,this.g=[],e)},c.getStartTime=function(e){if(e=="audio"){e=null;var n=this.Lb();return n.length&&(e=n[0],e=Math.min(e.dts,e.pts)/9e4),e}return e=="video"?(e=null,(n=this.jc(!1)).length&&(e=n[0],e=Math.min(e.dts,e.pts)/9e4),e):null},c.Rc=function(){return{audio:this.u,video:this.m}},c.Fd=function(){for(var e=[],n=T(this.jc()),i=n.next();!i.done;i=n.next())e.push.apply(e,M(i.value.nalus));return e},c.ph=function(){Ss("TsParser.getVideoResolution","Please use getVideoInfo function instead.");var e=this.Ke();return{height:e.height,width:e.width}},c.Ke=function(){return this.m=="hvc"?function(e){var n={height:null,width:null,ja:null};if(!(e=e.Fd()).length||!(e=e.find(function(te){return te.type==33})))return n;var i=new eo(e.fullData,!0);sn(i),sn(i),Ut(i,4);var o=Ut(i,3);ht(i);var h=Ut(i,2),p=Ut(i,1),g=Ut(i,5),b=Ut(i,32);e=sn(i);for(var w=sn(i),k=sn(i),I=sn(i),x=sn(i),C=sn(i),D=sn(i),_=[],j=[],F=0;F<o;F++)_.push(ht(i)),j.push(ht(i));if(0<o)for(F=o;8>F;F++)Ut(i,2);for(F=0;F<o;F++)_[F]&&Ut(i,88),j[F]&&sn(i);tt(i),(o=tt(i))==3&&Ut(i,1),_=tt(i),j=tt(i);var B=F=0,H=0,Y=0;return ht(i)&&(F+=tt(i),B+=tt(i),H+=tt(i),Y+=tt(i)),n.width=String(_-(F+B)*(o===1||o===2?2:1)),n.height=String(j-(H+Y)*(o===1?2:1)),i=function(te){for(var q=0,X=0;32>X;X++)q|=(te>>X&1)<<31-X;return q>>>0}(b),p=p==1?"H":"L",h="hvc1."+["","A","B","C"][h]+g,h+="."+i.toString(16).toUpperCase(),h+="."+p+D,C&&(h+="."+C.toString(16).toUpperCase()),x&&(h+="."+x.toString(16).toUpperCase()),I&&(h+="."+I.toString(16).toUpperCase()),k&&(h+="."+k.toString(16).toUpperCase()),w&&(h+="."+w.toString(16).toUpperCase()),e&&(h+="."+e.toString(16).toUpperCase()),n.ja=h,n}(this):function(e){var n={height:null,width:null,ja:null};if(!(e=e.Fd()).length||!(e=e.find(function(C){return C.type==7})))return n;var i=sn(e=new eo(e.data)),o=sn(e),h=sn(e);if(ui(e),u1.includes(i)){var p=tt(e);if(p===3&&bi(e,1),ui(e),ui(e),bi(e,1),ht(e)){p=p!==3?8:12;for(var g=0;g<p;g++)ht(e)&&ky(e,6>g?16:64)}}if(ui(e),(p=tt(e))===0)tt(e);else if(p===1)for(bi(e,1),ui(e),ui(e),p=tt(e),g=0;g<p;g++)ui(e);ui(e),bi(e,1),p=tt(e),g=tt(e);var b=Ut(e,1);b===0&&bi(e,1),bi(e,1);var w=0,k=0,I=0,x=0;return ht(e)&&(w=tt(e),k=tt(e),I=tt(e),x=tt(e)),n.height=String((2-b)*(g+1)*16-2*I-2*x),n.width=String(16*(p+1)-2*w-2*k),n.ja="avc1."+("0"+i.toString(16).toUpperCase()).slice(-2)+("0"+o.toString(16).toUpperCase()).slice(-2)+("0"+h.toString(16).toUpperCase()).slice(-2),n}(this)},We("shaka.util.TsParser",Mn),Mn.syncOffset=Iy,Mn.probe=Vp,Mn.prototype.getVideoInfo=Mn.prototype.Ke,Mn.prototype.getVideoResolution=Mn.prototype.ph,Mn.prototype.getVideoNalus=Mn.prototype.Fd,Mn.prototype.getCodecs=Mn.prototype.Rc,Mn.prototype.getStartTime=Mn.prototype.getStartTime,Mn.prototype.getVideoData=Mn.prototype.jc,Mn.prototype.getAudioData=Mn.prototype.Lb,Mn.prototype.getMetadata=Mn.prototype.getMetadata,Mn.prototype.parseNalus=Mn.prototype.cf,Mn.prototype.parseAvcNalus=Mn.prototype.Ih,Mn.prototype.parse=Mn.prototype.parse,Mn.prototype.clearData=Mn.prototype.clearData,Mn.Timescale=9e4;var u1=[100,110,122,244,44,83,86,118,128,138,139,134];function _o(e,n,i){this.g=null,this.o=-1,this.l=e,this.i=n,this.m=i,this.j=!1;e:{if(typeof libDPIModule>"u"&&Rt("Could not find LCEVC Library dependencies on this page"),typeof LCEVCdec<"u")this.h=LCEVCdec;else{if(typeof LcevcDil>"u"){Rt("Could not find LCEVC Library on this page"),e=!1;break e}this.h=LcevcDil,this.j=!0,Ss("LcevcDil","lcevc_dil.js is deprecated, please use lcevc_dec.js instead")}this.h.SupportObject===void 0?(Rt("Could not find LCEVC Library on this page"),e=!1):(this.h.SupportObject.SupportStatus||Rt(this.h.SupportObject.SupportError),e=this.h!==void 0&&typeof libDPIModule<"u"&&this.i instanceof HTMLCanvasElement&&this.h.SupportObject.SupportStatus)}e&&!this.g&&this.h.SupportObject.webGLSupport(this.i)&&(this.i.classList.remove("shaka-hidden"),this.g=this.j?new this.h.LcevcDil(this.l,this.i,this.m):new this.h.LCEVCdec(this.l,this.i,this.m))}function Kp(e){e.g&&e.i.classList.add("shaka-hidden")}function Mh(e,n,i){var o=c1,h=Gu;switch(n.mimeType){case"video/webm":o=d1;break;case"video/mp4":o=to}switch(i){case"DASH":h=Fl;break;case"HLS":h=ju}e.g&&(e.o=n.id,e.g.setLevelSwitching(n.id,!0),e.g.setContainerFormat(o),e.j||e.g.setStreamingFormat(h))}_o.prototype.release=function(){this.g&&(this.g.close(),this.g=null)},We("shaka.lcevc.Dec",_o),_o.prototype.release=_o.prototype.release;var c1=0,d1=1,to=2,ju=0,Fl=1,Gu=-1;function zp(e,n,i,o){var h=this;this.i=e,this.C=null,this.F=n,this.g={},this.G={},this.za={},this.h=null,this.ba=!1,this.Fa=i||function(){},this.V=o||null,this.j={},this.o=new mn,this.m={},this.H=null,this.L=new Pn,this.N="",this.ca=!1,this.l=qp(this,this.L),this.A=!1,this.J=new Ln(function(){return function(p){var g,b,w,k,I,x,C;return W(function(D){if(D.g==1){for(b in g=[],p.j)for(w=p.j[b],k=w[0],p.j[b]=w.slice(0,1),k&&g.push(k.p.catch(gp)),I=T(w.slice(1)),x=I.next();!x.done;x=I.next())x.value.p.reject(new fe(2,7,7003,void 0));for(C in p.h&&g.push(p.h.destroy()),p.F&&g.push(p.F.destroy()),p.m)g.push(p.m[C].destroy());return N(D,Promise.all(g),2)}p.o&&(p.o.release(),p.o=null),p.i&&(p.i.removeAttribute("src"),p.i.load(),p.i=null),p.C=null,p.l=null,p.h=null,p.F=null,p.g={},p.m={},p.H=null,p.j={},p.V=null,p.K=null,re(D)})}(h)}),this.u=!1,this.Y="UNKNOWN",this.ya=this.Aa=!1,this.ha=new Pn,this.s=!1,this.ga=!0,this.K=this.W=null}function qp(e,n){if(s.ManagedMediaSource){e.i.disableRemotePlayback=!0;var i=new ManagedMediaSource;return e.o.D(i,"startstreaming",function(){e.ga=!0}),e.o.D(i,"endstreaming",function(){e.ga=!1}),e.o.ka(i,"sourceopen",function(){URL.revokeObjectURL(e.N),n.resolve()}),e.o.ka(e.i,"playing",function(){e.ca=!0}),e.N=Bh(i),e.i.src=e.N,i}return i=new MediaSource,e.o.ka(i,"sourceopen",function(){URL.revokeObjectURL(e.N),n.resolve()}),e.o.ka(e.i,"playing",function(){e.ca=!0}),e.N=Bh(i),e.i.src=e.N,i}function Oh(e,n,i,o){var h,p,g,b,w,k,I,x,C,D,_,j;return W(function(F){switch(F.g){case 1:return h=_r,p=Ot,g=gn,N(F,function(B,H){var Y,te,q,X,he,ae,me,oe,ge,le;return W(function(Ee){if(Ee.g==1)return B.createSegmentIndex?N(Ee,B.createSegmentIndex(),2):Ee.B(2);if(!B.segmentIndex)return Ee.return(!1);if(B.segmentIndex.ob()==0)return Ee.return(!0);for(Y=_r,te=new Set,q=T(B.segmentIndex),X=q.next();!X.done;X=q.next())if(he=X.value,ae=he.mimeType||B.mimeType||"",me=he.codecs||B.codecs||"",oe=ae+":"+me,!te.has(oe)){if(te.add(oe),H==Y.ia){if(!xl(Er(ae,me)))return Ee.return(!1)}else if(H==Y.$?me=Qc(me):H==Y.P&&(me=xu(me,ae)),ge=Kc(B,ae,me),le=ko(ae,me),!Dn(ge)&&!wo(le))return Ee.return(!1)}return Ee.return(!0)})}(i,n),2);case 2:if(g.call(p,F.h,"Type negotiation should happen before MediaSourceEngine.init!"),b=Er(i.mimeType,o),n==h.ia){Nh(e,b,e.u,i.external),F.B(0);break}if(w=e.C.forceTransmux,(!Dn(b)||!e.u&&Ga.includes(b))&&(w=!0),k=ko(i.mimeType,o),!w){F.B(4);break}if(I=Li(h.P,(o||"").split(",")),x=Li(h.$,(o||"").split(",")),!I||!x){F.B(5);break}return e.s=!0,N(F,Oh(e,h.P,i,I),6);case 6:return N(F,Oh(e,h.$,i,x),7);case 7:return F.return();case 5:(C=wo(k))&&(D=C(),e.m[n]=D,b=D.convertCodecs(n,k));case 4:_=b+e.C.sourceBufferExtraFeatures,rn(e.J);try{j=e.l.addSourceBuffer(_)}catch(B){throw new fe(2,3,3015,B,"The mediaSource_ status was "+e.l.readyState+" expected 'open'")}e.u&&(j.mode=f1),e.o.D(j,"error",function(){e.j[n][0].p.reject(new fe(2,3,3014,e.i.error?e.i.error.code:0))}),e.o.D(j,"updateend",function(){return no(e,n)}),e.g[n]=j,e.G[n]=b,e.za[n]=!!i.drmInfos.length,re(F)}})}function Nh(e,n,i,o){e.h||(e.h=new Ha(e.F));var h=e.h;o=o||e.ba,e=e.Y,n=="application/cea-608"||n=="application/cea-708"?h.i=null:(h.i=(0,zn[n])(),h.i.setSequenceMode?h.i.setSequenceMode(i):Rt('Text parsers should have a "setSequenceMode" method!'),h.i.setManifestType?h.i.setManifestType(e):Rt('Text parsers should have a "setManifestType" method!'),h.u=o)}function Ul(e){return!(e.A||e.l&&e.l.readyState!="ended")}function ud(e,n){return e=e.A||!Object.keys(e.g).length?null:n==en?e.h.g:!(e=Hu(e,n))||e.length==1&&1e-6>e.end(0)-e.start(0)?null:e.length==1&&0>e.start(0)?0:e.length?e.start(0):null}function _h(e,n){return e.A?null:n==en?e.h.h:Np(Hu(e,n))}function Hu(e,n){try{return e.g[n].buffered}catch{return null}}function Fh(e,n,i,o,h,p,g,b,w,k){var I,x,C,D,_,j,F,B,H,Y;return g=g!==void 0&&g,b=b!==void 0&&b,w=w!==void 0&&w,k=k!==void 0&&k,W(function(te){switch(te.g){case 1:if(n!=(I=_r).ia){te.B(2);break}if(!e.u){te.B(3);break}return N(te,e.ha,4);case 4:x=te.h,e.h.s=x;case 3:return N(te,function(q,X,he,ae,me){var oe,ge,le,Ee;return W(function(ve){return ve.g==1?N(ve,Promise.resolve(),2):q.i&&q.j?he==null||ae==null?(q.i.parseInit(Nt(X)),ve.return()):(oe=q.u?he:q.s,ge={periodStart:q.s,segmentStart:he,segmentEnd:ae,vttOffset:oe},le=q.i.parseMedia(Nt(X),ge,me),Ee=le.filter(function(Be){return Be.startTime>=q.l&&Be.startTime<q.m}),q.j.append(Ee),q.g==null&&(q.g=Math.max(he,q.l)),q.h=Math.min(ae,q.m),void re(ve)):ve.return()})}(e.h,i,o?o.startTime:null,o?o.endTime:null,o?o.Z()[0]:null),5);case 5:return te.return();case 2:if(k||!e.s){te.B(6);break}return N(te,Fh(e,I.P,i,o,h,p,g,b,w,!0),7);case 7:return N(te,Fh(e,I.$,i,o,h,p,g,b,w,!0),8);case 8:return te.return();case 6:if(!e.g[n])return te.return();if(C=e.g[n].timestampOffset,D=e.G[n],e.m[n]&&(D=e.m[n].getOriginalMimeType()),o&&(_=function(q,X,he,ae,me,oe){var ge=null,le=Nt(he);if(Ga.includes(me))(oe=_l(le)).length&&ae&&((X=oe.find(function(_e){return _e.description==="com.apple.streaming.transportStreamTimestamp"}))&&X.data&&(ge=Math.round(X.data)/1e3),q.Fa([{cueTime:ae.startTime,data:le,frames:oe,dts:ae.startTime,pts:ae.startTime}],0,ae.endTime));else if(me.includes("/mp4")&&ae&&ae.timestampOffset==0&&ae.h&&ae.h.timescale){var Ee=ae.h.timescale;if(!isNaN(Ee)){var ve=0,Be=!1;new _n().box("moof",cn).box("traf",cn).O("tfdt",function(_e){ve=ld(_e.reader,_e.version).baseMediaDecodeTime/Ee,Be=!0,_e.parser.stop()}).parse(he,!0),Be&&(ge=ve)}}else me.includes("/mp4")||me.includes("/webm")||!Vp(le)||(q.K?q.K.clearData():q.K=new Mn,(X=(le=q.K.parse(le)).getStartTime(X))!=null&&(ge=X),(le=le.getMetadata()).length&&q.Fa(le,oe,ae?ae.endTime:null));return ge}(e,n,i,o,D,C),_!=null&&(j=o.startTime-_,(.001<=Math.abs(C-j)||g||b)&&(!w||0<j||!C)&&(C=j,e.ya&&(Sn(e,n,function(){return Vu(e,n)}),Sn(e,n,function(){return Ku(e,n,C)}))),F=n==I.$||!(I.$ in e.g),e.u&&F&&e.ha.resolve(C))),p&&n==I.$&&(e.h||Nh(e,"application/cea-608",e.u,!1),e.H||(B=D.split(";",1)[0],e.H=new Yi(B)),o?(H=e.H.i(i)).length&&function(q,X,he,ae,me){for(var oe=he+" "+ae,ge=new Map,le=(X=T(X)).next();!le.done;le=X.next()){var Ee=le.value;le=Ee.stream,Ee=Ee.cue,ge.has(le)||ge.set(le,new Map),ge.get(le).has(oe)||ge.get(le).set(oe,[]),jm(q,Ee,me),Ee.startTime>=q.l&&Ee.startTime<q.m&&(ge.get(le).get(oe).push(Ee),le==q.A&&q.j.append([Ee]))}for(oe=(me=T(ge.keys())).next();!oe.done;oe=me.next())for(oe=oe.value,q.o.has(oe)||q.o.set(oe,new Map),le=(X=T(ge.get(oe).keys())).next();!le.done;le=X.next())le=le.value,Ee=ge.get(oe).get(le),q.o.get(oe).set(le,Ee);q.g=q.g==null?Math.max(he,q.l):Math.min(q.g,Math.max(he,q.l)),q.h=Math.max(q.h,Math.min(ae,q.m))}(e.h,H,o.startTime,o.endTime,C):e.H.init(i,b)),!e.m[n]){te.B(9);break}return N(te,e.m[n].transmux(i,h,o,e.l.duration,n),10);case 10:i=te.h;case 9:return i=function(q,X,he,ae){var me=q.za[ae];return q.C.insertFakeEncryptionInInit&&he==null&&me&&(Tu()||qc()||Nn("SOPOpenBrowser"))&&fh(q.G[ae])=="mp4"&&(X=function(oe){function ge(){ve=!0}function le(be){Be.push(be),cn(be)}oe=Nt(oe);var Ee,ve=!1,Be=[],_e=[];if(new _n().box("moov",le).box("trak",le).box("mdia",le).box("minf",le).box("stbl",le).O("stsd",function(be){Ee=be,Be.push(be),qa(be)}).O("encv",ge).O("enca",ge).O("dvav",function(be){_e.push({box:be,Ma:1701733238})}).O("dva1",function(be){_e.push({box:be,Ma:1701733238})}).O("dvh1",function(be){_e.push({box:be,Ma:1701733238})}).O("dvhe",function(be){_e.push({box:be,Ma:1701733238})}).O("hev1",function(be){_e.push({box:be,Ma:1701733238})}).O("hvc1",function(be){_e.push({box:be,Ma:1701733238})}).O("avc1",function(be){_e.push({box:be,Ma:1701733238})}).O("avc3",function(be){_e.push({box:be,Ma:1701733238})}).O("ac-3",function(be){_e.push({box:be,Ma:1701733217})}).O("ec-3",function(be){_e.push({box:be,Ma:1701733217})}).O("ac-4",function(be){_e.push({box:be,Ma:1701733217})}).O("mp4a",function(be){_e.push({box:be,Ma:1701733217})}).parse(oe),ve)return oe;if(_e.length==0||!Ee)throw rs(oe),new fe(2,3,3019);_e.reverse();for(var Ye=T(_e),Ve=Ye.next();!Ve.done;Ve=Ye.next())Ve=Ve.value,oe=a1(oe,Ee,Ve.box,Be,Ve.Ma);return oe}(X)),X}(e,i,o?o.startTime:null,n),o&&e.u&&n!=I.ia&&(g||b)&&(Y=o.startTime,Sn(e,n,function(){return Vu(e,n)}),Sn(e,n,function(){return Ku(e,n,Y)})),N(te,Sn(e,n,function(){var q=i;if(n=="video"&&e.V){var X=e.V;X.g&&X.g.appendBuffer(q,"video",X.o,-C)}e.g[n].appendBuffer(q)}),11);case 11:re(te)}})}function Uh(e,n){var i;return W(function(o){return o.g==1?n==(i=_r).ia?e.h?N(o,e.h.remove(0,1/0),0):o.return():N(o,Sn(e,n,function(){return cd(e,n,0,e.l.duration)}),4):e.s?N(o,Sn(e,i.P,function(){return cd(e,i.P,0,e.l.duration)}),0):o.B(0)})}function h1(e,n,i,o,h,p,g,b,w){var k,I;return W(function(x){return x.g==1?n==(k=_r).ia?(p||(e.h.s=i),function(C,D,_){C.l=D,C.m=_}(e.h,o,h),x.return()):(I=[],N(x,function(C,D,_,j,F){var B,H,Y,te,q,X,he,ae,me,oe,ge,le,Ee,ve,Be;return W(function(_e){return _e.g==1?D==(B=_r).ia?_e.return(!1):(H=Hs(Ci(C.G[D])),Y=Ri(C.G[D]),q=!1,X=Er(_,j),he=C.C.forceTransmux,(!Dn(X)||!C.u&&Ga.includes(X))&&(he=!0),he&&(ae=ko(_,j),me=wo(ae))&&(te=me(),oe=Li(B.P,(j||"").split(",")),ge=Li(B.$,(j||"").split(",")),oe&&ge?(q=!0,le=ge,D==B.P&&(le=oe),X=te.convertCodecs(D,ko(_,le))):X=te.convertCodecs(D,ae)),Ee=Hs(Ci(X)),ve=Ri(X),H===Ee&&Y===ve?_e.return(!1):(Be=!0,(C.s||q&&te&&!C.m[D])&&(Be=!1),Be&&C.C.codecSwitchingStrategy==="smooth"&&$a()?N(_e,function(Ye,Ve,be,ke){return Sn(Ye,Ve,function(){Ve!==en&&($a()&&(Ye.m[Ve]&&(Ye.m[Ve].destroy(),delete Ye.m[Ve]),ke&&(Ye.m[Ve]=ke),Ye.g[Ve].changeType(be+Ye.C.sourceBufferExtraFeatures),Ye.G[Ve]=be),no(Ye,Ve))})}(C,D,X,te),3):(te&&te.destroy(),N(_e,Ry(C,F),3)))):_e.return(!0)})}(e,n,g,b,w),2)):(x.h||(I.push(Sn(e,n,function(){return Vu(e,n)})),e.s&&I.push(Sn(e,k.P,function(){return Vu(e,k.P)}))),p||(I.push(Sn(e,n,function(){return Ku(e,n,i)})),e.s&&I.push(Sn(e,k.P,function(){return Ku(e,k.P,i)}))),I.push(Sn(e,n,function(){e.g[n].appendWindowStart=0,e.g[n].appendWindowEnd=h,e.g[n].appendWindowStart=o,no(e,n)})),e.s&&I.push(Sn(e,k.P,function(){var C=k.P;e.g[C].appendWindowStart=0,e.g[C].appendWindowEnd=h,e.g[C].appendWindowStart=o,no(e,C)})),N(x,Promise.all(I),0))})}function cd(e,n,i,o){o<=i?no(e,n):e.g[n].remove(i,o)}function Vu(e,n){var i=e.g[n].appendWindowStart,o=e.g[n].appendWindowEnd;e.g[n].abort(),e.g[n].appendWindowStart=i,e.g[n].appendWindowEnd=o,no(e,n)}function Ku(e,n,i){0>i&&(i+=.001),e.g[n].timestampOffset=i,no(e,n)}function no(e,n){if(!e.A){var i=e.j[n][0];i&&(i.p.resolve(),Wp(e,n))}}function Sn(e,n,i){return rn(e.J),i={start:i,p:new Pn},e.j[n].push(i),e.j[n].length==1&&Ly(e,n),i.p}function ci(e,n){var i,o,h,p,g;return W(function(b){switch(b.g){case 1:for(h in rn(e.J),i=[],o={},e.g)o.Ac=new Pn,p={start:function(w){return function(){return w.Ac.resolve()}}(o),p:o.Ac},e.j[h].push(p),i.push(o.Ac),e.j[h].length==1&&p.start(),o={Ac:o.Ac};return ne(b,2),N(b,Promise.all(i),4);case 4:ce(b,3);break;case 2:throw we(b);case 3:return ne(b,5,6),N(b,n(),6);case 6:for(g in ze(b),e.g)Wp(e,g);xe(b,0);break;case 5:throw new fe(2,3,3015,we(b),e.i.error||"No error in the media element")}})}function Wp(e,n){e.j[n].shift(),Ly(e,n)}function Ly(e,n){var i=e.j[n][0];if(i)try{i.start()}catch(o){o.name=="QuotaExceededError"?i.p.reject(new fe(2,3,3017,n)):i.p.reject(new fe(2,3,3015,o,e.i.error||"No error in the media element")),Wp(e,n)}}function Ry(e,n){return ci(e,function(){return function(i,o){var h,p,g,b,w,k,I,x,C,D,_,j,F,B,H,Y,te,q,X,he,ae,me,oe;return W(function(ge){switch(ge.g){case 1:for(k in h=_r,i.A=!0,i.s=!1,p=i.i.currentTime,g=i.i.autoplay,b=i.i.paused,i.ca&&(i.i.autoplay=!1),Se(ge,2),i.o.$a(),w=[],i.m)w.push(i.m[k].destroy());for(I in i.j)for(x=i.j[I],C=x[0],i.j[I]=x.slice(0,1),C&&w.push(C.p.catch(gp)),D=T(x.slice(1)),_=D.next();!_.done;_=D.next())_.value.p.reject(new fe(2,7,7003,void 0));for(j in i.g){F=i.g[j];try{i.l.removeSourceBuffer(F)}catch{}}return N(ge,Promise.all(w),4);case 4:return i.m={},i.g={},B=i.l.duration,i.L=new Pn,i.l=qp(i,i.L),N(ge,i.L,5);case 5:!isNaN(B)&&B?i.l.duration=B:!isNaN(i.W)&&i.W&&(i.l.duration=i.W),H=new Pn,Y=i.l.sourceBuffers,te=o.size,q=0,X=function(){++q===te&&(H.resolve(),i.o.Db(Y,"addsourcebuffer",X))},i.o.D(Y,"addsourcebuffer",X),he=T(o.keys()),ae=he.next();case 6:return ae.done?(i.i.currentTime=p,N(ge,H,2)):(me=ae.value,oe=o.get(me),N(ge,Oh(i,me,oe,oe.codecs),9));case 9:i.s?(i.j[h.P]=[],i.j[h.$]=[]):i.j[me]=[],ae=he.next(),ge.B(6);break;case 2:ze(ge),i.A=!1,rn(i.J),i.o.ka(i.i,"canplaythrough",function(){i.J.g||(i.i.autoplay=g,b||i.i.play())}),xe(ge,0)}})}(e,n)})}(c=zp.prototype).destroy=function(){return this.J.destroy()},c.init=function(e,n,i,o){n=n!==void 0&&n,i=i===void 0?"UNKNOWN":i,o=o!==void 0&&o;var h,p,g,b,w,k=this;return W(function(I){switch(I.g){case 1:return h=_r,N(I,k.L,2);case 2:k.u=n,k.Y=i,k.Aa=o,k.ya=!k.u&&k.Y=="HLS"&&!k.Aa,k.K=null,p=T(e.keys()),g=p.next();case 3:if(g.done){I.B(0);break}return b=g.value,w=e.get(b),N(I,Oh(k,b,w,w.codecs),6);case 6:k.s?(k.j[h.P]=[],k.j[h.$]=[]):k.j[b]=[],g=p.next(),I.B(3)}})},c.configure=function(e){this.C=e},c.nb=function(){var e={total:this.A?[]:No(this.i.buffered),audio:this.A?[]:No(Hu(this,"audio")),video:this.A?[]:No(Hu(this,"video")),text:[]};if(this.h){var n=this.h.g,i=this.h.h;n!=null&&i!=null&&e.text.push({start:n,end:i})}return e},c.remove=function(e,n,i){var o,h=this;return W(function(p){return p.g==1?e==(o=_r).ia?N(p,h.h.remove(n,i),0):N(p,Sn(h,e,function(){return cd(h,e,n,i)}),4):h.s?N(p,Sn(h,o.P,function(){return cd(h,o.P,n,i)}),0):p.B(0)})},c.flush=function(e){var n,i=this;return W(function(o){return o.g==1?e==(n=_r).ia?o.return():N(o,Sn(i,e,function(){i.i.currentTime-=.001,no(i,e)}),2):i.s?N(o,Sn(i,n.P,function(){var h=n.P;i.i.currentTime-=.001,no(i,h)}),0):o.B(0)})},c.endOfStream=function(e){var n=this;return W(function(i){return N(i,ci(n,function(){Ul(n)||n.l.readyState==="closed"||(e?n.l.endOfStream(e):n.l.endOfStream())}),0)})},c.Pa=function(e){var n=this;return W(function(i){return N(i,ci(n,function(){if(e<n.l.duration)for(var o in n.g){var h={start:function(){},p:new Pn};n.j[o].unshift(h)}n.l.duration=e,n.W=e}),0)})},c.getDuration=function(){return this.l.duration};var Bh=s.URL.createObjectURL,f1="sequence";function Tt(e,n,i){this.i=e,this.o=n,this.u=this.j=1/0,this.g=1,this.h=this.l=null,this.s=0,this.F=!0,this.G=0,this.A=i===void 0||i,this.H=0,this.m=!1,this.C=null}function Yp(e,n,i){this.j=i,this.l=e,this.s=Cy(e),this.g=e.g.currentTime,this.m=Date.now()/1e3,this.h=!1,this.o=0,this.u=n,this.i=function(){}}function p1(e){this.g=e}function Cy(e){if(e.g.paused||e.g.playbackRate==0||e.g.buffered.length==0)var n=!1;else e:{n=e.g.currentTime;for(var i=(e=T(No(e.g.buffered))).next();!i.done;i=e.next())if(!(n<(i=i.value).start-.1||n>i.end-.5)){n=!0;break e}n=!1}return n}function Qp(e,n,i,o,h){var p=this;this.u=h,this.g=e,this.A=n,this.s=i,this.l=new mn,this.j=!1,this.F=e.readyState,this.C=this.i=0,this.h=o,this.o=!1,this.l.D(e,"waiting",function(){return $h(p)}),this.m=new Qt(function(){$h(p)}).Ra(this.s.gapJumpTimerTime)}function $h(e){if(e.g.readyState!=0){if(e.g.seeking){if(!e.j)return}else e.j=!1;if(!e.g.paused||e.g.currentTime==e.i&&(e.g.autoplay||e.g.currentTime!=e.i)){var n;if(e.g.readyState!=e.F&&(e.F=e.g.readyState),!(n=!e.h)){var i=(n=e.h).l,o=Cy(i),h=i.g.currentTime,p=Date.now()/1e3;n.g==h&&n.s==o||(n.m=p,n.g=h,n.s=o,n.h=!1),(o=(h=p-n.m)>=n.u&&o&&!n.h)&&(n.i(n.g,h),n.h=!0,n.g=i.g.currentTime,n.o++,n.j(new dt("stalldetected"))),n=!o}n&&(n=e.g.currentTime,o=function(g,b,w){return!g||!g.length||g.length==1&&1e-6>g.end(0)-g.start(0)?null:0<=(g=No(g).findIndex(function(k,I,x){return k.start>b&&(I==0||x[I-1].end-b<=w)}))?g:null}(i=e.g.buffered,n,e.s.gapDetectionThreshold),o!=null&&(o!=0||e.o))&&(h=i.start(o),(yp()||qc())&&(h=Math.ceil(100*(h+.01))/100),h>=e.A.eb()||.001>h-n||(o!=0&&i.end(o-1),e.g.currentTime=h,n==e.i&&(e.i=h),e.C++,e.u(new dt("gapjumped"))))}}}function Bl(e,n,i,o){n==HTMLMediaElement.HAVE_NOTHING||e.readyState>=n?o():(n=Dy.value().get(n),i.ka(e,n,o))}(c=Tt.prototype).getDuration=function(){return this.j},c.ah=function(){return this.g},c.og=function(e){this.i=e},c.Pa=function(e){this.j=e},c.fh=function(){return this.i},c.mg=function(e){this.s=e},c.pc=function(e){this.F=e},c.Yd=function(e){this.u=e},c.nf=function(e){this.o=e},c.Tg=function(){return this.o},c.dg=function(e,n){if(e.length!=0){var i=e[e.length-1].end+n;this.Td(e[0].start+n),this.g=e.reduce(function(o,h){return Math.max(o,h.end-h.start)},this.g),this.h=Math.max(this.h,i),this.i!=null&&this.A&&!this.m&&(this.i=(Date.now()+this.s)/1e3-this.h-this.g)}},c.Zc=function(e){if(e.length!=0){for(var n=e[0].startTime,i=e[0].endTime,o=(Date.now()+this.s)/1e3,h=(e=T(e)).next();!h.done;h=e.next())o<(h=h.value).startTime||(n=Math.min(n,h.startTime),i=Math.max(i,h.endTime),this.g=Math.max(this.g,h.endTime-h.startTime));this.Td(n),this.h=Math.max(this.h,i),this.i!=null&&this.A&&!this.m&&(this.i=o-this.h-this.g)}},c.Od=function(){this.m=!0},c.zh=function(){return this.m},c.ng=function(e){this.C=e},c.Xg=function(){return this.C},c.Td=function(e){this.l=this.l==null?e:Math.min(this.l,e)},c.Xe=function(e){this.g=Math.max(this.g,e)},c.offset=function(e){this.l!=null&&(this.l+=e),this.h!=null&&(this.h+=e)},c.R=function(){return this.j==1/0&&!this.F},c.Rb=function(){return this.j!=1/0&&!this.F},c.fb=function(){return Math.max(this.G,this.yb()-this.u)},c.rg=function(e){this.G=e},c.yb=function(){return this.R()||this.Rb()?Math.min(Math.max(0,(Date.now()+this.s)/1e3-this.g-this.i)+this.H,this.j):this.h?Math.min(this.h,this.j):this.j},c.Tc=function(e){var n=Math.max(this.l,this.G);return this.u==1/0?Math.ceil(1e3*n)/1e3:Math.max(n,Math.min(this.yb()-this.u+e,this.eb()))},c.Ob=function(){return this.Tc(0)},c.eb=function(){return Math.max(0,this.yb()-(this.R()||this.Rb()?this.o:0))},c.vg=function(){return!(this.i==null||this.h!=null&&this.A)},c.lg=function(e){this.H=e},We("shaka.media.PresentationTimeline",Tt),Tt.prototype.setAvailabilityTimeOffset=Tt.prototype.lg,Tt.prototype.usingPresentationStartTime=Tt.prototype.vg,Tt.prototype.getSeekRangeEnd=Tt.prototype.eb,Tt.prototype.getSeekRangeStart=Tt.prototype.Ob,Tt.prototype.getSafeSeekRangeStart=Tt.prototype.Tc,Tt.prototype.getSegmentAvailabilityEnd=Tt.prototype.yb,Tt.prototype.setUserSeekStart=Tt.prototype.rg,Tt.prototype.getSegmentAvailabilityStart=Tt.prototype.fb,Tt.prototype.isInProgress=Tt.prototype.Rb,Tt.prototype.isLive=Tt.prototype.R,Tt.prototype.offset=Tt.prototype.offset,Tt.prototype.notifyMaxSegmentDuration=Tt.prototype.Xe,Tt.prototype.notifyMinSegmentStartTime=Tt.prototype.Td,Tt.prototype.getInitialProgramDateTime=Tt.prototype.Xg,Tt.prototype.setInitialProgramDateTime=Tt.prototype.ng,Tt.prototype.isStartTimeLocked=Tt.prototype.zh,Tt.prototype.lockStartTime=Tt.prototype.Od,Tt.prototype.notifySegments=Tt.prototype.Zc,Tt.prototype.notifyTimeRange=Tt.prototype.dg,Tt.prototype.getDelay=Tt.prototype.Tg,Tt.prototype.setDelay=Tt.prototype.nf,Tt.prototype.setSegmentAvailabilityDuration=Tt.prototype.Yd,Tt.prototype.setStatic=Tt.prototype.pc,Tt.prototype.setClockOffset=Tt.prototype.mg,Tt.prototype.getPresentationStartTime=Tt.prototype.fh,Tt.prototype.setDuration=Tt.prototype.Pa,Tt.prototype.setPresentationStartTime=Tt.prototype.og,Tt.prototype.getMaxSegmentDuration=Tt.prototype.ah,Tt.prototype.getDuration=Tt.prototype.getDuration,Yp.prototype.release=function(){this.j=this.l=null,this.i=function(){}},Qp.prototype.release=function(){this.l&&(this.l.release(),this.l=null),this.m!=null&&(this.m.stop(),this.m=null),this.h&&(this.h.release(),this.h=null),this.g=this.A=this.u=null},Qp.prototype.af=function(){this.o=!0,$h(this)};var Dy=new Dl(function(){return new Map([[HTMLMediaElement.HAVE_METADATA,"loadedmetadata"],[HTMLMediaElement.HAVE_CURRENT_DATA,"loadeddata"],[HTMLMediaElement.HAVE_FUTURE_DATA,"canplay"],[HTMLMediaElement.HAVE_ENOUGH_DATA,"canplaythrough"]])});function Py(e,n,i,o){var h=this;this.g=e,this.m=n,this.s=i,this.l=null,this.j=function(){return h.l==null&&(h.l=o()),h.l},this.o=!1,this.h=new mn,this.i=new Zp(e),Bl(this.g,HTMLMediaElement.HAVE_METADATA,this.h,function(){Jp(h,h.j())})}function jh(e){return e.o?e.g.currentTime:e.j()}function Xp(e,n){0<e.g.readyState?Oy(e.i,n):Bl(e.g,HTMLMediaElement.HAVE_METADATA,e.h,function(){Jp(e,e.j())})}function Jp(e,n){.001>Math.abs(e.g.currentTime-n)?My(e):(e.h.ka(e.g,"seeking",function(){My(e)}),Oy(e.i,e.g.currentTime&&e.g.currentTime!=0?e.g.currentTime:n))}function My(e){e.o=!0,e.h.D(e.g,"seeking",function(){return e.m()}),e.s(e.g.currentTime)}function Zp(e){var n=this;this.h=e,this.m=10,this.l=this.j=this.i=0,this.g=new Qt(function(){0>=n.i||n.h.currentTime!=n.j?n.g.stop():(n.h.currentTime=n.l,n.i--)})}function Oy(e,n){e.j=e.h.currentTime,e.l=n,e.i=e.m,e.h.currentTime=n,e.g.Ra(.1)}function ro(e){this.g=e,this.j=!1,this.h=null,this.i=new mn}function eg(e,n,i,o,h,p){var g=this;this.i=e,this.g=n.presentationTimeline,this.A=n.minBufferTime||0,this.l=i,this.u=h,this.s=null,this.o=function(b,w,k){if(!w.stallEnabled)return null;var I=w.stallSkip;return function(x,C){x.i=C}(w=new Yp(new p1(b),w.stallThreshold,k),function(){I?b.currentTime+=I:(b.pause(),b.play())}),w}(e,i,p),this.j=new Qp(e,n.presentationTimeline,i,this.o,p),this.h=new Py(e,function(){var b=g.j;b.j=!0,b.o=!1;var w=jh(g.h);return b=tg(g,w),.001<Math.abs(b-w)&&(w=Date.now()/1e3,!g.s||g.s<w-1)?(g.s=w,Xp(g.h,b),b=void 0):(g.u(),b=void 0),b},function(b){var w=g.j;w.g.seeking&&!w.j&&(w.j=!0,w.i=b)},function(){var b=o;return b==null?b=1/0>g.g.getDuration()?g.g.Ob():g.g.eb():0>b&&(b=g.g.eb()+b),Ny(g,$l(g,b))}),this.m=new Qt(function(){if(g.i.readyState!=0&&!g.i.paused){var b=jh(g.h),w=g.g.Ob(),k=g.g.eb();3>k-w&&(w=k-3),b<w&&(b=tg(g,b),g.i.currentTime=b)}})}function Ny(e,n){var i=e.g.getDuration();return n>=i?i-e.l.durationBackoff:n}function tg(e,n){var i=Math.max(e.A,e.l.rebufferingGoal),o=e.l.safeSeekOffset,h=e.g.Ob(),p=e.g.eb(),g=e.g.getDuration();3>p-h&&(h=p-3);var b=e.g.Tc(i),w=e.g.Tc(o);return i=e.g.Tc(i+o),n>=g?Ny(e,n):n>p?p:n<h?_p(e.i.buffered,w)?w:i:n>=b||_p(e.i.buffered,n)?n:i}function $l(e,n){var i=e.g.Ob();return n<i?i:n>(e=e.g.eb())?e:n}function Xt(e){this.g=e,this.m=null,this.j=0,this.o=!1}function io(e,n,i){return new Xt([e=new wt(e,e+n,function(){return i},0,null,null,e,e,e+n)])}function Yr(e,n,i){this.i=e,this.g=n,this.h=i}function Jn(){Xt.call(this,[]),this.h=[]}function zu(e){var n=this;this.g=e,this.j=!1,this.i=this.g.Ed(),this.h=new Qt(function(){n.g.bg(.25*n.i)})}function dd(e){e.h.stop();var n=e.j?0:e.i;if(0<=n)try{return void(e.g.Ed()!=n&&e.g.rf(n))}catch{}e.h.Ra(.25),e.g.Ed()!=0&&e.g.rf(0)}function Gh(e){var n=this;this.h=e,this.g=new Set,this.i=new Qt(function(){jl(n,!1)}).Ra(.25)}function jl(e,n){for(var i=T(e.g),o=i.next();!o.done;o=i.next())o.value.j(e.h.currentTime,n)}function Qr(e){hn.call(this),this.g=new Map,this.h=e}function hd(e){hn.call(this);var n=this;this.g=new Set,this.i=e,this.h=new Qt(function(){for(var i=n.i(),o=T(n.g),h=o.next();!h.done;h=o.next())(h=h.value).endTime<i.start&&(n.g.delete(h),h=new dt("regionremove",new Map([["region",h]])),n.dispatchEvent(h))}).Ra(2)}function Hh(e,n){hn.call(this);var i=this;this.i=e,this.l=n,this.g=new Map,this.m=[{Yb:null,Xb:Gl,Qb:function(o,h){return ss(i,"enter",o,h)}},{Yb:qu,Xb:Gl,Qb:function(o,h){return ss(i,"enter",o,h)}},{Yb:Ys,Xb:Gl,Qb:function(o,h){return ss(i,"enter",o,h)}},{Yb:Gl,Xb:qu,Qb:function(o,h){return ss(i,"exit",o,h)}},{Yb:Gl,Xb:Ys,Qb:function(o,h){return ss(i,"exit",o,h)}},{Yb:qu,Xb:Ys,Qb:function(o,h){return ss(i,"skip",o,h)}},{Yb:Ys,Xb:qu,Qb:function(o,h){return ss(i,"skip",o,h)}}],this.h=new mn,this.h.D(this.i,"regionremove",function(o){i.g.delete(o.region)})}function ss(e,n,i,o){n=new dt(n,new Map([["region",i],["seeking",o]])),e.dispatchEvent(n)}Py.prototype.release=function(){this.h&&(this.h.release(),this.h=null),this.i!=null&&(this.i.release(),this.i=null),this.m=function(){},this.g=null},Zp.prototype.release=function(){this.g&&(this.g.stop(),this.g=null),this.h=null},(c=ro.prototype).je=function(){var e=this;Bl(this.g,HTMLMediaElement.HAVE_CURRENT_DATA,this.i,function(){e.h==null||e.h==0?e.j=!0:(e.i.ka(e.g,"seeking",function(){e.j=!0}),e.g.currentTime=Math.max(0,e.g.currentTime+e.h))})},c.release=function(){this.i&&(this.i.release(),this.i=null),this.g=null},c.ke=function(e){this.h=this.j?this.h:e},c.qd=function(){return(this.j?this.g.currentTime:this.h)||0},c.Bf=function(){return 0},c.Af=function(){return 0},c.cg=function(){},(c=eg.prototype).je=function(){this.m.Ra(.25)},c.release=function(){this.h&&(this.h.release(),this.h=null),this.j&&(this.j.release(),this.j=null),this.m&&(this.m.stop(),this.m=null),this.i=this.h=this.g=this.l=null,this.u=function(){}},c.ke=function(e){Xp(this.h,e)},c.qd=function(){var e=jh(this.h);return 0<this.i.readyState&&!this.i.paused?$l(this,e):e},c.Bf=function(){return this.o?this.o.o:0},c.Af=function(){return this.j.C},c.cg=function(){this.j.af()},(c=Xt.prototype).ob=function(){return this.g.length},c.release=function(){this.o||(this.g=[],this.m&&this.m.stop(),this.m=null)},c.Dh=function(){this.o=!0},c.bc=function(e){for(var n=T(this.g),i=n.next();!i.done;i=n.next())e(i.value)},c.find=function(e){for(var n=this.g.length-1,i=n;0<=i;--i){var o=this.g[i],h=i<n?this.g[i+1].startTime:o.endTime;if(e>=o.startTime&&e<h)return i+this.j}return this.g.length&&e<this.g[0].startTime?this.j:null},c.get=function(e){return this.g.length==0||0>(e-=this.j)||e>=this.g.length?null:this.g[e]},c.offset=function(e){if(!this.o)for(var n=T(this.g),i=n.next();!i.done;i=n.next())i.value.offset(e)},c.Rd=function(e){if(!this.o&&e.length){var n=Math.round(1e3*e[0].startTime)/1e3;this.g=this.g.filter(function(i){return Math.round(1e3*i.startTime)/1e3<n}),this.g.push.apply(this.g,M(e))}},c.Yc=function(e,n){var i=this;e=e.filter(function(o){return o.endTime>n&&(i.g.length==0||o.endTime>i.g[0].startTime)}),this.Rd(e),this.bb(n)},c.bb=function(e){if(!this.o){var n=this.g.length;this.g=this.g.filter(function(i){return i.endTime>e}),this.j+=n-this.g.length}},c.ac=function(e,n,i){if(i=i!==void 0&&i,!this.o){for(;this.g.length&&this.g[this.g.length-1].startTime>=n;)this.g.pop();for(;this.g.length&&this.g[0].endTime<=e;)this.g.shift(),i||this.j++;this.g.length!=0&&((n=new wt((e=this.g[this.g.length-1]).startTime,n,e.F,e.Qa,e.ua,e.h,e.timestampOffset,e.appendWindowStart,e.appendWindowEnd,e.i,e.tilesLayout,e.C,e.g,e.status,e.aes128Key)).mimeType=e.mimeType,n.codecs=e.codecs,n.l=e.l,this.g[this.g.length-1]=n)}},c.Zd=function(e,n){var i=this;this.o||(this.m&&this.m.stop(),this.m=new Qt(function(){var o=n();o?i.g.push.apply(i.g,M(o)):(i.m.stop(),i.m=null)}),this.m.Ra(e))},Xt.prototype[Symbol.iterator]=function(){return this.Mb(0)},Xt.prototype.Mb=function(e){var n=this.find(e);if(n==null)return null;n--;var i=this.get(n+1),o=-1;if(i&&0<i.i.length)for(var h=i.i.length-1;0<=h;--h){var p=i.i[h];if(e>=p.startTime&&e<p.endTime){for(;h&&!p.m;)h--,p=i.i[h];if(!p.m)return Kn("No independent partial segment found!"),null;n++,o=h-1;break}}return new Yr(this,n,o)},We("shaka.media.SegmentIndex",Xt),Xt.forSingleSegment=io,Xt.prototype.getIteratorForTime=Xt.prototype.Mb,Xt.prototype.updateEvery=Xt.prototype.Zd,Xt.prototype.fit=Xt.prototype.ac,Xt.prototype.evict=Xt.prototype.bb,Xt.prototype.mergeAndEvict=Xt.prototype.Yc,Xt.prototype.offset=Xt.prototype.offset,Xt.prototype.get=Xt.prototype.get,Xt.prototype.find=Xt.prototype.find,Xt.prototype.markImmutable=Xt.prototype.Dh,Xt.prototype.release=Xt.prototype.release,Yr.prototype.Lg=function(){return this.g},Yr.prototype.current=function(){var e=this.i.get(this.g);return e&&0<e.i.length&&e.u&&this.h>=e.i.length&&(this.g++,this.h=0,e=this.i.get(this.g)),e&&0<e.i.length?e.i[this.h]:e},Yr.prototype.next=function(){var e=this.i.get(this.g);return e&&0<e.i.length?(this.h++,e.u&&this.h==e.i.length&&(this.g++,this.h=0)):(this.g++,this.h=0),{value:e=this.current(),done:!e}},We("shaka.media.SegmentIterator",Yr),Yr.prototype.next=Yr.prototype.next,Yr.prototype.current=Yr.prototype.current,Yr.prototype.currentPosition=Yr.prototype.Lg,Z(Jn,Xt),(c=Jn.prototype).clone=function(){var e=new Jn;return e.h=this.h.slice(),e},c.release=function(){for(var e=T(this.h),n=e.next();!n.done;n=e.next())n.value.release();this.h=[]},c.bc=function(e){for(var n=T(this.h),i=n.next();!i.done;i=n.next())i.value.bc(e)},c.find=function(e){for(var n=0,i=T(this.h),o=i.next();!o.done;o=i.next()){var h=(o=o.value).find(e);if(h!=null)return h+n;n+=o.j+o.ob()}return null},c.get=function(e){for(var n=0,i=T(this.h),o=i.next();!o.done;o=i.next()){var h=(o=o.value).get(e-n);if(h)return h;n+=o.j+o.ob()}return null},c.offset=function(){},c.Rd=function(){},c.bb=function(){},c.Yc=function(){},c.ac=function(){},c.Zd=function(){},We("shaka.media.MetaSegmentIndex",Jn),Jn.prototype.updateEvery=Jn.prototype.Zd,Jn.prototype.fit=Jn.prototype.ac,Jn.prototype.mergeAndEvict=Jn.prototype.Yc,Jn.prototype.evict=Jn.prototype.bb,Jn.prototype.merge=Jn.prototype.Rd,Jn.prototype.offset=Jn.prototype.offset,Jn.prototype.get=Jn.prototype.get,Jn.prototype.find=Jn.prototype.find,Jn.prototype.forEachTopLevelReference=Jn.prototype.bc,Jn.prototype.release=Jn.prototype.release,zu.prototype.release=function(){this.set(this.ec()),this.h&&(this.h.stop(),this.h=null),this.g=null},zu.prototype.set=function(e){this.i=e,dd(this)},zu.prototype.ec=function(){return this.g.ec()},Gh.prototype.release=function(){this.i.stop();for(var e=T(this.g),n=e.next();!n.done;n=e.next())n.value.release();this.g.clear()},Z(Qr,hn),Qr.prototype.release=function(){this.g.clear(),hn.prototype.release.call(this)},Qr.prototype.j=function(e){for(var n=T(this.g.values()),i=n.next();!i.done;i=n.next()){e:{for(var o=(i=i.value).ad,h=o.length-1;0<=h;h--){var p=o[h];if(p.position<=e){o=p.Ve;break e}}o=null}if((h=o)&&(h=!((h=i.If)===o||h&&o&&h.bandwidth==o.bandwidth&&h.audioSamplingRate==o.audioSamplingRate&&h.codecs==o.codecs&&h.contentType==o.contentType&&h.frameRate==o.frameRate&&h.height==o.height&&h.mimeType==o.mimeType&&h.channelsCount==o.channelsCount&&h.pixelAspectRatio==o.pixelAspectRatio&&h.width==o.width)),h)e:{if(h=e,p=o.contentType,(p=this.h()[p])&&0<p.length){var g=p[p.length-1].end;if(h>=p[0].start&&h<g){h=!0;break e}}h=!1}h&&(i.If=o,JSON.stringify(o),i=new dt("qualitychange",new Map([["quality",o],["position",e]])),this.dispatchEvent(i))}},Z(hd,hn),hd.prototype.release=function(){this.g.clear(),this.h.stop(),hn.prototype.release.call(this)},Z(Hh,hn),Hh.prototype.release=function(){this.i=null,this.g.clear(),this.h.release(),this.h=null,hn.prototype.release.call(this)},Hh.prototype.j=function(e,n){if(!this.l||e!=0){this.l=!1;for(var i=T(this.i.g),o=i.next();!o.done;o=i.next()){o=o.value;var h=this.g.get(o),p=e<o.startTime?qu:e>o.endTime?Ys:Gl;this.g.set(o,p);for(var g=T(this.m),b=g.next();!b.done;b=g.next())(b=b.value).Yb==h&&b.Xb==p&&b.Qb(o,n)}}};var qu=1,Gl=2,Ys=3;function Hl(e,n,i){this.i=e,this.h=n,this.j=0,this.l=i,this.g=new Map}function Wu(e,n,i){if(i=i!==void 0&&i,e.h.segmentIndex){var o=e.h.segmentIndex.Mb(Math.max(n.startTime,e.j));if(o){var h=n;for(i&&(h=o.next().value)&&h.startTime==n.startTime&&h.endTime==n.endTime&&(h=null);e.g.size<e.i&&h!=null&&(n=!0,h.o&&h.ua!=null&&(n=!1),h.Pb()==2&&(n=!1),n&&!e.g.has(h)&&(fd(n=new Yu(e.l),h,e.h),e.g.set(h,n)),e.j=h.startTime,!(e.h.fastSwitching&&h.$c&&h.Nd));)h=o.next().value}}}function ng(e){if(e.g.size!==0){for(var n=T(e.g.keys()),i=n.next();!i.done;i=n.next())(i=i.value)&&rg(e,i);e.j=0}}function rg(e,n){var i=e.g.get(n);e.g.delete(n),i&&i.abort()}function Yu(e){this.i=e,this.g=this.h=null}function fd(e,n,i){var o=new Uint8Array(0);e.g=e.i(n,i,function(h){return W(function(p){if(p.g==1)return o=0<o.byteLength?$n(o,h):h,e.h?N(p,e.h(o),3):p.B(0);o=new Uint8Array(0),re(p)})})}function pd(e,n,i,o,h){return e=lr(e,o,h),n==0&&i==null||(e.headers.Range=i?"bytes="+n+"-"+i:"bytes="+n+"-"),e}function _y(e,n){var i=this;this.g=n,this.m=e,this.h=null,this.u=1,this.o=this.j=null,this.F=0,this.C=!1,this.i=new Map,this.A=!1,this.G=null,this.s=!1,this.l=new Ln(function(){return function(o){var h,p,g,b;return W(function(w){if(w.g==1){for(h=[],p=T(o.i.values()),g=p.next();!g.done;g=p.next())Xu(b=g.value),h.push(md(b));return N(w,Promise.all(h),2)}o.i.clear(),o.g=null,o.m=null,o.h=null,re(w)})}(i)}),this.H=Date.now()/1e3}function gd(e,n){var i=e.i.get("video");if(i){var o=i.stream;o&&(n?(n=o.trickModeVideo)&&!i.Vb&&(Qu(e,n,!1,0,!1),i.Vb=o):(o=i.Vb)&&(i.Vb=null,Qu(e,o,!0,0,!1)))}}function Fo(e,n,i,o,h,p){i=i!==void 0&&i,o=o===void 0?0:o,h=h!==void 0&&h,p=p!==void 0&&p,e.j=n,e.A&&(n.video&&Qu(e,n.video,i,o,h,p),n.audio&&Qu(e,n.audio,i,o,h,p))}function Vh(e,n){W(function(i){if(i.g==1)return e.o=n,e.A?n.segmentIndex?i.B(2):N(i,n.createSegmentIndex(),2):i.return();Qu(e,n,!0,0,!1),re(i)})}function Qu(e,n,i,o,h,p){var g=e.i.get(n.type);g||n.type!=en?g&&(g.Vb&&(n.trickModeVideo?(g.Vb=n,n=n.trickModeVideo):g.Vb=null),g.stream!=n||h)&&(g.pa&&function(b,w){w&&w!==b.h&&(ng(b),b.h=w)}(g.pa,n),n.type==en&&(h=Er(n.mimeType,n.codecs),Nh(e.g.T,h,e.m.sequenceMode,n.external)),g.stream.closeSegmentIndex&&g.stream.closeSegmentIndex(),g.stream=n,g.X=null,g.Cf=!!p,i&&(g.Nc?g.$d=!0:g.Ea?(g.Eb=!0,g.vd=o,g.$d=!0):(Xu(g),Sa(e,g,!0,o).catch(function(b){e.g&&e.g.onError(b)}))),function(b,w){var k,I;return W(function(x){if(x.g==1)return w.Na?(k=w.stream,I=w.Na,k.segmentIndex?x.B(2):N(x,k.createSegmentIndex(),2)):x.return();if(w.Na!=I||w.stream!=k)return x.return();var C=b.g.Dd(),D=_h(b.g.T,w.type),_=w.stream.segmentIndex.find(w.Ba?w.Ba.endTime:C),j=_==null?null:w.stream.segmentIndex.get(_);_=j&&j.ua?j.ua-j.Qa:null,j&&!_&&(_=(j.endTime-j.getStartTime())*(w.stream.bandwidth||0)/8),_?((j=j.h)&&(_+=(j.ua?j.ua-j.Qa:null)||0),C=8*_/(j=b.g.getBandwidthEstimate())<(D||0)-C-Math.max(b.m.minBufferTime||0,b.h.rebufferingGoal)||w.Na.h.g>_):C=!1,C&&w.Na.abort(),re(x)})}(e,g).catch(function(b){e.g&&e.g.onError(b)})):function(b,w){var k,I,x,C,D;W(function(_){switch(_.g){case 1:return k=_r,b.F++,I=b.F,ne(_,2),N(_,Uh(b.g.T,k.ia),4);case 4:ce(_,3);break;case 2:x=we(_),b.g&&b.g.onError(x);case 3:C=Er(w.mimeType,w.codecs),Nh(b.g.T,C,b.m.sequenceMode,w.external),(b.g.T.F.isTextVisible()||b.h.alwaysStreamText)&&b.F==I&&(D=as(b,w),b.i.set(k.ia,D),Yn(b,D,0)),re(_)}})}(e,n)}function so(e,n){n.Nc||n.Eb||(n.Ea?(n.Eb=!0,n.vd=0):ud(e.g.T,n.type)==null?n.ib==null&&Yn(e,n,0):(Xu(n),Sa(e,n,!1,0).catch(function(i){e.g&&e.g.onError(i)})))}function as(e,n){return{stream:n,type:n.type,X:null,pa:Fy(e,n),Ba:null,Ab:null,Re:null,Pe:null,Oe:null,Vb:null,endOfStream:!1,Ea:!1,ib:null,Eb:!1,vd:0,$d:!1,Nc:!1,dd:!0,ff:!1,Vc:!1,Na:null}}function Fy(e,n){return n.type!=="video"&&n.type!=="audio"?null:0<e.h.segmentPrefetchLimit?new Hl(e.h.segmentPrefetchLimit,n,function(i,o,h){return qh(e,i,o,h)}):null}function g1(e,n){var i,o,h,p,g;return W(function(b){switch(b.g){case 1:if(rn(e.l),n.Ea||n.ib==null||n.Nc)return b.return();if(n.ib=null,!n.Eb){b.B(2);break}return N(b,Sa(e,n,n.$d,n.vd),3);case 3:return b.return();case 2:if(n.stream.segmentIndex){b.B(4);break}return i=n.stream,N(b,n.stream.createSegmentIndex(),5);case 5:if(i!=n.stream)return i.closeSegmentIndex&&i.closeSegmentIndex(),n.Ea||n.ib||Yn(e,n,0),b.return();case 4:ne(b,6),o=function(w,k){if(Kh(k))return function(F,B){var H=_h(F,"video")||0;ph(F.h,B,H)}(w.g.T,k.stream.originalId||""),null;if(k.type==en&&function(F){F.h&&ph(F.h,"",0)}(w.g.T),!w.g.T.ga&&k.type!=en)return w.h.updateIntervalSeconds/2;var I=w.g.Dd(),x=k.Ba?k.Ba.endTime:I,C=function(F,B,H){return F.A?0:B==en?(F=F.h).h==null||F.h<H?0:F.h-Math.max(H,F.g):Fp(F=Hu(F,B),H)}(w.g.T,k.type,I),D=Math.max(1,Math.max(w.m.minBufferTime||0,w.h.rebufferingGoal,w.h.bufferingGoal)*w.u),_=w.m.presentationTimeline.getDuration()-x,j=_h(w.g.T,k.type);if(1e-6>_&&j)return k.endOfStream=!0,k.type=="video"&&(w=w.i.get(en))&&Kh(w)&&(w.endOfStream=!0),null;if(k.endOfStream=!1,C>=D)return w.h.updateIntervalSeconds/2;if(C=function(F,B,H,Y){if(B.X)return B.X.current();if(B.Ba||Y)return B.X=B.stream.segmentIndex.Mb(B.Ba?B.Ba.endTime:Y),B.X&&B.X.next().value;F=F.h.inaccurateManifestTolerance,Y=Math.max(H-F,0);var te=null;return F&&(B.X=B.stream.segmentIndex.Mb(Y),te=B.X&&B.X.next().value),te||(B.X=B.stream.segmentIndex.Mb(H),te=B.X&&B.X.next().value),te}(w,k,I,j),!C)return w.h.updateIntervalSeconds;for(D=1/0,_=T(_=Array.from(w.i.values())),j=_.next();!j.done;j=_.next())Kh(j=j.value)||j.X&&!j.X.current()||(D=Math.min(D,j.Ba?j.Ba.endTime:I));return x>=D+w.m.presentationTimeline.g?w.h.updateIntervalSeconds:(k.pa&&k.X&&(!(x=C.h)||k.Ba&&my(x,k.Ab)||function(F,B){if(F.h.segmentIndex&&F.g.size<F.i&&!F.g.has(B)){var H=new Yu(F.l);fd(H,B,F.h),F.g.set(B,H)}}(k.pa,x),Wu(k.pa,C)),function(F,B,H,Y){var te,q,X,he,ae,me,oe,ge,le,Ee,ve,Be,_e,Ye,Ve;return W(function(be){switch(be.g){case 1:if(te=_r,q=B.stream,X=B.X,B.Ea=!0,ne(be,2),Y.Pb()==2)throw new fe(1,1,1011);return N(be,function(ke,Ae,He){var De,$e,je,Ge,Fe,rt,Qe,Et,et,it,Pt,Yt,Zt;return W(function(an){switch(an.g){case 1:if(De=_r,$e=[],je=Math.max(0,He.appendWindowStart-.1),Ge=He.appendWindowEnd+.01,Fe=Hs(Ae.stream.codecs),rt=Ri(Ae.stream.mimeType),(Qe=He.timestampOffset)==Ae.Re&&je==Ae.Pe&&Ge==Ae.Oe&&Fe==Ae.Qe&&rt==Ae.Yf){an.B(2);break}if(Et=Ae.Qe&&Ae.Yf&&function(_t,Bt,tn,yt){if(Bt==en)var at=!1;else{at=Hs(Ci(_t.G[Bt]));var st=Ri(_t.G[Bt]),Ct=Er(tn,yt),$t=_t.C.forceTransmux;(!Dn(Ct)||!_t.u&&Ga.includes(Ct))&&($t=!0),tn=ko(tn,yt),$t&&($t=wo(tn))&&(Ct=($t=$t()).convertCodecs(Bt,tn),$t.destroy()),Bt=Hs(Ci(Ct)),Ct=Ri(Ct),at=at!==Bt||st!==Ct}return!!at&&(_t.C.codecSwitchingStrategy!=="smooth"||!$a()||_t.s)}(ke.g.T,Ae.type,rt,Fe),!Et){an.B(3);break}if(et=null,Ae.type===De.$?et=ke.i.get(De.P):Ae.type===De.P&&(et=ke.i.get(De.$)),!et){an.B(3);break}return N(an,md(et).catch(function(){}),5);case 5:et.Ab=null,so(ke,et);case 3:return it=function(){var _t,Bt,tn;return W(function(yt){if(yt.g==1)return _t=new Map,ke.j.audio&&_t.set(De.P,ke.j.audio),ke.j.video&&_t.set(De.$,ke.j.video),ne(yt,2),Ae.Pe=je,Ae.Oe=Ge,Ae.Qe=Fe,Ae.Yf=rt,Ae.Re=Qe,Bt=ke.m.sequenceMode||ke.m.type=="HLS",N(yt,h1(ke.g.T,Ae.type,Qe,je,Ge,Bt,He.mimeType||Ae.stream.mimeType,He.codecs||Ae.stream.codecs,_t),4);if(yt.g!=2)return ce(yt,0);throw tn=we(yt),Ae.Pe=null,Ae.Oe=null,Ae.Qe=null,Ae.Re=null,tn})},N(an,it(),2);case 2:return my(He.h,Ae.Ab)||(Ae.Ab=He.h,He.m&&He.h&&(Pt=zh(ke,Ae,He.h),Yt=function(){var _t,Bt,tn,yt,at;return W(function(st){switch(st.g){case 1:return ne(st,2),N(st,Pt,4);case 4:return _t=st.h,rn(ke.l),Bt=null,tn=new Map,new _n().box("moov",cn).box("trak",cn).box("mdia",cn).O("mdhd",function(Ct){Bt=Bu(Ct.reader,Ct.version).timescale}).box("hdlr",function(Ct){(Ct=Ct.reader).skip(8),Ct=Ct.rb(4);var $t=String.fromCharCode(Ct[0]);switch($t+=String.fromCharCode(Ct[1]),$t+=String.fromCharCode(Ct[2]),$t+=String.fromCharCode(Ct[3])){case"soun":tn.set(De.P,Bt);break;case"vide":tn.set(De.$,Bt)}Bt=null}).parse(_t),tn.has(Ae.type)?He.h.timescale=tn.get(Ae.type):Bt!=null&&(He.h.timescale=Bt),yt=Ae.stream.closedCaptions&&0<Ae.stream.closedCaptions.size,N(st,ke.g.Ef(Ae.type,_t),5);case 5:return N(st,Fh(ke.g.T,Ae.type,_t,null,Ae.stream,yt),6);case 6:ce(st,0);break;case 2:throw at=we(st),Ae.Ab=null,at}})},ke.g.Fh(He.startTime,He.h),$e.push(Yt()))),ke.m.sequenceMode&&(Zt=Ae.Ba?Ae.Ba.l:null,He.l!=Zt&&$e.push(function(_t,Bt,tn){var yt;return W(function(at){return at.g==1?Bt==(yt=_r).ia?at.return():(Bt==yt.$&&(_t.ha=new Pn),Sn(_t,Bt,function(){return Vu(_t,Bt)}),_t.s&&Sn(_t,yt.P,function(){return Vu(_t,yt.P)}),N(at,Sn(_t,Bt,function(){return Ku(_t,Bt,tn)}),2)):_t.s?N(at,Sn(_t,yt.P,function(){return Ku(_t,yt.P,tn)}),0):at.B(0)})}(ke.g.T,Ae.type,He.startTime))),N(an,Promise.all($e),0)}})}(F,B,Y),4);case 4:return rn(F.l),F.s?be.return():(he=q.mimeType=="video/mp4"||q.mimeType=="audio/mp4",ae=s.ReadableStream,F.h.lowLatencyMode&&ae&&he&&(F.m.type!="HLS"||Y.s)?(oe=new Uint8Array(0),le=ge=!1,ve=function(ke){var Ae,He,De;return W(function($e){switch($e.g){case 1:if(ge||(le=!0,rn(F.l),F.s))return $e.return();if(ne($e,2),oe=function(je,Ge){var Fe=new Uint8Array(je.length+Ge.length);return Fe.set(je),Fe.set(Ge,je.length),Fe}(oe,ke),Ae=!1,He=0,new _n().box("mdat",function(je){He=je.size+je.start,Ae=!0}).parse(oe,!1,!0),!Ae){$e.B(4);break}return De=oe.subarray(0,He),oe=oe.subarray(He),N($e,ig(F,B,H,q,Y,De,!0),5);case 5:B.pa&&B.X&&Wu(B.pa,Y,!0);case 4:ce($e,0);break;case 2:Ee=we($e),re($e)}})},N(be,zh(F,B,Y,ve),9)):N(be,zh(F,B,Y),7));case 7:return me=be.h,rn(F.l),F.s?be.return():(rn(F.l),B.Eb?(B.Ea=!1,Yn(F,B,0),be.return()):N(be,ig(F,B,H,q,Y,me),6));case 9:if(Be=be.h,Ee)throw Ee;if(le){be.B(10);break}return ge=!0,rn(F.l),F.s?be.return():B.Eb?(B.Ea=!1,Yn(F,B,0),be.return()):N(be,ig(F,B,H,q,Y,Be),10);case 10:B.pa&&B.X&&Wu(B.pa,Y,!0);case 6:if(rn(F.l),F.s)return be.return();B.Ba=Y,X.next(),B.Ea=!1,B.ff=!1,_e=F.g.T.nb(),Ye=_e[B.type],JSON.stringify(Ye),B.Eb||F.g.af(Y,B.stream),Yn(F,B,0),ce(be,0);break;case 2:if(Ve=we(be),rn(F.l,Ve),F.s)return be.return();if(B.Ea=!1,Ve.code==7001)B.Ea=!1,Xu(B),Yn(F,B,0),be.B(0);else if(B.type==te.ia&&F.h.ignoreTextStreamFailures)F.i.delete(te.ia),be.B(0);else{if(Ve.code!=3017)return B.Vc=!0,Ve.severity=2,N(be,Xr(F,B,Ve),0);(function(ke,Ae,He){if(!Array.from(ke.i.values()).some(function($e){return $e!=Ae&&$e.ff})){if(0<ke.h.maxDisabledTime&&ke.g.wd(Ae.stream,ke.h.maxDisabledTime))return;var De=Math.round(100*ke.u);if(20<De)ke.u-=.2;else{if(!(4<De))return Ae.Vc=!0,ke.s=!0,void ke.g.onError(He);ke.u-=.04}Ae.ff=!0}Yn(ke,Ae,4)})(F,B,Ve),be.B(0)}}})}(w,k,I,C).catch(function(){}),null)}(e,n),o!=null&&(Yn(e,n,o),n.Vc=!1),ce(b,7);break;case 6:return h=we(b),N(b,Xr(e,n,h),8);case 8:return b.return();case 7:if(p=Array.from(e.i.values()),!e.A||!p.every(function(w){return w.endOfStream})){b.B(0);break}return N(b,e.g.T.endOfStream(),10);case 10:rn(e.l),(g=e.g.T.getDuration())!=0&&g<e.m.presentationTimeline.getDuration()&&e.m.presentationTimeline.Pa(g),re(b)}})}function ig(e,n,i,o,h,p,g){var b,w,k,I,x,C;return g=g!==void 0&&g,W(function(D){switch(D.g){case 1:return b=o.closedCaptions&&0<o.closedCaptions.size,k=o.emsgSchemeIdUris!=null&&0<o.emsgSchemeIdUris.length||e.h.dispatchAllEmsgBoxes,I=e.h.parsePrftBox&&!e.C,(k||I)&&(w=new _n),k&&w.O("emsg",function(_){var j=o.emsgSchemeIdUris;if(_.version===0)var F=_.reader.bd(),B=_.reader.bd(),H=_.reader.M(),Y=_.reader.M(),te=_.reader.M(),q=_.reader.M(),X=h.startTime+Y/H;else H=_.reader.M(),Y=(X=_.reader.oc()/H+h.timestampOffset)-h.startTime,te=_.reader.M(),q=_.reader.M(),F=_.reader.bd(),B=_.reader.bd();_=_.reader.rb(_.reader.getLength()-_.reader.oa()),(j&&j.includes(F)||e.h.dispatchAllEmsgBoxes)&&(F=="urn:mpeg:dash:event:2012"?e.g.Gh():((j=new dt("emsg",j=new Map().set("detail",{startTime:X,endTime:X+te/H,schemeIdUri:F,value:B,timescale:H,presentationTimeDelta:Y,eventDuration:te,id:q,messageData:_}))).cancelable=!0,e.g.onEvent(j),j.defaultPrevented||F!="https://aomedia.org/emsg/ID3"&&F!="https://developer.apple.com/streaming/emsg-id3"||(F=_l(_)).length&&h&&e.g.Hh([{cueTime:h.startTime,data:_,frames:F,dts:h.startTime,pts:h.startTime}],0,h.endTime)))}),I&&w.O("prft",function(_){if(!e.C&&h.h.timescale){var j=_.reader,F=_.version;j.M(),_=1e3*(_=j.M())+j.M()/Math.pow(2,32)*1e3,F===0?j=j.M():(F=j.M(),j=j.M(),j=F*Math.pow(2,32)+j),_=new Date(new Date(Date.UTC(1900,0,1,0,0,0)).getTime()+_).getTime(),j=new dt("prft",j=new Map().set("detail",{wallClockTime:_,programStartDate:new Date(_-j/h.h.timescale*1e3)})),e.g.onEvent(j),e.C=!0}}),(k||I)&&w.parse(p),N(D,function(_,j,F){var B,H,Y;return W(function(te){if(te.g==1)return B=Math.max(_.h.bufferBehind,_.m.presentationTimeline.g),(H=ud(_.g.T,j.type))==null||1>=(Y=F-H-B)?te.return():N(te,_.g.T.remove(j.type,H,H+Y),2);rn(_.l),re(te)})}(e,n,i),2);case 2:return rn(e.l),x=n.dd,n.dd=!1,C=n.Cf,n.Cf=!1,N(D,e.g.Ef(n.type,p),3);case 3:return N(D,Fh(e.g.T,n.type,p,h,o,b,x,C,g),4);case 4:rn(e.l),re(D)}})}function Kh(e){return e&&e.type==en&&(e.stream.mimeType=="application/cea-608"||e.stream.mimeType=="application/cea-708")}function zh(e,n,i,o){var h,p,g,b,w;return W(function(k){switch(k.g){case 1:if(i instanceof is&&(h=i.g))return k.return(h);if(p=null,n.pa){var I=n.pa;if(I.g.has(i)){var x=I.g.get(i);o&&(x.h=o),I.g.delete(i),p=x.g}else p=null}return p||(p=qh(e,i,n.stream,o)),g=0,n.X&&(g=n.X.g),n.Na=p,N(k,p.promise,2);case 2:if(b=k.h,n.Na=null,w=b.data,!i.aes128Key){k.B(3);break}return N(k,function(C,D,_){var j,F,B,H;return W(function(Y){if(Y.g==1)return(j=D).cryptoKey?Y.B(2):N(Y,j.fetchKey(),3);if(!(F=j.iv))for(F=Nt(new ArrayBuffer(16)),B=j.firstMediaSequenceNumber+_,H=F.byteLength-1;0<=H;H--)F[H]=255&B,B>>=8;return Y.return(s.crypto.subtle.decrypt({name:"AES-CBC",iv:F},j.cryptoKey,C))})}(w,i.aes128Key,g),4);case 4:w=k.h;case 3:return k.return(w)}})}function qh(e,n,i,o){var h=n instanceof wt?n:void 0,p=h?1:0;return n=pd(n.Z(),n.Qa,n.ua,e.h.retryParameters,o),e.g.Tb.request(Ks,n,{type:p,stream:i,segment:h})}function Sa(e,n,i,o){var h,p;return W(function(g){return g.g==1?(n.Eb=!1,n.$d=!1,n.vd=0,n.Nc=!0,n.Ba=null,n.Ab=null,n.X=null,n.pa&&ng(n.pa),o?(h=e.g.Dd(),p=e.g.T.getDuration(),N(g,e.g.T.remove(n.type,h+o,p),3)):N(g,Uh(e.g.T,n.type),4)):g.g!=3?(rn(e.l),i?N(g,e.g.T.flush(n.type),3):g.B(3)):(rn(e.l),n.Nc=!1,n.endOfStream=!1,n.Ea||n.ib||Yn(e,n,0),void re(g))})}function Yn(e,n,i){var o=n.type;(o!=en||e.i.has(o))&&(n.ib=new mh(function(){var h;return W(function(p){return p.g==1?(ne(p,2),N(p,g1(e,n),4)):p.g!=2?ce(p,0):(h=we(p),e.g&&e.g.onError(h),void re(p))})}).U(i))}function Xu(e){e.ib!=null&&(e.ib.stop(),e.ib=null)}function md(e){return W(function(n){return e.Na?N(n,e.Na.abort(),0):n.B(0)})}function Xr(e,n,i){var o;return W(function(h){if(h.g==1)return N(h,kh(e.G),2);rn(e.l),o=e.h.maxDisabledTime===0&&i.code==1011?1:e.h.maxDisabledTime,i.category===1&&0<o&&(i.handled=e.g.wd(n.stream,o),i.handled&&(i.severity=1)),e.g.onError(i),i.handled||e.h.failureCallback(i),re(h)})}function sg(e,n,i){var o,h,p,g,b,w,k;return W(function(I){switch(I.g){case 1:var x=new mr(e).Da.split("/").pop().split(".");return o=x.length==1?"":x.pop().toLowerCase(),(h=m1[o])?I.return(h):(p=0,g=lr([e],i),ne(I,2),g.method="HEAD",N(I,n.request(p,g).promise,4));case 4:b=I.h,h=b.headers["content-type"],ce(I,3);break;case 2:if(!(w=we(I))||w.code!=1002&&w.code!=1001){I.B(3);break}return g.method="GET",N(I,n.request(p,g).promise,6);case 6:k=I.h,h=k.headers["content-type"];case 3:return I.return(h?h.toLowerCase().split(";").shift():"")}})}Yu.prototype.abort=function(){this.g&&this.g.abort()},(c=_y.prototype).destroy=function(){return this.l.destroy()},c.configure=function(e){this.h=e,this.G=new wp({maxAttempts:Math.max(e.retryParameters.maxAttempts,2),baseDelay:e.retryParameters.baseDelay,backoffFactor:e.retryParameters.backoffFactor,fuzzFactor:e.retryParameters.fuzzFactor},!0);for(var n=T(this.i.keys()),i=n.next();!i.done;i=n.next())if((i=this.i.get(i.value)).pa){var o=i.pa,h=e.segmentPrefetchLimit;o.i=h;for(var p=Array.from(o.g.keys());p.length>h;){var g=p.pop();g&&rg(o,g)}0<e.segmentPrefetchLimit||(i.pa=null)}else 0<e.segmentPrefetchLimit&&(i.pa=Fy(this,i.stream))},c.start=function(){var e=this;return W(function(n){if(n.g==1)return N(n,function(i){var o,h,p,g,b,w,k,I;return W(function(x){if(x.g==1){if(o=_r,!i.j)throw new fe(2,5,5006);return h=new Map,p=new Set,i.j.audio&&(h.set(o.P,i.j.audio),p.add(i.j.audio)),i.j.video&&(h.set(o.$,i.j.video),p.add(i.j.video)),i.o&&(h.set(o.ia,i.o),p.add(i.o)),N(x,i.g.T.init(h,i.m.sequenceMode,i.m.type,i.m.ignoreManifestTimestampsInSegmentsMode),2)}for(rn(i.l),i.updateDuration(),g=T(h.keys()),b=g.next();!b.done;b=g.next())w=b.value,k=h.get(w),i.i.has(w)||(I=as(i,k),i.i.set(w,I),Yn(i,I,0));re(x)})}(e),2);rn(e.l),e.A=!0,re(n)})},c.dd=function(){if(this.g)for(var e=this.g.Dd(),n=T(this.i.keys()),i=n.next();!i.done;i=n.next()){var o=i.value,h=null;(i=this.i.get(o)).X&&(h=i.X.current()),(!h||h.startTime>e||h.endTime<e)&&(i.X=null),(h=!(h=this.g.T).A&&(o==en?(h=h.h).g!=null&&h.h!=null&&e>=h.g&&e<h.h:_p(h=Hu(h,o),e)))||((_h(this.g.T,o)!=null||i.Ea)&&so(this,i),i.Na&&(i.Na.abort(),i.Na=null),o===en&&(o=this.g.T).H&&o.H.g(),i.dd=!0)}},c.updateDuration=function(){var e=this.m.presentationTimeline.getDuration();1/0>e?this.g.T.Pa(e):this.g.T.Pa(Math.pow(2,32))};var m1={mp4:"video/mp4",m4v:"video/mp4",m4a:"audio/mp4",webm:"video/webm",weba:"audio/webm",mkv:"video/webm",ts:"video/mp2t",ogv:"video/ogg",ogg:"audio/ogg",mpg:"video/mpeg",mpeg:"video/mpeg",m3u8:"application/x-mpegurl",mpd:"application/dash+xml",ism:"application/vnd.ms-sstr+xml",mp3:"audio/mpeg",aac:"audio/aac",flac:"audio/flac",wav:"audio/wav",sbv:"text/x-subviewer",srt:"text/srt",vtt:"text/vtt",webvtt:"text/vtt",ttml:"application/ttml+xml",lrc:"application/x-subtitle-lrc",ssa:"text/x-ssa",ass:"text/x-ssa"};function Uy(e,n){if(e.lineBreak)return`
`;if(e.nestedCues.length)return e.nestedCues.map(function(g){return Uy(g,e)}).join("");var i=[],o=700<=e.fontWeight,h=e.fontStyle=="italic",p=e.textDecoration.includes("underline");return o&&i.push(["b"]),h&&i.push(["i"]),p&&i.push(["u"]),(h=e.color)==""&&n&&(h=n.color),o="",(h=Jr(h))&&(o+="."+h),(h=e.backgroundColor)==""&&n&&(h=n.backgroundColor),(n=Jr(h))&&(o+=".bg_"+n),o&&i.push(["c",o]),i.reduceRight(function(g,b){var w=T(b);return"<"+(b=w.next().value)+((w=w.next().value)===void 0?"":w)+">"+g+"</"+b+">"},e.payload)}function Jr(e){var n=(e=e.toLowerCase()).replace(/\s/g,"").match(/^rgba?\((\d+),(\d+),(\d+),?([^,\s)]+)?/i);switch(n?e="#"+(256|parseInt(n[1],10)).toString(16).slice(1)+(256|parseInt(n[2],10)).toString(16).slice(1)+(256|parseInt(n[3],10)).toString(16).slice(1):e.startsWith("#")&&7<e.length&&(e=e.slice(0,7)),e){case"white":case"#fff":case"#ffffff":return"white";case"lime":case"#0f0":case"#00ff00":return"lime";case"cyan":case"#0ff":case"#00ffff":return"cyan";case"red":case"#f00":case"#ff0000":return"red";case"yellow":case"#ff0":case"#ffff00":return"yellow";case"magenta":case"#f0f":case"#ff00ff":return"magenta";case"blue":case"#00f":case"#0000ff":return"blue";case"black":case"#000":case"#000000":return"black"}return null}function os(e,n){for(var i=[],o=(e=T(e)).next();!o.done;o=e.next())if((o=o.value).isContainer)i.push.apply(i,M(os(o.nestedCues,o)));else{var h=o.clone();h.nestedCues=[],h.payload=Uy(o,n),i.push(h)}return i}function $r(e,n){this.g=null;for(var i=T(Array.from(e.textTracks)),o=i.next();!o.done;o=i.next())(o=o.value).mode="disabled",o.label==n&&(this.g=o);this.g||(this.g=e.addTextTrack("subtitles",n)),this.g.mode="hidden"}function y1(e){if(e.startTime>=e.endTime)return null;var n=new VTTCue(e.startTime,e.endTime,e.payload);n.lineAlign=e.lineAlign,n.positionAlign=e.positionAlign,e.size&&(n.size=e.size);try{n.align=e.textAlign}catch{}return e.textAlign=="center"&&n.align!="center"&&(n.align="middle"),e.writingMode=="vertical-lr"?n.vertical="lr":e.writingMode=="vertical-rl"&&(n.vertical="rl"),e.lineInterpretation==1&&(n.snapToLines=!1),e.line!=null&&(n.line=e.line),e.position!=null&&(n.position=e.position),n}function By(e,n){var i=e.mode;e.mode=i=="showing"?"showing":"hidden";for(var o=T(Array.from(e.cues)),h=o.next();!h.done;h=o.next())(h=h.value)&&n(h)&&e.removeCue(h);e.mode=i}function Bi(){}function xs(){}function $i(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function ls(e,n){var i=this;this.m=!1,this.i=[],this.u=e,this.s=n,this.l=null,this.g=document.createElement("div"),this.g.classList.add("shaka-text-container"),this.g.style.textAlign="center",this.g.style.display="flex",this.g.style.flexDirection="column",this.g.style.alignItems="center",this.g.style.justifyContent="flex-end",this.s.appendChild(this.g),this.C=new Qt(function(){i.u.paused||Is(i)}).Ra(.25),this.h=new Map,this.j=new mn,this.j.D(document,"fullscreenchange",function(){Is(i,!0)}),this.j.D(this.u,"seeking",function(){Is(i,!0)}),this.j.D(this.u,"resize",function(){var o=i.u,h=o.videoWidth;o=o.videoHeight,i.l=h&&o?h/o:null}),this.o=null,"ResizeObserver"in s&&(this.o=new ResizeObserver(function(){Is(i,!0)}),this.o.observe(this.g)),this.A=new Map}function Qs(e,n){for(;n!=null;){if(n==e.g)return!0;n=n.parentElement}return!1}function $y(e,n,i,o,h){for(var p=!1,g=[],b=[],w=(n=T(n)).next();!w.done;w=n.next()){w=w.value,h.push(w);var k=e.h.get(w),I=w.startTime<=o&&w.endTime>o,x=k?k.xg:null;k&&(g.push(k.qe),k.Ub&&g.push(k.Ub),I||(p=!0,e.h.delete(w),k=null)),I&&(b.push(w),k?Qs(e,x)||(p=!0):(yd(e,w,h),x=(k=e.h.get(w)).xg,p=!0)),0<w.nestedCues.length&&x&&$y(e,w.nestedCues,x,o,h),h.pop()}if(p){for(h=(o=T(g)).next();!h.done;h=o.next())(h=h.value).parentElement&&h.parentElement.removeChild(h);for(b.sort(function(C,D){return C.startTime!=D.startTime?C.startTime-D.startTime:C.endTime-D.endTime}),w=(b=T(b)).next();!w.done;w=b.next())(o=e.h.get(w.value)).Ub?(o.Ub.contains(i)&&o.Ub.removeChild(i),i.appendChild(o.Ub),o.Ub.appendChild(o.qe)):i.appendChild(o.qe)}}function Is(e,n){if(e.g){var i=e.u.currentTime;if(!e.m||n!==void 0&&n){for(var o=(n=T(e.A.values())).next();!o.done;o=n.next())$i(o.value);$i(e.g),e.h.clear(),e.A.clear()}if(e.m){n=new Map;for(var h=(o=T(e.h.keys())).next();!h.done;h=o.next())h=h.value,n.set(h,e.h.get(h));$y(e,e.i,e.g,i,[])}}}function yd(e,n,i){var o=1<i.length,h=o?"span":"div";n.lineBreak&&(h="br"),n.rubyTag&&(h=n.rubyTag),o=!o&&0<n.nestedCues.length;var p=document.createElement(h);if(h!="br"&&function(x,C,D,_,j){var F=C.style,B=D.nestedCues.length==0,H=1<_.length;F.whiteSpace="pre-wrap";var Y=D.payload.replace(/\s+$/g,function(q){return" ".repeat(q.length)});if(F.webkitTextStrokeColor=D.textStrokeColor,F.webkitTextStrokeWidth=D.textStrokeWidth,F.color=D.color,F.direction=D.direction,F.opacity=D.opacity,F.paddingLeft=Uo(D.linePadding,D,x.s),F.paddingRight=Uo(D.linePadding,D,x.s),F.textCombineUpright=D.textCombineUpright,F.textShadow=D.textShadow,D.backgroundImage)F.backgroundImage="url('"+D.backgroundImage+"')",F.backgroundRepeat="no-repeat",F.backgroundSize="contain",F.backgroundPosition="center",F.width="100%",F.height="100%";else{if(D.nestedCues.length)var te=C;else te=document.createElement("span"),C.appendChild(te);D.border&&(te.style.border=D.border),!j&&((C=ag(_,function(q){return q.backgroundColor}))?te.style.backgroundColor=C:Y&&(te.style.backgroundColor="rgba(0, 0, 0, 0.8)"),C=ag(_,function(q){return q.fontFamily}))&&(te.style.fontFamily=C),Y&&(te.textContent=Y)}H&&!_[_.length-1].isContainer?F.display="inline":(F.display="flex",F.flexDirection="column",F.alignItems="center",F.justifyContent=D.displayAlign=="before"?"flex-start":D.displayAlign=="center"?"center":"flex-end"),B||(F.margin="0"),F.fontFamily=D.fontFamily,F.fontWeight=D.fontWeight.toString(),F.fontStyle=D.fontStyle,F.letterSpacing=D.letterSpacing,F.fontSize=Uo(D.fontSize,D,x.s),(_=D.line)!=null&&((B=D.lineInterpretation)==mi&&(B=1,H=16,x.l&&1>x.l&&(H=32),_=0>_?100+_/H*100:_/H*100),B==1&&(F.position="absolute",D.writingMode==Hr?(F.width="100%",D.lineAlign==Gs?F.top=_+"%":D.lineAlign=="end"&&(F.bottom=100-_+"%")):D.writingMode=="vertical-lr"?(F.height="100%",D.lineAlign==Gs?F.left=_+"%":D.lineAlign=="end"&&(F.right=100-_+"%")):(F.height="100%",D.lineAlign==Gs?F.right=_+"%":D.lineAlign=="end"&&(F.left=100-_+"%")))),F.lineHeight=D.lineHeight,D.position!=null&&(D.writingMode==Hr?F.paddingLeft=D.position:F.paddingTop=D.position),x=function(q){var X=q.direction,he=q.positionAlign;return q=q.textAlign,he!==Tl?he:q==="left"||q==="start"&&X===js||q==="end"&&X==="rtl"?"line-left":q==="right"||q==="start"&&X==="rtl"||q==="end"&&X===js?"line-right":"center"}(D),x=="line-left"?F.cssFloat="left":x=="line-right"&&(F.cssFloat="right"),F.textAlign=D.textAlign,F.textDecoration=D.textDecoration.join(" "),F.writingMode=D.writingMode,"writingMode"in document.documentElement.style&&F.writingMode==D.writingMode||(F.webkitWritingMode=D.writingMode),D.size&&(D.writingMode==Hr?F.width=D.size+"%":F.height=D.size+"%")}(e,p,n,i,o),i=null,n.region&&n.region.id){i=n.region,h=e.l===4/3?2.5:1.9;var g=i.id+"_"+i.width+"x"+i.height+(i.heightUnits==ii?"%":"px")+"-"+i.viewportAnchorX+"x"+i.viewportAnchorY+(i.viewportAnchorUnits==ii?"%":"px");if(e.A.has(g))i=e.A.get(g);else{var b=document.createElement("span"),w=i.heightUnits==ii?"%":"px",k=i.widthUnits==ii?"%":"px",I=i.viewportAnchorUnits==ii?"%":"px";b.id="shaka-text-region---"+g,b.classList.add("shaka-text-region"),b.style.position="absolute",i.heightUnits===2&&i.widthUnits===2?(b.style.height=5.33*i.height+"%",b.style.width=i.width*h+"%"):(b.style.height=i.height+w,b.style.width=i.width+k),i.viewportAnchorUnits===2?(w=i.viewportAnchorY/75*100,k=i.viewportAnchorX/(e.l===4/3?160:210)*100,w-=i.regionAnchorY*i.height*5.33/100,k-=i.regionAnchorX*i.width*h/100,b.style.top=w+"%",b.style.left=k+"%"):(b.style.top=i.viewportAnchorY-i.regionAnchorY*i.height/100+I,b.style.left=i.viewportAnchorX-i.regionAnchorX*i.width/100+I),b.style.display="flex",b.style.flexDirection="column",b.style.alignItems="center",b.style.justifyContent=n.displayAlign=="before"?"flex-start":n.displayAlign=="center"?"center":"flex-end",e.A.set(g,b),i=b}}h=p,o&&((h=document.createElement("span")).classList.add("shaka-text-wrapper"),h.style.backgroundColor=n.backgroundColor,h.style.lineHeight="normal",p.appendChild(h)),e.h.set(n,{qe:p,xg:h,Ub:i})}function Uo(e,n,i){var o=(o=new RegExp(/(\d*\.?\d+)([a-z]+|%+)/).exec(e))?{value:Number(o[1]),unit:o[2]}:null;if(!o)return e;var h=o.value;switch(o.unit){case"%":return h/100*i.clientHeight/n.cellResolution.rows+"px";case"c":return i.clientHeight*h/n.cellResolution.rows+"px";default:return e}}function ag(e,n){for(var i=e.length-1;0<=i;i--){var o=n(e[i]);if(o||o===0)return o}return null}function og(e,n){this.h=e,this.g=n,this.m=void 0,this.i=!1,this.l=!0,this.j=!1}function ao(e){return e.g.sessionId||(e.g.sessionId=s.crypto.randomUUID()),{v:1,sf:e.m,sid:e.g.sessionId,cid:e.g.contentId,mtp:e.h.getBandwidthEstimate()/1e3}}function Ju(e,n,i){i=i===void 0?{}:i;var o=o===void 0?e.g.useHeaders:o;if(e.g.enabled){Object.assign(i,ao(e)),i.pr=e.h.Cd();var h=i.ot===Wh||i.ot===Yh;if(e.j&&h&&(i.bs=!0,i.su=!0,e.j=!1),i.su==null&&(i.su=e.l),o)e=function(g){for(var b=Object.keys(g),w={},k=["Object","Request","Session","Status"],I=[{},{},{},{}],x={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},C=(b=T(b)).next();!C.done;C=b.next())C=C.value,I[x[C]!=null?x[C]:1][C]=g[C];for(g=0;g<I.length;g++)(x=Bo(I[g]))&&(w["CMCD-"+k[g]]=x);return w}(i),Object.keys(e).length&&Object.assign(n.headers,e);else{var p=Bo(i);p&&(n.uris=n.uris.map(function(g){return Zu(g,p)}))}}}function Bo(e){function n(x){return 100*i(x/100)}function i(x){return Math.round(x)}for(var o,h=[],p={br:i,d:i,bl:n,dl:n,mtp:n,nor:function(x){return encodeURIComponent(x)},rtp:n,tb:i},g=Object.keys(e||{}).sort(),b=(g=T(g)).next();!b.done;b=g.next()){var w=e[b=b.value];if(o=w,!(Number.isNaN(o)||o==null||o===""||o===!1||b==="v"&&w===1||b=="pr"&&w===1)){var k,I=p[b];I&&(w=I(w)),k=(I=typeof w)=="string"&&b!=="ot"&&b!=="sf"&&b!=="st"?b+"="+JSON.stringify(w):I==="boolean"?b:I==="symbol"?b+"="+w.description:b+"="+w,h.push(k)}}return h.join(",")}function Zu(e,n){return!n||e.includes("offline:")?e:((e=new mr(e)).g.set("CMCD",n),e.toString())}(c=$r.prototype).remove=function(e,n){return!!this.g&&(By(this.g,function(i){return i.startTime<n&&i.endTime>e}),!0)},c.append=function(e){var n=os(e),i=[];e=this.g.cues?Array.from(this.g.cues):[];for(var o={},h=(n=T(n)).next();!h.done;o={Zb:o.Zb},h=n.next())o.Zb=h.value,e.some(function(p){return function(g){return g.startTime==p.Zb.startTime&&g.endTime==p.Zb.endTime&&g.text==p.Zb.payload}}(o))||(h=y1(o.Zb))&&i.push(h);for(o=(e=T(e=i.slice().sort(function(p,g){return p.startTime!=g.startTime?p.startTime-g.startTime:p.endTime!=g.endTime?p.endTime-g.startTime:"line"in VTTCue.prototype?i.indexOf(g)-i.indexOf(p):i.indexOf(p)-i.indexOf(g)}))).next();!o.done;o=e.next())this.g.addCue(o.value)},c.destroy=function(){return this.g&&(By(this.g,function(){return!0}),this.g.mode="disabled"),this.g=null,Promise.resolve()},c.isTextVisible=function(){return this.g.mode=="showing"},c.setTextVisibility=function(e){this.g.mode=e?"showing":"hidden"},We("shaka.text.SimpleTextDisplayer",$r),$r.prototype.setTextVisibility=$r.prototype.setTextVisibility,$r.prototype.isTextVisible=$r.prototype.isTextVisible,$r.prototype.destroy=$r.prototype.destroy,$r.prototype.append=$r.prototype.append,$r.prototype.remove=$r.prototype.remove,(c=Bi.prototype).remove=function(){},c.append=function(){},c.destroy=function(){},c.isTextVisible=function(){return!1},c.setTextVisibility=function(){},We("shaka.text.StubTextDisplayer",Bi),Bi.prototype.setTextVisibility=Bi.prototype.setTextVisibility,Bi.prototype.isTextVisible=Bi.prototype.isTextVisible,Bi.prototype.destroy=Bi.prototype.destroy,Bi.prototype.append=Bi.prototype.append,Bi.prototype.remove=Bi.prototype.remove,We("shaka.util.Dom",xs),xs.removeAllChildren=$i,(c=ls.prototype).append=function(e){for(var n=[].concat(M(this.i)),i={},o=(e=T(e)).next();!o.done;i={jd:i.jd},o=e.next())i.jd=o.value,n.some(function(h){return function(p){return ch(p,h.jd)}}(i))||this.i.push(i.jd);Is(this)},c.destroy=function(){return this.g&&(this.s.removeChild(this.g),this.g=null,this.m=!1,this.i=[],this.C&&this.C.stop(),this.h.clear(),this.j&&(this.j.release(),this.j=null),this.o&&(this.o.disconnect(),this.o=null)),Promise.resolve()},c.remove=function(e,n){if(!this.g)return!1;var i=this.i.length;return this.i=this.i.filter(function(o){return o.startTime<e||o.endTime>=n}),Is(this,i>this.i.length),!0},c.isTextVisible=function(){return this.m},c.setTextVisibility=function(e){this.m=e},We("shaka.text.UITextDisplayer",ls),ls.prototype.setTextVisibility=ls.prototype.setTextVisibility,ls.prototype.isTextVisible=ls.prototype.isTextVisible,ls.prototype.remove=ls.prototype.remove,ls.prototype.destroy=ls.prototype.destroy,ls.prototype.append=ls.prototype.append,We("shaka.text.WebVttGenerator",function(){}),og.prototype.configure=function(e){this.g=e};var vd="m",Vl="a",Wh="v",Yh="av",jy="i",lg="c",bd="tt";function us(e){this.h=e,this.g=null}function v1(e){return!e||e.toLowerCase()!=="false"&&(/^[-0-9]/.test(e)?parseInt(e,10):e.replace(/["]+/g,""))}We("shaka.util.CmcdManager.StreamingFormat",{DASH:"d",HLS:"h",zg:"s",OTHER:"o"}),(c=us.prototype).configure=function(e){this.h=e},c.Rf=function(){return this.h.enabled&&this.h.applyMaximumSuggestedBitrate&&this.g&&this.g.has(ug)?1e3*this.g.get(ug):null},c.Qf=function(){return this.h.enabled&&this.g&&this.g.has(Ls)?1e3*this.g.get(Ls):null},c.gh=function(){return this.h.enabled&&this.g&&this.g.has($o)?this.g.get($o):null},c.hh=function(){return this.h.enabled&&this.g&&this.g.has(Gy)?this.g.get(Gy):null},c.getBandwidthEstimate=function(e){var n=this.Qf();if(!n)return e;var i=this.h.estimatedThroughputWeightRatio;return 0<i&&1>=i?e*(1-i)+n*i:e},We("shaka.util.CmsdManager",us),us.prototype.getBandwidthEstimate=us.prototype.getBandwidthEstimate,us.prototype.getRoundTripTime=us.prototype.hh,us.prototype.getResponseDelay=us.prototype.gh,us.prototype.getEstimatedThroughput=us.prototype.Qf,us.prototype.getMaxBitrate=us.prototype.Rf;var Ls="etp",ug="mb",$o="rd",Gy="rtt";function Ed(){}function jo(e,n,i,o,h){var p,g=h in o,b=!0;for(p in n){var w=h+"."+p,k=g?o[h]:i[p];g||p in i?n[p]===void 0?k===void 0||g?delete e[p]:e[p]=Ll(k):k.constructor==Object&&n[p]&&n[p].constructor==Object?(e[p]||(e[p]=Ll(k)),w=jo(e[p],n[p],k,o,w),b=b&&w):typeof n[p]!=typeof k||n[p]==null||typeof n[p]!="function"&&n[p].constructor!=k.constructor?(Kn("Invalid config, wrong type for "+w),b=!1):(typeof i[p]=="function"&&i[p].length!=n[p].length&&Rt("Unexpected number of arguments for "+w),e[p]=n[p]):(Kn("Invalid config, unrecognized key "+w),b=!1)}return b}function cg(e,n){for(var i={},o=i,h=0,p=0;!(0>(h=e.indexOf(".",h)));)h!=0&&e[h-1]=="\\"||(o[p=e.substring(p,h).replace(/\\\./g,".")]={},o=o[p],p=h+1),h+=1;return o[e.substring(p).replace(/\\\./g,".")]=n,i}function Td(e,n){return e&&n}function dg(){this.g=null,this.h=[]}function wa(e,n){return W(function(i){if(i.g==1)return e.g?N(i,new Promise(function(o){return e.h.push(o)}),2):i.B(2);e.g=n,re(i)})}function cs(){}function Qh(e){return new mr(e=qs(e)).mb}function Go(e,n,i){function o(b){Nr(p).setUint32(g,b.byteLength,!0),g+=4,p.set(Nt(b),g),g+=b.byteLength}if(!i||!i.byteLength)throw new fe(2,6,6015);var h;h=typeof n=="string"?xp(n,!0):n,e=xp(e=qs(e),!0);var p=new Uint8Array(12+e.byteLength+h.byteLength+i.byteLength),g=0;return o(e),o(h),o(i),p}function Dr(e,n,i){return n!=="skd"?e:(n=i.serverCertificate,Go(e,i=qs(e).split("skd://").pop(),n))}function Hy(e,n){e===2&&(n.headers["Content-Type"]="application/octet-stream")}function Vy(){}function ec(){var e=1/0;navigator.connection&&navigator.connection.saveData&&(e=360);var n={retryParameters:{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:3e4,stallTimeout:5e3,connectionTimeout:1e4},servers:{},clearKeys:{},advanced:{},delayLicenseRequestUntilPlayed:!1,persistentSessionOnlinePlayback:!1,persistentSessionsMetadata:[],initDataTransform:function(b,w,k){return s.shakaMediaKeysPolyfill&&w=="skd"&&(w=k.serverCertificate,b=Go(b,k=Qh(b),w)),b},logLicenseExchange:!1,updateExpirationTime:1,preferredKeySystems:[],keySystemsMapping:{},parseInbandPsshEnabled:qc(),minHdcpVersion:"",ignoreDuplicateInitData:!vp()},i="reload",o=!1;vp()||yh()||Nn("Tizen 4")||Nn("Tizen 5")||Nn("Tizen 6")||Wc()||Su()&&qm()===53||Su()&&qm()===68||!(!Zi()||Zi()&&Nn("Android")||Zi()&&Nn("Fuchsia"))||(navigator.userAgentData&&navigator.userAgentData.platform?navigator.userAgentData.platform.toLowerCase()=="windows":navigator.platform&&navigator.platform.toLowerCase().includes("windows"))&&zm()||(i="smooth",o=!0),o={retryParameters:{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:3e4,stallTimeout:5e3,connectionTimeout:1e4},availabilityWindowOverride:NaN,disableAudio:!1,disableVideo:!1,disableText:!1,disableThumbnails:!1,defaultPresentationDelay:0,segmentRelativeVttTiming:!1,raiseFatalErrorOnManifestUpdateRequestFailure:!1,dash:{clockSyncUri:"",ignoreDrmInfo:!1,disableXlinkProcessing:!1,xlinkFailGracefully:!1,ignoreMinBufferTime:!1,autoCorrectDrift:!0,initialSegmentLimit:1e3,ignoreSuggestedPresentationDelay:!1,ignoreEmptyAdaptationSet:!1,ignoreMaxSegmentDuration:!1,keySystemsByURI:{"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:e2719d58-a985-b3c9-781a-b030af78d30e":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:79f0049a-4098-8642-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime"},manifestPreprocessor:function(b){return Td([b],b)},sequenceMode:!1,enableAudioGroups:!1,multiTypeVariantsAllowed:o},hls:{ignoreTextStreamFailures:!1,ignoreImageStreamFailures:!1,defaultAudioCodec:"mp4a.40.2",defaultVideoCodec:"avc1.42E01E",ignoreManifestProgramDateTime:!1,mediaPlaylistFullMimeType:'video/mp2t; codecs="avc1.42E01E, mp4a.40.2"',useSafariBehaviorForLive:!0,liveSegmentsDelay:3,sequenceMode:!(yh()||vp()||Wc()||wu()),ignoreManifestTimestampsInSegmentsMode:!1,disableCodecGuessing:!1,allowLowLatencyByteRangeOptimization:!0},mss:{manifestPreprocessor:function(b){return Td([b],b)},sequenceMode:!1,keySystemsBySystemId:{"9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","79f0049a-4098-8642-ab92-e65be0885f95":"com.microsoft.playready"}}};var h={retryParameters:{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:3e4,stallTimeout:5e3,connectionTimeout:1e4},failureCallback:function(b){return Td([b])},rebufferingGoal:2,bufferingGoal:10,bufferBehind:30,ignoreTextStreamFailures:!1,alwaysStreamText:!1,startAtSegmentBoundary:!1,gapDetectionThreshold:.5,gapJumpTimerTime:.25,durationBackoff:1,safeSeekOffset:5,stallEnabled:!0,stallThreshold:1,stallSkip:.1,useNativeHlsOnSafari:!0,inaccurateManifestTolerance:2,lowLatencyMode:!1,autoLowLatencyMode:!1,forceHTTPS:!1,preferNativeHls:!1,updateIntervalSeconds:1,dispatchAllEmsgBoxes:!1,observeQualityChanges:!1,maxDisabledTime:30,parsePrftBox:!1,segmentPrefetchLimit:0,liveSync:!1,liveSyncMaxLatency:1,liveSyncPlaybackRate:1.1,liveSyncMinLatency:0,liveSyncMinPlaybackRate:1,allowMediaSourceRecoveries:!0,minTimeBetweenRecoveries:5};(Su()||Tu()||Zi()||Nn("Hisense")||Nn("VIDAA"))&&(h.stallSkip=0);var p={trackSelectionCallback:function(b){return W(function(w){return w.return(b)})},downloadSizeCallback:function(b){var w;return W(function(k){return k.g==1?navigator.storage&&navigator.storage.estimate?N(k,navigator.storage.estimate(),3):k.return(!0):(w=k.h,k.return(w.usage+b<.95*w.quota))})},progressCallback:function(b,w){return Td([b,w])},usePersistentLicense:!0,numberOfParallelDownloads:5},g={drm:n,manifest:o,streaming:h,mediaSource:{codecSwitchingStrategy:i,sourceBufferExtraFeatures:"",forceTransmux:!1,insertFakeEncryptionInInit:!0},offline:p,abrFactory:function(){return new qn},abr:{enabled:!0,useNetworkInformation:!0,defaultBandwidthEstimate:1e6,switchInterval:8,bandwidthUpgradeTarget:.85,bandwidthDowngradeTarget:.95,restrictions:{minWidth:0,maxWidth:1/0,minHeight:0,maxHeight:e,minPixels:0,maxPixels:1/0,minFrameRate:0,maxFrameRate:1/0,minBandwidth:0,maxBandwidth:1/0},advanced:{minTotalBytes:128e3,minBytes:16e3,fastHalfLife:2,slowHalfLife:5},restrictToElementSize:!1,restrictToScreenSize:!1,ignoreDevicePixelRatio:!1,clearBufferSwitch:!1,safeMarginSwitch:0},autoShowText:3,preferredAudioLanguage:"",preferredAudioLabel:"",preferredTextLanguage:"",preferredVariantRole:"",preferredTextRole:"",preferredAudioChannelCount:2,preferredVideoHdrLevel:"AUTO",preferredVideoLayout:"",preferredVideoLabel:"",preferredVideoCodecs:[],preferredAudioCodecs:[],preferForcedSubs:!1,preferSpatialAudio:!1,preferredDecodingAttributes:[],restrictions:{minWidth:0,maxWidth:1/0,minHeight:0,maxHeight:1/0,minPixels:0,maxPixels:1/0,minFrameRate:0,maxFrameRate:1/0,minBandwidth:0,maxBandwidth:1/0},playRangeStart:0,playRangeEnd:1/0,textDisplayFactory:function(){return null},cmcd:{enabled:!1,sessionId:"",contentId:"",useHeaders:!1},cmsd:{enabled:!0,applyMaximumSuggestedBitrate:!0,estimatedThroughputWeightRatio:.5},lcevc:{enabled:!1,dynamicPerformanceScaling:!0,logLevel:0,drawLogo:!1},ads:{customPlayheadTracker:!1}};return p.trackSelectionCallback=function(b){return W(function(w){return w.return(function(k,I,x){var C=x;C=="AUTO"&&(C=s.matchMedia("(color-gamut: p3)").matches?"PQ":"SDR");var D=k.filter(function(F){return!(F.type!="variant"||F.hdr&&F.hdr!=C)});x=[];var _=mp(I,D.map(function(F){return F.language}));_&&(x=D.filter(function(F){return dn(F.language)==_})),x.length==0&&(x=D.filter(function(F){return F.primary})),x.length==0&&(D.map(function(F){return F.language}),x=D);var j=x.filter(function(F){return F.height&&480>=F.height});for(j.length&&(j.sort(function(F,B){return B.height-F.height}),x=j.filter(function(F){return F.height==j[0].height})),I=[],x.length&&(D=Math.floor(x.length/2),x.sort(function(F,B){return F.bandwidth-B.bandwidth}),I.push(x[D])),k=T(k),x=k.next();!x.done;x=k.next())(x=x.value).type!=en&&x.type!="image"||I.push(x);return I}(b,g.preferredAudioLanguage,g.preferredVideoHdrLevel))})},g}function Sd(e,n,i){var o={".drm.keySystemsMapping":"",".drm.servers":"",".drm.clearKeys":"",".drm.advanced":{distinctiveIdentifierRequired:!1,persistentStateRequired:!1,videoRobustness:"",audioRobustness:"",sessionType:"",serverCertificate:new Uint8Array(0),serverCertificateUri:"",individualizationServer:""}};return jo(e,n,i||ec(),o,"")}function QT(){this.g=null,this.h=[]}function Sr(e,n){var i=0;e.g&&e.g.state==n&&(i+=e.g.duration);for(var o=(e=T(e.h)).next();!o.done;o=e.next())i+=(o=o.value).state==n?o.duration:0;return i}function yr(){this.i=this.h=null,this.g=[]}function wn(e,n,i){e.i!=n&&(e.i=n,e.g.push({timestamp:Date.now()/1e3,id:n.id,type:"text",fromAdaptation:i,bandwidth:null}))}function Fn(){this.u=this.A=this.G=this.C=this.s=this.j=this.F=this.m=this.i=this.L=this.N=this.H=this.J=this.K=this.l=this.o=NaN,this.g=new QT,this.h=new yr}function Oe(e,n){hn.call(this);var i=this;this.l=zl,this.xd=this.g=null,this.ba=!1,this.Id=new mn,this.sc=new mn,this.o=new mn,this.Aa=new mn,this.C=this.F=this.m=this.H=null,this.Ld=0,this.W=new dg,this.ca=this.ga=this.i=this.Md=this.G=this.j=this.ya=this.K=this.eg=this.Y=this.V=this.za=this.L=this.yd=this.J=this.$b=null,this.kb=!1,this.Te=this.s=null,this.Ze=1e9,this.Qc=[],this.N=NaN,this.h=Js(this),this.Kd={width:1/0,height:1/0},this.u=null,this.Fa=new Ru(this.h.preferredAudioLanguage,this.h.preferredVariantRole,this.h.preferredAudioChannelCount,this.h.preferredVideoHdrLevel,this.h.preferSpatialAudio,this.h.preferredVideoLayout,this.h.preferredAudioLabel,this.h.preferredVideoLabel,this.h.mediaSource.codecSwitchingStrategy,this.h.manifest.dash.enableAudioGroups),this.jb=this.h.preferredTextLanguage,this.Mc=this.h.preferredTextRole,this.Lc=this.h.preferForcedSubs,this.Jc=[],n&&n(this),this.V=function(o){return new og({getBandwidthEstimate:function(){return o.s?o.s.getBandwidthEstimate():NaN},nb:function(){return o.nb()},getCurrentTime:function(){return o.g?o.g.currentTime:0},Cd:function(){return o.Cd()},Nb:function(){return o.Nb()},zb:function(){return o.zb()},R:function(){return o.R()}},o.h.cmcd)}(this),this.Y=new us(this.h.cmsd),this.H=function(o){return new ln(function(h,p,g){o.s&&o.s.segmentDownloaded(h,p,g)},function(h,p,g){if(p=new Map().set("headers",h).set("request",p).set("requestType",g),o.dispatchEvent(An("downloadheadersreceived",p)),o.Y&&(p=o.Y).h.enabled){if(g=h["cmsd-static"])try{var b=new Map,w=g.split(",");for(g=0;g<w.length;g++){var k=w[g].split("=");b.set(k[0],v1(k[1]))}}catch{}if(h=h["cmsd-dynamic"]){try{var I=new Map,x=h.split(";");for(h=1;h<x.length;h++){var C=x[h].split("=");I.set(C[0],v1(C[1]))}var D=I}catch{D=null}D&&(p.g=D)}}},function(h,p,g,b){h=new Map().set("request",h).set("error",p).set("httpResponseCode",g).set("aborted",b),o.dispatchEvent(An("downloadfailed",h))},function(h,p,g){var b=o.V;if(g=g===void 0?{}:g,b.g.enabled)if(p.method==="HEAD")Ju(b,p);else switch(h){case 0:try{if(b.g.enabled){if(g.type){e:{switch(g.type){case 4:var w="d";break e;case 3:case 2:w="h";break e;case 5:w="s";break e}w=void 0}b.m=w}Ju(b,p,{ot:vd,su:!b.i})}}catch(D){Lr("CMCD_MANIFEST_ERROR","Could not generate manifest CMCD data.",D)}break;case Ks:h=g;try{if(b.g.enabled){var k=h.segment;w=0,k&&(w=k.endTime-k.startTime);var I={d:1e3*w,st:b.h.R()?"l":"v"};I.ot=function(D){if(D.type===0)return jy;if(D=D.stream){var _=D.type;if(_=="video")return D.codecs&&D.codecs.includes(",")?Yh:Wh;if(_=="audio")return Vl;if(_=="text")return D.mimeType==="application/mp4"?bd:lg}}(h);var x=I.ot===Wh||I.ot===Vl||I.ot===Yh||I.ot===bd,C=h.stream;C&&(x&&(I.bl=function(D,_){if(!(_=D.h.nb()[_]).length)return NaN;var j=D.h.getCurrentTime();return(D=_.find(function(F){return F.start<=j&&F.end>=j}))?1e3*(D.end-j):NaN}(b,C.type)),C.bandwidth&&(I.br=C.bandwidth/1e3)),x&&I.ot!==bd&&(I.tb=function(D,_){var j=D.h.zb();if(!j.length)return NaN;D=j[0];for(var F=(j=T(j)).next();!F.done;F=j.next())(F=F.value).type==="variant"&&F.bandwidth>D.bandwidth&&(D=F);switch(_){case Wh:return D.videoBandwidth||NaN;case Vl:return D.audioBandwidth||NaN;default:return D.bandwidth}}(b,I.ot)/1e3),Ju(b,p,I)}}catch(D){Lr("CMCD_SEGMENT_ERROR","Could not generate segment CMCD data.",D)}break;case 2:case 5:case 6:Ju(b,p,{ot:"k"});break;case 4:Ju(b,p,{ot:"o"})}},function(h,p,g,b){o.G&&o.G.banLocation&&o.G.banLocation(b)})}(this),this.H.pf(this.h.streaming.forceHTTPS),this.A=null,wg&&(this.A=wg(),this.A.configure(this.h.ads)),this.Id.D(s,"online",function(){bg(i),i.gf()}),this.zd=new Qt(function(){return function(o){function h(k){var I="";return k.video&&(I+="video:"+k.video.id),k.audio&&(I=I+(I?"&":"")+"audio:"+k.audio.id),I}for(var p=Date.now()/1e3,g=!1,b=T(o.i.variants),w=b.next();!w.done;w=b.next())0<(w=w.value).disabledUntilTime&&w.disabledUntilTime<=p&&(w.disabledUntilTime=0,g=!0,h(w));o.i.variants.every(function(k){return k.disabledUntilTime===0})&&o.zd.stop(),g&&ic(o,!0,void 0,!1,!1)}(i)}),e&&(Ss("Player w/ mediaElement","Please migrate from initializing Player with a mediaElement; use the attach method instead."),this.Kc(e,!0))}function Pi(e){e.K!=null&&(Kp(e.K),e.K.release(),e.K=null)}function An(e,n){return new dt(e,n)}function ds(e,n){e.dispatchEvent(An("onstatechange",new Map().set("state",n)))}function Xh(e,n){var i;return W(function(o){return o.g==1?(i=++e.Ld,N(o,wa(e.W,n),2)):i!=e.Ld?(e.W.release(),o.return(!0)):o.return(!1)})}function Aa(e){var n,i,o,h,p;return W(function(g){if(g.g==1)return ds(e,"media-source"),n=e.h.textDisplayFactory,i=n(),e.We=n,o=function(b,w,k,I){return new zp(b,w,k,I)}(e.g,i,function(b,w,k){Pr(e,b,w,k)},e.K),o.configure(e.h.mediaSource),h=e.h.manifest,p=h.segmentRelativeVttTiming,o.ba=p,N(g,o.L,2);e.F=o,re(g)})}function Pr(e,n,i,o){for(var h=(n=T(n)).next();!h.done;h=n.next())if((h=h.value).data&&h.cueTime&&h.frames){var p=h.cueTime+i,g=o;g&&p>g&&(g=p);for(var b=T(h.frames),w=b.next();!w.done;w=b.next())Ho(e,p,g,"org.id3",w.value);e.A&&e.A.onHlsTimedMetadata(h,p)}}function Ho(e,n,i,o,h){n=new Map().set("startTime",n).set("endTime",i).set("metadataType",o).set("payload",h),e.dispatchEvent(An("metadata",n))}function Kl(e,n){if(n&&n.kind=="chapters"){n.mode="hidden";var i=new Qt(function(){n.mode="hidden"}).qc().U(.5);e.Jc.push(function(){i.stop()})}}function hg(e,n){return new ur(n,e.h.drm.updateExpirationTime)}function Rs(e,n,i){e.L=new t1,e.L.g=yi,Vs(e.L,i,Math.min(.5,i/2)),nc(e),e.yd=new Qt(function(){Xs(e)}).Ra(.25),e.o.D(n,"waiting",function(){return Xs(e)}),e.o.D(n,"stalled",function(){return Xs(e)}),e.o.D(n,"canplaythrough",function(){return Xs(e)}),e.o.D(n,"progress",function(){return Xs(e)})}function Xs(e){switch(e.l){case fn:if(e.g.ended)var n=!0;else{var i=Np(e.g.buffered);n=i!=null&&i>=e.g.duration-1}break;case hi:e:if(e.g.ended||Ul(e.F))n=!0;else{if(e.i.presentationTimeline.R()){i=e.i.presentationTimeline.yb();var o=Np(e.g.buffered);if(o!=null&&o>=i){n=!0;break e}}n=!1}break;default:n=!1}o=Fp(e.g.buffered,e.g.currentTime);var h=n,p=(i=e.L).h.get(i.g);n=i.g,o=h||o>=p?Lo:yi,i.g=o,n!=o&&nc(e)}function wd(e){if(e.G){var n=Ll(e.h.manifest);e.g&&e.g.nodeName==="AUDIO"&&(n.disableVideo=!0),e.G.configure(n)}if(e.m&&e.m.configure(e.h.drm),e.j){e.j.configure(e.h.streaming);try{pg(e,e.i)}catch(p){Ko(e,p)}e.s&&rc(e),!(n=e.j.j)||n.allowedByApplication&&n.allowedByKeySystem||ic(e)}if(e.H&&e.H.pf(e.h.streaming.forceHTTPS),e.F&&(e.F.configure(e.h.mediaSource),e.F.ba=e.h.manifest.segmentRelativeVttTiming,n=e.h.textDisplayFactory,e.We!=n)){var i=n(),o=e.F,h=o.F;o.F=i,h&&(i.setTextVisibility(h.isTextVisible()),h.destroy()),o.h&&(o.h.j=i),e.We=n,e.j&&(i=(n=e.j).i.get(en))&&Qu(n,i.stream,!0,0,!0)}e.s&&(e.s.configure(e.h.abr),e.h.abr.enabled?e.s.enable():e.s.disable(),qy(e)),e.L&&(n=e.h.streaming.rebufferingGoal,e.i&&(n=Math.max(n,e.i.minBufferTime)),Vs(e.L,n,Math.min(.5,n/2))),e.i&&Eg(e.i.presentationTimeline,e.h.playRangeStart,e.h.playRangeEnd),e.A&&e.A.configure(e.h.ads),e.V&&e.V.configure(e.h.cmcd),e.Y&&e.Y.configure(e.h.cmsd)}function ka(e){return e&&(e=/(\d+)x(\d+)/.exec(e))?{Jb:parseInt(e[1],10),rows:parseInt(e[2],10)}:null}function tc(e){return Array.from(e.g.textTracks).filter(function(n){return n.kind!="metadata"&&n.kind!="chapters"&&n.label!="Shaka Player TextTrack"})}function fg(e){return Array.from(e.g.textTracks).filter(function(n){return n.kind=="chapters"})}function Ad(e,n){var i;return W(function(o){switch(o.g){case 1:return ne(o,2),N(o,sg(n,e.H,e.h.streaming.retryParameters),4);case 4:i=o.h,ce(o,3);break;case 2:we(o);case 3:if(i)return o.return(i);throw new fe(1,2,2011,n)}})}function Jh(e,n,i,o,h,p,g){var b,w,k,I;return W(function(x){if(x.g==1)return h!="text/vtt"||g.length?N(x,oo(e,n,e.H,e.h.streaming.retryParameters),3):x.B(2);x.g!=2&&(b=x.h,w=Zh(e,b,h,g),k=new Blob([w],{type:"text/vtt"}),n=Bh(k),h="text/vtt"),I=document.createElement("track");var C=e.V,D=n;try{if(C.g.enabled){var _=ao(C);_.ot=lg,_.su=!0;var j=Zu(D,Bo(_))}else j=D}catch(F){Lr("CMCD_TEXT_TRACK_ERROR","Could not generate text track CMCD data.",F),j=D}return I.src=j,I.label=p,I.kind=o,I.srclang=i,e.g.getAttribute("crossorigin")||e.g.setAttribute("crossorigin","anonymous"),e.g.appendChild(I),x.return(I)})}function oo(e,n,i,o){var h,p,g;return W(function(b){if(b.g==1){h=Ks,(p=lr([n],o)).method="GET";var w=e.V;try{w.g.enabled&&Ju(w,p,{ot:lg,su:!0})}catch(k){Lr("CMCD_TEXT_ERROR","Could not generate text CMCD data.",k)}return N(b,i.request(h,p).promise,2)}return g=b.h,b.return(g.data)})}function Zh(e,n,i,o){var h=zn[i];if(h)return i=h(),e={periodStart:0,segmentStart:0,segmentEnd:e.g.duration,vttOffset:0},n=Nt(n),function(p,g){function b(I){for(var x=I,C=T(g),D=C.next();!D.done;D=C.next())(D=D.value).end&&D.start<I&&(x+=D.end-D.start);return(10>(I=Math.floor(x/3600))?"0":"")+I+":"+(10>(C=Math.floor(x/60%60))?"0":"")+C+":"+(10>(D=Math.floor(x%60))?"0":"")+D+"."+(100>(x=Math.floor(1e3*x%1e3))?10>x?"00":"0":"")+x}var w=os(p);p=`WEBVTT

`;for(var k=(w=T(w)).next();!k.done;k=w.next())p+=b((k=k.value).startTime)+" --> "+b(k.endTime)+function(I){var x=[];switch(I.textAlign){case"left":x.push("align:left");break;case"right":x.push("align:right");break;case ja:x.push("align:middle");break;case"start":x.push("align:start");break;case"end":x.push("align:end")}switch(I.writingMode){case"vertical-lr":x.push("vertical:lr");break;case"vertical-rl":x.push("vertical:rl")}return x.length?" "+x.join(" "):""}(k)+`
`,p+=k.payload+`

`;return p}(n=i.parseMedia(n,e,null),o);throw new fe(2,2,2014,i)}function Js(e){var n=ec();return n.streaming.failureCallback=function(i){if(e.R()){var o=null;i.code==1001||i.code==1002?o=1:i.code==1003&&(o=.1),o!=null&&(i.severity=1,e.gf(o))}},n.textDisplayFactory=function(){return e.xd?new ls(e.g,e.xd):HTMLMediaElement.prototype.addTextTrack?new $r(e.g,"Shaka Player TextTrack"):new Bi},n}function kd(e,n){return W(function(i){if(i.g==1)return N(i,function(o,h){return W(function(p){if(p.g==1)return N(p,qT(o.m,h),2);if(!h.variants.some(Th))throw new fe(2,4,4032);re(p)})}(e,n),2);pg(e,n),re(i)})}function pg(e,n){if(e.l!=Zs){Yc(n.variants,e.h.restrictions,e.Kd)&&e.j&&Ei(e);var i=e.m?e.m.g:null;if(i&&e.m.s)for(var o=T(n.variants),h=o.next();!h.done;h=o.next())h=h.value,ef(e,i.keySystem,h.video),ef(e,i.keySystem,h.audio);ac(e,n)}}function ef(e,n,i){if(i){for(var o=(i=T(i.drmInfos)).next();!o.done;o=i.next())if((o=o.value).keySystem==n)for(var h=(o=T(o.initData||[])).next();!h.done;h=o.next())h=h.value,Ol(e.m,h.initDataType,h.initData)}}function nc(e){var n=e.Le();if(e.u&&e.L&&e.C){var i=e.J;i.j=n,dd(i),e.V&&(i=e.V,n||i.i||(i.i=!0),i.i&&n&&(i.j=!0),i.l=n),Mi(e)}n=new Map().set("buffering",n),e.dispatchEvent(An("buffering",n))}function gg(e){var n=e.g.playbackRate;n!=0&&(e.J&&e.J.set(n),n=An("ratechange"),e.dispatchEvent(n))}function Mi(e){if(e.u&&e.L){var n=e.u.g,i="playing";e.L.g==yi?i="buffering":e.g.paused?i="paused":e.g.ended&&(i="ended");var o=i;if(n.g==null)n.g={timestamp:Date.now()/1e3,state:o,duration:0},n=!0;else{var h=Date.now()/1e3;n.g.duration=h-n.g.timestamp,n.g.state==o?n=!1:(n.h.push(n.g),n.g={timestamp:h,state:o,duration:0},n=!0)}n&&(i=new Map().set("newstate",i),e.dispatchEvent(An("statechanged",i)))}}function Ky(e){if(e.R()){var n=e.Bb();if(Number.isFinite(n.end)&&!(e.g.currentTime<n.start)){if(e.h.streaming.liveSync)var i=e.h.streaming.liveSyncMaxLatency,o=e.h.streaming.liveSyncPlaybackRate;else e.i&&e.i.serviceDescription&&(i=e.i.serviceDescription.maxLatency||e.h.streaming.liveSyncMaxLatency,o=e.i.serviceDescription.maxPlaybackRate||e.h.streaming.liveSyncPlaybackRate);if(e.h.streaming.liveSync)var h=e.h.streaming.liveSyncMinLatency,p=e.h.streaming.liveSyncMinPlaybackRate;else e.i&&e.i.serviceDescription&&(h=e.i.serviceDescription.minLatency||e.h.streaming.liveSyncMinLatency,p=e.i.serviceDescription.minPlaybackRate||e.h.streaming.liveSyncMinPlaybackRate);var g=e.g.playbackRate,b=n.end-e.g.currentTime,w=0;if(e.l==fn){var k=e.g.buffered;0<k.length&&(w=k.end(k.length-1),w=Math.max(o,w-n.end))}i&&o&&b-w>i?g!=o&&e.xf(o):h&&p&&b-w<h?g!=p&&e.xf(p):g!==e.J.ec()&&e.ud()}}}function di(e){if(e.g){var n,i=!1,o=e.g.currentTime/e.g.duration;isNaN(o)||(o=Math.round(100*o),isNaN(e.N)?(e.N=o,i=!0):(o=Math.max(e.N,o),e.N!=o&&(e.N=o,i=!0))),i&&(e.N==0?n=An("started"):e.N==25?n=An("firstquartile"):e.N==50?n=An("midpoint"):e.N==75?n=An("thirdquartile"):e.N==100&&(n=An("complete")),n&&e.dispatchEvent(n))}}function rc(e){try{ac(e,e.i)}catch(i){return Ko(e,i),!1}var n=Tp(e.i.variants);return n=e.Fa.create(n),e.s.setVariants(Array.from(n.values())),!0}function mg(e,n){return n=n!==void 0&&n,rc(e)?e.s.chooseVariant(n):null}function ic(e,n,i,o,h){n=n===void 0||n,i=i===void 0?0:i,o=o!==void 0&&o,h=h===void 0||h;var p=mg(e);p&&yg(e,p,h,n,i,o)}function yg(e,n,i,o,h,p){p=p!==void 0&&p;var g=e.j.j;if(n==g)o&&Fo(e.j,n,o,h,!0);else{var b=e.u.h;b.h!=n&&(b.h=n,b.g.push({timestamp:Date.now()/1e3,id:n.id,type:"variant",fromAdaptation:i,bandwidth:n.bandwidth})),Fo(e.j,n,o,h,p,i),o=null,g&&(o=Xc(g)),n=Xc(n),i?(i=new Map().set("oldTrack",o).set("newTrack",n),e.K&&Mh(e.K,n,e.Ie()),zo(e,i=An("adaptation",i))):vg(e,o,n)}}function lo(e,n){var i=Array.from(e.g.audioTracks).find(function(o){return o.enabled});n.enabled=!0,n.id!==i.id&&(i.enabled=!1),vg(e,i=Iu(i),n=Iu(n))}function Ei(e){zo(e,An("trackschanged"))}function vg(e,n,i){n=new Map().set("oldTrack",n).set("newTrack",i),e.K&&Mh(e.K,i,e.Ie()),zo(e,i=An("variantchanged",n))}function Vo(e){zo(e,An("textchanged"))}function zy(e){zo(e,An("texttrackvisibility"))}function qy(e){e.h.abr.enabled||bg(e),zo(e,An("abrstatuschanged",new Map().set("newStatus",e.h.abr.enabled)))}function bg(e,n){if(n=n===void 0||n,e.l==hi){e.zd.stop();for(var i=T(e.i.variants),o=i.next();!o.done;o=i.next())o.value.disabledUntilTime=0;n&&rc(e)}}function Ko(e,n){var i,o,h;return W(function(p){switch(p.g){case 1:if(e.l==Zs)return p.return();if(i=!0,!(e.kb&&e.i&&e.j)||n.code!=3016&&n.code!=3014&&n.code!=3015&&n.code!=3018){p.B(2);break}return ne(p,3),N(p,function(g){var b,w,k,I,x,C;return W(function(D){return D.g==1?(b=Date.now()/1e3,w=g.h.minTimeBetweenRecoveries,!g.h.allowMediaSourceRecoveries||b-g.H<w?D.return(!1):(g.H=b,k=_r,(I=g.i.get(k.P))&&(I.Ab=null,so(g,I),md(I).catch(function(){})),(x=g.i.get(k.$))&&(x.Ab=null,so(g,x),md(x).catch(function(){})),C=new Map,g.j.audio&&C.set(k.P,g.j.audio),g.j.video&&C.set(k.$,g.j.video),N(D,Ry(g.g.T,C),2))):D.return(!0)})}(e.j),5);case 5:o=p.h,i=!o,ce(p,2);break;case 3:we(p),i=!0;case 2:if(!i)return p.return();n.severity===2&&bg(e,!1),h=An("error",new Map().set("detail",n)),e.dispatchEvent(h),h.defaultPrevented&&(n.handled=!0),re(p)}})}function sc(e,n,i){i=new Map().set("detail",{schemeIdUri:i.schemeIdUri,value:i.value,startTime:i.startTime,endTime:i.endTime,id:i.id,eventElement:i.eventElement}),e.dispatchEvent(An(n,i))}function Wy(e){if(!e.g.error)return null;var n=e.g.error.code;if(n==1)return null;var i=e.g.error.msExtendedCode;return i&&(0>i&&(i+=Math.pow(2,32)),i=i.toString(16)),new fe(2,3,3016,n,i,e.g.error.message)}function b1(e,n){if(e.j){var i=An("keystatuschanged");e.dispatchEvent(i);var o=Object.keys(n);i=o.length==1&&o[0]=="00";var h=!1;if(o.length)for(var p=(o=T(e.i.variants)).next();!p.done;p=o.next()){var g=[];(p=p.value).audio&&g.push(p.audio),p.video&&g.push(p.video);for(var b=(g=T(g)).next();!b.done;b=g.next()){var w=b.value;if(b=p.allowedByKeySystem,w.keyIds.size){p.allowedByKeySystem=!0;for(var k=(w=T(w.keyIds)).next();!k.done;k=w.next())k=k.value,((k=n[i?"00":k])||e.m.F)&&(p.allowedByKeySystem=p.allowedByKeySystem&&!!k&&!E1.includes(k))}b!=p.allowedByKeySystem&&(h=!0)}}if(h&&(Ei(e),!rc(e)))return;(n=e.j.j)&&!n.allowedByKeySystem&&ic(e)}}function Yy(e,n,i){e.G&&e.G.onExpirationUpdated&&e.G.onExpirationUpdated(n,i),n=An("expirationupdated"),e.dispatchEvent(n)}function Eg(e,n,i){0<n&&(e.R()||e.rg(n)),i<(n=e.getDuration())&&(e.R()||e.Pa(i))}function ac(e,n){e=e.m?e.m.Bd():{};var i=Object.keys(e);i=i.length&&i[0]=="00";for(var o=!1,h=!1,p=new Set,g=new Set,b=(n=T(n.variants)).next();!b.done;b=n.next()){var w=[];(b=b.value).audio&&w.push(b.audio),b.video&&w.push(b.video);for(var k=(w=T(w)).next();!k.done;k=w.next())if((k=k.value).keyIds.size)for(var I=(k=T(k.keyIds)).next();!I.done;I=k.next()){I=I.value;var x=e[i?"00":I];x?E1.includes(x)&&g.add(x):p.add(I)}b.allowedByApplication?b.allowedByKeySystem&&(o=!0):h=!0}if(!o)throw new fe(2,4,4012,e={hasAppRestrictions:h,missingKeys:Array.from(p),restrictedKeyStatuses:Array.from(g)})}function zo(e,n){W(function(i){if(i.g==1)return N(i,Promise.resolve(),2);e.l!=Zs&&e.dispatchEvent(n),re(i)})}function Qy(e){for(var n=new Set,i=(e=T(e)).next();!i.done;i=e.next())(i=i.value).language?n.add(dn(i.language)):n.add("und");return n}function Xy(e){for(var n=new Map,i=new Map,o=(e=T(e)).next();!o.done;o=e.next()){var h="und",p=[];(o=o.value).language&&(h=dn(o.language)),(p=o.type=="variant"?o.audioRoles:o.roles)&&p.length||(p=[""]),n.has(h)||n.set(h,new Set);for(var g=(p=T(p)).next();!g.done;g=p.next())g=g.value,n.get(h).add(g),o.label&&(i.has(h)||i.set(h,new Map),i.get(h).set(g,o.label))}var b=[];return n.forEach(function(w,k){for(var I=(w=T(w)).next();!I.done;I=w.next()){I=I.value;var x=null;i.has(k)&&i.get(k).has(I)&&(x=i.get(k).get(I)),b.push({language:k,role:I,label:x})}}),b}We("shaka.util.ConfigUtils",Ed),Ed.convertToConfigObject=cg,Ed.mergeConfigObjects=jo,dg.prototype.release=function(){0<this.h.length?this.h.shift()():this.g=null},We("shaka.util.FairPlayUtils",cs),cs.commonFairPlayResponse=function(e,n){if(e===2){try{var i=Wn(n.data)}catch{return}e=!1,(i=i.trim()).substr(0,5)==="<ckc>"&&i.substr(-6)==="</ckc>"&&(i=i.slice(5,-6),e=!0);try{var o=JSON.parse(i);o.ckc&&(i=o.ckc,e=!0),o.CkcMessage&&(i=o.CkcMessage,e=!0),o.License&&(i=o.License,e=!0)}catch{}e&&(n.data=bs(ns(i)))}},cs.expressplayFairPlayRequest=function(e,n){Hy(e,n)},cs.conaxFairPlayRequest=function(e,n){Hy(e,n)},cs.ezdrmFairPlayRequest=function(e,n){Hy(e,n)},cs.verimatrixFairPlayRequest=function(e,n){e===2&&(e=Mo(e=Nt(n.body)),n.headers["Content-Type"]="application/x-www-form-urlencoded",n.body=As("spc="+e))},cs.expressplayInitDataTransform=function(e,n,i){return Dr(e,n,i)},cs.conaxInitDataTransform=function(e,n,i){if(n!=="skd")return e;n=i.serverCertificate,i=qs(e).split("skd://").pop().split("?").shift(),i=s.atob(i);var o=new ArrayBuffer(2*i.length);o=Wi(o);for(var h=0,p=i.length;h<p;h++)o[h]=i.charCodeAt(h);return Go(e,o,n)},cs.ezdrmInitDataTransform=function(e,n,i){return n!=="skd"?e:(n=i.serverCertificate,Go(e,i=qs(e).split(";").pop(),n))},cs.verimatrixInitDataTransform=function(e,n,i){return Dr(e,n,i)},cs.initDataTransform=Go,cs.defaultGetContentId=Qh,cs.isFairPlaySupported=function(){var e;return W(function(n){return n.g==1?(e={initDataTypes:["cenc","sinf","skd"],videoCapabilities:[{contentType:'video/mp4; codecs="avc1.42E01E"'}]},ne(n,2),N(n,navigator.requestMediaKeySystemAccess("com.apple.fps",[e]),4)):n.g!=2?n.return(!0):(we(n),n.return(!1))})},We("shaka.util.PlayerConfiguration",Vy),Vy.mergeConfigObjects=Sd,Vy.createDefault=ec,Z(Oe,hn),(c=Oe.prototype).destroy=function(){var e,n=this;return W(function(i){switch(i.g){case 1:return n.l==Zs?i.return():(Pi(n),e=n.detach(),n.l=Zs,N(i,e,2));case 2:if(n.Id&&(n.Id.release(),n.Id=null),n.sc&&(n.sc.release(),n.sc=null),n.o&&(n.o.release(),n.o=null),n.Aa&&(n.Aa.release(),n.Aa=null),n.Te=null,n.h=null,n.u=null,n.xd=null,n.V=null,n.Y=null,!n.H){i.B(3);break}return N(i,n.H.destroy(),4);case 4:n.H=null;case 3:n.s&&(n.s.release(),n.s=null),hn.prototype.release.call(n),re(i)}})},c.Kc=function(e,n){n=n===void 0||n;var i,o,h=this;return W(function(p){switch(p.g){case 1:if(h.l==Zs)throw new fe(2,7,7e3);if(!h.g||h.g==e){p.B(2);break}return N(p,h.detach(),2);case 2:return N(p,Xh(h,"attach"),4);case 4:if(p.h)return p.return();if(ne(p,5,6),ds(h,"attach"),i=function(){var g=Wy(h);g&&Ko(h,g)},h.sc.D(e,"error",i),h.g=e,!n||!ya()||h.F){p.B(6);break}return N(p,Aa(h),6);case 6:ze(p),h.W.release(),xe(p,0);break;case 5:return o=we(p),N(p,h.detach(),10);case 10:throw o}})},c.Fg=function(e){this.eg=e},c.detach=function(e){e=e!==void 0&&e;var n=this;return W(function(i){if(i.g==1){if(n.l==Zs)throw new fe(2,7,7e3);return N(i,n.rc(!1,e),2)}if(i.g!=3)return N(i,Xh(n,"detach"),3);if(i.h)return i.return();try{n.g&&(n.sc.$a(),n.g=null),ds(n,"detach"),n.A&&!e&&n.A.release()}finally{n.W.release()}re(i)})},c.rc=function(e,n){e=e===void 0||e,n=n!==void 0&&n;var i,o,h,p,g,b,w,k,I,x=this;return W(function(C){switch(C.g){case 1:return x.l!=Zs&&(x.l=zl),N(C,Xh(x,"unload"),2);case 2:return C.h?C.return():(Se(C,3),x.kb=!1,ds(x,"unload"),e&&!ya()&&(e=!1),Pi(x),i=x.Jc.map(function(D){return D()}),x.Jc=[],N(C,Promise.all(i),5));case 5:if(x.dispatchEvent(An("unloading")),x.za&&(x.za.release(),x.za=null),x.g&&(x.o.$a(),x.Aa.$a()),x.zd.stop(),x.$b&&(x.$b.release(),x.$b=null),x.yd&&(x.yd.stop(),x.yd=null),!x.G){C.B(6);break}return N(C,x.G.stop(),7);case 7:x.G=null,x.Md=null;case 6:if(!x.s){C.B(8);break}return N(C,x.s.stop(),8);case 8:if(!x.j){C.B(10);break}return N(C,x.j.destroy(),11);case 11:x.j=null;case 10:if(x.J&&(x.J.release(),x.J=null),x.C&&(x.C.release(),x.C=null),!x.F){C.B(12);break}return N(C,x.F.destroy(),13);case 13:x.F=null;case 12:if(x.A&&!n&&x.A.onAssetUnload(),x.Y&&(x.Y.g=null),x.g&&$i(x.g),!x.g||!x.g.src){C.B(14);break}return N(C,new Promise(function(D){return new Qt(D).U(.1)}),15);case 15:x.g.removeAttribute("src"),x.g.load();case 14:if(!x.m){C.B(16);break}return N(C,x.m.destroy(),17);case 17:x.m=null;case 16:if(x.ga=null,x.L=null,x.i){for(o=T(x.i.variants),h=o.next();!h.done;h=o.next())for(p=h.value,g=T([p.audio,p.video]),b=g.next();!b.done;b=g.next())(w=b.value)&&w.segmentIndex&&w.segmentIndex.release();for(k=T(x.i.textStreams),b=k.next();!b.done;b=k.next())(I=b.value).segmentIndex&&I.segmentIndex.release()}x.i=null,x.u=new Fn,x.We=null,x.Qc=[],x.N=NaN,nc(x);case 3:ze(C),x.W.release(),xe(C,4);break;case 4:if(e&&ya()&&!x.F)return N(C,Aa(x),0);C.B(0)}})},c.fi=function(e){this.ca=e},c.load=function(e,n,i){n=n===void 0?null:n;var o,h,p,g,b,w=this;return W(function(k){switch(k.g){case 1:if(w.l==Zs)throw new fe(2,7,7e3);return N(k,wa(w.W,"load"),2);case 2:if(w.W.release(),!w.g)throw new fe(2,7,7002);if(!w.ga){k.B(3);break}return N(k,w.rc(!1),3);case 3:if(o=++w.Ld,h=function(){if(w.Ld!=o)throw new fe(2,7,7e3)},p=function(I,x){return W(function(C){switch(C.g){case 1:return Se(C,2),N(C,wa(w.W,x),4);case 4:return h(),N(C,I(),5);case 5:h();case 2:ze(C),w.W.release(),xe(C,0)}})},ne(k,5),w.ca=n,w.kb=!1,w.dispatchEvent(An("loading")),g=Date.now()/1e3,w.u=new Fn,w.ga=e,i){k.B(7);break}return N(k,p(function(){return W(function(I){if(I.g==1)return N(I,function(x){var C,D;return W(function(_){return _.g==1?(C=x.h.manifest.retryParameters,N(_,sg(x.ga,x.H,C),2)):((D=_.h)=="application/x-mpegurl"&&vh()&&(D="application/vnd.apple.mpegurl"),_.return(D))})}(w),2);i=I.h,re(I)})},"guessMimeType_"),7);case 7:if(function(I,x){if(!ya())return!0;if(x){if((I.g||Wm()).canPlayType(x)=="")return!1;if(!ya()||!(x in ks))return!0;if(zc(x)){if(I.h.streaming.preferNativeHls)return!0;if(vh())return I.h.streaming.useNativeHlsOnSafari}}return!1}(w,i))return N(k,p(function(){return W(function(I){return N(I,function(x,C){var D,_,j,F,B;return W(function(H){return H.g==1?(D=_r,_=Date.now()/1e3,j=!0,x.m=hg(x,{Tb:x.H,onError:function(Y){Ko(x,Y)},Vd:function(Y){b1(x,Y)},onExpirationUpdated:function(Y,te){Yy(x,Y,te)},onEvent:function(Y){x.dispatchEvent(Y),Y.type=="drmsessionupdate"&&j&&(j=!1,x.u.j=Date.now()/1e3-_)}}),x.m.configure(x.h.drm),F={id:0,language:"und",disabledUntilTime:0,primary:!1,audio:null,video:null,bandwidth:100,allowedByApplication:!0,allowedByKeySystem:!0,decodingInfos:[]},(B={id:0,originalId:null,groupId:null,createSegmentIndex:function(){return Promise.resolve()},segmentIndex:null,mimeType:C?Ri(C):"",codecs:C?Ci(C):"",encrypted:!0,drmInfos:[],keyIds:new Set,language:"und",originalLanguage:null,label:null,type:D.$,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],forced:!1,channelsCount:null,audioSamplingRate:null,spatialAudio:!1,closedCaptions:null,accessibilityPurpose:null,external:!1,fastSwitching:!1,fullMimeTypes:new Set}).fullMimeTypes.add(Er(B.mimeType,B.codecs)),C.startsWith("audio/")?(B.type=D.P,F.audio=B):F.video=B,x.m.Y=!0,N(H,Ur(x.m,[F],[]),2)):N(H,x.m.Kc(x.g),0)})}(w,i),0)})},"initializeSrcEqualsDrmInner_"),16);if(w.F){k.B(11);break}return N(k,p(function(){return W(function(I){return N(I,Aa(w),0)})},"initializeMediaSourceEngineInner_"),11);case 11:return N(k,p(function(){return W(function(I){return N(I,function(x,C){var D,_,j,F,B,H,Y,te;return W(function(q){if(q.g==1)return D=x.H,ds(x,"manifest-parser"),x.Md=Op(x.ga,C||null),x.G=x.Md(),_=Ll(x.h.manifest),x.g&&x.g.nodeName==="AUDIO"&&(_.disableVideo=!0),x.G.configure(_),x.za=new hd(function(){return x.Bb()}),x.za.addEventListener("regionadd",function(X){X=X.region,sc(x,"timelineregionadded",X),x.A&&x.A.onDashTimedMetadata(X)}),x.ya=null,x.h.streaming.observeQualityChanges&&(x.ya=new Qr(function(){return x.nb()}),x.ya.addEventListener("qualitychange",function(X){var he=X.quality;X=X.position,he=new Map().set("mediaQuality",{bandwidth:he.bandwidth,audioSamplingRate:he.audioSamplingRate,codecs:he.codecs,contentType:he.contentType,frameRate:he.frameRate,height:he.height,mimeType:he.mimeType,channelsCount:he.channelsCount,pixelAspectRatio:he.pixelAspectRatio,width:he.width}).set("position",X),x.dispatchEvent(An("mediaqualitychanged",he))})),j={networkingEngine:D,filter:function(X){return kd(x,X)},makeTextStreamsForClosedCaptions:function(X){return function(he,ae){for(var me=new Set,oe=T(ae.textStreams),ge=oe.next();!ge.done;ge=oe.next())(ge=ge.value).mimeType!="application/cea-608"&&ge.mimeType!="application/cea-708"||me.add(ge.originalId);for(oe=T(ae.variants),ge=oe.next();!ge.done;ge=oe.next())if((ge=ge.value.video)&&ge.closedCaptions){for(var le=T(ge.closedCaptions.keys()),Ee=le.next();!Ee.done;Ee=le.next())if(Ee=Ee.value,!me.has(Ee)){var ve=Ee.startsWith("CC")?"application/cea-608":"application/cea-708",Be=new Jn,_e=ge.closedCaptions.get(Ee);ve={id:he.Ze++,originalId:Ee,groupId:null,createSegmentIndex:function(){return Promise.resolve()},segmentIndex:Be,mimeType:ve,codecs:"",kind:"caption",encrypted:!1,drmInfos:[],keyIds:new Set,language:_e,originalLanguage:_e,label:null,type:en,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:ge.roles,forced:!1,channelsCount:null,audioSamplingRate:null,spatialAudio:!1,closedCaptions:null,accessibilityPurpose:null,external:!1,fastSwitching:!1,fullMimeTypes:new Set([Er(ve,"")])},ae.textStreams.push(ve),me.add(Ee)}}}(x,X)},onTimelineRegionAdded:function(X){var he=x.za;e:{for(var ae=T(he.g),me=ae.next();!me.done;me=ae.next())if((me=me.value).schemeIdUri==X.schemeIdUri&&me.id==X.id&&me.startTime==X.startTime&&me.endTime==X.endTime){ae=me;break e}ae=null}ae==null&&(he.g.add(X),X=new dt("regionadd",new Map([["region",X]])),he.dispatchEvent(X))},onEvent:function(X){return x.dispatchEvent(X)},onError:function(X){return Ko(x,X)},isLowLatencyMode:function(){return x.h.streaming.lowLatencyMode},isAutoLowLatencyMode:function(){return x.h.streaming.autoLowLatencyMode},enableLowLatencyMode:function(){x.configure("streaming.lowLatencyMode",!0)},updateDuration:function(){x.j&&x.j.updateDuration()},newDrmInfo:function(X){var he=x.m?x.m.g:null;he&&x.m.s&&ef(x,he.keySystem,X)},onManifestUpdated:function(){var X=new Map().set("isLive",x.R());x.dispatchEvent(An("manifestupdated",X)),x.A&&x.A.onManifestUpdated(x.R())},getBandwidthEstimate:function(){return x.s.getBandwidthEstimate()}},F=Date.now()/1e3,ds(x,"manifest"),B=x,N(q,x.G.start(x.ga,j),2);if(B.i=q.h,H=An("manifestparsed"),x.dispatchEvent(H),x.i.variants.length==0)throw new fe(2,4,4036);(function(X){function he(ae){return ae.video&&ae.audio||ae.video&&ae.video.codecs.includes(",")}X.variants.some(he)&&(X.variants=X.variants.filter(he))})(x.i),Y=Date.now()/1e3,te=Y-F,x.u.F=te,re(q)})}(w,i),0)})},"parseManifestInner_"),13);case 13:return N(k,p(function(){return W(function(I){return N(I,function(x){var C,D,_;return W(function(j){return j.g==1?(ds(x,"drm-engine"),C=Date.now()/1e3,D=!0,x.m=hg(x,{Tb:x.H,onError:function(F){Ko(x,F)},Vd:function(F){b1(x,F)},onExpirationUpdated:function(F,B){Yy(x,F,B)},onEvent:function(F){x.dispatchEvent(F),F.type=="drmsessionupdate"&&D&&(D=!1,x.u.j=Date.now()/1e3-C,x.K&&Kp(x.K))}}),x.m.configure(x.h.drm),Yc(x.i.variants,x.h.restrictions,x.Kd)&&x.j&&Ei(x),_=Tp(x.i.variants),N(j,Ur(x.m,_,x.i.offlineSessionIds),2)):j.g!=3?N(j,x.m.Kc(x.g),3):N(j,kd(x,x.i),0)})}(w),0)})},"initializeDrmInner_"),14);case 14:return N(k,p(function(){return W(function(I){return N(I,function(x,C){var D,_,j,F,B,H,Y,te,q,X,he,ae,me,oe,ge,le,Ee,ve,Be,_e,Ye;return W(function(Ve){switch(Ve.g){case 1:for(ds(x,"load"),D=x.g,x.J=new zu({Ed:function(){return D.playbackRate},ec:function(){return D.defaultPlaybackRate},rf:function(be){D.playbackRate=be},bg:function(be){D.currentTime+=be}}),_=function(){return Mi(x)},j=function(){return gg(x)},x.o.D(D,"playing",_),x.o.D(D,"pause",_),x.o.D(D,"ended",_),x.o.D(D,"ratechange",j),function(be,ke){if(ke.lcevc.enabled){var Ae=be.zb();Ae&&Ae[0]&&Ae[0].videoMimeType=="video/mp2t"&&(zm()||yp())&&(ke.mediaSource.forceTransmux||Rt("LCEVC Warning: For MPEG-2 TS decoding the config.mediaSource.forceTransmux must be enabled.")),Pi(be),be.K==null&&(be.K=new _o(be.g,be.eg,ke.lcevc),be.F&&(be.F.V=be.K))}else Pi(be)}(x,x.h),F=x.h.abrFactory,x.s&&x.Te==F||(x.Te=F,x.s=F(),typeof x.s.setMediaElement!="function"&&(Ss("AbrManager w/o setMediaElement","Please use an AbrManager with setMediaElement function."),x.s.setMediaElement=function(){}),typeof x.s.setCmsdManager!="function"&&(Ss("AbrManager w/o setCmsdManager","Please use an AbrManager with setCmsdManager function."),x.s.setCmsdManager=function(){}),typeof x.s.trySuggestStreams!="function"&&(Ss("AbrManager w/o trySuggestStreams","Please use an AbrManager with trySuggestStreams function."),x.s.trySuggestStreams=function(){}),x.s.configure(x.h.abr)),x.Fa=new Ru(x.h.preferredAudioLanguage,x.h.preferredVariantRole,x.h.preferredAudioChannelCount,x.h.preferredVideoHdrLevel,x.h.preferSpatialAudio,x.h.preferredVideoLayout,x.h.preferredAudioLabel,x.h.preferredVideoLabel,x.h.mediaSource.codecSwitchingStrategy,x.h.manifest.dash.enableAudioGroups),x.jb=x.h.preferredTextLanguage,x.Mc=x.h.preferredTextRole,x.Lc=x.h.preferForcedSubs,Eg(x.i.presentationTimeline,x.h.playRangeStart,x.h.playRangeEnd),x.s.init(function(be,ke,Ae){x.i&&x.j&&be!=x.j.j&&yg(x,be,!0,ke!==void 0&&ke,Ae===void 0?0:Ae)}),x.s.setMediaElement(D),x.s.setCmsdManager(x.Y),Qm(x.i,x.h.preferredVideoCodecs,x.h.preferredAudioCodecs,x.h.preferredDecodingAttributes),x.j=function(be){return new _y(be.i,{Dd:function(){return be.C?be.C.qd():0},getBandwidthEstimate:function(){return be.s.getBandwidthEstimate()},T:be.F,Tb:be.H,onError:function(ke){return Ko(be,ke)},onEvent:function(ke){return be.dispatchEvent(ke)},Gh:function(){be.G&&be.G.update&&be.G.update()},af:function(ke,Ae){var He=ke.startTime,De=ke.endTime,$e=Ae.type;if(be.C){be.C.cg();var je=ud(be.F,$e);!be.R()&&be.g.paused&&je!=null&&0<je&&be.C.qd()<je&&be.C.ke(je)}Xs(be),He=new Map().set("start",He).set("end",De).set("contentType",$e),be.dispatchEvent(An("segmentappended",He)),be.s&&Ae.fastSwitching&&ke.$c&&ke.Nd&&be.s.trySuggestStreams()},Fh:function(ke,Ae){(Ae=Ae.Ve)&&be.ya&&function(He,De,$e){var je=function(Ge,Fe){var rt=Ge.g.get(Fe);return rt||(rt={ad:[],If:null,contentType:Fe},Ge.g.set(Fe,rt)),rt}(He,De.contentType);(function(Ge,Fe){if((Ge=Ge.h()[Fe.contentType])&&0<Ge.length){var rt=Ge[0].start,Qe=Ge[Ge.length-1].end,Et=Fe.ad;Fe.ad=Et.filter(function(et,it){return!(et.position<=rt&&it+1<Et.length&&Et[it+1].position<=rt||et.position>=Qe)})}else Fe.ad=[]})(He,je),He={Ve:De,position:$e},0<=(De=(je=je.ad).findIndex(function(Ge){return Ge.position>=$e}))?je.splice(De,je[De].position==$e?1:0,He):je.push(He)}(be.ya,Ae,ke)},Ef:function(ke,Ae){var He=be.m;if(He.h.parseInbandPsshEnabled&&!He.F&&["audio","video"].includes(ke)){var De=0,$e=T((Ae=new hy(Nt(Ae))).data);for(ke=$e.next();!ke.done;ke=$e.next())De+=ke.value.length;if(De==0)He=Promise.resolve();else{for(De=new Uint8Array(De),$e=0,ke=(Ae=T(Ae.data)).next();!ke.done;ke=Ae.next())ke=ke.value,De.set(ke,$e),$e+=ke.length;Ol(He,"cenc",De),He=He.l}}else He=Promise.resolve();return He},Hh:function(ke,Ae,He){Pr(be,ke,Ae,He)},wd:function(ke,Ae){return be.wd(ke,Ae)}})}(x),x.j.configure(x.h.streaming),x.l=hi,D.textTracks&&x.o.D(D.textTracks,"addtrack",function(be){be.track&&(be=be.track).kind==="chapters"&&Kl(x,be)}),x.dispatchEvent(An("streaming")),B=null,(H=x.j.j)||(B=mg(x,!0)),Y=[],q=T([(te=H||B).video,te.audio]),X=q.next();!X.done;X=q.next())(he=X.value)&&!he.segmentIndex&&Y.push(he.createSegmentIndex());if(!(0<Y.length)){Ve.B(2);break}return N(Ve,Promise.all(Y),2);case 2:if(x.G&&x.G.onInitialVariantChosen&&x.G.onInitialVariantChosen(te),Eg(x.i.presentationTimeline,x.h.playRangeStart,x.h.playRangeEnd),ae=function(be){x.C=function(ke,Ae){return new eg(ke.g,ke.i,ke.h.streaming,Ae,function(){ke.$b&&jl(ke.$b,!0),ke.j&&ke.j.dd(),ke.L&&Xs(ke)},function(He){return ke.dispatchEvent(He)})}(x,be),x.$b=function(ke,Ae){(Ae=new Hh(ke.za,ke.R()||0<Ae)).addEventListener("enter",function(De){sc(ke,"timelineregionenter",De.region)}),Ae.addEventListener("exit",function(De){sc(ke,"timelineregionexit",De.region)}),Ae.addEventListener("skip",function(De){var $e=De.region;De.seeking||(sc(ke,"timelineregionenter",$e),sc(ke,"timelineregionexit",$e))});var He=new Gh(ke.g);return He.g.add(Ae),ke.ya&&He.g.add(ke.ya),He}(x,be),Rs(x,D,Math.max(x.i.minBufferTime,x.h.streaming.rebufferingGoal))},x.h.streaming.startAtSegmentBoundary||ae(x.ca),H){Ve.B(4);break}if(!x.h.streaming.startAtSegmentBoundary){Ve.B(5);break}return me=x.i.presentationTimeline,oe=x.ca||x.g.currentTime,ge=me.Ob(),le=me.eb(),oe<ge?oe=ge:oe>le&&(oe=le),N(Ve,function(be,ke){var Ae,He,De,$e,je;return W(function(Ge){return Ge.g==1?(Ae=be.audio,He=be.video,De=function(Fe,rt){var Qe,Et,et;return W(function(it){return it.g==1?Fe?N(it,Fe.createSegmentIndex(),2):it.return(null):(Et=(Qe=Fe.segmentIndex.Mb(rt))?Qe.next().value:null)?(et=Et.startTime,it.return(et)):it.return(null)})},N(Ge,De(Ae,ke),2)):Ge.g!=3?($e=Ge.h,N(Ge,De(He,ke),3)):(je=Ge.h)!=null&&$e!=null?Ge.return(Math.max(je,$e)):je!=null?Ge.return(je):$e!=null?Ge.return($e):Ge.return(ke)})}(B,oe),6);case 6:Ee=Ve.h,ae(Ee);case 5:yg(x,B,!0,!1,0);case 4:return x.C.je(),x.ic().find(function(be){return be.active})||((ve=Jc(x.i.textStreams,x.jb,x.Mc,x.Lc)[0]||null)&&wn(x.u.h,ve,!0),B&&(ve?(B.audio&&function(be,ke,Ae){if(be.h.autoShowText==0)return!1;if(be.h.autoShowText==1)return!0;var He=dn(be.h.preferredTextLanguage);return Ae=dn(Ae.language),be.h.autoShowText==2?bu(Ae,He):be.h.autoShowText==3?(be=dn(ke.language),bu(Ae,He)&&!bu(be,Ae)):(Rt("Invalid autoShowText setting!"),!1)}(x,B.audio,ve)&&(x.ba=!0),x.ba&&x.F.F.setTextVisibility(!0),zy(x)):x.ba=!1),ve&&(x.h.streaming.alwaysStreamText||x.Ne())&&Vh(x.j,ve)),N(Ve,x.j.start(),7);case 7:x.h.abr.enabled&&(x.s.enable(),qy(x)),Ei(x),rc(x),x.i.variants.some(function(be){return be.primary}),(Be=x.R())&&(x.h.streaming.liveSync||x.i.serviceDescription)&&(_e=function(){return Ky(x)},x.o.D(D,"timeupdate",_e)),Be||(Ye=function(){return di(x)},x.o.D(D,"timeupdate",Ye),di(x)),x.A&&x.A.onManifestUpdated(Be),x.kb=!0,x.o.ka(D,"loadedmetadata",function(){x.u.m=Date.now()/1e3-C}),re(Ve)}})}(w,g),0)})},"loadInner_"),10);case 16:return N(k,p(function(){return W(function(I){return N(I,function(x,C,D){var _,j,F,B,H,Y,te,q,X,he;return W(function(ae){if(ae.g==1)return ds(x,"src-equals"),_=x.g,x.C=new ro(_),j=!1,x.Jc.push(function(){j=!0}),x.ca!=null&&x.C.ke(x.ca),x.J=new zu({Ed:function(){return _.playbackRate},ec:function(){return _.defaultPlaybackRate},rf:function(me){_.playbackRate=me},bg:function(me){_.currentTime+=me}}),F=x.h.streaming.rebufferingGoal,Rs(x,_,F),B=function(){return Mi(x)},H=function(){return gg(x)},x.o.D(_,"playing",B),x.o.D(_,"pause",B),x.o.D(_,"ended",B),x.o.D(_,"ratechange",H),_.preload!="none"&&x.o.ka(_,"loadedmetadata",function(){x.u.m=Date.now()/1e3-C}),_.audioTracks&&(x.o.D(_.audioTracks,"addtrack",function(){return Ei(x)}),x.o.D(_.audioTracks,"removetrack",function(){return Ei(x)}),x.o.D(_.audioTracks,"change",function(){return Ei(x)})),_.textTracks&&(x.o.D(_.textTracks,"addtrack",function(me){if(me.track)switch(me=me.track,me.kind){case"metadata":(function(oe,ge){if(ge.kind=="metadata"){ge.mode="hidden",oe.o.D(ge,"cuechange",function(){if(ge.activeCues)for(var Ee=T(ge.activeCues),ve=Ee.next();!ve.done;ve=Ee.next())ve=ve.value,Ho(oe,ve.startTime,ve.endTime,ve.type,ve.value),oe.A&&oe.A.onCueMetadataChange(ve.value)});var le=new Qt(function(){for(var Ee=function(Be){return Array.from(Be.g.textTracks).filter(function(_e){return _e.kind=="metadata"})}(oe),ve=(Ee=T(Ee)).next();!ve.done;ve=Ee.next())ve.value.mode="hidden"}).qc().U(.5);oe.Jc.push(function(){le.stop()})}})(x,me);break;case"chapters":Kl(x,me);break;default:Ei(x)}}),x.o.D(_.textTracks,"removetrack",function(){return Ei(x)}),x.o.D(_.textTracks,"change",function(){return Ei(x)})),_.src=function(me,oe,ge){try{if(!me.g.enabled)return oe;var le=ao(me);e:{switch(ge.toLowerCase()){case"audio/mp4":case"audio/webm":case"audio/ogg":case"audio/mpeg":case"audio/aac":case"audio/flac":case"audio/wav":var Ee=Vl;break e;case"video/webm":case"video/mp4":case"video/mpeg":case"video/mp2t":Ee=Yh;break e;case"application/x-mpegurl":case"application/vnd.apple.mpegurl":case"application/dash+xml":case"video/vnd.mpeg.dash.mpd":case"application/vnd.ms-sstr+xml":Ee=vd;break e}Ee=void 0}return le.ot=Ee,le.su=!0,Zu(oe,Bo(le))}catch(ve){return Lr("CMCD_SRC_ERROR","Could not generate src CMCD data.",ve),oe}}(x.V,x.ga,D),(Tu()||Su())&&_.load(),_.preload!="none"&&!_.autoplay&&zc(D)&&Au()&&_.load(),x.l=fn,x.dispatchEvent(An("streaming")),Y=new Pn,Bl(_,HTMLMediaElement.HAVE_METADATA,x.o,function(){x.C.je(),Y.resolve()}),Bl(_,HTMLMediaElement.HAVE_CURRENT_DATA,x.o,function(){var me;return W(function(oe){return oe.g==1?(function(ge){var le=ge.h.preferredAudioLanguage;le!=""&&ge.jg(le,ge.h.preferredVariantRole)}(x),(me=tc(x)).find(function(ge){return ge.mode!="disabled"})?(0<me.length&&(x.ba=!0),oe.B(2)):N(oe,new Promise(function(ge){x.o.ka(_.textTracks,"change",ge),new Qt(ge).U(1)}),2)):j?oe.return():(function(ge){var le=ge.h.preferredTextLanguage;le!=""&&ge.kf(le,ge.h.preferredTextRole,ge.h.preferForcedSubs)}(x),void re(oe))})}),_.error?Y.reject(Wy(x)):_.preload=="none"&&(Rt('With <video preload="none">, the browser will not load anything until play() is called. We are unable to measure load latency in a meaningful way, and we cannot provide track info yet. Please do not use preload="none" with Shaka Player.'),Y.resolve()),x.o.ka(_,"error",function(){Y.reject(Wy(x))}),N(ae,Y,2);(te=x.R())&&x.h.streaming.liveSync&&(q=function(){return Ky(x)},x.o.D(_,"timeupdate",q)),te||(X=function(){return di(x)},x.o.D(_,"timeupdate",X),di(x)),x.A&&(x.A.onManifestUpdated(te),te&&(he=x.Bb().end,x.o.D(_,"progress",function(){var me=x.Bb().end;he!=me&&(x.A.onManifestUpdated(x.R()),he=me)}))),x.kb=!0,re(ae)})}(w,g,i),0)})},"srcEqualsInner_"),10);case 10:w.dispatchEvent(An("loaded")),ce(k,0);break;case 5:if((b=we(k)).code==7e3){k.B(18);break}return N(k,w.rc(!1),18);case 18:throw b}})},c.Nh=function(){for(var e=this.W;e.g;)e.release()},c.configure=function(e,n){arguments.length==2&&typeof e=="string"&&(e=cg(e,n)),e.streaming&&"forceTransmuxTS"in e.streaming&&(Ss("streaming.forceTransmuxTS configuration","Please Use mediaSource.forceTransmux instead."),e.mediaSource.mediaSource=e.streaming.forceTransmuxTS,delete e.streaming.forceTransmuxTS),e.streaming&&"forceTransmux"in e.streaming&&(Ss("streaming.forceTransmux configuration","Please Use mediaSource.forceTransmux instead."),e.mediaSource.mediaSource=e.streaming.forceTransmux,delete e.streaming.forceTransmux),e.streaming&&e.streaming.lowLatencyMode&&(e.streaming.inaccurateManifestTolerance==null&&(e.streaming.inaccurateManifestTolerance=0),e.streaming.rebufferingGoal==null&&(e.streaming.rebufferingGoal=.01),e.streaming.segmentPrefetchLimit==null&&(e.streaming.segmentPrefetchLimit=2),e.streaming.retryParameters==null&&(e.streaming.retryParameters={}),e.streaming.retryParameters.baseDelay==null&&(e.streaming.retryParameters.baseDelay=100),e.manifest==null&&(e.manifest={}),e.manifest.retryParameters==null&&(e.manifest.retryParameters={}),e.manifest.retryParameters.baseDelay==null&&(e.manifest.retryParameters.baseDelay=100),e.drm==null&&(e.drm={}),e.drm.retryParameters==null&&(e.drm.retryParameters={}),e.drm.retryParameters.baseDelay==null&&(e.drm.retryParameters.baseDelay=100));var i=Sd(this.h,e,Js(this));return wd(this),i},c.getConfiguration=function(){var e=Js(this);return Sd(e,this.h,Js(this)),e},c.Rg=function(){if(this.g){var e=this.g.buffered.length;e=e?this.g.buffered.end(e-1):0;var n=this.getConfiguration().streaming.bufferingGoal;if(e>=(n=Math.min(this.g.currentTime+n,this.Bb().end)))return 1;if(!(e<=this.g.currentTime)&&e<n)return(e-this.g.currentTime)/(n-this.g.currentTime)}return 0},c.Rh=function(){for(var e in this.h)delete this.h[e];Sd(this.h,Js(this),Js(this)),wd(this)},c.Yg=function(){return this.l},c.Ie=function(){return this.i?this.i.type:null},c.bh=function(){return this.g},c.Nb=function(){return this.H},c.He=function(){return this.ga},c.Of=function(){return this.A?this.A:null},c.R=function(){return this.i?this.i.presentationTimeline.R():!(!this.g||!this.g.src)&&this.g.duration==1/0},c.Rb=function(){return!!this.i&&this.i.presentationTimeline.Rb()},c.th=function(){if(this.i){var e=this.i.variants;return!!e.length&&!e[0].video}return!(!this.g||!this.g.src)&&(this.g.videoTracks?this.g.videoTracks.length==0:this.g.videoHeight==0)},c.Bb=function(){if(this.i){if(!this.kb&&this.i.type=="HLS")return{start:0,end:0};var e=this.i.presentationTimeline;return{start:e.Ob(),end:e.eb()}}return this.g&&this.g.src&&(e=this.g.seekable).length?{start:e.start(0),end:e.end(e.length-1)}:{start:0,end:0}},c.qh=function(){this.R()&&(this.g.currentTime=this.Bb().end)},c.keySystem=function(){var e=this.drmInfo();return e?e.keySystem:""},c.drmInfo=function(){return this.m?this.m.g:null},c.Sc=function(){return this.m?this.m.Sc():1/0},c.Ge=function(){return this.m?this.m.Ge():[]},c.Bd=function(){return this.m?this.m.Bd():{}},c.Le=function(){return!!this.L&&this.L.g==yi},c.Cd=function(){return this.g?this.J?this.J.i:1:0},c.xf=function(e){var n=this;e==0?Rt("A trick play rate of 0 is unsupported!"):(this.Aa.$a(),this.g.paused&&this.g.play(),this.J.set(e),this.l==hi&&(this.s.playbackRateChanged(e),gd(this.j,1<Math.abs(e))),this.R()&&this.Aa.D(this.g,"timeupdate",function(){var i=n.g.currentTime,o=n.Bb(),h=n.h.streaming.safeSeekOffset;0<e?Math.floor(i)>=Math.floor(o.end)&&n.ud():Math.floor(i)<=Math.floor(o.start+h)&&n.ud()}))},c.ud=function(){var e=this.J.ec();this.l==fn&&this.J.set(e),this.l==hi&&(this.J.set(e),this.s.playbackRateChanged(e),gd(this.j,!1)),this.Aa.$a()},c.zb=function(){if(this.i){for(var e=this.j?this.j.j:null,n=[],i=0,o=T(this.i.variants),h=o.next();!h.done;h=o.next())if(Th(h=h.value)){var p=Xc(h);p.active=h==e,p.active||i==1||e==null||h.video!=e.video||h.audio!=e.audio||(p.active=!0),p.active&&i++,n.push(p)}return n}return this.g&&this.g.audioTracks?Array.from(this.g.audioTracks).map(function(g){return Iu(g)}):[]},c.ic=function(){if(this.i){for(var e=this.j?this.j.o:null,n=[],i=T(this.i.textStreams),o=i.next();!o.done;o=i.next()){var h=Ep(o=o.value);h.active=o==e,n.push(h)}return n}return this.g&&this.g.src&&this.g.textTracks?tc(this).map(function(p){return es(p)}):[]},c.Wg=function(){var e=this.Qc;return this.i&&(e=this.i.imageStreams),e.map(function(n){return ty(n)})},c.Og=function(e){var n,i,o,h,p=this;return W(function(g){return g.g==1?p.l!=hi&&p.l!=fn?g.return(null):(n=p.Qc,p.i&&(n=p.i.imageStreams),(i=n.find(function(b){return b.id==e}))?i.segmentIndex?g.B(2):N(g,i.createSegmentIndex(),2):g.return(null)):g.g!=4?(o=[],i.segmentIndex.bc(function(b){var w=ka(b.tilesLayout||i.tilesLayout);if(w){w=w.rows*w.Jb;for(var k=b.j-b.startTime,I=0;I<w;I++)o.push(p.Tf(e,b.startTime+k*I/w))}}),N(g,Promise.all(o),4)):(h=g.h,g.return(h.filter(function(b){return b})))})},c.Tf=function(e,n){var i,o,h,p,g,b,w,k,I,x,C,D,_,j,F,B,H,Y,te=this;return W(function(q){return q.g==1?te.l!=hi&&te.l!=fn?q.return(null):(i=te.Qc,te.i&&(i=te.i.imageStreams),(o=i.find(function(X){return X.id==e}))?o.segmentIndex?q.B(2):N(q,o.createSegmentIndex(),2):q.return(null)):(h=o.segmentIndex.find(n))==null?q.return(null):(p=o.segmentIndex.get(h),(g=ka(p.tilesLayout||o.tilesLayout))?(b=o.width||0,w=o.height||0,k=b/g.Jb,I=w/g.rows,x=g.Jb*g.rows,C=p.j-p.startTime,D=p.C||C/x,_=p.startTime,F=j=0,1<x&&(B=Math.floor((n-p.startTime)/D),_=p.startTime+B*D,j=B%g.Jb*k,F=Math.floor(B/g.Jb)*I),H=!1,(Y=p.A)&&(H=!0,I=Y.height,j=Y.positionX,F=Y.positionY,k=Y.width),q.return({segment:p,imageHeight:w,imageWidth:b,height:I,positionX:j,positionY:F,startTime:_,duration:D,uris:p.Z(),width:k,sprite:H})):q.return(null))})},c.kg=function(e){if(this.i&&this.j){var n=this.i.textStreams.find(function(o){return o.id==e.id});n&&n!=this.j.o&&(wn(this.u.h,n,!1),Vh(this.j,n),Vo(this),this.jb=n.language)}else if(this.g&&this.g.src&&this.g.textTracks){for(var i=(n=T(n=tc(this))).next();!i.done;i=n.next())ny(i=i.value)==e.id?i.mode=this.ba?"showing":"hidden":i.mode="disabled";Vo(this)}},c.lf=function(e,n,i){if(n=n!==void 0&&n,i=i===void 0?0:i,this.i&&this.j){this.h.abr.enabled&&Rt("Changing tracks while abr manager is enabled will likely result in the selected track being overriden. Consider disabling abr before calling selectVariantTrack().");var o=this.i.variants.find(function(h){return h.id==e.id});o&&Th(o)&&(yg(this,o,!1,n,i),this.Fa=new ay(o,this.h.mediaSource.codecSwitchingStrategy,this.h.manifest.dash.enableAudioGroups),rc(this))}else if(this.g&&this.g.audioTracks){for(i=(n=T(n=Array.from(this.g.audioTracks))).next();!i.done;i=n.next())if(ny(i=i.value)==e.id){lo(this,i);break}}},c.Qg=function(){return Xy(this.zb())},c.jh=function(){return Xy(this.ic())},c.Pg=function(){return Array.from(Qy(this.zb()))},c.ih=function(){return Array.from(Qy(this.ic()))},c.jg=function(e,n,i,o){if(i=i===void 0?0:i,o=o===void 0?0:o,this.i&&this.C){this.Fa=new Ru(e,n||"",i,"",!1,"","","",this.h.mediaSource.codecSwitchingStrategy,this.h.manifest.dash.enableAudioGroups),e=function(g,b){return g.video||b.video?g.video&&b.video?Math.abs((g.video.height||0)-(b.video.height||0))+Math.abs((g.video.width||0)-(b.video.width||0)):1/0:0},n=this.j.j;var h=this.Fa.create(this.i.variants);i=null;for(var p=(h=T(h.values())).next();!p.done;p=h.next())p=p.value,(!i||e(i,n)>e(p,n))&&(i=p);i?(e=Xc(i),this.lf(e,!0,o)):ic(this)}else this.g&&this.g.audioTracks&&(o=Jc(this.zb(),e,n||"",!1)[0])&&this.lf(o)},c.kf=function(e,n,i){i=i!==void 0&&i,this.i&&this.C?(this.jb=e,this.Mc=n||"",this.Lc=i,(e=Jc(this.i.textStreams,this.jb,this.Mc,this.Lc)[0]||null)&&e!=this.j.o&&(wn(this.u.h,e,!1),this.h.streaming.alwaysStreamText||this.Ne())&&(Vh(this.j,e),Vo(this))):(e=Jc(this.ic(),e,n||"",i)[0])&&this.kg(e)},c.Xh=function(e,n,i){if(n=n===void 0||n,i=i===void 0?0:i,this.i&&this.C){for(var o=null,h=T(this.i.variants),p=h.next();!p.done;p=h.next())if((p=p.value).audio.label==e){o=p;break}o!=null&&(this.Fa=new Ru(o.language,"",0,"",!1,"",e,"",this.h.mediaSource.codecSwitchingStrategy,this.h.manifest.dash.enableAudioGroups),ic(this,n,i))}else if(this.g&&this.g.audioTracks){for(n=null,o=(i=T(i=Array.from(this.g.audioTracks))).next();!o.done;o=i.next())(o=o.value).label==e&&(n=o);n&&lo(this,n)}},c.Ne=function(){var e=this.ba;return this.F&&this.l==hi?this.F.F.isTextVisible():this.g&&this.g.src&&this.g.textTracks?tc(this).some(function(n){return n.mode=="showing"}):e},c.Pf=function(){return this.g&&this.g.src&&this.g.textTracks?fg(this).map(function(e){return es(e)}):[]},c.Sg=function(e){if(!this.g||!this.g.src||!this.g.textTracks)return[];var n=dn(e),i=fg(this).filter(function(b){return dn(b.language)==n});if(!i||!i.length)return[];e=[];for(var o=new Set,h=(i=T(i)).next();!h.done;h=i.next())if((h=h.value)&&h.cues)for(var p=(h=T(h.cues)).next();!p.done;p=h.next()){var g=p.value;(p=g.id)&&p!=""||(p=g.startTime+"-"+g.endTime+"-"+g.text),g={id:p,title:g.text,startTime:g.startTime,endTime:g.endTime},o.has(p)||(e.push(g),o.add(p))}return e},c.pg=function(e){if(e=!!e,this.ba!=e){if(this.ba=e,this.l==hi)this.F.F.setTextVisibility(e),this.h.streaming.alwaysStreamText||(e?this.j.o||0<(e=Jc(this.i.textStreams,this.jb,this.Mc,this.Lc)).length&&(Vh(this.j,e[0]),Vo(this)):function(o){var h=o.i.get(en);h&&(Xu(h),md(h).catch(function(){}),o.i.delete(en)),o.o=null}(this.j));else if(this.g&&this.g.src&&this.g.textTracks)for(var n=tc(this),i=(n=T(n)).next();!i.done;i=n.next())(i=i.value).mode!="disabled"&&(i.mode=e?"showing":"hidden");zy(this)}},c.eh=function(){if(!this.R())return null;if(this.C)var e=this.C.qd();else{if(this.ca==null)return new Date;e=this.ca}if(this.i){var n=this.i.presentationTimeline;return new Date(1e3*((n.C||n.i)+e))}return this.g&&this.g.getStartDate?(n=this.g.getStartDate(),isNaN(n.getTime())?null:new Date(n.getTime()+1e3*e)):null},c.Sf=function(){if(!this.R())return null;if(this.i)return new Date(1e3*this.i.presentationTimeline.i);if(this.g&&this.g.getStartDate){var e=this.g.getStartDate();return isNaN(e.getTime())?null:e}return null},c.nb=function(){if(this.l==hi)return this.F.nb();var e={total:[],audio:[],video:[],text:[]};return this.l==fn&&(e.total=No(this.g.buffered)),e},c.getStats=function(){if(this.l!=hi&&this.l!=fn)return{width:NaN,height:NaN,streamBandwidth:NaN,decodedFrames:NaN,droppedFrames:NaN,corruptedFrames:NaN,stallsDetected:NaN,gapsJumped:NaN,estimatedBandwidth:NaN,completionPercent:NaN,loadLatency:NaN,manifestTimeSeconds:NaN,drmTimeSeconds:NaN,playTime:NaN,pauseTime:NaN,bufferingTime:NaN,licenseTime:NaN,liveLatency:NaN,maxSegmentDuration:NaN,switchHistory:[],stateHistory:[]};Mi(this);var e=this.g,n=e.currentTime/e.duration;if(!isNaN(n)){var i=this.u;n=Math.round(100*n),i.i=isNaN(i.i)?n:Math.max(i.i,n)}if(this.C&&(this.u.L=this.C.Af(),this.u.N=this.C.Bf()),e.getVideoPlaybackQuality){i=e.getVideoPlaybackQuality(),n=this.u;var o=Number(i.totalVideoFrames);n.K=Number(i.droppedVideoFrames),n.J=o,this.u.H=Number(i.corruptedVideoFrames)}if(i=this.m&&(i=this.m).J?i.J:NaN,this.u.s=i,this.l==hi){if(i=this.j.j,n=this.j.o,i){var h=(o=this.J?this.J.i:1)*i.bandwidth;n&&n.bandwidth&&(h+=o*n.bandwidth),this.u.A=h}i&&i.video&&(n=this.u,o=i.video.height||NaN,n.o=i.video.width||NaN,n.l=o),this.R()&&(i=this.Sf().valueOf()+1e3*e.currentTime,this.u.C=(Date.now()-i)/1e3),this.i&&this.i.presentationTimeline&&(this.u.G=this.i.presentationTimeline.g),i=this.s.getBandwidthEstimate(),this.u.u=i}this.l==fn&&(i=this.u,n=e.videoHeight||NaN,i.o=e.videoWidth||NaN,i.l=n);var p=this.u;e=p.o,i=p.l,n=p.A,o=p.J,h=p.K;for(var g=p.H,b=p.N,w=p.L,k=p.u,I=p.i,x=p.m,C=p.F,D=p.j,_=Sr(p.g,"playing"),j=Sr(p.g,"paused"),F=Sr(p.g,"buffering"),B=p.s,H=p.C,Y=p.G,te=function(he){function ae(le){return{timestamp:le.timestamp,state:le.state,duration:le.duration}}for(var me=[],oe=T(he.h),ge=oe.next();!ge.done;ge=oe.next())me.push(ae(ge.value));return he.g&&me.push(ae(he.g)),me}(p.g),q=[],X=(p=T(p.h.g)).next();!X.done;X=p.next())X=X.value,q.push({timestamp:X.timestamp,id:X.id,type:X.type,fromAdaptation:X.fromAdaptation,bandwidth:X.bandwidth});return{width:e,height:i,streamBandwidth:n,decodedFrames:o,droppedFrames:h,corruptedFrames:g,stallsDetected:b,gapsJumped:w,estimatedBandwidth:k,completionPercent:I,loadLatency:x,manifestTimeSeconds:C,drmTimeSeconds:D,playTime:_,pauseTime:j,bufferingTime:F,licenseTime:B,liveLatency:H,maxSegmentDuration:Y,stateHistory:te,switchHistory:q}},c.Cg=function(e,n,i,o,h,p,g){g=g!==void 0&&g;var b,w,k,I,x,C,D,_,j,F,B=this;return W(function(H){switch(H.g){case 1:if(B.l!=hi&&B.l!=fn)throw new fe(1,7,7004);if(i!="subtitles"&&i!="captions"&&Rt("Using a kind value different of `subtitles` or `captions` can cause unwanted issues."),o){H.B(2);break}return N(H,Ad(B,e),3);case 3:o=H.h;case 2:if(b=[],B.A&&(b=B.A.getCuePoints()),B.l!=fn){H.B(4);break}return g&&(i="forced"),N(H,Jh(B,e,n,i,o,p||"",b),5);case 5:if(w=dn(n),k=B.ic(),I=k.find(function(Y){return dn(Y.language)==w&&Y.label==(p||"")&&Y.kind==i}))return Ei(B),H.return(I);throw new fe(1,2,2012);case 4:if(x=_r,C=B.g.duration,B.i&&(C=B.i.presentationTimeline.getDuration()),C==1/0)throw new fe(1,4,4033);if(!b.length){H.B(6);break}return N(H,oo(B,e,B.H,B.h.streaming.retryParameters),7);case 7:D=H.h,_=Zh(B,D,o,b),j=new Blob([_],{type:"text/vtt"}),e=Bh(j),o="text/vtt";case 6:if(F={id:B.Ze++,originalId:null,groupId:null,createSegmentIndex:function(){return Promise.resolve()},segmentIndex:io(0,C,[e]),mimeType:o||"",codecs:h||"",kind:i,encrypted:!1,drmInfos:[],keyIds:new Set,language:n,originalLanguage:n,label:p||null,type:x.ia,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],forced:!!g,channelsCount:null,audioSamplingRate:null,spatialAudio:!1,closedCaptions:null,accessibilityPurpose:null,external:!0,fastSwitching:!1,fullMimeTypes:new Set([Er(o||"",h||"")])},!xl(Er(F.mimeType,F.codecs)))throw new fe(2,2,2014,o);return B.i.textStreams.push(F),Ei(B),H.return(Ep(F))}})},c.Dg=function(e,n){var i,o,h,p,g,b,w,k,I,x,C,D,_,j,F,B,H=this;return W(function(Y){switch(Y.g){case 1:if(H.l!=hi&&H.l!=fn)throw new fe(1,7,7004);if(n){Y.B(2);break}return N(Y,Ad(H,e),3);case 3:n=Y.h;case 2:if(n!="text/vtt")throw new fe(1,2,2017,e);if(i=_r,o=H.g.duration,H.i&&(o=H.i.presentationTimeline.getDuration()),o==1/0)throw new fe(1,4,4045);return N(Y,oo(H,e,H.H,H.h.streaming.retryParameters),4);case 4:if(h=Y.h,!(p=zn[n]))throw new fe(2,2,2014,n);for(g=p(),b={periodStart:0,segmentStart:0,segmentEnd:o,vttOffset:0},w=Nt(h),k=g.parseMedia(w,b,e),I=[],x={},C=T(k),D=C.next();!D.done;x={Fc:x.Fc,Gb:x.Gb},D=C.next())x.Gb=D.value,x.Fc=null,_=function(te){return function(){return te.Fc==null&&(te.Fc=Rr([e],[te.Gb.payload])),te.Fc||[]}}(x),j=new wt(x.Gb.startTime,x.Gb.endTime,_,0,null,null,0,0,1/0),x.Gb.payload.includes("#xywh")&&(F=x.Gb.payload.split("#xywh=")[1].split(",")).length===4&&j.qg({height:parseInt(F[3],10),positionX:parseInt(F[0],10),positionY:parseInt(F[1],10),width:parseInt(F[2],10)}),I.push(j);return B={id:H.Ze++,originalId:null,groupId:null,createSegmentIndex:function(){return Promise.resolve()},segmentIndex:new Xt(I),mimeType:n||"",codecs:"",kind:"",encrypted:!1,drmInfos:[],keyIds:new Set,language:"und",originalLanguage:null,label:null,type:i.ie,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],forced:!1,channelsCount:null,audioSamplingRate:null,spatialAudio:!1,closedCaptions:null,tilesLayout:"1x1",accessibilityPurpose:null,external:!0,fastSwitching:!1,fullMimeTypes:new Set([Er(n||"","")])},H.l==fn?H.Qc.push(B):H.i.imageStreams.push(B),Ei(H),Y.return(ty(B))}})},c.Bg=function(e,n,i){var o,h,p,g,b=this;return W(function(w){switch(w.g){case 1:if(b.l!=hi&&b.l!=fn)throw new fe(1,7,7004);if(i){w.B(2);break}return N(w,Ad(b,e),3);case 3:i=w.h;case 2:return o=[],b.A&&(o=b.A.getCuePoints()),N(w,Jh(b,e,n,"chapters",i,"",o),4);case 4:if(h=w.h,p=b.Pf(),!(g=p.find(function(k){return k.language==n}))){w.B(5);break}return N(w,new Promise(function(k,I){b.o.ka(h,"load",k),b.o.ka(h,"error",function(){I(new fe(1,2,2015))})}),6);case 6:return Ei(b),w.return(g);case 5:throw new fe(1,2,2012)}})},c.qf=function(e,n){this.Kd.width=e,this.Kd.height=n},c.gf=function(e){if(this.l==hi){var n=this.j;if(e=e===void 0?.1:e,n.l.g)n=!1;else if(n.s)n=!1;else{for(var i=T(n.i.values()),o=i.next();!o.done;o=i.next())!(o=o.value).Vc||o.Ea||o.ib||(o.Vc=!1,Yn(n,o,e));n=!0}}else n=!1;return n},c.Zg=function(){return Rt("Shaka Player's internal Manifest structure is NOT covered by semantic versioning compatibility guarantees.  It may change at any time!  Please consider filing a feature request for whatever you use getManifest() for."),this.i},c.$g=function(){return this.Md},c.sg=function(e){this.xd=e},c.wd=function(e,n){if(!this.h.abr.enabled||this.l===Zs||!navigator.onLine)return!1;if(this.i.variants.some(function(p){return!(!(p=p[e.type])||p.id===e.id||e.type=="audio"&&e.language!==p.language)})){for(var i=T(this.i.variants),o=i.next();!o.done;o=i.next()){var h=(o=o.value)[e.type];h&&h.id===e.id&&(o.disabledUntilTime=Date.now()/1e3+n)}return this.zd.Ra(1),ic(this,!0,n=this.nb().video.reduce(function(p,g){return p+g.end-g.start},0),!0,!1),!0}return!1},We("shaka.Player",Oe),Oe.prototype.setVideoContainer=Oe.prototype.sg,Oe.prototype.getManifestParserFactory=Oe.prototype.$g,Oe.prototype.getManifest=Oe.prototype.Zg,Oe.prototype.retryStreaming=Oe.prototype.gf,Oe.prototype.setMaxHardwareResolution=Oe.prototype.qf,Oe.prototype.addChaptersTrack=Oe.prototype.Bg,Oe.prototype.addThumbnailsTrack=Oe.prototype.Dg,Oe.prototype.addTextTrackAsync=Oe.prototype.Cg,Oe.prototype.getStats=Oe.prototype.getStats,Oe.prototype.getBufferedInfo=Oe.prototype.nb,Oe.prototype.getPresentationStartTimeAsDate=Oe.prototype.Sf,Oe.prototype.getPlayheadTimeAsDate=Oe.prototype.eh,Oe.prototype.setTextTrackVisibility=Oe.prototype.pg,Oe.prototype.getChapters=Oe.prototype.Sg,Oe.prototype.getChaptersTracks=Oe.prototype.Pf,Oe.prototype.isTextTrackVisible=Oe.prototype.Ne,Oe.prototype.selectVariantsByLabel=Oe.prototype.Xh,Oe.prototype.selectTextLanguage=Oe.prototype.kf,Oe.prototype.selectAudioLanguage=Oe.prototype.jg,Oe.prototype.getTextLanguages=Oe.prototype.ih,Oe.prototype.getAudioLanguages=Oe.prototype.Pg,Oe.prototype.getTextLanguagesAndRoles=Oe.prototype.jh,Oe.prototype.getAudioLanguagesAndRoles=Oe.prototype.Qg,Oe.prototype.selectVariantTrack=Oe.prototype.lf,Oe.prototype.selectTextTrack=Oe.prototype.kg,Oe.prototype.getThumbnails=Oe.prototype.Tf,Oe.prototype.getAllThumbnails=Oe.prototype.Og,Oe.prototype.getImageTracks=Oe.prototype.Wg,Oe.prototype.getTextTracks=Oe.prototype.ic,Oe.prototype.getVariantTracks=Oe.prototype.zb,Oe.prototype.cancelTrickPlay=Oe.prototype.ud,Oe.prototype.trickPlay=Oe.prototype.xf,Oe.prototype.getPlaybackRate=Oe.prototype.Cd,Oe.prototype.isBuffering=Oe.prototype.Le,Oe.prototype.getKeyStatuses=Oe.prototype.Bd,Oe.prototype.getActiveSessionsMetadata=Oe.prototype.Ge,Oe.prototype.getExpiration=Oe.prototype.Sc,Oe.prototype.drmInfo=Oe.prototype.drmInfo,Oe.prototype.keySystem=Oe.prototype.keySystem,Oe.prototype.goToLive=Oe.prototype.qh,Oe.prototype.seekRange=Oe.prototype.Bb,Oe.prototype.isAudioOnly=Oe.prototype.th,Oe.prototype.isInProgress=Oe.prototype.Rb,Oe.prototype.isLive=Oe.prototype.R,Oe.prototype.getAdManager=Oe.prototype.Of,Oe.prototype.getAssetUri=Oe.prototype.He,Oe.prototype.getNetworkingEngine=Oe.prototype.Nb,Oe.prototype.getMediaElement=Oe.prototype.bh,Oe.prototype.getManifestType=Oe.prototype.Ie,Oe.prototype.getLoadMode=Oe.prototype.Yg,Oe.prototype.resetConfiguration=Oe.prototype.Rh,Oe.prototype.getBufferFullness=Oe.prototype.Rg,Oe.prototype.getConfiguration=Oe.prototype.getConfiguration,Oe.prototype.configure=Oe.prototype.configure,Oe.prototype.releaseAllMutexes=Oe.prototype.Nh,Oe.prototype.load=Oe.prototype.load,Oe.prototype.updateStartTime=Oe.prototype.fi,Oe.prototype.unload=Oe.prototype.rc,Oe.prototype.detach=Oe.prototype.detach,Oe.prototype.attachCanvas=Oe.prototype.Fg,Oe.prototype.attach=Oe.prototype.Kc,Oe.probeSupport=function(e){var n,i,o,h,p;return e=e===void 0||e,W(function(g){if(g.g==1)return n={},e?N(g,function(){var x,C,D,_,j,F;return W(function(B){return B.g==1?(x="org.w3.clearkey com.widevine.alpha com.microsoft.playready com.microsoft.playready.recommendation com.apple.fps.1_0 com.apple.fps com.adobe.primetime".split(" "),D=[{videoCapabilities:C=[{contentType:'video/mp4; codecs="avc1.42E01E"'},{contentType:'video/webm; codecs="vp8"'}],persistentState:"required",sessionTypes:["persistent-license"]},{initDataTypes:["cenc"],videoCapabilities:C}],_=new Map,j=function(H){var Y,te,q;return W(function(X){switch(X.g){case 1:if(ne(X,2),H==="org.w3.clearkey"&&Au())throw Error("Unsupported keySystem");return N(X,navigator.requestMediaKeySystemAccess(H,D),4);case 4:return Y=X.h,q=!!(te=Y.getConfiguration().sessionTypes)&&te.includes("persistent-license"),yh()&&(q=!1),_.set(H,{persistentState:q}),N(X,Y.createMediaKeys(),5);case 5:ce(X,0);break;case 2:we(X),_.set(H,null),re(X)}})},F=x.map(function(H){return j(H)}),N(B,Promise.all(F),2)):B.return(kp(_))})}(),3):g.B(2);g.g!=2&&(n=g.h);var b={};if(ya())for(var w in ks)b[w]=!0;for(var k=(w=T(["application/dash+xml","application/x-mpegurl","application/vnd.apple.mpegurl","application/vnd.ms-sstr+xml"])).next();!k.done;k=w.next())b[k=k.value]=ya()?!!ks[k]:Eu(k);for(i=b,b={},k=(w=T(w='video/mp4; codecs="avc1.42E01E",video/mp4; codecs="avc3.42E01E",video/mp4; codecs="hev1.1.6.L93.90",video/mp4; codecs="hvc1.1.6.L93.90",video/mp4; codecs="hev1.2.4.L153.B0"; eotf="smpte2084",video/mp4; codecs="hvc1.2.4.L153.B0"; eotf="smpte2084",video/mp4; codecs="vp9",video/mp4; codecs="vp09.00.10.08",video/mp4; codecs="av01.0.01M.08",video/mp4; codecs="dvh1.20.01",audio/mp4; codecs="mp4a.40.2",audio/mp4; codecs="ac-3",audio/mp4; codecs="ec-3",audio/mp4; codecs="ac-4",audio/mp4; codecs="opus",audio/mp4; codecs="flac",audio/mp4; codecs="dtsc",audio/mp4; codecs="dtse",audio/mp4; codecs="dtsx",video/webm; codecs="vp8",video/webm; codecs="vp9",video/webm; codecs="vp09.00.10.08",audio/webm; codecs="vorbis",audio/webm; codecs="opus",video/mp2t; codecs="avc1.42E01E",video/mp2t; codecs="avc3.42E01E",video/mp2t; codecs="hvc1.1.6.L93.90",video/mp2t; codecs="mp4a.40.2",video/mp2t; codecs="ac-3",video/mp2t; codecs="ec-3",text/vtt,application/mp4; codecs="wvtt",application/ttml+xml,application/mp4; codecs="stpp"'.split(",").concat(M(Ga)))).next();!k.done;k=w.next()){b[k=k.value]=!!xl(k)||(ya()?Dn(k)||!!wo(k):Eu(k));var I=k.split(";")[0];b[I]=b[I]||b[k]}for(p in o={manifest:i,media:b,drm:n},h=Sg)o[p]=h[p]();return g.return(o)})},Oe.isBrowserSupported=function(){if(s.Promise||Rt("A Promise implementation or polyfill is required"),!(s.Promise&&s.Uint8Array&&Array.prototype.forEach)||Nn("Trident/"))return!1;var e=Au();return!(e&&9>e||!(s.MediaKeys&&s.navigator&&s.navigator.requestMediaKeySystemAccess&&s.MediaKeySystemAccess&&s.MediaKeySystemAccess.prototype.getConfiguration))&&(!!ya()||Eu("application/x-mpegurl"))},Oe.setAdManagerFactory=function(e){wg=e},Oe.registerSupportPlugin=function(e,n){Sg[e]=n},Oe.prototype.destroy=Oe.prototype.destroy;var Zs=0,zl=1,hi=2,fn=3;Oe.LoadMode={DESTROYED:Zs,NOT_LOADED:zl,MEDIA_SOURCE:hi,SRC_EQUALS:fn},Oe.version="v4.7.15";var Tg=["4","7"];sy=new function(e){this.g=e,this.i=Lu,this.h=X0}(new wh(Number(Tg[0]),Number(Tg[1])));var E1=["output-restricted","internal-error"],Sg={},wg=null;function T1(){this.h=[],this.j=this.i=this.g=0}function At(e,n,i){var o=this;this.g=e,this.h=n,this.j=i,this.i=!1,this.l=this.h.getVolume(),this.m=new mn,this.m.D(this.h,google.ima.AdEvent.Type.PAUSED,function(){o.i=!0}),this.m.D(this.h,google.ima.AdEvent.Type.RESUMED,function(){o.i=!1})}function qo(e,n,i,o,h){var p=this;this.o=e,this.i=n,this.F=!1,this.u=this.s=null,this.G=NaN,this.m=h,this.j=null,this.h=new mn,google.ima.settings.setLocale(i),google.ima.settings.setDisableCustomPlaybackForIOS10Plus(!0),this.C=new google.ima.AdDisplayContainer(this.o,this.i),this.C.initialize(),this.l=new google.ima.AdsLoader(this.C),this.l.getSettings().setPlayerType("shaka-player"),this.l.getSettings().setPlayerVersion("v4.7.15"),this.g=null,this.A=o||new google.ima.AdsRenderingSettings,this.h.D(this.l,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,function(g){(function(b,w){if(b.m(new dt("ads-loaded",new Map().set("loadTime",Date.now()/1e3-b.G))),b.s.customPlayheadTracker){var k={currentTime:b.i.currentTime};b.g=w.getAdsManager(k,b.A),b.i.muted?b.g.setVolume(0):b.g.setVolume(b.i.volume),b.h.D(b.i,"timeupdate",function(){b.i.duration&&(k.currentTime=b.i.currentTime)}),b.h.D(b.i,"volumechange",function(){b.j&&(b.j.setVolume(b.i.volume),b.i.muted&&b.j.setMuted(!0))})}else b.g=w.getAdsManager(b.i,b.A);b.m(new dt("ima-ad-manager-loaded",new Map().set("imaAdManager",b.g)));var I=b.g.getCuePoints();if(I.length){w=[];for(var x=(I=T(I)).next();!x.done;x=I.next())w.push({start:x.value,end:null});b.m(new dt("ad-cue-points-changed",new Map().set("cuepoints",w)))}(function(C){function D(_,j){_=new Map().set("originalEvent",_),C.m(new dt(j,_))}C.h.D(C.g,google.ima.AdErrorEvent.Type.AD_ERROR,function(_){Ag(C,_)}),C.h.D(C.g,google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,function(_){kg(C,_)}),C.h.D(C.g,google.ima.AdEvent.Type.STARTED,function(_){kg(C,_)}),C.h.D(C.g,google.ima.AdEvent.Type.FIRST_QUARTILE,function(_){D(_,"ad-first-quartile")}),C.h.D(C.g,google.ima.AdEvent.Type.MIDPOINT,function(_){D(_,"ad-midpoint")}),C.h.D(C.g,google.ima.AdEvent.Type.THIRD_QUARTILE,function(_){D(_,"ad-third-quartile")}),C.h.D(C.g,google.ima.AdEvent.Type.COMPLETE,function(_){D(_,"ad-complete")}),C.h.D(C.g,google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,function(_){uo(C,_)}),C.h.D(C.g,google.ima.AdEvent.Type.ALL_ADS_COMPLETED,function(_){uo(C,_)}),C.h.D(C.g,google.ima.AdEvent.Type.SKIPPED,function(_){D(_,"ad-skipped")}),C.h.D(C.g,google.ima.AdEvent.Type.VOLUME_CHANGED,function(_){D(_,"ad-volume-changed")}),C.h.D(C.g,google.ima.AdEvent.Type.VOLUME_MUTED,function(_){D(_,"ad-muted")}),C.h.D(C.g,google.ima.AdEvent.Type.PAUSED,function(_){C.j&&(C.j.i=!0,D(_,"ad-paused"))}),C.h.D(C.g,google.ima.AdEvent.Type.RESUMED,function(_){C.j&&(C.j.i=!1,D(_,"ad-resumed"))}),C.h.D(C.g,google.ima.AdEvent.Type.SKIPPABLE_STATE_CHANGED,function(_){C.j&&D(_,"ad-skip-state-changed")}),C.h.D(C.g,google.ima.AdEvent.Type.CLICK,function(_){D(_,"ad-clicked")}),C.h.D(C.g,google.ima.AdEvent.Type.AD_PROGRESS,function(_){D(_,"ad-progress")}),C.h.D(C.g,google.ima.AdEvent.Type.AD_BUFFERING,function(_){D(_,"ad-buffering")}),C.h.D(C.g,google.ima.AdEvent.Type.IMPRESSION,function(_){D(_,"ad-impression")}),C.h.D(C.g,google.ima.AdEvent.Type.DURATION_CHANGE,function(_){D(_,"ad-duration-changed")}),C.h.D(C.g,google.ima.AdEvent.Type.USER_CLOSE,function(_){D(_,"ad-closed")}),C.h.D(C.g,google.ima.AdEvent.Type.LOADED,function(_){D(_,"ad-loaded")}),C.h.D(C.g,google.ima.AdEvent.Type.ALL_ADS_COMPLETED,function(_){D(_,"all-ads-completed")}),C.h.D(C.g,google.ima.AdEvent.Type.LINEAR_CHANGED,function(_){D(_,"ad-linear-changed")}),C.h.D(C.g,google.ima.AdEvent.Type.AD_METADATA,function(_){D(_,"ad-metadata")}),C.h.D(C.g,google.ima.AdEvent.Type.LOG,function(_){D(_,"ad-recoverable-error")}),C.h.D(C.g,google.ima.AdEvent.Type.AD_BREAK_READY,function(_){D(_,"ad-break-ready")}),C.h.D(C.g,google.ima.AdEvent.Type.INTERACTION,function(_){D(_,"ad-interaction")})})(b);try{b.g.init(b.i.offsetWidth,b.i.offsetHeight,oc(b)?google.ima.ViewMode.FULLSCREEN:google.ima.ViewMode.NORMAL),b.h.D(b.i,"loadeddata",function(){b.g.resize(b.i.offsetWidth,b.i.offsetHeight,oc(b)?google.ima.ViewMode.FULLSCREEN:google.ima.ViewMode.NORMAL)}),"ResizeObserver"in s?(b.u=new ResizeObserver(function(){b.g.resize(b.i.offsetWidth,b.i.offsetHeight,oc(b)?google.ima.ViewMode.FULLSCREEN:google.ima.ViewMode.NORMAL)}),b.u.observe(b.i)):b.h.D(document,"fullscreenchange",function(){b.g.resize(b.i.offsetWidth,b.i.offsetHeight,oc(b)?google.ima.ViewMode.FULLSCREEN:google.ima.ViewMode.NORMAL)}),b.F?b.g.start():b.h.ka(b.i,"play",function(){b.F=!0,b.g.start()})}catch{uo(b,null)}})(p,g)}),this.h.D(this.l,google.ima.AdErrorEvent.Type.AD_ERROR,function(g){Ag(p,g)}),this.h.D(this.i,"ended",function(){p.l.contentComplete()}),this.h.ka(this.i,"play",function(){p.F=!0})}function Ag(e,n){n.getError(),n=new Map().set("originalEvent",n),e.m(new dt("ad-error",n)),uo(e,null),e.m(new dt("ad-cue-points-changed",new Map().set("cuepoints",[])))}function oc(e){return document.fullscreenEnabled?!!document.fullscreenElement:!!(e=e.i).webkitSupportsFullscreen&&e.webkitDisplayingFullscreen}function kg(e,n){var i=n.getAd();i?(e.j=new At(i,e.g,e.i),n=new Map().set("ad",e.j).set("sdkAdObject",i).set("originalEvent",n),e.m(new dt("ad-started",n)),e.j.isLinear()&&(e.o.setAttribute("ad-active","true"),e.s.customPlayheadTracker||e.i.pause(),e.i.muted?((n=e.j).l=e.i.volume,n.h.setVolume(0)):e.j.setVolume(e.i.volume))):Rt("The IMA SDK fired a "+n.type+" event with no associated ad. Unable to play ad!")}function uo(e,n){e.m(new dt("ad-stopped",new Map().set("originalEvent",n))),e.j&&e.j.isLinear()&&(e.o.removeAttribute("ad-active"),e.s.customPlayheadTracker||e.i.ended||e.i.play())}function pt(e,n,i,o,h){this.h=e,this.g=h,this.i=n,this.j=i,this.l=o}function Wo(e,n,i,o){this.A=e,this.J=n,this.g=i,this.l=null,this.W=NaN,this.i=o,this.H=!1,this.u=null,this.j=[],this.L=[],this.K=this.C=this.h=null,this.F=new Map,this.m=[],this.s=[],this.N="",this.V=!0,this.G="",this.o=new mn}function XT(e,n){var i,o,h,p,g,b,w;W(function(k){return k.g==1?n.staticResource?(i=Jy(n),e.F.get(i)?k.return():(o=lr([n.staticResource],{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:3e4,stallTimeout:5e3,connectionTimeout:1e4}),h=e.J.request(7,o),ne(k,2),e.F.set(i,[]),N(k,h.promise,4))):k.return():k.g!=2?(p=k.h,g=Wn(p.data),b=JSON.parse(g),w=b.apps,e.F.set(i,w),ce(k,0)):(we(k),e.F.delete(i),void re(k))})}function Jy(e){return[e.adId,e.adParameters,e.adSystem,e.adTitle,e.creativeAdId,e.creativeId,e.creativeSequence,e.height,e.width,e.staticResource].join("")}function Zy(e){var n=e.g.currentTime;if(n!=0&&e.u==null){for(var i,o,h=T(e.j),p=h.next();!p.done;p=h.next())for(var g=T((p=p.value).ads),b=g.next();!b.done;b=g.next())if(b=b.value,o){if(b.startTimeInSeconds<n&&b.startTimeInSeconds>o.startTimeInSeconds+o.durationInSeconds){o=b,i=p;break}}else b.startTimeInSeconds<n&&(o=b,i=p);i&&o&&!e.L.includes(o.adId)&&(e.u=n,e.g.currentTime=i.startTimeInSeconds)}}function ev(e){if(e.g.duration&&(e.h||e.j.length)){var n=e.g.currentTime,i=!1;if(e.h){i=!0;var o=e.C,h=o.startTimeInSeconds+.5*o.durationInSeconds,p=o.startTimeInSeconds+.75*o.durationInSeconds;n>=o.startTimeInSeconds+.25*o.durationInSeconds&&!e.s.includes("firstQuartile")?(e.s.push("firstQuartile"),Oi(e,"firstQuartile")):n>=h&&!e.s.includes("midpoint")?(e.s.push("midpoint"),Oi(e,"midpoint")):n>=p&&!e.s.includes("thirdQuartile")&&(e.s.push("thirdQuartile"),Oi(e,"thirdQuartile")),o=e.h.getRemainingTime(),0<(h=e.h.getDuration())&&(0>=o||o>h)&&ql(e)}if(!e.h||!e.h.isLinear()){e:for(o=T(e.j),h=o.next();!h.done&&(h=h.value,!e.h||!e.h.isLinear());h=o.next())for(p=0;p<h.ads.length;p++){var g=h.ads[p],b=g.startTimeInSeconds+g.durationInSeconds;if(g.startTimeInSeconds<=n&&b>n){if(e.L.includes(g.adId)){if(e.g.ended)continue;e.g.currentTime=b;break e}ql(e),e.K=h,e.h=new pt(g,p+1,h.ads.length,!0,e.g),e.C=g,p===0&&Oi(e,"breakStart"),tv(e);break}}if(!e.h){for(h=(o=T(e.j)).next();!h.done&&(h=h.value,!e.h);h=o.next())for(p=0;p<h.nonLinearAdsList.length;p++)if((g=h.nonLinearAdsList[p]).nonLinearAdList.length){b=h.startTimeInSeconds;var w=e.F.get(Jy(g.nonLinearAdList[0]));if(b<=n&&w&&w.length){ql(e),b=e;for(var k=(w=T(w)).next();!k.done;k=w.next())if((k=k.value).data.source.length){var I=document.createElement("img");I.src=k.data.source[0].url,I.style.top=(k.placeholder.top||0)+"%",I.style.height=100-(k.placeholder.top||0)+"%",I.style.left=(k.placeholder.left||0)+"%",I.style.maxWidth=100-(k.placeholder.left||0)+"%",I.style.objectFit="contain",I.style.position="absolute",b.A.appendChild(I)}e.K=h,e.h=new pt(g,p+1,h.ads.length,!1,e.g),e.C=g,p===0&&Oi(e,"breakStart"),tv(e);break}}}i&&!e.h&&(n=e.g.currentTime,e.u&&e.u>n&&(e.g.currentTime=e.u),e.u=null)}}}function ql(e){if(e.h){for(;e.A.lastChild;)e.A.removeChild(e.A.firstChild);e.H||e.L.push(e.C.adId),Oi(e,"complete");for(var n=T(e.m),i=n.next();!i.done;i=n.next())i=i.value,e.o.Db(i.target,i.type,i.listener);e.m=[],e.s=[],(n=e.h.getPositionInSequence())===(i=e.h.getSequenceLength())&&Oi(e,"breakEnd"),e.h=null,e.C=null,e.K=null}}function tv(e){var n=!1;e.g.paused?n=!0:(Oi(e,"impression"),Oi(e,"start")),e.m.push({target:e.g,type:"volumechange",listener:function(){e.g.muted&&Oi(e,"mute")}}),e.m.push({target:e.g,type:"volumechange",listener:function(){e.g.muted||Oi(e,"unmute")}}),e.m.push({target:e.g,type:"play",listener:function(){n?(Oi(e,"impression"),Oi(e,"start"),n=!1):Oi(e,"resume")}}),e.m.push({target:e.g,type:"pause",listener:function(){Oi(e,"pause")}});for(var i=T(e.m),o=i.next();!o.done;o=i.next())o=o.value,e.o.D(o.target,o.type,o.listener)}function Oi(e,n){var i=e.C.trackingEvents.find(function(h){return h.eventType==n});if(i||(i=e.K.adBreakTrackingEvents.find(function(h){return h.eventType==n})),i)for(var o=(i=T(i.beaconUrls)).next();!o.done;o=i.next())(o=o.value)&&o!=""&&((o=lr([o],{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:3e4,stallTimeout:5e3,connectionTimeout:1e4})).method="POST",e.J.request(7,o));switch(n){case"impression":e.i(new dt("ad-impression"));break;case"start":e.i(new dt("ad-started",new Map().set("ad",e.h)));break;case"mute":e.i(new dt("ad-muted"));break;case"unmute":e.i(new dt("ad-volume-changed"));break;case"resume":e.i(new dt("ad-resumed"));break;case"pause":e.i(new dt("ad-paused"));break;case"firstQuartile":e.i(new dt("ad-first-quartile"));break;case"midpoint":e.i(new dt("ad-midpoint"));break;case"thirdQuartile":e.i(new dt("ad-third-quartile"));break;case"complete":e.i(new dt("ad-complete")),e.i(new dt("ad-stopped"));break;case"breakStart":e.A.setAttribute("ad-active","true");break;case"breakEnd":e.A.removeAttribute("ad-active")}}function xt(e,n){this.g=e,this.i=null,this.h=n}function xg(e,n,i,o){var h=this;this.s=e,this.l=n,this.j=null,this.F=NaN,this.i=o,this.G=!1,this.u=this.m=this.o=null,this.A="",this.C=[],this.h=new mn,(e=new google.ima.dai.api.UiSettings).setLocale(i),this.g=new google.ima.dai.api.StreamManager(this.l,this.s,e),this.i(new dt("ima-stream-manager-loaded",new Map().set("imaStreamManager",this.g))),this.h.D(this.g,google.ima.dai.api.StreamEvent.Type.LOADED,function(p){(function(g,b){g.i(new dt("ads-loaded",new Map().set("loadTime",Date.now()/1e3-g.F))),b=b.getStreamData().url,g.j.resolve(b),g.j=null,g.G||g.h.D(g.l,"seeked",function(){var w=g.l.currentTime;if(w!=0){g.g.streamTimeForContentTime(w);var k=g.g.previousCuePointForStreamTime(w);k&&!k.played&&(g.o=w,g.l.currentTime=k.start)}})})(h,p)}),this.h.D(this.g,google.ima.dai.api.StreamEvent.Type.ERROR,function(){h.A.length?h.j.resolve(h.A):h.j.reject("IMA Stream request returned an error and there was no backup asset uri provided."),h.j=null}),this.h.D(this.g,google.ima.dai.api.StreamEvent.Type.AD_BREAK_STARTED,function(){}),this.h.D(this.g,google.ima.dai.api.StreamEvent.Type.STARTED,function(p){p=p.getAd(),h.m=new xt(p,h.l),h.u&&(h.m.i=h.u),h.i(new dt("ad-started",new Map().set("ad",h.m))),h.s.setAttribute("ad-active","true")}),this.h.D(this.g,google.ima.dai.api.StreamEvent.Type.AD_BREAK_ENDED,function(){h.s.removeAttribute("ad-active");var p=h.l.currentTime;h.o&&h.o>p&&(h.l.currentTime=h.o,h.o=null)}),this.h.D(this.g,google.ima.dai.api.StreamEvent.Type.AD_PROGRESS,function(p){h.u=p.getStreamData().adProgressData,h.m&&(h.m.i=h.u)}),this.h.D(this.g,google.ima.dai.api.StreamEvent.Type.FIRST_QUARTILE,function(){h.i(new dt("ad-first-quartile"))}),this.h.D(this.g,google.ima.dai.api.StreamEvent.Type.MIDPOINT,function(){h.i(new dt("ad-midpoint"))}),this.h.D(this.g,google.ima.dai.api.StreamEvent.Type.THIRD_QUARTILE,function(){h.i(new dt("ad-third-quartile"))}),this.h.D(this.g,google.ima.dai.api.StreamEvent.Type.COMPLETE,function(){h.i(new dt("ad-complete")),h.i(new dt("ad-stopped")),h.s.removeAttribute("ad-active"),h.m=null}),this.h.D(this.g,google.ima.dai.api.StreamEvent.Type.SKIPPED,function(){h.i(new dt("ad-skipped")),h.i(new dt("ad-stopped"))}),this.h.D(this.g,google.ima.dai.api.StreamEvent.Type.CUEPOINTS_CHANGED,function(p){var g=p.getStreamData();p=[];for(var b=(g=T(g.cuepoints)).next();!b.done;b=g.next())b=b.value,p.push({start:b.start,end:b.end});h.C=p,h.i(new dt("ad-cue-points-changed",new Map().set("cuepoints",p)))})}function ct(){hn.call(this),this.g=this.i=this.h=null,this.j=new T1,this.m=navigator.language,this.l=null}function nv(e,n){if(n&&n.type)switch(n.type){case"ads-loaded":e.j.h.push(n.loadTime);break;case"ad-started":e.j.g++;break;case"ad-complete":e.j.i++;break;case"ad-skipped":e.j.j++}e.dispatchEvent(n)}function rv(e){return JSON.stringify(e,function(n,i){if(typeof i!="function"){if(i instanceof Event||i instanceof dt){var o={};for(h in i)(n=i[h])&&typeof n=="object"?h=="detail"&&(o[h]=n):h in Event||(o[h]=n);return o}if(i instanceof Error){var h=new Set(["name","message","stack"]);for(o in i)h.add(o);for(o=(n=T(Object.getOwnPropertyNames(i))).next();!o.done;o=n.next())h.add(o.value);for(n={},o=(h=T(h)).next();!o.done;o=h.next())n[o=o.value]=i[o];i={_t:"Error",contents:n}}else if(i instanceof TimeRanges){for(h={_t:"TimeRanges",length:i.length,start:[],end:[]},o=(i=T(No(i))).next();!o.done;o=i.next())n=(o=o.value).end,h.start.push(o.start),h.end.push(n);i=h}else i=i instanceof Uint8Array?{_t:"Uint8Array",entries:Array.from(i)}:typeof i=="number"?isNaN(i)?"NaN":isFinite(i)?i:0>i?"-Infinity":"Infinity":i;return i}})}function Rn(e){return JSON.parse(e,function(n,i){if(i=="NaN")var o=NaN;else if(i=="-Infinity")o=-1/0;else if(i=="Infinity")o=1/0;else if(i&&typeof i=="object"&&i._t=="TimeRanges")o=function(h){return{length:h.length,start:function(p){return h.start[p]},end:function(p){return h.end[p]}}}(i);else if(i&&typeof i=="object"&&i._t=="Uint8Array")o=new Uint8Array(i.entries);else if(i&&typeof i=="object"&&i._t=="Error"){for(o in n=i.contents,i=Error(n.message),n)i[o]=n[o];o=i}else o=i;return o})}(c=At.prototype).getDuration=function(){return this.g.getDuration()},c.getMinSuggestedDuration=function(){return this.g.getMinSuggestedDuration()},c.getRemainingTime=function(){return this.h.getRemainingTime()},c.isPaused=function(){return this.i},c.isSkippable=function(){return 0<=this.g.getSkipTimeOffset()},c.getTimeUntilSkippable=function(){var e=this.g.getSkipTimeOffset();return e=this.getRemainingTime()-e,Math.max(e,0)},c.canSkipNow=function(){return this.h.getAdSkippableState()},c.skip=function(){return this.h.skip()},c.pause=function(){return this.h.pause()},c.play=function(){return this.h.resume()},c.getVolume=function(){return this.h.getVolume()},c.setVolume=function(e){return this.j.volume=e,this.h.setVolume(e)},c.isMuted=function(){return this.h.getVolume()==0},c.isLinear=function(){return this.g.isLinear()},c.resize=function(e,n){var i=!1,o=this.j;document.fullscreenEnabled?i=!!document.fullscreenElement:o.webkitSupportsFullscreen&&(i=o.webkitDisplayingFullscreen),this.h.resize(e,n,i?google.ima.ViewMode.FULLSCREEN:google.ima.ViewMode.NORMAL)},c.setMuted=function(e){(this.j.muted=e)?(this.l=this.getVolume(),this.h.setVolume(0)):this.h.setVolume(this.l)},c.getSequenceLength=function(){var e=this.g.getAdPodInfo();return e==null?1:e.getTotalAds()},c.getPositionInSequence=function(){var e=this.g.getAdPodInfo();return e==null?1:e.getAdPosition()},c.getTitle=function(){return this.g.getTitle()},c.getDescription=function(){return this.g.getDescription()},c.getVastMediaBitrate=function(){return this.g.getVastMediaBitrate()},c.getVastMediaHeight=function(){return this.g.getVastMediaHeight()},c.getVastMediaWidth=function(){return this.g.getVastMediaWidth()},c.getAdId=function(){return this.g.getAdId()},c.getCreativeAdId=function(){return this.g.getCreativeAdId()},c.getAdvertiserName=function(){return this.g.getAdvertiserName()},c.getMediaUrl=function(){return this.g.getMediaUrl()},c.getTimeOffset=function(){var e=this.g.getAdPodInfo();return e==null?0:e.getTimeOffset()},c.getPodIndex=function(){var e=this.g.getAdPodInfo();return e==null?0:e.getPodIndex()},c.release=function(){this.h=this.g=null},We("shaka.ads.ClientSideAd",At),At.prototype.release=At.prototype.release,At.prototype.getPodIndex=At.prototype.getPodIndex,At.prototype.getTimeOffset=At.prototype.getTimeOffset,At.prototype.getMediaUrl=At.prototype.getMediaUrl,At.prototype.getAdvertiserName=At.prototype.getAdvertiserName,At.prototype.getCreativeAdId=At.prototype.getCreativeAdId,At.prototype.getAdId=At.prototype.getAdId,At.prototype.getVastMediaWidth=At.prototype.getVastMediaWidth,At.prototype.getVastMediaHeight=At.prototype.getVastMediaHeight,At.prototype.getVastMediaBitrate=At.prototype.getVastMediaBitrate,At.prototype.getDescription=At.prototype.getDescription,At.prototype.getTitle=At.prototype.getTitle,At.prototype.getPositionInSequence=At.prototype.getPositionInSequence,At.prototype.getSequenceLength=At.prototype.getSequenceLength,At.prototype.setMuted=At.prototype.setMuted,At.prototype.resize=At.prototype.resize,At.prototype.isLinear=At.prototype.isLinear,At.prototype.isMuted=At.prototype.isMuted,At.prototype.setVolume=At.prototype.setVolume,At.prototype.getVolume=At.prototype.getVolume,At.prototype.play=At.prototype.play,At.prototype.pause=At.prototype.pause,At.prototype.skip=At.prototype.skip,At.prototype.canSkipNow=At.prototype.canSkipNow,At.prototype.getTimeUntilSkippable=At.prototype.getTimeUntilSkippable,At.prototype.isSkippable=At.prototype.isSkippable,At.prototype.isPaused=At.prototype.isPaused,At.prototype.getRemainingTime=At.prototype.getRemainingTime,At.prototype.getMinSuggestedDuration=At.prototype.getMinSuggestedDuration,At.prototype.getDuration=At.prototype.getDuration,qo.prototype.configure=function(e){this.s=e},qo.prototype.stop=function(){this.g&&this.g.stop(),this.o&&$i(this.o)},qo.prototype.release=function(){this.stop(),this.u&&this.u.disconnect(),this.h&&this.h.release(),this.g&&this.g.destroy(),this.l.destroy(),this.C.destroy()},(c=pt.prototype).getDuration=function(){return this.h.durationInSeconds},c.getMinSuggestedDuration=function(){return this.getDuration()},c.getRemainingTime=function(){return this.h.startTimeInSeconds+this.h.durationInSeconds-this.g.currentTime},c.isPaused=function(){return this.g.paused},c.isSkippable=function(){return!!this.h.skipOffset},c.getTimeUntilSkippable=function(){if(!this.h.skipOffset)return this.getRemainingTime();var e=this.getRemainingTime()-this.h.skipOffset;return Math.max(e,0)},c.canSkipNow=function(){return this.getTimeUntilSkippable()==0},c.skip=function(){this.g.currentTime+=this.getRemainingTime()},c.pause=function(){return this.g.pause()},c.play=function(){return this.g.play()},c.getVolume=function(){return this.g.volume},c.setVolume=function(e){this.g.volume=e},c.isMuted=function(){return this.g.muted},c.isLinear=function(){return this.l},c.resize=function(){},c.setMuted=function(e){this.g.muted=e},c.getSequenceLength=function(){return this.j?this.j:1},c.getPositionInSequence=function(){return this.i?this.i:1},c.getTitle=function(){return this.h.adTitle},c.getDescription=function(){return""},c.getVastMediaBitrate=function(){return 0},c.getVastMediaHeight=function(){return 0},c.getVastMediaWidth=function(){return 0},c.getAdId=function(){return this.h.adId},c.getCreativeAdId=function(){return this.h.creativeId},c.getAdvertiserName=function(){return""},c.getMediaUrl=function(){return null},c.getTimeOffset=function(){return 0},c.getPodIndex=function(){return 0},c.release=function(){this.j=this.i=this.g=this.h=null},We("shaka.ads.MediaTailorAd",pt),pt.prototype.release=pt.prototype.release,pt.prototype.getPodIndex=pt.prototype.getPodIndex,pt.prototype.getTimeOffset=pt.prototype.getTimeOffset,pt.prototype.getMediaUrl=pt.prototype.getMediaUrl,pt.prototype.getAdvertiserName=pt.prototype.getAdvertiserName,pt.prototype.getCreativeAdId=pt.prototype.getCreativeAdId,pt.prototype.getAdId=pt.prototype.getAdId,pt.prototype.getVastMediaWidth=pt.prototype.getVastMediaWidth,pt.prototype.getVastMediaHeight=pt.prototype.getVastMediaHeight,pt.prototype.getVastMediaBitrate=pt.prototype.getVastMediaBitrate,pt.prototype.getDescription=pt.prototype.getDescription,pt.prototype.getTitle=pt.prototype.getTitle,pt.prototype.getPositionInSequence=pt.prototype.getPositionInSequence,pt.prototype.getSequenceLength=pt.prototype.getSequenceLength,pt.prototype.setMuted=pt.prototype.setMuted,pt.prototype.resize=pt.prototype.resize,pt.prototype.isLinear=pt.prototype.isLinear,pt.prototype.isMuted=pt.prototype.isMuted,pt.prototype.setVolume=pt.prototype.setVolume,pt.prototype.getVolume=pt.prototype.getVolume,pt.prototype.play=pt.prototype.play,pt.prototype.pause=pt.prototype.pause,pt.prototype.skip=pt.prototype.skip,pt.prototype.canSkipNow=pt.prototype.canSkipNow,pt.prototype.getTimeUntilSkippable=pt.prototype.getTimeUntilSkippable,pt.prototype.isSkippable=pt.prototype.isSkippable,pt.prototype.isPaused=pt.prototype.isPaused,pt.prototype.getRemainingTime=pt.prototype.getRemainingTime,pt.prototype.getMinSuggestedDuration=pt.prototype.getMinSuggestedDuration,pt.prototype.getDuration=pt.prototype.getDuration,Wo.prototype.stop=function(){for(var e=T(this.m),n=e.next();!n.done;n=e.next())n=n.value,this.o.Db(n.target,n.type,n.listener);ql(this),this.m=[],this.s=[],this.N="",this.V=!0,this.G="",this.u=null,this.j=[],this.L=[],this.F.clear()},Wo.prototype.release=function(){this.stop(),this.o&&this.o.release()},Wo.prototype.onManifestUpdated=function(e){this.H=e,this.N!=""&&(function(n,i,o){var h,p,g,b,w,k,I,x,C,D,_,j,F,B,H;W(function(Y){if(Y.g==1)return h=lr([i],{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:3e4,stallTimeout:5e3,connectionTimeout:1e4}),p=n.J.request(7,h),ne(Y,2),N(Y,p.promise,4);if(Y.g!=2){if(g=Y.h,b=[],w=Wn(g.data),0<(k=JSON.parse(w)).avails.length){if(JSON.stringify(n.j)!=JSON.stringify(k.avails)){for(n.j=k.avails,I=T(n.j),x=I.next();!x.done;x=I.next())for(C=x.value,D=T(C.nonLinearAdsList),_=D.next();!_.done;_=D.next())for(j=_.value,F=T(j.nonLinearAdList),B=F.next();!B.done;B=F.next())H=B.value,XT(n,H);b=n.getCuePoints(),n.i(new dt("ad-cue-points-changed",new Map().set("cuepoints",b)))}}else n.j.length&&n.i(new dt("ad-cue-points-changed",new Map().set("cuepoints",b))),ql(n),n.j=[];return o&&(n.H||0<b.length)&&function(te){ev(te),te.H||(Zy(te),te.o.D(te.g,"seeked",function(){Zy(te)}),te.o.D(te.g,"ended",function(){ql(te)})),te.o.D(te.g,"timeupdate",function(){ev(te)})}(n),ce(Y,0)}we(Y),re(Y)})}(this,this.N,this.V),this.V=!1)},Wo.prototype.getCuePoints=function(){for(var e=[],n=T(this.j),i=n.next();!i.done;i=n.next())for(var o=(i=T(i.value.ads)).next();!o.done;o=i.next())o=o.value,e.push({start:o.startTimeInSeconds,end:o.startTimeInSeconds+o.durationInSeconds});return e},(c=xt.prototype).getDuration=function(){return this.i?this.i.duration:-1},c.getMinSuggestedDuration=function(){return this.getDuration()},c.getRemainingTime=function(){return this.i?this.i.duration-this.i.currentTime:-1},c.isPaused=function(){return this.h.paused},c.isSkippable=function(){return this.g.isSkippable()},c.getTimeUntilSkippable=function(){var e=this.g.getSkipTimeOffset();return e=this.getRemainingTime()-e,Math.max(e,0)},c.canSkipNow=function(){return this.getTimeUntilSkippable()==0},c.skip=function(){this.h.currentTime+=this.getRemainingTime()},c.pause=function(){return this.h.pause()},c.play=function(){return this.h.play()},c.getVolume=function(){return this.h.volume},c.setVolume=function(e){this.h.volume=e},c.isMuted=function(){return this.h.muted},c.isLinear=function(){return!0},c.resize=function(){},c.setMuted=function(e){this.h.muted=e},c.getSequenceLength=function(){var e=this.g.getAdPodInfo();return e==null?1:e.getTotalAds()},c.getPositionInSequence=function(){var e=this.g.getAdPodInfo();return e==null?1:e.getAdPosition()},c.getTitle=function(){return this.g.getTitle()},c.getDescription=function(){return this.g.getDescription()},c.getVastMediaBitrate=function(){return 0},c.getVastMediaHeight=function(){return this.g.getVastMediaHeight()},c.getVastMediaWidth=function(){return this.g.getVastMediaWidth()},c.getAdId=function(){return this.g.getAdId()},c.getCreativeAdId=function(){return this.g.getCreativeAdId()},c.getAdvertiserName=function(){return this.g.getAdvertiserName()},c.getMediaUrl=function(){return null},c.getTimeOffset=function(){var e=this.g.getAdPodInfo();return e==null?0:e.getTimeOffset()},c.getPodIndex=function(){var e=this.g.getAdPodInfo();return e==null?0:e.getPodIndex()},c.release=function(){this.h=this.i=this.g=null},We("shaka.ads.ServerSideAd",xt),xt.prototype.release=xt.prototype.release,xt.prototype.getPodIndex=xt.prototype.getPodIndex,xt.prototype.getTimeOffset=xt.prototype.getTimeOffset,xt.prototype.getMediaUrl=xt.prototype.getMediaUrl,xt.prototype.getAdvertiserName=xt.prototype.getAdvertiserName,xt.prototype.getCreativeAdId=xt.prototype.getCreativeAdId,xt.prototype.getAdId=xt.prototype.getAdId,xt.prototype.getVastMediaWidth=xt.prototype.getVastMediaWidth,xt.prototype.getVastMediaHeight=xt.prototype.getVastMediaHeight,xt.prototype.getVastMediaBitrate=xt.prototype.getVastMediaBitrate,xt.prototype.getDescription=xt.prototype.getDescription,xt.prototype.getTitle=xt.prototype.getTitle,xt.prototype.getPositionInSequence=xt.prototype.getPositionInSequence,xt.prototype.getSequenceLength=xt.prototype.getSequenceLength,xt.prototype.setMuted=xt.prototype.setMuted,xt.prototype.resize=xt.prototype.resize,xt.prototype.isLinear=xt.prototype.isLinear,xt.prototype.isMuted=xt.prototype.isMuted,xt.prototype.setVolume=xt.prototype.setVolume,xt.prototype.getVolume=xt.prototype.getVolume,xt.prototype.play=xt.prototype.play,xt.prototype.pause=xt.prototype.pause,xt.prototype.skip=xt.prototype.skip,xt.prototype.canSkipNow=xt.prototype.canSkipNow,xt.prototype.getTimeUntilSkippable=xt.prototype.getTimeUntilSkippable,xt.prototype.isSkippable=xt.prototype.isSkippable,xt.prototype.isPaused=xt.prototype.isPaused,xt.prototype.getRemainingTime=xt.prototype.getRemainingTime,xt.prototype.getMinSuggestedDuration=xt.prototype.getMinSuggestedDuration,xt.prototype.getDuration=xt.prototype.getDuration,(c=xg.prototype).configure=function(){},c.stop=function(){this.A="",this.o=null,this.C=[]},c.release=function(){this.stop(),this.h&&this.h.release()},c.onCueMetadataChange=function(e){if(e.key&&e.data){var n={};n[e.key]=e.data,this.g.onTimedMetadata(n)}},c.getCuePoints=function(){return this.C},Z(ct,hn),(c=ct.prototype).setLocale=function(e){this.m=e},c.configure=function(e){this.l=e,this.h&&this.h.configure(this.l),this.g&&this.g.configure(this.l)},c.initClientSide=function(e,n,i){var o=this;if(!s.google||!google.ima||!google.ima.AdsLoader)throw new fe(2,10,1e4);this.h&&this.h.release(),this.h=new qo(e,n,this.m,i,function(h){return nv(o,h)}),this.h.configure(this.l)},c.release=function(){this.h&&(this.h.release(),this.h=null),this.i&&(this.i.release(),this.i=null),this.g&&(this.g.release(),this.g=null),hn.prototype.release.call(this)},c.onAssetUnload=function(){this.h&&this.h.stop(),this.i&&this.i.stop(),this.g&&this.g.stop(),this.dispatchEvent(new dt("ad-stopped")),this.j=new T1},c.requestClientSideAds=function(e){if(!this.h)throw new fe(1,10,10001);var n=this.h;n.g&&n.g.destroy(),n.l&&n.l.contentComplete(),n.G=Date.now()/1e3,n.l.requestAds(e)},c.updateClientSideAdsRenderingSettings=function(e){if(!this.h)throw new fe(1,10,10001);var n=this.h;n.A=e,n.g&&n.g.updateAdsRenderingSettings(n.A)},c.initMediaTailor=function(e,n,i){var o=this;this.i&&this.i.release(),this.i=new Wo(e,n,i,function(h){return nv(o,h)})},c.requestMediaTailorStream=function(e,n,i){if(!this.i)throw new fe(1,10,10005);var o=this.i;return i=i===void 0?"":i,o.l?e=Promise.reject(new fe(1,10,10004)):(o.l=new Pn,function(h,p,g){var b,w,k,I,x,C,D,_,j,F,B;W(function(H){if(H.g==1)return(b=lr([p],{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:3e4,stallTimeout:5e3,connectionTimeout:1e4})).method="POST",g&&(w=JSON.stringify(g),b.body=As(w)),k=h.J.request(7,b),ne(H,2),N(H,k.promise,4);if(H.g!=2){if(I=H.h,x=Wn(I.data),!(C=JSON.parse(x)).manifestUrl||!C.trackingUrl)throw Error("Insufficient data from MediaTailor.");return D=new mr(p),_=new mr(C.trackingUrl),h.N=D.resolve(_).toString(),j=Date.now()/1e3,F=j-h.W,h.i(new dt("ads-loaded",new Map().set("loadTime",F))),B=new mr(C.manifestUrl),h.l.resolve(D.resolve(B).toString()),h.l=null,ce(H,0)}if(we(H),!h.G.length)return h.l.reject("MediaTailor request returned an error and there was no backup asset uri provided."),h.l=null,H.return();h.l.resolve(h.G),h.l=null,re(H)})}(o,e,n),o.G=i||"",o.W=Date.now()/1e3,e=o.l),e},c.initServerSide=function(e,n){var i=this;if(!s.google||!google.ima||!google.ima.dai)throw new fe(2,10,10002);this.g&&this.g.release(),this.g=new xg(e,n,this.m,function(o){return nv(i,o)}),this.g.configure(this.l)},c.requestServerSideStream=function(e,n){if(n=n===void 0?"":n,!this.g)throw new fe(1,10,10003);e.adTagParameters||(e.adTagParameters={});var i=e.adTagParameters;return(i.mpt||i.mpv)&&Rt('You have attempted to set "mpt" and/or "mpv" parameters of the ad tag. Please note that those parameters are used for Shaka adoption tracking and will be overriden.'),e.adTagParameters.mpt="shaka-player",e.adTagParameters.mpv="v4.7.15",(i=this.g).j?e=Promise.reject(new fe(1,10,10004)):(e instanceof google.ima.dai.api.LiveStreamRequest&&(i.G=!0),i.j=new Pn,i.g.requestStream(e),i.A=n||"",i.F=Date.now()/1e3,e=i.j),e},c.replaceServerSideAdTagParameters=function(e){if(!this.g)throw new fe(1,10,10003);(e.mpt||e.mpv)&&Rt('You have attempted to set "mpt" and/or "mpv" parameters of the ad tag. Please note that those parameters are used for Shaka adoption tracking and will be overriden.'),e.mpt="Shaka Player",e.mpv="v4.7.15",this.g.g.replaceAdTagParameters(e)},c.getServerSideCuePoints=function(){return Ss("AdManager.getServerSideCuePoints","Please use getCuePoints function."),this.getCuePoints()},c.getCuePoints=function(){var e=[];return this.g&&(e=e.concat(this.g.getCuePoints())),this.i&&(e=e.concat(this.i.getCuePoints())),e},c.getStats=function(){var e=this.j;return{loadTimes:e.h,started:e.g,playedCompletely:e.i,skipped:e.j}},c.onManifestUpdated=function(e){this.i&&this.i.onManifestUpdated(e)},c.onDashTimedMetadata=function(e){if(this.g&&e.schemeIdUri=="urn:google:dai:2018"){var n=e.schemeIdUri,i=e.eventElement?e.eventElement.getAttribute("messageData"):null;this.g.g.processMetadata(n,i,e.startTime)}},c.onHlsTimedMetadata=function(e,n){this.g&&this.g.g.processMetadata("ID3",e.data,n)},c.onCueMetadataChange=function(e){this.g&&this.g.onCueMetadataChange(e)},We("shaka.ads.AdManager",ct),ct.prototype.onCueMetadataChange=ct.prototype.onCueMetadataChange,ct.prototype.onHlsTimedMetadata=ct.prototype.onHlsTimedMetadata,ct.prototype.onDashTimedMetadata=ct.prototype.onDashTimedMetadata,ct.prototype.onManifestUpdated=ct.prototype.onManifestUpdated,ct.prototype.getStats=ct.prototype.getStats,ct.prototype.getCuePoints=ct.prototype.getCuePoints,ct.prototype.getServerSideCuePoints=ct.prototype.getServerSideCuePoints,ct.prototype.replaceServerSideAdTagParameters=ct.prototype.replaceServerSideAdTagParameters,ct.prototype.requestServerSideStream=ct.prototype.requestServerSideStream,ct.prototype.initServerSide=ct.prototype.initServerSide,ct.prototype.requestMediaTailorStream=ct.prototype.requestMediaTailorStream,ct.prototype.initMediaTailor=ct.prototype.initMediaTailor,ct.prototype.updateClientSideAdsRenderingSettings=ct.prototype.updateClientSideAdsRenderingSettings,ct.prototype.requestClientSideAds=ct.prototype.requestClientSideAds,ct.prototype.onAssetUnload=ct.prototype.onAssetUnload,ct.prototype.release=ct.prototype.release,ct.prototype.initClientSide=ct.prototype.initClientSide,ct.prototype.configure=ct.prototype.configure,ct.prototype.setLocale=ct.prototype.setLocale,ct.ADS_LOADED="ads-loaded",ct.AD_STARTED="ad-started",ct.AD_FIRST_QUARTILE="ad-first-quartile",ct.AD_MIDPOINT="ad-midpoint",ct.AD_THIRD_QUARTILE="ad-third-quartile",ct.AD_COMPLETE="ad-complete",ct.AD_STOPPED="ad-stopped",ct.AD_SKIPPED="ad-skipped",ct.AD_VOLUME_CHANGED="ad-volume-changed",ct.AD_MUTED="ad-muted",ct.AD_PAUSED="ad-paused",ct.AD_RESUMED="ad-resumed",ct.AD_SKIP_STATE_CHANGED="ad-skip-state-changed",ct.CUEPOINTS_CHANGED="ad-cue-points-changed",ct.IMA_AD_MANAGER_LOADED="ima-ad-manager-loaded",ct.IMA_STREAM_MANAGER_LOADED="ima-stream-manager-loaded",ct.AD_CLICKED="ad-clicked",ct.AD_PROGRESS="ad-progress",ct.AD_BUFFERING="ad-buffering",ct.AD_IMPRESSION="ad-impression",ct.AD_DURATION_CHANGED="ad-duration-changed",ct.AD_CLOSED="ad-closed",ct.AD_LOADED="ad-loaded",ct.ALL_ADS_COMPLETED="all-ads-completed",ct.AD_LINEAR_CHANGED="ad-linear-changed",ct.AD_METADATA="ad-metadata",ct.AD_RECOVERABLE_ERROR="ad-recoverable-error",ct.AD_ERROR="ad-error",ct.AD_BREAK_READY="ad-break-ready",ct.AD_INTERACTION="ad-interaction",wg=function(){return new ct};var Ig="ended play playing pause pausing ratechange seeked seeking timeupdate volumechange".split(" "),Lg="buffered currentTime duration ended loop muted paused playbackRate seeking videoHeight videoWidth volume".split(" "),tf=["loop","playbackRate"],S1=["pause","play"],xd={getAssetUri:2,getAudioLanguages:4,getAudioLanguagesAndRoles:4,getBufferFullness:1,getBufferedInfo:2,getExpiration:2,getKeyStatuses:2,getPlaybackRate:2,getTextLanguages:4,getTextLanguagesAndRoles:4,getImageTracks:2,getThumbnails:2,isAudioOnly:10,isBuffering:1,isInProgress:1,isLive:10,isTextTrackVisible:1,keySystem:10,seekRange:1,getLoadMode:10,getManifestType:10},Wl={getConfiguration:4,getStats:5,getTextTracks:2,getVariantTracks:2},Id={getPlayheadTimeAsDate:1,getPresentationStartTimeAsDate:20},lc=[["getConfiguration","configure"]],iv=[["isTextTrackVisible","setTextTrackVisibility"]],JT="addChaptersTrack addTextTrackAsync addThumbnailsTrack cancelTrickPlay configure getChapters getChaptersTracks resetConfiguration retryStreaming selectAudioLanguage selectTextLanguage selectTextTrack selectVariantTrack selectVariantsByLabel setTextTrackVisibility trickPlay updateStartTime goToLive".split(" "),ZT=["attach","attachCanvas","detach","load","unload"];function Rg(e,n,i,o,h,p,g){var b=this;this.G=e,this.K=g,this.l=new Qt(n),this.L=i,this.s=!1,this.u=o,this.F=h,this.N=p,this.h=this.m=!1,this.J="",this.o=null,this.A=function(){return sf(b)},this.C=function(w,k){switch((w=Rn(k)).type){case"event":var I=w.targetName,x=Du(w.event);b.u(I,x);break;case"update":for(x in I=w.update)for(var C in w=b.g[x]||{},I[x])w[C]=I[x][C];b.s&&(b.L(),b.s=!1);break;case"asyncComplete":if(x=w.id,C=w.error,w=b.i[x],delete b.i[x],w)if(C){for(I in x=new fe(C.severity,C.category,C.code),C)x[I]=C[I];w.reject(x)}else w.resolve()}},this.g={video:{},player:{}},this.H=0,this.i={},this.j=null,dc.add(this)}function nf(e,n){var i=e.N();Cs=n,n.addUpdateListener(e.A),n.addMessageListener("urn:x-cast:com.google.shaka.v2",e.C),sf(e),uc(e,{type:"init",initState:i,appData:e.o}),e.j.resolve()}function rf(e,n){var i=8003;switch(n.code){case"cancel":i=8004;break;case"timeout":i=8005;break;case"receiver_unavailable":i=8006}e.j.reject(new fe(2,8,i,n))}function Zn(e){var n=Cs;n.removeUpdateListener(e.A),n.removeMessageListener("urn:x-cast:com.google.shaka.v2",e.C)}function sf(e){var n=!!Cs&&Cs.status=="connected";if(e.h&&!n){for(var i in e.F(),e.g)e.g[i]={};Zr(e)}e.h=n,e.J=n?Cs.receiver.friendlyName:"",e.l.qc()}function Zr(e){for(var n in e.i){var i=e.i[n];delete e.i[n],i.reject(new fe(1,7,7e3))}}function uc(e,n){n=rv(n);var i=Cs;try{i.sendMessage("urn:x-cast:com.google.shaka.v2",n,function(){},$s)}catch(o){throw n=new fe(2,8,8005,o),i=new dt("error",new Map().set("detail",n)),e.u("player",i),e.cc(),n}}(c=Rg.prototype).destroy=function(){return dc.delete(this),Zr(this),Cs&&Zn(this),this.l&&(this.l.stop(),this.l=null),this.F=this.u=null,this.h=this.m=!1,this.C=this.A=this.j=this.i=this.g=this.o=null,Promise.resolve()},c.Ka=function(){return this.h},c.ef=function(){return this.J},c.init=function(){if(this.G.length)if(s.chrome&&chrome.cast&&chrome.cast.isAvailable){this.m=!0,this.l.qc();var e=new chrome.cast.SessionRequest(this.G,[],null,this.K,null);e=new chrome.cast.ApiConfig(e,function(n){for(var i=T(dc),o=i.next();!o.done;o=i.next()){var h=n;(o=o.value).j=new Pn,o.s=!0,nf(o,h)}},function(n){for(var i=T(dc),o=i.next();!o.done;o=i.next())o=o.value,cc=n=="available",o.l.qc()},"origin_scoped"),chrome.cast.initialize(e,function(){},function(){}),cc&&this.l.U(sv),(e=Cs)&&e.status!=chrome.cast.SessionStatus.STOPPED?(this.j=new Pn,this.s=!0,nf(this,e)):Cs=null}else s.Ut!==Cg&&(af=s.Ut||null,s.Ut=Cg)},c.mf=function(e){this.o=e,this.h&&uc(this,{type:"appData",appData:this.o})},c.cast=function(){var e=this;return W(function(n){if(!e.m)throw new fe(1,8,8e3);if(!cc)throw new fe(1,8,8001);if(e.h)throw new fe(1,8,8002);return e.j=new Pn,chrome.cast.requestSession(function(i){return nf(e,i)},function(i){return rf(e,i)}),N(n,e.j,0)})},c.cc=function(){if(this.h){if(Zr(this),Cs){Zn(this);try{Cs.stop(function(){},function(){})}catch{}Cs=null}sf(this)}},c.get=function(e,n){var i=this;if(e=="video"){if(S1.includes(n))return function(){return i.hg.apply(i,[e,n].concat(M(Ke.apply(0,arguments))))}}else if(e=="player"){if(Id[n]&&!this.get("player","isLive")())return function(){};if(JT.includes(n))return function(){return i.hg.apply(i,[e,n].concat(M(Ke.apply(0,arguments))))};if(ZT.includes(n))return function(){return i.Oh.apply(i,[e,n].concat(M(Ke.apply(0,arguments))))};if(xd[n]||Wl[n])return function(){return i.g[e][n]}}return this.g[e][n]},c.set=function(e,n,i){this.g[e][n]=i,uc(this,{type:"set",targetName:e,property:n,value:i})},c.hg=function(e,n){uc(this,{type:"call",targetName:e,methodName:n,args:Ke.apply(2,arguments)})},c.Oh=function(e,n){var i=Ke.apply(2,arguments),o=new Pn,h=this.H.toString();this.H++,this.i[h]=o;try{uc(this,{type:"asyncCall",targetName:e,methodName:n,args:i,id:h})}catch(p){o.reject(p)}return o};var sv=.02,cc=!1,Cs=null,af=null,dc=new Set;function Cg(e){if(af?s.Ut=af:delete s.Ut,af=null,e)for(var n=T(dc),i=n.next();!i.done;i=n.next())i.value.init();typeof s.Ut=="function"&&s.Ut(e)}function vr(e,n,i,o){o=o!==void 0&&o,hn.call(this);var h=this;this.i=e,this.h=n,this.m=this.o=this.j=this.s=this.l=null,this.C=i,this.A=o,this.u=new Map,this.g=new Rg(i,function(){return A1(h)},function(){return k1(h)},function(p,g){return ea(h,p,g)},function(){return Dg(h)},function(){return av(h)},o),function(p){p.g.init(),p.m=new mn;for(var g=T(Ig),b=g.next();!b.done;b=g.next())p.m.D(p.i,b.value,function(I){p.g.Ka()||(I=Du(I),p.j.dispatchEvent(I))});for(var w in Co)p.m.D(p.h,Co[w],function(I){p.g.Ka()||p.o.dispatchEvent(I)});for(var k in p.l={},g={},p.i)g.yc=k,Object.defineProperty(p.l,g.yc,{configurable:!1,enumerable:!0,get:function(I){return function(){return ov(p,I.yc)}}(g),set:function(I){return function(x){var C=I.yc;p.g.Ka()?p.g.set("video",C,x):p.i[C]=x}}(g)}),g={yc:g.yc};p.s={},w1(p,function(I){Object.defineProperty(p.s,I,{configurable:!1,enumerable:!0,get:function(){return function(x,C){if(x.u.has(C)&&(C=x.u.get(C)),C=="addEventListener")return function(D,_,j){return x.o.addEventListener(D,_,j)};if(C=="removeEventListener")return function(D,_,j){return x.o.removeEventListener(D,_,j)};if(C=="getMediaElement")return function(){return x.l};if(C=="getSharedConfiguration")return x.g.get("player","getConfiguration");if(C=="getNetworkingEngine")return function(){return x.h.Nb()};if(C=="getDrmEngine")return function(){return x.h.m};if(C=="getAdManager")return function(){return x.h.Of()};if(C=="setVideoContainer")return function(D){return x.h.sg(D)};if(x.g.Ka()){if(C=="getManifest"||C=="drmInfo")return function(){return Rt(C+"() does not work while casting!"),null};if(C=="attach"||C=="detach")return function(){return Rt(C+"() does not work while casting!"),Promise.resolve()}}return x.g.Ka()&&Object.keys(x.g.g.video).length==0&&(xd[C]||Wl[C])||!x.g.Ka()?x.h[C].bind(x.h):x.g.get("player",C)}(p,I)}})}),function(I){var x=new Map;w1(I,function(C,D){x.has(D)?(D=x.get(D),C.length<D.length?I.u.set(C,D):I.u.set(D,C)):x.set(D,C)})}(p),p.j=new hn,p.j.Gd=p.l,p.o=new hn,p.o.Gd=p.s}(this)}function w1(e,n){function i(w){return w!="constructor"&&typeof h[w]=="function"&&!p.has(w)}var o,h=e.h,p=new Set;for(o in h)i(o)&&(p.add(o),n(o,h[o]));for(e=Object.getPrototypeOf(h),o=Object.getPrototypeOf({});e&&e!=o;){for(var g=T(Object.getOwnPropertyNames(e)),b=g.next();!b.done;b=g.next())i(b=b.value)&&(p.add(b),n(b,h[b]));e=Object.getPrototypeOf(e)}}function av(e){var n={video:{},player:{},playerAfterLoad:{},manifest:e.h.He(),startTime:null};e.i.pause();for(var i=T(tf),o=i.next();!o.done;o=i.next())o=o.value,n.video[o]=e.i[o];for(e.i.ended||(n.startTime=e.i.currentTime),o=(i=T(lc)).next();!o.done;o=i.next()){var h=o.value;o=h[1],h=e.h[h[0]](),n.player[o]=h}for(o=(i=T(iv)).next();!o.done;o=i.next())o=(h=o.value)[1],h=e.h[h[0]](),n.playerAfterLoad[o]=h;return n}function A1(e){var n=new dt("caststatuschanged");e.dispatchEvent(n)}function k1(e){var n=new dt(e.l.paused?"pause":"play");e.j.dispatchEvent(n)}function Dg(e){for(var n=T(lc),i=n.next();!i.done;i=n.next()){var o=i.value;i=o[1],o=e.g.get("player",o[0])(),e.h[i](o)}var h=e.g.get("player","getAssetUri")();o=e.g.get("video","ended"),n=Promise.resolve();var p,g=e.i.autoplay;i=null,o||(i=e.g.get("video","currentTime")),(o=e.g.get("player","getTextTracks")())&&o.length&&(p=o.find(function(k){return k.active}));var b=e.g.get("player","isTextTrackVisible")();h&&(e.i.autoplay=!1,n=e.h.load(h,i));var w={};for(o=(i=T(tf)).next();!o.done;o=i.next())o=o.value,w[o]=e.g.get("video",o);n.then(function(){if(e.i){for(var k=T(tf),I=k.next();!I.done;I=k.next())I=I.value,e.i[I]=w[I];for(I=(k=T(iv)).next();!I.done;I=k.next()){var x=I.value;I=x[1],x=e.g.get("player",x[0])(),e.h[I](x)}e.h.pg(b),p&&e.h.kf(p.language,p.roles,p.forced),e.i.autoplay=g,h&&e.i.play()}},function(k){k=new dt("error",k=new Map().set("detail",k)),e.h.dispatchEvent(k)})}function ov(e,n){if(n=="addEventListener")return function(o,h,p){return e.j.addEventListener(o,h,p)};if(n=="removeEventListener")return function(o,h,p){return e.j.removeEventListener(o,h,p)};if(e.g.Ka()&&Object.keys(e.g.g.video).length==0){var i=e.i[n];if(typeof i!="function")return i}return e.g.Ka()?e.g.get("video",n):(typeof(n=e.i[n])=="function"&&(n=n.bind(e.i)),n)}function ea(e,n,i){e.g.Ka()&&(n=="video"?e.j.dispatchEvent(i):n=="player"&&e.o.dispatchEvent(i))}function qr(e,n,i,o){hn.call(this);var h=this;this.g=e,this.h=n,this.j=new mn,this.H={video:e,player:n},this.C=i||function(){},this.J=o||function(p){return p},this.i=null,this.F=!1,this.o=!0,this.m=0,this.A=!1,this.u=!0,this.s=this.l=null,this.G=new Qt(function(){Ld(h)}),function(p){var g=cast.receiver.CastReceiverManager.getInstance();g.onSenderConnected=function(){return lv(p)},g.onSenderDisconnected=function(){return lv(p)},g.onSystemVolumeChanged=function(){var k=cast.receiver.CastReceiverManager.getInstance().getSystemVolume();k&&ho(p,{type:"update",update:{video:{volume:k.level,muted:k.muted}}},p.l),ho(p,{type:"event",targetName:"video",event:{type:"volumechange"}},p.l)},p.s=g.getCastMessageBus("urn:x-cast:com.google.cast.media"),p.s.onMessage=function(k){return function(I,x){var C=Rn(x.data);switch(C.type){case"PLAY":I.g.play(),hs(I);break;case"PAUSE":I.g.pause(),hs(I);break;case"SEEK":x=C.currentTime;var D=C.resumeState;x!=null&&(I.g.currentTime=Number(x)),D&&D=="PLAYBACK_START"?(I.g.play(),hs(I)):D&&D=="PLAYBACK_PAUSE"&&(I.g.pause(),hs(I));break;case"STOP":I.h.rc().then(function(){I.h&&hs(I)});break;case"GET_STATUS":Yl(I,Number(C.requestId));break;case"VOLUME":x=(D=C.volume).level,D=D.muted;var _=I.g.volume,j=I.g.muted;x!=null&&(I.g.volume=Number(x)),D!=null&&(I.g.muted=D),_==I.g.volume&&j==I.g.muted||hs(I);break;case"LOAD":I.m=0,I.A=!1,I.u=!1,x=C.media,D=C.currentTime,_=I.J(x.contentId),j=C.autoplay||!0,I.C(x.customData),j&&(I.g.autoplay=!0),I.h.load(_,D).then(function(){I.h&&Yl(I)}).catch(function(F){var B="LOAD_FAILED";F.category==7&&F.code==7e3&&(B="LOAD_CANCELLED"),ho(I,{requestId:Number(C.requestId),type:B},I.s)});break;default:ho(I,{requestId:Number(C.requestId),type:"INVALID_REQUEST",reason:"INVALID_COMMAND"},I.s)}}(p,k)},p.l=g.getCastMessageBus("urn:x-cast:com.google.shaka.v2"),p.l.onMessage=function(k){return function(I,x){var C=Rn(x.data);switch(C.type){case"init":I.m=0,I.A=!1,I.u=!0,function(B,H,Y){var te,q,X,he,ae,me,oe,ge,le,Ee;W(function(ve){switch(ve.g){case 1:for(te in H.player)q=H.player[te],B.h[te](q);return B.C(Y),X=B.g.autoplay,H.manifest?(B.g.autoplay=!1,ne(ve,5),N(ve,B.h.load(H.manifest,H.startTime),7)):N(ve,Promise.resolve(),3);case 7:ce(ve,3);break;case 5:return he=we(ve),ae=new Map().set("detail",he),me=new dt("error",ae),B.h&&B.h.dispatchEvent(me),ve.return();case 3:if(!B.h)return ve.return();for(oe in H.video)ge=H.video[oe],B.g[oe]=ge;for(le in H.playerAfterLoad)Ee=H.playerAfterLoad[le],B.h[le](Ee);B.g.autoplay=X,H.manifest&&(B.g.play(),hs(B)),re(ve)}})}(I,C.initState,C.appData),Ld(I);break;case"appData":I.C(C.appData);break;case"set":var D=C.targetName,_=C.property;if(C=C.value,D=="video"){if(x=cast.receiver.CastReceiverManager.getInstance(),_=="volume"){x.setSystemVolumeLevel(C);break}if(_=="muted"){x.setSystemVolumeMuted(C);break}}I.H[D][_]=C;break;case"call":(D=I.H[C.targetName])[C.methodName].apply(D,C.args);break;case"asyncCall":D=C.targetName,_=C.methodName,D=="player"&&_=="load"&&(I.m=0,I.A=!1);var j=C.id,F=x.senderId;C=(x=I.H[D])[_].apply(x,C.args),D=="player"&&_=="load"&&(C=C.then(function(){I.u=!0})),C.then(function(){return cv(I,F,j,null)},function(B){return cv(I,F,j,B)})}}(p,k)},g.start();for(var b=(g=T(Ig)).next();!b.done;b=g.next())p.j.D(p.g,b.value,function(k){return uv(p,"video",k)});for(var w in Co)p.j.D(p.h,Co[w],function(k){return uv(p,"player",k)});cast.Ot&&cast.Ot.canDisplayType('video/mp4; codecs="avc1.640028"; width=3840; height=2160')?p.h.qf(3840,2160):p.h.qf(1920,1080),p.j.D(p.g,"loadeddata",function(){p.A=!0}),p.j.D(p.h,"loading",function(){p.o=!1,Ti(p)}),p.j.D(p.g,"playing",function(){p.o=!1,Ti(p)}),p.j.D(p.g,"pause",function(){Ti(p)}),p.j.D(p.h,"unloading",function(){p.o=!0,Ti(p)}),p.j.D(p.g,"ended",function(){new Qt(function(){p.g&&p.g.ended&&(p.o=!0,Ti(p))}).U(x1)})}(this)}function lv(e){e.m=0,e.u=!0,e.F=cast.receiver.CastReceiverManager.getInstance().getSenders().length!=0,Ti(e)}function Ti(e){var n;W(function(i){return i.g==1?N(i,Promise.resolve(),2):e.h?(n=new dt("caststatuschanged"),e.dispatchEvent(n),co(e)||hs(e),void re(i)):i.return()})}function uv(e,n,i){e.h&&(Ld(e),ho(e,{type:"event",targetName:n,event:i},e.l))}function Ld(e){e.G.U(of);for(var n={video:{},player:{}},i=T(Lg),o=i.next();!o.done;o=i.next())o=o.value,n.video[o]=e.g[o];if(e.h.R())for(var h in Id)e.m%Id[h]==0&&(n.player[h]=e.h[h]());for(var p in xd)e.m%xd[p]==0&&(n.player[p]=e.h[p]());for(var g in(i=cast.receiver.CastReceiverManager.getInstance().getSystemVolume())&&(n.video.volume=i.level,n.video.muted=i.muted),ho(e,{type:"update",update:n},e.l),Wl)e.m%Wl[g]==0&&((n={player:{}}).player[g]=e.h[g](),ho(e,{type:"update",update:n},e.l));e.A&&(e.m+=1),co(e)}function co(e){return!(!e.u||!e.g.duration&&!e.h.R()||(Yl(e),e.u=!1,0))}function Yl(e,n){var i={contentId:e.h.He(),streamType:e.h.R()?"LIVE":"BUFFERED",contentType:""};e.h.R()||(i.duration=e.g.duration),e.i&&(i.metadata=e.i),hs(e,n===void 0?0:n,i)}function cv(e,n,i,o){e.h&&ho(e,{type:"asyncComplete",id:i,error:o},e.l,n)}function ho(e,n,i,o){e.F&&(e=rv(n),o?i.getCastChannel(o).send(e):i.broadcast(e))}function hs(e,n,i){i=i===void 0?null:i;var o={mediaSessionId:0,playbackRate:e.g.playbackRate,playerState:e.o?Rd:e.h.Le()?I1:e.g.paused?Pg:lf,currentTime:e.g.currentTime,supportedMediaCommands:63,volume:{level:e.g.volume,muted:e.g.muted}};i&&(o.media=i),ho(e,{requestId:n===void 0?0:n,type:"MEDIA_STATUS",status:[o]},e.s)}Z(vr,hn),(c=vr.prototype).destroy=function(e){return e&&this.g.cc(),this.m&&(this.m.release(),this.m=null),e=[],this.h&&(e.push(this.h.destroy()),this.h=null),this.g&&(e.push(this.g.destroy()),this.g=null),this.s=this.l=this.i=null,hn.prototype.release.call(this),Promise.all(e)},c.oh=function(){return this.l},c.dh=function(){return this.s},c.Gg=function(){return this.g.m&&cc},c.Ka=function(){return this.g.Ka()},c.ef=function(){return this.g.ef()},c.cast=function(){var e=this;return W(function(n){return n.g==1?N(n,e.g.cast(),2):e.h?N(n,e.h.rc(),0):n.return()})},c.mf=function(e){this.g.mf(e)},c.bi=function(){var e;(e=this.g).h&&chrome.cast.requestSession(function(n){return nf(e,n)},function(n){return rf(e,n)})},c.cc=function(){this.g.cc()},c.Hg=function(e,n){n=n!==void 0&&n;var i=this;return W(function(o){if(o.g==1)return e==i.C&&n==i.A?o.return():(i.C=e,i.A=n,i.g.cc(),N(o,i.g.destroy(),2));i.g=null,i.g=new Rg(e,function(){return A1(i)},function(){return k1(i)},function(h,p){return ea(i,h,p)},function(){return Dg(i)},function(){return av(i)},n),i.g.init(),re(o)})},We("shaka.cast.CastProxy",vr),vr.prototype.changeReceiverId=vr.prototype.Hg,vr.prototype.forceDisconnect=vr.prototype.cc,vr.prototype.suggestDisconnect=vr.prototype.bi,vr.prototype.setAppData=vr.prototype.mf,vr.prototype.cast=vr.prototype.cast,vr.prototype.receiverName=vr.prototype.ef,vr.prototype.isCasting=vr.prototype.Ka,vr.prototype.canCast=vr.prototype.Gg,vr.prototype.getPlayer=vr.prototype.dh,vr.prototype.getVideo=vr.prototype.oh,vr.prototype.destroy=vr.prototype.destroy,Z(qr,hn),(c=qr.prototype).isConnected=function(){return this.F},c.uh=function(){return this.o},c.$h=function(e){this.i=e},c.Kg=function(){this.i=null},c.ai=function(e){this.i||(this.i={metadataType:cast.receiver.media.MetadataType.GENERIC}),this.i.title=e},c.Zh=function(e){this.i||(this.i={metadataType:cast.receiver.media.MetadataType.GENERIC}),this.i.images=[{url:e}]},c.Yh=function(e){this.i||(this.i={}),this.i.artist=e,this.i.metadataType=cast.receiver.media.MetadataType.MUSIC_TRACK},c.destroy=function(){var e,n=this;return W(function(i){if(i.g==1)return n.j&&(n.j.release(),n.j=null),e=[],n.h&&(e.push(n.h.destroy()),n.h=null),n.G&&(n.G.stop(),n.G=null),n.g=null,n.H=null,n.C=null,n.F=!1,n.o=!0,n.l=null,n.s=null,hn.prototype.release.call(n),N(i,Promise.all(e),2);cast.receiver.CastReceiverManager.getInstance().stop(),re(i)})},We("shaka.cast.CastReceiver",qr),qr.prototype.destroy=qr.prototype.destroy,qr.prototype.setContentArtist=qr.prototype.Yh,qr.prototype.setContentImage=qr.prototype.Zh,qr.prototype.setContentTitle=qr.prototype.ai,qr.prototype.clearContentMetadata=qr.prototype.Kg,qr.prototype.setContentMetadata=qr.prototype.$h,qr.prototype.isIdle=qr.prototype.uh,qr.prototype.isConnected=qr.prototype.isConnected;var of=.5,x1=5,Rd="IDLE",lf="PLAYING",I1="BUFFERING",Pg="PAUSED";function Mg(e,n,i,o,h){if(o>=h)return null;for(var p=-1,g=-1,b=0;b<i.length;b++)if(i[b].some(function(te){return te!=null&&te.g.trim()!=""})){p=b;break}for(b=i.length-1;0<=b;b--)if(i[b].some(function(te){return te!=null&&te.g.trim()!=""})){g=b;break}if(p===-1||g===-1)return null;for(var w=b=!1,k="white",I="black",x=uf(o,h,b,w,k,I);p<=g;p++){for(var C=i[p],D=-1,_=-1,j=0;j<C.length;j++)if(C[j]!=null&&C[j].g.trim()!==""){D=j;break}for(j=C.length-1;0<=j;j--)if(C[j]!=null&&C[j].g.trim()!==""){_=j;break}if(D===-1||_===-1)C=cf(o,h),e.nestedCues.push(C);else{for(;D<=_;D++)if(j=C[D]){var F=j.l,B=j.i,H=j.j,Y=j.h;F==b&&B==w&&H==k&&Y==I||(x.payload&&e.nestedCues.push(x),x=uf(o,h,F,B,H,Y),b=F,w=B,k=H,I=Y),x.payload+=j.g}else x.payload+=" ";x.payload&&e.nestedCues.push(x),p!==g&&(x=cf(o,h),e.nestedCues.push(x)),x=uf(o,h,b,w,k,I)}}return e.nestedCues.length?{cue:e,stream:n}:null}function uf(e,n,i,o,h,p){return e=new Bn(e,n,""),i&&e.textDecoration.push("underline"),o&&(e.fontStyle="italic"),e.color=h,e.backgroundColor=p,e}function cf(e,n){return(e=new Bn(e,n,"")).lineBreak=!0,e}function dv(e,n,i,o,h){this.g=e,this.l=n,this.i=i,this.h=o,this.j=h}function Og(e,n){this.i=[],this.g=1,this.h=0,this.u=e,this.s=n,this.j=this.m=!1,this.l="white",this.o="black",Yo(this)}function df(e,n,i){var o="CC"+(1+(e.u<<1|e.s)),h=new Bn(n,i,"");h.lineInterpretation=1;var p=fv.get(e.g);return p&&(h.line=p),Mg(h,o,e.i,n,i)}function Yo(e){ta(e,0,15),e.g=1}function Cd(e,n,i){if(!(32>i||127<i)){var o="";switch(n){case hc:o=hv.has(i)?hv.get(i):String.fromCharCode(i);break;case L1:o=C1.get(i);break;case Dd:e.i[e.g].pop(),o=D1.get(i);break;case R1:e.i[e.g].pop(),o=P1.get(i)}o&&e.i[e.g].push(new dv(o,e.m,e.j,e.o,e.l))}}function hf(e,n,i,o){if(!(0>i||0>n))if(n>=i)for(--o;0<=o;o--)e.i[n+o]=e.i[i+o].map(function(p){return p});else for(var h=0;h<o;h++)e.i[n+h]=e.i[i+h].map(function(p){return p})}function ta(e,n,i){for(var o=0;o<=i;o++)e.i[n+o]=[]}var hc=0,L1=1,Dd=2,R1=3,hv=new Map([[39,"’"],[42,"á"],[92,"é"],[92,"é"],[94,"í"],[95,"ó"],[96,"ú"],[123,"ç"],[124,"÷"],[125,"Ñ"],[126,"ñ"],[127,"█"]]),C1=new Map([[48,"®"],[49,"°"],[50,"½"],[51,"¿"],[52,"™"],[53,"¢"],[54,"£"],[55,"♪"],[56,"à"],[57," "],[58,"è"],[59,"â"],[60,"ê"],[61,"î"],[62,"ô"],[63,"û"]]),D1=new Map([[32,"Á"],[33,"É"],[34,"Ó"],[35,"Ú"],[36,"Ü"],[37,"ü"],[38,"‘"],[39,"¡"],[40,"*"],[41,"'"],[42,"─"],[43,"©"],[44,"℠"],[45,"·"],[46,"“"],[47,"”"],[48,"À"],[49,"Â"],[50,"Ç"],[51,"È"],[52,"Ê"],[53,"Ë"],[54,"ë"],[55,"Î"],[56,"Ï"],[57,"ï"],[58,"Ô"],[59,"Ù"],[60,"ù"],[61,"Û"],[62,"«"],[63,"»"]]),P1=new Map([[32,"Ã"],[33,"ã"],[34,"Í"],[35,"Ì"],[36,"ì"],[37,"Ò"],[38,"ò"],[39,"Õ"],[40,"õ"],[41,"{"],[42,"}"],[43,"\\"],[44,"^"],[45,"_"],[46,"|"],[47,"~"],[48,"Ä"],[49,"ä"],[50,"Ö"],[51,"ö"],[52,"ß"],[53,"¥"],[54,"¤"],[55,"│"],[56,"Å"],[57,"å"],[58,"Ø"],[59,"ø"],[60,"┌"],[61,"┐"],[62,"└"],[63,"┘"]]),fv=new Map([[1,10],[2,15.33],[3,20.66],[4,26],[5,31.33],[6,36.66],[7,42],[8,47.33],[9,52.66],[10,58],[11,63.33],[12,68.66],[13,74],[14,79.33],[15,84.66]]);function ff(e,n){this.h=Ng,this.o=new Og(e,n),this.i=new Og(e,n),this.g=this.j=new Og(e,n),this.l=0,this.m=null}function Pd(e,n,i){e.g=e.i;var o=e.g,h=null;return e.h!==fc&&e.h!==pc&&(h=df(o,e.l,i),(i=e.i).g=0<i.h?i.h:0,ta(i,0,15),(i=e.j).g=0<i.h?i.h:0,ta(i,0,15),o.g=15),e.h=fc,o.h=n,h}function M1(e){e.h=pv,e.g=e.j,e.g.h=0}function O1(e){Lr("Cea608DataChannel","CEA-608 text mode entered, but is unsupported"),e.g=e.o,e.h=pc}var Ng=0,pv=1,fc=3,pc=4,N1="black green blue cyan red yellow magenta black".split(" "),_g="white green blue cyan red yellow magenta white_italics".split(" ");function Qo(e,n){this.J=n,this.N=e,this.K=this.l=!1,this.m=this.o=this.G=this.L=this.H=0,this.F=pf,this.i=[],this.g=this.h=this.j=0,this.C=this.u=!1,this.A="white",this.s="black",fo(this)}function fo(e){e.i=[];for(var n=0;16>n;n++)e.i.push(po())}function po(){for(var e=[],n=0;42>n;n++)e.push(null);return e}function Xo(e,n){Md(e)&&(e.i[e.h][e.g]=new dv(n,e.C,e.u,e.s,e.A),e.g++)}function Md(e){var n=e.g<e.m&&0<=e.g;return e.h<e.o&&0<=e.h&&n}function fs(e,n,i){var o=new Bn(e.j,n,"");o.textAlign=e.F===eS?"left":e.F===_1?"right":ja;var h=o.region;switch(e.J&&(h.id+="svc"+e.J),h.id+="win"+e.N,h.height=e.o,h.width=e.m,h.heightUnits=2,h.widthUnits=2,h.viewportAnchorX=e.H,h.viewportAnchorY=e.L,h.viewportAnchorUnits=e.K?ii:2,e.G){case F1:h.regionAnchorX=0,h.regionAnchorY=0;break;case Fg:h.regionAnchorX=50,h.regionAnchorY=0;break;case U1:h.regionAnchorX=100,h.regionAnchorY=0;break;case tS:h.regionAnchorX=0,h.regionAnchorY=50;break;case Ug:h.regionAnchorX=50,h.regionAnchorY=50;break;case Bg:h.regionAnchorX=100,h.regionAnchorY=50;break;case B1:h.regionAnchorX=0,h.regionAnchorY=100;break;case gf:h.regionAnchorX=50,h.regionAnchorY=100;break;case gv:h.regionAnchorX=100,h.regionAnchorY=100}return(i=Mg(o,"svc"+i,e.i,e.j,n))&&(e.j=n),i}Qo.prototype.isVisible=function(){return this.l};var eS=0,_1=1,pf=2,F1=0,Fg=1,U1=2,tS=3,Ug=4,Bg=5,B1=6,gf=7,gv=8;function $g(){this.i=[],this.h=null,this.g=0}function $1(e,n){n.type===3?(e.g=2*(63&n.value)-1,e.h=[]):e.h&&(0<e.g&&(e.h.push(n),e.g--),e.g===0&&(e.i.push(new jg(e.h)),e.h=null,e.g=0))}function jg(e){this.g=0,this.h=e}function wr(e){if(!e.ea())throw new fe(2,2,3e3);return e.h[e.g++]}function l(e){this.i=e,this.h=[null,null,null,null,null,null,null,null],this.g=null}function d(e,n,i,o){if(128<=i&&135>=i)o=7&i,e.h[o]&&(e.g=e.h[o]);else{if(i===136){i=wr(n).value,n=null;for(var h=(i=T(m(e,i))).next();!h.done;h=i.next())(h=e.h[h.value]).isVisible()&&(n=fs(h,o,e.i)),fo(h);return n}if(i===137)for(i=(n=T(m(e,n=wr(n).value))).next();!i.done;i=n.next())(i=e.h[i.value]).isVisible()||(i.j=o),i.l=!0;else{if(i===138){for(i=wr(n).value,n=null,h=(i=T(m(e,i))).next();!h.done;h=i.next())(h=e.h[h.value]).isVisible()&&(n=fs(h,o,e.i)),h.l=!1;return n}if(i===139){for(i=wr(n).value,n=null,h=(i=T(m(e,i))).next();!h.done;h=i.next())(h=e.h[h.value]).isVisible()?n=fs(h,o,e.i):h.j=o,h.l=!h.l;return n}if(i===140)return S(e,n=wr(n).value,o);if(i===143)return o=S(e,255,o),R(e),o;if(i===144)n.skip(1),o=wr(n).value,e.g&&(e.g.u=0<(128&o),e.g.C=0<(64&o));else if(i===145)o=wr(n).value,i=wr(n).value,n.skip(1),e.g&&(n=P((48&i)>>4,(12&i)>>2,3&i),e.g.A=P((48&o)>>4,(12&o)>>2,3&o),e.g.s=n);else if(i===146)o=wr(n).value,n=wr(n).value,e.g&&((e=e.g).h=15&o,e.g=63&n);else if(i===151)n.skip(1),n.skip(1),o=wr(n).value,n.skip(1),e.g&&(e.g.F=3&o);else if(152<=i&&159>=i){if(i=(15&i)-8,!(h=e.h[i]!==null)){var p=new Qo(i,e.i);p.j=o,e.h[i]=p}o=wr(n).value,p=wr(n).value;var g=wr(n).value,b=wr(n).value,w=wr(n).value;n=wr(n).value,h&&!(7&n)||((n=e.h[i]).h=0,n.g=0,n.C=!1,n.u=!1,n.A="white",n.s="black"),(n=e.h[i]).l=0<(32&o),n.L=127&p,n.H=g,n.G=(240&b)>>4,n.K=0<(128&p),n.o=1+(15&b),n.m=1+(63&w),e.g=e.h[i]}}}return null}function m(e,n){for(var i=[],o=0;8>o;o++)!(1&~n)&&e.h[o]&&i.push(o),n>>=1;return i}function S(e,n,i){for(var o=null,h=(n=T(m(e,n))).next();!h.done;h=n.next()){h=h.value;var p=e.h[h];p.isVisible()&&(o=fs(p,i,e.i)),e.h[h]=null}return o}function R(e){e.g=null,e.h=[null,null,null,null,null,null,null,null]}function P(e,n,i){var o={0:0,1:0,2:1,3:1};return K[(e=o[e])<<2|(n=o[n])<<1|(i=o[i])]}jg.prototype.ea=function(){return this.g<this.h.length},jg.prototype.oa=function(){return this.g},jg.prototype.skip=function(e){if(this.g+e>this.h.length)throw new fe(2,2,3e3);this.g+=e};var V=new Map([[32," "],[33," "],[37,"…"],[42,"Š"],[44,"Œ"],[48,"█"],[49,"‘"],[50,"’"],[51,"“"],[52,"”"],[53,"•"],[57,"™"],[58,"š"],[60,"œ"],[61,"℠"],[63,"Ÿ"],[118,"⅛"],[119,"⅜"],[120,"⅝"],[121,"⅞"],[122,"│"],[123,"┐"],[124,"└"],[125,"─"],[126,"┘"],[127,"┌"]]),K="black blue green cyan red magenta yellow white".split(" ");function ee(){this.h=[],this.g=[],this.i=new $g,this.l=0,this.m=new Map([["CC1",new ff(0,0)],["CC2",new ff(0,1)],["CC3",new ff(1,0)],["CC4",new ff(1,1)]]),this.s=this.o=0,this.j=new Map,this.A=!0,this.u=new Set,pe(this)}function pe(e){e.o=0,e.s=0;for(var n=T(e.m.values()),i=n.next();!i.done;i=n.next())(i=i.value).h=Ng,i.g=i.j,i.m=null,Yo(i.i),Yo(i.j),Yo(i.o);e.A=!0}function Ne(e,n){var i=n.type;if((112&n.Ga)==16){var o=n.Ga>>3&1;i===0?e.o=o:e.s=o}if(o="CC"+(1+(i<<1|(i?e.s:e.o))),i=e.m.get(o),n.Ga===255&&n.lb===255||!n.Ga&&!n.lb||!Ue(n.Ga)||!Ue(n.lb))return 45<=++e.l&&pe(e),null;e.l=0,n.Ga&=127,n.lb&=127;var h=n.Ga;if(1<=h&&15>=h||!n.Ga&&!n.lb)return null;if(h=null,(112&n.Ga)==16)e:{if(e.u.add(o),o=n.Ga,e=n.lb,i.m===(o<<8|e))i.m=null;else if(i.m=o<<8|e,(240&o)==16&&(192&e)==64){n=[11,11,1,2,3,4,12,13,14,15,5,6,7,8,9,10][(7&o)<<1|e>>5&1];var p=(30&e)>>1;o="white",h=!1,7>p?o=_g[p]:p===7&&(h=!0),e=!(1&~e),i.h!==pc&&(p=i.g,i.h===fc&&n!==p.g&&(hf(p,i=1+n-p.h,1+p.g-p.h,p.h),ta(p,0,i-1),ta(p,n+1,15-n)),p.g=n,p.m=e,p.j=h,p.l=o,p.o="black")}else if((247&o)==17&&(240&e)==32)i.g.m=!1,i.g.j=!1,i.g.l="white",Cd(i.g,hc,32),o=!1,(n=_g[(14&e)>>1])==="white_italics"&&(n="white",o=!0),i.g.m=!(1&~e),i.g.j=o,i.g.l=n;else if((247&o)==16&&(240&e)==32||(247&o)==23&&(255&e)==45)n="black",!(7&o)&&(n=N1[(14&e)>>1]),i.g.o=n;else if((247&o)==17&&(240&e)==48)Cd(i.g,L1,e);else if((246&o)==18&&(224&e)==32)Cd(i.g,1&o?R1:Dd,e);else if((246&o)==20&&(240&e)==32){switch(e=n.pts,o=null,n.lb){case 32:M1(i);break;case 33:(i=i.g).i[i.g].pop();break;case 37:o=Pd(i,2,e);break;case 38:o=Pd(i,3,e);break;case 39:o=Pd(i,4,e);break;case 40:Cd(i.g,hc,32);break;case 41:i.h=2,i.g=i.i,i.g.h=0,i.l=e;break;case 42:Yo(i.o),O1(i);break;case 43:O1(i);break;case 44:n=i.i,o=null,i.h!==pc&&(o=df(n,i.l,e)),ta(n,0,15);break;case 45:n=i.g,i.h!==fc?o=null:(o=df(n,i.l,e),hf(n,(h=n.g-n.h+1)-1,h,n.h),ta(n,0,h-1),ta(n,n.g,15-n.g),i.l=e);break;case 46:ta(i.j,0,15);break;case 47:n=null,i.h!==pc&&(n=df(i.i,i.l,e)),o=i.j,i.j=i.i,i.i=o,M1(i),i.l=e,o=n}h=o;break e}h=null}else e=n.lb,Cd(i.g,hc,n.Ga),Cd(i.g,hc,e);return h}function qe(e,n){var i=[];try{for(;n.ea();){var o=wr(n).value,h=(224&o)>>5,p=31&o;if(h===7&&p!=0&&(h=63&wr(n).value),h!=0){e.u.add("svc"+h),e.j.has(h)||e.j.set(h,new l(h));for(var g=e.j.get(h),b=n.oa();n.oa()-b<p;){var w=wr(h=n),k=w.value,I=w.pts;if(k===16&&(k=k<<16|wr(h).value),0<=k&&31>=k){var x=I;if(g.g){var C=g.g;switch(h=null,k){case 8:!Md(C)||0>=C.g&&0>=C.h||(0>=C.g?(C.g=C.m-1,C.h--):C.g--,C.i[C.h][C.g]=null);break;case 13:if(C.isVisible()&&(h=fs(C,x,g.i)),C.h+1>=C.o){x=C;for(var D=0,_=1;16>_;_++,D++)x.i[D]=x.i[_];for(_=0;1>_;_++,D++)x.i[D]=po()}else C.h++;C.g=0;break;case 14:C.isVisible()&&(h=fs(C,x,g.i)),C.i[C.h]=po(),C.g=0;break;case 12:C.isVisible()&&(h=fs(C,x,g.i)),fo(C),(x=C).h=0,x.g=0}var j=h}else j=null}else if(128<=k&&159>=k)j=d(g,h,k,I);else{if(4096<=k&&4127>=k)8<=(x=255&k)&&15>=x?h.skip(1):16<=x&&23>=x?h.skip(2):24<=x&&31>=x&&h.skip(3);else if(4224<=k&&4255>=k)128<=(x=255&k)&&135>=x?h.skip(4):136<=x&&143>=x&&h.skip(5);else if(32<=k&&127>=k)h=k,g.g&&Xo(g.g,h===127?"♪":String.fromCharCode(h));else if(160<=k&&255>=k)g.g&&Xo(g.g,String.fromCharCode(k));else if(4128<=k&&4223>=k){if(h=255&k,g.g)if(V.has(h)){var F=V.get(h);Xo(g.g,F)}else Xo(g.g,"_")}else 4256<=k&&4351>=k&&g.g&&Xo(g.g,(255&k)!=160?"_":"[CC]");j=null}(h=j)&&i.push(h)}}}}catch(B){if(!(B instanceof fe&&B.code===3e3))throw B;Lr("CEA708_INVALID_DATA","Buffer read out of bounds / invalid CEA-708 Data.")}return i}function Ue(e){for(var n=0;e;)n^=1&e,e>>=1;return n===1}function Ze(e){for(var n=[],i=e,o=e=0;o<i.length;)e==2&&i[o]==3?(e=0,(i=[].concat(M(i))).splice(o,1),i=new Uint8Array(i)):i[o]==0?e++:e=0,o++;for(e=i,o=0;o<e.length;){for(i=0;e[o]==255;)i+=255,o++;i+=e[o++];for(var h=0;e[o]==255;)h+=255,o++;h+=e[o++],i==4&&n.push(e.subarray(o,o+h)),o+=h}return n}function Xe(){this.j=new Map,this.i=this.h=0,this.g=Le}ee.prototype.clear=function(){this.l=0,this.h=[],this.g=[];var e=this.i;e.i=[],e.h=[],e.g=0,pe(this);for(var n=(e=T(this.j.values())).next();!n.done;n=e.next())R(n.value)},ee.prototype.extract=function(e,n){if(this.A){for(var i=T(this.m.values()),o=i.next();!o.done;o=i.next())o.value.l=n;this.A=!1}if(!(8>(e=new xn(e,0)).getLength())&&e.fa()===181&&e.wa()===49&&e.M()===1195456820&&e.fa()===3&&64&(i=e.fa()))for(i&=31,e.skip(1),o=0;o<i;o++){var h=e.fa(),p=(4&h)>>2,g=e.fa(),b=e.fa();p&&((h&=3)==0||h===1?this.h.push({pts:n,type:h,Ga:g,lb:b,order:this.h.length}):(this.g.push({pts:n,type:h,value:g,order:this.g.length}),this.g.push({pts:n,type:2,value:b,order:this.g.length})))}},ee.prototype.decode=function(){function e(h,p){return h.pts-p.pts||h.order-p.order}var n=[];this.h.sort(e),this.g.sort(e);for(var i=T(this.h),o=i.next();!o.done;o=i.next())(o=Ne(this,o.value))&&n.push(o);for(o=(i=T(this.g)).next();!o.done;o=i.next())$1(this.i,o.value);for(o=(i=T(this.i.i)).next();!o.done;o=i.next())o=qe(this,o.value),n.push.apply(n,M(o));return this.i.i=[],this.h=[],this.g=[],n},ee.prototype.getStreams=function(){return Array.from(this.u)},We("shaka.cea.CeaDecoder",ee),bl=function(){return new ee},Xe.prototype.init=function(e){function n(p){(p=p.name)in Je&&(i.g=Je[p])}var i=this,o=[],h=[];if(new _n().box("moov",cn).box("mvex",cn).O("trex",function(p){var g=p.reader;g.skip(4),g.skip(4),p=g.M(),g=g.M(),i.h=p,i.i=g}).box("trak",cn).O("tkhd",function(p){p=$p(p.reader,p.version),o.push(p.trackId)}).box("mdia",cn).O("mdhd",function(p){p=Bu(p.reader,p.version),h.push(p.timescale)}).box("minf",cn).box("stbl",cn).O("stsd",qa).box("avc1",n).box("avc3",n).box("hev1",n).box("hvc1",n).box("dvh1",n).box("dvhe",n).box("encv",id).box("sinf",cn).box("frma",function(p){(p=Ay(p.reader).ja)in Je&&(i.g=Je[p])}).parse(e,!0),!o.length||!h.length||o.length!=h.length)throw new fe(2,2,2010);this.g==Le&&Rt("Unable to determine bitstream format for CEA parsing!"),o.forEach(function(p,g){i.j.set(p,h[g])})},Xe.prototype.parse=function(e){var n=this;if(this.g==Le)return[];var i=[],o=this.h,h=this.i,p=0,g=[],b=null,w=9e4;return new _n().box("moof",function(k){p=k.start,g=[],cn(k)}).box("traf",cn).O("trun",function(k){k=Sy(k.reader,k.version,k.flags),g.push(k)}).O("tfhd",function(k){k=Ty(k.reader,k.flags),o=k.Kf||n.h,h=k.Ng||n.i,k=k.trackId,n.j.has(k)&&(w=n.j.get(k))}).O("tfdt",function(k){b=ld(k.reader,k.version).baseMediaDecodeTime}).box("mdat",function(k){if(b===null)throw Rt("Unable to find base media decode time for CEA captions!"),new fe(2,2,2010);(function(I,x,C,D,_,j,F,B,H){var Y=0,te=j,q=B.map(function(ae){return ae.ig});for((q=[].concat.apply([],M(q))).length&&(te=q[0].sampleSize||j),x.skip(F+B[0].Mg);x.ea();){F=x.M();var X=x.fa(),he=null;switch(he=!1,B=1,I.g){case Te:he=(he=31&X)==6;break;case Ie:B=2,x.skip(1),he=(he=X>>1&63)==39||he==40;break;default:return}if(he)for(X=0,Y<q.length&&(X=q[Y].Xd||0),X=(C+X)/D,he=(B=T(Ze(x.rb(F-B)))).next();!he.done;he=B.next())H.push({packet:he.value,pts:X});else try{x.skip(F-B)}catch{break}(te-=F+4)==0&&(C=Y<q.length?C+(q[Y].hf||_):C+_,te=++Y<q.length&&q[Y].sampleSize||j)}})(n,k.reader,b,w,o,h,p-k.start-8,g,i)}).parse(e,!1),i},We("shaka.cea.Mp4CeaParser",Xe);var Le=0,Te=1,Ie=2,Je={avc1:Te,avc3:Te,hev1:Ie,hvc1:Ie,dvh1:Ie,dvhe:Ie};function kt(){this.g=null}function St(e,n,i){var o=function(w){for(var k=[],I=(w=T(w)).next();!I.done;I=w.next())(I=ut(I.value))&&k.push(I);return k}(e),h=null;e=[];var p=[],g=null,b=new Set(o.map(function(w){return w.keyId}));if(b.delete(null),1<b.size)throw new fe(2,4,4010);if(!n){if(p=o.filter(function(w){return w.cd=="urn:mpeg:dash:sea:2012"}),1<p.length)throw new fe(2,4,4050);p.length&&(g=function(w){if(!s.crypto||!s.crypto.subtle)throw Rt("Web Crypto API is not available to decrypt AES-128. (Web Crypto only exists in secure origins like https)"),new fe(2,4,4042);var k=dr(w.node,"urn:mpeg:dash:schema:sea:2012","SegmentEncryption");if(!k)throw new fe(2,4,4051);if(k.getAttribute("schemeIdUri")!="urn:mpeg:dash:sea:aes128-cbc:2013")throw new fe(2,4,4051);if(!(k=dr(w.node,"urn:mpeg:dash:schema:sea:2012","CryptoPeriod")))throw new fe(2,4,4051);if(w=k.getAttribute("IV"),k=k.getAttribute("keyUriTemplate"),!w||!k)throw new fe(2,4,4051);if((w=oi(w.substr(2))).byteLength!=16)throw new fe(2,4,4048);return{Ah:k,iv:w}}(p[0])),p=o.filter(function(w){return w.cd=="urn:mpeg:dash:mp4protection:2011"?(h=w.init||h,!1):w.cd!="urn:mpeg:dash:sea:2012"}),p.length&&(e=function(w,k,I,x){for(var C=[],D=(k=T(k)).next();!D.done;D=k.next()){var _=I[(D=D.value).cd];if(_){var j;if(j=dr(D.node,"urn:microsoft:playready","pro")){j=ns(j.textContent);var F=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);j=[{initData:ba(j,F,new Set,0),initDataType:"cenc",keyId:D.keyId}]}else j=null;if(F=null,D.cd==="urn:uuid:e2719d58-a985-b3c9-781a-b030af78d30e")if((F=x).size==0)F=null;else{var B=new Uint8Array([16,119,239,236,192,178,77,2,172,227,60,30,82,226,251,75]);F=[{initData:ba(new Uint8Array([]),B,F,1),initDataType:"cenc",keyId:D.keyId}]}j=Al(_,D.init||w||j||F),(_=It.get(_))&&(j.licenseServerUri=_(D)),C.push(j)}}return C}(h,p,i,b),e.length==0&&(e=[Al("",h)]))}if(o.length&&!g&&(n||!p.length))for(e=[],i=(n=T(Object.values(i))).next();!i.done;i=n.next())(i=i.value)!="org.w3.clearkey"&&e.push(Al(i,h));if(b=Array.from(b)[0]||null)for(i=(n=T(e)).next();!i.done;i=n.next())for(o=(i=T(i.value.initData)).next();!o.done;o=i.next())o.value.keyId=b;return{Jf:b,bj:h,drmInfos:e,le:g,Nf:!0}}function zt(e){var n=dr(e.node,"https://dashif.org/CPS","Laurl");return n&&n.textContent?n.textContent:(e=dr(e.node,"urn:microsoft:playready","pro"))?(e=function(i){var o=0,h=Nr(i),p=h.getUint32(o,!0);if(p!=i.byteLength)return[];e:{for(i=o+6,o=[];i<h.byteLength-1;){p=h.getUint16(i,!0),i+=2;var g=h.getUint16(i,!0);if(i+=2,1&g||g+i>h.byteLength){h=[];break e}var b=Nt(h,i,g);o.push({type:p,value:b}),i+=g}h=o}return h}(e=ns(e.textContent)).filter(function(i){return i.type===Qn})[0],e&&(e=Ou(e=ws(e.value,!0),"WRMHEADER"))?function(i){for(var o=(i=T(i.getElementsByTagName("DATA"))).next();!o.done;o=i.next())for(var h=(o=T(o.value.childNodes)).next();!h.done;h=o.next())if((h=h.value)instanceof Element&&h.tagName=="LA_URL")return h.textContent;return""}(e):""):""}function ut(e){var n=e.getAttribute("schemeIdUri"),i=Mu(e,"urn:mpeg:cenc:2013","default_KID"),o=r1(e,"urn:mpeg:cenc:2013","pssh").map(Tr);if(!n)return null;if(n=n.toLowerCase(),i&&(i=i.replace(/-/g,"").toLowerCase()).includes(" "))throw new fe(2,4,4009);var h=[];try{h=o.map(function(p){return{initDataType:"cenc",initData:ns(p),keyId:null}})}catch{throw new fe(2,4,4007)}return{node:e,cd:n,keyId:i,init:0<h.length?h:null}}vl["video/mp4"]=function(){return new Xe},kt.prototype.init=function(){},kt.prototype.parse=function(e){this.g?this.g.clearData():this.g=new Mn;var n=[];if(!Vp(e=Nt(e)))return n;var i=(e=this.g.parse(e)).Rc(),o=e.Fd();switch(e=[],i.video){case"avc":e.push(6);break;case"hvc":e.push(39),e.push(40)}if(!e.length)return n;for(o=(i=T(o)).next();!o.done;o=i.next())if(o=o.value,e.includes(o.type)&&o.time!=null)for(var h=T(Ze(o.data)),p=h.next();!p.done;p=h.next())n.push({packet:p.value,pts:o.time});return n},We("shaka.cea.TsCeaParser",kt),vl["video/mp2t"]=function(){return new kt};var Qn=1,It=new Map().set("com.widevine.alpha",function(e){var n=dr(e.node,"https://dashif.org/CPS","Laurl");return n&&n.textContent?n.textContent:(e=dr(e.node,"urn:microsoft","laurl"))&&e.getAttribute("licenseUrl")||""}).set("com.microsoft.playready",zt).set("com.microsoft.playready.recommendation",zt).set("com.microsoft.playready.software",zt).set("com.microsoft.playready.hardware",zt).set("org.w3.clearkey",function(e){var n=dr(e.node,"https://dashif.org/CPS","Laurl");return n&&n.textContent?n.textContent:(e=dr(e.node,"http://dashif.org/guidelines/clearKey","Laurl"))&&e.getAttribute("Lic_type")==="EME-1.0"&&e.textContent?e.textContent:""});function jt(e,n,i,o,h,p){var g={RepresentationID:n,Number:i,SubNumber:o,Bandwidth:h,Time:p};return e.replace(/\$(RepresentationID|Number|SubNumber|Bandwidth|Time)?(?:%0([0-9]+)([diouxX]))?\$/g,function(b,w,k,I){if(b=="$$")return"$";var x=g[w];if(x==null)return b;switch(w=="RepresentationID"&&k&&(k=void 0),w=="Time"&&typeof x!="bigint"&&(.2<=Math.abs(x-Math.round(x))&&Rt("Calculated $Time$ values must be close to integers"),x=Math.round(x)),I){case void 0:case"d":case"i":case"u":b=x.toString();break;case"o":b=x.toString(8);break;case"x":b=x.toString(16);break;case"X":b=x.toString(16).toUpperCase();break;default:b=x.toString()}return k=s.parseInt(k,10)||1,Array(Math.max(0,k-b.length)+1).join("0")+b})}function ft(e,n){var i=kn(e,n,"timescale"),o=1;i&&(o=Xa(i)||1);var h=kn(e,n,"duration");i=Xa(h||""),e.I.contentType=="image"&&(i=Ja(h||"")),i&&(i/=o);var p=kn(e,n,"startNumber");h=Number(kn(e,n,"presentationTimeOffset"))||0;var g=vi(p||"");p!=null&&g!=null||(g=1);var b=Ht(e,n,"SegmentTimeline");if(n=null,b){n=o,e=e.aa.duration||1/0,p=g,b=jn(b,"S");for(var w=[],k=-h,I=0;I<b.length;++I){var x=b[I],C=b[I+1],D=Vt(x,"t",vi),_=Vt(x,"d",vi),j=Vt(x,"r",Qa);if(x=Vt(x,"k",Qa)||0,D!=null&&(D-=h),!_)break;if(D=D??k,0>(j=j||0))if(C){if((C=Vt(C,"t",vi))==null||D>=C)break;j=Math.ceil((C-D)/_)-1}else{if(e==1/0||D/n>=e)break;j=Math.ceil((e*n-D)/_)-1}for(0<w.length&&D!=k&&(w[w.length-1].end=D/n),C=0;C<=j;++C)k=D+_,w.push({start:D/n,end:k/n,zf:D,gb:x,Wh:w.length+p}),D=k}n=w}return{timescale:o,xa:i,gd:g,sb:h/o||0,yf:h,timeline:n}}function Gt(e,n){return[n(e.I),n(e.ma),n(e.ra)].filter(Va)}function kn(e,n,i){n=Gt(e,n),e=null;for(var o=(n=T(n)).next();!o.done&&!(e=o.value.getAttribute(i));o=n.next());return e}function Ht(e,n,i){n=Gt(e,n),e=null;for(var o=(n=T(n)).next();!o.done&&!(e=zr(o.value,i));o=n.next());return e}function Ar(e,n,i,o,h,p){if(p=p===void 0?0:p,Mu(e,"http://www.w3.org/1999/xlink","href")){var g=function(k,I,x,C,D,_){for(var j=Mu(k,"http://www.w3.org/1999/xlink","href"),F=Mu(k,"http://www.w3.org/1999/xlink","actuate")||"onRequest",B=T(Array.from(k.attributes)),H=B.next();!H.done;H=B.next())(H=H.value).namespaceURI=="http://www.w3.org/1999/xlink"&&k.removeAttributeNS(H.namespaceURI,H.localName);if(5<=_)return ts(new fe(2,4,4028));if(F!="onLoad")return ts(new fe(2,4,4027));var Y=Rr([C],[j]);return D.request(0,lr(Y,I)).na(function(te){if(!(te=Za(te.data,k.tagName)))return ts(new fe(2,4,4001,j));for(;k.childNodes.length;)k.removeChild(k.childNodes[0]);for(;te.childNodes.length;){var q=te.childNodes[0];te.removeChild(q),k.appendChild(q)}for(q=(te=T(Array.from(te.attributes))).next();!q.done;q=te.next())k.setAttributeNode(q.value.cloneNode(!1));return Ar(k,I,x,Y[0],D,_+1)})}(e,n,i,o,h,p);return i&&(g=g.na(void 0,function(){return Ar(e,n,i,o,h,p)})),g}g=[];for(var b=T(Array.from(e.childNodes)),w=b.next();!w.done;w=b.next())(w=w.value)instanceof Element&&(Mu(w,"http://www.w3.org/1999/xlink","href")=="urn:mpeg:dash:resolve-to-zero:2013"?e.removeChild(w):w.tagName!="SegmentTimeline"&&g.push(Ar(w,n,i,o,h,p)));return oy(g).na(function(){return e})}function ji(e,n,i,o,h,p,g){var b,w=new _n().O("sidx",function(k){b=function(I,x,C,D,_,j,F){var B=[];F.reader.skip(4);var H=F.reader.M();if(H==0)throw new fe(2,3,3005);if(F.version==0)var Y=F.reader.M(),te=F.reader.M();else Y=F.reader.oc(),te=F.reader.oc();F.reader.skip(2);var q=F.reader.wa();for(I=I+F.size+te,te=0;te<q;te++){var X=F.reader.M(),he=(2147483648&X)>>>31;X&=2147483647;var ae=F.reader.M();if(F.reader.skip(4),he==1)throw new fe(2,3,3006);B.push(new wt(Y/H+C,(Y+ae)/H+C,function(){return j},I,I+X-1,x,C,D,_)),Y+=ae,I+=X}return F.parser.stop(),B}(n,o,h,p,g,i,k)});if(e&&w.parse(e),b)return b;throw new fe(2,3,3004)}function jr(e){this.h=Nr(e),this.g=new xn(this.h,0)}function er(e){var n=go(e);if(7<n.length)throw new fe(2,3,3002);for(var i=0,o=(n=T(n)).next();!o.done;o=n.next())i=256*i+o.value;n=go(e);e:{for(var h=(o=T(gc)).next();!h.done;h=o.next())if(vs(n,new Uint8Array(h.value))){o=!0;break e}o=!1}if(o)n=e.h.byteLength-e.g.oa();else{if(n.length==8&&224&n[1])throw new fe(2,3,3001);for(h=o=0;h<n.length;h++){var p=n[h];o=h==0?p&(1<<8-n.length)-1:256*o+p}n=o}return n=e.g.oa()+n<=e.h.byteLength?n:e.h.byteLength-e.g.oa(),o=Nr(e.h,e.g.oa(),n),e.g.skip(n),new j1(i,o)}function go(e){var n=e.g.oa(),i=e.g.fa();if(i==0)throw new fe(2,3,3002);return i=8-Math.floor(Math.log2(i)),e.g.skip(i-1),Nt(e.h,n,i)}jr.prototype.ea=function(){return this.g.ea()};var gc=[[255],[127,255],[63,255,255],[31,255,255,255],[15,255,255,255,255],[7,255,255,255,255,255],[3,255,255,255,255,255,255],[1,255,255,255,255,255,255,255]];function j1(e,n){this.id=e,this.g=n}function Gg(e){if(8<e.g.byteLength)throw new fe(2,3,3002);if(e.g.byteLength==8&&224&e.g.getUint8(0))throw new fe(2,3,3001);for(var n=0,i=0;i<e.g.byteLength;i++)n=256*n+e.g.getUint8(i);return n}function TN(e){var n=new jr(e.g);if((e=er(n)).id!=179)throw new fe(2,3,3013);if(e=Gg(e),(n=er(n)).id!=183)throw new fe(2,3,3012);n=new jr(n.g);for(var i=0;n.ea();){var o=er(n);if(o.id==241){i=Gg(o);break}}return{ei:e,Mh:i}}function GL(e,n,i){if(!(n=Ht(e,n,"Initialization")))return null;var o=e.I.cb(),h=n.getAttribute("sourceURL");h&&(o=Rr(o,[h])),h=0;var p=null;return(n=Vt(n,"range",Ya))&&(h=n.start,p=n.end),(i=new is(function(){return o},h,p,zL(e),null,null,i)).codecs=e.I.codecs,i.mimeType=e.I.mimeType,i}function SN(e,n,i){var o=Number(kn(e,Hg,"presentationTimeOffset"))||0,h=kn(e,Hg,"timescale"),p=1;h&&(p=Xa(h)||1);var g=o/p||0,b=GL(e,Hg,i);(function(k,I){if(KL(k,I),!VL(k))throw new fe(2,4,4002)})(e,b);var w=Km(e);return{dc:function(){var k=Ht(w,Hg,"RepresentationIndex"),I=w.I.cb();return k&&(k=k.getAttribute("sourceURL"))&&(I=Rr(I,[k])),k=VL(w),HL(w,n,b,I,k.start,k.end,g)}}}function HL(e,n,i,o,h,p,g){var b,w,k,I,x,C,D,_,j,F,B,H,Y,te,q,X,he,ae;return W(function(me){if(me.g==1)return b=e.presentationTimeline,w=!e.xb||!e.aa.Me,k=e.aa.start,I=e.aa.duration,x=e.I.mimeType.split("/")[1],D=null,_=[(C=n)(o,h,p,!1),x=="webm"?C(i.Z(),i.Qa,i.ua,!0):null],C=null,N(me,Promise.all(_),2);if(j=me.h,F=j[0],B=j[1]||null,Y=k-g,te=k,q=I?k+I:1/0,x=="mp4")var oe=ji(F,h,o,i,Y,te,q);else{if(er(oe=new jr(B)).id!=440786851)throw new fe(2,3,3008);var ge=er(oe);if(ge.id!=408125543)throw new fe(2,3,3009);oe=ge.g.byteOffset,ge=new jr(ge.g);for(var le=null;ge.ea();){var Ee=er(ge);if(Ee.id==357149030){le=Ee;break}}if(!le)throw new fe(2,3,3010);for(le=new jr(le.g),Ee=1e6,ge=null;le.ea();){var ve=er(le);if(ve.id==2807729)Ee=Gg(ve);else if(ve.id==17545)if(ve.g.byteLength==4)ge=ve.g.getFloat32(0);else{if(ve.g.byteLength!=8)throw new fe(2,3,3003);ge=ve.g.getFloat64(0)}}if(ge==null)throw new fe(2,3,3011);if(ge*=le=Ee/1e9,(Ee=er(new jr(F))).id!=475249515)throw new fe(2,3,3007);oe=function(Be,_e,Ye,Ve,be,ke,Ae,He,De){function $e(){return be}var je=[];Be=new jr(Be.g);for(var Ge=null,Fe=null;Be.ea();){var rt=er(Be);if(rt.id==187){var Qe=TN(rt);Qe&&(rt=Ye*Qe.ei,Qe=_e+Qe.Mh,Ge!=null&&je.push(new wt(Ge+Ae,rt+Ae,$e,Fe,Qe-1,ke,Ae,He,De)),Ge=rt,Fe=Qe)}}return Ge!=null&&je.push(new wt(Ge+Ae,Ve+Ae,$e,Fe,null,ke,Ae,He,De)),je}(Ee,oe,le,ge,o,i,Y,te,q)}for(X=T(H=oe),he=X.next();!he.done;he=X.next())(ae=he.value).codecs=e.I.codecs,ae.mimeType=e.I.mimeType;return b.Zc(H),D=new Xt(H),w&&D.ac(te,q,!0),me.return(D)})}function Hg(e){return e.ed}function VL(e){var n=Ht(e,Hg,"RepresentationIndex");return e=Ya((e=kn(e,Hg,"indexRange"))||""),n&&(e=Vt(n,"range",Ya,e)),e}function KL(e,n){var i=e.I.mimeType.split("/")[1];if(e.I.contentType!=en&&i!="mp4"&&i!="webm")throw new fe(2,4,4006);if(i=="webm"&&!n)throw new fe(2,4,4005)}function zL(e){var n=e.I;return{bandwidth:e.bandwidth,audioSamplingRate:n.audioSamplingRate,codecs:n.codecs,contentType:n.contentType,frameRate:n.frameRate||null,height:n.height||null,mimeType:n.mimeType,channelsCount:n.Ud,pixelAspectRatio:n.pixelAspectRatio||null,width:n.width||null}}function wN(e,n,i){var o=GL(e,qL,i),h=function(w){var k=function(C){return[C.I.Cb,C.ma.Cb,C.ra.Cb].filter(Va).map(function(D){return jn(D,"SegmentURL")}).reduce(function(D,_){return 0<D.length?D:_}).map(function(D){return D.getAttribute("indexRange")&&!C.Wf&&(C.Wf=!0),{Eh:D.getAttribute("media"),start:(D=Vt(D,"mediaRange",Ya,{start:0,end:null})).start,end:D.end}})}(w),I=(w=ft(w,qL)).gd;I==0&&(I=1);var x=0;return w.xa?x=w.xa*(I-1):w.timeline&&0<w.timeline.length&&(x=w.timeline[0].start),{xa:w.xa,startTime:x,gd:I,sb:w.sb,timeline:w.timeline,kc:k}}(e);if(!h.xa&&!h.timeline&&1<h.kc.length)throw new fe(2,4,4002);if(!h.xa&&!e.aa.duration&&!h.timeline&&h.kc.length==1)throw new fe(2,4,4002);if(h.timeline&&h.timeline.length==0)throw new fe(2,4,4002);var p=null,g=null;e.ra.id&&e.I.id&&(g=n[e.ra.id+","+e.I.id])&&(p=g.segmentIndex);var b=function(w,k,I,x,C,D,_,j){var F=x.kc.length;x.timeline&&x.timeline.length!=x.kc.length&&(F=Math.min(x.timeline.length,x.kc.length));for(var B=w-x.sb,H=k?w+k:1/0,Y=[],te=x.startTime,q={},X=0;X<F;q={Gc:q.Gc,Cc:q.Cc},X++){q.Cc=x.kc[X];var he=te;te=void 0,te=x.xa!=null?he+x.xa:x.timeline?x.timeline[X].end:he+k,q.Gc=null,(he=new wt(w+he,w+te,function(ae){return function(){return ae.Gc==null&&(ae.Gc=Rr(I(),[ae.Cc.Eh])),ae.Gc}}(q),q.Cc.start,q.Cc.end,C,B,w,H,[],"",null,null,Nl,D)).codecs=j,he.mimeType=_,Y.push(he)}return Y}(e.aa.start,e.aa.duration,e.I.cb,h,o,i,e.I.mimeType,e.I.codecs);return n=!p,p?p.Yc(b,e.presentationTimeline.fb()):p=new Xt(b),e.presentationTimeline.Zc(b),e.xb&&e.aa.Me||p.ac(e.aa.start,e.aa.duration?e.aa.start+e.aa.duration:1/0,n),g&&(g.segmentIndex=p),{dc:function(){return p&&p.ob()!=0||p.Rd(b),Promise.resolve(p)}}}function qL(e){return e.Cb}function AN(e,n,i,o,h,p,g){var b=function(_,j){var F=kn(_,G1,"initialization");if(!F)return null;var B=_.I.id,H=_.bandwidth||null,Y=_.I.cb;return j=new is(function(){var te=jt(F,B,null,null,H,null);return Rr(Y(),[te])},0,null,zL(_),null,null,j),j.codecs=_.I.codecs,j.mimeType=_.I.mimeType,j}(e,g),w=function(_){var j=ft(_,G1),F=kn(_,G1,"media"),B=kn(_,G1,"index");return{xa:j.xa,timescale:j.timescale,gd:j.gd,sb:j.sb,yf:j.yf,timeline:j.timeline,lc:F,Wc:B,mimeType:_.I.mimeType,codecs:_.I.codecs}}(e);(function(_){var j=_.Wc?1:0;if(j+=_.timeline?1:0,(j+=_.xa?1:0)==0)throw new fe(2,4,4002);if(j!=1&&(_.Wc&&(_.timeline=null),_.xa=null),!_.Wc&&!_.lc)throw new fe(2,4,4002)})(w);var k=Km(e);if(w.Wc)return KL(e,b),{dc:function(){var _=jt(w.Wc,k.I.id,null,null,k.bandwidth||null,null);return _=Rr(k.I.cb(),[_]),HL(k,n,b,_,0,null,w.sb)}};if(w.xa)return o||e.ma.contentType==="image"||(e.presentationTimeline.Xe(w.xa),e.presentationTimeline.Td(e.aa.start)),{dc:function(){return function(_,j,F,B,H,Y){function te(je){var Ge=(je-le)*ge,Fe=Ge+j.sb,rt=Ge+ae;return Ge=rt+ge,(rt=new wt(rt,Math.min(Ge,X()),function(){var Qe=Fe*Ee;return"BigInt"in s&&Qe>Number.MAX_SAFE_INTEGER&&(Qe=BigInt(Fe)*BigInt(Ee)),Qe=jt(ve,_e,je,null,Be,Qe),Rr(Ye(),[Qe])},0,null,B,Ve,ae,X(),[],"",null,null,Nl,Y)).codecs=_.I.codecs,rt.mimeType=_.I.mimeType,rt.j=Ge,rt}function q(){var je=[Math.max(he.fb(),ae),Math.min(he.yb(),X())].map(function(Ge){return Ge-ae});return je=[Math.ceil(je[0]/ge),Math.ceil(je[1]/ge)-1],_.I.wb&&je[1]++,je.map(function(Ge){return Ge+le})}function X(){var je=me!=null&&H[me]||oe;return je?ae+je:1/0}var he=_.presentationTimeline,ae=_.aa.start,me=_.ra.id,oe=_.aa.duration,ge=j.xa,le=j.gd,Ee=j.timescale,ve=j.lc,Be=_.bandwidth||null,_e=_.I.id,Ye=_.I.cb,Ve=ae-j.sb,be=q();F=_.xb?Math.max(be[0],be[1]-F+1):be[0],be=be[1];for(var ke=[],Ae=F;Ae<=be;++Ae){var He=te(Ae);ke.push(He)}var De=new Xt(ke);if(ke=he.yb()<X(),Ae=he.R(),ke||Ae){var $e=Math.max(F,be+1);F=ge,_.I.wb&&(F=.1),De.Zd(F,function(){var je=he.fb();De.bb(je);var Ge=T(q());Ge.next(),Ge=Ge.next().value;for(var Fe=[];$e<=Ge;){var rt=te($e);Fe.push(rt),$e++}return je>X()&&!Fe.length?null:Fe})}return Promise.resolve(De)}(k,w,h,b,p,g)}};var I=null;o=o=null,e.ra.id&&e.I.id&&(o=i[o=e.ra.id+","+e.I.id])&&(I=o.segmentIndex);var x=e.aa.start,C=e.aa.duration?x+e.aa.duration:1/0,D=!(e.xb&&e.aa.Me);return I?(WL(i=I,w,x,C,D,b),i.bb(e.presentationTimeline.fb())):I=new H1(w,e.I.id,e.bandwidth,e.I.cb,x,C,b,D,g,e.I.jf),w.timeline&&e.ma.contentType!=="image"&&e.presentationTimeline.dg(w.timeline,x),o&&e.xb&&(o.segmentIndex=I),{dc:function(){return I instanceof H1&&I.ob()==0&&WL(I,w,x,C,D,b),Promise.resolve(I)}}}function G1(e){return e.fd}function H1(e,n,i,o,h,p,g,b,w,k){Xt.call(this,[]),this.h=e,this.F=n,this.A=i,this.C=o,this.i=h,this.l=p,this.s=g,this.u=w,this.G=k,b&&YL(this)}function WL(e,n,i,o,h,p){if(function(b,w){if(b.s!==w){b.s=w;for(var k=(b=T(b.g)).next();!k.done;k=b.next())(k=k.value)&&yy(k,w)}}(e,p),e.h){i=e.h.timeline,e.h.lc=n.lc;var g=i[i.length-1];0<(n=n.timeline.filter(function(b){return b.start>=g.end})).length&&e.h.timeline.push.apply(e.h.timeline,M(n)),e.l!==o&&(e.l=o)}else e.h=n,e.i=i,e.l=o;h&&YL(e)}function YL(e){if(!e.o){for(var n=e.h.timeline;n.length&&n[n.length-1].start>=e.l;)n.pop();e.bb(e.i)}}function QL(e,n,i,o,h,p,g){return e=jt(e,n,i,p,o||null,h),Rr(g(),[e]).map(function(b){return b.toString()})}function mv(e){this.o=null,this.u=e,this.G=new Do,this.j=[],this.h=null,this.m=[],this.A=null,this.F=[],this.C=300,this.l=new Map,this.i=new Map,this.g=null,this.s="UNKNOWN"}function yv(e,n){var i,o,h,p,g,b,w;return W(function(k){return k.g==1?(i=Rr(e.j,[kN(e,n)]),o=lr(i,e.o.retryParameters),h=e.u.networkingEngine.request(8,o),ai(e.G,h),ne(k,2),N(k,h.promise,4)):k.g!=2?(p=k.h,g=Wn(p.data),(b=JSON.parse(g)).VERSION==1&&function(I,x,C){I.g!=null&&(I.g.stop(),I.g=null);var D=x["RELOAD-URI"]||C;I.g=new Qt(function(){yv(I,D)}),(C=x.TTL)&&(I.C=C),I.g.U(I.C),I.m=x["PATHWAY-PRIORITY"]||[],I.F=x["PATHWAY-CLONES"]||[]}(e,b,p.uri),ce(k,0)):(w=we(k))&&w.code==7001?k.return():(e.g!=null&&(e.g.stop(),e.g=null),e.g=new Qt(function(){yv(e,n)}),e.g.U(e.C),void re(k))})}function kN(e,n){if(!e.m.length)return n;n=new mr(n);var i=e.A||e.m[0],o=Math.round(e.u.getBandwidthEstimate()),h=n.g;return e.s=="DASH"?(h.add("_DASH_pathway",i),h.add("_DASH_throughput",String(o))):e.s=="HLS"&&(h.add("_HLS_pathway",i),h.add("_HLS_throughput",String(o))),Bm(h)&&Ii(n,h),n.toString()}function Vg(e,n,i,o){var h=e.l.get(n);h||(h=new Map),h.set(i,o),e.l.set(n,h)}function vv(e,n,i){i=i!==void 0&&i,n=e.l.get(n)||new Map;for(var o=[],h={},p=T(e.m),g=p.next();!g.done;h={Ib:h.Ib},g=p.next())if(h.Ib=g.value,g=n.get(h.Ib))o.push({df:h.Ib,location:g});else if(g=e.F.find(function(w){return function(k){return k.wi==w.Ib}}(h))){var b=n.get(g["BASE-ID"]);b&&(g["URI-REPLACEMENT"].yg?(mu(b=new mr(b),g["URI-REPLACEMENT"].yg),o.push({df:h.Ib,location:b.toString()})):o.push({df:h.Ib,location:b}))}for(h=Date.now(),g=(p=T(e.i.keys())).next();!g.done;g=p.next())g=g.value,h>(b=e.i.get(g))&&e.i.delete(g);if(o=o.filter(function(w){for(var k=T(e.i.keys()),I=k.next();!I.done;I=k.next())if(I.value.includes(new mr(w.location).mb))return!1;return!0}),o.length&&(e.A=o[0].df),o=o.map(function(w){return w.location}),!o.length&&e.h)for(g=(h=T(e.h.split(","))).next();!g.done;g=h.next())(p=n.get(g.value))&&(e.A=e.h,o.push(p));if(!o.length)for(h=(n=T(n.values())).next();!h.done;h=n.next())o.push(h.value);return i?o:Rr(e.j,o)}function mo(){this.j=[],this.h=[],this.g=[],this.l=[],this.i=[],this.m=!1,this.o=new Set}function XL(e,n){for(var i=[],o=[],h=[],p=[],g=(e=T(e)).next();!g.done;g=e.next()){var b=g.value;g=new Map(b.audioStreams.map(function(x){return[iS(x),x]}));var w=new Map(b.videoStreams.map(function(x){return[rS(x),x]})),k=new Map(b.textStreams.map(function(x){return[Sv(x),x]}));if(b=new Map(b.imageStreams.map(function(x){return[wv(x),x]})),n){var I=rR(en);k.set(Sv(I),I),I=rR("image"),b.set(wv(I),I)}i.push(g),o.push(w),h.push(k),p.push(b)}return{Df:i,wg:o,tg:h,Vf:p}}function JL(e){var n,i,o,h,p,g,b,w,k,I,x,C,D,_,j,F,B,H,Y,te,q,X,he,ae,me,oe,ge,le,Ee;return W(function(ve){switch(ve.g){case 1:if(n=_r,e.length==1)return ve.return(e[0]);for(i=e.map(function(Be){return new Map(Be.filter(function(_e){return _e.type===n.P}).map(function(_e){return[iS(_e),_e]}))}),o=e.map(function(Be){return new Map(Be.filter(function(_e){return _e.type===n.$}).map(function(_e){return[rS(_e),_e]}))}),h=e.map(function(Be){return new Map(Be.filter(function(_e){return _e.type===n.ia}).map(function(_e){return[Sv(_e),_e]}))}),p=e.map(function(Be){return new Map(Be.filter(function(_e){return _e.type===n.ie}).map(function(_e){return[wv(_e),_e]}))}),g=T(h),b=g.next();!b.done;b=g.next())w=b.value,k=nR(n.ia),w.set(Sv(k),k);for(I=T(p),x=I.next();!x.done;x=I.next())C=x.value,D=nR(n.ie),C.set(wv(D),D);return N(ve,Od(_=new mo,[],i,0,V1,K1),2);case 2:return j=ve.h,N(ve,Od(_,[],o,0,V1,K1),3);case 3:return F=ve.h,N(ve,Od(_,[],h,0,V1,K1),4);case 4:return B=ve.h,N(ve,Od(_,[],p,0,V1,K1),5);case 5:if(H=ve.h,Y=0,F.length&&j.length)for(he=T(j),ae=he.next();!ae.done;ae=he.next())for(me=ae.value,oe=T(F),ge=oe.next();!ge.done;ge=oe.next())le=ge.value,Ee=Y++,le.variantIds.push(Ee),me.variantIds.push(Ee);else for(te=F.concat(j),q=T(te),X=q.next();!X.done;X=q.next())X.value.variantIds=[Y++];return ve.return(F.concat(j).concat(B).concat(H))}})}function Od(e,n,i,o,h,p){var g,b,w,k,I,x,C,D,_,j,F,B,H,Y,te,q,X;return W(function(he){switch(he.g){case 1:for(g=[],b=0;b<o;b++)g.push(new Set);for(w=o;w<i.length;w++)g.push(new Set(i[w].values()));k=T(n),I=k.next();case 2:if(I.done){he.B(4);break}return x=I.value,N(he,function(ae,me,oe,ge,le,Ee){return W(function(ve){return ve.g==1?(tR(ae,oe,me),me.matchedStreams?me.segmentIndex?N(ve,ZL(me,ge),2):ve.B(2):ve.return(!1)):(eR(me,ge,le,Ee),ve.return(!0))})}(e,x,i,o,p,g),5);case 5:if(!he.h)throw new fe(2,4,4037);I=k.next(),he.B(2);break;case 4:for(C=T(g),D=C.next();!D.done;D=C.next())for(_=D.value,j=T(_),F=j.next();!F.done;F=j.next())B=F.value,(H=xN(e,B,i,h,p,g))&&n.push(H);for(Y=T(g),D=Y.next();!D.done;D=Y.next())for(te=D.value,q={},X=T(te),F=X.next();!F.done;q={od:q.od},F=X.next())if(q.od=F.value,!sR(q.od)&&n.some(function(ae){return function(me){return nS(e,ae.od,me)}}(q)))throw new fe(2,4,4037);return he.return(n)}})}function ZL(e,n){var i,o,h,p,g,b,w;return W(function(k){if(k.g==1){for(i=[],o=e.matchedStreams,h=T(o),p=h.next();!p.done;p=h.next())g=p.value,i.push(g.createSegmentIndex()),g.trickModeVideo&&!g.trickModeVideo.segmentIndex&&i.push(g.trickModeVideo.createSegmentIndex());return N(k,Promise.all(i),2)}if(e.segmentIndex instanceof Jn)for(b=n;b<o.length;b++)(w=o[b]).segmentIndex&&e.segmentIndex.h.push(w.segmentIndex);re(k)})}function xN(e,n,i,o,h,p){if(sR(n))return null;var g=o(n);return tR(e,i,g),g.createSegmentIndex&&(g.createSegmentIndex=function(){return W(function(b){return g.segmentIndex?b.B(0):(g.segmentIndex=new Jn,N(b,ZL(g,0),0))})}),g.matchedStreams&&g.matchedStreams.length?(eR(g,0,h,p),g):null}function eR(e,n,i,o){for(var h=e.matchedStreams;n<h.length;n++){var p=h[n];i(e,p);var g=!0;if(e.type=="audio"&&Il(e.language,p.language)==0&&(g=!1),g&&(o[n].delete(p),p.fullMimeTypes))for(g=(p=T(p.fullMimeTypes.values())).next();!g.done;g=p.next())e.fullMimeTypes.add(g.value)}}function bv(e){var n=Object.assign({},e);return n.originalId=null,n.createSegmentIndex=function(){return Promise.resolve()},n.closeSegmentIndex=function(){if(n.segmentIndex&&(n.segmentIndex.release(),n.segmentIndex=null),n.matchedStreams)for(var i=T(n.matchedStreams),o=i.next();!o.done;o=i.next())(o=o.value).segmentIndex&&(o.segmentIndex.release(),o.segmentIndex=null)},n.roles=n.roles.slice(),n.segmentIndex=null,n.emsgSchemeIdUris=[],n.keyIds=new Set,n.closedCaptions=null,n.trickModeVideo=null,n}function V1(e){return(e=Object.assign({},e)).roles=e.roles.slice(),e.keyIds=new Set,e.segments=[],e.variantIds=[],e.closedCaptions=null,e}function Kg(e,n){function i(g,b){g||(g=[]);for(var w=(b=T(b)).next();!w.done;w=b.next())w=w.value,g.includes(w)||g.push(w);return g}e.roles=i(e.roles,n.roles),n.emsgSchemeIdUris&&(e.emsgSchemeIdUris=i(e.emsgSchemeIdUris,n.emsgSchemeIdUris));for(var o=T(n.keyIds),h=o.next();!h.done;h=o.next())e.keyIds.add(h.value);if(e.originalId==null?e.originalId=n.originalId:e.originalId+=","+(n.originalId||""),o=Dh(e.drmInfos,n.drmInfos),n.drmInfos.length&&e.drmInfos.length&&!o.length)throw new fe(2,4,4038);if(e.drmInfos=o,e.encrypted=e.encrypted||n.encrypted,n.closedCaptions)for(e.closedCaptions||(e.closedCaptions=new Map),h=(o=T(n.closedCaptions)).next();!h.done;h=o.next()){var p=T(h.value);h=p.next().value,p=p.next().value,e.closedCaptions.set(h,p)}n.trickModeVideo?(e.trickModeVideo||(e.trickModeVideo=bv(n.trickModeVideo),e.trickModeVideo.createSegmentIndex=function(){return e.trickModeVideo.segmentIndex=e.segmentIndex.clone(),Promise.resolve()}),Kg(e.trickModeVideo,n.trickModeVideo)):e.trickModeVideo&&Kg(e.trickModeVideo,n)}function K1(e,n){var i=e.roles;i||(i=[]);for(var o=T(n.roles),h=o.next();!h.done;h=o.next())h=h.value,i.includes(h)||i.push(h);for(e.roles=i,o=(i=T(n.keyIds)).next();!o.done;o=i.next())e.keyIds.add(o.value);if(e.encrypted=e.encrypted&&n.encrypted,e.segments.push.apply(e.segments,M(n.segments)),n.closedCaptions)for(e.closedCaptions||(e.closedCaptions=new Map),i=(n=T(n.closedCaptions)).next();!i.done;i=n.next())i=(o=T(i.value)).next().value,o=o.next().value,e.closedCaptions.set(i,o)}function tR(e,n,i){for(var o=[],h=(n=T(n)).next();!h.done;h=n.next()){if(!(h=IN(e,h.value,i)))return;o.push(h)}i.matchedStreams=o}function IN(e,n,i){var o=null,h=(0,{audio:iS,video:rS,text:Sv,image:wv}[i.type])(i);if(n.has(h))o=n.get(h);else{h={audio:function(b,w){return nS(e,b,w)},video:function(b,w){return nS(e,b,w)},text:LN,image:RN}[i.type];for(var p={audio:CN,video:DN,text:PN,image:MN}[i.type],g=(n=T(n.values())).next();!g.done;g=n.next())!h(i,g=g.value)||i.fastSwitching!=g.fastSwitching||o&&!p(i,o,g)||(o=g)}return o}function Ev(e,n){function i(o){if(!sS.has(o)){var h=Ji(o);sS.set(o,h)}return sS.get(o)}return e.mimeType==n.mimeType&&i(e.codecs)==i(n.codecs)}function nS(e,n,i){return!(!Ev(n,i)&&!e.m||n.drmInfos&&!Dp(n.drmInfos,i.drmInfos))}function LN(e,n){return!n.language||e.forced===n.forced&&Il(e.language,n.language)!=0&&n.kind==e.kind}function RN(){return!0}function CN(e,n,i){var o=Ev(e,n),h=Ev(e,i);if(o&&!h)return!1;if(!o&&h||(o=Il(e.language,n.language),(h=Il(e.language,i.language))>o))return!0;if(h<o)return!1;if(n.label!==i.label){if(e.label===n.label)return!1;if(e.label===i.label)return!0}return e.roles.length?(o=n.roles.filter(function(p){return e.roles.includes(p)}),(h=i.roles.filter(function(p){return e.roles.includes(p)})).length>o.length||!(h.length<o.length)&&i.roles.length<n.roles.length):!((i.roles.length||!n.roles.length)&&(i.roles.length&&!n.roles.length||(n.primary||!i.primary)&&(n.primary&&!i.primary||(o=Tv(e.channelsCount,n.channelsCount,i.channelsCount))!=Jo&&(o==mc||(o=Tv(e.audioSamplingRate,n.audioSamplingRate,i.audioSamplingRate))!=Jo&&(o==mc||!e.bandwidth||iR(e.bandwidth,n.bandwidth,i.bandwidth)!=Jo)))))}function DN(e,n,i){var o=Ev(e,n),h=Ev(e,i);if(o&&!h)return!1;if(!o&&h||(o=Tv(e.width*e.height,n.width*n.height,i.width*i.height))==Jo)return!0;if(o==mc)return!1;if(e.frameRate){if((o=Tv(e.frameRate,n.frameRate,i.frameRate))==Jo)return!0;if(o==mc)return!1}return!(!e.bandwidth||iR(e.bandwidth,n.bandwidth,i.bandwidth)!=Jo)}function PN(e,n,i){var o=Il(e.language,n.language),h=Il(e.language,i.language);if(h>o)return!0;if(h<o)return!1;if(!n.primary&&i.primary)return!0;if(n.primary&&!i.primary)return!1;if(n.label!==i.label){if(e.label===n.label)return!1;if(e.label===i.label)return!0}if(e.roles.length){if(o=n.roles.filter(function(p){return e.roles.includes(p)}),(h=i.roles.filter(function(p){return e.roles.includes(p)})).length>o.length)return!0;if(h.length<o.length)return!1}else{if(!i.roles.length&&n.roles.length)return!0;if(i.roles.length&&!n.roles.length)return!1}return i.mimeType==e.mimeType&&i.codecs==e.codecs&&(n.mimeType!=e.mimeType||n.codecs!=e.codecs)}function MN(e,n,i){return Tv(e.width*e.height,n.width*n.height,i.width*i.height)==Jo}function nR(e){return{id:0,originalId:"",groupId:null,primary:!1,type:e,mimeType:"",codecs:"",language:"",originalLanguage:null,label:null,width:null,height:null,encrypted:!1,keyIds:new Set,segments:[],variantIds:[],roles:[],forced:!1,channelsCount:null,audioSamplingRate:null,spatialAudio:!1,closedCaptions:null,external:!1,fastSwitching:!1}}function rR(e){return{id:0,originalId:"",groupId:null,createSegmentIndex:function(){return Promise.resolve()},segmentIndex:new Xt([]),mimeType:"",codecs:"",encrypted:!1,drmInfos:[],keyIds:new Set,language:"",originalLanguage:null,label:null,type:e,primary:!1,trickModeVideo:null,emsgSchemeIdUris:null,roles:[],forced:!1,channelsCount:null,audioSamplingRate:null,spatialAudio:!1,closedCaptions:null,accessibilityPurpose:null,external:!1,fastSwitching:!1,fullMimeTypes:new Set}}function Tv(e,n,i){if(n==e&&e!=i)return mc;if(i==e&&e!=n)return Jo;if(n>e){if(i<=e||i-e<n-e)return Jo;if(i-e>n-e)return mc}else{if(i>e)return mc;if(e-i<e-n)return Jo;if(e-i>e-n)return mc}return aR}function iR(e,n,i){return n=Math.abs(e-n),(e=Math.abs(e-i))<n?Jo:n<e?mc:aR}function sR(e){switch(e.type){case en:return!e.language;case"image":return!e.tilesLayout;default:return!1}}function rS(e){return JSON.stringify([e.fastSwitching,e.width,e.frameRate,e.codecs,e.mimeType,e.label,e.roles,e.closedCaptions?Array.from(e.closedCaptions.entries()):null,e.bandwidth])}function iS(e){return JSON.stringify([e.fastSwitching,e.channelsCount,e.language,e.bandwidth,e.label,e.codecs,e.mimeType,e.roles,e.audioSamplingRate,e.primary])}function Sv(e){return JSON.stringify([e.language,e.label,e.codecs,e.mimeType,e.bandwidth,e.roles])}function wv(e){return JSON.stringify([e.width,e.codecs,e.mimeType])}Z(H1,Xt),(c=H1.prototype).ob=function(){return this.h?this.h.timeline.length:0},c.release=function(){Xt.prototype.release.call(this),this.h=null},c.bb=function(e){if(this.h){for(var n=0,i=this.h.timeline,o=0;o<i.length&&i[o].end+this.i<=e;o+=1)n+=1;0<n&&(this.h.timeline=i.slice(n),this.g.length>=n&&(this.g=this.g.slice(n)),this.j+=n,this.ob()===0&&this.release())}},c.find=function(e){if(this.h&&this.h.timeline&&this.h.timeline.length&&e<this.h.timeline[0].start+this.i)return this.j;if(!this.h)return null;var n=this.h.timeline;if(e<this.i||e>=this.l)return null;for(var i=n.length-1,o=0;o<n.length;o++){var h=n[o],p=h.start+this.i;if(h=o<i?n[o+1].start+this.i:this.l===1/0?h.end+this.i:this.l,e>=p&&e<h)return o+this.j}return null},c.get=function(e){var n=this;if(0>(e-=this.j)||e>=this.ob()||!this.h)return null;var i=this.g[e];if(!i){var o=this.h.lc,h=this.h.timeline[e],p=h.Wh,g=this.h.yf+h.zf;i=this.i-this.h.sb;var b=this.i+h.end,w=b;e===this.ob()-1&&this.l!==1/0&&(w=this.l);for(var k=this.h.codecs,I=this.h.mimeType,x=[],C=(h.end-h.start)/h.gb,D={},_=0;_<h.gb;D={Hc:D.Hc,ge:D.ge},_++){var j=h.start+C*_,F=j+C;D.ge=_+1,D.Hc=null,(j=new wt(this.i+j,this.i+F,function(B){return function(){return n.h?(B.Hc==null&&(B.Hc=QL(n.h.lc,n.F,p,n.A,g,B.ge,n.C)),B.Hc):[]}}(D),0,null,this.s,i,this.i,this.l,[],"",null,null,Nl,this.u)).codecs=k,j.mimeType=I,this.G==0?0<_&&j.Pd():_%this.G!=0&&j.Pd(),x.push(j)}(i=new wt(this.i+h.start,w,function(){return 0<h.gb?[]:QL(o,n.F,p,n.A,g,null,n.C)},0,null,this.s,i,this.i,this.l,x,"",null,null,Nl,this.u,0<h.gb)).codecs=k,i.mimeType=I,i.j=b,this.g[e]=i}return i},mv.prototype.configure=function(e){this.o=e},mv.prototype.destroy=function(){return this.u=this.o=null,this.j=[],this.h=null,this.m=[],this.F=[],this.l.clear(),this.g!=null&&(this.g.stop(),this.g=null),this.G.destroy()},mv.prototype.setManifestType=function(e){this.s=e},(c=mo.prototype).release=function(){for(var e=T(this.h.concat(this.g,this.l,this.i)),n=e.next();!n.done;n=e.next())(n=n.value).segmentIndex&&n.segmentIndex.release();this.h=[],this.g=[],this.l=[],this.i=[],this.j=[]},c.nh=function(){return this.j},c.Je=function(){return this.l.slice()},c.Vg=function(){return this.i},c.Gf=function(e,n){var i,o,h,p,g,b,w,k,I,x,C,D,_,j,F,B,H,Y,te,q,X,he,ae,me,oe,ge,le,Ee,ve,Be=this;return W(function(_e){if(_e.g==1){if(i=_r,!n&&e.length==1)return o=XL(e,!1),h=o.Df,p=o.wg,g=o.tg,b=o.Vf,Be.h=Array.from(h[0].values()),Be.g=Array.from(p[0].values()),Be.l=Array.from(g[0].values()),Be.i=Array.from(b[0].values()),_e.B(2);for(w=-1,k=0;k<e.length;k++)I=e[k],Be.o.has(I.id)||(Be.o.add(I.id),w==-1&&(w=k));return w==-1?_e.return():(x=XL(e,!0),C=x.Df,D=x.wg,_=x.tg,j=x.Vf,N(_e,Promise.all([Od(Be,Be.h,C,w,bv,Kg),Od(Be,Be.g,D,w,bv,Kg),Od(Be,Be.l,_,w,bv,Kg),Od(Be,Be.i,j,w,bv,Kg)]),2))}if(F=0,B=[],Be.g.length&&Be.h.length)for(he=T(Be.h),ae=he.next();!ae.done;ae=he.next())for(me=ae.value,oe=T(Be.g),ge=oe.next();!ge.done;ge=oe.next())le=ge.value,Ee=Dh(me.drmInfos,le.drmInfos),me.drmInfos.length&&le.drmInfos.length&&!Ee.length||(ve=F++,B.push({id:ve,language:me.language,disabledUntilTime:0,primary:me.primary,audio:me,video:le,bandwidth:(me.bandwidth||0)+(le.bandwidth||0),drmInfos:Ee,allowedByApplication:!0,allowedByKeySystem:!0,decodingInfos:[]}));else for(H=Be.g.length?Be.g:Be.h,Y=T(H),te=Y.next();!te.done;te=Y.next())q=te.value,X=F++,B.push({id:X,language:q.language,disabledUntilTime:0,primary:q.primary,audio:q.type==i.P?q:null,video:q.type==i.$?q:null,bandwidth:q.bandwidth||0,drmInfos:q.drmInfos,allowedByApplication:!0,allowedByKeySystem:!0,decodingInfos:[]});Be.j=B,re(_e)})},We("shaka.util.PeriodCombiner",mo),mo.prototype.combinePeriods=mo.prototype.Gf,mo.prototype.getImageStreams=mo.prototype.Vg,mo.prototype.getTextStreams=mo.prototype.Je,mo.prototype.getVariants=mo.prototype.nh;var Jo=1,aR=0,mc=-1,sS=new Map;function z1(){var e=this;this.i=this.g=null,this.o=[],this.j=null,this.J=1,this.m={},this.L={},this.l=new mo,this.F=0,this.H=new bt(5),this.G=new Qt(function(){(function(n){var i,o;W(function(h){switch(h.g){case 1:return i=0,ne(h,2),N(h,aS(n),4);case 4:i=h.h,ce(h,3);break;case 2:if(o=we(h),n.i){if(n.g.raiseFatalErrorOnManifestUpdateRequestFailure)return n.i.onError(o),h.return();o.severity=1,n.i.onError(o)}case 3:if(!n.i)return h.return();n.i.onManifestUpdated(),oS(n,i),re(h)}})})(e)}),this.C=new Do,this.u=null,this.K=[],this.A=1/0,this.s=!1,this.h=null}function aS(e){var n,i,o,h,p,g,b;return W(function(w){return w.g==1?(n=e.o,1<e.o.length&&e.h&&(i=vv(e.h,"Location",!0)).length&&(n=i),o=lr(n,e.g.retryParameters),h=Date.now(),N(w,uS(e,o,0,{type:4}),2)):w.g!=3?(p=w.h,e.i?(p.uri&&p.uri!=p.originalUri&&!e.o.includes(p.uri)&&e.o.unshift(p.uri),N(w,function(k,I,x){var C,D,_,j;return W(function(F){if(F.g==1){if(!(C=Za(I,"MPD")))throw new fe(2,4,4001,x);return k.g.dash.disableXlinkProcessing?F.return(oR(k,C,x)):(D=k.g.dash.xlinkFailGracefully,_=Ar(C,k.g.retryParameters,D,x,k.i.networkingEngine),ai(k.C,_),N(F,_.promise,2))}return j=F.h,F.return(oR(k,j,x))})}(e,p.data,p.uri),3)):w.return(0)):(g=Date.now(),b=(g-h)/1e3,e.H.sample(1,b),w.return(b))})}function oR(e,n,i){var o,h,p,g,b,w,k,I,x,C,D,_,j,F,B,H,Y,te,q,X,he,ae,me,oe,ge,le,Ee,ve,Be,_e,Ye,Ve,be,ke,Ae,He,De,$e,je,Ge,Fe,rt,Qe,Et,et,it,Pt,Yt,Zt,an,_t,Bt,tn,yt;return W(function(at){switch(at.g){case 1:for((o=e.g.dash.manifestPreprocessor)&&o(n),e.h&&e.h.l.clear(),h=[i],p=[],g=new Map,b=jn(n,"Location"),w=T(b),k=w.next();!k.done;k=w.next())I=k.value,x=I.getAttribute("serviceLocation"),(C=Tr(I))&&(D=Rr(h,[C])[0],x&&(e.h?Vg(e.h,"Location",x,D):g.set(x,D)),p.push(D));if(e.h?0<(_=vv(e.h,"Location",!0)).length&&(h=e.o=_):p.length&&(h=e.o=p),j=Promise.resolve(),(F=zr(n,"ContentSteering"))&&e.i)for(B=F.getAttribute("defaultServiceLocation"),e.h?(e.h.j=h,e.h.h=B):(e.h=new mv(e.i),e.h.configure(e.g),e.h.setManifestType("DASH"),e.h.j=h,e.h.h=B,(H=Tr(F))&&(Vt(F,"queryBeforeStart",Rh,!1)?j=yv(e.h,H):yv(e.h,H))),Y=T(g.keys()),te=Y.next();!te.done;te=Y.next())q=te.value,X=g.get(q),Vg(e.h,"Location",q,X);if(he=jn(n,"BaseURL"),me=!1,e.h)for(oe=T(he),ge=oe.next();!ge.done;ge=oe.next())le=ge.value,Ee=le.getAttribute("serviceLocation"),ve=Tr(le),Ee&&ve&&(Vg(e.h,"BaseURL",Ee,ve),me=!0);if(me&&e.h||(Be=he.map(Tr),ae=Rr(h,Be)),_e=function(){return e.h&&me?vv(e.h,"BaseURL"):ae||[]},Ye=0,he&&he.length&&(Ye=Vt(he[0],"availabilityTimeOffset",Ja)||0),Ve=e.g.dash.ignoreMinBufferTime,be=0,Ve||(be=Vt(n,"minBufferTime",Ea)||0),e.F=Vt(n,"minimumUpdatePeriod",Ea,-1),ke=Vt(n,"availabilityStartTime",ad),Ae=Vt(n,"timeShiftBufferDepth",Ea),He=e.g.dash.ignoreSuggestedPresentationDelay,De=null,He||(De=Vt(n,"suggestedPresentationDelay",Ea)),$e=e.g.dash.ignoreMaxSegmentDuration,je=null,$e||(je=Vt(n,"maxSegmentDuration",Ea)),Ge=n.getAttribute("type")||"static",e.j)for(Fe=e.j.presentationTimeline,rt=T(Object.values(e.m)),Qe=rt.next();!Qe.done;Qe=rt.next())(Et=Qe.value).segmentIndex&&Et.segmentIndex.bb(Fe.fb());else et=e.g.defaultPresentationDelay||1.5*be,Fe=new Tt(ke,De??et,e.g.dash.autoCorrectDrift);return Fe.pc(Ge=="static"),Fe.R()&&!isNaN(e.g.availabilityWindowOverride)&&(Ae=e.g.availabilityWindowOverride),Ae==null&&(Ae=1/0),Fe.Yd(Ae),it=n.getAttribute("profiles")||"",Pt={xb:Ge!="static",presentationTimeline:Fe,ra:null,aa:null,ma:null,I:null,bandwidth:0,Wf:!1,wb:Ye,profiles:it.split(",")},Yt=function(st,Ct,$t,Lt){var Ft=Vt(Lt,"mediaPresentationDuration",Ea),pi=[],Gn=0;Lt=jn(Lt,"Period");for(var ti=0;ti<Lt.length;ti++){var Ms=Lt[ti],Os=Lt[ti+1],ni=Vt(Ms,"start",Ea,Gn),kr=Ms.id,Tf=Vt(Ms,"duration",Ea),Da=null;if(Os){var Uv=Vt(Os,"start",Ea);Uv!=null&&(Da=Uv-ni)}else Ft!=null&&(Da=Ft-ni);if(Da==null&&(Da=Tf),!(st.u!==null&&kr!==null&&ni!==null&&ni<st.u)||st.K.includes(kr)||ti+1==Lt.length){if(ni!==null&&(st.u===null||ni>st.u)&&(st.u=ni),Gn=NN(st,Ct,$t,{start:ni,duration:Da,node:Ms,Me:Da==null||!Os}),pi.push(Gn),Ct.ra.id&&Da&&(st.L[Ct.ra.id]=Da),Da==null){Gn=null;break}Gn=ni+Da}}return st.K=pi.map(function(Ib){return Ib.id}),Ft!=null?{periods:pi,duration:Ft,Lf:!1}:{periods:pi,duration:Gn,Lf:!0}}(e,Pt,_e,n),Zt=Yt.duration,an=Yt.periods,Ge!="static"&&Yt.Lf||Fe.Pa(Zt||1/0),e.A&&!e.s&&e.i.isAutoLowLatencyMode()&&(e.i.enableLowLatencyMode(),e.s=e.i.isLowLatencyMode()),e.s?Fe.lg(e.A):e.A&&Rt("Low-latency DASH live stream detected, but low-latency streaming mode is not enabled in Shaka Player. Set streaming.lowLatencyMode configuration to true, and see https://bit.ly/3clctcj for details."),Fe.Xe(je||1),N(at,e.l.Gf(an,Pt.xb),2);case 2:return N(at,j,3);case 3:if(e.s&&(be=0,_t=De??e.g.defaultPresentationDelay,Fe.nf(_t)),e.j){e.j.variants=e.l.j,0<(Bt=e.l.Je()).length&&(e.j.textStreams=Bt),e.j.imageStreams=e.l.i,e.i.filter(e.j),at.B(4);break}if(e.j={presentationTimeline:Fe,variants:e.l.j,textStreams:e.l.Je(),imageStreams:e.l.i,offlineSessionIds:[],minBufferTime:be||0,sequenceMode:e.g.dash.sequenceMode,ignoreManifestTimestampsInSegmentsMode:!1,type:"DASH",serviceDescription:ON(n)},!Fe.vg()){at.B(5);break}return tn=jn(n,"UTCTiming"),N(at,function(st,Ct,$t){var Lt,Ft,pi,Gn,ti,Ms,Os,ni;return W(function(kr){switch(kr.g){case 1:Lt=$t.map(function(Tf){return{scheme:Tf.getAttribute("schemeIdUri"),value:Tf.getAttribute("value")}}),Ft=st.g.dash.clockSyncUri,!Lt.length&&Ft&&Lt.push({scheme:"urn:mpeg:dash:utc:http-head:2014",value:Ft}),pi=T(Lt),Gn=pi.next();case 2:if(Gn.done){kr.B(4);break}switch(ti=Gn.value,ne(kr,5),Ms=ti.scheme,Os=ti.value,Ms){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":return kr.B(7);case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":return kr.B(8);case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":return ni=Date.parse(Os),kr.return(isNaN(ni)?0:ni-Date.now());case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":Rt("NTP UTCTiming scheme is not supported");break;default:Rt("Unrecognized scheme in UTCTiming element",Ms)}kr.B(9);break;case 7:return N(kr,lR(st,Ct,Os,"HEAD"),10);case 10:return kr.return(kr.h);case 8:return N(kr,lR(st,Ct,Os,"GET"),11);case 11:return kr.return(kr.h);case 9:ce(kr,3);break;case 5:we(kr);case 3:Gn=pi.next(),kr.B(2);break;case 4:return Rt("A UTCTiming element should always be given in live manifests! This content may not play on clients with bad clocks!"),kr.return(0)}})}(e,_e,tn),6);case 6:if(yt=at.h,!e.i)return at.return();Fe.mg(yt);case 5:Fe.Od();case 4:e.i.makeTextStreamsForClosedCaptions(e.j),re(at)}})}function ON(e){if(!(e=zr(e,"ServiceDescription")))return null;var n=zr(e,"Latency"),i=zr(e,"PlaybackRate");return n&&n.getAttribute("max")||i?{maxLatency:e=n&&n.getAttribute("max")?parseInt(n.getAttribute("max"),10)/1e3:null,maxPlaybackRate:i?parseFloat(i.getAttribute("max")):null,minLatency:n=n&&n.getAttribute("min")?parseInt(n.getAttribute("min"),10)/1e3:null,minPlaybackRate:i=i?parseFloat(i.getAttribute("min")):null}:null}function NN(e,n,i,o){n.ra=lS(e,o.node,null,i),n.aa=o,n.ra.wb=n.wb,n.ra.id||(n.ra.id="__shaka_period_"+o.start);var h=jn(o.node,"EventStream");i=n.presentationTimeline.fb();for(var p=(h=T(h)).next();!p.done;p=h.next())_N(e,o.start,o.duration,p.value,i);if(i=jn(o.node,"AdaptationSet").map(function(I){return function(x,C,D){function _(be){switch(be){case 1:case 6:case 13:case 14:case 15:return"SDR";case 16:return"PQ";case 18:return"HLG"}}C.ma=lS(x,D,C.ra,null);var j,F=!1,B=jn(D,"Role"),H=B.map(function(be){return be.getAttribute("value")}).filter(Va),Y=void 0,te=C.ma.contentType==en;te&&(Y="subtitle");for(var q=(B=T(B)).next();!q.done;q=B.next()){var X=(q=q.value).getAttribute("schemeIdUri");if(X==null||X=="urn:mpeg:dash:role:2011")switch(q=q.getAttribute("value"),q){case"main":F=!0;break;case"caption":case"subtitle":Y=q}}X=jn(D,"EssentialProperty"),B=null;var he=!1;q=!1;for(var ae=(X=T(X)).next();!ae.done;ae=X.next()){var me=(ae=ae.value).getAttribute("schemeIdUri");me=="http://dashif.org/guidelines/trickmode"?B=ae.getAttribute("value"):me=="urn:mpeg:mpegB:cicp:TransferCharacteristics"?j=_(parseInt(ae.getAttribute("value"),10)):me!="urn:mpeg:mpegB:cicp:ColourPrimaries"&&me!="urn:mpeg:mpegB:cicp:MatrixCoefficients"&&(me=="urn:mpeg:dash:ssr:2023"?he=!0:q=!0)}for(X=T(X=jn(D,"SupplementalProperty")),ae=X.next();!ae.done;ae=X.next())(ae=ae.value).getAttribute("schemeIdUri")=="urn:mpeg:mpegB:cicp:TransferCharacteristics"&&(j=_(parseInt(ae.getAttribute("value"),10)));X=jn(D,"Accessibility");var oe,ge=new Map;for(X=T(X),ae=X.next();!ae.done;ae=X.next())if(me=ae.value,ae=me.getAttribute("schemeIdUri"),me=me.getAttribute("value"),ae=="urn:scte:dash:cc:cea-608:2015")if(ae=1,me!=null)for(var le=T(me=me.split(";")),Ee=le.next();!Ee.done;Ee=le.next()){var ve=Ee.value,Be=Ee=void 0;ve.includes("=")?(Ee=(ve=ve.split("="))[0].startsWith("CC")?ve[0]:"CC"+ve[0],Be=ve[1]||"und"):(Ee="CC"+ae,me.length==2?ae+=2:ae++,Be=ve),ge.set(Ee,dn(Be))}else ge.set("CC1","und");else if(ae=="urn:scte:dash:cc:cea-708:2015")if(ae=1,me!=null)for(me=T(me.split(";")),Ee=me.next();!Ee.done;Ee=me.next())Ee=Ee.value,ve=le=void 0,Ee.includes("=")?(Ee=Ee.split("="),le="svc"+Ee[0],ve=Ee[1].split(",")[0].split(":").pop()):(le="svc"+ae,ae++,ve=Ee),ge.set(le,dn(ve));else ge.set("svc1","und");else ae=="urn:mpeg:dash:role:2011"?me!=null&&(H.push(me),me=="captions"&&(Y="caption")):ae=="urn:tva:metadata:cs:AudioPurposeCS:2007"&&(me=="1"?oe="visually impaired":me=="2"&&(oe="hard of hearing"));if(q)return null;var _e=St(q=jn(D,"ContentProtection"),x.g.dash.ignoreDrmInfo,x.g.dash.keySystemsByURI),Ye=dn(C.ma.language||"und"),Ve=D.getAttribute("label");if((q=jn(D,"Label"))&&q.length&&(q=q[0]).textContent&&(Ve=q.textContent),q=jn(D,"Representation"),D=q.map(function(be){return(be=function(ke,Ae,He,De,$e,je,Ge,Fe,rt,Qe,Et){if(Ae.I=lS(ke,Qe,Ae.ma,null),ke.A=Math.min(ke.A,Ae.I.wb),!function(Lt){var Ft=Lt.ed?1:0;return Ft+=Lt.Cb?1:0,(Ft+=Lt.fd?1:0)==0?Lt.contentType==en||Lt.contentType=="application":(Ft!=1&&(Lt.ed&&(Lt.Cb=null),Lt.fd=null),!0)}(Ae.I))return null;var et=Ae.aa.start;Ae.bandwidth=Vt(Qe,"bandwidth",Xa)||0;var it=Ae.I.contentType,Pt=it==en||it=="application";it=it=="image";try{var Yt=void 0;if(He.le){var Zt=Ae.I.cb,an=Rr(Zt(),[He.le.Ah]),_t=lr(an,ke.g.retryParameters);Yt={method:"AES-128",iv:He.le.iv,firstMediaSequenceNumber:0,fetchKey:function(){var Lt,Ft,pi;return W(function(Gn){if(Gn.g==1)return N(Gn,uS(ke,_t,6),2);if(Gn.g!=3){if(!(Lt=Gn.h).data||Lt.data.byteLength!=16)throw new fe(2,4,4049);return Ft={name:"AES-CBC"},pi=Yt,N(Gn,s.crypto.subtle.importKey("raw",Lt.data,Ft,!0,["decrypt"]),3)}pi.cryptoKey=Gn.h,Yt.fetchKey=void 0,re(Gn)})}}}if(Zt=function(Lt,Ft,pi,Gn){return function(ti,Ms,Os,ni,kr){var Tf,Da,Uv,Ib;return W(function(Lb){return Lb.g==1?(Tf=Ks,Da=kr?0:1,Uv=pd(Ms,Os,ni,ti.g.retryParameters),N(Lb,uS(ti,Uv,Tf,{type:Da}),2)):(Ib=Lb.h,Lb.return(Ib.data))})}(ke,Lt,Ft,pi,Gn)},Ae.I.ed)var Bt=SN(Ae,Zt,Yt);else if(Ae.I.Cb)Bt=wN(Ae,ke.m,Yt);else if(Ae.I.fd)Bt=AN(Ae,Zt,ke.m,!!ke.j,ke.g.dash.initialSegmentLimit,ke.L,Yt);else{var tn=Ae.aa.duration||0,yt=Ae.I.cb;Bt={dc:function(){var Lt=io(et,tn,yt());return Lt.bc(function(Ft){Ft.mimeType=Ae.I.mimeType,Ft.codecs=Ae.I.codecs}),Promise.resolve(Lt)}}}}catch(Lt){if((Pt||it)&&Lt.code==4002)return null;throw Lt}Zt=function(Lt,Ft,pi,Gn){var ti=St(Lt,pi,Gn);if(Ft.Nf)Lt=Ft.drmInfos.length==1&&!Ft.drmInfos[0].keySystem,pi=ti.drmInfos.length==0,(Ft.drmInfos.length==0||Lt&&!pi)&&(Ft.drmInfos=ti.drmInfos),Ft.Nf=!1;else if(0<ti.drmInfos.length&&(Ft.drmInfos=Ft.drmInfos.filter(function(Ms){return ti.drmInfos.some(function(Os){return Os.keySystem==Ms.keySystem})}),Ft.drmInfos.length==0))throw new fe(2,4,4008);return ti.Jf||Ft.Jf}(Zt=jn(Qe,"ContentProtection"),He,ke.g.dash.ignoreDrmInfo,ke.g.dash.keySystemsByURI),Zt=new Set(Zt?[Zt]:[]),an=!1,jn(Qe,"SupplementalProperty").some(function(Lt){return Lt.getAttribute("schemeIdUri")=="tag:dolby.com,2018:dash:EC3_ExtensionType:2018"&&Lt.getAttribute("value")=="JOC"})&&(an=!0);var at,st,Ct=!1;if(Pt&&(Ct=Fe.includes("forced_subtitle")||Fe.includes("forced-subtitle")),it&&((Qe=jn(Qe,"EssentialProperty").find(function(Lt){return["http://dashif.org/thumbnail_tile","http://dashif.org/guidelines/thumbnail_tile"].includes(Lt.getAttribute("schemeIdUri"))}))&&(at=Qe.getAttribute("value")),!at))return null;Qe=Ae.I.codecs,Ae.profiles.includes("http://dashif.org/guidelines/dash-if-uhd#hevc-hdr-pq10")&&(Qe.includes("hvc1.2.4.L153.B0")||Qe.includes("hev1.2.4.L153.B0"))&&(st="PQ");var $t=(Pt=Ae.I.id?Ae.ra.id+","+Ae.I.id:"")&&ke.m[Pt]?ke.m[Pt]:{id:ke.J++,originalId:Ae.I.id,groupId:null,createSegmentIndex:function(){return Promise.resolve()},closeSegmentIndex:function(){$t.segmentIndex&&($t.segmentIndex.release(),$t.segmentIndex=null)},segmentIndex:null,mimeType:Ae.I.mimeType,codecs:Qe,frameRate:Ae.I.frameRate,pixelAspectRatio:Ae.I.pixelAspectRatio,bandwidth:Ae.bandwidth,width:Ae.I.width,height:Ae.I.height,kind:De,encrypted:0<He.drmInfos.length,drmInfos:He.drmInfos,keyIds:Zt,language:$e,originalLanguage:Ae.ma.language,label:je,type:Ae.ma.contentType,primary:Ge,trickModeVideo:null,emsgSchemeIdUris:Ae.I.emsgSchemeIdUris,roles:Fe,forced:Ct,channelsCount:Ae.I.Ud,audioSamplingRate:Ae.I.audioSamplingRate,spatialAudio:an,closedCaptions:rt,hdr:st,videoLayout:void 0,tilesLayout:at,accessibilityPurpose:Et,external:!1,fastSwitching:!1,fullMimeTypes:new Set([Er(Ae.I.mimeType,Ae.I.codecs)])};return $t.createSegmentIndex=function(){var Lt;return W(function(Ft){if(Ft.g==1)return $t.segmentIndex?Ft.B(0):(Lt=$t,N(Ft,Bt.dc(),3));Lt.segmentIndex=Ft.h,re(Ft)})},Pt&&Ae.xb&&!ke.m[Pt]&&(ke.m[Pt]=$t),$t}(x,C,_e,Y,Ye,Ve,F,H,ge,be,oe))&&(be.hdr=be.hdr||j,be.fastSwitching=he),be}).filter(function(be){return!!be}),D.length==0){if(B=C.ma.contentType=="image",x.g.dash.ignoreEmptyAdaptationSet||te||B)return null;throw new fe(2,4,4003)}if(!C.ma.contentType||C.ma.contentType=="application")for(C.ma.contentType=uR(D[0].mimeType,D[0].codecs),te=T(D),ae=te.next();!ae.done;ae=te.next())ae.value.type=C.ma.contentType;for(te=C.ma.id||"__fake__"+x.J++,X=T(D),ae=X.next();!ae.done;ae=X.next()){for(ae=ae.value,le=(me=T(_e.drmInfos)).next();!le.done;le=me.next())(le=le.value).keyIds=le.keyIds&&ae.keyIds?new Set([].concat(M(le.keyIds),M(ae.keyIds))):le.keyIds||ae.keyIds;x.g.dash.enableAudioGroups&&(ae.groupId=te)}return q=q.map(function(be){return be.getAttribute("id")}).filter(Va),{id:te,contentType:C.ma.contentType,language:Ye,cj:F,streams:D,drmInfos:_e.drmInfos,wf:B,Qh:q}}(e,n,I)}).filter(Va),n.xb){for(o=[],p=(h=T(i)).next();!p.done;p=h.next())for(var g=(p=T(p.value.Qh)).next();!g.done;g=p.next())o.push(g.value);if(o.length!=new Set(o).size)throw new fe(2,4,4018)}for(o=i.filter(function(I){return!I.wf}),h=(i=T(i=i.filter(function(I){return I.wf}))).next();!h.done;h=i.next()){p=(h=h.value).wf.split(" ");for(var b=(g=T(o)).next();!b.done;b=g.next()){var w=b.value;if(p.includes(w.id)){b={};for(var k=(w=T(w.streams)).next();!k.done;b={pd:b.pd},k=w.next())b.pd=k.value,b.pd.trickModeVideo=h.streams.find(function(I){return function(x){return Ji(I.pd.codecs)==Ji(x.codecs)}}(b))}}}if(i=q1(e.g.disableAudio,o,"audio"),h=q1(e.g.disableVideo,o,"video"),p=q1(e.g.disableText,o,en),o=q1(e.g.disableThumbnails,o,"image"),h.length===0&&i.length===0)throw new fe(2,4,4004);return{id:n.ra.id,audioStreams:i,videoStreams:h,textStreams:p,imageStreams:o}}function q1(e,n,i){return e||!n.length?[]:n.reduce(function(o,h){return h.contentType!=i||o.push.apply(o,M(h.streams)),o},[])}function oS(e,n){0>e.F||e.G.U(Math.max(e.F-n,Wt(e.H)))}function lS(e,n,i,o){i=i||{contentType:"",mimeType:"",codecs:"",emsgSchemeIdUris:[],frameRate:void 0,pixelAspectRatio:void 0,Ud:null,audioSamplingRate:null,wb:0,jf:0},o=o||i.cb;var h,p=n.getAttribute("id"),g=jn(n,"BaseURL"),b=!1;if(e.h)for(var w=T(g),k=w.next();!k.done;k=w.next()){var I=k.value;k=I.getAttribute("serviceLocation"),I=Tr(I),k&&I&&(Vg(e.h,p,k,I),b=!0)}b&&e.h||(h=g.map(Tr)),w=n.getAttribute("contentType")||i.contentType,k=n.getAttribute("mimeType")||i.mimeType,I=n.getAttribute("codecs")||i.codecs;var x=Vt(n,"frameRate",Ip)||i.frameRate,C=n.getAttribute("sar")||i.pixelAspectRatio,D=function(q,X){X=X.slice();for(var he=(q=T(q)).next();!he.done;he=q.next())he=he.value.getAttribute("schemeIdUri"),X.includes(he)||X.push(he);return X}(jn(n,"InbandEventStream"),i.emsgSchemeIdUris),_=jn(n,"AudioChannelConfiguration");_=function(q){for(var X=(q=T(q)).next();!X.done;X=q.next()){var he=X.value;if((X=he.getAttribute("schemeIdUri"))&&(he=he.getAttribute("value")))switch(X){case"urn:mpeg:dash:outputChannelPositionList:2012":return he.trim().split(/ +/).length;case"urn:mpeg:dash:23003:3:audio_channel_configuration:2011":case"urn:dts:dash:audio_channel_configuration:2012":if(!(X=parseInt(he,10)))continue;return X;case"tag:dolby.com,2014:dash:audio_channel_configuration:2011":case"urn:dolby:dash:audio_channel_configuration:2011":if(!(X=parseInt(he,16)))continue;for(q=0;X;)1&X&&++q,X>>=1;return q;case"urn:mpeg:mpegB:cicp:ChannelConfiguration":if(X=[0,1,2,3,4,5,6,8,2,3,4,7,8,24,8,12,10,12,14,12,14],(he=parseInt(he,10))&&0<he&&he<X.length)return X[he]}}return null}(_)||i.Ud;var j=Vt(n,"audioSamplingRate",vi)||i.audioSamplingRate;w||(w=uR(k,I));var F=zr(n,"SegmentBase"),B=zr(n,"SegmentTemplate"),H=F&&Vt(F,"availabilityTimeOffset",Ja)||0,Y=B&&Vt(B,"availabilityTimeOffset",Ja)||0,te=g&&g.length&&Vt(g[0],"availabilityTimeOffset",Ja)||0;return H=i.wb+te+H+Y,Y=null,(te=zr(n,"SegmentSequenceProperties"))&&(te=zr(te,"SAP"))&&(Y=Vt(te,"cadence",Qa)),{cb:function(){return Rr(o(),g.length?e.h&&b?vv(e.h,p):h||[]:[])},ed:F||i.ed,Cb:zr(n,"SegmentList")||i.Cb,fd:B||i.fd,width:Vt(n,"width",vi)||i.width,height:Vt(n,"height",vi)||i.height,contentType:w,mimeType:k,codecs:I,frameRate:x,pixelAspectRatio:C,emsgSchemeIdUris:D,id:p,language:n.getAttribute("lang"),Ud:_,audioSamplingRate:j,wb:H,jf:Y||i.jf}}function lR(e,n,i,o){var h,p,g,b,w,k;return W(function(I){if(I.g==1)return h=Rr(n(),[i]),(p=lr(h,e.g.retryParameters)).method=o,g=e.i.networkingEngine.request(4,p),ai(e.C,g),N(I,g.promise,2);if(b=I.h,o=="HEAD"){if(!b.headers||!b.headers.date)return I.return(0);w=b.headers.date}else w=Wn(b.data);return k=Date.parse(w),isNaN(k)?I.return(0):I.return(k-Date.now())})}function _N(e,n,i,o,h){for(var p=o.getAttribute("schemeIdUri")||"",g=o.getAttribute("value")||"",b=Vt(o,"timescale",vi)||1,w=(o=T(jn(o,"Event"))).next();!w.done;w=o.next()){var k=Vt(w=w.value,"presentationTime",vi)||0,I=Vt(w,"duration",vi)||0;I=(k=k/b+n)+I/b,i!=null&&(k=Math.min(k,n+i),I=Math.min(I,n+i)),I<h||(w={schemeIdUri:p,value:g,startTime:k,endTime:I,id:w.getAttribute("id")||"",eventElement:w},e.i.onTimelineRegionAdded(w))}}function uR(e,n){return xl(n=Er(e,n))?en:e.split("/")[0]}function uS(e,n,i,o){return n=e.i.networkingEngine.request(i,n,o),ai(e.C,n),n.promise}function W1(){}(c=z1.prototype).configure=function(e){this.g=e,this.h&&this.h.configure(this.g),this.l&&(this.l.m=this.g.dash.multiTypeVariantsAllowed&&$a())},c.start=function(e,n){var i,o=this;return W(function(h){if(h.g==1)return o.s=n.isLowLatencyMode(),o.o=[e],o.i=n,N(h,aS(o),2);if(i=h.h,o.i&&oS(o,i),!o.i)throw new fe(2,7,7001);return h.return(o.j)})},c.stop=function(){for(var e=T(Object.values(this.m)),n=e.next();!n.done;n=e.next())(n=n.value).segmentIndex&&n.segmentIndex.release();return this.l&&this.l.release(),this.g=this.i=null,this.o=[],this.j=null,this.m={},this.l=null,this.G!=null&&(this.G.stop(),this.G=null),this.h&&this.h.destroy(),this.C.destroy()},c.update=function(){var e,n=this;return W(function(i){return i.g==1?(ne(i,2),N(i,aS(n),4)):i.g!=2?ce(i,0):(e=we(i),n.i&&e?(n.i.onError(e),void re(i)):i.return())})},c.onExpirationUpdated=function(){},c.onInitialVariantChosen=function(e){if(this.j&&this.j.presentationTimeline.R()){var n=e.video||e.audio;if(n&&n.segmentIndex){e=this.j.presentationTimeline.yb();var i=n.segmentIndex.find(e);i!=null&&(n=n.segmentIndex.get(i))&&(this.F=n.endTime-e,oS(this,0))}}},c.banLocation=function(e){this.h&&this.h.i.set(e,Date.now()+6e4)},We("shaka.dash.DashParser",z1),ks["application/dash+xml"]=function(){return new z1},ks["video/vnd.mpeg.dash.mpd"]=function(){return new z1},We("shaka.dependencies",W1),W1.has=function(e){return cS.has(e)},W1.add=function(e,n){if(!dR[e])throw Error(e+" is not supported");e==cR?Ss("mux.js","mux.js is no longer used in Shaka Player."):cS.set(e,function(){return n})};var cR="muxjs",dR={dj:cR,ISOBoxer:"ISOBoxer"};W1.Allowed=dR;var cS=new Map([["ISOBoxer",function(){return s.ISOBoxer}]]);function hR(e,n,i){this.type=e,this.g=n,this.segments=i||null}function dS(e,n,i,o){this.id=e,this.name=n,this.g=i,this.value=o===void 0?null:o}function fR(e){var n=new Set().add("AUDIO").add("VIDEO").add("SUBTITLES").add("PATHWAY-ID").add("GROUP-ID").add("URI");return e.toString(n)}function gt(e,n,i){return(e=e.getAttribute(n))?e.value:i||null}function br(e,n){if(!(e=e.getAttribute(n)))throw new fe(2,4,4023,n);return e.value}function pR(e,n,i){i=i===void 0?[]:i,this.g=n,this.h=e,this.gb=i}function gR(e,n){this.name=e,this.value=n}function Zo(e,n){return e.filter(function(i){return i.name==n})}function mR(e,n){return e.filter(function(i){return br(i,"TYPE")==n})}function Si(e,n){for(var i=(e=T(e)).next();!i.done;i=e.next())if((i=i.value).name===n)return i;return null}function zg(e,n,i){return i=i===void 0?0:i,(e=Si(e,n))?Number(e.value):i}function mf(e,n,i){return n?yR(e,[n],i):[]}function yR(e,n,i){if(!n.length)return[];n=Rr(e,n),e=[];for(var o=(n=T(n)).next();!o.done;o=n.next()){var h=e,p=h.push,g=o.value;if((o=i)&&o.size){var b=(g=String(g).replace(/%7B/g,"{").replace(/%7D/g,"}")).match(/{\$\w*}/g);if(b)for(var w=(b=T(b)).next();!w.done;w=b.next()){var k=(w=w.value).slice(2,w.length-1),I=o.get(k);if(!I)throw new fe(2,4,4039,k);g=g.replace(w,I)}o=g}else o=g;p.call(h,o)}return e}function yf(e){this.h=e||"",this.g=0}function qg(e){Nd(e,/[ \t]+/gm)}function Nd(e,n){return n.lastIndex=e.g,n=(n=n.exec(e.h))==null?null:{position:n.index,length:n[0].length,results:n},e.g==e.h.length||n==null||n.position!=e.g?null:(e.g+=n.length,n.results)}function vf(e){return e.g==e.h.length?null:(e=Nd(e,/[^ \t\n]*/gm))?e[0]:null}function FN(){this.g=0}function hS(e,n){var i=(n=(n=Wn(n)).replace(/\r\n|\r(?=[^\n]|$)/gm,`
`).trim()).split(/\n+/m);if(!/^#EXTM3U($|[ \t\n])/m.test(i[0]))throw new fe(2,4,4015);n=0;for(var o=!0,h=T(i),p=h.next();!p.done;p=h.next())if(p=p.value,/^#(?!EXT)/m.test(p)||o)o=!1;else{if(p=fS(e,p),--e.g,vR.includes(p.name)){n=1;break}p.name=="EXT-X-STREAM-INF"&&(o=!0)}for(h=[],o=!0,p=0;p<i.length;p++){var g=i[p],b=i[p+1];if(/^#(?!EXT)/m.test(g)||o)o=!1;else{if(g=fS(e,g),UN.includes(g.name)){if(n!=1)throw new fe(2,4,4017);g=i.splice(p,i.length-p),i=[],o=[],p=[],b=null;for(var w=(g=T(g)).next();!w.done;w=g.next())w=w.value,/^(#EXT)/.test(w)?(w=fS(e,w),vR.includes(w.name)?h.push(w):w.name=="EXT-X-MAP"?b=w:w.name=="EXT-X-PART"?p.push(w):w.name=="EXT-X-PRELOAD-HINT"?gt(w,"TYPE")=="PART"?p.push(w):gt(w,"TYPE")=="MAP"&&(w.name="EXT-X-MAP",b=w):o.push(w)):/^#(?!EXT)/m.test(w)||(w=w.trim(),b&&o.push(b),i.push(new pR(w,o,p)),o=[],p=[]);return p.length&&(b&&o.push(b),i.push(new pR("",o,p))),new hR(n,h,i)}h.push(g),g.name=="EXT-X-STREAM-INF"&&(g.g.push(new gR("URI",b)),o=!0)}}return new hR(n,h)}function fS(e,n){e=e.g++;var i=n.match(/^#(EXT[^:]*)(?::(.*))?$/);if(!i)throw new fe(2,4,4016,n);n=i[1];var o,h=i[2];if(i=[],h){var p;(p=Nd(h=new yf(h),/^([^,=]+)(?:,|$)/g))&&(o=p[1]);for(var g=/([^=]+)=(?:"([^"]*)"|([^",]*))(?:,|$)/g;p=Nd(h,g);)i.push(new gR(p[1],p[2]||p[3])),qg(h)}return new dS(e,n,i,o)}dS.prototype.toString=function(e){var n="#"+this.name,i=this.g?this.g.filter(function(o){return!e||!e.has(o.name)}).map(function(o){return o.name+"="+(isNaN(Number(o.value))?'"'+o.value+'"':o.value)}):[];return this.value&&i.unshift(this.value),0<i.length&&(n+=":"+i.join(",")),n},dS.prototype.getAttribute=function(e){var n=this.g.filter(function(i){return i.name==e});return n.length?n[0]:null};var vR="EXT-X-TARGETDURATION EXT-X-MEDIA-SEQUENCE EXT-X-DISCONTINUITY-SEQUENCE EXT-X-PLAYLIST-TYPE EXT-X-I-FRAMES-ONLY EXT-X-ENDLIST EXT-X-SERVER-CONTROL EXT-X-SKIP EXT-X-PART-INF".split(" "),UN="EXTINF EXT-X-BYTERANGE EXT-X-DISCONTINUITY EXT-X-PROGRAM-DATE-TIME EXT-X-KEY EXT-X-DATERANGE EXT-X-MAP".split(" ");function bR(){}function ER(e){try{var n=pS(e);return Ro({uri:e,originalUri:e,data:n.data,headers:{"content-type":n.contentType}})}catch(i){return ts(i)}}function pS(e){var n=e.split(":");if(2>n.length||n[0]!="data")throw new fe(2,1,1004,e);if(2>(n=n.slice(1).join(":").split(",")).length)throw new fe(2,1,1004,e);var i=n[0];e=s.decodeURIComponent(n.slice(1).join(",")),n=i.split(";"),i=n[0];var o=!1;return 1<n.length&&n[n.length-1]=="base64"&&(o=!0,n.pop()),{data:o?ns(e):As(e),contentType:i}}function TR(e){var n=Ri(e);return{type:n.split("/")[0],mimeType:n,codecs:e=Ci(e),language:null,height:null,width:null,channelCount:null,sampleRate:null,closedCaptions:new Map}}function BN(e){for(var n=new Set,i=[],o=(e=T(e)).next();!o.done;o=e.next()){var h=Hs(o=o.value);n.has(h)||(i.push(o),n.add(h))}return i}function Y1(){var e=this;this.g=this.i=null,this.u=1,this.o=new Map,this.H=new Map,this.K=new Map,this.K.set("video",new Map),this.K.set("audio",new Map),this.K.set(en,new Map),this.K.set("image",new Map),this.Aa=new Set,this.h=new Map,this.l=null,this.Y="",this.ya=new FN,this.J=-1,this.V=1/0,this.ba=this.kb=!1,this.s=new Qt(function(){(function(n){var i,o,h,p,g,b;W(function(w){switch(w.g){case 1:return n.i?(ne(w,2),i=Date.now(),N(w,n.update(),4)):w.return();case 4:o=Date.now(),na(n)&&(h=(o-i)/1e3,n.Fa.sample(1,h),p=n.m,g=Math.max(0,p-Wt(n.Fa)),n.s.U(g)),ce(w,3);break;case 2:if(b=we(w),!n.i)return w.return();if(n.g.raiseFatalErrorOnManifestUpdateRequestFailure)return n.i.onError(b),w.return();b.severity=1,n.i.onError(b),n.s.U(.1);case 3:if(!n.i)return w.return();n.i.onManifestUpdated(),re(w)}})})(e)}),this.ca=X1,this.C=null,this.za=0,this.m=1/0,this.ha=this.ga=this.L=0,this.N=new Do,this.F=new Map,this.G=new Map,this.W=new Map,this.jb=this.A=!1,this.Fa=new bt(5),this.j=null}function gS(e,n){return na(e)?e.K.get(n.type):n.Qd}function $N(e,n){var i,o,h,p,g,b,w,k,I,x,C,D,_,j,F,B,H,Y,te,q,X,he,ae,me,oe,ge,le,Ee;return W(function(ve){if(ve.g==1){for(i=[],o=T(n.Z()),h=o.next();!h.done;h=o.next())p=h.value,g=new mr(p),b=g.g,n.sd&&(0<=n.Ya&&b.add("_HLS_msn",String(n.Ya)),0<=n.Za&&b.add("_HLS_part",String(n.Za))),n.td&&b.add("_HLS_skip","YES"),Bm(b)&&Ii(g,b),i.push(g.toString());return N(ve,SS(e,i,!0),2)}if(w=ve.h,!n.stream.segmentIndex)return ve.return();if((k=hS(e.ya,w.data)).type!=1)throw new fe(2,4,4017);var Be,_e;(I=w.uri)==w.originalUri||n.Z().includes(I)||n.gg.push(I),x=Zo(k.g,"EXT-X-DEFINE"),C=AR(e,x,I),D=n.stream,_=gS(e,n),j=NR(k,D.mimeType),F=j.keyIds,B=j.drmInfos,Be=D.keyIds,_e=F,Be.size===_e.size&&[].concat(M(Be)).every(function(Ye){return _e.has(Ye)})||(D.keyIds=F,D.drmInfos=B,e.i.newDrmInfo(D)),H=BR(e,k,D,_,C,n.Z),Y=H.segments,(te=H.bandwidth)&&(D.bandwidth=te),D.segmentIndex.Yc(Y,e.l.fb()),Y.length&&(q=zg(k.g,"EXT-X-MEDIA-SEQUENCE",0),he=(X=Si(k.g,"EXT-X-SKIP"))?Number(gt(X,"SKIPPED-SEGMENTS")):0,ae=MR(q,Y),me=ae.Ya,oe=ae.Za,n.Ya=me+he,n.Za=oe,ge=_.get(q),D.segmentIndex.bb(ge)),le=Y[0],n.Sb=le.startTime,Ee=Y[Y.length-1],n.pb=Ee.endTime,Si(k.g,"EXT-X-ENDLIST")&&(n.Uc=!0),vS(e,k),re(ve)})}function SR(e,n,i){n.Sb+=i,n.pb+=i;for(var o=T(e=gS(e,n)),h=o.next();!h.done;h=o.next()){var p=T(h.value);h=p.next().value,p=p.next().value,e.set(h,p+i)}n.Z()}function wR(e,n,i){var o,h,p,g,b,w,k,I,x,C,D,_,j,F,B,H,Y,te,q,X,he;return W(function(ae){switch(ae.g){case 1:if(o=TR(e.g.hls.mediaPlaylistFullMimeType),!n.segments.length)return ae.return(o);if(h=n.segments[0],p=mf(i(),h.h),g=p[0],b=new mr(g),w=b.Da.split(".").pop(),k=GR[w])return ae.return(TR(k));if(I=Ks,x=null,C=UR(e,n,h.g,i),e.W.clear(),!C){ae.B(2);break}return D=pd(C.Z(),C.hc(),C.fc(),e.g.retryParameters),N(ae,Yg(e,D,I,{type:0}),3);case 3:_=ae.h,x=_.data;case 2:return j=0,F=null,(B=Si(h.g,"EXT-X-BYTERANGE"))&&(H=T(bS(null,B.value)),j=H.next().value,F=H.next().value),Y=pd(p,j,F,e.g.retryParameters),N(ae,Yg(e,Y,I,{type:1}),4);case 4:if(te=ae.h,(q=te.headers["content-type"])&&(q=q.split(";")[0].toLowerCase()),w=="ts"||q=="video/mp2t"){var me=te.data,oe=Nt(me),ge=(oe=new Mn().parse(oe)).Rc();oe=oe.Ke();var le=[],Ee=!1,ve=!1;switch(ge.audio){case"aac":case"aac-loas":le.push("mp4a.40.2"),Ee=!0;break;case"mp3":le.push("mp4a.40.34"),Ee=!0;break;case"ac3":le.push("ac-3"),Ee=!0;break;case"ec3":le.push("ec-3"),Ee=!0;break;case"opus":le.push("opus"),Ee=!0}switch(ge.video){case"avc":oe.ja?le.push(oe.ja):le.push("avc1.42E01E"),ve=!0;break;case"hvc":oe.ja?le.push(oe.ja):le.push("hvc1.1.6.L93.90"),ve=!0;break;case"av1":le.push("av01.0.01M.08"),ve=!0}if(le.length){if(ge=Ee&&!ve,Ee=new Map,ve){(ve=new Yi("video/mp2t")).i(me);for(var Be=(me=T(ve.j())).next();!Be.done;Be=me.next())Be=Be.value,Ee.set(Be,Be);ve.g()}oe={type:ge?"audio":"video",mimeType:"video/mp2t",codecs:le.join(", "),language:null,height:oe.height,width:oe.width,channelCount:null,sampleRate:null,closedCaptions:Ee}}else oe=null;if(X=oe)return ae.return(X)}else if((w=="mp4"||w=="cmfv"||w=="m4s"||w=="fmp4"||q=="video/mp4"||q=="audio/mp4"||q=="video/iso.segment")&&(he=function(_e,Ye){function Ve(et){return be(et.name)}function be(et){switch(et=et.toLowerCase()){case"avc1":case"avc3":ke.push(et+".42E01E"),He=!0;break;case"hev1":case"hvc1":ke.push(et+".1.6.L93.90"),He=!0;break;case"dvh1":case"dvhe":ke.push(et+".05.04"),He=!0;break;case"vp09":ke.push(et+".00.10.08"),He=!0;break;case"av01":ke.push(et+".0.01M.08"),He=!0;break;case"mp4a":ke.push("mp4a.40.2"),Ae=!0;break;case"ac-3":case"ec-3":case"opus":case"flac":ke.push(et),Ae=!0}}var ke=[],Ae=!1,He=!1,De=null,$e=null,je=null,Ge=null,Fe=null;if(new _n().box("moov",cn).box("trak",cn).O("tkhd",function(et){et=$p(et.reader,et.version),$e=String(et.height),je=String(et.width)}).box("mdia",cn).O("mdhd",function(et){De=Bu(et.reader,et.version).language}).box("minf",cn).box("stbl",cn).O("stsd",qa).box("mp4a",function(et){var it=et.reader;it.skip(6),it.skip(2),it.skip(8);var Pt=it.wa();it.skip(2),it.skip(2),it.skip(2),it=it.wa()+it.wa()/65536,Ge=Pt,Fe=it,et.reader.ea()?cn(et):Ve(et)}).box("esds",function(et){et=function(it){for(var Pt,Yt,Zt="mp4a";it.ea();){Pt=it.fa();for(var an=it.fa();128&an;)an=it.fa();if(Pt==3)it.wa(),128&(an=it.fa())&&it.wa(),64&an&&it.skip(it.fa()),32&an&&it.wa();else if(Pt==4)Yt=it.fa(),it.skip(12);else if(Pt==5)break}return Yt&&(Zt+="."+this.g(Yt),Pt==5&&it.ea()&&((Yt=(248&(Pt=it.fa()))>>3)==31&&it.ea()&&(Yt=32+((7&Pt)<<3)+((224&it.fa())>>5)),Zt+="."+Yt)),{ja:Zt}}(et.reader),ke.push(et.ja),Ae=!0}).box("ac-3",Ve).box("ec-3",Ve).box("opus",Ve).box("Opus",Ve).box("fLaC",Ve).box("avc1",function(et){et=wy(et.reader,et.name),ke.push(et.ja),He=!0}).box("avc3",function(et){et=wy(et.reader,et.name),ke.push(et.ja),He=!0}).box("hev1",Ve).box("hvc1",Ve).box("dvh1",Ve).box("dvhe",Ve).box("vp09",Ve).box("av01",Ve).box("enca",sd).box("encv",id).box("sinf",cn).box("frma",function(et){be(et=Ay(et.reader).ja)}).parse(_e||Ye,!0),!ke.length)return null;var rt=Ae&&!He,Qe=new Map;if(He){var Et=new Yi("video/mp4");for(_e&&Et.init(_e),Et.i(Ye),Ye=(_e=T(Et.j())).next();!Ye.done;Ye=_e.next())Ye=Ye.value,Qe.set(Ye,Ye);Et.g()}return{type:rt?"audio":"video",mimeType:rt?"audio/mp4":"video/mp4",codecs:BN(ke).join(", "),language:De,height:$e,width:je,channelCount:Ge,sampleRate:Fe,closedCaptions:Qe}}(x,te.data)))return ae.return(he);return ae.return(o)}})}function mS(e){if(na(e)){if(e.ca==J1){for(var n,i=n=1/0,o=T(e.h.values()),h=o.next();!h.done;h=o.next())(h=h.value).stream.segmentIndex&&h.stream.type!="text"&&(n=Math.min(n,h.pb),i=Math.min(i,h.Sb));n-=i,e.g.hls.useSafariBehaviorForLive&&(n=e.l.o),isNaN(e.g.availabilityWindowOverride)||(n=e.g.availabilityWindowOverride),e.l.Yd(n)}if(!e.l.m)for(i=(n=T(e.h.values())).next();!i.done;i=n.next())!(i=i.value).stream.segmentIndex||i.type!="audio"&&i.type!="video"||(i=i.stream.segmentIndex.get(0))&&i.g&&e.l.ng(i.g)}else e.l.Pa(CR(e));e.l.Od()}function AR(e,n,i){i=new mr(i).g;for(var o=new Map,h=(n=T(n)).next();!h.done;h=n.next()){var p=h.value,g=gt(p,"NAME"),b=gt(p,"VALUE");h=gt(p,"QUERYPARAM"),p=gt(p,"IMPORT"),g&&b&&(o.has(g)||o.set(g,b)),h&&(g=i.get(h)[0])&&!o.has(g)&&o.set(h,g),p&&(h=e.o.get(p))&&o.set(p,h)}return o}function Wg(e){e.fullMimeTypes=new Set([Er(e.mimeType,e.codecs)])}function jN(e,n,i,o){for(var h={audio:[],video:[]},p=new Map,g=[],b=!1,w=!1,k=T(n),I=k.next();!I.done;I=k.next()){var x=I.value;I=gt(x,"AUDIO");var C=gt(x,"VIDEO"),D=I||C;D&&(g.includes(D)||g.push(D),(x=gt(x,"PATHWAY-ID"))&&p.set(D,x),I?b=!0:C&&(w=!0))}g.length&&i.length&&function(F,B,H){B=B.filter(function(he){var ae=gt(he,"URI")||"";return gt(he,"TYPE")!="SUBTITLES"&&ae!=""});for(var Y={},te=(B=T(B)).next();!te.done;te=B.next()){var q=fR(te=te.value);Y[q]?Y[q].push(te):Y[q]=[te]}for(var X in Y)RR(F,Y[X],H)}(e,k=i.filter(function(F){return g.includes(br(F,"GROUP-ID"))}),p),k=(p=g.sort().join(","))&&e.H.has(p)?e.H.get(p):[],b?h.audio.push.apply(h.audio,M(k)):w&&h.video.push.apply(h.video,M(k)),I=!1;var _=n.map(function(F){return br(F,"URI")});if(w=h.audio.find(function(F){return F&&F.Z().find(function(B){return _.includes(B)})}),C=Li("video",b=kR(e,n[0])),(D=Li("audio",b))&&!C?(w="audio",I=0<h.audio.length):!h.audio.length&&!h.video.length&&D&&C?(w="video",b=[[C,D].join()]):h.audio.length&&w?(w="audio",I=!0):w=h.video.length&&!h.audio.length?"audio":"video",!I){var j=x=D=C=I=null;!k.length&&(i=i.find(function(F){var B=gt(F,"URI")||"",H=gt(F,"TYPE");return F=br(F,"GROUP-ID"),H!="SUBTITLES"&&B==""&&g.includes(F)}))&&(I=gt(i,"LANGUAGE"),C=gt(i,"NAME"),D=xR(i),LR(i),x=gt(i,"CHARACTERISTICS"),j=IR(i)),e=function(F,B,H,Y,te,q,X,he,ae){for(var me=F.u++,oe=[],ge=T(B),le=ge.next();!le.done;le=ge.next()){var Ee=le.value;le=br(Ee,"URI"),Ee=gt(Ee,"PATHWAY-ID"),F.j&&Ee&&Vg(F.j,me,Ee,le),oe.push(le)}if(ge=oe.sort().join(","),F.h.has(ge))return F.h.get(ge);e:{if(B=gt(B[0],"CLOSED-CAPTIONS"),Y=="video"){if(B&&B!="NONE"){B=F.F.get(B);break e}if(!B&&F.F.size)for(B=T(F.F.keys()).next();!B.done;){B=F.F.get(B.value);break e}}B=null}return H=vu(Y,H),Y=Q1(F,me,oe,H,Y,te,!1,q,X,B,he,!1,ae,!1),F.h.set(ge,Y),Y}(e,n,b,w,I,C,D,x,j),p&&(e.stream.groupId=p),k.length||(e.stream.bandwidth=o),h[e.stream.type]=[e]}return h}function kR(e,n){var i=gt(n,"CODECS")||"";e.ba=0<i.length,e.ba||e.g.hls.disableCodecGuessing||(n=[],e.g.disableVideo||n.push(e.g.hls.defaultVideoCodec),e.g.disableAudio||n.push(e.g.hls.defaultAudioCodec),i=n.join(",")),e=new Set,n=[];for(var o=(i=T(i.split(/\s*,\s*/))).next();!o.done;o=i.next()){var h=Hs(o=o.value);e.has(h)||(n.push(o),e.add(h))}return n}function xR(e){return(e=gt(e,"CHANNELS"))?parseInt(e.split("/")[0],10):null}function IR(e){return(e=gt(e,"SAMPLE-RATE"))?parseInt(e,10):null}function LR(e){return!!(e=gt(e,"CHANNELS"))&&e.includes("/JOC")}function GN(e,n,i,o,h,p,g,b,w,k,I){for(var x=T(i),C=x.next();!C.done;C=x.next())$R(C.value.stream,h,p,g,b,w);for(h=e.g.disableAudio,n.length&&!h||(n=[null]),h=e.g.disableVideo,i.length&&!h||(i=[null]),h=[],p=(n=T(n)).next();!p.done;p=n.next())for(p=p.value,b=(g=T(i)).next();!b.done;b=g.next()){var D=b.value;(b=p?p.stream:null)&&(b.drmInfos=k,b.keyIds=I),(w=D?D.stream:null)&&(w.drmInfos=k,w.keyIds=I),x=p?p.stream.drmInfos:null,C=D?D.stream.drmInfos:null,D=(D=D?D.Z().sort().join(","):"")+" - "+(p?p.Z().sort().join(","):""),b&&w&&!Dp(x,C)||e.Aa.has(D)||(b={id:e.u++,language:b?b.language:"und",disabledUntilTime:0,primary:!!b&&b.primary||!!w&&w.primary,audio:b,video:w,bandwidth:o,allowedByApplication:!0,allowedByKeySystem:!0,decodingInfos:[]},h.push(b),e.Aa.add(D))}return h}function RR(e,n,i){for(var o=[],h=[],p=new Map,g=T(n),b=g.next();!b.done;b=g.next()){var w=b.value;b=br(w,"URI"),w=br(w,"GROUP-ID"),o.push(b),h.push(w),p.set(w,b)}if(g=h.sort().join(","),b=n[0],n="",(w=br(b,"TYPE").toLowerCase())=="subtitles"&&(w=en),w==en)n=gt(b,"CODECS")||"";else for(var k=(h=T(h)).next();!k.done;k=h.next())if(k=k.value,e.G.has(k)){n=e.G.get(k);break}if(h=o.sort().join(","),e.h.has(h))return e.h.get(h);if(k=e.u++,e.j)for(var I=(p=T(p)).next();!I.done;I=p.next()){var x=T(I.value);I=x.next().value,x=x.next().value,(I=i.get(I))&&Vg(e.j,k,I,x)}i=gt(b,"LANGUAGE"),p=gt(b,"NAME"),I=gt(b,"DEFAULT")=="YES",x=w=="audio"?xR(b):null;var C=w=="audio"&&LR(b);return(o=Q1(e,k,o,n,w,i,I,p,x,null,gt(b,"CHARACTERISTICS"),gt(b,"FORCED")=="YES",b=w=="audio"?IR(b):null,C)).stream&&(o.stream.groupId=g),e.H.has(g)?e.H.get(g).push(o):e.H.set(g,[o]),e.h.set(h,o),o}function Q1(e,n,i,o,h,p,g,b,w,k,I,x,C,D){function _(q){var X,he,ae,me,oe,ge,le,Ee,ve,Be,_e,Ye,Ve,be,ke,Ae,He;return W(function(De){switch(De.g){case 1:return X=H.Z(),N(De,SS(e,H.Z(),!0),2);case 2:if(he=De.h,q.aborted)return De.return();if((ae=he.uri)==he.originalUri||X.includes(ae)||B.push(ae),me=hS(e.ya,he.data),oe=void 0,e.ba||!e.g.hls.disableCodecGuessing){De.B(3);break}return N(De,wR(e,me,j),4);case 4:ge=De.h,oe=ge.mimeType,o=ge.codecs;case 3:return le=na(e),N(De,PR(e,0,me,j,ae,o,h,p,g,b,w,k,I,x,C,D,oe),5);case 5:if(Ee=De.h,q.aborted)return De.return();if(ve=Ee.stream,na(e)&&!le&&FR(e,me),H.Sb=Ee.Sb,H.pb=Ee.pb,H.td=Ee.td,H.sd=Ee.sd,H.Uc=Ee.Uc,H.Qd=Ee.Qd,H.Ya=Ee.Ya,H.Za=Ee.Za,H.Se=!0,F.segmentIndex=ve.segmentIndex,F.encrypted=ve.encrypted,F.drmInfos=ve.drmInfos,F.keyIds=ve.keyIds,F.mimeType=ve.mimeType,F.bandwidth=F.bandwidth||ve.bandwidth,F.codecs=F.codecs||ve.codecs,Wg(F),F.drmInfos.length&&e.i.newDrmInfo(F),h==(Be=_r).$||h==Be.P)for(_e=T(e.h.values()),Ye=_e.next();!Ye.done;Ye=_e.next())(Ve=Ye.value).Se||Ve.type!=h||(Ve.stream.mimeType=ve.mimeType,Wg(Ve.stream));h==Be.ia&&(be=ve.segmentIndex.get(0))&&be.h&&(F.mimeType="application/mp4",Wg(F)),function($e){if(!$e.C)return!1;for(var je=[],Ge=[],Fe=($e=T($e.C.variants)).next();!Fe.done;Fe=$e.next())(Fe=Fe.value).video&&je.push(Fe.video),Fe.audio&&Ge.push(Fe.audio);return!(0<je.length&&!je.some(function(rt){return rt.segmentIndex})||0<Ge.length&&!Ge.some(function(rt){return rt.segmentIndex}))}(e)&&(e.kb?yS(e,[H]):(e.kb=!0,ke=Array.from(e.h.values()),Ae=ke.filter(function($e){return $e.stream.segmentIndex}),yS(e,Ae),mS(e),0<(He=e.m)&&e.s.U(He))),re(De)}})}function j(){return e.j&&1<i.length?vv(e.j,n):B.concat(yR([e.Y],i,e.o))}var F=OR(e,o,h,p,g,b,w,k,I,x,C,D),B=[],H={stream:F,type:h,gg:B,Z:j,Sb:0,pb:0,Qd:new Map,td:!1,sd:!1,Uc:!1,re:-1,Ya:-1,Za:-1,Se:!1},Y=null,te=new AbortController;return F.createSegmentIndex=function(){return Y||(te=new AbortController,Y=new Promise(function(q){q(_(te.signal))}))},F.closeSegmentIndex=function(){Y&&!F.segmentIndex&&te.abort(),F.segmentIndex&&(F.segmentIndex.release(),F.segmentIndex=null),Y=null},H}function CR(e){for(var n=1/0,i=(e=T(e.h.values())).next();!i.done;i=e.next())(i=i.value).stream.segmentIndex&&i.stream.type!="text"&&(n=Math.min(n,i.pb));return n}function DR(e,n){for(var i=[],o=(n=T(n)).next();!o.done;o=n.next())(o=o.value).segmentIndex&&o.segmentIndex.bc(function(h){i.push(h)});e.l.Zc(i)}function yS(e,n){if(!na(e))for(var i=CR(e),o=T(n),h=o.next();!h.done;h=o.next())h.value.stream.segmentIndex.ac(0,i);DR(e,n.map(function(p){return p.stream})),e.g.hls.ignoreManifestProgramDateTime?function(p,g){for(var b=p.J==-1,w=T(g),k=w.next();!k.done;k=w.next()){var I=(k=k.value).stream.segmentIndex,x=gS(p,k);if(I=I.g[0]||null)for(var C=(x=T(x)).next();!C.done;C=x.next()){var D=(C=T(C.value)).next().value;if(C.next().value==I.startTime){b&&(p.J=Math.max(p.J,D)),k.re=D;break}}}if(!(0>p.J))for(k=(g=T(g)).next();!k.done;k=g.next())(w=(b=k.value).stream.segmentIndex)&&0<(k=p.J-b.re)&&(w.g.splice(0,k),w=w.g[0]||null)&&(w=-w.startTime,b.stream.segmentIndex.offset(w),SR(p,b,w))}(e,n):function(p,g){if(p.V==1/0)for(var b=(g=T(g)).next();!b.done;b=g.next()){var w=b.value.stream.segmentIndex.g[0]||null;w!=null&&w.g!=null&&(p.V=Math.min(p.V,w.g))}if((g=p.V)!=1/0)for(b=(w=T(p.h.values())).next();!b.done;b=w.next()){var k=(b=b.value).stream.segmentIndex;if(k!=null){var I=k.g[0]||null;if(I.g==null)Kn("Missing EXT-X-PROGRAM-DATE-TIME for stream",b.Z(),"Expect AV sync issues!");else for(SR(p,b,I.g-g-I.startTime),k=(b=T(k)).next();!k.done;k=b.next())k.value.tf(g)}}}(e,n)}function PR(e,n,i,o,h,p,g,b,w,k,I,x,C,D,_,j,F){var B,H,Y,te,q,X,he,ae,me,oe,ge,le,Ee,ve,Be,_e,Ye,Ve,be,ke,Ae,He,De;return W(function($e){if($e.g==1){if(i.type!=1)throw new fe(2,4,4017);B=Zo(i.g,"EXT-X-DEFINE"),H=AR(e,B,h);var je=Si(i.g,"EXT-X-PLAYLIST-TYPE"),Ge=Si(i.g,"EXT-X-ENDLIST");return Ge=je&&je.value=="VOD"||Ge,je=je&&je.value=="EVENT"&&!Ge,je=!Ge&&!je,jR(e,Ge?X1:je?J1:KR),na(e)&&vS(e,i),F?$e.B(2):N($e,function(Fe,rt,Qe,Et,et,it){var Pt,Yt,Zt,an,_t,Bt,tn,yt,at,st,Ct,$t,Lt;return W(function(Ft){switch(Ft.g){case 1:return Pt=Ks,Yt=Math.trunc((Et.segments.length-1)/2),Zt=mf(it(),Et.segments[Yt].h,et),an=new mr(Zt[0]),_t=an.Da.split(".").pop(),Bt=HR[rt],(tn=Bt[_t])||(tn=GR[_t])||(tn=ES(rt,Qe))?Ft.return(tn):(at=1,st=lr(Zt,Fe.g.retryParameters),ne(Ft,2),st.method="HEAD",N(Ft,Yg(Fe,st,Pt,{type:at}),4));case 4:Ct=Ft.h,yt=Ct.headers["content-type"],ce(Ft,3);break;case 2:if(!($t=we(Ft))||$t.code!=1002&&$t.code!=1001){Ft.B(3);break}return st.method="GET",N(Ft,Yg(Fe,st,Pt,{type:at}),6);case 6:Lt=Ft.h,yt=Lt.headers["content-type"];case 3:return yt?Ft.return(yt.split(";")[0]):Ft.return(TS(rt))}})}(e,g,p,i,H,o),3)}if($e.g!=2&&(F=$e.h),Y=NR(i,F),te=Y.drmInfos,q=Y.keyIds,X=Y.encrypted,he=Y.Eg,X&&!te.length&&!he)throw new fe(2,4,4026);return(ae=OR(e,p,g,b,w,k,I,x,C,D,_,j)).encrypted=X,ae.drmInfos=te,ae.keyIds=q,ae.mimeType=F,Wg(ae),me=na(e)?e.K.get(g):new Map,oe=BR(e,i,ae,me,H,o),ge=oe.segments,(le=oe.bandwidth)&&(ae.bandwidth=le),na(e)&&vS(e,i),Ee=ge[0].startTime,ve=ge[ge.length-1],Be=ve.endTime,_e=new Xt(ge),ae.segmentIndex=_e,Ve=!!(Ye=Si(i.g,"EXT-X-SERVER-CONTROL"))&&Ye.getAttribute("CAN-SKIP-UNTIL")!=null,be=!!Ye&&Ye.getAttribute("CAN-BLOCK-RELOAD")!=null,ke=zg(i.g,"EXT-X-MEDIA-SEQUENCE",0),Ae=MR(ke,ge),He=Ae.Ya,De=Ae.Za,$e.return({stream:ae,type:g,gg:[],Z:o,Sb:Ee,pb:Be,td:Ve,sd:be,Uc:!1,re:-1,Ya:He,Za:De,Qd:me,Se:!1})})}function MR(e,n){e=e+n.length-1;var i=-1;if(!n.length)return{Ya:++e,Za:i};var o=(n=n[n.length-1]).i;return n.i.length?(i=o.length-1,o[o.length-1].o||(e++,i=0),{Ya:e,Za:i}):(e++,n.s&&(i=0),{Ya:e,Za:i})}function OR(e,n,i,o,h,p,g,b,w,k,I,x){var C=ES(i,n)||TS(i),D=[];if(w)for(var _=(w=T(w.split(","))).next();!_.done;_=w.next())D.push(_.value);return w=void 0,_=null,i==en?w=D.includes("public.accessibility.transcribes-spoken-dialog")&&D.includes("public.accessibility.describes-music-and-sound")?"caption":"subtitle":D.includes("public.accessibility.describes-video")&&(_="visually impaired"),D.length||w!=="subtitle"||D.push("subtitle"),Wg(e={id:e.u++,originalId:p,groupId:null,createSegmentIndex:function(){return Promise.resolve()},segmentIndex:null,mimeType:C,codecs:n,kind:i==en?"subtitle":void 0,encrypted:!1,drmInfos:[],keyIds:new Set,language:dn(o||"und"),originalLanguage:o,label:p,type:i,primary:h,trickModeVideo:null,emsgSchemeIdUris:null,frameRate:void 0,pixelAspectRatio:void 0,width:void 0,height:void 0,bandwidth:void 0,roles:D,forced:k,channelsCount:g,audioSamplingRate:I,spatialAudio:x,closedCaptions:b,hdr:void 0,videoLayout:void 0,tilesLayout:void 0,accessibilityPurpose:_,external:!1,fastSwitching:!1,fullMimeTypes:new Set}),e}function NR(e,n){var i=[];if(e.segments)for(var o=(e=T(e.segments)).next();!o.done;o=e.next())o=Zo(o.value.g,"EXT-X-KEY"),i.push.apply(i,M(o));o=e=!1;for(var h=[],p=new Set,g=(i=T(i)).next();!g.done;g=i.next()){var b=br(g=g.value,"METHOD");if(b!="NONE"){if(e=!0,b=="AES-128")o=!0;else if(b=gt(g,"KEYFORMAT")||"identity",g=(b=VR[b])?b(g,n):null){if(g.keyIds)for(var w=(b=T(g.keyIds)).next();!w.done;w=b.next())p.add(w.value);h.push(g)}}}return{drmInfos:h,keyIds:p,encrypted:e,Eg:o}}function _R(e,n,i,o,h){if(!s.crypto||!s.crypto.subtle)throw Rt("Web Crypto API is not available to decrypt AES-128. (Web Crypto only exists in secure origins like https)"),new fe(2,4,4042);var p=0,g=gt(n,"IV","");if(g){var b=oi(g.substr(2));if(b.byteLength!=16)throw new fe(2,4,4048)}else p=zg(i.g,"EXT-X-MEDIA-SEQUENCE",0);var w={method:"AES-128",iv:b,firstMediaSequenceNumber:p,fetchKey:function(){var k,I,x,C,D;return W(function(_){if(_.g==1)return k=mf(o(),br(n,"URI"),h),I=lr(k,e.g.retryParameters),N(_,Yg(e,I,6),2);if(_.g!=3){if(!(x=_.h).data||x.data.byteLength!=16)throw new fe(2,4,4049);return C={name:"AES-CBC"},D=w,N(_,s.crypto.subtle.importKey("raw",x.data,C,!0,["decrypt"]),3)}D.cryptoKey=_.h,w.fetchKey=void 0,re(_)})}};return w}function vS(e,n){var i=1/0,o=n.segments;if(o.length)for(var h=o.length-1;0<=h;){var p=Si(o[h].g,"EXTINF");if(p){i=Number(p.value.split(",")[0]);break}h--}if(!(o=Si(n.g,"EXT-X-TARGETDURATION")))throw new fe(2,4,4024,"EXT-X-TARGETDURATION");o=Number(o.value),(h=Si(n.g,"EXT-X-PART-INF"))&&(e.L=Number(br(h,"PART-TARGET"))),n=Si(n.g,"EXT-X-SERVER-CONTROL"),e.A&&e.L?(e.m=e.jb?5*e.L<=i?Math.min(e.L,e.m):Math.min(i,e.m):Math.min(e.L,e.m),e.ha=n?Number(br(n,"PART-HOLD-BACK")):0):(e.m=Math.min(i,e.m),i=n?n.getAttribute("HOLD-BACK"):null,e.ga=i?Number(i.value):0),e.za=Math.max(o,e.za)}function FR(e,n){if(e.g.defaultPresentationDelay)n=e.g.defaultPresentationDelay;else if(e.ha)n=e.ha;else if(e.ga)n=e.ga;else{n=n.segments.length;var i=e.g.hls.liveSegmentsDelay;i>n-2&&(i=Math.max(1,n-2)),n=e.za*i}e.l.og(0),e.l.nf(n),e.l.pc(!1)}function UR(e,n,i,o,h){var p=Si(i,"EXT-X-MAP");if(!p)return null;var g=br(p,"URI"),b=mf(o(),g,h);if(g=[b.toString(),gt(p,"BYTERANGE","")].join("-"),!e.W.has(g)){for(var w=void 0,k=null,I=(i=T(i)).next();!I.done;I=i.next())(I=I.value).name=="EXT-X-KEY"?br(I,"METHOD")=="AES-128"&&I.id<p.id&&(w=_R(e,I,n,o,h)):I.name=="EXT-X-BYTERANGE"&&I.id<p.id&&(k=I);n=function(x,C,D,_){var j=0,F=null;return!(C=gt(C,"BYTERANGE"))&&D&&(C=D.value),C&&(j=C.split("@"),F=Number(j[0]),j=Number(j[1]),F=j+F-1,_&&(D=F+1-j)%16&&(F+=16-D%16)),new is(function(){return x},j,F,null,null,null,_)}(b,p,k,w),e.W.set(g,n)}return e.W.get(g)}function HN(e,n,i,o,h,p,g,b,w){var k=o.g,I=Si(k,"EXTINF"),x=0,C=0,D=null;o.gb.length&&!e.A&&Rt("Low-latency HLS live stream detected, but low-latency streaming mode is not enabled in Shaka Player. Set streaming.lowLatencyMode configuration to true, and see https://bit.ly/3clctcj for details.");var _=null;if(!e.g.hls.ignoreManifestProgramDateTime){var j=Si(k,"EXT-X-PROGRAM-DATE-TIME");j&&j.value&&(_=ad(j.value))}var F=Nl;if(Si(k,"EXT-X-GAP")&&(F=2),!I){if(o.gb.length==0)throw new fe(2,4,4024,"EXTINF");if(!e.A)return null}var B=[];j=!1;var H=null,Y=!1,te=!1;if(e.A&&o.gb.length){x=(g.mimeType=="video/mp4"||g.mimeType=="audio/mp4")&&s.ReadableStream&&e.g.hls.allowLowLatencyByteRangeOptimization;for(var q=_,X={},he=0;he<o.gb.length;X={Ec:X.Ec,md:X.md},he++){var ae=o.gb[he],me=he==0?i:B[B.length-1],oe=he==0?h:me.endTime,ge=Number(gt(ae,"DURATION"))||e.L;if(ge){var le=oe+ge,Ee=0,ve=null;if(ae.name=="EXT-X-PRELOAD-HINT"?(Ee=(Ee=gt(ae,"BYTERANGE-START"))?Number(Ee):0,(me=gt(ae,"BYTERANGE-LENGTH"))?ve=Ee+Number(me)-1:Ee&&(ve=Number.MAX_SAFE_INTEGER)):(Ee=(ve=T(bS(me,Ee=gt(ae,"BYTERANGE")))).next().value,ve=ve.next().value),X.md=gt(ae,"URI"),X.md){me=Nl,gt(ae,"GAP")=="YES"&&(me=2,Y=!0),X.Ec=null;var Be=function(Ye){return function(){return Ye.Ec==null&&(Ye.Ec=mf(b(),Ye.md,p)),Ye.Ec}}(X);x&&0<=Ee&&ve!=null&&(H=Be,j=!0),oe=new wt(oe,le,Be,Ee,ve,n,0,0,1/0,[],"",null,q,me,w),ae.name=="EXT-X-PRELOAD-HINT"&&(oe.Ue(),te=!0),gt(ae,"INDEPENDENT")!="YES"&&0<he&&oe.Pd(),B.push(oe),q&&(q+=ge)}}}}if(I){if((I=Number(I.value.split(",")[0]))==0)return null;x=h+I}else{if(!B.length)return null;x=B[B.length-1].endTime}j&&(Y||B[0].Qa!=0?(j=!1,H=null):B=[]),(I=Si(k,"EXT-X-BYTERANGE"))?(C=(D=T(bS(i,I.value))).next().value,D=D.next().value):B.length&&(C=B[0].Qa,D=B[B.length-1].ua),i="",I=null,g.type=="image"&&(i="1x1",g=Si(k,"EXT-X-TILES"))&&(i=br(g,"LAYOUT"),(g=gt(g,"DURATION"))&&(I=Number(g)));var _e=null;return n=new wt(h,x,function(){return H?H():(_e==null&&(_e=mf(b(),o.h,p)),_e||[])},C,D,n,0,0,1/0,B,i,I,_,F,w,0<B.length&&!!o.h),j&&(e.jb=!0,n.Zf(),te&&n.Ue()),n}function bS(e,n){var i=0,o=null;return n&&(i=n.split("@"),n=Number(i[0]),o=(i=i[1]?Number(i[1]):e.ua+1)+n-1),[i,o]}function BR(e,n,i,o,h,p){var g=n.segments,b=void 0,w=zg(n.g,"EXT-X-DISCONTINUITY-SEQUENCE",0),k=zg(n.g,"EXT-X-MEDIA-SEQUENCE",0),I=Si(n.g,"EXT-X-SKIP"),x=I?Number(gt(I,"SKIPPED-SEGMENTS")):0,C=k+x,D=0;na(e)&&o.has(C)&&(D=o.get(C)),D===0&&e.ca==J1&&0<o.size&&!o.has(C)&&(D=e.l.fb());var _=[],j=null;I=[];for(var F=0;F<g.length;F++){var B=g[F],H=F==0?D:j.endTime;C=k+x+F,Si(B.g,"EXT-X-DISCONTINUITY")&&w++;for(var Y=T(B.g),te=Y.next();!te.done;te=Y.next())(te=te.value).name=="EXT-X-KEY"&&(b=br(te,"METHOD")=="AES-128"?_R(e,te,n,p,h):void 0);o.set(C,H),Y=UR(e,n,B.g,p,h),!e.A&&e.i.isAutoLowLatencyMode()&&(e.i.enableLowLatencyMode(),e.A=e.i.isLowLatencyMode()),(H=HN(e,Y,j,B,H,h,i,p,b))&&((j=zg(B.g,"EXT-X-BITRATE"))?I.push({bitrate:j,duration:H.endTime-H.startTime}):I.length&&((j=I.pop()).duration+=H.endTime-H.startTime,I.push(j)),j=H,H.l=w,e.g.hls.ignoreManifestProgramDateTime&&e.J!=null&&C<e.J||_.push(H))}if(n=void 0,I.length&&(n=I.reduce(function(q,X){return q+X.duration},0),n=Math.round(I.reduce(function(q,X){return q+X.bitrate*X.duration},0)/n*1e3)),I=_.some(function(q){return q.g!=null})){for(i={},o=0;o<_.length;i={xc:i.xc,wc:i.wc,hd:i.hd,ub:i.ub,tc:i.tc},o++)if(i.ub=_[o],i.ub.g==null)for(i.wc=0,i.xc=o,h=function(q){return function(){var X=_[q.xc];if(X){if(X.g!=null)return X.g+q.wc;q.wc-=X.endTime-X.startTime,q.xc+=1}return null}}(i),i.tc=0,i.hd=o,p=function(q){return function(){var X=_[q.hd];if(X){if(X!=q.ub&&(q.tc+=X.endTime-X.startTime),X.g!=null)return X.g+q.tc;--q.hd}return null}}(i);i.ub.g==null;)i.ub.g=p(),i.ub.g==null&&(i.ub.g=h())}if(I)for(o=(i=T(_)).next();!o.done;o=i.next())for(o=(h=o.value).g,p=(h=T(h.i)).next();!p.done;p=h.next())(p=p.value).g=o,o+=p.endTime-p.startTime;if(e=e.V,I&&e!=1/0)for(o=(I=T(_)).next();!o.done;o=I.next())o.value.tf(e);return{segments:_,bandwidth:n}}function ES(e,n){if(e==en){if(n=="vtt"||n=="wvtt")return"text/vtt";if(n&&n!=="")return"application/mp4"}return e!="image"||n&&n!="jpeg"?e=="audio"&&n=="mp4a.40.34"?"audio/mpeg":n=="mjpg"?"application/mp4":null:"image/jpeg"}function TS(e){return e==en?"text/vtt":HR[e].mp4}function $R(e,n,i,o,h,p){e&&(e.width=Number(n)||void 0,e.height=Number(i)||void 0,e.frameRate=Number(o)||void 0,e.hdr=h||void 0,e.videoLayout=p||void 0)}function SS(e,n,i){return Yg(e,lr(n,e.g.retryParameters),0,{type:i?2:3})}function na(e){return e.ca!=X1}function jR(e,n){e.ca=n,e.l&&e.l.pc(!na(e)),na(e)||e.s.stop()}function Yg(e,n,i,o){if(!e.N)throw new fe(2,7,7001);return n=e.i.networkingEngine.request(i,n,o),ai(e.N,n),n.promise}We("shaka.net.DataUriPlugin",bR),bR.parse=ER,Ui("data",ER),(c=Y1.prototype).configure=function(e){this.g=e,this.j&&this.j.configure(this.g)},c.start=function(e,n){var i,o=this;return W(function(h){return h.g==1?(o.i=n,o.A=n.isLowLatencyMode(),N(h,SS(o,[e]),2)):h.g!=3?(i=h.h,o.Y=i.uri,N(h,function(p,g,b){var w,k,I,x,C,D,_,j,F,B,H,Y,te,q,X,he,ae,me,oe,ge,le,Ee,ve,Be,_e,Ye,Ve,be,ke,Ae;return W(function(He){switch(He.g){case 1:return w=hS(p.ya,g),k=Zo(w.g,"EXT-X-DEFINE"),I=[],x=[],C=[],w.type==1?N(He,wR(p,w,te=function(){return[b]}),6):(function(De,$e){for(var je=new mr(De.Y).g,Ge=($e=T($e)).next();!Ge.done;Ge=$e.next()){var Fe=Ge.value;Ge=gt(Fe,"NAME");var rt=gt(Fe,"VALUE");Fe=gt(Fe,"QUERYPARAM"),Ge&&rt&&(De.o.has(Ge)||De.o.set(Ge,rt)),Fe&&(Ge=je.get(Fe)[0])&&!De.o.has(Ge)&&De.o.set(Fe,Ge)}}(p,k),D=Zo(w.g,"EXT-X-MEDIA"),_=Zo(w.g,"EXT-X-STREAM-INF"),j=Zo(w.g,"EXT-X-IMAGE-STREAM-INF"),F=Zo(w.g,"EXT-X-I-FRAME-STREAM-INF"),B=Zo(w.g,"EXT-X-SESSION-KEY"),H=Zo(w.g,"EXT-X-SESSION-DATA"),Y=Zo(w.g,"EXT-X-CONTENT-STEERING"),function(De,$e){for(var je=($e=T($e)).next();!je.done;je=$e.next()){var Ge=je.value,Fe=gt(Ge,"DATA-ID");je=gt(Ge,"URI");var rt=gt(Ge,"LANGUAGE");Ge=gt(Ge,"VALUE"),Fe=new Map().set("id",Fe),je&&Fe.set("uri",mf([De.Y],je,De.o)[0]),rt&&Fe.set("language",rt),Ge&&Fe.set("value",Ge),je=new dt("sessiondata",Fe),De.i&&De.i.onEvent(je)}}(p,H),N(He,function(De,$e){var je,Ge,Fe,rt,Qe,Et;return W(function(et){if(!De.i||!De.g)return et.return();for(Ge=T($e),Fe=Ge.next();!Fe.done;Fe=Ge.next())if(rt=Fe.value,Qe=gt(rt,"PATHWAY-ID"),Et=gt(rt,"SERVER-URI"),Qe&&Et){De.j=new mv(De.i),De.j.configure(De.g),De.j.j=[De.Y],De.j.setManifestType("HLS"),De.j.h=Qe,je=yv(De.j,Et);break}return N(et,je,0)})}(p,Y),4));case 4:return function(De,$e){for(var je=($e=T($e)).next();!je.done;je=$e.next()){var Ge=je.value,Fe=gt(Ge,"AUDIO");je=gt(Ge,"VIDEO");var rt=gt(Ge,"SUBTITLES");if(Ge=kR(De,Ge),rt){var Qe=Li(en,Ge);De.G.set(rt,Qe),Qi(Ge,Qe)}Fe&&((rt=Li("audio",Ge))||(rt=De.g.hls.defaultAudioCodec),De.G.set(Fe,rt)),je&&((Fe=Li("video",Ge))||(Fe=De.g.hls.defaultVideoCodec),De.G.set(je,Fe))}}(p,_),function(De,$e){for(var je=($e=T($e=mR($e,"CLOSED-CAPTIONS"))).next();!je.done;je=$e.next()){var Ge=je.value,Fe=gt(Ge,"LANGUAGE");je=dn(Fe||"und"),Fe||(Fe=gt(Ge,"NAME"))&&(je=Fe),Fe=br(Ge,"GROUP-ID"),Ge=br(Ge,"INSTREAM-ID").replace("SERVICE","svc"),De.F.get(Fe)||De.F.set(Fe,new Map),De.F.get(Fe).set(Ge,je)}}(p,D),I=function(De,$e,je,Ge){var Fe=[],rt=new Set;if(0<je.length)for(var Qe=(je=T(je)).next();!Qe.done;Qe=je.next()){var Et=br(Qe=Qe.value,"METHOD");if(Et!="NONE"&&Et!="AES-128"&&(Et=gt(Qe,"KEYFORMAT")||"identity",Qe=(Et=VR[Et])?Et(Qe,""):null)){if(Qe.keyIds)for(var et=(Et=T(Qe.keyIds)).next();!et.done;et=Et.next())rt.add(et.value);Fe.push(Qe)}}for(je={},$e=T($e),Qe=$e.next();!Qe.done;Qe=$e.next())Qe=Qe.value,Et=fR(Qe),je[Et]?je[Et].push(Qe):je[Et]=[Qe];for(var it in $e=[],je){var Pt=(et=je[it])[0];Qe=gt(Pt,"FRAME-RATE"),Et=Number(gt(Pt,"AVERAGE-BANDWIDTH"))||Number(br(Pt,"BANDWIDTH"));var Yt=gt(Pt,"RESOLUTION"),Zt=T(Yt?Yt.split("x"):[null,null]);Yt=Zt.next().value,Zt=Zt.next().value;var an=gt(Pt,"VIDEO-RANGE");(Pt=gt(Pt,"REQ-VIDEO-LAYOUT"))&&Pt.includes(",")&&(Pt=Pt.split(",").filter(function(_t){return _t=="CH-STEREO"||_t=="CH-MONO"})[0]),Pt=Pt||"CH-MONO",et=jN(De,et,Ge,Et),$e.push.apply($e,M(GN(De,et.audio,et.video,Et,Yt,Zt,Qe,an,Pt,Fe,rt)))}return $e.filter(function(_t){return _t!=null})}(p,_,B,D),x=function(De,$e){var je=mR($e,"SUBTITLES");$e=je.map(function(Qe){if(De.g.disableText)return null;try{return RR(De,[Qe],new Map).stream}catch(Et){if(De.g.hls.ignoreTextStreamFailures)return null;throw Et}});for(var Ge=(je=T(je)).next();!Ge.done;Ge=je.next()){var Fe=br(Ge.value,"GROUP-ID");if((Ge=De.G.get(Fe))&&(Fe=De.H.get(Fe)))for(var rt=(Fe=T(Fe)).next();!rt.done;rt=Fe.next())(rt=rt.value).stream.codecs=Ge,rt.stream.mimeType=ES(en,Ge)||TS(en),Wg(rt.stream)}return $e.filter(function(Qe){return Qe})}(p,D),N(He,function(De,$e,je){var Ge,Fe;return W(function(rt){return rt.g==1?(Ge=$e.map(function(Qe){var Et,et;return W(function(it){if(it.g==1)return De.g.disableThumbnails?it.return(null):(ne(it,2),N(it,function(Pt,Yt){var Zt,an,_t,Bt,tn,yt,at,st,Ct,$t;return W(function(Lt){return Lt.g==1?(Zt=br(Yt,"URI"),an=gt(Yt,"CODECS","jpeg")||"",Pt.h.has(Zt)?Lt.return(Pt.h.get(Zt)):(_t=gt(Yt,"LANGUAGE"),Bt=gt(Yt,"NAME"),tn=gt(Yt,"CHARACTERISTICS"),yt=Q1(Pt,Pt.u++,[Zt],an,"image",_t,!1,Bt,null,null,tn,!1,null,!1),(at=gt(Yt,"RESOLUTION"))?N(Lt,yt.stream.createSegmentIndex(),3):Lt.B(2))):(Lt.g!=2&&(st=yt.stream.segmentIndex.get(0),Ct=st.tilesLayout)&&(yt.stream.width=Number(at.split("x")[0])*Number(Ct.split("x")[0]),yt.stream.height=Number(at.split("x")[1])*Number(Ct.split("x")[1])),($t=gt(Yt,"BANDWIDTH"))&&(yt.stream.bandwidth=Number($t)),Pt.h.set(Zt,yt),Lt.return(yt))})}(De,Qe),4));if(it.g!=2)return Et=it.h,it.return(Et.stream);if(et=we(it),De.g.hls.ignoreImageStreamFailures)return it.return(null);throw et})}).concat(je.map(function(Qe){if(De.g.disableThumbnails)return null;try{var Et=br(Qe,"URI"),et=gt(Qe,"CODECS")||"";if(De.h.has(Et))var it=De.h.get(Et);else{var Pt=gt(Qe,"LANGUAGE"),Yt=gt(Qe,"NAME"),Zt=gt(Qe,"CHARACTERISTICS"),an=Q1(De,De.u++,[Et],et,"image",Pt,!1,Yt,null,null,Zt,!1,null,!1),_t=gt(Qe,"RESOLUTION"),Bt=T(_t?_t.split("x"):[null,null]),tn=Bt.next().value,yt=Bt.next().value;an.stream.width=Number(tn)||void 0,an.stream.height=Number(yt)||void 0;var at=gt(Qe,"BANDWIDTH");at&&(an.stream.bandwidth=Number(at)),De.h.set(Et,an),it=an}return(Qe=it).stream.codecs!=="mjpg"?null:Qe.stream}catch(st){if(De.g.hls.ignoreImageStreamFailures)return null;throw st}})),N(rt,Promise.all(Ge),2)):(Fe=rt.h,rt.return(Fe.filter(function(Qe){return Qe})))})}(p,j,F),5);case 5:C=He.h,He.B(3);break;case 6:return q=He.h,X=q.type,he=q.mimeType,ae=q.codecs,me=q.language,oe=q.height,ge=q.width,le=q.channelCount,Ee=q.sampleRate,ve=q.closedCaptions,N(He,PR(p,p.u++,w,te,b,ae,X,me,!0,"Media Playlist",le,ve,null,!1,Ee,!1,he),7);case 7:Be=He.h,p.h.set(b,Be),X=="video"&&$R(Be.stream,ge,oe,null,null,null),I.push({id:0,language:dn(me||"und"),disabledUntilTime:0,primary:!0,audio:X=="audio"?Be.stream:null,video:X=="video"?Be.stream:null,bandwidth:Be.stream.bandwidth||0,allowedByApplication:!0,allowedByKeySystem:!0,decodingInfos:[]});case 3:if(!p.i)throw new fe(2,7,7001);if(p.l=new Tt(null,0),p.l.pc(!0),w.type==1&&(na(p)&&(FR(p,w),_e=p.m,p.s.U(_e)),Ye=Array.from(p.h.values()),yS(p,Ye),mS(p)),p.C={presentationTimeline:p.l,variants:I,textStreams:x,imageStreams:C,offlineSessionIds:[],minBufferTime:0,sequenceMode:p.g.hls.sequenceMode,ignoreManifestTimestampsInSegmentsMode:p.g.hls.ignoreManifestTimestampsInSegmentsMode,type:"HLS",serviceDescription:null},p.ba||!p.g.hls.disableCodecGuessing){He.B(8);break}for(Ve=[],be=T(p.C.variants),ke=be.next();!ke.done;ke=be.next())(Ae=ke.value).audio&&Ae.audio.codecs===""&&Ve.push(Ae.audio.createSegmentIndex()),Ae.video&&Ae.video.codecs===""&&Ve.push(Ae.video.createSegmentIndex());return N(He,Promise.all(Ve),8);case 8:p.i.makeTextStreamsForClosedCaptions(p.C),re(He)}})}(o,i.data,e),3)):h.return(o.C)})},c.stop=function(){this.s&&(this.s.stop(),this.s=null);var e=[];return this.N&&(e.push(this.N.destroy()),this.N=null),this.g=this.i=null,this.Aa.clear(),this.C=null,this.h.clear(),this.H.clear(),this.G.clear(),this.o.clear(),this.W.clear(),this.j&&this.j.destroy(),Promise.all(e)},c.update=function(){var e,n,i,o,h,p,g,b,w=this;return W(function(k){if(k.g==1){if(!na(w))return k.return();for(e=[],n=Array.from(w.h.values()),w.m=1/0,i=n.filter(function(I){return I.stream.segmentIndex}),o=T(i),h=o.next();!h.done;h=o.next())p=h.value,e.push($N(w,p));return N(k,Promise.all(e),2)}DR(w,i.map(function(I){return I.stream})),g=i.some(function(I){return I.Uc==0}),i.length&&!g&&(jR(w,VN.Ag),b=i.map(function(I){return I.pb}),w.l.Pa(Math.min.apply(Math,M(b))),w.i.updateDuration()),g&&mS(w),re(k)})},c.onExpirationUpdated=function(){},c.onInitialVariantChosen=function(){},c.banLocation=function(e){this.j&&this.j.i.set(e,Date.now()+6e4)},We("shaka.hls.HlsParser",Y1);var GR={aac:"audio/aac",ac3:"audio/ac3",ec3:"audio/ec3",mp3:"audio/mpeg"},HR={audio:{mp4:"audio/mp4",mp4a:"audio/mp4",m4s:"audio/mp4",m4i:"audio/mp4",m4a:"audio/mp4",m4f:"audio/mp4",cmfa:"audio/mp4",ts:"video/mp2t",tsa:"video/mp2t"},video:{mp4:"video/mp4",mp4v:"video/mp4",m4s:"video/mp4",m4i:"video/mp4",m4v:"video/mp4",m4f:"video/mp4",cmfv:"video/mp4",ts:"video/mp2t",tsv:"video/mp2t"},text:{mp4:"application/mp4",m4s:"application/mp4",m4i:"application/mp4",m4f:"application/mp4",cmft:"application/mp4",vtt:"text/vtt",webvtt:"text/vtt",ttml:"application/ttml+xml"},image:{jpg:"image/jpeg",png:"image/png",svg:"image/svg+xml",webp:"image/webp",avif:"image/avif"}},VR={"com.apple.streamingkeydelivery":function(e,n){if(n=="video/mp2t")throw new fe(2,4,4040);if(s.shakaMediaKeysPolyfill)throw new fe(2,4,4041);return Al("com.apple.fps",[{initDataType:"sinf",initData:new Uint8Array(0),keyId:null}])},"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(e){var n=br(e,"METHOD");return["SAMPLE-AES","SAMPLE-AES-CTR"].includes(n)?(n=Al("com.widevine.alpha",[{initDataType:"cenc",initData:n=Nt((n=pS(n=br(e,"URI"))).data)}]),(e=gt(e,"KEYID"))&&(n.keyIds=new Set([e.toLowerCase().substr(2)])),n):null},"com.microsoft.playready":function(e){var n=br(e,"METHOD");return["SAMPLE-AES","SAMPLE-AES-CTR"].includes(n)?Al("com.microsoft.playready",[{initDataType:"cenc",initData:e=ba(e=Nt((e=pS(e=br(e,"URI"))).data),n=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]),new Set,0)}]):null},identity:function(e,n){if(n=="video/mp2t")throw new fe(2,4,4040);if(s.shakaMediaKeysPolyfill)throw new fe(2,4,4041);return e=br(e,"METHOD"),["SAMPLE-AES","SAMPLE-AES-CTR"].includes(e)?Al("org.w3.clearkey",null):null}},X1="VOD",KR="EVENT",J1="LIVE",VN={Ag:X1,pi:KR,yi:J1};function Z1(e){if(e=zR(e))e:{for(var n=(e=T(e.getElementsByTagName("DATA"))).next();!n.done;n=e.next())if(n=zr(n.value,"LA_URL")){e=n.textContent;break e}e=""}else e="";return e}function zR(e){return(e=function(n){var i=0,o=Nr(n),h=o.getUint32(i,!0);if(h!=n.byteLength)return[];e:{for(n=i+6,i=[];n<o.byteLength-1;){h=o.getUint16(n,!0),n+=2;var p=o.getUint16(n,!0);if(n+=2,1&p||p+n>o.byteLength){o=[];break e}var g=Nt(o,n,p);i.push({type:h,value:g}),n+=p}o=i}return o}(e=ns(e.textContent)).filter(function(n){return n.type===KN})[0])&&(e=Ou(e=ws(e.value,!0),"WRMHEADER"))?e:null}ks["application/x-mpegurl"]=function(){return new Y1},ks["application/vnd.apple.mpegurl"]=function(){return new Y1};var KN=1,zN=new Map().set("com.microsoft.playready",Z1).set("com.microsoft.playready.recommendation",Z1).set("com.microsoft.playready.software",Z1).set("com.microsoft.playready.hardware",Z1);function Qg(e){if(!QR){QR=!0;var n=new Uint8Array([105,115,111,109]),i=new Uint8Array([97,118,99,49]),o=new Uint8Array([0,0,0,1]);tb=Jt("ftyp",n,o,n,i),n=Jt("dref",r_),wS=Jt("dinf",n)}this.g=e}function Xg(e){for(var n=[],i=T(e.g),o=i.next();!o.done;o=i.next()){var h=n,p=h.push,g=o.value;o=Jt;var b=g.id+1,w=g.stream.width||0,k=g.stream.height||0;g.type=="audio"&&(k=w=0);var I=g.duration*g.timescale,x=Math.floor(I/(_d+1));switch(I=Math.floor(I%(_d+1)),b=Jt("tkhd",b=new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3].concat(M(tr(b,4)),[0,0,0,0],M(tr(x,4)),M(tr(I,4)),[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],M(tr(w,2)),[0,0],M(tr(k,2)),[0,0]))),w=Jt,x=g.duration*g.timescale,k=Math.floor(x/(_d+1)),x=Math.floor(x%(_d+1)),I=(I=g.stream.language).charCodeAt(0)-96<<10|I.charCodeAt(1)-96<<5|I.charCodeAt(2)-96,k=Jt("mdhd",k=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3].concat(M(tr(g.timescale,4)),M(tr(k,4)),M(tr(x,4)),M(tr(I,2)),[0,0]))),x=g,I=new Uint8Array([]),x.type){case"video":I=WN;break;case"audio":I=YN}x=Jt("hdlr",I);e:{switch(g.type){case"video":g=Jt("minf",Jt("vmhd",e_),wS,qR(g));break e;case"audio":g=Jt("minf",Jt("smhd",t_),wS,qR(g));break e}g=new Uint8Array([])}o=o("trak",b,g=w("mdia",k,x,g)),p.call(h,o)}for(n=$n.apply(Kr,M(n)),i=Jt,o=(p=e.g[0]).duration*p.timescale,h=Math.floor(o/(_d+1)),o=Math.floor(o%(_d+1)),h=Jt("mvhd",h=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3].concat(M(tr(p.timescale,4)),M(tr(h,4)),M(tr(o,4)),[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]))),o=[],w=(e=T(e.g)).next();!w.done;w=e.next())b=(g=o).push,w=Jt("trex",w=new Uint8Array([0,0,0,0].concat(M(tr(w.value.id+1,4)),[0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))),b.call(g,w);if(e=Jt("mvex",e=$n.apply(Kr,M(o))),o=[],p.encrypted){for(g=(p=T(p.stream.drmInfos)).next();!g.done;g=p.next())if((g=g.value).initData)for(b=(g=T(g.initData)).next();!b.done;b=g.next())o.push(b.value.initData);p=$n.apply(Kr,M(o))}else p=new Uint8Array([]);return e=i("moov",h,n,e,p),(n=new Uint8Array(tb.byteLength+e.byteLength)).set(tb),n.set(e,tb.byteLength),n}function qR(e){var n=Jt,i=new Uint8Array([]);switch(e.type){case"video":if(e.codecs.includes("avc1")){i=e.stream.width||0;var o=e.stream.height||0;if(0<e.la.byteLength)var h=Jt("avcC",e.la);else{h=Jt;for(var p=7,g=[],b=[],w=0,k=0,I=0,x=0;x<e.Ta.length;x++){var C=YR(e.Ta[x]);switch(31&C[0]){case 7:g.push(C),p+=C.length+2;break;case 8:b.push(C),p+=C.length+2}}for(0<g.length&&(w=g[0][1],I=g[0][2],k=g[0][3]),x=0,(p=new Uint8Array(p))[x++]=1,p[x++]=w,p[x++]=I,p[x++]=k,p[x++]=255,p[x++]=224|g.length,w=0;w<g.length;w++)p[x++]=(65280&g[w].length)>>8,p[x++]=255&g[w].length,p.set(g[w],x),x+=g[w].length;for(p[x++]=b.length,g=0;g<b.length;g++)p[x++]=(65280&b[g].length)>>8,p[x++]=255&b[g].length,p.set(b[g],x),x+=b[g].length;h=h("avcC",p)}i=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].concat(M(tr(i,2)),M(tr(o,2)),[0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17])),o="avc1",b=WR(e),g=new Uint8Array([]),e.encrypted&&(g=Av(e),o="encv"),i=Jt(o,i,h,b,g)}else e.codecs.includes("hvc1")&&(o=e.stream.width||0,h=e.stream.height||0,i=new Uint8Array([]),0<e.la.byteLength&&(i=Jt("hvcC",e.la)),o=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].concat(M(tr(o,2)),M(tr(h,2)),[0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17])),h="hvc1",b=WR(e),g=new Uint8Array([]),e.encrypted&&(g=Av(e),h="encv"),i=Jt(h,o,i,b,g));break;case"audio":e.codecs.includes("mp3")?e=Jt(".mp3",eb(e)):e.codecs.includes("ac-3")?(i=Jt("dac3",e.da),o="ac-3",h=new Uint8Array([]),e.encrypted&&(h=Av(e),o="enca"),e=Jt(o,eb(e),i,h)):e.codecs.includes("ec-3")?(i=Jt("dec3",e.da),o="ec-3",h=new Uint8Array([]),e.encrypted&&(h=Av(e),o="enca"),e=Jt(o,eb(e),i,h)):(0<e.da.byteLength?i=Jt("esds",e.da):(i=Jt,o=e.id+1,h=e.stream.channelsCount||2,g=e.stream.audioSamplingRate||44100,w=vu("audio",e.codecs.split(",")),b=(k={96e3:0,88200:1,64e3:2,48e3:3,44100:4,32e3:5,24e3:6,22050:7,16e3:8,12e3:9,11025:10,8e3:11,7350:12})[g],w!=="mp4a.40.5"&&w!=="mp4a.40.29"||(b=k[2*g]),g=parseInt(w.split(".").pop(),10),i=i("esds",o=new Uint8Array([0,0,0,0,3,25].concat(M(tr(o,2)),[0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2,g<<3|b>>>1,b<<7|h<<3,6,1,2])))),o="mp4a",h=new Uint8Array([]),e.encrypted&&(h=Av(e),o="enca"),e=Jt(o,eb(e),i,h)),i=e}return n("stbl",e=Jt("stsd",n_,i),Jt("stts",QN),Jt("stsc",XN),Jt("stsz",ZN),Jt("stco",JN))}function WR(e){if(!e.qa&&!e.sa)return new Uint8Array([]);var n=e.sa;return Jt("pasp",e=new Uint8Array([].concat(M(tr(e.qa,4)),M(tr(n,4)))))}function eb(e){return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.stream.channelsCount||2,0,16,0,0,0,0].concat(M(tr(e.stream.audioSamplingRate||44100,2)),[0,0]))}function Av(e){for(var n=Jt,i=e.codecs.substring(0,e.codecs.indexOf(".")),o=0,h=0;h<i.length;h+=1)o|=i.charCodeAt(h)<<8*(i.length-h-1);i=Jt("frma",i=new Uint8Array([].concat(M(tr(o,4))))),o=Jt("schm",o=new Uint8Array([0,0,0,0,99,101,110,99,0,1,0,0])),h=Jt;for(var p=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),g=(e=T(e.stream.drmInfos)).next();!g.done;g=e.next())if((g=g.value)&&g.keyIds&&g.keyIds.size)for(var b=(g=T(g.keyIds)).next();!b.done;b=g.next())p=YR(b.value);return n("sinf",i,o,h("schi",p=Jt("tenc",e=new Uint8Array([0,0,0,0,0,0,1,8]),p)))}function kv(e){for(var n=[],i=(e=T(e.g)).next();!i.done;i=e.next()){i=i.value;var o,h=n.push,p=h.apply,g=Jt,b=new Uint8Array([0,0,0,0].concat(M(tr(i.data?i.data.hb:0,4))));b=Jt("mfhd",b);var w=i.data?i.data.Oa:[],k=new Uint8Array(4+w.length);for(o=0;o<w.length;o++){var I=w[o].flags;k[o+4]=I.Ia<<4|I.La<<2|I.Ja}var x=(w=Jt("sdtp",k)).length+92;k=Jt,o=Jt("tfhd",o=new Uint8Array([0,0,0,58].concat(M(tr(i.id+1,4)),[0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0]))),I=i.data?i.data.baseMediaDecodeTime:0;var C=Math.floor(I%(_d+1));I=Jt("tfdt",I=new Uint8Array([1,0,0,0].concat(M(tr(Math.floor(I/(_d+1)),4)),M(tr(C,4)))));var D=x,_=12+16*(C=(x=i.data?i.data.Oa:[]).length),j=new Uint8Array(_);for(D+=8+_,j.set([i.type==="video"?1:0,0,15,1].concat(M(tr(C,4)),M(tr(D,4))),0),D=0;D<C;D++){var F=x[D];_=tr(F.duration,4);var B=tr(F.size,4),H=F.flags;F=tr(F.Ua,4),j.set([].concat(M(_),M(B),[H.Va<<2|H.Ia,H.La<<6|H.Ja<<4|H.Wa,61440&H.Ha,15&H.Ha],M(F)),12+16*D)}g=g("moof",b,w=k("traf",o,I,x=Jt("trun",j),w)),p.call(h,n,[g,qN(i)])}return $n.apply(Kr,M(n))}function qN(e){return e=(e.data?e.data.Oa:[]).map(function(n){return n.data}),Jt("mdat",e=$n.apply(Kr,M(e)))}function tr(e,n){var i=[];for(--n;0<=n;n--)i.push(e>>8*n&255);return i}function YR(e){for(var n=new Uint8Array(e.length/2),i=0;i<e.length/2;i+=1)n[i]=parseInt(String(e[2*i]+e[2*i+1]),16);return n}function Jt(e){var n=Ke.apply(1,arguments),i=XR[e];i||(i=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)],XR[e]=i);for(var o=8,h=n.length-1;0<=h;h--)o+=n[h].byteLength;for((h=new Uint8Array(o))[0]=o>>24&255,h[1]=o>>16&255,h[2]=o>>8&255,h[3]=255&o,h.set(i,4),i=0,o=8;i<n.length;i++)h.set(n[i],o),o+=n[i].byteLength;return h}var QR=!1,_d=Math.pow(2,32)-1,XR={},WN=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),YN=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),QN=new Uint8Array([0,0,0,0,0,0,0,0]),XN=new Uint8Array([0,0,0,0,0,0,0,0]),JN=new Uint8Array([0,0,0,0,0,0,0,0]),ZN=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e_=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),t_=new Uint8Array([0,0,0,0,0,0,0,0]),n_=new Uint8Array([0,0,0,0,0,0,0,1]),tb=new Uint8Array([]),r_=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),wS=new Uint8Array([]);function AS(){var e=this;this.h=this.g=null,this.l=[],this.j=null,this.s=1,this.i=null,this.A=new bt(5),this.o=new Qt(function(){(function(n){var i;W(function(o){switch(o.g){case 1:return ne(o,2),N(o,kS(n),4);case 4:ce(o,3);break;case 2:i=we(o),n.h&&(i.severity=1,n.h.onError(i));case 3:if(!n.h)return o.return();re(o)}})})(e)}),this.u=new Do,this.m=new Map}function kS(e){var n,i,o,h,p,g,b;return W(function(w){if(w.g==1)return n=lr(e.l,e.g.retryParameters),i=e.h.networkingEngine,o=Date.now(),h=i.request(0,n,{type:5}),ai(e.u,h),N(w,h.promise,2);if(p=w.h,!e.h)return w.return();p.uri&&!e.l.includes(p.uri)&&e.l.unshift(p.uri);var k=p.uri,I=Za(p.data,"SmoothStreamingMedia");if(!I)throw new fe(2,4,4046,k);if((k=e.g.mss.manifestPreprocessor)&&k(I),e.i||(e.i=new Tt(null,0)),k=Vt(I,"IsLive",Rh,!1))throw new fe(2,4,4047);e.i.pc(!k);var x=Vt(I,"TimeScale",vi,1e7),C=Vt(I,"DVRWindowLength",vi);k&&(C===0||isNaN(C))&&(C=1/0);var D,_=Vt(I,"CanSeek",Rh,!1);for(C===0&&_&&(C=1/0),_=null,C&&0<C&&(_=C/x),k&&!isNaN(e.g.availabilityWindowOverride)&&(_=e.g.availabilityWindowOverride),_==null&&(_=1/0),e.i.Yd(_),C=Vt(I,"Duration",vi,1/0),k||e.i.Pa(C/x),k={variants:[],textStreams:[],timescale:x,duration:C/x},_=jn(I,"Protection"),x=e.g.mss.keySystemsBySystemId,C=[],D=(_=T(_)).next();!D.done;D=_.next())C=C.concat(jn(D.value,"ProtectionHeader"));if(C.length){for(_=[],D=0;D<C.length;D++){var j=C[D],F=j.getAttribute("SystemID").toLowerCase(),B=x[F];if(B){var H=zR(j);if(H)e:{for(var Y=(H=T(H.getElementsByTagName("DATA"))).next();!Y.done;Y=H.next())if(Y=zr(Y.value,"KID")){H=ns(Y.textContent),H=rs(H=new Uint8Array([H[3],H[2],H[1],H[0],H[5],H[4],H[7],H[6]].concat(M(H.slice(8)))));break e}H=null}else H=null;F=Al(B,F=[{initData:ba(Y=ns(j.textContent),F=oi(F.replace(/-/g,"")),new Set,0),initDataType:"cenc",keyId:H}]),H&&F.keyIds.add(H),(B=zN.get(B))&&(F.licenseServerUri=B(j)),_.push(F)}}x=_}else x=[];for(D=x,_=[],x=[],C=[],j=(I=T(I=jn(I,"StreamIndex"))).next();!j.done;j=I.next()){B=jn(j=j.value,"QualityLevel"),F=k.timescale,H=k.duration,Y=jn(j,"c");for(var te=[],q=0,X=0;X<Y.length;++X){var he=Y[X],ae=Y[X+1],me=Vt(he,"t",vi),oe=Vt(he,"d",vi);if(he=Vt(he,"r",Qa),!oe)break;if(me=me??q,0>(he=he||0))if(ae){if((ae=Vt(ae,"t",vi))==null||me>=ae)break;he=Math.ceil((ae-me)/oe)-1}else{if(H==1/0||me/F>=H)break;he=Math.ceil((H*F-me)/oe)-1}for(ae=0;ae<=he;++ae)q=me+oe,te.push({start:me/F,end:q/F,zf:me}),me=q}for(F=te,H=(B=T(B)).next();!H.done;H=B.next())(H=i_(e,j,H.value,F,D,k))&&(H.type!="audio"||e.g.disableAudio?H.type!="video"||e.g.disableVideo?H.type!=en||e.g.disableText||C.push(H):x.push(H):_.push(H))}for(I=[],D=(_=T(0<_.length?_:[null])).next();!D.done;D=_.next())for(D=D.value,H=(j=T(0<x.length?x:[null])).next();!H.done;H=j.next())F=(B=I).push,H=H.value,Y=0,D&&D.bandwidth&&0<D.bandwidth&&(Y+=D.bandwidth),H&&H.bandwidth&&0<H.bandwidth&&(Y+=H.bandwidth),H={id:e.s++,language:D?D.language:"und",disabledUntilTime:0,primary:!!D&&D.primary||!!H&&H.primary,audio:D,video:H,bandwidth:Y,allowedByApplication:!0,allowedByKeySystem:!0,decodingInfos:[]},F.call(B,H);k.variants=I,k.textStreams=C,e.j?(e.j.variants=k.variants,e.j.textStreams=k.textStreams,e.h.filter(e.j)):(e.j={presentationTimeline:e.i,variants:k.variants,textStreams:k.textStreams,imageStreams:[],offlineSessionIds:[],minBufferTime:0,sequenceMode:e.g.mss.sequenceMode,ignoreManifestTimestampsInSegmentsMode:!1,type:"MSS",serviceDescription:null},e.i.Od()),Promise.resolve(),g=Date.now(),b=(g-o)/1e3,e.A.sample(1,b),re(w)})}function i_(e,n,i,o,h,p){var g=n.getAttribute("Type");if(g!=="audio"&&g!=="video"&&g!=="text")return Rt("Ignoring unrecognized type:",g),null;var b=n.getAttribute("Language"),w=e.s++,k=Vt(i,"Bitrate",Xa),I=Vt(i,"MaxWidth",Xa),x=Vt(i,"MaxHeight",Xa),C=Vt(i,"Channels",Xa),D=Vt(i,"SamplingRate",Xa),_=p.duration;o.length&&(_=o[o.length-1].end-o[0].start);var j=e.i.getDuration();e.i.Pa(Math.min(_,j));var F={id:w,originalId:n.getAttribute("Name")||String(w),groupId:null,createSegmentIndex:function(){return Promise.resolve()},closeSegmentIndex:function(){return Promise.resolve()},segmentIndex:null,mimeType:"",codecs:"",frameRate:void 0,pixelAspectRatio:void 0,bandwidth:k||0,width:I||void 0,height:x||void 0,kind:"",encrypted:0<h.length,drmInfos:h,keyIds:new Set,language:dn(b||"und"),originalLanguage:b,label:"",type:"",primary:!1,trickModeVideo:null,emsgSchemeIdUris:[],roles:[],forced:!1,channelsCount:C,audioSamplingRate:D,spatialAudio:!1,closedCaptions:null,hdr:void 0,videoLayout:void 0,tilesLayout:void 0,matchedStreams:[],mssPrivateData:{duration:_,timescale:p.timescale,codecPrivateData:null},accessibilityPurpose:null,external:!1,fastSwitching:!1,fullMimeTypes:new Set};if((h=n.getAttribute("Subtype"))&&((h=a_[h])&&F.roles.push(h),h==="main"&&(F.primary=!0)),(h=i.getAttribute("FourCC"))!==null&&h!==""||(h=n.getAttribute("FourCC")),!h){if(g==="audio")h="AAC";else if(g==="video")return Rt('FourCC is not defined whereas it is required for a QualityLevel element for a StreamIndex of type "video"'),null}if(!s_.includes(h.toUpperCase()))return Rt("Codec not supported:",h),null;switch(i=function(B,H,Y,te){if(B=B.getAttribute("CodecPrivateData"))return B;if(H!=="audio")return null;H=te.channelsCount||2,B=te.audioSamplingRate||44100;var q={96e3:0,88200:1,64e3:2,48e3:3,44100:4,32e3:5,24e3:6,22050:7,16e3:8,12e3:9,11025:10,8e3:11,7350:12};return te=q[B],Y==="AACH"?(Y=new Uint8Array(4),B=q[2*B],Y[0]=40|te>>1,Y[1]=te<<7|H<<3|B>>1,Y[2]=B<<7|8,Y[3]=0,(H=new Uint16Array(2))[0]=(Y[0]<<8)+Y[1],H[1]=(Y[2]<<8)+Y[3],H[0].toString(16)+H[1].toString(16)):((Y=new Uint8Array(2))[0]=16|te>>1,Y[1]=te<<7|H<<3,(H=new Uint16Array(1))[0]=(Y[0]<<8)+Y[1],H[0].toString(16))}(i,g,h,F),F.mssPrivateData.codecPrivateData=i,g){case"audio":if(!i)return Rt("Quality unsupported without CodecPrivateData",g),null;F.type="audio",F.mimeType="mss/audio/mp4",F.codecs=function(B,H){var Y=0;return B==="AACH"&&(Y=5),H?Y===0&&(Y=(248&parseInt(H.substr(0,2),16))>>3):(Y=2,B==="AACH"&&(Y=5)),"mp4a.40."+Y}(h,i);break;case"video":if(!i)return Rt("Quality unsupported without CodecPrivateData",g),null;F.type="video",F.mimeType="mss/video/mp4",F.codecs=function(B){var H=/00000001[0-9]7/.exec(B);return H.length&&B?"avc1."+B.substr(B.indexOf(H[0])+10,6):""}(i);break;case"text":F.type=en,F.mimeType="application/mp4",(h==="TTML"||h==="DFXP")&&(F.codecs="stpp")}return F.fullMimeTypes.add(Er(F.mimeType,F.codecs)),F.createSegmentIndex=function(){if(F.segmentIndex)return Promise.resolve();if(e.m.has(F.id))var B=e.m.get(F.id);else B=[],F.type=="video"&&(B=F.mssPrivateData.codecPrivateData.split("00000001").slice(1)),B=Xg(new Qg([B={id:F.id,type:F.type,codecs:F.codecs,encrypted:F.encrypted,timescale:F.mssPrivateData.timescale,duration:F.mssPrivateData.duration,Ta:B,da:new Uint8Array([]),la:new Uint8Array([]),qa:0,sa:0,data:null,stream:F}])),e.m.set(F.id,B);return B=function(H,Y,te,q,X){var he=q.getAttribute("Url").replace("{bitrate}",String(te.bandwidth));q=[];for(var ae={},me=(X=T(X)).next();!me.done;ae={Dc:ae.Dc},me=X.next())ae.Dc=me.value,q.push(new wt(ae.Dc.start,ae.Dc.end,function(oe){return function(){return Rr(H.l,[he.replace("{start time}",String(oe.Dc.zf))])}}(ae),0,null,Y,0,0,te.mssPrivateData.duration));return q}(e,new is(function(){return[]},0,null,null,void 0,B),F,n,o),F.segmentIndex=new Xt(B),Promise.resolve()},F.closeSegmentIndex=function(){F.segmentIndex&&(F.segmentIndex.release(),F.segmentIndex=null)},F}(c=AS.prototype).configure=function(e){this.g=e},c.start=function(e,n){var i=this;return W(function(o){if(o.g==1)return i.l=[e],i.h=n,N(o,kS(i),2);if(!i.h)throw new fe(2,7,7001);return o.return(i.j)})},c.stop=function(){return this.g=this.h=null,this.l=[],this.j=null,this.o!=null&&(this.o.stop(),this.o=null),this.m.clear(),this.u.destroy()},c.update=function(){var e,n=this;return W(function(i){return i.g==1?(ne(i,2),N(i,kS(n),4)):i.g!=2?ce(i,0):(e=we(i),n.h&&e?(n.h.onError(e),void re(i)):i.return())})},c.onExpirationUpdated=function(){},c.onInitialVariantChosen=function(){},c.banLocation=function(){},We("shaka.mss.MssParser",AS);var s_="AAC AACL AACH AACP AVC1 H264 TTML DFXP".split(" "),a_={CAPT:"main",SUBT:"alternate",DESC:"main"};function JR(e,n,i,o,h,p){if(200<=i&&299>=i&&i!=202)return{uri:h||o,originalUri:o,data:n,status:i,headers:e,fromCache:!!e["x-shaka-from-cache"]};h=null;try{h=qs(n)}catch{}throw new fe(i==401||i==403?2:1,1,1001,o,i,h,e,p)}function xS(){}function nb(e,n,i,o,h){var p=new c_;va(n.headers).forEach(function(k,I){p.append(I,k)});var g=new l_,b={Ff:!1,ug:!1};if(e=function(k,I,x,C,D,_,j){var F,B,H,Y,te,q,X,he,ae,me,oe,ge;return W(function(le){switch(le.g){case 1:return F=o_,B=u_,q=te=0,X=Date.now(),ne(le,2),N(le,F(k,x),4);case 4:if(H=le.h,_(ZR(H.headers)),x.method=="HEAD"){le.B(5);break}return he=H.clone().body.getReader(),me=(ae=H.headers.get("Content-Length"))?parseInt(ae,10):0,new B({start:function(Ee){function ve(){var Be,_e,Ye;return W(function(Ve){switch(Ve.g){case 1:return ne(Ve,2),N(Ve,he.read(),4);case 4:Be=Ve.h,ce(Ve,3);break;case 2:return we(Ve),Ve.return();case 3:if(Be.done){Ve.B(5);break}if(te+=Be.value.byteLength,!j){Ve.B(5);break}return N(Ve,j(Be.value),5);case 5:(100<(_e=Date.now())-X||Be.done)&&(Ye=Be.done?0:me-te,D(_e-X,te-q,Ye),q=te,X=_e),Be.done?Ee.close():(Ee.enqueue(Be.value),ve()),re(Ve)}})}ve()}}),N(le,H.arrayBuffer(),6);case 6:Y=le.h;case 5:ce(le,3);break;case 2:throw oe=we(le),C.Ff?new fe(1,1,7001,k,I):C.ug?new fe(1,1,1003,k,I):new fe(1,1,1002,k,oe,I);case 3:return ge=ZR(H.headers),le.return(JR(ge,Y,H.status,k,H.url,I))}})}(e,i,{body:n.body||void 0,headers:p,method:n.method,signal:g.signal,credentials:n.allowCrossSiteCredentials?"include":void 0},b,o,h,n.streamDataCallback),e=new or(e,function(){return b.Ff=!0,g.abort(),Promise.resolve()}),n=n.retryParameters.timeout){var w=new Qt(function(){b.ug=!0,g.abort()});w.U(n/1e3),e.finally(function(){w.stop()})}return e}function ZR(e){var n={};return e.forEach(function(i,o){n[o.trim()]=i}),n}function eC(){if(!s.ReadableStream)return!1;try{new ReadableStream({})}catch{return!1}return!!s.Response&&!!new Response("").body&&!(!s.fetch||!s.AbortController)}ks["application/vnd.ms-sstr+xml"]=function(){return new AS},We("shaka.net.HttpFetchPlugin",xS),xS.isSupported=eC,xS.parse=nb;var o_=s.fetch,l_=s.AbortController,u_=s.ReadableStream,c_=s.Headers;function tC(){}function rb(e,n,i,o,h){var p=new d_,g=Date.now(),b=0;return new or(new Promise(function(w,k){p.open(n.method,e,!0),p.responseType="arraybuffer",p.timeout=n.retryParameters.timeout,p.withCredentials=n.allowCrossSiteCredentials,p.onabort=function(){k(new fe(1,1,7001,e,i))};var I=!1;for(var x in p.onreadystatechange=function(){if(p.readyState==2&&!I){var C=nC(p);h(C),I=!0}},p.onload=function(C){var D=nC(p),_=p.response;try{o(Date.now()-g,C.loaded-b,0);var j=JR(D,_,p.status,e,p.responseURL,i);w(j)}catch(F){k(F)}},p.onerror=function(C){k(new fe(1,1,1002,e,C,i))},p.ontimeout=function(){k(new fe(1,1,1003,e,i))},p.onprogress=function(C){var D=Date.now();(100<D-g||C.lengthComputable&&C.loaded==C.total)&&(o(D-g,C.loaded-b,p.readyState==4?0:C.total-C.loaded),b=C.loaded,g=D)},n.headers)p.setRequestHeader(x.toLowerCase(),n.headers[x]);p.send(n.body)}),function(){return p.abort(),Promise.resolve()})}function nC(e){var n=e.getAllResponseHeaders().trim().split(`\r
`);e={};for(var i=(n=T(n)).next();!i.done;i=n.next())e[(i=i.value.split(": "))[0].toLowerCase()]=i.slice(1).join(": ");return e}eC()&&(Ui("http",nb,2,!0),Ui("https",nb,2,!0),Ui("blob",nb,2,!0)),We("shaka.net.HttpXHRPlugin",tC),tC.parse=rb;var d_=s.XMLHttpRequest;function rC(e,n,i,o){this.g=e,this.i=n,this.groupId=i,this.h=o}function IS(e){return e.Z().map(function(n){return"{"+encodeURI(n)+"}"}).join("")+":"+e.Qa+":"+e.ua}function h_(e,n){return pd(e.g.Z(),e.g.Qa,e.g.ua,n.streaming.retryParameters)}function iC(){this.h=this.j=this.i=0,this.g=new Map,this.l=0}function sC(e,n){e.i+=n;var i=e.l;return e.l++,e.g.set(i,n),i}function aC(e){var n=this;this.o=e,this.j=new Map,this.i=new Ln(function(){return LS(n).catch(function(){})}),this.h=[],this.m=function(){},this.l=function(){},this.g=new iC}function LS(e){var n=e.h.map(function(i){return i()});return e.h=[],Promise.all(n)}function f_(e,n,i,o,h,p){rn(e.i);var g=(e.j.get(n)||Promise.resolve()).then(function(){var b,w,k,I,x,C,D;return W(function(_){if(_.g==1)return N(_,function(F,B){var H,Y,te,q;return W(function(X){return X.g==1?(H=Ks,Y=F.o.request(H,B),te=function(){return Y.abort()},F.h.push(te),N(X,Y.promise,2)):(q=X.h,Qi(F.h,te),X.return(q.data))})}(e,i),2);if(b=_.h,e.i.g)throw new fe(2,9,7001);if(h)for(I in w=Nt(b),(k=new hy(w)).data)x=Number(I),C=k.data[x],D=k.g[x],e.l(C,D);e.g.close(o,b.byteLength);var j=e.g;return e.m(j.i==0?0:j.j/j.i,e.g.h),_.return(p(b))})});e.j.set(n,g)}function ib(e,n){var i=this;this.i=e,this.h=e.objectStore(n),this.g=new Pn,e.onabort=function(o){o.preventDefault(),i.g.reject()},e.onerror=function(o){o.preventDefault(),i.g.reject()},e.oncomplete=function(){i.g.resolve()}}function RS(e,n){return new Promise(function(i,o){var h=e.h.openCursor();h.onerror=o,h.onsuccess=function(){var p;return W(function(g){if(g.g==1)return h.result==null?(i(),g.return()):(p=h.result,N(g,n(p.key,p.value,p),2));p.continue(),re(g)})}})}function CS(e){this.h=e,this.g=[]}function bf(e,n){return sb(e,n,"readwrite")}function sb(e,n,i){var o=new ib(i=e.h.transaction([n],i),n);return e.g.push(o),o.promise().then(function(){Qi(e.g,o)},function(){Qi(e.g,o)}),o}function Ef(e,n,i){this.h=new CS(e),this.i=n,this.g=i}function oC(e){return Promise.reject(new fe(2,9,9011,"Cannot add new value to "+e))}function lC(e,n,i,o){n=(e=bf(e.h,n)).store();for(var h={},p=(i=T(i)).next();!p.done;h={ld:h.ld},p=i.next())h.ld=p.value,n.delete(h.ld).onsuccess=function(g){return function(){return o(g.ld)}}(h);return e.promise()}function uC(e,n,i){var o,h,p,g,b,w,k;return W(function(I){if(I.g==1){for(o=sb(e.h,n,"readonly"),h=o.store(),p={},g=[],b={},w=T(i),k=w.next();!k.done;b={Bc:b.Bc,zc:b.zc},k=w.next())b.zc=k.value,b.Bc=h.get(b.zc),b.Bc.onsuccess=function(x){return function(){x.Bc.result==null&&g.push(x.zc),p[x.zc]=x.Bc.result}}(b);return N(I,o.promise(),2)}if(g.length)throw new fe(2,9,9012,"Could not find values for "+g);return I.return(i.map(function(x){return p[x]}))})}function xv(e){this.g=new CS(e)}function ps(){this.g=new Map}function cC(e){var n=null;if(e.g.forEach(function(i,o){i.getCells().forEach(function(h,p){h.hasFixedKeySpace()||n||(n={path:{Xa:o,ta:p},ta:h})})}),n)return n;throw new fe(2,9,9013,"Could not find a cell that supports add-operations")}function ab(e,n,i){if(!(e=e.g.get(n)))throw new fe(2,9,9013,"Could not find mechanism with name "+n);if(!(n=e.getCells().get(i)))throw new fe(2,9,9013,"Could not find cell with name "+i);return n}function dC(e,n){Iv.set(e,n)}Ui("http",rb,1,!0),Ui("https",rb,1,!0),Ui("blob",rb,1,!0),iC.prototype.close=function(e,n){if(this.g.has(e)){var i=this.g.get(e);this.g.delete(e),this.j+=i,this.h+=n}},aC.prototype.destroy=function(){return this.i.destroy()},ib.prototype.abort=function(){var e=this;return W(function(n){if(n.g==1){try{e.i.abort()}catch{}return ne(n,2),N(n,e.g,4)}if(n.g!=2)return ce(n,0);we(n),re(n)})},ib.prototype.store=function(){return this.h},ib.prototype.promise=function(){return this.g},CS.prototype.destroy=function(){return Promise.all(this.g.map(function(e){return e.abort()}))},(c=Ef.prototype).destroy=function(){return this.h.destroy()},c.hasFixedKeySpace=function(){return!0},c.addSegments=function(){return oC(this.i)},c.removeSegments=function(e,n){return lC(this,this.i,e,n)},c.getSegments=function(e){var n,i=this;return W(function(o){return o.g==1?N(o,uC(i,i.i,e),2):(n=o.h,o.return(n.map(function(h){return i.Hf(h)})))})},c.addManifests=function(){return oC(this.g)},c.updateManifest=function(){return Promise.reject(new fe(2,9,9016,"Cannot modify values in "+this.g))},c.updateManifestExpiration=function(e,n){var i=bf(this.h,this.g),o=i.store();return o.get(e).onsuccess=function(h){(h=h.target.result)&&(h.expiration=n,o.put(h,e))},i.promise()},c.removeManifests=function(e,n){return lC(this,this.g,e,n)},c.getManifests=function(e){var n,i=this;return W(function(o){return o.g==1?N(o,uC(i,i.g,e),2):(n=o.h,o.return(Promise.all(n.map(function(h){return i.Oc(h)}))))})},c.getAllManifests=function(){var e,n,i=this;return W(function(o){return o.g==1?(e=sb(i.h,i.g,"readonly"),n=new Map,N(o,RS(e,function(h,p){var g;return W(function(b){if(b.g==1)return N(b,i.Oc(p),2);g=b.h,n.set(h,g),re(b)})}),2)):o.g!=3?N(o,e.promise(),3):o.return(n)})},c.Hf=function(e){return e},c.Oc=function(e){return Promise.resolve(e)},c.add=function(e,n){var i,o,h,p,g,b,w,k=this;return W(function(I){if(I.g==1){for(i=bf(k.h,e),o=i.store(),h=[],p={},g=T(n),b=g.next();!b.done;p={nd:p.nd},b=g.next())w=b.value,p.nd=o.add(w),p.nd.onsuccess=function(x){return function(){h.push(x.nd.result)}}(p);return N(I,i.promise(),2)}return I.return(h)})},xv.prototype.destroy=function(){return this.g.destroy()},xv.prototype.getAll=function(){var e,n,i=this;return W(function(o){return o.g==1?(e=sb(i.g,"session-ids","readonly"),n=[],N(o,RS(e,function(h,p){n.push(p)}),2)):o.g!=3?N(o,e.promise(),3):o.return(n)})},xv.prototype.add=function(e){for(var n=bf(this.g,"session-ids"),i=n.store(),o=(e=T(e)).next();!o.done;o=e.next())i.add(o.value);return n.promise()},xv.prototype.remove=function(e){var n,i=this;return W(function(o){return o.g==1?N(o,RS(n=bf(i.g,"session-ids"),function(h,p,g){e.includes(p.sessionId)&&g.delete()}),2):N(o,n.promise(),0)})},ps.prototype.destroy=function(){for(var e=[],n=T(this.g.values()),i=n.next();!i.done;i=n.next())e.push(i.value.destroy());return this.g.clear(),Promise.all(e)},ps.prototype.init=function(){var e=this;Iv.forEach(function(h,p){(h=h())&&e.g.set(p,h)});for(var n=[],i=T(this.g.values()),o=i.next();!o.done;o=i.next())n.push(o.value.init());return Promise.all(n)},We("shaka.offline.StorageMuxer",ps),ps.unregister=function(e){Iv.delete(e)},ps.register=dC,ps.prototype.destroy=ps.prototype.destroy;var Iv=new Map;function Lv(){Ef.apply(this,arguments)}function p_(e,n){(function(h){var p=h.streams.filter(function(x){return x.contentType=="audio"});if(h=h.streams.filter(function(x){return x.contentType=="video"}),!p.every(function(x){return x.variantIds})||!h.every(function(x){return x.variantIds})){for(var g=T(p),b=g.next();!b.done;b=g.next())b.value.variantIds=[];for(b=(g=T(h)).next();!b.done;b=g.next())b.value.variantIds=[];if(g=0,h.length&&!p.length){var w=g++,k=T(h);for(b=k.next();!b.done;b=k.next())b.value.variantIds.push(w)}if(!h.length&&p.length)for(w=g++,b=(k=T(p)).next();!b.done;b=k.next())b.value.variantIds.push(w);if(h.length&&p.length)for(b=(p=T(p)).next();!b.done;b=p.next())for(b=b.value,k=(w=T(h)).next();!k.done;k=w.next()){k=k.value;var I=g++;b.variantIds.push(I),k.variantIds.push(I)}}})(e);for(var i=T(e.streams),o=i.next();!o.done;o=i.next());return e.streams.map(function(h){return function(p,g,b){var w=p.initSegmentUri?hC(p.initSegmentUri):null,k=g+p.presentationTimeOffset,I=g+b;return{id:p.id,originalId:null,groupId:null,primary:p.primary,type:p.contentType,mimeType:p.mimeType,codecs:p.codecs,frameRate:p.frameRate,pixelAspectRatio:void 0,hdr:void 0,videoLayout:void 0,kind:p.kind,language:p.language,originalLanguage:p.language||null,label:p.label,width:p.width,height:p.height,initSegmentKey:w,encrypted:p.encrypted,keyIds:new Set([p.keyId]),segments:p.segments.map(function(x){var C=hC(x.uri);return{startTime:g+x.startTime,endTime:g+x.endTime,dataKey:C,initSegmentKey:w,appendWindowStart:g,appendWindowEnd:I,timestampOffset:k,tilesLayout:"",mimeType:null,codecs:null}}),variantIds:p.variantIds,roles:[],forced:!1,audioSamplingRate:null,channelsCount:null,spatialAudio:!1,closedCaptions:null,tilesLayout:void 0,external:!1,fastSwitching:!1}}(h,e.startTime,n)})}function hC(e){var n;if((n=/^offline:[0-9]+\/[0-9]+\/([0-9]+)$/.exec(e))||(n=/^offline:segment\/([0-9]+)$/.exec(e)))return Number(n[1]);throw new fe(2,9,9004,"Could not parse uri "+e)}function ob(){Ef.apply(this,arguments)}function g_(e,n,i){return{id:e.id,originalId:e.originalId,groupId:null,primary:e.primary,type:e.contentType,mimeType:e.mimeType,codecs:e.codecs,frameRate:e.frameRate,pixelAspectRatio:e.pixelAspectRatio,hdr:void 0,videoLayout:void 0,kind:e.kind,language:e.language,originalLanguage:e.language||null,label:e.label,width:e.width,height:e.height,encrypted:e.encrypted,keyIds:new Set([e.keyId]),segments:e.segments.map(function(o){return{startTime:n+o.startTime,endTime:n+o.endTime,initSegmentKey:e.initSegmentKey,appendWindowStart:n,appendWindowEnd:i,timestampOffset:n-e.presentationTimeOffset,dataKey:o.dataKey,tilesLayout:"",mimeType:null,codecs:null}}),variantIds:e.variantIds,roles:[],forced:!1,audioSamplingRate:null,channelsCount:null,spatialAudio:!1,closedCaptions:null,tilesLayout:void 0,external:!1,fastSwitching:!1}}function DS(){Ef.apply(this,arguments)}function fC(){this.m=this.j=this.i=this.h=this.g=this.l=null}function Ql(e,n,i,o){this.g=e,this.i=n,this.h=i,this.l=o,this.j=["offline:",e,"/",n,"/",i,"/",o].join("")}function PS(e){if((e=/^offline:([a-z]+)\/([^/]+)\/([^/]+)\/([0-9]+)$/.exec(e))==null)return null;var n=e[1];if(n!="manifest"&&n!="segment")return null;var i=e[2];if(!i)return null;var o=e[3];return o&&n!=null?new Ql(n,i,o,Number(e[4])):null}function pC(e,n){this.h=e,this.g=n}function gC(e,n){var i=new Tt(null,0);i.Pa(n.duration);var o=n.streams.filter(function(k){return k.type=="audio"}),h=n.streams.filter(function(k){return k.type=="video"});o=function(k,I,x,C){for(var D=new Set,_=T(I),j=_.next();!j.done;j=_.next()){var F=T(j.value.variantIds);for(j=F.next();!j.done;j=F.next())D.add(j.value)}for(_=T(x),j=_.next();!j.done;j=_.next())for(F=T(j.value.variantIds),j=F.next();!j.done;j=F.next())D.add(j.value);for(_=new Map,D=T(D),j=D.next();!j.done;j=D.next())j=j.value,_.set(j,{id:j,language:"",disabledUntilTime:0,primary:!1,audio:null,video:null,bandwidth:0,allowedByApplication:!0,allowedByKeySystem:!0,decodingInfos:[]});for(I=T(I),D=I.next();!D.done;D=I.next())for(D=D.value,j=lb(k,D,C),F=T(D.variantIds),D=F.next();!D.done;D=F.next())(D=_.get(D.value)).language=j.language,D.primary=D.primary||j.primary,D.audio=j;for(x=T(x),I=x.next();!I.done;I=x.next())for(D=I.value,I=lb(k,D,C),j=T(D.variantIds),D=j.next();!D.done;D=j.next())(D=_.get(D.value)).primary=D.primary||I.primary,D.video=I;return _}(e,o,h,i),h=n.streams.filter(function(k){return k.type==en}).map(function(k){return lb(e,k,i)});var p=n.streams.filter(function(k){return k.type=="image"}).map(function(k){return lb(e,k,i)}),g=n.drmInfo?[n.drmInfo]:[];if(n.drmInfo)for(var b=T(o.values()),w=b.next();!w.done;w=b.next())(w=w.value).audio&&w.audio.encrypted&&(w.audio.drmInfos=g),w.video&&w.video.encrypted&&(w.video.drmInfos=g);return{presentationTimeline:i,minBufferTime:2,offlineSessionIds:n.sessionIds,variants:Array.from(o.values()),textStreams:h,imageStreams:p,sequenceMode:n.sequenceMode||!1,ignoreManifestTimestampsInSegmentsMode:!1,type:n.type||"UNKNOWN",serviceDescription:null}}function lb(e,n,i){var o=n.segments.map(function(h){return function(p,g,b){var w=new Ql("segment",p.h,p.g,g.dataKey);return p=new wt(g.startTime,g.endTime,function(){return[w.toString()]},0,null,g.initSegmentKey!=null?function(k,I){var x=new Ql("segment",k.h,k.g,I);return new is(function(){return[x.toString()]},0,null)}(p,g.initSegmentKey):null,g.timestampOffset,g.appendWindowStart,g.appendWindowEnd,[],g.tilesLayout||""),p.mimeType=g.mimeType||b.mimeType||"",p.codecs=g.codecs||b.codecs||"",p}(e,h,n)});return i.Zc(o),{id:n.id,originalId:n.originalId,groupId:n.groupId,createSegmentIndex:function(){return Promise.resolve()},segmentIndex:new Xt(o),mimeType:n.mimeType,codecs:n.codecs,width:n.width||void 0,height:n.height||void 0,frameRate:n.frameRate,pixelAspectRatio:n.pixelAspectRatio,hdr:n.hdr,videoLayout:n.videoLayout,kind:n.kind,encrypted:n.encrypted,drmInfos:[],keyIds:n.keyIds,language:n.language,originalLanguage:n.originalLanguage||null,label:n.label,type:n.type,primary:n.primary,trickModeVideo:null,emsgSchemeIdUris:null,roles:n.roles,forced:n.forced,channelsCount:n.channelsCount,audioSamplingRate:n.audioSamplingRate,spatialAudio:n.spatialAudio,closedCaptions:n.closedCaptions,tilesLayout:n.tilesLayout,accessibilityPurpose:null,external:n.external,fastSwitching:n.fastSwitching,fullMimeTypes:new Set([Er(n.mimeType,n.codecs)])}}function mC(){this.g=null}function yC(){}function vC(e){var n=PS(e);return e=n&&n.g=="manifest"?Ro(e={uri:e,originalUri:e,data:new ArrayBuffer(0),headers:{"content-type":"application/x-offline-manifest"}}):n&&n.g=="segment"?function(i,o){var h=new ps;return Ro(void 0).na(function(){return h.init()}).na(function(){return ab(h,o.Xa(),o.ta())}).na(function(p){return p.getSegments([o.key()])}).na(function(p){return{uri:o,data:p[0].data,headers:{}}}).finally(function(){return h.destroy()})}(n.key(),n):ts(new fe(2,1,9004,e))}function bC(e,n,i){var o,h,p,g,b,w;return W(function(k){switch(k.g){case 1:o=[];for(var I=[],x=T(i),C=x.next();!C.done;C=x.next()){C=C.value;for(var D=!1,_=T(I),j=_.next();!j.done;j=_.next())if(m_((j=j.value).info,C)){j.sessionIds.push(C.sessionId),D=!0;break}D||I.push({info:C,sessionIds:[C.sessionId]})}h=T(I),p=h.next();case 2:if(p.done){k.B(4);break}return g=p.value,b=function(F,B,H){var Y,te;return W(function(q){switch(q.g){case 1:return Y=new ur({Tb:B,onError:function(){},Vd:function(){},onExpirationUpdated:function(){},onEvent:function(){}}),ne(q,2),Y.configure(F),N(q,function(X,he,ae,me,oe,ge){var le=new Map;return(oe={audioCapabilities:oe,videoCapabilities:ge,distinctiveIdentifier:"optional",persistentState:"required",sessionTypes:["persistent-license"],label:he}).drmInfos=[{keySystem:he,licenseServerUri:ae,distinctiveIdentifierRequired:!1,persistentStateRequired:!0,audioRobustness:"",videoRobustness:"",serverCertificate:me,serverCertificateUri:"",initData:null,keyIds:null}],le.set(he,oe),i1(X,le,[])}(Y,H.info.keySystem,H.info.licenseUri,H.info.serverCertificate,H.info.audioCapabilities,H.info.videoCapabilities),4);case 4:ce(q,3);break;case 2:return we(q),N(q,Y.destroy(),5);case 5:return q.return([]);case 3:return te=[],N(q,Promise.all(H.sessionIds.map(function(X){return W(function(he){return he.g==1?(ne(he,2),N(he,function(ae,me){var oe,ge,le;return W(function(Ee){return Ee.g==1?N(Ee,Rp(ae,me,{initData:null,initDataType:null}),2):Ee.g!=3?(oe=Ee.h)?(ge=[],(le=ae.i.get(oe))&&(le.Sa=new Pn,ge.push(le.Sa)),ge.push(oe.remove()),N(Ee,Promise.all(ge),3)):Ee.return():(ae.i.delete(oe),void re(Ee))})}(Y,X),4)):he.g!=2?(te.push(X),ce(he,0)):(we(he),void re(he))})})),6);case 6:return N(q,Y.destroy(),7);case 7:return q.return(te)}})}(e,n,g),N(k,b,5);case 5:w=k.h,o=o.concat(w),p=h.next(),k.B(2);break;case 4:return k.return(o)}})}function m_(e,n){function i(o,h){return o.robustness==h.robustness&&o.contentType==h.contentType}return e.keySystem==n.keySystem&&e.licenseUri==n.licenseUri&&$c(e.audioCapabilities,n.audioCapabilities,i)&&$c(e.videoCapabilities,n.videoCapabilities,i)}function MS(e,n){var i=gC(new pC(e.Xa(),e.ta()),n),o=n.appMetadata||{};return i=EC(i),{offlineUri:e.toString(),originalManifestUri:n.originalManifestUri,duration:n.duration,size:n.size,expiration:n.expiration,tracks:i,appMetadata:o,isIncomplete:n.isIncomplete||!1}}function EC(e){for(var n=[],i=Tp(e.variants),o=(i=T(i)).next();!o.done;o=i.next())n.push(Xc(o.value));for(i=(e=T(e.textStreams)).next();!i.done;i=e.next())n.push(Ep(i.value));return n}function y_(){this.g={}}function v_(e,n){var i=n.audio,o=n.video;if(i&&!o&&(e.g[i.id]=i.bandwidth||n.bandwidth),!i&&o&&(e.g[o.id]=o.bandwidth||n.bandwidth),i&&o){var h=i.bandwidth||393216,p=o.bandwidth||n.bandwidth-h;0>=p&&(p=n.bandwidth),e.g[i.id]=h,e.g[o.id]=p}}function b_(e,n){e.g[n.id]=n.bandwidth||2048}function TC(e,n){return(e=e.g[n])==null&&(e=0),e}function ei(e){var n=this;if(e&&e.constructor!=Oe)throw new fe(2,9,9008);this.g=this.h=null,e?(this.h=e.h,this.g=e.Nb()):(this.h=ec(),this.g=new ln),this.i=[],this.j=[];var i=!e;this.l=new Ln(function(){var o,h,p,g,b;return W(function(w){switch(w.g){case 1:return N(w,Promise.all(n.j.map(function(k){return LS(k)})),2);case 2:for(o=function(){},h=[],p=T(n.i),g=p.next();!g.done;g=p.next())b=g.value,h.push(b.then(o,o));return N(w,Promise.all(h),3);case 3:if(!i){w.B(4);break}return N(w,n.g.destroy(),4);case 4:n.h=null,n.g=null,re(w)}})})}function OS(){if(ya())e:{for(var e=T(Iv.values()),n=e.next();!n.done;n=e.next())if(n=(n=n.value)()){n.destroy(),e=!0;break e}e=!1}else e=!1;return e}function SC(e){var n,i,o;return W(function(h){switch(h.g){case 1:return N(h,(n=new ps).init(),2);case 2:return N(h,cC(n),3);case 3:return i=h.h,o=new Ql("manifest",i.path.Xa,i.path.ta,e),N(h,n.destroy(),4);case 4:return N(h,new ei().remove(o.toString()),0)}})}function wC(e,n,i,o,h,p){var g,b,w,k,I,x,C,D,_,j,F;return W(function(B){switch(B.g){case 1:for(g=!1,ne(B,2),b=!0,w=T(i.streams),k=w.next();!k.done;k=w.next())for(I=k.value,x=T(I.segments),C=x.next();!C.done;C=x.next())D=C.value,(_=D.pendingSegmentRefId?o[D.pendingSegmentRefId]:null)!=null&&(D.dataKey=_,D.pendingSegmentRefId=void 0),(_=D.pendingInitSegmentRefId?o[D.pendingInitSegmentRefId]:null)!=null&&(D.initSegmentKey=_,D.pendingInitSegmentRefId=void 0),D.pendingSegmentRefId&&(b=!1),D.pendingInitSegmentRefId&&(b=!1);return i.size+=h,b&&(i.isIncomplete=!1),N(B,e.updateManifest(n,i),4);case 4:g=!0,p(),ce(B,0);break;case 2:return j=we(B),N(B,SC(n),5);case 5:if(g){B.B(6);break}return F=Object.values(o),N(B,e.removeSegments(F,function(){}),6);case 6:throw j}})}function NS(e){return e.variants.some(function(n){var i=n.audio&&n.audio.encrypted;return n.video&&n.video.encrypted||i})}function AC(e){return e.variants.some(function(n){return(n.video?n.video.drmInfos:[]).concat(n.audio?n.audio.drmInfos:[]).some(function(i){return i.initData&&i.initData.length})})}function kC(e,n,i,o){if(n.expiration=i.Sc(),i=_u(i),n.sessionIds=o.offline.usePersistentLicense?i:[],NS(e)&&o.offline.usePersistentLicense&&!i.length)throw new fe(2,9,9007)}function xC(e,n){for(var i=[],o=T(e.streams),h=o.next();!h.done;h=o.next())h=h.value,n&&h.type=="video"?i.push({contentType:Er(h.mimeType,h.codecs),robustness:e.drmInfo.videoRobustness}):n||h.type!="audio"||i.push({contentType:Er(h.mimeType,h.codecs),robustness:e.drmInfo.audioRobustness});return i}function E_(e,n,i){return W(function(o){return N(o,function(h,p,g,b){var w,k,I;return W(function(x){return x.g==1?b.drmInfo?(w=function(C){var D=Array.from(C.g.keys());if(!D.length)throw new fe(2,9,9e3,"No supported storage mechanisms found");return C.g.get(D[0]).getEmeSessionCell()}(g),k=b.sessionIds.map(function(C){return{sessionId:C,keySystem:b.drmInfo.keySystem,licenseUri:b.drmInfo.licenseServerUri,serverCertificate:b.drmInfo.serverCertificate,audioCapabilities:xC(b,!1),videoCapabilities:xC(b,!0)}}),N(x,bC(p,h,k),2)):x.return():x.g!=3?(I=x.h,N(x,w.remove(I),3)):N(x,w.add(k.filter(function(C){return!I.includes(C.sessionId)})),0)})}(e.g,e.h.drm,i,n),0)})}function T_(e,n,i){function o(){}var h=function(p){for(var g=new Set,b=(p=T(p.streams)).next();!b.done;b=p.next())for(var w=(b=T(b.value.segments)).next();!w.done;w=b.next())(w=w.value).initSegmentKey!=null&&g.add(w.initSegmentKey),g.add(w.dataKey);return Array.from(g)}(i);return MS(n,i),Promise.all([e.removeSegments(h,o),e.removeManifests([n.key()],o)])}function S_(e,n,i,o,h,p){var g={id:o.id,originalId:o.originalId,groupId:o.groupId,primary:o.primary,type:o.type,mimeType:o.mimeType,codecs:o.codecs,frameRate:o.frameRate,pixelAspectRatio:o.pixelAspectRatio,hdr:o.hdr,videoLayout:o.videoLayout,kind:o.kind,language:o.language,originalLanguage:o.originalLanguage,label:o.label,width:o.width||null,height:o.height||null,encrypted:o.encrypted,keyIds:o.keyIds,segments:[],variantIds:[],roles:o.roles,forced:o.forced,channelsCount:o.channelsCount,audioSamplingRate:o.audioSamplingRate,spatialAudio:o.spatialAudio,closedCaptions:o.closedCaptions,tilesLayout:o.tilesLayout,external:o.external,fastSwitching:o.fastSwitching},b=h.offline.numberOfParallelDownloads,w=0;return function(k,I,x){if((I=k.segmentIndex.find(I))!=null)for(var C=k.segmentIndex.get(I);C;)x(C),C=k.segmentIndex.get(++I)}(o,i.presentationTimeline.fb(),function(k){var I=IS(k),x=void 0;if(!p.has(I)){var C=k.endTime-k.startTime;C=TC(n,o.id)*C,C=sC(e.g,C),p.set(I,new rC(k,C,w,!1))}k.h&&(x=IS(k.h),p.has(x)||(C=.5*TC(n,o.id),C=sC(e.g,C),p.set(x,new rC(k.h,C,w,!0)))),g.segments.push({pendingInitSegmentRefId:x,initSegmentKey:x?0:null,startTime:k.startTime,endTime:k.endTime,appendWindowStart:k.appendWindowStart,appendWindowEnd:k.appendWindowEnd,timestampOffset:k.timestampOffset,tilesLayout:k.tilesLayout,pendingSegmentRefId:I,dataKey:0,mimeType:k.mimeType,codecs:k.codecs}),w=(w+1)%b}),g}function wi(e){if(e.l.g)throw new fe(2,9,7001)}function ub(){if(!OS())throw new fe(2,9,9e3)}function _S(e,n){return W(function(i){return i.g==1?(e.i.push(n),Se(i,2),N(i,n,4)):i.g!=2?i.return(i.h):(ze(i),Qi(e.i,n),xe(i,0))})}function IC(e){for(var n=new Set,i=T(e.textStreams),o=i.next();!o.done;o=i.next())n.add(o.value);for(o=(i=T(e.imageStreams)).next();!o.done;o=i.next())n.add(o.value);for(i=(e=T(e.variants)).next();!i.done;i=e.next())(i=i.value).audio&&n.add(i.audio),i.video&&n.add(i.video);return n}Z(Lv,Ef),Lv.prototype.updateManifestExpiration=function(e,n){var i,o,h,p=this;return W(function(g){return i=bf(p.h,p.g),o=i.store(),h=new Pn,o.get(e).onsuccess=function(b){(b=b.target.result)?(b.expiration=n,o.put(b),h.resolve()):h.reject(new fe(2,9,9012,"Could not find values for "+e))},N(g,Promise.all([i.promise(),h]),0)})},Lv.prototype.Oc=function(e){var n,i,o,h,p,g;return W(function(b){if(b.g==1){for(n=[],i=0;i<e.periods.length;++i)o=i==e.periods.length-1?e.duration:e.periods[i+1].startTime,h=o-e.periods[i].startTime,p=p_(e.periods[i],h),n.push(p);return N(b,JL(n),2)}return g=b.h,b.return({creationTime:0,originalManifestUri:e.originalManifestUri,duration:e.duration,size:e.size,expiration:e.expiration==null?1/0:e.expiration,streams:g,sessionIds:e.sessionIds,drmInfo:e.drmInfo,appMetadata:e.appMetadata,sequenceMode:!1})})},Lv.prototype.Hf=function(e){return{data:e.data}},Z(ob,Ef),ob.prototype.Oc=function(e){var n,i,o,h,p,g;return W(function(b){if(b.g==1){for(n=[],i=0;i<e.periods.length;++i){o=i==e.periods.length-1?e.duration:e.periods[i+1].startTime,h=o-e.periods[i].startTime;for(var w=e.periods[i],k=[],I=T(w.streams),x=I.next();!x.done;x=I.next())(x=x.value).variantIds.length!=0&&k.push(g_(x,w.startTime,w.startTime+h));p=k,n.push(p)}return N(b,JL(n),2)}return g=b.h,b.return({appMetadata:e.appMetadata,creationTime:0,drmInfo:e.drmInfo,duration:e.duration,expiration:e.expiration==null?1/0:e.expiration,originalManifestUri:e.originalManifestUri,sessionIds:e.sessionIds,size:e.size,streams:g,sequenceMode:!1})})},Z(DS,Ef),(c=DS.prototype).hasFixedKeySpace=function(){return!1},c.addSegments=function(e){return this.add(this.i,e)},c.addManifests=function(e){return this.add(this.g,e)},c.updateManifest=function(e,n){return function(i,o,h){var p=(i=bf(i.h,i.g)).store();return p.get(o).onsuccess=function(){p.put(h,o)},i.promise()}(this,e,n)},c.Oc=function(e){return e.expiration==null&&(e.expiration=1/0),Promise.resolve(e)},(c=fC.prototype).init=function(){var e=this,n=new Pn,i=!1,o=new Qt(function(){i=!0,n.reject(new fe(2,9,9017))});o.U(5);var h=s.indexedDB.open("shaka_offline_db",5);return h.onsuccess=function(){if(!i){var p=h.result;e.l=p;var g=p.objectStoreNames;g=g.contains("manifest")&&g.contains("segment")?new Lv(p,"segment","manifest"):null,e.g=g,g=(g=p.objectStoreNames).contains("manifest-v2")&&g.contains("segment-v2")?new ob(p,"segment-v2","manifest-v2"):null,e.h=g,g=(g=p.objectStoreNames).contains("manifest-v3")&&g.contains("segment-v3")?new ob(p,"segment-v3","manifest-v3"):null,e.i=g,g=(g=p.objectStoreNames).contains("manifest-v5")&&g.contains("segment-v5")?new DS(p,"segment-v5","manifest-v5"):null,e.j=g,p=p.objectStoreNames.contains("session-ids")?new xv(p):null,e.m=p,o.stop(),n.resolve()}},h.onupgradeneeded=function(){for(var p=h.result,g=T(["segment-v5","manifest-v5","session-ids"]),b=g.next();!b.done;b=g.next())b=b.value,p.objectStoreNames.contains(b)||p.createObjectStore(b,{autoIncrement:!0})},h.onerror=function(p){i||(n.reject(new fe(2,9,9001,h.error)),o.stop(),p.preventDefault())},n},c.destroy=function(){var e=this;return W(function(n){switch(n.g){case 1:if(!e.g){n.B(2);break}return N(n,e.g.destroy(),2);case 2:if(!e.h){n.B(4);break}return N(n,e.h.destroy(),4);case 4:if(!e.i){n.B(6);break}return N(n,e.i.destroy(),6);case 6:if(!e.j){n.B(8);break}return N(n,e.j.destroy(),8);case 8:if(!e.m){n.B(10);break}return N(n,e.m.destroy(),10);case 10:e.l&&e.l.close(),re(n)}})},c.getCells=function(){var e=new Map;return this.g&&e.set("v1",this.g),this.h&&e.set("v2",this.h),this.i&&e.set("v3",this.i),this.j&&e.set("v5",this.j),e},c.getEmeSessionCell=function(){return this.m},c.erase=function(){var e=this;return W(function(n){switch(n.g){case 1:if(!e.g){n.B(2);break}return N(n,e.g.destroy(),2);case 2:if(!e.h){n.B(4);break}return N(n,e.h.destroy(),4);case 4:if(!e.i){n.B(6);break}return N(n,e.i.destroy(),6);case 6:if(!e.j){n.B(8);break}return N(n,e.j.destroy(),8);case 8:return e.l&&e.l.close(),N(n,function(){var i=new Pn,o=s.indexedDB.deleteDatabase("shaka_offline_db");return o.onblocked=function(){},o.onsuccess=function(){i.resolve()},o.onerror=function(h){i.reject(new fe(2,9,9001,o.error)),h.preventDefault()},i}(),10);case 10:return e.l=null,e.g=null,e.h=null,e.i=null,e.j=null,N(n,e.init(),0)}})},dC("idb",function(){return Zi()||qc()||!s.indexedDB?null:new fC}),Ql.prototype.Xa=function(){return this.i},Ql.prototype.ta=function(){return this.h},Ql.prototype.key=function(){return this.l},Ql.prototype.toString=function(){return this.j},(c=mC.prototype).configure=function(){},c.start=function(e,n){var i,o,h,p,g,b,w=this;return W(function(k){switch(k.g){case 1:if(i=PS(e),w.g=i,i==null||i.g!="manifest")throw new fe(2,1,9004,e);return o=new ps,Se(k,2),N(k,o.init(),4);case 4:return N(k,ab(o,i.Xa(),i.ta()),5);case 5:return N(k,k.h.getManifests([i.key()]),6);case 6:return h=k.h,p=h[0],g=new pC(i.Xa(),i.ta()),b=gC(g,p),n.makeTextStreamsForClosedCaptions(b),k.return(b);case 2:return ze(k),N(k,o.destroy(),7);case 7:xe(k,0)}})},c.stop=function(){return Promise.resolve()},c.update=function(){},c.onExpirationUpdated=function(e,n){var i,o,h,p,g,b,w,k=this;return W(function(I){switch(I.g){case 1:return i=k.g,o=new ps,ne(I,2,3),N(I,o.init(),5);case 5:return N(I,ab(o,i.Xa(),i.ta()),6);case 6:return N(I,(h=I.h).getManifests([i.key()]),7);case 7:if(p=I.h,g=p[0],b=g.sessionIds.includes(e),w=g.expiration==null||g.expiration>n,!b||!w){I.B(3);break}return N(I,h.updateManifestExpiration(i.key(),n),3);case 3:return ze(I),N(I,o.destroy(),10);case 10:xe(I,0);break;case 2:we(I),I.B(3)}})},c.onInitialVariantChosen=function(){},c.banLocation=function(){},ks["application/x-offline-manifest"]=function(){return new mC},We("shaka.offline.OfflineScheme",yC),yC.plugin=vC,Ui("offline",vC),(c=ei.prototype).destroy=function(){return this.l.destroy()},c.configure=function(e,n){return arguments.length==2&&typeof e=="string"&&(e=cg(e,n)),Sd(this.h,e)},c.getConfiguration=function(){var e=ec();return Sd(e,this.h,ec()),e},c.Nb=function(){return this.g},c.store=function(e,n,i){var o=this,h=this.getConfiguration(),p=new aC(this.g);return this.j.push(p),n=function(g,b,w,k,I,x){var C,D,_,j,F,B,H,Y,te,q,X,he,ae;return W(function(me){switch(me.g){case 1:return ub(),D=C=null,_=new ps,B=F=j=null,ne(me,2,3),N(me,k(),5);case 5:return C=me.h,N(me,function(oe,ge,le,Ee){var ve,Be,_e,Ye,Ve;return W(function(be){if(be.g==1)return ve=null,Be=oe.g,_e={networkingEngine:Be,filter:function(){return Promise.resolve()},makeTextStreamsForClosedCaptions:function(){},onTimelineRegionAdded:function(){},onEvent:function(){},onError:function(ke){ve=ke},isLowLatencyMode:function(){return!1},isAutoLowLatencyMode:function(){return!1},enableLowLatencyMode:function(){},updateDuration:function(){},newDrmInfo:function(){},onManifestUpdated:function(){},getBandwidthEstimate:function(){return Ee.abr.defaultBandwidthEstimate}},le.configure(Ee.manifest),wi(oe),N(be,le.start(ge,_e),2);if(be.g!=3)return Ye=be.h,wi(oe),Ve=IC(Ye),N(be,Promise.all(zs(Ve,function(ke){return ke.createSegmentIndex()})),3);if(wi(oe),ve)throw ve;return be.return(Ye)})}(g,b,C,I),6);case 6:if(H=me.h,wi(g),H.presentationTimeline.R()||H.presentationTimeline.Rb())throw new fe(2,9,9005,b);return N(me,function(oe,ge,le,Ee){var ve;return W(function(Be){return Be.g==1?((ve=new ur({Tb:oe.g,onError:le,Vd:function(){},onExpirationUpdated:function(){},onEvent:function(){}})).configure(Ee.drm),N(Be,function(_e,Ye,Ve){return _e.ha=!0,_e.u=new Map,_e.N=Ve,Ch(_e,Ye)}(ve,ge.variants,Ee.offline.usePersistentLicense),2)):Be.g!=3?N(Be,Ml(ve),3):Be.return(ve)})}(g,H,function(oe){B=B||oe},I),7);case 7:if(D=me.h,wi(g),B)throw B;return N(me,function(oe,ge,le){var Ee,ve,Be,_e,Ye,Ve,be,ke,Ae,He,De,$e,je,Ge,Fe,rt,Qe,Et,et,it,Pt,Yt,Zt,an,_t,Bt,tn;return W(function(yt){switch(yt.g){case 1:return Ee={width:1/0,height:1/0},function(at,st,Ct){at.variants=at.variants.filter(function($t){return ku($t,st,Ct)})}(oe,le.restrictions,Ee),N(yt,Eh(ge,oe,le.offline.usePersistentLicense),2);case 2:for(ve=[],Be=le.preferredDecodingAttributes,_e=le.preferredVideoCodecs,Ye=le.preferredAudioCodecs,Qm(oe,_e,Ye,Be),Ve=T(oe.variants),be=Ve.next();!be.done;be=Ve.next())ke=be.value,ve.push(Xc(ke));for(Ae=T(oe.textStreams),He=Ae.next();!He.done;He=Ae.next())De=He.value,ve.push(Ep(De));for($e=T(oe.imageStreams),je=$e.next();!je.done;je=$e.next())Ge=je.value,ve.push(ty(Ge));return N(yt,le.offline.trackSelectionCallback(ve),3);case 3:for(Fe=yt.h,rt=oe.presentationTimeline.getDuration(),Qe=0,Et=T(Fe),et=Et.next();!et.done;et=Et.next())it=et.value,Pt=it.bandwidth*rt/8,Qe+=Pt;return ne(yt,4),N(yt,le.offline.downloadSizeCallback(Qe),6);case 6:if(!yt.h)throw new fe(2,9,9014);ce(yt,5);break;case 4:throw(Yt=we(yt))instanceof fe?Yt:new fe(2,9,9015);case 5:for(Zt=new Set,an=new Set,_t=new Set,Bt=T(Fe),et=Bt.next();!et.done;et=Bt.next())(tn=et.value).type=="variant"&&Zt.add(tn.id),tn.type=="text"&&an.add(tn.id),tn.type=="image"&&_t.add(tn.id);oe.variants=oe.variants.filter(function(at){return Zt.has(at.id)}),oe.textStreams=oe.textStreams.filter(function(at){return an.has(at.id)}),oe.imageStreams=oe.imageStreams.filter(function(at){return _t.has(at.id)}),function(at){at.variants.map(function(Ft){return Ft.video});var st=new Set(at.variants.map(function(Ft){return Ft.audio}));at=at.textStreams;for(var Ct=T(st),$t=Ct.next();!$t.done;$t=Ct.next())for(var Lt=($t=T(st)).next();!Lt.done;Lt=$t.next());for(st=T(at),Ct=st.next();!Ct.done;Ct=st.next())for(Ct=T(at),$t=Ct.next();!$t.done;$t=Ct.next());}(oe),re(yt)}})}(H,D,I),8);case 8:return N(me,_.init(),9);case 9:return wi(g),N(me,cC(_),10);case 10:return j=me.h,wi(g),Y=function(oe,ge,le,Ee,ve,Be){var _e=function(De,$e,je){return{offlineUri:null,originalManifestUri:De,duration:$e.presentationTimeline.getDuration(),size:0,expiration:1/0,tracks:$e=EC($e),appMetadata:je,isIncomplete:!1}}(le,ge,Ee),Ye=ve.offline.progressCallback;(function(De,$e,je){De.m=$e,De.l=je})(Be,function(De,$e){_e.size=$e,Ye(_e,De)},function(De,$e){Ve&&ve.offline.usePersistentLicense&&be==$e&&Ol(oe,"cenc",De)});var Ve=NS(ge)&&!AC(ge),be=null;Ve&&(be=w_.get(oe.g.keySystem));for(var ke=new y_,Ae=T(ge.textStreams),He=Ae.next();!He.done;He=Ae.next())ke.g[He.value.id]=52;for(Ae=T(ge.imageStreams),He=Ae.next();!He.done;He=Ae.next())b_(ke,He.value);for(He=T(ge.variants),Ae=He.next();!Ae.done;Ae=He.next())v_(ke,Ae.value);return ke=function(De,$e,je,Ge){for(var Fe=new Map,rt=IC(je),Qe=new Map,Et=(rt=T(rt)).next();!Et.done;Et=rt.next()){var et=S_(De,$e,je,Et=Et.value,Ge,Fe);Qe.set(Et.id,et)}for(De=T(je.variants),$e=De.next();!$e.done;$e=De.next())($e=$e.value).audio&&Qe.get($e.audio.id).variantIds.push($e.id),$e.video&&Qe.get($e.video.id).variantIds.push($e.id);return{streams:Array.from(Qe.values()),vf:Array.from(Fe.values())}}(Be,ke,ge,ve),Be=ke.streams,ke=ke.vf,He=oe.g,Ae=ve.offline.usePersistentLicense,He&&Ae&&(He.initData=[]),{Bh:{creationTime:Date.now(),originalManifestUri:le,duration:ge.presentationTimeline.getDuration(),size:0,expiration:oe.Sc(),streams:Be,sessionIds:Ae?_u(oe):[],drmInfo:He,appMetadata:Ee,isIncomplete:!0,sequenceMode:ge.sequenceMode,type:ge.type},vf:ke}}(D,H,b,w,I,x),te=Y.Bh,q=Y.vf,N(me,j.ta.addManifests([te]),11);case 11:if(X=me.h,wi(g),F=X[0],wi(g),B)throw B;return N(me,function(oe,ge,le,Ee,ve,Be,_e,Ye,Ve){var be,ke,Ae,He,De,$e,je,Ge,Fe,rt;return W(function(Qe){switch(Qe.g){case 1:if(be={},ke=0,Ae=function(Et,et){var it,Pt,Yt,Zt,an,_t,Bt;return W(function(tn){if(tn.g==1){for(it={},Pt=T(Et),Yt=Pt.next();!Yt.done;it={Hb:it.Hb},Yt=Pt.next())it.Hb=Yt.value,Zt=h_(it.Hb,Be),an=it.Hb.i,_t=it.Hb.h,Bt=function(yt){return function(at){var st,Ct,$t;return W(function(Lt){if(Lt.g==1)return N(Lt,_e.addSegments([{data:at}]),2);st=Lt.h,wi(oe),Ct=yt.Hb.g,$t=IS(Ct),be[$t]=st[0],ke+=at.byteLength,re(Lt)})}}(it),f_(ve,it.Hb.groupId,Zt,an,_t,Bt);return N(tn,function(yt){return W(function(at){return at.g==1?N(at,Promise.all(yt.j.values()),2):at.return(yt.g.h)})}(ve),2)}return et?(wi(oe),kC(Ye,Ee,Ve,Be),N(tn,_e.updateManifest(le,Ee),0)):tn.B(0)})},He=!1,ne(Qe,2),!NS(Ye)||!He||AC(Ye)){Qe.B(4);break}return N(Qe,Ae(ge.filter(function(Et){return Et.h}),!0),5);case 5:return wi(oe),ge=ge.filter(function(Et){return!Et.h}),De=be,$e=ke,be={},ke=0,N(Qe,wC(_e,le,Ee,De,$e,function(){return wi(oe)}),6);case 6:wi(oe);case 4:if(He){Qe.B(7);break}return N(Qe,Ae(ge,!1),8);case 8:return wi(oe),je=be,Ge=ke,be={},ke=0,N(Qe,wC(_e,le,Ee,je,Ge,function(){return wi(oe)}),9);case 9:wi(oe);case 7:ce(Qe,0);break;case 2:return Fe=we(Qe),rt=Object.values(be),N(Qe,_e.removeSegments(rt,function(){}),10);case 10:throw Fe}})}(g,q,F,te,x,I,j.ta,H,D),12);case 12:return wi(g),kC(H,te,D,I),N(me,j.ta.updateManifest(F,te),13);case 13:return wi(g),he=new Ql("manifest",j.path.Xa,j.path.ta,F),me.return(MS(he,te));case 3:return ze(me),N(me,_.destroy(),14);case 14:if(!C){me.B(15);break}return N(me,C.stop(),15);case 15:if(!D){me.B(17);break}return N(me,D.destroy(),17);case 17:xe(me,0);break;case 2:if(ae=we(me),F==null){me.B(19);break}return N(me,SC(F),19);case 19:throw B||ae}})}(this,e,n||{},function(){var g;return W(function(b){return b.g==1?i?b.B(2):N(b,sg(e,o.g,h.manifest.retryParameters),3):(b.g!=2&&(i=b.h),g=Op(e,i||null),b.return(g()))})},h,p),(n=new or(n,function(){return LS(p)})).finally(function(){Qi(o.j,p)}),function(g,b){var w=b.promise;return g.i.push(w),b.finally(function(){Qi(g.i,w)})}(this,n)},c.remove=function(e){return _S(this,function(n,i){var o,h,p,g,b,w;return W(function(k){switch(k.g){case 1:if(ub(),(o=PS(i))==null||o.g!="manifest")throw new fe(2,9,9004,i);return h=o,p=new ps,Se(k,2),N(k,p.init(),4);case 4:return N(k,ab(p,h.Xa(),h.ta()),5);case 5:return N(k,(g=k.h).getManifests([h.key()]),6);case 6:return b=k.h,w=b[0],N(k,Promise.all([E_(n,w,p),T_(g,h,w)]),2);case 2:return ze(k),N(k,p.destroy(),8);case 8:xe(k,0)}})}(this,e))},c.Ph=function(){return _S(this,function(e){var n,i,o,h,p,g,b,w,k,I;return W(function(x){switch(x.g){case 1:return ub(),n=e.g,i=e.h.drm,o=new ps,h=!1,Se(x,2),N(x,o.init(),4);case 4:p=[],function(C,D){C.g.forEach(function(_){D(_.getEmeSessionCell())})}(o,function(C){return p.push(C)}),g=T(p),b=g.next();case 5:if(b.done){x.B(2);break}return N(x,(w=b.value).getAll(),8);case 8:return k=x.h,N(x,bC(i,n,k),9);case 9:return I=x.h,N(x,w.remove(I),10);case 10:I.length!=k.length&&(h=!0),b=g.next(),x.B(5);break;case 2:return ze(x),N(x,o.destroy(),11);case 11:xe(x,3);break;case 3:return x.return(!h)}})}(this))},c.list=function(){return _S(this,W(function(o){switch(o.g){case 1:return ub(),e=[],n=new ps,Se(o,2),N(o,n.init(),4);case 4:return i=Promise.resolve(),function(h,p){h.g.forEach(function(g,b){g.getCells().forEach(function(w,k){p({Xa:b,ta:k},w)})})}(n,function(h,p){i=i.then(function(){return W(function(g){if(g.g==1)return N(g,p.getAllManifests(),2);g.h.forEach(function(b,w){b=MS(new Ql("manifest",h.Xa,h.ta,w),b),e.push(b)}),re(g)})})}),N(o,i,2);case 2:return ze(o),N(o,n.destroy(),6);case 6:xe(o,3);break;case 3:return o.return(e)}}));var e,n,i},We("shaka.offline.Storage",ei),ei.deleteAll=function(){var e;return W(function(n){return n.g==1?(e=new ps,Se(n,2),N(n,function(i){var o,h;return W(function(p){return p.g==1?(o=Array.from(i.g.values()),(h=0<o.length)||Iv.forEach(function(g){(g=g())&&o.push(g)}),N(p,Promise.all(o.map(function(g){return g.erase()})),2)):h?p.B(0):N(p,Promise.all(o.map(function(g){return g.destroy()})),0)})}(e),2)):n.g!=5?(ze(n),N(n,e.destroy(),5)):xe(n,0)})},ei.prototype.list=ei.prototype.list,ei.prototype.removeEmeSessions=ei.prototype.Ph,ei.prototype.remove=ei.prototype.remove,ei.prototype.store=ei.prototype.store,ei.prototype.getNetworkingEngine=ei.prototype.Nb,ei.prototype.getConfiguration=ei.prototype.getConfiguration,ei.prototype.configure=ei.prototype.configure,ei.prototype.destroy=ei.prototype.destroy,ei.support=OS;var w_=new Map().set("org.w3.clearkey","1077efecc0b24d02ace33c1e52e2fb4b").set("com.widevine.alpha","edef8ba979d64acea3c827dcd51d21ed").set("com.microsoft.playready","9a04f07998404286ab92e65be0885f95").set("com.microsoft.playready.recommendation","9a04f07998404286ab92e65be0885f95").set("com.microsoft.playready.software","9a04f07998404286ab92e65be0885f95").set("com.microsoft.playready.hardware","9a04f07998404286ab92e65be0885f95").set("com.adobe.primetime","f239e769efa348509c16a903c6932efb");function fi(){}function Gi(e,n){for(e={priority:n||0,callback:e},n=0;n<Rv.length;n++)if(Rv[n].priority<e.priority)return void Rv.splice(n,0,e);Rv.push(e)}Sg.offline=OS,We("shaka.polyfill",fi),fi.register=Gi,fi.installAll=function(){for(var e=T(Rv),n=e.next();!n.done;n=e.next()){n=n.value;try{n.callback()}catch(i){Rt("Error installing polyfill!",i)}}};var Rv=[];function Cv(){this.g=new cb}function LC(){s.AbortController||(s.AbortController=Cv,s.AbortSignal=cb)}function cb(){hn.call(this),this.h=!1,this.g=void 0,this.onabort=null}function RC(){}function CC(){if(!Object.getOwnPropertyDescriptor(Element.prototype,"ariaHidden"))for(var e=T(["ariaHidden","ariaLabel","ariaPressed","ariaSelected"]),n=e.next();!n.done;n=e.next())A_(n.value)}function A_(e){var n="aria-"+e.toLowerCase().replace(/^aria/,"");Object.defineProperty(Element.prototype,e,{get:function(){return this.getAttribute(n)},set:function(i){i==null||i==null?this.removeAttribute(n):this.setAttribute(n,i)}})}function DC(){}function PC(){Q2()}function MC(){}function OC(){if(s.Document){var e=Element.prototype;e.requestFullscreen=e.requestFullscreen||e.mozRequestFullScreen||e.msRequestFullscreen||e.webkitRequestFullscreen,(e=Document.prototype).exitFullscreen=e.exitFullscreen||e.mozCancelFullScreen||e.msExitFullscreen||e.webkitCancelFullScreen,"fullscreenElement"in document||(Object.defineProperty(document,"fullscreenElement",{get:function(){return document.mozFullScreenElement||document.msFullscreenElement||document.webkitCurrentFullScreenElement||document.webkitFullscreenElement}}),Object.defineProperty(document,"fullscreenEnabled",{get:function(){return document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled}})),document.addEventListener("webkitfullscreenchange",Jg),document.addEventListener("webkitfullscreenerror",Jg),document.addEventListener("mozfullscreenchange",Jg),document.addEventListener("mozfullscreenerror",Jg),document.addEventListener("MSFullscreenChange",Jg),document.addEventListener("MSFullscreenError",Jg)}}function Jg(e){var n=e.type.replace(/^(webkit|moz|MS)/,"").toLowerCase(),i=document.createEvent("Event");i.initEvent(n,e.bubbles,e.cancelable),e.target.dispatchEvent(i)}function Dv(){}function NC(){var e=!0;!Zi()||Zi()&&Nn("Android")||Zi()&&Nn("Fuchsia")||(e=!1),(vh()||Nn("PlayStation 5")||wu()||Su()||Tu()||Nn("PC=EOS")||Nn("Hisense")||Nn("VIDAA"))&&(e=!1),e&&navigator.mediaCapabilities||(navigator.mediaCapabilities||(navigator.mediaCapabilities={}),_C=navigator.mediaCapabilities,navigator.mediaCapabilities.decodingInfo=k_)}function k_(e){var n,i,o,h,p,g,b,w,k,I,x,C,D,_,j;return W(function(F){switch(F.g){case 1:if(n={supported:!1,powerEfficient:!0,smooth:!0,keySystemAccess:null,configuration:e},!e)return F.return(n);if(i=e.video,o=e.audio,e.type=="media-source"){if(!ya())return F.return(n);if(i){if(Zi())if(s.cast&&cast.Ot&&cast.Ot.canDisplayType){var B=i.contentType;if(i.width&&i.height&&(B+="; width="+i.width+"; height="+i.height),i.framerate&&(B+="; framerate="+i.framerate),i.transferFunction==="pq"&&(B+="; eotf=smpte2084"),B in hb)var H=hb[B];else H=cast.Ot.canDisplayType(B),hb[B]=H;h=H}else h=Dn(i.contentType);else Tu()?(p=i.contentType,i.width&&i.height&&(p+="; width="+i.width,p+="; height="+i.height),i.framerate&&(p+="; framerate="+i.framerate),i.bitrate&&(p+="; bitrate="+i.bitrate),h=Dn(p)):h=Dn(i.contentType);if(!h)return F.return(n)}if(o&&(Zi()&&o.spatialRendering?(b=o.contentType+"; spatialRendering=true",g=Dn(b)):g=Dn(o.contentType),!g))return F.return(n)}else if(e.type!="file"||i&&!Eu(i.contentType)||o&&!Eu(o.contentType))return F.return(n);if(!e.keySystemConfiguration)return n.supported=!0,F.return(Promise.resolve(n));if(w=e.keySystemConfiguration,k=[],I=[],w.audio&&(x={robustness:w.audio.robustness||"",contentType:e.audio.contentType},Tu()&&e.audio.contentType.includes('codecs="ac-3"')&&(x={robustness:x.robustness,contentType:'audio/mp4; codecs="ec-3"'}),k.push(x)),w.video&&(C={robustness:w.video.robustness||"",contentType:e.video.contentType},I.push(C)),D={initDataTypes:[w.initDataType],distinctiveIdentifier:w.distinctiveIdentifier,persistentState:w.persistentState,sessionTypes:w.sessionTypes},k.length&&(D.audioCapabilities=k),I.length&&(D.videoCapabilities=I),_=(e.video?e.video.contentType:"")+"#"+(e.audio?e.audio.contentType:"")+"#"+e.keySystemConfiguration.keySystem,ne(F,3),_ in db){j=db[_],F.B(5);break}return N(F,navigator.requestMediaKeySystemAccess(w.keySystem,[D]),6);case 6:j=F.h,db[_]=j;case 5:ce(F,4);break;case 3:we(F);case 4:j&&(n.supported=!0,n.keySystemAccess=j);case 2:return F.return(n)}})}Cv.prototype.abort=function(e){var n=this.g;n.h||(n.h=!0,n.g=e,n.g===void 0&&(n.g=new DOMException("signal is aborted without reason","AbortError")),e=new dt("abort"),n.onabort&&n.onabort(e),n.dispatchEvent(e))},E.Object.defineProperties(Cv.prototype,{signal:{configurable:!0,enumerable:!0,get:function(){return this.g}}}),fi.AbortController=Cv,Cv.install=LC,Z(cb,hn),E.Object.defineProperties(cb.prototype,{aborted:{configurable:!0,enumerable:!0,get:function(){return this.h}},reason:{configurable:!0,enumerable:!0,get:function(){return this.g}}}),Gi(LC),fi.Aria=RC,RC.install=CC,Gi(CC),fi.EncryptionScheme=DC,DC.install=PC,Gi(PC,-2),fi.Fullscreen=MC,MC.install=OC,Gi(OC),fi.MediaCapabilities=Dv,Dv.install=NC;var _C=null;Dv.originalMcap=_C;var db={};Dv.memoizedMediaKeySystemAccessRequests_=db;var FS,US,BS,$S,jS,GS,hb={};function FC(){}function UC(){var e=Au();(s.MediaSource||s.ManagedMediaSource)&&(e?10>=e?s.MediaSource=null:12>=e?(BC(),function(){var n=SourceBuffer.prototype.remove;SourceBuffer.prototype.remove=function(i,o){return n.call(this,i,o-.001)}}()):15>=e&&BC():(vp()||yh()||Nn("Tizen 4"))&&function(){var n=MediaSource.isTypeSupported.bind(MediaSource);if(MediaSource.isTypeSupported=function(o){return Hs(o)!="opus"&&n(o)},s.ManagedMediaSource){var i=ManagedMediaSource.isTypeSupported.bind(ManagedMediaSource);s.ManagedMediaSource.isTypeSupported=function(o){return Hs(o)!="opus"&&i(o)}}}()),(s.MediaSource||s.ManagedMediaSource)&&function(){var n=MediaSource.isTypeSupported.bind(MediaSource);if(MediaSource.isTypeSupported=function(o){return fh(o)!="mp2t"&&n(o)},s.ManagedMediaSource){var i=ManagedMediaSource.isTypeSupported.bind(ManagedMediaSource);s.ManagedMediaSource.isTypeSupported=function(o){return fh(o)!="mp2t"&&i(o)}}}(),s.MediaSource&&MediaSource.isTypeSupported('video/webm; codecs="vp9"')&&!MediaSource.isTypeSupported('video/webm; codecs="vp09.00.10.08"')&&function(){var n=MediaSource.isTypeSupported;Su()||(MediaSource.isTypeSupported=function(i){var o=i.split(/ *; */),h=o.findIndex(function(b){return b.startsWith("codecs=")});if(0>h)return n(i);var p=o[h].replace("codecs=","").replace(/"/g,"").split(/\s*,\s*/),g=p.findIndex(function(b){return b.startsWith("vp09")});return 0<=g&&(p[g]="vp9",o[h]='codecs="'+p.join(",")+'"',i=o.join("; ")),n(i)})}()}function BC(){var e=MediaSource.prototype.addSourceBuffer;MediaSource.prototype.addSourceBuffer=function(){var n=e.apply(this,Ke.apply(0,arguments));return n.abort=function(){},n}}function $C(){}function jC(){screen.orientation&&screen.orientation.unlock||(screen.orientation!=null?(screen.orientation.lock===void 0&&(screen.orientation.lock=function(){return Promise.resolve()}),screen.orientation.unlock===void 0&&(screen.orientation.unlock=function(){})):s.orientation!=null&&function(){function e(){switch(s.orientation){case-90:n.type="landscape-secondary",n.angle=270;break;case 0:n.type="portrait-primary",n.angle=0;break;case 90:n.type="landscape-primary",n.angle=90;break;case 180:n.type="portrait-secondary",n.angle=180}}var n=new fb;screen.orientation=n,e(),s.addEventListener("orientationchange",function(){e();var i=new dt("change");n.dispatchEvent(i)})}())}function fb(){hn.call(this),this.type="",this.angle=0}function HS(){}function x_(e,n){try{var i=new pb(e,n);return Promise.resolve(i)}catch(o){return Promise.reject(o)}}function I_(e){var n=this.mediaKeys;return n&&n!=e&&GC(n,null),delete this.mediaKeys,(this.mediaKeys=e)?GC(e,this):Promise.resolve()}function L_(e){if(Nr(e=Nt(e.initData)).getUint32(0,!0)+4!=e.byteLength)throw new RangeError("Malformed FairPlay init data");e=As(e=ws(e.subarray(4),!0));var n=new Event("encrypted");n.initDataType="skd",n.initData=bs(e),this.dispatchEvent(n)}function pb(e,n){if(this.keySystem=e,e.startsWith("com.apple.fps"))for(n=(e=T(n)).next();!n.done;n=e.next()){var i=n.value;if(i.persistentState=="required")n=null;else{n={audioCapabilities:[],videoCapabilities:[],persistentState:"optional",distinctiveIdentifier:"optional",initDataTypes:i.initDataTypes,sessionTypes:["temporary"],label:i.label};var o=!1,h=!1;if(i.audioCapabilities)for(var p=T(i.audioCapabilities),g=p.next();!g.done;g=p.next())(g=g.value).contentType&&(o=!0,WebKitMediaKeys.isTypeSupported(this.keySystem,g.contentType.split(";")[0])&&(n.audioCapabilities.push(g),h=!0));if(i.videoCapabilities)for(g=(i=T(i.videoCapabilities)).next();!g.done;g=i.next())(p=g.value).contentType&&(o=!0,WebKitMediaKeys.isTypeSupported(this.keySystem,p.contentType.split(";")[0])&&(n.videoCapabilities.push(p),h=!0));o||(h=WebKitMediaKeys.isTypeSupported(this.keySystem,"video/mp4")),n=h?n:null}if(n)return void(this.g=n)}throw(e=Error("Unsupported keySystem")).name="NotSupportedError",e.code=DOMException.NOT_SUPPORTED_ERR,e}function Pv(e){this.h=new WebKitMediaKeys(e),this.g=new mn}function GC(e,n){if(e.g.$a(),!n)return Promise.resolve();e.g.D(n,"webkitneedkey",L_);try{return Bl(n,HTMLMediaElement.HAVE_METADATA,e.g,function(){n.webkitSetMediaKeys(e.h)}),Promise.resolve()}catch(i){return Promise.reject(i)}}function VS(e){hn.call(this),this.i=null,this.l=e,this.g=this.h=null,this.j=new mn,this.sessionId="",this.expiration=NaN,this.closed=new Pn,this.keyStatuses=new HC}function gb(e,n){var i=e.keyStatuses;i.size=n==null?0:1,i.g=n,n=new dt("keystatuseschange"),e.dispatchEvent(n)}function HC(){this.size=0,this.g=void 0}function VC(){}function KC(){s.MediaKeys&&(!MediaKeys.prototype.setServerCertificate||yh()||Nn("Tizen 4")||Nn("Tizen 5.0")||Wc())&&(MediaKeys.prototype.setServerCertificate=R_)}function R_(){return Promise.resolve(!1)}function zC(){}function qC(){!s.HTMLVideoElement||navigator.requestMediaKeySystemAccess&&MediaKeySystemAccess.prototype.getConfiguration||(navigator.requestMediaKeySystemAccess=C_,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=D_,s.MediaKeys=mb,s.MediaKeySystemAccess=KS,s.shakaMediaKeysPolyfill=!0)}function C_(){return Promise.reject(Error("The key system specified is not supported."))}function D_(e){return e==null?Promise.resolve():Promise.reject(Error("MediaKeys not supported."))}function mb(){throw new TypeError("Illegal constructor.")}function KS(){throw this.keySystem="",new TypeError("Illegal constructor.")}function WC(){}function YC(){if(!(!s.HTMLVideoElement||navigator.requestMediaKeySystemAccess&&MediaKeySystemAccess.prototype.getConfiguration)){if(HTMLMediaElement.prototype.webkitGenerateKeyRequest)vb="webkit";else if(!HTMLMediaElement.prototype.generateKeyRequest)return;navigator.requestMediaKeySystemAccess=P_,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=M_,s.MediaKeys=Mv,s.MediaKeySystemAccess=yb,s.shakaMediaKeysPolyfill=!0}}function zS(e){return vb?vb+e.charAt(0).toUpperCase()+e.slice(1):e}function P_(e,n){try{var i=new yb(e,n);return Promise.resolve(i)}catch(o){return Promise.reject(o)}}function M_(e){var n=this.mediaKeys;return n&&n!=e&&QC(n,null),delete this.mediaKeys,(this.mediaKeys=e)&&QC(e,this),Promise.resolve()}function yb(e,n){this.g=this.keySystem=e;var i=!1;e=="org.w3.clearkey"&&(this.g="webkit-org.w3.clearkey",i=!1);var o=!1,h=document.getElementsByTagName("video");h=h.length?h[0]:document.createElement("video");for(var p=(n=T(n)).next();!p.done;p=n.next()){var g={audioCapabilities:[],videoCapabilities:[],persistentState:"optional",distinctiveIdentifier:"optional",initDataTypes:(p=p.value).initDataTypes,sessionTypes:["temporary"],label:p.label},b=!1;if(p.audioCapabilities)for(var w=T(p.audioCapabilities),k=w.next();!k.done;k=w.next())(k=k.value).contentType&&(b=!0,h.canPlayType(k.contentType.split(";")[0],this.g)&&(g.audioCapabilities.push(k),o=!0));if(p.videoCapabilities)for(k=(w=T(p.videoCapabilities)).next();!k.done;k=w.next())(k=k.value).contentType&&(b=!0,h.canPlayType(k.contentType,this.g)&&(g.videoCapabilities.push(k),o=!0));if(b||(o=h.canPlayType("video/mp4",this.g)||h.canPlayType("video/webm",this.g)),p.persistentState=="required"&&(i?(g.persistentState="required",g.sessionTypes=["persistent-license"]):o=!1),o)return void(this.h=g)}throw i="Unsupported keySystem",e!="org.w3.clearkey"&&e!="com.widevine.alpha"||(i="None of the requested configurations were supported."),(e=Error(i)).name="NotSupportedError",e.code=DOMException.NOT_SUPPORTED_ERR,e}function Mv(e){this.l=e,this.h=null,this.g=new mn,this.i=[],this.j=new Map}function QC(e,n){e.h=n,e.g.$a();var i=vb;n&&(e.g.D(n,i+"needkey",function(o){var h=new CustomEvent("encrypted");h.initDataType="cenc",h.initData=bs(o.initData),e.h.dispatchEvent(h)}),e.g.D(n,i+"keymessage",function(o){var h=qS(e,o.sessionId);h&&(o=new dt("message",o=new Map().set("messageType",h.keyStatuses.Pb()==null?"licenserequest":"licenserenewal").set("message",o.message)),h.h&&(h.h.resolve(),h.h=null),h.dispatchEvent(o))}),e.g.D(n,i+"keyadded",function(o){(o=qS(e,o.sessionId))&&(QS(o,"usable"),o.g&&o.g.resolve(),o.g=null)}),e.g.D(n,i+"keyerror",function(o){var h=qS(e,o.sessionId);if(h){var p=Error("EME v0.1b key error"),g=o.errorCode;g.systemCode=o.systemCode,p.errorCode=g,!o.sessionId&&h.h?(o.systemCode==45&&(p.message="Unsupported session type."),h.h.reject(p),h.h=null):o.sessionId&&h.g?(h.g.reject(p),h.g=null):(p=o.systemCode,o.errorCode.code==MediaKeyError.MEDIA_KEYERR_OUTPUT?QS(h,"output-restricted"):QS(h,p==1?"expired":"internal-error"))}}))}function qS(e,n){var i=e.j.get(n);return i||((i=e.i.shift())?(i.sessionId=n,e.j.set(n,i),i):null)}function WS(e,n,i){hn.call(this),this.j=e,this.m=!1,this.g=this.h=null,this.i=n,this.l=i,this.sessionId="",this.expiration=NaN,this.closed=new Pn,this.keyStatuses=new JC}function XC(e,n,i){if(e.m)return Promise.reject(Error("The session is already initialized."));e.m=!0;try{if(e.l=="persistent-license")if(i)var o=Nt(As("LOAD_SESSION|"+i));else{var h=As("PERSISTENT|");o=$n(h,n)}else o=Nt(n)}catch(g){return Promise.reject(g)}e.h=new Pn;var p=zS("generateKeyRequest");try{e.j[p](e.i,o)}catch(g){if(g.name!="InvalidStateError")return e.h=null,Promise.reject(g);new Qt(function(){try{e.j[p](e.i,o)}catch(b){e.h.reject(b),e.h=null}}).U(.01)}return e.h}function YS(e,n,i){if(e.g)e.g.then(function(){return YS(e,n,i)}).catch(function(){return YS(e,n,i)});else{if(e.g=n,e.i=="webkit-org.w3.clearkey"){var o=Wn(i),h=JSON.parse(o);h.keys[0].kty!="oct"&&(e.g.reject(Error("Response is not a valid JSON Web Key Set.")),e.g=null),o=ns(h.keys[0].k),h=ns(h.keys[0].kid)}else o=Nt(i),h=null;var p=zS("addKey");try{e.j[p](e.i,o,h,e.sessionId)}catch(g){e.g.reject(g),e.g=null}}}function QS(e,n){var i=e.keyStatuses;i.size=n==null?0:1,i.g=n,n=new dt("keystatuseschange"),e.dispatchEvent(n)}function JC(){this.size=0,this.g=void 0}Dv.memoizedCanDisplayTypeRequests_=hb,Gi(NC,-1),fi.MediaSource=FC,FC.install=UC,Gi(UC),fi.Orientation=$C,$C.install=jC,Z(fb,hn),fb.prototype.lock=function(e){function n(o){return screen.lockOrientation?screen.lockOrientation(o):screen.mozLockOrientation?screen.mozLockOrientation(o):!!screen.msLockOrientation&&screen.msLockOrientation(o)}var i=!1;switch(e){case"natural":i=n("default");break;case"any":i=!0,this.unlock();break;default:i=n(e)}return i?Promise.resolve():((e=Error("screen.orientation.lock() is not available on this device")).name="NotSupportedError",e.code=DOMException.NOT_SUPPORTED_ERR,Promise.reject(e))},fb.prototype.unlock=function(){screen.unlockOrientation?screen.unlockOrientation():screen.mozUnlockOrientation?screen.mozUnlockOrientation():screen.msUnlockOrientation&&screen.msUnlockOrientation()},Gi(jC),fi.PatchedMediaKeysApple=HS,HS.uninstall=function(){FS&&(FS=!1,Object.defineProperty(HTMLMediaElement.prototype,"mediaKeys",US),HTMLMediaElement.prototype.setMediaKeys=BS,s.MediaKeys=$S,s.MediaKeySystemAccess=jS,navigator.requestMediaKeySystemAccess=GS,US=GS=BS=jS=$S=null,s.shakaMediaKeysPolyfill=!1)},HS.install=function(e){s.HTMLVideoElement&&s.WebKitMediaKeys&&(e!==void 0&&e&&(FS=!0,US=Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype,"mediaKeys"),BS=HTMLMediaElement.prototype.setMediaKeys,$S=s.MediaKeys,jS=s.MediaKeySystemAccess,GS=navigator.requestMediaKeySystemAccess),delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=I_,s.MediaKeys=Pv,s.MediaKeySystemAccess=pb,navigator.requestMediaKeySystemAccess=x_,s.shakaMediaKeysPolyfill=!0)},pb.prototype.createMediaKeys=function(){var e=new Pv(this.keySystem);return Promise.resolve(e)},pb.prototype.getConfiguration=function(){return this.g},Pv.prototype.createSession=function(e){if((e=e||"temporary")!="temporary")throw new TypeError("Session type "+e+" is unsupported on this platform.");return new VS(this.h)},Pv.prototype.setServerCertificate=function(){return Promise.resolve(!1)},Pv.prototype.getStatusForPolicy=function(){return Promise.resolve("usable")},Z(VS,hn),(c=VS.prototype).generateRequest=function(e,n){var i=this;this.h=new Pn;try{var o=this.l.createSession("video/mp4",Nt(n));this.i=o,this.sessionId=o.sessionId||"",this.j.D(this.i,"webkitkeymessage",function(h){i.h&&(i.h.resolve(),i.h=null),h=new dt("message",h=new Map().set("messageType",i.keyStatuses.Pb()==null?"license-request":"license-renewal").set("message",bs(h.message))),i.dispatchEvent(h)}),this.j.D(o,"webkitkeyadded",function(){i.g&&(gb(i,"usable"),i.g.resolve(),i.g=null)}),this.j.D(o,"webkitkeyerror",function(){var h=Error("EME PatchedMediaKeysApple key error");if(h.errorCode=i.i.error,i.h!=null)i.h.reject(h),i.h=null;else if(i.g!=null)i.g.reject(h),i.g=null;else switch(i.i.error.code){case WebKitMediaKeyError.MEDIA_KEYERR_OUTPUT:case WebKitMediaKeyError.MEDIA_KEYERR_HARDWARECHANGE:gb(i,"output-not-allowed");break;default:gb(i,"internal-error")}}),gb(this,"status-pending")}catch(h){this.h.reject(h)}return this.h},c.load=function(){return Promise.reject(Error("MediaKeySession.load not yet supported"))},c.update=function(e){this.g=new Pn;try{this.i.update(Nt(e))}catch(n){this.g.reject(n)}return this.g},c.close=function(){try{this.i.close(),this.closed.resolve(),this.j.$a()}catch(e){this.closed.reject(e)}return this.closed},c.remove=function(){return Promise.reject(Error("MediaKeySession.remove is only applicable for persistent licenses, which are not supported on this platform"))},(c=HC.prototype).Pb=function(){return this.g},c.forEach=function(e){this.g&&e(this.g,Fu.value())},c.get=function(e){if(this.has(e))return this.g},c.has=function(e){var n=Fu.value();return!(!this.g||!vs(e,n))},c.entries=function(){},c.keys=function(){},c.values=function(){},fi.PatchedMediaKeysCert=VC,VC.install=KC,Gi(KC),fi.PatchedMediaKeysNop=zC,zC.install=qC,mb.prototype.createSession=function(){},mb.prototype.setServerCertificate=function(){},mb.prototype.getStatusForPolicy=function(){return Promise.resolve("usable")},KS.prototype.getConfiguration=function(){},KS.prototype.createMediaKeys=function(){},Gi(qC,-10),fi.PatchedMediaKeysWebkit=WC,WC.install=YC,yb.prototype.createMediaKeys=function(){var e=new Mv(this.g);return Promise.resolve(e)},yb.prototype.getConfiguration=function(){return this.h},Mv.prototype.createSession=function(e){if((e=e||"temporary")!="temporary"&&e!="persistent-license")throw new TypeError("Session type "+e+" is unsupported on this platform.");var n=this.h||document.createElement("video");return n.src||(n.src="about:blank"),e=new WS(n,this.l,e),this.i.push(e),e},Mv.prototype.setServerCertificate=function(){return Promise.resolve(!1)},Mv.prototype.getStatusForPolicy=function(){return Promise.resolve("usable")},Z(WS,hn),(c=WS.prototype).generateRequest=function(e,n){return XC(this,n,null)},c.load=function(e){return this.l=="persistent-license"?XC(this,null,e):Promise.reject(Error("Not a persistent session."))},c.update=function(e){var n=new Pn;return YS(this,n,e),n},c.close=function(){if(this.l!="persistent-license"){if(!this.sessionId)return this.closed.reject(Error("The session is not callable.")),this.closed;var e=zS("cancelKeyRequest");try{this.j[e](this.i,this.sessionId)}catch{}}return this.closed.resolve(),this.closed},c.remove=function(){return this.l!="persistent-license"?Promise.reject(Error("Not a persistent session.")):this.close()},(c=JC.prototype).Pb=function(){return this.g},c.forEach=function(e){this.g&&e(this.g,Fu.value())},c.get=function(e){if(this.has(e))return this.g},c.has=function(e){var n=Fu.value();return!(!this.g||!vs(e,n))},c.entries=function(){},c.keys=function(){},c.values=function(){};var vb="";function ZC(){}function e2(){if(s.HTMLVideoElement){var e=HTMLVideoElement.prototype;e.requestPictureInPicture&&document.exitPictureInPicture||!e.webkitSupportsPresentationMode||(document.pictureInPictureEnabled=!0,document.pictureInPictureElement=null,e.requestPictureInPicture=N_,Object.defineProperty(e,"disablePictureInPicture",{get:F_,set:U_,enumerable:!0,configurable:!0}),document.exitPictureInPicture=__,document.addEventListener("webkitpresentationmodechanged",O_,!0))}}function O_(e){if((e=e.target).webkitPresentationMode=="picture-in-picture"){document.pictureInPictureElement=e;var n=new Event("enterpictureinpicture");e.dispatchEvent(n)}else document.pictureInPictureElement==e&&(document.pictureInPictureElement=null),n=new Event("leavepictureinpicture"),e.dispatchEvent(n)}function N_(){return this.webkitSupportsPresentationMode("picture-in-picture")?(this.webkitSetPresentationMode("picture-in-picture"),document.pictureInPictureElement=this,Promise.resolve()):Promise.reject(Error("PiP not allowed by video element"))}function __(){var e=document.pictureInPictureElement;return e?(e.webkitSetPresentationMode("inline"),document.pictureInPictureElement=null,Promise.resolve()):Promise.reject(Error("No picture in picture element found"))}function F_(){return!!this.hasAttribute("disablePictureInPicture")||!this.webkitSupportsPresentationMode("picture-in-picture")}function U_(e){e?this.setAttribute("disablePictureInPicture",""):this.removeAttribute("disablePictureInPicture")}function t2(){}function n2(){s.crypto&&("randomUUID"in s.crypto||(s.crypto.randomUUID=B_))}function B_(){var e=URL.createObjectURL(new Blob),n=e.toString();return URL.revokeObjectURL(e),n.substr(n.lastIndexOf("/")+1)}function r2(){}function i2(){var e=Symbol.prototype;"description"in e||Object.defineProperty(e,"description",{get:$_})}function $_(){var e=/\((.*)\)/.exec(this.toString());return e?e[1]:void 0}function s2(){}function a2(){if(s.HTMLMediaElement){var e=HTMLMediaElement.prototype.play;HTMLMediaElement.prototype.play=function(){var n=e.apply(this);return n&&n.catch(function(){}),n}}}function o2(){}function l2(){if(s.HTMLVideoElement){var e=HTMLVideoElement.prototype;!e.getVideoPlaybackQuality&&("webkitDroppedFrameCount"in e||Wc())&&(e.getVideoPlaybackQuality=j_)}}function j_(){return{droppedVideoFrames:this.webkitDroppedFrameCount,totalVideoFrames:this.webkitDecodedFrameCount,corruptedVideoFrames:0,creationTime:NaN,totalFrameDelay:0}}function u2(){}function c2(){if(!s.VTTCue&&s.TextTrackCue){var e=null,n=TextTrackCue.length;if(n==3)e=XS;else if(n==6)e=G_;else{try{var i=!!XS(1,2,"")}catch{i=!1}i&&(e=XS)}e&&(s.VTTCue=function(o,h,p){return e(o,h,p)})}}function XS(e,n,i){return new s.TextTrackCue(e,n,i)}function G_(e,n,i){return new s.TextTrackCue(e+"-"+n+"-"+i,e,n,i)}function ra(){}Gi(YC),fi.PiPWebkit=ZC,ZC.install=e2,Gi(e2),fi.RandomUUID=t2,t2.install=n2,Gi(n2),fi.Symbol=r2,r2.install=i2,Gi(i2),fi.VideoPlayPromise=s2,s2.install=a2,Gi(a2),fi.VideoPlaybackQuality=o2,o2.install=l2,Gi(l2),fi.VTTCue=u2,u2.install=c2,Gi(c2),ra.prototype.parseInit=function(){},ra.prototype.setSequenceMode=function(){},ra.prototype.setManifestType=function(){},ra.prototype.parseMedia=function(e,n){for(var i=null,o=[],h=(e=T(e=Wn(e).split(/\r?\n/))).next();!h.done;h=e.next())if((h=h.value)&&!/^\s+$/.test(h)&&(h=H_.exec(h))){var p=V_.exec(h[1]);h=new Bn(p=60*parseInt(p[1],10)+parseFloat(p[2].replace(",",".")),n.segmentEnd?n.segmentEnd:p+2,h[2]),i&&(i.endTime=p,o.push(i)),i=h}return i&&o.push(i),o},We("shaka.text.LrcTextParser",ra),ra.prototype.parseMedia=ra.prototype.parseMedia,ra.prototype.setManifestType=ra.prototype.setManifestType,ra.prototype.setSequenceMode=ra.prototype.setSequenceMode,ra.prototype.parseInit=ra.prototype.parseInit;var H_=/^\[(\d{1,2}:\d{1,2}(?:[.,]\d{1,3})?)\](.*)/,V_=/^(\d+):(\d{1,2}(?:[.,]\d{1,3})?)$/;function Ds(){}function d2(e,n,i,o,h,p,g,b,w,k,I,x){var C=e.parentNode;if(e.nodeType==Node.COMMENT_NODE)return null;if(e.nodeType==Node.TEXT_NODE){if(!I)return null;var D=document.createElement("span");D.textContent=e.textContent}else D=e;for(var _=null,j=T(T2),F=j.next();!F.done&&!(_=Eb(D,"backgroundImage",o,"#",F.value)[0]);F=j.next());j=null;var B=Wa(D,T2,"backgroundImage");if(x&&B&&!B.startsWith("#")&&(F=new mr(x),B=new mr(B),(F=F.resolve(B).toString())&&(j=F)),(e.nodeName=="p"||_||j)&&(I=!0),e=I,F=(D.getAttribute("xml:space")||(b?"default":"preserve"))=="default",b=[],!(B=Array.from(D.childNodes).every(function(q){return q.nodeType==Node.TEXT_NODE})))for(var H=T(D.childNodes),Y=H.next();!Y.done;Y=H.next())(Y=d2(Y.value,n,i,o,h,p,g,F,w,D,I,x))&&b.push(Y);if(o=k!=null,x=/\S/.test(D.textContent),!((Y=D.hasAttribute("begin")||D.hasAttribute("end")||D.hasAttribute("dur"))||x||D.tagName=="br"||b.length!=0||o&&!F))return null;for(x=(H=p2(D,i)).start,H=H.end;C&&C.nodeType==Node.ELEMENT_NODE&&C.tagName!="tt";)x=(H=K_(C,i,x,H)).start,H=H.end,C=C.parentNode;if(x==null&&(x=0),x+=n.periodStart,H=H==null?1/0:H+n.periodStart,x=Math.max(x,n.segmentStart),H=Math.min(H,n.segmentEnd),!Y&&0<b.length)for(x=1/0,H=0,i=(n=T(b)).next();!i.done;i=n.next())i=i.value,x=Math.min(x,i.startTime),H=Math.max(H,i.endTime);if(D.tagName=="br")return(h=new Bn(x,H,"")).lineBreak=!0,h;if(n="",B&&(n=D.textContent,F&&(n=(n=n.trim()).replace(/\s+/g," "))),(n=new Bn(x,H,n)).nestedCues=b,I||(n.isContainer=!0),w&&(n.cellResolution=w),w=Eb(D,"region",p,"")[0],D.hasAttribute("region")&&w&&w.getAttribute("xml:id")){var te=w.getAttribute("xml:id");n.region=g.filter(function(q){return q.id==te})[0]}return g=w,k&&o&&!D.getAttribute("region")&&!D.getAttribute("style")&&(g=Eb(k,"region",p,"")[0]),function(q,X,he,ae,me,oe,ge,le){if(Ai(X,he,oe,"direction",ge=ge||le)=="rtl"&&(q.direction="rtl"),(le=Ai(X,he,oe,"writingMode",ge))=="tb"||le=="tblr"?q.writingMode="vertical-lr":le=="tbrl"?q.writingMode="vertical-rl":le=="rltb"||le=="rl"?q.direction="rtl":le&&(q.direction=js),(le=Ai(X,he,oe,"textAlign",!0))?(q.positionAlign=Y_[le],q.lineAlign=W_[le],q.textAlign=hp[le.toUpperCase()]):q.textAlign=ja,(le=Ai(X,he,oe,"displayAlign",!0))&&(q.displayAlign=_m[le.toUpperCase()]),(le=Ai(X,he,oe,"color",ge))&&(q.color=le),(le=Ai(X,he,oe,"backgroundColor",ge))&&(q.backgroundColor=le),(le=Ai(X,he,oe,"border",ge))&&(q.border=le),le=Ai(X,he,oe,"fontFamily",ge))switch(le){case"monospaceSerif":q.fontFamily="Courier New,Liberation Mono,Courier,monospace";break;case"proportionalSansSerif":q.fontFamily="Arial,Helvetica,Liberation Sans,sans-serif";break;case"sansSerif":q.fontFamily="sans-serif";break;case"monospaceSansSerif":q.fontFamily="Consolas,monospace";break;case"proportionalSerif":q.fontFamily="serif";break;default:q.fontFamily=le}switch((le=Ai(X,he,oe,"fontWeight",ge))&&le=="bold"&&(q.fontWeight=700),le=Ai(X,he,oe,"wrapOption",ge),q.wrapLine=!le||le!="noWrap",(le=Ai(X,he,oe,"lineHeight",ge))&&le.match(Zg)&&(q.lineHeight=le),(le=Ai(X,he,oe,"fontSize",ge))&&(le.match(Zg)||le.match(q_))&&(q.fontSize=le),(le=Ai(X,he,oe,"fontStyle",ge))&&(q.fontStyle=fp[le.toUpperCase()]),ae?(me=ae.getAttribute("imageType")||ae.getAttribute("imagetype"),le=ae.getAttribute("encoding"),ae=ae.textContent.trim(),me=="PNG"&&le=="Base64"&&ae&&(q.backgroundImage="data:image/png;base64,"+ae)):me&&(q.backgroundImage=me),(ae=Ai(X,he,oe,"textOutline",ge))&&((ae=ae.split(" "))[0].match(Zg)?q.textStrokeColor=q.color:(q.textStrokeColor=ae[0],ae.shift()),ae[0]&&ae[0].match(Zg)?q.textStrokeWidth=ae[0]:q.textStrokeColor=""),(ae=Ai(X,he,oe,"letterSpacing",ge))&&ae.match(Zg)&&(q.letterSpacing=ae),(ae=Ai(X,he,oe,"linePadding",ge))&&ae.match(Zg)&&(q.linePadding=ae),(ae=Ai(X,he,oe,"opacity",ge))&&(q.opacity=parseFloat(ae)),(ae=bb(he,oe,"textDecoration"))&&h2(q,ae),(ae=JS(X,oe,"textDecoration"))&&h2(q,ae),(ae=Ai(X,he,oe,"textCombine",ge))&&(q.textCombineUpright=ae),Ai(X,he,oe,"ruby",ge)){case"container":q.rubyTag="ruby";break;case"text":q.rubyTag="rt"}}(n,D,g,_,j,h,e,b.length==0),n}function h2(e,n){for(var i=(n=T(n.split(" "))).next();!i.done;i=n.next())switch(i.value){case"underline":e.textDecoration.includes("underline")||e.textDecoration.push("underline");break;case"noUnderline":e.textDecoration.includes("underline")&&Qi(e.textDecoration,"underline");break;case"lineThrough":e.textDecoration.includes("lineThrough")||e.textDecoration.push("lineThrough");break;case"noLineThrough":e.textDecoration.includes("lineThrough")&&Qi(e.textDecoration,"lineThrough");break;case"overline":e.textDecoration.includes("overline")||e.textDecoration.push("overline");break;case"noOverline":e.textDecoration.includes("overline")&&Qi(e.textDecoration,"overline")}}function Ai(e,n,i,o,h){return h=h===void 0||h,(e=JS(e,i,o))?e:h?bb(n,i,o):null}function bb(e,n,i){if(!e)return null;var o=Wa(e,Tb,i);return o||f2(e,n,i)}function JS(e,n,i){var o=Wa(e,Tb,i);return o||f2(e,n,i)}function f2(e,n,i){e=Eb(e,"style",n,"");for(var o=null,h=0;h<e.length;h++){var p=Mu(e[h],"urn:ebu:tt:style",i);p||(p=Wa(e[h],Tb,i)),p||(p=JS(e[h],n,i)),p&&(o=p)}return o}function Eb(e,n,i,o,h){var p=[];if(!e||1>i.length)return p;var g=e;for(e=null;g&&!(e=h?Mu(g,h,n):g.getAttribute(n))&&(g=g.parentNode)instanceof Element;);if(n=e){for(h=(n=T(n.split(" "))).next();!h.done;h=n.next())for(h=h.value,g=(e=T(i)).next();!g.done;g=e.next())if(o+(g=g.value).getAttribute("xml:id")==h){p.push(g);break}}return p}function K_(e,n,i,o){return e=p2(e,n),i==null?i=e.start:e.start!=null&&(i+=e.start),o==null?o=e.end:e.start!=null&&(o+=e.start),{start:i,end:o}}function p2(e,n){var i=ZS(e.getAttribute("begin"),n),o=ZS(e.getAttribute("end"),n);return e=ZS(e.getAttribute("dur"),n),o==null&&e!=null&&(o=i+e),{start:i,end:o}}function ZS(e,n){var i=null;if(g2.test(e)){e=g2.exec(e),i=Number(e[1]);var o=Number(e[2]),h=Number(e[3]),p=Number(e[4]);i=(h+=(p+=(Number(e[5])||0)/n.h)/n.frameRate)+60*o+3600*i}else if(m2.test(e))i=ew(m2,e);else if(y2.test(e))i=ew(y2,e);else if(v2.test(e))e=v2.exec(e),i=Number(e[1])/n.frameRate;else if(b2.test(e))e=b2.exec(e),i=Number(e[1])/n.g;else if(E2.test(e))i=ew(E2,e);else if(e)throw new fe(2,2,2001,"Could not parse cue time range in TTML");return i}function ew(e,n){return(e=e.exec(n))==null||e[0]==""?null:(Number(e[4])||0)/1e3+(Number(e[3])||0)+60*(Number(e[2])||0)+3600*(Number(e[1])||0)}function z_(e,n,i,o){this.frameRate=Number(e)||30,this.h=Number(n)||1,this.g=Number(o),this.g==0&&(this.g=e?this.frameRate*this.h:1),i&&(e=/^(\d+) (\d+)$/g.exec(i))&&(this.frameRate*=Number(e[1])/Number(e[2]))}zn["application/x-subtitle-lrc"]=function(){return new ra},Ds.prototype.parseInit=function(){},Ds.prototype.setSequenceMode=function(){},Ds.prototype.setManifestType=function(){},Ds.prototype.parseMedia=function(e,n,i){var o=Wn(e);if(e=[],o=="")return e;var h=Ou(o,"tt");if(!h)throw new fe(2,2,2005,"Failed to parse TTML.");if(!(o=h.getElementsByTagName("body")[0]))return[];var p=Wa(h,Ov,"frameRate"),g=Wa(h,Ov,"subFrameRate"),b=Wa(h,Ov,"frameRateMultiplier"),w=Wa(h,Ov,"tickRate"),k=Wa(h,Ov,"cellResolution"),I=h.getAttribute("xml:space")||"default",x=Wa(h,Tb,"extent");if(I!="default"&&I!="preserve")throw new fe(2,2,2005,"Invalid xml:space value: "+I);I=I=="default",p=new z_(p,g,b,w),k=k&&(k=/^(\d+) (\d+)$/.exec(k))?{Jb:parseInt(k[1],10),rows:parseInt(k[2],10)}:null,g=(g=h.getElementsByTagName("metadata")[0])?function(te){return Array.from(te.childNodes).filter(function(q){return q instanceof Element})}(g):[],b=Array.from(h.getElementsByTagName("style")),w=[];for(var C=T(h=Array.from(h.getElementsByTagName("region"))),D=C.next();!D.done;D=C.next()){var _=D.value;D=new Es;var j=_.getAttribute("xml:id");if(j){D.id=j;var F=null;x&&(F=tw.exec(x)||nw.exec(x)),j=F?Number(F[1]):null,F=F?Number(F[2]):null;var B,H=bb(_,b,"extent");if(H){var Y=(B=tw.exec(H))||nw.exec(H);Y!=null&&(D.width=Number(Y[1]),D.height=Number(Y[2]),B||(j!=null&&(D.width=100*D.width/j),F!=null&&(D.height=100*D.height/F)),D.widthUnits=B||j!=null?ii:0,D.heightUnits=B||F!=null?ii:0)}(_=bb(_,b,"origin"))&&(Y=(B=tw.exec(_))||nw.exec(_))!=null&&(D.viewportAnchorX=Number(Y[1]),D.viewportAnchorY=Number(Y[2]),B?H||(D.width=100-D.viewportAnchorX,D.widthUnits=ii,D.height=100-D.viewportAnchorY,D.heightUnits=ii):(F!=null&&(D.viewportAnchorY=100*D.viewportAnchorY/F),j!=null&&(D.viewportAnchorX=100*D.viewportAnchorX/j)),D.viewportAnchorUnits=B||j!=null?ii:0)}else D=null;D&&w.push(D)}if(jn(o,"p").length)throw new fe(2,2,2001,"<p> can only be inside <div> in TTML");for(C=(x=T(jn(o,"div"))).next();!C.done;C=x.next())if(jn(C.value,"span").length)throw new fe(2,2,2001,"<span> can only be inside <p> in TTML");return(n=d2(o,n,p,g,b,h,w,I,k,null,!1,i))&&(n.backgroundColor||(n.backgroundColor="transparent"),e.push(n)),e},We("shaka.text.TtmlTextParser",Ds),Ds.prototype.parseMedia=Ds.prototype.parseMedia,Ds.prototype.setManifestType=Ds.prototype.setManifestType,Ds.prototype.setSequenceMode=Ds.prototype.setSequenceMode,Ds.prototype.parseInit=Ds.prototype.parseInit;var tw=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,q_=/^(\d{1,2}(?:\.\d+)?|100)%$/,Zg=/^(\d+px|\d+em|\d*\.?\d+c)$/,nw=/^(\d+)px (\d+)px$/,g2=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,m2=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,y2=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,v2=/^(\d*(?:\.\d*)?)f$/,b2=/^(\d*(?:\.\d*)?)t$/,E2=RegExp("^(?:(\\d*(?:\\.\\d*)?)h)?(?:(\\d*(?:\\.\\d*)?)m)?(?:(\\d*(?:\\.\\d*)?)s)?(?:(\\d*(?:\\.\\d*)?)ms)?$"),W_={left:Gs,center:"center",right:"end",start:Gs,end:"end"},Y_={left:"line-left",center:"center",right:"line-right"},Ov=["http://www.w3.org/ns/ttml#parameter","http://www.w3.org/2006/10/ttaf1#parameter"],Tb=["http://www.w3.org/ns/ttml#styling","http://www.w3.org/2006/10/ttaf1#styling"],T2=["http://www.smpte-ra.org/schemas/2052-1/2010/smpte-tt","http://www.smpte-ra.org/schemas/2052-1/2013/smpte-tt"];function Hi(){this.g=new Ds}function Vi(){this.h=!1,this.g="UNKNOWN"}function S2(e){for(var n=T(Object.entries(H0)),i=n.next();!i.done;i=n.next()){var o=T(i.value);i=o.next().value,o=o.next().value;var h=new Bn(0,0,"");h.color=o,e.set("."+i,h)}for(i=(n=T(Object.entries(V0))).next();!i.done;i=n.next())i=(o=T(i.value)).next().value,o=o.next().value,(h=new Bn(0,0,"")).backgroundColor=o,e.set("."+i,h)}function w2(e,n,i){if(e.includes("<")){i.size===0&&S2(i);e:{for(var o=[],h=-1,p="",g=0;g<e.length;g++)if(e[g]==="/"&&0<g&&e[g-1]==="<"){var b=e.indexOf(">",g);if(b<=g)break e;if((b=e.substring(g+1,b))&&b==="c"){var w=o.pop();w?w===b?(p+="/"+b+">",g+=b.length+1):w.startsWith("c.")?(g+=b.length+1,p+="/"+w+">"):p+=e[g]:p+=e[g]}else p+=e[g]}else e[g]==="<"?e[h=g+1]!="c"&&(h=-1):e[g]===">"&&0<h&&(o.push(e.substr(h,g-h)),h=-1),p+=e[g];e=p}for(o=e,e=[],p=-1,h=0;h<o.length;h++)o[h]==="<"?p=h+1:o[h]===">"&&0<p&&((p=o.substr(p,h-p)).match(x2)&&e.push(p),p=-1);for(h=(e=T(e)).next();!h.done;h=e.next())h=h.value,o=o.replace("<"+h+">",'<div time="'+h+'">'),o+="</div>";e:{for(h=e=o,p=[],g=-1,e="",o=!1,b=0;b<h.length;b++)if(h[b]==="/"){if((w=h.indexOf(">",b))===-1){e=h;break e}if((w=h.substring(b+1,w))&&w=="v"){o=!0;var k=null;if(p.length&&(k=p[p.length-1]),k){if(k===w)e+="/"+w+">";else{if(!k.startsWith("v")){e+=h[b];continue}e+="/"+k+">"}b+=w.length+1}else e+=h[b]}else e+=h[b]}else h[b]==="<"?h[g=b+1]!="v"&&(g=-1):h[b]===">"&&0<g&&(p.push(h.substr(g,b-g)),g=-1),e+=h[b];for(p=(h=T(p)).next();!p.done;p=h.next())g=(p=p.value).replace(" ",".voice-"),e=(e=e.replace("<"+p+">","<"+g+">")).replace("</"+p+">","</"+g+">"),o||(e+="</"+g+">")}if(o=Ou("<span>"+e+"</span>","span")){if((o=o.childNodes).length==1&&((h=o[0]).nodeType==Node.TEXT_NODE||h.nodeType==Node.CDATA_SECTION_NODE))return void(n.payload=wb(e));for(o=(e=T(o)).next();!o.done;o=e.next())A2(o.value,n,i)}else n.payload=wb(e)}else n.payload=wb(e)}function Nv(e,n){return e&&0<e.length?e:n}function A2(e,n,i){var o=n.clone();if(o.nestedCues=[],o.payload="",o.rubyTag="",o.line=null,o.region=new Es,o.position=null,o.size=0,e.nodeType===Node.ELEMENT_NODE&&e.nodeName)for(var h=T(e.nodeName.split(/(?=[ .])+/g)),p=h.next();!p.done;p=h.next()){var g=p=p.value;if(g.startsWith(".voice-")){var b=g.split("-").pop();g='v[voice="'+b+'"]',i.has(g)||(g="v[voice="+b+"]")}switch(i.has(g)&&(g=i.get(g))&&(o.backgroundColor=Nv(g.backgroundColor,o.backgroundColor),o.color=Nv(g.color,o.color),o.fontFamily=Nv(g.fontFamily,o.fontFamily),o.fontSize=Nv(g.fontSize,o.fontSize),o.textShadow=Nv(g.textShadow,o.textShadow),o.fontWeight=g.fontWeight,o.fontStyle=g.fontStyle,o.opacity=g.opacity,o.rubyTag=g.rubyTag,o.textCombineUpright=g.textCombineUpright,o.wrapLine=g.wrapLine),p){case"br":return o=Nm(o.startTime,o.endTime),void n.nestedCues.push(o);case"b":o.fontWeight=700;break;case"i":o.fontStyle="italic";break;case"u":o.textDecoration.push("underline");break;case"font":(p=e.getAttribute("color"))&&(o.color=p);break;case"div":if(!(p=e.getAttribute("time")))break;(p=Sb(new yf(p)))&&(o.startTime=p);break;case"ruby":case"rp":case"rt":o.rubyTag=p}}if(h=e.childNodes,Lh(e)||h.length==1&&Lh(h[0]))for(h=!0,i=T(e.textContent.split(`
`)),e=i.next();!e.done;e=i.next())e=e.value,h||(h=Nm(o.startTime,o.endTime),n.nestedCues.push(h)),0<e.length&&((h=o.clone()).payload=wb(e),n.nestedCues.push(h)),h=!1;else for(n.nestedCues.push(o),e=(n=T(h)).next();!e.done;e=n.next())A2(e.value,o,i)}function k2(e,n,i){var o;(o=/^align:(start|middle|center|end|left|right)$/.exec(n))?(n=o[1],e.textAlign=n=="middle"?ja:hp[n.toUpperCase()]):(o=/^vertical:(lr|rl)$/.exec(n))?e.writingMode=o[1]=="lr"?"vertical-lr":"vertical-rl":(o=/^size:([\d.]+)%$/.exec(n))?e.size=Number(o[1]):(o=/^position:([\d.]+)%(?:,(line-left|line-right|middle|center|start|end|auto))?$/.exec(n))?(e.position=Number(o[1]),o[2]&&(n=o[2],e.positionAlign=n=="line-left"||n=="start"?"line-left":n=="line-right"||n=="end"?"line-right":n=="center"||n=="middle"?"center":Tl)):(o=/^region:(.*)$/.exec(n))?(n=function(h,p){return h=h.filter(function(g){return g.id==p}),h.length?h[0]:null}(i,o[1]))&&(e.region=n):(i=/^line:([\d.]+)%(?:,(start|end|center))?$/.exec(n))?(e.lineInterpretation=1,e.line=Number(i[1]),i[2]&&(e.lineAlign=dh[i[2].toUpperCase()])):(i=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(n))&&(e.lineInterpretation=mi,e.line=Number(i[1]),i[2]&&(e.lineAlign=dh[i[2].toUpperCase()]))}function Sb(e){if((e=Nd(e,x2))==null)return null;var n=Number(e[2]),i=Number(e[3]);return 59<n||59<i?null:Number(e[4])/1e3+i+60*n+3600*(Number(e[1])||0)}function wb(e){var n={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'","&nbsp;":" ","&lrm;":"‎","&rlm;":"‏"},i=/&(?:amp|lt|gt|quot|#(0+)?39|nbsp|lrm|rlm);/g,o=RegExp(i.source);return e&&o.test(e)?e.replace(i,function(h){return n[h]||"'"}):e||""}zn["application/ttml+xml"]=function(){return new Ds},Hi.prototype.parseInit=function(e){var n=!1;if(new _n().box("moov",cn).box("trak",cn).box("mdia",cn).box("minf",cn).box("stbl",cn).O("stsd",qa).box("stpp",function(i){n=!0,i.parser.stop()}).parse(e),!n)throw new fe(2,2,2007)},Hi.prototype.setSequenceMode=function(){},Hi.prototype.setManifestType=function(){},Hi.prototype.parseMedia=function(e,n,i){var o=this,h=!1,p=[];if(new _n().box("mdat",Po(function(g){h=!0,p=p.concat(o.g.parseMedia(g,n,i))})).parse(e,!1),!h)throw new fe(2,2,2007);return p},We("shaka.text.Mp4TtmlParser",Hi),Hi.prototype.parseMedia=Hi.prototype.parseMedia,Hi.prototype.setManifestType=Hi.prototype.setManifestType,Hi.prototype.setSequenceMode=Hi.prototype.setSequenceMode,Hi.prototype.parseInit=Hi.prototype.parseInit,zn['application/mp4; codecs="stpp"']=function(){return new Hi},zn['application/mp4; codecs="stpp.ttml"']=function(){return new Hi},zn['application/mp4; codecs="stpp.ttml.im1t"']=function(){return new Hi},zn['application/mp4; codecs="stpp.TTML.im1t"']=function(){return new Hi},Vi.prototype.parseInit=function(){},Vi.prototype.setSequenceMode=function(e){this.h=e},Vi.prototype.setManifestType=function(e){this.g=e},Vi.prototype.parseMedia=function(e,n){var i=(e=(e=Wn(e)).replace(/\r\n|\r(?=[^\n]|$)/gm,`
`)).split(/\n{2,}/m);if(!/^WEBVTT($|[ \t\n])/m.test(i[0]))throw new fe(2,2,2e3);if(e=n.vttOffset,i[0].includes("X-TIMESTAMP-MAP")&&this.g=="HLS")if(this.h){var o=i[0];if(e=o.match(/LOCAL:((?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{3}))/m),o=o.match(/MPEGTS:(\d+)/m),!e||!o)throw new fe(2,2,2e3);if((e=Sb(new yf(e[1])))==null)throw new fe(2,2,2e3);e=n.periodStart+Number(o[1])/9e4-e}else e=n.segmentStart;n=[];for(var h=(o=T(i[0].split(`
`))).next();!h.done;h=o.next())if(h=h.value,/^Region:/.test(h)){h=new yf(h);var p=new Es;vf(h),qg(h);for(var g=vf(h);g;){var b=p,w=g;(g=/^id=(.*)$/.exec(w))?b.id=g[1]:(g=/^width=(\d{1,2}|100)%$/.exec(w))?b.width=Number(g[1]):(g=/^lines=(\d+)$/.exec(w))?(b.height=Number(g[1]),b.heightUnits=2):(g=/^regionanchor=(\d{1,2}|100)%,(\d{1,2}|100)%$/.exec(w))?(b.regionAnchorX=Number(g[1]),b.regionAnchorY=Number(g[2])):(g=/^viewportanchor=(\d{1,2}|100)%,(\d{1,2}|100)%$/.exec(w))?(b.viewportAnchorX=Number(g[1]),b.viewportAnchorY=Number(g[2])):/^scroll=up$/.exec(w)&&(b.scroll="up"),qg(h),g=vf(h)}n.push(p)}for(S2(o=new Map),h=[],p=(i=T(i.slice(1))).next();!p.done;p=i.next()){if(((p=p.value.split(`
`)).length!=1||p[0])&&!/^NOTE($|[ \t])/.test(p[0])&&p[0]=="STYLE"){for(b=[],g=-1,w=1;w<p.length;w++)p[w].includes("::cue")&&(b.push([]),g=b.length-1),g!=-1&&(b[g].push(p[w]),p[w].includes("}")&&(g=-1));for(g=(b=T(b)).next();!g.done;g=b.next()){var k=g.value;g="global",(w=k[0].match(/\((.*)\)/))&&(g=w.pop()),w=k.slice(1,-1),k[0].includes("}")&&(k=/\{(.*?)\}/.exec(k[0]))&&(w=k[1].split(";")),(k=o.get(g))||(k=new Bn(0,0,""));for(var I=!1,x=0;x<w.length;x++){var C=/^\s*([^:]+):\s*(.*)/.exec(w[x]);if(C){var D=C[2].trim().replace(";","");switch(C[1].trim()){case"background-color":case"background":I=!0,k.backgroundColor=D;break;case"color":I=!0,k.color=D;break;case"font-family":I=!0,k.fontFamily=D;break;case"font-size":I=!0,k.fontSize=D;break;case"font-weight":(700<=parseInt(D,10)||D=="bold")&&(I=!0,k.fontWeight=700);break;case"font-style":switch(D){case"normal":I=!0,k.fontStyle=pu;break;case"italic":I=!0,k.fontStyle="italic";break;case"oblique":I=!0,k.fontStyle="oblique"}break;case"opacity":I=!0,k.opacity=parseFloat(D);break;case"text-combine-upright":I=!0,k.textCombineUpright=D;break;case"text-shadow":I=!0,k.textShadow=D;break;case"white-space":I=!0,k.wrapLine=D!="noWrap"}}}I&&o.set(g,k)}}if(I=e,p.length==1&&!p[0]||/^NOTE($|[ \t])/.test(p[0])||p[0]=="STYLE"||p[0]=="REGION")p=null;else if(b=null,p[0].includes("-->")||(b=p[0],p.splice(0,1)),w=Sb(g=new yf(p[0])),x=Nd(g,/[ \t]+--\x3e[ \t]+/g),k=Sb(g),w==null||x==null||k==null)Rt("Failed to parse VTT time code. Cue skipped:",b,p),p=null;else{for(w+=I,k+=I,p=p.slice(1).join(`
`).trim(),o.has("global")?((I=o.get("global").clone()).startTime=w,I.endTime=k,I.payload=""):I=new Bn(w,k,""),qg(g),w=vf(g);w;)k2(I,w,n),qg(g),w=vf(g);w2(p,I,o),b!=null&&(I.id=b),p=I}p&&h.push(p)}return h},We("shaka.text.VttTextParser",Vi),Vi.prototype.parseMedia=Vi.prototype.parseMedia,Vi.prototype.setManifestType=Vi.prototype.setManifestType,Vi.prototype.setSequenceMode=Vi.prototype.setSequenceMode,Vi.prototype.parseInit=Vi.prototype.parseInit;var x2=/(?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{2,3})/g;function ia(){this.g=null}function Q_(e,n,i){var o,h,p;return new _n().box("payl",Po(function(g){o=Wn(g)})).box("iden",Po(function(g){h=Wn(g)})).box("sttg",Po(function(g){p=Wn(g)})).parse(e),o?function(g,b,w,k,I){if(k=new Bn(k,I,""),w2(g,k,new Map),b&&(k.id=b),w)for(g=new yf(w),b=vf(g);b;)k2(k,b,[]),qg(g),b=vf(g);return k}(o,h,p,n,i):null}function sa(){}function I2(e){if((e=Nd(e,/(?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{2,3})/g))==null)return null;var n=Number(e[2]),i=Number(e[3]);return 59<n||59<i?null:Number(e[4])/1e3+i+60*n+3600*(Number(e[1])||0)}function Ps(){this.g=new Vi}function L2(e){var n=`WEBVTT

`;if(e=="")return n;for(var i=(e=T((e=(e=e.replace(/\r+/g,"")).trim()).split(`

`))).next();!i.done;i=e.next())(i=i.value.split(/\n/))[0].match(/\d+/)&&i.shift(),i[0]=i[0].replace(/,/g,"."),n+=i.join(`
`).replace(/{b}/g,"<b>").replace(/{\/b}/g,"</b>").replace(/{i}/g,"<i>").replace(/{\/i}/g,"</i>").replace(/{u}/g,"<u>").replace(/{\/u}/g,"</u>")+`

`;return n}function aa(){}function X_(e,n){var i=n.Fontname;if(i&&(e.fontFamily=i),(i=n.Fontsize)&&(e.fontSize=i+"px"),(i=n.PrimaryColour)&&(i=R2(i))&&(e.color=i),(i=n.BackColour)&&(i=R2(i))&&(e.backgroundColor=i),n.Bold&&(e.fontWeight=700),n.Italic&&(e.fontStyle="italic"),n.Underline&&e.textDecoration.push("underline"),(i=n.Spacing)&&(e.letterSpacing=i+"px"),i=n.Alignment)switch(parseInt(i,10)){case 1:e.displayAlign=jc,e.textAlign="start";break;case 2:e.displayAlign=jc,e.textAlign=ja;break;case 3:e.displayAlign=jc,e.textAlign="end";break;case 5:e.displayAlign="before",e.textAlign="start";break;case 6:e.displayAlign="before",e.textAlign=ja;break;case 7:e.displayAlign="before",e.textAlign="end";break;case 9:e.displayAlign="center",e.textAlign="start";break;case 10:e.displayAlign="center",e.textAlign=ja;break;case 11:e.displayAlign="center",e.textAlign="end"}(n=n.AlphaLevel)&&(e.opacity=parseFloat(n))}function R2(e){return 0<=(e=parseInt(e.replace("&H",""),16))?"rgba("+(255&e)+","+(e>>8&255)+","+(e>>16&255)+","+(e>>24&255^255)/255+")":null}function C2(e){return 3600*((e=Z_.exec(e))[1]?parseInt(e[1].replace(":",""),10):0)+60*parseInt(e[2],10)+parseFloat(e[3])}zn["text/vtt"]=function(){return new Vi},zn['text/vtt; codecs="vtt"']=function(){return new Vi},zn['text/vtt; codecs="wvtt"']=function(){return new Vi},ia.prototype.parseInit=function(e){var n=this,i=!1;if(new _n().box("moov",cn).box("trak",cn).box("mdia",cn).O("mdhd",function(o){o=Bu(o.reader,o.version),n.g=o.timescale}).box("minf",cn).box("stbl",cn).O("stsd",qa).box("wvtt",function(){i=!0}).parse(e),!this.g)throw new fe(2,2,2008);if(!i)throw new fe(2,2,2008)},ia.prototype.setSequenceMode=function(){},ia.prototype.setManifestType=function(){},ia.prototype.parseMedia=function(e,n){if(!e.length)return[];if(!this.g)throw new fe(2,2,2008);var i,o=0,h=[],p=[],g=!1,b=!1,w=!1,k=null;if(new _n().box("moof",cn).box("traf",cn).O("tfdt",function(H){g=!0,o=ld(H.reader,H.version).baseMediaDecodeTime}).O("tfhd",function(H){k=Ty(H.reader,H.flags).Kf}).O("trun",function(H){b=!0,h=Sy(H.reader,H.version,H.flags).ig}).box("mdat",Po(function(H){w=!0,i=H})).parse(e,!1),!w&&!g&&!b)throw new fe(2,2,2008);e=o;for(var I=new xn(i,0),x=T(h),C=x.next();!C.done;C=x.next()){var D=(C=C.value).hf||k,_=C.Xd?o+C.Xd:e;e=_+(D||0);var j=0;do{var F=I.M();j+=F;var B=null;Ih(I.M())=="vttc"?8<F&&(B=I.rb(F-8)):I.skip(F-8),D&&B&&(F=Q_(B,n.periodStart+_/this.g,n.periodStart+e/this.g),p.push(F))}while(C.sampleSize&&j<C.sampleSize)}return p.filter(Va)},We("shaka.text.Mp4VttParser",ia),ia.prototype.parseMedia=ia.prototype.parseMedia,ia.prototype.setManifestType=ia.prototype.setManifestType,ia.prototype.setSequenceMode=ia.prototype.setSequenceMode,ia.prototype.parseInit=ia.prototype.parseInit,zn['application/mp4; codecs="wvtt"']=function(){return new ia},sa.prototype.parseInit=function(){},sa.prototype.setSequenceMode=function(){},sa.prototype.setManifestType=function(){},sa.prototype.parseMedia=function(e){var n=Wn(e).replace(/\r+/g,"");if(e=[],(n=n.trim())=="")return e;for(var i=(n=T(n.split(`

`))).next();!i.done;i=n.next()){var o=new yf((i=i.value.split(`
`))[0]),h=I2(o),p=Nd(o,/,/g);if(o=I2(o),h==null||p==null||o==null)throw new fe(2,2,2001,"Could not parse cue time range in SubViewer");e.push(new Bn(h,o,i.slice(1).join(`
`).trim()))}return e},We("shaka.text.SbvTextParser",sa),sa.prototype.parseMedia=sa.prototype.parseMedia,sa.prototype.setManifestType=sa.prototype.setManifestType,sa.prototype.setSequenceMode=sa.prototype.setSequenceMode,sa.prototype.parseInit=sa.prototype.parseInit,zn["text/x-subviewer"]=function(){return new sa},Ps.prototype.parseInit=function(){},Ps.prototype.setSequenceMode=function(){},Ps.prototype.setManifestType=function(){},Ps.prototype.parseMedia=function(e,n,i){return e=Nt(As(e=L2(e=Wn(e)))),this.g.parseMedia(e,n,i)},We("shaka.text.SrtTextParser",Ps),Ps.srt2webvtt=L2,Ps.prototype.parseMedia=Ps.prototype.parseMedia,Ps.prototype.setManifestType=Ps.prototype.setManifestType,Ps.prototype.setSequenceMode=Ps.prototype.setSequenceMode,Ps.prototype.parseInit=Ps.prototype.parseInit,zn["text/srt"]=function(){return new Ps},aa.prototype.parseInit=function(){},aa.prototype.setSequenceMode=function(){},aa.prototype.setManifestType=function(){},aa.prototype.parseMedia=function(e){for(var n="",i="",o=(e=T(e=Wn(e).split(/\r?\n\s*\r?\n/))).next();!o.done;o=e.next()){var h=J_.exec(o.value);h&&(o=h[1],h=h[2],o=="V4 Styles"||o=="V4+ Styles"?n=h:o=="Events"&&(i=h))}e=[],o=null;for(var p=(n=T(n.split(/\r?\n/))).next();!p.done;p=n.next())if(h=p.value,!/^\s*;/.test(h)&&(p=D2.exec(h))){if(h=p[1].trim(),p=p[2].trim(),h=="Format")o=p.split(Ab);else if(h=="Style"){h=p.split(Ab),p={};for(var g=0;g<o.length&&g<h.length;g++)p[o[g]]=h[g];e.push(p)}}for(o=[],n=null,h={},p=(i=T(i.split(/\r?\n/))).next();!p.done;h={fe:h.fe},p=i.next())if(p=p.value,!/^\s*;/.test(p)&&(g=D2.exec(p))){if(p=g[1].trim(),g=g[2].trim(),p=="Format")n=g.split(Ab);else if(p=="Dialogue"){g=g.split(Ab),p={};for(var b=0;b<n.length&&b<g.length;b++)p[n[b]]=g[b];g=new Bn(b=C2(p.Start),C2(p.End),g.slice(n.length-1).join(",").replace(/\\N/g,`
`).replace(/\{[^}]+\}/g,"")),h.fe=p.Style,(p=e.find(function(w){return function(k){return k.Name==w.fe}}(h)))&&X_(g,p),o.push(g)}}return o},We("shaka.text.SsaTextParser",aa),aa.prototype.parseMedia=aa.prototype.parseMedia,aa.prototype.setManifestType=aa.prototype.setManifestType,aa.prototype.setSequenceMode=aa.prototype.setSequenceMode,aa.prototype.parseInit=aa.prototype.parseInit;var J_=/^\s*\[([^\]]+)\]\r?\n([\s\S]*)/,D2=/^\s*([^:]+):\s*(.*)/,Ab=/\s*,\s*/,Z_=/^(\d+:)?(\d{1,2}):(\d{1,2}(?:[.]\d{1,3})?)?$/;function P2(e,n){var i=1&e[n+1]?7:9;return n+i<=e.length&&0<(e=((3&e[n+3])<<11|e[n+4]<<3|(224&e[n+5])>>>5)-i)?{Hd:i,S:e}:null}function M2(e,n){var i=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],o=(60&e[n+2])>>>2;if(o>i.length-1)return null;var h=1+((192&e[n+2])>>>6),p=(1&e[n+2])<<2;return p|=(192&e[n+3])>>>6,{sampleRate:i[o],channelCount:p,ja:"mp4a.40."+h}}function O2(e,n){if(n+1<e.length&&e[n]===255&&(246&e[n+1])==240){var i=1&e[n+1]?7:9;if(n+i>=e.length)return!1;var o=(3&e[n+3])<<11|e[n+4]<<3|(224&e[n+5])>>>5;return!(o<=i)&&((n+=o)===e.length||n+1<e.length&&e[n]===255&&(246&e[n+1])==240)}return!1}function oa(e){this.i=e,this.h=0,this.g=new Map}function N2(e,n){if(n+8>e.length||e[n]!==11||e[n+1]!==119)return null;var i=e[n+4]>>6;if(3<=i)return null;var o=63&e[n+4],h=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*o+i];if(n+h>e.length)return null;var p=e[n+6]>>5,g=0;p===2?g+=2:(1&p&&p!==1&&(g+=2),4&p&&(g+=2)),g=(e[n+6]<<8|e[n+7])>>12-g&1;var b=7&e[n+5];return e=new Uint8Array([i<<6|e[n+5]>>3<<1|b>>2,(3&b)<<6|p<<3|g<<2|o>>4,o<<4&224]),{sampleRate:[48e3,44100,32e3][i],channelCount:[2,1,2,3,3,4,4,5][p]+g,da:e,S:h}}function e3(e,n){if(e[n]===11&&e[n+1]===119){var i,o,h=0,p=5;for(n+=p;0<p;){o=e[n];var g=Math.min(p,8),b=8-g;i=(o&(i=4278190080>>>24+b<<b))>>b,h=h?h<<g|i:i,n+=1,p-=g}if(16>h)return!0}return!1}function xa(e){this.i=e,this.h=0,this.g=new Map}function _2(e,n){if(n+8>e.length||(e[n]<<8|e[n+1])!=2935)return null;var i=new eo(e.subarray(n+2));bi(i,2),bi(i,3);var o=Ut(i,11)+1<<1,h=Ut(i,2);if(h==3){h=[24e3,22060,16e3][h=Ut(i,2)];var p=3}else h=[48e3,44100,32e3][h],p=Ut(i,2);var g=Ut(i,3),b=Ut(i,1);return i=Ut(i,5),n+o>e.byteLength?null:(e=Math.floor(o*h/(16*[1,2,3,6][p])),e=new Uint8Array([(8160&e)>>5,(31&e)<<3,h<<6|i<<1,g<<1|b,0]),{sampleRate:h,channelCount:[2,1,2,3,3,4,4,5][g]+b,da:e,S:o})}function Ia(e){this.i=e,this.h=0,this.g=new Map}function t3(e){for(var n=!1,i=[],o=e.find(function(w){return w.type==7}),h=!1,p=(e=T(e)).next();!p.done;p=e.next()){var g=!1;switch((p=p.value).type){case 1:g=h=!0;var b=p.data;o&&4<b.length&&((b=l1(new eo(b)))===2||b===4||b===7||b===9)&&(n=!0);break;case 5:n=g=h=!0;break;case 6:case 7:case 8:case 12:g=!0;break;case 9:h=g=!0;break;default:g=!1}h&&g&&(g=p.fullData.byteLength,(b=new Uint8Array(4))[0]=g>>24&255,b[1]=g>>16&255,b[2]=g>>8&255,b[3]=255&g,i.push(b),i.push(p.fullData))}return i.length?{data:$n.apply(Kr,M(i)),Xc:n}:null}zn["text/x-ssa"]=function(){return new aa},(c=oa.prototype).destroy=function(){this.g.clear()},c.isSupported=function(e){return e.toLowerCase().split(";")[0]=="audio/aac"&&Dn(this.convertCodecs("audio",e))},c.convertCodecs=function(e,n){return n.toLowerCase().split(";")[0]=="audio/aac"?'audio/mp4; codecs="'+(Ci(n)||"mp4a.40.2")+'"':n},c.getOriginalMimeType=function(){return this.i},c.transmux=function(e,n,i,o){for(var h=Nt(e),p=Ta(h),g=p.length;g<h.length&&!O2(h,g);g++);if(e=1e3*i.endTime,(p=_l(p)).length&&i&&(i=p.find(function(k){return k.description==="com.apple.streaming.transportStreamTimestamp"}))&&(e=i.data),!(i=M2(h,g)))return Promise.reject(new fe(2,3,3018));for(n.audioSamplingRate=i.sampleRate,n.channelsCount=i.channelCount,p=[];g<h.length;){var b=P2(h,g);if(!b)return Promise.reject(new fe(2,3,3018));var w=b.Hd+b.S;g+w<=h.length&&p.push({data:h.subarray(g+b.Hd,g+w),size:b.S,duration:1024,Ua:0,flags:{Va:0,La:0,Ja:0,Ha:0,Ia:2,Wa:0}}),g+=w}return h=i.sampleRate,e=Math.floor(e*h/1e3),e=new Qg([o={id:n.id,type:"audio",codecs:i.ja,encrypted:n.encrypted&&0<n.drmInfos.length,timescale:h,duration:o,Ta:[],da:new Uint8Array([]),la:new Uint8Array([]),qa:0,sa:0,data:{hb:this.h,baseMediaDecodeTime:e,Oa:p},stream:n}]),this.g.has(n.id)?o=this.g.get(n.id):(o=Xg(e),this.g.set(n.id,o)),n=kv(e),this.h++,n=$n(o,n),Promise.resolve(n)},We("shaka.transmuxer.AacTransmuxer",oa),oa.prototype.transmux=oa.prototype.transmux,oa.prototype.getOriginalMimeType=oa.prototype.getOriginalMimeType,oa.prototype.convertCodecs=oa.prototype.convertCodecs,oa.prototype.isSupported=oa.prototype.isSupported,oa.prototype.destroy=oa.prototype.destroy,gr("audio/aac",function(){return new oa("audio/aac")},Xi),(c=xa.prototype).destroy=function(){this.g.clear()},c.isSupported=function(e){return e.toLowerCase().split(";")[0]=="audio/ac3"&&Dn(this.convertCodecs("audio",e))},c.convertCodecs=function(e,n){return n.toLowerCase().split(";")[0]=="audio/ac3"?'audio/mp4; codecs="ac-3"':n},c.getOriginalMimeType=function(){return this.i},c.transmux=function(e,n,i,o){for(var h=Ta(e=Nt(e)),p=h.length;p<e.length&&!e3(e,p);p++);var g=1e3*i.endTime;(h=_l(h)).length&&i&&(i=h.find(function(k){return k.description==="com.apple.streaming.transportStreamTimestamp"}))&&(g=i.data),i=0,h=new Uint8Array([]);for(var b=[];p<e.length;){var w=N2(e,p);if(!w)return Promise.reject(new fe(2,3,3018));n.audioSamplingRate=w.sampleRate,n.channelsCount=w.channelCount,i=w.sampleRate,h=w.da,b.push({data:e.subarray(p,p+w.S),size:w.S,duration:1536,Ua:0,flags:{Va:0,La:0,Ja:0,Ha:0,Ia:2,Wa:0}}),p+=w.S}return e=Math.floor(g*i/1e3),e=new Qg([o={id:n.id,type:"audio",codecs:"ac-3",encrypted:n.encrypted&&0<n.drmInfos.length,timescale:i,duration:o,Ta:[],da:h,la:new Uint8Array([]),qa:0,sa:0,data:{hb:this.h,baseMediaDecodeTime:e,Oa:b},stream:n}]),this.g.has(n.id)?o=this.g.get(n.id):(o=Xg(e),this.g.set(n.id,o)),n=kv(e),this.h++,n=$n(o,n),Promise.resolve(n)},We("shaka.transmuxer.Ac3Transmuxer",xa),xa.prototype.transmux=xa.prototype.transmux,xa.prototype.getOriginalMimeType=xa.prototype.getOriginalMimeType,xa.prototype.convertCodecs=xa.prototype.convertCodecs,xa.prototype.isSupported=xa.prototype.isSupported,xa.prototype.destroy=xa.prototype.destroy,gr("audio/ac3",function(){return new xa("audio/ac3")},Xi),(c=Ia.prototype).destroy=function(){this.g.clear()},c.isSupported=function(e){return e.toLowerCase().split(";")[0]=="audio/ec3"&&Dn(this.convertCodecs("audio",e))},c.convertCodecs=function(e,n){return n.toLowerCase().split(";")[0]=="audio/ec3"?'audio/mp4; codecs="ec-3"':n},c.getOriginalMimeType=function(){return this.i},c.transmux=function(e,n,i,o){for(var h=Ta(e=Nt(e)),p=h.length;p<e.length&&(e[p]<<8|e[p+1])!=2935;p++);var g=1e3*i.endTime;(h=_l(h)).length&&i&&(i=h.find(function(k){return k.description==="com.apple.streaming.transportStreamTimestamp"}))&&(g=i.data),i=0,h=new Uint8Array([]);for(var b=[];p<e.length;){var w=_2(e,p);if(!w)return Promise.reject(new fe(2,3,3018));n.audioSamplingRate=w.sampleRate,n.channelsCount=w.channelCount,i=w.sampleRate,h=w.da,b.push({data:e.subarray(p,p+w.S),size:w.S,duration:1536,Ua:0,flags:{Va:0,La:0,Ja:0,Ha:0,Ia:2,Wa:0}}),p+=w.S}return e=Math.floor(g*i/1e3),e=new Qg([o={id:n.id,type:"audio",codecs:"ec-3",encrypted:n.encrypted&&0<n.drmInfos.length,timescale:i,duration:o,Ta:[],da:h,la:new Uint8Array([]),qa:0,sa:0,data:{hb:this.h,baseMediaDecodeTime:e,Oa:b},stream:n}]),this.g.has(n.id)?o=this.g.get(n.id):(o=Xg(e),this.g.set(n.id,o)),n=kv(e),this.h++,n=$n(o,n),Promise.resolve(n)},We("shaka.transmuxer.Ec3Transmuxer",Ia),Ia.prototype.transmux=Ia.prototype.transmux,Ia.prototype.getOriginalMimeType=Ia.prototype.getOriginalMimeType,Ia.prototype.convertCodecs=Ia.prototype.convertCodecs,Ia.prototype.isSupported=Ia.prototype.isSupported,Ia.prototype.destroy=Ia.prototype.destroy,gr("audio/ec3",function(){return new Ia("audio/ec3")},Xi);var n3=[100,110,122,244,44,83,86,118,128,138,139,134];function r3(e){if(!e.length)return null;var n=e.find(function(g){return g.type==32}),i=e.find(function(g){return g.type==33}),o=e.find(function(g){return g.type==34});if(!n||!i||!o)return null;var h=function(g){var b=new eo(g,!0);return sn(b),sn(b),Ut(b,4),Ut(b,2),Ut(b,6),g=Ut(b,3),b=ht(b),{Ye:g+1,uf:b}}(n.fullData);e=function(g){sn(g=new eo(g,!0)),sn(g);var b=0,w=0,k=0,I=0;Ut(g,4);var x=Ut(g,3);ht(g);for(var C=Ut(g,2),D=Ut(g,1),_=Ut(g,5),j=sn(g),F=sn(g),B=sn(g),H=sn(g),Y=sn(g),te=sn(g),q=sn(g),X=sn(g),he=sn(g),ae=sn(g),me=sn(g),oe=[],ge=[],le=0;le<x;le++)oe.push(ht(g)),ge.push(ht(g));if(0<x)for(le=x;8>le;le++)Ut(g,2);for(le=0;le<x;le++)oe[le]&&Ut(g,88),ge[le]&&sn(g);tt(g),(oe=tt(g))==3&&Ut(g,1),ge=tt(g),le=tt(g),ht(g)&&(b+=tt(g),w+=tt(g),k+=tt(g),I+=tt(g));var Ee=tt(g),ve=tt(g),Be=tt(g);if(ht(g))for(var _e=0;_e<=x;_e++)tt(g),tt(g),tt(g);else tt(g),tt(g),tt(g);if(tt(g),tt(g),tt(g),tt(g),tt(g),tt(g),ht(g)&&ht(g))for(_e=0;4>_e;_e++)for(var Ye=0;Ye<(_e===3?2:6);Ye++)if(ht(g)){var Ve=Math.min(64,1<<4+(_e<<1));1<_e&&$u(g);for(var be=0;be<Ve;be++)$u(g)}else tt(g);for(ht(g),ht(g),ht(g)&&(sn(g),tt(g),tt(g),ht(g)),_e=tt(g),Ve=Ye=0;Ve<_e;Ve++)if(be=!1,Ve!==0&&(be=ht(g)),be){Ve===_e&&tt(g),ht(g),tt(g);for(var ke=be=0;ke<=Ye;ke++){var Ae=ht(g),He=!1;Ae||(He=ht(g)),(Ae||He)&&be++}Ye=be}else{for(Ye=(ke=tt(g))+(be=tt(g)),Ae=0;Ae<ke;Ae++)tt(g),ht(g);for(ke=0;ke<be;ke++)tt(g),ht(g)}if(ht(g))for(_e=tt(g),Ye=0;Ye<_e;Ye++){for(Ve=0;Ve<Be+4;Ve++)Ut(g,1);Ut(g,1)}if(_e=Be=1,Ye=0,ht(g),ht(g),ht(g)){if(ht(g)&&(be=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],ke=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1],0<(Ve=sn(g))&&16>=Ve?(Be=be[Ve-1],_e=ke[Ve-1]):Ve===255&&(Be=Ut(g,16),_e=Ut(g,16))),ht(g)&&ht(g),ht(g)&&(Ut(g,3),ht(g),ht(g)&&(sn(g),sn(g),sn(g))),ht(g)&&(tt(g),tt(g)),ht(g),ht(g),ht(g),(Ve=ht(g))&&(tt(g),tt(g),tt(g),tt(g)),ht(g)&&(Ut(g,32),Ut(g,32),ht(g)&&tt(g),ht(g)))for(ke=!1,Ve=ht(g),be=ht(g),(Ve||be)&&((ke=ht(g))&&(sn(g),Ut(g,5),ht(g),Ut(g,5)),Ut(g,4),Ut(g,4),ke&&Ut(g,4),Ut(g,5),Ut(g,5),Ut(g,5)),Ae=0;Ae<=x;Ae++){var De=!0;He=1,ht(g)||(De=ht(g));var $e=!1;if(De?tt(g):$e=ht(g),$e||(He=tt(g)+1),Ve){for(De=0;De<He;De++)tt(g),tt(g),ke&&(tt(g),tt(g));ht(g)}if(be){for(De=0;De<He;De++)tt(g),tt(g),ke&&(tt(g),tt(g));ht(g)}}ht(g)&&(ht(g),ht(g),ht(g),Ye=tt(g),tt(g),tt(g),tt(g),tt(g))}return{ye:me,Ee:C,Fe:D,De:_,ze:j,Ae:F,Be:B,Ce:H,se:Y,te,ue:q,ve:X,we:he,xe:ae,Sd:Ye,pe:0,oe,ne:Ee,me:ve,width:ge-(b+w)*(oe===1||oe===2?2:1),height:le-(k+I)*(oe===1?2:1),Vh:Be,Uh:_e}}(i.fullData);var p=function(g){var b=new eo(g,!0);sn(b),sn(b),tt(b),tt(b),ht(b),ht(b),Ut(b,3),ht(b),ht(b),tt(b),tt(b),$u(b),ht(b),ht(b),ht(b)&&tt(b),$u(b),$u(b),ht(b),ht(b),ht(b),ht(b),g=ht(b),b=ht(b);var w=1;return b&&g?w=0:b?w=3:g&&(w=2),{bf:w}}(o.fullData);return n=function(g,b,w,k){var I=new Uint8Array(23+(5+g.byteLength)+(5+b.byteLength)+(5+w.byteLength));return I[0]=1,I[1]=(3&k.Ee)<<6|(k.Fe?1:0)<<5|31&k.De,I[2]=k.ze,I[3]=k.Ae,I[4]=k.Be,I[5]=k.Ce,I[6]=k.se,I[7]=k.te,I[8]=k.ue,I[9]=k.ve,I[10]=k.we,I[11]=k.xe,I[12]=k.ye,I[13]=240|(3840&k.Sd)>>8,I[14]=255&k.Sd,I[15]=252|3&k.bf,I[16]=252|3&k.oe,I[17]=248|7&k.ne,I[18]=248|7&k.me,I[19]=0,I[20]=0,I[21]=(3&k.pe)<<6|(7&k.Ye)<<3|(k.uf?1:0)<<2|3,I[22]=3,I[23]=160,I[24]=0,I[25]=1,I[26]=(65280&g.byteLength)>>8,I[27]=255&g.byteLength,I.set(g,28),I[23+(5+g.byteLength)]=161,I[g.byteLength+29]=0,I[g.byteLength+30]=1,I[g.byteLength+31]=(65280&b.byteLength)>>8,I[g.byteLength+32]=255&b.byteLength,I.set(b,g.byteLength+33),I[23+(g.byteLength+10+b.byteLength)]=162,I[g.byteLength+10+b.byteLength+24]=0,I[g.byteLength+10+b.byteLength+25]=1,I[g.byteLength+10+b.byteLength+26]=(65280&w.byteLength)>>8,I[g.byteLength+10+b.byteLength+27]=255&w.byteLength,I.set(w,g.byteLength+10+b.byteLength+28),I}(n.fullData,i.fullData,o.fullData,{Ye:h.Ye,uf:h.uf,Ee:e.Ee,Fe:e.Fe,ye:e.ye,De:e.De,ze:e.ze,Ae:e.Ae,Be:e.Be,Ce:e.Ce,se:e.se,te:e.te,ue:e.ue,ve:e.ve,we:e.we,xe:e.xe,pe:e.pe,Sd:e.Sd,oe:e.oe,ne:e.ne,me:e.me,bf:p.bf}),{height:e.height,width:e.width,la:n,qa:e.Vh,sa:e.Uh}}function kb(e,n){var i=e[n+1]>>3&3,o=e[n+1]>>1&3,h=e[n+2]>>4&15,p=e[n+2]>>2&3;if(i!==1&&h!==0&&h!==15&&p!==3){var g=e[n+3]>>6;h=1e3*i3[14*(i===3?3-o:o===3?3:4)+h-1],p=s3[3*(i===3?0:i===2?1:2)+p],i=a3[i][o];var b=o3[o],w=Math.floor(i*h/p+(e[n+2]>>1&1))*b,k=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);return(k=k?parseInt(k[1],10):0)&&87>=k&&o===2&&224e3<=h&&g===0&&(e[n+3]|=128),{sampleRate:p,channelCount:g===3?1:2,S:w,Th:8*i*b}}return null}function F2(e,n){return!(e[n]!==255||224&~e[n+1]||!(6&e[n+1]))}function U2(e,n){if(n+1<e.length&&F2(e,n)){var i=kb(e,n),o=4;return i&&i.S&&(o=i.S),(n+=o)===e.length||n+1<e.length&&F2(e,n)}return!1}var i3=[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],s3=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],a3=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],o3=[0,1,1,4];function La(e){this.i=e,this.h=0,this.g=new Map}function Ra(e){this.h=e,this.g=null}function la(e){this.h=e,(this.g=cS.get("ISOBoxer")())&&function(n){function i(){this.Ft(),1&this.flags&&(this.Bt("AlgorithmID","uint",24),this.Bt("IV_size","uint",8),this.jt("KID",16,"uint",8)),this.Bt("sample_count","uint",32),this.Ht("entry",this.sample_count,function(o){this.Vt(o,"InitializationVector","data",8),2&this.flags&&(this.Vt(o,"NumberOfEntries","uint",16),this.Gt(o,"clearAndCryptedData",o.NumberOfEntries,function(h){this.Vt(h,"BytesOfClearData","uint",16),this.Vt(h,"BytesOfEncryptedData","uint",32)}))})}n.g.addBoxProcessor("saio",function(){this.Ft(),1&this.flags&&(this.Bt("aux_info_type","uint",32),this.Bt("aux_info_type_parameter","uint",32)),this.Bt("entry_count","uint",32),this.jt("offset",this.entry_count,"uint",this.version===1?64:32)}),n.g.addBoxProcessor("saiz",function(){this.Ft(),1&this.flags&&(this.Bt("aux_info_type","uint",32),this.Bt("aux_info_type_parameter","uint",32)),this.Bt("default_sample_info_size","uint",8),this.Bt("sample_count","uint",32),this.default_sample_info_size===0&&this.jt("sample_info_size",this.sample_count,"uint",8)}),n.g.addBoxProcessor("senc",i),n.g.addBoxProcessor("uuid",function(){for(var o=!0,h=0;16>h;h++)this.usertype[h]!==l3[h]&&(o=!1);o&&(this.Xt&&(this.type="sepiff"),i.call(this))})}(this)}function B2(e,n){for(var i=8,o=0;o<e.boxes.length&&e.boxes[o].type!==n;o++)i+=e.boxes[o].size;return i}(c=La.prototype).destroy=function(){this.g.clear()},c.isSupported=function(e){return e.toLowerCase().split(";")[0]=="audio/mpeg"&&Dn(this.convertCodecs("audio",e))},c.convertCodecs=function(e,n){return n.toLowerCase().split(";")[0]=="audio/mpeg"?'audio/mp4; codecs="mp3"':n},c.getOriginalMimeType=function(){return this.i},c.transmux=function(e,n,i,o){for(var h=Ta(i=Nt(e)).length;h<i.length&&!U2(i,h);h++);var p;for(e=[];h<i.length;){var g=kb(i,h);if(!g)return Promise.reject(new fe(2,3,3018));p||(p=g),h+g.S<=i.length&&e.push({data:i.subarray(h,h+g.S),size:g.S,duration:1152,Ua:0,flags:{Va:0,La:0,Ja:0,Ha:0,Ia:2,Wa:0}}),h+=g.S}return p?(i=9e4*p.Th/p.sampleRate*this.h,p=new Qg([o={id:n.id,type:"audio",codecs:"mp3",encrypted:n.encrypted&&0<n.drmInfos.length,timescale:p.sampleRate,duration:o,Ta:[],da:new Uint8Array([]),la:new Uint8Array([]),qa:0,sa:0,data:{hb:this.h,baseMediaDecodeTime:i,Oa:e},stream:n}]),this.g.has(n.id)?o=this.g.get(n.id):(o=Xg(p),this.g.set(n.id,o)),n=kv(p),this.h++,n=$n(o,n),Promise.resolve(n)):Promise.reject(new fe(2,3,3018))},We("shaka.transmuxer.Mp3Transmuxer",La),La.prototype.transmux=La.prototype.transmux,La.prototype.getOriginalMimeType=La.prototype.getOriginalMimeType,La.prototype.convertCodecs=La.prototype.convertCodecs,La.prototype.isSupported=La.prototype.isSupported,La.prototype.destroy=La.prototype.destroy,gr("audio/mpeg",function(){return new La("audio/mpeg")},Xi),(c=Ra.prototype).destroy=function(){},c.isSupported=function(e){if(e.toLowerCase().split(";")[0]!="video/mp2t")return!1;var n=Ci(e).split(","),i=Li("audio",n);return n=Li("video",n),!(!i||n||Ji(i)!="mp3")&&Dn(this.convertCodecs("audio",e))},c.convertCodecs=function(e,n){return n.toLowerCase().split(";")[0]=="video/mp2t"?"audio/mpeg":n},c.getOriginalMimeType=function(){return this.h},c.transmux=function(e,n,i,o,h){if(this.g?this.g.clearData():this.g=new Mn,e=Nt(e),(e=this.g.parse(e)).Rc().audio!="mp3"||h!="audio")return Promise.reject(new fe(2,3,3018));for(h=new Uint8Array([]),n=(e=T(e.Lb())).next();!n.done;n=e.next())if(n=n.value.data)for(i=0;i<n.length;)(o=kb(n,i))?(i+o.S<=n.length&&(h=$n(h,n.subarray(i,i+o.S))),i+=o.S):i++;return Promise.resolve(h)},We("shaka.transmuxer.MpegTsTransmuxer",Ra),Ra.prototype.transmux=Ra.prototype.transmux,Ra.prototype.getOriginalMimeType=Ra.prototype.getOriginalMimeType,Ra.prototype.convertCodecs=Ra.prototype.convertCodecs,Ra.prototype.isSupported=Ra.prototype.isSupported,Ra.prototype.destroy=Ra.prototype.destroy,gr("video/mp2t",function(){return new Ra("video/mp2t")},Sl),(c=la.prototype).destroy=function(){},c.isSupported=function(e,n){var i=e.startsWith("mss/");return!(!this.g||!i)&&(n?Dn(this.convertCodecs(n,e)):(n=this.convertCodecs("audio",e),e=this.convertCodecs("video",e),Dn(n)||Dn(e)))},c.convertCodecs=function(e,n){return n.replace("mss/","")},c.getOriginalMimeType=function(){return this.h},c.transmux=function(e,n,i){if(!i)return Promise.resolve(Nt(e));if(!n.mssPrivateData)return Promise.reject(new fe(2,3,3020));try{var o,h=this.g.parseBuffer(e),p=h.fetch("tfhd");p.track_ID=n.id+1;var g=h.fetch("tfdt"),b=h.fetch("traf");g===null&&((g=this.g.createFullBox("tfdt",b,p)).version=1,g.flags=0,g.baseMediaDecodeTime=Math.floor(i.startTime*n.mssPrivateData.timescale));var w=h.fetch("trun"),k=h.fetch("tfxd");k&&k.qt.boxes.splice(k.qt.boxes.indexOf(k),1);var I=h.fetch("tfrf");I&&I.qt.boxes.splice(I.qt.boxes.indexOf(I),1);var x=h.fetch("sepiff");if(x!==null){x.type="senc",x.usertype=void 0;var C=h.fetch("saio");if(C===null){(C=this.g.createFullBox("saio",b)).version=0,C.flags=0,C.entry_count=1,C.offset=[0];var D=this.g.createFullBox("saiz",b);if(D.version=0,D.flags=0,D.sample_count=x.sample_count,D.default_sample_info_size=0,D.sample_info_size=[],2&x.flags)for(o=0;o<x.sample_count;o+=1)D.sample_info_size[o]=10+6*x.entry[o].NumberOfEntries;else D.default_sample_info_size=8}}p.flags&=16777214,p.flags|=131072,w.flags|=1;var _=h.fetch("moof");w.data_offset=_.getLength()+8;var j=h.fetch("saio");j!==null&&(j.offset[0]=B2(_,"traf")+B2(b,"senc")+16);var F=Nt(h.write());return Promise.resolve(F)}catch(B){return B instanceof fe?Promise.reject(B):Promise.reject(new fe(2,3,3022))}},We("shaka.transmuxer.MssTransmuxer",la),la.prototype.transmux=la.prototype.transmux,la.prototype.getOriginalMimeType=la.prototype.getOriginalMimeType,la.prototype.convertCodecs=la.prototype.convertCodecs,la.prototype.isSupported=la.prototype.isSupported,la.prototype.destroy=la.prototype.destroy;var l3=new Uint8Array([162,57,79,82,90,155,79,20,162,68,108,66,124,100,141,244]);function Ca(e){this.l=e,this.g=0,this.i=new Map,this.h=this.j=null}gr("mss/audio/mp4",function(){return new la("mss/audio/mp4")},Xi),gr("mss/video/mp4",function(){return new la("mss/video/mp4")},Xi),(c=Ca.prototype).destroy=function(){this.i.clear(),this.h&&this.h.destroy()},c.isSupported=function(e,n){if(e.toLowerCase().split(";")[0]!="video/mp2t")return!1;var i=e;n&&(i=this.convertCodecs(n,e));var o=Ci(i).split(",");return i=Li("audio",o),o=Li("video",o),!(i&&(i=Ji(i),!u3.includes(i))||o&&(i=Ji(o),!c3.includes(i)))&&(n?Dn(this.convertCodecs(n,e)):(n=this.convertCodecs("audio",e),e=this.convertCodecs("video",e),Dn(n)||Dn(e)))},c.convertCodecs=function(e,n){return n.toLowerCase().split(";")[0]=="video/mp2t"?(n=Ci(n).replace("mp4a.40.34","mp3").split(",").map(function(i){return xu(i,"audio/mp4")}).map(Qc).join(","),e=="audio"?'audio/mp4; codecs="'+n+'"':'video/mp4; codecs="'+n+'"'):n},c.getOriginalMimeType=function(){return this.l},c.transmux=function(e,n,i,o,h){var p=Nt(e);if(h=="audio"&&!Vp(p)){for(var g=Ta(p),b=g.length;b<p.length;b++)if(U2(p,b))return Promise.reject(new fe(2,3,3018));for(b=g.length;b<p.length;b++)if(O2(p,b))return this.h||(this.h=new oa("audio/aac")),this.h.transmux(e,n,i,o,h);return Promise.reject(new fe(2,3,3018))}this.j?this.j.clearData():this.j=new Mn,e=[];var w=(g=this.j.parse(p)).Rc();try{if(p=null,h=="video"){switch(w.video){case"avc":var k=[],I=null,x=[],C=g.jc();if(!C.length)throw new fe(2,3,3023);for(var D=0;D<C.length;D++){var _=C[D],j=_.nalus;x.push.apply(x,M(j));var F=t3(j);if(F){I==null&&(I=_.dts);var B=void 0;B=D+1<C.length?(C[D+1].dts||0)-(_.dts||0):1<C.length?(_.dts||0)-(C[D-1].dts||0):9e4*(i.endTime-i.startTime),k.push({data:F.data,size:F.data.byteLength,duration:B,Ua:Math.round((_.pts||0)-(_.dts||0)),flags:{Va:0,La:0,Ja:0,Ha:0,Ia:F.Xc?2:1,Wa:F.Xc?0:1}})}}var H=function(yt){if(!yt.length)return null;var at=yt.find(function(kr){return kr.type==7});if(yt=yt.find(function(kr){return kr.type==8}),!at||!yt)return null;var st=new eo(at.data),Ct=sn(st);if(sn(st),sn(st),ui(st),n3.includes(Ct)&&((Ct=tt(st))===3&&bi(st,1),ui(st),ui(st),bi(st,1),ht(st))){Ct=Ct!==3?8:12;for(var $t=0;$t<Ct;$t++)ht(st)&&ky(st,6>$t?16:64)}if(ui(st),(Ct=tt(st))===0)tt(st);else if(Ct===1)for(bi(st,1),ui(st),ui(st),Ct=tt(st),$t=0;$t<Ct;$t++)ui(st);ui(st),bi(st,1);var Lt=tt(st),Ft=tt(st),pi=Ut(st,1);pi===0&&bi(st,1),bi(st,1);var Gn=0,ti=0,Ms=0,Os=0;if(ht(st)&&(Gn=tt(st),ti=tt(st),Ms=tt(st),Os=tt(st)),$t=Ct=1,ht(st)&&ht(st)){var ni=sn(st);0<ni&&16>=ni?(Ct=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][ni-1],$t=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][ni-1]):ni===255&&(Ct=Ut(st,16),$t=Ut(st,16))}return st=(2-pi)*(Ft+1)*16-2*Ms-2*Os,Lt=16*(Lt+1)-2*Gn-2*ti,Gn=[],at=at.fullData,Gn.push(at.byteLength>>>8&255),Gn.push(255&at.byteLength),Gn=Gn.concat.apply(Gn,M(at)),at=[],yt=yt.fullData,at.push(yt.byteLength>>>8&255),at.push(255&yt.byteLength),at=at.concat.apply(at,M(yt)),{height:st,width:Lt,la:yt=new Uint8Array([1,Gn[3],Gn[4],Gn[5],255,225].concat(Gn,[1],at)),qa:Ct,sa:$t}}(x);if(!H||I==null)throw new fe(2,3,3018);n.height=H.height,n.width=H.width,p={id:n.id,type:"video",codecs:"avc1",encrypted:n.encrypted&&0<n.drmInfos.length,timescale:9e4,duration:o,Ta:[],da:new Uint8Array([]),la:H.la,qa:H.qa,sa:H.sa,data:{hb:this.g,baseMediaDecodeTime:I,Oa:k},stream:n};break;case"hvc":if(C=[],_=null,j=[],!(k=g.jc()).length)throw new fe(2,3,3023);for(F=0;F<k.length;F++){x=(I=k[F]).nalus,j.push.apply(j,M(x)),H=!1;var Y=[],te=!1;for(B=(D=T(x)).next();!B.done;B=D.next()){var q=B.value;switch(q.type){case 1:case 0:var X=te=!0;break;case 19:case 20:case 21:H=X=te=!0;break;case 32:case 33:case 34:case 39:case 40:X=!0;break;case 35:te=X=!0;break;default:X=!1}if(te&&X){var he=q.fullData.byteLength,ae=new Uint8Array(4);ae[0]=he>>24&255,ae[1]=he>>16&255,ae[2]=he>>8&255,ae[3]=255&he,Y.push(ae),Y.push(q.fullData)}}var me=Y.length?{data:$n.apply(Kr,M(Y)),Xc:H}:null;me&&(_==null&&I.dts!=null&&(_=I.dts),H=void 0,H=F+1<k.length?(k[F+1].dts||0)-(I.dts||0):1<k.length?(I.dts||0)-(k[F-1].dts||0):9e4*(i.endTime-i.startTime),C.push({data:me.data,size:me.data.byteLength,duration:H,Ua:Math.round((I.pts||0)-(I.dts||0)),flags:{Va:0,La:0,Ja:0,Ha:0,Ia:me.Xc?2:1,Wa:me.Xc?0:1}}))}var oe=r3(j);if(!oe||_==null)throw new fe(2,3,3018);n.height=oe.height,n.width=oe.width,p={id:n.id,type:"video",codecs:"hvc1",encrypted:n.encrypted&&0<n.drmInfos.length,timescale:9e4,duration:o,Ta:[],da:new Uint8Array([]),la:oe.la,qa:oe.qa,sa:oe.sa,data:{hb:this.g,baseMediaDecodeTime:_,Oa:C},stream:n}}p&&(e.push(p),p=null)}if(h=="audio"){switch(w.audio){case"aac":for(var ge=[],le=null,Ee=T(g.Lb()),ve=Ee.next();!ve.done;ve=Ee.next()){var Be=ve.value,_e=Be.data;if(_e){var Ye=0;if(!(b=M2(_e,Ye)))throw new fe(2,3,3018);for(n.audioSamplingRate=b.sampleRate,n.channelsCount=b.channelCount,le==null&&Be.pts!==null&&(le=Be.pts);Ye<_e.length;){var Ve=P2(_e,Ye);if(Ve){var be=Ve.Hd+Ve.S;Ye+be<=_e.length&&ge.push({data:_e.subarray(Ye+Ve.Hd,Ye+be),size:Ve.S,duration:1024,Ua:0,flags:{Va:0,La:0,Ja:0,Ha:0,Ia:2,Wa:0}}),Ye+=be}else Ye++}}}if(!b||le==null){if(!g.jc().length)throw new fe(2,3,3018);le=9e4*i.startTime;var ke=Li("audio",n.codecs.split(","));if(!ke||!n.channelsCount||!n.audioSamplingRate)throw new fe(2,3,3018);b={sampleRate:n.audioSamplingRate,channelCount:n.channelsCount,ja:ke};var Ae=function(yt,at){if(yt==="mp4a.40.2"){if(at===1)return new Uint8Array([0,200,0,128,35,128]);if(at===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(at===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(at===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(at===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(at===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(at===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(at===2||at===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}return null}(ke,n.channelsCount);if(!Ae)throw new fe(2,3,3018);var He=le+9e4*(i.endTime-i.startTime);for(g=le;g<He;)ge.push({data:Ae,size:Ae.byteLength,duration:1024,Ua:0,flags:{Va:0,La:0,Ja:0,Ha:0,Ia:2,Wa:0}}),g+=1024/b.sampleRate*9e4}var De=b.sampleRate;g=le/9e4*De,p={id:n.id,type:"audio",codecs:b.ja,encrypted:n.encrypted&&0<n.drmInfos.length,timescale:De,duration:o,Ta:[],da:new Uint8Array([]),la:new Uint8Array([]),qa:0,sa:0,data:{hb:this.g,baseMediaDecodeTime:g,Oa:ge},stream:n};break;case"ac3":i=[],b=0,ge=new Uint8Array([]),De=null;for(var $e=(Ye=T(g.Lb())).next();!$e.done;$e=Ye.next()){var je=$e.value,Ge=je.data;for(De==null&&je.pts!==null&&(De=je.pts),g=0;g<Ge.length;){var Fe=N2(Ge,g);Fe?(n.audioSamplingRate=Fe.sampleRate,n.channelsCount=Fe.channelCount,b=Fe.sampleRate,ge=Fe.da,i.push({data:Ge.subarray(g,g+Fe.S),size:Fe.S,duration:1536,Ua:0,flags:{Va:0,La:0,Ja:0,Ha:0,Ia:2,Wa:0}}),g+=Fe.S):g++}}if(b==0||ge.byteLength==0||De==null)throw new fe(2,3,3018);g=De/9e4*b,p={id:n.id,type:"audio",codecs:"ac-3",encrypted:n.encrypted&&0<n.drmInfos.length,timescale:b,duration:o,Ta:[],da:ge,la:new Uint8Array([]),qa:0,sa:0,data:{hb:this.g,baseMediaDecodeTime:g,Oa:i},stream:n};break;case"ec3":i=[],b=0,le=new Uint8Array([]),De=null;for(var rt=T(g.Lb()),Qe=rt.next();!Qe.done;Qe=rt.next()){var Et=Qe.value,et=Et.data;for(De==null&&Et.pts!==null&&(De=Et.pts),g=0;g<et.length;){var it=_2(et,g);it?(n.audioSamplingRate=it.sampleRate,n.channelsCount=it.channelCount,b=it.sampleRate,le=it.da,i.push({data:et.subarray(g,g+it.S),size:it.S,duration:1536,Ua:0,flags:{Va:0,La:0,Ja:0,Ha:0,Ia:2,Wa:0}}),g+=it.S):g++}}if(b==0||le.byteLength==0||De==null)throw new fe(2,3,3018);g=De/9e4*b,p={id:n.id,type:"audio",codecs:"ec-3",encrypted:n.encrypted&&0<n.drmInfos.length,timescale:b,duration:o,Ta:[],da:le,la:new Uint8Array([]),qa:0,sa:0,data:{hb:this.g,baseMediaDecodeTime:g,Oa:i},stream:n};break;case"mp3":var Pt;i=[],b=null;for(var Yt=T(g.Lb()),Zt=Yt.next();!Zt.done;Zt=Yt.next()){var an=Zt.value,_t=an.data;if(_t)for(b==null&&an.pts!==null&&(b=an.pts),g=0;g<_t.length;){var Bt=kb(_t,g);Bt?(Pt||(Pt=Bt),g+Bt.S<=_t.length&&i.push({data:_t.subarray(g,g+Bt.S),size:Bt.S,duration:1152,Ua:0,flags:{Va:0,La:0,Ja:0,Ha:0,Ia:2,Wa:0}}),g+=Bt.S):g++}}if(!Pt||b==null)throw new fe(2,3,3018);var tn=Pt.sampleRate;g=b/9e4*tn,p={id:n.id,type:"audio",codecs:"mp3",encrypted:n.encrypted&&0<n.drmInfos.length,timescale:tn,duration:o,Ta:[],da:new Uint8Array([]),la:new Uint8Array([]),qa:0,sa:0,data:{hb:this.g,baseMediaDecodeTime:g,Oa:i},stream:n}}p&&e.push(p)}}catch(yt){return yt&&yt.code==3023?Promise.resolve(new Uint8Array([])):Promise.reject(yt)}return e.length?(e=new Qg(e),this.i.has(n.id)?o=this.i.get(n.id):(o=Xg(e),this.i.set(n.id,o)),n=kv(e),this.g++,n=$n(o,n),Promise.resolve(n)):Promise.reject(new fe(2,3,3018))},We("shaka.transmuxer.TsTransmuxer",Ca),Ca.prototype.transmux=Ca.prototype.transmux,Ca.prototype.getOriginalMimeType=Ca.prototype.getOriginalMimeType,Ca.prototype.convertCodecs=Ca.prototype.convertCodecs,Ca.prototype.isSupported=Ca.prototype.isSupported,Ca.prototype.destroy=Ca.prototype.destroy;var _v,Fv,u3=["aac","ac-3","ec-3","mp3"],c3=["avc","hevc"];function $2(){}function j2(){_v||navigator.requestMediaKeySystemAccess&&MediaKeySystemAccess.prototype.getConfiguration&&(_v=navigator.requestMediaKeySystemAccess,navigator.requestMediaKeySystemAccess=d3)}function d3(e,n){var i,o=this;return W(function(h){return h.g==1?N(h,_v.call(o,e,n),2):Y2(i=h.h)?(navigator.requestMediaKeySystemAccess=_v,h.return(i)):(navigator.requestMediaKeySystemAccess=G2,h.return(G2.call(o,e,n)))})}function G2(e,n){var i,o,h,p,g,b,w,k,I,x,C=this;return W(function(D){if(D.g==1){for(i=W2(e),o=[],h=T(n),p=h.next();!p.done;p=h.next())g=p.value,b=H2(g.videoCapabilities,i),w=H2(g.audioCapabilities,i),g.videoCapabilities&&g.videoCapabilities.length&&!b.length||g.audioCapabilities&&g.audioCapabilities.length&&!w.length||((k=Object.assign({},g)).videoCapabilities=b,k.audioCapabilities=w,o.push(k));if(!o.length)throw(I=Error("Unsupported keySystem or supportedConfigurations.")).name="NotSupportedError",I.code=DOMException.NOT_SUPPORTED_ERR,I;return N(D,_v.call(C,e,o),2)}return x=D.h,D.return(new xb(x,i))})}function H2(e,n){return e&&e.filter(function(i){return!i.encryptionScheme||i.encryptionScheme==n})}function V2(){}function K2(){Fv||navigator.mediaCapabilities&&(Fv=navigator.mediaCapabilities.decodingInfo,navigator.mediaCapabilities.decodingInfo=h3)}function h3(e){var n,i,o,h=this;return W(function(p){switch(p.g){case 1:return N(p,Fv.call(h,e),2);case 2:if(n=p.h,!e.keySystemConfiguration)return p.return(n);if((i=n.keySystemAccess)&&Y2(i))return navigator.mediaCapabilities.decodingInfo=Fv,p.return(n);if(navigator.mediaCapabilities.decodingInfo=z2,i){p.B(3);break}return o=n,N(p,q2(e),4);case 4:return o.keySystemAccess=p.h,p.return(n);case 3:return p.return(z2.call(h,e))}})}function z2(e){var n,i,o,h,p,g,b,w,k=this;return W(function(I){switch(I.g){case 1:return n=null,e.keySystemConfiguration&&(i=e.keySystemConfiguration,o=i.keySystem,h=i.audio&&i.audio.encryptionScheme,p=i.video&&i.video.encryptionScheme,n=W2(o),g={powerEfficient:!1,smooth:!1,supported:!1,keySystemAccess:null,configuration:e},h&&h!=n||p&&p!=n)?I.return(g):N(I,Fv.call(k,e),2);case 2:if((b=I.h).keySystemAccess){b.keySystemAccess=new xb(b.keySystemAccess,n),I.B(3);break}if(!e.keySystemConfiguration){I.B(3);break}return w=b,N(I,q2(e),5);case 5:w.keySystemAccess=I.h;case 3:return I.return(b)}})}function q2(e){var n,i;return W(function(o){if(o.g==1){var h=e.keySystemConfiguration,p=[],g=[];return h.audio&&p.push({robustness:h.audio.robustness||"",contentType:e.audio.contentType}),h.video&&g.push({robustness:h.video.robustness||"",contentType:e.video.contentType}),h={initDataTypes:h.initDataType?[h.initDataType]:[],distinctiveIdentifier:h.distinctiveIdentifier,persistentState:h.persistentState,sessionTypes:h.sessionTypes},p.length&&(h.audioCapabilities=p),g.length&&(h.videoCapabilities=g),n=h,N(o,navigator.requestMediaKeySystemAccess(e.keySystemConfiguration.keySystem,[n]),2)}return i=o.h,o.return(i)})}function xb(e,n){this.h=e,this.g=n,this.keySystem=e.keySystem}function W2(e){return e.startsWith("com.widevine")||e.startsWith("com.microsoft")||e.startsWith("com.chromecast")||e.startsWith("com.adobe")||e.startsWith("org.w3")?"cenc":e.startsWith("com.apple")?"cbcs-1-9":null}function Y2(e){var n=(e=e.getConfiguration()).audioCapabilities&&e.audioCapabilities[0];return!(!(e=e.videoCapabilities&&e.videoCapabilities[0]||n)||e.encryptionScheme===void 0)}function rw(){}function Q2(){j2(),K2()}gr("video/mp2t",function(){return new Ca("video/mp2t")},fa),We("EmeEncryptionSchemePolyfill",$2),$2.install=j2,We("McEncryptionSchemePolyfill",V2),V2.install=K2,xb.prototype.getConfiguration=function(){var e=this.h.getConfiguration();if(e.videoCapabilities)for(var n=T(e.videoCapabilities),i=n.next();!i.done;i=n.next())i.value.encryptionScheme=this.g;if(e.audioCapabilities)for(i=(n=T(e.audioCapabilities)).next();!i.done;i=n.next())i.value.encryptionScheme=this.g;return e},xb.prototype.createMediaKeys=function(){return this.h.createMediaKeys()},We("EncryptionSchemePolyfills",rw),rw.install=Q2,f!==void 0&&f.exports&&(f.exports=rw)}).call(t,a,a,void 0),t.shaka)Jw[r]=t.shaka[r]}()),Xw);const Zw=Sf(wD),vn=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,hr=globalThis,$d="10.28.0";function Kv(){return zv(hr),hr}function zv(a){const t=a.Kt=a.Kt||{};return t.version=t.version||$d,t[$d]=t[$d]||{}}function Af(a,t,r=hr){const s=r.Kt=r.Kt||{},u=s[$d]=s[$d]||{};return u[a]||(u[a]=t())}const AD=["debug","info","warn","error","log","assert","trace"],qv={};function kf(a){if(!("console"in hr))return a();const t=hr.console,r={},s=Object.keys(qv);s.forEach(u=>{const f=qv[u];r[u]=t[u],t[u]=f});try{return a()}finally{s.forEach(u=>{t[u]=r[u]})}}function eA(){return zb().enabled}function Kb(a,...t){vn&&eA()&&kf(()=>{hr.console[a](`Sentry Logger [${a}]:`,...t)})}function zb(){return vn?Af("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const qt={enable:function(){zb().enabled=!0},disable:function(){zb().enabled=!1},isEnabled:eA,log:function(...a){Kb("log",...a)},warn:function(...a){Kb("warn",...a)},error:function(...a){Kb("error",...a)}},jd="?",tA=/\(error: (.*)\)/,nA=/captureMessage|captureException/;function rA(...a){const t=a.sort((r,s)=>r[0]-s[0]).map(r=>r[1]);return(r,s=0,u=0)=>{const f=[],c=r.split(`
`);for(let v=s;v<c.length;v++){let y=c[v];y.length>1024&&(y=y.slice(0,1024));const E=tA.test(y)?y.replace(tA,"$1"):y;if(!E.match(/\S*Error: /)){for(const A of t){const L=A(E);if(L){f.push(L);break}}if(f.length>=50+u)break}}return function(v){if(!v.length)return[];const y=Array.from(v);return/sentryWrapped/.test(Wv(y).function||"")&&y.pop(),y.reverse(),nA.test(Wv(y).function||"")&&(y.pop(),nA.test(Wv(y).function||"")&&y.pop()),y.slice(0,50).map(E=>({...E,filename:E.filename||Wv(y).filename,function:E.function||jd}))}(f.slice(u))}}function Wv(a){return a[a.length-1]||{}}const iA="<anonymous>";function bc(a){try{return a&&typeof a=="function"&&a.name||iA}catch{return iA}}function sA(a){const t=a.exception;if(t){const r=[];try{return t.values.forEach(s=>{s.stacktrace.frames&&r.push(...s.stacktrace.frames)}),r}catch{return}}}function aA(a){return"Wt"in a&&a.Wt?"[VueVNode]":"[VueViewModel]"}const Yv={},oA={};function Gd(a,t){Yv[a]=Yv[a]||[],Yv[a].push(t)}function Hd(a,t){if(!oA[a]){oA[a]=!0;try{t()}catch(r){vn&&qt.error(`Error while instrumenting ${a}`,r)}}}function vo(a,t){const r=a&&Yv[a];if(r)for(const s of r)try{s(t)}catch(u){vn&&qt.error(`Error while triggering instrumentation handler.
Type: ${a}
Name: ${bc(s)}
Error:`,u)}}let qb=null;function kD(){qb=hr.onerror,hr.onerror=function(a,t,r,s,u){return vo("error",{column:s,error:u,line:r,msg:a,url:t}),!!qb&&qb.apply(this,arguments)},hr.onerror.zt=!0}let Wb=null;function xD(){Wb=hr.onunhandledrejection,hr.onunhandledrejection=function(a){return vo("unhandledrejection",a),!Wb||Wb.apply(this,arguments)},hr.onunhandledrejection.zt=!0}const lA=Object.prototype.toString;function Qv(a){switch(lA.call(a)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return Ec(a,Error)}}function xf(a,t){return lA.call(a)===`[object ${t}]`}function uA(a){return xf(a,"ErrorEvent")}function cA(a){return xf(a,"DOMError")}function Jl(a){return xf(a,"String")}function Yb(a){return typeof a=="object"&&a!==null&&"Yt"in a&&"Qt"in a}function Xv(a){return a===null||Yb(a)||typeof a!="object"&&typeof a!="function"}function am(a){return xf(a,"Object")}function Jv(a){return typeof Event<"u"&&Ec(a,Event)}function om(a){return!!(a!=null&&a.then&&typeof a.then=="function")}function Ec(a,t){try{return a instanceof t}catch{return!1}}function dA(a){return!(typeof a!="object"||a===null||!(a.Jt||a.Zt||a.Wt))}const Qb=hr;function hA(a,t={}){if(!a)return"<unknown>";try{let r=a;const s=5,u=[];let f=0,c=0;const v=" > ",y=v.length;let E;const A=Array.isArray(t)?t:t.keyAttrs,L=!Array.isArray(t)&&t.maxStringLength||80;for(;r&&f++<s&&(E=ID(r,A),!(E==="html"||f>1&&c+u.length*y+E.length>=L));)u.push(E),c+=E.length,r=r.parentNode;return u.reverse().join(v)}catch{return"<unknown>"}}function ID(a,t){const r=a,s=[];if(!(r!=null&&r.tagName))return"";if(Qb.HTMLElement&&r instanceof HTMLElement&&r.dataset){if(r.dataset.sentryComponent)return r.dataset.sentryComponent;if(r.dataset.sentryElement)return r.dataset.sentryElement}s.push(r.tagName.toLowerCase());const u=t!=null&&t.length?t.filter(c=>r.getAttribute(c)).map(c=>[c,r.getAttribute(c)]):null;if(u!=null&&u.length)u.forEach(c=>{s.push(`[${c[0]}="${c[1]}"]`)});else{r.id&&s.push(`#${r.id}`);const c=r.className;if(c&&Jl(c)){const v=c.split(/\s+/);for(const y of v)s.push(`.${y}`)}}const f=["aria-label","type","name","title","alt"];for(const c of f){const v=r.getAttribute(c);v&&s.push(`[${c}="${v}"]`)}return s.join("")}function Xb(){try{return Qb.document.location.href}catch{return""}}function ua(a,t,r){if(!(t in a))return;const s=a[t];if(typeof s!="function")return;const u=r(s);typeof u=="function"&&fA(u,s);try{a[t]=u}catch{vn&&qt.log(`Failed to replace method "${t}" in object`,a)}}function Vd(a,t,r){try{Object.defineProperty(a,t,{value:r,writable:!0,configurable:!0})}catch{vn&&qt.log(`Failed to add non-enumerable property "${t}" to object`,a)}}function fA(a,t){try{const r=t.prototype||{};a.prototype=t.prototype=r,Vd(a,"__sentry_original__",t)}catch{}}function Jb(a){return a._e}function pA(a){if(Qv(a))return{message:a.message,name:a.name,stack:a.stack,...mA(a)};if(Jv(a)){const t={type:a.type,target:gA(a.target),currentTarget:gA(a.currentTarget),...mA(a)};return typeof CustomEvent<"u"&&Ec(a,CustomEvent)&&(t.detail=a.detail),t}return a}function gA(a){try{return t=a,typeof Element<"u"&&Ec(t,Element)?hA(a):Object.prototype.toString.call(a)}catch{return"<unknown>"}var t}function mA(a){if(typeof a=="object"&&a!==null){const t={};for(const r in a)Object.prototype.hasOwnProperty.call(a,r)&&(t[r]=a[r]);return t}return{}}function Zb(a,t=0){return typeof a!="string"||t===0||a.length<=t?a:`${a.slice(0,t)}...`}function yA(a,t){if(!Array.isArray(a))return"";const r=[];for(let s=0;s<a.length;s++){const u=a[s];try{dA(u)?r.push(aA(u)):r.push(String(u))}catch{r.push("[value cannot be serialized]")}}return r.join(t)}function Zv(a,t,r=!1){return!!Jl(a)&&(xf(t,"RegExp")?t.test(a):!!Jl(t)&&(r?a===t:a.includes(t)))}function e0(a,t=[],r=!1){return t.some(s=>Zv(a,s,r))}let eE;function Ma(a=function(){const t=hr;return t.crypto||t.msCrypto}()){try{if(a!=null&&a.randomUUID)return a.randomUUID().replace(/-/g,"")}catch{}return eE||(eE="10000000100040008000"+1e11),eE.replace(/[018]/g,t=>(t^(16*Math.random()&15)>>t/4).toString(16))}function vA(a){var t,r;return(r=(t=a.exception)==null?void 0:t.values)==null?void 0:r[0]}function Kd(a){const{message:t,event_id:r}=a;if(t)return t;const s=vA(a);return s?s.type&&s.value?`${s.type}: ${s.value}`:s.type||s.value||r||"<unknown>":r||"<unknown>"}function tE(a,t,r){const s=a.exception=a.exception||{},u=s.values=s.values||[],f=u[0]=u[0]||{};f.value||(f.value=t||""),f.type||(f.type="Error")}function If(a,t){const r=vA(a);if(!r)return;const s=r.mechanism;if(r.mechanism={type:"generic",handled:!0,...s,...t},t&&"data"in t){const u={...s==null?void 0:s.data,...t.data};r.mechanism.data=u}}function bA(a){if(function(t){try{return t.tn}catch{}}(a))return!0;try{Vd(a,"__sentry_captured__",!0)}catch{}return!1}function lm(){return Date.now()/1e3}let EA;function Zl(){return(EA??(EA=function(){const{performance:a}=hr;if(!(a!=null&&a.now)||!a.timeOrigin)return lm;const t=a.timeOrigin;return()=>(t+a.now())/1e3}()))()}function LD(a){const t=Zl(),r={sid:Ma(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>function(s){return{sid:`${s.sid}`,init:s.init,started:new Date(1e3*s.started).toISOString(),timestamp:new Date(1e3*s.timestamp).toISOString(),status:s.status,errors:s.errors,did:typeof s.did=="number"||typeof s.did=="string"?`${s.did}`:void 0,duration:s.duration,abnormal_mechanism:s.abnormal_mechanism,attrs:{release:s.release,environment:s.environment,ip_address:s.ipAddress,user_agent:s.userAgent}}}(r)};return a&&Lf(r,a),r}function Lf(a,t={}){if(t.user&&(!a.ipAddress&&t.user.ip_address&&(a.ipAddress=t.user.ip_address),a.did||t.did||(a.did=t.user.id||t.user.email||t.user.username)),a.timestamp=t.timestamp||Zl(),t.abnormal_mechanism&&(a.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(a.ignoreDuration=t.ignoreDuration),t.sid&&(a.sid=t.sid.length===32?t.sid:Ma()),t.init!==void 0&&(a.init=t.init),!a.did&&t.did&&(a.did=`${t.did}`),typeof t.started=="number"&&(a.started=t.started),a.ignoreDuration)a.duration=void 0;else if(typeof t.duration=="number")a.duration=t.duration;else{const r=a.timestamp-a.started;a.duration=r>=0?r:0}t.release&&(a.release=t.release),t.environment&&(a.environment=t.environment),!a.ipAddress&&t.ipAddress&&(a.ipAddress=t.ipAddress),!a.userAgent&&t.userAgent&&(a.userAgent=t.userAgent),typeof t.errors=="number"&&(a.errors=t.errors),t.status&&(a.status=t.status)}function um(a,t,r=2){if(!t||typeof t!="object"||r<=0)return t;if(a&&Object.keys(t).length===0)return a;const s={...a};for(const u in t)Object.prototype.hasOwnProperty.call(t,u)&&(s[u]=um(s[u],t[u],r-1));return s}function TA(){return Ma()}function SA(){return Ma().substring(16)}const nE="_sentrySpan";function wA(a,t){t?Vd(a,nE,t):delete a[nE]}function AA(a){return a[nE]}class nl{constructor(){this.en=!1,this.nn=[],this.rn=[],this.an=[],this.un=[],this.ln={},this.cn={},this.hn={},this.dn={},this.vn={},this.pn={},this.mn={traceId:TA(),sampleRand:Math.random()}}clone(){const t=new nl;return t.an=[...this.an],t.cn={...this.cn},t.hn={...this.hn},t.dn={...this.dn},t.vn={...this.vn},this.vn.flags&&(t.vn.flags={values:[...this.vn.flags.values]}),t.ln=this.ln,t.gn=this.gn,t.yn=this.yn,t.wn=this.wn,t.bn=this.bn,t.rn=[...this.rn],t.un=[...this.un],t.pn={...this.pn},t.mn={...this.mn},t.En=this.En,t.kn=this.kn,wA(t,AA(this)),t}setClient(t){this.En=t}setLastEventId(t){this.kn=t}getClient(){return this.En}lastEventId(){return this.kn}addScopeListener(t){this.nn.push(t)}addEventProcessor(t){return this.rn.push(t),this}setUser(t){return this.ln=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this.yn&&Lf(this.yn,{user:t}),this.Sn(),this}getUser(){return this.ln}setTags(t){return this.cn={...this.cn,...t},this.Sn(),this}setTag(t,r){return this.setTags({[t]:r})}setAttributes(t){return this.hn={...this.hn,...t},this.Sn(),this}setAttribute(t,r){return this.setAttributes({[t]:r})}removeAttribute(t){return t in this.hn&&(delete this.hn[t],this.Sn()),this}setExtras(t){return this.dn={...this.dn,...t},this.Sn(),this}setExtra(t,r){return this.dn={...this.dn,[t]:r},this.Sn(),this}setFingerprint(t){return this.bn=t,this.Sn(),this}setLevel(t){return this.gn=t,this.Sn(),this}setTransactionName(t){return this.wn=t,this.Sn(),this}setContext(t,r){return r===null?delete this.vn[t]:this.vn[t]=r,this.Sn(),this}setSession(t){return t?this.yn=t:delete this.yn,this.Sn(),this}getSession(){return this.yn}update(t){if(!t)return this;const r=typeof t=="function"?t(this):t,s=r instanceof nl?r.getScopeData():am(r)?t:void 0,{tags:u,attributes:f,extra:c,user:v,contexts:y,level:E,fingerprint:A=[],propagationContext:L}=s||{};return this.cn={...this.cn,...u},this.hn={...this.hn,...f},this.dn={...this.dn,...c},this.vn={...this.vn,...y},v&&Object.keys(v).length&&(this.ln=v),E&&(this.gn=E),A.length&&(this.bn=A),L&&(this.mn=L),this}clear(){return this.an=[],this.cn={},this.hn={},this.dn={},this.ln={},this.vn={},this.gn=void 0,this.wn=void 0,this.bn=void 0,this.yn=void 0,wA(this,void 0),this.un=[],this.setPropagationContext({traceId:TA(),sampleRand:Math.random()}),this.Sn(),this}addBreadcrumb(t,r){var f;const s=typeof r=="number"?r:100;if(s<=0)return this;const u={timestamp:lm(),...t,message:t.message?Zb(t.message,2048):t.message};return this.an.push(u),this.an.length>s&&(this.an=this.an.slice(-s),(f=this.En)==null||f.recordDroppedEvent("buffer_overflow","log_item")),this.Sn(),this}getLastBreadcrumb(){return this.an[this.an.length-1]}clearBreadcrumbs(){return this.an=[],this.Sn(),this}addAttachment(t){return this.un.push(t),this}clearAttachments(){return this.un=[],this}getScopeData(){return{breadcrumbs:this.an,attachments:this.un,contexts:this.vn,tags:this.cn,attributes:this.hn,extra:this.dn,user:this.ln,level:this.gn,fingerprint:this.bn||[],eventProcessors:this.rn,propagationContext:this.mn,sdkProcessingMetadata:this.pn,transactionName:this.wn,span:AA(this)}}setSDKProcessingMetadata(t){return this.pn=um(this.pn,t,2),this}setPropagationContext(t){return this.mn=t,this}getPropagationContext(){return this.mn}captureException(t,r){const s=(r==null?void 0:r.event_id)||Ma();if(!this.En)return vn&&qt.warn("No client configured on scope - will not capture exception!"),s;const u=new Error("Sentry syntheticException");return this.En.captureException(t,{originalException:t,syntheticException:u,...r,event_id:s},this),s}captureMessage(t,r,s){const u=(s==null?void 0:s.event_id)||Ma();if(!this.En)return vn&&qt.warn("No client configured on scope - will not capture message!"),u;const f=(s==null?void 0:s.syntheticException)??new Error(t);return this.En.captureMessage(t,r,{originalException:t,syntheticException:f,...s,event_id:u},this),u}captureEvent(t,r){const s=(r==null?void 0:r.event_id)||Ma();return this.En?(this.En.captureEvent(t,{...r,event_id:s},this),s):(vn&&qt.warn("No client configured on scope - will not capture event!"),s)}Sn(){this.en||(this.en=!0,this.nn.forEach(t=>{t(this)}),this.en=!1)}}class RD{constructor(t,r){let s,u;s=t||new nl,u=r||new nl,this.Tn=[{scope:s}],this.An=u}withScope(t){const r=this.Mn();let s;try{s=t(r)}catch(u){throw this.In(),u}return om(s)?s.then(u=>(this.In(),u),u=>{throw this.In(),u}):(this.In(),s)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this.An}getStackTop(){return this.Tn[this.Tn.length-1]}Mn(){const t=this.getScope().clone();return this.Tn.push({client:this.getClient(),scope:t}),t}In(){return!(this.Tn.length<=1)&&!!this.Tn.pop()}}function Rf(){const a=zv(Kv());return a.stack=a.stack||new RD(Af("defaultCurrentScope",()=>new nl),Af("defaultIsolationScope",()=>new nl))}function CD(a){return Rf().withScope(a)}function DD(a,t){const r=Rf();return r.withScope(()=>(r.getStackTop().scope=a,t(a)))}function kA(a){return Rf().withScope(()=>a(Rf().getIsolationScope()))}function rE(a){const t=zv(a);return t.acs?t.acs:{withIsolationScope:kA,withScope:CD,withSetScope:DD,withSetIsolationScope:(r,s)=>kA(s),getCurrentScope:()=>Rf().getScope(),getIsolationScope:()=>Rf().getIsolationScope()}}function eu(){return rE(Kv()).getCurrentScope()}function zd(){return rE(Kv()).getIsolationScope()}function iE(...a){const t=rE(Kv());if(a.length===2){const[r,s]=a;return r?t.withSetScope(r,s):t.withScope(s)}return t.withScope(a[0])}function _i(){return eu().getClient()}function PD(a){const t=a.getPropagationContext(),{traceId:r,parentSpanId:s,propagationSpanId:u}=t,f={trace_id:r,span_id:u||SA()};return s&&(f.parent_span_id=s),f}const xA="sentry.profile_id",IA="sentry.exclusive_time";function MD(a){if(a){if(typeof a=="object"&&"deref"in a&&typeof a.deref=="function")try{return a.deref()}catch{return}return a}}function LA(a){const t=a;return{scope:t.Ln,isolationScope:MD(t.xn)}}const OD=/^sentry-/;function ND(a){const t=function(s){if(!(!s||!Jl(s)&&!Array.isArray(s)))return Array.isArray(s)?s.reduce((u,f)=>{const c=RA(f);return Object.entries(c).forEach(([v,y])=>{u[v]=y}),u},{}):RA(s)}(a);if(!t)return;const r=Object.entries(t).reduce((s,[u,f])=>(u.match(OD)&&(s[u.slice(7)]=f),s),{});return Object.keys(r).length>0?r:void 0}function RA(a){return a.split(",").map(t=>{const r=t.indexOf("=");return r===-1?[]:[t.slice(0,r),t.slice(r+1)].map(s=>{try{return decodeURIComponent(s.trim())}catch{return}})}).reduce((t,[r,s])=>(r&&s&&(t[r]=s),t),{})}const _D=/^o(\d+)\./,FD=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function Cf(a,t=!1){const{host:r,path:s,pass:u,port:f,projectId:c,protocol:v,publicKey:y}=a;return`${v}://${y}${t&&u?`:${u}`:""}@${r}${f?`:${f}`:""}/${s&&`${s}/`}${c}`}function CA(a){return{protocol:a.protocol,publicKey:a.publicKey||"",pass:a.pass||"",host:a.host,port:a.port||"",path:a.path||"",projectId:a.projectId}}function UD(a){const t=a.getOptions(),{host:r}=a.getDsn()||{};let s;return t.orgId?s=String(t.orgId):r&&(s=function(u){const f=u.match(_D);return f==null?void 0:f[1]}(r)),s}function DA(a){const t=typeof a=="string"?function(r){const s=FD.exec(r);if(!s)return void kf(()=>{});const[u,f,c="",v="",y="",E=""]=s.slice(1);let A="",L=E;const T=L.split("/");if(T.length>1&&(A=T.slice(0,-1).join("/"),L=T.pop()),L){const M=L.match(/^\d+/);M&&(L=M[0])}return CA({host:v,pass:c,path:A,projectId:L,port:y,protocol:u,publicKey:f})}(a):CA(a);if(t&&function(r){if(!vn)return!0;const{port:s,projectId:u,protocol:f}=r;return!(["protocol","publicKey","host","projectId"].find(c=>!r[c]&&(qt.error(`Invalid Sentry Dsn: ${c} missing`),!0))||(u.match(/^\d+$/)?function(c){return c==="http"||c==="https"}(f)?s&&isNaN(parseInt(s,10))&&(qt.error(`Invalid Sentry Dsn: Invalid port ${s}`),1):(qt.error(`Invalid Sentry Dsn: Invalid protocol ${f}`),1):(qt.error(`Invalid Sentry Dsn: Invalid projectId ${u}`),1)))}(t))return t}let PA=!1;function BD(a){const{spanId:t,traceId:r,isRemote:s}=a.spanContext(),u=s?t:sE(a).parent_span_id,f=LA(a).scope;return{parent_span_id:u,span_id:s?(f==null?void 0:f.getPropagationContext().propagationSpanId)||SA():t,trace_id:r}}function $D(a){return a&&a.length>0?a.map(({context:{spanId:t,traceId:r,traceFlags:s,...u},attributes:f})=>({span_id:t,trace_id:r,sampled:s===1,attributes:f,...u})):void 0}function MA(a){return typeof a=="number"?OA(a):Array.isArray(a)?a[0]+a[1]/1e9:a instanceof Date?OA(a.getTime()):Zl()}function OA(a){return a>9999999999?a/1e3:a}function sE(a){var s;if(function(u){return typeof u.getSpanJSON=="function"}(a))return a.getSpanJSON();const{spanId:t,traceId:r}=a.spanContext();if(function(u){const f=u;return!!(f.attributes&&f.startTime&&f.name&&f.endTime&&f.status)}(a)){const{attributes:u,startTime:f,name:c,endTime:v,status:y,links:E}=a;return{span_id:t,trace_id:r,data:u,description:c,parent_span_id:"parentSpanId"in a?a.parentSpanId:"parentSpanContext"in a?(s=a.parentSpanContext)==null?void 0:s.spanId:void 0,start_timestamp:MA(f),timestamp:MA(v)||void 0,status:jD(y),op:u["sentry.op"],origin:u["sentry.origin"],links:$D(E)}}return{span_id:t,trace_id:r,start_timestamp:0,data:{}}}function jD(a){if(a&&a.code!==0)return a.code===1?"ok":a.message||"internal_error"}function NA(a){return a.Dn||a}function _A(){PA||(kf(()=>{}),PA=!0)}function FA(a){qt.log(`Ignoring span ${a.op} - ${a.description} because it matches \`ignoreSpans\`.`)}function UA(a,t){if(!(t!=null&&t.length)||!a.description)return!1;for(const s of t){if(typeof(r=s)=="string"||r instanceof RegExp){if(Zv(a.description,s))return vn&&FA(a),!0;continue}if(!s.name&&!s.op)continue;const u=!s.name||Zv(a.description,s.name),f=!s.op||a.op&&Zv(a.op,s.op);if(u&&f)return vn&&FA(a),!0}var r;return!1}function GD(a,t){const r=t.parent_span_id,s=t.span_id;if(r)for(const u of a)u.parent_span_id===s&&(u.parent_span_id=r)}const aE="production";function BA(a,t){const r=t.getOptions(),{publicKey:s}=t.getDsn()||{},u={environment:r.environment||aE,release:r.release,public_key:s,trace_id:a,org_id:UD(t)};return t.emit("createDsc",u),u}function HD(a){var O;const t=_i();if(!t)return{};const r=NA(a),s=sE(r),u=s.data,f=r.spanContext().traceState,c=(f==null?void 0:f.get("sentry.sample_rate"))??u["sentry.sample_rate"]??u["sentry.previous_trace_sample_rate"];function v(U){return typeof c!="number"&&typeof c!="string"||(U.sample_rate=`${c}`),U}const y=r.Cn;if(y)return v(y);const E=f==null?void 0:f.get("sentry.dsc"),A=E&&ND(E);if(A)return v(A);const L=BA(a.spanContext().traceId,t),T=u["sentry.source"],M=s.description;return T!=="url"&&M&&(L.transaction=M),function(){var $;if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const U=($=_i())==null?void 0:$.getOptions();return!(!U||U.tracesSampleRate==null&&!U.tracesSampler)}()&&(L.sampled=String(function(U){const{traceFlags:$}=U.spanContext();return $===1}(r)),L.sample_rand=(f==null?void 0:f.get("sentry.sample_rand"))??((O=LA(r).scope)==null?void 0:O.getPropagationContext().sampleRand.toString())),v(L),t.emit("createDsc",L,r),L}function tu(a,t=100,r=1/0){try{return oE("",a,t,r)}catch(s){return{ERROR:`**non-serializable** (${s})`}}}function $A(a,t=3,r=102400){const s=tu(a,t);return u=s,function(f){return~-encodeURI(f).split(/%..|./).length}(JSON.stringify(u))>r?$A(a,t-1,r):s;var u}function oE(a,t,r=1/0,s=1/0,u=function(){const f=new WeakSet;function c(y){return!!f.has(y)||(f.add(y),!1)}function v(y){f.delete(y)}return[c,v]}()){const[f,c]=u;if(t==null||["boolean","string"].includes(typeof t)||typeof t=="number"&&Number.isFinite(t))return t;const v=function(M,O){try{if(M==="domain"&&O&&typeof O=="object"&&O.$n)return"[Domain]";if(M==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&O===global)return"[Global]";if(typeof window<"u"&&O===window)return"[Window]";if(typeof document<"u"&&O===document)return"[Document]";if(dA(O))return aA(O);if(am(U=O)&&"nativeEvent"in U&&"preventDefault"in U&&"stopPropagation"in U)return"[SyntheticEvent]";if(typeof O=="number"&&!Number.isFinite(O))return`[${O}]`;if(typeof O=="function")return`[Function: ${bc(O)}]`;if(typeof O=="symbol")return`[${String(O)}]`;if(typeof O=="bigint")return`[BigInt: ${String(O)}]`;const $=function(z){const Q=Object.getPrototypeOf(z);return Q!=null&&Q.constructor?Q.constructor.name:"null prototype"}(O);return/^HTML(\w*)Element$/.test($)?`[HTMLElement: ${$}]`:`[object ${$}]`}catch($){return`**non-serializable** (${$})`}var U}(a,t);if(!v.startsWith("[object "))return v;if(t.Rn)return t;const y=typeof t.Pn=="number"?t.Pn:r;if(y===0)return v.replace("object ","");if(f(t))return"[Circular ~]";const E=t;if(E&&typeof E.toJSON=="function")try{return oE("",E.toJSON(),y-1,s,u)}catch{}const A=Array.isArray(t)?[]:{};let L=0;const T=pA(t);for(const M in T){if(!Object.prototype.hasOwnProperty.call(T,M))continue;if(L>=s){A[M]="[MaxProperties ~]";break}const O=T[M];A[M]=oE(M,O,y-1,s,u),L++}return c(t),A}function Df(a,t=[]){return[a,t]}function VD(a,t){const[r,s]=a;return[r,[...s,t]]}function jA(a,t){const r=a[1];for(const s of r)if(t(s,s[0].type))return!0;return!1}function lE(a){const t=zv(hr);return t.encodePolyfill?t.encodePolyfill(a):new TextEncoder().encode(a)}function KD(a){const[t,r]=a;let s=JSON.stringify(t);function u(f){typeof s=="string"?s=typeof f=="string"?s+f:[lE(s),f]:s.push(typeof f=="string"?lE(f):f)}for(const f of r){const[c,v]=f;if(u(`
${JSON.stringify(c)}
`),typeof v=="string"||v instanceof Uint8Array)u(v);else{let y;try{y=JSON.stringify(v)}catch{y=JSON.stringify(tu(v))}u(y)}}return typeof s=="string"?s:function(f){const c=f.reduce((E,A)=>E+A.length,0),v=new Uint8Array(c);let y=0;for(const E of f)v.set(E,y),y+=E.length;return v}(s)}function zD(a){const t=typeof a.data=="string"?lE(a.data):a.data;return[{type:"attachment",length:t.length,filename:a.filename,content_type:a.contentType,attachment_type:a.attachmentType},t]}const qD={session:"session",sessions:"session",attachment:"attachment",transaction:"transaction",event:"error",client_report:"internal",user_report:"default",profile:"profile",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",feedback:"feedback",span:"span",raw_security:"security",log:"log_item",metric:"metric",trace_metric:"metric"};function GA(a){return qD[a]}function HA(a){if(!(a!=null&&a.sdk))return;const{name:t,version:r}=a.sdk;return{name:t,version:r}}function WD(a,t,r,s){const u=HA(r),f=a.type&&a.type!=="replay_event"?a.type:"event";(function(v,y){var A,L,T,M;if(!y)return v;const E=v.sdk||{};v.sdk={...E,name:E.name||y.name,version:E.version||y.version,integrations:[...((A=v.sdk)==null?void 0:A.integrations)||[],...y.integrations||[]],packages:[...((L=v.sdk)==null?void 0:L.packages)||[],...y.packages||[]],settings:(T=v.sdk)!=null&&T.settings||y.settings?{...(M=v.sdk)==null?void 0:M.settings,...y.settings}:void 0}})(a,r==null?void 0:r.sdk);const c=function(v,y,E,A){var T;const L=(T=v.sdkProcessingMetadata)==null?void 0:T.dynamicSamplingContext;return{event_id:v.event_id,sent_at:new Date().toISOString(),...y&&{sdk:y},...!!E&&A&&{dsn:Cf(A)},...L&&{trace:L}}}(a,u,s,t);return delete a.sdkProcessingMetadata,Df(c,[[{type:f},a]])}function t0(a){return new cm(t=>{t(a)})}function uE(a){return new cm((t,r)=>{r(a)})}class cm{constructor(t){this.Nn=0,this.On=[],this._n(t)}then(t,r){return new cm((s,u)=>{this.On.push([!1,f=>{if(t)try{s(t(f))}catch(c){u(c)}else s(f)},f=>{if(r)try{s(r(f))}catch(c){u(c)}else u(f)}]),this.Un()})}catch(t){return this.then(r=>r,t)}finally(t){return new cm((r,s)=>{let u,f;return this.then(c=>{f=!1,u=c,t&&t()},c=>{f=!0,u=c,t&&t()}).then(()=>{f?s(u):r(u)})})}Un(){if(this.Nn===0)return;const t=this.On.slice();this.On=[],t.forEach(r=>{r[0]||(this.Nn===1&&r[1](this.Fn),this.Nn===2&&r[2](this.Fn),r[0]=!0)})}_n(t){const r=(f,c)=>{this.Nn===0&&(om(c)?c.then(s,u):(this.Nn=f,this.Fn=c,this.Un()))},s=f=>{r(1,f)},u=f=>{r(2,f)};try{t(s,u)}catch(f){u(f)}}}function YD(a,t,r,s=0){try{const u=cE(t,r,a,s);return om(u)?u:t0(u)}catch(u){return uE(u)}}function cE(a,t,r,s){const u=r[s];if(!a||!u)return a;const f=u({...a},t);return vn&&f===null&&qt.log(`Event processor "${u.id||"?"}" dropped event`),om(f)?f.then(c=>cE(c,t,r,s+1)):cE(f,t,r,s+1)}function QD(a,t){const{fingerprint:r,span:s,breadcrumbs:u,sdkProcessingMetadata:f}=t;(function(c,v){const{extra:y,tags:E,user:A,contexts:L,level:T,transactionName:M}=v;Object.keys(y).length&&(c.extra={...y,...c.extra}),Object.keys(E).length&&(c.tags={...E,...c.tags}),Object.keys(A).length&&(c.user={...A,...c.user}),Object.keys(L).length&&(c.contexts={...L,...c.contexts}),T&&(c.level=T),M&&c.type!=="transaction"&&(c.transaction=M)})(a,t),s&&function(c,v){c.contexts={trace:BD(v),...c.contexts},c.sdkProcessingMetadata={dynamicSamplingContext:HD(v),...c.sdkProcessingMetadata};const y=NA(v),E=sE(y).description;E&&!c.transaction&&c.type==="transaction"&&(c.transaction=E)}(a,s),function(c,v){c.fingerprint=c.fingerprint?Array.isArray(c.fingerprint)?c.fingerprint:[c.fingerprint]:[],v&&(c.fingerprint=c.fingerprint.concat(v)),c.fingerprint.length||delete c.fingerprint}(a,r),function(c,v){const y=[...c.breadcrumbs||[],...v];c.breadcrumbs=y.length?y:void 0}(a,u),function(c,v){c.sdkProcessingMetadata={...c.sdkProcessingMetadata,...v}}(a,f)}function VA(a,t){const{extra:r,tags:s,user:u,contexts:f,level:c,sdkProcessingMetadata:v,breadcrumbs:y,fingerprint:E,eventProcessors:A,attachments:L,propagationContext:T,transactionName:M,span:O}=t;n0(a,"extra",r),n0(a,"tags",s),n0(a,"user",u),n0(a,"contexts",f),a.sdkProcessingMetadata=um(a.sdkProcessingMetadata,v,2),c&&(a.level=c),M&&(a.transactionName=M),O&&(a.span=O),y.length&&(a.breadcrumbs=[...a.breadcrumbs,...y]),E.length&&(a.fingerprint=[...a.fingerprint,...E]),A.length&&(a.eventProcessors=[...a.eventProcessors,...A]),L.length&&(a.attachments=[...a.attachments,...L]),a.propagationContext={...a.propagationContext,...T}}function n0(a,t,r){a[t]=um(a[t],r,1)}let nu,KA,zA,Tc;function XD(a,t,r,s,u,f){const{normalizeDepth:c=3,normalizeMaxBreadth:v=1e3}=a,y={...t,event_id:t.event_id||r.event_id||Ma(),timestamp:t.timestamp||lm()},E=r.integrations||a.integrations.map(O=>O.name);(function(O,U){var se,ye;const{environment:$,release:z,dist:Q,maxValueLength:Z}=U;O.environment=O.environment||$||aE,!O.release&&z&&(O.release=z),!O.dist&&Q&&(O.dist=Q);const ie=O.request;ie!=null&&ie.url&&Z&&(ie.url=Zb(ie.url,Z)),Z&&((ye=(se=O.exception)==null?void 0:se.values)==null||ye.forEach(N=>{N.value&&(N.value=Zb(N.value,Z))}))})(y,a),function(O,U){U.length>0&&(O.sdk=O.sdk||{},O.sdk.integrations=[...O.sdk.integrations||[],...U])}(y,E),u&&u.emit("applyFrameMetadata",t),t.type===void 0&&function(O,U){var z,Q;const $=function(Z){const ie=hr.t,se=hr.Bn;if(!ie&&!se)return{};const ye=ie?Object.keys(ie):[],N=se?Object.keys(se):[];if(Tc&&ye.length===KA&&N.length===zA)return Tc;KA=ye.length,zA=N.length,Tc={},nu||(nu={});const re=(ne,Se)=>{for(const ce of ne){const we=Se[ce],ze=nu==null?void 0:nu[ce];if(ze&&Tc&&we)Tc[ze[0]]=we,nu&&(nu[ce]=[ze[0],we]);else if(we){const xe=Z(ce);for(let Ce=xe.length-1;Ce>=0;Ce--){const J=xe[Ce],ue=J==null?void 0:J.filename;if(ue&&Tc&&nu){Tc[ue]=we,nu[ce]=[ue,we];break}}}}};return ie&&re(ye,ie),se&&re(N,se),Tc}(U);(Q=(z=O.exception)==null?void 0:z.values)==null||Q.forEach(Z=>{var ie,se;(se=(ie=Z.stacktrace)==null?void 0:ie.frames)==null||se.forEach(ye=>{ye.filename&&(ye.debug_id=$[ye.filename])})})}(y,a.stackParser);const A=function(O,U){if(!U)return O;const $=O?O.clone():new nl;return $.update(U),$}(s,r.captureContext);r.mechanism&&If(y,r.mechanism);const L=u?u.getEventProcessors():[],T=Af("globalScope",()=>new nl).getScopeData();f&&VA(T,f.getScopeData()),A&&VA(T,A.getScopeData());const M=[...r.attachments||[],...T.attachments];return M.length&&(r.attachments=M),QD(y,T),YD([...L,...T.eventProcessors],y,r).then(O=>(O&&function(U){var Q,Z;const $={};if((Z=(Q=U.exception)==null?void 0:Q.values)==null||Z.forEach(ie=>{var se,ye;(ye=(se=ie.stacktrace)==null?void 0:se.frames)==null||ye.forEach(N=>{N.debug_id&&(N.abs_path?$[N.abs_path]=N.debug_id:N.filename&&($[N.filename]=N.debug_id),delete N.debug_id)})}),Object.keys($).length===0)return;U.debug_meta=U.debug_meta||{},U.debug_meta.images=U.debug_meta.images||[];const z=U.debug_meta.images;Object.entries($).forEach(([ie,se])=>{z.push({type:"sourcemap",code_file:ie,debug_id:se})})}(O),typeof c=="number"&&c>0?function(U,$,z){var Z,ie;if(!U)return null;const Q={...U,...U.breadcrumbs&&{breadcrumbs:U.breadcrumbs.map(se=>({...se,...se.data&&{data:tu(se.data,$,z)}}))},...U.user&&{user:tu(U.user,$,z)},...U.contexts&&{contexts:tu(U.contexts,$,z)},...U.extra&&{extra:tu(U.extra,$,z)}};return(Z=U.contexts)!=null&&Z.trace&&Q.contexts&&(Q.contexts.trace=U.contexts.trace,U.contexts.trace.data&&(Q.contexts.trace.data=tu(U.contexts.trace.data,$,z))),U.spans&&(Q.spans=U.spans.map(se=>({...se,...se.data&&{data:tu(se.data,$,z)}}))),(ie=U.contexts)!=null&&ie.flags&&Q.contexts&&(Q.contexts.flags=tu(U.contexts.flags,3,z)),Q}(O,c,v):O))}function JD(a){if(a)return function(t){return t instanceof nl||typeof t=="function"}(a)||function(t){return Object.keys(t).some(r=>ZD.includes(r))}(a)?{captureContext:a}:a}const ZD=["user","level","extra","contexts","tags","fingerprint","propagationContext"];function rl(a,t){return eu().captureException(a,JD(t))}function qA(a,t){return eu().captureEvent(a,t)}function WA(a){const t=zd(),r=eu(),{userAgent:s}=hr.navigator||{},u=LD({user:r.getUser()||t.getUser(),...s&&{userAgent:s},...a}),f=t.getSession();return(f==null?void 0:f.status)==="ok"&&Lf(f,{status:"exited"}),YA(),t.setSession(u),u}function YA(){const a=zd(),t=eu().getSession()||a.getSession();t&&function(r){let s={};r.status==="ok"&&(s={status:"exited"}),Lf(r,s)}(t),QA(),a.setSession()}function QA(){const a=zd(),t=_i(),r=a.getSession();r&&t&&t.captureSession(r)}function XA(a=!1){a?YA():QA()}function JA(a){const t=a.protocol?`${a.protocol}:`:"",r=a.port?`:${a.port}`:"";return`${t}//${a.host}${r}${a.path?`/${a.path}`:""}/api/`}function eP(a,t,r){return t||`${function(s){return`${JA(s)}${s.projectId}/envelope/`}(a)}?${function(s,u){const f={sentry_version:"7"};return s.publicKey&&(f.sentry_key=s.publicKey),u&&(f.sentry_client=`${u.name}/${u.version}`),new URLSearchParams(f).toString()}(a,r)}`}const ZA=[];function tP(a){const t=a.defaultIntegrations||[],r=a.integrations;let s;if(t.forEach(u=>{u.isDefaultInstance=!0}),Array.isArray(r))s=[...t,...r];else if(typeof r=="function"){const u=r(t);s=Array.isArray(u)?u:[u]}else s=t;return function(u){const f={};return u.forEach(c=>{const{name:v}=c,y=f[v];y&&!y.isDefaultInstance&&c.isDefaultInstance||(f[v]=c)}),Object.values(f)}(s)}function ek(a,t){for(const r of t)r!=null&&r.afterAllSetup&&r.afterAllSetup(a)}function tk(a,t,r){if(r[t.name])vn&&qt.log(`Integration skipped because it was already installed: ${t.name}`);else{if(r[t.name]=t,ZA.includes(t.name)||typeof t.setupOnce!="function"||(t.setupOnce(),ZA.push(t.name)),t.setup&&typeof t.setup=="function"&&t.setup(a),typeof t.preprocessEvent=="function"){const s=t.preprocessEvent.bind(t);a.on("preprocessEvent",(u,f)=>s(u,f,a))}if(typeof t.processEvent=="function"){const s=t.processEvent.bind(t),u=Object.assign((f,c)=>s(f,c,a),{id:t.name});a.addEventProcessor(u)}vn&&qt.log(`Integration installed: ${t.name}`)}}function nk(a,t){const r=t??function(f){return rk().get(f)}(a)??[];if(r.length===0)return;const s=a.getOptions(),u=function(f,c,v,y){const E={};return c!=null&&c.sdk&&(E.sdk={name:c.sdk.name,version:c.sdk.version}),v&&y&&(E.dsn=Cf(y)),Df(E,[(A=f,[{type:"log",item_count:A.length,content_type:"application/vnd.sentry.items.log+json"},{items:A}])]);var A}(r,s.jn,s.tunnel,a.getDsn());rk().set(a,[]),a.emit("flushLogs"),a.sendEnvelope(u)}function rk(){return Af("clientToLogBufferMap",()=>new WeakMap)}function ik(a,t){const r=t??function(f){return sk().get(f)}(a)??[];if(r.length===0)return;const s=a.getOptions(),u=function(f,c,v,y){const E={};return c!=null&&c.sdk&&(E.sdk={name:c.sdk.name,version:c.sdk.version}),v&&y&&(E.dsn=Cf(y)),Df(E,[(A=f,[{type:"trace_metric",item_count:A.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{items:A}])]);var A}(r,s.jn,s.tunnel,a.getDsn());sk().set(a,[]),a.emit("flushMetrics"),a.sendEnvelope(u)}function sk(){return Af("clientToMetricBufferMap",()=>new WeakMap)}const dE=Symbol.for("SentryBufferFullError");function hE(a=100){const t=new Set;function r(s){t.delete(s)}return{get $(){return Array.from(t)},add:function(s){if(!(t.size<a))return uE(dE);const u=s();return t.add(u),u.then(()=>r(u),()=>r(u)),u},drain:function(s){if(!t.size)return t0(!0);const u=Promise.allSettled(Array.from(t)).then(()=>!0);if(!s)return u;const f=[u,new Promise(c=>setTimeout(()=>c(!1),s))];return Promise.race(f)}}}function nP(a,{statusCode:t,headers:r},s=Date.now()){const u={...a},f=r==null?void 0:r["x-sentry-rate-limits"],c=r==null?void 0:r["retry-after"];if(f)for(const v of f.trim().split(",")){const[y,E,,,A]=v.split(":",5),L=parseInt(y,10),T=1e3*(isNaN(L)?60:L);if(E)for(const M of E.split(";"))M==="metric_bucket"&&A&&!A.split(";").includes("custom")||(u[M]=s+T);else u.all=s+T}else c?u.all=s+function(v,y=Date.now()){const E=parseInt(`${v}`,10);if(!isNaN(E))return 1e3*E;const A=Date.parse(`${v}`);return isNaN(A)?6e4:A-y}(c,s):t===429&&(u.all=s+6e4);return u}function rP(a,t,r=hE(a.bufferSize||64)){let s={};return{send:function(u){const f=[];if(jA(u,(y,E)=>{const A=GA(E);(function(L,T,M=Date.now()){return function(O,U){return O[U]||O.all||0}(L,T)>M})(s,A)?a.recordDroppedEvent("ratelimit_backoff",A):f.push(y)}),f.length===0)return Promise.resolve({});const c=Df(u[0],f),v=y=>{jA(c,(E,A)=>{a.recordDroppedEvent(y,GA(A))})};return r.add(()=>t({body:KD(c)}).then(y=>(y.statusCode!==void 0&&(y.statusCode<200||y.statusCode>=300)&&vn&&qt.warn(`Sentry responded with status code ${y.statusCode} to sent event.`),s=nP(s,y),y),y=>{throw v("network_error"),vn&&qt.error("Encountered error running transport request:",y),y})).then(y=>y,y=>{if(y===dE)return vn&&qt.error("Skipped sending event because buffer is full."),v("queue_overflow"),Promise.resolve({});throw y})},flush:u=>r.drain(u)}}function ak(a){const t=[];a.message&&t.push(a.message);try{const r=a.exception.values[a.exception.values.length-1];r!=null&&r.value&&(t.push(r.value),r.type&&t.push(`${r.type}: ${r.value}`))}catch{}return t}const ok="Not capturing exception because it's already been captured.",lk="Discarded session because of missing or non-string release",uk=Symbol.for("SentryInternalError"),ck=Symbol.for("SentryDoNotSendEventError");function r0(a){return{message:a,[uk]:!0}}function fE(a){return{message:a,[ck]:!0}}function dk(a){return!!a&&typeof a=="object"&&uk in a}function hk(a){return!!a&&typeof a=="object"&&ck in a}function fk(a,t,r,s,u){let f,c=0,v=!1;a.on(r,()=>{c=0,clearTimeout(f),v=!1}),a.on(t,y=>{c+=s(y),c>=8e5?u(a):v||(v=!0,f=setTimeout(()=>{u(a)},5e3))}),a.on("flush",()=>{u(a)})}class iP{constructor(t){var r,s,u;if(this.Hn=t,this.Vn={},this.Gn=0,this.Xn={},this.qn={},this.rn=[],this.Kn=hE(((r=t.transportOptions)==null?void 0:r.bufferSize)??64),t.dsn?this.Wn=DA(t.dsn):vn&&qt.warn("No DSN provided, client will not send events."),this.Wn){const f=eP(this.Wn,t.tunnel,t.jn?t.jn.sdk:void 0);this.zn=t.transport({tunnel:this.Hn.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...t.transportOptions,url:f})}this.Hn.enableLogs=this.Hn.enableLogs??((s=this.Hn.Yn)==null?void 0:s.enableLogs),this.Hn.enableLogs&&fk(this,"afterCaptureLog","flushLogs",aP,nk),(this.Hn.enableMetrics??((u=this.Hn.Yn)==null?void 0:u.enableMetrics)??!0)&&fk(this,"afterCaptureMetric","flushMetrics",sP,ik)}captureException(t,r,s){const u=Ma();if(bA(t))return vn&&qt.log(ok),u;const f={event_id:u,...r};return this.Qn(()=>this.eventFromException(t,f).then(c=>this.Jn(c,f,s)).then(c=>c),"error"),f.event_id}captureMessage(t,r,s,u){const f={event_id:Ma(),...s},c=Yb(t)?t:String(t),v=Xv(t),y=v?this.eventFromMessage(c,r,f):this.eventFromException(t,f);return this.Qn(()=>y.then(E=>this.Jn(E,f,u)),v?"unknown":"error"),f.event_id}captureEvent(t,r,s){const u=Ma();if(r!=null&&r.originalException&&bA(r.originalException))return vn&&qt.log(ok),u;const f={event_id:u,...r},c=t.sdkProcessingMetadata||{},v=c.capturedSpanScope,y=c.capturedSpanIsolationScope,E=pk(t.type);return this.Qn(()=>this.Jn(t,f,v||s,y),E),f.event_id}captureSession(t){this.sendSession(t),Lf(t,{init:!1})}getDsn(){return this.Wn}getOptions(){return this.Hn}getSdkMetadata(){return this.Hn.jn}getTransport(){return this.zn}async flush(t){const r=this.zn;if(!r)return!0;this.emit("flush");const s=await this.Zn(t),u=await r.flush(t);return s&&u}async close(t){const r=await this.flush(t);return this.getOptions().enabled=!1,this.emit("close"),r}getEventProcessors(){return this.rn}addEventProcessor(t){this.rn.push(t)}init(){(this._i()||this.Hn.integrations.some(({name:t})=>t.startsWith("Spotlight")))&&this.qi()}getIntegrationByName(t){return this.Vn[t]}addIntegration(t){const r=this.Vn[t.name];tk(this,t,this.Vn),r||ek(this,[t])}sendEvent(t,r={}){this.emit("beforeSendEvent",t,r);let s=WD(t,this.Wn,this.Hn.jn,this.Hn.tunnel);for(const u of r.attachments||[])s=VD(s,zD(u));this.sendEnvelope(s).then(u=>this.emit("afterSendEvent",t,u))}sendSession(t){const{release:r,environment:s=aE}=this.Hn;if("aggregates"in t){const f=t.attrs||{};if(!f.release&&!r)return void(vn&&qt.warn(lk));f.release=f.release||r,f.environment=f.environment||s,t.attrs=f}else{if(!t.release&&!r)return void(vn&&qt.warn(lk));t.release=t.release||r,t.environment=t.environment||s}this.emit("beforeSendSession",t);const u=function(f,c,v,y){const E=HA(v);return Df({sent_at:new Date().toISOString(),...E&&{sdk:E},...!!y&&c&&{dsn:Cf(c)}},["aggregates"in f?[{type:"sessions"},f]:[{type:"session"},f.toJSON()]])}(t,this.Wn,this.Hn.jn,this.Hn.tunnel);this.sendEnvelope(u)}recordDroppedEvent(t,r,s=1){if(this.Hn.sendClientReports){const u=`${t}:${r}`;vn&&qt.log(`Recording outcome: "${u}"${s>1?` (${s} times)`:""}`),this.Xn[u]=(this.Xn[u]||0)+s}}on(t,r){const s=this.qn[t]=this.qn[t]||new Set,u=(...f)=>r(...f);return s.add(u),()=>{s.delete(u)}}emit(t,...r){const s=this.qn[t];s&&s.forEach(u=>u(...r))}async sendEnvelope(t){if(this.emit("beforeEnvelope",t),this._i()&&this.zn)try{return await this.zn.send(t)}catch(r){return vn&&qt.error("Error while sending envelope:",r),{}}return vn&&qt.error("Transport disabled"),{}}qi(){const{integrations:t}=this.Hn;this.Vn=function(r,s){const u={};return s.forEach(f=>{f&&tk(r,f,u)}),u}(this,t),ek(this,t)}tr(t,r){var v,y;let s=r.level==="fatal",u=!1;const f=(v=r.exception)==null?void 0:v.values;if(f){u=!0,s=!1;for(const E of f)if(((y=E.mechanism)==null?void 0:y.handled)===!1){s=!0;break}}const c=t.status==="ok";(c&&t.errors===0||c&&s)&&(Lf(t,{...s&&{status:"crashed"},errors:t.errors||Number(u||s)}),this.captureSession(t))}async Zn(t){let r=0;for(;!t||r<t;){if(await new Promise(s=>setTimeout(s,1)),!this.Gn)return!0;r++}return!1}_i(){return this.getOptions().enabled!==!1&&this.zn!==void 0}er(t,r,s,u){const f=this.getOptions(),c=Object.keys(this.Vn);return!r.integrations&&(c!=null&&c.length)&&(r.integrations=c),this.emit("preprocessEvent",t,r),t.type||u.setLastEventId(t.event_id||r.event_id),XD(f,t,r,s,this,u).then(v=>{if(v===null)return v;this.emit("postprocessEvent",v,r),v.contexts={trace:PD(s),...v.contexts};const y=function(E,A){const L=A.getPropagationContext();return L.dsc||BA(L.traceId,E)}(this,s);return v.sdkProcessingMetadata={dynamicSamplingContext:y,...v.sdkProcessingMetadata},v})}Jn(t,r={},s=eu(),u=zd()){return vn&&pE(t)&&qt.log(`Captured error event \`${ak(t)[0]||"<unknown>"}\``),this.nr(t,r,s,u).then(f=>f.event_id,f=>{vn&&(hk(f)?qt.log(f.message):dk(f)?qt.warn(f.message):qt.warn(f))})}nr(t,r,s,u){const f=this.getOptions(),{sampleRate:c}=f,v=gk(t),y=pE(t),E=`before send for type \`${t.type||"error"}\``,A=c===void 0?void 0:function(T){if(typeof T=="boolean")return Number(T);const M=typeof T=="string"?parseFloat(T):T;return typeof M!="number"||isNaN(M)||M<0||M>1?void 0:M}(c);if(y&&typeof A=="number"&&Math.random()>A)return this.recordDroppedEvent("sample_rate","error"),uE(fE(`Discarding event because it's not included in the random sample (sampling rate = ${c})`));const L=pk(t.type);return this.er(t,r,s,u).then(T=>{if(T===null)throw this.recordDroppedEvent("event_processor",L),fE("An event processor returned `null`, will not send event.");if(r.data&&r.data.ir===!0)return T;const M=function(O,U,$,z){const{beforeSend:Q,beforeSendTransaction:Z,beforeSendSpan:ie,ignoreSpans:se}=U;let ye=$;if(pE(ye)&&Q)return Q(ye,z);if(gk(ye)){if(ie||se){const re=function(ne){var ue;const{trace_id:Se,parent_span_id:ce,span_id:we,status:ze,origin:xe,data:Ce,op:J}=((ue=ne.contexts)==null?void 0:ue.trace)??{};return{data:Ce??{},description:ne.transaction,op:J,parent_span_id:ce,span_id:we??"",start_timestamp:ne.start_timestamp??0,status:ze,timestamp:ne.timestamp,trace_id:Se??"",origin:xe,profile_id:Ce==null?void 0:Ce[xA],exclusive_time:Ce==null?void 0:Ce[IA],measurements:ne.measurements,is_segment:!0}}(ye);if(se!=null&&se.length&&UA(re,se))return null;if(ie){const ne=ie(re);ne?ye=um($,{type:"transaction",timestamp:(N=ne).timestamp,start_timestamp:N.start_timestamp,transaction:N.description,contexts:{trace:{trace_id:N.trace_id,span_id:N.span_id,parent_span_id:N.parent_span_id,op:N.op,status:N.status,origin:N.origin,data:{...N.data,...N.profile_id&&{[xA]:N.profile_id},...N.exclusive_time&&{[IA]:N.exclusive_time}}}},measurements:N.measurements}):_A()}if(ye.spans){const ne=[],Se=ye.spans;for(const we of Se)if(se!=null&&se.length&&UA(we,se))GD(Se,we);else if(ie){const ze=ie(we);ze?ne.push(ze):(_A(),ne.push(we))}else ne.push(we);const ce=ye.spans.length-ne.length;ce&&O.recordDroppedEvent("before_send","span",ce),ye.spans=ne}}if(Z){if(ye.spans){const re=ye.spans.length;ye.sdkProcessingMetadata={...$.sdkProcessingMetadata,spanCountBeforeProcessing:re}}return Z(ye,z)}}var N;return ye}(this,f,T,r);return function(O,U){const $=`${U} must return \`null\` or a valid event.`;if(om(O))return O.then(z=>{if(!am(z)&&z!==null)throw r0($);return z},z=>{throw r0(`${U} rejected with ${z}`)});if(!am(O)&&O!==null)throw r0($);return O}(M,E)}).then(T=>{var U;if(T===null){if(this.recordDroppedEvent("before_send",L),v){const $=1+(t.spans||[]).length;this.recordDroppedEvent("before_send","span",$)}throw fE(`${E} returned \`null\`, will not send event.`)}const M=s.getSession()||u.getSession();if(y&&M&&this.tr(M,T),v){const $=(((U=T.sdkProcessingMetadata)==null?void 0:U.spanCountBeforeProcessing)||0)-(T.spans?T.spans.length:0);$>0&&this.recordDroppedEvent("before_send","span",$)}const O=T.transaction_info;if(v&&O&&T.transaction!==t.transaction){const $="custom";T.transaction_info={...O,source:$}}return this.sendEvent(T,r),T}).then(null,T=>{throw hk(T)||dk(T)?T:(this.captureException(T,{mechanism:{handled:!1,type:"internal"},data:{ir:!0},originalException:T}),r0(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
Reason: ${T}`))})}Qn(t,r){this.Gn++,this.Kn.add(t).then(s=>(this.Gn--,s),s=>(this.Gn--,s===dE&&this.recordDroppedEvent("queue_overflow",r),s))}rr(){const t=this.Xn;return this.Xn={},Object.entries(t).map(([r,s])=>{const[u,f]=r.split(":");return{reason:u,category:f,quantity:s}})}sr(){vn&&qt.log("Flushing outcomes...");const t=this.rr();if(t.length===0)return void(vn&&qt.log("No outcomes to send"));if(!this.Wn)return void(vn&&qt.log("No dsn provided, will not send outcomes"));vn&&qt.log("Sending outcomes:",t);const r=(s=t,Df((u=this.Hn.tunnel&&Cf(this.Wn))?{dsn:u}:{},[[{type:"client_report"},{timestamp:lm(),discarded_events:s}]]));var s,u;this.sendEnvelope(r)}}function pk(a){return a==="replay_event"?"replay":a||"error"}function pE(a){return a.type===void 0}function gk(a){return a.type==="transaction"}function sP(a){let t=0;return a.name&&(t+=2*a.name.length),t+=8,t+mk(a.attributes)}function aP(a){let t=0;return a.message&&(t+=2*a.message.length),t+mk(a.attributes)}function mk(a){if(!a)return 0;let t=0;return Object.values(a).forEach(r=>{Array.isArray(r)?t+=r.length*yk(r[0]):Xv(r)?t+=yk(r):t+=100}),t}function yk(a){return typeof a=="string"?2*a.length:typeof a=="number"?8:typeof a=="boolean"?4:0}function oP(a,t){t.debug===!0&&(vn?qt.enable():kf(()=>{})),eu().update(t.initialScope);const r=new a(t);return function(s){eu().setClient(s)}(r),r.init(),r}function gE(a){if(!a)return{};const t=a.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};const r=t[6]||"",s=t[8]||"";return{host:t[4],path:t[5],protocol:t[2],search:r,hash:s,relative:t[5]+r+s}}function lP(a){var t;"aggregates"in a?((t=a.attrs)==null?void 0:t.ip_address)===void 0&&(a.attrs={...a.attrs,ip_address:"{{auto}}"}):a.ipAddress===void 0&&(a.ipAddress="{{auto}}")}function vk(a,t,r=[t],s="npm"){const u=a.jn||{};u.sdk||(u.sdk={name:`sentry.javascript.${t}`,packages:r.map(f=>({name:`${s}:@sentry/${f}`,version:$d})),version:$d}),a.jn=u}const uP=100;function qd(a,t){const r=_i(),s=zd();if(!r)return;const{beforeBreadcrumb:u=null,maxBreadcrumbs:f=uP}=r.getOptions();if(f<=0)return;const c={timestamp:lm(),...a},v=u?kf(()=>u(c,t)):c;v!==null&&(r.emit&&r.emit("beforeAddBreadcrumb",v,t),s.addBreadcrumb(v,f))}let bk;const Ek=new WeakMap,cP=()=>({name:"FunctionToString",setupOnce(){bk=Function.prototype.toString;try{Function.prototype.toString=function(...a){const t=Jb(this),r=Ek.has(_i())&&t!==void 0?t:this;return bk.apply(r,a)}}catch{}},setup(a){Ek.set(a,!0)}}),dP=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,`can't redefine non-configurable property "solana"`,"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)","Can't find variable: _AutofillCallbackHandler",/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/,/^Java exception was raised during method invocation$/],hP=(a={})=>{let t;return{name:"EventFilters",setup(r){const s=r.getOptions();t=Tk(a,s)},processEvent(r,s,u){if(!t){const f=u.getOptions();t=Tk(a,f)}return function(f,c){if(f.type){if(f.type==="transaction"&&function(v,y){if(!(y!=null&&y.length))return!1;const E=v.transaction;return!!E&&e0(E,y)}(f,c.ignoreTransactions))return vn&&qt.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
Event: ${Kd(f)}`),!0}else{if(function(v,y){return y!=null&&y.length?ak(v).some(E=>e0(E,y)):!1}(f,c.ignoreErrors))return vn&&qt.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
Event: ${Kd(f)}`),!0;if(function(v){var y,E;return(E=(y=v.exception)==null?void 0:y.values)!=null&&E.length?!v.message&&!v.exception.values.some(A=>A.stacktrace||A.type&&A.type!=="Error"||A.value):!1}(f))return vn&&qt.warn(`Event dropped due to not having an error message, error type or stacktrace.
Event: ${Kd(f)}`),!0;if(function(v,y){if(!(y!=null&&y.length))return!1;const E=i0(v);return!!E&&e0(E,y)}(f,c.denyUrls))return vn&&qt.warn(`Event dropped due to being matched by \`denyUrls\` option.
Event: ${Kd(f)}.
Url: ${i0(f)}`),!0;if(!function(v,y){if(!(y!=null&&y.length))return!0;const E=i0(v);return!E||e0(E,y)}(f,c.allowUrls))return vn&&qt.warn(`Event dropped due to not being matched by \`allowUrls\` option.
Event: ${Kd(f)}.
Url: ${i0(f)}`),!0}return!1}(r,t)?null:r}}},fP=(a={})=>({...hP(a),name:"InboundFilters"});function Tk(a={},t={}){return{allowUrls:[...a.allowUrls||[],...t.allowUrls||[]],denyUrls:[...a.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...a.ignoreErrors||[],...t.ignoreErrors||[],...a.disableErrorDefaults?[]:dP],ignoreTransactions:[...a.ignoreTransactions||[],...t.ignoreTransactions||[]]}}function i0(a){var t,r;try{const s=[...((t=a.exception)==null?void 0:t.values)??[]].reverse().find(f=>{var c,v,y;return((c=f.mechanism)==null?void 0:c.parent_id)===void 0&&((y=(v=f.stacktrace)==null?void 0:v.frames)==null?void 0:y.length)}),u=(r=s==null?void 0:s.stacktrace)==null?void 0:r.frames;return u?function(f=[]){for(let c=f.length-1;c>=0;c--){const v=f[c];if(v&&v.filename!=="<anonymous>"&&v.filename!=="[native code]")return v.filename||null}return null}(u):null}catch{return vn&&qt.error(`Cannot extract url for event ${Kd(a)}`),null}}function pP(a,t,r,s,u,f){var v;if(!((v=u.exception)!=null&&v.values)||!f||!Ec(f.originalException,Error))return;const c=u.exception.values.length>0?u.exception.values[u.exception.values.length-1]:void 0;c&&(u.exception.values=mE(a,t,s,f.originalException,r,u.exception.values,c,0))}function mE(a,t,r,s,u,f,c,v){if(f.length>=r+1)return f;let y=[...f];if(Ec(s[u],Error)){Sk(c,v);const E=a(t,s[u]),A=y.length;wk(E,u,A,v),y=mE(a,t,r,s[u],u,[E,...y],E,A)}return Array.isArray(s.errors)&&s.errors.forEach((E,A)=>{if(Ec(E,Error)){Sk(c,v);const L=a(t,E),T=y.length;wk(L,`errors[${A}]`,T,v),y=mE(a,t,r,E,u,[L,...y],L,T)}}),y}function Sk(a,t){a.mechanism={handled:!0,type:"auto.core.linked_errors",...a.mechanism,...a.type==="AggregateError"&&{is_exception_group:!0},exception_id:t}}function wk(a,t,r,s){a.mechanism={handled:!0,...a.mechanism,type:"chained",source:t,exception_id:r,parent_id:s}}function gP(){"console"in hr&&AD.forEach(function(a){a in hr.console&&ua(hr.console,a,function(t){return qv[a]=t,function(...r){vo("console",{args:r,level:a});const s=qv[a];s==null||s.apply(hr.console,r)}})})}function mP(a){return a==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(a)?a:"log"}const yP=()=>{let a;return{name:"Dedupe",processEvent(t){if(t.type)return t;try{if(function(r,s){return s?!!(function(u,f){const c=u.message,v=f.message;return!(!c&&!v||c&&!v||!c&&v||c!==v||!kk(u,f)||!Ak(u,f))}(r,s)||function(u,f){const c=xk(f),v=xk(u);return!(!c||!v||c.type!==v.type||c.value!==v.value||!kk(u,f)||!Ak(u,f))}(r,s)):!1}(t,a))return vn&&qt.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return a=t}}};function Ak(a,t){let r=sA(a),s=sA(t);if(!r&&!s)return!0;if(r&&!s||!r&&s||s.length!==r.length)return!1;for(let u=0;u<s.length;u++){const f=s[u],c=r[u];if(f.filename!==c.filename||f.lineno!==c.lineno||f.colno!==c.colno||f.function!==c.function)return!1}return!0}function kk(a,t){let r=a.fingerprint,s=t.fingerprint;if(!r&&!s)return!0;if(r&&!s||!r&&s)return!1;try{return r.join("")===s.join("")}catch{return!1}}function xk(a){var t,r;return(r=(t=a.exception)==null?void 0:t.values)==null?void 0:r[0]}function Ik(a){return a===void 0?void 0:a>=400&&a<500?"warning":a>=500?"error":void 0}const dm=hr;function yE(a){return a&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(a.toString())}function vP(){var r;if(typeof EdgeRuntime=="string")return!0;if(!function(){if(!("fetch"in dm))return!1;try{return new Headers,new Request("data:,"),new Response,!0}catch{return!1}}())return!1;if(yE(dm.fetch))return!0;let a=!1;const t=dm.document;if(t&&typeof t.createElement=="function")try{const s=t.createElement("iframe");s.hidden=!0,t.head.appendChild(s),(r=s.contentWindow)!=null&&r.fetch&&(a=yE(s.contentWindow.fetch)),t.head.removeChild(s)}catch(s){vn&&qt.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",s)}return a}function bP(a,t){const r="fetch";Gd(r,a),Hd(r,()=>function(s,u=!1){u&&!vP()||ua(hr,"fetch",function(f){return function(...c){const v=new Error,{method:y,url:E}=function(L){if(L.length===0)return{method:"GET",url:""};if(L.length===2){const[M,O]=L;return{url:Lk(M),method:vE(O,"method")?String(O.method).toUpperCase():"GET"}}const T=L[0];return{url:Lk(T),method:vE(T,"method")?String(T.method).toUpperCase():"GET"}}(c),A={args:c,fetchData:{method:y,url:E},startTimestamp:1e3*Zl(),virtualError:v,headers:EP(c)};return vo("fetch",{...A}),f.apply(hr,c).then(async L=>(vo("fetch",{...A,endTimestamp:1e3*Zl(),response:L}),L),L=>{if(vo("fetch",{...A,endTimestamp:1e3*Zl(),error:L}),Qv(L)&&L.stack===void 0&&(L.stack=v.stack,Vd(L,"framesToPop",1)),L instanceof TypeError&&(L.message==="Failed to fetch"||L.message==="Load failed"||L.message==="NetworkError when attempting to fetch resource."))try{const T=new URL(A.fetchData.url);L.message=`${L.message} (${T.host})`}catch{}throw L})}})}(0,t))}function vE(a,t){return!!a&&typeof a=="object"&&!!a[t]}function Lk(a){return typeof a=="string"?a:a?vE(a,"url")?a.url:a.toString?a.toString():"":""}function EP(a){const[t,r]=a;try{if(typeof r=="object"&&r!==null&&"headers"in r&&r.headers)return new Headers(r.headers);if(s=t,typeof Request<"u"&&Ec(s,Request))return new Headers(t.headers)}catch{}var s}const xr=hr;let bE=0;function Rk(){return bE>0}function Pf(a,t={}){if(!function(s){return typeof s=="function"}(a))return a;try{const s=a.ar;if(s)return typeof s=="function"?s:a;if(Jb(a))return a}catch{return a}const r=function(...s){try{const u=s.map(f=>Pf(f,t));return a.apply(this,u)}catch(u){throw bE++,setTimeout(()=>{bE--}),iE(f=>{f.addEventProcessor(c=>(t.mechanism&&(tE(c,void 0),If(c,t.mechanism)),c.extra={...c.extra,arguments:s},c)),rl(u)}),u}};try{for(const s in a)Object.prototype.hasOwnProperty.call(a,s)&&(r[s]=a[s])}catch{}fA(r,a),Vd(a,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get:()=>a.name})}catch{}return r}function EE(a,t){const r=SE(a,t),s={type:wP(t),value:AP(t)};return r.length&&(s.stacktrace={frames:r}),s.type===void 0&&s.value===""&&(s.value="Unrecoverable error caught"),s}function TP(a,t,r,s){const u=_i(),f=u==null?void 0:u.getOptions().normalizeDepth,c=function(E){for(const A in E)if(Object.prototype.hasOwnProperty.call(E,A)){const L=E[A];if(L instanceof Error)return L}}(t),v={ur:$A(t,f)};if(c)return{exception:{values:[EE(a,c)]},extra:v};const y={exception:{values:[{type:Jv(t)?t.constructor.name:s?"UnhandledRejection":"Error",value:kP(t,{isUnhandledRejection:s})}]},extra:v};if(r){const E=SE(a,r);E.length&&(y.exception.values[0].stacktrace={frames:E})}return y}function TE(a,t){return{exception:{values:[EE(a,t)]}}}function SE(a,t){const r=t.stacktrace||t.stack||"",s=function(f){return f&&SP.test(f.message)?1:0}(t),u=function(f){return typeof f.framesToPop=="number"?f.framesToPop:0}(t);try{return a(r,s,u)}catch{}return[]}const SP=/Minified React error #\d+;/i;function Ck(a){return typeof WebAssembly<"u"&&WebAssembly.Exception!==void 0&&a instanceof WebAssembly.Exception}function wP(a){const t=a==null?void 0:a.name;return!t&&Ck(a)?a.message&&Array.isArray(a.message)&&a.message.length==2?a.message[0]:"WebAssembly.Exception":t}function AP(a){const t=a==null?void 0:a.message;return Ck(a)?Array.isArray(a.message)&&a.message.length==2?a.message[1]:"wasm exception":t?t.error&&typeof t.error.message=="string"?t.error.message:t:"No error message"}function wE(a,t,r,s,u){let f;if(uA(t)&&t.error)return TE(a,t.error);if(cA(t)||xf(t,"DOMException")){const c=t;if("stack"in t)f=TE(a,t);else{const v=c.name||(cA(c)?"DOMError":"DOMException"),y=c.message?`${v}: ${c.message}`:v;f=AE(a,y,r,s),tE(f,y)}return"code"in c&&(f.tags={...f.tags,"DOMException.code":`${c.code}`}),f}return Qv(t)?TE(a,t):am(t)||Jv(t)?(f=TP(a,t,r,u),If(f,{synthetic:!0}),f):(f=AE(a,t,r,s),tE(f,`${t}`),If(f,{synthetic:!0}),f)}function AE(a,t,r,s){const u={};if(s&&r){const f=SE(a,r);f.length&&(u.exception={values:[{value:t,stacktrace:{frames:f}}]}),If(u,{synthetic:!0})}if(Yb(t)){const{Yt:f,Qt:c}=t;return u.logentry={message:f,params:c},u}return u.message=t,u}function kP(a,{isUnhandledRejection:t}){const r=function(u){const f=Object.keys(pA(u));return f.sort(),f[0]?f.join(", "):"[object has no keys]"}(a),s=t?"promise rejection":"exception";return uA(a)?`Event \`ErrorEvent\` captured as ${s} with message \`${a.message}\``:Jv(a)?`Event \`${function(u){try{const f=Object.getPrototypeOf(u);return f?f.constructor.name:void 0}catch{}}(a)}\` (type=${a.type}) captured as ${s}`:`Object captured as ${s} with keys: ${r}`}class xP extends iP{constructor(t){var A,L;const r=(s=t,{release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:(A=xr.SENTRY_RELEASE)==null?void 0:A.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...s});var s;vk(r,"browser",["browser"],xr.SENTRY_SDK_SOURCE||"npm"),(L=r.jn)!=null&&L.sdk&&(r.jn.sdk.settings={infer_ip:r.sendDefaultPii?"auto":"never",...r.jn.sdk.settings}),super(r);const{sendDefaultPii:u,sendClientReports:f,enableLogs:c,Yn:v,enableMetrics:y}=this.Hn,E=y??(v==null?void 0:v.enableMetrics)??!0;xr.document&&(f||c||E)&&xr.document.addEventListener("visibilitychange",()=>{xr.document.visibilityState==="hidden"&&(f&&this.sr(),c&&nk(this),E&&ik(this))}),u&&this.on("beforeSendSession",lP)}eventFromException(t,r){return function(s,u,f,c){const v=wE(s,u,(f==null?void 0:f.syntheticException)||void 0,c);return If(v),v.level="error",f!=null&&f.event_id&&(v.event_id=f.event_id),t0(v)}(this.Hn.stackParser,t,r,this.Hn.attachStacktrace)}eventFromMessage(t,r="info",s){return function(u,f,c="info",v,y){const E=AE(u,f,(v==null?void 0:v.syntheticException)||void 0,y);return E.level=c,v!=null&&v.event_id&&(E.event_id=v.event_id),t0(E)}(this.Hn.stackParser,t,r,s,this.Hn.attachStacktrace)}er(t,r,s,u){return t.platform=t.platform||"javascript",super.er(t,r,s,u)}}const IP=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,gs=hr;let Dk,kE,xE,s0;function LP(){if(!gs.document)return;const a=vo.bind(null,"dom"),t=Pk(a,!0);gs.document.addEventListener("click",t,!1),gs.document.addEventListener("keypress",t,!1),["EventTarget","Node"].forEach(r=>{var f,c;const s=gs,u=(f=s[r])==null?void 0:f.prototype;(c=u==null?void 0:u.hasOwnProperty)!=null&&c.call(u,"addEventListener")&&(ua(u,"addEventListener",function(v){return function(y,E,A){if(y==="click"||y=="keypress")try{const L=this.lr=this.lr||{},T=L[y]=L[y]||{refCount:0};if(!T.handler){const M=Pk(a);T.handler=M,v.call(this,y,M,A)}T.refCount++}catch{}return v.call(this,y,E,A)}}),ua(u,"removeEventListener",function(v){return function(y,E,A){if(y==="click"||y=="keypress")try{const L=this.lr||{},T=L[y];T&&(T.refCount--,T.refCount<=0&&(v.call(this,y,T.handler,A),T.handler=void 0,delete L[y]),Object.keys(L).length===0&&delete this.lr)}catch{}return v.call(this,y,E,A)}}))})}function Pk(a,t=!1){return r=>{if(!r||r.cr)return;const s=function(f){try{return f.target}catch{return null}}(r);if(function(f,c){return f==="keypress"&&(!(c!=null&&c.tagName)||c.tagName!=="INPUT"&&c.tagName!=="TEXTAREA"&&!c.isContentEditable)}(r.type,s))return;Vd(r,"_sentryCaptured",!0),s&&!s.hr&&Vd(s,"_sentryId",Ma());const u=r.type==="keypress"?"input":r.type;(function(f){if(f.type!==kE)return!1;try{if(!f.target||f.target.hr!==xE)return!1}catch{}return!0})(r)||(a({event:r,name:u,global:t}),kE=r.type,xE=s?s.hr:void 0),clearTimeout(Dk),Dk=gs.setTimeout(()=>{xE=void 0,kE=void 0},1e3)}}function Mk(a){const t="history";Gd(t,a),Hd(t,RP)}function RP(){function a(t){return function(...r){const s=r.length>2?r[2]:void 0;if(s){const u=s0,f=function(c){try{return new URL(c,gs.location.origin).toString()}catch{return c}}(String(s));if(s0=f,u===f)return t.apply(this,r);vo("history",{from:u,to:f})}return t.apply(this,r)}}gs.addEventListener("popstate",()=>{const t=gs.location.href,r=s0;s0=t,r!==t&&vo("history",{from:r,to:t})}),"history"in dm&&dm.history&&(ua(gs.history,"pushState",a),ua(gs.history,"replaceState",a))}const a0={},hm="__sentry_xhr_v3__";function CP(){if(!gs.XMLHttpRequest)return;const a=XMLHttpRequest.prototype;a.open=new Proxy(a.open,{apply(t,r,s){const u=new Error,f=1e3*Zl(),c=Jl(s[0])?s[0].toUpperCase():void 0,v=function(E){if(Jl(E))return E;try{return E.toString()}catch{}}(s[1]);if(!c||!v)return t.apply(r,s);r[hm]={method:c,url:v,request_headers:{}},c==="POST"&&v.match(/sentry_key/)&&(r.dr=!0);const y=()=>{const E=r[hm];if(E&&r.readyState===4){try{E.status_code=r.status}catch{}vo("xhr",{endTimestamp:1e3*Zl(),startTimestamp:f,xhr:r,virtualError:u})}};return"onreadystatechange"in r&&typeof r.onreadystatechange=="function"?r.onreadystatechange=new Proxy(r.onreadystatechange,{apply:(E,A,L)=>(y(),E.apply(A,L))}):r.addEventListener("readystatechange",y),r.setRequestHeader=new Proxy(r.setRequestHeader,{apply(E,A,L){const[T,M]=L,O=A[hm];return O&&Jl(T)&&Jl(M)&&(O.request_headers[T.toLowerCase()]=M),E.apply(A,L)}}),t.apply(r,s)}}),a.send=new Proxy(a.send,{apply(t,r,s){const u=r[hm];return u?(s[0]!==void 0&&(u.body=s[0]),vo("xhr",{startTimestamp:1e3*Zl(),xhr:r}),t.apply(r,s)):t.apply(r,s)}})}function DP(a,t=function(r){const s=a0[r];if(s)return s;let u=gs[r];if(yE(u))return a0[r]=u.bind(gs);const f=gs.document;if(f&&typeof f.createElement=="function")try{const c=f.createElement("iframe");c.hidden=!0,f.head.appendChild(c);const v=c.contentWindow;v!=null&&v[r]&&(u=v[r]),f.head.removeChild(c)}catch(c){IP&&qt.warn(`Could not create sandbox iframe for ${r} check, bailing to window.${r}: `,c)}return u&&(a0[r]=u.bind(gs))}("fetch")){let r=0,s=0;return rP(a,async function(u){const f=u.body.length;r+=f,s++;const c={body:u.body,method:"POST",referrerPolicy:"strict-origin",headers:a.headers,keepalive:r<=6e4&&s<15,...a.fetchOptions};try{const v=await t(a.url,c);return{statusCode:v.status,headers:{"x-sentry-rate-limits":v.headers.get("X-Sentry-Rate-Limits"),"retry-after":v.headers.get("Retry-After")}}}catch(v){throw a0.fetch=void 0,v}finally{r-=f,s--}},hE(a.bufferSize||40))}const Mf=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__;function IE(a,t,r,s){const u={filename:a,function:t==="<anonymous>"?jd:t,in_app:!0};return r!==void 0&&(u.lineno=r),s!==void 0&&(u.colno=s),u}const PP=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,MP=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,OP=/\((\S*)(?::(\d+))(?::(\d+))\)/,NP=/at (.+?) ?\(data:(.+?),/,_P=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,FP=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,UP=rA([30,a=>{const t=a.match(NP);if(t)return{filename:`<data:${t[2]}>`,function:t[1]};const r=PP.exec(a);if(r){const[,u,f,c]=r;return IE(u,jd,+f,+c)}const s=MP.exec(a);if(s){if(s[2]&&s[2].indexOf("eval")===0){const c=OP.exec(s[2]);c&&(s[2]=c[1],s[3]=c[2],s[4]=c[3])}const[u,f]=Ok(s[1]||jd,s[2]);return IE(f,u,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}}],[50,a=>{const t=_P.exec(a);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){const u=FP.exec(t[3]);u&&(t[1]=t[1]||"eval",t[3]=u[1],t[4]=u[2],t[5]="")}let r=t[3],s=t[1]||jd;return[s,r]=Ok(s,r),IE(r,s,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]),Ok=(a,t)=>{const r=a.indexOf("safari-extension")!==-1,s=a.indexOf("safari-web-extension")!==-1;return r||s?[a.indexOf("@")!==-1?a.split("@")[0]:jd,r?`safari-extension:${t}`:`safari-web-extension:${t}`]:[a,t]},Nk=1024,BP=(a={})=>{const t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...a};return{name:"Breadcrumbs",setup(r){var s;t.console&&function(u){const f="console";Gd(f,u),Hd(f,gP)}(function(u){return function(f){if(_i()!==u)return;const c={category:"console",data:{arguments:f.args,logger:"console"},level:mP(f.level),message:yA(f.args," ")};if(f.level==="assert"){if(f.args[0]!==!1)return;c.message=`Assertion failed: ${yA(f.args.slice(1)," ")||"console.assert"}`,c.data.arguments=f.args.slice(1)}qd(c,{input:f.args,level:f.level})}}(r)),t.dom&&(s=function(u,f){return function(c){if(_i()!==u)return;let v,y,E=typeof f=="object"?f.serializeAttribute:void 0,A=typeof f=="object"&&typeof f.maxStringLength=="number"?f.maxStringLength:void 0;A&&A>Nk&&(Mf&&qt.warn(`\`dom.maxStringLength\` cannot exceed 1024, but a value of ${A} was configured. Sentry will use 1024 instead.`),A=Nk),typeof E=="string"&&(E=[E]);try{const T=c.event,M=function(O){return!!O&&!!O.target}(T)?T.target:T;v=hA(M,{keyAttrs:E,maxStringLength:A}),y=function(O){if(!Qb.HTMLElement)return null;let U=O;for(let $=0;$<5;$++){if(!U)return null;if(U instanceof HTMLElement){if(U.dataset.sentryComponent)return U.dataset.sentryComponent;if(U.dataset.sentryElement)return U.dataset.sentryElement}U=U.parentNode}return null}(M)}catch{v="<unknown>"}if(v.length===0)return;const L={category:`ui.${c.name}`,message:v};y&&(L.data={"ui.component_name":y}),qd(L,{event:c.event,name:c.name,global:c.global})}}(r,t.dom),Gd("dom",s),Hd("dom",LP)),t.xhr&&function(u){Gd("xhr",u),Hd("xhr",CP)}(function(u){return function(f){if(_i()!==u)return;const{startTimestamp:c,endTimestamp:v}=f,y=f.xhr[hm];if(!c||!v||!y)return;const{method:E,url:A,status_code:L,body:T}=y,M={method:E,url:A,status_code:L},O={xhr:f.xhr,input:T,startTimestamp:c,endTimestamp:v},U={category:"xhr",data:M,type:"http",level:Ik(L)};u.emit("beforeOutgoingRequestBreadcrumb",U,O),qd(U,O)}}(r)),t.fetch&&bP(function(u){return function(f){if(_i()!==u)return;const{startTimestamp:c,endTimestamp:v}=f;if(v&&(!f.fetchData.url.match(/sentry_key/)||f.fetchData.method!=="POST"))if(f.fetchData.method,f.fetchData.url,f.error){const y=f.fetchData,E={data:f.error,input:f.args,startTimestamp:c,endTimestamp:v},A={category:"fetch",data:y,level:"error",type:"http"};u.emit("beforeOutgoingRequestBreadcrumb",A,E),qd(A,E)}else{const y=f.response,E={...f.fetchData,status_code:y==null?void 0:y.status};f.fetchData.request_body_size,f.fetchData.response_body_size;const A={input:f.args,response:y,startTimestamp:c,endTimestamp:v},L={category:"fetch",data:E,type:"http",level:Ik(E.status_code)};u.emit("beforeOutgoingRequestBreadcrumb",L,A),qd(L,A)}}}(r)),t.history&&Mk(function(u){return function(f){if(_i()!==u)return;let c=f.from,v=f.to;const y=gE(xr.location.href);let E=c?gE(c):void 0;const A=gE(v);E!=null&&E.path||(E=y),y.protocol===A.protocol&&y.host===A.host&&(v=A.relative),y.protocol===E.protocol&&y.host===E.host&&(c=E.relative),qd({category:"navigation",data:{from:c,to:v}})}}(r)),t.sentry&&r.on("beforeSendEvent",function(u){return function(f){_i()===u&&qd({category:"sentry."+(f.type==="transaction"?"transaction":"event"),event_id:f.event_id,level:f.level,message:Kd(f)},{event:f})}}(r))}}},$P=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],jP=(a={})=>{const t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...a};return{name:"BrowserApiErrors",setupOnce(){t.setTimeout&&ua(xr,"setTimeout",_k),t.setInterval&&ua(xr,"setInterval",_k),t.requestAnimationFrame&&ua(xr,"requestAnimationFrame",GP),t.XMLHttpRequest&&"XMLHttpRequest"in xr&&ua(XMLHttpRequest.prototype,"send",HP);const r=t.eventTarget;r&&(Array.isArray(r)?r:$P).forEach(s=>function(u,f){var y,E;const c=xr,v=(y=c[u])==null?void 0:y.prototype;(E=v==null?void 0:v.hasOwnProperty)!=null&&E.call(v,"addEventListener")&&(ua(v,"addEventListener",function(A){return function(L,T,M){try{typeof T.handleEvent=="function"&&(T.handleEvent=Pf(T.handleEvent,{mechanism:{data:{handler:bc(T),target:u},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return f.unregisterOriginalCallbacks&&function(O,U,$){O&&typeof O=="object"&&"removeEventListener"in O&&typeof O.removeEventListener=="function"&&O.removeEventListener(U,$)}(this,L,T),A.apply(this,[L,Pf(T,{mechanism:{data:{handler:bc(T),target:u},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),M])}}),ua(v,"removeEventListener",function(A){return function(L,T,M){try{const O=T.ar;O&&A.call(this,L,O,M)}catch{}return A.call(this,L,T,M)}}))}(s,t))}}};function _k(a){return function(...t){const r=t[0];return t[0]=Pf(r,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${bc(a)}`}}),a.apply(this,t)}}function GP(a){return function(t){return a.apply(this,[Pf(t,{mechanism:{data:{handler:bc(a)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function HP(a){return function(...t){const r=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(s=>{s in r&&typeof r[s]=="function"&&ua(r,s,function(u){const f={mechanism:{data:{handler:bc(u)},handled:!1,type:`auto.browser.browserapierrors.xhr.${s}`}},c=Jb(u);return c&&(f.mechanism.data.handler=bc(c)),Pf(u,f)})}),a.apply(this,t)}}const VP=()=>({name:"BrowserSession",setupOnce(){xr.document!==void 0?(WA({ignoreDuration:!0}),XA(),Mk(({from:a,to:t})=>{a!==void 0&&a!==t&&(WA({ignoreDuration:!0}),XA())})):Mf&&qt.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.")}}),Fk=(a={})=>{const t={onerror:!0,onunhandledrejection:!0,...a};return{name:"GlobalHandlers",setupOnce(){Error.stackTraceLimit=50},setup(r){t.onerror&&(function(s){(function(u){const f="error";Gd(f,u),Hd(f,kD)})(u=>{const{stackParser:f,attachStacktrace:c}=Bk();if(_i()!==s||Rk())return;const{msg:v,url:y,line:E,column:A,error:L}=u,T=function(M,O,U,$){const z=M.exception=M.exception||{},Q=z.values=z.values||[],Z=Q[0]=Q[0]||{},ie=Z.stacktrace=Z.stacktrace||{},se=ie.frames=ie.frames||[],ye=$,N=U,re=function(ne){if(!(!Jl(ne)||ne.length===0)){if(ne.startsWith("data:")){const Se=ne.match(/^data:([^;]+)/);return`<data:${Se?Se[1]:"text/javascript"}${ne.includes("base64,")?",base64":""}>`}return ne}}(O)??Xb();return se.length===0&&se.push({colno:ye,filename:re,function:jd,in_app:!0,lineno:N}),M}(wE(f,L||v,void 0,c,!1),y,E,A);T.level="error",qA(T,{originalException:L,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})})}(r),Uk("onerror")),t.onunhandledrejection&&(function(s){(function(u){const f="unhandledrejection";Gd(f,u),Hd(f,xD)})(u=>{const{stackParser:f,attachStacktrace:c}=Bk();if(_i()!==s||Rk())return;const v=function(E){if(Xv(E))return E;try{if("reason"in E)return E.reason;if("detail"in E&&"reason"in E.detail)return E.detail.reason}catch{}return E}(u),y=Xv(v)?{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(v)}`}]}}:wE(f,v,void 0,c,!0);y.level="error",qA(y,{originalException:v,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})})}(r),Uk("onunhandledrejection"))}}};function Uk(a){Mf&&qt.log(`Global Handler attached: ${a}`)}function Bk(){const a=_i();return(a==null?void 0:a.getOptions())||{stackParser:()=>[],attachStacktrace:!1}}const KP=()=>({name:"HttpContext",preprocessEvent(a){var s;if(!xr.navigator&&!xr.location&&!xr.document)return;const t=function(){const u=Xb(),{referrer:f}=xr.document||{},{userAgent:c}=xr.navigator||{};return{url:u,headers:{...f&&{Referer:f},...c&&{"User-Agent":c}}}}(),r={...t.headers,...(s=a.request)==null?void 0:s.headers};a.request={...t,...a.request,headers:r}}}),zP=(a={})=>{const t=a.limit||5,r=a.key||"cause";return{name:"LinkedErrors",preprocessEvent(s,u,f){pP(EE,f.getOptions().stackParser,r,t,s,u)}}};function qP(){return!!function(){var u;if(xr.window===void 0)return!1;const a=xr;if(a.nw)return!1;const t=a.chrome||a.browser;if(!((u=t==null?void 0:t.runtime)!=null&&u.id))return!1;const r=Xb(),s=["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"];return!(xr===xr.top&&s.some(f=>r.startsWith(`${f}://`)))}()&&(Mf&&kf(()=>{}),!0)}function WP(a={}){const t=!a.skipBrowserExtensionCheck&&qP();let r=a.defaultIntegrations==null?[fP(),cP(),jP(),BP(),Fk(),zP(),yP(),KP(),VP()]:a.defaultIntegrations;const s={...a,enabled:!t&&a.enabled,stackParser:(u=a.stackParser||UP,Array.isArray(u)?rA(...u):u),integrations:tP({integrations:a.integrations,defaultIntegrations:r}),transport:a.transport||DP};var u;return oP(xP,s)}function $k(a={}){const t=xr.document,r=(t==null?void 0:t.head)||(t==null?void 0:t.body);if(!r)return void(Mf&&qt.error("[showReportDialog] Global document not defined"));const s=eu(),u=_i(),f=u==null?void 0:u.getDsn();if(!f)return void(Mf&&qt.error("[showReportDialog] DSN not configured"));const c={...a,user:{...s.getUser(),...a.user},eventId:a.eventId||zd().lastEventId()},v=xr.document.createElement("script");v.async=!0,v.crossOrigin="anonymous",v.src=function(A,L){const T=DA(A);if(!T)return"";const M=`${JA(T)}embed/error-page/`;let O=`dsn=${Cf(T)}`;for(const U in L)if(U!=="dsn"&&U!=="onClose")if(U==="user"){const $=L.user;if(!$)continue;$.name&&(O+=`&name=${encodeURIComponent($.name)}`),$.email&&(O+=`&email=${encodeURIComponent($.email)}`)}else O+=`&${encodeURIComponent(U)}=${encodeURIComponent(L[U])}`;return`${M}?${O}`}(f,c);const{onLoad:y,onClose:E}=c;if(y&&(v.onload=y),E){const A=L=>{if(L.data==="__sentry_reportdialog_closed__")try{E()}finally{xr.removeEventListener("message",A)}};xr.addEventListener("message",A)}r.appendChild(v)}function YP(a,{componentStack:t},r){if(function(s){const u=s.match(/^([^.]+)/);return u!==null&&parseInt(u[0])>=17}(nr.version)&&Qv(a)&&t){const s=new Error(a.message);s.name=`React ErrorBoundary ${a.name}`,s.stack=t,function(u,f){const c=new WeakSet;(function v(y,E){if(!c.has(y))return y.cause?(c.add(y),v(y.cause,E)):void(y.cause=E)})(u,f)}(a,s)}return iE(s=>(s.setContext("react",{componentStack:t}),rl(a,r)))}const QP=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,LE={componentStack:null,error:null,eventId:null};let XP=class extends nr.Component{constructor(a){super(a),this.state=LE,this.vr=!0;const t=_i();t&&a.showDialog&&(this.vr=!1,this.mr=t.on("afterSendEvent",r=>{!r.type&&this.kn&&r.event_id===this.kn&&$k({...a.dialogOptions,eventId:this.kn})}))}componentDidCatch(a,t){const{componentStack:r}=t,{beforeCapture:s,onError:u,showDialog:f,dialogOptions:c}=this.props;iE(v=>{s&&s(v,a,r);const y=this.props.handled!=null?this.props.handled:!!this.props.fallback,E=YP(a,t,{mechanism:{handled:y,type:"auto.function.react.error_boundary"}});u&&u(a,r,E),f&&(this.kn=E,this.vr&&$k({...c,eventId:E})),this.setState({error:a,componentStack:r,eventId:E})})}componentDidMount(){const{onMount:a}=this.props;a&&a()}componentWillUnmount(){const{error:a,componentStack:t,eventId:r}=this.state,{onUnmount:s}=this.props;s&&(this.state===LE?s(null,null,null):s(a,t,r)),this.mr&&(this.mr(),this.mr=void 0)}resetErrorBoundary(){const{onReset:a}=this.props,{error:t,componentStack:r,eventId:s}=this.state;a&&a(t,r,s),this.setState(LE)}render(){const{fallback:a,children:t}=this.props,r=this.state;if(r.componentStack===null)return typeof t=="function"?t():t;const s=typeof a=="function"?nr.createElement(a,{error:r.error,componentStack:r.componentStack,resetError:()=>this.resetErrorBoundary(),eventId:r.eventId}):a;return nr.isValidElement(s)?s:(a&&QP&&qt.warn("fallback did not produce a valid ReactElement"),null)}};class jk extends EventTarget{constructor(){super()}fireSetup(){this.dispatchEvent(new CustomEvent("setup",{detail:{player:this}}))}fireInitialized(){this.dispatchEvent(new CustomEvent("initialized",{detail:{player:this}}))}fireLoad(){this.dispatchEvent(new CustomEvent("load",{detail:{player:this}}))}fireLoaded(){this.dispatchEvent(new CustomEvent("loaded",{detail:{player:this}}))}firePlayStart(){this.dispatchEvent(new CustomEvent("playStart",{detail:{player:this}}))}fireObserved(){this.dispatchEvent(new CustomEvent("observed",{detail:{player:this}}))}fireUnobserved(){this.dispatchEvent(new CustomEvent("unobserved",{detail:{player:this}}))}fireError(t){this.dispatchEvent(new CustomEvent("error",{detail:{player:this,error:t}}))}}const JP=["error","loading","loaded","unloading","unloaded","play","pause","ended","seeking","seeked","manifestparsed","stall","streamerend","streamingstarted"];class ZP extends jk{constructor(){super(...arguments);Mr(this,"shaka");Mr(this,"player");Mr(this,"videoElement");Mr(this,"loaded",!1);Mr(this,"observed",!1);Mr(this,"canceled",!1);Mr(this,"playAttempted",!1)}installAllPolyfills(){this.shaka&&this.shaka.polyfill.installAll()}async setup({videoElement:r,shaka:s}){this.videoElement=r,this.shaka=s,this.player=new s.Player(r),this.setupPlayerEventListeners(),this.installAllPolyfills(),this.player.configure({streaming:{useNativeHlsOnSafari:!0}}),this.fireSetup()}async setupPlayerEventListeners(){JP.forEach(r=>{this.player.addEventListener(r,s=>{Ns.debug(r,"shaka",function(u,f){const c={manifestUri:f.getAssetUri(),manifest:f.getManifest(),type:u.type};return u.type==="error"&&u.detail&&(c.error=u.detail),{...c}}(s,this.player))})})}async initializePlayer(){await this.player.attach(this.videoElement),this.fireInitialized()}async load(r){return this.fireLoad(),await this.player.load(r)}async destroyPlayer(){try{this.pause()}catch{}try{this.player.resetConfiguration(),this.player.destroy().catch(r=>{})}catch{}}async play(){return this.videoElement.paused?this.videoElement.play().catch(r=>{}):Promise.resolve()}pause(){this.videoElement.paused||this.videoElement.pause()}}const vt=Number.isFinite||function(a){return typeof a=="number"&&isFinite(a)},eM=Number.isSafeInteger||function(a){return typeof a=="number"&&Math.abs(a)<=tM},tM=Number.MAX_SAFE_INTEGER||9007199254740991;let Mt=function(a){return a.NETWORK_ERROR="networkError",a.MEDIA_ERROR="mediaError",a.KEY_SYSTEM_ERROR="keySystemError",a.MUX_ERROR="muxError",a.OTHER_ERROR="otherError",a}({}),Me=function(a){return a.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",a.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",a.KEY_SYSTEM_NO_SESSION="keySystemNoSession",a.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",a.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",a.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",a.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",a.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",a.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",a.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",a.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",a.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",a.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",a.MANIFEST_LOAD_ERROR="manifestLoadError",a.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",a.MANIFEST_PARSING_ERROR="manifestParsingError",a.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",a.LEVEL_EMPTY_ERROR="levelEmptyError",a.LEVEL_LOAD_ERROR="levelLoadError",a.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",a.LEVEL_PARSING_ERROR="levelParsingError",a.LEVEL_SWITCH_ERROR="levelSwitchError",a.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",a.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",a.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",a.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",a.FRAG_LOAD_ERROR="fragLoadError",a.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",a.FRAG_DECRYPT_ERROR="fragDecryptError",a.FRAG_PARSING_ERROR="fragParsingError",a.FRAG_GAP="fragGap",a.REMUX_ALLOC_ERROR="remuxAllocError",a.KEY_LOAD_ERROR="keyLoadError",a.KEY_LOAD_TIMEOUT="keyLoadTimeOut",a.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",a.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",a.BUFFER_APPEND_ERROR="bufferAppendError",a.BUFFER_APPENDING_ERROR="bufferAppendingError",a.BUFFER_STALLED_ERROR="bufferStalledError",a.BUFFER_FULL_ERROR="bufferFullError",a.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",a.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",a.ASSET_LIST_LOAD_ERROR="assetListLoadError",a.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",a.ASSET_LIST_PARSING_ERROR="assetListParsingError",a.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",a.INTERNAL_EXCEPTION="internalException",a.INTERNAL_ABORTED="aborted",a.ATTACH_MEDIA_ERROR="attachMediaError",a.UNKNOWN="unknown",a}({}),G=function(a){return a.MEDIA_ATTACHING="hlsMediaAttaching",a.MEDIA_ATTACHED="hlsMediaAttached",a.MEDIA_DETACHING="hlsMediaDetaching",a.MEDIA_DETACHED="hlsMediaDetached",a.MEDIA_ENDED="hlsMediaEnded",a.STALL_RESOLVED="hlsStallResolved",a.BUFFER_RESET="hlsBufferReset",a.BUFFER_CODECS="hlsBufferCodecs",a.BUFFER_CREATED="hlsBufferCreated",a.BUFFER_APPENDING="hlsBufferAppending",a.BUFFER_APPENDED="hlsBufferAppended",a.BUFFER_EOS="hlsBufferEos",a.BUFFERED_TO_END="hlsBufferedToEnd",a.BUFFER_FLUSHING="hlsBufferFlushing",a.BUFFER_FLUSHED="hlsBufferFlushed",a.MANIFEST_LOADING="hlsManifestLoading",a.MANIFEST_LOADED="hlsManifestLoaded",a.MANIFEST_PARSED="hlsManifestParsed",a.LEVEL_SWITCHING="hlsLevelSwitching",a.LEVEL_SWITCHED="hlsLevelSwitched",a.LEVEL_LOADING="hlsLevelLoading",a.LEVEL_LOADED="hlsLevelLoaded",a.LEVEL_UPDATED="hlsLevelUpdated",a.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",a.LEVELS_UPDATED="hlsLevelsUpdated",a.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",a.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",a.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",a.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",a.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",a.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",a.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",a.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",a.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",a.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",a.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",a.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",a.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",a.CUES_PARSED="hlsCuesParsed",a.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",a.INIT_PTS_FOUND="hlsInitPtsFound",a.FRAG_LOADING="hlsFragLoading",a.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",a.FRAG_LOADED="hlsFragLoaded",a.FRAG_DECRYPTED="hlsFragDecrypted",a.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",a.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",a.FRAG_PARSING_METADATA="hlsFragParsingMetadata",a.FRAG_PARSED="hlsFragParsed",a.FRAG_BUFFERED="hlsFragBuffered",a.FRAG_CHANGED="hlsFragChanged",a.FPS_DROP="hlsFpsDrop",a.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",a.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",a.ERROR="hlsError",a.DESTROYING="hlsDestroying",a.KEY_LOADING="hlsKeyLoading",a.KEY_LOADED="hlsKeyLoaded",a.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",a.BACK_BUFFER_REACHED="hlsBackBufferReached",a.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",a.ASSET_LIST_LOADING="hlsAssetListLoading",a.ASSET_LIST_LOADED="hlsAssetListLoaded",a.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",a.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",a.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",a.INTERSTITIAL_STARTED="hlsInterstitialStarted",a.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",a.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",a.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",a.INTERSTITIAL_ENDED="hlsInterstitialEnded",a.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",a.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",a.EVENT_CUE_ENTER="hlsEventCueEnter",a}({});var Sc="manifest",ru="level",bo="audioTrack",il="subtitleTrack",On="main",_s="audio",Eo="subtitle";class Of{constructor(t,r=0,s=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=t,this.alpha_=t?Math.exp(Math.log(.5)/t):0,this.estimate_=r,this.totalWeight_=s}sample(t,r){const s=Math.pow(this.alpha_,t);this.estimate_=r*(1-s)+s*this.estimate_,this.totalWeight_+=t}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const t=1-Math.pow(this.alpha_,this.totalWeight_);if(t)return this.estimate_/t}return this.estimate_}}class nM{constructor(t,r,s,u=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_=s,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Of(t),this.fast_=new Of(r),this.defaultTTFB_=u,this.ttfb_=new Of(t)}update(t,r){const{slow_:s,fast_:u,ttfb_:f}=this;s.halfLife!==t&&(this.slow_=new Of(t,s.getEstimate(),s.getTotalWeight())),u.halfLife!==r&&(this.fast_=new Of(r,u.getEstimate(),u.getTotalWeight())),f.halfLife!==t&&(this.ttfb_=new Of(t,f.getEstimate(),f.getTotalWeight()))}sample(t,r){const s=(t=Math.max(t,this.minDelayMs_))/1e3,u=8*r/s;this.fast_.sample(s,u),this.slow_.sample(s,u)}sampleTTFB(t){const r=t/1e3,s=Math.sqrt(2)*Math.exp(-Math.pow(r,2)/2);this.ttfb_.sample(s,Math.max(t,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}function rM(a,t,r){return(t=function(s){var u=function(f,c){if(typeof f!="object"||!f)return f;var v=f[Symbol.toPrimitive];if(v!==void 0){var y=v.call(f,c);if(typeof y!="object")return y;throw new TypeError("@@toPrimitive must return a primitive value.")}return(c==="string"?String:Number)(f)}(s,"string");return typeof u=="symbol"?u:u+""}(t))in a?Object.defineProperty(a,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):a[t]=r,a}function cr(){return cr=Object.assign?Object.assign.bind():function(a){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var s in r)({}).hasOwnProperty.call(r,s)&&(a[s]=r[s])}return a},cr.apply(null,arguments)}function Gk(a,t){var r=Object.keys(a);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(a);t&&(s=s.filter(function(u){return Object.getOwnPropertyDescriptor(a,u).enumerable})),r.push.apply(r,s)}return r}function rr(a){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Gk(Object(r),!0).forEach(function(s){rM(a,s,r[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(r)):Gk(Object(r)).forEach(function(s){Object.defineProperty(a,s,Object.getOwnPropertyDescriptor(r,s))})}return a}class iu{constructor(t,r){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;const s=`[${t}]:`;this.trace=wc,this.debug=r.debug.bind(null,s),this.log=r.log.bind(null,s),this.warn=r.warn.bind(null,s),this.info=r.info.bind(null,s),this.error=r.error.bind(null,s)}}const wc=function(){},iM={trace:wc,debug:wc,log:wc,warn:wc,info:wc,error:wc};function RE(){return cr({},iM)}function Hk(a,t,r){return t[a]?t[a].bind(t):function(s,u){const f=self.console[s];return f?f.bind(self.console,`${u?"["+u+"] ":""}[${s}] >`):wc}(a,r)}const CE=RE(),Hn=CE;function Ac(a=!0){if(!(typeof self>"u"))return(a||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function Vk(a,t){const r=Object.keys(a),s=Object.keys(t),u=r.length,f=s.length;return!u||!f||u===f&&!r.some(c=>s.indexOf(c)===-1)}function ca(a,t=!1){if(typeof TextDecoder<"u"){const y=new TextDecoder("utf-8").decode(a);if(t){const E=y.indexOf("\0");return E!==-1?y.substring(0,E):y}return y.replace(/\0/g,"")}const r=a.length;let s,u,f,c="",v=0;for(;v<r;){if(s=a[v++],s===0&&t)return c;if(s!==0&&s!==3)switch(s>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:c+=String.fromCharCode(s);break;case 12:case 13:u=a[v++],c+=String.fromCharCode((31&s)<<6|63&u);break;case 14:u=a[v++],f=a[v++],c+=String.fromCharCode((15&s)<<12|(63&u)<<6|63&f)}}return c}const sl=function(a){let t="";for(let r=0;r<a.length;r++){let s=a[r].toString(16);s.length<2&&(s="0"+s),t+=s}return t};function sM(a){return a&&a.q&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var Kk,zk={exports:{}},qk,Wk,Yk,Qk,To,DE=(Kk||(Kk=1,qk=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,Wk=/^(?=([^\/?#]*))\1([^]*)$/,Yk=/(?:\/|^)\.(?=\/)/g,Qk=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,zk.exports=To={buildAbsoluteURL:function(a,t,r){if(r=r||{},a=a.trim(),!(t=t.trim())){if(!r.alwaysNormalize)return a;var s=To.parseURL(a);if(!s)throw new Error("Error trying to parse base URL.");return s.path=To.normalizePath(s.path),To.buildURLFromParts(s)}var u=To.parseURL(t);if(!u)throw new Error("Error trying to parse relative URL.");if(u.scheme)return r.alwaysNormalize?(u.path=To.normalizePath(u.path),To.buildURLFromParts(u)):t;var f=To.parseURL(a);if(!f)throw new Error("Error trying to parse base URL.");if(!f.netLoc&&f.path&&f.path[0]!=="/"){var c=Wk.exec(f.path);f.netLoc=c[1],f.path=c[2]}f.netLoc&&!f.path&&(f.path="/");var v={scheme:f.scheme,netLoc:u.netLoc,path:null,params:u.params,query:u.query,fragment:u.fragment};if(!u.netLoc&&(v.netLoc=f.netLoc,u.path[0]!=="/"))if(u.path){var y=f.path,E=y.substring(0,y.lastIndexOf("/")+1)+u.path;v.path=To.normalizePath(E)}else v.path=f.path,u.params||(v.params=f.params,u.query||(v.query=f.query));return v.path===null&&(v.path=r.alwaysNormalize?To.normalizePath(u.path):u.path),To.buildURLFromParts(v)},parseURL:function(a){var t=qk.exec(a);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(a){for(a=a.split("").reverse().join("").replace(Yk,"");a.length!==(a=a.replace(Qk,"")).length;);return a.split("").reverse().join("")},buildURLFromParts:function(a){return a.scheme+a.netLoc+a.path+a.params+a.query+a.fragment}}),zk.exports);class PE{constructor(){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}}}var Fs="audio",Oa="video",ME="audiovideo";class Xk{constructor(t){this.gr=null,this.yr=null,this.wr=null,this.Er=null,this.base=void 0,this.relurl=void 0,typeof t=="string"&&(t={url:t}),this.base=t,function(r,s){const u=Jk(r,s);u&&(u.enumerable=!0,Object.defineProperty(r,s,u))}(this,"stats")}setByteRange(t,r){const s=t.split("@",2);let u;u=s.length===1?(r==null?void 0:r.byteRangeEndOffset)||0:parseInt(s[1]),this.gr=[u,parseInt(s[0])+u]}get baseurl(){return this.base.url}get byteRange(){return this.gr===null?[]:this.gr}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this.Er===null&&(this.Er={[Fs]:null,[Oa]:null,[ME]:null}),this.Er}set elementaryStreams(t){this.Er=t}get hasStats(){return this.wr!==null}get hasStreams(){return this.Er!==null}get stats(){return this.wr===null&&(this.wr=new PE),this.wr}set stats(t){this.wr=t}get url(){return!this.yr&&this.baseurl&&this.relurl&&(this.yr=DE.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this.yr||""}set url(t){this.yr=t}clearElementaryStreamInfo(){const{elementaryStreams:t}=this;t[Fs]=null,t[Oa]=null,t[ME]=null}}function xi(a){return a.sn!=="initSegment"}class OE extends Xk{constructor(t,r){super(r),this.kr=null,this.Sr=null,this.Tr=null,this.Ar=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=t}get byteLength(){if(this.hasStats){const t=this.stats.total;if(t)return t}if(this.byteRange){const t=this.byteRange[0],r=this.byteRange[1];if(vt(t)&&vt(r))return r-t}return null}get bitrate(){return this.byteLength?8*this.byteLength/this.duration:this.Ar?this.Ar:null}set bitrate(t){this.Ar=t}get decryptdata(){const{levelkeys:t}=this;if(!t&&!this.kr)return null;if(!this.kr&&this.levelkeys&&!this.levelkeys.NONE){const r=this.levelkeys.identity;if(r)this.kr=r.getDecryptData(this.sn);else{const s=Object.keys(this.levelkeys);if(s.length===1)return this.kr=this.levelkeys[s[0]].getDecryptData(this.sn)}}return this.kr}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const t=vt(this.duration)?this.duration:0;return this.programDateTime+1e3*t}get encrypted(){var t;if((t=this.kr)!=null&&t.encrypted)return!0;if(this.levelkeys){const r=Object.keys(this.levelkeys),s=r.length;if(s>1||s===1&&this.levelkeys[r[0]].encrypted)return!0}return!1}get programDateTime(){return this.Sr===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this.Sr}set programDateTime(t){vt(t)?this.Sr=t:this.Sr=this.rawProgramDateTime=null}get ref(){return xi(this)?(this.Tr||(this.Tr={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this.Tr):null}addStart(t){this.setStart(this.start+t)}setStart(t){this.start=t,this.Tr&&(this.Tr.start=t)}setDuration(t){this.duration=t,this.Tr&&(this.Tr.duration=t)}setKeyFormat(t){if(this.levelkeys){const r=this.levelkeys[t];r&&!this.kr&&(this.kr=r.getDecryptData(this.sn))}}abortRequests(){var t,r;(t=this.loader)==null||t.abort(),(r=this.keyLoader)==null||r.abort()}setElementaryStreamInfo(t,r,s,u,f,c=!1){const{elementaryStreams:v}=this,y=v[t];y?(y.startPTS=Math.min(y.startPTS,r),y.endPTS=Math.max(y.endPTS,s),y.startDTS=Math.min(y.startDTS,u),y.endDTS=Math.max(y.endDTS,f)):v[t]={startPTS:r,endPTS:s,startDTS:u,endDTS:f,partial:c}}}class aM extends Xk{constructor(t,r,s,u,f){super(s),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=t.decimalFloatingPoint("DURATION"),this.gap=t.bool("GAP"),this.independent=t.bool("INDEPENDENT"),this.relurl=t.enumeratedString("URI"),this.fragment=r,this.index=u;const c=t.enumeratedString("BYTERANGE");c&&this.setByteRange(c,f),f&&(this.fragOffset=f.fragOffset+f.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:t}=this;return!!(t.audio||t.video||t.audiovideo)}}function Jk(a,t){const r=Object.getPrototypeOf(a);if(r)return Object.getOwnPropertyDescriptor(r,t)||Jk(r,t)}const o0=Math.pow(2,32)-1,oM=[].push,Zk={video:1,audio:2,id3:3,text:4};function gi(a){return String.fromCharCode.apply(null,a)}function ex(a,t){const r=a[t]<<8|a[t+1];return r<0?65536+r:r}function Kt(a,t){const r=nx(a,t);return r<0?4294967296+r:r}function tx(a,t){let r=Kt(a,t);return r*=Math.pow(2,32),r+=Kt(a,t+4),r}function nx(a,t){return a[t]<<24|a[t+1]<<16|a[t+2]<<8|a[t+3]}function NE(a,t,r){a[t]=r>>24,a[t+1]=r>>16&255,a[t+2]=r>>8&255,a[t+3]=255&r}function un(a,t){const r=[];if(!t.length)return r;const s=a.byteLength;for(let u=0;u<s;){const f=Kt(a,u),c=f>1?u+f:s;if(gi(a.subarray(u+4,u+8))===t[0])if(t.length===1)r.push(a.subarray(u+8,c));else{const v=un(a.subarray(u+8,c),t.slice(1));v.length&&oM.apply(r,v)}u=c}return r}function lM(a){const t=[],r=a[0];let s=8;const u=Kt(a,s);s+=4;let f=0,c=0;r===0?(f=Kt(a,s),c=Kt(a,s+4),s+=8):(f=tx(a,s),c=tx(a,s+8),s+=16),s+=2;let v=a.length+c;const y=ex(a,s);s+=2;for(let E=0;E<y;E++){let A=s;const L=Kt(a,A);A+=4;const T=2147483647&L;if((2147483648&L)>>>31===1)return Hn.warn("SIDX has hierarchical references (not supported)"),null;const M=Kt(a,A);A+=4,t.push({referenceSize:T,subsegmentDuration:M,info:{duration:M/u,start:v,end:v+T-1}}),v+=T,A+=4,s=A}return{earliestPresentationTime:f,timescale:u,version:r,referencesCount:y,references:t}}function rx(a){const t=[],r=un(a,["moov","trak"]);for(let s=0;s<r.length;s++){const u=r[s],f=un(u,["tkhd"])[0];if(f){let c=f[0];const v=Kt(f,c===0?12:20),y=un(u,["mdia","mdhd"])[0];if(y){c=y[0];const E=Kt(y,c===0?12:20),A=un(u,["mdia","hdlr"])[0];if(A){const L=gi(A.subarray(8,12)),T={soun:Fs,vide:Oa}[L],M=uM(un(u,["mdia","minf","stbl","stsd"])[0]);T?(t[v]={timescale:E,type:T,stsd:M},t[T]=rr({timescale:E,id:v},M)):t[v]={timescale:E,type:L,stsd:M}}}}}return un(a,["moov","mvex","trex"]).forEach(s=>{const u=Kt(s,4),f=t[u];f&&(f.default={duration:Kt(s,12),flags:Kt(s,20)})}),t}function uM(a){const t=a.subarray(8),r=t.subarray(86),s=gi(t.subarray(4,8));let u,f=s;const c=s==="enca"||s==="encv";if(c){const y=un(t,[s])[0];un(y.subarray(s==="enca"?28:78),["sinf"]).forEach(E=>{const A=un(E,["schm"])[0];if(A){const L=gi(A.subarray(4,8));if(L==="cbcs"||L==="cenc"){const T=un(E,["frma"])[0];T&&(f=gi(T))}}})}const v=f;switch(f){case"avc1":case"avc2":case"avc3":case"avc4":{const y=un(r,["avcC"])[0];y&&y.length>3&&(f+="."+u0(y[1])+u0(y[2])+u0(y[3]),u=l0(v==="avc1"?"dva1":"dvav",r));break}case"mp4a":{const y=un(t,[s])[0],E=un(y.subarray(28),["esds"])[0];if(E&&E.length>7){let A=4;if(E[A++]!==3)break;A=_E(E,A),A+=2;const L=E[A++];if(128&L&&(A+=2),64&L&&(A+=E[A++]),E[A++]!==4)break;A=_E(E,A);const T=E[A++];if(T!==64||(f+="."+u0(T),A+=12,E[A++]!==5))break;A=_E(E,A);const M=E[A++];let O=(248&M)>>3;O===31&&(O+=1+((7&M)<<3)+((224&E[A])>>5)),f+="."+O}break}case"hvc1":case"hev1":{const y=un(r,["hvcC"])[0];if(y&&y.length>12){const E=y[1],A=["","A","B","C"][E>>6],L=31&E,T=Kt(y,2),M=(32&E)>>5?"H":"L",O=y[12],U=y.subarray(6,12);f+="."+A+L,f+="."+T.toString(16).toUpperCase(),f+="."+M+O;let $="";for(let z=U.length;z--;){const Q=U[z];(Q||$)&&($="."+Q.toString(16).toUpperCase()+$)}f+=$}u=l0(v=="hev1"?"dvhe":"dvh1",r);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":f=l0(f,r)||f;break;case"vp09":{const y=un(r,["vpcC"])[0];if(y&&y.length>6){const E=y[4],A=y[5],L=y[6]>>4&15;f+="."+al(E)+"."+al(A)+"."+al(L)}break}case"av01":{const y=un(r,["av1C"])[0];if(y&&y.length>2){const E=y[1]>>>5,A=31&y[1],L=y[2]>>>7?"H":"M",T=(64&y[2])>>6,M=(32&y[2])>>5,O=E===2&&T?M?12:10:T?10:8,U=(16&y[2])>>4,$=(8&y[2])>>3,z=(4&y[2])>>2,Q=3&y[2];f+="."+E+"."+al(A)+L+"."+al(O)+"."+U+"."+$+z+Q+"."+al(1)+"."+al(1)+"."+al(1)+"."+0,u=l0("dav1",r)}break}}return{codec:f,encrypted:c,supplemental:u}}function l0(a,t){const r=un(t,["dvvC"]),s=r.length?r[0]:un(t,["dvcC"])[0];if(s){const u=s[2]>>1&127,f=s[2]<<5&32|s[3]>>3&31;return a+"."+al(u)+"."+al(f)}}function _E(a,t){const r=t+5;for(;128&a[t++]&&t<r;);return t}function u0(a){return("0"+a.toString(16).toUpperCase()).slice(-2)}function al(a){return(a<10?"0":"")+a}function ix(a){const t=un(a,["schm"])[0];if(t){const r=gi(t.subarray(4,8));if(r==="cbcs"||r==="cenc")return un(a,["schi","tenc"])[0]}return null}function cM(a){const t=Kt(a,0);let r=8;1&t&&(r+=4),4&t&&(r+=4);let s=0;const u=Kt(a,4);for(let f=0;f<u;f++)256&t&&(s+=Kt(a,r),r+=4),512&t&&(r+=4),1024&t&&(r+=4),2048&t&&(r+=4);return s}function Na(a,t){const r=new Uint8Array(a.length+t.length);return r.set(a),r.set(t,a.length),r}function sx(a,t){const r=[],s=t.samples,u=t.timescale,f=t.id;let c=!1;return un(s,["moof"]).map(v=>{const y=v.byteOffset-8;un(v,["traf"]).map(E=>{const A=un(E,["tfdt"]).map(L=>{const T=L[0];let M=Kt(L,4);return T===1&&(M*=Math.pow(2,32),M+=Kt(L,8)),M/u})[0];return A!==void 0&&(a=A),un(E,["tfhd"]).map(L=>{const T=Kt(L,4),M=16777215&Kt(L,0);let O=0;const U=!!(16&M);let $=0;const z=!!(32&M);let Q=8;T===f&&(1&M&&(Q+=8),2&M&&(Q+=4),8&M&&(O=Kt(L,Q),Q+=4),U&&($=Kt(L,Q),Q+=4),z&&(Q+=4),t.type==="video"&&(c=c0(t.codec)),un(E,["trun"]).map(Z=>{const ie=Z[0],se=16777215&Kt(Z,0),ye=!!(1&se);let N=0;const re=!!(4&se),ne=!!(256&se);let Se=0;const ce=!!(512&se);let we=0;const ze=!!(1024&se),xe=!!(2048&se);let Ce=0;const J=Kt(Z,4);let ue=8;ye&&(N=Kt(Z,ue),ue+=4),re&&(ue+=4);let de=N+y;for(let W=0;W<J;W++){if(ne?(Se=Kt(Z,ue),ue+=4):Se=O,ce?(we=Kt(Z,ue),ue+=4):we=$,ze&&(ue+=4),xe&&(Ce=ie===0?Kt(Z,ue):nx(Z,ue),ue+=4),t.type===Oa){let Ke=0;for(;Ke<we;){const nt=Kt(s,de);de+=4,dM(c,s[de])&&FE(s.subarray(de,de+nt),c?2:1,a+Ce/u,r),de+=nt,Ke+=nt+4}}a+=Se/u}}))})})}),r}function c0(a){if(!a)return!1;const t=a.substring(0,4);return t==="hvc1"||t==="hev1"||t==="dvh1"||t==="dvhe"}function dM(a,t){if(a){const r=t>>1&63;return r===39||r===40}return(31&t)===6}function FE(a,t,r,s){const u=ax(a);let f=0;f+=t;let c=0,v=0,y=0;for(;f<u.length;){c=0;do{if(f>=u.length)break;y=u[f++],c+=y}while(y===255);v=0;do{if(f>=u.length)break;y=u[f++],v+=y}while(y===255);const E=u.length-f;let A=f;if(v<E)f+=v;else if(v>E){Hn.error(`Malformed SEI payload. ${v} is too small, only ${E} bytes left to parse.`);break}if(c===4){if(u[A++]===181){const L=ex(u,A);if(A+=2,L===49){const T=Kt(u,A);if(A+=4,T===1195456820){const M=u[A++];if(M===3){const O=u[A++],U=64&O,$=U?2+3*(31&O):0,z=new Uint8Array($);if(U){z[0]=O;for(let Q=1;Q<$;Q++)z[Q]=u[A++]}s.push({type:M,payloadType:c,pts:r,bytes:z})}}}}}else if(c===5&&v>16){const L=[];for(let O=0;O<16;O++){const U=u[A++].toString(16);L.push(U.length==1?"0"+U:U),O!==3&&O!==5&&O!==7&&O!==9||L.push("-")}const T=v-16,M=new Uint8Array(T);for(let O=0;O<T;O++)M[O]=u[A++];s.push({payloadType:c,pts:r,uuid:L.join(""),userData:ca(M),userDataBytes:M})}}}function ax(a){const t=a.byteLength,r=[];let s=1;for(;s<t-2;)a[s]===0&&a[s+1]===0&&a[s+2]===3?(r.push(s+2),s+=2):s++;if(r.length===0)return a;const u=t-r.length,f=new Uint8Array(u);let c=0;for(s=0;s<u;c++,s++)c===r[0]&&(c++,r.shift()),f[s]=a[c];return f}function hM(a,t,r){if(a.byteLength!==16)throw new RangeError("Invalid system id");let s,u,f;s=0,u=new Uint8Array,f=new Uint8Array;const c=new Uint8Array(4);return r&&r.byteLength>0&&new DataView(c.buffer).setUint32(0,r.byteLength,!1),function(v,...y){const E=y.length;let A=8,L=E;for(;L--;)A+=y[L].byteLength;const T=new Uint8Array(A);for(T[0]=A>>24&255,T[1]=A>>16&255,T[2]=A>>8&255,T[3]=255&A,T.set(v,4),L=0,A=8;L<E;L++)T.set(y[L],A),A+=y[L].byteLength;return T}([112,115,115,104],new Uint8Array([0,0,0,0]),a,f,u,c,r||new Uint8Array)}function fM(a){const t=a.getUint32(0),r=a.byteOffset,s=a.byteLength;if(s<t)return{offset:r,size:s};if(a.getUint32(4)!==1886614376)return{offset:r,size:t};const u=a.getUint32(8)>>>24;if(u!==0&&u!==1)return{offset:r,size:t};const f=a.buffer,c=sl(new Uint8Array(f,r+12,16)),v=a.getUint32(28);let y=null,E=null;if(u===0){if(t-32<v||v<22)return{offset:r,size:t};E=new Uint8Array(f,r+32,v)}else if(u===1){if(!v||s<r+32+16*v+16)return{offset:r,size:t};y=[];for(let A=0;A<v;A++)y.push(new Uint8Array(f,r+32+16*A,16))}return{version:u,systemId:c,kids:y,data:E,offset:r,size:t}}const ox=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),Nf={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,dav1:.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 lx(a,t){const r=Nf[t];return!!r&&!!r[a.slice(0,4)]}function UE(a,t,r=!0){return!a.split(",").some(s=>!ux(s,t,r))}function ux(a,t,r=!0){var s;const u=Ac(r);return(s=u==null?void 0:u.isTypeSupported(fm(a,t)))!=null&&s}function fm(a,t){return`${t}/mp4;codecs=${a}`}function cx(a){if(a){const t=a.substring(0,4);return Nf.video[t]}return 2}function d0(a){const t=ox();return a.split(",").reduce((r,s)=>{const u=t&&c0(s)?9:Nf.video[s];return u?(2*u+r)/(r?3:2):(Nf.audio[s]+r)/(r?2:1)},0)}const BE={},pM=/flac|opus|mp4a\.40\.34/i;function h0(a,t=!0){return a.replace(pM,r=>function(s,u=!0){if(BE[s])return BE[s];const f={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[s];for(let v=0;v<f.length;v++){var c;if(ux(f[v],"audio",u))return BE[s]=f[v],f[v];if(f[v]==="mp3"&&(c=Ac(u))!=null&&c.isTypeSupported("audio/mpeg"))return""}return s}(r.toLowerCase(),t))}function f0(a,t){if(a&&(a.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(a)!==-1))return a;if(t){const r=t.split(",");if(r.length>1){if(a){for(let s=r.length;s--;)if(r[s].substring(0,4)===a.substring(0,4))return r[s]}return r[0]}}return t||a}function gM(a){if(a.startsWith("av01.")){const t=a.split("."),r=["0","111","01","01","01","0"];for(let s=t.length;s>4&&s<10;s++)t[s]=r[s-4];return t.join(".")}return a}function dx(a){const t=Ac(a)||{isTypeSupported:()=>!1};return{mpeg:t.isTypeSupported("audio/mpeg"),mp3:t.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:t.isTypeSupported('audio/mp4; codecs="ac-3"')}}function hx(a){return a.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const fx={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]};function px(a,t){return{supported:!1,configurations:t,decodingInfoResults:[{supported:!1,smooth:!1,powerEfficient:!1}],error:a}}const gx={};function mM(a,t,r,s,u,f){const c=a.audioCodec?a.audioGroups:null,v=f==null?void 0:f.audioCodec,y=f==null?void 0:f.channels,E=y?parseInt(y):v?1/0:2;let A=null;if(c!=null&&c.length)try{A=c.length===1&&c[0]?t.groups[c[0]].channels:c.reduce((L,T)=>{if(T){const M=t.groups[T];if(!M)throw new Error(`Audio track group ${T} not found`);Object.keys(M.channels).forEach(O=>{L[O]=(L[O]||0)+M.channels[O]})}return L},{2:0})}catch{return!0}return a.videoCodec!==void 0&&(a.width>1920&&a.height>1088||a.height>1920&&a.width>1088||a.frameRate>Math.max(s,30)||a.videoRange!=="SDR"&&a.videoRange!==r||a.bitrate>Math.max(u,8e6))||!!A&&vt(E)&&Object.keys(A).some(L=>parseInt(L)>E)}function mx(a,t,r){const s=a.videoCodec,u=a.audioCodec;if(!s&&!u||!r)return Promise.resolve(fx);const f=[];if(s){const c={width:a.width,height:a.height,bitrate:Math.ceil(Math.max(.9*a.bitrate,a.averageBitrate)),framerate:a.frameRate||30},v=a.videoRange;v!=="SDR"&&(c.transferFunction=v.toLowerCase());const y=s.split(","),E=navigator.userAgent;if(y.some(A=>c0(A))&&ox())return Promise.resolve(px(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent sting: (${E})`),f));f.push.apply(f,y.map(A=>({type:"media-source",video:rr(rr({},c),{},{contentType:fm(gM(A),"video")})})))}return u&&a.audioGroups&&a.audioGroups.forEach(c=>{var v;c&&((v=t.groups[c])==null||v.tracks.forEach(y=>{if(y.groupId===c){const E=y.channels||"",A=parseFloat(E);vt(A)&&A>2&&f.push.apply(f,u.split(",").map(L=>({type:"media-source",audio:{contentType:fm(L,"audio"),channels:""+A}})))}}))}),Promise.all(f.map(c=>{const v=function(y){const{audio:E,video:A}=y,L=A||E;if(L){const T=hx(L.contentType);if(A)return`r${A.height}x${A.width}f${Math.ceil(A.framerate)}${A.transferFunction||"sd"}_${T}_${Math.ceil(A.bitrate/1e5)}`;if(E)return`c${E.channels}${E.spatialRendering?"s":"n"}_${T}`}return""}(c);return gx[v]||(gx[v]=r.decodingInfo(c))})).then(c=>({supported:!c.some(v=>!v.supported),configurations:f,decodingInfoResults:c})).catch(c=>({supported:!1,configurations:f,decodingInfoResults:[],error:c}))}const $E=["NONE","TYPE-0","TYPE-1",null],p0=["SDR","PQ","HLG"];var yx="",yM="YES",vM="v2";function vx(a){const{canSkipUntil:t,canSkipDateRanges:r,age:s}=a;return t&&s<t/2?r?vM:yM:yx}class bx{constructor(t,r,s){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=t,this.part=r,this.skip=s}addDirectives(t){const r=new self.URL(t);return this.msn!==void 0&&r.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&r.searchParams.set("_HLS_part",this.part.toString()),this.skip&&r.searchParams.set("_HLS_skip",this.skip),r.href}}class pm{constructor(t){if(this.Mr=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this.Ir=0,this.Lr=void 0,this.Dr=void 0,this.Cr=0,this.url=[t.url],this.Mr=[t.attrs],this.bitrate=t.bitrate,t.details&&(this.details=t.details),this.id=t.id||0,this.name=t.name,this.width=t.width||0,this.height=t.height||0,this.frameRate=t.attrs.optionalFloat("FRAME-RATE",0),this.Ir=t.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=t.audioCodec,this.videoCodec=t.videoCodec,this.codecSet=[t.videoCodec,t.audioCodec].filter(s=>!!s).map(s=>s.substring(0,4)).join(","),"supplemental"in t){var r;this.supplemental=t.supplemental;const s=(r=t.supplemental)==null?void 0:r.videoCodec;s&&s!==t.videoCodec&&(this.codecSet+=`,${s.substring(0,4)}`)}this.addGroupId("audio",t.attrs.AUDIO),this.addGroupId("text",t.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this.Ir||this.realBitrate||this.bitrate}get attrs(){return this.Mr[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(t){return Ex(this.Lr,t)}hasSubtitleGroup(t){return Ex(this.Dr,t)}get audioGroups(){return this.Lr}get subtitleGroups(){return this.Dr}addGroupId(t,r){if(r){if(t==="audio"){let s=this.Lr;s||(s=this.Lr=[]),s.indexOf(r)===-1&&s.push(r)}else if(t==="text"){let s=this.Dr;s||(s=this.Dr=[]),s.indexOf(r)===-1&&s.push(r)}}}get urlId(){return 0}set urlId(t){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var t;return(t=this.audioGroups)==null?void 0:t[0]}get textGroupId(){var t;return(t=this.subtitleGroups)==null?void 0:t[0]}addFallback(){}}function Ex(a,t){return!(!t||!a)&&a.indexOf(t)!==-1}function bM(a,t){let r=!1,s=[];if(a&&(r=a!=="SDR",s=[a]),t){s=t.allowedVideoRanges||p0.slice(0);const u=s.join("")!=="SDR"&&!t.videoCodec;r=t.preferHDR!==void 0?t.preferHDR:u&&function(){if(typeof matchMedia=="function"){const f=matchMedia("(dynamic-range: high)"),c=matchMedia("bad query");if(f.media!==c.media)return f.matches===!0}return!1}(),r||(s=["SDR"])}return{preferHDR:r,allowedVideoRanges:s}}const Or=(a,t)=>JSON.stringify(a,(r=>{const s=new WeakSet;return(u,f)=>{if(r&&(f=r(u,f)),typeof f=="object"&&f!==null){if(s.has(f))return;s.add(f)}return f}})(t));function ol(a,t){Hn.log(`[abr] start candidates with "${a}" ignored because ${t}`)}function Tx(a){return a.reduce((t,r)=>{let s=t.groups[r.groupId];s||(s=t.groups[r.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),s.tracks.push(r);const u=r.channels||"2";return s.channels[u]=(s.channels[u]||0)+1,s.hasDefault=s.hasDefault||r.default,s.hasAutoSelect=s.hasAutoSelect||r.autoselect,s.hasDefault&&(t.hasDefaultAudio=!0),s.hasAutoSelect&&(t.hasAutoSelectAudio=!0),t},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function Sx(a){if(!a)return a;const{lang:t,assocLang:r,characteristics:s,channels:u,audioCodec:f}=a;return{lang:t,assocLang:r,characteristics:s,channels:u,audioCodec:f}}function ll(a,t,r){if("attrs"in a){const s=t.indexOf(a);if(s!==-1)return s}for(let s=0;s<t.length;s++)if(Wd(a,t[s],r))return s;return-1}function Wd(a,t,r){const{groupId:s,name:u,lang:f,assocLang:c,default:v}=a,y=a.forced;return(s===void 0||t.groupId===s)&&(u===void 0||t.name===u)&&(f===void 0||function(E,A="--"){return E.length===A.length?E===A:E.startsWith(A)||A.startsWith(E)}(f,t.lang))&&(f===void 0||t.assocLang===c)&&(v===void 0||t.default===v)&&(y===void 0||t.forced===y)&&(!("characteristics"in a)||function(E,A=""){const L=E.split(","),T=A.split(",");return L.length===T.length&&!L.some(M=>T.indexOf(M)===-1)}(a.characteristics||"",t.characteristics))&&(r===void 0||r(a,t))}function Yd(a,t){const{audioCodec:r,channels:s}=a;return!(r!==void 0&&(t.audioCodec||"").substring(0,4)!==r.substring(0,4)||s!==void 0&&s!==(t.channels||"2"))}function wx(a,t,r){for(let s=t;s>-1;s--)if(r(a[s]))return s;for(let s=t+1;s<a.length;s++)if(r(a[s]))return s;return-1}function g0(a,t){var r;return!!a&&a!==((r=t.loadLevelObj)==null?void 0:r.uri)}const jE=function(a,t){let r=0,s=a.length-1,u=null,f=null;for(;r<=s;){u=(r+s)/2|0,f=a[u];const c=t(f);if(c>0)r=u+1;else{if(!(c<0))return f;s=u-1}}return null};function Qd(a,t,r=0,s=0,u=.005){let f=null;if(a){f=t[1+a.sn-t[0].sn]||null;const v=a.endDTS-r;v>0&&v<15e-7&&(r+=15e-7),f&&a.level!==f.level&&f.end<=a.end&&(f=t[2+a.sn-t[0].sn]||null)}else r===0&&t[0].start===0&&(f=t[0]);if(f&&((!a||a.level===f.level)&&Ax(r,s,f)===0||function(v,y,E){if(y&&y.start===0&&y.level<v.level&&(y.endPTS||0)>0){const A=y.tagList.reduce((L,T)=>(T[0]==="INF"&&(L+=parseFloat(T[1])),L),E);return v.start<=A}return!1}(f,a,Math.min(u,s))))return f;const c=jE(t,Ax.bind(null,r,s));return!c||c===a&&f?f:c}function Ax(a=0,t=0,r){if(r.start<=a&&r.start+r.duration>a)return 0;const s=Math.min(t,r.duration+(r.deltaPTS?r.deltaPTS:0));return r.start+r.duration-s<=a?1:r.start-s>a&&r.start?-1:0}function EM(a,t,r){const s=1e3*Math.min(t,r.duration+(r.deltaPTS?r.deltaPTS:0));return(r.endProgramDateTime||0)-s>a}function kx(a,t){return jE(a,r=>r.cc<t?1:r.cc>t?-1:0)}function m0(a){switch(a.details){case Me.FRAG_LOAD_TIMEOUT:case Me.KEY_LOAD_TIMEOUT:case Me.LEVEL_LOAD_TIMEOUT:case Me.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function xx(a,t){const r=m0(t);return a.default[(r?"timeout":"error")+"Retry"]}function GE(a,t){const r=a.backoff==="linear"?1:Math.pow(2,t);return Math.min(r*a.retryDelayMs,a.maxRetryDelayMs)}function Ix(a){return rr(rr({},a),{errorRetry:null,timeoutRetry:null})}function y0(a,t,r,s){if(!a)return!1;const u=s==null?void 0:s.code,f=t<a.maxNumRetry&&(function(c){return c===0&&navigator.onLine===!1||!!c&&(c<400||c>499)}(u)||!!r);return a.shouldRetry?a.shouldRetry(a,t,r,s,f):f}var Lx=0,su=2,TM=3,v0=5,gm=0,b0=1,Rx=2;function mm(a){const t={action:Lx,flags:gm};return a&&(t.resolved=!0),t}var ym="NOT_LOADED",Cx="APPENDING",_f="PARTIAL",Ff="OK";class SM{constructor(t){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=t,this.$r()}$r(){const{hls:t}=this;t.on(G.MANIFEST_LOADING,this.onManifestLoading,this),t.on(G.BUFFER_APPENDED,this.onBufferAppended,this),t.on(G.FRAG_BUFFERED,this.onFragBuffered,this),t.on(G.FRAG_LOADED,this.onFragLoaded,this)}Rr(){const{hls:t}=this;t.off(G.MANIFEST_LOADING,this.onManifestLoading,this),t.off(G.BUFFER_APPENDED,this.onBufferAppended,this),t.off(G.FRAG_BUFFERED,this.onFragBuffered,this),t.off(G.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this.Rr(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(t,r){const s=this.activePartLists[r];if(s)for(let u=s.length;u--;){const f=s[u];if(!f)break;const c=f.end;if(f.start<=t&&c!==null&&t<=c)return f}return this.getBufferedFrag(t,r)}getBufferedFrag(t,r){return this.getFragAtPos(t,r,!0)}getFragAtPos(t,r,s){const{fragments:u}=this,f=Object.keys(u);for(let c=f.length;c--;){const v=u[f[c]];if((v==null?void 0:v.body.type)===r&&(!s||v.buffered)){const y=v.body;if(y.start<=t&&t<=y.end)return y}}return null}detectEvictedFragments(t,r,s,u,f){this.timeRanges&&(this.timeRanges[t]=r);const c=(u==null?void 0:u.fragment.sn)||-1;Object.keys(this.fragments).forEach(v=>{const y=this.fragments[v];if(!y||c>=y.body.sn)return;if(!y.buffered&&(!y.loaded||f))return void(y.body.type===s&&this.removeFragment(y.body));const E=y.range[t];E&&(E.time.length!==0?E.time.some(A=>{const L=!this.isTimeBuffered(A.startPTS,A.endPTS,r);return L&&this.removeFragment(y.body),L}):this.removeFragment(y.body))})}detectPartialFragments(t){const r=this.timeRanges;if(!r||t.frag.sn==="initSegment")return;const s=t.frag,u=Uf(s),f=this.fragments[u];if(!f||f.buffered&&s.gap)return;const c=!s.relurl;Object.keys(r).forEach(v=>{const y=s.elementaryStreams[v];if(!y)return;const E=r[v],A=c||y.partial===!0;f.range[v]=this.getBufferedTimes(s,t.part,A,E)}),f.loaded=null,Object.keys(f.range).length?(f.buffered=!0,(f.body.endList=s.endList||f.body.endList)&&(this.endListFragments[f.body.type]=f),E0(f)||this.removeParts(s.sn-1,s.type)):this.removeFragment(f.body)}removeParts(t,r){const s=this.activePartLists[r];s&&(this.activePartLists[r]=Dx(s,u=>u.fragment.sn>=t))}fragBuffered(t,r){const s=Uf(t);let u=this.fragments[s];!u&&r&&(u=this.fragments[s]={body:t,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},t.gap&&(this.hasGaps=!0)),u&&(u.loaded=null,u.buffered=!0)}getBufferedTimes(t,r,s,u){const f={time:[],partial:s},c=t.start,v=t.end,y=t.minEndPTS||v,E=t.maxStartPTS||c;for(let A=0;A<u.length;A++){const L=u.start(A)-this.bufferPadding,T=u.end(A)+this.bufferPadding;if(E>=L&&y<=T){f.time.push({startPTS:Math.max(c,u.start(A)),endPTS:Math.min(v,u.end(A))});break}if(c<T&&v>L){const M=Math.max(c,u.start(A)),O=Math.min(v,u.end(A));O>M&&(f.partial=!0,f.time.push({startPTS:M,endPTS:O}))}else if(v<=L)break}return f}getPartialFragment(t){let r,s,u,f=null,c=0;const{bufferPadding:v,fragments:y}=this;return Object.keys(y).forEach(E=>{const A=y[E];A&&E0(A)&&(s=A.body.start-v,u=A.body.end+v,t>=s&&t<=u&&(r=Math.min(t-s,u-t),c<=r&&(f=A.body,c=r)))}),f}isEndListAppended(t){const r=this.endListFragments[t];return r!==void 0&&(r.buffered||E0(r))}getState(t){const r=Uf(t),s=this.fragments[r];return s?s.buffered?E0(s)?_f:Ff:Cx:ym}isTimeBuffered(t,r,s){let u,f;for(let c=0;c<s.length;c++){if(u=s.start(c)-this.bufferPadding,f=s.end(c)+this.bufferPadding,t>=u&&r<=f)return!0;if(r<=u)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(t,r){if(r.frag.sn==="initSegment"||r.frag.bitrateTest)return;const s=r.frag,u=r.part?null:r,f=Uf(s);this.fragments[f]={body:s,appendedPTS:null,loaded:u,buffered:!1,range:Object.create(null)}}onBufferAppended(t,r){const{frag:s,part:u,timeRanges:f,type:c}=r;if(s.sn==="initSegment")return;const v=s.type;if(u){let E=this.activePartLists[v];E||(this.activePartLists[v]=E=[]),E.push(u)}this.timeRanges=f;const y=f[c];this.detectEvictedFragments(c,y,v,u)}onFragBuffered(t,r){this.detectPartialFragments(r)}hasFragment(t){const r=Uf(t);return!!this.fragments[r]}hasFragments(t){const{fragments:r}=this,s=Object.keys(r);if(!t)return s.length>0;for(let u=s.length;u--;){const f=r[s[u]];if((f==null?void 0:f.body.type)===t)return!0}return!1}hasParts(t){var r;return!((r=this.activePartLists[t])==null||!r.length)}removeFragmentsInRange(t,r,s,u,f){u&&!this.hasGaps||Object.keys(this.fragments).forEach(c=>{const v=this.fragments[c];if(!v)return;const y=v.body;y.type!==s||u&&!y.gap||y.start<r&&y.end>t&&(v.buffered||f)&&this.removeFragment(y)})}removeFragment(t){const r=Uf(t);t.clearElementaryStreamInfo();const s=this.activePartLists[t.type];if(s){const u=t.sn;this.activePartLists[t.type]=Dx(s,f=>f.fragment.sn!==u)}delete this.fragments[r],t.endList&&delete this.endListFragments[t.type]}removeAllFragments(){var t,r;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const s=(t=this.hls)==null||(r=t.latestLevelDetails)==null?void 0:r.partList;s&&s.forEach(u=>u.clearElementaryStreamInfo())}}function E0(a){var t,r,s;return a.buffered&&(a.body.gap||((t=a.range.video)==null?void 0:t.partial)||((r=a.range.audio)==null?void 0:r.partial)||((s=a.range.audiovideo)==null?void 0:s.partial))}function Uf(a){return`${a.type}_${a.level}_${a.sn}`}function Dx(a,t){return a.filter(r=>{const s=t(r);return s||r.clearElementaryStreamInfo(),s})}var vm=0,HE=1;class wM{constructor(t,r,s){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=t,this.aesIV=r,this.aesMode=s}decrypt(t,r){switch(this.aesMode){case vm:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},r,t);case HE:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},r,t);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}}class AM{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(t){const r=new DataView(t),s=new Uint32Array(4);for(let u=0;u<4;u++)s[u]=r.getUint32(4*u);return s}initTable(){const t=this.sBox,r=this.invSBox,s=this.subMix,u=s[0],f=s[1],c=s[2],v=s[3],y=this.invSubMix,E=y[0],A=y[1],L=y[2],T=y[3],M=new Uint32Array(256);let O=0,U=0,$=0;for($=0;$<256;$++)M[$]=$<128?$<<1:$<<1^283;for($=0;$<256;$++){let z=U^U<<1^U<<2^U<<3^U<<4;z=z>>>8^255&z^99,t[O]=z,r[z]=O;const Q=M[O],Z=M[Q],ie=M[Z];let se=257*M[z]^16843008*z;u[O]=se<<24|se>>>8,f[O]=se<<16|se>>>16,c[O]=se<<8|se>>>24,v[O]=se,se=16843009*ie^65537*Z^257*Q^16843008*O,E[z]=se<<24|se>>>8,A[z]=se<<16|se>>>16,L[z]=se<<8|se>>>24,T[z]=se,O?(O=Q^M[M[M[ie^Q]]],U^=M[M[U]]):O=U=1}}expandKey(t){const r=this.uint8ArrayToUint32Array_(t);let s=!0,u=0;for(;u<r.length&&s;)s=r[u]===this.key[u],u++;if(s)return;this.key=r;const f=this.keySize=r.length;if(f!==4&&f!==6&&f!==8)throw new Error("Invalid aes key size="+f);const c=this.ksRows=4*(f+6+1);let v,y;const E=this.keySchedule=new Uint32Array(c),A=this.invKeySchedule=new Uint32Array(c),L=this.sBox,T=this.rcon,M=this.invSubMix,O=M[0],U=M[1],$=M[2],z=M[3];let Q,Z;for(v=0;v<c;v++)v<f?Q=E[v]=r[v]:(Z=Q,v%f==0?(Z=Z<<8|Z>>>24,Z=L[Z>>>24]<<24|L[Z>>>16&255]<<16|L[Z>>>8&255]<<8|L[255&Z],Z^=T[v/f|0]<<24):f>6&&v%f==4&&(Z=L[Z>>>24]<<24|L[Z>>>16&255]<<16|L[Z>>>8&255]<<8|L[255&Z]),E[v]=Q=(E[v-f]^Z)>>>0);for(y=0;y<c;y++)v=c-y,Z=3&y?E[v]:E[v-4],A[y]=y<4||v<=4?Z:O[L[Z>>>24]]^U[L[Z>>>16&255]]^$[L[Z>>>8&255]]^z[L[255&Z]],A[y]=A[y]>>>0}networkToHostOrderSwap(t){return t<<24|(65280&t)<<8|(16711680&t)>>8|t>>>24}decrypt(t,r,s){const u=this.keySize+6,f=this.invKeySchedule,c=this.invSBox,v=this.invSubMix,y=v[0],E=v[1],A=v[2],L=v[3],T=this.uint8ArrayToUint32Array_(s);let M=T[0],O=T[1],U=T[2],$=T[3];const z=new Int32Array(t),Q=new Int32Array(z.length);let Z,ie,se,ye,N,re,ne,Se,ce,we,ze,xe,Ce,J;const ue=this.networkToHostOrderSwap;for(;r<z.length;){for(ce=ue(z[r]),we=ue(z[r+1]),ze=ue(z[r+2]),xe=ue(z[r+3]),N=ce^f[0],re=xe^f[1],ne=ze^f[2],Se=we^f[3],Ce=4,J=1;J<u;J++)Z=y[N>>>24]^E[re>>16&255]^A[ne>>8&255]^L[255&Se]^f[Ce],ie=y[re>>>24]^E[ne>>16&255]^A[Se>>8&255]^L[255&N]^f[Ce+1],se=y[ne>>>24]^E[Se>>16&255]^A[N>>8&255]^L[255&re]^f[Ce+2],ye=y[Se>>>24]^E[N>>16&255]^A[re>>8&255]^L[255&ne]^f[Ce+3],N=Z,re=ie,ne=se,Se=ye,Ce+=4;Z=c[N>>>24]<<24^c[re>>16&255]<<16^c[ne>>8&255]<<8^c[255&Se]^f[Ce],ie=c[re>>>24]<<24^c[ne>>16&255]<<16^c[Se>>8&255]<<8^c[255&N]^f[Ce+1],se=c[ne>>>24]<<24^c[Se>>16&255]<<16^c[N>>8&255]<<8^c[255&re]^f[Ce+2],ye=c[Se>>>24]<<24^c[N>>16&255]<<16^c[re>>8&255]<<8^c[255&ne]^f[Ce+3],Q[r]=ue(Z^M),Q[r+1]=ue(ye^O),Q[r+2]=ue(se^U),Q[r+3]=ue(ie^$),M=ce,O=we,U=ze,$=xe,r+=4}return Q.buffer}}class kM{constructor(t,r,s){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=t,this.key=r,this.aesMode=s}expandKey(){const t=function(r){switch(r){case vm:return"AES-CBC";case HE:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${r}`)}}(this.aesMode);return this.subtle.importKey("raw",this.key,{name:t},!1,["encrypt","decrypt"])}}class VE{constructor(t,{removePKCS7Padding:r=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=t.enableSoftwareAES,this.removePKCS7Padding=r,r)try{const s=self.crypto;s&&(this.subtle=s.subtle||s.webkitSubtle)}catch{}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:t,remainderData:r}=this;if(!t||r)return this.reset(),null;const s=new Uint8Array(t);return this.reset(),this.removePKCS7Padding?function(u){const f=u.byteLength,c=f&&new DataView(u.buffer).getUint8(f-1);return c?u.slice(0,f-c):u}(s):s}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(t,r,s,u){return this.useSoftware?new Promise((f,c)=>{const v=ArrayBuffer.isView(t)?t:new Uint8Array(t);this.softwareDecrypt(v,r,s,u);const y=this.flush();y?f(y.buffer):c(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(t),r,s,u)}softwareDecrypt(t,r,s,u){const{currentIV:f,currentResult:c,remainderData:v}=this;if(u!==vm||r.byteLength!==16)return Hn.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),v&&(t=Na(v,t),this.remainderData=null);const y=this.getValidChunk(t);if(!y.length)return null;f&&(s=f);let E=this.softwareDecrypter;E||(E=this.softwareDecrypter=new AM),E.expandKey(r);const A=c;return this.currentResult=E.decrypt(y.buffer,0,s),this.currentIV=y.slice(-16).buffer,A||null}webCryptoDecrypt(t,r,s,u){if(this.key!==r||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(t,r,s,u));this.key=r,this.fastAesKey=new kM(this.subtle,r,u)}return this.fastAesKey.expandKey().then(f=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new wM(this.subtle,new Uint8Array(s),u).decrypt(t.buffer,f)):Promise.reject(new Error("web crypto not initialized"))).catch(f=>(Hn.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${f.name}: ${f.message}`),this.onWebCryptoError(t,r,s,u)))}onWebCryptoError(t,r,s,u){const f=this.enableSoftwareAES;if(f){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(t,r,s,u);const c=this.flush();if(c)return c.buffer}throw new Error("WebCrypto"+(f?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(t){let r=t;const s=t.length-t.length%16;return s!==t.length&&(r=t.slice(0,s),this.remainderData=t.slice(s)),r}logOnce(t){this.logEnabled&&(Hn.log(`[decrypter]: ${t}`),this.logEnabled=!1)}}const Px=Math.pow(2,17);class xM{constructor(t){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=t}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(t,r){const s=t.url;if(!s)return Promise.reject(new au({type:Mt.NETWORK_ERROR,details:Me.FRAG_LOAD_ERROR,fatal:!1,frag:t,error:new Error("Fragment does not have a "+(s?"part list":"url")),networkDetails:null}));this.abort();const u=this.config,f=u.fLoader,c=u.loader;return new Promise((v,y)=>{if(this.loader&&this.loader.destroy(),t.gap){if(t.tagList.some(O=>O[0]==="GAP"))return void y(Ox(t));t.gap=!1}const E=this.loader=f?new f(u):new c(u),A=Mx(t);t.loader=E;const L=Ix(u.fragLoadPolicy.default),T={loadPolicy:L,timeout:L.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:t.sn==="initSegment"?1/0:Px};t.stats=E.stats;const M={onSuccess:(O,U,$,z)=>{this.resetLoader(t,E);let Q=O.data;$.resetIV&&t.decryptdata&&(t.decryptdata.iv=new Uint8Array(Q.slice(0,16)),Q=Q.slice(16)),v({frag:t,part:null,payload:Q,networkDetails:z})},onError:(O,U,$,z)=>{this.resetLoader(t,E),y(new au({type:Mt.NETWORK_ERROR,details:Me.FRAG_LOAD_ERROR,fatal:!1,frag:t,response:rr({url:s,data:void 0},O),error:new Error(`HTTP Error ${O.code} ${O.text}`),networkDetails:$,stats:z}))},onAbort:(O,U,$)=>{this.resetLoader(t,E),y(new au({type:Mt.NETWORK_ERROR,details:Me.INTERNAL_ABORTED,fatal:!1,frag:t,error:new Error("Aborted"),networkDetails:$,stats:O}))},onTimeout:(O,U,$)=>{this.resetLoader(t,E),y(new au({type:Mt.NETWORK_ERROR,details:Me.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,error:new Error(`Timeout after ${T.timeout}ms`),networkDetails:$,stats:O}))}};r&&(M.onProgress=(O,U,$,z)=>r({frag:t,part:null,payload:$,networkDetails:z})),E.load(A,T,M)})}loadPart(t,r,s){this.abort();const u=this.config,f=u.fLoader,c=u.loader;return new Promise((v,y)=>{if(this.loader&&this.loader.destroy(),t.gap||r.gap)return void y(Ox(t,r));const E=this.loader=f?new f(u):new c(u),A=Mx(t,r);t.loader=E;const L=Ix(u.fragLoadPolicy.default),T={loadPolicy:L,timeout:L.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Px};r.stats=E.stats,E.load(A,T,{onSuccess:(M,O,U,$)=>{this.resetLoader(t,E),this.updateStatsFromPart(t,r);const z={frag:t,part:r,payload:M.data,networkDetails:$};s(z),v(z)},onError:(M,O,U,$)=>{this.resetLoader(t,E),y(new au({type:Mt.NETWORK_ERROR,details:Me.FRAG_LOAD_ERROR,fatal:!1,frag:t,part:r,response:rr({url:A.url,data:void 0},M),error:new Error(`HTTP Error ${M.code} ${M.text}`),networkDetails:U,stats:$}))},onAbort:(M,O,U)=>{t.stats.aborted=r.stats.aborted,this.resetLoader(t,E),y(new au({type:Mt.NETWORK_ERROR,details:Me.INTERNAL_ABORTED,fatal:!1,frag:t,part:r,error:new Error("Aborted"),networkDetails:U,stats:M}))},onTimeout:(M,O,U)=>{this.resetLoader(t,E),y(new au({type:Mt.NETWORK_ERROR,details:Me.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,part:r,error:new Error(`Timeout after ${T.timeout}ms`),networkDetails:U,stats:M}))}})})}updateStatsFromPart(t,r){const s=t.stats,u=r.stats,f=u.total;if(s.loaded+=u.loaded,f){const y=Math.round(t.duration/r.duration),E=Math.min(Math.round(s.loaded/f),y),A=(y-E)*Math.round(s.loaded/E);s.total=s.loaded+A}else s.total=Math.max(s.loaded,s.total);const c=s.loading,v=u.loading;c.start?c.first+=v.first-v.start:(c.start=v.start,c.first=v.first),c.end=v.end}resetLoader(t,r){t.loader=null,this.loader===r&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),r.destroy()}}function Mx(a,t=null){const r=t||a,s={frag:a,part:t,responseType:"arraybuffer",url:r.url,headers:{},rangeStart:0,rangeEnd:0},u=r.byteRangeStartOffset,f=r.byteRangeEndOffset;if(vt(u)&&vt(f)){var c;let y=u,E=f;if(a.sn==="initSegment"&&((v=(c=a.decryptdata)==null?void 0:c.method)==="AES-128"||v==="AES-256")){const A=f-u;A%16&&(E=f+(16-A%16)),u!==0&&(s.resetIV=!0,y=u-16)}s.rangeStart=y,s.rangeEnd=E}var v;return s}function Ox(a,t){const r=new Error(`GAP ${a.gap?"tag":"attribute"} found`),s={type:Mt.MEDIA_ERROR,details:Me.FRAG_GAP,fatal:!1,frag:a,error:r,networkDetails:null};return t&&(s.part=t),(t||a).stats.aborted=!0,new au(s)}class au extends Error{constructor(t){super(t.error.message),this.data=void 0,this.data=t}}class Nx extends iu{constructor(t,r){super(t,r),this.Pr=void 0,this.Nr=null,this.Or=null,this._r=0,this.Pr=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this.Or}hasNextTick(){return!!this.Nr}setInterval(t){return!this.Or&&(this._r=0,this.Or=self.setInterval(this.Pr,t),!0)}clearInterval(){return!!this.Or&&(self.clearInterval(this.Or),this.Or=null,!0)}clearNextTick(){return!!this.Nr&&(self.clearTimeout(this.Nr),this.Nr=null,!0)}tick(){this._r++,this._r===1&&(this.doTick(),this._r>1&&this.tickImmediate(),this._r=0)}tickImmediate(){this.clearNextTick(),this.Nr=self.setTimeout(this.Pr,0)}doTick(){}}class KE{constructor(t,r,s,u=0,f=-1,c=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing={start:0,executeStart:0,executeEnd:0,end:0},this.buffering={audio:{start:0,executeStart:0,executeEnd:0,end:0},video:{start:0,executeStart:0,executeEnd:0,end:0},audiovideo:{start:0,executeStart:0,executeEnd:0,end:0}},this.level=t,this.sn=r,this.id=s,this.size=u,this.part=f,this.partial=c}}const _x={length:0,start:()=>0,end:()=>0};class bn{static isBuffered(t,r){if(t){const s=bn.getBuffered(t);for(let u=s.length;u--;)if(r>=s.start(u)&&r<=s.end(u))return!0}return!1}static bufferedRanges(t){if(t){const r=bn.getBuffered(t);return bn.timeRangesToArray(r)}return[]}static timeRangesToArray(t){const r=[];for(let s=0;s<t.length;s++)r.push({start:t.start(s),end:t.end(s)});return r}static bufferInfo(t,r,s){if(t){const u=bn.bufferedRanges(t);if(u.length)return bn.bufferedInfo(u,r,s)}return{len:0,start:r,end:r,bufferedIndex:-1}}static bufferedInfo(t,r,s){r=Math.max(0,r),t.length>1&&t.sort((A,L)=>A.start-L.start||L.end-A.end);let u=-1,f=[];if(s)for(let A=0;A<t.length;A++){r>=t[A].start&&r<=t[A].end&&(u=A);const L=f.length;if(L){const T=f[L-1].end;t[A].start-T<s?t[A].end>T&&(f[L-1].end=t[A].end):f.push(t[A])}else f.push(t[A])}else f=t;let c,v=0,y=r,E=r;for(let A=0;A<f.length;A++){const L=f[A].start,T=f[A].end;if(u===-1&&r>=L&&r<=T&&(u=A),r+s>=L&&r<T)y=L,E=T,v=E-r;else if(r+s<L){c=L;break}}return{len:v,start:y||0,end:E||0,nextStart:c,buffered:t,bufferedIndex:u}}static getBuffered(t){try{return t.buffered||_x}catch(r){return Hn.log("failed to get media.buffered",r),_x}}}const Fx=/\{\$([a-zA-Z0-9-_]+)\}/g;function Ux(a){return Fx.test(a)}function zE(a,t){if(a.variableList!==null||a.hasVariableRefs){const r=a.variableList;return t.replace(Fx,s=>{const u=s.substring(2,s.length-1),f=r==null?void 0:r[u];return f===void 0?(a.playlistParsingError||(a.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${u}"`)),s):f})}return t}function Bx(a,t,r){let s,u,f=a.variableList;if(f||(a.variableList=f={}),"QUERYPARAM"in t){s=t.QUERYPARAM;try{const c=new self.URL(r).searchParams;if(!c.has(s))throw new Error(`"${s}" does not match any query parameter in URI: "${r}"`);u=c.get(s)}catch(c){a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${c.message}`))}}else s=t.NAME,u=t.VALUE;s in f?a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${s}"`)):f[s]=u||""}function IM(a,t,r){const s=t.IMPORT;if(r&&s in r){let u=a.variableList;u||(a.variableList=u={}),u[s]=r[s]}else a.playlistParsingError||(a.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${s}"`))}const LM=/^(\d+)x(\d+)$/,$x=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Fr{constructor(t,r){typeof t=="string"&&(t=Fr.parseAttrList(t,r)),cr(this,t)}get clientAttrs(){return Object.keys(this).filter(t=>t.substring(0,2)==="X-")}decimalInteger(t){const r=parseInt(this[t],10);return r>Number.MAX_SAFE_INTEGER?1/0:r}hexadecimalInteger(t){if(this[t]){let r=(this[t]||"0x").slice(2);r=(1&r.length?"0":"")+r;const s=new Uint8Array(r.length/2);for(let u=0;u<r.length/2;u++)s[u]=parseInt(r.slice(2*u,2*u+2),16);return s}return null}hexadecimalIntegerAsNumber(t){const r=parseInt(this[t],16);return r>Number.MAX_SAFE_INTEGER?1/0:r}decimalFloatingPoint(t){return parseFloat(this[t])}optionalFloat(t,r){const s=this[t];return s?parseFloat(s):r}enumeratedString(t){return this[t]}enumeratedStringList(t,r){const s=this[t];return(s?s.split(/[ ,]+/):[]).reduce((u,f)=>(u[f.toLowerCase()]=!0,u),r)}bool(t){return this[t]==="YES"}decimalResolution(t){const r=LM.exec(this[t]);if(r!==null)return{width:parseInt(r[1],10),height:parseInt(r[2],10)}}static parseAttrList(t,r){let s;const u={};for($x.lastIndex=0;(s=$x.exec(t))!==null;){const f=s[1].trim();let c=s[2];const v=c.indexOf('"')===0&&c.lastIndexOf('"')===c.length-1;let y=!1;if(v)c=c.slice(1,-1);else switch(f){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":y=!0}if(r&&(v||y))c=zE(r,c);else if(!y&&!v)switch(f){case"CLOSED-CAPTIONS":if(c==="NONE")break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":Hn.warn(`${t}: attribute ${f} is missing quotes`)}u[f]=c}return u}}function RM(a){return a==="SCTE35-OUT"||a==="SCTE35-IN"||a==="SCTE35-CMD"}class jx{constructor(t,r,s=0){var u;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this.Ur=void 0,this.Fr=void 0,this.Br=void 0,this.jr=void 0,this.Hr=void 0,this.tagAnchor=(r==null?void 0:r.tagAnchor)||null,this.tagOrder=(u=r==null?void 0:r.tagOrder)!=null?u:s,r){const f=r.attr;for(const c in f)if(Object.prototype.hasOwnProperty.call(t,c)&&t[c]!==f[c]){Hn.warn(`DATERANGE tag attribute: "${c}" does not match for tags with ID: "${t.ID}"`),this.Hr=c;break}t=cr(new Fr({}),f,t)}if(this.attr=t,r?(this.Ur=r.Ur,this.jr=r.jr,this.Fr=r.Fr,this.Br=r.Br):this.Ur=new Date(t["START-DATE"]),"END-DATE"in this.attr){const f=(r==null?void 0:r.endDate)||new Date(this.attr["END-DATE"]);vt(f.getTime())&&(this.Fr=f)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const t=this.jr;return t===void 0?this.jr=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):t}get startTime(){const{tagAnchor:t}=this;return t===null||t.programDateTime===null?(Hn.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${t}`),NaN):t.start+(this.startDate.getTime()-t.programDateTime)/1e3}get startDate(){return this.Ur}get endDate(){const t=this.Fr||this.Br;if(t)return t;const r=this.duration;return r!==null?this.Br=new Date(this.Ur.getTime()+1e3*r):null}get duration(){if("DURATION"in this.attr){const t=this.attr.decimalFloatingPoint("DURATION");if(vt(t))return t}else if(this.Fr)return(this.Fr.getTime()-this.Ur.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isInterstitial(){return this.class==="com.apple.hls.interstitial"}get isValid(){return!!this.id&&!this.Hr&&vt(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}}class CM{constructor(t){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.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!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.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=t}reloaded(t){if(!t)return this.advanced=!0,void(this.updated=!0);const r=this.lastPartSn-t.lastPartSn,s=this.lastPartIndex-t.lastPartIndex;this.updated=this.endSN!==t.endSN||!!s||!!r||!this.live,this.advanced=this.endSN>t.endSN||r>0||r===0&&s>0,this.updated||this.advanced?this.misses=Math.floor(.6*t.misses):this.misses=t.misses+1}get hasProgramDateTime(){return!!this.fragments.length&&vt(this.fragments[this.fragments.length-1].programDateTime)}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||10}get drift(){const t=this.driftEndTime-this.driftStartTime;return t>0?1e3*(this.driftEnd-this.driftStart)/t:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var t;return(t=this.partList)!=null&&t.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){var t;return(t=this.fragments)!=null&&t.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){var t;return(t=this.fragments)!=null&&t.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var t;return(t=this.partList)!=null&&t.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const t=this.partList;if(t){const r=this.lastPartIndex;if(r!==-1){for(let s=t.length;s--;)if(t[s].index>r)return t[s].index;return r}}return 0}get lastPartSn(){var t;return(t=this.partList)!=null&&t.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const t=this.partEnd-this.fragmentStart;return this.age>Math.max(t,this.totalduration)+this.levelTargetDuration}return!1}}function Bf(a){return a==="AES-128"||a==="AES-256"||a==="AES-256-CTR"}function qE(a){switch(a){case"AES-128":case"AES-256":return vm;case"AES-256-CTR":return HE;default:throw new Error(`invalid full segment method ${a}`)}}function WE(a){return Uint8Array.from(atob(a),t=>t.charCodeAt(0))}function YE(a){return Uint8Array.from(unescape(encodeURIComponent(a)),t=>t.charCodeAt(0))}function DM(a){const t=a.split(":");let r=null;if(t[0]==="data"&&t.length===2){const s=t[1].split(";"),u=s[s.length-1].split(",");if(u.length===2){const f=u[0]==="base64",c=u[1];f?(s.splice(-1,1),r=WE(c)):r=function(v){const y=YE(v).subarray(0,16),E=new Uint8Array(16);return E.set(y,16-y.length),E}(c)}}return r}const T0=typeof self<"u"?self:void 0;var ir={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},QE="org.w3.clearkey",XE="com.apple.streamingkeydelivery",S0="com.microsoft.playready",w0="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function JE(a){switch(a){case XE:return ir.FAIRPLAY;case S0:return ir.PLAYREADY;case w0:return ir.WIDEVINE;case QE:return ir.CLEARKEY}}var PM="1077efecc0b24d02ace33c1e52e2fb4b",MM="e2719d58a985b3c9781ab030af78d30e",OM="9a04f07998404286ab92e65be0885f95",NM="edef8ba979d64acea3c827dcd51d21ed";function ZE(a){return a===NM?ir.WIDEVINE:a===OM?ir.PLAYREADY:a===PM||a===MM?ir.CLEARKEY:void 0}function eT(a){switch(a){case ir.FAIRPLAY:return XE;case ir.PLAYREADY:return S0;case ir.WIDEVINE:return w0;case ir.CLEARKEY:return QE}}function A0(a){const{drmSystems:t,widevineLicenseUrl:r}=a,s=t?[ir.FAIRPLAY,ir.WIDEVINE,ir.PLAYREADY,ir.CLEARKEY].filter(u=>!!t[u]):[];return!s[ir.WIDEVINE]&&r&&s.push(ir.WIDEVINE),s}const Gx=T0!=null&&(Hx=T0.navigator)!=null&&Hx.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;var Hx;function Vx(a){const t=new Uint16Array(a.buffer,a.byteOffset,a.byteLength/2),r=String.fromCharCode.apply(null,Array.from(t)),s=r.substring(r.indexOf("<"),r.length),u=new DOMParser().parseFromString(s,"text/xml").getElementsByTagName("KID")[0];if(u){const f=u.childNodes[0]?u.childNodes[0].nodeValue:u.getAttribute("VALUE");if(f){const c=WE(f).subarray(0,16);return function(v){const y=function(E,A,L){const T=E[A];E[A]=E[L],E[L]=T};y(v,0,3),y(v,1,2),y(v,4,5),y(v,6,7)}(c),c}}return null}let k0={};class bm{static clearKeyUriToKeyIdMap(){k0={}}constructor(t,r,s,u=[1],f=null){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=t,this.uri=r,this.keyFormat=s,this.keyFormatVersions=u,this.iv=f,this.encrypted=!!t&&t!=="NONE",this.isCommonEncryption=this.encrypted&&!Bf(t)}isSupported(){if(this.method){if(Bf(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case XE:case w0:case S0:case QE:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(t){if(!this.encrypted||!this.uri)return null;if(Bf(this.method)&&this.uri&&!this.iv){typeof t!="number"&&(Hn.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),t=0);const s=function(u){const f=new Uint8Array(16);for(let c=12;c<16;c++)f[c]=u>>8*(15-c)&255;return f}(t);return new bm(this.method,this.uri,"identity",this.keyFormatVersions,s)}const r=DM(this.uri);if(r)switch(this.keyFormat){case w0:this.pssh=r,r.length>=22&&(this.keyId=r.subarray(r.length-22,r.length-6));break;case S0:{const s=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=hM(s,0,r),this.keyId=Vx(r);break}default:{let s=r.subarray(0,16);if(s.length!==16){const u=new Uint8Array(16);u.set(s,16-s.length),s=u}this.keyId=s;break}}if(!this.keyId||this.keyId.byteLength!==16){let s=k0[this.uri];if(!s){const u=Object.keys(k0).length%Number.MAX_SAFE_INTEGER;s=new Uint8Array(16),new DataView(s.buffer,12,4).setUint32(0,u),k0[this.uri]=s}this.keyId=s}return this}}const Kx=/#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,zx=/#EXT-X-MEDIA:(.*)/g,_M=/^#EXT(?:INF|-X-TARGETDURATION):/m,tT=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),FM=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|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("|"));class ul{static findGroup(t,r){for(let s=0;s<t.length;s++){const u=t[s];if(u.id===r)return u}}static resolve(t,r){return DE.buildAbsoluteURL(r,t,{alwaysNormalize:!0})}static isMediaPlaylist(t){return _M.test(t)}static parseMasterPlaylist(t,r){const s={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:Ux(t)},u=[];let f;for(Kx.lastIndex=0;(f=Kx.exec(t))!=null;)if(f[1]){var c;const y=new Fr(f[1],s),E=zE(s,f[2]),A={attrs:y,bitrate:y.decimalInteger("BANDWIDTH")||y.decimalInteger("AVERAGE-BANDWIDTH"),name:y.NAME,url:ul.resolve(E,r)},L=y.decimalResolution("RESOLUTION");L&&(A.width=L.width,A.height=L.height),Qx(y.CODECS,A);const T=y["SUPPLEMENTAL-CODECS"];T&&(A.supplemental={},Qx(T,A.supplemental)),(c=A.unknownCodecs)!=null&&c.length||u.push(A),s.levels.push(A)}else if(f[3]){const y=f[3],E=f[4];switch(y){case"SESSION-DATA":{const A=new Fr(E,s),L=A["DATA-ID"];L&&(s.sessionData===null&&(s.sessionData={}),s.sessionData[L]=A);break}case"SESSION-KEY":{const A=Wx(E,r,s);A.encrypted&&A.isSupported()?(s.sessionKeys===null&&(s.sessionKeys=[]),s.sessionKeys.push(A)):Hn.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${E}"`);break}case"DEFINE":Bx(s,new Fr(E,s),r);break;case"CONTENT-STEERING":{const A=new Fr(E,s);s.contentSteering={uri:ul.resolve(A["SERVER-URI"],r),pathwayId:A["PATHWAY-ID"]||"."};break}case"START":s.startTimeOffset=Yx(E)}}const v=u.length>0&&u.length<s.levels.length;return s.levels=v?u:s.levels,s.levels.length===0&&(s.playlistParsingError=new Error("no levels found in manifest")),s}static parseMasterPlaylistMedia(t,r,s){let u;const f={},c=s.levels,v={AUDIO:c.map(E=>({id:E.attrs.AUDIO,audioCodec:E.audioCodec})),SUBTITLES:c.map(E=>({id:E.attrs.SUBTITLES,textCodec:E.textCodec})),"CLOSED-CAPTIONS":[]};let y=0;for(zx.lastIndex=0;(u=zx.exec(t))!==null;){const E=new Fr(u[1],s),A=E.TYPE;if(A){const L=v[A],T=f[A]||[];f[A]=T;const M=E.LANGUAGE,O=E["ASSOC-LANGUAGE"],U=E.CHANNELS,$=E.CHARACTERISTICS,z=E["INSTREAM-ID"],Q={attrs:E,bitrate:0,id:y++,groupId:E["GROUP-ID"]||"",name:E.NAME||M||"",type:A,default:E.bool("DEFAULT"),autoselect:E.bool("AUTOSELECT"),forced:E.bool("FORCED"),lang:M,url:E.URI?ul.resolve(E.URI,r):""};if(O&&(Q.assocLang=O),U&&(Q.channels=U),$&&(Q.characteristics=$),z&&(Q.instreamId=z),L!=null&&L.length){const Z=ul.findGroup(L,Q.groupId)||L[0];Xx(Q,Z,"audioCodec"),Xx(Q,Z,"textCodec")}T.push(Q)}}return f}static parseLevelPlaylist(t,r,s,u,f,c){var v;const y={url:r},E=new CM(r),A=E.fragments,L=[];let T,M,O,U,$=null,z=0,Q=0,Z=0,ie=0,se=0,ye=null,N=new OE(u,y),re=-1,ne=!1,Se=null;if(tT.lastIndex=0,E.m3u8=t,E.hasVariableRefs=Ux(t),((v=tT.exec(t))==null?void 0:v[0])!=="#EXTM3U")return E.playlistParsingError=new Error("Missing format identifier #EXTM3U"),E;for(;(T=tT.exec(t))!==null;){ne&&(ne=!1,N=new OE(u,y),N.playlistOffset=Z,N.start=Z,N.sn=z,N.cc=ie,se&&(N.bitrate=se),N.level=s,$&&(N.initSegment=$,$.rawProgramDateTime&&(N.rawProgramDateTime=$.rawProgramDateTime,$.rawProgramDateTime=null),Se&&(N.setByteRange(Se),Se=null)));const xe=T[1];if(xe){N.duration=parseFloat(xe);const Ce=(" "+T[2]).slice(1);N.title=Ce||null,N.tagList.push(Ce?["INF",xe,Ce]:["INF",xe])}else if(T[3]){if(vt(N.duration)){N.playlistOffset=Z,N.start=Z,O&&Zx(N,O,E),N.sn=z,N.level=s,N.cc=ie,A.push(N);const Ce=(" "+T[3]).slice(1);N.relurl=zE(E,Ce),nT(N,ye,L),ye=N,Z+=N.duration,z++,Q=0,ne=!0}}else{if(T=T[0].match(FM),!T){Hn.warn("No matches on slow regex match for level playlist!");continue}for(M=1;M<T.length&&T[M]===void 0;M++);const Ce=(" "+T[M]).slice(1),J=(" "+T[M+1]).slice(1),ue=T[M+2]?(" "+T[M+2]).slice(1):null;switch(Ce){case"BYTERANGE":ye?N.setByteRange(J,ye):N.setByteRange(J);break;case"PROGRAM-DATE-TIME":N.rawProgramDateTime=J,N.tagList.push(["PROGRAM-DATE-TIME",J]),re===-1&&(re=A.length);break;case"PLAYLIST-TYPE":E.type&&ou(E,Ce,T),E.type=J.toUpperCase();break;case"MEDIA-SEQUENCE":E.startSN!==0?ou(E,Ce,T):A.length>0&&eI(E,Ce,T),z=E.startSN=parseInt(J);break;case"SKIP":{E.skippedSegments&&ou(E,Ce,T);const de=new Fr(J,E),W=de.decimalInteger("SKIPPED-SEGMENTS");if(vt(W)){E.skippedSegments+=W;for(let nt=W;nt--;)A.push(null);z+=W}const Ke=de.enumeratedString("RECENTLY-REMOVED-DATERANGES");Ke&&(E.recentlyRemovedDateranges=(E.recentlyRemovedDateranges||[]).concat(Ke.split("	")));break}case"TARGETDURATION":E.targetduration!==0&&ou(E,Ce,T),E.targetduration=Math.max(parseInt(J),1);break;case"VERSION":E.version!==null&&ou(E,Ce,T),E.version=parseInt(J);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":E.live||ou(E,Ce,T),E.live=!1;break;case"#":(J||ue)&&N.tagList.push(ue?[J,ue]:[J]);break;case"DISCONTINUITY":ie++,N.tagList.push(["DIS"]);break;case"GAP":N.gap=!0,N.tagList.push([Ce]);break;case"BITRATE":N.tagList.push([Ce,J]),se=1e3*parseInt(J),vt(se)?N.bitrate=se:se=0;break;case"DATERANGE":{const de=new Fr(J,E),W=new jx(de,E.dateRanges[de.ID],E.dateRangeTagCount);E.dateRangeTagCount++,W.isValid||E.skippedSegments?E.dateRanges[W.id]=W:Hn.warn(`Ignoring invalid DATERANGE tag: "${J}"`),N.tagList.push(["EXT-X-DATERANGE",J]);break}case"DEFINE":{const de=new Fr(J,E);"IMPORT"in de?IM(E,de,c):Bx(E,de,r)}break;case"DISCONTINUITY-SEQUENCE":E.startCC!==0?ou(E,Ce,T):A.length>0&&eI(E,Ce,T),E.startCC=ie=parseInt(J);break;case"KEY":{const de=Wx(J,r,E);if(de.isSupported()){if(de.method==="NONE"){O=void 0;break}O||(O={}),O[de.keyFormat]&&(O=cr({},O)),O[de.keyFormat]=de}else Hn.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${J}"`);break}case"START":E.startTimeOffset=Yx(J);break;case"MAP":{const de=new Fr(J,E);if(N.duration){const W=new OE(u,y);Jx(W,de,s,O),$=W,N.initSegment=$,$.rawProgramDateTime&&!N.rawProgramDateTime&&(N.rawProgramDateTime=$.rawProgramDateTime)}else{const W=N.byteRangeEndOffset;if(W){const Ke=N.byteRangeStartOffset;Se=`${W-Ke}@${Ke}`}else Se=null;Jx(N,de,s,O),$=N,ne=!0}$.cc=ie;break}case"SERVER-CONTROL":U&&ou(E,Ce,T),U=new Fr(J),E.canBlockReload=U.bool("CAN-BLOCK-RELOAD"),E.canSkipUntil=U.optionalFloat("CAN-SKIP-UNTIL",0),E.canSkipDateRanges=E.canSkipUntil>0&&U.bool("CAN-SKIP-DATERANGES"),E.partHoldBack=U.optionalFloat("PART-HOLD-BACK",0),E.holdBack=U.optionalFloat("HOLD-BACK",0);break;case"PART-INF":{E.partTarget&&ou(E,Ce,T);const de=new Fr(J);E.partTarget=de.decimalFloatingPoint("PART-TARGET");break}case"PART":{let de=E.partList;de||(de=E.partList=[]);const W=Q>0?de[de.length-1]:void 0,Ke=Q++,nt=new Fr(J,E),mt=new aM(nt,N,y,Ke,W);de.push(mt),N.duration+=mt.duration;break}case"PRELOAD-HINT":{const de=new Fr(J,E);E.preloadHint=de;break}case"RENDITION-REPORT":{const de=new Fr(J,E);E.renditionReports=E.renditionReports||[],E.renditionReports.push(de);break}default:Hn.warn(`line parsed but not handled: ${T}`)}}}ye&&!ye.relurl?(A.pop(),Z-=ye.duration,E.partList&&(E.fragmentHint=ye)):E.partList&&(nT(N,ye,L),N.cc=ie,E.fragmentHint=N,O&&Zx(N,O,E)),E.targetduration||(E.playlistParsingError=new Error("#EXT-X-TARGETDURATION is required"));const ce=A.length,we=A[0],ze=A[ce-1];if(Z+=E.skippedSegments*E.targetduration,Z>0&&ce&&ze){E.averagetargetduration=Z/ce;const xe=ze.sn;E.endSN=xe!=="initSegment"?xe:0,E.live||(ze.endList=!0),we&&E.startCC===void 0&&(E.startCC=we.cc),re>0&&(function(Ce,J){let ue=Ce[J];for(let de=J;de--;){const W=Ce[de];if(!W)return;W.programDateTime=ue.programDateTime-1e3*W.duration,ue=W}}(A,re),we&&L.unshift(we))}else E.endSN=0,E.startCC=0;return E.fragmentHint&&(Z+=E.fragmentHint.duration),E.totalduration=Z,L.length&&E.dateRangeTagCount&&we&&qx(L,E),E.endCC=ie,E}}function qx(a,t){const r=a.length,s=a[r-1],u=t.live?1/0:t.totalduration,f=Object.keys(t.dateRanges);for(let c=f.length;c--;){const v=t.dateRanges[f[c]],y=v.startDate.getTime();v.tagAnchor=s.ref;for(let E=r;E--;){const A=UM(t,y,a,E,u);if(A!==-1){v.tagAnchor=t.fragments[A].ref;break}}}}function UM(a,t,r,s,u){const f=r[s];if(f){const v=f.programDateTime;if(t>=v||s===0){var c;if(t<=v+1e3*((((c=r[s+1])==null?void 0:c.start)||u)-f.start)){const y=r[s].sn-a.startSN,E=a.fragments;if(E.length>r.length)for(let A=(r[s+1]||E[E.length-1]).sn-a.startSN;A>y;A--){const L=E[A].programDateTime;if(t>=L&&t<L+1e3*E[A].duration)return A}return y}}}return-1}function Wx(a,t,r){var s,u;const f=new Fr(a,r),c=(s=f.METHOD)!=null?s:"",v=f.URI,y=f.hexadecimalInteger("IV"),E=f.KEYFORMATVERSIONS,A=(u=f.KEYFORMAT)!=null?u:"identity";v&&f.IV&&!y&&Hn.error(`Invalid IV: ${f.IV}`);const L=v?ul.resolve(v,t):"",T=(E||"1").split("/").map(Number).filter(Number.isFinite);return new bm(c,L,A,T,y)}function Yx(a){const t=new Fr(a).decimalFloatingPoint("TIME-OFFSET");return vt(t)?t:null}function Qx(a,t){let r=(a||"").split(/[ ,]+/).filter(s=>s);["video","audio","text"].forEach(s=>{const u=r.filter(f=>lx(f,s));u.length&&(t[`${s}Codec`]=u.map(f=>f.split("/")[0]).join(","),r=r.filter(f=>u.indexOf(f)===-1))}),t.unknownCodecs=r}function Xx(a,t,r){const s=t[r];s&&(a[r]=s)}function nT(a,t,r){a.rawProgramDateTime?r.push(a):t!=null&&t.programDateTime&&(a.programDateTime=t.endProgramDateTime)}function Jx(a,t,r,s){a.relurl=t.URI,t.BYTERANGE&&a.setByteRange(t.BYTERANGE),a.level=r,a.sn="initSegment",s&&(a.levelkeys=s),a.initSegment=null}function Zx(a,t,r){a.levelkeys=t;const{encryptedFragments:s}=r;s.length&&s[s.length-1].levelkeys===t||!Object.keys(t).some(u=>t[u].isCommonEncryption)||s.push(a)}function ou(a,t,r){a.playlistParsingError=new Error(`#EXT-X-${t} must not appear more than once (${r[0]})`)}function eI(a,t,r){a.playlistParsingError=new Error(`#EXT-X-${t} must appear before the first Media Segment (${r[0]})`)}function rT(a,t){const r=t.startPTS;if(vt(r)){let s,u=0;t.sn>a.sn?(u=r-a.start,s=a):(u=a.start-r,s=t),s.duration!==u&&s.setDuration(u)}else t.sn>a.sn?a.cc===t.cc&&a.minEndPTS?t.setStart(a.start+(a.minEndPTS-a.start)):t.setStart(a.start+a.duration):t.setStart(Math.max(a.start-t.duration,0))}function tI(a,t,r,s,u,f){s-r<=0&&(Hn.warn("Fragment should have a positive duration",t),s=r+t.duration,f=u+t.duration);let c=r,v=s;const y=t.startPTS,E=t.endPTS;if(vt(y)){const U=Math.abs(y-r);vt(t.deltaPTS)?t.deltaPTS=Math.max(U,t.deltaPTS):t.deltaPTS=U,c=Math.max(r,y),r=Math.min(r,y),u=Math.min(u,t.startDTS),v=Math.min(s,E),s=Math.max(s,E),f=Math.max(f,t.endDTS)}const A=r-t.start;t.start!==0&&t.setStart(r),t.setDuration(s-t.start),t.startPTS=r,t.maxStartPTS=c,t.startDTS=u,t.endPTS=s,t.minEndPTS=v,t.endDTS=f;const L=t.sn;if(!a||L<a.startSN||L>a.endSN)return 0;let T;const M=L-a.startSN,O=a.fragments;for(O[M]=t,T=M;T>0;T--)rT(O[T],O[T-1]);for(T=M;T<O.length-1;T++)rT(O[T],O[T+1]);return a.fragmentHint&&rT(O[O.length-1],a.fragmentHint),a.PTSKnown=a.alignedSliding=!0,A}function BM(a,t){if(a===t)return;let r=null;const s=a.fragments;for(let y=s.length-1;y>=0;y--){const E=s[y].initSegment;if(E){r=E;break}}let u;a.fragmentHint&&delete a.fragmentHint.endPTS,function(y,E,A){const L=E.skippedSegments,T=Math.max(y.startSN,E.startSN)-E.startSN,M=(y.fragmentHint?1:0)+(L?E.endSN:Math.min(y.endSN,E.endSN))-E.startSN,O=E.startSN-y.startSN,U=E.fragmentHint?E.fragments.concat(E.fragmentHint):E.fragments,$=y.fragmentHint?y.fragments.concat(y.fragmentHint):y.fragments;for(let z=T;z<=M;z++){const Q=$[O+z];let Z=U[z];if(L&&!Z&&Q&&(Z=E.fragments[z]=Q),Q&&Z){if(A(Q,Z,z,U),Q.url&&Q.url!==Z.url)return void(E.playlistParsingError=nI(`media sequence mismatch ${Z.sn}:`,y,E,Q,Z));if(Q.cc!==Z.cc)return void(E.playlistParsingError=nI(`discontinuity sequence mismatch (${Q.cc}!=${Z.cc})`,y,E,Q,Z))}}}(a,t,(y,E,A,L)=>{if(!t.startCC&&E.cc!==y.cc){var T,M;const O=y.cc-E.cc;for(let U=A;U<L.length;U++)L[U].cc+=O;t.startCC=(T=(M=sI(a,t.startSN-1))==null?void 0:M.cc)!=null?T:L[0].cc,t.endCC=L[L.length-1].cc}vt(y.startPTS)&&vt(y.endPTS)&&(E.setStart(E.startPTS=y.startPTS),E.startDTS=y.startDTS,E.maxStartPTS=y.maxStartPTS,E.endPTS=y.endPTS,E.endDTS=y.endDTS,E.minEndPTS=y.minEndPTS,E.setDuration(y.endPTS-y.startPTS),E.duration&&(u=E),t.PTSKnown=t.alignedSliding=!0),y.hasStreams&&(E.elementaryStreams=y.elementaryStreams),E.loader=y.loader,y.hasStats&&(E.stats=y.stats),y.initSegment&&(E.initSegment=y.initSegment,r=y.initSegment)});const f=t.fragments,c=t.fragmentHint?f.concat(t.fragmentHint):f;if(r&&c.forEach(y=>{var E;!y||y.initSegment&&y.initSegment.relurl!==((E=r)==null?void 0:E.relurl)||(y.initSegment=r)}),t.skippedSegments)if(t.deltaUpdateFailed=f.some(y=>!y),t.deltaUpdateFailed){Hn.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let y=t.skippedSegments;y--;)f.shift();t.startSN=f[0].sn}else{t.endCC=f[f.length-1].cc,t.canSkipDateRanges&&(t.dateRanges=function(E,A){const{dateRanges:L,recentlyRemovedDateranges:T}=A,M=cr({},E);T&&T.forEach(U=>{delete M[U]});const O=Object.keys(M).length;return O&&Object.keys(L).forEach(U=>{const $=M[U],z=new jx(L[U].attr,$);z.isValid?(M[U]=z,$||(z.tagOrder+=O)):Hn.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${Or(L[U].attr)}"`)}),M}(a.dateRanges,t));const y=a.fragments.filter(E=>E.rawProgramDateTime);if(a.hasProgramDateTime&&!t.hasProgramDateTime)for(let E=1;E<c.length;E++)c[E].programDateTime===null&&nT(c[E],c[E-1],y);qx(y,t)}(function(y,E,A){if(y&&E){let L=0;for(let T=0,M=y.length;T<=M;T++){const O=y[T],U=E[T+L];O&&U&&O.index===U.index&&O.fragment.sn===U.fragment.sn?A(O,U):L--}}})(a.partList,t.partList,(y,E)=>{E.elementaryStreams=y.elementaryStreams,E.stats=y.stats}),u?tI(t,u,u.startPTS,u.endPTS,u.startDTS,u.endDTS):rI(a,t),f.length&&(t.totalduration=t.edge-f[0].start),t.driftStartTime=a.driftStartTime,t.driftStart=a.driftStart;const v=t.advancedDateTime;if(t.advanced&&v){const y=t.edge;t.driftStart||(t.driftStartTime=v,t.driftStart=y),t.driftEndTime=v,t.driftEnd=y}else t.driftEndTime=a.driftEndTime,t.driftEnd=a.driftEnd,t.advancedDateTime=a.advancedDateTime;t.requestScheduled===-1&&(t.requestScheduled=a.requestScheduled)}function nI(a,t,r,s,u){return new Error(`${a} ${u.url}
Playlist starting @${t.startSN}
${t.m3u8}

Playlist starting @${r.startSN}
${r.m3u8}`)}function rI(a,t,r=!0){const s=t.startSN+t.skippedSegments-a.startSN,u=a.fragments,f=s>=0;let c=0;if(f&&s<u.length)c=u[s].start;else if(f&&t.startSN===a.endSN+1)c=a.fragmentEnd;else if(f&&r)c=a.fragmentStart+s*t.levelTargetDuration;else{if(t.skippedSegments||t.fragmentStart!==0)return;c=a.fragmentStart}iT(t,c)}function iT(a,t){if(t){const r=a.fragments;for(let s=a.skippedSegments;s<r.length;s++)r[s].addStart(t);a.fragmentHint&&a.fragmentHint.addStart(t)}}function iI(a,t=1/0){let r=1e3*a.targetduration;if(a.updated){const s=a.fragments;if(s.length&&r*4>t){const f=1e3*s[s.length-1].duration;f<r&&(r=f)}}else r/=2;return Math.round(r)}function sI(a,t,r){if(!a)return null;let s=a.fragments[t-a.startSN];return s||(s=a.fragmentHint,s&&s.sn===t?s:t<a.startSN&&r&&r.sn===t?r:null)}function aI(a,t,r){return a?oI(a.partList,t,r):null}function oI(a,t,r){if(a)for(let s=a.length;s--;){const u=a[s];if(u.index===r&&u.fragment.sn===t)return u}return null}function lI(a){a.forEach((t,r)=>{var s;(s=t.details)==null||s.fragments.forEach(u=>{u.level=r,u.initSegment&&(u.initSegment.level=r)})})}function Em(a,t){for(let s=0,u=a.length;s<u;s++){var r;if(((r=a[s])==null?void 0:r.cc)===t)return a[s]}return null}function uI(a,t){if(a){const r=a.start+t;a.start=a.startPTS=r,a.endPTS=r+a.duration}}function cI(a,t){const r=t.fragments;for(let s=0,u=r.length;s<u;s++)uI(r[s],a);t.fragmentHint&&uI(t.fragmentHint,a),t.alignedSliding=!0}function dI(a,t){if(!function(f,c){return!!(f&&c.startCC<f.endCC&&c.endCC>f.startCC)}(t,a))return;const r=Math.min(t.endCC,a.endCC),s=Em(t.fragments,r),u=Em(a.fragments,r);!s||!u||(Hn.log(`Aligning playlist at start of dicontinuity sequence ${r}`),cI(s.start-u.start,a))}function x0(a,t){if(!a.hasProgramDateTime||!t.hasProgramDateTime)return;const r=a.fragments,s=t.fragments;if(!r.length||!s.length)return;let u,f;const c=Math.min(t.endCC,a.endCC);t.startCC<c&&a.startCC<c&&(u=Em(s,c),f=Em(r,c)),u&&f||(u=s[Math.floor(s.length/2)],f=Em(r,u.cc)||r[Math.floor(r.length/2)]);const v=u.programDateTime,y=f.programDateTime;!v||!y||cI((y-v)/1e3-(f.start-u.start),a)}const $M=function(a){let t="";const r=a.length;for(let s=0;s<r;s++)t+=`[${a.start(s).toFixed(3)}-${a.end(s).toFixed(3)}]`;return t},ri="STOPPED",En="IDLE",sT="KEY_LOADING",$f="FRAG_LOADING",jf="FRAG_LOADING_WAITING_RETRY",Gf="WAITING_TRACK",lu="PARSING",I0="PARSED",Hf="ENDED",Xd="ERROR",Tm="WAITING_INIT_PTS",Jd="WAITING_LEVEL";class aT extends Nx{constructor(t,r,s,u,f){super(u,t.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this.Nn=ri,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.buffering=!0,this.loadingParts=!1,this.loopSn=void 0,this.onMediaSeeking=()=>{const{config:c,fragCurrent:v,media:y,mediaBuffer:E,state:A}=this,L=y?y.currentTime:0,T=bn.bufferInfo(E||y,L,c.maxBufferHole);if(this.log(`media seeking to ${vt(L)?L.toFixed(3):L}, state: ${A}`),this.state===Hf)this.resetLoadingState();else if(v){const M=c.maxFragLookUpTolerance,O=v.start-M,U=v.start+v.duration+M;if(!T.len||U<T.start||O>T.end){const $=L>U;(L<O||$)&&($&&v.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),v.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(y&&(this.fragmentTracker.removeFragmentsInRange(L,1/0,this.playlistType,!0),L>this.lastCurrentTime&&(this.lastCurrentTime=L),!this.loadingParts)){const M=Math.max(T.end,L),O=this.shouldLoadParts(this.getLevelDetails(),M);O&&(this.log(`LL-Part loading ON after seeking to ${L.toFixed(2)} with buffer @${M.toFixed(2)}`),this.loadingParts=O)}this.hls.hasEnoughToStart||T.len||(this.log(`setting startPosition to ${L} because of seek before start`),this.nextLoadPosition=this.startPosition=L),this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=f,this.hls=t,this.fragmentLoader=new xM(t.config),this.keyLoader=s,this.fragmentTracker=r,this.config=t.config,this.decrypter=new VE(t.config)}registerListeners(){const{hls:t}=this;t.on(G.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(G.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(G.MANIFEST_LOADING,this.onManifestLoading,this),t.on(G.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(G.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t.off(G.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(G.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(G.MANIFEST_LOADING,this.onManifestLoading,this),t.off(G.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(G.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(t){}stopLoad(){if(this.state===ri)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const t=this.fragCurrent;t!=null&&t.loader&&(t.abortRequests(),this.fragmentTracker.removeFragment(t)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=ri}get startPositionValue(){const{nextLoadPosition:t,startPosition:r}=this;return r===-1&&t?t:r}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}Vr(t,r){if(r.live||!this.media)return!1;const s=t.end||0,u=this.config.timelineOffset||0;if(s<=u)return!1;const f=t.nextStart;if(f&&f>u&&f<r.edge||this.media.currentTime<t.start)return!1;const c=r.partList;if(c!=null&&c.length){const y=c[c.length-1];return bn.isBuffered(this.media,y.start+y.duration/2)}const v=r.fragments[r.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(v)}getLevelDetails(){var t;if(this.levels&&this.levelLastLoaded!==null)return(t=this.levelLastLoaded)==null?void 0:t.details}get timelineOffset(){const t=this.config.timelineOffset;var r;return t?((r=this.getLevelDetails())==null?void 0:r.appliedTimelineOffset)||t:0}onMediaAttached(t,r){const s=this.media=this.mediaBuffer=r.media;s.removeEventListener("seeking",this.onMediaSeeking),s.removeEventListener("ended",this.onMediaEnded),s.addEventListener("seeking",this.onMediaSeeking),s.addEventListener("ended",this.onMediaEnded);const u=this.config;this.levels&&u.autoStartLoad&&this.state===ri&&this.startLoad(u.startPosition)}onMediaDetaching(t,r){const s=!!r.transferMedia,u=this.media;if(u!==null){if(u.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),u.removeEventListener("seeking",this.onMediaSeeking),u.removeEventListener("ended",this.onMediaEnded),this.keyLoader&&!s&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,s)return this.resetLoadingState(),void this.resetTransmuxer();this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=this.startPosition=0,this.startFragRequested=!1}onError(t,r){}onManifestLoaded(t,r){this.startTimeOffset=r.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=ri,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(t,r,s){this.startFragRequested=!0,this.Gr(t,r,s)}Gr(t,r,s){this.Xr(t,r,s,u=>{const f=u.frag;if(this.fragContextChanged(f))return this.warn(`${f.type} sn: ${f.sn}${u.part?" part: "+u.part.index:""} of ${this.fragInfo(f,!1,u.part)}) was dropped during download.`),void this.fragmentTracker.removeFragment(f);f.stats.chunkCount++,this.qr(u)}).then(u=>{if(!u)return;const f=this.state,c=u.frag;this.fragContextChanged(c)?(f===$f||!this.fragCurrent&&f===lu)&&(this.fragmentTracker.removeFragment(c),this.state=En):("payload"in u&&(this.log(`Loaded ${c.type} sn: ${c.sn} of ${this.playlistLabel()} ${c.level}`),this.hls.trigger(G.FRAG_LOADED,u)),this.Kr(u))}).catch(u=>{this.state!==ri&&this.state!==Xd&&(this.warn(`Frag error: ${(u==null?void 0:u.message)||u}`),this.resetFragmentLoading(t))})}clearTrackerIfNeeded(t){var r;const{fragmentTracker:s}=this;if(s.getState(t)===Cx){const u=t.type,f=this.getFwdBufferInfo(this.mediaBuffer,u),c=Math.max(t.duration,f?f.len:this.config.maxBufferLength),v=this.backtrackFragment;((v?t.sn-v.sn:0)===1||this.reduceMaxBufferLength(c,t.duration))&&s.removeFragment(t)}else((r=this.mediaBuffer)==null?void 0:r.buffered.length)===0?s.removeAllFragments():s.hasParts(t.type)&&(s.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type}),s.getState(t)===_f&&s.removeFragment(t))}checkLiveUpdate(t){if(t.updated&&!t.live){const r=t.fragments[t.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:r,part:null,stats:r.stats,id:r.type})}t.fragments[0]||(t.deltaUpdateFailed=!0)}waitForLive(t){const r=t.details;return(r==null?void 0:r.live)&&r.type!=="EVENT"&&(this.levelLastLoaded!==t||r.expired)}flushMainBuffer(t,r,s=null){if(!(t-r))return;const u={startOffset:t,endOffset:r,type:s};this.hls.trigger(G.BUFFER_FLUSHING,u)}Wr(t,r){this.Xr(t,r).then(s=>{const u=s==null?void 0:s.frag;if(!u||this.fragContextChanged(u)||!this.levels)throw new Error("init load aborted");return s}).then(s=>{const{hls:u}=this,{frag:f,payload:c}=s,v=f.decryptdata;if(c&&c.byteLength>0&&v!=null&&v.key&&v.iv&&Bf(v.method)){const y=self.performance.now();return this.decrypter.decrypt(new Uint8Array(c),v.key.buffer,v.iv.buffer,qE(v.method)).catch(E=>{throw u.trigger(G.ERROR,{type:Mt.MEDIA_ERROR,details:Me.FRAG_DECRYPT_ERROR,fatal:!1,error:E,reason:E.message,frag:f}),E}).then(E=>{const A=self.performance.now();return u.trigger(G.FRAG_DECRYPTED,{frag:f,payload:E,stats:{tstart:y,tdecrypt:A}}),s.payload=E,this.completeInitSegmentLoad(s)})}return this.completeInitSegmentLoad(s)}).catch(s=>{this.state!==ri&&this.state!==Xd&&(this.warn(s),this.resetFragmentLoading(t))})}completeInitSegmentLoad(t){const{levels:r}=this;if(!r)throw new Error("init load aborted, missing levels");const s=t.frag.stats;this.state!==ri&&(this.state=En),t.frag.data=new Uint8Array(t.payload),s.parsing.start=s.buffering.start=self.performance.now(),s.parsing.end=s.buffering.end=self.performance.now(),this.tick()}fragContextChanged(t){const{fragCurrent:r}=this;return!t||!r||t.sn!==r.sn||t.level!==r.level}fragBufferedComplete(t,r){const s=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${t.type} sn: ${t.sn}${r?" part: "+r.index:""} of ${this.fragInfo(t,!1,r)} > buffer:${s?$M(bn.getBuffered(s)):"(detached)"})`),xi(t)){var u;if(t.type!==Eo){const c=t.elementaryStreams;if(!Object.keys(c).some(v=>!!c[v]))return void(this.state=En)}const f=(u=this.levels)==null?void 0:u[t.level];f!=null&&f.fragmentError&&(this.log(`Resetting level fragment error count of ${f.fragmentError} on frag buffered`),f.fragmentError=0)}this.state=En}Kr(t){const{transmuxer:r}=this;if(!r)return;const{frag:s,part:u,partsLoaded:f}=t,c=!f||f.length===0||f.some(y=>!y),v=new KE(s.level,s.sn,s.stats.chunkCount+1,0,u?u.index:-1,!c);r.flush(v)}qr(t){}Xr(t,r,s=null,u){var f;this.fragCurrent=t;const c=r==null?void 0:r.details;if(!this.levels||!c)throw new Error(`frag load aborted, missing level${c?"":" detail"}s`);let v=null;!t.encrypted||(f=t.decryptdata)!=null&&f.key?!t.encrypted&&c.encryptedFragments.length&&this.keyLoader.loadClear(t,c.encryptedFragments):(this.log(`Loading key for ${t.sn} of [${c.startSN}-${c.endSN}], ${this.playlistLabel()} ${t.level}`),this.state=sT,this.fragCurrent=t,v=this.keyLoader.load(t).then(L=>{if(!this.fragContextChanged(L.frag))return this.hls.trigger(G.KEY_LOADED,L),this.state===sT&&(this.state=En),L}),this.hls.trigger(G.KEY_LOADING,{frag:t}),this.fragCurrent===null&&(v=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING"))));const y=this.fragPrevious;if(xi(t)&&(!y||t.sn!==y.sn)){const L=this.shouldLoadParts(r.details,t.end);L!==this.loadingParts&&(this.log(`LL-Part loading ${L?"ON":"OFF"} loading sn ${y==null?void 0:y.sn}->${t.sn}`),this.loadingParts=L)}if(s=Math.max(t.start,s||0),this.loadingParts&&xi(t)){const L=c.partList;if(L&&u){s>t.end&&c.fragmentHint&&(t=c.fragmentHint);const T=this.getNextPart(L,t,s);if(T>-1){const M=L[T];let O;return t=this.fragCurrent=M.fragment,this.log(`Loading ${t.type} sn: ${t.sn} part: ${M.index} (${T}/${L.length-1}) of ${this.fragInfo(t,!1,M)}) cc: ${t.cc} [${c.startSN}-${c.endSN}], target: ${parseFloat(s.toFixed(3))}`),this.nextLoadPosition=M.start+M.duration,this.state=$f,O=v?v.then(U=>!U||this.fragContextChanged(U.frag)?null:this.doFragPartsLoad(t,M,r,u)).catch(U=>this.handleFragLoadError(U)):this.doFragPartsLoad(t,M,r,u).catch(U=>this.handleFragLoadError(U)),this.hls.trigger(G.FRAG_LOADING,{frag:t,part:M,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):O}if(!t.url||this.loadedEndOfParts(L,s))return Promise.resolve(null)}}if(xi(t)&&this.loadingParts)this.log(`LL-Part loading OFF after next part miss @${s.toFixed(2)}`),this.loadingParts=!1;else if(!t.url)return Promise.resolve(null);this.log(`Loading ${t.type} sn: ${t.sn} of ${this.fragInfo(t,!1)}) cc: ${t.cc} ${c?"["+c.startSN+"-"+c.endSN+"]":""}, target: ${parseFloat(s.toFixed(3))}`),vt(t.sn)&&!this.bitrateTest&&(this.nextLoadPosition=t.start+t.duration),this.state=$f;const E=this.config.progressive;let A;return A=E&&v?v.then(L=>!L||this.fragContextChanged(L==null?void 0:L.frag)?null:this.fragmentLoader.load(t,u)).catch(L=>this.handleFragLoadError(L)):Promise.all([this.fragmentLoader.load(t,E?u:void 0),v]).then(([L])=>(!E&&L&&u&&u(L),L)).catch(L=>this.handleFragLoadError(L)),this.hls.trigger(G.FRAG_LOADING,{frag:t,targetBufferTime:s}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):A}doFragPartsLoad(t,r,s,u){return new Promise((f,c)=>{var v;const y=[],E=(v=s.details)==null?void 0:v.partList,A=L=>{this.fragmentLoader.loadPart(t,L,u).then(T=>{y[L.index]=T;const M=T.part;this.hls.trigger(G.FRAG_LOADED,T);const O=aI(s.details,t.sn,L.index+1)||oI(E,t.sn,L.index+1);if(!O)return f({frag:t,part:M,partsLoaded:y});A(O)}).catch(c)};A(r)})}handleFragLoadError(t){if("data"in t){const r=t.data;t.data&&r.details===Me.INTERNAL_ABORTED?this.handleFragLoadAborted(r.frag,r.part):this.hls.trigger(G.ERROR,r)}else this.hls.trigger(G.ERROR,{type:Mt.OTHER_ERROR,details:Me.INTERNAL_EXCEPTION,err:t,error:t,fatal:!0});return null}zr(t){const r=this.getCurrentContext(t);if(!r||this.state!==lu)return void(this.fragCurrent||this.state===ri||this.state===Xd||(this.state=En));const{frag:s,part:u,level:f}=r,c=self.performance.now();s.stats.parsing.end=c,u&&(u.stats.parsing.end=c);const v=this.getLevelDetails(),y=v&&s.sn>v.endSN||this.shouldLoadParts(v,s.end);y!==this.loadingParts&&(this.log(`LL-Part loading ${y?"ON":"OFF"} after parsing segment ending @${s.end.toFixed(2)}`),this.loadingParts=y),this.updateLevelTiming(s,u,f,t.partial)}shouldLoadParts(t,r){if(this.config.lowLatencyMode){if(!t)return this.loadingParts;if(t!=null&&t.partList){var s;const f=t.partList[0];if(r>=f.end+(((s=t.fragmentHint)==null?void 0:s.duration)||0)){var u;if((this.hls.hasEnoughToStart?((u=this.media)==null?void 0:u.currentTime)||this.lastCurrentTime:this.getLoadPosition())>f.start-f.fragment.duration)return!0}}}return!1}getCurrentContext(t){const{levels:r,fragCurrent:s}=this,{level:u,sn:f,part:c}=t;if(r==null||!r[u])return this.warn(`Levels object was unset while buffering fragment ${f} of ${this.playlistLabel()} ${u}. The current chunk will not be buffered.`),null;const v=r[u],y=v.details,E=c>-1?aI(y,f,c):null,A=E?E.fragment:sI(y,f,s);return A?(s&&s!==A&&(A.stats=s.stats),{frag:A,part:E,level:v}):null}bufferFragmentData(t,r,s,u,f){var c;if(!t||this.state!==lu)return;const{data1:v,data2:y}=t;let E=v;if(v&&y&&(E=Na(v,y)),(c=E)==null||!c.length)return;const A={type:t.type,frag:r,part:s,chunkMeta:u,parent:r.type,data:E};if(this.hls.trigger(G.BUFFER_APPENDING,A),t.dropped&&t.independent&&!s){if(f)return;this.flushBufferGap(r)}}flushBufferGap(t){const r=this.media;if(!r)return;if(!bn.isBuffered(r,r.currentTime))return void this.flushMainBuffer(0,t.start);const s=r.currentTime,u=bn.bufferInfo(r,s,0),f=t.duration,c=Math.min(2*this.config.maxFragLookUpTolerance,.25*f),v=Math.max(Math.min(t.start-c,u.end-c),s+c);t.start-v>c&&this.flushMainBuffer(v,t.start)}getFwdBufferInfo(t,r){var s;const u=this.getLoadPosition();if(!vt(u))return null;const f=this.lastCurrentTime>u||(s=this.media)!=null&&s.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(t,u,r,f)}getFwdBufferInfoAtPos(t,r,s,u){const f=bn.bufferInfo(t,r,u);if(f.len===0&&f.nextStart!==void 0){const c=this.fragmentTracker.getBufferedFrag(r,s);if(c&&(f.nextStart<=c.end||c.gap)){const v=Math.max(Math.min(f.nextStart,c.end)-r,u);return bn.bufferInfo(t,r,v)}}return f}getMaxBufferLength(t){const{config:r}=this;let s;return s=t?Math.max(8*r.maxBufferSize/t,r.maxBufferLength):r.maxBufferLength,Math.min(s,r.maxMaxBufferLength)}reduceMaxBufferLength(t,r){const s=this.config,u=Math.max(Math.min(t-r,s.maxBufferLength),r),f=Math.max(t-3*r,s.maxMaxBufferLength/2,u);return f>=u&&(s.maxMaxBufferLength=f,this.warn(`Reduce max buffer length to ${f}s`),!0)}getAppendedFrag(t,r=On){var s;const u=(s=this.fragmentTracker)==null?void 0:s.getAppendedFrag(t,r);return u&&"fragment"in u?u.fragment:u}getNextFragment(t,r){const s=r.fragments,u=s.length;if(!u)return null;const{config:f}=this,c=s[0].start,v=f.lowLatencyMode&&!!r.partList;let y=null;if(r.live){const L=f.initialLiveManifestSize;if(u<L)return this.warn(`Not enough fragments to start playback (have: ${u}, need: ${L})`),null;if(!r.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||t<c){var E;v&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),y=this.getInitialLiveFragment(r,s);const T=this.hls.startPosition,M=this.hls.liveSyncPosition,O=y?(T!==-1&&T>=c?T:M)||y.start:t;this.log(`Setting startPosition to ${O} to match start frag at live edge. mainStart: ${T} liveSyncPosition: ${M} frag.start: ${(E=y)==null?void 0:E.start}`),this.startPosition=this.nextLoadPosition=O}}else t<=c&&(y=s[0]);if(!y){const L=this.loadingParts?r.partEnd:r.fragmentEnd;y=this.getFragmentAtPosition(t,L,r)}let A=this.filterReplacedPrimary(y,r);if(!A&&y){const L=y.sn-r.startSN;A=this.filterReplacedPrimary(s[L+1]||null,r)}return this.mapToInitFragWhenRequired(A)}isLoopLoading(t,r){const s=this.fragmentTracker.getState(t);return(s===Ff||s===_f&&!!t.gap)&&this.nextLoadPosition>r}getNextFragmentLoopLoading(t,r,s,u,f){let c=null;if(t.gap&&(c=this.getNextFragment(this.nextLoadPosition,r),c&&!c.gap&&s.nextStart)){const v=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,s.nextStart,u,0);if(v!==null&&s.len+v.len>=f){const y=c.sn;return this.loopSn!==y&&(this.log(`buffer full after gaps in "${u}" playlist starting at sn: ${y}`),this.loopSn=y),null}}return this.loopSn=void 0,c}get primaryPrefetch(){if(hI(this.hls.config)){var t,r;if(!((t=this.hls.interstitialsManager)==null||(r=t.playingItem)==null)&&r.event)return!0}return!1}filterReplacedPrimary(t,r){if(!t)return t;if(hI(this.hls.config)&&t.type!==Eo){const s=this.hls.interstitialsManager,u=s==null?void 0:s.bufferingItem;if(u){const c=u.event;if(c){if(c.appendInPlace||Math.abs(t.start-u.start)>1||u.start===0)return null}else if(t.end<=u.start&&(r==null?void 0:r.live)===!1||t.start>u.end&&u.nextEvent&&(u.nextEvent.appendInPlace||t.start-u.end>1))return null}const f=s==null?void 0:s.playerQueue;if(f)for(let c=f.length;c--;){const v=f[c].interstitial;if(v.appendInPlace&&t.start>=v.startTime&&t.end<=v.resumeTime)return null}}return t}mapToInitFragWhenRequired(t){return t==null||!t.initSegment||t!=null&&t.initSegment.data||this.bitrateTest?t:t.initSegment}getNextPart(t,r,s){let u=-1,f=!1,c=!0;for(let v=0,y=t.length;v<y;v++){const E=t[v];if(c=c&&!E.independent,u>-1&&s<E.start)break;const A=E.loaded;A?u=-1:(f||E.independent||c)&&E.fragment===r&&(u=v),f=A}return u}loadedEndOfParts(t,r){const s=t[t.length-1];return s&&r>s.start&&s.loaded}getInitialLiveFragment(t,r){const s=this.fragPrevious;let u=null;if(s){if(t.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${s.programDateTime}`),u=function(f,c,v){if(c===null||!Array.isArray(f)||!f.length||!vt(c)||c<(f[0].programDateTime||0)||c>=(f[f.length-1].endProgramDateTime||0))return null;v=v||0;for(let y=0;y<f.length;++y){const E=f[y];if(EM(c,v,E))return E}return null}(r,s.endProgramDateTime,this.config.maxFragLookUpTolerance)),!u){const f=s.sn+1;if(f>=t.startSN&&f<=t.endSN){const c=r[f-t.startSN];s.cc===c.cc&&(u=c,this.log(`Live playlist, switching playlist, load frag with next SN: ${u.sn}`))}u||(u=kx(r,s.cc),u&&this.log(`Live playlist, switching playlist, load frag with same CC: ${u.sn}`))}}else{const f=this.hls.liveSyncPosition;f!==null&&(u=this.getFragmentAtPosition(f,this.bitrateTest?t.fragmentEnd:t.edge,t))}return u}getFragmentAtPosition(t,r,s){const{config:u}=this;let{fragPrevious:f}=this,{fragments:c,endSN:v}=s;const{fragmentHint:y}=s,{maxFragLookUpTolerance:E}=u,A=s.partList,L=!!(this.loadingParts&&A!=null&&A.length&&y);let T;if(L&&y&&!this.bitrateTest&&A[A.length-1].fragment.sn===y.sn&&(c=c.concat(y),v=y.sn),t<r){var M;T=Qd(f,c,t,t<this.lastCurrentTime||t>r-E||(M=this.media)!=null&&M.paused||!this.startFragRequested?0:E)}else T=c[c.length-1];if(T){const O=T.sn-s.startSN,U=this.fragmentTracker.getState(T);if((U===Ff||U===_f&&T.gap)&&(f=T),f&&T.sn===f.sn&&(!L||A[0].fragment.sn>T.sn||!s.live&&!L)&&f&&T.level===f.level){const $=c[O+1];T=T.sn<v&&this.fragmentTracker.getState($)!==Ff?$:null}}return T}alignPlaylists(t,r,s){const u=t.fragments.length;if(!u)return this.warn("No fragments in live playlist"),0;const f=t.fragmentStart,c=!r,v=t.alignedSliding&&vt(f);if(c||!v&&!f){(function(E,A){E&&(dI(A,E),!A.alignedSliding&&E&&x0(A,E),A.alignedSliding||!E||A.skippedSegments||rI(E,A,!1))})(s,t);const y=t.fragmentStart;return this.log(`Live playlist sliding: ${y.toFixed(2)} start-sn: ${r?r.startSN:"na"}->${t.startSN} fragments: ${u}`),y}return f}waitForCdnTuneIn(t){return t.live&&t.canBlockReload&&t.partTarget&&t.tuneInGoal>Math.max(t.partHoldBack,3*t.partTarget)}setStartPosition(t,r){let s=this.startPosition;s<r&&(s=-1);const u=this.timelineOffset;if(s===-1){const f=this.startTimeOffset!==null,c=f?this.startTimeOffset:t.startTimeOffset;c!==null&&vt(c)?(s=r+c,c<0&&(s+=t.edge),s=Math.min(Math.max(r,s),r+t.totalduration),this.log(`Setting startPosition to ${s} for start time offset ${c} found in ${f?"multivariant":"media"} playlist`),this.startPosition=s):t.live?(s=this.hls.liveSyncPosition||r,this.log(`Setting startPosition to -1 to start at live edge ${s}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=s=0),this.lastCurrentTime=s+u}this.nextLoadPosition=s+u}getLoadPosition(){var t;const{media:r}=this;let s=0;return(t=this.hls)!=null&&t.hasEnoughToStart&&r?s=r.currentTime:this.nextLoadPosition>=0&&(s=this.nextLoadPosition),s}handleFragLoadAborted(t,r){this.transmuxer&&t.type===this.playlistType&&xi(t)&&t.stats.aborted&&(this.warn(`Fragment ${t.sn}${r?" part "+r.index:""} of ${this.playlistLabel()} ${t.level} was aborted`),this.resetFragmentLoading(t))}resetFragmentLoading(t){this.fragCurrent&&(this.fragContextChanged(t)||this.state===jf)||(this.state=En)}onFragmentOrKeyLoadError(t,r){if(r.chunkMeta&&!r.frag){const O=this.getCurrentContext(r.chunkMeta);O&&(r.frag=O.frag)}const s=r.frag;if(!s||s.type!==t||!this.levels)return;var u;if(this.fragContextChanged(s))return void this.warn(`Frag load error must match current frag to retry ${s.url} > ${(u=this.fragCurrent)==null?void 0:u.url}`);const f=r.details===Me.FRAG_GAP;f&&this.fragmentTracker.fragBuffered(s,!0);const c=r.errorAction,{action:v,flags:y,retryCount:E=0,retryConfig:A}=c||{},L=!!c&&!!A,T=L&&v===v0,M=L&&!c.resolved&&y===b0;if(!T&&M&&xi(s)&&!s.endList)this.resetFragmentErrors(t),this.treatAsGap(s),c.resolved=!0;else if((T||M)&&E<A.maxNumRetry){this.resetStartWhenNotLoaded(this.levelLastLoaded);const O=GE(A,E);this.warn(`Fragment ${s.sn} of ${t} ${s.level} errored with ${r.details}, retrying loading ${E+1}/${A.maxNumRetry} in ${O}ms`),c.resolved=!0,this.retryDate=self.performance.now()+O,this.state=jf}else if(A&&c){if(this.resetFragmentErrors(t),!(E<A.maxNumRetry))return void this.warn(`${r.details} reached or exceeded max retry (${E})`);f||v===TM||(c.resolved=!0)}else this.state=v===su?Jd:Xd;this.tickImmediate()}reduceLengthAndFlushBuffer(t){if(this.state===lu||this.state===I0){const r=t.frag,s=t.parent,u=this.getFwdBufferInfo(this.mediaBuffer,s),f=u&&u.len>.5;f&&this.reduceMaxBufferLength(u.len,(r==null?void 0:r.duration)||10);const c=!f;return c&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${s} buffer`),r&&(this.fragmentTracker.removeFragment(r),this.nextLoadPosition=r.start),this.resetLoadingState(),c}return!1}resetFragmentErrors(t){t===_s&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==ri&&(this.state=En)}afterBufferFlushed(t,r,s){if(!t)return;const u=bn.getBuffered(t);this.fragmentTracker.detectEvictedFragments(r,u,s),this.state===Hf&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==ri&&(this.state=En)}resetStartWhenNotLoaded(t){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const r=t?t.details:null;r!=null&&r.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(r,r.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(t){this.warn(`The loading context changed while buffering fragment ${t.sn} of ${this.playlistLabel()} ${t.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(t=0){this.fragmentTracker.removeFragmentsInRange(t,1/0,this.playlistType,!1,!0)}updateLevelTiming(t,r,s,u){const f=s.details;if(!f)return void this.warn("level.details undefined");var c;if(!Object.keys(t.elementaryStreams).reduce((v,y)=>{const E=t.elementaryStreams[y];if(E){const A=E.endPTS-E.startPTS;if(A<=0)return this.warn(`Could not parse fragment ${t.sn} ${y} duration reliably (${A})`),v||!1;const L=u?0:tI(f,t,E.startPTS,E.endPTS,E.startDTS,E.endDTS);return this.hls.trigger(G.LEVEL_PTS_UPDATED,{details:f,level:s,drift:L,type:y,frag:t,start:E.startPTS,end:E.endPTS}),!0}return v},!1)&&(s.fragmentError===0&&this.treatAsGap(t,s),((c=this.transmuxer)==null?void 0:c.error)===null)){const v=new Error(`Found no media in fragment ${t.sn} of ${this.playlistLabel()} ${t.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(v.message),this.hls.trigger(G.ERROR,{type:Mt.MEDIA_ERROR,details:Me.FRAG_PARSING_ERROR,fatal:!1,error:v,frag:t,reason:`Found no media in msn ${t.sn} of ${this.playlistLabel()} "${s.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=I0,this.log(`Parsed ${t.type} sn: ${t.sn}${r?" part: "+r.index:""} of ${this.fragInfo(t,!1,r)})`),this.hls.trigger(G.FRAG_PARSED,{frag:t,part:r})}playlistLabel(){return this.playlistType===On?"level":"track"}fragInfo(t,r=!0,s){var u,f;return`${this.playlistLabel()} ${t.level} (${s?"part":"frag"}:[${((u=r&&!s?t.startPTS:(s||t).start)!=null?u:NaN).toFixed(3)}-${((f=r&&!s?t.endPTS:(s||t).end)!=null?f:NaN).toFixed(3)}]${s&&t.type==="main"?"INDEPENDENT="+(s.independent?"YES":"NO"):""}`}treatAsGap(t,r){r&&r.fragmentError++,t.gap=!0,this.fragmentTracker.removeFragment(t),this.fragmentTracker.fragBuffered(t,!0)}resetTransmuxer(){var t;(t=this.transmuxer)==null||t.reset()}recoverWorkerError(t){t.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(t){const r=this.Nn;r!==t&&(this.Nn=t,this.log(`${r}->${t}`))}get state(){return this.Nn}}function hI(a){return!!a.interstitialsController&&a.enableInterstitialPlayback!==!1}class fI{constructor(){this.chunks=[],this.dataLength=0}push(t){this.chunks.push(t),this.dataLength+=t.length}flush(){const{chunks:t,dataLength:r}=this;let s;return t.length?(s=t.length===1?t[0]:function(u,f){const c=new Uint8Array(f);let v=0;for(let y=0;y<u.length;y++){const E=u[y];c.set(E,v),v+=E.length}return c}(t,r),this.reset(),s):new Uint8Array(0)}reset(){this.chunks.length=0,this.dataLength=0}}var pI,gI={exports:{}},jM=(pI||(pI=1,function(a){var t=Object.prototype.hasOwnProperty,r="~";function s(){}function u(y,E,A){this.fn=y,this.context=E,this.once=A||!1}function f(y,E,A,L,T){if(typeof A!="function")throw new TypeError("The listener must be a function");var M=new u(A,L||y,T),O=r?r+E:E;return y.$n[O]?y.$n[O].fn?y.$n[O]=[y.$n[O],M]:y.$n[O].push(M):(y.$n[O]=M,y.Yr++),y}function c(y,E){--y.Yr==0?y.$n=new s:delete y.$n[E]}function v(){this.$n=new s,this.Yr=0}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(r=!1)),v.prototype.eventNames=function(){var y,E,A=[];if(this.Yr===0)return A;for(E in y=this.$n)t.call(y,E)&&A.push(r?E.slice(1):E);return Object.getOwnPropertySymbols?A.concat(Object.getOwnPropertySymbols(y)):A},v.prototype.listeners=function(y){var E=r?r+y:y,A=this.$n[E];if(!A)return[];if(A.fn)return[A.fn];for(var L=0,T=A.length,M=new Array(T);L<T;L++)M[L]=A[L].fn;return M},v.prototype.listenerCount=function(y){var E=r?r+y:y,A=this.$n[E];return A?A.fn?1:A.length:0},v.prototype.emit=function(y,E,A,L,T,M){var O=r?r+y:y;if(!this.$n[O])return!1;var U,$,z=this.$n[O],Q=arguments.length;if(z.fn){switch(z.once&&this.removeListener(y,z.fn,void 0,!0),Q){case 1:return z.fn.call(z.context),!0;case 2:return z.fn.call(z.context,E),!0;case 3:return z.fn.call(z.context,E,A),!0;case 4:return z.fn.call(z.context,E,A,L),!0;case 5:return z.fn.call(z.context,E,A,L,T),!0;case 6:return z.fn.call(z.context,E,A,L,T,M),!0}for($=1,U=new Array(Q-1);$<Q;$++)U[$-1]=arguments[$];z.fn.apply(z.context,U)}else{var Z,ie=z.length;for($=0;$<ie;$++)switch(z[$].once&&this.removeListener(y,z[$].fn,void 0,!0),Q){case 1:z[$].fn.call(z[$].context);break;case 2:z[$].fn.call(z[$].context,E);break;case 3:z[$].fn.call(z[$].context,E,A);break;case 4:z[$].fn.call(z[$].context,E,A,L);break;default:if(!U)for(Z=1,U=new Array(Q-1);Z<Q;Z++)U[Z-1]=arguments[Z];z[$].fn.apply(z[$].context,U)}}return!0},v.prototype.on=function(y,E,A){return f(this,y,E,A,!1)},v.prototype.once=function(y,E,A){return f(this,y,E,A,!0)},v.prototype.removeListener=function(y,E,A,L){var T=r?r+y:y;if(!this.$n[T])return this;if(!E)return c(this,T),this;var M=this.$n[T];if(M.fn)M.fn!==E||L&&!M.once||A&&M.context!==A||c(this,T);else{for(var O=0,U=[],$=M.length;O<$;O++)(M[O].fn!==E||L&&!M[O].once||A&&M[O].context!==A)&&U.push(M[O]);U.length?this.$n[T]=U.length===1?U[0]:U:c(this,T)}return this},v.prototype.removeAllListeners=function(y){var E;return y?(E=r?r+y:y,this.$n[E]&&c(this,E)):(this.$n=new s,this.Yr=0),this},v.prototype.off=v.prototype.removeListener,v.prototype.addListener=v.prototype.on,v.prefixed=r,v.EventEmitter=v,a.exports=v}(gI)),gI.exports),oT=sM(jM);const Sm="1.6.2",Vf={};function mI(a,t){return t+10<=a.length&&a[t]===51&&a[t+1]===68&&a[t+2]===73&&a[t+3]<255&&a[t+4]<255&&a[t+6]<128&&a[t+7]<128&&a[t+8]<128&&a[t+9]<128}function lT(a,t){return t+10<=a.length&&a[t]===73&&a[t+1]===68&&a[t+2]===51&&a[t+3]<255&&a[t+4]<255&&a[t+6]<128&&a[t+7]<128&&a[t+8]<128&&a[t+9]<128}function L0(a,t){let r=0;return r=(127&a[t])<<21,r|=(127&a[t+1])<<14,r|=(127&a[t+2])<<7,r|=127&a[t+3],r}function wm(a,t){const r=t;let s=0;for(;lT(a,t);)s+=10,s+=L0(a,t+6),mI(a,t+10)&&(s+=10),t+=s;if(s>0)return a.subarray(r,r+s)}function yI(a,t){return a[t]===255&&(246&a[t+1])==240}function vI(a,t){return 1&a[t+1]?7:9}function uT(a,t){return(3&a[t+3])<<11|a[t+4]<<3|(224&a[t+5])>>>5}function R0(a,t){return t+1<a.length&&yI(a,t)}function GM(a,t){if(R0(a,t)){const r=vI(a,t);if(t+r>=a.length)return!1;const s=uT(a,t);if(s<=r)return!1;const u=t+s;return u===a.length||R0(a,u)}return!1}function bI(a,t,r,s,u){if(!a.samplerate){const f=function(c,v,y,E){const A=v[y+2],L=A>>2&15;if(L>12){const Q=new Error(`invalid ADTS sampling index:${L}`);return void c.emit(G.ERROR,G.ERROR,{type:Mt.MEDIA_ERROR,details:Me.FRAG_PARSING_ERROR,fatal:!0,error:Q,reason:Q.message})}const T=1+(A>>6&3),M=v[y+3]>>6&3|(1&A)<<2,O="mp4a.40."+T,U=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350][L];let $=L;T!==5&&T!==29||($-=3);const z=[T<<3|(14&$)>>1,(1&$)<<7|M<<3];return Hn.log(`manifest codec:${E}, parsed codec:${O}, channels:${M}, rate:${U} (ADTS object type:${T} sampling index:${L})`),{config:z,samplerate:U,channelCount:M,codec:O,parsedCodec:O,manifestCodec:E}}(t,r,s,u);if(!f)return;cr(a,f)}}function EI(a){return 9216e4/a}function TI(a,t,r,s,u){const f=s+u*EI(a.samplerate),c=function(E,A){const L=vI(E,A);if(A+L<=E.length){const T=uT(E,A)-L;if(T>0)return{headerLength:L,frameLength:T}}}(t,r);let v;if(c){const{frameLength:E,headerLength:A}=c,L=A+E,T=Math.max(0,r+L-t.length);T?(v=new Uint8Array(L-A),v.set(t.subarray(r+A,t.length),0)):v=t.subarray(r+A,r+L);const M={unit:v,pts:f};return T||a.samples.push(M),{sample:M,length:L,missing:T}}const y=t.length-r;return v=new Uint8Array(y),v.set(t.subarray(r,t.length),0),{sample:{unit:v,pts:f},length:y,missing:-1}}function HM(a,t){return lT(a,t)&&L0(a,t+6)+10<=a.length-t}function SI(a,t){if(a<0)return-SI(-a,t);const r=Math.pow(10,t);if(Math.abs(a*r%1-.5)<Number.EPSILON){const s=Math.floor(a*r);return(s%2==0?s:s+1)/r}return Math.round(a*r)/r}function cT(a,t=0,r=1/0){return function(s,u,f,c){const v=function(U){return U instanceof ArrayBuffer?U:U.buffer}(s);let y=1;"BYTES_PER_ELEMENT"in c&&(y=c.BYTES_PER_ELEMENT);const E=(O=s,O&&O.buffer instanceof ArrayBuffer&&O.byteLength!==void 0&&O.byteOffset!==void 0?s.byteOffset:0),A=(E+s.byteLength)/y,L=(E+u)/y,T=Math.floor(Math.max(0,Math.min(L,A))),M=Math.floor(Math.min(T+Math.max(f,0),A));var O;return new c(v,T,M-T)}(a,t,r,Uint8Array)}function VM(a){const t={key:a.type,description:"",data:"",mimeType:null,pictureType:null};if(a.size<2||a.data[0]!==3)return;const r=a.data.subarray(1).indexOf(0);if(r===-1)return;const s=ca(cT(a.data,1,r)),u=a.data[2+r],f=a.data.subarray(3+r).indexOf(0);if(f===-1)return;const c=ca(cT(a.data,3+r,f));let v;return v=s==="-->"?ca(cT(a.data,4+r+f)):function(y){return y instanceof ArrayBuffer?y:y.byteOffset==0&&y.byteLength==y.buffer.byteLength?y.buffer:new Uint8Array(y).buffer}(a.data.subarray(4+r+f)),t.mimeType=s,t.pictureType=u,t.description=c,t.data=v,t}function KM(a){return a.type==="PRIV"?function(t){if(t.size<2)return;const r=ca(t.data,!0),s=new Uint8Array(t.data.subarray(r.length+1));return{key:t.type,info:r,data:s.buffer}}(a):a.type[0]==="W"?function(t){if(t.type==="WXXX"){if(t.size<2)return;let s=1;const u=ca(t.data.subarray(s),!0);s+=u.length+1;const f=ca(t.data.subarray(s));return{key:t.type,info:u,data:f}}const r=ca(t.data);return{key:t.type,info:"",data:r}}(a):a.type==="APIC"?VM(a):function(t){if(t.size<2)return;if(t.type==="TXXX"){let s=1;const u=ca(t.data.subarray(s),!0);s+=u.length+1;const f=ca(t.data.subarray(s));return{key:t.type,info:u,data:f}}const r=ca(t.data.subarray(1));return{key:t.type,info:"",data:r}}(a)}function zM(a){const t=String.fromCharCode(a[0],a[1],a[2],a[3]),r=L0(a,4);return{type:t,size:r,data:a.subarray(10,10+r)}}function wI(a){let t=0;const r=[];for(;lT(a,t);){const s=L0(a,t+6);a[t+5]>>6&1&&(t+=10),t+=10;const u=t+s;for(;t+10<u;){const f=zM(a.subarray(t)),c=KM(f);c&&r.push(c),t+=f.size+10}mI(a,t)&&(t+=10)}return r}function AI(a){return a&&a.key==="PRIV"&&a.info==="com.apple.streaming.transportStreamTimestamp"}function qM(a){if(a.data.byteLength===8){const t=new Uint8Array(a.data),r=1&t[3];let s=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return s/=45,r&&(s+=4772185884e-2),Math.round(s)}}function dT(a){const t=wI(a);for(let r=0;r<t.length;r++){const s=t[r];if(AI(s))return qM(s)}}let da=function(a){return a.audioId3="org.id3",a.dateRange="com.apple.quicktime.HLS",a.emsg="https://aomedia.org/emsg/ID3",a.misbklv="urn:misb:KLV:bin:1910.1",a}({});function cl(a="",t=9e4){return{type:a,id:-1,pid:-1,inputTimeScale:t,sequenceNumber:-1,samples:[],dropped:0}}class hT{constructor(){this.Qr=void 0,this.Jr=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(t,r,s,u){this.Jr={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(t){this.initPTS=t,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(t,r){return!1}appendFrame(t,r,s){}demux(t,r){this.cachedData&&(t=Na(this.cachedData,t),this.cachedData=null);let s,u=wm(t,0),f=u?u.length:0;const c=this.Qr,v=this.Jr,y=u?dT(u):void 0,E=t.length;for((this.basePTS===null||this.frameIndex===0&&vt(y))&&(this.basePTS=WM(y,r,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),u&&u.length>0&&v.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:u,type:da.audioId3,duration:Number.POSITIVE_INFINITY});f<E;){if(this.canParse(t,f)){const A=this.appendFrame(c,t,f);A?(this.frameIndex++,this.lastPTS=A.sample.pts,f+=A.length,s=f):f=E}else HM(t,f)?(u=wm(t,f),v.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:u,type:da.audioId3,duration:Number.POSITIVE_INFINITY}),f+=u.length,s=f):f++;if(f===E&&s!==E){const A=t.slice(s);this.cachedData?this.cachedData=Na(this.cachedData,A):this.cachedData=A}}return{audioTrack:c,videoTrack:cl(),id3Track:v,textTrack:cl()}}demuxSampleAes(t,r,s){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(t){const r=this.cachedData;return r&&(this.cachedData=null,this.demux(r,0)),{audioTrack:this.Qr,videoTrack:cl(),id3Track:this.Jr,textTrack:cl()}}destroy(){this.cachedData=null,this.Qr=this.Jr=void 0}}const WM=(a,t,r)=>vt(a)?90*a:9e4*t+(r?9e4*r.baseTime/r.timescale:0);let C0=null;const YM=[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],QM=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],XM=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],JM=[0,1,1,4];function kI(a,t,r,s,u){if(r+24>t.length)return;const f=xI(t,r);if(f&&r+f.frameLength<=t.length){const c=s+u*(9e4*f.samplesPerFrame/f.sampleRate),v={unit:t.subarray(r,r+f.frameLength),pts:c,dts:c};return a.config=[],a.channelCount=f.channelCount,a.samplerate=f.sampleRate,a.samples.push(v),{sample:v,length:f.frameLength,missing:0}}}function xI(a,t){const r=a[t+1]>>3&3,s=a[t+1]>>1&3,u=a[t+2]>>4&15,f=a[t+2]>>2&3;if(r!==1&&u!==0&&u!==15&&f!==3){const c=a[t+2]>>1&1,v=a[t+3]>>6,y=1e3*YM[14*(r===3?3-s:s===3?3:4)+u-1],E=QM[3*(r===3?0:r===2?1:2)+f],A=v===3?1:2,L=XM[r][s],T=JM[s],M=8*L*T,O=Math.floor(L*y/E+c)*T;if(C0===null){const U=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);C0=U?parseInt(U[1]):0}return C0&&C0<=87&&s===2&&y>=224e3&&v===0&&(a[t+3]=128|a[t+3]),{sampleRate:E,channelCount:A,frameLength:O,samplesPerFrame:M}}}function fT(a,t){return!(a[t]!==255||224&~a[t+1]||!(6&a[t+1]))}function II(a,t){return t+1<a.length&&fT(a,t)}function LI(a,t){if(t+1<a.length&&fT(a,t)){const s=xI(a,t);let u=4;s!=null&&s.frameLength&&(u=s.frameLength);const f=t+u;return f===a.length||II(a,f)}return!1}const RI=(a,t)=>{let r=0,s=5;t+=s;const u=new Uint32Array(1),f=new Uint32Array(1),c=new Uint8Array(1);for(;s>0;){c[0]=a[t];const v=Math.min(s,8),y=8-v;f[0]=4278190080>>>24+y<<y,u[0]=(c[0]&f[0])>>y,r=r?r<<v|u[0]:u[0],t+=1,s-=v}return r};class ZM extends hT{constructor(t){super(),this.observer=void 0,this.observer=t}resetInitSegment(t,r,s,u){super.resetInitSegment(t,r,s,u),this.Qr={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:r,duration:u,inputTimeScale:9e4,dropped:0}}canParse(t,r){return r+64<t.length}appendFrame(t,r,s){const u=CI(t,r,s,this.basePTS,this.frameIndex);if(u!==-1)return{sample:t.samples[t.samples.length-1],length:u,missing:0}}static probe(t){if(!t)return!1;const r=wm(t,0);if(!r)return!1;const s=r.length;return t[s]===11&&t[s+1]===119&&dT(r)!==void 0&&RI(t,s)<16}}function CI(a,t,r,s,u){if(r+8>t.length||t[r]!==11||t[r+1]!==119)return-1;const f=t[r+4]>>6;if(f>=3)return-1;const c=[48e3,44100,32e3][f],v=63&t[r+4],y=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*v+f];if(r+y>t.length)return-1;const E=t[r+6]>>5;let A=0;E===2?A+=2:(1&E&&E!==1&&(A+=2),4&E&&(A+=2));const L=(t[r+6]<<8|t[r+7])>>12-A&1,T=[2,1,2,3,3,4,4,5][E]+L,M=t[r+5]>>3,O=7&t[r+5],U=new Uint8Array([f<<6|M<<1|O>>2,(3&O)<<6|E<<3|L<<2|v>>4,v<<4&224]),$=s+u*(1536/c*9e4),z=t.subarray(r,r+y);return a.config=U,a.channelCount=T,a.samplerate=c,a.samples.push({unit:z,pts:$}),y}const eO=/\/emsg[-/]ID3/i;function DI(a,t){return vt(a.presentationTime)?a.presentationTime/a.timeScale:t+a.presentationTimeDelta/a.timeScale}class tO{constructor(t,r,s){this.keyData=void 0,this.decrypter=void 0,this.keyData=s,this.decrypter=new VE(r,{removePKCS7Padding:!1})}decryptBuffer(t){return this.decrypter.decrypt(t,this.keyData.key.buffer,this.keyData.iv.buffer,vm)}decryptAacSample(t,r,s){const u=t[r].unit;if(u.length<=16)return;const f=u.subarray(16,u.length-u.length%16),c=f.buffer.slice(f.byteOffset,f.byteOffset+f.length);this.decryptBuffer(c).then(v=>{const y=new Uint8Array(v);u.set(y,16),this.decrypter.isSync()||this.decryptAacSamples(t,r+1,s)})}decryptAacSamples(t,r,s){for(;;r++){if(r>=t.length)return void s();if(!(t[r].unit.length<32)&&(this.decryptAacSample(t,r,s),!this.decrypter.isSync()))return}}getAvcEncryptedData(t){const r=16*Math.floor((t.length-48)/160)+16,s=new Int8Array(r);let u=0;for(let f=32;f<t.length-16;f+=160,u+=16)s.set(t.subarray(f,f+16),u);return s}getAvcDecryptedUnit(t,r){const s=new Uint8Array(r);let u=0;for(let f=32;f<t.length-16;f+=160,u+=16)t.set(s.subarray(u,u+16),f);return t}decryptAvcSample(t,r,s,u,f){const c=ax(f.data),v=this.getAvcEncryptedData(c);this.decryptBuffer(v.buffer).then(y=>{f.data=this.getAvcDecryptedUnit(c,y),this.decrypter.isSync()||this.decryptAvcSamples(t,r,s+1,u)})}decryptAvcSamples(t,r,s,u){if(t instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;r++,s=0){if(r>=t.length)return void u();const f=t[r].units;for(;!(s>=f.length);s++){const c=f[s];if(!(c.data.length<=48||c.type!==1&&c.type!==5||(this.decryptAvcSample(t,r,s,u,c),this.decrypter.isSync())))return}}}}class PI{constructor(){this.VideoSample=null}createVideoSample(t,r,s){return{key:t,frame:!1,pts:r,dts:s,units:[],length:0}}getLastNalUnit(t){var r;let s,u=this.VideoSample;if(u&&u.units.length!==0||(u=t[t.length-1]),(r=u)!=null&&r.units){const f=u.units;s=f[f.length-1]}return s}pushAccessUnit(t,r){if(t.units.length&&t.frame){if(t.pts===void 0){const s=r.samples,u=s.length;if(!u)return void r.dropped++;{const f=s[u-1];t.pts=f.pts,t.dts=f.dts}}r.samples.push(t)}}parseNALu(t,r,s){const u=r.byteLength;let f=t.naluState||0;const c=f,v=[];let y,E,A,L=0,T=-1,M=0;for(f===-1&&(T=0,M=this.getNALuType(r,0),f=0,L=1);L<u;)if(y=r[L++],f)if(f!==1)if(y)if(y===1){if(E=L-f-1,T>=0){const O={data:r.subarray(T,E),type:M};v.push(O)}else{const O=this.getLastNalUnit(t.samples);O&&(c&&L<=4-c&&O.state&&(O.data=O.data.subarray(0,O.data.byteLength-c)),E>0&&(O.data=Na(O.data,r.subarray(0,E)),O.state=0))}L<u?(A=this.getNALuType(r,L),T=L,M=A,f=0):f=-1}else f=0;else f=3;else f=y?0:2;else f=y?0:1;if(T>=0&&f>=0){const O={data:r.subarray(T,u),type:M,state:f};v.push(O)}if(v.length===0){const O=this.getLastNalUnit(t.samples);O&&(O.data=Na(O.data,r))}return t.naluState=f,v}}class Am{constructor(t){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=t,this.bytesAvailable=t.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const t=this.data,r=this.bytesAvailable,s=t.byteLength-r,u=new Uint8Array(4),f=Math.min(4,r);if(f===0)throw new Error("no bytes available");u.set(t.subarray(s,s+f)),this.word=new DataView(u.buffer).getUint32(0),this.bitsAvailable=8*f,this.bytesAvailable-=f}skipBits(t){let r;t=Math.min(t,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>t?(this.word<<=t,this.bitsAvailable-=t):(r=(t-=this.bitsAvailable)>>3,t-=r<<3,this.bytesAvailable-=r,this.loadWord(),this.word<<=t,this.bitsAvailable-=t)}readBits(t){let r=Math.min(this.bitsAvailable,t);const s=this.word>>>32-r;if(t>32&&Hn.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=r,this.bitsAvailable>0)this.word<<=r;else{if(!(this.bytesAvailable>0))throw new Error("no bits available");this.loadWord()}return r=t-r,r>0&&this.bitsAvailable?s<<r|this.readBits(r):s}skipLZ(){let t;for(t=0;t<this.bitsAvailable;++t)if(this.word&2147483648>>>t)return this.word<<=t,this.bitsAvailable-=t,t;return this.loadWord(),t+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const t=this.skipLZ();return this.readBits(t+1)-1}readEG(){const t=this.readUEG();return 1&t?1+t>>>1:-1*(t>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}}class MI extends PI{parsePES(t,r,s,u){const f=this.parseNALu(t,s.data,u);let c,v=this.VideoSample,y=!1;s.data=null,v&&f.length&&!t.audFound&&(this.pushAccessUnit(v,t),v=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts)),f.forEach(E=>{var A,L;switch(E.type){case 1:{let U=!1;c=!0;const $=E.data;if(y&&$.length>4){const z=this.readSliceType($);z!==2&&z!==4&&z!==7&&z!==9||(U=!0)}var T;U&&(T=v)!=null&&T.frame&&!v.key&&(this.pushAccessUnit(v,t),v=this.VideoSample=null),v||(v=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),v.frame=!0,v.key=U;break}case 5:c=!0,(A=v)!=null&&A.frame&&!v.key&&(this.pushAccessUnit(v,t),v=this.VideoSample=null),v||(v=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),v.key=!0,v.frame=!0;break;case 6:c=!0,FE(E.data,1,s.pts,r.samples);break;case 7:{var M,O;c=!0,y=!0;const U=E.data,$=this.readSPS(U);if(!t.sps||t.width!==$.width||t.height!==$.height||((M=t.pixelRatio)==null?void 0:M[0])!==$.pixelRatio[0]||((O=t.pixelRatio)==null?void 0:O[1])!==$.pixelRatio[1]){t.width=$.width,t.height=$.height,t.pixelRatio=$.pixelRatio,t.sps=[U];const z=U.subarray(1,4);let Q="avc1.";for(let Z=0;Z<3;Z++){let ie=z[Z].toString(16);ie.length<2&&(ie="0"+ie),Q+=ie}t.codec=Q}break}case 8:c=!0,t.pps=[E.data];break;case 9:c=!0,t.audFound=!0,(L=v)!=null&&L.frame&&(this.pushAccessUnit(v,t),v=null),v||(v=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts));break;case 12:c=!0;break;default:c=!1}v&&c&&v.units.push(E)}),u&&v&&(this.pushAccessUnit(v,t),this.VideoSample=null)}getNALuType(t,r){return 31&t[r]}readSliceType(t){const r=new Am(t);return r.readUByte(),r.readUEG(),r.readUEG()}skipScalingList(t,r){let s,u=8,f=8;for(let c=0;c<t;c++)f!==0&&(s=r.readEG(),f=(u+s+256)%256),u=f===0?u:f}readSPS(t){const r=new Am(t);let s,u,f,c=0,v=0,y=0,E=0;const A=r.readUByte.bind(r),L=r.readBits.bind(r),T=r.readUEG.bind(r),M=r.readBoolean.bind(r),O=r.skipBits.bind(r),U=r.skipEG.bind(r),$=r.skipUEG.bind(r),z=this.skipScalingList.bind(this);A();const Q=A();if(L(5),O(3),A(),$(),Q===100||Q===110||Q===122||Q===244||Q===44||Q===83||Q===86||Q===118||Q===128){const re=T();if(re===3&&O(1),$(),$(),O(1),M())for(u=re!==3?8:12,f=0;f<u;f++)M()&&z(f<6?16:64,r)}$();const Z=T();if(Z===0)T();else if(Z===1)for(O(1),U(),U(),s=T(),f=0;f<s;f++)U();$(),O(1);const ie=T(),se=T(),ye=L(1);ye===0&&O(1),O(1),M()&&(c=T(),v=T(),y=T(),E=T());let N=[1,1];if(M()&&M())switch(A()){case 1:N=[1,1];break;case 2:N=[12,11];break;case 3:N=[10,11];break;case 4:N=[16,11];break;case 5:N=[40,33];break;case 6:N=[24,11];break;case 7:N=[20,11];break;case 8:N=[32,11];break;case 9:N=[80,33];break;case 10:N=[18,11];break;case 11:N=[15,11];break;case 12:N=[64,33];break;case 13:N=[160,99];break;case 14:N=[4,3];break;case 15:N=[3,2];break;case 16:N=[2,1];break;case 255:N=[A()<<8|A(),A()<<8|A()]}return{width:Math.ceil(16*(ie+1)-2*c-2*v),height:(2-ye)*(se+1)*16-(ye?2:4)*(y+E),pixelRatio:N}}}class OI extends PI{constructor(...t){super(...t),this.initVPS=null}parsePES(t,r,s,u){const f=this.parseNALu(t,s.data,u);let c,v=this.VideoSample,y=!1;s.data=null,v&&f.length&&!t.audFound&&(this.pushAccessUnit(v,t),v=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts)),f.forEach(E=>{var A,L;switch(E.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:v||(v=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts)),v.frame=!0,c=!0;break;case 16:case 17:case 18:case 21:var T;c=!0,y&&(T=v)!=null&&T.frame&&!v.key&&(this.pushAccessUnit(v,t),v=this.VideoSample=null),v||(v=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),v.key=!0,v.frame=!0;break;case 19:case 20:c=!0,(A=v)!=null&&A.frame&&!v.key&&(this.pushAccessUnit(v,t),v=this.VideoSample=null),v||(v=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),v.key=!0,v.frame=!0;break;case 39:c=!0,FE(E.data,2,s.pts,r.samples);break;case 32:c=!0,t.vps||(typeof t.params!="object"&&(t.params={}),t.params=cr(t.params,this.readVPS(E.data)),this.initVPS=E.data),t.vps=[E.data];break;case 33:if(c=!0,y=!0,t.vps===void 0||t.vps[0]===this.initVPS||t.sps===void 0||this.matchSPS(t.sps[0],E.data)||(this.initVPS=t.vps[0],t.sps=t.pps=void 0),!t.sps){const M=this.readSPS(E.data);t.width=M.width,t.height=M.height,t.pixelRatio=M.pixelRatio,t.codec=M.codecString,t.sps=[],typeof t.params!="object"&&(t.params={});for(const O in M.params)t.params[O]=M.params[O]}this.pushParameterSet(t.sps,E.data,t.vps),v||(v=this.VideoSample=this.createVideoSample(!0,s.pts,s.dts)),v.key=!0;break;case 34:if(c=!0,typeof t.params=="object"){if(!t.pps){t.pps=[];const M=this.readPPS(E.data);for(const O in M)t.params[O]=M[O]}this.pushParameterSet(t.pps,E.data,t.vps)}break;case 35:c=!0,t.audFound=!0,(L=v)!=null&&L.frame&&(this.pushAccessUnit(v,t),v=null),v||(v=this.VideoSample=this.createVideoSample(!1,s.pts,s.dts));break;default:c=!1}v&&c&&v.units.push(E)}),u&&v&&(this.pushAccessUnit(v,t),this.VideoSample=null)}pushParameterSet(t,r,s){(s&&s[0]===this.initVPS||!s&&!t.length)&&t.push(r)}getNALuType(t,r){return(126&t[r])>>>1}ebsp2rbsp(t){const r=new Uint8Array(t.byteLength);let s=0;for(let u=0;u<t.byteLength;u++)u>=2&&t[u]===3&&t[u-1]===0&&t[u-2]===0||(r[s]=t[u],s++);return new Uint8Array(r.buffer,0,s)}pushAccessUnit(t,r){super.pushAccessUnit(t,r),this.initVPS&&(this.initVPS=null)}readVPS(t){const r=new Am(t);return r.readUByte(),r.readUByte(),r.readBits(4),r.skipBits(2),r.readBits(6),{numTemporalLayers:r.readBits(3)+1,temporalIdNested:r.readBoolean()}}readSPS(t){const r=new Am(this.ebsp2rbsp(t));r.readUByte(),r.readUByte(),r.readBits(4);const s=r.readBits(3);r.readBoolean();const u=r.readBits(2),f=r.readBoolean(),c=r.readBits(5),v=r.readUByte(),y=r.readUByte(),E=r.readUByte(),A=r.readUByte(),L=r.readUByte(),T=r.readUByte(),M=r.readUByte(),O=r.readUByte(),U=r.readUByte(),$=r.readUByte(),z=r.readUByte(),Q=[],Z=[];for(let bt=0;bt<s;bt++)Q.push(r.readBoolean()),Z.push(r.readBoolean());if(s>0)for(let bt=s;bt<8;bt++)r.readBits(2);for(let bt=0;bt<s;bt++)Q[bt]&&(r.readUByte(),r.readUByte(),r.readUByte(),r.readUByte(),r.readUByte(),r.readUByte(),r.readUByte(),r.readUByte(),r.readUByte(),r.readUByte(),r.readUByte()),Z[bt]&&r.readUByte();r.readUEG();const ie=r.readUEG();ie==3&&r.skipBits(1);const se=r.readUEG(),ye=r.readUEG(),N=r.readBoolean();let re=0,ne=0,Se=0,ce=0;N&&(re+=r.readUEG(),ne+=r.readUEG(),Se+=r.readUEG(),ce+=r.readUEG());const we=r.readUEG(),ze=r.readUEG(),xe=r.readUEG();for(let bt=r.readBoolean()?0:s;bt<=s;bt++)r.skipUEG(),r.skipUEG(),r.skipUEG();if(r.skipUEG(),r.skipUEG(),r.skipUEG(),r.skipUEG(),r.skipUEG(),r.skipUEG(),r.readBoolean()&&r.readBoolean())for(let bt=0;bt<4;bt++)for(let Wt=0;Wt<(bt===3?2:6);Wt++)if(r.readBoolean()){const Un=Math.min(64,1<<4+(bt<<1));bt>1&&r.readEG();for(let Ir=0;Ir<Un;Ir++)r.readEG()}else r.readUEG();r.readBoolean(),r.readBoolean(),r.readBoolean()&&(r.readUByte(),r.skipUEG(),r.skipUEG(),r.readBoolean());const Ce=r.readUEG();let J=0;for(let bt=0;bt<Ce;bt++){let Wt=!1;if(bt!==0&&(Wt=r.readBoolean()),Wt){bt===Ce&&r.readUEG(),r.readBoolean(),r.readUEG();let Un=0;for(let Ir=0;Ir<=J;Ir++){const Kn=r.readBoolean();let Rt=!1;Kn||(Rt=r.readBoolean()),(Kn||Rt)&&Un++}J=Un}else{const Un=r.readUEG(),Ir=r.readUEG();J=Un+Ir;for(let Kn=0;Kn<Un;Kn++)r.readUEG(),r.readBoolean();for(let Kn=0;Kn<Ir;Kn++)r.readUEG(),r.readBoolean()}}if(r.readBoolean()){const bt=r.readUEG();for(let Wt=0;Wt<bt;Wt++){for(let Un=0;Un<xe+4;Un++)r.readBits(1);r.readBits(1)}}let ue=0,de=1,W=1,Ke=!0,nt=1,mt=0;r.readBoolean(),r.readBoolean();let ot=!1;if(r.readBoolean()){if(r.readBoolean()){const bt=r.readUByte();bt>0&&bt<16?(de=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][bt-1],W=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][bt-1]):bt===255&&(de=r.readBits(16),W=r.readBits(16))}if(r.readBoolean()&&r.readBoolean(),r.readBoolean()&&(r.readBits(3),r.readBoolean(),r.readBoolean()&&(r.readUByte(),r.readUByte(),r.readUByte())),r.readBoolean()&&(r.readUEG(),r.readUEG()),r.readBoolean(),r.readBoolean(),r.readBoolean(),ot=r.readBoolean(),ot&&(re+=r.readUEG(),ne+=r.readUEG(),Se+=r.readUEG(),ce+=r.readUEG()),r.readBoolean()&&(nt=r.readBits(32),mt=r.readBits(32),r.readBoolean()&&r.readUEG(),r.readBoolean())){const bt=r.readBoolean(),Wt=r.readBoolean();let Un=!1;(bt||Wt)&&(Un=r.readBoolean(),Un&&(r.readUByte(),r.readBits(5),r.readBoolean(),r.readBits(5)),r.readBits(4),r.readBits(4),Un&&r.readBits(4),r.readBits(5),r.readBits(5),r.readBits(5));for(let Ir=0;Ir<=s;Ir++){Ke=r.readBoolean();let Kn=!1;Ke||r.readBoolean()?r.readEG():Kn=r.readBoolean();const Rt=Kn?1:r.readUEG()+1;if(bt)for(let Lr=0;Lr<Rt;Lr++)r.readUEG(),r.readUEG(),Un&&(r.readUEG(),r.readUEG()),r.skipBits(1);if(Wt)for(let Lr=0;Lr<Rt;Lr++)r.readUEG(),r.readUEG(),Un&&(r.readUEG(),r.readUEG()),r.skipBits(1)}}r.readBoolean()&&(r.readBoolean(),r.readBoolean(),r.readBoolean(),ue=r.readUEG())}let lt=se,nn=ye;if(N||ot){let bt=1,Wt=1;ie===1?bt=Wt=2:ie==2&&(bt=2),lt=se-bt*ne-bt*re,nn=ye-Wt*ce-Wt*Se}const pn=u?["A","B","C"][u]:"",We=v<<24|y<<16|E<<8|A;let Ot=0;for(let bt=0;bt<32;bt++)Ot=(Ot|(We>>bt&1)<<31-bt)>>>0;let gn=Ot.toString(16);return c===1&&gn==="2"&&(gn="6"),{codecString:`hvc1.${pn}${c}.${gn}.${f?"H":"L"}${z}.B0`,params:{general_tier_flag:f,general_profile_idc:c,general_profile_space:u,general_profile_compatibility_flags:[v,y,E,A],general_constraint_indicator_flags:[L,T,M,O,U,$],general_level_idc:z,bit_depth:we+8,bit_depth_luma_minus8:we,bit_depth_chroma_minus8:ze,min_spatial_segmentation_idc:ue,chroma_format_idc:ie,frame_rate:{fixed:Ke,fps:mt/nt}},width:lt,height:nn,pixelRatio:[de,W]}}readPPS(t){const r=new Am(this.ebsp2rbsp(t));r.readUByte(),r.readUByte(),r.skipUEG(),r.skipUEG(),r.skipBits(2),r.skipBits(3),r.skipBits(2),r.skipUEG(),r.skipUEG(),r.skipEG(),r.skipBits(2),r.readBoolean()&&r.skipUEG(),r.skipEG(),r.skipEG(),r.skipBits(4);const s=r.readBoolean(),u=r.readBoolean();let f=1;return u&&s?f=0:u?f=3:s&&(f=2),{parallelismType:f}}matchSPS(t,r){return String.fromCharCode.apply(null,t).substr(3)===String.fromCharCode.apply(null,r).substr(3)}}const zi=188;class kc{constructor(t,r,s,u){this.logger=void 0,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.Zr=-1,this.es=void 0,this.Qr=void 0,this.Jr=void 0,this.ns=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=t,this.config=r,this.typeSupported=s,this.logger=u,this.videoParser=null}static probe(t,r){const s=kc.syncOffset(t);return s>0&&r.warn(`MPEG2-TS detected but first sync word found @ offset ${s}`),s!==-1}static syncOffset(t){const r=t.length;let s=Math.min(940,r-zi)+1,u=0;for(;u<s;){let f=!1,c=-1,v=0;for(let y=u;y<r;y+=zi){if(t[y]!==71||r-y!==zi&&t[y+zi]!==71){if(v)return-1;break}if(v++,c===-1&&(c=y,c!==0&&(s=Math.min(c+18612,t.length-zi)+1)),f||(f=pT(t,y)===0),f&&v>1&&(c===0&&v>2||y+zi>s))return c}u++}return-1}static createTrack(t,r){return{container:t==="video"||t==="audio"?"video/mp2t":void 0,type:t,id:Zk[t],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:t==="audio"?r:void 0}}resetInitSegment(t,r,s,u){this.pmtParsed=!1,this.Zr=-1,this.es=kc.createTrack("video"),this.es.duration=u,this.Qr=kc.createTrack("audio",u),this.Jr=kc.createTrack("id3"),this.ns=kc.createTrack("text"),this.Qr.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=r,this.videoCodec=s}resetTimeStamp(){}resetContiguity(){const{Qr:t,es:r,Jr:s}=this;t&&(t.pesData=null),r&&(r.pesData=null),s&&(s.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(t,r,s=!1,u=!1){let f;s||(this.sampleAes=null);const c=this.es,v=this.Qr,y=this.Jr,E=this.ns;let A=c.pid,L=c.pesData,T=v.pid,M=y.pid,O=v.pesData,U=y.pesData,$=null,z=this.pmtParsed,Q=this.Zr,Z=t.length;if(this.remainderData&&(Z=(t=Na(this.remainderData,t)).length,this.remainderData=null),Z<zi&&!u)return this.remainderData=t,{audioTrack:v,videoTrack:c,id3Track:y,textTrack:E};const ie=Math.max(0,kc.syncOffset(t));Z-=(Z-ie)%zi,Z<t.byteLength&&!u&&(this.remainderData=new Uint8Array(t.buffer,Z,t.buffer.byteLength-Z));let se=0;for(let N=ie;N<Z;N+=zi)if(t[N]===71){const re=!!(64&t[N+1]),ne=pT(t,N);let Se;if((48&t[N+3])>>4>1){if(Se=N+5+t[N+4],Se===N+zi)continue}else Se=N+4;switch(ne){case A:if(re){if(L&&(f=Kf(L,this.logger))){if(this.videoParser===null)switch(c.segmentCodec){case"avc":this.videoParser=new MI;break;case"hevc":this.videoParser=new OI}this.videoParser!==null&&this.videoParser.parsePES(c,E,f,!1)}L={data:[],size:0}}L&&(L.data.push(t.subarray(Se,N+zi)),L.size+=N+zi-Se);break;case T:if(re){if(O&&(f=Kf(O,this.logger)))switch(v.segmentCodec){case"aac":this.parseAACPES(v,f);break;case"mp3":this.parseMPEGPES(v,f);break;case"ac3":this.parseAC3PES(v,f)}O={data:[],size:0}}O&&(O.data.push(t.subarray(Se,N+zi)),O.size+=N+zi-Se);break;case M:re&&(U&&(f=Kf(U,this.logger))&&this.parseID3PES(y,f),U={data:[],size:0}),U&&(U.data.push(t.subarray(Se,N+zi)),U.size+=N+zi-Se);break;case 0:re&&(Se+=t[Se]+1),Q=this.Zr=nO(t,Se);break;case Q:{re&&(Se+=t[Se]+1);const ce=rO(t,Se,this.typeSupported,s,this.observer,this.logger);A=ce.videoPid,A>0&&(c.pid=A,c.segmentCodec=ce.segmentVideoCodec),T=ce.audioPid,T>0&&(v.pid=T,v.segmentCodec=ce.segmentAudioCodec),M=ce.id3Pid,M>0&&(y.pid=M),$===null||z||(this.logger.warn(`MPEG-TS PMT found at ${N} after unknown PID '${$}'. Backtracking to sync byte @${ie} to parse all TS packets.`),$=null,N=ie-188),z=this.pmtParsed=!0;break}case 17:case 8191:break;default:$=ne}}else se++;se>0&&gT(this.observer,new Error(`Found ${se} TS packet/s that do not start with 0x47`),void 0,this.logger),c.pesData=L,v.pesData=O,y.pesData=U;const ye={audioTrack:v,videoTrack:c,id3Track:y,textTrack:E};return u&&this.extractRemainingSamples(ye),ye}flush(){const{remainderData:t}=this;let r;return this.remainderData=null,r=t?this.demux(t,-1,!1,!0):{videoTrack:this.es,audioTrack:this.Qr,id3Track:this.Jr,textTrack:this.ns},this.extractRemainingSamples(r),this.sampleAes?this.decrypt(r,this.sampleAes):r}extractRemainingSamples(t){const{audioTrack:r,videoTrack:s,id3Track:u,textTrack:f}=t,c=s.pesData,v=r.pesData,y=u.pesData;let E;if(c&&(E=Kf(c,this.logger))){if(this.videoParser===null)switch(s.segmentCodec){case"avc":this.videoParser=new MI;break;case"hevc":this.videoParser=new OI}this.videoParser!==null&&(this.videoParser.parsePES(s,f,E,!0),s.pesData=null)}else s.pesData=c;if(v&&(E=Kf(v,this.logger))){switch(r.segmentCodec){case"aac":this.parseAACPES(r,E);break;case"mp3":this.parseMPEGPES(r,E);break;case"ac3":this.parseAC3PES(r,E)}r.pesData=null}else v!=null&&v.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),r.pesData=v;y&&(E=Kf(y,this.logger))?(this.parseID3PES(u,E),u.pesData=null):u.pesData=y}demuxSampleAes(t,r,s){const u=this.demux(t,s,!0,!this.config.progressive),f=this.sampleAes=new tO(this.observer,this.config,r);return this.decrypt(u,f)}decrypt(t,r){return new Promise(s=>{const{audioTrack:u,videoTrack:f}=t;u.samples&&u.segmentCodec==="aac"?r.decryptAacSamples(u.samples,0,()=>{f.samples?r.decryptAvcSamples(f.samples,0,0,()=>{s(t)}):s(t)}):f.samples&&r.decryptAvcSamples(f.samples,0,0,()=>{s(t)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this.es=this.Qr=this.Jr=this.ns=void 0}parseAACPES(t,r){let s=0;const u=this.aacOverFlow;let f,c,v,y=r.data;if(u){this.aacOverFlow=null;const L=u.missing,T=u.sample.unit.byteLength;if(L===-1)y=Na(u.sample.unit,y);else{const M=T-L;u.sample.unit.set(y.subarray(0,L),M),t.samples.push(u.sample),s=u.missing}}for(f=s,c=y.length;f<c-1&&!R0(y,f);f++);if(f!==s){let L;const T=f<c-1;if(L=T?`AAC PES did not start with ADTS header,offset:${f}`:"No ADTS header found in AAC PES",gT(this.observer,new Error(L),T,this.logger),!T)return}if(bI(t,this.observer,y,f,this.audioCodec),r.pts!==void 0)v=r.pts;else{if(!u)return void this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");{const L=EI(t.samplerate);v=u.sample.pts+L}}let E,A=0;for(;f<c;){if(E=TI(t,y,f,v,A),f+=E.length,E.missing){this.aacOverFlow=E;break}for(A++;f<c-1&&!R0(y,f);f++);}}parseMPEGPES(t,r){const s=r.data,u=s.length;let f=0,c=0;const v=r.pts;if(v!==void 0)for(;c<u;)if(II(s,c)){const y=kI(t,s,c,v,f);if(!y)break;c+=y.length,f++}else c++;else this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS")}parseAC3PES(t,r){{const s=r.data,u=r.pts;if(u===void 0)return void this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");const f=s.length;let c,v=0,y=0;for(;y<f&&(c=CI(t,s,y,u,v++))>0;)y+=c}}parseID3PES(t,r){if(r.pts===void 0)return void this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");const s=cr({},r,{type:this.es?da.emsg:da.audioId3,duration:Number.POSITIVE_INFINITY});t.samples.push(s)}}function pT(a,t){return((31&a[t+1])<<8)+a[t+2]}function nO(a,t){return(31&a[t+10])<<8|a[t+11]}function rO(a,t,r,s,u,f){const c={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},v=t+3+((15&a[t+1])<<8|a[t+2])-4;for(t+=12+((15&a[t+10])<<8|a[t+11]);t<v;){const y=pT(a,t),E=(15&a[t+3])<<8|a[t+4];switch(a[t]){case 207:if(!s){mT("ADTS AAC",f);break}case 15:c.audioPid===-1&&(c.audioPid=y);break;case 21:c.id3Pid===-1&&(c.id3Pid=y);break;case 219:if(!s){mT("H.264",f);break}case 27:c.videoPid===-1&&(c.videoPid=y);break;case 3:case 4:r.mpeg||r.mp3?c.audioPid===-1&&(c.audioPid=y,c.segmentAudioCodec="mp3"):f.log("MPEG audio found, not supported in this browser");break;case 193:if(!s){mT("AC-3",f);break}case 129:r.ac3?c.audioPid===-1&&(c.audioPid=y,c.segmentAudioCodec="ac3"):f.log("AC-3 audio found, not supported in this browser");break;case 6:if(c.audioPid===-1&&E>0){let A=t+5,L=E;for(;L>2;){a[A]===106&&(r.ac3!==!0?f.log("AC-3 audio found, not supported in this browser for now"):(c.audioPid=y,c.segmentAudioCodec="ac3"));const T=a[A+1]+2;A+=T,L-=T}}break;case 194:case 135:return gT(u,new Error("Unsupported EC-3 in M2TS found"),void 0,f),c;case 36:c.videoPid===-1&&(c.videoPid=y,c.segmentVideoCodec="hevc",f.log("HEVC in M2TS found"))}t+=E+5}return c}function gT(a,t,r,s){s.warn(`parsing error: ${t.message}`),a.emit(G.ERROR,G.ERROR,{type:Mt.MEDIA_ERROR,details:Me.FRAG_PARSING_ERROR,fatal:!1,levelRetry:r,error:t,reason:t.message})}function mT(a,t){t.log(`${a} with AES-128-CBC encryption found in unencrypted stream`)}function Kf(a,t){let r,s,u,f,c,v=0;const y=a.data;if(!a||a.size===0)return null;for(;y[0].length<19&&y.length>1;)y[0]=Na(y[0],y[1]),y.splice(1,1);if(r=y[0],(r[0]<<16)+(r[1]<<8)+r[2]===1){if(s=(r[4]<<8)+r[5],s&&s>a.size-6)return null;const E=r[7];192&E&&(f=536870912*(14&r[9])+4194304*(255&r[10])+16384*(254&r[11])+128*(255&r[12])+(254&r[13])/2,64&E?(c=536870912*(14&r[14])+4194304*(255&r[15])+16384*(254&r[16])+128*(255&r[17])+(254&r[18])/2,f-c>54e5&&(t.warn(`${Math.round((f-c)/9e4)}s delta between PTS and DTS, align them`),f=c)):c=f),u=r[8];let A=u+9;if(a.size<=A)return null;a.size-=A;const L=new Uint8Array(a.size);for(let T=0,M=y.length;T<M;T++){r=y[T];let O=r.byteLength;if(A){if(A>O){A-=O;continue}r=r.subarray(A),O-=A,A=0}L.set(r,v),v+=O}return s&&(s-=u+3),{data:L,pts:f,dts:c,len:s}}return null}class iO{static getSilentFrame(t,r){if(t==="mp4a.40.2"){if(r===1)return new Uint8Array([0,200,0,128,35,128]);if(r===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(r===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(r===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(r===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(r===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(r===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(r===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(r===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}}}const xc=Math.pow(2,32)-1;class Pe{static init(){let t;for(t in Pe.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},Pe.types)Pe.types.hasOwnProperty(t)&&(Pe.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);const r=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),s=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);Pe.HDLR_TYPES={video:r,audio:s};const u=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),f=new Uint8Array([0,0,0,0,0,0,0,0]);Pe.STTS=Pe.STSC=Pe.STCO=f,Pe.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Pe.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),Pe.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),Pe.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const c=new Uint8Array([105,115,111,109]),v=new Uint8Array([97,118,99,49]),y=new Uint8Array([0,0,0,1]);Pe.FTYP=Pe.box(Pe.types.ftyp,c,y,c,v),Pe.DINF=Pe.box(Pe.types.dinf,Pe.box(Pe.types.dref,u))}static box(t,...r){let s=8,u=r.length;const f=u;for(;u--;)s+=r[u].byteLength;const c=new Uint8Array(s);for(c[0]=s>>24&255,c[1]=s>>16&255,c[2]=s>>8&255,c[3]=255&s,c.set(t,4),u=0,s=8;u<f;u++)c.set(r[u],s),s+=r[u].byteLength;return c}static hdlr(t){return Pe.box(Pe.types.hdlr,Pe.HDLR_TYPES[t])}static mdat(t){return Pe.box(Pe.types.mdat,t)}static mdhd(t,r){r*=t;const s=Math.floor(r/(xc+1)),u=Math.floor(r%(xc+1));return Pe.box(Pe.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,s>>24,s>>16&255,s>>8&255,255&s,u>>24,u>>16&255,u>>8&255,255&u,85,196,0,0]))}static mdia(t){return Pe.box(Pe.types.mdia,Pe.mdhd(t.timescale||0,t.duration||0),Pe.hdlr(t.type),Pe.minf(t))}static mfhd(t){return Pe.box(Pe.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}static minf(t){return t.type==="audio"?Pe.box(Pe.types.minf,Pe.box(Pe.types.smhd,Pe.SMHD),Pe.DINF,Pe.stbl(t)):Pe.box(Pe.types.minf,Pe.box(Pe.types.vmhd,Pe.VMHD),Pe.DINF,Pe.stbl(t))}static moof(t,r,s){return Pe.box(Pe.types.moof,Pe.mfhd(t),Pe.traf(s,r))}static moov(t){let r=t.length;const s=[];for(;r--;)s[r]=Pe.trak(t[r]);return Pe.box.apply(null,[Pe.types.moov,Pe.mvhd(t[0].timescale||0,t[0].duration||0)].concat(s).concat(Pe.mvex(t)))}static mvex(t){let r=t.length;const s=[];for(;r--;)s[r]=Pe.trex(t[r]);return Pe.box.apply(null,[Pe.types.mvex,...s])}static mvhd(t,r){r*=t;const s=Math.floor(r/(xc+1)),u=Math.floor(r%(xc+1)),f=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,s>>24,s>>16&255,s>>8&255,255&s,u>>24,u>>16&255,u>>8&255,255&u,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 Pe.box(Pe.types.mvhd,f)}static sdtp(t){const r=t.samples||[],s=new Uint8Array(4+r.length);let u,f;for(u=0;u<r.length;u++)f=r[u].flags,s[u+4]=f.dependsOn<<4|f.isDependedOn<<2|f.hasRedundancy;return Pe.box(Pe.types.sdtp,s)}static stbl(t){return Pe.box(Pe.types.stbl,Pe.stsd(t),Pe.box(Pe.types.stts,Pe.STTS),Pe.box(Pe.types.stsc,Pe.STSC),Pe.box(Pe.types.stsz,Pe.STSZ),Pe.box(Pe.types.stco,Pe.STCO))}static avc1(t){let r,s,u,f=[],c=[];for(r=0;r<t.sps.length;r++)s=t.sps[r],u=s.byteLength,f.push(u>>>8&255),f.push(255&u),f=f.concat(Array.prototype.slice.call(s));for(r=0;r<t.pps.length;r++)s=t.pps[r],u=s.byteLength,c.push(u>>>8&255),c.push(255&u),c=c.concat(Array.prototype.slice.call(s));const v=Pe.box(Pe.types.avcC,new Uint8Array([1,f[3],f[4],f[5],255,224|t.sps.length].concat(f).concat([t.pps.length]).concat(c))),y=t.width,E=t.height,A=t.pixelRatio[0],L=t.pixelRatio[1];return Pe.box(Pe.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,y>>8&255,255&y,E>>8&255,255&E,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]),v,Pe.box(Pe.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Pe.box(Pe.types.pasp,new Uint8Array([A>>24,A>>16&255,A>>8&255,255&A,L>>24,L>>16&255,L>>8&255,255&L])))}static esds(t){const r=t.config;return new Uint8Array([0,0,0,0,3,25,0,1,0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2,...r,6,1,2])}static audioStsd(t){const r=t.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount||0,0,16,0,0,0,0,r>>8&255,255&r,0,0])}static mp4a(t){return Pe.box(Pe.types.mp4a,Pe.audioStsd(t),Pe.box(Pe.types.esds,Pe.esds(t)))}static mp3(t){return Pe.box(Pe.types[".mp3"],Pe.audioStsd(t))}static ac3(t){return Pe.box(Pe.types["ac-3"],Pe.audioStsd(t),Pe.box(Pe.types.dac3,t.config))}static stsd(t){const{segmentCodec:r}=t;if(t.type==="audio"){if(r==="aac")return Pe.box(Pe.types.stsd,Pe.STSD,Pe.mp4a(t));if(r==="ac3"&&t.config)return Pe.box(Pe.types.stsd,Pe.STSD,Pe.ac3(t));if(r==="mp3"&&t.codec==="mp3")return Pe.box(Pe.types.stsd,Pe.STSD,Pe.mp3(t))}else{if(!t.pps||!t.sps)throw new Error("video track missing pps or sps");if(r==="avc")return Pe.box(Pe.types.stsd,Pe.STSD,Pe.avc1(t));if(r==="hevc"&&t.vps)return Pe.box(Pe.types.stsd,Pe.STSD,Pe.hvc1(t))}throw new Error(`unsupported ${t.type} segment codec (${r}/${t.codec})`)}static tkhd(t){const r=t.id,s=(t.duration||0)*(t.timescale||0),u=t.width||0,f=t.height||0,c=Math.floor(s/(xc+1)),v=Math.floor(s%(xc+1));return Pe.box(Pe.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,c>>24,c>>16&255,c>>8&255,255&c,v>>24,v>>16&255,v>>8&255,255&v,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,u>>8&255,255&u,0,0,f>>8&255,255&f,0,0]))}static traf(t,r){const s=Pe.sdtp(t),u=t.id,f=Math.floor(r/(xc+1)),c=Math.floor(r%(xc+1));return Pe.box(Pe.types.traf,Pe.box(Pe.types.tfhd,new Uint8Array([0,0,0,0,u>>24,u>>16&255,u>>8&255,255&u])),Pe.box(Pe.types.tfdt,new Uint8Array([1,0,0,0,f>>24,f>>16&255,f>>8&255,255&f,c>>24,c>>16&255,c>>8&255,255&c])),Pe.trun(t,s.length+16+20+8+16+8+8),s)}static trak(t){return t.duration=t.duration||4294967295,Pe.box(Pe.types.trak,Pe.tkhd(t),Pe.mdia(t))}static trex(t){const r=t.id;return Pe.box(Pe.types.trex,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(t,r){const s=t.samples||[],u=s.length,f=12+16*u,c=new Uint8Array(f);let v,y,E,A,L,T;for(r+=8+f,c.set([t.type==="video"?1:0,0,15,1,u>>>24&255,u>>>16&255,u>>>8&255,255&u,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0),v=0;v<u;v++)y=s[v],E=y.duration,A=y.size,L=y.flags,T=y.cts,c.set([E>>>24&255,E>>>16&255,E>>>8&255,255&E,A>>>24&255,A>>>16&255,A>>>8&255,255&A,L.isLeading<<2|L.dependsOn,L.isDependedOn<<6|L.hasRedundancy<<4|L.paddingValue<<1|L.isNonSync,61440&L.degradPrio,15&L.degradPrio,T>>>24&255,T>>>16&255,T>>>8&255,255&T],12+16*v);return Pe.box(Pe.types.trun,c)}static initSegment(t){Pe.types||Pe.init();const r=Pe.moov(t);return Na(Pe.FTYP,r)}static hvc1(t){const r=t.params,s=[t.vps,t.sps,t.pps],u=new Uint8Array([1,r.general_profile_space<<6|(r.general_tier_flag?32:0)|r.general_profile_idc,r.general_profile_compatibility_flags[0],r.general_profile_compatibility_flags[1],r.general_profile_compatibility_flags[2],r.general_profile_compatibility_flags[3],r.general_constraint_indicator_flags[0],r.general_constraint_indicator_flags[1],r.general_constraint_indicator_flags[2],r.general_constraint_indicator_flags[3],r.general_constraint_indicator_flags[4],r.general_constraint_indicator_flags[5],r.general_level_idc,240|r.min_spatial_segmentation_idc>>8,255&r.min_spatial_segmentation_idc,252|r.parallelismType,252|r.chroma_format_idc,248|r.bit_depth_luma_minus8,248|r.bit_depth_chroma_minus8,0,parseInt(r.frame_rate.fps),3|r.temporal_id_nested<<2|r.num_temporal_layers<<3|(r.frame_rate.fixed?64:0),s.length]);let f=u.length;for(let M=0;M<s.length;M+=1){f+=3;for(let O=0;O<s[M].length;O+=1)f+=2+s[M][O].length}const c=new Uint8Array(f);c.set(u,0),f=u.length;const v=s.length-1;for(let M=0;M<s.length;M+=1){c.set(new Uint8Array([32+M|(M===v?128:0),0,s[M].length]),f),f+=3;for(let O=0;O<s[M].length;O+=1)c.set(new Uint8Array([s[M][O].length>>8,255&s[M][O].length]),f),f+=2,c.set(s[M][O],f),f+=s[M][O].length}const y=Pe.box(Pe.types.hvcC,c),E=t.width,A=t.height,L=t.pixelRatio[0],T=t.pixelRatio[1];return Pe.box(Pe.types.hvc1,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,E>>8&255,255&E,A>>8&255,255&A,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]),y,Pe.box(Pe.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),Pe.box(Pe.types.pasp,new Uint8Array([L>>24,L>>16&255,L>>8&255,255&L,T>>24,T>>16&255,T>>8&255,255&T])))}}Pe.types=void 0,Pe.HDLR_TYPES=void 0,Pe.STTS=void 0,Pe.STSC=void 0,Pe.STCO=void 0,Pe.STSZ=void 0,Pe.VMHD=void 0,Pe.SMHD=void 0,Pe.STSD=void 0,Pe.FTYP=void 0,Pe.DINF=void 0;function yT(a,t,r=1,s=!1){const u=a*t*r;return s?Math.round(u):u}function km(a,t=!1){return yT(a,1e3,1/9e4,t)}let uu,zf=null,vT=null;function NI(a,t,r,s){return{duration:t,size:r,cts:s,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:a?2:1,isNonSync:a?0:1}}}class D0{constructor(t,r,s,u){if(this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this.rs=null,this.ss=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=t,this.config=r,this.typeSupported=s,this.logger=u,this.ISGenerated=!1,zf===null){const f=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);zf=f?parseInt(f[1]):0}if(vT===null){const f=navigator.userAgent.match(/Safari\/(\d+)/i);vT=f?parseInt(f[1]):0}}destroy(){this.config=this.videoTrackConfig=this.rs=this.ss=null}resetTimeStamp(t){this.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this.rs=this.ss=t}resetNextTimestamp(){this.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(t){let r=!1;const s=t[0].pts,u=t.reduce((f,c)=>{let v=c.pts,y=v-f;return y<-4294967296&&(r=!0,v=_a(v,s),y=v-f),y>0?f:v},s);return r&&this.logger.debug("PTS rollover detected"),u}remux(t,r,s,u,f,c,v,y){let E,A,L,T,M,O,U=f,$=f;const z=t.pid>-1,Q=r.pid>-1,Z=r.samples.length,ie=t.samples.length>0,se=v&&Z>0||Z>1;if((!z||ie)&&(!Q||se)||this.ISGenerated||v){if(this.ISGenerated){var ye,N,re,ne;const ze=this.videoTrackConfig;(ze&&(r.width!==ze.width||r.height!==ze.height||((ye=r.pixelRatio)==null?void 0:ye[0])!==((N=ze.pixelRatio)==null?void 0:N[0])||((re=r.pixelRatio)==null?void 0:re[1])!==((ne=ze.pixelRatio)==null?void 0:ne[1]))||!ze&&se||this.nextAudioPts===null&&ie)&&this.resetInitSegment()}this.ISGenerated||(L=this.generateIS(t,r,f,c));const Se=this.isVideoContiguous;let ce,we=-1;if(se&&(we=function(ze){for(let xe=0;xe<ze.length;xe++)if(ze[xe].key)return xe;return-1}(r.samples),!Se&&this.config.forceKeyFrameOnDiscontinuity))if(O=!0,we>0){this.logger.warn(`[mp4-remuxer]: Dropped ${we} out of ${Z} video samples due to a missing keyframe`);const ze=this.getVideoStartPts(r.samples);r.samples=r.samples.slice(we),r.dropped+=we,$+=(r.samples[0].pts-ze)/r.inputTimeScale,ce=$}else we===-1&&(this.logger.warn(`[mp4-remuxer]: No keyframe found out of ${Z} video samples`),O=!1);if(this.ISGenerated){if(ie&&se){const ze=this.getVideoStartPts(r.samples),xe=(_a(t.samples[0].pts,ze)-ze)/r.inputTimeScale;U+=Math.max(0,xe),$+=Math.max(0,-xe)}if(ie){if(t.samplerate||(this.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),L=this.generateIS(t,r,f,c)),A=this.remuxAudio(t,U,this.isAudioContiguous,c,Q||se||y===_s?$:void 0),se){const ze=A?A.endPTS-A.startPTS:0;r.inputTimeScale||(this.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),L=this.generateIS(t,r,f,c)),E=this.remuxVideo(r,$,Se,ze)}}else se&&(E=this.remuxVideo(r,$,Se,0));E&&(E.firstKeyFrame=we,E.independent=we!==-1,E.firstKeyFramePTS=ce)}}return this.ISGenerated&&this.rs&&this.ss&&(s.samples.length&&(M=_I(s,f,this.rs,this.ss)),u.samples.length&&(T=FI(u,f,this.rs))),{audio:A,video:E,initSegment:L,independent:O,text:T,id3:M}}generateIS(t,r,s,u){const f=t.samples,c=r.samples,v=this.typeSupported,y={},E=this.rs;let A,L,T,M=!E||u,O="audio/mp4";if(M&&(A=L=1/0),t.config&&f.length){switch(t.timescale=t.samplerate,t.segmentCodec){case"mp3":v.mpeg?(O="audio/mpeg",t.codec=""):v.mp3&&(t.codec="mp3");break;case"ac3":t.codec="ac-3"}y.audio={id:"audio",container:O,codec:t.codec,initSegment:t.segmentCodec==="mp3"&&v.mpeg?new Uint8Array(0):Pe.initSegment([t]),metadata:{channelCount:t.channelCount}},M&&(T=t.inputTimeScale,E&&T===E.timescale?M=!1:A=L=f[0].pts-Math.round(T*s))}if(r.sps&&r.pps&&c.length){if(r.timescale=r.inputTimeScale,y.video={id:"main",container:"video/mp4",codec:r.codec,initSegment:Pe.initSegment([r]),metadata:{width:r.width,height:r.height}},M)if(T=r.inputTimeScale,E&&T===E.timescale)M=!1;else{const U=this.getVideoStartPts(c),$=Math.round(T*s);L=Math.min(L,_a(c[0].dts,U)-$),A=Math.min(A,U-$)}this.videoTrackConfig={width:r.width,height:r.height,pixelRatio:r.pixelRatio}}if(Object.keys(y).length)return this.ISGenerated=!0,M?(this.rs={baseTime:A,timescale:T},this.ss={baseTime:L,timescale:T}):A=T=void 0,{tracks:y,initPTS:A,timescale:T}}remuxVideo(t,r,s,u){const f=t.inputTimeScale,c=t.samples,v=[],y=c.length,E=this.rs;let A,L,T=this.nextAvcDts,M=8,O=this.videoSampleDuration,U=Number.POSITIVE_INFINITY,$=Number.NEGATIVE_INFINITY,z=!1;if(!s||T===null){const ue=r*f,de=c[0].pts-_a(c[0].dts,c[0].pts);zf&&T!==null&&Math.abs(ue-de-T)<15e3?s=!0:T=ue-de}const Q=E.baseTime*f/E.timescale;for(let ue=0;ue<y;ue++){const de=c[ue];de.pts=_a(de.pts-Q,T),de.dts=_a(de.dts-Q,T),de.dts<c[ue>0?ue-1:ue].dts&&(z=!0)}z&&c.sort(function(ue,de){const W=ue.dts-de.dts,Ke=ue.pts-de.pts;return W||Ke}),A=c[0].dts,L=c[c.length-1].dts;const Z=L-A,ie=Z?Math.round(Z/(y-1)):O||t.inputTimeScale/30;if(s){const ue=A-T,de=ue>ie,W=ue<-1;if((de||W)&&(de?this.logger.warn(`${(t.segmentCodec||"").toUpperCase()}: ${km(ue,!0)} ms (${ue}dts) hole between fragments detected at ${r.toFixed(3)}`):this.logger.warn(`${(t.segmentCodec||"").toUpperCase()}: ${km(-ue,!0)} ms (${ue}dts) overlapping between fragments detected at ${r.toFixed(3)}`),!W||T>=c[0].pts||zf)){A=T;const Ke=c[0].pts-ue;if(de)c[0].dts=A,c[0].pts=Ke;else{let nt=!0;for(let mt=0;mt<c.length&&!(c[mt].dts>Ke&&nt);mt++){const ot=c[mt].pts;if(c[mt].dts-=ue,c[mt].pts-=ue,mt<c.length-1){const lt=c[mt+1].pts;nt=lt<=c[mt].pts==lt<=ot}}}this.logger.log(`Video: Initial PTS/DTS adjusted: ${km(Ke,!0)}/${km(A,!0)}, delta: ${km(ue,!0)} ms`)}}A=Math.max(0,A);let se=0,ye=0,N=A;for(let ue=0;ue<y;ue++){const de=c[ue],W=de.units,Ke=W.length;let nt=0;for(let mt=0;mt<Ke;mt++)nt+=W[mt].data.length;ye+=nt,se+=Ke,de.length=nt,de.dts<N?(de.dts=N,N+=ie/4|0||1):N=de.dts,U=Math.min(de.pts,U),$=Math.max(de.pts,$)}L=c[y-1].dts;const re=ye+4*se+8;let ne;try{ne=new Uint8Array(re)}catch(ue){return void this.observer.emit(G.ERROR,G.ERROR,{type:Mt.MUX_ERROR,details:Me.REMUX_ALLOC_ERROR,fatal:!1,error:ue,bytes:re,reason:`fail allocating video mdat ${re}`})}const Se=new DataView(ne.buffer);Se.setUint32(0,re),ne.set(Pe.types.mdat,4);let ce=!1,we=Number.POSITIVE_INFINITY,ze=Number.POSITIVE_INFINITY,xe=Number.NEGATIVE_INFINITY,Ce=Number.NEGATIVE_INFINITY;for(let ue=0;ue<y;ue++){const de=c[ue],W=de.units;let Ke,nt=0;for(let ot=0,lt=W.length;ot<lt;ot++){const nn=W[ot],pn=nn.data,We=nn.data.byteLength;Se.setUint32(M,We),M+=4,ne.set(pn,M),M+=We,nt+=4+We}if(ue<y-1)O=c[ue+1].dts-de.dts,Ke=c[ue+1].pts-de.pts;else{const ot=this.config,lt=ue>0?de.dts-c[ue-1].dts:ie;if(Ke=ue>0?de.pts-c[ue-1].pts:ie,ot.stretchShortVideoTrack&&this.nextAudioPts!==null){const nn=Math.floor(ot.maxBufferHole*f),pn=(u?U+u*f:this.nextAudioPts)-de.pts;pn>nn?(O=pn-lt,O<0?O=lt:ce=!0,this.logger.log(`[mp4-remuxer]: It is approximately ${pn/90} ms to the next segment; using duration ${O/90} ms for the last video frame.`)):O=lt}else O=lt}const mt=Math.round(de.pts-de.dts);we=Math.min(we,O),xe=Math.max(xe,O),ze=Math.min(ze,Ke),Ce=Math.max(Ce,Ke),v.push(NI(de.key,O,nt,mt))}if(v.length){if(zf){if(zf<70){const ue=v[0].flags;ue.dependsOn=2,ue.isNonSync=0}}else if(vT&&Ce-ze<xe-we&&ie/xe<.025&&v[0].cts===0){this.logger.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let ue=A;for(let de=0,W=v.length;de<W;de++){const Ke=ue+v[de].duration,nt=ue+v[de].cts;if(de<W-1){const mt=Ke+v[de+1].cts;v[de].duration=mt-nt}else v[de].duration=de?v[de-1].duration:ie;v[de].cts=0,ue=Ke}}}O=ce||!O?ie:O,this.nextAvcDts=T=L+O,this.videoSampleDuration=O,this.isVideoContiguous=!0;const J={data1:Pe.moof(t.sequenceNumber++,A,cr(t,{samples:v})),data2:ne,startPTS:U/f,endPTS:($+O)/f,startDTS:A/f,endDTS:T/f,type:"video",hasAudio:!1,hasVideo:!0,nb:v.length,dropped:t.dropped};return t.samples=[],t.dropped=0,J}getSamplesPerFrame(t){switch(t.segmentCodec){case"mp3":return 1152;case"ac3":return 1536;default:return 1024}}remuxAudio(t,r,s,u,f){const c=t.inputTimeScale,v=c/(t.samplerate?t.samplerate:c),y=this.getSamplesPerFrame(t),E=y*v,A=this.rs,L=t.segmentCodec==="mp3"&&this.typeSupported.mpeg,T=[],M=f!==void 0;let O=t.samples,U=L?0:8,$=this.nextAudioPts||-1;const z=r*c,Q=A.baseTime*c/A.timescale;if(this.isAudioContiguous=s=s||O.length&&$>0&&(u&&Math.abs(z-$)<9e3||Math.abs(_a(O[0].pts-Q,z)-$)<20*E),O.forEach(function(xe){xe.pts=_a(xe.pts-Q,z)}),!s||$<0){if(O=O.filter(xe=>xe.pts>=0),!O.length)return;$=f===0?0:u&&!M?Math.max(0,z):O[0].pts}if(t.segmentCodec==="aac"){const xe=this.config.maxAudioFramesDrift;for(let Ce=0,J=$;Ce<O.length;Ce++){const ue=O[Ce],de=ue.pts,W=de-J,Ke=Math.abs(1e3*W/c);if(W<=-xe*E&&M)Ce===0&&(this.logger.warn(`Audio frame @ ${(de/c).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*W/c)} ms.`),this.nextAudioPts=$=J=de);else if(W>=xe*E&&Ke<1e4&&M){let nt=Math.round(W/E);J=de-nt*E,J<0&&(nt--,J+=E),Ce===0&&(this.nextAudioPts=$=J),this.logger.warn(`[mp4-remuxer]: Injecting ${nt} audio frame @ ${(J/c).toFixed(3)}s due to ${Math.round(1e3*W/c)} ms gap.`);for(let mt=0;mt<nt;mt++){const ot=Math.max(J,0);let lt=iO.getSilentFrame(t.parsedCodec||t.manifestCodec||t.codec,t.channelCount);lt||(this.logger.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),lt=ue.unit.subarray()),O.splice(Ce,0,{unit:lt,pts:ot}),J+=E,Ce++}}ue.pts=J,J+=E}}let Z,ie=null,se=null,ye=0,N=O.length;for(;N--;)ye+=O[N].unit.byteLength;for(let xe=0,Ce=O.length;xe<Ce;xe++){const J=O[xe],ue=J.unit;let de=J.pts;if(se!==null)T[xe-1].duration=Math.round((de-se)/v);else{if(s&&t.segmentCodec==="aac"&&(de=$),ie=de,!(ye>0))return;ye+=U;try{Z=new Uint8Array(ye)}catch(Ke){return void this.observer.emit(G.ERROR,G.ERROR,{type:Mt.MUX_ERROR,details:Me.REMUX_ALLOC_ERROR,fatal:!1,error:Ke,bytes:ye,reason:`fail allocating audio mdat ${ye}`})}L||(new DataView(Z.buffer).setUint32(0,ye),Z.set(Pe.types.mdat,4))}Z.set(ue,U);const W=ue.byteLength;U+=W,T.push(NI(!0,y,W,0)),se=de}const re=T.length;if(!re)return;const ne=T[T.length-1];this.nextAudioPts=$=se+v*ne.duration;const Se=L?new Uint8Array(0):Pe.moof(t.sequenceNumber++,ie/v,cr({},t,{samples:T}));t.samples=[];const ce=ie/c,we=$/c,ze={data1:Se,data2:Z,startPTS:ce,endPTS:we,startDTS:ce,endDTS:we,type:"audio",hasAudio:!0,hasVideo:!1,nb:re};return this.isAudioContiguous=!0,ze}}function _a(a,t){let r;if(t===null)return a;for(r=t<a?-8589934592:8589934592;Math.abs(a-t)>4294967296;)a+=r;return a}function _I(a,t,r,s){const u=a.samples.length;if(!u)return;const f=a.inputTimeScale;for(let v=0;v<u;v++){const y=a.samples[v];y.pts=_a(y.pts-r.baseTime*f/r.timescale,t*f)/f,y.dts=_a(y.dts-s.baseTime*f/s.timescale,t*f)/f}const c=a.samples;return a.samples=[],{samples:c}}function FI(a,t,r){const s=a.samples.length;if(!s)return;const u=a.inputTimeScale;for(let c=0;c<s;c++){const v=a.samples[c];v.pts=_a(v.pts-r.baseTime*u/r.timescale,t*u)/u}a.samples.sort((c,v)=>c.pts-v.pts);const f=a.samples;return a.samples=[],{samples:f}}function UI(a,t){const r=a==null?void 0:a.codec;return r&&r.length>4?r:t===Fs?r==="ec-3"||r==="ac-3"||r==="alac"?r:r==="fLaC"||r==="Opus"?h0(r,!1):(Hn.warn(`Unhandled audio codec "${r}" in mp4 MAP`),r||"mp4a"):(Hn.warn(`Unhandled video codec "${r}" in mp4 MAP`),r||"avc1")}try{uu=self.performance.now.bind(self.performance)}catch{uu=Date.now}const P0=[{demux:class{constructor(a,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(a,t,r,s){const u=this.videoTrack=cl("video",1),f=this.audioTrack=cl("audio",1),c=this.txtTrack=cl("text",1);if(this.id3Track=cl("id3",1),this.timeOffset=0,a==null||!a.byteLength)return;const v=rx(a);if(v.video){const{id:y,timescale:E,codec:A,supplemental:L}=v.video;u.id=y,u.timescale=c.timescale=E,u.codec=A,u.supplemental=L}if(v.audio){const{id:y,timescale:E,codec:A}=v.audio;f.id=y,f.timescale=E,f.codec=A}c.id=Zk.text,u.sampleDuration=0,u.duration=f.duration=s}resetContiguity(){this.remainderData=null}static probe(a){return function(t){const r=t.byteLength;for(let s=0;s<r;){const u=Kt(t,s);if(u>8&&t[s+4]===109&&t[s+5]===111&&t[s+6]===111&&t[s+7]===102)return!0;s=u>1?s+u:r}return!1}(a)}demux(a,t){this.timeOffset=t;let r=a;const s=this.videoTrack,u=this.txtTrack;if(this.config.progressive){this.remainderData&&(r=Na(this.remainderData,a));const c=function(v){const y={valid:null,remainder:null},E=un(v,["moof"]);if(E.length<2)return y.remainder=v,y;const A=E[E.length-1];return y.valid=v.slice(0,A.byteOffset-8),y.remainder=v.slice(A.byteOffset-8),y}(r);this.remainderData=c.remainder,s.samples=c.valid||new Uint8Array}else s.samples=r;const f=this.extractID3Track(s,t);return u.samples=sx(t,s),{videoTrack:s,audioTrack:this.audioTrack,id3Track:f,textTrack:this.txtTrack}}flush(){const a=this.timeOffset,t=this.videoTrack,r=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const s=this.extractID3Track(t,this.timeOffset);return r.samples=sx(a,t),{videoTrack:t,audioTrack:cl(),id3Track:s,textTrack:cl()}}extractID3Track(a,t){const r=this.id3Track;if(a.samples.length){const s=un(a.samples,["emsg"]);s&&s.forEach(u=>{const f=function(c){const v=c[0];let y="",E="",A=0,L=0,T=0,M=0,O=0,U=0;if(v===0){for(;gi(c.subarray(U,U+1))!=="\0";)y+=gi(c.subarray(U,U+1)),U+=1;for(y+=gi(c.subarray(U,U+1)),U+=1;gi(c.subarray(U,U+1))!=="\0";)E+=gi(c.subarray(U,U+1)),U+=1;E+=gi(c.subarray(U,U+1)),U+=1,A=Kt(c,12),L=Kt(c,16),M=Kt(c,20),O=Kt(c,24),U=28}else if(v===1){U+=4,A=Kt(c,U),U+=4;const $=Kt(c,U);U+=4;const z=Kt(c,U);for(U+=4,T=4294967296*$+z,eM(T)||(T=Number.MAX_SAFE_INTEGER,Hn.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),M=Kt(c,U),U+=4,O=Kt(c,U),U+=4;gi(c.subarray(U,U+1))!=="\0";)y+=gi(c.subarray(U,U+1)),U+=1;for(y+=gi(c.subarray(U,U+1)),U+=1;gi(c.subarray(U,U+1))!=="\0";)E+=gi(c.subarray(U,U+1)),U+=1;E+=gi(c.subarray(U,U+1)),U+=1}return{schemeIdUri:y,value:E,timeScale:A,presentationTime:T,presentationTimeDelta:L,eventDuration:M,id:O,payload:c.subarray(U,c.byteLength)}}(u);if(eO.test(f.schemeIdUri)){const c=DI(f,t);let v=f.eventDuration===4294967295?Number.POSITIVE_INFINITY:f.eventDuration/f.timeScale;v<=.001&&(v=Number.POSITIVE_INFINITY);const y=f.payload;r.samples.push({data:y,len:y.byteLength,dts:c,pts:c,type:da.emsg,duration:v})}else if(this.config.enableEmsgKLVMetadata&&f.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const c=DI(f,t);r.samples.push({data:f.payload,len:f.payload.byteLength,dts:c,pts:c,type:da.misbklv,duration:Number.POSITIVE_INFINITY})}})}return r}demuxSampleAes(a,t,r){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}},remux:class{constructor(a,t,r,s){this.logger=void 0,this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.logger=s}destroy(){}resetTimeStamp(a){this.initPTS=a,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(a,t,r,s){this.audioCodec=t,this.videoCodec=r,this.generateInitSegment(function(u,f){if(!u||!f)return u;const c=f.keyId;return c&&f.isCommonEncryption&&un(u,["moov","trak"]).forEach(v=>{const y=un(v,["mdia","minf","stbl","stsd"])[0].subarray(8);let E=un(y,["enca"]);const A=E.length>0;A||(E=un(y,["encv"])),E.forEach(L=>{un(A?L.subarray(28):L.subarray(78),["sinf"]).forEach(T=>{const M=ix(T);if(M){const O=M.subarray(8,24);O.some(U=>U!==0)||(Hn.log(`[eme] Patching keyId in 'enc${A?"a":"v"}>sinf>>tenc' box: ${sl(O)} -> ${sl(c)}`),M.set(c,8))}})})}),u}(a,s)),this.emitInitSegment=!0}generateInitSegment(a){let{audioCodec:t,videoCodec:r}=this;if(a==null||!a.byteLength)return this.initTracks=void 0,void(this.initData=void 0);const s=this.initData=rx(a);s.audio&&(t=UI(s.audio,Fs)),s.video&&(r=UI(s.video,Oa));const u={};s.audio&&s.video?u.audiovideo={container:"video/mp4",codec:t+","+r,supplemental:s.video.supplemental,initSegment:a,id:"main"}:s.audio?u.audio={container:"audio/mp4",codec:t,initSegment:a,id:"audio"}:s.video?u.video={container:"video/mp4",codec:r,supplemental:s.video.supplemental,initSegment:a,id:"main"}:this.logger.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=u}remux(a,t,r,s,u,f){var c,v;let{initPTS:y,lastEndTime:E}=this;const A={audio:void 0,video:void 0,text:s,id3:r,initSegment:void 0};vt(E)||(E=this.lastEndTime=u||0);const L=t.samples;if(L==null||!L.length)return A;const T={initPTS:void 0,timescale:1};let M=this.initData;if((c=M)!=null&&c.length||(this.generateInitSegment(L),M=this.initData),(v=M)==null||!v.length)return this.logger.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),A;this.emitInitSegment&&(T.tracks=this.initTracks,this.emitInitSegment=!1);const O=function(N,re){let ne=0,Se=0,ce=0;const we=un(N,["moof","traf"]);for(let ze=0;ze<we.length;ze++){const xe=we[ze],Ce=un(xe,["tfhd"])[0],J=re[Kt(Ce,4)];if(!J)continue;const ue=J.default,de=Kt(Ce,0)|(ue==null?void 0:ue.flags);let W=ue==null?void 0:ue.duration;8&de&&(W=Kt(Ce,2&de?12:8));const Ke=J.timescale||9e4,nt=un(xe,["trun"]);for(let mt=0;mt<nt.length;mt++)ne=cM(nt[mt]),!ne&&W&&(ne=W*Kt(nt[mt],4)),J.type===Oa?Se+=ne/Ke:J.type===Fs&&(ce+=ne/Ke)}if(Se===0&&ce===0){let ze=1/0,xe=0,Ce=0;const J=un(N,["sidx"]);for(let ue=0;ue<J.length;ue++){const de=lM(J[ue]);if(de!=null&&de.references){ze=Math.min(ze,de.earliestPresentationTime/de.timescale);const W=de.references.reduce((Ke,nt)=>Ke+nt.info.duration||0,0);xe=Math.max(xe,W+de.earliestPresentationTime/de.timescale),Ce=xe-ze}}if(Ce&&vt(Ce))return Ce}return Se||ce}(L,M),U=function(N,re){return un(re,["moof","traf"]).reduce((ne,Se)=>{const ce=un(Se,["tfdt"])[0],we=ce[0],ze=un(Se,["tfhd"]).reduce((xe,Ce)=>{const J=Kt(Ce,4),ue=N[J];if(ue){let de=Kt(ce,4);if(we===1){if(de===o0)return Hn.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),xe;de*=o0+1,de+=Kt(ce,8)}const W=de/(ue.timescale||9e4);if(vt(W)&&(xe===null||W<xe))return W}return xe},null);return ze!==null&&vt(ze)&&(ne===null||ze<ne)?ze:ne},null)}(M,L),$=U===null?u:U;!f&&y||!function(N,re,ne,Se){if(N===null)return!0;const ce=Math.max(Se,1),we=re-N.baseTime/N.timescale;return Math.abs(we-ne)>ce}(y,$,u,O)&&T.timescale===y.timescale||(T.initPTS=$-u,y&&y.timescale===1&&this.logger.warn(`Adjusting initPTS @${u} from ${y.baseTime/y.timescale} to ${T.initPTS}`),this.initPTS=y={baseTime:T.initPTS,timescale:1});const z=a?$-y.baseTime/y.timescale:E,Q=z+O;(function(N,re,ne){un(re,["moof","traf"]).forEach(Se=>{un(Se,["tfhd"]).forEach(ce=>{const we=Kt(ce,4),ze=N[we];if(!ze)return;const xe=ze.timescale||9e4;un(Se,["tfdt"]).forEach(Ce=>{const J=Ce[0],ue=ne*xe;if(ue){let de=Kt(Ce,4);if(J===0)de-=ue,de=Math.max(de,0),NE(Ce,4,de);else{de*=Math.pow(2,32),de+=Kt(Ce,8),de-=ue,de=Math.max(de,0);const W=Math.floor(de/(o0+1)),Ke=Math.floor(de%(o0+1));NE(Ce,4,W),NE(Ce,8,Ke)}}})})})})(M,L,y.baseTime/y.timescale),O>0?this.lastEndTime=Q:(this.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const Z=!!M.audio,ie=!!M.video;let se="";Z&&(se+="audio"),ie&&(se+="video");const ye={data1:L,startPTS:z,startDTS:z,endPTS:Q,endDTS:Q,type:se,hasAudio:Z,hasVideo:ie,nb:1,dropped:0};return A.audio=ye.type==="audio"?ye:void 0,A.video=ye.type!=="audio"?ye:void 0,A.initSegment=T,A.id3=_I(r,u,y,y),s.samples.length&&(A.text=FI(s,u,y)),A}}},{demux:kc,remux:D0},{demux:class extends hT{constructor(a,t){super(),this.observer=void 0,this.config=void 0,this.observer=a,this.config=t}resetInitSegment(a,t,r,s){super.resetInitSegment(a,t,r,s),this.Qr={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:s,inputTimeScale:9e4,dropped:0}}static probe(a,t){if(!a)return!1;const r=wm(a,0);let s=(r==null?void 0:r.length)||0;if(LI(a,s))return!1;for(let u=a.length;s<u;s++)if(GM(a,s))return t.log("ADTS sync word found !"),!0;return!1}canParse(a,t){return function(r,s){return function(u,f){return f+5<u.length}(r,s)&&yI(r,s)&&uT(r,s)<=r.length-s}(a,t)}appendFrame(a,t,r){bI(a,this.observer,t,r,a.manifestCodec);const s=TI(a,t,r,this.basePTS,this.frameIndex);if(s&&s.missing===0)return s}},remux:D0},{demux:class extends hT{resetInitSegment(a,t,r,s){super.resetInitSegment(a,t,r,s),this.Qr={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:s,inputTimeScale:9e4,dropped:0}}static probe(a){if(!a)return!1;const t=wm(a,0);let r=(t==null?void 0:t.length)||0;if(t&&a[r]===11&&a[r+1]===119&&dT(t)!==void 0&&RI(a,r)<=16)return!1;for(let s=a.length;r<s;r++)if(LI(a,r))return Hn.log("MPEG Audio sync word found !"),!0;return!1}canParse(a,t){return function(r,s){return fT(r,s)&&4<=r.length-s}(a,t)}appendFrame(a,t,r){if(this.basePTS!==null)return kI(a,t,r,this.basePTS,this.frameIndex)}},remux:D0}];P0.splice(2,0,{demux:ZM,remux:D0});class BI{constructor(t,r,s,u,f,c){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=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=t,this.typeSupported=r,this.config=s,this.id=f,this.logger=c}configure(t){this.transmuxConfig=t,this.decrypter&&this.decrypter.reset()}push(t,r,s,u){const f=s.transmuxing;f.executeStart=uu();let c=new Uint8Array(t);const{currentTransmuxState:v,transmuxConfig:y}=this;u&&(this.currentTransmuxState=u);const{contiguous:E,discontinuity:A,trackSwitch:L,accurateTimeOffset:T,timeOffset:M,initSegmentChange:O}=u||v,{audioCodec:U,videoCodec:$,defaultInitPts:z,duration:Q,initSegmentData:Z}=y,ie=function(re,ne){let Se=null;return re.byteLength>0&&(ne==null?void 0:ne.key)!=null&&ne.iv!==null&&ne.method!=null&&(Se=ne),Se}(c,r);if(ie&&Bf(ie.method)){const re=this.getDecrypter(),ne=qE(ie.method);if(!re.isSync())return this.asyncResult=!0,this.decryptionPromise=re.webCryptoDecrypt(c,ie.key.buffer,ie.iv.buffer,ne).then(Se=>{const ce=this.push(Se,null,s);return this.decryptionPromise=null,ce}),this.decryptionPromise;{let Se=re.softwareDecrypt(c,ie.key.buffer,ie.iv.buffer,ne);if(s.part>-1){const ce=re.flush();Se=ce&&ce.buffer}if(!Se)return f.executeEnd=uu(),bT(s);c=new Uint8Array(Se)}}const se=this.needsProbing(A,L);if(se){const re=this.configureTransmuxer(c);if(re)return this.logger.warn(`[transmuxer] ${re.message}`),this.observer.emit(G.ERROR,G.ERROR,{type:Mt.MEDIA_ERROR,details:Me.FRAG_PARSING_ERROR,fatal:!1,error:re,reason:re.message}),f.executeEnd=uu(),bT(s)}(A||L||O||se)&&this.resetInitSegment(Z,U,$,Q,r),(A||O||se)&&this.resetInitialTimestamp(z),E||this.resetContiguity();const ye=this.transmux(c,ie,M,T,s);this.asyncResult=xm(ye);const N=this.currentTransmuxState;return N.contiguous=!0,N.discontinuity=!1,N.trackSwitch=!1,f.executeEnd=uu(),ye}flush(t){const r=t.transmuxing;r.executeStart=uu();const{decrypter:s,currentTransmuxState:u,decryptionPromise:f}=this;if(f)return this.asyncResult=!0,f.then(()=>this.flush(t));const c=[],{timeOffset:v}=u;if(s){const L=s.flush();L&&c.push(this.push(L.buffer,null,t))}const{demuxer:y,remuxer:E}=this;if(!y||!E){r.executeEnd=uu();const L=[bT(t)];return this.asyncResult?Promise.resolve(L):L}const A=y.flush(v);return xm(A)?(this.asyncResult=!0,A.then(L=>(this.flushRemux(c,L,t),c))):(this.flushRemux(c,A,t),this.asyncResult?Promise.resolve(c):c)}flushRemux(t,r,s){const{audioTrack:u,videoTrack:f,id3Track:c,textTrack:v}=r,{accurateTimeOffset:y,timeOffset:E}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${s.sn}${s.part>-1?" part: "+s.part:""} of ${this.id===On?"level":"track"} ${s.level}`);const A=this.remuxer.remux(u,f,c,v,E,y,!0,this.id);t.push({remuxResult:A,chunkMeta:s}),s.transmuxing.executeEnd=uu()}resetInitialTimestamp(t){const{demuxer:r,remuxer:s}=this;r&&s&&(r.resetTimeStamp(t),s.resetTimeStamp(t))}resetContiguity(){const{demuxer:t,remuxer:r}=this;t&&r&&(t.resetContiguity(),r.resetNextTimestamp())}resetInitSegment(t,r,s,u,f){const{demuxer:c,remuxer:v}=this;c&&v&&(c.resetInitSegment(t,r,s,u),v.resetInitSegment(t,r,s,f))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(t,r,s,u,f){let c;return c=r&&r.method==="SAMPLE-AES"?this.transmuxSampleAes(t,r,s,u,f):this.transmuxUnencrypted(t,s,u,f),c}transmuxUnencrypted(t,r,s,u){const{audioTrack:f,videoTrack:c,id3Track:v,textTrack:y}=this.demuxer.demux(t,r,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(f,c,v,y,r,s,!1,this.id),chunkMeta:u}}transmuxSampleAes(t,r,s,u,f){return this.demuxer.demuxSampleAes(t,r,s).then(c=>({remuxResult:this.remuxer.remux(c.audioTrack,c.videoTrack,c.id3Track,c.textTrack,s,u,!1,this.id),chunkMeta:f}))}configureTransmuxer(t){const{config:r,observer:s,typeSupported:u}=this;let f;for(let L=0,T=P0.length;L<T;L++){var c;if((c=P0[L].demux)!=null&&c.probe(t,this.logger)){f=P0[L];break}}if(!f)return new Error("Failed to find demuxer by probing fragment data");const v=this.demuxer,y=this.remuxer,E=f.remux,A=f.demux;y&&y instanceof E||(this.remuxer=new E(s,r,u,this.logger)),v&&v instanceof A||(this.demuxer=new A(s,r,u,this.logger),this.probe=A.probe)}needsProbing(t,r){return!this.demuxer||!this.remuxer||t||r}getDecrypter(){let t=this.decrypter;return t||(t=this.decrypter=new VE(this.config)),t}}const bT=a=>({remuxResult:{},chunkMeta:a});function xm(a){return"then"in a&&a.then instanceof Function}class sO{constructor(t,r,s,u,f){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=t,this.videoCodec=r,this.initSegmentData=s,this.duration=u,this.defaultInitPts=f||null}}class aO{constructor(t,r,s,u,f,c){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=t,this.contiguous=r,this.accurateTimeOffset=s,this.trackSwitch=u,this.timeOffset=f,this.initSegmentChange=c}}let $I=0;class jI{constructor(t,r,s,u){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=$I++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=y=>{const E=y.data,A=this.hls;if(A&&E!=null&&E.event&&E.instanceNo===this.instanceNo)switch(E.event){case"init":{var L;const T=(L=this.workerContext)==null?void 0:L.objectURL;T&&self.URL.revokeObjectURL(T);break}case"transmuxComplete":this.handleTransmuxComplete(E.data);break;case"flush":this.onFlush(E.data);break;case"workerLog":A.logger[E.data.logType]&&A.logger[E.data.logType](E.data.message);break;default:E.data=E.data||{},E.data.frag=this.frag,E.data.part=this.part,E.data.id=this.id,A.trigger(E.event,E.data)}},this.onWorkerError=y=>{if(!this.hls)return;const E=new Error(`${y.message}  (${y.filename}:${y.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(G.ERROR,{type:Mt.OTHER_ERROR,details:Me.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:E})};const f=t.config;this.hls=t,this.id=r,this.useWorker=!!f.enableWorker,this.onTransmuxComplete=s,this.onFlush=u;const c=(y,E)=>{(E=E||{}).frag=this.frag||void 0,y===G.ERROR&&(E.parent=this.id,E.part=this.part,this.error=E.error),this.hls.trigger(y,E)};this.observer=new oT,this.observer.on(G.FRAG_DECRYPTED,c),this.observer.on(G.ERROR,c);const v=dx(f.preferManagedMediaSource);if(this.useWorker&&typeof Worker<"u"){const y=this.hls.logger;if(f.workerPath||typeof __HLS_WORKER_BUNDLE__=="function"){try{f.workerPath?(y.log(`loading Web Worker ${f.workerPath} for "${r}"`),this.workerContext=function(A){const L=Vf[A];if(L)return L.clientCount++,L;const T=new self.URL(A,self.location.href).href,M={worker:new self.Worker(T),scriptURL:T,clientCount:1};return Vf[A]=M,M}(f.workerPath)):(y.log(`injecting Web Worker for "${r}"`),this.workerContext=function(){const A=Vf[Sm];if(A)return A.clientCount++,A;const L=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),T=self.URL.createObjectURL(L),M={worker:new self.Worker(T),objectURL:T,clientCount:1};return Vf[Sm]=M,M}());const{worker:E}=this.workerContext;E.addEventListener("message",this.onWorkerMessage),E.addEventListener("error",this.onWorkerError),E.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:v,id:r,config:Or(f)})}catch(E){y.warn(`Error setting up "${r}" Web Worker, fallback to inline`,E),this.terminateWorker(),this.error=null,this.transmuxer=new BI(this.observer,v,f,"",r,t.logger)}return}}this.transmuxer=new BI(this.observer,v,f,"",r,t.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const t=this.instanceNo;this.instanceNo=$I++;const r=this.hls.config,s=dx(r.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:t,typeSupported:s,id:this.id,config:Or(r)})}}terminateWorker(){if(this.workerContext){const{worker:t}=this.workerContext;this.workerContext=null,t.removeEventListener("message",this.onWorkerMessage),t.removeEventListener("error",this.onWorkerError),function(r){const s=Vf[r||Sm];if(s&&s.clientCount--==1){const{worker:u,objectURL:f}=s;delete Vf[r||Sm],f&&self.URL.revokeObjectURL(f),u.terminate()}}(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const r=this.transmuxer;r&&(r.destroy(),this.transmuxer=null)}const t=this.observer;t&&t.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(t,r,s,u,f,c,v,y,E,A){var L,T;E.transmuxing.start=self.performance.now();const{instanceNo:M,transmuxer:O}=this,U=c?c.start:f.start,$=f.decryptdata,z=this.frag,Q=!(z&&f.cc===z.cc),Z=!(z&&E.level===z.level),ie=z?E.sn-z.sn:-1,se=this.part?E.part-this.part.index:-1,ye=ie===0&&E.id>1&&E.id===(z==null?void 0:z.stats.chunkCount),N=!Z&&(ie===1||ie===0&&(se===1||ye&&se<=0)),re=self.performance.now();(Z||ie||f.stats.parsing.start===0)&&(f.stats.parsing.start=re),!c||!se&&N||(c.stats.parsing.start=re);const ne=!(z&&((L=f.initSegment)==null?void 0:L.url)===((T=z.initSegment)==null?void 0:T.url)),Se=new aO(Q,N,y,Z,U,ne);if(!N||Q||ne){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${f.type} sn: ${E.sn}${E.part>-1?" part: "+E.part:""} ${this.id===On?"level":"track"}: ${E.level} id: ${E.id}
        discontinuity: ${Q}
        trackSwitch: ${Z}
        contiguous: ${N}
        accurateTimeOffset: ${y}
        timeOffset: ${U}
        initSegmentChange: ${ne}`);const ce=new sO(s,u,r,v,A);this.configureTransmuxer(ce)}if(this.frag=f,this.part=c,this.workerContext)this.workerContext.worker.postMessage({instanceNo:M,cmd:"demux",data:t,decryptdata:$,chunkMeta:E,state:Se},t instanceof ArrayBuffer?[t]:[]);else if(O){const ce=O.push(t,$,E,Se);xm(ce)?ce.then(we=>{this.handleTransmuxComplete(we)}).catch(we=>{this.transmuxerError(we,E,"transmuxer-interface push error")}):this.handleTransmuxComplete(ce)}}flush(t){t.transmuxing.start=self.performance.now();const{instanceNo:r,transmuxer:s}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:r,cmd:"flush",chunkMeta:t});else if(s){const u=s.flush(t);xm(u)?u.then(f=>{this.handleFlushResult(f,t)}).catch(f=>{this.transmuxerError(f,t,"transmuxer-interface flush error")}):this.handleFlushResult(u,t)}}transmuxerError(t,r,s){this.hls&&(this.error=t,this.hls.trigger(G.ERROR,{type:Mt.MEDIA_ERROR,details:Me.FRAG_PARSING_ERROR,chunkMeta:r,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:t,err:t,reason:s}))}handleFlushResult(t,r){t.forEach(s=>{this.handleTransmuxComplete(s)}),this.onFlush(r)}configureTransmuxer(t){const{instanceNo:r,transmuxer:s}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:r,cmd:"configure",config:t}):s&&s.configure(t)}handleTransmuxComplete(t){t.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(t)}}class ET extends iu{constructor(t,r){super(r,t.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=t}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(t,r,s){const u=r==null?void 0:r.renditionReports;if(u){let f=-1;for(let c=0;c<u.length;c++){const v=u[c];let y;try{y=new self.URL(v.URI,r.url).href}catch(E){this.warn(`Could not construct new URL for Rendition Report: ${E}`),y=v.URI||""}if(y===t){f=c;break}y===t.substring(0,y.length)&&(f=c)}if(f!==-1){const c=u[f],v=parseInt(c["LAST-MSN"])||(r==null?void 0:r.lastPartSn);let y=parseInt(c["LAST-PART"])||(r==null?void 0:r.lastPartIndex);if(this.hls.config.lowLatencyMode){const A=Math.min(r.age-r.partTarget,r.targetduration);y>=0&&A>r.partTarget&&(y+=1)}const E=s&&vx(s);return new bx(v,y>=0?y:void 0,E)}}}loadPlaylist(t){this.clearTimer()}loadingPlaylist(t,r){this.clearTimer()}shouldLoadPlaylist(t){return this.canLoad&&!!t&&!!t.url&&(!t.details||t.details.live)}getUrlWithDirectives(t,r){if(r)try{return r.addDirectives(t)}catch(s){this.warn(`Could not construct new URL with HLS Delivery Directives: ${s}`)}return t}playlistLoaded(t,r,s){const{details:u,stats:f}=r,c=self.performance.now(),v=f.loading.first?Math.max(0,c-f.loading.first):0;u.advancedDateTime=Date.now()-v;const y=this.hls.config.timelineOffset;if(y!==u.appliedTimelineOffset){const A=Math.max(y||0,0);u.appliedTimelineOffset=A,u.fragments.forEach(L=>{L.start=L.playlistOffset+A})}if(u.live||s!=null&&s.live){const A="levelInfo"in r?r.levelInfo:r.track;if(u.reloaded(s),s&&u.fragments.length>0){BM(s,u);const z=u.playlistParsingError;if(z){this.warn(z);const Q=this.hls;if(!Q.config.ignorePlaylistParsingErrors){var E;const{networkDetails:Z}=r;return void Q.trigger(G.ERROR,{type:Mt.NETWORK_ERROR,details:Me.LEVEL_PARSING_ERROR,fatal:!1,url:u.url,error:z,reason:z.message,level:r.level||void 0,parent:(E=u.fragments[0])==null?void 0:E.type,networkDetails:Z,stats:f})}u.playlistParsingError=null}}u.requestScheduled===-1&&(u.requestScheduled=f.loading.start);const L=this.hls.mainForwardBufferInfo,T=L?L.end-L.len:0,M=iI(u,1e3*(u.edge-T));if(u.requestScheduled+M<c?u.requestScheduled=c:u.requestScheduled+=M,this.log(`live playlist ${t} ${u.advanced?"REFRESHED "+u.lastPartSn+"-"+u.lastPartIndex:u.updated?"UPDATED":"MISSED"}`),!this.canLoad||!u.live)return;let O,U,$;if(u.canBlockReload&&u.endSN&&u.advanced){const z=this.hls.config.lowLatencyMode,Q=u.lastPartSn,Z=u.endSN,ie=u.lastPartIndex,se=Q===Z;ie!==-1?se?(U=Z+1,$=z?0:ie):(U=Q,$=z?ie+1:u.maxPartIndex):U=Z+1;const ye=u.age,N=ye+u.ageHeader;let re=Math.min(N-u.partTarget,1.5*u.targetduration);if(re>0){if(N>3*u.targetduration)this.log(`Playlist last advanced ${ye.toFixed(2)}s ago. Omitting segment and part directives.`),U=void 0,$=void 0;else if(s!=null&&s.tuneInGoal&&N-u.partTarget>s.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${s.tuneInGoal} to: ${re} with playlist age: ${u.age}`),re=0;else{const ne=Math.floor(re/u.targetduration);U+=ne,$!==void 0&&($+=Math.round(re%u.targetduration/u.partTarget)),this.log(`CDN Tune-in age: ${u.ageHeader}s last advanced ${ye.toFixed(2)}s goal: ${re} skip sn ${ne} to part ${$}`)}u.tuneInGoal=re}if(O=this.getDeliveryDirectives(u,r.deliveryDirectives,U,$),z||!se)return u.requestScheduled=c,void this.loadingPlaylist(A,O)}else(u.canBlockReload||u.canSkipUntil)&&(O=this.getDeliveryDirectives(u,r.deliveryDirectives,U,$));O&&U!==void 0&&u.canBlockReload&&(u.requestScheduled=f.loading.first+Math.max(M-2*v,M/2)),this.scheduleLoading(A,O,u)}else this.clearTimer()}scheduleLoading(t,r,s){const u=s||t.details;if(!u)return void this.loadingPlaylist(t,r);const f=self.performance.now(),c=u.requestScheduled;if(f>=c)return void this.loadingPlaylist(t,r);const v=c-f;this.log(`reload live playlist ${t.name||t.bitrate+"bps"} in ${Math.round(v)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(t,r),v)}getDeliveryDirectives(t,r,s,u){let f=vx(t);return r!=null&&r.skip&&t.deltaUpdateFailed&&(s=r.msn,u=r.part,f=yx),new bx(s,u,f)}checkRetry(t){const r=t.details,s=m0(t),u=t.errorAction,{action:f,retryCount:c=0,retryConfig:v}=u||{},y=!!u&&!!v&&(f===v0||!u.resolved&&f===su);if(y){var E;if(c>=v.maxNumRetry)return!1;if(s&&(E=t.context)!=null&&E.deliveryDirectives)this.warn(`Retrying playlist loading ${c+1}/${v.maxNumRetry} after "${r}" without delivery-directives`),this.loadPlaylist();else{const A=GE(v,c);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),A),this.warn(`Retrying playlist loading ${c+1}/${v.maxNumRetry} after "${r}" in ${A}ms`)}t.levelRetry=!0,u.resolved=!0}return y}}function GI(a,t){if(a.length!==t.length)return!1;for(let r=0;r<a.length;r++)if(!Im(a[r].attrs,t[r].attrs))return!1;return!0}function Im(a,t,r){const s=a["STABLE-RENDITION-ID"];return s&&!r?s===t["STABLE-RENDITION-ID"]:!(r||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(u=>a[u]!==t[u])}function TT(a,t){return t.label.toLowerCase()===a.name.toLowerCase()&&(!t.language||t.language.toLowerCase()===(a.lang||"").toLowerCase())}class oO{constructor(t){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=t}destroy(){this.tracks=this.queues=null}append(t,r,s){if(this.queues===null||this.tracks===null)return;const u=this.queues[r];u.push(t),u.length!==1||s||this.executeNext(r)}appendBlocker(t){return new Promise(r=>{const s={label:"async-blocker",execute:r,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(s,t)})}prependBlocker(t){return new Promise(r=>{if(this.queues){const s={label:"async-blocker-prepend",execute:r,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[t].unshift(s)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(t=>{var r;const s=(r=t[0])==null?void 0:r.label;s!=="async-blocker"&&s!=="async-blocker-prepend"||(t[0].execute(),t.splice(0,1))})}unblockAudio(t){this.queues!==null&&this.queues.audio[0]===t&&this.shiftAndExecuteNext("audio")}executeNext(t){if(this.queues===null||this.tracks===null)return;const r=this.queues[t];if(r.length){const u=r[0];try{u.execute()}catch(f){var s;if(u.onError(f),this.queues===null||this.tracks===null)return;const c=(s=this.tracks[t])==null?void 0:s.buffer;c!=null&&c.updating||this.shiftAndExecuteNext(t)}}}shiftAndExecuteNext(t){this.queues!==null&&(this.queues[t].shift(),this.executeNext(t))}current(t){var r;return((r=this.queues)==null?void 0:r[t][0])||null}toString(){const{queues:t,tracks:r}=this;return t===null||r===null?"<destroyed>":`
${this.list("video")}
${this.list("audio")}
${this.list("audiovideo")}}`}list(t){var r,s;return(r=this.queues)!=null&&r[t]||(s=this.tracks)!=null&&s[t]?`${t}: (${this.listSbInfo(t)}) ${this.listOps(t)}`:""}listSbInfo(t){var r;const s=(r=this.tracks)==null?void 0:r[t],u=s==null?void 0:s.buffer;return u?`SourceBuffer${u.updating?" updating":""}${s.ended?" ended":""}${s.ending?" ending":""}`:"none"}listOps(t){var r;return((r=this.queues)==null?void 0:r[t].map(s=>s.label).join(", "))||""}}const HI=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,VI="HlsJsTrackRemovedError";class lO extends Error{constructor(t){super(t),this.name=VI}}function KI(a){const t=a.querySelectorAll("source");[].slice.call(t).forEach(r=>{a.removeChild(r)})}function ST(a){return a==="audio"?1:0}class wT{constructor(t){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=t,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(t){this.streamController=t}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:t}=this;t.on(G.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.on(G.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(G.MANIFEST_PARSED,this.onManifestParsed,this),t.on(G.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(G.BUFFER_CODECS,this.onBufferCodecs,this),t.on(G.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:t}=this;t.off(G.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.off(G.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(G.MANIFEST_PARSED,this.onManifestParsed,this),t.off(G.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(G.BUFFER_CODECS,this.onBufferCodecs,this),t.off(G.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(t,r){const s=this.hls.levels[r.droppedLevel];this.isLevelAllowed(s)&&this.restrictedLevels.push({bitrate:s.bitrate,height:s.height,width:s.width})}onMediaAttaching(t,r){this.media=r.media instanceof HTMLVideoElement?r.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(t,r){const s=this.hls;this.restrictedLevels=[],this.firstLevel=r.firstLevel,s.config.capLevelToPlayerSize&&r.video&&this.startCapping()}onLevelsUpdated(t,r){this.timer&&vt(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(t,r){this.hls.config.capLevelToPlayerSize&&r.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0)return void(this.clientRect=null);const t=this.hls.levels;if(t.length){const r=this.hls,s=this.getMaxLevel(t.length-1);s!==this.autoLevelCapping&&r.logger.log(`Setting autoLevelCapping to ${s}: ${t[s].height}p@${t[s].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),r.autoLevelCapping=s,r.autoLevelEnabled&&r.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=r.autoLevelCapping}}}getMaxLevel(t){const r=this.hls.levels;if(!r.length)return-1;const s=r.filter((u,f)=>this.isLevelAllowed(u)&&f<=t);return this.clientRect=null,wT.getMaxLevelByMediaSize(s,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const t=this.media,r={width:0,height:0};if(t){const s=t.getBoundingClientRect();r.width=s.width,r.height=s.height,r.width||r.height||(r.width=s.right-s.left||t.width||0,r.height=s.bottom-s.top||t.height||0)}return this.clientRect=r,r}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let t=1;if(!this.hls.config.ignoreDevicePixelRatio)try{t=self.devicePixelRatio}catch{}return Math.min(t,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(t){return!this.restrictedLevels.some(r=>t.bitrate===r.bitrate&&t.width===r.width&&t.height===r.height)}static getMaxLevelByMediaSize(t,r,s){if(t==null||!t.length)return-1;let u=t.length-1;const f=Math.max(r,s);for(let y=0;y<t.length;y+=1){const E=t[y];if((E.width>=f||E.height>=f)&&(c=E,!(v=t[y+1])||c.width!==v.width||c.height!==v.height)){u=y;break}}var c,v;return u}}const Us={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},uO={HLS:"h"},cO="CMCD-Object",zI="CMCD-Request",dO="CMCD-Session",hO="CMCD-Status",fO={[cO]:["br","d","ot","tb"],[zI]:["bl","dl","mtp","nor","nrr","su"],[dO]:["cid","pr","sf","sid","st","v"],[hO]:["bs","rtp"]};class qf{constructor(t,r){Array.isArray(t)&&(t=t.map(s=>s instanceof qf?s:new qf(s))),this.value=t,this.params=r}}function pO(a,t,r,s){return new Error(`failed to ${a} "${u=t,Array.isArray(u)?JSON.stringify(u):u instanceof Map?"Map{}":u instanceof Set?"Set{}":typeof u=="object"?JSON.stringify(u):String(u)}" as ${r}`,{cause:s});var u}function dl(a,t,r){return pO("serialize",a,t,r)}class qI{constructor(t){this.description=t}}const WI="Bare Item";function gO(a){if(ArrayBuffer.isView(a)===!1)throw dl(a,"Byte Sequence");return`:${t=a,btoa(String.fromCharCode(...t))}:`;var t}function YI(a){if(function(t){return t<-999999999999999||999999999999999<t}(a))throw dl(a,"Integer");return a.toString()}function mO(a){const t=SI(a,3);if(Math.floor(Math.abs(t)).toString().length>12)throw dl(a,"Decimal");const r=t.toString();return r.includes(".")?r:`${r}.0`}const yO=/[\x00-\x1f\x7f]+/;function QI(a){const t=(r=a).description||r.toString().slice(7,-1);var r;if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(t)===!1)throw dl(t,"Token");return t}function AT(a){switch(typeof a){case"number":if(!vt(a))throw dl(a,WI);return Number.isInteger(a)?YI(a):mO(a);case"string":return function(t){if(yO.test(t))throw dl(t,"String");return`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}(a);case"symbol":return QI(a);case"boolean":return function(t){if(typeof t!="boolean")throw dl(t,"Boolean");return t?"?1":"?0"}(a);case"object":if(a instanceof Date)return function(t){return`@${YI(t.getTime()/1e3)}`}(a);if(a instanceof Uint8Array)return gO(a);if(a instanceof qI)return QI(a);default:throw dl(a,WI)}}function kT(a){if(/^[a-z*][a-z0-9\-_.*]*$/.test(a)===!1)throw dl(a,"Key");return a}function xT(a){return a==null?"":Object.entries(a).map(([t,r])=>r===!0?`;${kT(t)}`:`;${kT(t)}=${AT(r)}`).join("")}function XI(a){return a instanceof qf?`${AT(a.value)}${xT(a.params)}`:AT(a)}function vO(a,t={whitespace:!0}){if(typeof a!="object")throw dl(a,"Dict");const r=a instanceof Map?a.entries():Object.entries(a),s=t!=null&&t.whitespace?" ":"";return Array.from(r).map(([u,f])=>{!(f instanceof qf)&&(f=new qf(f));let c=kT(u);var v;return f.value===!0?c+=xT(f.params):(c+="=",Array.isArray(f.value)?c+=`(${(v=f).value.map(XI).join(" ")})${xT(v.params)}`:c+=XI(f)),c}).join(`,${s}`)}const M0=a=>Math.round(a),O0=a=>100*M0(a/100),bO={br:M0,d:M0,bl:O0,dl:O0,mtp:O0,nor:(a,t)=>(t!=null&&t.baseUrl&&(a=function(r,s){const u=new URL(r),f=new URL(s);if(u.origin!==f.origin)return r;const c=u.pathname.split("/").slice(1),v=f.pathname.split("/").slice(1,-1);for(;c[0]===v[0];)c.shift(),v.shift();for(;v.length;)v.shift(),c.unshift("..");return c.join("/")}(a,t.baseUrl)),encodeURIComponent(a)),rtp:O0,tb:M0};function EO(a,t){const r={};if(a==null||typeof a!="object")return r;const s=Object.keys(a).sort(),u=cr({},bO,t==null?void 0:t.formatters),f=t==null?void 0:t.filter;return s.forEach(c=>{if(f!=null&&f(c))return;let v=a[c];const y=u[c];y&&(v=y(v,t)),c==="v"&&v===1||c=="pr"&&v===1||function(E){return typeof E=="number"?vt(E):E!=null&&E!==""&&E!==!1}(v)&&(function(E){return E==="ot"||E==="sf"||E==="st"}(c)&&typeof v=="string"&&(v=new qI(v)),r[c]=v)}),r}function JI(a,t={}){return a?function(r,s){return vO(r,s)}(EO(a,t),cr({whitespace:!1},t)):""}function TO(a,t,r){return cr(a,function(s,u={}){const f={};if(!s)return f;const c=Object.entries(s),v=Object.entries(fO).concat(Object.entries((u==null?void 0:u.customHeaderMap)||{})),y=c.reduce((E,A)=>{var L,T;const[M,O]=A,U=((L=v.find($=>$[1].includes(M)))===null||L===void 0?void 0:L[0])||zI;return(T=E[U])!==null&&T!==void 0||(E[U]={}),E[U][M]=O,E},{});return Object.entries(y).reduce((E,[A,L])=>(E[A]=JI(L,u),E),f)}(t,r))}const ZI=/CMCD=[^&#]+/;function SO(a,t,r){const s=function(f,c={}){if(!f)return"";const v=JI(f,c);return`CMCD=${encodeURIComponent(v)}`}(t,r);if(!s)return a;if(ZI.test(a))return a.replace(ZI,s);const u=a.includes("?")?"&":"?";return`${a}${u}${s}`}function eL(a,t,r,s){a&&Object.keys(t).forEach(u=>{const f=a.filter(c=>c.groupId===u).map(c=>{const v=cr({},c);return v.details=void 0,v.attrs=new Fr(v.attrs),v.url=v.attrs.URI=tL(c.url,c.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",r),v.groupId=v.attrs["GROUP-ID"]=t[u],v.attrs["PATHWAY-ID"]=s,v});a.push(...f)})}function tL(a,t,r,s){const{HOST:u,PARAMS:f,[r]:c}=s;let v;t&&(v=c==null?void 0:c[t],v&&(a=v));const y=new self.URL(a);return u&&!v&&(y.host=u),f&&Object.keys(f).sort().forEach(E=>{E&&y.searchParams.set(E,f[E])}),y.href}class Wf extends iu{constructor(t){super("eme",t.logger),this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this.os=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=Wf.CDMCleanupPromise?[Wf.CDMCleanupPromise]:[],this.onMediaEncrypted=r=>{const{initDataType:s,initData:u}=r,f=`"${r.type}" event: init data type: "${s}"`;if(this.debug(f),u!==null){if(!this.keyFormatPromise){let c=Object.keys(this.keySystemAccessPromises);c.length||(c=A0(this.config));const v=c.map(eT).filter(y=>!!y);this.keyFormatPromise=this.getKeyFormatPromise(v)}this.keyFormatPromise.then(c=>{const v=JE(c);let y,E;if(s==="sinf"){if(v!==ir.FAIRPLAY)return void this.warn(`Ignoring unexpected "${r.type}" event with init data type: "${s}" for selected key-system ${v}`);const O=gi(new Uint8Array(u));try{const U=ix(WE(JSON.parse(O).sinf));if(!U)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");y=new Uint8Array(U.subarray(8,24)),E=ir.FAIRPLAY}catch(U){return void this.warn(`${f} Failed to parse sinf: ${U}`)}}else{if(v!==ir.WIDEVINE&&v!==ir.PLAYREADY)return void this.warn(`Ignoring unexpected "${r.type}" event with init data type: "${s}" for selected key-system ${v}`);const O=function(z){const Q=[];if(z instanceof ArrayBuffer){const Z=z.byteLength;let ie=0;for(;ie+32<Z;){const se=fM(new DataView(z,ie));Q.push(se),ie+=se.size}}return Q}(u),U=O.filter(z=>!!z.systemId&&ZE(z.systemId)===v);U.length>1&&this.warn(`${f} Using first of ${U.length} pssh found for selected key-system ${v}`);const $=U[0];if(!$)return void(O.length===0||O.some(z=>!z.systemId)?this.warn(`${f} contains incomplete or invalid pssh data`):this.log(`ignoring ${f} for ${O.map(z=>ZE(z.systemId)).join(",")} pssh data in favor of playlist keys`));if(E=ZE($.systemId),$.version===0&&$.data)if(E===ir.WIDEVINE){const z=$.data.length-22;y=new Uint8Array($.data.subarray(z,z+16))}else E===ir.PLAYREADY&&(y=Vx($.data))}if(!E||!y)return;const A=sl(y),{keyIdToKeySessionPromise:L,mediaKeySessions:T}=this;let M=L[A];for(let O=0;O<T.length;O++){const U=T[O],$=U.decryptdata;if(!$.keyId)continue;const z=sl($.keyId);if(A===z||$.uri.replace(/-/g,"").indexOf(A)!==-1){if(M=L[z],$.pssh)break;delete L[z],$.pssh=new Uint8Array(u),$.keyId=y,M=L[A]=M.then(()=>this.generateRequestWithPreferredKeySession(U,s,u,"encrypted-event-key-match")),M.catch(Q=>this.handleError(Q));break}}if(!M){if(E!==v)return void this.log(`Ignoring "${r.type}" event with ${E} init data for selected key-system ${v}`);M=L[A]=this.getKeySystemSelectionPromise([E]).then(({keySystem:O,mediaKeys:U})=>{var $;this.throwIfDestroyed();const z=new bm("ISO-23001-7",A,($=eT(O))!=null?$:"");return z.pssh=new Uint8Array(u),z.keyId=y,this.attemptSetMediaKeys(O,U).then(()=>{this.throwIfDestroyed();const Q=this.createMediaKeySessionContext({decryptdata:z,keySystem:O,mediaKeys:U});return this.generateRequestWithPreferredKeySession(Q,s,u,"encrypted-event-no-match")})}),M.catch(O=>this.handleError(O))}})}},this.onWaitingForKey=r=>{this.log(`"${r.type}" event`)},this.hls=t,this.config=t.config,this.registerListeners()}destroy(){const t=this.media;this.unregisterListeners(),this.onMediaDetached(),this.us(t);const r=this.config;r.requestMediaKeySystemAccessFunc=null,r.licenseXhrSetup=r.licenseResponseCallback=void 0,r.drmSystems=r.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){this.hls.on(G.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(G.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(G.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(G.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(G.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(G.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(G.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(G.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(t){const{drmSystems:r,widevineLicenseUrl:s}=this.config,u=r[t];return u?u.licenseUrl:t===ir.WIDEVINE&&s?s:void 0}getLicenseServerUrlOrThrow(t){const r=this.getLicenseServerUrl(t);if(r===void 0)throw new Error(`no license server URL configured for key-system "${t}"`);return r}getServerCertificateUrl(t){const{drmSystems:r}=this.config,s=r[t];if(s)return s.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${t}"]`)}attemptKeySystemAccess(t){const r=this.hls.levels,s=(c,v,y)=>!!c&&y.indexOf(c)===v,u=r.map(c=>c.audioCodec).filter(s),f=r.map(c=>c.videoCodec).filter(s);return u.length+f.length===0&&f.push("avc1.42e01e"),new Promise((c,v)=>{const y=E=>{const A=E.shift();this.getMediaKeysPromise(A,u,f).then(L=>c({keySystem:A,mediaKeys:L})).catch(L=>{E.length?y(E):v(L instanceof Fa?L:new Fa({type:Mt.KEY_SYSTEM_ERROR,details:Me.KEY_SYSTEM_NO_ACCESS,error:L,fatal:!0},L.message))})};y(t)})}requestMediaKeySystemAccess(t,r){const{requestMediaKeySystemAccessFunc:s}=this.config;if(typeof s!="function"){let u=`Configured requestMediaKeySystemAccess is not a function ${s}`;return Gx===null&&self.location.protocol==="http:"&&(u=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(u))}return s(t,r)}getMediaKeysPromise(t,r,s){const u=function(v,y,E,A){let L;switch(v){case ir.FAIRPLAY:L=["cenc","sinf"];break;case ir.WIDEVINE:case ir.PLAYREADY:L=["cenc"];break;case ir.CLEARKEY:L=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${v}`)}return function(T,M,O,U){return[{initDataTypes:T,persistentState:U.persistentState||"optional",distinctiveIdentifier:U.distinctiveIdentifier||"optional",sessionTypes:U.sessionTypes||[U.sessionType||"temporary"],audioCapabilities:M.map($=>({contentType:`audio/mp4; codecs=${$}`,robustness:U.audioRobustness||"",encryptionScheme:U.audioEncryptionScheme||null})),videoCapabilities:O.map($=>({contentType:`video/mp4; codecs=${$}`,robustness:U.videoRobustness||"",encryptionScheme:U.videoEncryptionScheme||null}))}]}(L,y,E,A)}(t,r,s,this.config.drmSystemOptions),f=this.keySystemAccessPromises[t];let c=f==null?void 0:f.keySystemAccess;if(!c){this.log(`Requesting encrypted media "${t}" key-system access with config: ${Or(u)}`),c=this.requestMediaKeySystemAccess(t,u);const v=this.keySystemAccessPromises[t]={keySystemAccess:c};return c.catch(y=>{this.log(`Failed to obtain access to key-system "${t}": ${y}`)}),c.then(y=>{this.log(`Access for key-system "${y.keySystem}" obtained`);const E=this.fetchServerCertificate(t);return this.log(`Create media-keys for "${t}"`),v.mediaKeys=y.createMediaKeys().then(A=>(this.log(`Media-keys created for "${t}"`),E.then(L=>L?this.setMediaKeysServerCertificate(A,t,L):A))),v.mediaKeys.catch(A=>{this.error(`Failed to create media-keys for "${t}"}: ${A}`)}),v.mediaKeys})}return c.then(()=>f.mediaKeys)}createMediaKeySessionContext({decryptdata:t,keySystem:r,mediaKeys:s}){this.log(`Creating key-system session "${r}" keyId: ${sl(t.keyId||[])}`);const u=s.createSession(),f={decryptdata:t,keySystem:r,mediaKeys:s,mediaKeysSession:u,keyStatus:"status-pending"};return this.mediaKeySessions.push(f),f}renewKeySession(t){const r=t.decryptdata;if(r.pssh){const s=this.createMediaKeySessionContext(t),u=this.getKeyIdString(r),f="cenc";this.keyIdToKeySessionPromise[u]=this.generateRequestWithPreferredKeySession(s,f,r.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(t)}getKeyIdString(t){if(!t)throw new Error("Could not read keyId of undefined decryptdata");if(t.keyId===null)throw new Error("keyId is null");return sl(t.keyId)}updateKeySession(t,r){var s;const u=t.mediaKeysSession;return this.log(`Updating key-session "${u.sessionId}" for keyID ${sl(((s=t.decryptdata)==null?void 0:s.keyId)||[])}
      } (data length: ${r&&r.byteLength})`),u.update(r)}selectKeySystemFormat(t){const r=Object.keys(t.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${t.sn} ${t.type}: ${t.level}) key formats ${r.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(r)),this.keyFormatPromise}getKeyFormatPromise(t){return new Promise((r,s)=>{const u=A0(this.config),f=t.map(JE).filter(c=>!!c&&u.indexOf(c)!==-1);return this.getKeySystemSelectionPromise(f).then(({keySystem:c})=>{const v=eT(c);v?r(v):s(new Error(`Unable to find format for key-system "${c}"`))}).catch(s)})}loadKey(t){const r=t.keyInfo.decryptdata,s=this.getKeyIdString(r),u=`(keyId: ${s} format: "${r.keyFormat}" method: ${r.method} uri: ${r.uri})`;this.log(`Starting session for key ${u}`);let f=this.keyIdToKeySessionPromise[s];return f||(f=this.getKeySystemForKeyPromise(r).then(({keySystem:c,mediaKeys:v})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${t.frag.sn} ${t.frag.type}: ${t.frag.level} using key ${u}`),this.attemptSetMediaKeys(c,v).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:c,mediaKeys:v,decryptdata:r}))))),(this.keyIdToKeySessionPromise[s]=f.then(c=>{const v=r.pssh?r.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(c,"cenc",v,"playlist-key")})).catch(c=>this.handleError(c))),f}throwIfDestroyed(t="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(t){this.hls&&(this.error(t.message),t instanceof Fa?this.hls.trigger(G.ERROR,t.data):this.hls.trigger(G.ERROR,{type:Mt.KEY_SYSTEM_ERROR,details:Me.KEY_SYSTEM_NO_KEYS,error:t,fatal:!0}))}getKeySystemForKeyPromise(t){const r=this.getKeyIdString(t),s=this.keyIdToKeySessionPromise[r];if(!s){const u=JE(t.keyFormat),f=u?[u]:A0(this.config);return this.attemptKeySystemAccess(f)}return s}getKeySystemSelectionPromise(t){if(t.length||(t=A0(this.config)),t.length===0)throw new Fa({type:Mt.KEY_SYSTEM_ERROR,details:Me.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${Or({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(t)}attemptSetMediaKeys(t,r){const s=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${t}"`);const u=Promise.all(s).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(r)});return this.setMediaKeysQueue.push(u),u.then(()=>{this.log(`Media-keys set for "${t}"`),s.push(u),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(f=>s.indexOf(f)===-1)})}generateRequestWithPreferredKeySession(t,r,s,u){var f,c;const v=(f=this.config.drmSystems)==null||(c=f[t.keySystem])==null?void 0:c.generateRequest;if(v)try{const O=v.call(this.hls,r,s,t);if(!O)throw new Error("Invalid response from configured generateRequest filter");r=O.initDataType,s=O.initData?O.initData:null,t.decryptdata.pssh=s?new Uint8Array(s):null}catch(O){var y;if(this.warn(O.message),(y=this.hls)!=null&&y.config.debug)throw O}if(s===null)return this.log(`Skipping key-session request for "${u}" (no initData)`),Promise.resolve(t);const E=this.getKeyIdString(t.decryptdata);this.log(`Generating key-session request for "${u}": ${E} (init data type: ${r} length: ${s?s.byteLength:null})`);const A=new oT,L=t.ls=O=>{const U=t.mediaKeysSession;if(!U)return void A.emit("error",new Error("invalid state"));const{messageType:$,message:z}=O;this.log(`"${$}" message event for session "${U.sessionId}" message size: ${z.byteLength}`),$==="license-request"||$==="license-renewal"?this.renewLicense(t,z).catch(Q=>{A.eventNames().length?A.emit("error",Q):this.handleError(Q)}):$==="license-release"?t.keySystem===ir.FAIRPLAY&&(this.updateKeySession(t,YE("acknowledged")),this.removeSession(t)):this.warn(`unhandled media key message type "${$}"`)},T=t.cs=O=>{if(!t.mediaKeysSession)return void A.emit("error",new Error("invalid state"));this.onKeyStatusChange(t);const U=t.keyStatus;A.emit("keyStatus",U),U==="expired"&&(this.warn(`${t.keySystem} expired for key ${E}`),this.renewKeySession(t))};t.mediaKeysSession.addEventListener("message",L),t.mediaKeysSession.addEventListener("keystatuseschange",T);const M=new Promise((O,U)=>{A.on("error",U),A.on("keyStatus",$=>{$.startsWith("usable")?O():$==="output-restricted"?U(new Fa({type:Mt.KEY_SYSTEM_ERROR,details:Me.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):$==="internal-error"?U(new Fa({type:Mt.KEY_SYSTEM_ERROR,details:Me.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${$}"`)):$==="expired"?U(new Error("key expired while generating request")):this.warn(`unhandled key status change "${$}"`)})});return t.mediaKeysSession.generateRequest(r,s).then(()=>{var O;this.log(`Request generated for key-session "${(O=t.mediaKeysSession)==null?void 0:O.sessionId}" keyId: ${E}`)}).catch(O=>{throw new Fa({type:Mt.KEY_SYSTEM_ERROR,details:Me.KEY_SYSTEM_NO_SESSION,error:O,fatal:!1},`Error generating key-session request: ${O}`)}).then(()=>M).catch(O=>{throw A.removeAllListeners(),this.removeSession(t),O}).then(()=>(A.removeAllListeners(),t))}onKeyStatusChange(t){t.mediaKeysSession.keyStatuses.forEach((r,s)=>{if(typeof s=="string"&&typeof r=="object"){const u=s;s=r,r=u}this.log(`key status change "${r}" for keyStatuses keyId: ${sl("buffer"in s?new Uint8Array(s.buffer,s.byteOffset,s.byteLength):new Uint8Array(s))} session keyId: ${sl(new Uint8Array(t.decryptdata.keyId||[]))} uri: ${t.decryptdata.uri}`),t.keyStatus=r})}fetchServerCertificate(t){const r=this.config,s=new r.loader(r),u=this.getServerCertificateUrl(t);return u?(this.log(`Fetching server certificate for "${t}"`),new Promise((f,c)=>{const v={responseType:"arraybuffer",url:u},y=r.certLoadPolicy.default,E={loadPolicy:y,timeout:y.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},A={onSuccess:(L,T,M,O)=>{f(L.data)},onError:(L,T,M,O)=>{c(new Fa({type:Mt.KEY_SYSTEM_ERROR,details:Me.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:M,response:rr({url:v.url,data:void 0},L)},`"${t}" certificate request failed (${u}). Status: ${L.code} (${L.text})`))},onTimeout:(L,T,M)=>{c(new Fa({type:Mt.KEY_SYSTEM_ERROR,details:Me.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:M,response:{url:v.url,data:void 0}},`"${t}" certificate request timed out (${u})`))},onAbort:(L,T,M)=>{c(new Error("aborted"))}};s.load(v,E,A)})):Promise.resolve()}setMediaKeysServerCertificate(t,r,s){return new Promise((u,f)=>{t.setServerCertificate(s).then(c=>{this.log(`setServerCertificate ${c?"success":"not supported by CDM"} (${s==null?void 0:s.byteLength}) on "${r}"`),u(t)}).catch(c=>{f(new Fa({type:Mt.KEY_SYSTEM_ERROR,details:Me.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:c,fatal:!0},c.message))})})}renewLicense(t,r){return this.requestLicense(t,new Uint8Array(r)).then(s=>this.updateKeySession(t,new Uint8Array(s)).catch(u=>{throw new Fa({type:Mt.KEY_SYSTEM_ERROR,details:Me.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:u,fatal:!0},u.message)}))}unpackPlayReadyKeyMessage(t,r){const s=String.fromCharCode.apply(null,new Uint16Array(r.buffer));if(!s.includes("PlayReadyKeyMessage"))return t.setRequestHeader("Content-Type","text/xml; charset=utf-8"),r;const u=new DOMParser().parseFromString(s,"application/xml"),f=u.querySelectorAll("HttpHeader");if(f.length>0){let A;for(let L=0,T=f.length;L<T;L++){var c,v;A=f[L];const M=(c=A.querySelector("name"))==null?void 0:c.textContent,O=(v=A.querySelector("value"))==null?void 0:v.textContent;M&&O&&t.setRequestHeader(M,O)}}const y=u.querySelector("Challenge"),E=y==null?void 0:y.textContent;if(!E)throw new Error("Cannot find <Challenge> in key message");return YE(atob(E))}setupLicenseXHR(t,r,s,u){const f=this.config.licenseXhrSetup;return f?Promise.resolve().then(()=>{if(!s.decryptdata)throw new Error("Key removed");return f.call(this.hls,t,r,s,u)}).catch(c=>{if(!s.decryptdata)throw c;return t.open("POST",r,!0),f.call(this.hls,t,r,s,u)}).then(c=>(t.readyState||t.open("POST",r,!0),{xhr:t,licenseChallenge:c||u})):(t.open("POST",r,!0),Promise.resolve({xhr:t,licenseChallenge:u}))}requestLicense(t,r){const s=this.config.keyLoadPolicy.default;return new Promise((u,f)=>{const c=this.getLicenseServerUrlOrThrow(t.keySystem);this.log(`Sending license request to URL: ${c}`);const v=new XMLHttpRequest;v.responseType="arraybuffer",v.onreadystatechange=()=>{if(!this.hls||!t.mediaKeysSession)return f(new Error("invalid state"));if(v.readyState===4)if(v.status===200){this.os=0;let y=v.response;this.log(`License received ${y instanceof ArrayBuffer?y.byteLength:y}`);const E=this.config.licenseResponseCallback;if(E)try{y=E.call(this.hls,v,c,t)}catch(A){this.error(A)}u(y)}else{const y=s.errorRetry,E=y?y.maxNumRetry:0;if(this.os++,this.os>E||v.status>=400&&v.status<500)f(new Fa({type:Mt.KEY_SYSTEM_ERROR,details:Me.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:v,response:{url:c,data:void 0,code:v.status,text:v.statusText}},`License Request XHR failed (${c}). Status: ${v.status} (${v.statusText})`));else{const A=E-this.os+1;this.warn(`Retrying license request, ${A} attempts left`),this.requestLicense(t,r).then(u,f)}}},t.licenseXhr&&t.licenseXhr.readyState!==XMLHttpRequest.DONE&&t.licenseXhr.abort(),t.licenseXhr=v,this.setupLicenseXHR(v,c,t,r).then(({xhr:y,licenseChallenge:E})=>{t.keySystem==ir.PLAYREADY&&(E=this.unpackPlayReadyKeyMessage(y,E)),y.send(E)})})}onMediaAttached(t,r){if(!this.config.emeEnabled)return;const s=r.media;this.media=s,s.removeEventListener("encrypted",this.onMediaEncrypted),s.removeEventListener("waitingforkey",this.onWaitingForKey),s.addEventListener("encrypted",this.onMediaEncrypted),s.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const t=this.media;t&&(t.removeEventListener("encrypted",this.onMediaEncrypted),t.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null)}us(t){var r;const s=this.mediaKeySessions;this.os=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},bm.clearKeyUriToKeyIdMap();const u=s.length;Wf.CDMCleanupPromise=Promise.all(s.map(f=>this.removeSession(f)).concat(t==null||(r=t.setMediaKeys(null))==null?void 0:r.catch(f=>{var c;this.log(`Could not clear media keys: ${f}`),(c=this.hls)==null||c.trigger(G.ERROR,{type:Mt.OTHER_ERROR,details:Me.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${f}`)})}))).then(()=>{u&&(this.log("finished closing key sessions and clearing media keys"),s.length=0)}).catch(f=>{var c;this.log(`Could not close sessions and clear media keys: ${f}`),(c=this.hls)==null||c.trigger(G.ERROR,{type:Mt.OTHER_ERROR,details:Me.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${f}`)})})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(t,{sessionKeys:r}){if(r&&this.config.emeEnabled&&!this.keyFormatPromise){const s=r.reduce((u,f)=>(u.indexOf(f.keyFormat)===-1&&u.push(f.keyFormat),u),[]);this.log(`Selecting key-system from session-keys ${s.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(s)}}removeSession(t){const{mediaKeysSession:r,licenseXhr:s}=t;if(r){this.log(`Remove licenses and keys and close session ${r.sessionId}`),t.ls&&(r.removeEventListener("message",t.ls),t.ls=void 0),t.cs&&(r.removeEventListener("keystatuseschange",t.cs),t.cs=void 0),s&&s.readyState!==XMLHttpRequest.DONE&&s.abort(),t.mediaKeysSession=t.decryptdata=t.licenseXhr=void 0;const u=this.mediaKeySessions.indexOf(t);u>-1&&this.mediaKeySessions.splice(u,1);const{drmSystemOptions:f}=this.config;return(function(v){var y;return v.sessionType==="persistent-license"||!((y=v.sessionTypes)==null||!y.some(E=>E==="persistent-license"))}(f)?new Promise((v,y)=>{self.setTimeout(()=>y(new Error("MediaKeySession.remove() timeout")),8e3),r.remove().then(v)}):Promise.resolve()).catch(v=>{var y;this.log(`Could not remove session: ${v}`),(y=this.hls)==null||y.trigger(G.ERROR,{type:Mt.OTHER_ERROR,details:Me.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${v}`)})}).then(()=>r.close()).catch(v=>{var y;this.log(`Could not close session: ${v}`),(y=this.hls)==null||y.trigger(G.ERROR,{type:Mt.OTHER_ERROR,details:Me.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${v}`)})})}}}Wf.CDMCleanupPromise=void 0;class Fa extends Error{constructor(t,r){super(r),this.data=void 0,t.error||(t.error=new Error(r)),this.data=t,t.err=t.error}}function nL(a,t){let r;try{r=new Event("addtrack")}catch{r=document.createEvent("Event"),r.initEvent("addtrack",!1,!1)}r.track=a,t.dispatchEvent(r)}function rL(a,t){const r=a.mode;if(r==="disabled"&&(a.mode="hidden"),a.cues&&!a.cues.getCueById(t.id))try{if(a.addCue(t),!a.cues.getCueById(t.id))throw new Error(`addCue is failed for: ${t}`)}catch(s){Hn.debug(`[texttrack-utils]: ${s}`);try{const u=new self.TextTrackCue(t.startTime,t.endTime,t.text);u.id=t.id,a.addCue(u)}catch(u){Hn.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${u}`)}}r==="disabled"&&(a.mode=r)}function Yf(a,t){const r=a.mode;if(r==="disabled"&&(a.mode="hidden"),a.cues)for(let s=a.cues.length;s--;)t&&a.cues[s].removeEventListener("enter",t),a.removeCue(a.cues[s]);r==="disabled"&&(a.mode=r)}function IT(a,t,r,s){const u=a.mode;if(u==="disabled"&&(a.mode="hidden"),a.cues&&a.cues.length>0){const f=function(c,v,y){const E=[],A=function(L,T){if(T<=L[0].startTime)return 0;const M=L.length-1;if(T>L[M].endTime)return-1;let O,U=0,$=M;for(;U<=$;)if(O=Math.floor(($+U)/2),T<L[O].startTime)$=O-1;else{if(!(T>L[O].startTime&&U<M))return O;U=O+1}return L[U].startTime-T<T-L[$].startTime?U:$}(c,v);if(A>-1)for(let L=A,T=c.length;L<T;L++){const M=c[L];if(M.startTime>=v&&M.endTime<=y)E.push(M);else if(M.startTime>y)return E}return E}(a.cues,t,r);for(let c=0;c<f.length;c++)s&&!s(f[c])||a.removeCue(f[c])}u==="disabled"&&(a.mode=u)}function N0(a){const t=[];for(let r=0;r<a.length;r++){const s=a[r];s.kind!=="subtitles"&&s.kind!=="captions"||!s.label||t.push(a[r])}return t}function Lm(a){let t=5381,r=a.length;for(;r;)t=33*t^a.charCodeAt(--r);return(t>>>0).toString()}const Qf=.025;let _0=function(a){return a[a.Point=0]="Point",a[a.Range=1]="Range",a}({});function wO(a,t,r){return`${a.identifier}-${r+1}-${Lm(t)}`}class AO{constructor(t,r){this.base=void 0,this.hs=null,this.fs=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=r,this.dateRange=t,this.setDateRange(t)}setDateRange(t){this.dateRange=t,this.resumeOffset=t.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=t.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=t.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=t.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var t;this.appendInPlaceStarted=!1,(t=this.assetListLoader)==null||t.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this.hs=null)}isAssetPastPlayoutLimit(t){if(t>=this.assetList.length)return!0;const r=this.playoutLimit;return t<=0||isNaN(r)?!1:this.assetList[t].startOffset>r}findAssetIndex(t){return this.assetList.indexOf(t)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const t=this.dateRange.startTime;if(this.snapOptions.out){const r=this.dateRange.tagAnchor;if(r)return LT(t,r)}return t}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;const t=this.dateRange.tagAnchor;if(t){const r=this.dateRange.startTime;return r-LT(r,t)<.1}return!1}get resumptionOffset(){const t=this.resumeOffset,r=vt(t)?t:this.duration;return this.cumulativeDuration+r}get resumeTime(){const t=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const r=this.resumeAnchor;if(r)return LT(t,r)}return t}get appendInPlace(){return!!this.appendInPlaceStarted||!this.appendInPlaceDisabled&&!(this.cue.once||this.cue.pre||!this.startIsAligned||!(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)<Qf))}set appendInPlace(t){this.appendInPlaceStarted?this.resetOnResume=!t:this.appendInPlaceDisabled=!t}get timelineStart(){return this.fs!==null?this.fs:this.startTime}set timelineStart(t){this.fs=t}get duration(){const t=this.playoutLimit;let r;return r=this.hs!==null?this.hs:this.dateRange.duration?this.dateRange.duration:this.dateRange.plannedDuration||0,!isNaN(t)&&t<r&&(r=t),r}set duration(t){this.hs=t}get cue(){return this.dateRange.cue}get timelineOccupancy(){return this.dateRange.attr["X-TIMELINE-OCCUPIES"]==="RANGE"?_0.Range:_0.Point}get supplementsPrimary(){return this.dateRange.attr["X-TIMELINE-STYLE"]==="PRIMARY"}get contentMayVary(){return this.dateRange.attr["X-CONTENT-MAY-VARY"]!=="NO"}get assetUrl(){return this.dateRange.attr["X-ASSET-URI"]}get assetListUrl(){return this.dateRange.attr["X-ASSET-LIST"]}get baseUrl(){return this.base.url}get assetListLoaded(){return this.assetList.length>0||this.assetListResponse!==null}toString(){return`["${(t=this).identifier}" ${t.cue.pre?"<pre>":t.cue.post?"<post>":""}${t.timelineStart.toFixed(2)}-${t.resumeTime.toFixed(2)}]`;var t}}function LT(a,t){return a-t.start<t.duration/2&&!(Math.abs(a-(t.start+t.duration))<Qf)?t.start:t.start+t.duration}function iL(a,t,r){const s=new self.URL(a,r);return s.protocol!=="data:"&&s.searchParams.set("_HLS_primary_id",t),s}function RT(a){const t=a.timelineStart,r=a.duration||0;return`["${a.identifier}" ${t.toFixed(2)}-${(t+r).toFixed(2)}]`}class kO{constructor(t,r,s,u){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this.ds=void 0,this.vs=void 0,this.checkPlayout=()=>{const y=this.interstitial.playoutLimit,E=this.currentTime;this.startOffset+E>=y&&this.hls.trigger(G.PLAYOUT_LIMIT_REACHED,{})};const f=this.hls=new t(r);this.interstitial=s,this.assetItem=u;let c=u.uri;try{c=iL(c,f.sessionId).href}catch{}f.loadSource(c);const v=()=>{this.hasDetails=!0};f.once(G.LEVEL_LOADED,v),f.once(G.AUDIO_TRACK_LOADED,v),f.once(G.SUBTITLE_TRACK_LOADED,v),f.on(G.MEDIA_ATTACHING,(y,{media:E})=>{this.removeMediaListeners(),this.mediaAttached=E,this.interstitial.playoutLimit&&E.addEventListener("timeupdate",this.checkPlayout)})}bufferedInPlaceToEnd(t){var r;if(!this.interstitial.appendInPlace)return!1;if((r=this.hls)!=null&&r.bufferedToEnd)return!0;if(!t||!this.vs)return!1;const s=this.timelineOffset,u=bn.bufferInfo(t,s,0);return this.getAssetTime(u.end)>=this.vs-.02}get destroyed(){var t;return!((t=this.hls)!=null&&t.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var t;return((t=this.hls)==null?void 0:t.media)||null}get bufferedEnd(){const t=this.media||this.mediaAttached;if(!t)return this.vs?this.vs:this.currentTime;const r=bn.bufferInfo(t,t.currentTime,.001);return this.getAssetTime(r.end)}get currentTime(){const t=this.media||this.mediaAttached;return t?this.getAssetTime(t.currentTime):this.ds||0}get duration(){return this.assetItem.duration||0}get remaining(){const t=this.duration;return t?Math.max(0,t-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var t;return((t=this.hls)==null?void 0:t.config.timelineOffset)||0}set timelineOffset(t){const r=this.timelineOffset;if(t!==r){const s=t-r;if(Math.abs(s)>1/9e4){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=t}}}getAssetTime(t){const r=this.timelineOffset,s=this.duration;return Math.min(Math.max(0,t-r),s)}removeMediaListeners(){const t=this.mediaAttached;t&&(this.ds=t.currentTime,this.bufferSnapShot(),t.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){var t;this.mediaAttached&&(t=this.hls)!=null&&t.bufferedToEnd&&(this.vs=this.bufferedEnd)}destroy(){this.removeMediaListeners(),this.hls.destroy(),this.hls=this.interstitial=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(t){this.hls.attachMedia(t)}detachMedia(){this.removeMediaListeners(),this.mediaAttached=null,this.hls.detachMedia()}resumeBuffering(){this.hls.resumeBuffering()}pauseBuffering(){this.hls.pauseBuffering()}transferMedia(){return this.bufferSnapShot(),this.hls.transferMedia()}on(t,r,s){this.hls.on(t,r)}once(t,r,s){this.hls.once(t,r)}off(t,r,s){this.hls.off(t,r)}toString(){var t,r;return`HlsAssetPlayer: ${RT(this.assetItem)} ${(t=this.hls)==null?void 0:t.sessionId} ${(r=this.interstitial)!=null&&r.appendInPlace?"append-in-place":""}`}}class xO extends iu{constructor(t,r){super("interstitials-sched",r),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=t}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(t=>t.reset()),this.events=this.items=null}resetErrorsInRange(t,r){return this.events?this.events.reduce((s,u)=>t<=u.startOffset&&r>u.startOffset?(delete u.error,s+1):s,0):0}get duration(){const t=this.items;return t?t[t.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(t){return t&&this.eventMap[t]||null}hasEvent(t){return t in this.eventMap}findItemIndex(t,r){if(t.event)return this.findEventIndex(t.event.identifier);let s=-1;t.nextEvent?s=this.findEventIndex(t.nextEvent.identifier)-1:t.previousEvent&&(s=this.findEventIndex(t.previousEvent.identifier)+1);const u=this.items;if(u)for(u[s]||(r===void 0&&(r=t.start),s=this.findItemIndexAtTime(r));s>=0&&(f=u[s])!=null&&f.event;){var f;s--}return s}findItemIndexAtTime(t,r){const s=this.items;if(s)for(let u=0;u<s.length;u++){let f=s[u];if(r&&r!=="primary"&&(f=f[r]),t===f.start||t>f.start&&t<f.end)return u}return-1}findJumpRestrictedIndex(t,r){const s=this.items;if(s)for(let u=t;u<=r&&s[u];u++){const f=s[u].event;if(f!=null&&f.restrictions.jump&&!f.appendInPlace)return u}return-1}findEventIndex(t){const r=this.items;if(r)for(let u=r.length;u--;){var s;if(((s=r[u].event)==null?void 0:s.identifier)===t)return u}return-1}findAssetIndex(t,r){const s=t.assetList,u=s.length;if(u>1)for(let f=0;f<u;f++){const c=s[f];if(!c.error){const v=c.timelineStart;if(r===v||r>v&&r<v+(c.duration||0))return f}}return 0}get assetIdAtEnd(){var t,r;const s=(t=this.items)==null||(r=t[this.length-1])==null?void 0:r.event;if(s){const u=s.assetList,f=u[u.length-1];if(f)return f.identifier}return null}parseInterstitialDateRanges(t,r){const s=t.main.details,{dateRanges:u}=s,f=this.events,c=this.parseDateRanges(u,{url:s.url},r),v=Object.keys(u),y=f?f.filter(E=>!v.includes(E.identifier)):[];c.length&&c.sort((E,A)=>{const L=E.cue.pre,T=E.cue.post,M=A.cue.pre,O=A.cue.post;if(L&&!M)return-1;if(M&&!L||T&&!O)return 1;if(O&&!T)return-1;if(!(L||M||T||O)){const U=E.startTime,$=A.startTime;if(U!==$)return U-$}return E.dateRange.tagOrder-A.dateRange.tagOrder}),this.events=c,y.forEach(E=>{this.removeEvent(E)}),this.updateSchedule(t,y)}updateSchedule(t,r=[]){const s=this.events||[];if(s.length||r.length||this.length<2){const u=this.items,f=this.parseSchedule(s,t);(r.length||(u==null?void 0:u.length)!==f.length||f.some((c,v)=>Math.abs(c.playout.start-u[v].playout.start)>.005||Math.abs(c.playout.end-u[v].playout.end)>.005))&&(this.items=f,this.onScheduleUpdate(r,u))}}parseDateRanges(t,r,s){const u=[],f=Object.keys(t);for(let c=0;c<f.length;c++){const v=f[c],y=t[v];if(y.isInterstitial){let E=this.eventMap[v];E?E.setDateRange(y):(E=new AO(y,r),this.eventMap[v]=E,s===!1&&(E.appendInPlace=s)),u.push(E)}}return u}parseSchedule(t,r){const s=[],u=r.main.details,f=u.live?1/0:u.edge;let c=0;if((t=t.filter(y=>!(y.error||y.cue.once&&y.hasPlayed))).length){this.resolveOffsets(t,r);let y=0,E=0;if(t.forEach((A,L)=>{const T=A.cue.pre,M=A.cue.post,O=t[L-1]||null,U=A.appendInPlace,$=M?f:A.startOffset,z=A.duration,Q=A.timelineOccupancy===_0.Range?z:0,Z=A.resumptionOffset,ie=(O==null?void 0:O.startTime)===$,se=$+A.cumulativeDuration;let ye=U?se+z:$+Z;if(T||!M&&$<=0){const re=E;E+=Q,A.timelineStart=se;const ne=c;c+=z,s.push({event:A,start:se,end:ye,playout:{start:ne,end:c},integrated:{start:re,end:E}})}else{if(!($<=f))return;{if(!ie){const Se=$-y;if(Se>.033){const ce=y,we=E;E+=Se;const ze=c;c+=Se;const xe={previousEvent:t[L-1]||null,nextEvent:A,start:ce,end:ce+Se,playout:{start:ze,end:c},integrated:{start:we,end:E}};s.push(xe)}else Se>0&&O&&(O.cumulativeDuration+=Se,s[s.length-1].end=$)}M&&(ye=se),A.timelineStart=se;const re=E;E+=Q;const ne=c;c+=z,s.push({event:A,start:se,end:ye,playout:{start:ne,end:c},integrated:{start:re,end:E}})}}const N=A.resumeTime;y=M||N>f?f:N}),y<f){var v;const A=y,L=E,T=f-y;E+=T;const M=c;c+=T,s.push({previousEvent:((v=s[s.length-1])==null?void 0:v.event)||null,nextEvent:null,start:y,end:A+T,playout:{start:M,end:c},integrated:{start:L,end:E}})}this.setDurations(f,c,E)}else s.push({previousEvent:null,nextEvent:null,start:0,end:f,playout:{start:0,end:f},integrated:{start:0,end:f}}),this.setDurations(f,f,f);return s}setDurations(t,r,s){this.durations={primary:t,playout:r,integrated:s}}resolveOffsets(t,r){const s=r.main.details,u=s.live?1/0:s.edge;let f=0,c=-1;t.forEach((v,y)=>{const E=v.cue.pre,A=v.cue.post,L=E?0:A?u:v.startTime;this.updateAssetDurations(v),c===L?v.cumulativeDuration=f:(f=0,c=L),!A&&v.snapOptions.in&&(v.resumeAnchor=Qd(null,s.fragments,v.startOffset+v.resumptionOffset,0,0)||void 0),v.appendInPlace&&!v.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(v,r)||(v.appendInPlace=!1)),!v.appendInPlace&&y+1<t.length&&t[y+1].startTime-t[y].resumeTime<.033&&(t[y+1].appendInPlace=!1,t[y+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${v}`));const T=vt(v.resumeOffset)?v.resumeOffset:v.duration;f+=T})}primaryCanResumeInPlaceAt(t,r){const s=t.resumeTime,u=t.startTime+t.resumptionOffset;return Math.abs(s-u)>Qf?(this.log(`"${t.identifier}" resumption ${s} not aligned with estimated timeline end ${u}`),!1):r?!Object.keys(r).some(f=>{const c=r[f].details,v=c.edge;if(s>=v)return this.log(`"${t.identifier}" resumption ${s} past ${f} playlist end ${v}`),!1;const y=Qd(null,c.fragments,s);if(!y)return this.log(`"${t.identifier}" resumption ${s} does not align with any fragments in ${f} playlist (${c.fragStart}-${c.fragmentEnd})`),!0;const E=f==="audio"?.175:0;return!(Math.abs(y.start-s)<Qf+E||Math.abs(y.end-s)<Qf+E)&&(this.log(`"${t.identifier}" resumption ${s} not aligned with ${f} fragment bounds (${y.start}-${y.end} sn: ${y.sn} cc: ${y.cc})`),!0)}):(this.log(`"${t.identifier}" resumption ${s} can not be aligned with media (none selected)`),!1)}updateAssetDurations(t){if(!t.assetListLoaded)return;const r=t.timelineStart;let s=0,u=!1,f=!1;t.assetList.forEach((c,v)=>{const y=r+s;c.startOffset=s,c.timelineStart=y,u||(u=c.duration===null),f||(f=!!c.error);const E=c.error?0:c.duration||0;s+=E}),t.duration=u&&!f?Math.max(s,t.duration):s}removeEvent(t){t.reset(),delete this.eventMap[t.identifier]}}function Ic(a){return`[${a.event?'"'+a.event.identifier+'"':"primary"}: ${a.start.toFixed(2)}-${a.end.toFixed(2)}]`}class IO{constructor(t){this.hls=void 0,this.hls=t}destroy(){this.hls=null}loadAssetList(t,r){const s=t.assetListUrl;let u;try{u=iL(s,this.hls.sessionId,t.baseUrl)}catch(L){const T=this.assignAssetListError(t,Me.ASSET_LIST_LOAD_ERROR,L,s);return void this.hls.trigger(G.ERROR,T)}r&&u.protocol!=="data:"&&u.searchParams.set("_HLS_start_offset",""+r);const f=this.hls.config,c=new f.loader(f),v={responseType:"json",url:u.href},y=f.interstitialAssetListLoadPolicy.default,E={loadPolicy:y,timeout:y.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},A={onSuccess:(L,T,M,O)=>{const U=L.data,$=U==null?void 0:U.ASSETS;if(Array.isArray($))t.assetListResponse=U,this.hls.trigger(G.ASSET_LIST_LOADED,{event:t,assetListResponse:U,networkDetails:O});else{const z=this.assignAssetListError(t,Me.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),M.url,T,O);this.hls.trigger(G.ERROR,z)}},onError:(L,T,M,O)=>{const U=this.assignAssetListError(t,Me.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${L.code} ${L.text} (${T.url})`),T.url,O,M);this.hls.trigger(G.ERROR,U)},onTimeout:(L,T,M)=>{const O=this.assignAssetListError(t,Me.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${T.url})`),T.url,L,M);this.hls.trigger(G.ERROR,O)}};return c.load(v,E,A),this.hls.trigger(G.ASSET_LIST_LOADING,{event:t}),c}assignAssetListError(t,r,s,u,f,c){return t.error=s,{type:Mt.NETWORK_ERROR,details:r,fatal:!1,interstitial:t,url:u,error:s,networkDetails:c,stats:f}}}function cu(a,t,r){hl(a,t,r),a.addEventListener(t,r)}function hl(a,t,r){a.removeEventListener(t,r)}function sL(a){a==null||a.play().catch(()=>{})}class LO{constructor(t){this.buffered=void 0;const r=(s,u,f)=>{if((u>>>=0)>f-1)throw new DOMException(`Failed to execute '${s}' on 'TimeRanges': The index provided (${u}) is greater than the maximum bound (${f})`);return t[u][s]};this.buffered={get length(){return t.length},end:s=>r("end",s,t.length),start:s=>r("start",s,t.length)}}}const RO={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},aL=a=>String.fromCharCode(RO[a]||a),Zd=15,du=100,CO={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},DO={17:2,18:4,21:6,22:8,23:10,19:13,20:15},PO={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},MO={25:2,26:4,29:6,30:8,31:10,27:13,28:15},OO=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class NO{constructor(){this.time=null,this.verboseLevel=0}log(t,r){if(this.verboseLevel>=t){const s=typeof r=="function"?r():r;Hn.log(`${this.time} [${t}] ${s}`)}}}const eh=function(a){const t=[];for(let r=0;r<a.length;r++)t.push(a[r].toString(16));return t};class oL{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(t){const r=["foreground","underline","italics","background","flash"];for(let s=0;s<r.length;s++){const u=r[s];t.hasOwnProperty(u)&&(this[u]=t[u])}}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash}equals(t){return this.foreground===t.foreground&&this.underline===t.underline&&this.italics===t.italics&&this.background===t.background&&this.flash===t.flash}copy(t){this.foreground=t.foreground,this.underline=t.underline,this.italics=t.italics,this.background=t.background,this.flash=t.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class _O{constructor(){this.uchar=" ",this.penState=new oL}reset(){this.uchar=" ",this.penState.reset()}setChar(t,r){this.uchar=t,this.penState.copy(r)}setPenState(t){this.penState.copy(t)}equals(t){return this.uchar===t.uchar&&this.penState.equals(t.penState)}copy(t){this.uchar=t.uchar,this.penState.copy(t.penState)}isEmpty(){return this.uchar===" "&&this.penState.isDefault()}}class FO{constructor(t){this.chars=[],this.pos=0,this.currPenState=new oL,this.cueStartTime=null,this.logger=void 0;for(let r=0;r<du;r++)this.chars.push(new _O);this.logger=t}equals(t){for(let r=0;r<du;r++)if(!this.chars[r].equals(t.chars[r]))return!1;return!0}copy(t){for(let r=0;r<du;r++)this.chars[r].copy(t.chars[r])}isEmpty(){let t=!0;for(let r=0;r<du;r++)if(!this.chars[r].isEmpty()){t=!1;break}return t}setCursor(t){this.pos!==t&&(this.pos=t),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>du&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=du)}moveCursor(t){const r=this.pos+t;if(t>1)for(let s=this.pos+1;s<r+1;s++)this.chars[s].setPenState(this.currPenState);this.setCursor(r)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(t){t>=144&&this.backSpace();const r=aL(t);this.pos>=du?this.logger.log(0,()=>"Cannot insert "+t.toString(16)+" ("+r+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(r,this.currPenState),this.moveCursor(1))}clearFromPos(t){let r;for(r=t;r<du;r++)this.chars[r].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const t=[];let r=!0;for(let s=0;s<du;s++){const u=this.chars[s].uchar;u!==" "&&(r=!1),t.push(u)}return r?"":t.join("")}setPenStyles(t){this.currPenState.setStyles(t),this.chars[this.pos].setPenState(this.currPenState)}}class CT{constructor(t){this.rows=[],this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let r=0;r<Zd;r++)this.rows.push(new FO(t));this.logger=t}reset(){for(let t=0;t<Zd;t++)this.rows[t].clear();this.currRow=14}equals(t){let r=!0;for(let s=0;s<Zd;s++)if(!this.rows[s].equals(t.rows[s])){r=!1;break}return r}copy(t){for(let r=0;r<Zd;r++)this.rows[r].copy(t.rows[r])}isEmpty(){let t=!0;for(let r=0;r<Zd;r++)if(!this.rows[r].isEmpty()){t=!1;break}return t}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(t){this.rows[this.currRow].insertChar(t)}setPen(t){this.rows[this.currRow].setPenStyles(t)}moveCursor(t){this.rows[this.currRow].moveCursor(t)}setCursor(t){this.logger.log(2,"setCursor: "+t),this.rows[this.currRow].setCursor(t)}setPAC(t){this.logger.log(2,()=>"pacData = "+Or(t));let r=t.row-1;if(this.nrRollUpRows&&r<this.nrRollUpRows-1&&(r=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==r){for(let v=0;v<Zd;v++)this.rows[v].clear();const f=this.currRow+1-this.nrRollUpRows,c=this.lastOutputScreen;if(c){const v=c.rows[f].cueStartTime,y=this.logger.time;if(v!==null&&y!==null&&v<y)for(let E=0;E<this.nrRollUpRows;E++)this.rows[r-this.nrRollUpRows+E+1].copy(c.rows[f+E])}}this.currRow=r;const s=this.rows[this.currRow];if(t.indent!==null){const f=t.indent,c=Math.max(f-1,0);s.setCursor(t.indent),t.color=s.chars[c].penState.foreground}const u={foreground:t.color,underline:t.underline,italics:t.italics,background:"black",flash:!1};this.setPen(u)}setBkgData(t){this.logger.log(2,()=>"bkgData = "+Or(t)),this.backSpace(),this.setPen(t),this.insertChar(32)}setRollUpRows(t){this.nrRollUpRows=t}rollUp(){if(this.nrRollUpRows===null)return void this.logger.log(3,"roll_up but nrRollUpRows not set yet");this.logger.log(1,()=>this.getDisplayText());const t=this.currRow+1-this.nrRollUpRows,r=this.rows.splice(t,1)[0];r.clear(),this.rows.splice(this.currRow,0,r),this.logger.log(2,"Rolling up")}getDisplayText(t){t=t||!1;const r=[];let s="",u=-1;for(let f=0;f<Zd;f++){const c=this.rows[f].getTextString();c&&(u=f+1,t?r.push("Row "+u+": '"+c+"'"):r.push(c.trim()))}return r.length>0&&(s=t?"["+r.join(" | ")+"]":r.join(`
`)),s}getTextAndFormat(){return this.rows}}class lL{constructor(t,r,s){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=t,this.outputFilter=r,this.mode=null,this.verbose=0,this.displayedMemory=new CT(s),this.nonDisplayedMemory=new CT(s),this.lastOutputScreen=new CT(s),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=s}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(t){this.outputFilter=t}setPAC(t){this.writeScreen.setPAC(t)}setBkgData(t){this.writeScreen.setBkgData(t)}setMode(t){t!==this.mode&&(this.mode=t,this.logger.log(2,()=>"MODE="+t),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=t)}insertChars(t){for(let s=0;s<t.length;s++)this.writeScreen.insertChar(t[s]);const r=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>r+": "+this.writeScreen.getDisplayText(!0)),this.mode!=="MODE_PAINT-ON"&&this.mode!=="MODE_ROLL-UP"||(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(t){this.logger.log(2,"RU("+t+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(t)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const t=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=t,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(t){this.logger.log(2,"TO("+t+") - Tab Offset"),this.writeScreen.moveCursor(t)}ccMIDROW(t){const r={flash:!1};if(r.underline=t%2==1,r.italics=t>=46,r.italics)r.foreground="white";else{const s=Math.floor(t/2)-16,u=["white","green","blue","cyan","red","yellow","magenta"];r.foreground=u[s]}this.logger.log(2,"MIDROW: "+Or(r)),this.writeScreen.setPen(r)}outputDataUpdate(t=!1){const r=this.logger.time;r!==null&&this.outputFilter&&(this.cueStartTime!==null||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,r,this.lastOutputScreen),t&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:r):this.cueStartTime=r,this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(t){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,t,this.displayedMemory),this.cueStartTime=t))}}class uL{constructor(t,r,s){this.channels=void 0,this.currentChannel=0,this.cmdHistory={a:null,b:null},this.logger=void 0;const u=this.logger=new NO;this.channels=[null,new lL(t,r,u),new lL(t+1,s,u)]}getHandler(t){return this.channels[t].getHandler()}setHandler(t,r){this.channels[t].setHandler(r)}addData(t,r){this.logger.time=t;for(let s=0;s<r.length;s+=2){const u=127&r[s],f=127&r[s+1];let c=!1,v=null;if(u===0&&f===0)continue;this.logger.log(3,()=>"["+eh([r[s],r[s+1]])+"] -> ("+eh([u,f])+")");const y=this.cmdHistory;if(u>=16&&u<=31){if(UO(u,f,y)){F0(null,null,y),this.logger.log(3,()=>"Repeated command ("+eh([u,f])+") is dropped");continue}F0(u,f,this.cmdHistory),c=this.parseCmd(u,f),c||(c=this.parseMidrow(u,f)),c||(c=this.parsePAC(u,f)),c||(c=this.parseBackgroundAttributes(u,f))}else F0(null,null,y);if(!c&&(v=this.parseChars(u,f),v)){const E=this.currentChannel;E&&E>0?this.channels[E].insertChars(v):this.logger.log(2,"No channel found yet. TEXT-MODE?")}c||v||this.logger.log(2,()=>"Couldn't parse cleaned data "+eh([u,f])+" orig: "+eh([r[s],r[s+1]]))}}parseCmd(t,r){if(!((t===20||t===28||t===21||t===29)&&r>=32&&r<=47)&&!((t===23||t===31)&&r>=33&&r<=35))return!1;const s=t===20||t===21||t===23?1:2,u=this.channels[s];return t===20||t===21||t===28||t===29?r===32?u.ccRCL():r===33?u.ccBS():r===34?u.ccAOF():r===35?u.ccAON():r===36?u.ccDER():r===37?u.ccRU(2):r===38?u.ccRU(3):r===39?u.ccRU(4):r===40?u.ccFON():r===41?u.ccRDC():r===42?u.ccTR():r===43?u.ccRTD():r===44?u.ccEDM():r===45?u.ccCR():r===46?u.ccENM():r===47&&u.ccEOC():u.ccTO(r-32),this.currentChannel=s,!0}parseMidrow(t,r){let s=0;if((t===17||t===25)&&r>=32&&r<=47){if(s=t===17?1:2,s!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const u=this.channels[s];return!!u&&(u.ccMIDROW(r),this.logger.log(3,()=>"MIDROW ("+eh([t,r])+")"),!0)}return!1}parsePAC(t,r){let s;if(!((t>=17&&t<=23||t>=25&&t<=31)&&r>=64&&r<=127)&&!((t===16||t===24)&&r>=64&&r<=95))return!1;const u=t<=23?1:2;s=r>=64&&r<=95?u===1?CO[t]:PO[t]:u===1?DO[t]:MO[t];const f=this.channels[u];return!!f&&(f.setPAC(this.interpretPAC(s,r)),this.currentChannel=u,!0)}interpretPAC(t,r){let s;const u={color:null,italics:!1,indent:null,underline:!1,row:t};return s=r>95?r-96:r-64,u.underline=!(1&~s),s<=13?u.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(s/2)]:s<=15?(u.italics=!0,u.color="white"):u.indent=4*Math.floor((s-16)/2),u}parseChars(t,r){let s,u=null,f=null;if(t>=25?(s=2,f=t-8):(s=1,f=t),f>=17&&f<=19){let c;c=f===17?r+80:f===18?r+112:r+144,this.logger.log(2,()=>"Special char '"+aL(c)+"' in channel "+s),u=[c]}else t>=32&&t<=127&&(u=r===0?[t]:[t,r]);return u&&this.logger.log(3,()=>"Char codes =  "+eh(u).join(",")),u}parseBackgroundAttributes(t,r){if(!((t===16||t===24)&&r>=32&&r<=47)&&!((t===23||t===31)&&r>=45&&r<=47))return!1;let s;const u={};t===16||t===24?(s=Math.floor((r-32)/2),u.background=OO[s],r%2==1&&(u.background=u.background+"_semi")):r===45?u.background="transparent":(u.foreground="black",r===47&&(u.underline=!0));const f=t<=23?1:2;return this.channels[f].setBkgData(u),!0}reset(){for(let t=0;t<Object.keys(this.channels).length;t++){const r=this.channels[t];r&&r.reset()}F0(null,null,this.cmdHistory)}cueSplitAtTime(t){for(let r=0;r<this.channels.length;r++){const s=this.channels[r];s&&s.cueSplitAtTime(t)}}}function F0(a,t,r){r.a=a,r.b=t}function UO(a,t,r){return r.a===a&&r.b===t}var DT=function(){if(T0!=null&&T0.VTTCue)return self.VTTCue;const a=["","lr","rl"],t=["start","middle","end","left","right"];function r(c,v){if(typeof v!="string"||!Array.isArray(c))return!1;const y=v.toLowerCase();return!!~c.indexOf(y)&&y}function s(c){return r(t,c)}function u(c,...v){let y=1;for(;y<arguments.length;y++){const E=arguments[y];for(const A in E)c[A]=E[A]}return c}function f(c,v,y){const E=this,A={enumerable:!0};E.hasBeenReset=!1;let L="",T=!1,M=c,O=v,U=y,$=null,z="",Q=!0,Z="auto",ie="start",se=50,ye="middle",N=50,re="middle";Object.defineProperty(E,"id",u({},A,{get:function(){return L},set:function(ne){L=""+ne}})),Object.defineProperty(E,"pauseOnExit",u({},A,{get:function(){return T},set:function(ne){T=!!ne}})),Object.defineProperty(E,"startTime",u({},A,{get:function(){return M},set:function(ne){if(typeof ne!="number")throw new TypeError("Start time must be set to a number.");M=ne,this.hasBeenReset=!0}})),Object.defineProperty(E,"endTime",u({},A,{get:function(){return O},set:function(ne){if(typeof ne!="number")throw new TypeError("End time must be set to a number.");O=ne,this.hasBeenReset=!0}})),Object.defineProperty(E,"text",u({},A,{get:function(){return U},set:function(ne){U=""+ne,this.hasBeenReset=!0}})),Object.defineProperty(E,"region",u({},A,{get:function(){return $},set:function(ne){$=ne,this.hasBeenReset=!0}})),Object.defineProperty(E,"vertical",u({},A,{get:function(){return z},set:function(ne){const Se=function(ce){return r(a,ce)}(ne);if(Se===!1)throw new SyntaxError("An invalid or illegal string was specified.");z=Se,this.hasBeenReset=!0}})),Object.defineProperty(E,"snapToLines",u({},A,{get:function(){return Q},set:function(ne){Q=!!ne,this.hasBeenReset=!0}})),Object.defineProperty(E,"line",u({},A,{get:function(){return Z},set:function(ne){if(typeof ne!="number"&&ne!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");Z=ne,this.hasBeenReset=!0}})),Object.defineProperty(E,"lineAlign",u({},A,{get:function(){return ie},set:function(ne){const Se=s(ne);if(!Se)throw new SyntaxError("An invalid or illegal string was specified.");ie=Se,this.hasBeenReset=!0}})),Object.defineProperty(E,"position",u({},A,{get:function(){return se},set:function(ne){if(ne<0||ne>100)throw new Error("Position must be between 0 and 100.");se=ne,this.hasBeenReset=!0}})),Object.defineProperty(E,"positionAlign",u({},A,{get:function(){return ye},set:function(ne){const Se=s(ne);if(!Se)throw new SyntaxError("An invalid or illegal string was specified.");ye=Se,this.hasBeenReset=!0}})),Object.defineProperty(E,"size",u({},A,{get:function(){return N},set:function(ne){if(ne<0||ne>100)throw new Error("Size must be between 0 and 100.");N=ne,this.hasBeenReset=!0}})),Object.defineProperty(E,"align",u({},A,{get:function(){return re},set:function(ne){const Se=s(ne);if(!Se)throw new SyntaxError("An invalid or illegal string was specified.");re=Se,this.hasBeenReset=!0}})),E.displayState=void 0}return f.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},f}();class BO{decode(t,r){if(!t)return"";if(typeof t!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))}}function cL(a){function t(s,u,f,c){return 3600*(0|s)+60*(0|u)+(0|f)+parseFloat(c||0)}const r=a.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return r?parseFloat(r[2])>59?t(r[2],r[3],0,r[4]):t(r[1],r[2],r[3],r[4]):null}class $O{constructor(){this.values=Object.create(null)}set(t,r){this.get(t)||r===""||(this.values[t]=r)}get(t,r,s){return s?this.has(t)?this.values[t]:r[s]:this.has(t)?this.values[t]:r}has(t){return t in this.values}alt(t,r,s){for(let u=0;u<s.length;++u)if(r===s[u]){this.set(t,r);break}}integer(t,r){/^-?\d+$/.test(r)&&this.set(t,parseInt(r,10))}percent(t,r){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(r)){const s=parseFloat(r);if(s>=0&&s<=100)return this.set(t,s),!0}return!1}}function dL(a,t,r,s){const u=s?a.split(s):[a];for(const f in u){if(typeof u[f]!="string")continue;const c=u[f].split(r);c.length===2&&t(c[0],c[1])}}const PT=new DT(0,0,""),U0=PT.align==="middle"?"middle":"center";function jO(a,t,r){const s=a;function u(){const c=cL(a);if(c===null)throw new Error("Malformed timestamp: "+s);return a=a.replace(/^[^\sa-zA-Z-]+/,""),c}function f(){a=a.replace(/^\s+/,"")}if(f(),t.startTime=u(),f(),a.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+s);a=a.slice(3),f(),t.endTime=u(),f(),function(c,v){const y=new $O;dL(c,function(L,T){let M;switch(L){case"region":for(let O=r.length-1;O>=0;O--)if(r[O].id===T){y.set(L,r[O].region);break}break;case"vertical":y.alt(L,T,["rl","lr"]);break;case"line":M=T.split(","),y.integer(L,M[0]),y.percent(L,M[0])&&y.set("snapToLines",!1),y.alt(L,M[0],["auto"]),M.length===2&&y.alt("lineAlign",M[1],["start",U0,"end"]);break;case"position":M=T.split(","),y.percent(L,M[0]),M.length===2&&y.alt("positionAlign",M[1],["start",U0,"end","line-left","line-right","auto"]);break;case"size":y.percent(L,T);break;case"align":y.alt(L,T,["start",U0,"end","left","right"])}},/:/,/\s/),v.region=y.get("region",null),v.vertical=y.get("vertical","");let E=y.get("line","auto");E==="auto"&&PT.line===-1&&(E=-1),v.line=E,v.lineAlign=y.get("lineAlign","start"),v.snapToLines=y.get("snapToLines",!0),v.size=y.get("size",100),v.align=y.get("align",U0);let A=y.get("position","auto");A==="auto"&&PT.position===50&&(A=v.align==="start"||v.align==="left"?0:v.align==="end"||v.align==="right"?100:50),v.position=A}(a,t)}function hL(a){return a.replace(/<br(?: \/)?>/gi,`
`)}class GO{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new BO,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(t){const r=this;function s(){let u=r.buffer,f=0;for(u=hL(u);f<u.length&&u[f]!=="\r"&&u[f]!==`
`;)++f;const c=u.slice(0,f);return u[f]==="\r"&&++f,u[f]===`
`&&++f,r.buffer=u.slice(f),c}t&&(r.buffer+=r.decoder.decode(t,{stream:!0}));try{let u="";if(r.state==="INITIAL"){if(!/\r\n|\n/.test(r.buffer))return this;u=s();const c=u.match(/^(ï»¿)?WEBVTT([ \t].*)?$/);if(c==null||!c[0])throw new Error("Malformed WebVTT signature.");r.state="HEADER"}let f=!1;for(;r.buffer;){if(!/\r\n|\n/.test(r.buffer))return this;switch(f?f=!1:u=s(),r.state){case"HEADER":/:/.test(u)?dL(u,function(c,v){},/:/):u||(r.state="ID");continue;case"NOTE":u||(r.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(u)){r.state="NOTE";break}if(!u)continue;if(r.cue=new DT(0,0,""),r.state="CUE",u.indexOf("-->")===-1){r.cue.id=u;continue}case"CUE":if(!r.cue){r.state="BADCUE";continue}try{jO(u,r.cue,r.regionList)}catch{r.cue=null,r.state="BADCUE";continue}r.state="CUETEXT";continue;case"CUETEXT":{const c=u.indexOf("-->")!==-1;if(!u||c&&(f=!0)){r.oncue&&r.cue&&r.oncue(r.cue),r.cue=null,r.state="ID";continue}if(r.cue===null)continue;r.cue.text&&(r.cue.text+=`
`),r.cue.text+=u}continue;case"BADCUE":u||(r.state="ID")}}}catch{r.state==="CUETEXT"&&r.cue&&r.oncue&&r.oncue(r.cue),r.cue=null,r.state=r.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const t=this;try{if((t.cue||t.state==="HEADER")&&(t.buffer+=`

`,t.parse()),t.state==="INITIAL"||t.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(r){t.onparsingerror&&t.onparsingerror(r)}return t.onflush&&t.onflush(),this}}const HO=/\r\n|\n\r|\n|\r/g,MT=function(a,t,r=0){return a.slice(r,r+t.length)===t};function OT(a,t,r){return Lm(a.toString())+Lm(t.toString())+Lm(r)}function VO(a,t,r,s,u,f,c){const v=new GO,y=ca(new Uint8Array(a)).trim().replace(HO,`
`).split(`
`),E=[],A=t?function($,z=1){return yT($,9e4,1/z)}(t.baseTime,t.timescale):0;let L,T="00:00.000",M=0,O=0,U=!0;v.oncue=function($){const z=r[s];let Q=r.ccOffset;const Z=(M-A)/9e4;if(z!=null&&z.new&&(O!==void 0?Q=r.ccOffset=z.start:function(N,re,ne){let Se=N[re],ce=N[Se.prevCC];if(!ce||!ce.new&&Se.new)return N.ccOffset=N.presentationOffset=Se.start,void(Se.new=!1);for(;(we=ce)!=null&&we.new;){var we;N.ccOffset+=Se.start-ce.start,Se.new=!1,Se=ce,ce=N[Se.prevCC]}N.presentationOffset=ne}(r,s,Z)),Z){if(!t)return void(L=new Error("Missing initPTS for VTT MPEGTS"));Q=Z-r.presentationOffset}const ie=$.endTime-$.startTime,se=_a(9e4*($.startTime+Q-O),9e4*u)/9e4;$.startTime=Math.max(se,0),$.endTime=Math.max(se+ie,0);const ye=$.text.trim();$.text=decodeURIComponent(encodeURIComponent(ye)),$.id||($.id=OT($.startTime,$.endTime,ye)),$.endTime>0&&E.push($)},v.onparsingerror=function($){L=$},v.onflush=function(){L?c(L):f(E)},y.forEach($=>{if(U){if(MT($,"X-TIMESTAMP-MAP=")){U=!1,$.slice(16).split(",").forEach(z=>{MT(z,"LOCAL:")?T=z.slice(6):MT(z,"MPEGTS:")&&(M=parseInt(z.slice(7)))});try{O=function(z){let Q=parseInt(z.slice(-3));const Z=parseInt(z.slice(-6,-4)),ie=parseInt(z.slice(-9,-7)),se=z.length>9?parseInt(z.substring(0,z.indexOf(":"))):0;if(!(vt(Q)&&vt(Z)&&vt(ie)&&vt(se)))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${z}`);return Q+=1e3*Z,Q+=6e4*ie,Q+=36e5*se,Q}(T)/1e3}catch(z){L=z}return}$===""&&(U=!1)}v.parse($+`
`)}),v.flush()}const NT="stpp.ttml.im1t",fL=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,pL=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,KO={left:"start",center:"center",right:"end",start:"start",end:"end"};function gL(a,t,r,s){const u=un(new Uint8Array(a),["mdat"]);if(u.length===0)return void s(new Error("Could not parse IMSC1 mdat"));const f=u.map(v=>ca(v)),c=function(v,y,E=1,A=!1){return yT(v,y,1/E,A)}(t.baseTime,1,t.timescale);try{f.forEach(v=>r(function(y,E){const A=new DOMParser().parseFromString(y,"text/xml"),L=A.getElementsByTagName("tt")[0];if(!L)throw new Error("Invalid ttml");const T={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},M=Object.keys(T).reduce((Q,Z)=>(Q[Z]=L.getAttribute(`ttp:${Z}`)||T[Z],Q),{}),O=L.getAttribute("xml:space")!=="preserve",U=mL(_T(L,"styling","style")),$=mL(_T(L,"layout","region")),z=_T(L,"body","[begin]");return[].map.call(z,Q=>{const Z=yL(Q,O);if(!Z||!Q.hasAttribute("begin"))return null;const ie=UT(Q.getAttribute("begin"),M),se=UT(Q.getAttribute("dur"),M);let ye=UT(Q.getAttribute("end"),M);if(ie===null)throw vL(Q);if(ye===null){if(se===null)throw vL(Q);ye=ie+se}const N=new DT(ie-E,ye-E,Z);N.id=OT(N.startTime,N.endTime,N.text);const re=function(Se,ce,we){const ze="http://www.w3.org/ns/ttml#styling";let xe=null;const Ce=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],J=Se!=null&&Se.hasAttribute("style")?Se.getAttribute("style"):null;return J&&we.hasOwnProperty(J)&&(xe=we[J]),Ce.reduce((ue,de)=>{const W=FT(ce,ze,de)||FT(Se,ze,de)||FT(xe,ze,de);return W&&(ue[de]=W),ue},{})}($[Q.getAttribute("region")],U[Q.getAttribute("style")],U),{textAlign:ne}=re;if(ne){const Se=KO[ne];Se&&(N.lineAlign=Se),N.align=ne}return cr(N,re),N}).filter(Q=>Q!==null)}(v,c)))}catch(v){s(v)}}function _T(a,t,r){const s=a.getElementsByTagName(t)[0];return s?[].slice.call(s.querySelectorAll(r)):[]}function mL(a){return a.reduce((t,r)=>{const s=r.getAttribute("xml:id");return s&&(t[s]=r),t},{})}function yL(a,t){return[].slice.call(a.childNodes).reduce((r,s,u)=>{var f;return s.nodeName==="br"&&u?r+`
`:(f=s.childNodes)!=null&&f.length?yL(s,t):t?r+s.textContent.trim().replace(/\s+/g," "):r+s.textContent},"")}function FT(a,t,r){return a&&a.hasAttributeNS(t,r)?a.getAttributeNS(t,r):null}function vL(a){return new Error(`Could not parse ttml timestamp ${a}`)}function UT(a,t){if(!a)return null;let r=cL(a);return r===null&&(fL.test(a)?r=function(s,u){const f=fL.exec(s),c=(0|f[4])+(0|f[5])/u.subFrameRate;return 3600*(0|f[1])+60*(0|f[2])+(0|f[3])+c/u.frameRate}(a,t):pL.test(a)&&(r=function(s,u){const f=pL.exec(s),c=Number(f[1]);switch(f[2]){case"h":return 3600*c;case"m":return 60*c;case"ms":return 1e3*c;case"f":return c/u.frameRate;case"t":return c/u.tickRate}return c}(a,t))),r}class B0{constructor(t,r){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=t,this.trackName=r}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(t,r,s){(this.startTime===null||this.startTime>t)&&(this.startTime=t),this.endTime=r,this.screen=s,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}function bL(a){return a.characteristics&&/transcribes-spoken-dialog/gi.test(a.characteristics)&&/describes-music-and-sound/gi.test(a.characteristics)?"captions":"subtitles"}function EL(a,t){return!!a&&a.kind===bL(t)&&TT(t,a)}const zO=/\s/,qO={newCue(a,t,r,s){const u=[];let f,c,v,y,E;const A=self.VTTCue||self.TextTrackCue;for(let T=0;T<s.rows.length;T++)if(f=s.rows[T],v=!0,y=0,E="",!f.isEmpty()){var L;for(let U=0;U<f.chars.length;U++)zO.test(f.chars[U].uchar)&&v?y++:(E+=f.chars[U].uchar,v=!1);f.cueStartTime=t,t===r&&(r+=1e-4),y>=16?y--:y++;const M=hL(E.trim()),O=OT(t,r,M);a!=null&&(L=a.cues)!=null&&L.getCueById(O)||(c=new A(t,r,M),c.id=O,c.line=T+1,c.align="left",c.position=10+Math.min(80,10*Math.floor(8*y/32)),u.push(c))}return a&&u.length&&(u.sort((T,M)=>T.line==="auto"||M.line==="auto"?0:T.line>8&&M.line>8?M.line-T.line:T.line-M.line),u.forEach(T=>rL(a,T))),u}},WO=/(\d+)-(\d+)\/(\d+)/;class TL{constructor(t){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=t.fetchSetup||YO,this.controller=new self.AbortController,this.stats=new PE}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var t;this.abortInternal(),(t=this.callbacks)!=null&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(t,r,s){const u=this.stats;if(u.loading.start)throw new Error("Loader can only be used once.");u.loading.start=self.performance.now();const f=function(A,L){const T={method:"GET",mode:"cors",credentials:"same-origin",signal:L,headers:new self.Headers(cr({},A.headers))};return A.rangeEnd&&T.headers.set("Range","bytes="+A.rangeStart+"-"+String(A.rangeEnd-1)),T}(t,this.controller.signal),c=t.responseType==="arraybuffer",v=c?"byteLength":"length",{maxTimeToFirstByteMs:y,maxLoadTimeMs:E}=r.loadPolicy;this.context=t,this.config=r,this.callbacks=s,this.request=this.fetchSetup(t,f),self.clearTimeout(this.requestTimeout),r.timeout=y&&vt(y)?y:E,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(u,t,this.response))},r.timeout),(xm(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(A=>{var L;this.response=this.loader=A;const T=Math.max(self.performance.now(),u.loading.start);if(self.clearTimeout(this.requestTimeout),r.timeout=E,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(u,t,this.response))},E-(T-u.loading.start)),!A.ok){const{status:O,statusText:U}=A;throw new QO(U||"fetch, bad network response",O,A)}u.loading.first=T,u.total=function(O){const U=O.get("Content-Range");if(U){const z=function(Q){const Z=WO.exec(Q);if(Z)return parseInt(Z[2])-parseInt(Z[1])+1}(U);if(vt(z))return z}const $=O.get("Content-Length");if($)return parseInt($)}(A.headers)||u.total;const M=(L=this.callbacks)==null?void 0:L.onProgress;return M&&vt(r.highWaterMark)?this.loadProgressively(A,u,t,r.highWaterMark,M):c?A.arrayBuffer():t.responseType==="json"?A.json():A.text()}).then(A=>{var L,T;const M=this.response;if(!M)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),u.loading.end=Math.max(self.performance.now(),u.loading.first);const O=A[v];O&&(u.loaded=u.total=O);const U={url:M.url,data:A,code:M.status},$=(L=this.callbacks)==null?void 0:L.onProgress;$&&!vt(r.highWaterMark)&&$(u,t,A,M),(T=this.callbacks)==null||T.onSuccess(U,u,t,M)}).catch(A=>{var L;if(self.clearTimeout(this.requestTimeout),u.aborted)return;const T=A&&A.code||0,M=A?A.message:null;(L=this.callbacks)==null||L.onError({code:T,text:M},t,A?A.details:null,u)})}getCacheAge(){let t=null;if(this.response){const r=this.response.headers.get("age");t=r?parseFloat(r):null}return t}getResponseHeader(t){return this.response?this.response.headers.get(t):null}loadProgressively(t,r,s,u=0,f){const c=new fI,v=t.body.getReader(),y=()=>v.read().then(E=>{if(E.done)return c.dataLength&&f(r,s,c.flush().buffer,t),Promise.resolve(new ArrayBuffer(0));const A=E.value,L=A.length;return r.loaded+=L,L<u||c.dataLength?(c.push(A),c.dataLength>=u&&f(r,s,c.flush().buffer,t)):f(r,s,A.buffer,t),y()}).catch(()=>Promise.reject());return y()}}function YO(a,t){return new self.Request(a.url,t)}class QO extends Error{constructor(t,r,s){super(t),this.code=void 0,this.details=void 0,this.code=r,this.details=s}}const XO=/^age:\s*[\d.]+\s*$/im;class SL{constructor(t){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=t&&t.xhrSetup||null,this.stats=new PE,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const t=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),t&&(t.onreadystatechange=null,t.onprogress=null,t.readyState!==4&&(this.stats.aborted=!0,t.abort()))}abort(){var t;this.abortInternal(),(t=this.callbacks)!=null&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(t,r,s){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=t,this.config=r,this.callbacks=s,this.loadInternal()}loadInternal(){const{config:t,context:r}=this;if(!t||!r)return;const s=this.loader=new self.XMLHttpRequest,u=this.stats;u.loading.first=0,u.loaded=0,u.aborted=!1;const f=this.xhrSetup;f?Promise.resolve().then(()=>{if(this.loader===s&&!this.stats.aborted)return f(s,r.url)}).catch(c=>{if(this.loader===s&&!this.stats.aborted)return s.open("GET",r.url,!0),f(s,r.url)}).then(()=>{this.loader!==s||this.stats.aborted||this.openAndSendXhr(s,r,t)}).catch(c=>{var v;(v=this.callbacks)==null||v.onError({code:s.status,text:c.message},r,s,u)}):this.openAndSendXhr(s,r,t)}openAndSendXhr(t,r,s){t.readyState||t.open("GET",r.url,!0);const u=r.headers,{maxTimeToFirstByteMs:f,maxLoadTimeMs:c}=s.loadPolicy;if(u)for(const v in u)t.setRequestHeader(v,u[v]);r.rangeEnd&&t.setRequestHeader("Range","bytes="+r.rangeStart+"-"+(r.rangeEnd-1)),t.onreadystatechange=this.readystatechange.bind(this),t.onprogress=this.loadprogress.bind(this),t.responseType=r.responseType,self.clearTimeout(this.requestTimeout),s.timeout=f&&vt(f)?f:c,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),s.timeout),t.send()}readystatechange(){const{context:t,loader:r,stats:s}=this;if(!t||!r)return;const u=r.readyState,f=this.config;if(!s.aborted&&u>=2&&(s.loading.first===0&&(s.loading.first=Math.max(self.performance.now(),s.loading.start),f.timeout!==f.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),f.timeout=f.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),f.loadPolicy.maxLoadTimeMs-(s.loading.first-s.loading.start)))),u===4)){self.clearTimeout(this.requestTimeout),r.onreadystatechange=null,r.onprogress=null;const E=r.status,A=r.responseType==="text"?r.responseText:null;if(E>=200&&E<300){const T=A??r.response;if(T!=null){var c,v;s.loading.end=Math.max(self.performance.now(),s.loading.first);const M=r.responseType==="arraybuffer"?T.byteLength:T.length;s.loaded=s.total=M,s.bwEstimate=8e3*s.total/(s.loading.end-s.loading.first);const O=(c=this.callbacks)==null?void 0:c.onProgress;O&&O(s,t,T,r);const U={url:r.responseURL,data:T,code:E};return void((v=this.callbacks)==null||v.onSuccess(U,s,t,r))}}const L=f.loadPolicy.errorRetry;var y;y0(L,s.retry,!1,{url:t.url,data:void 0,code:E})?this.retry(L):(Hn.error(`${E} while loading ${t.url}`),(y=this.callbacks)==null||y.onError({code:E,text:r.statusText},t,r,s))}}loadtimeout(){if(!this.config)return;const t=this.config.loadPolicy.timeoutRetry;if(y0(t,this.stats.retry,!0))this.retry(t);else{var r;Hn.warn(`timeout while loading ${(r=this.context)==null?void 0:r.url}`);const s=this.callbacks;s&&(this.abortInternal(),s.onTimeout(this.stats,this.context,this.loader))}}retry(t){const{context:r,stats:s}=this;this.retryDelay=GE(t,s.retry),s.retry++,Hn.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${r==null?void 0:r.url}, retrying ${s.retry}/${t.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(t){const r=this.stats;r.loaded=t.loaded,t.lengthComputable&&(r.total=t.total)}getCacheAge(){let t=null;if(this.loader&&XO.test(this.loader.getAllResponseHeaders())){const r=this.loader.getResponseHeader("age");t=r?parseFloat(r):null}return t}getResponseHeader(t){return this.loader&&new RegExp(`^${t}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(t):null}}const JO=rr(rr({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:6e7,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncDurationCount:3,liveSyncOnStallIncrease:1,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,ignorePlaylistParsingErrors:!1,loader:SL,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:class extends iu{constructor(a){super("abr",a.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.ps=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.bwEstimator=void 0,this.gs=t=>{var r;const{fragCurrent:s,partCurrent:u,hls:f}=this,{autoLevelEnabled:c,media:v}=f;if(!s||!v)return;const y=performance.now(),E=u?u.stats:s.stats,A=u?u.duration:s.duration,L=y-E.loading.start,T=f.minAutoLevel,M=s.level,O=this.ps;if(E.aborted||E.loaded&&E.loaded===E.total||M<=T)return this.clearTimer(),void(this.ps=-1);if(!c)return;const U=O>-1&&O!==M,$=!!t||U;if(!$&&(v.paused||!v.playbackRate||!v.readyState))return;const z=f.mainForwardBufferInfo;if(!$&&z===null)return;const Q=this.bwEstimator.getEstimateTTFB(),Z=Math.abs(v.playbackRate);if(L<=Math.max(Q,A/(2*Z)*1e3))return;const ie=z?z.len/Z:0,se=E.loading.first?E.loading.first-E.loading.start:-1,ye=E.loaded&&se>-1,N=this.getBwEstimate(),re=f.levels,ne=re[M],Se=Math.max(E.loaded,Math.round(A*(s.bitrate||ne.averageBitrate)/8));let ce=ye?L-se:L;ce<1&&ye&&(ce=Math.min(L,8*E.loaded/N));const we=ye?1e3*E.loaded/ce:0,ze=Q/1e3,xe=we?(Se-E.loaded)/we:8*Se/N+ze;if(xe<=ie)return;const Ce=we?8*we:N,J=((r=(t==null?void 0:t.details)||this.hls.latestLevelDetails)==null?void 0:r.live)===!0,ue=this.hls.config.abrBandWidthUpFactor;let de,W=Number.POSITIVE_INFINITY;for(de=M-1;de>T;de--){const ot=re[de].maxBitrate,lt=!re[de].details||J;if(W=this.getTimeToLoadFrag(ze,Ce,A*ot,lt),W<Math.min(ie,A+ze))break}if(W>=xe||W>10*A)return;ye?this.bwEstimator.sample(L-Math.min(Q,se),E.loaded):this.bwEstimator.sampleTTFB(L);const Ke=re[de].maxBitrate;this.getBwEstimate()*ue>Ke&&this.resetEstimator(Ke);const nt=this.findBestLevel(Ke,T,de,0,ie,1,1);nt>-1&&(de=nt),this.warn(`Fragment ${s.sn}${u?" part "+u.index:""} of level ${M} is loading too slowly;
      Fragment duration: ${s.duration.toFixed(3)}
      Time to underbuffer: ${ie.toFixed(3)} s
      Estimated load time for current fragment: ${xe.toFixed(3)} s
      Estimated load time for down switch fragment: ${W.toFixed(3)} s
      TTFB estimate: ${0|se} ms
      Current BW estimate: ${vt(N)?0|N:"Unknown"} bps
      New BW estimate: ${0|this.getBwEstimate()} bps
      Switching to level ${de} @ ${0|Ke} bps`),f.nextLoadLevel=f.nextAutoLevel=de,this.clearTimer();const mt=()=>{if(this.clearTimer(),this.fragCurrent===s&&this.hls.loadLevel===de&&de>0){const ot=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${de>0?"and switching down":""}
      Fragment duration: ${s.duration.toFixed(3)} s
      Time to underbuffer: ${ot.toFixed(3)} s`),s.abortRequests(),this.fragCurrent=this.partCurrent=null,de>T){let lt=this.findBestLevel(this.hls.levels[T].bitrate,T,de,0,ot,1,1);lt===-1&&(lt=T),this.hls.nextLoadLevel=this.hls.nextAutoLevel=lt,this.resetEstimator(this.hls.levels[lt].bitrate)}}};U||xe>2*W?mt():this.timer=self.setInterval(mt,1e3*W),f.trigger(G.FRAG_LOAD_EMERGENCY_ABORTED,{frag:s,part:u,stats:E})},this.hls=a,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(a){a&&(this.log(`setting initial bwe to ${a}`),this.hls.config.abrEwmaDefaultEstimate=a),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const a=this.hls.config;return new nM(a.abrEwmaSlowVoD,a.abrEwmaFastVoD,a.abrEwmaDefaultEstimate)}registerListeners(){const{hls:a}=this;a.on(G.MANIFEST_LOADING,this.onManifestLoading,this),a.on(G.FRAG_LOADING,this.onFragLoading,this),a.on(G.FRAG_LOADED,this.onFragLoaded,this),a.on(G.FRAG_BUFFERED,this.onFragBuffered,this),a.on(G.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(G.LEVEL_LOADED,this.onLevelLoaded,this),a.on(G.LEVELS_UPDATED,this.onLevelsUpdated,this),a.on(G.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),a.on(G.ERROR,this.onError,this)}unregisterListeners(){const{hls:a}=this;a&&(a.off(G.MANIFEST_LOADING,this.onManifestLoading,this),a.off(G.FRAG_LOADING,this.onFragLoading,this),a.off(G.FRAG_LOADED,this.onFragLoaded,this),a.off(G.FRAG_BUFFERED,this.onFragBuffered,this),a.off(G.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(G.LEVEL_LOADED,this.onLevelLoaded,this),a.off(G.LEVELS_UPDATED,this.onLevelsUpdated,this),a.off(G.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),a.off(G.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this.gs=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(a,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this.ps=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(a,t){const r=t.frag;if(!this.ignoreFragment(r)){var s;r.bitrateTest||(this.fragCurrent=r,this.partCurrent=(s=t.part)!=null?s:null),this.clearTimer(),this.timer=self.setInterval(this.gs,100)}}onLevelSwitching(a,t){this.clearTimer()}onError(a,t){if(!t.fatal)switch(t.details){case Me.BUFFER_ADD_CODEC_ERROR:case Me.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case Me.FRAG_LOAD_TIMEOUT:{const r=t.frag,{fragCurrent:s,partCurrent:u}=this;if(r&&s&&r.sn===s.sn&&r.level===s.level){const f=performance.now(),c=u?u.stats:r.stats,v=f-c.loading.start,y=c.loading.first?c.loading.first-c.loading.start:-1;if(c.loaded&&y>-1){const E=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(v-Math.min(E,y),c.loaded)}else this.bwEstimator.sampleTTFB(v)}break}}}getTimeToLoadFrag(a,t,r,s){return a+r/t+(s?a+this.lastLevelLoadSec:0)}onLevelLoaded(a,t){const r=this.hls.config,{loading:s}=t.stats,u=s.end-s.first;vt(u)&&(this.lastLevelLoadSec=u/1e3),t.details.live?this.bwEstimator.update(r.abrEwmaSlowLive,r.abrEwmaFastLive):this.bwEstimator.update(r.abrEwmaSlowVoD,r.abrEwmaFastVoD),this.timer>-1&&this.gs(t.levelInfo)}onFragLoaded(a,{frag:t,part:r}){const s=r?r.stats:t.stats;if(t.type===On&&this.bwEstimator.sampleTTFB(s.loading.first-s.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this.ps&&(this.ps=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const u=r?r.duration:t.duration,f=this.hls.levels[t.level],c=(f.loaded?f.loaded.bytes:0)+s.loaded,v=(f.loaded?f.loaded.duration:0)+u;f.loaded={bytes:c,duration:v},f.realBitrate=Math.round(8*c/v)}if(t.bitrateTest){const u={stats:s,frag:t,part:r,id:t.type};this.onFragBuffered(G.FRAG_BUFFERED,u),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(a,t){const{frag:r,part:s}=t,u=s!=null&&s.stats.loaded?s.stats:r.stats;if(u.aborted||this.ignoreFragment(r))return;const f=u.parsing.end-u.loading.start-Math.min(u.loading.first-u.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(f,u.loaded),u.bwEstimate=this.getBwEstimate(),r.bitrateTest?this.bitrateTestDelay=f/1e3:this.bitrateTestDelay=0}ignoreFragment(a){return a.type!==On||a.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:a,minAutoLevel:t}=this.hls,r=this.getBwEstimate(),s=this.hls.config.maxStarvationDelay,u=this.findBestLevel(r,t,a,0,s,1,1);if(u>-1)return u;const f=this.hls.firstLevel,c=Math.min(Math.max(f,t),a);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${f} clamped to ${c}`),c}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this.ps}get nextAutoLevel(){const a=this.forcedAutoLevel,t=this.bwEstimator.canEstimate(),r=this.lastLoadedFragLevel>-1;if(!(a===-1||t&&r&&this.nextAutoLevelKey!==this.getAutoLevelKey()))return a;const s=t&&r?this.getNextABRAutoLevel():this.firstAutoLevel;if(a!==-1){const u=this.hls.levels;if(u.length>Math.max(a,s)&&u[a].loadError<=u[s].loadError)return a}return this.ps=s,this.nextAutoLevelKey=this.getAutoLevelKey(),s}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:a,partCurrent:t,hls:r}=this;if(r.levels.length<=1)return r.loadLevel;const{maxAutoLevel:s,config:u,minAutoLevel:f}=r,c=t?t.duration:a?a.duration:0,v=this.getBwEstimate(),y=this.getStarvationDelay();let E=u.abrBandWidthFactor,A=u.abrBandWidthUpFactor;if(y){const U=this.findBestLevel(v,f,s,y,0,E,A);if(U>=0)return this.rebufferNotice=-1,U}let L=c?Math.min(c,u.maxStarvationDelay):u.maxStarvationDelay;if(!y){const U=this.bitrateTestDelay;U&&(L=(c?Math.min(c,u.maxLoadingDelay):u.maxLoadingDelay)-U,this.info(`bitrate test took ${Math.round(1e3*U)}ms, set first fragment max fetchDuration to ${Math.round(1e3*L)} ms`),E=A=1)}const T=this.findBestLevel(v,f,s,y,L,E,A);if(this.rebufferNotice!==T&&(this.rebufferNotice=T,this.info(`${y?"rebuffering expected":"buffer is empty"}, optimal quality level ${T}`)),T>-1)return T;const M=r.levels[f],O=r.loadLevelObj;return O&&(M==null?void 0:M.bitrate)<O.bitrate?f:r.loadLevel}getStarvationDelay(){const a=this.hls,t=a.media;if(!t)return 1/0;const r=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,s=a.mainForwardBufferInfo;return(s?s.len:0)/r}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(a,t,r,s,u,f,c){var v;const y=s+u,E=this.lastLoadedFragLevel,A=E===-1?this.hls.firstLevel:E,{fragCurrent:L,partCurrent:T}=this,{levels:M,allAudioTracks:O,loadLevel:U,config:$}=this.hls;if(M.length===1)return 0;const z=M[A],Q=!((v=this.hls.latestLevelDetails)==null||!v.live),Z=U===-1||E===-1;let ie,se="SDR",ye=(z==null?void 0:z.frameRate)||0;const{audioPreference:N,videoPreference:re}=$,ne=this.audioTracksByGroup||(this.audioTracksByGroup=Tx(O));let Se=-1;if(Z){if(this.firstSelection!==-1)return this.firstSelection;const Ce=this.codecTiers||(this.codecTiers=function(ot,lt,nn,pn){return ot.slice(nn,pn+1).reduce((We,Ot,gn)=>{if(!Ot.codecSet)return We;const bt=Ot.audioGroups;let Wt=We[Ot.codecSet];Wt||(We[Ot.codecSet]=Wt={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:gn,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!bt,fragmentError:0}),Wt.minBitrate=Math.min(Wt.minBitrate,Ot.bitrate);const Un=Math.min(Ot.height,Ot.width);return Wt.minHeight=Math.min(Wt.minHeight,Un),Wt.minFramerate=Math.min(Wt.minFramerate,Ot.frameRate),Wt.minIndex=Math.min(Wt.minIndex,gn),Wt.maxScore=Math.max(Wt.maxScore,Ot.score),Wt.fragmentError+=Ot.fragmentError,Wt.videoRanges[Ot.videoRange]=(Wt.videoRanges[Ot.videoRange]||0)+1,bt&&bt.forEach(Ir=>{if(!Ir)return;const Kn=lt.groups[Ir];Kn&&(Wt.hasDefaultAudio=Wt.hasDefaultAudio||lt.hasDefaultAudio?Kn.hasDefault:Kn.hasAutoSelect||!lt.hasDefaultAudio&&!lt.hasAutoSelectAudio,Object.keys(Kn.channels).forEach(Rt=>{Wt.channels[Rt]=(Wt.channels[Rt]||0)+Kn.channels[Rt]}))}),We},{})}(M,ne,t,r)),J=function(ot,lt,nn,pn,We){const Ot=Object.keys(ot),gn=pn==null?void 0:pn.channels,bt=pn==null?void 0:pn.audioCodec,Wt=We==null?void 0:We.videoCodec,Un=gn&&parseInt(gn)===2;let Ir=!1,Kn=!1,Rt=1/0,Lr=1/0,$s=1/0,hu=1/0,Ba=0,mn=[];const{preferHDR:dp,allowedVideoRanges:lh}=bM(lt,We);for(let fr=Ot.length;fr--;){const ar=ot[Ot[fr]];Ir||(Ir=ar.channels[2]>0),Rt=Math.min(Rt,ar.minHeight),Lr=Math.min(Lr,ar.minFramerate),$s=Math.min($s,ar.minBitrate),lh.filter(pr=>ar.videoRanges[pr]>0).length>0&&(Kn=!0)}Rt=vt(Rt)?Rt:0,Lr=vt(Lr)?Lr:0;const Dn=Math.max(1080,Rt),$a=Math.max(30,Lr);$s=vt($s)?$s:nn,nn=Math.max($s,nn),Kn||(lt=void 0);const fu=Ot.length>1;return{codecSet:Ot.reduce((fr,ar)=>{const pr=ot[ar];if(ar===fr)return fr;if(mn=Kn?lh.filter(vs=>pr.videoRanges[vs]>0):[],fu){if(pr.minBitrate>nn)return ol(ar,`min bitrate of ${pr.minBitrate} > current estimate of ${nn}`),fr;if(!pr.hasDefaultAudio)return ol(ar,"no renditions with default or auto-select sound found"),fr;if(bt&&ar.indexOf(bt.substring(0,4))%5!=0)return ol(ar,`audio codec preference "${bt}" not found`),fr;if(gn&&!Un){if(!pr.channels[gn])return ol(ar,`no renditions with ${gn} channel sound found (channels options: ${Object.keys(pr.channels)})`),fr}else if((!bt||Un)&&Ir&&pr.channels[2]===0)return ol(ar,"no renditions with stereo sound found"),fr;if(pr.minHeight>Dn)return ol(ar,`min resolution of ${pr.minHeight} > maximum of ${Dn}`),fr;if(pr.minFramerate>$a)return ol(ar,`min framerate of ${pr.minFramerate} > maximum of ${$a}`),fr;if(!mn.some(vs=>pr.videoRanges[vs]>0))return ol(ar,`no variants with VIDEO-RANGE of ${Or(mn)} found`),fr;if(Wt&&ar.indexOf(Wt.substring(0,4))%5!=0)return ol(ar,`video codec preference "${Wt}" not found`),fr;if(pr.maxScore<Ba)return ol(ar,`max score of ${pr.maxScore} < selected max of ${Ba}`),fr}return fr&&(d0(ar)>=d0(fr)||pr.fragmentError>ot[fr].fragmentError)?fr:(hu=pr.minIndex,Ba=pr.maxScore,ar)},void 0),videoRanges:mn,preferHDR:dp,minFramerate:Lr,minBitrate:$s,minIndex:hu}}(Ce,se,a,N,re),{codecSet:ue,videoRanges:de,minFramerate:W,minBitrate:Ke,minIndex:nt,preferHDR:mt}=J;Se=nt,ie=ue,se=mt?de[de.length-1]:de[0],ye=W,a=Math.max(a,Ke),this.log(`picked start tier ${Or(J)}`)}else ie=z==null?void 0:z.codecSet,se=z==null?void 0:z.videoRange;const ce=T?T.duration:L?L.duration:0,we=this.bwEstimator.getEstimateTTFB()/1e3,ze=[];for(let Ce=r;Ce>=t;Ce--){var xe;const J=M[Ce],ue=Ce>A;if(!J)continue;if($.useMediaCapabilities&&!J.supportedResult&&!J.supportedPromise){const ot=navigator.mediaCapabilities;typeof(ot==null?void 0:ot.decodingInfo)=="function"&&(mM(J,ne,se,ye,a,N)||c0(J.videoCodec))?(J.supportedPromise=mx(J,ne,ot),J.supportedPromise.then(lt=>{if(!this.hls)return;J.supportedResult=lt;const nn=this.hls.levels,pn=nn.indexOf(J);lt.error?this.warn(`MediaCapabilities decodingInfo error: "${lt.error}" for level ${pn} ${Or(lt)}`):lt.supported||(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${pn} ${Or(lt)}`),pn>-1&&nn.length>1&&(this.log(`Removing unsupported level ${pn}`),this.hls.removeLevel(pn),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))})):J.supportedResult=fx}if((ie&&J.codecSet!==ie||se&&J.videoRange!==se||ue&&ye>J.frameRate||!ue&&ye>0&&ye<J.frameRate||J.supportedResult&&((xe=J.supportedResult.decodingInfoResults)==null||!xe[0].smooth))&&(!Z||Ce!==Se)){ze.push(Ce);continue}const de=J.details,W=(T?de==null?void 0:de.partTarget:de==null?void 0:de.averagetargetduration)||ce;let Ke;Ke=ue?c*a:f*a;const nt=ce&&s>=2*ce&&u===0?J.averageBitrate:J.maxBitrate,mt=this.getTimeToLoadFrag(we,Ke,nt*W,de===void 0);if(Ke>=nt&&(Ce===E||J.loadError===0&&J.fragmentError===0)&&(mt<=we||!vt(mt)||Q&&!this.bitrateTestDelay||mt<y)){const ot=this.forcedAutoLevel;return Ce===U||ot!==-1&&ot===U||(ze.length&&this.trace(`Skipped level(s) ${ze.join(",")} of ${r} max with CODECS and VIDEO-RANGE:"${M[ze[0]].codecs}" ${M[ze[0]].videoRange}; not compatible with "${ie}" ${se}`),this.info(`switch candidate:${A}->${Ce} adjustedbw(${Math.round(Ke)})-bitrate=${Math.round(Ke-nt)} ttfb:${we.toFixed(1)} avgDuration:${W.toFixed(1)} maxFetchDuration:${y.toFixed(1)} fetchDuration:${mt.toFixed(1)} firstSelection:${Z} codecSet:${J.codecSet} videoRange:${J.videoRange} hls.loadLevel:${U}`)),Z&&(this.firstSelection=Ce),Ce}}return-1}set nextAutoLevel(a){const t=this.deriveNextAutoLevel(a);this.ps!==t&&(this.nextAutoLevelKey="",this.ps=t)}deriveNextAutoLevel(a){const{maxAutoLevel:t,minAutoLevel:r}=this.hls;return Math.min(Math.max(a,r),t)}},bufferController:class extends iu{constructor(a,t){var r;super("buffer-controller",a.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this.ys=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this.ws=s=>{var u;this.hls&&((u=this.mediaSource)==null?void 0:u.readyState)==="open"&&this.hls.pauseBuffering()},this.Es=s=>{this.hls&&this.hls.resumeBuffering()},this.ks=s=>{const{media:u,mediaSource:f}=this;s&&this.log("Media source opened"),u&&f&&(f.removeEventListener("sourceopen",this.ks),u.removeEventListener("emptied",this.Ss),this.updateDuration(),this.hls.trigger(G.MEDIA_ATTACHED,{media:u,mediaSource:f}),this.mediaSource!==null&&this.checkPendingTracks())},this.Ts=()=>{this.log("Media source closed")},this.As=()=>{this.log("Media source ended")},this.Ss=()=>{const{mediaSrc:s,ys:u}=this;s!==u&&this.error(`Media element src was set while attaching MediaSource (${u} > ${s})`)},this.hls=a,this.fragmentTracker=t,this.appendSource=(r=Ac(a.config.preferManagedMediaSource),typeof self<"u"&&r===self.ManagedMediaSource),this.initTracks(),this.registerListeners()}hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this.ks=this.Ts=null,this.As=null,this.Es=this.ws=null}registerListeners(){const{hls:a}=this;a.on(G.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(G.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(G.MANIFEST_LOADING,this.onManifestLoading,this),a.on(G.MANIFEST_PARSED,this.onManifestParsed,this),a.on(G.BUFFER_RESET,this.onBufferReset,this),a.on(G.BUFFER_APPENDING,this.onBufferAppending,this),a.on(G.BUFFER_CODECS,this.onBufferCodecs,this),a.on(G.BUFFER_EOS,this.onBufferEos,this),a.on(G.BUFFER_FLUSHING,this.onBufferFlushing,this),a.on(G.LEVEL_UPDATED,this.onLevelUpdated,this),a.on(G.FRAG_PARSED,this.onFragParsed,this),a.on(G.FRAG_CHANGED,this.onFragChanged,this),a.on(G.ERROR,this.onError,this)}unregisterListeners(){const{hls:a}=this;a.off(G.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(G.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(G.MANIFEST_LOADING,this.onManifestLoading,this),a.off(G.MANIFEST_PARSED,this.onManifestParsed,this),a.off(G.BUFFER_RESET,this.onBufferReset,this),a.off(G.BUFFER_APPENDING,this.onBufferAppending,this),a.off(G.BUFFER_CODECS,this.onBufferCodecs,this),a.off(G.BUFFER_EOS,this.onBufferEos,this),a.off(G.BUFFER_FLUSHING,this.onBufferFlushing,this),a.off(G.LEVEL_UPDATED,this.onLevelUpdated,this),a.off(G.FRAG_PARSED,this.onFragParsed,this),a.off(G.FRAG_CHANGED,this.onFragChanged,this),a.off(G.ERROR,this.onError,this)}transferMedia(){const{media:a,mediaSource:t}=this;if(!a)return null;const r={};if(this.operationQueue){const u=this.isUpdating();u||this.operationQueue.removeBlockers();const f=this.isQueued();(u||f)&&this.warn(`Transfering MediaSource with${f?" operations in queue":""}${u?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const s=this.transferData;return!this.sourceBufferCount&&s&&s.mediaSource===t?cr(r,s.tracks):this.sourceBuffers.forEach(u=>{const[f]=u;f&&(r[f]=cr({},this.tracks[f]),this.removeBuffer(f)),u[0]=u[1]=null}),{media:a,mediaSource:t,tracks:r}}initTracks(){this.sourceBuffers=[[null,null],[null,null]],this.tracks={},this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(a,t){var r;let s=2;(t.audio&&!t.video||!t.altAudio)&&(s=1),this.bufferCodecEventsTotal=s,this.log(`${s} bufferCodec event(s) expected.`),(r=this.transferData)!=null&&r.mediaSource&&this.sourceBufferCount&&s&&this.bufferCreated()}onMediaAttaching(a,t){const r=this.media=t.media,s=Ac(this.appendSource);if(this.transferData=this.overrides=void 0,r&&s){const u=!!t.mediaSource;(u||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);const f=this.mediaSource=t.mediaSource||new s;if(this.assignMediaSource(f),u)this.ys=r.src,this.attachTransferred();else{const c=this.ys=self.URL.createObjectURL(f);if(this.appendSource)try{r.removeAttribute("src");const v=self.ManagedMediaSource;r.disableRemotePlayback=r.disableRemotePlayback||v&&f instanceof v,KI(r),function(y,E){const A=self.document.createElement("source");A.type="video/mp4",A.src=E,y.appendChild(A)}(r,c),r.load()}catch{r.src=c}else r.src=c}r.addEventListener("emptied",this.Ss)}}assignMediaSource(a){var t,r;this.log(`${((t=this.transferData)==null?void 0:t.mediaSource)===a?"transferred":"created"} media source: ${(r=a.constructor)==null?void 0:r.name}`),a.addEventListener("sourceopen",this.ks),a.addEventListener("sourceended",this.As),a.addEventListener("sourceclose",this.Ts),this.appendSource&&(a.addEventListener("startstreaming",this.Es),a.addEventListener("endstreaming",this.ws))}attachTransferred(){const a=this.media,t=this.transferData;if(!t||!a)return;const r=this.tracks,s=t.tracks,u=s?Object.keys(s):null,f=u?u.length:0,c=()=>{this.media&&this.mediaSourceOpenOrEnded&&this.ks()};if(s&&u&&f){if(!this.tracksReady)return this.hls.config.startFragPrefetch=!0,void this.log("attachTransferred: waiting for SourceBuffer track info");if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal})
required tracks: ${Or(r,(v,y)=>v==="initSegment"?void 0:y)};
transfer tracks: ${Or(s,(v,y)=>v==="initSegment"?void 0:y)}}`),!Vk(s,r)){t.mediaSource=null,t.tracks=void 0;const v=a.currentTime,y=this.details,E=Math.max(v,(y==null?void 0:y.fragments[0].start)||0);return E-v>1?void this.log(`attachTransferred: waiting for playback to reach new tracks start time ${v} -> ${E}`):(this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(s)}"->"${Object.keys(r)}") start time: ${E} currentTime: ${v}`),this.onMediaDetaching(G.MEDIA_DETACHING,{}),this.onMediaAttaching(G.MEDIA_ATTACHING,t),void(a.currentTime=E))}this.transferData=void 0,u.forEach(v=>{const y=v,E=s[y];if(E){const A=E.buffer;if(A){const L=this.fragmentTracker,T=E.id;if(L.hasFragments(T)||L.hasParts(T)){const U=bn.getBuffered(A);L.detectEvictedFragments(y,U,T,null,!0)}const M=ST(y),O=[y,A];this.sourceBuffers[M]=O,A.updating&&this.operationQueue&&this.operationQueue.prependBlocker(y),this.trackSourceBuffer(y,E)}}}),c(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),c()}get mediaSourceOpenOrEnded(){var a;const t=(a=this.mediaSource)==null?void 0:a.readyState;return t==="open"||t==="ended"}onMediaDetaching(a,t){const r=!!t.transferMedia;this.transferData=this.overrides=void 0;const{media:s,mediaSource:u,ys:f}=this;if(u){if(this.log("media source "+(r?"transferring":"detaching")),r)this.sourceBuffers.forEach(([c])=>{c&&this.removeBuffer(c)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const c=u.readyState==="open";try{const v=u.sourceBuffers;for(let y=v.length;y--;)c&&v[y].abort(),u.removeSourceBuffer(v[y]);c&&u.endOfStream()}catch(v){this.warn(`onMediaDetaching: ${v.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}u.removeEventListener("sourceopen",this.ks),u.removeEventListener("sourceended",this.As),u.removeEventListener("sourceclose",this.Ts),this.appendSource&&(u.removeEventListener("startstreaming",this.Es),u.removeEventListener("endstreaming",this.ws)),this.mediaSource=null,this.ys=null}s&&(s.removeEventListener("emptied",this.Ss),r||(f&&self.URL.revokeObjectURL(f),this.mediaSrc===f?(s.removeAttribute("src"),this.appendSource&&KI(s),s.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(G.MEDIA_DETACHED,t)}onBufferReset(){this.sourceBuffers.forEach(([a])=>{a&&this.resetBuffer(a)}),this.initTracks()}resetBuffer(a){var t;const r=(t=this.tracks[a])==null?void 0:t.buffer;if(this.removeBuffer(a),r)try{var s;(s=this.mediaSource)!=null&&s.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(r)}catch(u){this.warn(`onBufferReset ${a}`,u)}delete this.tracks[a]}removeBuffer(a){this.removeBufferListeners(a),this.sourceBuffers[ST(a)]=[null,null];const t=this.tracks[a];t&&(t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new oO(this.tracks)}onBufferCodecs(a,t){const r=this.tracks,s=Object.keys(t);this.log(`BUFFER_CODECS: "${s}" (current SB count ${this.sourceBufferCount})`);const u="audiovideo"in t&&(r.audio||r.video)||r.audiovideo&&("audio"in t||"video"in t),f=!u&&this.sourceBufferCount&&this.media&&s.some(c=>!r[c]);u||f?this.warn(`Unsupported transition between "${Object.keys(r)}" and "${s}" SourceBuffers`):(s.forEach(c=>{var v,y,E;const A=t[c],{id:L,codec:T,levelCodec:M,container:O,metadata:U,supplemental:$}=A;let z=r[c];const Q=(v=this.transferData)==null||(y=v.tracks)==null?void 0:y[c],Z=Q!=null&&Q.buffer?Q:z,ie=(Z==null?void 0:Z.pendingCodec)||(Z==null?void 0:Z.codec),se=Z==null?void 0:Z.levelCodec;z||(z=r[c]={buffer:void 0,listeners:[],codec:T,supplemental:$,container:O,levelCodec:M,metadata:U,id:L});const ye=f0(ie,se),N=ye==null?void 0:ye.replace(HI,"$1");let re=f0(T,M);const ne=(E=re)==null?void 0:E.replace(HI,"$1");re&&ye&&N!==ne&&(c.slice(0,5)==="audio"&&(re=h0(re,this.appendSource)),this.log(`switching codec ${ie} to ${re}`),re!==(z.pendingCodec||z.codec)&&(z.pendingCodec=re),z.container=O,this.appendChangeType(c,O,re))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),this.sourceBufferCount||this.mediaSourceOpenOrEnded&&this.checkPendingTracks())}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((a,t)=>{const r=this.tracks[t];return a[t]={id:r.id,container:r.container,codec:r.codec,levelCodec:r.levelCodec},a},{})}appendChangeType(a,t,r){const s=`${t};codecs=${r}`,u={label:`change-type=${s}`,execute:()=>{const f=this.tracks[a];if(f){const c=f.buffer;c!=null&&c.changeType&&(this.log(`changing ${a} sourceBuffer type to ${s}`),c.changeType(s),f.codec=r,f.container=t)}this.shiftAndExecuteNext(a)},onStart:()=>{},onComplete:()=>{},onError:f=>{this.warn(`Failed to change ${a} SourceBuffer type`,f)}};this.append(u,a,this.isPending(this.tracks[a]))}blockAudio(a){var t;const r=a.start,s=r+.05*a.duration;if(((t=this.fragmentTracker.getAppendedFrag(r,On))==null?void 0:t.gap)===!0)return;const u={label:"block-audio",execute:()=>{var f;const c=this.tracks.video;(this.lastVideoAppendEnd>s||c!=null&&c.buffer&&bn.isBuffered(c.buffer,s)||((f=this.fragmentTracker.getAppendedFrag(s,On))==null?void 0:f.gap)===!0)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:f=>{this.warn("Error executing block-audio operation",f)}};this.blockedAudioAppend={op:u,frag:a},this.append(u,"audio",!0)}unblockAudio(){const{blockedAudioAppend:a,operationQueue:t}=this;a&&t&&(this.blockedAudioAppend=null,t.unblockAudio(a.op))}onBufferAppending(a,t){const{tracks:r}=this,{data:s,type:u,parent:f,frag:c,part:v,chunkMeta:y}=t,E=y.buffering[u],A=c.sn,L=self.performance.now();E.start=L;const T=c.stats.buffering,M=v?v.stats.buffering:null;T.start===0&&(T.start=L),M&&M.start===0&&(M.start=L);const O=r.audio;let U=!1;u==="audio"&&(O==null?void 0:O.container)==="audio/mpeg"&&(U=!this.lastMpegAudioChunk||y.id===1||this.lastMpegAudioChunk.sn!==y.sn,this.lastMpegAudioChunk=y);const $=this.tracks.video,z=$==null?void 0:$.buffer;if(z&&A!=="initSegment"){const ie=v||c,se=this.blockedAudioAppend;if(u!=="audio"||f==="main"||this.blockedAudioAppend){if(u==="video"){const ye=ie.end;if(se){const N=se.frag.start;(ye>N||ye<this.lastVideoAppendEnd||bn.isBuffered(z,N))&&this.unblockAudio()}this.lastVideoAppendEnd=ye}}else{const ye=ie.start+.05*ie.duration,N=z.buffered,re=this.currentOp("video");N.length||re?!re&&!bn.isBuffered(z,ye)&&this.lastVideoAppendEnd<ye&&this.blockAudio(ie):this.blockAudio(ie)}}const Q=(v||c).start,Z={label:`append-${u}`,execute:()=>{if(E.executeStart=self.performance.now(),U){const ie=this.tracks[u];if(ie){const se=ie.buffer;if(se){const ye=Q-se.timestampOffset;Math.abs(ye)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${Q} (delta: ${ye}) sn: ${A})`),se.timestampOffset=Q)}}}this.appendExecutor(s,u)},onStart:()=>{},onComplete:()=>{const ie=self.performance.now();E.executeEnd=E.end=ie,T.first===0&&(T.first=ie),M&&M.first===0&&(M.first=ie);const se={};this.sourceBuffers.forEach(([ye,N])=>{ye&&(se[ye]=bn.getBuffered(N))}),this.appendErrors[u]=0,u==="audio"||u==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(G.BUFFER_APPENDED,{type:u,frag:c,part:v,chunkMeta:y,parent:c.type,timeRanges:se})},onError:ie=>{var se;const ye={type:Mt.MEDIA_ERROR,parent:c.type,details:Me.BUFFER_APPEND_ERROR,sourceBufferName:u,frag:c,part:v,chunkMeta:y,error:ie,err:ie,fatal:!1},N=(se=this.media)==null?void 0:se.error;if(ie.code===DOMException.QUOTA_EXCEEDED_ERR)ye.details=Me.BUFFER_FULL_ERROR;else if(ie.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!N)ye.errorAction=mm(!0);else if(ie.name===VI&&this.sourceBufferCount===0)ye.errorAction=mm(!0);else{const re=++this.appendErrors[u];this.warn(`Failed ${re}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${u}" sourceBuffer (${N||"no media error"})`),(re>=this.hls.config.appendErrorMaxRetry||N)&&(ye.fatal=!0)}this.hls.trigger(G.ERROR,ye)}};this.append(Z,u,this.isPending(this.tracks[u]))}getFlushOp(a,t,r){return this.log(`queuing "${a}" remove ${t}-${r}`),{label:"remove",execute:()=>{this.removeExecutor(a,t,r)},onStart:()=>{},onComplete:()=>{this.hls.trigger(G.BUFFER_FLUSHED,{type:a})},onError:s=>{this.warn(`Failed to remove ${t}-${r} from "${a}" SourceBuffer`,s)}}}onBufferFlushing(a,t){const{type:r,startOffset:s,endOffset:u}=t;r?this.append(this.getFlushOp(r,s,u),r):this.sourceBuffers.forEach(([f])=>{f&&this.append(this.getFlushOp(f,s,u),f)})}onFragParsed(a,t){const{frag:r,part:s}=t,u=[],f=s?s.elementaryStreams:r.elementaryStreams;f[ME]?u.push("audiovideo"):(f[Fs]&&u.push("audio"),f[Oa]&&u.push("video")),u.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${r.type} level: ${r.level} sn: ${r.sn}`),this.blockBuffers(()=>{const c=self.performance.now();r.stats.buffering.end=c,s&&(s.stats.buffering.end=c);const v=s?s.stats:r.stats;this.hls.trigger(G.FRAG_BUFFERED,{frag:r,part:s,stats:v,id:r.type})},u).catch(c=>{this.warn(`Fragment buffered callback ${c}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(a,t){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([a])=>{var t,r;return a&&(!((t=this.tracks[a])!=null&&t.ended)||((r=this.tracks[a])==null?void 0:r.ending))})}onBufferEos(a,t){var r;this.sourceBuffers.forEach(([u])=>{if(u){const f=this.tracks[u];t.type&&t.type!==u||(f.ending=!0,f.ended||(f.ended=!0,this.log(`${u} buffer reached EOS`)))}});const s=((r=this.overrides)==null?void 0:r.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([u])=>{var f;return u&&!((f=this.tracks[u])!=null&&f.ended)})&&(s?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:u}=this;u&&u.readyState==="open"?(this.log("Calling mediaSource.endOfStream()"),u.endOfStream(),this.hls.trigger(G.BUFFERED_TO_END,void 0)):u&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${u.readyState}`)})):(this.tracksEnded(),this.hls.trigger(G.BUFFERED_TO_END,void 0)))}tracksEnded(){this.sourceBuffers.forEach(([a])=>{if(a!==null){const t=this.tracks[a];t&&(t.ending=!1)}})}onLevelUpdated(a,{details:t}){t.fragments.length&&(this.details=t,this.updateDuration())}updateDuration(){const a=this.getDurationAndRange();a&&this.blockUntilOpen(()=>this.updateMediaSource(a))}onError(a,t){if(t.details===Me.BUFFER_APPEND_ERROR&&t.frag){var r;const s=(r=t.errorAction)==null?void 0:r.nextAutoLevel;vt(s)&&s!==t.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:a,details:t,media:r}=this;if(!r||t===null||!this.sourceBufferCount)return;const s=a.config,u=r.currentTime,f=t.levelTargetDuration,c=t.live&&s.liveBackBufferLength!==null?s.liveBackBufferLength:s.backBufferLength;if(vt(c)&&c>=0){const v=Math.max(c,f),y=Math.floor(u/f)*f-v;this.flushBackBuffer(u,f,y)}if(vt(s.frontBufferFlushThreshold)&&s.frontBufferFlushThreshold>0){const v=Math.max(s.maxBufferLength,s.frontBufferFlushThreshold),y=Math.max(v,f),E=Math.floor(u/f)*f+y;this.flushFrontBuffer(u,f,E)}}flushBackBuffer(a,t,r){this.sourceBuffers.forEach(([s,u])=>{if(u){const c=bn.getBuffered(u);if(c.length>0&&r>c.start(0)){var f;this.hls.trigger(G.BACK_BUFFER_REACHED,{bufferEnd:r});const v=this.tracks[s];if((f=this.details)!=null&&f.live)this.hls.trigger(G.LIVE_BACK_BUFFER_REACHED,{bufferEnd:r});else if(v!=null&&v.ended)return void this.log(`Cannot flush ${s} back buffer while SourceBuffer is in ended state`);this.hls.trigger(G.BUFFER_FLUSHING,{startOffset:0,endOffset:r,type:s})}}})}flushFrontBuffer(a,t,r){this.sourceBuffers.forEach(([s,u])=>{if(u){const f=bn.getBuffered(u),c=f.length;if(c<2)return;const v=f.start(c-1),y=f.end(c-1);if(r>v||a>=v&&a<=y)return;this.hls.trigger(G.BUFFER_FLUSHING,{startOffset:v,endOffset:1/0,type:s})}})}getDurationAndRange(){var a;const{details:t,mediaSource:r}=this;if(!t||!this.media||(r==null?void 0:r.readyState)!=="open")return null;const s=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&t.live&&r.setLiveSeekableRange){const c=Math.max(0,t.fragmentStart);return{duration:1/0,start:c,end:Math.max(c,s)}}return{duration:1/0}}const u=(a=this.overrides)==null?void 0:a.duration;if(u)return vt(u)?{duration:u}:null;const f=this.media.duration;return s>(vt(r.duration)?r.duration:0)&&s>f||!vt(f)?{duration:s}:null}updateMediaSource({duration:a,start:t,end:r}){const s=this.mediaSource;this.media&&s&&s.readyState==="open"&&(s.duration!==a&&(vt(a)&&this.log(`Updating MediaSource duration to ${a.toFixed(3)}`),s.duration=a),t!==void 0&&r!==void 0&&(this.log(`MediaSource duration is set to ${s.duration}. Setting seekable range to ${t}-${r}.`),s.setLiveSeekableRange(t,r)))}get tracksReady(){const a=this.pendingTrackCount;return a>0&&(a>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:a,pendingTrackCount:t,tracks:r}=this;if(this.log(`checkPendingTracks (pending: ${t} codec events expected: ${a}) ${Or(r)}`),this.tracksReady){var s;const u=(s=this.transferData)==null?void 0:s.tracks;u&&Object.keys(u).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const a={};this.sourceBuffers.forEach(([t,r])=>{if(t){const s=this.tracks[t];a[t]={buffer:r,container:s.container,codec:s.codec,supplemental:s.supplemental,levelCodec:s.levelCodec,id:s.id,metadata:s.metadata}}}),this.hls.trigger(G.BUFFER_CREATED,{tracks:a}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([t])=>{this.executeNext(t)})}else{const a=new Error("could not create source buffer for media codec(s)");this.hls.trigger(G.ERROR,{type:Mt.MEDIA_ERROR,details:Me.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:a,reason:a.message})}}createSourceBuffers(){const{tracks:a,sourceBuffers:t,mediaSource:r}=this;if(!r)throw new Error("createSourceBuffers called when mediaSource was null");for(const u in a){const f=u,c=a[f];if(this.isPending(c)){const v=this.getTrackCodec(c,f),y=`${c.container};codecs=${v}`;c.codec=v,this.log(`creating sourceBuffer(${y})${this.currentOp(f)?" Queued":""} ${Or(c)}`);try{const E=r.addSourceBuffer(y),A=ST(f),L=[f,E];t[A]=L,c.buffer=E}catch(E){var s;return this.error(`error while trying to add sourceBuffer: ${E.message}`),this.shiftAndExecuteNext(f),(s=this.operationQueue)==null||s.removeBlockers(),delete this.tracks[f],void this.hls.trigger(G.ERROR,{type:Mt.MEDIA_ERROR,details:Me.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:E,sourceBufferName:f,mimeType:y,parent:c.id})}this.trackSourceBuffer(f,c)}}this.bufferCreated()}getTrackCodec(a,t){const r=a.supplemental;let s=a.codec;r&&(t==="video"||t==="audiovideo")&&UE(r,"video")&&(s=function(f,c){const v=[];if(f){const y=f.split(",");for(let E=0;E<y.length;E++)lx(y[E],"video")||v.push(y[E])}return c&&v.push(c),v.join(",")}(s,r));const u=f0(s,a.levelCodec);return u?t.slice(0,5)==="audio"?h0(u,this.appendSource):u:""}trackSourceBuffer(a,t){const r=t.buffer;if(!r)return;const s=this.getTrackCodec(t,a);this.tracks[a]={buffer:r,codec:s,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(a),this.addBufferListener(a,"updatestart",this.onSBUpdateStart),this.addBufferListener(a,"updateend",this.onSBUpdateEnd),this.addBufferListener(a,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(a,"bufferedchange",(u,f)=>{const c=f.removedRanges;c!=null&&c.length&&this.hls.trigger(G.BUFFER_FLUSHED,{type:u})})}get mediaSrc(){var a,t;const r=((a=this.media)==null||(t=a.querySelector)==null?void 0:t.call(a,"source"))||this.media;return r==null?void 0:r.src}onSBUpdateStart(a){const t=this.currentOp(a);t&&t.onStart()}onSBUpdateEnd(a){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed")return void this.resetBuffer(a);const r=this.currentOp(a);r&&(r.onComplete(),this.shiftAndExecuteNext(a))}onSBUpdateError(a,t){var r;const s=new Error(`${a} SourceBuffer error. MediaSource readyState: ${(r=this.mediaSource)==null?void 0:r.readyState}`);this.error(`${s}`,t),this.hls.trigger(G.ERROR,{type:Mt.MEDIA_ERROR,details:Me.BUFFER_APPENDING_ERROR,sourceBufferName:a,error:s,fatal:!1});const u=this.currentOp(a);u&&u.onError(s)}removeExecutor(a,t,r){const{media:s,mediaSource:u}=this,f=this.tracks[a],c=f==null?void 0:f.buffer;if(!s||!u||!c)return this.warn(`Attempting to remove from the ${a} SourceBuffer, but it does not exist`),void this.shiftAndExecuteNext(a);const v=vt(s.duration)?s.duration:1/0,y=vt(u.duration)?u.duration:1/0,E=Math.max(0,t),A=Math.min(r,v,y);A>E&&(!f.ending||f.ended)?(f.ended=!1,this.log(`Removing [${E},${A}] from the ${a} SourceBuffer`),c.remove(E,A)):this.shiftAndExecuteNext(a)}appendExecutor(a,t){const r=this.tracks[t],s=r==null?void 0:r.buffer;if(!s)throw new lO(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);r.ending=!1,r.ended=!1,s.appendBuffer(a)}blockUntilOpen(a){if(this.isUpdating()||this.isQueued())this.blockBuffers(a).catch(t=>{this.warn(`SourceBuffer blocked callback ${t}`),this.stepOperationQueue(this.sourceBufferTypes)});else try{a()}catch(t){this.warn(`Callback run without blocking ${this.operationQueue} ${t}`)}}isUpdating(){return this.sourceBuffers.some(([a,t])=>a&&t.updating)}isQueued(){return this.sourceBuffers.some(([a])=>a&&!!this.currentOp(a))}isPending(a){return!!a&&!a.buffer}blockBuffers(a,t=this.sourceBufferTypes){if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(a);const{operationQueue:r}=this,s=t.map(u=>this.appendBlocker(u));return t.length>1&&this.blockedAudioAppend&&this.unblockAudio(),Promise.all(s).then(u=>{r===this.operationQueue&&(a(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(a){a.forEach(t=>{var r;const s=(r=this.tracks[t])==null?void 0:r.buffer;s&&!s.updating&&this.shiftAndExecuteNext(t)})}append(a,t,r){this.operationQueue&&this.operationQueue.append(a,t,r)}appendBlocker(a){if(this.operationQueue)return this.operationQueue.appendBlocker(a)}currentOp(a){return this.operationQueue?this.operationQueue.current(a):null}executeNext(a){a&&this.operationQueue&&this.operationQueue.executeNext(a)}shiftAndExecuteNext(a){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(a)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((a,t)=>a+(this.isPending(this.tracks[t])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((a,[t])=>a+(t?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([a])=>a).filter(a=>!!a)}addBufferListener(a,t,r){const s=this.tracks[a];if(!s)return;const u=s.buffer;if(!u)return;const f=r.bind(this,a);s.listeners.push({event:t,listener:f}),u.addEventListener(t,f)}removeBufferListeners(a){const t=this.tracks[a];if(!t)return;const r=t.buffer;r&&(t.listeners.forEach(s=>{r.removeEventListener(s.event,s.listener)}),t.listeners.length=0)}},capLevelController:wT,errorController:class extends iu{constructor(a){super("error-controller",a.logger),this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.hls=a,this.registerListeners()}registerListeners(){const a=this.hls;a.on(G.ERROR,this.onError,this),a.on(G.MANIFEST_LOADING,this.onManifestLoading,this),a.on(G.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const a=this.hls;a&&(a.off(G.ERROR,this.onError,this),a.off(G.ERROR,this.onErrorOut,this),a.off(G.MANIFEST_LOADING,this.onManifestLoading,this),a.off(G.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(a){}stopLoad(){this.playlistError=0}getVariantLevelIndex(a){return(a==null?void 0:a.type)===On?a.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(a,t){var r;if(t.fatal)return;const s=this.hls,u=t.context;switch(t.details){case Me.FRAG_LOAD_ERROR:case Me.FRAG_LOAD_TIMEOUT:case Me.KEY_LOAD_ERROR:case Me.KEY_LOAD_TIMEOUT:return void(t.errorAction=this.getFragRetryOrSwitchAction(t));case Me.FRAG_PARSING_ERROR:if((r=t.frag)!=null&&r.gap)return void(t.errorAction=mm());case Me.FRAG_GAP:case Me.FRAG_DECRYPT_ERROR:return t.errorAction=this.getFragRetryOrSwitchAction(t),void(t.errorAction.action=su);case Me.LEVEL_EMPTY_ERROR:case Me.LEVEL_PARSING_ERROR:{var f,c;const y=t.parent===On?t.level:s.loadLevel;t.details===Me.LEVEL_EMPTY_ERROR&&(f=t.context)!=null&&(c=f.levelDetails)!=null&&c.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,y):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,y))}return;case Me.LEVEL_LOAD_ERROR:case Me.LEVEL_LOAD_TIMEOUT:return void(typeof(u==null?void 0:u.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,u.level)));case Me.AUDIO_TRACK_LOAD_ERROR:case Me.AUDIO_TRACK_LOAD_TIMEOUT:case Me.SUBTITLE_LOAD_ERROR:case Me.SUBTITLE_TRACK_LOAD_TIMEOUT:if(u){const y=s.loadLevelObj;if(y&&(u.type===bo&&y.hasAudioGroup(u.groupId)||u.type===il&&y.hasSubtitleGroup(u.groupId)))return t.errorAction=this.getPlaylistRetryOrSwitchAction(t,s.loadLevel),t.errorAction.action=su,void(t.errorAction.flags=b0)}return;case Me.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const y=s.loadLevelObj,E=y==null?void 0:y.attrs["HDCP-LEVEL"];E?t.errorAction={action:su,flags:Rx,hdcpLevel:E}:this.keySystemError(t)}return;case Me.BUFFER_ADD_CODEC_ERROR:case Me.REMUX_ALLOC_ERROR:case Me.BUFFER_APPEND_ERROR:var v;t.errorAction||(t.errorAction=this.getLevelSwitchAction(t,(v=t.level)!=null?v:s.loadLevel));return;case Me.INTERNAL_EXCEPTION:case Me.BUFFER_APPENDING_ERROR:case Me.BUFFER_FULL_ERROR:case Me.LEVEL_SWITCH_ERROR:case Me.BUFFER_STALLED_ERROR:case Me.BUFFER_SEEK_OVER_HOLE:case Me.BUFFER_NUDGE_ON_STALL:return void(t.errorAction=mm())}t.type===Mt.KEY_SYSTEM_ERROR&&this.keySystemError(t)}keySystemError(a){const t=this.getVariantLevelIndex(a.frag);a.levelRetry=!1,a.errorAction=this.getLevelSwitchAction(a,t)}getPlaylistRetryOrSwitchAction(a,t){const r=xx(this.hls.config.playlistLoadPolicy,a),s=this.playlistError++;if(y0(r,s,m0(a),a.response))return{action:v0,flags:gm,retryConfig:r,retryCount:s};const u=this.getLevelSwitchAction(a,t);return r&&(u.retryConfig=r,u.retryCount=s),u}getFragRetryOrSwitchAction(a){const t=this.hls,r=this.getVariantLevelIndex(a.frag),s=t.levels[r],{fragLoadPolicy:u,keyLoadPolicy:f}=t.config,c=xx(a.details.startsWith("key")?f:u,a),v=t.levels.reduce((E,A)=>E+A.fragmentError,0);if(s&&(a.details!==Me.FRAG_GAP&&s.fragmentError++,y0(c,v,m0(a),a.response)))return{action:v0,flags:gm,retryConfig:c,retryCount:v};const y=this.getLevelSwitchAction(a,r);return c&&(y.retryConfig=c,y.retryCount=v),y}getLevelSwitchAction(a,t){const r=this.hls;t==null&&(t=r.loadLevel);const s=this.hls.levels[t];if(s){var u,f;const y=a.details;s.loadError++,y===Me.BUFFER_APPEND_ERROR&&s.fragmentError++;let E=-1;const{levels:A,loadLevel:L,minAutoLevel:T,maxAutoLevel:M}=r;r.autoLevelEnabled||(r.loadLevel=-1);const O=(u=a.frag)==null?void 0:u.type,U=(O===_s&&y===Me.FRAG_PARSING_ERROR||a.sourceBufferName==="audio"&&(y===Me.BUFFER_ADD_CODEC_ERROR||y===Me.BUFFER_APPEND_ERROR))&&A.some(({audioCodec:Z})=>s.audioCodec!==Z),$=a.sourceBufferName==="video"&&(y===Me.BUFFER_ADD_CODEC_ERROR||y===Me.BUFFER_APPEND_ERROR)&&A.some(({codecSet:Z,audioCodec:ie})=>s.codecSet!==Z&&s.audioCodec===ie),{type:z,groupId:Q}=(f=a.context)!=null?f:{};for(let Z=A.length;Z--;){const ie=(Z+L)%A.length;if(ie!==L&&ie>=T&&ie<=M&&A[ie].loadError===0){var c,v;const se=A[ie];if(y===Me.FRAG_GAP&&O===On&&a.frag){const ye=A[ie].details;if(ye){const N=Qd(a.frag,ye.fragments,a.frag.start);if(N!=null&&N.gap)continue}}else if(z===bo&&se.hasAudioGroup(Q)||z===il&&se.hasSubtitleGroup(Q)||O===_s&&(c=s.audioGroups)!=null&&c.some(ye=>se.hasAudioGroup(ye))||O===Eo&&(v=s.subtitleGroups)!=null&&v.some(ye=>se.hasSubtitleGroup(ye))||U&&s.audioCodec===se.audioCodec||!U&&s.audioCodec!==se.audioCodec||$&&s.codecSet===se.codecSet)continue;E=ie;break}}if(E>-1&&r.loadLevel!==E)return a.levelRetry=!0,this.playlistError=0,{action:su,flags:gm,nextAutoLevel:E}}return{action:su,flags:b0}}onErrorOut(a,t){var r;switch((r=t.errorAction)==null?void 0:r.action){case Lx:break;case su:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===Me.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()}sendAlternateToPenaltyBox(a){const t=this.hls,r=a.errorAction;if(!r)return;const{flags:s,hdcpLevel:u,nextAutoLevel:f}=r;switch(s){case gm:this.switchLevel(a,f);break;case Rx:u&&(t.maxHdcpLevel=$E[$E.indexOf(u)-1],r.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`)}r.resolved||this.switchLevel(a,f)}switchLevel(a,t){if(t!==void 0&&a.errorAction&&(this.warn(`switching to level ${t} after ${a.details}`),this.hls.nextAutoLevel=t,a.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,a.details===Me.BUFFER_ADD_CODEC_ERROR&&a.mimeType&&a.sourceBufferName!=="audiovideo")){const r=hx(a.mimeType),s=this.hls.levels;for(let u=s.length;u--;)s[u][`${a.sourceBufferName}Codec`]===r&&this.hls.removeLevel(u)}}},fpsController:class{constructor(a){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=a,this.registerListeners()}setStreamController(a){this.streamController=a}registerListeners(){this.hls.on(G.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(G.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(G.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(G.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(a,t){const r=this.hls.config;if(r.capLevelOnFPSDrop){const s=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=s,s&&typeof s.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),r.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(a,t,r){const s=performance.now();if(t){if(this.lastTime){const u=s-this.lastTime,f=r-this.lastDroppedFrames,c=t-this.lastDecodedFrames,v=1e3*f/u,y=this.hls;if(y.trigger(G.FPS_DROP,{currentDropped:f,currentDecoded:c,totalDroppedFrames:r}),v>0&&f>y.config.fpsDroppedMonitoringThreshold*c){let E=y.currentLevel;y.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+E),E>0&&(y.autoLevelCapping===-1||y.autoLevelCapping>=E)&&(E-=1,y.trigger(G.FPS_DROP_LEVEL_CAPPING,{level:E,droppedLevel:y.currentLevel}),y.autoLevelCapping=E,this.streamController.nextLevelSwitch())}}this.lastTime=s,this.lastDroppedFrames=r,this.lastDecodedFrames=t}}checkFPSInterval(){const a=this.media;if(a)if(this.isVideoPlaybackQualityAvailable){const t=a.getVideoPlaybackQuality();this.checkFPS(a,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(a,a.webkitDecodedFrameCount,a.webkitDroppedFrameCount)}},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:Gx,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,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}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,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},{cueHandler:qO,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:class extends aT{constructor(a,t,r){super(a,t,r,"subtitle-stream-controller",Eo),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();const{hls:a}=this;a.on(G.LEVEL_LOADED,this.onLevelLoaded,this),a.on(G.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),a.on(G.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),a.on(G.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.on(G.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),a.on(G.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:a}=this;a.off(G.LEVEL_LOADED,this.onLevelLoaded,this),a.off(G.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),a.off(G.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),a.off(G.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.off(G.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),a.off(G.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(a,t){this.stopLoad(),this.state=En,this.setInterval(500),this.nextLoadPosition=this.lastCurrentTime=a+this.timelineOffset,this.startPosition=t?-1:a,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(a,t){this.tracksBuffered=[],super.onMediaDetaching(a,t)}onLevelLoaded(a,t){this.mainDetails=t.details}onSubtitleFragProcessed(a,t){const{frag:r,success:s}=t;if(xi(r)&&(this.fragPrevious=r),this.state=En,!s)return;const u=this.tracksBuffered[this.currentTrackId];if(!u)return;let f;const c=r.start;for(let y=0;y<u.length;y++)if(c>=u[y].start&&c<=u[y].end){f=u[y];break}const v=r.start+r.duration;f?f.end=v:(f={start:c,end:v},u.push(f)),this.fragmentTracker.fragBuffered(r),this.fragBufferedComplete(r,null),this.media&&this.tick()}onBufferFlushing(a,t){const{startOffset:r,endOffset:s}=t;if(r===0&&s!==Number.POSITIVE_INFINITY){const u=s-1;if(u<=0)return;t.endOffsetSubtitles=Math.max(0,u),this.tracksBuffered.forEach(f=>{for(let c=0;c<f.length;)if(f[c].end<=u)f.shift();else{if(!(f[c].start<u))break;f[c].start=u,c++}}),this.fragmentTracker.removeFragmentsInRange(r,u,Eo)}}onError(a,t){const r=t.frag;(r==null?void 0:r.type)===Eo&&(t.details===Me.FRAG_GAP&&this.fragmentTracker.fragBuffered(r,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==ri&&(this.state=En))}onSubtitleTracksUpdated(a,{subtitleTracks:t}){this.levels&&GI(this.levels,t)?this.levels=t.map(r=>new pm(r)):(this.tracksBuffered=[],this.levels=t.map(r=>{const s=new pm(r);return this.tracksBuffered[s.id]=[],s}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Eo),this.fragPrevious=null,this.mediaBuffer=null)}onSubtitleTrackSwitch(a,t){var r;if(this.currentTrackId=t.id,(r=this.levels)==null||!r.length||this.currentTrackId===-1)return void this.clearInterval();const s=this.levels[this.currentTrackId];s!=null&&s.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,s&&this.state!==ri&&this.setInterval(500)}onSubtitleTrackLoaded(a,t){var r;const{currentTrackId:s,levels:u}=this,{details:f,id:c}=t;if(!u)return void this.warn(`Subtitle tracks were reset while loading level ${c}`);const v=u[c];if(c>=u.length||!v)return;this.log(`Subtitle track ${c} loaded [${f.startSN},${f.endSN}]${f.lastPartSn?`[part-${f.lastPartSn}-${f.lastPartIndex}]`:""},duration:${f.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let y=0;if(f.live||(r=v.details)!=null&&r.live){const A=this.mainDetails;if(f.deltaUpdateFailed||!A)return;const L=A.fragments[0];var E;v.details?(y=this.alignPlaylists(f,v.details,(E=this.levelLastLoaded)==null?void 0:E.details),y===0&&L&&(y=L.start,iT(f,y))):f.hasProgramDateTime&&A.hasProgramDateTime?(x0(f,A),y=f.fragmentStart):L&&(y=L.start,iT(f,y))}v.details=f,this.levelLastLoaded=v,c===s&&(this.hls.trigger(G.SUBTITLE_TRACK_UPDATED,{details:f,id:c,groupId:t.groupId}),this.tick(),f.live&&!this.fragCurrent&&this.media&&this.state===En)&&(Qd(null,f.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),v.details=void 0))}Kr(a){const{frag:t,payload:r}=a,s=t.decryptdata,u=this.hls;if(!this.fragContextChanged(t)&&r&&r.byteLength>0&&s!=null&&s.key&&s.iv&&Bf(s.method)){const f=performance.now();this.decrypter.decrypt(new Uint8Array(r),s.key.buffer,s.iv.buffer,qE(s.method)).catch(c=>{throw u.trigger(G.ERROR,{type:Mt.MEDIA_ERROR,details:Me.FRAG_DECRYPT_ERROR,fatal:!1,error:c,reason:c.message,frag:t}),c}).then(c=>{const v=performance.now();u.trigger(G.FRAG_DECRYPTED,{frag:t,payload:c,stats:{tstart:f,tdecrypt:v}})}).catch(c=>{this.warn(`${c.name}: ${c.message}`),this.state=En})}}doTick(){if(this.media){if(this.state===En){const{currentTrackId:a,levels:t}=this,r=t==null?void 0:t[a];if(!r||!t.length||!r.details||this.waitForLive(r))return;const{config:s}=this,u=this.getLoadPosition(),f=bn.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],u,s.maxBufferHole),{end:c,len:v}=f,y=r.details;if(v>this.hls.maxBufferLength+y.levelTargetDuration)return;const E=y.fragments,A=E.length,L=y.edge;let T=null;const M=this.fragPrevious;if(c<L){const U=s.maxFragLookUpTolerance,$=c>L-U?0:U;T=Qd(M,E,Math.max(E[0].start,c),$),!T&&M&&M.start<E[0].start&&(T=E[0])}else T=E[A-1];if(T=this.filterReplacedPrimary(T,r.details),!T)return;const O=E[T.sn-y.startSN-1];if(O&&O.cc===T.cc&&this.fragmentTracker.getState(O)===ym&&(T=O),this.fragmentTracker.getState(T)===ym){const U=this.mapToInitFragWhenRequired(T);U&&this.loadFragment(U,r,c)}}}else this.state=En}loadFragment(a,t,r){xi(a)?super.loadFragment(a,t,r):this.Wr(a,t)}get mediaBufferTimeRanges(){return new LO(this.tracksBuffered[this.currentTrackId]||[])}},subtitleTrackController:class extends ET{constructor(a){super(a,"subtitle-track-controller"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this.Ms=!0,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const r=N0(this.media.textTracks);for(let u=0;u<r.length;u++)if(r[u].mode==="hidden")t=r[u];else if(r[u].mode==="showing"){t=r[u];break}const s=this.findTrackForTextTrack(t);this.subtitleTrack!==s&&this.setSubtitleTrack(s)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this.Ms}set subtitleDisplay(a){this.Ms=a,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:a}=this;a.on(G.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(G.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(G.MANIFEST_LOADING,this.onManifestLoading,this),a.on(G.MANIFEST_PARSED,this.onManifestParsed,this),a.on(G.LEVEL_LOADING,this.onLevelLoading,this),a.on(G.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(G.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.on(G.ERROR,this.onError,this)}unregisterListeners(){const{hls:a}=this;a.off(G.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(G.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(G.MANIFEST_LOADING,this.onManifestLoading,this),a.off(G.MANIFEST_PARSED,this.onManifestParsed,this),a.off(G.LEVEL_LOADING,this.onLevelLoading,this),a.off(G.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(G.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),a.off(G.ERROR,this.onError,this)}onMediaAttached(a,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-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))}pollTrackChange(a){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,a)}onMediaDetaching(a,t){const r=this.media;if(!r)return;const s=!!t.transferMedia;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||r.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,!s&&N0(r.textTracks).forEach(u=>{Yf(u)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(a,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(a,t){const{id:r,groupId:s,details:u}=t,f=this.tracksInGroup[r];if(!f||f.groupId!==s)return void this.warn(`Subtitle track with id:${r} and group:${s} not found in active group ${f==null?void 0:f.groupId}`);const c=f.details;f.details=t.details,this.log(`Subtitle track ${r} "${f.name}" lang:${f.lang} group:${s} loaded [${u.startSN}-${u.endSN}]`),r===this.trackId&&this.playlistLoaded(r,t,c)}onLevelLoading(a,t){this.switchLevel(t.level)}onLevelSwitching(a,t){this.switchLevel(t.level)}switchLevel(a){const t=this.hls.levels[a];if(!t)return;const r=t.subtitleGroups||null,s=this.groupIds;let u=this.currentTrack;if(!r||(s==null?void 0:s.length)!==(r==null?void 0:r.length)||r!=null&&r.some(f=>(s==null?void 0:s.indexOf(f))===-1)){this.groupIds=r,this.trackId=-1,this.currentTrack=null;const f=this.tracks.filter(E=>!r||r.indexOf(E.groupId)!==-1);if(f.length)this.selectDefaultTrack&&!f.some(E=>E.default)&&(this.selectDefaultTrack=!1),f.forEach((E,A)=>{E.id=A});else if(!u&&!this.tracksInGroup.length)return;this.tracksInGroup=f;const c=this.hls.config.subtitlePreference;if(!u&&c){this.selectDefaultTrack=!1;const E=ll(c,f);if(E>-1)u=f[E];else{const A=ll(c,this.tracks);u=this.tracks[A]}}let v=this.findTrackId(u);v===-1&&u&&(v=this.findTrackId(null));const y={subtitleTracks:f};this.log(`Updating subtitle tracks, ${f.length} track(s) found in "${r==null?void 0:r.join(",")}" group-id`),this.hls.trigger(G.SUBTITLE_TRACKS_UPDATED,y),v!==-1&&this.trackId===-1&&this.setSubtitleTrack(v)}}findTrackId(a){const t=this.tracksInGroup,r=this.selectDefaultTrack;for(let s=0;s<t.length;s++){const u=t[s];if((!r||u.default)&&(r||a)&&(!a||Wd(u,a)))return s}if(a){for(let s=0;s<t.length;s++){const u=t[s];if(Im(a.attrs,u.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return s}for(let s=0;s<t.length;s++){const u=t[s];if(Im(a.attrs,u.attrs,["LANGUAGE"]))return s}}return-1}findTrackForTextTrack(a){if(a){const t=this.tracksInGroup;for(let r=0;r<t.length;r++)if(TT(t[r],a))return r}return-1}onError(a,t){!t.fatal&&t.context&&(t.context.type!==il||t.context.id!==this.trackId||this.groupIds&&this.groupIds.indexOf(t.context.groupId)===-1||this.checkRetry(t))}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(a){this.selectDefaultTrack=!1,this.setSubtitleTrack(a)}setSubtitleOption(a){if(this.hls.config.subtitlePreference=a,a){if(a.id===-1)return this.setSubtitleTrack(-1),null;const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const r=this.currentTrack;if(r&&Wd(a,r))return r;const s=ll(a,this.tracksInGroup);if(s>-1){const u=this.tracksInGroup[s];return this.setSubtitleTrack(s),u}if(r)return null;{const u=ll(a,t);if(u>-1)return t[u]}}}return null}loadPlaylist(a){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,a)}loadingPlaylist(a,t){super.loadingPlaylist(a,t);const r=a.id,s=a.groupId,u=this.getUrlWithDirectives(a.url,t),f=a.details,c=f==null?void 0:f.age;this.log(`Loading subtitle ${r} "${a.name}" lang:${a.lang} group:${s}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${c&&f.live?" age "+c.toFixed(1)+(f.type&&" "+f.type||""):""} ${u}`),this.hls.trigger(G.SUBTITLE_TRACK_LOADING,{url:u,id:r,groupId:s,deliveryDirectives:t||null,track:a})}toggleTrackModes(){const{media:a}=this;if(!a)return;const t=N0(a.textTracks),r=this.currentTrack;let s;if(r&&(s=t.filter(u=>TT(r,u))[0],s||this.warn(`Unable to find subtitle TextTrack with name "${r.name}" and language "${r.lang}"`)),[].slice.call(t).forEach(u=>{u.mode!=="disabled"&&u!==s&&(u.mode="disabled")}),s){const u=this.subtitleDisplay?"showing":"hidden";s.mode!==u&&(s.mode=u)}}setSubtitleTrack(a){const t=this.tracksInGroup;if(!this.media)return void(this.queuedDefaultTrack=a);if(a<-1||a>=t.length||!vt(a))return void this.warn(`Invalid subtitle track id: ${a}`);this.selectDefaultTrack=!1;const r=this.currentTrack,s=t[a]||null;if(this.trackId=a,this.currentTrack=s,this.toggleTrackModes(),!s)return void this.hls.trigger(G.SUBTITLE_TRACK_SWITCH,{id:a});const u=!!s.details&&!s.details.live;if(a===this.trackId&&s===r&&u)return;this.log(`Switching to subtitle-track ${a}`+(s?` "${s.name}" lang:${s.lang} group:${s.groupId}`:""));const{id:f,groupId:c="",name:v,type:y,url:E}=s;this.hls.trigger(G.SUBTITLE_TRACK_SWITCH,{id:f,groupId:c,name:v,type:y,url:E});const A=this.switchParams(s.url,r==null?void 0:r.details,s.details);this.loadPlaylist(A)}},timelineController:class{constructor(a){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={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this.captionsProperties=void 0,this.hls=a,this.config=a.config,this.Cues=a.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}},a.on(G.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(G.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(G.MANIFEST_LOADING,this.onManifestLoading,this),a.on(G.MANIFEST_LOADED,this.onManifestLoaded,this),a.on(G.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),a.on(G.FRAG_LOADING,this.onFragLoading,this),a.on(G.FRAG_LOADED,this.onFragLoaded,this),a.on(G.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),a.on(G.FRAG_DECRYPTED,this.onFragDecrypted,this),a.on(G.INIT_PTS_FOUND,this.onInitPtsFound,this),a.on(G.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),a.on(G.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:a}=this;a.off(G.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(G.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(G.MANIFEST_LOADING,this.onManifestLoading,this),a.off(G.MANIFEST_LOADED,this.onManifestLoaded,this),a.off(G.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),a.off(G.FRAG_LOADING,this.onFragLoading,this),a.off(G.FRAG_LOADED,this.onFragLoaded,this),a.off(G.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),a.off(G.FRAG_DECRYPTED,this.onFragDecrypted,this),a.off(G.INIT_PTS_FOUND,this.onInitPtsFound,this),a.off(G.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),a.off(G.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const a=new B0(this,"textTrack1"),t=new B0(this,"textTrack2"),r=new B0(this,"textTrack3"),s=new B0(this,"textTrack4");this.cea608Parser1=new uL(1,a,t),this.cea608Parser2=new uL(3,r,s)}addCues(a,t,r,s,u){let f=!1;for(let A=u.length;A--;){const L=u[A],T=(c=L[0],v=L[1],y=t,E=r,Math.min(v,E)-Math.max(c,y));if(T>=0&&(L[0]=Math.min(L[0],t),L[1]=Math.max(L[1],r),f=!0,T/(r-t)>.5))return}var c,v,y,E;if(f||u.push([t,r]),this.config.renderTextTracksNatively){const A=this.captionsTracks[a];this.Cues.newCue(A,t,r,s)}else{const A=this.Cues.newCue(null,t,r,s);this.hls.trigger(G.CUES_PARSED,{type:"captions",cues:A,track:a})}}onInitPtsFound(a,{frag:t,id:r,initPTS:s,timescale:u}){const{unparsedVttFrags:f}=this;r===On&&(this.initPTS[t.cc]={baseTime:s,timescale:u}),f.length&&(this.unparsedVttFrags=[],f.forEach(c=>{this.onFragLoaded(G.FRAG_LOADED,c)}))}getExistingTrack(a,t){const{media:r}=this;if(r)for(let s=0;s<r.textTracks.length;s++){const u=r.textTracks[s];if(EL(u,{name:a,lang:t,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return u}return null}createCaptionsTrack(a){this.config.renderTextTracksNatively?this.createNativeTrack(a):this.createNonNativeTrack(a)}createNativeTrack(a){if(this.captionsTracks[a])return;const{captionsProperties:t,captionsTracks:r,media:s}=this,{label:u,languageCode:f}=t[a],c=this.getExistingTrack(u,f);if(c)r[a]=c,Yf(r[a]),nL(r[a],s);else{const v=this.createTextTrack("captions",u,f);v&&(v[a]=!0,r[a]=v)}}createNonNativeTrack(a){if(this.nonNativeCaptionsTracks[a])return;const t=this.captionsProperties[a];if(!t)return;const r={Is:a,label:t.label,kind:"captions",default:!!t.media&&!!t.media.default,closedCaptions:t.media};this.nonNativeCaptionsTracks[a]=r,this.hls.trigger(G.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[r]})}createTextTrack(a,t,r){const s=this.media;if(s)return s.addTextTrack(a,t,r)}onMediaAttaching(a,t){this.media=t.media,t.mediaSource||this.Ls()}onMediaDetaching(a,t){const r=!!t.transferMedia;if(this.media=null,r)return;const{captionsTracks:s}=this;Object.keys(s).forEach(u=>{Yf(s[u]),delete s[u]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this.Ls(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}Ls(){const{media:a}=this;if(!a)return;const t=a.textTracks;if(t)for(let r=0;r<t.length;r++)Yf(t[r])}onSubtitleTracksUpdated(a,t){const r=t.subtitleTracks||[],s=r.some(u=>u.textCodec===NT);if(this.config.enableWebVTT||s&&this.config.enableIMSC1){if(GI(this.tracks,r))return void(this.tracks=r);if(this.textTracks=[],this.tracks=r,this.config.renderTextTracksNatively){const u=this.media,f=u?N0(u.textTracks):null;if(this.tracks.forEach((c,v)=>{let y;if(f){let E=null;for(let A=0;A<f.length;A++)if(f[A]&&EL(f[A],c)){E=f[A],f[A]=null;break}E&&(y=E)}if(y)Yf(y);else{const E=bL(c);y=this.createTextTrack(E,c.name,c.lang),y&&(y.mode="disabled")}y&&this.textTracks.push(y)}),f!=null&&f.length){const c=f.filter(v=>v!==null).map(v=>v.label);c.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${c.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const u=this.tracks.map(f=>({label:f.name,kind:f.type.toLowerCase(),default:f.default,subtitleTrack:f}));this.hls.trigger(G.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:u})}}}onManifestLoaded(a,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(r=>{const s=/(?:CC|SERVICE)([1-4])/.exec(r.instreamId);if(!s)return;const u=`textTrack${s[1]}`,f=this.captionsProperties[u];f&&(f.label=r.name,r.lang&&(f.languageCode=r.lang),f.media=r)})}closedCaptionsForLevel(a){const t=this.hls.levels[a.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(a,t){if(this.enabled&&t.frag.type===On){var r,s;const{cea608Parser1:u,cea608Parser2:f,lastSn:c}=this,{cc:v,sn:y}=t.frag,E=(r=(s=t.part)==null?void 0:s.index)!=null?r:-1;u&&f&&(y!==c+1||y===c&&E!==this.lastPartIndex+1||v!==this.lastCc)&&(u.reset(),f.reset()),this.lastCc=v,this.lastSn=y,this.lastPartIndex=E}}onFragLoaded(a,t){const{frag:r,payload:s}=t;if(r.type===Eo)if(s.byteLength){const u=r.decryptdata,f="stats"in t;if(u==null||!u.encrypted||f){const c=this.tracks[r.level],v=this.vttCCs;v[r.cc]||(v[r.cc]={start:r.start,prevCC:this.prevCC,new:!0},this.prevCC=r.cc),c&&c.textCodec===NT?this.xs(r,s):this.Ds(t)}}else this.hls.trigger(G.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:new Error("Empty subtitle payload")})}xs(a,t){const r=this.hls;gL(t,this.initPTS[a.cc],s=>{this.Cs(s,a.level),r.trigger(G.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:a})},s=>{r.logger.log(`Failed to parse IMSC1: ${s}`),r.trigger(G.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:a,error:s})})}Ds(a){var t;const{frag:r,payload:s}=a,{initPTS:u,unparsedVttFrags:f}=this,c=u.length-1;if(!u[r.cc]&&c===-1)return void f.push(a);const v=this.hls;VO((t=r.initSegment)!=null&&t.data?Na(r.initSegment.data,new Uint8Array(s)).buffer:s,this.initPTS[r.cc],this.vttCCs,r.cc,r.start,y=>{this.Cs(y,r.level),v.trigger(G.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:r})},y=>{const E=y.message==="Missing initPTS for VTT MPEGTS";E?f.push(a):this.$s(r,s),v.logger.log(`Failed to parse VTT cue: ${y}`),E&&c>r.cc||v.trigger(G.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:y})})}$s(a,t){const r=this.tracks[a.level];r.textCodec||gL(t,this.initPTS[a.cc],()=>{r.textCodec=NT,this.xs(a,t)},()=>{r.textCodec="wvtt"})}Cs(a,t){const r=this.hls;if(this.config.renderTextTracksNatively){const s=this.textTracks[t];if(!s||s.mode==="disabled")return;a.forEach(u=>rL(s,u))}else{const s=this.tracks[t];if(!s)return;const u=s.default?"default":"subtitles"+t;r.trigger(G.CUES_PARSED,{type:"subtitles",cues:a,track:u})}}onFragDecrypted(a,t){const{frag:r}=t;r.type===Eo&&this.onFragLoaded(G.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(a,t){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:r,samples:s}=t;if(r.type!==On||this.closedCaptionsForLevel(r)!=="NONE")for(let u=0;u<s.length;u++){const f=s[u].bytes;if(f){this.cea608Parser1||this.initCea608Parsers();const c=this.extractCea608Data(f);this.cea608Parser1.addData(s[u].pts,c[0]),this.cea608Parser2.addData(s[u].pts,c[1])}}}onBufferFlushing(a,{startOffset:t,endOffset:r,endOffsetSubtitles:s,type:u}){const{media:f}=this;if(f&&!(f.currentTime<r)){if(!u||u==="video"){const{captionsTracks:c}=this;Object.keys(c).forEach(v=>IT(c[v],t,r))}if(this.config.renderTextTracksNatively&&t===0&&s!==void 0){const{textTracks:c}=this;Object.keys(c).forEach(v=>IT(c[v],t,s))}}}extractCea608Data(a){const t=[[],[]],r=31&a[0];let s=2;for(let u=0;u<r;u++){const f=a[s++],c=127&a[s++],v=127&a[s++];if(!(c===0&&v===0)&&4&f){const y=3&f;y!==0&&y!==1||(t[y].push(c),t[y].push(v))}}return t}},audioStreamController:class extends aT{constructor(a,t,r){super(a,t,r,"audio-stream-controller",_s),this.mainAnchor=null,this.mainFragLoading=null,this.audioOnly=!1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.resetItem()}resetItem(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null}registerListeners(){super.registerListeners();const{hls:a}=this;a.on(G.LEVEL_LOADED,this.onLevelLoaded,this),a.on(G.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),a.on(G.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),a.on(G.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),a.on(G.BUFFER_RESET,this.onBufferReset,this),a.on(G.BUFFER_CREATED,this.onBufferCreated,this),a.on(G.BUFFER_FLUSHING,this.onBufferFlushing,this),a.on(G.BUFFER_FLUSHED,this.onBufferFlushed,this),a.on(G.INIT_PTS_FOUND,this.onInitPtsFound,this),a.on(G.FRAG_LOADING,this.onFragLoading,this),a.on(G.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:a}=this;a&&(super.unregisterListeners(),a.off(G.LEVEL_LOADED,this.onLevelLoaded,this),a.off(G.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),a.off(G.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),a.off(G.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),a.off(G.BUFFER_RESET,this.onBufferReset,this),a.off(G.BUFFER_CREATED,this.onBufferCreated,this),a.off(G.BUFFER_FLUSHING,this.onBufferFlushing,this),a.off(G.BUFFER_FLUSHED,this.onBufferFlushed,this),a.off(G.INIT_PTS_FOUND,this.onInitPtsFound,this),a.off(G.FRAG_LOADING,this.onFragLoading,this),a.off(G.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(a,{frag:t,id:r,initPTS:s,timescale:u}){if(r===On){const f=t.cc,c=this.fragCurrent;if(this.initPTS[f]={baseTime:s,timescale:u},this.log(`InitPTS for cc: ${f} found from main: ${s}/${u}`),this.mainAnchor=t,this.state===Tm){const v=this.waitingData;(!v&&!this.loadingParts||v&&v.frag.cc!==f)&&(this.nextLoadPosition=this.findSyncFrag(t).start),this.tick()}else!this.hls.hasEnoughToStart&&c&&c.cc!==f?(this.startFragRequested=!1,this.nextLoadPosition=this.findSyncFrag(t).start,c.abortRequests(),this.resetLoadingState()):this.state===En&&this.tick()}}findSyncFrag(a){const t=this.getLevelDetails(),r=a.cc;return function(s,u,f){if(s&&s.startCC<=u&&s.endCC>=u){const c=f.start,v=f.end;let y=s.fragments;if(!f.relurl){const{fragmentHint:E}=s;E&&(y=y.concat(E))}return jE(y,E=>E.cc<u||E.end<=c?1:E.cc>u||E.start>=v?-1:0)}return null}(t,r,a)||t&&kx(t.fragments,r)||a}startLoad(a,t){if(!this.levels)return this.startPosition=a,void(this.state=ri);const r=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),r>0&&a===-1?(this.log(`Override startPosition with lastCurrentTime @${r.toFixed(3)}`),a=r,this.state=En):this.state=Gf,this.nextLoadPosition=this.lastCurrentTime=a+this.timelineOffset,this.startPosition=t?-1:a,this.tick()}doTick(){switch(this.state){case En:this.doTickIdle();break;case Gf:{const{levels:t,trackId:r}=this,s=t==null?void 0:t[r],u=s==null?void 0:s.details;if(u&&!this.waitForLive(s)){if(this.waitForCdnTuneIn(u))break;this.state=Tm}break}case jf:{var a;const t=performance.now(),r=this.retryDate;if(!r||t>=r||(a=this.media)!=null&&a.seeking){const{levels:s,trackId:u}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((s==null?void 0:s[u])||null),this.state=En}break}case Tm:{const t=this.waitingData;if(t){const{frag:r,part:s,cache:u,complete:f}=t,c=this.mainAnchor;if(this.initPTS[r.cc]!==void 0){this.waitingData=null,this.state=$f;const v={frag:r,part:s,payload:u.flush().buffer,networkDetails:null};this.qr(v),f&&super.Kr(v)}else c&&c.cc!==t.frag.cc&&(this.log(`Waiting fragment cc (${r.cc}) cancelled because video is at cc ${c.cc}`),this.nextLoadPosition=this.findSyncFrag(c).start,this.clearWaitingFragment())}else this.state=En}}this.onTickEnd()}clearWaitingFragment(){const a=this.waitingData;a&&(this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.fragmentTracker.removeFragment(a.frag),this.waitingData=null,this.state!==ri&&(this.state=En))}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:a}=this;a!=null&&a.readyState&&(this.lastCurrentTime=a.currentTime)}doTickIdle(){var a;const{hls:t,levels:r,media:s,trackId:u}=this,f=t.config;if(!this.buffering||!s&&!this.primaryPrefetch&&(this.startFragRequested||!f.startFragPrefetch)||r==null||!r[u])return;const c=r[u],v=c.details;if(!v||this.waitForLive(c)||this.waitForCdnTuneIn(v))return this.state=Gf,void(this.startFragRequested=!1);const y=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&y&&(this.bufferFlushed=!1,this.afterBufferFlushed(y,Fs,_s));const E=this.getFwdBufferInfo(y,_s);if(E===null)return;if(!this.switchingTrack&&this.Vr(E,v))return t.trigger(G.BUFFER_EOS,{type:"audio"}),void(this.state=Hf);const A=E.len,L=t.maxBufferLength,T=v.fragments,M=T[0].start,O=this.getLoadPosition(),U=this.flushing?O:E.end;if(this.switchingTrack&&s){const Q=O;v.PTSKnown&&Q<M&&(E.end>M||E.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),s.currentTime=M+.05)}if(A>=L&&!this.switchingTrack&&U<T[T.length-1].start)return;let $=this.getNextFragment(U,v);if($&&this.isLoopLoading($,U)&&($=this.getNextFragmentLoopLoading($,v,E,On,L)),!$)return void(this.bufferFlushed=!0);let z=((a=this.mainFragLoading)==null?void 0:a.frag)||null;if(!this.audioOnly&&this.startFragRequested&&z&&xi($)&&!$.endList&&(!v.live||!this.loadingParts&&U<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(z)===Ff&&(this.mainFragLoading=z=null),z&&xi(z))){if($.start>z.end){const Q=this.fragmentTracker.getFragAtPos(U,On);Q&&Q.end>z.end&&(z=Q,this.mainFragLoading={frag:Q,targetBufferTime:null})}if($.start>z.end)return}this.loadFragment($,c,U)}onMediaDetaching(a,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(a,t)}onAudioTracksUpdated(a,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(r=>new pm(r))}onAudioTrackSwitching(a,t){const r=!!t.url;this.trackId=t.id;const{fragCurrent:s}=this;s&&(s.abortRequests(),this.removeUnbufferedFrags(s.start)),this.resetLoadingState(),r?(this.switchingTrack=t,this.flushAudioIfNeeded(t),this.state!==ri&&(this.setInterval(100),this.state=En,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(a,t){this.mainDetails=t.details;const r=this.cachedTrackLoadedData;r&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(G.AUDIO_TRACK_LOADED,r))}onAudioTrackLoaded(a,t){var r;const{levels:s}=this,{details:u,id:f,groupId:c,track:v}=t;if(!s)return void this.warn(`Audio tracks reset while loading track ${f} "${v.name}" of "${c}"`);const y=this.mainDetails;if(!y||u.endCC>y.endCC||y.expired)return this.cachedTrackLoadedData=t,void(this.state!==ri&&(this.state=Gf));this.cachedTrackLoadedData=null,this.log(`Audio track ${f} "${v.name}" of "${c}" loaded [${u.startSN},${u.endSN}]${u.lastPartSn?`[part-${u.lastPartSn}-${u.lastPartIndex}]`:""},duration:${u.totalduration}`);const E=s[f];let A=0;if(u.live||(r=E.details)!=null&&r.live){if(this.checkLiveUpdate(u),u.deltaUpdateFailed)return;var L;E.details&&(A=this.alignPlaylists(u,E.details,(L=this.levelLastLoaded)==null?void 0:L.details)),u.alignedSliding||(dI(u,y),u.alignedSliding||x0(u,y),A=u.fragmentStart)}E.details=u,this.levelLastLoaded=E,this.startFragRequested||this.setStartPosition(y,A),this.hls.trigger(G.AUDIO_TRACK_UPDATED,{details:u,id:f,groupId:t.groupId}),this.state!==Gf||this.waitForCdnTuneIn(u)||(this.state=En),this.tick()}qr(a){var t;const r=a.frag,{part:s,payload:u}=a,{config:f,trackId:c,levels:v}=this;if(!v)return void this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${r.sn} of level ${r.level} will not be buffered`);const y=v[c];if(!y)return void this.warn("Audio track is undefined on fragment load progress");const E=y.details;if(!E)return this.warn("Audio track details undefined on fragment load progress"),void this.removeUnbufferedFrags(r.start);const A=f.defaultAudioCodec||y.audioCodec||"mp4a.40.2";let L=this.transmuxer;L||(L=this.transmuxer=new jI(this.hls,_s,this.Rs.bind(this),this.zr.bind(this)));const T=this.initPTS[r.cc],M=(t=r.initSegment)==null?void 0:t.data;if(T!==void 0){const U=s?s.index:-1,$=U!==-1,z=new KE(r.level,r.sn,r.stats.chunkCount,u.byteLength,U,$);L.push(u,M,A,"",r,s,E.totalduration,!1,z,T)}else{this.log(`Unknown video PTS for cc ${r.cc}, waiting for video PTS before demuxing audio frag ${r.sn} of [${E.startSN} ,${E.endSN}],track ${c}`);const{cache:O}=this.waitingData=this.waitingData||{frag:r,part:s,cache:new fI,complete:!1};O.push(new Uint8Array(u)),this.state!==ri&&(this.state=Tm)}}Kr(a){this.waitingData?this.waitingData.complete=!0:super.Kr(a)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(a,t){this.bufferFlushed=this.flushing=!1;const r=t.tracks.audio;r&&(this.mediaBuffer=r.buffer||null)}onFragLoading(a,t){!this.audioOnly&&t.frag.type===On&&xi(t.frag)&&(this.mainFragLoading=t,this.state===En&&this.tick())}onFragBuffered(a,t){const{frag:r,part:s}=t;if(r.type===_s)if(this.fragContextChanged(r))this.warn(`Fragment ${r.sn}${s?" p: "+s.index:""} of level ${r.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);else{if(xi(r)){this.fragPrevious=r;const u=this.switchingTrack;u&&(this.bufferedTrack=u,this.switchingTrack=null,this.hls.trigger(G.AUDIO_TRACK_SWITCHED,rr({},u)))}this.fragBufferedComplete(r,s),this.media&&this.tick()}else this.audioOnly||r.type!==On||r.elementaryStreams.video||r.elementaryStreams.audiovideo||(this.audioOnly=!0,this.mainFragLoading=null)}onError(a,t){var r;if(t.fatal)this.state=Xd;else switch(t.details){case Me.FRAG_GAP:case Me.FRAG_PARSING_ERROR:case Me.FRAG_DECRYPT_ERROR:case Me.FRAG_LOAD_ERROR:case Me.FRAG_LOAD_TIMEOUT:case Me.KEY_LOAD_ERROR:case Me.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(_s,t);break;case Me.AUDIO_TRACK_LOAD_ERROR:case Me.AUDIO_TRACK_LOAD_TIMEOUT:case Me.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==Gf||((r=t.context)==null?void 0:r.type)!==bo||(this.state=En);break;case Me.BUFFER_ADD_CODEC_ERROR:case Me.BUFFER_APPEND_ERROR:if(t.parent!=="audio")return;this.resetLoadingState();break;case Me.BUFFER_FULL_ERROR:if(t.parent!=="audio")return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case Me.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}onBufferFlushing(a,{type:t}){t!==Oa&&(this.flushing=!0)}onBufferFlushed(a,{type:t}){if(t!==Oa){this.flushing=!1,this.bufferFlushed=!0,this.state===Hf&&(this.state=En);const r=this.mediaBuffer||this.media;r&&(this.afterBufferFlushed(r,t,_s),this.tick())}}Rs(a){var t;const r="audio",{hls:s}=this,{remuxResult:u,chunkMeta:f}=a,c=this.getCurrentContext(f);if(!c)return void this.resetWhenMissingContext(f);const{frag:v,part:y,level:E}=c,{details:A}=E,{audio:L,text:T,id3:M,initSegment:O}=u;if(!this.fragContextChanged(v)&&A){if(this.state=lu,this.switchingTrack&&L&&this.completeAudioSwitch(this.switchingTrack),O!=null&&O.tracks){const U=v.initSegment||v;this.Ps(E,O.tracks,U,f),s.trigger(G.FRAG_PARSING_INIT_SEGMENT,{frag:U,id:r,tracks:O.tracks})}if(L){const{startPTS:U,endPTS:$,startDTS:z,endDTS:Q}=L;y&&(y.elementaryStreams[Fs]={startPTS:U,endPTS:$,startDTS:z,endDTS:Q}),v.setElementaryStreamInfo(Fs,U,$,z,Q),this.bufferFragmentData(L,v,y,f)}if(M!=null&&(t=M.samples)!=null&&t.length){const U=cr({id:r,frag:v,details:A},M);s.trigger(G.FRAG_PARSING_METADATA,U)}if(T){const U=cr({id:r,frag:v,details:A},T);s.trigger(G.FRAG_PARSING_USERDATA,U)}}else this.fragmentTracker.removeFragment(v)}Ps(a,t,r,s){if(this.state!==lu||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;const u=t.audio;u.id=_s;const f=a.audioCodec;this.log(`Init audio buffer, container:${u.container}, codecs[level/parsed]=[${f}/${u.codec}]`),f&&f.split(",").length===1&&(u.levelCodec=f),this.hls.trigger(G.BUFFER_CODECS,t);const c=u.initSegment;if(c!=null&&c.byteLength){const v={type:"audio",frag:r,part:null,chunkMeta:s,parent:r.type,data:c};this.hls.trigger(G.BUFFER_APPENDING,v)}this.tickImmediate()}loadFragment(a,t,r){const s=this.fragmentTracker.getState(a);var u;if(this.switchingTrack||s===ym||s===_f)if(xi(a))if((u=t.details)!=null&&u.live&&!this.initPTS[a.cc]){this.log(`Waiting for video PTS in continuity counter ${a.cc} of live stream before loading audio fragment ${a.sn} of level ${this.trackId}`),this.state=Tm;const f=this.mainDetails;f&&f.fragmentStart!==t.details.fragmentStart&&x0(t.details,f)}else super.loadFragment(a,t,r);else this.Wr(a,t);else this.clearTrackerIfNeeded(a)}flushAudioIfNeeded(a){if(this.media&&this.bufferedTrack){const{name:t,lang:r,assocLang:s,characteristics:u,audioCodec:f,channels:c}=this.bufferedTrack;Wd({name:t,lang:r,assocLang:s,characteristics:u,audioCodec:f,channels:c},a,Yd)||(g0(a.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=a)}}completeAudioSwitch(a){const{hls:t}=this;this.flushAudioIfNeeded(a),this.bufferedTrack=a,this.switchingTrack=null,t.trigger(G.AUDIO_TRACK_SWITCHED,rr({},a))}},audioTrackController:class extends ET{constructor(a){super(a,"audio-track-controller"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:a}=this;a.on(G.MANIFEST_LOADING,this.onManifestLoading,this),a.on(G.MANIFEST_PARSED,this.onManifestParsed,this),a.on(G.LEVEL_LOADING,this.onLevelLoading,this),a.on(G.LEVEL_SWITCHING,this.onLevelSwitching,this),a.on(G.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),a.on(G.ERROR,this.onError,this)}unregisterListeners(){const{hls:a}=this;a.off(G.MANIFEST_LOADING,this.onManifestLoading,this),a.off(G.MANIFEST_PARSED,this.onManifestParsed,this),a.off(G.LEVEL_LOADING,this.onLevelLoading,this),a.off(G.LEVEL_SWITCHING,this.onLevelSwitching,this),a.off(G.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),a.off(G.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(a,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(a,t){const{id:r,groupId:s,details:u}=t,f=this.tracksInGroup[r];if(!f||f.groupId!==s)return void this.warn(`Audio track with id:${r} and group:${s} not found in active group ${f==null?void 0:f.groupId}`);const c=f.details;f.details=t.details,this.log(`Audio track ${r} "${f.name}" lang:${f.lang} group:${s} loaded [${u.startSN}-${u.endSN}]`),r===this.trackId&&this.playlistLoaded(r,t,c)}onLevelLoading(a,t){this.switchLevel(t.level)}onLevelSwitching(a,t){this.switchLevel(t.level)}switchLevel(a){const t=this.hls.levels[a];if(!t)return;const r=t.audioGroups||null,s=this.groupIds;let u=this.currentTrack;if(!r||(s==null?void 0:s.length)!==(r==null?void 0:r.length)||r!=null&&r.some(c=>(s==null?void 0:s.indexOf(c))===-1)){this.groupIds=r,this.trackId=-1,this.currentTrack=null;const c=this.tracks.filter(L=>!r||r.indexOf(L.groupId)!==-1);if(c.length)this.selectDefaultTrack&&!c.some(L=>L.default)&&(this.selectDefaultTrack=!1),c.forEach((L,T)=>{L.id=T});else if(!u&&!this.tracksInGroup.length)return;this.tracksInGroup=c;const v=this.hls.config.audioPreference;if(!u&&v){const L=ll(v,c,Yd);if(L>-1)u=c[L];else{const T=ll(v,this.tracks);u=this.tracks[T]}}let y=this.findTrackId(u);y===-1&&u&&(y=this.findTrackId(null));const E={audioTracks:c};this.log(`Updating audio tracks, ${c.length} track(s) found in group(s): ${r==null?void 0:r.join(",")}`),this.hls.trigger(G.AUDIO_TRACKS_UPDATED,E);const A=this.trackId;if(y!==-1&&A===-1)this.setAudioTrack(y);else if(c.length&&A===-1){var f;const L=new Error(`No audio track selected for current audio group-ID(s): ${(f=this.groupIds)==null?void 0:f.join(",")} track count: ${c.length}`);this.warn(L.message),this.hls.trigger(G.ERROR,{type:Mt.MEDIA_ERROR,details:Me.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:L})}}}onError(a,t){!t.fatal&&t.context&&(t.context.type!==bo||t.context.id!==this.trackId||this.groupIds&&this.groupIds.indexOf(t.context.groupId)===-1||this.checkRetry(t))}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(a){this.selectDefaultTrack=!1,this.setAudioTrack(a)}setAudioOption(a){const t=this.hls;if(t.config.audioPreference=a,a){const r=this.allAudioTracks;if(this.selectDefaultTrack=!1,r.length){const s=this.currentTrack;if(s&&Wd(a,s,Yd))return s;const u=ll(a,this.tracksInGroup,Yd);if(u>-1){const f=this.tracksInGroup[u];return this.setAudioTrack(u),f}if(s){let f=t.loadLevel;f===-1&&(f=t.firstAutoLevel);const c=function(v,y,E,A,L){const T=y[A],M=y.reduce((Q,Z,ie)=>{const se=Z.uri;return(Q[se]||(Q[se]=[])).push(ie),Q},{})[T.uri];M.length>1&&(A=Math.max.apply(Math,M));const O=T.videoRange,U=T.frameRate,$=T.codecSet.substring(0,4),z=wx(y,A,Q=>{if(Q.videoRange!==O||Q.frameRate!==U||Q.codecSet.substring(0,4)!==$)return!1;const Z=Q.audioGroups,ie=E.filter(se=>!Z||Z.indexOf(se.groupId)!==-1);return ll(v,ie,L)>-1});return z>-1?z:wx(y,A,Q=>{const Z=Q.audioGroups,ie=E.filter(se=>!Z||Z.indexOf(se.groupId)!==-1);return ll(v,ie,L)>-1})}(a,t.levels,r,f,Yd);if(c===-1)return null;t.nextLoadLevel=c}if(a.channels||a.audioCodec){const f=ll(a,r);if(f>-1)return r[f]}}}return null}setAudioTrack(a){const t=this.tracksInGroup;if(a<0||a>=t.length)return void this.warn(`Invalid audio track id: ${a}`);this.selectDefaultTrack=!1;const r=this.currentTrack,s=t[a],u=s.details&&!s.details.live;if(a===this.trackId&&s===r&&u||(this.log(`Switching to audio-track ${a} "${s.name}" lang:${s.lang} group:${s.groupId} channels:${s.channels}`),this.trackId=a,this.currentTrack=s,this.hls.trigger(G.AUDIO_TRACK_SWITCHING,rr({},s)),u))return;const f=this.switchParams(s.url,r==null?void 0:r.details,s.details);this.loadPlaylist(f)}findTrackId(a){const t=this.tracksInGroup;for(let r=0;r<t.length;r++){const s=t[r];if((!this.selectDefaultTrack||s.default)&&(!a||Wd(a,s,Yd)))return r}if(a){const{name:r,lang:s,assocLang:u,characteristics:f,audioCodec:c,channels:v}=a;for(let y=0;y<t.length;y++)if(Wd({name:r,lang:s,assocLang:u,characteristics:f,audioCodec:c,channels:v},t[y],Yd))return y;for(let y=0;y<t.length;y++){const E=t[y];if(Im(a.attrs,E.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return y}for(let y=0;y<t.length;y++){const E=t[y];if(Im(a.attrs,E.attrs,["LANGUAGE"]))return y}}return-1}loadPlaylist(a){super.loadPlaylist();const t=this.currentTrack;this.shouldLoadPlaylist(t)&&g0(t.url,this.hls)&&this.scheduleLoading(t,a)}loadingPlaylist(a,t){super.loadingPlaylist(a,t);const r=a.id,s=a.groupId,u=this.getUrlWithDirectives(a.url,t),f=a.details,c=f==null?void 0:f.age;this.log(`Loading audio-track ${r} "${a.name}" lang:${a.lang} group:${s}${(t==null?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:""}${c&&f.live?" age "+c.toFixed(1)+(f.type&&" "+f.type||""):""} ${u}`),this.hls.trigger(G.AUDIO_TRACK_LOADING,{url:u,id:r,groupId:s,deliveryDirectives:t||null,track:a})}},emeController:Wf,cmcdController:class{constructor(a){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=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=s=>{try{this.apply(s,{ot:Us.MANIFEST,su:!this.initialized})}catch(u){this.hls.logger.warn("Could not generate manifest CMCD data.",u)}},this.applyFragmentData=s=>{try{const{frag:u,part:f}=s,c=this.hls.levels[u.level],v=this.getObjectType(u),y={d:1e3*(f||u).duration,ot:v};v!==Us.VIDEO&&v!==Us.AUDIO&&v!=Us.MUXED||(y.br=c.bitrate/1e3,y.tb=this.getTopBandwidth(v)/1e3,y.bl=this.getBufferLength(v));const E=f?this.getNextPart(f):this.getNextFrag(u);E!=null&&E.url&&E.url!==u.url&&(y.nor=E.url),this.apply(s,y)}catch(u){this.hls.logger.warn("Could not generate segment CMCD data.",u)}},this.hls=a;const t=this.config=a.config,{cmcd:r}=t;r!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=r.sessionId||a.sessionId,this.cid=r.contentId,this.useHeaders=r.useHeaders===!0,this.includeKeys=r.includeKeys,this.registerListeners())}registerListeners(){const a=this.hls;a.on(G.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(G.MEDIA_DETACHED,this.onMediaDetached,this),a.on(G.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const a=this.hls;a.off(G.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(G.MEDIA_DETACHED,this.onMediaDetached,this),a.off(G.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null}onMediaAttached(a,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(a,t){var r,s;this.audioBuffer=(r=t.tracks.audio)==null?void 0:r.buffer,this.videoBuffer=(s=t.tracks.video)==null?void 0:s.buffer}createData(){var a;return{v:1,sf:uO.HLS,sid:this.sid,cid:this.cid,pr:(a=this.media)==null?void 0:a.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(a,t={}){cr(t,this.createData());const r=t.ot===Us.INIT||t.ot===Us.VIDEO||t.ot===Us.MUXED;this.starved&&r&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:s}=this;s&&(t=Object.keys(t).reduce((f,c)=>(s.includes(c)&&(f[c]=t[c]),f),{}));const u={baseUrl:a.url};this.useHeaders?(a.headers||(a.headers={}),TO(a.headers,t,u)):a.url=SO(a.url,t,u)}getNextFrag(a){var t;const r=(t=this.hls.levels[a.level])==null?void 0:t.details;if(r){const s=a.sn-r.startSN;return r.fragments[s+1]}}getNextPart(a){var t,r;const{index:s,fragment:u}=a,f=(t=this.hls.levels[u.level])==null||(r=t.details)==null?void 0:r.partList;if(f){const{sn:c}=u;for(let v=f.length-1;v>=0;v--){const y=f[v];if(y.index===s&&y.fragment.sn===c)return f[v+1]}}}getObjectType(a){const{type:t}=a;return t==="subtitle"?Us.TIMED_TEXT:a.sn==="initSegment"?Us.INIT:t==="audio"?Us.AUDIO:t==="main"?this.hls.audioTracks.length?Us.VIDEO:Us.MUXED:void 0}getTopBandwidth(a){let t,r=0;const s=this.hls;if(a===Us.AUDIO)t=s.audioTracks;else{const u=s.maxAutoLevel,f=u>-1?u+1:s.levels.length;t=s.levels.slice(0,f)}for(const u of t)u.bitrate>r&&(r=u.bitrate);return r>0?r:NaN}getBufferLength(a){const t=this.media,r=a===Us.AUDIO?this.audioBuffer:this.videoBuffer;return!r||!t?NaN:1e3*bn.bufferInfo(r,t.currentTime,this.config.maxBufferHole).len}createPlaylistLoader(){const{pLoader:a}=this.config,t=this.applyPlaylistData,r=a||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new r(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,u,f){t(s),this.loader.load(s,u,f)}}}createFragmentLoader(){const{fLoader:a}=this.config,t=this.applyFragmentData,r=a||this.config.loader;return class{constructor(s){this.loader=void 0,this.loader=new r(s)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(s,u,f){t(s),this.loader.load(s,u,f)}}}},contentSteeringController:class extends iu{constructor(a){super("content-steering",a.logger),this.hls=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.Ns=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=a,this.registerListeners()}registerListeners(){const a=this.hls;a.on(G.MANIFEST_LOADING,this.onManifestLoading,this),a.on(G.MANIFEST_LOADED,this.onManifestLoaded,this),a.on(G.MANIFEST_PARSED,this.onManifestParsed,this),a.on(G.ERROR,this.onError,this)}unregisterListeners(){const a=this.hls;a&&(a.off(G.MANIFEST_LOADING,this.onManifestLoading,this),a.off(G.MANIFEST_LOADED,this.onManifestLoaded,this),a.off(G.MANIFEST_PARSED,this.onManifestParsed,this),a.off(G.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((a,t)=>(a.indexOf(t.pathwayId)===-1&&a.push(t.pathwayId),a),[])}get pathwayPriority(){return this.Ns}set pathwayPriority(a){this.updatePathwayPriority(a)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const a=1e3*this.timeToLoad-(performance.now()-this.updated);if(a>0)return void this.scheduleRefresh(this.uri,a)}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(a){const t=this.levels;t&&(this.levels=t.filter(r=>r!==a))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(a,t){const{contentSteering:r}=t;r!==null&&(this.pathwayId=r.pathwayId,this.uri=r.uri,this.started&&this.startLoad())}onManifestParsed(a,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(a,t){const{errorAction:r}=t;if((r==null?void 0:r.action)===su&&r.flags===b0){const s=this.levels;let u=this.Ns,f=this.pathwayId;if(t.context){const{groupId:c,pathwayId:v,type:y}=t.context;c&&s?f=this.getPathwayForGroupId(c,y,f):v&&(f=v)}f in this.penalizedPathways||(this.penalizedPathways[f]=performance.now()),!u&&s&&(u=this.pathways()),u&&u.length>1&&(this.updatePathwayPriority(u),r.resolved=this.pathwayId!==f),r.resolved||this.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${f} levels: ${s&&s.length} priorities: ${Or(u)} penalized: ${Or(this.penalizedPathways)}`)}}filterParsedLevels(a){this.levels=a;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const r=a[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${r}"`),t=this.getLevelsForPathway(r),this.pathwayId=r}return t.length!==a.length&&this.log(`Found ${t.length}/${a.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(a){return this.levels===null?[]:this.levels.filter(t=>a===t.pathwayId)}updatePathwayPriority(a){let t;this.Ns=a;const r=this.penalizedPathways,s=performance.now();Object.keys(r).forEach(u=>{s-r[u]>3e5&&delete r[u]});for(let u=0;u<a.length;u++){const f=a[u];if(f in r)continue;if(f===this.pathwayId)return;const c=this.hls.nextLoadLevel,v=this.hls.levels[c];if(t=this.getLevelsForPathway(f),t.length>0){this.log(`Setting Pathway to "${f}"`),this.pathwayId=f,lI(t),this.hls.trigger(G.LEVELS_UPDATED,{levels:t});const y=this.hls.levels[c];v&&y&&this.levels&&(y.attrs["STABLE-VARIANT-ID"]!==v.attrs["STABLE-VARIANT-ID"]&&y.bitrate!==v.bitrate&&this.log(`Unstable Pathways change from bitrate ${v.bitrate} to ${y.bitrate}`),this.hls.nextLoadLevel=c);break}}}getPathwayForGroupId(a,t,r){const s=this.getLevelsForPathway(r).concat(this.levels||[]);for(let u=0;u<s.length;u++)if(t===bo&&s[u].hasAudioGroup(a)||t===il&&s[u].hasSubtitleGroup(a))return s[u].pathwayId;return r}clonePathways(a){const t=this.levels;if(!t)return;const r={},s={};a.forEach(u=>{const{ID:f,"BASE-ID":c,"URI-REPLACEMENT":v}=u;if(t.some(E=>E.pathwayId===f))return;const y=this.getLevelsForPathway(c).map(E=>{const A=new Fr(E.attrs);A["PATHWAY-ID"]=f;const L=A.AUDIO&&`${A.AUDIO}_clone_${f}`,T=A.SUBTITLES&&`${A.SUBTITLES}_clone_${f}`;L&&(r[A.AUDIO]=L,A.AUDIO=L),T&&(s[A.SUBTITLES]=T,A.SUBTITLES=T);const M=tL(E.uri,A["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",v),O=new pm({attrs:A,audioCodec:E.audioCodec,bitrate:E.bitrate,height:E.height,name:E.name,url:M,videoCodec:E.videoCodec,width:E.width});if(E.audioGroups)for(let U=1;U<E.audioGroups.length;U++)O.addGroupId("audio",`${E.audioGroups[U]}_clone_${f}`);if(E.subtitleGroups)for(let U=1;U<E.subtitleGroups.length;U++)O.addGroupId("text",`${E.subtitleGroups[U]}_clone_${f}`);return O});t.push(...y),eL(this.audioTracks,r,v,f),eL(this.subtitleTracks,s,v,f)})}loadSteeringManifest(a){const t=this.hls.config,r=t.loader;let s;this.loader&&this.loader.destroy(),this.loader=new r(t);try{s=new self.URL(a)}catch{return this.enabled=!1,void this.log(`Failed to parse Steering Manifest URI: ${a}`)}if(s.protocol!=="data:"){const E=0|(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate);s.searchParams.set("_HLS_pathway",this.pathwayId),s.searchParams.set("_HLS_throughput",""+E)}const u={responseType:"json",url:s.href},f=t.steeringManifestLoadPolicy.default,c=f.errorRetry||f.timeoutRetry||{},v={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:c.maxNumRetry||0,retryDelay:c.retryDelayMs||0,maxRetryDelay:c.maxRetryDelayMs||0},y={onSuccess:(E,A,L,T)=>{this.log(`Loaded steering manifest: "${s}"`);const M=E.data;if((M==null?void 0:M.VERSION)!==1)return void this.log(`Steering VERSION ${M.VERSION} not supported!`);this.updated=performance.now(),this.timeToLoad=M.TTL;const{"RELOAD-URI":O,"PATHWAY-CLONES":U,"PATHWAY-PRIORITY":$}=M;if(O)try{this.uri=new self.URL(O,s).href}catch{return this.enabled=!1,void this.log(`Failed to parse Steering Manifest RELOAD-URI: ${O}`)}this.scheduleRefresh(this.uri||L.url),U&&this.clonePathways(U);const z={steeringManifest:M,url:s.toString()};this.hls.trigger(G.STEERING_MANIFEST_LOADED,z),$&&this.updatePathwayPriority($)},onError:(E,A,L,T)=>{if(this.log(`Error loading steering manifest: ${E.code} ${E.text} (${A.url})`),this.stopLoad(),E.code===410)return this.enabled=!1,void this.log(`Steering manifest ${A.url} no longer available`);let M=1e3*this.timeToLoad;if(E.code!==429)this.scheduleRefresh(this.uri||A.url,M);else{const O=this.loader;if(typeof(O==null?void 0:O.getResponseHeader)=="function"){const U=O.getResponseHeader("Retry-After");U&&(M=1e3*parseFloat(U))}this.log(`Steering manifest ${A.url} rate limited`)}},onTimeout:(E,A,L)=>{this.log(`Timeout loading steering manifest (${A.url})`),this.scheduleRefresh(this.uri||A.url)}};this.log(`Requesting steering manifest: ${s}`),this.loader.load(u,v,y)}scheduleRefresh(a,t=1e3*this.timeToLoad){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var r;const s=(r=this.hls)==null?void 0:r.media;!s||s.ended?this.scheduleRefresh(a,1e3*this.timeToLoad):this.loadSteeringManifest(a)},t)}},interstitialsController:class extends iu{constructor(a,t){super("interstitials",a.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const r=this.currentTime;if(r===void 0||this.playbackDisabled)return;const s=r-this.timelinePos;if(Math.abs(s)<1/7056e5)return;const u=s<=-.01;this.timelinePos=r,this.bufferedPos=r;const f=this.playingItem;if(!f)return void this.checkBuffer();if(u&&this.schedule.resetErrorsInRange(r,r-s)&&this.updateSchedule(),this.checkBuffer(),u&&r<f.start||r>=f.end){var c;const A=this.schedule.findItemIndexAtTime(this.timelinePos);if(!this.isInterstitial(f)&&(c=this.media)!=null&&c.paused&&(this.shouldPlay=!1),!u){const L=this.findItemIndex(f);if(A>L){const T=this.schedule.findJumpRestrictedIndex(L+1,A);if(T>L)return void this.setSchedulePosition(T)}}return void this.setSchedulePosition(A)}const v=this.playingAsset;if(!v){if(this.playingLastItem&&this.isInterstitial(f)){const A=f.event.assetList[0];A&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(r,A))}return}const y=v.timelineStart,E=v.duration||0;(u&&r<y||r>=y+E)&&this.setScheduleToAssetAtTime(r,v)},this.onTimeupdate=()=>{const r=this.currentTime;if(r===void 0||this.playbackDisabled||!(r>this.timelinePos))return;this.timelinePos=r,r>this.bufferedPos&&this.checkBuffer();const s=this.playingItem;if(!s||this.playingLastItem)return;if(r>=s.end){this.timelinePos=s.end;const f=this.findItemIndex(s);this.setSchedulePosition(f+1)}const u=this.playingAsset;u&&r>=u.timelineStart+(u.duration||0)&&this.setScheduleToAssetAtTime(r,u)},this.onScheduleUpdate=(r,s)=>{const u=this.schedule,f=this.playingItem,c=u.events||[],v=u.items||[],y=u.durations,E=r.map(T=>T.identifier),A=!(!c.length&&!E.length);if(A&&this.log(`INTERSTITIALS_UPDATED (${c.length}): ${c}
Schedule: ${v.map(T=>Ic(T))}`),E.length&&this.log(`Removed events ${E}`),this.playerQueue.forEach(T=>{if(T.interstitial.appendInPlace){const M=T.assetItem.timelineStart,O=T.timelineOffset-M;if(O)try{T.timelineOffset=M}catch(U){Math.abs(O)>Qf&&this.warn(`${U} ("${T.assetId}" ${T.timelineOffset}->${M})`)}}}),f){const T=this.updateItem(f,this.timelinePos);this.itemsMatch(f,T)&&(this.playingItem=T,this.waitingItem=this.endedItem=null)}else this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const L=this.bufferingItem;if(L){const T=this.updateItem(L,this.bufferedPos);this.itemsMatch(L,T)?this.bufferingItem=T:L.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(L.event,null))}if(r.forEach(T=>{T.assetList.forEach(M=>{this.clearAssetPlayer(M.identifier,null)})}),A||s){if(this.hls.trigger(G.INTERSTITIALS_UPDATED,{events:c.slice(0),schedule:v.slice(0),durations:y,removedIds:E}),this.isInterstitial(f)&&E.includes(f.event.identifier))return this.warn(`Interstitial "${f.event.identifier}" removed while playing`),void this.primaryFallback(f.event);this.checkBuffer()}},this.hls=a,this.HlsPlayerClass=t,this.assetListLoader=new IO(a),this.schedule=new xO(this.onScheduleUpdate,a.logger),this.registerListeners()}registerListeners(){const a=this.hls;a.on(G.MEDIA_ATTACHING,this.onMediaAttaching,this),a.on(G.MEDIA_ATTACHED,this.onMediaAttached,this),a.on(G.MEDIA_DETACHING,this.onMediaDetaching,this),a.on(G.MANIFEST_LOADING,this.onManifestLoading,this),a.on(G.LEVEL_UPDATED,this.onLevelUpdated,this),a.on(G.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),a.on(G.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),a.on(G.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),a.on(G.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),a.on(G.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),a.on(G.ASSET_LIST_LOADED,this.onAssetListLoaded,this),a.on(G.BUFFER_APPENDED,this.onBufferAppended,this),a.on(G.BUFFER_FLUSHED,this.onBufferFlushed,this),a.on(G.BUFFERED_TO_END,this.onBufferedToEnd,this),a.on(G.MEDIA_ENDED,this.onMediaEnded,this),a.on(G.ERROR,this.onError,this),a.on(G.DESTROYING,this.onDestroying,this)}unregisterListeners(){const a=this.hls;a&&(a.off(G.MEDIA_ATTACHING,this.onMediaAttaching,this),a.off(G.MEDIA_ATTACHED,this.onMediaAttached,this),a.off(G.MEDIA_DETACHING,this.onMediaDetaching,this),a.off(G.MANIFEST_LOADING,this.onManifestLoading,this),a.off(G.LEVEL_UPDATED,this.onLevelUpdated,this),a.off(G.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),a.off(G.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),a.off(G.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),a.off(G.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),a.off(G.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),a.off(G.ASSET_LIST_LOADED,this.onAssetListLoaded,this),a.off(G.BUFFER_CODECS,this.onBufferCodecs,this),a.off(G.BUFFER_APPENDED,this.onBufferAppended,this),a.off(G.BUFFER_FLUSHED,this.onBufferFlushed,this),a.off(G.BUFFERED_TO_END,this.onBufferedToEnd,this),a.off(G.MEDIA_ENDED,this.onMediaEnded,this),a.off(G.ERROR,this.onError,this),a.off(G.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var a;(a=this.getBufferingPlayer())==null||a.resumeBuffering()}pauseBuffering(){var a;(a=this.getBufferingPlayer())==null||a.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.manager=null,this.hls=this.HlsPlayerClass=this.schedule=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){const a=this.primaryMedia||this.media;a&&this.removeMediaListeners(a)}removeMediaListeners(a){hl(a,"play",this.onPlay),hl(a,"pause",this.onPause),hl(a,"seeking",this.onSeeking),hl(a,"timeupdate",this.onTimeupdate)}onMediaAttaching(a,t){const r=this.media=t.media;cu(r,"seeking",this.onSeeking),cu(r,"timeupdate",this.onTimeupdate),cu(r,"play",this.onPlay),cu(r,"pause",this.onPause)}onMediaAttached(a,t){const r=this.effectivePlayingItem,s=this.detachedData;if(this.detachedData=null,r===null)this.checkStart();else if(!s){this.clearScheduleState();const u=this.findItemIndex(r);this.setSchedulePosition(u)}}clearScheduleState(){this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(a,t){const r=!!t.transferMedia,s=this.media;if(this.media=null,!r&&(s&&this.removeMediaListeners(s),this.detachedData)){const u=this.getBufferingPlayer();u&&(this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,u.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.manager){if(!this.hls)return null;const a=this,t=()=>a.bufferingItem||a.waitingItem,r=A=>A&&a.getAssetPlayer(A.identifier),s=(A,L,T,M,O)=>{if(A){let U=A[L].start;const $=A.event;if($){if(L==="playout"||$.timelineOccupancy!==_0.Point){const z=r(T);(z==null?void 0:z.interstitial)===$&&(U+=z.assetItem.startOffset+z[O])}}else U+=(M==="bufferedPos"?f():a[M])-A.start;return U}return 0},u=(A,L)=>{if(A!==0&&L!=="primary"&&a.schedule.length){var T;const M=a.schedule.findItemIndexAtTime(A),O=(T=a.schedule.items)==null?void 0:T[M];if(O)return A+(O[L].start-O.start)}return A},f=()=>{const A=a.bufferedPos;return A===Number.MAX_VALUE?c("primary"):Math.max(A,0)},c=A=>{var L;return(L=a.primaryDetails)!=null&&L.live?a.primaryDetails.edge:a.schedule.durations[A]},v=(A,L)=>{var T,M;const O=a.effectivePlayingItem;if(O!=null&&(T=O.event)!=null&&T.restrictions.skip)return;a.log(`seek to ${A} "${L}"`);const U=a.effectivePlayingItem,$=a.schedule.findItemIndexAtTime(A,L),z=(M=a.schedule.items)==null?void 0:M[$],Q=a.getBufferingPlayer(),Z=Q==null?void 0:Q.interstitial,ie=Z==null?void 0:Z.appendInPlace,se=U&&a.itemsMatch(U,z);if(U&&(ie||se)){const N=r(a.playingAsset),re=(N==null?void 0:N.media)||a.primaryMedia;if(re){const ne=L==="primary"?re.currentTime:s(U,L,a.playingAsset,"timelinePos","currentTime"),Se=A-ne,ce=(ie?ne:re.currentTime)+Se;if(ce>=0&&(!N||ie||ce<=N.duration))return void(re.currentTime=ce)}}if(z){let N=A;if(L!=="primary"){const ne=A-z[L].start;N=z.start+ne}const re=!a.isInterstitial(z);if(a.isInterstitial(U)&&!U.event.appendInPlace||!re&&!z.event.appendInPlace){if(U){const ne=a.findItemIndex(U);if($>ne){const ce=a.schedule.findJumpRestrictedIndex(ne+1,$);if(ce>ne)return void a.setSchedulePosition(ce)}let Se=0;if(re)a.timelinePos=N,a.checkBuffer();else{var ye;const ce=z==null||(ye=z.event)==null?void 0:ye.assetList;if(ce){const we=A-(z[L]||z).start;for(let ze=ce.length;ze--;){const xe=ce[ze];if(xe.duration&&we>=xe.startOffset&&we<xe.startOffset+xe.duration){Se=ze;break}}}}a.setSchedulePosition($,Se)}}else{const ne=a.media||(ie?Q==null?void 0:Q.media:null);ne&&(ne.currentTime=N)}}},y=()=>{const A=a.effectivePlayingItem;if(a.isInterstitial(A))return A;const L=t();return a.isInterstitial(L)?L:null},E={get currentTime(){const A=y(),L=a.effectivePlayingItem;return L&&L===A?s(L,"playout",a.effectivePlayingAsset,"timelinePos","currentTime")-L.playout.start:0},set currentTime(A){const L=y(),T=a.effectivePlayingItem;T&&T===L&&v(A+T.playout.start,"playout")},get duration(){const A=y();return A?A.playout.end-A.playout.start:0},get assetPlayers(){var A;const L=(A=y())==null?void 0:A.event.assetList;return L?L.map(T=>a.getAssetPlayer(T.identifier)):[]},get playingIndex(){var A;const L=(A=y())==null?void 0:A.event;return L&&a.effectivePlayingAsset?L.findAssetIndex(a.effectivePlayingAsset):-1},get scheduleItem(){return y()}};this.manager={get events(){var A,L;return((A=a.schedule)==null||(L=A.events)==null?void 0:L.slice(0))||[]},get schedule(){var A,L;return((A=a.schedule)==null||(L=A.items)==null?void 0:L.slice(0))||[]},get interstitialPlayer(){return y()?E:null},get playerQueue(){return a.playerQueue.slice(0)},get bufferingAsset(){return a.bufferingAsset},get bufferingItem(){return t()},get bufferingIndex(){const A=t();return a.findItemIndex(A)},get playingAsset(){return a.effectivePlayingAsset},get playingItem(){return a.effectivePlayingItem},get playingIndex(){const A=a.effectivePlayingItem;return a.findItemIndex(A)},primary:{get bufferedEnd(){return f()},get currentTime(){const A=a.timelinePos;return A>0?A:0},set currentTime(A){v(A,"primary")},get duration(){return c("primary")},get seekableStart(){var A;return((A=a.primaryDetails)==null?void 0:A.fragmentStart)||0}},integrated:{get bufferedEnd(){return s(t(),"integrated",a.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return s(a.effectivePlayingItem,"integrated",a.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(A){v(A,"integrated")},get duration(){return c("integrated")},get seekableStart(){var A;return u(((A=a.primaryDetails)==null?void 0:A.fragmentStart)||0,"integrated")}},skip:()=>{const A=a.effectivePlayingItem,L=A==null?void 0:A.event;if(L&&!L.restrictions.skip){const T=a.findItemIndex(A);if(L.appendInPlace){const M=A.playout.start+A.event.duration;v(M+.001,"playout")}else a.advanceAfterAssetEnded(L,T,1/0)}}}}return this.manager}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var a;const t=this.playingItem,r=(a=this.schedule)==null?void 0:a.items;return!!(this.playbackStarted&&t&&r)&&this.findItemIndex(t)===r.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var a,t,r;if(this.mediaSelection===null)return;const s=this.waitingItem||this.playingItem;if(this.isInterstitial(s)&&!s.event.appendInPlace)return;let u=this.media;!u&&(a=this.bufferingItem)!=null&&(t=a.event)!=null&&t.appendInPlace&&(u=this.primaryMedia);const f=(r=u)==null?void 0:r.currentTime;return f!==void 0&&vt(f)?f:void 0}get primaryMedia(){var a;return this.media||((a=this.detachedData)==null?void 0:a.media)||null}isInterstitial(a){return!(a==null||!a.event)}retreiveMediaSource(a,t){const r=this.getAssetPlayer(a);r&&this.transferMediaFromPlayer(r,t)}transferMediaFromPlayer(a,t){const r=a.interstitial.appendInPlace,s=a.media;if(r&&s===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&s)return void(this.detachedData={media:s});const u=a.transferMedia();this.log(`transfer MediaSource from ${a} ${Or(u)}`),this.detachedData=u}else t&&s&&(this.shouldPlay||(this.shouldPlay=!s.paused))}transferMediaTo(a,t){var r,s;if(a.media===t)return;let u=null;const f=this.hls,c=a!==f,v=c&&a.interstitial.appendInPlace,y=(r=this.detachedData)==null?void 0:r.mediaSource;let E;if(f.media)v&&(u=f.transferMedia(),this.detachedData=u),E="Primary";else if(y){const T=this.getBufferingPlayer();T?(u=T.transferMedia(),E=`${T}`):E="detached MediaSource"}else E="detached media";if(!u){if(y)u=this.detachedData,this.log(`using detachedData: MediaSource ${Or(u)}`);else if(!this.detachedData||f.media===t){const T=this.playerQueue;T.length>1&&T.forEach(M=>{if(c&&M.interstitial.appendInPlace!==v){const O=M.interstitial;this.clearInterstitial(M.interstitial,null),O.appendInPlace=!1,O.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${O}`)}}),this.hls.detachMedia(),this.detachedData={media:t}}}const A=u&&"mediaSource"in u&&((s=u.mediaSource)==null?void 0:s.readyState)!=="closed",L=A&&u?u:t;if(this.log(`${A?"transfering MediaSource":"attaching media"} to ${c?a:"Primary"} from ${E}`),L===u){const T=c&&a.assetId===this.schedule.assetIdAtEnd;L.overrides={duration:this.schedule.duration,endOfStream:!c||T,cueRemoval:!c}}a.attachMedia(L)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const a=this.schedule,t=a.events;if(!t||this.playbackDisabled||!this.media)return;this.bufferedPos===-1&&(this.bufferedPos=0);const r=this.timelinePos,s=this.effectivePlayingItem;if(r===-1){const u=this.hls.startPosition;if(this.timelinePos=u,t.length&&t[0].cue.pre){const f=a.findEventIndex(t[0].identifier);this.setSchedulePosition(f)}else if(u>=0||!this.primaryLive){const f=this.timelinePos=u>0?u:0,c=a.findItemIndexAtTime(f);this.setSchedulePosition(c)}}else if(s&&!this.playingItem){const u=a.findItemIndex(s);this.setSchedulePosition(u)}}advanceAfterAssetEnded(a,t,r){const s=r+1;if(a.isAssetPastPlayoutLimit(s)||a.assetList[s].error){const u=this.schedule.items;if(u){const f=t+1;if(f>=u.length)return void this.setSchedulePosition(-1);const c=a.resumeTime;this.timelinePos<c&&(this.timelinePos=c,this.checkBuffer()),this.setSchedulePosition(f)}}else this.setSchedulePosition(t,s)}setScheduleToAssetAtTime(a,t){const r=this.schedule,s=t.parentIdentifier,u=r.getEvent(s);if(u){const f=r.findEventIndex(s),c=r.findAssetIndex(u,a);this.setSchedulePosition(f,c)}}setSchedulePosition(a,t){const r=this.schedule.items;if(!r||this.playbackDisabled)return;this.log(`setSchedulePosition ${a}, ${t}`);const s=a>=0?r[a]:null,u=this.playingItem,f=this.playingLastItem;if(this.isInterstitial(u)){var c;const y=u.event,E=this.playingAsset,A=E==null?void 0:E.identifier,L=A?this.getAssetPlayer(A):null;if(L&&A&&(!this.eventItemsMatch(u,s)||t!==void 0&&A!==((c=y.assetList)==null?void 0:c[t].identifier))){var v;const T=y.findAssetIndex(E);this.log(`INTERSTITIAL_ASSET_ENDED ${T+1}/${y.assetList.length} ${RT(E)}`),this.endedAsset=E,this.playingAsset=null,this.hls.trigger(G.INTERSTITIAL_ASSET_ENDED,{asset:E,assetListIndex:T,event:y,schedule:r.slice(0),scheduleIndex:a,player:L}),this.retreiveMediaSource(A,s),!L.media||(v=this.detachedData)!=null&&v.mediaSource||L.detachMedia()}if(!this.eventItemsMatch(u,s)&&(this.endedItem=u,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${y} ${Ic(u)}`),y.hasPlayed=!0,this.hls.trigger(G.INTERSTITIAL_ENDED,{event:y,schedule:r.slice(0),scheduleIndex:a}),y.cue.once)){this.updateSchedule();const T=this.schedule.items;if(s&&T){const M=this.schedule.findItemIndex(s);this.advanceSchedule(M,T,t,u,f)}return}}this.advanceSchedule(a,r,t,u,f)}advanceSchedule(a,t,r,s,u){const f=a>=0?t[a]:null,c=this.primaryMedia,v=this.playerQueue;if(v.length&&v.forEach(y=>{const E=y.interstitial,A=this.schedule.findEventIndex(E.identifier);(A<a||A>a+1)&&this.clearInterstitial(E,f)}),this.isInterstitial(f)){this.timelinePos=Math.min(Math.max(this.timelinePos,f.start),f.end);const y=f.event;r===void 0&&(r=this.schedule.findAssetIndex(y,this.timelinePos));const E=this.waitingItem;this.assetsBuffered(f,c)||this.setBufferingItem(f);let A=this.preloadAssets(y,r);if(this.eventItemsMatch(f,E||s)||(this.waitingItem=f,this.log(`INTERSTITIAL_STARTED ${Ic(f)} ${y.appendInPlace?"append in place":""}`),this.hls.trigger(G.INTERSTITIAL_STARTED,{event:y,schedule:t.slice(0),scheduleIndex:a})),!y.assetListLoaded)return void this.log(`Waiting for ASSET-LIST to complete loading ${y}`);if(y.assetListLoader&&(y.assetListLoader.destroy(),y.assetListLoader=void 0),!c)return void this.log(`Waiting for attachMedia to start Interstitial ${y}`);this.waitingItem=this.endedItem=null,this.playingItem=f;const L=y.assetList[r];if(!L){const T=t[a+1],M=this.media;return T&&M&&!this.isInterstitial(T)&&M.currentTime<T.start&&(M.currentTime=this.timelinePos=T.start),void this.advanceAfterAssetEnded(y,a,r||0)}if(A||(A=this.getAssetPlayer(L.identifier)),A===null||A.destroyed){const T=y.assetList.length;this.warn(`asset ${r+1}/${T} player destroyed ${y}`),A=this.createAssetPlayer(y,L,r)}if(!this.eventItemsMatch(f,this.bufferingItem)&&y.appendInPlace&&this.isAssetBuffered(L))return;this.startAssetPlayer(A,r,t,a,c),this.shouldPlay&&sL(A.media)}else f!==null?(this.resumePrimary(f,a,s),this.shouldPlay&&sL(this.hls.media)):u&&this.isInterstitial(s)&&(this.endedItem=null,this.playingItem=s,s.event.appendInPlace||this.attachPrimary(this.schedule.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var a,t;return(a=this.mediaSelection)==null||(t=a.main)==null?void 0:t.details}get primaryLive(){var a;return!((a=this.primaryDetails)==null||!a.live)}resumePrimary(a,t,r){var s;if(this.playingItem=a,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(a),this.log(`resuming ${Ic(a)}`),(s=this.detachedData)==null||!s.mediaSource){let f=this.timelinePos;(f<a.start||f>=a.end)&&(f=this.getPrimaryResumption(a,t),this.timelinePos=f),this.attachPrimary(f,a)}if(!r)return;const u=this.schedule.items;u&&(this.log(`resumed ${Ic(a)}`),this.hls.trigger(G.INTERSTITIALS_PRIMARY_RESUMED,{schedule:u.slice(0),scheduleIndex:t}),this.checkBuffer())}getPrimaryResumption(a,t){const r=a.start;if(this.primaryLive){const s=this.primaryDetails;if(t===0)return this.hls.startPosition;if(s&&(r<s.fragmentStart||r>s.edge))return this.hls.liveSyncPosition||-1}return r}isAssetBuffered(a){const t=this.getAssetPlayer(a.identifier);return t!=null&&t.hls?t.hls.bufferedToEnd:bn.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=a.timelineStart+(a.duration||0)}attachPrimary(a,t,r){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const s=this.primaryMedia;if(!s)return;const u=this.hls;u.media?this.checkBuffer():(this.transferMediaTo(u,s),r&&this.startLoadingPrimaryAt(a,r)),r||(this.timelinePos=a,this.startLoadingPrimaryAt(a,r))}startLoadingPrimaryAt(a,t){var r;const s=this.hls;!s.loadingEnabled||!s.media||Math.abs((((r=s.mainForwardBufferInfo)==null?void 0:r.start)||s.media.currentTime)-a)>.5?s.startLoad(a,t):s.bufferingEnabled||s.resumeBuffering()}onManifestLoading(){this.stopLoad(),this.schedule.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(G.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(G.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(a,t){if(t.level===-1)return;const r=this.hls.levels[t.level],s=rr(rr({},this.mediaSelection||this.altSelection),{},{main:r});this.mediaSelection=s,this.schedule.parseInterstitialDateRanges(s,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(a,t){const r=this.hls.audioTracks[t.id],s=this.mediaSelection;if(!s)return void(this.altSelection=rr(rr({},this.altSelection),{},{audio:r}));const u=rr(rr({},s),{},{audio:r});this.mediaSelection=u}onSubtitleTrackUpdated(a,t){const r=this.hls.subtitleTracks[t.id],s=this.mediaSelection;if(!s)return void(this.altSelection=rr(rr({},this.altSelection),{},{subtitles:r}));const u=rr(rr({},s),{},{subtitles:r});this.mediaSelection=u}onAudioTrackSwitching(a,t){const r=Sx(t);this.playerQueue.forEach(s=>s.hls.setAudioOption(t)||s.hls.setAudioOption(r))}onSubtitleTrackSwitch(a,t){const r=Sx(t);this.playerQueue.forEach(s=>s.hls.setSubtitleOption(t)||t.id!==-1&&s.hls.setSubtitleOption(r))}onBufferCodecs(a,t){const r=t.tracks;r&&(this.requiredTracks=r)}onBufferAppended(a,t){this.checkBuffer()}onBufferFlushed(a,t){const r=this.playingItem;if(r&&!this.itemsMatch(r,this.bufferingItem)&&!this.isInterstitial(r)){const s=this.timelinePos;this.bufferedPos=s,this.checkBuffer()}}onBufferedToEnd(a){const t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let s=0;s<t.length;s++){const u=t[s];if(u.cue.post){var r;const f=this.schedule.findEventIndex(u.identifier),c=(r=this.schedule.items)==null?void 0:r[f];this.isInterstitial(c)&&this.eventItemsMatch(c,this.bufferingItem)&&this.bufferedToItem(c,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(a){const t=this.playingItem;if(!this.playingLastItem&&t){const r=this.findItemIndex(t);this.setSchedulePosition(r+1)}else this.shouldPlay=!1}updateItem(a,t){const r=this.schedule.items;return a&&r&&r[this.findItemIndex(a,t)]||null}itemsMatch(a,t){return!!t&&(a===t||a.event&&t.event&&this.eventItemsMatch(a,t)||!a.event&&!t.event&&this.findItemIndex(a)===this.findItemIndex(t))}eventItemsMatch(a,t){var r;return!!t&&(a===t||a.event.identifier===((r=t.event)==null?void 0:r.identifier))}findItemIndex(a,t){return a?this.schedule.findItemIndex(a,t):-1}updateSchedule(){const a=this.mediaSelection;a&&this.schedule.updateSchedule(a,[])}checkBuffer(a){const t=this.schedule.items;if(!t)return;const r=bn.bufferInfo(this.primaryMedia,this.timelinePos,0);a&&(this.bufferedPos=this.timelinePos),a||(a=r.len<1),this.updateBufferedPos(r.end,t,a)}updateBufferedPos(a,t,r){const s=this.schedule,u=this.bufferingItem;if(this.bufferedPos>a)return;if(t.length===1&&this.itemsMatch(t[0],u))return void(this.bufferedPos=a);const f=this.playingItem,c=this.findItemIndex(f);let v=s.findItemIndexAtTime(a);if(this.bufferedPos<a){var y,E;const A=this.findItemIndex(u),L=Math.min(A+1,t.length-1),T=t[L];if((v===-1&&u&&a>=u.end||(y=T.event)!=null&&y.appendInPlace&&a+.01>=T.start)&&(v=L),L-c>1&&(u==null||(E=u.event)==null?void 0:E.appendInPlace)===!1)return;if(this.bufferedPos=a,v>A&&v>c)this.bufferedToItem(T);else{const M=this.primaryDetails;this.primaryLive&&M&&a>M.edge-M.targetduration&&T.start<M.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(T)&&this.preloadAssets(T.event,0)}}else r&&f&&!this.itemsMatch(f,u)&&(v===c?this.bufferedToItem(f):v===c+1&&this.bufferedToItem(t[v]))}assetsBuffered(a,t){return a.event.assetList.length!==0&&!a.event.assetList.some(r=>{const s=this.getAssetPlayer(r.identifier);return!(s!=null&&s.bufferedInPlaceToEnd(t))})}setBufferingItem(a){const t=this.bufferingItem,r=this.schedule;if(this.itemsMatch(a,t))this.bufferingItem!==a&&(this.bufferingItem=a);else{const{items:s,events:u}=r;if(!s||!u)return t;const f=this.isInterstitial(a),c=this.getBufferingPlayer();if(this.bufferingItem=a,this.bufferedPos=Math.max(a.start,Math.min(a.end,this.timelinePos)),!this.playbackDisabled){const v=c?c.remaining:t?t.end-this.timelinePos:0;this.log(`buffered to boundary ${Ic(a)}`+(t?` (${v.toFixed(2)} remaining)`:"")),f?a.event.assetList.forEach(y=>{const E=this.getAssetPlayer(y.identifier);E&&E.resumeBuffering()}):(this.hls.resumeBuffering(),this.playerQueue.forEach(y=>y.pauseBuffering()))}this.hls.trigger(G.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:u.slice(0),schedule:s.slice(0),bufferingIndex:this.findItemIndex(a),playingIndex:this.findItemIndex(this.playingItem)})}return t}bufferedToItem(a,t=0){const r=this.setBufferingItem(a);if(!this.playbackDisabled){if(this.isInterstitial(a))this.bufferedToEvent(a,t);else if(r!==null){this.bufferingAsset=null;const s=this.detachedData;s?s.mediaSource?this.attachPrimary(a.start,a,!0):this.preloadPrimary(a):this.preloadPrimary(a)}}}preloadPrimary(a){const t=this.findItemIndex(a),r=this.getPrimaryResumption(a,t);this.startLoadingPrimaryAt(r)}bufferedToEvent(a,t){const r=a.event,s=r.assetList.length===0&&!r.assetListLoader,u=r.cue.once;if(s||!u){const f=this.preloadAssets(r,t);if(f!=null&&f.interstitial.appendInPlace){const c=r.assetList[t],v=this.primaryMedia;c&&v&&this.bufferAssetPlayer(f,v)}}}preloadAssets(a,t){const r=a.assetUrl,s=a.assetList.length,u=s===0&&!a.assetListLoader,f=a.cue.once;if(u){const v=a.timelineStart;if(a.appendInPlace){var c;const L=this.playingItem;this.isInterstitial(L)||(L==null||(c=L.nextEvent)==null?void 0:c.identifier)!==a.identifier||this.flushFrontBuffer(v+.25)}let y,E=0;if(!this.playingItem&&this.primaryLive&&(E=this.hls.startPosition,E===-1&&(E=this.hls.liveSyncPosition||0)),E&&!a.cue.pre&&!a.cue.post){const L=E-v;L>0&&(y=Math.round(1e3*L)/1e3)}if(this.log(`Load interstitial asset ${t+1}/${r?1:s} ${a}${y?` live-start: ${E} start-offset: ${y}`:""}`),r)return this.createAsset(a,0,0,v,a.duration,r);const A=this.assetListLoader.loadAssetList(a,y);A&&(a.assetListLoader=A)}else if(!f&&s){for(let v=t;v<s;v++){const y=a.assetList[v],E=this.getAssetPlayerQueueIndex(y.identifier);E!==-1&&!this.playerQueue[E].destroyed||y.error||this.createAssetPlayer(a,y,v)}return this.getAssetPlayer(a.assetList[t].identifier)}return null}flushFrontBuffer(a){const t=this.requiredTracks;t&&(this.log(`Removing front buffer starting at ${a}`),Object.keys(t).forEach(r=>{this.hls.trigger(G.BUFFER_FLUSHING,{startOffset:a,endOffset:1/0,type:r})}))}getAssetPlayerQueueIndex(a){const t=this.playerQueue;for(let r=0;r<t.length;r++)if(a===t[r].assetId)return r;return-1}getAssetPlayer(a){const t=this.getAssetPlayerQueueIndex(a);return this.playerQueue[t]||null}getBufferingPlayer(){const{playerQueue:a,primaryMedia:t}=this;if(t){for(let r=0;r<a.length;r++)if(a[r].media===t)return a[r]}return null}createAsset(a,t,r,s,u,f){const c={parentIdentifier:a.identifier,identifier:wO(a,f,t),duration:u,startOffset:r,timelineStart:s,uri:f};return this.createAssetPlayer(a,c,t)}createAssetPlayer(a,t,r){this.log(`create HLSAssetPlayer for ${RT(t)}`);const s=this.hls,u=s.userConfig;let f=u.videoPreference;const c=s.loadLevelObj||s.levels[s.currentLevel];(f||c)&&(f=cr({},f),c.videoCodec&&(f.videoCodec=c.videoCodec),c.videoRange&&(f.allowedVideoRanges=[c.videoRange]));const v=s.audioTracks[s.audioTrack],y=s.subtitleTracks[s.subtitleTrack];let E=0;if(this.primaryLive||a.appendInPlace){const Q=this.timelinePos-t.timelineStart;if(Q>1){const Z=t.duration;Z&&Q<Z&&(E=Q)}}const A=t.identifier,L=rr(rr({},u),{},{autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:s.sessionId,assetPlayerId:A,abrEwmaDefaultEstimate:s.bandwidthEstimate,interstitialsController:void 0,startPosition:E,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:f,audioPreference:v||u.audioPreference,subtitlePreference:y||u.subtitlePreference});a.appendInPlace&&(a.appendInPlaceStarted=!0,t.timelineStart&&(L.timelineOffset=t.timelineStart));const T=L.cmcd;T!=null&&T.sessionId&&T.contentId&&(L.cmcd=cr({},T,{contentId:Lm(t.uri)})),this.getAssetPlayer(A)&&this.warn(`Duplicate date range identifier ${a} and asset ${A}`);const M=new kO(this.HlsPlayerClass,L,a,t);this.playerQueue.push(M),a.assetList[r]=t;const O=Q=>{if(Q.live){const se=new Error(`Interstitials MUST be VOD assets ${a}`),ye={fatal:!0,type:Mt.OTHER_ERROR,details:Me.INTERSTITIAL_ASSET_ITEM_ERROR,error:se};return void this.handleAssetItemError(ye,a,this.schedule.findEventIndex(a.identifier),r,se.message)}const Z=Q.edge-Q.fragmentStart,ie=t.duration;(ie===null||Z>ie)&&(this.log(`Interstitial asset "${A}" duration change ${ie} > ${Z}`),t.duration=Z,this.updateSchedule())};M.on(G.LEVEL_UPDATED,(Q,{details:Z})=>O(Z)),M.on(G.LEVEL_PTS_UPDATED,(Q,{details:Z})=>O(Z));const U=(Q,Z)=>{const ie=this.getAssetPlayer(A);if(ie&&Z.tracks){ie.off(G.BUFFER_CODECS,U),ie.tracks=Z.tracks;const se=this.primaryMedia;this.bufferingAsset===ie.assetItem&&se&&!ie.media&&this.bufferAssetPlayer(ie,se)}};M.on(G.BUFFER_CODECS,U);const $=()=>{var Q;const Z=this.getAssetPlayer(A);if(this.log(`buffered to end of asset ${Z}`),!Z)return;const ie=this.schedule.findEventIndex(a.identifier),se=a.findAssetIndex(t),ye=se+1,N=(Q=this.schedule.items)==null?void 0:Q[ie];if(this.isInterstitial(N))if(se===-1||a.isAssetPastPlayoutLimit(ye)||a.assetList[ye].error){var re;const ne=(re=this.schedule.items)==null?void 0:re[ie+1];ne&&this.bufferedToItem(ne)}else this.bufferedToItem(N,ye)};M.on(G.BUFFERED_TO_END,$);const z=Q=>()=>{if(!this.getAssetPlayer(A))return;this.shouldPlay=!0;const Z=this.schedule.findEventIndex(a.identifier);this.advanceAfterAssetEnded(a,Z,Q)};return M.once(G.MEDIA_ENDED,z(r)),M.once(G.PLAYOUT_LIMIT_REACHED,z(1/0)),M.on(G.ERROR,(Q,Z)=>{const ie=this.getAssetPlayer(A);if(Z.details!==Me.BUFFER_STALLED_ERROR)this.handleAssetItemError(Z,a,this.schedule.findEventIndex(a.identifier),r,`Asset player error ${Z.error} ${a}`);else if(ie!=null&&ie.media){const se=ie.currentTime,ye=ie.duration-se;se&&a.appendInPlace&&ye/ie.media.playbackRate<.5?(this.log(`Advancing buffer past end of asset ${A} ${a} at ${ie.media.currentTime}`),$()):(this.warn(`Stalled at ${se} of ${se+ye} in asset ${A} ${a}`),this.onTimeupdate(),this.checkBuffer(!0))}}),M.on(G.DESTROYING,()=>{if(!this.getAssetPlayer(A))return;const Q=new Error(`Asset player destroyed unexpectedly ${A}`),Z={fatal:!0,type:Mt.OTHER_ERROR,details:Me.INTERSTITIAL_ASSET_ITEM_ERROR,error:Q};this.handleAssetItemError(Z,a,this.schedule.findEventIndex(a.identifier),r,Q.message)}),this.hls.trigger(G.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:r,event:a,player:M}),M}clearInterstitial(a,t){a.assetList.forEach(r=>{this.clearAssetPlayer(r.identifier,t)}),a.reset()}clearAssetPlayer(a,t){const r=this.getAssetPlayerQueueIndex(a);if(r!==-1){this.log(`clearAssetPlayer "${a}" toSegment: ${t&&Ic(t)}`);const s=this.playerQueue[r];this.transferMediaFromPlayer(s,t),this.playerQueue.splice(r,1),s.destroy()}}emptyPlayerQueue(){let a;for(;a=this.playerQueue.pop();)a.destroy();this.playerQueue=[]}startAssetPlayer(a,t,r,s,u){const{interstitial:f,assetItem:c,assetId:v}=a,y=f.assetList.length,E=this.playingAsset;this.endedAsset=null,this.playingAsset=c,E&&E.identifier===v||(E&&(this.clearAssetPlayer(E.identifier,r[s]),delete E.error),this.log(`INTERSTITIAL_ASSET_STARTED ${t+1}/${y} ${a}`),this.hls.trigger(G.INTERSTITIAL_ASSET_STARTED,{asset:c,assetListIndex:t,event:f,schedule:r.slice(0),scheduleIndex:s,player:a})),this.bufferAssetPlayer(a,u)}bufferAssetPlayer(a,t){var r,s;const{interstitial:u,assetItem:f,assetId:c}=a,v=this.schedule.findEventIndex(u.identifier),y=(r=this.schedule.items)==null?void 0:r[v];if(!y)return;this.setBufferingItem(y),this.bufferingAsset=f;const E=this.getBufferingPlayer();if(E===a)return;const A=u.appendInPlace;if(A&&(E==null?void 0:E.interstitial.appendInPlace)===!1)return;const L=(E==null?void 0:E.tracks)||((s=this.detachedData)==null?void 0:s.tracks)||this.requiredTracks;if(A&&f!==this.playingAsset){if(!a.tracks)return;if(L&&!Vk(L,a.tracks)){const T=new Error(`Asset "${c}" SourceBuffer tracks ('${Object.keys(a.tracks)}') are not compatible with primary content tracks ('${Object.keys(L)}')`),M={fatal:!0,type:Mt.OTHER_ERROR,details:Me.INTERSTITIAL_ASSET_ITEM_ERROR,error:T},O=u.findAssetIndex(f);return void this.handleAssetItemError(M,u,v,O,T.message)}}this.transferMediaTo(a,t)}handleAssetItemError(a,t,r,s,u){if(a.details===Me.BUFFER_STALLED_ERROR)return;const f=t.assetList[s]||null;let c=null;if(f){const A=this.getAssetPlayerQueueIndex(f.identifier);c=this.playerQueue[A]||null}const v=this.schedule.items,y=cr({},a,{fatal:!1,errorAction:mm(!0),asset:f,assetListIndex:s,event:t,schedule:v,scheduleIndex:r,player:c});if(this.warn(`Asset item error: ${a.error}`),this.hls.trigger(G.INTERSTITIAL_ASSET_ERROR,y),!a.fatal)return;const E=new Error(u);f&&(this.playingAsset!==f&&this.clearAssetPlayer(f.identifier,null),f.error=E),t.assetList.some(A=>!A.error)?t.appendInPlace&&(t.error=E):t.error=E,this.primaryFallback(t)}primaryFallback(a){const t=a.timelineStart,r=this.effectivePlayingItem;if(this.updateSchedule(),r){this.log(`Fallback to primary from event "${a.identifier}" start: ${t} pos: ${this.timelinePos} playing: ${r?Ic(r):"<none>"} error: ${a.error}`),a.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t));let s=this.timelinePos;s===-1&&(s=this.hls.startPosition);const u=this.updateItem(r,s);if(this.itemsMatch(r,u))this.clearInterstitial(a,null);else{const f=this.schedule.findItemIndexAtTime(s);this.setSchedulePosition(f)}}else this.checkStart()}onAssetListLoaded(a,t){var r;const s=t.event,u=s.identifier,f=t.assetListResponse.ASSETS;if(!this.schedule.hasEvent(u))return;const c=s.timelineStart,v=s.duration;let y=0;f.forEach((M,O)=>{const U=parseFloat(M.DURATION);this.createAsset(s,O,y,c+y,U,M.URI),y+=U}),s.duration=y,this.log(`Loaded asset-list with duration: ${y} (was: ${v}) ${s}`);const E=this.waitingItem,A=(E==null?void 0:E.event.identifier)===u;this.updateSchedule();const L=(r=this.bufferingItem)==null?void 0:r.event;if(A){var T;const M=this.schedule.findEventIndex(u),O=(T=this.schedule.items)==null?void 0:T[M];if(O){if(!this.playingItem&&this.timelinePos>O.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==M)return s.error=new Error(`Interstitial no longer within playback range ${this.timelinePos} ${s}`),void this.primaryFallback(s);this.setBufferingItem(O)}this.setSchedulePosition(M)}else if((L==null?void 0:L.identifier)===u&&L.appendInPlace){const M=s.assetList[0],O=this.getAssetPlayer(M.identifier),U=this.primaryMedia;M&&O&&U&&this.bufferAssetPlayer(O,U)}}onError(a,t){switch(t.details){case Me.ASSET_LIST_PARSING_ERROR:case Me.ASSET_LIST_LOAD_ERROR:case Me.ASSET_LIST_LOAD_TIMEOUT:{const r=t.interstitial;r&&this.primaryFallback(r);break}case Me.BUFFER_STALLED_ERROR:this.onTimeupdate(),this.checkBuffer(!0)}}}});function BT(a){return a&&typeof a=="object"?Array.isArray(a)?a.map(BT):Object.keys(a).reduce((t,r)=>(t[r]=BT(a[r]),t),{}):a}function ZO(a,t){const r=a.loader;r!==TL&&r!==SL?(t.log("[config]: Custom loader detected, cannot enable progressive streaming"),a.progressive=!1):function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}()&&(a.loader=TL,a.progressive=!0,a.enableSoftwareAES=!0,t.log("[config]: Progressive streaming enabled, using FetchLoader"))}class eN extends Nx{constructor(t,r){super("gap-controller",t.logger),this.hls=null,this.fragmentTracker=null,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var s;(s=this.media)!=null&&s.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{var s;this.hls&&(this.ended=((s=this.media)==null?void 0:s.currentTime)||1,this.hls.trigger(G.MEDIA_ENDED,{stalled:!1}))},this.hls=t,this.fragmentTracker=r,this.registerListeners()}registerListeners(){const{hls:t}=this;t&&(t.on(G.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(G.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(G.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:t}=this;t&&(t.off(G.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(G.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(G.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(t,r){this.setInterval(100),this.mediaSource=r.mediaSource;const s=this.media=r.media;cu(s,"playing",this.onMediaPlaying),cu(s,"waiting",this.onMediaWaiting),cu(s,"ended",this.onMediaEnded)}onMediaDetaching(t,r){this.clearInterval();const{media:s}=this;s&&(hl(s,"playing",this.onMediaPlaying),hl(s,"waiting",this.onMediaWaiting),hl(s,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(t,r){this.buffered=r.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var t;if((t=this.media)==null||!t.readyState||!this.hasBuffered)return;const r=this.media.currentTime;this.poll(r,this.lastCurrentTime),this.lastCurrentTime=r}poll(t,r){var s,u;const f=(s=this.hls)==null?void 0:s.config;if(!f)return;const{media:c,stalled:v}=this;if(!c)return;const{seeking:y}=c,E=this.seeking&&!y,A=!this.seeking&&y,L=c.paused&&!y||c.ended||c.playbackRate===0;if(this.seeking=y,t!==r)return r&&(this.ended=0),this.moved=!0,y||(this.nudgeRetry=0,f.nudgeOnVideoHole&&!L&&t>r&&this.nudgeOnVideoHole(t,r)),void(this.waiting===0&&this.stallResolved(t));if(A||E)return void(E&&this.stallResolved(t));if(L)return this.nudgeRetry=0,this.stallResolved(t),void(!this.ended&&c.ended&&this.hls&&(this.ended=t||1,this.hls.trigger(G.MEDIA_ENDED,{stalled:!1})));if(!bn.getBuffered(c).length)return void(this.nudgeRetry=0);const T=bn.bufferInfo(c,t,0),M=T.nextStart||0,O=this.fragmentTracker;if(y&&O&&this.hls){const ye=wL(this.hls.inFlightFragments,t),N=T.len>2,re=!M||ye||M-t>2&&!O.getPartialFragment(t);if(N||re)return;this.moved=!1}const U=(u=this.hls)==null?void 0:u.latestLevelDetails;if(!this.moved&&this.stalled!==null&&O){if(!(T.len>0)&&!M)return;const ye=Math.max(M,T.start||0)-t,N=U==null||!U.live?2:2*U.targetduration,re=O.getPartialFragment(t);if(ye>0&&(ye<=N||re))return void(c.paused||this.Os(re))}const $=f.detectStallWithCurrentTimeMs,z=self.performance.now(),Q=this.waiting;if(v===null)return void(this.stalled=Q>0&&z-Q<$?Q:z);const Z=z-v;if(!y&&(Z>=$||Q)&&this.hls){var ie;if(((ie=this.mediaSource)==null?void 0:ie.readyState)==="ended"&&(U==null||!U.live)&&Math.abs(t-((U==null?void 0:U.edge)||0))<1)return this.ended?void 0:(this.ended=t||1,void this.hls.trigger(G.MEDIA_ENDED,{stalled:!0}));if(this._s(T),!this.media||!this.hls)return}const se=bn.bufferInfo(c,t,f.maxBufferHole);this.Us(se,Z)}stallResolved(t){const r=this.stalled;if(r&&this.hls&&(this.stalled=null,this.stallReported)){const s=self.performance.now()-r;this.log(`playback not stuck anymore @${t}, after ${Math.round(s)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(G.STALL_RESOLVED,{})}}nudgeOnVideoHole(t,r){var s;const u=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(s=this.buffered.audio)!=null&&s.length&&u&&u.length>1&&t>u.end(0)){const f=bn.bufferedInfo(bn.timeRangesToArray(this.buffered.audio),t,0);if(f.len>1&&r>=f.start){const c=bn.timeRangesToArray(u),v=bn.bufferedInfo(c,r,0).bufferedIndex;if(v>-1&&v<c.length-1){const y=bn.bufferedInfo(c,t,0).bufferedIndex,E=c[v].end,A=c[v+1].start;if((y===-1||y>v)&&A-E<1&&t-E<2){const L=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${t} hole: ${E} -> ${A} buffered index: ${y}`);this.warn(L.message),this.media.currentTime+=1e-6;const T=this.fragmentTracker.getPartialFragment(t)||void 0,M=bn.bufferInfo(this.media,t,0);this.hls.trigger(G.ERROR,{type:Mt.MEDIA_ERROR,details:Me.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:L,reason:L.message,frag:T,buffer:M.len,bufferInfo:M})}}}}}Us(t,r){var s,u;const{fragmentTracker:f,media:c}=this,v=(s=this.hls)==null?void 0:s.config;if(!c||!f||!v)return;const y=c.currentTime,E=(u=this.hls)==null?void 0:u.latestLevelDetails,A=f.getPartialFragment(y);if((A||E!=null&&E.live&&y<E.fragmentStart)&&(this.Os(A)||!this.media))return;const L=t.buffered;(L&&L.length>1&&t.len>v.maxBufferHole||t.nextStart&&t.nextStart-y<v.maxBufferHole)&&(r>1e3*v.highBufferWatchdogPeriod||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this.Fs(t))}_s(t){const{hls:r,media:s,stallReported:u,stalled:f}=this;if(!u&&f!==null&&s&&r){this.stallReported=!0;const c=new Error(`Playback stalling at @${s.currentTime} due to low buffer (${Or(t)})`);this.warn(c.message),r.trigger(G.ERROR,{type:Mt.MEDIA_ERROR,details:Me.BUFFER_STALLED_ERROR,fatal:!1,error:c,buffer:t.len,bufferInfo:t,stalled:{start:f}})}}Os(t){var r;const{fragmentTracker:s,media:u}=this,f=(r=this.hls)==null?void 0:r.config;if(!u||!s||!f)return 0;const c=u.currentTime,v=bn.bufferInfo(u,c,0),y=c<v.start?v.start:v.nextStart;if(y&&this.hls){const A=v.len<=f.maxBufferHole,L=v.len>0&&v.len<1&&u.readyState<3,T=y-c;if(T>0&&(A||L)){if(T>f.maxBufferHole){let O=!1;if(c===0){const U=s.getAppendedFrag(0,On);U&&y<U.end&&(O=!0)}if(!O){const U=t||s.getAppendedFrag(c,On);if(U){var E;if((E=this.hls.loadLevelObj)==null||!E.details||wL(this.hls.inFlightFragments,y))return 0;let $=!1,z=U.end;for(;z<y;){const Q=s.getPartialFragment(z);if(!Q){$=!0;break}z+=Q.duration}if($)return 0}}}const M=Math.max(y+.05,c+.1);if(this.warn(`skipping hole, adjusting currentTime from ${c} to ${M}`),this.moved=!0,u.currentTime=M,t==null||!t.gap){const O=new Error(`fragment loaded with buffer holes, seeking from ${c} to ${M}`);this.hls.trigger(G.ERROR,{type:Mt.MEDIA_ERROR,details:Me.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:O,reason:O.message,frag:t||void 0,buffer:v.len,bufferInfo:v})}return M}}return 0}Fs(t){const{hls:r,media:s,nudgeRetry:u}=this,f=r==null?void 0:r.config;if(!s||!f)return 0;const c=s.currentTime;if(this.nudgeRetry++,u<f.nudgeMaxRetry){const v=c+(u+1)*f.nudgeOffset,y=new Error(`Nudging 'currentTime' from ${c} to ${v}`);this.warn(y.message),s.currentTime=v,r.trigger(G.ERROR,{type:Mt.MEDIA_ERROR,details:Me.BUFFER_NUDGE_ON_STALL,error:y,fatal:!1,buffer:t.len,bufferInfo:t})}else{const v=new Error(`Playhead still not moving while enough data buffered @${c} after ${f.nudgeMaxRetry} nudges`);this.error(v.message),r.trigger(G.ERROR,{type:Mt.MEDIA_ERROR,details:Me.BUFFER_STALLED_ERROR,error:v,fatal:!0,buffer:t.len,bufferInfo:t})}}}function wL(a,t){const r=AL(a.main);if(r&&r.start<=t)return r;const s=AL(a.audio);return s&&s.start<=t?s:null}function AL(a){if(!a)return null;switch(a.state){case En:case ri:case Hf:case Xd:return null}return a.frag}function $T(){if(typeof self<"u")return self.VTTCue||self.TextTrackCue}function kL(a,t,r,s,u){let f=new a(t,r,"");try{f.value=s,u&&(f.type=u)}catch{f=new a(t,r,Or(u?rr({type:u},s):s))}return f}const $0=(()=>{const a=$T();try{a&&new a(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class tN{constructor(t){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(G.EVENT_CUE_ENTER,{})},this.hls=t,this.$r()}destroy(){this.Rr(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}$r(){const{hls:t}=this;t.on(G.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(G.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(G.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(G.MANIFEST_LOADING,this.onManifestLoading,this),t.on(G.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.on(G.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(G.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(G.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this)}Rr(){const{hls:t}=this;t.off(G.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(G.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(G.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(G.MANIFEST_LOADING,this.onManifestLoading,this),t.off(G.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.off(G.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(G.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(G.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this)}onMediaAttaching(t,r){var s;this.media=r.media,((s=r.overrides)==null?void 0:s.cueRemoval)===!1&&(this.removeCues=!1)}onMediaAttached(){const t=this.hls.latestLevelDetails;t&&this.updateDateRangeCues(t)}onMediaDetaching(t,r){this.media=null,r.transferMedia||(this.id3Track&&(this.removeCues&&Yf(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(t){const r=this.getID3Track(t.textTracks);return r.mode="hidden",r}getID3Track(t){if(this.media){for(let r=0;r<t.length;r++){const s=t[r];if(s.kind==="metadata"&&s.label==="id3")return nL(s,this.media),s}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(t,r){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:s,enableID3MetadataCues:u}}}=this;if(!s&&!u)return;const{samples:f}=r;this.id3Track||(this.id3Track=this.createTrack(this.media));const c=$T();if(c)for(let v=0;v<f.length;v++){const y=f[v].type;if(y===da.emsg&&!s||!u)continue;const E=wI(f[v].data);if(E){const A=f[v].pts;let L=A+f[v].duration;L>$0&&(L=$0),L-A<=0&&(L=A+.25);for(let T=0;T<E.length;T++){const M=E[T];if(!AI(M)){this.updateId3CueEnds(A,y);const O=kL(c,A,L,M,y);O&&this.id3Track.addCue(O)}}}}}updateId3CueEnds(t,r){var s;const u=(s=this.id3Track)==null?void 0:s.cues;if(u)for(let f=u.length;f--;){const c=u[f];c.type===r&&c.startTime<t&&c.endTime===$0&&(c.endTime=t)}}onBufferFlushing(t,{startOffset:r,endOffset:s,type:u}){const{id3Track:f,hls:c}=this;if(!c)return;const{config:{enableEmsgMetadataCues:v,enableID3MetadataCues:y}}=c;if(f&&(v||y)){let E;E=u==="audio"?A=>A.type===da.audioId3&&y:u==="video"?A=>A.type===da.emsg&&v:A=>A.type===da.audioId3&&y||A.type===da.emsg&&v,IT(f,r,s,E)}}onLevelUpdated(t,{details:r}){this.updateDateRangeCues(r,!0)}onLevelPtsUpdated(t,r){Math.abs(r.drift)>.01&&this.updateDateRangeCues(r.details)}updateDateRangeCues(t,r){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{id3Track:s}=this,{dateRanges:u}=t,f=Object.keys(u);let c=this.dateRangeCuesAppended;var v;if(s&&r)if((v=s.cues)!=null&&v.length){const T=Object.keys(c).filter(M=>!f.includes(M));for(let M=T.length;M--;){const O=T[M],U=c[O].cues;delete c[O],Object.keys(U).forEach($=>{try{const z=U[$];z.removeEventListener("enter",this.onEventCueEnter),s.removeCue(z)}catch{}})}}else c=this.dateRangeCuesAppended={};const y=t.fragments[t.fragments.length-1];if(f.length===0||!vt(y==null?void 0:y.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const E=$T();for(let T=0;T<f.length;T++){const M=f[T],O=u[M],U=O.startTime,$=c[M],z=($==null?void 0:$.cues)||{};let Q=($==null?void 0:$.durationKnown)||!1,Z=$0;const{duration:ie,endDate:se}=O;if(se&&ie!==null)Z=U+ie,Q=!0;else if(O.endOnNext&&!Q){const N=f.reduce((re,ne)=>{if(ne!==O.id){const Se=u[ne];if(Se.class===O.class&&Se.startDate>O.startDate&&(!re||O.startDate<re.startDate))return Se}return re},null);N&&(Z=N.startTime,Q=!0)}const ye=Object.keys(O.attr);for(let N=0;N<ye.length;N++){const re=ye[N];if((L=re)==="ID"||L==="CLASS"||L==="CUE"||L==="START-DATE"||L==="DURATION"||L==="END-DATE"||L==="END-ON-NEXT")continue;const ne=z[re];if(ne)Q&&!$.durationKnown?ne.endTime=Z:Math.abs(ne.startTime-U)>.01&&(ne.startTime=U,ne.endTime=Z);else if(E){let Se=O.attr[re];RM(re)&&(A=Se,Se=Uint8Array.from(A.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer);const ce=kL(E,U,Z,{key:re,data:Se},da.dateRange);ce&&(ce.id=M,this.id3Track.addCue(ce),z[re]=ce,this.hls.config.interstitialsController&&(re!=="X-ASSET-LIST"&&re!=="X-ASSET-URL"||ce.addEventListener("enter",this.onEventCueEnter)))}}c[M]={cues:z,dateRange:O,durationKnown:Q}}var A,L}}class nN{constructor(t){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this.Bs=null,this.js=!1,this.onTimeupdate=()=>{const{media:r}=this,s=this.levelDetails;if(!r||!s)return;this.currentTime=r.currentTime;const u=this.computeLatency();if(u===null)return;this.Bs=u;const{lowLatencyMode:f,maxLiveSyncPlaybackRate:c}=this.config;if(!f||c===1||!s.live)return;const v=this.targetLatency;if(v===null)return;const y=u-v;if(y<Math.min(this.maxLatency,v+s.targetduration)&&y>.05&&this.forwardBufferLength>1){const E=Math.min(2,Math.max(1,c)),A=Math.round(2/(1+Math.exp(-.75*y-this.edgeStalled))*20)/20,L=Math.min(E,Math.max(1,A));this.changeMediaPlaybackRate(r,L)}else r.playbackRate!==1&&r.playbackRate!==0&&this.changeMediaPlaybackRate(r,1)},this.hls=t,this.config=t.config,this.registerListeners()}get levelDetails(){var t;return((t=this.hls)==null?void 0:t.latestLevelDetails)||null}get latency(){return this.Bs||0}get maxLatency(){const{config:t}=this;if(t.liveMaxLatencyDuration!==void 0)return t.liveMaxLatencyDuration;const r=this.levelDetails;return r?t.liveMaxLatencyDurationCount*r.targetduration:0}get targetLatency(){const t=this.levelDetails;if(t===null||this.hls===null)return null;const{holdBack:r,partHoldBack:s,targetduration:u}=t,{liveSyncDuration:f,liveSyncDurationCount:c,lowLatencyMode:v}=this.config,y=this.hls.userConfig;let E=v&&s||r;(this.js||y.liveSyncDuration||y.liveSyncDurationCount||E===0)&&(E=f!==void 0?f:c*u);const A=u;return E+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,A)}set targetLatency(t){this.stallCount=0,this.config.liveSyncDuration=t,this.js=!0}get liveSyncPosition(){const t=this.estimateLiveEdge(),r=this.targetLatency;if(t===null||r===null)return null;const s=this.levelDetails;if(s===null)return null;const u=s.edge,f=t-r-this.edgeStalled,c=u-s.totalduration,v=u-(this.config.lowLatencyMode&&s.partTarget||s.targetduration);return Math.min(Math.max(c,f),v)}get drift(){const t=this.levelDetails;return t===null?1:t.drift}get edgeStalled(){const t=this.levelDetails;if(t===null)return 0;const r=3*(this.config.lowLatencyMode&&t.partTarget||t.targetduration);return Math.max(t.age-r,0)}get forwardBufferLength(){const{media:t}=this,r=this.levelDetails;if(!t||!r)return 0;const s=t.buffered.length;return(s?t.buffered.end(s-1):r.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:t}=this;t&&(t.on(G.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(G.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(G.MANIFEST_LOADING,this.onManifestLoading,this),t.on(G.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(G.ERROR,this.onError,this))}unregisterListeners(){const{hls:t}=this;t&&(t.off(G.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(G.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(G.MANIFEST_LOADING,this.onManifestLoading,this),t.off(G.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(G.ERROR,this.onError,this))}onMediaAttached(t,r){this.media=r.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this.Bs=null,this.stallCount=0}onLevelUpdated(t,{details:r}){r.advanced&&this.onTimeupdate(),!r.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(t,r){var s;r.details===Me.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(s=this.levelDetails)!=null&&s.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(t,r){var s,u;t.playbackRate!==r&&((s=this.hls)==null||s.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(u=this.targetLatency)==null?void 0:u.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${t.playbackRate} to ${r}`),t.playbackRate=r)}estimateLiveEdge(){const t=this.levelDetails;return t===null?null:t.edge+t.age}computeLatency(){const t=this.estimateLiveEdge();return t===null?null:t-this.currentTime}}class rN extends ET{constructor(t,r){super(t,"level-controller"),this.Hs=[],this.Vs=-1,this.Gs=-1,this.Xs=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=r,this.$r()}$r(){const{hls:t}=this;t.on(G.MANIFEST_LOADING,this.onManifestLoading,this),t.on(G.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(G.LEVEL_LOADED,this.onLevelLoaded,this),t.on(G.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(G.FRAG_BUFFERED,this.onFragBuffered,this),t.on(G.ERROR,this.onError,this)}Rr(){const{hls:t}=this;t.off(G.MANIFEST_LOADING,this.onManifestLoading,this),t.off(G.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(G.LEVEL_LOADED,this.onLevelLoaded,this),t.off(G.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(G.FRAG_BUFFERED,this.onFragBuffered,this),t.off(G.ERROR,this.onError,this)}destroy(){this.Rr(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this.Hs.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this.Xs=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this.Hs=[],this.Gs=-1}onManifestLoading(t,r){this.resetLevels()}onManifestLoaded(t,r){const s=this.hls.config.preferManagedMediaSource,u=[],f={},c={};let v=!1,y=!1,E=!1;r.levels.forEach(A=>{var L;const T=A.attrs;let{audioCodec:M,videoCodec:O}=A;M&&(A.audioCodec=M=h0(M,s)||void 0),((L=O)==null?void 0:L.indexOf("avc1"))===0&&(O=A.videoCodec=function(Se){const ce=Se.split(",");for(let we=0;we<ce.length;we++){const ze=ce[we].split(".");if(ze.length>2){let xe=ze.shift()+".";xe+=parseInt(ze.shift()).toString(16),xe+=("000"+parseInt(ze.shift()).toString(16)).slice(-4),ce[we]=xe}}return ce.join(",")}(O));const{width:U,height:$,unknownCodecs:z}=A;let Q=z?z.length:0;if(z)for(let Se=Q;Se--;){const ce=z[Se];this.isAudioSupported(ce)?(A.audioCodec=M=M?`${M},${ce}`:ce,Q--,Nf.audio[M.substring(0,4)]=2):this.isVideoSupported(ce)&&(A.videoCodec=O=O?`${O},${ce}`:ce,Q--,Nf.video[O.substring(0,4)]=2)}if(v||(v=!(!U||!$)),y||(y=!!O),E||(E=!!M),Q||M&&!this.isAudioSupported(M)||O&&!this.isVideoSupported(O))return void this.log(`Some or all CODECS not supported "${T.CODECS}"`);const{CODECS:Z,"FRAME-RATE":ie,"HDCP-LEVEL":se,"PATHWAY-ID":ye,RESOLUTION:N,"VIDEO-RANGE":re}=T,ne=`${`${ye||"."}-`}${A.bitrate}-${N}-${ie}-${Z}-${re}-${se}`;if(f[ne])if(f[ne].uri===A.url||A.attrs["PATHWAY-ID"])f[ne].addGroupId("audio",T.AUDIO),f[ne].addGroupId("text",T.SUBTITLES);else{const Se=c[ne]+=1;A.attrs["PATHWAY-ID"]=new Array(Se+1).join(".");const ce=this.createLevel(A);f[ne]=ce,u.push(ce)}else{const Se=this.createLevel(A);f[ne]=Se,c[ne]=1,u.push(Se)}}),this.filterAndSortMediaOptions(u,r,v,y,E)}createLevel(t){const r=new pm(t),s=t.supplemental;if(s!=null&&s.videoCodec&&!this.isVideoSupported(s.videoCodec)){const u=new Error(`SUPPLEMENTAL-CODECS not supported "${s.videoCodec}"`);this.log(u.message),r.supportedResult=px(u,[])}return r}isAudioSupported(t){return UE(t,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(t){return UE(t,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(t,r,s,u,f){let c=[],v=[],y=t;if((s||u)&&f&&(y=y.filter(({videoCodec:$,videoRange:z,width:Q,height:Z})=>{return(!!$||!(!Q||!Z))&&!!(ie=z)&&p0.indexOf(ie)>-1;var ie})),y.length===0)return void Promise.resolve().then(()=>{if(this.hls){let $="no level with compatible codecs found in manifest",z=$;r.levels.length&&(z=`one or more CODECS in variant not supported: ${Or(r.levels.map(Z=>Z.attrs.CODECS).filter((Z,ie,se)=>se.indexOf(Z)===ie))}`,this.warn(z),$+=` (${z})`);const Q=new Error($);this.hls.trigger(G.ERROR,{type:Mt.MEDIA_ERROR,details:Me.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:r.url,error:Q,reason:z})}});r.audioTracks&&(c=r.audioTracks.filter($=>!$.audioCodec||this.isAudioSupported($.audioCodec)),xL(c)),r.subtitles&&(v=r.subtitles,xL(v));const E=y.slice(0);y.sort(($,z)=>{if($.attrs["HDCP-LEVEL"]!==z.attrs["HDCP-LEVEL"])return($.attrs["HDCP-LEVEL"]||"")>(z.attrs["HDCP-LEVEL"]||"")?1:-1;if(s&&$.height!==z.height)return $.height-z.height;if($.frameRate!==z.frameRate)return $.frameRate-z.frameRate;if($.videoRange!==z.videoRange)return p0.indexOf($.videoRange)-p0.indexOf(z.videoRange);if($.videoCodec!==z.videoCodec){const Q=cx($.videoCodec),Z=cx(z.videoCodec);if(Q!==Z)return Z-Q}if($.uri===z.uri&&$.codecSet!==z.codecSet){const Q=d0($.codecSet),Z=d0(z.codecSet);if(Q!==Z)return Z-Q}return $.averageBitrate!==z.averageBitrate?$.averageBitrate-z.averageBitrate:0});let A=E[0];if(this.steering&&(y=this.steering.filterParsedLevels(y),y.length!==E.length)){for(let $=0;$<E.length;$++)if(E[$].pathwayId===y[0].pathwayId){A=E[$];break}}this.Hs=y;for(let $=0;$<y.length;$++)if(y[$]===A){var L;this.Vs=$;const z=A.bitrate,Q=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${y.length} level(s) found, first bitrate: ${z}`),((L=this.hls.userConfig)==null?void 0:L.abrEwmaDefaultEstimate)===void 0){const Z=Math.min(z,this.hls.config.abrEwmaDefaultEstimateMax);Z>Q&&Q===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=Z)}break}const T=f&&!u,M=this.hls.config,O=!(!M.audioStreamController||!M.audioTrackController),U={levels:y,audioTracks:c,subtitleTracks:v,sessionData:r.sessionData,sessionKeys:r.sessionKeys,firstLevel:this.Vs,stats:r.stats,audio:f,video:u,altAudio:O&&!T&&c.some($=>!!$.url)};this.hls.trigger(G.MANIFEST_PARSED,U)}get levels(){return this.Hs.length===0?null:this.Hs}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(t){const r=this.Hs;if(r.length===0)return;if(t<0||t>=r.length){const A=new Error("invalid level idx"),L=t<0;if(this.hls.trigger(G.ERROR,{type:Mt.OTHER_ERROR,details:Me.LEVEL_SWITCH_ERROR,level:t,fatal:L,error:A,reason:A.message}),L)return;t=Math.min(t,r.length-1)}const s=this.currentLevelIndex,u=this.currentLevel,f=u?u.attrs["PATHWAY-ID"]:void 0,c=r[t],v=c.attrs["PATHWAY-ID"];if(this.currentLevelIndex=t,this.currentLevel=c,s===t&&u&&f===v)return;this.log(`Switching to level ${t} (${c.height?c.height+"p ":""}${c.videoRange?c.videoRange+" ":""}${c.codecSet?c.codecSet+" ":""}@${c.bitrate})${v?" with Pathway "+v:""} from level ${s}${f?" with Pathway "+f:""}`);const y={level:t,attrs:c.attrs,details:c.details,bitrate:c.bitrate,averageBitrate:c.averageBitrate,maxBitrate:c.maxBitrate,realBitrate:c.realBitrate,width:c.width,height:c.height,codecSet:c.codecSet,audioCodec:c.audioCodec,videoCodec:c.videoCodec,audioGroups:c.audioGroups,subtitleGroups:c.subtitleGroups,loaded:c.loaded,loadError:c.loadError,fragmentError:c.fragmentError,name:c.name,id:c.id,uri:c.uri,url:c.url,urlId:0,audioGroupIds:c.audioGroupIds,textGroupIds:c.textGroupIds};this.hls.trigger(G.LEVEL_SWITCHING,y);const E=c.details;if(!E||E.live){const A=this.switchParams(c.uri,u==null?void 0:u.details,E);this.loadPlaylist(A)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(t){this.manualLevelIndex=t,this.Xs===void 0&&(this.Xs=t),t!==-1&&(this.level=t)}get firstLevel(){return this.Vs}set firstLevel(t){this.Vs=t}get startLevel(){if(this.Xs===void 0){const t=this.hls.config.startLevel;return t!==void 0?t:this.hls.firstAutoLevel}return this.Xs}set startLevel(t){this.Xs=t}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(t){if(this.steering){const r=this.steering.pathways(),s=t.filter(u=>r.indexOf(u)!==-1);if(t.length<1)return void this.warn(`pathwayPriority ${t} should contain at least one pathway from list: ${r}`);this.steering.pathwayPriority=s}}onError(t,r){!r.fatal&&r.context&&r.context.type===ru&&r.context.level===this.level&&this.checkRetry(r)}onFragBuffered(t,{frag:r}){if(r!==void 0&&r.type===On){const s=r.elementaryStreams;if(!Object.keys(s).some(f=>!!s[f]))return;const u=this.Hs[r.level];u!=null&&u.loadError&&(this.log(`Resetting level error count of ${u.loadError} on frag buffered`),u.loadError=0)}}onLevelLoaded(t,r){var s;const{level:u,details:f}=r,c=r.levelInfo;var v;if(!c)return this.warn(`Invalid level index ${u}`),void((v=r.deliveryDirectives)!=null&&v.skip&&(f.deltaUpdateFailed=!0));if(c===this.currentLevel||r.withoutMultiVariant){c.fragmentError===0&&(c.loadError=0);let y=c.details;y===r.details&&y.advanced&&(y=void 0),this.playlistLoaded(u,r,y)}else(s=r.deliveryDirectives)!=null&&s.skip&&(f.deltaUpdateFailed=!0)}loadPlaylist(t){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,t)}loadingPlaylist(t,r){super.loadingPlaylist(t,r);const s=this.getUrlWithDirectives(t.uri,r),u=this.currentLevelIndex,f=t.attrs["PATHWAY-ID"],c=t.details,v=c==null?void 0:c.age;this.log(`Loading level index ${u}${(r==null?void 0:r.msn)!==void 0?" at sn "+r.msn+" part "+r.part:""}${f?" Pathway "+f:""}${v&&c.live?" age "+v.toFixed(1)+(c.type&&" "+c.type||""):""} ${s}`),this.hls.trigger(G.LEVEL_LOADING,{url:s,level:u,levelInfo:t,pathwayId:t.attrs["PATHWAY-ID"],id:0,deliveryDirectives:r||null})}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(t){this.level=t,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=t)}removeLevel(t){var r;if(this.Hs.length===1)return;const s=this.Hs.filter((f,c)=>c!==t||(this.steering&&this.steering.removeLevel(f),f===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,f.details&&f.details.fragments.forEach(v=>v.level=-1)),!1));lI(s),this.Hs=s,this.currentLevelIndex>-1&&(r=this.currentLevel)!=null&&r.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const u=s.length-1;this.Vs=Math.min(this.Vs,u),this.Xs&&(this.Xs=Math.min(this.Xs,u)),this.hls.trigger(G.LEVELS_UPDATED,{levels:s})}onLevelsUpdated(t,{levels:r}){this.Hs=r}checkMaxAutoUpdated(){const{autoLevelCapping:t,maxAutoLevel:r,maxHdcpLevel:s}=this.hls;this.Gs!==r&&(this.Gs=r,this.hls.trigger(G.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:t,levels:this.levels,maxAutoLevel:r,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:s}))}}function xL(a){const t={};a.forEach(r=>{const s=r.groupId||"";r.id=t[s]=t[s]||0,t[s]++})}function IL(){return self.SourceBuffer||self.WebKitSourceBuffer}function LL(){if(!Ac())return!1;const a=IL();return!a||a.prototype&&typeof a.prototype.appendBuffer=="function"&&typeof a.prototype.remove=="function"}class iN extends aT{constructor(t,r,s){super(t,r,s,"stream-controller",On),this.audioCodecSwap=!1,this.level=-1,this.qs=!1,this.Ks=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{const u=this.media,f=u?u.currentTime:null;if(f===null||!vt(f)||(this.log(`Media seeked to ${f.toFixed(3)}`),!this.getBufferedFrag(f)))return;const c=this.getFwdBufferInfoAtPos(u,f,On,0);c!==null&&c.len!==0?this.tick():this.warn(`Main forward buffer length at ${f} on "seeked" event ${c?c.len:"empty"})`)},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:t}=this;t.on(G.MANIFEST_PARSED,this.onManifestParsed,this),t.on(G.LEVEL_LOADING,this.onLevelLoading,this),t.on(G.LEVEL_LOADED,this.onLevelLoaded,this),t.on(G.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.on(G.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(G.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(G.BUFFER_CREATED,this.onBufferCreated,this),t.on(G.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(G.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(G.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:t}=this;t.off(G.MANIFEST_PARSED,this.onManifestParsed,this),t.off(G.LEVEL_LOADED,this.onLevelLoaded,this),t.off(G.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.off(G.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(G.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(G.BUFFER_CREATED,this.onBufferCreated,this),t.off(G.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(G.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(G.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(t,r){if(this.levels){const{lastCurrentTime:s,hls:u}=this;if(this.stopLoad(),this.setInterval(100),this.level=-1,!this.startFragRequested){let f=u.startLevel;f===-1&&(u.config.testBandwidth&&this.levels.length>1?(f=0,this.bitrateTest=!0):f=u.firstAutoLevel),u.nextLoadLevel=f,this.level=u.loadLevel,this.Ks=!!r}s>0&&t===-1&&!r&&(this.log(`Override startPosition with lastCurrentTime @${s.toFixed(3)}`),t=s),this.state=En,this.nextLoadPosition=this.lastCurrentTime=t+this.timelineOffset,this.startPosition=r?-1:t,this.tick()}else this.qs=!0,this.state=ri}stopLoad(){this.qs=!1,super.stopLoad()}doTick(){switch(this.state){case Jd:{const{levels:r,level:s}=this,u=r==null?void 0:r[s],f=u==null?void 0:u.details;if(f&&(!f.live||this.levelLastLoaded===u&&!this.waitForLive(u))){if(this.waitForCdnTuneIn(f))break;this.state=En;break}if(this.hls.nextLoadLevel!==this.level){this.state=En;break}break}case jf:{var t;const r=self.performance.now(),s=this.retryDate;if(!s||r>=s||(t=this.media)!=null&&t.seeking){const{levels:u,level:f}=this,c=u==null?void 0:u[f];this.resetStartWhenNotLoaded(c||null),this.state=En}}}this.state===En&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var t;super.onTickEnd(),(t=this.media)!=null&&t.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:t,levelLastLoaded:r,levels:s,media:u}=this;if(r===null||!u&&!this.primaryPrefetch&&(this.startFragRequested||!t.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const f=this.buffering?t.nextLoadLevel:t.loadLevel;if(s==null||!s[f])return;const c=s[f],v=this.getMainFwdBufferInfo();if(v===null)return;const y=this.getLevelDetails();if(y&&this.Vr(v,y)){const U={};return this.altAudio===2&&(U.type="video"),this.hls.trigger(G.BUFFER_EOS,U),void(this.state=Hf)}if(!this.buffering)return;t.loadLevel!==f&&t.manualLevel===-1&&this.log(`Adapting to level ${f} from level ${this.level}`),this.level=t.nextLoadLevel=f;const E=c.details;if(!E||this.state===Jd||this.waitForLive(c))return this.level=f,this.state=Jd,void(this.startFragRequested=!1);const A=v.len,L=this.getMaxBufferLength(c.maxBitrate);if(A>=L)return;this.backtrackFragment&&this.backtrackFragment.start>v.end&&(this.backtrackFragment=null);const T=this.backtrackFragment?this.backtrackFragment.start:v.end;let M=this.getNextFragment(T,E);if(this.couldBacktrack&&!this.fragPrevious&&M&&xi(M)&&this.fragmentTracker.getState(M)!==Ff){var O;const U=((O=this.backtrackFragment)!=null?O:M).sn-E.startSN,$=E.fragments[U-1];$&&M.cc===$.cc&&(M=$,this.fragmentTracker.removeFragment($))}else this.backtrackFragment&&v.len&&(this.backtrackFragment=null);if(M&&this.isLoopLoading(M,T)){if(!M.gap){const U=this.audioOnly&&!this.altAudio?Fs:Oa,$=(U===Oa?this.videoBuffer:this.mediaBuffer)||this.media;$&&this.afterBufferFlushed($,U,On)}M=this.getNextFragmentLoopLoading(M,E,v,On,L)}M&&(!M.initSegment||M.initSegment.data||this.bitrateTest||(M=M.initSegment),this.loadFragment(M,c,T))}loadFragment(t,r,s){const u=this.fragmentTracker.getState(t);u===ym||u===_f?xi(t)?this.bitrateTest?(this.log(`Fragment ${t.sn} of level ${t.level} is being downloaded to test bitrate and will not be buffered`),this.Ws(t,r)):super.loadFragment(t,r,s):this.Wr(t,r):this.clearTrackerIfNeeded(t)}getBufferedFrag(t){return this.fragmentTracker.getBufferedFrag(t,On)}followingBufferedFrag(t){return t?this.getBufferedFrag(t.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:t,media:r}=this;if(r!=null&&r.readyState){let s;const u=this.getAppendedFrag(r.currentTime);u&&u.start>1&&this.flushMainBuffer(0,u.start-1);const f=this.getLevelDetails();if(f!=null&&f.live){const v=this.getMainFwdBufferInfo();if(!v||v.len<2*f.targetduration)return}if(!r.paused&&t){const v=t[this.hls.nextLoadLevel],y=this.fragLastKbps;s=y&&this.fragCurrent?this.fragCurrent.duration*v.maxBitrate/(1e3*y)+1:0}else s=0;const c=this.getBufferedFrag(r.currentTime+s);if(c){const v=this.followingBufferedFrag(c);if(v){this.abortCurrentFrag();const y=v.maxStartPTS?v.maxStartPTS:v.start,E=v.duration,A=Math.max(c.end,y+Math.min(Math.max(E-this.config.maxFragLookUpTolerance,E*(this.couldBacktrack?.5:.125)),E*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(A,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const t=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,t&&(t.abortRequests(),this.fragmentTracker.removeFragment(t)),this.state){case sT:case $f:case jf:case lu:case I0:this.state=En}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(t,r){super.flushMainBuffer(t,r,this.altAudio===2?"video":null)}onMediaAttached(t,r){super.onMediaAttached(t,r);const s=r.media;cu(s,"playing",this.onMediaPlaying),cu(s,"seeked",this.onMediaSeeked)}onMediaDetaching(t,r){const{media:s}=this;s&&(hl(s,"playing",this.onMediaPlaying),hl(s,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(t,r),r.transferMedia||(this.Ks=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(G.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(t,r){let s=!1,u=!1;r.levels.forEach(f=>{const c=f.audioCodec;c&&(s=s||c.indexOf("mp4a.40.2")!==-1,u=u||c.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=s&&u&&!function(){var f;const c=IL();return typeof(c==null||(f=c.prototype)==null?void 0:f.changeType)=="function"}(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=r.levels,this.startFragRequested=!1}onLevelLoading(t,r){const{levels:s}=this;if(!s||this.state!==En)return;const u=r.levelInfo;(!u.details||u.details.live&&(this.levelLastLoaded!==u||u.details.expired)||this.waitForCdnTuneIn(u.details))&&(this.state=Jd)}onLevelLoaded(t,r){var s;const{levels:u,startFragRequested:f}=this,c=r.level,v=r.details,y=v.totalduration;if(!u)return void this.warn(`Levels were reset while loading level ${c}`);this.log(`Level ${c} loaded [${v.startSN},${v.endSN}]${v.lastPartSn?`[part-${v.lastPartSn}-${v.lastPartIndex}]`:""}, cc [${v.startCC}, ${v.endCC}] duration:${y}`);const E=r.levelInfo,A=this.fragCurrent;!A||this.state!==$f&&this.state!==jf||A.level!==r.level&&A.loader&&this.abortCurrentFrag();let L=0;if(v.live||(s=E.details)!=null&&s.live){var T;if(this.checkLiveUpdate(v),v.deltaUpdateFailed)return;L=this.alignPlaylists(v,E.details,(T=this.levelLastLoaded)==null?void 0:T.details)}if(E.details=v,this.levelLastLoaded=E,f||this.setStartPosition(v,L),this.hls.trigger(G.LEVEL_UPDATED,{details:v,level:c}),this.state===Jd){if(this.waitForCdnTuneIn(v))return;this.state=En}f&&v.live&&this.synchronizeToLiveEdge(v),this.tick()}synchronizeToLiveEdge(t){const{config:r,media:s}=this;if(!s)return;const u=this.hls.liveSyncPosition,f=this.getLoadPosition(),c=t.fragmentStart,v=t.edge,y=f>=c-r.maxFragLookUpTolerance&&f<=v;if(u!==null&&s.duration>u&&(f<u||!y)){const E=r.liveMaxLatencyDuration!==void 0?r.liveMaxLatencyDuration:r.liveMaxLatencyDurationCount*t.targetduration;(!y&&s.readyState<4||f<v-E)&&(this.Ks||(this.nextLoadPosition=u),s.readyState&&(this.warn(`Playback: ${f.toFixed(3)} is located too far from the end of live sliding playlist: ${v}, reset currentTime to : ${u.toFixed(3)}`),s.currentTime=u))}}qr(t){var r;const s=t.frag,{part:u,payload:f}=t,{levels:c}=this;if(!c)return void this.warn(`Levels were reset while fragment load was in progress. Fragment ${s.sn} of level ${s.level} will not be buffered`);const v=c[s.level];if(!v)return void this.warn(`Level ${s.level} not found on progress`);const y=v.details;if(!y)return this.warn(`Dropping fragment ${s.sn} of level ${s.level} after level details were reset`),void this.fragmentTracker.removeFragment(s);const E=v.videoCodec,A=y.PTSKnown||!y.live,L=(r=s.initSegment)==null?void 0:r.data,T=this.zs(v),M=this.transmuxer=this.transmuxer||new jI(this.hls,On,this.Rs.bind(this),this.zr.bind(this)),O=u?u.index:-1,U=O!==-1,$=new KE(s.level,s.sn,s.stats.chunkCount,f.byteLength,O,U),z=this.initPTS[s.cc];M.push(f,L,T,E,s,u,y.totalduration,A,$,z)}onAudioTrackSwitching(t,r){const s=this.hls,u=this.altAudio===2;if(g0(r.url,s))this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const f=this.fragCurrent;f&&(this.log("Switching to main audio track, cancel main fragment load"),f.abortRequests(),this.fragmentTracker.removeFragment(f)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(u)return this.fragmentTracker.removeAllFragments(),s.once(G.BUFFER_FLUSHED,()=>{var f;(f=this.hls)==null||f.trigger(G.AUDIO_TRACK_SWITCHED,r)}),void s.trigger(G.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});s.trigger(G.AUDIO_TRACK_SWITCHED,r)}}onAudioTrackSwitched(t,r){const s=g0(r.url,this.hls);if(s){const u=this.videoBuffer;u&&this.mediaBuffer!==u&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=u)}this.altAudio=s?2:0,this.tick()}onBufferCreated(t,r){const s=r.tracks;let u,f,c=!1;for(const v in s){const y=s[v];if(y.id==="main"){if(f=v,u=y,v==="video"){const E=s[v];E&&(this.videoBuffer=E.buffer)}}else c=!0}c&&u?(this.log(`Alternate track found, use ${f}.buffered to schedule main fragment loading`),this.mediaBuffer=u.buffer):this.mediaBuffer=this.media}onFragBuffered(t,r){const{frag:s,part:u}=r,f=s.type===On;if(f){if(this.fragContextChanged(s))return this.warn(`Fragment ${s.sn}${u?" p: "+u.index:""} of level ${s.level} finished buffering, but was aborted. state: ${this.state}`),void(this.state===I0&&(this.state=En));const v=u?u.stats:s.stats;this.fragLastKbps=Math.round(8*v.total/(v.buffering.end-v.loading.first)),xi(s)&&(this.fragPrevious=s),this.fragBufferedComplete(s,u)}const c=this.media;c&&(!this.Ks&&bn.getBuffered(c).length&&(this.Ks=!0,this.seekToStartPos()),f&&this.tick())}get hasEnoughToStart(){return this.Ks}onError(t,r){var s;if(r.fatal)this.state=Xd;else switch(r.details){case Me.FRAG_GAP:case Me.FRAG_PARSING_ERROR:case Me.FRAG_DECRYPT_ERROR:case Me.FRAG_LOAD_ERROR:case Me.FRAG_LOAD_TIMEOUT:case Me.KEY_LOAD_ERROR:case Me.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(On,r);break;case Me.LEVEL_LOAD_ERROR:case Me.LEVEL_LOAD_TIMEOUT:case Me.LEVEL_PARSING_ERROR:r.levelRetry||this.state!==Jd||((s=r.context)==null?void 0:s.type)!==ru||(this.state=En);break;case Me.BUFFER_ADD_CODEC_ERROR:case Me.BUFFER_APPEND_ERROR:if(r.parent!=="main")return;this.resetLoadingState();break;case Me.BUFFER_FULL_ERROR:if(r.parent!=="main")return;this.reduceLengthAndFlushBuffer(r)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case Me.INTERNAL_EXCEPTION:this.recoverWorkerError(r)}}onFragLoadEmergencyAborted(){this.state=En,this.Ks||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(t,{type:r}){if(r!==Fs||!this.altAudio){const s=(r===Oa?this.videoBuffer:this.mediaBuffer)||this.media;s&&(this.afterBufferFlushed(s,r,On),this.tick())}}onLevelsUpdated(t,r){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=r.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:t}=this;if(!t)return;const r=t.currentTime;let s=this.startPosition;if(s>=0&&r<s){if(t.seeking)return void this.log(`could not seek to ${s}, already seeking at ${r}`);const u=this.timelineOffset;u&&s&&(s+=u);const f=this.getLevelDetails(),c=bn.getBuffered(t),v=c.length?c.start(0):0,y=v-s,E=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);y>0&&(y<E||this.loadingParts&&y<2*((f==null?void 0:f.partTarget)||0))&&(this.log(`adjusting start position by ${y} to match buffer start`),s+=y,this.startPosition=s),r<s&&(this.log(`seek to target start position ${s} from current time ${r} buffer start ${v}`),t.currentTime=s)}}zs(t){let r=this.config.defaultAudioCodec||t.audioCodec;return this.audioCodecSwap&&r&&(this.log("Swapping audio codec"),r=r.indexOf("mp4a.40.5")!==-1?"mp4a.40.2":"mp4a.40.5"),r}Ws(t,r){t.bitrateTest=!0,this.Xr(t,r).then(s=>{const{hls:u}=this,f=s==null?void 0:s.frag;if(!f||this.fragContextChanged(f))return;r.fragmentError=0,this.state=En,this.startFragRequested=!1,this.bitrateTest=!1;const c=f.stats;c.parsing.start=c.parsing.end=c.buffering.start=c.buffering.end=self.performance.now(),u.trigger(G.FRAG_LOADED,s),f.bitrateTest=!1})}Rs(t){var r;const s=this.playlistType,{hls:u}=this,{remuxResult:f,chunkMeta:c}=t,v=this.getCurrentContext(c);if(!v)return void this.resetWhenMissingContext(c);const{frag:y,part:E,level:A}=v,{video:L,text:T,id3:M,initSegment:O}=f,{details:U}=A,$=this.altAudio?void 0:f.audio;if(this.fragContextChanged(y))this.fragmentTracker.removeFragment(y);else{if(this.state=lu,O){if(O!=null&&O.tracks){const Z=y.initSegment||y;this.Ps(A,O.tracks,Z,c),u.trigger(G.FRAG_PARSING_INIT_SEGMENT,{frag:Z,id:s,tracks:O.tracks})}const z=O.initPTS,Q=O.timescale;vt(z)&&(this.initPTS[y.cc]={baseTime:z,timescale:Q},u.trigger(G.INIT_PTS_FOUND,{frag:y,id:s,initPTS:z,timescale:Q}))}if(L&&U){$&&L.type==="audiovideo"&&this.logMuxedErr(y);const z=U.fragments[y.sn-1-U.startSN],Q=y.sn===U.startSN,Z=!z||y.cc>z.cc;if(f.independent!==!1){const{startPTS:ie,endPTS:se,startDTS:ye,endDTS:N}=L;if(E)E.elementaryStreams[L.type]={startPTS:ie,endPTS:se,startDTS:ye,endDTS:N};else if(L.firstKeyFrame&&L.independent&&c.id===1&&!Z&&(this.couldBacktrack=!0),L.dropped&&L.independent){const re=this.getMainFwdBufferInfo(),ne=(re?re.end:this.getLoadPosition())+this.config.maxBufferHole,Se=L.firstKeyFramePTS?L.firstKeyFramePTS:ie;if(!Q&&ne<Se-this.config.maxBufferHole&&!Z)return void this.backtrack(y);Z&&(y.gap=!0),y.setElementaryStreamInfo(L.type,y.start,se,y.start,N,!0)}else Q&&ie-(U.appliedTimelineOffset||0)>2&&(y.gap=!0);y.setElementaryStreamInfo(L.type,ie,se,ye,N),this.backtrackFragment&&(this.backtrackFragment=y),this.bufferFragmentData(L,y,E,c,Q||Z)}else{if(!Q&&!Z)return void this.backtrack(y);y.gap=!0}}if($){const{startPTS:z,endPTS:Q,startDTS:Z,endDTS:ie}=$;E&&(E.elementaryStreams[Fs]={startPTS:z,endPTS:Q,startDTS:Z,endDTS:ie}),y.setElementaryStreamInfo(Fs,z,Q,Z,ie),this.bufferFragmentData($,y,E,c)}if(U&&M!=null&&(r=M.samples)!=null&&r.length){const z={id:s,frag:y,details:U,samples:M.samples};u.trigger(G.FRAG_PARSING_METADATA,z)}if(U&&T){const z={id:s,frag:y,details:U,samples:T.samples};u.trigger(G.FRAG_PARSING_USERDATA,z)}}}logMuxedErr(t){this.warn(`${xi(t)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${t.url}`)}Ps(t,r,s,u){if(this.state!==lu)return;this.audioOnly=!!r.audio&&!r.video,this.altAudio&&!this.audioOnly&&(delete r.audio,r.audiovideo&&this.logMuxedErr(s));const{audio:f,video:c,audiovideo:v}=r;if(f){let E=f0(f.codec,t.audioCodec);E==="mp4a"&&(E="mp4a.40.5");const A=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){E&&(E=E.indexOf("mp4a.40.5")!==-1?"mp4a.40.2":"mp4a.40.5");const L=f.metadata;L&&"channelCount"in L&&(L.channelCount||1)!==1&&A.indexOf("firefox")===-1&&(E="mp4a.40.5")}E&&E.indexOf("mp4a.40.5")!==-1&&A.indexOf("android")!==-1&&f.container!=="audio/mpeg"&&(E="mp4a.40.2",this.log(`Android: force audio codec to ${E}`)),t.audioCodec&&t.audioCodec!==E&&this.log(`Swapping manifest audio codec "${t.audioCodec}" for "${E}"`),f.levelCodec=E,f.id=On,this.log(`Init audio buffer, container:${f.container}, codecs[selected/level/parsed]=[${E||""}/${t.audioCodec||""}/${f.codec}]`),delete r.audiovideo}if(c){c.levelCodec=t.videoCodec,c.id=On;const E=c.codec;if((E==null?void 0:E.length)===4)switch(E){case"hvc1":case"hev1":c.codec="hvc1.1.6.L120.90";break;case"av01":c.codec="av01.0.04M.08";break;case"avc1":c.codec="avc1.42e01e"}this.log(`Init video buffer, container:${c.container}, codecs[level/parsed]=[${t.videoCodec||""}/${E}]${c.codec!==E?" parsed-corrected="+c.codec:""}${c.supplemental?" supplemental="+c.supplemental:""}`),delete r.audiovideo}v&&(this.log(`Init audiovideo buffer, container:${v.container}, codecs[level/parsed]=[${t.codecs}/${v.codec}]`),delete r.video,delete r.audio);const y=Object.keys(r);if(y.length){if(this.hls.trigger(G.BUFFER_CODECS,r),!this.hls)return;y.forEach(E=>{const A=r[E].initSegment;A!=null&&A.byteLength&&this.hls.trigger(G.BUFFER_APPENDING,{type:E,data:A,frag:s,part:null,chunkMeta:u,parent:s.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const t=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(t,On)}get maxBufferLength(){const{levels:t,level:r}=this,s=t==null?void 0:t[r];return s?this.getMaxBufferLength(s.maxBitrate):this.config.maxBufferLength}backtrack(t){this.couldBacktrack=!0,this.backtrackFragment=t,this.resetTransmuxer(),this.flushBufferGap(t),this.fragmentTracker.removeFragment(t),this.fragPrevious=null,this.nextLoadPosition=t.start,this.state=En}checkFragmentChanged(){const t=this.media;let r=null;if(t&&t.readyState>1&&t.seeking===!1){const s=t.currentTime;if(bn.isBuffered(t,s)?r=this.getAppendedFrag(s):bn.isBuffered(t,s+.1)&&(r=this.getAppendedFrag(s+.1)),r){this.backtrackFragment=null;const u=this.fragPlaying,f=r.level;u&&r.sn===u.sn&&u.level===f||(this.fragPlaying=r,this.hls.trigger(G.FRAG_CHANGED,{frag:r}),u&&u.level===f||this.hls.trigger(G.LEVEL_SWITCHED,{level:f}))}}}get nextLevel(){const t=this.nextBufferedFrag;return t?t.level:-1}get currentFrag(){var t;if(this.fragPlaying)return this.fragPlaying;const r=((t=this.media)==null?void 0:t.currentTime)||this.lastCurrentTime;return vt(r)?this.getAppendedFrag(r):null}get currentProgramDateTime(){var t;const r=((t=this.media)==null?void 0:t.currentTime)||this.lastCurrentTime;if(vt(r)){const s=this.getLevelDetails(),u=this.currentFrag||(s?Qd(null,s.fragments,r):null);if(u){const f=u.programDateTime;if(f!==null){const c=f+1e3*(r-u.start);return new Date(c)}}}return null}get currentLevel(){const t=this.currentFrag;return t?t.level:-1}get nextBufferedFrag(){const t=this.currentFrag;return t?this.followingBufferedFrag(t):null}get forceStartLoad(){return this.qs}}class sN{constructor(t){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=t}abort(t){for(const s in this.keyUriToKeyInfo){const u=this.keyUriToKeyInfo[s].loader;if(u){var r;if(t&&t!==((r=u.context)==null?void 0:r.frag.type))return;u.abort()}}}detach(){for(const t in this.keyUriToKeyInfo){const r=this.keyUriToKeyInfo[t];(r.mediaKeySessionContext||r.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[t]}}destroy(){this.detach();for(const t in this.keyUriToKeyInfo){const r=this.keyUriToKeyInfo[t].loader;r&&r.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(t,r=Me.KEY_LOAD_ERROR,s,u,f){return new au({type:Mt.NETWORK_ERROR,details:r,fatal:!1,frag:t,response:f,error:s,networkDetails:u})}loadClear(t,r){if(this.emeController&&this.config.emeEnabled){const{sn:s,cc:u}=t;for(let f=0;f<r.length;f++){const c=r[f];if(u<=c.cc&&(s==="initSegment"||c.sn==="initSegment"||s<c.sn)){this.emeController.selectKeySystemFormat(c).then(v=>{c.setKeyFormat(v)});break}}}}load(t){return!t.decryptdata&&t.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(t).then(r=>this.loadInternal(t,r)):this.loadInternal(t)}loadInternal(t,r){var s,u;r&&t.setKeyFormat(r);const f=t.decryptdata;if(!f){const E=new Error(r?`Expected frag.decryptdata to be defined after setting format ${r}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(t,Me.KEY_LOAD_ERROR,E))}const c=f.uri;if(!c)return Promise.reject(this.createKeyLoadError(t,Me.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${c}"`)));let v=this.keyUriToKeyInfo[c];if((s=v)!=null&&s.decryptdata.key)return f.key=v.decryptdata.key,Promise.resolve({frag:t,keyInfo:v});var y;if((u=v)!=null&&u.keyLoadPromise)switch((y=v.mediaKeySessionContext)==null?void 0:y.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return v.keyLoadPromise.then(E=>(f.key=E.keyInfo.decryptdata.key,{frag:t,keyInfo:v}))}switch(v=this.keyUriToKeyInfo[c]={decryptdata:f,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},f.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return f.keyFormat==="identity"?this.loadKeyHTTP(v,t):this.loadKeyEME(v,t);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(v,t);default:return Promise.reject(this.createKeyLoadError(t,Me.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${f.method}"`)))}}loadKeyEME(t,r){const s={frag:r,keyInfo:t};if(this.emeController&&this.config.emeEnabled){const u=this.emeController.loadKey(s);if(u)return(t.keyLoadPromise=u.then(f=>(t.mediaKeySessionContext=f,s))).catch(f=>{throw t.keyLoadPromise=null,f})}return Promise.resolve(s)}loadKeyHTTP(t,r){const s=this.config,u=new s.loader(s);return r.keyLoader=t.loader=u,t.keyLoadPromise=new Promise((f,c)=>{const v={keyInfo:t,frag:r,responseType:"arraybuffer",url:t.decryptdata.uri},y=s.keyLoadPolicy.default,E={loadPolicy:y,timeout:y.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},A={onSuccess:(L,T,M,O)=>{const{frag:U,keyInfo:$,url:z}=M;if(!U.decryptdata||$!==this.keyUriToKeyInfo[z])return c(this.createKeyLoadError(U,Me.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),O));$.decryptdata.key=U.decryptdata.key=new Uint8Array(L.data),U.keyLoader=null,$.loader=null,f({frag:U,keyInfo:$})},onError:(L,T,M,O)=>{this.resetLoader(T),c(this.createKeyLoadError(r,Me.KEY_LOAD_ERROR,new Error(`HTTP Error ${L.code} loading key ${L.text}`),M,rr({url:v.url,data:void 0},L)))},onTimeout:(L,T,M)=>{this.resetLoader(T),c(this.createKeyLoadError(r,Me.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),M))},onAbort:(L,T,M)=>{this.resetLoader(T),c(this.createKeyLoadError(r,Me.INTERNAL_ABORTED,new Error("key loading aborted"),M))}};u.load(v,E,A)})}resetLoader(t){const{frag:r,keyInfo:s,url:u}=t,f=s.loader;r.keyLoader===f&&(r.keyLoader=null,s.loader=null),delete this.keyUriToKeyInfo[u],f&&f.destroy()}}function RL(a){const{type:t}=a;switch(t){case bo:return _s;case il:return Eo;default:return On}}function jT(a,t){let r=a.url;return r!==void 0&&r.indexOf("data:")!==0||(r=t.url),r}class aN{constructor(t){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=t,this.registerListeners()}startLoad(t){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:t}=this;t.on(G.MANIFEST_LOADING,this.onManifestLoading,this),t.on(G.LEVEL_LOADING,this.onLevelLoading,this),t.on(G.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.on(G.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),t.on(G.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:t}=this;t.off(G.MANIFEST_LOADING,this.onManifestLoading,this),t.off(G.LEVEL_LOADING,this.onLevelLoading,this),t.off(G.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.off(G.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),t.off(G.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(t){const r=this.hls.config,s=r.pLoader,u=r.loader,f=new(s||u)(r);return this.loaders[t.type]=f,f}getInternalLoader(t){return this.loaders[t.type]}resetInternalLoader(t){this.loaders[t]&&delete this.loaders[t]}destroyInternalLoaders(){for(const t in this.loaders){const r=this.loaders[t];r&&r.destroy(),this.resetInternalLoader(t)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(t,r){const{url:s}=r;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Sc,url:s,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(t,r){const{id:s,level:u,pathwayId:f,url:c,deliveryDirectives:v,levelInfo:y}=r;this.load({id:s,level:u,pathwayId:f,responseType:"text",type:ru,url:c,deliveryDirectives:v,levelOrTrack:y})}onAudioTrackLoading(t,r){const{id:s,groupId:u,url:f,deliveryDirectives:c,track:v}=r;this.load({id:s,groupId:u,level:null,responseType:"text",type:bo,url:f,deliveryDirectives:c,levelOrTrack:v})}onSubtitleTrackLoading(t,r){const{id:s,groupId:u,url:f,deliveryDirectives:c,track:v}=r;this.load({id:s,groupId:u,level:null,responseType:"text",type:il,url:f,deliveryDirectives:c,levelOrTrack:v})}onLevelsUpdated(t,r){const s=this.loaders[ru];if(s){const u=s.context;u&&!r.levels.some(f=>f===u.levelOrTrack)&&(s.abort(),delete this.loaders[ru])}}load(t){var r;const s=this.hls.config;let u,f=this.getInternalLoader(t);if(f){const E=this.hls.logger,A=f.context;if(A&&A.levelOrTrack===t.levelOrTrack&&(A.url===t.url||A.deliveryDirectives&&!t.deliveryDirectives))return void(A.url===t.url?E.log(`[playlist-loader]: ignore ${t.url} ongoing request`):E.log(`[playlist-loader]: ignore ${t.url} in favor of ${A.url}`));E.log(`[playlist-loader]: aborting previous loader for type: ${t.type}`),f.abort()}if(u=t.type===Sc?s.manifestLoadPolicy.default:cr({},s.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),f=this.createInternalLoader(t),vt((r=t.deliveryDirectives)==null?void 0:r.part)){let E;if(t.type===ru&&t.level!==null?E=this.hls.levels[t.level].details:t.type===bo&&t.id!==null?E=this.hls.audioTracks[t.id].details:t.type===il&&t.id!==null&&(E=this.hls.subtitleTracks[t.id].details),E){const A=E.partTarget,L=E.targetduration;if(A&&L){const T=1e3*Math.max(3*A,.8*L);u=cr({},u,{maxTimeToFirstByteMs:Math.min(T,u.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(T,u.maxTimeToFirstByteMs)})}}}const c=u.errorRetry||u.timeoutRetry||{},v={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:c.maxNumRetry||0,retryDelay:c.retryDelayMs||0,maxRetryDelay:c.maxRetryDelayMs||0},y={onSuccess:(E,A,L,T)=>{const M=this.getInternalLoader(L);this.resetInternalLoader(L.type);const O=E.data;O.indexOf("#EXTM3U")===0?(A.parsing.start=performance.now(),ul.isMediaPlaylist(O)||L.type!==Sc?this.handleTrackOrLevelPlaylist(E,A,L,T||null,M):this.handleMasterPlaylist(E,A,L,T)):this.handleManifestParsingError(E,L,new Error("no EXTM3U delimiter"),T||null,A)},onError:(E,A,L,T)=>{this.handleNetworkError(A,L,!1,E,T)},onTimeout:(E,A,L)=>{this.handleNetworkError(A,L,!0,void 0,E)}};f.load(t,v,y)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:t,startPosition:r},forceStartLoad:s}=this.hls;(t||s)&&(this.hls.logger.log(`${t?"auto":"force"} startLoad with configured startPosition ${r}`),this.hls.startLoad(r))}handleMasterPlaylist(t,r,s,u){const f=this.hls,c=t.data,v=jT(t,s),y=ul.parseMasterPlaylist(c,v);if(y.playlistParsingError)return void this.handleManifestParsingError(t,s,y.playlistParsingError,u,r);const{contentSteering:E,levels:A,sessionData:L,sessionKeys:T,startTimeOffset:M,variableList:O}=y;this.variableList=O;const{AUDIO:U=[],SUBTITLES:$,"CLOSED-CAPTIONS":z}=ul.parseMasterPlaylistMedia(c,v,y);U.length&&(U.some(Q=>!Q.url)||!A[0].audioCodec||A[0].attrs.AUDIO||(this.hls.logger.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 Fr({}),bitrate:0,url:""}))),f.trigger(G.MANIFEST_LOADED,{levels:A,audioTracks:U,subtitles:$,captions:z,contentSteering:E,url:v,stats:r,networkDetails:u,sessionData:L,sessionKeys:T,startTimeOffset:M,variableList:O})}handleTrackOrLevelPlaylist(t,r,s,u,f){const c=this.hls,{id:v,level:y,type:E}=s,A=jT(t,s),L=vt(y)?y:vt(v)?v:0,T=RL(s),M=ul.parseLevelPlaylist(t.data,A,L,T,0,this.variableList);if(E===Sc){const O={attrs:new Fr({}),bitrate:0,details:M,name:"",url:A};M.requestScheduled=r.loading.start+iI(M,0),c.trigger(G.MANIFEST_LOADED,{levels:[O],audioTracks:[],url:A,stats:r,networkDetails:u,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}r.parsing.end=performance.now(),s.levelDetails=M,this.handlePlaylistLoaded(M,t,r,s,u,f)}handleManifestParsingError(t,r,s,u,f){this.hls.trigger(G.ERROR,{type:Mt.NETWORK_ERROR,details:Me.MANIFEST_PARSING_ERROR,fatal:r.type===Sc,url:t.url,err:s,error:s,reason:s.message,response:t,context:r,networkDetails:u,stats:f})}handleNetworkError(t,r,s=!1,u,f){let c=`A network ${s?"timeout":"error"+(u?" (status "+u.code+")":"")} occurred while loading ${t.type}`;t.type===ru?c+=`: ${t.level} id: ${t.id}`:t.type!==bo&&t.type!==il||(c+=` id: ${t.id} group-id: "${t.groupId}"`);const v=new Error(c);this.hls.logger.warn(`[playlist-loader]: ${c}`);let y=Me.UNKNOWN,E=!1;const A=this.getInternalLoader(t);switch(t.type){case Sc:y=s?Me.MANIFEST_LOAD_TIMEOUT:Me.MANIFEST_LOAD_ERROR,E=!0;break;case ru:y=s?Me.LEVEL_LOAD_TIMEOUT:Me.LEVEL_LOAD_ERROR,E=!1;break;case bo:y=s?Me.AUDIO_TRACK_LOAD_TIMEOUT:Me.AUDIO_TRACK_LOAD_ERROR,E=!1;break;case il:y=s?Me.SUBTITLE_TRACK_LOAD_TIMEOUT:Me.SUBTITLE_LOAD_ERROR,E=!1}A&&this.resetInternalLoader(t.type);const L={type:Mt.NETWORK_ERROR,details:y,fatal:E,url:t.url,loader:A,context:t,error:v,networkDetails:r,stats:f};if(u){const T=(r==null?void 0:r.url)||t.url;L.response=rr({url:T,data:void 0},u)}this.hls.trigger(G.ERROR,L)}handlePlaylistLoaded(t,r,s,u,f,c){const v=this.hls,{type:y,level:E,id:A,groupId:L,deliveryDirectives:T}=u,M=jT(r,u),O=RL(u),U=typeof u.level=="number"&&O===On?E:void 0;if(!t.fragments.length){const z=t.playlistParsingError=new Error("No Segments found in Playlist");return void v.trigger(G.ERROR,{type:Mt.NETWORK_ERROR,details:Me.LEVEL_EMPTY_ERROR,fatal:!1,url:M,error:z,reason:z.message,response:r,context:u,level:U,parent:O,networkDetails:f,stats:s})}t.targetduration||(t.playlistParsingError=new Error("Missing Target Duration"));const $=t.playlistParsingError;if($){if(this.hls.logger.warn($),!v.config.ignorePlaylistParsingErrors)return void v.trigger(G.ERROR,{type:Mt.NETWORK_ERROR,details:Me.LEVEL_PARSING_ERROR,fatal:!1,url:M,error:$,reason:$.message,response:r,context:u,level:U,parent:O,networkDetails:f,stats:s});t.playlistParsingError=null}switch(t.live&&c&&(c.getCacheAge&&(t.ageHeader=c.getCacheAge()||0),c.getCacheAge&&!isNaN(t.ageHeader)||(t.ageHeader=0)),y){case Sc:case ru:v.trigger(G.LEVEL_LOADED,{details:t,levelInfo:u.levelOrTrack||v.levels[0],level:U||0,id:A||0,stats:s,networkDetails:f,deliveryDirectives:T,withoutMultiVariant:y===Sc});break;case bo:v.trigger(G.AUDIO_TRACK_LOADED,{details:t,track:u.levelOrTrack,id:A||0,groupId:L||"",stats:s,networkDetails:f,deliveryDirectives:T});break;case il:v.trigger(G.SUBTITLE_TRACK_LOADED,{details:t,track:u.levelOrTrack,id:A||0,groupId:L||"",stats:s,networkDetails:f,deliveryDirectives:T})}}}class Lc{static get version(){return Sm}static isMSESupported(){return LL()}static isSupported(){return function(){if(!LL())return!1;const t=Ac();return typeof(t==null?void 0:t.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(r=>t.isTypeSupported(fm(r,"video")))||["mp4a.40.2","fLaC"].some(r=>t.isTypeSupported(fm(r,"audio"))))}()}static getMediaSource(){return Ac()}static get Events(){return G}static get MetadataSchema(){return da}static get ErrorTypes(){return Mt}static get ErrorDetails(){return Me}static get DefaultConfig(){return Lc.defaultConfig?Lc.defaultConfig:JO}static set DefaultConfig(t){Lc.defaultConfig=t}constructor(t={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.Ys=new oT,this.Qs=-1,this.Js=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.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this.Zs=null,this.yr=null,this.eo=void 0,this.triggeringException=void 0,this.started=!1;const r=this.logger=function(xe,Ce,J){const ue=RE();if(typeof console=="object"&&xe===!0||typeof xe=="object"){const de=["debug","log","info","warn","error"];de.forEach(W=>{ue[W]=Hk(W,xe,J)});try{ue.log(`Debug logs enabled for "${Ce}" in hls.js version 1.6.2`)}catch{return RE()}de.forEach(W=>{CE[W]=Hk(W,xe)})}else cr(CE,ue);return ue}(t.debug||!1,"Hls instance",t.assetPlayerId),s=this.config=function(xe,Ce,J){if((Ce.liveSyncDurationCount||Ce.liveMaxLatencyDurationCount)&&(Ce.liveSyncDuration||Ce.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(Ce.liveMaxLatencyDurationCount!==void 0&&(Ce.liveSyncDurationCount===void 0||Ce.liveMaxLatencyDurationCount<=Ce.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(Ce.liveMaxLatencyDuration!==void 0&&(Ce.liveSyncDuration===void 0||Ce.liveMaxLatencyDuration<=Ce.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const ue=BT(xe),de=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach(W=>{const Ke=`${W==="level"?"playlist":W}LoadPolicy`,nt=Ce[Ke]===void 0,mt=[];de.forEach(ot=>{const lt=`${W}Loading${ot}`,nn=Ce[lt];if(nn!==void 0&&nt){mt.push(lt);const pn=ue[Ke].default;switch(Ce[Ke]={default:pn},ot){case"TimeOut":pn.maxLoadTimeMs=nn,pn.maxTimeToFirstByteMs=nn;break;case"MaxRetry":pn.errorRetry.maxNumRetry=nn,pn.timeoutRetry.maxNumRetry=nn;break;case"RetryDelay":pn.errorRetry.retryDelayMs=nn,pn.timeoutRetry.retryDelayMs=nn;break;case"MaxRetryTimeout":pn.errorRetry.maxRetryDelayMs=nn,pn.timeoutRetry.maxRetryDelayMs=nn}}}),mt.length&&J.warn(`hls.js config: "${mt.join('", "')}" setting(s) are deprecated, use "${Ke}": ${Or(Ce[Ke])}`)}),rr(rr({},ue),Ce)}(Lc.DefaultConfig,t,r);this.userConfig=t,s.progressive&&ZO(s,r);const{abrController:u,bufferController:f,capLevelController:c,errorController:v,fpsController:y}=s,E=new v(this),A=this.abrController=new u(this),L=new SM(this),T=s.interstitialsController,M=T?this.interstitialsController=new T(this,Lc):null,O=this.bufferController=new f(this,L),U=this.capLevelController=new c(this),$=new y(this),z=new aN(this),Q=s.contentSteeringController,Z=Q?new Q(this):null,ie=this.levelController=new rN(this,Z),se=new tN(this),ye=new sN(this.config),N=this.streamController=new iN(this,L,ye),re=this.gapController=new eN(this,L);U.setStreamController(N),$.setStreamController(N);const ne=[z,ie,N];M&&ne.splice(1,0,M),Z&&ne.splice(1,0,Z),this.networkControllers=ne;const Se=[A,O,re,U,$,se,L];this.audioTrackController=this.createController(s.audioTrackController,ne);const ce=s.audioStreamController;ce&&ne.push(this.audioStreamController=new ce(this,L,ye)),this.subtitleTrackController=this.createController(s.subtitleTrackController,ne);const we=s.subtitleStreamController;we&&ne.push(this.subtititleStreamController=new we(this,L,ye)),this.createController(s.timelineController,Se),ye.emeController=this.emeController=this.createController(s.emeController,Se),this.cmcdController=this.createController(s.cmcdController,Se),this.latencyController=this.createController(nN,Se),this.coreComponents=Se,ne.push(E);const ze=E.onErrorOut;typeof ze=="function"&&this.on(G.ERROR,ze,E),this.on(G.MANIFEST_LOADED,z.onManifestLoaded,z)}createController(t,r){if(t){const s=new t(this);return r&&r.push(s),s}return null}on(t,r,s=this){this.Ys.on(t,r,s)}once(t,r,s=this){this.Ys.once(t,r,s)}removeAllListeners(t){this.Ys.removeAllListeners(t)}off(t,r,s=this,u){this.Ys.off(t,r,s,u)}listeners(t){return this.Ys.listeners(t)}emit(t,r,s){return this.Ys.emit(t,r,s)}trigger(t,r){if(this.config.debug)return this.emit(t,t,r);try{return this.emit(t,t,r)}catch(s){if(this.logger.error("An internal error happened while handling event "+t+'. Error message: "'+s.message+'". Here is a stacktrace:',s),!this.triggeringException){this.triggeringException=!0;const u=t===G.ERROR;this.trigger(G.ERROR,{type:Mt.OTHER_ERROR,details:Me.INTERNAL_EXCEPTION,fatal:u,event:t,error:s}),this.triggeringException=!1}}return!1}listenerCount(t){return this.Ys.listenerCount(t)}destroy(){this.logger.log("destroy"),this.trigger(G.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this.Qs=-1,this.yr=null,this.networkControllers.forEach(r=>r.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(r=>r.destroy()),this.coreComponents.length=0;const t=this.config;t.xhrSetup=t.fetchSetup=void 0,this.userConfig=null}attachMedia(t){if(!t||"media"in t&&!t.media){const f=new Error(`attachMedia failed: invalid argument (${t})`);return void this.trigger(G.ERROR,{type:Mt.OTHER_ERROR,details:Me.ATTACH_MEDIA_ERROR,fatal:!0,error:f})}this.logger.log("attachMedia"),this.Zs&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const r="media"in t,s=r?t.media:t,u=r?t:{media:s};this.Zs=s,this.trigger(G.MEDIA_ATTACHING,u)}detachMedia(){this.logger.log("detachMedia"),this.trigger(G.MEDIA_DETACHING,{}),this.Zs=null}transferMedia(){this.Zs=null;const t=this.bufferController.transferMedia();return this.trigger(G.MEDIA_DETACHING,{transferMedia:t}),t}loadSource(t){this.stopLoad();const r=this.media,s=this.yr,u=this.yr=DE.buildAbsoluteURL(self.location.href,t,{alwaysNormalize:!0});this.Qs=-1,this.Js=null,this.logger.log(`loadSource:${u}`),r&&s&&(s!==u||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(r)),this.trigger(G.MANIFEST_LOADING,{url:t})}get url(){return this.yr}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(t=-1,r){this.logger.log(`startLoad(${t+(r?", <skip seek to start>":"")})`),this.started=!0,this.resumeBuffering();for(let s=0;s<this.networkControllers.length&&(this.networkControllers[s].startLoad(t,r),this.started&&this.networkControllers);s++);}stopLoad(){this.logger.log("stopLoad"),this.started=!1;for(let t=0;t<this.networkControllers.length&&(this.networkControllers[t].stopLoad(),!this.started&&this.networkControllers);t++);}get loadingEnabled(){return this.started}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach(t=>{t.resumeBuffering&&t.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(t=>{t.pauseBuffering&&t.pauseBuffering()}))}get inFlightFragments(){const t={[On]:this.streamController.inFlightFrag};return this.audioStreamController&&(t[_s]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(t[Eo]=this.subtititleStreamController.inFlightFrag),t}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const t=this.Zs,r=t==null?void 0:t.currentTime;this.detachMedia(),t&&(this.attachMedia(t),r&&this.startLoad(r))}removeLevel(t){this.levelController.removeLevel(t)}get sessionId(){let t=this.eo;return t||(t=this.eo=function(){try{return crypto.randomUUID()}catch{try{const s=URL.createObjectURL(new Blob),u=s.toString();return URL.revokeObjectURL(s),u.slice(u.lastIndexOf("/")+1)}catch{let u=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,f=>{const c=(u+16*Math.random())%16|0;return u=Math.floor(u/16),(f=="x"?c:3&c|8).toString(16)})}}}()),t}get levels(){return this.levelController.levels||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(t){this.logger.log(`set currentLevel:${t}`),this.levelController.manualLevel=t,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(t){this.logger.log(`set nextLevel:${t}`),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(t){this.logger.log(`set loadLevel:${t}`),this.levelController.manualLevel=t}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(t){this.levelController.nextLoadLevel=t}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(t){this.logger.log(`set firstLevel:${t}`),this.levelController.firstLevel=t}get startLevel(){const t=this.levelController.startLevel;return t===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:t}set startLevel(t){this.logger.log(`set startLevel:${t}`),t!==-1&&(t=Math.max(t,this.minAutoLevel)),this.levelController.startLevel=t}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(t){const r=!!t;r!==this.config.capLevelToPlayerSize&&(r?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=r)}get autoLevelCapping(){return this.Qs}get bandwidthEstimate(){const{bwEstimator:t}=this.abrController;return t?t.getEstimate():NaN}set bandwidthEstimate(t){this.abrController.resetEstimator(t)}get abrEwmaDefaultEstimate(){const{bwEstimator:t}=this.abrController;return t?t.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:t}=this.abrController;return t?t.getEstimateTTFB():NaN}set autoLevelCapping(t){this.Qs!==t&&(this.logger.log(`set autoLevelCapping:${t}`),this.Qs=t,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this.Js}set maxHdcpLevel(t){(function(r){return $E.indexOf(r)>-1})(t)&&this.Js!==t&&(this.Js=t,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:t,config:{minAutoBitrate:r}}=this;if(!t)return 0;const s=t.length;for(let u=0;u<s;u++)if(t[u].maxBitrate>=r)return u;return 0}get maxAutoLevel(){const{levels:t,autoLevelCapping:r,maxHdcpLevel:s}=this;let u;if(u=r===-1&&t!=null&&t.length?t.length-1:r,s)for(let f=u;f--;){const c=t[f].attrs["HDCP-LEVEL"];if(c&&c<=s)return f}return u}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(t){this.abrController.nextAutoLevel=t}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(t){var r;return((r=this.audioTrackController)==null?void 0:r.setAudioOption(t))||null}setSubtitleOption(t){var r;return((r=this.subtitleTrackController)==null?void 0:r.setSubtitleOption(t))||null}get allAudioTracks(){const t=this.audioTrackController;return t?t.allAudioTracks:[]}get audioTracks(){const t=this.audioTrackController;return t?t.audioTracks:[]}get audioTrack(){const t=this.audioTrackController;return t?t.audioTrack:-1}set audioTrack(t){const r=this.audioTrackController;r&&(r.audioTrack=t)}get allSubtitleTracks(){const t=this.subtitleTrackController;return t?t.allSubtitleTracks:[]}get subtitleTracks(){const t=this.subtitleTrackController;return t?t.subtitleTracks:[]}get subtitleTrack(){const t=this.subtitleTrackController;return t?t.subtitleTrack:-1}get media(){return this.Zs}set subtitleTrack(t){const r=this.subtitleTrackController;r&&(r.subtitleTrack=t)}get subtitleDisplay(){const t=this.subtitleTrackController;return!!t&&t.subtitleDisplay}set subtitleDisplay(t){const r=this.subtitleTrackController;r&&(r.subtitleDisplay=t)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(t){this.config.lowLatencyMode=t}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}set targetLatency(t){this.latencyController.targetLatency=t}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(t){this.levelController.pathwayPriority=t}get bufferedToEnd(){var t;return!((t=this.bufferController)==null||!t.bufferedToEnd)}get interstitialsManager(){var t;return((t=this.interstitialsController)==null?void 0:t.interstitialsManager)||null}getMediaDecodingInfo(t,r=this.allAudioTracks){return mx(t,Tx(r),navigator.mediaCapabilities)}}Lc.defaultConfig=void 0;const oN=[G.MEDIA_ATTACHED,G.MEDIA_DETACHED,G.MANIFEST_LOADING,G.MANIFEST_LOADED,G.DESTROYING];class lN extends jk{constructor(){super(...arguments);Mr(this,"hls");Mr(this,"videoElement");Mr(this,"loaded",!1);Mr(this,"observed",!1);Mr(this,"canceled",!1);Mr(this,"playAttempted",!1)}async setup({videoElement:r}){this.videoElement=r,this.hls=new Lc({maxBufferLength:30,maxMaxBufferLength:60}),this.setupPlayerEventListeners(),this.fireSetup()}setupPlayerEventListeners(){this.hls.on(G.ERROR,(r,s)=>{if(s.fatal)switch(s.type){case Mt.NETWORK_ERROR:{this.hls.startLoad();const u=new Error(s.details||"Network error occurred");u.name="HLSNetworkError",this.fireError(u);break}case Mt.MEDIA_ERROR:this.hls.recoverMediaError();break;default:this.destroyPlayer(),this.setup({videoElement:this.videoElement})}}),oN.forEach(r=>{this.hls.on(r,(s,u)=>{Ns.debug(s,"hls",u)})})}async initializePlayer(){this.hls.attachMedia(this.videoElement),this.fireInitialized()}async load(r){return this.fireLoad(),this.hls.loadSource(r),this.loaded=!0,Promise.resolve()}async destroyPlayer(){try{this.pause()}catch{}try{return this.hls&&(this.hls.stopLoad(),this.hls.detachMedia(),this.hls.destroy()),Promise.resolve()}catch(r){return Promise.reject(r)}}async play(){return this.videoElement.paused?this.videoElement.play().catch(r=>{}):Promise.resolve()}pause(){this.videoElement.paused||this.videoElement.pause()}}function j0(a=null){var E;let t,r=null,s=null,u=null,f=null,c=!1,v=!1,y=!1;if(!a){if(typeof window>"u"||!((E=window.navigator)!=null&&E.userAgent))return{osName:r,osVersion:s,browserName:u,browserVersion:f,isMobile:c,isTablet:v,isFeaturePhone:y};a=window.navigator.userAgent}return(t=a.match(/iPhone|iPod|iPad/))?(r="iPhone",c=!0,v=t[0]==="iPad",(t=a.match(/ OS (\d+([_.]\d+)*)/))&&(s=t[1].replace(/_/g,"."))):(t=a.match(/Android( (\d+(\.\d+)*))?/))?(r="Android",t[2]&&(s=t[2]),c=!0,v=!a.match(/Mobile/)):(t=a.match(/Windows Phone(( OS)? (\d+(\.\d+)*))?/))?(r="Windows Phone",t[3]&&(s=t[3]),c=!0,v=!!a.match(/Touch/)):(t=a.match(/Windows( NT (\d+(\.\d+)*))?/))?(r="Windows",t[2]&&(s=t[2])):(t=a.match(/Macintosh(.*OS X (\d+([_.]\d+)*))?/))?(r="Macintosh",t[2]&&(s=t[2].replace(/_/g,"."))):a.match(/DoCoMo/)?(r="DoCoMo",c=!0,y=!0):a.match(/(J-PHONE|Vodafone|SoftBank)/)?(r="SoftBank",c=!0,y=!0):a.match(/UP\.Browser/)&&(r="KDDI",c=!0,y=!0),(t=a.match(/Edge([/ ](\d+(\.\d+)*))?/))?(u="Edge",t[2]&&(f=t[2])):(t=a.match(/Opera([/ ](\d+(\.\d+)*))?/))?(u="Opera",t[2]&&(f=t[2])):r==="Android"&&(t=a.match(/Version(\/(\d+(\.\d+)*))?/))?(u="AndroidBrowser",t[2]&&(f=t[2])):(t=a.match(/(Chrome|CriOS)(\/(\d+(\.\d+)*))?/))?(u="Chrome",t[3]&&(f=t[3])):(t=a.match(/Firefox(\/(\d+(\.\d+)*))?/))?(u="Firefox",t[2]&&(f=t[2])):a.match(/(MSIE|Trident)/)?(u="IE",(t=a.match(/(rv:|MSIE )(\d+(\.\d+)*)/))&&(f=t[2])):(t=a.match(/Safari(\/(\d+(\.\d+)*))?/))&&(u="Safari",t[2]&&(f=t[2])),{osName:r,osVersion:s,browserName:u,browserVersion:f,isMobile:c,isTablet:v,isFeaturePhone:y}}const G0="VideoPlayerLoadingError",GT="VideoCan'tPlayError",uN="HoverPlayingError",cN="ErrorBoundary",Rc="player type",Cc="Library Provider",Dc="Additional Data",CL="ShakaError",HT="GeneralPlayerError";class dN extends Error{constructor(r,s){super();Mr(this,"message");Mr(this,"name");Mr(this,"type");Mr(this,"cause");Mr(this,"translationCode");this.message=(s==null?void 0:s.message)||`A Video Player error occurred with the following error code: ${r.code}.`,this.cause=(u=>"detail"in u?u.detail:u)(r),this.name=(s==null?void 0:s.name)||CL,this.type=CL}}class hN extends Error{constructor(r,s){super();Mr(this,"message");Mr(this,"name");Mr(this,"type");Mr(this,"cause");Mr(this,"translationCode");this.message=(s==null?void 0:s.message)||r.message||`${r.name} ocurred.`,this.type=HT,this.cause=r,this.name=(s==null?void 0:s.name)||r.name||HT,this.translationCode=HT}}const Pc=(a,t)=>(r=>typeof r=="object"&&r!==null&&("detail"in r&&r.detail!==null&&typeof r.detail=="object"?"code"in r.detail&&"category"in r.detail&&"severity"in r.detail:"code"in r&&"category"in r&&"severity"in r))(a)?new dN(a,t):new hN(a,t),fN=({onClick:a})=>ki.jsx("button",{className:"video-player-play-button",onClick:a,"aria-label":"Play video",children:ki.jsx("span",{className:"video-player-play-icon"})}),Xf=1,DL="HLSJS",pN="SHAKA",gN=({manifestUri:a,playerType:t,type:r,thumbnail:s,control:u,onPlayStarted:f,onPlay:c,onPlaying:v,onLoadeddata:y,libraryProvider:E,errorScreen:A,...L})=>{const T=nr.useRef(null),[M,O]=nr.useState(!0),[U,$]=nr.useState(!1),[z,Q]=nr.useState(!1),[Z,ie]=nr.useState(null),[se]=nr.useState(()=>E===DL?new lN:new ZP);return(({videoRef:ye,playerType:N,player:re,type:ne})=>{nr.useEffect(()=>{const Se=j0();if(N===Hb||Se.isMobile&&N===vc&&ne!==sm)return;const ce=ye.current;if(!ce)return;const we=new IntersectionObserver(ze=>{ze.forEach(xe=>{xe.isIntersecting?re.fireObserved():re.fireUnobserved()})},{threshold:.6});return we.observe(ce),()=>{we.disconnect()}},[ye,N,re,ne])})({videoRef:T,playerType:t,player:se,type:r}),((ye,N,re,ne)=>{nr.useEffect(()=>{const Se=ye.current;if(!Se)return;let ce=Se.paused,we=Se.muted,ze=!1;const xe=()=>{if(document.visibilityState!=="hidden"||document.pictureInPictureElement){if(document.visibilityState==="visible"&&!document.pictureInPictureElement){if(!ze)return void(N.playAttempted&&Se.paused&&Se.play().catch(Ce=>{if(Ce.name==="AbortError")return;const J=Pc(Ce,{name:GT});rl(J,ue=>(ue.setContext(Dc,J),ue.setTag(Rc,re),ue.setTag(Cc,ne),ue))}));ce||Se.play().catch(Ce=>{if(Ce.name==="AbortError")return;const J=Pc(Ce,{name:GT});rl(J,ue=>(ue.setContext(Dc,J),ue.setTag(Rc,re),ue.setTag(Cc,ne),ue))}),we||(Se.muted=!1)}}else ze=!0,ce=Se.paused,we=Se.muted,Se.paused||Se.pause(),Se.muted||(Se.muted=!0)};return document.addEventListener("visibilitychange",xe),()=>{document.removeEventListener("visibilitychange",xe)}},[ye,N])})(T,se,t,E),nr.useEffect(()=>{if(!a)return;const ye=j0();let N=!1;return(async()=>{const re=T.current;if(re){se.addEventListener("observed",()=>{Ns.debug("observed","player event");const ne=!se.observed;se.canceled=!1,se.observed||(se.observed=!0),se.observed&&se.loaded&&(t===vc&&r!==sm||t===el&&u===Xf&&!ye.isMobile)&&(se.playAttempted=!0,re.play().then(()=>{$(!0),ne&&se.firePlayStart()}).catch(Se=>{const ce=Pc(Se,{name:G0});rl(ce,we=>(we.setContext(Dc,ce),we.setTag(Rc,t),we.setTag(Cc,E),we))}))}),se.addEventListener("unobserved",()=>{Ns.debug("unobserved","player event"),se.canceled=!0,se.loaded&&re.pause()}),se.addEventListener("loaded",()=>{Ns.debug("loaded","player event"),se.loaded=!0,se.observed&&se.loaded&&!se.canceled&&(t===vc||t===el&&u===Xf&&!ye.isMobile)&&(se.playAttempted=!0,re.play().then(()=>{se.firePlayStart(),$(!0)}).catch(ne=>{if(ne.name==="NotAllowedError")O(!0);else{const Se=Pc(ne,{name:G0});rl(Se,ce=>(ce.setContext(Dc,Se),ce.setTag(Rc,t),ce.setTag(Cc,E),ce))}}))}),se.addEventListener("playStart",()=>{Ns.debug("playStart","player event"),f()}),se.addEventListener("error",ne=>{var we;const Se=ne,ce=(we=Se.detail)==null?void 0:we.error;if(ce){ie(ce);const ze=Pc(ce,{name:G0});rl(ze,xe=>(xe.setContext(Dc,ze),xe.setTag(Rc,t),xe.setTag(Cc,E),xe))}});try{if(await se.setup({videoElement:re,shaka:Zw}),await se.initializePlayer(),await se.load(a),N)return;se.fireLoaded()}catch(ne){if(N)return;const Se=ne;if(Se.severity===Zw.util.Error.Severity.CRITICAL){ie(Se);const ce=Pc(ne,{name:G0});rl(ce,we=>(we.setContext(Dc,ce),we.setTag(Rc,t),we.setTag(Cc,E),we))}}}})(),()=>{se&&(N=!0,se.destroyPlayer())}},[a,se,f,t]),Z?A:ki.jsxs(ki.Fragment,{children:[ki.jsx("video",{ref:T,controls:U,controlsList:"nodownload noplaybackrate",disablePictureInPicture:!0,muted:!0,onPlay:()=>{Q(!1);const ye=T.current;z&&Math.floor(ye.currentTime)===Math.floor(ye.duration)&&(ye.currentTime=0),O(!1),c()},onPlaying:v,onLoadedData:y,onEnded:()=>{Q(!0),t===el&&(O(!0),$(!1)),document.pictureInPictureElement&&document.exitPictureInPicture()},onMouseEnter:ye=>{if(t!=el||u===Xf)return;const N=ye.target;u!==Xf&&N&&N.play().then(()=>{$(!1),O(!1)}).catch(re=>{const ne=Pc(re,{name:uN});rl(ne,Se=>(Se.setContext(Dc,ne),Se.setTag(Rc,t),Se.setTag(Cc,E),Se))})},onMouseLeave:ye=>{if(t!=el||u===Xf)return;const N=ye.target;u!==Xf&&N&&(N.pause(),O(!0))},width:"100%",height:"100%",poster:s,...L}),M&&ki.jsx(fN,{onClick:()=>{const ye=T.current;ye&&ye.play().then(()=>{O(!1),$(!0),se.firePlayStart()}).catch(N=>{if(N.name==="AbortError")O(!0);else{ie(N);const re=Pc(N,{name:GT});rl(re,ne=>(ne.setContext(Dc,re),ne.setTag(Rc,t),ne.setTag(Cc,E),ne))}})}})]})},mN=({message:a})=>ki.jsx("div",{className:"video-player-error",children:ki.jsx("p",{className:"video-player-error-message",children:a})});function VT(a,t){const r={eventName:a,movieName:t,url:window.location.href,abTest:"autoplay_testA"};j0().isMobile&&(r.abTest="video_autoplay_sp_B");const s=new CustomEvent("itemMovieEvent",{bubbles:!0,cancelable:!0,detail:r});Ns.debug(`[RatEventBridge] Sending event: type=${s.type}, detail=${JSON.stringify(s.detail)}`),document.dispatchEvent(s),window!==window.parent&&typeof window.parent.postMessage=="function"&&window.parent.postMessage(JSON.stringify(s.detail),"*")}const yN=({children:a,errorScreen:t})=>ki.jsx(XP,{fallback:()=>t,beforeCapture:r=>{r.setTransactionName(cN)},onError:r=>{},children:a}),vN=({options:a})=>{const{isValid:t,validateErrors:r}=(ce=>{let we={};const ze=ce.playerType;switch(ze){case vc:we=(xe=>{const Ce={};return xe.width&&typeof xe.width=="number"||(Ce.width="width is required and must be a number"),xe.height&&typeof xe.height=="number"||(Ce.height="height is required and must be a number"),xe.movieId&&typeof xe.movieId=="number"||(Ce.movieId="movieId is required and must be a number"),xe.shopId&&typeof xe.shopId!="number"&&(Ce.shopId="shopId must be a number"),xe.type&&typeof xe.type!="number"&&(Ce.type="type must be a number"),xe.selector&&typeof xe.selector!="string"&&(Ce.selector="selector must be a string"),Ce})(ce);break;case Bd:we=(xe=>{const Ce={};return xe.movieId&&typeof xe.movieId=="number"||(Ce.movieId="movieId is required and must be a number"),xe.shopId&&typeof xe.shopId!="number"&&(Ce.shopId="shopId must be a number"),xe.type&&typeof xe.type!="number"&&(Ce.type="type must be a number"),xe.selector&&typeof xe.selector!="string"&&(Ce.selector="selector must be a string"),Ce})(ce);break;case Hb:we=(xe=>{const Ce={};return xe.width&&typeof xe.width=="number"||(Ce.width="width is required and must be a number"),xe.height&&typeof xe.height=="number"||(Ce.height="height is required and must be a number"),xe.movieId&&typeof xe.movieId!="number"&&(Ce.movieId="movieId must be a number"),xe.userId&&typeof xe.userId!="number"&&(Ce.userId="userId must be a number"),xe.serviceId&&typeof xe.serviceId=="number"||(Ce.serviceId="serviceId is required and must be a number"),xe.refId&&typeof xe.refId=="string"||(Ce.refId="refId is required and must be a string"),xe.selector&&typeof xe.selector!="string"&&(Ce.selector="selector must be a string"),xe.autoPlay&&typeof xe.autoPlay!="number"&&(Ce.autoPlay="autoPlay must be a number"),xe.v&&typeof xe.v!="number"&&(Ce.v="v must be a number"),xe.control&&typeof xe.control!="number"&&(Ce.control="control must be a number"),Ce})(ce);break;case el:we=(xe=>{const Ce={};return xe.width&&typeof xe.width=="number"||(Ce.width="width is required and must be a number"),xe.height&&typeof xe.height=="number"||(Ce.height="height is required and must be a number"),xe.userId&&typeof xe.userId!="number"&&(Ce.userId="userId must be a number"),xe.serviceId&&typeof xe.serviceId=="number"||(Ce.serviceId="serviceId is required and must be a number"),xe.refId||xe.movieId?(xe.movieId&&typeof xe.movieId!="number"&&(Ce.movieId="movieId must be a number"),xe.refId&&typeof xe.refId!="string"&&(Ce.refId="refId must be a string")):Ce.refId="Either refId or movieId is required",xe.selector&&typeof xe.selector!="string"&&(Ce.selector="selector must be a string"),xe.autoPlay&&typeof xe.autoPlay!="number"&&(Ce.autoPlay="autoPlay must be a number"),xe.v&&typeof xe.v!="number"&&(Ce.v="v must be a number"),xe.control&&typeof xe.control!="number"&&(Ce.control="control must be a number"),Ce})(ce);break;default:throw new Error(`Unknown playerType: ${ze}`)}return{isValid:Object.keys(we).length===0,validateErrors:we}})(a),{playerType:s,width:u,height:f,control:c,type:v,movieId:y,serviceId:E}=a,{manifestData:A,manifestLoading:L,manifestError:T}=ED(a),[M,O]=nr.useState(!1),U=j0(),{playLogError:$}=(ce=>{const{playerType:we,type:ze,movieId:xe,referrerUrl:Ce,enabled:J}=ce,ue=["playlog",we,ze,xe,Ce],{data:de,error:W}=qw({queryKey:ue,queryFn:()=>SD({playerType:we,type:ze,movieId:xe,referrerUrl:Ce}),enabled:J,staleTime:1/0,retry:1});return{playLogData:de,playLogError:W}})({playerType:s,type:v,movieId:y,referrerUrl:window.location.href,enabled:M&&!!y&&!Hv.REVIEW.includes(E)&&!Hv.TRAVEL.includes(E)&&v!==yD}),z=nr.useCallback(()=>{O(!0)},[]),Q=s===vc&&v===sm,Z=s===vc&&v==Gb,ie=s===Bd&&v===Gb,se=nr.useCallback(ce=>{if(!ce)return;const we=ce.parentElement;v===sm&&(we.style.width=u?`${u}px`:"",we.style.height=f?`${f}px`:"")},[f,v,u]);if(!t)return Ns.error(r.message,Vb,{errors:r}),null;if(L)return null;$&&Ns.error($.message,bD,{error:$});const ye=ki.jsx(mN,{"data-player-type":"item",message:vD}),N=A.responseData.videoRatioHeight,re=A.responseData.videoRatioWidth,ne=v===sm?{width:"100%",height:"100%"}:{width:u?`${u}px`:"100%",height:f?`${f}px`:"100%",maxWidth:"100%",maxHeight:"100%",...(ce=>{if(s===Bd)return screen.width>768?{aspectRatio:"16 / 9"}:{"--aspect-ratio":ce,aspectRatio:"var(--aspect-ratio)"}})(((ce,we=3/4,ze=16/9)=>Math.max(Math.min(ce,ze),we))(re/N))};if(T||!A||A.responseStatus!=="success")return ki.jsx("div",{className:"video-player","data-books-type":Q,"data-item-type":Z,"data-shop-type":ie,ref:se,style:ne,children:ye});const Se=s===el&&U.isMobile&&U.osName!=="iPhone"?DL:pN;return ki.jsx("div",{className:"video-player","data-books-type":Q,"data-item-type":Z,"data-shop-type":ie,ref:se,style:ne,children:ki.jsx(yN,{errorScreen:ye,children:ki.jsx(gN,{manifestUri:(A==null?void 0:A.responseData.playbackUrl)||"",thumbnail:A==null?void 0:A.responseData.stillUrl,control:c,playerType:s,type:v,onPlayStarted:z,onPlay:()=>{VT("start",y)},onPlaying:()=>{VT("milestone",y)},onLoadeddata:()=>{VT("loadstart",y)},libraryProvider:Se,errorScreen:ye,playsInline:s===Bd||s===el,"webkit-playsinline":s===Bd||s===el})})})};function bN(){let a=null,t=null;const r=document.currentScript;if(r)a=r.src,t=r;else if({url:typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Cn&&Cn.tagName.toUpperCase()==="SCRIPT"&&Cn.src||new URL("assets/shaka-player-widget.umd.js",document.baseURI).href}!==void 0&&(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Cn&&Cn.tagName.toUpperCase()==="SCRIPT"&&Cn.src||new URL("assets/shaka-player-widget.umd.js",document.baseURI).href))a=typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:Cn&&Cn.tagName.toUpperCase()==="SCRIPT"&&Cn.src||new URL("assets/shaka-player-widget.umd.js",document.baseURI).href,t=Array.from(document.getElementsByTagName("script")).find(v=>v.src===a)||null;else{const v=document.getElementsByTagName("script");t=v[v.length-1],a=(t==null?void 0:t.getAttribute("src"))||null}if(!a||!t)return null;const s=new URL(a).searchParams,u=function(v){return/\/gate\/play\//.test(v)?vc:/\/gate\/play_pf/.test(v)?el:/\/gate\/play_sfp/.test(v)?Bd:/\/gate\/play_review/.test(v)?Hb:vc}(a),f=u,c={width:tl(s.get("w"))||0,height:tl(s.get("h"))||0,refId:s.get("ref_id")||null,movieId:tl(s.get("mid"))||0,serviceId:tl(s.get("sid"))||1100000001,userId:tl(s.get("urid")),selector:Vv(s.get("sel")),autoPlay:tl(s.get("a"))||null,v:tl(s.get("v")),control:tl(s.get("ctr"))||null,shopId:tl(s.get("shop_id"))||0,type:tl(s.get("type"))||Gb,playerType:f,mountingElements:EN(t,Vv(s.get("sel")))};return c.mountingElements?c:null}function PL(a){const t=document.createElement("div");return t.setAttribute("id",a),t}function EN(a,t){let r=[];if(!t){const u=PL(function(c="RVideoPF_"){return`${c}${new Date().getTime()}`}()),f=a.insertAdjacentElement("afterend",u);return r=f?[f]:[],r}const s=Vv(t).replace(/[.#]/g,"").replace(/%23/g,"");if(t.startsWith(".")){const u=document.getElementsByClassName(s);r=Array.from(u)}else{const u=document.getElementById(s)||PL(s);r=u?[u]:[]}return r}(function(a){const t={...a};var r,s;vk(t,"react"),r="react",s={version:nr.version},zd().setContext(r,s),WP(t)})({dsn:"https://0bd1df93400d322947d228c54e9d7f24@o1009122.ingest.us.sentry.io/4510343748648960",allowUrls:[/\/gate\/play(\/|$)/i,/\/gate\/play_pf(\/|$)/i,/\/gate\/play_sfp(\/|$)/i,/\/gate\/play_review(\/|$)/i],environment:"production",release:"videopf-widget@undefined",sendDefaultPii:!0,sampleRate:.25,beforeSend(a,t){const r=t==null?void 0:t.originalException;return(r instanceof Error?r.name:r==null?void 0:r.name)==="AbortError"?null:a},integrations:a=>{const t=new Set(["BrowserApiErrors","Breadcrumbs"]);return[...a.filter(r=>!t.has(r.name)),Fk({onerror:!0,onunhandledrejection:!0})]},ignoreErrors:[/The play\(\) request was interrupted by a call to pause\(\)\./i,/The play\(\) request was interrupted by a new load request\./i,"AbortError",/The user aborted a request\./i,/signal is aborted without reason/i,/^The operation was aborted\.?$/,"NS_ERROR_ABORT",/^Fetch is aborted\.?$/i]}),async function(){const a=bN();if(!a)return void Ns.warn("No valid player options found","InitializeApp");const{mountingElements:t,selector:r}=a,s=function(f){return f?"__player_mounted__"+Vv(f).replace(/[.#]/g,"").replace(/%23/g,""):null}(r);t.length>0&&s&&window[s]&&typeof window[s].root.unmount=="function"&&(window[s].root.unmount(),window[s]=void 0,delete window[s]);try{await async function(){}()}catch(f){Ns.error("Error during mocking setup",Vb,{error:f})}const u=new hD({defaultOptions:{queries:{staleTime:3e5,refetchOnWindowFocus:!1}}});if(t.length>0)for(const f of t){const c=rD.createRoot(f);s&&window[s]?window[s].root=c:s&&(window[s]={root:c}),Ns.info("Rendering application","InitializeApp",{playerOption:a}),c.render(ki.jsx(nr.StrictMode,{children:ki.jsx(pD,{client:u,children:ki.jsx(vN,{options:a})})}))}else Ns.warn("No mounting element found for player option","InitializeApp",{playerOption:a})}().catch(a=>{Ns.error("Failed to initialize application",Vb,{error:a})})});
//# sourceMappingURL=shaka-player-widget.umd.js.map
