index.33ec3ead.js 113 KB

12
  1. import{d as ft,i as j,F as Oe,L as $e,w as le,B as bt}from"./index.9a8e7555.js";const vt="_video_14tg9_1",wt="_loadingVideo_14tg9_23",_t="_playOver_14tg9_32",kt="_tips_14tg9_40",xt="_btn_14tg9_44",Tt="_freeTxt_14tg9_47",Ct="_freeRate_14tg9_53";var q={"video-container":"_video-container_14tg9_1",video:vt,loadingVideo:wt,playOver:_t,tips:kt,btn:xt,freeTxt:Tt,freeRate:Ct};function p(e,i,t){return i in e?Object.defineProperty(e,i,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[i]=t,e}function At(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 r=i[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function St(e,i,t){return i&&je(e.prototype,i),t&&je(e,t),e}function Pt(e,i,t){return i in e?Object.defineProperty(e,i,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[i]=t,e}function Re(e,i){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);i&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),t.push.apply(t,r)}return t}function De(e){for(var i=1;i<arguments.length;i++){var t=arguments[i]!=null?arguments[i]:{};i%2?Re(Object(t),!0).forEach(function(r){Pt(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):Re(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}var He={addCSS:!0,thumbWidth:15,watch:!0};function Et(e,i){return function(){return Array.from(document.querySelectorAll(i)).includes(this)}.call(e,i)}function Nt(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},Ee=function(e,i){return!!(e&&i&&e instanceof i)},We=function(e){return e==null},Ke=function(e){return ne(e)===Object},Mt=function(e){return ne(e)===Number&&!Number.isNaN(e)},Ye=function(e){return ne(e)===String},It=function(e){return ne(e)===Boolean},zt=function(e){return ne(e)===Function},Je=function(e){return Array.isArray(e)},Qe=function(e){return Ee(e,NodeList)},Lt=function(e){return Ee(e,Element)},Ot=function(e){return Ee(e,Event)},$t=function(e){return We(e)||(Ye(e)||Je(e)||Qe(e))&&!e.length||Ke(e)&&!Object.keys(e).length},O={nullOrUndefined:We,object:Ke,number:Mt,string:Ye,boolean:It,function:zt,array:Je,nodeList:Qe,element:Lt,event:Ot,empty:$t};function jt(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 Rt(e,i){if(1>i){var t=jt(i);return parseFloat(e.toFixed(t))}return Math.round(e/i)*i}var Dt=function(){function e(i,t){At(this,e),O.element(i)?this.element=i:O.string(i)&&(this.element=document.querySelector(i)),O.element(this.element)&&O.empty(this.element.rangeTouch)&&(this.config=De({},He,{},t),this.init())}return St(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,r=i?"addEventListener":"removeEventListener";["touchstart","touchmove","touchend"].forEach(function(s){t.element[r](s,function(n){return t.set(n)},!1)})}},{key:"get",value:function(i){if(!e.enabled||!O.event(i))return null;var t,r=i.target,s=i.changedTouches[0],n=parseFloat(r.getAttribute("min"))||0,o=parseFloat(r.getAttribute("max"))||100,l=parseFloat(r.getAttribute("step"))||1,c=r.getBoundingClientRect(),d=100/c.width*(this.config.thumbWidth/2)/100;return 0>(t=100/c.width*(s.clientX-c.left))?t=0:100<t&&(t=100),50>t?t-=(100-2*t)*d:50<t&&(t+=2*(t-50)*d),n+Rt(t/100*(o-n),l)}},{key:"set",value:function(i){e.enabled&&O.event(i)&&!i.target.disabled&&(i.preventDefault(),i.target.value=this.get(i),Nt(i.target,i.type==="touchend"?"change":"input"))}}],[{key:"setup",value:function(i){var t=1<arguments.length&&arguments[1]!==void 0?arguments[1]:{},r=null;if(O.empty(i)||O.string(i)?r=Array.from(document.querySelectorAll(O.string(i)?i:'input[type="range"]')):O.element(i)?r=[i]:O.nodeList(i)?r=Array.from(i):O.array(i)&&(r=i.filter(O.element)),O.empty(r))return null;var s=De({},He,{},t);if(O.string(i)&&s.watch){var n=new MutationObserver(function(o){Array.from(o).forEach(function(l){Array.from(l.addedNodes).forEach(function(c){O.element(c)&&Et(c,i)&&new e(c,s)})})});n.observe(document.body,{childList:!0,subtree:!0})}return r.map(function(o){return new e(o,t)})}},{key:"enabled",get:function(){return"ontouchstart"in document.documentElement}}]),e}();const Z=e=>e!=null?e.constructor:null,U=(e,i)=>Boolean(e&&i&&e instanceof i),Ne=e=>e==null,Xe=e=>Z(e)===Object,Ht=e=>Z(e)===Number&&!Number.isNaN(e),ge=e=>Z(e)===String,Ft=e=>Z(e)===Boolean,Ge=e=>Z(e)===Function,Ze=e=>Array.isArray(e),Vt=e=>U(e,WeakMap),et=e=>U(e,NodeList),qt=e=>Z(e)===Text,Bt=e=>U(e,Event),Ut=e=>U(e,KeyboardEvent),Wt=e=>U(e,window.TextTrackCue)||U(e,window.VTTCue),Kt=e=>U(e,TextTrack)||!Ne(e)&&ge(e.kind),Yt=e=>U(e,Promise)&&Ge(e.then),Jt=e=>e!==null&&typeof e=="object"&&e.nodeType===1&&typeof e.style=="object"&&typeof e.ownerDocument=="object",tt=e=>Ne(e)||(ge(e)||Ze(e)||et(e))&&!e.length||Xe(e)&&!Object.keys(e).length,Qt=e=>{if(U(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 a={nullOrUndefined:Ne,object:Xe,number:Ht,string:ge,boolean:Ft,function:Ge,array:Ze,weakMap:Vt,nodeList:et,element:Jt,textNode:qt,event:Bt,keyboardEvent:Ut,cue:Wt,track:Kt,promise:Yt,url:Qt,empty:tt};const ke=(()=>{const e=document.createElement("span"),i={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},t=Object.keys(i).find(r=>e.style[r]!==void 0);return!!a.string(t)&&i[t]})();function it(e,i){setTimeout(()=>{try{e.hidden=!0,e.offsetHeight,e.hidden=!1}catch{}},i)}const L={isIE:Boolean(window.document.documentMode),isEdge:window.navigator.userAgent.includes("Edge"),isWebkit:"WebkitAppearance"in document.documentElement.style&&!/Edge/.test(navigator.userAgent),isIPhone:/(iPhone|iPod)/gi.test(navigator.platform),isIos:navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1||/(iPad|iPhone|iPod)/gi.test(navigator.platform)};function Xt(e){return JSON.parse(JSON.stringify(e))}function rt(e,i){return i.split(".").reduce((t,r)=>t&&t[r],e)}function N(e={},...i){if(!i.length)return e;const t=i.shift();return a.object(t)?(Object.keys(t).forEach(r=>{a.object(t[r])?(Object.keys(e).includes(r)||Object.assign(e,{[r]:{}}),N(e[r],t[r])):Object.assign(e,{[r]:t[r]})}),N(e,...i)):e}function st(e,i){const t=e.length?e:[e];Array.from(t).reverse().forEach((r,s)=>{const n=s>0?i.cloneNode(!0):i,o=r.parentNode,l=r.nextSibling;n.appendChild(r),l?o.insertBefore(n,l):o.appendChild(n)})}function xe(e,i){a.element(e)&&!a.empty(i)&&Object.entries(i).filter(([,t])=>!a.nullOrUndefined(t)).forEach(([t,r])=>e.setAttribute(t,r))}function b(e,i,t){const r=document.createElement(e);return a.object(i)&&xe(r,i),a.string(t)&&(r.innerText=t),r}function Gt(e,i){a.element(e)&&a.element(i)&&i.parentNode.insertBefore(e,i.nextSibling)}function Fe(e,i,t,r){a.element(i)&&i.appendChild(b(e,t,r))}function B(e){a.nodeList(e)||a.array(e)?Array.from(e).forEach(B):a.element(e)&&a.element(e.parentNode)&&e.parentNode.removeChild(e)}function ce(e){if(!a.element(e))return;let{length:i}=e.childNodes;for(;i>0;)e.removeChild(e.lastChild),i-=1}function pe(e,i){return a.element(i)&&a.element(i.parentNode)&&a.element(e)?(i.parentNode.replaceChild(e,i),e):null}function H(e,i){if(!a.string(e)||a.empty(e))return{};const t={},r=N({},i);return e.split(",").forEach(s=>{const n=s.trim(),o=n.replace(".",""),l=n.replace(/[[\]]/g,"").split("="),[c]=l,d=l.length>1?l[1].replace(/["']/g,""):"";switch(n.charAt(0)){case".":a.string(r.class)?t.class=`${r.class} ${o}`:t.class=o;break;case"#":t.id=n.replace("#","");break;case"[":t[c]=d}}),N(r,t)}function Y(e,i){if(!a.element(e))return;let t=i;a.boolean(t)||(t=!e.hidden),e.hidden=t}function k(e,i,t){if(a.nodeList(e))return Array.from(e).map(r=>k(r,i,t));if(a.element(e)){let r="toggle";return t!==void 0&&(r=t?"add":"remove"),e.classList[r](i),e.classList.contains(i)}return!1}function he(e,i){return a.element(e)&&e.classList.contains(i)}function J(e,i){const{prototype:t}=Element;return(t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector||function(){return Array.from(document.querySelectorAll(i)).includes(this)}).call(e,i)}function Zt(e,i){const{prototype:t}=Element;return(t.closest||function(){let r=this;do{if(J.matches(r,i))return r;r=r.parentElement||r.parentNode}while(r!==null&&r.nodeType===1);return null}).call(e,i)}function Q(e){return this.elements.container.querySelectorAll(e)}function I(e){return this.elements.container.querySelector(e)}function be(e=null,i=!1){a.element(e)&&(e.focus({preventScroll:!0}),i&&k(e,this.config.classNames.tabFocus))}const Ve={"audio/ogg":"vorbis","audio/wav":"1","video/webm":"vp8, vorbis","video/mp4":"avc1.42E01E, mp4a.40.2","video/ogg":"theora"},E={audio:"canPlayType"in document.createElement("audio"),video:"canPlayType"in document.createElement("video"),check(e,i,t){const r=L.isIPhone&&t&&E.playsinline,s=E[e]||i!=="html5";return{api:s,ui:s&&E.rangeInput&&(e!=="video"||!L.isIPhone||r)}},pip:!(L.isIPhone||!a.function(b("video").webkitSetPresentationMode)&&(!document.pictureInPictureEnabled||b("video").disablePictureInPicture)),airplay:a.function(window.WebKitPlaybackTargetAvailabilityEvent),playsinline:"playsInline"in document.createElement("video"),mime(e){if(a.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 Boolean(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:ke!==!1,reducedMotion:"matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches},ei=(()=>{let e=!1;try{const i=Object.defineProperty({},"passive",{get:()=>(e=!0,null)});window.addEventListener("test",null,i),window.removeEventListener("test",null,i)}catch{}return e})();function X(e,i,t,r=!1,s=!0,n=!1){if(!e||!("addEventListener"in e)||a.empty(i)||!a.function(t))return;const o=i.split(" ");let l=n;ei&&(l={passive:s,capture:n}),o.forEach(c=>{this&&this.eventListeners&&r&&this.eventListeners.push({element:e,type:c,callback:t,options:l}),e[r?"addEventListener":"removeEventListener"](c,t,l)})}function _(e,i="",t,r=!0,s=!1){X.call(this,e,i,t,!0,r,s)}function ye(e,i="",t,r=!0,s=!1){X.call(this,e,i,t,!1,r,s)}function Me(e,i="",t,r=!0,s=!1){const n=(...o)=>{ye(e,i,n,r,s),t.apply(this,o)};X.call(this,e,i,n,!0,r,s)}function f(e,i="",t=!1,r={}){if(!a.element(e)||a.empty(i))return;const s=new CustomEvent(i,{bubbles:t,detail:{...r,plyr:this}});e.dispatchEvent(s)}function ti(){this&&this.eventListeners&&(this.eventListeners.forEach(e=>{const{element:i,type:t,callback:r,options:s}=e;i.removeEventListener(t,r,s)}),this.eventListeners=[])}function ii(){return new Promise(e=>this.ready?setTimeout(e,0):_.call(this,this.elements.container,"ready",e)).then(()=>{})}function V(e){a.promise(e)&&e.then(null,()=>{})}function Te(e){return a.array(e)?e.filter((i,t)=>e.indexOf(i)===t):e}function nt(e,i){return a.array(e)&&e.length?e.reduce((t,r)=>Math.abs(r-i)<Math.abs(t-i)?r:t):null}function at(e){return!(!window||!window.CSS)&&window.CSS.supports(e)}const qe=[[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 ot(e){return a.array(e)||a.string(e)&&e.includes(":")?(a.array(e)?e:e.split(":")).map(Number).every(a.number):!1}function me(e){if(!a.array(e)||!e.every(a.number))return null;const[i,t]=e,r=(n,o)=>o===0?n:r(o,n%o),s=r(i,t);return[i/s,t/s]}function Ie(e){const i=r=>ot(r)?r.split(":").map(Number):null;let t=i(e);if(t===null&&(t=i(this.config.ratio)),t===null&&!a.empty(this.embed)&&a.array(this.embed.ratio)&&({ratio:t}=this.embed),t===null&&this.isHTML5){const{videoWidth:r,videoHeight:s}=this.media;t=[r,s]}return me(t)}function G(e){if(!this.isVideo)return{};const{wrapper:i}=this.elements,t=Ie.call(this,e);if(!a.array(t))return{};const[r,s]=me(t),n=100/r*s;if(at(`aspect-ratio: ${r}/${s}`)?i.style.aspectRatio=`${r}/${s}`:i.style.paddingBottom=`${n}%`,this.isVimeo&&!this.config.vimeo.premium&&this.supported.ui){const o=100/this.media.offsetWidth*parseInt(window.getComputedStyle(this.media).paddingBottom,10),l=(o-n)/(o/50);this.fullscreen.active?i.style.paddingBottom=null:this.media.style.transform=`translateY(-${l}%)`}else this.isHTML5&&i.classList.add(this.config.classNames.videoFixedRatio);return{padding:n,ratio:t}}function lt(e,i,t=.05){const r=e/i,s=nt(Object.keys(qe),r);return Math.abs(s-r)<=t?qe[s]:[e,i]}function ri(){return[Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)]}const K={getSources(){return this.isHTML5?Array.from(this.media.querySelectorAll("source")).filter(e=>{const i=e.getAttribute("type");return!!a.empty(i)||E.mime.call(this,i)}):[]},getQualityOptions(){return this.config.quality.forced?this.config.quality.options:K.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,a.empty(this.config.ratio)||G.call(e),Object.defineProperty(e.media,"quality",{get(){const i=K.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&&a.function(e.config.quality.onChange))e.config.quality.onChange(i);else{const t=K.getSources.call(e).find(c=>Number(c.getAttribute("size"))===i);if(!t)return;const{currentTime:r,paused:s,preload:n,readyState:o,playbackRate:l}=e.media;e.media.src=t.getAttribute("src"),(n!=="none"||o)&&(e.once("loadedmetadata",()=>{e.speed=l,e.currentTime=r,s||V(e.play())}),e.media.load())}f.call(e,e.media,"qualitychange",!1,{quality:i})}}})},cancelRequests(){this.isHTML5&&(B(K.getSources.call(this)),this.media.setAttribute("src",this.config.blankVideo),this.media.load(),this.debug.log("Cancelled network requests"))}};function si(e){return`${e}-${Math.floor(1e4*Math.random())}`}function Ce(e,...i){return a.empty(e)?e:e.toString().replace(/{(\d+)}/g,(t,r)=>i[r].toString())}function ni(e,i){return e===0||i===0||Number.isNaN(e)||Number.isNaN(i)?0:(e/i*100).toFixed(2)}const ie=(e="",i="",t="")=>e.replace(new RegExp(i.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1"),"g"),t.toString()),ct=(e="")=>e.toString().replace(/\w\S*/g,i=>i.charAt(0).toUpperCase()+i.substr(1).toLowerCase());function ai(e=""){let i=e.toString();return i=ie(i,"-"," "),i=ie(i,"_"," "),i=ct(i),ie(i," ","")}function oi(e=""){let i=e.toString();return i=ai(i),i.charAt(0).toLowerCase()+i.slice(1)}function li(e){const i=document.createDocumentFragment(),t=document.createElement("div");return i.appendChild(t),t.innerHTML=e,i.firstChild.innerText}function ci(e){const i=document.createElement("div");return i.appendChild(e),i.innerHTML}const Be={pip:"PIP",airplay:"AirPlay",html5:"HTML5",vimeo:"Vimeo",youtube:"YouTube"},z={get(e="",i={}){if(a.empty(e)||a.empty(i))return"";let t=rt(i.i18n,e);if(a.empty(t))return Object.keys(Be).includes(e)?Be[e]:"";const r={"{seektime}":i.seekTime,"{title}":i.title};return Object.entries(r).forEach(([s,n])=>{t=ie(t,s,n)}),t}};class re{constructor(i){p(this,"get",t=>{if(!re.supported||!this.enabled)return null;const r=window.localStorage.getItem(this.key);if(a.empty(r))return null;const s=JSON.parse(r);return a.string(t)&&t.length?s[t]:s}),p(this,"set",t=>{if(!re.supported||!this.enabled||!a.object(t))return;let r=this.get();a.empty(r)&&(r={}),N(r,t);try{window.localStorage.setItem(this.key,JSON.stringify(r))}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 ae(e,i="text"){return new Promise((t,r)=>{try{const s=new XMLHttpRequest;if(!("withCredentials"in s))return;s.addEventListener("load",()=>{if(i==="text")try{t(JSON.parse(s.responseText))}catch{t(s.responseText)}else t(s.response)}),s.addEventListener("error",()=>{throw new Error(s.status)}),s.open("GET",e,!0),s.responseType=i,s.send()}catch(s){r(s)}})}function dt(e,i){if(!a.string(e))return;const t=a.string(i);let r=!1;const s=()=>document.getElementById(i)!==null,n=(o,l)=>{o.innerHTML=l,t&&s()||document.body.insertAdjacentElement("afterbegin",o)};if(!t||!s()){const o=re.supported,l=document.createElement("div");if(l.setAttribute("hidden",""),t&&l.setAttribute("id",i),o){const c=window.localStorage.getItem(`cache-${i}`);if(r=c!==null,r){const d=JSON.parse(c);n(l,d.content)}}ae(e).then(c=>{if(!a.empty(c)){if(o)try{window.localStorage.setItem(`cache-${i}`,JSON.stringify({content:c}))}catch{}n(l,c)}}).catch(()=>{})}}const ut=e=>Math.trunc(e/60/60%60,10),di=e=>Math.trunc(e%60,10);function fe(e=0,i=!1,t=!1){if(!a.number(e))return fe(void 0,i,t);const r=c=>`0${c}`.slice(-2);let s=ut(e);const n=(o=e,Math.trunc(o/60%60,10));var o;const l=di(e);return s=i||s>0?`${s}:`:"",`${t&&e>0?"-":""}${s}${r(n)}:${r(l)}`}const u={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||L.isIE&&!window.svg4everybody;return{url:this.config.iconUrl,cors:t}},findElements(){try{return this.elements.controls=I.call(this,this.config.selectors.controls.wrapper),this.elements.buttons={play:Q.call(this,this.config.selectors.buttons.play),pause:I.call(this,this.config.selectors.buttons.pause),restart:I.call(this,this.config.selectors.buttons.restart),rewind:I.call(this,this.config.selectors.buttons.rewind),fastForward:I.call(this,this.config.selectors.buttons.fastForward),mute:I.call(this,this.config.selectors.buttons.mute),pip:I.call(this,this.config.selectors.buttons.pip),airplay:I.call(this,this.config.selectors.buttons.airplay),settings:I.call(this,this.config.selectors.buttons.settings),captions:I.call(this,this.config.selectors.buttons.captions),fullscreen:I.call(this,this.config.selectors.buttons.fullscreen)},this.elements.progress=I.call(this,this.config.selectors.progress),this.elements.inputs={seek:I.call(this,this.config.selectors.inputs.seek),volume:I.call(this,this.config.selectors.inputs.volume)},this.elements.display={buffer:I.call(this,this.config.selectors.display.buffer),currentTime:I.call(this,this.config.selectors.display.currentTime),duration:I.call(this,this.config.selectors.display.duration)},a.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",r=u.getIconUrl.call(this),s=`${r.cors?"":r.url}#${this.config.iconPrefix}`,n=document.createElementNS(t,"svg");xe(n,N(i,{"aria-hidden":"true",focusable:"false"}));const o=document.createElementNS(t,"use"),l=`${s}-${e}`;return"href"in o&&o.setAttributeNS("http://www.w3.org/1999/xlink","href",l),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l),n.appendChild(o),n},createLabel(e,i={}){const t=z.get(e,this.config);return b("span",{...i,class:[i.class,this.config.classNames.hidden].filter(Boolean).join(" ")},t)},createBadge(e){if(a.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 r=oi(e);const s={element:"button",toggle:!1,label:null,icon:null,labelPressed:null,iconPressed:null};switch(["element","icon","label"].forEach(o=>{Object.keys(t).includes(o)&&(s[o]=t[o],delete t[o])}),s.element!=="button"||Object.keys(t).includes("type")||(t.type="button"),Object.keys(t).includes("class")?t.class.split(" ").some(o=>o===this.config.classNames.control)||N(t,{class:`${t.class} ${this.config.classNames.control}`}):t.class=this.config.classNames.control,e){case"play":s.toggle=!0,s.label="play",s.labelPressed="pause",s.icon="play",s.iconPressed="pause";break;case"mute":s.toggle=!0,s.label="mute",s.labelPressed="unmute",s.icon="volume",s.iconPressed="muted";break;case"captions":s.toggle=!0,s.label="enableCaptions",s.labelPressed="disableCaptions",s.icon="captions-off",s.iconPressed="captions-on";break;case"fullscreen":s.toggle=!0,s.label="enterFullscreen",s.labelPressed="exitFullscreen",s.icon="enter-fullscreen",s.iconPressed="exit-fullscreen";break;case"play-large":t.class+=` ${this.config.classNames.control}--overlaid`,r="play",s.label="play",s.icon="play";break;default:a.empty(s.label)&&(s.label=r),a.empty(s.icon)&&(s.icon=e)}const n=b(s.element);return s.toggle?(n.appendChild(u.createIcon.call(this,s.iconPressed,{class:"icon--pressed"})),n.appendChild(u.createIcon.call(this,s.icon,{class:"icon--not-pressed"})),n.appendChild(u.createLabel.call(this,s.labelPressed,{class:"label--pressed"})),n.appendChild(u.createLabel.call(this,s.label,{class:"label--not-pressed"}))):(n.appendChild(u.createIcon.call(this,s.icon)),n.appendChild(u.createLabel.call(this,s.label))),N(t,H(this.config.selectors.buttons[r],t)),xe(n,t),r==="play"?(a.array(this.elements.buttons[r])||(this.elements.buttons[r]=[]),this.elements.buttons[r].push(n)):this.elements.buttons[r]=n,n},createRange(e,i){const t=b("input",N(H(this.config.selectors.inputs[e]),{type:"range",min:0,max:100,step:.01,value:0,autocomplete:"off",role:"slider","aria-label":z.get(e,this.config),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0},i));return this.elements.inputs[e]=t,u.updateRangeFill.call(this,t),Dt.setup(t),t},createProgress(e,i){const t=b("progress",N(H(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 r={played:"played",buffer:"buffered"}[e],s=r?z.get(r,this.config):"";t.innerText=`% ${s.toLowerCase()}`}return this.elements.display[e]=t,t},createTime(e,i){const t=H(this.config.selectors.display[e],i),r=b("div",N(t,{class:`${t.class?t.class:""} ${this.config.classNames.display.time} `.trim(),"aria-label":z.get(e,this.config)}),"00:00");return this.elements.display[e]=r,r},bindMenuItemShortcuts(e,i){_.call(this,e,"keydown keyup",t=>{if(![32,38,39,40].includes(t.which)||(t.preventDefault(),t.stopPropagation(),t.type==="keydown"))return;const r=J(e,'[role="menuitemradio"]');if(!r&&[32,39].includes(t.which))u.showMenuPanel.call(this,i,!0);else{let s;t.which!==32&&(t.which===40||r&&t.which===39?(s=e.nextElementSibling,a.element(s)||(s=e.parentNode.firstElementChild)):(s=e.previousElementSibling,a.element(s)||(s=e.parentNode.lastElementChild)),be.call(this,s,!0))}},!1),_.call(this,e,"keyup",t=>{t.which===13&&u.focusFirstMenuItem.call(this,null,!0)})},createMenuItem({value:e,list:i,type:t,title:r,badge:s=null,checked:n=!1}){const o=H(this.config.selectors.inputs[t]),l=b("button",N(o,{type:"button",role:"menuitemradio",class:`${this.config.classNames.control} ${o.class?o.class:""}`.trim(),"aria-checked":n,value:e})),c=b("span");c.innerHTML=r,a.element(s)&&c.appendChild(s),l.appendChild(c),Object.defineProperty(l,"checked",{enumerable:!0,get:()=>l.getAttribute("aria-checked")==="true",set(d){d&&Array.from(l.parentNode.children).filter(g=>J(g,'[role="menuitemradio"]')).forEach(g=>g.setAttribute("aria-checked","false")),l.setAttribute("aria-checked",d?"true":"false")}}),this.listeners.bind(l,"click keyup",d=>{if(!a.keyboardEvent(d)||d.which===32){switch(d.preventDefault(),d.stopPropagation(),l.checked=!0,t){case"language":this.currentTrack=Number(e);break;case"quality":this.quality=e;break;case"speed":this.speed=parseFloat(e)}u.showMenuPanel.call(this,"home",a.keyboardEvent(d))}},t,!1),u.bindMenuItemShortcuts.call(this,l,t),i.appendChild(l)},formatTime(e=0,i=!1){return a.number(e)?fe(e,ut(this.duration)>0,i):e},updateTimeDisplay(e=null,i=0,t=!1){a.element(e)&&a.number(i)&&(e.innerText=u.formatTime(i,t))},updateVolume(){this.supported.ui&&(a.element(this.elements.inputs.volume)&&u.setRange.call(this,this.elements.inputs.volume,this.muted?0:this.volume),a.element(this.elements.buttons.mute)&&(this.elements.buttons.mute.pressed=this.muted||this.volume===0))},setRange(e,i=0){a.element(e)&&(e.value=i,u.updateRangeFill.call(this,e))},updateProgress(e){if(!this.supported.ui||!a.event(e))return;let i=0;const t=(r,s)=>{const n=a.number(s)?s:0,o=a.element(r)?r:this.elements.display.buffer;if(a.element(o)){o.value=n;const l=o.getElementsByTagName("span")[0];a.element(l)&&(l.childNodes[0].nodeValue=n)}};if(e)switch(e.type){case"timeupdate":case"seeking":case"seeked":i=ni(this.currentTime,this.duration),e.type==="timeupdate"&&u.setRange.call(this,this.elements.inputs.seek,i);break;case"playing":case"progress":t(this.elements.display.buffer,100*this.buffered)}},updateRangeFill(e){const i=a.event(e)?e.target:e;if(a.element(i)&&i.getAttribute("type")==="range"){if(J(i,this.config.selectors.inputs.seek)){i.setAttribute("aria-valuenow",this.currentTime);const t=u.formatTime(this.currentTime),r=u.formatTime(this.duration),s=z.get("seekLabel",this.config);i.setAttribute("aria-valuetext",s.replace("{currentTime}",t).replace("{duration}",r))}else if(J(i,this.config.selectors.inputs.volume)){const t=100*i.value;i.setAttribute("aria-valuenow",t),i.setAttribute("aria-valuetext",`${t.toFixed(1)}%`)}else i.setAttribute("aria-valuenow",i.value);L.isWebkit&&i.style.setProperty("--value",i.value/i.max*100+"%")}},updateSeekTooltip(e){if(!this.config.tooltips.seek||!a.element(this.elements.inputs.seek)||!a.element(this.elements.display.seekTooltip)||this.duration===0)return;const i=`${this.config.classNames.tooltip}--visible`,t=n=>k(this.elements.display.seekTooltip,i,n);if(this.touch)return void t(!1);let r=0;const s=this.elements.progress.getBoundingClientRect();if(a.event(e))r=100/s.width*(e.pageX-s.left);else{if(!he(this.elements.display.seekTooltip,i))return;r=parseFloat(this.elements.display.seekTooltip.style.left,10)}r<0?r=0:r>100&&(r=100),u.updateTimeDisplay.call(this,this.elements.display.seekTooltip,this.duration/100*r),this.elements.display.seekTooltip.style.left=`${r}%`,a.event(e)&&["mouseenter","mouseleave"].includes(e.type)&&t(e.type==="mouseenter")},timeUpdate(e){const i=!a.element(this.elements.display.duration)&&this.config.invertTime;u.updateTimeDisplay.call(this,this.elements.display.currentTime,i?this.duration-this.currentTime:this.currentTime,i),e&&e.type==="timeupdate"&&this.media.seeking||u.updateProgress.call(this,e)},durationUpdate(){if(!this.supported.ui||!this.config.invertTime&&this.currentTime)return;if(this.duration>=2**32)return Y(this.elements.display.currentTime,!0),void Y(this.elements.progress,!0);a.element(this.elements.inputs.seek)&&this.elements.inputs.seek.setAttribute("aria-valuemax",this.duration);const e=a.element(this.elements.display.duration);!e&&this.config.displayDuration&&this.paused&&u.updateTimeDisplay.call(this,this.elements.display.currentTime,this.duration),e&&u.updateTimeDisplay.call(this,this.elements.display.duration,this.duration),u.updateSeekTooltip.call(this)},toggleMenuButton(e,i){Y(this.elements.settings.buttons[e],!i)},updateSetting(e,i,t){const r=this.elements.settings.panels[e];let s=null,n=i;if(e==="captions")s=this.currentTrack;else{if(s=a.empty(t)?this[e]:t,a.empty(s)&&(s=this.config[e].default),!a.empty(this.options[e])&&!this.options[e].includes(s))return void this.debug.warn(`Unsupported value of '${s}' for ${e}`);if(!this.config[e].options.includes(s))return void this.debug.warn(`Disabled value of '${s}' for ${e}`)}if(a.element(n)||(n=r&&r.querySelector('[role="menu"]')),!a.element(n))return;this.elements.settings.buttons[e].querySelector(`.${this.config.classNames.menu.value}`).innerHTML=u.getLabel.call(this,e,s);const o=n&&n.querySelector(`[value="${s}"]`);a.element(o)&&(o.checked=!0)},getLabel(e,i){switch(e){case"speed":return i===1?z.get("normal",this.config):`${i}&times;`;case"quality":if(a.number(i)){const t=z.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(!a.element(this.elements.settings.panels.quality))return;const i="quality",t=this.elements.settings.panels.quality.querySelector('[role="menu"]');a.array(e)&&(this.options.quality=Te(e).filter(n=>this.config.quality.options.includes(n)));const r=!a.empty(this.options.quality)&&this.options.quality.length>1;if(u.toggleMenuButton.call(this,i,r),ce(t),u.checkMenu.call(this),!r)return;const s=n=>{const o=z.get(`qualityBadge.${n}`,this.config);return o.length?u.createBadge.call(this,o):null};this.options.quality.sort((n,o)=>{const l=this.config.quality.options;return l.indexOf(n)>l.indexOf(o)?1:-1}).forEach(n=>{u.createMenuItem.call(this,{value:n,list:t,type:i,title:u.getLabel.call(this,"quality",n),badge:s(n)})}),u.updateSetting.call(this,i,t)},setCaptionsMenu(){if(!a.element(this.elements.settings.panels.captions))return;const e="captions",i=this.elements.settings.panels.captions.querySelector('[role="menu"]'),t=A.getTracks.call(this),r=Boolean(t.length);if(u.toggleMenuButton.call(this,e,r),ce(i),u.checkMenu.call(this),!r)return;const s=t.map((n,o)=>({value:o,checked:this.captions.toggled&&this.currentTrack===o,title:A.getLabel.call(this,n),badge:n.language&&u.createBadge.call(this,n.language.toUpperCase()),list:i,type:"language"}));s.unshift({value:-1,checked:!this.captions.toggled,title:z.get("disabled",this.config),list:i,type:"language"}),s.forEach(u.createMenuItem.bind(this)),u.updateSetting.call(this,e,i)},setSpeedMenu(){if(!a.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(r=>r>=this.minimumSpeed&&r<=this.maximumSpeed);const t=!a.empty(this.options.speed)&&this.options.speed.length>1;u.toggleMenuButton.call(this,e,t),ce(i),u.checkMenu.call(this),t&&(this.options.speed.forEach(r=>{u.createMenuItem.call(this,{value:r,list:i,type:e,title:u.getLabel.call(this,"speed",r)})}),u.updateSetting.call(this,e,i))},checkMenu(){const{buttons:e}=this.elements.settings,i=!a.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;a.element(t)||(t=Object.values(this.elements.settings.panels).find(s=>!s.hidden));const r=t.querySelector('[role^="menuitem"]');be.call(this,r,i)},toggleMenu(e){const{popup:i}=this.elements.settings,t=this.elements.buttons.settings;if(!a.element(i)||!a.element(t))return;const{hidden:r}=i;let s=r;if(a.boolean(e))s=e;else if(a.keyboardEvent(e)&&e.which===27)s=!1;else if(a.event(e)){const n=a.function(e.composedPath)?e.composedPath()[0]:e.target,o=i.contains(n);if(o||!o&&e.target!==t&&s)return}t.setAttribute("aria-expanded",s),Y(i,!s),k(this.elements.container,this.config.classNames.menu.open,s),s&&a.keyboardEvent(e)?u.focusFirstMenuItem.call(this,null,!0):s||r||be.call(this,t,a.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,r=i.scrollHeight;return B(i),{width:t,height:r}},showMenuPanel(e="",i=!1){const t=this.elements.container.querySelector(`#plyr-settings-${this.id}-${e}`);if(!a.element(t))return;const r=t.parentNode,s=Array.from(r.children).find(n=>!n.hidden);if(E.transitions&&!E.reducedMotion){r.style.width=`${s.scrollWidth}px`,r.style.height=`${s.scrollHeight}px`;const n=u.getMenuSize.call(this,t),o=l=>{l.target===r&&["width","height"].includes(l.propertyName)&&(r.style.width="",r.style.height="",ye.call(this,r,ke,o))};_.call(this,r,ke,o),r.style.width=`${n.width}px`,r.style.height=`${n.height}px`}Y(s,!0),Y(t,!1),u.focusFirstMenuItem.call(this,t,i)},setDownloadUrl(){const e=this.elements.buttons.download;a.element(e)&&e.setAttribute("href",this.download)},create(e){const{bindMenuItemShortcuts:i,createButton:t,createProgress:r,createRange:s,createTime:n,setQualityMenu:o,setSpeedMenu:l,showMenuPanel:c}=u;this.elements.controls=null,a.array(this.config.controls)&&this.config.controls.includes("play-large")&&this.elements.container.appendChild(t.call(this,"play-large"));const d=b("div",H(this.config.selectors.controls.wrapper));this.elements.controls=d;const g={class:"plyr__controls__item"};return Te(a.array(this.config.controls)?this.config.controls:[]).forEach(y=>{if(y==="restart"&&d.appendChild(t.call(this,"restart",g)),y==="rewind"&&d.appendChild(t.call(this,"rewind",g)),y==="play"&&d.appendChild(t.call(this,"play",g)),y==="fast-forward"&&d.appendChild(t.call(this,"fast-forward",g)),y==="progress"){const h=b("div",{class:`${g.class} plyr__progress__container`}),w=b("div",H(this.config.selectors.progress));if(w.appendChild(s.call(this,"seek",{id:`plyr-seek-${e.id}`})),w.appendChild(r.call(this,"buffer")),this.config.tooltips.seek){const x=b("span",{class:this.config.classNames.tooltip},"00:00");w.appendChild(x),this.elements.display.seekTooltip=x}this.elements.progress=w,h.appendChild(this.elements.progress),d.appendChild(h)}if(y==="current-time"&&d.appendChild(n.call(this,"currentTime",g)),y==="duration"&&d.appendChild(n.call(this,"duration",g)),y==="mute"||y==="volume"){let{volume:h}=this.elements;if(a.element(h)&&d.contains(h)||(h=b("div",N({},g,{class:`${g.class} plyr__volume`.trim()})),this.elements.volume=h,d.appendChild(h)),y==="mute"&&h.appendChild(t.call(this,"mute")),y==="volume"&&!L.isIos){const w={max:1,step:.05,value:this.config.volume};h.appendChild(s.call(this,"volume",N(w,{id:`plyr-volume-${e.id}`})))}}if(y==="captions"&&d.appendChild(t.call(this,"captions",g)),y==="settings"&&!a.empty(this.config.settings)){const h=b("div",N({},g,{class:`${g.class} plyr__menu`.trim(),hidden:""}));h.appendChild(t.call(this,"settings",{"aria-haspopup":!0,"aria-controls":`plyr-settings-${e.id}`,"aria-expanded":!1}));const w=b("div",{class:"plyr__menu__container",id:`plyr-settings-${e.id}`,hidden:""}),x=b("div"),T=b("div",{id:`plyr-settings-${e.id}-home`}),P=b("div",{role:"menu"});T.appendChild(P),x.appendChild(T),this.elements.settings.panels.home=T,this.config.settings.forEach(v=>{const m=b("button",N(H(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,m,v),_.call(this,m,"click",()=>{c.call(this,v,!1)});const C=b("span",null,z.get(v,this.config)),M=b("span",{class:this.config.classNames.menu.value});M.innerHTML=e[v],C.appendChild(M),m.appendChild(C),P.appendChild(m);const $=b("div",{id:`plyr-settings-${e.id}-${v}`,hidden:""}),R=b("button",{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--back`});R.appendChild(b("span",{"aria-hidden":!0},z.get(v,this.config))),R.appendChild(b("span",{class:this.config.classNames.hidden},z.get("menuBack",this.config))),_.call(this,$,"keydown",D=>{D.which===37&&(D.preventDefault(),D.stopPropagation(),c.call(this,"home",!0))},!1),_.call(this,R,"click",()=>{c.call(this,"home",!1)}),$.appendChild(R),$.appendChild(b("div",{role:"menu"})),x.appendChild($),this.elements.settings.buttons[v]=m,this.elements.settings.panels[v]=$}),w.appendChild(x),h.appendChild(w),d.appendChild(h),this.elements.settings.popup=w,this.elements.settings.menu=h}if(y==="pip"&&E.pip&&d.appendChild(t.call(this,"pip",g)),y==="airplay"&&E.airplay&&d.appendChild(t.call(this,"airplay",g)),y==="download"){const h=N({},g,{element:"a",href:this.download,target:"_blank"});this.isHTML5&&(h.download="");const{download:w}=this.config.urls;!a.url(w)&&this.isEmbed&&N(h,{icon:`logo-${this.provider}`,label:this.provider}),d.appendChild(t.call(this,"download",h))}y==="fullscreen"&&d.appendChild(t.call(this,"fullscreen",g))}),this.isHTML5&&o.call(this,K.getQualityOptions.call(this)),l.call(this),d},inject(){if(this.config.loadSprite){const s=u.getIconUrl.call(this);s.cors&&dt(s.url,"sprite-plyr")}this.id=Math.floor(1e4*Math.random());let e=null;this.elements.controls=null;const i={id:this.id,seektime:this.config.seekTime,title:this.config.title};let t=!0;a.function(this.config.controls)&&(this.config.controls=this.config.controls.call(this,i)),this.config.controls||(this.config.controls=[]),a.element(this.config.controls)||a.string(this.config.controls)?e=this.config.controls:(e=u.create.call(this,{id:this.id,seektime:this.config.seekTime,speed:this.speed,quality:this.quality,captions:A.getLabel.call(this)}),t=!1);let r;if(t&&a.string(this.config.controls)&&(e=(s=>{let n=s;return Object.entries(i).forEach(([o,l])=>{n=ie(n,`{${o}}`,l)}),n})(e)),a.string(this.config.selectors.controls.container)&&(r=document.querySelector(this.config.selectors.controls.container)),a.element(r)||(r=this.elements.container),r[a.element(e)?"insertAdjacentElement":"insertAdjacentHTML"]("afterbegin",e),a.element(this.elements.controls)||u.findElements.call(this),!a.empty(this.elements.buttons)){const s=n=>{const o=this.config.classNames.controlPressed;Object.defineProperty(n,"pressed",{enumerable:!0,get:()=>he(n,o),set(l=!1){k(n,o,l)}})};Object.values(this.elements.buttons).filter(Boolean).forEach(n=>{a.array(n)||a.nodeList(n)?Array.from(n).filter(Boolean).forEach(s):s(n)})}if(L.isEdge&&it(r),this.config.tooltips.controls){const{classNames:s,selectors:n}=this.config,o=`${n.controls.wrapper} ${n.labels} .${s.hidden}`,l=Q.call(this,o);Array.from(l).forEach(c=>{k(c,this.config.classNames.hidden,!1),k(c,this.config.classNames.tooltip,!0)})}}};function pt(e,i=!0){let t=e;if(i){const r=document.createElement("a");r.href=t,t=r.href}try{return new URL(t)}catch{return null}}function ht(e){const i=new URLSearchParams;return a.object(e)&&Object.entries(e).forEach(([t,r])=>{i.set(t,r)}),i}const A={setup(){if(!this.supported.ui)return;if(!this.isVideo||this.isYouTube||this.isHTML5&&!E.textTracks)return void(a.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&u.setCaptionsMenu.call(this));if(a.element(this.elements.captions)||(this.elements.captions=b("div",H(this.config.selectors.captions)),Gt(this.elements.captions,this.elements.wrapper)),L.isIE&&window.URL){const r=this.media.querySelectorAll("track");Array.from(r).forEach(s=>{const n=s.getAttribute("src"),o=pt(n);o!==null&&o.hostname!==window.location.href.hostname&&["http:","https:"].includes(o.protocol)&&ae(n,"blob").then(l=>{s.setAttribute("src",window.URL.createObjectURL(l))}).catch(()=>{B(s)})})}const e=Te((navigator.languages||[navigator.language||navigator.userLanguage||"en"]).map(r=>r.split("-")[0]));let i=(this.storage.get("language")||this.config.captions.language||"auto").toLowerCase();i==="auto"&&([i]=e);let t=this.storage.get("captions");if(a.boolean(t)||({active:t}=this.config.captions),Object.assign(this.captions,{toggled:!1,active:t,language:i,languages:e}),this.isHTML5){const r=this.config.captions.update?"addtrack removetrack":"removetrack";_.call(this,this.media.textTracks,r,A.update.bind(this))}setTimeout(A.update.bind(this),0)},update(){const e=A.getTracks.call(this,!0),{active:i,language:t,meta:r,currentTrackNode:s}=this.captions,n=Boolean(e.find(o=>o.language===t));this.isHTML5&&this.isVideo&&e.filter(o=>!r.get(o)).forEach(o=>{this.debug.log("Track added",o),r.set(o,{default:o.mode==="showing"}),o.mode==="showing"&&(o.mode="hidden"),_.call(this,o,"cuechange",()=>A.updateCues.call(this))}),(n&&this.language!==t||!e.includes(s))&&(A.setLanguage.call(this,t),A.toggle.call(this,i&&n)),this.elements&&k(this.elements.container,this.config.classNames.captions.enabled,!a.empty(e)),a.array(this.config.controls)&&this.config.controls.includes("settings")&&this.config.settings.includes("captions")&&u.setCaptionsMenu.call(this)},toggle(e,i=!0){if(!this.supported.ui)return;const{toggled:t}=this.captions,r=this.config.classNames.captions.active,s=a.nullOrUndefined(e)?!t:e;if(s!==t){if(i||(this.captions.active=s,this.storage.set({captions:s})),!this.language&&s&&!i){const n=A.getTracks.call(this),o=A.findTrack.call(this,[this.captions.language,...this.captions.languages],!0);return this.captions.language=o.language,void A.set.call(this,n.indexOf(o))}this.elements.buttons.captions&&(this.elements.buttons.captions.pressed=s),k(this.elements.container,r,s),this.captions.toggled=s,u.updateSetting.call(this,"captions"),f.call(this,this.media,s?"captionsenabled":"captionsdisabled")}setTimeout(()=>{s&&this.captions.toggled&&(this.captions.currentTrackNode.mode="hidden")})},set(e,i=!0){const t=A.getTracks.call(this);if(e!==-1)if(a.number(e))if(e in t){if(this.captions.currentTrack!==e){this.captions.currentTrack=e;const r=t[e],{language:s}=r||{};this.captions.currentTrackNode=r,u.updateSetting.call(this,"captions"),i||(this.captions.language=s,this.storage.set({language:s})),this.isVimeo&&this.embed.enableTextTrack(s),f.call(this,this.media,"languagechange")}A.toggle.call(this,!0,i),this.isHTML5&&this.isVideo&&A.updateCues.call(this)}else this.debug.warn("Track not found",e);else this.debug.warn("Invalid caption argument",e);else A.toggle.call(this,!1,i)},setLanguage(e,i=!0){if(!a.string(e))return void this.debug.warn("Invalid language argument",e);const t=e.toLowerCase();this.captions.language=t;const r=A.getTracks.call(this),s=A.findTrack.call(this,[t]);A.set.call(this,r.indexOf(s),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),r=o=>Number((this.captions.meta.get(o)||{}).default),s=Array.from(t).sort((o,l)=>r(l)-r(o));let n;return e.every(o=>(n=s.find(l=>l.language===o),!n)),n||(i?s[0]:void 0)},getCurrentTrack(){return A.getTracks.call(this)[this.currentTrack]},getLabel(e){let i=e;return!a.track(i)&&E.textTracks&&this.captions.toggled&&(i=A.getCurrentTrack.call(this)),a.track(i)?a.empty(i.label)?a.empty(i.language)?z.get("enabled",this.config):e.language.toUpperCase():i.label:z.get("disabled",this.config)},updateCues(e){if(!this.supported.ui)return;if(!a.element(this.elements.captions))return void this.debug.warn("No captions element to render to");if(!a.nullOrUndefined(e)&&!Array.isArray(e))return void this.debug.warn("updateCues: Invalid input",e);let i=e;if(!i){const r=A.getCurrentTrack.call(this);i=Array.from((r||{}).activeCues||[]).map(s=>s.getCueAsHTML()).map(ci)}const t=i.map(r=>r.trim()).join(`
  2. `);if(t!==this.elements.captions.innerHTML){ce(this.elements.captions);const r=b("span",H(this.config.selectors.caption));r.innerHTML=t,this.elements.captions.appendChild(r),f.call(this,this.media,"cuechange")}}},mt={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.6.12/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",hidden:"plyr__sr-only",hideControls:"plyr--hide-controls",isIos:"plyr--is-ios",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"},tabFocus:"plyr__tab-focus",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:""},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}},ve={active:"picture-in-picture",inactive:"inline"},W={html5:"html5",youtube:"youtube",vimeo:"vimeo"},we={audio:"audio",video:"video"};function ui(e){return/^(https?:\/\/)?(www\.)?(youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(e)?W.youtube:/^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(e)?W.vimeo:null}const _e=()=>{};class pi{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):_e}get warn(){return this.enabled?Function.prototype.bind.call(console.warn,console):_e}get error(){return this.enabled?Function.prototype.bind.call(console.error,console):_e}}class F{constructor(i){p(this,"onChange",()=>{if(!this.enabled)return;const t=this.player.elements.buttons.fullscreen;a.element(t)&&(t.pressed=this.active);const r=this.target===this.player.media?this.target:this.player.elements.container;f.call(this.player,r,this.active?"enterfullscreen":"exitfullscreen",!0)}),p(this,"toggleFallback",(t=!1)=>{if(t?this.scrollPosition={x:window.scrollX||0,y:window.scrollY||0}:window.scrollTo(this.scrollPosition.x,this.scrollPosition.y),document.body.style.overflow=t?"hidden":"",k(this.target,this.player.config.classNames.fullscreen.fallback,t),L.isIos){let r=document.head.querySelector('meta[name="viewport"]');const s="viewport-fit=cover";r||(r=document.createElement("meta"),r.setAttribute("name","viewport"));const n=a.string(r.content)&&r.content.includes(s);t?(this.cleanupViewport=!n,n||(r.content+=`,${s}`)):this.cleanupViewport&&(r.content=r.content.split(",").filter(o=>o.trim()!==s).join(","))}this.onChange()}),p(this,"trapFocus",t=>{if(L.isIos||!this.active||t.key!=="Tab"||t.keyCode!==9)return;const r=document.activeElement,s=Q.call(this.player,"a[href], button:not(:disabled), input:not(:disabled), [tabindex]"),[n]=s,o=s[s.length-1];r!==o||t.shiftKey?r===n&&t.shiftKey&&(o.focus(),t.preventDefault()):(n.focus(),t.preventDefault())}),p(this,"update",()=>{if(this.enabled){let t;t=this.forceFallback?"Fallback (forced)":F.native?"Native":"Fallback",this.player.debug.log(`${t} fullscreen enabled`)}else this.player.debug.log("Fullscreen not supported and fallback disabled");k(this.player.elements.container,this.player.config.classNames.fullscreen.enabled,this.enabled)}),p(this,"enter",()=>{this.enabled&&(L.isIos&&this.player.config.fullscreen.iosNative?this.player.isVimeo?this.player.embed.requestFullscreen():this.target.webkitEnterFullscreen():!F.native||this.forceFallback?this.toggleFallback(!0):this.prefix?a.empty(this.prefix)||this.target[`${this.prefix}Request${this.property}`]():this.target.requestFullscreen({navigationUI:"hide"}))}),p(this,"exit",()=>{if(this.enabled)if(L.isIos&&this.player.config.fullscreen.iosNative)this.target.webkitExitFullscreen(),V(this.player.play());else if(!F.native||this.forceFallback)this.toggleFallback(!1);else if(this.prefix){if(!a.empty(this.prefix)){const t=this.prefix==="moz"?"Cancel":"Exit";document[`${this.prefix}${t}${this.property}`]()}}else(document.cancelFullScreen||document.exitFullscreen).call(document)}),p(this,"toggle",()=>{this.active?this.exit():this.enter()}),this.player=i,this.prefix=F.prefix,this.property=F.property,this.scrollPosition={x:0,y:0},this.forceFallback=i.config.fullscreen.fallback==="force",this.player.elements.fullscreen=i.config.fullscreen.container&&Zt(this.player.elements.container,i.config.fullscreen.container),_.call(this.player,document,this.prefix==="ms"?"MSFullscreenChange":`${this.prefix}fullscreenchange`,()=>{this.onChange()}),_.call(this.player,this.player.elements.container,"dblclick",t=>{a.element(this.player.elements.controls)&&this.player.elements.controls.contains(t.target)||this.player.listeners.proxy(t,this.toggle,"fullscreen")}),_.call(this,this.player.elements.container,"keydown",t=>this.trapFocus(t)),this.update()}static get native(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)}get usingNative(){return F.native&&!this.forceFallback}static get prefix(){if(a.function(document.exitFullscreen))return"";let i="";return["webkit","moz","ms"].some(t=>!(!a.function(document[`${t}ExitFullscreen`])&&!a.function(document[`${t}CancelFullScreen`]))&&(i=t,!0)),i}static get property(){return this.prefix==="moz"?"FullScreen":"Fullscreen"}get enabled(){return(F.native||this.player.config.fullscreen.fallback)&&this.player.config.fullscreen.enabled&&this.player.supported.ui&&this.player.isVideo}get active(){if(!this.enabled)return!1;if(!F.native||this.forceFallback)return he(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(){return L.isIos&&this.player.config.fullscreen.iosNative?this.player.media:this.player.elements.fullscreen||this.player.elements.container}}function de(e,i=1){return new Promise((t,r)=>{const s=new Image,n=()=>{delete s.onload,delete s.onerror,(s.naturalWidth>=i?t:r)(s)};Object.assign(s,{onload:n,onerror:n,src:e})})}const S={addStyleHook(){k(this.elements.container,this.config.selectors.container.replace(".",""),!0),k(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)return this.debug.warn(`Basic support only for ${this.provider} ${this.type}`),void S.toggleNativeControls.call(this,!0);a.element(this.elements.controls)||(u.inject.call(this),this.listeners.controls()),S.toggleNativeControls.call(this),this.isHTML5&&A.setup.call(this),this.volume=null,this.muted=null,this.loop=null,this.quality=null,this.speed=null,u.updateVolume.call(this),u.timeUpdate.call(this),u.durationUpdate.call(this),S.checkPlaying.call(this),k(this.elements.container,this.config.classNames.pip.supported,E.pip&&this.isHTML5&&this.isVideo),k(this.elements.container,this.config.classNames.airplay.supported,E.airplay&&this.isHTML5),k(this.elements.container,this.config.classNames.isIos,L.isIos),k(this.elements.container,this.config.classNames.isTouch,this.touch),this.ready=!0,setTimeout(()=>{f.call(this,this.media,"ready")},0),S.setTitle.call(this),this.poster&&S.setPoster.call(this,this.poster,!1).catch(()=>{}),this.config.duration&&u.durationUpdate.call(this)},setTitle(){let e=z.get("play",this.config);if(a.string(this.config.title)&&!a.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=I.call(this,"iframe");if(!a.element(i))return;const t=a.empty(this.config.title)?"video":this.config.title,r=z.get("frameTitle",this.config);i.setAttribute("title",r.replace("{title}",t))}},togglePoster(e){k(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"),ii.call(this).then(()=>de(e)).catch(t=>{throw e===this.poster&&S.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:""}),S.togglePoster.call(this,!0),e)))},checkPlaying(e){k(this.elements.container,this.config.classNames.playing,this.playing),k(this.elements.container,this.config.classNames.paused,this.paused),k(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",z.get(this.playing?"pause":"play",this.config))}),a.event(e)&&e.type==="timeupdate"||S.toggleControls.call(this)},checkLoading(e){this.loading=["stalled","waiting"].includes(e.type),clearTimeout(this.timers.loading),this.timers.loading=setTimeout(()=>{k(this.elements.container,this.config.classNames.loading,this.loading),S.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(Boolean(e||this.loading||this.paused||i.pressed||i.hover||t))}},migrateStyles(){Object.values({...this.media.style}).filter(e=>!a.empty(e)&&a.string(e)&&e.startsWith("--plyr")).forEach(e=>{this.elements.container.style.setProperty(e,this.media.style.getPropertyValue(e)),this.media.style.removeProperty(e)}),a.empty(this.media.style)&&this.media.removeAttribute("style")}};class hi{constructor(i){p(this,"firstTouch",()=>{const{player:t}=this,{elements:r}=t;t.touch=!0,k(r.container,t.config.classNames.isTouch,!0)}),p(this,"setTabFocus",t=>{const{player:r}=this,{elements:s}=r;if(clearTimeout(this.focusTimer),t.type==="keydown"&&t.which!==9)return;t.type==="keydown"&&(this.lastKeyDown=t.timeStamp);const n=t.timeStamp-this.lastKeyDown<=20;(t.type!=="focus"||n)&&((()=>{const o=r.config.classNames.tabFocus;k(Q.call(r,`.${o}`),o,!1)})(),t.type!=="focusout"&&(this.focusTimer=setTimeout(()=>{const o=document.activeElement;s.container.contains(o)&&k(document.activeElement,r.config.classNames.tabFocus,!0)},10)))}),p(this,"global",(t=!0)=>{const{player:r}=this;r.config.keyboard.global&&X.call(r,window,"keydown keyup",this.handleKey,t,!1),X.call(r,document.body,"click",this.toggleMenu,t),Me.call(r,document.body,"touchstart",this.firstTouch),X.call(r,document.body,"keydown focus blur focusout",this.setTabFocus,t,!1,!0)}),p(this,"container",()=>{const{player:t}=this,{config:r,elements:s,timers:n}=t;!r.keyboard.global&&r.keyboard.focused&&_.call(t,s.container,"keydown keyup",this.handleKey,!1),_.call(t,s.container,"mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen",c=>{const{controls:d}=s;d&&c.type==="enterfullscreen"&&(d.pressed=!1,d.hover=!1);let g=0;["touchstart","touchmove","mousemove"].includes(c.type)&&(S.toggleControls.call(t,!0),g=t.touch?3e3:2e3),clearTimeout(n.controls),n.controls=setTimeout(()=>S.toggleControls.call(t,!1),g)});const o=()=>{if(!t.isVimeo||t.config.vimeo.premium)return;const c=s.wrapper,{active:d}=t.fullscreen,[g,y]=Ie.call(t),h=at(`aspect-ratio: ${g} / ${y}`);if(!d)return void(h?(c.style.width=null,c.style.height=null):(c.style.maxWidth=null,c.style.margin=null));const[w,x]=ri(),T=w/x>g/y;h?(c.style.width=T?"auto":"100%",c.style.height=T?"100%":"auto"):(c.style.maxWidth=T?x/y*g+"px":null,c.style.margin=T?"0 auto":null)},l=()=>{clearTimeout(n.resized),n.resized=setTimeout(o,50)};_.call(t,s.container,"enterfullscreen exitfullscreen",c=>{const{target:d}=t.fullscreen;d===s.container&&(!t.isEmbed&&a.empty(t.config.ratio)||(o(),(c.type==="enterfullscreen"?_:ye).call(t,window,"resize",l)))})}),p(this,"media",()=>{const{player:t}=this,{elements:r}=t;if(_.call(t,t.media,"timeupdate seeking seeked",n=>u.timeUpdate.call(t,n)),_.call(t,t.media,"durationchange loadeddata loadedmetadata",n=>u.durationUpdate.call(t,n)),_.call(t,t.media,"ended",()=>{t.isHTML5&&t.isVideo&&t.config.resetOnEnd&&(t.restart(),t.pause())}),_.call(t,t.media,"progress playing seeking seeked",n=>u.updateProgress.call(t,n)),_.call(t,t.media,"volumechange",n=>u.updateVolume.call(t,n)),_.call(t,t.media,"playing play pause ended emptied timeupdate",n=>S.checkPlaying.call(t,n)),_.call(t,t.media,"waiting canplay seeked playing",n=>S.checkLoading.call(t,n)),t.supported.ui&&t.config.clickToPlay&&!t.isAudio){const n=I.call(t,`.${t.config.classNames.video}`);if(!a.element(n))return;_.call(t,r.container,"click",o=>{([r.container,n].includes(o.target)||n.contains(o.target))&&(t.touch&&t.config.hideControls||(t.ended?(this.proxy(o,t.restart,"restart"),this.proxy(o,()=>{V(t.play())},"play")):this.proxy(o,()=>{V(t.togglePlay())},"play")))})}t.supported.ui&&t.config.disableContextMenu&&_.call(t,r.wrapper,"contextmenu",n=>{n.preventDefault()},!1),_.call(t,t.media,"volumechange",()=>{t.storage.set({volume:t.volume,muted:t.muted})}),_.call(t,t.media,"ratechange",()=>{u.updateSetting.call(t,"speed"),t.storage.set({speed:t.speed})}),_.call(t,t.media,"qualitychange",n=>{u.updateSetting.call(t,"quality",null,n.detail.quality)}),_.call(t,t.media,"ready qualitychange",()=>{u.setDownloadUrl.call(t)});const s=t.config.events.concat(["keyup","keydown"]).join(" ");_.call(t,t.media,s,n=>{let{detail:o={}}=n;n.type==="error"&&(o=t.media.error),f.call(t,r.container,n.type,!0,o)})}),p(this,"proxy",(t,r,s)=>{const{player:n}=this,o=n.config.listeners[s];let l=!0;a.function(o)&&(l=o.call(n,t)),l!==!1&&a.function(r)&&r.call(n,t)}),p(this,"bind",(t,r,s,n,o=!0)=>{const{player:l}=this,c=l.config.listeners[n],d=a.function(c);_.call(l,t,r,g=>this.proxy(g,s,n),o&&!d)}),p(this,"controls",()=>{const{player:t}=this,{elements:r}=t,s=L.isIE?"change":"input";if(r.buttons.play&&Array.from(r.buttons.play).forEach(n=>{this.bind(n,"click",()=>{V(t.togglePlay())},"play")}),this.bind(r.buttons.restart,"click",t.restart,"restart"),this.bind(r.buttons.rewind,"click",()=>{t.lastSeekTime=Date.now(),t.rewind()},"rewind"),this.bind(r.buttons.fastForward,"click",()=>{t.lastSeekTime=Date.now(),t.forward()},"fastForward"),this.bind(r.buttons.mute,"click",()=>{t.muted=!t.muted},"mute"),this.bind(r.buttons.captions,"click",()=>t.toggleCaptions()),this.bind(r.buttons.download,"click",()=>{f.call(t,t.media,"download")},"download"),this.bind(r.buttons.fullscreen,"click",()=>{t.fullscreen.toggle()},"fullscreen"),this.bind(r.buttons.pip,"click",()=>{t.pip="toggle"},"pip"),this.bind(r.buttons.airplay,"click",t.airplay,"airplay"),this.bind(r.buttons.settings,"click",n=>{n.stopPropagation(),n.preventDefault(),u.toggleMenu.call(t,n)},null,!1),this.bind(r.buttons.settings,"keyup",n=>{const o=n.which;[13,32].includes(o)&&(o!==13?(n.preventDefault(),n.stopPropagation(),u.toggleMenu.call(t,n)):u.focusFirstMenuItem.call(t,null,!0))},null,!1),this.bind(r.settings.menu,"keydown",n=>{n.which===27&&u.toggleMenu.call(t,n)}),this.bind(r.inputs.seek,"mousedown mousemove",n=>{const o=r.progress.getBoundingClientRect(),l=100/o.width*(n.pageX-o.left);n.currentTarget.setAttribute("seek-value",l)}),this.bind(r.inputs.seek,"mousedown mouseup keydown keyup touchstart touchend",n=>{const o=n.currentTarget,l=n.keyCode?n.keyCode:n.which,c="play-on-seeked";if(a.keyboardEvent(n)&&l!==39&&l!==37)return;t.lastSeekTime=Date.now();const d=o.hasAttribute(c),g=["mouseup","touchend","keyup"].includes(n.type);d&&g?(o.removeAttribute(c),V(t.play())):!g&&t.playing&&(o.setAttribute(c,""),t.pause())}),L.isIos){const n=Q.call(t,'input[type="range"]');Array.from(n).forEach(o=>this.bind(o,s,l=>it(l.target)))}this.bind(r.inputs.seek,s,n=>{const o=n.currentTarget;let l=o.getAttribute("seek-value");a.empty(l)&&(l=o.value),o.removeAttribute("seek-value"),t.currentTime=l/o.max*t.duration},"seek"),this.bind(r.progress,"mouseenter mouseleave mousemove",n=>u.updateSeekTooltip.call(t,n)),this.bind(r.progress,"mousemove touchmove",n=>{const{previewThumbnails:o}=t;o&&o.loaded&&o.startMove(n)}),this.bind(r.progress,"mouseleave touchend click",()=>{const{previewThumbnails:n}=t;n&&n.loaded&&n.endMove(!1,!0)}),this.bind(r.progress,"mousedown touchstart",n=>{const{previewThumbnails:o}=t;o&&o.loaded&&o.startScrubbing(n)}),this.bind(r.progress,"mouseup touchend",n=>{const{previewThumbnails:o}=t;o&&o.loaded&&o.endScrubbing(n)}),L.isWebkit&&Array.from(Q.call(t,'input[type="range"]')).forEach(n=>{this.bind(n,"input",o=>u.updateRangeFill.call(t,o.target))}),t.config.toggleInvert&&!a.element(r.display.duration)&&this.bind(r.display.currentTime,"click",()=>{t.currentTime!==0&&(t.config.invertTime=!t.config.invertTime,u.timeUpdate.call(t))}),this.bind(r.inputs.volume,s,n=>{t.volume=n.target.value},"volume"),this.bind(r.controls,"mouseenter mouseleave",n=>{r.controls.hover=!t.touch&&n.type==="mouseenter"}),r.fullscreen&&Array.from(r.fullscreen.children).filter(n=>!n.contains(r.container)).forEach(n=>{this.bind(n,"mouseenter mouseleave",o=>{r.controls&&(r.controls.hover=!t.touch&&o.type==="mouseenter")})}),this.bind(r.controls,"mousedown mouseup touchstart touchend touchcancel",n=>{r.controls.pressed=["mousedown","touchstart"].includes(n.type)}),this.bind(r.controls,"focusin",()=>{const{config:n,timers:o}=t;k(r.controls,n.classNames.noTransition,!0),S.toggleControls.call(t,!0),setTimeout(()=>{k(r.controls,n.classNames.noTransition,!1)},0);const l=this.touch?3e3:4e3;clearTimeout(o.controls),o.controls=setTimeout(()=>S.toggleControls.call(t,!1),l)}),this.bind(r.inputs.volume,"wheel",n=>{const o=n.webkitDirectionInvertedFromDevice,[l,c]=[n.deltaX,-n.deltaY].map(y=>o?-y:y),d=Math.sign(Math.abs(l)>Math.abs(c)?l:c);t.increaseVolume(d/50);const{volume:g}=t.media;(d===1&&g<1||d===-1&&g>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.setTabFocus=this.setTabFocus.bind(this),this.firstTouch=this.firstTouch.bind(this)}handleKey(i){const{player:t}=this,{elements:r}=t,s=i.keyCode?i.keyCode:i.which,n=i.type==="keydown",o=n&&s===this.lastKey;if(!(i.altKey||i.ctrlKey||i.metaKey||i.shiftKey)&&!!a.number(s))if(n){const l=document.activeElement;if(a.element(l)){const{editable:c}=t.config.selectors,{seek:d}=r.inputs;if(l!==d&&J(l,c)||i.which===32&&J(l,'button, [role^="menuitem"]'))return}switch([32,37,38,39,40,48,49,50,51,52,53,54,56,57,67,70,73,75,76,77,79].includes(s)&&(i.preventDefault(),i.stopPropagation()),s){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:o||(t.currentTime=t.duration/10*(s-48));break;case 32:case 75:o||V(t.togglePlay());break;case 38:t.increaseVolume(.1);break;case 40:t.decreaseVolume(.1);break;case 77:o||(t.muted=!t.muted);break;case 39:t.forward();break;case 37:t.rewind();break;case 70:t.fullscreen.toggle();break;case 67:o||t.toggleCaptions();break;case 76:t.loop=!t.loop}s===27&&!t.fullscreen.usingNative&&t.fullscreen.active&&t.fullscreen.toggle(),this.lastKey=s}else this.lastKey=null}toggleMenu(i){u.toggleMenu.call(this.player,i)}}function mi(e,i){return e(i={exports:{}},i.exports),i.exports}var gi=mi(function(e,i){e.exports=function(){var t=function(){},r={},s={},n={};function o(h,w){h=h.push?h:[h];var x,T,P,v=[],m=h.length,C=m;for(x=function(M,$){$.length&&v.push(M),--C||w(v)};m--;)T=h[m],(P=s[T])?x(T,P):(n[T]=n[T]||[]).push(x)}function l(h,w){if(h){var x=n[h];if(s[h]=w,x)for(;x.length;)x[0](h,w),x.splice(0,1)}}function c(h,w){h.call&&(h={success:h}),w.length?(h.error||t)(w):(h.success||t)(h)}function d(h,w,x,T){var P,v,m=document,C=x.async,M=(x.numRetries||0)+1,$=x.before||t,R=h.replace(/[\?|#].*$/,""),D=h.replace(/^(css|img)!/,"");T=T||0,/(^css!|\.css$)/.test(R)?((v=m.createElement("link")).rel="stylesheet",v.href=D,(P="hideFocus"in v)&&v.relList&&(P=0,v.rel="preload",v.as="style")):/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(R)?(v=m.createElement("img")).src=D:((v=m.createElement("script")).src=h,v.async=C===void 0||C),v.onload=v.onerror=v.onbeforeload=function(Le){var oe=Le.type[0];if(P)try{v.sheet.cssText.length||(oe="e")}catch(yt){yt.code!=18&&(oe="e")}if(oe=="e"){if((T+=1)<M)return d(h,w,x,T)}else if(v.rel=="preload"&&v.as=="style")return v.rel="stylesheet";w(h,oe,Le.defaultPrevented)},$(h,v)!==!1&&m.head.appendChild(v)}function g(h,w,x){var T,P,v=(h=h.push?h:[h]).length,m=v,C=[];for(T=function(M,$,R){if($=="e"&&C.push(M),$=="b"){if(!R)return;C.push(M)}--v||w(C)},P=0;P<m;P++)d(h[P],T,x)}function y(h,w,x){var T,P;if(w&&w.trim&&(T=w),P=(T?x:w)||{},T){if(T in r)throw"LoadJS";r[T]=!0}function v(m,C){g(h,function(M){c(P,M),m&&c({success:m,error:C},M),l(T,M)},P)}if(P.returnPromise)return new Promise(v);v()}return y.ready=function(h,w){return o(h,function(x){c(w,x)}),y},y.done=function(h){l(h,[])},y.reset=function(){r={},s={},n={}},y.isDefined=function(h){return h in r},y}()});function ze(e){return new Promise((i,t)=>{gi(e,{success:i,error:t})})}function yi(e){return a.empty(e)?null:a.number(Number(e))?e:e.match(/^.*(vimeo.com\/|video\/)(\d+).*/)?RegExp.$2:e}function fi(e){const i=e.match(/^.*(?:vimeo.com\/|video\/)(?:\d+)(?:\?.*&*h=|\/)+(?<hash>[\d,a-f]+)/);return i?i.groups.hash:null}function ee(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,f.call(this,this.media,e?"play":"pause"))}const Ae={setup(){const e=this;k(e.elements.wrapper,e.config.classNames.embed,!0),e.options.speed=e.config.speed.options,G.call(e),a.object(window.Vimeo)?Ae.ready.call(e):ze(e.config.urls.vimeo.sdk).then(()=>{Ae.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:r,...s}=i;let n=e.media.getAttribute("src"),o="";a.empty(n)?(n=e.media.getAttribute(e.config.attributes.embed.id),o=e.media.getAttribute(e.config.attributes.embed.hash)):o=fi(n);const l=o?{h:o}:{};t&&Object.assign(s,{controls:!1,sidedock:!1});const c=ht({loop:e.config.loop.active,autoplay:e.autoplay,muted:e.muted,gesture:"media",playsinline:!this.config.fullscreen.iosNative,...l,...s}),d=yi(n),g=b("iframe"),y=Ce(e.config.urls.vimeo.iframe,d,c);if(g.setAttribute("src",y),g.setAttribute("allowfullscreen",""),g.setAttribute("allow",["autoplay","fullscreen","picture-in-picture","encrypted-media","accelerometer","gyroscope"].join("; ")),a.empty(r)||g.setAttribute("referrerPolicy",r),t||!i.customControls)g.setAttribute("data-poster",e.poster),e.media=pe(g,e.media);else{const m=b("div",{class:e.config.classNames.embedContainer,"data-poster":e.poster});m.appendChild(g),e.media=pe(m,e.media)}i.customControls||ae(Ce(e.config.urls.vimeo.api,y)).then(m=>{!a.empty(m)&&m.thumbnail_url&&S.setPoster.call(e,m.thumbnail_url).catch(()=>{})}),e.embed=new window.Vimeo.Player(g,{autopause:e.config.autopause,muted:e.muted}),e.media.paused=!0,e.media.currentTime=0,e.supported.ui&&e.embed.disableTextTrack(),e.media.play=()=>(ee.call(e,!0),e.embed.play()),e.media.pause=()=>(ee.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:()=>h,set(m){const{embed:C,media:M,paused:$,volume:R}=e,D=$&&!C.hasPlayed;M.seeking=!0,f.call(e,M,"seeking"),Promise.resolve(D&&C.setVolume(0)).then(()=>C.setCurrentTime(m)).then(()=>D&&C.pause()).then(()=>D&&C.setVolume(R)).catch(()=>{})}});let w=e.config.speed.selected;Object.defineProperty(e.media,"playbackRate",{get:()=>w,set(m){e.embed.setPlaybackRate(m).then(()=>{w=m,f.call(e,e.media,"ratechange")}).catch(()=>{e.options.speed=[1]})}});let{volume:x}=e.config;Object.defineProperty(e.media,"volume",{get:()=>x,set(m){e.embed.setVolume(m).then(()=>{x=m,f.call(e,e.media,"volumechange")})}});let{muted:T}=e.config;Object.defineProperty(e.media,"muted",{get:()=>T,set(m){const C=!!a.boolean(m)&&m;e.embed.setVolume(C?0:e.config.volume).then(()=>{T=C,f.call(e,e.media,"volumechange")})}});let P,{loop:v}=e.config;Object.defineProperty(e.media,"loop",{get:()=>v,set(m){const C=a.boolean(m)?m:e.config.loop.active;e.embed.setLoop(C).then(()=>{v=C})}}),e.embed.getVideoUrl().then(m=>{P=m,u.setDownloadUrl.call(e)}).catch(m=>{this.debug.warn(m)}),Object.defineProperty(e.media,"currentSrc",{get:()=>P}),Object.defineProperty(e.media,"ended",{get:()=>e.currentTime===e.duration}),Promise.all([e.embed.getVideoWidth(),e.embed.getVideoHeight()]).then(m=>{const[C,M]=m;e.embed.ratio=lt(C,M),G.call(this)}),e.embed.setAutopause(e.config.autopause).then(m=>{e.config.autopause=m}),e.embed.getVideoTitle().then(m=>{e.config.title=m,S.setTitle.call(this)}),e.embed.getCurrentTime().then(m=>{h=m,f.call(e,e.media,"timeupdate")}),e.embed.getDuration().then(m=>{e.media.duration=m,f.call(e,e.media,"durationchange")}),e.embed.getTextTracks().then(m=>{e.media.textTracks=m,A.setup.call(e)}),e.embed.on("cuechange",({cues:m=[]})=>{const C=m.map(M=>li(M.text));A.updateCues.call(e,C)}),e.embed.on("loaded",()=>{e.embed.getPaused().then(m=>{ee.call(e,!m),m||f.call(e,e.media,"playing")}),a.element(e.embed.element)&&e.supported.ui&&e.embed.element.setAttribute("tabindex",-1)}),e.embed.on("bufferstart",()=>{f.call(e,e.media,"waiting")}),e.embed.on("bufferend",()=>{f.call(e,e.media,"playing")}),e.embed.on("play",()=>{ee.call(e,!0),f.call(e,e.media,"playing")}),e.embed.on("pause",()=>{ee.call(e,!1)}),e.embed.on("timeupdate",m=>{e.media.seeking=!1,h=m.seconds,f.call(e,e.media,"timeupdate")}),e.embed.on("progress",m=>{e.media.buffered=m.percent,f.call(e,e.media,"progress"),parseInt(m.percent,10)===1&&f.call(e,e.media,"canplaythrough"),e.embed.getDuration().then(C=>{C!==e.media.duration&&(e.media.duration=C,f.call(e,e.media,"durationchange"))})}),e.embed.on("seeked",()=>{e.media.seeking=!1,f.call(e,e.media,"seeked")}),e.embed.on("ended",()=>{e.media.paused=!0,f.call(e,e.media,"ended")}),e.embed.on("error",m=>{e.media.error=m,f.call(e,e.media,"error")}),i.customControls&&setTimeout(()=>S.build.call(e),0)}};function bi(e){return a.empty(e)?null:e.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/)?RegExp.$2:e}function te(e){e&&!this.embed.hasPlayed&&(this.embed.hasPlayed=!0),this.media.paused===e&&(this.media.paused=!e,f.call(this,this.media,e?"play":"pause"))}function vi(e){return e.noCookie?"https://www.youtube-nocookie.com":window.location.protocol==="http:"?"http://www.youtube.com":void 0}const ue={setup(){if(k(this.elements.wrapper,this.config.classNames.embed,!0),a.object(window.YT)&&a.function(window.YT.Player))ue.ready.call(this);else{const e=window.onYouTubeIframeAPIReady;window.onYouTubeIframeAPIReady=()=>{a.function(e)&&e(),ue.ready.call(this)},ze(this.config.urls.youtube.sdk).catch(i=>{this.debug.warn("YouTube API failed to load",i)})}},getTitle(e){ae(Ce(this.config.urls.youtube.api,e)).then(i=>{if(a.object(i)){const{title:t,height:r,width:s}=i;this.config.title=t,S.setTitle.call(this),this.embed.ratio=lt(s,r)}G.call(this)}).catch(()=>{G.call(this)})},ready(){const e=this,i=e.config.youtube,t=e.media&&e.media.getAttribute("id");if(!a.empty(t)&&t.startsWith("youtube-"))return;let r=e.media.getAttribute("src");a.empty(r)&&(r=e.media.getAttribute(this.config.attributes.embed.id));const s=bi(r),n=b("div",{id:si(e.provider),"data-poster":i.customControls?e.poster:void 0});if(e.media=pe(n,e.media),i.customControls){const o=l=>`https://i.ytimg.com/vi/${s}/${l}default.jpg`;de(o("maxres"),121).catch(()=>de(o("sd"),121)).catch(()=>de(o("hq"))).then(l=>S.setPoster.call(e,l.src)).then(l=>{l.includes("maxres")||(e.elements.poster.style.backgroundSize="cover")}).catch(()=>{})}e.embed=new window.YT.Player(e.media,{videoId:s,host:vi(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.fullscreen.iosNative?0:1,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 l=o.data,c={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."}[l]||"An unknown error occured";e.media.error={code:l,message:c},f.call(e,e.media,"error")}},onPlaybackRateChange(o){const l=o.target;e.media.playbackRate=l.getPlaybackRate(),f.call(e,e.media,"ratechange")},onReady(o){if(a.function(e.media.play))return;const l=o.target;ue.getTitle.call(e,s),e.media.play=()=>{te.call(e,!0),l.playVideo()},e.media.pause=()=>{te.call(e,!1),l.pauseVideo()},e.media.stop=()=>{l.stopVideo()},e.media.duration=l.getDuration(),e.media.paused=!0,e.media.currentTime=0,Object.defineProperty(e.media,"currentTime",{get:()=>Number(l.getCurrentTime()),set(y){e.paused&&!e.embed.hasPlayed&&e.embed.mute(),e.media.seeking=!0,f.call(e,e.media,"seeking"),l.seekTo(y)}}),Object.defineProperty(e.media,"playbackRate",{get:()=>l.getPlaybackRate(),set(y){l.setPlaybackRate(y)}});let{volume:c}=e.config;Object.defineProperty(e.media,"volume",{get:()=>c,set(y){c=y,l.setVolume(100*c),f.call(e,e.media,"volumechange")}});let{muted:d}=e.config;Object.defineProperty(e.media,"muted",{get:()=>d,set(y){const h=a.boolean(y)?y:d;d=h,l[h?"mute":"unMute"](),l.setVolume(100*c),f.call(e,e.media,"volumechange")}}),Object.defineProperty(e.media,"currentSrc",{get:()=>l.getVideoUrl()}),Object.defineProperty(e.media,"ended",{get:()=>e.currentTime===e.duration});const g=l.getAvailablePlaybackRates();e.options.speed=g.filter(y=>e.config.speed.options.includes(y)),e.supported.ui&&i.customControls&&e.media.setAttribute("tabindex",-1),f.call(e,e.media,"timeupdate"),f.call(e,e.media,"durationchange"),clearInterval(e.timers.buffering),e.timers.buffering=setInterval(()=>{e.media.buffered=l.getVideoLoadedFraction(),(e.media.lastBuffered===null||e.media.lastBuffered<e.media.buffered)&&f.call(e,e.media,"progress"),e.media.lastBuffered=e.media.buffered,e.media.buffered===1&&(clearInterval(e.timers.buffering),f.call(e,e.media,"canplaythrough"))},200),i.customControls&&setTimeout(()=>S.build.call(e),50)},onStateChange(o){const l=o.target;switch(clearInterval(e.timers.playing),e.media.seeking&&[1,2].includes(o.data)&&(e.media.seeking=!1,f.call(e,e.media,"seeked")),o.data){case-1:f.call(e,e.media,"timeupdate"),e.media.buffered=l.getVideoLoadedFraction(),f.call(e,e.media,"progress");break;case 0:te.call(e,!1),e.media.loop?(l.stopVideo(),l.playVideo()):f.call(e,e.media,"ended");break;case 1:i.customControls&&!e.config.autoplay&&e.media.paused&&!e.embed.hasPlayed?e.media.pause():(te.call(e,!0),f.call(e,e.media,"playing"),e.timers.playing=setInterval(()=>{f.call(e,e.media,"timeupdate")},50),e.media.duration!==l.getDuration()&&(e.media.duration=l.getDuration(),f.call(e,e.media,"durationchange")));break;case 2:e.muted||e.embed.unMute(),te.call(e,!1);break;case 3:f.call(e,e.media,"waiting")}f.call(e,e.elements.container,"statechange",!1,{code:o.data})}}})}},gt={setup(){this.media?(k(this.elements.container,this.config.classNames.type.replace("{0}",this.type),!0),k(this.elements.container,this.config.classNames.provider.replace("{0}",this.provider),!0),this.isEmbed&&k(this.elements.container,this.config.classNames.type.replace("{0}","video"),!0),this.isVideo&&(this.elements.wrapper=b("div",{class:this.config.classNames.video}),st(this.media,this.elements.wrapper),this.elements.poster=b("div",{class:this.config.classNames.poster}),this.elements.wrapper.appendChild(this.elements.poster)),this.isHTML5?K.setup.call(this):this.isYouTube?ue.setup.call(this):this.isVimeo&&Ae.setup.call(this)):this.debug.warn("No media element found!")}};class wi{constructor(i){p(this,"load",()=>{this.enabled&&(a.object(window.google)&&a.object(window.google.ima)?this.ready():ze(this.player.config.urls.googleIMA.sdk).then(()=>{this.ready()}).catch(()=>{this.trigger("error",new Error("Google IMA SDK failed to load"))}))}),p(this,"ready",()=>{var t;this.enabled||((t=this).manager&&t.manager.destroy(),t.elements.displayContainer&&t.elements.displayContainer.destroy(),t.elements.container.remove()),this.startSafetyTimer(12e3,"ready()"),this.managerPromise.then(()=>{this.clearSafetyTimer("onAdsManagerLoaded()")}),this.listeners(),this.setupIMA()}),p(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()}),p(this,"requestAds",()=>{const{container:t}=this.player.elements;try{const r=new google.ima.AdsRequest;r.adTagUrl=this.tagUrl,r.linearAdSlotWidth=t.offsetWidth,r.linearAdSlotHeight=t.offsetHeight,r.nonLinearAdSlotWidth=t.offsetWidth,r.nonLinearAdSlotHeight=t.offsetHeight,r.forceNonLinearFullSlot=!1,r.setAdWillPlayMuted(!this.player.muted),this.loader.requestAds(r)}catch(r){this.onAdError(r)}}),p(this,"pollCountdown",(t=!1)=>{if(!t)return clearInterval(this.countdownTimer),void this.elements.container.removeAttribute("data-badge-text");this.countdownTimer=setInterval(()=>{const r=fe(Math.max(this.manager.getRemainingTime(),0)),s=`${z.get("advertisement",this.player.config)} - ${r}`;this.elements.container.setAttribute("data-badge-text",s)},100)}),p(this,"onAdsManagerLoaded",t=>{if(!this.enabled)return;const r=new google.ima.AdsRenderingSettings;r.restoreCustomPlaybackStateOnAdBreakComplete=!0,r.enablePreloading=!0,this.manager=t.getAdsManager(this.player,r),this.cuePoints=this.manager.getCuePoints(),this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,s=>this.onAdError(s)),Object.keys(google.ima.AdEvent.Type).forEach(s=>{this.manager.addEventListener(google.ima.AdEvent.Type[s],n=>this.onAdEvent(n))}),this.trigger("loaded")}),p(this,"addCuePoints",()=>{a.empty(this.cuePoints)||this.cuePoints.forEach(t=>{if(t!==0&&t!==-1&&t<this.player.duration){const r=this.player.elements.progress;if(a.element(r)){const s=100/this.player.duration*t,n=b("span",{class:this.player.config.classNames.cues});n.style.left=`${s.toString()}%`,r.appendChild(n)}}})}),p(this,"onAdEvent",t=>{const{container:r}=this.player.elements,s=t.getAd(),n=t.getAdData();switch((o=>{f.call(this.player,this.player.media,`ads${o.replace(/_/g,"").toLowerCase()}`)})(t.type),t.type){case google.ima.AdEvent.Type.LOADED:this.trigger("loaded"),this.pollCountdown(!0),s.isLinear()||(s.width=r.offsetWidth,s.height=r.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()}`)}}),p(this,"onAdError",t=>{this.cancel(),this.player.debug.warn("Ads error",t)}),p(this,"listeners",()=>{const{container:t}=this.player.elements;let r;this.player.on("canplay",()=>{this.addCuePoints()}),this.player.on("ended",()=>{this.loader.contentComplete()}),this.player.on("timeupdate",()=>{r=this.player.currentTime}),this.player.on("seeked",()=>{const s=this.player.currentTime;a.empty(this.cuePoints)||this.cuePoints.forEach((n,o)=>{r<n&&n<s&&(this.manager.discardAdBreak(),this.cuePoints.splice(o,1))})}),window.addEventListener("resize",()=>{this.manager&&this.manager.resize(t.offsetWidth,t.offsetHeight,google.ima.ViewMode.NORMAL)})}),p(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(r){this.onAdError(r)}}).catch(()=>{})}),p(this,"resumeContent",()=>{this.elements.container.style.zIndex="",this.playing=!1,V(this.player.media.play())}),p(this,"pauseContent",()=>{this.elements.container.style.zIndex=3,this.playing=!0,this.player.media.pause()}),p(this,"cancel",()=>{this.initialized&&this.resumeContent(),this.trigger("error"),this.loadAds()}),p(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(()=>{})}),p(this,"trigger",(t,...r)=>{const s=this.events[t];a.array(s)&&s.forEach(n=>{a.function(n)&&n.apply(this,r)})}),p(this,"on",(t,r)=>(a.array(this.events[t])||(this.events[t]=[]),this.events[t].push(r),this)),p(this,"startSafetyTimer",(t,r)=>{this.player.debug.log(`Safety timer invoked from: ${r}`),this.safetyTimer=setTimeout(()=>{this.cancel(),this.clearSafetyTimer("startSafetyTimer()")},t)}),p(this,"clearSafetyTimer",t=>{a.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,r)=>{this.on("loaded",t),this.on("error",r)}),this.load()}get enabled(){const{config:i}=this;return this.player.isHTML5&&this.player.isVideo&&i.enabled&&(!a.empty(i.publisherId)||a.url(i.tagUrl))}get tagUrl(){const{config:i}=this;return a.url(i.tagUrl)?i.tagUrl:`https://go.aniview.com/api/adserver6/vast/?${ht({AV_PUBLISHERID:"58c25bb0073ef448b1087ad6",AV_CHANNELID:"5a0458dc28a06145e4519d21",AV_URL:window.location.hostname,cb:Date.now(),AV_WIDTH:640,AV_HEIGHT:480,AV_CDIM2:i.publisherId})}`}}const _i=e=>{const i=[];return e.split(/\r\n\r\n|\n\n|\r\r/).forEach(t=>{const r={};t.split(/\r\n|\n|\r/).forEach(s=>{if(a.number(r.startTime)){if(!a.empty(s.trim())&&a.empty(r.text)){const n=s.trim().split("#xywh=");[r.text]=n,n[1]&&([r.x,r.y,r.w,r.h]=n[1].split(","))}}else{const n=s.match(/([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})( ?--> ?)([0-9]{2})?:?([0-9]{2}):([0-9]{2}).([0-9]{2,3})/);n&&(r.startTime=60*Number(n[1]||0)*60+60*Number(n[2])+Number(n[3])+Number(`0.${n[4]}`),r.endTime=60*Number(n[6]||0)*60+60*Number(n[7])+Number(n[8])+Number(`0.${n[9]}`))}}),r.text&&i.push(r)}),i},Ue=(e,i)=>{const t={};return e>i.width/i.height?(t.width=i.width,t.height=1/e*i.width):(t.height=i.height,t.width=e*i.height),t};class Se{constructor(i){p(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.loaded=!0)})}),p(this,"getThumbnails",()=>new Promise(t=>{const{src:r}=this.player.config.previewThumbnails;if(a.empty(r))throw new Error("Missing previewThumbnails.src config attribute");const s=()=>{this.thumbnails.sort((n,o)=>n.height-o.height),this.player.debug.log("Preview thumbnails",this.thumbnails),t()};if(a.function(r))r(n=>{this.thumbnails=n,s()});else{const n=(a.string(r)?[r]:r).map(o=>this.getThumbnail(o));Promise.all(n).then(s)}})),p(this,"getThumbnail",t=>new Promise(r=>{ae(t).then(s=>{const n={frames:_i(s),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 o=new Image;o.onload=()=>{n.height=o.naturalHeight,n.width=o.naturalWidth,this.thumbnails.push(n),r()},o.src=n.urlPrefix+n.frames[0].text})})),p(this,"startMove",t=>{if(this.loaded&&a.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{const r=this.player.elements.progress.getBoundingClientRect(),s=100/r.width*(t.pageX-r.left);this.seekTime=this.player.media.duration*(s/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.innerText=fe(this.seekTime)}this.showImageAtCurrentTime()}}),p(this,"endMove",()=>{this.toggleThumbContainer(!1,!0)}),p(this,"startScrubbing",t=>{(a.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()))}),p(this,"endScrubbing",()=>{this.mouseDown=!1,Math.ceil(this.lastTime)===Math.ceil(this.player.media.currentTime)?this.toggleScrubbingContainer(!1):Me.call(this.player,this.player.media,"timeupdate",()=>{this.mouseDown||this.toggleScrubbingContainer(!1)})}),p(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})}),p(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.container.appendChild(t),a.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)}),p(this,"destroy",()=>{this.elements.thumb.container&&this.elements.thumb.container.remove(),this.elements.scrubbing.container&&this.elements.scrubbing.container.remove()}),p(this,"showImageAtCurrentTime",()=>{this.mouseDown?this.setScrubbingContainerSize():this.setThumbContainerSizeAndPos();const t=this.thumbnails[0].frames.findIndex(n=>this.seekTime>=n.startTime&&this.seekTime<=n.endTime),r=t>=0;let s=0;this.mouseDown||this.toggleThumbContainer(r),r&&(this.thumbnails.forEach((n,o)=>{this.loadedImages.includes(n.frames[t].text)&&(s=o)}),t!==this.showingThumb&&(this.showingThumb=t,this.loadImage(s)))}),p(this,"loadImage",(t=0)=>{const r=this.showingThumb,s=this.thumbnails[t],{urlPrefix:n}=s,o=s.frames[r],l=s.frames[r].text,c=n+l;if(this.currentImageElement&&this.currentImageElement.dataset.filename===l)this.showImage(this.currentImageElement,o,t,r,l,!1),this.currentImageElement.dataset.index=r,this.removeOldImages(this.currentImageElement);else{this.loadingImage&&this.usingSprites&&(this.loadingImage.onload=null);const d=new Image;d.src=c,d.dataset.index=r,d.dataset.filename=l,this.showingThumbFilename=l,this.player.debug.log(`Loading image: ${c}`),d.onload=()=>this.showImage(d,o,t,r,l,!0),this.loadingImage=d,this.removeOldImages(d)}}),p(this,"showImage",(t,r,s,n,o,l=!0)=>{this.player.debug.log(`Showing thumb: ${o}. num: ${n}. qual: ${s}. newimg: ${l}`),this.setImageSizeAndOffset(t,r),l&&(this.currentImageContainer.appendChild(t),this.currentImageElement=t,this.loadedImages.includes(o)||this.loadedImages.push(o)),this.preloadNearby(n,!0).then(this.preloadNearby(n,!1)).then(this.getHigherQuality(s,t,r,o))}),p(this,"removeOldImages",t=>{Array.from(this.currentImageContainer.children).forEach(r=>{if(r.tagName.toLowerCase()!=="img")return;const s=this.usingSprites?500:1e3;if(r.dataset.index!==t.dataset.index&&!r.dataset.deleting){r.dataset.deleting=!0;const{currentImageContainer:n}=this;setTimeout(()=>{n.removeChild(r),this.player.debug.log(`Removing thumb: ${r.dataset.filename}`)},s)}})}),p(this,"preloadNearby",(t,r=!0)=>new Promise(s=>{setTimeout(()=>{const n=this.thumbnails[0].frames[t].text;if(this.showingThumbFilename===n){let o;o=r?this.thumbnails[0].frames.slice(t):this.thumbnails[0].frames.slice(0,t).reverse();let l=!1;o.forEach(c=>{const d=c.text;if(d!==n&&!this.loadedImages.includes(d)){l=!0,this.player.debug.log(`Preloading thumb filename: ${d}`);const{urlPrefix:g}=this.thumbnails[0],y=g+d,h=new Image;h.src=y,h.onload=()=>{this.player.debug.log(`Preloaded thumb filename: ${d}`),this.loadedImages.includes(d)||this.loadedImages.push(d),s()}}}),l||s()}},300)})),p(this,"getHigherQuality",(t,r,s,n)=>{if(t<this.thumbnails.length-1){let o=r.naturalHeight;this.usingSprites&&(o=s.h),o<this.thumbContainerHeight&&setTimeout(()=>{this.showingThumbFilename===n&&(this.player.debug.log(`Showing higher quality thumb for: ${n}`),this.loadImage(t+1))},300)}}),p(this,"toggleThumbContainer",(t=!1,r=!1)=>{const s=this.player.config.classNames.previewThumbnails.thumbContainerShown;this.elements.thumb.container.classList.toggle(s,t),!t&&r&&(this.showingThumb=null,this.showingThumbFilename=null)}),p(this,"toggleScrubbingContainer",(t=!1)=>{const r=this.player.config.classNames.previewThumbnails.scrubbingContainerShown;this.elements.scrubbing.container.classList.toggle(r,t),t||(this.showingThumb=null,this.showingThumbFilename=null)}),p(this,"determineContainerAutoSizing",()=>{(this.elements.thumb.imageContainer.clientHeight>20||this.elements.thumb.imageContainer.clientWidth>20)&&(this.sizeSpecifiedInCSS=!0)}),p(this,"setThumbContainerSizeAndPos",()=>{if(this.sizeSpecifiedInCSS){if(this.elements.thumb.imageContainer.clientHeight>20&&this.elements.thumb.imageContainer.clientWidth<20){const t=Math.floor(this.elements.thumb.imageContainer.clientHeight*this.thumbAspectRatio);this.elements.thumb.imageContainer.style.width=`${t}px`}else if(this.elements.thumb.imageContainer.clientHeight<20&&this.elements.thumb.imageContainer.clientWidth>20){const t=Math.floor(this.elements.thumb.imageContainer.clientWidth/this.thumbAspectRatio);this.elements.thumb.imageContainer.style.height=`${t}px`}}else{const t=Math.floor(this.thumbContainerHeight*this.thumbAspectRatio);this.elements.thumb.imageContainer.style.height=`${this.thumbContainerHeight}px`,this.elements.thumb.imageContainer.style.width=`${t}px`}this.setThumbContainerPos()}),p(this,"setThumbContainerPos",()=>{const t=this.player.elements.progress.getBoundingClientRect(),r=this.player.elements.container.getBoundingClientRect(),{container:s}=this.elements.thumb,n=r.left-t.left+10,o=r.right-t.left-s.clientWidth-10;let l=this.mousePosX-t.left-s.clientWidth/2;l<n&&(l=n),l>o&&(l=o),s.style.left=`${l}px`}),p(this,"setScrubbingContainerSize",()=>{const{width:t,height:r}=Ue(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=`${r}px`}),p(this,"setImageSizeAndOffset",(t,r)=>{if(!this.usingSprites)return;const s=this.thumbContainerHeight/r.h;t.style.height=t.naturalHeight*s+"px",t.style.width=t.naturalWidth*s+"px",t.style.left=`-${r.x*s}px`,t.style.top=`-${r.y*s}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}=Ue(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 Pe={insertElements(e,i){a.string(i)?Fe(e,this.media,{src:i}):a.array(i)&&i.forEach(t=>{Fe(e,this.media,t)})},change(e){rt(e,"sources.length")?(K.cancelRequests.call(this),this.destroy.call(this,()=>{this.options.quality=[],B(this.media),this.media=null,a.element(this.elements.container)&&this.elements.container.removeAttribute("class");const{sources:i,type:t}=e,[{provider:r=W.html5,src:s}]=i,n=r==="html5"?t:"div",o=r==="html5"?{}:{src:s};Object.assign(this,{provider:r,type:t,supported:E.check(t,r,this.config.playsinline),media:b(n,o)}),this.elements.container.appendChild(this.media),a.boolean(e.autoplay)&&(this.config.autoplay=e.autoplay),this.isHTML5&&(this.config.crossorigin&&this.media.setAttribute("crossorigin",""),this.config.autoplay&&this.media.setAttribute("autoplay",""),a.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","")),S.addStyleHook.call(this),this.isHTML5&&Pe.insertElements.call(this,"source",i),this.config.title=e.title,gt.setup.call(this),this.isHTML5&&Object.keys(e).includes("tracks")&&Pe.insertElements.call(this,"track",e.tracks),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&S.build.call(this),this.isHTML5&&this.media.load(),a.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 Se(this))),this.fullscreen.update()},!0)):this.debug.warn("Invalid source format")}};function ki(e=0,i=0,t=255){return Math.min(Math.max(e,i),t)}class se{constructor(i,t){if(p(this,"play",()=>a.function(this.media.play)?(this.ads&&this.ads.enabled&&this.ads.managerPromise.then(()=>this.ads.play()).catch(()=>V(this.media.play())),this.media.play()):null),p(this,"pause",()=>this.playing&&a.function(this.media.pause)?this.media.pause():null),p(this,"togglePlay",l=>(a.boolean(l)?l:!this.playing)?this.play():this.pause()),p(this,"stop",()=>{this.isHTML5?(this.pause(),this.restart()):a.function(this.media.stop)&&this.media.stop()}),p(this,"restart",()=>{this.currentTime=0}),p(this,"rewind",l=>{this.currentTime-=a.number(l)?l:this.config.seekTime}),p(this,"forward",l=>{this.currentTime+=a.number(l)?l:this.config.seekTime}),p(this,"increaseVolume",l=>{const c=this.media.muted?0:this.volume;this.volume=c+(a.number(l)?l:0)}),p(this,"decreaseVolume",l=>{this.increaseVolume(-l)}),p(this,"airplay",()=>{E.airplay&&this.media.webkitShowPlaybackTargetPicker()}),p(this,"toggleControls",l=>{if(this.supported.ui&&!this.isAudio){const c=he(this.elements.container,this.config.classNames.hideControls),d=l===void 0?void 0:!l,g=k(this.elements.container,this.config.classNames.hideControls,d);if(g&&a.array(this.config.controls)&&this.config.controls.includes("settings")&&!a.empty(this.config.settings)&&u.toggleMenu.call(this,!1),g!==c){const y=g?"controlshidden":"controlsshown";f.call(this,this.media,y)}return!g}return!1}),p(this,"on",(l,c)=>{_.call(this,this.elements.container,l,c)}),p(this,"once",(l,c)=>{Me.call(this,this.elements.container,l,c)}),p(this,"off",(l,c)=>{ye(this.elements.container,l,c)}),p(this,"destroy",(l,c=!1)=>{if(!this.ready)return;const d=()=>{document.body.style.overflow="",this.embed=null,c?(Object.keys(this.elements).length&&(B(this.elements.buttons.play),B(this.elements.captions),B(this.elements.controls),B(this.elements.wrapper),this.elements.buttons.play=null,this.elements.captions=null,this.elements.controls=null,this.elements.wrapper=null),a.function(l)&&l()):(ti.call(this),K.cancelRequests.call(this),pe(this.elements.original,this.elements.container),f.call(this,this.elements.original,"destroyed",!0),a.function(l)&&l.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?(S.toggleNativeControls.call(this,!0),d()):this.isYouTube?(clearInterval(this.timers.buffering),clearInterval(this.timers.playing),this.embed!==null&&a.function(this.embed.destroy)&&this.embed.destroy(),d()):this.isVimeo&&(this.embed!==null&&this.embed.unload().then(d),setTimeout(d,200))}),p(this,"supports",l=>E.mime.call(this,l)),this.timers={},this.ready=!1,this.loading=!1,this.failed=!1,this.touch=E.touch,this.media=i,a.string(this.media)&&(this.media=document.querySelectorAll(this.media)),(window.jQuery&&this.media instanceof jQuery||a.nodeList(this.media)||a.array(this.media))&&(this.media=this.media[0]),this.config=N({},mt,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 pi(this.config.debug),this.debug.log("Config",this.config),this.debug.log("Support",E),a.nullOrUndefined(this.media)||!a.element(this.media))return void this.debug.error("Setup failed: no suitable element passed");if(this.media.plyr)return void this.debug.warn("Target already setup");if(!this.config.enabled)return void this.debug.error("Setup failed: disabled by config");if(!E.check().api)return void this.debug.error("Setup failed: no support");const r=this.media.cloneNode(!0);r.autoplay=!1,this.elements.original=r;const s=this.media.tagName.toLowerCase();let n=null,o=null;switch(s){case"div":if(n=this.media.querySelector("iframe"),a.element(n)){if(o=pt(n.getAttribute("src")),this.provider=ui(o.toString()),this.elements.container=this.media,this.media=n,this.elements.container.className="",o.search.length){const l=["1","true"];l.includes(o.searchParams.get("autoplay"))&&(this.config.autoplay=!0),l.includes(o.searchParams.get("loop"))&&(this.config.loop.active=!0),this.isYouTube?(this.config.playsinline=l.includes(o.searchParams.get("playsinline")),this.config.youtube.hl=o.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(a.empty(this.provider)||!Object.values(W).includes(this.provider))return void this.debug.error("Setup failed: Invalid provider");this.type=we.video;break;case"video":case"audio":this.type=s,this.provider=W.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:return void this.debug.error("Setup failed: unsupported type")}this.supported=E.check(this.type,this.provider,this.config.playsinline),this.supported.api?(this.eventListeners=[],this.listeners=new hi(this),this.storage=new re(this),this.media.plyr=this,a.element(this.elements.container)||(this.elements.container=b("div",{tabindex:0}),st(this.media,this.elements.container)),S.migrateStyles.call(this),S.addStyleHook.call(this),gt.setup.call(this),this.config.debug&&_.call(this,this.elements.container,this.config.events.join(" "),l=>{this.debug.log(`event: ${l.type}`)}),this.fullscreen=new F(this),(this.isHTML5||this.isEmbed&&!this.supported.ui)&&S.build.call(this),this.listeners.container(),this.listeners.global(),this.config.ads.enabled&&(this.ads=new wi(this)),this.isHTML5&&this.config.autoplay&&this.once("canplay",()=>V(this.play())),this.lastSeekTime=0,this.config.previewThumbnails.enabled&&(this.previewThumbnails=new Se(this))):this.debug.error("Setup failed: no support")}get isHTML5(){return this.provider===W.html5}get isEmbed(){return this.isYouTube||this.isVimeo}get isYouTube(){return this.provider===W.youtube}get isVimeo(){return this.provider===W.vimeo}get isVideo(){return this.type===we.video}get isAudio(){return this.type===we.audio}get playing(){return Boolean(this.ready&&!this.paused&&!this.ended)}get paused(){return Boolean(this.media.paused)}get stopped(){return Boolean(this.paused&&this.currentTime===0)}get ended(){return Boolean(this.media.ended)}set currentTime(i){if(!this.duration)return;const t=a.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 a.number(i)?i:i&&i.length&&this.duration>0?i.end(0)/this.duration:0}get seeking(){return Boolean(this.media.seeking)}get duration(){const i=parseFloat(this.config.duration),t=(this.media||{}).duration,r=a.number(t)&&t!==1/0?t:0;return i||r}set volume(i){let t=i;a.string(t)&&(t=Number(t)),a.number(t)||(t=this.storage.get("volume")),a.number(t)||({volume:t}=this.config),t>1&&(t=1),t<0&&(t=0),this.config.volume=t,this.media.volume=t,!a.empty(i)&&this.muted&&t>0&&(this.muted=!1)}get volume(){return Number(this.media.volume)}set muted(i){let t=i;a.boolean(t)||(t=this.storage.get("muted")),a.boolean(t)||(t=this.config.muted),this.config.muted=t,this.media.muted=t}get muted(){return Boolean(this.media.muted)}get hasAudio(){return!this.isHTML5||!!this.isAudio||Boolean(this.media.mozHasAudio)||Boolean(this.media.webkitAudioDecodedByteCount)||Boolean(this.media.audioTracks&&this.media.audioTracks.length)}set speed(i){let t=null;a.number(i)&&(t=i),a.number(t)||(t=this.storage.get("speed")),a.number(t)||(t=this.config.speed.selected);const{minimumSpeed:r,maximumSpeed:s}=this;t=ki(t,r,s),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,r=this.options.quality;if(!r.length)return;let s=[!a.empty(i)&&Number(i),this.storage.get("quality"),t.selected,t.default].find(a.number),n=!0;if(!r.includes(s)){const o=nt(r,s);this.debug.warn(`Unsupported quality option: ${s}, using ${o} instead`),s=o,n=!1}t.selected=s,this.media.quality=s,n&&this.storage.set({quality:s})}get quality(){return this.media.quality}set loop(i){const t=a.boolean(i)?i:this.config.loop.active;this.config.loop.active=t,this.media.loop=t}get loop(){return Boolean(this.media.loop)}set source(i){Pe.change.call(this,i)}get source(){return this.media.currentSrc}get download(){const{download:i}=this.config.urls;return a.url(i)?i:this.source}set download(i){a.url(i)&&(this.config.urls.download=i,u.setDownloadUrl.call(this))}set poster(i){this.isVideo?S.setPoster.call(this,i,!1).catch(()=>{}):this.debug.warn("Poster can only be set for video")}get poster(){return this.isVideo?this.media.getAttribute("poster")||this.media.getAttribute("data-poster"):null}get ratio(){if(!this.isVideo)return null;const i=me(Ie.call(this));return a.array(i)?i.join(":"):i}set ratio(i){this.isVideo?a.string(i)&&ot(i)?(this.config.ratio=me(i),G.call(this)):this.debug.error(`Invalid aspect ratio specified (${i})`):this.debug.warn("Aspect ratio can only be set for video")}set autoplay(i){const t=a.boolean(i)?i:this.config.autoplay;this.config.autoplay=t}get autoplay(){return Boolean(this.config.autoplay)}toggleCaptions(i){A.toggle.call(this,i,!1)}set currentTrack(i){A.set.call(this,i,!1),A.setup()}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(!E.pip)return;const t=a.boolean(i)?i:!this.pip;a.function(this.media.webkitSetPresentationMode)&&this.media.webkitSetPresentationMode(t?ve.active:ve.inactive),a.function(this.media.requestPictureInPicture)&&(!this.pip&&t?this.media.requestPictureInPicture():this.pip&&!t&&document.exitPictureInPicture())}get pip(){return E.pip?a.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 Se(this))}static supported(i,t,r){return E.check(i,t,r)}static loadSprite(i,t){return dt(i,t)}static setup(i,t={}){let r=null;return a.string(i)?r=Array.from(document.querySelectorAll(i)):a.nodeList(i)?r=Array.from(i):a.array(i)&&(r=i.filter(a.element)),a.empty(r)?null:r.map(s=>new se(s,t))}}se.defaults=Xt(mt);var xi="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFIAAABSCAMAAADw8nOpAAAAAXNSR0IArs4c6QAAAapQTFRFAAAA////////////2NjY2dnZ9vb2////9vb23Nzc3d3d3t7e39/f////4+Pj4+Pj6+vr7Ozs5+fn6Ojo7u7u6enp6enp7+/v8fHx7Ozs8fHx7e3t7+/v8/Pz8PDw8/Pz9PT0+/v78PDw8PDw9PT09PT0////9fX1/Pz89fX19fX19fX18vLy/Pz89vb29vb2/Pz8+fn59/f3////9/f3+vr69/f3+vr6////+Pj4+/v7////+/v7+/v7+Pj4+fn5/////f39+/v7+/v7+/v7+fn5+/v7+/v7/f39////+/v7////+/v7/f39/Pz8/Pz8/////Pz8/////Pz8/f39/f39/Pz8/f39/v7+/Pz8/v7+/////Pz8/v7+/v7+/v7+/v7+/Pz8/v7+/////v7+/v7+/v7+/v7+/v7+/v7+/////v7+/v7+/v7+/////v7+/////v7+/v7+/////v7+/////v7+/////////////////v7+/////v7+/////////////v7+/////////////////////v7+////////////////////////lZ+FUgAAAI10Uk5TAAYSFRobGxscHR4fICMkJScpKywsLi8vNTY2OD5BQkJDQ0RGRkhISktMTlBRUlNVWFlbXF1gY29wcXJyc3R1d3p7fH+AgoSFhoaHj5CTlJWXmJifn6WoqKusr6+0tLi5ury/v8LDyMvMzdTV1tjY2trb3ODh4eLj5ejs7e3u7u/w8vT19vj5+vr7/P3+n1NMJwAAA5RJREFUWMO1metfEkEUhg86lrZZRBeVitJSsVIkKym7KFqYqJGXLiplCWUYBKllRiaQa7Lz/s998Bqyu7ML+37eeX47t3Pec4ZIR9VuX2gutpSW5fRSbC7kc1dTKaroHEtyFIgnxzorzPFs7VMbADLRCb/X5XRIksPp8vonohkAG1PtNsPAysFVIB8JtNawAtW0BiJ5YHWw0hDwaDALxAbqmIrqBmJANnhEfMq9OfDZNqaptlmOXK/g9Bvj4DNNTFdNMxzxRpFfHOFIeZiQPCnwEd0frZ2HPCQxQUlDMuZrtYkt61hsZgbUvIj1Fi1i1ybCdmZI9jA2u9SJPQpGmWGNQulRJULpZybUr0CF2aUo3cyUuhWl6NxbNtHPTKofm0X2qHbdzDrur+f6obNkm0eYlaAw5gvP/AgW7aUg7YsYKbjXXG5mJalZ5v/dd1sCQ6xEDSFxcOp9SEmlIqUU+g5E3Bz3sJLl4bn9mBzEDCuDZhDcyzNZrhpxT104Loxs4tndfDSIWbX1mdzCr8fHRJmzGNzZ7lWo5ZlhAMDna4LINqxub3o7YmrffN12A8qkQ4wZQzsREU1jQO2TH7sW4+ddIeQApomIKuR8nS4S+HBRAFmX36ggok5EmAASf5+d0GdG0ElEYwgIIYHvt3WRAYwRURKtgkjgbb0OshVJomqeqRFGIhfQPqQ1GV5Nbo2lPIwEEjd0FtNNPowbQoK/PKOBHIePQvAbQwJrD6pUR/gRojl4jSKBj5fVRngxRwtwGUdi6/nJ4iNcWKBlNJhAAis3i45owDKl4TCFRL6j2AgH0iRDMocsnvclyCUg36shTU8c99QmvgSnKWR+uOgIJ5YoZuoQ4dOV4iMuIWbuqP9+VKVx1E1cSP7qrOaFNBw28KVDI2xMwEduRA0h/2hXRVG4DYZgvDuvH4INJYqVOyKJwkA6Uw0/helMNOlqBMnCpCtoDdbuVwlbAyEDw1+cFjMwU3o269sOMX7dmM3SMIOvt5P3E0GHuWcGNSzruTiAN/VMUHuWVctYS7ceXjVjrC2w/1YUKdRbnlKq92DBFy9HwRe3WVuWWlE8W1HiW9CIsKJdYkVTx4rWkxUNMivaeFY0G61oiVrRuCWixoR4eznRKNgE7xNtgveJvwEcKXernoio8mmZHxS2nz2mZQCZyLjf62pwSJKjweX1j0cyAORpE88eljzOHHxCWlhOy3J6eUHoCekfdmynrwwsFL4AAAAASUVORK5CYII=",Ci=ft({name:"col-video",props:{trySee:{type:Boolean,default:!1},freeRate:{type:Number,default:100},setting:{type:Object,default:()=>{}},controls:Boolean,height:String,src:{type:String,default:""},poster:{type:String,default:""},styleValue:{type:Object,default:()=>({})},playsinline:{type:Boolean,default:!0},onPlay:{type:Function,default:()=>{}}},data(){return{player:null,loading:!0,trySeeOver:!1,showSeeStatus:!0}},mounted(){this._init()},computed:{computedSeeStatus(){return console.log(this.showSeeStatus,this.trySee,this.trySeeOver,"this.showSeeStatus, this.trySee"),this.showSeeStatus&&this.trySee},playTime(){return this.player.duration*this.freeRate/100||0}},methods:{_init(){let e=["current-time","play-large","play","progress","captions","fullscreen"];this.player=new se(this.$refs.video,{controls:e,...this.setting,invertTime:!1,fullscreen:{enabled:!0,fallback:"force",iosNative:!0}}),this.player.elements.container&&(this.player.elements.container.style.height=this.height||"210px"),this.player.on("loadedmetadata",()=>{this.loading=!1,this.trySee?this.domPlayVisibility():this.domPlayVisibility(!1);const i=this;this.player.on("timeupdate",()=>{const t=i.player;t.currentTime>=this.playTime&&i.trySee&&(t.pause(),i.trySeeOver=!0,i.showSeeStatus=!0,i.domPlayVisibility())})}),this.player.on("play",()=>{this.onPlay&&this.onPlay()})},domPlayVisibility(e=!0){const i=document.querySelector(".plyr__controls"),t=document.querySelector(".plyr__control--overlaid");e?(i==null||i.setAttribute("style","display:none"),t==null||t.setAttribute("style","display:none")):(i==null||i.removeAttribute("style"),setTimeout(()=>{t==null||t.removeAttribute("style")},200))},onClickPlay(){this.player.play(),this.domPlayVisibility(!1),this.showSeeStatus=!1},onBuy(){this.$router.back()},onReplay(){this.player.restart(),this.player.play(),this.domPlayVisibility(!1),this.trySeeOver=!1,this.showSeeStatus=!1}},unmounted(){var e;(e=this.player)==null||e.destroy()},render(){return j("div",{class:q["video-container"]},[j("video",{ref:"video",class:q.video,src:this.src,playsinline:this.playsinline,poster:this.poster,style:{...this.styleValue}},null),this.loading&&j("div",{class:q.loadingVideo,style:{height:this.height||"210px"}},null),this.trySee&&this.computedSeeStatus&&!this.loading&&j("div",{class:[q.loadingVideo,q.playOver],style:{height:this.height||"210px"}},[this.trySeeOver?j(Oe,null,[j("p",{class:q.tips},[le("\u514D\u8D39\u8BD5\u770B\u7ED3\u675F\uFF0C\u8D2D\u4E70\u5B8C\u6574\u8BFE\u7A0B\u540E\u7EE7\u7EED\u5B66\u4E60")]),j(bt,{class:q.btn,type:"primary",round:!0,size:"small",onClick:this.onBuy},{default:()=>[le("\u7ACB\u5373\u8D2D\u4E70")]}),j("div",{class:q.replay,onClick:this.onReplay},[j($e,{name:"replay",style:{marginRight:"5px"},size:16},null),le("\u91CD\u64AD")])]):j(Oe,null,[j($e,{name:xi,size:50,onClick:this.onClickPlay},null),j("p",{class:q.freeTxt},[le("\u514D\u8D39\u8BD5\u770B")])])])])}});export{Ci as C};