From 72a7c3f7ee1c6b7d310b73498e6931ef84c71ae6 Mon Sep 17 00:00:00 2001 From: Alexander Lopatin Date: Wed, 27 Nov 2024 22:44:58 +0800 Subject: [PATCH] Debug --- _config.yml | 4 +- .../etc/aquatic/aquatic_ws.conf | 2 +- _hosts/media.codonaft/etc/init.d/aquatic_ws | 18 ++- .../etc/nginx/http.d/media.conf | 18 +-- .../media.codonaft/etc/nginx/http.d/omv.conf | 4 + _includes/head.html | 105 +++++++++++++++--- _includes/p2p_player.html | 6 +- _includes/zapthreads.html | 2 +- _sass/includes/_p2p_player.scss | 3 - ...stack-PxFj4GI7.js => vidstack-BfdttQuo.js} | 32 +++--- ...stack-8IHwm4sy.js => vidstack-CqQtTnlu.js} | 2 +- assets/js/vendor/vidstack-player/vidstack.js | 2 +- ...20\272\321\202\320\270\320\272\320\265.md" | 3 +- 13 files changed, 135 insertions(+), 66 deletions(-) rename assets/js/vendor/vidstack-player/chunks/{vidstack-PxFj4GI7.js => vidstack-BfdttQuo.js} (88%) rename assets/js/vendor/vidstack-player/chunks/{vidstack-8IHwm4sy.js => vidstack-CqQtTnlu.js} (93%) diff --git a/_config.yml b/_config.yml index db865b7..901550d 100644 --- a/_config.yml +++ b/_config.yml @@ -145,7 +145,9 @@ theme_settings: post_navigation: true p2p_player: - media_url: https://media.codonaft.com + media_urls: + - https://media.codonaft.com + - https://media-cached.codonaft.com trackers: - wss://media.codonaft.com/announce - wss://tracker.webtorrent.dev diff --git a/_hosts/media.codonaft/etc/aquatic/aquatic_ws.conf b/_hosts/media.codonaft/etc/aquatic/aquatic_ws.conf index 11f3ab6..7fe3c8e 100644 --- a/_hosts/media.codonaft/etc/aquatic/aquatic_ws.conf +++ b/_hosts/media.codonaft/etc/aquatic/aquatic_ws.conf @@ -11,7 +11,7 @@ enable_tls = false tls_certificate_path = "" tls_private_key_path = "" websocket_max_message_size = 65536 -websocket_max_frame_size = 16384 +websocket_max_frame_size = 32768 # first messages that iOS sends are too large, this causes a connection drop websocket_write_buffer_size = 8192 enable_http_health_checks = false diff --git a/_hosts/media.codonaft/etc/init.d/aquatic_ws b/_hosts/media.codonaft/etc/init.d/aquatic_ws index d3c50e5..5f8e7df 100755 --- a/_hosts/media.codonaft/etc/init.d/aquatic_ws +++ b/_hosts/media.codonaft/etc/init.d/aquatic_ws @@ -37,23 +37,29 @@ update_access_list() { # https://github.com/Novage/p2p-media-loader/blob/fe59c09e8226687f0478836becdaf2bbb39c10ba/packages/p2p-media-loader-core/src/utils/peer.ts#L12 python -c " from glob import glob +from syslog import syslog import base64, hashlib, os, tempfile, tomllib location = '/var/www/' config = tomllib.load(open('${CONFIG_FILE}', 'rb')) output = config['access_list']['path'] + +syslog('aquatic_ws: generating info hashes') with tempfile.NamedTemporaryFile(delete=False, dir=os.path.dirname(output), mode='wt') as temp: for i in glob('%s/*/*/main.m3u8' % location): def write_hashes(n, stream_type): for index in range(n): stream_swarm_id = b'v2-https://%s-%s-%d' % (i.replace(location, '').encode('utf-8'), stream_type, index) - item = base64.b64encode(hashlib.md5(stream_swarm_id).digest()[1:]).hex() + raw_item = base64.b64encode(hashlib.md5(stream_swarm_id).digest()[1:]) + item = raw_item.hex() + syslog('aquatic_ws: %s %s %s' % (stream_swarm_id, raw_item, item)) temp.write(item + '\\n') - parent_dir = os.path.dirname(i) - main_streams = glob('%s/*/video.m3u8' % parent_dir) - secondary_streams = glob('%s/*/audio.m3u8' % parent_dir) - write_hashes(len(main_streams), b'main') - write_hashes(len(secondary_streams), b'secondary') + with open(i) as p: + playlist = p.readlines() + main_streams = sum(1 for i in playlist if i.startswith('#EXT-X-STREAM-INF')) + secondary_streams = sum(1 for i in playlist if i.startswith('#EXT-X-MEDIA:TYPE=AUDIO')) + write_hashes(main_streams, b'main') + write_hashes(secondary_streams, b'secondary') temp.close() os.chmod(temp.name, 0o644) os.replace(temp.name, output)" diff --git a/_hosts/media.codonaft/etc/nginx/http.d/media.conf b/_hosts/media.codonaft/etc/nginx/http.d/media.conf index b8d3b81..d7cdef5 100644 --- a/_hosts/media.codonaft/etc/nginx/http.d/media.conf +++ b/_hosts/media.codonaft/etc/nginx/http.d/media.conf @@ -10,19 +10,6 @@ map $origin_allowed $origin { 1 $http_origin; } -server { - listen 80; - listen [::]:80; - - server_name media.codonaft.com; - - location / { - add_header Cache-Control "public, max-age=7200"; - expires 2h; - return 301 https://$host$request_uri; - } -} - server { listen 443 ssl; listen [::]:443 ssl; @@ -42,7 +29,9 @@ server { # #add_header X-Early-Data $tls1_3_early_data; # Debug 0-RTT # add_header x-frame-options "deny"; - server_name media.codonaft.com; + include /etc/nginx/cloudflare.conf; + + server_name media.codonaft.com media-cached.codonaft.com; ssl_certificate /etc/nginx/ssl/codonaft.com/fullchain.pem; ssl_certificate_key /etc/nginx/ssl/codonaft.com/privkey.pem; ssl_trusted_certificate /etc/nginx/ssl/codonaft.com/chain.pem; @@ -75,6 +64,7 @@ server { # 4 hours, for testing add_header Cache-Control "public, max-age=14400, immutable"; + #add_header Cache-Control "public, max-age=14400, must-revalidate"; expires 4h; # TODO: 1 year diff --git a/_hosts/media.codonaft/etc/nginx/http.d/omv.conf b/_hosts/media.codonaft/etc/nginx/http.d/omv.conf index 2c9e872..ef4cceb 100644 --- a/_hosts/media.codonaft/etc/nginx/http.d/omv.conf +++ b/_hosts/media.codonaft/etc/nginx/http.d/omv.conf @@ -2,6 +2,8 @@ server { listen 80; listen [::]:80; + include /etc/nginx/cloudflare.conf; + server_name omv.codonaft.com; location / { @@ -16,6 +18,8 @@ server { listen [::]:443 ssl; http2 on; + include /etc/nginx/cloudflare.conf; + server_name omv.codonaft.com; ssl_certificate /etc/nginx/ssl/codonaft.com/fullchain.pem; ssl_certificate_key /etc/nginx/ssl/codonaft.com/privkey.pem; diff --git a/_includes/head.html b/_includes/head.html index 9256086..e118ba5 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -80,12 +80,15 @@ import '/assets/js/vendor/vidstack-player/vidstack.js'; const pageLog = text => { - if (window.location.pathname !== '/ru/video-test/') return; - const p = document.createElement('p'); - p.textContent = text; - p.style.color = 'green' - p.style.fontWeight = '800'; - document.body.appendChild(p); + if (window.location.pathname === '/ru/video-test/') { + const p = document.createElement('p'); + p.textContent = text; + p.style.color = 'green' + p.style.fontWeight = '800'; + document.body.appendChild(p); + } else { + console.log(text); + } }; const codecSupported = codec => @@ -149,7 +152,7 @@ const loadChapters = (player, playerIndex) => { const duration = player.duration; - const element = document.querySelector(`.p2p-player-chapters[data-stream-url="${player.getAttribute('src')}"]`); + const element = player.parentElement.parentElement.querySelector('.p2p-player-chapters'); if (!element) return; const lines = element @@ -218,8 +221,36 @@ loadChapters(player, playerIndex); }; + let lastFailureTime = 0; + let mediaSourceSelectionAttempt = 0; + let aborted = false; + const fallback = player => { + if (player.state.playing) { + player.setAttribute('autoplay', true); + } + + const now = Date.now(); + if (now - lastFailureTime < 5000 || (!player.state.waiting && !aborted)) { + return; + } + lastFailureTime = now; + + setTimeout(() => fallback(player), 6000); + + const source = new URL(player.getAttribute('src')); + const mediaUrls = {{ site.theme_settings.p2p_player.media_urls | jsonify }}; + + mediaSourceSelectionAttempt++; + source.hostname = new URL(mediaUrls[mediaSourceSelectionAttempt % mediaUrls.length]).hostname; + + player.setAttribute('src', source.toString()); + pageLog('new source ' + player.getAttribute('src') + ' attempt=' + mediaSourceSelectionAttempt); + }; + const initializePlayer = (player, playerIndex, currentTime, autoPlay) => { pageLog(`initializePlayer ${playerIndex}`); + const swarmId = new URL(player.getAttribute('src')); + const videoLayout = player.querySelector('media-video-layout'); const poster = player.querySelector("media-poster"); @@ -297,18 +328,46 @@ }); } - player.addEventListener('stalled', event => { - pageLog('stalled'); + for (const i of ['abort', 'audio-gain-change', 'audio-track-change', 'audio-tracks-change', 'auto-play', 'auto-play-change', 'auto-play-fail', 'can-load', 'can-load-poster', 'can-play', 'can-play-through', 'controls-change', 'destroy', 'duration-change', 'emptied', 'end', 'ended', 'error', 'fullscreen-change', 'fullscreen-error', 'live-change', 'live-edge-change', 'load-start', 'loaded-data', 'loaded-metadata', 'loop-change', 'media-airplay-request', 'media-audio-gain-change-request', 'media-audio-track-change-request', 'media-clip-end-change-request', 'media-clip-start-change-request', 'media-duration-change-request', 'media-enter-fullscreen-request', 'media-enter-pip-request', 'media-exit-fullscreen-request', 'media-exit-pip-request', 'media-google-cast-request', 'media-live-edge-request', 'media-mute-request', 'media-orientation-lock-request', 'media-orientation-unlock-request', 'media-pause-controls-request', 'media-pause-request', 'media-play-request', 'media-player-connect', 'media-poster-start-loading', 'media-quality-change-request', 'media-rate-change-request', 'media-resume-controls-request', 'media-seek-request', 'media-seeking-request', 'media-start-loading', 'media-text-track-change-request', 'media-type-change', 'media-unmute-request', 'media-user-loop-change-request', 'media-volume-change-request', 'orientation-change', 'pause', 'picture-in-picture-change', 'picture-in-picture-error', 'play', 'play-fail', 'playing', 'plays-inline-change', 'poster-change', 'progress', 'provider-change', 'provider-loader-change', 'provider-setup', 'qualities-change', 'quality-change', 'rate-change', 'remote-playback-change', 'replay', 'seeked', 'seeking', 'stalled', 'started', 'stream-type-change', 'suspend', 'text-track-change', 'text-tracks-change', 'title-change', 'vds-log', 'video-presentation-change', 'view-type-change', 'volume-change']) { + player.addEventListener(i, event => { + pageLog(i); + }); + } + + player.addEventListener('abort', event => { + aborted = true; + fallback(player) + }); + + player.addEventListener('can-play', event => { + aborted = false; + }); + + player.addEventListener('source-change', event => { + pageLog('source-change' + JSON.stringify(event.detail)); + }); + + player.addEventListener('sources-change', event => { + pageLog('sources-change' + JSON.stringify(event.detail)); + }); + + player.addEventListener('error', event => { + pageLog('error ' + JSON.stringify(event.detail)); + if (event.detail['code'] === 1) { + fallback(player); + } }); player.addEventListener("provider-change", event => { const provider = event.detail; if (provider?.type === 'hls') { + pageLog('swarmId ' + swarmId); + provider.library = HlsWithP2P; provider.config = { p2p: { core: { - // swarmId: player.getAttribute('src'), + // swarmId: swarmId.toString(), // isP2PDisabled: false, // simultaneousHttpDownloads: 2, // simultaneousP2PDownloads: 3, @@ -324,15 +383,21 @@ p2pErrorRetries: Infinity, announceTrackers: {{ site.theme_settings.p2p_player.trackers | jsonify }}, rtcConfig: { iceServers: {{ site.theme_settings.p2p_player.ice_servers | jsonify }}.map(urls => { return { urls }; }) }, + mainStream: { + swarmId: swarmId.toString(), + }, + secondaryStream: { + swarmId: swarmId.toString(), + }, }, onHlsJsCreated: (hls) => { - hls.p2pEngine.addEventListener('onPeerConnect', (params) => { + hls.p2pEngine.addEventListener('onPeerConnect', params => { pageLog('Peer connected:' + params.peerId); }); - hls.p2pEngine.addEventListener('onPeerError', (params) => { + hls.p2pEngine.addEventListener('onPeerError', params => { pageLog('Peer error:' + params.peerId); }); - hls.p2pEngine.addEventListener('onPeerClose', (params) => { + hls.p2pEngine.addEventListener('onPeerClose', params => { pageLog('Peer disconnected:' + params.peerId); }); hls.p2pEngine.addEventListener('onChunkDownloaded', (bytesLength, downloadSource, peerId) => { @@ -343,20 +408,24 @@ hls.p2pEngine.addEventListener('onChunkUploaded', (bytesLength, peerId) => { pageLog('Peer UPdownload:' + bytesLength + ' ' + peerId); }); - hls.p2pEngine.addEventListener('onSegmentLoaded', (params) => { + hls.p2pEngine.addEventListener('onSegmentLoaded', params => { if (params.peerId) { pageLog('P2P Segment loaded:' + params.bytesLength); } }); - hls.p2pEngine.addEventListener('onSegmentError', (params) => { + hls.p2pEngine.addEventListener('onSegmentError', params => { pageLog('ERROR loading segment:' + JSON.stringify(params)); + if (params && params['downloadSource'] === 'http' && params['error'] !== undefined && params['error']['type'] === 'bytes-receiving-timeout') { + pageLog('http timeout failure'); + fallback(player); + } }); - hls.on(Hls.Events.MANIFEST_PARSED, function (event, data) { + hls.on(Hls.Events.MANIFEST_PARSED, (event, data) => { console.log(data); pageLog('manifest loaded, found ' + data.levels.length + ' quality level'); }); - hls.on(Hls.Events.BUFFER_CREATED, function (event, data) { + hls.on(Hls.Events.BUFFER_CREATED, (event, data) => { pageLog('codec: ' + data.tracks.audiovideo.codec); }); // TODO: connectedPeerCount @@ -376,7 +445,7 @@ currentLocation.searchParams.delete('t'); history.replaceState(undefined, '', currentLocation.pathname + currentLocation.search); if (Hls?.isSupported()) { - console.log('hls is supported'); + pageLog('hls is supported'); let maybeAutoPlay = true; document .querySelectorAll('media-player') diff --git a/_includes/p2p_player.html b/_includes/p2p_player.html index d2951ca..19a4b2d 100644 --- a/_includes/p2p_player.html +++ b/_includes/p2p_player.html @@ -7,7 +7,7 @@ {% assign video_id = page.permalink | split: '/' | last %} {% endif %} - {% assign stream_url_prefix = site.theme_settings.p2p_player.media_url | append: '/' | append: video_id %} + {% assign stream_url_prefix = site.theme_settings.p2p_player.media_urls[0] | append: '/' | append: video_id %} {% assign stream_url = stream_url_prefix | append: "/main.m3u8" %} {% assign thumbnail_url = stream_url_prefix | append: "/thumbnail.webp" %} {% endif %} @@ -38,12 +38,12 @@ {% if include.chapters %} -
+
{{ include.chapters | strip | newline_to_br }}
{% endif %} {% if include.description %} -
+
{{ include.description | strip | markdownify }}
{% endif %} diff --git a/_includes/zapthreads.html b/_includes/zapthreads.html index 2a335a2..7b356ac 100644 --- a/_includes/zapthreads.html +++ b/_includes/zapthreads.html @@ -33,7 +33,7 @@

 Nostr Login

 Nostr Login

- `}function Wr(a){return m(()=>{const t=a==="mute"||a==="mute+volume",e=a==="volume"||a==="mute+volume";return h` + `}function Ur(a){return m(()=>{const t=a==="mute"||a==="mute+volume",e=a==="volume"||a==="mute+volume";return h`
- ${[t?Or():null,e?Ur():null]} + ${[t?Or():null,e?Wr():null]}
- `})}function Ur(){const{translations:a}=V(),t=R(a,"Volume");return h` + `})}function Wr(){const{translations:a}=V(),t=R(a,"Volume");return h`
@@ -708,7 +708,7 @@ import{u as I,c as rt,V as st,e as l,s as y,E as q,p as f,l as G,i as C,a as Y,b - `}function oo(a){return m(()=>a()?"true":"false")}function R(a,t){return m(()=>fe(a,t))}class lo extends T(ce,xr){static tagName="media-plyr-layout";#t;onSetup(){this.forwardKeepAlive=!1,this.#t=b()}onConnect(){this.#t.player.el?.setAttribute("data-layout","plyr"),P(()=>this.#t.player.el?.removeAttribute("data-layout")),Pr(this,this.#t),l(()=>{this.$props.customIcons()?new ze([this]).connect():new Er([this]).connect()})}render(){return m(this.#e.bind(this))}#e(){const{viewType:t}=this.#t.$state;return t()==="audio"?Ar():t()==="video"?Mr():null}}$(pr),$(kr),$(lo);function rs(a,t){const e=String(a),s=e.length;if(s=3600?rs(r,2):r,p=rs(o,2),v=i&&d>0?`.${String(d).replace(/^0?\./,"")}`:"",w=`${u}:${p}${v}`;return n>0||s?`${c}:${w}`:w}function ye(a){const t=[],{hours:e,minutes:s,seconds:i}=Ni(a);return e>0&&t.push(`${e} hour`),s>0&&t.push(`${s} min`),(i>0||t.length===0)&&t.push(`${i} sec`),t.join(" ")}class co extends k{static props={translations:null};static state=new ft({label:null,busy:!1});#t;#e=!1;onSetup(){this.#t=b()}onAttach(t){t.style.display="contents"}onConnect(t){t.setAttribute("data-media-announcer",""),L(t,"role","status"),L(t,"aria-live","polite");const{busy:e}=this.$state;this.setAttributes({"aria-busy":()=>e()?"true":null}),this.#e=!0,l(this.#s.bind(this)),l(this.#r.bind(this)),l(this.#n.bind(this)),l(this.#i.bind(this)),l(this.#a.bind(this)),l(this.#c.bind(this)),l(this.#h.bind(this)),dt(),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()?"Fullscreen":"Exit Fullscreen")}#a(){const{pictureInPicture:t}=this.#t.$state;this.#d(t()?"Picture-in-Picture":"Exit Picture-in-Picture")}#n(){const{textTrack:t}=this.#t.$state;this.#d(t()?"Subtitles On":"Subtitles 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 i=f(e),n=Math.abs(i-this.#o);if(n>=1){const r=i>=this.#o,o=ye(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 i=window.setTimeout(()=>void e.set(!1),150);return this.el&&g(this.el,"aria-label",s),C(s)&&this.dispatch("change",{detail:s}),()=>window.clearTimeout(i)}#d(t){const{label:e}=this.$state;e.set(t)}}class uo extends T(HTMLElement,co){static tagName="media-announcer"}class ho extends st{#t;constructor(t){super(),this.#t=t}onAttach(t){const{$props:e,ariaKeys:s}=b(),i=t.getAttribute("aria-keyshortcuts");if(i){s[this.#t]=i,P(()=>{delete s[this.#t]});return}const n=e.keyShortcuts()[this.#t];if(n){const r=Y(n)?n.join(" "):C(n)?n:n?.keys;t.setAttribute("aria-keyshortcuts",Y(r)?r.join(" "):r)}}}class j extends st{static props={disabled:!1};#t;constructor(t){super(),this.#t=t,new at,t.keyShortcut&&new ho(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){L(t,"tabindex","0"),L(t,"role","button"),L(t,"type","button")}onConnect(t){const e=bt(t,this.#i.bind(this));for(const s of["click","touchstart"])e.add(s,this.#a.bind(this),{passive:!0})}#e(){return ie(this.#t.isPresssed())}#s(t){$a(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 po extends k{static props=j.props;#t;constructor(){super(),new j({isPresssed:this.#s.bind(this),onPress:this.#e.bind(this)})}onSetup(){this.#t=b();const{canAirPlay:t,isAirPlayConnected:e}=this.#t.$state;this.setAttributes({"data-active":e,"data-supported":t,"data-state":this.#i.bind(this),"aria-hidden":W(()=>!t())})}onAttach(t){t.setAttribute("data-media-tooltip","airplay"),gt(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 mo extends T(HTMLElement,po){static tagName="media-airplay-button"}class fo extends k{static props=j.props;#t;constructor(){super(),new j({isPresssed:this.#s.bind(this),keyShortcut:"toggleCaptions",onPress:this.#e.bind(this)})}onSetup(){this.#t=b(),this.setAttributes({"data-active":this.#s.bind(this),"data-supported":()=>!this.#i(),"aria-hidden":W(this.#i.bind(this))})}onAttach(t){t.setAttribute("data-media-tooltip","caption"),gt(t,"Subtitles")}#e(t){this.#t.remote.toggleCaptions(t)}#s(){const{textTrack:t}=this.#t.$state,e=t();return!!e&&U(e)}#i(){const{hasCaptions:t}=this.#t.$state;return!t()}}class go extends T(HTMLElement,fo){static tagName="media-caption-button"}class bo extends k{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=b();const{fullscreen:t}=this.#t.$state,e=this.#i.bind(this);this.setAttributes({"data-active":t,"data-supported":e,"aria-hidden":W(()=>!e())})}onAttach(t){t.setAttribute("data-media-tooltip","fullscreen"),gt(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 yo extends T(HTMLElement,bo){static tagName="media-fullscreen-button"}class vo extends k{static props=j.props;#t;constructor(){super(),new j({isPresssed:this.#s.bind(this),onPress:this.#e.bind(this)})}onSetup(){this.#t=b();const{canGoogleCast:t,isGoogleCastConnected:e}=this.#t.$state;this.setAttributes({"data-active":e,"data-supported":t,"data-state":this.#i.bind(this),"aria-hidden":W(()=>!t())})}onAttach(t){t.setAttribute("data-media-tooltip","google-cast"),gt(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 $o extends T(HTMLElement,vo){static tagName="media-google-cast-button"}class wo extends k{static props={disabled:!1};#t;constructor(){super(),new at}onSetup(){this.#t=b();const{disabled:t}=this.$props,{live:e,liveEdge:s}=this.#t.$state,i=()=>!e();this.setAttributes({"data-edge":s,"data-hidden":i,"aria-disabled":W(()=>t()||s()),"aria-hidden":W(i)})}onAttach(t){L(t,"tabindex","0"),L(t,"role","button"),L(t,"type","button"),t.setAttribute("data-media-tooltip","live")}onConnect(t){bt(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 To extends T(HTMLElement,wo){static tagName="media-live-button"}class ko extends k{static props=j.props;#t;constructor(){super(),new j({isPresssed:this.#s.bind(this),keyShortcut:"toggleMuted",onPress:this.#e.bind(this)})}onSetup(){this.#t=b(),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"),gt(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 So extends T(HTMLElement,ko){static tagName="media-mute-button"}class xo extends k{static props=j.props;#t;constructor(){super(),new j({isPresssed:this.#s.bind(this),keyShortcut:"togglePictureInPicture",onPress:this.#e.bind(this)})}onSetup(){this.#t=b();const{pictureInPicture:t}=this.#t.$state,e=this.#i.bind(this);this.setAttributes({"data-active":t,"data-supported":e,"aria-hidden":W(()=>!e())})}onAttach(t){t.setAttribute("data-media-tooltip","pip"),gt(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 Po extends T(HTMLElement,xo){static tagName="media-pip-button"}class Co extends k{static props=j.props;#t;constructor(){super(),new j({isPresssed:this.#s.bind(this),keyShortcut:"togglePaused",onPress:this.#e.bind(this)})}onSetup(){this.#t=b();const{paused:t,ended:e}=this.#t.$state;this.setAttributes({"data-paused":t,"data-ended":e})}onAttach(t){t.setAttribute("data-media-tooltip","play"),gt(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 Eo extends T(HTMLElement,Co){static tagName="media-play-button"}class Ao extends k{static props={disabled:!1,seconds:30};#t;constructor(){super(),new at}onSetup(){this.#t=b();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":W(()=>!s())})}onAttach(t){L(t,"tabindex","0"),L(t,"role","button"),L(t,"type","button"),t.setAttribute("data-media-tooltip","seek"),gt(t,this.#s.bind(this))}onConnect(t){bt(t,this.#i.bind(this))}#e(){const{canSeek:t}=this.#t.$state;return t()}#s(){const{seconds:t}=this.$props;return`Seek ${t()>0?"forward":"backward"} ${t()} seconds`}#i(t){const{seconds:e,disabled:s}=this.$props;if(s())return;const{currentTime:i}=this.#t.$state,n=i()+e();this.#t.remote.seek(n,t)}}class Mo extends T(HTMLElement,Ao){static tagName="media-seek-button"}class Fi extends k{static props={disabled:!1,defaultPressed:!1};#t=y(!1);get pressed(){return this.#t()}constructor(){super(),new j({isPresssed:this.#t})}}const Lo=Fi.prototype;x(Lo,"pressed");class qo extends T(HTMLElement,Fi){static tagName="media-toggle-button"}class _o{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 q(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 vt extends k{static props={textDir:"ltr",exampleText:"Captions look like this."};#t;static lib=y(null);onSetup(){this.#t=b(),this.setAttributes({"aria-hidden":W(this.#e.bind(this))})}onAttach(t){t.style.setProperty("pointer-events","none")}onConnect(t){vt.lib()||import("/assets/js/vendor/media-captions/prod.js").then(e=>vt.lib.set(e)),l(this.#s.bind(this))}#e(){const{textTrack:t,remotePlaybackState:e,iOSControls:s}=this.#t.$state,i=t();return s()||e()==="connected"||!i||!U(i)}#s(){if(!vt.lib())return;const{viewType:t}=this.#t.$state;return t()==="audio"?this.#i():this.#o()}#i(){return l(this.#a.bind(this)),this.#u(null),()=>{this.el.textContent=""}}#a(){if(this.#e())return;this.#n();const{textTrack:t}=this.#t.$state;G(t(),"cue-change",this.#n.bind(this)),l(this.#r.bind(this))}#n(){this.el.textContent="",this.#p>=0&&this.#b();const{realCurrentTime:t,textTrack:e}=this.#t.$state,{renderVTTCueString:s}=vt.lib(),i=f(t),n=f(e).activeCues;for(const r of n){const o=this.#g(),d=this.#y();d.innerHTML=s(r,i),o.append(d),this.el.append(d)}}#r(){const{realCurrentTime:t}=this.#t.$state,{updateTimedVTTCueNodes:e}=vt.lib();e(this.el,t())}#o(){const{CaptionsRenderer:t}=vt.lib(),e=new t(this.el),s=new _o(e);return this.#t.textRenderers.add(s),l(this.#l.bind(this,e)),l(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);G(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();g(t,"data-example","");const e=this.#y();g(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 g(t,"data-part","cue-display"),t}#y(){const t=document.createElement("div");return g(t,"data-part","cue"),t}}class Do extends T(HTMLElement,vt){static tagName="media-captions"}class Io extends k{static props={defaultText:""}}class Vo extends T(HTMLElement,Io){static tagName="media-chapter-title";#t;#e;onSetup(){this.#t=b(),this.#e=y("")}onConnect(){const t=this.#t.textTracks;Oa(t,"chapters",this.#e.set),l(this.#s.bind(this))}#s(){const{defaultText:t}=this.$props;this.textContent=this.#e()||t()}}class Ro extends k{static props={hideDelay:1e3,hideOnMouseLeave:!1};#t;onSetup(){this.#t=b(),l(this.#s.bind(this))}onAttach(t){const{pictureInPicture:e,fullscreen:s}=this.#t.$state;Z(t,"pointer-events","none"),L(t,"role","group"),this.setAttributes({"data-visible":this.#i.bind(this),"data-fullscreen":s,"data-pip":e}),l(()=>{this.dispatch("change",{detail:this.#i()})}),l(this.#e.bind(this)),l(()=>{const i=s();for(const n of["top","right","bottom","left"])Z(t,`padding-${n}`,i&&`env(safe-area-inset-${n})`)})}#e(){if(!this.el)return;const{nativeControls:t}=this.#t.$state,e=t();g(this.el,"aria-hidden",e?"true":null),Z(this.el,"display",e?"none":null)}#s(){const{controls:t}=this.#t.player,{hideDelay:e,hideOnMouseLeave:s}=this.$props;t.defaultDelay=e()===1e3?this.#t.$props.controlsDelay():e(),t.hideOnMouseLeave=s()}#i(){const{controlsVisible:t}=this.#t.$state;return t()}}class Oo extends T(HTMLElement,Ro){static tagName="media-controls"}class No extends k{onAttach(t){t.style.pointerEvents||Z(t,"pointer-events","auto")}}class Fo extends T(HTMLElement,No){static tagName="media-controls-group"}class Ho extends k{static props={disabled:!1,event:void 0,action:void 0};#t;#e=null;onSetup(){this.#t=b();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]"),l(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"),G(this.#e,t,this.#n.bind(this),{passive:!1}))}#i=0;#a=-1;#n(t){if(this.$props.disabled()||Es(t)&&(t.button!==0||this.#t.activeMenu)||Jt(t)&&this.#t.activeMenu||Ne(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(Es(t)||wa(t)||Jt(t)){const e=Jt(t)?t.changedTouches[0]??t.touches[0]:void 0,s=e?.clientX??t.clientX,i=e?.clientY??t.clientY,n=this.el.getBoundingClientRect(),r=i>=n.top&&i<=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 K("will-trigger",{detail:t,cancelable:!0,trigger:e});if(this.dispatchEvent(s),s.defaultPrevented)return;const[i,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[Ta(i)](e),this.dispatch("trigger",{detail:t,trigger:e})}}class Bo extends T(HTMLElement,Ho){static tagName="media-gesture"}class Go extends k{static props={when:!1}}class Ko extends T(HTMLElement,Go){static tagName="media-layout";#t;onSetup(){this.#t=b()}onConnect(){l(this.#e.bind(this))}#e(){const t=this.firstElementChild,e=t?.localName==="template",s=this.$props.when();if(!(xs(s)?s:_(()=>s(this.#t.player.state))())){e?(this.textContent="",this.appendChild(t)):yt(t)&&(t.style.display="none");return}e?this.append(t.content.cloneNode(!0)):yt(t)&&(t.style.display="")}}const B=rt(),os=rt();class Pt extends st{#t=new Set;#e=y("");#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(){X(os,{add:this.#i.bind(this),remove:this.#a.bind(this)})}onAttach(t){J(B)||L(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 i=this.#o(s),n=this.#o(t);i?.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 Wo=[1,1.25,1.5,1.75,2,2.5,3,4];class Hi extends k{static props={normalLabel:"Disabled",gains:Wo};#t;#e;#s;get value(){return this.#s.value}get disabled(){const{gains:t}=this.$props,{canSetAudioGain:e}=this.#t.$state;return!e()||t().length===0}constructor(){super(),this.#s=new Pt,this.#s.onValueChange=this.#o.bind(this)}onSetup(){this.#t=b(),J(B)&&(this.#e=I(B))}onConnect(t){l(this.#i.bind(this)),l(this.#a.bind(this)),l(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 ls=Hi.prototype;x(ls,"value"),x(ls,"disabled"),O(ls,"getOptions");function qt(a,t){ht(()=>{if(!a.connectScope)return;const e=a.querySelector("template");e&&l(()=>{const s=a.getOptions();Fe(e,s.length,(i,n)=>{const{label:r,value:o}=s[n],d=i.querySelector('[data-part="label"]');i.setAttribute("value",o),d&&(C(r)?d.textContent=r:l(()=>{d.textContent=r()})),t?.(i,s[n],n)})})})}class Uo extends T(HTMLElement,Hi){static tagName="media-audio-gain-radio-group";onConnect(){qt(this)}}class Bi extends k{static props={emptyLabel:"Default"};#t;#e;#s;get value(){return this.#s.value}get disabled(){const{audioTracks:t}=this.#e.$state;return t().length<=1}constructor(){super(),this.#s=new Pt,this.#s.onValueChange=this.#o.bind(this)}onSetup(){this.#e=b(),J(B)&&(this.#t=I(B))}onConnect(t){l(this.#i.bind(this)),l(this.#n.bind(this)),l(this.#a.bind(this))}getOptions(){const{audioTracks:t}=this.#e.$state;return t().map(e=>({track:e,label:e.label,value:e.label.toLowerCase()}))}#i(){this.#s.value=this.#r()}#a(){const{emptyLabel:t}=this.$props,{audioTrack:e}=this.#e.$state,s=e();this.#t?.hint.set(s?.label??t())}#n(){this.#t?.disable(this.disabled)}#r(){const{audioTrack:t}=this.#e.$state,e=t();return e?e.label.toLowerCase():""}#o(t,e){if(this.disabled)return;const s=this.#e.audioTracks.toArray().findIndex(i=>i.label.toLowerCase()===t);if(s>=0){const i=this.#e.audioTracks[s];this.#e.remote.changeAudioTrack(s,e),this.dispatch("change",{detail:i,trigger:e})}}}const ds=Bi.prototype;x(ds,"value"),x(ds,"disabled"),O(ds,"getOptions");class Qo extends T(HTMLElement,Bi){static tagName="media-audio-radio-group";onConnect(){qt(this)}}class Gi extends k{static props={offLabel:"Off"};#t;#e;#s;get value(){return this.#s.value}get disabled(){const{hasCaptions:t}=this.#t.$state;return!t()}constructor(){super(),this.#s=new Pt,this.#s.onValueChange=this.#o.bind(this)}onSetup(){this.#t=b(),J(B)&&(this.#e=I(B))}onConnect(t){super.onConnect?.(t),l(this.#i.bind(this)),l(this.#n.bind(this)),l(this.#a.bind(this))}getOptions(){const{offLabel:t}=this.$props,{textTracks:e}=this.#t.$state;return[{value:"off",label:t},...e().filter(U).map(s=>({track:s,label:s.label,value:this.#l(s)}))]}#i(){this.#s.value=this.#r()}#a(){const{offLabel:t}=this.$props,{textTrack:e}=this.#t.$state,s=e();this.#e?.hint.set(s&&U(s)&&s.mode==="showing"?s.label:t())}#n(){this.#e?.disable(this.disabled)}#r(){const{textTrack:t}=this.#t.$state,e=t();return e&&U(e)&&e.mode==="showing"?this.#l(e):"off"}#o(t,e){if(this.disabled)return;if(t==="off"){const i=this.#t.textTracks.selected;if(i){const n=this.#t.textTracks.indexOf(i);this.#t.remote.changeTextTrackMode(n,"disabled",e),this.dispatch("change",{detail:null,trigger:e})}return}const s=this.#t.textTracks.toArray().findIndex(i=>this.#l(i)===t);if(s>=0){const i=this.#t.textTracks[s];this.#t.remote.changeTextTrackMode(s,"showing",e),this.dispatch("change",{detail:i,trigger:e})}}#l(t){return t.id+":"+t.kind+"-"+t.label.toLowerCase()}}const cs=Gi.prototype;x(cs,"value"),x(cs,"disabled"),O(cs,"getOptions");class zo extends T(HTMLElement,Gi){static tagName="media-captions-radio-group";onConnect(){qt(this)}}var jo=Object.defineProperty,Yo=Object.getOwnPropertyDescriptor,us=(a,t,e,s)=>{for(var i=Yo(t,e),n=a.length-1,r;n>=0;n--)(r=a[n])&&(i=r(t,e,i)||i);return i&&jo(t,e,i),i};class ve extends k{static props={thumbnails:null};#t;#e;#s;#i=y(null);#a=y([]);get value(){return this.#s.value}get disabled(){return!this.#a()?.length}constructor(){super(),this.#s=new Pt,this.#s.onValueChange=this.#u.bind(this)}onSetup(){this.#t=b(),J(B)&&(this.#e=I(B));const{thumbnails:t}=this.$props;this.setAttributes({"data-thumbnails":()=>!!t()})}onAttach(t){this.#e?.attachObserver({onOpen:this.#n.bind(this)})}getOptions(){const{seekableStart:t,seekableEnd:e}=this.#t.$state,s=t(),i=e();return this.#a().map((n,r)=>({cue:n,value:r.toString(),label:n.text,startTime:be(Math.max(0,n.startTime-s)),duration:ye(Math.min(i,n.endTime)-Math.max(s,n.startTime))}))}#n(){f(()=>this.#l())}onConnect(t){l(this.#l.bind(this)),l(this.#c.bind(this)),l(this.#r.bind(this)),re(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 q(t).add("add-cue",e).add("remove-cue",e),()=>{this.#a.set([])}}#o(t){const{seekableStart:e,seekableEnd:s}=this.#t.$state,i=e(),n=s();this.#a.set([...t.cues].filter(r=>r.startTime<=n&&r.endTime>=i))}#l(){if(!this.#e?.expanded())return;if(!this.#i()){this.#s.value="-1";return}const{realCurrentTime:e,seekableStart:s,seekableEnd:i}=this.#t.$state,n=s(),r=i(),o=e(),d=this.#a().findIndex(c=>Na(c,o));this.#s.value=d.toString(),d>=0&&ht(()=>{if(!this.connectScope)return;const c=this.#a()[d],u=this.el.querySelector("[aria-checked='true']"),p=Math.max(n,c.startTime),v=Math.min(r,c.endTime)-p,w=Math.max(0,o-p)/v*100;u&&Z(u,"--progress",H(w,3)+"%")})}#c(){this.#e?.disable(this.disabled)}#u(t,e){if(this.disabled||!e)return;const s=+t,i=this.#a(),{clipStartTime:n}=this.#t.$state;ot(s)&&i?.[s]&&(this.#s.value=s.toString(),this.#t.remote.seek(i[s].startTime-n(),e),this.dispatch("change",{detail:i[s],trigger:e}))}}us([x],ve.prototype,"value"),us([x],ve.prototype,"disabled"),us([O],ve.prototype,"getOptions");class Xo extends T(HTMLElement,ve){static tagName="media-chapters-radio-group";onConnect(){qt(this,(t,e)=>{const{cue:s,startTime:i,duration:n}=e,r=t.querySelector(".vds-thumbnail,media-thumbnail"),o=t.querySelector('[data-part="start-time"]'),d=t.querySelector('[data-part="duration"]');o&&(o.textContent=i),d&&(d.textContent=n),r&&(r.setAttribute("time",s.startTime+""),l(()=>{const c=this.$props.thumbnails();"src"in r?r.src=c:C(c)&&r.setAttribute("src",c)}))})}}class hs extends k{static props={disabled:!1};#t;#e=y(null);get expanded(){return this.#t?.expanded()??!1}constructor(){super(),new at}onSetup(){this.#t=I(B)}onAttach(t){this.#t.attachMenuButton(this),l(this.#s.bind(this)),L(t,"type","button")}onConnect(t){l(this.#i.bind(this)),this.#a();const e=new MutationObserver(this.#a.bind(this));e.observe(t,{attributeFilter:["data-part"],childList:!0,subtree:!0}),P(()=>e.disconnect()),bt(t,s=>{this.dispatch("select",{trigger:s})})}#s(){this.#t.disableMenuButton(this.$props.disabled())}#i(){const t=this.#e();t&&l(()=>{const e=this.#t.hint();e&&(t.textContent=e)})}#a(){const t=this.el?.querySelector('[data-part="hint"]');this.#e.set(t??null)}}const Jo=hs.prototype;x(Jo,"expanded");class Zo extends T(HTMLElement,hs){static tagName="media-menu-button"}class Ki extends st{#t;constructor(t){super(),this.#t=t,l(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(rn(e)){this.#a?.();const n=G(e,"animationend",s,{once:!0});this.#a=n}else s()}})}#n(){window.clearTimeout(this.#s),this.#s=-1}}const ps=rt(),Ut=rt();function tl(a,t){const e=ka(a,t);for(const{el:s,top:i,left:n}of e)s.scroll({top:i,left:n,behavior:t.behavior})}function el(a,t={}){tl(a,{scrollMode:"if-needed",block:"center",inline:"center",...t})}const sl=["a[href]","[tabindex]","input","select","button"].map(a=>`${a}:not([aria-hidden='true'])`).join(","),il=new Set(["Escape","Tab","ArrowUp","ArrowDown","Home","PageUp","End","PageDown","Enter"," "]);class al{#t=-1;#e=null;#s=[];#i;get items(){return this.#s}constructor(t){this.#i=t}attachMenu(t){G(t,"focus",this.#r.bind(this)),this.#e=t,P(()=>{this.#e=null})}listen(){this.#e&&(this.update(),new q(this.#e).add("keyup",this.#l.bind(this)).add("keydown",this.#c.bind(this)),P(()=>{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(()=>{el(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(Sa(t)&&e instanceof Element){const s=e.getAttribute("role");return!/a|input|select|button/.test(e.localName)&&!s}return il.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(sl),e=[],s=i=>i.getAttribute("role")==="menu";for(const i of t)yt(i)&&i.offsetParent!==null&&js(this.#e,i,s)&&e.push(i);return e}}var nl=Object.defineProperty,rl=Object.getOwnPropertyDescriptor,Qt=(a,t,e,s)=>{for(var i=rl(t,e),n=a.length-1,r;n>=0;n--)(r=a[n])&&(i=r(t,e,i)||i);return i&&nl(t,e,i),i};let ol=0;class _t extends k{static props={showDelay:0};#t;#e;#s;#i=y(!1);#a=y(!1);#n=y(null);#r=y(null);#o;#l=new Set;#c=null;#u;#h;#d=!1;#p=y(!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 Ki({trigger:this.#n,content:this.#r,showDelay:t,listen:(e,s,i)=>{bt(e,r=>{this.#i()?i(r):s(r)});const n=this.#M();n&&bt(n,r=>{r.stopPropagation(),i(r)})},onChange:this.#T.bind(this)})}onSetup(){this.#t=b();const t=++ol;this.#e=`media-menu-${t}`,this.#s=`media-menu-button-${t}`,this.#h=new al({closeMenu:this.close.bind(this)}),J(B)&&(this.#o=I(B)),this.#b(),this.setAttributes({"data-open":this.#i,"data-root":!this.isSubmenu,"data-submenu":this.isSubmenu,"data-disabled":this.#P.bind(this)}),X(B,{button:this.#n,content:this.#r,expanded:this.#i,hint:y(""),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.#D.bind(this),onTransitionEvent:e=>{this.#m.add(e),P(()=>{this.#m.delete(e)})}})}onAttach(t){t.style.setProperty("display","contents")}onConnect(t){l(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=J(Ut)?I(Ut):null;X(Ut,{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.#O(),this.#v(t),t&&(l(()=>{const{height:e}=this.#t.$state,s=this.#r();s&&Z(s,"--player-height",e()+"px")}),this.#h.listen(),this.listen("pointerup",this.#A.bind(this)),G(window,"pointerup",this.#C.bind(this)))}#y(t){const e=t.el,s=this.isSubmenu,i=W(this.#P.bind(this));L(e,"tabindex",s?"-1":"0"),L(e,"role",s?"menuitem":"button"),g(e,"id",this.#s),g(e,"aria-haspopup","menu"),g(e,"aria-expanded","false"),g(e,"data-root",!this.isSubmenu),g(e,"data-submenu",this.isSubmenu),l(()=>{g(e,"data-open",this.#i()),g(e,"aria-disabled",i())}),this.#n.set(e),P(()=>{this.#n.set(null)})}#$(t){const e=t.el;e.style.setProperty("display","none"),g(e,"id",this.#e),L(e,"role","menu"),L(e,"tabindex","-1"),g(e,"data-root",!this.isSubmenu),g(e,"data-submenu",this.isSubmenu),this.#r.set(e),P(()=>this.#r.set(null)),l(()=>g(e,"data-open",this.#i())),this.#h.attachMenu(e),this.#v(!1);const i=this.#B.bind(this);this.isSubmenu?this.#o?.onTransitionEvent(i):(t.listen("transitionstart",i),t.listen("transitionend",i),t.listen("animationend",this.#O),t.listen("vds-menu-resize",this.#O))}#w(t){this.#c=t}#v(t){const e=f(this.#r);e&&g(e,"aria-hidden",ie(!t))}#x(t){this.#p.set(t)}#f=!1;#T(t,e){if(this.#f=Zt(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(),i=this.#r();if(s&&(g(s,"aria-controls",t&&this.#e),g(s,"aria-expanded",ie(t))),i&&g(i,"aria-labelledby",t&&this.#s),this.#i.set(t),this.#q(e),dt(),this.#f){t?i?.focus():s?.focus();for(const n of[this.el,i])n&&n.setAttribute("data-keyboard","")}else for(const n of[this.el,i])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&&Us(e,t)||t.stopPropagation()}#C(t){const e=this.#r();this.#d||e&&Us(e,t)||this.close(t)}#M(){const t=this.el?.querySelector('[data-part="close-target"]');return this.el&&t&&js(this.el,t,e=>e.getAttribute("role")==="menu")?t:null}#q(t){this.isSubmenu||(this.#i()?this.#t.remote.pauseControls(t):this.#t.remote.resumeControls(t))}#D(t){this.#l.add(t),new q(t).add("open",this.#R).add("close",this.#F),P(this.#_)}#_=this.#V.bind(this);#V(t){this.#l.delete(t)}#L=!1;#R=this.#I.bind(this);#I(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 i of[s.el,s.triggerElement])i?.setAttribute("aria-hidden","true");if(e){const s=t.target.el;for(const i of e.children)i.contains(s)?i.setAttribute("data-open",""):i!==s&&i.setAttribute("data-hidden","")}}#F=this.#H.bind(this);#H(t){this.#L=!1;const e=this.#r();this.isSubmenu&&this.triggerElement?.setAttribute("aria-hidden","false");for(const s of this.#l)for(const i of[s.el,s.triggerElement])i?.setAttribute("aria-hidden","false");if(e)for(const s of e.children)s.removeAttribute("data-open"),s.removeAttribute("data-hidden")}#O=ct(()=>{const t=f(this.#r);if(!t)return;let e=0,s=getComputedStyle(t),i=[...t.children];for(const n of["paddingTop","paddingBottom","borderTopWidth","borderBottomWidth"])e+=parseFloat(s[n])||0;for(const n of i)if(yt(n)&&n.style.display==="contents")i.push(...n.children);else if(n.nodeType===3)e+=parseFloat(getComputedStyle(n).fontSize);else if(yt(n)){if(!Qs(n))continue;const r=getComputedStyle(n);e+=n.offsetHeight+(parseFloat(r.marginTop)||0)+(parseFloat(r.marginBottom)||0)}Z(t,"--menu-height",e+"px")});#N=!1;#B(t){const e=this.#r();e&&t.propertyName==="height"&&(this.#N=t.type==="transitionstart",g(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),dt())}close(t){f(this.#i)&&(this.#u.hide(t),dt())}}Qt([x],_t.prototype,"triggerElement"),Qt([x],_t.prototype,"contentElement"),Qt([x],_t.prototype,"isSubmenu"),Qt([O],_t.prototype,"open"),Qt([O],_t.prototype,"close");class ll extends T(HTMLElement,_t){static tagName="media-menu"}class dl extends hs{}class cl extends T(HTMLElement,dl){static tagName="media-menu-item"}class ul extends k{static props={container:null,disabled:!1};#t=null;#e;onSetup(){this.#e=b(),X($e,{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,ht(()=>{ht(()=>{this.connectScope&&l(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;g(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 yt(t)?t:t?document.querySelector(t):document.body}}const $e=rt();class hl extends k{static props={placement:null,offset:0,alignOffset:0};#t;constructor(){super(),new at;const{placement:t}=this.$props;this.setAttributes({"data-placement":t})}onAttach(t){if(this.#t=I(B),this.#t.attachMenuItems(this),J($e)){const e=I($e);e&&(X($e,null),e.attach(t),P(()=>e.attach(null)))}}onConnect(t){l(this.#e.bind(this))}#e(){const{expanded:t}=this.#t;if(!this.el||!t())return;const e=this.$props.placement();if(!e)return;Object.assign(this.el.style,{position:"absolute",top:0,left:0,width:"max-content"});const{offset:s,alignOffset:i}=this.$props;P(Ys(this.el,this.#i(),e,{offsetVarName:"media-menu",xOffset:i(),yOffset:s()})),P(this.#s.bind(this))}#s(){this.el&&(this.el.removeAttribute("style"),this.el.style.display="none")}#i(){return this.#t.button()}}class pl extends T(HTMLElement,hl){static tagName="media-menu-items"}class ml extends T(HTMLElement,ul){static tagName="media-menu-portal";static attrs={disabled:{converter(t){return C(t)?t:t!==null}}}}class Wi extends k{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=_(()=>{const{sort:t}=this.$props,{qualities:e}=this.#t.$state;return wi(e(),t()==="descending")});constructor(){super(),this.#s=new Pt,this.#s.onValueChange=this.#o.bind(this)}onSetup(){this.#t=b(),J(B)&&(this.#e=I(B))}onConnect(t){l(this.#a.bind(this)),l(this.#r.bind(this)),l(this.#n.bind(this))}getOptions(){const{autoLabel:t,hideBitrate:e}=this.$props;return[{value:"auto",label:t},...this.#i().map(s=>{const i=s.bitrate&&s.bitrate>=0?`${H(s.bitrate/1e6,2)} Mbps`:null;return{quality:s,label:s.height+"p",value:this.#c(s),bitrate:()=>e()?null:i}})]}#a(){this.#s.value=this.#l()}#n(){const{autoLabel:t}=this.$props,{autoQuality:e,quality:s}=this.#t.$state,i=s()?s().height+"p":"";this.#e?.hint.set(e()?t()+(i?` (${i})`:""):i)}#r(){this.#e?.disable(this.disabled)}#o(t,e){if(this.disabled)return;if(t==="auto"){this.#t.remote.changeQuality(-1,e),this.dispatch("change",{detail:"auto",trigger:e});return}const{qualities:s}=this.#t.$state,i=f(s).findIndex(n=>this.#c(n)===t);if(i>=0){const n=f(s)[i];this.#t.remote.changeQuality(i,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.height+"_"+t.bitrate}}const ms=Wi.prototype;x(ms,"value"),x(ms,"disabled"),O(ms,"getOptions");class fl extends T(HTMLElement,Wi){static tagName="media-quality-radio-group";onConnect(){qt(this,(t,e)=>{const s=e.bitrate,i=t.querySelector('[data-part="bitrate"]');s&&i&&l(()=>{i.textContent=s()||""})})}}class Ui extends k{static props={value:""};#t=y(!1);#e={value:this.$props.value,check:this.#r.bind(this),onCheck:null};get checked(){return this.#t()}constructor(){super(),new at}onSetup(){this.setAttributes({value:this.$props.value,"data-checked":this.#t,"aria-checked":W(this.#t)})}onAttach(t){const e=J(B);L(t,"tabindex",e?"-1":"0"),L(t,"role",e?"menuitemradio":"radio"),l(this.#a.bind(this))}onConnect(t){this.#i(),bt(t,this.#n.bind(this)),P(this.#s.bind(this))}#s(){Ft(()=>{I(os).remove(this.#e)},this.connectScope)}#i(){I(os).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 gl=Ui.prototype;x(gl,"checked");class bl extends T(HTMLElement,Ui){static tagName="media-radio"}class Qi extends k{static props={value:""};#t;get values(){return this.#t.values}get value(){return this.#t.value}set value(t){this.#t.value=t}constructor(){super(),this.#t=new Pt,this.#t.onValueChange=this.#s.bind(this)}onSetup(){l(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 zi=Qi.prototype;x(zi,"values"),x(zi,"value");class yl extends T(HTMLElement,Qi){static tagName="media-radio-group"}const vl=[.25,.5,.75,1,1.25,1.5,1.75,2];class ji extends k{static props={normalLabel:"Normal",rates:vl};#t;#e;#s;get value(){return this.#s.value}get disabled(){const{rates:t}=this.$props,{canSetPlaybackRate:e}=this.#t.$state;return!e()||t().length===0}constructor(){super(),this.#s=new Pt,this.#s.onValueChange=this.#o.bind(this)}onSetup(){this.#t=b(),J(B)&&(this.#e=I(B))}onConnect(t){l(this.#i.bind(this)),l(this.#a.bind(this)),l(this.#n.bind(this))}getOptions(){const{rates:t,normalLabel:e}=this.$props;return t().map(s=>({label:s===1?e:s+"",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+"")}#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 fs=ji.prototype;x(fs,"value"),x(fs,"disabled"),O(fs,"getOptions");class $l extends T(HTMLElement,ji){static tagName="media-speed-radio-group";onConnect(){qt(this)}}class wl extends k{static props={src:null,alt:null,crossOrigin:null};static state=new ft({img:null,src:null,alt:null,crossOrigin:null,loading:!0,error:null,hidden:!1});#t;onSetup(){this.#t=b(),this.#o(),this.#l(),this.#c(),this.#i()}onAttach(t){t.style.setProperty("pointer-events","none"),l(this.#n.bind(this)),l(this.#o.bind(this)),l(this.#l.bind(this)),l(this.#c.bind(this)),l(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){l(this.#s.bind(this)),l(this.#u.bind(this))}#e(){const{error:t}=this.$state;return!kt(t())}#s(){const{canLoadPoster:t,poster:e}=this.#t.$state;!t()&&e()&&Bt(e(),"preconnect")}#i(){const{src:t}=this.$props,{poster:e,nativeControls:s}=this.#t.$state;this.el&&g(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 q(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:i}=this.#t.$state,n=this.$props.src()||"",r=n||t()||i();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:i}=this.#t.$state,n=t()!==null?t():s();e.set(/ytimg\.com|vimeo/.test(i()||"")?null:n===!0?"anonymous":n)}#u(){const{loading:t,error:e}=this.$state,{canLoadPoster:s,poster:i}=this.#t.$state;t.set(s()&&!!i()),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 Tl extends T(HTMLElement,wl){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;l(()=>{const{loading:i,hidden:n}=this.$state;this.#t.style.display=i()||n()?"none":""}),l(()=>{g(this.#t,"alt",e()),g(this.#t,"crossorigin",s()),g(this.#t,"src",t())}),this.#t.parentNode!==this&&this.prepend(this.#t)}}const Ct=new ft({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 Yi(this.min,this.max,this.value)},get fillPercent(){return this.fillRate*100},get pointerRate(){return Yi(this.min,this.max,this.pointerValue)},get pointerPercent(){return this.pointerRate*100}});function Yi(a,t,e){const s=t-a,i=e-a;return s>0?i/s:0}const Dt=rt(()=>({}));class Xi extends st{#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),P(this.#s.bind(this))}#s(){this.#e?.disconnect(),this.#e=void 0}}function kl(a,t,e,s){return De(a,H(e,Fa(s)),t)}function Sl(a,t,e,s){const i=De(0,e,1),n=t-a,r=n*i,o=r/s,d=s*Math.round(o);return a+d}const gs={Left:-1,ArrowLeft:-1,Up:1,ArrowUp:1,Right:1,ArrowRight:1,Down:-1,ArrowDown:-1};class xl extends st{#t;#e;#s;constructor(t,e){super(),this.#t=t,this.#e=e}onSetup(){J(Ut)&&(this.#s=I(Ut))}onConnect(t){l(this.#c.bind(this,t)),l(this.#u.bind(this,t)),this.#t.swipeGesture&&l(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 q(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(kt(this.#n)||Ne(t))return;const e=t.touches[0],s=e.clientX-this.#n.clientX,i=e.clientY-this.#n.clientY,n=this.$state.dragging();!n&&Math.abs(i)>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;G(t,"focus",this.#h.bind(this)),!(e()||this.#t.isDisabled())&&new q(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 q(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:i,max:n,dragging:r}=this.$state,o=Math.max(i(),Math.min(t,n()));s.set(o);const d=this.createEvent("value-change",{detail:o,trigger:e});if(this.dispatch(d),this.#t.onValueChange?.(d),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:i}=this.$state;s.set(t),this.dispatch("pointer-value-change",{detail:t,trigger:e}),i()&&this.#d(t,e)}#m(t){let e,s=this.el.getBoundingClientRect(),{min:i,max:n}=this.$state;if(this.$props.orientation()==="vertical"){const{bottom:r,height:o}=s;e=(r-t.clientY)/o}else if(this.#n&&ot(this.#r)){const{width:r}=this.#a.getBoundingClientRect(),o=(t.clientX-this.#n.clientX)/r,d=n()-i(),c=d*Math.abs(o);e=(o<0?this.#r-c:this.#r+c)/d}else{const{left:r,width:o}=s;e=(t.clientX-r)/o}return Math.max(i(),Math.min(n(),this.#t.roundValue(Sl(i(),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 i=this.createEvent("drag-start",{detail:t,trigger:e});this.dispatch(i),this.#t.onDragStart?.(i),this.#s?.onDragStart?.()}#v(t,e){const{dragging:s}=this.$state;if(!s())return;s.set(!1),this.#e.remote.resumeControls(e);const i=this.createEvent("drag-end",{detail:t,trigger:e});this.dispatch(i),this.#t.onDragEnd?.(i),this.#n=null,this.#r=null,this.#s?.onDragEnd?.()}#x;#f=!1;#T(t){if(!Object.keys(gs).includes(t.key))return;const{key:s}=t,i=this.#S(t);if(!kt(i)){this.#p(i,t),this.#d(i,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(gs).includes(t.key)||!kt(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:i}=this.$state;return e==="Home"||e==="PageUp"?s():e==="End"||e==="PageDown"?i():!t.metaKey&&/^[0-9]$/.test(e)?(i()-s())/10*Number(e):null}#P(t){const{key:e,shiftKey:s}=t;t.preventDefault(),t.stopPropagation();const{shiftKeyMultiplier:i}=this.$props,{min:n,max:r,value:o,pointerValue:d}=this.$state,c=this.#t.getStep(),u=this.#t.getKeyStep(),p=s?u*i():u,v=Number(gs[e]),w=p*v,S=this.#f?d():this.#t.getValue?.()??o(),N=(S+w)/c;return Math.max(n(),Math.min(r(),Number((c*N).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=Tt(t=>{this.#p(this.#m(t),t)},20,{leading:!0})}class et extends st{static props={hidden:!1,disabled:!1,step:1,keyStep:1,orientation:"horizontal",shiftKeyMultiplier:5};#t;#e;#s=y(!0);#i=y(!0);constructor(t){super(),this.#e=t}onSetup(){this.#t=b();const t=new at;t.attach(this),this.$state.focused=t.focused.bind(t),J(Dt)||X(Dt,{default:"value"}),X(ps,{orientation:this.$props.orientation,disabled:this.#e.isDisabled,preview:y(null)}),l(this.#r.bind(this)),l(this.#o.bind(this)),l(this.#l.bind(this)),this.#u(),new xl(this.#e,this.#t).attach(this),new Xi({callback:this.#a.bind(this)}).attach(this)}onAttach(t){L(t,"role","slider"),L(t,"tabindex","0"),L(t,"autocomplete","off"),l(this.#h.bind(this))}onConnect(t){P(zs(t,this.#s.set)),l(this.#n.bind(this))}#a(t){this.#i.set(t[0].isIntersecting)}#n(){const{hidden:t}=this.$props;this.$state.hidden.set(t()||!this.#s()||!this.#i.bind(this))}#r(){const{dragging:t,value:e,min:s,max:i}=this.$state;f(t)||e.set(kl(s(),i(),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 ie(this.#e.isDisabled())}#u(){const{orientation:t}=this.$props,{dragging:e,active:s,pointing:i}=this.$state;this.setAttributes({"data-dragging":e,"data-pointing":i,"data-active":s,"aria-disabled":this.#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(H(t(),3),H(e(),3))}#d=ct((t,e)=>{this.el?.style.setProperty("--slider-fill",t+"%"),this.el?.style.setProperty("--slider-pointer",e+"%")})}class Pl extends k{static props={...et.props,step:25,keyStep:25,shiftKeyMultiplier:2,min:0,max:300};static state=Ct;#t;onSetup(){this.#t=b(),X(Dt,{default:"percent",percent:(t,e)=>H(this.$state.value(),e)+"%"}),new et({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),l(this.#i.bind(this)),l(this.#a.bind(this))}onAttach(t){t.setAttribute("data-media-audio-gain-slider",""),L(t,"aria-label","Audio Boost");const{canSetAudioGain:e}=this.#t.$state;this.setAttributes({"data-supported":e,"aria-hidden":W(()=>!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=H(1+t.detail/100,2);this.#t.remote.changeAudioGain(e,t)}#o(t){this.#r(t)}#l(t){this.#r(t)}}class Cl extends T(HTMLElement,Pl){static tagName="media-audio-gain-slider"}class El extends k{static props={...et.props,step:1,keyStep:1,shiftKeyMultiplier:1};static state=Ct;#t;#e=_(()=>{const{qualities:t}=this.#t.$state;return wi(t())});onSetup(){this.#t=b(),new et({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),l(this.#a.bind(this)),l(this.#n.bind(this))}onAttach(t){t.setAttribute("data-media-quality-slider",""),L(t,"aria-label","Video Quality");const{qualities:e,canSetQuality:s}=this.#t.$state,i=_(()=>s()&&e().length>0);this.setAttributes({"data-supported":i,"aria-hidden":W(()=>!i())})}#s(){const{value:t}=this.$state;return t()}#i(){const{quality:t}=this.#t.$state;if(!t())return"";const{height:e,bitrate:s}=t(),i=s&&s>0?`${(s/1e6).toFixed(2)} Mbps`:null;return e?`${e}p${i?` (${i})`:""}`:"Auto"}#a(){const t=this.#e();this.$state.max.set(Math.max(0,t.length-1))}#n(){let{quality:t}=this.#t.$state,e=this.#e(),s=Math.max(0,e.indexOf(t()));this.$state.value.set(s),this.dispatch("value-change",{detail:s})}#r(){const{disabled:t}=this.$props,{canSetQuality:e,qualities:s}=this.#t.$state;return t()||s().length<=1||!e()}#o=Tt(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 Al extends T(HTMLElement,El){static tagName="media-quality-slider"}class Ji extends k{static props={...et.props,step:.1,keyStep:5,shiftKeyMultiplier:2,pauseWhileDragging:!1,noSwipeGesture:!1,seekingRequestThrottle:100};static state=Ct;#t;#e;#s=y(null);constructor(){super();const{noSwipeGesture:t}=this.$props;new et({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=b(),X(Dt,{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)}),l(this.#r.bind(this)),l(this.#n.bind(this))}onAttach(t){t.setAttribute("data-media-time-slider",""),L(t,"aria-label","Seek")}onConnect(t){l(this.#o.bind(this)),re(this.#t.textTracks,"chapters",this.#s.set)}#i(){const{bufferedEnd:t,duration:e}=this.#t.$state;return H(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=Tt(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}=I(ps);t&&e()&&g(t,"data-preview",this.$state.active())}#l(t,e){this.#t.remote.seeking(t,e)}#c(t,e,s){this.#e.cancel();const{live:i}=this.#t.$state;if(i()&&e>=99){this.#t.remote.seekToLiveEdge(s);return}this.#t.remote.seek(t,s)}#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:i}=this.$props;i()&&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 H(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)?`${ye(t)} out of ${ye(e())}`:"live"}#f(t){const{duration:e}=this.#t.$state;return H(t/100*e(),5)}#T(t){const{liveEdge:e,duration:s}=this.#t.$state,i=Math.max(0,Math.min(1,e()?1:Math.min(t,s())/s()));return Number.isNaN(i)?0:Number.isFinite(i)?i*100:100}#k(t){const e=this.#f(t),{live:s,duration:i}=this.#t.$state;return Number.isFinite(e)?(s()?e-i():e).toFixed(0):"LIVE"}#S(t,e){const s=this.#f(t),{live:i,duration:n}=this.#t.$state,r=i()?s-n():s;return Number.isFinite(s)?`${r<0?"-":""}${be(Math.abs(r),e)}`:"LIVE"}}class Zi extends k{static props={disabled:!1};#t;#e;#s;#i=null;#a=[];#n=y(null);#r=y([]);#o=y(-1);#l=y(-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=b(),this.#e=Mt(Ji.state)}onAttach(t){re(this.#t.textTracks,"chapters",this.#u.bind(this)),l(this.#E.bind(this))}onConnect(){P(()=>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&&Ft(()=>this.#d(),this.#s=xa())}#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&&l(this.#p.bind(this))}#p(){const{hidden:t}=this.#e;t()||(l(this.#m.bind(this)),l(this.#b.bind(this)),l(this.#g.bind(this)),l(this.#v.bind(this)))}#m(){const t=this.#r();if(!t.length)return;let e,{seekableStart:s,seekableEnd:i}=this.#t.$state,n=s(),r=i()||t[t.length-1].endTime,o=r-n,d=100;for(let c=0;cd?this.#y(d,u,100):u0&&e<100),g(t,"data-ended",e===100))}#w(t,e){let s=0,i=this.#r();if(e===0)return 0;if(e===100)return i.length-1;let{seekableStart:n}=this.#t.$state,r=n(),o=this.#k(i);for(let d=t;d=0&&s<100)return d;return 0}#v(){this.#x(this.#f())}#x=ct(t=>{let e,s=this.#r(),{seekableStart:i}=this.#t.$state,n=i(),r=this.#k(s);for(let o=this.#c;o=p?100:(e-u)/(p-u)*100,3))}#P(t){let e=[],{seekableStart:s,seekableEnd:i,duration:n}=this.#t.$state,r=s(),o=i();t=t.filter(u=>u.startTime<=o&&u.endTime>=r);const d=t[0];d&&d.startTime>r&&e.push(new window.VTTCue(r,d.startTime,""));for(let u=0;u0&&e.push(new window.VTTCue(p.endTime,p.endTime+w,""))}}const c=t[t.length-1];if(c){e.push(c);const u=n();u>=0&&u-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 q(e).add("add-cue",s).add("remove-cue",s),l(this.#C.bind(this))}return this.#i=this.#_(),this.#i&&l(this.#q.bind(this)),()=>{this.#i&&(this.#i.textContent="",this.#i=null)}}#C(){this.#t.$state.duration(),this.#M()}#M=Ce(()=>{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);#q(){const t=this.activePointerCue||this.activeCue;this.#i&&(this.#i.textContent=t?.text||"")}#D(){let t=this.el;for(;t&&t.getAttribute("role")!=="slider";)t=t.parentElement;return t}#_(){const t=this.#D();return t?t.querySelector('[data-part="chapter-title"]'):null}}const we=Zi.prototype;x(we,"cues"),x(we,"activeCue"),x(we,"activePointerCue"),O(we,"setRefs");class Ml extends T(HTMLElement,Zi){static tagName="media-slider-chapters";#t=null;onConnect(){ht(()=>{if(!this.connectScope)return;const t=this.querySelector("template");t&&(this.#t=t,l(this.#e.bind(this)))})}#e(){if(!this.#t)return;const t=Fe(this.#t,this.cues.length||1);this.setRefs(t)}}class zt extends k{static props={...et.props,min:0,max:100,value:0};static state=Ct;constructor(){super(),new et({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(){l(this.#s.bind(this)),l(this.#i.bind(this))}#t(){const{value:t}=this.$state;return Math.round(t())}#e(){const{value:t,max:e}=this.$state;return H(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 Ll extends T(HTMLElement,zt){static tagName="media-slider"}class ql extends k{static props={offset:0,noClamp:!1};#t;onSetup(){this.#t=I(ps);const{active:t}=Mt(zt.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),P(()=>e.set(null)),l(this.#e.bind(this));const s=new ResizeObserver(this.#e.bind(this));s.observe(t),P(()=>s.disconnect())}#e=ct(()=>{const{disabled:t,orientation:e}=this.#t;if(t())return;const s=this.el,{offset:i,noClamp:n}=this.$props;s&&_l(s,{clamp:!n(),offset:i(),orientation:e()})})}function _l(a,{clamp:t,offset:e,orientation:s}){const i=getComputedStyle(a),n=parseFloat(i.width),r=parseFloat(i.height),o={top:null,right:null,bottom:null,left:null};if(o[s==="horizontal"?"bottom":"left"]=`calc(100% + var(--media-slider-preview-offset, ${e}px))`,s==="horizontal"){const d=n/2;if(!t)o.left=`calc(var(--slider-pointer) - ${d}px)`;else{const c=`max(0px, calc(var(--slider-pointer) - ${d}px))`,u=`calc(100% - ${n}px)`;o.left=`min(${c}, ${u})`}}else{const d=r/2;if(!t)o.bottom=`calc(var(--slider-pointer) - ${d}px)`;else{const c=`max(${d}px, calc(var(--slider-pointer) - ${d}px))`,u=`calc(100% - ${r}px)`;o.bottom=`min(${c}, ${u})`}}Object.assign(a.style,o)}class Dl extends T(HTMLElement,ql){static tagName="media-slider-preview"}class Il extends k{}class Vl extends T(HTMLElement,Il){static tagName="media-slider-steps";#t=null;onConnect(t){ht(()=>{this.connectScope&&(this.#t=t.querySelector("template"),this.#t&&l(this.#e.bind(this)))})}#e(){if(!this.#t)return;const{min:t,max:e,step:s}=Mt(Ct),i=(e()-t())/s();Fe(this.#t,Math.floor(i)+1)}}const mt=new Map,Te=new Map;class vs{#t;#e;#s;$images=y([]);static create(t,e){const s=b();return new vs(t,e,s)}constructor(t,e,s){this.#e=t,this.#s=e,this.#t=s,l(this.#i.bind(this))}#i(){const{canLoad:t}=this.#t.$state;if(!t())return;const e=this.#e();if(e){if(C(e)&&mt.has(e)){const s=mt.get(e);if(mt.delete(e),mt.set(e,s),mt.size>99){const i=mt.keys().next().value;mt.delete(i)}this.$images.set(mt.get(e))}else if(C(e)){const s=this.#s(),i=e+"::"+s;if(!Te.has(i)){const n=new Promise(async(r,o)=>{try{const d=await fetch(e,{credentials:oe(s)});if(d.headers.get("content-type")==="application/json"){const u=await d.json();if(Y(u))if(u[0]&&"text"in u[0])r(this.#r(u));else{for(let p=0;p{try{const{cues:p}=await u(d);r(this.#r(p))}catch(p){o(p)}})}catch(d){o(d)}}).then(r=>(mt.set(i,r),r)).catch(r=>{this.#u(e,r)}).finally(()=>{C(i)&&Te.delete(i)});Te.set(i,n)}Te.get(i)?.then(n=>{this.$images.set(n||[])})}else if(Y(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,i)=>(ut(s.url&&C(s.url)),ut("startTime"in s&&ot(s.startTime)),{...s,url:C(s.url)?this.#l(s.url,e):s.url}))}#n(t){ut(C(t.url)),ut(Y(t.tiles)&&t.tiles?.length);const e=new URL(t.url),s=[],i="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:i,height:n,coords:{x:r.x,y:r.y}});return s}#r(t){for(let i=0;i{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!kt(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:i}=this.$state,n=-1,r=null;for(let o=t.length-1;o>=0;o--){const d=t[o];if(e>=d.startTime&&(!d.endTime||e1?v:1;this.#d(t,"--thumbnail-width",`${i*S}px`),this.#d(t,"--thumbnail-height",`${n*S}px`),this.#d(t,"--thumbnail-aspect-ratio",String(H(i/n,5))),this.#d(e,"width",`${e.naturalWidth*S}px`),this.#d(e,"height",`${e.naturalHeight*S}px`),this.#d(e,"transform",s.coords?`translate(-${s.coords.x*S}px, -${s.coords.y*S}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 Ol=He('');class ta extends T(HTMLElement,Rl){static tagName="media-thumbnail";static attrs={crossOrigin:"crossorigin"};#t;#e=this.#s();onSetup(){this.#t=b(),this.$state.img.set(this.#e)}onConnect(){const{src:t,crossOrigin:e}=this.$state;this.#e.parentNode!==this&&this.prepend(this.#e),l(()=>{g(this.#e,"src",t()),g(this.#e,"crossorigin",e())})}#s(){return Be(Ol)}}class Nl extends ta{static tagName="media-slider-thumbnail";#t;#e;onSetup(){super.onSetup(),this.#t=b(),this.#e=Mt(zt.state)}onConnect(){super.onConnect(),l(this.#s.bind(this))}#s(){const{duration:t,clipStartTime:e}=this.#t.$state;this.time=e()+this.#e.pointerRate()*t()}}class ea extends k{static props={type:"pointer",format:null,showHours:!1,showMs:!1,padHours:null,padMinutes:null,decimalPlaces:2};#t;#e;#s;onSetup(){this.#s=Mt(zt.state),this.#t=I(Dt),this.#e=_(this.getValueText.bind(this))}getValueText(){const{type:t,format:e,decimalPlaces:s,padHours:i,padMinutes:n,showHours:r,showMs:o}=this.$props,{value:d,pointerValue:c,min:u,max:p}=this.#s,v=e?.()??this.#t.default,w=t()==="current"?d():c();if(v==="percent"){const S=p()-u(),N=w/S*100;return(this.#t.percent??H)(N,s())+"%"}else return v==="time"?(this.#t.time??be)(w,{padHrs:i(),padMins:n(),showHrs:r(),showMs:o()}):(this.#t.value?.(w)??w.toFixed(2))+""}}const Fl=ea.prototype;O(Fl,"getValueText");class Hl extends T(HTMLElement,ea){static tagName="media-slider-value";static attrs={padMinutes:{converter:Ca}};onConnect(){l(()=>{const{smallWhen:t}=E(),e=this.getValueText(),s=e.endsWith("%")?"\u21C5":"\u21C4",i=s&&!t()?`(${s}) `:"";this.textContent=i+e})}}class sa extends k{static props={src:null,crossOrigin:null};static state=new ft({video:null,src:null,crossOrigin:null,canPlay:!1,error:null,hidden:!1});#t;#e;get video(){return this.$state.video()}onSetup(){this.#t=b(),this.#e=Mt(zt.state),this.#a(),this.setAttributes({"data-loading":this.#n.bind(this),"data-hidden":this.$state.hidden,"data-error":this.#r.bind(this),"aria-hidden":W(this.$state.hidden)})}onAttach(t){l(this.#s.bind(this)),l(this.#i.bind(this)),l(this.#a.bind(this)),l(this.#o.bind(this)),l(this.#l.bind(this)),l(this.#h.bind(this))}#s(){const t=this.$state.video();t&&(t.readyState>=2&&this.#c(),new q(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,i=t()!==null?t():s();e.set(i===!0?"anonymous":i)}#n(){const{canPlay:t,hidden:e}=this.$state;return!t()&&!e()}#r(){const{error:t}=this.$state;return!kt(t)}#o(){const{src:t,hidden:e}=this.$state,{canLoad:s,duration:i}=this.#t.$state;e.set(s()&&(!t()||this.#r()||!Number.isFinite(i())))}#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:i}=this.#e,n=t();e()&&n&&Number.isFinite(s())&&Number.isFinite(i())&&(n.currentTime=i()*s())}}const Bl=sa.prototype;x(Bl,"video");const Gl=He('');class Kl extends T(HTMLElement,sa){static tagName="media-slider-video";#t;#e=this.#s();onSetup(){this.#t=b(),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),l(()=>{g(this.#e,"crossorigin",s()),g(this.#e,"preload",t()?"auto":"none"),g(this.#e,"src",e())})}#s(){return Be(Gl)}}class Wl extends k{static props={...et.props,step:.25,keyStep:.25,shiftKeyMultiplier:2,min:0,max:2};static state=Ct;#t;onSetup(){this.#t=b(),new et({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),l(this.#i.bind(this)),l(this.#a.bind(this))}onAttach(t){t.setAttribute("data-media-speed-slider",""),L(t,"aria-label","Speed");const{canSetPlaybackRate:e}=this.#t.$state;this.setAttributes({"data-supported":e,"aria-hidden":W(()=>!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 H(t,2)}#r(){const{disabled:t}=this.$props,{canSetPlaybackRate:e}=this.#t.$state;return t()||!e()}#o=Tt(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 Ul extends T(HTMLElement,Wl){static tagName="media-speed-slider"}class Ql extends T(HTMLElement,Ji){static tagName="media-time-slider"}class zl extends k{static props={...et.props,keyStep:5,shiftKeyMultiplier:2};static state=Ct;#t;onSetup(){this.#t=b();const{audioGain:t}=this.#t.$state;X(Dt,{default:"percent",value(e){return(e*(t()??1)).toFixed(2)},percent(e){return Math.round(e*(t()??1))}}),new et({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),l(this.#n.bind(this))}onAttach(t){t.setAttribute("data-media-volume-slider",""),L(t,"aria-label","Volume");const{canSetVolume:e}=this.#t.$state;this.setAttributes({"data-supported":e,"aria-hidden":W(()=>!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 H(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=Tt(this.#o.bind(this),25);#o(t){if(!t.trigger)return;const e=H(t.detail/100,3);this.#t.remote.changeVolume(e,t)}#l(t){this.#r(t)}#c(t){this.#r(t)}}class jl extends T(HTMLElement,zl){static tagName="media-volume-slider"}class Yl extends k{static props={size:96,trackWidth:8,fillPercent:50};onConnect(t){ht(()=>{if(!this.connectScope)return;const e=t.querySelector("svg"),s=e.firstElementChild,i=s.nextElementSibling;l(this.#t.bind(this,e,s,i))})}#t(t,e,s){const{size:i,trackWidth:n,fillPercent:r}=this.$props;g(t,"width",i()),g(t,"height",i()),g(e,"stroke-width",n()),g(s,"stroke-width",n()),g(s,"stroke-dashoffset",100-r())}}class Xl extends T(ce,Yl){static tagName="media-spinner";render(){return h` + `}function oo(a){return m(()=>a()?"true":"false")}function R(a,t){return m(()=>fe(a,t))}class lo extends T(ce,xr){static tagName="media-plyr-layout";#t;onSetup(){this.forwardKeepAlive=!1,this.#t=b()}onConnect(){this.#t.player.el?.setAttribute("data-layout","plyr"),P(()=>this.#t.player.el?.removeAttribute("data-layout")),Pr(this,this.#t),l(()=>{this.$props.customIcons()?new ze([this]).connect():new Er([this]).connect()})}render(){return m(this.#e.bind(this))}#e(){const{viewType:t}=this.#t.$state;return t()==="audio"?Ar():t()==="video"?Mr():null}}$(pr),$(kr),$(lo);function rs(a,t){const e=String(a),s=e.length;if(s=3600?rs(r,2):r,p=rs(o,2),v=i&&d>0?`.${String(d).replace(/^0?\./,"")}`:"",w=`${u}:${p}${v}`;return n>0||s?`${c}:${w}`:w}function ye(a){const t=[],{hours:e,minutes:s,seconds:i}=Ni(a);return e>0&&t.push(`${e} hour`),s>0&&t.push(`${s} min`),(i>0||t.length===0)&&t.push(`${i} sec`),t.join(" ")}class co extends k{static props={translations:null};static state=new ft({label:null,busy:!1});#t;#e=!1;onSetup(){this.#t=b()}onAttach(t){t.style.display="contents"}onConnect(t){t.setAttribute("data-media-announcer",""),L(t,"role","status"),L(t,"aria-live","polite");const{busy:e}=this.$state;this.setAttributes({"aria-busy":()=>e()?"true":null}),this.#e=!0,l(this.#s.bind(this)),l(this.#r.bind(this)),l(this.#n.bind(this)),l(this.#i.bind(this)),l(this.#a.bind(this)),l(this.#c.bind(this)),l(this.#h.bind(this)),dt(),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()?"Fullscreen":"Exit Fullscreen")}#a(){const{pictureInPicture:t}=this.#t.$state;this.#d(t()?"Picture-in-Picture":"Exit Picture-in-Picture")}#n(){const{textTrack:t}=this.#t.$state;this.#d(t()?"Subtitles On":"Subtitles 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 i=f(e),n=Math.abs(i-this.#o);if(n>=1){const r=i>=this.#o,o=ye(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 i=window.setTimeout(()=>void e.set(!1),150);return this.el&&g(this.el,"aria-label",s),C(s)&&this.dispatch("change",{detail:s}),()=>window.clearTimeout(i)}#d(t){const{label:e}=this.$state;e.set(t)}}class uo extends T(HTMLElement,co){static tagName="media-announcer"}class ho extends st{#t;constructor(t){super(),this.#t=t}onAttach(t){const{$props:e,ariaKeys:s}=b(),i=t.getAttribute("aria-keyshortcuts");if(i){s[this.#t]=i,P(()=>{delete s[this.#t]});return}const n=e.keyShortcuts()[this.#t];if(n){const r=Y(n)?n.join(" "):C(n)?n:n?.keys;t.setAttribute("aria-keyshortcuts",Y(r)?r.join(" "):r)}}}class j extends st{static props={disabled:!1};#t;constructor(t){super(),this.#t=t,new at,t.keyShortcut&&new ho(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){L(t,"tabindex","0"),L(t,"role","button"),L(t,"type","button")}onConnect(t){const e=bt(t,this.#i.bind(this));for(const s of["click","touchstart"])e.add(s,this.#a.bind(this),{passive:!0})}#e(){return ie(this.#t.isPresssed())}#s(t){$a(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 po extends k{static props=j.props;#t;constructor(){super(),new j({isPresssed:this.#s.bind(this),onPress:this.#e.bind(this)})}onSetup(){this.#t=b();const{canAirPlay:t,isAirPlayConnected:e}=this.#t.$state;this.setAttributes({"data-active":e,"data-supported":t,"data-state":this.#i.bind(this),"aria-hidden":U(()=>!t())})}onAttach(t){t.setAttribute("data-media-tooltip","airplay"),gt(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 mo extends T(HTMLElement,po){static tagName="media-airplay-button"}class fo extends k{static props=j.props;#t;constructor(){super(),new j({isPresssed:this.#s.bind(this),keyShortcut:"toggleCaptions",onPress:this.#e.bind(this)})}onSetup(){this.#t=b(),this.setAttributes({"data-active":this.#s.bind(this),"data-supported":()=>!this.#i(),"aria-hidden":U(this.#i.bind(this))})}onAttach(t){t.setAttribute("data-media-tooltip","caption"),gt(t,"Subtitles")}#e(t){this.#t.remote.toggleCaptions(t)}#s(){const{textTrack:t}=this.#t.$state,e=t();return!!e&&W(e)}#i(){const{hasCaptions:t}=this.#t.$state;return!t()}}class go extends T(HTMLElement,fo){static tagName="media-caption-button"}class bo extends k{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=b();const{fullscreen:t}=this.#t.$state,e=this.#i.bind(this);this.setAttributes({"data-active":t,"data-supported":e,"aria-hidden":U(()=>!e())})}onAttach(t){t.setAttribute("data-media-tooltip","fullscreen"),gt(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 yo extends T(HTMLElement,bo){static tagName="media-fullscreen-button"}class vo extends k{static props=j.props;#t;constructor(){super(),new j({isPresssed:this.#s.bind(this),onPress:this.#e.bind(this)})}onSetup(){this.#t=b();const{canGoogleCast:t,isGoogleCastConnected:e}=this.#t.$state;this.setAttributes({"data-active":e,"data-supported":t,"data-state":this.#i.bind(this),"aria-hidden":U(()=>!t())})}onAttach(t){t.setAttribute("data-media-tooltip","google-cast"),gt(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 $o extends T(HTMLElement,vo){static tagName="media-google-cast-button"}class wo extends k{static props={disabled:!1};#t;constructor(){super(),new at}onSetup(){this.#t=b();const{disabled:t}=this.$props,{live:e,liveEdge:s}=this.#t.$state,i=()=>!e();this.setAttributes({"data-edge":s,"data-hidden":i,"aria-disabled":U(()=>t()||s()),"aria-hidden":U(i)})}onAttach(t){L(t,"tabindex","0"),L(t,"role","button"),L(t,"type","button"),t.setAttribute("data-media-tooltip","live")}onConnect(t){bt(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 To extends T(HTMLElement,wo){static tagName="media-live-button"}class ko extends k{static props=j.props;#t;constructor(){super(),new j({isPresssed:this.#s.bind(this),keyShortcut:"toggleMuted",onPress:this.#e.bind(this)})}onSetup(){this.#t=b(),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"),gt(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 So extends T(HTMLElement,ko){static tagName="media-mute-button"}class xo extends k{static props=j.props;#t;constructor(){super(),new j({isPresssed:this.#s.bind(this),keyShortcut:"togglePictureInPicture",onPress:this.#e.bind(this)})}onSetup(){this.#t=b();const{pictureInPicture:t}=this.#t.$state,e=this.#i.bind(this);this.setAttributes({"data-active":t,"data-supported":e,"aria-hidden":U(()=>!e())})}onAttach(t){t.setAttribute("data-media-tooltip","pip"),gt(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 Po extends T(HTMLElement,xo){static tagName="media-pip-button"}class Co extends k{static props=j.props;#t;constructor(){super(),new j({isPresssed:this.#s.bind(this),keyShortcut:"togglePaused",onPress:this.#e.bind(this)})}onSetup(){this.#t=b();const{paused:t,ended:e}=this.#t.$state;this.setAttributes({"data-paused":t,"data-ended":e})}onAttach(t){t.setAttribute("data-media-tooltip","play"),gt(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 Eo extends T(HTMLElement,Co){static tagName="media-play-button"}class Ao extends k{static props={disabled:!1,seconds:30};#t;constructor(){super(),new at}onSetup(){this.#t=b();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":U(()=>!s())})}onAttach(t){L(t,"tabindex","0"),L(t,"role","button"),L(t,"type","button"),t.setAttribute("data-media-tooltip","seek"),gt(t,this.#s.bind(this))}onConnect(t){bt(t,this.#i.bind(this))}#e(){const{canSeek:t}=this.#t.$state;return t()}#s(){const{seconds:t}=this.$props;return`Seek ${t()>0?"forward":"backward"} ${t()} seconds`}#i(t){const{seconds:e,disabled:s}=this.$props;if(s())return;const{currentTime:i}=this.#t.$state,n=i()+e();this.#t.remote.seek(n,t)}}class Mo extends T(HTMLElement,Ao){static tagName="media-seek-button"}class Fi extends k{static props={disabled:!1,defaultPressed:!1};#t=y(!1);get pressed(){return this.#t()}constructor(){super(),new j({isPresssed:this.#t})}}const Lo=Fi.prototype;x(Lo,"pressed");class qo extends T(HTMLElement,Fi){static tagName="media-toggle-button"}class _o{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 q(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 vt extends k{static props={textDir:"ltr",exampleText:"Captions look like this."};#t;static lib=y(null);onSetup(){this.#t=b(),this.setAttributes({"aria-hidden":U(this.#e.bind(this))})}onAttach(t){t.style.setProperty("pointer-events","none")}onConnect(t){vt.lib()||import("/assets/js/vendor/media-captions/prod.js").then(e=>vt.lib.set(e)),l(this.#s.bind(this))}#e(){const{textTrack:t,remotePlaybackState:e,iOSControls:s}=this.#t.$state,i=t();return s()||e()==="connected"||!i||!W(i)}#s(){if(!vt.lib())return;const{viewType:t}=this.#t.$state;return t()==="audio"?this.#i():this.#o()}#i(){return l(this.#a.bind(this)),this.#u(null),()=>{this.el.textContent=""}}#a(){if(this.#e())return;this.#n();const{textTrack:t}=this.#t.$state;G(t(),"cue-change",this.#n.bind(this)),l(this.#r.bind(this))}#n(){this.el.textContent="",this.#p>=0&&this.#b();const{realCurrentTime:t,textTrack:e}=this.#t.$state,{renderVTTCueString:s}=vt.lib(),i=f(t),n=f(e).activeCues;for(const r of n){const o=this.#g(),d=this.#y();d.innerHTML=s(r,i),o.append(d),this.el.append(d)}}#r(){const{realCurrentTime:t}=this.#t.$state,{updateTimedVTTCueNodes:e}=vt.lib();e(this.el,t())}#o(){const{CaptionsRenderer:t}=vt.lib(),e=new t(this.el),s=new _o(e);return this.#t.textRenderers.add(s),l(this.#l.bind(this,e)),l(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);G(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();g(t,"data-example","");const e=this.#y();g(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 g(t,"data-part","cue-display"),t}#y(){const t=document.createElement("div");return g(t,"data-part","cue"),t}}class Do extends T(HTMLElement,vt){static tagName="media-captions"}class Io extends k{static props={defaultText:""}}class Vo extends T(HTMLElement,Io){static tagName="media-chapter-title";#t;#e;onSetup(){this.#t=b(),this.#e=y("")}onConnect(){const t=this.#t.textTracks;Oa(t,"chapters",this.#e.set),l(this.#s.bind(this))}#s(){const{defaultText:t}=this.$props;this.textContent=this.#e()||t()}}class Ro extends k{static props={hideDelay:1e3,hideOnMouseLeave:!1};#t;onSetup(){this.#t=b(),l(this.#s.bind(this))}onAttach(t){const{pictureInPicture:e,fullscreen:s}=this.#t.$state;Z(t,"pointer-events","none"),L(t,"role","group"),this.setAttributes({"data-visible":this.#i.bind(this),"data-fullscreen":s,"data-pip":e}),l(()=>{this.dispatch("change",{detail:this.#i()})}),l(this.#e.bind(this)),l(()=>{const i=s();for(const n of["top","right","bottom","left"])Z(t,`padding-${n}`,i&&`env(safe-area-inset-${n})`)})}#e(){if(!this.el)return;const{nativeControls:t}=this.#t.$state,e=t();g(this.el,"aria-hidden",e?"true":null),Z(this.el,"display",e?"none":null)}#s(){const{controls:t}=this.#t.player,{hideDelay:e,hideOnMouseLeave:s}=this.$props;t.defaultDelay=e()===1e3?this.#t.$props.controlsDelay():e(),t.hideOnMouseLeave=s()}#i(){const{controlsVisible:t}=this.#t.$state;return t()}}class Oo extends T(HTMLElement,Ro){static tagName="media-controls"}class No extends k{onAttach(t){t.style.pointerEvents||Z(t,"pointer-events","auto")}}class Fo extends T(HTMLElement,No){static tagName="media-controls-group"}class Ho extends k{static props={disabled:!1,event:void 0,action:void 0};#t;#e=null;onSetup(){this.#t=b();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]"),l(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"),G(this.#e,t,this.#n.bind(this),{passive:!1}))}#i=0;#a=-1;#n(t){if(this.$props.disabled()||Es(t)&&(t.button!==0||this.#t.activeMenu)||Jt(t)&&this.#t.activeMenu||Ne(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(Es(t)||wa(t)||Jt(t)){const e=Jt(t)?t.changedTouches[0]??t.touches[0]:void 0,s=e?.clientX??t.clientX,i=e?.clientY??t.clientY,n=this.el.getBoundingClientRect(),r=i>=n.top&&i<=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 K("will-trigger",{detail:t,cancelable:!0,trigger:e});if(this.dispatchEvent(s),s.defaultPrevented)return;const[i,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[Ta(i)](e),this.dispatch("trigger",{detail:t,trigger:e})}}class Bo extends T(HTMLElement,Ho){static tagName="media-gesture"}class Go extends k{static props={when:!1}}class Ko extends T(HTMLElement,Go){static tagName="media-layout";#t;onSetup(){this.#t=b()}onConnect(){l(this.#e.bind(this))}#e(){const t=this.firstElementChild,e=t?.localName==="template",s=this.$props.when();if(!(xs(s)?s:_(()=>s(this.#t.player.state))())){e?(this.textContent="",this.appendChild(t)):yt(t)&&(t.style.display="none");return}e?this.append(t.content.cloneNode(!0)):yt(t)&&(t.style.display="")}}const B=rt(),os=rt();class Pt extends st{#t=new Set;#e=y("");#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(){X(os,{add:this.#i.bind(this),remove:this.#a.bind(this)})}onAttach(t){J(B)||L(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 i=this.#o(s),n=this.#o(t);i?.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 Uo=[1,1.25,1.5,1.75,2,2.5,3,4];class Hi extends k{static props={normalLabel:"Disabled",gains:Uo};#t;#e;#s;get value(){return this.#s.value}get disabled(){const{gains:t}=this.$props,{canSetAudioGain:e}=this.#t.$state;return!e()||t().length===0}constructor(){super(),this.#s=new Pt,this.#s.onValueChange=this.#o.bind(this)}onSetup(){this.#t=b(),J(B)&&(this.#e=I(B))}onConnect(t){l(this.#i.bind(this)),l(this.#a.bind(this)),l(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 ls=Hi.prototype;x(ls,"value"),x(ls,"disabled"),O(ls,"getOptions");function qt(a,t){ht(()=>{if(!a.connectScope)return;const e=a.querySelector("template");e&&l(()=>{const s=a.getOptions();Fe(e,s.length,(i,n)=>{const{label:r,value:o}=s[n],d=i.querySelector('[data-part="label"]');i.setAttribute("value",o),d&&(C(r)?d.textContent=r:l(()=>{d.textContent=r()})),t?.(i,s[n],n)})})})}class Wo extends T(HTMLElement,Hi){static tagName="media-audio-gain-radio-group";onConnect(){qt(this)}}class Bi extends k{static props={emptyLabel:"Default"};#t;#e;#s;get value(){return this.#s.value}get disabled(){const{audioTracks:t}=this.#e.$state;return t().length<=1}constructor(){super(),this.#s=new Pt,this.#s.onValueChange=this.#o.bind(this)}onSetup(){this.#e=b(),J(B)&&(this.#t=I(B))}onConnect(t){l(this.#i.bind(this)),l(this.#n.bind(this)),l(this.#a.bind(this))}getOptions(){const{audioTracks:t}=this.#e.$state;return t().map(e=>({track:e,label:e.label,value:e.label.toLowerCase()}))}#i(){this.#s.value=this.#r()}#a(){const{emptyLabel:t}=this.$props,{audioTrack:e}=this.#e.$state,s=e();this.#t?.hint.set(s?.label??t())}#n(){this.#t?.disable(this.disabled)}#r(){const{audioTrack:t}=this.#e.$state,e=t();return e?e.label.toLowerCase():""}#o(t,e){if(this.disabled)return;const s=this.#e.audioTracks.toArray().findIndex(i=>i.label.toLowerCase()===t);if(s>=0){const i=this.#e.audioTracks[s];this.#e.remote.changeAudioTrack(s,e),this.dispatch("change",{detail:i,trigger:e})}}}const ds=Bi.prototype;x(ds,"value"),x(ds,"disabled"),O(ds,"getOptions");class Qo extends T(HTMLElement,Bi){static tagName="media-audio-radio-group";onConnect(){qt(this)}}class Gi extends k{static props={offLabel:"Off"};#t;#e;#s;get value(){return this.#s.value}get disabled(){const{hasCaptions:t}=this.#t.$state;return!t()}constructor(){super(),this.#s=new Pt,this.#s.onValueChange=this.#o.bind(this)}onSetup(){this.#t=b(),J(B)&&(this.#e=I(B))}onConnect(t){super.onConnect?.(t),l(this.#i.bind(this)),l(this.#n.bind(this)),l(this.#a.bind(this))}getOptions(){const{offLabel:t}=this.$props,{textTracks:e}=this.#t.$state;return[{value:"off",label:t},...e().filter(W).map(s=>({track:s,label:s.label,value:this.#l(s)}))]}#i(){this.#s.value=this.#r()}#a(){const{offLabel:t}=this.$props,{textTrack:e}=this.#t.$state,s=e();this.#e?.hint.set(s&&W(s)&&s.mode==="showing"?s.label:t())}#n(){this.#e?.disable(this.disabled)}#r(){const{textTrack:t}=this.#t.$state,e=t();return e&&W(e)&&e.mode==="showing"?this.#l(e):"off"}#o(t,e){if(this.disabled)return;if(t==="off"){const i=this.#t.textTracks.selected;if(i){const n=this.#t.textTracks.indexOf(i);this.#t.remote.changeTextTrackMode(n,"disabled",e),this.dispatch("change",{detail:null,trigger:e})}return}const s=this.#t.textTracks.toArray().findIndex(i=>this.#l(i)===t);if(s>=0){const i=this.#t.textTracks[s];this.#t.remote.changeTextTrackMode(s,"showing",e),this.dispatch("change",{detail:i,trigger:e})}}#l(t){return t.id+":"+t.kind+"-"+t.label.toLowerCase()}}const cs=Gi.prototype;x(cs,"value"),x(cs,"disabled"),O(cs,"getOptions");class zo extends T(HTMLElement,Gi){static tagName="media-captions-radio-group";onConnect(){qt(this)}}var jo=Object.defineProperty,Yo=Object.getOwnPropertyDescriptor,us=(a,t,e,s)=>{for(var i=Yo(t,e),n=a.length-1,r;n>=0;n--)(r=a[n])&&(i=r(t,e,i)||i);return i&&jo(t,e,i),i};class ve extends k{static props={thumbnails:null};#t;#e;#s;#i=y(null);#a=y([]);get value(){return this.#s.value}get disabled(){return!this.#a()?.length}constructor(){super(),this.#s=new Pt,this.#s.onValueChange=this.#u.bind(this)}onSetup(){this.#t=b(),J(B)&&(this.#e=I(B));const{thumbnails:t}=this.$props;this.setAttributes({"data-thumbnails":()=>!!t()})}onAttach(t){this.#e?.attachObserver({onOpen:this.#n.bind(this)})}getOptions(){const{seekableStart:t,seekableEnd:e}=this.#t.$state,s=t(),i=e();return this.#a().map((n,r)=>({cue:n,value:r.toString(),label:n.text,startTime:be(Math.max(0,n.startTime-s)),duration:ye(Math.min(i,n.endTime)-Math.max(s,n.startTime))}))}#n(){f(()=>this.#l())}onConnect(t){l(this.#l.bind(this)),l(this.#c.bind(this)),l(this.#r.bind(this)),re(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 q(t).add("add-cue",e).add("remove-cue",e),()=>{this.#a.set([])}}#o(t){const{seekableStart:e,seekableEnd:s}=this.#t.$state,i=e(),n=s();this.#a.set([...t.cues].filter(r=>r.startTime<=n&&r.endTime>=i))}#l(){if(!this.#e?.expanded())return;if(!this.#i()){this.#s.value="-1";return}const{realCurrentTime:e,seekableStart:s,seekableEnd:i}=this.#t.$state,n=s(),r=i(),o=e(),d=this.#a().findIndex(c=>Na(c,o));this.#s.value=d.toString(),d>=0&&ht(()=>{if(!this.connectScope)return;const c=this.#a()[d],u=this.el.querySelector("[aria-checked='true']"),p=Math.max(n,c.startTime),v=Math.min(r,c.endTime)-p,w=Math.max(0,o-p)/v*100;u&&Z(u,"--progress",H(w,3)+"%")})}#c(){this.#e?.disable(this.disabled)}#u(t,e){if(this.disabled||!e)return;const s=+t,i=this.#a(),{clipStartTime:n}=this.#t.$state;ot(s)&&i?.[s]&&(this.#s.value=s.toString(),this.#t.remote.seek(i[s].startTime-n(),e),this.dispatch("change",{detail:i[s],trigger:e}))}}us([x],ve.prototype,"value"),us([x],ve.prototype,"disabled"),us([O],ve.prototype,"getOptions");class Xo extends T(HTMLElement,ve){static tagName="media-chapters-radio-group";onConnect(){qt(this,(t,e)=>{const{cue:s,startTime:i,duration:n}=e,r=t.querySelector(".vds-thumbnail,media-thumbnail"),o=t.querySelector('[data-part="start-time"]'),d=t.querySelector('[data-part="duration"]');o&&(o.textContent=i),d&&(d.textContent=n),r&&(r.setAttribute("time",s.startTime+""),l(()=>{const c=this.$props.thumbnails();"src"in r?r.src=c:C(c)&&r.setAttribute("src",c)}))})}}class hs extends k{static props={disabled:!1};#t;#e=y(null);get expanded(){return this.#t?.expanded()??!1}constructor(){super(),new at}onSetup(){this.#t=I(B)}onAttach(t){this.#t.attachMenuButton(this),l(this.#s.bind(this)),L(t,"type","button")}onConnect(t){l(this.#i.bind(this)),this.#a();const e=new MutationObserver(this.#a.bind(this));e.observe(t,{attributeFilter:["data-part"],childList:!0,subtree:!0}),P(()=>e.disconnect()),bt(t,s=>{this.dispatch("select",{trigger:s})})}#s(){this.#t.disableMenuButton(this.$props.disabled())}#i(){const t=this.#e();t&&l(()=>{const e=this.#t.hint();e&&(t.textContent=e)})}#a(){const t=this.el?.querySelector('[data-part="hint"]');this.#e.set(t??null)}}const Jo=hs.prototype;x(Jo,"expanded");class Zo extends T(HTMLElement,hs){static tagName="media-menu-button"}class Ki extends st{#t;constructor(t){super(),this.#t=t,l(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(rn(e)){this.#a?.();const n=G(e,"animationend",s,{once:!0});this.#a=n}else s()}})}#n(){window.clearTimeout(this.#s),this.#s=-1}}const ps=rt(),Wt=rt();function tl(a,t){const e=ka(a,t);for(const{el:s,top:i,left:n}of e)s.scroll({top:i,left:n,behavior:t.behavior})}function el(a,t={}){tl(a,{scrollMode:"if-needed",block:"center",inline:"center",...t})}const sl=["a[href]","[tabindex]","input","select","button"].map(a=>`${a}:not([aria-hidden='true'])`).join(","),il=new Set(["Escape","Tab","ArrowUp","ArrowDown","Home","PageUp","End","PageDown","Enter"," "]);class al{#t=-1;#e=null;#s=[];#i;get items(){return this.#s}constructor(t){this.#i=t}attachMenu(t){G(t,"focus",this.#r.bind(this)),this.#e=t,P(()=>{this.#e=null})}listen(){this.#e&&(this.update(),new q(this.#e).add("keyup",this.#l.bind(this)).add("keydown",this.#c.bind(this)),P(()=>{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(()=>{el(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(Sa(t)&&e instanceof Element){const s=e.getAttribute("role");return!/a|input|select|button/.test(e.localName)&&!s}return il.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(sl),e=[],s=i=>i.getAttribute("role")==="menu";for(const i of t)yt(i)&&i.offsetParent!==null&&js(this.#e,i,s)&&e.push(i);return e}}var nl=Object.defineProperty,rl=Object.getOwnPropertyDescriptor,Qt=(a,t,e,s)=>{for(var i=rl(t,e),n=a.length-1,r;n>=0;n--)(r=a[n])&&(i=r(t,e,i)||i);return i&&nl(t,e,i),i};let ol=0;class _t extends k{static props={showDelay:0};#t;#e;#s;#i=y(!1);#a=y(!1);#n=y(null);#r=y(null);#o;#l=new Set;#c=null;#u;#h;#d=!1;#p=y(!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 Ki({trigger:this.#n,content:this.#r,showDelay:t,listen:(e,s,i)=>{bt(e,r=>{this.#i()?i(r):s(r)});const n=this.#M();n&&bt(n,r=>{r.stopPropagation(),i(r)})},onChange:this.#T.bind(this)})}onSetup(){this.#t=b();const t=++ol;this.#e=`media-menu-${t}`,this.#s=`media-menu-button-${t}`,this.#h=new al({closeMenu:this.close.bind(this)}),J(B)&&(this.#o=I(B)),this.#b(),this.setAttributes({"data-open":this.#i,"data-root":!this.isSubmenu,"data-submenu":this.isSubmenu,"data-disabled":this.#P.bind(this)}),X(B,{button:this.#n,content:this.#r,expanded:this.#i,hint:y(""),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.#D.bind(this),onTransitionEvent:e=>{this.#m.add(e),P(()=>{this.#m.delete(e)})}})}onAttach(t){t.style.setProperty("display","contents")}onConnect(t){l(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=J(Wt)?I(Wt):null;X(Wt,{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.#O(),this.#v(t),t&&(l(()=>{const{height:e}=this.#t.$state,s=this.#r();s&&Z(s,"--player-height",e()+"px")}),this.#h.listen(),this.listen("pointerup",this.#A.bind(this)),G(window,"pointerup",this.#C.bind(this)))}#y(t){const e=t.el,s=this.isSubmenu,i=U(this.#P.bind(this));L(e,"tabindex",s?"-1":"0"),L(e,"role",s?"menuitem":"button"),g(e,"id",this.#s),g(e,"aria-haspopup","menu"),g(e,"aria-expanded","false"),g(e,"data-root",!this.isSubmenu),g(e,"data-submenu",this.isSubmenu),l(()=>{g(e,"data-open",this.#i()),g(e,"aria-disabled",i())}),this.#n.set(e),P(()=>{this.#n.set(null)})}#$(t){const e=t.el;e.style.setProperty("display","none"),g(e,"id",this.#e),L(e,"role","menu"),L(e,"tabindex","-1"),g(e,"data-root",!this.isSubmenu),g(e,"data-submenu",this.isSubmenu),this.#r.set(e),P(()=>this.#r.set(null)),l(()=>g(e,"data-open",this.#i())),this.#h.attachMenu(e),this.#v(!1);const i=this.#B.bind(this);this.isSubmenu?this.#o?.onTransitionEvent(i):(t.listen("transitionstart",i),t.listen("transitionend",i),t.listen("animationend",this.#O),t.listen("vds-menu-resize",this.#O))}#w(t){this.#c=t}#v(t){const e=f(this.#r);e&&g(e,"aria-hidden",ie(!t))}#x(t){this.#p.set(t)}#f=!1;#T(t,e){if(this.#f=Zt(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(),i=this.#r();if(s&&(g(s,"aria-controls",t&&this.#e),g(s,"aria-expanded",ie(t))),i&&g(i,"aria-labelledby",t&&this.#s),this.#i.set(t),this.#q(e),dt(),this.#f){t?i?.focus():s?.focus();for(const n of[this.el,i])n&&n.setAttribute("data-keyboard","")}else for(const n of[this.el,i])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&&Ws(e,t)||t.stopPropagation()}#C(t){const e=this.#r();this.#d||e&&Ws(e,t)||this.close(t)}#M(){const t=this.el?.querySelector('[data-part="close-target"]');return this.el&&t&&js(this.el,t,e=>e.getAttribute("role")==="menu")?t:null}#q(t){this.isSubmenu||(this.#i()?this.#t.remote.pauseControls(t):this.#t.remote.resumeControls(t))}#D(t){this.#l.add(t),new q(t).add("open",this.#R).add("close",this.#F),P(this.#_)}#_=this.#V.bind(this);#V(t){this.#l.delete(t)}#L=!1;#R=this.#I.bind(this);#I(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 i of[s.el,s.triggerElement])i?.setAttribute("aria-hidden","true");if(e){const s=t.target.el;for(const i of e.children)i.contains(s)?i.setAttribute("data-open",""):i!==s&&i.setAttribute("data-hidden","")}}#F=this.#H.bind(this);#H(t){this.#L=!1;const e=this.#r();this.isSubmenu&&this.triggerElement?.setAttribute("aria-hidden","false");for(const s of this.#l)for(const i of[s.el,s.triggerElement])i?.setAttribute("aria-hidden","false");if(e)for(const s of e.children)s.removeAttribute("data-open"),s.removeAttribute("data-hidden")}#O=ct(()=>{const t=f(this.#r);if(!t)return;let e=0,s=getComputedStyle(t),i=[...t.children];for(const n of["paddingTop","paddingBottom","borderTopWidth","borderBottomWidth"])e+=parseFloat(s[n])||0;for(const n of i)if(yt(n)&&n.style.display==="contents")i.push(...n.children);else if(n.nodeType===3)e+=parseFloat(getComputedStyle(n).fontSize);else if(yt(n)){if(!Qs(n))continue;const r=getComputedStyle(n);e+=n.offsetHeight+(parseFloat(r.marginTop)||0)+(parseFloat(r.marginBottom)||0)}Z(t,"--menu-height",e+"px")});#N=!1;#B(t){const e=this.#r();e&&t.propertyName==="height"&&(this.#N=t.type==="transitionstart",g(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),dt())}close(t){f(this.#i)&&(this.#u.hide(t),dt())}}Qt([x],_t.prototype,"triggerElement"),Qt([x],_t.prototype,"contentElement"),Qt([x],_t.prototype,"isSubmenu"),Qt([O],_t.prototype,"open"),Qt([O],_t.prototype,"close");class ll extends T(HTMLElement,_t){static tagName="media-menu"}class dl extends hs{}class cl extends T(HTMLElement,dl){static tagName="media-menu-item"}class ul extends k{static props={container:null,disabled:!1};#t=null;#e;onSetup(){this.#e=b(),X($e,{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,ht(()=>{ht(()=>{this.connectScope&&l(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;g(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 yt(t)?t:t?document.querySelector(t):document.body}}const $e=rt();class hl extends k{static props={placement:null,offset:0,alignOffset:0};#t;constructor(){super(),new at;const{placement:t}=this.$props;this.setAttributes({"data-placement":t})}onAttach(t){if(this.#t=I(B),this.#t.attachMenuItems(this),J($e)){const e=I($e);e&&(X($e,null),e.attach(t),P(()=>e.attach(null)))}}onConnect(t){l(this.#e.bind(this))}#e(){const{expanded:t}=this.#t;if(!this.el||!t())return;const e=this.$props.placement();if(!e)return;Object.assign(this.el.style,{position:"absolute",top:0,left:0,width:"max-content"});const{offset:s,alignOffset:i}=this.$props;P(Ys(this.el,this.#i(),e,{offsetVarName:"media-menu",xOffset:i(),yOffset:s()})),P(this.#s.bind(this))}#s(){this.el&&(this.el.removeAttribute("style"),this.el.style.display="none")}#i(){return this.#t.button()}}class pl extends T(HTMLElement,hl){static tagName="media-menu-items"}class ml extends T(HTMLElement,ul){static tagName="media-menu-portal";static attrs={disabled:{converter(t){return C(t)?t:t!==null}}}}class Ui extends k{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=_(()=>{const{sort:t}=this.$props,{qualities:e}=this.#t.$state;return wi(e(),t()==="descending")});constructor(){super(),this.#s=new Pt,this.#s.onValueChange=this.#o.bind(this)}onSetup(){this.#t=b(),J(B)&&(this.#e=I(B))}onConnect(t){l(this.#a.bind(this)),l(this.#r.bind(this)),l(this.#n.bind(this))}getOptions(){const{autoLabel:t,hideBitrate:e}=this.$props;return[{value:"auto",label:t},...this.#i().map(s=>{const i=s.bitrate&&s.bitrate>=0?`${H(s.bitrate/1e6,2)} Mbps`:null;return{quality:s,label:s.height+"p",value:this.#c(s),bitrate:()=>e()?null:i}})]}#a(){this.#s.value=this.#l()}#n(){const{autoLabel:t}=this.$props,{autoQuality:e,quality:s}=this.#t.$state,i=s()?s().height+"p":"";this.#e?.hint.set(e()?t()+(i?` (${i})`:""):i)}#r(){this.#e?.disable(this.disabled)}#o(t,e){if(this.disabled)return;if(t==="auto"){this.#t.remote.changeQuality(-1,e),this.dispatch("change",{detail:"auto",trigger:e});return}const{qualities:s}=this.#t.$state,i=f(s).findIndex(n=>this.#c(n)===t);if(i>=0){const n=f(s)[i];this.#t.remote.changeQuality(i,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.height+"_"+t.bitrate}}const ms=Ui.prototype;x(ms,"value"),x(ms,"disabled"),O(ms,"getOptions");class fl extends T(HTMLElement,Ui){static tagName="media-quality-radio-group";onConnect(){qt(this,(t,e)=>{const s=e.bitrate,i=t.querySelector('[data-part="bitrate"]');s&&i&&l(()=>{i.textContent=s()||""})})}}class Wi extends k{static props={value:""};#t=y(!1);#e={value:this.$props.value,check:this.#r.bind(this),onCheck:null};get checked(){return this.#t()}constructor(){super(),new at}onSetup(){this.setAttributes({value:this.$props.value,"data-checked":this.#t,"aria-checked":U(this.#t)})}onAttach(t){const e=J(B);L(t,"tabindex",e?"-1":"0"),L(t,"role",e?"menuitemradio":"radio"),l(this.#a.bind(this))}onConnect(t){this.#i(),bt(t,this.#n.bind(this)),P(this.#s.bind(this))}#s(){Ft(()=>{I(os).remove(this.#e)},this.connectScope)}#i(){I(os).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 gl=Wi.prototype;x(gl,"checked");class bl extends T(HTMLElement,Wi){static tagName="media-radio"}class Qi extends k{static props={value:""};#t;get values(){return this.#t.values}get value(){return this.#t.value}set value(t){this.#t.value=t}constructor(){super(),this.#t=new Pt,this.#t.onValueChange=this.#s.bind(this)}onSetup(){l(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 zi=Qi.prototype;x(zi,"values"),x(zi,"value");class yl extends T(HTMLElement,Qi){static tagName="media-radio-group"}const vl=[.25,.5,.75,1,1.25,1.5,1.75,2];class ji extends k{static props={normalLabel:"Normal",rates:vl};#t;#e;#s;get value(){return this.#s.value}get disabled(){const{rates:t}=this.$props,{canSetPlaybackRate:e}=this.#t.$state;return!e()||t().length===0}constructor(){super(),this.#s=new Pt,this.#s.onValueChange=this.#o.bind(this)}onSetup(){this.#t=b(),J(B)&&(this.#e=I(B))}onConnect(t){l(this.#i.bind(this)),l(this.#a.bind(this)),l(this.#n.bind(this))}getOptions(){const{rates:t,normalLabel:e}=this.$props;return t().map(s=>({label:s===1?e:s+"",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+"")}#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 fs=ji.prototype;x(fs,"value"),x(fs,"disabled"),O(fs,"getOptions");class $l extends T(HTMLElement,ji){static tagName="media-speed-radio-group";onConnect(){qt(this)}}class wl extends k{static props={src:null,alt:null,crossOrigin:null};static state=new ft({img:null,src:null,alt:null,crossOrigin:null,loading:!0,error:null,hidden:!1});#t;onSetup(){this.#t=b(),this.#o(),this.#l(),this.#c(),this.#i()}onAttach(t){t.style.setProperty("pointer-events","none"),l(this.#n.bind(this)),l(this.#o.bind(this)),l(this.#l.bind(this)),l(this.#c.bind(this)),l(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){l(this.#s.bind(this)),l(this.#u.bind(this))}#e(){const{error:t}=this.$state;return!kt(t())}#s(){const{canLoadPoster:t,poster:e}=this.#t.$state;!t()&&e()&&Bt(e(),"preconnect")}#i(){const{src:t}=this.$props,{poster:e,nativeControls:s}=this.#t.$state;this.el&&g(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 q(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:i}=this.#t.$state,n=this.$props.src()||"",r=n||t()||i();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:i}=this.#t.$state,n=t()!==null?t():s();e.set(/ytimg\.com|vimeo/.test(i()||"")?null:n===!0?"anonymous":n)}#u(){const{loading:t,error:e}=this.$state,{canLoadPoster:s,poster:i}=this.#t.$state;t.set(s()&&!!i()),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 Tl extends T(HTMLElement,wl){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;l(()=>{const{loading:i,hidden:n}=this.$state;this.#t.style.display=i()||n()?"none":""}),l(()=>{g(this.#t,"alt",e()),g(this.#t,"crossorigin",s()),g(this.#t,"src",t())}),this.#t.parentNode!==this&&this.prepend(this.#t)}}const Ct=new ft({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 Yi(this.min,this.max,this.value)},get fillPercent(){return this.fillRate*100},get pointerRate(){return Yi(this.min,this.max,this.pointerValue)},get pointerPercent(){return this.pointerRate*100}});function Yi(a,t,e){const s=t-a,i=e-a;return s>0?i/s:0}const Dt=rt(()=>({}));class Xi extends st{#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),P(this.#s.bind(this))}#s(){this.#e?.disconnect(),this.#e=void 0}}function kl(a,t,e,s){return De(a,H(e,Fa(s)),t)}function Sl(a,t,e,s){const i=De(0,e,1),n=t-a,r=n*i,o=r/s,d=s*Math.round(o);return a+d}const gs={Left:-1,ArrowLeft:-1,Up:1,ArrowUp:1,Right:1,ArrowRight:1,Down:-1,ArrowDown:-1};class xl extends st{#t;#e;#s;constructor(t,e){super(),this.#t=t,this.#e=e}onSetup(){J(Wt)&&(this.#s=I(Wt))}onConnect(t){l(this.#c.bind(this,t)),l(this.#u.bind(this,t)),this.#t.swipeGesture&&l(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 q(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(kt(this.#n)||Ne(t))return;const e=t.touches[0],s=e.clientX-this.#n.clientX,i=e.clientY-this.#n.clientY,n=this.$state.dragging();!n&&Math.abs(i)>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;G(t,"focus",this.#h.bind(this)),!(e()||this.#t.isDisabled())&&new q(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 q(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:i,max:n,dragging:r}=this.$state,o=Math.max(i(),Math.min(t,n()));s.set(o);const d=this.createEvent("value-change",{detail:o,trigger:e});if(this.dispatch(d),this.#t.onValueChange?.(d),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:i}=this.$state;s.set(t),this.dispatch("pointer-value-change",{detail:t,trigger:e}),i()&&this.#d(t,e)}#m(t){let e,s=this.el.getBoundingClientRect(),{min:i,max:n}=this.$state;if(this.$props.orientation()==="vertical"){const{bottom:r,height:o}=s;e=(r-t.clientY)/o}else if(this.#n&&ot(this.#r)){const{width:r}=this.#a.getBoundingClientRect(),o=(t.clientX-this.#n.clientX)/r,d=n()-i(),c=d*Math.abs(o);e=(o<0?this.#r-c:this.#r+c)/d}else{const{left:r,width:o}=s;e=(t.clientX-r)/o}return Math.max(i(),Math.min(n(),this.#t.roundValue(Sl(i(),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 i=this.createEvent("drag-start",{detail:t,trigger:e});this.dispatch(i),this.#t.onDragStart?.(i),this.#s?.onDragStart?.()}#v(t,e){const{dragging:s}=this.$state;if(!s())return;s.set(!1),this.#e.remote.resumeControls(e);const i=this.createEvent("drag-end",{detail:t,trigger:e});this.dispatch(i),this.#t.onDragEnd?.(i),this.#n=null,this.#r=null,this.#s?.onDragEnd?.()}#x;#f=!1;#T(t){if(!Object.keys(gs).includes(t.key))return;const{key:s}=t,i=this.#S(t);if(!kt(i)){this.#p(i,t),this.#d(i,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(gs).includes(t.key)||!kt(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:i}=this.$state;return e==="Home"||e==="PageUp"?s():e==="End"||e==="PageDown"?i():!t.metaKey&&/^[0-9]$/.test(e)?(i()-s())/10*Number(e):null}#P(t){const{key:e,shiftKey:s}=t;t.preventDefault(),t.stopPropagation();const{shiftKeyMultiplier:i}=this.$props,{min:n,max:r,value:o,pointerValue:d}=this.$state,c=this.#t.getStep(),u=this.#t.getKeyStep(),p=s?u*i():u,v=Number(gs[e]),w=p*v,S=this.#f?d():this.#t.getValue?.()??o(),N=(S+w)/c;return Math.max(n(),Math.min(r(),Number((c*N).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=Tt(t=>{this.#p(this.#m(t),t)},20,{leading:!0})}class et extends st{static props={hidden:!1,disabled:!1,step:1,keyStep:1,orientation:"horizontal",shiftKeyMultiplier:5};#t;#e;#s=y(!0);#i=y(!0);constructor(t){super(),this.#e=t}onSetup(){this.#t=b();const t=new at;t.attach(this),this.$state.focused=t.focused.bind(t),J(Dt)||X(Dt,{default:"value"}),X(ps,{orientation:this.$props.orientation,disabled:this.#e.isDisabled,preview:y(null)}),l(this.#r.bind(this)),l(this.#o.bind(this)),l(this.#l.bind(this)),this.#u(),new xl(this.#e,this.#t).attach(this),new Xi({callback:this.#a.bind(this)}).attach(this)}onAttach(t){L(t,"role","slider"),L(t,"tabindex","0"),L(t,"autocomplete","off"),l(this.#h.bind(this))}onConnect(t){P(zs(t,this.#s.set)),l(this.#n.bind(this))}#a(t){this.#i.set(t[0].isIntersecting)}#n(){const{hidden:t}=this.$props;this.$state.hidden.set(t()||!this.#s()||!this.#i.bind(this))}#r(){const{dragging:t,value:e,min:s,max:i}=this.$state;f(t)||e.set(kl(s(),i(),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 ie(this.#e.isDisabled())}#u(){const{orientation:t}=this.$props,{dragging:e,active:s,pointing:i}=this.$state;this.setAttributes({"data-dragging":e,"data-pointing":i,"data-active":s,"aria-disabled":this.#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(H(t(),3),H(e(),3))}#d=ct((t,e)=>{this.el?.style.setProperty("--slider-fill",t+"%"),this.el?.style.setProperty("--slider-pointer",e+"%")})}class Pl extends k{static props={...et.props,step:25,keyStep:25,shiftKeyMultiplier:2,min:0,max:300};static state=Ct;#t;onSetup(){this.#t=b(),X(Dt,{default:"percent",percent:(t,e)=>H(this.$state.value(),e)+"%"}),new et({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),l(this.#i.bind(this)),l(this.#a.bind(this))}onAttach(t){t.setAttribute("data-media-audio-gain-slider",""),L(t,"aria-label","Audio Boost");const{canSetAudioGain:e}=this.#t.$state;this.setAttributes({"data-supported":e,"aria-hidden":U(()=>!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=H(1+t.detail/100,2);this.#t.remote.changeAudioGain(e,t)}#o(t){this.#r(t)}#l(t){this.#r(t)}}class Cl extends T(HTMLElement,Pl){static tagName="media-audio-gain-slider"}class El extends k{static props={...et.props,step:1,keyStep:1,shiftKeyMultiplier:1};static state=Ct;#t;#e=_(()=>{const{qualities:t}=this.#t.$state;return wi(t())});onSetup(){this.#t=b(),new et({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),l(this.#a.bind(this)),l(this.#n.bind(this))}onAttach(t){t.setAttribute("data-media-quality-slider",""),L(t,"aria-label","Video Quality");const{qualities:e,canSetQuality:s}=this.#t.$state,i=_(()=>s()&&e().length>0);this.setAttributes({"data-supported":i,"aria-hidden":U(()=>!i())})}#s(){const{value:t}=this.$state;return t()}#i(){const{quality:t}=this.#t.$state;if(!t())return"";const{height:e,bitrate:s}=t(),i=s&&s>0?`${(s/1e6).toFixed(2)} Mbps`:null;return e?`${e}p${i?` (${i})`:""}`:"Auto"}#a(){const t=this.#e();this.$state.max.set(Math.max(0,t.length-1))}#n(){let{quality:t}=this.#t.$state,e=this.#e(),s=Math.max(0,e.indexOf(t()));this.$state.value.set(s),this.dispatch("value-change",{detail:s})}#r(){const{disabled:t}=this.$props,{canSetQuality:e,qualities:s}=this.#t.$state;return t()||s().length<=1||!e()}#o=Tt(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 Al extends T(HTMLElement,El){static tagName="media-quality-slider"}class Ji extends k{static props={...et.props,step:.1,keyStep:5,shiftKeyMultiplier:2,pauseWhileDragging:!1,noSwipeGesture:!1,seekingRequestThrottle:100};static state=Ct;#t;#e;#s=y(null);constructor(){super();const{noSwipeGesture:t}=this.$props;new et({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=b(),X(Dt,{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)}),l(this.#r.bind(this)),l(this.#n.bind(this))}onAttach(t){t.setAttribute("data-media-time-slider",""),L(t,"aria-label","Seek")}onConnect(t){l(this.#o.bind(this)),re(this.#t.textTracks,"chapters",this.#s.set)}#i(){const{bufferedEnd:t,duration:e}=this.#t.$state;return H(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=Tt(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}=I(ps);t&&e()&&g(t,"data-preview",this.$state.active())}#l(t,e){this.#t.remote.seeking(t,e)}#c(t,e,s){this.#e.cancel();const{live:i}=this.#t.$state;if(i()&&e>=99){this.#t.remote.seekToLiveEdge(s);return}this.#t.remote.seek(t,s)}#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:i}=this.$props;i()&&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 H(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)?`${ye(t)} out of ${ye(e())}`:"live"}#f(t){const{duration:e}=this.#t.$state;return H(t/100*e(),5)}#T(t){const{liveEdge:e,duration:s}=this.#t.$state,i=Math.max(0,Math.min(1,e()?1:Math.min(t,s())/s()));return Number.isNaN(i)?0:Number.isFinite(i)?i*100:100}#k(t){const e=this.#f(t),{live:s,duration:i}=this.#t.$state;return Number.isFinite(e)?(s()?e-i():e).toFixed(0):"LIVE"}#S(t,e){const s=this.#f(t),{live:i,duration:n}=this.#t.$state,r=i()?s-n():s;return Number.isFinite(s)?`${r<0?"-":""}${be(Math.abs(r),e)}`:"LIVE"}}class Zi extends k{static props={disabled:!1};#t;#e;#s;#i=null;#a=[];#n=y(null);#r=y([]);#o=y(-1);#l=y(-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=b(),this.#e=Mt(Ji.state)}onAttach(t){re(this.#t.textTracks,"chapters",this.#u.bind(this)),l(this.#E.bind(this))}onConnect(){P(()=>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&&Ft(()=>this.#d(),this.#s=xa())}#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&&l(this.#p.bind(this))}#p(){const{hidden:t}=this.#e;t()||(l(this.#m.bind(this)),l(this.#b.bind(this)),l(this.#g.bind(this)),l(this.#v.bind(this)))}#m(){const t=this.#r();if(!t.length)return;let e,{seekableStart:s,seekableEnd:i}=this.#t.$state,n=s(),r=i()||t[t.length-1].endTime,o=r-n,d=100;for(let c=0;cd?this.#y(d,u,100):u0&&e<100),g(t,"data-ended",e===100))}#w(t,e){let s=0,i=this.#r();if(e===0)return 0;if(e===100)return i.length-1;let{seekableStart:n}=this.#t.$state,r=n(),o=this.#k(i);for(let d=t;d=0&&s<100)return d;return 0}#v(){this.#x(this.#f())}#x=ct(t=>{let e,s=this.#r(),{seekableStart:i}=this.#t.$state,n=i(),r=this.#k(s);for(let o=this.#c;o=p?100:(e-u)/(p-u)*100,3))}#P(t){let e=[],{seekableStart:s,seekableEnd:i,duration:n}=this.#t.$state,r=s(),o=i();t=t.filter(u=>u.startTime<=o&&u.endTime>=r);const d=t[0];d&&d.startTime>r&&e.push(new window.VTTCue(r,d.startTime,""));for(let u=0;u0&&e.push(new window.VTTCue(p.endTime,p.endTime+w,""))}}const c=t[t.length-1];if(c){e.push(c);const u=n();u>=0&&u-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 q(e).add("add-cue",s).add("remove-cue",s),l(this.#C.bind(this))}return this.#i=this.#_(),this.#i&&l(this.#q.bind(this)),()=>{this.#i&&(this.#i.textContent="",this.#i=null)}}#C(){this.#t.$state.duration(),this.#M()}#M=Ce(()=>{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);#q(){const t=this.activePointerCue||this.activeCue;this.#i&&(this.#i.textContent=t?.text||"")}#D(){let t=this.el;for(;t&&t.getAttribute("role")!=="slider";)t=t.parentElement;return t}#_(){const t=this.#D();return t?t.querySelector('[data-part="chapter-title"]'):null}}const we=Zi.prototype;x(we,"cues"),x(we,"activeCue"),x(we,"activePointerCue"),O(we,"setRefs");class Ml extends T(HTMLElement,Zi){static tagName="media-slider-chapters";#t=null;onConnect(){ht(()=>{if(!this.connectScope)return;const t=this.querySelector("template");t&&(this.#t=t,l(this.#e.bind(this)))})}#e(){if(!this.#t)return;const t=Fe(this.#t,this.cues.length||1);this.setRefs(t)}}class zt extends k{static props={...et.props,min:0,max:100,value:0};static state=Ct;constructor(){super(),new et({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(){l(this.#s.bind(this)),l(this.#i.bind(this))}#t(){const{value:t}=this.$state;return Math.round(t())}#e(){const{value:t,max:e}=this.$state;return H(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 Ll extends T(HTMLElement,zt){static tagName="media-slider"}class ql extends k{static props={offset:0,noClamp:!1};#t;onSetup(){this.#t=I(ps);const{active:t}=Mt(zt.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),P(()=>e.set(null)),l(this.#e.bind(this));const s=new ResizeObserver(this.#e.bind(this));s.observe(t),P(()=>s.disconnect())}#e=ct(()=>{const{disabled:t,orientation:e}=this.#t;if(t())return;const s=this.el,{offset:i,noClamp:n}=this.$props;s&&_l(s,{clamp:!n(),offset:i(),orientation:e()})})}function _l(a,{clamp:t,offset:e,orientation:s}){const i=getComputedStyle(a),n=parseFloat(i.width),r=parseFloat(i.height),o={top:null,right:null,bottom:null,left:null};if(o[s==="horizontal"?"bottom":"left"]=`calc(100% + var(--media-slider-preview-offset, ${e}px))`,s==="horizontal"){const d=n/2;if(!t)o.left=`calc(var(--slider-pointer) - ${d}px)`;else{const c=`max(0px, calc(var(--slider-pointer) - ${d}px))`,u=`calc(100% - ${n}px)`;o.left=`min(${c}, ${u})`}}else{const d=r/2;if(!t)o.bottom=`calc(var(--slider-pointer) - ${d}px)`;else{const c=`max(${d}px, calc(var(--slider-pointer) - ${d}px))`,u=`calc(100% - ${r}px)`;o.bottom=`min(${c}, ${u})`}}Object.assign(a.style,o)}class Dl extends T(HTMLElement,ql){static tagName="media-slider-preview"}class Il extends k{}class Vl extends T(HTMLElement,Il){static tagName="media-slider-steps";#t=null;onConnect(t){ht(()=>{this.connectScope&&(this.#t=t.querySelector("template"),this.#t&&l(this.#e.bind(this)))})}#e(){if(!this.#t)return;const{min:t,max:e,step:s}=Mt(Ct),i=(e()-t())/s();Fe(this.#t,Math.floor(i)+1)}}const mt=new Map,Te=new Map;class vs{#t;#e;#s;$images=y([]);static create(t,e){const s=b();return new vs(t,e,s)}constructor(t,e,s){this.#e=t,this.#s=e,this.#t=s,l(this.#i.bind(this))}#i(){const{canLoad:t}=this.#t.$state;if(!t())return;const e=this.#e();if(e){if(C(e)&&mt.has(e)){const s=mt.get(e);if(mt.delete(e),mt.set(e,s),mt.size>99){const i=mt.keys().next().value;mt.delete(i)}this.$images.set(mt.get(e))}else if(C(e)){const s=this.#s(),i=e+"::"+s;if(!Te.has(i)){const n=new Promise(async(r,o)=>{try{const d=await fetch(e,{credentials:oe(s)});if(d.headers.get("content-type")==="application/json"){const u=await d.json();if(Y(u))if(u[0]&&"text"in u[0])r(this.#r(u));else{for(let p=0;p{try{const{cues:p}=await u(d);r(this.#r(p))}catch(p){o(p)}})}catch(d){o(d)}}).then(r=>(mt.set(i,r),r)).catch(r=>{this.#u(e,r)}).finally(()=>{C(i)&&Te.delete(i)});Te.set(i,n)}Te.get(i)?.then(n=>{this.$images.set(n||[])})}else if(Y(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,i)=>(ut(s.url&&C(s.url)),ut("startTime"in s&&ot(s.startTime)),{...s,url:C(s.url)?this.#l(s.url,e):s.url}))}#n(t){ut(C(t.url)),ut(Y(t.tiles)&&t.tiles?.length);const e=new URL(t.url),s=[],i="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:i,height:n,coords:{x:r.x,y:r.y}});return s}#r(t){for(let i=0;i{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!kt(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:i}=this.$state,n=-1,r=null;for(let o=t.length-1;o>=0;o--){const d=t[o];if(e>=d.startTime&&(!d.endTime||e1?v:1;this.#d(t,"--thumbnail-width",`${i*S}px`),this.#d(t,"--thumbnail-height",`${n*S}px`),this.#d(t,"--thumbnail-aspect-ratio",String(H(i/n,5))),this.#d(e,"width",`${e.naturalWidth*S}px`),this.#d(e,"height",`${e.naturalHeight*S}px`),this.#d(e,"transform",s.coords?`translate(-${s.coords.x*S}px, -${s.coords.y*S}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 Ol=He('');class ta extends T(HTMLElement,Rl){static tagName="media-thumbnail";static attrs={crossOrigin:"crossorigin"};#t;#e=this.#s();onSetup(){this.#t=b(),this.$state.img.set(this.#e)}onConnect(){const{src:t,crossOrigin:e}=this.$state;this.#e.parentNode!==this&&this.prepend(this.#e),l(()=>{g(this.#e,"src",t()),g(this.#e,"crossorigin",e())})}#s(){return Be(Ol)}}class Nl extends ta{static tagName="media-slider-thumbnail";#t;#e;onSetup(){super.onSetup(),this.#t=b(),this.#e=Mt(zt.state)}onConnect(){super.onConnect(),l(this.#s.bind(this))}#s(){const{duration:t,clipStartTime:e}=this.#t.$state;this.time=e()+this.#e.pointerRate()*t()}}class ea extends k{static props={type:"pointer",format:null,showHours:!1,showMs:!1,padHours:null,padMinutes:null,decimalPlaces:2};#t;#e;#s;onSetup(){this.#s=Mt(zt.state),this.#t=I(Dt),this.#e=_(this.getValueText.bind(this))}getValueText(){const{type:t,format:e,decimalPlaces:s,padHours:i,padMinutes:n,showHours:r,showMs:o}=this.$props,{value:d,pointerValue:c,min:u,max:p}=this.#s,v=e?.()??this.#t.default,w=t()==="current"?d():c();if(v==="percent"){const S=p()-u(),N=w/S*100;return(this.#t.percent??H)(N,s())+"%"}else return v==="time"?(this.#t.time??be)(w,{padHrs:i(),padMins:n(),showHrs:r(),showMs:o()}):(this.#t.value?.(w)??w.toFixed(2))+""}}const Fl=ea.prototype;O(Fl,"getValueText");class Hl extends T(HTMLElement,ea){static tagName="media-slider-value";static attrs={padMinutes:{converter:Ca}};onConnect(){l(()=>{const{smallWhen:t}=E(),e=this.getValueText(),s=e.endsWith("%")?"\u21C5":"\u21C4",i=s&&!t()?`(${s}) `:"";this.textContent=i+e})}}class sa extends k{static props={src:null,crossOrigin:null};static state=new ft({video:null,src:null,crossOrigin:null,canPlay:!1,error:null,hidden:!1});#t;#e;get video(){return this.$state.video()}onSetup(){this.#t=b(),this.#e=Mt(zt.state),this.#a(),this.setAttributes({"data-loading":this.#n.bind(this),"data-hidden":this.$state.hidden,"data-error":this.#r.bind(this),"aria-hidden":U(this.$state.hidden)})}onAttach(t){l(this.#s.bind(this)),l(this.#i.bind(this)),l(this.#a.bind(this)),l(this.#o.bind(this)),l(this.#l.bind(this)),l(this.#h.bind(this))}#s(){const t=this.$state.video();t&&(t.readyState>=2&&this.#c(),new q(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,i=t()!==null?t():s();e.set(i===!0?"anonymous":i)}#n(){const{canPlay:t,hidden:e}=this.$state;return!t()&&!e()}#r(){const{error:t}=this.$state;return!kt(t)}#o(){const{src:t,hidden:e}=this.$state,{canLoad:s,duration:i}=this.#t.$state;e.set(s()&&(!t()||this.#r()||!Number.isFinite(i())))}#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:i}=this.#e,n=t();e()&&n&&Number.isFinite(s())&&Number.isFinite(i())&&(n.currentTime=i()*s())}}const Bl=sa.prototype;x(Bl,"video");const Gl=He('');class Kl extends T(HTMLElement,sa){static tagName="media-slider-video";#t;#e=this.#s();onSetup(){this.#t=b(),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),l(()=>{g(this.#e,"crossorigin",s()),g(this.#e,"preload",t()?"auto":"none"),g(this.#e,"src",e())})}#s(){return Be(Gl)}}class Ul extends k{static props={...et.props,step:.25,keyStep:.25,shiftKeyMultiplier:2,min:0,max:2};static state=Ct;#t;onSetup(){this.#t=b(),new et({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),l(this.#i.bind(this)),l(this.#a.bind(this))}onAttach(t){t.setAttribute("data-media-speed-slider",""),L(t,"aria-label","Speed");const{canSetPlaybackRate:e}=this.#t.$state;this.setAttributes({"data-supported":e,"aria-hidden":U(()=>!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 H(t,2)}#r(){const{disabled:t}=this.$props,{canSetPlaybackRate:e}=this.#t.$state;return t()||!e()}#o=Tt(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 Wl extends T(HTMLElement,Ul){static tagName="media-speed-slider"}class Ql extends T(HTMLElement,Ji){static tagName="media-time-slider"}class zl extends k{static props={...et.props,keyStep:5,shiftKeyMultiplier:2};static state=Ct;#t;onSetup(){this.#t=b();const{audioGain:t}=this.#t.$state;X(Dt,{default:"percent",value(e){return(e*(t()??1)).toFixed(2)},percent(e){return Math.round(e*(t()??1))}}),new et({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),l(this.#n.bind(this))}onAttach(t){t.setAttribute("data-media-volume-slider",""),L(t,"aria-label","Volume");const{canSetVolume:e}=this.#t.$state;this.setAttributes({"data-supported":e,"aria-hidden":U(()=>!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 H(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=Tt(this.#o.bind(this),25);#o(t){if(!t.trigger)return;const e=H(t.detail/100,3);this.#t.remote.changeVolume(e,t)}#l(t){this.#r(t)}#c(t){this.#r(t)}}class jl extends T(HTMLElement,zl){static tagName="media-volume-slider"}class Yl extends k{static props={size:96,trackWidth:8,fillPercent:50};onConnect(t){ht(()=>{if(!this.connectScope)return;const e=t.querySelector("svg"),s=e.firstElementChild,i=s.nextElementSibling;l(this.#t.bind(this,e,s,i))})}#t(t,e,s){const{size:i,trackWidth:n,fillPercent:r}=this.$props;g(t,"width",i()),g(t,"height",i()),g(e,"stroke-width",n()),g(s,"stroke-width",n()),g(s,"stroke-dashoffset",100-r())}}class Xl extends T(ce,Yl){static tagName="media-spinner";render(){return h` - `}}class Jl extends k{static props={type:"current",showHours:!1,padHours:null,padMinutes:null,remainder:!1,toggle:!1,hidden:!1};static state=new ft({timeText:"",hidden:!1});#t;#e=y(null);#s=y(!0);#i=y(!0);onSetup(){this.#t=b(),this.#o();const{type:t}=this.$props;this.setAttributes({"data-type":t,"data-remainder":this.#u.bind(this)}),new Xi({callback:this.#a.bind(this)}).attach(this)}onAttach(t){t.hasAttribute("role")||l(this.#l.bind(this)),l(this.#o.bind(this))}onConnect(t){P(zs(t,this.#s.set)),l(this.#n.bind(this)),l(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&&bt(this.el,this.#h.bind(this))}#o(){const{hidden:t,timeText:e}=this.$state,{duration:s}=this.#t.$state;if(t())return;const{type:i,padHours:n,padMinutes:r,showHours:o}=this.$props,d=this.#c(i()),c=s(),u=this.#u();if(!Number.isFinite(d+c)){e.set("LIVE");return}const p=u?Math.max(0,c-d):d,v=be(p,{padHrs:n(),padMins:r(),showHrs:o()});e.set((u?"-":"")+v)}#l(){if(!this.el)return;const{toggle:t}=this.$props;g(this.el,"role",t()?"timer":null),g(this.el,"tabindex",t()?0:null)}#c(t){const{bufferedEnd:e,duration:s,currentTime:i}=this.#t.$state;switch(t){case"buffered":return e();case"duration":return s();default:return i()}}#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 Zl extends T(HTMLElement,Jl){static tagName="media-time";onConnect(){l(()=>{this.textContent=this.$state.timeText()})}}class td extends k{}class ed extends T(HTMLElement,td){static tagName="media-title";#t;onSetup(){this.#t=b()}onConnect(){l(this.#e.bind(this))}#e(){const{title:t}=this.#t.$state;this.textContent=t()}}const Et=rt();class sd extends k{static props={placement:"top center",offset:0,alignOffset:0};constructor(){super(),new at;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=I(Et);P(()=>e.detachContent(t)),P(ht(()=>{this.connectScope&&l(this.#e.bind(this))}))}#t(t){I(Et).attachContent(t)}#e(){const{showing:t}=I(Et);if(!t())return;const{placement:e,offset:s,alignOffset:i}=this.$props;return Ys(this.el,this.#s(),e(),{offsetVarName:"media-tooltip",xOffset:i(),yOffset:s()})}#s(){return I(Et).trigger()}}class id extends T(HTMLElement,sd){static tagName="media-tooltip-content"}let ad=0;class nd extends k{static props={showDelay:700};#t=`media-tooltip-${++ad}`;#e=y(null);#s=y(null);#i=y(!1);constructor(){super(),new at;const{showDelay:t}=this.$props;new Ki({trigger:this.#e,content:this.#s,showDelay:t,listen(e,s,i){l(()=>{le()&&G(e,"focus",s),G(e,"blur",i)}),new q(e).add("touchstart",n=>n.preventDefault(),{passive:!1}).add("mouseenter",s).add("mouseleave",i)},onChange:this.#l.bind(this)})}onAttach(t){t.style.setProperty("display","contents")}onSetup(){X(Et,{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`,""),g(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",L(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&&g(e,"aria-describedby",t?this.#t:null);for(const i of[this.el,e,s])i&&g(i,"data-visible",t);this.#i.set(t)}}class rd extends T(HTMLElement,nd){static tagName="media-tooltip"}class od extends k{constructor(){super(),new at}onConnect(t){P(ht(()=>{if(!this.connectScope)return;this.#t();const e=I(Et);P(()=>{const s=this.#e();s&&e.detachTrigger(s)})}))}#t(){const t=this.#e(),e=I(Et);t&&e.attachTrigger(t)}#e(){const t=this.el.firstElementChild;return t?.localName==="button"||t?.getAttribute("role")==="button"?t:this.el}}class ld extends T(HTMLElement,od){static tagName="media-tooltip-trigger";onConnect(){this.style.display="contents"}}$(Ko),$(Oo),$(Fo),$(Tl),$(uo),$(rd),$(ld),$(id),$(Eo),$(So),$(go),$(yo),$(Po),$(Mo),$(mo),$($o),$(qo),$(Ll),$(Cl),$(jl),$(Ql),$(Ul),$(Al),$(Ml),$(Vl),$(Dl),$(Hl),$(Nl),$(Kl),$(ll),$(Zo),$(ml),$(pl),$(cl),$(Qo),$(zo),$($l),$(Uo),$(fl),$(Xo),$(yl),$(bl),$(Bo),$(ta),$(Do),$(To),$(Zl),$(ed),$(Vo),$(Xl);export{He as a,Be as c}; + `}}class Jl extends k{static props={type:"current",showHours:!1,padHours:null,padMinutes:null,remainder:!1,toggle:!1,hidden:!1};static state=new ft({timeText:"",hidden:!1});#t;#e=y(null);#s=y(!0);#i=y(!0);onSetup(){this.#t=b(),this.#o();const{type:t}=this.$props;this.setAttributes({"data-type":t,"data-remainder":this.#u.bind(this)}),new Xi({callback:this.#a.bind(this)}).attach(this)}onAttach(t){t.hasAttribute("role")||l(this.#l.bind(this)),l(this.#o.bind(this))}onConnect(t){P(zs(t,this.#s.set)),l(this.#n.bind(this)),l(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&&bt(this.el,this.#h.bind(this))}#o(){const{hidden:t,timeText:e}=this.$state,{duration:s}=this.#t.$state;if(t())return;const{type:i,padHours:n,padMinutes:r,showHours:o}=this.$props,d=this.#c(i()),c=s(),u=this.#u();if(!Number.isFinite(d+c)){e.set("LIVE");return}const p=u?Math.max(0,c-d):d,v=be(p,{padHrs:n(),padMins:r(),showHrs:o()});e.set((u?"-":"")+v)}#l(){if(!this.el)return;const{toggle:t}=this.$props;g(this.el,"role",t()?"timer":null),g(this.el,"tabindex",t()?0:null)}#c(t){const{bufferedEnd:e,duration:s,currentTime:i}=this.#t.$state;switch(t){case"buffered":return e();case"duration":return s();default:return i()}}#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 Zl extends T(HTMLElement,Jl){static tagName="media-time";onConnect(){l(()=>{this.textContent=this.$state.timeText()})}}class td extends k{}class ed extends T(HTMLElement,td){static tagName="media-title";#t;onSetup(){this.#t=b()}onConnect(){l(this.#e.bind(this))}#e(){const{title:t}=this.#t.$state;this.textContent=t()}}const Et=rt();class sd extends k{static props={placement:"top center",offset:0,alignOffset:0};constructor(){super(),new at;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=I(Et);P(()=>e.detachContent(t)),P(ht(()=>{this.connectScope&&l(this.#e.bind(this))}))}#t(t){I(Et).attachContent(t)}#e(){const{showing:t}=I(Et);if(!t())return;const{placement:e,offset:s,alignOffset:i}=this.$props;return Ys(this.el,this.#s(),e(),{offsetVarName:"media-tooltip",xOffset:i(),yOffset:s()})}#s(){return I(Et).trigger()}}class id extends T(HTMLElement,sd){static tagName="media-tooltip-content"}let ad=0;class nd extends k{static props={showDelay:700};#t=`media-tooltip-${++ad}`;#e=y(null);#s=y(null);#i=y(!1);constructor(){super(),new at;const{showDelay:t}=this.$props;new Ki({trigger:this.#e,content:this.#s,showDelay:t,listen(e,s,i){l(()=>{le()&&G(e,"focus",s),G(e,"blur",i)}),new q(e).add("touchstart",n=>n.preventDefault(),{passive:!1}).add("mouseenter",s).add("mouseleave",i)},onChange:this.#l.bind(this)})}onAttach(t){t.style.setProperty("display","contents")}onSetup(){X(Et,{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`,""),g(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",L(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&&g(e,"aria-describedby",t?this.#t:null);for(const i of[this.el,e,s])i&&g(i,"data-visible",t);this.#i.set(t)}}class rd extends T(HTMLElement,nd){static tagName="media-tooltip"}class od extends k{constructor(){super(),new at}onConnect(t){P(ht(()=>{if(!this.connectScope)return;this.#t();const e=I(Et);P(()=>{const s=this.#e();s&&e.detachTrigger(s)})}))}#t(){const t=this.#e(),e=I(Et);t&&e.attachTrigger(t)}#e(){const t=this.el.firstElementChild;return t?.localName==="button"||t?.getAttribute("role")==="button"?t:this.el}}class ld extends T(HTMLElement,od){static tagName="media-tooltip-trigger";onConnect(){this.style.display="contents"}}$(Ko),$(Oo),$(Fo),$(Tl),$(uo),$(rd),$(ld),$(id),$(Eo),$(So),$(go),$(yo),$(Po),$(Mo),$(mo),$($o),$(qo),$(Ll),$(Cl),$(jl),$(Ql),$(Wl),$(Al),$(Ml),$(Vl),$(Dl),$(Hl),$(Nl),$(Kl),$(ll),$(Zo),$(ml),$(pl),$(cl),$(Qo),$(zo),$($l),$(Wo),$(fl),$(Xo),$(yl),$(bl),$(Bo),$(ta),$(Do),$(To),$(Zl),$(ed),$(Vo),$(Xl);export{He as a,Be as c}; diff --git a/assets/js/vendor/vidstack-player/chunks/vidstack-8IHwm4sy.js b/assets/js/vendor/vidstack-player/chunks/vidstack-CqQtTnlu.js similarity index 93% rename from assets/js/vendor/vidstack-player/chunks/vidstack-8IHwm4sy.js rename to assets/js/vendor/vidstack-player/chunks/vidstack-CqQtTnlu.js index 3cddcad..eb8d846 100644 --- a/assets/js/vendor/vidstack-player/chunks/vidstack-8IHwm4sy.js +++ b/assets/js/vendor/vidstack-player/chunks/vidstack-CqQtTnlu.js @@ -1 +1 @@ -import{ao as m,e as c}from"./vidstack-ClmE_LDk.js";import{c as p,a as r}from"./vidstack-PxFj4GI7.js";import"./vidstack-tiQh4UD3.js";import"./vidstack-BFul-1yb.js";import"./vidstack-BqbADcDA.js";import"./vidstack-DB4QmL2O.js";import"./vidstack-C_AxqLKV.js";import"./vidstack-DRH_1tFW.js";import"./vidstack-BfBBPhXV.js";import"./vidstack-Bxv1Qnxe.js";import"/assets/js/vendor/media-icons/lazy.min.js";const d=r('');function l(o,s){const n=p(d);n.innerHTML=m,o.append(n);const e=document.createElement("span");e.classList.add("vds-google-cast-info"),o.append(e);const t=document.createElement("span");t.classList.add("vds-google-cast-device-name"),c(()=>{const{remotePlaybackInfo:i}=s,a=i();return a?.deviceName&&(t.textContent=a.deviceName,e.append("Google Cast on ",t)),()=>{e.textContent=""}})}export{l as insertContent}; +import{ao as m,e as c}from"./vidstack-ClmE_LDk.js";import{c as p,a as r}from"./vidstack-BfdttQuo.js";import"./vidstack-tiQh4UD3.js";import"./vidstack-BFul-1yb.js";import"./vidstack-BqbADcDA.js";import"./vidstack-DB4QmL2O.js";import"./vidstack-C_AxqLKV.js";import"./vidstack-DRH_1tFW.js";import"./vidstack-BfBBPhXV.js";import"./vidstack-Bxv1Qnxe.js";import"/assets/js/vendor/media-icons/lazy.min.js";const d=r('');function l(o,s){const n=p(d);n.innerHTML=m,o.append(n);const e=document.createElement("span");e.classList.add("vds-google-cast-info"),o.append(e);const t=document.createElement("span");t.classList.add("vds-google-cast-device-name"),c(()=>{const{remotePlaybackInfo:i}=s,a=i();return a?.deviceName&&(t.textContent=a.deviceName,e.append("Google Cast on ",t)),()=>{e.textContent=""}})}export{l as insertContent}; diff --git a/assets/js/vendor/vidstack-player/vidstack.js b/assets/js/vendor/vidstack-player/vidstack.js index 0291019..437e8e3 100644 --- a/assets/js/vendor/vidstack-player/vidstack.js +++ b/assets/js/vendor/vidstack-player/vidstack.js @@ -1 +1 @@ -import"./chunks/vidstack-PxFj4GI7.js";import"/assets/js/vendor/media-icons/lazy.min.js";import"./chunks/vidstack-ClmE_LDk.js";import"./chunks/vidstack-tiQh4UD3.js";import"./chunks/vidstack-BFul-1yb.js";import"./chunks/vidstack-BqbADcDA.js";import"./chunks/vidstack-DB4QmL2O.js";import"./chunks/vidstack-C_AxqLKV.js";import"./chunks/vidstack-DRH_1tFW.js";import"./chunks/vidstack-BfBBPhXV.js";import"./chunks/vidstack-Bxv1Qnxe.js"; +import"./chunks/vidstack-BfdttQuo.js";import"/assets/js/vendor/media-icons/lazy.min.js";import"./chunks/vidstack-ClmE_LDk.js";import"./chunks/vidstack-tiQh4UD3.js";import"./chunks/vidstack-BFul-1yb.js";import"./chunks/vidstack-BqbADcDA.js";import"./chunks/vidstack-DB4QmL2O.js";import"./chunks/vidstack-C_AxqLKV.js";import"./chunks/vidstack-DRH_1tFW.js";import"./chunks/vidstack-BfBBPhXV.js";import"./chunks/vidstack-Bxv1Qnxe.js"; diff --git "a/ru/_posts/2024-11-26-\320\262\320\276\320\277\321\200\320\276\321\201\321\213-\320\270-\320\276\321\202\320\262\320\265\321\202\321\213-\320\260\320\273\320\263\320\276\321\200\320\270\321\202\320\274\321\213-\320\275\320\260-\320\277\321\200\320\260\320\272\321\202\320\270\320\272\320\265.md" "b/ru/_posts/2024-11-26-\320\262\320\276\320\277\321\200\320\276\321\201\321\213-\320\270-\320\276\321\202\320\262\320\265\321\202\321\213-\320\260\320\273\320\263\320\276\321\200\320\270\321\202\320\274\321\213-\320\275\320\260-\320\277\321\200\320\260\320\272\321\202\320\270\320\272\320\265.md" index a9a63a0..983cff7 100644 --- "a/ru/_posts/2024-11-26-\320\262\320\276\320\277\321\200\320\276\321\201\321\213-\320\270-\320\276\321\202\320\262\320\265\321\202\321\213-\320\260\320\273\320\263\320\276\321\200\320\270\321\202\320\274\321\213-\320\275\320\260-\320\277\321\200\320\260\320\272\321\202\320\270\320\272\320\265.md" +++ "b/ru/_posts/2024-11-26-\320\262\320\276\320\277\321\200\320\276\321\201\321\213-\320\270-\320\276\321\202\320\262\320\265\321\202\321\213-\320\260\320\273\320\263\320\276\321\200\320\270\321\202\320\274\321\213-\320\275\320\260-\320\277\321\200\320\260\320\272\321\202\320\270\320\272\320\265.md" @@ -38,7 +38,8 @@ nostr: 17:34 Итоги" description=" -Использованное видео: [Scaling Git at Microsoft - Git Merge 2017](https://youtu.be/g_MPGU_m01s) +Использованное видео: +- [Scaling Git at Microsoft - Git Merge 2017](https://youtu.be/g_MPGU_m01s) Музыка Chris Zabriskie (распространяется на условиях лицензии CC BY 4.0): - CGI Snake