@hanifhan1f/vidstack 1.12.32 → 1.12.33
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/with-layouts/chunks/vidstack-BCLumCST.js +939 -0
- package/cdn/with-layouts/chunks/vidstack-DLGH9jfs.js +1 -0
- package/cdn/with-layouts/vidstack.js +1 -1
- package/dev/define/templates/vidstack-video-layout.js +3 -1
- package/package.json +1 -1
- package/prod/define/templates/vidstack-video-layout.js +3 -1
- package/server/chunks/vidstack-BIGdJnUK.js +2141 -0
- package/server/define/vidstack-player-default-layout.js +1 -1
- package/server/define/vidstack-player-layouts.js +1 -1
- package/server/vidstack-elements.js +1 -1
|
@@ -0,0 +1,939 @@
|
|
|
1
|
+
import{u as V,c as ut,V as ot,e as d,s as b,E as _,p as f,l as K,i as M,a as W,b as jt,S as wt,f as Et,t as ht,d as ga,D as z,w as ba,o as L,g as re,h as _s,j as oe,k as v,m as le,n as zt,q as ya,r as Os,v as at,x as va,y as $a,z as wa,A as Ta,B as Ve,C as ft,F as D,G as de,H as ka,I as At,J as Re,K as Tt,L as S,M as A,N as H,O as tt,P as Vs,Q as Nt,R as k,T as Ne,U as T,W as Rs,X as Sa,Y as xa,Z as Ns,_ as Pa,$ as Fe,a0 as ce,a1 as p,a2 as Ca,a3 as ue,a4 as he,a5 as Ea,a6 as Aa,a7 as Ma,a8 as La,a9 as Fs,aa as Mt,ab as pe,ac as Da,ad as Bs,ae as Ia,af as qa,ag as st,ah as _a,ai as Oa,aj as Ft,ak as Va,al as Ra,am as Na}from"./vidstack-Dy1Hfo7P.js";import{I as Gs,c as Hs,a as Fa,b as Ba,d as Ga,e as Ha,i as Ka,f as Wa,g as Qa,h as Ua,j as ja,k as Be,l as Ks,m as Ge}from"./vidstack-CwzW7rJU.js";import{T as me,g as Lt,a as Ws,u as za}from"./vidstack-CaW6KGwN.js";import{i as Y,T as X,a as fe,w as Yt,b as Ya,c as Xa}from"./vidstack-DeLOZ-hK.js";import{L as I}from"./vidstack-C_AxqLKV.js";import{Q as lt}from"./vidstack-DRH_1tFW.js";import{c as He,a as gt}from"./vidstack-BfBBPhXV.js";import{p as Xt,g as ge,a as Qs,b as Us}from"./vidstack-CROJF16Z.js";import{c as Ke,r as Q,g as Ja}from"./vidstack-Bxv1Qnxe.js";import"https://cdn.vidstack.io/icons";const We=Symbol(0),Za=["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"],js=ut();function y(){return V(js)}function R(){return y().$state}function tn(i){return i instanceof HTMLAudioElement}function en(i){return i instanceof HTMLVideoElement}function sn(i){return tn(i)||en(i)}class Dt extends ot{}const an={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:"<"},Jt=new Set(["Shift","Alt","Meta","Ctrl"]),nn='button, [role="button"]',zs='input, textarea, select, [contenteditable], [role^="menuitem"], [role="timer"]';class rn extends Dt{#t;constructor(t){super(),this.#t=t}onConnect(){d(this.#e.bind(this))}#e(){const{keyDisabled:t,keyTarget:e}=this.$props;if(t())return;const s=e()==="player"?this.el:document,a=b(!1);s===this.el?new _(this.el).add("focusin",()=>a.set(!0)).add("focusout",n=>{this.el.contains(n.target)||a.set(!1)}):(f(a)||a.set(document.querySelector("[data-media-player]")===this.el),K(document,"focusin",n=>{const r=n.composedPath().find(o=>o instanceof Element&&o.localName==="media-player");r!==void 0&&a.set(this.el===r)})),d(()=>{a()&&new _(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(zs))return;let{method:s,value:a}=this.#n(t);if(!M(a)&&!W(a)){a?.onKeyUp?.({event:t,player:this.#t.player,remote:this.#t.remote}),a?.callback?.(t,this.#t.remote);return}s?.startsWith("seek")&&(t.preventDefault(),t.stopPropagation(),this.#l?(this.#c(t,s==="seekForward"),this.#l=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||Jt.has(t.key))return;const e=document.activeElement;if(e?.matches(zs)||jt(t)&&e?.matches(nn))return;let{method:s,value:a}=this.#n(t),n=!t.metaKey&&/^[0-9]$/.test(t.key);if(!M(a)&&!W(a)&&!n){a?.onKeyDown?.({event:t,player:this.#t.player,remote:this.#t.remote}),a?.callback?.(t,this.#t.remote);return}if(!s&&n&&!dn(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.#u(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){sn(t.target)&&this.#n(t).method&&t.preventDefault()}#n(t){const e={...this.$props.keyShortcuts(),...this.#t.ariaKeys},s=Object.keys(e).find(a=>{const n=e[a],r=W(n)?n.join(" "):M(n)?n:n?.keys;return(W(r)?r:r?.split(" "))?.map(l=>ln(l).replace(/Control/g,"Ctrl").split("+"))?.some(l=>{const c=new Set(l.filter(h=>Jt.has(h)));"<>".includes(t.key)&&c.add("Shift");for(const h of Jt){const u=h.toLowerCase()+"Key";if(!c.has(h)&&t[u])return!1}return l.every(h=>Jt.has(h)?t[h.toLowerCase()+"Key"]:t.key===h.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()))}#l=null;#c(t,e){this.#l?.dispatchEvent(new KeyboardEvent(t.type,{key:e?"Right":"Left",shiftKey:t.shiftKey,trigger:t}))}#u(t,e,s){this.$state.canSeek()&&(this.#l||(this.#l=this.el.querySelector("[data-media-time-slider]")),this.#l?this.#c(t,s):this.#t.remote.seeking(this.#o(t,e),t))}}const on=["!","@","#","$","%","^","&","*","(",")"];function ln(i){return i.replace(/Shift\+(\d)/g,(t,e)=>on[e-1])}function dn(i){for(const t of Jt)if(i[t.toLowerCase()+"Key"])return!0;return!1}const cn={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:an,storage:null},Ys=new wt({artist:"",artwork:null,audioTrack:null,audioTracks:[],autoPlay:!1,autoPlayError:null,audioGain:null,buffered:new me,canLoad:!1,canLoadPoster:!1,canFullscreen:!1,canOrientScreen:Hs(),canPictureInPicture:!1,canPlay:!1,clipStartTime:0,clipEndTime:0,controls:!1,get iOSControls(){return Gs&&this.mediaType==="video"&&(!this.playsInline||!Et.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 me,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 me,seeking:!1,source:{src:"",type:""},sources:[],started:!1,textTracks:[],textTrack:null,get hasCaptions(){return this.textTracks.filter(Y).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 i=Ws(this.buffered)??0;return Math.max(i,this.clipStartTime)},get bufferedEnd(){const i=Lt(this.buffered)??0;return Math.min(this.seekableEnd,Math.max(0,i-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 i=Ws(this.seekable)??0;return Math.max(i,this.clipStartTime)},get seekableEnd(){if(this.providedDuration>0)return this.providedDuration;const i=this.liveSyncPosition>0?this.liveSyncPosition:this.canPlay?Lt(this.seekable)??1/0:0;return this.clipEndTime>0?Math.min(this.clipEndTime,i):i},get seekableWindow(){const i=this.seekableEnd-this.seekableStart;return isNaN(i)?1/0:Math.max(0,i)},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}),Xs=new Set(["autoPlayError","autoPlaying","buffered","canPlay","error","paused","played","playing","seekable","seeking","waiting"]),un=new Set([...Xs,"ended","inferredPoster","inferredStreamType","inferredTitle","intrinsicDuration","inferredLiveDVRWindow","liveSyncPosition","realCurrentTime","savedState","started","userBehindLiveEdge"]);function Js(i,t=!1){const e=t?Xs:un;Ys.reset(i,s=>e.has(s)),ht()}function Zs(i,t){const e=i+t.clipStartTime(),s=Math.floor(i)===Math.floor(t.seekableStart()),a=Math.floor(e)===Math.floor(t.seekableEnd());return s?t.seekableStart():a?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 ti extends ga{items=[];[I.readonly]=!1;get length(){return this.items.length}get readonly(){return this[I.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()}[I.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 z("add",{detail:t,trigger:e})))}[I.remove](t,e){const s=this.items.indexOf(t);s>=0&&(this[I.onRemove]?.(t,e),this.items.splice(s,1),this.dispatchEvent(new z("remove",{detail:t,trigger:e})))}[I.reset](t){for(const e of[...this.items])this[I.remove](e,t);this.items=[],this[I.setReadonly](!1,t),this[I.onReset]?.()}[I.setReadonly](t,e){this[I.readonly]!==t&&(this[I.readonly]=t,this.dispatchEvent(new z("readonly-change",{detail:t,trigger:e})))}}const Zt=Symbol(0);class ei extends ti{get selected(){return this.items.find(t=>t.selected)??null}get selectedIndex(){return this.items.findIndex(t=>t.selected)}[I.onRemove](t,e){this[I.select](t,!1,e)}[I.add](t,e){t[Zt]=!1,Object.defineProperty(t,"selected",{get(){return this[Zt]},set:s=>{this.readonly||(this[I.onUserSelect]?.(),this[I.select](t,s))}}),super[I.add](t,e)}[I.select](t,e,s){if(e===t?.[Zt])return;const a=this.selected;t&&(t[Zt]=e),(e?a!==t:a===t)&&(a&&(a[Zt]=!1),this.dispatchEvent(new z("change",{detail:{prev:a,current:this.selected},trigger:s})))}}class hn extends ei{#t=!1;switch="current";get auto(){return this.#t||this.readonly}[lt.enableAuto];[I.onUserSelect](){this[lt.setAuto](!1)}[I.onReset](t){this[lt.enableAuto]=void 0,this[lt.setAuto](!1,t)}autoSelect(t){this.readonly||this.#t||!this[lt.enableAuto]||(this[lt.enableAuto]?.(t),this[lt.setAuto](!0,t))}getBySrc(t){return this.items.find(e=>e.src===t)}[lt.setAuto](t,e){this.#t!==t&&(this.#t=t,this.dispatchEvent(new z("auto-change",{detail:t,trigger:e})))}}class si extends Dt{#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")ba(this.#e);else if(e==="visible"){let s,a=new IntersectionObserver(n=>{this.scope&&n[0].isIntersecting&&(s?.(),s=void 0,this.#e())});a.observe(t),s=L(()=>a.disconnect())}}}class pn{#t;#e;constructor(t,e){this.#t=t,this.#e=e}notify(t,...e){this.#t(new z(t,{detail:e?.[0],trigger:e?.[1]}))}async ready(t,e){return re(async()=>{const{logger:s}=this.#e,{autoPlay:a,canPlay:n,started:r,duration:o,seekable:l,buffered:c,remotePlaybackInfo:h,playsInline:u,savedState:g,source:$}=this.#e.$state;if(n())return;const w={duration:t?.duration??o(),seekable:t?.seekable??l(),buffered:t?.buffered??c(),provider:this.#e.$provider()};this.notify("can-play",w,e),ht();let P=this.#e.$provider(),{storage:C,qualities:B}=this.#e,{muted:ct,volume:Z,clipStartTime:G,playbackRate:pt}=this.#e.$props;await C?.onLoad?.($());const mt=g()?.currentTime,Qt=g()?.paused,$t=await C?.getTime(),Ds=mt??$t??G(),fa=Qt===!1||Qt!==!0&&!r()&&a();if(P){P.setVolume(await C?.getVolume()??Z()),P.setMuted(ct()||!!await C?.getMuted());const Rt=await C?.getAudioGain()??1;Rt>1&&P.audioGain?.setGain?.(Rt),P.setPlaybackRate?.(await C?.getPlaybackRate()??pt()),P.setPlaysInline?.(u()),Ds>0&&P.setCurrentTime(Ds)}const Ut=await C?.getVideoQuality();if(Ut&&B.length){let Rt=null,Is=1/0;for(const ne of B){const qs=Math.abs(Ut.width-ne.width)+Math.abs(Ut.height-ne.height)+(Ut.bitrate?Math.abs(Ut.bitrate-(ne.bitrate??0)):0);qs<Is&&(Rt=ne,Is=qs)}Rt&&(Rt.selected=!0)}n()&&fa?await this.#s(e):$t&&$t>0&&this.notify("started",void 0,e),h.set(null)})}async#s(t){const{player:e,$state:{autoPlaying:s,muted:a}}=this.#e;s.set(!0);const n=new z("auto-play-attempt",{trigger:t});try{await e.play(n)}catch{}}}const Qe=Et.fullscreenEnabled;class mn extends ot{#t=!1;#e=!1;get active(){return this.#e}get supported(){return Qe}onConnect(){new _(Et).add("fullscreenchange",this.#i.bind(this)).add("fullscreenerror",this.#a.bind(this)),L(this.#s.bind(this))}async#s(){Qe&&await this.exit()}#i(t){const e=Ue(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||Ue(this.el)?void 0:(ii(),Et.requestFullscreen(this.el))}catch(t){throw this.#t=!1,t}}async exit(){if(!(!this.el||!Ue(this.el)))return ii(),Et.exitFullscreen()}}function Ue(i){if(Et.fullscreenElement===i)return!0;try{return i.matches(Et.fullscreenPseudoClass)}catch{return!1}}function ii(){if(!Qe)throw Error("[vidstack] no fullscreen API")}class Oe extends ot{#t=b(this.#r());#e=b(!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=Hs();get supported(){return Oe.supported}onConnect(){if(this.supported)K(screen.orientation,"change",this.#a.bind(this));else{const t=window.matchMedia("(orientation: landscape)");t.onchange=this.#a.bind(this),L(()=>t.onchange=null)}L(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:f(this.#t),lock:this.#s},trigger:t})}async lock(t){f(this.#e)||this.#s===t||(this.#n(),await screen.orientation.lock(t),this.#e.set(!0),this.#s=t)}async unlock(){f(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 fn{#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 ai{#t=!1;#e=_s();#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=_s()}}function gn(i){return i?"true":"false"}function j(i){return()=>gn(i())}function bn(){return typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function ni(i,t){const e=t.composedPath()[0];return Os(e)&&i.contains(e)}const je=new Set;{let i=function(){for(const t of je)try{t()}catch{}window.requestAnimationFrame(i)};i()}function yn(i){return je.add(i),()=>je.delete(i)}function q(i,t,e){i.hasAttribute(t)||i.setAttribute(t,e)}function kt(i,t){if(i.hasAttribute("aria-label")||i.hasAttribute("data-no-label"))return;if(!oe(t)){v(i,"aria-label",t);return}function e(){v(i,"aria-label",t())}d(e)}function ri(i){const t=getComputedStyle(i);return t.display!=="none"&&parseInt(t.opacity)>0}function vn(i){return!!i&&("checkVisibility"in i?i.checkVisibility({checkOpacity:!0,checkVisibilityCSS:!0}):ri(i))}function oi(i,t){return yn(()=>t(vn(i)))}function li(i,t,e){for(;t;){if(t===i)return!0;if(e?.(t))break;t=t.parentElement}return!1}function St(i,t){return new _(i).add("pointerup",e=>{e.button===0&&!e.defaultPrevented&&t(e)}).add("keydown",e=>{jt(e)&&t(e)})}function ze(i){return le(i)&&(i.touches.length>1||i.changedTouches.length>1)}function bt(i){let t=ya(),e=window.requestAnimationFrame(()=>{zt(i,t),e=-1});return()=>void window.cancelAnimationFrame(e)}function Ye(i,t,e){let s,a=i,n=i.parentElement,r=i.content.firstElementChild,o=[];!r&&i.firstElementChild&&(i.innerHTML=i.firstElementChild.outerHTML,i.firstElementChild.remove(),r=i.content.firstElementChild);for(let l=0;l<t;l++)s=document.importNode(r,!0),e?.(s,l),n.insertBefore(s,a.nextSibling),o.push(s),a=s;return L(()=>{for(let l=0;l<o.length;l++)o[l].remove()}),o}function Xe(i){const t=document.createElement("template");return t.innerHTML=i,t.content}function Je(i){return i.cloneNode(!0).firstElementChild}function di(i,t,e,{offsetVarName:s,xOffset:a,yOffset:n,...r}){if(!i)return;const o=e.replace(" ","-").replace("-center","");if(at(i,"visibility",t?null:"hidden"),!t)return;let l=e.includes("top");const c=u=>e.includes("left")?`calc(-1 * ${u})`:u,h=u=>l?`calc(-1 * ${u})`:u;return va(t,i,()=>{$a(t,i,{placement:o,middleware:[...r.middleware??[],wa({fallbackAxisSideDirection:"start",crossAxis:!1}),Ta()],...r}).then(({x:u,y:g,middlewareData:$})=>{const w=!!$.flip?.index;l=e.includes(w?"bottom":"top"),i.setAttribute("data-placement",w?e.startsWith("top")?e.replace("top","bottom"):e.replace("bottom","top"):e),Object.assign(i.style,{top:`calc(${g+"px"} + ${h(n?n+"px":`var(--${s}-y-offset, 0px)`)})`,left:`calc(${u+"px"} + ${c(a?a+"px":`var(--${s}-x-offset, 0px)`)})`})})})}function $n(i){return getComputedStyle(i).animationName!=="none"}function wn(i){const t=document.createElement("slot");return t.name=i,t}function Tn(i){const t=b(!1);return d(()=>{const e=i();e&&new _(e).add("transitionstart",()=>t.set(!0)).add("transitionend",()=>t.set(!1))}),t}function ci(i,t){function e(){const s=i();if(!s)return;t();const a=new ResizeObserver(ft(t));return a.observe(s),()=>a.disconnect()}d(e)}function kn(i){const t=Sn(i),e=xn(i);let s=!1;return D(()=>{const a=t();return s&&!a?!1:(s=a,a||e())})}function Sn(i){const t=b(!1);return d(()=>{const e=i();if(!e){t.set(!1);return}new _(e).add("mouseenter",()=>t.set(!0)).add("mouseleave",()=>t.set(!1))}),t}function xn(i){const t=b(!1);return d(()=>{const e=i();if(!e){t.set(!1);return}new _(e).add("focusin",()=>t.set(!0)).add("focusout",()=>t.set(!1))}),t}function xt(i){return i instanceof HTMLElement}function Pn(){const i=b("dark"),t=window.matchMedia("(prefers-color-scheme: light)");function e(){i.set(t.matches?"light":"dark")}return e(),K(t,"change",e),i}function ui(i,t){d(()=>{const s=t();if(s==="system"){const a=Pn();d(()=>e(a()));return}e(s)});function e(s){Ve(i,"light",s==="light"),Ve(i,"dark",s==="dark")}}class Cn extends Dt{#t=-2;#e=!1;#s=b(!1);#i=b(!1);#a=null;#n=b(!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(){d(this.#r.bind(this))}#r(){const{viewType:t}=this.$state;if(!this.el||!this.#n())return;if(t()==="audio"){this.show();return}d(this.#o.bind(this)),d(this.#l.bind(this));const e=this.#c.bind(this),s=this.#u.bind(this),a=this.#h.bind(this);new _(this.el).add("can-play",n=>this.show(0,n)).add("play",e).add("pause",s).add("end",a).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 a=new _(this.el),n=this.hideOnMouseLeave;(!n||!this.#i())&&d(()=>{s()||a.add("pointermove",this.#b.bind(this))}),n&&a.add("mouseenter",this.#d.bind(this)).add("mouseleave",this.#p.bind(this))}#l(){const{paused:t,started:e,autoPlayError:s}=this.$state;if(t()||s()&&!e())return;const a=this.#b.bind(this);d(()=>{if(!this.el)return;const n=this.$state.pointer(),r=n==="coarse",o=new _(this.el),l=[r?"touchend":"pointerup","keydown"];for(const c of l)o.add(c,a,{passive:!1})})}#c(t){t.triggers.hasType("ended")||(this.show(0,t),this.hide(void 0,t))}#u(t){this.show(0,t)}#h(t){const{loop:e}=this.$state;e()&&this.hide(0,t)}#d(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||ze(t)||(de(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 En extends Dt{#t;#e;#s;controls;#i;#a;#n;#r=new ai;constructor(t,e,s){super(),this.#t=t,this.#e=e,this.#s=s,this.#n=s.$provider,this.controls=new Cn,this.#i=new mn,this.#a=new Oe}onAttach(){this.listen("fullscreen-change",this.#x.bind(this))}onConnect(t){const e=Object.getOwnPropertyNames(Object.getPrototypeOf(this)),s=new _(t),a=this.#c.bind(this);for(const n of e)n.startsWith("media-")&&s.add(n,a);this.#o(),d(this.#l.bind(this)),d(this.#m.bind(this)),d(this.#b.bind(this)),d(this.#g.bind(this)),d(this.#y.bind(this)),d(this.#$.bind(this)),d(this.#w.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",a=>{this.#u(a),s()})}#l(){const t=this.#n(),e=this.$state.canPlay();return t&&e&&this.#r.start(),()=>{this.#r.stop()}}#c(t){t.stopPropagation(),!t.defaultPrevented&&this[t.type]&&(f(this.#n)?this[t.type](t):this.#r.enqueue(t.type,()=>{f(this.#n)&&this[t.type](t)}))}async play(t){const{canPlay:e,paused:s,autoPlaying:a}=this.$state;if(this.#u(t)||!f(s))return;t&&this.#e.queue.enqueue("media-play-request",t);const n=f(a);try{const r=f(this.#n);return Ze(r,f(e)),An(n),await r.play()}catch(r){const o=this.createEvent("play-fail",{detail:He(r),trigger:t});throw o.autoPlay=n,this.#t.handle(o),r}}#u(t){const{load:e}=this.$props,{canLoad:s}=this.$state;if(e()==="play"&&!s()){const a=this.createEvent("media-start-loading",{trigger:t});return this.dispatchEvent(a),this.#r.enqueue("media-play-request",async()=>{try{await this.play(a)}catch{}}),!0}return!1}async pause(t){const{canPlay:e,paused:s}=this.$state;if(!f(s)){t&&this.#e.queue.enqueue("media-pause-request",t);try{const a=f(this.#n);return Ze(a,f(e)),await a.pause()}catch(a){throw this.#e.queue.delete("media-pause-request"),a}}}setAudioGain(t,e){const{audioGain:s,canSetAudioGain:a}=this.$state;if(s()===t)return;const n=this.#n();if(!n?.audioGain||!a())throw Error("[vidstack] audio gain api not available");e&&this.#e.queue.enqueue("media-audio-gain-change-request",e),n.audioGain.setGain(t)}seekToLiveEdge(t){const{canPlay:e,live:s,liveEdge:a,canSeek:n,liveSyncPosition:r,seekableEnd:o,userBehindLiveEdge:l}=this.$state;if(l.set(!1),f(()=>!s()||a()||!n()))return;const c=f(this.#n);Ze(c,f(e)),t&&this.#e.queue.enqueue("media-seek-request",t);const h=o()-2;c.setCurrentTime(Math.min(h,r()??h))}#h=!1;async enterFullscreen(t="prefer-media",e){const s=this.#d(t);if(hi(t,s),!s.active)return f(this.$state.pictureInPicture)&&(this.#h=!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.#d(t);if(hi(t,s),!!s.active){e&&this.#e.queue.enqueue("media-exit-fullscreen-request",e);try{const a=await s.exit();return this.#h&&f(this.$state.canPictureInPicture)&&await this.enterPictureInPicture(),a}finally{this.#h=!1}}}#d(t){const e=f(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 a of s){if(a===document.pictureInPictureElement&&document.exitPictureInPicture){await document.exitPictureInPicture();return}if(a.webkitPresentationMode==="picture-in-picture"){a.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=Fa&&!Ba&&Ga(e());t.set(s)}#$(){const{canFullscreen:t}=this.$state,e=this.#i.supported||!!this.#n()?.fullscreen?.supported;t.set(e)}#w(){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{}}#v;async requestGoogleCast(t){try{const{canGoogleCast:e}=this.$state;if(!f(e)){const a=Error("Cast not available.");throw a.code="CAST_NOT_AVAILABLE",a}if(Xt("https://www.gstatic.com"),!this.#v){const a=await import("./vidstack-Dp3Ib32P.js");this.#v=new a.GoogleCastLoader}await this.#v.prompt(this.#s),t&&this.#e.queue.enqueue("media-google-cast-request",t);const s=f(this.$state.remotePlaybackState)!=="disconnected";s&&this.$state.savedState.set({paused:f(this.$state.paused),currentTime:f(this.$state.currentTime)}),this.$state.remotePlaybackLoader.set(s?this.#v: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 a=t.detail,n=s[a];if(n){const r=t.type;this.#e.queue.enqueue(r,t),n.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#x(t){const e=f(this.$props.fullscreenOrientation),s=t.detail;if(!(ka(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:He(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.#T(e,t)}}async"media-exit-pip-request"(t){try{await this.exitPictureInPicture(t)}catch(e){this.#T(e,t)}}#T(t,e){this.#t.handle(this.createEvent("picture-in-picture-error",{detail:He(t)}))}"media-live-edge-request"(t){const{live:e,liveEdge:s,canSeek:a}=this.$state;if(!(!e()||s()||!a())){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 a=this.#n();a?.setPlaybackRate&&(this.#e.queue.enqueue("media-rate-change-request",t),a.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:a}=this.#s;if(e.readonly)return;this.#e.queue.enqueue("media-quality-change-request",t);const n=t.detail;if(n<0)e.autoSelect(t),t.isOriginTrusted&&s?.setVideoQuality?.(null);else{const r=e[n];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:a,seekableEnd:n,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 c=Zs(o,this.$state);!Number.isFinite(c)||!e()||(this.#e.queue.enqueue(l,t),this.#n().setCurrentTime(c),a()&&t.isOriginTrusted&&Math.abs(n()-c)>=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,a=this.#s.textTracks[e];if(a){const n=t.type;this.#e.queue.enqueue(n,t),a.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 a=t.type;this.#e.queue.enqueue(a,t),this.#s.$provider().setMuted(!1),s()===0&&(this.#e.queue.enqueue(a,t),this.#n().setVolume(.25))}"media-volume-change-request"(t){const{muted:e,volume:s}=this.$state,a=t.detail;if(s()===a)return;const n=t.type;this.#e.queue.enqueue(n,t),this.#n().setVolume(a),a>0&&e()&&(this.#e.queue.enqueue(n,t),this.#n().setMuted(!1))}#k(t,e,s){}}function Ze(i,t){if(!(i&&t))throw Error("[vidstack] media not ready")}function hi(i,t){if(!t?.supported)throw Error("[vidstack] no fullscreen support")}function An(i){if(!(!bn()||!i))throw Error("[vidstack] autoplay blocked")}class Mn{seeking=!1;looping=!1;replaying=!1;queue=new fn}function ts(i){return!M(i)&&("height"in i||"label"in i)}const Ln=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 Dn extends Dt{#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 _(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){d(this.#E.bind(this)),this.#p(),this.#m(),this.#b(),this.#c(),L(this.#u.bind(this))}onDestroy(){const{audioTracks:t,qualities:e,textTracks:s}=this.#e;t[I.reset](),e[I.reset](),s[I.reset](),this.#S()}handle(t){if(!this.scope)return;const e=t.type;re(()=>this[t.type]?.(t)),Ln.has(e)&&this.#s.set(e,t),this.dispatch(t)}#l=!1;#c(){this.#l&&(requestAnimationFrame(()=>{this.scope&&this.#e.remote.play(new z("dom-connect"))}),this.#l=!1)}#u(){this.#l||(this.#l=!this.$state.paused(),this.#e.$provider()?.pause())}#h(){this.#_(),this.#i=!1,this.#t.replaying=!1,this.#t.looping=!1,this.#r=!1,this.#o=void 0,this.#s.clear()}#d(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 _(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 _(t).add("add",this.#v.bind(this)).add("remove",this.#v.bind(this)).add("change",this.#x.bind(this)).add("auto-change",this.#f.bind(this)).add("readonly-change",this.#P.bind(this))}#b(){const t=this.#e.audioTracks;new _(t).add("add",this.#$.bind(this)).add("remove",this.#$.bind(this)).add("change",this.#w.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.#d("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){const{audioTracks:e}=this.$state;e.set(this.#e.audioTracks.toArray()),this.dispatch("audio-tracks-change",{detail:e(),trigger:t})}#w(t){const{audioTrack:e}=this.$state;e.set(this.#e.audioTracks.selected),t&&this.#d("media-audio-track-change-request",t),this.dispatch("audio-track-change",{detail:e(),trigger:t})}#v(t){const{qualities:e}=this.$state;e.set(this.#e.qualities.toArray()),this.dispatch("qualities-change",{detail:e(),trigger:t})}#x(t){const{quality:e}=this.$state;e.set(this.#e.qualities.selected),t&&this.#d("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()}#T=null;#k(){this.#S(),this.#T=d(()=>{const{qualities:t}=this.#e,{mediaWidth:e,mediaHeight:s}=this.$state,a=e(),n=s();if(a===0||n===0)return;let r=null,o=1/0;for(const l of t){const c=Math.abs(l.width-a)+Math.abs(l.height-n);c<o&&(o=c,r=l)}r&&t[I.select](r,!0,new z("resize",{detail:{width:a,height:n}}))})}#S(){this.#T?.(),this.#T=null}#P(){this.$state.canSetQuality.set(!this.#e.qualities.readonly)}#E(){const{canSetVolume:t,isGoogleCastConnected:e}=this.$state;if(e()){t.set(!1);return}Ha().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.#h()}"can-load"(t){this.$state.canLoad.set(!0),this.#s.set("can-load",t),this.#e.textTracks[X.canLoad](),this.#d("media-start-loading",t)}"can-load-poster"(t){this.$state.canLoadPoster.set(!0),this.#s.set("can-load-poster",t),this.#d("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 a=this.$state.providedViewType(),n=a==="unknown"?t.detail:a;s!==n&&setTimeout(()=>{requestAnimationFrame(()=>{this.scope&&(this.$state.inferredViewType.set(t.detail),this.dispatch("view-type-change",{detail:n,trigger:t}))})},0)}"stream-type-change"(t){const e=this.#s.get("source-change");e&&t.triggers.add(e);const{streamType:s,inferredStreamType:a}=this.$state;a.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.#d("media-rate-change-request",t),s()&&e?.setPlaybackRate?.(t.detail)}"remote-playback-change"(t){const{remotePlaybackState:e,remotePlaybackType:s}=this.$state,{type:a,state:n}=t.detail,r=n==="connected";s.set(a),e.set(n);const o=a==="airplay"?"media-airplay-request":"media-google-cast-request";if(r)this.#d(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:a}=this.#e,n=!1,r=!1;for(const o of t){if(!ts(o))continue;if(!e.some(c=>c.src===o.src)){const c=a.getBySrc(o.src);c&&(a[I.remove](c,s),r=!0)}}r&&!a.length&&(this.$state.savedState.set(null),a[I.reset](s));for(const o of e){if(!ts(o)||a.getBySrc(o.src))continue;const l={id:o.id??o.label??(o.height?o.height+"p":"0p"),width:o.width??0,bitrate:null,codec:null,...o,selected:!1};a[I.add](l,s),n=!0}n&&!a[lt.enableAuto]&&(this.#k(),a[lt.enableAuto]=this.#k.bind(this),a[lt.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:a}=this.#e;if(!e){this.#a=[],this.#n=[-1,-1],s[I.reset](t),a[I.reset](t),Js(this.$state,e),this.#h();return}Js(this.$state,e),this.#h()}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:a,canPlay:n}=this.$state;n.set(!0),s.set(t.buffered),e.set(t.seekable);const r=Lt(t.seekable)??1/0;a.set(r)}"duration-change"(t){const{live:e,intrinsicDuration:s,providedDuration:a,clipEndTime:n,ended:r}=this.$state,o=t.detail;if(!e()){const l=Number.isNaN(o)?0:o;s.set(l),r()&&this.#I(t)}(a()>0||n()>0)&&t.stopImmediatePropagation()}progress(t){const{buffered:e,seekable:s}=this.$state,{buffered:a,seekable:n}=t.detail,r=Lt(a),o=a.length!==e().length,l=r!==Lt(e()),c=Lt(n),h=n.length!==s().length,u=c!==Lt(s());(o||l)&&e.set(a),(h||u)&&s.set(n)}play(t){const{paused:e,autoPlayError:s,ended:a,autoPlaying:n,playsInline:r,pointer:o,muted:l,viewType:c,live:h,userBehindLiveEdge:u}=this.$state;if(this.#D(),!e()){t.stopImmediatePropagation();return}t.autoPlay=n();const g=this.#s.get("waiting");g&&t.triggers.add(g),this.#d("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})),n.set(!1)),(a()||this.#t.replaying)&&(this.#t.replaying=!1,a.set(!1),this.handle(this.createEvent("replay",{trigger:t}))),!r()&&c()==="video"&&o()==="coarse"&&this.#e.remote.enterFullscreen("prefer-media",t),h()&&!u()&&this.#e.remote.seekToLiveEdge(t)}#D(t){if(!f(this.#e.$provider))return;const{ended:s,seekableStart:a,clipEndTime:n,currentTime:r,realCurrentTime:o,duration:l}=this.$state,c=s()||o()<a()||n()>0&&o()>=n()||Math.abs(r()-l())<.1;return c&&this.dispatch("media-seek-request",{detail:a(),trigger:t}),c}"play-fail"(t){const{muted:e,autoPlaying:s}=this.$state,a=this.#s.get("play");a&&t.triggers.add(a),this.#d("media-play-request",t);const{paused:n,playing:r}=this.$state;n.set(!0),r.set(!1),this.#h(),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.#h(),0);const{paused:a,playing:n,live:r,liveSyncPosition:o,seekableEnd:l,started:c,currentTime:h,seeking:u,ended:g}=this.$state;if(a.set(!1),n.set(!0),u.set(!1),g.set(!1),this.#t.looping){this.#t.looping=!1;return}if(r()&&!c()&&h()===0){const $=o()??l()-2;Number.isFinite($)&&this.#e.$provider().setCurrentTime($)}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.#l=!0),this.#d("media-pause-request",t);const e=this.#s.get("seeked");e&&t.triggers.add(e);const{paused:s,playing:a}=this.$state;s.set(!0),a.set(!1),this.#i&&setTimeout(()=>{this.handle(this.createEvent("end",{trigger:t})),this.#i=!1},0),this.#h()}"time-change"(t){if(this.#t.looping){t.stopImmediatePropagation();return}let{waiting:e,played:s,clipEndTime:a,realCurrentTime:n,currentTime:r}=this.$state,o=t.detail,l=a();n.set(o),this.#q(),e.set(!1);for(const c of this.#e.textTracks)c[X.updateActiveCues](o,t);l>0&&o>=l&&(this.#i=!0,this.dispatch("media-pause-request",{trigger:t})),this.#O(),this.dispatch("time-update",{detail:{currentTime:r(),played:s()},trigger:t})}#q(){const{currentTime:t,played:e,paused:s}=this.$state;s()||(this.#n=za(this.#a,this.#n,t()),e.set(new me(this.#a)))}#I(t){const{clipStartTime:e,clipEndTime:s,duration:a}=this.$state;e()>0||s()>0||this.handle(this.createEvent("time-change",{detail:a(),trigger:t}))}#O(){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:a}=this.$state;a.set(t.detail),this.#d("media-audio-gain-change-request",t),s()&&e?.setAudioGain?.(a())}"volume-change"(t){const{storage:e}=this.#e,{volume:s,muted:a,canPlay:n}=this.$state,r=t.detail;s.set(r.volume),a.set(r.muted||r.volume===0),this.#d("media-volume-change-request",t),this.#d(r.muted?"media-mute-request":"media-unmute-request",t),n()&&(e?.setVolume?.(s()),e?.setMuted?.(a()))}seeking=At(t=>{const{seeking:e,realCurrentTime:s,paused:a}=this.$state;e.set(!0),s.set(t.detail),this.#d("media-seeking-request",t),a()&&(this.#o=t,this.#L()),this.#n=[-1,-1]},150,{leading:!0});seeked(t){const{seeking:e,currentTime:s,realCurrentTime:a,paused:n,seekableEnd:r,ended:o,live:l}=this.$state;if(this.#t.seeking)e.set(!0),t.stopImmediatePropagation();else if(e()){const c=this.#s.get("waiting");c&&t.triggers.add(c);const h=this.#s.get("seeking");h&&!t.triggers.has(h)&&t.triggers.add(h),n()&&this.#_(),e.set(!1),a.set(t.detail),this.#d("media-seek-request",t);const u=t?.originEvent;u?.isTrusted&&!(u instanceof MessageEvent)&&!/seek/.test(u.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.#L())}#L=Re(()=>{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.#D(t),this.dispatch("media-loop-request",{trigger:t})})},10);return}setTimeout(()=>this.#V(t),0)}}#V(t){const{storage:e}=this.#e,{paused:s,seeking:a,ended:n,duration:r}=this.$state;this.#I(t),s()||this.dispatch("pause",{trigger:t}),a()&&this.dispatch("seeked",{detail:r(),trigger:t}),n.set(!0),this.#h(),e?.setTime?.(r(),!0),this.dispatch("ended",{trigger:t})}#_(){this.#L.cancel(),this.$state.waiting.set(!1)}"fullscreen-change"(t){const e=t.detail;this.$state.fullscreen.set(e),this.#d(e?"media-enter-fullscreen-request":"media-exit-fullscreen-request",t)}"fullscreen-error"(t){this.#d("media-enter-fullscreen-request",t),this.#d("media-exit-fullscreen-request",t)}"orientation-change"(t){const e=t.detail.lock;this.#d(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.#d(e?"media-enter-pip-request":"media-exit-pip-request",t)}"picture-in-picture-error"(t){this.#d("media-enter-pip-request",t),this.#d("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 In extends Dt{onSetup(){this.#t();const t=[this.#i,this.#n,this.#d,this.#p,this.#o,this.#c,this.#u,this.#m,this.#g,this.#b,this.#r,this.#h,this.#l,this.#e,this.#a];for(const e of t)d(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:a,loop:n}=this.$props,r=this.$state;r.providedPoster.set(a()),r.providedStreamType.set(e()),r.providedViewType.set(t()),r.providedTitle.set(s()),r.providedLoop.set(n())}#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)}#l(){const{poster:t}=this.$state;this.dispatch("poster-change",{detail:t()})}#c(){const t=this.$props.crossOrigin()??this.$props.crossorigin(),e=t===!0?"":t;this.$state.crossOrigin.set(e)}#u(){const{duration:t}=this.$props;this.dispatch("media-duration-change-request",{detail:t()})}#h(){const t=this.$props.playsInline()||this.$props.playsinline();this.$state.playsInline.set(t),this.dispatch("plays-inline-change",{detail:t})}#d(){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 qn{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 a=s?localStorage.getItem(s):null,n=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,...a?JSON.parse(a):{},time:n?+n:null}}save(){if(!this.playerId)return;const t=JSON.stringify({...this.#t,time:void 0});localStorage.setItem(this.playerId,t)}saveTimeThrottled=At(this.saveTime.bind(this),1e3);saveTime(){if(!this.mediaId)return;const t=(this.#t.time??0).toString();localStorage.setItem(this.mediaId,t)}}const pi=["play","pause","seekforward","seekbackward","seekto"];class _n extends Dt{onConnect(){d(this.#e.bind(this)),d(this.#s.bind(this));const t=this.#i.bind(this);for(const e of pi)navigator.mediaSession.setActionHandler(e,t);L(this.#t.bind(this))}#t(){for(const t of pi)navigator.mediaSession.setActionHandler(t,null)}#e(){const{title:t,artist:e,artwork:s,poster:a}=this.$state;navigator.mediaSession.metadata=new MediaMetadata({title:t(),artist:e(),artwork:s()??[{src:a()}]})}#s(){const{canPlay:t,paused:e}=this.$state;navigator.mediaSession.playbackState=t()?e()?"paused":"playing":"none"}#i(t){const e=new z("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:Tt(t.seekTime)?t.seekTime:this.$state.currentTime()+(t.seekOffset??(t.action==="seekforward"?10:-10)),trigger:e});break}}}class On{#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 z("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,a=this.#s;(!s[a]||!Y(s[a]))&&(a=-1),a===-1&&(a=s.findIndex(n=>Y(n)&&n.default)),a===-1&&(a=s.findIndex(n=>Y(n))),a>=0&&this.changeTextTrackMode(a,"showing",t),this.#s=-1}disableCaptions(t){const e=this.getPlayer(t?.target);if(!e)return;const s=e.state.textTracks,a=e.state.textTrack;if(a){const n=s.indexOf(a);this.changeTextTrackMode(n,"disabled",t),this.#s=n}}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 a=new z(t,{bubbles:!0,composed:!0,cancelable:!0,detail:s,trigger:e});let n=e?.target||null;n&&n instanceof S&&(n=n.el),n=!n||n===document||n===window||n===document.body||this.#e?.el&&n instanceof Node&&!this.#e.el.contains(n)?this.#t??this.getPlayer()?.el:n??this.#t,this.#e?t==="media-play-request"&&!this.#e.state.canLoad?n?.dispatchEvent(a):this.#e.canPlayQueue.enqueue(t,()=>n?.dispatchEvent(a)):n?.dispatchEvent(a)}#n(t){}}class Vn extends ei{}class Rn{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[X.native]?.remove?.(),t[X.native]=null,this.#i.delete(t)}changeTrack(t){const e=t?.[X.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[X.native]??=this.#n(t);xt(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",a=t.src&&t.type==="vtt";return e.id=t.id,e.src=a?t.src:"",e.label=t.label,e.kind=t.kind,e.default=s,t.language&&(e.srclang=t.language),s&&!a&&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[X.native];if(!s)continue;if(!this.#t){s.track.mode=s.managed?"hidden":"disabled";continue}const a=s.track.mode==="showing";a&&this.#r(e,s.track),e.setMode(a?"showing":"disabled",t)}}}class Nn{#t=null;#e;#s=[];#i;#a=!1;#n=null;#r=null;constructor(t){this.#i=t;const e=t.textTracks;this.#e=e,d(this.#o.bind(this)),L(this.#p.bind(this)),new _(e).add("add",this.#u.bind(this)).add("remove",this.#h.bind(this)).add("mode-change",this.#d.bind(this))}#o(){const{nativeControls:t}=this.#i.$state;this.#a=t(),this.#d()}add(t){this.#s.push(t),re(this.#d.bind(this))}remove(t){t.detach(),this.#s.splice(this.#s.indexOf(t),1),re(this.#d.bind(this))}attachVideo(t){requestAnimationFrame(()=>{if(this.#t=t,t){this.#n=new Rn,this.#n.attach(t);for(const e of this.#e)this.#l(e)}this.#d()})}#l(t){Y(t)&&this.#n?.addTrack(t)}#c(t){Y(t)&&this.#n?.removeTrack(t)}#u(t){this.#l(t.detail)}#h(t){this.#c(t.detail)}#d(){const t=this.#e.selected;if(this.#t&&(this.#a||t?.[X.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,a)=>s.priority-a.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 Fn extends ti{#t=!1;#e={};#s=null;#i=null;[X.crossOrigin];constructor(){super()}get selected(){return this.items.find(e=>e.mode==="showing"&&Y(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.#c(t)}add(t,e){const s=t instanceof fe,a=s?t:new fe(t),n=t.kind==="captions"||t.kind==="subtitles"?"captions":t.kind;return this.#e[n]&&t.default&&delete t.default,a.addEventListener("mode-change",this.#r),this[I.add](a,e),a[X.crossOrigin]=this[X.crossOrigin],this.#t&&a[X.canLoad](),t.default&&(this.#e[n]=a),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[X.onModeChange]=null,t.removeEventListener("mode-change",this.#r),this[I.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))}[X.canLoad](){if(!this.#t){for(const t of this.items)t[X.canLoad]();this.#t=!0,this.#a()}}#a=Re(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 a=this.getByKind(s);if(a.find(c=>c.mode==="showing"))continue;const n=this.#i?a.find(c=>c.language===this.#i):null,r=W(s)?this.#e[s.find(c=>this.#e[c])||""]:this.#e[s],o=n??r,l=o&&Y(o);o&&(!l||t!==!1)&&(o.mode="showing",l&&this.#l(o))}},300);#n=null;#r=this.#o.bind(this);#o(t){const e=t.detail;if(this.#s&&Y(e)&&e!==this.#n&&this.#l(e),e.mode==="showing"){const s=Y(e)?["captions","subtitles"]:[e.kind];for(const a of this.items)a.mode==="showing"&&a!=e&&s.includes(a.kind)&&(a.mode="disabled")}this.dispatchEvent(new z("mode-change",{detail:t.detail,trigger:t}))}#l(t){t.mode!=="disabled"&&this.#c(t.language),this.#s?.setCaptions?.(t.mode==="showing")}#c(t){this.#s?.setLang?.(this.#i=t)}setStorage(t){this.#s=t}}let be=b(!1);K(document,"pointerdown",()=>{be.set(!1)}),K(document,"keydown",i=>{i.metaKey||i.altKey||i.ctrlKey||be.set(!0)});class dt extends ot{#t=b(!1);onConnect(t){d(()=>{const e=new _(t);if(!be()){this.#t.set(!1),ye(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),ye(t,s),e.add("focus",this.#e.bind(this)).add("blur",this.#s.bind(this))})}focused(){return this.#t()}#e(){this.#t.set(!0),ye(this.el,!0)}#s(){this.#t.set(!1),ye(this.el,!1)}#i(){mi(this.el,!0)}#a(){mi(this.el,!1)}}function ye(i,t){v(i,"data-focus",t),v(i,"data-hocus",t)}function mi(i,t){v(i,"data-hocus",t),v(i,"data-hover",t)}class Wt extends S{static props=cn;static state=Ys;#t;#e;#s;canPlayQueue=new ai;remoteControl;get#i(){return this.#t.$provider()}get#a(){return this.$props}constructor(){super(),new In;const t={player:this,qualities:new hn,audioTracks:new Vn,storage:null,$provider:b(null),$providerSetup:b(!1),$props:this.$props,$state:this.$state};t.remote=this.remoteControl=new On(void 0),t.remote.setPlayer(this),t.textTracks=new Fn,t.textTracks[X.crossOrigin]=this.$state.crossOrigin,t.textRenderers=new Nn(t),t.ariaKeys={},this.#t=t,tt(js,t),this.orientation=new Oe,new dt,new rn(t);const e=new Mn;this.#e=new Dn(e,t),this.#s=new En(this.#e,e,t),t.delegate=new pn(this.#e.handle.bind(this.#e),t),t.notify=t.delegate.notify.bind(t.delegate),typeof navigator<"u"&&"mediaSession"in navigator&&new _n,new si("load",this.startLoading.bind(this)),new si("posterLoad",this.startLoadingPoster.bind(this))}onSetup(){this.#c(),d(this.#l.bind(this)),d(this.#b.bind(this)),d(this.#p.bind(this)),d(this.#w.bind(this)),d(this.#y.bind(this)),d(this.#T.bind(this)),d(this.#x.bind(this))}onAttach(t){t.setAttribute("data-media-player",""),q(t,"tabindex","0"),q(t,"role","region"),d(this.#S.bind(this)),d(this.#r.bind(this)),d(this.#o.bind(this)),K(t,"find-media-player",this.#u.bind(this))}onConnect(t){Gs&&v(t,"data-iphone","");const e=window.matchMedia("(pointer: coarse)");this.#d(e),e.onchange=this.#d.bind(this);const s=new ResizeObserver(ft(this.#h.bind(this)));s.observe(t),d(this.#h.bind(this)),this.dispatch("media-player-connect",{detail:this,bubbles:!0,composed:!0}),L(()=>{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:a,providedTitle:n}=this.$state,r=s(),o=Vs(a()),l=o!=="Unknown"?`${r?"Live ":""}${o}`:r?"Live":"Media",c=e();v(this.el,"aria-label",`${l} Player`+(c?` - ${c}`:"")),t?.hasAttribute("title")&&(this.#n=!0,t?.removeAttribute("title"))}#o(){const t=this.orientation.landscape?"landscape":"portrait";this.$state.orientation.set(t),v(this.el,"data-orientation",t),this.#h()}#l(){this.$state.canPlay()&&this.#i?this.canPlayQueue.start():this.canPlayQueue.stop()}#c(){if(Wt[We]){this.setAttributes(Wt[We]);return}const t={"data-load":function(){return this.$props.load()},"data-captions":function(){const s=this.$state.textTrack();return!!s&&Y(s)},"data-ios-controls":function(){return this.$state.iOSControls()},"data-controls":function(){return this.controls.showing},"data-buffering":function(){const{canLoad:s,canPlay:a,waiting:n}=this.$state;return s()&&(!a()||n())},"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 Za){const a="data-"+(e[s]??Nt(s));t[a]=function(){return this.$state[s]()}}delete t.title,Wt[We]=t,this.setAttributes(t)}#u(t){t.detail(this)}#h(){if(!this.el)return;const t=this.el.clientWidth,e=this.el.clientHeight;this.$state.width.set(t),this.$state.height.set(e),at(this.el,"--player-width",t+"px"),at(this.el,"--player-height",e+"px")}#d(t){const e=t.matches?"coarse":"fine";v(this.el,"data-pointer",e),this.$state.pointer.set(e),this.#h()}get provider(){return this.#i}get controls(){return this.#s.controls}set controls(t){this.#a.controls.set(t)}orientation;get title(){return f(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 f(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 f(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 f(this.$state.currentTime)}set currentTime(t){this.#$(t)}#y(){this.#$(this.$props.currentTime())}#$(t){this.canPlayQueue.enqueue("currentTime",()=>{const{currentTime:e}=this.$state;t!==f(e)&&f(()=>{if(!this.#i)return;const s=Zs(t,this.$state);Number.isFinite(s)&&this.#i.setCurrentTime(s)})})}get volume(){return f(this.$state.volume)}set volume(t){this.#v(t)}#w(){this.#v(this.$props.volume())}#v(t){const e=Ke(0,t,1);this.canPlayQueue.enqueue("volume",()=>{this.#i&&this.#i.setVolume(e)})}get playbackRate(){return f(this.$state.playbackRate)}set playbackRate(t){this.#f(t)}#x(){this.#f(this.$props.playbackRate())}#f(t){this.canPlayQueue.enqueue("rate",()=>{this.#i&&this.#i.setPlaybackRate?.(t)})}#T(){this.#k(this.$props.playsInline())}#k(t){this.canPlayQueue.enqueue("playsinline",()=>{this.#i&&this.#i.setPlaysInline?.(t)})}#S(){let t=this.$props.storage(),e=M(t)?new qn:t;if(e?.onChange){const{source:s}=this.$state,a=M(t)?t:this.el?.id,n=D(this.#P.bind(this));d(()=>e.onChange(s(),n(),a||void 0))}this.#t.storage=e,this.#t.textTracks.setStorage(e),L(()=>{e?.onDestroy?.(),this.#t.storage=null,this.#t.textTracks.setStorage(null)})}#P(){const{clipStartTime:t,clipEndTime:e}=this.$props,{source:s}=this.$state,a=s();return a.src?`${a.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 O=Wt.prototype;A(O,"canPlayQueue"),A(O,"remoteControl"),A(O,"provider"),A(O,"controls"),A(O,"orientation"),A(O,"title"),A(O,"qualities"),A(O,"audioTracks"),A(O,"textTracks"),A(O,"textRenderers"),A(O,"duration"),A(O,"paused"),A(O,"muted"),A(O,"currentTime"),A(O,"volume"),A(O,"playbackRate"),H(O,"play"),H(O,"pause"),H(O,"enterFullscreen"),H(O,"exitFullscreen"),H(O,"enterPictureInPicture"),H(O,"exitPictureInPicture"),H(O,"seekToLiveEdge"),H(O,"startLoading"),H(O,"startLoadingPoster"),H(O,"requestAirPlay"),H(O,"requestGoogleCast"),H(O,"setAudioGain");class Bn extends k(HTMLElement,Wt){static tagName="media-player";static attrs={autoPlay:"autoplay",crossOrigin:"crossorigin",playsInline:"playsinline",preferNativeHLS:"prefer-native-hls",minLiveDVRWindow:"min-live-dvr-window"}}class Gn{name="audio";target;canPlay(t){return Ka(t)?!M(t.src)||t.type==="?"||Wa(this.target,t.type):!1}mediaType(){return"audio"}async load(t){return new(await import("../providers/vidstack-audio-cxaZF4jF.js")).AudioProvider(this.target,t)}}class es{name="video";target;canPlay(t){return Qa(t)?!M(t.src)||t.type==="?"||Ua(this.target,t.type):!1}mediaType(){return"video"}async load(t){return new(await import("../providers/vidstack-video-EWE67g5i.js")).VideoProvider(this.target,t)}}class As extends es{static supported=ja();name="dash";canPlay(t){return As.supported&&Be(t)}async load(t){return new(await import("../providers/vidstack-dash-DX1VjdTW.js")).DASHProvider(this.target,t)}}class Ms extends es{static supported=Ks();name="hls";canPlay(t){return Ms.supported&&Ge(t)}async load(t){return new(await import("../providers/vidstack-hls-2d6-2JAG.js")).HLSProvider(this.target,t)}}class Hn{name="vimeo";target;preconnect(){const t=["https://i.vimeocdn.com","https://f.vimeocdn.com","https://fresnel.vimeocdn.com"];for(const e of t)Xt(e)}canPlay(t){return M(t.src)&&t.type==="video/vimeo"}mediaType(){return"video"}async load(t){return new(await import("../providers/vidstack-vimeo-DqFeS0-d.js")).VimeoProvider(this.target,t)}async loadPoster(t,e,s){const{resolveVimeoVideoId:a,getVimeoVideoInfo:n}=await import("./vidstack-2f5gzOW6.js");if(!M(t.src))return null;const{videoId:r,hash:o}=a(t.src);return r?n(r,s,o).then(l=>l?l.poster:null):null}}class Kn{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)Xt(e)}canPlay(t){return M(t.src)&&t.type==="video/youtube"}mediaType(){return"video"}async load(t){return new(await import("../providers/vidstack-youtube-eivIFfMV.js")).YouTubeProvider(this.target,t)}async loadPoster(t,e,s){const{findYouTubePoster:a,resolveYouTubeVideoId:n}=await import("./vidstack-DiNS2Vx5.js"),r=M(t.src)&&n(t.src);return r?a(r,s):null}}function Wn(i,t){return fetch(i,t).then(e=>e.text()).then(e=>/type="static"/.test(e)?"on-demand":"live")}function fi(i,t){return fetch(i,t).then(e=>e.text()).then(e=>{const s=Qn(e);if(s)return fi(/^https?:/.test(s)?s:new URL(s,i).href,t);const a=/EXT-X-PLAYLIST-TYPE:\s*VOD/.test(e)?"on-demand":"live";return a==="live"&&Un(e)>=10&&(/#EXT-X-DVR-ENABLED:\s*true/.test(e)||e.includes("#EXT-X-DISCONTINUITY"))?"live:dvr":a})}function Qn(i){const t=i.match(/#EXT-X-STREAM-INF:[^\n]+(\n[^\n]+)*/g);return t?t[0].split(`
|
|
2
|
+
`)[1].trim():null}function Un(i){const t=i.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 ss=new Map;class jn{#t=!1;#e;#s;#i;#a;constructor(t,e,s,a=[]){this.#s=t,this.#i=e,this.#a=s;const n=new As,r=new Ms,o=new es,l=new Gn,c=new Kn,h=new Hn,u=[c,h];this.#e=D(()=>{const $=e.$state.remotePlaybackLoader(),w=e.$props.preferNativeHLS()?[o,l,n,r,...u,...a]:[r,o,l,n,...u,...a];return $?[$,...w]:w});const{$state:g}=e;g.sources.set(gi(e.$props.src()));for(const $ of g.sources()){const w=this.#e().find(C=>C.canPlay($));if(!w)continue;const P=w.mediaType($);e.$state.source.set($),e.$state.mediaType.set(P),e.$state.inferredViewType.set(P),this.#a.set(w),this.#t=!0;break}}connect(){const t=this.#a();this.#t&&(this.#l(this.#i.$state.source(),t),this.#c(t),this.#t=!1),d(this.#n.bind(this)),d(this.#r.bind(this)),d(this.#u.bind(this)),d(this.#h.bind(this)),d(this.#d.bind(this))}#n(){this.#i.notify("sources-change",[...gi(this.#i.$props.src()),...this.#s()])}#r(){const{$state:t}=this.#i,e=t.sources(),s=f(t.source),a=this.#o(s,e);if(e[0]?.src&&!a.src&&!a.type){const{crossOrigin:r}=t,o=ge(r()),l=new AbortController;return Promise.all(e.map(c=>M(c.src)&&c.type==="?"?fetch(c.src,{method:"HEAD",credentials:o,signal:l.signal}).then(h=>(c.type=h.headers.get("content-type")||"??",ss.set(c.src,c.type),c)).catch(()=>c):c)).then(c=>{if(l.signal.aborted)return;const h=this.#o(f(t.source),c);ht(),h.src||this.#i.notify("error",{message:"Failed to load resource.",code:4})}),()=>l.abort()}ht()}#o(t,e){let s={src:"",type:""},a=null,n=new z("sources-change",{detail:{sources:e}}),r=this.#e(),{started:o,paused:l,currentTime:c,quality:h,savedState:u}=this.#i.$state;for(const g of e){const $=r.find(w=>w.canPlay(g));if($){s=g,a=$;break}}if(ts(s)){const g=h(),$=e.find(w=>w.src===g?.src);f(o)?u.set({paused:f(l),currentTime:f(c)}):u.set(null),$&&(s=$,n=new z("quality-change",{detail:{quality:g}}))}return yi(t,s)||this.#l(s,a,n),a!==f(this.#a)&&this.#c(a,n),s}#l(t,e,s){this.#i.notify("source-change",t,s),this.#i.notify("media-type-change",e?.mediaType(t)||"unknown",s)}#c(t,e){this.#i.$providerSetup.set(!1),this.#i.notify("provider-change",null,e),t&&f(()=>t.preconnect?.(this.#i)),this.#a.set(t),this.#i.notify("provider-loader-change",t,e)}#u(){const t=this.#i.$provider();if(!(!t||f(this.#i.$providerSetup))){if(this.#i.$state.canLoad()){zt(()=>t.setup(),t.scope),this.#i.$providerSetup.set(!0);return}f(()=>t.preconnect?.())}}#h(){if(!this.#i.$providerSetup())return;const t=this.#i.$provider(),e=this.#i.$state.source(),s=f(this.#i.$state.crossOrigin),a=f(this.#i.$props.preferNativeHLS);if(!yi(t?.currentSrc,e)){if(this.#i.$state.canLoad()){const n=new AbortController;return Ge(e)?(a||!Ks())&&fi(e.src,{credentials:ge(s),signal:n.signal}).then(r=>{this.#i.notify("stream-type-change",r)}).catch(Ne):Be(e)?Wn(e.src,{credentials:ge(s),signal:n.signal}).then(r=>{this.#i.notify("stream-type-change",r)}).catch(Ne):this.#i.notify("stream-type-change","on-demand"),f(()=>{const r=f(this.#i.$state.preload);return t?.loadSource(e,r).catch(o=>{})}),()=>n.abort()}try{M(e.src)&&Xt(new URL(e.src).origin)}catch{}}}#d(){const t=this.#a(),{providedPoster:e,source:s,canLoadPoster:a}=this.#i.$state;if(!t||!t.loadPoster||!s()||!a()||e())return;const n=new AbortController,r=new z("source-change",{detail:s});return t.loadPoster(s(),this.#i,n).then(o=>{this.#i.notify("poster-change",o||"",r)}).catch(()=>{this.#i.notify("poster-change","",r)}),()=>{n.abort()}}}function gi(i){return(W(i)?i:[i]).map(t=>M(t)?{src:t,type:bi(t)}:{...t,type:bi(t.src,t.type)})}function bi(i,t){return M(t)&&t.length?t:M(i)&&ss.has(i)?ss.get(i):!t&&Ge({src:i,type:""})?"application/x-mpegurl":!t&&Be({src:i,type:""})?"application/dash+xml":!M(i)||i.startsWith("blob:")?"video/object":i.includes("youtube")||i.includes("youtu.be")?"video/youtube":i.includes("vimeo")&&!i.includes("progressive_redirect")&&!i.includes(".m3u8")?"video/vimeo":"?"}function yi(i,t){return i?.src===t?.src&&i?.type===t?.type}class zn{#t;#e;#s=[];constructor(t,e){this.#t=t,this.#e=e,d(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||fe.createId(e);this.#e.textTracks.getById(s)||(e.id=s,this.#e.textTracks.add(e))}this.#s=t}}class vi extends S{static props={loaders:[]};static state=new wt({loader:null});#t;#e;#s=b([]);#i=b([]);#a=null;onSetup(){this.#t=y(),this.#e=new jn(this.#s,this.#t,this.$state.loader,this.$props.loaders())}onAttach(t){t.setAttribute("data-media-provider","")}onConnect(t){this.#e.connect(),new zn(this.#i,this.#t);const e=new ResizeObserver(ft(this.#l.bind(this)));e.observe(t);const s=new MutationObserver(this.#c.bind(this));s.observe(t,{attributes:!0,childList:!0}),this.#l(),this.#c(),L(()=>{e.disconnect(),s.disconnect()})}#n=-1;load(t){t?.setAttribute("aria-hidden","true"),window.cancelAnimationFrame(this.#n),this.#n=requestAnimationFrame(()=>this.#r(t)),L(()=>{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&&f(s)||(this.#o(),this.#a=e,e&&(e.target=t||null),!(!e||!t)&&e.load(this.#t).then(a=>{this.scope&&f(this.$state.loader)===e&&this.#t.notify("provider-change",a)}))}onDestroy(){this.#a=null,this.#o()}#o(){this.#t?.notify("provider-change",null)}#l(){if(!this.el)return;const{player:t,$state:e}=this.#t,s=this.el.offsetWidth,a=this.el.offsetHeight;t&&(e.mediaWidth.set(s),e.mediaHeight.set(a),t.el&&(at(t.el,"--media-width",s+"px"),at(t.el,"--media-height",a+"px")))}#c(){const t=[],e=[],s=this.el.children;for(const a of s)if(!a.hasAttribute("data-vds")){if(a instanceof HTMLSourceElement){const n={id:a.id,src:a.src,type:a.type};for(const r of["id","src","width","height","bitrate","codec"]){const o=a.getAttribute(`data-${r}`);M(o)&&(n[r]=/id|src|codec/.test(r)?o:Number(o))}t.push(n)}else if(a instanceof HTMLTrackElement){const n={src:a.src,kind:a.track.kind,language:a.srclang,label:a.label,default:a.default,type:a.getAttribute("data-type")};e.push({id:a.id||fe.createId(n),...n})}}this.#s.set(t),this.#i.set(e),ht()}}const Yn=vi.prototype;H(Yn,"load");class Xn extends k(HTMLElement,vi){static tagName="media-provider";#t;#e=null;#s=null;onSetup(){this.#t=y(),this.setAttribute("keep-alive","")}onDestroy(){this.#s?.remove(),this.#s=null,this.#e?.remove(),this.#e=null}onConnect(){d(()=>{const t=this.$state.loader(),e=t?.name==="youtube",s=t?.name==="vimeo",a=e||s,n=t?.name==="google-cast",r=t?n?this.#r():a?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),a&&r&&d(()=>{const{nativeControls:l,viewType:c}=this.#t.$state,h=l(),u=c()==="audio";!h&&!u?(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),v(r,"data-no-controls",!h)})}e?r?.classList.add("vds-youtube"):s&&r?.classList.add("vds-vimeo"),a||(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 d(()=>{v(t,"controls",e()),v(t,"crossorigin",s())}),t}#a(){const t=this.#e instanceof HTMLVideoElement?this.#e:document.createElement("video"),{crossOrigin:e,poster:s,nativeControls:a}=this.#t.$state,n=D(()=>a()?"true":null),r=D(()=>s()&&a()?s():null);return d(()=>{v(t,"controls",n()),v(t,"crossorigin",e()),v(t,"poster",r())}),t}#n(){const t=this.#e instanceof HTMLIFrameElement?this.#e:document.createElement("iframe"),{nativeControls:e}=this.#t.$state;return d(()=>v(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-DLGH9jfs.js").then(({insertContent:e})=>{e(t,this.#t.$state)}),t}}T(Bn),T(Xn);const $i=ut();function x(){return V($i)}const Jn={colorScheme:"system",download:null,customIcons:!1,disableTimeSlider:!1,menuContainer:null,menuGroup:"bottom",noAudioGain:!1,noGestures:!1,noKeyboardAnimations:!1,noModal:!1,noScrubGesture:!1,playbackRates:{min:0,max:2,step:.25},audioGains:{min:0,max:300,step:25},seekStep:5,sliderChaptersMinWidth:325,hideQualityBitrate:!1,episodes:null,episodesTitle:"Episodes",smallWhen:!1,thumbnails:null,translations:null,when:!1};class is extends S{static props=Jn;#t;#e=D(()=>{const t=this.$props.when();return this.#i(t)});#s=D(()=>{const t=this.$props.smallWhen();return this.#i(t)});get isMatch(){return this.#e()}get isSmallLayout(){return this.#s()}onSetup(){this.#t=y(),this.setAttributes({"data-match":this.#e,"data-sm":()=>this.#s()?"":null,"data-lg":()=>this.#s()?null:"","data-size":()=>this.#s()?"sm":"lg","data-no-scrub-gesture":this.$props.noScrubGesture}),tt($i,{...this.$props,when:this.#e,smallWhen:this.#s,userPrefersAnnouncements:b(!0),userPrefersKeyboardAnimations:b(!0),menuPortal:b(null)})}onAttach(t){ui(t,this.$props.colorScheme)}#i(t){return t!=="never"&&(Rs(t)?t:D(()=>t(this.#t.player.state))())}}const wi=is.prototype;A(wi,"isMatch"),A(wi,"isSmallLayout");let Zn=class extends is{static props={...super.props,when:({viewType:t})=>t==="audio",smallWhen:({width:t})=>t<576}};class tr extends xa{#t=null;#e=!1;#s=null;constructor(t){super(t),this.#e=t.type===Ns.ATTRIBUTE||t.type===Ns.BOOLEAN_ATTRIBUTE}render(t){return t!==this.#t&&(this.disconnected(),this.#t=t,this.isConnected&&this.#i()),this.#t?this.#a(f(this.#t)):Pa}reconnected(){this.#i()}disconnected(){this.#s?.(),this.#s=null}#i(){this.#t&&(this.#s=d(this.#r.bind(this)))}#a(t){return this.#e?Fe(t):t}#n(t){this.setValue(this.#a(t))}#r(){this.#n(this.#t?.())}}function m(i){return Sa(tr)(D(i))}class ve extends HTMLElement{rootPart=null;connectedCallback(){this.rootPart=ce(this.render(),this,{renderBefore:this.firstChild}),this.rootPart.setConnected(!0)}disconnectedCallback(){this.rootPart?.setConnected(!1),this.rootPart=null,ce(null,this)}}function Ti(i,t){d(()=>{const{player:e}=y(),s=e.el;return s&&v(s,"data-layout",t()&&i),()=>s?.removeAttribute("data-layout")})}class ki{#t;#e;elements=new Set;constructor(t,e){this.#t=t,this.#e=e}connect(){this.#i();const t=new MutationObserver(this.#s);for(const e of this.#t)t.observe(e,{childList:!0,subtree:!0});L(()=>t.disconnect()),L(this.disconnect.bind(this))}disconnect(){this.elements.clear()}assign(t,e){Os(t)?(e.textContent="",e.append(t)):(ce(null,e),ce(t,e)),e.style.display||(e.style.display="contents");const s=e.firstElementChild;if(!s)return;const a=e.getAttribute("data-class");a&&s.classList.add(...a.split(" "))}#s=ft(this.#i.bind(this));#i(t){if(t&&!t.some(a=>a.addedNodes.length))return;let e=!1,s=this.#t.flatMap(a=>[...a.querySelectorAll("slot")]);for(const a of s)!a.hasAttribute("name")||this.elements.has(a)||(this.elements.add(a),e=!0);e&&this.#e(this.elements)}}let er=0,$e="data-slot-id";class as{#t;slots;constructor(t){this.#t=t,this.slots=new ki(t,this.#s.bind(this))}connect(){this.slots.connect(),this.#s();const t=new MutationObserver(this.#e);for(const e of this.#t)t.observe(e,{childList:!0});L(()=>t.disconnect())}#e=ft(this.#s.bind(this));#s(){for(const t of this.#t)for(const e of t.children){if(e.nodeType!==1)continue;const s=e.getAttribute("slot");if(!s)continue;e.style.display="none";let a=e.getAttribute($e);a||e.setAttribute($e,a=++er+"");for(const n of this.slots.elements){if(n.getAttribute("name")!==s||n.getAttribute($e)===a)continue;const r=document.importNode(e,!0);s.includes("-icon")&&r.classList.add("vds-icon"),r.style.display="",r.removeAttribute("slot"),this.slots.assign(r,n),n.setAttribute($e,a)}}}}function et(i,t){return i()?.[t]??t}function ns(){return m(()=>{const{translations:i,userPrefersAnnouncements:t}=x();return t()?p`<media-announcer .translations=${m(i)}></media-announcer>`:null})}function it(i,t=""){return p`<slot
|
|
4
|
+
name=${`${i}-icon`}
|
|
5
|
+
data-class=${`vds-icon vds-${i}-icon${t?` ${t}`:""}`}
|
|
6
|
+
></slot>`}function te(i){return i.map(t=>it(t))}function E(i,t){return m(()=>et(i,t))}function sr({tooltip:i}){const{translations:t}=x(),{remotePlaybackState:e}=R(),s=m(()=>{const n=et(t,"AirPlay"),r=Vs(e());return`${n} ${r}`}),a=E(t,"AirPlay");return p`
|
|
7
|
+
<media-tooltip class="vds-airplay-tooltip vds-tooltip">
|
|
8
|
+
<media-tooltip-trigger>
|
|
9
|
+
<media-airplay-button class="vds-airplay-button vds-button" aria-label=${s}>
|
|
10
|
+
${it("airplay")}
|
|
11
|
+
</media-airplay-button>
|
|
12
|
+
</media-tooltip-trigger>
|
|
13
|
+
<media-tooltip-content class="vds-tooltip-content" placement=${i}>
|
|
14
|
+
<span class="vds-airplay-tooltip-text">${a}</span>
|
|
15
|
+
</media-tooltip-content>
|
|
16
|
+
</media-tooltip>
|
|
17
|
+
`}function we({tooltip:i}){const{translations:t}=x(),e=E(t,"Play"),s=E(t,"Pause");return p`
|
|
18
|
+
<media-tooltip class="vds-play-tooltip vds-tooltip">
|
|
19
|
+
<media-tooltip-trigger>
|
|
20
|
+
<media-play-button
|
|
21
|
+
class="vds-play-button vds-button"
|
|
22
|
+
aria-label=${E(t,"Play")}
|
|
23
|
+
>
|
|
24
|
+
${te(["play","pause","replay"])}
|
|
25
|
+
</media-play-button>
|
|
26
|
+
</media-tooltip-trigger>
|
|
27
|
+
<media-tooltip-content class="vds-tooltip-content" placement=${i}>
|
|
28
|
+
<span class="vds-play-tooltip-text">${e}</span>
|
|
29
|
+
<span class="vds-pause-tooltip-text">${s}</span>
|
|
30
|
+
</media-tooltip-content>
|
|
31
|
+
</media-tooltip>
|
|
32
|
+
`}function Si({tooltip:i,ref:t=Ne}){const{translations:e}=x(),s=E(e,"Mute"),a=E(e,"Unmute");return p`
|
|
33
|
+
<media-tooltip class="vds-mute-tooltip vds-tooltip">
|
|
34
|
+
<media-tooltip-trigger>
|
|
35
|
+
<media-mute-button
|
|
36
|
+
class="vds-mute-button vds-button"
|
|
37
|
+
aria-label=${E(e,"Mute")}
|
|
38
|
+
${ue(t)}
|
|
39
|
+
>
|
|
40
|
+
${te(["mute","volume-low","volume-high"])}
|
|
41
|
+
</media-mute-button>
|
|
42
|
+
</media-tooltip-trigger>
|
|
43
|
+
<media-tooltip-content class="vds-tooltip-content" placement=${i}>
|
|
44
|
+
<span class="vds-mute-tooltip-text">${a}</span>
|
|
45
|
+
<span class="vds-unmute-tooltip-text">${s}</span>
|
|
46
|
+
</media-tooltip-content>
|
|
47
|
+
</media-tooltip>
|
|
48
|
+
`}function rs({tooltip:i}){const{translations:t}=x(),e=E(t,"Closed-Captions On"),s=E(t,"Closed-Captions Off");return p`
|
|
49
|
+
<media-tooltip class="vds-caption-tooltip vds-tooltip">
|
|
50
|
+
<media-tooltip-trigger>
|
|
51
|
+
<media-caption-button
|
|
52
|
+
class="vds-caption-button vds-button"
|
|
53
|
+
aria-label=${E(t,"Captions")}
|
|
54
|
+
>
|
|
55
|
+
${te(["cc-on","cc-off"])}
|
|
56
|
+
</media-caption-button>
|
|
57
|
+
</media-tooltip-trigger>
|
|
58
|
+
<media-tooltip-content class="vds-tooltip-content" placement=${i}>
|
|
59
|
+
<span class="vds-cc-on-tooltip-text">${s}</span>
|
|
60
|
+
<span class="vds-cc-off-tooltip-text">${e}</span>
|
|
61
|
+
</media-tooltip-content>
|
|
62
|
+
</media-tooltip>
|
|
63
|
+
`}function ir(){const{translations:i}=x(),t=E(i,"Enter PiP"),e=E(i,"Exit PiP");return p`
|
|
64
|
+
<media-tooltip class="vds-pip-tooltip vds-tooltip">
|
|
65
|
+
<media-tooltip-trigger>
|
|
66
|
+
<media-pip-button
|
|
67
|
+
class="vds-pip-button vds-button"
|
|
68
|
+
aria-label=${E(i,"PiP")}
|
|
69
|
+
>
|
|
70
|
+
${te(["pip-enter","pip-exit"])}
|
|
71
|
+
</media-pip-button>
|
|
72
|
+
</media-tooltip-trigger>
|
|
73
|
+
<media-tooltip-content class="vds-tooltip-content">
|
|
74
|
+
<span class="vds-pip-enter-tooltip-text">${t}</span>
|
|
75
|
+
<span class="vds-pip-exit-tooltip-text">${e}</span>
|
|
76
|
+
</media-tooltip-content>
|
|
77
|
+
</media-tooltip>
|
|
78
|
+
`}function xi({tooltip:i}){const{translations:t}=x(),e=E(t,"Enter Fullscreen"),s=E(t,"Exit Fullscreen");return p`
|
|
79
|
+
<media-tooltip class="vds-fullscreen-tooltip vds-tooltip">
|
|
80
|
+
<media-tooltip-trigger>
|
|
81
|
+
<media-fullscreen-button
|
|
82
|
+
class="vds-fullscreen-button vds-button"
|
|
83
|
+
aria-label=${E(t,"Fullscreen")}
|
|
84
|
+
>
|
|
85
|
+
${te(["fs-enter","fs-exit"])}
|
|
86
|
+
</media-fullscreen-button>
|
|
87
|
+
</media-tooltip-trigger>
|
|
88
|
+
<media-tooltip-content class="vds-tooltip-content" placement=${i}>
|
|
89
|
+
<span class="vds-fs-enter-tooltip-text">${e}</span>
|
|
90
|
+
<span class="vds-fs-exit-tooltip-text">${s}</span>
|
|
91
|
+
</media-tooltip-content>
|
|
92
|
+
</media-tooltip>
|
|
93
|
+
`}function Bt({backward:i,tooltip:t}){const{translations:e,seekStep:s}=x(),a=i?"Seek Backward":"Seek Forward",n=E(e,a);return p`
|
|
94
|
+
<media-tooltip class="vds-seek-tooltip vds-tooltip">
|
|
95
|
+
<media-tooltip-trigger>
|
|
96
|
+
<media-seek-button
|
|
97
|
+
class="vds-seek-button vds-button"
|
|
98
|
+
seconds=${m(()=>(i?-1:1)*s())}
|
|
99
|
+
aria-label=${n}
|
|
100
|
+
>
|
|
101
|
+
${it(i?"seek-backward":"seek-forward")}
|
|
102
|
+
</media-seek-button>
|
|
103
|
+
</media-tooltip-trigger>
|
|
104
|
+
<media-tooltip-content class="vds-tooltip-content" placement=${t}>
|
|
105
|
+
${E(e,a)}
|
|
106
|
+
</media-tooltip-content>
|
|
107
|
+
</media-tooltip>
|
|
108
|
+
`}function Pi(){const{translations:i}=x(),{live:t}=R(),e=E(i,"Skip To Live"),s=E(i,"LIVE");return t()?p`
|
|
109
|
+
<media-live-button class="vds-live-button" aria-label=${e}>
|
|
110
|
+
<span class="vds-live-button-text">${s}</span>
|
|
111
|
+
</media-live-button>
|
|
112
|
+
`:null}function os(){return m(()=>{const{download:i,translations:t}=x(),e=i();if(Ca(e))return null;const{source:s,title:a}=R(),n=s(),r=Qs({title:a(),src:n,download:e});return M(r?.url)?p`
|
|
113
|
+
<media-tooltip class="vds-download-tooltip vds-tooltip">
|
|
114
|
+
<media-tooltip-trigger>
|
|
115
|
+
<a
|
|
116
|
+
role="button"
|
|
117
|
+
class="vds-download-button vds-button"
|
|
118
|
+
aria-label=${E(t,"Download")}
|
|
119
|
+
href=${Us(r.url,{download:r.name})}
|
|
120
|
+
download=${r.name}
|
|
121
|
+
target="_blank"
|
|
122
|
+
>
|
|
123
|
+
<slot name="download-icon" data-class="vds-icon" />
|
|
124
|
+
</a>
|
|
125
|
+
</media-tooltip-trigger>
|
|
126
|
+
<media-tooltip-content class="vds-tooltip-content" placement="top">
|
|
127
|
+
${E(t,"Download")}
|
|
128
|
+
</media-tooltip-content>
|
|
129
|
+
</media-tooltip>
|
|
130
|
+
`:null})}function Ci({tooltip:i}={}){const t="Episodes",e="Episodes";function s(n){n.stopPropagation(),n.currentTarget?.dispatchEvent(new CustomEvent("vds-episodes-open",{bubbles:!0,composed:!0}))}const a=p`
|
|
131
|
+
<button
|
|
132
|
+
type="button"
|
|
133
|
+
class="vds-episode-button vds-button"
|
|
134
|
+
aria-label=${t}
|
|
135
|
+
@pointerup=${s}
|
|
136
|
+
>
|
|
137
|
+
${it("menu-episodes")}
|
|
138
|
+
</button>
|
|
139
|
+
`;return i?p`
|
|
140
|
+
<media-tooltip class="vds-episode-tooltip vds-tooltip">
|
|
141
|
+
<media-tooltip-trigger> ${a} </media-tooltip-trigger>
|
|
142
|
+
<media-tooltip-content class="vds-tooltip-content" placement=${i}>
|
|
143
|
+
<span class="vds-episode-tooltip-text">${e}</span>
|
|
144
|
+
</media-tooltip-content>
|
|
145
|
+
</media-tooltip>
|
|
146
|
+
`:a}function ls(){const{translations:i}=x();return p`
|
|
147
|
+
<media-captions
|
|
148
|
+
class="vds-captions"
|
|
149
|
+
.exampleText=${E(i,"Captions look like this")}
|
|
150
|
+
></media-captions>
|
|
151
|
+
`}function It(){return p`<div class="vds-controls-spacer"></div>`}function Ei(i,t){return p`
|
|
152
|
+
<media-menu-portal .container=${m(i)} disabled="fullscreen">
|
|
153
|
+
${t}
|
|
154
|
+
</media-menu-portal>
|
|
155
|
+
`}function Ai(i,t,e,s){let a=M(t)?document.querySelector(t):t;a||(a=i?.closest("dialog")),a||(a=document.body);const n=document.createElement("div");n.style.display="contents",n.classList.add(e),a.append(n),d(()=>{if(!n)return;const{viewType:o}=R(),l=s();v(n,"data-view-type",o()),v(n,"data-sm",l),v(n,"data-lg",!l),v(n,"data-size",l?"sm":"lg")});const{colorScheme:r}=x();return ui(n,r),n}function Mi({placement:i,tooltip:t,portal:e}){const{textTracks:s}=y(),{viewType:a,seekableStart:n,seekableEnd:r}=R(),{translations:o,thumbnails:l,menuPortal:c,noModal:h,menuGroup:u,smallWhen:g}=x();if(D(()=>{const G=n(),pt=r(),mt=b(null);return Yt(s,"chapters",mt.set),!mt()?.cues.filter($t=>$t.startTime<=pt&&$t.endTime>=G)?.length})())return null;const w=D(()=>h()?he(i):g()?null:he(i)),P=D(()=>!g()&&u()==="bottom"&&a()==="video"?26:0),C=b(!1);function B(){C.set(!0)}function ct(){C.set(!1)}const Z=p`
|
|
156
|
+
<media-menu-items
|
|
157
|
+
class="vds-chapters-menu-items vds-menu-items"
|
|
158
|
+
placement=${m(w)}
|
|
159
|
+
offset=${m(P)}
|
|
160
|
+
>
|
|
161
|
+
${m(()=>C()?p`
|
|
162
|
+
<media-chapters-radio-group
|
|
163
|
+
class="vds-chapters-radio-group vds-radio-group"
|
|
164
|
+
.thumbnails=${m(l)}
|
|
165
|
+
>
|
|
166
|
+
<template>
|
|
167
|
+
<media-radio class="vds-chapter-radio vds-radio">
|
|
168
|
+
<media-thumbnail class="vds-thumbnail"></media-thumbnail>
|
|
169
|
+
<div class="vds-chapter-radio-content">
|
|
170
|
+
<span class="vds-chapter-radio-label" data-part="label"></span>
|
|
171
|
+
<span class="vds-chapter-radio-start-time" data-part="start-time"></span>
|
|
172
|
+
<span class="vds-chapter-radio-duration" data-part="duration"></span>
|
|
173
|
+
</div>
|
|
174
|
+
</media-radio>
|
|
175
|
+
</template>
|
|
176
|
+
</media-chapters-radio-group>
|
|
177
|
+
`:null)}
|
|
178
|
+
</media-menu-items>
|
|
179
|
+
`;return p`
|
|
180
|
+
<media-menu class="vds-chapters-menu vds-menu" @open=${B} @close=${ct}>
|
|
181
|
+
<media-tooltip class="vds-tooltip">
|
|
182
|
+
<media-tooltip-trigger>
|
|
183
|
+
<media-menu-button
|
|
184
|
+
class="vds-menu-button vds-button"
|
|
185
|
+
aria-label=${E(o,"Chapters")}
|
|
186
|
+
>
|
|
187
|
+
${it("menu-chapters")}
|
|
188
|
+
</media-menu-button>
|
|
189
|
+
</media-tooltip-trigger>
|
|
190
|
+
<media-tooltip-content
|
|
191
|
+
class="vds-tooltip-content"
|
|
192
|
+
placement=${oe(t)?m(t):t}
|
|
193
|
+
>
|
|
194
|
+
${E(o,"Chapters")}
|
|
195
|
+
</media-tooltip-content>
|
|
196
|
+
</media-tooltip>
|
|
197
|
+
${Ei(c,Z)}
|
|
198
|
+
</media-menu>
|
|
199
|
+
`}function ds(i){const{style:t}=new Option;return t.color=i,t.color.match(/\((.*?)\)/)[1].replace(/,/g," ")}const cs={type:"color"},ar={type:"radio",values:{"Monospaced Serif":"mono-serif","Proportional Serif":"pro-serif","Monospaced Sans-Serif":"mono-sans","Proportional Sans-Serif":"pro-sans",Casual:"casual",Cursive:"cursive","Small Capitals":"capitals"}},nr={type:"slider",min:0,max:400,step:25,upIcon:null,downIcon:null},rr={type:"slider",min:0,max:100,step:5,upIcon:null,downIcon:null},or={type:"radio",values:["None","Drop Shadow","Raised","Depressed","Outline"]},Te={fontFamily:"pro-sans",fontSize:"100%",textColor:"#ffffff",textOpacity:"100%",textShadow:"none",textBg:"#000000",textBgOpacity:"100%",displayBg:"#000000",displayBgOpacity:"0%"},qt=Object.keys(Te).reduce((i,t)=>({...i,[t]:b(Te[t])}),{});for(const i of Object.keys(qt)){const t=localStorage.getItem(`vds-player:${Nt(i)}`);M(t)&&qt[i].set(t)}function lr(){for(const i of Object.keys(qt)){const t=Te[i];qt[i].set(t)}}let Li=!1,us=new Set;function dr(){const{player:i}=y();us.add(i),L(()=>us.delete(i)),Li||(zt(()=>{for(const t of Ea(qt)){const e=qt[t],s=Te[t],a=`--media-user-${Nt(t)}`,n=`vds-player:${Nt(t)}`;d(()=>{const r=e(),o=r===s,l=o?null:cr(i,t,r);for(const c of us)c.el?.style.setProperty(a,l);o?localStorage.removeItem(n):localStorage.setItem(n,r)})}},null),Li=!0)}function cr(i,t,e){switch(t){case"fontFamily":const s=e==="capitals"?"small-caps":"";return i.el?.style.setProperty("--media-user-font-variant",s),hr(e);case"fontSize":case"textOpacity":case"textBgOpacity":case"displayBgOpacity":return ur(e);case"textColor":return`rgb(${ds(e)} / var(--media-user-text-opacity, 1))`;case"textShadow":return pr(e);case"textBg":return`rgb(${ds(e)} / var(--media-user-text-bg-opacity, 1))`;case"displayBg":return`rgb(${ds(e)} / var(--media-user-display-bg-opacity, 1))`}}function ur(i){return(parseInt(i)/100).toString()}function hr(i){switch(i){case"mono-serif":return'"Courier New", Courier, "Nimbus Mono L", "Cutive Mono", monospace';case"mono-sans":return'"Deja Vu Sans Mono", "Lucida Console", Monaco, Consolas, "PT Mono", monospace';case"pro-sans":return'Roboto, "Arial Unicode Ms", Arial, Helvetica, Verdana, "PT Sans Caption", sans-serif';case"casual":return'"Comic Sans MS", Impact, Handlee, fantasy';case"cursive":return'"Monotype Corsiva", "URW Chancery L", "Apple Chancery", "Dancing Script", cursive';case"capitals":return'"Arial Unicode Ms", Arial, Helvetica, Verdana, "Marcellus SC", sans-serif + font-variant=small-caps';default:return'"Times New Roman", Times, Georgia, Cambria, "PT Serif Caption", serif'}}function pr(i){switch(i){case"drop shadow":return"rgb(34, 34, 34) 1.86389px 1.86389px 2.79583px, rgb(34, 34, 34) 1.86389px 1.86389px 3.72778px, rgb(34, 34, 34) 1.86389px 1.86389px 4.65972px";case"raised":return"rgb(34, 34, 34) 1px 1px, rgb(34, 34, 34) 2px 2px";case"depressed":return"rgb(204, 204, 204) 1px 1px, rgb(34, 34, 34) -1px -1px";case"outline":return"rgb(34, 34, 34) 0px 0px 1.86389px, rgb(34, 34, 34) 0px 0px 1.86389px, rgb(34, 34, 34) 0px 0px 1.86389px, rgb(34, 34, 34) 0px 0px 1.86389px, rgb(34, 34, 34) 0px 0px 1.86389px";default:return""}}let mr=0;function nt({label:i="",value:t="",children:e}){if(!i)return p`
|
|
200
|
+
<div class="vds-menu-section">
|
|
201
|
+
<div class="vds-menu-section-body">${e}</div>
|
|
202
|
+
</div>
|
|
203
|
+
`;const s=`vds-menu-section-${++mr}`;return p`
|
|
204
|
+
<section class="vds-menu-section" role="group" aria-labelledby=${s}>
|
|
205
|
+
<div class="vds-menu-section-title">
|
|
206
|
+
<header id=${s}>${i}</header>
|
|
207
|
+
${t?p`<div class="vds-menu-section-value">${t}</div>`:null}
|
|
208
|
+
</div>
|
|
209
|
+
<div class="vds-menu-section-body">${e}</div>
|
|
210
|
+
</section>
|
|
211
|
+
`}function ee({label:i,children:t}){return p`
|
|
212
|
+
<div class="vds-menu-item">
|
|
213
|
+
<div class="vds-menu-item-label">${i}</div>
|
|
214
|
+
${t}
|
|
215
|
+
</div>
|
|
216
|
+
`}function Pt({label:i,icon:t,hint:e}){return p`
|
|
217
|
+
<media-menu-button class="vds-menu-item">
|
|
218
|
+
${it("menu-arrow-left","vds-menu-close-icon")}
|
|
219
|
+
${t?it(t,"vds-menu-item-icon"):null}
|
|
220
|
+
<span class="vds-menu-item-label">${m(i)}</span>
|
|
221
|
+
<span class="vds-menu-item-hint" data-part="hint">${e?m(e):null} </span>
|
|
222
|
+
${it("menu-arrow-right","vds-menu-open-icon")}
|
|
223
|
+
</media-menu-button>
|
|
224
|
+
`}function fr({value:i=null,options:t,hideLabel:e=!1,children:s=null,onChange:a=null}){function n(r){const{value:o,label:l}=r;return p`
|
|
225
|
+
<media-radio class="vds-radio" value=${o}>
|
|
226
|
+
${it("menu-radio-check")}
|
|
227
|
+
${e?null:p`
|
|
228
|
+
<span class="vds-radio-label" data-part="label">
|
|
229
|
+
${M(l)?l:m(l)}
|
|
230
|
+
</span>
|
|
231
|
+
`}
|
|
232
|
+
${oe(s)?s(r):s}
|
|
233
|
+
</media-radio>
|
|
234
|
+
`}return p`
|
|
235
|
+
<media-radio-group
|
|
236
|
+
class="vds-radio-group"
|
|
237
|
+
value=${M(i)?i:i?m(i):""}
|
|
238
|
+
@change=${a}
|
|
239
|
+
>
|
|
240
|
+
${W(t)?t.map(n):m(()=>t().map(n))}
|
|
241
|
+
</media-radio-group>
|
|
242
|
+
`}function gr(i){return W(i)?i.map(t=>({label:t,value:t.toLowerCase()})):Object.keys(i).map(t=>({label:t,value:i[t]}))}function ke(){return p`
|
|
243
|
+
<div class="vds-slider-track"></div>
|
|
244
|
+
<div class="vds-slider-track-fill vds-slider-track"></div>
|
|
245
|
+
<div class="vds-slider-thumb"></div>
|
|
246
|
+
`}function Se(){return p`
|
|
247
|
+
<media-slider-steps class="vds-slider-steps">
|
|
248
|
+
<template>
|
|
249
|
+
<div class="vds-slider-step"></div>
|
|
250
|
+
</template>
|
|
251
|
+
</media-slider-steps>
|
|
252
|
+
`}function xe({label:i=null,value:t=null,upIcon:e="",downIcon:s="",children:a,isMin:n,isMax:r}){const o=i||t,l=[s?it(s,"down"):null,a,e?it(e,"up"):null];return p`
|
|
253
|
+
<div
|
|
254
|
+
class=${`vds-menu-item vds-menu-slider-item${o?" group":""}`}
|
|
255
|
+
data-min=${m(()=>n()?"":null)}
|
|
256
|
+
data-max=${m(()=>r()?"":null)}
|
|
257
|
+
>
|
|
258
|
+
${o?p`
|
|
259
|
+
<div class="vds-menu-slider-title">
|
|
260
|
+
${[i?p`<div>${i}</div>`:null,t?p`<div>${t}</div>`:null]}
|
|
261
|
+
</div>
|
|
262
|
+
<div class="vds-menu-slider-body">${l}</div>
|
|
263
|
+
`:l}
|
|
264
|
+
</div>
|
|
265
|
+
`}const br={...nr,upIcon:"menu-opacity-up",downIcon:"menu-opacity-down"},hs={...rr,upIcon:"menu-opacity-up",downIcon:"menu-opacity-down"};function yr(){return m(()=>{const{hasCaptions:i}=R(),{translations:t}=x();return i()?p`
|
|
266
|
+
<media-menu class="vds-font-menu vds-menu">
|
|
267
|
+
${Pt({label:()=>et(t,"Caption Styles")})}
|
|
268
|
+
<media-menu-items class="vds-menu-items">
|
|
269
|
+
${[nt({label:E(t,"Font"),children:[vr(),$r()]}),nt({label:E(t,"Text"),children:[wr(),kr(),Tr()]}),nt({label:E(t,"Text Background"),children:[Sr(),xr()]}),nt({label:E(t,"Display Background"),children:[Pr(),Cr()]}),nt({children:[Er()]})]}
|
|
270
|
+
</media-menu-items>
|
|
271
|
+
</media-menu>
|
|
272
|
+
`:null})}function vr(){return yt({label:"Family",option:ar,type:"fontFamily"})}function $r(){return yt({label:"Size",option:br,type:"fontSize"})}function wr(){return yt({label:"Color",option:cs,type:"textColor"})}function Tr(){return yt({label:"Opacity",option:hs,type:"textOpacity"})}function kr(){return yt({label:"Shadow",option:or,type:"textShadow"})}function Sr(){return yt({label:"Color",option:cs,type:"textBg"})}function xr(){return yt({label:"Opacity",option:hs,type:"textBgOpacity"})}function Pr(){return yt({label:"Color",option:cs,type:"displayBg"})}function Cr(){return yt({label:"Opacity",option:hs,type:"displayBgOpacity"})}function Er(){const{translations:i}=x();return p`
|
|
273
|
+
<button class="vds-menu-item" role="menuitem" @click=${lr}>
|
|
274
|
+
<span class="vds-menu-item-label">${m(()=>et(i,"Reset"))}</span>
|
|
275
|
+
</button>
|
|
276
|
+
`}function yt({label:i,option:t,type:e}){const{player:s}=y(),{translations:a}=x(),n=qt[e],r=()=>et(a,i);function o(){ht(),s.dispatchEvent(new Event("vds-font-change"))}if(t.type==="color"){let h=function(u){n.set(u.target.value),o()};return ee({label:m(r),children:p`
|
|
277
|
+
<input
|
|
278
|
+
class="vds-color-picker"
|
|
279
|
+
type="color"
|
|
280
|
+
.value=${m(n)}
|
|
281
|
+
@input=${h}
|
|
282
|
+
/>
|
|
283
|
+
`})}if(t.type==="slider"){let h=function(C){n.set(C.detail+"%"),o()};const{min:u,max:g,step:$,upIcon:w,downIcon:P}=t;return xe({label:m(r),value:m(n),upIcon:w,downIcon:P,isMin:()=>n()===u+"%",isMax:()=>n()===g+"%",children:p`
|
|
284
|
+
<media-slider
|
|
285
|
+
class="vds-slider"
|
|
286
|
+
min=${u}
|
|
287
|
+
max=${g}
|
|
288
|
+
step=${$}
|
|
289
|
+
key-step=${$}
|
|
290
|
+
.value=${m(()=>parseInt(n()))}
|
|
291
|
+
aria-label=${m(r)}
|
|
292
|
+
@value-change=${h}
|
|
293
|
+
@drag-value-change=${h}
|
|
294
|
+
>
|
|
295
|
+
${ke()}${Se()}
|
|
296
|
+
</media-slider>
|
|
297
|
+
`})}const l=gr(t.values),c=()=>{const h=n(),u=l.find(g=>g.value===h)?.label||"";return et(a,M(u)?u:u())};return p`
|
|
298
|
+
<media-menu class=${`vds-${Nt(e)}-menu vds-menu`}>
|
|
299
|
+
${Pt({label:r,hint:c})}
|
|
300
|
+
<media-menu-items class="vds-menu-items">
|
|
301
|
+
${fr({value:n,options:l,onChange({detail:h}){n.set(h),o()}})}
|
|
302
|
+
</media-menu-items>
|
|
303
|
+
</media-menu>
|
|
304
|
+
`}function Pe({label:i,checked:t,defaultChecked:e=!1,storageKey:s,onChange:a}){const{translations:n}=x(),r=s?localStorage.getItem(s):null,o=b(!!(r??e)),l=b(!1),c=m(j(o)),h=E(n,i);s&&a(f(o)),t&&d(()=>void o.set(t()));function u(w){w?.button!==1&&(o.set(P=>!P),s&&localStorage.setItem(s,o()?"1":""),a(o(),w),l.set(!1))}function g(w){jt(w)&&u()}function $(w){w.button===0&&l.set(!0)}return p`
|
|
305
|
+
<div
|
|
306
|
+
class="vds-menu-checkbox"
|
|
307
|
+
role="menuitemcheckbox"
|
|
308
|
+
tabindex="0"
|
|
309
|
+
aria-label=${h}
|
|
310
|
+
aria-checked=${c}
|
|
311
|
+
data-active=${m(()=>l()?"":null)}
|
|
312
|
+
@pointerup=${u}
|
|
313
|
+
@pointerdown=${$}
|
|
314
|
+
@keydown=${g}
|
|
315
|
+
></div>
|
|
316
|
+
`}function Ar(){return m(()=>{const{translations:i}=x();return p`
|
|
317
|
+
<media-menu class="vds-accessibility-menu vds-menu">
|
|
318
|
+
${Pt({label:()=>et(i,"Accessibility"),icon:"menu-accessibility"})}
|
|
319
|
+
<media-menu-items class="vds-menu-items">
|
|
320
|
+
${[nt({children:[Mr(),Lr()]}),nt({children:[yr()]})]}
|
|
321
|
+
</media-menu-items>
|
|
322
|
+
</media-menu>
|
|
323
|
+
`})}function Mr(){const{userPrefersAnnouncements:i,translations:t}=x(),e="Announcements";return ee({label:E(t,e),children:Pe({label:e,storageKey:"vds-player::announcements",onChange(s){i.set(s)}})})}function Lr(){return m(()=>{const{translations:i,userPrefersKeyboardAnimations:t,noKeyboardAnimations:e}=x(),{viewType:s}=R();if(D(()=>s()!=="video"||e())())return null;const n="Keyboard Animations";return ee({label:E(i,n),children:Pe({label:n,defaultChecked:!0,storageKey:"vds-player::keyboard-animations",onChange(r){t.set(r)}})})})}function Dr(){return m(()=>{const{noAudioGain:i,translations:t}=x(),{audioTracks:e,canSetAudioGain:s}=R();return D(()=>!(s()&&!i())&&e().length<=1)()?null:p`
|
|
324
|
+
<media-menu class="vds-audio-menu vds-menu">
|
|
325
|
+
${Pt({label:()=>et(t,"Audio"),icon:"menu-audio"})}
|
|
326
|
+
<media-menu-items class="vds-menu-items">
|
|
327
|
+
${[Ir(),qr()]}
|
|
328
|
+
</media-menu-items>
|
|
329
|
+
</media-menu>
|
|
330
|
+
`})}function Ir(){return m(()=>{const{translations:i}=x(),{audioTracks:t}=R(),e=E(i,"Default");return D(()=>t().length<=1)()?null:nt({children:p`
|
|
331
|
+
<media-menu class="vds-audio-tracks-menu vds-menu">
|
|
332
|
+
${Pt({label:()=>et(i,"Track")})}
|
|
333
|
+
<media-menu-items class="vds-menu-items">
|
|
334
|
+
<media-audio-radio-group
|
|
335
|
+
class="vds-audio-track-radio-group vds-radio-group"
|
|
336
|
+
empty-label=${e}
|
|
337
|
+
>
|
|
338
|
+
<template>
|
|
339
|
+
<media-radio class="vds-audio-track-radio vds-radio">
|
|
340
|
+
<slot name="menu-radio-check-icon" data-class="vds-icon"></slot>
|
|
341
|
+
<span class="vds-radio-label" data-part="label"></span>
|
|
342
|
+
</media-radio>
|
|
343
|
+
</template>
|
|
344
|
+
</media-audio-radio-group>
|
|
345
|
+
</media-menu-items>
|
|
346
|
+
</media-menu>
|
|
347
|
+
`})})}function qr(){return m(()=>{const{noAudioGain:i,translations:t}=x(),{canSetAudioGain:e}=R();if(D(()=>!e()||i())())return null;const{audioGain:a}=R();return nt({label:E(t,"Boost"),value:m(()=>Math.round(((a()??1)-1)*100)+"%"),children:[xe({upIcon:"menu-audio-boost-up",downIcon:"menu-audio-boost-down",children:_r(),isMin:()=>((a()??1)-1)*100<=Di(),isMax:()=>((a()??1)-1)*100===Ii()})]})})}function _r(){const{translations:i}=x(),t=E(i,"Boost"),e=Di,s=Ii,a=Or;return p`
|
|
348
|
+
<media-audio-gain-slider
|
|
349
|
+
class="vds-audio-gain-slider vds-slider"
|
|
350
|
+
aria-label=${t}
|
|
351
|
+
min=${m(e)}
|
|
352
|
+
max=${m(s)}
|
|
353
|
+
step=${m(a)}
|
|
354
|
+
key-step=${m(a)}
|
|
355
|
+
>
|
|
356
|
+
${ke()}${Se()}
|
|
357
|
+
</media-audio-gain-slider>
|
|
358
|
+
`}function Di(){const{audioGains:i}=x(),t=i();return W(t)?t[0]??0:t.min}function Ii(){const{audioGains:i}=x(),t=i();return W(t)?t[t.length-1]??300:t.max}function Or(){const{audioGains:i}=x(),t=i();return W(t)?t[1]-t[0]||25:t.step}const ps={en:"gb",eng:"gb",english:"gb",id:"id",ind:"id",indonesian:"id",ja:"jp",jpn:"jp",japanese:"jp",ko:"kr",kor:"kr",korean:"kr",zh:"cn",zho:"cn",chi:"cn",chinese:"cn",es:"es",spa:"es",spanish:"es",fr:"fr",fra:"fr",french:"fr",de:"de",deu:"de",ger:"de",german:"de",pt:"br",por:"br",portuguese:"br",ru:"ru",rus:"ru",russian:"ru",ar:"sa",ara:"sa",arabic:"sa",hi:"in",hin:"in",hindi:"in",th:"th",tha:"th",thai:"th",vi:"vn",vie:"vn",vietnamese:"vn",it:"it",ita:"it",italian:"it",tr:"tr",tur:"tr",turkish:"tr",pl:"pl",pol:"pl",polish:"pl",nl:"nl",nld:"nl",dutch:"nl",ms:"my",msa:"my",malay:"my"};function Vr(i){const t=i.toLowerCase().replace(/\s\d+$/,"").trim();if(ps[t])return ps[t];for(const[e,s]of Object.entries(ps))if(t.startsWith(e)||t.includes(e))return s;return null}function Rr(){return m(()=>{const{translations:i}=x(),{hasCaptions:t,textTracks:e,textTrack:s}=R(),a=E(i,"Off"),n=y();if(!t())return null;const r=s(),o=e().filter(Y),l=new Map;for(const w of o){const P=w.label.replace(/\s\d+$/,"").trim();l.has(P)||l.set(P,[]),l.get(P).push(w)}const c=["indonesian","english","japanese","korean","chinese"],h=w=>{const P=w.toLowerCase(),C=c.findIndex(B=>P.includes(B));return C!==-1?C:999},u=Array.from(l.entries()).sort((w,P)=>{const C=h(w[0]),B=h(P[0]);return C!==B?C-B:w[0].localeCompare(P[0])}),g=o.every(w=>w.mode!=="showing"),$=w=>{const P=n.textTracks.selected;if(P){const C=n.textTracks.indexOf(P);n.remote.changeTextTrackMode(C,"disabled",w)}};return p`
|
|
359
|
+
<media-menu class="vds-captions-menu vds-menu">
|
|
360
|
+
${Pt({label:()=>et(i,"Captions"),icon:"menu-captions"})}
|
|
361
|
+
<media-menu-items class="vds-menu-items">
|
|
362
|
+
|
|
363
|
+
<media-radio-group value=${g?"off":"none"}>
|
|
364
|
+
<media-radio
|
|
365
|
+
class="vds-caption-radio vds-radio"
|
|
366
|
+
value="off"
|
|
367
|
+
@change=${$}
|
|
368
|
+
>
|
|
369
|
+
<slot name="menu-radio-check-icon" data-class="vds-icon"></slot>
|
|
370
|
+
<span class="vds-radio-label">${a}</span>
|
|
371
|
+
</media-radio>
|
|
372
|
+
</media-radio-group>
|
|
373
|
+
|
|
374
|
+
${u.map(([w,P])=>{const C=Vr(w),B=p`
|
|
375
|
+
<div style="display: flex; align-items: center; gap: 8px;">
|
|
376
|
+
${C?p`<span class="fi fi-${C}" style="font-size: 1.25em; border-radius: 2px; width: 1.33em; height: 1em; display: inline-block; background-image: url('https://cdnjs.cloudflare.com/ajax/libs/flag-icons/7.1.0/flags/4x3/${C}.svg'); background-size: cover; background-position: center;"></span>`:""}
|
|
377
|
+
<span>${w}</span>
|
|
378
|
+
</div>
|
|
379
|
+
`,ct=P.findIndex(Z=>Z===r);return p`
|
|
380
|
+
<media-menu class="vds-captions-group-menu vds-menu">
|
|
381
|
+
${Pt({label:()=>B})}
|
|
382
|
+
<media-menu-items class="vds-menu-items">
|
|
383
|
+
<media-radio-group value=${String(ct)}>
|
|
384
|
+
${P.map((Z,G)=>{const pt=P.length>1?`${w} ${G+1}`:w,mt=Qt=>{const $t=n.textTracks.indexOf(Z);n.remote.changeTextTrackMode($t,"showing",Qt)};return p`
|
|
385
|
+
<media-radio
|
|
386
|
+
class="vds-caption-radio vds-radio"
|
|
387
|
+
value=${String(G)}
|
|
388
|
+
@change=${mt}
|
|
389
|
+
>
|
|
390
|
+
<slot name="menu-radio-check-icon" data-class="vds-icon"></slot>
|
|
391
|
+
<span class="vds-radio-label">${pt}</span>
|
|
392
|
+
</media-radio>
|
|
393
|
+
`})}
|
|
394
|
+
</media-radio-group>
|
|
395
|
+
</media-menu-items>
|
|
396
|
+
</media-menu>
|
|
397
|
+
`})}
|
|
398
|
+
|
|
399
|
+
</media-menu-items>
|
|
400
|
+
</media-menu>
|
|
401
|
+
`})}function ms(i,t){return[...i].sort(t?Fr:Nr)}function Nr(i,t){return i.height===t.height?(i.bitrate??0)-(t.bitrate??0):i.height-t.height}function Fr(i,t){return t.height===i.height?(t.bitrate??0)-(i.bitrate??0):t.height-i.height}function Br(){return m(()=>{const{translations:i}=x();return p`
|
|
402
|
+
<media-menu class="vds-playback-menu vds-menu">
|
|
403
|
+
${Pt({label:()=>et(i,"Playback"),icon:"menu-playback"})}
|
|
404
|
+
<media-menu-items class="vds-menu-items">
|
|
405
|
+
${[nt({children:Gr()}),Hr(),Ur()]}
|
|
406
|
+
</media-menu-items>
|
|
407
|
+
</media-menu>
|
|
408
|
+
`})}function Gr(){const{remote:i}=y(),{translations:t}=x(),e="Loop";return ee({label:E(t,e),children:Pe({label:e,storageKey:"vds-player::user-loop",onChange(s,a){i.userPrefersLoopChange(s,a)}})})}function Hr(){return m(()=>{const{translations:i}=x(),{canSetPlaybackRate:t,playbackRate:e}=R();return t()?nt({label:E(i,"Speed"),value:m(()=>e()===1?et(i,"Normal"):e()+"x"),children:[xe({upIcon:"menu-speed-up",downIcon:"menu-speed-down",children:Wr(),isMin:()=>e()===qi(),isMax:()=>e()===_i()})]}):null})}function qi(){const{playbackRates:i}=x(),t=i();return W(t)?t[0]??0:t.min}function _i(){const{playbackRates:i}=x(),t=i();return W(t)?t[t.length-1]??2:t.max}function Kr(){const{playbackRates:i}=x(),t=i();return W(t)?t[1]-t[0]||.25:t.step}function Wr(){const{translations:i}=x(),t=E(i,"Speed"),e=qi,s=_i,a=Kr;return p`
|
|
409
|
+
<media-speed-slider
|
|
410
|
+
class="vds-speed-slider vds-slider"
|
|
411
|
+
aria-label=${t}
|
|
412
|
+
min=${m(e)}
|
|
413
|
+
max=${m(s)}
|
|
414
|
+
step=${m(a)}
|
|
415
|
+
key-step=${m(a)}
|
|
416
|
+
>
|
|
417
|
+
${ke()}${Se()}
|
|
418
|
+
</media-speed-slider>
|
|
419
|
+
`}function Qr(){const{remote:i,qualities:t}=y(),{autoQuality:e,canSetQuality:s,qualities:a}=R(),{translations:n}=x(),r="Auto";return D(()=>!s()||a().length<=1)()?null:ee({label:E(n,r),children:Pe({label:r,checked:e,onChange(l,c){l?i.requestAutoQuality(c):i.changeQuality(t.selectedIndex,c)}})})}function Ur(){return m(()=>{const{hideQualityBitrate:i,translations:t}=x(),{canSetQuality:e,qualities:s,quality:a}=R(),n=D(()=>!e()||s().length<=1),r=D(()=>ms(s()));return n()?null:nt({label:E(t,"Quality"),value:m(()=>{const o=a()?.height,l=a()?.label,c=i()?null:a()?.bitrate,h=c&&c>0?`${(c/1e6).toFixed(2)} Mbps`:null,u=et(t,"Auto"),g=l??(o?`${o}p`:"");return g?`${g}${h?` (${h})`:""}`:u}),children:[xe({upIcon:"menu-quality-up",downIcon:"menu-quality-down",children:jr(),isMin:()=>r()[0]===a(),isMax:()=>r().at(-1)===a()}),Qr()]})})}function jr(){const{translations:i}=x(),t=E(i,"Quality");return p`
|
|
420
|
+
<media-quality-slider class="vds-quality-slider vds-slider" aria-label=${t}>
|
|
421
|
+
${ke()}${Se()}
|
|
422
|
+
</media-quality-slider>
|
|
423
|
+
`}function Oi({placement:i,portal:t,tooltip:e}){return m(()=>{const{viewType:s}=R(),{translations:a,menuPortal:n,noModal:r,menuGroup:o,smallWhen:l}=x(),c=D(()=>r()?he(i):l()?null:he(i)),h=D(()=>!l()&&o()==="bottom"&&s()==="video"?26:0),u=b(!1);dr();function g(){u.set(!0)}function $(){u.set(!1)}const w=p`
|
|
424
|
+
<media-menu-items
|
|
425
|
+
class="vds-settings-menu-items vds-menu-items"
|
|
426
|
+
placement=${m(c)}
|
|
427
|
+
offset=${m(h)}
|
|
428
|
+
>
|
|
429
|
+
${m(()=>u()?[Br(),Ar(),Dr(),Rr()]:null)}
|
|
430
|
+
</media-menu-items>
|
|
431
|
+
`;return p`
|
|
432
|
+
<media-menu class="vds-settings-menu vds-menu" @open=${g} @close=${$}>
|
|
433
|
+
<media-tooltip class="vds-tooltip">
|
|
434
|
+
<media-tooltip-trigger>
|
|
435
|
+
<media-menu-button
|
|
436
|
+
class="vds-menu-button vds-button"
|
|
437
|
+
aria-label=${E(a,"Settings")}
|
|
438
|
+
>
|
|
439
|
+
${it("menu-settings","vds-rotate-icon")}
|
|
440
|
+
</media-menu-button>
|
|
441
|
+
</media-tooltip-trigger>
|
|
442
|
+
<media-tooltip-content
|
|
443
|
+
class="vds-tooltip-content"
|
|
444
|
+
placement=${oe(e)?m(e):e}
|
|
445
|
+
>
|
|
446
|
+
${E(a,"Settings")}
|
|
447
|
+
</media-tooltip-content>
|
|
448
|
+
</media-tooltip>
|
|
449
|
+
${Ei(n,w)}
|
|
450
|
+
</media-menu>
|
|
451
|
+
`})}function fs({orientation:i,tooltip:t}){return m(()=>{const{pointer:e,muted:s,canSetVolume:a}=R();if(e()==="coarse"&&!s())return null;if(!a())return Si({tooltip:t});const n=b(void 0),r=kn(n);return p`
|
|
452
|
+
<div class="vds-volume" ?data-active=${m(r)} ${ue(n.set)}>
|
|
453
|
+
${Si({tooltip:t})}
|
|
454
|
+
<div class="vds-volume-popup">${zr({orientation:i})}</div>
|
|
455
|
+
</div>
|
|
456
|
+
`})}function zr({orientation:i}={}){const{translations:t}=x(),e=E(t,"Volume");return p`
|
|
457
|
+
<media-volume-slider
|
|
458
|
+
class="vds-volume-slider vds-slider"
|
|
459
|
+
aria-label=${e}
|
|
460
|
+
orientation=${Fe(i)}
|
|
461
|
+
>
|
|
462
|
+
<div class="vds-slider-track"></div>
|
|
463
|
+
<div class="vds-slider-track-fill vds-slider-track"></div>
|
|
464
|
+
<media-slider-preview class="vds-slider-preview" no-clamp>
|
|
465
|
+
<media-slider-value class="vds-slider-value"></media-slider-value>
|
|
466
|
+
</media-slider-preview>
|
|
467
|
+
<div class="vds-slider-thumb"></div>
|
|
468
|
+
</media-volume-slider>
|
|
469
|
+
`}function gs(){const i=b(void 0),t=b(0),{thumbnails:e,translations:s,sliderChaptersMinWidth:a,disableTimeSlider:n,seekStep:r,noScrubGesture:o}=x(),l=E(s,"Seek"),c=m(n),h=m(()=>t()<a()),u=m(e);return ci(i,()=>{const g=i();g&&t.set(g.clientWidth)}),p`
|
|
470
|
+
<media-time-slider
|
|
471
|
+
class="vds-time-slider vds-slider"
|
|
472
|
+
aria-label=${l}
|
|
473
|
+
key-step=${m(r)}
|
|
474
|
+
?disabled=${c}
|
|
475
|
+
?no-swipe-gesture=${m(o)}
|
|
476
|
+
${ue(i.set)}
|
|
477
|
+
>
|
|
478
|
+
<media-slider-chapters class="vds-slider-chapters" ?disabled=${h}>
|
|
479
|
+
<template>
|
|
480
|
+
<div class="vds-slider-chapter">
|
|
481
|
+
<div class="vds-slider-track"></div>
|
|
482
|
+
<div class="vds-slider-track-fill vds-slider-track"></div>
|
|
483
|
+
<div class="vds-slider-progress vds-slider-track"></div>
|
|
484
|
+
</div>
|
|
485
|
+
</template>
|
|
486
|
+
</media-slider-chapters>
|
|
487
|
+
<div class="vds-slider-thumb"></div>
|
|
488
|
+
<media-slider-preview class="vds-slider-preview">
|
|
489
|
+
<media-slider-thumbnail
|
|
490
|
+
class="vds-slider-thumbnail vds-thumbnail"
|
|
491
|
+
.src=${u}
|
|
492
|
+
></media-slider-thumbnail>
|
|
493
|
+
<div class="vds-slider-chapter-title" data-part="chapter-title"></div>
|
|
494
|
+
<media-slider-value class="vds-slider-value"></media-slider-value>
|
|
495
|
+
</media-slider-preview>
|
|
496
|
+
</media-time-slider>
|
|
497
|
+
`}function Yr(){return p`
|
|
498
|
+
<div class="vds-time-group">
|
|
499
|
+
${m(()=>{const{duration:i}=R();return i()?[p`<media-time class="vds-time" type="current"></media-time>`,p`<div class="vds-time-divider">/</div>`,p`<media-time class="vds-time" type="duration"></media-time>`]:null})}
|
|
500
|
+
</div>
|
|
501
|
+
`}function Xr(){return m(()=>{const{live:i,duration:t}=R();return i()?Pi():t()?p`<media-time class="vds-time" type="current" toggle remainder></media-time>`:null})}function Vi(){return m(()=>{const{live:i}=R();return i()?Pi():Yr()})}function Jr(){return m(()=>{const{textTracks:i}=y(),{title:t,started:e}=R(),s=b(null);return Yt(i,"chapters",s.set),s()&&(e()||!t())?Ri():p`<media-title class="vds-chapter-title"></media-title>`})}function Ri(){return p`<media-chapter-title class="vds-chapter-title"></media-chapter-title>`}function Zr(){return[ns(),ls(),p`
|
|
502
|
+
<media-controls class="vds-controls">
|
|
503
|
+
<media-controls-group class="vds-controls-group">
|
|
504
|
+
${[Bt({backward:!0,tooltip:"top start"}),we({tooltip:"top"}),Bt({tooltip:"top"}),to(),gs(),Xr(),fs({orientation:"vertical",tooltip:"top"}),rs({tooltip:"top"}),os(),sr({tooltip:"top"}),eo()]}
|
|
505
|
+
</media-controls-group>
|
|
506
|
+
</media-controls>
|
|
507
|
+
`]}function to(){return m(()=>{let i=b(void 0),t=b(!1),e=y(),{title:s,started:a,currentTime:n,ended:r}=R(),{translations:o}=x(),l=Tn(i),c=()=>a()||n()>0;const h=()=>{const $=r()?"Replay":c()?"Continue":"Play";return`${et(o,$)}: ${s()}`};d(()=>{l()&&document.activeElement===document.body&&e.player.el?.focus({preventScroll:!0})});function u(){const $=i(),w=!!$&&!l()&&$.clientWidth<$.children[0].clientWidth;$&&Ve($,"vds-marquee",w),t.set(w)}function g(){return p`
|
|
508
|
+
<span class="vds-title-text">
|
|
509
|
+
${m(h)}${m(()=>c()?Ri():null)}
|
|
510
|
+
</span>
|
|
511
|
+
`}return ci(i,u),s()?p`
|
|
512
|
+
<span class="vds-title" title=${m(h)} ${ue(i.set)}>
|
|
513
|
+
${[g(),m(()=>t()&&!l()?g():null)]}
|
|
514
|
+
</span>
|
|
515
|
+
`:It()})}function eo(){const i="top end";return[Mi({tooltip:"top",placement:i,portal:!0}),Oi({tooltip:"top end",placement:i,portal:!0})]}function Ni({name:i,class:t,state:e,paths:s,viewBox:a="0 0 32 32"}){return p`<svg
|
|
516
|
+
class="${"vds-icon"+(t?` ${t}`:"")}"
|
|
517
|
+
viewBox="${a}"
|
|
518
|
+
fill="none"
|
|
519
|
+
aria-hidden="true"
|
|
520
|
+
focusable="false"
|
|
521
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
522
|
+
data-icon=${Fe(i??e)}
|
|
523
|
+
>
|
|
524
|
+
${M(s)?Aa(s):m(s)}
|
|
525
|
+
</svg>`}class so{#t={};#e=!1;slots;constructor(t){this.slots=new ki(t,this.#i.bind(this))}connect(){this.slots.connect()}load(){this.loadIcons().then(t=>{this.#t=t,this.#e=!0,this.#i()})}*#s(){for(const t of Object.keys(this.#t)){const e=`${t}-icon`;for(const s of this.slots.elements)s.name===e&&(yield{icon:this.#t[t],slot:s})}}#i(){if(this.#e)for(const{icon:t,slot:e}of this.#s())this.slots.assign(t,e)}}class Fi extends so{connect(){super.connect();const{player:t}=y();if(!t.el)return;let e,s=new IntersectionObserver(a=>{a[0]?.isIntersecting&&(e?.(),e=void 0,this.load())});s.observe(t.el),e=L(()=>s.disconnect())}}class Bi extends Fi{async loadIcons(){const t=(await import("./vidstack-BxJPOhv7.js")).icons,e={};for(const s of Object.keys(t))e[s]=Ni({name:s,paths:t[s]});return e}}class io extends k(ve,Zn){static tagName="media-audio-layout";static attrs={smallWhen:{converter(t){return t!=="never"&&!!t}}};#t;#e=b(!1);onSetup(){this.forwardKeepAlive=!1,this.#t=y(),this.classList.add("vds-audio-layout"),this.#a()}onConnect(){Ti("audio",()=>this.isMatch),this.#i()}render(){return m(this.#s.bind(this))}#s(){return this.isMatch?Zr():null}#i(){const{menuPortal:t}=x();d(()=>{if(!this.isMatch)return;const e=Ai(this,this.menuContainer,"vds-audio-layout",()=>this.isSmallLayout),s=e?[this,e]:[this];return(this.$props.customIcons()?new as(s):new Bi(s)).connect(),t.set(e),()=>{e.remove(),t.set(null)}})}#a(){const{pointer:t}=this.#t.$state;d(()=>{t()==="coarse"&&d(this.#n.bind(this))})}#n(){if(!this.#e()){K(this,"pointerdown",this.#r.bind(this),{capture:!0});return}K(this,"pointerdown",t=>t.stopPropagation()),K(window,"pointerdown",this.#o.bind(this))}#r(t){const{target:e}=t;xt(e)&&e.closest(".vds-time-slider")&&(t.stopImmediatePropagation(),this.setAttribute("data-scrubbing",""),this.#e.set(!0))}#o(){this.#e.set(!1),this.removeAttribute("data-scrubbing")}}class ao extends is{static props={...super.props,when:({viewType:t})=>t==="video",smallWhen:({width:t,height:e})=>t<576||e<380}}function Gi(){return m(()=>{const i=y(),{noKeyboardAnimations:t,userPrefersKeyboardAnimations:e}=x();if(D(()=>t()||!e())())return null;const a=b(!1),{lastKeyboardAction:n}=i.$state;d(()=>{a.set(!!n());const u=setTimeout(()=>a.set(!1),500);return()=>{a.set(!1),window.clearTimeout(u)}});const r=D(()=>{const u=n()?.action;return u&&a()?Nt(u):null}),o=D(()=>`vds-kb-action${a()?"":" hidden"}`),l=D(no),c=D(()=>{const u=ro();return u?wn(u):null});function h(){const u=c();return u?p`
|
|
526
|
+
<div class="vds-kb-bezel">
|
|
527
|
+
<div class="vds-kb-icon">${u}</div>
|
|
528
|
+
</div>
|
|
529
|
+
`:null}return p`
|
|
530
|
+
<div class=${m(o)} data-action=${m(r)}>
|
|
531
|
+
<div class="vds-kb-text-wrapper">
|
|
532
|
+
<div class="vds-kb-text">${m(l)}</div>
|
|
533
|
+
</div>
|
|
534
|
+
${m(()=>Ma(n(),h()))}
|
|
535
|
+
</div>
|
|
536
|
+
`})}function no(){const{$state:i}=y(),t=i.lastKeyboardAction()?.action,e=i.audioGain()??1;switch(t){case"toggleMuted":return i.muted()?"0%":Hi(i.volume(),e);case"volumeUp":case"volumeDown":return Hi(i.volume(),e);default:return""}}function Hi(i,t){return`${Math.round(i*t*100)}%`}function ro(){const{$state:i}=y();switch(i.lastKeyboardAction()?.action){case"togglePaused":return i.paused()?"kb-pause-icon":"kb-play-icon";case"toggleMuted":return i.muted()||i.volume()===0?"kb-mute-icon":i.volume()>=.5?"kb-volume-up-icon":"kb-volume-down-icon";case"toggleFullscreen":return`kb-fs-${i.fullscreen()?"enter":"exit"}-icon`;case"togglePictureInPicture":return`kb-pip-${i.pictureInPicture()?"enter":"exit"}-icon`;case"toggleCaptions":return i.hasCaptions()?`kb-cc-${i.textTrack()?"on":"off"}-icon`:null;case"volumeUp":return"kb-volume-up-icon";case"volumeDown":return"kb-volume-down-icon";case"seekForward":return"kb-seek-forward-icon";case"seekBackward":return"kb-seek-backward-icon";default:return null}}function oo(){const{episodes:i,smallWhen:t}=x(),{fullscreen:e}=R(),s=b(!1);d(()=>{e()||s.set(!1)});function a(){!e()&&!t()||!i()?.length||s.set(!s())}function n(){s.set(!1)}return[ns(),Wi(),Ce(),Gi(),ls(),p`<div class="vds-scrim"></div>`,p`
|
|
537
|
+
<media-controls class="vds-controls" @vds-episodes-open=${a}>
|
|
538
|
+
${[co(),It(),p`
|
|
539
|
+
<media-controls-group class="vds-controls-group">
|
|
540
|
+
${gs()}
|
|
541
|
+
</media-controls-group>
|
|
542
|
+
`,p`
|
|
543
|
+
<media-controls-group class="vds-controls-group vds-controls-group-bottom">
|
|
544
|
+
${[Bt({backward:!0,tooltip:"top"}),we({tooltip:"top start"}),Bt({backward:!1,tooltip:"top"}),fs({orientation:"horizontal",tooltip:"top"}),Vi(),Jr(),It(),m(()=>(e()||t())&&i()?.length?Ci({tooltip:"top"}):null),rs({tooltip:"top"}),lo(),os(),ir(),xi({tooltip:"top end"})]}
|
|
545
|
+
</media-controls-group>
|
|
546
|
+
`]}
|
|
547
|
+
</media-controls>
|
|
548
|
+
`,Ki(s,n)]}function lo(){return m(()=>{const{menuGroup:i}=x();return i()==="bottom"?bs():null})}function co(){return p`
|
|
549
|
+
<media-controls-group class="vds-controls-group">
|
|
550
|
+
${m(()=>{const{menuGroup:i}=x();return i()==="top"?[It(),bs()]:null})}
|
|
551
|
+
</media-controls-group>
|
|
552
|
+
`}function uo(){const{episodes:i,smallWhen:t}=x(),{fullscreen:e}=R(),s=b(!1);d(()=>{e()||s.set(!1)});function a(){!e()&&!t()||!i()?.length||s.set(!s())}function n(){s.set(!1)}return[ns(),Wi(),Ce(),ls(),Gi(),p`<div class="vds-scrim"></div>`,p`
|
|
553
|
+
<media-controls class="vds-controls" @vds-episodes-open=${a}>
|
|
554
|
+
<media-controls-group class="vds-controls-group">
|
|
555
|
+
${[It(),rs({tooltip:"bottom"}),os(),bs(),fs({orientation:"vertical",tooltip:"bottom end"})]}
|
|
556
|
+
</media-controls-group>
|
|
557
|
+
|
|
558
|
+
${It()}
|
|
559
|
+
|
|
560
|
+
<media-controls-group class="vds-controls-group">
|
|
561
|
+
${gs()}
|
|
562
|
+
</media-controls-group>
|
|
563
|
+
|
|
564
|
+
<media-controls-group class="vds-controls-group vds-controls-group-bottom">
|
|
565
|
+
${[Bt({backward:!0,tooltip:"top"}),we({tooltip:"top"}),Bt({backward:!1,tooltip:"top"}),Vi(),It(),m(()=>(e()||t())&&i()?.length?Ci({tooltip:"top"}):null),xi({tooltip:"top end"})]}
|
|
566
|
+
</media-controls-group>
|
|
567
|
+
</media-controls>
|
|
568
|
+
`,po(),Ki(s,n)]}function ho(){return p`
|
|
569
|
+
<div class="vds-load-container">
|
|
570
|
+
${[Ce(),we({tooltip:"top"})]}
|
|
571
|
+
</div>
|
|
572
|
+
`}function po(){return m(()=>{const{duration:i}=R();return i()===0?null:p`
|
|
573
|
+
<div class="vds-start-duration">
|
|
574
|
+
<media-time class="vds-time" type="duration"></media-time>
|
|
575
|
+
</div>
|
|
576
|
+
`})}function Ce(){return p`
|
|
577
|
+
<div class="vds-buffering-indicator">
|
|
578
|
+
<media-spinner class="vds-buffering-spinner"></media-spinner>
|
|
579
|
+
</div>
|
|
580
|
+
`}function mo(i){return i<=0?null:i<60?"<1m left":`${Math.floor(i/60)}m left`}function Ki(i,t){const{episodes:e,episodesTitle:s,smallWhen:a}=x(),{fullscreen:n,currentTime:r,duration:o}=R();return m(()=>{const l=e()??[];if(!n()&&!a()||!l.length)return null;const c=r(),h=o();return p`
|
|
581
|
+
<div
|
|
582
|
+
class="vds-episodes-backdrop"
|
|
583
|
+
data-open=${i()?"true":"false"}
|
|
584
|
+
@pointerup=${u=>{u.target===u.currentTarget&&t()}}
|
|
585
|
+
>
|
|
586
|
+
<aside
|
|
587
|
+
class="vds-episodes-panel"
|
|
588
|
+
data-open=${i()?"true":"false"}
|
|
589
|
+
@keydown=${u=>{u.key==="Escape"&&t()}}
|
|
590
|
+
>
|
|
591
|
+
<header class="vds-episodes-panel-header">
|
|
592
|
+
<h3 class="vds-episodes-panel-title">${s()}</h3>
|
|
593
|
+
<button
|
|
594
|
+
type="button"
|
|
595
|
+
class="vds-episodes-close-btn"
|
|
596
|
+
aria-label="Close episodes"
|
|
597
|
+
@pointerup=${u=>{u.stopPropagation(),t()}}
|
|
598
|
+
>
|
|
599
|
+
<span aria-hidden="true">✕</span>
|
|
600
|
+
</button>
|
|
601
|
+
</header>
|
|
602
|
+
<div class="vds-episodes-list" role="list">
|
|
603
|
+
${l.map((u,g)=>{const $=u.episodeTitle||`Episode ${u.episodeNumber??g+1}`,w=u.seasonNumber!=null&&u.episodeNumber!=null?`S${String(u.seasonNumber).padStart(2,"0")} \xB7 E${String(u.episodeNumber).padStart(2,"0")}`:$,P=u.isActive===!0;let C=null;if(P&&h>0){const G=Math.max(0,h-c);C=mo(G)}else u.timeLeft!=null&&u.timeLeft>0?C=`${u.timeLeft}m left`:Number.isFinite(u.runtime)&&(u.runtime??0)>0&&(C=`${u.runtime}m`);let B=0;P&&h>0?B=Math.min(100,c/h*100):u.progressPercent!=null&&u.progressPercent>0&&(B=Math.min(100,u.progressPercent));const ct=!!u.episodeTitle&&u.episodeTitle.trim()!==""&&u.episodeTitle!==u.title,Z=G=>{G.stopPropagation(),!P&&(G.currentTarget?.dispatchEvent(new CustomEvent("vds-episode-select",{bubbles:!0,composed:!0,detail:{episode:u,index:g}})),t())};return p`
|
|
604
|
+
<article
|
|
605
|
+
class="vds-episode-item"
|
|
606
|
+
data-active=${P?"true":"false"}
|
|
607
|
+
aria-current=${P?"true":void 0}
|
|
608
|
+
role="button"
|
|
609
|
+
tabindex="0"
|
|
610
|
+
aria-label=${u.title||$}
|
|
611
|
+
@pointerup=${Z}
|
|
612
|
+
@keydown=${G=>{(G.key==="Enter"||G.key===" ")&&Z(G)}}
|
|
613
|
+
>
|
|
614
|
+
<div class="vds-episode-thumb-wrap">
|
|
615
|
+
${u.thumbnail?p`
|
|
616
|
+
<img
|
|
617
|
+
class="vds-episode-thumb"
|
|
618
|
+
src=${u.thumbnail}
|
|
619
|
+
alt=${u.title||$}
|
|
620
|
+
loading="lazy"
|
|
621
|
+
decoding="async"
|
|
622
|
+
/>
|
|
623
|
+
`:p`<div class="vds-episode-thumb vds-episode-thumb-placeholder"></div>`}
|
|
624
|
+
${B>0?p`
|
|
625
|
+
<div class="vds-episode-progress-track" aria-hidden="true">
|
|
626
|
+
<div
|
|
627
|
+
class="vds-episode-progress-fill"
|
|
628
|
+
style=${`width: ${B}%;`}
|
|
629
|
+
></div>
|
|
630
|
+
</div>
|
|
631
|
+
`:null}
|
|
632
|
+
</div>
|
|
633
|
+
<div class="vds-episode-body">
|
|
634
|
+
<div class="vds-episode-meta-row">
|
|
635
|
+
<div class="vds-episode-meta-primary">
|
|
636
|
+
${P?p`<span class="vds-episode-now-chip">Playing</span>`:null}
|
|
637
|
+
<span class="vds-episode-label">${w}</span>
|
|
638
|
+
</div>
|
|
639
|
+
${C?p`<span class="vds-episode-runtime">${C}</span>`:null}
|
|
640
|
+
</div>
|
|
641
|
+
<h4 class="vds-episode-title" title=${u.title||""}>
|
|
642
|
+
${u.title||"-"}
|
|
643
|
+
</h4>
|
|
644
|
+
${ct?p`<p class="vds-episode-subtitle" title=${u.episodeTitle}>
|
|
645
|
+
${u.episodeTitle}
|
|
646
|
+
</p>`:null}
|
|
647
|
+
${u.overview?p`<p class="vds-episode-desc" title=${u.overview}>
|
|
648
|
+
${u.overview}
|
|
649
|
+
</p>`:p`<p class="vds-episode-desc" style="font-style: italic; opacity: 0.7;">
|
|
650
|
+
Deskripsi tidak tersedia.
|
|
651
|
+
</p>`}
|
|
652
|
+
</div>
|
|
653
|
+
</article>
|
|
654
|
+
`})}
|
|
655
|
+
</div>
|
|
656
|
+
</aside>
|
|
657
|
+
</div>
|
|
658
|
+
`})}function bs(){const{menuGroup:i,smallWhen:t}=x(),e=()=>i()==="top"||t()?"bottom":"top",s=D(()=>`${e()} ${i()==="top"?"end":"center"}`),a=D(()=>`${e()} end`);return[Mi({tooltip:s,placement:a,portal:!0}),Oi({tooltip:s,placement:a,portal:!0})]}function Wi(){return m(()=>{const{noGestures:i}=x();return i()?null:p`
|
|
659
|
+
<div class="vds-gestures">
|
|
660
|
+
<media-gesture class="vds-gesture" event="pointerup" action="toggle:paused"></media-gesture>
|
|
661
|
+
<media-gesture
|
|
662
|
+
class="vds-gesture"
|
|
663
|
+
event="pointerup"
|
|
664
|
+
action="toggle:controls"
|
|
665
|
+
></media-gesture>
|
|
666
|
+
<media-gesture
|
|
667
|
+
class="vds-gesture"
|
|
668
|
+
event="dblpointerup"
|
|
669
|
+
action="toggle:fullscreen"
|
|
670
|
+
></media-gesture>
|
|
671
|
+
<media-gesture class="vds-gesture" event="dblpointerup" action="seek:-10"></media-gesture>
|
|
672
|
+
<media-gesture class="vds-gesture" event="dblpointerup" action="seek:10"></media-gesture>
|
|
673
|
+
</div>
|
|
674
|
+
`})}class fo extends k(ve,ao){static tagName="media-video-layout";static attrs={smallWhen:{converter(t){return t!=="never"&&!!t}},episodes:{converter(t){if(!t)return null;try{const e=JSON.parse(t);return Array.isArray(e)?e:null}catch{return null}}}};#t;onSetup(){this.forwardKeepAlive=!1,this.#t=y(),this.classList.add("vds-video-layout")}onConnect(){Ti("video",()=>this.isMatch),this.#e()}render(){return m(this.#s.bind(this))}#e(){const{menuPortal:t}=x();d(()=>{if(!this.isMatch)return;const e=Ai(this,this.menuContainer,"vds-video-layout",()=>this.isSmallLayout),s=e?[this,e]:[this];return(this.$props.customIcons()?new as(s):new Bi(s)).connect(),t.set(e),()=>{e.remove(),t.set(null)}})}#s(){const{load:t}=this.#t.$props,{canLoad:e,streamType:s,nativeControls:a}=this.#t.$state;return!a()&&this.isMatch?t()==="play"&&!e()?ho():s()==="unknown"?Ce():this.isSmallLayout?uo():oo():null}}const Qi=ut();function N(){return V(Qi)}const go={clickToPlay:!0,clickToFullscreen:!0,controls:["play-large","play","progress","current-time","mute+volume","captions","settings","pip","airplay","fullscreen"],customIcons:!1,displayDuration:!1,download:null,markers:null,invertTime:!0,thumbnails:null,toggleTime:!0,translations:null,seekTime:10,speed:[.5,.75,1,1.25,1.5,1.75,2,4]};class bo extends S{static props=go;#t;onSetup(){this.#t=y(),tt(Qi,{...this.$props,previewTime:b(0)})}}function yo(i,t){const{canAirPlay:e,canFullscreen:s,canPictureInPicture:a,controlsHidden:n,currentTime:r,fullscreen:o,hasCaptions:l,isAirPlayConnected:c,paused:h,pictureInPicture:u,playing:g,pointer:$,poster:w,textTrack:P,viewType:C,waiting:B}=t.$state;i.classList.add("plyr"),i.classList.add("plyr--full-ui");const ct={"plyr--airplay-active":c,"plyr--airplay-supported":e,"plyr--fullscreen-active":o,"plyr--fullscreen-enabled":s,"plyr--hide-controls":n,"plyr--is-touch":()=>$()==="coarse","plyr--loading":B,"plyr--paused":h,"plyr--pip-active":u,"plyr--pip-enabled":a,"plyr--playing":g,"plyr__poster-enabled":w,"plyr--stopped":()=>h()&&r()===0,"plyr--captions-active":P,"plyr--captions-enabled":l},Z=La();for(const G of Object.keys(ct))Z.add(d(()=>void i.classList.toggle(G,!!ct[G]())));return Z.add(d(()=>{const G=`plyr--${C()}`;return i.classList.add(G),()=>i.classList.remove(G)}),d(()=>{const{$provider:G}=t,pt=G()?.type,mt=`plyr--${vo(pt)?"html5":pt}`;return i.classList.toggle(mt,!!pt),()=>i.classList.remove(mt)})),()=>Z.empty()}function vo(i){return i==="audio"||i==="video"}class $o extends Fi{async loadIcons(){const t=(await import("./vidstack-Dge3KT8k.js")).icons,e={};for(const s of Object.keys(t))e[s]=Ni({name:s,paths:t[s],viewBox:"0 0 18 18"});return e}}function Ee(i,t){return i()?.[t]??t}function wo(){return xo()}function To(){const i=y(),{load:t}=i.$props,{canLoad:e}=i.$state;return D(()=>t()==="play"&&!e())()?[Ui(),ji()]:[ko(),So(),ji(),Po(),Bo(),Go()]}function Ui(){const i=y(),{translations:t}=N(),{title:e}=i.$state,s=m(()=>`${Ee(t,"Play")}, ${e()}`);return p`
|
|
675
|
+
<media-play-button
|
|
676
|
+
class="plyr__control plyr__control--overlaid"
|
|
677
|
+
aria-label=${s}
|
|
678
|
+
data-plyr="play"
|
|
679
|
+
>
|
|
680
|
+
<slot name="play-icon"></slot>
|
|
681
|
+
</button>
|
|
682
|
+
`}function ko(){const{controls:i}=N();return m(()=>i().includes("play-large")?Ui():null)}function So(){const{thumbnails:i,previewTime:t}=N();return p`
|
|
683
|
+
<media-thumbnail
|
|
684
|
+
.src=${m(i)}
|
|
685
|
+
class="plyr__preview-scrubbing"
|
|
686
|
+
time=${m(()=>t())}
|
|
687
|
+
></media-thumbnail>
|
|
688
|
+
`}function ji(){const i=y(),{poster:t}=i.$state,e=m(()=>`background-image: url("${t()}");`);return p`<div class="plyr__poster" style=${e}></div>`}function xo(){const i=new Set(["captions","pip","airplay","fullscreen"]),{controls:t}=N(),e=m(()=>t().filter(s=>!i.has(s)).map(zi));return p`<div class="plyr__controls">${e}</div>`}function Po(){const{controls:i}=N(),t=m(()=>i().map(zi));return p`<div class="plyr__controls">${t}</div>`}function zi(i){switch(i){case"airplay":return Co();case"captions":return Eo();case"current-time":return No();case"download":return Fo();case"duration":return Yi();case"fast-forward":return _o();case"fullscreen":return Ao();case"mute":case"volume":case"mute+volume":return Vo(i);case"pip":return Lo();case"play":return Do();case"progress":return Oo();case"restart":return Io();case"rewind":return qo();case"settings":return Ho();default:return null}}function Co(){const{translations:i}=N();return p`
|
|
689
|
+
<media-airplay-button class="plyr__controls__item plyr__control" data-plyr="airplay">
|
|
690
|
+
<slot name="airplay-icon"></slot>
|
|
691
|
+
<span class="plyr__tooltip">${F(i,"AirPlay")}</span>
|
|
692
|
+
</media-airplay-button>
|
|
693
|
+
`}function Eo(){const{translations:i}=N(),t=F(i,"Disable captions"),e=F(i,"Enable captions");return p`
|
|
694
|
+
<media-caption-button
|
|
695
|
+
class="plyr__controls__item plyr__control"
|
|
696
|
+
data-no-label
|
|
697
|
+
data-plyr="captions"
|
|
698
|
+
>
|
|
699
|
+
<slot name="captions-on-icon" data-class="icon--pressed"></slot>
|
|
700
|
+
<slot name="captions-off-icon" data-class="icon--not-pressed"></slot>
|
|
701
|
+
<span class="label--pressed plyr__tooltip">${t}</span>
|
|
702
|
+
<span class="label--not-pressed plyr__tooltip">${e}</span>
|
|
703
|
+
</media-caption-button>
|
|
704
|
+
`}function Ao(){const{translations:i}=N(),t=F(i,"Enter Fullscreen"),e=F(i,"Exit Fullscreen");return p`
|
|
705
|
+
<media-fullscreen-button
|
|
706
|
+
class="plyr__controls__item plyr__control"
|
|
707
|
+
data-no-label
|
|
708
|
+
data-plyr="fullscreen"
|
|
709
|
+
>
|
|
710
|
+
<slot name="enter-fullscreen-icon" data-class="icon--pressed"></slot>
|
|
711
|
+
<slot name="exit-fullscreen-icon" data-class="icon--not-pressed"></slot>
|
|
712
|
+
<span class="label--pressed plyr__tooltip">${e}</span>
|
|
713
|
+
<span class="label--not-pressed plyr__tooltip">${t}</span>
|
|
714
|
+
</media-fullscreen-button>
|
|
715
|
+
`}function Mo(){const{translations:i}=N(),t=F(i,"Mute"),e=F(i,"Unmute");return p`
|
|
716
|
+
<media-mute-button class="plyr__control" data-no-label data-plyr="mute">
|
|
717
|
+
<slot name="muted-icon" data-class="icon--pressed"></slot>
|
|
718
|
+
<slot name="volume-icon" data-class="icon--not-pressed"></slot>
|
|
719
|
+
<span class="label--pressed plyr__tooltip">${e}</span>
|
|
720
|
+
<span class="label--not-pressed plyr__tooltip">${t}</span>
|
|
721
|
+
</media-mute-button>
|
|
722
|
+
`}function Lo(){const{translations:i}=N(),t=F(i,"Enter PiP"),e=F(i,"Exit PiP");return p`
|
|
723
|
+
<media-pip-button class="plyr__controls__item plyr__control" data-no-label data-plyr="pip">
|
|
724
|
+
<slot name="pip-icon"></slot>
|
|
725
|
+
<slot name="enter-pip-icon" data-class="icon--pressed"></slot>
|
|
726
|
+
<slot name="exit-pip-icon" data-class="icon--not-pressed"></slot>
|
|
727
|
+
<span class="label--pressed plyr__tooltip">${e}</span>
|
|
728
|
+
<span class="label--not-pressed plyr__tooltip">${t}</span>
|
|
729
|
+
</media-pip-button>
|
|
730
|
+
`}function Do(){const{translations:i}=N(),t=F(i,"Play"),e=F(i,"Pause");return p`
|
|
731
|
+
<media-play-button class="plyr__controls__item plyr__control" data-no-label data-plyr="play">
|
|
732
|
+
<slot name="pause-icon" data-class="icon--pressed"></slot>
|
|
733
|
+
<slot name="play-icon" data-class="icon--not-pressed"></slot>
|
|
734
|
+
<span class="label--pressed plyr__tooltip">${e}</span>
|
|
735
|
+
<span class="label--not-pressed plyr__tooltip">${t}</span>
|
|
736
|
+
</media-play-button>
|
|
737
|
+
`}function Io(){const{translations:i}=N(),{remote:t}=y(),e=F(i,"Restart");function s(a){de(a)&&!jt(a)||t.seek(0,a)}return p`
|
|
738
|
+
<button
|
|
739
|
+
type="button"
|
|
740
|
+
class="plyr__control"
|
|
741
|
+
data-plyr="restart"
|
|
742
|
+
@pointerup=${s}
|
|
743
|
+
@keydown=${s}
|
|
744
|
+
>
|
|
745
|
+
<slot name="restart-icon"></slot>
|
|
746
|
+
<span class="plyr__tooltip">${e}</span>
|
|
747
|
+
</button>
|
|
748
|
+
`}function qo(){const{translations:i,seekTime:t}=N(),e=m(()=>`${Ee(i,"Rewind")} ${t()}s`),s=m(()=>-1*t());return p`
|
|
749
|
+
<media-seek-button
|
|
750
|
+
class="plyr__controls__item plyr__control"
|
|
751
|
+
seconds=${s}
|
|
752
|
+
data-no-label
|
|
753
|
+
data-plyr="rewind"
|
|
754
|
+
>
|
|
755
|
+
<slot name="rewind-icon"></slot>
|
|
756
|
+
<span class="plyr__tooltip">${e}</span>
|
|
757
|
+
</media-seek-button>
|
|
758
|
+
`}function _o(){const{translations:i,seekTime:t}=N(),e=m(()=>`${Ee(i,"Forward")} ${t()}s`),s=m(t);return p`
|
|
759
|
+
<media-seek-button
|
|
760
|
+
class="plyr__controls__item plyr__control"
|
|
761
|
+
seconds=${s}
|
|
762
|
+
data-no-label
|
|
763
|
+
data-plyr="fast-forward"
|
|
764
|
+
>
|
|
765
|
+
<slot name="fast-forward-icon"></slot>
|
|
766
|
+
<span class="plyr__tooltip">${e}</span>
|
|
767
|
+
</media-seek-button>
|
|
768
|
+
`}function Oo(){let i=y(),{duration:t,viewType:e}=i.$state,{translations:s,markers:a,thumbnails:n,seekTime:r,previewTime:o}=N(),l=F(s,"Seek"),c=b(null),h=m(()=>{const C=c();return C?p`<span class="plyr__progress__marker-label">${Fs(C.label)}<br /></span>`:null});function u(C){o.set(C.detail)}function g(){c.set(this)}function $(){c.set(null)}function w(){const C=n(),B=m(()=>e()==="audio");return C?p`
|
|
769
|
+
<media-slider-preview class="plyr__slider__preview" ?no-clamp=${B}>
|
|
770
|
+
<media-slider-thumbnail .src=${C} class="plyr__slider__preview__thumbnail">
|
|
771
|
+
<span class="plyr__slider__preview__time-container">
|
|
772
|
+
${h}
|
|
773
|
+
<media-slider-value class="plyr__slider__preview__time"></media-slider-value>
|
|
774
|
+
</span>
|
|
775
|
+
</media-slider-thumbnail>
|
|
776
|
+
</media-slider-preview>
|
|
777
|
+
`:p`
|
|
778
|
+
<span class="plyr__tooltip">
|
|
779
|
+
${h}
|
|
780
|
+
<media-slider-value></media-slider-value>
|
|
781
|
+
</span>
|
|
782
|
+
`}function P(){const C=t();return Number.isFinite(C)?a()?.map(B=>p`
|
|
783
|
+
<span
|
|
784
|
+
class="plyr__progress__marker"
|
|
785
|
+
@mouseenter=${g.bind(B)}
|
|
786
|
+
@mouseleave=${$}
|
|
787
|
+
style=${`left: ${B.time/C*100}%;`}
|
|
788
|
+
></span>
|
|
789
|
+
`):null}return p`
|
|
790
|
+
<div class="plyr__controls__item plyr__progress__container">
|
|
791
|
+
<div class="plyr__progress">
|
|
792
|
+
<media-time-slider
|
|
793
|
+
class="plyr__slider"
|
|
794
|
+
data-plyr="seek"
|
|
795
|
+
pause-while-dragging
|
|
796
|
+
key-step=${m(r)}
|
|
797
|
+
aria-label=${l}
|
|
798
|
+
@media-seeking-request=${u}
|
|
799
|
+
>
|
|
800
|
+
<div class="plyr__slider__track"></div>
|
|
801
|
+
<div class="plyr__slider__thumb"></div>
|
|
802
|
+
<div class="plyr__slider__buffer"></div>
|
|
803
|
+
${m(w)}${m(P)}
|
|
804
|
+
</media-time-slider>
|
|
805
|
+
</div>
|
|
806
|
+
</div>
|
|
807
|
+
`}function Vo(i){return m(()=>{const t=i==="mute"||i==="mute+volume",e=i==="volume"||i==="mute+volume";return p`
|
|
808
|
+
<div class="plyr__controls__item plyr__volume">
|
|
809
|
+
${[t?Mo():null,e?Ro():null]}
|
|
810
|
+
</div>
|
|
811
|
+
`})}function Ro(){const{translations:i}=N(),t=F(i,"Volume");return p`
|
|
812
|
+
<media-volume-slider class="plyr__slider" data-plyr="volume" aria-label=${t}>
|
|
813
|
+
<div class="plyr__slider__track"></div>
|
|
814
|
+
<div class="plyr__slider__thumb"></div>
|
|
815
|
+
</media-volume-slider>
|
|
816
|
+
`}function No(){const i=y(),{translations:t,invertTime:e,toggleTime:s,displayDuration:a}=N(),n=b(f(e));function r(l){!s()||a()||de(l)&&!jt(l)||n.set(c=>!c)}function o(){return m(()=>a()?Yi():null)}return m(()=>{const{streamType:l}=i.$state,c=F(t,"LIVE"),h=F(t,"Current time"),u=m(()=>!a()&&n());return l()==="live"||l()==="ll-live"?p`
|
|
817
|
+
<media-live-button
|
|
818
|
+
class="plyr__controls__item plyr__control plyr__live-button"
|
|
819
|
+
data-plyr="live"
|
|
820
|
+
>
|
|
821
|
+
<span class="plyr__live-button__text">${c}</span>
|
|
822
|
+
</media-live-button>
|
|
823
|
+
`:p`
|
|
824
|
+
<media-time
|
|
825
|
+
type="current"
|
|
826
|
+
class="plyr__controls__item plyr__time plyr__time--current"
|
|
827
|
+
tabindex="0"
|
|
828
|
+
role="timer"
|
|
829
|
+
aria-label=${h}
|
|
830
|
+
?remainder=${u}
|
|
831
|
+
@pointerup=${r}
|
|
832
|
+
@keydown=${r}
|
|
833
|
+
></media-time>
|
|
834
|
+
${o()}
|
|
835
|
+
`})}function Yi(){const{translations:i}=N(),t=F(i,"Duration");return p`
|
|
836
|
+
<media-time
|
|
837
|
+
type="duration"
|
|
838
|
+
class="plyr__controls__item plyr__time plyr__time--duration"
|
|
839
|
+
role="timer"
|
|
840
|
+
tabindex="0"
|
|
841
|
+
aria-label=${t}
|
|
842
|
+
></media-time>
|
|
843
|
+
`}function Fo(){return m(()=>{const i=y(),{translations:t,download:e}=N(),{title:s,source:a}=i.$state,n=a(),r=e(),o=Qs({title:s(),src:n,download:r}),l=F(t,"Download");return M(o?.url)?p`
|
|
844
|
+
<a
|
|
845
|
+
class="plyr__controls__item plyr__control"
|
|
846
|
+
href=${Us(o.url,{download:o.name})}
|
|
847
|
+
download=${o.name}
|
|
848
|
+
target="_blank"
|
|
849
|
+
>
|
|
850
|
+
<slot name="download-icon" />
|
|
851
|
+
<span class="plyr__tooltip">${l}</span>
|
|
852
|
+
</a>
|
|
853
|
+
`:null})}function Bo(){return m(()=>{const{clickToPlay:i,clickToFullscreen:t}=N();return[i()?p`
|
|
854
|
+
<media-gesture
|
|
855
|
+
class="plyr__gesture"
|
|
856
|
+
event="pointerup"
|
|
857
|
+
action="toggle:paused"
|
|
858
|
+
></media-gesture>
|
|
859
|
+
`:null,t()?p`
|
|
860
|
+
<media-gesture
|
|
861
|
+
class="plyr__gesture"
|
|
862
|
+
event="dblpointerup"
|
|
863
|
+
action="toggle:fullscreen"
|
|
864
|
+
></media-gesture>
|
|
865
|
+
`:null]})}function Go(){const i=y(),t=b(void 0),e=m(()=>Fs(t()?.text));return d(()=>{const s=i.$state.textTrack();if(!s)return;function a(){t.set(s?.activeCues[0])}return a(),K(s,"cue-change",a)}),p`
|
|
866
|
+
<div class="plyr__captions" dir="auto">
|
|
867
|
+
<span class="plyr__caption">${e}</span>
|
|
868
|
+
</div>
|
|
869
|
+
`}function Ho(){const{translations:i}=N(),t=F(i,"Settings");return p`
|
|
870
|
+
<div class="plyr__controls__item plyr__menu">
|
|
871
|
+
<media-menu>
|
|
872
|
+
<media-menu-button class="plyr__control" data-plyr="settings">
|
|
873
|
+
<slot name="settings-icon" />
|
|
874
|
+
<span class="plyr__tooltip">${t}</span>
|
|
875
|
+
</media-menu-button>
|
|
876
|
+
<media-menu-items class="plyr__menu__container" placement="top end">
|
|
877
|
+
<div><div>${[Wo(),zo(),Xo(),Uo()]}</div></div>
|
|
878
|
+
</media-menu-items>
|
|
879
|
+
</media-menu>
|
|
880
|
+
</div>
|
|
881
|
+
`}function Ae({label:i,children:t}){const e=b(!1);return p`
|
|
882
|
+
<media-menu @open=${()=>e.set(!0)} @close=${()=>e.set(!1)}>
|
|
883
|
+
${Ko({label:i,open:e})}
|
|
884
|
+
<media-menu-items>${t}</media-menu-items>
|
|
885
|
+
</media-menu>
|
|
886
|
+
`}function Ko({open:i,label:t}){const{translations:e}=N(),s=m(()=>`plyr__control plyr__control--${i()?"back":"forward"}`);function a(){const n=F(e,"Go back to previous menu");return m(()=>i()?p`<span class="plyr__sr-only">${n}</span>`:null)}return p`
|
|
887
|
+
<media-menu-button class=${s} data-plyr="settings">
|
|
888
|
+
<span class="plyr__menu__label" aria-hidden=${Zo(i)}>
|
|
889
|
+
${F(e,t)}
|
|
890
|
+
</span>
|
|
891
|
+
<span class="plyr__menu__value" data-part="hint"></span>
|
|
892
|
+
${a()}
|
|
893
|
+
</media-menu-button>
|
|
894
|
+
`}function Wo(){return Ae({label:"Audio",children:Qo()})}function Qo(){const{translations:i}=N();return p`
|
|
895
|
+
<media-audio-radio-group empty-label=${F(i,"Default")}>
|
|
896
|
+
<template>
|
|
897
|
+
<media-radio class="plyr__control" data-plyr="audio">
|
|
898
|
+
<span data-part="label"></span>
|
|
899
|
+
</media-radio>
|
|
900
|
+
</template>
|
|
901
|
+
</media-audio-radio-group>
|
|
902
|
+
`}function Uo(){return Ae({label:"Speed",children:jo()})}function jo(){const{translations:i,speed:t}=N();return p`
|
|
903
|
+
<media-speed-radio-group .rates=${t} normal-label=${F(i,"Normal")}>
|
|
904
|
+
<template>
|
|
905
|
+
<media-radio class="plyr__control" data-plyr="speed">
|
|
906
|
+
<span data-part="label"></span>
|
|
907
|
+
</media-radio>
|
|
908
|
+
</template>
|
|
909
|
+
</media-speed-radio-group>
|
|
910
|
+
`}function zo(){return Ae({label:"Captions",children:Yo()})}function Yo(){const{translations:i}=N();return p`
|
|
911
|
+
<media-captions-radio-group off-label=${F(i,"Disabled")}>
|
|
912
|
+
<template>
|
|
913
|
+
<media-radio class="plyr__control" data-plyr="captions">
|
|
914
|
+
<span data-part="label"></span>
|
|
915
|
+
</media-radio>
|
|
916
|
+
</template>
|
|
917
|
+
</media-captions-radio-group>
|
|
918
|
+
`}function Xo(){return Ae({label:"Quality",children:Jo()})}function Jo(){const{translations:i}=N();return p`
|
|
919
|
+
<media-quality-radio-group auto-label=${F(i,"Auto")}>
|
|
920
|
+
<template>
|
|
921
|
+
<media-radio class="plyr__control" data-plyr="quality">
|
|
922
|
+
<span data-part="label"></span>
|
|
923
|
+
</media-radio>
|
|
924
|
+
</template>
|
|
925
|
+
</media-quality-radio-group>
|
|
926
|
+
`}function Zo(i){return m(()=>i()?"true":"false")}function F(i,t){return m(()=>Ee(i,t))}class tl extends k(ve,bo){static tagName="media-plyr-layout";#t;onSetup(){this.forwardKeepAlive=!1,this.#t=y()}onConnect(){this.#t.player.el?.setAttribute("data-layout","plyr"),L(()=>this.#t.player.el?.removeAttribute("data-layout")),yo(this,this.#t),d(()=>{this.$props.customIcons()?new as([this]).connect():new $o([this]).connect()})}render(){return m(this.#e.bind(this))}#e(){const{viewType:t}=this.#t.$state;return t()==="audio"?wo():t()==="video"?To():null}}T(io),T(fo),T(tl);function ys(i,t){const e=String(i),s=e.length;if(s<t){const n=t-s;return`${"0".repeat(n)}${i}`}return e}function Xi(i){const t=Math.trunc(i/3600),e=Math.trunc(i%3600/60),s=Math.trunc(i%60),a=Number((i-Math.trunc(i)).toPrecision(3));return{hours:t,minutes:e,seconds:s,fraction:a}}function Me(i,{padHrs:t=null,padMins:e=null,showHrs:s=!1,showMs:a=!1}={}){const{hours:n,minutes:r,seconds:o,fraction:l}=Xi(i),c=t?ys(n,2):n,h=e||Mt(e)&&i>=3600?ys(r,2):r,u=ys(o,2),g=a&&l>0?`.${String(l).replace(/^0?\./,"")}`:"",$=`${h}:${u}${g}`;return n>0||s?`${c}:${$}`:$}function Le(i){const t=[],{hours:e,minutes:s,seconds:a}=Xi(i);return e>0&&t.push(`${e} hour`),s>0&&t.push(`${s} min`),(a>0||t.length===0)&&t.push(`${a} sec`),t.join(" ")}class el extends S{static props={translations:null};static state=new wt({label:null,busy:!1});#t;#e=!1;onSetup(){this.#t=y()}onAttach(t){t.style.display="contents"}onConnect(t){t.setAttribute("data-media-announcer",""),q(t,"role","status"),q(t,"aria-live","polite");const{busy:e}=this.$state;this.setAttributes({"aria-busy":()=>e()?"true":null}),this.#e=!0,d(this.#s.bind(this)),d(this.#r.bind(this)),d(this.#n.bind(this)),d(this.#i.bind(this)),d(this.#a.bind(this)),d(this.#c.bind(this)),d(this.#h.bind(this)),ht(),this.#e=!1}#s(){const{paused:t}=this.#t.$state;this.#d(t()?"Pause":"Play")}#i(){const{fullscreen:t}=this.#t.$state;this.#d(t()?"Enter Fullscreen":"Exit Fullscreen")}#a(){const{pictureInPicture:t}=this.#t.$state;this.#d(t()?"Enter PiP":"Exit PiP")}#n(){const{textTrack:t}=this.#t.$state;this.#d(t()?"Closed-Captions On":"Closed-Captions Off")}#r(){const{muted:t,volume:e,audioGain:s}=this.#t.$state;this.#d(t()||e()===0?"Mute":`${Math.round(e()*(s()??1)*100)}% ${this.#u("Volume")}`)}#o=-1;#l=-1;#c(){const{seeking:t,currentTime:e}=this.#t.$state,s=t();this.#o>0?(window.clearTimeout(this.#l),this.#l=window.setTimeout(()=>{if(!this.scope)return;const a=f(e),n=Math.abs(a-this.#o);if(n>=1){const r=a>=this.#o,o=Le(n);this.#d(`${this.#u(r?"Seek Forward":"Seek Backward")} ${o}`)}this.#o=-1,this.#l=-1},300)):s&&(this.#o=f(e))}#u(t){const{translations:e}=this.$props;return e?.()?.[t||""]??t}#h(){const{label:t,busy:e}=this.$state,s=this.#u(t());if(this.#e)return;e.set(!0);const a=window.setTimeout(()=>void e.set(!1),150);return this.el&&v(this.el,"aria-label",s),M(s)&&this.dispatch("change",{detail:s}),()=>window.clearTimeout(a)}#d(t){const{label:e}=this.$state;e.set(t)}}class sl extends k(HTMLElement,el){static tagName="media-announcer"}class il extends ot{#t;constructor(t){super(),this.#t=t}onAttach(t){const{$props:e,ariaKeys:s}=y(),a=t.getAttribute("aria-keyshortcuts");if(a){s[this.#t]=a,L(()=>{delete s[this.#t]});return}const n=e.keyShortcuts()[this.#t];if(n){const r=W(n)?n.join(" "):M(n)?n:n?.keys;t.setAttribute("aria-keyshortcuts",W(r)?r.join(" "):r)}}}class J extends ot{static props={disabled:!1};#t;constructor(t){super(),this.#t=t,new dt,t.keyShortcut&&new il(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){q(t,"tabindex","0"),q(t,"role","button"),q(t,"type","button")}onConnect(t){const e=St(t,this.#i.bind(this));for(const s of["click","touchstart"])e.add(s,this.#a.bind(this),{passive:!0})}#e(){return pe(this.#t.isPresssed())}#s(t){Da(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 al extends S{static props=J.props;#t;constructor(){super(),new J({isPresssed:this.#s.bind(this),onPress:this.#e.bind(this)})}onSetup(){this.#t=y();const{canAirPlay:t,isAirPlayConnected:e}=this.#t.$state;this.setAttributes({"data-active":e,"data-supported":t,"data-state":this.#i.bind(this),"aria-hidden":j(()=>!t())})}onAttach(t){t.setAttribute("data-media-tooltip","airplay"),kt(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 nl extends k(HTMLElement,al){static tagName="media-airplay-button"}class rl extends S{static props=J.props;#t;constructor(){super(),new J({isPresssed:this.#s.bind(this),keyShortcut:"toggleCaptions",onPress:this.#e.bind(this)})}onSetup(){this.#t=y(),this.setAttributes({"data-active":this.#s.bind(this),"data-supported":()=>!this.#i(),"aria-hidden":j(this.#i.bind(this))})}onAttach(t){t.setAttribute("data-media-tooltip","caption"),kt(t,"Captions")}#e(t){this.#t.remote.toggleCaptions(t)}#s(){const{textTrack:t}=this.#t.$state,e=t();return!!e&&Y(e)}#i(){const{hasCaptions:t}=this.#t.$state;return!t()}}class ol extends k(HTMLElement,rl){static tagName="media-caption-button"}class ll extends S{static props={...J.props,target:"prefer-media"};#t;constructor(){super(),new J({isPresssed:this.#s.bind(this),keyShortcut:"toggleFullscreen",onPress:this.#e.bind(this)})}onSetup(){this.#t=y();const{fullscreen:t}=this.#t.$state,e=this.#i.bind(this);this.setAttributes({"data-active":t,"data-supported":e,"aria-hidden":j(()=>!e())})}onAttach(t){t.setAttribute("data-media-tooltip","fullscreen"),kt(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 dl extends k(HTMLElement,ll){static tagName="media-fullscreen-button"}class cl extends S{static props=J.props;#t;constructor(){super(),new J({isPresssed:this.#s.bind(this),onPress:this.#e.bind(this)})}onSetup(){this.#t=y();const{canGoogleCast:t,isGoogleCastConnected:e}=this.#t.$state;this.setAttributes({"data-active":e,"data-supported":t,"data-state":this.#i.bind(this),"aria-hidden":j(()=>!t())})}onAttach(t){t.setAttribute("data-media-tooltip","google-cast"),kt(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 ul extends k(HTMLElement,cl){static tagName="media-google-cast-button"}class hl extends S{static props={disabled:!1};#t;constructor(){super(),new dt}onSetup(){this.#t=y();const{disabled:t}=this.$props,{live:e,liveEdge:s}=this.#t.$state,a=()=>!e();this.setAttributes({"data-edge":s,"data-hidden":a,"aria-disabled":j(()=>t()||s()),"aria-hidden":j(a)})}onAttach(t){q(t,"tabindex","0"),q(t,"role","button"),q(t,"type","button"),t.setAttribute("data-media-tooltip","live")}onConnect(t){St(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 pl extends k(HTMLElement,hl){static tagName="media-live-button"}class ml extends S{static props=J.props;#t;constructor(){super(),new J({isPresssed:this.#s.bind(this),keyShortcut:"toggleMuted",onPress:this.#e.bind(this)})}onSetup(){this.#t=y(),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"),kt(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 fl extends k(HTMLElement,ml){static tagName="media-mute-button"}class gl extends S{static props=J.props;#t;constructor(){super(),new J({isPresssed:this.#s.bind(this),keyShortcut:"togglePictureInPicture",onPress:this.#e.bind(this)})}onSetup(){this.#t=y();const{pictureInPicture:t}=this.#t.$state,e=this.#i.bind(this);this.setAttributes({"data-active":t,"data-supported":e,"aria-hidden":j(()=>!e())})}onAttach(t){t.setAttribute("data-media-tooltip","pip"),kt(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 bl extends k(HTMLElement,gl){static tagName="media-pip-button"}class yl extends S{static props=J.props;#t;constructor(){super(),new J({isPresssed:this.#s.bind(this),keyShortcut:"togglePaused",onPress:this.#e.bind(this)})}onSetup(){this.#t=y();const{paused:t,ended:e}=this.#t.$state;this.setAttributes({"data-paused":t,"data-ended":e})}onAttach(t){t.setAttribute("data-media-tooltip","play"),kt(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 vl extends k(HTMLElement,yl){static tagName="media-play-button"}class $l extends S{static props={disabled:!1,seconds:30};#t;constructor(){super(),new dt}onSetup(){this.#t=y();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":j(()=>!s())})}onAttach(t){q(t,"tabindex","0"),q(t,"role","button"),q(t,"type","button"),t.setAttribute("data-media-tooltip","seek"),kt(t,this.#s.bind(this))}onConnect(t){St(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:a}=this.#t.$state,n=a()+e();this.#t.remote.seek(n,t)}}class wl extends k(HTMLElement,$l){static tagName="media-seek-button"}class Ji extends S{static props={disabled:!1,defaultPressed:!1};#t=b(!1);get pressed(){return this.#t()}constructor(){super(),new J({isPresssed:this.#t})}}const Tl=Ji.prototype;A(Tl,"pressed");class kl extends k(HTMLElement,Ji){static tagName="media-toggle-button"}class Sl{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 _(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 Ct extends S{static props={textDir:"ltr",exampleText:"Captions look like this."};#t;static lib=b(null);onSetup(){this.#t=y(),this.setAttributes({"aria-hidden":j(this.#e.bind(this))})}onAttach(t){t.style.setProperty("pointer-events","none")}onConnect(t){Ct.lib()||import("https://cdn.jsdelivr.net/npm/media-captions@next/dist/prod.js").then(e=>Ct.lib.set(e)),d(this.#s.bind(this))}#e(){const{textTrack:t,remotePlaybackState:e,iOSControls:s}=this.#t.$state,a=t();return s()||e()==="connected"||!a||!Y(a)}#s(){if(!Ct.lib())return;const{viewType:t}=this.#t.$state;return t()==="audio"?this.#i():this.#o()}#i(){return d(this.#a.bind(this)),this.#u(null),()=>{this.el.textContent=""}}#a(){if(this.#e())return;this.#n();const{textTrack:t}=this.#t.$state;K(t(),"cue-change",this.#n.bind(this)),d(this.#r.bind(this))}#n(){this.el.textContent="",this.#p>=0&&this.#b();const{realCurrentTime:t,textTrack:e}=this.#t.$state,{renderVTTCueString:s}=Ct.lib(),a=f(t),n=f(e).activeCues;for(const r of n){const o=this.#g(),l=this.#y();l.innerHTML=s(r,a),o.append(l),this.el.append(l)}}#r(){const{realCurrentTime:t}=this.#t.$state,{updateTimedVTTCueNodes:e}=Ct.lib();e(this.el,t())}#o(){const{CaptionsRenderer:t}=Ct.lib(),e=new t(this.el),s=new Sl(e);return this.#t.textRenderers.add(s),d(this.#l.bind(this,e)),d(this.#c.bind(this,e)),this.#u(e),()=>{this.el.textContent="",this.#t.textRenderers.remove(s),e.destroy()}}#l(t){t.dir=this.$props.textDir()}#c(t){if(this.#e())return;const{realCurrentTime:e,textTrack:s}=this.#t.$state;t.currentTime=e(),this.#p>=0&&s()?.activeCues[0]&&this.#b()}#u(t){const e=this.#t.player;if(!e)return;const s=this.#h.bind(this,t);K(e,"vds-font-change",s)}#h(t){if(this.#p>=0){this.#m();return}const{textTrack:e}=this.#t.$state;e()?.activeCues[0]?t?.update(!0):this.#d()}#d(){const t=this.#g();v(t,"data-example","");const e=this.#y();v(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 v(t,"data-part","cue-display"),t}#y(){const t=document.createElement("div");return v(t,"data-part","cue"),t}}class xl extends k(HTMLElement,Ct){static tagName="media-captions"}class Pl extends S{static props={defaultText:""}}class Cl extends k(HTMLElement,Pl){static tagName="media-chapter-title";#t;#e;onSetup(){this.#t=y(),this.#e=b("")}onConnect(){const t=this.#t.textTracks;Ya(t,"chapters",this.#e.set),d(this.#s.bind(this))}#s(){const{defaultText:t}=this.$props;this.textContent=this.#e()||t()}}class El extends S{static props={hideDelay:2e3,hideOnMouseLeave:!1};#t;onSetup(){this.#t=y(),d(this.#s.bind(this))}onAttach(t){const{pictureInPicture:e,fullscreen:s}=this.#t.$state;at(t,"pointer-events","none"),q(t,"role","group"),this.setAttributes({"data-visible":this.#i.bind(this),"data-fullscreen":s,"data-pip":e}),d(()=>{this.dispatch("change",{detail:this.#i()})}),d(this.#e.bind(this)),d(()=>{const a=s();for(const n of["top","right","bottom","left"])at(t,`padding-${n}`,a&&`env(safe-area-inset-${n})`)})}#e(){if(!this.el)return;const{nativeControls:t}=this.#t.$state,e=t();v(this.el,"aria-hidden",e?"true":null),at(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 Al extends k(HTMLElement,El){static tagName="media-controls"}class Ml extends S{onAttach(t){t.style.pointerEvents||at(t,"pointer-events","auto")}}class Ll extends k(HTMLElement,Ml){static tagName="media-controls-group"}class Dl extends S{static props={disabled:!1,event:void 0,action:void 0};#t;#e=null;onSetup(){this.#t=y();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]"),d(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"),K(this.#e,t,this.#n.bind(this),{passive:!1}))}#i=0;#a=-1;#n(t){if(this.$props.disabled()||Bs(t)&&(t.button!==0||this.#t.activeMenu)||le(t)&&this.#t.activeMenu||ze(t)||!this.#o(t))return;if(t.MEDIA_GESTURE=!0,t.preventDefault(),!f(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.#l()&&this.#c(f(this.$props.action),t),requestAnimationFrame(()=>{this.el.removeAttribute("data-triggered")})})}#o(t){if(!this.el)return!1;if(Bs(t)||Ia(t)||le(t)){const e=le(t)?t.changedTouches[0]??t.touches[0]:void 0,s=e?.clientX??t.clientX,a=e?.clientY??t.clientY,n=this.el.getBoundingClientRect(),r=a>=n.top&&a<=n.bottom&&s>=n.left&&s<=n.right;return t.type.includes("leave")?!r:r}return!0}#l(){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}#c(t,e){if(!t)return;const s=new z("will-trigger",{detail:t,cancelable:!0,trigger:e});if(this.dispatchEvent(s),s.defaultPrevented)return;const[a,n]=t.replace(/:([a-z])/,"-$1").split(":");t.includes(":fullscreen")?this.#t.remote.toggleFullscreen("prefer-media",e):t.includes("seek:")?this.#t.remote.seek(f(this.#t.$state.currentTime)+(+n||0),e):this.#t.remote[qa(a)](e),this.dispatch("trigger",{detail:t,trigger:e})}}class Il extends k(HTMLElement,Dl){static tagName="media-gesture"}class ql extends S{static props={when:!1}}class _l extends k(HTMLElement,ql){static tagName="media-layout";#t;onSetup(){this.#t=y()}onConnect(){d(this.#e.bind(this))}#e(){const t=this.firstElementChild,e=t?.localName==="template",s=this.$props.when();if(!(Rs(s)?s:D(()=>s(this.#t.player.state))())){e?(this.textContent="",this.appendChild(t)):xt(t)&&(t.style.display="none");return}e?this.append(t.content.cloneNode(!0)):xt(t)&&(t.style.display="")}}const U=ut(),vs=ut();class _t extends ot{#t=new Set;#e=b("");#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(){tt(vs,{add:this.#i.bind(this),remove:this.#a.bind(this)})}onAttach(t){st(U)||q(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=f(this.#e);if(!t||t===s)return;const a=this.#o(s),n=this.#o(t);a?.check(!1,e),n?.check(!0,e),this.#e.set(t),this.onValueChange?.(t,e)}#o(t){for(const e of this.#t)if(t===f(e.value))return e;return null}}const Ol=[1,1.25,1.5,1.75,2,2.5,3,4];class Zi extends S{static props={normalLabel:"Disabled",gains:Ol};#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 _t,this.#s.onValueChange=this.#o.bind(this)}onSetup(){this.#t=y(),st(U)&&(this.#e=V(U))}onConnect(t){d(this.#i.bind(this)),d(this.#a.bind(this)),d(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 $s=Zi.prototype;A($s,"value"),A($s,"disabled"),H($s,"getOptions");function Gt(i,t){bt(()=>{if(!i.connectScope)return;const e=i.querySelector("template");e&&d(()=>{const s=i.getOptions();Ye(e,s.length,(a,n)=>{const{label:r,value:o}=s[n],l=a.querySelector('[data-part="label"]');a.setAttribute("value",o),l&&(M(r)?l.textContent=r:d(()=>{l.textContent=r()})),t?.(a,s[n],n)})})})}class Vl extends k(HTMLElement,Zi){static tagName="media-audio-gain-radio-group";onConnect(){Gt(this)}}class ta extends S{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 _t,this.#s.onValueChange=this.#o.bind(this)}onSetup(){this.#e=y(),st(U)&&(this.#t=V(U))}onConnect(t){d(this.#i.bind(this)),d(this.#n.bind(this)),d(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(a=>a.label.toLowerCase()===t);if(s>=0){const a=this.#e.audioTracks[s];this.#e.remote.changeAudioTrack(s,e),this.dispatch("change",{detail:a,trigger:e})}}}const ws=ta.prototype;A(ws,"value"),A(ws,"disabled"),H(ws,"getOptions");class Rl extends k(HTMLElement,ta){static tagName="media-audio-radio-group";onConnect(){Gt(this)}}class ea extends S{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 _t,this.#s.onValueChange=this.#o.bind(this)}onSetup(){this.#t=y(),st(U)&&(this.#e=V(U))}onConnect(t){super.onConnect?.(t),d(this.#i.bind(this)),d(this.#n.bind(this)),d(this.#a.bind(this))}getOptions(){const{offLabel:t}=this.$props,{textTracks:e}=this.#t.$state,s=e().filter(Y),a=["indonesian","english","japanese","korean","chinese"],n=c=>{const h=c.toLowerCase(),u=a.findIndex(g=>h.includes(g));return u!==-1?u:999},r=[...s].sort((c,h)=>{const u=n(c.label),g=n(h.label);return u!==g?u-g:c.label.localeCompare(h.label)}),o=new Map,l=r.map(c=>{const h=(o.get(c.label)||0)+1;o.set(c.label,h);const u=r.filter($=>$.label===c.label).length;let g=c.label;return u>1&&(g=`${c.label} ${h}`),{track:c,label:g,value:this.#l(c)}});return[{value:"off",label:t},...l]}#i(){this.#s.value=this.#r()}#a(){const{offLabel:t}=this.$props,{textTrack:e}=this.#t.$state,s=e();this.#e?.hint.set(s&&Y(s)&&s.mode==="showing"?s.label:t())}#n(){this.#e?.disable(this.disabled)}#r(){const{textTrack:t}=this.#t.$state,e=t();return e&&Y(e)&&e.mode==="showing"?this.#l(e):"off"}#o(t,e){if(this.disabled)return;if(t==="off"){const a=this.#t.textTracks.selected;if(a){const n=this.#t.textTracks.indexOf(a);this.#t.remote.changeTextTrackMode(n,"disabled",e),this.dispatch("change",{detail:null,trigger:e})}return}const s=this.#t.textTracks.toArray().findIndex(a=>this.#l(a)===t);if(s>=0){const a=this.#t.textTracks[s];this.#t.remote.changeTextTrackMode(s,"showing",e),this.dispatch("change",{detail:a,trigger:e})}}#l(t){return t.id+":"+t.kind+"-"+t.label.toLowerCase()}}const Ts=ea.prototype;A(Ts,"value"),A(Ts,"disabled"),H(Ts,"getOptions");class Nl extends k(HTMLElement,ea){static tagName="media-captions-radio-group";onConnect(){Gt(this)}}var Fl=Object.defineProperty,Bl=Object.getOwnPropertyDescriptor,ks=(i,t,e,s)=>{for(var a=Bl(t,e),n=i.length-1,r;n>=0;n--)(r=i[n])&&(a=r(t,e,a)||a);return a&&Fl(t,e,a),a};class De extends S{static props={thumbnails:null};#t;#e;#s;#i=b(null);#a=b([]);get value(){return this.#s.value}get disabled(){return!this.#a()?.length}constructor(){super(),this.#s=new _t,this.#s.onValueChange=this.#u.bind(this)}onSetup(){this.#t=y(),st(U)&&(this.#e=V(U));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(),a=e();return this.#a().map((n,r)=>({cue:n,value:r.toString(),label:n.text,startTime:Me(Math.max(0,n.startTime-s)),duration:Le(Math.min(a,n.endTime)-Math.max(s,n.startTime))}))}#n(){f(()=>this.#l())}onConnect(t){d(this.#l.bind(this)),d(this.#c.bind(this)),d(this.#r.bind(this)),Yt(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 _(t).add("add-cue",e).add("remove-cue",e),()=>{this.#a.set([])}}#o(t){const{seekableStart:e,seekableEnd:s}=this.#t.$state,a=e(),n=s();this.#a.set([...t.cues].filter(r=>r.startTime<=n&&r.endTime>=a))}#l(){if(!this.#e?.expanded())return;if(!this.#i()){this.#s.value="-1";return}const{realCurrentTime:e,seekableStart:s,seekableEnd:a}=this.#t.$state,n=s(),r=a(),o=e(),l=this.#a().findIndex(c=>Xa(c,o));this.#s.value=l.toString(),l>=0&&bt(()=>{if(!this.connectScope)return;const c=this.#a()[l],h=this.el.querySelector("[aria-checked='true']"),u=Math.max(n,c.startTime),g=Math.min(r,c.endTime)-u,$=Math.max(0,o-u)/g*100;h&&at(h,"--progress",Q($,3)+"%")})}#c(){this.#e?.disable(this.disabled)}#u(t,e){if(this.disabled||!e)return;const s=+t,a=this.#a(),{clipStartTime:n}=this.#t.$state;Tt(s)&&a?.[s]&&(this.#s.value=s.toString(),this.#t.remote.seek(a[s].startTime-n(),e),this.dispatch("change",{detail:a[s],trigger:e}))}}ks([A],De.prototype,"value"),ks([A],De.prototype,"disabled"),ks([H],De.prototype,"getOptions");class Gl extends k(HTMLElement,De){static tagName="media-chapters-radio-group";onConnect(){Gt(this,(t,e)=>{const{cue:s,startTime:a,duration:n}=e,r=t.querySelector(".vds-thumbnail,media-thumbnail"),o=t.querySelector('[data-part="start-time"]'),l=t.querySelector('[data-part="duration"]');o&&(o.textContent=a),l&&(l.textContent=n),r&&(r.setAttribute("time",s.startTime+""),d(()=>{const c=this.$props.thumbnails();"src"in r?r.src=c:M(c)&&r.setAttribute("src",c)}))})}}class Ss extends S{static props={disabled:!1};#t;#e=b(null);get expanded(){return this.#t?.expanded()??!1}constructor(){super(),new dt}onSetup(){this.#t=V(U)}onAttach(t){this.#t.attachMenuButton(this),d(this.#s.bind(this)),q(t,"type","button")}onConnect(t){d(this.#i.bind(this)),this.#a();const e=new MutationObserver(this.#a.bind(this));e.observe(t,{attributeFilter:["data-part"],childList:!0,subtree:!0}),L(()=>e.disconnect()),St(t,s=>{this.dispatch("select",{trigger:s})})}#s(){this.#t.disableMenuButton(this.$props.disabled())}#i(){const t=this.#e();t&&d(()=>{const e=this.#t.hint();e&&(t.textContent=e)})}#a(){const t=this.el?.querySelector('[data-part="hint"]');this.#e.set(t??null)}}const Hl=Ss.prototype;A(Hl,"expanded");class Kl extends k(HTMLElement,Ss){static tagName="media-menu-button"}class sa extends ot{#t;constructor(t){super(),this.#t=t,d(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"),f(()=>this.#t.onChange(!0,t))},this.#t.showDelay?.()??0)}hide(t){this.#n(),f(()=>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($n(e)){this.#a?.();const n=K(e,"animationend",s,{once:!0});this.#a=n}else s()}})}#n(){window.clearTimeout(this.#s),this.#s=-1}}const xs=ut(),se=ut();function Wl(i,t){const e=_a(i,t);for(const{el:s,top:a,left:n}of e)s.scroll({top:a,left:n,behavior:t.behavior})}function Ql(i,t={}){Wl(i,{scrollMode:"if-needed",block:"center",inline:"center",...t})}const Ul=["a[href]","[tabindex]","input","select","button"].map(i=>`${i}:not([aria-hidden='true'])`).join(","),jl=new Set(["Escape","Tab","ArrowUp","ArrowDown","Home","PageUp","End","PageDown","Enter"," "]);class zl{#t=-1;#e=null;#s=[];#i;get items(){return this.#s}constructor(t){this.#i=t}attachMenu(t){K(t,"focus",this.#r.bind(this)),this.#e=t,L(()=>{this.#e=null})}listen(){this.#e&&(this.update(),new _(this.#e).add("keyup",this.#l.bind(this)).add("keydown",this.#c.bind(this)),L(()=>{this.#t=-1,this.#s=[]}))}update(){this.#t=0,this.#s=this.#h()}scroll(t=this.#n()){const e=this.#s[t];e&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{Ql(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(Oa(t)&&e instanceof Element){const s=e.getAttribute("role");return!/a|input|select|button/.test(e.localName)&&!s}return jl.has(t.key)}#l(t){this.#o(t)&&(t.stopPropagation(),t.preventDefault())}#c(t){if(this.#o(t))switch(t.stopPropagation(),t.preventDefault(),t.key){case"Escape":this.#i.closeMenu(t);break;case"Tab":this.#a(this.#u(t.shiftKey?-1:1));break;case"ArrowUp":this.#a(this.#u(-1));break;case"ArrowDown":this.#a(this.#u(1));break;case"Home":case"PageUp":this.#a(0);break;case"End":case"PageDown":this.#a(this.#s.length-1);break}}#u(t){let e=this.#t;do e=(e+t+this.#s.length)%this.#s.length;while(this.#s[e]?.offsetParent===null);return e}#h(){if(!this.#e)return[];const t=this.#e.querySelectorAll(Ul),e=[],s=a=>a.getAttribute("role")==="menu";for(const a of t)xt(a)&&a.offsetParent!==null&&li(this.#e,a,s)&&e.push(a);return e}}var Yl=Object.defineProperty,Xl=Object.getOwnPropertyDescriptor,ie=(i,t,e,s)=>{for(var a=Xl(t,e),n=i.length-1,r;n>=0;n--)(r=i[n])&&(a=r(t,e,a)||a);return a&&Yl(t,e,a),a};let Jl=0;class Ht extends S{static props={showDelay:0};#t;#e;#s;#i=b(!1);#a=b(!1);#n=b(null);#r=b(null);#o;#l=new Set;#c=null;#u;#h;#d=!1;#p=b(!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.#u=new sa({trigger:this.#n,content:this.#r,showDelay:t,listen:(e,s,a)=>{St(e,r=>{this.#i()?a(r):s(r)});const n=this.#M();n&&St(n,r=>{r.stopPropagation(),a(r)})},onChange:this.#T.bind(this)})}onSetup(){this.#t=y();const t=++Jl;this.#e=`media-menu-${t}`,this.#s=`media-menu-button-${t}`,this.#h=new zl({closeMenu:this.close.bind(this)}),st(U)&&(this.#o=V(U)),this.#b(),this.setAttributes({"data-open":this.#i,"data-root":!this.isSubmenu,"data-submenu":this.isSubmenu,"data-disabled":this.#P.bind(this)}),tt(U,{button:this.#n,content:this.#r,expanded:this.#i,hint:b(""),submenu:!!this.#o,disable:this.#E.bind(this),attachMenuButton:this.#y.bind(this),attachMenuItems:this.#$.bind(this),attachObserver:this.#w.bind(this),disableMenuButton:this.#x.bind(this),addSubmenu:this.#q.bind(this),onTransitionEvent:e=>{this.#m.add(e),L(()=>{this.#m.delete(e)})}})}onAttach(t){t.style.setProperty("display","contents")}onConnect(t){d(this.#g.bind(this)),this.isSubmenu&&this.#o?.addSubmenu(this)}onDestroy(){this.#n.set(null),this.#r.set(null),this.#c=null,this.#m.clear()}#b(){let t=-1,e=st(se)?V(se):null;tt(se,{onDragStart:()=>{e?.onDragStart?.(),window.clearTimeout(t),t=-1,this.#d=!0},onDragEnd:()=>{e?.onDragEnd?.(),t=window.setTimeout(()=>{this.#d=!1,t=-1},300)}})}#g(){const t=this.#S();this.isSubmenu||this.#R(),this.#v(t),t&&(d(()=>{const{height:e}=this.#t.$state,s=this.#r();s&&at(s,"--player-height",e()+"px")}),this.#h.listen(),this.listen("pointerup",this.#A.bind(this)),K(window,"pointerup",this.#C.bind(this)))}#y(t){const e=t.el,s=this.isSubmenu,a=j(this.#P.bind(this));q(e,"tabindex",s?"-1":"0"),q(e,"role",s?"menuitem":"button"),v(e,"id",this.#s),v(e,"aria-haspopup","menu"),v(e,"aria-expanded","false"),v(e,"data-root",!this.isSubmenu),v(e,"data-submenu",this.isSubmenu),d(()=>{v(e,"data-open",this.#i()),v(e,"aria-disabled",a())}),this.#n.set(e),L(()=>{this.#n.set(null)})}#$(t){const e=t.el;e.style.setProperty("display","none"),v(e,"id",this.#e),q(e,"role","menu"),q(e,"tabindex","-1"),v(e,"data-root",!this.isSubmenu),v(e,"data-submenu",this.isSubmenu),this.#r.set(e),L(()=>this.#r.set(null)),d(()=>v(e,"data-open",this.#i())),this.#h.attachMenu(e),this.#v(!1);const a=this.#G.bind(this);this.isSubmenu?this.#o?.onTransitionEvent(a):(t.listen("transitionstart",a),t.listen("transitionend",a),t.listen("animationend",this.#R),t.listen("vds-menu-resize",this.#R))}#w(t){this.#c=t}#v(t){const e=f(this.#r);e&&v(e,"aria-hidden",pe(!t))}#x(t){this.#p.set(t)}#f=!1;#T(t,e){if(this.#f=de(e),e?.stopPropagation(),this.#i()===t)return;if(this.#P()){t&&this.#u.hide(e);return}this.el?.dispatchEvent(new Event("vds-menu-resize",{bubbles:!0,composed:!0}));const s=this.#n(),a=this.#r();if(s&&(v(s,"aria-controls",t&&this.#e),v(s,"aria-expanded",pe(t))),a&&v(a,"aria-labelledby",t&&this.#s),this.#i.set(t),this.#D(e),ht(),this.#f){t?a?.focus():s?.focus();for(const n of[this.el,a])n&&n.setAttribute("data-keyboard","")}else for(const n of[this.el,a])n&&n.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.#c?.onOpen?.(e);else{if(this.isSubmenu)for(const n of this.#l)n.close(e);else this.#t.activeMenu=null;this.#c?.onClose?.(e)}t&&requestAnimationFrame(this.#k.bind(this))}#k(){this.#N||this.#L||(this.#h.update(),requestAnimationFrame(()=>{this.#f?this.#h.focusActive():this.#h.scroll()}))}#S(){return!this.#P()&&this.#i()}#P(){return this.#a()||this.#p()}#E(t){this.#a.set(t)}#A(t){const e=this.#r();this.#d||e&&ni(e,t)||t.stopPropagation()}#C(t){const e=this.#r();this.#d||e&&ni(e,t)||this.close(t)}#M(){const t=this.el?.querySelector('[data-part="close-target"]');return this.el&&t&&li(this.el,t,e=>e.getAttribute("role")==="menu")?t:null}#D(t){this.isSubmenu||(this.#i()?this.#t.remote.pauseControls(t):this.#t.remote.resumeControls(t))}#q(t){this.#l.add(t),new _(t).add("open",this.#V).add("close",this.#F),L(this.#I)}#I=this.#O.bind(this);#O(t){this.#l.delete(t)}#L=!1;#V=this.#_.bind(this);#_(t){this.#L=!0;const e=this.#r();this.isSubmenu&&this.triggerElement?.setAttribute("aria-hidden","true");for(const s of this.#l)if(s!==t.target)for(const a of[s.el,s.triggerElement])a?.setAttribute("aria-hidden","true");if(e){const s=t.target.el;for(const a of e.children)a.contains(s)?a.setAttribute("data-open",""):a!==s&&a.setAttribute("data-hidden","")}}#F=this.#B.bind(this);#B(t){this.#L=!1;const e=this.#r();this.isSubmenu&&this.triggerElement?.setAttribute("aria-hidden","false");for(const s of this.#l)for(const a of[s.el,s.triggerElement])a?.setAttribute("aria-hidden","false");if(e)for(const s of e.children)s.removeAttribute("data-open"),s.removeAttribute("data-hidden")}#R=ft(()=>{const t=f(this.#r);if(!t)return;let e=0,s=getComputedStyle(t),a=[...t.children];for(const n of["paddingTop","paddingBottom","borderTopWidth","borderBottomWidth"])e+=parseFloat(s[n])||0;for(const n of a)if(xt(n)&&n.style.display==="contents")a.push(...n.children);else if(n.nodeType===3)e+=parseFloat(getComputedStyle(n).fontSize);else if(xt(n)){if(!ri(n))continue;const r=getComputedStyle(n);e+=n.offsetHeight+(parseFloat(r.marginTop)||0)+(parseFloat(r.marginBottom)||0)}at(t,"--menu-height",e+"px")});#N=!1;#G(t){const e=this.#r();e&&t.propertyName==="height"&&(this.#N=t.type==="transitionstart",v(e,"data-transition",this.#N?"height":null),this.#i()&&this.#k());for(const s of this.#m)s(t)}open(t){f(this.#i)||(this.#u.show(t),ht())}close(t){f(this.#i)&&(this.#u.hide(t),ht())}}ie([A],Ht.prototype,"triggerElement"),ie([A],Ht.prototype,"contentElement"),ie([A],Ht.prototype,"isSubmenu"),ie([H],Ht.prototype,"open"),ie([H],Ht.prototype,"close");class Zl extends k(HTMLElement,Ht){static tagName="media-menu"}class td extends Ss{}class ed extends k(HTMLElement,td){static tagName="media-menu-item"}class sd extends S{static props={container:null,disabled:!1};#t=null;#e;onSetup(){this.#e=y(),tt(Ie,{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,bt(()=>{bt(()=>{this.connectScope&&d(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;v(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 xt(t)?t:t?document.querySelector(t):document.body}}const Ie=ut();class id extends S{static props={placement:null,offset:0,alignOffset:0};#t;constructor(){super(),new dt;const{placement:t}=this.$props;this.setAttributes({"data-placement":t})}onAttach(t){if(this.#t=V(U),this.#t.attachMenuItems(this),st(Ie)){const e=V(Ie);e&&(tt(Ie,null),e.attach(t),L(()=>e.attach(null)))}}onConnect(t){d(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:a}=this.$props;L(di(this.el,this.#i(),e,{offsetVarName:"media-menu",xOffset:a(),yOffset:s()})),L(this.#s.bind(this))}#s(){this.el&&(this.el.removeAttribute("style"),this.el.style.display="none")}#i(){return this.#t.button()}}class ad extends k(HTMLElement,id){static tagName="media-menu-items"}class nd extends k(HTMLElement,sd){static tagName="media-menu-portal";static attrs={disabled:{converter(t){return M(t)?t:t!==null}}}}class ia extends S{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=D(()=>{const{sort:t}=this.$props,{qualities:e}=this.#t.$state;return ms(e(),t()==="descending")});constructor(){super(),this.#s=new _t,this.#s.onValueChange=this.#o.bind(this)}onSetup(){this.#t=y(),st(U)&&(this.#e=V(U))}onConnect(t){d(this.#a.bind(this)),d(this.#r.bind(this)),d(this.#n.bind(this))}getOptions(){const{autoLabel:t,hideBitrate:e}=this.$props;return[{value:"auto",label:t},...this.#i().map(s=>{const a=s.bitrate&&s.bitrate>=0?`${Q(s.bitrate/1e6,2)} Mbps`:null;return{quality:s,label:s.label??(s.height?s.height+"p":"Unknown"),value:this.#c(s),bitrate:()=>e()?null:a}})]}#a(){this.#s.value=this.#l()}#n(){const{autoLabel:t}=this.$props,{autoQuality:e,quality:s}=this.#t.$state,a=s(),n=a?a.label??(a.height?a.height+"p":""):"";this.#e?.hint.set(e()?t()+(n?` (${n})`:""):n)}#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,a=f(s).findIndex(n=>this.#c(n)===t);if(a>=0){const n=f(s)[a];this.#t.remote.changeQuality(a,e),this.dispatch("change",{detail:n,trigger:e})}}#l(){const{quality:t,autoQuality:e}=this.#t.$state;if(e())return"auto";const s=t();return s?this.#c(s):"auto"}#c(t){return t.id}}const Ps=ia.prototype;A(Ps,"value"),A(Ps,"disabled"),H(Ps,"getOptions");class rd extends k(HTMLElement,ia){static tagName="media-quality-radio-group";onConnect(){Gt(this,(t,e)=>{const s=e.bitrate,a=t.querySelector('[data-part="bitrate"]');s&&a&&d(()=>{a.textContent=s()||""})})}}class aa extends S{static props={value:""};#t=b(!1);#e={value:this.$props.value,check:this.#r.bind(this),onCheck:null};get checked(){return this.#t()}constructor(){super(),new dt}onSetup(){this.setAttributes({value:this.$props.value,"data-checked":this.#t,"aria-checked":j(this.#t)})}onAttach(t){const e=st(U);q(t,"tabindex",e?"-1":"0"),q(t,"role",e?"menuitemradio":"radio"),d(this.#a.bind(this))}onConnect(t){this.#i(),St(t,this.#n.bind(this)),L(this.#s.bind(this))}#s(){zt(()=>{V(vs).remove(this.#e)},this.connectScope)}#i(){V(vs).add(this.#e)}#a(){const{value:t}=this.$props,e=t();f(this.#t)&&this.#e.onCheck?.(e)}#n(t){f(this.#t)||(this.#o(!0,t),this.#l(t),this.#e.onCheck?.(f(this.$props.value),t))}#r(t,e){f(this.#t)!==t&&this.#o(t,e)}#o(t,e){this.#t.set(t),this.dispatch("change",{detail:t,trigger:e})}#l(t){this.dispatch("select",{trigger:t})}}const od=aa.prototype;A(od,"checked");class ld extends k(HTMLElement,aa){static tagName="media-radio"}class na extends S{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 _t,this.#t.onValueChange=this.#s.bind(this)}onSetup(){d(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 ra=na.prototype;A(ra,"values"),A(ra,"value");class dd extends k(HTMLElement,na){static tagName="media-radio-group"}const cd=[.25,.5,.75,1,1.25,1.5,1.75,2];class oa extends S{static props={normalLabel:"Normal",rates:cd};#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 _t,this.#s.onValueChange=this.#o.bind(this)}onSetup(){this.#t=y(),st(U)&&(this.#e=V(U))}onConnect(t){d(this.#i.bind(this)),d(this.#a.bind(this)),d(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 Cs=oa.prototype;A(Cs,"value"),A(Cs,"disabled"),H(Cs,"getOptions");class ud extends k(HTMLElement,oa){static tagName="media-speed-radio-group";onConnect(){Gt(this)}}class hd extends S{static props={src:null,alt:null,crossOrigin:null};static state=new wt({img:null,src:null,alt:null,crossOrigin:null,loading:!0,error:null,hidden:!1});#t;onSetup(){this.#t=y(),this.#o(),this.#l(),this.#c(),this.#i()}onAttach(t){t.style.setProperty("pointer-events","none"),d(this.#n.bind(this)),d(this.#o.bind(this)),d(this.#l.bind(this)),d(this.#c.bind(this)),d(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){d(this.#s.bind(this)),d(this.#u.bind(this))}#e(){const{error:t}=this.$state;return!Mt(t())}#s(){const{canLoadPoster:t,poster:e}=this.#t.$state;!t()&&e()&&Xt(e(),"preconnect")}#i(){const{src:t}=this.$props,{poster:e,nativeControls:s}=this.#t.$state;this.el&&v(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 _(t).add("load",this.#h.bind(this)).add("error",this.#d.bind(this)),t.complete&&this.#h())}#r="";#o(){const{poster:t}=this.#t.$props,{canLoadPoster:e,providedPoster:s,inferredPoster:a}=this.#t.$state,n=this.$props.src()||"",r=n||t()||a();this.#r===s()&&s.set(n),this.$state.src.set(e()&&r.length?r:null),this.#r=n}#l(){const{src:t}=this.$props,{alt:e}=this.$state,{poster:s}=this.#t.$state;e.set(t()||s()?this.$props.alt():null)}#c(){const{crossOrigin:t}=this.$props,{crossOrigin:e}=this.$state,{crossOrigin:s,poster:a}=this.#t.$state,n=t()!==null?t():s();e.set(/ytimg\.com|vimeo/.test(a()||"")?null:n===!0?"anonymous":n)}#u(){const{loading:t,error:e}=this.$state,{canLoadPoster:s,poster:a}=this.#t.$state;t.set(s()&&!!a()),e.set(null)}#h(){const{loading:t,error:e}=this.$state;t.set(!1),e.set(null)}#d(t){const{loading:e,error:s}=this.$state;e.set(!1),s.set(t)}}class pd extends k(HTMLElement,hd){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;d(()=>{const{loading:a,hidden:n}=this.$state;this.#t.style.display=a()||n()?"none":""}),d(()=>{v(this.#t,"alt",e()),v(this.#t,"crossorigin",s()),v(this.#t,"src",t())}),this.#t.parentNode!==this&&this.prepend(this.#t)}}const Ot=new wt({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 la(this.min,this.max,this.value)},get fillPercent(){return this.fillRate*100},get pointerRate(){return la(this.min,this.max,this.pointerValue)},get pointerPercent(){return this.pointerRate*100}});function la(i,t,e){const s=t-i,a=e-i;return s>0?a/s:0}const Kt=ut(()=>({}));class da extends ot{#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),L(this.#s.bind(this))}#s(){this.#e?.disconnect(),this.#e=void 0}}function md(i,t,e,s){return Ke(i,Q(e,Ja(s)),t)}function fd(i,t,e,s){const a=Ke(0,e,1),n=t-i,r=n*a,o=r/s,l=s*Math.round(o);return i+l}const Es={Left:-1,ArrowLeft:-1,Up:1,ArrowUp:1,Right:1,ArrowRight:1,Down:-1,ArrowDown:-1};class gd extends ot{#t;#e;#s;constructor(t,e){super(),this.#t=t,this.#e=e}onSetup(){st(se)&&(this.#s=V(se))}onConnect(t){d(this.#c.bind(this,t)),d(this.#u.bind(this,t)),this.#t.swipeGesture&&d(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 _(this.#a).add("touchstart",this.#o.bind(this),{passive:!0}).add("touchmove",this.#l.bind(this),{passive:!1})}#a=null;#n=null;#r=null;#o(t){this.#n=t.touches[0]}#l(t){if(Mt(this.#n)||ze(t))return;const e=t.touches[0],s=e.clientX-this.#n.clientX,a=e.clientY-this.#n.clientY,n=this.$state.dragging();!n&&Math.abs(a)>5||n||(t.preventDefault(),Math.abs(s)>20&&(this.#n=e,this.#r=this.$state.value(),this.#w(this.#r,t)))}#c(t){const{hidden:e}=this.$props;K(t,"focus",this.#h.bind(this)),!(e()||this.#t.isDisabled())&&new _(t).add("keyup",this.#k.bind(this)).add("keydown",this.#T.bind(this)).add("pointerenter",this.#b.bind(this)).add("pointermove",this.#g.bind(this)).add("pointerleave",this.#y.bind(this)).add("pointerdown",this.#$.bind(this))}#u(t){this.#t.isDisabled()||!this.$state.dragging()||new _(document).add("pointerup",this.#E.bind(this),{capture:!0}).add("pointermove",this.#C.bind(this)).add("touchmove",this.#A.bind(this),{passive:!1})}#h(){this.#p(this.$state.value())}#d(t,e){const{value:s,min:a,max:n,dragging:r}=this.$state,o=Math.max(a(),Math.min(t,n()));s.set(o);const l=this.createEvent("value-change",{detail:o,trigger:e});if(this.dispatch(l),this.#t.onValueChange?.(l),r()){const c=this.createEvent("drag-value-change",{detail:o,trigger:e});this.dispatch(c),this.#t.onDragValueChange?.(c)}}#p(t,e){const{pointerValue:s,dragging:a}=this.$state;s.set(t),this.dispatch("pointer-value-change",{detail:t,trigger:e}),a()&&this.#d(t,e)}#m(t){let e,s=this.el.getBoundingClientRect(),{min:a,max:n}=this.$state;if(this.$props.orientation()==="vertical"){const{bottom:r,height:o}=s;e=(r-t.clientY)/o}else if(this.#n&&Tt(this.#r)){const{width:r}=this.#a.getBoundingClientRect(),o=(t.clientX-this.#n.clientX)/r,l=n()-a(),c=l*Math.abs(o);e=(o<0?this.#r-c:this.#r+c)/l}else{const{left:r,width:o}=s;e=(t.clientX-r)/o}return Math.max(a(),Math.min(n(),this.#t.roundValue(fd(a(),n(),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){if(t.button!==0)return;const e=this.#m(t);this.#w(e,t),this.#p(e,t)}#w(t,e){const{dragging:s}=this.$state;if(s())return;s.set(!0),this.#e.remote.pauseControls(e);const a=this.createEvent("drag-start",{detail:t,trigger:e});this.dispatch(a),this.#t.onDragStart?.(a),this.#s?.onDragStart?.()}#v(t,e){const{dragging:s}=this.$state;if(!s())return;s.set(!1),this.#e.remote.resumeControls(e);const a=this.createEvent("drag-end",{detail:t,trigger:e});this.dispatch(a),this.#t.onDragEnd?.(a),this.#n=null,this.#r=null,this.#s?.onDragEnd?.()}#x;#f=!1;#T(t){if(!Object.keys(Es).includes(t.key))return;const{key:s}=t,a=this.#S(t);if(!Mt(a)){this.#p(a,t),this.#d(a,t);return}const n=this.#P(t);this.#f||(this.#f=s===this.#x,!this.$state.dragging()&&this.#f&&this.#w(n,t)),this.#p(n,t),this.#x=s}#k(t){if(!Object.keys(Es).includes(t.key)||!Mt(this.#S(t)))return;const s=this.#f?this.$state.pointerValue():this.#P(t);this.#d(s,t),this.#v(s,t),this.#x="",this.#f=!1}#S(t){let e=t.key,{min:s,max:a}=this.$state;return e==="Home"||e==="PageUp"?s():e==="End"||e==="PageDown"?a():!t.metaKey&&/^[0-9]$/.test(e)?(a()-s())/10*Number(e):null}#P(t){const{key:e,shiftKey:s}=t;t.preventDefault(),t.stopPropagation();const{shiftKeyMultiplier:a}=this.$props,{min:n,max:r,value:o,pointerValue:l}=this.$state,c=this.#t.getStep(),h=this.#t.getKeyStep(),u=s?h*a():h,g=Number(Es[e]),$=u*g,w=this.#f?l():this.#t.getValue?.()??o(),P=(w+$)/c;return Math.max(n(),Math.min(r(),Number((c*P).toFixed(3))))}#E(t){if(t.button!==0)return;t.preventDefault(),t.stopImmediatePropagation();const e=this.#m(t);this.#p(e,t),this.#v(e,t)}#A(t){t.preventDefault()}#C=At(t=>{this.#p(this.#m(t),t)},20,{leading:!0})}class rt extends ot{static props={hidden:!1,disabled:!1,step:1,keyStep:1,orientation:"horizontal",shiftKeyMultiplier:5};#t;#e;#s=b(!0);#i=b(!0);constructor(t){super(),this.#e=t}onSetup(){this.#t=y();const t=new dt;t.attach(this),this.$state.focused=t.focused.bind(t),st(Kt)||tt(Kt,{default:"value"}),tt(xs,{orientation:this.$props.orientation,disabled:this.#e.isDisabled,preview:b(null)}),d(this.#r.bind(this)),d(this.#o.bind(this)),d(this.#l.bind(this)),this.#u(),new gd(this.#e,this.#t).attach(this),new da({callback:this.#a.bind(this)}).attach(this)}onAttach(t){q(t,"role","slider"),q(t,"tabindex","0"),q(t,"autocomplete","off"),d(this.#h.bind(this))}onConnect(t){L(oi(t,this.#s.set)),d(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:a}=this.$state;f(t)||e.set(md(s(),a(),e(),this.#e.getStep()))}#o(){this.$state.step.set(this.#e.getStep())}#l(){if(!this.#e.isDisabled())return;const{dragging:t,pointing:e}=this.$state;t.set(!1),e.set(!1)}#c(){return pe(this.#e.isDisabled())}#u(){const{orientation:t}=this.$props,{dragging:e,active:s,pointing:a}=this.$state;this.setAttributes({"data-dragging":e,"data-pointing":a,"data-active":s,"aria-disabled":this.#c.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})}#h(){const{fillPercent:t,pointerPercent:e}=this.$state;this.#d(Q(t(),3),Q(e(),3))}#d=ft((t,e)=>{this.el?.style.setProperty("--slider-fill",t+"%"),this.el?.style.setProperty("--slider-pointer",e+"%")})}class bd extends S{static props={...rt.props,step:25,keyStep:25,shiftKeyMultiplier:2,min:0,max:300};static state=Ot;#t;onSetup(){this.#t=y(),tt(Kt,{default:"percent",percent:(t,e)=>Q(this.$state.value(),e)+"%"}),new rt({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.#l.bind(this),onValueChange:this.#o.bind(this)}).attach(this),d(this.#i.bind(this)),d(this.#a.bind(this))}onAttach(t){t.setAttribute("data-media-audio-gain-slider",""),q(t,"aria-label","Audio Boost");const{canSetAudioGain:e}=this.#t.$state;this.setAttributes({"data-supported":e,"aria-hidden":j(()=>!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=Q(1+t.detail/100,2);this.#t.remote.changeAudioGain(e,t)}#o(t){this.#r(t)}#l(t){this.#r(t)}}class yd extends k(HTMLElement,bd){static tagName="media-audio-gain-slider"}class vd extends S{static props={...rt.props,step:1,keyStep:1,shiftKeyMultiplier:1};static state=Ot;#t;#e=D(()=>{const{qualities:t}=this.#t.$state;return ms(t())});onSetup(){this.#t=y(),new rt({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.#u.bind(this),onValueChange:this.#c.bind(this)}).attach(this),d(this.#a.bind(this)),d(this.#n.bind(this))}onAttach(t){t.setAttribute("data-media-quality-slider",""),q(t,"aria-label","Video Quality");const{qualities:e,canSetQuality:s}=this.#t.$state,a=D(()=>s()&&e().length>0);this.setAttributes({"data-supported":a,"aria-hidden":j(()=>!a())})}#s(){const{value:t}=this.$state;return t()}#i(){const{quality:t}=this.#t.$state;if(!t())return"";const{height:e,bitrate:s,label:a}=t(),n=s&&s>0?`${(s/1e6).toFixed(2)} Mbps`:null,r=a??(e?`${e}p`:"");return r?`${r}${n?` (${n})`:""}`:"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=At(this.#l.bind(this),25);#l(t){if(!t.trigger)return;const{qualities:e}=this.#t,s=f(this.#e)[t.detail];this.#t.remote.changeQuality(e.indexOf(s),t)}#c(t){this.#o(t)}#u(t){this.#o(t)}}class $d extends k(HTMLElement,vd){static tagName="media-quality-slider"}class ca extends S{static props={...rt.props,step:.1,keyStep:5,shiftKeyMultiplier:2,pauseWhileDragging:!1,noSwipeGesture:!1,seekingRequestThrottle:100};static state=Ot;#t;#e;#s=b(null);constructor(){super();const{noSwipeGesture:t}=this.$props;new rt({swipeGesture:()=>!t(),getValue:this.#b.bind(this),getStep:this.#g.bind(this),getKeyStep:this.#y.bind(this),roundValue:this.#$,isDisabled:this.#w.bind(this),aria:{valueNow:this.#v.bind(this),valueText:this.#x.bind(this)},onDragStart:this.#h.bind(this),onDragValueChange:this.#d.bind(this),onDragEnd:this.#p.bind(this),onValueChange:this.#m.bind(this)})}onSetup(){this.#t=y(),tt(Kt,{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)}),d(this.#r.bind(this)),d(this.#n.bind(this))}onAttach(t){t.setAttribute("data-media-time-slider",""),q(t,"aria-label","Seek")}onConnect(t){d(this.#o.bind(this)),Yt(this.#t.textTracks,"chapters",this.#s.set)}#i(){const{bufferedEnd:t,duration:e}=this.#t.$state;return Q(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=At(this.#l.bind(this),this.$props.seekingRequestThrottle())}#r(){if(this.$state.hidden())return;const{value:t,dragging:e}=this.$state,s=this.#b();f(e)||(t.set(s),this.dispatch("value-change",{detail:s}))}#o(){const t=this.#t.player.el,{preview:e}=V(xs);t&&e()&&v(t,"data-preview",this.$state.active())}#l(t,e){this.#t.remote.seeking(t,e)}#c(t,e,s){this.#e.cancel();const{live:a}=this.#t.$state;if(a()&&e>=99){this.#t.remote.seekToLiveEdge(s);return}this.#t.remote.seek(t,s)}#u=!1;#h(t){const{pauseWhileDragging:e}=this.$props;if(e()){const{paused:s}=this.#t.$state;this.#u=!s(),this.#t.remote.pause(t)}}#d(t){this.#e(this.#f(t.detail),t)}#p(t){const{seeking:e}=this.#t.$state;f(e)||this.#l(this.#f(t.detail),t);const s=t.detail;this.#c(this.#f(s),s,t);const{pauseWhileDragging:a}=this.$props;a()&&this.#u&&(this.#t.remote.play(t),this.#u=!1)}#m(t){const{dragging:e}=this.$state;e()||!t.trigger||this.#p(t)}#b(){const{currentTime:t}=this.#t.$state;return this.#T(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){return Q(t,3)}#w(){const{disabled:t}=this.$props,{canSeek:e}=this.#t.$state;return t()||!e()}#v(){const{value:t}=this.$state;return Math.round(t())}#x(){const t=this.#f(this.$state.value()),{duration:e}=this.#t.$state;return Number.isFinite(t)?`${Le(t)} out of ${Le(e())}`:"live"}#f(t){const{duration:e}=this.#t.$state;return Q(t/100*e(),5)}#T(t){const{liveEdge:e,duration:s}=this.#t.$state,a=Math.max(0,Math.min(1,e()?1:Math.min(t,s())/s()));return Number.isNaN(a)?0:Number.isFinite(a)?a*100:100}#k(t){const e=this.#f(t),{live:s,duration:a}=this.#t.$state;return Number.isFinite(e)?(s()?e-a():e).toFixed(0):"LIVE"}#S(t,e){const s=this.#f(t),{live:a,duration:n}=this.#t.$state,r=a()?s-n():s;return Number.isFinite(s)?`${r<0?"-":""}${Me(Math.abs(r),e)}`:"LIVE"}}class ua extends S{static props={disabled:!1};#t;#e;#s;#i=null;#a=[];#n=b(null);#r=b([]);#o=b(-1);#l=b(-1);#c=0;get cues(){return this.#r()}get activeCue(){return this.#r()[this.#o()]||null}get activePointerCue(){return this.#r()[this.#l()]||null}onSetup(){this.#t=y(),this.#e=Ft(ca.state)}onAttach(t){Yt(this.#t.textTracks,"chapters",this.#u.bind(this)),d(this.#E.bind(this))}onConnect(){L(()=>this.#h.bind(this))}onDestroy(){this.#u(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&&zt(()=>this.#d(),this.#s=Va())}#u(t){f(this.#n)!==t&&(this.#h(),this.#n.set(t))}#h(){this.#a=[],this.#r.set([]),this.#o.set(-1),this.#l.set(-1),this.#c=0,this.#s?.dispose()}#d(){this.#a.length&&d(this.#p.bind(this))}#p(){const{hidden:t}=this.#e;t()||(d(this.#m.bind(this)),d(this.#b.bind(this)),d(this.#g.bind(this)),d(this.#v.bind(this)))}#m(){const t=this.#r();if(!t.length)return;let e,{seekableStart:s,seekableEnd:a}=this.#t.$state,n=s(),r=a()||t[t.length-1].endTime,o=r-n,l=100;for(let c=0;c<t.length;c++)if(e=t[c],this.#a[c]){const h=c===t.length-1?l:Q((e.endTime-Math.max(n,e.startTime))/o*100,3);this.#a[c].style.width=h+"%",l-=h}}#b(){let{liveEdge:t,seekableStart:e,seekableEnd:s}=this.#t.$state,{fillPercent:a,value:n}=this.#e,r=this.#r(),o=t(),l=f(this.#o),c=r[l],h=o?this.#r.length-1:this.#w(c&&c.startTime/s()*100<=f(n)?l:0,a());o||!c?this.#y(0,r.length,100):h>l?this.#y(l,h,100):h<l&&this.#y(h+1,l+1,0);const u=o?100:this.#S(r[h],a(),e(),this.#k(r));this.#$(this.#a[h],u),this.#o.set(h)}#g(){let{hidden:t,pointerPercent:e}=this.#e;if(t()){this.#l.set(-1);return}const s=this.#w(0,e());this.#l.set(s)}#y(t,e,s){for(let a=t;a<e;a++)this.#$(this.#a[a],s)}#$(t,e){t&&(t.style.setProperty("--chapter-fill",e+"%"),v(t,"data-active",e>0&&e<100),v(t,"data-ended",e===100))}#w(t,e){let s=0,a=this.#r();if(e===0)return 0;if(e===100)return a.length-1;let{seekableStart:n}=this.#t.$state,r=n(),o=this.#k(a);for(let l=t;l<a.length;l++)if(s=this.#S(a[l],e,r,o),s>=0&&s<100)return l;return 0}#v(){this.#x(this.#f())}#x=ft(t=>{let e,s=this.#r(),{seekableStart:a}=this.#t.$state,n=a(),r=this.#k(s);for(let o=this.#c;o<this.#a.length;o++)if(e=this.#S(s[o],t,n,r),this.#a[o]?.style.setProperty("--chapter-progress",e+"%"),e<100){this.#c=o;break}});#f=D(this.#T.bind(this));#T(){const{bufferedEnd:t,duration:e}=this.#t.$state;return Q(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,a){if(!t||this.#r().length===0)return 0;const r=a-s,o=Math.max(0,t.startTime-s),l=Math.min(a,t.endTime)-s,c=o/r,h=c*100,u=Math.min(1,c+(l-o)/r)*100;return Math.max(0,Q(e>=u?100:(e-h)/(u-h)*100,3))}#P(t){let e=[],{seekableStart:s,seekableEnd:a,duration:n}=this.#t.$state,r=s(),o=a();t=t.filter(h=>h.startTime<=o&&h.endTime>=r);const l=t[0];l&&l.startTime>r&&e.push(new window.VTTCue(r,l.startTime,""));for(let h=0;h<t.length-1;h++){const u=t[h],g=t[h+1];if(e.push(u),g){const $=g.startTime-u.endTime;$>0&&e.push(new window.VTTCue(u.endTime,u.endTime+$,""))}}const c=t[t.length-1];if(c){e.push(c);const h=n();h>=0&&h-c.endTime>1&&e.push(new window.VTTCue(c.endTime,n(),""))}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.#c=0;return}const e=this.#n();if(e){const s=this.#M.bind(this);s(),new _(e).add("add-cue",s).add("remove-cue",s),d(this.#C.bind(this))}return this.#i=this.#I(),this.#i&&d(this.#D.bind(this)),()=>{this.#i&&(this.#i.textContent="",this.#i=null)}}#C(){this.#t.$state.duration(),this.#M()}#M=Re(()=>{const t=f(this.#n);!this.scope||!t||!t.cues.length||(this.#r.set(this.#P(t.cues)),this.#o.set(0),this.#c=0)},150,!0);#D(){const t=this.activePointerCue||this.activeCue;this.#i&&(this.#i.textContent=t?.text||"")}#q(){let t=this.el;for(;t&&t.getAttribute("role")!=="slider";)t=t.parentElement;return t}#I(){const t=this.#q();return t?t.querySelector('[data-part="chapter-title"]'):null}}const qe=ua.prototype;A(qe,"cues"),A(qe,"activeCue"),A(qe,"activePointerCue"),H(qe,"setRefs");class wd extends k(HTMLElement,ua){static tagName="media-slider-chapters";#t=null;onConnect(){bt(()=>{if(!this.connectScope)return;const t=this.querySelector("template");t&&(this.#t=t,d(this.#e.bind(this)))})}#e(){if(!this.#t)return;const t=Ye(this.#t,this.cues.length||1);this.setRefs(t)}}class ae extends S{static props={...rt.props,min:0,max:100,value:0};static state=Ot;constructor(){super(),new rt({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(){d(this.#s.bind(this)),d(this.#i.bind(this))}#t(){const{value:t}=this.$state;return Math.round(t())}#e(){const{value:t,max:e}=this.$state;return Q(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 Td extends k(HTMLElement,ae){static tagName="media-slider"}class kd extends S{static props={offset:0,noClamp:!1};#t;onSetup(){this.#t=V(xs);const{active:t}=Ft(ae.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),L(()=>e.set(null)),d(this.#e.bind(this));const s=new ResizeObserver(this.#e.bind(this));s.observe(t),L(()=>s.disconnect())}#e=ft(()=>{const{disabled:t,orientation:e}=this.#t;if(t())return;const s=this.el,{offset:a,noClamp:n}=this.$props;s&&Sd(s,{clamp:!n(),offset:a(),orientation:e()})})}function Sd(i,{clamp:t,offset:e,orientation:s}){const a=getComputedStyle(i),n=parseFloat(a.width),r=parseFloat(a.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=n/2;if(!t)o.left=`calc(var(--slider-pointer) - ${l}px)`;else{const c=`max(0px, calc(var(--slider-pointer) - ${l}px))`,h=`calc(100% - ${n}px)`;o.left=`min(${c}, ${h})`}}else{const l=r/2;if(!t)o.bottom=`calc(var(--slider-pointer) - ${l}px)`;else{const c=`max(${l}px, calc(var(--slider-pointer) - ${l}px))`,h=`calc(100% - ${r}px)`;o.bottom=`min(${c}, ${h})`}}Object.assign(i.style,o)}class xd extends k(HTMLElement,kd){static tagName="media-slider-preview"}class Pd extends S{}class Cd extends k(HTMLElement,Pd){static tagName="media-slider-steps";#t=null;onConnect(t){bt(()=>{this.connectScope&&(this.#t=t.querySelector("template"),this.#t&&d(this.#e.bind(this)))})}#e(){if(!this.#t)return;const{min:t,max:e,step:s}=Ft(Ot),a=(e()-t())/s();Ye(this.#t,Math.floor(a)+1)}}const vt=new Map,_e=new Map;class Ls{#t;#e;#s;$images=b([]);static create(t,e){const s=y();return new Ls(t,e,s)}constructor(t,e,s){this.#e=t,this.#s=e,this.#t=s,d(this.#i.bind(this))}#i(){const{canLoad:t}=this.#t.$state;if(!t())return;const e=this.#e();if(e){if(M(e)&&vt.has(e)){const s=vt.get(e);if(vt.delete(e),vt.set(e,s),vt.size>99){const a=vt.keys().next().value;vt.delete(a)}this.$images.set(vt.get(e))}else if(M(e)){const s=this.#s(),a=e+"::"+s;if(!_e.has(a)){const n=new Promise(async(r,o)=>{try{const l=await fetch(e,{credentials:ge(s)});if(l.headers.get("content-type")==="application/json"){const h=await l.json();if(W(h))if(h[0]&&"text"in h[0])r(this.#r(h));else{for(let u=0;u<h.length;u++){const g=h[u];gt(Ra(g),!1),gt("url"in g&&M(g.url),!1),gt("startTime"in g&&Tt(g.startTime),!1)}r(h)}else r(this.#n(h));return}import("https://cdn.jsdelivr.net/npm/media-captions@next/dist/prod.js").then(async({parseResponse:h})=>{try{const{cues:u}=await h(l);r(this.#r(u))}catch(u){o(u)}})}catch(l){o(l)}}).then(r=>(vt.set(a,r),r)).catch(r=>{this.#u(e,r)}).finally(()=>{M(a)&&_e.delete(a)});_e.set(a,n)}_e.get(a)?.then(n=>{this.$images.set(n||[])})}else if(W(e))try{this.$images.set(this.#a(e))}catch(s){this.#u(e,s)}else try{this.$images.set(this.#n(e))}catch(s){this.#u(e,s)}return()=>{this.$images.set([])}}}#a(t){const e=this.#o();return t.map((s,a)=>(gt(s.url&&M(s.url)),gt("startTime"in s&&Tt(s.startTime)),{...s,url:M(s.url)?this.#l(s.url,e):s.url}))}#n(t){gt(M(t.url)),gt(W(t.tiles)&&t.tiles?.length);const e=new URL(t.url),s=[],a="tile_width"in t?t.tile_width:t.tileWidth,n="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:a,height:n,coords:{x:r.x,y:r.y}});return s}#r(t){for(let a=0;a<t.length;a++){const n=t[a];gt("startTime"in n&&Tt(n.startTime)),gt("text"in n&&M(n.text))}const e=[],s=this.#o();for(const a of t){const[n,r]=a.text.split("#"),o=this.#c(r);e.push({url:this.#l(n,s),startTime:a.startTime,endTime:a.endTime,width:o?.w,height:o?.h,coords:o&&Tt(o.x)&&Tt(o.y)?{x:o.x,y:o.y}:void 0})}return e}#o(){let t=f(this.#e);return!M(t)||!/^https?:/.test(t)?location.href:t}#l(t,e){return/^https?:/.test(t)?new URL(t):new URL(t,e)}#c(t){if(!t)return{};const[e,s]=t.split("="),a=s?.split(","),n={};if(!e||!a)return null;for(let r=0;r<e.length;r++){const o=+a[r];isNaN(o)||(n[e[r]]=o)}return n}#u(t,e){}}class Ed extends S{static props={src:null,time:0,crossOrigin:null};static state=new wt({src:"",img:null,thumbnails:[],activeThumbnail:null,crossOrigin:null,loading:!1,error:null,hidden:!1});media;#t;#e=[];onSetup(){this.media=y(),this.#t=Ls.create(this.$props.src,this.$state.crossOrigin),this.#i(),this.setAttributes({"data-loading":this.#o.bind(this),"data-error":this.#l.bind(this),"data-hidden":this.$state.hidden,"aria-hidden":j(this.$state.hidden)})}onConnect(t){d(this.#s.bind(this)),d(this.#c.bind(this)),d(this.#i.bind(this)),d(this.#a.bind(this)),d(this.#u.bind(this)),d(this.#h.bind(this))}#s(){const t=this.$state.img();t&&new _(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,a=t()!==null?t():s();e.set(a===!0?"anonymous":a)}#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.#h(),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()}#l(){const{error:t}=this.$state;return!Mt(t())}#c(){const{hidden:t}=this.$state,{duration:e}=this.media.$state,s=this.#t.$images();t.set(this.#l()||!Number.isFinite(e())||s.length===0)}getTime(){return this.$props.time()}#u(){let t=this.#t.$images();if(!t.length)return;let e=this.getTime(),{src:s,activeThumbnail:a}=this.$state,n=-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)){n=o;break}}t[n]&&(r=t[n]),a.set(r),s.set(r?.url.href||"")}#h(){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 a=s.width??e.naturalWidth,n=s?.height??e.naturalHeight,{maxWidth:r,maxHeight:o,minWidth:l,minHeight:c,width:h,height:u}=getComputedStyle(this.el);l==="100%"&&(l=parseFloat(h)+""),c==="100%"&&(c=parseFloat(u)+"");let g=Math.max(parseInt(l)/a,parseInt(c)/n),$=Math.min(Math.max(parseInt(l),parseInt(r))/a,Math.max(parseInt(c),parseInt(o))/n),w=!isNaN($)&&$<1?$:g>1?g:1;this.#d(t,"--thumbnail-width",`${a*w}px`),this.#d(t,"--thumbnail-height",`${n*w}px`),this.#d(t,"--thumbnail-aspect-ratio",String(Q(a/n,5))),this.#d(e,"width",`${e.naturalWidth*w}px`),this.#d(e,"height",`${e.naturalHeight*w}px`),this.#d(e,"transform",s.coords?`translate(-${s.coords.x*w}px, -${s.coords.y*w}px)`:""),this.#d(e,"max-width","none")}#d(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 Ad=Xe('<img loading="eager" decoding="async" aria-hidden="true">');class ha extends k(HTMLElement,Ed){static tagName="media-thumbnail";static attrs={crossOrigin:"crossorigin"};#t;#e=this.#s();onSetup(){this.#t=y(),this.$state.img.set(this.#e)}onConnect(){const{src:t,crossOrigin:e}=this.$state;this.#e.parentNode!==this&&this.prepend(this.#e),d(()=>{v(this.#e,"src",t()),v(this.#e,"crossorigin",e())})}#s(){return Je(Ad)}}class Md extends ha{static tagName="media-slider-thumbnail";#t;#e;onSetup(){super.onSetup(),this.#t=y(),this.#e=Ft(ae.state)}onConnect(){super.onConnect(),d(this.#s.bind(this))}#s(){const{duration:t,clipStartTime:e}=this.#t.$state;this.time=e()+this.#e.pointerRate()*t()}}class pa extends S{static props={type:"pointer",format:null,showHours:!1,showMs:!1,padHours:null,padMinutes:null,decimalPlaces:2};#t;#e;#s;onSetup(){this.#s=Ft(ae.state),this.#t=V(Kt),this.#e=D(this.getValueText.bind(this))}getValueText(){const{type:t,format:e,decimalPlaces:s,padHours:a,padMinutes:n,showHours:r,showMs:o}=this.$props,{value:l,pointerValue:c,min:h,max:u}=this.#s,g=e?.()??this.#t.default,$=t()==="current"?l():c();if(g==="percent"){const w=u()-h(),P=$/w*100;return(this.#t.percent??Q)(P,s())+"%"}else return g==="time"?(this.#t.time??Me)($,{padHrs:a(),padMins:n(),showHrs:r(),showMs:o()}):(this.#t.value?.($)??$.toFixed(2))+""}}const Ld=pa.prototype;H(Ld,"getValueText");class Dd extends k(HTMLElement,pa){static tagName="media-slider-value";static attrs={padMinutes:{converter:Na}};onConnect(){d(()=>{this.textContent=this.getValueText()})}}class ma extends S{static props={src:null,crossOrigin:null};static state=new wt({video:null,src:null,crossOrigin:null,canPlay:!1,error:null,hidden:!1});#t;#e;get video(){return this.$state.video()}onSetup(){this.#t=y(),this.#e=Ft(ae.state),this.#a(),this.setAttributes({"data-loading":this.#n.bind(this),"data-hidden":this.$state.hidden,"data-error":this.#r.bind(this),"aria-hidden":j(this.$state.hidden)})}onAttach(t){d(this.#s.bind(this)),d(this.#i.bind(this)),d(this.#a.bind(this)),d(this.#o.bind(this)),d(this.#l.bind(this)),d(this.#h.bind(this))}#s(){const t=this.$state.video();t&&(t.readyState>=2&&this.#c(),new _(t).add("canplay",this.#c.bind(this)).add("error",this.#u.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,a=t()!==null?t():s();e.set(a===!0?"anonymous":a)}#n(){const{canPlay:t,hidden:e}=this.$state;return!t()&&!e()}#r(){const{error:t}=this.$state;return!Mt(t)}#o(){const{src:t,hidden:e}=this.$state,{canLoad:s,duration:a}=this.#t.$state;e.set(s()&&(!t()||this.#r()||!Number.isFinite(a())))}#l(){const{src:t,canPlay:e,error:s}=this.$state;t(),e.set(!1),s.set(null)}#c(t){const{canPlay:e,error:s}=this.$state;e.set(!0),s.set(null),this.dispatch("can-play",{trigger:t})}#u(t){const{canPlay:e,error:s}=this.$state;e.set(!1),s.set(t),this.dispatch("error",{trigger:t})}#h(){const{video:t,canPlay:e}=this.$state,{duration:s}=this.#t.$state,{pointerRate:a}=this.#e,n=t();e()&&n&&Number.isFinite(s())&&Number.isFinite(a())&&(n.currentTime=a()*s())}}const Id=ma.prototype;A(Id,"video");const qd=Xe('<video muted playsinline preload="none" style="max-width: unset;"></video>');class _d extends k(HTMLElement,ma){static tagName="media-slider-video";#t;#e=this.#s();onSetup(){this.#t=y(),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),d(()=>{v(this.#e,"crossorigin",s()),v(this.#e,"preload",t()?"auto":"none"),v(this.#e,"src",e())})}#s(){return Je(qd)}}class Od extends S{static props={...rt.props,step:.25,keyStep:.25,shiftKeyMultiplier:2,min:0,max:2};static state=Ot;#t;onSetup(){this.#t=y(),new rt({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.#u.bind(this),onValueChange:this.#c.bind(this)}).attach(this),d(this.#i.bind(this)),d(this.#a.bind(this))}onAttach(t){t.setAttribute("data-media-speed-slider",""),q(t,"aria-label","Speed");const{canSetPlaybackRate:e}=this.#t.$state;this.setAttributes({"data-supported":e,"aria-hidden":j(()=>!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 Q(t,2)}#r(){const{disabled:t}=this.$props,{canSetPlaybackRate:e}=this.#t.$state;return t()||!e()}#o=At(this.#l.bind(this),25);#l(t){if(!t.trigger)return;const e=t.detail;this.#t.remote.changePlaybackRate(e,t)}#c(t){this.#o(t)}#u(t){this.#o(t)}}class Vd extends k(HTMLElement,Od){static tagName="media-speed-slider"}class Rd extends k(HTMLElement,ca){static tagName="media-time-slider"}class Nd extends S{static props={...rt.props,keyStep:5,shiftKeyMultiplier:2};static state=Ot;#t;onSetup(){this.#t=y();const{audioGain:t}=this.#t.$state;tt(Kt,{default:"percent",value(e){return(e*(t()??1)).toFixed(2)},percent(e){return Math.round(e*(t()??1))}}),new rt({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.#c.bind(this),onValueChange:this.#l.bind(this)}).attach(this),d(this.#n.bind(this))}onAttach(t){t.setAttribute("data-media-volume-slider",""),q(t,"aria-label","Volume");const{canSetVolume:e}=this.#t.$state;this.setAttributes({"data-supported":e,"aria-hidden":j(()=>!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 Q(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=At(this.#o.bind(this),25);#o(t){if(!t.trigger)return;const e=Q(t.detail/100,3);this.#t.remote.changeVolume(e,t)}#l(t){this.#r(t)}#c(t){this.#r(t)}}class Fd extends k(HTMLElement,Nd){static tagName="media-volume-slider"}class Bd extends S{static props={size:96,trackWidth:8,fillPercent:50};onConnect(t){bt(()=>{if(!this.connectScope)return;const e=t.querySelector("svg"),s=e.firstElementChild,a=s.nextElementSibling;d(this.#t.bind(this,e,s,a))})}#t(t,e,s){const{size:a,trackWidth:n,fillPercent:r}=this.$props;v(t,"width",a()),v(t,"height",a()),v(e,"stroke-width",n()),v(s,"stroke-width",n()),v(s,"stroke-dashoffset",100-r())}}class Gd extends k(ve,Bd){static tagName="media-spinner";render(){return p`
|
|
927
|
+
<svg fill="none" viewBox="0 0 120 120" aria-hidden="true" data-part="root">
|
|
928
|
+
<circle cx="60" cy="60" r="54" stroke="currentColor" data-part="track"></circle>
|
|
929
|
+
<circle
|
|
930
|
+
cx="60"
|
|
931
|
+
cy="60"
|
|
932
|
+
r="54"
|
|
933
|
+
stroke="currentColor"
|
|
934
|
+
pathLength="100"
|
|
935
|
+
stroke-dasharray="100"
|
|
936
|
+
data-part="track-fill"
|
|
937
|
+
></circle>
|
|
938
|
+
</svg>
|
|
939
|
+
`}}class Hd extends S{static props={type:"current",showHours:!1,padHours:null,padMinutes:null,remainder:!1,toggle:!1,hidden:!1};static state=new wt({timeText:"",hidden:!1});#t;#e=b(null);#s=b(!0);#i=b(!0);onSetup(){this.#t=y(),this.#o();const{type:t}=this.$props;this.setAttributes({"data-type":t,"data-remainder":this.#u.bind(this)}),new da({callback:this.#a.bind(this)}).attach(this)}onAttach(t){t.hasAttribute("role")||d(this.#l.bind(this)),d(this.#o.bind(this))}onConnect(t){L(oi(t,this.#s.set)),d(this.#n.bind(this)),d(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&&St(this.el,this.#h.bind(this))}#o(){const{hidden:t,timeText:e}=this.$state,{duration:s}=this.#t.$state;if(t())return;const{type:a,padHours:n,padMinutes:r,showHours:o}=this.$props,l=this.#c(a()),c=s(),h=this.#u();if(!Number.isFinite(l+c)){e.set("LIVE");return}const u=h?Math.max(0,c-l):l,g=Me(u,{padHrs:n(),padMins:r(),showHrs:o()});e.set((h?"-":"")+g)}#l(){if(!this.el)return;const{toggle:t}=this.$props;v(this.el,"role",t()?"timer":null),v(this.el,"tabindex",t()?0:null)}#c(t){const{bufferedEnd:e,duration:s,currentTime:a}=this.#t.$state;switch(t){case"buffered":return e();case"duration":return s();default:return a()}}#u(){return this.$props.remainder()&&this.#e()!==!1}#h(t){if(t.preventDefault(),this.#e()===null){this.#e.set(!this.$props.remainder());return}this.#e.set(e=>!e)}}class Kd extends k(HTMLElement,Hd){static tagName="media-time";onConnect(){d(()=>{this.textContent=this.$state.timeText()})}}class Wd extends S{}class Qd extends k(HTMLElement,Wd){static tagName="media-title";#t;onSetup(){this.#t=y()}onConnect(){d(this.#e.bind(this))}#e(){const{title:t}=this.#t.$state;this.textContent=t()}}const Vt=ut();class Ud extends S{static props={placement:"top center",offset:0,alignOffset:0};constructor(){super(),new dt;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=V(Vt);L(()=>e.detachContent(t)),L(bt(()=>{this.connectScope&&d(this.#e.bind(this))}))}#t(t){V(Vt).attachContent(t)}#e(){const{showing:t}=V(Vt);if(!t())return;const{placement:e,offset:s,alignOffset:a}=this.$props;return di(this.el,this.#s(),e(),{offsetVarName:"media-tooltip",xOffset:a(),yOffset:s()})}#s(){return V(Vt).trigger()}}class jd extends k(HTMLElement,Ud){static tagName="media-tooltip-content"}let zd=0;class Yd extends S{static props={showDelay:700};#t=`media-tooltip-${++zd}`;#e=b(null);#s=b(null);#i=b(!1);constructor(){super(),new dt;const{showDelay:t}=this.$props;new sa({trigger:this.#e,content:this.#s,showDelay:t,listen(e,s,a){d(()=>{be()&&K(e,"focus",s),K(e,"blur",a)}),new _(e).add("touchstart",n=>n.preventDefault(),{passive:!1}).add("mouseenter",s).add("mouseleave",a)},onChange:this.#l.bind(this)})}onAttach(t){t.style.setProperty("display","contents")}onSetup(){tt(Vt,{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`,""),v(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",q(t,"role","tooltip"),this.#s.set(t)}#o(t){t.removeAttribute("id"),t.removeAttribute("role"),this.#s.set(null)}#l(t){const e=this.#e(),s=this.#s();e&&v(e,"aria-describedby",t?this.#t:null);for(const a of[this.el,e,s])a&&v(a,"data-visible",t);this.#i.set(t)}}class Xd extends k(HTMLElement,Yd){static tagName="media-tooltip"}class Jd extends S{constructor(){super(),new dt}onConnect(t){L(bt(()=>{if(!this.connectScope)return;this.#t();const e=V(Vt);L(()=>{const s=this.#e();s&&e.detachTrigger(s)})}))}#t(){const t=this.#e(),e=V(Vt);t&&e.attachTrigger(t)}#e(){const t=this.el.firstElementChild;return t?.localName==="button"||t?.getAttribute("role")==="button"?t:this.el}}class Zd extends k(HTMLElement,Jd){static tagName="media-tooltip-trigger";onConnect(){this.style.display="contents"}}T(_l),T(Al),T(Ll),T(pd),T(sl),T(Xd),T(Zd),T(jd),T(vl),T(fl),T(ol),T(dl),T(bl),T(wl),T(nl),T(ul),T(kl),T(Td),T(yd),T(Fd),T(Rd),T(Vd),T($d),T(wd),T(Cd),T(xd),T(Dd),T(Md),T(_d),T(Zl),T(Kl),T(nd),T(ad),T(ed),T(Rl),T(Nl),T(ud),T(Vl),T(rd),T(Gl),T(dd),T(ld),T(Il),T(ha),T(xl),T(pl),T(Kd),T(Qd),T(Cl),T(Gd);export{Xe as a,Je as c};
|