!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=t(e,document):"function"==typeof define&&define.amd?define(null,function(){t(e,document)}):e.plyr=t(e,document)}("undefined"!=typeof window?window:this,function(e,t){"use strict";function n(){var e,n,r,s=navigator.useragent,a=navigator.appname,o=""+parsefloat(navigator.appversion),i=parseint(navigator.appversion,10);return-1!==navigator.appversion.indexof("windows nt")&&-1!==navigator.appversion.indexof("rv:11")?(a="ie",o="11;"):-1!==(n=s.indexof("msie"))?(a="ie",o=s.substring(n+5)):-1!==(n=s.indexof("chrome"))?(a="chrome",o=s.substring(n+7)):-1!==(n=s.indexof("safari"))?(a="safari",o=s.substring(n+7),-1!==(n=s.indexof("version"))&&(o=s.substring(n+8))):-1!==(n=s.indexof("firefox"))?(a="firefox",o=s.substring(n+8)):(e=s.lastindexof(" ")+1)<(n=s.lastindexof("/"))&&(a=s.substring(e,n),o=s.substring(n+1),a.tolowercase()==a.touppercase()&&(a=navigator.appname)),-1!==(r=o.indexof(";"))&&(o=o.substring(0,r)),-1!==(r=o.indexof(" "))&&(o=o.substring(0,r)),i=parseint(""+o,10),isnan(i)&&(o=""+parsefloat(navigator.appversion),i=parseint(navigator.appversion,10)),{name:a,version:i,ios:/(ipad|iphone|ipod)/g.test(navigator.platform),touch:"ontouchstart"in t.documentelement}}function r(e,t){var n=e.media;if("video"==e.type)switch(t){case"video/webm":return!(!n.canplaytype||!n.canplaytype('video/webm; codecs="vp8, vorbis"').replace(/no/,""));case"video/mp4":return!(!n.canplaytype||!n.canplaytype('video/mp4; codecs="avc1.42e01e, mp4a.40.2"').replace(/no/,""));case"video/ogg":return!(!n.canplaytype||!n.canplaytype('video/ogg; codecs="theora"').replace(/no/,""))}else if("audio"==e.type)switch(t){case"audio/mpeg":return!(!n.canplaytype||!n.canplaytype("audio/mpeg;").replace(/no/,""));case"audio/ogg":return!(!n.canplaytype||!n.canplaytype('audio/ogg; codecs="vorbis"').replace(/no/,""));case"audio/wav":return!(!n.canplaytype||!n.canplaytype('audio/wav; codecs="1"').replace(/no/,""))}return!1}function s(e){if(!t.queryselectorall('script[src="'+e+'"]').length){var n=t.createelement("script");n.src=e;var r=t.getelementsbytagname("script")[0];r.parentnode.insertbefore(n,r)}}function a(e,t){return array.prototype.indexof&&-1!=e.indexof(t)}function o(e,t,n){return e.replace(new regexp(t.replace(/([.*+?\^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),n)}function i(e,t){e.length||(e=[e]);for(var n=e.length-1;n>=0;n--){var r=n>0?t.clonenode(!0):t,s=e[n],a=s.parentnode,o=s.nextsibling;r.appendchild(s),o?a.insertbefore(r,o):a.appendchild(r)}}function l(e){for(var t=e.parentnode;e.firstchild;)t.insertbefore(e.firstchild,e);t.removechild(e)}function u(e){e&&e.parentnode.removechild(e)}function c(e,t){e.insertbefore(t,e.firstchild)}function p(e,t){for(var n in t)e.setattribute(n,"boolean"==typeof t[n]&&t[n]?"":t[n])}function d(e,n,r){var s=t.createelement(e);p(s,r),c(n,s)}function f(e){return e.replace(".","")}function m(e,t,n){if(e)if(e.classlist)e.classlist[n?"add":"remove"](t);else{var r=(" "+e.classname+" ").replace(/\s+/g," ").replace(" "+t+" ","");e.classname=r+(n?" "+t:"")}}function y(e,t){return e?e.classlist?e.classlist.contains(t):new regexp("(\\s|^)"+t+"(\\s|$)").test(e.classname):!1}function b(e,t,n){e&&h(e,t,n,!0)}function v(e,t,n){e&&h(e,t,n,!1)}function g(e,t,n,r){b(e,t,function(t){n&&n.apply(e,[t]),r.apply(e,[t])})}function h(e,t,n,r){var s=t.split(" ");if(e instanceof nodelist)for(var a=0;ar;r++){var s=e[r];for(var a in s)s[a]&&s[a].constructor&&s[a].constructor===object?(t[a]=t[a]||{},t(t[a],s[a])):t[a]=s[a]}return t}}function _(){var e={supportsfullscreen:!1,isfullscreen:function(){return!1},requestfullscreen:function(){},cancelfullscreen:function(){},fullscreeneventname:"",element:null,prefix:""},n="webkit moz o ms khtml".split(" ");if("undefined"!=typeof t.cancelfullscreen)e.supportsfullscreen=!0;else for(var r=0,s=n.length;s>r;r++){if(e.prefix=n[r],"undefined"!=typeof t[e.prefix+"cancelfullscreen"]){e.supportsfullscreen=!0;break}if("undefined"!=typeof t.msexitfullscreen&&t.msfullscreenenabled){e.prefix="ms",e.supportsfullscreen=!0;break}}return e.supportsfullscreen&&(e.fullscreeneventname="ms"==e.prefix?"msfullscreenchange":e.prefix+"fullscreenchange",e.isfullscreen=function(e){switch("undefined"==typeof e&&(e=t.body),this.prefix){case"":return t.fullscreenelement==e;case"moz":return t.mozfullscreenelement==e;default:return t[this.prefix+"fullscreenelement"]==e}},e.requestfullscreen=function(e){return"undefined"==typeof e&&(e=t.body),""===this.prefix?e.requestfullscreen():e[this.prefix+("ms"==this.prefix?"requestfullscreen":"requestfullscreen")]()},e.cancelfullscreen=function(){return""===this.prefix?t.cancelfullscreen():t[this.prefix+("ms"==this.prefix?"exitfullscreen":"cancelfullscreen")]()},e.element=function(){return""===this.prefix?t.fullscreenelement:t[this.prefix+"fullscreenelement"]}),e}function f(){var t={supported:function(){if(!("localstorage"in e))return!1;try{e.localstorage.setitem("___test","ok");var t=e.localstorage.getitem("___test");return e.localstorage.removeitem("___test"),"ok"===t}catch(n){return!1}return!1}()};return t}function c(h,t){function c(t,n){t.debug&&e.console&&console[n?"warn":"log"](t)}function a(){var e=['
','
','','','',"0% "+t.i18n.played,"",'',"0% "+t.i18n.buffered,""];return t.tooltips.seek&&e.push('00:00'),e.push("
",''),a(t.controls,"restart")&&e.push('"),a(t.controls,"rewind")&&e.push('"),a(t.controls,"play")&&e.push('",'"),a(t.controls,"fast-forward")&&e.push('"),a(t.controls,"current-time")&&e.push('',''+t.i18n.currenttime+"",'00:00',""),a(t.controls,"duration")&&e.push('',''+t.i18n.duration+"",'00:00',""),e.push("",''),a(t.controls,"mute")&&e.push('"),a(t.controls,"volume")&&e.push('",''),a(t.controls,"captions")&&e.push('"),a(t.controls,"fullscreen")&&e.push('"),e.push("","
"),e.join("")}function n(){if(ce.supported.full&&("audio"!=ce.type||t.fullscreen.allowaudio)&&t.fullscreen.enabled){var e=e.supportsfullscreen;e||t.fullscreen.fallback&&!q()?(c((e?"native":"fallback")+" fullscreen enabled"),m(ce.container,t.classes.fullscreen.enabled,!0)):c("fullscreen not supported and fallback disabled"),w(ce.buttons.fullscreen,!1),r(),t.fullscreen.hidecontrols&&m(ce.container,t.classes.fullscreen.hidecontrols,!0)}}function i(){if("video"===ce.type){v(t.selectors.captions)||ce.videocontainer.insertadjacenthtml("afterbegin",'
'),ce.usingtexttracks=!1,ce.media.texttracks&&(ce.usingtexttracks=!0);for(var e,t="",n=ce.media.childnodes,r=0;r=10||"firefox"===ce.browser.name&&ce.browser.version>=31)&&(c("detected browser with known texttrack issues - using manual fallback"),ce.usingtexttracks=!1),ce.usingtexttracks){c("texttracks supported");for(var o=0;o ");for(var r=0;rce.captions.length-1){ce.subcount=ce.captions.length-1;break}ce.media.currenttime.tofixed(1)>=n(ce.captions[ce.subcount][0])&&ce.media.currenttime.tofixed(1)<=r(ce.captions[ce.subcount][0])?(ce.currentcaption=ce.captions[ce.subcount][1],p(ce.currentcaption)):p()}}function l(){ce.buttons.captions&&(m(ce.container,t.classes.captions.enabled,!0),t.captions.defaultactive&&(m(ce.container,t.classes.captions.active,!0),w(ce.buttons.captions,!0)))}function o(e){return ce.container.queryselectorall(e)}function v(e){return o(e)[0]}function q(){try{return e.self!==e.top}catch(t){return!0}}function r(){function e(e){9===e.which&&ce.isfullscreen&&(e.target!==r||e.shiftkey?e.target===n&&e.shiftkey&&(e.preventdefault(),r.focus()):(e.preventdefault(),n.focus()))}var t=o("input:not([disabled]), button:not([disabled])"),n=t[0],r=t[t.length-1];b(ce.container,"keydown",e)}function j(e,t){if("string"==typeof t)d(e,ce.media,{src:t});else if(t.constructor===array)for(var n=t.length-1;n>=0;n--)d(e,ce.media,t[n])}function h(){var e=t.html;c("injecting custom controls"),e||(e=a()),e=o(e,"{seektime}",t.seektime),e=o(e,"{id}",math.floor(1e4*math.random()));var n;if(null!==t.selectors.controls.container&&(n=t.selectors.controls.container,"string"==typeof selector&&(n=t.queryselector(n))),n instanceof htmlelement||(n=ce.container),n.insertadjacenthtml("beforeend",e),t.tooltips.controls)for(var r=o(t.selectors.labels+" ."+t.classes.hidden),s=r.length-1;s>=0;s--){var a=r[s];m(a,t.classes.hidden,!1),m(a,t.classes.tooltip,!0)}}function d(){try{return ce.controls=v(t.selectors.controls.wrapper),ce.buttons={},ce.buttons.seek=v(t.selectors.buttons.seek),ce.buttons.play=v(t.selectors.buttons.play),ce.buttons.pause=v(t.selectors.buttons.pause),ce.buttons.restart=v(t.selectors.buttons.restart),ce.buttons.rewind=v(t.selectors.buttons.rewind),ce.buttons.forward=v(t.selectors.buttons.forward),ce.buttons.fullscreen=v(t.selectors.buttons.fullscreen),ce.buttons.volume=v(t.selectors.buttons.volume),ce.buttons.mute=v(t.selectors.buttons.mute),ce.buttons.captions=v(t.selectors.buttons.captions),ce.checkboxes=o('[type="checkbox"]'),ce.progress={},ce.progress.container=v(t.selectors.progress.container),ce.progress.buffer={},ce.progress.buffer.bar=v(t.selectors.progress.buffer),ce.progress.buffer.text=ce.progress.buffer.bar&&ce.progress.buffer.bar.getelementsbytagname("span")[0],ce.progress.played={},ce.progress.played.bar=v(t.selectors.progress.played),ce.progress.played.text=ce.progress.played.bar&&ce.progress.played.bar.getelementsbytagname("span")[0],ce.progress.tooltip=ce.progress.container&&ce.progress.container.queryselector("."+t.classes.tooltip),ce.volume=v(t.selectors.buttons.volume),ce.duration=v(t.selectors.duration),ce.currenttime=v(t.selectors.currenttime),ce.seektime=o(t.selectors.seektime),!0}catch(e){return c("it looks like there is a problem with your controls html",!0),y(!0),!1}}function b(){m(ce.container,t.selectors.container.replace(".",""),ce.supported.full)}function y(e){e?ce.media.setattribute("controls",""):ce.media.removeattribute("controls")}function $(e){var t=t.i18n.play;"undefined"!=typeof t.title&&t.title.length&&(t+=", "+t.title),ce.supported.full&&ce.buttons.play&&ce.buttons.play.setattribute("aria-label",t),e instanceof htmlelement&&e.setattribute("title",t.i18n.frametitle.replace("{title}",t.title))}function w(){if(!ce.media)return c("no audio or video element found",!0),!1;if(ce.supported.full&&(m(ce.container,t.classes.type.replace("{0}",ce.type),!0),m(ce.container,t.classes.stopped,t.autoplay),m(ce.container,t.classes.isios,ce.browser.ios),m(ce.container,t.classes.istouch,ce.browser.touch),"video"===ce.type)){var e=t.createelement("div");e.setattribute("class",t.classes.videowrapper),i(ce.media,e),ce.videocontainer=e}a(t.types.embed,ce.type)&&(z(),ce.embedid=null)}function z(){for(var n=t.createelement("div"),r=ce.embedid,a=ce.type+"-"+math.floor(1e4*math.random()),o=o('[id^="'+ce.type+'-"]'),i=o.length-1;i>=0;i--)u(o[i]);if(m(ce.media,t.classes.videowrapper,!0),m(ce.media,t.classes.embedwrapper,!0),"youtube"===ce.type)ce.media.appendchild(n),n.setattribute("id",a),"object"==typeof yt?u(r,n):(s(t.urls.youtube.api),e.onyoutubereadycallbacks=e.onyoutubereadycallbacks||[],e.onyoutubereadycallbacks.push(function(){u(r,n)}),e.onyoutubeiframeapiready=function(){e.onyoutubereadycallbacks.foreach(function(e){e()})});else if("vimeo"===ce.type){var l=t.createelement("iframe");l.loaded=!1,b(l,"load",function(){l.loaded=!0}),p(l,{src:"https://player.vimeo.com/video/"+r+"?player_id="+a+"&api=1&badge=0&byline=0&portrait=0&title=0",id:a,webkitallowfullscreen:"",mozallowfullscreen:"",allowfullscreen:"",frameborder:0}),ce.supported.full?(n.appendchild(l),ce.media.appendchild(n)):ce.media.appendchild(l),"$f"in e||s(t.urls.vimeo.api);var c=e.setinterval(function(){"$f"in e&&l.loaded&&(e.clearinterval(c),x.call(l))},50)}}function k(){$(v("iframe")),ce.container.plyr.embed=ce.embed,fe()}function u(t,n){"timer"in ce||(ce.timer={}),ce.embed=new yt.player(n.id,{videoid:t,playervars:{autoplay:t.autoplay?1:0,controls:ce.supported.full?0:1,rel:0,showinfo:0,iv_load_policy:3,cc_load_policy:t.captions.defaultactive?1:0,cc_lang_pref:"en",wmode:"transparent",modestbranding:1,disablekb:1,origin:"*"},events:{onready:function(t){var n=t.target;ce.media.play=function(){n.playvideo(),ce.media.paused=!1},ce.media.pause=function(){n.pausevideo(),ce.media.paused=!0},ce.media.stop=function(){n.stopvideo(),ce.media.paused=!0},ce.media.duration=n.getduration(),ce.media.paused=!0,ce.media.currenttime=n.getcurrenttime(),ce.media.muted=n.ismuted(),t.title=n.getvideodata().title,k(ce.media,"timeupdate"),e.clearinterval(ce.timer.buffering),ce.timer.buffering=e.setinterval(function(){ce.media.buffered=n.getvideoloadedfraction(),k(ce.media,"progress"),1===ce.media.buffered&&(e.clearinterval(ce.timer.buffering),k(ce.media,"canplaythrough"))},200),k(),fe()},onstatechange:function(t){var n=t.target;switch(e.clearinterval(ce.timer.playing),t.data){case 0:ce.media.paused=!0,k(ce.media,"ended");break;case 1:ce.media.paused=!1,ce.media.seeking=!1,k(ce.media,"play"),k(ce.media,"playing"),ce.timer.playing=e.setinterval(function(){ce.media.currenttime=n.getcurrenttime(),k(ce.media,"timeupdate")},100);break;case 2:ce.media.paused=!0,k(ce.media,"pause")}}}})}function x(){ce.embed=$f(this),ce.embed.addevent("ready",function(){ce.media.play=function(){ce.embed.api("play"),ce.media.paused=!1},ce.media.pause=function(){ce.embed.api("pause"),ce.media.paused=!0},ce.media.stop=function(){ce.embed.api("stop"),ce.media.paused=!0},ce.media.paused=!0,ce.media.currenttime=0,k(),ce.embed.api("getcurrenttime",function(e){ce.media.currenttime=e,k(ce.media,"timeupdate")}),ce.embed.api("getduration",function(e){ce.media.duration=e,fe()}),ce.embed.addevent("play",function(){ce.media.paused=!1,k(ce.media,"play"),k(ce.media,"playing")}),ce.embed.addevent("pause",function(){ce.media.paused=!0,k(ce.media,"pause")}),ce.embed.addevent("playprogress",function(e){ce.media.seeking=!1,ce.media.currenttime=e.seconds,k(ce.media,"timeupdate")}),ce.embed.addevent("loadprogress",function(e){ce.media.buffered=e.percent,k(ce.media,"progress"),1===parseint(e.percent)&&k(ce.media,"canplaythrough")}),ce.embed.addevent("finish",function(){ce.media.paused=!0,k(ce.media,"ended")}),t.autoplay&&ce.embed.api("play")})}function j(){"play"in ce.media&&ce.media.play()}function g(){"pause"in ce.media&&ce.media.pause()}function q(e){e===!0?j():e===!1?g():ce.media[ce.media.paused?"play":"pause"]()}function z(e){"number"!=typeof e&&(e=t.seektime),te(ce.media.currenttime-e)}function ee(e){"number"!=typeof e&&(e=t.seektime),te(ce.media.currenttime+e)}function te(e){var t=0,n=ce.media.paused,r=ne();"number"==typeof e?t=e:"object"!=typeof e||"input"!==e.type&&"change"!==e.type||(t=e.target.value/e.target.max*r),0>t?t=0:t>r&&(t=r);try{ce.media.currenttime=t.tofixed(1)}catch(s){}if(a(t.types.embed,ce.type)){switch(ce.type){case"youtube":ce.embed.seekto(t);break;case"vimeo":ce.embed.api("seekto",t.tofixed(0))}n&&g(),k(ce.media,"timeupdate"),ce.media.seeking=!0}c("seeking to "+ce.media.currenttime+" seconds"),m(t)}function ne(){var e=parseint(t.duration);return isnan(e)?ce.media.duration:e}function re(){m(ce.container,t.classes.playing,!ce.media.paused),m(ce.container,t.classes.stopped,ce.media.paused)}function se(e){var n=e.supportsfullscreen;e&&e.type===e.fullscreeneventname?ce.isfullscreen=e.isfullscreen(ce.container):n?(e.isfullscreen(ce.container)?e.cancelfullscreen():e.requestfullscreen(ce.container),ce.isfullscreen=e.isfullscreen(ce.container)):(ce.isfullscreen=!ce.isfullscreen,ce.isfullscreen?(b(t,"keyup",ae),t.body.style.overflow="hidden"):(v(t,"keyup",ae),t.body.style.overflow="")),m(ce.container,t.classes.fullscreen.active,ce.isfullscreen),ce.isfullscreen?ce.container.setattribute("tabindex","-1"):ce.container.removeattribute("tabindex"),r(ce.isfullscreen),w(ce.buttons.fullscreen,ce.isfullscreen),t.fullscreen.hidecontrols&&be(!0),k(ce.container,ce.isfullscreen?"enterfullscreen":"exitfullscreen")}function ae(e){27===(e.which||e.charcode||e.keycode)&&ce.isfullscreen&&se()}function oe(e){if("boolean"!=typeof e&&(e=!ce.media.muted),w(ce.buttons.mute,e),ce.media.muted=e,a(t.types.embed,ce.type)){switch(ce.type){case"youtube":ce.embed[ce.media.muted?"mute":"unmute"]();break;case"vimeo":ce.embed.api("setvolume",ce.media.muted?0:parsefloat(t.volume/10))}k(ce.media,"volumechange")}}function ie(t){if("undefined"==typeof t&&(t=t.volume,t.storage.enabled&&f().supported&&(t=e.localstorage.getitem(t.storage.key),e.localstorage.removeitem("plyr-volume"))),(null===t||isnan(t))&&(t=t.volume),t>10&&(t=10),0>t&&(t=0),ce.media.volume=parsefloat(t/10),t.volume=t,a(t.types.embed,ce.type)){switch(ce.type){case"youtube":ce.embed.setvolume(100*ce.media.volume);break;case"vimeo":ce.embed.api("setvolume",ce.media.volume)}k(ce.media,"volumechange")}ce.media.muted&&t>0&&oe()}function le(){var t=ce.media.muted?0:10*ce.media.volume;ce.supported.full&&ce.volume&&(ce.volume.value=t),t.storage.enabled&&f().supported&&!isnan(t)&&e.localstorage.setitem(t.storage.key,t),m(ce.container,t.classes.muted,0===t),ce.supported.full&&ce.buttons.mute&&w(ce.buttons.mute,0===t)}function ue(e){ce.supported.full&&ce.buttons.captions&&("boolean"!=typeof e&&(e=-1===ce.container.classname.indexof(t.classes.captions.active)),ce.captionsenabled=e,w(ce.buttons.captions,ce.captionsenabled),m(ce.container,t.classes.captions.active,ce.captionsenabled),k(ce.container,ce.captionsenabled?"captionsenabled":"captionsdisabled"))}function ce(e){var t="waiting"===e.type;cleartimeout(ce.timers.loading),ce.timers.loading=settimeout(function(){m(ce.container,t.classes.loading,t)},t?250:0)}function pe(e){var t=ce.progress.played.bar,n=ce.progress.played.text,r=0,s=ne();if(e)switch(e.type){case"timeupdate":case"seeking":r=x(ce.media.currenttime,s),"timeupdate"==e.type&&ce.buttons.seek&&(ce.buttons.seek.value=r);break;case"change":case"input":r=e.target.value;break;case"playing":case"progress":t=ce.progress.buffer.bar,n=ce.progress.buffer.text,r=function(){var e=ce.media.buffered;return e&&e.length?x(e.end(0),s):"number"==typeof e?100*e:0}()}t&&(t.value=r),n&&(n.innerhtml=r)}function de(e,t){if(t){isnan(e)&&(e=0),ce.secs=parseint(e%60),ce.mins=parseint(e/60%60),ce.hours=parseint(e/60/60%60);var n=parseint(ne()/60/60%60)>0;ce.secs=("0"+ce.secs).slice(-2),ce.mins=("0"+ce.mins).slice(-2),t.innerhtml=(n?ce.hours+":":"")+ce.mins+":"+ce.secs}}function fe(){if(ce.supported.full){var e=ne()||0;!ce.duration&&t.displayduration&&ce.media.paused&&de(e,ce.currenttime),ce.duration&&de(e,ce.duration),ye()}}function me(e){de(ce.media.currenttime,ce.currenttime),e&&"timeupdate"==e.type&&ce.media.seeking||pe(e)}function ye(e){if(t.tooltips.seek&&!ce.browser.touch){var t=ce.progress.container.getboundingclientrect(),n=0,r=t.classes.tooltip+"--visible";if(e)n=100/t.width*(e.pagex-t.left);else{if(!y(ce.progress.tooltip,r))return;n=ce.progress.tooltip.style.left.replace("%","")}0>n?n=0:n>100&&(n=100),de(ne()/100*n,ce.progress.tooltip),ce.progress.tooltip.style.left=n+"%",e&&a(["mouseenter","mouseleave"],e.type)&&m(ce.progress.tooltip,r,"mouseenter"===e.type)}}function be(t){ce.isfullscreen&&(m(ce.container,t.classes.hover,!0),e.cleartimeout(ce.timers.hover),ce.timers.hover=e.settimeout(function(){ce.controls.mouseover&&t!==!0||m(ce.container,t.classes.hover,!1)},2e3))}function ve(e){if("undefined"!=typeof e)return void ge(e);var t;switch(ce.type){case"youtube":t=ce.embed.getvideourl();break;case"vimeo":ce.embed.api("getvideourl",function(e){t=e});break;default:t=ce.media.currentsrc}return t||""}function ge(n){if(!("undefined"!=typeof n&&"sources"in n&&n.sources.length))return void c("invalid source format",!0);if(g(),"youtube"===ce.type?(ce.embed.destroy(),e.clearinterval(ce.timer.buffering),e.clearinterval(ce.timer.playing)):"video"===ce.type&&ce.videocontainer&&u(ce.videocontainer),ce.embed=null,xe(),u(ce.media),"type"in n&&(ce.type=n.type,"video"===ce.type)){var r=n.sources[0];"type"in r&&a(t.types.embed,r.type)&&(ce.type=r.type)}switch(ce.supported=s.supported(ce.type),ce.type){case"video":ce.media=t.createelement("video");break;case"audio":ce.media=t.createelement("audio");break;case"youtube":case"vimeo":ce.media=t.createelement("div"),ce.embedid=n.sources[0].src}c(ce.container,ce.media),"undefined"!=typeof n.autoplay&&(t.autoplay=n.autoplay),a(t.types.html5,ce.type)&&(t.crossorigin&&ce.media.setattribute("crossorigin",""),t.autoplay&&ce.media.setattribute("autoplay",""),"poster"in n&&ce.media.setattribute("poster",n.poster),t.loop&&ce.media.setattribute("loop","")),ce.container.classname=ce.originalclassname,m(ce.container,t.classes.fullscreen.active,ce.isfullscreen),m(ce.container,t.classes.captions.active,ce.captionsenabled),b(),a(t.types.html5,ce.type)&&j("source",n.sources),w(),a(t.types.html5,ce.type)&&("tracks"in n&&j("track",n.tracks),ce.media.load(),fe(),fe()),t.title=n.title,$(),ce.container.plyr.media=ce.media}function he(e){"video"===ce.type&&ce.media.setattribute("poster",e)}function ke(){function n(){var e=ce.media.paused;e?j():g();var t=ce.buttons[e?"play":"pause"],n=ce.buttons[e?"pause":"play"];if(n){var r=y(t,t.classes.tabfocus);settimeout(function(){n.focus(),r&&(m(t,t.classes.tabfocus,!1),m(n,t.classes.tabfocus,!0))},100)}}function r(){var e=t.activeelement;e&&e!=t.body?t.queryselector&&(e=t.queryselector(":focus")):e=null;for(var n in ce.buttons){var r=ce.buttons[n];m(r,t.classes.tabfocus,r===e)}}var s="ie"==ce.browser.name?"change":"input";b(e,"keyup",function(e){var t=e.keycode?e.keycode:e.which;9==t&&r()}),b(t.body,"click",function(){m(v("."+t.classes.tabfocus),t.classes.tabfocus,!1)});for(var a in ce.buttons){var o=ce.buttons[a];b(o,"blur",function(){m(o,"tab-focus",!1)})}g(ce.buttons.play,"click",t.listeners.play,n),g(ce.buttons.pause,"click",t.listeners.pause,n),g(ce.buttons.restart,"click",t.listeners.restart,te),g(ce.buttons.rewind,"click",t.listeners.rewind,z),g(ce.buttons.forward,"click",t.listeners.forward,ee),g(ce.buttons.seek,s,t.listeners.seek,te),g(ce.volume,s,t.listeners.volume,function(){ie(ce.volume.value)}),g(ce.buttons.mute,"click",t.listeners.mute,oe),g(ce.buttons.fullscreen,"click",t.listeners.fullscreen,se),e.supportsfullscreen&&b(t,e.fullscreeneventname,se),b(ce.buttons.captions,"click",ue),b(ce.progress.container,"mouseenter mouseleave mousemove",ye);t.fullscreen.hidecontrols&&b(ce.controls,"mouseenter mouseleave",function(e){ce.controls.mouseover="mouseenter"===e.type})}function we(){b(ce.media,"timeupdate seeking",me),b(ce.media,"timeupdate",m),b(ce.media,"durationchange loadedmetadata",fe),b(ce.media,"ended",function(){"video"===ce.type&&p(),re()}),b(ce.media,"progress playing",pe),b(ce.media,"volumechange",le),b(ce.media,"play pause",re),b(ce.media,"waiting canplay seeked",ce),t.click&&b(ce.media,"click",function(){ce.media.paused?j():ce.media.ended?(te(),j()):g()}),t.fullscreen.hidecontrols&&b(ce.media,"mousemove",be),b(ce.media,t.events.join(" "),function(e){k(ce.container,e.type)})}function xe(){if(a(t.types.html5,ce.type)){ce.media.setattribute("src","");for(var e=ce.media.queryselectorall("source"),t=0;t=0;s--){var a=e[s];if("undefined"==typeof a.plyr){var o=t(a,n,json.parse(a.getattribute("data-plyr")));if(!o.enabled)return;var i=new c(a,o);a.plyr=object.keys(i).length?i:!1,k(a,"setup",{plyr:a.plyr})}r.push(a.plyr)}return r},s}),function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createevent("customevent");return n.initcustomevent(e,t.bubbles,t.cancelable,t.detail),n}return"function"==typeof window.customevent?!1:(e.prototype=window.event.prototype,void(window.customevent=e))}()