/* videojs-vtt.js - v0.15.4 (https://github.com/videojs/vtt.js) built on 17-08-2022 */ !function(a){var b;"undefined"!=typeof window?b=window:"undefined"!=typeof self&&(b=self),b.vttjs=a()}(function(){return function(){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){return e(b[g][1][a]||a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g59?b(c[1],c[2],0,c[4]):b(0,c[1],c[2],c[4]):null}function f(){this.values=s(null)}function g(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].trim(),i=g[1].trim();b(h,i)}}}function h(a,b,c){function h(){var b=e(a);if(null===b)throw new d(d.Errors.BadTimeStamp,"Malformed timestamp: "+k);return a=a.replace(/^[^\sa-zA-Z-]+/,""),b}function i(a,b){var d=new f;g(a,function(a,b){switch(a){case"region":for(var e=c.length-1;e>=0;e--)if(c[e].id===b){d.set(a,c[e].region);break}break;case"vertical":d.alt(a,b,["rl","lr"]);break;case"line":var f=b.split(","),g=f[0];d.integer(a,g),d.percent(a,g)&&d.set("snapToLines",!1),d.alt(a,g,["auto"]),2===f.length&&d.alt("lineAlign",f[1],["start","center","end"]);break;case"position":f=b.split(","),d.percent(a,f[0]),2===f.length&&d.alt("positionAlign",f[1],["start","center","end"]);break;case"size":d.percent(a,b);break;case"align":d.alt(a,b,["start","center","end","left","right"])}},/:/,/\s/),b.region=d.get("region",null),b.vertical=d.get("vertical","");try{b.line=d.get("line","auto")}catch(a){}b.lineAlign=d.get("lineAlign","start"),b.snapToLines=d.get("snapToLines",!0),b.size=d.get("size",100);try{b.align=d.get("align","center")}catch(a){b.align=d.get("align","middle")}try{b.position=d.get("position","auto")}catch(a){b.position=d.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},b.align)}b.positionAlign=d.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},b.align)}function j(){a=a.replace(/^\s+/,"")}var k=a;if(j(),b.startTime=h(),j(),"--\x3e"!==a.substr(0,3))throw new d(d.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+k);a=a.substr(3),j(),b.endTime=h(),j(),i(a,b)}function i(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 d(a){return t.innerHTML=a,a=t.textContent,t.textContent="",a}function f(a,b){return!x[b.localName]||x[b.localName]===a.localName}function g(b,c){var d=u[b];if(!d)return null;var e=a.document.createElement(d),f=w[b];return f&&c&&(e[f]=c.trim()),e}for(var h,i=a.document.createElement("div"),j=i,k=[];null!==(h=c());)if("<"!==h[0])j.appendChild(a.document.createTextNode(d(h)));else{if("/"===h[1]){k.length&&k[k.length-1]===h.substr(2).replace(">","")&&(k.pop(),j=j.parentNode);continue}var l,m=e(h.substr(1,h.length-2));if(m){l=a.document.createProcessingInstruction("timestamp",m),j.appendChild(l);continue}var n=h.match(/^<([^.\s\/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!n)continue;if(!(l=g(n[1],n[3])))continue;if(!f(j,l))continue;if(n[2]){var o=n[2].split(".");o.forEach(function(a){var b=/^bg_/.test(a),c=b?a.slice(3):a;if(v.hasOwnProperty(c)){var d=b?"background-color":"color",e=v[c];l.style[d]=e}}),l.className=o.join(" ")}k.push(n[1]),j.appendChild(l),j=l}return i}function j(a){for(var b=0;b=c[0]&&a<=c[1])return!0}return!1}function k(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=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;ei&&(e=new o(a),g=i),a=new o(f)}return e||f}var f=new o(b),g=b.cue,h=l(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 k=f.lineHeight,m=k*Math.round(h),n=c[j]+k,p=i[0];Math.abs(m)>n&&(m=m<0?-1:1,m*=Math.ceil(n/k)*k),h<0&&(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"center":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 o(b)}var r=e(f,i);b.move(r.toCSSCompatValues(c))}function q(){}var r=a("global/document"),s=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}}();d.prototype=s(Error.prototype),d.prototype.constructor=d,d.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},f.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=0&&b<=100)&&(this.set(a,b),!0)}};var t=r.createElement&&r.createElement("textarea"),u={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},v={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},w={v:"title",lang:"lang"},x={rt:"ruby"},y=[[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]];m.prototype.applyStyles=function(a,b){b=b||this.div;for(var c in a)a.hasOwnProperty(c)&&(b.style[c]=a[c])},m.prototype.formatStyle=function(a,b){return 0===a?0:a+b},n.prototype=s(m.prototype),n.prototype.constructor=n,o.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}},o.prototype.overlaps=function(a){return this.lefta.left&&this.topa.top},o.prototype.overlapsAny=function(a){for(var b=0;b=a.top&&this.bottom<=a.bottom&&this.left>=a.left&&this.right<=a.right},o.prototype.overlapsOppositeAxis=function(a,b){switch(b){case"+x":return this.lefta.right;case"+y":return this.topa.bottom}},o.prototype.intersectPercentage=function(a){return Math.max(0,Math.min(this.right,a.right)-Math.max(this.left,a.left))*Math.max(0,Math.min(this.bottom,a.bottom)-Math.max(this.top,a.top))/(this.height*this.width)},o.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}},o.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;return a=a.div?a.div.getBoundingClientRect():a.tagName?a.getBoundingClientRect():a,{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}},q.StringDecoder=function(){return{decode:function(a){if(!a)return"";if("string"!=typeof a)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(a))}}},q.convertCueToDOMTree=function(a,b){return a&&b?i(a,b):null},q.processCues=function(a,b,c){function d(a){for(var b=0;b100)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=e(a);b?(r=b,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return s},set:function(a){if(a<0||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=e(a);if(!b)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");t=b,this.hasBeenReset=!0}}}),this.displayState=void 0}var g="auto",h={"":1,lr:1,rl:1},i={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};f.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},b.exports=f},{}],3:[function(a,b,c){function d(a){return"string"==typeof a&&(!!g[a.toLowerCase()]&&a.toLowerCase())}function e(a){return"number"==typeof a&&a>=0&&a<=100}function f(){var a=100,b=3,c=0,f=100,g=0,h=100,i="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return a},set:function(b){if(!e(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(!e(a))throw new Error("RegionAnchorX must be between 0 and 100.");f=a}},regionAnchorX:{enumerable:!0,get:function(){return c},set:function(a){if(!e(a))throw new Error("RegionAnchorY must be between 0 and 100.");c=a}},viewportAnchorY:{enumerable:!0,get:function(){return h},set:function(a){if(!e(a))throw new Error("ViewportAnchorY must be between 0 and 100.");h=a}},viewportAnchorX:{enumerable:!0,get:function(){return g},set:function(a){if(!e(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=d(a);!1===b?console.warn("Scroll: an invalid or illegal string was specified."):i=b}}})}var g={"":!0,up:!0};b.exports=f},{}],4:[function(a,b,c){},{}],5:[function(a,b,c){(function(c){var d,e=void 0!==c?c:"undefined"!=typeof window?window:{},f=a("min-document");"undefined"!=typeof document?d=document:(d=e["__GLOBAL_DOCUMENT_CACHE@4"])||(d=e["__GLOBAL_DOCUMENT_CACHE@4"]=f),b.exports=d}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"min-document":4}],6:[function(a,b,c){(function(a){var c;c="undefined"!=typeof window?window:void 0!==a?a:"undefined"!=typeof self?self:{},b.exports=c}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],7:[function(a,b,c){var d=a("global/window"),e=b.exports={WebVTT:a("./vtt.js"),VTTCue:a("./vttcue.js"),VTTRegion:a("./vttregion.js")};d.vttjs=e,d.WebVTT=e.WebVTT;var f=e.VTTCue,g=e.VTTRegion,h=d.VTTCue,i=d.VTTRegion;e.shim=function(){d.VTTCue=f,d.VTTRegion=g},e.restore=function(){d.VTTCue=h,d.VTTRegion=i},d.VTTCue||e.shim()},{"./vtt.js":1,"./vttcue.js":2,"./vttregion.js":3,"global/window":6}]},{},[7])(7)});