videojs-vtt.js
Advanced tools
Comparing version 0.12.6 to 0.14.0
@@ -535,11 +535,2 @@ (function(f){var g;if(typeof window!=='undefined'){g=window}else if(typeof self!=='undefined'){g=self}g.vttjs=f()})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
function CueStyleBox(window, cue, styleOptions) { | ||
var isIE8 = (/MSIE\s8\.0/).test(navigator.userAgent); | ||
var color = "rgba(255, 255, 255, 1)"; | ||
var backgroundColor = "rgba(0, 0, 0, 0.8)"; | ||
if (isIE8) { | ||
color = "rgb(255, 255, 255)"; | ||
backgroundColor = "rgb(0, 0, 0)"; | ||
} | ||
StyleBox.call(this); | ||
@@ -552,4 +543,4 @@ this.cue = cue; | ||
var styles = { | ||
color: color, | ||
backgroundColor: backgroundColor, | ||
color: "rgba(255, 255, 255, 1)", | ||
backgroundColor: "rgba(0, 0, 0, 0.8)", | ||
position: "relative", | ||
@@ -560,11 +551,9 @@ left: 0, | ||
bottom: 0, | ||
display: "inline" | ||
display: "inline", | ||
writingMode: cue.vertical === "" ? "horizontal-tb" | ||
: cue.vertical === "lr" ? "vertical-lr" | ||
: "vertical-rl", | ||
unicodeBidi: "plaintext" | ||
}; | ||
if (!isIE8) { | ||
styles.writingMode = cue.vertical === "" ? "horizontal-tb" | ||
: cue.vertical === "lr" ? "vertical-lr" | ||
: "vertical-rl"; | ||
styles.unicodeBidi = "plaintext"; | ||
} | ||
this.applyStyles(styles, this.cueDiv); | ||
@@ -577,2 +566,7 @@ | ||
styles = { | ||
direction: determineBidi(this.cueDiv), | ||
writingMode: cue.vertical === "" ? "horizontal-tb" | ||
: cue.vertical === "lr" ? "vertical-lr" | ||
: "vertical-rl", | ||
unicodeBidi: "plaintext", | ||
textAlign: cue.align === "middle" ? "center" : cue.align, | ||
@@ -584,12 +578,3 @@ font: styleOptions.font, | ||
if (!isIE8) { | ||
styles.direction = determineBidi(this.cueDiv); | ||
styles.writingMode = cue.vertical === "" ? "horizontal-tb" | ||
: cue.vertical === "lr" ? "vertical-lr" | ||
: "vertical-rl". | ||
stylesunicodeBidi = "plaintext"; | ||
} | ||
this.applyStyles(styles); | ||
this.div.appendChild(this.cueDiv); | ||
@@ -649,4 +634,2 @@ | ||
function BoxPosition(obj) { | ||
var isIE8 = (/MSIE\s8\.0/).test(navigator.userAgent); | ||
// Either a BoxPosition was passed in and we need to copy it, or a StyleBox | ||
@@ -680,6 +663,2 @@ // was passed in and we need to copy the results of 'getBoundingClientRect' | ||
this.lineHeight = lh !== undefined ? lh : obj.lineHeight; | ||
if (isIE8 && !this.lineHeight) { | ||
this.lineHeight = 13; | ||
} | ||
} | ||
@@ -1358,12 +1337,12 @@ | ||
var directionSetting = { | ||
"": true, | ||
"lr": true, | ||
"rl": true | ||
"": 1, | ||
"lr": 1, | ||
"rl": 1 | ||
}; | ||
var alignSetting = { | ||
"start": true, | ||
"middle": true, | ||
"end": true, | ||
"left": true, | ||
"right": true | ||
"start": 1, | ||
"middle": 1, | ||
"end": 1, | ||
"left": 1, | ||
"right": 1 | ||
}; | ||
@@ -1387,25 +1366,3 @@ | ||
function extend(obj) { | ||
var i = 1; | ||
for (; i < arguments.length; i++) { | ||
var cobj = arguments[i]; | ||
for (var p in cobj) { | ||
obj[p] = cobj[p]; | ||
} | ||
} | ||
return obj; | ||
} | ||
function VTTCue(startTime, endTime, text) { | ||
var cue = this; | ||
var isIE8 = (/MSIE\s8\.0/).test(navigator.userAgent); | ||
var baseObj = {}; | ||
if (isIE8) { | ||
cue = document.createElement('custom'); | ||
} else { | ||
baseObj.enumerable = true; | ||
} | ||
/** | ||
@@ -1419,3 +1376,3 @@ * Shim implementation specific properties. These properties are not in | ||
// lazily. | ||
cue.hasBeenReset = false; | ||
this.hasBeenReset = false; | ||
@@ -1442,4 +1399,5 @@ /** | ||
Object.defineProperty(cue, | ||
"id", extend({}, baseObj, { | ||
Object.defineProperties(this, { | ||
"id": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -1451,6 +1409,6 @@ return _id; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"pauseOnExit", extend({}, baseObj, { | ||
"pauseOnExit": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -1462,6 +1420,6 @@ return _pauseOnExit; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"startTime", extend({}, baseObj, { | ||
"startTime": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -1477,6 +1435,6 @@ return _startTime; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"endTime", extend({}, baseObj, { | ||
"endTime": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -1492,6 +1450,6 @@ return _endTime; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"text", extend({}, baseObj, { | ||
"text": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -1504,6 +1462,6 @@ return _text; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"region", extend({}, baseObj, { | ||
"region": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -1516,6 +1474,6 @@ return _region; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"vertical", extend({}, baseObj, { | ||
"vertical": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -1533,6 +1491,6 @@ return _vertical; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"snapToLines", extend({}, baseObj, { | ||
"snapToLines": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -1545,6 +1503,6 @@ return _snapToLines; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"line", extend({}, baseObj, { | ||
"line": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -1560,6 +1518,6 @@ return _line; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"lineAlign", extend({}, baseObj, { | ||
"lineAlign": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -1576,6 +1534,6 @@ return _lineAlign; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"position", extend({}, baseObj, { | ||
"position": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -1591,6 +1549,6 @@ return _position; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"positionAlign", extend({}, baseObj, { | ||
"positionAlign": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -1607,6 +1565,6 @@ return _positionAlign; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"size", extend({}, baseObj, { | ||
"size": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -1622,6 +1580,6 @@ return _size; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"align", extend({}, baseObj, { | ||
"align": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -1638,3 +1596,4 @@ return _align; | ||
} | ||
})); | ||
} | ||
}); | ||
@@ -1646,7 +1605,3 @@ /** | ||
// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#text-track-cue-display-state | ||
cue.displayState = undefined; | ||
if (isIE8) { | ||
return cue; | ||
} | ||
this.displayState = undefined; | ||
} | ||
@@ -1653,0 +1608,0 @@ |
@@ -1,2 +0,2 @@ | ||
/* videojs-vtt.js - v0.12.6 (https://github.com/gkatsev/vtt.js) built on 13-02-2018 */ | ||
!function(a){var b;"undefined"!=typeof window?b=window:"undefined"!=typeof self&&(b=self),b.vttjs=a()}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b){function c(a,b){this.name="ParsingError",this.code=a.code,this.message=b||a.message}function d(a){function b(a,b,c,d){return 3600*(0|a)+60*(0|b)+(0|c)+(0|d)/1e3}var c=a.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/);return c?c[3]?b(c[1],c[2],c[3].replace(":",""),c[4]):c[1]>59?b(c[1],c[2],0,c[4]):b(0,c[1],c[2],c[4]):null}function e(){this.values=q(null)}function f(a,b,c,d){var e=d?a.split(d):[a];for(var f in e)if("string"==typeof e[f]){var g=e[f].split(c);if(2===g.length){var h=g[0],i=g[1];b(h,i)}}}function g(a,b,g){function h(){var b=d(a);if(null===b)throw new c(c.Errors.BadTimeStamp,"Malformed timestamp: "+k);return a=a.replace(/^[^\sa-zA-Z-]+/,""),b}function i(a,b){var c=new e;f(a,function(a,b){switch(a){case"region":for(var d=g.length-1;d>=0;d--)if(g[d].id===b){c.set(a,g[d].region);break}break;case"vertical":c.alt(a,b,["rl","lr"]);break;case"line":var e=b.split(","),f=e[0];c.integer(a,f),c.percent(a,f)?c.set("snapToLines",!1):null,c.alt(a,f,["auto"]),2===e.length&&c.alt("lineAlign",e[1],["start","middle","end"]);break;case"position":e=b.split(","),c.percent(a,e[0]),2===e.length&&c.alt("positionAlign",e[1],["start","middle","end"]);break;case"size":c.percent(a,b);break;case"align":c.alt(a,b,["start","middle","end","left","right"])}},/:/,/\s/),b.region=c.get("region",null),b.vertical=c.get("vertical",""),b.line=c.get("line","auto"),b.lineAlign=c.get("lineAlign","start"),b.snapToLines=c.get("snapToLines",!0),b.size=c.get("size",100),b.align=c.get("align","middle"),b.position=c.get("position",{start:0,left:0,middle:50,end:100,right:100},b.align),b.positionAlign=c.get("positionAlign",{start:"start",left:"start",middle:"middle",end:"end",right:"end"},b.align)}function j(){a=a.replace(/^\s+/,"")}var k=a;if(j(),b.startTime=h(),j(),"-->"!==a.substr(0,3))throw new c(c.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+k);a=a.substr(3),j(),b.endTime=h(),j(),i(a,b)}function h(a,b){function c(){function a(a){return b=b.substr(a.length),a}if(!b)return null;var c=b.match(/^([^<]*)(<[^>]*>?)?/);return a(c[1]?c[1]:c[2])}function e(a){return r[a]}function f(a){for(;o=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(o[0],e);return a}function g(a,b){return!u[b.localName]||u[b.localName]===a.localName}function h(b,c){var d=s[b];if(!d)return null;var e=a.document.createElement(d);e.localName=d;var f=t[b];return f&&c&&(e[f]=c.trim()),e}for(var i,j=a.document.createElement("div"),k=j,l=[];null!==(i=c());)if("<"!==i[0])k.appendChild(a.document.createTextNode(f(i)));else{if("/"===i[1]){l.length&&l[l.length-1]===i.substr(2).replace(">","")&&(l.pop(),k=k.parentNode);continue}var m,n=d(i.substr(1,i.length-2));if(n){m=a.document.createProcessingInstruction("timestamp",n),k.appendChild(m);continue}var o=i.match(/^<([^.\s\/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!o)continue;if(m=h(o[1],o[3]),!m)continue;if(!g(k,m))continue;o[2]&&(m.className=o[2].substr(1).replace("."," ")),l.push(o[1]),k.appendChild(m),k=m}return j}function i(a){for(var b=0;b<v.length;b++){var c=v[b];if(a>=c[0]&&a<=c[1])return!0}return!1}function j(a){function b(a,b){for(var c=b.childNodes.length-1;c>=0;c--)a.push(b.childNodes[c])}function c(a){if(!a||!a.length)return null;var d=a.pop(),e=d.textContent||d.innerText;if(e){var f=e.match(/^.*(\n|\r)/);return f?(a.length=0,f[0]):e}return"ruby"===d.tagName?c(a):d.childNodes?(b(a,d),c(a)):void 0}var d,e=[],f="";if(!a||!a.childNodes)return"ltr";for(b(e,a);f=c(e);)for(var g=0;g<f.length;g++)if(d=f.charCodeAt(g),i(d))return"rtl";return"ltr"}function k(a){if("number"==typeof a.line&&(a.snapToLines||a.line>=0&&a.line<=100))return a.line;if(!a.track||!a.track.textTrackList||!a.track.textTrackList.mediaElement)return-1;for(var b=a.track,c=b.textTrackList,d=0,e=0;e<c.length&&c[e]!==b;e++)"showing"===c[e].mode&&d++;return-1*++d}function l(){}function m(a,b,c){var d=/MSIE\s8\.0/.test(navigator.userAgent),e="rgba(255, 255, 255, 1)",f="rgba(0, 0, 0, 0.8)";d&&(e="rgb(255, 255, 255)",f="rgb(0, 0, 0)"),l.call(this),this.cue=b,this.cueDiv=h(a,b.text);var g={color:e,backgroundColor:f,position:"relative",left:0,right:0,top:0,bottom:0,display:"inline"};d||(g.writingMode=""===b.vertical?"horizontal-tb":"lr"===b.vertical?"vertical-lr":"vertical-rl",g.unicodeBidi="plaintext"),this.applyStyles(g,this.cueDiv),this.div=a.document.createElement("div"),g={textAlign:"middle"===b.align?"center":b.align,font:c.font,whiteSpace:"pre-line",position:"absolute"},d||(g.direction=j(this.cueDiv),g.writingMode=""===b.vertical?"horizontal-tb":"lr"===b.vertical?"vertical-lr":"vertical-rl".stylesunicodeBidi="plaintext"),this.applyStyles(g),this.div.appendChild(this.cueDiv);var i=0;switch(b.positionAlign){case"start":i=b.position;break;case"middle":i=b.position-b.size/2;break;case"end":i=b.position-b.size}this.applyStyles(""===b.vertical?{left:this.formatStyle(i,"%"),width:this.formatStyle(b.size,"%")}:{top:this.formatStyle(i,"%"),height:this.formatStyle(b.size,"%")}),this.move=function(a){this.applyStyles({top:this.formatStyle(a.top,"px"),bottom:this.formatStyle(a.bottom,"px"),left:this.formatStyle(a.left,"px"),right:this.formatStyle(a.right,"px"),height:this.formatStyle(a.height,"px"),width:this.formatStyle(a.width,"px")})}}function n(a){var b,c,d,e,f=/MSIE\s8\.0/.test(navigator.userAgent);if(a.div){c=a.div.offsetHeight,d=a.div.offsetWidth,e=a.div.offsetTop;var g=(g=a.div.childNodes)&&(g=g[0])&&g.getClientRects&&g.getClientRects();a=a.div.getBoundingClientRect(),b=g?Math.max(g[0]&&g[0].height||0,a.height/g.length):0}this.left=a.left,this.right=a.right,this.top=a.top||e,this.height=a.height||c,this.bottom=a.bottom||e+(a.height||c),this.width=a.width||d,this.lineHeight=void 0!==b?b:a.lineHeight,f&&!this.lineHeight&&(this.lineHeight=13)}function o(a,b,c,d){function e(a,b){for(var e,f=new n(a),g=1,h=0;h<b.length;h++){for(;a.overlapsOppositeAxis(c,b[h])||a.within(c)&&a.overlapsAny(d);)a.move(b[h]);if(a.within(c))return a;var i=a.intersectPercentage(c);g>i&&(e=new n(a),g=i),a=new n(f)}return e||f}var f=new n(b),g=b.cue,h=k(g),i=[];if(g.snapToLines){var j;switch(g.vertical){case"":i=["+y","-y"],j="height";break;case"rl":i=["+x","-x"],j="width";break;case"lr":i=["-x","+x"],j="width"}var l=f.lineHeight,m=l*Math.round(h),o=c[j]+l,p=i[0];Math.abs(m)>o&&(m=0>m?-1:1,m*=Math.ceil(o/l)*l),0>h&&(m+=""===g.vertical?c.height:c.width,i=i.reverse()),f.move(p,m)}else{var q=f.lineHeight/c.height*100;switch(g.lineAlign){case"middle":h-=q/2;break;case"end":h-=q}switch(g.vertical){case"":b.applyStyles({top:b.formatStyle(h,"%")});break;case"rl":b.applyStyles({left:b.formatStyle(h,"%")});break;case"lr":b.applyStyles({right:b.formatStyle(h,"%")})}i=["+y","-x","+x","-y"],f=new n(b)}var r=e(f,i);b.move(r.toCSSCompatValues(c))}function p(){}var q=Object.create||function(){function a(){}return function(b){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return a.prototype=b,new a}}();c.prototype=q(Error.prototype),c.prototype.constructor=c,c.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},e.prototype={set:function(a,b){this.get(a)||""===b||(this.values[a]=b)},get:function(a,b,c){return c?this.has(a)?this.values[a]:b[c]:this.has(a)?this.values[a]:b},has:function(a){return a in this.values},alt:function(a,b,c){for(var d=0;d<c.length;++d)if(b===c[d]){this.set(a,b);break}},integer:function(a,b){/^-?\d+$/.test(b)&&this.set(a,parseInt(b,10))},percent:function(a,b){var c;return(c=b.match(/^([\d]{1,3})(\.[\d]*)?%$/))&&(b=parseFloat(b),b>=0&&100>=b)?(this.set(a,b),!0):!1}};var r={"&":"&","<":"<",">":">","‎":"","‏":""," ":" "},s={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},t={v:"title",lang:"lang"},u={rt:"ruby"},v=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];l.prototype.applyStyles=function(a,b){b=b||this.div;for(var c in a)a.hasOwnProperty(c)&&(b.style[c]=a[c])},l.prototype.formatStyle=function(a,b){return 0===a?0:a+b},m.prototype=q(l.prototype),m.prototype.constructor=m,n.prototype.move=function(a,b){switch(b=void 0!==b?b:this.lineHeight,a){case"+x":this.left+=b,this.right+=b;break;case"-x":this.left-=b,this.right-=b;break;case"+y":this.top+=b,this.bottom+=b;break;case"-y":this.top-=b,this.bottom-=b}},n.prototype.overlaps=function(a){return this.left<a.right&&this.right>a.left&&this.top<a.bottom&&this.bottom>a.top},n.prototype.overlapsAny=function(a){for(var b=0;b<a.length;b++)if(this.overlaps(a[b]))return!0;return!1},n.prototype.within=function(a){return this.top>=a.top&&this.bottom<=a.bottom&&this.left>=a.left&&this.right<=a.right},n.prototype.overlapsOppositeAxis=function(a,b){switch(b){case"+x":return this.left<a.left;case"-x":return this.right>a.right;case"+y":return this.top<a.top;case"-y":return this.bottom>a.bottom}},n.prototype.intersectPercentage=function(a){var b=Math.max(0,Math.min(this.right,a.right)-Math.max(this.left,a.left)),c=Math.max(0,Math.min(this.bottom,a.bottom)-Math.max(this.top,a.top)),d=b*c;return d/(this.height*this.width)},n.prototype.toCSSCompatValues=function(a){return{top:this.top-a.top,bottom:a.bottom-this.bottom,left:this.left-a.left,right:a.right-this.right,height:this.height,width:this.width}},n.getSimpleBoxPosition=function(a){var b=a.div?a.div.offsetHeight:a.tagName?a.offsetHeight:0,c=a.div?a.div.offsetWidth:a.tagName?a.offsetWidth:0,d=a.div?a.div.offsetTop:a.tagName?a.offsetTop:0;a=a.div?a.div.getBoundingClientRect():a.tagName?a.getBoundingClientRect():a;var e={left:a.left,right:a.right,top:a.top||d,height:a.height||b,bottom:a.bottom||d+(a.height||b),width:a.width||c};return e},p.StringDecoder=function(){return{decode:function(a){if(!a)return"";if("string"!=typeof a)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(a))}}},p.convertCueToDOMTree=function(a,b){return a&&b?h(a,b):null};var w=.05,x="sans-serif",y="1.5%";p.processCues=function(a,b,c){function d(a){for(var b=0;b<a.length;b++)if(a[b].hasBeenReset||!a[b].displayState)return!0;return!1}if(!a||!b||!c)return null;for(;c.firstChild;)c.removeChild(c.firstChild);var e=a.document.createElement("div");if(e.style.position="absolute",e.style.left="0",e.style.right="0",e.style.top="0",e.style.bottom="0",e.style.margin=y,c.appendChild(e),d(b)){var f=[],g=n.getSimpleBoxPosition(e),h=Math.round(g.height*w*100)/100,i={font:h+"px "+x};!function(){for(var c,d,h=0;h<b.length;h++)d=b[h],c=new m(a,d,i),e.appendChild(c.div),o(a,c,g,f),d.displayState=c.div,f.push(n.getSimpleBoxPosition(c))}()}else for(var j=0;j<b.length;j++)e.appendChild(b[j].displayState)},p.Parser=function(a,b,c){c||(c=b,b={}),b||(b={}),this.window=a,this.vttjs=b,this.state="INITIAL",this.buffer="",this.decoder=c||new TextDecoder("utf8"),this.regionList=[]},p.Parser.prototype={reportOrThrowError:function(a){if(!(a instanceof c))throw a;this.onparsingerror&&this.onparsingerror(a)},parse:function(a){function b(){for(var a=k.buffer,b=0;b<a.length&&"\r"!==a[b]&&"\n"!==a[b];)++b;var c=a.substr(0,b);return"\r"===a[b]&&++b,"\n"===a[b]&&++b,k.buffer=a.substr(b),c}function h(a){var b=new e;if(f(a,function(a,c){switch(a){case"id":b.set(a,c);break;case"width":b.percent(a,c);break;case"lines":b.integer(a,c);break;case"regionanchor":case"viewportanchor":var d=c.split(",");if(2!==d.length)break;var f=new e;if(f.percent("x",d[0]),f.percent("y",d[1]),!f.has("x")||!f.has("y"))break;b.set(a+"X",f.get("x")),b.set(a+"Y",f.get("y"));break;case"scroll":b.alt(a,c,["up"])}},/=/,/\s/),b.has("id")){var c=new(k.vttjs.VTTRegion||k.window.VTTRegion);c.width=b.get("width",100),c.lines=b.get("lines",3),c.regionAnchorX=b.get("regionanchorX",0),c.regionAnchorY=b.get("regionanchorY",100),c.viewportAnchorX=b.get("viewportanchorX",0),c.viewportAnchorY=b.get("viewportanchorY",100),c.scroll=b.get("scroll",""),k.onregion&&k.onregion(c),k.regionList.push({id:b.get("id"),region:c})}}function i(a){var b=new e;f(a,function(a,c){switch(a){case"MPEGT":b.integer(a+"S",c);break;case"LOCA":b.set(a+"L",d(c))}},/[^\d]:/,/,/),k.ontimestampmap&&k.ontimestampmap({MPEGTS:b.get("MPEGTS"),LOCAL:b.get("LOCAL")})}function j(a){a.match(/X-TIMESTAMP-MAP/)?f(a,function(a,b){switch(a){case"X-TIMESTAMP-MAP":i(b)}},/=/):f(a,function(a,b){switch(a){case"Region":h(b)}},/:/)}var k=this;a&&(k.buffer+=k.decoder.decode(a,{stream:!0}));try{var l;if("INITIAL"===k.state){if(!/\r\n|\n/.test(k.buffer))return this;l=b();var m=l.match(/^WEBVTT([ \t].*)?$/);if(!m||!m[0])throw new c(c.Errors.BadSignature);k.state="HEADER"}for(var n=!1;k.buffer;){if(!/\r\n|\n/.test(k.buffer))return this;switch(n?n=!1:l=b(),k.state){case"HEADER":/:/.test(l)?j(l):l||(k.state="ID");continue;case"NOTE":l||(k.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(l)){k.state="NOTE";break}if(!l)continue;if(k.cue=new(k.vttjs.VTTCue||k.window.VTTCue)(0,0,""),k.state="CUE",-1===l.indexOf("-->")){k.cue.id=l;continue}case"CUE":try{g(l,k.cue,k.regionList)}catch(o){k.reportOrThrowError(o),k.cue=null,k.state="BADCUE";continue}k.state="CUETEXT";continue;case"CUETEXT":var p=-1!==l.indexOf("-->");if(!l||p&&(n=!0)){k.oncue&&k.oncue(k.cue),k.cue=null,k.state="ID";continue}k.cue.text&&(k.cue.text+="\n"),k.cue.text+=l;continue;case"BADCUE":l||(k.state="ID");continue}}}catch(o){k.reportOrThrowError(o),"CUETEXT"===k.state&&k.cue&&k.oncue&&k.oncue(k.cue),k.cue=null,k.state="INITIAL"===k.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){var a=this;try{if(a.buffer+=a.decoder.decode(),(a.cue||"HEADER"===a.state)&&(a.buffer+="\n\n",a.parse()),"INITIAL"===a.state)throw new c(c.Errors.BadSignature)}catch(b){a.reportOrThrowError(b)}return a.onflush&&a.onflush(),this}},b.exports=p},{}],2:[function(a,b){function c(a){if("string"!=typeof a)return!1;var b=h[a.toLowerCase()];return b?a.toLowerCase():!1}function d(a){if("string"!=typeof a)return!1;var b=i[a.toLowerCase()];return b?a.toLowerCase():!1}function e(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)a[d]=c[d]}return a}function f(a,b,f){var h=this,i=/MSIE\s8\.0/.test(navigator.userAgent),j={};i?h=document.createElement("custom"):j.enumerable=!0,h.hasBeenReset=!1;var k="",l=!1,m=a,n=b,o=f,p=null,q="",r=!0,s="auto",t="start",u=50,v="middle",w=50,x="middle";return Object.defineProperty(h,"id",e({},j,{get:function(){return k},set:function(a){k=""+a}})),Object.defineProperty(h,"pauseOnExit",e({},j,{get:function(){return l},set:function(a){l=!!a}})),Object.defineProperty(h,"startTime",e({},j,{get:function(){return m},set:function(a){if("number"!=typeof a)throw new TypeError("Start time must be set to a number.");m=a,this.hasBeenReset=!0}})),Object.defineProperty(h,"endTime",e({},j,{get:function(){return n},set:function(a){if("number"!=typeof a)throw new TypeError("End time must be set to a number.");n=a,this.hasBeenReset=!0}})),Object.defineProperty(h,"text",e({},j,{get:function(){return o},set:function(a){o=""+a,this.hasBeenReset=!0}})),Object.defineProperty(h,"region",e({},j,{get:function(){return p},set:function(a){p=a,this.hasBeenReset=!0}})),Object.defineProperty(h,"vertical",e({},j,{get:function(){return q},set:function(a){var b=c(a);if(b===!1)throw new SyntaxError("An invalid or illegal string was specified.");q=b,this.hasBeenReset=!0}})),Object.defineProperty(h,"snapToLines",e({},j,{get:function(){return r},set:function(a){r=!!a,this.hasBeenReset=!0}})),Object.defineProperty(h,"line",e({},j,{get:function(){return s},set:function(a){if("number"!=typeof a&&a!==g)throw new SyntaxError("An invalid number or illegal string was specified.");s=a,this.hasBeenReset=!0}})),Object.defineProperty(h,"lineAlign",e({},j,{get:function(){return t},set:function(a){var b=d(a);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");t=b,this.hasBeenReset=!0}})),Object.defineProperty(h,"position",e({},j,{get:function(){return u},set:function(a){if(0>a||a>100)throw new Error("Position must be between 0 and 100.");u=a,this.hasBeenReset=!0}})),Object.defineProperty(h,"positionAlign",e({},j,{get:function(){return v},set:function(a){var b=d(a);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");v=b,this.hasBeenReset=!0}})),Object.defineProperty(h,"size",e({},j,{get:function(){return w},set:function(a){if(0>a||a>100)throw new Error("Size must be between 0 and 100.");w=a,this.hasBeenReset=!0}})),Object.defineProperty(h,"align",e({},j,{get:function(){return x},set:function(a){var b=d(a);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");x=b,this.hasBeenReset=!0}})),h.displayState=void 0,i?h:void 0}var g="auto",h={"":!0,lr:!0,rl:!0},i={start:!0,middle:!0,end:!0,left:!0,right:!0};f.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},b.exports=f},{}],3:[function(a,b){function c(a){if("string"!=typeof a)return!1;var b=f[a.toLowerCase()];return b?a.toLowerCase():!1}function d(a){return"number"==typeof a&&a>=0&&100>=a}function e(){var a=100,b=3,e=0,f=100,g=0,h=100,i="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return a},set:function(b){if(!d(b))throw new Error("Width must be between 0 and 100.");a=b}},lines:{enumerable:!0,get:function(){return b},set:function(a){if("number"!=typeof a)throw new TypeError("Lines must be set to a number.");b=a}},regionAnchorY:{enumerable:!0,get:function(){return f},set:function(a){if(!d(a))throw new Error("RegionAnchorX must be between 0 and 100.");f=a}},regionAnchorX:{enumerable:!0,get:function(){return e},set:function(a){if(!d(a))throw new Error("RegionAnchorY must be between 0 and 100.");e=a}},viewportAnchorY:{enumerable:!0,get:function(){return h},set:function(a){if(!d(a))throw new Error("ViewportAnchorY must be between 0 and 100.");h=a}},viewportAnchorX:{enumerable:!0,get:function(){return g},set:function(a){if(!d(a))throw new Error("ViewportAnchorX must be between 0 and 100.");g=a}},scroll:{enumerable:!0,get:function(){return i},set:function(a){var b=c(a);if(b===!1)throw new SyntaxError("An invalid or illegal string was specified.");i=b}}})}var f={"":!0,up:!0};b.exports=e},{}],4:[function(a,b){(function(a){b.exports="undefined"!=typeof window?window:"undefined"!=typeof a?a:"undefined"!=typeof self?self:{}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],5:[function(a,b){var c=a("global/window"),d=b.exports={WebVTT:a("./vtt.js"),VTTCue:a("./vttcue.js"),VTTRegion:a("./vttregion.js")};c.vttjs=d,c.WebVTT=d.WebVTT;var e=d.VTTCue,f=d.VTTRegion,g=c.VTTCue,h=c.VTTRegion;d.shim=function(){c.VTTCue=e,c.VTTRegion=f},d.restore=function(){c.VTTCue=g,c.VTTRegion=h},c.VTTCue||d.shim()},{"./vtt.js":1,"./vttcue.js":2,"./vttregion.js":3,"global/window":4}]},{},[5])(5)}); | ||
/* videojs-vtt.js - v0.12.6 (https://github.com/gkatsev/vtt.js) built on 09-04-2018 */ | ||
!function(a){var b;"undefined"!=typeof window?b=window:"undefined"!=typeof self&&(b=self),b.vttjs=a()}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b){function c(a,b){this.name="ParsingError",this.code=a.code,this.message=b||a.message}function d(a){function b(a,b,c,d){return 3600*(0|a)+60*(0|b)+(0|c)+(0|d)/1e3}var c=a.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/);return c?c[3]?b(c[1],c[2],c[3].replace(":",""),c[4]):c[1]>59?b(c[1],c[2],0,c[4]):b(0,c[1],c[2],c[4]):null}function e(){this.values=q(null)}function f(a,b,c,d){var e=d?a.split(d):[a];for(var f in e)if("string"==typeof e[f]){var g=e[f].split(c);if(2===g.length){var h=g[0],i=g[1];b(h,i)}}}function g(a,b,g){function h(){var b=d(a);if(null===b)throw new c(c.Errors.BadTimeStamp,"Malformed timestamp: "+k);return a=a.replace(/^[^\sa-zA-Z-]+/,""),b}function i(a,b){var c=new e;f(a,function(a,b){switch(a){case"region":for(var d=g.length-1;d>=0;d--)if(g[d].id===b){c.set(a,g[d].region);break}break;case"vertical":c.alt(a,b,["rl","lr"]);break;case"line":var e=b.split(","),f=e[0];c.integer(a,f),c.percent(a,f)?c.set("snapToLines",!1):null,c.alt(a,f,["auto"]),2===e.length&&c.alt("lineAlign",e[1],["start","middle","end"]);break;case"position":e=b.split(","),c.percent(a,e[0]),2===e.length&&c.alt("positionAlign",e[1],["start","middle","end"]);break;case"size":c.percent(a,b);break;case"align":c.alt(a,b,["start","middle","end","left","right"])}},/:/,/\s/),b.region=c.get("region",null),b.vertical=c.get("vertical",""),b.line=c.get("line","auto"),b.lineAlign=c.get("lineAlign","start"),b.snapToLines=c.get("snapToLines",!0),b.size=c.get("size",100),b.align=c.get("align","middle"),b.position=c.get("position",{start:0,left:0,middle:50,end:100,right:100},b.align),b.positionAlign=c.get("positionAlign",{start:"start",left:"start",middle:"middle",end:"end",right:"end"},b.align)}function j(){a=a.replace(/^\s+/,"")}var k=a;if(j(),b.startTime=h(),j(),"-->"!==a.substr(0,3))throw new c(c.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+k);a=a.substr(3),j(),b.endTime=h(),j(),i(a,b)}function h(a,b){function c(){function a(a){return b=b.substr(a.length),a}if(!b)return null;var c=b.match(/^([^<]*)(<[^>]*>?)?/);return a(c[1]?c[1]:c[2])}function e(a){return r[a]}function f(a){for(;o=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(o[0],e);return a}function g(a,b){return!u[b.localName]||u[b.localName]===a.localName}function h(b,c){var d=s[b];if(!d)return null;var e=a.document.createElement(d);e.localName=d;var f=t[b];return f&&c&&(e[f]=c.trim()),e}for(var i,j=a.document.createElement("div"),k=j,l=[];null!==(i=c());)if("<"!==i[0])k.appendChild(a.document.createTextNode(f(i)));else{if("/"===i[1]){l.length&&l[l.length-1]===i.substr(2).replace(">","")&&(l.pop(),k=k.parentNode);continue}var m,n=d(i.substr(1,i.length-2));if(n){m=a.document.createProcessingInstruction("timestamp",n),k.appendChild(m);continue}var o=i.match(/^<([^.\s\/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!o)continue;if(m=h(o[1],o[3]),!m)continue;if(!g(k,m))continue;o[2]&&(m.className=o[2].substr(1).replace("."," ")),l.push(o[1]),k.appendChild(m),k=m}return j}function i(a){for(var b=0;b<v.length;b++){var c=v[b];if(a>=c[0]&&a<=c[1])return!0}return!1}function j(a){function b(a,b){for(var c=b.childNodes.length-1;c>=0;c--)a.push(b.childNodes[c])}function c(a){if(!a||!a.length)return null;var d=a.pop(),e=d.textContent||d.innerText;if(e){var f=e.match(/^.*(\n|\r)/);return f?(a.length=0,f[0]):e}return"ruby"===d.tagName?c(a):d.childNodes?(b(a,d),c(a)):void 0}var d,e=[],f="";if(!a||!a.childNodes)return"ltr";for(b(e,a);f=c(e);)for(var g=0;g<f.length;g++)if(d=f.charCodeAt(g),i(d))return"rtl";return"ltr"}function k(a){if("number"==typeof a.line&&(a.snapToLines||a.line>=0&&a.line<=100))return a.line;if(!a.track||!a.track.textTrackList||!a.track.textTrackList.mediaElement)return-1;for(var b=a.track,c=b.textTrackList,d=0,e=0;e<c.length&&c[e]!==b;e++)"showing"===c[e].mode&&d++;return-1*++d}function l(){}function m(a,b,c){l.call(this),this.cue=b,this.cueDiv=h(a,b.text);var d={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:""===b.vertical?"horizontal-tb":"lr"===b.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(d,this.cueDiv),this.div=a.document.createElement("div"),d={direction:j(this.cueDiv),writingMode:""===b.vertical?"horizontal-tb":"lr"===b.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===b.align?"center":b.align,font:c.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(d),this.div.appendChild(this.cueDiv);var e=0;switch(b.positionAlign){case"start":e=b.position;break;case"middle":e=b.position-b.size/2;break;case"end":e=b.position-b.size}this.applyStyles(""===b.vertical?{left:this.formatStyle(e,"%"),width:this.formatStyle(b.size,"%")}:{top:this.formatStyle(e,"%"),height:this.formatStyle(b.size,"%")}),this.move=function(a){this.applyStyles({top:this.formatStyle(a.top,"px"),bottom:this.formatStyle(a.bottom,"px"),left:this.formatStyle(a.left,"px"),right:this.formatStyle(a.right,"px"),height:this.formatStyle(a.height,"px"),width:this.formatStyle(a.width,"px")})}}function n(a){var b,c,d,e;if(a.div){c=a.div.offsetHeight,d=a.div.offsetWidth,e=a.div.offsetTop;var f=(f=a.div.childNodes)&&(f=f[0])&&f.getClientRects&&f.getClientRects();a=a.div.getBoundingClientRect(),b=f?Math.max(f[0]&&f[0].height||0,a.height/f.length):0}this.left=a.left,this.right=a.right,this.top=a.top||e,this.height=a.height||c,this.bottom=a.bottom||e+(a.height||c),this.width=a.width||d,this.lineHeight=void 0!==b?b:a.lineHeight}function o(a,b,c,d){function e(a,b){for(var e,f=new n(a),g=1,h=0;h<b.length;h++){for(;a.overlapsOppositeAxis(c,b[h])||a.within(c)&&a.overlapsAny(d);)a.move(b[h]);if(a.within(c))return a;var i=a.intersectPercentage(c);g>i&&(e=new n(a),g=i),a=new n(f)}return e||f}var f=new n(b),g=b.cue,h=k(g),i=[];if(g.snapToLines){var j;switch(g.vertical){case"":i=["+y","-y"],j="height";break;case"rl":i=["+x","-x"],j="width";break;case"lr":i=["-x","+x"],j="width"}var l=f.lineHeight,m=l*Math.round(h),o=c[j]+l,p=i[0];Math.abs(m)>o&&(m=0>m?-1:1,m*=Math.ceil(o/l)*l),0>h&&(m+=""===g.vertical?c.height:c.width,i=i.reverse()),f.move(p,m)}else{var q=f.lineHeight/c.height*100;switch(g.lineAlign){case"middle":h-=q/2;break;case"end":h-=q}switch(g.vertical){case"":b.applyStyles({top:b.formatStyle(h,"%")});break;case"rl":b.applyStyles({left:b.formatStyle(h,"%")});break;case"lr":b.applyStyles({right:b.formatStyle(h,"%")})}i=["+y","-x","+x","-y"],f=new n(b)}var r=e(f,i);b.move(r.toCSSCompatValues(c))}function p(){}var q=Object.create||function(){function a(){}return function(b){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return a.prototype=b,new a}}();c.prototype=q(Error.prototype),c.prototype.constructor=c,c.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},e.prototype={set:function(a,b){this.get(a)||""===b||(this.values[a]=b)},get:function(a,b,c){return c?this.has(a)?this.values[a]:b[c]:this.has(a)?this.values[a]:b},has:function(a){return a in this.values},alt:function(a,b,c){for(var d=0;d<c.length;++d)if(b===c[d]){this.set(a,b);break}},integer:function(a,b){/^-?\d+$/.test(b)&&this.set(a,parseInt(b,10))},percent:function(a,b){var c;return(c=b.match(/^([\d]{1,3})(\.[\d]*)?%$/))&&(b=parseFloat(b),b>=0&&100>=b)?(this.set(a,b),!0):!1}};var r={"&":"&","<":"<",">":">","‎":"","‏":""," ":" "},s={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},t={v:"title",lang:"lang"},u={rt:"ruby"},v=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];l.prototype.applyStyles=function(a,b){b=b||this.div;for(var c in a)a.hasOwnProperty(c)&&(b.style[c]=a[c])},l.prototype.formatStyle=function(a,b){return 0===a?0:a+b},m.prototype=q(l.prototype),m.prototype.constructor=m,n.prototype.move=function(a,b){switch(b=void 0!==b?b:this.lineHeight,a){case"+x":this.left+=b,this.right+=b;break;case"-x":this.left-=b,this.right-=b;break;case"+y":this.top+=b,this.bottom+=b;break;case"-y":this.top-=b,this.bottom-=b}},n.prototype.overlaps=function(a){return this.left<a.right&&this.right>a.left&&this.top<a.bottom&&this.bottom>a.top},n.prototype.overlapsAny=function(a){for(var b=0;b<a.length;b++)if(this.overlaps(a[b]))return!0;return!1},n.prototype.within=function(a){return this.top>=a.top&&this.bottom<=a.bottom&&this.left>=a.left&&this.right<=a.right},n.prototype.overlapsOppositeAxis=function(a,b){switch(b){case"+x":return this.left<a.left;case"-x":return this.right>a.right;case"+y":return this.top<a.top;case"-y":return this.bottom>a.bottom}},n.prototype.intersectPercentage=function(a){var b=Math.max(0,Math.min(this.right,a.right)-Math.max(this.left,a.left)),c=Math.max(0,Math.min(this.bottom,a.bottom)-Math.max(this.top,a.top)),d=b*c;return d/(this.height*this.width)},n.prototype.toCSSCompatValues=function(a){return{top:this.top-a.top,bottom:a.bottom-this.bottom,left:this.left-a.left,right:a.right-this.right,height:this.height,width:this.width}},n.getSimpleBoxPosition=function(a){var b=a.div?a.div.offsetHeight:a.tagName?a.offsetHeight:0,c=a.div?a.div.offsetWidth:a.tagName?a.offsetWidth:0,d=a.div?a.div.offsetTop:a.tagName?a.offsetTop:0;a=a.div?a.div.getBoundingClientRect():a.tagName?a.getBoundingClientRect():a;var e={left:a.left,right:a.right,top:a.top||d,height:a.height||b,bottom:a.bottom||d+(a.height||b),width:a.width||c};return e},p.StringDecoder=function(){return{decode:function(a){if(!a)return"";if("string"!=typeof a)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(a))}}},p.convertCueToDOMTree=function(a,b){return a&&b?h(a,b):null};var w=.05,x="sans-serif",y="1.5%";p.processCues=function(a,b,c){function d(a){for(var b=0;b<a.length;b++)if(a[b].hasBeenReset||!a[b].displayState)return!0;return!1}if(!a||!b||!c)return null;for(;c.firstChild;)c.removeChild(c.firstChild);var e=a.document.createElement("div");if(e.style.position="absolute",e.style.left="0",e.style.right="0",e.style.top="0",e.style.bottom="0",e.style.margin=y,c.appendChild(e),d(b)){var f=[],g=n.getSimpleBoxPosition(e),h=Math.round(g.height*w*100)/100,i={font:h+"px "+x};!function(){for(var c,d,h=0;h<b.length;h++)d=b[h],c=new m(a,d,i),e.appendChild(c.div),o(a,c,g,f),d.displayState=c.div,f.push(n.getSimpleBoxPosition(c))}()}else for(var j=0;j<b.length;j++)e.appendChild(b[j].displayState)},p.Parser=function(a,b,c){c||(c=b,b={}),b||(b={}),this.window=a,this.vttjs=b,this.state="INITIAL",this.buffer="",this.decoder=c||new TextDecoder("utf8"),this.regionList=[]},p.Parser.prototype={reportOrThrowError:function(a){if(!(a instanceof c))throw a;this.onparsingerror&&this.onparsingerror(a)},parse:function(a){function b(){for(var a=k.buffer,b=0;b<a.length&&"\r"!==a[b]&&"\n"!==a[b];)++b;var c=a.substr(0,b);return"\r"===a[b]&&++b,"\n"===a[b]&&++b,k.buffer=a.substr(b),c}function h(a){var b=new e;if(f(a,function(a,c){switch(a){case"id":b.set(a,c);break;case"width":b.percent(a,c);break;case"lines":b.integer(a,c);break;case"regionanchor":case"viewportanchor":var d=c.split(",");if(2!==d.length)break;var f=new e;if(f.percent("x",d[0]),f.percent("y",d[1]),!f.has("x")||!f.has("y"))break;b.set(a+"X",f.get("x")),b.set(a+"Y",f.get("y"));break;case"scroll":b.alt(a,c,["up"])}},/=/,/\s/),b.has("id")){var c=new(k.vttjs.VTTRegion||k.window.VTTRegion);c.width=b.get("width",100),c.lines=b.get("lines",3),c.regionAnchorX=b.get("regionanchorX",0),c.regionAnchorY=b.get("regionanchorY",100),c.viewportAnchorX=b.get("viewportanchorX",0),c.viewportAnchorY=b.get("viewportanchorY",100),c.scroll=b.get("scroll",""),k.onregion&&k.onregion(c),k.regionList.push({id:b.get("id"),region:c})}}function i(a){var b=new e;f(a,function(a,c){switch(a){case"MPEGT":b.integer(a+"S",c);break;case"LOCA":b.set(a+"L",d(c))}},/[^\d]:/,/,/),k.ontimestampmap&&k.ontimestampmap({MPEGTS:b.get("MPEGTS"),LOCAL:b.get("LOCAL")})}function j(a){a.match(/X-TIMESTAMP-MAP/)?f(a,function(a,b){switch(a){case"X-TIMESTAMP-MAP":i(b)}},/=/):f(a,function(a,b){switch(a){case"Region":h(b)}},/:/)}var k=this;a&&(k.buffer+=k.decoder.decode(a,{stream:!0}));try{var l;if("INITIAL"===k.state){if(!/\r\n|\n/.test(k.buffer))return this;l=b();var m=l.match(/^WEBVTT([ \t].*)?$/);if(!m||!m[0])throw new c(c.Errors.BadSignature);k.state="HEADER"}for(var n=!1;k.buffer;){if(!/\r\n|\n/.test(k.buffer))return this;switch(n?n=!1:l=b(),k.state){case"HEADER":/:/.test(l)?j(l):l||(k.state="ID");continue;case"NOTE":l||(k.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(l)){k.state="NOTE";break}if(!l)continue;if(k.cue=new(k.vttjs.VTTCue||k.window.VTTCue)(0,0,""),k.state="CUE",-1===l.indexOf("-->")){k.cue.id=l;continue}case"CUE":try{g(l,k.cue,k.regionList)}catch(o){k.reportOrThrowError(o),k.cue=null,k.state="BADCUE";continue}k.state="CUETEXT";continue;case"CUETEXT":var p=-1!==l.indexOf("-->");if(!l||p&&(n=!0)){k.oncue&&k.oncue(k.cue),k.cue=null,k.state="ID";continue}k.cue.text&&(k.cue.text+="\n"),k.cue.text+=l;continue;case"BADCUE":l||(k.state="ID");continue}}}catch(o){k.reportOrThrowError(o),"CUETEXT"===k.state&&k.cue&&k.oncue&&k.oncue(k.cue),k.cue=null,k.state="INITIAL"===k.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){var a=this;try{if(a.buffer+=a.decoder.decode(),(a.cue||"HEADER"===a.state)&&(a.buffer+="\n\n",a.parse()),"INITIAL"===a.state)throw new c(c.Errors.BadSignature)}catch(b){a.reportOrThrowError(b)}return a.onflush&&a.onflush(),this}},b.exports=p},{}],2:[function(a,b){function c(a){if("string"!=typeof a)return!1;var b=g[a.toLowerCase()];return b?a.toLowerCase():!1}function d(a){if("string"!=typeof a)return!1;var b=h[a.toLowerCase()];return b?a.toLowerCase():!1}function e(a,b,e){this.hasBeenReset=!1;var g="",h=!1,i=a,j=b,k=e,l=null,m="",n=!0,o="auto",p="start",q=50,r="middle",s=50,t="middle";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return g},set:function(a){g=""+a}},pauseOnExit:{enumerable:!0,get:function(){return h},set:function(a){h=!!a}},startTime:{enumerable:!0,get:function(){return i},set:function(a){if("number"!=typeof a)throw new TypeError("Start time must be set to a number.");i=a,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return j},set:function(a){if("number"!=typeof a)throw new TypeError("End time must be set to a number.");j=a,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return k},set:function(a){k=""+a,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return l},set:function(a){l=a,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return m},set:function(a){var b=c(a);if(b===!1)throw new SyntaxError("An invalid or illegal string was specified.");m=b,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return n},set:function(a){n=!!a,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return o},set:function(a){if("number"!=typeof a&&a!==f)throw new SyntaxError("An invalid number or illegal string was specified.");o=a,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return p},set:function(a){var b=d(a);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");p=b,this.hasBeenReset=!0}},position:{enumerable:!0,get:function(){return q},set:function(a){if(0>a||a>100)throw new Error("Position must be between 0 and 100.");q=a,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return r},set:function(a){var b=d(a);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");r=b,this.hasBeenReset=!0}},size:{enumerable:!0,get:function(){return s},set:function(a){if(0>a||a>100)throw new Error("Size must be between 0 and 100.");s=a,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return t},set:function(a){var b=d(a);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");t=b,this.hasBeenReset=!0}}}),this.displayState=void 0}var f="auto",g={"":1,lr:1,rl:1},h={start:1,middle:1,end:1,left:1,right:1};e.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},b.exports=e},{}],3:[function(a,b){function c(a){if("string"!=typeof a)return!1;var b=f[a.toLowerCase()];return b?a.toLowerCase():!1}function d(a){return"number"==typeof a&&a>=0&&100>=a}function e(){var a=100,b=3,e=0,f=100,g=0,h=100,i="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return a},set:function(b){if(!d(b))throw new Error("Width must be between 0 and 100.");a=b}},lines:{enumerable:!0,get:function(){return b},set:function(a){if("number"!=typeof a)throw new TypeError("Lines must be set to a number.");b=a}},regionAnchorY:{enumerable:!0,get:function(){return f},set:function(a){if(!d(a))throw new Error("RegionAnchorX must be between 0 and 100.");f=a}},regionAnchorX:{enumerable:!0,get:function(){return e},set:function(a){if(!d(a))throw new Error("RegionAnchorY must be between 0 and 100.");e=a}},viewportAnchorY:{enumerable:!0,get:function(){return h},set:function(a){if(!d(a))throw new Error("ViewportAnchorY must be between 0 and 100.");h=a}},viewportAnchorX:{enumerable:!0,get:function(){return g},set:function(a){if(!d(a))throw new Error("ViewportAnchorX must be between 0 and 100.");g=a}},scroll:{enumerable:!0,get:function(){return i},set:function(a){var b=c(a);if(b===!1)throw new SyntaxError("An invalid or illegal string was specified.");i=b}}})}var f={"":!0,up:!0};b.exports=e},{}],4:[function(a,b){(function(a){b.exports="undefined"!=typeof window?window:"undefined"!=typeof a?a:"undefined"!=typeof self?self:{}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],5:[function(a,b){var c=a("global/window"),d=b.exports={WebVTT:a("./vtt.js"),VTTCue:a("./vttcue.js"),VTTRegion:a("./vttregion.js")};c.vttjs=d,c.WebVTT=d.WebVTT;var e=d.VTTCue,f=d.VTTRegion,g=c.VTTCue,h=c.VTTRegion;d.shim=function(){c.VTTCue=e,c.VTTRegion=f},d.restore=function(){c.VTTCue=g,c.VTTRegion=h},c.VTTCue||d.shim()},{"./vtt.js":1,"./vttcue.js":2,"./vttregion.js":3,"global/window":4}]},{},[5])(5)}); |
177
dist/vtt.js
@@ -535,11 +535,2 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.vttjs = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
function CueStyleBox(window, cue, styleOptions) { | ||
var isIE8 = (/MSIE\s8\.0/).test(navigator.userAgent); | ||
var color = "rgba(255, 255, 255, 1)"; | ||
var backgroundColor = "rgba(0, 0, 0, 0.8)"; | ||
if (isIE8) { | ||
color = "rgb(255, 255, 255)"; | ||
backgroundColor = "rgb(0, 0, 0)"; | ||
} | ||
StyleBox.call(this); | ||
@@ -552,4 +543,4 @@ this.cue = cue; | ||
var styles = { | ||
color: color, | ||
backgroundColor: backgroundColor, | ||
color: "rgba(255, 255, 255, 1)", | ||
backgroundColor: "rgba(0, 0, 0, 0.8)", | ||
position: "relative", | ||
@@ -560,11 +551,9 @@ left: 0, | ||
bottom: 0, | ||
display: "inline" | ||
display: "inline", | ||
writingMode: cue.vertical === "" ? "horizontal-tb" | ||
: cue.vertical === "lr" ? "vertical-lr" | ||
: "vertical-rl", | ||
unicodeBidi: "plaintext" | ||
}; | ||
if (!isIE8) { | ||
styles.writingMode = cue.vertical === "" ? "horizontal-tb" | ||
: cue.vertical === "lr" ? "vertical-lr" | ||
: "vertical-rl"; | ||
styles.unicodeBidi = "plaintext"; | ||
} | ||
this.applyStyles(styles, this.cueDiv); | ||
@@ -577,2 +566,7 @@ | ||
styles = { | ||
direction: determineBidi(this.cueDiv), | ||
writingMode: cue.vertical === "" ? "horizontal-tb" | ||
: cue.vertical === "lr" ? "vertical-lr" | ||
: "vertical-rl", | ||
unicodeBidi: "plaintext", | ||
textAlign: cue.align === "middle" ? "center" : cue.align, | ||
@@ -584,12 +578,3 @@ font: styleOptions.font, | ||
if (!isIE8) { | ||
styles.direction = determineBidi(this.cueDiv); | ||
styles.writingMode = cue.vertical === "" ? "horizontal-tb" | ||
: cue.vertical === "lr" ? "vertical-lr" | ||
: "vertical-rl". | ||
stylesunicodeBidi = "plaintext"; | ||
} | ||
this.applyStyles(styles); | ||
this.div.appendChild(this.cueDiv); | ||
@@ -649,4 +634,2 @@ | ||
function BoxPosition(obj) { | ||
var isIE8 = (/MSIE\s8\.0/).test(navigator.userAgent); | ||
// Either a BoxPosition was passed in and we need to copy it, or a StyleBox | ||
@@ -680,6 +663,2 @@ // was passed in and we need to copy the results of 'getBoundingClientRect' | ||
this.lineHeight = lh !== undefined ? lh : obj.lineHeight; | ||
if (isIE8 && !this.lineHeight) { | ||
this.lineHeight = 13; | ||
} | ||
} | ||
@@ -1358,12 +1337,12 @@ | ||
var directionSetting = { | ||
"": true, | ||
"lr": true, | ||
"rl": true | ||
"": 1, | ||
"lr": 1, | ||
"rl": 1 | ||
}; | ||
var alignSetting = { | ||
"start": true, | ||
"middle": true, | ||
"end": true, | ||
"left": true, | ||
"right": true | ||
"start": 1, | ||
"middle": 1, | ||
"end": 1, | ||
"left": 1, | ||
"right": 1 | ||
}; | ||
@@ -1387,25 +1366,3 @@ | ||
function extend(obj) { | ||
var i = 1; | ||
for (; i < arguments.length; i++) { | ||
var cobj = arguments[i]; | ||
for (var p in cobj) { | ||
obj[p] = cobj[p]; | ||
} | ||
} | ||
return obj; | ||
} | ||
function VTTCue(startTime, endTime, text) { | ||
var cue = this; | ||
var isIE8 = (/MSIE\s8\.0/).test(navigator.userAgent); | ||
var baseObj = {}; | ||
if (isIE8) { | ||
cue = document.createElement('custom'); | ||
} else { | ||
baseObj.enumerable = true; | ||
} | ||
/** | ||
@@ -1419,3 +1376,3 @@ * Shim implementation specific properties. These properties are not in | ||
// lazily. | ||
cue.hasBeenReset = false; | ||
this.hasBeenReset = false; | ||
@@ -1442,4 +1399,5 @@ /** | ||
Object.defineProperty(cue, | ||
"id", extend({}, baseObj, { | ||
Object.defineProperties(this, { | ||
"id": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -1451,6 +1409,6 @@ return _id; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"pauseOnExit", extend({}, baseObj, { | ||
"pauseOnExit": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -1462,6 +1420,6 @@ return _pauseOnExit; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"startTime", extend({}, baseObj, { | ||
"startTime": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -1477,6 +1435,6 @@ return _startTime; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"endTime", extend({}, baseObj, { | ||
"endTime": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -1492,6 +1450,6 @@ return _endTime; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"text", extend({}, baseObj, { | ||
"text": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -1504,6 +1462,6 @@ return _text; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"region", extend({}, baseObj, { | ||
"region": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -1516,6 +1474,6 @@ return _region; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"vertical", extend({}, baseObj, { | ||
"vertical": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -1533,6 +1491,6 @@ return _vertical; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"snapToLines", extend({}, baseObj, { | ||
"snapToLines": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -1545,6 +1503,6 @@ return _snapToLines; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"line", extend({}, baseObj, { | ||
"line": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -1560,6 +1518,6 @@ return _line; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"lineAlign", extend({}, baseObj, { | ||
"lineAlign": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -1576,6 +1534,6 @@ return _lineAlign; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"position", extend({}, baseObj, { | ||
"position": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -1591,6 +1549,6 @@ return _position; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"positionAlign", extend({}, baseObj, { | ||
"positionAlign": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -1607,6 +1565,6 @@ return _positionAlign; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"size", extend({}, baseObj, { | ||
"size": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -1622,6 +1580,6 @@ return _size; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"align", extend({}, baseObj, { | ||
"align": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -1638,3 +1596,4 @@ return _align; | ||
} | ||
})); | ||
} | ||
}); | ||
@@ -1646,7 +1605,3 @@ /** | ||
// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#text-track-cue-display-state | ||
cue.displayState = undefined; | ||
if (isIE8) { | ||
return cue; | ||
} | ||
this.displayState = undefined; | ||
} | ||
@@ -1653,0 +1608,0 @@ |
@@ -1,2 +0,2 @@ | ||
/* videojs-vtt.js - v0.12.6 (https://github.com/gkatsev/vtt.js) built on 13-02-2018 */ | ||
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.vttjs=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b){function c(a,b){this.name="ParsingError",this.code=a.code,this.message=b||a.message}function d(a){function b(a,b,c,d){return 3600*(0|a)+60*(0|b)+(0|c)+(0|d)/1e3}var c=a.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/);return c?c[3]?b(c[1],c[2],c[3].replace(":",""),c[4]):c[1]>59?b(c[1],c[2],0,c[4]):b(0,c[1],c[2],c[4]):null}function e(){this.values=q(null)}function f(a,b,c,d){var e=d?a.split(d):[a];for(var f in e)if("string"==typeof e[f]){var g=e[f].split(c);if(2===g.length){var h=g[0],i=g[1];b(h,i)}}}function g(a,b,g){function h(){var b=d(a);if(null===b)throw new c(c.Errors.BadTimeStamp,"Malformed timestamp: "+k);return a=a.replace(/^[^\sa-zA-Z-]+/,""),b}function i(a,b){var c=new e;f(a,function(a,b){switch(a){case"region":for(var d=g.length-1;d>=0;d--)if(g[d].id===b){c.set(a,g[d].region);break}break;case"vertical":c.alt(a,b,["rl","lr"]);break;case"line":var e=b.split(","),f=e[0];c.integer(a,f),c.percent(a,f)?c.set("snapToLines",!1):null,c.alt(a,f,["auto"]),2===e.length&&c.alt("lineAlign",e[1],["start","middle","end"]);break;case"position":e=b.split(","),c.percent(a,e[0]),2===e.length&&c.alt("positionAlign",e[1],["start","middle","end"]);break;case"size":c.percent(a,b);break;case"align":c.alt(a,b,["start","middle","end","left","right"])}},/:/,/\s/),b.region=c.get("region",null),b.vertical=c.get("vertical",""),b.line=c.get("line","auto"),b.lineAlign=c.get("lineAlign","start"),b.snapToLines=c.get("snapToLines",!0),b.size=c.get("size",100),b.align=c.get("align","middle"),b.position=c.get("position",{start:0,left:0,middle:50,end:100,right:100},b.align),b.positionAlign=c.get("positionAlign",{start:"start",left:"start",middle:"middle",end:"end",right:"end"},b.align)}function j(){a=a.replace(/^\s+/,"")}var k=a;if(j(),b.startTime=h(),j(),"-->"!==a.substr(0,3))throw new c(c.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+k);a=a.substr(3),j(),b.endTime=h(),j(),i(a,b)}function h(a,b){function c(){function a(a){return b=b.substr(a.length),a}if(!b)return null;var c=b.match(/^([^<]*)(<[^>]*>?)?/);return a(c[1]?c[1]:c[2])}function e(a){return r[a]}function f(a){for(;o=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(o[0],e);return a}function g(a,b){return!u[b.localName]||u[b.localName]===a.localName}function h(b,c){var d=s[b];if(!d)return null;var e=a.document.createElement(d);e.localName=d;var f=t[b];return f&&c&&(e[f]=c.trim()),e}for(var i,j=a.document.createElement("div"),k=j,l=[];null!==(i=c());)if("<"!==i[0])k.appendChild(a.document.createTextNode(f(i)));else{if("/"===i[1]){l.length&&l[l.length-1]===i.substr(2).replace(">","")&&(l.pop(),k=k.parentNode);continue}var m,n=d(i.substr(1,i.length-2));if(n){m=a.document.createProcessingInstruction("timestamp",n),k.appendChild(m);continue}var o=i.match(/^<([^.\s\/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!o)continue;if(m=h(o[1],o[3]),!m)continue;if(!g(k,m))continue;o[2]&&(m.className=o[2].substr(1).replace("."," ")),l.push(o[1]),k.appendChild(m),k=m}return j}function i(a){for(var b=0;b<v.length;b++){var c=v[b];if(a>=c[0]&&a<=c[1])return!0}return!1}function j(a){function b(a,b){for(var c=b.childNodes.length-1;c>=0;c--)a.push(b.childNodes[c])}function c(a){if(!a||!a.length)return null;var d=a.pop(),e=d.textContent||d.innerText;if(e){var f=e.match(/^.*(\n|\r)/);return f?(a.length=0,f[0]):e}return"ruby"===d.tagName?c(a):d.childNodes?(b(a,d),c(a)):void 0}var d,e=[],f="";if(!a||!a.childNodes)return"ltr";for(b(e,a);f=c(e);)for(var g=0;g<f.length;g++)if(d=f.charCodeAt(g),i(d))return"rtl";return"ltr"}function k(a){if("number"==typeof a.line&&(a.snapToLines||a.line>=0&&a.line<=100))return a.line;if(!a.track||!a.track.textTrackList||!a.track.textTrackList.mediaElement)return-1;for(var b=a.track,c=b.textTrackList,d=0,e=0;e<c.length&&c[e]!==b;e++)"showing"===c[e].mode&&d++;return-1*++d}function l(){}function m(a,b,c){var d=/MSIE\s8\.0/.test(navigator.userAgent),e="rgba(255, 255, 255, 1)",f="rgba(0, 0, 0, 0.8)";d&&(e="rgb(255, 255, 255)",f="rgb(0, 0, 0)"),l.call(this),this.cue=b,this.cueDiv=h(a,b.text);var g={color:e,backgroundColor:f,position:"relative",left:0,right:0,top:0,bottom:0,display:"inline"};d||(g.writingMode=""===b.vertical?"horizontal-tb":"lr"===b.vertical?"vertical-lr":"vertical-rl",g.unicodeBidi="plaintext"),this.applyStyles(g,this.cueDiv),this.div=a.document.createElement("div"),g={textAlign:"middle"===b.align?"center":b.align,font:c.font,whiteSpace:"pre-line",position:"absolute"},d||(g.direction=j(this.cueDiv),g.writingMode=""===b.vertical?"horizontal-tb":"lr"===b.vertical?"vertical-lr":"vertical-rl".stylesunicodeBidi="plaintext"),this.applyStyles(g),this.div.appendChild(this.cueDiv);var i=0;switch(b.positionAlign){case"start":i=b.position;break;case"middle":i=b.position-b.size/2;break;case"end":i=b.position-b.size}this.applyStyles(""===b.vertical?{left:this.formatStyle(i,"%"),width:this.formatStyle(b.size,"%")}:{top:this.formatStyle(i,"%"),height:this.formatStyle(b.size,"%")}),this.move=function(a){this.applyStyles({top:this.formatStyle(a.top,"px"),bottom:this.formatStyle(a.bottom,"px"),left:this.formatStyle(a.left,"px"),right:this.formatStyle(a.right,"px"),height:this.formatStyle(a.height,"px"),width:this.formatStyle(a.width,"px")})}}function n(a){var b,c,d,e,f=/MSIE\s8\.0/.test(navigator.userAgent);if(a.div){c=a.div.offsetHeight,d=a.div.offsetWidth,e=a.div.offsetTop;var g=(g=a.div.childNodes)&&(g=g[0])&&g.getClientRects&&g.getClientRects();a=a.div.getBoundingClientRect(),b=g?Math.max(g[0]&&g[0].height||0,a.height/g.length):0}this.left=a.left,this.right=a.right,this.top=a.top||e,this.height=a.height||c,this.bottom=a.bottom||e+(a.height||c),this.width=a.width||d,this.lineHeight=void 0!==b?b:a.lineHeight,f&&!this.lineHeight&&(this.lineHeight=13)}function o(a,b,c,d){function e(a,b){for(var e,f=new n(a),g=1,h=0;h<b.length;h++){for(;a.overlapsOppositeAxis(c,b[h])||a.within(c)&&a.overlapsAny(d);)a.move(b[h]);if(a.within(c))return a;var i=a.intersectPercentage(c);g>i&&(e=new n(a),g=i),a=new n(f)}return e||f}var f=new n(b),g=b.cue,h=k(g),i=[];if(g.snapToLines){var j;switch(g.vertical){case"":i=["+y","-y"],j="height";break;case"rl":i=["+x","-x"],j="width";break;case"lr":i=["-x","+x"],j="width"}var l=f.lineHeight,m=l*Math.round(h),o=c[j]+l,p=i[0];Math.abs(m)>o&&(m=0>m?-1:1,m*=Math.ceil(o/l)*l),0>h&&(m+=""===g.vertical?c.height:c.width,i=i.reverse()),f.move(p,m)}else{var q=f.lineHeight/c.height*100;switch(g.lineAlign){case"middle":h-=q/2;break;case"end":h-=q}switch(g.vertical){case"":b.applyStyles({top:b.formatStyle(h,"%")});break;case"rl":b.applyStyles({left:b.formatStyle(h,"%")});break;case"lr":b.applyStyles({right:b.formatStyle(h,"%")})}i=["+y","-x","+x","-y"],f=new n(b)}var r=e(f,i);b.move(r.toCSSCompatValues(c))}function p(){}var q=Object.create||function(){function a(){}return function(b){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return a.prototype=b,new a}}();c.prototype=q(Error.prototype),c.prototype.constructor=c,c.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},e.prototype={set:function(a,b){this.get(a)||""===b||(this.values[a]=b)},get:function(a,b,c){return c?this.has(a)?this.values[a]:b[c]:this.has(a)?this.values[a]:b},has:function(a){return a in this.values},alt:function(a,b,c){for(var d=0;d<c.length;++d)if(b===c[d]){this.set(a,b);break}},integer:function(a,b){/^-?\d+$/.test(b)&&this.set(a,parseInt(b,10))},percent:function(a,b){var c;return(c=b.match(/^([\d]{1,3})(\.[\d]*)?%$/))&&(b=parseFloat(b),b>=0&&100>=b)?(this.set(a,b),!0):!1}};var r={"&":"&","<":"<",">":">","‎":"","‏":""," ":" "},s={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},t={v:"title",lang:"lang"},u={rt:"ruby"},v=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];l.prototype.applyStyles=function(a,b){b=b||this.div;for(var c in a)a.hasOwnProperty(c)&&(b.style[c]=a[c])},l.prototype.formatStyle=function(a,b){return 0===a?0:a+b},m.prototype=q(l.prototype),m.prototype.constructor=m,n.prototype.move=function(a,b){switch(b=void 0!==b?b:this.lineHeight,a){case"+x":this.left+=b,this.right+=b;break;case"-x":this.left-=b,this.right-=b;break;case"+y":this.top+=b,this.bottom+=b;break;case"-y":this.top-=b,this.bottom-=b}},n.prototype.overlaps=function(a){return this.left<a.right&&this.right>a.left&&this.top<a.bottom&&this.bottom>a.top},n.prototype.overlapsAny=function(a){for(var b=0;b<a.length;b++)if(this.overlaps(a[b]))return!0;return!1},n.prototype.within=function(a){return this.top>=a.top&&this.bottom<=a.bottom&&this.left>=a.left&&this.right<=a.right},n.prototype.overlapsOppositeAxis=function(a,b){switch(b){case"+x":return this.left<a.left;case"-x":return this.right>a.right;case"+y":return this.top<a.top;case"-y":return this.bottom>a.bottom}},n.prototype.intersectPercentage=function(a){var b=Math.max(0,Math.min(this.right,a.right)-Math.max(this.left,a.left)),c=Math.max(0,Math.min(this.bottom,a.bottom)-Math.max(this.top,a.top)),d=b*c;return d/(this.height*this.width)},n.prototype.toCSSCompatValues=function(a){return{top:this.top-a.top,bottom:a.bottom-this.bottom,left:this.left-a.left,right:a.right-this.right,height:this.height,width:this.width}},n.getSimpleBoxPosition=function(a){var b=a.div?a.div.offsetHeight:a.tagName?a.offsetHeight:0,c=a.div?a.div.offsetWidth:a.tagName?a.offsetWidth:0,d=a.div?a.div.offsetTop:a.tagName?a.offsetTop:0;a=a.div?a.div.getBoundingClientRect():a.tagName?a.getBoundingClientRect():a;var e={left:a.left,right:a.right,top:a.top||d,height:a.height||b,bottom:a.bottom||d+(a.height||b),width:a.width||c};return e},p.StringDecoder=function(){return{decode:function(a){if(!a)return"";if("string"!=typeof a)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(a))}}},p.convertCueToDOMTree=function(a,b){return a&&b?h(a,b):null};var w=.05,x="sans-serif",y="1.5%";p.processCues=function(a,b,c){function d(a){for(var b=0;b<a.length;b++)if(a[b].hasBeenReset||!a[b].displayState)return!0;return!1}if(!a||!b||!c)return null;for(;c.firstChild;)c.removeChild(c.firstChild);var e=a.document.createElement("div");if(e.style.position="absolute",e.style.left="0",e.style.right="0",e.style.top="0",e.style.bottom="0",e.style.margin=y,c.appendChild(e),d(b)){var f=[],g=n.getSimpleBoxPosition(e),h=Math.round(g.height*w*100)/100,i={font:h+"px "+x};!function(){for(var c,d,h=0;h<b.length;h++)d=b[h],c=new m(a,d,i),e.appendChild(c.div),o(a,c,g,f),d.displayState=c.div,f.push(n.getSimpleBoxPosition(c))}()}else for(var j=0;j<b.length;j++)e.appendChild(b[j].displayState)},p.Parser=function(a,b,c){c||(c=b,b={}),b||(b={}),this.window=a,this.vttjs=b,this.state="INITIAL",this.buffer="",this.decoder=c||new TextDecoder("utf8"),this.regionList=[]},p.Parser.prototype={reportOrThrowError:function(a){if(!(a instanceof c))throw a;this.onparsingerror&&this.onparsingerror(a)},parse:function(a){function b(){for(var a=k.buffer,b=0;b<a.length&&"\r"!==a[b]&&"\n"!==a[b];)++b;var c=a.substr(0,b);return"\r"===a[b]&&++b,"\n"===a[b]&&++b,k.buffer=a.substr(b),c}function h(a){var b=new e;if(f(a,function(a,c){switch(a){case"id":b.set(a,c);break;case"width":b.percent(a,c);break;case"lines":b.integer(a,c);break;case"regionanchor":case"viewportanchor":var d=c.split(",");if(2!==d.length)break;var f=new e;if(f.percent("x",d[0]),f.percent("y",d[1]),!f.has("x")||!f.has("y"))break;b.set(a+"X",f.get("x")),b.set(a+"Y",f.get("y"));break;case"scroll":b.alt(a,c,["up"])}},/=/,/\s/),b.has("id")){var c=new(k.vttjs.VTTRegion||k.window.VTTRegion);c.width=b.get("width",100),c.lines=b.get("lines",3),c.regionAnchorX=b.get("regionanchorX",0),c.regionAnchorY=b.get("regionanchorY",100),c.viewportAnchorX=b.get("viewportanchorX",0),c.viewportAnchorY=b.get("viewportanchorY",100),c.scroll=b.get("scroll",""),k.onregion&&k.onregion(c),k.regionList.push({id:b.get("id"),region:c})}}function i(a){var b=new e;f(a,function(a,c){switch(a){case"MPEGT":b.integer(a+"S",c);break;case"LOCA":b.set(a+"L",d(c))}},/[^\d]:/,/,/),k.ontimestampmap&&k.ontimestampmap({MPEGTS:b.get("MPEGTS"),LOCAL:b.get("LOCAL")})}function j(a){a.match(/X-TIMESTAMP-MAP/)?f(a,function(a,b){switch(a){case"X-TIMESTAMP-MAP":i(b)}},/=/):f(a,function(a,b){switch(a){case"Region":h(b)}},/:/)}var k=this;a&&(k.buffer+=k.decoder.decode(a,{stream:!0}));try{var l;if("INITIAL"===k.state){if(!/\r\n|\n/.test(k.buffer))return this;l=b();var m=l.match(/^WEBVTT([ \t].*)?$/);if(!m||!m[0])throw new c(c.Errors.BadSignature);k.state="HEADER"}for(var n=!1;k.buffer;){if(!/\r\n|\n/.test(k.buffer))return this;switch(n?n=!1:l=b(),k.state){case"HEADER":/:/.test(l)?j(l):l||(k.state="ID");continue;case"NOTE":l||(k.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(l)){k.state="NOTE";break}if(!l)continue;if(k.cue=new(k.vttjs.VTTCue||k.window.VTTCue)(0,0,""),k.state="CUE",-1===l.indexOf("-->")){k.cue.id=l;continue}case"CUE":try{g(l,k.cue,k.regionList)}catch(o){k.reportOrThrowError(o),k.cue=null,k.state="BADCUE";continue}k.state="CUETEXT";continue;case"CUETEXT":var p=-1!==l.indexOf("-->");if(!l||p&&(n=!0)){k.oncue&&k.oncue(k.cue),k.cue=null,k.state="ID";continue}k.cue.text&&(k.cue.text+="\n"),k.cue.text+=l;continue;case"BADCUE":l||(k.state="ID");continue}}}catch(o){k.reportOrThrowError(o),"CUETEXT"===k.state&&k.cue&&k.oncue&&k.oncue(k.cue),k.cue=null,k.state="INITIAL"===k.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){var a=this;try{if(a.buffer+=a.decoder.decode(),(a.cue||"HEADER"===a.state)&&(a.buffer+="\n\n",a.parse()),"INITIAL"===a.state)throw new c(c.Errors.BadSignature)}catch(b){a.reportOrThrowError(b)}return a.onflush&&a.onflush(),this}},b.exports=p},{}],2:[function(a,b){function c(a){if("string"!=typeof a)return!1;var b=h[a.toLowerCase()];return b?a.toLowerCase():!1}function d(a){if("string"!=typeof a)return!1;var b=i[a.toLowerCase()];return b?a.toLowerCase():!1}function e(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)a[d]=c[d]}return a}function f(a,b,f){var h=this,i=/MSIE\s8\.0/.test(navigator.userAgent),j={};i?h=document.createElement("custom"):j.enumerable=!0,h.hasBeenReset=!1;var k="",l=!1,m=a,n=b,o=f,p=null,q="",r=!0,s="auto",t="start",u=50,v="middle",w=50,x="middle";return Object.defineProperty(h,"id",e({},j,{get:function(){return k},set:function(a){k=""+a}})),Object.defineProperty(h,"pauseOnExit",e({},j,{get:function(){return l},set:function(a){l=!!a}})),Object.defineProperty(h,"startTime",e({},j,{get:function(){return m},set:function(a){if("number"!=typeof a)throw new TypeError("Start time must be set to a number.");m=a,this.hasBeenReset=!0}})),Object.defineProperty(h,"endTime",e({},j,{get:function(){return n},set:function(a){if("number"!=typeof a)throw new TypeError("End time must be set to a number.");n=a,this.hasBeenReset=!0}})),Object.defineProperty(h,"text",e({},j,{get:function(){return o},set:function(a){o=""+a,this.hasBeenReset=!0}})),Object.defineProperty(h,"region",e({},j,{get:function(){return p},set:function(a){p=a,this.hasBeenReset=!0}})),Object.defineProperty(h,"vertical",e({},j,{get:function(){return q},set:function(a){var b=c(a);if(b===!1)throw new SyntaxError("An invalid or illegal string was specified.");q=b,this.hasBeenReset=!0}})),Object.defineProperty(h,"snapToLines",e({},j,{get:function(){return r},set:function(a){r=!!a,this.hasBeenReset=!0}})),Object.defineProperty(h,"line",e({},j,{get:function(){return s},set:function(a){if("number"!=typeof a&&a!==g)throw new SyntaxError("An invalid number or illegal string was specified.");s=a,this.hasBeenReset=!0}})),Object.defineProperty(h,"lineAlign",e({},j,{get:function(){return t},set:function(a){var b=d(a);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");t=b,this.hasBeenReset=!0}})),Object.defineProperty(h,"position",e({},j,{get:function(){return u},set:function(a){if(0>a||a>100)throw new Error("Position must be between 0 and 100.");u=a,this.hasBeenReset=!0}})),Object.defineProperty(h,"positionAlign",e({},j,{get:function(){return v},set:function(a){var b=d(a);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");v=b,this.hasBeenReset=!0}})),Object.defineProperty(h,"size",e({},j,{get:function(){return w},set:function(a){if(0>a||a>100)throw new Error("Size must be between 0 and 100.");w=a,this.hasBeenReset=!0}})),Object.defineProperty(h,"align",e({},j,{get:function(){return x},set:function(a){var b=d(a);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");x=b,this.hasBeenReset=!0}})),h.displayState=void 0,i?h:void 0}var g="auto",h={"":!0,lr:!0,rl:!0},i={start:!0,middle:!0,end:!0,left:!0,right:!0};f.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},b.exports=f},{}],3:[function(a,b){function c(a){if("string"!=typeof a)return!1;var b=f[a.toLowerCase()];return b?a.toLowerCase():!1}function d(a){return"number"==typeof a&&a>=0&&100>=a}function e(){var a=100,b=3,e=0,f=100,g=0,h=100,i="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return a},set:function(b){if(!d(b))throw new Error("Width must be between 0 and 100.");a=b}},lines:{enumerable:!0,get:function(){return b},set:function(a){if("number"!=typeof a)throw new TypeError("Lines must be set to a number.");b=a}},regionAnchorY:{enumerable:!0,get:function(){return f},set:function(a){if(!d(a))throw new Error("RegionAnchorX must be between 0 and 100.");f=a}},regionAnchorX:{enumerable:!0,get:function(){return e},set:function(a){if(!d(a))throw new Error("RegionAnchorY must be between 0 and 100.");e=a}},viewportAnchorY:{enumerable:!0,get:function(){return h},set:function(a){if(!d(a))throw new Error("ViewportAnchorY must be between 0 and 100.");h=a}},viewportAnchorX:{enumerable:!0,get:function(){return g},set:function(a){if(!d(a))throw new Error("ViewportAnchorX must be between 0 and 100.");g=a}},scroll:{enumerable:!0,get:function(){return i},set:function(a){var b=c(a);if(b===!1)throw new SyntaxError("An invalid or illegal string was specified.");i=b}}})}var f={"":!0,up:!0};b.exports=e},{}],4:[function(a,b){(function(a){b.exports="undefined"!=typeof window?window:"undefined"!=typeof a?a:"undefined"!=typeof self?self:{}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],5:[function(a,b){var c=a("global/window"),d=b.exports={WebVTT:a("./vtt.js"),VTTCue:a("./vttcue.js"),VTTRegion:a("./vttregion.js")};c.vttjs=d,c.WebVTT=d.WebVTT;var e=d.VTTCue,f=d.VTTRegion,g=c.VTTCue,h=c.VTTRegion;d.shim=function(){c.VTTCue=e,c.VTTRegion=f},d.restore=function(){c.VTTCue=g,c.VTTRegion=h},c.VTTCue||d.shim()},{"./vtt.js":1,"./vttcue.js":2,"./vttregion.js":3,"global/window":4}]},{},[5])(5)}); | ||
/* videojs-vtt.js - v0.12.6 (https://github.com/gkatsev/vtt.js) built on 09-04-2018 */ | ||
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.vttjs=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b){function c(a,b){this.name="ParsingError",this.code=a.code,this.message=b||a.message}function d(a){function b(a,b,c,d){return 3600*(0|a)+60*(0|b)+(0|c)+(0|d)/1e3}var c=a.match(/^(\d+):(\d{2})(:\d{2})?\.(\d{3})/);return c?c[3]?b(c[1],c[2],c[3].replace(":",""),c[4]):c[1]>59?b(c[1],c[2],0,c[4]):b(0,c[1],c[2],c[4]):null}function e(){this.values=q(null)}function f(a,b,c,d){var e=d?a.split(d):[a];for(var f in e)if("string"==typeof e[f]){var g=e[f].split(c);if(2===g.length){var h=g[0],i=g[1];b(h,i)}}}function g(a,b,g){function h(){var b=d(a);if(null===b)throw new c(c.Errors.BadTimeStamp,"Malformed timestamp: "+k);return a=a.replace(/^[^\sa-zA-Z-]+/,""),b}function i(a,b){var c=new e;f(a,function(a,b){switch(a){case"region":for(var d=g.length-1;d>=0;d--)if(g[d].id===b){c.set(a,g[d].region);break}break;case"vertical":c.alt(a,b,["rl","lr"]);break;case"line":var e=b.split(","),f=e[0];c.integer(a,f),c.percent(a,f)?c.set("snapToLines",!1):null,c.alt(a,f,["auto"]),2===e.length&&c.alt("lineAlign",e[1],["start","middle","end"]);break;case"position":e=b.split(","),c.percent(a,e[0]),2===e.length&&c.alt("positionAlign",e[1],["start","middle","end"]);break;case"size":c.percent(a,b);break;case"align":c.alt(a,b,["start","middle","end","left","right"])}},/:/,/\s/),b.region=c.get("region",null),b.vertical=c.get("vertical",""),b.line=c.get("line","auto"),b.lineAlign=c.get("lineAlign","start"),b.snapToLines=c.get("snapToLines",!0),b.size=c.get("size",100),b.align=c.get("align","middle"),b.position=c.get("position",{start:0,left:0,middle:50,end:100,right:100},b.align),b.positionAlign=c.get("positionAlign",{start:"start",left:"start",middle:"middle",end:"end",right:"end"},b.align)}function j(){a=a.replace(/^\s+/,"")}var k=a;if(j(),b.startTime=h(),j(),"-->"!==a.substr(0,3))throw new c(c.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+k);a=a.substr(3),j(),b.endTime=h(),j(),i(a,b)}function h(a,b){function c(){function a(a){return b=b.substr(a.length),a}if(!b)return null;var c=b.match(/^([^<]*)(<[^>]*>?)?/);return a(c[1]?c[1]:c[2])}function e(a){return r[a]}function f(a){for(;o=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(o[0],e);return a}function g(a,b){return!u[b.localName]||u[b.localName]===a.localName}function h(b,c){var d=s[b];if(!d)return null;var e=a.document.createElement(d);e.localName=d;var f=t[b];return f&&c&&(e[f]=c.trim()),e}for(var i,j=a.document.createElement("div"),k=j,l=[];null!==(i=c());)if("<"!==i[0])k.appendChild(a.document.createTextNode(f(i)));else{if("/"===i[1]){l.length&&l[l.length-1]===i.substr(2).replace(">","")&&(l.pop(),k=k.parentNode);continue}var m,n=d(i.substr(1,i.length-2));if(n){m=a.document.createProcessingInstruction("timestamp",n),k.appendChild(m);continue}var o=i.match(/^<([^.\s\/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!o)continue;if(m=h(o[1],o[3]),!m)continue;if(!g(k,m))continue;o[2]&&(m.className=o[2].substr(1).replace("."," ")),l.push(o[1]),k.appendChild(m),k=m}return j}function i(a){for(var b=0;b<v.length;b++){var c=v[b];if(a>=c[0]&&a<=c[1])return!0}return!1}function j(a){function b(a,b){for(var c=b.childNodes.length-1;c>=0;c--)a.push(b.childNodes[c])}function c(a){if(!a||!a.length)return null;var d=a.pop(),e=d.textContent||d.innerText;if(e){var f=e.match(/^.*(\n|\r)/);return f?(a.length=0,f[0]):e}return"ruby"===d.tagName?c(a):d.childNodes?(b(a,d),c(a)):void 0}var d,e=[],f="";if(!a||!a.childNodes)return"ltr";for(b(e,a);f=c(e);)for(var g=0;g<f.length;g++)if(d=f.charCodeAt(g),i(d))return"rtl";return"ltr"}function k(a){if("number"==typeof a.line&&(a.snapToLines||a.line>=0&&a.line<=100))return a.line;if(!a.track||!a.track.textTrackList||!a.track.textTrackList.mediaElement)return-1;for(var b=a.track,c=b.textTrackList,d=0,e=0;e<c.length&&c[e]!==b;e++)"showing"===c[e].mode&&d++;return-1*++d}function l(){}function m(a,b,c){l.call(this),this.cue=b,this.cueDiv=h(a,b.text);var d={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:""===b.vertical?"horizontal-tb":"lr"===b.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(d,this.cueDiv),this.div=a.document.createElement("div"),d={direction:j(this.cueDiv),writingMode:""===b.vertical?"horizontal-tb":"lr"===b.vertical?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:"middle"===b.align?"center":b.align,font:c.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(d),this.div.appendChild(this.cueDiv);var e=0;switch(b.positionAlign){case"start":e=b.position;break;case"middle":e=b.position-b.size/2;break;case"end":e=b.position-b.size}this.applyStyles(""===b.vertical?{left:this.formatStyle(e,"%"),width:this.formatStyle(b.size,"%")}:{top:this.formatStyle(e,"%"),height:this.formatStyle(b.size,"%")}),this.move=function(a){this.applyStyles({top:this.formatStyle(a.top,"px"),bottom:this.formatStyle(a.bottom,"px"),left:this.formatStyle(a.left,"px"),right:this.formatStyle(a.right,"px"),height:this.formatStyle(a.height,"px"),width:this.formatStyle(a.width,"px")})}}function n(a){var b,c,d,e;if(a.div){c=a.div.offsetHeight,d=a.div.offsetWidth,e=a.div.offsetTop;var f=(f=a.div.childNodes)&&(f=f[0])&&f.getClientRects&&f.getClientRects();a=a.div.getBoundingClientRect(),b=f?Math.max(f[0]&&f[0].height||0,a.height/f.length):0}this.left=a.left,this.right=a.right,this.top=a.top||e,this.height=a.height||c,this.bottom=a.bottom||e+(a.height||c),this.width=a.width||d,this.lineHeight=void 0!==b?b:a.lineHeight}function o(a,b,c,d){function e(a,b){for(var e,f=new n(a),g=1,h=0;h<b.length;h++){for(;a.overlapsOppositeAxis(c,b[h])||a.within(c)&&a.overlapsAny(d);)a.move(b[h]);if(a.within(c))return a;var i=a.intersectPercentage(c);g>i&&(e=new n(a),g=i),a=new n(f)}return e||f}var f=new n(b),g=b.cue,h=k(g),i=[];if(g.snapToLines){var j;switch(g.vertical){case"":i=["+y","-y"],j="height";break;case"rl":i=["+x","-x"],j="width";break;case"lr":i=["-x","+x"],j="width"}var l=f.lineHeight,m=l*Math.round(h),o=c[j]+l,p=i[0];Math.abs(m)>o&&(m=0>m?-1:1,m*=Math.ceil(o/l)*l),0>h&&(m+=""===g.vertical?c.height:c.width,i=i.reverse()),f.move(p,m)}else{var q=f.lineHeight/c.height*100;switch(g.lineAlign){case"middle":h-=q/2;break;case"end":h-=q}switch(g.vertical){case"":b.applyStyles({top:b.formatStyle(h,"%")});break;case"rl":b.applyStyles({left:b.formatStyle(h,"%")});break;case"lr":b.applyStyles({right:b.formatStyle(h,"%")})}i=["+y","-x","+x","-y"],f=new n(b)}var r=e(f,i);b.move(r.toCSSCompatValues(c))}function p(){}var q=Object.create||function(){function a(){}return function(b){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return a.prototype=b,new a}}();c.prototype=q(Error.prototype),c.prototype.constructor=c,c.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},e.prototype={set:function(a,b){this.get(a)||""===b||(this.values[a]=b)},get:function(a,b,c){return c?this.has(a)?this.values[a]:b[c]:this.has(a)?this.values[a]:b},has:function(a){return a in this.values},alt:function(a,b,c){for(var d=0;d<c.length;++d)if(b===c[d]){this.set(a,b);break}},integer:function(a,b){/^-?\d+$/.test(b)&&this.set(a,parseInt(b,10))},percent:function(a,b){var c;return(c=b.match(/^([\d]{1,3})(\.[\d]*)?%$/))&&(b=parseFloat(b),b>=0&&100>=b)?(this.set(a,b),!0):!1}};var r={"&":"&","<":"<",">":">","‎":"","‏":""," ":" "},s={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},t={v:"title",lang:"lang"},u={rt:"ruby"},v=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];l.prototype.applyStyles=function(a,b){b=b||this.div;for(var c in a)a.hasOwnProperty(c)&&(b.style[c]=a[c])},l.prototype.formatStyle=function(a,b){return 0===a?0:a+b},m.prototype=q(l.prototype),m.prototype.constructor=m,n.prototype.move=function(a,b){switch(b=void 0!==b?b:this.lineHeight,a){case"+x":this.left+=b,this.right+=b;break;case"-x":this.left-=b,this.right-=b;break;case"+y":this.top+=b,this.bottom+=b;break;case"-y":this.top-=b,this.bottom-=b}},n.prototype.overlaps=function(a){return this.left<a.right&&this.right>a.left&&this.top<a.bottom&&this.bottom>a.top},n.prototype.overlapsAny=function(a){for(var b=0;b<a.length;b++)if(this.overlaps(a[b]))return!0;return!1},n.prototype.within=function(a){return this.top>=a.top&&this.bottom<=a.bottom&&this.left>=a.left&&this.right<=a.right},n.prototype.overlapsOppositeAxis=function(a,b){switch(b){case"+x":return this.left<a.left;case"-x":return this.right>a.right;case"+y":return this.top<a.top;case"-y":return this.bottom>a.bottom}},n.prototype.intersectPercentage=function(a){var b=Math.max(0,Math.min(this.right,a.right)-Math.max(this.left,a.left)),c=Math.max(0,Math.min(this.bottom,a.bottom)-Math.max(this.top,a.top)),d=b*c;return d/(this.height*this.width)},n.prototype.toCSSCompatValues=function(a){return{top:this.top-a.top,bottom:a.bottom-this.bottom,left:this.left-a.left,right:a.right-this.right,height:this.height,width:this.width}},n.getSimpleBoxPosition=function(a){var b=a.div?a.div.offsetHeight:a.tagName?a.offsetHeight:0,c=a.div?a.div.offsetWidth:a.tagName?a.offsetWidth:0,d=a.div?a.div.offsetTop:a.tagName?a.offsetTop:0;a=a.div?a.div.getBoundingClientRect():a.tagName?a.getBoundingClientRect():a;var e={left:a.left,right:a.right,top:a.top||d,height:a.height||b,bottom:a.bottom||d+(a.height||b),width:a.width||c};return e},p.StringDecoder=function(){return{decode:function(a){if(!a)return"";if("string"!=typeof a)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(a))}}},p.convertCueToDOMTree=function(a,b){return a&&b?h(a,b):null};var w=.05,x="sans-serif",y="1.5%";p.processCues=function(a,b,c){function d(a){for(var b=0;b<a.length;b++)if(a[b].hasBeenReset||!a[b].displayState)return!0;return!1}if(!a||!b||!c)return null;for(;c.firstChild;)c.removeChild(c.firstChild);var e=a.document.createElement("div");if(e.style.position="absolute",e.style.left="0",e.style.right="0",e.style.top="0",e.style.bottom="0",e.style.margin=y,c.appendChild(e),d(b)){var f=[],g=n.getSimpleBoxPosition(e),h=Math.round(g.height*w*100)/100,i={font:h+"px "+x};!function(){for(var c,d,h=0;h<b.length;h++)d=b[h],c=new m(a,d,i),e.appendChild(c.div),o(a,c,g,f),d.displayState=c.div,f.push(n.getSimpleBoxPosition(c))}()}else for(var j=0;j<b.length;j++)e.appendChild(b[j].displayState)},p.Parser=function(a,b,c){c||(c=b,b={}),b||(b={}),this.window=a,this.vttjs=b,this.state="INITIAL",this.buffer="",this.decoder=c||new TextDecoder("utf8"),this.regionList=[]},p.Parser.prototype={reportOrThrowError:function(a){if(!(a instanceof c))throw a;this.onparsingerror&&this.onparsingerror(a)},parse:function(a){function b(){for(var a=k.buffer,b=0;b<a.length&&"\r"!==a[b]&&"\n"!==a[b];)++b;var c=a.substr(0,b);return"\r"===a[b]&&++b,"\n"===a[b]&&++b,k.buffer=a.substr(b),c}function h(a){var b=new e;if(f(a,function(a,c){switch(a){case"id":b.set(a,c);break;case"width":b.percent(a,c);break;case"lines":b.integer(a,c);break;case"regionanchor":case"viewportanchor":var d=c.split(",");if(2!==d.length)break;var f=new e;if(f.percent("x",d[0]),f.percent("y",d[1]),!f.has("x")||!f.has("y"))break;b.set(a+"X",f.get("x")),b.set(a+"Y",f.get("y"));break;case"scroll":b.alt(a,c,["up"])}},/=/,/\s/),b.has("id")){var c=new(k.vttjs.VTTRegion||k.window.VTTRegion);c.width=b.get("width",100),c.lines=b.get("lines",3),c.regionAnchorX=b.get("regionanchorX",0),c.regionAnchorY=b.get("regionanchorY",100),c.viewportAnchorX=b.get("viewportanchorX",0),c.viewportAnchorY=b.get("viewportanchorY",100),c.scroll=b.get("scroll",""),k.onregion&&k.onregion(c),k.regionList.push({id:b.get("id"),region:c})}}function i(a){var b=new e;f(a,function(a,c){switch(a){case"MPEGT":b.integer(a+"S",c);break;case"LOCA":b.set(a+"L",d(c))}},/[^\d]:/,/,/),k.ontimestampmap&&k.ontimestampmap({MPEGTS:b.get("MPEGTS"),LOCAL:b.get("LOCAL")})}function j(a){a.match(/X-TIMESTAMP-MAP/)?f(a,function(a,b){switch(a){case"X-TIMESTAMP-MAP":i(b)}},/=/):f(a,function(a,b){switch(a){case"Region":h(b)}},/:/)}var k=this;a&&(k.buffer+=k.decoder.decode(a,{stream:!0}));try{var l;if("INITIAL"===k.state){if(!/\r\n|\n/.test(k.buffer))return this;l=b();var m=l.match(/^WEBVTT([ \t].*)?$/);if(!m||!m[0])throw new c(c.Errors.BadSignature);k.state="HEADER"}for(var n=!1;k.buffer;){if(!/\r\n|\n/.test(k.buffer))return this;switch(n?n=!1:l=b(),k.state){case"HEADER":/:/.test(l)?j(l):l||(k.state="ID");continue;case"NOTE":l||(k.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(l)){k.state="NOTE";break}if(!l)continue;if(k.cue=new(k.vttjs.VTTCue||k.window.VTTCue)(0,0,""),k.state="CUE",-1===l.indexOf("-->")){k.cue.id=l;continue}case"CUE":try{g(l,k.cue,k.regionList)}catch(o){k.reportOrThrowError(o),k.cue=null,k.state="BADCUE";continue}k.state="CUETEXT";continue;case"CUETEXT":var p=-1!==l.indexOf("-->");if(!l||p&&(n=!0)){k.oncue&&k.oncue(k.cue),k.cue=null,k.state="ID";continue}k.cue.text&&(k.cue.text+="\n"),k.cue.text+=l;continue;case"BADCUE":l||(k.state="ID");continue}}}catch(o){k.reportOrThrowError(o),"CUETEXT"===k.state&&k.cue&&k.oncue&&k.oncue(k.cue),k.cue=null,k.state="INITIAL"===k.state?"BADWEBVTT":"BADCUE"}return this},flush:function(){var a=this;try{if(a.buffer+=a.decoder.decode(),(a.cue||"HEADER"===a.state)&&(a.buffer+="\n\n",a.parse()),"INITIAL"===a.state)throw new c(c.Errors.BadSignature)}catch(b){a.reportOrThrowError(b)}return a.onflush&&a.onflush(),this}},b.exports=p},{}],2:[function(a,b){function c(a){if("string"!=typeof a)return!1;var b=g[a.toLowerCase()];return b?a.toLowerCase():!1}function d(a){if("string"!=typeof a)return!1;var b=h[a.toLowerCase()];return b?a.toLowerCase():!1}function e(a,b,e){this.hasBeenReset=!1;var g="",h=!1,i=a,j=b,k=e,l=null,m="",n=!0,o="auto",p="start",q=50,r="middle",s=50,t="middle";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return g},set:function(a){g=""+a}},pauseOnExit:{enumerable:!0,get:function(){return h},set:function(a){h=!!a}},startTime:{enumerable:!0,get:function(){return i},set:function(a){if("number"!=typeof a)throw new TypeError("Start time must be set to a number.");i=a,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return j},set:function(a){if("number"!=typeof a)throw new TypeError("End time must be set to a number.");j=a,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return k},set:function(a){k=""+a,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return l},set:function(a){l=a,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return m},set:function(a){var b=c(a);if(b===!1)throw new SyntaxError("An invalid or illegal string was specified.");m=b,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return n},set:function(a){n=!!a,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return o},set:function(a){if("number"!=typeof a&&a!==f)throw new SyntaxError("An invalid number or illegal string was specified.");o=a,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return p},set:function(a){var b=d(a);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");p=b,this.hasBeenReset=!0}},position:{enumerable:!0,get:function(){return q},set:function(a){if(0>a||a>100)throw new Error("Position must be between 0 and 100.");q=a,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return r},set:function(a){var b=d(a);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");r=b,this.hasBeenReset=!0}},size:{enumerable:!0,get:function(){return s},set:function(a){if(0>a||a>100)throw new Error("Size must be between 0 and 100.");s=a,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return t},set:function(a){var b=d(a);if(!b)throw new SyntaxError("An invalid or illegal string was specified.");t=b,this.hasBeenReset=!0}}}),this.displayState=void 0}var f="auto",g={"":1,lr:1,rl:1},h={start:1,middle:1,end:1,left:1,right:1};e.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},b.exports=e},{}],3:[function(a,b){function c(a){if("string"!=typeof a)return!1;var b=f[a.toLowerCase()];return b?a.toLowerCase():!1}function d(a){return"number"==typeof a&&a>=0&&100>=a}function e(){var a=100,b=3,e=0,f=100,g=0,h=100,i="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return a},set:function(b){if(!d(b))throw new Error("Width must be between 0 and 100.");a=b}},lines:{enumerable:!0,get:function(){return b},set:function(a){if("number"!=typeof a)throw new TypeError("Lines must be set to a number.");b=a}},regionAnchorY:{enumerable:!0,get:function(){return f},set:function(a){if(!d(a))throw new Error("RegionAnchorX must be between 0 and 100.");f=a}},regionAnchorX:{enumerable:!0,get:function(){return e},set:function(a){if(!d(a))throw new Error("RegionAnchorY must be between 0 and 100.");e=a}},viewportAnchorY:{enumerable:!0,get:function(){return h},set:function(a){if(!d(a))throw new Error("ViewportAnchorY must be between 0 and 100.");h=a}},viewportAnchorX:{enumerable:!0,get:function(){return g},set:function(a){if(!d(a))throw new Error("ViewportAnchorX must be between 0 and 100.");g=a}},scroll:{enumerable:!0,get:function(){return i},set:function(a){var b=c(a);if(b===!1)throw new SyntaxError("An invalid or illegal string was specified.");i=b}}})}var f={"":!0,up:!0};b.exports=e},{}],4:[function(a,b){(function(a){b.exports="undefined"!=typeof window?window:"undefined"!=typeof a?a:"undefined"!=typeof self?self:{}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],5:[function(a,b){var c=a("global/window"),d=b.exports={WebVTT:a("./vtt.js"),VTTCue:a("./vttcue.js"),VTTRegion:a("./vttregion.js")};c.vttjs=d,c.WebVTT=d.WebVTT;var e=d.VTTCue,f=d.VTTRegion,g=c.VTTCue,h=c.VTTRegion;d.shim=function(){c.VTTCue=e,c.VTTRegion=f},d.restore=function(){c.VTTCue=g,c.VTTRegion=h},c.VTTCue||d.shim()},{"./vtt.js":1,"./vttcue.js":2,"./vttregion.js":3,"global/window":4}]},{},[5])(5)}); |
@@ -534,11 +534,2 @@ /** | ||
function CueStyleBox(window, cue, styleOptions) { | ||
var isIE8 = (/MSIE\s8\.0/).test(navigator.userAgent); | ||
var color = "rgba(255, 255, 255, 1)"; | ||
var backgroundColor = "rgba(0, 0, 0, 0.8)"; | ||
if (isIE8) { | ||
color = "rgb(255, 255, 255)"; | ||
backgroundColor = "rgb(0, 0, 0)"; | ||
} | ||
StyleBox.call(this); | ||
@@ -551,4 +542,4 @@ this.cue = cue; | ||
var styles = { | ||
color: color, | ||
backgroundColor: backgroundColor, | ||
color: "rgba(255, 255, 255, 1)", | ||
backgroundColor: "rgba(0, 0, 0, 0.8)", | ||
position: "relative", | ||
@@ -559,11 +550,9 @@ left: 0, | ||
bottom: 0, | ||
display: "inline" | ||
display: "inline", | ||
writingMode: cue.vertical === "" ? "horizontal-tb" | ||
: cue.vertical === "lr" ? "vertical-lr" | ||
: "vertical-rl", | ||
unicodeBidi: "plaintext" | ||
}; | ||
if (!isIE8) { | ||
styles.writingMode = cue.vertical === "" ? "horizontal-tb" | ||
: cue.vertical === "lr" ? "vertical-lr" | ||
: "vertical-rl"; | ||
styles.unicodeBidi = "plaintext"; | ||
} | ||
this.applyStyles(styles, this.cueDiv); | ||
@@ -576,2 +565,7 @@ | ||
styles = { | ||
direction: determineBidi(this.cueDiv), | ||
writingMode: cue.vertical === "" ? "horizontal-tb" | ||
: cue.vertical === "lr" ? "vertical-lr" | ||
: "vertical-rl", | ||
unicodeBidi: "plaintext", | ||
textAlign: cue.align === "middle" ? "center" : cue.align, | ||
@@ -583,12 +577,3 @@ font: styleOptions.font, | ||
if (!isIE8) { | ||
styles.direction = determineBidi(this.cueDiv); | ||
styles.writingMode = cue.vertical === "" ? "horizontal-tb" | ||
: cue.vertical === "lr" ? "vertical-lr" | ||
: "vertical-rl". | ||
stylesunicodeBidi = "plaintext"; | ||
} | ||
this.applyStyles(styles); | ||
this.div.appendChild(this.cueDiv); | ||
@@ -648,4 +633,2 @@ | ||
function BoxPosition(obj) { | ||
var isIE8 = (/MSIE\s8\.0/).test(navigator.userAgent); | ||
// Either a BoxPosition was passed in and we need to copy it, or a StyleBox | ||
@@ -679,6 +662,2 @@ // was passed in and we need to copy the results of 'getBoundingClientRect' | ||
this.lineHeight = lh !== undefined ? lh : obj.lineHeight; | ||
if (isIE8 && !this.lineHeight) { | ||
this.lineHeight = 13; | ||
} | ||
} | ||
@@ -685,0 +664,0 @@ |
@@ -19,12 +19,12 @@ /** | ||
var directionSetting = { | ||
"": true, | ||
"lr": true, | ||
"rl": true | ||
"": 1, | ||
"lr": 1, | ||
"rl": 1 | ||
}; | ||
var alignSetting = { | ||
"start": true, | ||
"middle": true, | ||
"end": true, | ||
"left": true, | ||
"right": true | ||
"start": 1, | ||
"middle": 1, | ||
"end": 1, | ||
"left": 1, | ||
"right": 1 | ||
}; | ||
@@ -48,25 +48,3 @@ | ||
function extend(obj) { | ||
var i = 1; | ||
for (; i < arguments.length; i++) { | ||
var cobj = arguments[i]; | ||
for (var p in cobj) { | ||
obj[p] = cobj[p]; | ||
} | ||
} | ||
return obj; | ||
} | ||
function VTTCue(startTime, endTime, text) { | ||
var cue = this; | ||
var isIE8 = (/MSIE\s8\.0/).test(navigator.userAgent); | ||
var baseObj = {}; | ||
if (isIE8) { | ||
cue = document.createElement('custom'); | ||
} else { | ||
baseObj.enumerable = true; | ||
} | ||
/** | ||
@@ -80,3 +58,3 @@ * Shim implementation specific properties. These properties are not in | ||
// lazily. | ||
cue.hasBeenReset = false; | ||
this.hasBeenReset = false; | ||
@@ -103,4 +81,5 @@ /** | ||
Object.defineProperty(cue, | ||
"id", extend({}, baseObj, { | ||
Object.defineProperties(this, { | ||
"id": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -112,6 +91,6 @@ return _id; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"pauseOnExit", extend({}, baseObj, { | ||
"pauseOnExit": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -123,6 +102,6 @@ return _pauseOnExit; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"startTime", extend({}, baseObj, { | ||
"startTime": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -138,6 +117,6 @@ return _startTime; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"endTime", extend({}, baseObj, { | ||
"endTime": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -153,6 +132,6 @@ return _endTime; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"text", extend({}, baseObj, { | ||
"text": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -165,6 +144,6 @@ return _text; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"region", extend({}, baseObj, { | ||
"region": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -177,6 +156,6 @@ return _region; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"vertical", extend({}, baseObj, { | ||
"vertical": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -194,6 +173,6 @@ return _vertical; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"snapToLines", extend({}, baseObj, { | ||
"snapToLines": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -206,6 +185,6 @@ return _snapToLines; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"line", extend({}, baseObj, { | ||
"line": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -221,6 +200,6 @@ return _line; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"lineAlign", extend({}, baseObj, { | ||
"lineAlign": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -237,6 +216,6 @@ return _lineAlign; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"position", extend({}, baseObj, { | ||
"position": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -252,6 +231,6 @@ return _position; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"positionAlign", extend({}, baseObj, { | ||
"positionAlign": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -268,6 +247,6 @@ return _positionAlign; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"size", extend({}, baseObj, { | ||
"size": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -283,6 +262,6 @@ return _size; | ||
} | ||
})); | ||
}, | ||
Object.defineProperty(cue, | ||
"align", extend({}, baseObj, { | ||
"align": { | ||
enumerable: true, | ||
get: function() { | ||
@@ -299,3 +278,4 @@ return _align; | ||
} | ||
})); | ||
} | ||
}); | ||
@@ -307,7 +287,3 @@ /** | ||
// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#text-track-cue-display-state | ||
cue.displayState = undefined; | ||
if (isIE8) { | ||
return cue; | ||
} | ||
this.displayState = undefined; | ||
} | ||
@@ -314,0 +290,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"description": "A JavaScript implementation of the WebVTT specification.", | ||
"version": "0.12.6", | ||
"version": "0.14.0", | ||
"main": "lib/browser-index.js", | ||
@@ -8,0 +8,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
289811
20
5020