@screwtopmedia/cdf-ng-media
Version:
Angular module for displaying media assets (images, videos)
95 lines (62 loc) • 134 kB
JavaScript
/*!
JW Player version 8.4.0-beta.1
Copyright (c) 2018, JW Player, All Rights Reserved
https://github.com/jwplayer/jwplayer/blob/v8.4.0-beta.1/README.md
This source code and its use and distribution is subject to the terms and conditions of the applicable license agreement.
https://www.jwplayer.com/tos/
This product includes portions of other software. For the full text of licenses, see below:
JW Player Third Party Software Notices and/or Additional Terms and Conditions
**************************************************************************************************
The following software is used under Apache License 2.0
**************************************************************************************************
vtt.js v0.13.0
Copyright (c) 2018 Mozilla (http://mozilla.org)
https://github.com/mozilla/vtt.js/blob/v0.13.0/LICENSE
* * *
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and
limitations under the License.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************************************
The following software is used under MIT license
**************************************************************************************************
Underscore.js v1.6.0
Copyright (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative
https://github.com/jashkenas/underscore/blob/1.6.0/LICENSE
Backbone backbone.events.js v1.1.2
Copyright (c) 2010-2014 Jeremy Ashkenas, DocumentCloud
https://github.com/jashkenas/backbone/blob/1.1.2/LICENSE
Promise Polyfill v7.1.1
Copyright (c) 2014 Taylor Hakes and Forbes Lindesay
https://github.com/taylorhakes/promise-polyfill/blob/v7.1.1/LICENSE
can-autoplay.js v3.0.0
Copyright (c) 2017 video-dev
https://github.com/video-dev/can-autoplay/blob/v3.0.0/LICENSE
* * *
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************************************
The following software is used under W3C license
**************************************************************************************************
Intersection Observer v0.5.0
Copyright (c) 2016 Google Inc. (http://google.com)
https://github.com/w3c/IntersectionObserver/blob/v0.5.0/LICENSE.md
* * *
W3C SOFTWARE AND DOCUMENT NOTICE AND LICENSE
Status: This license takes effect 13 May, 2015.
This work is being provided by the copyright holders under the following license.
License
By obtaining and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions.
Permission to copy, modify, and distribute this work, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the work or portions thereof, including modifications:
The full text of this NOTICE in a location viewable to users of the redistributed or derivative work.
Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the W3C Software and Document Short Notice should be included.
Notice of any changes or modifications, through a copyright statement on the new code or document such as "This software or document includes material copied from or derived from [title and URI of the W3C document]. Copyright © [YEAR] W3C® (MIT, ERCIM, Keio, Beihang)."
Disclaimers
THIS WORK IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENT WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENT.
The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the work without specific, written prior permission. Title to copyright in this work will at all times remain with copyright holders.
*/
(window.webpackJsonpjwplayer=window.webpackJsonpjwplayer||[]).push([[0],[,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.r(t);var i=n(0),o=n(17),a=n(5),r=n(6),l=n(40),s=n(8),c=n(29),u=n(50),w=void 0;function p(e){return w||(w=new DOMParser),w.parseFromString(e,"image/svg+xml").documentElement}var d=function(e,t,n,i){var o=document.createElement("div");return o.className="jw-icon jw-icon-inline jw-button-color jw-reset "+e,o.setAttribute("role","button"),o.setAttribute("tabindex","0"),n&&o.setAttribute("aria-label",n),o.style.display="none",t&&new u.a(o).on("click tap enter",function(e){t(e)}),o.addEventListener("mousedown",function(e){e.preventDefault()}),i&&Array.prototype.forEach.call(i,function(e){"string"==typeof e?o.appendChild(p(e)):o.appendChild(e)}),{element:function(){return o},toggle:function(e){e?this.show():this.hide()},show:function(){o.style.display=""},hide:function(){o.style.display="none"}}},j=n(86),h=n.n(j),f=n(85),g=n.n(f),v=n(84),m=n.n(v),b=n(83),y=n.n(b),k=n(82),x=n.n(k),C=n(81),O=n.n(C),E=n(80),T=n.n(E),L=n(79),S=n.n(L),M=n(78),z=n.n(M),B=n(77),_=n.n(B),H=n(76),A=n.n(H),P=n(75),I=n.n(P),V=n(74),N=n.n(V),R=n(73),U=n.n(R),D=n(72),q=n.n(D),F=n(71),W=n.n(F),Z=n(70),X=n.n(Z),J=n(69),K=n.n(J),Y=n(68),Q=n.n(Y),G=n(67),$=n.n(G),ee=n(66),te=n.n(ee),ne=n(65),ie=n.n(ne),oe=n(64),ae=n.n(oe),re=null;function le(e){var t=we().querySelector(ce(e));return t?ue(t):null}function se(e){var t=we().querySelectorAll(e.split(",").map(ce).join(","));return Array.prototype.map.call(t,function(e){return ue(e)})}function ce(e){return".jw-svg-icon-"+e}function ue(e){return e.cloneNode(!0)}function we(){return re||(re=p("<xml>"+h.a+g.a+m.a+y.a+x.a+O.a+T.a+S.a+z.a+_.a+A.a+I.a+N.a+U.a+q.a+W.a+X.a+K.a+Q.a+$.a+te.a+ie.a+ae.a+"</xml>")),re}var pe=n(18),de=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();var je={};var he=function(){function e(t,n,i,o,a){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var r=document.createElement("div");r.className="jw-icon jw-icon-inline jw-button-color jw-reset "+(a||""),r.setAttribute("button",o),r.setAttribute("role","button"),r.setAttribute("tabindex","0"),n&&r.setAttribute("aria-label",n);var l=void 0;t&&"<svg"===t.substring(0,4)?l=function(e){if(!je[e]){var t=Object.keys(je);t.length>10&&delete je[t[0]];var n=p(e);je[e]=n}return je[e].cloneNode(!0)}(t):((l=document.createElement("div")).className="jw-icon jw-button-image jw-button-color jw-reset",t&&Object(pe.d)(l,{backgroundImage:"url("+t+")"})),r.appendChild(l),new u.a(r).on("click tap enter",i,this),r.addEventListener("mousedown",function(e){e.preventDefault()}),this.id=o,this.buttonElement=r}return de(e,[{key:"element",value:function(){return this.buttonElement}},{key:"toggle",value:function(e){e?this.show():this.hide()}},{key:"show",value:function(){this.buttonElement.style.display=""}},{key:"hide",value:function(){this.buttonElement.style.display="none"}}]),e}(),fe=n(9),ge=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();var ve=function(e){var t=Object(s.c)(e),n=window.pageXOffset;return n&&o.OS.android&&document.body.parentElement.getBoundingClientRect().left>=0&&(t.left-=n,t.right-=n),t},me=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Object(i.h)(this,r.a),this.className=t+" jw-background-color jw-reset",this.orientation=n,this.dragStartListener=this.dragStart.bind(this),this.dragMoveListener=this.dragMove.bind(this),this.dragEndListener=this.dragEnd.bind(this),this.tapListener=this.tap.bind(this)}return ge(e,[{key:"setup",value:function(){this.el=Object(s.e)(function(){return'<div class="'+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")+" "+(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"")+' jw-reset" aria-hidden="true"><div class="jw-slider-container jw-reset"><div class="jw-rail jw-reset"></div><div class="jw-buffer jw-reset"></div><div class="jw-progress jw-reset"></div><div class="jw-knob jw-reset"></div></div></div>'}(this.className,"jw-slider-"+this.orientation)),this.elementRail=this.el.getElementsByClassName("jw-slider-container")[0],this.elementBuffer=this.el.getElementsByClassName("jw-buffer")[0],this.elementProgress=this.el.getElementsByClassName("jw-progress")[0],this.elementThumb=this.el.getElementsByClassName("jw-knob")[0],this.userInteract=new u.a(this.element(),{preventScrolling:!0}),this.userInteract.on("dragStart",this.dragStartListener),this.userInteract.on("drag",this.dragMoveListener),this.userInteract.on("dragEnd",this.dragEndListener),this.userInteract.on("tap click",this.tapListener)}},{key:"dragStart",value:function(){this.trigger("dragStart"),this.railBounds=ve(this.elementRail)}},{key:"dragEnd",value:function(e){this.dragMove(e),this.trigger("dragEnd")}},{key:"dragMove",value:function(e){var t=this.railBounds=this.railBounds?this.railBounds:ve(this.elementRail),n=void 0,i=void 0;return i="horizontal"===this.orientation?(n=e.pageX)<t.left?0:n>t.right?100:100*Object(l.a)((n-t.left)/t.width,0,1):(n=e.pageY)>=t.bottom?0:n<=t.top?100:100*Object(l.a)((t.height-(n-t.top))/t.height,0,1),this.render(i),this.update(i),!1}},{key:"tap",value:function(e){this.railBounds=ve(this.elementRail),this.dragMove(e)}},{key:"limit",value:function(e){return e}},{key:"update",value:function(e){this.trigger("update",{percentage:e})}},{key:"render",value:function(e){e=Math.max(0,Math.min(e,100)),"horizontal"===this.orientation?(this.elementThumb.style.left=e+"%",this.elementProgress.style.width=e+"%"):(this.elementThumb.style.bottom=e+"%",this.elementProgress.style.height=e+"%")}},{key:"updateBuffer",value:function(e){this.elementBuffer.style.width=e+"%"}},{key:"element",value:function(){return this.el}}]),e}(),be=function(e,t){e&&t&&(e.setAttribute("aria-label",t),e.setAttribute("role","button"),e.setAttribute("tabindex","0"))},ye=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();var ke=function(){function e(t,n,o,a){var l=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Object(i.h)(this,r.a),this.el=document.createElement("div");var s="jw-icon jw-icon-tooltip "+t+" jw-button-color jw-reset";o||(s+=" jw-hidden"),be(this.el,n),this.el.className=s,this.container=document.createElement("div"),this.container.className="jw-overlay jw-reset",this.openClass="jw-open",this.componentType="tooltip",this.el.appendChild(this.container),a&&a.length>0&&Array.prototype.forEach.call(a,function(e){"string"==typeof e?l.el.appendChild(p(e)):l.el.appendChild(e)})}return ye(e,[{key:"addContent",value:function(e){this.content&&this.removeContent(),this.content=e,this.container.appendChild(e)}},{key:"removeContent",value:function(){this.content&&(this.container.removeChild(this.content),this.content=null)}},{key:"hasContent",value:function(){return!!this.content}},{key:"element",value:function(){return this.el}},{key:"openTooltip",value:function(e){this.trigger("open-"+this.componentType,e,{isOpen:!0}),this.isOpen=!0,Object(s.p)(this.el,this.openClass,this.isOpen)}},{key:"closeTooltip",value:function(e){this.trigger("close-"+this.componentType,e,{isOpen:!1}),this.isOpen=!1,Object(s.p)(this.el,this.openClass,this.isOpen)}},{key:"toggleOpenState",value:function(e){this.isOpen?this.closeTooltip(e):this.openTooltip(e)}}]),e}(),xe=n(33),Ce=n(51),Oe=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();var Ee=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.time=t,this.text=n,this.el=document.createElement("div"),this.el.className="jw-cue jw-reset"}return Oe(e,[{key:"align",value:function(e){if("%"===this.time.toString().slice(-1))this.pct=this.time;else{var t=this.time/e*100;this.pct=t+"%"}this.el.style.left=this.pct}}]),e}(),Te={loadChapters:function(e){Object(xe.a)(e,this.chaptersLoaded.bind(this),this.chaptersFailed,{plainText:!0})},chaptersLoaded:function(e){var t=this,n=Object(Ce.a)(e.responseText);Array.isArray(n)&&(n.forEach(function(e){return t.addCue(e)}),this.drawCues())},chaptersFailed:function(){},addCue:function(e){this.cues.push(new Ee(e.begin,e.text))},drawCues:function(){var e=this,t=this._model.get("duration");!t||t<=0||this.cues.forEach(function(n){n.align(t),n.el.addEventListener("mouseover",function(){e.activeCue=n}),n.el.addEventListener("mouseout",function(){e.activeCue=null}),e.elementRail.appendChild(n.el)})},resetChapters:function(){this.cues.forEach(function(e){e.el.parentNode&&e.el.parentNode.removeChild(e.el)}),this.cues=[]}};var Le={loadThumbnails:function(e){e&&(this.vttPath=e.split("?")[0].split("/").slice(0,-1).join("/"),this.individualImage=null,Object(xe.a)(e,this.thumbnailsLoaded.bind(this),this.thumbnailsFailed.bind(this),{plainText:!0}))},thumbnailsLoaded:function(e){var t=Object(Ce.a)(e.responseText);Array.isArray(t)&&(t.forEach(function(e){this.thumbnails.push(new function(e){this.begin=e.begin,this.end=e.end,this.img=e.text}(e))},this),this.drawCues())},thumbnailsFailed:function(){},chooseThumbnail:function(e){var t=Object(i.B)(this.thumbnails,{end:e},Object(i.z)("end"));t>=this.thumbnails.length&&(t=this.thumbnails.length-1);var n=this.thumbnails[t].img;return n.indexOf("://")<0&&(n=this.vttPath?this.vttPath+"/"+n:n),n},loadThumbnail:function(e){var t=this.chooseThumbnail(e),n={margin:"0 auto",backgroundPosition:"0 0"};if(t.indexOf("#xywh")>0)try{var o=/(.+)#xywh=(\d+),(\d+),(\d+),(\d+)/.exec(t);t=o[1],n.backgroundPosition=-1*o[2]+"px "+-1*o[3]+"px",n.width=o[4],this.timeTip.setWidth(+n.width),n.height=o[5]}catch(e){return}else this.individualImage||(this.individualImage=new Image,this.individualImage.onload=Object(i.b)(function(){this.individualImage.onload=null,this.timeTip.image({width:this.individualImage.width,height:this.individualImage.height}),this.timeTip.setWidth(this.individualImage.width)},this),this.individualImage.src=t);return n.backgroundImage='url("'+t+'")',n},showThumbnail:function(e){this._model.get("containerWidth")<=420||this.thumbnails.length<1||this.timeTip.image(this.loadThumbnail(e))},resetThumbnails:function(){this.timeTip.image({backgroundImage:"",width:0,height:0}),this.thumbnails=[]}},Se=function e(t,n,i){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,n);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,n,i)}if("value"in o)return o.value;var r=o.get;return void 0!==r?r.call(i):void 0},Me=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();function ze(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Be(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _e(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var He=function(e){function t(){return ze(this,t),Be(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return _e(t,ke),Me(t,[{key:"setup",value:function(){this.text=document.createElement("span"),this.text.className="jw-text jw-reset",this.img=document.createElement("div"),this.img.className="jw-time-thumb jw-reset",this.containerWidth=0,this.textLength=0,this.dragJustReleased=!1;var e=document.createElement("div");e.className="jw-time-tip jw-reset",e.appendChild(this.img),e.appendChild(this.text),this.addContent(e)}},{key:"image",value:function(e){Object(pe.d)(this.img,e)}},{key:"update",value:function(e){this.text.textContent=e}},{key:"getWidth",value:function(){return this.containerWidth||this.setWidth(),this.containerWidth}},{key:"setWidth",value:function(e){e?this.containerWidth=e+16:this.container&&(this.containerWidth=Object(s.c)(this.container).width+16)}},{key:"resetWidth",value:function(){this.containerWidth=0}}]),t}();var Ae=function(e){function t(e,n){ze(this,t);var o=Be(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"jw-slider-time","horizontal"));return o._model=e,o._api=n,o.timeTip=new He("jw-tooltip-time",null,!0),o.timeTip.setup(),o.cues=[],o.seekThrottled=Object(i.C)(o.performSeek,400),o.mobileHoverDistance=5,o.setup(),o}return _e(t,me),Me(t,[{key:"setup",value:function(){var e=this;Se(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setup",this).apply(this,arguments),this._model.on("change:duration",this.onDuration,this).on("change:cues",this.addCues,this).on("seeked",function(){e._model.get("scrubbing")||e.updateAriaText()}).change("playlistItem",this.onPlaylistItem,this).change("position",this.onPosition,this).change("buffer",this.onBuffer,this).change("streamType",this.onStreamType,this),Object(s.n)(this.el,"tabindex","0"),Object(s.n)(this.el,"role","slider"),Object(s.n)(this.el,"aria-label","Time Slider"),this.el.removeAttribute("aria-hidden"),this.elementRail.appendChild(this.timeTip.element()),this.elementUI=new u.a(this.el,{useHover:!0,useMove:!0}).on("drag move over",this.showTimeTooltip,this).on("out",this.hideTimeTooltip,this).on("click",function(){return e.el.focus()}),this.el.addEventListener("focus",function(){return e.updateAriaText()})}},{key:"update",value:function(e){this.seekTo=e,this.seekThrottled(),Se(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"update",this).apply(this,arguments)}},{key:"dragStart",value:function(){this._model.set("scrubbing",!0),Se(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"dragStart",this).apply(this,arguments)}},{key:"dragEnd",value:function(){Se(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"dragEnd",this).apply(this,arguments),this._model.set("scrubbing",!1)}},{key:"onBuffer",value:function(e,t){this.updateBuffer(t)}},{key:"onPosition",value:function(e,t){this.updateTime(t,e.get("duration"))}},{key:"onDuration",value:function(e,t){this.updateTime(e.get("position"),t),Object(s.n)(this.el,"aria-valuemin",0),Object(s.n)(this.el,"aria-valuemax",t),this.drawCues()}},{key:"onStreamType",value:function(e,t){this.streamType=t}},{key:"updateTime",value:function(e,t){var n=0;if(t)if("DVR"===this.streamType){var i=this._model.get("dvrSeekLimit"),o=t+i;n=(o-(e+i))/o*100}else"VOD"!==this.streamType&&this.streamType||(n=e/t*100);this.render(n)}},{key:"onPlaylistItem",value:function(e,t){if(t){this.reset(),this.addCues(e,e.get("cues"));var n=t.tracks;Object(i.g)(n,function(e){e&&e.kind&&"thumbnails"===e.kind.toLowerCase()?this.loadThumbnails(e.file):e&&e.kind&&"chapters"===e.kind.toLowerCase()&&this.loadChapters(e.file)},this)}}},{key:"performSeek",value:function(){var e=this.seekTo,t=this._model.get("duration"),n=void 0;if(0===t)this._api.play({reason:"interaction"});else if("DVR"===this.streamType){var i=this._model.get("seekRange"),o=this._model.get("dvrSeekLimit");n=i.start+(-t-o)*e/100,this._api.seek(n,{reason:"interaction"})}else n=e/100*t,this._api.seek(Math.min(n,t-.25),{reason:"interaction"})}},{key:"showTimeTooltip",value:function(e){var t=this,n=this._model.get("duration");if(0!==n){var i=this._model.get("containerWidth"),o=Object(s.c)(this.elementRail),a=e.pageX?e.pageX-o.left:e.x,r=(a=Object(l.a)(a,0,o.width))/o.width,c=n*r;if(n<0)c=(n+=this._model.get("dvrSeekLimit"))-(c=n*r);var w=void 0;if("touch"===Object(u.b)(e.sourceEvent)&&(this.activeCue=this.cues.reduce(function(e,n){return Math.abs(a-parseInt(n.pct)/100*o.width)<t.mobileHoverDistance?n:e},void 0)),this.activeCue)w=this.activeCue.text;else{w=Object(fe.timeFormat)(c,!0),n<0&&c>-1&&(w="Live")}var p=this.timeTip;p.update(w),this.textLength!==w.length&&(this.textLength=w.length,p.resetWidth()),this.showThumbnail(c),Object(s.a)(p.el,"jw-open");var d=p.getWidth(),j=o.width/100,h=i-o.width,f=0;d>h&&(f=(d-h)/(200*j));var g=100*Math.min(1-f,Math.max(f,r)).toFixed(3);Object(pe.d)(p.el,{left:g+"%"})}}},{key:"hideTimeTooltip",value:function(){Object(s.l)(this.timeTip.el,"jw-open")}},{key:"addCues",value:function(e,t){var n=this;this.resetChapters(),t&&t.length&&(t.forEach(function(e){n.addCue(e)}),this.drawCues())}},{key:"updateAriaText",value:function(){var e=this._model.get("position"),t=this._model.get("duration"),n=void 0;n="DVR"===this.streamType?Object(fe.timeFormat)(e):Object(fe.timeFormat)(e)+" of "+Object(fe.timeFormat)(t),Object(s.n)(this.el,"aria-valuetext",n)}},{key:"reset",value:function(){this.resetThumbnails(),this.timeTip.resetWidth(),this.textLength=0}}]),t}();Object(i.h)(Ae.prototype,Te,Le);var Pe=Ae,Ie=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();var Ve=function(e){function t(e,n,i,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var a=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,n,i,!0,o));return a._model=e,a.volumeSlider=new me("jw-slider-volume jw-volume-tip","vertical"),a.volumeSlider.setup(),a.volumeSlider.element().classList.remove("jw-background-color"),a.addContent(a.volumeSlider.element()),a.volumeSlider.on("update",function(e){this.trigger("update",e),this.el.focus()},a),new u.a(a.el,{useHover:!0,directSelect:!0,useFocus:!0}).on("click enter",a.toggleValue,a).on("tap",a.toggleOpenState,a).on("over",a.openTooltip,a).on("out",a.closeTooltip,a),a._model.on("change:volume",a.onVolume,a),a}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,ke),Ie(t,[{key:"toggleValue",value:function(){this.trigger("toggleValue")}}]),t}();function Ne(e,t,n,i){var o=document.createElement("div");o.className="jw-reset jw-tooltip jw-tooltip-"+t;var a=document.createElement("div");a.className="jw-text",a.textContent=n,o.appendChild(a),e.appendChild(o);var r={open:function(){r.touchEvent||(o.setAttribute("aria-expanded","true"),Object(s.a)(o,"jw-open"),i&&i())},close:function(){r.touchEvent||(o.setAttribute("aria-expanded","false"),Object(s.l)(o,"jw-open"))},setText:function(e){o.querySelector(".jw-text").textContent=e}};return e.addEventListener("mouseover",r.open),e.addEventListener("focus",r.open),e.addEventListener("blur",r.close),e.addEventListener("mouseout",r.close),e.addEventListener("touchstart",function(){r.touchEvent=!0},{passive:!0}),r}var Re=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();function Ue(e,t){var n=document.createElement("div");return n.className="jw-icon jw-icon-inline jw-text jw-reset "+e,t&&Object(s.n)(n,"role",t),n}function De(e){var t=document.createElement("div");return t.className="jw-reset "+e,t}function qe(e,t){return e.filter(function(e){return!t.some(function(t){return t.id+t.btnClass===e.id+e.btnClass&&e.callback===t.callback})})}var Fe=function(e,t){t.forEach(function(t){t.element&&(t=t.element()),e.appendChild(t)})},We=function(){function e(t,n){var l=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Object(i.h)(this,r.a),this._api=t,this._model=n,this._isMobile=o.OS.mobile;var c=n.get("localization"),w=new Pe(n,t),p=void 0,j=void 0,h=c.volume;if(!(n.get("sdkplatform")||o.OS.iOS&&o.OS.version.major<10)){var f=se("volume-0,volume-100");j=d("jw-icon-volume",function(){t.setMute()},h,f)}if(!this._isMobile){var g=(p=new Ve(n,"jw-icon-volume",h,se("volume-0,volume-50,volume-100"))).element();Object(s.n)(g,"aria-valuemin",0),Object(s.n)(g,"aria-valuemax",100),Object(s.n)(g,"role","slider")}var v=d("jw-icon-next",function(){t.next()},c.next,se("next")),m=d("jw-icon-settings jw-settings-submenu-button",function(e){l.trigger("settingsInteraction","quality",!0,e)},c.settings,se("settings"));Object(s.n)(m.element(),"aria-haspopup","true");var b=d("jw-icon-cc jw-settings-submenu-button",function(e){l.trigger("settingsInteraction","captions",!1,e)},c.cc,se("cc-off,cc-on"));Object(s.n)(b.element(),"aria-haspopup","true");var y=d("jw-text-live",function(){l.goToLiveEdge()},c.liveBroadcast);y.element().textContent=c.liveBroadcast;var k,x,C,O=this.elements={alt:(k="jw-text-alt",x="status",C=document.createElement("span"),C.className="jw-text jw-reset "+k,x&&Object(s.n)(C,"role",x),C),play:d("jw-icon-playback",function(){t.playToggle({reason:"interaction"})},c.play,se("play,pause,stop")),rewind:d("jw-icon-rewind",function(){l.rewind()},c.rewind,se("rewind")),live:y,next:v,elapsed:Ue("jw-text-elapsed","timer"),countdown:Ue("jw-text-countdown","timer"),time:w,duration:Ue("jw-text-duration","timer"),mute:j,volumetooltip:p,cast:function(e,t){if(o.Browser.safari){var n=d("jw-icon-airplay jw-off",e,t.airplay,se("airplay-off,airplay-on"));return Ne(n.element(),"airplay",t.airplay),n}if(o.Browser.chrome&&!o.OS.iOS){var i=document.createElement("button","google-cast-button");Object(s.n)(i,"type","button"),Object(s.n)(i,"tabindex","-1");var a=document.createElement("div");return a.className="jw-reset jw-icon jw-icon-inline jw-icon-cast jw-button-color",a.style.display="none",a.style.cursor="pointer",a.appendChild(i),be(a,t.cast),Ne(a,"chromecast",t.cast),{element:function(){return a},toggle:function(e){e?this.show():this.hide()},show:function(){a.style.display=""},hide:function(){a.style.display="none"},button:i}}}(function(){t.castToggle()},c),fullscreen:d("jw-icon-fullscreen",function(){t.setFullscreen()},c.fullscreen,se("fullscreen-off,fullscreen-on")),spacer:De("jw-spacer"),buttonContainer:De("jw-button-container"),settingsButton:m,captionsButton:b},E=Ne(b.element(),"captions",c.cc),T=function(e){var t=e.get("captionsList")[e.get("captionsIndex")],n=c.cc;t&&"Off"!==t.label&&(n=t.label),E.setText(n)},L=Ne(O.next.element(),"next",c.nextUp,function(){var e=n.get("nextUp");l.trigger("nextShown",{mode:e.mode,ui:"nextup",itemsShown:[e],feedData:e.feedData,reason:"hover"})});Ne(O.rewind.element(),"rewind",c.rewind),Ne(O.settingsButton.element(),"settings",c.settings),Ne(O.fullscreen.element(),"fullscreen",c.fullscreen);var S=[O.play,O.rewind,O.next,O.volumetooltip,O.mute,O.alt,O.live,O.elapsed,O.countdown,O.duration,O.spacer,O.cast,O.captionsButton,O.settingsButton,O.fullscreen].filter(function(e){return e}),M=[O.time,O.buttonContainer].filter(function(e){return e}),z=this.menus=[O.volumetooltip].filter(function(e){return e});this.el=document.createElement("div"),this.el.className="jw-controlbar jw-reset",Fe(O.buttonContainer,S),Fe(this.el,M);var B=n.get("logo");B&&"control-bar"===B.position&&this.addLogo(B),O.play.show(),O.fullscreen.show(),O.mute&&O.mute.show(),n.change("volume",this.onVolume,this),n.change("mute",this.onMute,this),n.change("state",this.onState,this),n.change("duration",this.onDuration,this),n.change("position",this.onElapsed,this),n.change("fullscreen",this.onFullscreen,this),n.change("streamType",this.onStreamTypeChange,this),n.change("dvrLive",function(e,t){Object(s.p)(l.elements.live.element(),"jw-dvr-live",!1===t)},this),n.change("altText",this.setAltText,this),n.change("customButtons",this.updateButtons,this),n.on("change:captionsIndex",T,this),n.on("change:captionsList",T,this),n.change("nextUp",function(e,t){var n=c.nextUp;t&&t.title&&(n+=": "+t.title),L.setText(n),O.next.toggle(!!t)}),n.change("audioMode",this.onAudioMode,this),O.cast&&(n.change("castAvailable",this.onCastAvailable,this),n.change("castActive",this.onCastActive,this)),O.volumetooltip&&(O.volumetooltip.on("update",function(e){var t=e.percentage;this._api.setVolume(t)},this),O.volumetooltip.on("toggleValue",function(){this._api.setMute()},this)),O.cast&&O.cast.button&&new u.a(O.cast.element()).on("click tap enter",function(e){"click"!==e.type&&O.cast.button.click(),this._model.set("castClicked",!0)},this),new u.a(O.duration).on("click tap enter",function(){if("DVR"===this._model.get("streamType")){var e=this._model.get("position"),t=this._model.get("dvrSeekLimit");this._api.seek(Math.max(-t,e),{reason:"interaction"})}},this),new u.a(this.el).on("click tap drag",function(){this.trigger(a.Qa)},this),Object(i.g)(z,function(e){e.on("open-tooltip",this.closeMenus,this)},this)}return Re(e,[{key:"onVolume",value:function(e,t){this.renderVolume(e.get("mute"),t)}},{key:"onMute",value:function(e,t){this.renderVolume(t,e.get("volume"))}},{key:"renderVolume",value:function(e,t){var n=this.elements.mute,i=this.elements.volumetooltip;if(n&&(Object(s.p)(n.element(),"jw-off",e),Object(s.p)(n.element(),"jw-full",!e)),i){var o=e?0:t,a=i.element();i.volumeSlider.render(o),Object(s.p)(a,"jw-off",e),Object(s.p)(a,"jw-full",t>=75&&!e),Object(s.n)(a,"aria-valuenow",o),Object(s.n)(a,"aria-valuetext","Volume "+o+"%")}}},{key:"onCastAvailable",value:function(e,t){this.elements.cast.toggle(t)}},{key:"onCastActive",value:function(e,t){this.elements.fullscreen.toggle(!t),this.elements.cast.button&&Object(s.p)(this.elements.cast.button,"jw-off",!t)}},{key:"onElapsed",value:function(e,t){var n=void 0,i=void 0,o=e.get("duration");if("DVR"===e.get("streamType")){var a=Math.ceil(t),r=this._model.get("dvrSeekLimit");n=i=a>=-r?"":"-"+Object(fe.timeFormat)(-(t+r)),e.set("dvrLive",a>=-r)}else n=Object(fe.timeFormat)(t),i=Object(fe.timeFormat)(o-t);this.elements.elapsed.textContent=n,this.elements.countdown.textContent=i}},{key:"onDuration",value:function(e,t){this.elements.duration.textContent=Object(fe.timeFormat)(Math.abs(t))}},{key:"onFullscreen",value:function(e,t){Object(s.p)(this.elements.fullscreen.element(),"jw-off",t),this.elements.play.element().focus()}},{key:"onAudioMode",value:function(e,t){var n=this.elements.time.element();t?this.elements.buttonContainer.insertBefore(n,this.elements.elapsed):Object(s.j)(this.el,n)}},{key:"element",value:function(){return this.el}},{key:"setAltText",value:function(e,t){this.elements.alt.textContent=t}},{key:"closeMenus",value:function(e){Object(i.g)(this.menus,function(t){e&&e.target===t.el||t.closeTooltip(e)})}},{key:"rewind",value:function(){var e=this._model.get("position"),t=this._model.get("duration"),n=e-10,i=0;"DVR"===this._model.get("streamType")&&(i=t),this._api.seek(Math.max(n,i),{reason:"interaction"})}},{key:"onState",value:function(e,t){var n=e.get("localization"),i=n.play;t===a.Na&&(i="LIVE"!==e.get("streamType")?n.pause:n.stop),Object(s.n)(this.elements.play.element(),"aria-label",i)}},{key:"onStreamTypeChange",value:function(e,t){var n="LIVE"===t,i="DVR"===t;this.elements.rewind.toggle(!n),this.elements.live.toggle(n||i),Object(s.n)(this.elements.live.element(),"tabindex",n?"-1":"0"),this.elements.duration.style.display=i?"none":"",this.onDuration(e,e.get("duration")),this.onState(e,e.get("state"))}},{key:"addLogo",value:function(e){var t=this.elements.buttonContainer,n=new he(e.file,"Logo",function(){e.link&&window.open(e.link,"_blank")},"logo","jw-logo-button");e.link||Object(s.n)(n.element(),"tabindex","-1"),t.insertBefore(n.element(),t.querySelector(".jw-spacer").nextSibling)}},{key:"goToLiveEdge",value:function(){if("DVR"===this._model.get("streamType")){var e=this._model.get("position"),t=this._model.get("dvrSeekLimit");this._api.seek(Math.max(-t,e),{reason:"interaction"})}}},{key:"updateButtons",value:function(e,t,n){if(t){var i=this.elements.buttonContainer,o=void 0,a=void 0;t!==n&&n?(o=qe(t,n),a=qe(n,t),this.removeButtons(i,a)):o=t;for(var r=o.length-1;r>=0;r--){var l=o[r],s=new he(l.img,l.tooltip,l.callback,l.id,l.btnClass);l.tooltip&&Ne(s.element(),l.id,l.tooltip);var c=void 0;"related"===s.id?c=this.elements.settingsButton.element():"share"===s.id?c=i.querySelector('[button="related"]')||this.elements.settingsButton.element():(c=this.elements.spacer.nextSibling)&&"logo"===c.getAttribute("button")&&(c=c.nextSibling),i.insertBefore(s.element(),c)}}}},{key:"removeButtons",value:function(e,t){for(var n=t.length;n--;){var i=e.querySelector('[button="'+t[n].id+'"]');i&&e.removeChild(i)}}},{key:"toggleCaptionsButtonState",value:function(e){var t=this.elements.captionsButton;t&&Object(s.p)(t.element(),"jw-off",!e)}}]),e}(),Ze=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return'<div class="jw-display-icon-container jw-display-icon-'+e+' jw-reset"><div class="jw-icon jw-icon-'+e+' jw-button-color jw-reset" role="button" tabindex="0" aria-label="'+(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"")+'"></div></div>'},Xe=function(e){return'<div class="jw-display jw-reset"><div class="jw-display-container jw-reset"><div class="jw-display-controls jw-reset">'+Ze("rewind",e.rewind)+Ze("display",e.playback)+Ze("next",e.next)+"</div></div></div>"},Je=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();var Ke=function(){function e(t,n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.el=i,new u.a(this.el).on("click tap enter",function(){var e=t.get("position"),i=t.get("duration"),o=e-10,a=0;"DVR"===t.get("streamType")&&(a=i),n.seek(Math.max(o,a))})}return Je(e,[{key:"element",value:function(){return this.el}}]),e}(),Ye=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();var Qe=function(){function e(t,n,o){var a=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Object(i.h)(this,r.a);var l=t.get("localization"),s=o.getElementsByClassName("jw-icon-display")[0],c=t.get("idleButton");o.style.cursor="pointer",this.icon=s,this.el=o,new u.a(this.el).on("click tap enter",function(e){a.trigger(e.type)}),t.on("change:state",function(e,t,n){var i=void 0;switch(t){case"buffering":i=l.buffer;break;case"playing":i=l.pause;break;case"idle":case"paused":i=l.playback;break;case"complete":i=l.replay;break;default:i=""}""!==i?s.setAttribute("aria-label",i):s.removeAttribute("aria-label"),a.toggleIdleClass(n,t,c)}),this.toggleIdleClass("","idle",c)}return Ye(e,[{key:"element",value:function(){return this.el}},{key:"toggleIdleClass",value:function(e,t,n){"stroke"!==n&&"fill"!==n&&"label"!==n||("idle"===e?Object(s.l)(this.icon,"jw-ab-idle-"+n):"idle"===t&&Object(s.a)(this.icon,"jw-ab-idle-"+n))}}]),e}(),Ge=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();var $e=function(){function e(t,n,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),new u.a(i).on("click tap enter",function(){n.next()}),t.change("nextUp",function(e,t){i.style.visibility=t?"":"hidden"}),this.el=i}return Ge(e,[{key:"element",value:function(){return this.el}}]),e}(),et=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();var tt=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.el=Object(s.e)(Xe(t.get("localization")));var i=this.el.querySelector(".jw-display-controls"),o={};nt("rewind",se("rewind"),Ke,i,o,t,n),nt("display",se("play,pause,buffer,replay"),Qe,i,o,t,n),nt("next",se("next"),$e,i,o,t,n),this.container=i,this.buttons=o}return et(e,[{key:"element",value:function(){return this.el}}]),e}();function nt(e,t,n,i,o,a,r){var l=i.querySelector(".jw-display-icon-"+e),s=i.querySelector(".jw-icon-"+e);t.forEach(function(e){s.appendChild(e)}),o[e]=new n(a,r,l)}var it=n(1),ot=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();var at=function(){function e(t,n,o){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Object(i.h)(this,r.a),this._model=t,this._api=n,this._playerElement=o,this.nextUpText=t.get("localization").nextUp,this.nextUpClose=t.get("localization").nextUpClose,this.state="tooltip",this.enabled=!1,this.shown=!1,this.reset()}return ot(e,[{key:"setup",value:function(e){this.container=e.createElement("div"),this.container.className="jw-nextup-container jw-reset";var t=Object(s.e)(function(){return'<div class="jw-nextup jw-background-color jw-reset"><div class="jw-nextup-tooltip jw-reset"><div class="jw-nextup-thumbnail jw-reset"></div><div class="jw-nextup-body jw-reset"><div class="jw-nextup-header jw-reset">'+(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")+'</div><div class="jw-nextup-title jw-reset">'+(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"")+'</div><div class="jw-nextup-duration jw-reset">'+(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"")+'</div></div></div><button type="button" class="jw-icon jw-nextup-close jw-reset" aria-label="'+(arguments.length>3&&void 0!==arguments[3]?arguments[3]:"")+'"></button></div>'}());t.querySelector(".jw-nextup-close").appendChild(le("close")),this.addContent(t),this.closeButton=this.content.querySelector(".jw-nextup-close"),this.closeButton.setAttribute("aria-label",this.nextUpClose),this.tooltip=this.content.querySelector(".jw-nextup-tooltip");var n=this._model,i=n.player;this.enabled=!1,n.on("change:nextUp",this.onNextUp,this),i.change("duration",this.onDuration,this),i.change("position",this.onElapsed,this),i.change("streamType",this.onStreamType,this),i.change("state",function(e,t){"complete"===t&&this.toggle(!1)},this),new u.a(this.closeButton,{directSelect:!0}).on("click tap enter",function(){this.nextUpSticky=!1,this.toggle(!1)},this),new u.a(this.tooltip).on("click tap",this.click,this)}},{key:"loadThumbnail",value:function(e){return this.nextUpImage=new Image,this.nextUpImage.onload=function(){this.nextUpImage.onload=null}.bind(this),this.nextUpImage.src=e,{backgroundImage:'url("'+e+'")'}}},{key:"click",value:function(){this.reset(),this._api.next()}},{key:"toggle",value:function(e,t){if(this.enabled&&(Object(s.p)(this.container,"jw-nextup-sticky",!!this.nextUpSticky),this.shown!==e)){this.shown=e,Object(s.p)(this.container,"jw-nextup-container-visible",e),Object(s.p)(this._playerElement,"jw-flag-nextup",e);var n=this._model.get("nextUp");e&&n&&this.trigger("nextShown",{mode:n.mode,ui:"nextup",itemsShown:[n],feedData:n.feedData,reason:t})}}},{key:"setNextUpItem",value:function(e){var t=this;setTimeout(function(){if(t.thumbnail=t.content.querySelector(".jw-nextup-thumbnail"),Object(s.p)(t.content,"jw-nextup-thumbnail-visible",!!e.image),e.image){var n=t.loadThumbnail(e.image);Object(pe.d)(t.thumbnail,n)}t.header=t.content.querySelector(".jw-nextup-header"),t.header.innerText=t.nextUpText,t.title=t.content.querySelector(".jw-nextup-title");var i=e.title;if(t.title.innerText=i?Object(s.e)(i).textContent:"",e.duration){t.duration=t.content.querySelector(".jw-nextup-duration");var o=e.duration;t.duration.innerText=o?Object(s.e)(o).textContent:""}},500)}},{key:"onNextUp",value:function(e,t){this.reset(),t&&(this.enabled=!(!t.title&&!t.image),this.enabled&&(t.showNextUp||(this.nextUpSticky=!1,this.toggle(!1)),this.setNextUpItem(t)))}},{key:"onDuration",value:function(e,t){if(t){var n=Object(it.f)(e.get("nextupoffset")||-10);n<0&&(n+=t),this.offset=n}}},{key:"onElapsed",value:function(e,t){var n=this.nextUpSticky;if(this.enabled&&!1!==n){var i=t>=this.offset;i&&void 0===n?(this.nextUpSticky=i,this.toggle(i,"time")):!i&&n&&this.reset()}}},{key:"onStreamType",value:function(e,t){"VOD"!==t&&(this.nextUpSticky=!1,this.toggle(!1))}},{key:"element",value:function(){return this.container}},{key:"addContent",value:function(e){this.content&&this.removeContent(),this.content=e,this.container.appendChild(e)}},{key:"removeContent",value:function(){this.content&&(this.container.removeChild(this.content),this.content=null)}},{key:"reset",value:function(){this.nextUpSticky=void 0,this.toggle(!1)}},{key:"destroy",value:function(){this.off(),this._model.off(null,null,this)}}]),e}(),rt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments[2],i=arguments[3];return'<li class="jw-reset jw-rightclick-item '+(n?"jw-featured":"")+'"><a href="'+e+'" class="jw-rightclick-link jw-reset" target="_blank">'+(i?'<span class="jw-rightclick-logo jw-reset"></span>':"")+t+"</a></li>"},lt=function(e){return'<li class="jw-reset jw-rightclick-item"><button type="button" class="jw-reset jw-rightclick-link jw-info-overlay-item">'+e+"</button></li>"},st=n(23),ct=n(7),ut=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}();function wt(e){var t=Object(s.e)(e),n=t.querySelector(".jw-rightclick-logo");return n&&n.appendChild(le("jwplayer-logo")),t}var pt=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.infoOverlay=t}return ut(e,[{key:"buildArray",value:function(){var e={items:[{title:'Powered by <span class="jw-reset">JW Player '+st.a.split("+")[0]+"</span>",featured:!0,showLogo:!0,link:"https://jwplayer.com/learn-more"}]},t=this.model.get("provider");if(t&&t.name.indexOf("flash")>=0){var n="Flash Version "+Object(ct.a)();e.items.push({title:n,link:"http://www.adobe.com/software/flash/about/"})}return e}},{key:"rightClick",value:function(e){return this.lazySetup(),!this.mouseOverContext&&(this.hideMenu(),this.showMenu(e),this.addHideMenuHandlers(),!1)}},{key:"getOffset",value:function(e){var t=Object(s.c)(this.playerElement),n=e.pageX-t.left,i=e.pageY-t.top;return this.model.get("touchMode")&&(i-=100),{x:n,y:i}}},{key:"showMenu",value:function(e){var t=this,n=this.getOffset(e);return this.el.style.left=n.x+"px",this.el.style.top=n.y+"px",this.outCount=0,Object(s.a)(this.playerElement,"jw-flag-rightclick-open"),Object(s.a)(this.el,"jw-open"),clearTimeout(this._menuTimeout),this._menuTimeout=setTimeout(function(){return t.hideMenu()},3e3),!1}},{key:"hideMenu",value:function(e){e&&this.el.contains(e.target)||(Object(s.l)(this.playerElement,"jw-flag-rightclick-open"),Object(s.l)(this.el,"jw-open"))}},{key:"lazySetup",value:function(){var e,t,n,i,o=this,a=(e=this.buildArray(),t=this.model.get("localization"),n=e.items,(i=(void 0===n?[]:n).map(function(e){return rt(e.link,e.title,e.featured,e.showLogo)})).unshift(lt(t.videoInfo)),'<div class="jw-rightclick jw-reset"><ul class="jw-rightclick-list jw-reset">'+i.join("")+"</ul></div>");if(this.el){if(this.html!==a){this.html=a;var r=wt(a);Object(s.g)(this.el);for(var l=r.childNodes.length;l--;)this.el.appendChild(r.firstChild)}}else this.html=a,this.el=wt(this.html),this.layer.appendChild(this.el),this.hideMenuHandler=function(e){return o.hideMenu(e)},this.overHandler=function(){o.mouseOverContext=!0},this.outHandler=function(e){o.mouseOverContext=!1,e.relatedTarget&&!o.el.contains(e.relatedTarget)&&++o.outCount>1&&o.hideMenu()},this.infoOverlayHandler=function(){o.mouseOverContext=!1,o.hideMenu(),o.infoOverlay.open()}}},{key:"setup",value:function(e,t,n){this.playerElement=t,this.model=e,this.mouseOverContext=!1,this.layer=n,o.OS.iOS?(this.startLongPressHandler=this.startLongPress.bind(this),this.cancelLongPressHandler=this.cancelLongPress.bind(this),t.addEventListener("touchstart",this.startLongPressHandler),t.addEventListener("touchmove",this.cancelLongPressHandler),t.addEventListener("touchend",this.cancelLongPressHandler),t.addEventListener("touchcancel",this.cancelLongPressHandler)):t.oncontextmenu=this.rightClick.bind(this)}},{key:"startLongPress",value:function(e){var t=this;this.cancelLongPress(),this.longPressTimeout=setTimeout(function(){t.rightClick(e),t.longPressTimeout=null},500)}},{key:"cancelLongPress",value:function(){clearTimeout(this.longPressTimeout)}},{key:"addHideMenuHandlers",value:function(){this.removeHideMenuHandlers(),this.playerElement.addEventListener("touchstart",this.hideMenuHandler),document.addEventListener("touchstart",this.hideMenuHandler),o.OS.mobile||(this.playerElement.addEventListener("click",this.hideMenuHandler),document.addEventListener("click",this.hideMenuHandler),this.el.addEventListener("mouseover",this.overHandler),this.el.addEventListener("mouseout",this.outHandler)),this.el.querySelector(".jw-info-overlay-item").addEventListener("click",this.infoOverlayHandler)}},{key:"removeHideMenuHandlers",value:function(){this.playerElement&&this.playerElement.removeEventListener("click",this.hideMenuHandler),this.el&&(this.el.querySelector(".jw-info-overlay-item").removeEventListener("click",this.infoOverlayHandler),this.el.removeEventListener("mouseover",this.overHandler),this.el.removeEventListener("mouseout",this.outHandler)),document.removeEventListener("click",this.hideMenuHandler),document.removeEventListener("touchstart",this.hideMenuHandler)}},{key:"destroy",value:function(){clearTimeout(this._menuTimeout),this.removeHideMenuHandlers(),this.el&&(this.hideMenu(),this.hideMenuHandler=null,this.el=null),this.playerElement&&(this.playerElement.removeEventListener("touchstart",this.startLongPressHandler),this.playerElement.removeEventListener("touchmove",this.cancelLongPressHandler),this.playerElement.removeEventListener("touchend",this.cancelLongPressHandler),this.playerElement.removeEventListener("touchcancel",this.cancelLongPressHandler),this.playerElement.oncontextmenu=null,this.playerElement=null),this.model&&(this.model=null)}}]),e}(),dt=function(){return'<div class="jw-reset jw-settings-menu" role="menu" aria-expanded="false"><div class="jw-reset jw-settings-topbar" role="menubar"></div></div>'};function jt(e){var t=document.getElementsByClassName("jw-icon-settings")[0];if(t){var n="Right"===e?Object(s.i)(t):Object(s.k)(t);n&&n.focus()}}var ht=function(e){Object.keys(e).forEach(function(t){e[t].deactivate()})},ft=function(){return'<div class="jw-reset jw-settings-submenu" role="menu" aria-expanded="false"></div>'};var gt=f