@hanifhan1f/vidstack 1.12.19 → 1.12.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cdn/chunks/vidstack-BBMfnVvt.js +1 -0
- package/cdn/chunks/vidstack-BF7lZRtq.js +3 -0
- package/cdn/chunks/vidstack-BYpysj84.js +1 -0
- package/cdn/chunks/vidstack-BkxGdzTJ.js +16 -0
- package/cdn/chunks/vidstack-Bzk6lVKb.js +1 -0
- package/cdn/chunks/vidstack-C0nMUcD9.js +1 -0
- package/cdn/chunks/vidstack-C1FlyyzK.js +1 -0
- package/cdn/chunks/vidstack-C51SKMUl.js +1 -0
- package/cdn/chunks/vidstack-CL95Hezv.js +1 -0
- package/cdn/chunks/vidstack-Cj0I-Rec.js +1 -0
- package/cdn/chunks/vidstack-CkaxOIJb.js +1 -0
- package/cdn/chunks/vidstack-Cu8FqSS9.js +1 -0
- package/cdn/chunks/vidstack-D84Fzc__.js +16 -0
- package/cdn/chunks/vidstack-DIPX97sJ.js +3 -0
- package/cdn/chunks/vidstack-DQvyz7Mm.js +1 -0
- package/cdn/chunks/vidstack-Dd9fqVv6.js +1 -0
- package/cdn/chunks/vidstack-DdAmWWBJ.js +1 -0
- package/cdn/chunks/vidstack-DhXI_0ND.js +1 -0
- package/cdn/chunks/vidstack-DiXE5sG8.js +1 -0
- package/cdn/chunks/vidstack-pFwe7gvT.js +3 -0
- package/cdn/chunks/vidstack-uMxrPflF.js +1 -0
- package/cdn/chunks/vidstack-zemsqC5d.js +1 -0
- package/cdn/providers/vidstack-audio-BAfEe7CJ.js +1 -0
- package/cdn/providers/vidstack-audio-BOGYlExy.js +1 -0
- package/cdn/providers/vidstack-dash-CGZUJqdT.js +1 -0
- package/cdn/providers/vidstack-dash-D4ZARr66.js +1 -0
- package/cdn/providers/vidstack-google-cast-Drb5Ncs5.js +1 -0
- package/cdn/providers/vidstack-hls-8-552IuX.js +1 -0
- package/cdn/providers/vidstack-hls-CVpa4usG.js +1 -0
- package/cdn/providers/vidstack-html-Bag27bH6.js +1 -0
- package/cdn/providers/vidstack-html-BvVaN2VT.js +1 -0
- package/cdn/providers/vidstack-video-BnwQZKER.js +1 -0
- package/cdn/providers/vidstack-video-DXUiSn4B.js +1 -0
- package/cdn/providers/vidstack-vimeo-DD6HUOtJ.js +1 -0
- package/cdn/providers/vidstack-vimeo-gJmBqtLK.js +1 -0
- package/cdn/providers/vidstack-youtube-BVNE075s.js +1 -0
- package/cdn/providers/vidstack-youtube-Chl_dTAz.js +1 -0
- package/cdn/vidstack.js +1 -1
- package/cdn/with-layouts/chunks/vidstack-2Rlth5Cf.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-4liSokT6.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-B97B8XDc.js +3 -0
- package/cdn/with-layouts/chunks/vidstack-BP3ybDy9.js +912 -0
- package/cdn/with-layouts/chunks/vidstack-BaNApRCP.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-BbFHhcVG.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-BlWKO1g1.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-BxJPOhv7.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-BxdAdQ0H.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-CROJF16Z.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-CXEcXyBI.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-CaW6KGwN.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-Ciq-n5rg.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-CmuGllcj.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-CwzW7rJU.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-CyNByJUW.js +912 -0
- package/cdn/with-layouts/chunks/vidstack-DJyGEdCH.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-DeLOZ-hK.js +3 -0
- package/cdn/with-layouts/chunks/vidstack-DhNpv7SU.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-Dp3Ib32P.js +1 -0
- package/cdn/with-layouts/chunks/vidstack-Dy1Hfo7P.js +3 -0
- package/cdn/with-layouts/providers/vidstack-audio-CwoQJvl2.js +1 -0
- package/cdn/with-layouts/providers/vidstack-audio-cxaZF4jF.js +1 -0
- package/cdn/with-layouts/providers/vidstack-dash-CJsKJfLI.js +1 -0
- package/cdn/with-layouts/providers/vidstack-dash-DX1VjdTW.js +1 -0
- package/cdn/with-layouts/providers/vidstack-google-cast-DYJgNlvD.js +1 -0
- package/cdn/with-layouts/providers/vidstack-hls-2d6-2JAG.js +1 -0
- package/cdn/with-layouts/providers/vidstack-hls-ji26kFdQ.js +1 -0
- package/cdn/with-layouts/providers/vidstack-html-BvHMxtoe.js +1 -0
- package/cdn/with-layouts/providers/vidstack-html-C9nnuK3r.js +1 -0
- package/cdn/with-layouts/providers/vidstack-video-1Uj5cNP2.js +1 -0
- package/cdn/with-layouts/providers/vidstack-video-EWE67g5i.js +1 -0
- package/cdn/with-layouts/providers/vidstack-vimeo-DACTbJaQ.js +1 -0
- package/cdn/with-layouts/providers/vidstack-vimeo-DqFeS0-d.js +1 -0
- package/cdn/with-layouts/providers/vidstack-youtube-RoLp-I6u.js +1 -0
- package/cdn/with-layouts/providers/vidstack-youtube-eivIFfMV.js +1 -0
- package/cdn/with-layouts/vidstack.js +1 -1
- package/dev/chunks/vidstack-0XhA3AD_.js +5181 -0
- package/dev/chunks/vidstack-44ILR0Cb.js +1521 -0
- package/dev/chunks/vidstack-5oWWZmVl.js +58 -0
- package/dev/chunks/vidstack-B4XOm7dP.js +104 -0
- package/dev/chunks/vidstack-BnBLcaA5.js +115 -0
- package/dev/chunks/vidstack-Bo8BNFJ2.js +2986 -0
- package/dev/chunks/vidstack-C3N4zIuV.js +254 -0
- package/dev/chunks/vidstack-CAL4iu_K.js +1482 -0
- package/dev/chunks/vidstack-CEjYxSqZ.js +297 -0
- package/dev/chunks/vidstack-CGyAjz8G.js +58 -0
- package/dev/chunks/vidstack-CJCnHmKE.js +104 -0
- package/dev/chunks/vidstack-CQdFhXSo.js +204 -0
- package/dev/chunks/vidstack-CzCQJ29U.js +107 -0
- package/dev/chunks/vidstack-DD_3HszA.js +1520 -0
- package/dev/chunks/vidstack-DV4g4XvL.js +33 -0
- package/dev/chunks/vidstack-DWtK42Sh.js +1483 -0
- package/dev/chunks/vidstack-D_LvMxPr.js +204 -0
- package/dev/chunks/vidstack-DdTXMZro.js +66 -0
- package/dev/chunks/vidstack-DrczgsqN.js +297 -0
- package/dev/chunks/vidstack-el2dbO0m.js +5181 -0
- package/dev/chunks/vidstack-gF_qqvCK.js +109 -0
- package/dev/chunks/vidstack-rvhuswgi.js +2986 -0
- package/dev/define/plyr-layout.js +7 -7
- package/dev/define/templates/plyr-layout.js +2 -2
- package/dev/define/templates/vidstack-audio-layout.js +3 -3
- package/dev/define/templates/vidstack-video-layout.js +7 -9
- package/dev/define/vidstack-player-default-layout.js +3 -3
- package/dev/define/vidstack-player-layouts.js +3 -3
- package/dev/define/vidstack-player-ui.js +9 -9
- package/dev/define/vidstack-player.js +5 -5
- package/dev/global/plyr.js +9 -9
- package/dev/global/vidstack-player.js +6 -6
- package/dev/providers/vidstack-audio.js +2 -2
- package/dev/providers/vidstack-dash.js +4 -4
- package/dev/providers/vidstack-hls.js +4 -4
- package/dev/providers/vidstack-html.js +1 -1
- package/dev/providers/vidstack-video.js +4 -4
- package/dev/providers/vidstack-vimeo.js +4 -4
- package/dev/providers/vidstack-youtube.js +3 -3
- package/dev/vidstack-elements.js +12 -12
- package/dev/vidstack.js +9 -9
- package/package.json +1 -1
- package/player/styles/default/layouts/video.css +113 -79
- package/prod/chunks/vidstack-BAqdCFIm.js +4771 -0
- package/prod/chunks/vidstack-BRnfTkxi.js +297 -0
- package/prod/chunks/vidstack-BexQYZop.js +2976 -0
- package/prod/chunks/vidstack-Bf1Q6kqO.js +109 -0
- package/prod/chunks/vidstack-Bn9yLryd.js +58 -0
- package/prod/chunks/vidstack-C-yd_bAJ.js +4771 -0
- package/prod/chunks/vidstack-C4PTiuot.js +107 -0
- package/prod/chunks/vidstack-Cs0fH84E.js +1521 -0
- package/prod/chunks/vidstack-DDePVDjt.js +2976 -0
- package/prod/chunks/vidstack-DMDDSV3t.js +104 -0
- package/prod/chunks/vidstack-DXfGRhxZ.js +201 -0
- package/prod/chunks/vidstack-Dg71uhRc.js +58 -0
- package/prod/chunks/vidstack-DlLwMLBL.js +33 -0
- package/prod/chunks/vidstack-DnRxQoqP.js +104 -0
- package/prod/chunks/vidstack-KShKSmYu.js +66 -0
- package/prod/chunks/vidstack-Ko2EJadT.js +1483 -0
- package/prod/chunks/vidstack-ShUhyBfI.js +201 -0
- package/prod/chunks/vidstack-V9U6gsde.js +1482 -0
- package/prod/chunks/vidstack-XA3zT5W9.js +297 -0
- package/prod/chunks/vidstack-kdaDngIm.js +1520 -0
- package/prod/chunks/vidstack-oNEzlviH.js +246 -0
- package/prod/chunks/vidstack-wTTCvdqe.js +115 -0
- package/prod/define/plyr-layout.js +7 -7
- package/prod/define/templates/plyr-layout.js +2 -2
- package/prod/define/templates/vidstack-audio-layout.js +3 -3
- package/prod/define/templates/vidstack-video-layout.js +7 -9
- package/prod/define/vidstack-player-default-layout.js +3 -3
- package/prod/define/vidstack-player-layouts.js +3 -3
- package/prod/define/vidstack-player-ui.js +9 -9
- package/prod/define/vidstack-player.js +5 -5
- package/prod/global/plyr.js +9 -9
- package/prod/global/vidstack-player.js +6 -6
- package/prod/providers/vidstack-audio.js +2 -2
- package/prod/providers/vidstack-dash.js +4 -4
- package/prod/providers/vidstack-hls.js +4 -4
- package/prod/providers/vidstack-html.js +1 -1
- package/prod/providers/vidstack-video.js +4 -4
- package/prod/providers/vidstack-vimeo.js +4 -4
- package/prod/providers/vidstack-youtube.js +3 -3
- package/prod/vidstack-elements.js +12 -12
- package/prod/vidstack.js +9 -9
- package/server/chunks/vidstack-B2Bc9g7_.js +2000 -0
- package/server/chunks/vidstack-BosyhF3p.js +207 -0
- package/server/chunks/vidstack-C8F1EUBn.js +104 -0
- package/server/chunks/vidstack-CWho6PlG.js +141 -0
- package/server/chunks/vidstack-DhF59-Up.js +4635 -0
- package/server/chunks/vidstack-DoHmOxNm.js +295 -0
- package/server/chunks/vidstack-DzWvfg1d.js +1503 -0
- package/server/chunks/vidstack-PnFpou7g.js +3035 -0
- package/server/chunks/vidstack-gEJMQpTE.js +2001 -0
- package/server/define/plyr-layout.js +2 -2
- package/server/define/vidstack-player-default-layout.js +1 -1
- package/server/define/vidstack-player-layouts.js +1 -1
- package/server/define/vidstack-player-ui.js +4 -4
- package/server/define/vidstack-player.js +2 -2
- package/server/global/plyr.js +4 -4
- package/server/global/vidstack-player.js +2 -2
- package/server/vidstack-elements.js +8 -8
- package/server/vidstack.js +4 -4
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{u as M,c as st,V as U,e as h,s as T,E as A,p as u,l as H,i as S,a as Q,b as qe,S as it,f as ot,t as J,d as Rs,D as V,w as Os,o as k,g as qt,h as Le,j as Ns,k as p,m as Lt,n as It,q as Fs,r as Hs,v as B,x as Gs,y as Bs,z as Ks,A as _s,B as Ie,C as Us,F as j,G as ht,H as zt,I as g,J as $,K as q,L as K,M as bt,N as Qs,O as Ws,P as Y,Q as b,R as Ve,T as f,U as lt,W as Vt,X as zs,Y as De,Z as js,_ as Ys,$ as Xs,a0 as G,a1 as Js,a2 as Zs,a3 as yt,a4 as ti,a5 as ei,a6 as si,a7 as Re,a8 as ii}from"./vidstack-D40FSa5B.js";import{I as Oe,c as Ne,a as ai,b as ni,d as ri,e as oi,f as hi,i as li,g as Fe}from"./vidstack-DQvyz7Mm.js";import{T as Dt,g as dt,a as He,u as di}from"./vidstack-CioT3Yw2.js";import{i as R,T as O,a as Rt,w as ci,b as jt,c as ui}from"./vidstack-BF7lZRtq.js";import{L as P}from"./vidstack-C_AxqLKV.js";import{Q as W}from"./vidstack-DRH_1tFW.js";import{c as Yt,a as Z}from"./vidstack-BfBBPhXV.js";import{c as pi,a as Xt,i as mi,b as fi,d as Jt,e as Zt,r as L,g as gi}from"./vidstack-BYpysj84.js";import{p as St,g as Ot}from"./vidstack-uMxrPflF.js";import"https://cdn.vidstack.io/icons";const te=Symbol(0),bi=["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"],Ge=st();function w(){return M(Ge)}function yi(n){return n instanceof HTMLAudioElement}function wi(n){return n instanceof HTMLVideoElement}function Ti(n){return yi(n)||wi(n)}class ct extends U{}const $i={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:"<"},Pt=new Set(["Shift","Alt","Meta","Ctrl"]),vi='button, [role="button"]',Be='input, textarea, select, [contenteditable], [role^="menuitem"], [role="timer"]';class ki extends ct{#t;constructor(t){super(),this.#t=t}onConnect(){h(this.#e.bind(this))}#e(){const{keyDisabled:t,keyTarget:e}=this.$props;if(t())return;const s=e()==="player"?this.el:document,i=T(!1);s===this.el?new A(this.el).add("focusin",()=>i.set(!0)).add("focusout",a=>{this.el.contains(a.target)||i.set(!1)}):(u(i)||i.set(document.querySelector("[data-media-player]")===this.el),H(document,"focusin",a=>{const r=a.composedPath().find(o=>o instanceof Element&&o.localName==="media-player");r!==void 0&&i.set(this.el===r)})),h(()=>{i()&&new A(s).add("keyup",this.#s.bind(this)).add("keydown",this.#i.bind(this)).add("keydown",this.#a.bind(this),{capture:!0})})}#s(t){const e=document.activeElement;if(!t.key||!this.$state.canSeek()||e?.matches(Be))return;let{method:s,value:i}=this.#n(t);if(!S(i)&&!Q(i)){i?.onKeyUp?.({event:t,player:this.#t.player,remote:this.#t.remote}),i?.callback?.(t,this.#t.remote);return}s?.startsWith("seek")&&(t.preventDefault(),t.stopPropagation(),this.#h?(this.#d(t,s==="seekForward"),this.#h=null):(this.#t.remote.seek(this.#r,t),this.#r=void 0)),s?.startsWith("volume")&&this.el.querySelector("[data-media-volume-slider]")?.dispatchEvent(new KeyboardEvent("keyup",{key:s==="volumeUp"?"Up":"Down",shiftKey:t.shiftKey,trigger:t}))}#i(t){if(!t.key||Pt.has(t.key))return;const e=document.activeElement;if(e?.matches(Be)||qe(t)&&e?.matches(vi))return;let{method:s,value:i}=this.#n(t),a=!t.metaKey&&/^[0-9]$/.test(t.key);if(!S(i)&&!Q(i)&&!a){i?.onKeyDown?.({event:t,player:this.#t.player,remote:this.#t.remote}),i?.callback?.(t,this.#t.remote);return}if(!s&&a&&!xi(t)){t.preventDefault(),t.stopPropagation(),this.#t.remote.seek(this.$state.duration()/10*Number(t.key),t);return}if(s){switch(t.preventDefault(),t.stopPropagation(),s){case"seekForward":case"seekBackward":this.#c(t,s,s==="seekForward");break;case"volumeUp":case"volumeDown":const r=this.el.querySelector("[data-media-volume-slider]");if(r)r.dispatchEvent(new KeyboardEvent("keydown",{key:s==="volumeUp"?"Up":"Down",shiftKey:t.shiftKey,trigger:t}));else{const l=t.shiftKey?.1:.05;this.#t.remote.changeVolume(this.$state.volume()+(s==="volumeUp"?+l:-l),t)}break;case"toggleFullscreen":this.#t.remote.toggleFullscreen("prefer-media",t);break;case"speedUp":case"slowDown":const o=this.$state.playbackRate();this.#t.remote.changePlaybackRate(Math.max(.25,Math.min(2,o+(s==="speedUp"?.25:-.25))),t);break;default:this.#t.remote[s]?.(t)}this.$state.lastKeyboardAction.set({action:s,event:t})}}#a(t){Ti(t.target)&&this.#n(t).method&&t.preventDefault()}#n(t){const e={...this.$props.keyShortcuts(),...this.#t.ariaKeys},s=Object.keys(e).find(i=>{const a=e[i],r=Q(a)?a.join(" "):S(a)?a:a?.keys;return(Q(r)?r:r?.split(" "))?.map(l=>Pi(l).replace(/Control/g,"Ctrl").split("+"))?.some(l=>{const d=new Set(l.filter(c=>Pt.has(c)));"<>".includes(t.key)&&d.add("Shift");for(const c of Pt){const m=c.toLowerCase()+"Key";if(!d.has(c)&&t[m])return!1}return l.every(c=>Pt.has(c)?t[c.toLowerCase()+"Key"]:t.key===c.replace("Space"," "))})});return{method:s,value:s?e[s]:null}}#r;#o(t,e){const s=t.shiftKey?10:5;return this.#r=Math.max(0,Math.min((this.#r??this.$state.currentTime())+(e==="seekForward"?+s:-s),this.$state.duration()))}#h=null;#d(t,e){this.#h?.dispatchEvent(new KeyboardEvent(t.type,{key:e?"Right":"Left",shiftKey:t.shiftKey,trigger:t}))}#c(t,e,s){this.$state.canSeek()&&(this.#h||(this.#h=this.el.querySelector("[data-media-time-slider]")),this.#h?this.#d(t,s):this.#t.remote.seeking(this.#o(t,e),t))}}const Si=["!","@","#","$","%","^","&","*","(",")"];function Pi(n){return n.replace(/Shift\+(\d)/g,(t,e)=>Si[e-1])}function xi(n){for(const t of Pt)if(n[t.toLowerCase()+"Key"])return!0;return!1}const Ci={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,viewType:"unknown",streamType:"unknown",volume:1,liveEdgeTolerance:10,minLiveDVRWindow:60,keyDisabled:!1,keyTarget:"player",keyShortcuts:$i,storage:null},Ke=new it({artist:"",artwork:null,audioTrack:null,audioTracks:[],autoPlay:!1,autoPlayError:null,audioGain:null,buffered:new Dt,canLoad:!1,canLoadPoster:!1,canFullscreen:!1,canOrientScreen:Ne(),canPictureInPicture:!1,canPlay:!1,clipStartTime:0,clipEndTime:0,controls:!1,get iOSControls(){return Oe&&this.mediaType==="video"&&(!this.playsInline||!ot.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 Dt,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 Dt,seeking:!1,source:{src:"",type:""},sources:[],started:!1,textTracks:[],textTrack:null,get hasCaptions(){return this.textTracks.filter(R).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 this.providedViewType!=="unknown"?this.providedViewType:this.inferredViewType},get streamType(){return this.providedStreamType!=="unknown"?this.providedStreamType:this.inferredStreamType},get currentSrc(){return this.source},get bufferedStart(){const n=He(this.buffered)??0;return Math.max(n,this.clipStartTime)},get bufferedEnd(){const n=dt(this.buffered)??0;return Math.min(this.seekableEnd,Math.max(0,n-this.clipStartTime))},get bufferedWindow(){return Math.max(0,this.bufferedEnd-this.bufferedStart)},get seekableStart(){if(this.isLiveDVR&&this.liveDVRWindow>0)return Math.max(0,this.seekableEnd-this.liveDVRWindow);const n=He(this.seekable)??0;return Math.max(n,this.clipStartTime)},get seekableEnd(){if(this.providedDuration>0)return this.providedDuration;const n=this.liveSyncPosition>0?this.liveSyncPosition:this.canPlay?dt(this.seekable)??1/0:0;return this.clipEndTime>0?Math.min(this.clipEndTime,n):n},get seekableWindow(){const n=this.seekableEnd-this.seekableStart;return isNaN(n)?1/0:Math.max(0,n)},canAirPlay:!1,canGoogleCast:!1,remotePlaybackState:"disconnected",remotePlaybackType:"none",remotePlaybackLoader:null,remotePlaybackInfo:null,get isAirPlayConnected(){return this.remotePlaybackType==="airplay"&&this.remotePlaybackState==="connected"},get isGoogleCastConnected(){return this.remotePlaybackType==="google-cast"&&this.remotePlaybackState==="connected"},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}),_e=new Set(["autoPlayError","autoPlaying","buffered","canPlay","error","paused","played","playing","seekable","seeking","waiting"]),Ei=new Set([..._e,"ended","inferredPoster","inferredStreamType","inferredTitle","intrinsicDuration","inferredLiveDVRWindow","liveSyncPosition","realCurrentTime","savedState","started","userBehindLiveEdge"]);function Ue(n,t=!1){const e=t?_e:Ei;Ke.reset(n,s=>e.has(s)),J()}function Qe(n,t){const e=n+t.clipStartTime(),s=Math.floor(n)===Math.floor(t.seekableStart()),i=Math.floor(e)===Math.floor(t.seekableEnd());return s?t.seekableStart():i?t.seekableEnd():t.isLiveDVR()&&t.liveDVRWindow()>0&&e<t.seekableEnd()-t.liveDVRWindow()?t.bufferedStart():Math.min(Math.max(t.seekableStart()+.1,e),t.seekableEnd()-.1)}class We extends Rs{items=[];[P.readonly]=!1;get length(){return this.items.length}get readonly(){return this[P.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()}[P.add](t,e){const s=this.items.length;""+s in this||Object.defineProperty(this,s,{get(){return this.items[s]}}),!this.items.includes(t)&&(this.items.push(t),this.dispatchEvent(new V("add",{detail:t,trigger:e})))}[P.remove](t,e){const s=this.items.indexOf(t);s>=0&&(this[P.onRemove]?.(t,e),this.items.splice(s,1),this.dispatchEvent(new V("remove",{detail:t,trigger:e})))}[P.reset](t){for(const e of[...this.items])this[P.remove](e,t);this.items=[],this[P.setReadonly](!1,t),this[P.onReset]?.()}[P.setReadonly](t,e){this[P.readonly]!==t&&(this[P.readonly]=t,this.dispatchEvent(new V("readonly-change",{detail:t,trigger:e})))}}const xt=Symbol(0);class ze extends We{get selected(){return this.items.find(t=>t.selected)??null}get selectedIndex(){return this.items.findIndex(t=>t.selected)}[P.onRemove](t,e){this[P.select](t,!1,e)}[P.add](t,e){t[xt]=!1,Object.defineProperty(t,"selected",{get(){return this[xt]},set:s=>{this.readonly||(this[P.onUserSelect]?.(),this[P.select](t,s))}}),super[P.add](t,e)}[P.select](t,e,s){if(e===t?.[xt])return;const i=this.selected;t&&(t[xt]=e),(e?i!==t:i===t)&&(i&&(i[xt]=!1),this.dispatchEvent(new V("change",{detail:{prev:i,current:this.selected},trigger:s})))}}class Ai extends ze{#t=!1;switch="current";get auto(){return this.#t||this.readonly}[W.enableAuto];[P.onUserSelect](){this[W.setAuto](!1)}[P.onReset](t){this[W.enableAuto]=void 0,this[W.setAuto](!1,t)}autoSelect(t){this.readonly||this.#t||!this[W.enableAuto]||(this[W.enableAuto]?.(t),this[W.setAuto](!0,t))}getBySrc(t){return this.items.find(e=>e.src===t)}[W.setAuto](t,e){this.#t!==t&&(this.#t=t,this.dispatchEvent(new V("auto-change",{detail:t,trigger:e})))}}class je extends ct{#t;#e;constructor(t,e){super(),this.#t=t,this.#e=e}async onAttach(t){const e=this.$props[this.#t]();if(e==="eager")requestAnimationFrame(this.#e);else if(e==="idle")Os(this.#e);else if(e==="visible"){let s,i=new IntersectionObserver(a=>{this.scope&&a[0].isIntersecting&&(s?.(),s=void 0,this.#e())});i.observe(t),s=k(()=>i.disconnect())}}}class Mi{#t;#e;constructor(t,e){this.#t=t,this.#e=e}notify(t,...e){this.#t(new V(t,{detail:e?.[0],trigger:e?.[1]}))}async ready(t,e){return qt(async()=>{const{logger:s}=this.#e,{autoPlay:i,canPlay:a,started:r,duration:o,seekable:l,buffered:d,remotePlaybackInfo:c,playsInline:m,savedState:y,source:v}=this.#e.$state;if(a())return;const E={duration:t?.duration??o(),seekable:t?.seekable??l(),buffered:t?.buffered??d(),provider:this.#e.$provider()};this.notify("can-play",E,e),J();let F=this.#e.$provider(),{storage:X,qualities:xe}=this.#e,{muted:Ms,volume:qs,clipStartTime:Ls,playbackRate:Is}=this.#e.$props;await X?.onLoad?.(v());const Vs=y()?.currentTime,Ce=y()?.paused,Wt=await X?.getTime(),Ee=Vs??Wt??Ls(),Ds=Ce===!1||Ce!==!0&&!r()&&i();if(F){F.setVolume(await X?.getVolume()??qs()),F.setMuted(Ms()||!!await X?.getMuted());const gt=await X?.getAudioGain()??1;gt>1&&F.audioGain?.setGain?.(gt),F.setPlaybackRate?.(await X?.getPlaybackRate()??Is()),F.setPlaysInline?.(m()),Ee>0&&F.setCurrentTime(Ee)}const kt=await X?.getVideoQuality();if(kt&&xe.length){let gt=null,Ae=1/0;for(const Mt of xe){const Me=Math.abs(kt.width-Mt.width)+Math.abs(kt.height-Mt.height)+(kt.bitrate?Math.abs(kt.bitrate-(Mt.bitrate??0)):0);Me<Ae&&(gt=Mt,Ae=Me)}gt&&(gt.selected=!0)}a()&&Ds?await this.#s(e):Wt&&Wt>0&&this.notify("started",void 0,e),c.set(null)})}async#s(t){const{player:e,$state:{autoPlaying:s,muted:i}}=this.#e;s.set(!0);const a=new V("auto-play-attempt",{trigger:t});try{await e.play(a)}catch{}}}const ee=ot.fullscreenEnabled;class qi extends U{#t=!1;#e=!1;get active(){return this.#e}get supported(){return ee}onConnect(){new A(ot).add("fullscreenchange",this.#i.bind(this)).add("fullscreenerror",this.#a.bind(this)),k(this.#s.bind(this))}async#s(){ee&&await this.exit()}#i(t){const e=se(this.el);e!==this.#e&&(e||(this.#t=!1),this.#e=e,this.dispatch("fullscreen-change",{detail:e,trigger:t}))}#a(t){this.#t&&(this.dispatch("fullscreen-error",{detail:null,trigger:t}),this.#t=!1)}async enter(){try{return this.#t=!0,!this.el||se(this.el)?void 0:(Ye(),ot.requestFullscreen(this.el))}catch(t){throw this.#t=!1,t}}async exit(){if(!(!this.el||!se(this.el)))return Ye(),ot.exitFullscreen()}}function se(n){if(ot.fullscreenElement===n)return!0;try{return n.matches(ot.fullscreenPseudoClass)}catch{return!1}}function Ye(){if(!ee)throw Error("[vidstack] no fullscreen API")}class Qt extends U{#t=T(this.#r());#e=T(!1);#s;get type(){return this.#t()}get locked(){return this.#e()}get portrait(){return this.#t().startsWith("portrait")}get landscape(){return this.#t().startsWith("landscape")}static supported=Ne();get supported(){return Qt.supported}onConnect(){if(this.supported)H(screen.orientation,"change",this.#a.bind(this));else{const t=window.matchMedia("(orientation: landscape)");t.onchange=this.#a.bind(this),k(()=>t.onchange=null)}k(this.#i.bind(this))}async#i(){this.supported&&this.#e()&&await this.unlock()}#a(t){this.#t.set(this.#r()),this.dispatch("orientation-change",{detail:{orientation:u(this.#t),lock:this.#s},trigger:t})}async lock(t){u(this.#e)||this.#s===t||(this.#n(),await screen.orientation.lock(t),this.#e.set(!0),this.#s=t)}async unlock(){u(this.#e)&&(this.#n(),this.#s=void 0,await screen.orientation.unlock(),this.#e.set(!1))}#n(){if(!this.supported)throw Error("[vidstack] no orientation API")}#r(){return this.supported?window.screen.orientation.type:window.innerWidth>=window.innerHeight?"landscape-primary":"portrait-primary"}}class Li{#t=new Map;enqueue(t,e){this.#t.set(t,e)}serve(t){const e=this.peek(t);return this.#t.delete(t),e}peek(t){return this.#t.get(t)}delete(t){this.#t.delete(t)}clear(){this.#t.clear()}}class Xe{#t=!1;#e=Le();#s=new Map;get size(){return this.#s.size}get isServing(){return this.#t}async waitForFlush(){this.#t||await this.#e.promise}enqueue(t,e){if(this.#t){e();return}this.#s.delete(t),this.#s.set(t,e)}serve(t){this.#s.get(t)?.(),this.#s.delete(t)}start(){this.#i(),this.#t=!0,this.#s.size>0&&this.#i()}stop(){this.#t=!1}reset(){this.stop(),this.#s.clear(),this.#a()}#i(){for(const t of this.#s.keys())this.serve(t);this.#a()}#a(){this.#e.resolve(),this.#e=Le()}}function Ii(n){return n?"true":"false"}function D(n){return()=>Ii(n())}function Vi(){return typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function Je(n,t){const e=t.composedPath()[0];return Hs(e)&&n.contains(e)}const ie=new Set;{let n=function(){for(const t of ie)try{t()}catch{}window.requestAnimationFrame(n)};n()}function Di(n){return ie.add(n),()=>ie.delete(n)}function x(n,t,e){n.hasAttribute(t)||n.setAttribute(t,e)}function at(n,t){if(n.hasAttribute("aria-label")||n.hasAttribute("data-no-label"))return;if(!Ns(t)){p(n,"aria-label",t);return}function e(){p(n,"aria-label",t())}h(e)}function Ze(n){const t=getComputedStyle(n);return t.display!=="none"&&parseInt(t.opacity)>0}function Ri(n){return!!n&&("checkVisibility"in n?n.checkVisibility({checkOpacity:!0,checkVisibilityCSS:!0}):Ze(n))}function ts(n,t){return Di(()=>t(Ri(n)))}function es(n,t,e){for(;t;){if(t===n)return!0;if(e?.(t))break;t=t.parentElement}return!1}function nt(n,t){return new A(n).add("pointerup",e=>{e.button===0&&!e.defaultPrevented&&t(e)}).add("keydown",e=>{qe(e)&&t(e)})}function ae(n){return Lt(n)&&(n.touches.length>1||n.changedTouches.length>1)}function tt(n){let t=Fs(),e=window.requestAnimationFrame(()=>{It(n,t),e=-1});return()=>void window.cancelAnimationFrame(e)}function ne(n,t,e){let s,i=n,a=n.parentElement,r=n.content.firstElementChild,o=[];!r&&n.firstElementChild&&(n.innerHTML=n.firstElementChild.outerHTML,n.firstElementChild.remove(),r=n.content.firstElementChild);for(let l=0;l<t;l++)s=document.importNode(r,!0),e?.(s,l),a.insertBefore(s,i.nextSibling),o.push(s),i=s;return k(()=>{for(let l=0;l<o.length;l++)o[l].remove()}),o}function re(n){const t=document.createElement("template");return t.innerHTML=n,t.content}function oe(n){return n.cloneNode(!0).firstElementChild}function ss(n,t,e,{offsetVarName:s,xOffset:i,yOffset:a,...r}){if(!n)return;const o=e.replace(" ","-").replace("-center","");if(B(n,"visibility",t?null:"hidden"),!t)return;let l=e.includes("top");const d=m=>e.includes("left")?`calc(-1 * ${m})`:m,c=m=>l?`calc(-1 * ${m})`:m;return Gs(t,n,()=>{Bs(t,n,{placement:o,middleware:[...r.middleware??[],Ks({fallbackAxisSideDirection:"start",crossAxis:!1}),_s()],...r}).then(({x:m,y,middlewareData:v})=>{const E=!!v.flip?.index;l=e.includes(E?"bottom":"top"),n.setAttribute("data-placement",E?e.startsWith("top")?e.replace("top","bottom"):e.replace("bottom","top"):e),Object.assign(n.style,{top:`calc(${y+"px"} + ${c(a?a+"px":`var(--${s}-y-offset, 0px)`)})`,left:`calc(${m+"px"} + ${d(i?i+"px":`var(--${s}-x-offset, 0px)`)})`})})})}function Oi(n){return getComputedStyle(n).animationName!=="none"}function ut(n){return n instanceof HTMLElement}class Ni extends ct{#t=-2;#e=!1;#s=T(!1);#i=T(!1);#a=null;#n=T(!0);defaultDelay=2e3;get canIdle(){return this.#n()}set canIdle(t){this.#n.set(t)}get hideOnMouseLeave(){const{hideControlsOnMouseLeave:t}=this.$props;return this.#s()||t()}set hideOnMouseLeave(t){this.#s.set(t)}get showing(){return this.$state.controlsVisible()}show(t=0,e){this.#m(),this.#e||this.#g(!0,t,e)}hide(t=this.defaultDelay,e){this.#m(),this.#e||this.#g(!1,t,e)}pause(t){this.#e=!0,this.#m(),this.#g(!0,0,t)}resume(t){this.#e=!1,!this.$state.paused()&&this.#g(!1,this.defaultDelay,t)}onConnect(){h(this.#r.bind(this))}#r(){const{viewType:t}=this.$state;if(!this.el||!this.#n())return;if(t()==="audio"){this.show();return}h(this.#o.bind(this)),h(this.#h.bind(this));const e=this.#d.bind(this),s=this.#c.bind(this),i=this.#u.bind(this);new A(this.el).add("can-play",a=>this.show(0,a)).add("play",e).add("pause",s).add("end",i).add("auto-play-fail",s)}#o(){if(!this.el)return;const{started:t,pointer:e,paused:s}=this.$state;if(!t()||e()!=="fine")return;const i=new A(this.el),a=this.hideOnMouseLeave;(!a||!this.#i())&&h(()=>{s()||i.add("pointermove",this.#b.bind(this))}),a&&i.add("mouseenter",this.#l.bind(this)).add("mouseleave",this.#p.bind(this))}#h(){const{paused:t,started:e,autoPlayError:s}=this.$state;if(t()||s()&&!e())return;const i=this.#b.bind(this);h(()=>{if(!this.el)return;const a=this.$state.pointer(),r=a==="coarse",o=new A(this.el),l=[r?"touchend":"pointerup","keydown"];for(const d of l)o.add(d,i,{passive:!1})})}#d(t){t.triggers.hasType("ended")||(this.show(0,t),this.hide(void 0,t))}#c(t){this.show(0,t)}#u(t){const{loop:e}=this.$state;e()&&this.hide(0,t)}#l(t){this.#i.set(!1),this.show(0,t),this.hide(void 0,t)}#p(t){this.#i.set(!0),this.hide(0,t)}#m(){window.clearTimeout(this.#t),this.#t=-1}#b(t){t.MEDIA_GESTURE||this.#e||ae(t)||(Ie(t)&&(t.key==="Escape"?(this.el?.focus(),this.#a=null):this.#a&&(t.preventDefault(),requestAnimationFrame(()=>{this.#a?.focus(),this.#a=null}))),this.show(0,t),this.hide(this.defaultDelay,t))}#g(t,e,s){if(e===0){this.#y(t,s);return}this.#t=window.setTimeout(()=>{this.scope&&this.#y(t&&!this.#e,s)},e)}#y(t,e){this.$state.controlsVisible()!==t&&(this.$state.controlsVisible.set(t),!t&&document.activeElement&&this.el?.contains(document.activeElement)&&(this.#a=document.activeElement,requestAnimationFrame(()=>{this.el?.focus({preventScroll:!0})})),this.dispatch("controls-change",{detail:t,trigger:e}))}}class Fi extends ct{#t;#e;#s;controls;#i;#a;#n;#r=new Xe;constructor(t,e,s){super(),this.#t=t,this.#e=e,this.#s=s,this.#n=s.$provider,this.controls=new Ni,this.#i=new qi,this.#a=new Qt}onAttach(){this.listen("fullscreen-change",this.#P.bind(this))}onConnect(t){const e=Object.getOwnPropertyNames(Object.getPrototypeOf(this)),s=new A(t),i=this.#d.bind(this);for(const a of e)a.startsWith("media-")&&s.add(a,i);this.#o(),h(this.#h.bind(this)),h(this.#m.bind(this)),h(this.#b.bind(this)),h(this.#g.bind(this)),h(this.#y.bind(this)),h(this.#T.bind(this)),h(this.#$.bind(this))}onDestroy(){try{const t=this.createEvent("destroy"),{pictureInPicture:e,fullscreen:s}=this.$state;s()&&this.exitFullscreen("prefer-media",t),e()&&this.exitPictureInPicture(t)}catch{}this.#r.reset()}#o(){const{load:t}=this.$props,{canLoad:e}=this.$state;if(t()!=="play"||e())return;const s=this.listen("media-play-request",i=>{this.#c(i),s()})}#h(){const t=this.#n(),e=this.$state.canPlay();return t&&e&&this.#r.start(),()=>{this.#r.stop()}}#d(t){t.stopPropagation(),!t.defaultPrevented&&this[t.type]&&(u(this.#n)?this[t.type](t):this.#r.enqueue(t.type,()=>{u(this.#n)&&this[t.type](t)}))}async play(t){const{canPlay:e,paused:s,autoPlaying:i}=this.$state;if(this.#c(t)||!u(s))return;t&&this.#e.queue.enqueue("media-play-request",t);const a=u(i);try{const r=u(this.#n);return he(r,u(e)),Hi(a),await r.play()}catch(r){const o=this.createEvent("play-fail",{detail:Yt(r),trigger:t});throw o.autoPlay=a,this.#t.handle(o),r}}#c(t){const{load:e}=this.$props,{canLoad:s}=this.$state;if(e()==="play"&&!s()){const i=this.createEvent("media-start-loading",{trigger:t});return this.dispatchEvent(i),this.#r.enqueue("media-play-request",async()=>{try{await this.play(i)}catch{}}),!0}return!1}async pause(t){const{canPlay:e,paused:s}=this.$state;if(!u(s)){t&&this.#e.queue.enqueue("media-pause-request",t);try{const i=u(this.#n);return he(i,u(e)),await i.pause()}catch(i){throw this.#e.queue.delete("media-pause-request"),i}}}setAudioGain(t,e){const{audioGain:s,canSetAudioGain:i}=this.$state;if(s()===t)return;const a=this.#n();if(!a?.audioGain||!i())throw Error("[vidstack] audio gain api not available");e&&this.#e.queue.enqueue("media-audio-gain-change-request",e),a.audioGain.setGain(t)}seekToLiveEdge(t){const{canPlay:e,live:s,liveEdge:i,canSeek:a,liveSyncPosition:r,seekableEnd:o,userBehindLiveEdge:l}=this.$state;if(l.set(!1),u(()=>!s()||i()||!a()))return;const d=u(this.#n);he(d,u(e)),t&&this.#e.queue.enqueue("media-seek-request",t);const c=o()-2;d.setCurrentTime(Math.min(c,r()??c))}#u=!1;async enterFullscreen(t="prefer-media",e){const s=this.#l(t);if(is(t,s),!s.active)return u(this.$state.pictureInPicture)&&(this.#u=!0,await this.exitPictureInPicture(e)),e&&this.#e.queue.enqueue("media-enter-fullscreen-request",e),s.enter()}async exitFullscreen(t="prefer-media",e){const s=this.#l(t);if(is(t,s),!!s.active){e&&this.#e.queue.enqueue("media-exit-fullscreen-request",e);try{const i=await s.exit();return this.#u&&u(this.$state.canPictureInPicture)&&await this.enterPictureInPicture(),i}finally{this.#u=!1}}}#l(t){const e=u(this.#n);return t==="prefer-media"&&this.#i.supported||t==="media"?this.#i:e?.fullscreen}async enterPictureInPicture(t){if(this.#p(),!this.$state.pictureInPicture())return t&&this.#e.queue.enqueue("media-enter-pip-request",t),await this.#n().pictureInPicture.enter()}async exitPictureInPicture(t){if(this.#p(),!!this.$state.pictureInPicture()){t&&this.#e.queue.enqueue("media-exit-pip-request",t);try{if(document?.pictureInPictureElement&&document.exitPictureInPicture){await document.exitPictureInPicture();return}const e=this.#n();if(e?.pictureInPicture){await e.pictureInPicture.exit();return}const s=document?.querySelectorAll?.("video")||[];for(const i of s){if(i===document.pictureInPictureElement&&document.exitPictureInPicture){await document.exitPictureInPicture();return}if(i.webkitPresentationMode==="picture-in-picture"){i.webkitSetPresentationMode("inline");return}}}catch{}}}#p(){if(!this.$state.canPictureInPicture())throw Error("[vidstack] no pip support")}#m(){this.controls.defaultDelay=this.$props.controlsDelay()}#b(){const{canSetAudioGain:t}=this.$state,e=!!this.#n()?.audioGain?.supported;t.set(e)}#g(){const{canAirPlay:t}=this.$state,e=!!this.#n()?.airPlay?.supported;t.set(e)}#y(){const{canGoogleCast:t,source:e}=this.$state,s=ai&&!ni&&pi(e());t.set(s)}#T(){const{canFullscreen:t}=this.$state,e=this.#i.supported||!!this.#n()?.fullscreen?.supported;t.set(e)}#$(){const{canPictureInPicture:t}=this.$state,e=!!this.#n()?.pictureInPicture?.supported;t.set(e)}async"media-airplay-request"(t){try{await this.requestAirPlay(t)}catch{}}async requestAirPlay(t){try{const e=this.#n()?.airPlay;if(!e?.supported)throw Error("No AirPlay adapter.");return t&&this.#e.queue.enqueue("media-airplay-request",t),await e.prompt()}catch(e){throw this.#e.queue.delete("media-airplay-request"),e}}async"media-google-cast-request"(t){try{await this.requestGoogleCast(t)}catch{}}#w;async requestGoogleCast(t){try{const{canGoogleCast:e}=this.$state;if(!u(e)){const i=Error("Cast not available.");throw i.code="CAST_NOT_AVAILABLE",i}if(St("https://www.gstatic.com"),!this.#w){const i=await import("./vidstack-Dd9fqVv6.js");this.#w=new i.GoogleCastLoader}await this.#w.prompt(this.#s),t&&this.#e.queue.enqueue("media-google-cast-request",t);const s=u(this.$state.remotePlaybackState)!=="disconnected";s&&this.$state.savedState.set({paused:u(this.$state.paused),currentTime:u(this.$state.currentTime)}),this.$state.remotePlaybackLoader.set(s?this.#w:null)}catch(e){throw this.#e.queue.delete("media-google-cast-request"),e}}"media-clip-start-change-request"(t){const{clipStartTime:e}=this.$state;e.set(t.detail)}"media-clip-end-change-request"(t){const{clipEndTime:e}=this.$state;e.set(t.detail),this.dispatch("duration-change",{detail:t.detail,trigger:t})}"media-duration-change-request"(t){const{providedDuration:e,clipEndTime:s}=this.$state;e.set(t.detail),s()<=0&&this.dispatch("duration-change",{detail:t.detail,trigger:t})}"media-audio-track-change-request"(t){const{logger:e,audioTracks:s}=this.#s;if(s.readonly)return;const i=t.detail,a=s[i];if(a){const r=t.type;this.#e.queue.enqueue(r,t),a.selected=!0}}async"media-enter-fullscreen-request"(t){try{await this.enterFullscreen(t.detail,t)}catch(e){this.#f(e,t)}}async"media-exit-fullscreen-request"(t){try{await this.exitFullscreen(t.detail,t)}catch(e){this.#f(e,t)}}async#P(t){const e=u(this.$props.fullscreenOrientation),s=t.detail;if(!(Us(e)||e==="none"||!this.#a.supported))if(s){if(this.#a.locked)return;this.dispatch("media-orientation-lock-request",{detail:e,trigger:t})}else this.#a.locked&&this.dispatch("media-orientation-unlock-request",{trigger:t})}#f(t,e){this.#t.handle(this.createEvent("fullscreen-error",{detail:Yt(t)}))}async"media-orientation-lock-request"(t){const e=t.type;try{this.#e.queue.enqueue(e,t),await this.#a.lock(t.detail)}catch{this.#e.queue.delete(e)}}async"media-orientation-unlock-request"(t){const e=t.type;try{this.#e.queue.enqueue(e,t),await this.#a.unlock()}catch{this.#e.queue.delete(e)}}async"media-enter-pip-request"(t){try{await this.enterPictureInPicture(t)}catch(e){this.#v(e,t)}}async"media-exit-pip-request"(t){try{await this.exitPictureInPicture(t)}catch(e){this.#v(e,t)}}#v(t,e){this.#t.handle(this.createEvent("picture-in-picture-error",{detail:Yt(t)}))}"media-live-edge-request"(t){const{live:e,liveEdge:s,canSeek:i}=this.$state;if(!(!e()||s()||!i())){this.#e.queue.enqueue("media-seek-request",t);try{this.seekToLiveEdge()}catch{this.#e.queue.delete("media-seek-request")}}}async"media-loop-request"(t){try{this.#e.looping=!0,this.#e.replaying=!0,await this.play(t)}catch{this.#e.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{}}async"media-play-request"(t){if(this.$state.paused())try{await this.play(t)}catch{}}"media-rate-change-request"(t){const{playbackRate:e,canSetPlaybackRate:s}=this.$state;if(e()===t.detail||!s())return;const i=this.#n();i?.setPlaybackRate&&(this.#e.queue.enqueue("media-rate-change-request",t),i.setPlaybackRate(t.detail))}"media-audio-gain-change-request"(t){try{this.setAudioGain(t.detail,t)}catch{}}"media-quality-change-request"(t){const{qualities:e,storage:s,logger:i}=this.#s;if(e.readonly)return;this.#e.queue.enqueue("media-quality-change-request",t);const a=t.detail;if(a<0)e.autoSelect(t),t.isOriginTrusted&&s?.setVideoQuality?.(null);else{const r=e[a];r&&(r.selected=!0,t.isOriginTrusted&&s?.setVideoQuality?.({id:r.id,width:r.width,height:r.height,bitrate:r.bitrate}))}}"media-pause-controls-request"(t){const e=t.type;this.#e.queue.enqueue(e,t),this.controls.pause(t)}"media-resume-controls-request"(t){const e=t.type;this.#e.queue.enqueue(e,t),this.controls.resume(t)}"media-seek-request"(t){const{canSeek:e,ended:s,live:i,seekableEnd:a,userBehindLiveEdge:r}=this.$state,o=t.detail;s()&&(this.#e.replaying=!0);const l=t.type;this.#e.seeking=!1,this.#e.queue.delete(l);const d=Qe(o,this.$state);!Number.isFinite(d)||!e()||(this.#e.queue.enqueue(l,t),this.#n().setCurrentTime(d),i()&&t.isOriginTrusted&&Math.abs(a()-d)>=2&&r.set(!0))}"media-seeking-request"(t){const e=t.type;this.#e.queue.enqueue(e,t),this.$state.seeking.set(!0),this.#e.seeking=!0}"media-start-loading"(t){if(this.$state.canLoad())return;const e=t.type;this.#e.queue.enqueue(e,t),this.#t.handle(this.createEvent("can-load"))}"media-poster-start-loading"(t){if(this.$state.canLoadPoster())return;const e=t.type;this.#e.queue.enqueue(e,t),this.#t.handle(this.createEvent("can-load-poster"))}"media-text-track-change-request"(t){const{index:e,mode:s}=t.detail,i=this.#s.textTracks[e];if(i){const a=t.type;this.#e.queue.enqueue(a,t),i.setMode(s,t)}}"media-mute-request"(t){if(this.$state.muted())return;const e=t.type;this.#e.queue.enqueue(e,t),this.#n().setMuted(!0)}"media-unmute-request"(t){const{muted:e,volume:s}=this.$state;if(!e())return;const i=t.type;this.#e.queue.enqueue(i,t),this.#s.$provider().setMuted(!1),s()===0&&(this.#e.queue.enqueue(i,t),this.#n().setVolume(.25))}"media-volume-change-request"(t){const{muted:e,volume:s}=this.$state,i=t.detail;if(s()===i)return;const a=t.type;this.#e.queue.enqueue(a,t),this.#n().setVolume(i),i>0&&e()&&(this.#e.queue.enqueue(a,t),this.#n().setMuted(!1))}#k(t,e,s){}}function he(n,t){if(!(n&&t))throw Error("[vidstack] media not ready")}function is(n,t){if(!t?.supported)throw Error("[vidstack] no fullscreen support")}function Hi(n){if(!(!Vi()||!n))throw Error("[vidstack] autoplay blocked")}class Gi{seeking=!1;looping=!1;replaying=!1;queue=new Li}function le(n){return!S(n)&&"width"in n&&"height"in n&&j(n.width)&&j(n.height)}const Bi=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 Ki extends ct{#t;#e;#s=new Map;#i=!1;#a=[];#n=[-1,-1];#r=!1;#o;constructor(t,e){super(),this.#t=t,this.#e=e}onAttach(t){t.setAttribute("aria-busy","true"),new A(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){h(this.#E.bind(this)),this.#p(),this.#m(),this.#b(),this.#d(),k(this.#c.bind(this))}onDestroy(){const{audioTracks:t,qualities:e,textTracks:s}=this.#e;t[P.reset](),e[P.reset](),s[P.reset](),this.#S()}handle(t){if(!this.scope)return;const e=t.type;qt(()=>this[t.type]?.(t)),Bi.has(e)&&this.#s.set(e,t),this.dispatch(t)}#h=!1;#d(){this.#h&&(requestAnimationFrame(()=>{this.scope&&this.#e.remote.play(new V("dom-connect"))}),this.#h=!1)}#c(){this.#h||(this.#h=!this.$state.paused(),this.#e.$provider()?.pause())}#u(){this.#D(),this.#i=!1,this.#t.replaying=!1,this.#t.looping=!1,this.#r=!1,this.#o=void 0,this.#s.clear()}#l(t,e){const s=this.#t.queue.serve(t);s&&(e.request=s,e.triggers.add(s))}#p(){this.#g(),this.#y();const t=this.#e.textTracks;new A(t).add("add",this.#g.bind(this)).add("remove",this.#g.bind(this)).add("mode-change",this.#y.bind(this))}#m(){const t=this.#e.qualities;new A(t).add("add",this.#w.bind(this)).add("remove",this.#w.bind(this)).add("change",this.#P.bind(this)).add("auto-change",this.#f.bind(this)).add("readonly-change",this.#x.bind(this))}#b(){const t=this.#e.audioTracks;new A(t).add("add",this.#T.bind(this)).add("remove",this.#T.bind(this)).add("change",this.#$.bind(this))}#g(t){const{textTracks:e}=this.$state;e.set(this.#e.textTracks.toArray()),this.dispatch("text-tracks-change",{detail:e(),trigger:t})}#y(t){t&&this.#l("media-text-track-change-request",t);const e=this.#e.textTracks.selected,{textTrack:s}=this.$state;s()!==e&&(s.set(e),this.dispatch("text-track-change",{detail:e,trigger:t}))}#T(t){const{audioTracks:e}=this.$state;e.set(this.#e.audioTracks.toArray()),this.dispatch("audio-tracks-change",{detail:e(),trigger:t})}#$(t){const{audioTrack:e}=this.$state;e.set(this.#e.audioTracks.selected),t&&this.#l("media-audio-track-change-request",t),this.dispatch("audio-track-change",{detail:e(),trigger:t})}#w(t){const{qualities:e}=this.$state;e.set(this.#e.qualities.toArray()),this.dispatch("qualities-change",{detail:e(),trigger:t})}#P(t){const{quality:e}=this.$state;e.set(this.#e.qualities.selected),t&&this.#l("media-quality-change-request",t),this.dispatch("quality-change",{detail:e(),trigger:t})}#f(){const{qualities:t}=this.#e,e=t.auto;this.$state.autoQuality.set(e),e||this.#S()}#v=null;#k(){this.#S(),this.#v=h(()=>{const{qualities:t}=this.#e,{mediaWidth:e,mediaHeight:s}=this.$state,i=e(),a=s();if(i===0||a===0)return;let r=null,o=1/0;for(const l of t){const d=Math.abs(l.width-i)+Math.abs(l.height-a);d<o&&(o=d,r=l)}r&&t[P.select](r,!0,new V("resize",{detail:{width:i,height:a}}))})}#S(){this.#v?.(),this.#v=null}#x(){this.$state.canSetQuality.set(!this.#e.qualities.readonly)}#E(){const{canSetVolume:t,isGoogleCastConnected:e}=this.$state;if(e()){t.set(!1);return}ri().then(t.set)}"provider-change"(t){const e=this.#e.$provider(),s=t.detail;e?.type!==s?.type&&(e?.destroy?.(),e?.scope?.dispose(),this.#e.$provider.set(t.detail),e&&t.detail===null&&this.#C(t))}"provider-loader-change"(t){}"auto-play"(t){this.$state.autoPlayError.set(null)}"auto-play-fail"(t){this.$state.autoPlayError.set(t.detail),this.#u()}"can-load"(t){this.$state.canLoad.set(!0),this.#s.set("can-load",t),this.#e.textTracks[O.canLoad](),this.#l("media-start-loading",t)}"can-load-poster"(t){this.$state.canLoadPoster.set(!0),this.#s.set("can-load-poster",t),this.#l("media-poster-start-loading",t)}"media-type-change"(t){const e=this.#s.get("source-change");e&&t.triggers.add(e);const s=this.$state.viewType();this.$state.mediaType.set(t.detail);const i=this.$state.providedViewType(),a=i==="unknown"?t.detail:i;s!==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){const e=this.#s.get("source-change");e&&t.triggers.add(e);const{streamType:s,inferredStreamType:i}=this.$state;i.set(t.detail),t.detail=s()}"rate-change"(t){const{storage:e}=this.#e,{canPlay:s}=this.$state;this.$state.playbackRate.set(t.detail),this.#l("media-rate-change-request",t),s()&&e?.setPlaybackRate?.(t.detail)}"remote-playback-change"(t){const{remotePlaybackState:e,remotePlaybackType:s}=this.$state,{type:i,state:a}=t.detail,r=a==="connected";s.set(i),e.set(a);const o=i==="airplay"?"media-airplay-request":"media-google-cast-request";if(r)this.#l(o,t);else{const l=this.#t.queue.peek(o);l&&(t.request=l,t.triggers.add(l))}}"sources-change"(t){const e=this.$state.sources(),s=t.detail;this.$state.sources.set(s),this.#A(e,s,t)}#A(t,e,s){let{qualities:i}=this.#e,a=!1,r=!1;for(const o of t){if(!le(o))continue;if(!e.some(d=>d.src===o.src)){const d=i.getBySrc(o.src);d&&(i[P.remove](d,s),r=!0)}}r&&!i.length&&(this.$state.savedState.set(null),i[P.reset](s));for(const o of e){if(!le(o)||i.getBySrc(o.src))continue;const l={id:o.id??o.height+"p",bitrate:null,codec:null,...o,selected:!1};i[P.add](l,s),a=!0}a&&!i[W.enableAuto]&&(this.#k(),i[W.enableAuto]=this.#k.bind(this),i[W.setAuto](!0,s))}"source-change"(t){t.isQualityChange=t.originEvent?.type==="quality-change";const e=t.detail;this.#C(t,t.isQualityChange),this.#s.set(t.type,t),this.$state.source.set(e),this.el?.setAttribute("aria-busy","true")}#C(t,e=!1){const{audioTracks:s,qualities:i}=this.#e;if(!e){this.#a=[],this.#n=[-1,-1],s[P.reset](t),i[P.reset](t),Ue(this.$state,e),this.#u();return}Ue(this.$state,e),this.#u()}abort(t){const e=this.#s.get("source-change");e&&t.triggers.add(e);const s=this.#s.get("can-load");s&&!t.triggers.hasType("can-load")&&t.triggers.add(s)}"load-start"(t){const e=this.#s.get("source-change");e&&t.triggers.add(e)}error(t){this.$state.error.set(t.detail);const e=this.#s.get("abort");e&&t.triggers.add(e)}"loaded-metadata"(t){const e=this.#s.get("load-start");e&&t.triggers.add(e)}"loaded-data"(t){const e=this.#s.get("load-start");e&&t.triggers.add(e)}"can-play"(t){const e=this.#s.get("loaded-metadata");e&&t.triggers.add(e),this.#M(t.detail),this.el?.setAttribute("aria-busy","false")}"can-play-through"(t){this.#M(t.detail);const e=this.#s.get("can-play");e&&t.triggers.add(e)}#M(t){const{seekable:e,buffered:s,intrinsicDuration:i,canPlay:a}=this.$state;a.set(!0),s.set(t.buffered),e.set(t.seekable);const r=dt(t.seekable)??1/0;i.set(r)}"duration-change"(t){const{live:e,intrinsicDuration:s,providedDuration:i,clipEndTime:a,ended:r}=this.$state,o=t.detail;if(!e()){const l=Number.isNaN(o)?0:o;s.set(l),r()&&this.#I(t)}(i()>0||a()>0)&&t.stopImmediatePropagation()}progress(t){const{buffered:e,seekable:s}=this.$state,{buffered:i,seekable:a}=t.detail,r=dt(i),o=i.length!==e().length,l=r!==dt(e()),d=dt(a),c=a.length!==s().length,m=d!==dt(s());(o||l)&&e.set(i),(c||m)&&s.set(a)}play(t){const{paused:e,autoPlayError:s,ended:i,autoPlaying:a,playsInline:r,pointer:o,muted:l,viewType:d,live:c,userBehindLiveEdge:m}=this.$state;if(this.#L(),!e()){t.stopImmediatePropagation();return}t.autoPlay=a();const y=this.#s.get("waiting");y&&t.triggers.add(y),this.#l("media-play-request",t),this.#s.set("play",t),e.set(!1),s.set(null),t.autoPlay&&(this.handle(this.createEvent("auto-play",{detail:{muted:l()},trigger:t})),a.set(!1)),(i()||this.#t.replaying)&&(this.#t.replaying=!1,i.set(!1),this.handle(this.createEvent("replay",{trigger:t}))),!r()&&d()==="video"&&o()==="coarse"&&this.#e.remote.enterFullscreen("prefer-media",t),c()&&!m()&&this.#e.remote.seekToLiveEdge(t)}#L(t){if(!u(this.#e.$provider))return;const{ended:s,seekableStart:i,clipEndTime:a,currentTime:r,realCurrentTime:o,duration:l}=this.$state,d=s()||o()<i()||a()>0&&o()>=a()||Math.abs(r()-l())<.1;return d&&this.dispatch("media-seek-request",{detail:i(),trigger:t}),d}"play-fail"(t){const{muted:e,autoPlaying:s}=this.$state,i=this.#s.get("play");i&&t.triggers.add(i),this.#l("media-play-request",t);const{paused:a,playing:r}=this.$state;a.set(!0),r.set(!1),this.#u(),this.#s.set("play-fail",t),t.autoPlay&&(this.handle(this.createEvent("auto-play-fail",{detail:{muted:e(),error:t.detail},trigger:t})),s.set(!1))}playing(t){const e=this.#s.get("play"),s=this.#s.get("seeked");e?t.triggers.add(e):s&&t.triggers.add(s),setTimeout(()=>this.#u(),0);const{paused:i,playing:a,live:r,liveSyncPosition:o,seekableEnd:l,started:d,currentTime:c,seeking:m,ended:y}=this.$state;if(i.set(!1),a.set(!0),m.set(!1),y.set(!1),this.#t.looping){this.#t.looping=!1;return}if(r()&&!d()&&c()===0){const v=o()??l()-2;Number.isFinite(v)&&this.#e.$provider().setCurrentTime(v)}this.started(t)}started(t){const{started:e}=this.$state;e()||(e.set(!0),this.handle(this.createEvent("started",{trigger:t})))}pause(t){this.el?.isConnected||(this.#h=!0),this.#l("media-pause-request",t);const e=this.#s.get("seeked");e&&t.triggers.add(e);const{paused:s,playing:i}=this.$state;s.set(!0),i.set(!1),this.#i&&setTimeout(()=>{this.handle(this.createEvent("end",{trigger:t})),this.#i=!1},0),this.#u()}"time-change"(t){if(this.#t.looping){t.stopImmediatePropagation();return}let{waiting:e,played:s,clipEndTime:i,realCurrentTime:a,currentTime:r}=this.$state,o=t.detail,l=i();a.set(o),this.#V(),e.set(!1);for(const d of this.#e.textTracks)d[O.updateActiveCues](o,t);l>0&&o>=l&&(this.#i=!0,this.dispatch("media-pause-request",{trigger:t})),this.#R(),this.dispatch("time-update",{detail:{currentTime:r(),played:s()},trigger:t})}#V(){const{currentTime:t,played:e,paused:s}=this.$state;s()||(this.#n=di(this.#a,this.#n,t()),e.set(new Dt(this.#a)))}#I(t){const{clipStartTime:e,clipEndTime:s,duration:i}=this.$state;e()>0||s()>0||this.handle(this.createEvent("time-change",{detail:i(),trigger:t}))}#R(){const{storage:t}=this.#e,{canPlay:e,realCurrentTime:s}=this.$state;e()&&t?.setTime?.(s())}"audio-gain-change"(t){const{storage:e}=this.#e,{canPlay:s,audioGain:i}=this.$state;i.set(t.detail),this.#l("media-audio-gain-change-request",t),s()&&e?.setAudioGain?.(i())}"volume-change"(t){const{storage:e}=this.#e,{volume:s,muted:i,canPlay:a}=this.$state,r=t.detail;s.set(r.volume),i.set(r.muted||r.volume===0),this.#l("media-volume-change-request",t),this.#l(r.muted?"media-mute-request":"media-unmute-request",t),a()&&(e?.setVolume?.(s()),e?.setMuted?.(i()))}seeking=ht(t=>{const{seeking:e,realCurrentTime:s,paused:i}=this.$state;e.set(!0),s.set(t.detail),this.#l("media-seeking-request",t),i()&&(this.#o=t,this.#q()),this.#n=[-1,-1]},150,{leading:!0});seeked(t){const{seeking:e,currentTime:s,realCurrentTime:i,paused:a,seekableEnd:r,ended:o,live:l}=this.$state;if(this.#t.seeking)e.set(!0),t.stopImmediatePropagation();else if(e()){const d=this.#s.get("waiting");d&&t.triggers.add(d);const c=this.#s.get("seeking");c&&!t.triggers.has(c)&&t.triggers.add(c),a()&&this.#D(),e.set(!1),i.set(t.detail),this.#l("media-seek-request",t);const m=t?.originEvent;m?.isTrusted&&!(m instanceof MessageEvent)&&!/seek/.test(m.type)&&this.started(t)}l()||(Math.floor(s())!==Math.floor(r())?o.set(!1):this.end(t))}waiting(t){this.#r||this.#t.seeking||(t.stopImmediatePropagation(),this.#o=t,this.#q())}#q=zt(()=>{if(!this.#o)return;this.#r=!0;const{waiting:t,playing:e}=this.$state;t.set(!0),e.set(!1);const s=this.createEvent("waiting",{trigger:this.#o});this.#s.set("waiting",s),this.dispatch(s),this.#o=void 0,this.#r=!1},300);end(t){const{loop:e,ended:s}=this.$state;if(!(!e()&&s())){if(e()){setTimeout(()=>{requestAnimationFrame(()=>{this.#L(t),this.dispatch("media-loop-request",{trigger:t})})},10);return}setTimeout(()=>this.#O(t),0)}}#O(t){const{storage:e}=this.#e,{paused:s,seeking:i,ended:a,duration:r}=this.$state;this.#I(t),s()||this.dispatch("pause",{trigger:t}),i()&&this.dispatch("seeked",{detail:r(),trigger:t}),a.set(!0),this.#u(),e?.setTime?.(r(),!0),this.dispatch("ended",{trigger:t})}#D(){this.#q.cancel(),this.$state.waiting.set(!1)}"fullscreen-change"(t){const e=t.detail;this.$state.fullscreen.set(e),this.#l(e?"media-enter-fullscreen-request":"media-exit-fullscreen-request",t)}"fullscreen-error"(t){this.#l("media-enter-fullscreen-request",t),this.#l("media-exit-fullscreen-request",t)}"orientation-change"(t){const e=t.detail.lock;this.#l(e?"media-orientation-lock-request":"media-orientation-unlock-request",t)}"picture-in-picture-change"(t){const e=t.detail;this.$state.pictureInPicture.set(e),this.#l(e?"media-enter-pip-request":"media-exit-pip-request",t)}"picture-in-picture-error"(t){this.#l("media-enter-pip-request",t),this.#l("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 _i extends ct{onSetup(){this.#t();const t=[this.#i,this.#n,this.#l,this.#p,this.#o,this.#d,this.#c,this.#m,this.#g,this.#b,this.#r,this.#u,this.#h,this.#e,this.#a];for(const e of t)h(e.bind(this))}#t(){const t={duration:"providedDuration",loop:"providedLoop",poster:"providedPoster",streamType:"providedStreamType",title:"providedTitle",viewType:"providedViewType"},e=new Set(["currentTime","paused","playbackRate","volume"]);for(const s of Object.keys(this.$props))e.has(s)||this.$state[t[s]??s]?.set(this.$props[s]());this.$state.muted.set(this.$props.muted()||this.$props.volume()===0)}#e(){const{viewType:t,streamType:e,title:s,poster:i,loop:a}=this.$props,r=this.$state;r.providedPoster.set(i()),r.providedStreamType.set(e()),r.providedViewType.set(t()),r.providedTitle.set(s()),r.providedLoop.set(a())}#s(){}#i(){const{artist:t,artwork:e}=this.$props;this.$state.artist.set(t()),this.$state.artwork.set(e())}#a(){const{title:t}=this.$state;this.dispatch("title-change",{detail:t()})}#n(){const t=this.$props.autoPlay()||this.$props.autoplay();this.$state.autoPlay.set(t),this.dispatch("auto-play-change",{detail:t})}#r(){const t=this.$state.loop();this.dispatch("loop-change",{detail:t})}#o(){const t=this.$props.controls();this.$state.controls.set(t)}#h(){const{poster:t}=this.$state;this.dispatch("poster-change",{detail:t()})}#d(){const t=this.$props.crossOrigin()??this.$props.crossorigin(),e=t===!0?"":t;this.$state.crossOrigin.set(e)}#c(){const{duration:t}=this.$props;this.dispatch("media-duration-change-request",{detail:t()})}#u(){const t=this.$props.playsInline()||this.$props.playsinline();this.$state.playsInline.set(t),this.dispatch("plays-inline-change",{detail:t})}#l(){const{clipStartTime:t}=this.$props;this.dispatch("media-clip-start-change-request",{detail:t()})}#p(){const{clipEndTime:t}=this.$props;this.dispatch("media-clip-end-change-request",{detail:t()})}#m(){this.dispatch("live-change",{detail:this.$state.live()})}#b(){this.$state.liveEdgeTolerance.set(this.$props.liveEdgeTolerance()),this.$state.minLiveDVRWindow.set(this.$props.minLiveDVRWindow())}#g(){this.dispatch("live-edge-change",{detail:this.$state.liveEdge()})}}class Ui{playerId="vds-player";mediaId=null;#t={volume:null,muted:null,audioGain:null,time:null,lang:null,captions:null,rate:null,quality:null};async getVolume(){return this.#t.volume}async setVolume(t){this.#t.volume=t,this.save()}async getMuted(){return this.#t.muted}async setMuted(t){this.#t.muted=t,this.save()}async getTime(){return this.#t.time}async setTime(t,e){const s=t<0;this.#t.time=s?null:t,s||e?this.saveTime():this.saveTimeThrottled()}async getLang(){return this.#t.lang}async setLang(t){this.#t.lang=t,this.save()}async getCaptions(){return this.#t.captions}async setCaptions(t){this.#t.captions=t,this.save()}async getPlaybackRate(){return this.#t.rate}async setPlaybackRate(t){this.#t.rate=t,this.save()}async getAudioGain(){return this.#t.audioGain}async setAudioGain(t){this.#t.audioGain=t,this.save()}async getVideoQuality(){return this.#t.quality}async setVideoQuality(t){this.#t.quality=t,this.save()}onChange(t,e,s="vds-player"){const i=s?localStorage.getItem(s):null,a=e?localStorage.getItem(e):null;this.playerId=s,this.mediaId=e,this.#t={volume:null,muted:null,audioGain:null,lang:null,captions:null,rate:null,quality:null,...i?JSON.parse(i):{},time:a?+a:null}}save(){if(!this.playerId)return;const t=JSON.stringify({...this.#t,time:void 0});localStorage.setItem(this.playerId,t)}saveTimeThrottled=ht(this.saveTime.bind(this),1e3);saveTime(){if(!this.mediaId)return;const t=(this.#t.time??0).toString();localStorage.setItem(this.mediaId,t)}}const as=["play","pause","seekforward","seekbackward","seekto"];class Qi extends ct{onConnect(){h(this.#e.bind(this)),h(this.#s.bind(this));const t=this.#i.bind(this);for(const e of as)navigator.mediaSession.setActionHandler(e,t);k(this.#t.bind(this))}#t(){for(const t of as)navigator.mediaSession.setActionHandler(t,null)}#e(){const{title:t,artist:e,artwork:s,poster:i}=this.$state;navigator.mediaSession.metadata=new MediaMetadata({title:t(),artist:e(),artwork:s()??[{src:i()}]})}#s(){const{canPlay:t,paused:e}=this.$state;navigator.mediaSession.playbackState=t()?e()?"paused":"playing":"none"}#i(t){const e=new V("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:j(t.seekTime)?t.seekTime:this.$state.currentTime()+(t.seekOffset??(t.action==="seekforward"?10:-10)),trigger:e});break}}}class Wi{#t=null;#e=null;#s=-1;#i;constructor(t=void 0){this.#i=t}setTarget(t){this.#t=t}getPlayer(t){return this.#e?this.#e:((t??this.#t)?.dispatchEvent(new V("find-media-player",{detail:e=>void(this.#e=e),bubbles:!0,composed:!0})),this.#e)}setPlayer(t){this.#e=t}startLoading(t){this.#a("media-start-loading",t)}startLoadingPoster(t){this.#a("media-poster-start-loading",t)}requestAirPlay(t){this.#a("media-airplay-request",t)}requestGoogleCast(t){this.#a("media-google-cast-request",t)}play(t){this.#a("media-play-request",t)}pause(t){this.#a("media-pause-request",t)}mute(t){this.#a("media-mute-request",t)}unmute(t){this.#a("media-unmute-request",t)}enterFullscreen(t,e){this.#a("media-enter-fullscreen-request",e,t)}exitFullscreen(t,e){this.#a("media-exit-fullscreen-request",e,t)}lockScreenOrientation(t,e){this.#a("media-orientation-lock-request",e,t)}unlockScreenOrientation(t){this.#a("media-orientation-unlock-request",t)}enterPictureInPicture(t){this.#a("media-enter-pip-request",t)}exitPictureInPicture(t){this.#a("media-exit-pip-request",t)}seeking(t,e){this.#a("media-seeking-request",e,t)}seek(t,e){this.#a("media-seek-request",e,t)}seekToLiveEdge(t){this.#a("media-live-edge-request",t)}changeDuration(t,e){this.#a("media-duration-change-request",e,t)}changeClipStart(t,e){this.#a("media-clip-start-change-request",e,t)}changeClipEnd(t,e){this.#a("media-clip-end-change-request",e,t)}changeVolume(t,e){this.#a("media-volume-change-request",e,Math.max(0,Math.min(1,t)))}changeAudioTrack(t,e){this.#a("media-audio-track-change-request",e,t)}changeQuality(t,e){this.#a("media-quality-change-request",e,t)}requestAutoQuality(t){this.changeQuality(-1,t)}changeTextTrackMode(t,e,s){this.#a("media-text-track-change-request",s,{index:t,mode:e})}changePlaybackRate(t,e){this.#a("media-rate-change-request",e,t)}changeAudioGain(t,e){this.#a("media-audio-gain-change-request",e,t)}resumeControls(t){this.#a("media-resume-controls-request",t)}pauseControls(t){this.#a("media-pause-controls-request",t)}togglePaused(t){const e=this.getPlayer(t?.target);e&&(e.state.paused?this.play(t):this.pause(t))}toggleControls(t){const e=this.getPlayer(t?.target);e&&(e.controls.showing?e.controls.hide(0,t):e.controls.show(0,t))}toggleMuted(t){const e=this.getPlayer(t?.target);e&&(e.state.muted?this.unmute(t):this.mute(t))}toggleFullscreen(t,e){const s=this.getPlayer(e?.target);s&&(s.state.fullscreen?this.exitFullscreen(t,e):this.enterFullscreen(t,e))}togglePictureInPicture(t){const e=this.getPlayer(t?.target);e&&(e.state.pictureInPicture?this.exitPictureInPicture(t):this.enterPictureInPicture(t))}showCaptions(t){const e=this.getPlayer(t?.target);if(!e)return;let s=e.state.textTracks,i=this.#s;(!s[i]||!R(s[i]))&&(i=-1),i===-1&&(i=s.findIndex(a=>R(a)&&a.default)),i===-1&&(i=s.findIndex(a=>R(a))),i>=0&&this.changeTextTrackMode(i,"showing",t),this.#s=-1}disableCaptions(t){const e=this.getPlayer(t?.target);if(!e)return;const s=e.state.textTracks,i=e.state.textTrack;if(i){const a=s.indexOf(i);this.changeTextTrackMode(a,"disabled",t),this.#s=a}}toggleCaptions(t){const e=this.getPlayer(t?.target);e&&(e.state.textTrack?this.disableCaptions():this.showCaptions())}userPrefersLoopChange(t,e){this.#a("media-user-loop-change-request",e,t)}#a(t,e,s){const i=new V(t,{bubbles:!0,composed:!0,cancelable:!0,detail:s,trigger:e});let a=e?.target||null;a&&a instanceof g&&(a=a.el),a=!a||a===document||a===window||a===document.body||this.#e?.el&&a instanceof Node&&!this.#e.el.contains(a)?this.#t??this.getPlayer()?.el:a??this.#t,this.#e?t==="media-play-request"&&!this.#e.state.canLoad?a?.dispatchEvent(i):this.#e.canPlayQueue.enqueue(t,()=>a?.dispatchEvent(i)):a?.dispatchEvent(i)}#n(t){}}class zi extends ze{}class ji{priority=0;#t=!0;#e=null;#s=null;#i=new Set;canRender(t,e){return!!e}attach(t){this.#e=t,t&&(t.textTracks.onchange=this.#o.bind(this))}addTrack(t){this.#i.add(t),this.#a(t)}removeTrack(t){t[O.native]?.remove?.(),t[O.native]=null,this.#i.delete(t)}changeTrack(t){const e=t?.[O.native];e&&e.track.mode!=="showing"&&(e.track.mode="showing"),this.#s=t}setDisplay(t){this.#t=t,this.#o()}detach(){this.#e&&(this.#e.textTracks.onchange=null);for(const t of this.#i)this.removeTrack(t);this.#i.clear(),this.#e=null,this.#s=null}#a(t){if(!this.#e)return;const e=t[O.native]??=this.#n(t);ut(e)&&(this.#e.append(e),e.track.mode=e.default?"showing":"disabled")}#n(t){const e=document.createElement("track"),s=t.default||t.mode==="showing",i=t.src&&t.type==="vtt";return e.id=t.id,e.src=i?t.src:"",e.label=t.label,e.kind=t.kind,e.default=s,t.language&&(e.srclang=t.language),s&&!i&&this.#r(t,e.track),e}#r(t,e){if(!(t.src&&t.type==="vtt"||e.cues?.length))for(const s of t.cues)e.addCue(s)}#o(t){for(const e of this.#i){const s=e[O.native];if(!s)continue;if(!this.#t){s.track.mode=s.managed?"hidden":"disabled";continue}const i=s.track.mode==="showing";i&&this.#r(e,s.track),e.setMode(i?"showing":"disabled",t)}}}class Yi{#t=null;#e;#s=[];#i;#a=!1;#n=null;#r=null;constructor(t){this.#i=t;const e=t.textTracks;this.#e=e,h(this.#o.bind(this)),k(this.#p.bind(this)),new A(e).add("add",this.#c.bind(this)).add("remove",this.#u.bind(this)).add("mode-change",this.#l.bind(this))}#o(){const{nativeControls:t}=this.#i.$state;this.#a=t(),this.#l()}add(t){this.#s.push(t),qt(this.#l.bind(this))}remove(t){t.detach(),this.#s.splice(this.#s.indexOf(t),1),qt(this.#l.bind(this))}attachVideo(t){requestAnimationFrame(()=>{if(this.#t=t,t){this.#n=new ji,this.#n.attach(t);for(const e of this.#e)this.#h(e)}this.#l()})}#h(t){R(t)&&this.#n?.addTrack(t)}#d(t){R(t)&&this.#n?.removeTrack(t)}#c(t){this.#h(t.detail)}#u(t){this.#d(t.detail)}#l(){const t=this.#e.selected;if(this.#t&&(this.#a||t?.[O.nativeHLS])){this.#r?.changeTrack(null),this.#n?.setDisplay(!0),this.#n?.changeTrack(t);return}if(this.#n?.setDisplay(!1),this.#n?.changeTrack(null),!t){this.#r?.changeTrack(null);return}const e=this.#s.sort((s,i)=>s.priority-i.priority).find(s=>s.canRender(t,this.#t));this.#r!==e&&(this.#r?.detach(),e?.attach(this.#t),this.#r=e??null),e?.changeTrack(t)}#p(){this.#n?.detach(),this.#n=null,this.#r?.detach(),this.#r=null}}class Xi extends We{#t=!1;#e={};#s=null;#i=null;[O.crossOrigin];constructor(){super()}get selected(){return this.items.find(e=>e.mode==="showing"&&R(e))??null}get selectedIndex(){const t=this.selected;return t?this.indexOf(t):-1}get preferredLang(){return this.#i}set preferredLang(t){this.#i=t,this.#d(t)}add(t,e){const s=t instanceof Rt,i=s?t:new Rt(t),a=t.kind==="captions"||t.kind==="subtitles"?"captions":t.kind;return this.#e[a]&&t.default&&delete t.default,i.addEventListener("mode-change",this.#r),this[P.add](i,e),i[O.crossOrigin]=this[O.crossOrigin],this.#t&&i[O.canLoad](),t.default&&(this.#e[a]=i),this.#a(),this}remove(t,e){if(this.#n=t,!!this.items.includes(t))return t===this.#e[t.kind]&&delete this.#e[t.kind],t.mode="disabled",t[O.onModeChange]=null,t.removeEventListener("mode-change",this.#r),this[P.remove](t,e),this.#n=null,this}clear(t){for(const e of[...this.items])this.remove(e,t);return this}getByKind(t){const e=Array.isArray(t)?t:[t];return this.items.filter(s=>e.includes(s.kind))}[O.canLoad](){if(!this.#t){for(const t of this.items)t[O.canLoad]();this.#t=!0,this.#a()}}#a=zt(async()=>{if(!this.#t)return;!this.#i&&this.#s&&(this.#i=await this.#s.getLang());const t=await this.#s?.getCaptions(),e=[["captions","subtitles"],"chapters","descriptions","metadata"];for(const s of e){const i=this.getByKind(s);if(i.find(d=>d.mode==="showing"))continue;const a=this.#i?i.find(d=>d.language===this.#i):null,r=Q(s)?this.#e[s.find(d=>this.#e[d])||""]:this.#e[s],o=a??r,l=o&&R(o);o&&(!l||t!==!1)&&(o.mode="showing",l&&this.#h(o))}},300);#n=null;#r=this.#o.bind(this);#o(t){const e=t.detail;if(this.#s&&R(e)&&e!==this.#n&&this.#h(e),e.mode==="showing"){const s=R(e)?["captions","subtitles"]:[e.kind];for(const i of this.items)i.mode==="showing"&&i!=e&&s.includes(i.kind)&&(i.mode="disabled")}this.dispatchEvent(new V("mode-change",{detail:t.detail,trigger:t}))}#h(t){t.mode!=="disabled"&&this.#d(t.language),this.#s?.setCaptions?.(t.mode==="showing")}#d(t){this.#s?.setLang?.(this.#i=t)}setStorage(t){this.#s=t}}let Nt=T(!1);H(document,"pointerdown",()=>{Nt.set(!1)}),H(document,"keydown",n=>{n.metaKey||n.altKey||n.ctrlKey||Nt.set(!0)});class z extends U{#t=T(!1);onConnect(t){h(()=>{const e=new A(t);if(!Nt()){this.#t.set(!1),Ft(t,!1),e.add("pointerenter",this.#i.bind(this)).add("pointerleave",this.#a.bind(this));return}const s=document.activeElement===t;this.#t.set(s),Ft(t,s),e.add("focus",this.#e.bind(this)).add("blur",this.#s.bind(this))})}focused(){return this.#t()}#e(){this.#t.set(!0),Ft(this.el,!0)}#s(){this.#t.set(!1),Ft(this.el,!1)}#i(){ns(this.el,!0)}#a(){ns(this.el,!1)}}function Ft(n,t){p(n,"data-focus",t),p(n,"data-hocus",t)}function ns(n,t){p(n,"data-hocus",t),p(n,"data-hover",t)}class vt extends g{static props=Ci;static state=Ke;#t;#e;#s;canPlayQueue=new Xe;remoteControl;get#i(){return this.#t.$provider()}get#a(){return this.$props}constructor(){super(),new _i;const t={player:this,qualities:new Ai,audioTracks:new zi,storage:null,$provider:T(null),$providerSetup:T(!1),$props:this.$props,$state:this.$state};t.remote=this.remoteControl=new Wi(void 0),t.remote.setPlayer(this),t.textTracks=new Xi,t.textTracks[O.crossOrigin]=this.$state.crossOrigin,t.textRenderers=new Yi(t),t.ariaKeys={},this.#t=t,K(Ge,t),this.orientation=new Qt,new z,new ki(t);const e=new Gi;this.#e=new Ki(e,t),this.#s=new Fi(this.#e,e,t),t.delegate=new Mi(this.#e.handle.bind(this.#e),t),t.notify=t.delegate.notify.bind(t.delegate),typeof navigator<"u"&&"mediaSession"in navigator&&new Qi,new je("load",this.startLoading.bind(this)),new je("posterLoad",this.startLoadingPoster.bind(this))}onSetup(){this.#d(),h(this.#h.bind(this)),h(this.#b.bind(this)),h(this.#p.bind(this)),h(this.#$.bind(this)),h(this.#y.bind(this)),h(this.#v.bind(this)),h(this.#P.bind(this))}onAttach(t){t.setAttribute("data-media-player",""),x(t,"tabindex","0"),x(t,"role","region"),h(this.#S.bind(this)),h(this.#r.bind(this)),h(this.#o.bind(this)),H(t,"find-media-player",this.#c.bind(this))}onConnect(t){Oe&&p(t,"data-iphone","");const e=window.matchMedia("(pointer: coarse)");this.#l(e),e.onchange=this.#l.bind(this);const s=new ResizeObserver(bt(this.#u.bind(this)));s.observe(t),h(this.#u.bind(this)),this.dispatch("media-player-connect",{detail:this,bubbles:!0,composed:!0}),k(()=>{s.disconnect(),e.onchange=null})}onDestroy(){this.#t.player=null,this.canPlayQueue.reset()}#n=!1;#r(){const t=this.$el,{title:e,live:s,viewType:i,providedTitle:a}=this.$state,r=s(),o=Qs(i()),l=o!=="Unknown"?`${r?"Live ":""}${o}`:r?"Live":"Media",d=e();p(this.el,"aria-label",`${l} Player`+(d?` - ${d}`:"")),t?.hasAttribute("title")&&(this.#n=!0,t?.removeAttribute("title"))}#o(){const t=this.orientation.landscape?"landscape":"portrait";this.$state.orientation.set(t),p(this.el,"data-orientation",t),this.#u()}#h(){this.$state.canPlay()&&this.#i?this.canPlayQueue.start():this.canPlayQueue.stop()}#d(){if(vt[te]){this.setAttributes(vt[te]);return}const t={"data-load":function(){return this.$props.load()},"data-captions":function(){const s=this.$state.textTrack();return!!s&&R(s)},"data-ios-controls":function(){return this.$state.iOSControls()},"data-controls":function(){return this.controls.showing},"data-buffering":function(){const{canLoad:s,canPlay:i,waiting:a}=this.$state;return s()&&(!i()||a())},"data-error":function(){const{error:s}=this.$state;return!!s()},"data-autoplay-error":function(){const{autoPlayError:s}=this.$state;return!!s()}},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(const s of bi){const i="data-"+(e[s]??Ws(s));t[i]=function(){return this.$state[s]()}}delete t.title,vt[te]=t,this.setAttributes(t)}#c(t){t.detail(this)}#u(){if(!this.el)return;const t=this.el.clientWidth,e=this.el.clientHeight;this.$state.width.set(t),this.$state.height.set(e),B(this.el,"--player-width",t+"px"),B(this.el,"--player-height",e+"px")}#l(t){const e=t.matches?"coarse":"fine";p(this.el,"data-pointer",e),this.$state.pointer.set(e),this.#u()}get provider(){return this.#i}get controls(){return this.#s.controls}set controls(t){this.#a.controls.set(t)}orientation;get title(){return u(this.$state.title)}set title(t){if(this.#n){this.#n=!1;return}this.#a.title.set(t)}get qualities(){return this.#t.qualities}get audioTracks(){return this.#t.audioTracks}get textTracks(){return this.#t.textTracks}get textRenderers(){return this.#t.textRenderers}get duration(){return this.$state.duration()}set duration(t){this.#a.duration.set(t)}get paused(){return u(this.$state.paused)}set paused(t){this.#m(t)}#p(){this.#m(this.$props.paused())}#m(t){t?this.canPlayQueue.enqueue("paused",()=>this.#s.pause()):this.canPlayQueue.enqueue("paused",()=>this.#s.play())}get muted(){return u(this.$state.muted)}set muted(t){this.#g(t)}#b(){this.#g(this.$props.muted())}#g(t){this.canPlayQueue.enqueue("muted",()=>{this.#i&&this.#i.setMuted(t)})}get currentTime(){return u(this.$state.currentTime)}set currentTime(t){this.#T(t)}#y(){this.#T(this.$props.currentTime())}#T(t){this.canPlayQueue.enqueue("currentTime",()=>{const{currentTime:e}=this.$state;t!==u(e)&&u(()=>{if(!this.#i)return;const s=Qe(t,this.$state);Number.isFinite(s)&&this.#i.setCurrentTime(s)})})}get volume(){return u(this.$state.volume)}set volume(t){this.#w(t)}#$(){this.#w(this.$props.volume())}#w(t){const e=Xt(0,t,1);this.canPlayQueue.enqueue("volume",()=>{this.#i&&this.#i.setVolume(e)})}get playbackRate(){return u(this.$state.playbackRate)}set playbackRate(t){this.#f(t)}#P(){this.#f(this.$props.playbackRate())}#f(t){this.canPlayQueue.enqueue("rate",()=>{this.#i&&this.#i.setPlaybackRate?.(t)})}#v(){this.#k(this.$props.playsInline())}#k(t){this.canPlayQueue.enqueue("playsinline",()=>{this.#i&&this.#i.setPlaysInline?.(t)})}#S(){let t=this.$props.storage(),e=S(t)?new Ui:t;if(e?.onChange){const{source:s}=this.$state,i=S(t)?t:this.el?.id,a=Y(this.#x.bind(this));h(()=>e.onChange(s(),a(),i||void 0))}this.#t.storage=e,this.#t.textTracks.setStorage(e),k(()=>{e?.onDestroy?.(),this.#t.storage=null,this.#t.textTracks.setStorage(null)})}#x(){const{clipStartTime:t,clipEndTime:e}=this.$props,{source:s}=this.$state,i=s();return i.src?`${i.src}:${t()}:${e()}`:null}async play(t){return this.#s.play(t)}async pause(t){return this.#s.pause(t)}async enterFullscreen(t,e){return this.#s.enterFullscreen(t,e)}async exitFullscreen(t,e){return this.#s.exitFullscreen(t,e)}enterPictureInPicture(t){return this.#s.enterPictureInPicture(t)}exitPictureInPicture(t){return this.#s.exitPictureInPicture(t)}seekToLiveEdge(t){this.#s.seekToLiveEdge(t)}startLoading(t){this.#t.notify("can-load",void 0,t)}startLoadingPoster(t){this.#t.notify("can-load-poster",void 0,t)}requestAirPlay(t){return this.#s.requestAirPlay(t)}requestGoogleCast(t){return this.#s.requestGoogleCast(t)}setAudioGain(t,e){return this.#s.setAudioGain(t,e)}destroy(){super.destroy(),this.#t.remote.setPlayer(null),this.dispatch("destroy")}}const C=vt.prototype;$(C,"canPlayQueue"),$(C,"remoteControl"),$(C,"provider"),$(C,"controls"),$(C,"orientation"),$(C,"title"),$(C,"qualities"),$(C,"audioTracks"),$(C,"textTracks"),$(C,"textRenderers"),$(C,"duration"),$(C,"paused"),$(C,"muted"),$(C,"currentTime"),$(C,"volume"),$(C,"playbackRate"),q(C,"play"),q(C,"pause"),q(C,"enterFullscreen"),q(C,"exitFullscreen"),q(C,"enterPictureInPicture"),q(C,"exitPictureInPicture"),q(C,"seekToLiveEdge"),q(C,"startLoading"),q(C,"startLoadingPoster"),q(C,"requestAirPlay"),q(C,"requestGoogleCast"),q(C,"setAudioGain");class Ji extends b(HTMLElement,vt){static tagName="media-player";static attrs={autoPlay:"autoplay",crossOrigin:"crossorigin",playsInline:"playsinline",preferNativeHLS:"prefer-native-hls",minLiveDVRWindow:"min-live-dvr-window"}}class Zi{name="audio";target;canPlay(t){return mi(t)?!S(t.src)||t.type==="?"||oi(this.target,t.type):!1}mediaType(){return"audio"}async load(t){return new(await import("../providers/vidstack-audio-BOGYlExy.js")).AudioProvider(this.target,t)}}class de{name="video";target;canPlay(t){return fi(t)?!S(t.src)||t.type==="?"||hi(this.target,t.type):!1}mediaType(){return"video"}async load(t){return new(await import("../providers/vidstack-video-BnwQZKER.js")).VideoProvider(this.target,t)}}class ke extends de{static supported=li();name="dash";canPlay(t){return ke.supported&&Jt(t)}async load(t){return new(await import("../providers/vidstack-dash-D4ZARr66.js")).DASHProvider(this.target,t)}}class Se extends de{static supported=Fe();name="hls";canPlay(t){return Se.supported&&Zt(t)}async load(t){return new(await import("../providers/vidstack-hls-8-552IuX.js")).HLSProvider(this.target,t)}}class ta{name="vimeo";target;preconnect(){const t=["https://i.vimeocdn.com","https://f.vimeocdn.com","https://fresnel.vimeocdn.com"];for(const e of t)St(e)}canPlay(t){return S(t.src)&&t.type==="video/vimeo"}mediaType(){return"video"}async load(t){return new(await import("../providers/vidstack-vimeo-gJmBqtLK.js")).VimeoProvider(this.target,t)}async loadPoster(t,e,s){const{resolveVimeoVideoId:i,getVimeoVideoInfo:a}=await import("./vidstack-2f5gzOW6.js");if(!S(t.src))return null;const{videoId:r,hash:o}=i(t.src);return r?a(r,s,o).then(l=>l?l.poster:null):null}}class ea{name="youtube";target;preconnect(){const t=["https://www.google.com","https://i.ytimg.com","https://googleads.g.doubleclick.net","https://static.doubleclick.net"];for(const e of t)St(e)}canPlay(t){return S(t.src)&&t.type==="video/youtube"}mediaType(){return"video"}async load(t){return new(await import("../providers/vidstack-youtube-Chl_dTAz.js")).YouTubeProvider(this.target,t)}async loadPoster(t,e,s){const{findYouTubePoster:i,resolveYouTubeVideoId:a}=await import("./vidstack-DiNS2Vx5.js"),r=S(t.src)&&a(t.src);return r?i(r,s):null}}function sa(n,t){return fetch(n,t).then(e=>e.text()).then(e=>/type="static"/.test(e)?"on-demand":"live")}function rs(n,t){return fetch(n,t).then(e=>e.text()).then(e=>{const s=ia(e);if(s)return rs(/^https?:/.test(s)?s:new URL(s,n).href,t);const i=/EXT-X-PLAYLIST-TYPE:\s*VOD/.test(e)?"on-demand":"live";return i==="live"&&aa(e)>=10&&(/#EXT-X-DVR-ENABLED:\s*true/.test(e)||e.includes("#EXT-X-DISCONTINUITY"))?"live:dvr":i})}function ia(n){const t=n.match(/#EXT-X-STREAM-INF:[^\n]+(\n[^\n]+)*/g);return t?t[0].split(`
|
|
2
|
+
`)[1].trim():null}function aa(n){const t=n.split(`
|
|
3
|
+
`);for(const e of t)if(e.startsWith("#EXT-X-TARGETDURATION")){const s=parseFloat(e.split(":")[1]);if(!isNaN(s))return s}return-1}const ce=new Map;class na{#t=!1;#e;#s;#i;#a;constructor(t,e,s,i=[]){this.#s=t,this.#i=e,this.#a=s;const a=new ke,r=new Se,o=new de,l=new Zi,d=new ea,c=new ta,m=[d,c];this.#e=Y(()=>{const v=e.$state.remotePlaybackLoader(),E=e.$props.preferNativeHLS()?[o,l,a,r,...m,...i]:[r,o,l,a,...m,...i];return v?[v,...E]:E});const{$state:y}=e;y.sources.set(os(e.$props.src()));for(const v of y.sources()){const E=this.#e().find(X=>X.canPlay(v));if(!E)continue;const F=E.mediaType(v);e.$state.source.set(v),e.$state.mediaType.set(F),e.$state.inferredViewType.set(F),this.#a.set(E),this.#t=!0;break}}connect(){const t=this.#a();this.#t&&(this.#h(this.#i.$state.source(),t),this.#d(t),this.#t=!1),h(this.#n.bind(this)),h(this.#r.bind(this)),h(this.#c.bind(this)),h(this.#u.bind(this)),h(this.#l.bind(this))}#n(){this.#i.notify("sources-change",[...os(this.#i.$props.src()),...this.#s()])}#r(){const{$state:t}=this.#i,e=t.sources(),s=u(t.source),i=this.#o(s,e);if(e[0]?.src&&!i.src&&!i.type){const{crossOrigin:r}=t,o=Ot(r()),l=new AbortController;return Promise.all(e.map(d=>S(d.src)&&d.type==="?"?fetch(d.src,{method:"HEAD",credentials:o,signal:l.signal}).then(c=>(d.type=c.headers.get("content-type")||"??",ce.set(d.src,d.type),d)).catch(()=>d):d)).then(d=>{if(l.signal.aborted)return;const c=this.#o(u(t.source),d);J(),c.src||this.#i.notify("error",{message:"Failed to load resource.",code:4})}),()=>l.abort()}J()}#o(t,e){let s={src:"",type:""},i=null,a=new V("sources-change",{detail:{sources:e}}),r=this.#e(),{started:o,paused:l,currentTime:d,quality:c,savedState:m}=this.#i.$state;for(const y of e){const v=r.find(E=>E.canPlay(y));if(v){s=y,i=v;break}}if(le(s)){const y=c(),v=e.find(E=>E.src===y?.src);u(o)?m.set({paused:u(l),currentTime:u(d)}):m.set(null),v&&(s=v,a=new V("quality-change",{detail:{quality:y}}))}return ls(t,s)||this.#h(s,i,a),i!==u(this.#a)&&this.#d(i,a),s}#h(t,e,s){this.#i.notify("source-change",t,s),this.#i.notify("media-type-change",e?.mediaType(t)||"unknown",s)}#d(t,e){this.#i.$providerSetup.set(!1),this.#i.notify("provider-change",null,e),t&&u(()=>t.preconnect?.(this.#i)),this.#a.set(t),this.#i.notify("provider-loader-change",t,e)}#c(){const t=this.#i.$provider();if(!(!t||u(this.#i.$providerSetup))){if(this.#i.$state.canLoad()){It(()=>t.setup(),t.scope),this.#i.$providerSetup.set(!0);return}u(()=>t.preconnect?.())}}#u(){if(!this.#i.$providerSetup())return;const t=this.#i.$provider(),e=this.#i.$state.source(),s=u(this.#i.$state.crossOrigin),i=u(this.#i.$props.preferNativeHLS);if(!ls(t?.currentSrc,e)){if(this.#i.$state.canLoad()){const a=new AbortController;return Zt(e)?(i||!Fe())&&rs(e.src,{credentials:Ot(s),signal:a.signal}).then(r=>{this.#i.notify("stream-type-change",r)}).catch(Ve):Jt(e)?sa(e.src,{credentials:Ot(s),signal:a.signal}).then(r=>{this.#i.notify("stream-type-change",r)}).catch(Ve):this.#i.notify("stream-type-change","on-demand"),u(()=>{const r=u(this.#i.$state.preload);return t?.loadSource(e,r).catch(o=>{})}),()=>a.abort()}try{S(e.src)&&St(new URL(e.src).origin)}catch{}}}#l(){const t=this.#a(),{providedPoster:e,source:s,canLoadPoster:i}=this.#i.$state;if(!t||!t.loadPoster||!s()||!i()||e())return;const a=new AbortController,r=new V("source-change",{detail:s});return t.loadPoster(s(),this.#i,a).then(o=>{this.#i.notify("poster-change",o||"",r)}).catch(()=>{this.#i.notify("poster-change","",r)}),()=>{a.abort()}}}function os(n){return(Q(n)?n:[n]).map(t=>S(t)?{src:t,type:hs(t)}:{...t,type:hs(t.src,t.type)})}function hs(n,t){return S(t)&&t.length?t:S(n)&&ce.has(n)?ce.get(n):!t&&Zt({src:n,type:""})?"application/x-mpegurl":!t&&Jt({src:n,type:""})?"application/dash+xml":!S(n)||n.startsWith("blob:")?"video/object":n.includes("youtube")||n.includes("youtu.be")?"video/youtube":n.includes("vimeo")&&!n.includes("progressive_redirect")&&!n.includes(".m3u8")?"video/vimeo":"?"}function ls(n,t){return n?.src===t?.src&&n?.type===t?.type}class ra{#t;#e;#s=[];constructor(t,e){this.#t=t,this.#e=e,h(this.#i.bind(this))}#i(){const t=this.#t();for(const e of this.#s)if(!t.some(s=>s.id===e.id)){const s=e.id&&this.#e.textTracks.getById(e.id);s&&this.#e.textTracks.remove(s)}for(const e of t){const s=e.id||Rt.createId(e);this.#e.textTracks.getById(s)||(e.id=s,this.#e.textTracks.add(e))}this.#s=t}}class ds extends g{static props={loaders:[]};static state=new it({loader:null});#t;#e;#s=T([]);#i=T([]);#a=null;onSetup(){this.#t=w(),this.#e=new na(this.#s,this.#t,this.$state.loader,this.$props.loaders())}onAttach(t){t.setAttribute("data-media-provider","")}onConnect(t){this.#e.connect(),new ra(this.#i,this.#t);const e=new ResizeObserver(bt(this.#h.bind(this)));e.observe(t);const s=new MutationObserver(this.#d.bind(this));s.observe(t,{attributes:!0,childList:!0}),this.#h(),this.#d(),k(()=>{e.disconnect(),s.disconnect()})}#n=-1;load(t){t?.setAttribute("aria-hidden","true"),window.cancelAnimationFrame(this.#n),this.#n=requestAnimationFrame(()=>this.#r(t)),k(()=>{window.cancelAnimationFrame(this.#n)})}#r(t){if(!this.scope)return;const e=this.$state.loader(),{$provider:s}=this.#t;this.#a===e&&e?.target===t&&u(s)||(this.#o(),this.#a=e,e&&(e.target=t||null),!(!e||!t)&&e.load(this.#t).then(i=>{this.scope&&u(this.$state.loader)===e&&this.#t.notify("provider-change",i)}))}onDestroy(){this.#a=null,this.#o()}#o(){this.#t?.notify("provider-change",null)}#h(){if(!this.el)return;const{player:t,$state:e}=this.#t,s=this.el.offsetWidth,i=this.el.offsetHeight;t&&(e.mediaWidth.set(s),e.mediaHeight.set(i),t.el&&(B(t.el,"--media-width",s+"px"),B(t.el,"--media-height",i+"px")))}#d(){const t=[],e=[],s=this.el.children;for(const i of s)if(!i.hasAttribute("data-vds")){if(i instanceof HTMLSourceElement){const a={id:i.id,src:i.src,type:i.type};for(const r of["id","src","width","height","bitrate","codec"]){const o=i.getAttribute(`data-${r}`);S(o)&&(a[r]=/id|src|codec/.test(r)?o:Number(o))}t.push(a)}else if(i instanceof HTMLTrackElement){const a={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||Rt.createId(a),...a})}}this.#s.set(t),this.#i.set(e),J()}}const oa=ds.prototype;q(oa,"load");class ha extends b(HTMLElement,ds){static tagName="media-provider";#t;#e=null;#s=null;onSetup(){this.#t=w(),this.setAttribute("keep-alive","")}onDestroy(){this.#s?.remove(),this.#s=null,this.#e?.remove(),this.#e=null}onConnect(){h(()=>{const t=this.$state.loader(),e=t?.name==="youtube",s=t?.name==="vimeo",i=e||s,a=t?.name==="google-cast",r=t?a?this.#r():i?this.#n():t.mediaType()==="audio"?this.#i():this.#a():null;if(this.#e!==r){const o=this.#e?.parentElement??this;this.#e?.remove(),this.#e=r,r&&o.prepend(r),i&&r&&h(()=>{const{nativeControls:l,viewType:d}=this.#t.$state,c=l(),m=d()==="audio";!c&&!m?(this.#s=this.querySelector(".vds-blocker"),this.#s||(this.#s=document.createElement("div"),this.#s.classList.add("vds-blocker"),r.after(this.#s))):(this.#s?.remove(),this.#s=null),p(r,"data-no-controls",!c)})}e?r?.classList.add("vds-youtube"):s&&r?.classList.add("vds-vimeo"),i||(this.#s?.remove(),this.#s=null),this.load(r)})}#i(){const t=this.#e instanceof HTMLAudioElement?this.#e:document.createElement("audio"),{controls:e,crossOrigin:s}=this.#t.$state;return h(()=>{p(t,"controls",e()),p(t,"crossorigin",s())}),t}#a(){const t=this.#e instanceof HTMLVideoElement?this.#e:document.createElement("video"),{crossOrigin:e,poster:s,nativeControls:i}=this.#t.$state,a=Y(()=>i()?"true":null),r=Y(()=>s()&&i()?s():null);return h(()=>{p(t,"controls",a()),p(t,"crossorigin",e()),p(t,"poster",r())}),t}#n(){const t=this.#e instanceof HTMLIFrameElement?this.#e:document.createElement("iframe"),{nativeControls:e}=this.#t.$state;return h(()=>p(t,"tabindex",e()?null:-1)),t}#r(){if(this.#e?.classList.contains("vds-google-cast"))return this.#e;const t=document.createElement("div");return t.classList.add("vds-google-cast"),import("./vidstack-Cj0I-Rec.js").then(({insertContent:e})=>{e(t,this.#t.$state)}),t}}f(Ji),f(ha);function ue(n,t){const e=String(n),s=e.length;if(s<t){const a=t-s;return`${"0".repeat(a)}${n}`}return e}function cs(n){const t=Math.trunc(n/3600),e=Math.trunc(n%3600/60),s=Math.trunc(n%60),i=Number((n-Math.trunc(n)).toPrecision(3));return{hours:t,minutes:e,seconds:s,fraction:i}}function Ht(n,{padHrs:t=null,padMins:e=null,showHrs:s=!1,showMs:i=!1}={}){const{hours:a,minutes:r,seconds:o,fraction:l}=cs(n),d=t?ue(a,2):a,c=e||lt(e)&&n>=3600?ue(r,2):r,m=ue(o,2),y=i&&l>0?`.${String(l).replace(/^0?\./,"")}`:"",v=`${c}:${m}${y}`;return a>0||s?`${d}:${v}`:v}function Gt(n){const t=[],{hours:e,minutes:s,seconds:i}=cs(n);return e>0&&t.push(`${e} hour`),s>0&&t.push(`${s} min`),(i>0||t.length===0)&&t.push(`${i} sec`),t.join(" ")}class la extends g{static props={translations:null};static state=new it({label:null,busy:!1});#t;#e=!1;onSetup(){this.#t=w()}onAttach(t){t.style.display="contents"}onConnect(t){t.setAttribute("data-media-announcer",""),x(t,"role","status"),x(t,"aria-live","polite");const{busy:e}=this.$state;this.setAttributes({"aria-busy":()=>e()?"true":null}),this.#e=!0,h(this.#s.bind(this)),h(this.#r.bind(this)),h(this.#n.bind(this)),h(this.#i.bind(this)),h(this.#a.bind(this)),h(this.#d.bind(this)),h(this.#u.bind(this)),J(),this.#e=!1}#s(){const{paused:t}=this.#t.$state;this.#l(t()?"Pause":"Play")}#i(){const{fullscreen:t}=this.#t.$state;this.#l(t()?"Enter Fullscreen":"Exit Fullscreen")}#a(){const{pictureInPicture:t}=this.#t.$state;this.#l(t()?"Enter PiP":"Exit PiP")}#n(){const{textTrack:t}=this.#t.$state;this.#l(t()?"Closed-Captions On":"Closed-Captions Off")}#r(){const{muted:t,volume:e,audioGain:s}=this.#t.$state;this.#l(t()||e()===0?"Mute":`${Math.round(e()*(s()??1)*100)}% ${this.#c("Volume")}`)}#o=-1;#h=-1;#d(){const{seeking:t,currentTime:e}=this.#t.$state,s=t();this.#o>0?(window.clearTimeout(this.#h),this.#h=window.setTimeout(()=>{if(!this.scope)return;const i=u(e),a=Math.abs(i-this.#o);if(a>=1){const r=i>=this.#o,o=Gt(a);this.#l(`${this.#c(r?"Seek Forward":"Seek Backward")} ${o}`)}this.#o=-1,this.#h=-1},300)):s&&(this.#o=u(e))}#c(t){const{translations:e}=this.$props;return e?.()?.[t||""]??t}#u(){const{label:t,busy:e}=this.$state,s=this.#c(t());if(this.#e)return;e.set(!0);const i=window.setTimeout(()=>void e.set(!1),150);return this.el&&p(this.el,"aria-label",s),S(s)&&this.dispatch("change",{detail:s}),()=>window.clearTimeout(i)}#l(t){const{label:e}=this.$state;e.set(t)}}class da extends b(HTMLElement,la){static tagName="media-announcer"}class ca extends U{#t;constructor(t){super(),this.#t=t}onAttach(t){const{$props:e,ariaKeys:s}=w(),i=t.getAttribute("aria-keyshortcuts");if(i){s[this.#t]=i,k(()=>{delete s[this.#t]});return}const a=e.keyShortcuts()[this.#t];if(a){const r=Q(a)?a.join(" "):S(a)?a:a?.keys;t.setAttribute("aria-keyshortcuts",Q(r)?r.join(" "):r)}}}class N extends U{static props={disabled:!1};#t;constructor(t){super(),this.#t=t,new z,t.keyShortcut&&new ca(t.keyShortcut)}onSetup(){const{disabled:t}=this.$props;this.setAttributes({"data-pressed":this.#t.isPresssed,"aria-pressed":this.#e.bind(this),"aria-disabled":()=>t()?"true":null})}onAttach(t){x(t,"tabindex","0"),x(t,"role","button"),x(t,"type","button")}onConnect(t){const e=nt(t,this.#i.bind(this));for(const s of["click","touchstart"])e.add(s,this.#a.bind(this),{passive:!0})}#e(){return Vt(this.#t.isPresssed())}#s(t){zs(this.#t.isPresssed)&&this.#t.isPresssed.set(e=>!e)}#i(t){if(this.$props.disabled()||this.el.hasAttribute("data-disabled")){t.preventDefault(),t.stopImmediatePropagation();return}t.preventDefault(),(this.#t.onPress??this.#s).call(this,t)}#a(t){this.$props.disabled()&&(t.preventDefault(),t.stopImmediatePropagation())}}class ua extends g{static props=N.props;#t;constructor(){super(),new N({isPresssed:this.#s.bind(this),onPress:this.#e.bind(this)})}onSetup(){this.#t=w();const{canAirPlay:t,isAirPlayConnected:e}=this.#t.$state;this.setAttributes({"data-active":e,"data-supported":t,"data-state":this.#i.bind(this),"aria-hidden":D(()=>!t())})}onAttach(t){t.setAttribute("data-media-tooltip","airplay"),at(t,this.#a.bind(this))}#e(t){this.#t.remote.requestAirPlay(t)}#s(){const{remotePlaybackType:t,remotePlaybackState:e}=this.#t.$state;return t()==="airplay"&&e()!=="disconnected"}#i(){const{remotePlaybackType:t,remotePlaybackState:e}=this.#t.$state;return t()==="airplay"&&e()}#a(){const{remotePlaybackState:t}=this.#t.$state;return`AirPlay ${t()}`}}class pa extends b(HTMLElement,ua){static tagName="media-airplay-button"}class ma extends g{static props=N.props;#t;constructor(){super(),new N({isPresssed:this.#s.bind(this),keyShortcut:"toggleCaptions",onPress:this.#e.bind(this)})}onSetup(){this.#t=w(),this.setAttributes({"data-active":this.#s.bind(this),"data-supported":()=>!this.#i(),"aria-hidden":D(this.#i.bind(this))})}onAttach(t){t.setAttribute("data-media-tooltip","caption"),at(t,"Captions")}#e(t){this.#t.remote.toggleCaptions(t)}#s(){const{textTrack:t}=this.#t.$state,e=t();return!!e&&R(e)}#i(){const{hasCaptions:t}=this.#t.$state;return!t()}}class fa extends b(HTMLElement,ma){static tagName="media-caption-button"}class ga extends g{static props={...N.props,target:"prefer-media"};#t;constructor(){super(),new N({isPresssed:this.#s.bind(this),keyShortcut:"toggleFullscreen",onPress:this.#e.bind(this)})}onSetup(){this.#t=w();const{fullscreen:t}=this.#t.$state,e=this.#i.bind(this);this.setAttributes({"data-active":t,"data-supported":e,"aria-hidden":D(()=>!e())})}onAttach(t){t.setAttribute("data-media-tooltip","fullscreen"),at(t,"Fullscreen")}#e(t){const e=this.#t.remote,s=this.$props.target();this.#s()?e.exitFullscreen(s,t):e.enterFullscreen(s,t)}#s(){const{fullscreen:t}=this.#t.$state;return t()}#i(){const{canFullscreen:t}=this.#t.$state;return t()}}class ba extends b(HTMLElement,ga){static tagName="media-fullscreen-button"}class ya extends g{static props=N.props;#t;constructor(){super(),new N({isPresssed:this.#s.bind(this),onPress:this.#e.bind(this)})}onSetup(){this.#t=w();const{canGoogleCast:t,isGoogleCastConnected:e}=this.#t.$state;this.setAttributes({"data-active":e,"data-supported":t,"data-state":this.#i.bind(this),"aria-hidden":D(()=>!t())})}onAttach(t){t.setAttribute("data-media-tooltip","google-cast"),at(t,this.#a.bind(this))}#e(t){this.#t.remote.requestGoogleCast(t)}#s(){const{remotePlaybackType:t,remotePlaybackState:e}=this.#t.$state;return t()==="google-cast"&&e()!=="disconnected"}#i(){const{remotePlaybackType:t,remotePlaybackState:e}=this.#t.$state;return t()==="google-cast"&&e()}#a(){const{remotePlaybackState:t}=this.#t.$state;return`Google Cast ${t()}`}}class wa extends b(HTMLElement,ya){static tagName="media-google-cast-button"}class Ta extends g{static props={disabled:!1};#t;constructor(){super(),new z}onSetup(){this.#t=w();const{disabled:t}=this.$props,{live:e,liveEdge:s}=this.#t.$state,i=()=>!e();this.setAttributes({"data-edge":s,"data-hidden":i,"aria-disabled":D(()=>t()||s()),"aria-hidden":D(i)})}onAttach(t){x(t,"tabindex","0"),x(t,"role","button"),x(t,"type","button"),t.setAttribute("data-media-tooltip","live")}onConnect(t){nt(t,this.#e.bind(this))}#e(t){const{disabled:e}=this.$props,{liveEdge:s}=this.#t.$state;e()||s()||this.#t.remote.seekToLiveEdge(t)}}class $a extends b(HTMLElement,Ta){static tagName="media-live-button"}class va extends g{static props=N.props;#t;constructor(){super(),new N({isPresssed:this.#s.bind(this),keyShortcut:"toggleMuted",onPress:this.#e.bind(this)})}onSetup(){this.#t=w(),this.setAttributes({"data-muted":this.#s.bind(this),"data-state":this.#i.bind(this)})}onAttach(t){t.setAttribute("data-media-mute-button",""),t.setAttribute("data-media-tooltip","mute"),at(t,"Mute")}#e(t){const e=this.#t.remote;this.#s()?e.unmute(t):e.mute(t)}#s(){const{muted:t,volume:e}=this.#t.$state;return t()||e()===0}#i(){const{muted:t,volume:e}=this.#t.$state,s=e();if(t()||s===0)return"muted";if(s>=.5)return"high";if(s<.5)return"low"}}class ka extends b(HTMLElement,va){static tagName="media-mute-button"}class Sa extends g{static props=N.props;#t;constructor(){super(),new N({isPresssed:this.#s.bind(this),keyShortcut:"togglePictureInPicture",onPress:this.#e.bind(this)})}onSetup(){this.#t=w();const{pictureInPicture:t}=this.#t.$state,e=this.#i.bind(this);this.setAttributes({"data-active":t,"data-supported":e,"aria-hidden":D(()=>!e())})}onAttach(t){t.setAttribute("data-media-tooltip","pip"),at(t,"PiP")}#e(t){const e=this.#t.remote;this.#s()?e.exitPictureInPicture(t):e.enterPictureInPicture(t)}#s(){const{pictureInPicture:t}=this.#t.$state;return t()}#i(){const{canPictureInPicture:t}=this.#t.$state;return t()}}class Pa extends b(HTMLElement,Sa){static tagName="media-pip-button"}class xa extends g{static props=N.props;#t;constructor(){super(),new N({isPresssed:this.#s.bind(this),keyShortcut:"togglePaused",onPress:this.#e.bind(this)})}onSetup(){this.#t=w();const{paused:t,ended:e}=this.#t.$state;this.setAttributes({"data-paused":t,"data-ended":e})}onAttach(t){t.setAttribute("data-media-tooltip","play"),at(t,"Play")}#e(t){const e=this.#t.remote;this.#s()?e.pause(t):e.play(t)}#s(){const{paused:t}=this.#t.$state;return!t()}}class Ca extends b(HTMLElement,xa){static tagName="media-play-button"}class Ea extends g{static props={disabled:!1,seconds:30};#t;constructor(){super(),new z}onSetup(){this.#t=w();const{seeking:t}=this.#t.$state,{seconds:e}=this.$props,s=this.#e.bind(this);this.setAttributes({seconds:e,"data-seeking":t,"data-supported":s,"aria-hidden":D(()=>!s())})}onAttach(t){x(t,"tabindex","0"),x(t,"role","button"),x(t,"type","button"),t.setAttribute("data-media-tooltip","seek"),at(t,this.#s.bind(this))}onConnect(t){nt(t,this.#i.bind(this))}#e(){const{canSeek:t}=this.#t.$state;return t()}#s(){const{seconds:t}=this.$props;return`Seek ${t()>0?"forward":"backward"} ${t()} seconds`}#i(t){const{seconds:e,disabled:s}=this.$props;if(s())return;const{currentTime:i}=this.#t.$state,a=i()+e();this.#t.remote.seek(a,t)}}class Aa extends b(HTMLElement,Ea){static tagName="media-seek-button"}class us extends g{static props={disabled:!1,defaultPressed:!1};#t=T(!1);get pressed(){return this.#t()}constructor(){super(),new N({isPresssed:this.#t})}}const Ma=us.prototype;$(Ma,"pressed");class qa extends b(HTMLElement,us){static tagName="media-toggle-button"}class La{priority=10;#t=null;#e;#s;constructor(t){this.#e=t}attach(){}canRender(){return!0}detach(){this.#s?.abort(),this.#s=void 0,this.#e.reset(),this.#t=null}changeTrack(t){!t||this.#t===t||(this.#s?.abort(),this.#s=new A(t),t.readyState<2?(this.#e.reset(),this.#s.add("load",()=>this.#i(t),{once:!0})):this.#i(t),this.#s.add("add-cue",e=>{this.#e.addCue(e.detail)}).add("remove-cue",e=>{this.#e.removeCue(e.detail)}),this.#t=t)}#i(t){this.#e.changeTrack({cues:[...t.cues],regions:[...t.regions]})}}class rt extends g{static props={textDir:"ltr",exampleText:"Captions look like this."};#t;static lib=T(null);onSetup(){this.#t=w(),this.setAttributes({"aria-hidden":D(this.#e.bind(this))})}onAttach(t){t.style.setProperty("pointer-events","none")}onConnect(t){rt.lib()||import("https://cdn.jsdelivr.net/npm/media-captions@next/dist/prod.js").then(e=>rt.lib.set(e)),h(this.#s.bind(this))}#e(){const{textTrack:t,remotePlaybackState:e,iOSControls:s}=this.#t.$state,i=t();return s()||e()==="connected"||!i||!R(i)}#s(){if(!rt.lib())return;const{viewType:t}=this.#t.$state;return t()==="audio"?this.#i():this.#o()}#i(){return h(this.#a.bind(this)),this.#c(null),()=>{this.el.textContent=""}}#a(){if(this.#e())return;this.#n();const{textTrack:t}=this.#t.$state;H(t(),"cue-change",this.#n.bind(this)),h(this.#r.bind(this))}#n(){this.el.textContent="",this.#p>=0&&this.#b();const{realCurrentTime:t,textTrack:e}=this.#t.$state,{renderVTTCueString:s}=rt.lib(),i=u(t),a=u(e).activeCues;for(const r of a){const o=this.#g(),l=this.#y();l.innerHTML=s(r,i),o.append(l),this.el.append(l)}}#r(){const{realCurrentTime:t}=this.#t.$state,{updateTimedVTTCueNodes:e}=rt.lib();e(this.el,t())}#o(){const{CaptionsRenderer:t}=rt.lib(),e=new t(this.el),s=new La(e);return this.#t.textRenderers.add(s),h(this.#h.bind(this,e)),h(this.#d.bind(this,e)),this.#c(e),()=>{this.el.textContent="",this.#t.textRenderers.remove(s),e.destroy()}}#h(t){t.dir=this.$props.textDir()}#d(t){if(this.#e())return;const{realCurrentTime:e,textTrack:s}=this.#t.$state;t.currentTime=e(),this.#p>=0&&s()?.activeCues[0]&&this.#b()}#c(t){const e=this.#t.player;if(!e)return;const s=this.#u.bind(this,t);H(e,"vds-font-change",s)}#u(t){if(this.#p>=0){this.#m();return}const{textTrack:e}=this.#t.$state;e()?.activeCues[0]?t?.update(!0):this.#l()}#l(){const t=this.#g();p(t,"data-example","");const e=this.#y();p(e,"data-example",""),e.textContent=this.$props.exampleText(),t?.append(e),this.el?.append(t),this.el?.setAttribute("data-example",""),this.#m()}#p=-1;#m(){window.clearTimeout(this.#p),this.#p=window.setTimeout(this.#b.bind(this),2500)}#b(){this.el?.removeAttribute("data-example"),this.el?.querySelector("[data-example]")&&(this.el.textContent=""),this.#p=-1}#g(){const t=document.createElement("div");return p(t,"data-part","cue-display"),t}#y(){const t=document.createElement("div");return p(t,"data-part","cue"),t}}class Ia extends b(HTMLElement,rt){static tagName="media-captions"}class Va extends g{static props={defaultText:""}}class Da extends b(HTMLElement,Va){static tagName="media-chapter-title";#t;#e;onSetup(){this.#t=w(),this.#e=T("")}onConnect(){const t=this.#t.textTracks;ci(t,"chapters",this.#e.set),h(this.#s.bind(this))}#s(){const{defaultText:t}=this.$props;this.textContent=this.#e()||t()}}class Ra extends g{static props={hideDelay:2e3,hideOnMouseLeave:!1};#t;onSetup(){this.#t=w(),h(this.#s.bind(this))}onAttach(t){const{pictureInPicture:e,fullscreen:s}=this.#t.$state;B(t,"pointer-events","none"),x(t,"role","group"),this.setAttributes({"data-visible":this.#i.bind(this),"data-fullscreen":s,"data-pip":e}),h(()=>{this.dispatch("change",{detail:this.#i()})}),h(this.#e.bind(this)),h(()=>{const i=s();for(const a of["top","right","bottom","left"])B(t,`padding-${a}`,i&&`env(safe-area-inset-${a})`)})}#e(){if(!this.el)return;const{nativeControls:t}=this.#t.$state,e=t();p(this.el,"aria-hidden",e?"true":null),B(this.el,"display",e?"none":null)}#s(){const{controls:t}=this.#t.player,{hideDelay:e,hideOnMouseLeave:s}=this.$props;t.defaultDelay=e()===2e3?this.#t.$props.controlsDelay():e(),t.hideOnMouseLeave=s()}#i(){const{controlsVisible:t}=this.#t.$state;return t()}}class Oa extends b(HTMLElement,Ra){static tagName="media-controls"}class Na extends g{onAttach(t){t.style.pointerEvents||B(t,"pointer-events","auto")}}class Fa extends b(HTMLElement,Na){static tagName="media-controls-group"}class Ha extends g{static props={disabled:!1,event:void 0,action:void 0};#t;#e=null;onSetup(){this.#t=w();const{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.#e=this.#t.player.el?.querySelector("[data-media-provider]"),h(this.#s.bind(this))}#s(){let t=this.$props.event(),e=this.$props.disabled();!this.#e||!t||e||(/^dbl/.test(t)&&(t=t.split(/^dbl/)[1]),(t==="pointerup"||t==="pointerdown")&&this.#t.$state.pointer()==="coarse"&&(t=t==="pointerup"?"touchend":"touchstart"),H(this.#e,t,this.#n.bind(this),{passive:!1}))}#i=0;#a=-1;#n(t){if(this.$props.disabled()||De(t)&&(t.button!==0||this.#t.activeMenu)||Lt(t)&&this.#t.activeMenu||ae(t)||!this.#o(t))return;if(t.MEDIA_GESTURE=!0,t.preventDefault(),!u(this.$props.event)?.startsWith("dbl"))this.#i===0&&setTimeout(()=>{this.#i===1&&this.#r(t)},250);else if(this.#i===1){queueMicrotask(()=>this.#r(t)),clearTimeout(this.#a),this.#i=0;return}this.#i===0&&(this.#a=window.setTimeout(()=>{this.#i=0},275)),this.#i++}#r(t){this.el.setAttribute("data-triggered",""),requestAnimationFrame(()=>{this.#h()&&this.#d(u(this.$props.action),t),requestAnimationFrame(()=>{this.el.removeAttribute("data-triggered")})})}#o(t){if(!this.el)return!1;if(De(t)||js(t)||Lt(t)){const e=Lt(t)?t.changedTouches[0]??t.touches[0]:void 0,s=e?.clientX??t.clientX,i=e?.clientY??t.clientY,a=this.el.getBoundingClientRect(),r=i>=a.top&&i<=a.bottom&&s>=a.left&&s<=a.right;return t.type.includes("leave")?!r:r}return!0}#h(){const t=this.#t.player.el.querySelectorAll("[data-media-gesture][data-triggered]");return Array.from(t).sort((e,s)=>+getComputedStyle(s).zIndex-+getComputedStyle(e).zIndex)[0]===this.el}#d(t,e){if(!t)return;const s=new V("will-trigger",{detail:t,cancelable:!0,trigger:e});if(this.dispatchEvent(s),s.defaultPrevented)return;const[i,a]=t.replace(/:([a-z])/,"-$1").split(":");t.includes(":fullscreen")?this.#t.remote.toggleFullscreen("prefer-media",e):t.includes("seek:")?this.#t.remote.seek(u(this.#t.$state.currentTime)+(+a||0),e):this.#t.remote[Ys(i)](e),this.dispatch("trigger",{detail:t,trigger:e})}}class Ga extends b(HTMLElement,Ha){static tagName="media-gesture"}class Ba extends g{static props={when:!1}}class Ka extends b(HTMLElement,Ba){static tagName="media-layout";#t;onSetup(){this.#t=w()}onConnect(){h(this.#e.bind(this))}#e(){const t=this.firstElementChild,e=t?.localName==="template",s=this.$props.when();if(!(Xs(s)?s:Y(()=>s(this.#t.player.state))())){e?(this.textContent="",this.appendChild(t)):ut(t)&&(t.style.display="none");return}e?this.append(t.content.cloneNode(!0)):ut(t)&&(t.style.display="")}}const I=st(),pe=st();class pt extends U{#t=new Set;#e=T("");#s=null;onValueChange;get values(){return Array.from(this.#t).map(t=>t.value())}get value(){return this.#e()}set value(t){this.#r(t)}onSetup(){K(pe,{add:this.#i.bind(this),remove:this.#a.bind(this)})}onAttach(t){G(I)||x(t,"role","radiogroup"),this.setAttributes({value:this.#e})}onDestroy(){this.#t.clear()}#i(t){this.#t.has(t)||(this.#t.add(t),t.onCheck=this.#n,t.check(t.value()===this.#e()))}#a(t){t.onCheck=null,this.#t.delete(t)}#n=this.#r.bind(this);#r(t,e){const s=u(this.#e);if(!t||t===s)return;const i=this.#o(s),a=this.#o(t);i?.check(!1,e),a?.check(!0,e),this.#e.set(t),this.onValueChange?.(t,e)}#o(t){for(const e of this.#t)if(t===u(e.value))return e;return null}}const _a=[1,1.25,1.5,1.75,2,2.5,3,4];class ps extends g{static props={normalLabel:"Disabled",gains:_a};#t;#e;#s;get value(){return this.#s.value}get disabled(){const{gains:t}=this.$props,{canSetAudioGain:e}=this.#t.$state;return!e()||t().length===0}constructor(){super(),this.#s=new pt,this.#s.onValueChange=this.#o.bind(this)}onSetup(){this.#t=w(),G(I)&&(this.#e=M(I))}onConnect(t){h(this.#i.bind(this)),h(this.#a.bind(this)),h(this.#n.bind(this))}getOptions(){const{gains:t,normalLabel:e}=this.$props;return t().map(s=>({label:s===1||s===null?e:String(s*100)+"%",value:s.toString()}))}#i(){this.#s.value=this.#r()}#a(){const{normalLabel:t}=this.$props,{audioGain:e}=this.#t.$state,s=e();this.#e?.hint.set(s===1||s==null?t():String(s*100)+"%")}#n(){this.#e?.disable(this.disabled)}#r(){const{audioGain:t}=this.#t.$state;return t()?.toString()??"1"}#o(t,e){if(this.disabled)return;const s=+t;this.#t.remote.changeAudioGain(s,e),this.dispatch("change",{detail:s,trigger:e})}}const me=ps.prototype;$(me,"value"),$(me,"disabled"),q(me,"getOptions");function wt(n,t){tt(()=>{if(!n.connectScope)return;const e=n.querySelector("template");e&&h(()=>{const s=n.getOptions();ne(e,s.length,(i,a)=>{const{label:r,value:o}=s[a],l=i.querySelector('[data-part="label"]');i.setAttribute("value",o),l&&(S(r)?l.textContent=r:h(()=>{l.textContent=r()})),t?.(i,s[a],a)})})})}class Ua extends b(HTMLElement,ps){static tagName="media-audio-gain-radio-group";onConnect(){wt(this)}}class ms extends g{static props={emptyLabel:"Default"};#t;#e;#s;get value(){return this.#s.value}get disabled(){const{audioTracks:t}=this.#e.$state;return t().length<=1}constructor(){super(),this.#s=new pt,this.#s.onValueChange=this.#o.bind(this)}onSetup(){this.#e=w(),G(I)&&(this.#t=M(I))}onConnect(t){h(this.#i.bind(this)),h(this.#n.bind(this)),h(this.#a.bind(this))}getOptions(){const{audioTracks:t}=this.#e.$state;return t().map(e=>({track:e,label:e.label,value:e.label.toLowerCase()}))}#i(){this.#s.value=this.#r()}#a(){const{emptyLabel:t}=this.$props,{audioTrack:e}=this.#e.$state,s=e();this.#t?.hint.set(s?.label??t())}#n(){this.#t?.disable(this.disabled)}#r(){const{audioTrack:t}=this.#e.$state,e=t();return e?e.label.toLowerCase():""}#o(t,e){if(this.disabled)return;const s=this.#e.audioTracks.toArray().findIndex(i=>i.label.toLowerCase()===t);if(s>=0){const i=this.#e.audioTracks[s];this.#e.remote.changeAudioTrack(s,e),this.dispatch("change",{detail:i,trigger:e})}}}const fe=ms.prototype;$(fe,"value"),$(fe,"disabled"),q(fe,"getOptions");class Qa extends b(HTMLElement,ms){static tagName="media-audio-radio-group";onConnect(){wt(this)}}class fs extends g{static props={offLabel:"Off"};#t;#e;#s;get value(){return this.#s.value}get disabled(){const{hasCaptions:t}=this.#t.$state;return!t()}constructor(){super(),this.#s=new pt,this.#s.onValueChange=this.#o.bind(this)}onSetup(){this.#t=w(),G(I)&&(this.#e=M(I))}onConnect(t){super.onConnect?.(t),h(this.#i.bind(this)),h(this.#n.bind(this)),h(this.#a.bind(this))}getOptions(){const{offLabel:t}=this.$props,{textTracks:e}=this.#t.$state;return[{value:"off",label:t},...e().filter(R).map(s=>({track:s,label:s.label,value:this.#h(s)}))]}#i(){this.#s.value=this.#r()}#a(){const{offLabel:t}=this.$props,{textTrack:e}=this.#t.$state,s=e();this.#e?.hint.set(s&&R(s)&&s.mode==="showing"?s.label:t())}#n(){this.#e?.disable(this.disabled)}#r(){const{textTrack:t}=this.#t.$state,e=t();return e&&R(e)&&e.mode==="showing"?this.#h(e):"off"}#o(t,e){if(this.disabled)return;if(t==="off"){const i=this.#t.textTracks.selected;if(i){const a=this.#t.textTracks.indexOf(i);this.#t.remote.changeTextTrackMode(a,"disabled",e),this.dispatch("change",{detail:null,trigger:e})}return}const s=this.#t.textTracks.toArray().findIndex(i=>this.#h(i)===t);if(s>=0){const i=this.#t.textTracks[s];this.#t.remote.changeTextTrackMode(s,"showing",e),this.dispatch("change",{detail:i,trigger:e})}}#h(t){return t.id+":"+t.kind+"-"+t.label.toLowerCase()}}const ge=fs.prototype;$(ge,"value"),$(ge,"disabled"),q(ge,"getOptions");class Wa extends b(HTMLElement,fs){static tagName="media-captions-radio-group";onConnect(){wt(this)}}var za=Object.defineProperty,ja=Object.getOwnPropertyDescriptor,be=(n,t,e,s)=>{for(var i=ja(t,e),a=n.length-1,r;a>=0;a--)(r=n[a])&&(i=r(t,e,i)||i);return i&&za(t,e,i),i};class Bt extends g{static props={thumbnails:null};#t;#e;#s;#i=T(null);#a=T([]);get value(){return this.#s.value}get disabled(){return!this.#a()?.length}constructor(){super(),this.#s=new pt,this.#s.onValueChange=this.#c.bind(this)}onSetup(){this.#t=w(),G(I)&&(this.#e=M(I));const{thumbnails:t}=this.$props;this.setAttributes({"data-thumbnails":()=>!!t()})}onAttach(t){this.#e?.attachObserver({onOpen:this.#n.bind(this)})}getOptions(){const{seekableStart:t,seekableEnd:e}=this.#t.$state,s=t(),i=e();return this.#a().map((a,r)=>({cue:a,value:r.toString(),label:a.text,startTime:Ht(Math.max(0,a.startTime-s)),duration:Gt(Math.min(i,a.endTime)-Math.max(s,a.startTime))}))}#n(){u(()=>this.#h())}onConnect(t){h(this.#h.bind(this)),h(this.#d.bind(this)),h(this.#r.bind(this)),jt(this.#t.textTracks,"chapters",this.#i.set)}#r(){const t=this.#i();if(!t)return;const e=this.#o.bind(this,t);return e(),new A(t).add("add-cue",e).add("remove-cue",e),()=>{this.#a.set([])}}#o(t){const{seekableStart:e,seekableEnd:s}=this.#t.$state,i=e(),a=s();this.#a.set([...t.cues].filter(r=>r.startTime<=a&&r.endTime>=i))}#h(){if(!this.#e?.expanded())return;if(!this.#i()){this.#s.value="-1";return}const{realCurrentTime:e,seekableStart:s,seekableEnd:i}=this.#t.$state,a=s(),r=i(),o=e(),l=this.#a().findIndex(d=>ui(d,o));this.#s.value=l.toString(),l>=0&&tt(()=>{if(!this.connectScope)return;const d=this.#a()[l],c=this.el.querySelector("[aria-checked='true']"),m=Math.max(a,d.startTime),y=Math.min(r,d.endTime)-m,v=Math.max(0,o-m)/y*100;c&&B(c,"--progress",L(v,3)+"%")})}#d(){this.#e?.disable(this.disabled)}#c(t,e){if(this.disabled||!e)return;const s=+t,i=this.#a(),{clipStartTime:a}=this.#t.$state;j(s)&&i?.[s]&&(this.#s.value=s.toString(),this.#t.remote.seek(i[s].startTime-a(),e),this.dispatch("change",{detail:i[s],trigger:e}))}}be([$],Bt.prototype,"value"),be([$],Bt.prototype,"disabled"),be([q],Bt.prototype,"getOptions");class Ya extends b(HTMLElement,Bt){static tagName="media-chapters-radio-group";onConnect(){wt(this,(t,e)=>{const{cue:s,startTime:i,duration:a}=e,r=t.querySelector(".vds-thumbnail,media-thumbnail"),o=t.querySelector('[data-part="start-time"]'),l=t.querySelector('[data-part="duration"]');o&&(o.textContent=i),l&&(l.textContent=a),r&&(r.setAttribute("time",s.startTime+""),h(()=>{const d=this.$props.thumbnails();"src"in r?r.src=d:S(d)&&r.setAttribute("src",d)}))})}}class ye extends g{static props={disabled:!1};#t;#e=T(null);get expanded(){return this.#t?.expanded()??!1}constructor(){super(),new z}onSetup(){this.#t=M(I)}onAttach(t){this.#t.attachMenuButton(this),h(this.#s.bind(this)),x(t,"type","button")}onConnect(t){h(this.#i.bind(this)),this.#a();const e=new MutationObserver(this.#a.bind(this));e.observe(t,{attributeFilter:["data-part"],childList:!0,subtree:!0}),k(()=>e.disconnect()),nt(t,s=>{this.dispatch("select",{trigger:s})})}#s(){this.#t.disableMenuButton(this.$props.disabled())}#i(){const t=this.#e();t&&h(()=>{const e=this.#t.hint();e&&(t.textContent=e)})}#a(){const t=this.el?.querySelector('[data-part="hint"]');this.#e.set(t??null)}}const Xa=ye.prototype;$(Xa,"expanded");class Ja extends b(HTMLElement,ye){static tagName="media-menu-button"}class gs extends U{#t;constructor(t){super(),this.#t=t,h(this.#e.bind(this))}onDestroy(){this.#a?.(),this.#a=null}#e(){const t=this.#t.trigger();if(!t){this.hide();return}const e=this.show.bind(this),s=this.hide.bind(this);this.#t.listen(t,e,s)}#s=-1;#i=-1;#a=null;show(t){this.#n(),window.cancelAnimationFrame(this.#i),this.#i=-1,this.#a?.(),this.#a=null,this.#s=window.setTimeout(()=>{this.#s=-1;const e=this.#t.content();e&&e.style.removeProperty("display"),u(()=>this.#t.onChange(!0,t))},this.#t.showDelay?.()??0)}hide(t){this.#n(),u(()=>this.#t.onChange(!1,t)),this.#i=requestAnimationFrame(()=>{this.#n(),this.#i=-1;const e=this.#t.content();if(e){const s=()=>{e.style.display="none",this.#a=null};if(Oi(e)){this.#a?.();const a=H(e,"animationend",s,{once:!0});this.#a=a}else s()}})}#n(){window.clearTimeout(this.#s),this.#s=-1}}const we=st(),Ct=st();function Za(n,t){const e=Js(n,t);for(const{el:s,top:i,left:a}of e)s.scroll({top:i,left:a,behavior:t.behavior})}function tn(n,t={}){Za(n,{scrollMode:"if-needed",block:"center",inline:"center",...t})}const en=["a[href]","[tabindex]","input","select","button"].map(n=>`${n}:not([aria-hidden='true'])`).join(","),sn=new Set(["Escape","Tab","ArrowUp","ArrowDown","Home","PageUp","End","PageDown","Enter"," "]);class an{#t=-1;#e=null;#s=[];#i;get items(){return this.#s}constructor(t){this.#i=t}attachMenu(t){H(t,"focus",this.#r.bind(this)),this.#e=t,k(()=>{this.#e=null})}listen(){this.#e&&(this.update(),new A(this.#e).add("keyup",this.#h.bind(this)).add("keydown",this.#d.bind(this)),k(()=>{this.#t=-1,this.#s=[]}))}update(){this.#t=0,this.#s=this.#u()}scroll(t=this.#n()){const e=this.#s[t];e&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{tn(e,{behavior:"smooth",boundary:s=>!s.hasAttribute("data-root")})})})}focusActive(t=!0){const e=this.#n();this.#a(e>=0?e:0,t)}#a(t,e=!0){this.#t=t,this.#s[t]?(this.#s[t].focus({preventScroll:!0}),e&&this.scroll(t)):this.#e?.focus({preventScroll:!0})}#n(){return this.#s.findIndex(t=>document.activeElement===t||t.getAttribute("role")==="menuitemradio"&&t.getAttribute("aria-checked")==="true")}#r(){this.#t>=0||(this.update(),this.focusActive())}#o(t){const e=t.target;if(Zs(t)&&e instanceof Element){const s=e.getAttribute("role");return!/a|input|select|button/.test(e.localName)&&!s}return sn.has(t.key)}#h(t){this.#o(t)&&(t.stopPropagation(),t.preventDefault())}#d(t){if(this.#o(t))switch(t.stopPropagation(),t.preventDefault(),t.key){case"Escape":this.#i.closeMenu(t);break;case"Tab":this.#a(this.#c(t.shiftKey?-1:1));break;case"ArrowUp":this.#a(this.#c(-1));break;case"ArrowDown":this.#a(this.#c(1));break;case"Home":case"PageUp":this.#a(0);break;case"End":case"PageDown":this.#a(this.#s.length-1);break}}#c(t){let e=this.#t;do e=(e+t+this.#s.length)%this.#s.length;while(this.#s[e]?.offsetParent===null);return e}#u(){if(!this.#e)return[];const t=this.#e.querySelectorAll(en),e=[],s=i=>i.getAttribute("role")==="menu";for(const i of t)ut(i)&&i.offsetParent!==null&&es(this.#e,i,s)&&e.push(i);return e}}var nn=Object.defineProperty,rn=Object.getOwnPropertyDescriptor,Et=(n,t,e,s)=>{for(var i=rn(t,e),a=n.length-1,r;a>=0;a--)(r=n[a])&&(i=r(t,e,i)||i);return i&&nn(t,e,i),i};let on=0;class Tt extends g{static props={showDelay:0};#t;#e;#s;#i=T(!1);#a=T(!1);#n=T(null);#r=T(null);#o;#h=new Set;#d=null;#c;#u;#l=!1;#p=T(!1);#m=new Set;get triggerElement(){return this.#n()}get contentElement(){return this.#r()}get isSubmenu(){return!!this.#o}constructor(){super();const{showDelay:t}=this.$props;this.#c=new gs({trigger:this.#n,content:this.#r,showDelay:t,listen:(e,s,i)=>{nt(e,r=>{this.#i()?i(r):s(r)});const a=this.#M();a&&nt(a,r=>{r.stopPropagation(),i(r)})},onChange:this.#v.bind(this)})}onSetup(){this.#t=w();const t=++on;this.#e=`media-menu-${t}`,this.#s=`media-menu-button-${t}`,this.#u=new an({closeMenu:this.close.bind(this)}),G(I)&&(this.#o=M(I)),this.#b(),this.setAttributes({"data-open":this.#i,"data-root":!this.isSubmenu,"data-submenu":this.isSubmenu,"data-disabled":this.#x.bind(this)}),K(I,{button:this.#n,content:this.#r,expanded:this.#i,hint:T(""),submenu:!!this.#o,disable:this.#E.bind(this),attachMenuButton:this.#y.bind(this),attachMenuItems:this.#T.bind(this),attachObserver:this.#$.bind(this),disableMenuButton:this.#P.bind(this),addSubmenu:this.#V.bind(this),onTransitionEvent:e=>{this.#m.add(e),k(()=>{this.#m.delete(e)})}})}onAttach(t){t.style.setProperty("display","contents")}onConnect(t){h(this.#g.bind(this)),this.isSubmenu&&this.#o?.addSubmenu(this)}onDestroy(){this.#n.set(null),this.#r.set(null),this.#d=null,this.#m.clear()}#b(){let t=-1,e=G(Ct)?M(Ct):null;K(Ct,{onDragStart:()=>{e?.onDragStart?.(),window.clearTimeout(t),t=-1,this.#l=!0},onDragEnd:()=>{e?.onDragEnd?.(),t=window.setTimeout(()=>{this.#l=!1,t=-1},300)}})}#g(){const t=this.#S();this.isSubmenu||this.#N(),this.#w(t),t&&(h(()=>{const{height:e}=this.#t.$state,s=this.#r();s&&B(s,"--player-height",e()+"px")}),this.#u.listen(),this.listen("pointerup",this.#A.bind(this)),H(window,"pointerup",this.#C.bind(this)))}#y(t){const e=t.el,s=this.isSubmenu,i=D(this.#x.bind(this));x(e,"tabindex",s?"-1":"0"),x(e,"role",s?"menuitem":"button"),p(e,"id",this.#s),p(e,"aria-haspopup","menu"),p(e,"aria-expanded","false"),p(e,"data-root",!this.isSubmenu),p(e,"data-submenu",this.isSubmenu),h(()=>{p(e,"data-open",this.#i()),p(e,"aria-disabled",i())}),this.#n.set(e),k(()=>{this.#n.set(null)})}#T(t){const e=t.el;e.style.setProperty("display","none"),p(e,"id",this.#e),x(e,"role","menu"),x(e,"tabindex","-1"),p(e,"data-root",!this.isSubmenu),p(e,"data-submenu",this.isSubmenu),this.#r.set(e),k(()=>this.#r.set(null)),h(()=>p(e,"data-open",this.#i())),this.#u.attachMenu(e),this.#w(!1);const i=this.#B.bind(this);this.isSubmenu?this.#o?.onTransitionEvent(i):(t.listen("transitionstart",i),t.listen("transitionend",i),t.listen("animationend",this.#N),t.listen("vds-menu-resize",this.#N))}#$(t){this.#d=t}#w(t){const e=u(this.#r);e&&p(e,"aria-hidden",Vt(!t))}#P(t){this.#p.set(t)}#f=!1;#v(t,e){if(this.#f=Ie(e),e?.stopPropagation(),this.#i()===t)return;if(this.#x()){t&&this.#c.hide(e);return}this.el?.dispatchEvent(new Event("vds-menu-resize",{bubbles:!0,composed:!0}));const s=this.#n(),i=this.#r();if(s&&(p(s,"aria-controls",t&&this.#e),p(s,"aria-expanded",Vt(t))),i&&p(i,"aria-labelledby",t&&this.#s),this.#i.set(t),this.#L(e),J(),this.#f){t?i?.focus():s?.focus();for(const a of[this.el,i])a&&a.setAttribute("data-keyboard","")}else for(const a of[this.el,i])a&&a.removeAttribute("data-keyboard");if(this.dispatch(t?"open":"close",{trigger:e}),t)!this.isSubmenu&&this.#t.activeMenu!==this&&(this.#t.activeMenu?.close(e),this.#t.activeMenu=this),this.#d?.onOpen?.(e);else{if(this.isSubmenu)for(const a of this.#h)a.close(e);else this.#t.activeMenu=null;this.#d?.onClose?.(e)}t&&requestAnimationFrame(this.#k.bind(this))}#k(){this.#F||this.#q||(this.#u.update(),requestAnimationFrame(()=>{this.#f?this.#u.focusActive():this.#u.scroll()}))}#S(){return!this.#x()&&this.#i()}#x(){return this.#a()||this.#p()}#E(t){this.#a.set(t)}#A(t){const e=this.#r();this.#l||e&&Je(e,t)||t.stopPropagation()}#C(t){const e=this.#r();this.#l||e&&Je(e,t)||this.close(t)}#M(){const t=this.el?.querySelector('[data-part="close-target"]');return this.el&&t&&es(this.el,t,e=>e.getAttribute("role")==="menu")?t:null}#L(t){this.isSubmenu||(this.#i()?this.#t.remote.pauseControls(t):this.#t.remote.resumeControls(t))}#V(t){this.#h.add(t),new A(t).add("open",this.#O).add("close",this.#H),k(this.#I)}#I=this.#R.bind(this);#R(t){this.#h.delete(t)}#q=!1;#O=this.#D.bind(this);#D(t){this.#q=!0;const e=this.#r();this.isSubmenu&&this.triggerElement?.setAttribute("aria-hidden","true");for(const s of this.#h)if(s!==t.target)for(const i of[s.el,s.triggerElement])i?.setAttribute("aria-hidden","true");if(e){const s=t.target.el;for(const i of e.children)i.contains(s)?i.setAttribute("data-open",""):i!==s&&i.setAttribute("data-hidden","")}}#H=this.#G.bind(this);#G(t){this.#q=!1;const e=this.#r();this.isSubmenu&&this.triggerElement?.setAttribute("aria-hidden","false");for(const s of this.#h)for(const i of[s.el,s.triggerElement])i?.setAttribute("aria-hidden","false");if(e)for(const s of e.children)s.removeAttribute("data-open"),s.removeAttribute("data-hidden")}#N=bt(()=>{const t=u(this.#r);if(!t)return;let e=0,s=getComputedStyle(t),i=[...t.children];for(const a of["paddingTop","paddingBottom","borderTopWidth","borderBottomWidth"])e+=parseFloat(s[a])||0;for(const a of i)if(ut(a)&&a.style.display==="contents")i.push(...a.children);else if(a.nodeType===3)e+=parseFloat(getComputedStyle(a).fontSize);else if(ut(a)){if(!Ze(a))continue;const r=getComputedStyle(a);e+=a.offsetHeight+(parseFloat(r.marginTop)||0)+(parseFloat(r.marginBottom)||0)}B(t,"--menu-height",e+"px")});#F=!1;#B(t){const e=this.#r();e&&t.propertyName==="height"&&(this.#F=t.type==="transitionstart",p(e,"data-transition",this.#F?"height":null),this.#i()&&this.#k());for(const s of this.#m)s(t)}open(t){u(this.#i)||(this.#c.show(t),J())}close(t){u(this.#i)&&(this.#c.hide(t),J())}}Et([$],Tt.prototype,"triggerElement"),Et([$],Tt.prototype,"contentElement"),Et([$],Tt.prototype,"isSubmenu"),Et([q],Tt.prototype,"open"),Et([q],Tt.prototype,"close");class hn extends b(HTMLElement,Tt){static tagName="media-menu"}class ln extends ye{}class dn extends b(HTMLElement,ln){static tagName="media-menu-item"}class cn extends g{static props={container:null,disabled:!1};#t=null;#e;onSetup(){this.#e=w(),K(Kt,{attach:this.#s.bind(this)})}onAttach(t){t.style.setProperty("display","contents")}onConnect(t){}onDestroy(){this.#t?.remove(),this.#t=null}#s(t){this.#a(!1),this.#t=t,tt(()=>{tt(()=>{this.connectScope&&h(this.#i.bind(this))})})}#i(){const{fullscreen:t}=this.#e.$state,{disabled:e}=this.$props;this.#a(e()==="fullscreen"?!t():!e())}#a(t){if(!this.#t)return;let e=this.#n(this.$props.container());if(!e)return;const s=this.#t.parentElement===e;p(this.#t,"data-portal",t),t?s||(this.#t.remove(),e.append(this.#t)):s&&this.#t.parentElement===e&&(this.#t.remove(),this.el?.append(this.#t))}#n(t){return ut(t)?t:t?document.querySelector(t):document.body}}const Kt=st();class un extends g{static props={placement:null,offset:0,alignOffset:0};#t;constructor(){super(),new z;const{placement:t}=this.$props;this.setAttributes({"data-placement":t})}onAttach(t){if(this.#t=M(I),this.#t.attachMenuItems(this),G(Kt)){const e=M(Kt);e&&(K(Kt,null),e.attach(t),k(()=>e.attach(null)))}}onConnect(t){h(this.#e.bind(this))}#e(){const{expanded:t}=this.#t;if(!this.el||!t())return;const e=this.$props.placement();if(!e)return;Object.assign(this.el.style,{position:"absolute",top:0,left:0,width:"max-content"});const{offset:s,alignOffset:i}=this.$props;k(ss(this.el,this.#i(),e,{offsetVarName:"media-menu",xOffset:i(),yOffset:s()})),k(this.#s.bind(this))}#s(){this.el&&(this.el.removeAttribute("style"),this.el.style.display="none")}#i(){return this.#t.button()}}class pn extends b(HTMLElement,un){static tagName="media-menu-items"}class mn extends b(HTMLElement,cn){static tagName="media-menu-portal";static attrs={disabled:{converter(t){return S(t)?t:t!==null}}}}function bs(n,t){return[...n].sort(t?gn:fn)}function fn(n,t){return n.height===t.height?(n.bitrate??0)-(t.bitrate??0):n.height-t.height}function gn(n,t){return t.height===n.height?(t.bitrate??0)-(n.bitrate??0):t.height-n.height}class ys extends g{static props={autoLabel:"Auto",hideBitrate:!1,sort:"descending"};#t;#e;#s;get value(){return this.#s.value}get disabled(){const{canSetQuality:t,qualities:e}=this.#t.$state;return!t()||e().length<=1}#i=Y(()=>{const{sort:t}=this.$props,{qualities:e}=this.#t.$state;return bs(e(),t()==="descending")});constructor(){super(),this.#s=new pt,this.#s.onValueChange=this.#o.bind(this)}onSetup(){this.#t=w(),G(I)&&(this.#e=M(I))}onConnect(t){h(this.#a.bind(this)),h(this.#r.bind(this)),h(this.#n.bind(this))}getOptions(){const{autoLabel:t,hideBitrate:e}=this.$props;return[{value:"auto",label:t},...this.#i().map(s=>{const i=s.bitrate&&s.bitrate>=0?`${L(s.bitrate/1e6,2)} Mbps`:null;return{quality:s,label:s.height+"p",value:this.#d(s),bitrate:()=>e()?null:i}})]}#a(){this.#s.value=this.#h()}#n(){const{autoLabel:t}=this.$props,{autoQuality:e,quality:s}=this.#t.$state,i=s()?s().height+"p":"";this.#e?.hint.set(e()?t()+(i?` (${i})`:""):i)}#r(){this.#e?.disable(this.disabled)}#o(t,e){if(this.disabled)return;if(t==="auto"){this.#t.remote.changeQuality(-1,e),this.dispatch("change",{detail:"auto",trigger:e});return}const{qualities:s}=this.#t.$state,i=u(s).findIndex(a=>this.#d(a)===t);if(i>=0){const a=u(s)[i];this.#t.remote.changeQuality(i,e),this.dispatch("change",{detail:a,trigger:e})}}#h(){const{quality:t,autoQuality:e}=this.#t.$state;if(e())return"auto";const s=t();return s?this.#d(s):"auto"}#d(t){return t.height+"_"+t.bitrate}}const Te=ys.prototype;$(Te,"value"),$(Te,"disabled"),q(Te,"getOptions");class bn extends b(HTMLElement,ys){static tagName="media-quality-radio-group";onConnect(){wt(this,(t,e)=>{const s=e.bitrate,i=t.querySelector('[data-part="bitrate"]');s&&i&&h(()=>{i.textContent=s()||""})})}}class ws extends g{static props={value:""};#t=T(!1);#e={value:this.$props.value,check:this.#r.bind(this),onCheck:null};get checked(){return this.#t()}constructor(){super(),new z}onSetup(){this.setAttributes({value:this.$props.value,"data-checked":this.#t,"aria-checked":D(this.#t)})}onAttach(t){const e=G(I);x(t,"tabindex",e?"-1":"0"),x(t,"role",e?"menuitemradio":"radio"),h(this.#a.bind(this))}onConnect(t){this.#i(),nt(t,this.#n.bind(this)),k(this.#s.bind(this))}#s(){It(()=>{M(pe).remove(this.#e)},this.connectScope)}#i(){M(pe).add(this.#e)}#a(){const{value:t}=this.$props,e=t();u(this.#t)&&this.#e.onCheck?.(e)}#n(t){u(this.#t)||(this.#o(!0,t),this.#h(t),this.#e.onCheck?.(u(this.$props.value),t))}#r(t,e){u(this.#t)!==t&&this.#o(t,e)}#o(t,e){this.#t.set(t),this.dispatch("change",{detail:t,trigger:e})}#h(t){this.dispatch("select",{trigger:t})}}const yn=ws.prototype;$(yn,"checked");class wn extends b(HTMLElement,ws){static tagName="media-radio"}class Ts extends g{static props={value:""};#t;get values(){return this.#t.values}get value(){return this.#t.value}set value(t){this.#t.value=t}constructor(){super(),this.#t=new pt,this.#t.onValueChange=this.#s.bind(this)}onSetup(){h(this.#e.bind(this))}#e(){this.#t.value=this.$props.value()}#s(t,e){const s=this.createEvent("change",{detail:t,trigger:e});this.dispatch(s)}}const $s=Ts.prototype;$($s,"values"),$($s,"value");class Tn extends b(HTMLElement,Ts){static tagName="media-radio-group"}const $n=[.25,.5,.75,1,1.25,1.5,1.75,2];class vs extends g{static props={normalLabel:"Normal",rates:$n};#t;#e;#s;get value(){return this.#s.value}get disabled(){const{rates:t}=this.$props,{canSetPlaybackRate:e}=this.#t.$state;return!e()||t().length===0}constructor(){super(),this.#s=new pt,this.#s.onValueChange=this.#o.bind(this)}onSetup(){this.#t=w(),G(I)&&(this.#e=M(I))}onConnect(t){h(this.#i.bind(this)),h(this.#a.bind(this)),h(this.#n.bind(this))}getOptions(){const{rates:t,normalLabel:e}=this.$props;return t().map(s=>({label:s===1?e:s+"\xD7",value:s.toString()}))}#i(){this.#s.value=this.#r()}#a(){const{normalLabel:t}=this.$props,{playbackRate:e}=this.#t.$state,s=e();this.#e?.hint.set(s===1?t():s+"\xD7")}#n(){this.#e?.disable(this.disabled)}#r(){const{playbackRate:t}=this.#t.$state;return t().toString()}#o(t,e){if(this.disabled)return;const s=+t;this.#t.remote.changePlaybackRate(s,e),this.dispatch("change",{detail:s,trigger:e})}}const $e=vs.prototype;$($e,"value"),$($e,"disabled"),q($e,"getOptions");class vn extends b(HTMLElement,vs){static tagName="media-speed-radio-group";onConnect(){wt(this)}}class kn extends g{static props={src:null,alt:null,crossOrigin:null};static state=new it({img:null,src:null,alt:null,crossOrigin:null,loading:!0,error:null,hidden:!1});#t;onSetup(){this.#t=w(),this.#o(),this.#h(),this.#d(),this.#i()}onAttach(t){t.style.setProperty("pointer-events","none"),h(this.#n.bind(this)),h(this.#o.bind(this)),h(this.#h.bind(this)),h(this.#d.bind(this)),h(this.#i.bind(this));const{started:e}=this.#t.$state;this.setAttributes({"data-visible":()=>!e()&&!this.$state.hidden(),"data-loading":this.#a.bind(this),"data-error":this.#e.bind(this),"data-hidden":this.$state.hidden})}onConnect(t){h(this.#s.bind(this)),h(this.#c.bind(this))}#e(){const{error:t}=this.$state;return!lt(t())}#s(){const{canLoadPoster:t,poster:e}=this.#t.$state;!t()&&e()&&St(e(),"preconnect")}#i(){const{src:t}=this.$props,{poster:e,nativeControls:s}=this.#t.$state;this.el&&p(this.el,"display",s()?"none":null),this.$state.hidden.set(this.#e()||!(t()||e())||s())}#a(){const{loading:t,hidden:e}=this.$state;return!e()&&t()}#n(){const t=this.$state.img();t&&(new A(t).add("load",this.#u.bind(this)).add("error",this.#l.bind(this)),t.complete&&this.#u())}#r="";#o(){const{poster:t}=this.#t.$props,{canLoadPoster:e,providedPoster:s,inferredPoster:i}=this.#t.$state,a=this.$props.src()||"",r=a||t()||i();this.#r===s()&&s.set(a),this.$state.src.set(e()&&r.length?r:null),this.#r=a}#h(){const{src:t}=this.$props,{alt:e}=this.$state,{poster:s}=this.#t.$state;e.set(t()||s()?this.$props.alt():null)}#d(){const{crossOrigin:t}=this.$props,{crossOrigin:e}=this.$state,{crossOrigin:s,poster:i}=this.#t.$state,a=t()!==null?t():s();e.set(/ytimg\.com|vimeo/.test(i()||"")?null:a===!0?"anonymous":a)}#c(){const{loading:t,error:e}=this.$state,{canLoadPoster:s,poster:i}=this.#t.$state;t.set(s()&&!!i()),e.set(null)}#u(){const{loading:t,error:e}=this.$state;t.set(!1),e.set(null)}#l(t){const{loading:e,error:s}=this.$state;e.set(!1),s.set(t)}}class Sn extends b(HTMLElement,kn){static tagName="media-poster";static attrs={crossOrigin:"crossorigin"};#t=document.createElement("img");onSetup(){this.$state.img.set(this.#t)}onConnect(){const{src:t,alt:e,crossOrigin:s}=this.$state;h(()=>{const{loading:i,hidden:a}=this.$state;this.#t.style.display=i()||a()?"none":""}),h(()=>{p(this.#t,"alt",e()),p(this.#t,"crossorigin",s()),p(this.#t,"src",t())}),this.#t.parentNode!==this&&this.prepend(this.#t)}}const mt=new it({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 ks(this.min,this.max,this.value)},get fillPercent(){return this.fillRate*100},get pointerRate(){return ks(this.min,this.max,this.pointerValue)},get pointerPercent(){return this.pointerRate*100}});function ks(n,t,e){const s=t-n,i=e-n;return s>0?i/s:0}const $t=st(()=>({}));class Ss extends U{#t;#e;constructor(t){super(),this.#t=t}onConnect(t){this.#e=new IntersectionObserver(e=>{this.#t.callback?.(e,this.#e)},this.#t),this.#e.observe(t),k(this.#s.bind(this))}#s(){this.#e?.disconnect(),this.#e=void 0}}function Pn(n,t,e,s){return Xt(n,L(e,gi(s)),t)}function xn(n,t,e,s){const i=Xt(0,e,1),a=t-n,r=a*i,o=r/s,l=s*Math.round(o);return n+l}const ve={Left:-1,ArrowLeft:-1,Up:1,ArrowUp:1,Right:1,ArrowRight:1,Down:-1,ArrowDown:-1};class Cn extends U{#t;#e;#s;constructor(t,e){super(),this.#t=t,this.#e=e}onSetup(){G(Ct)&&(this.#s=M(Ct))}onConnect(t){h(this.#d.bind(this,t)),h(this.#c.bind(this,t)),this.#t.swipeGesture&&h(this.#i.bind(this))}#i(){const{pointer:t}=this.#e.$state;if(t()!=="coarse"||!this.#t.swipeGesture()){this.#a=null;return}this.#a=this.#e.player.el?.querySelector("media-provider,[data-media-provider]"),this.#a&&new A(this.#a).add("touchstart",this.#o.bind(this),{passive:!0}).add("touchmove",this.#h.bind(this),{passive:!1})}#a=null;#n=null;#r=null;#o(t){this.#n=t.touches[0]}#h(t){if(lt(this.#n)||ae(t))return;const e=t.touches[0],s=e.clientX-this.#n.clientX,i=e.clientY-this.#n.clientY,a=this.$state.dragging();!a&&Math.abs(i)>5||a||(t.preventDefault(),Math.abs(s)>20&&(this.#n=e,this.#r=this.$state.value(),this.#$(this.#r,t)))}#d(t){const{hidden:e}=this.$props;H(t,"focus",this.#u.bind(this)),!(e()||this.#t.isDisabled())&&new A(t).add("keyup",this.#k.bind(this)).add("keydown",this.#v.bind(this)).add("pointerenter",this.#b.bind(this)).add("pointermove",this.#g.bind(this)).add("pointerleave",this.#y.bind(this)).add("pointerdown",this.#T.bind(this))}#c(t){this.#t.isDisabled()||!this.$state.dragging()||new A(document).add("pointerup",this.#E.bind(this),{capture:!0}).add("pointermove",this.#C.bind(this)).add("touchmove",this.#A.bind(this),{passive:!1})}#u(){this.#p(this.$state.value())}#l(t,e){const{value:s,min:i,max:a,dragging:r}=this.$state,o=Math.max(i(),Math.min(t,a()));s.set(o);const l=this.createEvent("value-change",{detail:o,trigger:e});if(this.dispatch(l),this.#t.onValueChange?.(l),r()){const d=this.createEvent("drag-value-change",{detail:o,trigger:e});this.dispatch(d),this.#t.onDragValueChange?.(d)}}#p(t,e){const{pointerValue:s,dragging:i}=this.$state;s.set(t),this.dispatch("pointer-value-change",{detail:t,trigger:e}),i()&&this.#l(t,e)}#m(t){let e,s=this.el.getBoundingClientRect(),{min:i,max:a}=this.$state;if(this.$props.orientation()==="vertical"){const{bottom:r,height:o}=s;e=(r-t.clientY)/o}else if(this.#n&&j(this.#r)){const{width:r}=this.#a.getBoundingClientRect(),o=(t.clientX-this.#n.clientX)/r,l=a()-i(),d=l*Math.abs(o);e=(o<0?this.#r-d:this.#r+d)/l}else{const{left:r,width:o}=s;e=(t.clientX-r)/o}return Math.max(i(),Math.min(a(),this.#t.roundValue(xn(i(),a(),e,this.#t.getStep()))))}#b(t){this.$state.pointing.set(!0)}#g(t){const{dragging:e}=this.$state;e()||this.#p(this.#m(t),t)}#y(t){this.$state.pointing.set(!1)}#T(t){if(t.button!==0)return;const e=this.#m(t);this.#$(e,t),this.#p(e,t)}#$(t,e){const{dragging:s}=this.$state;if(s())return;s.set(!0),this.#e.remote.pauseControls(e);const i=this.createEvent("drag-start",{detail:t,trigger:e});this.dispatch(i),this.#t.onDragStart?.(i),this.#s?.onDragStart?.()}#w(t,e){const{dragging:s}=this.$state;if(!s())return;s.set(!1),this.#e.remote.resumeControls(e);const i=this.createEvent("drag-end",{detail:t,trigger:e});this.dispatch(i),this.#t.onDragEnd?.(i),this.#n=null,this.#r=null,this.#s?.onDragEnd?.()}#P;#f=!1;#v(t){if(!Object.keys(ve).includes(t.key))return;const{key:s}=t,i=this.#S(t);if(!lt(i)){this.#p(i,t),this.#l(i,t);return}const a=this.#x(t);this.#f||(this.#f=s===this.#P,!this.$state.dragging()&&this.#f&&this.#$(a,t)),this.#p(a,t),this.#P=s}#k(t){if(!Object.keys(ve).includes(t.key)||!lt(this.#S(t)))return;const s=this.#f?this.$state.pointerValue():this.#x(t);this.#l(s,t),this.#w(s,t),this.#P="",this.#f=!1}#S(t){let e=t.key,{min:s,max:i}=this.$state;return e==="Home"||e==="PageUp"?s():e==="End"||e==="PageDown"?i():!t.metaKey&&/^[0-9]$/.test(e)?(i()-s())/10*Number(e):null}#x(t){const{key:e,shiftKey:s}=t;t.preventDefault(),t.stopPropagation();const{shiftKeyMultiplier:i}=this.$props,{min:a,max:r,value:o,pointerValue:l}=this.$state,d=this.#t.getStep(),c=this.#t.getKeyStep(),m=s?c*i():c,y=Number(ve[e]),v=m*y,E=this.#f?l():this.#t.getValue?.()??o(),F=(E+v)/d;return Math.max(a(),Math.min(r(),Number((d*F).toFixed(3))))}#E(t){if(t.button!==0)return;t.preventDefault(),t.stopImmediatePropagation();const e=this.#m(t);this.#p(e,t),this.#w(e,t)}#A(t){t.preventDefault()}#C=ht(t=>{this.#p(this.#m(t),t)},20,{leading:!0})}class _ extends U{static props={hidden:!1,disabled:!1,step:1,keyStep:1,orientation:"horizontal",shiftKeyMultiplier:5};#t;#e;#s=T(!0);#i=T(!0);constructor(t){super(),this.#e=t}onSetup(){this.#t=w();const t=new z;t.attach(this),this.$state.focused=t.focused.bind(t),G($t)||K($t,{default:"value"}),K(we,{orientation:this.$props.orientation,disabled:this.#e.isDisabled,preview:T(null)}),h(this.#r.bind(this)),h(this.#o.bind(this)),h(this.#h.bind(this)),this.#c(),new Cn(this.#e,this.#t).attach(this),new Ss({callback:this.#a.bind(this)}).attach(this)}onAttach(t){x(t,"role","slider"),x(t,"tabindex","0"),x(t,"autocomplete","off"),h(this.#u.bind(this))}onConnect(t){k(ts(t,this.#s.set)),h(this.#n.bind(this))}#a(t){this.#i.set(t[0].isIntersecting)}#n(){const{hidden:t}=this.$props;this.$state.hidden.set(t()||!this.#s()||!this.#i.bind(this))}#r(){const{dragging:t,value:e,min:s,max:i}=this.$state;u(t)||e.set(Pn(s(),i(),e(),this.#e.getStep()))}#o(){this.$state.step.set(this.#e.getStep())}#h(){if(!this.#e.isDisabled())return;const{dragging:t,pointing:e}=this.$state;t.set(!1),e.set(!1)}#d(){return Vt(this.#e.isDisabled())}#c(){const{orientation:t}=this.$props,{dragging:e,active:s,pointing:i}=this.$state;this.setAttributes({"data-dragging":e,"data-pointing":i,"data-active":s,"aria-disabled":this.#d.bind(this),"aria-valuemin":this.#e.aria.valueMin??this.$state.min,"aria-valuemax":this.#e.aria.valueMax??this.$state.max,"aria-valuenow":this.#e.aria.valueNow,"aria-valuetext":this.#e.aria.valueText,"aria-orientation":t})}#u(){const{fillPercent:t,pointerPercent:e}=this.$state;this.#l(L(t(),3),L(e(),3))}#l=bt((t,e)=>{this.el?.style.setProperty("--slider-fill",t+"%"),this.el?.style.setProperty("--slider-pointer",e+"%")})}class En extends g{static props={..._.props,step:25,keyStep:25,shiftKeyMultiplier:2,min:0,max:300};static state=mt;#t;onSetup(){this.#t=w(),K($t,{default:"percent",percent:(t,e)=>L(this.$state.value(),e)+"%"}),new _({getStep:this.$props.step,getKeyStep:this.$props.keyStep,roundValue:Math.round,isDisabled:this.#n.bind(this),aria:{valueNow:this.#e.bind(this),valueText:this.#s.bind(this)},onDragValueChange:this.#h.bind(this),onValueChange:this.#o.bind(this)}).attach(this),h(this.#i.bind(this)),h(this.#a.bind(this))}onAttach(t){t.setAttribute("data-media-audio-gain-slider",""),x(t,"aria-label","Audio Boost");const{canSetAudioGain:e}=this.#t.$state;this.setAttributes({"data-supported":e,"aria-hidden":D(()=>!e())})}#e(){const{value:t}=this.$state;return Math.round(t())}#s(){const{value:t}=this.$state;return t()+"%"}#i(){const{min:t,max:e}=this.$props;this.$state.min.set(t()),this.$state.max.set(e())}#a(){const{audioGain:t}=this.#t.$state,e=((t()??1)-1)*100;this.$state.value.set(e),this.dispatch("value-change",{detail:e})}#n(){const{disabled:t}=this.$props,{canSetAudioGain:e}=this.#t.$state;return t()||!e()}#r(t){if(!t.trigger)return;const e=L(1+t.detail/100,2);this.#t.remote.changeAudioGain(e,t)}#o(t){this.#r(t)}#h(t){this.#r(t)}}class An extends b(HTMLElement,En){static tagName="media-audio-gain-slider"}class Mn extends g{static props={..._.props,step:1,keyStep:1,shiftKeyMultiplier:1};static state=mt;#t;#e=Y(()=>{const{qualities:t}=this.#t.$state;return bs(t())});onSetup(){this.#t=w(),new _({getStep:this.$props.step,getKeyStep:this.$props.keyStep,roundValue:Math.round,isDisabled:this.#r.bind(this),aria:{valueNow:this.#s.bind(this),valueText:this.#i.bind(this)},onDragValueChange:this.#c.bind(this),onValueChange:this.#d.bind(this)}).attach(this),h(this.#a.bind(this)),h(this.#n.bind(this))}onAttach(t){t.setAttribute("data-media-quality-slider",""),x(t,"aria-label","Video Quality");const{qualities:e,canSetQuality:s}=this.#t.$state,i=Y(()=>s()&&e().length>0);this.setAttributes({"data-supported":i,"aria-hidden":D(()=>!i())})}#s(){const{value:t}=this.$state;return t()}#i(){const{quality:t}=this.#t.$state;if(!t())return"";const{height:e,bitrate:s}=t(),i=s&&s>0?`${(s/1e6).toFixed(2)} Mbps`:null;return e?`${e}p${i?` (${i})`:""}`:"Auto"}#a(){const t=this.#e();this.$state.max.set(Math.max(0,t.length-1))}#n(){let{quality:t}=this.#t.$state,e=this.#e(),s=Math.max(0,e.indexOf(t()));this.$state.value.set(s),this.dispatch("value-change",{detail:s})}#r(){const{disabled:t}=this.$props,{canSetQuality:e,qualities:s}=this.#t.$state;return t()||s().length<=1||!e()}#o=ht(this.#h.bind(this),25);#h(t){if(!t.trigger)return;const{qualities:e}=this.#t,s=u(this.#e)[t.detail];this.#t.remote.changeQuality(e.indexOf(s),t)}#d(t){this.#o(t)}#c(t){this.#o(t)}}class qn extends b(HTMLElement,Mn){static tagName="media-quality-slider"}class Ps extends g{static props={..._.props,step:.1,keyStep:5,shiftKeyMultiplier:2,pauseWhileDragging:!1,noSwipeGesture:!1,seekingRequestThrottle:100};static state=mt;#t;#e;#s=T(null);constructor(){super();const{noSwipeGesture:t}=this.$props;new _({swipeGesture:()=>!t(),getValue:this.#b.bind(this),getStep:this.#g.bind(this),getKeyStep:this.#y.bind(this),roundValue:this.#T,isDisabled:this.#$.bind(this),aria:{valueNow:this.#w.bind(this),valueText:this.#P.bind(this)},onDragStart:this.#u.bind(this),onDragValueChange:this.#l.bind(this),onDragEnd:this.#p.bind(this),onValueChange:this.#m.bind(this)})}onSetup(){this.#t=w(),K($t,{default:"time",value:this.#k.bind(this),time:this.#S.bind(this)}),this.setAttributes({"data-chapters":this.#a.bind(this)}),this.setStyles({"--slider-progress":this.#i.bind(this)}),h(this.#r.bind(this)),h(this.#n.bind(this))}onAttach(t){t.setAttribute("data-media-time-slider",""),x(t,"aria-label","Seek")}onConnect(t){h(this.#o.bind(this)),jt(this.#t.textTracks,"chapters",this.#s.set)}#i(){const{bufferedEnd:t,duration:e}=this.#t.$state;return L(Math.min(t()/Math.max(e(),1),1)*100,3)+"%"}#a(){const{duration:t}=this.#t.$state;return this.#s()?.cues.length&&Number.isFinite(t())&&t()>0}#n(){this.#e=ht(this.#h.bind(this),this.$props.seekingRequestThrottle())}#r(){if(this.$state.hidden())return;const{value:t,dragging:e}=this.$state,s=this.#b();u(e)||(t.set(s),this.dispatch("value-change",{detail:s}))}#o(){const t=this.#t.player.el,{preview:e}=M(we);t&&e()&&p(t,"data-preview",this.$state.active())}#h(t,e){this.#t.remote.seeking(t,e)}#d(t,e,s){this.#e.cancel();const{live:i}=this.#t.$state;if(i()&&e>=99){this.#t.remote.seekToLiveEdge(s);return}this.#t.remote.seek(t,s)}#c=!1;#u(t){const{pauseWhileDragging:e}=this.$props;if(e()){const{paused:s}=this.#t.$state;this.#c=!s(),this.#t.remote.pause(t)}}#l(t){this.#e(this.#f(t.detail),t)}#p(t){const{seeking:e}=this.#t.$state;u(e)||this.#h(this.#f(t.detail),t);const s=t.detail;this.#d(this.#f(s),s,t);const{pauseWhileDragging:i}=this.$props;i()&&this.#c&&(this.#t.remote.play(t),this.#c=!1)}#m(t){const{dragging:e}=this.$state;e()||!t.trigger||this.#p(t)}#b(){const{currentTime:t}=this.#t.$state;return this.#v(t())}#g(){const t=this.$props.step()/this.#t.$state.duration()*100;return Number.isFinite(t)?t:1}#y(){const t=this.$props.keyStep()/this.#t.$state.duration()*100;return Number.isFinite(t)?t:1}#T(t){return L(t,3)}#$(){const{disabled:t}=this.$props,{canSeek:e}=this.#t.$state;return t()||!e()}#w(){const{value:t}=this.$state;return Math.round(t())}#P(){const t=this.#f(this.$state.value()),{duration:e}=this.#t.$state;return Number.isFinite(t)?`${Gt(t)} out of ${Gt(e())}`:"live"}#f(t){const{duration:e}=this.#t.$state;return L(t/100*e(),5)}#v(t){const{liveEdge:e,duration:s}=this.#t.$state,i=Math.max(0,Math.min(1,e()?1:Math.min(t,s())/s()));return Number.isNaN(i)?0:Number.isFinite(i)?i*100:100}#k(t){const e=this.#f(t),{live:s,duration:i}=this.#t.$state;return Number.isFinite(e)?(s()?e-i():e).toFixed(0):"LIVE"}#S(t,e){const s=this.#f(t),{live:i,duration:a}=this.#t.$state,r=i()?s-a():s;return Number.isFinite(s)?`${r<0?"-":""}${Ht(Math.abs(r),e)}`:"LIVE"}}class xs extends g{static props={disabled:!1};#t;#e;#s;#i=null;#a=[];#n=T(null);#r=T([]);#o=T(-1);#h=T(-1);#d=0;get cues(){return this.#r()}get activeCue(){return this.#r()[this.#o()]||null}get activePointerCue(){return this.#r()[this.#h()]||null}onSetup(){this.#t=w(),this.#e=yt(Ps.state)}onAttach(t){jt(this.#t.textTracks,"chapters",this.#c.bind(this)),h(this.#E.bind(this))}onConnect(){k(()=>this.#u.bind(this))}onDestroy(){this.#c(null)}setRefs(t){if(this.#a=t,this.#s?.dispose(),this.#a.length===1){const e=this.#a[0];e.style.width="100%",e.style.setProperty("--chapter-fill","var(--slider-fill)"),e.style.setProperty("--chapter-progress","var(--slider-progress)")}else this.#a.length>0&&It(()=>this.#l(),this.#s=ti())}#c(t){u(this.#n)!==t&&(this.#u(),this.#n.set(t))}#u(){this.#a=[],this.#r.set([]),this.#o.set(-1),this.#h.set(-1),this.#d=0,this.#s?.dispose()}#l(){this.#a.length&&h(this.#p.bind(this))}#p(){const{hidden:t}=this.#e;t()||(h(this.#m.bind(this)),h(this.#b.bind(this)),h(this.#g.bind(this)),h(this.#w.bind(this)))}#m(){const t=this.#r();if(!t.length)return;let e,{seekableStart:s,seekableEnd:i}=this.#t.$state,a=s(),r=i()||t[t.length-1].endTime,o=r-a,l=100;for(let d=0;d<t.length;d++)if(e=t[d],this.#a[d]){const c=d===t.length-1?l:L((e.endTime-Math.max(a,e.startTime))/o*100,3);this.#a[d].style.width=c+"%",l-=c}}#b(){let{liveEdge:t,seekableStart:e,seekableEnd:s}=this.#t.$state,{fillPercent:i,value:a}=this.#e,r=this.#r(),o=t(),l=u(this.#o),d=r[l],c=o?this.#r.length-1:this.#$(d&&d.startTime/s()*100<=u(a)?l:0,i());o||!d?this.#y(0,r.length,100):c>l?this.#y(l,c,100):c<l&&this.#y(c+1,l+1,0);const m=o?100:this.#S(r[c],i(),e(),this.#k(r));this.#T(this.#a[c],m),this.#o.set(c)}#g(){let{hidden:t,pointerPercent:e}=this.#e;if(t()){this.#h.set(-1);return}const s=this.#$(0,e());this.#h.set(s)}#y(t,e,s){for(let i=t;i<e;i++)this.#T(this.#a[i],s)}#T(t,e){t&&(t.style.setProperty("--chapter-fill",e+"%"),p(t,"data-active",e>0&&e<100),p(t,"data-ended",e===100))}#$(t,e){let s=0,i=this.#r();if(e===0)return 0;if(e===100)return i.length-1;let{seekableStart:a}=this.#t.$state,r=a(),o=this.#k(i);for(let l=t;l<i.length;l++)if(s=this.#S(i[l],e,r,o),s>=0&&s<100)return l;return 0}#w(){this.#P(this.#f())}#P=bt(t=>{let e,s=this.#r(),{seekableStart:i}=this.#t.$state,a=i(),r=this.#k(s);for(let o=this.#d;o<this.#a.length;o++)if(e=this.#S(s[o],t,a,r),this.#a[o]?.style.setProperty("--chapter-progress",e+"%"),e<100){this.#d=o;break}});#f=Y(this.#v.bind(this));#v(){const{bufferedEnd:t,duration:e}=this.#t.$state;return L(Math.min(t()/Math.max(e(),1),1),3)*100}#k(t){const{seekableEnd:e}=this.#t.$state,s=e();return Number.isFinite(s)?s:t[t.length-1]?.endTime||0}#S(t,e,s,i){if(!t||this.#r().length===0)return 0;const r=i-s,o=Math.max(0,t.startTime-s),l=Math.min(i,t.endTime)-s,d=o/r,c=d*100,m=Math.min(1,d+(l-o)/r)*100;return Math.max(0,L(e>=m?100:(e-c)/(m-c)*100,3))}#x(t){let e=[],{seekableStart:s,seekableEnd:i,duration:a}=this.#t.$state,r=s(),o=i();t=t.filter(c=>c.startTime<=o&&c.endTime>=r);const l=t[0];l&&l.startTime>r&&e.push(new window.VTTCue(r,l.startTime,""));for(let c=0;c<t.length-1;c++){const m=t[c],y=t[c+1];if(e.push(m),y){const v=y.startTime-m.endTime;v>0&&e.push(new window.VTTCue(m.endTime,m.endTime+v,""))}}const d=t[t.length-1];if(d){e.push(d);const c=a();c>=0&&c-d.endTime>1&&e.push(new window.VTTCue(d.endTime,a(),""))}return e}#E(){const{source:t}=this.#t.$state;t(),this.#A()}#A(){if(!this.scope)return;const{disabled:t}=this.$props;if(t()){this.#r.set([]),this.#o.set(0),this.#d=0;return}const e=this.#n();if(e){const s=this.#M.bind(this);s(),new A(e).add("add-cue",s).add("remove-cue",s),h(this.#C.bind(this))}return this.#i=this.#I(),this.#i&&h(this.#L.bind(this)),()=>{this.#i&&(this.#i.textContent="",this.#i=null)}}#C(){this.#t.$state.duration(),this.#M()}#M=zt(()=>{const t=u(this.#n);!this.scope||!t||!t.cues.length||(this.#r.set(this.#x(t.cues)),this.#o.set(0),this.#d=0)},150,!0);#L(){const t=this.activePointerCue||this.activeCue;this.#i&&(this.#i.textContent=t?.text||"")}#V(){let t=this.el;for(;t&&t.getAttribute("role")!=="slider";)t=t.parentElement;return t}#I(){const t=this.#V();return t?t.querySelector('[data-part="chapter-title"]'):null}}const _t=xs.prototype;$(_t,"cues"),$(_t,"activeCue"),$(_t,"activePointerCue"),q(_t,"setRefs");class Ln extends b(HTMLElement,xs){static tagName="media-slider-chapters";#t=null;onConnect(){tt(()=>{if(!this.connectScope)return;const t=this.querySelector("template");t&&(this.#t=t,h(this.#e.bind(this)))})}#e(){if(!this.#t)return;const t=ne(this.#t,this.cues.length||1);this.setRefs(t)}}class At extends g{static props={..._.props,min:0,max:100,value:0};static state=mt;constructor(){super(),new _({getStep:this.$props.step,getKeyStep:this.$props.keyStep,roundValue:Math.round,isDisabled:this.$props.disabled,aria:{valueNow:this.#t.bind(this),valueText:this.#e.bind(this)}})}onSetup(){h(this.#s.bind(this)),h(this.#i.bind(this))}#t(){const{value:t}=this.$state;return Math.round(t())}#e(){const{value:t,max:e}=this.$state;return L(t()/e()*100,2)+"%"}#s(){const{value:t}=this.$props;this.$state.value.set(t())}#i(){const{min:t,max:e}=this.$props;this.$state.min.set(t()),this.$state.max.set(e())}}class In extends b(HTMLElement,At){static tagName="media-slider"}class Vn extends g{static props={offset:0,noClamp:!1};#t;onSetup(){this.#t=M(we);const{active:t}=yt(At.state);this.setAttributes({"data-visible":t})}onAttach(t){Object.assign(t.style,{position:"absolute",top:0,left:0,width:"max-content"})}onConnect(t){const{preview:e}=this.#t;e.set(t),k(()=>e.set(null)),h(this.#e.bind(this));const s=new ResizeObserver(this.#e.bind(this));s.observe(t),k(()=>s.disconnect())}#e=bt(()=>{const{disabled:t,orientation:e}=this.#t;if(t())return;const s=this.el,{offset:i,noClamp:a}=this.$props;s&&Dn(s,{clamp:!a(),offset:i(),orientation:e()})})}function Dn(n,{clamp:t,offset:e,orientation:s}){const i=getComputedStyle(n),a=parseFloat(i.width),r=parseFloat(i.height),o={top:null,right:null,bottom:null,left:null};if(o[s==="horizontal"?"bottom":"left"]=`calc(100% + var(--media-slider-preview-offset, ${e}px))`,s==="horizontal"){const l=a/2;if(!t)o.left=`calc(var(--slider-pointer) - ${l}px)`;else{const d=`max(0px, calc(var(--slider-pointer) - ${l}px))`,c=`calc(100% - ${a}px)`;o.left=`min(${d}, ${c})`}}else{const l=r/2;if(!t)o.bottom=`calc(var(--slider-pointer) - ${l}px)`;else{const d=`max(${l}px, calc(var(--slider-pointer) - ${l}px))`,c=`calc(100% - ${r}px)`;o.bottom=`min(${d}, ${c})`}}Object.assign(n.style,o)}class Rn extends b(HTMLElement,Vn){static tagName="media-slider-preview"}class On extends g{}class Nn extends b(HTMLElement,On){static tagName="media-slider-steps";#t=null;onConnect(t){tt(()=>{this.connectScope&&(this.#t=t.querySelector("template"),this.#t&&h(this.#e.bind(this)))})}#e(){if(!this.#t)return;const{min:t,max:e,step:s}=yt(mt),i=(e()-t())/s();ne(this.#t,Math.floor(i)+1)}}const et=new Map,Ut=new Map;class Pe{#t;#e;#s;$images=T([]);static create(t,e){const s=w();return new Pe(t,e,s)}constructor(t,e,s){this.#e=t,this.#s=e,this.#t=s,h(this.#i.bind(this))}#i(){const{canLoad:t}=this.#t.$state;if(!t())return;const e=this.#e();if(e){if(S(e)&&et.has(e)){const s=et.get(e);if(et.delete(e),et.set(e,s),et.size>99){const i=et.keys().next().value;et.delete(i)}this.$images.set(et.get(e))}else if(S(e)){const s=this.#s(),i=e+"::"+s;if(!Ut.has(i)){const a=new Promise(async(r,o)=>{try{const l=await fetch(e,{credentials:Ot(s)});if(l.headers.get("content-type")==="application/json"){const c=await l.json();if(Q(c))if(c[0]&&"text"in c[0])r(this.#r(c));else{for(let m=0;m<c.length;m++){const y=c[m];Z(ei(y),!1),Z("url"in y&&S(y.url),!1),Z("startTime"in y&&j(y.startTime),!1)}r(c)}else r(this.#n(c));return}import("https://cdn.jsdelivr.net/npm/media-captions@next/dist/prod.js").then(async({parseResponse:c})=>{try{const{cues:m}=await c(l);r(this.#r(m))}catch(m){o(m)}})}catch(l){o(l)}}).then(r=>(et.set(i,r),r)).catch(r=>{this.#c(e,r)}).finally(()=>{S(i)&&Ut.delete(i)});Ut.set(i,a)}Ut.get(i)?.then(a=>{this.$images.set(a||[])})}else if(Q(e))try{this.$images.set(this.#a(e))}catch(s){this.#c(e,s)}else try{this.$images.set(this.#n(e))}catch(s){this.#c(e,s)}return()=>{this.$images.set([])}}}#a(t){const e=this.#o();return t.map((s,i)=>(Z(s.url&&S(s.url)),Z("startTime"in s&&j(s.startTime)),{...s,url:S(s.url)?this.#h(s.url,e):s.url}))}#n(t){Z(S(t.url)),Z(Q(t.tiles)&&t.tiles?.length);const e=new URL(t.url),s=[],i="tile_width"in t?t.tile_width:t.tileWidth,a="tile_height"in t?t.tile_height:t.tileHeight;for(const r of t.tiles)s.push({url:e,startTime:"start"in r?r.start:r.startTime,width:i,height:a,coords:{x:r.x,y:r.y}});return s}#r(t){for(let i=0;i<t.length;i++){const a=t[i];Z("startTime"in a&&j(a.startTime)),Z("text"in a&&S(a.text))}const e=[],s=this.#o();for(const i of t){const[a,r]=i.text.split("#"),o=this.#d(r);e.push({url:this.#h(a,s),startTime:i.startTime,endTime:i.endTime,width:o?.w,height:o?.h,coords:o&&j(o.x)&&j(o.y)?{x:o.x,y:o.y}:void 0})}return e}#o(){let t=u(this.#e);return!S(t)||!/^https?:/.test(t)?location.href:t}#h(t,e){return/^https?:/.test(t)?new URL(t):new URL(t,e)}#d(t){if(!t)return{};const[e,s]=t.split("="),i=s?.split(","),a={};if(!e||!i)return null;for(let r=0;r<e.length;r++){const o=+i[r];isNaN(o)||(a[e[r]]=o)}return a}#c(t,e){}}class Fn extends g{static props={src:null,time:0,crossOrigin:null};static state=new it({src:"",img:null,thumbnails:[],activeThumbnail:null,crossOrigin:null,loading:!1,error:null,hidden:!1});media;#t;#e=[];onSetup(){this.media=w(),this.#t=Pe.create(this.$props.src,this.$state.crossOrigin),this.#i(),this.setAttributes({"data-loading":this.#o.bind(this),"data-error":this.#h.bind(this),"data-hidden":this.$state.hidden,"aria-hidden":D(this.$state.hidden)})}onConnect(t){h(this.#s.bind(this)),h(this.#d.bind(this)),h(this.#i.bind(this)),h(this.#a.bind(this)),h(this.#c.bind(this)),h(this.#u.bind(this))}#s(){const t=this.$state.img();t&&new A(t).add("load",this.#n.bind(this)).add("error",this.#r.bind(this))}#i(){const{crossOrigin:t}=this.$props,{crossOrigin:e}=this.$state,{crossOrigin:s}=this.media.$state,i=t()!==null?t():s();e.set(i===!0?"anonymous":i)}#a(){const{src:t,loading:e,error:s}=this.$state;return t()&&(e.set(!0),s.set(null)),()=>{this.#p(),e.set(!1),s.set(null)}}#n(){const{loading:t,error:e}=this.$state;this.#u(),t.set(!1),e.set(null)}#r(t){const{loading:e,error:s}=this.$state;e.set(!1),s.set(t)}#o(){const{loading:t,hidden:e}=this.$state;return!e()&&t()}#h(){const{error:t}=this.$state;return!lt(t())}#d(){const{hidden:t}=this.$state,{duration:e}=this.media.$state,s=this.#t.$images();t.set(this.#h()||!Number.isFinite(e())||s.length===0)}getTime(){return this.$props.time()}#c(){let t=this.#t.$images();if(!t.length)return;let e=this.getTime(),{src:s,activeThumbnail:i}=this.$state,a=-1,r=null;for(let o=t.length-1;o>=0;o--){const l=t[o];if(e>=l.startTime&&(!l.endTime||e<l.endTime)){a=o;break}}t[a]&&(r=t[a]),i.set(r),s.set(r?.url.href||"")}#u(){if(!this.scope||this.$state.hidden())return;const t=this.el,e=this.$state.img(),s=this.$state.activeThumbnail();if(!e||!s||!t)return;let i=s.width??e.naturalWidth,a=s?.height??e.naturalHeight,{maxWidth:r,maxHeight:o,minWidth:l,minHeight:d,width:c,height:m}=getComputedStyle(this.el);l==="100%"&&(l=parseFloat(c)+""),d==="100%"&&(d=parseFloat(m)+"");let y=Math.max(parseInt(l)/i,parseInt(d)/a),v=Math.min(Math.max(parseInt(l),parseInt(r))/i,Math.max(parseInt(d),parseInt(o))/a),E=!isNaN(v)&&v<1?v:y>1?y:1;this.#l(t,"--thumbnail-width",`${i*E}px`),this.#l(t,"--thumbnail-height",`${a*E}px`),this.#l(t,"--thumbnail-aspect-ratio",String(L(i/a,5))),this.#l(e,"width",`${e.naturalWidth*E}px`),this.#l(e,"height",`${e.naturalHeight*E}px`),this.#l(e,"transform",s.coords?`translate(-${s.coords.x*E}px, -${s.coords.y*E}px)`:""),this.#l(e,"max-width","none")}#l(t,e,s){t.style.setProperty(e,s),this.#e.push(()=>t.style.removeProperty(e))}#p(){for(const t of this.#e)t();this.#e=[]}}const Hn=re('<img loading="eager" decoding="async" aria-hidden="true">');class Cs extends b(HTMLElement,Fn){static tagName="media-thumbnail";static attrs={crossOrigin:"crossorigin"};#t;#e=this.#s();onSetup(){this.#t=w(),this.$state.img.set(this.#e)}onConnect(){const{src:t,crossOrigin:e}=this.$state;this.#e.parentNode!==this&&this.prepend(this.#e),h(()=>{p(this.#e,"src",t()),p(this.#e,"crossorigin",e())})}#s(){return oe(Hn)}}class Gn extends Cs{static tagName="media-slider-thumbnail";#t;#e;onSetup(){super.onSetup(),this.#t=w(),this.#e=yt(At.state)}onConnect(){super.onConnect(),h(this.#s.bind(this))}#s(){const{duration:t,clipStartTime:e}=this.#t.$state;this.time=e()+this.#e.pointerRate()*t()}}class Es extends g{static props={type:"pointer",format:null,showHours:!1,showMs:!1,padHours:null,padMinutes:null,decimalPlaces:2};#t;#e;#s;onSetup(){this.#s=yt(At.state),this.#t=M($t),this.#e=Y(this.getValueText.bind(this))}getValueText(){const{type:t,format:e,decimalPlaces:s,padHours:i,padMinutes:a,showHours:r,showMs:o}=this.$props,{value:l,pointerValue:d,min:c,max:m}=this.#s,y=e?.()??this.#t.default,v=t()==="current"?l():d();if(y==="percent"){const E=m()-c(),F=v/E*100;return(this.#t.percent??L)(F,s())+"%"}else return y==="time"?(this.#t.time??Ht)(v,{padHrs:i(),padMins:a(),showHrs:r(),showMs:o()}):(this.#t.value?.(v)??v.toFixed(2))+""}}const Bn=Es.prototype;q(Bn,"getValueText");class Kn extends b(HTMLElement,Es){static tagName="media-slider-value";static attrs={padMinutes:{converter:si}};onConnect(){h(()=>{this.textContent=this.getValueText()})}}class As extends g{static props={src:null,crossOrigin:null};static state=new it({video:null,src:null,crossOrigin:null,canPlay:!1,error:null,hidden:!1});#t;#e;get video(){return this.$state.video()}onSetup(){this.#t=w(),this.#e=yt(At.state),this.#a(),this.setAttributes({"data-loading":this.#n.bind(this),"data-hidden":this.$state.hidden,"data-error":this.#r.bind(this),"aria-hidden":D(this.$state.hidden)})}onAttach(t){h(this.#s.bind(this)),h(this.#i.bind(this)),h(this.#a.bind(this)),h(this.#o.bind(this)),h(this.#h.bind(this)),h(this.#u.bind(this))}#s(){const t=this.$state.video();t&&(t.readyState>=2&&this.#d(),new A(t).add("canplay",this.#d.bind(this)).add("error",this.#c.bind(this)))}#i(){const{src:t}=this.$state,{canLoad:e}=this.#t.$state;t.set(e()?this.$props.src():null)}#a(){const{crossOrigin:t}=this.$props,{crossOrigin:e}=this.$state,{crossOrigin:s}=this.#t.$state,i=t()!==null?t():s();e.set(i===!0?"anonymous":i)}#n(){const{canPlay:t,hidden:e}=this.$state;return!t()&&!e()}#r(){const{error:t}=this.$state;return!lt(t)}#o(){const{src:t,hidden:e}=this.$state,{canLoad:s,duration:i}=this.#t.$state;e.set(s()&&(!t()||this.#r()||!Number.isFinite(i())))}#h(){const{src:t,canPlay:e,error:s}=this.$state;t(),e.set(!1),s.set(null)}#d(t){const{canPlay:e,error:s}=this.$state;e.set(!0),s.set(null),this.dispatch("can-play",{trigger:t})}#c(t){const{canPlay:e,error:s}=this.$state;e.set(!1),s.set(t),this.dispatch("error",{trigger:t})}#u(){const{video:t,canPlay:e}=this.$state,{duration:s}=this.#t.$state,{pointerRate:i}=this.#e,a=t();e()&&a&&Number.isFinite(s())&&Number.isFinite(i())&&(a.currentTime=i()*s())}}const _n=As.prototype;$(_n,"video");const Un=re('<video muted playsinline preload="none" style="max-width: unset;"></video>');class Qn extends b(HTMLElement,As){static tagName="media-slider-video";#t;#e=this.#s();onSetup(){this.#t=w(),this.$state.video.set(this.#e)}onConnect(){const{canLoad:t}=this.#t.$state,{src:e,crossOrigin:s}=this.$state;this.#e.parentNode!==this&&this.prepend(this.#e),h(()=>{p(this.#e,"crossorigin",s()),p(this.#e,"preload",t()?"auto":"none"),p(this.#e,"src",e())})}#s(){return oe(Un)}}class Wn extends g{static props={..._.props,step:.25,keyStep:.25,shiftKeyMultiplier:2,min:0,max:2};static state=mt;#t;onSetup(){this.#t=w(),new _({getStep:this.$props.step,getKeyStep:this.$props.keyStep,roundValue:this.#n,isDisabled:this.#r.bind(this),aria:{valueNow:this.#e.bind(this),valueText:this.#s.bind(this)},onDragValueChange:this.#c.bind(this),onValueChange:this.#d.bind(this)}).attach(this),h(this.#i.bind(this)),h(this.#a.bind(this))}onAttach(t){t.setAttribute("data-media-speed-slider",""),x(t,"aria-label","Speed");const{canSetPlaybackRate:e}=this.#t.$state;this.setAttributes({"data-supported":e,"aria-hidden":D(()=>!e())})}#e(){const{value:t}=this.$state;return t()}#s(){const{value:t}=this.$state;return t()+"x"}#i(){const{min:t,max:e}=this.$props;this.$state.min.set(t()),this.$state.max.set(e())}#a(){const{playbackRate:t}=this.#t.$state,e=t();this.$state.value.set(e),this.dispatch("value-change",{detail:e})}#n(t){return L(t,2)}#r(){const{disabled:t}=this.$props,{canSetPlaybackRate:e}=this.#t.$state;return t()||!e()}#o=ht(this.#h.bind(this),25);#h(t){if(!t.trigger)return;const e=t.detail;this.#t.remote.changePlaybackRate(e,t)}#d(t){this.#o(t)}#c(t){this.#o(t)}}class zn extends b(HTMLElement,Wn){static tagName="media-speed-slider"}class jn extends b(HTMLElement,Ps){static tagName="media-time-slider"}class Yn extends g{static props={..._.props,keyStep:5,shiftKeyMultiplier:2};static state=mt;#t;onSetup(){this.#t=w();const{audioGain:t}=this.#t.$state;K($t,{default:"percent",value(e){return(e*(t()??1)).toFixed(2)},percent(e){return Math.round(e*(t()??1))}}),new _({getStep:this.$props.step,getKeyStep:this.$props.keyStep,roundValue:Math.round,isDisabled:this.#a.bind(this),aria:{valueMax:this.#i.bind(this),valueNow:this.#e.bind(this),valueText:this.#s.bind(this)},onDragValueChange:this.#d.bind(this),onValueChange:this.#h.bind(this)}).attach(this),h(this.#n.bind(this))}onAttach(t){t.setAttribute("data-media-volume-slider",""),x(t,"aria-label","Volume");const{canSetVolume:e}=this.#t.$state;this.setAttributes({"data-supported":e,"aria-hidden":D(()=>!e())})}#e(){const{value:t}=this.$state,{audioGain:e}=this.#t.$state;return Math.round(t()*(e()??1))}#s(){const{value:t,max:e}=this.$state,{audioGain:s}=this.#t.$state;return L(t()/e()*(s()??1)*100,2)+"%"}#i(){const{audioGain:t}=this.#t.$state;return this.$state.max()*(t()??1)}#a(){const{disabled:t}=this.$props,{canSetVolume:e}=this.#t.$state;return t()||!e()}#n(){const{muted:t,volume:e}=this.#t.$state,s=t()?0:e()*100;this.$state.value.set(s),this.dispatch("value-change",{detail:s})}#r=ht(this.#o.bind(this),25);#o(t){if(!t.trigger)return;const e=L(t.detail/100,3);this.#t.remote.changeVolume(e,t)}#h(t){this.#r(t)}#d(t){this.#r(t)}}class Xn extends b(HTMLElement,Yn){static tagName="media-volume-slider"}class Jn extends HTMLElement{rootPart=null;connectedCallback(){this.rootPart=Re(this.render(),this,{renderBefore:this.firstChild}),this.rootPart.setConnected(!0)}disconnectedCallback(){this.rootPart?.setConnected(!1),this.rootPart=null,Re(null,this)}}class Zn extends g{static props={size:96,trackWidth:8,fillPercent:50};onConnect(t){tt(()=>{if(!this.connectScope)return;const e=t.querySelector("svg"),s=e.firstElementChild,i=s.nextElementSibling;h(this.#t.bind(this,e,s,i))})}#t(t,e,s){const{size:i,trackWidth:a,fillPercent:r}=this.$props;p(t,"width",i()),p(t,"height",i()),p(e,"stroke-width",a()),p(s,"stroke-width",a()),p(s,"stroke-dashoffset",100-r())}}class tr extends b(Jn,Zn){static tagName="media-spinner";render(){return ii`
|
|
4
|
+
<svg fill="none" viewBox="0 0 120 120" aria-hidden="true" data-part="root">
|
|
5
|
+
<circle cx="60" cy="60" r="54" stroke="currentColor" data-part="track"></circle>
|
|
6
|
+
<circle
|
|
7
|
+
cx="60"
|
|
8
|
+
cy="60"
|
|
9
|
+
r="54"
|
|
10
|
+
stroke="currentColor"
|
|
11
|
+
pathLength="100"
|
|
12
|
+
stroke-dasharray="100"
|
|
13
|
+
data-part="track-fill"
|
|
14
|
+
></circle>
|
|
15
|
+
</svg>
|
|
16
|
+
`}}class er extends g{static props={type:"current",showHours:!1,padHours:null,padMinutes:null,remainder:!1,toggle:!1,hidden:!1};static state=new it({timeText:"",hidden:!1});#t;#e=T(null);#s=T(!0);#i=T(!0);onSetup(){this.#t=w(),this.#o();const{type:t}=this.$props;this.setAttributes({"data-type":t,"data-remainder":this.#c.bind(this)}),new Ss({callback:this.#a.bind(this)}).attach(this)}onAttach(t){t.hasAttribute("role")||h(this.#h.bind(this)),h(this.#o.bind(this))}onConnect(t){k(ts(t,this.#s.set)),h(this.#n.bind(this)),h(this.#r.bind(this))}#a(t){this.#i.set(t[0].isIntersecting)}#n(){const{hidden:t}=this.$props;this.$state.hidden.set(t()||!this.#s()||!this.#i())}#r(){if(!this.$props.toggle()){this.#e.set(null);return}this.el&&nt(this.el,this.#u.bind(this))}#o(){const{hidden:t,timeText:e}=this.$state,{duration:s}=this.#t.$state;if(t())return;const{type:i,padHours:a,padMinutes:r,showHours:o}=this.$props,l=this.#d(i()),d=s(),c=this.#c();if(!Number.isFinite(l+d)){e.set("LIVE");return}const m=c?Math.max(0,d-l):l,y=Ht(m,{padHrs:a(),padMins:r(),showHrs:o()});e.set((c?"-":"")+y)}#h(){if(!this.el)return;const{toggle:t}=this.$props;p(this.el,"role",t()?"timer":null),p(this.el,"tabindex",t()?0:null)}#d(t){const{bufferedEnd:e,duration:s,currentTime:i}=this.#t.$state;switch(t){case"buffered":return e();case"duration":return s();default:return i()}}#c(){return this.$props.remainder()&&this.#e()!==!1}#u(t){if(t.preventDefault(),this.#e()===null){this.#e.set(!this.$props.remainder());return}this.#e.set(e=>!e)}}class sr extends b(HTMLElement,er){static tagName="media-time";onConnect(){h(()=>{this.textContent=this.$state.timeText()})}}class ir extends g{}class ar extends b(HTMLElement,ir){static tagName="media-title";#t;onSetup(){this.#t=w()}onConnect(){h(this.#e.bind(this))}#e(){const{title:t}=this.#t.$state;this.textContent=t()}}const ft=st();class nr extends g{static props={placement:"top center",offset:0,alignOffset:0};constructor(){super(),new z;const{placement:t}=this.$props;this.setAttributes({"data-placement":t})}onAttach(t){this.#t(t),Object.assign(t.style,{position:"absolute",top:0,left:0,width:"max-content"})}onConnect(t){this.#t(t);const e=M(ft);k(()=>e.detachContent(t)),k(tt(()=>{this.connectScope&&h(this.#e.bind(this))}))}#t(t){M(ft).attachContent(t)}#e(){const{showing:t}=M(ft);if(!t())return;const{placement:e,offset:s,alignOffset:i}=this.$props;return ss(this.el,this.#s(),e(),{offsetVarName:"media-tooltip",xOffset:i(),yOffset:s()})}#s(){return M(ft).trigger()}}class rr extends b(HTMLElement,nr){static tagName="media-tooltip-content"}let or=0;class hr extends g{static props={showDelay:700};#t=`media-tooltip-${++or}`;#e=T(null);#s=T(null);#i=T(!1);constructor(){super(),new z;const{showDelay:t}=this.$props;new gs({trigger:this.#e,content:this.#s,showDelay:t,listen(e,s,i){h(()=>{Nt()&&H(e,"focus",s),H(e,"blur",i)}),new A(e).add("touchstart",a=>a.preventDefault(),{passive:!1}).add("mouseenter",s).add("mouseleave",i)},onChange:this.#h.bind(this)})}onAttach(t){t.style.setProperty("display","contents")}onSetup(){K(ft,{trigger:this.#e,content:this.#s,showing:this.#i,attachTrigger:this.#a.bind(this),detachTrigger:this.#n.bind(this),attachContent:this.#r.bind(this),detachContent:this.#o.bind(this)})}#a(t){this.#e.set(t);let e=t.getAttribute("data-media-tooltip");e&&this.el?.setAttribute(`data-media-${e}-tooltip`,""),p(t,"data-describedby",this.#t)}#n(t){t.removeAttribute("data-describedby"),t.removeAttribute("aria-describedby"),this.#e.set(null)}#r(t){t.setAttribute("id",this.#t),t.style.display="none",x(t,"role","tooltip"),this.#s.set(t)}#o(t){t.removeAttribute("id"),t.removeAttribute("role"),this.#s.set(null)}#h(t){const e=this.#e(),s=this.#s();e&&p(e,"aria-describedby",t?this.#t:null);for(const i of[this.el,e,s])i&&p(i,"data-visible",t);this.#i.set(t)}}class lr extends b(HTMLElement,hr){static tagName="media-tooltip"}class dr extends g{constructor(){super(),new z}onConnect(t){k(tt(()=>{if(!this.connectScope)return;this.#t();const e=M(ft);k(()=>{const s=this.#e();s&&e.detachTrigger(s)})}))}#t(){const t=this.#e(),e=M(ft);t&&e.attachTrigger(t)}#e(){const t=this.el.firstElementChild;return t?.localName==="button"||t?.getAttribute("role")==="button"?t:this.el}}class cr extends b(HTMLElement,dr){static tagName="media-tooltip-trigger";onConnect(){this.style.display="contents"}}f(Ka),f(Oa),f(Fa),f(Sn),f(da),f(lr),f(cr),f(rr),f(Ca),f(ka),f(fa),f(ba),f(Pa),f(Aa),f(pa),f(wa),f(qa),f(In),f(An),f(Xn),f(jn),f(zn),f(qn),f(Ln),f(Nn),f(Rn),f(Kn),f(Gn),f(Qn),f(hn),f(Ja),f(mn),f(pn),f(dn),f(Qa),f(Wa),f(vn),f(Ua),f(bn),f(Ya),f(Tn),f(wn),f(Ga),f(Cs),f(Ia),f($a),f(sr),f(ar),f(Da),f(tr);export{re as a,oe as c};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{l,n as m,i as u,q as C,d as S,D as c,a as p,H as g}from"./vidstack-pFwe7gvT.js";import{g as T}from"./vidstack-C51SKMUl.js";const b=Symbol(0),E=Symbol(0),A=Symbol(0),w=Symbol(0),O=Symbol(0),x=Symbol(0),N=Symbol(0),a={crossOrigin:b,readyState:E,updateActiveCues:A,canLoad:w,onModeChange:O,native:x,nativeHLS:N};function f(h,t){return t>=h.startTime&&t<h.endTime}function v(h,t,s){let e=null,i=C();function n(){const r=u(t)?[t]:t,o=h.toArray().find(d=>r.includes(d.kind)&&d.mode==="showing");if(o!==e){if(!o){s(null),e=null;return}o.readyState==2?s(o):(s(null),m(()=>{const d=l(o,"load",()=>{s(o),d()},{once:!0})},i)),e=o}}return n(),l(h,"mode-change",n)}function k(h,t,s){v(h,t,e=>{if(!e){s("");return}const i=()=>{const n=e?.activeCues[0];s(n?.text||"")};i(),l(e,"cue-change",i)})}class M extends S{static createId(t){return`vds-${t.type}-${t.kind}-${t.src??t.label??"?"}`}src;content;type;encoding;id="";label="";language="";kind;default=!1;#h=!1;#e=0;#i="disabled";#o={};#n=[];#t=[];#s=[];#r=new Set;[a.readyState]=0;[a.crossOrigin];[a.onModeChange]=null;[a.native]=null;get metadata(){return this.#o}get regions(){return this.#n}get cues(){return this.#t}get activeCues(){return this.#s}get readyState(){return this[a.readyState]}get mode(){return this.#i}set mode(t){this.setMode(t)}constructor(t){super();for(const s of Object.keys(t))this[s]=t[s];this.type||(this.type="vtt"),t.content?this.#f(t):t.src||(this[a.readyState]=2)}addCue(t,s){if(t.id){if(this.#r.has(t.id))return;this.#r.add(t.id)}let e=0,i=this.#t.length;for(e=0;e<i&&!(t.endTime<=this.#t[e].startTime);e++);e===i?this.#t.push(t):this.#t.splice(e,0,t),t instanceof TextTrackCue||this[a.native]?.track.addCue(t),this.dispatchEvent(new c("add-cue",{detail:t,trigger:s})),f(t,this.#e)&&this[a.updateActiveCues](this.#e,s)}removeCue(t,s){const e=this.#t.indexOf(t);if(e>=0){const i=this.#s.includes(t);t.id&&this.#r.delete(t.id),this.#t.splice(e,1),this[a.native]?.track.removeCue(t),this.dispatchEvent(new c("remove-cue",{detail:t,trigger:s})),i&&this[a.updateActiveCues](this.#e,s)}}setMode(t,s){this.#i!==t&&(this.#i=t,t==="disabled"?(this.#s=[],this.#u()):this.readyState===2?this[a.updateActiveCues](this.#e,s):this.#c(),this.dispatchEvent(new c("mode-change",{detail:this,trigger:s})),this[a.onModeChange]?.())}[a.updateActiveCues](t,s){if(this.#e=t,this.mode==="disabled"||!this.#t.length)return;const e=[];for(let n=0,r=this.#t.length;n<r;n++){const o=this.#t[n];f(o,t)&&e.push(o)}let i=e.length!==this.#s.length;if(!i){for(let n=0;n<e.length;n++)if(!this.#s.includes(e[n])){i=!0;break}}this.#s=e,i&&this.#u(s)}[a.canLoad](){this.#h=!0,this.#i!=="disabled"&&this.#c()}#f(t){import("https://cdn.jsdelivr.net/npm/media-captions@next/dist/prod.js").then(({parseText:s,VTTCue:e,VTTRegion:i})=>{if(!u(t.content)||t.type==="json")this.#l(t.content,e,i),this.readyState!==3&&this.#a();else{const n=t.content.split(`
|
|
2
|
+
`).map(r=>r.trim()).join(`
|
|
3
|
+
`).trim();s(n,{type:t.type}).then(({cues:r,regions:o})=>{this.#t=r,this.#n=o,this.#a()})}})}async#c(){if(!(!this.#h||this[a.readyState]>0)){if(this[a.readyState]=1,this.dispatchEvent(new c("load-start")),!this.src){this.#a();return}try{const{parseResponse:t,VTTCue:s,VTTRegion:e}=await import("https://cdn.jsdelivr.net/npm/media-captions@next/dist/prod.js"),i=this[a.crossOrigin]?.(),n=fetch(this.src,{headers:this.type==="json"?{"Content-Type":"application/json"}:void 0,credentials:T(i)});if(this.type==="json")this.#l(await(await n).text(),s,e);else{const{errors:r,metadata:o,regions:d,cues:y}=await t(n,{type:this.type,encoding:this.encoding});if(r[0]?.code===0)throw r[0];this.#o=o,this.#n=d,this.#t=y}this.#a()}catch(t){this.#d(t)}}}#a(){if(this[a.readyState]=2,!this.src||this.type!=="vtt"){const s=this[a.native];if(s&&!s.managed)for(const e of this.#t)s.track.addCue(e)}const t=new c("load");this[a.updateActiveCues](this.#e,t),this.dispatchEvent(t)}#d(t){this[a.readyState]=3,this.dispatchEvent(new c("error",{detail:t}))}#l(t,s,e){try{const{regions:i,cues:n}=j(t,s,e);this.#n=i,this.#t=n}catch(i){this.#d(i)}}#u(t){this.dispatchEvent(new c("cue-change",{trigger:t}))}}const _=/captions|subtitles/;function I(h){return _.test(h.kind)}function j(h,t,s){const e=u(h)?JSON.parse(h):h;let i=[],n=[];return e.regions&&s&&(i=e.regions.map(r=>Object.assign(new s,r))),(e.cues||p(e))&&(n=(p(e)?e:e.cues).filter(r=>g(r.startTime)&&g(r.endTime)).map(r=>Object.assign(new t(0,0,""),r))),{regions:i,cues:n}}export{a as T,M as a,v as b,f as c,I as i,k as w};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as n,C as o,aa as u}from"./vidstack-D40FSa5B.js";const s=navigator?.userAgent.toLowerCase()||"",i=/iphone|ipad|ipod|ios|crios|fxios/i.test(s),p=/(iphone|ipod)/gi.test(navigator?.platform||""),d=!!window.chrome,f=!!window.safari||i;function l(){return S()&&n(screen.orientation.unlock)}function S(){return!o(window.screen.orientation)&&!o(window.screen.orientation.lock)}function w(e,t){return e||(e=document.createElement("audio")),e.canPlayType(t).length>0}function m(e,t){return e||(e=document.createElement("video")),e.canPlayType(t).length>0}function y(e){return e||(e=document.createElement("video")),e.canPlayType("application/vnd.apple.mpegurl").length>0}function P(e){return e?!!document.pictureInPictureEnabled&&!e.disablePictureInPicture:!1}function g(e){return n(e?.webkitSupportsPresentationMode)&&n(e?.webkitSetPresentationMode)}async function I(){const e=document.createElement("video");return e.volume=.5,await u(0),e.volume===.5}function E(){return window?.ManagedMediaSource??window?.MediaSource??window?.WebKitMediaSource}function M(){return window?.SourceBuffer??window?.WebKitSourceBuffer}function a(){const e=E();if(o(e))return!1;const t=e&&n(e.isTypeSupported)&&e.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),r=M(),c=o(r)||!o(r.prototype)&&n(r.prototype.appendBuffer)&&n(r.prototype.remove);return!!t&&!!c}function T(){return a()}export{p as I,d as a,i as b,l as c,I as d,w as e,m as f,a as g,P as h,T as i,g as j,y as k,f as l};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as n}from"./vidstack-BYpysj84.js";import{l}from"./vidstack-uMxrPflF.js";import{a as c,b as p}from"./vidstack-DQvyz7Mm.js";import{a as g,b as d,i,d as m,e as h,f as y,c as f,j as C}from"./vidstack-CrqkytHl.js";import{p as w}from"./vidstack-D40FSa5B.js";class E{name="google-cast";target;#e;get cast(){return g()}mediaType(){return"video"}canPlay(e){return c&&!p&&n(e)}async prompt(e){let t,a,r;try{t=await this.#r(e),this.#e||(this.#e=new cast.framework.RemotePlayer,new cast.framework.RemotePlayerController(this.#e)),a=e.player.createEvent("google-cast-prompt-open",{trigger:t}),e.player.dispatchEvent(a),this.#t(e,"connecting",a),await this.#o(w(e.$props.googleCast)),e.$state.remotePlaybackInfo.set({deviceName:d()?.getCastDevice().friendlyName}),i()&&this.#t(e,"connected",a)}catch(o){const s=o instanceof Error?o:this.#a((o+"").toUpperCase(),"Prompt failed.");throw r=e.player.createEvent("google-cast-prompt-error",{detail:s,trigger:a??t,cancelable:!0}),e.player.dispatch(r),this.#t(e,i()?"connected":"disconnected",r),s}finally{e.player.dispatch("google-cast-prompt-close",{trigger:r??a??t})}}async load(e){if(!this.#e)throw Error("[vidstack] google cast player was not initialized");return new(await import("../providers/vidstack-google-cast-BdORATUX.js")).GoogleCastProvider(this.#e,e)}async#r(e){if(m())return;const t=e.player.createEvent("google-cast-load-start");e.player.dispatch(t),await l(h()),await customElements.whenDefined("google-cast-launcher");const a=e.player.createEvent("google-cast-loaded",{trigger:t});if(e.player.dispatch(a),!y())throw this.#a("CAST_NOT_AVAILABLE","Google Cast not available on this platform.");return a}async#o(e){this.#s(e);const t=await this.cast.requestSession();if(t)throw this.#a(t.toUpperCase(),f(t))}#s(e){this.cast?.setOptions({...C(),...e})}#t(e,t,a){const r={type:"google-cast",state:t};e.notify("remote-playback-change",r,a)}#a(e,t){const a=Error(t);return a.code=e,a}}export{E as GoogleCastLoader};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as a,e as o,l as n,E as h}from"./vidstack-pFwe7gvT.js";import"./vidstack-Cu8FqSS9.js";class c{#t;#s;#i;#e=a(!1);get supported(){return this.#e()}constructor(e,t){this.#t=e,this.#s=t,this.#r()}#r(){!this.#t?.remote||!this.canPrompt||(this.#t.remote.watchAvailability(e=>{this.#e.set(e)}).catch(()=>{this.#e.set(!1)}),o(this.#a.bind(this)))}#a(){if(!this.#e())return;const e=["connecting","connect","disconnect"],t=this.#o.bind(this);t(),n(this.#t,"playing",t);const s=new h(this.#t.remote);for(const r of e)s.add(r,t)}async prompt(){if(!this.supported)throw Error("Not supported on this platform.");return this.type==="airplay"&&this.#t.webkitShowPlaybackTargetPicker?this.#t.webkitShowPlaybackTargetPicker():this.#t.remote.prompt()}#o(e){const t=this.#t.remote.state;if(t===this.#i)return;const s={type:this.type,state:t};this.#s.notify("remote-playback-change",s,e),this.#i=t}}class p extends c{type="airplay";get canPrompt(){return"WebKitPlaybackTargetAvailabilityEvent"in window}}export{p as H};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{l as o}from"./vidstack-pFwe7gvT.js";function r(){return"https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1"}function i(){return!!window.cast?.framework}function c(){return!!window.chrome?.cast?.isAvailable}function u(){return e().getCastState()===cast.framework.CastState.CONNECTED}function e(){return window.cast.framework.CastContext.getInstance()}function a(){return e().getCurrentSession()}function n(){return a()?.getSessionObj().media[0]}function C(t){return n()?.media.contentId===t?.src}function d(){return{language:"en-US",autoJoinPolicy:chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,receiverApplicationId:chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,resumeSavedSession:!0,androidReceiverCompatible:!0}}function f(t){return`Google Cast Error Code: ${t}`}function g(t,s){return o(e(),t,s)}export{e as a,a as b,f as c,i as d,r as e,c as f,n as g,C as h,u as i,d as j,g as l};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{C as i,H as s}from"./vidstack-pFwe7gvT.js";class o{#i;#t;constructor(t){this.#t=t}start(){i(this.#i)&&this.#s()}stop(){s(this.#i)&&window.cancelAnimationFrame(this.#i),this.#i=void 0}#s(){this.#i=window.requestAnimationFrame(()=>{i(this.#i)||(this.#t(),this.#s())})}}export{o as R};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const I=Symbol(0);let Ut=!1,$e=!1,M=null,ft=null,L=null,k=0,ht=[],me={};const ts=()=>{},dt=0,Ze=1,qt=2,Xt=3;function es(){Ut=!0,queueMicrotask(Je)}function Je(){if(!ht.length){Ut=!1;return}$e=!0;for(let t=0;t<ht.length;t++)ht[t].$st!==dt&&ns(ht[t]);ht=[],Ut=!1,$e=!1}function ns(t){let e=[t];for(;t=t[I];)t.$e&&t.$st!==dt&&e.push(t);for(let n=e.length-1;n>=0;n--)Ce(e[n])}function ss(t){const e=Kt();return Ct(e,t.length?t.bind(null,pt.bind(e)):t,null)}function is(t){return Ct(M,t,null)}function Ge(t){return Ct(null,t,null)}function rs(){$e||Je()}function ve(){return M}function B(t,e){try{return Ct(e,t,null)}catch(n){ye(e,n);return}}function Qe(t,e=M){return e?.$cx[t]}function os(t,e,n=M){n&&(n.$cx={...n.$cx,[t]:e})}function xt(t){if(!t||!M)return t||ts;const e=M;return e.$d?Array.isArray(e.$d)?e.$d.push(t):e.$d=[e.$d,t]:e.$d=t,function(){e.$st!==Xt&&(t.call(null),Yt(e.$d)?e.$d=null:Array.isArray(e.$d)&&e.$d.splice(e.$d.indexOf(t),1))}}function pt(t=!0){if(this.$st!==Xt){if(this.$h)if(Array.isArray(this.$h))for(let e=this.$h.length-1;e>=0;e--)pt.call(this.$h[e]);else pt.call(this.$h);if(t){const e=this[I];e&&(Array.isArray(e.$h)?e.$h.splice(e.$h.indexOf(this),1):e.$h=null),ls(this)}}}function ls(t){t.$st=Xt,t.$d&&tn(t),t.$s&&Ee(t,0),t[I]=null,t.$s=null,t.$o=null,t.$h=null,t.$cx=me,t.$eh=null}function tn(t){try{if(Array.isArray(t.$d))for(let e=t.$d.length-1;e>=0;e--){const n=t.$d[e];n.call(n)}else t.$d.call(t.$d);t.$d=null}catch(e){ye(t,e)}}function Ct(t,e,n){const s=M,i=ft;M=t,ft=n;try{return e.call(t)}finally{M=s,ft=i}}function ye(t,e){if(!t||!t.$eh)throw e;let n=0,s=t.$eh.length,i=e;for(n=0;n<s;n++)try{t.$eh[n](i);break}catch(r){i=r}if(n===s)throw i}function be(){return this.$st===Xt?this.$v:(ft&&!this.$e&&(!L&&ft.$s&&ft.$s[k]==this?k++:L?L.push(this):L=[this]),this.$c&&Ce(this),this.$v)}function en(t){const e=Yt(t)?t(this.$v):t;if(this.$ch(this.$v,e)&&(this.$v=e,this.$o))for(let n=0;n<this.$o.length;n++)on(this.$o[n],qt);return this.$v}const we=function(){this[I]=null,this.$h=null,M&&M.append(this)},et=we.prototype;et.$cx=me,et.$eh=null,et.$c=null,et.$d=null,et.append=function(t){t[I]=this,this.$h?Array.isArray(this.$h)?this.$h.push(t):this.$h=[this.$h,t]:this.$h=t,t.$cx=t.$cx===me?this.$cx:{...this.$cx,...t.$cx},this.$eh&&(t.$eh=t.$eh?[...t.$eh,...this.$eh]:this.$eh)},et.dispose=function(){pt.call(this)};function Kt(){return new we}const nn=function(e,n,s){we.call(this),this.$st=n?qt:dt,this.$i=!1,this.$e=!1,this.$s=null,this.$o=null,this.$v=e,n&&(this.$c=n),s&&s.dirty&&(this.$ch=s.dirty)},Ae=nn.prototype;Object.setPrototypeOf(Ae,et),Ae.$ch=cs,Ae.call=be;function xe(t,e,n){return new nn(t,e,n)}function cs(t,e){return t!==e}function Yt(t){return typeof t=="function"}function Ce(t){if(t.$st===Ze)for(let e=0;e<t.$s.length&&(Ce(t.$s[e]),t.$st!==qt);e++);t.$st===qt?sn(t):t.$st=dt}function as(t){t.$h&&pt.call(t,!1),t.$d&&tn(t),t.$eh=t[I]?t[I].$eh:null}function sn(t){let e=L,n=k;L=null,k=0;try{as(t);const s=Ct(t,t.$c,t);rn(t),!t.$e&&t.$i?en.call(t,s):(t.$v=s,t.$i=!0)}catch(s){rn(t),ye(t,s)}finally{L=e,k=n,t.$st=dt}}function rn(t){if(L){if(t.$s&&Ee(t,k),t.$s&&k>0){t.$s.length=k+L.length;for(let n=0;n<L.length;n++)t.$s[k+n]=L[n]}else t.$s=L;let e;for(let n=k;n<t.$s.length;n++)e=t.$s[n],e.$o?e.$o.push(t):e.$o=[t]}else t.$s&&k<t.$s.length&&(Ee(t,k),t.$s.length=k)}function on(t,e){if(!(t.$st>=e)&&(t.$e&&t.$st===dt&&(ht.push(t),Ut||es()),t.$st=e,t.$o))for(let n=0;n<t.$o.length;n++)on(t.$o[n],Ze)}function Ee(t,e){let n,s;for(let i=e;i<t.$s.length;i++)n=t.$s[i],n.$o&&(s=n.$o.indexOf(t),n.$o[s]=n.$o[n.$o.length-1],n.$o.pop())}function Se(...t){}function ln(t){return t===null}function Zt(t){return typeof t>"u"}function us(t){return ln(t)||Zt(t)}function fs(t){return t?.constructor===Object}function hs(t){return typeof t=="number"&&!Number.isNaN(t)}function _e(t){return typeof t=="string"}function ds(t){return typeof t=="boolean"}function Oe(t){return typeof t=="function"}function Te(t){return Array.isArray(t)}const ps=Event,cn=Symbol("DOM_EVENT");class Re extends ps{[cn]=!0;detail;triggers=new gs;get trigger(){return this.triggers.source}get originEvent(){return this.triggers.origin}get isOriginTrusted(){return this.triggers.origin?.isTrusted??!1}constructor(e,...n){super(e,n[0]),this.detail=n[0]?.detail;const s=n[0]?.trigger;s&&this.triggers.add(s)}}class gs{chain=[];get source(){return this.chain[0]}get origin(){return this.chain[this.chain.length-1]}add(e){this.chain.push(e),$s(e)&&this.chain.push(...e.triggers)}remove(e){return this.chain.splice(this.chain.indexOf(e),1)[0]}has(e){return this.chain.some(n=>n===e)}hasType(e){return!!this.findType(e)}findType(e){return this.chain.find(n=>n.type===e)}walk(e){for(const n of this.chain){const s=e(n);if(s)return[n,s]}}[Symbol.iterator](){return this.chain.values()}}function $s(t){return!!t?.[cn]}class ms extends EventTarget{$ts__events;addEventListener(e,n,s){return super.addEventListener(e,n,s)}removeEventListener(e,n,s){return super.removeEventListener(e,n,s)}}function an(t,e,n,s){return t.addEventListener(e,n,s),xt(()=>t.removeEventListener(e,n,s))}class vs{#t;#e;get signal(){return this.#e.signal}constructor(e){this.#t=e,this.#e=new AbortController,xt(this.abort.bind(this))}add(e,n,s){if(this.signal.aborted)throw Error("aborted");return this.#t.addEventListener(e,n,{...s,signal:s?.signal?ys(this.signal,s.signal):this.signal}),this}remove(e,n){return this.#t.removeEventListener(e,n),this}abort(e){this.#e.abort(e)}}function ys(...t){const e=new AbortController,n={signal:e.signal};function s(i){e.abort(i.target.reason)}for(const i of t){if(i.aborted){e.abort(i.reason);break}i.addEventListener("abort",s,n)}return e.signal}function bs(t){return!!t?.type.startsWith("pointer")}function ws(t){return!!t?.type.startsWith("touch")}function As(t){return/^(click|mouse)/.test(t?.type??"")}function ke(t){return!!t?.type.startsWith("key")}function xs(t){return ke(t)&&t.key==="Enter"}function Cs(t){return ke(t)&&(t.key==="Enter"||t.key===" ")}function Es(t){return t instanceof Node}function Ne(t,e,n){if(t)if(!n&&n!==""&&n!==0)t.removeAttribute(e);else{const s=n===!0?"":n+"";t.getAttribute(e)!==s&&t.setAttribute(e,s)}else return}function Pe(t,e,n){if(t)!n&&n!==0?t.style.removeProperty(e):t.style.setProperty(e,n+"");else return}function Jt(t,e){const n=xe(t,null,e),s=be.bind(n);return s[I]=!0,s.set=en.bind(n),s}function Ss(t){return Yt(t)&&I in t}function un(t,e){const n=xe(e?.initial,t,e),s=be.bind(n);return s[I]=!0,s}function _s(t,e){const n=xe(null,function(){let i=t();return Yt(i)&&xt(i),null},void 0);return n.$e=!0,sn(n),pt.bind(n,!0)}function Os(t){return Ss(t)&&"set"in t}const Gt=_s;function Ts(t){return{id:Symbol(),provide:t}}function fn(t,e,n=ve()){const s=!Zt(e);os(t.id,s?e:t.provide?.(),n)}function hn(t){return Qe(t.id)}function Rs(t){return!Zt(Qe(t.id))}const Et=Symbol(0),St=Symbol(0),dn=Symbol(0),Le={};class ks{$ts__events;$ts__vars;[dn]=null;$el=Jt(null);el=null;scope=null;attachScope=null;connectScope=null;component=null;destroyed=!1;props=Le;attrs=null;styles=null;state;$state;#t=[];#e=[];#n=[];#s=[];constructor(e,n,s){this.scope=n,s?.scope&&s.scope.append(n);let i=e.state,r=e.props;if(i&&(this.$state=i.create(),this.state=new Proxy(this.$state,{get:(o,l)=>this.$state[l]()}),fn(i,this.$state)),r&&(this.props=Ns(r),s?.props))for(const o of Object.keys(s.props))this.props[o]?.set(s.props[o]);xt(this.destroy.bind(this))}setup(){B(()=>{for(const e of this.#t)e()},this.scope)}attach(e){this.el||(this.el=e,this.$el.set(e),B(()=>{this.attachScope=Kt(),B(()=>{for(const n of this.#e)n(this.el);this.#i(),this.#r()},this.attachScope)},this.scope),e.dispatchEvent(new Event("attached")))}detach(){this.attachScope?.dispose(),this.attachScope=null,this.connectScope=null,this.el=null,this.$el.set(null)}connect(){!this.el||!this.attachScope||!this.#n.length||B(()=>{this.connectScope=Kt(),B(()=>{for(const e of this.#n)e(this.el)},this.connectScope)},this.attachScope)}disconnect(){this.connectScope?.dispose(),this.connectScope=null}destroy(){if(this.destroyed)return;this.destroyed=!0,B(()=>{for(const n of this.#s)n(this.el)},this.scope);const e=this.el;this.detach(),this.scope.dispose(),this.#t.length=0,this.#e.length=0,this.#n.length=0,this.#s.length=0,this.component=null,this.attrs=null,this.styles=null,this.props=Le,this.scope=null,this.state=Le,this.$state=null,e&&delete e.$}addHooks(e){e.onSetup&&this.#t.push(e.onSetup.bind(e)),e.onAttach&&this.#e.push(e.onAttach.bind(e)),e.onConnect&&this.#n.push(e.onConnect.bind(e)),e.onDestroy&&this.#s.push(e.onDestroy.bind(e))}#i(){if(this.attrs)for(const e of Object.keys(this.attrs))Oe(this.attrs[e])?Gt(this.#o.bind(this,e)):Ne(this.el,e,this.attrs[e])}#r(){if(this.styles)for(const e of Object.keys(this.styles))Oe(this.styles[e])?Gt(this.#l.bind(this,e)):Pe(this.el,e,this.styles[e])}#o(e){Ne(this.el,e,this.attrs[e].call(this.component))}#l(e){Pe(this.el,e,this.styles[e].call(this.component))}}function Ns(t){const e={};for(const n of Object.keys(t)){const s=t[n];e[n]=Jt(s,s)}return e}let _t={$$:null};function Ps(t,e){return ss(()=>{_t.$$=new ks(t,ve(),e);const n=new t;return _t.$$.component=n,_t.$$=null,n})}class pn extends EventTarget{$$;get el(){return this.$$.el}get $el(){return this.$$.$el()}get scope(){return this.$$.scope}get attachScope(){return this.$$.attachScope}get connectScope(){return this.$$.connectScope}get $props(){return this.$$.props}get $state(){return this.$$.$state}get state(){return this.$$.state}constructor(){super(),_t.$$&&this.attach(_t)}attach({$$:e}){return this.$$=e,e.addHooks(this),this}addEventListener(e,n,s){this.listen(e,n,s)}removeEventListener(e,n,s){this.el?.removeEventListener(e,n,s)}setAttributes(e){this.$$.attrs||(this.$$.attrs={}),Object.assign(this.$$.attrs,e)}setStyles(e){this.$$.styles||(this.$$.styles={}),Object.assign(this.$$.styles,e)}setCSSVars(e){this.setStyles(e)}createEvent(e,...n){return new Re(e,n[0])}dispatch(e,...n){if(!this.el)return!1;const s=e instanceof Event?e:new Re(e,n[0]);return Object.defineProperty(s,"target",{get:()=>this.$$.component}),Ge(()=>(this.$$[dn]?.(s),this.el.dispatchEvent(s)))}dispatchEvent(e){return this.dispatch(e)}listen(e,n,s){return this.el?an(this.el,e,n,s):Se}}function Ls(t,e){for(const n of t)n(e)}function gn(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Hs(t){return t.replace(/-./g,e=>e[1].toUpperCase())}function Ms(t){return t.charAt(0).toUpperCase()+t.slice(1)}const He=t=>t===null?"":t+"",Fs=t=>t===null?null:t+"",Ds=t=>t===null?0:Number(t),$n=t=>t!==null,Ws=()=>null,Is=t=>t===null?[]:JSON.parse(t),Bs=t=>t===null?{}:JSON.parse(t);function Vs(t){if(t===null)return Fs;switch(typeof t){case"undefined":return He;case"string":return He;case"boolean":return $n;case"number":return Ds;case"function":return Ws;case"object":return Te(t)?Is:Bs;default:return He}}const Z=Symbol(0),mn=Symbol(0),nt=Symbol(0),Ot=Symbol(0);var U;(function(t){t[t.Idle=0]="Idle";const n=1;t[t.Pending=n]="Pending";const s=2;t[t.Ready=s]="Ready"})(U||(U={}));function js(t,e){class n extends t{static attrs;static[Z]=null;static get observedAttributes(){if(!this[Z]&&e.props){const i=new Map;for(const r of Object.keys(e.props)){let o=this.attrs?.[r],l=_e(o)?o:o&&o?.attr;l!==!1&&(l||(l=gn(r)),i.set(l,{prop:r,converter:o&&!_e(o)&&o?.converter||Vs(e.props[r])}))}this[Z]=i}return this[Z]?Array.from(this[Z].keys()):[]}$;[nt]=U.Idle;[Ot]=null;keepAlive=!1;forwardKeepAlive=!0;get scope(){return this.$.$$.scope}get attachScope(){return this.$.$$.attachScope}get connectScope(){return this.$.$$.connectScope}get $props(){return this.$.$$.props}get $state(){return this.$.$$.$state}get state(){return this.$.state}constructor(...i){if(super(...i),this.$=B(()=>Ps(e),null),this.$.$$.addHooks(this),e.props){const r=this.$props,o=Object.getOwnPropertyDescriptors(this);for(const l of Object.keys(o))l in e.props&&(r[l].set(this[l]),delete this[l])}}attributeChangedCallback(i,r,o){const l=this.constructor;if(!l[Z]){super.attributeChangedCallback?.(i,r,o);return}const c=l[Z].get(i);c&&(this[c.prop]=c.converter(o))}connectedCallback(){const i=this.$?.$$;if(!i||i.destroyed)return;if(this[nt]!==U.Ready){Us.call(this);return}if(!this.isConnected)return;this.hasAttribute("keep-alive")&&(this.keepAlive=!0),i.connect(),Te(this[Ot])&&Ls(this[Ot],this),this[Ot]=null;const r=super.connectedCallback;r&&B(()=>r.call(this),this.connectScope)}disconnectedCallback(){const i=this.$?.$$;if(!i||i.destroyed)return;i.disconnect();const r=super.disconnectedCallback;r&&r.call(this),!this.keepAlive&&!this.hasAttribute("keep-alive")&&setTimeout(()=>{requestAnimationFrame(()=>{this.isConnected||i.destroy()})},0)}[mn](){const i=this.$.$$,r=this.constructor;if(i.destroyed)return;const o=r[Z];if(o)for(const l of this.attributes){let c=o.get(l.name);c&&c.converter&&i.props[c.prop].set(c.converter(this.getAttribute(l.name)))}i.setup(),i.attach(this),this[nt]=U.Ready,this.connectedCallback()}subscribe(i){return this.$.subscribe(i)}destroy(){this.disconnectedCallback(),this.$.destroy()}}return zs(n,e),n}function zs(t,e){const n=t.prototype,s=e.prototype;if(e.props)for(const i of Object.keys(e.props))Object.defineProperty(n,i,{enumerable:!0,configurable:!0,get(){return this.$props[i]()},set(r){this.$props[i].set(r)}});if(s[Et])for(const i of s[Et])Object.defineProperty(n,i,{enumerable:!0,configurable:!0,get(){return this.$[i]},set(r){this.$[i]=r}});if(s[St])for(const i of s[St])n[i]=function(...r){return this.$[i](...r)}}function Us(){if(this[nt]!==U.Idle)return;this[nt]=U.Pending;const t=Xs(this),e=t&&window.customElements.get(t.localName),n=t&&t[nt]===U.Ready;if(t&&(!e||!n)){qs.call(this,t);return}vn.call(this,t)}async function qs(t){await window.customElements.whenDefined(t.localName),t[nt]!==U.Ready&&await new Promise(e=>(t[Ot]??=[]).push(e)),vn.call(this,t)}function vn(t){if(this.isConnected){if(t){t.keepAlive&&t.forwardKeepAlive&&(this.keepAlive=!0,this.setAttribute("keep-alive",""));const e=this.$.$$.scope;e&&t.$.$$.attachScope.append(e)}this[mn]()}}function Xs(t){let e=t.parentNode,n=t.localName.split("-",1)[0]+"-";for(;e;){if(e.nodeType===1&&e.localName.startsWith(n))return e;e=e.parentNode}return null}function Ks(t,e=!1){(e||!window.customElements.get(t.tagName))&&window.customElements.define(t.tagName,t)}class Ys extends pn{subscribe(e){return B(()=>Gt(()=>e(this.state)),this.$$.scope)}destroy(){this.$$.destroy()}}function Zs(t,e,n){t[Et]||(t[Et]=new Set),t[Et].add(e)}function Js(t,e,n){t[St]||(t[St]=new Set),t[St].add(e)}class Gs{id=Symbol(0);record;#t;constructor(e){this.record=e,this.#t=Object.getOwnPropertyDescriptors(e)}create(){const e={},n=new Proxy(e,{get:(s,i)=>e[i]()});for(const s of Object.keys(this.record)){const i=this.#t[s].get;e[s]=i?un(i.bind(n)):Jt(this.record[s])}return e}reset(e,n){for(const s of Object.keys(e))!this.#t[s].get&&(!n||n(s))&&e[s].set(this.record[s])}}function Qs(t){return hn(t)}function ti(t){return t?"true":"false"}function ei(t){return Object.keys(t)}function ni(){let t,e;return{promise:new Promise((s,i)=>{t=s,e=i}),resolve:t,reject:e}}function si(t){return new Promise(e=>setTimeout(e,t))}function ii(t){let e=-1,n;function s(...i){n=i,!(e>=0)&&(e=window.requestAnimationFrame(()=>{t.apply(this,n),e=-1,n=void 0}))}return s}const ri=typeof window<"u"?"requestIdleCallback"in window?window.requestIdleCallback:t=>window.setTimeout(t,1):Se;function oi(t,e){return new Promise(n=>{ri(s=>{t?.(s),n()},e)})}var N={fullscreenEnabled:0,fullscreenElement:1,requestFullscreen:2,exitFullscreen:3,fullscreenchange:4,fullscreenerror:5,fullscreen:6},yn=["webkitFullscreenEnabled","webkitFullscreenElement","webkitRequestFullscreen","webkitExitFullscreen","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"],bn=["mozFullScreenEnabled","mozFullScreenElement","mozRequestFullScreen","mozCancelFullScreen","mozfullscreenchange","mozfullscreenerror","-moz-full-screen"],wn=["msFullscreenEnabled","msFullscreenElement","msRequestFullscreen","msExitFullscreen","MSFullscreenChange","MSFullscreenError","-ms-fullscreen"],O=typeof window<"u"&&typeof window.document<"u"?window.document:{},H="fullscreenEnabled"in O&&Object.keys(N)||yn[0]in O&&yn||bn[0]in O&&bn||wn[0]in O&&wn||[],li={requestFullscreen:function(t){return t[H[N.requestFullscreen]]()},requestFullscreenFunction:function(t){return t[H[N.requestFullscreen]]},get exitFullscreen(){return O[H[N.exitFullscreen]].bind(O)},get fullscreenPseudoClass(){return":"+H[N.fullscreen]},addEventListener:function(t,e,n){return O.addEventListener(H[N[t]],e,n)},removeEventListener:function(t,e,n){return O.removeEventListener(H[N[t]],e,n)},get fullscreenEnabled(){return!!O[H[N.fullscreenEnabled]]},set fullscreenEnabled(t){},get fullscreenElement(){return O[H[N.fullscreenElement]]},set fullscreenElement(t){},get onfullscreenchange(){return O[("on"+H[N.fullscreenchange]).toLowerCase()]},set onfullscreenchange(t){return O[("on"+H[N.fullscreenchange]).toLowerCase()]=t},get onfullscreenerror(){return O[("on"+H[N.fullscreenerror]).toLowerCase()]},set onfullscreenerror(t){return O[("on"+H[N.fullscreenerror]).toLowerCase()]=t}};const Qt=Math.min,st=Math.max,te=Math.round,ee=Math.floor,V=t=>({x:t,y:t}),ci={left:"right",right:"left",bottom:"top",top:"bottom"};function An(t,e,n){return st(t,Qt(e,n))}function Me(t,e){return typeof t=="function"?t(e):t}function gt(t){return t.split("-")[0]}function Fe(t){return t.split("-")[1]}function xn(t){return t==="x"?"y":"x"}function Cn(t){return t==="y"?"height":"width"}function it(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function En(t){return xn(it(t))}function ai(t,e,n){n===void 0&&(n=!1);const s=Fe(t),i=En(t),r=Cn(i);let o=i==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(o=ne(o)),[o,ne(o)]}function ui(t){const e=ne(t);return[De(t),e,De(e)]}function De(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const Sn=["left","right"],_n=["right","left"],fi=["top","bottom"],hi=["bottom","top"];function di(t,e,n){switch(t){case"top":case"bottom":return n?e?_n:Sn:e?Sn:_n;case"left":case"right":return e?fi:hi;default:return[]}}function pi(t,e,n,s){const i=Fe(t);let r=di(gt(t),n==="start",s);return i&&(r=r.map(o=>o+"-"+i),e&&(r=r.concat(r.map(De)))),r}function ne(t){const e=gt(t);return ci[e]+t.slice(e.length)}function gi(t){return{top:0,right:0,bottom:0,left:0,...t}}function $i(t){return typeof t!="number"?gi(t):{top:t,right:t,bottom:t,left:t}}function se(t){const{x:e,y:n,width:s,height:i}=t;return{width:s,height:i,top:n,left:e,right:e+s,bottom:n+i,x:e,y:n}}function On(t,e,n){let{reference:s,floating:i}=t;const r=it(e),o=En(e),l=Cn(o),c=gt(e),a=r==="y",u=s.x+s.width/2-i.width/2,f=s.y+s.height/2-i.height/2,d=s[l]/2-i[l]/2;let h;switch(c){case"top":h={x:u,y:s.y-i.height};break;case"bottom":h={x:u,y:s.y+s.height};break;case"right":h={x:s.x+s.width,y:f};break;case"left":h={x:s.x-i.width,y:f};break;default:h={x:s.x,y:s.y}}switch(Fe(e)){case"start":h[o]-=d*(n&&a?-1:1);break;case"end":h[o]+=d*(n&&a?-1:1);break}return h}async function mi(t,e){var n;e===void 0&&(e={});const{x:s,y:i,platform:r,rects:o,elements:l,strategy:c}=t,{boundary:a="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:d=!1,padding:h=0}=Me(e,t),p=$i(h),v=l[d?f==="floating"?"reference":"floating":f],$=se(await r.getClippingRect({element:(n=await(r.isElement==null?void 0:r.isElement(v)))==null||n?v:v.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(l.floating)),boundary:a,rootBoundary:u,strategy:c})),y=f==="floating"?{x:s,y:i,width:o.floating.width,height:o.floating.height}:o.reference,b=await(r.getOffsetParent==null?void 0:r.getOffsetParent(l.floating)),w=await(r.isElement==null?void 0:r.isElement(b))?await(r.getScale==null?void 0:r.getScale(b))||{x:1,y:1}:{x:1,y:1},C=se(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:y,offsetParent:b,strategy:c}):y);return{top:($.top-C.top+p.top)/w.y,bottom:(C.bottom-$.bottom+p.bottom)/w.y,left:($.left-C.left+p.left)/w.x,right:(C.right-$.right+p.right)/w.x}}const vi=50,yi=async(t,e,n)=>{const{placement:s="bottom",strategy:i="absolute",middleware:r=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:mi},c=await(o.isRTL==null?void 0:o.isRTL(e));let a=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:u,y:f}=On(a,s,c),d=s,h=0;const p={};for(let g=0;g<r.length;g++){const v=r[g];if(!v)continue;const{name:$,fn:y}=v,{x:b,y:w,data:C,reset:E}=await y({x:u,y:f,initialPlacement:s,placement:d,strategy:i,middlewareData:p,rects:a,platform:l,elements:{reference:t,floating:e}});u=b??u,f=w??f,p[$]={...p[$],...C},E&&h<vi&&(h++,typeof E=="object"&&(E.placement&&(d=E.placement),E.rects&&(a=E.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:i}):E.rects),{x:u,y:f}=On(a,d,c)),g=-1)}return{x:u,y:f,placement:d,strategy:i,middlewareData:p}},bi=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,s;const{placement:i,middlewareData:r,rects:o,initialPlacement:l,platform:c,elements:a}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...v}=Me(t,e);if((n=r.arrow)!=null&&n.alignmentOffset)return{};const $=gt(i),y=it(l),b=gt(l)===l,w=await(c.isRTL==null?void 0:c.isRTL(a.floating)),C=d||(b||!g?[ne(l)]:ui(l)),E=p!=="none";!d&&E&&C.push(...pi(l,g,p,w));const W=[l,...C],X=await c.detectOverflow(e,v),Q=[];let z=((s=r.flip)==null?void 0:s.overflows)||[];if(u&&Q.push(X[$]),f){const A=ai(i,o,w);Q.push(X[A[0]],X[A[1]])}if(z=[...z,{placement:i,overflows:Q}],!Q.every(A=>A<=0)){var wt,At;const A=(((wt=r.flip)==null?void 0:wt.index)||0)+1,tt=W[A];if(tt&&(!(f==="alignment"?y!==it(tt):!1)||z.every(S=>it(S.placement)===y?S.overflows[0]>0:!0)))return{data:{index:A,overflows:z},reset:{placement:tt}};let T=(At=z.filter(m=>m.overflows[0]<=0).sort((m,S)=>m.overflows[1]-S.overflows[1])[0])==null?void 0:At.placement;if(!T)switch(h){case"bestFit":{var _;const m=(_=z.filter(S=>{if(E){const R=it(S.placement);return R===y||R==="y"}return!0}).map(S=>[S.placement,S.overflows.filter(R=>R>0).reduce((R,ut)=>R+ut,0)]).sort((S,R)=>S[1]-R[1])[0])==null?void 0:_[0];m&&(T=m);break}case"initialPlacement":T=l;break}if(i!==T)return{reset:{placement:T}}}return{}}}},wi=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:s,placement:i,platform:r}=e,{mainAxis:o=!0,crossAxis:l=!1,limiter:c={fn:$=>{let{x:y,y:b}=$;return{x:y,y:b}}},...a}=Me(t,e),u={x:n,y:s},f=await r.detectOverflow(e,a),d=it(gt(i)),h=xn(d);let p=u[h],g=u[d];if(o){const $=h==="y"?"top":"left",y=h==="y"?"bottom":"right",b=p+f[$],w=p-f[y];p=An(b,p,w)}if(l){const $=d==="y"?"top":"left",y=d==="y"?"bottom":"right",b=g+f[$],w=g-f[y];g=An(b,g,w)}const v=c.fn({...e,[h]:p,[d]:g});return{...v,data:{x:v.x-n,y:v.y-s,enabled:{[h]:o,[d]:l}}}}}};function ie(){return typeof window<"u"}function $t(t){return Tn(t)?(t.nodeName||"").toLowerCase():"#document"}function P(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function j(t){var e;return(e=(Tn(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Tn(t){return ie()?t instanceof Node||t instanceof P(t).Node:!1}function F(t){return ie()?t instanceof Element||t instanceof P(t).Element:!1}function q(t){return ie()?t instanceof HTMLElement||t instanceof P(t).HTMLElement:!1}function Rn(t){return!ie()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof P(t).ShadowRoot}function Tt(t){const{overflow:e,overflowX:n,overflowY:s,display:i}=D(t);return/auto|scroll|overlay|hidden|clip/.test(e+s+n)&&i!=="inline"&&i!=="contents"}function Ai(t){return/^(table|td|th)$/.test($t(t))}function re(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const xi=/transform|translate|scale|rotate|perspective|filter/,Ci=/paint|layout|strict|content/,rt=t=>!!t&&t!=="none";let We;function Ie(t){const e=F(t)?D(t):t;return rt(e.transform)||rt(e.translate)||rt(e.scale)||rt(e.rotate)||rt(e.perspective)||!Be()&&(rt(e.backdropFilter)||rt(e.filter))||xi.test(e.willChange||"")||Ci.test(e.contain||"")}function Ei(t){let e=J(t);for(;q(e)&&!mt(e);){if(Ie(e))return e;if(re(e))return null;e=J(e)}return null}function Be(){return We==null&&(We=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),We}function mt(t){return/^(html|body|#document)$/.test($t(t))}function D(t){return P(t).getComputedStyle(t)}function oe(t){return F(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function J(t){if($t(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Rn(t)&&t.host||j(t);return Rn(e)?e.host:e}function kn(t){const e=J(t);return mt(e)?t.ownerDocument?t.ownerDocument.body:t.body:q(e)&&Tt(e)?e:kn(e)}function Rt(t,e,n){var s;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=kn(t),r=i===((s=t.ownerDocument)==null?void 0:s.body),o=P(i);if(r){const l=Ve(o);return e.concat(o,o.visualViewport||[],Tt(i)?i:[],l&&n?Rt(l):[])}else return e.concat(i,Rt(i,[],n))}function Ve(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Nn(t){const e=D(t);let n=parseFloat(e.width)||0,s=parseFloat(e.height)||0;const i=q(t),r=i?t.offsetWidth:n,o=i?t.offsetHeight:s,l=te(n)!==r||te(s)!==o;return l&&(n=r,s=o),{width:n,height:s,$:l}}function je(t){return F(t)?t:t.contextElement}function vt(t){const e=je(t);if(!q(e))return V(1);const n=e.getBoundingClientRect(),{width:s,height:i,$:r}=Nn(e);let o=(r?te(n.width):n.width)/s,l=(r?te(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const Si=V(0);function Pn(t){const e=P(t);return!Be()||!e.visualViewport?Si:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function _i(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==P(t)?!1:e}function ot(t,e,n,s){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),r=je(t);let o=V(1);e&&(s?F(s)&&(o=vt(s)):o=vt(t));const l=_i(r,n,s)?Pn(r):V(0);let c=(i.left+l.x)/o.x,a=(i.top+l.y)/o.y,u=i.width/o.x,f=i.height/o.y;if(r){const d=P(r),h=s&&F(s)?P(s):s;let p=d,g=Ve(p);for(;g&&s&&h!==p;){const v=vt(g),$=g.getBoundingClientRect(),y=D(g),b=$.left+(g.clientLeft+parseFloat(y.paddingLeft))*v.x,w=$.top+(g.clientTop+parseFloat(y.paddingTop))*v.y;c*=v.x,a*=v.y,u*=v.x,f*=v.y,c+=b,a+=w,p=P(g),g=Ve(p)}}return se({width:u,height:f,x:c,y:a})}function le(t,e){const n=oe(t).scrollLeft;return e?e.left+n:ot(j(t)).left+n}function Ln(t,e){const n=t.getBoundingClientRect(),s=n.left+e.scrollLeft-le(t,n),i=n.top+e.scrollTop;return{x:s,y:i}}function Oi(t){let{elements:e,rect:n,offsetParent:s,strategy:i}=t;const r=i==="fixed",o=j(s),l=e?re(e.floating):!1;if(s===o||l&&r)return n;let c={scrollLeft:0,scrollTop:0},a=V(1);const u=V(0),f=q(s);if((f||!f&&!r)&&(($t(s)!=="body"||Tt(o))&&(c=oe(s)),f)){const h=ot(s);a=vt(s),u.x=h.x+s.clientLeft,u.y=h.y+s.clientTop}const d=o&&!f&&!r?Ln(o,c):V(0);return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-c.scrollLeft*a.x+u.x+d.x,y:n.y*a.y-c.scrollTop*a.y+u.y+d.y}}function Ti(t){return Array.from(t.getClientRects())}function Ri(t){const e=j(t),n=oe(t),s=t.ownerDocument.body,i=st(e.scrollWidth,e.clientWidth,s.scrollWidth,s.clientWidth),r=st(e.scrollHeight,e.clientHeight,s.scrollHeight,s.clientHeight);let o=-n.scrollLeft+le(t);const l=-n.scrollTop;return D(s).direction==="rtl"&&(o+=st(e.clientWidth,s.clientWidth)-i),{width:i,height:r,x:o,y:l}}const Hn=25;function ki(t,e){const n=P(t),s=j(t),i=n.visualViewport;let r=s.clientWidth,o=s.clientHeight,l=0,c=0;if(i){r=i.width,o=i.height;const u=Be();(!u||u&&e==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}const a=le(s);if(a<=0){const u=s.ownerDocument,f=u.body,d=getComputedStyle(f),h=u.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,p=Math.abs(s.clientWidth-f.clientWidth-h);p<=Hn&&(r-=p)}else a<=Hn&&(r+=a);return{width:r,height:o,x:l,y:c}}function Ni(t,e){const n=ot(t,!0,e==="fixed"),s=n.top+t.clientTop,i=n.left+t.clientLeft,r=q(t)?vt(t):V(1),o=t.clientWidth*r.x,l=t.clientHeight*r.y,c=i*r.x,a=s*r.y;return{width:o,height:l,x:c,y:a}}function Mn(t,e,n){let s;if(e==="viewport")s=ki(t,n);else if(e==="document")s=Ri(j(t));else if(F(e))s=Ni(e,n);else{const i=Pn(t);s={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return se(s)}function Fn(t,e){const n=J(t);return n===e||!F(n)||mt(n)?!1:D(n).position==="fixed"||Fn(n,e)}function Pi(t,e){const n=e.get(t);if(n)return n;let s=Rt(t,[],!1).filter(l=>F(l)&&$t(l)!=="body"),i=null;const r=D(t).position==="fixed";let o=r?J(t):t;for(;F(o)&&!mt(o);){const l=D(o),c=Ie(o);!c&&l.position==="fixed"&&(i=null),(r?!c&&!i:!c&&l.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||Tt(o)&&!c&&Fn(t,o))?s=s.filter(u=>u!==o):i=l,o=J(o)}return e.set(t,s),s}function Li(t){let{element:e,boundary:n,rootBoundary:s,strategy:i}=t;const o=[...n==="clippingAncestors"?re(e)?[]:Pi(e,this._c):[].concat(n),s],l=Mn(e,o[0],i);let c=l.top,a=l.right,u=l.bottom,f=l.left;for(let d=1;d<o.length;d++){const h=Mn(e,o[d],i);c=st(h.top,c),a=Qt(h.right,a),u=Qt(h.bottom,u),f=st(h.left,f)}return{width:a-f,height:u-c,x:f,y:c}}function Hi(t){const{width:e,height:n}=Nn(t);return{width:e,height:n}}function Mi(t,e,n){const s=q(e),i=j(e),r=n==="fixed",o=ot(t,!0,r,e);let l={scrollLeft:0,scrollTop:0};const c=V(0);function a(){c.x=le(i)}if(s||!s&&!r)if(($t(e)!=="body"||Tt(i))&&(l=oe(e)),s){const h=ot(e,!0,r,e);c.x=h.x+e.clientLeft,c.y=h.y+e.clientTop}else i&&a();r&&!s&&i&&a();const u=i&&!s&&!r?Ln(i,l):V(0),f=o.left+l.scrollLeft-c.x-u.x,d=o.top+l.scrollTop-c.y-u.y;return{x:f,y:d,width:o.width,height:o.height}}function ze(t){return D(t).position==="static"}function Dn(t,e){if(!q(t)||D(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return j(t)===n&&(n=n.ownerDocument.body),n}function Wn(t,e){const n=P(t);if(re(t))return n;if(!q(t)){let i=J(t);for(;i&&!mt(i);){if(F(i)&&!ze(i))return i;i=J(i)}return n}let s=Dn(t,e);for(;s&&Ai(s)&&ze(s);)s=Dn(s,e);return s&&mt(s)&&ze(s)&&!Ie(s)?n:s||Ei(t)||n}const Fi=async function(t){const e=this.getOffsetParent||Wn,n=this.getDimensions,s=await n(t.floating);return{reference:Mi(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function Di(t){return D(t).direction==="rtl"}const Wi={convertOffsetParentRelativeRectToViewportRelativeRect:Oi,getDocumentElement:j,getClippingRect:Li,getOffsetParent:Wn,getElementRects:Fi,getClientRects:Ti,getDimensions:Hi,getScale:vt,isElement:F,isRTL:Di};function In(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Ii(t,e){let n=null,s;const i=j(t);function r(){var l;clearTimeout(s),(l=n)==null||l.disconnect(),n=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),r();const a=t.getBoundingClientRect(),{left:u,top:f,width:d,height:h}=a;if(l||e(),!d||!h)return;const p=ee(f),g=ee(i.clientWidth-(u+d)),v=ee(i.clientHeight-(f+h)),$=ee(u),b={rootMargin:-p+"px "+-g+"px "+-v+"px "+-$+"px",threshold:st(0,Qt(1,c))||1};let w=!0;function C(E){const W=E[0].intersectionRatio;if(W!==c){if(!w)return o();W?o(!1,W):s=setTimeout(()=>{o(!1,1e-7)},1e3)}W===1&&!In(a,t.getBoundingClientRect())&&o(),w=!1}try{n=new IntersectionObserver(C,{...b,root:i.ownerDocument})}catch{n=new IntersectionObserver(C,b)}n.observe(t)}return o(!0),r}function Bi(t,e,n,s){s===void 0&&(s={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=s,a=je(t),u=i||r?[...a?Rt(a):[],...e?Rt(e):[]]:[];u.forEach($=>{i&&$.addEventListener("scroll",n,{passive:!0}),r&&$.addEventListener("resize",n)});const f=a&&l?Ii(a,n):null;let d=-1,h=null;o&&(h=new ResizeObserver($=>{let[y]=$;y&&y.target===a&&h&&e&&(h.unobserve(e),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var b;(b=h)==null||b.observe(e)})),n()}),a&&!c&&h.observe(a),e&&h.observe(e));let p,g=c?ot(t):null;c&&v();function v(){const $=ot(t);g&&!In(g,$)&&n(),g=$,p=requestAnimationFrame(v)}return n(),()=>{var $;u.forEach(y=>{i&&y.removeEventListener("scroll",n),r&&y.removeEventListener("resize",n)}),f?.(),($=h)==null||$.disconnect(),h=null,c&&cancelAnimationFrame(p)}}const Vi=wi,ji=bi,zi=(t,e,n)=>{const s=new Map,i={platform:Wi,...n},r={...i.platform,_c:s};return yi(t,e,{...i,platform:r})};var Ui=qi;function qi(t,e,n){var s=null,i=null,r=function(){s&&(clearTimeout(s),i=null,s=null)},o=function(){var c=i;r(),c&&c()},l=function(){if(!e)return t.apply(this,arguments);var c=this,a=arguments,u=n&&!s;if(r(),i=function(){t.apply(c,a)},s=setTimeout(function(){if(s=null,!u){var f=i;return i=null,f()}},e),u)return i()};return l.cancel=r,l.flush=o,l}var Xi=Ki;function Ki(t,e,n){var s=null,i=null,r=n&&n.leading,o=n&&n.trailing;r==null&&(r=!0),o==null&&(o=!r),r==!0&&(o=!1);var l=function(){s&&(clearTimeout(s),s=null)},c=function(){var u=i;l(),u&&u()},a=function(){var u=r&&!s,f=this,d=arguments;if(i=function(){return t.apply(f,d)},s||(s=setTimeout(function(){if(s=null,o)return i()},e)),u)return u=!1,i()};return a.cancel=l,a.flush=c,a}const Bn=t=>typeof t=="object"&&t!=null&&t.nodeType===1,Vn=(t,e)=>(!e||t!=="hidden")&&t!=="visible"&&t!=="clip",ce=(t,e)=>{if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){const n=getComputedStyle(t,null);return Vn(n.overflowY,e)||Vn(n.overflowX,e)||(s=>{const i=(r=>{if(!r.ownerDocument||!r.ownerDocument.defaultView)return null;try{return r.ownerDocument.defaultView.frameElement}catch{return null}})(s);return!!i&&(i.clientHeight<s.scrollHeight||i.clientWidth<s.scrollWidth)})(t)}return!1},ae=(t,e,n,s,i,r,o,l)=>r<t&&o>e||r>t&&o<e?0:r<=t&&l<=n||o>=e&&l>=n?r-t-s:o>e&&l<n||r<t&&l>n?o-e+i:0,Yi=t=>{const e=t.parentElement;return e??(t.getRootNode().host||null)},Zi=(t,e)=>{var n,s,i,r;if(typeof document>"u")return[];const{scrollMode:o,block:l,inline:c,boundary:a,skipOverflowHiddenElements:u}=e,f=typeof a=="function"?a:T=>T!==a;if(!Bn(t))throw new TypeError("Invalid target");const d=document.scrollingElement||document.documentElement,h=[];let p=t;for(;Bn(p)&&f(p);){if(p=Yi(p),p===d){h.push(p);break}p!=null&&p===document.body&&ce(p)&&!ce(document.documentElement)||p!=null&&ce(p,u)&&h.push(p)}const g=(s=(n=window.visualViewport)==null?void 0:n.width)!=null?s:innerWidth,v=(r=(i=window.visualViewport)==null?void 0:i.height)!=null?r:innerHeight,{scrollX:$,scrollY:y}=window,{height:b,width:w,top:C,right:E,bottom:W,left:X}=t.getBoundingClientRect(),{top:Q,right:z,bottom:wt,left:At}=(T=>{const m=window.getComputedStyle(T);return{top:parseFloat(m.scrollMarginTop)||0,right:parseFloat(m.scrollMarginRight)||0,bottom:parseFloat(m.scrollMarginBottom)||0,left:parseFloat(m.scrollMarginLeft)||0}})(t);let _=l==="start"||l==="nearest"?C-Q:l==="end"?W+wt:C+b/2-Q+wt,A=c==="center"?X+w/2-At+z:c==="end"?E+z:X-At;const tt=[];for(let T=0;T<h.length;T++){const m=h[T],{height:S,width:R,top:ut,right:he,bottom:de,left:Ft}=m.getBoundingClientRect();if(o==="if-needed"&&C>=0&&X>=0&&W<=v&&E<=g&&(m===d&&!ce(m)||C>=ut&&W<=de&&X>=Ft&&E<=he))return tt;const Dt=getComputedStyle(m),Wt=parseInt(Dt.borderLeftWidth,10),It=parseInt(Dt.borderTopWidth,10),Bt=parseInt(Dt.borderRightWidth,10),Vt=parseInt(Dt.borderBottomWidth,10);let K=0,Y=0;const jt="offsetWidth"in m?m.offsetWidth-m.clientWidth-Wt-Bt:0,zt="offsetHeight"in m?m.offsetHeight-m.clientHeight-It-Vt:0,pe="offsetWidth"in m?m.offsetWidth===0?0:R/m.offsetWidth:0,ge="offsetHeight"in m?m.offsetHeight===0?0:S/m.offsetHeight:0;if(d===m)K=l==="start"?_:l==="end"?_-v:l==="nearest"?ae(y,y+v,v,It,Vt,y+_,y+_+b,b):_-v/2,Y=c==="start"?A:c==="center"?A-g/2:c==="end"?A-g:ae($,$+g,g,Wt,Bt,$+A,$+A+w,w),K=Math.max(0,K+y),Y=Math.max(0,Y+$);else{K=l==="start"?_-ut-It:l==="end"?_-de+Vt+zt:l==="nearest"?ae(ut,de,S,It,Vt+zt,_,_+b,b):_-(ut+S/2)+zt/2,Y=c==="start"?A-Ft-Wt:c==="center"?A-(Ft+R/2)+jt/2:c==="end"?A-he+Bt+jt:ae(Ft,he,R,Wt,Bt+jt,A,A+w,w);const{scrollLeft:Ke,scrollTop:Ye}=m;K=ge===0?0:Math.max(0,Math.min(Ye+K/ge,m.scrollHeight-S/ge+zt)),Y=pe===0?0:Math.max(0,Math.min(Ke+Y/pe,m.scrollWidth-R/pe+jt)),_+=Ye-K,A+=Ke-Y}tt.push({el:m,top:K,left:Y})}return tt};var Ue;const ue=window,yt=ue.trustedTypes,jn=yt?yt.createPolicy("lit-html",{createHTML:t=>t}):void 0,qe="$lit$",G=`lit$${(Math.random()+"").slice(9)}$`,zn="?"+G,Ji=`<${zn}>`,lt=document,kt=()=>lt.createComment(""),Nt=t=>t===null||typeof t!="object"&&typeof t!="function",Un=Array.isArray,Gi=t=>Un(t)||typeof t?.[Symbol.iterator]=="function",Xe=`[
|
|
2
|
+
\f\r]`,Pt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,qn=/-->/g,Xn=/>/g,ct=RegExp(`>|${Xe}(?:([^\\s"'>=/]+)(${Xe}*=${Xe}*(?:[^
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Kn=/'/g,Yn=/"/g,Zn=/^(?:script|style|textarea|title)$/i,Qi=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),tr=Qi(1),Lt=Symbol.for("lit-noChange"),x=Symbol.for("lit-nothing"),Jn=new WeakMap,at=lt.createTreeWalker(lt,129,null,!1);function Gn(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return jn!==void 0?jn.createHTML(e):e}const er=(t,e)=>{const n=t.length-1,s=[];let i,r=e===2?"<svg>":"",o=Pt;for(let l=0;l<n;l++){const c=t[l];let a,u,f=-1,d=0;for(;d<c.length&&(o.lastIndex=d,u=o.exec(c),u!==null);)d=o.lastIndex,o===Pt?u[1]==="!--"?o=qn:u[1]!==void 0?o=Xn:u[2]!==void 0?(Zn.test(u[2])&&(i=RegExp("</"+u[2],"g")),o=ct):u[3]!==void 0&&(o=ct):o===ct?u[0]===">"?(o=i??Pt,f=-1):u[1]===void 0?f=-2:(f=o.lastIndex-u[2].length,a=u[1],o=u[3]===void 0?ct:u[3]==='"'?Yn:Kn):o===Yn||o===Kn?o=ct:o===qn||o===Xn?o=Pt:(o=ct,i=void 0);const h=o===ct&&t[l+1].startsWith("/>")?" ":"";r+=o===Pt?c+Ji:f>=0?(s.push(a),c.slice(0,f)+qe+c.slice(f)+G+h):c+G+(f===-2?(s.push(void 0),l):h)}return[Gn(t,r+(t[n]||"<?>")+(e===2?"</svg>":"")),s]};class Ht{constructor({strings:e,_$litType$:n},s){let i;this.parts=[];let r=0,o=0;const l=e.length-1,c=this.parts,[a,u]=er(e,n);if(this.el=Ht.createElement(a,s),at.currentNode=this.el.content,n===2){const f=this.el.content,d=f.firstChild;d.remove(),f.append(...d.childNodes)}for(;(i=at.nextNode())!==null&&c.length<l;){if(i.nodeType===1){if(i.hasAttributes()){const f=[];for(const d of i.getAttributeNames())if(d.endsWith(qe)||d.startsWith(G)){const h=u[o++];if(f.push(d),h!==void 0){const p=i.getAttribute(h.toLowerCase()+qe).split(G),g=/([.?@])?(.*)/.exec(h);c.push({type:1,index:r,name:g[2],strings:p,ctor:g[1]==="."?sr:g[1]==="?"?rr:g[1]==="@"?or:fe})}else c.push({type:6,index:r})}for(const d of f)i.removeAttribute(d)}if(Zn.test(i.tagName)){const f=i.textContent.split(G),d=f.length-1;if(d>0){i.textContent=yt?yt.emptyScript:"";for(let h=0;h<d;h++)i.append(f[h],kt()),at.nextNode(),c.push({type:2,index:++r});i.append(f[d],kt())}}}else if(i.nodeType===8)if(i.data===zn)c.push({type:2,index:r});else{let f=-1;for(;(f=i.data.indexOf(G,f+1))!==-1;)c.push({type:7,index:r}),f+=G.length-1}r++}}static createElement(e,n){const s=lt.createElement("template");return s.innerHTML=e,s}}function bt(t,e,n=t,s){var i,r,o,l;if(e===Lt)return e;let c=s!==void 0?(i=n._$Co)===null||i===void 0?void 0:i[s]:n._$Cl;const a=Nt(e)?void 0:e._$litDirective$;return c?.constructor!==a&&((r=c?._$AO)===null||r===void 0||r.call(c,!1),a===void 0?c=void 0:(c=new a(t),c._$AT(t,n,s)),s!==void 0?((o=(l=n)._$Co)!==null&&o!==void 0?o:l._$Co=[])[s]=c:n._$Cl=c),c!==void 0&&(e=bt(t,c._$AS(t,e.values),c,s)),e}class nr{constructor(e,n){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=n}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var n;const{el:{content:s},parts:i}=this._$AD,r=((n=e?.creationScope)!==null&&n!==void 0?n:lt).importNode(s,!0);at.currentNode=r;let o=at.nextNode(),l=0,c=0,a=i[0];for(;a!==void 0;){if(l===a.index){let u;a.type===2?u=new Mt(o,o.nextSibling,this,e):a.type===1?u=new a.ctor(o,a.name,a.strings,this,e):a.type===6&&(u=new lr(o,this,e)),this._$AV.push(u),a=i[++c]}l!==a?.index&&(o=at.nextNode(),l++)}return at.currentNode=lt,r}v(e){let n=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(e,s,n),n+=s.strings.length-2):s._$AI(e[n])),n++}}class Mt{constructor(e,n,s,i){var r;this.type=2,this._$AH=x,this._$AN=void 0,this._$AA=e,this._$AB=n,this._$AM=s,this.options=i,this._$Cp=(r=i?.isConnected)===null||r===void 0||r}get _$AU(){var e,n;return(n=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&n!==void 0?n:this._$Cp}get parentNode(){let e=this._$AA.parentNode;const n=this._$AM;return n!==void 0&&e?.nodeType===11&&(e=n.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,n=this){e=bt(this,e,n),Nt(e)?e===x||e==null||e===""?(this._$AH!==x&&this._$AR(),this._$AH=x):e!==this._$AH&&e!==Lt&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):Gi(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==x&&Nt(this._$AH)?this._$AA.nextSibling.data=e:this.$(lt.createTextNode(e)),this._$AH=e}g(e){var n;const{values:s,_$litType$:i}=e,r=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=Ht.createElement(Gn(i.h,i.h[0]),this.options)),i);if(((n=this._$AH)===null||n===void 0?void 0:n._$AD)===r)this._$AH.v(s);else{const o=new nr(r,this),l=o.u(this.options);o.v(s),this.$(l),this._$AH=o}}_$AC(e){let n=Jn.get(e.strings);return n===void 0&&Jn.set(e.strings,n=new Ht(e)),n}T(e){Un(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let s,i=0;for(const r of e)i===n.length?n.push(s=new Mt(this.k(kt()),this.k(kt()),this,this.options)):s=n[i],s._$AI(r),i++;i<n.length&&(this._$AR(s&&s._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,n){var s;for((s=this._$AP)===null||s===void 0||s.call(this,!1,!0,n);e&&e!==this._$AB;){const i=e.nextSibling;e.remove(),e=i}}setConnected(e){var n;this._$AM===void 0&&(this._$Cp=e,(n=this._$AP)===null||n===void 0||n.call(this,e))}}class fe{constructor(e,n,s,i,r){this.type=1,this._$AH=x,this._$AN=void 0,this.element=e,this.name=n,this._$AM=i,this.options=r,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=x}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,n=this,s,i){const r=this.strings;let o=!1;if(r===void 0)e=bt(this,e,n,0),o=!Nt(e)||e!==this._$AH&&e!==Lt,o&&(this._$AH=e);else{const l=e;let c,a;for(e=r[0],c=0;c<r.length-1;c++)a=bt(this,l[s+c],n,c),a===Lt&&(a=this._$AH[c]),o||(o=!Nt(a)||a!==this._$AH[c]),a===x?e=x:e!==x&&(e+=(a??"")+r[c+1]),this._$AH[c]=a}o&&!i&&this.j(e)}j(e){e===x?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class sr extends fe{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===x?void 0:e}}const ir=yt?yt.emptyScript:"";class rr extends fe{constructor(){super(...arguments),this.type=4}j(e){e&&e!==x?this.element.setAttribute(this.name,ir):this.element.removeAttribute(this.name)}}class or extends fe{constructor(e,n,s,i,r){super(e,n,s,i,r),this.type=5}_$AI(e,n=this){var s;if((e=(s=bt(this,e,n,0))!==null&&s!==void 0?s:x)===Lt)return;const i=this._$AH,r=e===x&&i!==x||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,o=e!==x&&(i===x||r);r&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var n,s;typeof this._$AH=="function"?this._$AH.call((s=(n=this.options)===null||n===void 0?void 0:n.host)!==null&&s!==void 0?s:this.element,e):this._$AH.handleEvent(e)}}class lr{constructor(e,n,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=n,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){bt(this,e)}}const Qn=ue.litHtmlPolyfillSupport;Qn?.(Ht,Mt),((Ue=ue.litHtmlVersions)!==null&&Ue!==void 0?Ue:ue.litHtmlVersions=[]).push("2.8.0");const cr=(t,e,n)=>{var s,i;const r=(s=n?.renderBefore)!==null&&s!==void 0?s:e;let o=r._$litPart$;if(o===void 0){const l=(i=n?.renderBefore)!==null&&i!==void 0?i:null;r._$litPart$=o=new Mt(e.insertBefore(kt(),l),l,void 0,n??{})}return o._$AI(t),o};var ar='<path fill-rule="evenodd" clip-rule="evenodd" d="M6 7C5.63181 7 5.33333 7.29848 5.33333 7.66667V14.8667C5.33333 14.9403 5.39361 14.9999 5.46724 15.0009C10.8844 15.0719 15.2614 19.449 15.3325 24.8661C15.3334 24.9397 15.393 25 15.4667 25H26C26.3682 25 26.6667 24.7015 26.6667 24.3333V7.66667C26.6667 7.29848 26.3682 7 26 7H6ZM17.0119 22.2294C17.0263 22.29 17.0802 22.3333 17.1425 22.3333H23.3333C23.7015 22.3333 24 22.0349 24 21.6667V10.3333C24 9.96514 23.7015 9.66667 23.3333 9.66667H8.66667C8.29848 9.66667 8 9.96514 8 10.3333V13.1909C8 13.2531 8.04332 13.3071 8.10392 13.3214C12.5063 14.3618 15.9715 17.827 17.0119 22.2294Z" fill="currentColor"/> <path d="M13.2 25C13.2736 25 13.3334 24.9398 13.3322 24.8661C13.2615 20.5544 9.77889 17.0718 5.46718 17.0011C5.39356 16.9999 5.33333 17.0597 5.33333 17.1333V18.8667C5.33333 18.9403 5.39348 18.9999 5.4671 19.0015C8.67465 19.0716 11.2617 21.6587 11.3319 24.8662C11.3335 24.9399 11.393 25 11.4667 25H13.2Z" fill="currentColor"/> <path d="M5.33333 21.1333C5.33333 21.0597 5.39332 20.9998 5.46692 21.0022C7.57033 21.0712 9.26217 22.763 9.33114 24.8664C9.33356 24.94 9.27364 25 9.2 25H6C5.63181 25 5.33333 24.7015 5.33333 24.3333V21.1333Z" fill="currentColor"/>';export{ds as $,Vi as A,ke as B,Zt as C,Re as D,vs as E,Xi as F,Ui as G,hs as H,Ys as I,Zs as J,Js as K,fn as L,ii as M,Ms as N,gn as O,un as P,js as Q,Se as R,Gs as S,Ks as T,ln as U,pn as V,ti as W,Os as X,bs as Y,As as Z,Hs as _,Te as a,Rs as a0,Zi as a1,xs as a2,Qs as a3,Kt as a4,fs as a5,$n as a6,cr as a7,tr as a8,us as a9,si as aa,ei as ab,ar as ac,Cs as b,Ts as c,ms as d,Gt as e,li as f,Ge as g,ni as h,_e as i,Oe as j,Ne as k,an as l,ws as m,B as n,xt as o,is as p,ve as q,Es as r,Jt as s,rs as t,hn as u,Pe as v,oi as w,Bi as x,zi as y,ji as z};
|