@glitchlab/vue-video-player 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.md +112 -15
  2. package/dist/HLSPlayer.vue.d.ts +4 -0
  3. package/dist/HLSPlayer.vue.d.ts.map +1 -1
  4. package/dist/VideoPlayer.vue.d.ts +9 -0
  5. package/dist/VideoPlayer.vue.d.ts.map +1 -1
  6. package/dist/components/ControlBar.vue.d.ts +24 -0
  7. package/dist/components/ControlBar.vue.d.ts.map +1 -1
  8. package/dist/components/{IconQuality.vue.d.ts → IconAlert.vue.d.ts} +1 -1
  9. package/dist/components/IconAlert.vue.d.ts.map +1 -0
  10. package/dist/components/IconCheck.vue.d.ts +16 -0
  11. package/dist/components/IconCheck.vue.d.ts.map +1 -0
  12. package/dist/components/IconChevronRight.vue.d.ts +16 -0
  13. package/dist/components/IconChevronRight.vue.d.ts.map +1 -0
  14. package/dist/components/IconGear.vue.d.ts +16 -0
  15. package/dist/components/IconGear.vue.d.ts.map +1 -0
  16. package/dist/components/IconRefresh.vue.d.ts +16 -0
  17. package/dist/components/{IconQuality.vue.d.ts.map → IconRefresh.vue.d.ts.map} +1 -1
  18. package/dist/components/SettingsMenu.vue.d.ts +61 -0
  19. package/dist/components/SettingsMenu.vue.d.ts.map +1 -0
  20. package/dist/index.cjs +3 -3
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.ts +2 -1
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.mjs +1767 -1276
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/style.css +1 -1
  27. package/dist/utils/caption-style.d.ts +17 -0
  28. package/dist/utils/caption-style.d.ts.map +1 -0
  29. package/dist/utils/preferences.d.ts +26 -0
  30. package/dist/utils/preferences.d.ts.map +1 -0
  31. package/dist/utils/theme.d.ts +15 -0
  32. package/dist/utils/theme.d.ts.map +1 -0
  33. package/dist/utils/types.d.ts +46 -0
  34. package/dist/utils/types.d.ts.map +1 -1
  35. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),U=require("hls.js");function Ce(n,a,o){const t=n==null?void 0:n.trim();if(t)return t;if(a){try{const r=new Intl.DisplayNames(void 0,{type:"language"}).of(a);if(r&&r!==a)return r}catch{}return a}return`Audio ${o+1}`}const Se={index:-1,height:0,label:"Auto"};function Te(n,a){return n>0?`${n}p`:`Level ${a+1}`}const Ie=["muted","loop","controls","autoplay","playsinline","preload","poster"],be=e.defineComponent({__name:"HLSPlayer",props:{src:{},hlsConfig:{},isHls:{type:Boolean},muted:{type:Boolean,default:!0},loop:{type:Boolean,default:!1},controls:{type:Boolean,default:!1},autoPlay:{type:Boolean,default:!1},playsInline:{type:Boolean,default:!0},preload:{default:"metadata"},poster:{},class:{},audioTrackIndex:{default:-1},qualityLevelIndex:{default:-1}},emits:["play","pause","ended","audio-tracks","quality-levels","current-level"],setup(n,{expose:a,emit:o}){const t=n,u=o,r=e.ref(null),m=e.ref(null);let f,E;const w=globalThis.window!==void 0&&U.isSupported(),b=v=>!!t.isHls||w&&v.endsWith(".m3u8");function B(){E==null||E(),E=void 0,f==null||f(),f=void 0,m.value&&(m.value.destroy(),m.value=null);const v=r.value;if(v){for(v.pause(),v.removeAttribute("src");v.firstChild;)v.firstChild.remove();v.load(),u("audio-tracks",[]),u("quality-levels",[]),u("current-level",-1)}}function h(v){var D,V,q;const y=r.value;if(!y||!v)return;B();const _=()=>{t.autoPlay&&y.play().catch(()=>{})};if(b(v)){const k=new U(t.hlsConfig);m.value=k;const N=()=>{const L=k.audioTracks.map(($,T)=>({index:T,label:Ce($.name,$.lang,T),lang:$.lang||void 0}));u("audio-tracks",L)},M=()=>{const L=k.levels.map(($,T)=>({index:T,height:$.height||0,label:Te($.height||0,T)}));u("quality-levels",L)};k.on(U.Events.MANIFEST_PARSED,_),k.on(U.Events.MANIFEST_PARSED,M),k.on(U.Events.LEVELS_UPDATED,M),k.on(U.Events.LEVEL_SWITCHED,(L,$)=>{u("current-level",$.level)}),k.on(U.Events.AUDIO_TRACKS_UPDATED,N),k.on(U.Events.AUDIO_TRACK_SWITCHED,N),k.on(U.Events.ERROR,(L,$)=>{$.fatal&&(k.destroy(),m.value=null)}),k.attachMedia(y),k.loadSource(v)}else{y.src=v,y.load(),y.addEventListener("loadedmetadata",_,{once:!0}),E=()=>{y.removeEventListener("loadedmetadata",_)};const k=y.audioTracks;if(k){const N=()=>{const M=[];for(let L=0;L<k.length;L++){const $=k[L];M.push({index:L,label:Ce($.label,$.language,L),lang:$.language||void 0})}u("audio-tracks",M)};(D=k.addEventListener)==null||D.call(k,"addtrack",N),(V=k.addEventListener)==null||V.call(k,"removetrack",N),(q=k.addEventListener)==null||q.call(k,"change",N),k.length>0&&N(),f=()=>{var M,L,$;(M=k.removeEventListener)==null||M.call(k,"addtrack",N),(L=k.removeEventListener)==null||L.call(k,"removetrack",N),($=k.removeEventListener)==null||$.call(k,"change",N)}}}}function p(v){var D;if(v==null||v<0)return;const y=m.value;if(y){y.audioTrack!==v&&(y.audioTrack=v);return}const _=(D=r.value)==null?void 0:D.audioTracks;if(_)for(let V=0;V<_.length;V++)_[V].enabled=V===v}function g(v){if(v==null)return;const y=m.value;y&&y.currentLevel!==v&&(y.currentLevel=v)}return e.onMounted(()=>{t.src&&h(t.src)}),e.watch(()=>t.src,v=>{v&&h(v)}),e.watch(()=>t.audioTrackIndex,v=>p(v)),e.watch(()=>t.qualityLevelIndex,v=>g(v)),e.onBeforeUnmount(B),a({videoEl:r}),(v,y)=>(e.openBlock(),e.createElementBlock("video",{ref_key:"videoEl",ref:r,muted:n.muted,loop:n.loop,controls:n.controls,autoplay:n.autoPlay,playsinline:n.playsInline,preload:n.preload,poster:n.poster,class:e.normalizeClass(t.class),onPlay:y[0]||(y[0]=_=>u("play")),onPause:y[1]||(y[1]=_=>u("pause")),onEnded:y[2]||(y[2]=_=>u("ended"))},[e.renderSlot(v.$slots,"default")],42,Ie))}}),ze={name:"IconAudio"},Ae=e.defineComponent({...ze,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M3 14V10C3 9.44772 3.44772 9 4 9H6.58579C6.851 9 7.10536 8.89464 7.29289 8.70711L11.2929 4.70711C11.9229 4.07714 13 4.52331 13 5.41421V18.5858C13 19.4767 11.9229 19.9229 11.2929 19.2929L7.29289 15.2929C7.10536 15.1054 6.851 15 6.58579 15H4C3.44772 15 3 14.5523 3 14Z",stroke:"currentColor","stroke-width":"1.5","stroke-linejoin":"round"},null,-1),e.createElementVNode("path",{d:"M16.5 8C17.5 9 18 10.5 18 12C18 13.5 17.5 15 16.5 16M19 5.5C20.5 7 21.5 9.5 21.5 12C21.5 14.5 20.5 17 19 18.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])],2))}}),De={name:"IconChevron"},xe=e.defineComponent({...De,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M6 9L12 15L18 9",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))}}),He=["aria-expanded"],Fe={class:"gvp-audio-label"},qe={key:0,class:"gvp-audio-menu",role:"listbox","aria-label":"Audio tracks"},Re=["aria-selected","onClick"],Ue=e.defineComponent({__name:"AudioTrackSwitcher",props:{tracks:{},activeIndex:{}},emits:["select"],setup(n,{emit:a}){const o=n,t=a,u=e.ref(!1),r=e.ref(null),m=e.computed(()=>o.tracks.find(b=>b.index===o.activeIndex)??o.tracks[0]);function f(b){r.value&&!r.value.contains(b.target)&&(u.value=!1)}function E(b){b.key==="Escape"&&(u.value=!1)}e.watch(u,b=>{b?(document.addEventListener("mousedown",f),document.addEventListener("keydown",E)):(document.removeEventListener("mousedown",f),document.removeEventListener("keydown",E))}),e.onBeforeUnmount(()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",E)});function w(b){t("select",b),u.value=!1}return(b,B)=>{var h;return e.openBlock(),e.createElementBlock("div",{ref_key:"rootEl",ref:r,class:"gvp-audio"},[e.createElementVNode("button",{type:"button",class:"gvp-audio-btn","aria-haspopup":"listbox","aria-expanded":u.value,"aria-label":"Audio track",onClick:B[0]||(B[0]=p=>u.value=!u.value)},[e.createVNode(Ae),e.createElementVNode("span",Fe,e.toDisplayString((h=m.value)==null?void 0:h.label),1),e.createVNode(xe)],8,He),u.value?(e.openBlock(),e.createElementBlock("ul",qe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.tracks,p=>(e.openBlock(),e.createElementBlock("li",{key:p.index},[e.createElementVNode("button",{type:"button",role:"option","aria-selected":p.index===n.activeIndex,class:e.normalizeClass(["gvp-audio-menu-item",{"is-active":p.index===n.activeIndex}]),onClick:g=>w(p.index)},e.toDisplayString(p.label),11,Re)]))),128))])):e.createCommentVNode("",!0)],512)}}}),Oe={name:"IconSpeed"},Be=e.defineComponent({...Oe,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2Z",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("path",{d:"M12 8V12L14.5 14.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))}}),je=["aria-expanded"],Ze={class:"gvp-speed-label"},Qe={key:0,class:"gvp-speed-menu",role:"listbox","aria-label":"Playback speed"},We=["aria-selected","onClick"],Ye=e.defineComponent({__name:"SpeedSwitcher",props:{speed:{}},emits:["select"],setup(n,{emit:a}){const o=[.5,.75,1,1.25,1.5,2],t=a,u=e.ref(!1),r=e.ref(null);function m(w){r.value&&!r.value.contains(w.target)&&(u.value=!1)}function f(w){w.key==="Escape"&&(u.value=!1)}e.watch(u,w=>{w?(document.addEventListener("mousedown",m),document.addEventListener("keydown",f)):(document.removeEventListener("mousedown",m),document.removeEventListener("keydown",f))}),e.onBeforeUnmount(()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",f)});function E(w){t("select",w),u.value=!1}return(w,b)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootEl",ref:r,class:"gvp-speed"},[e.createElementVNode("button",{type:"button",class:"gvp-speed-btn","aria-haspopup":"listbox","aria-expanded":u.value,"aria-label":"`Playback speed: ${speed === 1 ? '1×' : speed + '×'}`",onClick:b[0]||(b[0]=B=>u.value=!u.value)},[e.createVNode(Be),e.createElementVNode("span",Ze,e.toDisplayString(n.speed===1?"1×":`${n.speed}×`),1),e.createVNode(xe)],8,je),u.value?(e.openBlock(),e.createElementBlock("ul",Qe,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(o,B=>e.createElementVNode("li",{key:B},[e.createElementVNode("button",{type:"button",role:"option","aria-selected":B===n.speed,class:e.normalizeClass(["gvp-speed-menu-item",{"is-active":B===n.speed}]),onClick:h=>E(B)},e.toDisplayString(B===1?"Normal":`${B}×`),11,We)])),64))])):e.createCommentVNode("",!0)],512))}}),Ke={name:"IconCaptions"},Ne=e.defineComponent({...Ke,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("rect",{x:"2",y:"5",width:"20",height:"14",rx:"3",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("path",{d:"M7 12H11M13 12H17M7 15H9M11 15H13M15 15H17",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])],2))}}),Xe=["aria-expanded","aria-pressed"],Je={key:0,class:"gvp-captions-menu",role:"listbox","aria-label":"Captions"},Ge=["aria-selected"],et=["aria-selected","onClick"],tt=e.defineComponent({__name:"CaptionsSwitcher",props:{video:{}},setup(n){const a=n,o=e.ref([]),t=e.ref(-1),u=e.ref(!1),r=e.ref(null);function m(h){const p=[];for(let v=0;v<h.length;v++){const y=h[v];(y.kind==="subtitles"||y.kind==="captions")&&p.push({index:v,label:y.label||y.language||`Track ${v+1}`})}o.value=p;let g=-1;for(let v=0;v<h.length;v++)if(h[v].mode==="showing"){g=v;break}t.value=g}let f=null;e.watch(()=>a.video,h=>{if(f==null||f(),f=null,!h){o.value=[],t.value=-1;return}const p=h.textTracks;m(p);const g=()=>m(p);typeof p.addEventListener=="function"&&(p.addEventListener("addtrack",g),p.addEventListener("removetrack",g),p.addEventListener("change",g),f=()=>{p.removeEventListener("addtrack",g),p.removeEventListener("removetrack",g),p.removeEventListener("change",g)})},{immediate:!0}),e.onBeforeUnmount(()=>{f==null||f(),document.removeEventListener("mousedown",E),document.removeEventListener("keydown",w)});function E(h){r.value&&!r.value.contains(h.target)&&(u.value=!1)}function w(h){h.key==="Escape"&&(u.value=!1)}e.watch(u,h=>{h?(document.addEventListener("mousedown",E),document.addEventListener("keydown",w)):(document.removeEventListener("mousedown",E),document.removeEventListener("keydown",w))});function b(){if(!a.video)return;const h=a.video.textTracks;for(let p=0;p<h.length;p++)h[p].mode="hidden";t.value=-1,u.value=!1}function B(h){if(!a.video)return;const p=a.video.textTracks;for(let g=0;g<p.length;g++)p[g].mode=g===h?"showing":"hidden";t.value=h,u.value=!1}return(h,p)=>o.value.length>0?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"rootEl",ref:r,class:"gvp-captions"},[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["gvp-captions-btn",{"is-active":t.value>=0}]),"aria-haspopup":"listbox","aria-expanded":u.value,"aria-pressed":t.value>=0,"aria-label":"Captions",onClick:p[0]||(p[0]=g=>u.value=!u.value)},[e.createVNode(Ne)],10,Xe),u.value?(e.openBlock(),e.createElementBlock("ul",Je,[e.createElementVNode("li",null,[e.createElementVNode("button",{type:"button",role:"option","aria-selected":t.value===-1,class:e.normalizeClass(["gvp-captions-menu-item",{"is-active":t.value===-1}]),onClick:b}," Off ",10,Ge)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,g=>(e.openBlock(),e.createElementBlock("li",{key:g.index},[e.createElementVNode("button",{type:"button",role:"option","aria-selected":g.index===t.value,class:e.normalizeClass(["gvp-captions-menu-item",{"is-active":g.index===t.value}]),onClick:v=>B(g.index)},e.toDisplayString(g.label),11,et)]))),128))])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0)}}),nt={name:"IconPause"},ot=e.defineComponent({...nt,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("rect",{x:"6",y:"5",width:"4",height:"14",rx:"1",fill:"currentColor"},null,-1),e.createElementVNode("rect",{x:"14",y:"5",width:"4",height:"14",rx:"1",fill:"currentColor"},null,-1)])],2))}}),lt={name:"IconPlaySolid"},at=e.defineComponent({...lt,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M7 5.5V18.5C7 19.2659 7.84856 19.7261 8.4899 19.3071L19.0801 12.4014C19.6644 12.0204 19.6644 11.9796 19.0801 11.5986L8.4899 4.69288C7.84856 4.27388 7 4.73408 7 5.5Z",fill:"currentColor"},null,-1)])],2))}}),rt={name:"IconPrev"},st=e.defineComponent({...rt,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M16.5 18.5V5.5C16.5 4.73408 15.6514 4.27388 15.0101 4.69288L6.91993 9.98432C6.33563 10.3653 6.33563 11.0347 6.91993 11.4157L15.0101 16.7071C15.6514 17.1261 16.5 16.6659 16.5 15.9V18.5Z",fill:"currentColor"},null,-1),e.createElementVNode("path",{d:"M6 5V19",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},null,-1)])],2))}}),it={name:"IconNext"},ct=e.defineComponent({...it,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M7.5 5.5V18.5C7.5 19.2659 8.34856 19.7261 8.98990 19.3071L17.0801 14.0157C17.6644 13.6347 17.6644 12.9653 17.0801 12.5843L8.98990 7.29288C8.34856 6.87388 7.5 7.33408 7.5 8.1V5.5Z",fill:"currentColor"},null,-1),e.createElementVNode("path",{d:"M18 5V19",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},null,-1)])],2))}}),ut={name:"IconVolumeHigh"},dt=e.defineComponent({...ut,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M3 14V10C3 9.44772 3.44772 9 4 9H6.58579C6.851 9 7.10536 8.89464 7.29289 8.70711L11.2929 4.70711C11.9229 4.07714 13 4.52331 13 5.41421V18.5858C13 19.4767 11.9229 19.9229 11.2929 19.2929L7.29289 15.2929C7.10536 15.1054 6.851 15 6.58579 15H4C3.44772 15 3 14.5523 3 14Z",stroke:"currentColor","stroke-width":"1.5","stroke-linejoin":"round"},null,-1),e.createElementVNode("path",{d:"M16.5 8C17.5 9 18 10.5 18 12C18 13.5 17.5 15 16.5 16M19 5.5C20.5 7 21.5 9.5 21.5 12C21.5 14.5 20.5 17 19 18.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])],2))}}),vt={name:"IconVolumeLow"},pt=e.defineComponent({...vt,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M3 14V10C3 9.44772 3.44772 9 4 9H6.58579C6.851 9 7.10536 8.89464 7.29289 8.70711L11.2929 4.70711C11.9229 4.07714 13 4.52331 13 5.41421V18.5858C13 19.4767 11.9229 19.9229 11.2929 19.2929L7.29289 15.2929C7.10536 15.1054 6.851 15 6.58579 15H4C3.44772 15 3 14.5523 3 14Z",stroke:"currentColor","stroke-width":"1.5","stroke-linejoin":"round"},null,-1),e.createElementVNode("path",{d:"M16.5 8C17.5 9 18 10.5 18 12C18 13.5 17.5 15 16.5 16",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])],2))}}),mt={name:"IconVolumeMuted"},ft=e.defineComponent({...mt,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M3 14V10C3 9.44772 3.44772 9 4 9H6.58579C6.851 9 7.10536 8.89464 7.29289 8.70711L11.2929 4.70711C11.9229 4.07714 13 4.52331 13 5.41421V18.5858C13 19.4767 11.9229 19.9229 11.2929 19.2929L7.29289 15.2929C7.10536 15.1054 6.851 15 6.58579 15H4C3.44772 15 3 14.5523 3 14Z",stroke:"currentColor","stroke-width":"1.5","stroke-linejoin":"round"},null,-1),e.createElementVNode("path",{d:"M16 9L22 15M22 9L16 15",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])],2))}}),kt={name:"IconQuality"},ht=e.defineComponent({...kt,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M12 15C13.6569 15 15 13.6569 15 12C15 10.3431 13.6569 9 12 9C10.3431 9 9 10.3431 9 12C9 13.6569 10.3431 15 12 15Z",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("path",{d:"M3 12C3 12.6 3.08 13.18 3.23 13.73L4.6 14.5C4.86 14.65 5.02 14.94 5 15.24C4.98 15.58 4.96 15.92 5.07 16.24C5.18 16.56 5.39 16.83 5.62 17.08C5.83 17.3 6.13 17.4 6.42 17.36L7.99 17.13C8.28 17.09 8.57 17.21 8.74 17.45C9.07 17.93 9.49 18.34 9.97 18.66C10.21 18.83 10.34 19.11 10.31 19.4L10.13 20.97C10.1 21.26 10.21 21.55 10.43 21.74C10.91 22.16 11.45 22 12 22C12.55 22 13.09 22.16 13.57 21.74C13.79 21.55 13.9 21.26 13.87 20.97L13.69 19.4C13.66 19.11 13.79 18.83 14.03 18.66",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])],2))}}),gt={name:"IconPiP"},Ve=e.defineComponent({...gt,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("rect",{x:"12",y:"12",width:"8",height:"5",rx:"1",fill:"currentColor"},null,-1)])],2))}}),yt={name:"IconFullscreen"},Ct=e.defineComponent({...yt,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M4 9V4H9M15 4H20V9M20 15V20H15M9 20H4V15",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))}}),Et={name:"IconFullscreenExit"},wt=e.defineComponent({...Et,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M9 4V9H4M15 9V4H20M15 20V15H20M9 15H4V20",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))}});function ge(n){if(!Number.isFinite(n)||n<0)return"--:--";const a=Math.floor(n),o=Math.floor(a/3600),t=Math.floor(a%3600/60),r=(a%60).toString().padStart(2,"0");if(o>0){const m=t.toString().padStart(2,"0");return`${o}:${m}:${r}`}return`${t}:${r}`}function Ee(n){const a=n.trim().split(":");if(a.length<2||a.length>3)return NaN;const o=a.map(Number);return o.some(t=>!Number.isFinite(t))?NaN:o.length===3?o[0]*3600+o[1]*60+o[2]:o[0]*60+o[1]}function bt(n,a){try{return new URL(n,a).href}catch{return n}}function xt(n,a){const o=[],t=n.replace(/\r/g,"").split(`
2
- `);for(let u=0;u<t.length;u++){const r=t[u].indexOf("-->");if(r===-1)continue;const m=Ee(t[u].slice(0,r)),f=Ee(t[u].slice(r+3));if(!Number.isFinite(m)||!Number.isFinite(f))continue;const E=(t[u+1]??"").trim();if(!E)continue;const w=E.indexOf("#xywh=");let b=E,B=0,h=0,p=0,g=0;if(w!==-1){b=E.slice(0,w);const v=E.slice(w+6).split(",").map(Number);v.length===4&&v.every(Number.isFinite)&&([B,h,p,g]=v)}o.push({start:m,end:f,url:bt(b,a),x:B,y:h,w:p,h:g})}return o.sort((u,r)=>u.start-r.start),o}function Bt(n){return{cues:n,cueAt(a){if(n.length===0)return null;let o=0,t=n.length-1,u=n[0];for(;o<=t;){const r=o+t>>1,m=n[r];if(a<m.start)t=r-1;else if(a>m.end)u=m,o=r+1;else return m}return u}}}function we(n){const a=n.trim().split(":");if(a.length<2||a.length>3)return NaN;const o=a.map(Number);return o.some(t=>!Number.isFinite(t))?NaN:o.length===3?o[0]*3600+o[1]*60+o[2]:o[0]*60+o[1]}function Nt(n){const a=[],o=n.replace(/\r/g,"").split(`
3
- `);for(let t=0;t<o.length;t++){const u=o[t].indexOf("-->");if(u===-1)continue;const r=we(o[t].slice(0,u)),m=we(o[t].slice(u+3));if(!Number.isFinite(r)||!Number.isFinite(m))continue;const f=(o[t+1]??"").trim();f&&a.push({start:r,end:m,title:f})}return a.sort((t,u)=>t.start-u.start),a}function Vt(n,a){const o=n.filter(t=>Number.isFinite(t.start)&&t.start>=0&&t.title).sort((t,u)=>t.start-u.start);return o.map((t,u)=>{var r;return{start:t.start,end:Number.isFinite(t.end)?t.end:((r=o[u+1])==null?void 0:r.start)??a,title:t.title}})}function Lt(n,a){for(const o of n)if(a>=o.start&&a<o.end)return o;return null}const _t={class:"gvp-controls-row"},$t=["disabled"],Pt=["aria-label","aria-pressed"],Mt=["disabled"],St={key:1,class:"gvp-seek-preview-chapter"},Tt={class:"gvp-seek-preview-time"},It=["value","disabled","aria-valuemax","aria-valuenow"],zt={class:"gvp-time","aria-live":"off"},At=["aria-expanded","aria-label"],Dt={class:"gvp-speed-label"},Ht={key:0,class:"gvp-speed-menu",role:"listbox","aria-label":"Playback speed"},Ft=["aria-selected","onClick"],qt=["aria-expanded","aria-label"],Rt={class:"gvp-quality-label"},Ut={key:0,class:"gvp-quality-menu",role:"listbox","aria-label":"Quality"},Ot=["aria-selected"],jt=["aria-selected","onClick"],Zt=["aria-expanded","aria-pressed"],Qt={key:0,class:"gvp-captions-menu",role:"listbox","aria-label":"Captions"},Wt=["aria-selected"],Yt=["aria-selected","onClick"],Kt=["aria-label","aria-pressed"],Xt={key:0,class:"gvp-volume-slider-wrap"},Jt={class:"gvp-volume-track"},Gt=["value","aria-valuenow"],en=["aria-label","aria-pressed"],tn=["aria-label","aria-pressed"],nn=3e3,on=e.defineComponent({__name:"ControlBar",props:{video:{},isPlaying:{type:Boolean},container:{},onTogglePlay:{},qualityLevels:{default:()=>[]},currentLevel:{default:-1},selectedLevel:{default:-1},thumbnails:{},chapters:{},hasPrev:{type:Boolean,default:!1},hasNext:{type:Boolean,default:!1}},emits:["select-level","prev","next"],setup(n,{emit:a}){const o=(()=>{if(typeof navigator>"u")return!1;const l=navigator.userAgent;return/iPad|iPhone|iPod/.test(l)||l.includes("Mac")&&navigator.maxTouchPoints>1})(),t=typeof navigator>"u"?!1:/iPhone|iPod/.test(navigator.userAgent),u=[.5,.75,1,1.25,1.5,2],r=n,m=a,f=e.ref(!0);let E=null;function w(){E!==null&&(clearTimeout(E),E=null)}function b(){w(),r.isPlaying&&(E=setTimeout(()=>{f.value=!1},nn))}function B(){f.value=!0,b()}e.watch(()=>r.isPlaying,l=>{l?b():(w(),f.value=!0)},{immediate:!0}),e.watch(()=>r.container,l=>{if(!l)return;const s=()=>B();l.addEventListener("mousemove",s),l.addEventListener("touchstart",s),l.addEventListener("focusin",s)},{immediate:!0});const h=e.ref(0),p=e.ref(0),g=e.ref(0);e.watch(()=>r.video,l=>{if(!l)return;const s=()=>{h.value=l.currentTime},i=()=>{p.value=Number.isFinite(l.duration)?l.duration:0},C=()=>{const S=l.buffered;if(!S||S.length===0){g.value=0;return}let ye=S.end(S.length-1);for(let oe=0;oe<S.length;oe++)if(S.start(oe)<=l.currentTime&&l.currentTime<=S.end(oe)){ye=S.end(oe);break}g.value=ye};s(),i(),C(),l.addEventListener("timeupdate",s),l.addEventListener("durationchange",i),l.addEventListener("loadedmetadata",i),l.addEventListener("progress",C),l.addEventListener("timeupdate",C)},{immediate:!0});const v=()=>p.value>0,y=()=>v()?h.value/p.value*100:0,_=()=>v()?g.value/p.value*100:0;function D(l){const s=r.video;if(!s||!v())return;const i=Number(l.target.value)/100*p.value;s.currentTime=i,h.value=i}const V=e.ref(null),q=e.ref(null),k=e.ref(0),N=e.ref(0),M=e.ref(!1);e.watch(()=>r.thumbnails,l=>{if(V.value=null,!l)return;let s=!1;fetch(l).then(i=>i.ok?i.text():Promise.reject(new Error("fetch failed"))).then(i=>{if(s)return;const C=xt(i,new URL(l,location.href).href);V.value=C.length>0?Bt(C):null}).catch(()=>{s||(V.value=null)}),e.onBeforeUnmount(()=>{s=!0})},{immediate:!0});function L(l){const s=q.value;if(!s||!v())return;const i=s.getBoundingClientRect(),C=Math.min(Math.max(l.clientX-i.left,0),i.width);N.value=C,k.value=C/i.width*p.value,M.value=!0}function $(){M.value=!1}const T=e.computed(()=>{var l;return M.value?((l=V.value)==null?void 0:l.cueAt(k.value))??null:null}),G=e.computed(()=>{const l=T.value;return l!==null&&l.w>0&&l.h>0}),ve=e.computed(()=>{var C;const l=T.value,s=((C=q.value)==null?void 0:C.clientWidth)??0;if(!G.value||!l||s===0)return N.value;const i=l.w/2;return Math.min(Math.max(N.value,i),s-i)}),Z=e.ref([]);e.watch(()=>r.chapters,l=>{if(Z.value=[],typeof l!="string"||!l)return;let s=!1;fetch(l).then(i=>i.ok?i.text():Promise.reject(new Error("fetch failed"))).then(i=>{s||(Z.value=Nt(i))}).catch(()=>{s||(Z.value=[])}),e.onBeforeUnmount(()=>{s=!0})},{immediate:!0});const W=e.computed(()=>typeof r.chapters=="string"?Z.value:Array.isArray(r.chapters)?Vt(r.chapters,p.value):[]),Y=e.computed(()=>M.value?Lt(W.value,k.value):null),H=e.ref(1),P=e.ref(!1);e.watch(()=>r.video,l=>{if(!l)return;const s=()=>{H.value=l.volume,P.value=l.muted};s(),l.addEventListener("volumechange",s)},{immediate:!0});function pe(){r.video&&(r.video.muted=!r.video.muted)}function me(l){const s=r.video;if(!s)return;const i=Number(l.target.value)/100;s.volume=i,i>0&&s.muted&&(s.muted=!1)}const F=e.ref(1),O=e.ref(!1),le=e.ref(null);e.watch(()=>r.video,l=>{if(!l)return;const s=()=>{F.value=l.playbackRate};s(),l.addEventListener("ratechange",s)},{immediate:!0});function fe(l){r.video&&(r.video.playbackRate=l),F.value=l,O.value=!1}const j=e.ref(!1),z=e.ref(null),ee=e.computed(()=>r.qualityLevels.length>=2),ae=e.computed(()=>[...r.qualityLevels].sort((l,s)=>s.height-l.height)),K=e.computed(()=>r.qualityLevels.find(l=>l.index===r.currentLevel)),re=e.computed(()=>{if(r.selectedLevel<0)return K.value?`Auto (${K.value.label})`:"Auto";const l=r.qualityLevels.find(s=>s.index===r.selectedLevel);return(l==null?void 0:l.label)??"Auto"});function Q(l){m("select-level",l),j.value=!1}const X=e.ref([]),A=e.ref(-1),R=e.ref(!1),se=e.ref(null);function te(l){const s=[];for(let C=0;C<l.length;C++){const S=l[C];(S.kind==="subtitles"||S.kind==="captions")&&s.push({index:C,label:S.label||S.language||`Track ${C+1}`})}X.value=s;let i=-1;for(let C=0;C<l.length;C++)if(l[C].mode==="showing"){i=C;break}A.value=i}e.watch(()=>r.video,l=>{if(!l){X.value=[],A.value=-1;return}const s=l.textTracks;te(s);const i=()=>te(s);typeof s.addEventListener=="function"&&(s.addEventListener("addtrack",i),s.addEventListener("removetrack",i),s.addEventListener("change",i))},{immediate:!0});function ie(l){var i;const s=(i=r.video)==null?void 0:i.textTracks;if(s){for(let C=0;C<s.length;C++)s[C].mode=C===l?"showing":"hidden";A.value=l,R.value=!1}}function c(){var s;const l=(s=r.video)==null?void 0:s.textTracks;if(l){for(let i=0;i<l.length;i++)l[i].mode="hidden";A.value=-1,R.value=!1}}const d=e.ref(!1),x=typeof document<"u"&&!!document.pictureInPictureEnabled;e.watch(()=>r.video,l=>{l&&(l.addEventListener("enterpictureinpicture",()=>{d.value=!0}),l.addEventListener("leavepictureinpicture",()=>{d.value=!1}))},{immediate:!0});function J(){r.video&&(document.pictureInPictureElement?document.exitPictureInPicture().catch(()=>{}):r.video.requestPictureInPicture().catch(()=>{}))}const I=e.ref(!1),ce=typeof document>"u"?!1:!!(document.fullscreenEnabled||document.webkitFullscreenEnabled);function ke(){return document.fullscreenElement??document.webkitFullscreenElement??null}function ue(l){const s=l.requestFullscreen??l.webkitRequestFullscreen;return s?s.call(l):Promise.reject(new Error("unsupported"))}function ne(){const l=document.exitFullscreen??document.webkitExitFullscreen;return l?l.call(document):Promise.reject(new Error("unsupported"))}function de(){I.value=ke()===r.container}e.onMounted(()=>{document.addEventListener("fullscreenchange",de),document.addEventListener("webkitfullscreenchange",de)}),e.onBeforeUnmount(()=>{w(),document.removeEventListener("fullscreenchange",de),document.removeEventListener("webkitfullscreenchange",de)});function Pe(){var l,s;if(t){(s=(l=r.video)==null?void 0:l.webkitEnterFullscreen)==null||s.call(l);return}I.value?ne().catch(()=>{}):r.container&&ue(r.container).catch(()=>{})}const Me=ce||t&&r.video!==null&&typeof r.video.webkitEnterFullscreen=="function";function he(l,s){function i(S){s.value&&!s.value.contains(S.target)&&(l.value=!1)}function C(S){S.key==="Escape"&&(l.value=!1)}e.watch(l,S=>{S?(document.addEventListener("mousedown",i),document.addEventListener("keydown",C)):(document.removeEventListener("mousedown",i),document.removeEventListener("keydown",C))}),e.onBeforeUnmount(()=>{document.removeEventListener("mousedown",i),document.removeEventListener("keydown",C)})}return he(O,le),he(R,se),he(j,z),(l,s)=>(e.openBlock(),e.createElementBlock("div",{role:"toolbar","aria-label":"Video controls",class:e.normalizeClass(["gvp-controls",!f.value&&"is-hidden"]),onMouseenter:w,onMouseleave:b},[e.createElementVNode("div",_t,[n.hasPrev||n.hasNext?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"gvp-ctrl-btn","aria-label":"Previous video",disabled:!n.hasPrev,onClick:s[0]||(s[0]=i=>m("prev"))},[e.createVNode(st)],8,$t)):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",class:"gvp-ctrl-btn","aria-label":n.isPlaying?"Pause":"Play","aria-pressed":n.isPlaying,onClick:s[1]||(s[1]=(...i)=>n.onTogglePlay&&n.onTogglePlay(...i))},[n.isPlaying?(e.openBlock(),e.createBlock(ot,{key:0})):(e.openBlock(),e.createBlock(at,{key:1}))],8,Pt),n.hasPrev||n.hasNext?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"gvp-ctrl-btn","aria-label":"Next video",disabled:!n.hasNext,onClick:s[2]||(s[2]=i=>m("next"))},[e.createVNode(ct)],8,Mt)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"gvp-seek",onPointermove:L,onPointerleave:$},[e.createElementVNode("div",{ref_key:"seekTrackEl",ref:q,class:"gvp-seek-track"},[e.createElementVNode("div",{class:"gvp-seek-buffered",style:e.normalizeStyle({width:`${_()}%`})},null,4),e.createElementVNode("div",{class:"gvp-seek-progress",style:e.normalizeStyle({width:`${y()}%`})},null,4),v()?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(W.value,i=>e.withDirectives((e.openBlock(),e.createElementBlock("div",{key:`${i.start}-${i.title}`,class:"gvp-seek-chapter-tick",style:e.normalizeStyle({left:`${i.start/p.value*100}%`})},null,4)),[[e.vShow,i.start>0&&i.start<p.value]])),128)):e.createCommentVNode("",!0)],512),M.value&&v()?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["gvp-seek-preview",{"has-thumb":G.value}]),style:e.normalizeStyle({left:`${ve.value}px`})},[G.value&&T.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"gvp-seek-preview-thumb",style:e.normalizeStyle({width:`${T.value.w}px`,height:`${T.value.h}px`,backgroundImage:`url(${JSON.stringify(T.value.url)})`,backgroundPosition:`-${T.value.x}px -${T.value.y}px`})},null,4)):e.createCommentVNode("",!0),Y.value?(e.openBlock(),e.createElementBlock("span",St,e.toDisplayString(Y.value.title),1)):e.createCommentVNode("",!0),e.createElementVNode("span",Tt,e.toDisplayString(e.unref(ge)(k.value)),1)],6)):e.createCommentVNode("",!0),e.createElementVNode("input",{type:"range",class:"gvp-seek-input",min:0,max:100,step:.1,value:y(),disabled:!v(),"aria-label":"Seek","aria-valuemin":0,"aria-valuemax":Math.floor(p.value),"aria-valuenow":Math.floor(h.value),onInput:D},null,40,It)],32),e.createElementVNode("span",zt,e.toDisplayString(e.unref(ge)(h.value))+" / "+e.toDisplayString(e.unref(ge)(p.value)),1),e.createElementVNode("div",{ref_key:"speedRootEl",ref:le,class:"gvp-speed"},[e.createElementVNode("button",{type:"button",class:"gvp-ctrl-btn gvp-speed-btn","aria-haspopup":"listbox","aria-expanded":O.value,"aria-label":`Playback speed: ${F.value===1?"1×":F.value+"×"}`,onClick:s[3]||(s[3]=i=>O.value=!O.value)},[e.createVNode(Be),e.createElementVNode("span",Dt,e.toDisplayString(F.value===1?"1×":`${F.value}×`),1)],8,At),O.value?(e.openBlock(),e.createElementBlock("ul",Ht,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(u,i=>e.createElementVNode("li",{key:i},[e.createElementVNode("button",{type:"button",role:"option","aria-selected":i===F.value,class:e.normalizeClass(["gvp-speed-menu-item",{"is-active":i===F.value}]),onClick:C=>fe(i)},e.toDisplayString(i===1?"Normal":`${i}×`),11,Ft)])),64))])):e.createCommentVNode("",!0)],512),ee.value?(e.openBlock(),e.createElementBlock("div",{key:2,ref_key:"qualityRootEl",ref:z,class:"gvp-quality"},[e.createElementVNode("button",{type:"button",class:"gvp-ctrl-btn gvp-quality-btn","aria-haspopup":"listbox","aria-expanded":j.value,"aria-label":`Quality: ${re.value}`,onClick:s[4]||(s[4]=i=>j.value=!j.value)},[e.createVNode(ht),e.createElementVNode("span",Rt,e.toDisplayString(re.value),1)],8,qt),j.value?(e.openBlock(),e.createElementBlock("ul",Ut,[e.createElementVNode("li",null,[e.createElementVNode("button",{type:"button",role:"option","aria-selected":n.selectedLevel<0,class:e.normalizeClass(["gvp-quality-menu-item",{"is-active":n.selectedLevel<0}]),onClick:s[5]||(s[5]=i=>Q(e.unref(Se).index))},e.toDisplayString(K.value?`Auto (${K.value.label})`:"Auto"),11,Ot)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(ae.value,i=>(e.openBlock(),e.createElementBlock("li",{key:i.index},[e.createElementVNode("button",{type:"button",role:"option","aria-selected":i.index===n.selectedLevel,class:e.normalizeClass(["gvp-quality-menu-item",{"is-active":i.index===n.selectedLevel}]),onClick:C=>Q(i.index)},e.toDisplayString(i.label),11,jt)]))),128))])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),X.value.length>0?(e.openBlock(),e.createElementBlock("div",{key:3,ref_key:"captionsRootEl",ref:se,class:"gvp-captions"},[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["gvp-ctrl-btn",A.value>=0&&"is-active"]),"aria-haspopup":"listbox","aria-expanded":R.value,"aria-label":"Captions","aria-pressed":A.value>=0,onClick:s[6]||(s[6]=i=>R.value=!R.value)},[e.createVNode(Ne)],10,Zt),R.value?(e.openBlock(),e.createElementBlock("ul",Qt,[e.createElementVNode("li",null,[e.createElementVNode("button",{type:"button",role:"option","aria-selected":A.value===-1,class:e.normalizeClass(["gvp-captions-menu-item",{"is-active":A.value===-1}]),onClick:c},"Off",10,Wt)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(X.value,i=>(e.openBlock(),e.createElementBlock("li",{key:i.index},[e.createElementVNode("button",{type:"button",role:"option","aria-selected":i.index===A.value,class:e.normalizeClass(["gvp-captions-menu-item",{"is-active":i.index===A.value}]),onClick:C=>ie(i.index)},e.toDisplayString(i.label),11,Yt)]))),128))])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["gvp-volume",!e.unref(o)&&"is-expandable"])},[e.createElementVNode("button",{type:"button",class:"gvp-ctrl-btn","aria-label":P.value?"Unmute":"Mute","aria-pressed":P.value,onClick:pe},[P.value||H.value===0?(e.openBlock(),e.createBlock(ft,{key:0})):H.value<.5?(e.openBlock(),e.createBlock(pt,{key:1})):(e.openBlock(),e.createBlock(dt,{key:2}))],8,Kt),e.unref(o)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Xt,[e.createElementVNode("div",Jt,[e.createElementVNode("div",{class:"gvp-volume-fill",style:e.normalizeStyle({width:`${P.value?0:Math.round(H.value*100)}%`})},null,4)]),e.createElementVNode("input",{type:"range",class:"gvp-volume-input",min:0,max:100,step:1,value:P.value?0:Math.round(H.value*100),"aria-label":"Volume","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":P.value?0:Math.round(H.value*100),onInput:me},null,40,Gt)]))],2),e.unref(x)?(e.openBlock(),e.createElementBlock("button",{key:4,type:"button",class:e.normalizeClass(["gvp-ctrl-btn",d.value&&"is-active"]),"aria-label":d.value?"Exit picture-in-picture":"Picture-in-picture","aria-pressed":d.value,onClick:J},[e.createVNode(Ve)],10,en)):e.createCommentVNode("",!0),e.unref(Me)?(e.openBlock(),e.createElementBlock("button",{key:5,type:"button",class:e.normalizeClass(["gvp-ctrl-btn",I.value&&"is-active"]),"aria-label":I.value?"Exit fullscreen":"Enter fullscreen","aria-pressed":I.value,onClick:Pe},[I.value?(e.openBlock(),e.createBlock(wt,{key:0})):(e.openBlock(),e.createBlock(Ct,{key:1}))],10,tn)):e.createCommentVNode("",!0)])],34))}}),ln={name:"IconDesktop"},an=e.defineComponent({...ln,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M14 2H10C6.72077 2 5.08116 2 3.91891 2.81382C3.48891 3.1149 3.1149 3.48891 2.81382 3.91891C2 5.08116 2 6.72077 2 10C2 13.2792 2 14.9188 2.81382 16.0811C3.1149 16.5111 3.48891 16.8851 3.91891 17.1862C5.08116 18 6.72077 18 10 18H14C17.2792 18 18.9188 18 20.0811 17.1862C20.5111 16.8851 20.8851 16.5111 21.1862 16.0811C22 14.9188 22 13.2792 22 10C22 6.72077 22 5.08116 21.1862 3.91891C20.8851 3.48891 20.5111 3.1149 20.0811 2.81382C18.9188 2 17.2792 2 14 2Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1),e.createElementVNode("path",{d:"M11 15H13",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),e.createElementVNode("path",{d:"M14.5 22L14.1845 21.5811C13.4733 20.6369 13.2969 19.1944 13.7468 18M9.5 22L9.8155 21.5811C10.5267 20.6369 10.7031 19.1944 10.2532 18",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1),e.createElementVNode("path",{d:"M7 22H17",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])],2))}}),rn={name:"IconMobile"},sn=e.defineComponent({...rn,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M5 9C5 5.70017 5 4.05025 6.02513 3.02513C7.05025 2 8.70017 2 12 2C15.2998 2 16.9497 2 17.9749 3.02513C19 4.05025 19 5.70017 19 9V15C19 18.2998 19 19.9497 17.9749 20.9749C16.9497 22 15.2998 22 12 22C8.70017 22 7.05025 22 6.02513 20.9749C5 19.9497 5 18.2998 5 15V9Z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},null,-1),e.createElementVNode("path",{d:"M11 19H13",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),e.createElementVNode("path",{d:"M9 2L9.089 2.53402C9.28188 3.69129 9.37832 4.26993 9.77519 4.62204C10.1892 4.98934 10.7761 5 12 5C13.2239 5 13.8108 4.98934 14.2248 4.62204C14.6217 4.26993 14.7181 3.69129 14.911 2.53402L15 2",stroke:"currentColor","stroke-width":"2","stroke-linejoin":"round"},null,-1)])],2))}}),cn={name:"IconPlay"},un=e.defineComponent({...cn,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"22",height:"22",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M5.3335 11.45V4.54997C5.3335 4.36108 5.40016 4.20275 5.5335 4.07497C5.66683 3.94719 5.82238 3.8833 6.00016 3.8833C6.05572 3.8833 6.11405 3.89163 6.17516 3.9083C6.23627 3.92497 6.29461 3.94997 6.35016 3.9833L11.7835 7.4333C11.8835 7.49997 11.9585 7.5833 12.0085 7.6833C12.0585 7.7833 12.0835 7.88886 12.0835 7.99997C12.0835 8.11108 12.0585 8.21663 12.0085 8.31663C11.9585 8.41663 11.8835 8.49997 11.7835 8.56663L6.35016 12.0166C6.29461 12.05 6.23627 12.075 6.17516 12.0916C6.11405 12.1083 6.05572 12.1166 6.00016 12.1166C5.82238 12.1166 5.66683 12.0527 5.5335 11.925C5.40016 11.7972 5.3335 11.6389 5.3335 11.45Z",fill:"currentColor"},null,-1)])],2))}}),dn={name:"IconX"},vn=e.defineComponent({...dn,props:{class:{}},setup(n){const a=n;return(o,t)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",a.class]),width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M6.94994 5.53594L12.1929 0.292938C12.5834 -0.0975275 13.2165 -0.0975279 13.6069 0.292938C13.9974 0.683403 13.9974 1.31647 13.6069 1.70694L8.36394 6.94994L13.6069 12.1929C13.9974 12.5834 13.9974 13.2165 13.6069 13.6069C13.2165 13.9974 12.5834 13.9974 12.1929 13.6069L6.94994 8.36394L1.70694 13.6069C1.31647 13.9974 0.683403 13.9974 0.292938 13.6069C-0.0975279 13.2165 -0.0975277 12.5834 0.292938 12.1929L5.53594 6.94994L0.292938 1.70694C-0.0975279 1.31647 -0.0975279 0.683403 0.292938 0.292938C0.683403 -0.0975279 1.31647 -0.0975277 1.70694 0.292938L6.94994 5.53594Z",fill:"currentColor"},null,-1)])],2))}});function Le(n){if(!n)return null;if(/^[A-Za-z0-9_-]{11}$/.test(n))return n;let a;try{a=new URL(n)}catch{return null}const o=a.hostname.replace(/^www\./,"");if(o==="youtu.be"){const t=a.pathname.slice(1).split("/")[0];return/^[A-Za-z0-9_-]{11}$/.test(t)?t:null}if(o==="youtube.com"||o==="m.youtube.com"||o==="music.youtube.com"||o==="youtube-nocookie.com"){const t=a.searchParams.get("v");if(t&&/^[A-Za-z0-9_-]{11}$/.test(t))return t;const u=/^\/(?:embed|shorts|v|live)\/([A-Za-z0-9_-]{11})/.exec(a.pathname);if(u)return u[1]}return null}function _e(n){try{const a=new URL(n),o=a.searchParams.get("t")??a.searchParams.get("start");if(!o)return null;if(/^\d+s?$/.test(o))return Number.parseInt(o,10);const t=/^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/.exec(o);if(t){const u=Number.parseInt(t[1]??"0",10),r=Number.parseInt(t[2]??"0",10),m=Number.parseInt(t[3]??"0",10),f=u*3600+r*60+m;return f>0?f:null}}catch{}return null}function $e(n,a={}){const{autoPlay:o=!1,muted:t=!0,loop:u=!1,controls:r=!0,startSeconds:m}=a,f=new URLSearchParams({rel:"0",modestbranding:"1",playsinline:"1",controls:r?"1":"0"});return o?(f.set("autoplay","1"),f.set("mute","1")):t&&f.set("mute","1"),u&&(f.set("loop","1"),f.set("playlist",n)),m&&m>0&&f.set("start",String(m)),`https://www.youtube-nocookie.com/embed/${n}?${f.toString()}`}const pn=["src"],mn={key:2,class:"gvp-vignette"},fn={key:3,class:"gvp-toggle"},kn={class:"gvp-toggle-pill"},hn=["aria-pressed"],gn=["aria-pressed"],yn=["aria-label","aria-pressed"],Cn=["aria-label"],En={key:10,class:"gvp-play-wrap"},wn={key:0,class:"gvp-tooltip",role:"tooltip"},bn={key:12,class:"gvp-bottom-fade"},xn=e.defineComponent({__name:"VideoPlayer",props:{src:{},poster:{},playlist:{},defaultIndex:{default:0},autoAdvance:{type:Boolean,default:!0},showDeviceToggle:{type:Boolean,default:!0},defaultDevice:{default:"desktop"},hoverPlay:{type:Boolean,default:!1},tooltipText:{},muted:{type:Boolean,default:!0},loop:{type:Boolean,default:!1},controls:{type:[Boolean,String],default:!0},autoPlay:{type:Boolean,default:!1},frameMaxWidth:{},aspectRatio:{},hlsConfig:{},isHls:{type:Boolean},thumbnails:{},chapters:{},class:{default:""},closable:{type:Boolean,default:!1}},emits:["close","play","pause","ended","time-update","seeked","volume-change","milestone","error","playlist-change"],setup(n,{emit:a}){const o=n,t=a,u=e.ref(null),r=e.ref(o.defaultDevice),m=e.ref(!1),f=e.ref(!1),E=e.ref(null),w=e.ref([]),b=e.ref(-1),B=e.ref([]),h=e.ref(-1),p=e.ref(-1),g=e.ref(1),v=e.ref(!1),y=e.ref(!1),_=e.ref(null),D=typeof document<"u"&&!!document.pictureInPictureEnabled,V=e.computed(()=>o.controls===!0||o.controls==="custom"),q=e.computed(()=>o.controls==="native"),k=e.computed(()=>Array.isArray(o.playlist)&&o.playlist.length>0),N=e.ref(k.value?Math.min(Math.max(o.defaultIndex,0),o.playlist.length-1):0),M=e.computed(()=>k.value?o.playlist[Math.min(N.value,o.playlist.length-1)]:null),L=e.computed(()=>{var c;return((c=M.value)==null?void 0:c.src)??o.src??""}),$=e.computed(()=>{var c;return((c=M.value)==null?void 0:c.poster)??o.poster}),T=e.computed(()=>{var c;return((c=M.value)==null?void 0:c.thumbnails)??o.thumbnails}),G=e.computed(()=>{var c;return((c=M.value)==null?void 0:c.chapters)??o.chapters}),ve=e.computed(()=>k.value&&N.value>0),Z=e.computed(()=>k.value&&N.value<o.playlist.length-1);let W=!1;function Y(c,d=!1){if(!k.value)return;const x=Math.min(Math.max(c,0),o.playlist.length-1);x!==N.value&&(W=d,N.value=x,t("playlist-change",x,o.playlist[x]))}const H=e.computed(()=>Le(L.value)),P=e.computed(()=>H.value!==null),pe=e.computed(()=>H.value?$e(H.value,{autoPlay:o.autoPlay,muted:o.muted,loop:o.loop,controls:V.value?!0:q.value,startSeconds:_e(L.value)}):null);function me(c){w.value=c,b.value=-1}function F(c){B.value=c,p.value=-1}const O=e.computed(()=>!P.value&&w.value.length>1),le=e.computed(()=>{var c;return b.value>=0?b.value:((c=w.value[0])==null?void 0:c.index)??-1}),fe=e.computed(()=>{var c,d;return r.value==="mobile"?((c=o.aspectRatio)==null?void 0:c.mobile)??"9/16":((d=o.aspectRatio)==null?void 0:d.desktop)??"16/9"}),j=e.computed(()=>{var c,d;return r.value==="mobile"?((c=o.frameMaxWidth)==null?void 0:c.mobile)??"420px":((d=o.frameMaxWidth)==null?void 0:d.desktop)??"960px"}),z=e.computed(()=>{var c;return((c=u.value)==null?void 0:c.videoEl)??null});async function ee(){const c=z.value;if(c)try{c.readyState<2&&c.load();const d=c.play();E.value=d,await d,m.value=!0}catch{m.value=!1}finally{E.value=null}}async function ae(){const c=z.value;if(c){if(E.value)try{await E.value}catch{}c.pause()}}async function K(){!o.hoverPlay||P.value||await ee()}async function re(){!o.hoverPlay||P.value||(await ae(),m.value=!1)}async function Q(){const c=z.value;c&&(c.paused?await ee():(await ae(),m.value=!1))}function X(){m.value=!1,t("ended"),k.value&&o.autoAdvance&&Z.value&&Y(N.value+1,!0)}e.watch(L,()=>{W&&(W=!1,ee())});function A(){f.value=!0,K()}function R(){f.value=!1,re()}function se(c){g.value=c;const d=z.value;d&&(d.playbackRate=c)}e.watch(z,c=>{if(!c)return;c.addEventListener("ratechange",()=>{g.value=c.playbackRate}),c.addEventListener("enterpictureinpicture",()=>{v.value=!0}),c.addEventListener("leavepictureinpicture",()=>{v.value=!1});const d=new Set;c.addEventListener("timeupdate",()=>{const x=c.duration;if(t("time-update",c.currentTime,Number.isFinite(x)?x:0),!Number.isFinite(x)||x<=0)return;const J=c.currentTime/x*100;for(const I of[25,50,75,100])J>=I&&!d.has(I)&&(d.add(I),t("milestone",I))}),c.addEventListener("seeked",()=>{t("seeked",c.currentTime)}),c.addEventListener("volumechange",()=>{t("volume-change",c.volume,c.muted)}),c.addEventListener("error",()=>{t("error")})});function te(){const c=z.value;c&&(document.pictureInPictureElement?document.exitPictureInPicture().catch(()=>{}):c.requestPictureInPicture().catch(()=>{}))}function ie(c){var J,I,ce;const d=z.value;if(!(!d||!y.value&&!((J=_.value)!=null&&J.contains(document.activeElement))||c.target.tagName==="INPUT"&&c.key!==" "))switch(c.key){case" ":case"k":c.preventDefault(),Q();break;case"ArrowLeft":c.preventDefault(),d.currentTime=Math.max(0,d.currentTime-5);break;case"ArrowRight":c.preventDefault(),d.currentTime=Math.min(d.duration||0,d.currentTime+5);break;case"ArrowUp":c.preventDefault(),d.volume=Math.min(1,d.volume+.1),d.muted&&(d.muted=!1);break;case"ArrowDown":c.preventDefault(),d.volume=Math.max(0,d.volume-.1);break;case"m":d.muted=!d.muted;break;case"f":{const ke=document.fullscreenElement??document.webkitFullscreenElement??null,ue=((I=_.value)==null?void 0:I.requestFullscreen)??((ce=_.value)==null?void 0:ce.webkitRequestFullscreen),ne=document.exitFullscreen??document.webkitExitFullscreen;ke===_.value?ne==null||ne.call(document).catch(()=>{}):ue&&_.value&&ue.call(_.value).catch(()=>{});break}case"p":D&&te();break}}return e.onMounted(()=>{document.addEventListener("keydown",ie)}),e.onBeforeUnmount(()=>{document.removeEventListener("keydown",ie)}),(c,d)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootEl",ref:_,class:e.normalizeClass(["gvp-root",o.class]),style:e.normalizeStyle({width:j.value,aspectRatio:fe.value}),onMouseenter:d[12]||(d[12]=x=>{y.value=!0,A()}),onMouseleave:d[13]||(d[13]=x=>{y.value=!1,R()})},[P.value?(e.openBlock(),e.createElementBlock("iframe",{key:0,class:"gvp-video gvp-youtube",src:pe.value??void 0,title:"YouTube video player",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowfullscreen:"",referrerpolicy:"strict-origin-when-cross-origin"},null,8,pn)):(e.openBlock(),e.createBlock(be,{ref_key:"hlsPlayerRef",ref:u,key:L.value,controls:q.value,"hls-config":n.hlsConfig,"is-hls":n.isHls,loop:n.loop,muted:n.muted,"auto-play":n.autoPlay,"audio-track-index":b.value,"quality-level-index":p.value,"plays-inline":!0,poster:$.value,src:L.value,class:"gvp-video",preload:"metadata",onAudioTracks:me,onQualityLevels:F,onCurrentLevel:d[0]||(d[0]=x=>h.value=x),onEnded:X,onPause:d[1]||(d[1]=x=>{m.value=!1,t("pause")}),onPlay:d[2]||(d[2]=x=>{m.value=!0,t("play")})},{default:e.withCtx(()=>[e.renderSlot(c.$slots,"default")]),_:3},8,["controls","hls-config","is-hls","loop","muted","auto-play","audio-track-index","quality-level-index","poster","src"])),P.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",mn)),n.showDeviceToggle?(e.openBlock(),e.createElementBlock("div",fn,[e.createElementVNode("div",kn,[e.createElementVNode("button",{"aria-pressed":r.value==="desktop",class:e.normalizeClass(["gvp-toggle-btn",{"is-active":r.value==="desktop"}]),"aria-label":"Desktop view",type:"button",onClick:d[3]||(d[3]=x=>r.value="desktop")},[e.createVNode(an)],10,hn),d[14]||(d[14]=e.createElementVNode("div",{class:"gvp-toggle-divider"},null,-1)),e.createElementVNode("button",{"aria-pressed":r.value==="mobile",class:e.normalizeClass(["gvp-toggle-btn",{"is-active":r.value==="mobile"}]),"aria-label":"Mobile view",type:"button",onClick:d[4]||(d[4]=x=>r.value="mobile")},[e.createVNode(sn)],10,gn)])])):e.createCommentVNode("",!0),n.closable?(e.openBlock(),e.createElementBlock("button",{key:4,"aria-label":"Close",class:"gvp-close",type:"button",onClick:d[5]||(d[5]=x=>t("close"))},[e.createVNode(vn)])):e.createCommentVNode("",!0),O.value&&!V.value?(e.openBlock(),e.createBlock(Ue,{key:5,tracks:w.value,"active-index":le.value,onSelect:d[6]||(d[6]=x=>b.value=x)},null,8,["tracks","active-index"])):e.createCommentVNode("",!0),!P.value&&!V.value?(e.openBlock(),e.createBlock(Ye,{key:6,speed:g.value,onSelect:se},null,8,["speed"])):e.createCommentVNode("",!0),!P.value&&!V.value?(e.openBlock(),e.createBlock(tt,{key:7,video:z.value},null,8,["video"])):e.createCommentVNode("",!0),!P.value&&e.unref(D)&&!V.value?(e.openBlock(),e.createElementBlock("button",{key:8,type:"button",class:e.normalizeClass(["gvp-pip-btn",{"is-active":v.value}]),"aria-label":v.value?"Exit picture-in-picture":"Picture-in-picture","aria-pressed":v.value,onClick:te},[e.createVNode(Ve)],10,yn)):e.createCommentVNode("",!0),!P.value&&V.value?(e.openBlock(),e.createElementBlock("button",{key:9,type:"button",class:"gvp-click-layer","aria-label":m.value?"Pause":"Play",onClick:Q},null,8,Cn)):e.createCommentVNode("",!0),!P.value&&!V.value&&!m.value?(e.openBlock(),e.createElementBlock("div",En,[e.createElementVNode("button",{"aria-label":"Play",class:"gvp-play",type:"button",onClick:Q,onMouseenter:d[7]||(d[7]=x=>f.value=!0),onMouseleave:d[8]||(d[8]=x=>f.value=!1)},[e.createVNode(un),n.tooltipText&&f.value?(e.openBlock(),e.createElementBlock("span",wn,e.toDisplayString(n.tooltipText),1)):e.createCommentVNode("",!0)],32)])):e.createCommentVNode("",!0),!P.value&&V.value?(e.openBlock(),e.createBlock(on,{key:11,video:z.value,"is-playing":m.value,container:_.value,"on-toggle-play":Q,"quality-levels":B.value,"current-level":h.value,"selected-level":p.value,thumbnails:T.value,chapters:G.value,"has-prev":ve.value,"has-next":Z.value,onSelectLevel:d[9]||(d[9]=x=>p.value=x),onPrev:d[10]||(d[10]=x=>Y(N.value-1,!0)),onNext:d[11]||(d[11]=x=>Y(N.value+1,!0))},null,8,["video","is-playing","container","quality-levels","current-level","selected-level","thumbnails","chapters","has-prev","has-next"])):e.createCommentVNode("",!0),!P.value&&!V.value?(e.openBlock(),e.createElementBlock("div",bn)):e.createCommentVNode("",!0)],38))}});exports.HLSPlayer=be;exports.VueVideoPlayer=xn;exports.parseYouTubeId=Le;exports.parseYouTubeStart=_e;exports.youTubeEmbedUrl=$e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),Z=require("hls.js");function we(t,l,n){const o=t==null?void 0:t.trim();if(o)return o;if(l){try{const u=new Intl.DisplayNames(void 0,{type:"language"}).of(l);if(u&&u!==l)return u}catch{}return l}return`Audio ${n+1}`}const Ze={index:-1,height:0,label:"Auto"};function We(t,l){return t>0?`${t}p`:`Level ${l+1}`}const Ke=["muted","loop","controls","autoplay","playsinline","preload","poster"],Ve=e.defineComponent({__name:"HLSPlayer",props:{src:{},hlsConfig:{},isHls:{type:Boolean},muted:{type:Boolean,default:!0},loop:{type:Boolean,default:!1},controls:{type:Boolean,default:!1},autoPlay:{type:Boolean,default:!1},playsInline:{type:Boolean,default:!0},preload:{default:"metadata"},poster:{},class:{},audioTrackIndex:{default:-1},qualityLevelIndex:{default:-1}},emits:["play","pause","ended","fatal-error","live-change","audio-tracks","quality-levels","current-level"],setup(t,{expose:l,emit:n}){const o=t,r=n,u=e.ref(null),c=e.ref(null);let p,C;const N=globalThis.window!==void 0&&Z.isSupported(),V=v=>!!o.isHls||N&&v.endsWith(".m3u8");function b(){C==null||C(),C=void 0,p==null||p(),p=void 0,c.value&&(c.value.destroy(),c.value=null);const v=u.value;if(v){for(v.pause(),v.removeAttribute("src");v.firstChild;)v.firstChild.remove();v.load(),r("audio-tracks",[]),r("quality-levels",[]),r("current-level",-1),r("live-change",!1)}}function h(v){var M,D,W;const x=u.value;if(!x||!v)return;b();const A=()=>{o.autoPlay&&x.play().catch(()=>{})};if(V(v)){const y=new Z(o.hlsConfig);c.value=y;const z=()=>{const S=y.audioTracks.map((L,_)=>({index:_,label:we(L.name,L.lang,_),lang:L.lang||void 0}));r("audio-tracks",S)},$=()=>{const S=y.levels.map((L,_)=>({index:_,height:L.height||0,label:We(L.height||0,_)}));r("quality-levels",S)};y.on(Z.Events.MANIFEST_PARSED,A),y.on(Z.Events.MANIFEST_PARSED,$),y.on(Z.Events.LEVELS_UPDATED,$),y.on(Z.Events.LEVEL_SWITCHED,(S,L)=>{r("current-level",L.level)}),y.on(Z.Events.AUDIO_TRACKS_UPDATED,z),y.on(Z.Events.AUDIO_TRACK_SWITCHED,z),y.on(Z.Events.LEVEL_LOADED,(S,L)=>{var _;r("live-change",!!((_=L.details)!=null&&_.live))});let P=!1;y.on(Z.Events.ERROR,(S,L)=>{L.fatal&&(L.type===Z.ErrorTypes.NETWORK_ERROR&&!P?(P=!0,y.startLoad()):L.type===Z.ErrorTypes.MEDIA_ERROR&&!P?(P=!0,y.recoverMediaError()):(y.destroy(),c.value=null,r("fatal-error")))}),y.attachMedia(x),y.loadSource(v)}else{x.src=v,x.load(),x.addEventListener("loadedmetadata",A,{once:!0}),C=()=>{x.removeEventListener("loadedmetadata",A)};const y=x.audioTracks;if(y){const z=()=>{const $=[];for(let P=0;P<y.length;P++){const S=y[P];$.push({index:P,label:we(S.label,S.language,P),lang:S.language||void 0})}r("audio-tracks",$)};(M=y.addEventListener)==null||M.call(y,"addtrack",z),(D=y.addEventListener)==null||D.call(y,"removetrack",z),(W=y.addEventListener)==null||W.call(y,"change",z),y.length>0&&z(),p=()=>{var $,P,S;($=y.removeEventListener)==null||$.call(y,"addtrack",z),(P=y.removeEventListener)==null||P.call(y,"removetrack",z),(S=y.removeEventListener)==null||S.call(y,"change",z)}}}}function E(v){var M;if(v==null||v<0)return;const x=c.value;if(x){x.audioTrack!==v&&(x.audioTrack=v);return}const A=(M=u.value)==null?void 0:M.audioTracks;if(A)for(let D=0;D<A.length;D++)A[D].enabled=D===v}function B(v){if(v==null)return;const x=c.value;x&&x.currentLevel!==v&&(x.currentLevel=v)}return e.onMounted(()=>{o.src&&h(o.src)}),e.watch(()=>o.src,v=>{v&&h(v)}),e.watch(()=>o.audioTrackIndex,v=>E(v)),e.watch(()=>o.qualityLevelIndex,v=>B(v)),e.onBeforeUnmount(b),l({videoEl:u}),(v,x)=>(e.openBlock(),e.createElementBlock("video",{ref_key:"videoEl",ref:u,muted:t.muted,loop:t.loop,controls:t.controls,autoplay:t.autoPlay,playsinline:t.playsInline,preload:t.preload,poster:t.poster,class:e.normalizeClass(o.class),onPlay:x[0]||(x[0]=A=>r("play")),onPause:x[1]||(x[1]=A=>r("pause")),onEnded:x[2]||(x[2]=A=>r("ended"))},[e.renderSlot(v.$slots,"default")],42,Ke))}}),Qe={name:"IconAudio"},Ye=e.defineComponent({...Qe,props:{class:{}},setup(t){const l=t;return(n,o)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...o[0]||(o[0]=[e.createElementVNode("path",{d:"M3 14V10C3 9.44772 3.44772 9 4 9H6.58579C6.851 9 7.10536 8.89464 7.29289 8.70711L11.2929 4.70711C11.9229 4.07714 13 4.52331 13 5.41421V18.5858C13 19.4767 11.9229 19.9229 11.2929 19.2929L7.29289 15.2929C7.10536 15.1054 6.851 15 6.58579 15H4C3.44772 15 3 14.5523 3 14Z",stroke:"currentColor","stroke-width":"1.5","stroke-linejoin":"round"},null,-1),e.createElementVNode("path",{d:"M16.5 8C17.5 9 18 10.5 18 12C18 13.5 17.5 15 16.5 16M19 5.5C20.5 7 21.5 9.5 21.5 12C21.5 14.5 20.5 17 19 18.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])],2))}}),Ge={name:"IconChevron"},Le=e.defineComponent({...Ge,props:{class:{}},setup(t){const l=t;return(n,o)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...o[0]||(o[0]=[e.createElementVNode("path",{d:"M6 9L12 15L18 9",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))}}),Je=["aria-expanded"],Xe={class:"gvp-audio-label"},et={key:0,class:"gvp-audio-menu",role:"listbox","aria-label":"Audio tracks"},tt=["aria-selected","onClick"],nt=e.defineComponent({__name:"AudioTrackSwitcher",props:{tracks:{},activeIndex:{}},emits:["select"],setup(t,{emit:l}){const n=t,o=l,r=e.ref(!1),u=e.ref(null),c=e.computed(()=>n.tracks.find(V=>V.index===n.activeIndex)??n.tracks[0]);function p(V){u.value&&!u.value.contains(V.target)&&(r.value=!1)}function C(V){V.key==="Escape"&&(r.value=!1)}e.watch(r,V=>{V?(document.addEventListener("mousedown",p),document.addEventListener("keydown",C)):(document.removeEventListener("mousedown",p),document.removeEventListener("keydown",C))}),e.onBeforeUnmount(()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",C)});function N(V){o("select",V),r.value=!1}return(V,b)=>{var h;return e.openBlock(),e.createElementBlock("div",{ref_key:"rootEl",ref:u,class:"gvp-audio"},[e.createElementVNode("button",{type:"button",class:"gvp-audio-btn","aria-haspopup":"listbox","aria-expanded":r.value,"aria-label":"Audio track",onClick:b[0]||(b[0]=E=>r.value=!r.value)},[e.createVNode(Ye),e.createElementVNode("span",Xe,e.toDisplayString((h=c.value)==null?void 0:h.label),1),e.createVNode(Le)],8,Je),r.value?(e.openBlock(),e.createElementBlock("ul",et,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.tracks,E=>(e.openBlock(),e.createElementBlock("li",{key:E.index},[e.createElementVNode("button",{type:"button",role:"option","aria-selected":E.index===t.activeIndex,class:e.normalizeClass(["gvp-audio-menu-item",{"is-active":E.index===t.activeIndex}]),onClick:B=>N(E.index)},e.toDisplayString(E.label),11,tt)]))),128))])):e.createCommentVNode("",!0)],512)}}}),ot={name:"IconSpeed"},lt=e.defineComponent({...ot,props:{class:{}},setup(t){const l=t;return(n,o)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...o[0]||(o[0]=[e.createElementVNode("path",{d:"M12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2Z",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("path",{d:"M12 8V12L14.5 14.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))}}),at=["aria-expanded"],rt={class:"gvp-speed-label"},st={key:0,class:"gvp-speed-menu",role:"listbox","aria-label":"Playback speed"},it=["aria-selected","onClick"],ct=e.defineComponent({__name:"SpeedSwitcher",props:{speed:{}},emits:["select"],setup(t,{emit:l}){const n=[.5,.75,1,1.25,1.5,2],o=l,r=e.ref(!1),u=e.ref(null);function c(N){u.value&&!u.value.contains(N.target)&&(r.value=!1)}function p(N){N.key==="Escape"&&(r.value=!1)}e.watch(r,N=>{N?(document.addEventListener("mousedown",c),document.addEventListener("keydown",p)):(document.removeEventListener("mousedown",c),document.removeEventListener("keydown",p))}),e.onBeforeUnmount(()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",p)});function C(N){o("select",N),r.value=!1}return(N,V)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"rootEl",ref:u,class:"gvp-speed"},[e.createElementVNode("button",{type:"button",class:"gvp-speed-btn","aria-haspopup":"listbox","aria-expanded":r.value,"aria-label":"`Playback speed: ${speed === 1 ? '1×' : speed + '×'}`",onClick:V[0]||(V[0]=b=>r.value=!r.value)},[e.createVNode(lt),e.createElementVNode("span",rt,e.toDisplayString(t.speed===1?"1×":`${t.speed}×`),1),e.createVNode(Le)],8,at),r.value?(e.openBlock(),e.createElementBlock("ul",st,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(n,b=>e.createElementVNode("li",{key:b},[e.createElementVNode("button",{type:"button",role:"option","aria-selected":b===t.speed,class:e.normalizeClass(["gvp-speed-menu-item",{"is-active":b===t.speed}]),onClick:h=>C(b)},e.toDisplayString(b===1?"Normal":`${b}×`),11,it)])),64))])):e.createCommentVNode("",!0)],512))}}),ut={name:"IconCaptions"},dt=e.defineComponent({...ut,props:{class:{}},setup(t){const l=t;return(n,o)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...o[0]||(o[0]=[e.createElementVNode("rect",{x:"2",y:"5",width:"20",height:"14",rx:"3",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("path",{d:"M7 12H11M13 12H17M7 15H9M11 15H13M15 15H17",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])],2))}}),vt=["aria-expanded","aria-pressed"],mt={key:0,class:"gvp-captions-menu",role:"listbox","aria-label":"Captions"},pt=["aria-selected"],ft=["aria-selected","onClick"],kt=e.defineComponent({__name:"CaptionsSwitcher",props:{video:{}},setup(t){const l=t,n=e.ref([]),o=e.ref(-1),r=e.ref(!1),u=e.ref(null);function c(h){const E=[];for(let v=0;v<h.length;v++){const x=h[v];(x.kind==="subtitles"||x.kind==="captions")&&E.push({index:v,label:x.label||x.language||`Track ${v+1}`})}n.value=E;let B=-1;for(let v=0;v<h.length;v++)if(h[v].mode==="showing"){B=v;break}o.value=B}let p=null;e.watch(()=>l.video,h=>{if(p==null||p(),p=null,!h){n.value=[],o.value=-1;return}const E=h.textTracks;c(E);const B=()=>c(E);typeof E.addEventListener=="function"&&(E.addEventListener("addtrack",B),E.addEventListener("removetrack",B),E.addEventListener("change",B),p=()=>{E.removeEventListener("addtrack",B),E.removeEventListener("removetrack",B),E.removeEventListener("change",B)})},{immediate:!0}),e.onBeforeUnmount(()=>{p==null||p(),document.removeEventListener("mousedown",C),document.removeEventListener("keydown",N)});function C(h){u.value&&!u.value.contains(h.target)&&(r.value=!1)}function N(h){h.key==="Escape"&&(r.value=!1)}e.watch(r,h=>{h?(document.addEventListener("mousedown",C),document.addEventListener("keydown",N)):(document.removeEventListener("mousedown",C),document.removeEventListener("keydown",N))});function V(){if(!l.video)return;const h=l.video.textTracks;for(let E=0;E<h.length;E++)h[E].mode="hidden";o.value=-1,r.value=!1}function b(h){if(!l.video)return;const E=l.video.textTracks;for(let B=0;B<E.length;B++)E[B].mode=B===h?"showing":"hidden";o.value=h,r.value=!1}return(h,E)=>n.value.length>0?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"rootEl",ref:u,class:"gvp-captions"},[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["gvp-captions-btn",{"is-active":o.value>=0}]),"aria-haspopup":"listbox","aria-expanded":r.value,"aria-pressed":o.value>=0,"aria-label":"Captions",onClick:E[0]||(E[0]=B=>r.value=!r.value)},[e.createVNode(dt)],10,vt),r.value?(e.openBlock(),e.createElementBlock("ul",mt,[e.createElementVNode("li",null,[e.createElementVNode("button",{type:"button",role:"option","aria-selected":o.value===-1,class:e.normalizeClass(["gvp-captions-menu-item",{"is-active":o.value===-1}]),onClick:V}," Off ",10,pt)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,B=>(e.openBlock(),e.createElementBlock("li",{key:B.index},[e.createElementVNode("button",{type:"button",role:"option","aria-selected":B.index===o.value,class:e.normalizeClass(["gvp-captions-menu-item",{"is-active":B.index===o.value}]),onClick:v=>b(B.index)},e.toDisplayString(B.label),11,ft)]))),128))])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0)}}),gt={name:"IconPause"},ht=e.defineComponent({...gt,props:{class:{}},setup(t){const l=t;return(n,o)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...o[0]||(o[0]=[e.createElementVNode("rect",{x:"6",y:"5",width:"4",height:"14",rx:"1",fill:"currentColor"},null,-1),e.createElementVNode("rect",{x:"14",y:"5",width:"4",height:"14",rx:"1",fill:"currentColor"},null,-1)])],2))}}),yt={name:"IconPlaySolid"},Et=e.defineComponent({...yt,props:{class:{}},setup(t){const l=t;return(n,o)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...o[0]||(o[0]=[e.createElementVNode("path",{d:"M7 5.5V18.5C7 19.2659 7.84856 19.7261 8.4899 19.3071L19.0801 12.4014C19.6644 12.0204 19.6644 11.9796 19.0801 11.5986L8.4899 4.69288C7.84856 4.27388 7 4.73408 7 5.5Z",fill:"currentColor"},null,-1)])],2))}}),Ct={name:"IconPrev"},wt=e.defineComponent({...Ct,props:{class:{}},setup(t){const l=t;return(n,o)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...o[0]||(o[0]=[e.createElementVNode("path",{d:"M16.5 18.5V5.5C16.5 4.73408 15.6514 4.27388 15.0101 4.69288L6.91993 9.98432C6.33563 10.3653 6.33563 11.0347 6.91993 11.4157L15.0101 16.7071C15.6514 17.1261 16.5 16.6659 16.5 15.9V18.5Z",fill:"currentColor"},null,-1),e.createElementVNode("path",{d:"M6 5V19",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},null,-1)])],2))}}),bt={name:"IconNext"},Bt=e.defineComponent({...bt,props:{class:{}},setup(t){const l=t;return(n,o)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...o[0]||(o[0]=[e.createElementVNode("path",{d:"M7.5 5.5V18.5C7.5 19.2659 8.34856 19.7261 8.98990 19.3071L17.0801 14.0157C17.6644 13.6347 17.6644 12.9653 17.0801 12.5843L8.98990 7.29288C8.34856 6.87388 7.5 7.33408 7.5 8.1V5.5Z",fill:"currentColor"},null,-1),e.createElementVNode("path",{d:"M18 5V19",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},null,-1)])],2))}}),xt={name:"IconVolumeHigh"},Nt=e.defineComponent({...xt,props:{class:{}},setup(t){const l=t;return(n,o)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...o[0]||(o[0]=[e.createElementVNode("path",{d:"M3 14V10C3 9.44772 3.44772 9 4 9H6.58579C6.851 9 7.10536 8.89464 7.29289 8.70711L11.2929 4.70711C11.9229 4.07714 13 4.52331 13 5.41421V18.5858C13 19.4767 11.9229 19.9229 11.2929 19.2929L7.29289 15.2929C7.10536 15.1054 6.851 15 6.58579 15H4C3.44772 15 3 14.5523 3 14Z",stroke:"currentColor","stroke-width":"1.5","stroke-linejoin":"round"},null,-1),e.createElementVNode("path",{d:"M16.5 8C17.5 9 18 10.5 18 12C18 13.5 17.5 15 16.5 16M19 5.5C20.5 7 21.5 9.5 21.5 12C21.5 14.5 20.5 17 19 18.5",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])],2))}}),Vt={name:"IconVolumeLow"},Lt=e.defineComponent({...Vt,props:{class:{}},setup(t){const l=t;return(n,o)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...o[0]||(o[0]=[e.createElementVNode("path",{d:"M3 14V10C3 9.44772 3.44772 9 4 9H6.58579C6.851 9 7.10536 8.89464 7.29289 8.70711L11.2929 4.70711C11.9229 4.07714 13 4.52331 13 5.41421V18.5858C13 19.4767 11.9229 19.9229 11.2929 19.2929L7.29289 15.2929C7.10536 15.1054 6.851 15 6.58579 15H4C3.44772 15 3 14.5523 3 14Z",stroke:"currentColor","stroke-width":"1.5","stroke-linejoin":"round"},null,-1),e.createElementVNode("path",{d:"M16.5 8C17.5 9 18 10.5 18 12C18 13.5 17.5 15 16.5 16",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])],2))}}),$t={name:"IconVolumeMuted"},_t=e.defineComponent({...$t,props:{class:{}},setup(t){const l=t;return(n,o)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...o[0]||(o[0]=[e.createElementVNode("path",{d:"M3 14V10C3 9.44772 3.44772 9 4 9H6.58579C6.851 9 7.10536 8.89464 7.29289 8.70711L11.2929 4.70711C11.9229 4.07714 13 4.52331 13 5.41421V18.5858C13 19.4767 11.9229 19.9229 11.2929 19.2929L7.29289 15.2929C7.10536 15.1054 6.851 15 6.58579 15H4C3.44772 15 3 14.5523 3 14Z",stroke:"currentColor","stroke-width":"1.5","stroke-linejoin":"round"},null,-1),e.createElementVNode("path",{d:"M16 9L22 15M22 9L16 15",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])],2))}}),Pt={name:"IconPiP"},$e=e.defineComponent({...Pt,props:{class:{}},setup(t){const l=t;return(n,o)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...o[0]||(o[0]=[e.createElementVNode("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",stroke:"currentColor","stroke-width":"1.5"},null,-1),e.createElementVNode("rect",{x:"12",y:"12",width:"8",height:"5",rx:"1",fill:"currentColor"},null,-1)])],2))}}),St={name:"IconFullscreen"},Tt=e.defineComponent({...St,props:{class:{}},setup(t){const l=t;return(n,o)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...o[0]||(o[0]=[e.createElementVNode("path",{d:"M4 9V4H9M15 4H20V9M20 15V20H15M9 20H4V15",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))}}),Mt={name:"IconFullscreenExit"},It=e.defineComponent({...Mt,props:{class:{}},setup(t){const l=t;return(n,o)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...o[0]||(o[0]=[e.createElementVNode("path",{d:"M9 4V9H4M15 9V4H20M15 20V15H20M9 15H4V20",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))}}),At={name:"IconGear"},zt=e.defineComponent({...At,props:{class:{}},setup(t){const l=t;return(n,o)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...o[0]||(o[0]=[e.createElementVNode("path",{d:"M12 15.5A3.5 3.5 0 1 0 12 8.5A3.5 3.5 0 0 0 12 15.5Z",stroke:"currentColor","stroke-width":"2"},null,-1),e.createElementVNode("path",{d:"M19.4 13A1.65 1.65 0 0 0 19.73 14.82L19.79 14.88A2 2 0 1 1 16.96 17.71L16.9 17.65A1.65 1.65 0 0 0 15.08 17.32A1.65 1.65 0 0 0 14 18.83V19A2 2 0 1 1 10 19V18.91A1.65 1.65 0 0 0 8.83 17.4A1.65 1.65 0 0 0 7.01 17.73L6.95 17.79A2 2 0 1 1 4.12 14.96L4.18 14.9A1.65 1.65 0 0 0 4.51 13.08A1.65 1.65 0 0 0 3 12H2.91A2 2 0 1 1 2.91 8H3A1.65 1.65 0 0 0 4.51 6.83A1.65 1.65 0 0 0 4.18 5.01L4.12 4.95A2 2 0 1 1 6.95 2.12L7.01 2.18A1.65 1.65 0 0 0 8.83 2.51H8.91A1.65 1.65 0 0 0 10 1V0.91A2 2 0 1 1 14 0.91V1A1.65 1.65 0 0 0 15.08 2.51A1.65 1.65 0 0 0 16.9 2.18L16.96 2.12A2 2 0 1 1 19.79 4.95L19.73 5.01A1.65 1.65 0 0 0 19.4 6.83V6.91A1.65 1.65 0 0 0 21 8H21.09A2 2 0 1 1 21.09 12H21A1.65 1.65 0 0 0 19.4 13Z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))}}),Dt={name:"IconChevronRight"},ue=e.defineComponent({...Dt,props:{class:{}},setup(t){const l=t;return(n,o)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...o[0]||(o[0]=[e.createElementVNode("path",{d:"M9 6L15 12L9 18",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))}}),Ht={name:"IconCheck"},ae=e.defineComponent({...Ht,props:{class:{}},setup(t){const l=t;return(n,o)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...o[0]||(o[0]=[e.createElementVNode("path",{d:"M5 12L10 17L19 7",stroke:"currentColor","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))}}),Ft=["aria-expanded"],Rt={key:0,class:"gvp-settings-menu",role:"menu"},qt={class:"gvp-settings-row-value"},Ot={class:"gvp-settings-row-value"},Ut={class:"gvp-settings-row-value"},jt={class:"gvp-settings-row-value"},Zt=["aria-checked","onClick"],Wt={class:"gvp-settings-check"},Kt=["aria-checked"],Qt={class:"gvp-settings-check"},Yt=["aria-checked","onClick"],Gt={class:"gvp-settings-check"},Jt=["aria-checked"],Xt={class:"gvp-settings-check"},en=["aria-checked","onClick"],tn={class:"gvp-settings-check"},nn=["aria-checked","onClick"],on={class:"gvp-settings-check"},ln={name:"SettingsMenu"},an=e.defineComponent({...ln,props:{video:{},qualityLevels:{default:()=>[]},currentLevel:{default:-1},selectedLevel:{default:-1},audioTracks:{default:()=>[]},audioTrackIndex:{default:-1}},emits:["select-level","select-audio-track"],setup(t,{emit:l}){const n=t,o=l,r=[.5,.75,1,1.25,1.5,2],u=e.ref(!1),c=e.ref("root"),p=e.ref(null),C=e.ref(1);e.watch(()=>n.video,k=>{if(!k)return;const d=()=>{C.value=k.playbackRate};d(),k.addEventListener("ratechange",d)},{immediate:!0});function N(k){n.video&&(n.video.playbackRate=k),C.value=k,c.value="root"}const V=e.ref([]),b=e.ref(-1);function h(k){const d=[];for(let m=0;m<k.length;m++){const H=k[m];(H.kind==="subtitles"||H.kind==="captions")&&d.push({index:m,label:H.label||H.language||`Track ${m+1}`})}V.value=d;let O=-1;for(let m=0;m<k.length;m++)if(k[m].mode==="showing"){O=m;break}b.value=O}e.watch(()=>n.video,k=>{if(!k){V.value=[],b.value=-1;return}const d=k.textTracks;h(d);const O=()=>h(d);typeof d.addEventListener=="function"&&(d.addEventListener("addtrack",O),d.addEventListener("removetrack",O),d.addEventListener("change",O))},{immediate:!0});function E(k){var O;const d=(O=n.video)==null?void 0:O.textTracks;if(d)for(let m=0;m<d.length;m++)d[m].mode=m===k?"showing":"hidden";b.value=k,c.value="root"}const B=e.computed(()=>[...n.qualityLevels].sort((k,d)=>d.height-k.height)),v=e.computed(()=>n.qualityLevels.find(k=>k.index===n.currentLevel)),x=e.computed(()=>{var k;return n.selectedLevel<0?v.value?`Auto (${v.value.label})`:"Auto":((k=n.qualityLevels.find(d=>d.index===n.selectedLevel))==null?void 0:k.label)??"Auto"});function A(k){o("select-level",k),c.value="root"}const M=e.computed(()=>n.audioTracks.find(k=>k.index===n.audioTrackIndex)??n.audioTracks[0]);function D(k){o("select-audio-track",k),c.value="root"}const W=e.computed(()=>n.qualityLevels.length>=2),y=e.computed(()=>V.value.length>0),z=e.computed(()=>n.audioTracks.length>1),$=e.computed(()=>C.value===1?"Normal":`${C.value}×`),P=e.computed(()=>{var k;return b.value<0?"Off":((k=V.value.find(d=>d.index===b.value))==null?void 0:k.label)??"Off"});function S(){u.value=!1,c.value="root"}function L(k){p.value&&!p.value.contains(k.target)&&S()}function _(k){k.key==="Escape"&&S()}e.watch(u,k=>{k?(document.addEventListener("mousedown",L),document.addEventListener("keydown",_)):(document.removeEventListener("mousedown",L),document.removeEventListener("keydown",_))}),e.onBeforeUnmount(()=>{document.removeEventListener("mousedown",L),document.removeEventListener("keydown",_)});function J(){u.value=!u.value,c.value="root"}return(k,d)=>{var O;return e.openBlock(),e.createElementBlock("div",{ref_key:"rootEl",ref:p,class:"gvp-settings"},[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["gvp-ctrl-btn",{"is-active":u.value}]),"aria-haspopup":"menu","aria-expanded":u.value,"aria-label":"Settings",onClick:J},[e.createVNode(zt)],10,Ft),u.value?(e.openBlock(),e.createElementBlock("div",Rt,[c.value==="root"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("button",{type:"button",role:"menuitem",class:"gvp-settings-row",onClick:d[0]||(d[0]=m=>c.value="speed")},[d[7]||(d[7]=e.createElementVNode("span",{class:"gvp-settings-row-label"},"Speed",-1)),e.createElementVNode("span",qt,e.toDisplayString($.value),1),e.createVNode(ue,{class:"gvp-settings-chevron"})]),W.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",role:"menuitem",class:"gvp-settings-row",onClick:d[1]||(d[1]=m=>c.value="quality")},[d[8]||(d[8]=e.createElementVNode("span",{class:"gvp-settings-row-label"},"Quality",-1)),e.createElementVNode("span",Ot,e.toDisplayString(x.value),1),e.createVNode(ue,{class:"gvp-settings-chevron"})])):e.createCommentVNode("",!0),y.value?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",role:"menuitem",class:"gvp-settings-row",onClick:d[2]||(d[2]=m=>c.value="captions")},[d[9]||(d[9]=e.createElementVNode("span",{class:"gvp-settings-row-label"},"Subtitles",-1)),e.createElementVNode("span",Ut,e.toDisplayString(P.value),1),e.createVNode(ue,{class:"gvp-settings-chevron"})])):e.createCommentVNode("",!0),z.value?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",role:"menuitem",class:"gvp-settings-row",onClick:d[3]||(d[3]=m=>c.value="audio")},[d[10]||(d[10]=e.createElementVNode("span",{class:"gvp-settings-row-label"},"Audio",-1)),e.createElementVNode("span",jt,e.toDisplayString((O=M.value)==null?void 0:O.label),1),e.createVNode(ue,{class:"gvp-settings-chevron"})])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),c.value!=="root"?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"gvp-settings-back",onClick:d[4]||(d[4]=m=>c.value="root")},[e.createVNode(ue,{class:"gvp-settings-back-icon"}),e.createElementVNode("span",null,e.toDisplayString(c.value==="speed"?"Speed":c.value==="quality"?"Quality":c.value==="captions"?"Subtitles":"Audio"),1)])):e.createCommentVNode("",!0),c.value==="speed"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},e.renderList(r,m=>e.createElementVNode("button",{key:m,type:"button",role:"menuitemradio","aria-checked":m===C.value,class:e.normalizeClass(["gvp-settings-option",{"is-active":m===C.value}]),onClick:H=>N(m)},[e.createElementVNode("span",Wt,[m===C.value?(e.openBlock(),e.createBlock(ae,{key:0})):e.createCommentVNode("",!0)]),e.createElementVNode("span",null,e.toDisplayString(m===1?"Normal":`${m}×`),1)],10,Zt)),64)):e.createCommentVNode("",!0),c.value==="quality"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[e.createElementVNode("button",{type:"button",role:"menuitemradio","aria-checked":t.selectedLevel<0,class:e.normalizeClass(["gvp-settings-option",{"is-active":t.selectedLevel<0}]),onClick:d[5]||(d[5]=m=>A(e.unref(Ze).index))},[e.createElementVNode("span",Qt,[t.selectedLevel<0?(e.openBlock(),e.createBlock(ae,{key:0})):e.createCommentVNode("",!0)]),e.createElementVNode("span",null,e.toDisplayString(v.value?`Auto (${v.value.label})`:"Auto"),1)],10,Kt),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B.value,m=>(e.openBlock(),e.createElementBlock("button",{key:m.index,type:"button",role:"menuitemradio","aria-checked":m.index===t.selectedLevel,class:e.normalizeClass(["gvp-settings-option",{"is-active":m.index===t.selectedLevel}]),onClick:H=>A(m.index)},[e.createElementVNode("span",Gt,[m.index===t.selectedLevel?(e.openBlock(),e.createBlock(ae,{key:0})):e.createCommentVNode("",!0)]),e.createElementVNode("span",null,e.toDisplayString(m.label),1)],10,Yt))),128))],64)):e.createCommentVNode("",!0),c.value==="captions"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[e.createElementVNode("button",{type:"button",role:"menuitemradio","aria-checked":b.value===-1,class:e.normalizeClass(["gvp-settings-option",{"is-active":b.value===-1}]),onClick:d[6]||(d[6]=m=>E(-1))},[e.createElementVNode("span",Xt,[b.value===-1?(e.openBlock(),e.createBlock(ae,{key:0})):e.createCommentVNode("",!0)]),d[11]||(d[11]=e.createElementVNode("span",null,"Off",-1))],10,Jt),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(V.value,m=>(e.openBlock(),e.createElementBlock("button",{key:m.index,type:"button",role:"menuitemradio","aria-checked":m.index===b.value,class:e.normalizeClass(["gvp-settings-option",{"is-active":m.index===b.value}]),onClick:H=>E(m.index)},[e.createElementVNode("span",tn,[m.index===b.value?(e.openBlock(),e.createBlock(ae,{key:0})):e.createCommentVNode("",!0)]),e.createElementVNode("span",null,e.toDisplayString(m.label),1)],10,en))),128))],64)):e.createCommentVNode("",!0),c.value==="audio"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:5},e.renderList(t.audioTracks,m=>{var H,F,q;return e.openBlock(),e.createElementBlock("button",{key:m.index,type:"button",role:"menuitemradio","aria-checked":m.index===(((H=M.value)==null?void 0:H.index)??-1),class:e.normalizeClass(["gvp-settings-option",{"is-active":m.index===(((F=M.value)==null?void 0:F.index)??-1)}]),onClick:R=>D(m.index)},[e.createElementVNode("span",on,[m.index===(((q=M.value)==null?void 0:q.index)??-1)?(e.openBlock(),e.createBlock(ae,{key:0})):e.createCommentVNode("",!0)]),e.createElementVNode("span",null,e.toDisplayString(m.label),1)],10,nn)}),128)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],512)}}});function de(t){if(!Number.isFinite(t)||t<0)return"--:--";const l=Math.floor(t),n=Math.floor(l/3600),o=Math.floor(l%3600/60),u=(l%60).toString().padStart(2,"0");if(n>0){const c=o.toString().padStart(2,"0");return`${n}:${c}:${u}`}return`${o}:${u}`}function be(t){const l=t.trim().split(":");if(l.length<2||l.length>3)return NaN;const n=l.map(Number);return n.some(o=>!Number.isFinite(o))?NaN:n.length===3?n[0]*3600+n[1]*60+n[2]:n[0]*60+n[1]}function rn(t,l){try{return new URL(t,l).href}catch{return t}}function sn(t,l){const n=[],o=t.replace(/\r/g,"").split(`
2
+ `);for(let r=0;r<o.length;r++){const u=o[r].indexOf("-->");if(u===-1)continue;const c=be(o[r].slice(0,u)),p=be(o[r].slice(u+3));if(!Number.isFinite(c)||!Number.isFinite(p))continue;const C=(o[r+1]??"").trim();if(!C)continue;const N=C.indexOf("#xywh=");let V=C,b=0,h=0,E=0,B=0;if(N!==-1){V=C.slice(0,N);const v=C.slice(N+6).split(",").map(Number);v.length===4&&v.every(Number.isFinite)&&([b,h,E,B]=v)}n.push({start:c,end:p,url:rn(V,l),x:b,y:h,w:E,h:B})}return n.sort((r,u)=>r.start-u.start),n}function cn(t){return{cues:t,cueAt(l){if(t.length===0)return null;let n=0,o=t.length-1,r=t[0];for(;n<=o;){const u=n+o>>1,c=t[u];if(l<c.start)o=u-1;else if(l>c.end)r=c,n=u+1;else return c}return r}}}function Be(t){const l=t.trim().split(":");if(l.length<2||l.length>3)return NaN;const n=l.map(Number);return n.some(o=>!Number.isFinite(o))?NaN:n.length===3?n[0]*3600+n[1]*60+n[2]:n[0]*60+n[1]}function un(t){const l=[],n=t.replace(/\r/g,"").split(`
3
+ `);for(let o=0;o<n.length;o++){const r=n[o].indexOf("-->");if(r===-1)continue;const u=Be(n[o].slice(0,r)),c=Be(n[o].slice(r+3));if(!Number.isFinite(u)||!Number.isFinite(c))continue;const p=(n[o+1]??"").trim();p&&l.push({start:u,end:c,title:p})}return l.sort((o,r)=>o.start-r.start),l}function dn(t,l){const n=t.filter(o=>Number.isFinite(o.start)&&o.start>=0&&o.title).sort((o,r)=>o.start-r.start);return n.map((o,r)=>{var u;return{start:o.start,end:Number.isFinite(o.end)?o.end:((u=n[r+1])==null?void 0:u.start)??l,title:o.title}})}function vn(t,l){for(const n of t)if(l>=n.start&&l<n.end)return n;return null}const mn={class:"gvp-controls-seek"},pn={key:1,class:"gvp-seek-preview-chapter"},fn={class:"gvp-seek-preview-time"},kn=["value","disabled","aria-valuemax","aria-valuenow","aria-valuetext"],gn={class:"gvp-controls-row"},hn={class:"gvp-controls-left"},yn=["aria-label","aria-pressed"],En=["disabled"],Cn=["disabled"],wn=["aria-label","aria-pressed"],bn={key:0,class:"gvp-volume-slider-wrap"},Bn={class:"gvp-volume-track"},xn=["value","aria-valuenow","aria-valuetext"],Nn={key:2,class:"gvp-time","aria-live":"off"},Vn=["disabled","aria-label"],Ln={class:"gvp-controls-right"},$n=["aria-label","aria-pressed"],_n=["aria-label","aria-pressed"],Pn=3e3,Sn=10,Tn=e.defineComponent({__name:"ControlBar",props:{video:{},isPlaying:{type:Boolean},container:{},onTogglePlay:{},qualityLevels:{default:()=>[]},currentLevel:{default:-1},selectedLevel:{default:-1},thumbnails:{},chapters:{},hasPrev:{type:Boolean,default:!1},hasNext:{type:Boolean,default:!1},isLive:{type:Boolean,default:!1},audioTracks:{default:()=>[]},audioTrackIndex:{default:-1}},emits:["select-level","select-audio-track","prev","next"],setup(t,{emit:l}){const n=(()=>{if(typeof navigator>"u")return!1;const i=navigator.userAgent;return/iPad|iPhone|iPod/.test(i)||i.includes("Mac")&&navigator.maxTouchPoints>1})(),o=typeof navigator>"u"?!1:/iPhone|iPod/.test(navigator.userAgent),r=t,u=l,c=e.ref(!0);let p=null;function C(){p!==null&&(clearTimeout(p),p=null)}function N(){C(),r.isPlaying&&(p=setTimeout(()=>{c.value=!1},Pn))}function V(){c.value=!0,N()}e.watch(()=>r.isPlaying,i=>{i?N():(C(),c.value=!0)},{immediate:!0}),e.watch(()=>r.container,i=>{if(!i)return;const g=()=>V();i.addEventListener("mousemove",g),i.addEventListener("touchstart",g),i.addEventListener("focusin",g)},{immediate:!0});const b=e.ref(0),h=e.ref(0),E=e.ref(0),B=e.ref(!1),v=e.ref(!0),x=e.computed(()=>r.isLive||B.value);e.watch(()=>r.video,i=>{if(!i)return;const g=()=>{b.value=i.currentTime},w=()=>{h.value=Number.isFinite(i.duration)?i.duration:0},U=()=>{const T=i.buffered;if(!T||T.length===0){E.value=0;return}let ne=T.end(T.length-1);for(let G=0;G<T.length;G++)if(T.start(G)<=i.currentTime&&i.currentTime<=T.end(G)){ne=T.end(G);break}E.value=ne},te=()=>{if(B.value=!Number.isFinite(i.duration)&&i.duration>0,x.value&&i.seekable.length>0){const T=i.seekable.end(i.seekable.length-1);v.value=T-i.currentTime<=Sn}};g(),w(),U(),te(),i.addEventListener("timeupdate",g),i.addEventListener("durationchange",w),i.addEventListener("loadedmetadata",w),i.addEventListener("progress",U),i.addEventListener("timeupdate",U),i.addEventListener("durationchange",te),i.addEventListener("loadedmetadata",te),i.addEventListener("timeupdate",te)},{immediate:!0});function A(){const i=r.video;!i||i.seekable.length===0||(i.currentTime=i.seekable.end(i.seekable.length-1))}const M=()=>h.value>0,D=()=>M()?b.value/h.value*100:0,W=()=>M()?E.value/h.value*100:0;function y(i){const g=r.video;if(!g||!M())return;const w=Number(i.target.value)/100*h.value;g.currentTime=w,b.value=w}const z=e.ref(null),$=e.ref(null),P=e.ref(0),S=e.ref(0),L=e.ref(!1);e.watch(()=>r.thumbnails,i=>{if(z.value=null,!i)return;let g=!1;fetch(i).then(w=>w.ok?w.text():Promise.reject(new Error("fetch failed"))).then(w=>{if(g)return;const U=sn(w,new URL(i,location.href).href);z.value=U.length>0?cn(U):null}).catch(()=>{g||(z.value=null)}),e.onBeforeUnmount(()=>{g=!0})},{immediate:!0});function _(i){const g=$.value;if(!g||!M())return;const w=g.getBoundingClientRect(),U=Math.min(Math.max(i.clientX-w.left,0),w.width);S.value=U,P.value=U/w.width*h.value,L.value=!0}function J(){L.value=!1}const k=e.computed(()=>{var i;return L.value?((i=z.value)==null?void 0:i.cueAt(P.value))??null:null}),d=e.computed(()=>{const i=k.value;return i!==null&&i.w>0&&i.h>0}),O=e.computed(()=>{var U;const i=k.value,g=((U=$.value)==null?void 0:U.clientWidth)??0;if(!d.value||!i||g===0)return S.value;const w=i.w/2;return Math.min(Math.max(S.value,w),g-w)}),m=e.ref([]);e.watch(()=>r.chapters,i=>{if(m.value=[],typeof i!="string"||!i)return;let g=!1;fetch(i).then(w=>w.ok?w.text():Promise.reject(new Error("fetch failed"))).then(w=>{g||(m.value=un(w))}).catch(()=>{g||(m.value=[])}),e.onBeforeUnmount(()=>{g=!0})},{immediate:!0});const H=e.computed(()=>typeof r.chapters=="string"?m.value:Array.isArray(r.chapters)?dn(r.chapters,h.value):[]),F=e.computed(()=>L.value?vn(H.value,P.value):null),q=e.ref(1),R=e.ref(!1);e.watch(()=>r.video,i=>{if(!i)return;const g=()=>{q.value=i.volume,R.value=i.muted};g(),i.addEventListener("volumechange",g)},{immediate:!0});function ee(){r.video&&(r.video.muted=!r.video.muted)}function Q(i){const g=r.video;if(!g)return;const w=Number(i.target.value)/100;g.volume=w,w>0&&g.muted&&(g.muted=!1)}const X=e.ref(!1),fe=typeof document<"u"&&!!document.pictureInPictureEnabled;e.watch(()=>r.video,i=>{i&&(i.addEventListener("enterpictureinpicture",()=>{X.value=!0}),i.addEventListener("leavepictureinpicture",()=>{X.value=!1}))},{immediate:!0});function ke(){r.video&&(document.pictureInPictureElement?document.exitPictureInPicture().catch(()=>{}):r.video.requestPictureInPicture().catch(()=>{}))}const Y=e.ref(!1),ve=typeof document>"u"?!1:!!(document.fullscreenEnabled||document.webkitFullscreenEnabled);function re(){return document.fullscreenElement??document.webkitFullscreenElement??null}function se(i){const g=i.requestFullscreen??i.webkitRequestFullscreen;return g?g.call(i):Promise.reject(new Error("unsupported"))}function ie(){const i=document.exitFullscreen??document.webkitExitFullscreen;return i?i.call(document):Promise.reject(new Error("unsupported"))}function I(){Y.value=re()===r.container}e.onMounted(()=>{document.addEventListener("fullscreenchange",I),document.addEventListener("webkitfullscreenchange",I)}),e.onBeforeUnmount(()=>{C(),document.removeEventListener("fullscreenchange",I),document.removeEventListener("webkitfullscreenchange",I)});function ge(){var i,g;if(o){(g=(i=r.video)==null?void 0:i.webkitEnterFullscreen)==null||g.call(i);return}Y.value?ie().catch(()=>{}):r.container&&se(r.container).catch(()=>{})}const he=ve||o&&r.video!==null&&typeof r.video.webkitEnterFullscreen=="function";return(i,g)=>(e.openBlock(),e.createElementBlock("div",{role:"toolbar","aria-label":"Video controls",class:e.normalizeClass(["gvp-controls",!c.value&&"is-hidden"]),onMouseenter:C,onMouseleave:N},[e.createElementVNode("div",mn,[e.createElementVNode("div",{class:"gvp-seek",onPointermove:_,onPointerleave:J},[e.createElementVNode("div",{ref_key:"seekTrackEl",ref:$,class:"gvp-seek-track"},[e.createElementVNode("div",{class:"gvp-seek-buffered",style:e.normalizeStyle({width:`${W()}%`})},null,4),e.createElementVNode("div",{class:"gvp-seek-progress",style:e.normalizeStyle({width:`${D()}%`})},null,4),M()?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(H.value,w=>e.withDirectives((e.openBlock(),e.createElementBlock("div",{key:`${w.start}-${w.title}`,class:"gvp-seek-chapter-tick",style:e.normalizeStyle({left:`${w.start/h.value*100}%`})},null,4)),[[e.vShow,w.start>0&&w.start<h.value]])),128)):e.createCommentVNode("",!0)],512),L.value&&M()?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["gvp-seek-preview",{"has-thumb":d.value}]),style:e.normalizeStyle({left:`${O.value}px`})},[d.value&&k.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"gvp-seek-preview-thumb",style:e.normalizeStyle({width:`${k.value.w}px`,height:`${k.value.h}px`,backgroundImage:`url(${JSON.stringify(k.value.url)})`,backgroundPosition:`-${k.value.x}px -${k.value.y}px`})},null,4)):e.createCommentVNode("",!0),F.value?(e.openBlock(),e.createElementBlock("span",pn,e.toDisplayString(F.value.title),1)):e.createCommentVNode("",!0),e.createElementVNode("span",fn,e.toDisplayString(e.unref(de)(P.value)),1)],6)):e.createCommentVNode("",!0),e.createElementVNode("input",{type:"range",class:"gvp-seek-input",min:0,max:100,step:.1,value:D(),disabled:!M(),"aria-label":"Seek","aria-valuemin":0,"aria-valuemax":Math.floor(h.value),"aria-valuenow":Math.floor(b.value),"aria-valuetext":`${e.unref(de)(b.value)} of ${e.unref(de)(h.value)}`,onInput:y},null,40,kn)],32)]),e.createElementVNode("div",gn,[e.createElementVNode("div",hn,[e.createElementVNode("button",{type:"button",class:"gvp-ctrl-btn","aria-label":t.isPlaying?"Pause":"Play","aria-pressed":t.isPlaying,onClick:g[0]||(g[0]=(...w)=>t.onTogglePlay&&t.onTogglePlay(...w))},[t.isPlaying?(e.openBlock(),e.createBlock(ht,{key:0})):(e.openBlock(),e.createBlock(Et,{key:1}))],8,yn),t.hasPrev||t.hasNext?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"gvp-ctrl-btn","aria-label":"Previous video",disabled:!t.hasPrev,onClick:g[1]||(g[1]=w=>u("prev"))},[e.createVNode(wt)],8,En)):e.createCommentVNode("",!0),t.hasPrev||t.hasNext?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"gvp-ctrl-btn","aria-label":"Next video",disabled:!t.hasNext,onClick:g[2]||(g[2]=w=>u("next"))},[e.createVNode(Bt)],8,Cn)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["gvp-volume",!e.unref(n)&&"is-expandable"])},[e.createElementVNode("button",{type:"button",class:"gvp-ctrl-btn","aria-label":R.value?"Unmute":"Mute","aria-pressed":R.value,onClick:ee},[R.value||q.value===0?(e.openBlock(),e.createBlock(_t,{key:0})):q.value<.5?(e.openBlock(),e.createBlock(Lt,{key:1})):(e.openBlock(),e.createBlock(Nt,{key:2}))],8,wn),e.unref(n)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",bn,[e.createElementVNode("div",Bn,[e.createElementVNode("div",{class:"gvp-volume-fill",style:e.normalizeStyle({width:`${R.value?0:Math.round(q.value*100)}%`})},null,4)]),e.createElementVNode("input",{type:"range",class:"gvp-volume-input",min:0,max:100,step:1,value:R.value?0:Math.round(q.value*100),"aria-label":"Volume","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":R.value?0:Math.round(q.value*100),"aria-valuetext":`${R.value?0:Math.round(q.value*100)}%`,onInput:Q},null,40,xn)]))],2),x.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Nn,e.toDisplayString(e.unref(de)(b.value))+" / "+e.toDisplayString(e.unref(de)(h.value)),1)),x.value?(e.openBlock(),e.createElementBlock("button",{key:3,type:"button",class:e.normalizeClass(["gvp-live",{"is-at-edge":v.value}]),disabled:v.value,"aria-label":v.value?"Live":"Go to live edge",onClick:A},[...g[5]||(g[5]=[e.createElementVNode("span",{class:"gvp-live-dot"},null,-1),e.createElementVNode("span",null,"LIVE",-1)])],10,Vn)):e.createCommentVNode("",!0)]),e.createElementVNode("div",Ln,[e.createVNode(an,{video:t.video,"quality-levels":t.qualityLevels,"current-level":t.currentLevel,"selected-level":t.selectedLevel,"audio-tracks":t.audioTracks,"audio-track-index":t.audioTrackIndex,onSelectLevel:g[3]||(g[3]=w=>u("select-level",w)),onSelectAudioTrack:g[4]||(g[4]=w=>u("select-audio-track",w))},null,8,["video","quality-levels","current-level","selected-level","audio-tracks","audio-track-index"]),e.unref(fe)?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:e.normalizeClass(["gvp-ctrl-btn",X.value&&"is-active"]),"aria-label":X.value?"Exit picture-in-picture":"Picture-in-picture","aria-pressed":X.value,onClick:ke},[e.createVNode($e)],10,$n)):e.createCommentVNode("",!0),e.unref(he)?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:e.normalizeClass(["gvp-ctrl-btn",Y.value&&"is-active"]),"aria-label":Y.value?"Exit fullscreen":"Enter fullscreen","aria-pressed":Y.value,onClick:ge},[Y.value?(e.openBlock(),e.createBlock(It,{key:0})):(e.openBlock(),e.createBlock(Tt,{key:1}))],10,_n)):e.createCommentVNode("",!0)])])],34))}}),Mn={name:"IconDesktop"},In=e.defineComponent({...Mn,props:{class:{}},setup(t){const l=t;return(n,o)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...o[0]||(o[0]=[e.createElementVNode("path",{d:"M14 2H10C6.72077 2 5.08116 2 3.91891 2.81382C3.48891 3.1149 3.1149 3.48891 2.81382 3.91891C2 5.08116 2 6.72077 2 10C2 13.2792 2 14.9188 2.81382 16.0811C3.1149 16.5111 3.48891 16.8851 3.91891 17.1862C5.08116 18 6.72077 18 10 18H14C17.2792 18 18.9188 18 20.0811 17.1862C20.5111 16.8851 20.8851 16.5111 21.1862 16.0811C22 14.9188 22 13.2792 22 10C22 6.72077 22 5.08116 21.1862 3.91891C20.8851 3.48891 20.5111 3.1149 20.0811 2.81382C18.9188 2 17.2792 2 14 2Z",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1),e.createElementVNode("path",{d:"M11 15H13",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),e.createElementVNode("path",{d:"M14.5 22L14.1845 21.5811C13.4733 20.6369 13.2969 19.1944 13.7468 18M9.5 22L9.8155 21.5811C10.5267 20.6369 10.7031 19.1944 10.2532 18",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1),e.createElementVNode("path",{d:"M7 22H17",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1)])],2))}}),An={name:"IconMobile"},zn=e.defineComponent({...An,props:{class:{}},setup(t){const l=t;return(n,o)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...o[0]||(o[0]=[e.createElementVNode("path",{d:"M5 9C5 5.70017 5 4.05025 6.02513 3.02513C7.05025 2 8.70017 2 12 2C15.2998 2 16.9497 2 17.9749 3.02513C19 4.05025 19 5.70017 19 9V15C19 18.2998 19 19.9497 17.9749 20.9749C16.9497 22 15.2998 22 12 22C8.70017 22 7.05025 22 6.02513 20.9749C5 19.9497 5 18.2998 5 15V9Z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"},null,-1),e.createElementVNode("path",{d:"M11 19H13",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),e.createElementVNode("path",{d:"M9 2L9.089 2.53402C9.28188 3.69129 9.37832 4.26993 9.77519 4.62204C10.1892 4.98934 10.7761 5 12 5C13.2239 5 13.8108 4.98934 14.2248 4.62204C14.6217 4.26993 14.7181 3.69129 14.911 2.53402L15 2",stroke:"currentColor","stroke-width":"2","stroke-linejoin":"round"},null,-1)])],2))}}),Dn={name:"IconPlay"},Hn=e.defineComponent({...Dn,props:{class:{}},setup(t){const l=t;return(n,o)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"22",height:"22",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...o[0]||(o[0]=[e.createElementVNode("path",{d:"M5.3335 11.45V4.54997C5.3335 4.36108 5.40016 4.20275 5.5335 4.07497C5.66683 3.94719 5.82238 3.8833 6.00016 3.8833C6.05572 3.8833 6.11405 3.89163 6.17516 3.9083C6.23627 3.92497 6.29461 3.94997 6.35016 3.9833L11.7835 7.4333C11.8835 7.49997 11.9585 7.5833 12.0085 7.6833C12.0585 7.7833 12.0835 7.88886 12.0835 7.99997C12.0835 8.11108 12.0585 8.21663 12.0085 8.31663C11.9585 8.41663 11.8835 8.49997 11.7835 8.56663L6.35016 12.0166C6.29461 12.05 6.23627 12.075 6.17516 12.0916C6.11405 12.1083 6.05572 12.1166 6.00016 12.1166C5.82238 12.1166 5.66683 12.0527 5.5335 11.925C5.40016 11.7972 5.3335 11.6389 5.3335 11.45Z",fill:"currentColor"},null,-1)])],2))}}),Fn={name:"IconX"},xe=e.defineComponent({...Fn,props:{class:{}},setup(t){const l=t;return(n,o)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...o[0]||(o[0]=[e.createElementVNode("path",{d:"M6.94994 5.53594L12.1929 0.292938C12.5834 -0.0975275 13.2165 -0.0975279 13.6069 0.292938C13.9974 0.683403 13.9974 1.31647 13.6069 1.70694L8.36394 6.94994L13.6069 12.1929C13.9974 12.5834 13.9974 13.2165 13.6069 13.6069C13.2165 13.9974 12.5834 13.9974 12.1929 13.6069L6.94994 8.36394L1.70694 13.6069C1.31647 13.9974 0.683403 13.9974 0.292938 13.6069C-0.0975279 13.2165 -0.0975277 12.5834 0.292938 12.1929L5.53594 6.94994L0.292938 1.70694C-0.0975279 1.31647 -0.0975279 0.683403 0.292938 0.292938C0.683403 -0.0975279 1.31647 -0.0975277 1.70694 0.292938L6.94994 5.53594Z",fill:"currentColor"},null,-1)])],2))}}),Rn={name:"IconAlert"},qn=e.defineComponent({...Rn,props:{class:{}},setup(t){const l=t;return(n,o)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...o[0]||(o[0]=[e.createElementVNode("path",{d:"M12 9V13M12 17H12.01M10.29 3.86L1.82 18A2 2 0 0 0 3.53 21H20.47A2 2 0 0 0 22.18 18L13.71 3.86A2 2 0 0 0 10.29 3.86Z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))}}),On={name:"IconRefresh"},Un=e.defineComponent({...On,props:{class:{}},setup(t){const l=t;return(n,o)=>(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["gvp-icon",l.class]),width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"},[...o[0]||(o[0]=[e.createElementVNode("path",{d:"M21 12A9 9 0 1 1 18.36 5.64M21 3V9H15",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))}});function _e(t){if(!t)return null;if(/^[A-Za-z0-9_-]{11}$/.test(t))return t;let l;try{l=new URL(t)}catch{return null}const n=l.hostname.replace(/^www\./,"");if(n==="youtu.be"){const o=l.pathname.slice(1).split("/")[0];return/^[A-Za-z0-9_-]{11}$/.test(o)?o:null}if(n==="youtube.com"||n==="m.youtube.com"||n==="music.youtube.com"||n==="youtube-nocookie.com"){const o=l.searchParams.get("v");if(o&&/^[A-Za-z0-9_-]{11}$/.test(o))return o;const r=/^\/(?:embed|shorts|v|live)\/([A-Za-z0-9_-]{11})/.exec(l.pathname);if(r)return r[1]}return null}function Pe(t){try{const l=new URL(t),n=l.searchParams.get("t")??l.searchParams.get("start");if(!n)return null;if(/^\d+s?$/.test(n))return Number.parseInt(n,10);const o=/^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/.exec(n);if(o){const r=Number.parseInt(o[1]??"0",10),u=Number.parseInt(o[2]??"0",10),c=Number.parseInt(o[3]??"0",10),p=r*3600+u*60+c;return p>0?p:null}}catch{}return null}function Se(t,l={}){const{autoPlay:n=!1,muted:o=!0,loop:r=!1,controls:u=!0,startSeconds:c}=l,p=new URLSearchParams({rel:"0",modestbranding:"1",playsinline:"1",controls:u?"1":"0"});return n?(p.set("autoplay","1"),p.set("mute","1")):o&&p.set("mute","1"),r&&(p.set("loop","1"),p.set("playlist",t)),c&&c>0&&p.set("start",String(c)),`https://www.youtube-nocookie.com/embed/${t}?${p.toString()}`}const jn="gvp:prefs:";function Te(t){return jn+t}function pe(t){if(typeof localStorage>"u")return{};try{const l=localStorage.getItem(Te(t));if(!l)return{};const n=JSON.parse(l);return typeof n=="object"&&n!==null?n:{}}catch{return{}}}function Me(t,l){if(!(typeof localStorage>"u"))try{const o={...pe(t),...l};localStorage.setItem(Te(t),JSON.stringify(o))}catch{}}function Ne(t,l,n){if(typeof localStorage>"u"||!l)return;const r={...pe(t).positions};n>0?r[l]=n:delete r[l],Me(t,{positions:r})}function Zn(t,l){var r;const o=(r=pe(t).positions)==null?void 0:r[l];return typeof o=="number"&&o>0?o:0}function Wn(t){const l=t.trim().replace(/^#/,"");if(/^[0-9a-f]{3}$/i.test(l))return[parseInt(l[0]+l[0],16),parseInt(l[1]+l[1],16),parseInt(l[2]+l[2],16)];if(/^[0-9a-f]{6}$/i.test(l))return[parseInt(l.slice(0,2),16),parseInt(l.slice(2,4),16),parseInt(l.slice(4,6),16)];const n=/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i.exec(t);return n?[Number(n[1]),Number(n[2]),Number(n[3])]:null}function Kn(t,l){const n=Wn(t);return n?`rgba(${n[0]}, ${n[1]}, ${n[2]}, ${l})`:t}function Qn(t,l){if(!l)return"";const n=[];if(l.fontSize&&n.push(`font-size: ${l.fontSize};`),l.textColor&&n.push(`color: ${l.textColor};`),l.backgroundColor){const o=typeof l.backgroundOpacity=="number"?Kn(l.backgroundColor,l.backgroundOpacity):l.backgroundColor;n.push(`background-color: ${o};`)}else typeof l.backgroundOpacity=="number"&&n.push(`background-color: rgba(0, 0, 0, ${l.backgroundOpacity});`);return n.length===0?"":`.${t}::cue { ${n.join(" ")} }`}function Yn(t){const l=t.trim().replace(/^#/,"");if(/^[0-9a-f]{3}$/i.test(l)){const o=parseInt(l[0]+l[0],16),r=parseInt(l[1]+l[1],16),u=parseInt(l[2]+l[2],16);return`${o} ${r} ${u}`}if(/^[0-9a-f]{6}$/i.test(l)){const o=parseInt(l.slice(0,2),16),r=parseInt(l.slice(2,4),16),u=parseInt(l.slice(4,6),16);return`${o} ${r} ${u}`}const n=/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i.exec(t);return n?`${n[1]} ${n[2]} ${n[3]}`:null}function Gn(t){if(!t)return{};const l={};if(t.accent){const n=Yn(t.accent);n?l["--gvp-accent-rgb"]=n:l["--gvp-accent"]=t.accent}return t.radius&&(l["--gvp-radius"]=t.radius),l}const Jn=["src"],Xn={key:3,class:"gvp-vignette"},eo={key:4,class:"gvp-sr-only",role:"status","aria-live":"polite"},to={key:5,class:"gvp-loading",role:"status","aria-live":"polite"},no={key:6,class:"gvp-error",role:"alert"},oo={key:7,class:"gvp-toggle"},lo={class:"gvp-toggle-pill"},ao=["aria-pressed"],ro=["aria-pressed"],so=["aria-label","aria-pressed"],io=["aria-label"],co={key:14,class:"gvp-play-wrap"},uo={key:0,class:"gvp-tooltip",role:"tooltip"},vo={key:16,class:"gvp-bottom-fade"},mo=e.defineComponent({__name:"VideoPlayer",props:{src:{},poster:{},playlist:{},defaultIndex:{default:0},autoAdvance:{type:Boolean,default:!0},showDeviceToggle:{type:Boolean,default:!0},defaultDevice:{default:"desktop"},hoverPlay:{type:Boolean,default:!1},tooltipText:{},muted:{type:Boolean,default:!0},loop:{type:Boolean,default:!1},controls:{type:[Boolean,String],default:!0},autoPlay:{type:Boolean,default:!1},frameMaxWidth:{},aspectRatio:{},hlsConfig:{},isHls:{type:Boolean},thumbnails:{},chapters:{},persistKey:{},captionStyle:{},theme:{},miniPlayer:{type:Boolean,default:!1},miniPlayerPosition:{default:"bottom-right"},ambientMode:{type:Boolean,default:!1},class:{default:""},closable:{type:Boolean,default:!1}},emits:["close","play","pause","ended","time-update","seeked","volume-change","milestone","error","playlist-change"],setup(t,{emit:l}){const n=t,o=l,r=e.ref(null),u=e.ref(n.defaultDevice),c=e.ref(!1),p=e.ref(!1),C=e.ref(!1),N=e.ref(!1),V=e.ref(!1),b=e.ref(0),h=e.ref(null),E=e.ref([]),B=e.ref(-1),v=e.ref([]),x=e.ref(-1),A=e.ref(-1),M=e.ref(1),D=e.ref(!1),W=e.ref(!1),y=e.ref(null),z=typeof document<"u"&&!!document.pictureInPictureEnabled,$=e.computed(()=>n.controls===!0||n.controls==="custom"),P=e.computed(()=>n.controls==="native"),S=`gvp-video-${Math.random().toString(36).slice(2,10)}`,L=e.computed(()=>Gn(n.theme)),_=e.ref(!1),J=e.ref(!1),k=e.ref(null);let d=null;e.watch(k,a=>{d==null||d.disconnect(),d=null,!(!n.miniPlayer||!a||typeof IntersectionObserver>"u")&&(d=new IntersectionObserver(([s])=>{s.isIntersecting?(_.value=!1,J.value=!1):c.value&&!J.value&&(_.value=!0)},{threshold:0}),d.observe(a))}),e.watch(c,a=>{a||(_.value=!1)});function O(){_.value=!1,J.value=!0}const m=e.ref(null);let H=0;e.onBeforeUnmount(()=>{d==null||d.disconnect(),d=null,cancelAnimationFrame(H)});let F=null;e.watch(()=>n.captionStyle,a=>{if(typeof document>"u")return;const s=Qn(S,a);if(!s){F==null||F.remove(),F=null;return}F||(F=document.createElement("style"),document.head.appendChild(F)),F.textContent=s},{immediate:!0,deep:!0}),e.onBeforeUnmount(()=>{F==null||F.remove(),F=null});const q=e.computed(()=>Array.isArray(n.playlist)&&n.playlist.length>0),R=e.ref(q.value?Math.min(Math.max(n.defaultIndex,0),n.playlist.length-1):0),ee=e.computed(()=>q.value?n.playlist[Math.min(R.value,n.playlist.length-1)]:null),Q=e.computed(()=>{var a;return((a=ee.value)==null?void 0:a.src)??n.src??""}),X=e.computed(()=>{var a;return((a=ee.value)==null?void 0:a.poster)??n.poster}),fe=e.computed(()=>{var a;return((a=ee.value)==null?void 0:a.thumbnails)??n.thumbnails}),ke=e.computed(()=>{var a;return((a=ee.value)==null?void 0:a.chapters)??n.chapters}),Y=e.computed(()=>q.value&&R.value>0),ve=e.computed(()=>q.value&&R.value<n.playlist.length-1);let re=!1;function se(a,s=!1){if(!q.value)return;const f=Math.min(Math.max(a,0),n.playlist.length-1);f!==R.value&&(re=s,R.value=f,o("playlist-change",f,n.playlist[f]))}const ie=e.computed(()=>_e(Q.value)),I=e.computed(()=>ie.value!==null),ge=e.computed(()=>ie.value?Se(ie.value,{autoPlay:n.autoPlay,muted:n.muted,loop:n.loop,controls:$.value?!0:P.value,startSeconds:Pe(Q.value)}):null);function he(a){E.value=a,B.value=-1}function i(a){v.value=a,A.value=-1}const g=e.computed(()=>!I.value&&E.value.length>1),w=e.computed(()=>{var a;return B.value>=0?B.value:((a=E.value[0])==null?void 0:a.index)??-1}),U=e.computed(()=>{var a,s;return u.value==="mobile"?((a=n.aspectRatio)==null?void 0:a.mobile)??"9/16":((s=n.aspectRatio)==null?void 0:s.desktop)??"16/9"}),te=e.computed(()=>{var a,s;return u.value==="mobile"?((a=n.frameMaxWidth)==null?void 0:a.mobile)??"420px":((s=n.frameMaxWidth)==null?void 0:s.desktop)??"960px"}),T=e.computed(()=>{var a;return((a=r.value)==null?void 0:a.videoEl)??null});e.watch([m,T],([a,s])=>{if(cancelAnimationFrame(H),!n.ambientMode||!a||!s||I.value)return;const f=a.getContext("2d");if(!f)return;let j=0;const K=ce=>{if(H=requestAnimationFrame(K),!(ce-j<250)&&(j=ce,!(s.readyState<2||s.paused)))try{f.drawImage(s,0,0,a.width,a.height)}catch{}};H=requestAnimationFrame(K)});async function ne(){const a=T.value;if(a)try{a.readyState<2&&a.load();const s=a.play();h.value=s,await s,c.value=!0}catch{c.value=!1}finally{h.value=null}}async function G(){const a=T.value;if(a){if(h.value)try{await h.value}catch{}a.pause()}}async function Ie(){!n.hoverPlay||I.value||await ne()}async function Ae(){!n.hoverPlay||I.value||(await G(),c.value=!1)}async function me(){const a=T.value;a&&(a.paused?await ne():(await G(),c.value=!1))}function ye(){const a=y.value;if(!a)return;if((document.fullscreenElement??document.webkitFullscreenElement??null)===a){const f=document.exitFullscreen??document.webkitExitFullscreen;f==null||f.call(document).catch(()=>{})}else{const f=a.requestFullscreen??a.webkitRequestFullscreen;f==null||f.call(a).catch(()=>{})}}let oe=null;function ze(){oe===null&&(oe=setTimeout(()=>{oe=null,me()},250))}function De(){oe!==null&&(clearTimeout(oe),oe=null),ye()}function He(){c.value=!1,o("ended"),q.value&&n.autoAdvance&&ve.value&&se(R.value+1,!0)}e.watch(Q,()=>{re&&(re=!1,ne())});function Fe(){p.value=!0,Ie()}function Re(){p.value=!1,Ae()}function qe(a){M.value=a;const s=T.value;s&&(s.playbackRate=a)}e.watch(T,a=>{if(!a)return;a.addEventListener("ratechange",()=>{M.value=a.playbackRate}),a.addEventListener("enterpictureinpicture",()=>{D.value=!0}),a.addEventListener("leavepictureinpicture",()=>{D.value=!1});const s=new Set;a.addEventListener("timeupdate",()=>{const f=a.duration;if(o("time-update",a.currentTime,Number.isFinite(f)?f:0),!Number.isFinite(f)||f<=0)return;const j=a.currentTime/f*100;for(const K of[25,50,75,100])j>=K&&!s.has(K)&&(s.add(K),o("milestone",K))}),a.addEventListener("seeked",()=>{o("seeked",a.currentTime)}),a.addEventListener("volumechange",()=>{o("volume-change",a.volume,a.muted)}),a.addEventListener("error",()=>{N.value=!0,C.value=!1,o("error")}),a.addEventListener("waiting",()=>{C.value=!0}),a.addEventListener("stalled",()=>{C.value=!0}),a.addEventListener("playing",()=>{C.value=!1}),a.addEventListener("canplay",()=>{C.value=!1}),a.addEventListener("seeked",()=>{C.value=!1})}),e.watch(Q,()=>{N.value=!1,C.value=!1});function Oe(){N.value=!0,C.value=!1,o("error")}const Ue=e.computed(()=>N.value?"Video failed to load":C.value?"Loading":c.value?"Playing":"Paused");function je(){N.value=!1,C.value=!1,b.value+=1}e.watch(T,a=>{if(!a||!n.persistKey)return;const s=n.persistKey,f=pe(s);typeof f.volume=="number"&&(a.volume=f.volume),typeof f.muted=="boolean"&&(a.muted=f.muted),typeof f.speed=="number"&&(a.playbackRate=f.speed);const j=()=>{Me(s,{volume:a.volume,muted:a.muted,speed:a.playbackRate})};a.addEventListener("volumechange",j),a.addEventListener("ratechange",j)}),e.watch([T,Q],([a,s])=>{if(!a||!n.persistKey||!s)return;const f=n.persistKey,j=()=>{const le=Zn(f,s);le>0&&(!Number.isFinite(a.duration)||le<a.duration-1)&&(a.currentTime=le)};a.readyState>=1?j():a.addEventListener("loadedmetadata",j,{once:!0});let K=0;const ce=()=>{const le=Date.now();le-K<1e3||(K=le,Ne(f,s,a.currentTime))};a.addEventListener("timeupdate",ce),a.addEventListener("pause",ce),a.addEventListener("ended",()=>Ne(f,s,0))},{immediate:!0});function Ee(){const a=T.value;a&&(document.pictureInPictureElement?document.exitPictureInPicture().catch(()=>{}):a.requestPictureInPicture().catch(()=>{}))}function Ce(a){var j;const s=T.value;if(!(!s||!W.value&&!((j=y.value)!=null&&j.contains(document.activeElement))||a.target.tagName==="INPUT"&&a.key!==" "))switch(a.key){case" ":case"k":a.preventDefault(),me();break;case"ArrowLeft":a.preventDefault(),s.currentTime=Math.max(0,s.currentTime-5);break;case"ArrowRight":a.preventDefault(),s.currentTime=Math.min(s.duration||0,s.currentTime+5);break;case"ArrowUp":a.preventDefault(),s.volume=Math.min(1,s.volume+.1),s.muted&&(s.muted=!1);break;case"ArrowDown":a.preventDefault(),s.volume=Math.max(0,s.volume-.1);break;case"m":s.muted=!s.muted;break;case"f":ye();break;case"p":z&&Ee();break}}return e.onMounted(()=>{document.addEventListener("keydown",Ce)}),e.onBeforeUnmount(()=>{document.removeEventListener("keydown",Ce)}),(a,s)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["gvp-ambient-wrap",{"is-ambient":t.ambientMode}]),style:e.normalizeStyle({width:te.value})},[t.miniPlayer?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"miniSentinelEl",ref:k,class:"gvp-mini-sentinel","aria-hidden":"true"},null,512)):e.createCommentVNode("",!0),t.ambientMode&&!I.value&&!_.value?(e.openBlock(),e.createElementBlock("canvas",{key:1,ref_key:"ambientCanvasEl",ref:m,class:"gvp-ambient-canvas",width:"32",height:"18"},null,512)):e.createCommentVNode("",!0),_.value?(e.openBlock(),e.createElementBlock("div",{key:2,class:"gvp-mini-placeholder",style:e.normalizeStyle({width:"100%",aspectRatio:U.value}),"aria-hidden":"true"},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"rootEl",ref:y,class:e.normalizeClass(["gvp-root",n.class,{"gvp-mini":_.value},_.value?`gvp-mini-${t.miniPlayerPosition}`:""]),style:e.normalizeStyle({width:"100%",aspectRatio:U.value,...L.value}),onMouseenter:s[14]||(s[14]=f=>{W.value=!0,Fe()}),onMouseleave:s[15]||(s[15]=f=>{W.value=!1,Re()})},[_.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"gvp-mini-close","aria-label":"Close mini player",onClick:O},[e.createVNode(xe)])):e.createCommentVNode("",!0),I.value?(e.openBlock(),e.createElementBlock("iframe",{key:1,class:"gvp-video gvp-youtube",src:ge.value??void 0,title:"YouTube video player",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowfullscreen:"",referrerpolicy:"strict-origin-when-cross-origin"},null,8,Jn)):(e.openBlock(),e.createBlock(Ve,{ref_key:"hlsPlayerRef",ref:r,key:`${Q.value}#${b.value}`,controls:P.value,"hls-config":t.hlsConfig,"is-hls":t.isHls,loop:t.loop,muted:t.muted,"auto-play":t.autoPlay,"audio-track-index":B.value,"quality-level-index":A.value,"plays-inline":!0,poster:X.value,src:Q.value,class:e.normalizeClass(["gvp-video",S]),preload:"metadata",onAudioTracks:he,onQualityLevels:i,onCurrentLevel:s[0]||(s[0]=f=>x.value=f),onEnded:He,onFatalError:Oe,onLiveChange:s[1]||(s[1]=f=>V.value=f),onPause:s[2]||(s[2]=f=>{c.value=!1,o("pause")}),onPlay:s[3]||(s[3]=f=>{c.value=!0,o("play")})},{default:e.withCtx(()=>[e.renderSlot(a.$slots,"default")]),_:3},8,["controls","hls-config","is-hls","loop","muted","auto-play","audio-track-index","quality-level-index","poster","src","class"])),I.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Xn)),I.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",eo,e.toDisplayString(Ue.value),1)),!I.value&&C.value&&!N.value?(e.openBlock(),e.createElementBlock("div",to,[...s[16]||(s[16]=[e.createElementVNode("div",{class:"gvp-spinner"},null,-1),e.createElementVNode("span",{class:"gvp-sr-only"},"Loading…",-1)])])):e.createCommentVNode("",!0),!I.value&&N.value?(e.openBlock(),e.createElementBlock("div",no,[e.createVNode(qn,{class:"gvp-error-icon"}),s[18]||(s[18]=e.createElementVNode("p",{class:"gvp-error-text"},"This video couldn't be played.",-1)),e.createElementVNode("button",{type:"button",class:"gvp-error-retry",onClick:je},[e.createVNode(Un),s[17]||(s[17]=e.createElementVNode("span",null,"Retry",-1))])])):e.createCommentVNode("",!0),t.showDeviceToggle?(e.openBlock(),e.createElementBlock("div",oo,[e.createElementVNode("div",lo,[e.createElementVNode("button",{"aria-pressed":u.value==="desktop",class:e.normalizeClass(["gvp-toggle-btn",{"is-active":u.value==="desktop"}]),"aria-label":"Desktop view",type:"button",onClick:s[4]||(s[4]=f=>u.value="desktop")},[e.createVNode(In)],10,ao),s[19]||(s[19]=e.createElementVNode("div",{class:"gvp-toggle-divider"},null,-1)),e.createElementVNode("button",{"aria-pressed":u.value==="mobile",class:e.normalizeClass(["gvp-toggle-btn",{"is-active":u.value==="mobile"}]),"aria-label":"Mobile view",type:"button",onClick:s[5]||(s[5]=f=>u.value="mobile")},[e.createVNode(zn)],10,ro)])])):e.createCommentVNode("",!0),t.closable?(e.openBlock(),e.createElementBlock("button",{key:8,"aria-label":"Close",class:"gvp-close",type:"button",onClick:s[6]||(s[6]=f=>o("close"))},[e.createVNode(xe)])):e.createCommentVNode("",!0),g.value&&!$.value?(e.openBlock(),e.createBlock(nt,{key:9,tracks:E.value,"active-index":w.value,onSelect:s[7]||(s[7]=f=>B.value=f)},null,8,["tracks","active-index"])):e.createCommentVNode("",!0),!I.value&&!$.value?(e.openBlock(),e.createBlock(ct,{key:10,speed:M.value,onSelect:qe},null,8,["speed"])):e.createCommentVNode("",!0),!I.value&&!$.value?(e.openBlock(),e.createBlock(kt,{key:11,video:T.value},null,8,["video"])):e.createCommentVNode("",!0),!I.value&&e.unref(z)&&!$.value?(e.openBlock(),e.createElementBlock("button",{key:12,type:"button",class:e.normalizeClass(["gvp-pip-btn",{"is-active":D.value}]),"aria-label":D.value?"Exit picture-in-picture":"Picture-in-picture","aria-pressed":D.value,onClick:Ee},[e.createVNode($e)],10,so)):e.createCommentVNode("",!0),!I.value&&$.value?(e.openBlock(),e.createElementBlock("button",{key:13,type:"button",class:"gvp-click-layer","aria-label":c.value?"Pause":"Play",onClick:ze,onDblclick:De},null,40,io)):e.createCommentVNode("",!0),!I.value&&!$.value&&!c.value?(e.openBlock(),e.createElementBlock("div",co,[e.createElementVNode("button",{"aria-label":"Play",class:"gvp-play",type:"button",onClick:me,onMouseenter:s[8]||(s[8]=f=>p.value=!0),onMouseleave:s[9]||(s[9]=f=>p.value=!1)},[e.createVNode(Hn),t.tooltipText&&p.value?(e.openBlock(),e.createElementBlock("span",uo,e.toDisplayString(t.tooltipText),1)):e.createCommentVNode("",!0)],32)])):e.createCommentVNode("",!0),!I.value&&$.value?(e.openBlock(),e.createBlock(Tn,{key:15,video:T.value,"is-playing":c.value,container:y.value,"on-toggle-play":me,"quality-levels":v.value,"current-level":x.value,"selected-level":A.value,thumbnails:fe.value,chapters:ke.value,"has-prev":Y.value,"has-next":ve.value,"is-live":V.value,"audio-tracks":E.value,"audio-track-index":w.value,onSelectLevel:s[10]||(s[10]=f=>A.value=f),onSelectAudioTrack:s[11]||(s[11]=f=>B.value=f),onPrev:s[12]||(s[12]=f=>se(R.value-1,!0)),onNext:s[13]||(s[13]=f=>se(R.value+1,!0))},null,8,["video","is-playing","container","quality-levels","current-level","selected-level","thumbnails","chapters","has-prev","has-next","is-live","audio-tracks","audio-track-index"])):e.createCommentVNode("",!0),!I.value&&!$.value?(e.openBlock(),e.createElementBlock("div",vo)):e.createCommentVNode("",!0)],38)],6))}});exports.HLSPlayer=Ve;exports.VueVideoPlayer=mo;exports.parseYouTubeId=_e;exports.parseYouTubeStart=Pe;exports.youTubeEmbedUrl=Se;
4
4
  //# sourceMappingURL=index.cjs.map