@vkontakte/videoplayer-core 2.0.94-dev.bd326e8.0 → 2.0.94

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es2015.cjs.js CHANGED
@@ -1,9 +1,9 @@
1
1
  /**
2
- * @vkontakte/videoplayer-core v2.0.94-dev.bd326e8.0
3
- * Mon, 11 Dec 2023 13:21:34 GMT
2
+ * @vkontakte/videoplayer-core v2.0.94
3
+ * Mon, 11 Dec 2023 14:20:28 GMT
4
4
  * https://st.mycdn.me/static/vkontakte-videoplayer/2-0-94/doc/
5
5
  */
6
- "use strict";var Vu=Object.create;var Ya=Object.defineProperty;var Uu=Object.getOwnPropertyDescriptor;var ju=Object.getOwnPropertyNames;var Hu=Object.getPrototypeOf,Gu=Object.prototype.hasOwnProperty;var Yu=(i,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ju(e))!Gu.call(i,r)&&r!==t&&Ya(i,r,{get:()=>e[r],enumerable:!(s=Uu(e,r))||s.enumerable});return i};var qa=(i,e,t)=>(t=i!=null?Vu(Hu(i)):{},Yu(e||!i||!i.__esModule?Ya(t,"default",{value:i,enumerable:!0}):t,i));var a=require("@vkontakte/videoplayer-shared/es2015.cjs.js"),qu=require("lodash/debounce.js");const Vo="2.0.94-dev.bd326e8.0";exports.PlaybackState=void 0;(function(i){i.STOPPED="stopped",i.READY="ready",i.PLAYING="playing",i.PAUSED="paused"})(exports.PlaybackState||(exports.PlaybackState={}));exports.VideoFormat=void 0;(function(i){i.MPEG="MPEG",i.DASH="DASH",i.DASH_SEP="DASH_SEP",i.DASH_SEP_VK="DASH_SEP",i.DASH_WEBM="DASH_WEBM",i.DASH_WEBM_AV1="DASH_WEBM_AV1",i.DASH_WEBM_VK="DASH_WEBM",i.DASH_ONDEMAND="DASH_ONDEMAND",i.DASH_ONDEMAND_VK="DASH_ONDEMAND",i.DASH_LIVE="DASH_LIVE",i.DASH_LIVE_CMAF="DASH_LIVE_CMAF",i.DASH_LIVE_WEBM="DASH_LIVE_WEBM",i.HLS="HLS",i.HLS_ONDEMAND="HLS_ONDEMAND",i.HLS_JS="HLS",i.HLS_LIVE="HLS_LIVE",i.HLS_LIVE_CMAF="HLS_LIVE_CMAF",i.WEB_RTC_LIVE="WEB_RTC_LIVE"})(exports.VideoFormat||(exports.VideoFormat={}));var ue;(function(i){i.SCREEN="SCREEN",i.CHROMECAST="CHROMECAST"})(ue||(ue={}));exports.ChromecastState=void 0;(function(i){i.NOT_AVAILABLE="NOT_AVAILABLE",i.AVAILABLE="AVAILABLE",i.CONNECTING="CONNECTING",i.CONNECTED="CONNECTED"})(exports.ChromecastState||(exports.ChromecastState={}));exports.HttpConnectionType=void 0;(function(i){i.HTTP1="http1",i.HTTP2="http2",i.QUIC="quic"})(exports.HttpConnectionType||(exports.HttpConnectionType={}));var B;(function(i){i.None="none",i.Requested="requested",i.Applying="applying"})(B||(B={}));exports.Surface=void 0;(function(i){i.NONE="none",i.INLINE="inline",i.FULLSCREEN="fullscreen",i.SECOND_SCREEN="second_screen",i.PIP="pip"})(exports.Surface||(exports.Surface={}));function K(i,e,t,s){function r(n){return n instanceof t?n:new t(function(o){o(n)})}return new(t||(t=Promise))(function(n,o){function l(c){try{u(s.next(c))}catch(h){o(h)}}function d(c){try{u(s.throw(c))}catch(h){o(h)}}function u(c){c.done?n(c.value):r(c.value).then(l,d)}u((s=s.apply(i,e||[])).next())})}function R(i){return this instanceof R?(this.v=i,this):new R(i)}function be(i,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s=t.apply(i,e||[]),r,n=[];return r={},o("next"),o("throw"),o("return"),r[Symbol.asyncIterator]=function(){return this},r;function o(f){s[f]&&(r[f]=function(p){return new Promise(function(m,b){n.push([f,p,m,b])>1||l(f,p)})})}function l(f,p){try{d(s[f](p))}catch(m){h(n[0][3],m)}}function d(f){f.value instanceof R?Promise.resolve(f.value.v).then(u,c):h(n[0][2],f)}function u(f){l("next",f)}function c(f){l("throw",f)}function h(f,p){f(p),n.shift(),n.length&&l(n[0][0],n[0][1])}}var zu=i=>new Promise((e,t)=>{const s=document.createElement("script");s.setAttribute("src",i),s.onload=()=>e,s.onerror=()=>t,document.body.appendChild(s)});class Wu{constructor(e){var t;this.connection$=new a.ValueSubject(void 0),this.castState$=new a.ValueSubject(exports.ChromecastState.NOT_AVAILABLE),this.errorEvent$=new a.Subject,this.realCastState$=new a.ValueSubject(exports.ChromecastState.NOT_AVAILABLE),this.subscription=new a.Subscription,this.params=e,this.log=this.params.dependencies.logger.createComponentLog("ChromecastInitializer");const s="chrome"in window;if(this.log({message:`[constructor] receiverApplicationId: ${this.params.receiverApplicationId}, isDisabled: ${this.params.isDisabled}, isSupported: ${s}`}),e.isDisabled||!s)return;const r=a.isNonNullable((t=window.chrome)===null||t===void 0?void 0:t.cast),n=!!window.__onGCastApiAvailable;r?this.initializeCastApi():(window.__onGCastApiAvailable=o=>{delete window.__onGCastApiAvailable,o&&this.initializeCastApi()},n||zu("https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1").catch(()=>this.errorEvent$.next({id:"ChromecastLoading",category:a.ErrorCategory.NETWORK,message:"Script loading failed!"})))}connect(){var e;(e=cast.framework.CastContext.getInstance())===null||e===void 0||e.requestSession()}disconnect(){var e,t;(t=(e=cast.framework.CastContext.getInstance())===null||e===void 0?void 0:e.getCurrentSession())===null||t===void 0||t.endSession(!0)}stopMedia(){return new Promise((e,t)=>{var s,r,n;(n=(r=(s=cast.framework.CastContext.getInstance())===null||s===void 0?void 0:s.getCurrentSession())===null||r===void 0?void 0:r.getMediaSession())===null||n===void 0||n.stop(new chrome.cast.media.StopRequest,e,t)})}toggleConnection(){a.isNonNullable(this.connection$.getValue())?this.disconnect():this.connect()}setVolume(e){const t=this.connection$.getValue();a.isNullable(t)||(t.remotePlayer.volumeLevel=e,t.remotePlayerController.setVolumeLevel())}setMuted(e){const t=this.connection$.getValue();a.isNullable(t)||e!==t.remotePlayer.isMuted&&t.remotePlayerController.muteOrUnmute()}destroy(){this.subscription.unsubscribe()}initListeners(){const e=new cast.framework.RemotePlayer,t=new cast.framework.RemotePlayerController(e),s=cast.framework.CastContext.getInstance();this.subscription.add(a.fromEvent(s,cast.framework.CastContextEventType.SESSION_STATE_CHANGED).subscribe(r=>{var n,o;switch(r.sessionState){case cast.framework.SessionState.SESSION_STARTED:case cast.framework.SessionState.SESSION_STARTING:case cast.framework.SessionState.SESSION_RESUMED:this.contentId=(o=(n=s.getCurrentSession())===null||n===void 0?void 0:n.getMediaSession())===null||o===void 0?void 0:o.media.contentId;break;case cast.framework.SessionState.NO_SESSION:case cast.framework.SessionState.SESSION_ENDING:case cast.framework.SessionState.SESSION_ENDED:case cast.framework.SessionState.SESSION_START_FAILED:this.contentId=void 0;break;default:return a.assertNever(r.sessionState)}})).add(a.merge(a.fromEvent(s,cast.framework.CastContextEventType.CAST_STATE_CHANGED).pipe(a.tap(r=>{this.log({message:`[cast.framework.RemotePlayerEventType.CAST_STATE_CHANGED]: ${JSON.stringify(r)}`})}),a.map(r=>r.castState)),a.observableFrom([s.getCastState()])).pipe(a.filterChanged(),a.map(Qu),a.tap(r=>{this.log({message:`realCastState$: ${r}`})})).subscribe(this.realCastState$)).add(this.realCastState$.subscribe(r=>{var n;const o=r===exports.ChromecastState.CONNECTED,l=a.isNonNullable(this.connection$.getValue());if(o&&!l){const d=s.getCurrentSession();a.assertNonNullable(d);const u=d.getCastDevice(),c=(n=d.getMediaSession())===null||n===void 0?void 0:n.media.contentId;(a.isNullable(c)||c===this.contentId)&&(this.log({message:"connection created"}),this.connection$.next({remotePlayer:e,remotePlayerController:t,session:d,castDevice:u}))}else!o&&l&&(this.log({message:"connection destroyed"}),this.connection$.next(void 0));this.castState$.next(r===exports.ChromecastState.CONNECTED?a.isNonNullable(this.connection$.getValue())?exports.ChromecastState.CONNECTED:exports.ChromecastState.AVAILABLE:r)}))}initializeCastApi(){var e;let t,s,r;try{t=cast.framework.CastContext.getInstance(),s=chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,r=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED}catch(n){return}try{t.setOptions({receiverApplicationId:(e=this.params.receiverApplicationId)!==null&&e!==void 0?e:s,autoJoinPolicy:r}),this.initListeners()}catch(n){this.errorEvent$.next({id:"ChromecastInitializer",category:a.ErrorCategory.EXTERNAL_API,message:"[initializeCastApi] failed",thrown:n})}}}const Qu=i=>{switch(i){case cast.framework.CastState.NO_DEVICES_AVAILABLE:return exports.ChromecastState.NOT_AVAILABLE;case cast.framework.CastState.NOT_CONNECTED:return exports.ChromecastState.AVAILABLE;case cast.framework.CastState.CONNECTING:return exports.ChromecastState.CONNECTING;case cast.framework.CastState.CONNECTED:return exports.ChromecastState.CONNECTED;default:return a.assertNever(i)}};var Ms=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function cs(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var ke=function(i){try{return!!i()}catch(e){return!0}},Ku=ke,hs=!Ku(function(){var i=function(){}.bind();return typeof i!="function"||i.hasOwnProperty("prototype")}),Uo=hs,jo=Function.prototype,Lr=jo.call,Ju=Uo&&jo.bind.bind(Lr,Lr),Pe=Uo?Ju:function(i){return function(){return Lr.apply(i,arguments)}},Ho=Pe,Xu=Ho({}.toString),Zu=Ho("".slice),fi=function(i){return Zu(Xu(i),8,-1)},ed=Pe,td=ke,id=fi,Bs=Object,sd=ed("".split),rd=td(function(){return!Bs("z").propertyIsEnumerable(0)})?function(i){return id(i)=="String"?sd(i,""):Bs(i)}:Bs,pi=function(i){return i==null},ad=pi,nd=TypeError,na=function(i){if(ad(i))throw nd("Can't call method on "+i);return i},od=rd,ld=na,mi=function(i){return od(ld(i))},Ht={},Ri=function(i){return i&&i.Math==Math&&i},le=Ri(typeof globalThis=="object"&&globalThis)||Ri(typeof window=="object"&&window)||Ri(typeof self=="object"&&self)||Ri(typeof Ms=="object"&&Ms)||function(){return this}()||Ms||Function("return this")(),Or=typeof document=="object"&&document.all,ud=typeof Or=="undefined"&&Or!==void 0,Go={all:Or,IS_HTMLDDA:ud},Yo=Go,dd=Yo.all,ne=Yo.IS_HTMLDDA?function(i){return typeof i=="function"||i===dd}:function(i){return typeof i=="function"},cd=le,hd=ne,za=cd.WeakMap,fd=hd(za)&&/native code/.test(String(za)),Wa=ne,qo=Go,pd=qo.all,ze=qo.IS_HTMLDDA?function(i){return typeof i=="object"?i!==null:Wa(i)||i===pd}:function(i){return typeof i=="object"?i!==null:Wa(i)},md=ke,nt=!md(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),St={},vd=le,Qa=ze,Mr=vd.document,bd=Qa(Mr)&&Qa(Mr.createElement),oa=function(i){return bd?Mr.createElement(i):{}},Sd=nt,gd=ke,yd=oa,zo=!Sd&&!gd(function(){return Object.defineProperty(yd("div"),"a",{get:function(){return 7}}).a!=7}),Td=nt,Ed=ke,Wo=Td&&Ed(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),$d=ze,kd=String,Pd=TypeError,We=function(i){if($d(i))return i;throw Pd(kd(i)+" is not an object")},Ad=hs,Ci=Function.prototype.call,ge=Ad?Ci.bind(Ci):function(){return Ci.apply(Ci,arguments)},la={},Fs=la,Vs=le,_d=ne,Ka=function(i){return _d(i)?i:void 0},gt=function(i,e){return arguments.length<2?Ka(Fs[i])||Ka(Vs[i]):Fs[i]&&Fs[i][e]||Vs[i]&&Vs[i][e]},wd=Pe,fs=wd({}.isPrototypeOf),ps=typeof navigator!="undefined"&&String(navigator.userAgent)||"",Qo=le,Us=ps,Ja=Qo.process,Xa=Qo.Deno,Za=Ja&&Ja.versions||Xa&&Xa.version,en=Za&&Za.v8,we,is;en&&(we=en.split("."),is=we[0]>0&&we[0]<4?1:+(we[0]+we[1]));!is&&Us&&(we=Us.match(/Edge\/(\d+)/),(!we||we[1]>=74)&&(we=Us.match(/Chrome\/(\d+)/),we&&(is=+we[1])));var Ko=is,tn=Ko,Rd=ke,Cd=le,Dd=Cd.String,Jo=!!Object.getOwnPropertySymbols&&!Rd(function(){var i=Symbol();return!Dd(i)||!(Object(i)instanceof Symbol)||!Symbol.sham&&tn&&tn<41}),Id=Jo,Xo=Id&&!Symbol.sham&&typeof Symbol.iterator=="symbol",Nd=gt,xd=ne,Ld=fs,Od=Xo,Md=Object,Zo=Od?function(i){return typeof i=="symbol"}:function(i){var e=Nd("Symbol");return xd(e)&&Ld(e.prototype,Md(i))},Bd=String,ms=function(i){try{return Bd(i)}catch(e){return"Object"}},Fd=ne,Vd=ms,Ud=TypeError,yt=function(i){if(Fd(i))return i;throw Ud(Vd(i)+" is not a function")},jd=yt,Hd=pi,vs=function(i,e){var t=i[e];return Hd(t)?void 0:jd(t)},js=ge,Hs=ne,Gs=ze,Gd=TypeError,Yd=function(i,e){var t,s;if(e==="string"&&Hs(t=i.toString)&&!Gs(s=js(t,i))||Hs(t=i.valueOf)&&!Gs(s=js(t,i))||e!=="string"&&Hs(t=i.toString)&&!Gs(s=js(t,i)))return s;throw Gd("Can't convert object to primitive value")},el={exports:{}},qd=!0,sn=le,zd=Object.defineProperty,Wd=function(i,e){try{zd(sn,i,{value:e,configurable:!0,writable:!0})}catch(t){sn[i]=e}return e},Qd=le,Kd=Wd,rn="__core-js_shared__",Jd=Qd[rn]||Kd(rn,{}),ua=Jd,an=ua;(el.exports=function(i,e){return an[i]||(an[i]=e!==void 0?e:{})})("versions",[]).push({version:"3.31.0",mode:"pure",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.0/LICENSE",source:"https://github.com/zloirock/core-js"});var tl=el.exports,Xd=na,Zd=Object,bs=function(i){return Zd(Xd(i))},ec=Pe,tc=bs,ic=ec({}.hasOwnProperty),Fe=Object.hasOwn||function(e,t){return ic(tc(e),t)},sc=Pe,rc=0,ac=Math.random(),nc=sc(1 .toString),il=function(i){return"Symbol("+(i===void 0?"":i)+")_"+nc(++rc+ac,36)},oc=le,lc=tl,nn=Fe,uc=il,dc=Jo,cc=Xo,Nt=oc.Symbol,Ys=lc("wks"),hc=cc?Nt.for||Nt:Nt&&Nt.withoutSetter||uc,ce=function(i){return nn(Ys,i)||(Ys[i]=dc&&nn(Nt,i)?Nt[i]:hc("Symbol."+i)),Ys[i]},fc=ge,on=ze,ln=Zo,pc=vs,mc=Yd,vc=ce,bc=TypeError,Sc=vc("toPrimitive"),gc=function(i,e){if(!on(i)||ln(i))return i;var t=pc(i,Sc),s;if(t){if(e===void 0&&(e="default"),s=fc(t,i,e),!on(s)||ln(s))return s;throw bc("Can't convert object to primitive value")}return e===void 0&&(e="number"),mc(i,e)},yc=gc,Tc=Zo,da=function(i){var e=yc(i,"string");return Tc(e)?e:e+""},Ec=nt,$c=zo,kc=Wo,Di=We,un=da,Pc=TypeError,qs=Object.defineProperty,Ac=Object.getOwnPropertyDescriptor,zs="enumerable",Ws="configurable",Qs="writable";St.f=Ec?kc?function(e,t,s){if(Di(e),t=un(t),Di(s),typeof e=="function"&&t==="prototype"&&"value"in s&&Qs in s&&!s[Qs]){var r=Ac(e,t);r&&r[Qs]&&(e[t]=s.value,s={configurable:Ws in s?s[Ws]:r[Ws],enumerable:zs in s?s[zs]:r[zs],writable:!1})}return qs(e,t,s)}:qs:function(e,t,s){if(Di(e),t=un(t),Di(s),$c)try{return qs(e,t,s)}catch(r){}if("get"in s||"set"in s)throw Pc("Accessors not supported");return"value"in s&&(e[t]=s.value),e};var Ss=function(i,e){return{enumerable:!(i&1),configurable:!(i&2),writable:!(i&4),value:e}},_c=nt,wc=St,Rc=Ss,vi=_c?function(i,e,t){return wc.f(i,e,Rc(1,t))}:function(i,e,t){return i[e]=t,i},Cc=tl,Dc=il,dn=Cc("keys"),ca=function(i){return dn[i]||(dn[i]=Dc(i))},ha={},Ic=fd,sl=le,Nc=ze,xc=vi,Ks=Fe,Js=ua,Lc=ca,Oc=ha,cn="Object already initialized",Br=sl.TypeError,Mc=sl.WeakMap,ss,ui,rs,Bc=function(i){return rs(i)?ui(i):ss(i,{})},Fc=function(i){return function(e){var t;if(!Nc(e)||(t=ui(e)).type!==i)throw Br("Incompatible receiver, "+i+" required");return t}};if(Ic||Js.state){var Ne=Js.state||(Js.state=new Mc);Ne.get=Ne.get,Ne.has=Ne.has,Ne.set=Ne.set,ss=function(i,e){if(Ne.has(i))throw Br(cn);return e.facade=i,Ne.set(i,e),e},ui=function(i){return Ne.get(i)||{}},rs=function(i){return Ne.has(i)}}else{var _t=Lc("state");Oc[_t]=!0,ss=function(i,e){if(Ks(i,_t))throw Br(cn);return e.facade=i,xc(i,_t,e),e},ui=function(i){return Ks(i,_t)?i[_t]:{}},rs=function(i){return Ks(i,_t)}}var rl={set:ss,get:ui,has:rs,enforce:Bc,getterFor:Fc},Vc=hs,al=Function.prototype,hn=al.apply,fn=al.call,nl=typeof Reflect=="object"&&Reflect.apply||(Vc?fn.bind(hn):function(){return fn.apply(hn,arguments)}),Uc=fi,jc=Pe,ol=function(i){if(Uc(i)==="Function")return jc(i)},fa={},ll={},ul={}.propertyIsEnumerable,dl=Object.getOwnPropertyDescriptor,Hc=dl&&!ul.call({1:2},1);ll.f=Hc?function(e){var t=dl(this,e);return!!t&&t.enumerable}:ul;var Gc=nt,Yc=ge,qc=ll,zc=Ss,Wc=mi,Qc=da,Kc=Fe,Jc=zo,pn=Object.getOwnPropertyDescriptor;fa.f=Gc?pn:function(e,t){if(e=Wc(e),t=Qc(t),Jc)try{return pn(e,t)}catch(s){}if(Kc(e,t))return zc(!Yc(qc.f,e,t),e[t])};var Xc=ke,Zc=ne,eh=/#|\.prototype\./,bi=function(i,e){var t=ih[th(i)];return t==rh?!0:t==sh?!1:Zc(e)?Xc(e):!!e},th=bi.normalize=function(i){return String(i).replace(eh,".").toLowerCase()},ih=bi.data={},sh=bi.NATIVE="N",rh=bi.POLYFILL="P",cl=bi,mn=ol,ah=yt,nh=hs,oh=mn(mn.bind),gs=function(i,e){return ah(i),e===void 0?i:nh?oh(i,e):function(){return i.apply(e,arguments)}},Ii=le,lh=nl,uh=ol,dh=ne,ch=fa.f,hh=cl,wt=la,fh=gs,Rt=vi,vn=Fe,ph=function(i){var e=function(t,s,r){if(this instanceof e){switch(arguments.length){case 0:return new i;case 1:return new i(t);case 2:return new i(t,s)}return new i(t,s,r)}return lh(i,this,arguments)};return e.prototype=i.prototype,e},De=function(i,e){var t=i.target,s=i.global,r=i.stat,n=i.proto,o=s?Ii:r?Ii[t]:(Ii[t]||{}).prototype,l=s?wt:wt[t]||Rt(wt,t,{})[t],d=l.prototype,u,c,h,f,p,m,b,g,E;for(f in e)u=hh(s?f:t+(r?".":"#")+f,i.forced),c=!u&&o&&vn(o,f),m=l[f],c&&(i.dontCallGetSet?(E=ch(o,f),b=E&&E.value):b=o[f]),p=c&&b?b:e[f],!(c&&typeof m==typeof p)&&(i.bind&&c?g=fh(p,Ii):i.wrap&&c?g=ph(p):n&&dh(p)?g=uh(p):g=p,(i.sham||p&&p.sham||m&&m.sham)&&Rt(g,"sham",!0),Rt(l,f,g),n&&(h=t+"Prototype",vn(wt,h)||Rt(wt,h,{}),Rt(wt[h],f,p),i.real&&d&&(u||!d[f])&&Rt(d,f,p)))},Fr=nt,mh=Fe,hl=Function.prototype,vh=Fr&&Object.getOwnPropertyDescriptor,pa=mh(hl,"name"),bh=pa&&function(){}.name==="something",Sh=pa&&(!Fr||Fr&&vh(hl,"name").configurable),gh={EXISTS:pa,PROPER:bh,CONFIGURABLE:Sh},fl={},yh=Math.ceil,Th=Math.floor,Eh=Math.trunc||function(e){var t=+e;return(t>0?Th:yh)(t)},$h=Eh,ma=function(i){var e=+i;return e!==e||e===0?0:$h(e)},kh=ma,Ph=Math.max,Ah=Math.min,_h=function(i,e){var t=kh(i);return t<0?Ph(t+e,0):Ah(t,e)},wh=ma,Rh=Math.min,Ch=function(i){return i>0?Rh(wh(i),9007199254740991):0},Dh=Ch,va=function(i){return Dh(i.length)},Ih=mi,Nh=_h,xh=va,bn=function(i){return function(e,t,s){var r=Ih(e),n=xh(r),o=Nh(s,n),l;if(i&&t!=t){for(;n>o;)if(l=r[o++],l!=l)return!0}else for(;n>o;o++)if((i||o in r)&&r[o]===t)return i||o||0;return!i&&-1}},Lh={includes:bn(!0),indexOf:bn(!1)},Oh=Pe,Xs=Fe,Mh=mi,Bh=Lh.indexOf,Fh=ha,Sn=Oh([].push),Vh=function(i,e){var t=Mh(i),s=0,r=[],n;for(n in t)!Xs(Fh,n)&&Xs(t,n)&&Sn(r,n);for(;e.length>s;)Xs(t,n=e[s++])&&(~Bh(r,n)||Sn(r,n));return r},pl=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Uh=Vh,jh=pl,Hh=Object.keys||function(e){return Uh(e,jh)},Gh=nt,Yh=Wo,qh=St,zh=We,Wh=mi,Qh=Hh;fl.f=Gh&&!Yh?Object.defineProperties:function(e,t){zh(e);for(var s=Wh(t),r=Qh(t),n=r.length,o=0,l;n>o;)qh.f(e,l=r[o++],s[l]);return e};var Kh=gt,ml=Kh("document","documentElement"),Jh=We,Xh=fl,gn=pl,Zh=ha,ef=ml,tf=oa,sf=ca,yn=">",Tn="<",Vr="prototype",Ur="script",vl=sf("IE_PROTO"),Zs=function(){},bl=function(i){return Tn+Ur+yn+i+Tn+"/"+Ur+yn},En=function(i){i.write(bl("")),i.close();var e=i.parentWindow.Object;return i=null,e},rf=function(){var i=tf("iframe"),e="java"+Ur+":",t;return i.style.display="none",ef.appendChild(i),i.src=String(e),t=i.contentWindow.document,t.open(),t.write(bl("document.F=Object")),t.close(),t.F},Ni,Xi=function(){try{Ni=new ActiveXObject("htmlfile")}catch(e){}Xi=typeof document!="undefined"?document.domain&&Ni?En(Ni):rf():En(Ni);for(var i=gn.length;i--;)delete Xi[Vr][gn[i]];return Xi()};Zh[vl]=!0;var Sl=Object.create||function(e,t){var s;return e!==null?(Zs[Vr]=Jh(e),s=new Zs,Zs[Vr]=null,s[vl]=e):s=Xi(),t===void 0?s:Xh.f(s,t)},af=ke,nf=!af(function(){function i(){}return i.prototype.constructor=null,Object.getPrototypeOf(new i)!==i.prototype}),of=Fe,lf=ne,uf=bs,df=ca,cf=nf,$n=df("IE_PROTO"),jr=Object,hf=jr.prototype,gl=cf?jr.getPrototypeOf:function(i){var e=uf(i);if(of(e,$n))return e[$n];var t=e.constructor;return lf(t)&&e instanceof t?t.prototype:e instanceof jr?hf:null},ff=vi,ba=function(i,e,t,s){return s&&s.enumerable?i[e]=t:ff(i,e,t),i},pf=ke,mf=ne,vf=ze,bf=Sl,kn=gl,Sf=ba,gf=ce,Hr=gf("iterator"),yl=!1,Ge,er,tr;[].keys&&(tr=[].keys(),"next"in tr?(er=kn(kn(tr)),er!==Object.prototype&&(Ge=er)):yl=!0);var yf=!vf(Ge)||pf(function(){var i={};return Ge[Hr].call(i)!==i});yf?Ge={}:Ge=bf(Ge);mf(Ge[Hr])||Sf(Ge,Hr,function(){return this});var Tl={IteratorPrototype:Ge,BUGGY_SAFARI_ITERATORS:yl},Tf=ce,Ef=Tf("toStringTag"),El={};El[Ef]="z";var Sa=String(El)==="[object z]",$f=Sa,kf=ne,Zi=fi,Pf=ce,Af=Pf("toStringTag"),_f=Object,wf=Zi(function(){return arguments}())=="Arguments",Rf=function(i,e){try{return i[e]}catch(t){}},Si=$f?Zi:function(i){var e,t,s;return i===void 0?"Undefined":i===null?"Null":typeof(t=Rf(e=_f(i),Af))=="string"?t:wf?Zi(e):(s=Zi(e))=="Object"&&kf(e.callee)?"Arguments":s},Cf=Sa,Df=Si,If=Cf?{}.toString:function(){return"[object "+Df(this)+"]"},Nf=Sa,xf=St.f,Lf=vi,Of=Fe,Mf=If,Bf=ce,Pn=Bf("toStringTag"),ga=function(i,e,t,s){if(i){var r=t?i:i.prototype;Of(r,Pn)||xf(r,Pn,{configurable:!0,value:e}),s&&!Nf&&Lf(r,"toString",Mf)}},Ff=Tl.IteratorPrototype,Vf=Sl,Uf=Ss,jf=ga,Hf=Ht,Gf=function(){return this},Yf=function(i,e,t,s){var r=e+" Iterator";return i.prototype=Vf(Ff,{next:Uf(+!s,t)}),jf(i,r,!1,!0),Hf[r]=Gf,i},qf=De,zf=ge,$l=gh,Wf=Yf,Qf=gl,Kf=ga,An=ba,Jf=ce,_n=Ht,kl=Tl,Xf=$l.PROPER;$l.CONFIGURABLE;kl.IteratorPrototype;var xi=kl.BUGGY_SAFARI_ITERATORS,ir=Jf("iterator"),wn="keys",Li="values",Rn="entries",Zf=function(){return this},ep=function(i,e,t,s,r,n,o){Wf(t,e,s);var l=function(E){if(E===r&&f)return f;if(!xi&&E in c)return c[E];switch(E){case wn:return function(){return new t(this,E)};case Li:return function(){return new t(this,E)};case Rn:return function(){return new t(this,E)}}return function(){return new t(this)}},d=e+" Iterator",u=!1,c=i.prototype,h=c[ir]||c["@@iterator"]||r&&c[r],f=!xi&&h||l(r),p=e=="Array"&&c.entries||h,m,b,g;if(p&&(m=Qf(p.call(new i)),m!==Object.prototype&&m.next&&(Kf(m,d,!0,!0),_n[d]=Zf)),Xf&&r==Li&&h&&h.name!==Li&&(u=!0,f=function(){return zf(h,this)}),r)if(b={values:l(Li),keys:n?f:l(wn),entries:l(Rn)},o)for(g in b)(xi||u||!(g in c))&&An(c,g,b[g]);else qf({target:e,proto:!0,forced:xi||u},b);return o&&c[ir]!==f&&An(c,ir,f,{name:r}),_n[e]=f,b},tp=function(i,e){return{value:i,done:e}},ip=mi,Cn=Ht,Pl=rl;St.f;var sp=ep,Oi=tp,Al="Array Iterator",rp=Pl.set,ap=Pl.getterFor(Al);sp(Array,"Array",function(i,e){rp(this,{type:Al,target:ip(i),index:0,kind:e})},function(){var i=ap(this),e=i.target,t=i.kind,s=i.index++;return!e||s>=e.length?(i.target=void 0,Oi(void 0,!0)):t=="keys"?Oi(s,!1):t=="values"?Oi(e[s],!1):Oi([s,e[s]],!1)},"values");Cn.Arguments=Cn.Array;var np=ce,op=Ht,lp=np("iterator"),up=Array.prototype,dp=function(i){return i!==void 0&&(op.Array===i||up[lp]===i)},cp=Si,Dn=vs,hp=pi,fp=Ht,pp=ce,mp=pp("iterator"),_l=function(i){if(!hp(i))return Dn(i,mp)||Dn(i,"@@iterator")||fp[cp(i)]},vp=ge,bp=yt,Sp=We,gp=ms,yp=_l,Tp=TypeError,Ep=function(i,e){var t=arguments.length<2?yp(i):e;if(bp(t))return Sp(vp(t,i));throw Tp(gp(i)+" is not iterable")},$p=ge,In=We,kp=vs,Pp=function(i,e,t){var s,r;In(i);try{if(s=kp(i,"return"),!s){if(e==="throw")throw t;return t}s=$p(s,i)}catch(n){r=!0,s=n}if(e==="throw")throw t;if(r)throw s;return In(s),t},Ap=gs,_p=ge,wp=We,Rp=ms,Cp=dp,Dp=va,Nn=fs,Ip=Ep,Np=_l,xn=Pp,xp=TypeError,es=function(i,e){this.stopped=i,this.result=e},Ln=es.prototype,ya=function(i,e,t){var s=t&&t.that,r=!!(t&&t.AS_ENTRIES),n=!!(t&&t.IS_RECORD),o=!!(t&&t.IS_ITERATOR),l=!!(t&&t.INTERRUPTED),d=Ap(e,s),u,c,h,f,p,m,b,g=function(y){return u&&xn(u,"normal",y),new es(!0,y)},E=function(y){return r?(wp(y),l?d(y[0],y[1],g):d(y[0],y[1])):l?d(y,g):d(y)};if(n)u=i.iterator;else if(o)u=i;else{if(c=Np(i),!c)throw xp(Rp(i)+" is not iterable");if(Cp(c)){for(h=0,f=Dp(i);f>h;h++)if(p=E(i[h]),p&&Nn(Ln,p))return p;return new es(!1)}u=Ip(i,c)}for(m=n?i.next:u.next;!(b=_p(m,u)).done;){try{p=E(b.value)}catch(y){xn(u,"throw",y)}if(typeof p=="object"&&p&&Nn(Ln,p))return p}return new es(!1)},Lp=da,Op=St,Mp=Ss,Bp=function(i,e,t){var s=Lp(e);s in i?Op.f(i,s,Mp(0,t)):i[s]=t},Fp=De,Vp=ya,Up=Bp;Fp({target:"Object",stat:!0},{fromEntries:function(e){var t={};return Vp(e,function(s,r){Up(t,s,r)},{AS_ENTRIES:!0}),t}});var jp=la,Hp=jp.Object.fromEntries,Gp={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Yp=Gp,qp=le,zp=Si,Wp=vi,On=Ht,Qp=ce,Mn=Qp("toStringTag");for(var sr in Yp){var Bn=qp[sr],rr=Bn&&Bn.prototype;rr&&zp(rr)!==Mn&&Wp(rr,Mn,sr),On[sr]=On.Array}var Kp=Hp,Jp=Kp,Xp=Jp,Zp=Xp,Ft=cs(Zp),em=fi,ys=typeof process!="undefined"&&em(process)=="process",tm=St,im=function(i,e,t){return tm.f(i,e,t)},sm=gt,rm=im,am=ce,nm=nt,Fn=am("species"),om=function(i){var e=sm(i);nm&&e&&!e[Fn]&&rm(e,Fn,{configurable:!0,get:function(){return this}})},lm=fs,um=TypeError,dm=function(i,e){if(lm(e,i))return i;throw um("Incorrect invocation")},cm=Pe,hm=ne,Gr=ua,fm=cm(Function.toString);hm(Gr.inspectSource)||(Gr.inspectSource=function(i){return fm(i)});var wl=Gr.inspectSource,pm=Pe,mm=ke,Rl=ne,vm=Si,bm=gt,Sm=wl,Cl=function(){},gm=[],Dl=bm("Reflect","construct"),Ta=/^\s*(?:class|function)\b/,ym=pm(Ta.exec),Tm=!Ta.exec(Cl),ei=function(e){if(!Rl(e))return!1;try{return Dl(Cl,gm,e),!0}catch(t){return!1}},Il=function(e){if(!Rl(e))return!1;switch(vm(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Tm||!!ym(Ta,Sm(e))}catch(t){return!0}};Il.sham=!0;var Em=!Dl||mm(function(){var i;return ei(ei.call)||!ei(Object)||!ei(function(){i=!0})||i})?Il:ei,$m=Em,km=ms,Pm=TypeError,Am=function(i){if($m(i))return i;throw Pm(km(i)+" is not a constructor")},Vn=We,_m=Am,wm=pi,Rm=ce,Cm=Rm("species"),Nl=function(i,e){var t=Vn(i).constructor,s;return t===void 0||wm(s=Vn(t)[Cm])?e:_m(s)},Dm=Pe,Im=Dm([].slice),Nm=TypeError,xm=function(i,e){if(i<e)throw Nm("Not enough arguments");return i},Lm=ps,xl=/(?:ipad|iphone|ipod).*applewebkit/i.test(Lm),Se=le,Om=nl,Mm=gs,Un=ne,Bm=Fe,Ll=ke,jn=ml,Fm=Im,Hn=oa,Vm=xm,Um=xl,jm=ys,Yr=Se.setImmediate,qr=Se.clearImmediate,Hm=Se.process,ar=Se.Dispatch,Gm=Se.Function,Gn=Se.MessageChannel,Ym=Se.String,nr=0,ni={},Yn="onreadystatechange",di,ft,or,lr;Ll(function(){di=Se.location});var Ea=function(i){if(Bm(ni,i)){var e=ni[i];delete ni[i],e()}},ur=function(i){return function(){Ea(i)}},qn=function(i){Ea(i.data)},zn=function(i){Se.postMessage(Ym(i),di.protocol+"//"+di.host)};(!Yr||!qr)&&(Yr=function(e){Vm(arguments.length,1);var t=Un(e)?e:Gm(e),s=Fm(arguments,1);return ni[++nr]=function(){Om(t,void 0,s)},ft(nr),nr},qr=function(e){delete ni[e]},jm?ft=function(i){Hm.nextTick(ur(i))}:ar&&ar.now?ft=function(i){ar.now(ur(i))}:Gn&&!Um?(or=new Gn,lr=or.port2,or.port1.onmessage=qn,ft=Mm(lr.postMessage,lr)):Se.addEventListener&&Un(Se.postMessage)&&!Se.importScripts&&di&&di.protocol!=="file:"&&!Ll(zn)?(ft=zn,Se.addEventListener("message",qn,!1)):Yn in Hn("script")?ft=function(i){jn.appendChild(Hn("script"))[Yn]=function(){jn.removeChild(this),Ea(i)}}:ft=function(i){setTimeout(ur(i),0)});var Ol={set:Yr,clear:qr},Ml=function(){this.head=null,this.tail=null};Ml.prototype={add:function(i){var e={item:i,next:null},t=this.tail;t?t.next=e:this.head=e,this.tail=e},get:function(){var i=this.head;if(i){var e=this.head=i.next;return e===null&&(this.tail=null),i.item}}};var Bl=Ml,qm=ps,zm=/ipad|iphone|ipod/i.test(qm)&&typeof Pebble!="undefined",Wm=ps,Qm=/web0s(?!.*chrome)/i.test(Wm),bt=le,Wn=gs,Km=fa.f,dr=Ol.set,Jm=Bl,Xm=xl,Zm=zm,ev=Qm,cr=ys,Qn=bt.MutationObserver||bt.WebKitMutationObserver,Kn=bt.document,Jn=bt.process,Mi=bt.Promise,Xn=Km(bt,"queueMicrotask"),zr=Xn&&Xn.value,Ct,hr,fr,Bi,Zn;if(!zr){var Fi=new Jm,Vi=function(){var i,e;for(cr&&(i=Jn.domain)&&i.exit();e=Fi.get();)try{e()}catch(t){throw Fi.head&&Ct(),t}i&&i.enter()};!Xm&&!cr&&!ev&&Qn&&Kn?(hr=!0,fr=Kn.createTextNode(""),new Qn(Vi).observe(fr,{characterData:!0}),Ct=function(){fr.data=hr=!hr}):!Zm&&Mi&&Mi.resolve?(Bi=Mi.resolve(void 0),Bi.constructor=Mi,Zn=Wn(Bi.then,Bi),Ct=function(){Zn(Vi)}):cr?Ct=function(){Jn.nextTick(Vi)}:(dr=Wn(dr,bt),Ct=function(){dr(Vi)}),zr=function(i){Fi.head||Ct(),Fi.add(i)}}var tv=zr,iv=function(i,e){try{arguments.length==1?console.error(i):console.error(i,e)}catch(t){}},$a=function(i){try{return{error:!1,value:i()}}catch(e){return{error:!0,value:e}}},sv=le,Gt=sv.Promise,Fl=typeof Deno=="object"&&Deno&&typeof Deno.version=="object",rv=Fl,av=ys,nv=!rv&&!av&&typeof window=="object"&&typeof document=="object",ov=le,oi=Gt,lv=ne,uv=cl,dv=wl,cv=ce,hv=nv,fv=Fl,pr=Ko,eo=oi&&oi.prototype,pv=cv("species"),Wr=!1,Vl=lv(ov.PromiseRejectionEvent),mv=uv("Promise",function(){var i=dv(oi),e=i!==String(oi);if(!e&&pr===66||!(eo.catch&&eo.finally))return!0;if(!pr||pr<51||!/native code/.test(i)){var t=new oi(function(n){n(1)}),s=function(n){n(function(){},function(){})},r=t.constructor={};if(r[pv]=s,Wr=t.then(function(){})instanceof s,!Wr)return!0}return!e&&(hv||fv)&&!Vl}),gi={CONSTRUCTOR:mv,REJECTION_EVENT:Vl,SUBCLASSING:Wr},Yt={},to=yt,vv=TypeError,bv=function(i){var e,t;this.promise=new i(function(s,r){if(e!==void 0||t!==void 0)throw vv("Bad Promise constructor");e=s,t=r}),this.resolve=to(e),this.reject=to(t)};Yt.f=function(i){return new bv(i)};var Sv=De,as=ys,at=le,yi=ge,gv=ba,yv=ga,Tv=om,Ev=yt,Qr=ne,$v=ze,kv=dm,Pv=Nl,Ul=Ol.set,ka=tv,Av=iv,_v=$a,wv=Bl,jl=rl,Kr=Gt,Pa=gi,Hl=Yt,Ts="Promise",Gl=Pa.CONSTRUCTOR,Rv=Pa.REJECTION_EVENT;Pa.SUBCLASSING;var mr=jl.getterFor(Ts),Cv=jl.set,Dv=Kr&&Kr.prototype,xt=Kr,vr=Dv,Yl=at.TypeError,Jr=at.document,Aa=at.process,Xr=Hl.f,Iv=Xr,Nv=!!(Jr&&Jr.createEvent&&at.dispatchEvent),ql="unhandledrejection",xv="rejectionhandled",io=0,zl=1,Lv=2,_a=1,Wl=2,Ui,so,Ov,Ql=function(i){var e;return $v(i)&&Qr(e=i.then)?e:!1},Kl=function(i,e){var t=e.value,s=e.state==zl,r=s?i.ok:i.fail,n=i.resolve,o=i.reject,l=i.domain,d,u,c;try{r?(s||(e.rejection===Wl&&Bv(e),e.rejection=_a),r===!0?d=t:(l&&l.enter(),d=r(t),l&&(l.exit(),c=!0)),d===i.promise?o(Yl("Promise-chain cycle")):(u=Ql(d))?yi(u,d,n,o):n(d)):o(t)}catch(h){l&&!c&&l.exit(),o(h)}},Jl=function(i,e){i.notified||(i.notified=!0,ka(function(){for(var t=i.reactions,s;s=t.get();)Kl(s,i);i.notified=!1,e&&!i.rejection&&Mv(i)}))},Xl=function(i,e,t){var s,r;Nv?(s=Jr.createEvent("Event"),s.promise=e,s.reason=t,s.initEvent(i,!1,!0),at.dispatchEvent(s)):s={promise:e,reason:t},!Rv&&(r=at["on"+i])?r(s):i===ql&&Av("Unhandled promise rejection",t)},Mv=function(i){yi(Ul,at,function(){var e=i.facade,t=i.value,s=ro(i),r;if(s&&(r=_v(function(){as?Aa.emit("unhandledRejection",t,e):Xl(ql,e,t)}),i.rejection=as||ro(i)?Wl:_a,r.error))throw r.value})},ro=function(i){return i.rejection!==_a&&!i.parent},Bv=function(i){yi(Ul,at,function(){var e=i.facade;as?Aa.emit("rejectionHandled",e):Xl(xv,e,i.value)})},Lt=function(i,e,t){return function(s){i(e,s,t)}},Mt=function(i,e,t){i.done||(i.done=!0,t&&(i=t),i.value=e,i.state=Lv,Jl(i,!0))},Zr=function(i,e,t){if(!i.done){i.done=!0,t&&(i=t);try{if(i.facade===e)throw Yl("Promise can't be resolved itself");var s=Ql(e);s?ka(function(){var r={done:!1};try{yi(s,e,Lt(Zr,r,i),Lt(Mt,r,i))}catch(n){Mt(r,n,i)}}):(i.value=e,i.state=zl,Jl(i,!1))}catch(r){Mt({done:!1},r,i)}}};Gl&&(xt=function(e){kv(this,vr),Ev(e),yi(Ui,this);var t=mr(this);try{e(Lt(Zr,t),Lt(Mt,t))}catch(s){Mt(t,s)}},vr=xt.prototype,Ui=function(e){Cv(this,{type:Ts,done:!1,notified:!1,parent:!1,reactions:new wv,rejection:!1,state:io,value:void 0})},Ui.prototype=gv(vr,"then",function(e,t){var s=mr(this),r=Xr(Pv(this,xt));return s.parent=!0,r.ok=Qr(e)?e:!0,r.fail=Qr(t)&&t,r.domain=as?Aa.domain:void 0,s.state==io?s.reactions.add(r):ka(function(){Kl(r,s)}),r.promise}),so=function(){var i=new Ui,e=mr(i);this.promise=i,this.resolve=Lt(Zr,e),this.reject=Lt(Mt,e)},Hl.f=Xr=function(i){return i===xt||i===Ov?new so(i):Iv(i)});Sv({global:!0,constructor:!0,wrap:!0,forced:Gl},{Promise:xt});yv(xt,Ts,!1,!0);Tv(Ts);var Fv=ce,Zl=Fv("iterator"),eu=!1;try{var Vv=0,ao={next:function(){return{done:!!Vv++}},return:function(){eu=!0}};ao[Zl]=function(){return this},Array.from(ao,function(){throw 2})}catch(i){}var Uv=function(i,e){if(!e&&!eu)return!1;var t=!1;try{var s={};s[Zl]=function(){return{next:function(){return{done:t=!0}}}},i(s)}catch(r){}return t},jv=Gt,Hv=Uv,Gv=gi.CONSTRUCTOR,tu=Gv||!Hv(function(i){jv.all(i).then(void 0,function(){})}),Yv=De,qv=ge,zv=yt,Wv=Yt,Qv=$a,Kv=ya,Jv=tu;Yv({target:"Promise",stat:!0,forced:Jv},{all:function(e){var t=this,s=Wv.f(t),r=s.resolve,n=s.reject,o=Qv(function(){var l=zv(t.resolve),d=[],u=0,c=1;Kv(e,function(h){var f=u++,p=!1;c++,qv(l,t,h).then(function(m){p||(p=!0,d[f]=m,--c||r(d))},n)}),--c||r(d)});return o.error&&n(o.value),s.promise}});var Xv=De,Zv=gi.CONSTRUCTOR,no=Gt;no&&no.prototype;Xv({target:"Promise",proto:!0,forced:Zv,real:!0},{catch:function(i){return this.then(void 0,i)}});var eb=De,tb=ge,ib=yt,sb=Yt,rb=$a,ab=ya,nb=tu;eb({target:"Promise",stat:!0,forced:nb},{race:function(e){var t=this,s=sb.f(t),r=s.reject,n=rb(function(){var o=ib(t.resolve);ab(e,function(l){tb(o,t,l).then(s.resolve,r)})});return n.error&&r(n.value),s.promise}});var ob=De,lb=ge,ub=Yt,db=gi.CONSTRUCTOR;ob({target:"Promise",stat:!0,forced:db},{reject:function(e){var t=ub.f(this);return lb(t.reject,void 0,e),t.promise}});var cb=We,hb=ze,fb=Yt,iu=function(i,e){if(cb(i),hb(e)&&e.constructor===i)return e;var t=fb.f(i),s=t.resolve;return s(e),t.promise},pb=De,mb=gt,vb=qd,bb=Gt,Sb=gi.CONSTRUCTOR,gb=iu,yb=mb("Promise"),Tb=!Sb;pb({target:"Promise",stat:!0,forced:vb},{resolve:function(e){return gb(Tb&&this===yb?bb:this,e)}});var Eb=De,ea=Gt,$b=ke,kb=gt,Pb=ne,Ab=Nl,oo=iu,_b=ea&&ea.prototype,wb=!!ea&&$b(function(){_b.finally.call({then:function(){}},function(){})});Eb({target:"Promise",proto:!0,real:!0,forced:wb},{finally:function(i){var e=Ab(this,kb("Promise")),t=Pb(i);return this.then(t?function(s){return oo(e,i()).then(function(){return s})}:i,t?function(s){return oo(e,i()).then(function(){throw s})}:i)}});var Rb=gt,wa=Rb,Cb=wa,Db=Cb("Promise","finally"),Ib=Db,Nb=Ib,xb=Nb,Lb=xb,Es=cs(Lb),ae;(function(i){i[i.OFFSET_P=0]="OFFSET_P",i[i.PLAYBACK_SHIFT=1]="PLAYBACK_SHIFT",i[i.DASH_CMAF_OFFSET_P=2]="DASH_CMAF_OFFSET_P"})(ae||(ae={}));var Re=(i,e=0,t=ae.OFFSET_P)=>{switch(t){case ae.OFFSET_P:return i.replace("_offset_p",e===0?"":"_"+e.toFixed(0));case ae.PLAYBACK_SHIFT:{if(e===0)return i;const s=new URL(i);return s.searchParams.append("playback_shift",e.toFixed(0)),s.toString()}case ae.DASH_CMAF_OFFSET_P:{if(e===0)return i;const s=new URL(i);return s.searchParams.set("offset_p",e.toFixed(0)),s.toString()}default:a.assertNever(t)}return i};const lo=(i,e)=>{var t;switch(e){case ae.OFFSET_P:return NaN;case ae.PLAYBACK_SHIFT:{const s=new URL(i);return Number(s.searchParams.get("playback_shift"))}case ae.DASH_CMAF_OFFSET_P:{const s=new URL(i);return Number((t=s.searchParams.get("offset_p"))!==null&&t!==void 0?t:0)}default:a.assertNever(e)}};var P=(i,e,t=!1)=>{const s=i.getTransition();(t||!s||s.to===e)&&i.setState(e)};class X{constructor(e){this.transitionStarted$=new a.Subject,this.transitionEnded$=new a.Subject,this.transitionUpdated$=new a.Subject,this.forceChanged$=new a.Subject,this.stateChangeStarted$=a.merge(this.transitionStarted$,this.transitionUpdated$),this.stateChangeEnded$=a.merge(this.transitionEnded$,this.forceChanged$),this.state=e,this.prevState=void 0}setState(e){const t=this.transition,s=this.state;this.transition=void 0,this.prevState=s,this.state=e,t?t.to===e?this.transitionEnded$.next(t):this.forceChanged$.next({from:t.from,to:e,canceledTransition:t}):this.forceChanged$.next({from:s,to:e,canceledTransition:t})}startTransitionTo(e){const t=this.transition,s=this.state;s===e||a.isNonNullable(t)&&t.to===e||(this.prevState=s,this.state=e,t?(this.transition={from:t.from,to:e,canceledTransition:t},this.transitionUpdated$.next(this.transition)):(this.transition={from:s,to:e},this.transitionStarted$.next(this.transition)))}getTransition(){return this.transition}getState(){return this.state}getPrevState(){return this.prevState}}const Ob=i=>{switch(i){case exports.VideoFormat.MPEG:case exports.VideoFormat.DASH:case exports.VideoFormat.DASH_SEP:case exports.VideoFormat.DASH_ONDEMAND:case exports.VideoFormat.DASH_WEBM:case exports.VideoFormat.DASH_WEBM_AV1:case exports.VideoFormat.HLS:case exports.VideoFormat.HLS_ONDEMAND:return!1;case exports.VideoFormat.DASH_LIVE:case exports.VideoFormat.DASH_LIVE_CMAF:case exports.VideoFormat.HLS_LIVE:case exports.VideoFormat.HLS_LIVE_CMAF:case exports.VideoFormat.DASH_LIVE_WEBM:case exports.VideoFormat.WEB_RTC_LIVE:return!0;default:return a.assertNever(i)}};var O;(function(i){i.STOPPED="stopped",i.READY="ready",i.PLAYING="playing",i.PAUSED="paused"})(O||(O={}));const Mb=5,Bb=5,Fb=500,uo=7e3;class Vb{constructor(e){this.subscription=new a.Subscription,this.loadMediaTimeoutSubscription=new a.Subscription,this.videoState=new X(O.STOPPED),this.syncPlayback=()=>{const s=this.videoState.getState(),r=this.videoState.getTransition(),n=this.params.desiredState.playbackState.getState(),o=this.params.desiredState.playbackState.getTransition(),l=this.params.desiredState.seekState.getState();if(this.log({message:`[syncPlayback] videoState: ${s}; videoTransition: ${JSON.stringify(r)}; desiredPlaybackState: ${n}; desiredPlaybackStateTransition: ${this.params.desiredState.playbackState.getTransition()}; seekState: ${JSON.stringify(l)};`}),n===exports.PlaybackState.STOPPED){s!==O.STOPPED&&(this.videoState.startTransitionTo(O.STOPPED),this.stop());return}if(!r){if((o==null?void 0:o.to)!==exports.PlaybackState.PAUSED&&l.state===B.Requested&&s!==O.STOPPED){this.seek(l.position/1e3);return}switch(n){case exports.PlaybackState.READY:{switch(s){case O.PLAYING:case O.PAUSED:case O.READY:break;case O.STOPPED:this.videoState.startTransitionTo(O.READY),this.prepare();break;default:a.assertNever(s)}break}case exports.PlaybackState.PLAYING:{switch(s){case O.PLAYING:break;case O.PAUSED:this.videoState.startTransitionTo(O.PLAYING),this.params.connection.remotePlayerController.playOrPause();break;case O.READY:this.videoState.startTransitionTo(O.PLAYING),this.params.connection.remotePlayerController.playOrPause();break;case O.STOPPED:this.videoState.startTransitionTo(O.READY),this.prepare();break;default:a.assertNever(s)}break}case exports.PlaybackState.PAUSED:{switch(s){case O.PLAYING:this.videoState.startTransitionTo(O.PAUSED),this.params.connection.remotePlayerController.playOrPause();break;case O.PAUSED:break;case O.READY:this.videoState.startTransitionTo(O.PAUSED),this.videoState.setState(O.PAUSED);break;case O.STOPPED:this.videoState.startTransitionTo(O.READY),this.prepare();break;default:a.assertNever(s)}break}default:a.assertNever(n)}}},this.params=e,this.log=this.params.dependencies.logger.createComponentLog("ChromecastProvider"),this.log({message:`constructor, format: ${e.format}`}),this.params.output.isLive$.next(Ob(e.format)),this.params.output.isAudioAvailable$.next(!0),this.handleRemoteVolumeChange({volume:this.params.connection.remotePlayer.volumeLevel,muted:this.params.connection.remotePlayer.isMuted});const t=this.params.connection.session.getMediaSession();t&&this.restoreSession(t),this.subscribe()}destroy(){this.log({message:"[destroy]"}),this.subscription.unsubscribe()}subscribe(){this.subscription.add(this.loadMediaTimeoutSubscription);const e=new a.Subscription;this.subscription.add(e),this.subscription.add(a.merge(this.videoState.stateChangeStarted$.pipe(a.map(r=>`stateChangeStarted$ ${JSON.stringify(r)}`)),this.videoState.stateChangeEnded$.pipe(a.map(r=>`stateChangeEnded$ ${JSON.stringify(r)}`))).subscribe(r=>this.log({message:`[videoState] ${r}`})));const t=(r,n)=>this.subscription.add(r.subscribe(n));if(this.params.output.isLive$.getValue())this.params.output.position$.next(0),this.params.output.duration$.next(0);else{const r=new a.Subject;e.add(r.pipe(a.debounce(Fb)).subscribe(()=>{this.params.output.seekedEvent$.next()}));let n=NaN;e.add(a.fromEvent(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED).subscribe(o=>{this.logRemoteEvent(o);const l=o.value;this.params.output.position$.next(l),(this.params.desiredState.seekState.getState().state===B.Applying||Math.abs(l-n)>Mb)&&r.next(l),n=l})),e.add(a.fromEvent(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.DURATION_CHANGED).subscribe(o=>{this.logRemoteEvent(o),this.params.output.duration$.next(o.value)}))}t(a.fromEvent(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED),r=>{this.logRemoteEvent(r),r.value?this.handleRemoteReady():(this.handleRemoteStop(),e.unsubscribe())}),t(a.fromEvent(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED),r=>{this.logRemoteEvent(r),r.value?this.handleRemotePause():this.handleRemotePlay()}),t(a.fromEvent(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED),r=>{this.logRemoteEvent(r);const{remotePlayer:n}=this.params.connection,o=r.value,l=this.params.output.isBuffering$.getValue(),d=o===chrome.cast.media.PlayerState.BUFFERING;switch(l!==d&&this.params.output.isBuffering$.next(d),o){case chrome.cast.media.PlayerState.IDLE:!this.params.output.isLive$.getValue()&&n.duration-n.currentTime<Bb&&this.params.output.endedEvent$.next(),this.handleRemoteStop(),P(this.params.desiredState.playbackState,exports.PlaybackState.STOPPED);break;case chrome.cast.media.PlayerState.PAUSED:{this.handleRemotePause();break}case chrome.cast.media.PlayerState.PLAYING:this.handleRemotePlay();break;case chrome.cast.media.PlayerState.BUFFERING:break;default:a.assertNever(o)}}),t(a.fromEvent(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.VOLUME_LEVEL_CHANGED),r=>{this.logRemoteEvent(r),this.handleRemoteVolumeChange({volume:r.value})}),t(a.fromEvent(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.IS_MUTED_CHANGED),r=>{this.logRemoteEvent(r),this.handleRemoteVolumeChange({muted:r.value})});const s=a.merge(this.params.desiredState.playbackState.stateChangeStarted$,this.params.desiredState.seekState.stateChangeEnded$,this.videoState.stateChangeEnded$,a.observableFrom(["init"])).pipe(a.debounce(0));t(s,this.syncPlayback)}restoreSession(e){this.log({message:"restoreSession"});const{remotePlayer:t}=this.params.connection;if(e.playerState!==chrome.cast.media.PlayerState.IDLE){t.isPaused?(this.videoState.setState(O.PAUSED),P(this.params.desiredState.playbackState,exports.PlaybackState.PAUSED)):(this.videoState.setState(O.PLAYING),P(this.params.desiredState.playbackState,exports.PlaybackState.PLAYING));const s=this.params.output.isLive$.getValue();this.params.output.duration$.next(s?0:t.duration),this.params.output.position$.next(s?0:t.currentTime),this.params.desiredState.seekState.setState({state:B.None})}}prepare(){const e=this.params.format;this.log({message:`[prepare] format: ${e}`});const t=this.createMediaInfo(e),s=this.createLoadRequest(t);this.loadMedia(s)}handleRemotePause(){const e=this.videoState.getState(),t=this.videoState.getTransition();((t==null?void 0:t.to)===O.PAUSED||e===O.PLAYING)&&(this.videoState.setState(O.PAUSED),P(this.params.desiredState.playbackState,exports.PlaybackState.PAUSED))}handleRemotePlay(){const e=this.videoState.getState(),t=this.videoState.getTransition();((t==null?void 0:t.to)===O.PLAYING||e===O.PAUSED)&&(this.videoState.setState(O.PLAYING),P(this.params.desiredState.playbackState,exports.PlaybackState.PLAYING))}handleRemoteReady(){var e;const t=this.videoState.getTransition();(t==null?void 0:t.to)===O.READY&&this.videoState.setState(O.READY),((e=this.params.desiredState.playbackState.getTransition())===null||e===void 0?void 0:e.to)===exports.PlaybackState.READY&&P(this.params.desiredState.playbackState,exports.PlaybackState.READY)}handleRemoteStop(){this.videoState.getState()!==O.STOPPED&&this.videoState.setState(O.STOPPED)}handleRemoteVolumeChange(e){var t,s;const r=this.params.output.volume$.getValue(),n={volume:(t=e.volume)!==null&&t!==void 0?t:r.volume,muted:(s=e.muted)!==null&&s!==void 0?s:r.muted};(n.volume!==r.volume||n.muted!==n.muted)&&this.params.output.volume$.next(n)}seek(e){this.params.output.willSeekEvent$.next();const{remotePlayer:t,remotePlayerController:s}=this.params.connection;t.currentTime=e,s.seek()}stop(){const{remotePlayerController:e}=this.params.connection;e.stop()}createMediaInfo(e){var t;const s=this.params.source;let r,n,o;switch(e){case exports.VideoFormat.MPEG:{const c=s[e];a.assertNonNullable(c);const h=a.getHighestQuality(Object.keys(c));a.assertNonNullable(h);const f=c[h];a.assertNonNullable(f),r=f,n="video/mp4",o=chrome.cast.media.StreamType.BUFFERED;break}case exports.VideoFormat.HLS:case exports.VideoFormat.HLS_ONDEMAND:{const c=s[e];a.assertNonNullable(c),r=c.url,n="application/x-mpegurl",o=chrome.cast.media.StreamType.BUFFERED;break}case exports.VideoFormat.DASH_SEP:case exports.VideoFormat.DASH_ONDEMAND:case exports.VideoFormat.DASH_WEBM:case exports.VideoFormat.DASH_WEBM_AV1:{const c=s[e];a.assertNonNullable(c),r=c.url,n="application/dash+xml",o=chrome.cast.media.StreamType.BUFFERED;break}case exports.VideoFormat.DASH_LIVE_CMAF:{const c=s[e];a.assertNonNullable(c),r=c.url,n="application/dash+xml",o=chrome.cast.media.StreamType.LIVE;break}case exports.VideoFormat.HLS_LIVE:case exports.VideoFormat.HLS_LIVE_CMAF:{const c=s[e];a.assertNonNullable(c),r=Re(c.url),n="application/x-mpegurl",o=chrome.cast.media.StreamType.LIVE;break}case exports.VideoFormat.DASH:case exports.VideoFormat.DASH_LIVE:case exports.VideoFormat.WEB_RTC_LIVE:{const c="Unsupported format for Chromecast",h=new Error(c);throw this.params.output.error$.next({id:"ChromecastProvider.createMediaInfo()",category:a.ErrorCategory.VIDEO_PIPELINE,message:c,thrown:h}),h}case exports.VideoFormat.DASH_LIVE_WEBM:throw new Error("DASH_LIVE_WEBM is no longer supported");default:return a.assertNever(e)}const l=new chrome.cast.media.MediaInfo((t=this.params.meta.videoId)!==null&&t!==void 0?t:r,n);l.contentUrl=r,l.streamType=o,l.metadata=new chrome.cast.media.GenericMediaMetadata;const{title:d,subtitle:u}=this.params.meta;return a.isNonNullable(d)&&(l.metadata.title=d),a.isNonNullable(u)&&(l.metadata.subtitle=u),l}createLoadRequest(e){const t=new chrome.cast.media.LoadRequest(e);t.autoplay=!1;const s=this.params.desiredState.seekState.getState();return s.state===B.Applying||s.state===B.Requested?t.currentTime=this.params.output.isLive$.getValue()?0:s.position/1e3:t.currentTime=0,t}loadMedia(e){const t=this.params.connection.session.loadMedia(e),s=new Promise((r,n)=>{this.loadMediaTimeoutSubscription.add(a.timeout(uo).subscribe(()=>n(`timeout(${uo})`)))});Es(Promise.race([t,s]).then(()=>{this.log({message:`[loadMedia] completed, format: ${this.params.format}`}),this.params.desiredState.seekState.getState().state===B.Applying&&this.params.output.seekedEvent$.next(),this.handleRemoteReady()},r=>{const n=`[prepare] loadMedia failed, format: ${this.params.format}, reason: ${r}`;this.log({message:n}),this.params.output.error$.next({id:"ChromecastProvider.loadMedia",category:a.ErrorCategory.VIDEO_PIPELINE,message:n,thrown:r})}),()=>{this.loadMediaTimeoutSubscription.unsubscribe()})}logRemoteEvent(e){this.log({message:`[remoteEvent] ${JSON.stringify(e)}`})}}var Ub=i=>{let e,t=!1,s=!1;i.on("playbackTimeUpdated",({timeToEnd:r})=>{s=r<=3,t&&s&&(e==null||e())}),i.extend("MediaSourceController",function(){const{parent:r}=this,n=r.signalEndOfStream;return{signalEndOfStream:o=>{t=!0,e=()=>n(o),t&&s&&(e==null||e())}}},!0)},jb=i=>{const e=new a.ValueSubject(1/0),t=new a.Subject,s=new a.ValueSubject(void 0),r=new a.ValueSubject(void 0);let n=NaN,o=!1;const l=()=>{n=Date.now(),o=!1},d=c=>{var h,f,p,m,b;const g=Ft(c.getAllResponseHeaders().trim().split(/[\n\r]+/).map(v=>v.split(": ")));if("x-playback-duration"in g||"x-playback-duration-millis"in g){const v=parseInt((h=c.getResponseHeader("X-Playback-Duration"))!==null&&h!==void 0?h:"",10),S=parseInt((f=c.getResponseHeader("X-Playback-Duration-Millis"))!==null&&f!==void 0?f:"",10),T=(p=S!=null?S:v*1e3)!==null&&p!==void 0?p:NaN;a.isNonNullable(T)&&!isNaN(T)&&e.next(T)}const E=(m=g["x-delivery-type"])!==null&&m!==void 0?m:exports.HttpConnectionType.HTTP1,y=(b={1:!0,0:!1}[g["x-reused"]])!==null&&b!==void 0?b:void 0;s.next(E),r.next(y)},u=c=>{c.readyState>=2&&!o&&(o=!0,t.next(Date.now()-n))};return i.extend("XHRLoader",function(){const{parent:c}=this,h=c.load.bind(c);return{load:function(f){if(f.request.type==="MPD"){const p=f.onload,m=f.progress;f.onload=function(...b){return d(this),p(...b)},f.progress=function(...b){return u(this),m(...b)},l()}return h(f)}}},!0),{playbackDuration$:e,ping$:t,connectionReused$:r,connectionType$:s}},Vt=i=>{const e=new URL(i);return e.searchParams.set("quic","1"),e.toString()},Hb=i=>i.extend("RequestModifier",()=>({modifyRequestURL:Vt}),!0),Gb=i=>{i.extend("HTTPLoader",function(){const{parent:e}=this,t=e.load;return{load:s=>{if(s.request&&s.request.range){const[r,n]=s.request.range.split("-").map(l=>parseInt(l,10)),o=new URL(s.request.url,location.href);o.searchParams.append("bytes",`${r}-${n}`),s.request.url=o.toString(),s.request.range=void 0}t(s)}}},!0)};const Ce=(i,e,t,{equal:s=(o,l)=>o===l,changed$:r,onError:n}={})=>{const o=i.getState(),l=e(),d=a.isNullable(r),u=new a.Subscription;return r&&u.add(r.subscribe(c=>{const h=i.getState();s(c,h)&&i.setState(c)},n)),s(l,o)||(t(o),d&&i.setState(o)),u.add(i.stateChangeStarted$.subscribe(c=>{t(c.to),d&&i.setState(c.to)},n)),u},Tt=(i,e,t)=>Ce(e,()=>i.loop,s=>{a.isNonNullable(s)&&(i.loop=s)},{onError:t}),Qe=(i,e,t,s)=>Ce(e,()=>({muted:i.muted,volume:i.volume}),r=>{a.isNonNullable(r)&&(i.muted=r.muted,i.volume=r.volume)},{equal:(r,n)=>r===n||(r==null?void 0:r.muted)===(n==null?void 0:n.muted)&&(r==null?void 0:r.volume)===(n==null?void 0:n.volume),changed$:t,onError:s}),ot=(i,e,t,s)=>Ce(e,()=>i.playbackRate,r=>{a.isNonNullable(r)&&(i.playbackRate=r)},{changed$:t,onError:s}),Yb=i=>["__",i.language,i.label].join("|"),qb=(i,e)=>{if(i.id===e)return!0;const[t,s,r]=e.split("|");return i.language===s&&i.label===r};class Ve{constructor(){this.available$=new a.Subject,this.current$=new a.ValueSubject(void 0),this.error$=new a.Subject,this.subscription=new a.Subscription,this.externalTracks=new Map,this.internalTracks=new Map}connect(e,t,s){this.video=e,this.cueSettings=t.textTrackCuesSettings,this.subscribe();const r=n=>{this.error$.next({id:"TextTracksManager",category:a.ErrorCategory.WTF,message:"Generic HtmlVideoTextTrackManager error",thrown:n})};this.subscription.add(this.available$.subscribe(s.availableTextTracks$)),this.subscription.add(this.current$.subscribe(s.currentTextTrack$)),this.subscription.add(this.error$.subscribe(s.error$)),this.subscription.add(Ce(t.internalTextTracks,()=>Object.values(this.internalTracks),n=>{a.isNonNullable(n)&&this.setInternal(n)},{equal:(n,o)=>a.isNonNullable(n)&&a.isNonNullable(o)&&n.length===o.length&&n.every(({id:l},d)=>l===o[d].id),changed$:this.available$.pipe(a.map(n=>n.filter(({type:o})=>o==="internal"))),onError:r})),this.subscription.add(Ce(t.externalTextTracks,()=>Object.values(this.externalTracks),n=>{a.isNonNullable(n)&&this.setExternal(n)},{equal:(n,o)=>a.isNonNullable(n)&&a.isNonNullable(o)&&n.length===o.length&&n.every(({id:l},d)=>l===o[d].id),changed$:this.available$.pipe(a.map(n=>n.filter(({type:o})=>o==="external"))),onError:r})),this.subscription.add(Ce(t.currentTextTrack,()=>{if(this.video)return;const n=this.htmlTextTracksAsArray().find(({mode:o})=>o==="showing");return n&&this.htmlTextTrackToITextTrack(n).id},n=>this.select(n),{changed$:this.current$,onError:r})),this.subscription.add(Ce(t.textTrackCuesSettings,()=>({}),()=>{if(this.video)for(const n of this.htmlTextTracksAsArray())this.applyCueSettings(n.cues),this.applyCueSettings(n.activeCues)}))}subscribe(){a.assertNonNullable(this.video);const{textTracks:e}=this.video;this.subscription.add(a.fromEvent(e,"addtrack").subscribe(()=>{const s=this.current$.getValue();s&&this.select(s)})),this.subscription.add(a.merge(a.fromEvent(e,"addtrack"),a.fromEvent(e,"removetrack"),a.observableFrom(["init"])).pipe(a.map(()=>this.htmlTextTracksAsArray().map(s=>this.htmlTextTrackToITextTrack(s))),a.filterChanged((s,r)=>s.length===r.length&&s.every(({id:n},o)=>n===r[o].id))).subscribe(this.available$)),this.subscription.add(a.merge(a.fromEvent(e,"change"),a.observableFrom(["init"])).pipe(a.map(()=>this.htmlTextTracksAsArray().find(({mode:s})=>s==="showing")),a.map(s=>s&&this.htmlTextTrackToITextTrack(s).id),a.filterChanged()).subscribe(this.current$));const t=s=>{var r,n;return this.applyCueSettings((n=(r=s.target)===null||r===void 0?void 0:r.activeCues)!==null&&n!==void 0?n:null)};this.subscription.add(a.fromEvent(e,"addtrack").subscribe(s=>{var r,n;(r=s.track)===null||r===void 0||r.addEventListener("cuechange",t);const o=l=>{var d,u,c,h,f;const p=(u=(d=l.target)===null||d===void 0?void 0:d.cues)!==null&&u!==void 0?u:null;p&&p.length&&(this.applyCueSettings((h=(c=l.target)===null||c===void 0?void 0:c.cues)!==null&&h!==void 0?h:null),(f=l.target)===null||f===void 0||f.removeEventListener("cuechange",o))};(n=s.track)===null||n===void 0||n.addEventListener("cuechange",o)})),this.subscription.add(a.fromEvent(e,"removetrack").subscribe(s=>{var r;(r=s.track)===null||r===void 0||r.removeEventListener("cuechange",t)}))}applyCueSettings(e){if(!e||!e.length)return;const t=this.cueSettings.getState();for(const s of Array.from(e)){const r=s;a.isNonNullable(t.align)&&(r.align=t.align),a.isNonNullable(t.position)&&(r.position=t.position),a.isNonNullable(t.size)&&(r.size=t.size),a.isNonNullable(t.line)&&(r.line=t.line)}}htmlTextTracksAsArray(e=!1){a.assertNonNullable(this.video);const t=[...this.video.textTracks];return e?t:t.filter(Ve.isHealthyTrack)}htmlTextTrackToITextTrack(e){var t,s;const{language:r,label:n}=e,o=e.id?e.id:Yb(e),l=this.externalTracks.has(o),d=o.includes("auto");return l?{id:o,type:"external",isAuto:d,language:r,label:n,url:(t=this.externalTracks.get(o))===null||t===void 0?void 0:t.url}:{id:o,type:"internal",isAuto:d,language:r,label:n,url:(s=this.internalTracks.get(o))===null||s===void 0?void 0:s.url}}static isHealthyTrack(e){return!(e.kind==="metadata"||e.groupId||e.id===""&&e.label===""&&e.language==="")}setExternal(e){this.internalTracks.size>0&&Array.from(this.internalTracks).forEach(([,t])=>this.detach(t)),e.filter(({id:t})=>!this.externalTracks.has(t)).forEach(t=>this.attach(t)),Array.from(this.externalTracks).filter(([t])=>!e.find(s=>s.id===t)).forEach(([,t])=>this.detach(t))}setInternal(e){const t=[...this.externalTracks];e.filter(({id:s,language:r,isAuto:n})=>!this.internalTracks.has(s)&&!t.some(([,o])=>o.language===r&&o.isAuto===n)).forEach(s=>this.attach(s)),Array.from(this.internalTracks).filter(([s])=>!e.find(r=>r.id===s)).forEach(([,s])=>this.detach(s))}select(e){a.assertNonNullable(this.video);for(const t of this.htmlTextTracksAsArray(!0))t.mode="showing";for(const t of this.htmlTextTracksAsArray(!0))(a.isNullable(e)||!qb(t,e))&&(t.mode="disabled")}destroy(){if(this.subscription.unsubscribe(),this.video)for(const e of Array.from(this.video.getElementsByTagName("track"))){const t=e.getAttribute("id");t&&this.externalTracks.has(t)&&this.video.removeChild(e)}this.externalTracks.clear()}attach(e){a.assertNonNullable(this.video);const t=document.createElement("track");t.setAttribute("src",e.url),t.setAttribute("id",e.id),e.label&&t.setAttribute("label",e.label),e.language&&t.setAttribute("srclang",e.language),e.type==="external"?this.externalTracks.set(e.id,e):e.type==="internal"&&this.internalTracks.set(e.id,e),this.video.appendChild(t)}detach(e){a.assertNonNullable(this.video);const t=Array.prototype.find.call(this.video.getElementsByTagName("track"),s=>s.getAttribute("id")===e.id);t&&this.video.removeChild(t),e.type==="external"?this.externalTracks.delete(e.id):e.type==="internal"&&this.internalTracks.delete(e.id)}}const Ra=i=>{i.removeAttribute("src"),i.load()},zb=i=>{try{i.pause(),i.playbackRate=0,Ra(i),i.remove()}catch(e){console.error(e)}};class Wb{constructor(){this.attribute="data-pool-reused"}get(e){return e.hasAttribute(this.attribute)}set(e,t){e.toggleAttribute(this.attribute,t)}delete(e){e.removeAttribute(this.attribute)}}const ta=window.WeakMap?new WeakMap:new Wb,Ke=i=>{let e=i.querySelector("video");const t=!!e;return e?Ra(e):(e=document.createElement("video"),i.appendChild(e)),ta.set(e,t),e.setAttribute("crossorigin","anonymous"),e.setAttribute("playsinline","playsinline"),e.controls=!1,e.setAttribute("poster","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),e},Je=i=>{const e=ta.get(i);ta.delete(i),e?Ra(i):zb(i)};class $s{constructor(){this.pausedTime=0,this.streamOffset=0,this.pauseTimestamp=0}getTotalPausedTime(){return this.pausedTime+this.getCurrentPausedTime()}getCurrentPausedTime(){return this.pauseTimestamp>0?Date.now()-this.pauseTimestamp:0}getStreamOffset(){return this.streamOffset}getTotalOffset(){return this.getTotalPausedTime()+this.streamOffset}pause(){this.pauseTimestamp===0&&(this.pauseTimestamp=Date.now())}resume(){this.pauseTimestamp>0&&(this.pausedTime+=this.getCurrentPausedTime(),this.pauseTimestamp=0)}resetTo(e,t=!1){this.streamOffset=e,this.pauseTimestamp=0,this.pausedTime=0,t&&this.pause()}}const su=i=>{var e;let t=i;for(;!(t instanceof Document)&&!(t instanceof ShadowRoot)&&t!==null;)t=t==null?void 0:t.parentNode;return(e=t)!==null&&e!==void 0?e:void 0},co=i=>{const e=su(i);return!!(e&&e.fullscreenElement&&e.fullscreenElement===i)},Qb=i=>{const e=su(i);return!!(e&&e.pictureInPictureElement&&e.pictureInPictureElement===i)},ia=3;class Kb{constructor(e){this._buffer=[],this._source=e}fill(){this._buffer=[];const e=this._source.currentTime;for(let t=0,s=this._source.buffered.length;t<s;t++){let r=this._source.buffered.start(t);const n=this._source.buffered.end(t);r>e&&r-e<ia&&(r=e),this._buffer.push({from:r,to:n,i:t})}return this._buffer.sort(function(t,s){return t.from-s.from}),this._buffer}getByTime(e){return this._buffer.find(t=>e>=t.from&&e<t.to)}getNextWithGap(e,t){const s=this.getNext(e);if(s&&s.from-e.to<(t||ia))return s}getNext(e){let t=this._buffer.indexOf(e);if(~t&&this._buffer.length-1>t)return this._buffer[++t]}smartRemove(e,t,s){this._buffer.forEach(({from:r,to:n})=>{const o=r>=e&&r<t,l=n>=e&&n<t;o&&l||(o?s(t,n):l?s(r,e):r<e&&n>t?(s(t,n),s(r,e)):s(r,n))})}destroy(){this._buffer=[]}}var ru=(i,e,t=ia)=>{let s=0,r=0;for(let n=0;n<i.length;n++){const o=i.start(n),l=i.end(n);if(o<=e&&e<=l){if(s=o,r=l,!t)return{from:s,to:r};for(let d=n-1;d>=0;d--)i.end(d)+t>=s&&(s=i.start(d));for(let d=n+1;d<i.length;d++)i.start(d)-t<=r&&(r=i.end(d))}}return{from:s,to:r}};const Xe=i=>{const e=v=>a.fromEvent(i,v).pipe(a.mapTo(void 0)),t=["waiting","pause","canplay","play","canplaythrough","playing","seeking","seeked","ended"],s=a.merge(...t.map(v=>a.fromEvent(i,v))).pipe(a.map(v=>v.type==="ended"?i.readyState<2:i.readyState<3),a.filterChanged()),r=a.merge(a.fromEvent(i,"progress"),a.fromEvent(i,"timeupdate")).pipe(a.map(()=>ru(i.buffered,i.currentTime))),o=a.getCurrentBrowser().browser===a.CurrentClientBrowser.Safari?a.combine({play:e("play").pipe(a.once()),playing:e("playing")}).pipe(a.mapTo(void 0)):e("playing"),l=a.fromEvent(i,"volumechange").pipe(a.map(()=>({muted:i.muted,volume:i.volume}))),d=a.fromEvent(i,"ratechange").pipe(a.map(()=>i.playbackRate)),u=a.fromEvent(i,"error").pipe(a.filter(()=>!!(i.error||i.played.length)),a.map(()=>{var v;const S=i.error;return{id:S?`MediaError#${S.code}`:"HtmlVideoError",category:a.ErrorCategory.VIDEO_PIPELINE,message:S?S.message:"Error event from HTML video element",thrown:(v=i.error)!==null&&v!==void 0?v:void 0}})),c=a.fromEvent(i,"timeupdate").pipe(a.map(()=>i.currentTime)),h=new a.Subject,f=.3;let p;c.subscribe(v=>{i.loop&&a.isNonNullable(p)&&a.isNonNullable(v)&&p>=i.duration-f&&v<=f&&h.next(p),p=v});const m=a.fromEvent(i,"enterpictureinpicture"),b=a.fromEvent(i,"leavepictureinpicture"),g=new a.ValueSubject(Qb(i));m.subscribe(()=>g.next(!0)),b.subscribe(()=>g.next(!1));const E=new a.ValueSubject(co(i));return a.fromEvent(i,"fullscreenchange").pipe(a.map(()=>co(i))).subscribe(E),{playing$:o,pause$:e("pause").pipe(a.filter(()=>!i.error)),canplay$:e("canplay"),ended$:e("ended"),looped$:h,error$:u,seeked$:e("seeked"),seeking$:e("seeking"),progress$:e("progress"),loadStart$:e("loadstart"),loadedMetadata$:e("loadedmetadata"),loadedData$:e("loadeddata"),timeUpdate$:c,durationChange$:a.fromEvent(i,"durationchange").pipe(a.map(()=>i.duration)),isBuffering$:s,currentBuffer$:r,volumeState$:l,playbackRateState$:d,inPiP$:g,inFullscreen$:E}},Ca=i=>{if(i.includes("/")){const e=i.split("/");return parseInt(e[0])/parseInt(e[1])}else return parseFloat(i)};var Jb=De,Xb=bs,Zb=va,eS=ma;Jb({target:"Array",proto:!0},{at:function(e){var t=Xb(this),s=Zb(t),r=eS(e),n=r>=0?r:s+r;return n<0||n>=s?void 0:t[n]}});var tS=wa,iS=tS("Array","at"),sS=iS,rS=sS,aS=rS,nS=aS,Le=cs(nS);let Da=!1,He={};const oS=i=>{Da=i},lS=()=>{He={}},uS=i=>{i(He)},ji=(i,e)=>{var t;Da&&(He.meta=(t=He.meta)!==null&&t!==void 0?t:{},He.meta[i]=e)};class Oe{constructor(e){this.name=e}next(e){var t,s;if(!Da)return;He.series=(t=He.series)!==null&&t!==void 0?t:{};const r=(s=He.series[this.name])!==null&&s!==void 0?s:[];r.push([Date.now(),e]),He.series[this.name]=r}}var mt;(function(i){i.FitsContainer="FitsContainer",i.FitsThroughput="FitsThroughput",i.Buffer="Buffer",i.DroppedFramesLimit="DroppedFramesLimit",i.FitsQualityLimits="FitsQualityLimits"})(mt||(mt={}));const dS=new Oe("best_bitrate"),cS=(i,e,t)=>(e-t)*Math.pow(2,-10*i)+t;class hS{constructor(){this.history={}}recordSelection(e){this.history[e.id]=a.now()}recordSwitch(e){this.last=e}clear(){this.last=void 0,this.history={}}}const qt=(i,{container:e,throughput:t,tuning:s,limits:r,reserve:n=0,forwardBufferHealth:o,playbackRate:l,current:d,history:u,droppedVideoMaxQualityLimit:c,abrLogger:h})=>{var f,p,m,b,g;const E=s.usePixelRatio&&(f=window.devicePixelRatio)!==null&&f!==void 0?f:1,y=s.limitByContainer&&e&&e.width>0&&e.height>0&&{width:e.width*E*s.containerSizeFactor,height:e.height*E*s.containerSizeFactor},v=y&&a.videoSizeToQuality(y),S=s.considerPlaybackRate&&a.isNonNullable(l)?l:1,T=i.filter(I=>!a.isInvariantQuality(I.quality)).sort((I,A)=>a.isHigher(I.quality,A.quality)?-1:1),k=(p=Le(T,-1))===null||p===void 0?void 0:p.quality,L=(m=Le(T,0))===null||m===void 0?void 0:m.quality,j=a.isNullable(r)||a.isNonNullable(r.min)&&a.isNonNullable(r.max)&&a.isLower(r.max,r.min)||a.isNonNullable(r.min)&&L&&a.isHigher(r.min,L)||a.isNonNullable(r.max)&&k&&a.isLower(r.max,k),D=S*cS(o!=null?o:.5,s.bitrateFactorAtEmptyBuffer,s.bitrateFactorAtFullBuffer),x={},w=T.filter(I=>(v?a.isLower(I.quality,v):!0)?(a.isNonNullable(t)&&isFinite(t)&&a.isNonNullable(I.bitrate)?t-n>=I.bitrate*D:!0)?s.lazyQualitySwitch&&a.isNonNullable(s.minBufferToSwitchUp)&&d&&!a.isInvariantQuality(d.quality)&&(o!=null?o:0)<s.minBufferToSwitchUp&&a.isHigher(I.quality,d.quality)?(x[I.quality]=mt.Buffer,!1):!!c&&a.isHigherOrEqual(I.quality,c)?(x[I.quality]=mt.DroppedFramesLimit,!1):j||(a.isNullable(r.max)||a.isLowerOrEqual(I.quality,r.max))&&(a.isNullable(r.min)||a.isHigherOrEqual(I.quality,r.min))?!0:(x[I.quality]=mt.FitsQualityLimits,!1):(x[I.quality]=mt.FitsThroughput,!1):(x[I.quality]=mt.FitsContainer,!1))[0];w&&w.bitrate&&dS.next(w.bitrate);const N=(b=w!=null?w:T[Math.ceil((T.length-1)/2)])!==null&&b!==void 0?b:i[0];N.quality!==((g=u==null?void 0:u.last)===null||g===void 0?void 0:g.quality)&&h({message:`
6
+ "use strict";var Vu=Object.create;var Ya=Object.defineProperty;var Uu=Object.getOwnPropertyDescriptor;var ju=Object.getOwnPropertyNames;var Hu=Object.getPrototypeOf,Gu=Object.prototype.hasOwnProperty;var Yu=(i,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of ju(e))!Gu.call(i,r)&&r!==t&&Ya(i,r,{get:()=>e[r],enumerable:!(s=Uu(e,r))||s.enumerable});return i};var qa=(i,e,t)=>(t=i!=null?Vu(Hu(i)):{},Yu(e||!i||!i.__esModule?Ya(t,"default",{value:i,enumerable:!0}):t,i));var a=require("@vkontakte/videoplayer-shared/es2015.cjs.js"),qu=require("lodash/debounce.js");const Vo="2.0.94";exports.PlaybackState=void 0;(function(i){i.STOPPED="stopped",i.READY="ready",i.PLAYING="playing",i.PAUSED="paused"})(exports.PlaybackState||(exports.PlaybackState={}));exports.VideoFormat=void 0;(function(i){i.MPEG="MPEG",i.DASH="DASH",i.DASH_SEP="DASH_SEP",i.DASH_SEP_VK="DASH_SEP",i.DASH_WEBM="DASH_WEBM",i.DASH_WEBM_AV1="DASH_WEBM_AV1",i.DASH_WEBM_VK="DASH_WEBM",i.DASH_ONDEMAND="DASH_ONDEMAND",i.DASH_ONDEMAND_VK="DASH_ONDEMAND",i.DASH_LIVE="DASH_LIVE",i.DASH_LIVE_CMAF="DASH_LIVE_CMAF",i.DASH_LIVE_WEBM="DASH_LIVE_WEBM",i.HLS="HLS",i.HLS_ONDEMAND="HLS_ONDEMAND",i.HLS_JS="HLS",i.HLS_LIVE="HLS_LIVE",i.HLS_LIVE_CMAF="HLS_LIVE_CMAF",i.WEB_RTC_LIVE="WEB_RTC_LIVE"})(exports.VideoFormat||(exports.VideoFormat={}));var ue;(function(i){i.SCREEN="SCREEN",i.CHROMECAST="CHROMECAST"})(ue||(ue={}));exports.ChromecastState=void 0;(function(i){i.NOT_AVAILABLE="NOT_AVAILABLE",i.AVAILABLE="AVAILABLE",i.CONNECTING="CONNECTING",i.CONNECTED="CONNECTED"})(exports.ChromecastState||(exports.ChromecastState={}));exports.HttpConnectionType=void 0;(function(i){i.HTTP1="http1",i.HTTP2="http2",i.QUIC="quic"})(exports.HttpConnectionType||(exports.HttpConnectionType={}));var B;(function(i){i.None="none",i.Requested="requested",i.Applying="applying"})(B||(B={}));exports.Surface=void 0;(function(i){i.NONE="none",i.INLINE="inline",i.FULLSCREEN="fullscreen",i.SECOND_SCREEN="second_screen",i.PIP="pip"})(exports.Surface||(exports.Surface={}));function K(i,e,t,s){function r(n){return n instanceof t?n:new t(function(o){o(n)})}return new(t||(t=Promise))(function(n,o){function l(c){try{u(s.next(c))}catch(h){o(h)}}function d(c){try{u(s.throw(c))}catch(h){o(h)}}function u(c){c.done?n(c.value):r(c.value).then(l,d)}u((s=s.apply(i,e||[])).next())})}function R(i){return this instanceof R?(this.v=i,this):new R(i)}function be(i,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s=t.apply(i,e||[]),r,n=[];return r={},o("next"),o("throw"),o("return"),r[Symbol.asyncIterator]=function(){return this},r;function o(f){s[f]&&(r[f]=function(p){return new Promise(function(m,b){n.push([f,p,m,b])>1||l(f,p)})})}function l(f,p){try{d(s[f](p))}catch(m){h(n[0][3],m)}}function d(f){f.value instanceof R?Promise.resolve(f.value.v).then(u,c):h(n[0][2],f)}function u(f){l("next",f)}function c(f){l("throw",f)}function h(f,p){f(p),n.shift(),n.length&&l(n[0][0],n[0][1])}}var zu=i=>new Promise((e,t)=>{const s=document.createElement("script");s.setAttribute("src",i),s.onload=()=>e,s.onerror=()=>t,document.body.appendChild(s)});class Wu{constructor(e){var t;this.connection$=new a.ValueSubject(void 0),this.castState$=new a.ValueSubject(exports.ChromecastState.NOT_AVAILABLE),this.errorEvent$=new a.Subject,this.realCastState$=new a.ValueSubject(exports.ChromecastState.NOT_AVAILABLE),this.subscription=new a.Subscription,this.params=e,this.log=this.params.dependencies.logger.createComponentLog("ChromecastInitializer");const s="chrome"in window;if(this.log({message:`[constructor] receiverApplicationId: ${this.params.receiverApplicationId}, isDisabled: ${this.params.isDisabled}, isSupported: ${s}`}),e.isDisabled||!s)return;const r=a.isNonNullable((t=window.chrome)===null||t===void 0?void 0:t.cast),n=!!window.__onGCastApiAvailable;r?this.initializeCastApi():(window.__onGCastApiAvailable=o=>{delete window.__onGCastApiAvailable,o&&this.initializeCastApi()},n||zu("https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1").catch(()=>this.errorEvent$.next({id:"ChromecastLoading",category:a.ErrorCategory.NETWORK,message:"Script loading failed!"})))}connect(){var e;(e=cast.framework.CastContext.getInstance())===null||e===void 0||e.requestSession()}disconnect(){var e,t;(t=(e=cast.framework.CastContext.getInstance())===null||e===void 0?void 0:e.getCurrentSession())===null||t===void 0||t.endSession(!0)}stopMedia(){return new Promise((e,t)=>{var s,r,n;(n=(r=(s=cast.framework.CastContext.getInstance())===null||s===void 0?void 0:s.getCurrentSession())===null||r===void 0?void 0:r.getMediaSession())===null||n===void 0||n.stop(new chrome.cast.media.StopRequest,e,t)})}toggleConnection(){a.isNonNullable(this.connection$.getValue())?this.disconnect():this.connect()}setVolume(e){const t=this.connection$.getValue();a.isNullable(t)||(t.remotePlayer.volumeLevel=e,t.remotePlayerController.setVolumeLevel())}setMuted(e){const t=this.connection$.getValue();a.isNullable(t)||e!==t.remotePlayer.isMuted&&t.remotePlayerController.muteOrUnmute()}destroy(){this.subscription.unsubscribe()}initListeners(){const e=new cast.framework.RemotePlayer,t=new cast.framework.RemotePlayerController(e),s=cast.framework.CastContext.getInstance();this.subscription.add(a.fromEvent(s,cast.framework.CastContextEventType.SESSION_STATE_CHANGED).subscribe(r=>{var n,o;switch(r.sessionState){case cast.framework.SessionState.SESSION_STARTED:case cast.framework.SessionState.SESSION_STARTING:case cast.framework.SessionState.SESSION_RESUMED:this.contentId=(o=(n=s.getCurrentSession())===null||n===void 0?void 0:n.getMediaSession())===null||o===void 0?void 0:o.media.contentId;break;case cast.framework.SessionState.NO_SESSION:case cast.framework.SessionState.SESSION_ENDING:case cast.framework.SessionState.SESSION_ENDED:case cast.framework.SessionState.SESSION_START_FAILED:this.contentId=void 0;break;default:return a.assertNever(r.sessionState)}})).add(a.merge(a.fromEvent(s,cast.framework.CastContextEventType.CAST_STATE_CHANGED).pipe(a.tap(r=>{this.log({message:`[cast.framework.RemotePlayerEventType.CAST_STATE_CHANGED]: ${JSON.stringify(r)}`})}),a.map(r=>r.castState)),a.observableFrom([s.getCastState()])).pipe(a.filterChanged(),a.map(Qu),a.tap(r=>{this.log({message:`realCastState$: ${r}`})})).subscribe(this.realCastState$)).add(this.realCastState$.subscribe(r=>{var n;const o=r===exports.ChromecastState.CONNECTED,l=a.isNonNullable(this.connection$.getValue());if(o&&!l){const d=s.getCurrentSession();a.assertNonNullable(d);const u=d.getCastDevice(),c=(n=d.getMediaSession())===null||n===void 0?void 0:n.media.contentId;(a.isNullable(c)||c===this.contentId)&&(this.log({message:"connection created"}),this.connection$.next({remotePlayer:e,remotePlayerController:t,session:d,castDevice:u}))}else!o&&l&&(this.log({message:"connection destroyed"}),this.connection$.next(void 0));this.castState$.next(r===exports.ChromecastState.CONNECTED?a.isNonNullable(this.connection$.getValue())?exports.ChromecastState.CONNECTED:exports.ChromecastState.AVAILABLE:r)}))}initializeCastApi(){var e;let t,s,r;try{t=cast.framework.CastContext.getInstance(),s=chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,r=chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED}catch(n){return}try{t.setOptions({receiverApplicationId:(e=this.params.receiverApplicationId)!==null&&e!==void 0?e:s,autoJoinPolicy:r}),this.initListeners()}catch(n){this.errorEvent$.next({id:"ChromecastInitializer",category:a.ErrorCategory.EXTERNAL_API,message:"[initializeCastApi] failed",thrown:n})}}}const Qu=i=>{switch(i){case cast.framework.CastState.NO_DEVICES_AVAILABLE:return exports.ChromecastState.NOT_AVAILABLE;case cast.framework.CastState.NOT_CONNECTED:return exports.ChromecastState.AVAILABLE;case cast.framework.CastState.CONNECTING:return exports.ChromecastState.CONNECTING;case cast.framework.CastState.CONNECTED:return exports.ChromecastState.CONNECTED;default:return a.assertNever(i)}};var Ms=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function cs(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var ke=function(i){try{return!!i()}catch(e){return!0}},Ku=ke,hs=!Ku(function(){var i=function(){}.bind();return typeof i!="function"||i.hasOwnProperty("prototype")}),Uo=hs,jo=Function.prototype,Lr=jo.call,Ju=Uo&&jo.bind.bind(Lr,Lr),Pe=Uo?Ju:function(i){return function(){return Lr.apply(i,arguments)}},Ho=Pe,Xu=Ho({}.toString),Zu=Ho("".slice),fi=function(i){return Zu(Xu(i),8,-1)},ed=Pe,td=ke,id=fi,Bs=Object,sd=ed("".split),rd=td(function(){return!Bs("z").propertyIsEnumerable(0)})?function(i){return id(i)=="String"?sd(i,""):Bs(i)}:Bs,pi=function(i){return i==null},ad=pi,nd=TypeError,na=function(i){if(ad(i))throw nd("Can't call method on "+i);return i},od=rd,ld=na,mi=function(i){return od(ld(i))},Ht={},Ri=function(i){return i&&i.Math==Math&&i},le=Ri(typeof globalThis=="object"&&globalThis)||Ri(typeof window=="object"&&window)||Ri(typeof self=="object"&&self)||Ri(typeof Ms=="object"&&Ms)||function(){return this}()||Ms||Function("return this")(),Or=typeof document=="object"&&document.all,ud=typeof Or=="undefined"&&Or!==void 0,Go={all:Or,IS_HTMLDDA:ud},Yo=Go,dd=Yo.all,ne=Yo.IS_HTMLDDA?function(i){return typeof i=="function"||i===dd}:function(i){return typeof i=="function"},cd=le,hd=ne,za=cd.WeakMap,fd=hd(za)&&/native code/.test(String(za)),Wa=ne,qo=Go,pd=qo.all,ze=qo.IS_HTMLDDA?function(i){return typeof i=="object"?i!==null:Wa(i)||i===pd}:function(i){return typeof i=="object"?i!==null:Wa(i)},md=ke,nt=!md(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7}),St={},vd=le,Qa=ze,Mr=vd.document,bd=Qa(Mr)&&Qa(Mr.createElement),oa=function(i){return bd?Mr.createElement(i):{}},Sd=nt,gd=ke,yd=oa,zo=!Sd&&!gd(function(){return Object.defineProperty(yd("div"),"a",{get:function(){return 7}}).a!=7}),Td=nt,Ed=ke,Wo=Td&&Ed(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42}),$d=ze,kd=String,Pd=TypeError,We=function(i){if($d(i))return i;throw Pd(kd(i)+" is not an object")},Ad=hs,Ci=Function.prototype.call,ge=Ad?Ci.bind(Ci):function(){return Ci.apply(Ci,arguments)},la={},Fs=la,Vs=le,_d=ne,Ka=function(i){return _d(i)?i:void 0},gt=function(i,e){return arguments.length<2?Ka(Fs[i])||Ka(Vs[i]):Fs[i]&&Fs[i][e]||Vs[i]&&Vs[i][e]},wd=Pe,fs=wd({}.isPrototypeOf),ps=typeof navigator!="undefined"&&String(navigator.userAgent)||"",Qo=le,Us=ps,Ja=Qo.process,Xa=Qo.Deno,Za=Ja&&Ja.versions||Xa&&Xa.version,en=Za&&Za.v8,we,is;en&&(we=en.split("."),is=we[0]>0&&we[0]<4?1:+(we[0]+we[1]));!is&&Us&&(we=Us.match(/Edge\/(\d+)/),(!we||we[1]>=74)&&(we=Us.match(/Chrome\/(\d+)/),we&&(is=+we[1])));var Ko=is,tn=Ko,Rd=ke,Cd=le,Dd=Cd.String,Jo=!!Object.getOwnPropertySymbols&&!Rd(function(){var i=Symbol();return!Dd(i)||!(Object(i)instanceof Symbol)||!Symbol.sham&&tn&&tn<41}),Id=Jo,Xo=Id&&!Symbol.sham&&typeof Symbol.iterator=="symbol",Nd=gt,xd=ne,Ld=fs,Od=Xo,Md=Object,Zo=Od?function(i){return typeof i=="symbol"}:function(i){var e=Nd("Symbol");return xd(e)&&Ld(e.prototype,Md(i))},Bd=String,ms=function(i){try{return Bd(i)}catch(e){return"Object"}},Fd=ne,Vd=ms,Ud=TypeError,yt=function(i){if(Fd(i))return i;throw Ud(Vd(i)+" is not a function")},jd=yt,Hd=pi,vs=function(i,e){var t=i[e];return Hd(t)?void 0:jd(t)},js=ge,Hs=ne,Gs=ze,Gd=TypeError,Yd=function(i,e){var t,s;if(e==="string"&&Hs(t=i.toString)&&!Gs(s=js(t,i))||Hs(t=i.valueOf)&&!Gs(s=js(t,i))||e!=="string"&&Hs(t=i.toString)&&!Gs(s=js(t,i)))return s;throw Gd("Can't convert object to primitive value")},el={exports:{}},qd=!0,sn=le,zd=Object.defineProperty,Wd=function(i,e){try{zd(sn,i,{value:e,configurable:!0,writable:!0})}catch(t){sn[i]=e}return e},Qd=le,Kd=Wd,rn="__core-js_shared__",Jd=Qd[rn]||Kd(rn,{}),ua=Jd,an=ua;(el.exports=function(i,e){return an[i]||(an[i]=e!==void 0?e:{})})("versions",[]).push({version:"3.31.0",mode:"pure",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.0/LICENSE",source:"https://github.com/zloirock/core-js"});var tl=el.exports,Xd=na,Zd=Object,bs=function(i){return Zd(Xd(i))},ec=Pe,tc=bs,ic=ec({}.hasOwnProperty),Fe=Object.hasOwn||function(e,t){return ic(tc(e),t)},sc=Pe,rc=0,ac=Math.random(),nc=sc(1 .toString),il=function(i){return"Symbol("+(i===void 0?"":i)+")_"+nc(++rc+ac,36)},oc=le,lc=tl,nn=Fe,uc=il,dc=Jo,cc=Xo,Nt=oc.Symbol,Ys=lc("wks"),hc=cc?Nt.for||Nt:Nt&&Nt.withoutSetter||uc,ce=function(i){return nn(Ys,i)||(Ys[i]=dc&&nn(Nt,i)?Nt[i]:hc("Symbol."+i)),Ys[i]},fc=ge,on=ze,ln=Zo,pc=vs,mc=Yd,vc=ce,bc=TypeError,Sc=vc("toPrimitive"),gc=function(i,e){if(!on(i)||ln(i))return i;var t=pc(i,Sc),s;if(t){if(e===void 0&&(e="default"),s=fc(t,i,e),!on(s)||ln(s))return s;throw bc("Can't convert object to primitive value")}return e===void 0&&(e="number"),mc(i,e)},yc=gc,Tc=Zo,da=function(i){var e=yc(i,"string");return Tc(e)?e:e+""},Ec=nt,$c=zo,kc=Wo,Di=We,un=da,Pc=TypeError,qs=Object.defineProperty,Ac=Object.getOwnPropertyDescriptor,zs="enumerable",Ws="configurable",Qs="writable";St.f=Ec?kc?function(e,t,s){if(Di(e),t=un(t),Di(s),typeof e=="function"&&t==="prototype"&&"value"in s&&Qs in s&&!s[Qs]){var r=Ac(e,t);r&&r[Qs]&&(e[t]=s.value,s={configurable:Ws in s?s[Ws]:r[Ws],enumerable:zs in s?s[zs]:r[zs],writable:!1})}return qs(e,t,s)}:qs:function(e,t,s){if(Di(e),t=un(t),Di(s),$c)try{return qs(e,t,s)}catch(r){}if("get"in s||"set"in s)throw Pc("Accessors not supported");return"value"in s&&(e[t]=s.value),e};var Ss=function(i,e){return{enumerable:!(i&1),configurable:!(i&2),writable:!(i&4),value:e}},_c=nt,wc=St,Rc=Ss,vi=_c?function(i,e,t){return wc.f(i,e,Rc(1,t))}:function(i,e,t){return i[e]=t,i},Cc=tl,Dc=il,dn=Cc("keys"),ca=function(i){return dn[i]||(dn[i]=Dc(i))},ha={},Ic=fd,sl=le,Nc=ze,xc=vi,Ks=Fe,Js=ua,Lc=ca,Oc=ha,cn="Object already initialized",Br=sl.TypeError,Mc=sl.WeakMap,ss,ui,rs,Bc=function(i){return rs(i)?ui(i):ss(i,{})},Fc=function(i){return function(e){var t;if(!Nc(e)||(t=ui(e)).type!==i)throw Br("Incompatible receiver, "+i+" required");return t}};if(Ic||Js.state){var Ne=Js.state||(Js.state=new Mc);Ne.get=Ne.get,Ne.has=Ne.has,Ne.set=Ne.set,ss=function(i,e){if(Ne.has(i))throw Br(cn);return e.facade=i,Ne.set(i,e),e},ui=function(i){return Ne.get(i)||{}},rs=function(i){return Ne.has(i)}}else{var _t=Lc("state");Oc[_t]=!0,ss=function(i,e){if(Ks(i,_t))throw Br(cn);return e.facade=i,xc(i,_t,e),e},ui=function(i){return Ks(i,_t)?i[_t]:{}},rs=function(i){return Ks(i,_t)}}var rl={set:ss,get:ui,has:rs,enforce:Bc,getterFor:Fc},Vc=hs,al=Function.prototype,hn=al.apply,fn=al.call,nl=typeof Reflect=="object"&&Reflect.apply||(Vc?fn.bind(hn):function(){return fn.apply(hn,arguments)}),Uc=fi,jc=Pe,ol=function(i){if(Uc(i)==="Function")return jc(i)},fa={},ll={},ul={}.propertyIsEnumerable,dl=Object.getOwnPropertyDescriptor,Hc=dl&&!ul.call({1:2},1);ll.f=Hc?function(e){var t=dl(this,e);return!!t&&t.enumerable}:ul;var Gc=nt,Yc=ge,qc=ll,zc=Ss,Wc=mi,Qc=da,Kc=Fe,Jc=zo,pn=Object.getOwnPropertyDescriptor;fa.f=Gc?pn:function(e,t){if(e=Wc(e),t=Qc(t),Jc)try{return pn(e,t)}catch(s){}if(Kc(e,t))return zc(!Yc(qc.f,e,t),e[t])};var Xc=ke,Zc=ne,eh=/#|\.prototype\./,bi=function(i,e){var t=ih[th(i)];return t==rh?!0:t==sh?!1:Zc(e)?Xc(e):!!e},th=bi.normalize=function(i){return String(i).replace(eh,".").toLowerCase()},ih=bi.data={},sh=bi.NATIVE="N",rh=bi.POLYFILL="P",cl=bi,mn=ol,ah=yt,nh=hs,oh=mn(mn.bind),gs=function(i,e){return ah(i),e===void 0?i:nh?oh(i,e):function(){return i.apply(e,arguments)}},Ii=le,lh=nl,uh=ol,dh=ne,ch=fa.f,hh=cl,wt=la,fh=gs,Rt=vi,vn=Fe,ph=function(i){var e=function(t,s,r){if(this instanceof e){switch(arguments.length){case 0:return new i;case 1:return new i(t);case 2:return new i(t,s)}return new i(t,s,r)}return lh(i,this,arguments)};return e.prototype=i.prototype,e},De=function(i,e){var t=i.target,s=i.global,r=i.stat,n=i.proto,o=s?Ii:r?Ii[t]:(Ii[t]||{}).prototype,l=s?wt:wt[t]||Rt(wt,t,{})[t],d=l.prototype,u,c,h,f,p,m,b,g,E;for(f in e)u=hh(s?f:t+(r?".":"#")+f,i.forced),c=!u&&o&&vn(o,f),m=l[f],c&&(i.dontCallGetSet?(E=ch(o,f),b=E&&E.value):b=o[f]),p=c&&b?b:e[f],!(c&&typeof m==typeof p)&&(i.bind&&c?g=fh(p,Ii):i.wrap&&c?g=ph(p):n&&dh(p)?g=uh(p):g=p,(i.sham||p&&p.sham||m&&m.sham)&&Rt(g,"sham",!0),Rt(l,f,g),n&&(h=t+"Prototype",vn(wt,h)||Rt(wt,h,{}),Rt(wt[h],f,p),i.real&&d&&(u||!d[f])&&Rt(d,f,p)))},Fr=nt,mh=Fe,hl=Function.prototype,vh=Fr&&Object.getOwnPropertyDescriptor,pa=mh(hl,"name"),bh=pa&&function(){}.name==="something",Sh=pa&&(!Fr||Fr&&vh(hl,"name").configurable),gh={EXISTS:pa,PROPER:bh,CONFIGURABLE:Sh},fl={},yh=Math.ceil,Th=Math.floor,Eh=Math.trunc||function(e){var t=+e;return(t>0?Th:yh)(t)},$h=Eh,ma=function(i){var e=+i;return e!==e||e===0?0:$h(e)},kh=ma,Ph=Math.max,Ah=Math.min,_h=function(i,e){var t=kh(i);return t<0?Ph(t+e,0):Ah(t,e)},wh=ma,Rh=Math.min,Ch=function(i){return i>0?Rh(wh(i),9007199254740991):0},Dh=Ch,va=function(i){return Dh(i.length)},Ih=mi,Nh=_h,xh=va,bn=function(i){return function(e,t,s){var r=Ih(e),n=xh(r),o=Nh(s,n),l;if(i&&t!=t){for(;n>o;)if(l=r[o++],l!=l)return!0}else for(;n>o;o++)if((i||o in r)&&r[o]===t)return i||o||0;return!i&&-1}},Lh={includes:bn(!0),indexOf:bn(!1)},Oh=Pe,Xs=Fe,Mh=mi,Bh=Lh.indexOf,Fh=ha,Sn=Oh([].push),Vh=function(i,e){var t=Mh(i),s=0,r=[],n;for(n in t)!Xs(Fh,n)&&Xs(t,n)&&Sn(r,n);for(;e.length>s;)Xs(t,n=e[s++])&&(~Bh(r,n)||Sn(r,n));return r},pl=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Uh=Vh,jh=pl,Hh=Object.keys||function(e){return Uh(e,jh)},Gh=nt,Yh=Wo,qh=St,zh=We,Wh=mi,Qh=Hh;fl.f=Gh&&!Yh?Object.defineProperties:function(e,t){zh(e);for(var s=Wh(t),r=Qh(t),n=r.length,o=0,l;n>o;)qh.f(e,l=r[o++],s[l]);return e};var Kh=gt,ml=Kh("document","documentElement"),Jh=We,Xh=fl,gn=pl,Zh=ha,ef=ml,tf=oa,sf=ca,yn=">",Tn="<",Vr="prototype",Ur="script",vl=sf("IE_PROTO"),Zs=function(){},bl=function(i){return Tn+Ur+yn+i+Tn+"/"+Ur+yn},En=function(i){i.write(bl("")),i.close();var e=i.parentWindow.Object;return i=null,e},rf=function(){var i=tf("iframe"),e="java"+Ur+":",t;return i.style.display="none",ef.appendChild(i),i.src=String(e),t=i.contentWindow.document,t.open(),t.write(bl("document.F=Object")),t.close(),t.F},Ni,Xi=function(){try{Ni=new ActiveXObject("htmlfile")}catch(e){}Xi=typeof document!="undefined"?document.domain&&Ni?En(Ni):rf():En(Ni);for(var i=gn.length;i--;)delete Xi[Vr][gn[i]];return Xi()};Zh[vl]=!0;var Sl=Object.create||function(e,t){var s;return e!==null?(Zs[Vr]=Jh(e),s=new Zs,Zs[Vr]=null,s[vl]=e):s=Xi(),t===void 0?s:Xh.f(s,t)},af=ke,nf=!af(function(){function i(){}return i.prototype.constructor=null,Object.getPrototypeOf(new i)!==i.prototype}),of=Fe,lf=ne,uf=bs,df=ca,cf=nf,$n=df("IE_PROTO"),jr=Object,hf=jr.prototype,gl=cf?jr.getPrototypeOf:function(i){var e=uf(i);if(of(e,$n))return e[$n];var t=e.constructor;return lf(t)&&e instanceof t?t.prototype:e instanceof jr?hf:null},ff=vi,ba=function(i,e,t,s){return s&&s.enumerable?i[e]=t:ff(i,e,t),i},pf=ke,mf=ne,vf=ze,bf=Sl,kn=gl,Sf=ba,gf=ce,Hr=gf("iterator"),yl=!1,Ge,er,tr;[].keys&&(tr=[].keys(),"next"in tr?(er=kn(kn(tr)),er!==Object.prototype&&(Ge=er)):yl=!0);var yf=!vf(Ge)||pf(function(){var i={};return Ge[Hr].call(i)!==i});yf?Ge={}:Ge=bf(Ge);mf(Ge[Hr])||Sf(Ge,Hr,function(){return this});var Tl={IteratorPrototype:Ge,BUGGY_SAFARI_ITERATORS:yl},Tf=ce,Ef=Tf("toStringTag"),El={};El[Ef]="z";var Sa=String(El)==="[object z]",$f=Sa,kf=ne,Zi=fi,Pf=ce,Af=Pf("toStringTag"),_f=Object,wf=Zi(function(){return arguments}())=="Arguments",Rf=function(i,e){try{return i[e]}catch(t){}},Si=$f?Zi:function(i){var e,t,s;return i===void 0?"Undefined":i===null?"Null":typeof(t=Rf(e=_f(i),Af))=="string"?t:wf?Zi(e):(s=Zi(e))=="Object"&&kf(e.callee)?"Arguments":s},Cf=Sa,Df=Si,If=Cf?{}.toString:function(){return"[object "+Df(this)+"]"},Nf=Sa,xf=St.f,Lf=vi,Of=Fe,Mf=If,Bf=ce,Pn=Bf("toStringTag"),ga=function(i,e,t,s){if(i){var r=t?i:i.prototype;Of(r,Pn)||xf(r,Pn,{configurable:!0,value:e}),s&&!Nf&&Lf(r,"toString",Mf)}},Ff=Tl.IteratorPrototype,Vf=Sl,Uf=Ss,jf=ga,Hf=Ht,Gf=function(){return this},Yf=function(i,e,t,s){var r=e+" Iterator";return i.prototype=Vf(Ff,{next:Uf(+!s,t)}),jf(i,r,!1,!0),Hf[r]=Gf,i},qf=De,zf=ge,$l=gh,Wf=Yf,Qf=gl,Kf=ga,An=ba,Jf=ce,_n=Ht,kl=Tl,Xf=$l.PROPER;$l.CONFIGURABLE;kl.IteratorPrototype;var xi=kl.BUGGY_SAFARI_ITERATORS,ir=Jf("iterator"),wn="keys",Li="values",Rn="entries",Zf=function(){return this},ep=function(i,e,t,s,r,n,o){Wf(t,e,s);var l=function(E){if(E===r&&f)return f;if(!xi&&E in c)return c[E];switch(E){case wn:return function(){return new t(this,E)};case Li:return function(){return new t(this,E)};case Rn:return function(){return new t(this,E)}}return function(){return new t(this)}},d=e+" Iterator",u=!1,c=i.prototype,h=c[ir]||c["@@iterator"]||r&&c[r],f=!xi&&h||l(r),p=e=="Array"&&c.entries||h,m,b,g;if(p&&(m=Qf(p.call(new i)),m!==Object.prototype&&m.next&&(Kf(m,d,!0,!0),_n[d]=Zf)),Xf&&r==Li&&h&&h.name!==Li&&(u=!0,f=function(){return zf(h,this)}),r)if(b={values:l(Li),keys:n?f:l(wn),entries:l(Rn)},o)for(g in b)(xi||u||!(g in c))&&An(c,g,b[g]);else qf({target:e,proto:!0,forced:xi||u},b);return o&&c[ir]!==f&&An(c,ir,f,{name:r}),_n[e]=f,b},tp=function(i,e){return{value:i,done:e}},ip=mi,Cn=Ht,Pl=rl;St.f;var sp=ep,Oi=tp,Al="Array Iterator",rp=Pl.set,ap=Pl.getterFor(Al);sp(Array,"Array",function(i,e){rp(this,{type:Al,target:ip(i),index:0,kind:e})},function(){var i=ap(this),e=i.target,t=i.kind,s=i.index++;return!e||s>=e.length?(i.target=void 0,Oi(void 0,!0)):t=="keys"?Oi(s,!1):t=="values"?Oi(e[s],!1):Oi([s,e[s]],!1)},"values");Cn.Arguments=Cn.Array;var np=ce,op=Ht,lp=np("iterator"),up=Array.prototype,dp=function(i){return i!==void 0&&(op.Array===i||up[lp]===i)},cp=Si,Dn=vs,hp=pi,fp=Ht,pp=ce,mp=pp("iterator"),_l=function(i){if(!hp(i))return Dn(i,mp)||Dn(i,"@@iterator")||fp[cp(i)]},vp=ge,bp=yt,Sp=We,gp=ms,yp=_l,Tp=TypeError,Ep=function(i,e){var t=arguments.length<2?yp(i):e;if(bp(t))return Sp(vp(t,i));throw Tp(gp(i)+" is not iterable")},$p=ge,In=We,kp=vs,Pp=function(i,e,t){var s,r;In(i);try{if(s=kp(i,"return"),!s){if(e==="throw")throw t;return t}s=$p(s,i)}catch(n){r=!0,s=n}if(e==="throw")throw t;if(r)throw s;return In(s),t},Ap=gs,_p=ge,wp=We,Rp=ms,Cp=dp,Dp=va,Nn=fs,Ip=Ep,Np=_l,xn=Pp,xp=TypeError,es=function(i,e){this.stopped=i,this.result=e},Ln=es.prototype,ya=function(i,e,t){var s=t&&t.that,r=!!(t&&t.AS_ENTRIES),n=!!(t&&t.IS_RECORD),o=!!(t&&t.IS_ITERATOR),l=!!(t&&t.INTERRUPTED),d=Ap(e,s),u,c,h,f,p,m,b,g=function(y){return u&&xn(u,"normal",y),new es(!0,y)},E=function(y){return r?(wp(y),l?d(y[0],y[1],g):d(y[0],y[1])):l?d(y,g):d(y)};if(n)u=i.iterator;else if(o)u=i;else{if(c=Np(i),!c)throw xp(Rp(i)+" is not iterable");if(Cp(c)){for(h=0,f=Dp(i);f>h;h++)if(p=E(i[h]),p&&Nn(Ln,p))return p;return new es(!1)}u=Ip(i,c)}for(m=n?i.next:u.next;!(b=_p(m,u)).done;){try{p=E(b.value)}catch(y){xn(u,"throw",y)}if(typeof p=="object"&&p&&Nn(Ln,p))return p}return new es(!1)},Lp=da,Op=St,Mp=Ss,Bp=function(i,e,t){var s=Lp(e);s in i?Op.f(i,s,Mp(0,t)):i[s]=t},Fp=De,Vp=ya,Up=Bp;Fp({target:"Object",stat:!0},{fromEntries:function(e){var t={};return Vp(e,function(s,r){Up(t,s,r)},{AS_ENTRIES:!0}),t}});var jp=la,Hp=jp.Object.fromEntries,Gp={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},Yp=Gp,qp=le,zp=Si,Wp=vi,On=Ht,Qp=ce,Mn=Qp("toStringTag");for(var sr in Yp){var Bn=qp[sr],rr=Bn&&Bn.prototype;rr&&zp(rr)!==Mn&&Wp(rr,Mn,sr),On[sr]=On.Array}var Kp=Hp,Jp=Kp,Xp=Jp,Zp=Xp,Ft=cs(Zp),em=fi,ys=typeof process!="undefined"&&em(process)=="process",tm=St,im=function(i,e,t){return tm.f(i,e,t)},sm=gt,rm=im,am=ce,nm=nt,Fn=am("species"),om=function(i){var e=sm(i);nm&&e&&!e[Fn]&&rm(e,Fn,{configurable:!0,get:function(){return this}})},lm=fs,um=TypeError,dm=function(i,e){if(lm(e,i))return i;throw um("Incorrect invocation")},cm=Pe,hm=ne,Gr=ua,fm=cm(Function.toString);hm(Gr.inspectSource)||(Gr.inspectSource=function(i){return fm(i)});var wl=Gr.inspectSource,pm=Pe,mm=ke,Rl=ne,vm=Si,bm=gt,Sm=wl,Cl=function(){},gm=[],Dl=bm("Reflect","construct"),Ta=/^\s*(?:class|function)\b/,ym=pm(Ta.exec),Tm=!Ta.exec(Cl),ei=function(e){if(!Rl(e))return!1;try{return Dl(Cl,gm,e),!0}catch(t){return!1}},Il=function(e){if(!Rl(e))return!1;switch(vm(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Tm||!!ym(Ta,Sm(e))}catch(t){return!0}};Il.sham=!0;var Em=!Dl||mm(function(){var i;return ei(ei.call)||!ei(Object)||!ei(function(){i=!0})||i})?Il:ei,$m=Em,km=ms,Pm=TypeError,Am=function(i){if($m(i))return i;throw Pm(km(i)+" is not a constructor")},Vn=We,_m=Am,wm=pi,Rm=ce,Cm=Rm("species"),Nl=function(i,e){var t=Vn(i).constructor,s;return t===void 0||wm(s=Vn(t)[Cm])?e:_m(s)},Dm=Pe,Im=Dm([].slice),Nm=TypeError,xm=function(i,e){if(i<e)throw Nm("Not enough arguments");return i},Lm=ps,xl=/(?:ipad|iphone|ipod).*applewebkit/i.test(Lm),Se=le,Om=nl,Mm=gs,Un=ne,Bm=Fe,Ll=ke,jn=ml,Fm=Im,Hn=oa,Vm=xm,Um=xl,jm=ys,Yr=Se.setImmediate,qr=Se.clearImmediate,Hm=Se.process,ar=Se.Dispatch,Gm=Se.Function,Gn=Se.MessageChannel,Ym=Se.String,nr=0,ni={},Yn="onreadystatechange",di,ft,or,lr;Ll(function(){di=Se.location});var Ea=function(i){if(Bm(ni,i)){var e=ni[i];delete ni[i],e()}},ur=function(i){return function(){Ea(i)}},qn=function(i){Ea(i.data)},zn=function(i){Se.postMessage(Ym(i),di.protocol+"//"+di.host)};(!Yr||!qr)&&(Yr=function(e){Vm(arguments.length,1);var t=Un(e)?e:Gm(e),s=Fm(arguments,1);return ni[++nr]=function(){Om(t,void 0,s)},ft(nr),nr},qr=function(e){delete ni[e]},jm?ft=function(i){Hm.nextTick(ur(i))}:ar&&ar.now?ft=function(i){ar.now(ur(i))}:Gn&&!Um?(or=new Gn,lr=or.port2,or.port1.onmessage=qn,ft=Mm(lr.postMessage,lr)):Se.addEventListener&&Un(Se.postMessage)&&!Se.importScripts&&di&&di.protocol!=="file:"&&!Ll(zn)?(ft=zn,Se.addEventListener("message",qn,!1)):Yn in Hn("script")?ft=function(i){jn.appendChild(Hn("script"))[Yn]=function(){jn.removeChild(this),Ea(i)}}:ft=function(i){setTimeout(ur(i),0)});var Ol={set:Yr,clear:qr},Ml=function(){this.head=null,this.tail=null};Ml.prototype={add:function(i){var e={item:i,next:null},t=this.tail;t?t.next=e:this.head=e,this.tail=e},get:function(){var i=this.head;if(i){var e=this.head=i.next;return e===null&&(this.tail=null),i.item}}};var Bl=Ml,qm=ps,zm=/ipad|iphone|ipod/i.test(qm)&&typeof Pebble!="undefined",Wm=ps,Qm=/web0s(?!.*chrome)/i.test(Wm),bt=le,Wn=gs,Km=fa.f,dr=Ol.set,Jm=Bl,Xm=xl,Zm=zm,ev=Qm,cr=ys,Qn=bt.MutationObserver||bt.WebKitMutationObserver,Kn=bt.document,Jn=bt.process,Mi=bt.Promise,Xn=Km(bt,"queueMicrotask"),zr=Xn&&Xn.value,Ct,hr,fr,Bi,Zn;if(!zr){var Fi=new Jm,Vi=function(){var i,e;for(cr&&(i=Jn.domain)&&i.exit();e=Fi.get();)try{e()}catch(t){throw Fi.head&&Ct(),t}i&&i.enter()};!Xm&&!cr&&!ev&&Qn&&Kn?(hr=!0,fr=Kn.createTextNode(""),new Qn(Vi).observe(fr,{characterData:!0}),Ct=function(){fr.data=hr=!hr}):!Zm&&Mi&&Mi.resolve?(Bi=Mi.resolve(void 0),Bi.constructor=Mi,Zn=Wn(Bi.then,Bi),Ct=function(){Zn(Vi)}):cr?Ct=function(){Jn.nextTick(Vi)}:(dr=Wn(dr,bt),Ct=function(){dr(Vi)}),zr=function(i){Fi.head||Ct(),Fi.add(i)}}var tv=zr,iv=function(i,e){try{arguments.length==1?console.error(i):console.error(i,e)}catch(t){}},$a=function(i){try{return{error:!1,value:i()}}catch(e){return{error:!0,value:e}}},sv=le,Gt=sv.Promise,Fl=typeof Deno=="object"&&Deno&&typeof Deno.version=="object",rv=Fl,av=ys,nv=!rv&&!av&&typeof window=="object"&&typeof document=="object",ov=le,oi=Gt,lv=ne,uv=cl,dv=wl,cv=ce,hv=nv,fv=Fl,pr=Ko,eo=oi&&oi.prototype,pv=cv("species"),Wr=!1,Vl=lv(ov.PromiseRejectionEvent),mv=uv("Promise",function(){var i=dv(oi),e=i!==String(oi);if(!e&&pr===66||!(eo.catch&&eo.finally))return!0;if(!pr||pr<51||!/native code/.test(i)){var t=new oi(function(n){n(1)}),s=function(n){n(function(){},function(){})},r=t.constructor={};if(r[pv]=s,Wr=t.then(function(){})instanceof s,!Wr)return!0}return!e&&(hv||fv)&&!Vl}),gi={CONSTRUCTOR:mv,REJECTION_EVENT:Vl,SUBCLASSING:Wr},Yt={},to=yt,vv=TypeError,bv=function(i){var e,t;this.promise=new i(function(s,r){if(e!==void 0||t!==void 0)throw vv("Bad Promise constructor");e=s,t=r}),this.resolve=to(e),this.reject=to(t)};Yt.f=function(i){return new bv(i)};var Sv=De,as=ys,at=le,yi=ge,gv=ba,yv=ga,Tv=om,Ev=yt,Qr=ne,$v=ze,kv=dm,Pv=Nl,Ul=Ol.set,ka=tv,Av=iv,_v=$a,wv=Bl,jl=rl,Kr=Gt,Pa=gi,Hl=Yt,Ts="Promise",Gl=Pa.CONSTRUCTOR,Rv=Pa.REJECTION_EVENT;Pa.SUBCLASSING;var mr=jl.getterFor(Ts),Cv=jl.set,Dv=Kr&&Kr.prototype,xt=Kr,vr=Dv,Yl=at.TypeError,Jr=at.document,Aa=at.process,Xr=Hl.f,Iv=Xr,Nv=!!(Jr&&Jr.createEvent&&at.dispatchEvent),ql="unhandledrejection",xv="rejectionhandled",io=0,zl=1,Lv=2,_a=1,Wl=2,Ui,so,Ov,Ql=function(i){var e;return $v(i)&&Qr(e=i.then)?e:!1},Kl=function(i,e){var t=e.value,s=e.state==zl,r=s?i.ok:i.fail,n=i.resolve,o=i.reject,l=i.domain,d,u,c;try{r?(s||(e.rejection===Wl&&Bv(e),e.rejection=_a),r===!0?d=t:(l&&l.enter(),d=r(t),l&&(l.exit(),c=!0)),d===i.promise?o(Yl("Promise-chain cycle")):(u=Ql(d))?yi(u,d,n,o):n(d)):o(t)}catch(h){l&&!c&&l.exit(),o(h)}},Jl=function(i,e){i.notified||(i.notified=!0,ka(function(){for(var t=i.reactions,s;s=t.get();)Kl(s,i);i.notified=!1,e&&!i.rejection&&Mv(i)}))},Xl=function(i,e,t){var s,r;Nv?(s=Jr.createEvent("Event"),s.promise=e,s.reason=t,s.initEvent(i,!1,!0),at.dispatchEvent(s)):s={promise:e,reason:t},!Rv&&(r=at["on"+i])?r(s):i===ql&&Av("Unhandled promise rejection",t)},Mv=function(i){yi(Ul,at,function(){var e=i.facade,t=i.value,s=ro(i),r;if(s&&(r=_v(function(){as?Aa.emit("unhandledRejection",t,e):Xl(ql,e,t)}),i.rejection=as||ro(i)?Wl:_a,r.error))throw r.value})},ro=function(i){return i.rejection!==_a&&!i.parent},Bv=function(i){yi(Ul,at,function(){var e=i.facade;as?Aa.emit("rejectionHandled",e):Xl(xv,e,i.value)})},Lt=function(i,e,t){return function(s){i(e,s,t)}},Mt=function(i,e,t){i.done||(i.done=!0,t&&(i=t),i.value=e,i.state=Lv,Jl(i,!0))},Zr=function(i,e,t){if(!i.done){i.done=!0,t&&(i=t);try{if(i.facade===e)throw Yl("Promise can't be resolved itself");var s=Ql(e);s?ka(function(){var r={done:!1};try{yi(s,e,Lt(Zr,r,i),Lt(Mt,r,i))}catch(n){Mt(r,n,i)}}):(i.value=e,i.state=zl,Jl(i,!1))}catch(r){Mt({done:!1},r,i)}}};Gl&&(xt=function(e){kv(this,vr),Ev(e),yi(Ui,this);var t=mr(this);try{e(Lt(Zr,t),Lt(Mt,t))}catch(s){Mt(t,s)}},vr=xt.prototype,Ui=function(e){Cv(this,{type:Ts,done:!1,notified:!1,parent:!1,reactions:new wv,rejection:!1,state:io,value:void 0})},Ui.prototype=gv(vr,"then",function(e,t){var s=mr(this),r=Xr(Pv(this,xt));return s.parent=!0,r.ok=Qr(e)?e:!0,r.fail=Qr(t)&&t,r.domain=as?Aa.domain:void 0,s.state==io?s.reactions.add(r):ka(function(){Kl(r,s)}),r.promise}),so=function(){var i=new Ui,e=mr(i);this.promise=i,this.resolve=Lt(Zr,e),this.reject=Lt(Mt,e)},Hl.f=Xr=function(i){return i===xt||i===Ov?new so(i):Iv(i)});Sv({global:!0,constructor:!0,wrap:!0,forced:Gl},{Promise:xt});yv(xt,Ts,!1,!0);Tv(Ts);var Fv=ce,Zl=Fv("iterator"),eu=!1;try{var Vv=0,ao={next:function(){return{done:!!Vv++}},return:function(){eu=!0}};ao[Zl]=function(){return this},Array.from(ao,function(){throw 2})}catch(i){}var Uv=function(i,e){if(!e&&!eu)return!1;var t=!1;try{var s={};s[Zl]=function(){return{next:function(){return{done:t=!0}}}},i(s)}catch(r){}return t},jv=Gt,Hv=Uv,Gv=gi.CONSTRUCTOR,tu=Gv||!Hv(function(i){jv.all(i).then(void 0,function(){})}),Yv=De,qv=ge,zv=yt,Wv=Yt,Qv=$a,Kv=ya,Jv=tu;Yv({target:"Promise",stat:!0,forced:Jv},{all:function(e){var t=this,s=Wv.f(t),r=s.resolve,n=s.reject,o=Qv(function(){var l=zv(t.resolve),d=[],u=0,c=1;Kv(e,function(h){var f=u++,p=!1;c++,qv(l,t,h).then(function(m){p||(p=!0,d[f]=m,--c||r(d))},n)}),--c||r(d)});return o.error&&n(o.value),s.promise}});var Xv=De,Zv=gi.CONSTRUCTOR,no=Gt;no&&no.prototype;Xv({target:"Promise",proto:!0,forced:Zv,real:!0},{catch:function(i){return this.then(void 0,i)}});var eb=De,tb=ge,ib=yt,sb=Yt,rb=$a,ab=ya,nb=tu;eb({target:"Promise",stat:!0,forced:nb},{race:function(e){var t=this,s=sb.f(t),r=s.reject,n=rb(function(){var o=ib(t.resolve);ab(e,function(l){tb(o,t,l).then(s.resolve,r)})});return n.error&&r(n.value),s.promise}});var ob=De,lb=ge,ub=Yt,db=gi.CONSTRUCTOR;ob({target:"Promise",stat:!0,forced:db},{reject:function(e){var t=ub.f(this);return lb(t.reject,void 0,e),t.promise}});var cb=We,hb=ze,fb=Yt,iu=function(i,e){if(cb(i),hb(e)&&e.constructor===i)return e;var t=fb.f(i),s=t.resolve;return s(e),t.promise},pb=De,mb=gt,vb=qd,bb=Gt,Sb=gi.CONSTRUCTOR,gb=iu,yb=mb("Promise"),Tb=!Sb;pb({target:"Promise",stat:!0,forced:vb},{resolve:function(e){return gb(Tb&&this===yb?bb:this,e)}});var Eb=De,ea=Gt,$b=ke,kb=gt,Pb=ne,Ab=Nl,oo=iu,_b=ea&&ea.prototype,wb=!!ea&&$b(function(){_b.finally.call({then:function(){}},function(){})});Eb({target:"Promise",proto:!0,real:!0,forced:wb},{finally:function(i){var e=Ab(this,kb("Promise")),t=Pb(i);return this.then(t?function(s){return oo(e,i()).then(function(){return s})}:i,t?function(s){return oo(e,i()).then(function(){throw s})}:i)}});var Rb=gt,wa=Rb,Cb=wa,Db=Cb("Promise","finally"),Ib=Db,Nb=Ib,xb=Nb,Lb=xb,Es=cs(Lb),ae;(function(i){i[i.OFFSET_P=0]="OFFSET_P",i[i.PLAYBACK_SHIFT=1]="PLAYBACK_SHIFT",i[i.DASH_CMAF_OFFSET_P=2]="DASH_CMAF_OFFSET_P"})(ae||(ae={}));var Re=(i,e=0,t=ae.OFFSET_P)=>{switch(t){case ae.OFFSET_P:return i.replace("_offset_p",e===0?"":"_"+e.toFixed(0));case ae.PLAYBACK_SHIFT:{if(e===0)return i;const s=new URL(i);return s.searchParams.append("playback_shift",e.toFixed(0)),s.toString()}case ae.DASH_CMAF_OFFSET_P:{if(e===0)return i;const s=new URL(i);return s.searchParams.set("offset_p",e.toFixed(0)),s.toString()}default:a.assertNever(t)}return i};const lo=(i,e)=>{var t;switch(e){case ae.OFFSET_P:return NaN;case ae.PLAYBACK_SHIFT:{const s=new URL(i);return Number(s.searchParams.get("playback_shift"))}case ae.DASH_CMAF_OFFSET_P:{const s=new URL(i);return Number((t=s.searchParams.get("offset_p"))!==null&&t!==void 0?t:0)}default:a.assertNever(e)}};var P=(i,e,t=!1)=>{const s=i.getTransition();(t||!s||s.to===e)&&i.setState(e)};class X{constructor(e){this.transitionStarted$=new a.Subject,this.transitionEnded$=new a.Subject,this.transitionUpdated$=new a.Subject,this.forceChanged$=new a.Subject,this.stateChangeStarted$=a.merge(this.transitionStarted$,this.transitionUpdated$),this.stateChangeEnded$=a.merge(this.transitionEnded$,this.forceChanged$),this.state=e,this.prevState=void 0}setState(e){const t=this.transition,s=this.state;this.transition=void 0,this.prevState=s,this.state=e,t?t.to===e?this.transitionEnded$.next(t):this.forceChanged$.next({from:t.from,to:e,canceledTransition:t}):this.forceChanged$.next({from:s,to:e,canceledTransition:t})}startTransitionTo(e){const t=this.transition,s=this.state;s===e||a.isNonNullable(t)&&t.to===e||(this.prevState=s,this.state=e,t?(this.transition={from:t.from,to:e,canceledTransition:t},this.transitionUpdated$.next(this.transition)):(this.transition={from:s,to:e},this.transitionStarted$.next(this.transition)))}getTransition(){return this.transition}getState(){return this.state}getPrevState(){return this.prevState}}const Ob=i=>{switch(i){case exports.VideoFormat.MPEG:case exports.VideoFormat.DASH:case exports.VideoFormat.DASH_SEP:case exports.VideoFormat.DASH_ONDEMAND:case exports.VideoFormat.DASH_WEBM:case exports.VideoFormat.DASH_WEBM_AV1:case exports.VideoFormat.HLS:case exports.VideoFormat.HLS_ONDEMAND:return!1;case exports.VideoFormat.DASH_LIVE:case exports.VideoFormat.DASH_LIVE_CMAF:case exports.VideoFormat.HLS_LIVE:case exports.VideoFormat.HLS_LIVE_CMAF:case exports.VideoFormat.DASH_LIVE_WEBM:case exports.VideoFormat.WEB_RTC_LIVE:return!0;default:return a.assertNever(i)}};var O;(function(i){i.STOPPED="stopped",i.READY="ready",i.PLAYING="playing",i.PAUSED="paused"})(O||(O={}));const Mb=5,Bb=5,Fb=500,uo=7e3;class Vb{constructor(e){this.subscription=new a.Subscription,this.loadMediaTimeoutSubscription=new a.Subscription,this.videoState=new X(O.STOPPED),this.syncPlayback=()=>{const s=this.videoState.getState(),r=this.videoState.getTransition(),n=this.params.desiredState.playbackState.getState(),o=this.params.desiredState.playbackState.getTransition(),l=this.params.desiredState.seekState.getState();if(this.log({message:`[syncPlayback] videoState: ${s}; videoTransition: ${JSON.stringify(r)}; desiredPlaybackState: ${n}; desiredPlaybackStateTransition: ${this.params.desiredState.playbackState.getTransition()}; seekState: ${JSON.stringify(l)};`}),n===exports.PlaybackState.STOPPED){s!==O.STOPPED&&(this.videoState.startTransitionTo(O.STOPPED),this.stop());return}if(!r){if((o==null?void 0:o.to)!==exports.PlaybackState.PAUSED&&l.state===B.Requested&&s!==O.STOPPED){this.seek(l.position/1e3);return}switch(n){case exports.PlaybackState.READY:{switch(s){case O.PLAYING:case O.PAUSED:case O.READY:break;case O.STOPPED:this.videoState.startTransitionTo(O.READY),this.prepare();break;default:a.assertNever(s)}break}case exports.PlaybackState.PLAYING:{switch(s){case O.PLAYING:break;case O.PAUSED:this.videoState.startTransitionTo(O.PLAYING),this.params.connection.remotePlayerController.playOrPause();break;case O.READY:this.videoState.startTransitionTo(O.PLAYING),this.params.connection.remotePlayerController.playOrPause();break;case O.STOPPED:this.videoState.startTransitionTo(O.READY),this.prepare();break;default:a.assertNever(s)}break}case exports.PlaybackState.PAUSED:{switch(s){case O.PLAYING:this.videoState.startTransitionTo(O.PAUSED),this.params.connection.remotePlayerController.playOrPause();break;case O.PAUSED:break;case O.READY:this.videoState.startTransitionTo(O.PAUSED),this.videoState.setState(O.PAUSED);break;case O.STOPPED:this.videoState.startTransitionTo(O.READY),this.prepare();break;default:a.assertNever(s)}break}default:a.assertNever(n)}}},this.params=e,this.log=this.params.dependencies.logger.createComponentLog("ChromecastProvider"),this.log({message:`constructor, format: ${e.format}`}),this.params.output.isLive$.next(Ob(e.format)),this.params.output.isAudioAvailable$.next(!0),this.handleRemoteVolumeChange({volume:this.params.connection.remotePlayer.volumeLevel,muted:this.params.connection.remotePlayer.isMuted});const t=this.params.connection.session.getMediaSession();t&&this.restoreSession(t),this.subscribe()}destroy(){this.log({message:"[destroy]"}),this.subscription.unsubscribe()}subscribe(){this.subscription.add(this.loadMediaTimeoutSubscription);const e=new a.Subscription;this.subscription.add(e),this.subscription.add(a.merge(this.videoState.stateChangeStarted$.pipe(a.map(r=>`stateChangeStarted$ ${JSON.stringify(r)}`)),this.videoState.stateChangeEnded$.pipe(a.map(r=>`stateChangeEnded$ ${JSON.stringify(r)}`))).subscribe(r=>this.log({message:`[videoState] ${r}`})));const t=(r,n)=>this.subscription.add(r.subscribe(n));if(this.params.output.isLive$.getValue())this.params.output.position$.next(0),this.params.output.duration$.next(0);else{const r=new a.Subject;e.add(r.pipe(a.debounce(Fb)).subscribe(()=>{this.params.output.seekedEvent$.next()}));let n=NaN;e.add(a.fromEvent(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.CURRENT_TIME_CHANGED).subscribe(o=>{this.logRemoteEvent(o);const l=o.value;this.params.output.position$.next(l),(this.params.desiredState.seekState.getState().state===B.Applying||Math.abs(l-n)>Mb)&&r.next(l),n=l})),e.add(a.fromEvent(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.DURATION_CHANGED).subscribe(o=>{this.logRemoteEvent(o),this.params.output.duration$.next(o.value)}))}t(a.fromEvent(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED),r=>{this.logRemoteEvent(r),r.value?this.handleRemoteReady():(this.handleRemoteStop(),e.unsubscribe())}),t(a.fromEvent(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED),r=>{this.logRemoteEvent(r),r.value?this.handleRemotePause():this.handleRemotePlay()}),t(a.fromEvent(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED),r=>{this.logRemoteEvent(r);const{remotePlayer:n}=this.params.connection,o=r.value,l=this.params.output.isBuffering$.getValue(),d=o===chrome.cast.media.PlayerState.BUFFERING;switch(l!==d&&this.params.output.isBuffering$.next(d),o){case chrome.cast.media.PlayerState.IDLE:!this.params.output.isLive$.getValue()&&n.duration-n.currentTime<Bb&&this.params.output.endedEvent$.next(),this.handleRemoteStop(),P(this.params.desiredState.playbackState,exports.PlaybackState.STOPPED);break;case chrome.cast.media.PlayerState.PAUSED:{this.handleRemotePause();break}case chrome.cast.media.PlayerState.PLAYING:this.handleRemotePlay();break;case chrome.cast.media.PlayerState.BUFFERING:break;default:a.assertNever(o)}}),t(a.fromEvent(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.VOLUME_LEVEL_CHANGED),r=>{this.logRemoteEvent(r),this.handleRemoteVolumeChange({volume:r.value})}),t(a.fromEvent(this.params.connection.remotePlayerController,cast.framework.RemotePlayerEventType.IS_MUTED_CHANGED),r=>{this.logRemoteEvent(r),this.handleRemoteVolumeChange({muted:r.value})});const s=a.merge(this.params.desiredState.playbackState.stateChangeStarted$,this.params.desiredState.seekState.stateChangeEnded$,this.videoState.stateChangeEnded$,a.observableFrom(["init"])).pipe(a.debounce(0));t(s,this.syncPlayback)}restoreSession(e){this.log({message:"restoreSession"});const{remotePlayer:t}=this.params.connection;if(e.playerState!==chrome.cast.media.PlayerState.IDLE){t.isPaused?(this.videoState.setState(O.PAUSED),P(this.params.desiredState.playbackState,exports.PlaybackState.PAUSED)):(this.videoState.setState(O.PLAYING),P(this.params.desiredState.playbackState,exports.PlaybackState.PLAYING));const s=this.params.output.isLive$.getValue();this.params.output.duration$.next(s?0:t.duration),this.params.output.position$.next(s?0:t.currentTime),this.params.desiredState.seekState.setState({state:B.None})}}prepare(){const e=this.params.format;this.log({message:`[prepare] format: ${e}`});const t=this.createMediaInfo(e),s=this.createLoadRequest(t);this.loadMedia(s)}handleRemotePause(){const e=this.videoState.getState(),t=this.videoState.getTransition();((t==null?void 0:t.to)===O.PAUSED||e===O.PLAYING)&&(this.videoState.setState(O.PAUSED),P(this.params.desiredState.playbackState,exports.PlaybackState.PAUSED))}handleRemotePlay(){const e=this.videoState.getState(),t=this.videoState.getTransition();((t==null?void 0:t.to)===O.PLAYING||e===O.PAUSED)&&(this.videoState.setState(O.PLAYING),P(this.params.desiredState.playbackState,exports.PlaybackState.PLAYING))}handleRemoteReady(){var e;const t=this.videoState.getTransition();(t==null?void 0:t.to)===O.READY&&this.videoState.setState(O.READY),((e=this.params.desiredState.playbackState.getTransition())===null||e===void 0?void 0:e.to)===exports.PlaybackState.READY&&P(this.params.desiredState.playbackState,exports.PlaybackState.READY)}handleRemoteStop(){this.videoState.getState()!==O.STOPPED&&this.videoState.setState(O.STOPPED)}handleRemoteVolumeChange(e){var t,s;const r=this.params.output.volume$.getValue(),n={volume:(t=e.volume)!==null&&t!==void 0?t:r.volume,muted:(s=e.muted)!==null&&s!==void 0?s:r.muted};(n.volume!==r.volume||n.muted!==n.muted)&&this.params.output.volume$.next(n)}seek(e){this.params.output.willSeekEvent$.next();const{remotePlayer:t,remotePlayerController:s}=this.params.connection;t.currentTime=e,s.seek()}stop(){const{remotePlayerController:e}=this.params.connection;e.stop()}createMediaInfo(e){var t;const s=this.params.source;let r,n,o;switch(e){case exports.VideoFormat.MPEG:{const c=s[e];a.assertNonNullable(c);const h=a.getHighestQuality(Object.keys(c));a.assertNonNullable(h);const f=c[h];a.assertNonNullable(f),r=f,n="video/mp4",o=chrome.cast.media.StreamType.BUFFERED;break}case exports.VideoFormat.HLS:case exports.VideoFormat.HLS_ONDEMAND:{const c=s[e];a.assertNonNullable(c),r=c.url,n="application/x-mpegurl",o=chrome.cast.media.StreamType.BUFFERED;break}case exports.VideoFormat.DASH_SEP:case exports.VideoFormat.DASH_ONDEMAND:case exports.VideoFormat.DASH_WEBM:case exports.VideoFormat.DASH_WEBM_AV1:{const c=s[e];a.assertNonNullable(c),r=c.url,n="application/dash+xml",o=chrome.cast.media.StreamType.BUFFERED;break}case exports.VideoFormat.DASH_LIVE_CMAF:{const c=s[e];a.assertNonNullable(c),r=c.url,n="application/dash+xml",o=chrome.cast.media.StreamType.LIVE;break}case exports.VideoFormat.HLS_LIVE:case exports.VideoFormat.HLS_LIVE_CMAF:{const c=s[e];a.assertNonNullable(c),r=Re(c.url),n="application/x-mpegurl",o=chrome.cast.media.StreamType.LIVE;break}case exports.VideoFormat.DASH:case exports.VideoFormat.DASH_LIVE:case exports.VideoFormat.WEB_RTC_LIVE:{const c="Unsupported format for Chromecast",h=new Error(c);throw this.params.output.error$.next({id:"ChromecastProvider.createMediaInfo()",category:a.ErrorCategory.VIDEO_PIPELINE,message:c,thrown:h}),h}case exports.VideoFormat.DASH_LIVE_WEBM:throw new Error("DASH_LIVE_WEBM is no longer supported");default:return a.assertNever(e)}const l=new chrome.cast.media.MediaInfo((t=this.params.meta.videoId)!==null&&t!==void 0?t:r,n);l.contentUrl=r,l.streamType=o,l.metadata=new chrome.cast.media.GenericMediaMetadata;const{title:d,subtitle:u}=this.params.meta;return a.isNonNullable(d)&&(l.metadata.title=d),a.isNonNullable(u)&&(l.metadata.subtitle=u),l}createLoadRequest(e){const t=new chrome.cast.media.LoadRequest(e);t.autoplay=!1;const s=this.params.desiredState.seekState.getState();return s.state===B.Applying||s.state===B.Requested?t.currentTime=this.params.output.isLive$.getValue()?0:s.position/1e3:t.currentTime=0,t}loadMedia(e){const t=this.params.connection.session.loadMedia(e),s=new Promise((r,n)=>{this.loadMediaTimeoutSubscription.add(a.timeout(uo).subscribe(()=>n(`timeout(${uo})`)))});Es(Promise.race([t,s]).then(()=>{this.log({message:`[loadMedia] completed, format: ${this.params.format}`}),this.params.desiredState.seekState.getState().state===B.Applying&&this.params.output.seekedEvent$.next(),this.handleRemoteReady()},r=>{const n=`[prepare] loadMedia failed, format: ${this.params.format}, reason: ${r}`;this.log({message:n}),this.params.output.error$.next({id:"ChromecastProvider.loadMedia",category:a.ErrorCategory.VIDEO_PIPELINE,message:n,thrown:r})}),()=>{this.loadMediaTimeoutSubscription.unsubscribe()})}logRemoteEvent(e){this.log({message:`[remoteEvent] ${JSON.stringify(e)}`})}}var Ub=i=>{let e,t=!1,s=!1;i.on("playbackTimeUpdated",({timeToEnd:r})=>{s=r<=3,t&&s&&(e==null||e())}),i.extend("MediaSourceController",function(){const{parent:r}=this,n=r.signalEndOfStream;return{signalEndOfStream:o=>{t=!0,e=()=>n(o),t&&s&&(e==null||e())}}},!0)},jb=i=>{const e=new a.ValueSubject(1/0),t=new a.Subject,s=new a.ValueSubject(void 0),r=new a.ValueSubject(void 0);let n=NaN,o=!1;const l=()=>{n=Date.now(),o=!1},d=c=>{var h,f,p,m,b;const g=Ft(c.getAllResponseHeaders().trim().split(/[\n\r]+/).map(v=>v.split(": ")));if("x-playback-duration"in g||"x-playback-duration-millis"in g){const v=parseInt((h=c.getResponseHeader("X-Playback-Duration"))!==null&&h!==void 0?h:"",10),S=parseInt((f=c.getResponseHeader("X-Playback-Duration-Millis"))!==null&&f!==void 0?f:"",10),T=(p=S!=null?S:v*1e3)!==null&&p!==void 0?p:NaN;a.isNonNullable(T)&&!isNaN(T)&&e.next(T)}const E=(m=g["x-delivery-type"])!==null&&m!==void 0?m:exports.HttpConnectionType.HTTP1,y=(b={1:!0,0:!1}[g["x-reused"]])!==null&&b!==void 0?b:void 0;s.next(E),r.next(y)},u=c=>{c.readyState>=2&&!o&&(o=!0,t.next(Date.now()-n))};return i.extend("XHRLoader",function(){const{parent:c}=this,h=c.load.bind(c);return{load:function(f){if(f.request.type==="MPD"){const p=f.onload,m=f.progress;f.onload=function(...b){return d(this),p(...b)},f.progress=function(...b){return u(this),m(...b)},l()}return h(f)}}},!0),{playbackDuration$:e,ping$:t,connectionReused$:r,connectionType$:s}},Vt=i=>{const e=new URL(i);return e.searchParams.set("quic","1"),e.toString()},Hb=i=>i.extend("RequestModifier",()=>({modifyRequestURL:Vt}),!0),Gb=i=>{i.extend("HTTPLoader",function(){const{parent:e}=this,t=e.load;return{load:s=>{if(s.request&&s.request.range){const[r,n]=s.request.range.split("-").map(l=>parseInt(l,10)),o=new URL(s.request.url,location.href);o.searchParams.append("bytes",`${r}-${n}`),s.request.url=o.toString(),s.request.range=void 0}t(s)}}},!0)};const Ce=(i,e,t,{equal:s=(o,l)=>o===l,changed$:r,onError:n}={})=>{const o=i.getState(),l=e(),d=a.isNullable(r),u=new a.Subscription;return r&&u.add(r.subscribe(c=>{const h=i.getState();s(c,h)&&i.setState(c)},n)),s(l,o)||(t(o),d&&i.setState(o)),u.add(i.stateChangeStarted$.subscribe(c=>{t(c.to),d&&i.setState(c.to)},n)),u},Tt=(i,e,t)=>Ce(e,()=>i.loop,s=>{a.isNonNullable(s)&&(i.loop=s)},{onError:t}),Qe=(i,e,t,s)=>Ce(e,()=>({muted:i.muted,volume:i.volume}),r=>{a.isNonNullable(r)&&(i.muted=r.muted,i.volume=r.volume)},{equal:(r,n)=>r===n||(r==null?void 0:r.muted)===(n==null?void 0:n.muted)&&(r==null?void 0:r.volume)===(n==null?void 0:n.volume),changed$:t,onError:s}),ot=(i,e,t,s)=>Ce(e,()=>i.playbackRate,r=>{a.isNonNullable(r)&&(i.playbackRate=r)},{changed$:t,onError:s}),Yb=i=>["__",i.language,i.label].join("|"),qb=(i,e)=>{if(i.id===e)return!0;const[t,s,r]=e.split("|");return i.language===s&&i.label===r};class Ve{constructor(){this.available$=new a.Subject,this.current$=new a.ValueSubject(void 0),this.error$=new a.Subject,this.subscription=new a.Subscription,this.externalTracks=new Map,this.internalTracks=new Map}connect(e,t,s){this.video=e,this.cueSettings=t.textTrackCuesSettings,this.subscribe();const r=n=>{this.error$.next({id:"TextTracksManager",category:a.ErrorCategory.WTF,message:"Generic HtmlVideoTextTrackManager error",thrown:n})};this.subscription.add(this.available$.subscribe(s.availableTextTracks$)),this.subscription.add(this.current$.subscribe(s.currentTextTrack$)),this.subscription.add(this.error$.subscribe(s.error$)),this.subscription.add(Ce(t.internalTextTracks,()=>Object.values(this.internalTracks),n=>{a.isNonNullable(n)&&this.setInternal(n)},{equal:(n,o)=>a.isNonNullable(n)&&a.isNonNullable(o)&&n.length===o.length&&n.every(({id:l},d)=>l===o[d].id),changed$:this.available$.pipe(a.map(n=>n.filter(({type:o})=>o==="internal"))),onError:r})),this.subscription.add(Ce(t.externalTextTracks,()=>Object.values(this.externalTracks),n=>{a.isNonNullable(n)&&this.setExternal(n)},{equal:(n,o)=>a.isNonNullable(n)&&a.isNonNullable(o)&&n.length===o.length&&n.every(({id:l},d)=>l===o[d].id),changed$:this.available$.pipe(a.map(n=>n.filter(({type:o})=>o==="external"))),onError:r})),this.subscription.add(Ce(t.currentTextTrack,()=>{if(this.video)return;const n=this.htmlTextTracksAsArray().find(({mode:o})=>o==="showing");return n&&this.htmlTextTrackToITextTrack(n).id},n=>this.select(n),{changed$:this.current$,onError:r})),this.subscription.add(Ce(t.textTrackCuesSettings,()=>({}),()=>{if(this.video)for(const n of this.htmlTextTracksAsArray())this.applyCueSettings(n.cues),this.applyCueSettings(n.activeCues)}))}subscribe(){a.assertNonNullable(this.video);const{textTracks:e}=this.video;this.subscription.add(a.fromEvent(e,"addtrack").subscribe(()=>{const s=this.current$.getValue();s&&this.select(s)})),this.subscription.add(a.merge(a.fromEvent(e,"addtrack"),a.fromEvent(e,"removetrack"),a.observableFrom(["init"])).pipe(a.map(()=>this.htmlTextTracksAsArray().map(s=>this.htmlTextTrackToITextTrack(s))),a.filterChanged((s,r)=>s.length===r.length&&s.every(({id:n},o)=>n===r[o].id))).subscribe(this.available$)),this.subscription.add(a.merge(a.fromEvent(e,"change"),a.observableFrom(["init"])).pipe(a.map(()=>this.htmlTextTracksAsArray().find(({mode:s})=>s==="showing")),a.map(s=>s&&this.htmlTextTrackToITextTrack(s).id),a.filterChanged()).subscribe(this.current$));const t=s=>{var r,n;return this.applyCueSettings((n=(r=s.target)===null||r===void 0?void 0:r.activeCues)!==null&&n!==void 0?n:null)};this.subscription.add(a.fromEvent(e,"addtrack").subscribe(s=>{var r,n;(r=s.track)===null||r===void 0||r.addEventListener("cuechange",t);const o=l=>{var d,u,c,h,f;const p=(u=(d=l.target)===null||d===void 0?void 0:d.cues)!==null&&u!==void 0?u:null;p&&p.length&&(this.applyCueSettings((h=(c=l.target)===null||c===void 0?void 0:c.cues)!==null&&h!==void 0?h:null),(f=l.target)===null||f===void 0||f.removeEventListener("cuechange",o))};(n=s.track)===null||n===void 0||n.addEventListener("cuechange",o)})),this.subscription.add(a.fromEvent(e,"removetrack").subscribe(s=>{var r;(r=s.track)===null||r===void 0||r.removeEventListener("cuechange",t)}))}applyCueSettings(e){if(!e||!e.length)return;const t=this.cueSettings.getState();for(const s of Array.from(e)){const r=s;a.isNonNullable(t.align)&&(r.align=t.align),a.isNonNullable(t.position)&&(r.position=t.position),a.isNonNullable(t.size)&&(r.size=t.size),a.isNonNullable(t.line)&&(r.line=t.line)}}htmlTextTracksAsArray(e=!1){a.assertNonNullable(this.video);const t=[...this.video.textTracks];return e?t:t.filter(Ve.isHealthyTrack)}htmlTextTrackToITextTrack(e){var t,s;const{language:r,label:n}=e,o=e.id?e.id:Yb(e),l=this.externalTracks.has(o),d=o.includes("auto");return l?{id:o,type:"external",isAuto:d,language:r,label:n,url:(t=this.externalTracks.get(o))===null||t===void 0?void 0:t.url}:{id:o,type:"internal",isAuto:d,language:r,label:n,url:(s=this.internalTracks.get(o))===null||s===void 0?void 0:s.url}}static isHealthyTrack(e){return!(e.kind==="metadata"||e.groupId||e.id===""&&e.label===""&&e.language==="")}setExternal(e){this.internalTracks.size>0&&Array.from(this.internalTracks).forEach(([,t])=>this.detach(t)),e.filter(({id:t})=>!this.externalTracks.has(t)).forEach(t=>this.attach(t)),Array.from(this.externalTracks).filter(([t])=>!e.find(s=>s.id===t)).forEach(([,t])=>this.detach(t))}setInternal(e){const t=[...this.externalTracks];e.filter(({id:s,language:r,isAuto:n})=>!this.internalTracks.has(s)&&!t.some(([,o])=>o.language===r&&o.isAuto===n)).forEach(s=>this.attach(s)),Array.from(this.internalTracks).filter(([s])=>!e.find(r=>r.id===s)).forEach(([,s])=>this.detach(s))}select(e){a.assertNonNullable(this.video);for(const t of this.htmlTextTracksAsArray(!0))t.mode="showing";for(const t of this.htmlTextTracksAsArray(!0))(a.isNullable(e)||!qb(t,e))&&(t.mode="disabled")}destroy(){if(this.subscription.unsubscribe(),this.video)for(const e of Array.from(this.video.getElementsByTagName("track"))){const t=e.getAttribute("id");t&&this.externalTracks.has(t)&&this.video.removeChild(e)}this.externalTracks.clear()}attach(e){a.assertNonNullable(this.video);const t=document.createElement("track");t.setAttribute("src",e.url),t.setAttribute("id",e.id),e.label&&t.setAttribute("label",e.label),e.language&&t.setAttribute("srclang",e.language),e.type==="external"?this.externalTracks.set(e.id,e):e.type==="internal"&&this.internalTracks.set(e.id,e),this.video.appendChild(t)}detach(e){a.assertNonNullable(this.video);const t=Array.prototype.find.call(this.video.getElementsByTagName("track"),s=>s.getAttribute("id")===e.id);t&&this.video.removeChild(t),e.type==="external"?this.externalTracks.delete(e.id):e.type==="internal"&&this.internalTracks.delete(e.id)}}const Ra=i=>{i.removeAttribute("src"),i.load()},zb=i=>{try{i.pause(),i.playbackRate=0,Ra(i),i.remove()}catch(e){console.error(e)}};class Wb{constructor(){this.attribute="data-pool-reused"}get(e){return e.hasAttribute(this.attribute)}set(e,t){e.toggleAttribute(this.attribute,t)}delete(e){e.removeAttribute(this.attribute)}}const ta=window.WeakMap?new WeakMap:new Wb,Ke=i=>{let e=i.querySelector("video");const t=!!e;return e?Ra(e):(e=document.createElement("video"),i.appendChild(e)),ta.set(e,t),e.setAttribute("crossorigin","anonymous"),e.setAttribute("playsinline","playsinline"),e.controls=!1,e.setAttribute("poster","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="),e},Je=i=>{const e=ta.get(i);ta.delete(i),e?Ra(i):zb(i)};class $s{constructor(){this.pausedTime=0,this.streamOffset=0,this.pauseTimestamp=0}getTotalPausedTime(){return this.pausedTime+this.getCurrentPausedTime()}getCurrentPausedTime(){return this.pauseTimestamp>0?Date.now()-this.pauseTimestamp:0}getStreamOffset(){return this.streamOffset}getTotalOffset(){return this.getTotalPausedTime()+this.streamOffset}pause(){this.pauseTimestamp===0&&(this.pauseTimestamp=Date.now())}resume(){this.pauseTimestamp>0&&(this.pausedTime+=this.getCurrentPausedTime(),this.pauseTimestamp=0)}resetTo(e,t=!1){this.streamOffset=e,this.pauseTimestamp=0,this.pausedTime=0,t&&this.pause()}}const su=i=>{var e;let t=i;for(;!(t instanceof Document)&&!(t instanceof ShadowRoot)&&t!==null;)t=t==null?void 0:t.parentNode;return(e=t)!==null&&e!==void 0?e:void 0},co=i=>{const e=su(i);return!!(e&&e.fullscreenElement&&e.fullscreenElement===i)},Qb=i=>{const e=su(i);return!!(e&&e.pictureInPictureElement&&e.pictureInPictureElement===i)},ia=3;class Kb{constructor(e){this._buffer=[],this._source=e}fill(){this._buffer=[];const e=this._source.currentTime;for(let t=0,s=this._source.buffered.length;t<s;t++){let r=this._source.buffered.start(t);const n=this._source.buffered.end(t);r>e&&r-e<ia&&(r=e),this._buffer.push({from:r,to:n,i:t})}return this._buffer.sort(function(t,s){return t.from-s.from}),this._buffer}getByTime(e){return this._buffer.find(t=>e>=t.from&&e<t.to)}getNextWithGap(e,t){const s=this.getNext(e);if(s&&s.from-e.to<(t||ia))return s}getNext(e){let t=this._buffer.indexOf(e);if(~t&&this._buffer.length-1>t)return this._buffer[++t]}smartRemove(e,t,s){this._buffer.forEach(({from:r,to:n})=>{const o=r>=e&&r<t,l=n>=e&&n<t;o&&l||(o?s(t,n):l?s(r,e):r<e&&n>t?(s(t,n),s(r,e)):s(r,n))})}destroy(){this._buffer=[]}}var ru=(i,e,t=ia)=>{let s=0,r=0;for(let n=0;n<i.length;n++){const o=i.start(n),l=i.end(n);if(o<=e&&e<=l){if(s=o,r=l,!t)return{from:s,to:r};for(let d=n-1;d>=0;d--)i.end(d)+t>=s&&(s=i.start(d));for(let d=n+1;d<i.length;d++)i.start(d)-t<=r&&(r=i.end(d))}}return{from:s,to:r}};const Xe=i=>{const e=v=>a.fromEvent(i,v).pipe(a.mapTo(void 0)),t=["waiting","pause","canplay","play","canplaythrough","playing","seeking","seeked","ended"],s=a.merge(...t.map(v=>a.fromEvent(i,v))).pipe(a.map(v=>v.type==="ended"?i.readyState<2:i.readyState<3),a.filterChanged()),r=a.merge(a.fromEvent(i,"progress"),a.fromEvent(i,"timeupdate")).pipe(a.map(()=>ru(i.buffered,i.currentTime))),o=a.getCurrentBrowser().browser===a.CurrentClientBrowser.Safari?a.combine({play:e("play").pipe(a.once()),playing:e("playing")}).pipe(a.mapTo(void 0)):e("playing"),l=a.fromEvent(i,"volumechange").pipe(a.map(()=>({muted:i.muted,volume:i.volume}))),d=a.fromEvent(i,"ratechange").pipe(a.map(()=>i.playbackRate)),u=a.fromEvent(i,"error").pipe(a.filter(()=>!!(i.error||i.played.length)),a.map(()=>{var v;const S=i.error;return{id:S?`MediaError#${S.code}`:"HtmlVideoError",category:a.ErrorCategory.VIDEO_PIPELINE,message:S?S.message:"Error event from HTML video element",thrown:(v=i.error)!==null&&v!==void 0?v:void 0}})),c=a.fromEvent(i,"timeupdate").pipe(a.map(()=>i.currentTime)),h=new a.Subject,f=.3;let p;c.subscribe(v=>{i.loop&&a.isNonNullable(p)&&a.isNonNullable(v)&&p>=i.duration-f&&v<=f&&h.next(p),p=v});const m=a.fromEvent(i,"enterpictureinpicture"),b=a.fromEvent(i,"leavepictureinpicture"),g=new a.ValueSubject(Qb(i));m.subscribe(()=>g.next(!0)),b.subscribe(()=>g.next(!1));const E=new a.ValueSubject(co(i));return a.fromEvent(i,"fullscreenchange").pipe(a.map(()=>co(i))).subscribe(E),{playing$:o,pause$:e("pause").pipe(a.filter(()=>!i.error)),canplay$:e("canplay"),ended$:e("ended"),looped$:h,error$:u,seeked$:e("seeked"),seeking$:e("seeking"),progress$:e("progress"),loadStart$:e("loadstart"),loadedMetadata$:e("loadedmetadata"),loadedData$:e("loadeddata"),timeUpdate$:c,durationChange$:a.fromEvent(i,"durationchange").pipe(a.map(()=>i.duration)),isBuffering$:s,currentBuffer$:r,volumeState$:l,playbackRateState$:d,inPiP$:g,inFullscreen$:E}},Ca=i=>{if(i.includes("/")){const e=i.split("/");return parseInt(e[0])/parseInt(e[1])}else return parseFloat(i)};var Jb=De,Xb=bs,Zb=va,eS=ma;Jb({target:"Array",proto:!0},{at:function(e){var t=Xb(this),s=Zb(t),r=eS(e),n=r>=0?r:s+r;return n<0||n>=s?void 0:t[n]}});var tS=wa,iS=tS("Array","at"),sS=iS,rS=sS,aS=rS,nS=aS,Le=cs(nS);let Da=!1,He={};const oS=i=>{Da=i},lS=()=>{He={}},uS=i=>{i(He)},ji=(i,e)=>{var t;Da&&(He.meta=(t=He.meta)!==null&&t!==void 0?t:{},He.meta[i]=e)};class Oe{constructor(e){this.name=e}next(e){var t,s;if(!Da)return;He.series=(t=He.series)!==null&&t!==void 0?t:{};const r=(s=He.series[this.name])!==null&&s!==void 0?s:[];r.push([Date.now(),e]),He.series[this.name]=r}}var mt;(function(i){i.FitsContainer="FitsContainer",i.FitsThroughput="FitsThroughput",i.Buffer="Buffer",i.DroppedFramesLimit="DroppedFramesLimit",i.FitsQualityLimits="FitsQualityLimits"})(mt||(mt={}));const dS=new Oe("best_bitrate"),cS=(i,e,t)=>(e-t)*Math.pow(2,-10*i)+t;class hS{constructor(){this.history={}}recordSelection(e){this.history[e.id]=a.now()}recordSwitch(e){this.last=e}clear(){this.last=void 0,this.history={}}}const qt=(i,{container:e,throughput:t,tuning:s,limits:r,reserve:n=0,forwardBufferHealth:o,playbackRate:l,current:d,history:u,droppedVideoMaxQualityLimit:c,abrLogger:h})=>{var f,p,m,b,g;const E=s.usePixelRatio&&(f=window.devicePixelRatio)!==null&&f!==void 0?f:1,y=s.limitByContainer&&e&&e.width>0&&e.height>0&&{width:e.width*E*s.containerSizeFactor,height:e.height*E*s.containerSizeFactor},v=y&&a.videoSizeToQuality(y),S=s.considerPlaybackRate&&a.isNonNullable(l)?l:1,T=i.filter(I=>!a.isInvariantQuality(I.quality)).sort((I,A)=>a.isHigher(I.quality,A.quality)?-1:1),k=(p=Le(T,-1))===null||p===void 0?void 0:p.quality,L=(m=Le(T,0))===null||m===void 0?void 0:m.quality,j=a.isNullable(r)||a.isNonNullable(r.min)&&a.isNonNullable(r.max)&&a.isLower(r.max,r.min)||a.isNonNullable(r.min)&&L&&a.isHigher(r.min,L)||a.isNonNullable(r.max)&&k&&a.isLower(r.max,k),D=S*cS(o!=null?o:.5,s.bitrateFactorAtEmptyBuffer,s.bitrateFactorAtFullBuffer),x={},w=T.filter(I=>(v?a.isLower(I.quality,v):!0)?(a.isNonNullable(t)&&isFinite(t)&&a.isNonNullable(I.bitrate)?t-n>=I.bitrate*D:!0)?s.lazyQualitySwitch&&a.isNonNullable(s.minBufferToSwitchUp)&&d&&!a.isInvariantQuality(d.quality)&&(o!=null?o:0)<s.minBufferToSwitchUp&&a.isHigher(I.quality,d.quality)?(x[I.quality]=mt.Buffer,!1):!!c&&a.isHigherOrEqual(I.quality,c)?(x[I.quality]=mt.DroppedFramesLimit,!1):j||(a.isNullable(r.max)||a.isLowerOrEqual(I.quality,r.max))&&(a.isNullable(r.min)||a.isHigherOrEqual(I.quality,r.min))?!0:(x[I.quality]=mt.FitsQualityLimits,!1):(x[I.quality]=mt.FitsThroughput,!1):(x[I.quality]=mt.FitsContainer,!1))[0];w&&w.bitrate&&dS.next(w.bitrate);const N=(b=w!=null?w:T[Math.ceil((T.length-1)/2)])!==null&&b!==void 0?b:i[0];N.quality!==((g=u==null?void 0:u.last)===null||g===void 0?void 0:g.quality)&&h({message:`
7
7
  [available tracks] ${i.map(I=>I.quality).join(", ")}
8
8
 
9
9
  [limit params]