PageSourceSearch

https://www.craftzing.com/_next/static/chunks/07b5dd1e-6df990b9130c135d.js

js craftzing.com collected 2026-10-02 18:41:37 UTC 184,064 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6305],{71911:function(t,e,i){let s,a,n,r;i.d(e,{$P:function(){return B},Be:function(){return sZ},Cv:function(){return sS},DR:function(){return e$},Er:function(){return s$},Ew:function(){return U},F$:function(){return sz},FA:function(){return el},Fl:function(){return sk},G6:function(){return ey},G9:function(){return g},HV:function(){return tb},Id:function(){return sJ},Je:function(){return sT},K3:function(){return sr},LD:function(){return sH},LK:function(){return er},QF:function(){return sx},Rt:function(){return sE},S3:function(){return sw},TO:function(){return sM},UP:function(){return sy},Uf:function(){return s4},V6:function(){return eV},Vi:function(){return sN},W6:function(){return u},WU:function(){return sF},WV:function(){return s7},WX:function(){return tK},Xm:function(){return sG},ZJ:function(){return sj},Zf:function(){return sQ},_1:function(){return sf},_S:function(){return to},_e:function(){return sO},a2:function(){return tG},al:function(){return sY},bj:function(){return sI},bx:function(){return sb},cA:function(){return sL},cj:function(){return p},dc:function(){return sU},e0:function(){return s0},eV:function(){return sB},fS:function(){return eu},fZ:function(){return sR},gU:function(){return H},gV:function(){return s1},gq:function(){return sA},hA:function(){return sX},ib:function(){return sW},il:function(){return sv},j9:function(){return aa},jh:function(){return s_},kA:function(){return Y},kH:function(){return tl},lk:function(){return Z}
1,mr:function(){return eI},n8:function(){return tt},nA:function(){return ts},nQ:function(){return K},nl:function(){return ti},nq:function(){return i0},ns:function(){return sq},qG:function(){return sD},r4:function(){return s9},tF:function(){return x},tn:function(){return S},u9:function(){return sK},v$:function(){return sV},ve:function(){return Q},xu:function(){return ae},zY:function(){return sP},zh:function(){return sC}});var h=i(2265),o=i(63298),l=i(50032);function d(t){return!(0,o.isString)(t)&&"width"in t&&"height"in t&&(0,o.isNumber)(t.width)&&(0,o.isNumber)(t.height)}let u="undefined"==typeof document,c=u?"":navigator?.userAgent.toLowerCase()||"",p=!u&&/iphone|ipad|ipod|ios|crios|fxios/i.test(c),m=!u&&/(iphone|ipod)/gi.test(navigator?.platform||""),g=!u&&!!window.chrome,f=!u&&(!!window.safari||p);function y(){return!u&&!(0,o.isUndefined)(window.screen.orientation)&&!(0,o.isUndefined)(window.screen.orientation.lock)&&(0,o.isFunction)(screen.orientation.unlock)}function b(t,e){return!u&&(t||(t=document.createElement("audio")),t.canPlayType(e).length>0)}function v(t,e){return!u&&(t||(t=document.createElement("video")),t.canPlayType(e).length>0)}function w(t){return!u&&(t||(t=document.createElement("video")),t.canPlayType("application/vnd.apple.mpegurl").length>0)}function k(t){return!u&&!!document.pictureInPictureEnabled&&!t?.disablePictureInPicture}function $(t){return!u&&(0,o.isFunction)(t?.webkitSupportsPresentationMode)&&(0,o.isFunction)(t?.webkitSetPresentationMode)}async function T(){let t=document.createElement("video");return t.volume=.5,await (0,o.waitTimeout)(0),.5===t.volume}function x(){if(u)return!1;let t=u?void 0:window?.ManagedMediaSource??window?.MediaSource??window?.WebKitMediaSource;if((0,o.isUndefined)(t))return!1;let e=t&&(0,o.isFunction)(t.isTypeSupported)&&t.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),i=u?void 0:window?.SourceBuffer??window?.WebKitSourceBuffer,s=(0,o.isUndefined)(i)||!(0,o.isUndefined)(i.prototype)&&(0,o.isFunction)(i.prototype.appendBuffer)&&(0,o.isFunction)(i.prototype.remove);return!!e&&!!s}class S{#t;get length(){return this.#t.length}constructor(t,e){(0,o.isArray)(t)?this.#t=t:(0,o.isUndefined)(t)||(0,o.isUndefined)(e)?this.#t=[]:this.#t=[[t,e]]}start(t){return this.#t[t][0]??1/0}end(t){return this.#t[t][1]??1/0}}function C(t){if(!t.length)return null;let e=t.start(0);for(let i=1;i<t.length;i++){let s=t.start(i);s<e&&(e=s)}return e}function P(t){if(!t.length)return null;let e=t.end(0);for(let i=1;i<t.length;i++){let s=t.end(i);s>e&&(e=s)}return e}let E=/\.(m4a|m4b|mp4a|mpga|mp2|mp2a|mp3|m2a|m3a|wav|weba|aac|oga|spx|flac)($|\?)/i,A=new Set(["audio/mpeg","audio/ogg","audio/3gp","audio/mp3","audio/webm","audio/flac","audio/m4a","audio/m4b","audio/mp4a","audio/mp4"]),q=/\.(mp4|og[gv]|webm|mov|m4v)(#t=[,\d+]+)?($|\?)/i,M=new Set(["video/mp4","video/webm","video/3gp","video/ogg","video/avi","video/mpeg"]),D=/\.(m3u8)($|\?)/i,R=/\.(mpd)($|\?)/i,L=new Set(["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"]),I=new Set(["application/dash+xml"]);function V(t){let{src:e,type:i}=t;return(0,o.isString)(e)?E.test(e)||A.has(i)||e.startsWith("blob:")&&"audio/object"===i:"audio/object"===i}function O(t){return(0,o.isString)(t.src)?q.test(t.src)||M.has(t.type)||t.src.startsWith("blob:")&&"video/object"===t.type||F(t)&&(u||w()):"video/object"===t.type}function F(t){let{src:e,type:i}=t;return(0,o.isString)(e)&&D.test(e)||L.has(i)}function N(t){let{src:e,type:i}=t;return(0,o.isString)(e)&&R.test(e)||I.has(i)}function U(t){return(0,o.isString)(t.src)&&(V(t)||O(t)||F(t))}function K(t,e){let i=new URL(t);for(let t of Object.keys(e))i.searchParams.set(t,e[t]+"");return i.toString()}function B(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"preconnect";if(u)return!1;let i=document.querySelector(`link[href="${t}"]`);if(!(0,o.isNull)(i))return!0;let s=document.createElement("link");return s.rel=e,s.href=t,s.crossOrigin="true",document.head.append(s),!0}let G={};function Q(t){if(G[t])return G[t].promise;let e=(0,o.deferredPromise)(),i=document.querySelector(`script[src="${t}"]`);if(!(0,o.isNull)(i))return e.resolve(),e.promise;G[t]=e;let s=document.createElement("script");return s.src=t,s.onload=()=>{e.resolve(),delete G[t]},s.onerror=()=>{e.reject(),delete G[t]},setTimeout(()=>
1document.head.append(s),0),e.promise}function W(t){return"use-credentials"===t?"include":(0,o.isString)(t)?"same-origin":void 0}function H(t){let{title:e,src:i,download:s}=t,a=(0,o.isBoolean)(s)||""===s?i.src:(0,o.isString)(s)?s:s?.url;return!function(t){let{url:e,src:i,download:s}=t;return(0,o.isString)(e)&&(s&&!0!==s||V(i)||O(i))}({url:a,src:i,download:s})?null:{url:a,name:!(0,o.isBoolean)(s)&&!(0,o.isString)(s)&&s?.filename||e.toLowerCase()||"media"}}let j=Symbol(0),z=Symbol(0),_=Symbol(0),X=Symbol(0),Y={crossOrigin:j,readyState:z,updateActiveCues:_,canLoad:X,onModeChange:Symbol(0),native:Symbol(0),nativeHLS:Symbol(0)};function J(t,e){return e>=t.startTime&&e<t.endTime}function Z(t,e,i){let s=null,a=(0,o.getScope)();function n(){let n=(0,o.isString)(e)?[e]:e,r=t.toArray().find(t=>n.includes(t.kind)&&"showing"===t.mode);if(r!==s){if(!r){i(null),s=null;return}2==r.readyState?i(r):(i(null),(0,o.scoped)(()=>{let t=(0,o.listenEvent)(r,"load",()=>{i(r),t()},{once:!0})},a)),s=r}}return n(),(0,o.listenEvent)(t,"mode-change",n)}class tt extends o.EventsTarget{static #e=void(s=Y.readyState,Y.crossOrigin,a=Y.onModeChange,n=Y.native);static createId(t){return`vds-${t.type}-${t.kind}-${t.src??t.label??"?"}`}#i;#s;#a;#n;#r;#h;#o;get metadata(){return this.#n}get regions(){return this.#r}get cues(){return this.#h}get activeCues(){return this.#o}get readyState(){return this[Y.readyState]}get mode(){return this.#a}set mode(t){this.setMode(t)}constructor(t){for(let e of(super(),this.id="",this.label="",this.language="",this.default=!1,this.#i=!1,this.#s=0,this.#a="disabled",this.#n={},this.#r=[],this.#h=[],this.#o=[],this[s]=0,this[a]=null,this[n]=null,Object.keys(t)))this[e]=t[e];
1this.type||(this.type="vtt"),!u&&t.content?this.#l(t):t.src||(this[Y.readyState]=2)}addCue(t,e){let i=0,s=this.#h.length;for(i=0;i<s&&!(t.endTime<=this.#h[i].startTime);i++);i===s?this.#h.push(t):this.#h.splice(i,0,t),t instanceof TextTrackCue||this[Y.native]?.track.addCue(t),this.dispatchEvent(new o.DOMEvent("add-cue",{detail:t,trigger:e})),J(t,this.#s)&&this[Y.updateActiveCues](this.#s,e)}removeCue(t,e){let i=this.#h.indexOf(t);if(i>=0){let s=this.#o.includes(t);this.#h.splice(i,1),this[Y.native]?.track.removeCue(t),this.dispatchEvent(new o.DOMEvent("remove-cue",{detail:t,trigger:e})),s&&this[Y.updateActiveCues](this.#s,e)}}setMode(t,e){this.#a!==t&&(this.#a=t,"disabled"===t?(this.#o=[],this.#d()):2===this.readyState?this[Y.updateActiveCues](this.#s,e):this.#u(),this.dispatchEvent(new o.DOMEvent("mode-change",{detail:this,trigger:e})),this[Y.onModeChange]?.())}[Y.updateActiveCues](t,e){if(this.#s=t,"disabled"===this.mode||!this.#h.length)return;let i=[];for(let e=0,s=this.#h.length;e<s;e++){let s=this.#h[e];J(s,t)&&i.push(s)}let s=i.length!==this.#o.length;if(!s){for(let t=0;t<i.length;t++)if(!this.#o.includes(i[t])){s=!0;break}}this.#o=i,s&&this.#d(e)}[Y.canLoad](){this.#i=!0,"disabled"!==this.#a&&this.#u()}#l(t){i.e(7276).then(i.bind(i,97276)).then(e=>{let{parseText:i,VTTCue:s,VTTRegion:a}=e;(0,o.isString)(t.content)&&"json"!==t.type?i(t.content,{type:t.type}).then(t=>{let{cues:e,regions:i}=t;this.#h=e,this.#r=i,this.#c()}):(this.#p(t.content,s,a),3!==this.readyState&&this.#c())})}async #u(){if(this.#i&&!(this[Y.readyState]>0)){if(this[Y.readyState]=1,this.dispatchEvent(new o.DOMEvent("load-start")),!this.src){this.#c();return}try{let{parseResponse:t,VTTCue:e,VTTRegion:s}=await i.e(7276).then(i.bind(i,97276)),a=this[Y.crossOrigin]?.(),n=fetch(this.src,{headers:"json"===this.type?{"Content-Type":"application/json"}:void 0,credentials:W(a)});if("json"===this.type)this.#p(await (await n).text(),e,s);else{let{errors:e,metadata:i,regions:s,cues:a}
1=await t(n,{type:this.type,encoding:this.encoding});if(e[0]?.code===0)throw e[0];this.#n=i,this.#r=s,this.#h=a}this.#c()}catch(t){this.#m(t)}}}#c(){if(this[Y.readyState]=2,!this.src||"vtt"!==this.type){let t=this[Y.native];if(t&&!t.managed)for(let e of this.#h)t.track.addCue(e)}let t=new o.DOMEvent("load");this[Y.updateActiveCues](this.#s,t),this.dispatchEvent(t)}#m(t){this[Y.readyState]=3,this.dispatchEvent(new o.DOMEvent("error",{detail:t}))}#p(t,e,i){try{let{regions:s,cues:a}=function(t,e,i){let s=(0,o.isString)(t)?JSON.parse(t):t,a=[],n=[];return s.regions&&i&&(a=s.regions.map(t=>Object.assign(new i,t))),(s.cues||(0,o.isArray)(s))&&(n=((0,o.isArray)(s)?s:s.cues).filter(t=>(0,o.isNumber)(t.startTime)&&(0,o.isNumber)(t.endTime)).map(t=>Object.assign(new e(0,0,""),t))),{regions:a,cues:n}}(t,e,i);this.#r=s,this.#h=a}catch(t){this.#m(t)}}#d(t){this.dispatchEvent(new o.DOMEvent("cue-change",{trigger:t}))}}let te=/captions|subtitles/;function ti(t){return te.test(t.kind)}let ts=new o.State({artist:"",artwork:null,audioTrack:null,audioTracks:[],autoPlay:!1,autoPlayError:null,audioGain:null,buffered:new S,canLoad:!1,canLoadPoster:!1,canFullscreen:!1,canOrientScreen:y(),canPictureInPicture:!1,canPlay:!1,clipStartTime:0,clipEndTime:0,controls:!1,get iOSControl
1s(){return m&&"video"===this.mediaType&&(!this.playsInline||!o.fscreen.fullscreenEnabled&&this.fullscreen)},get nativeControls(){return this.controls||this.iOSControls},controlsVisible:!1,get controlsHidden(){return!this.controlsVisible},crossOrigin:null,ended:!1,error:null,fullscreen:!1,get loop(){return this.providedLoop||this.userPrefersLoop},logLevel:"silent",mediaType:"unknown",muted:!1,paused:!0,played:new S,playing:!1,playsInline:!1,pictureInPicture:!1,preload:"metadata",playbackRate:1,qualities:[],quality:null,autoQuality:!1,canSetQuality:!0,canSetPlaybackRate:!0,canSetVolume:!1,canSetAudioGain:!1,seekable:new S,seeking:!1,source:{src:"",type:""},sources:[],started:!1,textTracks:[],textTrack:null,get hasCaptions(){return this.textTracks.filter(ti).length>0},volume:1,waiting:!1,realCurrentTime:0,get currentTime(){return this.ended?this.duration:this.clipStartTime>0?Math.max(0,Math.min(this.realCurrentTime-this.clipStartTime,this.duration)):this.realCurrentTime},providedDuration:-1,intrinsicDuration:0,get duration(){return this.seekableWindow},get title(){return this.providedTitle||this.inferredTitle},get poster(){return this.providedPoster||this.inferredPoster},get viewType(){return"unknown"!==this.providedViewType?this.providedViewType:this.inferredViewType},get streamType(){return"unknown"!==this.providedStreamType?this.providedStreamType:this.inferredStreamType},get currentSrc(){return this.source},get bufferedStart(){return Math.max(C(this.buffered)??0,this.clipStartTime)},get bufferedEnd(){let t=P(this.buffered)??0;return Math.min(this.seekableEnd,Math.max(0,t-this.clipStartTime))},get bufferedWindow(){return Math.max(0,this.bufferedEnd-this.bufferedStart)}
1,get seekableStart(){if(this.isLiveDVR&&this.liveDVRWindow>0)return Math.max(0,this.seekableEnd-this.liveDVRWindow);return Math.max(C(this.seekable)??0,this.clipStartTime)},get seekableEnd(){if(this.providedDuration>0)return this.providedDuration;let t=this.liveSyncPosition>0?this.liveSyncPosition:this.canPlay?P(this.seekable)??1/0:0;return this.clipEndTime>0?Math.min(this.clipEndTime,t):t},get seekableWindow(){let t=this.seekableEnd-this.seekableStart;return isNaN(t)?1/0:Math.max(0,t)},canAirPlay:!1,canGoogleCast:!1,remotePlaybackState:"disconnected",remotePlaybackType:"none",remotePlaybackLoader:null,remotePlaybackInfo:null,get isAirPlayConnected(){return"airplay"===this.remotePlaybackType&&"connected"===this.remotePlaybackState},get isGoogleCastConnected(){return"google-cast"===this.remotePlaybackType&&"connected"===this.remotePlaybackState},pointer:"fine",orientation:"landscape",width:0,height:0,mediaWidth:0,mediaHeight:0,lastKeyboardAction:null,userBehindLiveEdge:!1,liveEdgeTolerance:10,minLiveDVRWindow:60,get canSeek(){return/unknown|on-demand|:dvr/.test(this.streamType)&&Number.isFinite(this.duration)&&(!this.isLiveDVR||this.duration>=this.liveDVRWindow)},get live(){return this.streamType.includes("live")||!Number.isFinite(this.duration)},get liveEdgeStart(){return this.live&&Number.isFinite(this.seekableEnd)?Math.max(0,this.seekableEnd-this.liveEdgeTolerance):0},get liveEdge(){return this.live&&(!this.canSeek||!this.userBehindLiveEdge&&this.currentTime>=this.liveEdgeStart)},get liveEdgeWindow(){return this.live&&Number.isFinite(this.seekableEnd)?this.seekableEnd-this.liveEdgeStart:0},get isLiveDVR(){return/:dvr/.test(this.streamType)},get liveDVRWindow(){return Math.max(this.inferredLiveDVRWindow,this.minLiveDVRWindow)},autoPlaying:!1,providedTitle:"",inferredTitle:"",providedLoop:!1,userPrefersLoop:!1,providedPoster:"",inferredPoster:"",inferredViewType:"unknown",providedViewType:"unknown",providedStreamType:"unknown",inferredStreamType:"unknown",liveSyncPosition:null,inferredLiveDVRWindow:0,savedState:null}),ta=new Set(["autoPlayError","autoPlaying","buffered","canPlay","error","paused","played","playing","seekable","seeking","waiting"]),tn=new Set([...ta,"ended","inferredPoster","inferredStreamType","inferredTitle","intrinsicDuration","inferredLiveDVRWindow","liveSyncPosition","realCurrentTime","savedState","started","userBehindLiveEdge"]);function tr(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=e?ta:tn;ts.reset(t,t=>i.has(t)),(0,o.tick)()}function th(t,e){let i=t+e.clipStartTime(),s=Math.floor(t)===Math.floor(e.seekableStart()),a=Math.floor(i)===Math.floor(e.seekableEnd());return s?e.seekableStart():a?e.seekableEnd():e.isLiveDVR()&&e.liveDVRWindow()>0&&i<e.seekableEnd()-e.liveDVRWindow()?e.bufferedStart():Math.min(Math.max(e.seekableStart()+.1,i),e.seekableEnd()-.1)}let to=(0,o.createContext)();function tl(){return(0,o.useContext)(to)}class td{#g;#f;#y;#b;constructor(t){this.#g=null,this.#f=null,this.#y=-1,this.#b=t}setTarget(t){this.#g=t}getPlayer(t){return this.#f||(t??this.#g)?.dispatchEvent(new o.DOMEvent("find-media-player",{detail:t=>void(this.#f=t),bubbles:!0,composed:!0})),this.#f}setPlayer(t){this.#f=t}startLoading(t){this.#v("media-start-loading",t)}startLoadingPoster(t){this.#v("media-poster-start-loading",t)}requestAirPlay(t){this.#v("media-airplay-request",t)}requestGoogleCast(t){this.#v("media-google-cast-request",t)}play(t){this.#v("media-play-request",t)}pause(t){this.#v("media-pause-request",t)}mute(t){this.#v("media-mute-request",t)}unmute(t){this.#v("media-unmute-request",t)}enterFullscreen(t,e){this.#v("media-enter-fullscreen-request",e,t)}exitFullscreen(t,e){this.#v("media-exit-fullscreen-request",e,t)}lockScreenOrientation(t,e){this.#v("media-orientation-lock-request",e,t)}unlockScreenOrientation(t){this.#v("media-orientation-unlock-request",t)}enterPictureInPicture(t){this.#v("media-enter-pip-request",t)}exitPictureInPicture(t){this.#v("media-exit-pip-request",t)}seeking(t,e){this.#v("media-seeking-request",e,t)}seek(t,e){this.#v("media-seek-request",e,t)}seekToLiveEdge(t){this.#v("media-live-edge-request",t)}changeDuration(t,e){this.#v("media-duration-change-request",e,t)}changeClipStart(t,e){this.#v("media-clip-start-change-request",e,t)}changeClipEnd(t,e){this.#v("media-clip-end-change-request",e,t)}changeVolume(t,e){this.#v("media-volume-change-request",e,Math.max(0,Math.min(1,t)))}changeAudioTrack(t,e){this.#v("media-audio-track-change-request",e,t)}changeQuality(t,e){this.#v("media-quality-change-request",e,t)}requestAutoQuality(t){this.changeQuality(-1,t)}changeTextTrackMode(t,e,i){this.#v("media-text-track-change-request",i,{index:t,mode:e})}changePlaybackRate(t,e){this.#v("media-rate-change-request",e,t)}changeAudioGain(t,e){this.#v("media-audio-gain-change-request",e,t)}
1resumeControls(t){this.#v("media-resume-controls-request",t)}pauseControls(t){this.#v("media-pause-controls-request",t)}togglePaused(t){let e=this.getPlayer(t?.target);e&&(e.state.paused?this.play(t):this.pause(t))}toggleControls(t){let e=this.getPlayer(t?.target);e&&(e.controls.showing?e.controls.hide(0,t):e.controls.show(0,t))}toggleMuted(t){let e=this.getPlayer(t?.target);e&&(e.state.muted?this.unmute(t):this.mute(t))}toggleFullscreen(t,e){let i=this.getPlayer(e?.target);i&&(i.state.fullscreen?this.exitFullscreen(t,e):this.enterFullscreen(t,e))}togglePictureInPicture(t){let e=this.getPlayer(t?.target);e&&(e.state.pictureInPicture?this.exitPictureInPicture(t):this.enterPictureInPicture(t))}showCaptions(t){let e=this.getPlayer(t?.target);if(!e)return;let i=e.state.textTracks,s=this.#y;i[s]&&ti(i[s])||(s=-1),-1===s&&(s=i.findIndex(t=>ti(t)&&t.default)),-1===s&&(s=i.findIndex(t=>ti(t))),s>=0&&this.changeTextTrackMode(s,"showing",t),this.#y=-1}disableCaptions(t){let e=this.getPlayer(t?.target);if(!e)return;let i=e.state.textTracks,s=e.state.textTrack;if(s){let e=i.indexOf(s);this.changeTextTrackMode(e,"disabled",t),this.#y=e}}toggleCaptions(t){let e=this.getPlayer(t?.target);e&&(e.state.textTrack?this.disableCaptions():this.showCaptions())}userPrefersLoopChange(t,e){this.#v("media-user-loop-change-request",e,t)}#v(t,e,i){let s=new o.DOMEvent(t,{bubbles:!0,composed:!0,cancelable:!0,detail:i,trigger:e}),a=e?.target||null;a&&a instanceof o.Component&&(a=a.el),a=!a||a===document||a===window||a===document.body||this.#f?.el&&a instanceof Node&&!this.#f.el.contains(a)?this.#g??this.getPlayer()?.el:a??this.#g,this.#f&&("media-play-request"!==t||this.#f.state.canLoad)?this.#f.canPlayQueue.enqueue(t,()=>a?.dispatchEvent(s)):a?.dispatchEvent(s)}#w(t){}}class tu{#k;async getVolume(){return this.#k.volume}async setVolume(t){this.#k.volume=t,this.save()}async getMuted(){return this.#k.muted}async setMuted(t){this.#k.muted=t,this.save()}async getTime(){return this.#k.time}async setTime(t,e){let i=t<0;this.#k.time=i?null:t,i||e?this.saveTime():this.saveTimeThrottled()}async getLang(){return this.#k.lang}async setLang(t){this.#k.lang=t,this.save()}async getCaptions(){return this.#k.captions}async setCaptions(t){this.#k.captions=t,this.save()}async getPlaybackRate(){return this.#k.rate}async setPlaybackRate(t){this.#k.rate=t,this.save()}async getAudioGain(){return this.#k.audioGain}async setAudioGain(t){this.#k.audioGain=t,this.save()}async getVideoQuality(){return this.#k.quality}async setVideoQuality(t){this.#k.quality=t,this.save()}onChange(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"vds-player",s=i?localStorage.getItem(i):null,a=e?localStorage.getItem(e):null;this.playerId=i,this.mediaId=e,this.#k={volume:null,muted:null,audioGain:null,lang:null,captions:null,rate:null,quality:null,...s?JSON.parse(s):{},time:a?+a:null}}save(){if(u||!this.playerId)return;let t=JSON.stringify({...this.#k,time:void 0});localStorage.setItem(this.playerId,t)}saveTime(){if(u||!this.mediaId)return;let t=(this.#k.time??0).toString();localStorage.setItem(this.mediaId,t)}constructor(){this.playerId="vds-player",this.mediaId=null,this.#k={volume:null,muted:null,audioGain:null,time:null,lang:null,captions:null,rate:null,quality:null},this.saveTimeThrottled=(0,o.functionThrottle)(this.saveTime.bind(this),1e3)}}let tc=Symbol(0),tp=Symbol(0),tm=Symbol(0),tg=Symbol(0),tf=Symbol(0),ty=Symbol(0),tb={add:tc,remove:tp,reset:tm,select:tg,readonly:tf,setReadonly:ty,onReset:Symbol(0),onRemove:Symbol(0),onUserSelect:Symbol(0)};class tv extends o.EventsTarget{static #e=r=tb.readonly;get length(){return this.items.length}get readonly(){return this[tb.readonly]}indexOf(t){return this.items.indexOf(t)}getById(t){return""===t?null:this.items.find(e=>e.id===t)??null}toArray(){return[...this.items]}[Symbol.iterator](){return this.items.values()}[tb.add](t,e){let i=this.items.length;""+i in this||Object.defineProperty(this,i,{get(){return this.items[i]}}),this.items.includes(t)||(this.items.push(t),this.dispatchEvent(new o.DOMEvent("add",{detail:t,trigger:e})))}[tb.remove](t,e){let i=this.items.indexOf(t);i>=0&&(this[tb.onRemove]?.(t,e),this.items.splice(i,1),this.dispatchEvent(new o.DOMEvent("remove",{detail:t,trigger:e})))}[tb.reset](t){for(let e of[...this.items])this[tb.remove](e,t);this.items=[],this[tb.setReadonly](!1,t),this[tb.onReset]?.()}[tb.setReadonly](t,e){this[tb.readonly]!==t&&(this[tb.readonly]=t,this.dispatchEvent(new o.DOMEvent("readonly-change",{detail:t,trigger:e})))}constructor(...t){super(...t),this.items=[],this[r]=!1}}let tw=Symbol(0);class tk extends tv{get selected(){return this.items.find(t=>t.selected)??null}get selectedIndex(){return this.items.findIndex(t=>t.selected)}[tb.onRemove](t,e){this[tb.select](t,!1,e)}[tb.add](t,e){t[tw]=!1,Object.defineProperty(t,"selected",{get(){return this[tw]},set:e=>
1{this.readonly||(this[tb.onUserSelect]?.(),this[tb.select](t,e))}}),super[tb.add](t,e)}[tb.select](t,e,i){if(e===t?.[tw])return;let s=this.selected;t&&(t[tw]=e),(e?s!==t:s===t)&&(s&&(s[tw]=!1),this.dispatchEvent(new o.DOMEvent("change",{detail:{prev:s,current:this.selected},trigger:i})))}}class t$ extends tk{}function tT(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return Number(t.toFixed(e))}function tx(t){return String(t).split(".")[1]?.length??0}function tS(t,e,i){return Math.max(t,Math.min(i,e))}function tC(t,e){let i=e.composedPath()[0];return(0,o.isDOMNode)(i)&&t.contains(i)}let tP=new Set;if(!u){let t=function(){for(let t of tP)try{t()}catch(t){}window.requestAnimationFrame(t)};t()}function tE(t,e,i){t.hasAttribute(e)||t.setAttribute(e,i)}function tA(t,e){if(!(t.hasAttribute("aria-label")||t.hasAttribute("data-no-label"))){if(!(0,o.isFunction)(e)){(0,o.setAttribute)(t,"aria-label",e);return}u?i():(0,o.effect)(i)}function i(){(0,o.setAttribute)(t,"aria-label",e())}}function tq(t){let e=getComputedStyle(t);return"none"!==e.display&&parseInt(e.opacity)>0}function tM(t,e){var i;return i=()=>e(!!t&&("checkVisibility"in t?t.checkVisibility({checkOpacity:!0,checkVisibilityCSS:!0}):tq(t))),tP.add(i),()=>tP.delete(i)}function tD(t,e,i){for(;e;){if(e===t)return!0;if(i?.(e))break;e=e.parentElement}return!1}function tR(t,e){return new o.EventsController(t).add("pointerup",t=>{0!==t.button||t.defaultPrevented||e(t)}).add("keydown",t=>{(0,o.isKeyboardClick)(t)&&e(t)})}function tL(t){return(0,o.isTouchEvent)(t)&&(t.touches.length>1||t.changedTouches.length>1)}function tI(t){if(u)return t();let e=(0,o.getScope)(),i=window.requestAnimationFrame(()=>{(0,o.scoped)(t,e),i=-1});return()=>void window.cancelAnimationFrame(i)}function tV(t,e,i,s){let{offsetVarName:a,xOffset:n,yOffset:r,...h}=s;if(!t)return;let d=i.replace(" ","-").replace("-center","");if((0,o.setStyle)(t,"visibility",e?null:"hidden"),!e)return;let u=i.includes("top"),c=t=>i.includes("left")?`calc(-1 * ${t})`:t,p=t=>u?`calc(-1 * ${t})`:t;return(0,l.Me)(e,t,()=>{(0,l.oo)(e,t,{placement:d,middleware:[...h.middleware??[],(0,l.RR)({fallbackAxisSideDirection:"start",crossAxis:!1}),(0,l.uY)()],...h}).then(e=>{let{x:s,y:h,middlewareData:o}=e,l=!!o.flip?.index;u=i.includes(l?"bottom":"top"),t.setAttribute("data-placement",l?i.startsWith("top")?i.replace("top","bottom"):i.replace("bottom","top"):i),Object.assign(t.style,{top:`calc(${h+"px"} + ${p(r?r+"px":`var(--${a}-y-offset, 0px)`)})`,left:`calc(${s+"px"} + ${c(n?n+"px":`var(--${a}-x-offset, 0px)`)})`})})})}function tO(t){return t instanceof HTMLElement}class tF{#$;#T;#x;#S;canRender(t,e){return!!e}attach(t){this.#T=t,t&&(t.textTracks.onchange=this.#C.bind(this))}addTrack(t){this.#S.add(t),this.#P(t)}removeTrack(t){t[Y.native]?.remove?.(),t[Y.native]=null,this.#S.delete(t)}changeTrack(t){let e=t?.[Y.native];e&&"showing"!==e.track.mode&&(e.track.mode="showing"),this.#x=t}setDisplay(t){this.#$=t,this.#C()}detach(){for(let t of(this.#T&&(this.#T.textTracks.onchange=null),this.#S))this.removeTrack(t);this.#S.clear(),this.#T=null,this.#x=null}#P(t){if(!this.#T)return;let e=t[Y.native]??=this.#E(t);tO(e)&&(this.#T.append(e),e.track.mode=e.default?"showing":"disabled")}#E(t){let e=document.createElement("track"),i=t.default||"showing"===t.mode,s=t.src&&"vtt"===t.type;return e.id=t.id,e.src=s?t.src:"",e.label=t.label,e.kind=t.kind,e.default=i,t.language&&(e.srclang=t.language),i&&!s&&this.#A(t,e.track),e}#A(t,e){if(!(t.src&&"vtt"===t.type||e.cues?.length))for(let i of t.cues)e.addCue(i)}#C(t){for(let e of this.#S){let i=e[Y.native];if(!i)continue;if(!this.#$){i.track.mode=i.managed?"hidden":"disabled";continue}let s="showing"===i.track.mode;s&&this.#A(e,i.track),e.setMode(s?"showing":"disabled",t)}}constructor(){this.priority=0,this.#$=!0,this.#T=null,this.#x=null,this.#S=new Set}}class tN{#T;#q;#M;#D;#R;#L;#I;constructor(t){this.#T=null,this.#M=[],this.#R=!1,this.#L=null,this.#I=null,this.#D=t;let e=t.textTracks;this.#q=e,(0,o.effect)(this.#V.bind(this)),(0,o.onDispose)(this.#O.bind(this)),new o.EventsController(e).add("add",this.#F.bind(this)).add("remove",this.#N.bind(this)).add("mode-change",this.#U.bind(this))}#V(){let{nativeControls:t}=this.#D.$state;this.#R=t(),this.#U()}add(t){this.#M.push(t),(0,o.untrack)(this.#U.bind(this))}remove(t){t.detach(),this.#M.splice(this.#M.indexOf(t),1),(0,o.untrack)(this.#U.bind(this))}attachVideo(t){requestAnimationFrame(()=>{if(this.#T=t,t)for(let e of(this.#L=new tF,this.#L.attach(t),this.#q))this.#K(e);this.#U()})}#K(t){ti(t)&&this.#L?.addTrack(t)}#B(t){ti(t)&&this.#L?.removeTrack(t)}#F(t){this.#K(t.detail)}#N(t){this.#B(t.detail)}#U(){let t=this.#q.selected;if(this.#T&&(this.#R||t?.[Y.nativeHLS])){this.#I?.changeTrack(null),this.#L?.setDisplay(!0),this.#L?.changeTrack(t);return}if(this.#L?.setDisplay(!1),this.#L?.changeTrack(null),!t){this.#I?.changeTrack(null);return}let e=this.#M.sort((t,e)=>t.priority-e.priority).find(e=>e.canRender(t,this.#T));this.#I!==e&&(this.#I?.detach(),e?.attach(this.#T),this.#I=e??null),e?.changeTrack(t)}#O(){this.#L?.detach(),this.#L=null,this.#I?.detach(),this.#I=null}}class tU extends tv{static #e=Y.crossOrigin;#i;#G;#Q;#W;constructor(){super(),this.#i=!1,this.#G={},this.#Q=null,this.#W=null,this.#H=(0,o.functionDebounce)(async()=>
1{if(!this.#i)return;!this.#W&&this.#Q&&(this.#W=await this.#Q.getLang());let t=await this.#Q?.getCaptions();for(let e of[["captions","subtitles"],"chapters","descriptions","metadata"]){let i=this.getByKind(e);if(i.find(t=>"showing"===t.mode))continue;let s=this.#W?i.find(t=>t.language===this.#W):null,a=(0,o.isArray)(e)?this.#G[e.find(t=>this.#G[t])||""]:this.#G[e],n=s??a,r=n&&ti(n);n&&(!r||!1!==t)&&(n.mode="showing",r&&this.#j(n))}},300),this.#z=null,this.#_=this.#X.bind(this)}get selected(){return this.items.find(t=>"showing"===t.mode&&ti(t))??null}get selectedIndex(){let t=this.selected;return t?this.indexOf(t):-1}get preferredLang(){return this.#W}set preferredLang(t){this.#W=t,this.#Y(t)}add(t,e){let i=t instanceof tt?t:new tt(t),s="captions"===t.kind||"subtitles"===t.kind?"captions":t.kind;return this.#G[s]&&t.default&&delete t.default,i.addEventListener("mode-change",this.#_),this[tb.add](i,e),i[Y.crossOrigin]=this[Y.crossOrigin],this.#i&&i[Y.canLoad](),t.default&&(this.#G[s]=i),this.#H(),this}remove(t,e){if(this.#z=t,this.items.includes(t))return t===this.#G[t.kind]&&delete this.#G[t.kind],t.mode="disabled",t[Y.onModeChange]=null,t.removeEventListener("mode-change",this.#_),this[tb.remove](t,e),this.#z=null,this}clear(t){for(let e of[...this.items])this.remove(e,t);return this}getByKind(t){let e=Array.isArray(t)?t:[t];return this.items.filter(t=>e.includes(t.kind))}[Y.canLoad](){if(!this.#i){for(let t of this.items)t[Y.canLoad]();this.#i=!0,this.#H()}}#H;#z;#_;#X(t){let e=t.detail;if(this.#Q&&ti(e)&&e!==this.#z&&this.#j(e),"showing"===e.mode){let t=ti(e)?["captions","subtitles"]:[e.kind];for(let i of this.items)"showing"===i.mode&&i!=e&&t.includes(i.kind)&&(i.mode="disabled")}this.dispatchEvent(new o.DOMEvent("mode-change",{detail:t.detail,trigger:t}))}#j(t){"disabled"!==t.mode&&this.#Y(t.language),this.#Q?.setCaptions?.("showing"===t.mode)}#Y(t){this.#Q?.setLang?.(this.#W=t)}setStorage(t){this.#Q=t}}let tK={setAuto:Symbol(0),enableAuto:Symbol(0)};class tB extends tk{static #e=tK.enableAuto;#J;get auto(){return this.#J||this.readonly}[tb.onUserSelect](){this[tK.setAuto](!1)}[tb.onReset](t){this[tK.enableAuto]=void 0,this[tK.setAuto](!1,t)}autoSelect(t){this.readonly||this.#J||!this[tK.enableAuto]||(this[tK.enableAuto]?.(t),this[tK.setAuto](!0,t))}getBySrc(t){return this.items.find(e=>e.src===t)}[tK.setAuto](t,e){this.#J!==t&&(this.#J=t,this.dispatchEvent(new o.DOMEvent("auto-change",{detail:t,trigger:e})))}constructor(...t){super(...t),this.#J=!1,this.switch="current"}}function tG(t,e){return[...t].sort(e?tW:tQ)}function tQ(t,e){return t.height===e.height?(t.bitrate??0)-(e.bitrate??0):t.height-e.height}function tW(t,e){return e.height===t.height?(e.bitrate??0)-(t.bitrate??0):e.height-t.height}class tH extends o.ViewController{}let tj=new Set(["Shift","Alt","Meta","Ctrl"]),tz='input, textarea, select, [contenteditable], [role^="menuitem"], [role="timer"]';class t_ extends tH{#D;constructor(t){super(),this.#Z=null,this.#D=t}onConnect(){(0,o.effect)(this.#tt.bind(this))}#tt(){let{keyDisabled:t,keyTarget:e}=this.$props;if(t())return;let i="player"===e()?this.el:document,s=(0,o.signal)(!1);i===this.el?new o.EventsController(this.el).add("focusin",()=>s.set(!0)).add("focusout",t=>{this.el.contains(t.target)||s.set(!1)}):((0,o.peek)(s)||s.set(document.querySelector("[data-media-player]")===this.el),(0,o.listenEvent)(document,"focusin",t=>{let e=t.composedPath().find(t=>t instanceof Element&&"media-player"===t.localName);void 0!==e&&s.set(this.el===e)})),(0,o.effect)(()=>{s()&&new o.EventsController(i).add("keyup",this.#te.bind(this)).add("keydown",this.#ti.bind(this)).add("keydown",this.#ts.bind(this),{capture:!0})})}#te(t){let e=document.activeElement;if(!t.key||!this.$state.canSeek()||e?.matches(tz))return;let{method:i,value:s}=this.#ta(t);if(!(0,o.isString)(s)&&!(0,o.isArray)(s)){s?.onKeyUp?.({event:t,player:this.#D.player,remote:this.#D.remote}),s?.callback?.(t,this.#D.remote);return}if(i?.startsWith("seek")&&(t.preventDefault(),t.stopPropagation(),this.#Z?(this.#tn(t,"seekForward"===i),this.#Z=null):(this.#D.remote.seek(this.#tr,t),this.#tr=void 0)),i?.startsWith("volume")){let e=this.el.querySelector("[data-media-volume-slider]");e?.dispatchEvent(new KeyboardEvent("keyup",{key:"volumeUp"===i?"Up":"Down",shiftKey:t.shiftKey,trigger:t}))}}#ti(t){if(!t.key||tj.has(t.key))return;let e=document.activeElement;if(e?.matches(tz)||(0,o.isKeyboardClick)(t)&&e?.matches('button, [role="button"]'))return;let{method:i,value:s}=this.#ta(t),a=!t.metaKey&&/^[0-9]$/.test(t.key);if(!(0,o.isString)(s)&&!(0,o.isArray)(s)&&!a){s?.onKeyDown?.({event:t,player:this.#D.player,remote:this.#D.remote}),s?.callback?.(t,this.#D.remote);return}if(!i&&a&&!function(t){for(let e of tj)if(t[e.toLowerCase()+"Key"])return!0;return!1}(t)){t.preventDefault(),t.stopPropagation(),this.#D.remote.seek(this.$state.duration()/10*Number(t.key),t);return}if(i){switch(t.preventDefault(),t.stopPropagation(),i){case"seekForward":case"seekBackward":this.#th(t,i,"seekForward"===i);break;case"volumeUp":case"volumeDown":let e=this.el.querySelector("[data-media-volume-slider]");if(e)e.dispatchEvent(new KeyboardEvent("keydown",{key:"volumeUp"===i?"Up":"Down",shiftKey:t.shiftKey,trigger:t}));else{let e=t.shiftKey?.1:.05;this.#D.remote.changeVolume(this.$state.volume()+("volumeUp"===i?+e:-e),t)}break;case"toggleFullscreen":this.#D.remote.toggleFullscreen("prefer-media",t);break;case"speedUp":case"slowDown":let s=this.$state.playbackRate();this.#D.remote.changePlaybackRate(Math.max(.25,Math.min(2,s+("speedUp"===i?.25:-.25))),t);break;default:this.#D.remote[i]?.(t)}this.$state.lastKeyboardAction.set({action:i,event:t})}}#ts(t){var e,i;i=e=t.target,(!u&&i instanceof HTMLAudioElement||!u&&e instanceof HTMLVideoElement)&&this.#ta(t).method&&t.preventDefault()}#ta(t){let e={...this.$props.keyShortcuts(),...this.#D.ariaKeys},i=Object.keys(e).find(i=>{let s=e[i],a=(0,o.isArray)(s)?s.join(" "):(0,o.isString)(s)?s:s?.keys,n=(o.isArray(a)?a:a?.split(" "))?.map(t=>t.replace(/Shift\+(\d)/g,(t,e)=>tX[e-1]).replace(/Control/g,"Ctrl").split("+"));return n?.some(e=>{let i=new Set(e.filter(t=>tj.has(t)));for(let e of tj){let s=e.toLowerCase()+"Key";if(!i.has(e)&&t[s])return!1}return e.every(e=>tj.has(e)?t[e.toLowerCase()+"Key"]:t.key===e.replace("Space"," "))})});return{method:i,value:i?e[i]:null}}#tr;#to(t,e){let i=t.shiftKey?10:5;return this.#tr=Math.max(0,Math.min((this.#tr??this.$state.currentTime())+("seekForward"===e?+i:-i),this.$state.duration()))}#Z;#tn(t,e){this.#Z?.dispatchEvent(new KeyboardEvent(t.type,{key:e?"Right":"Left",shiftKey:t.shiftKey,trigger:t}))}#th(t,e,i){this.$state.canSeek()&&(this.#Z||(this.#Z=this.el.querySelector("[data-media-time-slider]")),this.#Z?this.#tn(t,i):this.#D.remote.seeking(this.#to(t,e),t))}}let tX=["!","@","#","$","%","^","&","*","(",")"];class tY extends o.ViewController{#tl;constructor(t){super(),this.#tl=t}onAttach(t){let{$props:e,ariaKeys:i}=tl(),s=t.getAttribute("aria-keyshortcuts");if(s){i[this.#tl]=s,u||(0,o.onDispose)(()=>{delete i[this.#tl]});return}let a=e.keyShortcuts()[this.#tl];
1if(a){let e=(0,o.isArray)(a)?a.join(" "):(0,o.isString)(a)?a:a?.keys;t.setAttribute("aria-keyshortcuts",(0,o.isArray)(e)?e.join(" "):e)}}}class tJ extends tH{#td;#tu;#tc;#tp;#tm;#tg;get canIdle(){return this.#tg()}set canIdle(t){this.#tg.set(t)}get hideOnMouseLeave(){let{hideControlsOnMouseLeave:t}=this.$props;return this.#tc()||t()}set hideOnMouseLeave(t){this.#tc.set(t)}get showing(){return this.$state.controlsVisible()}show(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1?arguments[1]:void 0;this.#tf(),this.#tu||this.#ty(!0,t,e)}hide(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.defaultDelay,e=arguments.length>1?arguments[1]:void 0;this.#tf(),this.#tu||this.#ty(!1,t,e)}pause(t){this.#tu=!0,this.#tf(),this.#ty(!0,0,t)}resume(t){this.#tu=!1,this.$state.paused()||this.#ty(!1,this.defaultDelay,t)}onConnect(){(0,o.effect)(this.#tb.bind(this))}#tb(){let{viewType:t}=this.$state;if(!this.el||!this.#tg())return;if("audio"===t()){this.show();return}(0,o.effect)(this.#tv.bind(this)),(0,o.effect)(this.#tw.bind(this));let e=this.#tk.bind(this),i=this.#t$.bind(this),s=this.#tT.bind(this);new o.EventsController(this.el).add("can-play",t=>this.show(0,t)).add("play",e).add("pause",i).add("end",s).add("auto-play-fail",i)}#tv(){if(!this.el)return;let{started:t,pointer:e,paused:i}=this.$state;if(!t()||"fine"!==e())return;let s=new o.EventsController(this.el),a=this.hideOnMouseLeave;a&&this.#tp()||(0,o.effect)(()=>{i()||s.add("pointermove",this.#tx.bind(this))}),a&&s.add("mouseenter",this.#tS.bind(this)).add("mouseleave",this.#tC.bind(this))}#tw(){let{paused:t,started:e,autoPlayError:i}=this.$state;if(t()||i()&&!e())return;let s=this.#tx.bind(this);(0,o.effect)(()=>{if(!this.el)return;let t=this.$state.pointer(),e=new o.EventsController(this.el);for(let i of["coarse"===t?"touchend":"pointerup","keydown"])e.add(i,s,{passive:!1})})}#tk(t){t.triggers.hasType("ended")||(this.show(0,t),this.hide(void 0,t))}#t$(t){this.show(0,t)}#tT(t){let{loop:e}=this.$state;e()&&this.hide(0,t)}#tS(t){this.#tp.set(!1),this.show(0,t),this.hide(void 0,t)}#tC(t){this.#tp.set(!0),this.hide(0,t)}#tf(){window.clearTimeout(this.#td),this.#td=-1}#tx(t){t.MEDIA_GESTURE||this.#tu||tL(t)||((0,o.isKeyboardEvent)(t)&&("Escape"===t.key?(this.el?.focus(),this.#tm=null):this.#tm&&(t.preventDefault(),requestAnimationFrame(()=>{this.#tm?.focus(),this.#tm=null}))),this.show(0,t),this.hide(this.defaultDelay,t))}#ty(t,e,i){if(0===e){this.#C(t,i);return}this.#td=window.setTimeout(()=>{this.scope&&this.#C(t&&!this.#tu,i)},e)}#C(t,e){this.$state.controlsVisible()!==t&&(this.$state.controlsVisible.set(t),!t&&document.activeElement&&this.el?.contains(document.activeElement)&&(this.#tm=document.activeElement,requestAnimationFrame(()=>{this.el?.focus({preventScroll:!0})}
1)),this.dispatch("controls-change",{detail:t,trigger:e}))}constructor(...t){super(...t),this.#td=-2,this.#tu=!1,this.#tc=(0,o.signal)(!1),this.#tp=(0,o.signal)(!1),this.#tm=null,this.#tg=(0,o.signal)(!0),this.defaultDelay=2e3}}let tZ=o.fscreen.fullscreenEnabled;class t0 extends o.ViewController{#tP;#tE;get active(){return this.#tE}get supported(){return tZ}onConnect(){new o.EventsController(o.fscreen).add("fullscreenchange",this.#C.bind(this)).add("fullscreenerror",this.#tA.bind(this)),(0,o.onDispose)(this.#tq.bind(this))}async #tq(){tZ&&await this.exit()}#C(t){let e=t1(this.el);e!==this.#tE&&(e||(this.#tP=!1),this.#tE=e,this.dispatch("fullscreen-change",{detail:e,trigger:t}))}#tA(t){this.#tP&&(this.dispatch("fullscreen-error",{detail:null,trigger:t}),this.#tP=!1)}async enter(){try{if(this.#tP=!0,!this.el||t1(this.el))return;return t2(),o.fscreen.requestFullscreen(this.el)}catch(t){throw this.#tP=!1,t}}async exit(){if(this.el&&t1(this.el))return t2(),o.fscreen.exitFullscreen()}constructor(...t){super(...t),this.#tP=!1,this.#tE=!1}}function t1(t){if(o.fscreen.fullscreenElement===t)return!0;try{return t.matches(o.fscreen.fullscreenPseudoClass)}catch(t){return!1}}function t2(){if(!tZ)throw Error("[vidstack] no fullscreen API")}class t3 extends o.ViewController{#tM;#tD;#tR;get type(){return this.#tM()}get locked(){return this.#tD()}get portrait(){return this.#tM().startsWith("portrait")}get landscape(){return this.#tM().startsWith("landscape")}static #e=this.supported=y();get supported(){return t3.supported}onConnect(){if(this.supported)(0,o.listenEvent)(screen.orientation,"change",this.#tL.bind(this));else{let t=window.matchMedia("(orientation: landscape)");t.onchange=this.#tL.bind(this),(0,o.onDispose)(()=>t.onchange=null)}(0,o.onDispose)(this.#tq.bind(this))}async #tq(){this.supported&&this.#tD()&&await this.unlock()}#tL(t){this.#tM.set(this.#tI()),this.dispatch("orientation-change",{detail:{orientation:(0,o.peek)(this.#tM),lock:this.#tR},trigger:t})}async lock(t){(0,o.peek)(this.#tD)||this.#tR===t||(this.#tV(),await screen.orientation.lock(t),this.#tD.set(!0),this.#tR=t)}async unlock(){(0,o.peek)(this.#tD)&&(this.#tV(),this.#tR=void 0,await screen.orientation.unlock(),this.#tD.set(!1))}#tV(){if(!this.supported)throw Error("[vidstack] no orientation API")}#tI(){return u?"portrait-primary":this.supported?window.screen.orientation.type:window.innerWidth>=window.innerHeight?"landscape-primary":"portrait-primary"}constructor(...t){super(...t),this.#tM=(0,o.signal)(this.#tI()),this.#tD=(0,o.signal)(!1)}}class t6{canPlay(t){return!!V(t)&&(u||!(0,o.isString)(t.src)||"?"===t.type||b(this.target,t.type))}mediaType(){return"audio"}async load(t){if(u)throw Error("[vidstack] can not load audio provider server-side");return new(await i.e(6).then(i.bind(i,60006))).AudioProvider(this.target,t)}constructor(){this.name="audio"}}class t5{canPlay(t){return!!O(t)&&(u||!(0,o.isString)(t.src)||"?"===t.type||v(this.target,t.type))}mediaType(){return"video"}async load(t){if(u)throw Error("[vidstack] can not load video provider server-side");return new(await Promise.resolve().then(function(){return eb})).VideoProvider(this.target,t)}constructor(){this.name="video"}}class t7 extends t5{static #e=this.supported=x();canPlay(t){return t7.supported&&F(t)}async load(t){if(u)throw Error("[vidstack] can not load hls provider server-side");return new(await i.e(2366).then(i.bind(i,2366))).HLSProvider(this.target,t)}constructor(...t){super(...t),this.name="hls"}}let t4=null,t9=[],t8=[];function et(){return t4??=new AudioContext}function ee(){t4&&0===t9.length&&0===t8.length&&t4.close().then(()=>{t4=null})}class ei{#D;#C;#tO;#tF;get currentGain(){return this.#tO?.gain?.value??null}get supported(){return!0}constructor(t,e){this.#tO=null,this.#tF=null,this.#D=t,this.#C=e}setGain(t){let e=this.currentGain;if(t!==this.currentGain){if(1===t&&1!==e){this.removeGain();return}!this.#tO&&(this.#tO=function(){let t=et(),e=t.createGain();return e.connect(t.destination),t9.push(e),e}(),this.#tF&&this.#tF.connect(this.#tO)),this.#tF||(this.#tF=function(t,e){let i=et().createMediaElementSource(t);return e&&i.connect(e),t8.push(i),i}(this.#D,this.#tO)),this.#tO.gain.value=t,this.#C(t)}}removeGain(){this.#tO&&(this.#tF&&this.#tF.connect(et().destination),this.#tN(),this.#C(null))}destroy(){this.#tU(),this.#tN()}
1#tU(){if(this.#tF)try{!function(t){let e=t8.indexOf(t);-1!==e&&(t8.splice(e,1),t.disconnect(),ee())}(this.#tF)}catch(t){}finally{this.#tF=null}}#tN(){if(this.#tO)try{!function(t){let e=t9.indexOf(t);-1!==e&&(t9.splice(e,1),t.disconnect(),ee())}(this.#tO)}catch(t){}finally{this.#tO=null}}}let es=["focus","blur","visibilitychange","pageshow","pagehide"];class ea{#tK;#tB;#tG;connect(){let t=new o.EventsController(window),e=this.#tQ.bind(this);for(let i of es)t.add(i,e);f&&t.add("beforeunload",t=>{this.#tG=setTimeout(()=>{t.defaultPrevented||t.returnValue.length>0||(this.#tK.set("hidden"),this.#tB.set("hidden"))},0)})}get pageState(){return this.#tK()}get visibility(){return this.#tB()}#tQ(t){f&&window.clearTimeout(this.#tG),("blur"!==t.type||"active"===this.#tK())&&(this.#tK.set(en(t)),this.#tB.set("hidden"==document.visibilityState?"hidden":"visible"))}constructor(){this.#tK=(0,o.signal)(en()),this.#tB=(0,o.signal)(u?"visible":document.visibilityState)}}function en(t){return u||t?.type==="blur"||"hidden"===document.visibilityState?"hidden":document.hasFocus()?"active":"passive"}class er{#tW;#tH;constructor(t){this.#tH=t}start(){(0,o.isUndefined)(this.#tW)&&this.#tj()}stop(){(0,o.isNumber)(this.#tW)&&window.cancelAnimationFrame(this.#tW),this.#tW=void 0}#tj(){this.#tW=window.requestAnimationFrame(()=>{(0,o.isUndefined)(this.#tW)||(this.#tH(),this.#tj())})}}class eh{#tz;#t_;#tX;#tY;#tJ;#tZ;#t0;#t1;get #D(){return this.#tz.media}constructor(t,e){this.#tX=!1,this.#tY=!1,this.#tJ=!1,this.#tZ=new er(this.#t2.bind(this)),this.#t0=new ea,this.#t3=0,this.#t6=-1,this.#t5=void 0,this.#t7=void 0,this.#tz=t,this.#t_=e,this.#t1=new o.EventsController(t.media),this.#t4(),this.#t0.connect(),(0,o.effect)(this.#t9.bind(this)),(0,o.onDispose)(this.#t8.bind(this))}#t8(){this.#tY=!1,this.#tJ=!1,this.#tZ.stop(),this.#t1.abort(),this.#t5?.clear()}#t3;#t6;#t2(){let t=this.#D.currentTime;f&&t-this.#t6<.35||this.#t3===t||(this.#et(t),this.#t3=t)}#t4(){this.#ee("loadstart",this.#ei),this.#ee("abort",this.#es),this.#ee("emptied",this.#ea),this.#ee("error",this.#tA),this.#ee("volumechange",this.#en)}#er(){this.#tY||(this.#ee("loadeddata",this.#eh),this.#ee("loadedmetadata",this.#eo),this.#ee("canplay",this.#el),this.#ee("canplaythrough",this.#ed),this.#ee("durationchange",this.#eu),this.#ee("play",this.#tk),this.#ee("progress",this.#ec),this.#ee("stalled",this.#ep),this.#ee("suspend",this.#em),this.#ee("ratechange",this.#eg),this.#tY=!0)}#ef(){this.#tJ||(this.#ee("pause",this.#t$),this.#ee("playing",this.#ey),this.#ee("seeked",this.#eb),this.#ee("seeking",this.#ev),this.#ee("ended",this.#ew),this.#ee("waiting",this.#ek),this.#tJ=!0)}#t5;#t7;#ee(t,e){this.#t1.add(t,e.bind(this))}#e$(t){}#et(t,e){let i=Math.min(t,this.#t_.$state.seekableEnd());this.#t_.notify("time-change",i,e)}#ei(t){if(3===this.#D.networkState){this.#es(t);return}this.#er(),this.#t_.notify("load-start",void 0,t)}#es(t){this.#t_.notify("abort",void 0,t)}#ea(){this.#t_.notify("emptied",void 0,event)}#eh(t){this.#t_.notify("loaded-data",void 0,t)}#eo(t){this.#t3=0,this.#t6=-1,this.#ef(),this.#t_.notify("loaded-metadata",void 0,t),(p||f&&F(this.#t_.$state.source()))&&this.#t_.delegate.ready(this.#eT(),t)}#eT(){return{provider:(0,o.peek)(this.#t_.$provider),duration:this.#D.duration,buffered:this.#D.buffered,seekable:this.#D.seekable}}#tk(t){this.#t_.$state.canPlay&&this.#t_.notify("play",void 0,t)}#t$(t){(1!==this.#D.readyState||this.#tX)&&(this.#tX=!1,this.#tZ.stop(),this.#t_.notify("pause",void 0,t))}#el(t){this.#t_.delegate.ready(this.#eT(),t)}#ed(t){this.#t_.$state.started()||this.#t_.notify("can-play-through",this.#eT(),t)}#ey(t){this.#D.paused||(this.#tX=!1,this.#t_.notify("playing",void 0,t),this.#tZ.start())}#ep(t){this.#t_.notify("stalled",void 0,t),this.#D.readyState<3&&(this.#tX=!0,this.#t_.notify("waiting",void 0,t))}#ek(t){this.#D.readyState<3&&(this.#tX=!0,this.#t_.notify("waiting",void 0,t))}#ew(t){this.#tZ.stop(),this.#et(this.#D.duration,t),this.#t_.notify("end",void 0,t),this.#t_.$state.loop()&&(0,o.isNil)(this.#D.controls)&&(this.#D.controls=!1)}#t9(){let t=this.#t_.$state.paused(),e="hidden"===this.#t0.visibility;(t||e)&&(0,o.listenEvent)(this.#D,"timeupdate",this.#ex.bind(this))}#ex(t){this.#et(this.#D.currentTime,t)}#eu(t){this.#t_.$state.ended()&&this.#et(this.#D.duration,t),this.#t_.notify("duration-change",this.#D.duration,t)}#en(t){let e={volume:this.#D.volume,muted:this.#D.muted};this.#t_.notify("volume-change",e,t)}#eb(t){this.#t6=this.#D.currentTime,this.#et(this.#D.currentTime,t),this.#t_.notify("seeked",this.#D.currentTime,t),Math.trunc(this.#D.currentTime)===Math.trunc(this.#D.duration)&&tx(this.#D.duration)>tx(this.#D.currentTime)&&(this.#et(this.#D.duration,t),this.#D.ended||this.#t_.player.dis
1patch(new o.DOMEvent("media-play-request",{trigger:t})))}#ev(t){this.#t_.notify("seeking",this.#D.currentTime,t)}#ec(t){let e={buffered:this.#D.buffered,seekable:this.#D.seekable};this.#t_.notify("progress",e,t)}#em(t){this.#t_.notify("suspend",void 0,t)}#eg(t){this.#t_.notify("rate-change",this.#D.playbackRate,t)}#tA(t){let e=this.#D.error;if(!e)return;let i={message:e.message,code:e.code,mediaError:e};this.#t_.notify("error",i,t)}}class eo{#tz;#t_;get #eS(){return this.#tz.media.audioTracks}constructor(t,e){this.#tz=t,this.#t_=e,this.#eS.onaddtrack=this.#eC.bind(this),this.#eS.onremovetrack=this.#eP.bind(this),this.#eS.onchange=this.#eE.bind(this),(0,o.listenEvent)(this.#t_.audioTracks,"change",this.#eA.bind(this))}#eC(t){let e=t.track;if(""===e.label)return;let i={id:e.id.toString()||`native-audio-${this.#t_.audioTracks.length}`,label:e.label,language:e.language,kind:e.kind,selected:!1};this.#t_.audioTracks[tb.add](i,t),e.enabled&&(i.selected=!0)}#eP(t){let e=this.#t_.audioTracks.getById(t.track.id);e&&this.#t_.audioTracks[tb.remove](e,t)}#eE(t){let e=this.#eq();if(!e)return;let i=this.#t_.audioTracks.getById(e.id);i&&this.#t_.audioTracks[tb.select](i,!0,t)}#eq(){return Array.from(this.#eS).find(t=>t.enabled)}#eA(t){let{current:e}=t.detail;if(!e)return;let i=this.#eS.getTrackById(e.id);if(i){let t=this.#eq();t&&(t.enabled=!1),i.enabled=!0}}}class el{constructor(t,e){this.scope=(0,o.createScope)(),this.currentSrc=null,this.media=t,this.ctx=e,this.audioGain=new ei(t,t=>{this.ctx.notify("audio-gain-change",t)})}setup(){new eh(this,this.ctx),"audioTracks"in this.media&&new eo(this,this.ctx),(0,o.onDispose)(()=>{for(let t of(this.audioGain.destroy(),this.media.srcObject=null,this.media.removeAttribute("src"),this.media.querySelectorAll("source")))t.remove();this.media.load()})}get type(){return""}setPlaybackRate(t){this.media.playbackRate=t}async play(){return this.media.play()}async pause(){return this.media.pause()}setMuted(t){this.media.muted=t}setVolume(t){this.media.volume=t}setCurrentTime(t){this.media.currentTime=t}setPlaysInline(t){(0,o.setAttribute)(this.media,"playsinline",t)}async loadSource(t,e){let{src:i,type:s}=t;(this.media.preload=e||"",!u&&void 0!==window.MediaStream&&i instanceof window.MediaStream)?(this.removeSource(),this.media.srcObject=i):(this.media.srcObject=null,(0,o.isString)(i)?"?"!==s?this.appendSource({src:i,type:s}):(this.removeSource(),this.media.src=this.#eM(i)):(this.removeSource(),this.media.src=window.URL.createObjectURL(i))),this.media.load(),this.currentSrc={src:i,type:s}}appendSource(t,e){let i=this.media.querySelector("source[data-vds]"),s=i??document.createElement("source");(0,o.setAttribute)(s,"src",this.#eM(t.src)),(0,o.setAttribute)(s,"type","?"!==t.type?t.type:e),(0,o.setAttribute)(s,"data-vds",""),i||this.media.append(s)}removeSource(){this.media.querySelector("source[data-vds]")?.remove()}#eM(t){let{clipStartTime:e,clipEndTime:i}=this.ctx.$state,s=e(),a=i();return s>0&&a>0?`${t}#t=${s},${a}`:s>0?`${t}#t=${s}`:a>0?`${t}#t=0,${a}`:t}}class ed{#D;#t_;#tK;#eD;get supported(){return this.#eD()}constructor(t,e){this.#eD=(0,o.signal)(!1),this.#D=t,this.#t_=e,this.#eR()}#eR(){!u&&this.#D?.remote&&this.canPrompt&&(this.#D.remote.watchAvailability(t=>{this.#eD.set(t)}).catch(()=>{this.#eD.set(!1)}),(0,o.effect)(this.#eL.bind(this)))}#eL(){if(!this.#eD())return;let t=this.#eI.bind(this);t(),(0,o.listenEvent)(this.#D,"playing",t);let e=new o.EventsController(this.#D.remote);for(let i of["connecting","connect","disconnect"])e.add(i,t)}async prompt(){if(!this.supported)throw Error("Not supported on this platform.");return"airplay"===this.type&&this.#D.webkitShowPlaybackTargetPicker?this.#D.webkitShowPlaybackTargetPicker():this.#D.remote.prompt()}#eI(t){let e=this.#D.remote.state;if(e===this.#tK)return;let i={type:this.type,state:e};this.#t_.notify("remote-playback-change",i,t),this.#tK=e}}class eu extends ed{get canPrompt(){return"WebKitPlaybackTargetAvailabilityEvent"in window}constructor(...t){super(...t),this.type="airplay"}}class ec{#T;#t_;constructor(t,e){this.#T=t,this.#t_=e,t.textTracks.onaddtrack=this.#F.bind(this),(0,o.onDispose)(this.#t8.bind(this))}#F(t){let e=t.track;if(!e||Array.from(this.#T.children).find(t=>t.track===e))return;let i=new tt({id:e.id,kind:e.kind,label:e.label??"",language:e.language,type:"vtt"});i[Y.native]={track:e},i[Y.readyState]=2,i[Y.nativeHLS]=!0;let s=0,a=t=>{if(e.cues)for(let a=s;a<e.cues.length;a++)i.addCue(e.cues[a],t),s++};a(t),e.oncuechange=a,this.#t_.textTracks.add(i,t),i.setMode(e.mode,t)}#t8(){for(let t of(this.#T.textTracks.onaddtrack=null,this.#t_.textTracks)){let e=t[Y.native]?.track;e?.oncuechange&&(e.oncuechange=null)}}}class ep{#T;#D;constructor(t,e){this.#C=(t,e)=>{this.#D.notify("picture-in-picture-change",t,e)},this.#T=t,this.#D=e,new o.EventsController(t).add("enterpictureinpicture",this.#eV.bind(this)).add("leavepictureinpicture",this.#eO.bind(this))}get active(){return document.pictureInPictureElement===this.#T}get supported(){return k(this.#T)}
1async enter(){return this.#T.requestPictureInPicture()}exit(){return document.exitPictureInPicture()}#eV(t){this.#C(!0,t)}#eO(t){this.#C(!1,t)}#C}class em{#T;#D;#a;get mode(){return this.#a}constructor(t,e){this.#a="inline",this.#T=t,this.#D=e,(0,o.listenEvent)(t,"webkitpresentationmodechanged",this.#eF.bind(this))}get supported(){return $(this.#T)}async setPresentationMode(t){this.#a!==t&&this.#T.webkitSetPresentationMode(t)}#eF(t){let e=this.#a;this.#a=this.#T.webkitPresentationMode,this.#D.player?.dispatch(new o.DOMEvent("video-presentation-change",{detail:this.#a,trigger:t})),["fullscreen","picture-in-picture"].forEach(i=>{(this.#a===i||e===i)&&this.#D.notify(`${i}-change`,this.#a===i,t)})}}class eg{#eN;get active(){return"fullscreen"===this.#eN.mode}get supported(){return this.#eN.supported}constructor(t){this.#eN=t}async enter(){this.#eN.setPresentationMode("fullscreen")}async exit(){this.#eN.setPresentationMode("inline")}}class ef{#eN;get active(){return"picture-in-picture"===this.#eN.mode}get supported(){return this.#eN.supported}constructor(t){this.#eN=t}async enter(){this.#eN.setPresentationMode("picture-in-picture")}async exit(){this.#eN.setPresentationMode("inline")}}class ey extends el{get type(){return"video"}constructor(t,e){super(t,e),this.$$PROVIDER_TYPE="VIDEO",(0,o.scoped)(()=>{if(this.airPlay=new eu(t,e),$(t)){let i=new em(t,e);this.fullscreen=new eg(i),this.pictureInPicture=new ef(i)}else k(t)&&(this.pictureInPicture=new ep(t,e))},this.scope)}setup(){super.setup(),w(this.video)&&new ec(this.video,this.ctx),this.ctx.textRenderers.attachVideo(this.video),(0,o.onDispose)(()=>{this.ctx.textRenderers.attachVideo(null)}),"video"===this.type&&this.ctx.notify("provider-setup",this)}get video(){return this.media}}var eb=Object.freeze({__proto__:null,VideoProvider:ey});function ev(t){try{return new Intl.DisplayNames(navigator.languages,{type:"language"}).of(t)??null}catch(t){return null}}let ew=t=>`dash-${(0,o.camelToKebabCase)(t)}`;class ek{#T;#t_;#eU;#eK;#eB;get instance(){return this.#eU}constructor(t,e){this.#eU=null,this.#eK=new Set,this.#eB=null,this.config={},this.#eG=null,this.#eQ={},this.#eW=-1,this.#T=t,this.#t_=e}setup(t){this.#eU=t().create();let e=this.#eH.bind(this);for(let i of Object.values(t.events))this.#eU.on(i,e);for(let e of(this.#eU.on(t.events.ERROR,this.#tA.bind(this)),this.#eK))e(this.#eU);this.#t_.player.dispatch("dash-instance",{detail:this.#eU}),this.#eU.initialize(this.#T,void 0,!1),this.#eU.updateSettings({streaming:{text:{defaultEnabled:!1,dispatchForManualRendering:!0},buffer:{fastSwitchEnabled:!0}},...this.config}),this.#eU.on(t.events.FRAGMENT_LOADING_STARTED,this.#ej.bind(this)),this.#eU.on(t.events.FRAGMENT_LOADING_COMPLETED,this.#ez.bind(this)),this.#eU.on(t.events.MANIFEST_LOADED,this.#e_.bind(this)),this.#eU.on(t.events.QUALITY_CHANGE_RENDERED,this.#eX.bind(this)),this.#eU.on(t.events.TEXT_TRACKS_ADDED,this.#eY.bind(this)),this.#eU.on(t.events.TRACK_CHANGE_RENDERED,this.#eJ.bind(this)),this.#t_.qualities[tK.enableAuto]=this.#eZ.bind(this),(0,o.listenEvent)(this.#t_.qualities,"change",this.#e0.bind(this)),(0,o.listenEvent)(this.#t_.audioTracks,"change",this.#e1.bind(this)),this.#eB=(0,o.effect)(this.#e2.bind(this))}#e3(t){return new o.DOMEvent(ew(t.type),{detail:t})}#e2(){if(!this.#t_.$state.live())return;let t=new er(this.#e6.bind(this));return t.start(),t.stop.bind(t)}#e6(){if(!this.#eU)return;let t=this.#eU.duration()-this.#eU.time();this.#t_.$state.liveSyncPosition.set(isNaN(t)?1/0:t)}#eH(t){this.#t_.player?.dispatch(this.#e3(t))}#eG;#eQ;#e5(t){let e=this.#eG?.[Y.native],i=(e?.track).cues;if(!e||!i)return;let s=this.#eG.id,a=this.#eQ[s]??0,n=this.#e3(t);for(let t=a;t<i.length;t++){let e=i[t];e.positionAlign||(e.positionAlign="auto"),this.#eG.addCue(e,n)}this.#eQ[s]=i.length}#eY(t){if(!this.#eU)return;let e=t.tracks,i=[...this.#T.textTracks].filter(t=>"manualMode"in t),s=this.#e3(t);for(let t=0;t<i.length;t++){let a=e[t],n=i[t],r=new tt({id:`dash-${a.kind}-${t}`,label:a?.label??a.labels.find(t=>t.text)?.text??(a?.lang&&ev(a.lang))??a?.lang??void 0,language:a.lang??void 0,kind:a.kind,default:a.defaultTrack});r[Y.native]={managed:!0,track:n},r[Y.readyState]=2,r[Y.onModeChange]=()=>{this.#eU&&("showing"===r.mode?(this.#eU.setTextTrack(t),this.#eG=r):(this.#eU.setTextTrack(-1),this.#eG=null))},this.#t_.textTracks.add(r,s)}}#eJ(t){let{mediaType:e,newMediaInfo:i}=t;if("audio"===e){let e=this.#t_.audioTracks.getById(`dash-audio-${i.index}`);
1if(e){let i=this.#e3(t);this.#t_.audioTracks[tb.select](e,!0,i)}}}#eX(t){if("video"!==t.mediaType)return;let e=this.#t_.qualities[t.newQuality];if(e){let i=this.#e3(t);this.#t_.qualities[tb.select](e,!0,i)}}#e_(t){if(this.#t_.$state.canPlay()||!this.#eU)return;let{type:e,mediaPresentationDuration:i}=t.data,s=this.#e3(t);this.#t_.notify("stream-type-change","static"!==e?"live":"on-demand",s),this.#t_.notify("duration-change",i,s),this.#t_.qualities[tK.setAuto](!0,s);let a=this.#eU.getVideoElement(),n=this.#eU.getTracksForTypeFromManifest("video",t.data),r=[...new Set(n.map(t=>t.mimeType))].find(t=>t&&v(a,t)),h=n.filter(t=>r===t.mimeType)[0],l=this.#eU.getTracksForTypeFromManifest("audio",t.data),d=[...new Set(l.map(t=>t.mimeType))].find(t=>t&&b(a,t));if(l=l.filter(t=>d===t.mimeType),h.bitrateList.forEach((t,e)=>{let i={id:t.id?.toString()??`dash-bitrate-${e}`,width:t.width??0,height:t.height??0,bitrate:t.bandwidth??0,codec:h.codec,index:e};this.#t_.qualities[tb.add](i,s)}),(0,o.isNumber)(h.index)){let t=this.#t_.qualities[h.index];t&&this.#t_.qualities[tb.select](t,!0,s)}l.forEach((t,e)=>{let i=t.labels.find(t=>navigator.languages.some(e=>t.lang&&e.toLowerCase().startsWith(t.lang.toLowerCase())))||t.labels[0],a={id:`dash-audio-${t?.index}`,label:i?.text??(t.lang&&ev(t.lang))??t.lang??"",language:t.lang??"",kind:"main",mimeType:t.mimeType,codec:t.codec,index:e};this.#t_.audioTracks[tb.add](a,s)}),a.dispatchEvent(new o.DOMEvent("canplay",{trigger:s}))}#tA(t){let{type:e,error:i}=t;27===i.code?this.#e7(i):this.#e4(i)}#ej(){this.#eW>=0&&this.#e9()}#ez(t){"text"===t.mediaType&&requestAnimationFrame(this.#e5.bind(this,t))}#eW;#e7(t){this.#e9(),this.#eU?.play(),this.#eW=window.setTimeout(()=>{this.#eW=-1,this.#e4(t)},5e3)}#e9(){clearTimeout(this.#eW),this.#eW=-1}#e4(t){this.#t_.notify("error",{message:t.message??"",code:1,error:t})}#eZ(){this.#e8("video",!0);let{qualities:t}=this.#t_;this.#eU?.setQualityFor("video",t.selectedIndex,!0)}#e8(t,e){this.#eU?.updateSettings({streaming:{abr:{autoSwitchBitrate:{[t]:e}}}})}#e0(){let{qualities:t}=this.#t_;this.#eU&&!t.auto&&t.selected&&(this.#e8("video",!1),this.#eU.setQualityFor("video",t.selectedIndex,"current"===t.switch),g&&(this.#T.currentTime=this.#T.currentTime))}#e1(){if(!this.#eU)return;let{audioTracks:t}=this.#t_,e=this.#eU.getTracksFor("audio").find(e=>t.selected&&t.selected.id===`dash-audio-${e.index}`);e&&this.#eU.setCurrentTrack(e)}#it(){this.#e9(),this.#eG=null,this.#eQ={}}onInstance(t){return this.#eK.add(t),()=>this.#eK.delete(t)}loadSource(t){this.#it(),(0,o.isString)(t.src)&&this.#eU?.attachSource(t.src)}destroy(){this.#it(),this.#eU?.destroy(),this.#eU=null,this.#eB?.(),this.#eB=null}}function e$(t){return t instanceof Error?t:Error("string"==typeof t?t:JSON.stringify(t))}function eT(t,e){if(!t)throw Error("Assertion failed.")}class ex{#ie;#t_;#tH;constructor(t,e,i){this.#ie=t,this.#t_=e,this.#tH=i,this.#ii()}async #ii(){let t={onLoadStart:this.#ei.bind(this),onLoaded:this.#is.bind(this),onLoadError:this.#ia.bind(this)},e=await eC(this.#ie,t);return((0,o.isUndefined)(e)&&!(0,o.isString)(this.#ie)&&(e=await eS(this.#ie,t)),e)?window.dashjs.supportsMediaSource()?e:(this.#t_.player.dispatch(new o.DOMEvent("dash-unsupported")),this.#t_.notify("error",{message:"[vidstack] `dash.js` is not supported in this environment",code:4}),null):null}#ei(){this.#t_.player.dispatch(new o.DOMEvent("dash-lib-load-start"))}#is(t){this.#t_.player.dispatch(new o.DOMEvent("dash-lib-loaded",{detail:t})),this.#tH(t)}#ia(t){let e=e$(t);this.#t_.player.dispatch(new o.DOMEvent("dash-lib-load-error",{detail:e})),this.#t_.notify("error",{message:e.message,code:4,error:e})}}async function eS(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(0,o.isUndefined)(t)){if(e.onLoadStart?.(),t&&t.prototype&&t.prototype!==Function)return e.onLoaded?.(t),t;if(eP(t)){let i=t.MediaPlayer;return e.onLoaded?.(i),i}try{let i=(await t())?.default;if(eP(i))return e.onLoaded?.(i.MediaPlayer),i.MediaPlayer;if(i)e.onLoaded?.(i);else throw Error("");return i}catch(t){e.onLoadError?.(t)}}}async function eC(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if((0,o.isString)(t)){e.onLoadStart?.();try{if(await Q(t),!(0,o.isFunction)(window.dashjs.MediaPlayer))throw Error("");let i=window.dashjs.MediaPlayer;return e.onLoaded?.(i),i}catch(t){e.onLoadError?.(t)}}}function eP(t){return t&&"MediaPlayer"in t}class eE extends ey{#ir;#ih;get ctor(){return this.#ir}get instance(){return this.#ih.instance}static #e=this.supported=x();get type(){return"dash"}
1get canLiveSync(){return!0}#io;get config(){return this.#ih.config}set config(t){this.#ih.config=t}get library(){return this.#io}set library(t){this.#io=t}preconnect(){(0,o.isString)(this.#io)&&B(this.#io)}setup(){super.setup(),new ex(this.#io,this.ctx,t=>{this.#ir=t,this.#ih.setup(t),this.ctx.notify("provider-setup",this);let e=(0,o.peek)(this.ctx.$state.source);e&&this.loadSource(e)})}async loadSource(t,e){if(!(0,o.isString)(t.src)){this.removeSource();return}this.media.preload=e||"",this.appendSource(t,"application/x-mpegurl"),this.#ih.loadSource(t),this.currentSrc=t}onInstance(t){let e=this.#ih.instance;return e&&t(e),this.#ih.onInstance(t)}destroy(){this.#ih.destroy()}constructor(...t){super(...t),this.$$PROVIDER_TYPE="DASH",this.#ir=null,this.#ih=new ek(this.video,this.ctx),this.#io="https://cdn.jsdelivr.net/npm/[email protected]/dist/dash.all.min.js"}}var eA=Object.freeze({__proto__:null,DASHProvider:eE});class eq extends t5{static #e=this.supported=x();canPlay(t){return eq.supported&&N(t)}async load(t){if(u)throw Error("[vidstack] can not load dash provider server-side");return new(await Promise.resolve().then(function(){return eA})).DASHProvider(this.target,t)}constructor(...t){super(...t),this.name="dash"}}class eM{preconnect(){for(let t of["https://i.vimeocdn.com","https://f.vimeocdn.com","https://fresnel.vimeocdn.com"])B(t)}canPlay(t){return(0,o.isString)(t.src)&&"video/vimeo"===t.type}mediaType(){return"video"}async load(t){if(u)throw Error("[vidstack] can not load vimeo provider server-side");return new(await i.e(4713).then(i.bind(i,24713))).VimeoProvider(this.target,t)}async loadPoster(t,e,s){let{resolveVimeoVideoId:a,getVimeoVideoInfo:n}=await i.e(2606).then(i.bind(i,32606));if(!(0,o.isString)(t.src))return null;let{videoId:r,hash:h}=a(t.src);return r?n(r,s,h).then(t=>t?t.poster:null):null}constructor(){this.name="vimeo"}}class eD{preconnect(){for(let t of["https://www.google.com","https://i.ytimg.com","https://googleads.g.doubleclick.net","https://static.doubleclick.net"])B(t)}canPlay(t){return(0,o.isString)(t.src)&&"video/youtube"===t.type}mediaType(){return"video"}async load(t){if(u)throw Error("[vidstack] can not load youtube provider server-side");return new(await i.e(7704).then(i.bind(i,47704))).YouTubeProvider(this.target,t)}async loadPoster(t,e,s){let{findYouTubePoster:a,resolveYouTubeVideoId:n}=await i.e(6397).then(i.bind(i,36397)),r=(0,o.isString)(t.src)&&n(t.src);return r?a(r,s):null}constructor(){this.name="youtube"}}function eR(t,e){let i=String(t),s=i.length;if(s<e){let i="0".repeat(e-s);return`${i}${t}`}return i}function eL(t){let e=Number((t-Math.trunc(t)).toPrecision(3));return{hours:Math.trunc(t/3600),minutes:Math.trunc(t%3600/60),seconds:Math.trunc(t%60),fraction:e}}function eI(t){let{padHrs:e=null,padMins:i=null,showHrs:s=!1,showMs:a=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{hours:n,minutes:r,seconds:h,fraction:l}=eL(t),d=e?eR(n,2):n,u=i||(0,o.isNull)(i)&&t>=3600?eR(r,2):r,c=eR(h,2),p=a&&l>0?`.${String(l).replace(/^0?\./,"")}`:"",m=`${u}:${c}${p}`;return n>0||s?`${d}:${m}`:m}function eV(t){let e=[],{hours:i,minutes:s,seconds:a}=eL(t);return i>0&&e.push(`${i} hour`),s>0&&e.push(`${s} min`),(a>0||0===e.length)&&e.push(`${a} sec`),e.join(" ")}let eO=Symbol(0),eF=["autoPlay","canAirPlay","canFullscreen","canGoogleCast","canLoad","canLoadPoster","canPictureInPicture","canPlay","canSeek","ended","fullscreen","isAirPlayConnected","isGoogleCastConnected","live","liveEdge","loop","mediaType","muted","paused","pictureInPicture","playing","playsInline","remotePlaybackState","remotePlaybackType","seeking","started","streamType","viewType","waiting"],eN={artist:"",artwork:null,autoplay:!1,autoPlay:!1,clipStartTime:0,clipEndTime:0,controls:!1,currentTime:0,crossorigin:null,crossOrigin:null,duration:-1,fullscreenOrientation:"landscape",googleCast:{},load:"visible",posterLoad:"visible",logLevel:"silent",loop:!1,muted:!1,paused:!0,playsinline:!1,playsInline:!1,playbackRate:1,poster:"",preload:"metadata",preferNativeHLS:!1,src:"",title:"",controlsDelay:2e3,hideControlsOnMouseLeave:!1,viewT
1ype:"unknown",streamType:"unknown",volume:1,liveEdgeTolerance:10,minLiveDVRWindow:60,keyDisabled:!1,keyTarget:"player",keyShortcuts:{togglePaused:"k Space",toggleMuted:"m",toggleFullscreen:"f",togglePictureInPicture:"i",toggleCaptions:"c",seekBackward:"j J ArrowLeft",seekForward:"l L ArrowRight",volumeUp:"ArrowUp",volumeDown:"ArrowDown",speedUp:">",slowDown:"<"},storage:null};class eU extends tH{#tM;#tH;constructor(t,e){super(),this.#tM=t,this.#tH=e}async onAttach(t){if(u)return;let e=this.$props[this.#tM]();if("eager"===e)requestAnimationFrame(this.#tH);else if("idle"===e)(0,o.waitIdlePeriod)(this.#tH);else if("visible"===e){let e,i=new IntersectionObserver(t=>{this.scope&&t[0].isIntersecting&&(e?.(),e=void 0,this.#tH())});i.observe(t),e=(0,o.onDispose)(()=>i.disconnect())}}}class eK{#il;#D;constructor(t,e){this.#il=t,this.#D=e}notify(t){for(var e=arguments.length,i=Array(e>1?e-1:0),s=1;s<e;s++)i[s-1]=arguments[s];u||this.#il(new o.DOMEvent(t,{detail:i?.[0],trigger:i?.[1]}))}async ready(t,e){if(!u)return(0,o.untrack)(async()=>{let{logger:i}=this.#D,{autoPlay:s,canPlay:a,started:n,duration:r,seekable:h,buffered:l,remotePlaybackInfo:d,playsInline:u,savedState:c,source:p}=this.#D.$state;if(a())return;let m={duration:t?.duration??r(),seekable:t?.seekable??h(),buffered:t?.buffered??l(),provider:this.#D.$provider()};this.notify("can-play",m,e),(0,o.tick)();let g=this.#D.$provider(),{storage:f,qualities:y}=this.#D,{muted:b,volume:v,clipStartTime:w,playbackRate:k}=this.#D.$props;await f?.onLoad?.(p());let $=c()?.currentTime,T=c()?.paused,x=await f?.getTime(),S=$??x??w(),C=!1===T||!0!==T&&!n()&&s();if(g){g.setVolume(await f?.getVolume()??v()),g.setMuted(b()||!!await f?.getMuted());let t=await f?.getAudioGain()??1;t>1&&g.audioGain?.setGain?.(t),g.setPlaybackRate?.(await f?.getPlaybackRate()??k()),g.setPlaysInline?.(u()),S>0&&g.setCurrentTime(S)}let P=await f?.getVideoQuality();if(P&&y.length){let t=null,e=1/0;for(let i of y){let s=Math.abs(P.width-i.width)+Math.abs(P.height-i.height)+(P.bitrate?Math.abs(P.bitrate-(i.bitrate??0)):0);s<e&&(t=i,e=s)}t&&(t.selected=!0)}a()&&C?await this.#id(e):x&&x>0&&this.notify("started",void 0,e),d.set(null)})}async #id(t){let{player:e,$state:{autoPlaying:i,muted:s}}=this.#D;i.set(!0);let a=new o.DOMEvent("auto-play-attempt",{trigger:t});try{await e.play(a)}catch(t){}}}class eB{#iu;enqueue(t,e){this.#iu.set(t,e)}serve(t){let e=this.peek(t);return this.#iu.delete(t),e}peek(t){return this.#iu.get(t)}delete(t){this.#iu.delete(t)}clear(){this.#iu.clear()}constructor(){this.#iu=new Map}}class eG{#ic;#ip;#iu;get size(){return this.#iu.size}get isServing(){return this.#ic}async waitForFlush(){this.#ic||await this.#ip.promise}enqueue(t,e){if(this.#ic){e();return}this.#iu.delete(t),this.#iu.set(t,e)}serve(t){this.#iu.get(t)?.(),this.#iu.delete(t)}start(){this.#im(),this.#ic=!0,this.#iu.size>0&&this.#im()}stop(){this.#ic=!1}reset(){this.stop(),this.#iu.clear(),this.#ig()}#im(){for(let t of this.#iu.keys())this.serve(t);this.#ig()}#ig(){this.#ip.resolve(),this.#ip=(0,o.deferredPromise)()}constructor(){this.#ic=!1,this.#ip=(0,o.deferredPromise)(),this.#iu=new Map}}function eQ(t){return()=>t()?"true":"false"}class eW extends tH{#iy;#ib;#D;#iv;#iw;#ik;#i$;constructor(t,e,i){super(),this.#i$=new eG,this.#iT=!1,this.#iy=t,this.#ib=e,this.#D=i,this.#ik=i.$provider,this.controls=new tJ,this.#iv=new t0,this.#iw=new t3}onAttach(){this.listen("fullscreen-change",this.#ix.bind(this))}onConnect(t){let e=Object.getOwnPropertyNames(Object.getPrototypeOf(this)),i=new o.EventsController(t),s=this.#iS.bind(this);for(let t of e)t.startsWith("media-")&&i.add(t,s);this.#iC(),(0,o.effect)(this.#iP.bind(this)),(0,o.effect)(this.#iE.bind(this)),(0,o.effect)(this.#iA.bind(this)),(0,o.effect)(this.#iq.bind(this)),(0,o.effect)(this.#iM.bind(this)),(0,o.effect)(this.#iD.bind(this)),(0,o.effect)(this.#iR.bind(this))}onDestroy(){try{let t=this.createEvent("destroy"),{pictureInPicture:e,fullscreen:i}=this.$state;i()&&this.exitFullscreen("prefer-media",t),e()&&this.exitPictureInPicture(t)}catch(t){}this.#i$.reset()}#iC(){let{load:t}=this.$props,{canLoad:e}=this.$state;if("play"!==t()||e())return;
1let i=this.listen("media-play-request",t=>{this.#iL(t),i()})}#iP(){let t=this.#ik(),e=this.$state.canPlay();return t&&e&&this.#i$.start(),()=>{this.#i$.stop()}}#iS(t){t.stopPropagation(),!t.defaultPrevented&&this[t.type]&&((0,o.peek)(this.#ik)?this[t.type](t):this.#i$.enqueue(t.type,()=>{(0,o.peek)(this.#ik)&&this[t.type](t)}))}async play(t){if(u)return;let{canPlay:e,paused:i,autoPlaying:s}=this.$state;if(this.#iL(t)||!(0,o.peek)(i))return;t&&this.#ib.queue.enqueue("media-play-request",t);let a=(0,o.peek)(s);try{let t=(0,o.peek)(this.#ik);return eH(t,(0,o.peek)(e)),function(t){if("undefined"!=typeof window&&window.matchMedia("(prefers-reduced-motion: reduce)").matches&&t)throw Error("[vidstack] autoplay blocked")}(a),await t.play()}catch(i){let e=this.createEvent("play-fail",{detail:e$(i),trigger:t});throw e.autoPlay=a,this.#iy.handle(e),i}}#iL(t){let{load:e}=this.$props,{canLoad:i}=this.$state;if("play"===e()&&!i()){let e=this.createEvent("media-start-loading",{trigger:t});return this.dispatchEvent(e),this.#i$.enqueue("media-play-request",async()=>{try{await this.play(e)}catch(t){}}),!0}return!1}async pause(t){if(u)return;let{canPlay:e,paused:i}=this.$state;if(!(0,o.peek)(i)){t&&this.#ib.queue.enqueue("media-pause-request",t);try{let t=(0,o.peek)(this.#ik);return eH(t,(0,o.peek)(e)),await t.pause()}catch(t){throw this.#ib.queue.delete("media-pause-request"),t}}}setAudioGain(t,e){let{audioGain:i,canSetAudioGain:s}=this.$state;if(i()===t)return;let a=this.#ik();if(!a?.audioGain||!s())throw Error("[vidstack] audio gain api not available");e&&this.#ib.queue.enqueue("media-audio-gain-change-request",e),a.audioGain.setGain(t)}seekToLiveEdge(t){if(u)return;let{canPlay:e,live:i,liveEdge:s,canSeek:a,liveSyncPosition:n,seekableEnd:r,userBehindLiveEdge:h}=this.$state;if(h.set(!1),(0,o.peek)(()=>!i()||s()||!a()))return;let l=(0,o.peek)(this.#ik);eH(l,(0,o.peek)(e)),t&&this.#ib.queue.enqueue("media-seek-request",t);let d=r()-2;l.setCurrentTime(Math.min(d,n()??d))}#iT;async enterFullscreen(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"prefer-media",e=arguments.length>1?arguments[1]:void 0;if(u)return;let i=this.#iI(t);if(ej(t,i),!i.active)return(0,o.peek)(this.$state.pictureInPicture)&&(this.#iT=!0,await this.exitPictureInPicture(e)),e&&this.#ib.queue.enqueue("media-enter-fullscreen-request",e),i.enter()}async exitFullscreen(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"prefer-media",e=arguments.length>1?arguments[1]:void 0;if(u)return;let i=this.#iI(t);if(ej(t,i),i.active){e&&this.#ib.queue.enqueue("media-exit-fullscreen-request",e);try{let t=await i.exit();return this.#iT&&(0,o.peek)(this.$state.canPictureInPicture)&&await this.enterPictureInPicture(),t}finally{this.#iT=!1}}}#iI(t){let e=(0,o.peek)(this.#ik);return"prefer-media"===t&&this.#iv.supported||"media"===t?this.#iv:e?.fullscreen}async enterPictureInPicture(t){if(!u&&(this.#iV(),!this.$state.pictureInPicture()))return t&&this.#ib.queue.enqueue("media-enter-pip-request",t),await this.#ik().pictureInPicture.enter()}async exitPictureInPicture(t){if(!u&&(this.#iV(),this.$state.pictureInPicture()))return t&&this.#ib.queue.enqueue("media-exit-pip-request",t),await this.#ik().pictureInPicture.exit()}#iV(){if(!this.$state.canPictureInPicture())throw Error("[vidstack] no pip support")}#iE(){this.controls.defaultDelay=this.$props.controlsDelay()}#iA(){let{canSetAudioGain:t}=this.$state,e=!!this.#ik()?.audioGain?.supported;t.set(e)}#iq(){let{canAirPlay:t}=this.$state,e=!!this.#ik()?.airPlay?.supported;t.set(e)}#iM(){let{canGoogleCast:t,source:e}=this.$state,i=g&&!p&&U(e());t.set(i)}#iD(){let{canFullscreen:t}=this.$state,e=this.#iv.supported||!!this.#ik()?.fullscreen?.supported;t.set(e)}#iR(){let{canPictureInPicture:t}=this.$state,e=!!this.#ik()?.pictureInPicture?.supported;t.set(e)}async "media-airplay-request"(t){try{await this.requestAirPlay(t)}catch(t){}}async requestAirPlay(t){try{let e=this.#ik()?.airPlay;if(!e?.supported)throw Error("No AirPlay adapter.");return t&&this.#ib.queue.enqueue("media-airplay-request",t),await e.prompt()}catch(t){throw this.#ib.queue.delete("media-airplay-request"),t}}async "media-google-cast-request"(t){try{await this.requestGoogleCast(t)}
1catch(t){}}#iO;async requestGoogleCast(t){try{let{canGoogleCast:e}=this.$state;if(!(0,o.peek)(e)){let t=Error("Cast not available.");throw t.code="CAST_NOT_AVAILABLE",t}if(B("https://www.gstatic.com"),!this.#iO){let t=await i.e(2702).then(i.bind(i,42702)).then(function(t){return t.loader});this.#iO=new t.GoogleCastLoader}await this.#iO.prompt(this.#D),t&&this.#ib.queue.enqueue("media-google-cast-request",t);let s="disconnected"!==(0,o.peek)(this.$state.remotePlaybackState);s&&this.$state.savedState.set({paused:(0,o.peek)(this.$state.paused),currentTime:(0,o.peek)(this.$state.currentTime)}),this.$state.remotePlaybackLoader.set(s?this.#iO:null)}catch(t){throw this.#ib.queue.delete("media-google-cast-request"),t}}"media-clip-start-change-request"(t){let{clipStartTime:e}=this.$state;e.set(t.detail)}"media-clip-end-change-request"(t){let{clipEndTime:e}=this.$state;e.set(t.detail),this.dispatch("duration-change",{detail:t.detail,trigger:t})}"media-duration-change-request"(t){let{providedDuration:e,clipEndTime:i}=this.$state;e.set(t.detail),0>=i()&&this.dispatch("duration-change",{detail:t.detail,trigger:t})}"media-audio-track-change-request"(t){let{logger:e,audioTracks:i}=this.#D;if(i.readonly)return;let s=i[t.detail];if(s){let e=t.type;this.#ib.queue.enqueue(e,t),s.selected=!0}}async "media-enter-fullscreen-request"(t){try{await this.enterFullscreen(t.detail,t)}catch(e){this.#iF(e,t)}}async "media-exit-fullscreen-request"(t){try{await this.exitFullscreen(t.detail,t)}catch(e){this.#iF(e,t)}}async #ix(t){let e=(0,o.peek)(this.$props.fullscreenOrientation),i=t.detail;if(!(0,o.isUndefined)(e)&&"none"!==e&&this.#iw.supported){if(i){if(this.#iw.locked)return;this.dispatch("media-orientation-lock-request",{detail:e,trigger:t})}else this.#iw.locked&&this.dispatch("media-orientation-unlock-request",{trigger:t})}}#iF(t,e){this.#iy.handle(this.createEvent("fullscreen-error",{detail:e$(t)}))}async "media-orientation-lock-request"(t){let e=t.type;try{this.#ib.queue.enqueue(e,t),await this.#iw.lock(t.detail)}catch(t){this.#ib.queue.delete(e)}}async "media-orientation-unlock-request"(t){let e=t.type;try{this.#ib.queue.enqueue(e,t),await this.#iw.unlock()}catch(t){this.#ib.queue.delete(e)}}async "media-enter-pip-request"(t){try{await this.enterPictureInPicture(t)}catch(e){this.#iN(e,t)}}async "media-exit-pip-request"(t){try{await this.exitPictureInPicture(t)}catch(e){this.#iN(e,t)}}#iN(t,e){this.#iy.handle(this.createEvent("picture-in-picture-error",{detail:e$(t)}))}"media-live-edge-request"(t){let{live:e,liveEdge:i,canSeek:s}=this.$state;if(!(!e()||i())&&s()){this.#ib.queue.enqueue("media-seek-request",t);try{this.seekToLiveEdge()}catch(t){this.#ib.queue.delete("media-seek-request")}}}async "media-loop-request"(t){try{this.#ib.looping=!0,this.#ib.replaying=!0,await this.play(t)}catch(t){this.#ib.looping=!1}}"media-user-loop-change-request"(t){this.$state.userPrefersLoop.set(t.detail)}async "media-pause-request"(t){if(!this.$state.paused())try{await this.pause(t)}catch(t){}}async "media-play-request"(t){if(this.$state.paused())try{await this.play(t)}catch(t){}}"media-rate-change-request"(t){let{playbackRate:e,canSetPlaybackRate:i}=this.$state;if(e()===t.detail||!i())return;let s=this.#ik();s?.setPlaybackRate&&(this.#ib.queue.enqueue("media-rate-change-request",t),s.setPlaybackRate(t.detail))}"media-audio-gain-change-request"(t){try{this.setAudioGain(t.detail,t)}catch(t){}}"media-quality-change-request"(t){let{qualities:e,storage:i,logger:s}=this.#D;if(e.readonly)return;this.#ib.queue.enqueue("media-quality-change-request",t);let a=t.detail;if(a<0)e.autoSelect(t),t.isOriginTrusted&&i?.setVideoQuality?.(null);else{let s=e[a];s&&(s.selected=!0,t.isOriginTrusted&&i?.setVideoQuality?.({id:s.id,width:s.width,height:s.height,bitrate:s.bitrate}))}}"media-pause-controls-request"(t){let e=t.type;this.#ib.queue.enqueue(e,t),this.controls.pause(t)}"media-resume-controls-request"(t){let e=t.type;this.#ib.queue.enqueue(e,t),this.controls.resume(t)}"media-seek-request"(t){let{canSeek:e,ended:i,live:s,seekableEnd:a,userBehindLiveEdge:n}=this.$state,r=t.detail;i()&&(this.#ib.replaying=!0);let h=t.type;this.#ib.seeking=!1,this.#ib.queue.delete(h);let o=th(r,this.$state);Number.isFinite(o)&&e()&&(this.#ib.queue.enqueue(h,t),this.#ik().setCurrentTime(o),s()&&t.isOriginTrusted&&Math.abs(a()-o)>=2&&n.set(!0))}"media-seeking-request"(t){let e=t.type;this.#ib.queue.enqueue(e,t),this.$state.seeking.set(!0),this.#ib.seeking=!0}"media-start-loading"(t){if(this.$state.canLoad())return;let e=t.type;this.#ib.queue.enqueue(e,t),this.#iy.handle(this.createEvent("can-load"))}"media-poster-start-loading"(t){if(this.$state.canLoadPoster())return;let e=t.type;this.#ib.queue.enqueue(e,t),this.#iy.handle(this.createEvent("can-load-poster"))}"media-text-track-change-request"(t){let{index:e,mode:i}=t.detail,s=this.#D.textTracks[e];if(s){let e=t.type;this.#ib.queue.enqueue(e,t),s.setMode(i,t)}}"media-mute-request"(t){if(this.$state.muted())return;let e=t.type;this.#ib.queue.enqueue(e,t),this.#ik().setMuted(!0)}"media-unmute-request"(t){let{muted:e,volume:i}=this.$state;if(!e())return;let s=t.type;this.#ib.queue.enqueue(s,t),this.#D.$provider().setMuted(!1),0===i()&&(this.#ib.queue.enqueue(s,t),this.#ik().setVolume(.25))}"media-volume-change-request"(t){let{muted:e,volume:i}=this.$state,s=t.detail;if(i()===s)return;let a=t.type;this.#ib.queue.enqueue(a,t),this.#ik().setVolume(s),s>
10&&e()&&(this.#ib.queue.enqueue(a,t),this.#ik().setMuted(!1))}#iU(t,e,i){}}function eH(t,e){if(!t||!e)throw Error("[vidstack] media not ready")}function ej(t,e){if(!e?.supported)throw Error("[vidstack] no fullscreen support")}class ez{constructor(){this.seeking=!1,this.looping=!1,this.replaying=!1,this.queue=new eB}}let e_=new Set(["auto-play","auto-play-fail","can-load","sources-change","source-change","load-start","abort","error","loaded-metadata","loaded-data","can-play","play","play-fail","pause","playing","seeking","seeked","waiting"]);class eX extends tH{#ib;#D;#iK;#iB;#iG;#iQ;#iW;#iH;constructor(t,e){super(),this.#iK=new Map,this.#iB=!1,this.#iG=[],this.#iQ=[-1,-1],this.#iW=!1,this.#ij=!1,this.#iz=null,this.seeking=(0,o.functionThrottle)(t=>{let{seeking:e,realCurrentTime:i,paused:s}=this.$state;e.set(!0),i.set(t.detail),this.#i_("media-seeking-request",t),s()&&(this.#iH=t,this.#iX()),this.#iQ=[-1,-1]},150,{leading:!0}),this.#iX=(0,o.functionDebounce)(()=>{if(!this.#iH)return;this.#iW=!0;let{waiting:t,playing:e}=this.$state;t.set(!0),e.set(!1);let i=this.createEvent("waiting",{trigger:this.#iH});this.#iK.set("waiting",i),this.dispatch(i),this.#iH=void 0,this.#iW=!1},300),this.#ib=t,this.#D=e}onAttach(t){t.setAttribute("aria-busy","true"),new o.EventsController(this).add("fullscreen-change",this["fullscreen-change"].bind(this)).add("fullscreen-error",this["fullscreen-error"].bind(this)).add("orientation-change",this["orientation-change"].bind(this))}onConnect(t){(0,o.effect)(this.#iY.bind(this)),this.#iJ(),this.#iZ(),this.#i0(),this.#i1(),(0,o.onDispose)(this.#i2.bind(this))}onDestroy(){let{audioTracks:t,qualities:e,textTracks:i}=this.#D;t[tb.reset](),e[tb.reset](),i[tb.reset](),this.#i3()}handle(t){if(!this.scope)return;let e=t.type;(0,o.untrack)(()=>this[t.type]?.(t)),u||(e_.has(e)&&this.#iK.set(e,t),this.dispatch(t))}#ij;#i1(){this.#ij&&(requestAnimationFrame(()=>{this.scope&&this.#D.remote.play(new o.DOMEvent("dom-connect"))}),this.#ij=!1)}#i2(){this.#ij||(this.#ij=!this.$state.paused(),this.#D.$provider()?.pause())}#i6(){this.#i5(),this.#iB=!1,this.#ib.replaying=!1,this.#ib.looping=!1,this.#iW=!1,this.#iH=void 0,this.#iK.clear()}#i_(t,e){let i=this.#ib.queue.serve(t);i&&(e.request=i,e.triggers.add(i))}#iJ(){this.#i7(),this.#i4();let t=this.#D.textTracks;new o.EventsController(t).add("add",this.#i7.bind(this)).add("remove",this.#i7.bind(this)).add("mode-change",this.#i4.bind(this))}#iZ(){let t=this.#D.qualities;new o.EventsController(t).add("add",this.#i9.bind(this)).add("remove",this.#i9.bind(this)).add("change",this.#eX.bind(this)).add("auto-change",this.#i8.bind(this)).add("readonly-change",this.#st.bind(this))}#i0(){let t=this.#D.audioTracks;new o.EventsController(t).add("add",this.#se.bind(this)).add("remove",this.#se.bind(this)).add("change",this.#si.bind(this))}#i7(t){let{textTracks:e}=this.$state;e.set(this.#D.textTracks.toArray()),this.dispatch("text-tracks-change",{detail:e(),trigger:t})}#i4(t){t&&this.#i_("media-text-track-change-request",t);let e=this.#D.textTracks.selected,{textTrack:i}=this.$state;i()!==e&&(i.set(e),this.dispatch("text-track-change",{detail:e,trigger:t}))}#se(t){let{audioTracks:e}=this.$state;e.set(this.#D.audioTracks.toArray()),this.dispatch("audio-tracks-change",{detail:e(),trigger:t})}#si(t){let{audioTrack:e}=this.$state;e.set(this.#D.audioTracks.selected),t&&this.#i_("media-audio-track-change-request",t),this.dispatch("audio-track-change",{detail:e(),trigger:t})}#i9(t){let{qualities:e}=this.$state;e.set(this.#D.qualities.toArray()),this.dispatch("qualities-change",{detail:e(),trigger:t})}#eX(t){let{quality:e}=this.$state;e.set(this.#D.qualities.selected),t&&this.#i_("media-quality-change-request",t),this.dispatch("quality-change",{detail:e(),trigger:t})}#i8(){let{qualities:t}=this.#D,e=t.auto;this.$state.autoQuality.set(e),e||this.#i3()}#iz;#ss(){this.#i3(),this.#iz=(0,o.effect)(()=>{let{qualities:t}=this.#D,{mediaWidth:e,mediaHeight:i}=this.$state,s=e(),a=i();if(0===s||0===a)return;let n=null,r=1/0;for(let e of t){let t=Math.abs(e.width-s)+Math.abs(e.height-a);t<r&&(r=t,n=e)}n&&t[tb.select](n,!0,new o.DOMEvent("resize",{detail:{width:s,height:a}}))})}#i3(){this.#iz?.(),this.#iz=null}#st(){this.$state.canSetQuality.set(!this.#D.qualities.readonly)}#iY(){let{canSetVolume:t,isGoogleCastConnected:e}=this.$state;if(e()){t.set(!1);return}T().then(t.set)}"provider-change"(t){let e=this.#D.$provider(),i=t.detail;e?.type!==i?.type&&(e?.destroy?.(),e?.scope?.dispose(),this.#D.$provider.set(t.detail),e&&null===t.detail&&this.#sa(t))}"provider-loader-change"(t){}"auto-play"(t){this.$state.autoPlayError.set(null)}"auto-play-fail"(t){this.$state.autoPlayError.set(t.detail),this.#i6()}"can-load"(t){this.$state.canLoad.set(!0),this.#iK.set("can-load",t),this.#D.textTracks[Y.canLoad](),this.#i_("media-start-loading",t)}"can-load-poster"(t){this.$state.canLoadPoster.set(!0),this.#iK.set("can-load-poster",t),this.#i_("media-poster-start-loading",t)}"media-type-change"(t){let e=this.#iK.get("source-change");e&&t.triggers.add(e);let i=this.$state.viewType();this.$state.mediaType.set(t.detail);let s=this.$state.providedViewType(),a="unknown"===s?t.detail:s;i!==a&&(u?this.$state.inferredViewType.set(a):setTimeout(()=>{requestAnimationFrame(()=>{this.scope&&(this.$state.inferredViewType.set(t.detail),this.dispatch("view-type-change",{detail:a,trigger:t}))})},0))}"stream-type-change"(t){let e=this.#iK.get("source-change");e&&t.triggers.add(e);let{streamType:i,inferredStreamType:s}=this.$state;s.set(t.detail),t.detail=i()}"rate-change"(t){let{storage:e}=this.#D,{canPlay:i}=this.$state;this.$state.playbackRate.set(t.detail),this.#i_("media-rate-change-request",t),i()&&e?.setPlaybackRate?.(t.detail)}"remote-playback-change"(t){let{remotePlaybackState:e,remotePlaybackType:i}=this.$state,{type:s,state:a}=t.detail,n="connected"===a;
1i.set(s),e.set(a);let r="airplay"===s?"media-airplay-request":"media-google-cast-request";if(n)this.#i_(r,t);else{let e=this.#ib.queue.peek(r);e&&(t.request=e,t.triggers.add(e))}}"sources-change"(t){let e=this.$state.sources(),i=t.detail;this.$state.sources.set(i),this.#sn(e,i,t)}#sn(t,e,i){let{qualities:s}=this.#D,a=!1,n=!1;for(let a of t)if(d(a)&&!e.some(t=>t.src===a.src)){let t=s.getBySrc(a.src);t&&(s[tb.remove](t,i),n=!0)}for(let t of(n&&!s.length&&(this.$state.savedState.set(null),s[tb.reset](i)),e)){if(!d(t)||s.getBySrc(t.src))continue;let e={id:t.id??t.height+"p",bitrate:null,codec:null,...t,selected:!1};s[tb.add](e,i),a=!0}a&&!s[tK.enableAuto]&&(this.#ss(),s[tK.enableAuto]=this.#ss.bind(this),s[tK.setAuto](!0,i))}"source-change"(t){t.isQualityChange=t.originEvent?.type==="quality-change";let e=t.detail;this.#sa(t,t.isQualityChange),this.#iK.set(t.type,t),this.$state.source.set(e),this.el?.setAttribute("aria-busy","true")}#sa(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],{audioTracks:i,qualities:s}=this.#D;if(!e){this.#iG=[],this.#iQ=[-1,-1],i[tb.reset](t),s[tb.reset](t),tr(this.$state,e),this.#i6();return}tr(this.$state,e),this.#i6()}abort(t){let e=this.#iK.get("source-change");e&&t.triggers.add(e);let i=this.#iK.get("can-load");i&&!t.triggers.hasType("can-load")&&t.triggers.add(i)}"load-start"(t){let e=this.#iK.get("source-change");e&&t.triggers.add(e)}error(t){this.$state.error.set(t.detail);let e=this.#iK.get("abort");e&&t.triggers.add(e)}"loaded-metadata"(t){let e=this.#iK.get("load-start");e&&t.triggers.add(e)}"loaded-data"(t){let e=this.#iK.get("load-start");e&&t.triggers.add(e)}"can-play"(t){let e=this.#iK.get("loaded-metadata");e&&t.triggers.add(e),this.#sr(t.detail),this.el?.setAttribute("aria-busy","false")}"can-play-through"(t){this.#sr(t.detail);let e=this.#iK.get("can-play");e&&t.triggers.add(e)}#sr(t){let{seekable:e,buffered:i,intrinsicDuration:s,canPlay:a}=this.$state;a.set(!0),i.set(t.buffered),e.set(t.seekable);let n=P(t.seekable)??1/0;s.set(n)}"duration-change"(t){let{live:e,intrinsicDuration:i,providedDuration:s,clipEndTime:a,ended:n}=this.$state,r=t.detail;if(!e()){let e=Number.isNaN(r)?0:r;i.set(e),n()&&this.#sh(t)}(s()>0||a()>0)&&t.stopImmediatePropagation()}progress(t){let{buffered:e,seekable:i}=this.$state,{buffered:s,seekable:a}=t.detail,n=P(s),r=s.length!==e().length,h=n!==P(e()),o=P(a),l=a.length!==i().length,d=o!==P(i());(r||h)&&e.set(s),(l||d)&&i.set(a)}play(t){let{paused:e,autoPlayError:i,ended:s,autoPlaying:a,playsInline:n,pointer:r,muted:h,viewType:o,live:l,userBehindLiveEdge:d}=this.$state;if(this.#so(),!e()){t.stopImmediatePropagation();return}t.autoPlay=a();let u=this.#iK.get("waiting");u&&t.triggers.add(u),this.#i_("media-play-request",t),this.#iK.set("play",t),e.set(!1),i.set(null),t.autoPlay&&(this.handle(this.createEvent("auto-play",{detail:{muted:h()},trigger:t})),a.set(!1)),(s()||this.#ib.replaying)&&(this.#ib.replaying=!1,s.set(!1),this.handle(this.createEvent("replay",{trigger:t}))),n()||"video"!==o()||"coarse"!==r()||this.#D.remote.enterFullscreen("prefer-media",t),l()&&!d()&&this.#D.remote.seekToLiveEdge(t)}#so(t){if(!(0,o.peek)(this.#D.$provider))return;let{ended:e,seekableStart:i,clipEndTime:s,currentTime:a,realCurrentTime:n,duration:r}=this.$state,h=e()||n()<i()||s()>0&&n()>=s()||.1>Math.abs(a()-r());return h&&this.dispatch("media-seek-request",{detail:i(),trigger:t}),h}"play-fail"(t){let{muted:e,autoPlaying:i}=this.$state,s=this.#iK.get("play");s&&t.triggers.add(s),this.#i_("media-play-request",t);let{paused:a,playing:n}=this.$state;a.set(!0),n.set(!1),this.#i6(),this.#iK.set("play-fail",t),t.autoPlay&&(this.handle(this.createEvent("auto-play-fail",{detail:{muted:e(),error:t.detail},trigger:t})),i.set(!1))}playing(t){let e=this.#iK.get("play"),i=this.#iK.get("seeked");e?t.triggers.add(e):i&&t.triggers.add(i),setTimeout(()=>this.#i6(),0);let{paused:s,playing:a,live:n,liveSyncPosition:r,seekableEnd:h,started:o,currentTime:l,seeking:d,ended:u}=this.$state;if(s.set(!1),a.set(!0),d.set(!1),u.set(!1),this.#ib.looping){this.#ib.looping=!1;return}
1if(n()&&!o()&&0===l()){let t=r()??h()-2;Number.isFinite(t)&&this.#D.$provider().setCurrentTime(t)}this.started(t)}started(t){let{started:e}=this.$state;e()||(e.set(!0),this.handle(this.createEvent("started",{trigger:t})))}pause(t){this.el?.isConnected||(this.#ij=!0),this.#i_("media-pause-request",t);let e=this.#iK.get("seeked");e&&t.triggers.add(e);let{paused:i,playing:s}=this.$state;i.set(!0),s.set(!1),this.#iB&&setTimeout(()=>{this.handle(this.createEvent("end",{trigger:t})),this.#iB=!1},0),this.#i6()}"time-change"(t){if(this.#ib.looping){t.stopImmediatePropagation();return}let{waiting:e,played:i,clipEndTime:s,realCurrentTime:a,currentTime:n}=this.$state,r=t.detail,h=s();for(let i of(a.set(r),this.#sl(),e.set(!1),this.#D.textTracks))i[Y.updateActiveCues](r,t);h>0&&r>=h&&(this.#iB=!0,this.dispatch("media-pause-request",{trigger:t})),this.#sd(),this.dispatch("time-update",{detail:{currentTime:n(),played:i()},trigger:t})}#sl(){var t,e,i;let s,a;let{currentTime:n,played:r,paused:h}=this.$state;h()||(this.#iQ=(t=this.#iG,e=this.#iQ,i=n(),s=e[0],a=e[1],i<s?[i,-1]:(i===s||(-1===s?e[0]=i:(i>s&&(e[1]=i,-1===a&&t.push(e)),function(t){if(t.length<=1)return;t.sort((t,e)=>t[0]-e[0]);let e=[],i=t[0];for(let s=1;s<t.length;s++){let a=t[s];i[1]>=a[0]-1?i=[i[0],Math.max(i[1],a[1])]:(e.push(i),i=a)}e.push(i)}(t))),e)),r.set(new S(this.#iG)))}#sh(t){let{clipStartTime:e,clipEndTime:i,duration:s}=this.$state;e()>0||i()>0||this.handle(this.createEvent("time-change",{detail:s(),trigger:t}))}#sd(){let{storage:t}=this.#D,{canPlay:e,realCurrentTime:i}=this.$state;e()&&t?.setTime?.(i())}"audio-gain-change"(t){let{storage:e}=this.#D,{canPlay:i,audioGain:s}=this.$state;s.set(t.detail),this.#i_("media-audio-gain-change-request",t),i()&&e?.setAudioGain?.(s())}"volume-change"(t){let{storage:e}=this.#D,{volume:i,muted:s,canPlay:a}=this.$state,n=t.detail;i.set(n.volume),s.set(n.muted||0===n.volume),this.#i_("media-volume-change-request",t),this.#i_(n.muted?"media-mute-request":"media-unmute-request",t),a()&&(e?.setVolume?.(i()),e?.setMuted?.(s()))}seeked(t){let{seeking:e,currentTime:i,realCurrentTime:s,paused:a,seekableEnd:n,ended:r,live:h}=this.$state;if(this.#ib.seeking)e.set(!0),t.stopImmediatePropagation();else if(e()){let i=this.#iK.get("waiting");i&&t.triggers.add(i);let n=this.#iK.get("seeking");n&&!t.triggers.has(n)&&t.triggers.add(n),a()&&this.#i5(),e.set(!1),s.set(t.detail),this.#i_("media-seek-request",t);let r=t?.originEvent;!r?.isTrusted||r instanceof MessageEvent||/seek/.test(r.type)||this.started(t)}h()||(Math.floor(i())!==Math.floor(n())?r.set(!1):this.end(t))}waiting(t){this.#iW||this.#ib.seeking||(t.stopImmediatePropagation(),this.#iH=t,this.#iX())}#iX;end(t){let{loop:e,ended:i}=this.$state;if(!(!e()&&i())){if(e()){setTimeout(()=>{requestAnimationFrame(()=>{this.#so(t),this.dispatch("media-loop-request",{trigger:t})})},10);return}setTimeout(()=>this.#ew(t),0)}}#ew(t){let{storage:e}=this.#D,{paused:i,seeking:s,ended:a,duration:n}=this.$state;this.#sh(t),i()||this.dispatch("pause",{trigger:t}),s()&&this.dispatch("seeked",{detail:n(),trigger:t}),a.set(!0),this.#i6(),e?.setTime?.(n(),!0),this.dispatch("ended",{trigger:t})}#i5(){this.#iX.cancel(),this.$state.waiting.set(!1)}"fullscreen-change"(t){let e=t.detail;this.$state.fullscreen.set(e),this.#i_(e?"media-enter-fullscreen-request":"media-exit-fullscreen-request",t)}"fullscreen-error"(t){this.#i_("media-enter-fullscreen-request",t),this.#i_("media-exit-fullscreen-request",t)}"orientation-change"(t){let e=t.detail.lock;this.#i_(e?"media-orientation-lock-request":"media-orientation-unlock-request",t)}"picture-in-picture-change"(t){let e=t.detail;this.$state.pictureInPicture.set(e),this.#i_(e?"media-enter-pip-request":"media-exit-pip-request",t)}"picture-in-picture-error"(t){this.#i_("media-enter-pip-request",t),this.#i_("media-exit-pip-request",t)}"title-change"(t){t.trigger&&(t.stopImmediatePropagation(),this.$state.inferredTitle.set(t.detail))}"poster-change"(t){t.trigger&&(t.stopImmediatePropagation(),this.$state.inferredPoster.set(t.detail))}}class eY extends tH{onSetup(){if(this.#tb(),!u)for(let t of[this.#su,this.#sc,this.#sp,this.#sm,this.#V,this.#sg,this.#sf,this.#sy,this.#sb,this.#sv,this.#sw,this.#sk,this.#s$,this.#sT,this.#sx])(0,o.effect)(t.bind(this))}#tb(){let t={duration:"providedDuration",loop:"providedLoop",poster:"providedPoster",streamType:"providedStreamType",title:"providedTitle",viewType:"providedViewType"},e=new Set(["currentTime","paused","playbackRate","volume"]);for(let i of Object.keys(this.$props))e.has(i)||this.$state[t[i]??i]?.set(this.$props[i]());this.$state.muted.set(this.$props.muted()||0===this.$props.volume())}#sT(){let{viewType:t,streamType:e,title:i,poster:s,loop:a}=this.$props,n=this.$state;n.providedPoster.set(s()),n.providedStreamType.set(e()),n.providedViewType.set(t()),n.providedTitle.set(i()),n.providedLoop.set(a())}#sS(){}#su(){let{artist:t,artwork:e}=this.$props;this.$state.artist.set(t()),this.$state.artwork.set(e())}#sx(){let{title:t}=this.$state;this.dispatch("title-change",{detail:t()})}#sc(){let t=this.$props.autoPlay()||this.$props.autoplay();this.$state.autoPlay.set(t),this.dispatch("auto-play-change",{detail:t})}#sw(){let t=this.$state.loop();this.dispatch("loop-change",{detail:t})}#V(){let t=this.$props.controls();this.$state.controls.set(t)}#s$(){let{poster:t}=this.$state;this.dispatch("poster-change",{detail:t()})}#sg(){let t=this.$props.crossOrigin()??this.$props.crossorigin();this.$state.crossOrigin.set(!0===t?"":t)}#sf(){let{duration:t}=this.$props;this.dispatch("media-duration-change-request",{detail:t()})}
1#sk(){let t=this.$props.playsInline()||this.$props.playsinline();this.$state.playsInline.set(t),this.dispatch("plays-inline-change",{detail:t})}#sp(){let{clipStartTime:t}=this.$props;this.dispatch("media-clip-start-change-request",{detail:t()})}#sm(){let{clipEndTime:t}=this.$props;this.dispatch("media-clip-end-change-request",{detail:t()})}#sy(){this.dispatch("live-change",{detail:this.$state.live()})}#sv(){this.$state.liveEdgeTolerance.set(this.$props.liveEdgeTolerance()),this.$state.minLiveDVRWindow.set(this.$props.minLiveDVRWindow())}#sb(){this.dispatch("live-edge-change",{detail:this.$state.liveEdge()})}}let eJ=["play","pause","seekforward","seekbackward","seekto"];class eZ extends tH{onConnect(){(0,o.effect)(this.#sC.bind(this)),(0,o.effect)(this.#sP.bind(this));let t=this.#sE.bind(this);for(let e of eJ)navigator.mediaSession.setActionHandler(e,t);(0,o.onDispose)(this.#tq.bind(this))}#tq(){for(let t of eJ)navigator.mediaSession.setActionHandler(t,null)}#sC(){let{title:t,artist:e,artwork:i,poster:s}=this.$state;navigator.mediaSession.metadata=new MediaMetadata({title:t(),artist:e(),artwork:i()??[{src:s()}]})}#sP(){let{canPlay:t,paused:e}=this.$state;navigator.mediaSession.playbackState=t()?e()?"paused":"playing":"none"}#sE(t){let e=new o.DOMEvent("media-session-action",{detail:t});switch(t.action){case"play":this.dispatch("media-play-request",{trigger:e});break;case"pause":this.dispatch("media-pause-request",{trigger:e});break;case"seekto":case"seekforward":case"seekbackward":this.dispatch("media-seek-request",{detail:(0,o.isNumber)(t.seekTime)?t.seekTime:this.$state.currentTime()+(t.seekOffset??("seekforward"===t.action?10:-10)),trigger:e})}}}let e0=(0,o.signal)(!1);u||((0,o.listenEvent)(document,"pointerdown",()=>{e0.set(!1)}),(0,o.listenEvent)(document,"keydown",t=>{t.metaKey||t.altKey||t.ctrlKey||e0.set(!0)}));class e1 extends o.ViewController{#sA;onConnect(t){(0,o.effect)(()=>{let e=new o.EventsController(t);if(!e0()){this.#sA.set(!1),e2(t,!1),e.add("pointerenter",this.#sq.bind(this)).add("pointerleave",this.#sM.bind(this));return}let i=document.activeElement===t;this.#sA.set(i),e2(t,i),e.add("focus",this.#sD.bind(this)).add("blur",this.#sR.bind(this))})}focused(){return this.#sA()}#sD(){this.#sA.set(!0),e2(this.el,!0)}#sR(){this.#sA.set(!1),e2(this.el,!1)}#sq(){e3(this.el,!0)}#sM(){e3(this.el,!1)}constructor(...t){super(...t),this.#sA=(0,o.signal)(!1)}}function e2(t,e){(0,o.setAttribute)(t,"data-focus",e),(0,o.setAttribute)(t,"data-hocus",e)}function e3(t,e){(0,o.setAttribute)(t,"data-hocus",e),(0,o.setAttribute)(t,"data-hover",e)}class e6 extends o.Component{static #e=this.props=eN;static #sL=this.state=ts;#D;#iy;#sI;get #tz(){return this.#D.$provider()}get #sV(){return this.$props}constructor(){super(),this.canPlayQueue=new eG,this.#sO=!1,new eY;let t={player:this,qualities:new tB,audioTracks:new t$,storage:null,$provider:(0,o.signal)(null),$providerSetup:(0,o.signal)(!1),$props:this.$props,$state:this.$state};t.remote=this.remoteControl=new td(void 0),t.remote.setPlayer(this),t.textTracks=new tU,t.textTracks[Y.crossOrigin]=this.$state.crossOrigin,t.textRenderers=new tN(t),t.ariaKeys={},this.#D=t,(0,o.provideContext)(to,t),this.orientation=new t3,new e1,new t_(t);let e=new ez;this.#iy=new eX(e,t),this.#sI=new eW(this.#iy,e,t),t.delegate=new eK(this.#iy.handle.bind(this.#iy),t),t.notify=t.delegate.notify.bind(t.delegate),"undefined"!=typeof navigator&&"mediaSession"in navigator&&new eZ,new eU("load",this.startLoading.bind(this)),new eU("posterLoad",this.startLoadingPoster.bind(this))}onSetup(){this.#sF(),(0,o.effect)(this.#sN.bind(this)),(0,o.effect)(this.#sU.bind(this)),(0,o.effect)(this.#tw.bind(this)),(0,o.effect)(this.#sK.bind(this)),(0,o.effect)(this.#sB.bind(this)),(0,o.effect)(this.#sk.bind(this)),(0,o.effect)(this.#sG.bind(this))}onAttach(t){t.setAttribute("data-media-player",""),tE(t,"tabindex","0"),tE(t,"role","region"),(0,o.effect)(this.#sQ.bind(this)),u?this.#sx():(0,o.effect)(this.#sx.bind(this)),u?this.#sW():(0,o.effect)(this.#sW.bind(this)),(0,o.listenEvent)(t,"find-media-player",this.#sH.bind(this))}onConnect(t){m&&(0,o.setAttribute)(t,"data-iphone","");let e=window.matchMedia("(pointer: coarse)");this.#sj(e),e.onchange=this.#sj.bind(this);let i=new ResizeObserver((0,o.animationFrameThrottle)(this.#sz.bind(this)));i.observe(t),(0,o.effect)(this.#sz.bind(this)),this.dispatch("media-player-connect",{detail:this,bubbles:!0,composed:!0}),(0,o.onDispose)(()=>{i.disconnect(),e.onchange=null})}onDestroy(){this.#D.player=null,this.canPlayQueue.reset()}#sO;
1#sx(){let t=this.$el,{title:e,live:i,viewType:s,providedTitle:a}=this.$state,n=i(),r=(0,o.uppercaseFirstChar)(s()),h="Unknown"!==r?`${n?"Live ":""}${r}`:n?"Live":"Media",l=e();(0,o.setAttribute)(this.el,"aria-label",`${h} Player`+(l?` - ${l}`:"")),!u&&t?.hasAttribute("title")&&(this.#sO=!0,t?.removeAttribute("title"))}#sW(){let t=this.orientation.landscape?"landscape":"portrait";this.$state.orientation.set(t),(0,o.setAttribute)(this.el,"data-orientation",t),this.#sz()}#sN(){this.$state.canPlay()&&this.#tz?this.canPlayQueue.start():this.canPlayQueue.stop()}#sF(){if(e6[eO]){this.setAttributes(e6[eO]);return}let t={"data-load":function(){return this.$props.load()},"data-captions":function(){let t=this.$state.textTrack();return!!t&&ti(t)},"data-ios-controls":function(){return this.$state.iOSControls()},"data-controls":function(){return this.controls.showing},"data-buffering":function(){let{canLoad:t,canPlay:e,waiting:i}=this.$state;return t()&&(!e()||i())},"data-error":function(){let{error:t}=this.$state;return!!t()},"data-autoplay-error":function(){let{autoPlayError:t}=this.$state;return!!t()}},e={autoPlay:"autoplay",canAirPlay:"can-airplay",canPictureInPicture:"can-pip",pictureInPicture:"pip",playsInline:"playsinline",remotePlaybackState:"remote-state",remotePlaybackType:"remote-type",isAirPlayConnected:"airplay",isGoogleCastConnected:"google-cast"};for(let i of eF)t["data-"+(e[i]??(0,o.camelToKebabCase)(i))]=function(){return this.$state[i]()};delete t.title,e6[eO]=t,this.setAttributes(t)}#sH(t){t.detail(this)}#sz(){if(u||!this.el)return;let t=this.el.clientWidth,e=this.el.clientHeight;this.$state.width.set(t),this.$state.height.set(e),(0,o.setStyle)(this.el,"--player-width",t+"px"),(0,o.setStyle)(this.el,"--player-height",e+"px")}#sj(t){if(u)return;let e=t.matches?"coarse":"fine";(0,o.setAttribute)(this.el,"data-pointer",e),this.$state.pointer.set(e),this.#sz()}get provider(){return this.#tz}get controls(){return this.#sI.controls}set controls(t){this.#sV.controls.set(t)}get title(){return(0,o.peek)(this.$state.title)}set title(t){if(this.#sO){this.#sO=!1;return}this.#sV.title.set(t)}get qualities(){return this.#D.qualities}get audioTracks(){return this.#D.audioTracks}get textTracks(){return this.#D.textTracks}get textRenderers(){return this.#D.textRenderers}get duration(){return this.$state.duration()}set duration(t){this.#sV.duration.set(t)}get paused(){return(0,o.peek)(this.$state.paused)}set paused(t){this.#s_(t)}#tw(){this.#s_(this.$props.paused())}#s_(t){t?this.canPlayQueue.enqueue("paused",()=>this.#sI.pause()):this.canPlayQueue.enqueue("paused",()=>this.#sI.play())}get muted(){return(0,o.peek)(this.$state.muted)}set muted(t){this.#sX(t)}#sU(){this.#sX(this.$props.muted())}#sX(t){this.canPlayQueue.enqueue("muted",()=>{this.#tz&&this.#tz.setMuted(t)})}get currentTime(){return(0,o.peek)(this.$state.currentTime)}set currentTime(t){this.#sY(t)}#sB(){this.#sY(this.$props.currentTime())}#sY(t){this.canPlayQueue.enqueue("currentTime",()=>{let{currentTime:e}=this.$state;t!==(0,o.peek)(e)&&(0,o.peek)(()=>{if(!this.#tz)return;let e=th(t,this.$state);Number.isFinite(e)&&this.#tz.setCurrentTime(e)})})}get volume(){return(0,o.peek)(this.$state.volume)}set volume(t){this.#sJ(t)}#sK(){this.#sJ(this.$props.volume())}#sJ(t){let e=tS(0,t,1);this.canPlayQueue.enqueue("volume",()=>{this.#tz&&this.#tz.setVolume(e)})}get playbackRate(){return(0,o.peek)(this.$state.playbackRate)}set playbackRate(t){this.#sZ(t)}#sG(){this.#sZ(this.$props.playbackRate())}#sZ(t){this.canPlayQueue.enqueue("rate",()=>{this.#tz&&this.#tz.setPlaybackRate?.(t)})}#sk(){this.#s0(this.$props.playsInline())}#s0(t){this.canPlayQueue.enqueue("playsinline",()=>{this.#tz&&this.#tz.setPlaysInline?.(t)})}#sQ(){let t=this.$props.storage(),e=(0,o.isString)(t)?new tu:t;if(e?.onChange){let{source:i}=this.$state,s=(0,o.isString)(t)?t:this.el?.id,a=(0,o.computed)(this.#s1.bind(this));(0,o.effect)(()=>e.onChange(i(),a(),s||void 0))}this.#D.storage=e,this.#D.textTracks.setStorage(e),(0,o.onDispose)(()=>{e?.onDestroy?.(),this.#D.storage=null,this.#D.textTracks.setStorage(null)})}#s1(){let{clipStartTime:t,clipEndTime:e}=this.$props,{source:i}=this.$state,s=i();return s.src?`${s.src}:${t()}:${e()}`:null}async play(t){return this.#sI.play(t)}async pause(t){return this.#sI.pause(t)}async enterFullscreen(t,e){return this.#sI.enterFullscreen(t,e)}async exitFullscreen(t,e){return this.#sI.exitFullscreen(t,e)}enterPictureInPicture(t){return this.#sI.enterPictureInPicture(t)}exitPictureInPicture(t){return this.#sI.exitPictureInPicture(t)}seekToLiveEdge(t){this.#sI.seekToLiveEdge(t)}startLoading(t){this.#D.notify("can-load",void 0,t)}startLoadingPoster(t){this.#D.notify("can-load-poster",void 0,t)}requestAirPlay(t){return this.#sI.requestAirPlay(t)}requestGoogleCast(t){return this.#sI.requestGoogleCast(t)}
1setAudioGain(t,e){return this.#sI.setAudioGain(t,e)}destroy(){super.destroy(),this.#D.remote.setPlayer(null),this.dispatch("destroy")}}let e5=e6.prototype;(0,o.prop)(e5,"canPlayQueue"),(0,o.prop)(e5,"remoteControl"),(0,o.prop)(e5,"provider"),(0,o.prop)(e5,"controls"),(0,o.prop)(e5,"orientation"),(0,o.prop)(e5,"title"),(0,o.prop)(e5,"qualities"),(0,o.prop)(e5,"audioTracks"),(0,o.prop)(e5,"textTracks"),(0,o.prop)(e5,"textRenderers"),(0,o.prop)(e5,"duration"),(0,o.prop)(e5,"paused"),(0,o.prop)(e5,"muted"),(0,o.prop)(e5,"currentTime"),(0,o.prop)(e5,"volume"),(0,o.prop)(e5,"playbackRate"),(0,o.method)(e5,"play"),(0,o.method)(e5,"pause"),(0,o.method)(e5,"enterFullscreen"),(0,o.method)(e5,"exitFullscreen"),(0,o.method)(e5,"enterPictureInPicture"),(0,o.method)(e5,"exitPictureInPicture"),(0,o.method)(e5,"seekToLiveEdge"),(0,o.method)(e5,"startLoading"),(0,o.method)(e5,"startLoadingPoster"),(0,o.method)(e5,"requestAirPlay"),(0,o.method)(e5,"requestGoogleCast"),(0,o.method)(e5,"setAudioGain");let e7=new Map;class e4{#s2;#s3;#s6;#D;#s5;constructor(t,e,i,s=[]){this.#s2=!1,this.#s6=t,this.#D=e,this.#s5=i;let a=new eq,n=new t7,r=new t5,h=new t6,l=[new eD,new eM];this.#s3=(0,o.computed)(()=>{let t=e.$state.remotePlaybackLoader(),i=e.$props.preferNativeHLS()?[r,h,a,n,...l,...s]:[n,r,h,a,...l,...s];return t?[t,...i]:i});let{$state:d}=e;for(let t of(d.sources.set(e9(e.$props.src())),d.sources())){let i=this.#s3().find(e=>e.canPlay(t));if(!i)continue;let s=i.mediaType(t);e.$state.source.set(t),e.$state.mediaType.set(s),e.$state.inferredViewType.set(s),this.#s5.set(i),this.#s2=!0;break}}connect(){let t=this.#s5();this.#s2&&(this.#s7(this.#D.$state.source(),t),this.#s4(t),this.#s2=!1),(0,o.effect)(this.#s9.bind(this)),(0,o.effect)(this.#s8.bind(this)),(0,o.effect)(this.#at.bind(this)),(0,o.effect)(this.#ae.bind(this)),(0,o.effect)(this.#ai.bind(this))}#s9(){this.#D.notify("sources-change",[...e9(this.#D.$props.src()),...this.#s6()])}#s8(){let{$state:t}=this.#D,e=t.sources(),i=(0,o.peek)(t.source),s=this.#as(i,e);if(e[0]?.src&&!s.src&&!s.type){let{crossOrigin:i}=t,s=W(i()),a=new AbortController;return Promise.all(e.map(t=>(0,o.isString)(t.src)&&"?"===t.type?fetch(t.src,{method:"HEAD",credentials:s,signal:a.signal}).then(e=>(t.type=e.headers.get("content-type")||"??",e7.set(t.src,t.type),t)).catch(()=>t):t)).then(e=>{if(a.signal.aborted)return;let i=this.#as((0,o.peek)(t.source),e);(0,o.tick)(),i.src||this.#D.notify("error",{message:"Failed to load resource.",code:4})}),()=>a.abort()}(0,o.tick)()}#as(t,e){let i={src:"",type:""},s=null,a=new o.DOMEvent("sources-change",{detail:{sources:e}}),n=this.#s3(),{started:r,paused:h,currentTime:l,quality:u,savedState:c}=this.#D.$state;for(let t of e){let e=n.find(e=>e.canPlay(t));if(e){i=t,s=e;break}}if(d(i)){let t=u(),s=e.find(e=>e.src===t?.src);(0,o.peek)(r)?c.set({paused:(0,o.peek)(h),currentTime:(0,o.peek)(l)}):c.set(null),s&&(i=s,a=new o.DOMEvent("quality-change",{detail:{quality:t}}))}return it(t,i)||this.#s7(i,s,a),s!==(0,o.peek)(this.#s5)&&this.#s4(s,a),i}#s7(t,e,i){this.#D.notify("source-change",t,i),this.#D.notify("media-type-change",e?.mediaType(t)||"unknown",i)}#s4(t,e){this.#D.$providerSetup.set(!1),this.#D.notify("provider-change",null,e),t&&(0,o.peek)(()=>t.preconnect?.(this.#D)),this.#s5.set(t),this.#D.notify("provider-loader-change",t,e)}#at(){let t=this.#D.$provider();if(!(!t||(0,o.peek)(this.#D.$providerSetup))){if(this.#D.$state.canLoad()){(0,o.scoped)(()=>t.setup(),t.scope),this.#D.$providerSetup.set(!0);return}(0,o.peek)(()=>t.preconnect?.())}}#ae(){if(!this.#D.$providerSetup())return;let t=this.#D.$provider(),e=this.#D.$state.source(),i=(0,o.peek)(this.#D.$state.crossOrigin),s=(0,o.peek)(this.#D.$props.preferNativeHLS);if(!it(t?.currentSrc,e)){if(this.#D.$state.canLoad()){let a=new AbortController;return F(e)?(s||!x())&&(function t(e,i){return fetch(e,i).then(t=>t.text()).then(s=>{let a=function(t){let e=t.match(/#EXT-X-STREAM-INF:[^\n]+(\n[^\n]+)*/g);return e?e[0].split("\n")[1].trim():null}(s);if(a)return t(/^https?:/.test(a)?a:new URL(a,e).href,i);let n=/EXT-X-PLAYLIST-TYPE:\s*VOD/.test(s)?"on-demand":"live";return"live"===n&&function(t){for(let e of t.split("\n"))if(e.startsWith("#EXT-X-TARGETDURATION")){let t=parseFloat(e.split(":")[1]);if(!isNaN(t))return t}return -1}(s)>=10&&(/#EXT-X-DVR-ENABLED:\s*true/.test(s)||s.includes("#EXT-X-DISCONTINUITY"))?"live:dvr":n})})(e.src,{credentials:W(i),signal:a.signal}).then(t=>{this.#D.notify("stream-type-change",t)}).catch(o.noop):N(e)?fetch(e.src,{credentials:W(i),signal:a.signal}).then(t=>t.text()).then(t=>/type="static"/.test(t)?"on-demand":"live").then(t=>{this.#D.notify("stream-type-change",t)}).catch(o.noop):this.#D.notify("stream-type-change","on-demand"),(0,o.peek)(()=>{let i=(0,o.peek)(this.#D.$state.preload);return t?.loadSource(e,i).catch(t=>{})}),()=>a.abort()}try{(0,o.isString)(e.src)&&B(new URL(e.src).origin)}catch(t){}}}#ai(){let t=this.#s5(),{providedPoster:e,source:i,canLoadPoster:s}=this.#D.$state;if(!t||!t.loadPoster||!i()||!s()||e())return;let a=new AbortController,n=new o.DOMEvent("source-change",{detail:i});return t.loadPoster(i(),this.#D,a).then(t=>{this.#D.notify("poster-change",t||"",n)}).catch(()=>
1{this.#D.notify("poster-change","",n)}),()=>{a.abort()}}}function e9(t){return((0,o.isArray)(t)?t:[t]).map(t=>(0,o.isString)(t)?{src:t,type:e8(t)}:{...t,type:e8(t.src,t.type)})}function e8(t,e){if((0,o.isString)(e)&&e.length)return e;if((0,o.isString)(t)&&e7.has(t))return e7.get(t);if(!e&&F({src:t,type:""}))return"application/x-mpegurl";if(!e&&N({src:t,type:""}))return"application/dash+xml";if(!(0,o.isString)(t)||t.startsWith("blob:"))return"video/object";if(t.includes("youtube")||t.includes("youtu.be"))return"video/youtube";if(t.includes("vimeo")&&!t.includes("progressive_redirect")&&!t.includes(".m3u8"))return"video/vimeo";return"?"}function it(t,e){return t?.src===e?.src&&t?.type===e?.type}class ie{#aa;#D;#an;constructor(t,e){this.#an=[],this.#aa=t,this.#D=e,(0,o.effect)(this.#ar.bind(this))}#ar(){let t=this.#aa();for(let e of this.#an)if(!t.some(t=>t.id===e.id)){let t=e.id&&this.#D.textTracks.getById(e.id);t&&this.#D.textTracks.remove(t)}for(let e of t){let t=e.id||tt.createId(e);this.#D.textTracks.getById(t)||(e.id=t,this.#D.textTracks.add(e))}this.#an=t}}class ii extends o.Component{static #e=this.props={loaders:[]};static #sL=this.state=new o.State({loader:null});#D;#ah;#s6;#aa;#s5;onSetup(){this.#D=tl(),this.#ah=new e4(this.#s6,this.#D,this.$state.loader,this.$props.loaders())}onAttach(t){t.setAttribute("data-media-provider","")}onConnect(t){this.#ah.connect(),new ie(this.#aa,this.#D);let e=new ResizeObserver((0,o.animationFrameThrottle)(this.#sz.bind(this)));e.observe(t);let i=new MutationObserver(this.#ao.bind(this));i.observe(t,{attributes:!0,childList:!0}),this.#sz(),this.#ao(),(0,o.onDispose)(()=>{e.disconnect(),i.disconnect()})}#al;load(t){t?.setAttribute("aria-hidden","true"),window.cancelAnimationFrame(this.#al),this.#al=requestAnimationFrame(()=>this.#ad(t)),(0,o.onDispose)(()=>{window.cancelAnimationFrame(this.#al)})}#ad(t){if(!this.scope)return;let e=this.$state.loader(),{$provider:i}=this.#D;!(this.#s5===e&&e?.target===t&&(0,o.peek)(i))&&(this.#au(),this.#s5=e,e&&(e.target=t||null),e&&t&&e.load(this.#D).then(t=>{this.scope&&(0,o.peek)(this.$state.loader)===e&&this.#D.notify("provider-change",t)}))}onDestroy(){this.#s5=null,this.#au()}#au(){this.#D?.notify("provider-change",null)}#sz(){if(!this.el)return;let{player:t,$state:e}=this.#D,i=this.el.offsetWidth,s=this.el.offsetHeight;t&&(e.mediaWidth.set(i),e.mediaHeight.set(s),t.el&&((0,o.setStyle)(t.el,"--media-width",i+"px"),(0,o.setStyle)(t.el,"--media-height",s+"px")))}#ao(){let t=[],e=[];for(let i of this.el.children)if(!i.hasAttribute("data-vds")){if(i instanceof HTMLSourceElement){let e={id:i.id,src:i.src,type:i.type};for(let t of["id","src","width","height","bitrate","codec"]){let s=i.getAttribute(`data-${t}`);(0,o.isString)(s)&&(e[t]=/id|src|codec/.test(t)?s:Number(s))}t.push(e)}else if(i instanceof HTMLTrackElement){let t={src:i.src,kind:i.track.kind,language:i.srclang,label:i.label,default:i.default,type:i.getAttribute("data-type")};e.push({id:i.id||tt.createId(t),...t})}}this.#s6.set(t),this.#aa.set(e),(0,o.tick)()}constructor(...t){super(...t),this.#s6=(0,o.signal)([]),this.#aa=(0,o.signal)([]),this.#s5=null,this.#al=-1}}let is=ii.prototype;(0,o.method)(is,"load");class ia extends o.Component{static #e=this.props={translations:null};static #sL=this.state=new o.State({label:null,busy:!1});#D;#ac;onSetup(){this.#D=tl()}onAttach(t){t.style.display="contents"}onConnect(t){t.setAttribute("data-media-announcer",""),tE(t,"role","status"),tE(t,"aria-live","polite");let{busy:e}=this.$state;this.setAttributes({"aria-busy":()=>e()?"true":null}),this.#ac=!0,(0,o.effect)(this.#tw.bind(this)),(0,o.effect)(this.#sK.bind(this)),(0,o.effect)(this.#ap.bind(this)),(0,o.effect)(this.#am.bind(this)),(0,o.effect)(this.#ag.bind(this)),(0,o.effect)(this.#af.bind(this)),(0,o.effect)(this.#ay.bind(this)),(0,o.tick)(),this.#ac=!1}#tw(){let{paused:t}=this.#D.$state;this.#ab(t()?"Pause":"Play")}#am(){let{fullscreen:t}=this.#D.$state;this.#ab(t()?"Enter Fullscreen":"Exit Fullscreen")}#ag(){let{pictureInPicture:t}=this.#D.$state;this.#ab(t()?"Enter PiP":"Exit PiP")}#ap(){let{textTrack:t}=this.#D.$state;this.#ab(t()?"Closed-Captions On":"Closed-Captions Off")}#sK(){let{muted:t,volume:e,audioGain:i}=this.#D.$state;this.#ab(t()||0===e()?"Mute":`${Math.round(e()*(i()??1)*100)}% ${this.#av("Volume")}`)}#aw;#ak;#af(){let{seeking:t,currentTime:e}=this.#D.$state,i=t();this.#aw>0?(window.clearTimeout(this.#ak),this.#ak=window.setTimeout(()=>{if(!this.scope)return;let t=(0,o.peek)(e),i=Math.abs(t-this.#aw);if(i>=1){let e=t>=this.#aw,s=eV(i);this.#ab(`${this.#av(e?"Seek Forward":"Seek Backward")} ${s}`)}this.#aw=-1,this.#ak=-1},300)):i&&(this.#aw=(0,o.peek)(e))}#av(t){let{translations:e}=this.$props;return e?.()?.[t||""]??t}#ay(){let{label:t,busy:e}=this.$state,i=this.#av(t());if(this.#ac)return;e.set(!0);let s=window.setTimeout(()=>void e.set(!1),150);return this.el&&(0,o.setAttribute)(this.el,"aria-label",i),(0,o.isString)(i)&&this.dispatch("change",{detail:i}),()=>window.clearTimeout(s)}#ab(t){let{label:e}=this.$state;e.set(t)}constructor(...t){super(...t),this.#ac=!1,this.#aw=-1,this.#ak=-1}}class ir extends o.Component{static #e=this.props={hideDelay:2e3,hideOnMouseLeave:!1};#D;onSetup(){this.#D=tl(),(0,o.effect)(this.#a$.bind(this))}onAttach(t){let{pictureInPicture:e,fullscreen:i}=this.#D.$state;(0,o.setStyle)(t,"pointer-events","none"),tE(t,"role","group"),this.setAttributes({"data-visible":this.#aT.bind(this),"data-fullscreen":i,"data-pip":e}),(0,o.effect)(()=>{this.dispatch("change",{detail:this.#aT()})}),(0,o.effect)(this.#ax.bind(this)),(0,o.effect)(()=>{let e=i();for(let i of["top","right","bottom","left"])(0,o.setStyle)(t,`padding-${i}`,e&&`env(safe-area-inset-${i})`)})}#ax(){if(!this.el)return;let{nativeControls:t}=this.#D.$state,e=t();(0,o.setAttribute)(this.el,"aria-hidden",e?"true":null),(0,o.setStyle)(this.el,"display",e?"none":null)}#a$(){let{controls:t}=this.#D.player,{hideDelay:e,hideOnMouseLeave:i}=this.$props;t.defaultDelay=2e3===e()?this.#D.$props.controlsDelay():e(),t.hideOnMouseLeave=i()}#aT(){let{controlsVisible:t}=this.#D.$state;return t()}}class ih extends o.Component{onAttach(t){t.style.pointerEvents||(0,o.setStyle)(t,"pointer-events","auto")}}class io extends o.ViewController{#aS;constructor(t){super(),this.#aC=-1,this.#aP=-1,this.#aE=null,this.#aS=t,(0,o.effect)(this.#aA.bind(this))}onDestroy(){this.#aE?.(),this.#aE=null}#aA(){let t=this.#aS.trigger();if(!t){this.hide();return}let e=this.show.bind(this),i=this.hide.bind(this);this.#aS.listen(t,e,i)}#aC;#aP;#aE;show(t){this.#aq(),window.cancelAnimationFrame(this.#aP),this.#aP=-1,this.#aE?.(),this.#aE=null,this.#aC=window.setTimeout(()=>{this.#aC=-1;let e=this.#aS.content();e&&e.style.removeProperty("display"),(0,o.peek)(()=>this.#aS.onChange(!0,t))},this.#aS.showDelay?.()??0)}hide(t){this.#aq(),(0,o.peek)(()=>this.#aS.onChange(!1,t)),this.#aP=requestAnimationFrame(()=>{this.#aq(),this.#aP=-1;let t=this.#aS.content();if(t){let e=()=>{t.style.display="none",this.#aE=null};if("none"!==getComputedStyle(t).animationName){this.#aE?.();let i=(0,o.listenEvent)(t,"animationend",e,{once:!0});this.#aE=i}else e()}})}#aq(){window.clearTimeout(this.#aC),this.#aC=-1}}let il=(0,o.createContext)(),id=0;class iu extends o.Component{static #e=this.props={showDelay:700};#tW;#aM;#aD;#aR;constructor(){super(),this.#tW=`media-tooltip-${++id}`,this.#aM=(0,o.signal)(null),this.#aD=(0,o.signal)(null),this.#aR=(0,o.signal)(!1),new e1;let{showDelay:t}=this.$props;new io({trigger:this.#aM,content:this.#aD,showDelay:t,listen(t,e,i){(0,o.effect)(()=>{e0()&&(0,o.listenEvent)(t,"focus",e),(0,o.listenEvent)(t,"blur",i)}),new o.EventsController(t).add("touchstart",t=>t.preventDefault(),{passive:!1}).add("mouseenter",e).add("mouseleave",i)},onChange:this.#aL.bind(this)})}onAttach(t){t.style.setProperty("display","contents")}onSetup(){(0,o.provideContext)(il,{trigger:this.#aM,content:this.#aD,showing:this.#aR,attachTrigger:this.#aI.bind(this),detachTrigger:this.#aV.bind(this),attachContent:this.#aO.bind(this),detachContent:this.#aF.bind(this)})}#aI(t){this.#aM.set(t);let e=t.getAttribute("data-media-tooltip");e&&this.el?.setAttribute(`data-media-${e}-tooltip`,""),(0,o.setAttribute)(t,"data-describedby",this.#tW)}#aV(t){t.removeAttribute("data-describedby"),t.removeAttribute("aria-describedby"),this.#aM.set(null)}#aO(t){t.setAttribute("id",this.#tW),t.style.display="none",tE(t,"role","tooltip"),this.#aD.set(t)}#aF(t){t.removeAttribute("id"),t.removeAttribute("role"),this.#aD.set(null)}#aL(t){let e=this.#aM(),i=this.#aD();for(let s of(e&&(0,o.setAttribute)(e,"aria-describedby",t?this.#tW:null),[this.el,e,
1i]))s&&(0,o.setAttribute)(s,"data-visible",t);this.#aR.set(t)}}class ic extends o.Component{constructor(){super(),new e1}onConnect(t){(0,o.onDispose)(tI(()=>{if(!this.connectScope)return;this.#aN();let t=(0,o.useContext)(il);(0,o.onDispose)(()=>{let e=this.#aU();e&&t.detachTrigger(e)})}))}#aN(){let t=this.#aU(),e=(0,o.useContext)(il);t&&e.attachTrigger(t)}#aU(){let t=this.el.firstElementChild;return t?.localName==="button"||t?.getAttribute("role")==="button"?t:this.el}}class ip extends o.Component{static #e=this.props={placement:"top center",offset:0,alignOffset:0};constructor(){super(),new e1;let{placement:t}=this.$props;this.setAttributes({"data-placement":t})}onAttach(t){this.#aN(t),Object.assign(t.style,{position:"absolute",top:0,left:0,width:"max-content"})}onConnect(t){this.#aN(t);let e=(0,o.useContext)(il);(0,o.onDispose)(()=>e.detachContent(t)),(0,o.onDispose)(tI(()=>{this.connectScope&&(0,o.effect)(this.#aK.bind(this))}))}#aN(t){(0,o.useContext)(il).attachContent(t)}#aK(){let{showing:t}=(0,o.useContext)(il);if(!t())return;let{placement:e,offset:i,alignOffset:s}=this.$props;return tV(this.el,this.#aB(),e(),{offsetVarName:"media-tooltip",xOffset:s(),yOffset:i()})}#aB(){return(0,o.useContext)(il).trigger()}}class im extends o.ViewController{static #e=this.props={disabled:!1};#aS;constructor(t){super(),this.#aS=t,new e1,t.keyShortcut&&new tY(t.keyShortcut)}onSetup(){let{disabled:t}=this.$props;this.setAttributes({"data-pressed":this.#aS.isPresssed,"aria-pressed":this.#aG.bind(this),"aria-disabled":()=>t()?"true":null})}onAttach(t){tE(t,"tabindex","0"),tE(t,"role","button"),tE(t,"type","button")}onConnect(t){let e=tR(t,this.#aQ.bind(this));for(let t of["click","touchstart"])e.add(t,this.#aW.bind(this),{passive:!0})}#aG(){return(0,o.ariaBool)(this.#aS.isPresssed())}#aH(t){(0,o.isWriteSignal)(this.#aS.isPresssed)&&this.#aS.isPresssed.set(t=>!t)}#aQ(t){if(this.$props.disabled()||this.el.hasAttribute("data-disabled")){t.preventDefault(),t.stopImmediatePropagation();return}t.preventDefault(),(this.#aS.onPress??this.#aH).call(this,t)}#aW(t){this.$props.disabled()&&(t.preventDefault(),t.stopImmediatePropagation())}}class ig extends o.Component{static #e=this.props={disabled:!1,defaultPressed:!1};#aj;get pressed(){return this.#aj()}constructor(){super(),this.#aj=(0,o.signal)(!1),new im({isPresssed:this.#aj})}}let iy=ig.prototype;(0,o.prop)(iy,"pressed");class ib extends o.Component{static #e=this.props=im.props;#D;constructor(){super(),new im({isPresssed:this.#az.bind(this),onPress:this.#a_.bind(this)})}onSetup(){this.#D=tl();let{canAirPlay:t,isAirPlayConnected:e}=this.#D.$state;this.setAttributes({"data-active":e,"data-supported":t,"data-state":this.#aX.bind(this),"aria-hidden":eQ(()=>!t())})}onAttach(t){t.setAttribute("data-media-tooltip","airplay"),tA(t,this.#aY.bind(this))}#a_(t){this.#D.remote.requestAirPlay(t)}#az(){let{remotePlaybackType:t,remotePlaybackState:e}=this.#D.$state;return"airplay"===t()&&"disconnected"!==e()}#aX(){let{remotePlaybackType:t,remotePlaybackState:e}=this.#D.$state;return"airplay"===t()&&e()}#aY(){let{remotePlaybackState:t}=this.#D.$state;return`AirPlay ${t()}`}}class iv extends o.Component{static #e=this.props=im.props;#D;constructor(){super(),new im({isPresssed:this.#az.bind(this),onPress:this.#a_.bind(this)})}onSetup(){this.#D=tl();let{canGoogleCast:t,isGoogleCastConnected:e}=this.#D.$state;this.setAttributes({"data-active":e,"data-supported":t,"data-state":this.#aX.bind(this),"aria-hidden":eQ(()=>!t())})}onAttach(t){t.setAttribute("data-media-tooltip","google-cast"),tA(t,this.#aY.bind(this))}#a_(t){this.#D.remote.requestGoogleCast(t)}#az(){let{remotePlaybackType:t,remotePlaybackState:e}=this.#D.$state;return"google-cast"===t()&&"disconnected"!==e()}#aX(){let{remotePlaybackType:t,remotePlaybackState:e}=this.#D.$state;return"google-cast"===t()&&e()}#aY(){let{remotePlaybackState:t}=this.#D.$state;return`Google Cast ${t()}`}}class iw extends o.Component{static #e=this.props=im.props;#D;constructor(){super(),new im({isPresssed:this.#az.bind(this),keyShortcut:"togglePaused",onPress:this.#a_.bind(this)})}onSetup(){this.#D=tl();let{paused:t,ended:e}=this.#D.$state;this.setAttributes({"data-paused":t,"data-ended":e})}onAttach(t){t.setAttribute("data-media-tooltip","play"),tA(t,"Play")}#a_(t){let e=this.#D.remote;this.#az()?e.pause(t):e.play(t)}#az(){let{paused:t}=this.#D.$state;return!t()}}class ik extends o.Component{static #e=this.props=im.props;#D;constructor(){super(),new im({isPresssed:this.#az.bind(this),keyShortcut:"toggleCaptions",onPress:this.#a_.bind(this)})}onSetup(){this.#D=tl(),this.setAttributes({"data-active":this.#az.bind(this),"data-supported":()=>
1!this.#aJ(),"aria-hidden":eQ(this.#aJ.bind(this))})}onAttach(t){t.setAttribute("data-media-tooltip","caption"),tA(t,"Captions")}#a_(t){this.#D.remote.toggleCaptions(t)}#az(){let{textTrack:t}=this.#D.$state,e=t();return!!e&&ti(e)}#aJ(){let{hasCaptions:t}=this.#D.$state;return!t()}}class i$ extends o.Component{static #e=this.props={...im.props,target:"prefer-media"};#D;constructor(){super(),new im({isPresssed:this.#az.bind(this),keyShortcut:"toggleFullscreen",onPress:this.#a_.bind(this)})}onSetup(){this.#D=tl();let{fullscreen:t}=this.#D.$state,e=this.#aZ.bind(this);this.setAttributes({"data-active":t,"data-supported":e,"aria-hidden":eQ(()=>!e())})}onAttach(t){t.setAttribute("data-media-tooltip","fullscreen"),tA(t,"Fullscreen")}#a_(t){let e=this.#D.remote,i=this.$props.target();this.#az()?e.exitFullscreen(i,t):e.enterFullscreen(i,t)}#az(){let{fullscreen:t}=this.#D.$state;return t()}#aZ(){let{canFullscreen:t}=this.#D.$state;return t()}}class iT extends o.Component{static #e=this.props=im.props;#D;constructor(){super(),new im({isPresssed:this.#az.bind(this),keyShortcut:"toggleMuted",onPress:this.#a_.bind(this)})}onSetup(){this.#D=tl(),this.setAttributes({"data-muted":this.#az.bind(this),"data-state":this.#aX.bind(this)})}onAttach(t){t.setAttribute("data-media-mute-button",""),t.setAttribute("data-media-tooltip","mute"),tA(t,"Mute")}#a_(t){let e=this.#D.remote;this.#az()?e.unmute(t):e.mute(t)}#az(){let{muted:t,volume:e}=this.#D.$state;return t()||0===e()}#aX(){let{muted:t,volume:e}=this.#D.$state,i=e();return t()||0===i?"muted":i>=.5?"high":i<.5?"low":void 0}}class ix extends o.Component{static #e=this.props=im.props;#D;constructor(){super(),new im({isPresssed:this.#az.bind(this),keyShortcut:"togglePictureInPicture",onPress:this.#a_.bind(this)})}onSetup(){this.#D=tl();let{pictureInPicture:t}=this.#D.$state,e=this.#aZ.bind(this);this.setAttributes({"data-active":t,"data-supported":e,"aria-hidden":eQ(()=>!e())})}onAttach(t){t.setAttribute("data-media-tooltip","pip"),tA(t,"PiP")}#a_(t){let e=this.#D.remote;this.#az()?e.exitPictureInPicture(t):e.enterPictureInPicture(t)}#az(){let{pictureInPicture:t}=this.#D.$state;return t()}#aZ(){let{canPictureInPicture:t}=this.#D.$state;return t()}}class iS extends o.Component{static #e=this.props={disabled:!1,seconds:30};#D;constructor(){super(),new e1}onSetup(){this.#D=tl();let{seeking:t}=this.#D.$state,{seconds:e}=this.$props,i=this.#aZ.bind(this);this.setAttributes({seconds:e,"data-seeking":t,"data-supported":i,"aria-hidden":eQ(()=>!i())})}onAttach(t){tE(t,"tabindex","0"),tE(t,"role","button"),tE(t,"type","button"),t.setAttribute("data-media-tooltip","seek"),tA(t,this.#aY.bind(this))}onConnect(t){tR(t,this.#a_.bind(this))}#aZ(){let{canSeek:t}=this.#D.$state;return t()}#aY(){let{seconds:t}=this.$props;return`Seek ${t()>0?"forward":"backward"} ${t()} seconds`}#a_(t){let{seconds:e,disabled:i}=this.$props;if(i())return;let{currentTime:s}=this.#D.$state,a=s()+e();this.#D.remote.seek(a,t)}}class iC extends o.Component{static #e=this.props={disabled:!1};#D;constructor(){super(),new e1}onSetup(){this.#D=tl();let{disabled:t}=this.$props,{live:e,liveEdge:i}=this.#D.$state,s=()=>!e();this.setAttributes({"data-edge":i,"data-hidden":s,"aria-disabled":eQ(()=>t()||i()),"aria-hidden":eQ(s)})}onAttach(t){tE(t,"tabindex","0"),tE(t,"role","button"),tE(t,"type","button"),t.setAttribute("data-media-tooltip","live")}onConnect(t){tR(t,this.#a_.bind(this))}#a_(t){let{disabled:e}=this.$props,{liveEdge:i}=this.#D.$state;e()||i()||this.#D.remote.seekToLiveEdge(t)}}let iP=new o.State({min:0,max:100,value:0,step:1,pointerValue:0,focused:!1,dragging:!1,pointing:!1,hidden:!1,get active(){return this.dragging||this.focused||this.pointing},get fillRate(){return iE(this.min,this.max,this.value)},get fillPercent(){return 100*this.fillRate},get pointerRate(){return iE(this.min,this.max,this.pointerValue)},get pointerPercent(){return 100*this.pointerRate}});function iE(t,e,i){let s=e-t;return s>0?(i-t)/s:0}class iA extends o.ViewController{#tb;#a0;constructor(t){super(),this.#tb=t}onConnect(t){this.#a0=new IntersectionObserver(t=>{this.#tb.callback?.(t,this.#a0)},this.#tb),this.#a0.observe(t),(0,o.onDispose)(this.#tq.bind(this))}#tq(){this.#a0?.disconnect(),this.#a0=void 0}}let iq=(0,o.createContext)(),iM=(0,o.createContext)(),iD={Left:-1,ArrowLeft:-1,Up:1,ArrowUp:1,Right:1,ArrowRight:1,Down:-1,ArrowDown:-1};class iR extends o.ViewController{#aS;#D;#a0;constructor(t,e){super(),this.#tz=null,this.#a1=null,this.#a2=null,this.#a3
1=!1,this.#a6=(0,o.functionThrottle)(t=>{this.#a5(this.#a7(t),t)},20,{leading:!0}),this.#aS=t,this.#D=e}onSetup(){(0,o.hasProvidedContext)(iM)&&(this.#a0=(0,o.useContext)(iM))}onConnect(t){(0,o.effect)(this.#a4.bind(this,t)),(0,o.effect)(this.#a9.bind(this,t)),this.#aS.swipeGesture&&(0,o.effect)(this.#a8.bind(this))}#a8(){let{pointer:t}=this.#D.$state;if("coarse"!==t()||!this.#aS.swipeGesture()){this.#tz=null;return}this.#tz=this.#D.player.el?.querySelector("media-provider,[data-media-provider]"),this.#tz&&new o.EventsController(this.#tz).add("touchstart",this.#nt.bind(this),{passive:!0}).add("touchmove",this.#ne.bind(this),{passive:!1})}#tz;#a1;#a2;#nt(t){this.#a1=t.touches[0]}#ne(t){if((0,o.isNull)(this.#a1)||tL(t))return;let e=t.touches[0],i=e.clientX-this.#a1.clientX,s=e.clientY-this.#a1.clientY,a=this.$state.dragging();!a&&Math.abs(s)>5||a||(t.preventDefault(),Math.abs(i)>20&&(this.#a1=e,this.#a2=this.$state.value(),this.#ni(this.#a2,t)))}#a4(t){let{hidden:e}=this.$props;(0,o.listenEvent)(t,"focus",this.#sD.bind(this)),e()||this.#aS.isDisabled()||new o.EventsController(t).add("keyup",this.#te.bind(this)).add("keydown",this.#ti.bind(this)).add("pointerenter",this.#sq.bind(this)).add("pointermove",this.#ns.bind(this)).add("pointerleave",this.#sM.bind(this)).add("pointerdown",this.#na.bind(this))}#a9(t){!this.#aS.isDisabled()&&this.$state.dragging()&&new o.EventsController(document).add("pointerup",this.#nn.bind(this),{capture:!0}).add("pointermove",this.#a6.bind(this)).add("touchmove",this.#nr.bind(this),{passive:!1})}#sD(){this.#a5(this.$state.value())}#nh(t,e){let{value:i,min:s,max:a,dragging:n}=this.$state,r=Math.max(s(),Math.min(t,a()));i.set(r);let h=this.createEvent("value-change",{detail:r,trigger:e});if(this.dispatch(h),this.#aS.onValueChange?.(h),n()){let t=this.createEvent("drag-value-change",{detail:r,trigger:e});this.dispatch(t),this.#aS.onDragValueChange?.(t)}}#a5(t,e){let{pointerValue:i,dragging:s}=this.$state;i.set(t),this.dispatch("pointer-value-change",{detail:t,trigger:e}),s()&&this.#nh(t,e)}#a7(t){var e,i,s,a;let n,r=this.el.getBoundingClientRect(),{min:h,max:l}=this.$state;if("vertical"===this.$props.orientation()){let{bottom:e,height:i}=r;n=(e-t.clientY)/i}else if(this.#a1&&(0,o.isNumber)(this.#a2)){let{width:e}=this.#tz.getBoundingClientRect(),i=(t.clientX-this.#a1.clientX)/e,s=l()-h(),a=s*Math.abs(i);n=(i<0?this.#a2-a:this.#a2+a)/s}else{let{left:e,width:i}=r;n=(t.clientX-e)/i}return Math.max(h(),Math.min(l(),this.#aS.roundValue((e=h(),i=l(),s=n,e+(a=this.#aS.getStep())*Math.round((i-e)*tS(0,s,1)/a)))))}#sq(t){this.$state.pointing.set(!0)}#ns(t){let{dragging:e}=this.$state;e()||this.#a5(this.#a7(t),t)}#sM(t){this.$state.pointing.set(!1)}#na(t){if(0!==t.button)return;let e=this.#a7(t);this.#ni(e,t),this.#a5(e,t)}#ni(t,e){let{dragging:i}=this.$state;if(i())return;i.set(!0),this.#D.remote.pauseControls(e);let s=this.createEvent("drag-start",{detail:t,trigger:e});this.dispatch(s),this.#aS.onDragStart?.(s),this.#a0?.onDragStart?.()}#no(t,e){let{dragging:i}=this.$state;if(!i())return;i.set(!1),this.#D.remote.resumeControls(e);let s=this.createEvent("drag-end",{detail:t,trigger:e});this.dispatch(s),this.#aS.onDragEnd?.(s),this.#a1=null,this.#a2=null,this.#a0?.onDragEnd?.()}#nl;#a3;#ti(t){if(!Object.keys(iD).includes(t.key))return;let{key:e}=t,i=this.#nd(t);if(!(0,o.isNull)(i)){this.#a5(i,t),this.#nh(i,t);return}let s=this.#nu(t);this.#a3||(this.#a3=e===this.#nl,!this.$state.dragging()&&this.#a3&&this.#ni(s,t)),this.#a5(s,t),this.#nl=e}#te(t){if(!Object.keys(iD).includes(t.key)||!(0,o.isNull)(this.#nd(t)))return;let e=this.#a3?this.$state.pointerValue():this.#nu(t);this.#nh(e,t),this.#no(e,t),this.#nl="",this.#a3=!1}#nd(t){let e=t.key,{min:i,max:s}=this.$state;return"Home"===e||"PageUp"===e?i():"End"===e||"PageDown"===e?s():!t.metaKey&&/^[0-9]$/.test(e)?(s()-i())/10*Number(e):null}#nu(t){let{key:e,shiftKey:i}=t;t.preventDefault(),t.stopPropagation();let{shiftKeyMultiplier:s}=this.$props,{min:a,max:n,value:r,pointerValue:h}=this.$state,o=this.#aS.getStep(),l=this.#aS.getKeyStep(),d=i?l*s():l,u=Number(iD[e]),c=this.#a3?h():this.#aS.getValue?.()??r();return Math.max(a(),Math.min(n(),Number(((c+d*u)/o*o).toFixed(3))))}#nn(t){if(0!==t.button)return;t.preventDefault(),t.stopImmediatePropagation();let e=this.#a7(t);this.#a5(e,t),this.#no(e,t)}#nr(t){t.preventDefault()}#a6}let iL=(0,o.createContext)(()=>({}));class iI extends o.ViewController{static #e=this.props={hidden:!1,disabled:!1,step:1,keyStep:1,orientation:"horizontal",shiftKeyMultiplier:5};#D;#aS;#nc;#np;constructor(t){super(),this.#nc=(0,o.signal)(!0),this.#np=(0,o.signal)(!0),this.#nm=(0,o.animationFrameThrottle)((t,e)=>{this.el?.style.setProperty("--slider-fill",t+"%"),this.el?.style.setProperty("--slider-pointer",e+"%")}),this.#aS=t}onSetup(){this.#D=tl();let t=new e1;t.attach(this),this.$state.focused=t.focused.bind(t),(0,o.hasProvidedContext)(iL)||(0,o.provideContext)(iL,{default:"value"}),(0,o.provideContext)(iq,{orientation:this.$props.orientation,disabled:this.#aS.isDisabled,preview:(0,o.signal)(null)}),(0,o.effect)(this.#ng.bind(this)),(0,o.effect)(this.#nf.bind(this)),(0,o.effect)(this.#ny.bind(this)),this.#nb(),new iR(this.#aS,this.#D).attach(this),new iA({callback:this.#nv.bind(this)}).attach(this)}onAttach(t){tE(t,"role","slider"),tE(t,"tabindex","0"),tE(t,"autocomplete","off"),u?this.#nw():(0,o.effect)(this.#nw.bind(this))}onConnect(t){(0,o.onDispose)(tM(t,this.#nc.set)),(0,o.effect)(this.#nk.bind(this))}#nv(t){this.#np.set(t[0].isIntersecting)}#nk(){let{hidden:t}=this.$props;this.$state.hidden.set(t()||!this.#nc()||!this.#np.bind(this))}#ng(){let{dragging:t,value:e,min:i,max:s}=this.$state;if(!(0,o.peek)(t)){var a,n;e.set((a=i(),n=s(),tS(a,tT(e(),tx(this.#aS.getStep())),n)))}}#nf(){this.$state.step.set(this.#aS.getStep())}#ny(){if(!this.#aS.isDisabled())return;let{dragging:t,pointing:e}=this.$state;t.set(!1),e.set(!1)}#n$(){return(0,o.ariaBool)(this.#aS.isDisabled())}#nb(){let{orientation:t}=this.$props,{dragging:e,active:i,pointing:s}=this.$state;this.setAttributes({"data-dragging":e,"data-pointing":s,"data-active":i,"aria-disabled":this.#n$.bind(this),"aria-valuemin":this.#aS.aria.valueMin??this.$state.min,"aria-valuemax":this.#aS.aria.valueMax??this.$state.max,"aria-valuenow":this.#aS.aria.valueNow,"aria-valuetext":this.#aS.aria.valueText,"aria-orientation":t})}#nw(){let{fillPercent:t,pointerPercent:e}=this.$state;this.#nm(tT(t(),3),tT(e(),3))}#nm}class iV extends o.Component{static #e=this.props={...iI.props,min:0,max:100,value:0};static #sL=this.state=iP;constructor(){super(),new iI({getStep:this.$props.step,getKeyStep:this.$props.keyStep,roundValue:Math.round,isDisabled:this.$props.disabled,aria:{valueNow:this.#nT.bind(this),valueText:this.#nx.bind(this)}})}onSetup(){(0,o.effect)(this.#ng.bind(this)),(0,o.effect)(this.#nS.bind(this))}#nT(){let{value:t}=this.$state;return Math.round(t())}#nx(){let{value:t,max:e}=this.$state;return tT(t()/e()*100,2)+"%"}#ng(){let{value:t}=this.$props;this.$state.value.set(t())}#nS(){let{min:t,max:e}=this.$props;this.$state.min.set(t()),this.$state.max.set(e())}}let iO=new Map,iF=new Map;class iN{#D;#nC;#nP;static create(t,e){return new iN(t,e,tl())}constructor(t,e,i){this.$images=(0,o.signal)([]),this.#nC=t,this.#nP=e,this.#D=i,(0,o.effect)(this.#nE.bind(this))}#nE(){let{canLoad:t}=this.#D.$state;if(!t())return;let e=this.#nC();if(e){if((0,o.isString)(e)&&iO.has(e)){let t=iO.get(e);if(iO.delete(e),iO.set(e,t),iO.size>99){let t=iO.keys().next().value;iO.delete(t)}this.$images.set(iO.get(e))}else if((0,o.isString)(e)){let t=this.#nP(),s=e+"::"+t;if(!iF.has(s)){let a=new Promise(async(s,a)=>{try{let n=await fetch(e,{credentials:W(t)});if("application/json"===n.headers.get("content-type")){let t=await n.json();if((0,o.isArray)(t)){if(t[0]&&"text"in t[0])s(this.#nA(t));else{for(let e=0;e<t.length;e++){let i=t[e];eT((0,o.isObject)(i),!1),eT("url"in i&&(0,o.isString)(i.url),!1),eT("startTime"in i&&(0,o.isNumber)(i.startTime),!1)}s(t)}}else s(this.#nq(t));return}i.e(7276).then(i.bind(i,97276)).then(async t=>{let{parseResponse:e}=t;try{let{cues:t}=await e(n);s(this.#nA(t))}catch(t){a(t)}})}catch(t){a(t)}}).then(t=>(iO.set(s,t),t)).catch(t=>{this.#tA(e,t)}).finally(()=>{(0,o.isString)(s)&&iF.delete(s)});iF.set(s,a)}iF.get(s)?.then(t=>{this.$images.set(t||[])})}else if((0,o.isArray)(e))try{this.$images.set(this.#nM(e))}catch(t){this.#tA(e,t)}else try{this.$images.set(this.#nq(e))}catch(t){this.#tA(e,t)}return()=>{this.$images.set([])}}}#nM(t){let e=this.#nD();return t.map((t,i)=>(eT(t.url&&(0,o.isString)(t.url)),eT("startTime"in t&&(0,o.isNumber)(t.startTime)),{...t,url:(0,o.isString)(t.url)?this.#nR(t.url,e):t.url}))}#nq(t){eT((0,o.isString)(t.url)),eT((0,o.isArray)(t.tiles)&&t.tiles?.length);let e=new URL(t.url),i=[],s="tile_width"in t?t.tile_width:t.tileWidth,a="tile_height"in t?t.tile_height:t.tileHeight;for(let n of t.tiles)i.push({url:e,startTime:"start"in n?n.start:n.startTime,width:s,height:a,coords:{x:n.x,y:n.y}});return i}#nA(t){for(let e=0;e<t.length;e++){let i=t[e];eT("startTime"in i&&(0,o.isNumber)(i.startTime)),eT("text"in i&&(0,o.isString)(i.text))}let e=[],i=this.#nD();
1for(let s of t){let[t,a]=s.text.split("#"),n=this.#nL(a);e.push({url:this.#nR(t,i),startTime:s.startTime,endTime:s.endTime,width:n?.w,height:n?.h,coords:n&&(0,o.isNumber)(n.x)&&(0,o.isNumber)(n.y)?{x:n.x,y:n.y}:void 0})}return e}#nD(){let t=(0,o.peek)(this.#nC);return(0,o.isString)(t)&&/^https?:/.test(t)?t:location.href}#nR(t,e){return/^https?:/.test(t)?new URL(t):new URL(t,e)}#nL(t){if(!t)return{};let[e,i]=t.split("="),s=i?.split(","),a={};if(!e||!s)return null;for(let t=0;t<e.length;t++){let i=+s[t];isNaN(i)||(a[e[t]]=i)}return a}#tA(t,e){}}class iU extends o.Component{static #e=this.props={src:null,time:0,crossOrigin:null};static #sL=this.state=new o.State({src:"",img:null,thumbnails:[],activeThumbnail:null,crossOrigin:null,loading:!1,error:null,hidden:!1});#s5;#nI;onSetup(){this.media=tl(),this.#s5=iN.create(this.$props.src,this.$state.crossOrigin),this.#sg(),this.setAttributes({"data-loading":this.#nV.bind(this),"data-error":this.#nO.bind(this),"data-hidden":this.$state.hidden,"aria-hidden":eQ(this.$state.hidden)})}onConnect(t){(0,o.effect)(this.#nF.bind(this)),(0,o.effect)(this.#nk.bind(this)),(0,o.effect)(this.#sg.bind(this)),(0,o.effect)(this.#ei.bind(this)),(0,o.effect)(this.#nN.bind(this)),(0,o.effect)(this.#nU.bind(this))}#nF(){let t=this.$state.img();t&&new o.EventsController(t).add("load",this.#is.bind(this)).add("error",this.#tA.bind(this))}#sg(){let{crossOrigin:t}=this.$props,{crossOrigin:e}=this.$state,{crossOrigin:i}=this.media.$state,s=null!==t()?t():i();e.set(!0===s?"anonymous":s)}#ei(){let{src:t,loading:e,error:i}=this.$state;return t()&&(e.set(!0),i.set(null)),()=>{this.#nK(),e.set(!1),i.set(null)}}#is(){let{loading:t,error:e}=this.$state;this.#nU(),t.set(!1),e.set(null)}#tA(t){let{loading:e,error:i}=this.$state;e.set(!1),i.set(t)}#nV(){let{loading:t,hidden:e}=this.$state;return!e()&&t()}#nO(){let{error:t}=this.$state;return!(0,o.isNull)(t())}#nk(){let{hidden:t}=this.$state,{duration:e}=this.media.$state,i=this.#s5.$images();t.set(this.#nO()||!Number.isFinite(e())||0===i.length)}getTime(){return this.$props.time()}#nN(){let t=this.#s5.$images();if(!t.length)return;let e=this.getTime(),{src:i,activeThumbnail:s}=this.$state,a=-1,n=null;for(let i=t.length-1;i>=0;i--){let s=t[i];if(e>=s.startTime&&(!s.endTime||e<s.endTime)){a=i;break}}t[a]&&(n=t[a]),s.set(n),i.set(n?.url.href||"")}#nU(){if(!this.scope||this.$state.hidden())return;let t=this.el,e=this.$state.img(),i=this.$state.activeThumbnail();if(!e||!i||!t)return;let s=i.width??e.naturalWidth,a=i?.height??e.naturalHeight,{maxWidth:n,maxHeight:r,minWidth:h,minHeight:o,width:l,height:d}=getComputedStyle(this.el);"100%"===h&&(h=parseFloat(l)+""),"100%"===o&&(o=parseFloat(d)+"");let u=Math.max(parseInt(h)/s,parseInt(o)/a),c=Math.min(Math.max(parseInt(h),parseInt(n))/s,Math.max(parseInt(o),parseInt(r))/a),p=!isNaN(c)&&c<1?c:u>1?u:1;this.#nB(t,"--thumbnail-width",`${s*p}px`),this.#nB(t,"--thumbnail-height",`${a*p}px`),this.#nB(t,"--thumbnail-aspect-ratio",String(tT(s/a,5))),this.#nB(e,"width",`${e.naturalWidth*p}px`),this.#nB(e,"height",`${e.naturalHeight*p}px`),this.#nB(e,"transform",i.coords?`translate(-${i.coords.x*p}px, -${i.coords.y*p}px)`:""),this.#nB(e,"max-width","none")}#nB(t,e,i){t.style.setProperty(e,i),this.#nI.push(()=>t.style.removeProperty(e))}#nK(){for(let t of this.#nI)t();this.#nI=[]}constructor(...t){super(...t),this.#nI=[]}}class iK extends iU{#nG;onAttach(t){this.#nG=(0,o.useState)(iV.state)}getTime(){let{duration:t,clipStartTime:e}=this.media.$state;return e()+this.#nG.pointerRate()*t()}}class iB extends o.Component{static #e=this.props={src:null,crossOrigin:null};static #sL=this.state=new o.State({video:null,src:null,crossOrigin:null,canPlay:!1,error:null,hidden:!1});#D;#nG;get video(){return this.$state.video()}onSetup(){this.#D=tl(),this.#nG=(0,o.useState)(iV.state),this.#sg(),this.setAttributes({"data-loading":this.#nV.bind(this),"data-hidden":this.$state.hidden,"data-error":this.#nO.bind(this),"aria-hidden":eQ(this.$state.hidden)})}onAttach(t){(0,o.effect)(this.#nQ.bind(this)),(0,o.effect)(this.#nW.bind(this)),(0,o.effect)(this.#sg.bind(this)),(0,o.effect)(this.#nk.bind(this)),(0,o.effect)(this.#nH.bind(this)),(0,o.effect)(this.#nj.bind(this))}#nQ(){let t=this.$state.video();t&&(t.readyState>=2&&this.#el(),new o.EventsController(t).add("canplay",this.#el.bind(this)).add("error",this.#tA.bind(this)))}#nW(){let{src:t}
1=this.$state,{canLoad:e}=this.#D.$state;t.set(e()?this.$props.src():null)}#sg(){let{crossOrigin:t}=this.$props,{crossOrigin:e}=this.$state,{crossOrigin:i}=this.#D.$state,s=null!==t()?t():i();e.set(!0===s?"anonymous":s)}#nV(){let{canPlay:t,hidden:e}=this.$state;return!t()&&!e()}#nO(){let{error:t}=this.$state;return!(0,o.isNull)(t)}#nk(){let{src:t,hidden:e}=this.$state,{canLoad:i,duration:s}=this.#D.$state;e.set(i()&&(!t()||this.#nO()||!Number.isFinite(s())))}#nH(){let{src:t,canPlay:e,error:i}=this.$state;t(),e.set(!1),i.set(null)}#el(t){let{canPlay:e,error:i}=this.$state;e.set(!0),i.set(null),this.dispatch("can-play",{trigger:t})}#tA(t){let{canPlay:e,error:i}=this.$state;e.set(!1),i.set(t),this.dispatch("error",{trigger:t})}#nj(){let{video:t,canPlay:e}=this.$state,{duration:i}=this.#D.$state,{pointerRate:s}=this.#nG,a=t();e()&&a&&Number.isFinite(i())&&Number.isFinite(s())&&(a.currentTime=s()*i())}}let iG=iB.prototype;(0,o.prop)(iG,"video");class iQ extends o.Component{static #e=this.props={type:"pointer",format:null,showHours:!1,showMs:!1,padHours:null,padMinutes:null,decimalPlaces:2};#nz;#n_;#nG;onSetup(){this.#nG=(0,o.useState)(iV.state),this.#nz=(0,o.useContext)(iL),this.#n_=(0,o.computed)(this.getValueText.bind(this))}getValueText(){let{type:t,format:e,decimalPlaces:i,padHours:s,padMinutes:a,showHours:n,showMs:r}=this.$props,{value:h,pointerValue:o,min:l,max:d}=this.#nG,u=e?.()??this.#nz.default,c="current"===t()?h():o();if("percent"===u){let t=d()-l();return(this.#nz.percent??tT)(c/t*100,i())+"%"}return"time"===u?(this.#nz.time??eI)(c,{padHrs:s(),padMins:a(),showHrs:n(),showMs:r()}):(this.#nz.value?.(c)??c.toFixed(2))+""}}let iW=iQ.prototype;(0,o.method)(iW,"getValueText");class iH extends o.Component{static #e=this.props={offset:0,noClamp:!1};#nG;onSetup(){this.#nG=(0,o.useContext)(iq);let{active:t}=(0,o.useState)(iV.state);this.setAttributes({"data-visible":t})}onAttach(t){Object.assign(t.style,{position:"absolute",top:0,left:0,width:"max-content"})}onConnect(t){let{preview:e}=this.#nG;e.set(t),(0,o.onDispose)(()=>e.set(null)),(0,o.effect)(this.#nX.bind(this));let i=new ResizeObserver(this.#nX.bind(this));i.observe(t),(0,o.onDispose)(()=>i.disconnect())}#nX;constructor(...t){super(...t),this.#nX=(0,o.animationFrameThrottle)(()=>{let{disabled:t,orientation:e}=this.#nG;if(t())return;let i=this.el,{offset:s,noClamp:a}=this.$props;i&&function(t,e){let{clamp:i,offset:s,orientation:a}=e,n=getComputedStyle(t),r=parseFloat(n.width),h=parseFloat(n.height),o={top:null,right:null,bottom:null,left:null};if(o["horizontal"===a?"bottom":"left"]=`calc(100% + var(--media-slider-preview-offset, ${s}px))`,"horizontal"===a){let t=r/2;if(i){let e=`max(0px, calc(var(--slider-pointer) - ${t}px))`,i=`calc(100% - ${r}px)`;o.left=`min(${e}, ${i})`}else o.left=`calc(var(--slider-pointer) - ${t}px)`}else{let t=h/2;if(i){let e=`max(${t}px, calc(var(--slider-pointer) - ${t}px))`,i=`calc(100% - ${h}px)`;o.bottom=`min(${e}, ${i})`}else o.bottom=`calc(var(--slider-pointer) - ${t}px)`}Object.assign(t.style,o)}(i,{clamp:!a(),offset:s(),orientation:e()})})}}class ij extends o.Component{static #e=this.props={...iI.props,keyStep:5,shiftKeyMultiplier:2};static #sL=this.state=iP;#D;onSetup(){this.#D=tl();let{audioGain:t}=this.#D.$state;(0,o.provideContext)(iL,{default:"percent",value:e=>(e*(t()??1)).toFixed(2),percent:e=>Math.round(e*(t()??1))}),new iI({getStep:this.$props.step,getKeyStep:this.$props.keyStep,roundValue:Math.round,isDisabled:this.#nY.bind(this),aria:{valueMax:this.#nJ.bind(this),valueNow:this.#nT.bind(this),valueText:this.#nx.bind(this)},onDragValueChange:this.#nZ.bind(this),onValueChange:this.#n0.bind(this)}).attach(this),(0,o.effect)(this.#sK.bind(this))}onAttach(t){t.setAttribute("data-media-volume-slider",""),tE(t,"aria-label","Volume");let{canSetVolume:e}=this.#D.$state;this.setAttributes({"data-supported":e,"aria-hidden":eQ(()=>!e())})}#nT(){let{value:t}=this.$state,{audioGain:e}=this.#D.$state;return Math.round(t()*(e()??1))}#nx(){let{value:t,max:e}=this.$state,{audioGain:i}=this.#D.$state;return tT(t()/e()*(i()??1)*100,2)+"%"}#nJ(){let{audioGain:t}=this.#D.$state;return this.$state.max()*(t()??1)}#nY(){let{disabled:t}=this.$props,{canSetVolume:e}=this.#D.$state;return t()||!e()}#sK(){let{muted:t,volume:e}=this.#D.$state,i=t()?0:100*e();this.$state.value.set(i),this.dispatch("value-change",{detail:i})}#n1;#en(t){if(!t.trigger)return;let e=tT(t.detail/100,3);this.#D.remote.changeVolume(e,t)}#n0(t){this.#n1(t)}#nZ(t){this.#n1(t)}constructor(...t){super(...t),this.#n1=(0,o.functionThrottle)(this.#en.bind(this),25)}}class iz extends o.Component{static #e=this.props={...iI.props,step:25,keyStep:25,shiftKeyMultiplier:2,min:0,max:300};static #sL=this.state=iP;#D;onSetup(){this.#D=tl(),(0,o.provideContext)(iL,{default:"percent",percent:(t,e)=>tT(this.$state.value(),e)+"%"}),new iI({getStep:this.$props.step,getKeyStep:this.$props.keyStep,roundValue:Math.round,isDisabled:this.#nY.bind(this),aria:{valueNow:this.#nT.bind(this),valueText:this.#nx.bind(this)},onDragValueChange:this.#nZ.bind(this),onValueChange:this.#n0.bind(this)}).attach(this),(0,o.effect)(this.#nS.bind(this)),(0,o.effect)(this.#n2.bind(this))}onAttach(t){t.setAttribute("data-media-audio-gain-slider",""),tE(t,"aria-label","Audio Boost");let{canSetAudioGain:e}=this.#D.$state;this.setAttributes({"data-supported":e,"aria-hidden":eQ(()=>!e())})}#nT(){let{value:t}=this.$state;return Math.round(t())}#nx(){let{value:t}=this.$state;return t()+"%"}#nS(){let{min:t,max:e}=this.$props;this.$state.min.set(t()),this.$state.max.set(e())}#n2(){let{audioGain:t}=this.#D.$state,e=((t()??1)-1)*100;this.$state.value.set(e),this.dispatch("value-change",{detail:e})}#nY(){let{disabled:t}=this.$props,{canSetAudioGain:e}=this.#D.$state;return t()||!e()}#n3(t){if(!t.trigger)return;let e=tT(1+t.detail/100,2);this.#D.remote.changeAudioGain(e,t)}#n0(t){this.#n3(t)}#nZ(t){this.#n3(t)}}class i_ extends o.Component{static #e=this.props={...iI.props,step:.25,keyStep:.25,shiftKeyMultiplier:2,min:0,max:2};static #sL=this.state=iP;#D;onSetup(){this.#D=tl(),new iI({getStep:this.$props.step,getKeyStep:this.$props.keyStep,roundValue:this.#n6,isDisabled:this.#nY.bind(this),aria:{valueNow:this.#nT.bind(this),valueText:this.#nx.bind(this)},onDragValueChange:this.#nZ.bind(this),onValueChange:this.#n0.bind(this)}).attach(this),(0,o.effect)(this.#nS.bind(this)),(0,o.effect)(this.#sG.bind(this))}
1onAttach(t){t.setAttribute("data-media-speed-slider",""),tE(t,"aria-label","Speed");let{canSetPlaybackRate:e}=this.#D.$state;this.setAttributes({"data-supported":e,"aria-hidden":eQ(()=>!e())})}#nT(){let{value:t}=this.$state;return t()}#nx(){let{value:t}=this.$state;return t()+"x"}#nS(){let{min:t,max:e}=this.$props;this.$state.min.set(t()),this.$state.max.set(e())}#sG(){let{playbackRate:t}=this.#D.$state,e=t();this.$state.value.set(e),this.dispatch("value-change",{detail:e})}#n6(t){return tT(t,2)}#nY(){let{disabled:t}=this.$props,{canSetPlaybackRate:e}=this.#D.$state;return t()||!e()}#n5;#n7(t){if(!t.trigger)return;let e=t.detail;this.#D.remote.changePlaybackRate(e,t)}#n0(t){this.#n5(t)}#nZ(t){this.#n5(t)}constructor(...t){super(...t),this.#n5=(0,o.functionThrottle)(this.#n7.bind(this),25)}}class iX extends o.Component{static #e=this.props={...iI.props,step:1,keyStep:1,shiftKeyMultiplier:1};static #sL=this.state=iP;#D;#n4;onSetup(){this.#D=tl(),new iI({getStep:this.$props.step,getKeyStep:this.$props.keyStep,roundValue:Math.round,isDisabled:this.#nY.bind(this),aria:{valueNow:this.#nT.bind(this),valueText:this.#nx.bind(this)},onDragValueChange:this.#nZ.bind(this),onValueChange:this.#n0.bind(this)}).attach(this),(0,o.effect)(this.#n9.bind(this)),(0,o.effect)(this.#n8.bind(this))}onAttach(t){t.setAttribute("data-media-quality-slider",""),tE(t,"aria-label","Video Quality");let{qualities:e,canSetQuality:i}=this.#D.$state,s=(0,o.computed)(()=>i()&&e().length>0);this.setAttributes({"data-supported":s,"aria-hidden":eQ(()=>!s())})}#nT(){let{value:t}=this.$state;return t()}#nx(){let{quality:t}=this.#D.$state;if(!t())return"";let{height:e,bitrate:i}=t(),s=i&&i>0?`${(i/1e6).toFixed(2)} Mbps`:null;return e?`${e}p${s?` (${s})`:""}`:"Auto"}#n9(){let t=this.#n4();this.$state.max.set(Math.max(0,t.length-1))}#n8(){let{quality:t}=this.#D.$state,e=Math.max(0,this.#n4().indexOf(t()));this.$state.value.set(e),this.dispatch("value-change",{detail:e})}#nY(){let{disabled:t}=this.$props,{canSetQuality:e,qualities:i}=this.#D.$state;return t()||i().length<=1||!e()}#rt;#eX(t){if(!t.trigger)return;let{qualities:e}=this.#D,i=(0,o.peek)(this.#n4)[t.detail];this.#D.remote.changeQuality(e.indexOf(i),t)}#n0(t){this.#rt(t)}#nZ(t){this.#rt(t)}constructor(...t){super(...t),this.#n4=(0,o.computed)(()=>{let{qualities:t}=this.#D.$state;return tG(t())}),this.#rt=(0,o.functionThrottle)(this.#eX.bind(this),25)}}class iY extends o.Component{static #e=this.props={...iI.props,step:.1,keyStep:5,shiftKeyMultiplier:2,pauseWhileDragging:!1,noSwipeGesture:!1,seekingRequestThrottle:100};static #sL=this.state=iP;#D;#re;#ri;constructor(){super(),this.#ri=(0,o.signal)(null),this.#rs=!1;let{noSwipeGesture:t}=this.$props;new iI({swipeGesture:()=>!t(),getValue:this.#ra.bind(this),getStep:this.#rn.bind(this),getKeyStep:this.#rr.bind(this),roundValue:this.#n6,isDisabled:this.#nY.bind(this),aria:{valueNow:this.#nT.bind(this),valueText:this.#nx.bind(this)},onDragStart:this.#rh.bind(this),onDragValueChange:this.#nZ.bind(this),onDragEnd:this.#ro.bind(this),onValueChange:this.#n0.bind(this)})}onSetup(){this.#D=tl(),(0,o.provideContext)(iL,{default:"time",value:this.#rl.bind(this),time:this.#rd.bind(this)}),this.setAttributes({"data-chapters":this.#ru.bind(this)}),this.setStyles({"--slider-progress":this.#rc.bind(this)}),(0,o.effect)(this.#sB.bind(this)),(0,o.effect)(this.#rp.bind(this))}onAttach(t){t.setAttribute("data-media-time-slider",""),tE(t,"aria-label","Seek")}onConnect(t){(0,o.effect)(this.#rm.bind(this)),Z(this.#D.textTracks,"chapters",this.#ri.set)}#rc(){let{bufferedEnd:t,duration:e}=this.#D.$state;return tT(100*Math.min(t()/Math.max(e(),1),1),3)+"%"}#ru(){let{duration:t}=this.#D.$state;return this.#ri()?.cues.length&&Number.isFinite(t())&&t()>0}#rp(){this.#re=(0,o.functionThrottle)(this.#th.bind(this),this.$props.seekingRequestThrottle())}#sB(){if(this.$state.hidden())return;let{value:t,dragging:e}=this.$state,i=this.#ra();(0,o.peek)(e)||(t.set(i),this.dispatch("value-change",{detail:i}))}#rm(){let t=this.#D.player.el,{preview:e}=(0,o.useContext)(iq);
1t&&e()&&(0,o.setAttribute)(t,"data-preview",this.$state.active())}#th(t,e){this.#D.remote.seeking(t,e)}#rg(t,e,i){this.#re.cancel();let{live:s}=this.#D.$state;if(s()&&e>=99){this.#D.remote.seekToLiveEdge(i);return}this.#D.remote.seek(t,i)}#rs;#rh(t){let{pauseWhileDragging:e}=this.$props;if(e()){let{paused:e}=this.#D.$state;this.#rs=!e(),this.#D.remote.pause(t)}}#nZ(t){this.#re(this.#rf(t.detail),t)}#ro(t){let{seeking:e}=this.#D.$state;(0,o.peek)(e)||this.#th(this.#rf(t.detail),t);let i=t.detail;this.#rg(this.#rf(i),i,t);let{pauseWhileDragging:s}=this.$props;s()&&this.#rs&&(this.#D.remote.play(t),this.#rs=!1)}#n0(t){let{dragging:e}=this.$state;!e()&&t.trigger&&this.#ro(t)}#ra(){let{currentTime:t}=this.#D.$state;return this.#ry(t())}#rn(){let t=this.$props.step()/this.#D.$state.duration()*100;return Number.isFinite(t)?t:1}#rr(){let t=this.$props.keyStep()/this.#D.$state.duration()*100;return Number.isFinite(t)?t:1}#n6(t){return tT(t,3)}#nY(){let{disabled:t}=this.$props,{canSeek:e}=this.#D.$state;return t()||!e()}#nT(){let{value:t}=this.$state;return Math.round(t())}#nx(){let t=this.#rf(this.$state.value()),{duration:e}=this.#D.$state;return Number.isFinite(t)?`${eV(t)} out of ${eV(e())}`:"live"}#rf(t){let{duration:e}=this.#D.$state;return tT(t/100*e(),5)}#ry(t){let{liveEdge:e,duration:i}=this.#D.$state,s=Math.max(0,Math.min(1,e()?1:Math.min(t,i())/i()));return Number.isNaN(s)?0:Number.isFinite(s)?100*s:100}#rl(t){let e=this.#rf(t),{live:i,duration:s}=this.#D.$state;return Number.isFinite(e)?(i()?e-s():e).toFixed(0):"LIVE"}#rd(t,e){let i=this.#rf(t),{live:s,duration:a}=this.#D.$state,n=s()?i-a():i;return Number.isFinite(i)?`${n<0?"-":""}${eI(Math.abs(n),e)}`:"LIVE"}}class iJ extends o.Component{static #e=this.props={disabled:!1};#D;#rb;#rv;#rw;#rk;#r$;#rT;#rx;#rS;#rC;get cues(){return this.#rT()}get activeCue(){return this.#rT()[this.#rx()]||null}get activePointerCue(){return this.#rT()[this.#rS()]||null}onSetup(){this.#D=tl(),this.#rb=(0,o.useState)(iY.state)}onAttach(t){Z(this.#D.textTracks,"chapters",this.#rP.bind(this)),(0,o.effect)(this.#rE.bind(this))}onConnect(){(0,o.onDispose)(()=>this.#it.bind(this))}onDestroy(){this.#rP(null)}setRefs(t){if(this.#rk=t,this.#rv?.dispose(),1===this.#rk.length){let t=this.#rk[0];t.style.width="100%",t.style.setProperty("--chapter-fill","var(--slider-fill)"),t.style.setProperty("--chapter-progress","var(--slider-progress)")}else this.#rk.length>0&&(0,o.scoped)(()=>this.#rA(),this.#rv=(0,o.createScope)())}#rP(t){(0,o.peek)(this.#r$)!==t&&(this.#it(),this.#r$.set(t))}#it(){this.#rk=[],this.#rT.set([]),this.#rx.set(-1),this.#rS.set(-1),this.#rC=0,this.#rv?.dispose()}#rA(){this.#rk.length&&(0,o.effect)(this.#rq.bind(this))}#rq(){let{hidden:t}=this.#rb;t()||((0,o.effect)(this.#rM.bind(this)),(0,o.effect)(this.#rD.bind(this)),(0,o.effect)(this.#rR.bind(this)),(0,o.effect)(this.#rL.bind(this)))}#rM(){let t=this.#rT();if(!t.length)return;let e,{seekableStart:i,seekableEnd:s}=this.#D.$state,a=i(),n=(s()||t[t.length-1].endTime)-a,r=100;for(let i=0;i<t.length;i++)if(e=t[i],this.#rk[i]){let s=i===t.length-1?r:tT((e.endTime-Math.max(a,e.startTime))/n*100,3);this.#rk[i].style.width=s+"%",r-=s}}#rD(){let{liveEdge:t,seekableStart:e,seekableEnd:i}=this.#D.$state,{fillPercent:s,value:a}=this.#rb,n=this.#rT(),r=t(),h=(0,o.peek)(this.#rx),l=n[h],d=r?this.#rT.length-1:this.#rI(l&&l.startTime/i()*100<=(0,o.peek)(a)?h:0,s());r||!l?this.#rV(0,n.length,100):d>h?this.#rV(h,d,100):d<h&&this.#rV(d+1,h+1,0);let u=r?100:this.#rO(n[d],s(),e(),this.#rF(n));this.#rN(this.#rk[d],u),this.#rx.set(d)}#rR(){let{hidden:t,pointerPercent:e}=this.#rb;if(t()){this.#rS.set(-1);return}let i=this.#rI(0,e());this.#rS.set(i)}#rV(t,e,i){for(let s=t;s<e;s++)this.#rN(this.#rk[s],i)}#rN(t,e){t&&(t.style.setProperty("--chapter-fill",e+"%"),(0,o.setAttribute)(t,"data-active",e>0&&e<100),(0,o.setAttribute)(t,"data-ended",100===e))}#rI(t,e){let i=0,s=this.#rT();if(0===e)return 0;if(100===e)return s.length-1;let{seekableStart:a}=this.#D.$state,n=a(),r=this.#rF(s);for(let a=t;a<s.length;a++)if((i=this.#rO(s[a],e,n,r))>=0&&i<100)return a;return 0}#rL(){this.#rU(this.#rK())}#rU;#rK;#rB(){let{bufferedEnd:t,duration:e}=this.#D.$state;return 100*tT(Math.min(t()/Math.max(e(),1),1),3)}#rF(t){let{seekableEnd:e}=this.#D.$state,i=e();return Number.isFinite(i)?i:t[t.length-1]?.endTime||0}#rO(t,e,i,s){if(!t||0===this.#rT().length)return 0;
1let a=s-i,n=Math.max(0,t.startTime-i),r=Math.min(s,t.endTime)-i,h=n/a,o=100*h,l=100*Math.min(1,h+(r-n)/a);return Math.max(0,tT(e>=l?100:(e-o)/(l-o)*100,3))}#rG(t){let e=[],{seekableStart:i,seekableEnd:s,duration:a}=this.#D.$state,n=i(),r=s(),h=(t=t.filter(t=>t.startTime<=r&&t.endTime>=n))[0];h&&h.startTime>n&&e.push(new window.VTTCue(n,h.startTime,""));for(let i=0;i<t.length-1;i++){let s=t[i],a=t[i+1];if(e.push(s),a){let t=a.startTime-s.endTime;t>0&&e.push(new window.VTTCue(s.endTime,s.endTime+t,""))}}let o=t[t.length-1];if(o){e.push(o);let t=a();t>=0&&t-o.endTime>1&&e.push(new window.VTTCue(o.endTime,a(),""))}return e}#rE(){let{source:t}=this.#D.$state;t(),this.#eJ()}#eJ(){if(!this.scope)return;let{disabled:t}=this.$props;if(t()){this.#rT.set([]),this.#rx.set(0),this.#rC=0;return}let e=this.#r$();if(e){let t=this.#rQ.bind(this);t(),new o.EventsController(e).add("add-cue",t).add("remove-cue",t),(0,o.effect)(this.#rW.bind(this))}return this.#rw=this.#rH(),this.#rw&&(0,o.effect)(this.#rj.bind(this)),()=>{this.#rw&&(this.#rw.textContent="",this.#rw=null)}}#rW(){this.#D.$state.duration(),this.#rQ()}#rQ;#rj(){let t=this.activePointerCue||this.activeCue;this.#rw&&(this.#rw.textContent=t?.text||"")}#rz(){let t=this.el;for(;t&&"slider"!==t.getAttribute("role");)t=t.parentElement;return t}#rH(){let t=this.#rz();return t?t.querySelector('[data-part="chapter-title"]'):null}constructor(...t){super(...t),this.#rw=null,this.#rk=[],this.#r$=(0,o.signal)(null),this.#rT=(0,o.signal)([]),this.#rx=(0,o.signal)(-1),this.#rS=(0,o.signal)(-1),this.#rC=0,this.#rU=(0,o.animationFrameThrottle)(t=>{let e,i=this.#rT(),{seekableStart:s}=this.#D.$state,a=s(),n=this.#rF(i);for(let s=this.#rC;s<this.#rk.length;s++)if(e=this.#rO(i[s],t,a,n),this.#rk[s]?.style.setProperty("--chapter-progress",e+"%"),e<100){this.#rC=s;break}}),this.#rK=(0,o.computed)(this.#rB.bind(this)),this.#rQ=(0,o.functionDebounce)(()=>{let t=(0,o.peek)(this.#r$);this.scope&&t&&t.cues.length&&(this.#rT.set(this.#rG(t.cues)),this.#rx.set(0),this.#rC=0)},150,!0)}}let iZ=iJ.prototype;(0,o.prop)(iZ,"cues"),(0,o.prop)(iZ,"activeCue"),(0,o.prop)(iZ,"activePointerCue"),(0,o.method)(iZ,"setRefs");let i0=(0,o.createContext)(),i1=["a[href]","[tabindex]","input","select","button"].map(t=>`${t}:not([aria-hidden='true'])`).join(","),i2=new Set(["Escape","Tab","ArrowUp","ArrowDown","Home","PageUp","End","PageDown","Enter"," "]);class i3{#r_;#rX;#rY;#aS;get items(){return this.#rY}constructor(t){this.#r_=-1,this.#rX=null,this.#rY=[],this.#aS=t}attachMenu(t){(0,o.listenEvent)(t,"focus",this.#sD.bind(this)),this.#rX=t,(0,o.onDispose)(()=>{this.#rX=null})}listen(){this.#rX&&(this.update(),new o.EventsController(this.#rX).add("keyup",this.#te.bind(this)).add("keydown",this.#ti.bind(this)),(0,o.onDispose)(()=>{this.#r_=-1,this.#rY=[]}))}update(){this.#r_=0,this.#rY=this.#rJ()}scroll(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.#rZ(),e=this.#rY[t];e&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{!function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){for(let{el:i,top:s,left:a}of(0,o.r)(t,e))i.scroll({top:s,left:a,behavior:e.behavior})}(t,{scrollMode:"if-needed",block:"center",inline:"center",...e})}(e,{behavior:"smooth",boundary:t=>!t.hasAttribute("data-root")})})})}focusActive(){let t=!(arguments.length>0)||void 0===arguments[0]||arguments[0],e=this.#rZ();this.#r0(e>=0?e:0,t)}#r0(t){let e=!(arguments.length>1)||void 0===arguments[1]||arguments[1];this.#r_=t,this.#rY[t]?(this.#rY[t].focus({preventScroll:!0}),e&&this.scroll(t)):this.#rX?.focus({preventScroll:!0})}#rZ(){return this.#rY.findIndex(t=>document.activeElement===t||"menuitemradio"===t.getAttribute("role")&&"true"===t.getAttribute("aria-checked"))}#sD(){this.#r_>=0||(this.update(),this.focusActive())}#r1(t){let e=t.target;if((0,o.wasEnterKeyPressed)(t)&&e instanceof Element){let t=e.getAttribute("role");return!/a|input|select|button/.test(e.localName)&&!t}return i2.has(t.key)}#te(t){this.#r1(t)&&(t.stopPropagation(),t.preventDefault())}#ti(t){if(this.#r1(t))switch(t.stopPropagation(),t.preventDefault(),t.key){case"Escape":this.#aS.closeMenu(t);break;case"Tab":this.#r0(this.#r2(t.shiftKey?-1:1));break;case"ArrowUp":this.#r0(this.#r2(-1));break;case"ArrowDown":this.#r0(this.#r2(1));break;case"Home":case"PageUp":this.#r0(0);break;case"End":case"PageDown":this.#r0(this.#rY.length-1)}}#r2(t){let e=this.#r_;do e=(e+t+this.#rY.length)%this.#rY.length;while(this.#rY[e]?.offsetParent===null);return e}#rJ(){if(!this.#rX)return[];let t=this.#rX.querySelectorAll(i1),e=[],i=t=>"menu"===t.getAttribute("role");for(let s of t)tO(s)&&null!==s.offsetParent&&tD(this.#rX,s,i)&&e.push(s);return e}}var i6=Object.defineProperty,i5=Object.getOwnPropertyDescriptor,i7=(t,e,i,s)=>{for(var a,n=i5(e,i),r=t.length-1;r>=0;r--)(a=t[r])&&(n=a(e,i,n)||n);return n&&i6(e,i,n),n};let i4=0;class i9 extends o.Component{static #e=this.props={showDelay:0};#D;#r3;#r6;#r5;#r7;#aM;#aD;#r4;#r9;#r8;#ht;#he;#hi;#hs;#ha;get triggerElement(){return this.#aM()}get contentElement(){return this.#aD()}get isSubmenu(){return!!this.#r4}constructor(){super(),this.#r5=(0,o.signal)(!1),this.#r7=(0,o.signal)(!1),this.#aM=(0,o.signal)(null),this.#aD=(0,o.signal)(null),this.#r9=new Set,this.#r8=null,this.#hi=!1,this.#hs=(0,o.signal)(!1),this.#ha=new Set,this.#hn=!1,this.#hr=this.#hh.bind(this),this.#ho=!1,this.#hl=this.#hd.bind(this),this.#hu=this.#hc.bind(this),this.#sz=(0,o.animationFrameThrottle)(()=>{let t=(0,o.peek)(this.#aD);if(!t||u)return;let e=0,i=getComputedStyle(t),s=[...t.children];for(let t of["paddingTop","paddingBottom","borderTopWidth","borderBottomWidth"])e+=parseFloat(i[t])||0;for(let t of s)if(tO(t)&&"contents"===t.style.display)s.push(...t.children);else if(3===t.nodeType)e+=parseFloat(getComputedStyle(t).fontSize);else if(tO(t)){if(!tq(t))continue;let i=getComputedStyle(t);e+=t.offsetHeight+(parseFloat(i.marginTop)||0)+(parseFloat(i.marginBottom)||
10)}(0,o.setStyle)(t,"--menu-height",e+"px")}),this.#hp=!1;let{showDelay:t}=this.$props;this.#ht=new io({trigger:this.#aM,content:this.#aD,showDelay:t,listen:(t,e,i)=>{tR(t,t=>{this.#r5()?i(t):e(t)});let s=this.#hm();s&&tR(s,t=>{t.stopPropagation(),i(t)})},onChange:this.#hg.bind(this)})}onSetup(){this.#D=tl();let t=++i4;this.#r3=`media-menu-${t}`,this.#r6=`media-menu-button-${t}`,this.#he=new i3({closeMenu:this.close.bind(this)}),(0,o.hasProvidedContext)(i0)&&(this.#r4=(0,o.useContext)(i0)),this.#hf(),this.setAttributes({"data-open":this.#r5,"data-root":!this.isSubmenu,"data-submenu":this.isSubmenu,"data-disabled":this.#nY.bind(this)}),(0,o.provideContext)(i0,{button:this.#aM,content:this.#aD,expanded:this.#r5,hint:(0,o.signal)(""),submenu:!!this.#r4,disable:this.#hy.bind(this),attachMenuButton:this.#hb.bind(this),attachMenuItems:this.#hv.bind(this),attachObserver:this.#hw.bind(this),disableMenuButton:this.#hk.bind(this),addSubmenu:this.#h$.bind(this),onTransitionEvent:t=>{this.#ha.add(t),(0,o.onDispose)(()=>{this.#ha.delete(t)})}})}onAttach(t){t.style.setProperty("display","contents")}onConnect(t){(0,o.effect)(this.#hT.bind(this)),this.isSubmenu&&this.#r4?.addSubmenu(this)}onDestroy(){this.#aM.set(null),this.#aD.set(null),this.#r8=null,this.#ha.clear()}#hf(){let t=-1,e=(0,o.hasProvidedContext)(iM)?(0,o.useContext)(iM):null;(0,o.provideContext)(iM,{onDragStart:()=>{e?.onDragStart?.(),window.clearTimeout(t),t=-1,this.#hi=!0},onDragEnd:()=>{e?.onDragEnd?.(),t=window.setTimeout(()=>{this.#hi=!1,t=-1},300)}})}#hT(){let t=this.#hx();this.isSubmenu||this.#sz(),this.#hS(t),t&&((0,o.effect)(()=>{let{height:t}=this.#D.$state,e=this.#aD();e&&(0,o.setStyle)(e,"--player-height",t()+"px")}),this.#he.listen(),this.listen("pointerup",this.#hC.bind(this)),(0,o.listenEvent)(window,"pointerup",this.#hP.bind(this)))}#hb(t){let e=t.el,i=this.isSubmenu,s=eQ(this.#nY.bind(this));tE(e,"tabindex",i?"-1":"0"),tE(e,"role",i?"menuitem":"button"),(0,o.setAttribute)(e,"id",this.#r6),(0,o.setAttribute)(e,"aria-haspopup","menu"),(0,o.setAttribute)(e,"aria-expanded","false"),(0,o.setAttribute)(e,"data-root",!this.isSubmenu),(0,o.setAttribute)(e,"data-submenu",this.isSubmenu);let a=()=>{(0,o.setAttribute)(e,"data-open",this.#r5()),(0,o.setAttribute)(e,"aria-disabled",s())};u?a():(0,o.effect)(a),this.#aM.set(e),(0,o.onDispose)(()=>{this.#aM.set(null)})}#hv(t){let e=t.el;e.style.setProperty("display","none"),(0,o.setAttribute)(e,"id",this.#r3),tE(e,"role","menu"),tE(e,"tabindex","-1"),(0,o.setAttribute)(e,"data-root",!this.isSubmenu),(0,o.setAttribute)(e,"data-submenu",this.isSubmenu),this.#aD.set(e),(0,o.onDispose)(()=>this.#aD.set(null));let i=()=>(0,o.setAttribute)(e,"data-open",this.#r5());u?i():(0,o.effect)(i),this.#he.attachMenu(e),this.#hS(!1);let s=this.#hE.bind(this);this.isSubmenu?this.#r4?.onTransitionEvent(s):(t.listen("transitionstart",s),t.listen("transitionend",s),t.listen("animationend",this.#sz),t.listen("vds-menu-resize",this.#sz))}#hw(t){this.#r8=t}#hS(t){let e=(0,o.peek)(this.#aD);e&&(0,o.setAttribute)(e,"aria-hidden",(0,o.ariaBool)(!t))}#hk(t){this.#hs.set(t)}#hn;#hg(t,e){if(this.#hn=(0,o.isKeyboardEvent)(e),e?.stopPropagation(),this.#r5()===t)return;if(this.#nY()){t&&this.#ht.hide(e);return}this.el?.dispatchEvent(new Event("vds-menu-resize",{bubbles:!0,composed:!0}));let i=this.#aM(),s=this.#aD();if(i&&((0,o.setAttribute)(i,"aria-controls",t&&this.#r3),(0,o.setAttribute)(i,"aria-expanded",(0,o.ariaBool)(t))),s&&(0,o.setAttribute)(s,"aria-labelledby",t&&this.#r6),this.#r5.set(t),this.#hA(e),(0,o.tick)(),this.#hn)for(let e of(t?s?.focus():i?.focus(),[this.el,s]))e&&e.setAttribute("data-keyboard","");else for(let t of[this.el,s])t&&t.removeAttribute("data-keyboard");if(this.dispatch(t?"open":"close",{trigger:e}),t)this.isSubmenu||this.#D.activeMenu===this||(this.#D.activeMenu?.close(e),this.#D.activeMenu=this),this.#r8?.onOpen?.(e);else{if(this.isSubmenu)for(let t of this.#r9)t.close(e);else this.#D.activeMenu=null;this.#r8?.onClose?.(e)}t&&requestAnimationFrame(this.#hq.bind(this))}
1#hq(){this.#hp||this.#ho||(this.#he.update(),requestAnimationFrame(()=>{this.#hn?this.#he.focusActive():this.#he.scroll()}))}#hx(){return!this.#nY()&&this.#r5()}#nY(){return this.#r7()||this.#hs()}#hy(t){this.#r7.set(t)}#hC(t){let e=this.#aD();this.#hi||e&&tC(e,t)||t.stopPropagation()}#hP(t){let e=this.#aD();this.#hi||e&&tC(e,t)||this.close(t)}#hm(){let t=this.el?.querySelector('[data-part="close-target"]');return this.el&&t&&tD(this.el,t,t=>"menu"===t.getAttribute("role"))?t:null}#hA(t){this.isSubmenu||(this.#r5()?this.#D.remote.pauseControls(t):this.#D.remote.resumeControls(t))}#h$(t){this.#r9.add(t),new o.EventsController(t).add("open",this.#hl).add("close",this.#hu),(0,o.onDispose)(this.#hr)}#hr;#hh(t){this.#r9.delete(t)}#ho;#hl;#hd(t){this.#ho=!0;let e=this.#aD();for(let e of(this.isSubmenu&&this.triggerElement?.setAttribute("aria-hidden","true"),this.#r9))if(e!==t.target)for(let t of[e.el,e.triggerElement])t?.setAttribute("aria-hidden","true");if(e){let i=t.target.el;for(let t of e.children)t.contains(i)?t.setAttribute("data-open",""):t!==i&&t.setAttribute("data-hidden","")}}#hu;#hc(t){this.#ho=!1;let e=this.#aD();for(let t of(this.isSubmenu&&this.triggerElement?.setAttribute("aria-hidden","false"),this.#r9))for(let e of[t.el,t.triggerElement])e?.setAttribute("aria-hidden","false");if(e)for(let t of e.children)t.removeAttribute("data-open"),t.removeAttribute("data-hidden")}#sz;#hp;#hE(t){let e=this.#aD();for(let i of(e&&"height"===t.propertyName&&(this.#hp="transitionstart"===t.type,(0,o.setAttribute)(e,"data-transition",this.#hp?"height":null),this.#r5()&&this.#hq()),this.#ha))i(t)}open(t){(0,o.peek)(this.#r5)||(this.#ht.show(t),(0,o.tick)())}close(t){(0,o.peek)(this.#r5)&&(this.#ht.hide(t),(0,o.tick)())}}i7([o.prop],i9.prototype,"triggerElement"),i7([o.prop],i9.prototype,"contentElement"),i7([o.prop],i9.prototype,"isSubmenu"),i7([o.method],i9.prototype,"open"),i7([o.method],i9.prototype,"close");class i8 extends o.Component{static #e=this.props={disabled:!1};#hM;#hD;get expanded(){return this.#hM?.expanded()??!1}constructor(){super(),this.#hD=(0,o.signal)(null),new e1}onSetup(){this.#hM=(0,o.useContext)(i0)}onAttach(t){this.#hM.attachMenuButton(this),(0,o.effect)(this.#ny.bind(this)),tE(t,"type","button")}onConnect(t){(0,o.effect)(this.#hR.bind(this)),this.#ao();let e=new MutationObserver(this.#ao.bind(this));e.observe(t,{attributeFilter:["data-part"],childList:!0,subtree:!0}),(0,o.onDispose)(()=>e.disconnect()),tR(t,t=>{this.dispatch("select",{trigger:t})})}#ny(){this.#hM.disableMenuButton(this.$props.disabled())}#hR(){let t=this.#hD();t&&(0,o.effect)(()=>{let e=this.#hM.hint();e&&(t.textContent=e)})}#ao(){let t=this.el?.querySelector('[data-part="hint"]');this.#hD.set(t??null)}}let st=i8.prototype;(0,o.prop)(st,"expanded");class se extends i8{}class si extends o.Component{static #e=this.props={container:null,disabled:!1};#g;#D;onSetup(){this.#D=tl(),(0,o.provideContext)(ss,{attach:this.#hL.bind(this)})}onAttach(t){t.style.setProperty("display","contents")}onConnect(t){}onDestroy(){this.#g?.remove(),this.#g=null}#hL(t){this.#hI(!1),this.#g=t,tI(()=>{tI(()=>{this.connectScope&&(0,o.effect)(this.#ny.bind(this))})})}#ny(){let{fullscreen:t}=this.#D.$state,{disabled:e}=this.$props;this.#hI("fullscreen"===e()?!t():!e())}#hI(t){if(!this.#g)return;let e=this.#hV(this.$props.container());if(!e)return;let i=this.#g.parentElement===e;(0,o.setAttribute)(this.#g,"data-portal",t),t?i||(this.#g.remove(),e.append(this.#g)):i&&this.#g.parentElement===e&&(this.#g.remove(),this.el?.append(this.#g))}#hV(t){return tO(t)?t:t?document.querySelector(t):document.body}constructor(...t){super(...t),this.#g=null}}let ss=(0,o.createContext)();class sa extends o.Component{static #e=this.props={placement:null,offset:0,alignOffset:0};#hM;constructor(){super(),new e1;let{placement:t}=this.$props;this.setAttributes({"data-placement":t})}onAttach(t){if(this.#hM=(0,o.useContext)(i0),this.#hM.attachMenuItems(this),(0,o.hasProvidedContext)(ss)){let e=(0,o.useContext)(ss);e&&((0,o.provideContext)(ss,null),e.attach(t),(0,o.onDispose)(()=>e.attach(null)))}}onConnect(t){(0,o.effect)(this.#aK.bind(this))}#aK(){let{expanded:t}=this.#hM;if(!this.el||!t())return;let e=this.$props.placement();if(!e)return;Object.assign(this.el.style,{position:"absolute",top:0,left:0,width:"max-content"});let{offset:i,alignOffset:s}=this.$props;(0,o.onDispose)(tV(this.el,this.#aU(),e,{offsetVarName:"media-menu",xOffset:s(),yOffset:i()})),(0,o.onDispose)(this.#hO.bind(this))}#hO(){this.el&&(this.el.removeAttribute("style"),this.el.style.display="none")}#aU(){return this.#hM.button()}}let sn=(0,o.createContext)();class sr extends o.ViewController{#hF;#hN;#ih;get values(){return Array.from(this.#hF).map(t=>t.value())}get value(){return this.#hN()}set value(t){this.#C(t)}onSetup(){(0,o.provideContext)(sn,{add:this.#hU.bind(this),remove:this.#hK.bind(this)})}onAttach(t){(0,o.hasProvidedContext)(i0)||tE(t,"role","radiogroup"),this.setAttributes({value:this.#hN})}onDestroy(){this.#hF.clear()}#hU(t){this.#hF.has(t)||(this.#hF.add(t),t.onCheck=this.#hB,t.check(t.value()===this.#hN()))}#hK(t){t.onCheck=null,this.#hF.delete(t)}#hB;#C(t,e){let i=(0,o.peek)(this.#hN);if(!t||t===i)return;let s=this.#hG(i),a=this.#hG(t);s?.check(!1,e),a?.check(!0,e),this.#hN.set(t),this.onValueChange?.(t,e)}#hG(t){for(let e of this.#hF)if(t===(0,o.peek)(e.value))return e;return null}constructor(...t){super(...t),this.#hF=new Set,this.#hN=(0,o.signal)(""),this.#ih=null,this.#hB=this.#C.bind(this)}}class sh extends o.Component{static #e=this.props={value:""};#ih;get values(){return this.#ih.values}get value(){return this.#ih.value}set value(t){this.#ih.value=t}constructor(){super(),this.#ih=new sr,this.#ih.onValueChange=this.#n0.bind(this)}onSetup(){u?this.#ng():(0,o.effect)(this.#ng.bind(this))}#ng(){this.#ih.value=this.$props.value()}#n0(t,e){let i=this.createEvent("change",{detail:t,trigger:e});this.dispatch(i)}}let so=sh.prototype;(0,o.prop)(so,"values"),(0,o.prop)(so,"value");class sl extends o.Component{static #e=this.props={value:""};#hQ;#ih;get checked(){return this.#hQ()}
1constructor(){super(),this.#hQ=(0,o.signal)(!1),this.#ih={value:this.$props.value,check:this.#hW.bind(this),onCheck:null},new e1}onSetup(){this.setAttributes({value:this.$props.value,"data-checked":this.#hQ,"aria-checked":eQ(this.#hQ)})}onAttach(t){let e=(0,o.hasProvidedContext)(i0);tE(t,"tabindex",e?"-1":"0"),tE(t,"role",e?"menuitemradio":"radio"),(0,o.effect)(this.#ng.bind(this))}onConnect(t){this.#hH(),tR(t,this.#a_.bind(this)),(0,o.onDispose)(this.#tq.bind(this))}#tq(){(0,o.scoped)(()=>{(0,o.useContext)(sn).remove(this.#ih)},this.connectScope)}#hH(){(0,o.useContext)(sn).add(this.#ih)}#ng(){let{value:t}=this.$props,e=t();(0,o.peek)(this.#hQ)&&this.#ih.onCheck?.(e)}#a_(t){(0,o.peek)(this.#hQ)||(this.#C(!0,t),this.#hj(t),this.#ih.onCheck?.(o.peek(this.$props.value),t))}#hW(t,e){(0,o.peek)(this.#hQ)!==t&&this.#C(t,e)}#C(t,e){this.#hQ.set(t),this.dispatch("change",{detail:t,trigger:e})}#hj(t){this.dispatch("select",{trigger:t})}}let sd=sl.prototype;(0,o.prop)(sd,"checked");class su extends o.Component{static #e=this.props={disabled:!1,event:void 0,action:void 0};#D;#tz;onSetup(){this.#D=tl();let{event:t,action:e}=this.$props;this.setAttributes({event:t,action:e})}onAttach(t){t.setAttribute("data-media-gesture",""),t.style.setProperty("pointer-events","none")}onConnect(t){this.#tz=this.#D.player.el?.querySelector("[data-media-provider]"),(0,o.effect)(this.#hz.bind(this))}#hz(){let t=this.$props.event(),e=this.$props.disabled();this.#tz&&t&&!e&&(/^dbl/.test(t)&&(t=t.split(/^dbl/)[1]),("pointerup"===t||"pointerdown"===t)&&"coarse"===this.#D.$state.pointer()&&(t="pointerup"===t?"touchend":"touchstart"),(0,o.listenEvent)(this.#tz,t,this.#h_.bind(this),{passive:!1}))}#hX;#hY;#h_(t){if(this.$props.disabled()||(0,o.isPointerEvent)(t)&&(0!==t.button||this.#D.activeMenu)||(0,o.isTouchEvent)(t)&&this.#D.activeMenu||tL(t)||!this.#hJ(t))return;t.MEDIA_GESTURE=!0,t.preventDefault();let e=(0,o.peek)(this.$props.event);if(e?.startsWith("dbl")){if(1===this.#hX){queueMicrotask(()=>this.#hZ(t)),clearTimeout(this.#hY),this.#hX=0;return}}else 0===this.#hX&&setTimeout(()=>{1===this.#hX&&this.#hZ(t)},250);0===this.#hX&&(this.#hY=window.setTimeout(()=>{this.#hX=0},275)),this.#hX++}#hZ(t){this.el.setAttribute("data-triggered",""),requestAnimationFrame(()=>{this.#h0()&&this.#h1((0,o.peek)(this.$props.action),t),requestAnimationFrame(()=>{this.el.removeAttribute("data-triggered")})})}#hJ(t){if(!this.el)return!1;if((0,o.isPointerEvent)(t)||(0,o.isMouseEvent)(t)||(0,o.isTouchEvent)(t)){let e=(0,o.isTouchEvent)(t)?t.changedTouches[0]??t.touches[0]:void 0,i=e?.clientX??t.clientX,s=e?.clientY??t.clientY,a=this.el.getBoundingClientRect(),n=s>=a.top&&s<=a.bottom&&i>=a.left&&i<=a.right;return t.type.includes("leave")?!n:n}return!0}#h0(){return Array.from(this.#D.player.el.querySelectorAll("[data-media-gesture][data-triggered]")).sort((t,e)=>+getComputedStyle(e).zIndex-+getComputedStyle(t).zIndex)[0]===this.el}#h1(t,e){if(!t)return;let i=new o.DOMEvent("will-trigger",{detail:t,cancelable:!0,trigger:e});if(this.dispatchEvent(i),i.defaultPrevented)return;let[s,a]=t.replace(/:([a-z])/,"-$1").split(":");t.includes(":fullscreen")?this.#D.remote.toggleFullscreen("prefer-media",e):t.includes("seek:")?this.#D.remote.seek((0,o.peek)(this.#D.$state.currentTime)+(+a||0),e):this.#D.remote[(0,o.kebabToCamelCase)(s)](e),this.dispatch("trigger",{detail:t,trigger:e})}constructor(...t){super(...t),this.#tz=null,this.#hX=0,this.#hY=-1}}class sc{#x;#h2;#t1;constructor(t){this.priority=10,this.#x=null,this.#h2=t}attach(){}canRender(){return!0}detach(){this.#t1?.abort(),this.#t1=void 0,this.#h2.reset(),this.#x=null}changeTrack(t){t&&this.#x!==t&&(this.#t1?.abort(),this.#t1=new o.EventsController(t),t.readyState<2?(this.#h2.reset(),this.#t1.add("load",()=>this.#h3(t),{once:!0})):this.#h3(t),this.#t1.add("add-cue",t=>{this.#h2.addCue(t.detail)}).add("remove-cue",t=>{this.#h2.removeCue(t.detail)}),this.#x=t)}#h3(t){this.#h2.changeTrack({cues:[...t.cues],regions:[...t.regions]})}}class sp extends o.Component{static #e=this.props={textDir:"ltr",exampleText:"Captions look like this."};#D;static #sL=this.lib=(0,o.signal)(null);onSetup(){this.#D=tl(),this.setAttributes({"aria-hidden":eQ(this.#aJ.b
1ind(this))})}onAttach(t){t.style.setProperty("pointer-events","none")}onConnect(t){sp.lib()||i.e(7276).then(i.bind(i,97276)).then(t=>sp.lib.set(t)),(0,o.effect)(this.#h6.bind(this))}#aJ(){let{textTrack:t,remotePlaybackState:e,iOSControls:i}=this.#D.$state,s=t();return i()||"connected"===e()||!s||!ti(s)}#h6(){if(!sp.lib())return;let{viewType:t}=this.#D.$state;return"audio"===t()?this.#h5():this.#h7()}#h5(){return(0,o.effect)(this.#eJ.bind(this)),this.#h4(null),()=>{this.el.textContent=""}}#eJ(){if(this.#aJ())return;this.#h9();let{textTrack:t}=this.#D.$state;(0,o.listenEvent)(t(),"cue-change",this.#h9.bind(this)),(0,o.effect)(this.#h8.bind(this))}#h9(){this.el.textContent="",this.#ot>=0&&this.#oe();let{realCurrentTime:t,textTrack:e}=this.#D.$state,{renderVTTCueString:i}=sp.lib(),s=(0,o.peek)(t);for(let t of(0,o.peek)(e).activeCues){let e=this.#oi(),a=this.#os();a.innerHTML=i(t,s),e.append(a),this.el.append(a)}}#h8(){let{realCurrentTime:t}=this.#D.$state,{updateTimedVTTCueNodes:e}=sp.lib();e(this.el,t())}#h7(){let{CaptionsRenderer:t}=sp.lib(),e=new t(this.el),i=new sc(e);return this.#D.textRenderers.add(i),(0,o.effect)(this.#oa.bind(this,e)),(0,o.effect)(this.#on.bind(this,e)),this.#h4(e),()=>{this.el.textContent="",this.#D.textRenderers.remove(i),e.destroy()}}#oa(t){t.dir=this.$props.textDir()}#on(t){if(this.#aJ())return;let{realCurrentTime:e,textTrack:i}=this.#D.$state;t.currentTime=e(),this.#ot>=0&&i()?.activeCues[0]&&this.#oe()}#h4(t){let e=this.#D.player;if(!e)return;let i=this.#or.bind(this,t);(0,o.listenEvent)(e,"vds-font-change",i)}#or(t){if(this.#ot>=0){this.#oh();return}let{textTrack:e}=this.#D.$state;e()?.activeCues[0]?t?.update(!0):this.#oo()}#oo(){let t=this.#oi();(0,o.setAttribute)(t,"data-example","");let e=this.#os();(0,o.setAttribute)(e,"data-example",""),e.textContent=this.$props.exampleText(),t?.append(e),this.el?.append(t),this.el?.setAttribute("data-example",""),this.#oh()}#ot;#oh(){window.clearTimeout(this.#ot),this.#ot=window.setTimeout(this.#oe.bind(this),2500)}#oe(){this.el?.removeAttribute("data-example"),this.el?.querySelector("[data-example]")&&(this.el.textContent=""),this.#ot=-1}#oi(){let t=document.createElement("div");return(0,o.setAttribute)(t,"data-part","cue-display"),t}#os(){let t=document.createElement("div");return(0,o.setAttribute)(t,"data-part","cue"),t}constructor(...t){super(...t),this.#ot=-1}}class sm extends o.Component{static #e=this.props={src:null,alt:null,crossOrigin:null};static #sL=this.state=new o.State({img:null,src:null,alt:null,crossOrigin:null,loading:!0,error:null,hidden:!1});#D;onSetup(){this.#D=tl(),this.#nW(),this.#ol(),this.#sg(),this.#nk()}onAttach(t){t.style.setProperty("pointer-events","none"),(0,o.effect)(this.#nF.bind(this)),(0,o.effect)(this.#nW.bind(this)),(0,o.effect)(this.#ol.bind(this)),(0,o.effect)(this.#sg.bind(this)),(0,o.effect)(this.#nk.bind(this));let{started:e}=this.#D.$state;this.setAttributes({"data-visible":()=>!e()&&!this.$state.hidden(),"data-loading":this.#nV.bind(this),"data-error":this.#nO.bind(this),"data-hidden":this.$state.hidden})}onConnect(t){(0,o.effect)(this.#od.bind(this)),(0,o.effect)(this.#ei.bind(this))}#nO(){let{error:t}=this.$state;return!(0,o.isNull)(t())}#od(){let{canLoadPoster:t,poster:e}=this.#D.$state;!t()&&e()&&B(e(),"preconnect")}#nk(){let{src:t}=this.$props,{poster:e,nativeControls:i}=this.#D.$state;this.el&&(0,o.setAttribute)(this.el,"display",i()?"none":null),this.$state.hidden.set(this.#nO()||!(t()||e())||i())}#nV(){let{loading:t,hidden:e}=this.$state;return!e()&&t()}#nF(){let t=this.$state.img();t&&(new o.EventsController(t).add("load",this.#ou.bind(this)).add("error",this.#tA.bind(this)),t.complete&&this.#ou())}#oc;#nW(){let{poster:t}=this.#D.$props,{canLoadPoster:e,providedPoster:i,inferredPoster:s}=this.#D.$state,a=this.$props.src()||"",n=a||t()||s();this.#oc===i()&&i.set(a),this.$state.src.set(e()&&n.length?n:null),this.#oc=a}#ol(){let{src:t}=this.$props,{alt:e}=this.$state,{poster:i}=this.#D.$state;e.set(t()||i()?this.$props.alt():null)}#sg(){let{crossOrigin:t}=this.$props,{crossOrigin:e}=this.$state,{crossOrigin:i,poster:s}=this.#D.$state,a=null!==t()?t():i();e.set(/ytimg\.com|vimeo/.test(s()||"")?null:!0===a?"anonymous":a)}#ei(){let{loading:t,error:e}
1=this.$state,{canLoadPoster:i,poster:s}=this.#D.$state;t.set(i()&&!!s()),e.set(null)}#ou(){let{loading:t,error:e}=this.$state;t.set(!1),e.set(null)}#tA(t){let{loading:e,error:i}=this.$state;e.set(!1),i.set(t)}constructor(...t){super(...t),this.#oc=""}}class sg extends o.Component{static #e=this.props={type:"current",showHours:!1,padHours:null,padMinutes:null,remainder:!1,toggle:!1,hidden:!1};static #sL=this.state=new o.State({timeText:"",hidden:!1});#D;#op;#nc;#np;onSetup(){this.#D=tl(),this.#om();let{type:t}=this.$props;this.setAttributes({"data-type":t,"data-remainder":this.#og.bind(this)}),new iA({callback:this.#nv.bind(this)}).attach(this)}onAttach(t){t.hasAttribute("role")||(0,o.effect)(this.#of.bind(this)),(0,o.effect)(this.#om.bind(this))}onConnect(t){(0,o.onDispose)(tM(t,this.#nc.set)),(0,o.effect)(this.#nk.bind(this)),(0,o.effect)(this.#oy.bind(this))}#nv(t){this.#np.set(t[0].isIntersecting)}#nk(){let{hidden:t}=this.$props;this.$state.hidden.set(t()||!this.#nc()||!this.#np())}#oy(){if(!this.$props.toggle()){this.#op.set(null);return}this.el&&tR(this.el,this.#ob.bind(this))}#om(){let{hidden:t,timeText:e}=this.$state,{duration:i}=this.#D.$state;if(t())return;let{type:s,padHours:a,padMinutes:n,showHours:r}=this.$props,h=this.#ov(s()),o=i(),l=this.#og();if(!Number.isFinite(h+o)){e.set("LIVE");return}let d=eI(l?Math.max(0,o-h):h,{padHrs:a(),padMins:n(),showHrs:r()});e.set((l?"-":"")+d)}#of(){if(!this.el)return;let{toggle:t}=this.$props;(0,o.setAttribute)(this.el,"role",t()?"timer":null),(0,o.setAttribute)(this.el,"tabindex",t()?0:null)}#ov(t){let{bufferedEnd:e,duration:i,currentTime:s}=this.#D.$state;switch(t){case"buffered":return e();case"duration":return i();default:return s()}}#og(){return this.$props.remainder()&&!1!==this.#op()}#ob(t){if(t.preventDefault(),null===this.#op()){this.#op.set(!this.$props.remainder());return}this.#op.set(t=>!t)}constructor(...t){super(...t),this.#op=(0,o.signal)(null),this.#nc=(0,o.signal)(!0),this.#np=(0,o.signal)(!0)}}class sf extends e6{}class sy extends ii{}class sb extends ia{}class sv extends ir{}class sw extends ih{}class sk extends ig{}class s$ extends ik{}class sT extends i${}class sx extends iC{}class sS extends iT{}class sC extends ix{}class sP extends iw{}class sE extends ib{}class sA extends iv{}class sq extends iS{}class sM extends iu{}class sD extends ic{}class sR extends ip{}class sL extends iV{}class sI extends iY{}class sV extends ij{}class sO extends iz{}class sF extends i_{}class sN extends iX{}class sU extends iK{}class sK extends iQ{}class sB extends iB{}class sG extends iH{}class sQ extends iJ{}class sW extends i9{}class sH extends i8{}class sj extends sa{}class sz extends se{}class s_ extends sh{}class sX extends sl{}class sY extends sp{}class sJ extends su{}class sZ extends sm{}class s0 extends iU{}class s1 extends sg{}let s2=h.forwardRef((t,e)=>{let{children:i,...s}=t,a=h.Children.toArray(i),n=a.find(s5);if(n){let t=n.props.children,i=a.map(e=>e!==n?e:h.Children.count(t)>1?h.Children.only(null):h.isValidElement(t)?t.props.children:null);return h.createElement(s3,{...s,ref:e},h.isValidElement(t)?h.cloneElement(t,void 0,i):null)}return h.createElement(s3,{...s,ref:e},i)});s2.displayName="Slot";let s3=h.forwardRef((t,e)=>{let{children:i,...s}=t;return h.isValidElement(i)?h.cloneElement(i,{...function(t,e){let i={...e};for(let s in e){let a=t[s],n=e[s];/^on[A-Z]/.test(s)?a&&n?i[s]=function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];n(...e),a(...e)}:a&&(i[s]=a):"style"===s?i[s]={...a,...n}:"className"===s&&(i[s]=[a,n].filter(Boolean).join(" "))}return{...t,...i}}(s,i.props),ref:e?(0,o.composeRefs)(e,i.ref):i.ref}):h.Children.count(i)>1?h.Children.only(null):null});s3.displayName="SlotClone";let s6=t=>{let{children:e}=t;return h.createElement(h.Fragment,null,e)};function s5(t){return h.isValidElement(t)&&t.type===s6}let s7=["button","div","span","img","video","audio"].reduce((t,e)=>{let i=h.forwardRef((t,i)=>{let{asChild:s,...a}=t,n=s?s2:e;return h.createElement(n,{...a,ref:i})});return i.displayName=`Primitive.${e}`,{...t,[e]:i}},{});
1function s4(t){return t?.$$PROVIDER_TYPE==="REMOTION"}function s9(t){return t?.type==="video/remotion"}let s8=sL.state.record,at=Object.keys(s8).reduce((t,e)=>({...t,[e]:()=>s8[e]}),{});function ae(t,e){let i=(0,o.useStateContext)(iP);return(0,o.useSignal)((e?.current?.$state||i||at)[t])}let ai=sf.state.record,as=Object.keys(ai).reduce((t,e)=>({...t,[e]:()=>ai[e]}),{});function aa(t,e){let i=(0,o.useStateContext)(ts);return(0,o.useSignal)((e?.current?.$state||i||as)[t])}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.