@nexlylab/widget 1.32.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -0
- package/dist/INSTALL.txt +3 -0
- package/dist/runtime/1.32.14/chunks/ClickToLoadEmbed-CDdotCS8-W2yBrg7b.js +2 -0
- package/dist/runtime/1.32.14/chunks/PanelInfoVideo-BKn3ucAb-BrU-Qlul.js +3 -0
- package/dist/runtime/1.32.14/chunks/PanelVideoOverlay-BY__oBYV-B8OPC1xh.js +3 -0
- package/dist/runtime/1.32.14/chunks/_commonjsHelpers-C6fGbg64-BC8KDfbh.js +2 -0
- package/dist/runtime/1.32.14/chunks/accent-legibility-BJF2VO5n-CDPQ7suO.js +2 -0
- package/dist/runtime/1.32.14/chunks/allowed-elements-BXnLJV1S-C-_lr2zm.js +28 -0
- package/dist/runtime/1.32.14/chunks/assistant-link-components-MZWf5ty7-C44wlQAi.js +2 -0
- package/dist/runtime/1.32.14/chunks/assistant-link-policy-DWaWTnGr-Cc-yj-a-.js +2 -0
- package/dist/runtime/1.32.14/chunks/block-helpers-Cg_zAqG6-DnN2COvk.js +2 -0
- package/dist/runtime/1.32.14/chunks/block-rating-DH7mp-_R-CoiP5C2K.js +2 -0
- package/dist/runtime/1.32.14/chunks/external-url-LRu_ntew-CJQjg_od.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-1o6W5wiJ-I68tb-d3.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-B1ef1IlE-QeFj7CR9.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-B8aKMeg5-BLxOZxZv.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-B9ozeox8-oy07dUaV.js +6 -0
- package/dist/runtime/1.32.14/chunks/index-BD-jPdzs-ZRnEJoQe.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-BPDIV1BN-DINkyYvc.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-BSoCdILD-D6wzHiS0.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-BcsmWDTX-Dw9WA5Ac.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-BljIlfbh-D9I6jaso.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-BnKOhYKk-CkemNrch.js +4 -0
- package/dist/runtime/1.32.14/chunks/index-Bu9Gh6Nc-BfWdQCT7.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-BvlAsO4n-DbuSZfeK.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-BylVnv7X-DBhSkJ7i.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-C1WD1dlq-Dm9kbc85.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-C262wwK4-DpyhuXqd.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-C6_8JGpJ-BqZmEVev.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-C75hX_dj-VhJcCfAC.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-CMFQhtEe-BcW8HKb8.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-CNJUK2bK-C0OfCXUx.js +50 -0
- package/dist/runtime/1.32.14/chunks/index-Chy2Zmo5-CiRb-0NX.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-CmYYEi7N-Dr1V6OGz.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-CqV8rHvG-DS9JaGVN.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-CwbUW6dx-BLBDoJCM.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-Czz6Gyh_-C3bBvEcm.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-D-ZhVFzi-A3rpkVmQ.js +6 -0
- package/dist/runtime/1.32.14/chunks/index-D72orqXX-C_0Ll4qr.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-D9grn5WJ-Dp5AxBD4.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-DDEE3QfX-3B-eE3K7.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-DMQkz1bV-BuMYksln.js +272 -0
- package/dist/runtime/1.32.14/chunks/index-DO0-ht8E-DUgMllqN.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-DPNGQF5b-_M0CWPEY.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-DP_6HfDM-DAdxCQyi.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-DTVlG27U-DP0QKkgf.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-DZADUAKv-DPfvWVuj.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-DZKtK9hT-DQBGsPwB.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-Dh0aThiP-Aqz1AnQ5.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-Dkv5YXXW-pkywvGDF.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-DphwDFW6-C9wFr7fa.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-Dt6OpItC-R_xuAEQV.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-Gi-3UOyp-DuzPeEIz.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-IW3aNe-y-W1lJrIDD.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-V1EfdiK7-bdo5pwX-.js +4 -0
- package/dist/runtime/1.32.14/chunks/index-csHaX5dv-BpgnWlB8.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-hHQjRGar-TEMHje2B.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-k-jZV_MQ-H31PHMqm.js +2 -0
- package/dist/runtime/1.32.14/chunks/index-qpVhJY7A-Cgivx3vY.js +4 -0
- package/dist/runtime/1.32.14/chunks/index-uM4Y0lxc-Dsa9X9U7.js +2 -0
- package/dist/runtime/1.32.14/chunks/index.modern-CioVZ357-BA5NTOmY.js +6 -0
- package/dist/runtime/1.32.14/chunks/inert-assistant-components-B6Cx9pG5-DWb6n3Yq.js +2 -0
- package/dist/runtime/1.32.14/chunks/use-deferred-rating-XlgCUwcY-DDVOwURi.js +2 -0
- package/dist/runtime/1.32.14/nexly.js +61 -0
- package/dist/v1.js +6 -0
- package/package.json +36 -0
package/README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# @nexlylab/widget
|
|
2
|
+
|
|
3
|
+
Agent AI na dowolnej stronie w jednej linijce HTML. Bez builda, bez frameworka, bez konfiguracji.
|
|
4
|
+
|
|
5
|
+
## Instalacja
|
|
6
|
+
|
|
7
|
+
Wklej przed `</body>`:
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<script src="https://cdn.jsdelivr.net/npm/@nexlylab/widget/dist/v1.js"
|
|
11
|
+
data-api-key="pk_live_TWOJ_KLUCZ" defer></script>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
To wszystko. Klucz skopiujesz z panelu → Produkt → Instalacja. Motyw, język, zestaw
|
|
15
|
+
bloków i pozostałe ustawienia pobierane są z serwera na podstawie klucza, więc zmiana
|
|
16
|
+
konfiguracji nie wymaga dotykania Twojej strony.
|
|
17
|
+
|
|
18
|
+
Adres z numerem wersji (`@nexlylab/widget@1.32.14`) przypina Cię do jednego wydania i
|
|
19
|
+
jest cache'owany na zawsze — polecany na produkcji.
|
|
20
|
+
|
|
21
|
+
## Jak to wpływa na szybkość strony
|
|
22
|
+
|
|
23
|
+
Wklejony `<script>` pobiera tylko loader (**~1,9 KB gzip**), który rysuje sam przycisk.
|
|
24
|
+
Właściwy widget ściąga się dopiero, gdy odwiedzający najedzie na przycisk lub go
|
|
25
|
+
kliknie, a poszczególne moduły — dopiero gdy są potrzebne. Ładowanie Twojej strony
|
|
26
|
+
pozostaje nietknięte.
|
|
27
|
+
|
|
28
|
+
## Opcje
|
|
29
|
+
|
|
30
|
+
Wszystkie są opcjonalne — domyślne wartości pochodzą z ustawień produktu.
|
|
31
|
+
|
|
32
|
+
| Atrybut | Wartości | Domyślnie |
|
|
33
|
+
|---|---|---|
|
|
34
|
+
| `data-api-key` | klucz `pk_live_…` / `pk_test_…` | **wymagany** |
|
|
35
|
+
| `data-theme` | `light`, `dark`, `system` | `system` |
|
|
36
|
+
| `data-position` | `bottom-right`, `bottom-left` | `bottom-right` |
|
|
37
|
+
| `data-preload` | `hover`, `idle`, `click` | `hover` |
|
|
38
|
+
| `data-debug` | obecność atrybutu włącza logi | wyłączone |
|
|
39
|
+
|
|
40
|
+
Diagnostykę można też włączyć bez zmiany kodu, dopisując `?nexly-debug=1` do adresu strony.
|
|
41
|
+
|
|
42
|
+
## Sterowanie z Twojego kodu
|
|
43
|
+
|
|
44
|
+
`window.Nexly` istnieje natychmiast po wykonaniu snippetu — wywołania sprzed
|
|
45
|
+
załadowania widgetu trafiają do kolejki i wykonują się później, więc nie trzeba
|
|
46
|
+
niczego opóźniać.
|
|
47
|
+
|
|
48
|
+
```html
|
|
49
|
+
<button onclick="Nexly('open')">Potrzebuję pomocy</button>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Dostępne polecenia: `open`, `close`, `destroy`.
|
|
53
|
+
|
|
54
|
+
## Wymagania
|
|
55
|
+
|
|
56
|
+
Widget wymaga HTTPS, jeśli chcesz korzystać z rozmowy głosowej — mikrofon i WebRTC są
|
|
57
|
+
przez przeglądarki dostępne wyłącznie w bezpiecznym kontekście. Czat tekstowy działa
|
|
58
|
+
również po HTTP.
|
|
59
|
+
|
|
60
|
+
Domenę Twojej strony trzeba dodać w panelu do listy dozwolonych originów. Bez tego
|
|
61
|
+
widget wczyta się, ale rozmowa zwróci błąd — komunikat w konsoli wskaże, gdzie to
|
|
62
|
+
uzupełnić.
|
|
63
|
+
|
|
64
|
+
## Licencja
|
|
65
|
+
|
|
66
|
+
MIT © NexlyLab
|
package/dist/INSTALL.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{t as v,r as y,j as i}from"../nexly.js";import{L as $,N as j,l as N}from"./allowed-elements-BXnLJV1S-C-_lr2zm.js";import{a as m}from"./assistant-link-policy-DWaWTnGr-Cc-yj-a-.js";const k=["youtube.com","youtube-nocookie.com"],B=["youtu.be"],E=["vimeo.com"],f=/^[A-Za-z0-9_-]{6,32}$/,P=/^\d{6,12}$/;function S(n){return f.test(n)}const _=4;function w(n){const[t,e]=v(()=>new URL(n));return e||!t?null:t}function b(n,t){if(t){const r=n.pathname.split("/").filter(Boolean);if(r.length!==1)return null;const o=r[0];return f.test(o)?o:null}const e=n.pathname.split("/").filter(Boolean);if(e[0]==="watch"){const r=n.searchParams.get("v");return r&&f.test(r)?r:null}if(e[0]==="embed"||e[0]==="shorts"||e[0]==="v"){if(e.length!==2)return null;const r=e[1];return f.test(r)?r:null}return null}function z(n){const t=n.pathname.split("/").filter(Boolean),e=t[0]==="video"?t[1]:t[0];if(!e)return null;const r=t[0]==="video"?2:1;return t.length!==r?null:P.test(e)?e:null}function C(n){const t=w(n);if(!t||t.protocol!=="https:")return null;const e=t.hostname;if(m(e,B)){const r=b(t,!0);return r?{provider:"youtube",id:r}:null}if(m(e,k)){const r=b(t,!1);return r?{provider:"youtube",id:r}:null}if(m(e,E)){const r=z(t);return r?{provider:"vimeo",id:r}:null}return null}const F=/\.(png|jpe?g|gif|webp|avif|svg)$/i,L=/[;?#]|[\u0000-\u001F\u007F]/,R=5;function U(n){let t=n;for(let e=0;e<R;e++){if(!t.includes("%"))return t;const[r,o]=v(()=>decodeURIComponent(t));if(o||r===void 0)return null;if(r===t)return t;t=r}return null}function H(n,t){if(t.length===0)return null;const e=w(n);if(!e||e.protocol!=="https:"||!m(e.hostname,t)||e.search)return null;const r=U(e.pathname);return r===null||L.test(r)||!F.test(r)?null:(e.username="",e.password="",e.href)}function*x(n){if(n.children)for(const t of n.children)yield t,yield*x(t)}function T(n,t={}){const e=t.allowEmbeds===!0,r=t.allowedImageHosts??[],o={embeds:[],images:[]};if(!n||!e&&r.length===0)return o;const[p,h]=v(()=>$().use(j).use(N).parse(n));if(h||!p)return o;const c=[],s=[],d=new Set,a=new Set;for(const u of x(p)){if(e&&u.type==="link"&&c.length<_){const l=u.url?C(u.url):null;if(l){const g=`${l.provider}:${l.id}`;d.has(g)||(d.add(g),c.push(l))}continue}if(u.type==="image"&&s.length<_){const l=u.url?H(u.url,r):null;l&&!a.has(l)&&(a.add(l),s.push({src:l,alt:(u.alt??"").trim()}))}}return{embeds:c,images:s}}const I={youtube:"support_chat.media_provider_youtube",vimeo:"support_chat.media_provider_vimeo"};function M(n){return n.provider==="youtube"?S(n.id)?`https://www.youtube-nocookie.com/embed/${n.id}`:null:`https://player.vimeo.com/video/${n.id}`}function X({embed:n,t,classPrefix:e,posterUrl:r=null}){const[o,p]=y.useState(!1),[h,c]=y.useState(!1),s=t(I[n.provider]),d=M(n);if(!d)return null;if(o)return i.jsx("div",{className:`${e}__media-frame`,children:i.jsx("iframe",{src:d,title:t("support_chat.media_player_title",{provider:s}),sandbox:"allow-scripts allow-same-origin allow-presentation",referrerPolicy:"strict-origin-when-cross-origin",allow:"accelerometer; encrypted-media; picture-in-picture; fullscreen",allowFullScreen:!0,loading:"lazy"})});const a=h?null:r;return i.jsxs("button",{type:"button",className:`${e}__media-tile${a?` ${e}__media-tile--poster`:""}`,onClick:()=>p(!0),"aria-label":t("support_chat.media_play_video",{provider:s}),children:[a&&i.jsx("img",{className:`${e}__media-poster`,src:a,alt:"","aria-hidden":"true",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",onError:()=>c(!0)}),i.jsx("span",{className:`${e}__media-play`,"aria-hidden":"true",children:i.jsx("svg",{viewBox:"0 0 24 24",width:"24",height:"24",fill:"currentColor",children:i.jsx("path",{d:"M8 5v14l11-7z"})})}),i.jsx("span",{className:`${e}__media-tile-label`,children:s})]})}export{S as F,X,T as j};
|
|
2
|
+
//# sourceMappingURL=ClickToLoadEmbed-CDdotCS8-W2yBrg7b.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["chunks/PanelVideoOverlay-BY__oBYV-B8OPC1xh.js","nexly.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as o,j as n,_ as v,b as d}from"../nexly.js";function _(e,r,a){const[i,t]=o.useState(null);return o.useEffect(()=>{if(!a)return;let l=!1;async function s(){const[u,c]=await d(()=>fetch(`${r}/api/widget/panel-video?panel=${e}`,{headers:{"X-API-Key":a}}));if(l||c||!u.ok)return;const[p,f]=await d(()=>u.json());l||f||t(p)}return s(),()=>{l=!0}},[e,r,a]),i}const b=o.lazy(()=>v(()=>import("./PanelVideoOverlay-BY__oBYV-B8OPC1xh.js"),__vite__mapDeps([0,1])).then(e=>({default:e.PanelVideoOverlay})));function x({panelKey:e,baseUrl:r,apiKey:a,t:i}){const t=_(e,r,a),[l,s]=o.useState(!1);if(!t?.enabled||!t.videoUrl)return null;const u=t.videoUrl,c=t.contentType??"video/mp4";return n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",className:"es-panel-video-btn","aria-label":i("panel_video.info_button"),title:i("panel_video.info_button"),onClick:()=>s(!0),"data-testid":"panel-video-info-button",children:n.jsx("span",{"aria-hidden":"true",children:"i"})}),l&&n.jsx(o.Suspense,{fallback:null,children:n.jsx(b,{videoUrl:u,contentType:c,onClose:()=>s(!1),t:i})})]})}export{x as j};
|
|
3
|
+
//# sourceMappingURL=PanelInfoVideo-BKn3ucAb-BrU-Qlul.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{r as oe,j as K}from"../nexly.js";function m(e,i,t){return(i=vt(i))in e?Object.defineProperty(e,i,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[i]=t,e}function bt(e,i){if(typeof e!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var s=t.call(e,i);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return(i==="string"?String:Number)(e)}function vt(e){var i=bt(e,"string");return typeof i=="symbol"?i:i+""}function wt(e,i){if(!(e instanceof i))throw new TypeError("Cannot call a class as a function")}function je(e,i){for(var t=0;t<i.length;t++){var s=i[t];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function kt(e,i,t){return i&&je(e.prototype,i),t&&je(e,t),e}function Tt(e,i,t){return i in e?Object.defineProperty(e,i,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[i]=t,e}function He(e,i){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);i&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),t.push.apply(t,s)}return t}function qe(e){for(var i=1;i<arguments.length;i++){var t=arguments[i]!=null?arguments[i]:{};i%2?He(Object(t),!0).forEach(function(s){Tt(e,s,t[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):He(Object(t)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(t,s))})}return e}var De={addCSS:!0,thumbWidth:15,watch:!0};function Ct(e,i){return function(){return Array.from(document.querySelectorAll(i)).includes(this)}.call(e,i)}function At(e,i){if(e&&i){var t=new Event(i,{bubbles:!0});e.dispatchEvent(t)}}var ne=function(e){return e!=null?e.constructor:null},Ne=function(e,i){return!!(e&&i&&e instanceof i)},We=function(e){return e==null},Ke=function(e){return ne(e)===Object},St=function(e){return ne(e)===Number&&!Number.isNaN(e)},Ye=function(e){return ne(e)===String},Et=function(e){return ne(e)===Boolean},Mt=function(e){return ne(e)===Function},Xe=function(e){return Array.isArray(e)},Qe=function(e){return Ne(e,NodeList)},Pt=function(e){return Ne(e,Element)},xt=function(e){return Ne(e,Event)},Nt=function(e){return We(e)||(Ye(e)||Xe(e)||Qe(e))&&!e.length||Ke(e)&&!Object.keys(e).length},H={nullOrUndefined:We,object:Ke,number:St,string:Ye,boolean:Et,function:Mt,array:Xe,nodeList:Qe,element:Pt,event:xt,empty:Nt};function Lt(e){var i="".concat(e).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return i?Math.max(0,(i[1]?i[1].length:0)-(i[2]?+i[2]:0)):0}function It(e,i){if(1>i){var t=Lt(i);return parseFloat(e.toFixed(t))}return Math.round(e/i)*i}var $t=(function(){function e(i,t){wt(this,e),H.element(i)?this.element=i:H.string(i)&&(this.element=document.querySelector(i)),H.element(this.element)&&H.empty(this.element.rangeTouch)&&(this.config=qe({},De,{},t),this.init())}return kt(e,[{key:"init",value:function(){e.enabled&&(this.config.addCSS&&(this.element.style.userSelect="none",this.element.style.webKitUserSelect="none",this.element.style.touchAction="manipulation"),this.listeners(!0),this.element.rangeTouch=this)}},{key:"destroy",value:function(){e.enabled&&(this.config.addCSS&&(this.element.style.userSelect="",this.element.style.webKitUserSelect="",this.element.style.touchAction=""),this.listeners(!1),this.element.rangeTouch=null)}},{key:"listeners",value:function(i){var t=this,s=i?"addEventListener":"removeEventListener";["touchstart","touchmove","touchend"].forEach(function(a){t.element[s](a,function(n){return t.set(n)},!1)})}},{key:"get",value:function(i){if(!e.enabled||!H.event(i))return null;var t,s=i.target,a=i.changedTouches[0],n=parseFloat(s.getAttribute("min"))||0,r=parseFloat(s.getAttribute("max"))||100,o=parseFloat(s.getAttribute("step"))||1,c=s.getBoundingClientRect(),u=100/c.width*(this.config.thumbWidth/2)/100;return 0>(t=100/c.width*(a.clientX-c.left))?t=0:100<t&&(t=100),50>t?t-=(100-2*t)*u:50<t&&(t+=2*(t-50)*u),n+It(t/100*(r-n),o)}},{key:"set",value:function(i){e.enabled&&H.event(i)&&!i.target.disabled&&(i.preventDefault(),i.target.value=this.get(i),At(i.target,i.type==="touchend"?"change":"input"))}}],[{key:"setup",value:function(i){var t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},s=null;if(H.empty(i)||H.string(i)?s=Array.from(document.querySelectorAll(H.string(i)?i:'input[type="range"]')):H.element(i)?s=[i]:H.nodeList(i)?s=Array.from(i):H.array(i)&&(s=i.filter(H.element)),H.empty(s))return null;var a=qe({},De,{},t);if(H.string(i)&&a.watch){var n=new MutationObserver(function(r){Array.from(r).forEach(function(o){Array.from(o.addedNodes).forEach(function(c){H.element(c)&&Ct(c,i)&&new e(c,a)})})});n.observe(document.body,{childList:!0,subtree:!0})}return s.map(function(r){return new e(r,t)})}},{key:"enabled",get:function(){return"ontouchstart"in document.documentElement}}]),e})();const ae=e=>e!==null&&typeof e<"u"?e.constructor:null,B=(e,i)=>!!(e&&i&&e instanceof i),Le=e=>e===null||typeof e>"u",Je=e=>ae(e)===Object,Ot=e=>ae(e)===Number&&!Number.isNaN(e),ge=e=>ae(e)===String,_t=e=>ae(e)===Boolean,Ge=e=>typeof e=="function",Ze=e=>Array.isArray(e),jt=e=>B(e,WeakMap),et=e=>B(e,NodeList),Ht=e=>ae(e)===Text,qt=e=>B(e,Event),Dt=e=>B(e,KeyboardEvent),Rt=e=>B(e,window.TextTrackCue)||B(e,window.VTTCue),Vt=e=>B(e,TextTrack)||!Le(e)&&ge(e.kind),Ft=e=>B(e,Promise)&&Ge(e.then);function Ut(e){return e!==null&&typeof e=="object"&&e.nodeType===1&&typeof e.style=="object"&&typeof e.ownerDocument=="object"}function tt(e){return Le(e)||(ge(e)||Ze(e)||et(e))&&!e.length||Je(e)&&!Object.keys(e).length}function Bt(e){if(B(e,window.URL))return!0;if(!ge(e))return!1;let i=e;(!e.startsWith("http://")||!e.startsWith("https://"))&&(i=`http://${e}`);try{return!tt(new URL(i).hostname)}catch{return!1}}var l={nullOrUndefined:Le,object:Je,number:Ot,string:ge,boolean:_t,function:Ge,array:Ze,weakMap:jt,nodeList:et,element:Ut,textNode:Ht,event:qt,keyboardEvent:Dt,cue:Rt,track:Vt,promise:Ft,url:Bt,empty:tt};const Te=(()=>{const e=document.createElement("span"),i={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},t=Object.keys(i).find(s=>e.style[s]!==void 0);return l.string(t)?i[t]:!1})();function it(e,i){setTimeout(()=>{try{e.hidden=!0,e.offsetHeight,e.hidden=!1}catch{}},i)}function zt(e){return JSON.parse(JSON.stringify(e))}function st(e,i){return i.split(".").reduce((t,s)=>t&&t[s],e)}function N(e={},...i){if(!i.length)return e;const t=i.shift();return l.object(t)?(Object.keys(t).forEach(s=>{l.object(t[s])?(Object.keys(e).includes(s)||Object.assign(e,{[s]:{}}),N(e[s],t[s])):Object.assign(e,{[s]:t[s]})}),N(e,...i)):e}function nt(e,i){const t=e.length?e:[e];Array.from(t).reverse().forEach((s,a)=>{const n=a>0?i.cloneNode(!0):i,r=s.parentNode,o=s.nextSibling;n.appendChild(s),o?r.insertBefore(n,o):r.appendChild(n)})}function Ce(e,i){!l.element(e)||l.empty(i)||Object.entries(i).filter(([,t])=>!l.nullOrUndefined(t)).forEach(([t,s])=>e.setAttribute(t,s))}function b(e,i,t){const s=document.createElement(e);return l.object(i)&&Ce(s,i),l.string(t)&&(s.textContent=t),s}function Wt(e,i){!l.element(e)||!l.element(i)||i.parentNode.insertBefore(e,i.nextSibling)}function Re(e,i,t,s){l.element(i)&&i.appendChild(b(e,t,s))}function U(e){if(l.nodeList(e)||l.array(e)){Array.from(e).forEach(U);return}!l.element(e)||!l.element(e.parentNode)||e.parentNode.removeChild(e)}function ce(e){if(!l.element(e))return;let{length:i}=e.childNodes;for(;i>0;)e.removeChild(e.lastChild),i-=1}function de(e,i){return!l.element(i)||!l.element(i.parentNode)||!l.element(e)?null:(i.parentNode.replaceChild(e,i),e)}function V(e,i){if(!l.string(e)||l.empty(e))return{};const t={},s=N({},i);return e.split(",").forEach(a=>{const n=a.trim(),r=n.replace(".",""),o=n.replace(/[[\]]/g,"").split("="),[c]=o,u=o.length>1?o[1].replace(/["']/g,""):"";switch(n.charAt(0)){case".":l.string(s.class)?t.class=`${s.class} ${r}`:t.class=r;break;case"#":t.id=n.replace("#","");break;case"[":t[c]=u;break}}),N(s,t)}function Y(e,i){if(!l.element(e))return;let t=i;l.boolean(t)||(t=!e.hidden),e.hidden=t}function S(e,i,t){if(l.nodeList(e))return Array.from(e).map(s=>S(s,i,t));if(l.element(e)){let s="toggle";return typeof t<"u"&&(s=t?"add":"remove"),e.classList[s](i),e.classList.contains(i)}return!1}function me(e,i){return l.element(e)&&e.classList.contains(i)}function X(e,i){const{prototype:t}=Element;function s(){return Array.from(document.querySelectorAll(i)).includes(this)}return(t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector||s).call(e,i)}function Kt(e,i){const{prototype:t}=Element;function s(){let a=this;do{if(X.matches(a,i))return a;a=a.parentElement||a.parentNode}while(a!==null&&a.nodeType===1);return null}return(t.closest||s).call(e,i)}function ee(e){return this.elements.container.querySelectorAll(e)}function $(e){return this.elements.container.querySelector(e)}function be(e=null,i=!1){l.element(e)&&e.focus({preventScroll:!0,focusVisible:i})}const Ve={"audio/ogg":"vorbis","audio/wav":"1","video/webm":"vp8, vorbis","video/mp4":"avc1.42E01E, mp4a.40.2","video/ogg":"theora"},L={audio:"canPlayType"in document.createElement("audio"),video:"canPlayType"in document.createElement("video"),check(e,i){const t=L[e]||i!=="html5",s=t&&L.rangeInput;return{api:t,ui:s}},pip:document.pictureInPictureEnabled&&!b("video").disablePictureInPicture,airplay:l.function(window.WebKitPlaybackTargetAvailabilityEvent),playsinline:"playsInline"in document.createElement("video"),mime(e){if(l.empty(e))return!1;const[i]=e.split("/");let t=e;if(!this.isHTML5||i!==this.type)return!1;Object.keys(Ve).includes(t)&&(t+=`; codecs="${Ve[e]}"`);try{return!!(t&&this.media.canPlayType(t).replace(/no/,""))}catch{return!1}},textTracks:"textTracks"in document.createElement("video"),rangeInput:(()=>{const e=document.createElement("input");return e.type="range",e.type==="range"})(),touch:"ontouchstart"in document.documentElement,transitions:Te!==!1,reducedMotion:"matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches},Yt=(()=>{let e=!1;try{const i=Object.defineProperty({},"passive",{get(){return e=!0,null}});window.addEventListener("test",null,i),window.removeEventListener("test",null,i)}catch{}return e})();function te(e,i,t,s=!1,a=!0,n=!1){if(!e||!("addEventListener"in e)||l.empty(i)||!l.function(t))return;const r=i.split(" ");let o=n;Yt&&(o={passive:a,capture:n}),r.forEach(c=>{this&&this.eventListeners&&s&&this.eventListeners.push({element:e,type:c,callback:t,options:o}),e[s?"addEventListener":"removeEventListener"](c,t,o)})}function C(e,i="",t,s=!0,a=!1){te.call(this,e,i,t,!0,s,a)}function fe(e,i="",t,s=!0,a=!1){te.call(this,e,i,t,!1,s,a)}function Ie(e,i="",t,s=!0,a=!1){const n=(...r)=>{fe(e,i,n,s,a),t.apply(this,r)};te.call(this,e,i,n,!0,s,a)}function v(e,i="",t=!1,s={}){if(!l.element(e)||l.empty(i))return;const a=new CustomEvent(i,{bubbles:t,detail:{...s,plyr:this}});e.dispatchEvent(a)}function Xt(){this&&this.eventListeners&&(this.eventListeners.forEach(e=>{const{element:i,type:t,callback:s,options:a}=e;i.removeEventListener(t,s,a)}),this.eventListeners=[])}function Qt(){return new Promise(e=>this.ready?setTimeout(e,0):C.call(this,this.elements.container,"ready",e)).then(()=>{})}function F(e){l.promise(e)&&e.then(null,()=>{})}function Ae(e){return l.array(e)?e.filter((i,t)=>e.indexOf(i)===t):e}function at(e,i){return!l.array(e)||!e.length?null:e.reduce((t,s)=>Math.abs(s-i)<Math.abs(t-i)?s:t)}function lt(e){return!window||!window.CSS?!1:window.CSS.supports(e)}const Fe=[[1,1],[4,3],[3,4],[5,4],[4,5],[3,2],[2,3],[16,10],[10,16],[16,9],[9,16],[21,9],[9,21],[32,9],[9,32]].reduce((e,[i,t])=>({...e,[i/t]:[i,t]}),{});function rt(e){return!l.array(e)&&(!l.string(e)||!e.includes(":"))?!1:(l.array(e)?e:e.split(":")).map(Number).every(l.number)}function pe(e){if(!l.array(e)||!e.every(l.number))return null;const[i,t]=e,s=(n,r)=>r===0?n:s(r,n%r),a=s(i,t);return[i/a,t/a]}function $e(e){const i=s=>rt(s)?s.split(":").map(Number):null;let t=i(e);if(t===null&&(t=i(this.config.ratio)),t===null&&!l.empty(this.embed)&&l.array(this.embed.ratio)&&({ratio:t}=this.embed),t===null&&this.isHTML5){const{videoWidth:s,videoHeight:a}=this.media;t=[s,a]}return pe(t)}function Q(e){if(!this.isVideo)return{};const{wrapper:i}=this.elements,t=$e.call(this,e);if(!l.array(t))return{};const[s,a]=pe(t),n=lt(`aspect-ratio: ${s}/${a}`),r=100/s*a;if(n?i.style.aspectRatio=`${s}/${a}`:i.style.paddingBottom=`${r}%`,this.isVimeo&&!this.config.vimeo.premium&&this.supported.ui){const o=100/this.media.offsetWidth*Number.parseInt(window.getComputedStyle(this.media).paddingBottom,10),c=(o-r)/(o/50);this.fullscreen.active?i.style.paddingBottom=null:this.media.style.transform=`translateY(-${c}%)`}else this.isHTML5&&i.classList.add(this.config.classNames.videoFixedRatio);return{padding:r,ratio:t}}function ot(e,i,t=.05){const s=e/i,a=at(Object.keys(Fe),s);return Math.abs(a-s)<=t?Fe[a]:[e,i]}function Jt(){const e=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),i=Math.max(document.documentElement.clientHeight||0,window.innerHeight||0);return[e,i]}const W={getSources(){return this.isHTML5?Array.from(this.media.querySelectorAll("source")).filter(e=>{const i=e.getAttribute("type");return l.empty(i)?!0:L.mime.call(this,i)}):[]},getQualityOptions(){return this.config.quality.forced?this.config.quality.options:W.getSources.call(this).map(e=>Number(e.getAttribute("size"))).filter(Boolean)},setup(){if(!this.isHTML5)return;const e=this;e.options.speed=e.config.speed.options,l.empty(this.config.ratio)||Q.call(e),Object.defineProperty(e.media,"quality",{get(){const i=W.getSources.call(e).find(t=>t.getAttribute("src")===e.source);return i&&Number(i.getAttribute("size"))},set(i){if(e.quality!==i){if(e.config.quality.forced&&l.function(e.config.quality.onChange))e.config.quality.onChange(i);else{const t=W.getSources.call(e).find(c=>Number(c.getAttribute("size"))===i);if(!t)return;const{currentTime:s,paused:a,preload:n,readyState:r,playbackRate:o}=e.media;e.media.src=t.getAttribute("src"),(n!=="none"||r)&&(e.once("loadedmetadata",()=>{e.speed=o,e.currentTime=s,a||F(e.play())}),e.media.load())}v.call(e,e.media,"qualitychange",!1,{quality:i})}}})},cancelRequests(){this.isHTML5&&(U(W.getSources.call(this)),this.media.setAttribute("src",this.config.blankVideo),this.media.load(),this.debug.log("Cancelled network requests"))}},Gt=!!window.document.documentMode,Zt=/Edge/.test(navigator.userAgent),ei="WebkitAppearance"in document.documentElement.style&&!/Edge/.test(navigator.userAgent),ti=navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,ii=/iPad|iPhone|iPod/i.test(navigator.userAgent)&&navigator.maxTouchPoints>1;var _={isIE:Gt,isEdge:Zt,isWebKit:ei,isIPadOS:ti,isIos:ii};function si(e){return`${e}-${Math.floor(Math.random()*1e4)}`}function Se(e,...i){return l.empty(e)?e:e.toString().replace(/\{(\d+)\}/g,(t,s)=>i[s].toString())}function ni(e,i){return e===0||i===0||Number.isNaN(e)||Number.isNaN(i)?0:(e/i*100).toFixed(2)}function Z(e="",i="",t=""){return e.replace(new RegExp(i.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1"),"g"),t.toString())}function ct(e=""){return e.toString().replace(/\w\S*/g,i=>i.charAt(0).toUpperCase()+i.slice(1).toLowerCase())}function ai(e=""){let i=e.toString();return i=Z(i,"-"," "),i=Z(i,"_"," "),i=ct(i),Z(i," ","")}function li(e=""){let i=e.toString();return i=ai(i),i.charAt(0).toLowerCase()+i.slice(1)}function ri(e){const i=document.createDocumentFragment(),t=document.createElement("div");return i.appendChild(t),t.innerHTML=e,i.firstChild.textContent}function oi(e){const i=document.createElement("div");return i.appendChild(e),i.innerHTML}const Ue={pip:"PIP",airplay:"AirPlay",html5:"HTML5",vimeo:"Vimeo",youtube:"YouTube"},O={get(e="",i={}){if(l.empty(e)||l.empty(i))return"";let t=st(i.i18n,e);if(l.empty(t))return Object.keys(Ue).includes(e)?Ue[e]:"";const s={"{seektime}":i.seekTime,"{title}":i.title};return Object.entries(s).forEach(([a,n])=>{t=Z(t,a,n)}),t}};class ie{constructor(i){m(this,"get",t=>{if(!ie.supported||!this.enabled)return null;const s=window.localStorage.getItem(this.key);if(l.empty(s))return null;const a=JSON.parse(s);return l.string(t)&&t.length?a[t]:a}),m(this,"set",t=>{if(!ie.supported||!this.enabled||!l.object(t))return;let s=this.get();l.empty(s)&&(s={}),N(s,t);try{window.localStorage.setItem(this.key,JSON.stringify(s))}catch{}}),this.enabled=i.config.storage.enabled,this.key=i.config.storage.key}static get supported(){try{if(!("localStorage"in window))return!1;const i="___test";return window.localStorage.setItem(i,i),window.localStorage.removeItem(i),!0}catch{return!1}}}function le(e,i="text",t=!1){return new Promise((s,a)=>{try{const n=new XMLHttpRequest;if(!("withCredentials"in n))return;t&&(n.withCredentials=!0),n.addEventListener("load",()=>{if(i==="text")try{s(JSON.parse(n.responseText))}catch{s(n.responseText)}else s(n.response)}),n.addEventListener("error",()=>{throw new Error(n.status)}),n.open("GET",e,!0),n.responseType=i,n.send()}catch(n){a(n)}})}function ut(e,i){if(!l.string(e))return;const t="cache",s=l.string(i);let a=!1;const n=()=>document.getElementById(i)!==null,r=(o,c)=>{o.innerHTML=c,!(s&&n())&&document.body.insertAdjacentElement("afterbegin",o)};if(!s||!n()){const o=ie.supported,c=document.createElement("div");if(c.setAttribute("hidden",""),s&&c.setAttribute("id",i),o){const u=window.localStorage.getItem(`${t}-${i}`);if(a=u!==null,a){const p=JSON.parse(u);r(c,p.content)}}le(e).then(u=>{if(!l.empty(u)){if(o)try{window.localStorage.setItem(`${t}-${i}`,JSON.stringify({content:u}))}catch{}r(c,u)}}).catch(()=>{})}}const ht=e=>Math.trunc(e/60/60%60,10),ci=e=>Math.trunc(e/60%60,10),ui=e=>Math.trunc(e%60,10);function ye(e=0,i=!1,t=!1){if(!l.number(e))return ye(void 0,i,t);const s=o=>`0${o}`.slice(-2);let a=ht(e);const n=ci(e),r=ui(e);return i||a>0?a=`${a}:`:a="",`${t&&e>0?"-":""}${a}${s(n)}:${s(r)}`}const d={getIconUrl(){const e=new URL(this.config.iconUrl,window.location),i=window.location.host?window.location.host:window.top.location.host,t=e.host!==i||_.isIE&&!window.svg4everybody;return{url:this.config.iconUrl,cors:t}},findElements(){try{return this.elements.controls=$.call(this,this.config.selectors.controls.wrapper),this.elements.buttons={play:ee.call(this,this.config.selectors.buttons.play),pause:$.call(this,this.config.selectors.buttons.pause),restart:$.call(this,this.config.selectors.buttons.restart),rewind:$.call(this,this.config.selectors.buttons.rewind),fastForward:$.call(this,this.config.selectors.buttons.fastForward),mute:$.call(this,this.config.selectors.buttons.mute),pip:$.call(this,this.config.selectors.buttons.pip),airplay:$.call(this,this.config.selectors.buttons.airplay),settings:$.call(this,this.config.selectors.buttons.settings),captions:$.call(this,this.config.selectors.buttons.captions),fullscreen:$.call(this,this.config.selectors.buttons.fullscreen)},this.elements.progress=$.call(this,this.config.selectors.progress),this.elements.inputs={seek:$.call(this,this.config.selectors.inputs.seek),volume:$.call(this,this.config.selectors.inputs.volume)},this.elements.display={buffer:$.call(this,this.config.selectors.display.buffer),currentTime:$.call(this,this.config.selectors.display.currentTime),duration:$.call(this,this.config.selectors.display.duration)},l.element(this.elements.progress)&&(this.elements.display.seekTooltip=this.elements.progress.querySelector(`.${this.config.classNames.tooltip}`)),!0}catch(e){return this.debug.warn("It looks like there is a problem with your custom controls HTML",e),this.toggleNativeControls(!0),!1}},createIcon(e,i){const t="http://www.w3.org/2000/svg",s=d.getIconUrl.call(this),a=`${s.cors?"":s.url}#${this.config.iconPrefix}`,n=document.createElementNS(t,"svg");Ce(n,N(i,{"aria-hidden":"true",focusable:"false"}));const r=document.createElementNS(t,"use"),o=`${a}-${e}`;return"href"in r&&r.setAttributeNS("http://www.w3.org/1999/xlink","href",o),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o),n.appendChild(r),n},createLabel(e,i={}){const t=O.get(e,this.config),s={...i,class:[i.class,this.config.classNames.hidden].filter(Boolean).join(" ")};return b("span",s,t)},createBadge(e){if(l.empty(e))return null;const i=b("span",{class:this.config.classNames.menu.value});return i.appendChild(b("span",{class:this.config.classNames.menu.badge},e)),i},createButton(e,i){const t=N({},i);let s=li(e);const a={element:"button",toggle:!1,label:null,icon:null,labelPressed:null,iconPressed:null};switch(["element","icon","label"].forEach(r=>{Object.keys(t).includes(r)&&(a[r]=t[r],delete t[r])}),a.element==="button"&&!Object.keys(t).includes("type")&&(t.type="button"),Object.keys(t).includes("class")?t.class.split(" ").includes(this.config.classNames.control)||N(t,{class:`${t.class} ${this.config.classNames.control}`}):t.class=this.config.classNames.control,e){case"play":a.toggle=!0,a.label="play",a.labelPressed="pause",a.icon="play",a.iconPressed="pause";break;case"mute":a.toggle=!0,a.label="mute",a.labelPressed="unmute",a.icon="volume",a.iconPressed="muted";break;case"captions":a.toggle=!0,a.label="enableCaptions",a.labelPressed="disableCaptions",a.icon="captions-off",a.iconPressed="captions-on";break;case"fullscreen":a.toggle=!0,a.label="enterFullscreen",a.labelPressed="exitFullscreen",a.icon="enter-fullscreen",a.iconPressed="exit-fullscreen";break;case"play-large":t.class+=` ${this.config.classNames.control}--overlaid`,s="play",a.label="play",a.icon="play";break;default:l.empty(a.label)&&(a.label=s),l.empty(a.icon)&&(a.icon=e)}const n=b(a.element);return a.toggle?(n.appendChild(d.createIcon.call(this,a.iconPressed,{class:"icon--pressed"})),n.appendChild(d.createIcon.call(this,a.icon,{class:"icon--not-pressed"})),n.appendChild(d.createLabel.call(this,a.labelPressed,{class:"label--pressed"})),n.appendChild(d.createLabel.call(this,a.label,{class:"label--not-pressed"}))):(n.appendChild(d.createIcon.call(this,a.icon)),n.appendChild(d.createLabel.call(this,a.label))),N(t,V(this.config.selectors.buttons[s],t)),Ce(n,t),s==="play"?(l.array(this.elements.buttons[s])||(this.elements.buttons[s]=[]),this.elements.buttons[s].push(n)):this.elements.buttons[s]=n,n},createRange(e,i){const t=b("input",N(V(this.config.selectors.inputs[e]),{type:"range",min:0,max:100,step:.01,value:0,autocomplete:"off",role:"slider","aria-label":O.get(e,this.config),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0},i));return this.elements.inputs[e]=t,d.updateRangeFill.call(this,t),$t.setup(t),t},createProgress(e,i){const t=b("progress",N(V(this.config.selectors.display[e]),{min:0,max:100,value:0,role:"progressbar","aria-hidden":!0},i));if(e!=="volume"){t.appendChild(b("span",null,"0"));const s={played:"played",buffer:"buffered"}[e],a=s?O.get(s,this.config):"";t.textContent=`% ${a.toLowerCase()}`}return this.elements.display[e]=t,t},createTime(e,i){const t=V(this.config.selectors.display[e],i),s=b("div",N(t,{class:`${t.class?t.class:""} ${this.config.classNames.display.time} `.trim(),"aria-label":O.get(e,this.config),role:"timer"}),"00:00");return this.elements.display[e]=s,s},bindMenuItemShortcuts(e,i){C.call(this,e,"keydown keyup",t=>{if(![" ","ArrowUp","ArrowDown","ArrowRight"].includes(t.key)||(t.preventDefault(),t.stopPropagation(),t.type==="keydown"))return;const s=X(e,'[role="menuitemradio"]');if(!s&&[" ","ArrowRight"].includes(t.key))d.showMenuPanel.call(this,i,!0);else{let a;t.key!==" "&&(t.key==="ArrowDown"||s&&t.key==="ArrowRight"?(a=e.nextElementSibling,l.element(a)||(a=e.parentNode.firstElementChild)):(a=e.previousElementSibling,l.element(a)||(a=e.parentNode.lastElementChild)),be.call(this,a,!0))}},!1),C.call(this,e,"keyup",t=>{t.key==="Return"&&d.focusFirstMenuItem.call(this,null,!0)})},createMenuItem({value:e,list:i,type:t,title:s,badge:a=null,checked:n=!1}){const r=V(this.config.selectors.inputs[t]),o=b("button",N(r,{type:"button",role:"menuitemradio",class:`${this.config.classNames.control} ${r.class?r.class:""}`.trim(),"aria-checked":n,value:e})),c=b("span");c.innerHTML=s,l.element(a)&&c.appendChild(a),o.appendChild(c),Object.defineProperty(o,"checked",{enumerable:!0,get(){return o.getAttribute("aria-checked")==="true"},set(u){u&&Array.from(o.parentNode.children).filter(p=>X(p,'[role="menuitemradio"]')).forEach(p=>p.setAttribute("aria-checked","false")),o.setAttribute("aria-checked",u?"true":"false")}}),this.listeners.bind(o,"click keyup",u=>{if(!(l.keyboardEvent(u)&&u.key!==" ")){switch(u.preventDefault(),u.stopPropagation(),o.checked=!0,t){case"language":this.currentTrack=Number(e);break;case"quality":this.quality=e;break;case"speed":this.speed=Number.parseFloat(e);break}d.showMenuPanel.call(this,"home",l.keyboardEvent(u))}},t,!1),d.bindMenuItemShortcuts.call(this,o,t),i.appendChild(o)},formatTime(e=0,i=!1){if(!l.number(e))return e;const t=ht(this.duration)>0;return ye(e,t,i)},updateTimeDisplay(e=null,i=0,t=!1){!l.element(e)||!l.number(i)||(e.textContent=d.formatTime(i,t))},updateVolume(){this.supported.ui&&(l.element(this.elements.inputs.volume)&&d.setRange.call(this,this.elements.inputs.volume,this.muted?0:this.volume),l.element(this.elements.buttons.mute)&&(this.elements.buttons.mute.pressed=this.muted||this.volume===0))},setRange(e,i=0){l.element(e)&&(e.value=i,d.updateRangeFill.call(this,e))},updateProgress(e){if(!this.supported.ui||!l.event(e))return;let i=0;const t=(s,a)=>{const n=l.number(a)?a:0,r=l.element(s)?s:this.elements.display.buffer;if(l.element(r)){r.value=n;const o=r.getElementsByTagName("span")[0];l.element(o)&&(o.childNodes[0].nodeValue=n)}};if(e)switch(e.type){case"timeupdate":case"seeking":case"seeked":i=ni(this.currentTime,this.duration),e.type==="timeupdate"&&d.setRange.call(this,this.elements.inputs.seek,i);break;case"playing":case"progress":t(this.elements.display.buffer,this.buffered*100);break}},updateRangeFill(e){const i=l.event(e)?e.target:e;if(!(!l.element(i)||i.getAttribute("type")!=="range")){if(X(i,this.config.selectors.inputs.seek)){i.setAttribute("aria-valuenow",this.currentTime);const t=d.formatTime(this.currentTime),s=d.formatTime(this.duration),a=O.get("seekLabel",this.config);i.setAttribute("aria-valuetext",a.replace("{currentTime}",t).replace("{duration}",s))}else if(X(i,this.config.selectors.inputs.volume)){const t=i.value*100;i.setAttribute("aria-valuenow",t),i.setAttribute("aria-valuetext",`${t.toFixed(1)}%`)}else i.setAttribute("aria-valuenow",i.value);!_.isWebKit&&!_.isIPadOS||i.style.setProperty("--value",`${i.value/i.max*100}%`)}},updateSeekTooltip(e){var i,t;if(!this.config.tooltips.seek||!l.element(this.elements.inputs.seek)||!l.element(this.elements.display.seekTooltip)||this.duration===0)return;const s=this.elements.display.seekTooltip,a=`${this.config.classNames.tooltip}--visible`,n=p=>S(s,a,p);if(this.touch){n(!1);return}let r=0;const o=this.elements.progress.getBoundingClientRect();if(l.event(e)){const p=e.pageX-e.clientX;r=100/o.width*(e.pageX-o.left-p)}else if(me(s,a))r=Number.parseFloat(s.style.left,10);else return;r<0?r=0:r>100&&(r=100);const c=this.duration/100*r;s.textContent=d.formatTime(c);const u=(i=this.config.markers)===null||i===void 0||(t=i.points)===null||t===void 0?void 0:t.find(({time:p})=>p===Math.round(c));u&&s.insertAdjacentHTML("afterbegin",`${u.label}<br>`),s.style.left=`${r}%`,l.event(e)&&["mouseenter","mouseleave"].includes(e.type)&&n(e.type==="mouseenter")},timeUpdate(e){const i=!l.element(this.elements.display.duration)&&this.config.invertTime;d.updateTimeDisplay.call(this,this.elements.display.currentTime,i?this.duration-this.currentTime:this.currentTime,i),!(e&&e.type==="timeupdate"&&this.media.seeking)&&d.updateProgress.call(this,e)},durationUpdate(){if(!this.supported.ui||!this.config.invertTime&&this.currentTime)return;if(this.duration>=2**32){Y(this.elements.display.currentTime,!0),Y(this.elements.progress,!0);return}l.element(this.elements.inputs.seek)&&this.elements.inputs.seek.setAttribute("aria-valuemax",this.duration);const e=l.element(this.elements.display.duration);!e&&this.config.displayDuration&&this.paused&&d.updateTimeDisplay.call(this,this.elements.display.currentTime,this.duration),e&&d.updateTimeDisplay.call(this,this.elements.display.duration,this.duration),this.config.markers.enabled&&d.setMarkers.call(this),d.updateSeekTooltip.call(this)},toggleMenuButton(e,i){Y(this.elements.settings.buttons[e],!i)},updateSetting(e,i,t){const s=this.elements.settings.panels[e];let a=null,n=i;if(e==="captions")a=this.currentTrack;else{if(a=l.empty(t)?this[e]:t,l.empty(a)&&(a=this.config[e].default),!l.empty(this.options[e])&&!this.options[e].includes(a)){this.debug.warn(`Unsupported value of '${a}' for ${e}`);return}if(!this.config[e].options.includes(a)){this.debug.warn(`Disabled value of '${a}' for ${e}`);return}}if(l.element(n)||(n=s&&s.querySelector('[role="menu"]')),!l.element(n))return;const r=this.elements.settings.buttons[e].querySelector(`.${this.config.classNames.menu.value}`);r.innerHTML=d.getLabel.call(this,e,a);const o=n&&n.querySelector(`[value="${a}"]`);l.element(o)&&(o.checked=!0)},getLabel(e,i){switch(e){case"speed":return i===1?O.get("normal",this.config):`${i}×`;case"quality":if(l.number(i)){const t=O.get(`qualityLabel.${i}`,this.config);return t.length?t:`${i}p`}return ct(i);case"captions":return A.getLabel.call(this);default:return null}},setQualityMenu(e){if(!l.element(this.elements.settings.panels.quality))return;const i="quality",t=this.elements.settings.panels.quality.querySelector('[role="menu"]');l.array(e)&&(this.options.quality=Ae(e).filter(n=>this.config.quality.options.includes(n)));const s=!l.empty(this.options.quality)&&this.options.quality.length>1;if(d.toggleMenuButton.call(this,i,s),ce(t),d.checkMenu.call(this),!s)return;const a=n=>{const r=O.get(`qualityBadge.${n}`,this.config);return r.length?d.createBadge.call(this,r):null};this.options.quality.sort((n,r)=>{const o=this.config.quality.options;return o.indexOf(n)>o.indexOf(r)?1:-1}).forEach(n=>{d.createMenuItem.call(this,{value:n,list:t,type:i,title:d.getLabel.call(this,"quality",n),badge:a(n)})}),d.updateSetting.call(this,i,t)},setCaptionsMenu(){if(!l.element(this.elements.settings.panels.captions))return;const e="captions",i=this.elements.settings.panels.captions.querySelector('[role="menu"]'),t=A.getTracks.call(this),s=!!t.length;if(d.toggleMenuButton.call(this,e,s),ce(i),d.checkMenu.call(this),!s)return;const a=t.map((n,r)=>({value:r,checked:this.captions.toggled&&this.currentTrack===r,title:A.getLabel.call(this,n),badge:n.language&&d.createBadge.call(this,n.language.toUpperCase()),list:i,type:"language"}));a.unshift({value:-1,checked:!this.captions.toggled,title:O.get("disabled",this.config),list:i,type:"language"}),a.forEach(d.createMenuItem.bind(this)),d.updateSetting.call(this,e,i)},setSpeedMenu(){if(!l.element(this.elements.settings.panels.speed))return;const e="speed",i=this.elements.settings.panels.speed.querySelector('[role="menu"]');this.options.speed=this.options.speed.filter(s=>s>=this.minimumSpeed&&s<=this.maximumSpeed);const t=!l.empty(this.options.speed)&&this.options.speed.length>1;d.toggleMenuButton.call(this,e,t),ce(i),d.checkMenu.call(this),t&&(this.options.speed.forEach(s=>{d.createMenuItem.call(this,{value:s,list:i,type:e,title:d.getLabel.call(this,"speed",s)})}),d.updateSetting.call(this,e,i))},checkMenu(){const{buttons:e}=this.elements.settings,i=!l.empty(e)&&Object.values(e).some(t=>!t.hidden);Y(this.elements.settings.menu,!i)},focusFirstMenuItem(e,i=!1){if(this.elements.settings.popup.hidden)return;let t=e;l.element(t)||(t=Object.values(this.elements.settings.panels).find(a=>!a.hidden));const s=t.querySelector('[role^="menuitem"]');be.call(this,s,i)},toggleMenu(e){const{popup:i}=this.elements.settings,t=this.elements.buttons.settings;if(!l.element(i)||!l.element(t))return;const{hidden:s}=i;let a=s;if(l.boolean(e))a=e;else if(l.keyboardEvent(e)&&e.key==="Escape")a=!1;else if(l.event(e)){const n=l.function(e.composedPath)?e.composedPath()[0]:e.target,r=i.contains(n);if(r||!r&&e.target!==t&&a)return}t.setAttribute("aria-expanded",a),Y(i,!a),S(this.elements.container,this.config.classNames.menu.open,a),a&&l.keyboardEvent(e)?d.focusFirstMenuItem.call(this,null,!0):!a&&!s&&be.call(this,t,l.keyboardEvent(e))},getMenuSize(e){const i=e.cloneNode(!0);i.style.position="absolute",i.style.opacity=0,i.removeAttribute("hidden"),e.parentNode.appendChild(i);const t=i.scrollWidth,s=i.scrollHeight;return U(i),{width:t,height:s}},showMenuPanel(e="",i=!1){const t=this.elements.container.querySelector(`#plyr-settings-${this.id}-${e}`);if(!l.element(t))return;const s=t.parentNode,a=Array.from(s.children).find(n=>!n.hidden);if(L.transitions&&!L.reducedMotion){s.style.width=`${a.scrollWidth}px`,s.style.height=`${a.scrollHeight}px`;const n=d.getMenuSize.call(this,t),r=o=>{o.target!==s||!["width","height"].includes(o.propertyName)||(s.style.width="",s.style.height="",fe.call(this,s,Te,r))};C.call(this,s,Te,r),s.style.width=`${n.width}px`,s.style.height=`${n.height}px`}Y(a,!0),Y(t,!1),d.focusFirstMenuItem.call(this,t,i)},setDownloadUrl(){const e=this.elements.buttons.download;l.element(e)&&e.setAttribute("href",this.download)},create(e){const{bindMenuItemShortcuts:i,createButton:t,createProgress:s,createRange:a,createTime:n,setQualityMenu:r,setSpeedMenu:o,showMenuPanel:c}=d;this.elements.controls=null,l.array(this.config.controls)&&this.config.controls.includes("play-large")&&this.elements.container.appendChild(t.call(this,"play-large"));const u=b("div",V(this.config.selectors.controls.wrapper));this.elements.controls=u;const p={class:"plyr__controls__item"};return Ae(l.array(this.config.controls)?this.config.controls:[]).forEach(y=>{if(y==="restart"&&u.appendChild(t.call(this,"restart",p)),y==="rewind"&&u.appendChild(t.call(this,"rewind",p)),y==="play"&&u.appendChild(t.call(this,"play",p)),y==="fast-forward"&&u.appendChild(t.call(this,"fast-forward",p)),y==="progress"){const h=b("div",{class:`${p.class} plyr__progress__container`}),f=b("div",V(this.config.selectors.progress));if(f.appendChild(a.call(this,"seek",{id:`plyr-seek-${e.id}`})),f.appendChild(s.call(this,"buffer")),this.config.tooltips.seek){const T=b("span",{class:this.config.classNames.tooltip},"00:00");f.appendChild(T),this.elements.display.seekTooltip=T}this.elements.progress=f,h.appendChild(this.elements.progress),u.appendChild(h)}if(y==="current-time"&&u.appendChild(n.call(this,"currentTime",p)),y==="duration"&&u.appendChild(n.call(this,"duration",p)),y==="mute"||y==="volume"){let{volume:h}=this.elements;if((!l.element(h)||!u.contains(h))&&(h=b("div",N({},p,{class:`${p.class} plyr__volume`.trim()})),this.elements.volume=h,u.appendChild(h)),y==="mute"&&h.appendChild(t.call(this,"mute")),y==="volume"&&!_.isIos&&!_.isIPadOS){const f={max:1,step:.05,value:this.config.volume};h.appendChild(a.call(this,"volume",N(f,{id:`plyr-volume-${e.id}`})))}}if(y==="captions"&&u.appendChild(t.call(this,"captions",p)),y==="settings"&&!l.empty(this.config.settings)){const h=b("div",N({},p,{class:`${p.class} plyr__menu`.trim(),hidden:""}));h.appendChild(t.call(this,"settings",{"aria-haspopup":!0,"aria-controls":`plyr-settings-${e.id}`,"aria-expanded":!1}));const f=b("div",{class:"plyr__menu__container",id:`plyr-settings-${e.id}`,hidden:""}),T=b("div"),w=b("div",{id:`plyr-settings-${e.id}-home`}),I=b("div",{role:"menu"});w.appendChild(I),T.appendChild(w),this.elements.settings.panels.home=w,this.config.settings.forEach(M=>{const g=b("button",N(V(this.config.selectors.buttons.settings),{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--forward`,role:"menuitem","aria-haspopup":!0,hidden:""}));i.call(this,g,M),C.call(this,g,"click",()=>{c.call(this,M,!1)});const k=b("span",null,O.get(M,this.config)),P=b("span",{class:this.config.classNames.menu.value});P.innerHTML=e[M],k.appendChild(P),g.appendChild(k),I.appendChild(g);const j=b("div",{id:`plyr-settings-${e.id}-${M}`,hidden:""}),q=b("button",{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--back`});q.appendChild(b("span",{"aria-hidden":!0},O.get(M,this.config))),q.appendChild(b("span",{class:this.config.classNames.hidden},O.get("menuBack",this.config))),C.call(this,j,"keydown",D=>{D.key==="ArrowLeft"&&(D.preventDefault(),D.stopPropagation(),c.call(this,"home",!0))},!1),C.call(this,q,"click",()=>{c.call(this,"home",!1)}),j.appendChild(q),j.appendChild(b("div",{role:"menu"})),T.appendChild(j),this.elements.settings.buttons[M]=g,this.elements.settings.panels[M]=j}),f.appendChild(T),h.appendChild(f),u.appendChild(h),this.elements.settings.popup=f,this.elements.settings.menu=h}if(y==="pip"&&L.pip&&u.appendChild(t.call(this,"pip",p)),y==="airplay"&&L.airplay&&u.appendChild(t.call(this,"airplay",p)),y==="download"){const h=N({},p,{element:"a",href:this.download,target:"_blank"});this.isHTML5&&(h.download="");const{download:f}=this.config.urls;!l.url(f)&&this.isEmbed&&N(h,{icon:`logo-${this.provider}`,label:this.provider}),u.appendChild(t.call(this,"download",h))}y==="fullscreen"&&u.appendChild(t.call(this,"fullscreen",p))}),this.isHTML5&&r.call(this,W.getQualityOptions.call(this)),o.call(this),u},inject(){if(this.config.loadSprite){const r=d.getIconUrl.call(this);r.cors&&ut(r.url,"sprite-plyr")}this.id=Math.floor(Math.random()*1e4);let e=null;this.elements.controls=null;const i={id:this.id,seektime:this.config.seekTime,title:this.config.title};let t=!0;l.function(this.config.controls)&&(this.config.controls=this.config.controls.call(this,i)),this.config.controls||(this.config.controls=[]),l.element(this.config.controls)||l.string(this.config.controls)?e=this.config.controls:(e=d.create.call(this,{id:this.id,seektime:this.config.seekTime,speed:this.speed,quality:this.quality,captions:A.getLabel.call(this)}),t=!1);const s=r=>{let o=r;return Object.entries(i).forEach(([c,u])=>{o=Z(o,`{${c}}`,u)}),o};t&&l.string(this.config.controls)&&(e=s(e));let a;l.string(this.config.selectors.controls.container)&&(a=document.querySelector(this.config.selectors.controls.container)),l.element(a)||(a=this.elements.container);const n=l.element(e)?"insertAdjacentElement":"insertAdjacentHTML";if(a[n]("afterbegin",e),l.element(this.elements.controls)||d.findElements.call(this),!l.empty(this.elements.buttons)){const r=o=>{const c=this.config.classNames.controlPressed;o.setAttribute("aria-pressed","false"),Object.defineProperty(o,"pressed",{configurable:!0,enumerable:!0,get(){return me(o,c)},set(u=!1){S(o,c,u),o.setAttribute("aria-pressed",u?"true":"false")}})};Object.values(this.elements.buttons).filter(Boolean).forEach(o=>{l.array(o)||l.nodeList(o)?Array.from(o).filter(Boolean).forEach(r):r(o)})}if(_.isEdge&&it(a),this.config.tooltips.controls){const{classNames:r,selectors:o}=this.config,c=`${o.controls.wrapper} ${o.labels} .${r.hidden}`,u=ee.call(this,c);Array.from(u).forEach(p=>{S(p,this.config.classNames.hidden,!1),S(p,this.config.classNames.tooltip,!0)})}},setMediaMetadata(){try{"mediaSession"in navigator&&(navigator.mediaSession.metadata=new window.MediaMetadata({title:this.config.mediaMetadata.title,artist:this.config.mediaMetadata.artist,album:this.config.mediaMetadata.album,artwork:this.config.mediaMetadata.artwork}))}catch{}},setMarkers(){var e,i;if(!this.duration||this.elements.markers)return;const t=(e=this.config.markers)===null||e===void 0||(i=e.points)===null||i===void 0?void 0:i.filter(({time:c})=>c>0&&c<this.duration);if(!(t!=null&&t.length))return;const s=document.createDocumentFragment(),a=document.createDocumentFragment();let n=null;const r=`${this.config.classNames.tooltip}--visible`,o=c=>S(n,r,c);t.forEach(c=>{const u=b("span",{class:this.config.classNames.marker},""),p=`${c.time/this.duration*100}%`;n&&(u.addEventListener("mouseenter",()=>{c.label||(n.style.left=p,n.innerHTML=c.label,o(!0))}),u.addEventListener("mouseleave",()=>{o(!1)})),u.addEventListener("click",()=>{this.currentTime=c.time}),u.style.left=p,a.appendChild(u)}),s.appendChild(a),this.config.tooltips.seek||(n=b("span",{class:this.config.classNames.tooltip},""),s.appendChild(n)),this.elements.markers={points:a,tip:n},this.elements.progress.appendChild(s)}};function dt(e,i=!0){let t=e;if(i){const s=document.createElement("a");s.href=t,t=s.href}try{return new URL(t)}catch{return null}}function mt(e){const i=new URLSearchParams;return l.object(e)&&Object.entries(e).forEach(([t,s])=>{i.set(t,s)}),i}const A={setup(){if(!this.supported.ui)return;if(!this.isVideo||this.isYouTube||this.isHTML5&&!L.textTracks){l.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&d.setCaptionsMenu.call(this);return}if(l.element(this.elements.captions)||(this.elements.captions=b("div",V(this.config.selectors.captions)),this.elements.captions.setAttribute("dir","auto"),Wt(this.elements.captions,this.elements.wrapper)),_.isIE&&window.URL){const a=this.media.querySelectorAll("track");Array.from(a).forEach(n=>{const r=n.getAttribute("src"),o=dt(r);o!==null&&o.hostname!==window.location.href.hostname&&["http:","https:"].includes(o.protocol)&&le(r,"blob").then(c=>{n.setAttribute("src",window.URL.createObjectURL(c))}).catch(()=>{U(n)})})}const e=navigator.languages||[navigator.language||navigator.userLanguage||"en"],i=Ae(e.map(a=>a.split("-")[0]));let t=(this.storage.get("language")||this.captions.language||this.config.captions.language||"auto").toLowerCase();t==="auto"&&([t]=i);let s=this.storage.get("captions")||this.captions.active;if(l.boolean(s)||({active:s}=this.config.captions),Object.assign(this.captions,{toggled:!1,active:s,language:t,languages:i}),this.isHTML5){const a=this.config.captions.update?"addtrack removetrack":"removetrack";C.call(this,this.media.textTracks,a,A.update.bind(this))}setTimeout(A.update.bind(this),0)},update(){const e=A.getTracks.call(this,!0),{active:i,language:t,meta:s,currentTrackNode:a}=this.captions,n=!!e.find(r=>r.language===t);this.isHTML5&&this.isVideo&&e.filter(r=>!s.get(r)).forEach(r=>{this.debug.log("Track added",r),s.set(r,{default:r.mode==="showing"}),r.mode==="showing"&&(r.mode="hidden"),C.call(this,r,"cuechange",()=>A.updateCues.call(this))}),(n&&this.language!==t||!e.includes(a))&&(A.setLanguage.call(this,t),A.toggle.call(this,i&&n)),this.elements&&S(this.elements.container,this.config.classNames.captions.enabled,!l.empty(e)),l.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&d.setCaptionsMenu.call(this)},toggle(e,i=!0){if(!this.supported.ui)return;const{toggled:t}=this.captions,s=this.config.classNames.captions.active,a=l.nullOrUndefined(e)?!t:e;if(a!==t){if(i||(this.captions.active=a,this.storage.set({captions:a})),!this.language&&a&&!i){const n=A.getTracks.call(this),r=A.findTrack.call(this,[this.captions.language,...this.captions.languages],!0);this.captions.language=r.language,A.set.call(this,n.indexOf(r));return}this.elements.buttons.captions&&(this.elements.buttons.captions.pressed=a),S(this.elements.container,s,a),this.captions.toggled=a,d.updateSetting.call(this,"captions"),v.call(this,this.media,a?"captionsenabled":"captionsdisabled")}setTimeout(()=>{a&&this.captions.toggled&&(this.captions.currentTrackNode.mode="hidden")})},set(e,i=!0){const t=A.getTracks.call(this);if(e===-1){A.toggle.call(this,!1,i);return}if(!l.number(e)){this.debug.warn("Invalid caption argument",e);return}if(!(e in t)){this.debug.warn("Track not found",e);return}if(this.captions.currentTrack!==e){this.captions.currentTrack=e;const s=t[e],{language:a}=s||{};this.captions.currentTrackNode=s,d.updateSetting.call(this,"captions"),i||(this.captions.language=a,this.storage.set({language:a})),this.isVimeo&&this.embed.enableTextTrack(a,null,!1),v.call(this,this.media,"languagechange")}A.toggle.call(this,!0,i),this.isHTML5&&this.isVideo&&A.updateCues.call(this)},setLanguage(e,i=!0){if(!l.string(e)){this.debug.warn("Invalid language argument",e);return}const t=e.toLowerCase();this.captions.language=t;const s=A.getTracks.call(this),a=A.findTrack.call(this,[t]);A.set.call(this,s.indexOf(a),i)},getTracks(e=!1){return Array.from((this.media||{}).textTracks||[]).filter(i=>!this.isHTML5||e||this.captions.meta.has(i)).filter(i=>["captions","subtitles"].includes(i.kind))},findTrack(e,i=!1){const t=A.getTracks.call(this),s=r=>Number((this.captions.meta.get(r)||{}).default),a=Array.from(t).sort((r,o)=>s(o)-s(r));let n;return e.every(r=>(n=a.find(o=>o.language===r),!n)),n||(i?a[0]:void 0)},getCurrentTrack(){return A.getTracks.call(this)[this.currentTrack]},getLabel(e){let i=e;return!l.track(i)&&L.textTracks&&this.captions.toggled&&(i=A.getCurrentTrack.call(this)),l.track(i)?l.empty(i.label)?l.empty(i.language)?O.get("enabled",this.config):e.language.toUpperCase():i.label:O.get("disabled",this.config)},updateCues(e){if(!this.supported.ui)return;if(!l.element(this.elements.captions)){this.debug.warn("No captions element to render to");return}if(!l.nullOrUndefined(e)&&!Array.isArray(e)){this.debug.warn("updateCues: Invalid input",e);return}let i=e;if(!i){const s=A.getCurrentTrack.call(this);i=Array.from((s||{}).activeCues||[]).map(a=>a.getCueAsHTML()).map(oi)}const t=i.map(s=>s.trim()).join(`
|
|
2
|
+
`);if(t!==this.elements.captions.innerHTML){ce(this.elements.captions);const s=b("span",V(this.config.selectors.caption));s.innerHTML=t,this.elements.captions.appendChild(s),v.call(this,this.media,"cuechange")}}},pt={enabled:!0,title:"",debug:!1,autoplay:!1,autopause:!0,playsinline:!0,seekTime:10,volume:1,muted:!1,duration:null,displayDuration:!0,invertTime:!0,toggleInvert:!0,ratio:null,clickToPlay:!0,hideControls:!0,resetOnEnd:!1,disableContextMenu:!0,loadSprite:!0,iconPrefix:"plyr",iconUrl:"https://cdn.plyr.io/3.8.4/plyr.svg",blankVideo:"https://cdn.plyr.io/static/blank.mp4",quality:{default:576,options:[4320,2880,2160,1440,1080,720,576,480,360,240],forced:!1,onChange:null},loop:{active:!1},speed:{selected:1,options:[.5,.75,1,1.25,1.5,1.75,2,4]},keyboard:{focused:!0,global:!1},tooltips:{controls:!1,seek:!0},captions:{active:!1,language:"auto",update:!1},fullscreen:{enabled:!0,fallback:!0,iosNative:!1},storage:{enabled:!0,key:"plyr"},controls:["play-large","play","progress","current-time","mute","volume","captions","settings","pip","airplay","fullscreen"],settings:["captions","quality","speed"],i18n:{restart:"Restart",rewind:"Rewind {seektime}s",play:"Play",pause:"Pause",fastForward:"Forward {seektime}s",seek:"Seek",seekLabel:"{currentTime} of {duration}",played:"Played",buffered:"Buffered",currentTime:"Current time",duration:"Duration",volume:"Volume",mute:"Mute",unmute:"Unmute",enableCaptions:"Enable captions",disableCaptions:"Disable captions",download:"Download",enterFullscreen:"Enter fullscreen",exitFullscreen:"Exit fullscreen",frameTitle:"Player for {title}",captions:"Captions",settings:"Settings",pip:"PIP",menuBack:"Go back to previous menu",speed:"Speed",normal:"Normal",quality:"Quality",loop:"Loop",start:"Start",end:"End",all:"All",reset:"Reset",disabled:"Disabled",enabled:"Enabled",advertisement:"Ad",qualityBadge:{2160:"4K",1440:"HD",1080:"HD",720:"HD",576:"SD",480:"SD"}},urls:{download:null,vimeo:{sdk:"https://player.vimeo.com/api/player.js",iframe:"https://player.vimeo.com/video/{0}?{1}",api:"https://vimeo.com/api/oembed.json?url={0}"},youtube:{sdk:"https://www.youtube.com/iframe_api",api:"https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}"},googleIMA:{sdk:"https://imasdk.googleapis.com/js/sdkloader/ima3.js"}},listeners:{seek:null,play:null,pause:null,restart:null,rewind:null,fastForward:null,mute:null,volume:null,captions:null,download:null,fullscreen:null,pip:null,airplay:null,speed:null,quality:null,loop:null,language:null},events:["ended","progress","stalled","playing","waiting","canplay","canplaythrough","loadstart","loadeddata","loadedmetadata","timeupdate","volumechange","play","pause","error","seeking","seeked","emptied","ratechange","cuechange","download","enterfullscreen","exitfullscreen","captionsenabled","captionsdisabled","languagechange","controlshidden","controlsshown","ready","statechange","qualitychange","adsloaded","adscontentpause","adscontentresume","adstarted","adsmidpoint","adscomplete","adsallcomplete","adsimpression","adsclick"],selectors:{editable:"input, textarea, select, [contenteditable]",container:".plyr",controls:{container:null,wrapper:".plyr__controls"},labels:"[data-plyr]",buttons:{play:'[data-plyr="play"]',pause:'[data-plyr="pause"]',restart:'[data-plyr="restart"]',rewind:'[data-plyr="rewind"]',fastForward:'[data-plyr="fast-forward"]',mute:'[data-plyr="mute"]',captions:'[data-plyr="captions"]',download:'[data-plyr="download"]',fullscreen:'[data-plyr="fullscreen"]',pip:'[data-plyr="pip"]',airplay:'[data-plyr="airplay"]',settings:'[data-plyr="settings"]',loop:'[data-plyr="loop"]'},inputs:{seek:'[data-plyr="seek"]',volume:'[data-plyr="volume"]',speed:'[data-plyr="speed"]',language:'[data-plyr="language"]',quality:'[data-plyr="quality"]'},display:{currentTime:".plyr__time--current",duration:".plyr__time--duration",buffer:".plyr__progress__buffer",loop:".plyr__progress__loop",volume:".plyr__volume--display"},progress:".plyr__progress",captions:".plyr__captions",caption:".plyr__caption"},classNames:{type:"plyr--{0}",provider:"plyr--{0}",video:"plyr__video-wrapper",embed:"plyr__video-embed",videoFixedRatio:"plyr__video-wrapper--fixed-ratio",embedContainer:"plyr__video-embed__container",poster:"plyr__poster",posterEnabled:"plyr__poster-enabled",ads:"plyr__ads",control:"plyr__control",controlPressed:"plyr__control--pressed",playing:"plyr--playing",paused:"plyr--paused",stopped:"plyr--stopped",loading:"plyr--loading",hover:"plyr--hover",tooltip:"plyr__tooltip",cues:"plyr__cues",marker:"plyr__progress__marker",hidden:"plyr__sr-only",hideControls:"plyr--hide-controls",isTouch:"plyr--is-touch",uiSupported:"plyr--full-ui",noTransition:"plyr--no-transition",display:{time:"plyr__time"},menu:{value:"plyr__menu__value",badge:"plyr__badge",open:"plyr--menu-open"},captions:{enabled:"plyr--captions-enabled",active:"plyr--captions-active"},fullscreen:{enabled:"plyr--fullscreen-enabled",fallback:"plyr--fullscreen-fallback"},pip:{supported:"plyr--pip-supported",active:"plyr--pip-active"},airplay:{supported:"plyr--airplay-supported",active:"plyr--airplay-active"},previewThumbnails:{thumbContainer:"plyr__preview-thumb",thumbContainerShown:"plyr__preview-thumb--is-shown",imageContainer:"plyr__preview-thumb__image-container",timeContainer:"plyr__preview-thumb__time-container",scrubbingContainer:"plyr__preview-scrubbing",scrubbingContainerShown:"plyr__preview-scrubbing--is-shown"}},attributes:{embed:{provider:"data-plyr-provider",id:"data-plyr-embed-id",hash:"data-plyr-embed-hash"}},ads:{enabled:!1,publisherId:"",tagUrl:""},previewThumbnails:{enabled:!1,src:"",withCredentials:!1},vimeo:{byline:!1,portrait:!1,title:!1,speed:!0,transparent:!1,customControls:!0,referrerPolicy:null,premium:!1},youtube:{rel:0,showinfo:0,iv_load_policy:3,modestbranding:1,customControls:!0,noCookie:!1},mediaMetadata:{title:"",artist:"",album:"",artwork:[]},markers:{enabled:!1,points:[]}},ve={active:"picture-in-picture",inactive:"inline"},z={html5:"html5",youtube:"youtube",vimeo:"vimeo"},we={audio:"audio",video:"video"};function hi(e){return/^(?:https?:\/\/)?(?:www\.)?(?:youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(e)?z.youtube:/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(e)?z.vimeo:null}function ke(){}class di{constructor(i=!1){this.enabled=window.console&&i,this.enabled&&this.log("Debugging enabled")}get log(){return this.enabled?Function.prototype.bind.call(console.log,console):ke}get warn(){return this.enabled?Function.prototype.bind.call(console.warn,console):ke}get error(){return this.enabled?Function.prototype.bind.call(console.error,console):ke}}class R{constructor(i){m(this,"onChange",()=>{if(!this.supported)return;const t=this.player.elements.buttons.fullscreen;l.element(t)&&(t.pressed=this.active);const s=this.target===this.player.media?this.target:this.player.elements.container;v.call(this.player,s,this.active?"enterfullscreen":"exitfullscreen",!0)}),m(this,"toggleFallback",(t=!1)=>{if(t){var s,a;this.scrollPosition={x:(s=window.scrollX)!==null&&s!==void 0?s:0,y:(a=window.scrollY)!==null&&a!==void 0?a:0}}else window.scrollTo(this.scrollPosition.x,this.scrollPosition.y);if(document.body.style.overflow=t?"hidden":"",S(this.target,this.player.config.classNames.fullscreen.fallback,t),_.isIos){let n=document.head.querySelector('meta[name="viewport"]');const r="viewport-fit=cover";n||(n=document.createElement("meta"),n.setAttribute("name","viewport"));const o=l.string(n.content)&&n.content.includes(r);t?(this.cleanupViewport=!o,o||(n.content+=`,${r}`)):this.cleanupViewport&&(n.content=n.content.split(",").filter(c=>c.trim()!==r).join(","))}this.onChange()}),m(this,"trapFocus",t=>{if(_.isIos||_.isIPadOS||!this.active||t.key!=="Tab")return;const s=document.activeElement,a=ee.call(this.player,"a[href], button:not(:disabled), input:not(:disabled), [tabindex]"),[n]=a,r=a[a.length-1];s===r&&!t.shiftKey?(n.focus(),t.preventDefault()):s===n&&t.shiftKey&&(r.focus(),t.preventDefault())}),m(this,"update",()=>{if(this.supported){let t;this.forceFallback?t="Fallback (forced)":R.nativeSupported?t="Native":t="Fallback",this.player.debug.log(`${t} fullscreen enabled`)}else this.player.debug.log("Fullscreen not supported and fallback disabled");S(this.player.elements.container,this.player.config.classNames.fullscreen.enabled,this.supported)}),m(this,"enter",()=>{this.supported&&(_.isIos&&this.player.config.fullscreen.iosNative?this.player.isVimeo?this.player.embed.requestFullscreen():this.target.webkitEnterFullscreen():!R.nativeSupported||this.forceFallback?this.toggleFallback(!0):this.prefix?l.empty(this.prefix)||this.target[`${this.prefix}Request${this.property}`]():this.target.requestFullscreen({navigationUI:"hide"}))}),m(this,"exit",()=>{if(this.supported){if(_.isIos&&this.player.config.fullscreen.iosNative)this.player.isVimeo?this.player.embed.exitFullscreen():this.target.webkitEnterFullscreen(),F(this.player.play());else if(!R.nativeSupported||this.forceFallback)this.toggleFallback(!1);else if(!this.prefix)(document.cancelFullScreen||document.exitFullscreen).call(document);else if(!l.empty(this.prefix)){const t=this.prefix==="moz"?"Cancel":"Exit";document[`${this.prefix}${t}${this.property}`]()}}}),m(this,"toggle",()=>{this.active?this.exit():this.enter()}),this.player=i,this.prefix=R.prefix,this.property=R.property,this.scrollPosition={x:0,y:0},this.forceFallback=i.config.fullscreen.fallback==="force",this.player.elements.fullscreen=i.config.fullscreen.container&&Kt(this.player.elements.container,i.config.fullscreen.container),C.call(this.player,document,this.prefix==="ms"?"MSFullscreenChange":`${this.prefix}fullscreenchange`,()=>{this.onChange()}),C.call(this.player,this.player.elements.container,"dblclick",t=>{l.element(this.player.elements.controls)&&this.player.elements.controls.contains(t.target)||this.player.listeners.proxy(t,this.toggle,"fullscreen")}),C.call(this,this.player.elements.container,"keydown",t=>this.trapFocus(t)),this.update()}static get nativeSupported(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)}get useNative(){return R.nativeSupported&&!this.forceFallback}static get prefix(){if(l.function(document.exitFullscreen))return"";let i="";return["webkit","moz","ms"].some(t=>l.function(document[`${t}ExitFullscreen`])||l.function(document[`${t}CancelFullScreen`])?(i=t,!0):!1),i}static get property(){return this.prefix==="moz"?"FullScreen":"Fullscreen"}get supported(){return[this.player.config.fullscreen.enabled,this.player.isVideo,R.nativeSupported||this.player.config.fullscreen.fallback,!this.player.isYouTube||R.nativeSupported||!_.isIos||this.player.config.playsinline&&!this.player.config.fullscreen.iosNative].every(Boolean)}get active(){if(!this.supported)return!1;if(!R.nativeSupported||this.forceFallback)return me(this.target,this.player.config.classNames.fullscreen.fallback);const i=this.prefix?this.target.getRootNode()[`${this.prefix}${this.property}Element`]:this.target.getRootNode().fullscreenElement;return i&&i.shadowRoot?i===this.target.getRootNode().host:i===this.target}get target(){var i;return _.isIos&&this.player.config.fullscreen.iosNative?this.player.media:(i=this.player.elements.fullscreen)!==null&&i!==void 0?i:this.player.elements.container}}function ue(e,i=1){return new Promise((t,s)=>{const a=new Image,n=()=>{delete a.onload,delete a.onerror,(a.naturalWidth>=i?t:s)(a)};Object.assign(a,{onload:n,onerror:n,src:e})})}const E={addStyleHook(){S(this.elements.container,this.config.selectors.container.replace(".",""),!0),S(this.elements.container,this.config.classNames.uiSupported,this.supported.ui)},toggleNativeControls(e=!1){e&&this.isHTML5?this.media.setAttribute("controls",""):this.media.removeAttribute("controls")},build(){if(this.listeners.media(),!this.supported.ui){this.debug.warn(`Basic support only for ${this.provider} ${this.type}`),E.toggleNativeControls.call(this,!0);return}l.element(this.elements.controls)||(d.inject.call(this),this.listeners.controls()),E.toggleNativeControls.call(this),this.isHTML5&&A.setup.call(this),this.volume=null,this.muted=null,this.loop=null,this.quality=null,this.speed=null,d.updateVolume.call(this),d.timeUpdate.call(this),d.durationUpdate.call(this),E.checkPlaying.call(this),S(this.elements.container,this.config.classNames.pip.supported,L.pip&&this.isHTML5&&this.isVideo),S(this.elements.container,this.config.classNames.airplay.supported,L.airplay&&this.isHTML5),S(this.elements.container,this.config.classNames.isTouch,this.touch),this.ready=!0,setTimeout(()=>{v.call(this,this.media,"ready")},0),E.setTitle.call(this),this.poster&&E.setPoster.call(this,this.poster,!1).catch(()=>{}),this.config.duration&&d.durationUpdate.call(this),this.config.mediaMetadata&&d.setMediaMetadata.call(this)},setTitle(){let e=O.get("play",this.config);if(l.string(this.config.title)&&!l.empty(this.config.title)&&(e+=`, ${this.config.title}`),Array.from(this.elements.buttons.play||[]).forEach(i=>{i.setAttribute("aria-label",e)}),this.isEmbed){const i=$.call(this,"iframe");if(!l.element(i))return;const t=l.empty(this.config.title)?"video":this.config.title,s=O.get("frameTitle",this.config);i.setAttribute("title",s.replace("{title}",t))}},togglePoster(e){S(this.elements.container,this.config.classNames.posterEnabled,e)},setPoster(e,i=!0){return i&&this.poster?Promise.reject(new Error("Poster already set")):(this.media.setAttribute("data-poster",e),this.elements.poster.removeAttribute("hidden"),Qt.call(this).then(()=>ue(e)).catch(t=>{throw e===this.poster&&E.togglePoster.call(this,!1),t}).then(()=>{if(e!==this.poster)throw new Error("setPoster cancelled by later call to setPoster")}).then(()=>(Object.assign(this.elements.poster.style,{backgroundImage:`url('${e}')`,backgroundSize:""}),E.togglePoster.call(this,!0),e)))},checkPlaying(e){S(this.elements.container,this.config.classNames.playing,this.playing),S(this.elements.container,this.config.classNames.paused,this.paused),S(this.elements.container,this.config.classNames.stopped,this.stopped),Array.from(this.elements.buttons.play||[]).forEach(i=>{Object.assign(i,{pressed:this.playing}),i.setAttribute("aria-label",O.get(this.playing?"pause":"play",this.config))}),!(l.event(e)&&e.type==="timeupdate")&&E.toggleControls.call(this)},checkLoading(e){this.loading=["stalled","waiting"].includes(e.type),clearTimeout(this.timers.loading),this.timers.loading=setTimeout(()=>{S(this.elements.container,this.config.classNames.loading,this.loading),E.toggleControls.call(this)},this.loading?250:0)},toggleControls(e){const{controls:i}=this.elements;if(i&&this.config.hideControls){const t=this.touch&&this.lastSeekTime+2e3>Date.now();this.toggleControls(!!(e||this.loading||this.paused||i.pressed||i.hover||t))}},migrateStyles(){Object.values({...this.media.style}).filter(e=>!l.empty(e)&&l.string(e)&&e.startsWith("--plyr")).forEach(e=>{this.elements.container.style.setProperty(e,this.media.style.getPropertyValue(e)),this.media.style.removeProperty(e)}),l.empty(this.media.style)&&this.media.removeAttribute("style")}};class mi{constructor(i){m(this,"firstTouch",()=>{const{player:t}=this,{elements:s}=t;t.touch=!0,S(s.container,t.config.classNames.isTouch,!0)}),m(this,"global",(t=!0)=>{const{player:s}=this;s.config.keyboard.global&&te.call(s,window,"keydown keyup",this.handleKey,t,!1),te.call(s,document.body,"click",this.toggleMenu,t),Ie.call(s,document.body,"touchstart",this.firstTouch)}),m(this,"container",()=>{const{player:t}=this,{config:s,elements:a,timers:n}=t;!s.keyboard.global&&s.keyboard.focused&&C.call(t,a.container,"keydown keyup",this.handleKey,!1),C.call(t,a.container,"mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen",c=>{const{controls:u}=a;u&&c.type==="enterfullscreen"&&(u.pressed=!1,u.hover=!1);const p=["touchstart","touchmove","mousemove"].includes(c.type);let y=0;p&&(E.toggleControls.call(t,!0),y=t.touch?3e3:2e3),clearTimeout(n.controls),n.controls=setTimeout(()=>E.toggleControls.call(t,!1),y)});const r=()=>{if(!t.isVimeo||t.config.vimeo.premium)return;const c=a.wrapper,{active:u}=t.fullscreen,[p,y]=$e.call(t),h=lt(`aspect-ratio: ${p} / ${y}`);if(!u){h?(c.style.width=null,c.style.height=null):(c.style.maxWidth=null,c.style.margin=null);return}const[f,T]=Jt(),w=f/T>p/y;h?(c.style.width=w?"auto":"100%",c.style.height=w?"100%":"auto"):(c.style.maxWidth=w?`${T/y*p}px`:null,c.style.margin=w?"0 auto":null)},o=()=>{clearTimeout(n.resized),n.resized=setTimeout(r,50)};C.call(t,a.container,"enterfullscreen exitfullscreen",c=>{const{target:u}=t.fullscreen;u!==a.container||!t.isEmbed&&l.empty(t.config.ratio)||(r(),(c.type==="enterfullscreen"?C:fe).call(t,window,"resize",o))})}),m(this,"media",()=>{const{player:t}=this,{elements:s}=t;if(C.call(t,t.media,"timeupdate seeking seeked",n=>d.timeUpdate.call(t,n)),C.call(t,t.media,"durationchange loadeddata loadedmetadata",n=>d.durationUpdate.call(t,n)),C.call(t,t.media,"ended",()=>{t.isHTML5&&t.isVideo&&t.config.resetOnEnd&&(t.restart(),t.pause())}),C.call(t,t.media,"progress playing seeking seeked",n=>d.updateProgress.call(t,n)),C.call(t,t.media,"volumechange",n=>d.updateVolume.call(t,n)),C.call(t,t.media,"playing play pause ended emptied timeupdate",n=>E.checkPlaying.call(t,n)),C.call(t,t.media,"waiting canplay seeked playing",n=>E.checkLoading.call(t,n)),t.supported.ui&&t.config.clickToPlay&&!t.isAudio){const n=$.call(t,`.${t.config.classNames.video}`);if(!l.element(n))return;C.call(t,s.container,"click",r=>{![s.container,n].includes(r.target)&&!n.contains(r.target)||t.touch&&t.config.hideControls||(t.ended?(this.proxy(r,t.restart,"restart"),this.proxy(r,()=>{F(t.play())},"play")):this.proxy(r,()=>{F(t.togglePlay())},"play"))})}t.supported.ui&&t.config.disableContextMenu&&C.call(t,s.wrapper,"contextmenu",n=>{n.preventDefault()},!1),C.call(t,t.media,"volumechange",()=>{t.storage.set({volume:t.volume,muted:t.muted})}),C.call(t,t.media,"ratechange",()=>{d.updateSetting.call(t,"speed"),t.storage.set({speed:t.speed})}),C.call(t,t.media,"qualitychange",n=>{d.updateSetting.call(t,"quality",null,n.detail.quality)}),C.call(t,t.media,"ready qualitychange",()=>{d.setDownloadUrl.call(t)});const a=t.config.events.concat(["keyup","keydown"]).join(" ");C.call(t,t.media,a,n=>{let{detail:r={}}=n;n.type==="error"&&(r=t.media.error),v.call(t,s.container,n.type,!0,r)})}),m(this,"proxy",(t,s,a)=>{const{player:n}=this,r=n.config.listeners[a],o=l.function(r);let c=!0;o&&(c=r.call(n,t)),c!==!1&&l.function(s)&&s.call(n,t)}),m(this,"bind",(t,s,a,n,r=!0)=>{const{player:o}=this,c=o.config.listeners[n],u=l.function(c);C.call(o,t,s,p=>this.proxy(p,a,n),r&&!u)}),m(this,"controls",()=>{const{player:t}=this,{elements:s}=t,a=_.isIE?"change":"input";if(s.buttons.play&&Array.from(s.buttons.play).forEach(n=>{this.bind(n,"click",()=>{F(t.togglePlay())},"play")}),this.bind(s.buttons.restart,"click",t.restart,"restart"),this.bind(s.buttons.rewind,"click",()=>{t.lastSeekTime=Date.now(),t.rewind()},"rewind"),this.bind(s.buttons.fastForward,"click",()=>{t.lastSeekTime=Date.now(),t.forward()},"fastForward"),this.bind(s.buttons.mute,"click",()=>{t.muted=!t.muted},"mute"),this.bind(s.buttons.captions,"click",()=>t.toggleCaptions()),this.bind(s.buttons.download,"click",()=>{v.call(t,t.media,"download")},"download"),this.bind(s.buttons.fullscreen,"click",()=>{t.fullscreen.toggle()},"fullscreen"),this.bind(s.buttons.pip,"click",()=>{t.pip="toggle"},"pip"),this.bind(s.buttons.airplay,"click",t.airplay,"airplay"),this.bind(s.buttons.settings,"click",n=>{n.stopPropagation(),n.preventDefault(),d.toggleMenu.call(t,n)},null,!1),this.bind(s.buttons.settings,"keyup",n=>{if([" ","Enter"].includes(n.key)){if(n.key==="Enter"){d.focusFirstMenuItem.call(t,null,!0);return}n.preventDefault(),n.stopPropagation(),d.toggleMenu.call(t,n)}},null,!1),this.bind(s.settings.menu,"keydown",n=>{n.key==="Escape"&&d.toggleMenu.call(t,n)}),this.bind(s.inputs.seek,"mousedown mousemove",n=>{const r=s.progress.getBoundingClientRect(),o=n.pageX-n.clientX,c=100/r.width*(n.pageX-r.left-o);n.currentTarget.setAttribute("seek-value",c)}),this.bind(s.inputs.seek,"mousedown mouseup keydown keyup touchstart touchend",n=>{const r=n.currentTarget,o="play-on-seeked";if(l.keyboardEvent(n)&&!["ArrowLeft","ArrowRight"].includes(n.key))return;t.lastSeekTime=Date.now();const c=r.hasAttribute(o),u=["mouseup","touchend","keyup"].includes(n.type);c&&u?(r.removeAttribute(o),F(t.play())):!u&&t.playing&&(r.setAttribute(o,""),t.pause())}),_.isIos){const n=ee.call(t,'input[type="range"]');Array.from(n).forEach(r=>this.bind(r,a,o=>it(o.target)))}this.bind(s.inputs.seek,a,n=>{const r=n.currentTarget;let o=r.getAttribute("seek-value");l.empty(o)&&(o=r.value),r.removeAttribute("seek-value"),t.currentTime=o/r.max*t.duration},"seek"),this.bind(s.progress,"mouseenter mouseleave mousemove",n=>d.updateSeekTooltip.call(t,n)),this.bind(s.progress,"mousemove touchmove",n=>{const{previewThumbnails:r}=t;r&&r.loaded&&r.startMove(n)}),this.bind(s.progress,"mouseleave touchend click",()=>{const{previewThumbnails:n}=t;n&&n.loaded&&n.endMove(!1,!0)}),this.bind(s.progress,"mousedown touchstart",n=>{const{previewThumbnails:r}=t;r&&r.loaded&&r.startScrubbing(n)}),this.bind(s.progress,"mouseup touchend",n=>{const{previewThumbnails:r}=t;r&&r.loaded&&r.endScrubbing(n)}),_.isWebKit&&Array.from(ee.call(t,'input[type="range"]')).forEach(n=>{this.bind(n,"input",r=>d.updateRangeFill.call(t,r.target))}),t.config.toggleInvert&&!l.element(s.display.duration)&&this.bind(s.display.currentTime,"click",()=>{t.currentTime!==0&&(t.config.invertTime=!t.config.invertTime,d.timeUpdate.call(t))}),this.bind(s.inputs.volume,a,n=>{t.volume=n.target.value},"volume"),this.bind(s.controls,"mouseenter mouseleave",n=>{s.controls.hover=!t.touch&&n.type==="mouseenter"}),s.fullscreen&&Array.from(s.fullscreen.children).filter(n=>!n.contains(s.container)).forEach(n=>{this.bind(n,"mouseenter mouseleave",r=>{s.controls&&(s.controls.hover=!t.touch&&r.type==="mouseenter")})}),this.bind(s.controls,"mousedown mouseup touchstart touchend touchcancel",n=>{s.controls.pressed=["mousedown","touchstart"].includes(n.type)}),this.bind(s.controls,"focusin",()=>{const{config:n,timers:r}=t;S(s.controls,n.classNames.noTransition,!0),E.toggleControls.call(t,!0),setTimeout(()=>{S(s.controls,n.classNames.noTransition,!1)},0);const o=this.touch?3e3:4e3;clearTimeout(r.controls),r.controls=setTimeout(()=>E.toggleControls.call(t,!1),o)}),this.bind(s.inputs.volume,"wheel",n=>{const r=n.webkitDirectionInvertedFromDevice,[o,c]=[n.deltaX,-n.deltaY].map(y=>r?-y:y),u=Math.sign(Math.abs(o)>Math.abs(c)?o:c);t.increaseVolume(u/50);const{volume:p}=t.media;(u===1&&p<1||u===-1&&p>0)&&n.preventDefault()},"volume",!1)}),this.player=i,this.lastKey=null,this.focusTimer=null,this.lastKeyDown=null,this.handleKey=this.handleKey.bind(this),this.toggleMenu=this.toggleMenu.bind(this),this.firstTouch=this.firstTouch.bind(this)}handleKey(i){const{player:t}=this,{elements:s}=t,{key:a,type:n,altKey:r,ctrlKey:o,metaKey:c,shiftKey:u}=i,p=n==="keydown",y=p&&a===this.lastKey;if(r||o||c||u||!a)return;const h=f=>{t.currentTime=t.duration/10*f};if(p){const f=document.activeElement;if(l.element(f)){const{editable:T}=t.config.selectors,{seek:w}=s.inputs;if(f!==w&&X(f,T)||i.key===" "&&X(f,'button, [role^="menuitem"]'))return}switch([" ","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","0","1","2","3","4","5","6","7","8","9","c","f","k","l","m"].includes(a)&&(i.preventDefault(),i.stopPropagation()),a){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":y||h(Number.parseInt(a,10));break;case" ":case"k":y||F(t.togglePlay());break;case"ArrowUp":t.increaseVolume(.1);break;case"ArrowDown":t.decreaseVolume(.1);break;case"m":y||(t.muted=!t.muted);break;case"ArrowRight":t.forward();break;case"ArrowLeft":t.rewind();break;case"f":t.fullscreen.toggle();break;case"c":y||t.toggleCaptions();break;case"l":t.loop=!t.loop;break}a==="Escape"&&!t.fullscreen.usingNative&&t.fullscreen.active&&t.fullscreen.toggle(),this.lastKey=a}else this.lastKey=null}toggleMenu(i){d.toggleMenu.call(this.player,i)}}function pi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ee={exports:{}},gi=Ee.exports,Be;function fi(){return Be||(Be=1,(function(e,i){(function(t,s){e.exports=s()})(gi,function(){var t=function(){},s={},a={},n={};function r(h,f){h=h.push?h:[h];var T=[],w=h.length,I=w,M,g,k,P;for(M=function(j,q){q.length&&T.push(j),I--,I||f(T)};w--;){if(g=h[w],k=a[g],k){M(g,k);continue}P=n[g]=n[g]||[],P.push(M)}}function o(h,f){if(h){var T=n[h];if(a[h]=f,!!T)for(;T.length;)T[0](h,f),T.splice(0,1)}}function c(h,f){h.call&&(h={success:h}),f.length?(h.error||t)(f):(h.success||t)(h)}function u(h,f,T,w){var I=document,M=T.async,g=(T.numRetries||0)+1,k=T.before||t,P=h.replace(/[\?|#].*$/,""),j=h.replace(/^(css|img|module|nomodule)!/,""),q,D,x;if(w=w||0,/(^css!|\.css$)/.test(P))x=I.createElement("link"),x.rel="stylesheet",x.href=j,q="hideFocus"in x,q&&x.relList&&(q=0,x.rel="preload",x.as="style");else if(/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(P))x=I.createElement("img"),x.src=j;else if(x=I.createElement("script"),x.src=j,x.async=M===void 0?!0:M,D="noModule"in x,/^module!/.test(P)){if(!D)return f(h,"l");x.type="module"}else if(/^nomodule!/.test(P)&&D)return f(h,"l");x.onload=x.onerror=x.onbeforeload=function(_e){var re=_e.type[0];if(q)try{x.sheet.cssText.length||(re="e")}catch(yt){yt.code!=18&&(re="e")}if(re=="e"){if(w+=1,w<g)return u(h,f,T,w)}else if(x.rel=="preload"&&x.as=="style")return x.rel="stylesheet";f(h,re,_e.defaultPrevented)},k(h,x)!==!1&&I.head.appendChild(x)}function p(h,f,T){h=h.push?h:[h];var w=h.length,I=w,M=[],g,k;for(g=function(P,j,q){if(j=="e"&&M.push(P),j=="b")if(q)M.push(P);else return;w--,w||f(M)},k=0;k<I;k++)u(h[k],g,T)}function y(h,f,T){var w,I;if(f&&f.trim&&(w=f),I=(w?T:f)||{},w){if(w in s)throw"LoadJS";s[w]=!0}function M(g,k){p(h,function(P){c(I,P),g&&c({success:g,error:k},P),o(w,P)},I)}if(I.returnPromise)return new Promise(M);M()}return y.ready=function(h,f){return r(h,function(T){c(f,T)}),y},y.done=function(h){o(h,[])},y.reset=function(){s={},a={},n={}},y.isDefined=function(h){return h in s},y})})(Ee)),Ee.exports}var yi=fi(),bi=pi(yi);function Oe(e){return new Promise((i,t)=>{bi(e,{success:i,error:t})})}function vi(e){if(l.empty(e))return null;if(l.number(Number(e)))return e;const i=/^.*(vimeo.com\/|video\/)(\d+).*/,t=e.match(i);return t?t[2]:e}function wi(e){const i=/^.*(vimeo.com\/|video\/)(\d+)(\?.*h=|\/)+([\d,a-f]+)/,t=e.match(i);return t&&t.length===5?t[4]:null}function J(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,v.call(this,this.media,e?"play":"pause"))}const Me={setup(){const e=this;S(e.elements.wrapper,e.config.classNames.embed,!0),e.options.speed=e.config.speed.options,Q.call(e),l.object(window.Vimeo)?Me.ready.call(e):Oe(e.config.urls.vimeo.sdk).then(()=>{Me.ready.call(e)}).catch(i=>{e.debug.warn("Vimeo SDK (player.js) failed to load",i)})},ready(){const e=this,i=e.config.vimeo,{premium:t,referrerPolicy:s,...a}=i;let n=e.media.getAttribute("src"),r="";l.empty(n)?(n=e.media.getAttribute(e.config.attributes.embed.id),r=e.media.getAttribute(e.config.attributes.embed.hash)):r=wi(n);const o=r?{h:r}:{};t&&Object.assign(a,{controls:!1,sidedock:!1});const c=mt({loop:e.config.loop.active,autoplay:e.autoplay,muted:e.muted,gesture:"media",playsinline:e.config.playsinline,...o,...a}),u=vi(n),p=b("iframe"),y=Se(e.config.urls.vimeo.iframe,u,c);if(p.setAttribute("src",y),p.setAttribute("allowfullscreen",""),p.setAttribute("allow",["autoplay","fullscreen","picture-in-picture","encrypted-media","accelerometer","gyroscope"].join("; ")),l.empty(s)||p.setAttribute("referrerPolicy",s),t||!i.customControls)p.setAttribute("data-poster",e.poster),e.media=de(p,e.media);else{const g=b("div",{class:e.config.classNames.embedContainer,"data-poster":e.poster});g.appendChild(p),e.media=de(g,e.media)}i.customControls||le(Se(e.config.urls.vimeo.api,y)).then(g=>{l.empty(g)||!g.thumbnail_url||E.setPoster.call(e,g.thumbnail_url).catch(()=>{})}),e.embed=new window.Vimeo.Player(p,{autopause:e.config.autopause,muted:e.muted}),e.media.paused=!0,e.media.currentTime=0,e.supported.ui&&e.embed.disableTextTrack(),e.media.play=()=>(J.call(e,!0),e.embed.play()),e.media.pause=()=>(J.call(e,!1),e.embed.pause()),e.media.stop=()=>{e.pause(),e.currentTime=0};let{currentTime:h}=e.media;Object.defineProperty(e.media,"currentTime",{get(){return h},set(g){const{embed:k,media:P,paused:j,volume:q}=e,D=j&&!k.hasPlayed;P.seeking=!0,v.call(e,P,"seeking"),Promise.resolve(D&&k.setVolume(0)).then(()=>k.setCurrentTime(g)).then(()=>D&&k.pause()).then(()=>D&&k.setVolume(q)).catch(()=>{})}});let f=e.config.speed.selected;Object.defineProperty(e.media,"playbackRate",{get(){return f},set(g){e.embed.setPlaybackRate(g).then(()=>{f=g,v.call(e,e.media,"ratechange")}).catch(()=>{e.options.speed=[1]})}});let{volume:T}=e.config;Object.defineProperty(e.media,"volume",{get(){return T},set(g){e.embed.setVolume(g).then(()=>{T=g,v.call(e,e.media,"volumechange")})}});let{muted:w}=e.config;Object.defineProperty(e.media,"muted",{get(){return w},set(g){const k=l.boolean(g)?g:!1;e.embed.setMuted(k?!0:e.config.muted).then(()=>{w=k,v.call(e,e.media,"volumechange")})}});let{loop:I}=e.config;Object.defineProperty(e.media,"loop",{get(){return I},set(g){const k=l.boolean(g)?g:e.config.loop.active;e.embed.setLoop(k).then(()=>{I=k})}});let M;e.embed.getVideoUrl().then(g=>{M=g,d.setDownloadUrl.call(e)}).catch(g=>{this.debug.warn(g)}),Object.defineProperty(e.media,"currentSrc",{get(){return M}}),Object.defineProperty(e.media,"ended",{get(){return e.currentTime===e.duration}}),Promise.all([e.embed.getVideoWidth(),e.embed.getVideoHeight()]).then(g=>{const[k,P]=g;e.embed.ratio=ot(k,P),Q.call(this)}),e.embed.setAutopause(e.config.autopause).then(g=>{e.config.autopause=g}),e.embed.getVideoTitle().then(g=>{e.config.title=g,E.setTitle.call(this)}),e.embed.getCurrentTime().then(g=>{h=g,v.call(e,e.media,"timeupdate")}),e.embed.getDuration().then(g=>{e.media.duration=g,v.call(e,e.media,"durationchange")}),e.embed.getTextTracks().then(g=>{e.media.textTracks=g,A.setup.call(e)}),e.embed.on("cuechange",({cues:g=[]})=>{const k=g.map(P=>ri(P.text));A.updateCues.call(e,k)}),e.embed.on("loaded",()=>{e.embed.getPaused().then(g=>{J.call(e,!g),g||v.call(e,e.media,"playing")}),l.element(e.embed.element)&&e.supported.ui&&e.embed.element.setAttribute("tabindex",-1)}),e.embed.on("bufferstart",()=>{v.call(e,e.media,"waiting")}),e.embed.on("bufferend",()=>{v.call(e,e.media,"playing")}),e.embed.on("play",()=>{J.call(e,!0),v.call(e,e.media,"playing")}),e.embed.on("pause",()=>{J.call(e,!1)}),e.embed.on("timeupdate",g=>{e.media.seeking=!1,h=g.seconds,v.call(e,e.media,"timeupdate")}),e.embed.on("progress",g=>{e.media.buffered=g.percent,v.call(e,e.media,"progress"),Number.parseInt(g.percent,10)===1&&v.call(e,e.media,"canplaythrough"),e.embed.getDuration().then(k=>{k!==e.media.duration&&(e.media.duration=k,v.call(e,e.media,"durationchange"))})}),e.embed.on("seeked",()=>{e.media.seeking=!1,v.call(e,e.media,"seeked")}),e.embed.on("ended",()=>{e.media.paused=!0,v.call(e,e.media,"ended")}),e.embed.on("error",g=>{e.media.error=g,v.call(e,e.media,"error")}),i.customControls&&setTimeout(()=>E.build.call(e),0)}};function ki(e){if(l.empty(e))return null;const i=/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/,t=e.match(i);return t&&t[2]?t[2]:e}function G(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,v.call(this,this.media,e?"play":"pause"))}function Ti(e){if(e.noCookie)return"https://www.youtube-nocookie.com";if(window.location.protocol==="http:")return"http://www.youtube.com"}const he={setup(){if(S(this.elements.wrapper,this.config.classNames.embed,!0),l.object(window.YT)&&l.function(window.YT.Player))he.ready.call(this);else{const e=window.onYouTubeIframeAPIReady;window.onYouTubeIframeAPIReady=()=>{l.function(e)&&e(),he.ready.call(this)},Oe(this.config.urls.youtube.sdk).catch(i=>{this.debug.warn("YouTube API failed to load",i)})}},getTitle(e){const i=Se(this.config.urls.youtube.api,e);le(i).then(t=>{if(l.object(t)){const{title:s,height:a,width:n}=t;this.config.title=s,E.setTitle.call(this),this.embed.ratio=ot(n,a)}Q.call(this)}).catch(()=>{Q.call(this)})},ready(){const e=this,i=e.config.youtube,t=e.media&&e.media.getAttribute("id");if(!l.empty(t)&&t.startsWith("youtube-"))return;let s=e.media.getAttribute("src");l.empty(s)&&(s=e.media.getAttribute(this.config.attributes.embed.id));const a=ki(s),n=si(e.provider),r=b("div",{id:n,"data-poster":i.customControls?e.poster:void 0});if(e.media=de(r,e.media),i.customControls){const o=c=>`https://i.ytimg.com/vi/${a}/${c}default.jpg`;ue(o("maxres"),121).catch(()=>ue(o("sd"),121)).catch(()=>ue(o("hq"))).then(c=>E.setPoster.call(e,c.src)).then(c=>{c.includes("maxres")||(e.elements.poster.style.backgroundSize="cover")}).catch(()=>{})}e.embed=new window.YT.Player(e.media,{videoId:a,host:Ti(i),playerVars:N({},{autoplay:e.config.autoplay?1:0,hl:e.config.hl,controls:e.supported.ui&&i.customControls?0:1,disablekb:1,playsinline:e.config.playsinline&&!e.config.fullscreen.iosNative?1:0,cc_load_policy:e.captions.active?1:0,cc_lang_pref:e.config.captions.language,widget_referrer:window?window.location.href:null},i),events:{onError(o){if(!e.media.error){const c=o.data,u={2:"The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks.",5:"The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.",100:"The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.",101:"The owner of the requested video does not allow it to be played in embedded players.",150:"The owner of the requested video does not allow it to be played in embedded players."}[c]||"An unknown error occurred";e.media.error={code:c,message:u},v.call(e,e.media,"error")}},onPlaybackRateChange(o){const c=o.target;e.media.playbackRate=c.getPlaybackRate(),v.call(e,e.media,"ratechange")},onReady(o){if(l.function(e.media.play))return;const c=o.target;he.getTitle.call(e,a),e.media.play=()=>{G.call(e,!0),c.playVideo()},e.media.pause=()=>{G.call(e,!1),c.pauseVideo()},e.media.stop=()=>{c.stopVideo()},e.media.duration=c.getDuration(),e.media.paused=!0,e.media.currentTime=0,Object.defineProperty(e.media,"currentTime",{get(){return Number(c.getCurrentTime())},set(h){e.paused&&!e.embed.hasPlayed&&e.embed.mute(),e.media.seeking=!0,v.call(e,e.media,"seeking"),c.seekTo(h)}}),Object.defineProperty(e.media,"playbackRate",{get(){return c.getPlaybackRate()},set(h){c.setPlaybackRate(h)}});let{volume:u}=e.config;Object.defineProperty(e.media,"volume",{get(){return u},set(h){u=h,c.setVolume(u*100),v.call(e,e.media,"volumechange")}});let{muted:p}=e.config;Object.defineProperty(e.media,"muted",{get(){return p},set(h){const f=l.boolean(h)?h:p;p=f,c[f?"mute":"unMute"](),c.setVolume(u*100),v.call(e,e.media,"volumechange")}}),Object.defineProperty(e.media,"currentSrc",{get(){return c.getVideoUrl()}}),Object.defineProperty(e.media,"ended",{get(){return e.currentTime===e.duration}});const y=c.getAvailablePlaybackRates();e.options.speed=y.filter(h=>e.config.speed.options.includes(h)),e.supported.ui&&i.customControls&&e.media.setAttribute("tabindex",-1),v.call(e,e.media,"timeupdate"),v.call(e,e.media,"durationchange"),clearInterval(e.timers.buffering),e.timers.buffering=setInterval(()=>{e.media.buffered=c.getVideoLoadedFraction(),(e.media.lastBuffered===null||e.media.lastBuffered<e.media.buffered)&&v.call(e,e.media,"progress"),e.media.lastBuffered=e.media.buffered,e.media.buffered===1&&(clearInterval(e.timers.buffering),v.call(e,e.media,"canplaythrough"))},200),i.customControls&&setTimeout(()=>E.build.call(e),50)},onStateChange(o){const c=o.target;switch(clearInterval(e.timers.playing),e.media.seeking&&[1,2].includes(o.data)&&(e.media.seeking=!1,v.call(e,e.media,"seeked")),o.data){case-1:v.call(e,e.media,"timeupdate"),e.media.buffered=c.getVideoLoadedFraction(),v.call(e,e.media,"progress");break;case 0:G.call(e,!1),e.media.loop?(c.stopVideo(),c.playVideo()):v.call(e,e.media,"ended");break;case 1:i.customControls&&!e.config.autoplay&&e.media.paused&&!e.embed.hasPlayed?e.media.pause():(G.call(e,!0),v.call(e,e.media,"playing"),e.timers.playing=setInterval(()=>{v.call(e,e.media,"timeupdate")},50),e.media.duration!==c.getDuration()&&(e.media.duration=c.getDuration(),v.call(e,e.media,"durationchange")));break;case 2:e.muted||e.embed.unMute(),G.call(e,!1);break;case 3:v.call(e,e.media,"waiting");break}v.call(e,e.elements.container,"statechange",!1,{code:o.data})}}})}},gt={setup(){if(!this.media){this.debug.warn("No media element found!");return}S(this.elements.container,this.config.classNames.type.replace("{0}",this.type),!0),S(this.elements.container,this.config.classNames.provider.replace("{0}",this.provider),!0),this.isEmbed&&S(this.elements.container,this.config.classNames.type.replace("{0}","video"),!0),this.isVideo&&(this.elements.wrapper=b("div",{class:this.config.classNames.video}),nt(this.media,this.elements.wrapper),this.elements.poster=b("div",{class:this.config.classNames.poster}),this.elements.wrapper.appendChild(this.elements.poster)),this.isHTML5?W.setup.call(this):this.isYouTube?he.setup.call(this):this.isVimeo&&Me.setup.call(this)}};function Ci(e){e.manager&&e.manager.destroy(),e.elements.displayContainer&&e.elements.displayContainer.destroy(),e.elements.container.remove()}class Ai{constructor(i){m(this,"load",()=>{this.enabled&&(!l.object(window.google)||!l.object(window.google.ima)?Oe(this.player.config.urls.googleIMA.sdk).then(()=>{this.ready()}).catch(()=>{this.trigger("error",new Error("Google IMA SDK failed to load"))}):this.ready())}),m(this,"ready",()=>{this.enabled||Ci(this),this.startSafetyTimer(12e3,"ready()"),this.managerPromise.then(()=>{this.clearSafetyTimer("onAdsManagerLoaded()")}),this.listeners(),this.setupIMA()}),m(this,"setupIMA",()=>{this.elements.container=b("div",{class:this.player.config.classNames.ads}),this.player.elements.container.appendChild(this.elements.container),google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED),google.ima.settings.setLocale(this.player.config.ads.language),google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.player.config.playsinline),this.elements.displayContainer=new google.ima.AdDisplayContainer(this.elements.container,this.player.media),this.loader=new google.ima.AdsLoader(this.elements.displayContainer),this.loader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,t=>this.onAdsManagerLoaded(t),!1),this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,t=>this.onAdError(t),!1),this.requestAds()}),m(this,"requestAds",()=>{const{container:t}=this.player.elements;try{const s=new google.ima.AdsRequest;s.adTagUrl=this.tagUrl,s.linearAdSlotWidth=t.offsetWidth,s.linearAdSlotHeight=t.offsetHeight,s.nonLinearAdSlotWidth=t.offsetWidth,s.nonLinearAdSlotHeight=t.offsetHeight,s.forceNonLinearFullSlot=!1,s.setAdWillPlayMuted(!this.player.muted),this.loader.requestAds(s)}catch(s){this.onAdError(s)}}),m(this,"pollCountdown",(t=!1)=>{if(!t){clearInterval(this.countdownTimer),this.elements.container.removeAttribute("data-badge-text");return}const s=()=>{const a=ye(Math.max(this.manager.getRemainingTime(),0)),n=`${O.get("advertisement",this.player.config)} - ${a}`;this.elements.container.setAttribute("data-badge-text",n)};this.countdownTimer=setInterval(s,100)}),m(this,"onAdsManagerLoaded",t=>{if(!this.enabled)return;const s=new google.ima.AdsRenderingSettings;s.restoreCustomPlaybackStateOnAdBreakComplete=!0,s.enablePreloading=!0,this.manager=t.getAdsManager(this.player,s),this.cuePoints=this.manager.getCuePoints(),this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,a=>this.onAdError(a)),Object.keys(google.ima.AdEvent.Type).forEach(a=>{this.manager.addEventListener(google.ima.AdEvent.Type[a],n=>this.onAdEvent(n))}),this.trigger("loaded")}),m(this,"addCuePoints",()=>{l.empty(this.cuePoints)||this.cuePoints.forEach(t=>{if(t!==0&&t!==-1&&t<this.player.duration){const s=this.player.elements.progress;if(l.element(s)){const a=100/this.player.duration*t,n=b("span",{class:this.player.config.classNames.cues});n.style.left=`${a.toString()}%`,s.appendChild(n)}}})}),m(this,"onAdEvent",t=>{const{container:s}=this.player.elements,a=t.getAd(),n=t.getAdData();switch((r=>{v.call(this.player,this.player.media,`ads${r.replace(/_/g,"").toLowerCase()}`)})(t.type),t.type){case google.ima.AdEvent.Type.LOADED:this.trigger("loaded"),this.pollCountdown(!0),a.isLinear()||(a.width=s.offsetWidth,a.height=s.offsetHeight);break;case google.ima.AdEvent.Type.STARTED:this.manager.setVolume(this.player.volume);break;case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:this.player.ended?this.loadAds():this.loader.contentComplete();break;case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED:this.pauseContent();break;case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED:this.pollCountdown(),this.resumeContent();break;case google.ima.AdEvent.Type.LOG:n.adError&&this.player.debug.warn(`Non-fatal ad error: ${n.adError.getMessage()}`);break}}),m(this,"onAdError",t=>{this.cancel(),this.player.debug.warn("Ads error",t)}),m(this,"listeners",()=>{const{container:t}=this.player.elements;let s;this.player.on("canplay",()=>{this.addCuePoints()}),this.player.on("ended",()=>{this.loader.contentComplete()}),this.player.on("timeupdate",()=>{s=this.player.currentTime}),this.player.on("seeked",()=>{const a=this.player.currentTime;l.empty(this.cuePoints)||this.cuePoints.forEach((n,r)=>{s<n&&n<a&&(this.manager.discardAdBreak(),this.cuePoints.splice(r,1))})}),window.addEventListener("resize",()=>{this.manager&&this.manager.resize(t.offsetWidth,t.offsetHeight,google.ima.ViewMode.NORMAL)})}),m(this,"play",()=>{const{container:t}=this.player.elements;this.managerPromise||this.resumeContent(),this.managerPromise.then(()=>{this.manager.setVolume(this.player.volume),this.elements.displayContainer.initialize();try{this.initialized||(this.manager.init(t.offsetWidth,t.offsetHeight,google.ima.ViewMode.NORMAL),this.manager.start()),this.initialized=!0}catch(s){this.onAdError(s)}}).catch(()=>{})}),m(this,"resumeContent",()=>{this.elements.container.style.zIndex="",this.playing=!1,F(this.player.media.play())}),m(this,"pauseContent",()=>{this.elements.container.style.zIndex=3,this.playing=!0,this.player.media.pause()}),m(this,"cancel",()=>{this.initialized&&this.resumeContent(),this.trigger("error"),this.loadAds()}),m(this,"loadAds",()=>{this.managerPromise.then(()=>{this.manager&&this.manager.destroy(),this.managerPromise=new Promise(t=>{this.on("loaded",t),this.player.debug.log(this.manager)}),this.initialized=!1,this.requestAds()}).catch(()=>{})}),m(this,"trigger",(t,...s)=>{const a=this.events[t];l.array(a)&&a.forEach(n=>{l.function(n)&&n.apply(this,s)})}),m(this,"on",(t,s)=>(l.array(this.events[t])||(this.events[t]=[]),this.events[t].push(s),this)),m(this,"startSafetyTimer",(t,s)=>{this.player.debug.log(`Safety timer invoked from: ${s}`),this.safetyTimer=setTimeout(()=>{this.cancel(),this.clearSafetyTimer("startSafetyTimer()")},t)}),m(this,"clearSafetyTimer",t=>{l.nullOrUndefined(this.safetyTimer)||(this.player.debug.log(`Safety timer cleared from: ${t}`),clearTimeout(this.safetyTimer),this.safetyTimer=null)}),this.player=i,this.config=i.config.ads,this.playing=!1,this.initialized=!1,this.elements={container:null,displayContainer:null},this.manager=null,this.loader=null,this.cuePoints=null,this.events={},this.safetyTimer=null,this.countdownTimer=null,this.managerPromise=new Promise((t,s)=>{this.on("loaded",t),this.on("error",s)}),this.load()}get enabled(){const{config:i}=this;return this.player.isHTML5&&this.player.isVideo&&i.enabled&&(!l.empty(i.publisherId)||l.url(i.tagUrl))}get tagUrl(){const{config:i}=this;if(l.url(i.tagUrl))return i.tagUrl;const t={AV_PUBLISHERID:"58c25bb0073ef448b1087ad6",AV_CHANNELID:"5a0458dc28a06145e4519d21",AV_URL:window.location.hostname,cb:Date.now(),AV_WIDTH:640,AV_HEIGHT:480,AV_CDIM2:i.publisherId};return`https://go.aniview.com/api/adserver6/vast/?${mt(t)}`}}function ft(e=0,i=0,t=255){return Math.min(Math.max(e,i),t)}function Si(e){const i=[];return e.split(/\r\n\r\n|\n\n|\r\r/).forEach(t=>{const s={};t.split(/\r\n|\n|\r/).forEach(a=>{if(l.number(s.startTime)){if(!l.empty(a.trim())&&l.empty(s.text)){const n=a.trim().split("#xywh=");[s.text]=n,n[1]&&([s.x,s.y,s.w,s.h]=n[1].split(","))}}else{const n=a.match(/(\d{2})?:?(\d{2}):(\d{2}).(\d{2,3})( ?--> ?)(\d{2})?:?(\d{2}):(\d{2}).(\d{2,3})/);n&&(s.startTime=Number(n[1]||0)*60*60+Number(n[2])*60+Number(n[3])+ +`0.${n[4]}`,s.endTime=Number(n[6]||0)*60*60+Number(n[7])*60+Number(n[8])+ +`0.${n[9]}`)}}),s.text&&i.push(s)}),i}function ze(e,i){const t=i.width/i.height,s={};return e>t?(s.width=i.width,s.height=1/e*i.width):(s.height=i.height,s.width=e*i.height),s}class Pe{constructor(i){m(this,"load",()=>{this.player.elements.display.seekTooltip&&(this.player.elements.display.seekTooltip.hidden=this.enabled),this.enabled&&this.getThumbnails().then(()=>{this.enabled&&(this.render(),this.determineContainerAutoSizing(),this.listeners(),this.loaded=!0)})}),m(this,"getThumbnails",()=>new Promise(t=>{const{src:s}=this.player.config.previewThumbnails;if(l.empty(s))throw new Error("Missing previewThumbnails.src config attribute");const a=()=>{this.thumbnails.sort((n,r)=>n.height-r.height),this.player.debug.log("Preview thumbnails",this.thumbnails),t()};if(l.function(s))s(n=>{this.thumbnails=n,a()});else{const n=(l.string(s)?[s]:s).map(r=>this.getThumbnail(r));Promise.all(n).then(a)}})),m(this,"getThumbnail",t=>new Promise(s=>{le(t,void 0,this.player.config.previewThumbnails.withCredentials).then(a=>{const n={frames:Si(a),height:null,urlPrefix:""};!n.frames[0].text.startsWith("/")&&!n.frames[0].text.startsWith("http://")&&!n.frames[0].text.startsWith("https://")&&(n.urlPrefix=t.substring(0,t.lastIndexOf("/")+1));const r=new Image;r.onload=()=>{n.height=r.naturalHeight,n.width=r.naturalWidth,this.thumbnails.push(n),s()},r.src=n.urlPrefix+n.frames[0].text})})),m(this,"startMove",t=>{if(this.loaded&&!(!l.event(t)||!["touchmove","mousemove"].includes(t.type))&&this.player.media.duration){if(t.type==="touchmove")this.seekTime=this.player.media.duration*(this.player.elements.inputs.seek.value/100);else{var s,a;const n=this.player.elements.progress.getBoundingClientRect(),r=100/n.width*(t.pageX-n.left);this.seekTime=this.player.media.duration*(r/100),this.seekTime<0&&(this.seekTime=0),this.seekTime>this.player.media.duration-1&&(this.seekTime=this.player.media.duration-1),this.mousePosX=t.pageX,this.elements.thumb.time.textContent=ye(this.seekTime);const o=(s=this.player.config.markers)===null||s===void 0||(a=s.points)===null||a===void 0?void 0:a.find(({time:c})=>c===Math.round(this.seekTime));o&&this.elements.thumb.time.insertAdjacentHTML("afterbegin",`${o.label}<br>`)}this.showImageAtCurrentTime()}}),m(this,"endMove",()=>{this.toggleThumbContainer(!1,!0)}),m(this,"startScrubbing",t=>{(l.nullOrUndefined(t.button)||t.button===!1||t.button===0)&&(this.mouseDown=!0,this.player.media.duration&&(this.toggleScrubbingContainer(!0),this.toggleThumbContainer(!1,!0),this.showImageAtCurrentTime()))}),m(this,"endScrubbing",()=>{this.mouseDown=!1,Math.ceil(this.lastTime)===Math.ceil(this.player.media.currentTime)?this.toggleScrubbingContainer(!1):Ie.call(this.player,this.player.media,"timeupdate",()=>{this.mouseDown||this.toggleScrubbingContainer(!1)})}),m(this,"listeners",()=>{this.player.on("play",()=>{this.toggleThumbContainer(!1,!0)}),this.player.on("seeked",()=>{this.toggleThumbContainer(!1)}),this.player.on("timeupdate",()=>{this.lastTime=this.player.media.currentTime})}),m(this,"render",()=>{this.elements.thumb.container=b("div",{class:this.player.config.classNames.previewThumbnails.thumbContainer}),this.elements.thumb.imageContainer=b("div",{class:this.player.config.classNames.previewThumbnails.imageContainer}),this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer);const t=b("div",{class:this.player.config.classNames.previewThumbnails.timeContainer});this.elements.thumb.time=b("span",{},"00:00"),t.appendChild(this.elements.thumb.time),this.elements.thumb.imageContainer.appendChild(t),l.element(this.player.elements.progress)&&this.player.elements.progress.appendChild(this.elements.thumb.container),this.elements.scrubbing.container=b("div",{class:this.player.config.classNames.previewThumbnails.scrubbingContainer}),this.player.elements.wrapper.appendChild(this.elements.scrubbing.container)}),m(this,"destroy",()=>{this.elements.thumb.container&&this.elements.thumb.container.remove(),this.elements.scrubbing.container&&this.elements.scrubbing.container.remove()}),m(this,"showImageAtCurrentTime",()=>{this.mouseDown?this.setScrubbingContainerSize():this.setThumbContainerSizeAndPos();const t=this.thumbnails[0].frames.findIndex(n=>this.seekTime>=n.startTime&&this.seekTime<=n.endTime),s=t>=0;let a=0;this.mouseDown||this.toggleThumbContainer(s),s&&(this.thumbnails.forEach((n,r)=>{this.loadedImages.includes(n.frames[t].text)&&(a=r)}),t!==this.showingThumb&&(this.showingThumb=t,this.loadImage(a)))}),m(this,"loadImage",(t=0)=>{const s=this.showingThumb,a=this.thumbnails[t],{urlPrefix:n}=a,r=a.frames[s],o=a.frames[s].text,c=n+o;if(!this.currentImageElement||this.currentImageElement.dataset.filename!==o){this.loadingImage&&this.usingSprites&&(this.loadingImage.onload=null);const u=new Image;u.src=c,u.dataset.index=s,u.dataset.filename=o,this.showingThumbFilename=o,this.player.debug.log(`Loading image: ${c}`),u.onload=()=>this.showImage(u,r,t,s,o,!0),this.loadingImage=u,this.removeOldImages(u)}else this.showImage(this.currentImageElement,r,t,s,o,!1),this.currentImageElement.dataset.index=s,this.removeOldImages(this.currentImageElement)}),m(this,"showImage",(t,s,a,n,r,o=!0)=>{this.player.debug.log(`Showing thumb: ${r}. num: ${n}. qual: ${a}. newimg: ${o}`),this.setImageSizeAndOffset(t,s),o&&(this.currentImageContainer.appendChild(t),this.currentImageElement=t,this.loadedImages.includes(r)||this.loadedImages.push(r)),this.preloadNearby(n,!0).then(this.preloadNearby(n,!1)).then(this.getHigherQuality(a,t,s,r))}),m(this,"removeOldImages",t=>{Array.from(this.currentImageContainer.children).forEach(s=>{if(s.tagName.toLowerCase()!=="img")return;const a=this.usingSprites?500:1e3;if(s.dataset.index!==t.dataset.index&&!s.dataset.deleting){s.dataset.deleting=!0;const{currentImageContainer:n}=this;setTimeout(()=>{n.removeChild(s),this.player.debug.log(`Removing thumb: ${s.dataset.filename}`)},a)}})}),m(this,"preloadNearby",(t,s=!0)=>new Promise(a=>{setTimeout(()=>{const n=this.thumbnails[0].frames[t].text;if(this.showingThumbFilename===n){let r;s?r=this.thumbnails[0].frames.slice(t):r=this.thumbnails[0].frames.slice(0,t).reverse();let o=!1;r.forEach(c=>{const u=c.text;if(u!==n&&!this.loadedImages.includes(u)){o=!0,this.player.debug.log(`Preloading thumb filename: ${u}`);const{urlPrefix:p}=this.thumbnails[0],y=p+u,h=new Image;h.src=y,h.onload=()=>{this.player.debug.log(`Preloaded thumb filename: ${u}`),this.loadedImages.includes(u)||this.loadedImages.push(u),a()}}}),o||a()}},300)})),m(this,"getHigherQuality",(t,s,a,n)=>{if(t<this.thumbnails.length-1){let r=s.naturalHeight;this.usingSprites&&(r=a.h),r<this.thumbContainerHeight&&setTimeout(()=>{this.showingThumbFilename===n&&(this.player.debug.log(`Showing higher quality thumb for: ${n}`),this.loadImage(t+1))},300)}}),m(this,"toggleThumbContainer",(t=!1,s=!1)=>{const a=this.player.config.classNames.previewThumbnails.thumbContainerShown;this.elements.thumb.container.classList.toggle(a,t),!t&&s&&(this.showingThumb=null,this.showingThumbFilename=null)}),m(this,"toggleScrubbingContainer",(t=!1)=>{const s=this.player.config.classNames.previewThumbnails.scrubbingContainerShown;this.elements.scrubbing.container.classList.toggle(s,t),t||(this.showingThumb=null,this.showingThumbFilename=null)}),m(this,"determineContainerAutoSizing",()=>{(this.elements.thumb.imageContainer.clientHeight>20||this.elements.thumb.imageContainer.clientWidth>20)&&(this.sizeSpecifiedInCSS=!0)}),m(this,"setThumbContainerSizeAndPos",()=>{const{imageContainer:t}=this.elements.thumb;if(this.sizeSpecifiedInCSS){if(t.clientHeight>20&&t.clientWidth<20){const s=Math.floor(t.clientHeight*this.thumbAspectRatio);t.style.width=`${s}px`}else if(t.clientHeight<20&&t.clientWidth>20){const s=Math.floor(t.clientWidth/this.thumbAspectRatio);t.style.height=`${s}px`}}else{const s=Math.floor(this.thumbContainerHeight*this.thumbAspectRatio);t.style.height=`${this.thumbContainerHeight}px`,t.style.width=`${s}px`}this.setThumbContainerPos()}),m(this,"setThumbContainerPos",()=>{const t=this.player.elements.progress.getBoundingClientRect(),s=this.player.elements.container.getBoundingClientRect(),{container:a}=this.elements.thumb,n=s.left-t.left+10,r=s.right-t.left-a.clientWidth-10,o=this.mousePosX-t.left-a.clientWidth/2,c=ft(o,n,r);a.style.left=`${c}px`,a.style.setProperty("--preview-arrow-offset",`${o-c}px`)}),m(this,"setScrubbingContainerSize",()=>{const{width:t,height:s}=ze(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight});this.elements.scrubbing.container.style.width=`${t}px`,this.elements.scrubbing.container.style.height=`${s}px`}),m(this,"setImageSizeAndOffset",(t,s)=>{if(!this.usingSprites)return;const a=this.thumbContainerHeight/s.h;t.style.height=`${t.naturalHeight*a}px`,t.style.width=`${t.naturalWidth*a}px`,t.style.left=`-${s.x*a}px`,t.style.top=`-${s.y*a}px`}),this.player=i,this.thumbnails=[],this.loaded=!1,this.lastMouseMoveTime=Date.now(),this.mouseDown=!1,this.loadedImages=[],this.elements={thumb:{},scrubbing:{}},this.load()}get enabled(){return this.player.isHTML5&&this.player.isVideo&&this.player.config.previewThumbnails.enabled}get currentImageContainer(){return this.mouseDown?this.elements.scrubbing.container:this.elements.thumb.imageContainer}get usingSprites(){return Object.keys(this.thumbnails[0].frames[0]).includes("w")}get thumbAspectRatio(){return this.usingSprites?this.thumbnails[0].frames[0].w/this.thumbnails[0].frames[0].h:this.thumbnails[0].width/this.thumbnails[0].height}get thumbContainerHeight(){if(this.mouseDown){const{height:i}=ze(this.thumbAspectRatio,{width:this.player.media.clientWidth,height:this.player.media.clientHeight});return i}return this.sizeSpecifiedInCSS?this.elements.thumb.imageContainer.clientHeight:Math.floor(this.player.media.clientWidth/this.thumbAspectRatio/4)}get currentImageElement(){return this.mouseDown?this.currentScrubbingImageElement:this.currentThumbnailImageElement}set currentImageElement(i){this.mouseDown?this.currentScrubbingImageElement=i:this.currentThumbnailImageElement=i}}const xe={insertElements(e,i){l.string(i)?Re(e,this.media,{src:i}):l.array(i)&&i.forEach(t=>{Re(e,this.media,t)})},change(e){if(!st(e,"sources.length")){this.debug.warn("Invalid source format");return}W.cancelRequests.call(this),this.destroy(()=>{this.options.quality=[],U(this.media),this.media=null,l.element(this.elements.container)&&this.elements.container.removeAttribute("class");const{sources:i,type:t}=e,[{provider:s=z.html5,src:a}]=i,n=s==="html5"?t:"div",r=s==="html5"?{}:{src:a};Object.assign(this,{provider:s,type:t,supported:L.check(t,s,this.config.playsinline),media:b(n,r)}),this.elements.container.appendChild(this.media),l.boolean(e.autoplay)&&(this.config.autoplay=e.autoplay),this.isHTML5&&(this.config.crossorigin&&this.media.setAttribute("crossorigin",""),this.config.autoplay&&this.media.setAttribute("autoplay",""),l.empty(e.poster)||(this.poster=e.poster),this.config.loop.active&&this.media.setAttribute("loop",""),this.config.muted&&this.media.setAttribute("muted",""),this.config.playsinline&&this.media.setAttribute("playsinline","")),E.addStyleHook.call(this),this.isHTML5&&xe.insertElements.call(this,"source",i),this.config.title=e.title,gt.setup.call(this),this.isHTML5&&Object.keys(e).includes("tracks")&&xe.insertElements.call(this,"track",e.tracks),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&E.build.call(this),this.isHTML5&&this.media.load(),l.empty(e.previewThumbnails)||(Object.assign(this.config.previewThumbnails,e.previewThumbnails),this.previewThumbnails&&this.previewThumbnails.loaded&&(this.previewThumbnails.destroy(),this.previewThumbnails=null),this.config.previewThumbnails.enabled&&(this.previewThumbnails=new Pe(this))),this.fullscreen.update()},!0)}};class se{constructor(i,t){if(m(this,"play",()=>l.function(this.media.play)?(this.ads&&this.ads.enabled&&this.ads.managerPromise.then(()=>this.ads.play()).catch(()=>F(this.media.play())),this.media.play()):null),m(this,"pause",()=>!this.playing||!l.function(this.media.pause)?null:this.media.pause()),m(this,"togglePlay",o=>(l.boolean(o)?o:!this.playing)?this.play():this.pause()),m(this,"stop",()=>{this.isHTML5?(this.pause(),this.restart()):l.function(this.media.stop)&&this.media.stop()}),m(this,"restart",()=>{this.currentTime=0}),m(this,"rewind",o=>{this.currentTime-=l.number(o)?o:this.config.seekTime}),m(this,"forward",o=>{this.currentTime+=l.number(o)?o:this.config.seekTime}),m(this,"increaseVolume",o=>{const c=this.media.muted?0:this.volume;this.volume=c+(l.number(o)?o:0)}),m(this,"decreaseVolume",o=>{this.increaseVolume(-o)}),m(this,"airplay",()=>{L.airplay&&this.media.webkitShowPlaybackTargetPicker()}),m(this,"toggleControls",o=>{if(this.supported.ui&&!this.isAudio){const c=me(this.elements.container,this.config.classNames.hideControls),u=typeof o>"u"?void 0:!o,p=S(this.elements.container,this.config.classNames.hideControls,u);if(p&&l.array(this.config.controls)&&this.config.controls.includes("settings")&&!l.empty(this.config.settings)&&d.toggleMenu.call(this,!1),p!==c){const y=p?"controlshidden":"controlsshown";v.call(this,this.media,y)}return!p}return!1}),m(this,"on",(o,c)=>{C.call(this,this.elements.container,o,c)}),m(this,"once",(o,c)=>{Ie.call(this,this.elements.container,o,c)}),m(this,"off",(o,c)=>{fe(this.elements.container,o,c)}),m(this,"destroy",(o,c=!1)=>{if(!this.ready)return;const u=()=>{document.body.style.overflow="",this.embed=null,c?(Object.keys(this.elements).length&&(U(this.elements.buttons.play),U(this.elements.captions),U(this.elements.controls),U(this.elements.wrapper),this.elements.buttons.play=null,this.elements.captions=null,this.elements.controls=null,this.elements.wrapper=null),l.function(o)&&o()):(Xt.call(this),W.cancelRequests.call(this),de(this.elements.original,this.elements.container),v.call(this,this.elements.original,"destroyed",!0),l.function(o)&&o.call(this.elements.original),this.ready=!1,setTimeout(()=>{this.elements=null,this.media=null},200))};this.stop(),clearTimeout(this.timers.loading),clearTimeout(this.timers.controls),clearTimeout(this.timers.resized),this.isHTML5?(E.toggleNativeControls.call(this,!0),u()):this.isYouTube?(clearInterval(this.timers.buffering),clearInterval(this.timers.playing),this.embed!==null&&l.function(this.embed.destroy)&&this.embed.destroy(),u()):this.isVimeo&&(this.embed!==null&&this.embed.unload().then(u),setTimeout(u,200))}),m(this,"supports",o=>L.mime.call(this,o)),this.timers={},this.ready=!1,this.loading=!1,this.failed=!1,this.touch=L.touch,this.media=i,l.string(this.media)&&(this.media=document.querySelectorAll(this.media)),(window.jQuery&&this.media instanceof jQuery||l.nodeList(this.media)||l.array(this.media))&&(this.media=this.media[0]),this.config=N({},pt,se.defaults,t||{},(()=>{try{return JSON.parse(this.media.getAttribute("data-plyr-config"))}catch{return{}}})()),this.elements={container:null,fullscreen:null,captions:null,buttons:{},display:{},progress:{},inputs:{},settings:{popup:null,menu:null,panels:{},buttons:{}}},this.captions={active:null,currentTrack:-1,meta:new WeakMap},this.fullscreen={active:!1},this.options={speed:[],quality:[]},this.debug=new di(this.config.debug),this.debug.log("Config",this.config),this.debug.log("Support",L),l.nullOrUndefined(this.media)||!l.element(this.media)){this.debug.error("Setup failed: no suitable element passed");return}if(this.media.plyr){this.debug.warn("Target already setup");return}if(!this.config.enabled){this.debug.error("Setup failed: disabled by config");return}if(!L.check().api){this.debug.error("Setup failed: no support");return}const s=this.media.cloneNode(!0);s.autoplay=!1,this.elements.original=s;const a=this.media.tagName.toLowerCase();let n=null,r=null;switch(a){case"div":if(n=this.media.querySelector("iframe"),l.element(n)){if(r=dt(n.getAttribute("src")),this.provider=hi(r.toString()),this.elements.container=this.media,this.media=n,this.elements.container.className="",r.search.length){const o=["1","true"];o.includes(r.searchParams.get("autoplay"))&&(this.config.autoplay=!0),o.includes(r.searchParams.get("loop"))&&(this.config.loop.active=!0),this.isYouTube?(this.config.playsinline=o.includes(r.searchParams.get("playsinline")),this.config.youtube.hl=r.searchParams.get("hl")):this.config.playsinline=!0}}else this.provider=this.media.getAttribute(this.config.attributes.embed.provider),this.media.removeAttribute(this.config.attributes.embed.provider);if(l.empty(this.provider)||!Object.values(z).includes(this.provider)){this.debug.error("Setup failed: Invalid provider");return}this.type=we.video;break;case"video":case"audio":this.type=a,this.provider=z.html5,this.media.hasAttribute("crossorigin")&&(this.config.crossorigin=!0),this.media.hasAttribute("autoplay")&&(this.config.autoplay=!0),(this.media.hasAttribute("playsinline")||this.media.hasAttribute("webkit-playsinline"))&&(this.config.playsinline=!0),this.media.hasAttribute("muted")&&(this.config.muted=!0),this.media.hasAttribute("loop")&&(this.config.loop.active=!0);break;default:this.debug.error("Setup failed: unsupported type");return}if(this.supported=L.check(this.type,this.provider),!this.supported.api){this.debug.error("Setup failed: no support");return}this.eventListeners=[],this.listeners=new mi(this),this.storage=new ie(this),this.media.plyr=this,l.element(this.elements.container)||(this.elements.container=b("div"),nt(this.media,this.elements.container)),E.migrateStyles.call(this),E.addStyleHook.call(this),gt.setup.call(this),this.config.debug&&C.call(this,this.elements.container,this.config.events.join(" "),o=>{this.debug.log(`event: ${o.type}`)}),this.fullscreen=new R(this),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&E.build.call(this),this.listeners.container(),this.listeners.global(),this.config.ads.enabled&&(this.ads=new Ai(this)),this.isHTML5&&this.config.autoplay&&this.once("canplay",()=>F(this.play())),this.lastSeekTime=0,this.config.previewThumbnails.enabled&&(this.previewThumbnails=new Pe(this))}get isHTML5(){return this.provider===z.html5}get isEmbed(){return this.isYouTube||this.isVimeo}get isYouTube(){return this.provider===z.youtube}get isVimeo(){return this.provider===z.vimeo}get isVideo(){return this.type===we.video}get isAudio(){return this.type===we.audio}get playing(){return!!(this.ready&&!this.paused&&!this.ended)}get paused(){return!!this.media.paused}get stopped(){return!!(this.paused&&this.currentTime===0)}get ended(){return!!this.media.ended}set currentTime(i){if(!this.duration)return;const t=l.number(i)&&i>0;this.media.currentTime=t?Math.min(i,this.duration):0,this.debug.log(`Seeking to ${this.currentTime} seconds`)}get currentTime(){return Number(this.media.currentTime)}get buffered(){const{buffered:i}=this.media;return l.number(i)?i:i&&i.length&&this.duration>0?i.end(0)/this.duration:0}get seeking(){return!!this.media.seeking}get duration(){const i=Number.parseFloat(this.config.duration),t=(this.media||{}).duration,s=!l.number(t)||t===1/0?0:t;return i||s}set volume(i){let t=i;const s=1,a=0;l.string(t)&&(t=Number(t)),l.number(t)||(t=this.storage.get("volume")),l.number(t)||({volume:t}=this.config),t>s&&(t=s),t<a&&(t=a),this.config.volume=t,this.media.volume=t,!l.empty(i)&&this.muted&&t>0&&(this.muted=!1)}get volume(){return Number(this.media.volume)}set muted(i){let t=i;l.boolean(t)||(t=this.storage.get("muted")),l.boolean(t)||(t=this.config.muted),this.config.muted=t,this.media.muted=t}get muted(){return!!this.media.muted}get hasAudio(){return!this.isHTML5||this.isAudio?!0:!!this.media.mozHasAudio||!!this.media.webkitAudioDecodedByteCount||!!(this.media.audioTracks&&this.media.audioTracks.length)}set speed(i){let t=null;l.number(i)&&(t=i),l.number(t)||(t=this.storage.get("speed")),l.number(t)||(t=this.config.speed.selected);const{minimumSpeed:s,maximumSpeed:a}=this;t=ft(t,s,a),this.config.speed.selected=t,setTimeout(()=>{this.media&&(this.media.playbackRate=t)},0)}get speed(){return Number(this.media.playbackRate)}get minimumSpeed(){return this.isYouTube?Math.min(...this.options.speed):this.isVimeo?.5:.0625}get maximumSpeed(){return this.isYouTube?Math.max(...this.options.speed):this.isVimeo?2:16}set quality(i){const t=this.config.quality,s=this.options.quality;if(!s.length)return;let a=[!l.empty(i)&&Number(i),this.storage.get("quality"),t.selected,t.default].find(l.number),n=!0;if(!s.includes(a)){const r=at(s,a);this.debug.warn(`Unsupported quality option: ${a}, using ${r} instead`),a=r,n=!1}t.selected=a,this.media.quality=a,n&&this.storage.set({quality:a})}get quality(){return this.media.quality}set loop(i){const t=l.boolean(i)?i:this.config.loop.active;this.config.loop.active=t,this.media.loop=t}get loop(){return!!this.media.loop}set source(i){xe.change.call(this,i)}get source(){return this.media.currentSrc}get download(){const{download:i}=this.config.urls;return l.url(i)?i:this.source}set download(i){l.url(i)&&(this.config.urls.download=i,d.setDownloadUrl.call(this))}set poster(i){if(!this.isVideo){this.debug.warn("Poster can only be set for video");return}E.setPoster.call(this,i,!1).catch(()=>{})}get poster(){return this.isVideo?this.media.getAttribute("poster")||this.media.getAttribute("data-poster"):null}get ratio(){if(!this.isVideo)return null;const i=pe($e.call(this));return l.array(i)?i.join(":"):i}set ratio(i){if(!this.isVideo){this.debug.warn("Aspect ratio can only be set for video");return}if(!l.string(i)||!rt(i)){this.debug.error(`Invalid aspect ratio specified (${i})`);return}this.config.ratio=pe(i),Q.call(this)}set autoplay(i){this.config.autoplay=l.boolean(i)?i:this.config.autoplay}get autoplay(){return!!this.config.autoplay}toggleCaptions(i){A.toggle.call(this,i,!1)}set currentTrack(i){A.set.call(this,i,!1),A.setup.call(this)}get currentTrack(){const{toggled:i,currentTrack:t}=this.captions;return i?t:-1}set language(i){A.setLanguage.call(this,i,!1)}get language(){return(A.getCurrentTrack.call(this)||{}).language}set pip(i){if(!L.pip)return;const t=l.boolean(i)?i:!this.pip;l.function(this.media.webkitSetPresentationMode)&&this.media.webkitSetPresentationMode(t?ve.active:ve.inactive),l.function(this.media.requestPictureInPicture)&&(!this.pip&&t?this.media.requestPictureInPicture():this.pip&&!t&&document.exitPictureInPicture())}get pip(){return L.pip?l.empty(this.media.webkitPresentationMode)?this.media===document.pictureInPictureElement:this.media.webkitPresentationMode===ve.active:null}setPreviewThumbnails(i){this.previewThumbnails&&this.previewThumbnails.loaded&&(this.previewThumbnails.destroy(),this.previewThumbnails=null),Object.assign(this.config.previewThumbnails,i),this.config.previewThumbnails.enabled&&(this.previewThumbnails=new Pe(this))}static supported(i,t){return L.check(i,t)}static loadSprite(i,t){return ut(i,t)}static setup(i,t={}){let s=null;return l.string(i)?s=Array.from(document.querySelectorAll(i)):l.nodeList(i)?s=Array.from(i):l.array(i)&&(s=i.filter(l.element)),l.empty(s)?null:s.map(a=>new se(a,t))}}se.defaults=zt(pt);const Ei='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><symbol id="plyr-airplay" viewBox="0 0 18 18"><path d="M16 1H2a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h3v-2H3V3h12v8h-2v2h3a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1"/><path d="M4 17h10l-5-6z"/></symbol><symbol id="plyr-captions-off" viewBox="0 0 18 18"><path fill-opacity=".5" fill-rule="evenodd" d="M1 1c-.6 0-1 .4-1 1v11c0 .6.4 1 1 1h4.6l2.7 2.7c.2.2.4.3.7.3s.5-.1.7-.3l2.7-2.7H17c.6 0 1-.4 1-1V2c0-.6-.4-1-1-1zm4.52 10.15c1.99 0 3.01-1.32 3.28-2.41l-1.29-.39c-.19.66-.78 1.45-1.99 1.45-1.14 0-2.2-.83-2.2-2.34 0-1.61 1.12-2.37 2.18-2.37 1.23 0 1.78.75 1.95 1.43l1.3-.41C8.47 4.96 7.46 3.76 5.5 3.76c-1.9 0-3.61 1.44-3.61 3.7s1.65 3.69 3.63 3.69m7.57 0c1.99 0 3.01-1.32 3.28-2.41l-1.29-.39c-.19.66-.78 1.45-1.99 1.45-1.14 0-2.2-.83-2.2-2.34 0-1.61 1.12-2.37 2.18-2.37 1.23 0 1.78.75 1.95 1.43l1.3-.41c-.28-1.15-1.29-2.35-3.25-2.35-1.9 0-3.61 1.44-3.61 3.7s1.65 3.69 3.63 3.69"/></symbol><symbol id="plyr-captions-on" viewBox="0 0 18 18"><path fill-rule="evenodd" d="M1 1c-.6 0-1 .4-1 1v11c0 .6.4 1 1 1h4.6l2.7 2.7c.2.2.4.3.7.3s.5-.1.7-.3l2.7-2.7H17c.6 0 1-.4 1-1V2c0-.6-.4-1-1-1zm4.52 10.15c1.99 0 3.01-1.32 3.28-2.41l-1.29-.39c-.19.66-.78 1.45-1.99 1.45-1.14 0-2.2-.83-2.2-2.34 0-1.61 1.12-2.37 2.18-2.37 1.23 0 1.78.75 1.95 1.43l1.3-.41C8.47 4.96 7.46 3.76 5.5 3.76c-1.9 0-3.61 1.44-3.61 3.7s1.65 3.69 3.63 3.69m7.57 0c1.99 0 3.01-1.32 3.28-2.41l-1.29-.39c-.19.66-.78 1.45-1.99 1.45-1.14 0-2.2-.83-2.2-2.34 0-1.61 1.12-2.37 2.18-2.37 1.23 0 1.78.75 1.95 1.43l1.3-.41c-.28-1.15-1.29-2.35-3.25-2.35-1.9 0-3.61 1.44-3.61 3.7s1.65 3.69 3.63 3.69"/></symbol><symbol id="plyr-download" viewBox="0 0 18 18"><path d="M9 13c.3 0 .5-.1.7-.3L15.4 7 14 5.6l-4 4V1H8v8.6l-4-4L2.6 7l5.7 5.7c.2.2.4.3.7.3m-7 2h14v2H2z"/></symbol><symbol id="plyr-enter-fullscreen" viewBox="0 0 18 18"><path d="M10 3h3.6l-4 4L11 8.4l4-4V8h2V1h-7zM7 9.6l-4 4V10H1v7h7v-2H4.4l4-4z"/></symbol><symbol id="plyr-exit-fullscreen" viewBox="0 0 18 18"><path d="M1 12h3.6l-4 4L2 17.4l4-4V17h2v-7H1zM16 .6l-4 4V1h-2v7h7V6h-3.6l4-4z"/></symbol><symbol id="plyr-fast-forward" viewBox="0 0 18 18"><path d="M7.875 7.171 0 1v16l7.875-6.171V17L18 9 7.875 1z"/></symbol><symbol id="plyr-logo-vimeo" viewBox="0 0 18 18"><path d="M17 5.3c-.1 1.6-1.2 3.7-3.3 6.4-2.2 2.8-4 4.2-5.5 4.2-.9 0-1.7-.9-2.4-2.6C5 10.9 4.4 6 3 6c-.1 0-.5.3-1.2.8l-.8-1c.8-.7 3.5-3.4 4.7-3.5S7.7 3 8 4.8c.3 2 .8 6.1 1.8 6.1.9 0 2.5-3.4 2.6-4 .1-.9-.3-1.9-2.3-1.1.8-2.6 2.3-3.8 4.5-3.8q2.55.15 2.4 3.3"/></symbol><symbol id="plyr-logo-youtube" viewBox="0 0 18 18"><path d="M16.8 5.8c-.2-1.3-.8-2.2-2.2-2.4C12.4 3 9 3 9 3s-3.4 0-5.6.4C2 3.6 1.3 4.5 1.2 5.8 1 7.1 1 9 1 9s0 1.9.2 3.2.8 2.2 2.2 2.4C5.6 15 9 15 9 15s3.4 0 5.6-.4c1.4-.3 2-1.1 2.2-2.4S17 9 17 9s0-1.9-.2-3.2M7 12V6l5 3z"/></symbol><symbol id="plyr-muted" viewBox="0 0 18 18"><path d="m12.4 12.5 2.1-2.1 2.1 2.1 1.4-1.4L15.9 9 18 6.9l-1.4-1.4-2.1 2.1-2.1-2.1L11 6.9 13.1 9 11 11.1zM3.786 6.008H.714C.286 6.008 0 6.31 0 6.76v4.512c0 .452.286.752.714.752h3.072l4.071 3.858c.5.3 1.143 0 1.143-.602V2.752c0-.601-.643-.977-1.143-.601z"/></symbol><symbol id="plyr-pause" viewBox="0 0 18 18"><path d="M6 1H3c-.6 0-1 .4-1 1v14c0 .6.4 1 1 1h3c.6 0 1-.4 1-1V2c0-.6-.4-1-1-1m6 0c-.6 0-1 .4-1 1v14c0 .6.4 1 1 1h3c.6 0 1-.4 1-1V2c0-.6-.4-1-1-1z"/></symbol><symbol id="plyr-pip" viewBox="0 0 18 18"><path d="M13.293 3.293 7.022 9.564l1.414 1.414 6.271-6.271L17 7V1h-6z"/><path d="M13 15H3V5h5V3H2a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-6h-2z"/></symbol><symbol id="plyr-play" viewBox="0 0 18 18"><path d="M15.562 8.1 3.87.225c-.818-.562-1.87 0-1.87.9v15.75c0 .9 1.052 1.462 1.87.9L15.563 9.9c.584-.45.584-1.35 0-1.8"/></symbol><symbol id="plyr-restart" viewBox="0 0 18 18"><path d="m9.7 1.2.7 6.4 2.1-2.1c1.9 1.9 1.9 5.1 0 7-.9 1-2.2 1.5-3.5 1.5s-2.6-.5-3.5-1.5c-1.9-1.9-1.9-5.1 0-7 .6-.6 1.4-1.1 2.3-1.3l-.6-1.9C6 2.6 4.9 3.2 4 4.1 1.3 6.8 1.3 11.2 4 14c1.3 1.3 3.1 2 4.9 2 1.9 0 3.6-.7 4.9-2 2.7-2.7 2.7-7.1 0-9.9L16 1.9z"/></symbol><symbol id="plyr-rewind" viewBox="0 0 18 18"><path d="M10.125 1 0 9l10.125 8v-6.171L18 17V1l-7.875 6.171z"/></symbol><symbol id="plyr-settings" viewBox="0 0 18 18"><path d="M16.135 7.784a2 2 0 0 1-1.23-2.969c.322-.536.225-.998-.094-1.316l-.31-.31c-.318-.318-.78-.415-1.316-.094a2 2 0 0 1-2.969-1.23C10.065 1.258 9.669 1 9.219 1h-.438c-.45 0-.845.258-.997.865a2 2 0 0 1-2.969 1.23c-.536-.322-.999-.225-1.317.093l-.31.31c-.318.318-.415.781-.093 1.317a2 2 0 0 1-1.23 2.969C1.26 7.935 1 8.33 1 8.781v.438c0 .45.258.845.865.997a2 2 0 0 1 1.23 2.969c-.322.536-.225.998.094 1.316l.31.31c.319.319.782.415 1.316.094a2 2 0 0 1 2.969 1.23c.151.607.547.865.997.865h.438c.45 0 .845-.258.997-.865a2 2 0 0 1 2.969-1.23c.535.321.997.225 1.316-.094l.31-.31c.318-.318.415-.781.094-1.316a2 2 0 0 1 1.23-2.969c.607-.151.865-.547.865-.997v-.438c0-.451-.26-.846-.865-.997M9 12a3 3 0 1 1 0-6 3 3 0 0 1 0 6"/></symbol><symbol id="plyr-volume" viewBox="0 0 18 18"><path d="M15.6 3.3c-.4-.4-1-.4-1.4 0s-.4 1 0 1.4C15.4 5.9 16 7.4 16 9s-.6 3.1-1.8 4.3c-.4.4-.4 1 0 1.4.2.2.5.3.7.3.3 0 .5-.1.7-.3C17.1 13.2 18 11.2 18 9s-.9-4.2-2.4-5.7"/><path d="M11.282 5.282a.91.91 0 0 0 0 1.316c.735.735.995 1.458.995 2.402 0 .936-.425 1.917-.995 2.487a.91.91 0 0 0 0 1.316c.145.145.636.262 1.018.156a.7.7 0 0 0 .298-.156C13.773 11.733 14.13 10.16 14.13 9q.001-.255-.011-.51c-.053-.992-.319-2.005-1.522-3.208a.91.91 0 0 0-1.316 0m-7.495.726H.714C.286 6.008 0 6.31 0 6.76v4.512c0 .452.286.752.714.752h3.072l4.071 3.858c.5.3 1.143 0 1.143-.602V2.752c0-.601-.643-.977-1.143-.601z"/></symbol></svg>';function Pi({videoUrl:e,contentType:i,onClose:t,t:s}){const a=oe.useRef(null),n=oe.useRef(null);return oe.useEffect(()=>{if(!a.current)return;const r=new se(a.current,{controls:["play","progress","current-time","rewind","fast-forward"],seekTime:10,loadSprite:!1,iconUrl:"",i18n:{play:s("panel_video.controls.play"),pause:s("panel_video.controls.pause"),rewind:s("panel_video.controls.rewind"),fastForward:s("panel_video.controls.fast_forward")}});return()=>r.destroy()},[]),oe.useEffect(()=>{n.current?.focus();function r(o){o.key==="Escape"&&t()}return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[t]),K.jsxs("div",{className:"es-panel-video-overlay",role:"dialog","aria-modal":"true","data-testid":"panel-video-overlay",children:[K.jsx("div",{hidden:!0,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:Ei}}),K.jsx("button",{ref:n,type:"button",className:"es-panel-video-overlay__close","aria-label":s("panel_video.close"),title:s("panel_video.close"),onClick:t,children:K.jsx("span",{"aria-hidden":"true",children:"×"})}),K.jsx("div",{className:"es-panel-video-overlay__player",children:K.jsx("video",{ref:a,playsInline:!0,children:K.jsx("source",{src:e,type:i})})})]})}export{Pi as PanelVideoOverlay};
|
|
3
|
+
//# sourceMappingURL=PanelVideoOverlay-BY__oBYV-B8OPC1xh.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const b=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i;function f(n){const t=b.exec(n.trim())?.[1];if(t===void 0)throw new Error(`accent-legibility: not a hex colour: ${n}`);const r=t.length===3?t.replace(/./g,o=>o+o):t,e=o=>parseInt(r.slice(o,o+2),16);return[e(0),e(2),e(4)]}function E(n){return b.test(n.trim())}function h(n){const t=r=>Math.max(0,Math.min(255,Math.round(r)));return`#${n.map(r=>t(r).toString(16).padStart(2,"0")).join("")}`.toUpperCase()}function S(n){const[t,r,e]=f(n),o=i=>{const c=i/255;return c<=.04045?c/12.92:((c+.055)/1.055)**2.4};return .2126*o(t)+.7152*o(r)+.0722*o(e)}function d(n,t){const r=S(n),e=S(t);return(Math.max(r,e)+.05)/(Math.min(r,e)+.05)}function M(n,t,r){const[e,o,i]=f(n),[c,a,l]=f(r),s=(u,p)=>u*t+p*(1-t);return h([s(e,c),s(o,a),s(i,l)])}function x(n,t,r){const e=f(n),o=f(r),i=t*255,c=[...new Set([Math.floor(i),Math.ceil(i)])].map(s=>s/255),a=[],l=[];for(let s=0;s<3;s+=1){const u=e[s]??0,p=o[s]??0,F=c.map(w=>u*w+p*(1-w));a.push(Math.min(...F.map(Math.floor))),l.push(Math.max(...F.map(Math.ceil)))}return[h(a),h(l)]}function C(n,t){return`rgba(${f(n).join(", ")}, ${t})`}const m=256;function g(n,t){return t.reduce((r,e)=>Math.min(r,d(n,e)),1/0)}function $(n,t,r,e){const o=typeof t=="string"?[t]:t;if(g(n,o)>=r)return h(f(n));const i=e==="light"?"#000000":"#FFFFFF";for(let c=1;c<=m;c+=1){const a=M(i,c/m,n);if(g(a,o)>=r)return a}return h(f(i))}function y(n){const t=typeof n=="string"?[n]:n;if(t.length===0)throw new Error("accent-legibility: at least one tint surface is required");return t}function j(n,t,r){const e=o=>g(n,x(n,t,o));return y(r).reduce((o,i)=>e(i)<e(o)?i:o)}function T(n,t,r,e,o){const i=y(t),c=s=>[...new Set(i.flatMap(u=>x(s,r,u)))],a=o==="light"?"#000000":"#FFFFFF";for(let s=0;s<=m;s+=1){const u=s===0?h(f(n)):M(a,s/m,n),p=c(u);if(g(u,p)>=e)return{accent:u,composites:p}}const l=h(f(a));return{accent:l,composites:c(l)}}function A(n,t,r,e){const o=$(n,t,r,e);for(let i=1;i<=m;i+=1){const c=M(o,i/m,t);if(d(c,t)>=r)return c}return o}function k({accent:n,surface:t,backdrop:r,tintAlpha:e,mode:o}){const i=h(f(n)),{accent:c,composites:a}=T(i,t,e,4.5,o),{accent:l,composites:s}=T(i,t,.15,4.5,o),u=A(i,r,3,o),p=j(c,e,t);return{tint:C(c,e),tintComposites:a,tintComposite:M(c,e,p),worstSurface:p,onTint:c,onStrongTint:l,strongTintComposites:s,boundary:u,adjusted:c!==i,ratios:{onTint:g(c,a),onStrongTint:g(l,s),boundary:d(u,r)}}}export{$ as A,d as O,S,f,h as p,E as w,k as x};
|
|
2
|
+
//# sourceMappingURL=accent-legibility-BJF2VO5n-CDPQ7suO.js.map
|