@castlabs/prestoplay 6.23.1 → 6.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -7
  5. package/cjs/cl.cast.js +116 -116
  6. package/cjs/cl.conviva.js +32 -32
  7. package/cjs/cl.core.js +607 -591
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +88 -86
  10. package/cjs/cl.externs.js +105 -54
  11. package/cjs/cl.freewheel.js +25 -24
  12. package/cjs/cl.hls.js +77 -71
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -30
  15. package/cjs/cl.ima.js +24 -23
  16. package/cjs/cl.mse.js +352 -342
  17. package/cjs/cl.muxdata.js +15 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +15 -14
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.sessions.js +16 -16
  22. package/cjs/cl.simid.js +15 -15
  23. package/cjs/cl.smooth.js +72 -72
  24. package/cjs/cl.thumbnails.js +26 -26
  25. package/cjs/cl.tizen.js +72 -72
  26. package/cjs/cl.ttml.js +29 -29
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +12 -12
  29. package/cjs/cl.vr.js +19 -19
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.yospace.js +4 -4
  32. package/cjs/cl.youbora.js +37 -37
  33. package/cl.adobe.js +3 -3
  34. package/cl.airplay.js +3 -3
  35. package/cl.broadpeak.js +5 -5
  36. package/cl.cast.js +88 -88
  37. package/cl.conviva.js +27 -27
  38. package/cl.core.js +491 -478
  39. package/cl.crypto.js +9 -9
  40. package/cl.dash.js +82 -80
  41. package/cl.externs.js +105 -54
  42. package/cl.freewheel.js +19 -19
  43. package/cl.hls.js +79 -74
  44. package/cl.hlssmpte.js +5 -5
  45. package/cl.htmlcue.js +26 -26
  46. package/cl.ima.js +18 -17
  47. package/cl.mse.js +310 -306
  48. package/cl.muxdata.js +13 -13
  49. package/cl.onboard.js +4 -4
  50. package/cl.persistent.js +10 -10
  51. package/cl.playlist.js +5 -5
  52. package/cl.sessions.js +10 -10
  53. package/cl.simid.js +13 -13
  54. package/cl.smooth.js +60 -59
  55. package/cl.thumbnails.js +19 -19
  56. package/cl.tizen.js +57 -57
  57. package/cl.ttml.js +22 -22
  58. package/cl.verimatrix.js +4 -4
  59. package/cl.vimond.js +8 -8
  60. package/cl.vr.js +14 -14
  61. package/cl.vtt.js +12 -12
  62. package/cl.yospace.js +3 -3
  63. package/cl.youbora.js +28 -28
  64. package/package.json +1 -1
  65. package/typings.d.ts +54 -25
@@ -1,10 +1,10 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var iV=function(a){this.startTime=a.startTime;this.endTime=a.endTime;this.a=this.f=null;a=a.value;if(!_.N.R(a)){a:{var b=a.info;if(_.N.fa(b)&&(b=b.toLowerCase().match(/lang:(\w+)/))&&b[1]){b=b[1].toLowerCase();break a}b=null}this.f=b;a=a.data;this.a=_.N.fa(a)?a:null}},kV=function(a,b,c){this.m=a;this.l=b;this.j=c;this.a=new _.Yh;this.h=(a=_.rv(_.Wc))?new a(this.m.getConfiguration()):null;this.g=new _.K("clpp.hlssmpte.ImageCueHandler");this.f=null;jV(this)},jV=function(a){a.a.one(a.m,_.Ke,function(){return lV(a)})},
3
- lV=function(a){var b=a.m.getSurface().getMedia();if(b)if(a.h){a.a.on(b.textTracks,_.Lc,function(d){return mV(a,d)});var c=Array.from(b.textTracks);c.filter(function(d){return d.kind===_.Se}).forEach(function(d){mV(a,{track:d})});!nV(c)&&a.l&&(a.g.warn("The metadata track is not present. Changing an audio track in order to enforce the creation of the metadata track."),oV(a,b))}else a.g.warn("The clpp.ttml.TextParser class is not available. Please register the ttml component first.");else a.g.warn("A video element is not available. Skipping.")},
4
- nV=function(a){return a.some(function(b){return b.kind===_.Se})},oV=function(a,b){var c=a.m.getTrackManager(),d=c.qa(),e=c.getAudioTracks().find(function(g){return g!==d});if(e){var f=function(){return c.Ha(d)};a.a.on(b.textTracks,_.Lc,function(g){g.track.kind===_.Se&&(a.a.off(b.textTracks,_.Lc,f),f())});c.Ha(e)}else a.g.warn("Can't enforce the creation of the metadata track if single audio track. Skipping.")},mV=function(a,b){var c=b.track;c.kind===_.Se&&(a.g.info("The metadata track has been added."),
5
- c.mode=_.ye,a.a.on(c,_.Vd,function(d){return pV(a,d)}))},pV=function(a,b){var c=qV(a);c&&Array.from(b.target.activeCues||[]).forEach(function(d){if(d!==a.f&&Number.isFinite(d.startTime)&&Number.isFinite(d.endTime)&&"org.id3"===d.type&&d.value&&"TXXX"===d.value.key){var e=new iV(d);if(e.f===c&&null!==e.a){a.f=d;d=a.h.parseMedia(_.T.cb(e.a),{periodStart:a.j,segmentStart:e.startTime,segmentEnd:e.endTime});var f=a.m.getTextDisplayer();f.remove(0,e.startTime);f.append(d.cues,d.styles)}}})},qV=function(a){return(a=
6
- a.m.getTrackManager().Ba())&&a.language&&a.language.toLowerCase()},rV=function(){this.a=null;this.f=!1},sV=function(){};kV.prototype.destroy=function(){this.a.release();this.f=null;return Promise.resolve()};_.x(rV,_.Lv);rV.prototype.onPlayerCreated=function(){};rV.prototype.onContentWillLoad=function(a){if(this.f=_.Gl()){var b=a.getConfiguration();b=_.N.gb(b.hlssmpte||{});_.N.wi(b.patchMetadataTrack)||(b.patchMetadataTrack=!1);_.N.xa(b.timestampOffset)||(b.timestampOffset=0);this.a=new kV(a,b.patchMetadataTrack,b.timestampOffset)}};rV.prototype.onPlayerWillDestroy=function(){var a=this;return _.I(function(b){if(1==b.a)return a.a?_.y(b,a.a.destroy(),3):b.F(0);a.a=null;_.B(b)})};rV.prototype.id=function(){return"hlssmpte"};
7
- _.J("clpp.hlssmpte.HlsSmptePlugin",rV);rV.Id="hlssmpte";sV.prototype.create=function(){return new rV};_.Ht(new sV);};
2
+ var f=function(window){var gW=function(a){this.startTime=a.startTime;this.endTime=a.endTime;this.a=this.f=null;a=a.value;if(!_.N.R(a)){a:{var b=a.info;if(_.N.ha(b)&&(b=b.toLowerCase().match(/lang:(\w+)/))&&b[1]){b=b[1].toLowerCase();break a}b=null}this.f=b;a=a.data;this.a=_.N.ha(a)?a:null}},iW=function(a,b,c){this.m=a;this.l=b;this.j=c;this.a=new _.wi;this.h=(a=_.Gv(_.ad))?new a(this.m.getConfiguration()):null;this.g=new _.K("clpp.hlssmpte.ImageCueHandler");this.f=null;hW(this)},hW=function(a){a.a.one(a.m,_.Te,function(){return jW(a)})},
3
+ jW=function(a){var b=a.m.getSurface().getMedia();if(b)if(a.h){a.a.on(b.textTracks,_.Qc,function(d){return kW(a,d)});var c=Array.from(b.textTracks);c.filter(function(d){return d.kind===_.$e}).forEach(function(d){kW(a,{track:d})});!lW(c)&&a.l&&(a.g.warn("The metadata track is not present. Changing an audio track in order to enforce the creation of the metadata track."),mW(a,b))}else a.g.warn("The clpp.ttml.TextParser class is not available. Please register the ttml component first.");else a.g.warn("A video element is not available. Skipping.")},
4
+ lW=function(a){return a.some(function(b){return b.kind===_.$e})},mW=function(a,b){var c=a.m.getTrackManager(),d=c.ra(),e=c.getAudioTracks().find(function(g){return g!==d});if(e){var f=function(){return c.Ka(d)};a.a.on(b.textTracks,_.Qc,function(g){g.track.kind===_.$e&&(a.a.off(b.textTracks,_.Qc,f),f())});c.Ka(e)}else a.g.warn("Can't enforce the creation of the metadata track if single audio track. Skipping.")},kW=function(a,b){var c=b.track;c.kind===_.$e&&(a.g.info("The metadata track has been added."),
5
+ c.mode=_.Ge,a.a.on(c,_.be,function(d){return nW(a,d)}))},nW=function(a,b){var c=oW(a);c&&Array.from(b.target.activeCues||[]).forEach(function(d){if(d!==a.f&&Number.isFinite(d.startTime)&&Number.isFinite(d.endTime)&&"org.id3"===d.type&&d.value&&"TXXX"===d.value.key){var e=new gW(d);if(e.f===c&&null!==e.a){a.f=d;d=a.h.parseMedia(_.T.ib(e.a),{periodStart:a.j,segmentStart:e.startTime,segmentEnd:e.endTime});var f=a.m.getTextDisplayer();f.remove(0,e.startTime);f.append(d.cues,d.styles)}}})},oW=function(a){return(a=
6
+ a.m.getTrackManager().Ba())&&a.language&&a.language.toLowerCase()},pW=function(){this.a=null;this.f=!1},qW=function(){};iW.prototype.destroy=function(){this.a.release();this.f=null;return Promise.resolve()};_.x(pW,_.gw);pW.prototype.onPlayerCreated=function(){};pW.prototype.onContentWillLoad=function(a){if(this.f=_.Ll()){var b=a.getConfiguration();b=_.N.nb(b.hlssmpte||{});_.N.Ai(b.patchMetadataTrack)||(b.patchMetadataTrack=!1);_.N.xa(b.timestampOffset)||(b.timestampOffset=0);this.a=new iW(a,b.patchMetadataTrack,b.timestampOffset)}};pW.prototype.onPlayerWillDestroy=function(){var a=this;return _.I(function(b){if(1==b.a)return a.a?_.y(b,a.a.destroy(),3):b.F(0);a.a=null;_.C(b)})};pW.prototype.id=function(){return"hlssmpte"};
7
+ _.J("clpp.hlssmpte.HlsSmptePlugin",pW);pW.Id="hlssmpte";qW.prototype.create=function(){return new pW};_.cu(new qW);};
8
8
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
9
9
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
10
10
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.htmlcue.js CHANGED
@@ -1,34 +1,34 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var $T="CLPP Subtitle Styles",aU="Unsupported unit",bU="clpp-text-plain",cU="clpp-text-ttml",dU="clpp.htmlcue.HtmlTextDisplayer",eU="initial",fU=function(a){return _.Fi(a,{Mh:function(b,c){return b.pa(c)}})},gU=function(a,b){if(0===b.length)return a;var c=a,d=a.findIndex(function(e){return e.startTime>=b[0].startTime});0<=d&&(c=c.slice(0,d));return c.concat(b)},hU=function(a,b){for(var c=0,d=a.length-1;c<=d;){var e=c+d>>1,f=b(a[e]);if(0===f)return e;0<f?c=e+1:d=e-1}return-1},iU=function(){},jU=function(a){if(!a.input)return null;
3
- var b=a.input.match(/^([^<]*)(<[^>]+>?)?/);b=b[1]?b[1]:b[2];a.input=a.input.substr(b.length);return b},lU=function(a){for(var b=null;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],function(c){return kU[c]});return a},nU=function(a,b){mU(a,b);Array.from(b.getElementsByTagName("*")).forEach(function(c){mU(a,c)})},mU=function(a,b){for(var c in a)null!=a[c]&&(b.style[c]=a[c])},oU=function(a,b){return 0===a?"0":a+b},pU=function(a,b){return 1>Math.abs(a-b)||a<b},qU=function(a,b){return a<b&&
4
- 1<Math.abs(a-b)},rU=function(a,b){return a>b&&1<Math.abs(a-b)},sU=function(a,b){return 1>Math.abs(a-b)||a>b},tU=function(a,b,c,d,e,f){this.left=a;this.f=b;this.top=c;this.a=d;this.height=e;this.width=f},uU=function(a){return new tU(a.left,a.f,a.top,a.a,a.height,a.width)},vU=function(a){var b=a.getBoundingClientRect(),c=getComputedStyle(a,null),d=parseFloat(c.getPropertyValue("border-left-width"))||0,e=parseFloat(c.getPropertyValue("border-right-width"))||0,f=parseFloat(c.getPropertyValue("border-top-width"))||
5
- 0;c=parseFloat(c.getPropertyValue("border-bottom-width"))||0;var g=(b.top||a.offsetTop)+f;f=(b.height||a.offsetHeight)-f-c;return new tU(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-d-e)},wU=function(a,b){return b.some(function(c){return qU(a.left,c.f)&&rU(a.f,c.left)&&qU(a.top,c.a)&&rU(a.a,c.top)})},xU=function(a,b){return sU(a.top,b.top)&&pU(a.a,b.a)&&sU(a.left,b.left)&&pU(a.f,b.f)},yU=function(a,b,c){switch(c){case "+x":return qU(a.left,b.left);case "-x":return rU(a.f,b.f);
6
- case "+y":return qU(a.top,b.top);case "-y":return rU(a.a,b.a);default:throw Error("Unknown axis");}},zU=function(a,b,c){this.id=a;this.w=b;this.B=c;this.a=this.o();this.j=!1},AU=function(a,b,c){zU.call(this,a.id,"clpp-text-cue",{});this.l=b;this.f=a;this.h=!!this.f.backgroundImage;this.C=c},CU=function(a){var b=a.a.childNodes[0],c=a.a.getBoundingClientRect(),d=b.getClientRects();b=c.height/d.length;c=c.width/d.length;return BU(a)?b:c},FU=function(a,b,c){return BU(a)&&_.N.xa(c)?oU(c,_.Of):(DU(a)||
7
- EU(a))&&_.N.xa(b)?oU(b,"%"):eU},DU=function(a){return a.f.writingMode===_.Hg},EU=function(a){return a.f.writingMode===_.Jg},BU=function(a){return a.f.writingMode===_.Ji},GU=function(a,b,c){return(DU(a)||EU(a))&&_.N.xa(c)?oU(c,_.Of):DU(a)&&_.N.R(c)?oU(0,_.Of):BU(a)&&_.N.xa(b)?oU(b,"%"):eU},HU=function(a,b){if(typeof a.f.position===_.k&&typeof a.f.size===_.k)switch(b){case _.Ge:return a.f.position;case "auto":case _.rd:return a.f.position-a.f.size/2;case _.He:return a.f.position-a.f.size}return 0},
8
- IU=function(a){switch(a.f.positionAlign){case _.Ge:return _.De;case "auto":case _.rd:return _.Ii;case _.He:return _.Vf}return a.f.textAlign},JU=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.De:case _.De:return _.Ge;case _.Ii:return _.rd;case _.Vf:case _.Vf:return _.He}return a.f.positionAlign},KU=function(a){switch(a.f.writingMode){case _.Ji:return"horizontal-tb";case _.Hg:return _.Hg;case _.Jg:return _.Jg;default:throw Error("Unknown writing mode");}},LU=function(a,b){this.l=a;this.f=
9
- a.a;this.j=void 0===b?!1:b;this.a=vU(a.a);this.h=[]},MU=function(a,b){if(a.j)switch(b.writingMode){case _.Ji:return["-y"];case _.Hg:return["+x"];case _.Jg:return["-x"]}var c=[];switch(b.writingMode){case _.Ji:c=["+y","-y"];break;case _.Hg:c=["+x","-x"];break;case _.Jg:c=["-x","+x"]}0>b.line&&(c=c.reverse());return c},NU=function(a){for(a.h=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=vU(a.l.a)},OU=function(a,b,c){zU.call(this,a,b,c);this.h=null;this.l=[]},PU=function(a,b){OU.call(this,
10
- a.id,"clpp-text-cue-region",b);this.f=a},QU=function(a,b,c){a=a.f;var d=a.viewportAnchorUnits;if(d===_.Oi)return a.viewportAnchorY/100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(aU);},SU=function(a){this.g=new _.K("clpp.htmlcue.StyleManager");this.j=[];this.h=a;this.l=[];this.a=RU(this,this.h);this.f=RU(this,this.h,!0);this.f.disabled=!0;this.g.debug("Stylesheet CLPP Subtitle Styles has been created.")},TU=function(a,b){var c=!1;try{a.f.insertRule(b,0);var d=
11
- a.f.cssRules[0];d instanceof CSSStyleRule&&(c=d.selectorText.split(",").every(function(e){return 0===e.trim().indexOf("."+a.h+" ")}))}catch(e){}0<a.f.cssRules.length&&a.f.deleteRule(0);return c},UU=function(a,b){var c="."+a.h+" .clpp-text-container",d=c+" .clpp-text-cue";return b=b.replace(/::cue\((#[^)]+)\)/g,c+" $1").replace(/::cue\(([^)]+)\)/g,d+" $1").replace(/::cue-region\(([^)]+)\)/g,c+" $1 .clpp-text-cue").replace(/::cue/g,d).replace(/::cue-region/g,c+" .clpp-text-cue-region .clpp-text-cue").replace(/::ttml/g,
12
- c)},RU=function(a,b,c){var d=document.createElement(_.ng),e=d.dataset;e.name=$T;e["for"]=b;c&&(e.name="CLPP Subtitle Styles (sandbox)",e.sandbox=!0);b=document.head;b.appendChild(d);VU(a,b);a.g.debug("Created HTML style element #CLPP Subtitle Styles.");return d.sheet},VU=function(a,b){var c=new MutationObserver(function(d){d.forEach(function(e){e.removedNodes.forEach(function(f){f.id===$T&&a.g.error("PRESTOplay HTML style element #CLPP Subtitle Styles has been unexpectedly removed! Some styles will not work!")})})});
13
- c.observe(b,{subtree:!1,childList:!0});a.j.push(function(){return c.disconnect()})},YU=function(a){_.Bv.call(this,a);var b=this;this.g=new _.K(dU);this.m=a;this.L=WU(a.getConfiguration());this.j=!1;this.f=[];this.C=a.getSurface().getContainer();this.h=new SU(a.getSurface().getUniqueCssClass());this.a=new OU(null,"clpp-text-container",{});this.w=new _.Eu(a.getSurface(),this.Bk.bind(this));this.J=null;this.C?(this.C.appendChild(this.a.a),this.a.init(null)):this.g.warn("No container element! Subtitles will not appear. Please check your player surface configuration or switch to NativeTextDisplayer.");
14
- this.G=new _.yl(function(){XU(b)});this.A=new Map;this.l=null},WU=function(a){a=_.N.gb(a.htmlcue||{});_.N.R(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.N.R(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},ZU=function(a,b){return a.startTime<=b&&a.endTime>b},XU=function(a,b){if((b||a.j)&&a.C){var c=a.m.getPosition();if(b||a.J!==c&&a.m.getState()===_.Iq){a.J=c;var d=$U(a,c);(c=b)||(c=a.l,c=!(null===c&&null===d||null!==c&&null!==d&&c.start===d.start&&c.end===d.end));if(c&&(a.l=d,aV(a),
15
- d)){c={color:a.getFontColor()||void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.Gv(a)||void 0};d=a.f.slice(d.start,d.end+1);d=_.w(d);for(var e=d.next();!e.done;e=d.next()){var f=a;e=e.value;var g=f.a.a,h=null;switch(e.payloadType){case _.Qg:h="clpp-text-vtt";break;case _.vg:h=cU;break;case _.Hi:h=bU}h&&!g.classList.contains(h)&&_.jr(g,h);g=vU(f.a.a);if(0===g.width||0===g.height)f.g.warn("The height or width of the `.clpp-text-container` element is zero. Captions will not be displayed. Please check if the `clpp.styles.css` file has been included.");
16
- else{mU({fontSize:bV(f,e.containerRows)},f.a.a);g=null;h=e.payloadType===_.Qg;var l=e.payloadType===_.vg;e.region&&(h||l||e.backgroundImage)&&(f.A.has(e.region.id)?g=f.A.get(e.region.id):(g=new PU(e.region,{}),f.A.set(e.region.id,g),f.a.appendChild(g)));e=new AU(e,f.L,c);g?g.appendChild(e):f.a.appendChild(e)}}}}}},$U=function(a,b){var c=hU(a.f,function(e){return ZU(e,b)?0:b!==e.startTime?b-e.startTime:b-e.endTime});if(-1===c)return null;for(var d=c;0<=d-1&&ZU(a.f[d-1],b);)d--;for(;c+1<a.f.length&&
17
- ZU(a.f[c+1],b);)c++;return{start:d,end:c}},cV=function(a){aV(a);a.J=null;a.l=null;a.f=[]},aV=function(a){a.A.clear();if(a.a){var b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(cU);b.classList.remove(bU);a=a.a;NU(a.h);a.l=[]}},bV=function(a,b){var c=vU(a.a.a).height;if(null!==a.I)return a.getFontSize();if(null!==a.B){var d=a.getFontSizePercent();return Math.round(c*d)+_.Of}if(typeof b===_.k&&0<b)return Math.round(c/b)+_.Of;d=a.getFontSizePercent();return Math.round(c*d)+_.Of},dV=function(){},
18
- eV=function(){};
19
- iU.prototype.parse=function(a){a={input:a};for(var b=_.lr(_.Zd),c=[],d=b,e;null!==(e=jU(a));)if("\x3c"===e[0])if("/"===e[1])c.length&&c[c.length-1]===e.substr(2).replace("\x3e","")&&(c.pop(),d=d.parentNode);else{if(e=e.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/)){var f=e[1];var g=e[3];var h=fV[f];h?(h=_.lr(h),(f=gV[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||hV[g.localName]&&hV[g.localName]!==d.localName||(e[2]&&(g.className=e[2].substr(1).replace(/\./g," ")),c.push(e[1]),d.appendChild(g),
20
- d=g)}}else d.appendChild(document.createTextNode(lU(e)));return b};var fV={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},gV={v:"voice",lang:"lang"},hV={rt:"ruby"},kU={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f","\x26nbsp;":"\u00a0"};zU.prototype.init=function(){this.j=!0};zU.prototype.A=function(){return!1};_.x(AU,zU);AU.prototype.A=function(){return!this.h&&!(this.f.region&&this.f.region.displayAlign)};
21
- AU.prototype.init=function(a){zU.prototype.init.call(this,a);if(this.h)_.jr(this.a,"clpp-text-cue-image"),this.a.style.backgroundImage='url("'+this.f.backgroundImage+'")',this.l.stretchSmpteImage&&(this.a.style.backgroundSize="contain");else if(a){var b=this.f;if(b.payloadType===_.vg){var c=_.lr(_.Zd);c.innerHTML=b.payload;b=c}else b.payloadType===_.Qg?b=(new iU).parse(b.payload):(c=_.lr(_.Zd),c.textContent=b.payload,b=c);_.jr(b,this.w);this.id&&(b.id=this.id);c=_.w(this.f.cssClassList);for(var d=
22
- c.next();!d.done;d=c.next())_.jr(b,d.value);mU({writingMode:KU(this)},b);this.a.appendChild(b);_.jr(this.a,"clpp-text-wrapper");c=_.w(this.f.cssClassList);for(d=c.next();!d.done;d=c.next())_.jr(this.a,"clpp-text-wrapper__"+d.value);_.N.R(this.f.line)&&(this.f.lineInterpretation=_.Ki,this.f.line=BU(this)?-1:0);c=KU(this);mU({writingMode:c,webkitWritingMode:c,direction:eU,textAlign:IU(this)},this.a);if(!this.f.region||!this.f.region.displayAlign){c=HU(this,JU(this));d=GU(this,c,null);var e=FU(this,
23
- c,null),f=EU(this)&&_.N.R(null)?oU(0,_.Of):eU;mU({position:"absolute",left:d,right:f,top:e,width:BU(this)?oU(this.f.size,"%"):eU,height:DU(this)||EU(this)?oU(this.f.size,"%"):eU},this.a);d=this.f;a=BU(this)?a.height:a.width;e=CU(this);if(d.lineInterpretation===_.Ki)f=e*Math.round(d.line),Math.abs(f)>a&&(f=e*(0>d.line?0:-1)),0>f&&(f+=a);else{f=e/a*100;var g=d.line;switch(d.lineAlign){case _.rd:g-=f/2;break;case _.qe:g-=f}f=Math.round(g/100*a)}EU(this)&&(f=a-f-e);a=f;d=GU(this,c,a);e=EU(this)&&_.N.R(a)?
24
- oU(0,_.Of):eU;mU({left:d,right:e,top:FU(this,c,a)},this.a)}nU(this.C,b)}};AU.prototype.o=function(){return _.lr(_.Zd)};LU.prototype.append=function(a){var b=a.a;b.style.visibility=_.ye;this.f.appendChild(b);a.j||a.init(this.a);if(a.A()){a:{var c=vU(a.a);var d=MU(this,a.f),e=CU(a),f=uU(c),g=null,h=0;d=_.w(d);for(var l=d.next();!l.done;l=d.next()){for(l=l.value;yU(c,this.a,l)||xU(c,this.a)&&wU(c,this.h);){var m=c,n=e;switch(l){case "+x":m.left+=n;m.f+=n;break;case "-x":m.left-=n;m.f-=n;break;case "+y":m.top+=n;m.a+=n;break;case "-y":m.top-=n,m.a-=n}}if(this.j||xU(c,this.a))break a;l=this.a;l=Math.max(0,Math.min(c.f,
25
- l.f)-Math.max(c.left,l.left))*Math.max(0,Math.min(c.a,l.a)-Math.max(c.top,l.top))/(c.height*c.width);l>h&&(g=uU(c),h=l);c=uU(f)}c=g||f}mU({top:oU(c.top-this.a.top,_.Of),bottom:oU(this.a.a-c.a,_.Of),left:oU(c.left-this.a.left,_.Of),right:oU(this.a.f-c.f,_.Of),height:oU(c.height,_.Of),width:oU(c.width,_.Of)},a.a)}b.style.visibility="visible";this.h.push(vU(a.a))};_.x(OU,zU);OU.prototype.init=function(){this.h=new LU(this);this.j=!0};OU.prototype.o=function(){var a=_.lr(_.Zd);_.jr(a,this.w);this.id&&(a.id=this.id);return a};OU.prototype.appendChild=function(a){NU(this.h);this.l.unshift(a);a=_.w(this.l);for(var b=a.next();!b.done;b=a.next())this.h.append(b.value)};_.x(PU,OU);
26
- PU.prototype.init=function(a){a:{var b=this.f;switch(b.widthUnits){case 0:b=b.width;break a;case _.Oi:b=b.width/100*a.width;break a;default:throw Error(aU);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.Oi)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(aU);d=a.height;var e=QU(this,d,a.height);mU(this.B,this.a);mU({left:oU(c,_.Of),top:oU(e,_.Of),width:oU(b,_.Of),height:oU(d,_.Of)},this.a);this.f.writingMode&&mU({display:"flex",
27
- "flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&mU({"justify-content":this.f.displayAlign},this.a);b=_.w(this.f.cssClassList);for(c=b.next();!c.done;c=b.next())_.jr(this.a,c.value);a:switch(b=this.f,b.heightUnits){case 0:b=b.height;break a;case _.Oi:b=b.height/100*a.height;break a;case 2:b=b.height;d=new AU(new _.Ni(0,1,"Lorem ipsum",_.Hi),{},{});c=d.a;this.a.appendChild(c);d.init(vU(this.a));d=c.getBoundingClientRect().height;this.a.removeChild(c);b*=d;break a;default:throw Error(aU);
28
- }a=QU(this,b,a.height);mU({top:oU(a,_.Of),height:oU(b,_.Of)},this.a);this.h=new LU(this,!0);this.j=!0};PU.prototype.getId=function(){return this.f.id};SU.prototype.appendRule=function(a){if(null!=this.a&&!this.l.some(function(c){return c===a})){var b=UU(this,a);if(TU(this,b)){try{this.a.insertRule(b,this.a.cssRules.length),this.g.debug("Added CSS rule "+b)}catch(c){this.g.error("An error occurred when adding a CSS rule: "+b)}this.l.push(a)}else this.g.warn("Stylesheet CLPP Subtitle Styles ignoring the CSS rule because it's not safe: "+b)}};
29
- SU.prototype.destroy=function(){var a=this;return _.I(function(b){if(null==a.a)return b["return"]();a.j.forEach(function(c){return c()});a.j=[];if(null!=a.a){for(;0<a.a.cssRules.length;)a.a.deleteRule(0);a.l=[]}document.head.removeChild(a.a.ownerNode);document.head.removeChild(a.f.ownerNode);a.a=null;a.f=null;a.g.debug("Stylesheet CLPP Subtitle Styles has been destroyed.");_.B(b)})};_.x(YU,_.Bv);_.t=YU.prototype;_.t.append=function(a,b){if(null!=this.h&&0!==a.length){for(var c=_.w(b),d=c.next();!d.done;d=c.next())this.h.appendRule(d.value);a.sort(function(e,f){return e.startTime!==f.startTime?e.startTime-f.startTime:e.endTime-f.endTime});this.f=gU(this.f,fU(a));this.l=null;XU(this,!1)}};_.t.Rb=function(){null==this.h||XU(this,!0)};
30
- _.t.destroy=function(){var a=this;return _.I(function(b){if(1==b.a){if(null==a.h)return b["return"]();cV(a);a.G.stop();return _.y(b,a.h.destroy(),2)}a.h=null;a.C.removeChild(a.a.a);a.a=null;a.w.stop();a.w=null;a.j=!1;_.B(b)})};_.t.remove=function(a,b){if(null==this.h)return!1;this.f=this.f.filter(function(c){return c.startTime<a||c.endTime>=b});this.l=null;XU(this,!0);return!0};_.t.isTextVisible=function(){return this.j};
31
- _.t.setTextVisibility=function(a){null!=this.h&&this.j!==a&&((this.j=a)?(this.G.Eb(.25),this.L.enableResizeObserver&&this.w.start(),XU(this,!0)):(this.G.stop(),this.w.stop(),cV(this)))};_.t.Bk=function(){XU(this,!0)};_.J(dU,YU);YU.prototype.setTextVisibility=YU.prototype.setTextVisibility;YU.prototype.isTextVisible=YU.prototype.isTextVisible;YU.prototype.remove=YU.prototype.remove;YU.prototype.destroy=YU.prototype.destroy;YU.prototype.append=YU.prototype.append;dV.prototype.a=function(a){return!!a.enableHtmlCue&&!_.Il()};dV.prototype.create=function(a){return new YU(a)};_.x(eV,_.ku);eV.prototype.f=function(){_.kq(_.ze,new dV)};eV.prototype.a=function(){_.iq.has(_.ze)&&(_.iq["delete"](_.ze),_.jq.info("Removed factory: 'html'"))};eV.prototype.id=function(){return _.pg};_.J("clpp.htmlcue.HtmlCueComponent",eV);};
2
+ var f=function(window){var YU="CLPP Subtitle Styles",ZU="Unsupported unit",$U="clpp-text-plain",aV="clpp-text-ttml",bV="clpp.htmlcue.HtmlTextDisplayer",cV="initial",dV=function(a){return _.Zi(a,{Rh:function(b,c){return b.qa(c)}})},eV=function(a,b){if(0===b.length)return a;var c=a,d=a.findIndex(function(e){return e.startTime>=b[0].startTime});0<=d&&(c=c.slice(0,d));return c.concat(b)},fV=function(a,b){for(var c=0,d=a.length-1;c<=d;){var e=c+d>>1,f=b(a[e]);if(0===f)return e;0<f?c=e+1:d=e-1}return-1},gV=function(){},hV=function(a){if(!a.input)return null;
3
+ var b=a.input.match(/^([^<]*)(<[^>]+>?)?/);b=b[1]?b[1]:b[2];a.input=a.input.substr(b.length);return b},jV=function(a){for(var b=null;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],function(c){return iV[c]});return a},lV=function(a,b){kV(a,b);Array.from(b.getElementsByTagName("*")).forEach(function(c){kV(a,c)})},kV=function(a,b){for(var c in a)null!=a[c]&&(b.style[c]=a[c])},mV=function(a,b){return 0===a?"0":a+b},nV=function(a,b){return 1>Math.abs(a-b)||a<b},oV=function(a,b){return a<b&&
4
+ 1<Math.abs(a-b)},pV=function(a,b){return a>b&&1<Math.abs(a-b)},qV=function(a,b){return 1>Math.abs(a-b)||a>b},rV=function(a,b,c,d,e,f){this.left=a;this.f=b;this.top=c;this.a=d;this.height=e;this.width=f},sV=function(a){return new rV(a.left,a.f,a.top,a.a,a.height,a.width)},tV=function(a){var b=a.getBoundingClientRect(),c=getComputedStyle(a,null),d=parseFloat(c.getPropertyValue("border-left-width"))||0,e=parseFloat(c.getPropertyValue("border-right-width"))||0,f=parseFloat(c.getPropertyValue("border-top-width"))||
5
+ 0;c=parseFloat(c.getPropertyValue("border-bottom-width"))||0;var g=(b.top||a.offsetTop)+f;f=(b.height||a.offsetHeight)-f-c;return new rV(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-d-e)},uV=function(a,b){return b.some(function(c){return oV(a.left,c.f)&&pV(a.f,c.left)&&oV(a.top,c.a)&&pV(a.a,c.top)})},vV=function(a,b){return qV(a.top,b.top)&&nV(a.a,b.a)&&qV(a.left,b.left)&&nV(a.f,b.f)},wV=function(a,b,c){switch(c){case "+x":return oV(a.left,b.left);case "-x":return pV(a.f,b.f);
6
+ case "+y":return oV(a.top,b.top);case "-y":return pV(a.a,b.a);default:throw Error("Unknown axis");}},xV=function(a,b,c){this.id=a;this.w=b;this.B=c;this.a=this.o();this.j=!1},yV=function(a,b,c){xV.call(this,a.id,"clpp-text-cue",{});this.l=b;this.f=a;this.h=!!this.f.backgroundImage;this.C=c},AV=function(a){var b=a.a.childNodes[0],c=a.a.getBoundingClientRect(),d=b.getClientRects();b=c.height/d.length;c=c.width/d.length;return zV(a)?b:c},DV=function(a,b,c){return zV(a)&&_.N.xa(c)?mV(c,_.Xf):(BV(a)||
7
+ CV(a))&&_.N.xa(b)?mV(b,"%"):cV},BV=function(a){return a.f.writingMode===_.Xg},CV=function(a){return a.f.writingMode===_.Yg},zV=function(a){return a.f.writingMode===_.cj},EV=function(a,b,c){return(BV(a)||CV(a))&&_.N.xa(c)?mV(c,_.Xf):BV(a)&&_.N.R(c)?mV(0,_.Xf):zV(a)&&_.N.xa(b)?mV(b,"%"):cV},FV=function(a,b){if(typeof a.f.position===_.k&&typeof a.f.size===_.k)switch(b){case _.Oe:return a.f.position;case "auto":case _.yd:return a.f.position-a.f.size/2;case _.Qe:return a.f.position-a.f.size}return 0},
8
+ GV=function(a){switch(a.f.positionAlign){case _.Oe:return _.Le;case "auto":case _.yd:return _.bj;case _.Qe:return _.dg}return a.f.textAlign},HV=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.Le:case _.Le:return _.Oe;case _.bj:return _.yd;case _.dg:case _.dg:return _.Qe}return a.f.positionAlign},IV=function(a){switch(a.f.writingMode){case _.cj:return"horizontal-tb";case _.Xg:return _.Xg;case _.Yg:return _.Yg;default:throw Error("Unknown writing mode");}},JV=function(a,b){this.l=a;this.f=
9
+ a.a;this.j=void 0===b?!1:b;this.a=tV(a.a);this.h=[]},KV=function(a,b){if(a.j)switch(b.writingMode){case _.cj:return["-y"];case _.Xg:return["+x"];case _.Yg:return["-x"]}var c=[];switch(b.writingMode){case _.cj:c=["+y","-y"];break;case _.Xg:c=["+x","-x"];break;case _.Yg:c=["-x","+x"]}0>b.line&&(c=c.reverse());return c},LV=function(a){for(a.h=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=tV(a.l.a)},MV=function(a,b,c){xV.call(this,a,b,c);this.h=null;this.l=[]},NV=function(a,b){MV.call(this,
10
+ a.id,"clpp-text-cue-region",b);this.f=a},OV=function(a,b,c){a=a.f;var d=a.viewportAnchorUnits;if(d===_.hj)return a.viewportAnchorY/100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(ZU);},QV=function(a){this.g=new _.K("clpp.htmlcue.StyleManager");this.j=[];this.h=a;this.l=[];this.a=PV(this,this.h);this.f=PV(this,this.h,!0);this.f.disabled=!0;this.g.debug("Stylesheet CLPP Subtitle Styles has been created.")},RV=function(a,b){var c=!1;try{a.f.insertRule(b,0);var d=
11
+ a.f.cssRules[0];d instanceof CSSStyleRule&&(c=d.selectorText.split(",").every(function(e){return 0===e.trim().indexOf("."+a.h+" ")}))}catch(e){}0<a.f.cssRules.length&&a.f.deleteRule(0);return c},SV=function(a,b){var c="."+a.h+" .clpp-text-container",d=c+" .clpp-text-cue";return b=b.replace(/::cue\((#[^)]+)\)/g,c+" $1").replace(/::cue\(([^)]+)\)/g,d+" $1").replace(/::cue-region\(([^)]+)\)/g,c+" $1 .clpp-text-cue").replace(/::cue/g,d).replace(/::cue-region/g,c+" .clpp-text-cue-region .clpp-text-cue").replace(/::ttml/g,
12
+ c)},PV=function(a,b,c){var d=document.createElement(_.wg),e=d.dataset;e.name=YU;e["for"]=b;c&&(e.name="CLPP Subtitle Styles (sandbox)",e.sandbox=!0);b=document.head;b.appendChild(d);TV(a,b);a.g.debug("Created HTML style element #CLPP Subtitle Styles.");return d.sheet},TV=function(a,b){var c=new MutationObserver(function(d){d.forEach(function(e){e.removedNodes.forEach(function(f){f.id===YU&&a.g.error("PRESTOplay HTML style element #CLPP Subtitle Styles has been unexpectedly removed! Some styles will not work!")})})});
13
+ c.observe(b,{subtree:!1,childList:!0});a.j.push(function(){return c.disconnect()})},WV=function(a){_.Iv.call(this,a);var b=this;this.g=new _.K(bV);this.m=a;this.L=UV(a.getConfiguration());this.j=!1;this.f=[];this.C=a.getSurface().getContainer();this.h=new QV(a.getSurface().getUniqueCssClass());this.a=new MV(null,"clpp-text-container",{});this.w=new _.Zu(a.getSurface(),this.Kk.bind(this));this.J=null;this.C?(this.C.appendChild(this.a.a),this.a.init(null)):this.g.warn("No container element! Subtitles will not appear. Please check your player surface configuration or switch to NativeTextDisplayer.");
14
+ this.G=new _.mi(function(){VV(b)});this.A=new Map;this.l=null},UV=function(a){a=_.N.nb(a.htmlcue||{});_.N.R(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.N.R(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},XV=function(a,b){return a.startTime<=b&&a.endTime>b},VV=function(a,b){if((b||a.j)&&a.C){var c=a.m.getPosition();if(b||a.J!==c&&a.m.getState()===_.Vq){a.J=c;var d=YV(a,c);(c=b)||(c=a.l,c=!(null===c&&null===d||null!==c&&null!==d&&c.start===d.start&&c.end===d.end));if(c&&(a.l=d,ZV(a),
15
+ d)){c={color:a.getFontColor()||void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.Nv(a)||void 0};d=a.f.slice(d.start,d.end+1);d=_.w(d);for(var e=d.next();!e.done;e=d.next()){var f=a;e=e.value;var g=f.a.a,h=null;switch(e.payloadType){case _.eh:h="clpp-text-vtt";break;case _.Kg:h=aV;break;case _.aj:h=$U}h&&!g.classList.contains(h)&&_.ur(g,h);g=tV(f.a.a);if(0===g.width||0===g.height)f.g.warn("The height or width of the `.clpp-text-container` element is zero. Captions will not be displayed. Please check if the `clpp.styles.css` file has been included.");
16
+ else{kV({fontSize:$V(f,e.containerRows)},f.a.a);g=null;h=e.payloadType===_.eh;var l=e.payloadType===_.Kg;e.region&&(h||l||e.backgroundImage)&&(f.A.has(e.region.id)?g=f.A.get(e.region.id):(g=new NV(e.region,{}),f.A.set(e.region.id,g),f.a.appendChild(g)));e=new yV(e,f.L,c);g?g.appendChild(e):f.a.appendChild(e)}}}}}},YV=function(a,b){var c=fV(a.f,function(e){return XV(e,b)?0:b!==e.startTime?b-e.startTime:b-e.endTime});if(-1===c)return null;for(var d=c;0<=d-1&&XV(a.f[d-1],b);)d--;for(;c+1<a.f.length&&
17
+ XV(a.f[c+1],b);)c++;return{start:d,end:c}},aW=function(a){ZV(a);a.J=null;a.l=null;a.f=[]},ZV=function(a){a.A.clear();if(a.a){var b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(aV);b.classList.remove($U);a=a.a;LV(a.h);a.l=[]}},$V=function(a,b){var c=tV(a.a.a).height;if(null!==a.I)return a.getFontSize();if(null!==a.B){var d=a.getFontSizePercent();return Math.round(c*d)+_.Xf}if(typeof b===_.k&&0<b)return Math.round(c/b)+_.Xf;d=a.getFontSizePercent();return Math.round(c*d)+_.Xf},bW=function(){},
18
+ cW=function(){};
19
+ gV.prototype.parse=function(a){a={input:a};for(var b=_.wr(_.fe),c=[],d=b,e;null!==(e=hV(a));)if("\x3c"===e[0])if("/"===e[1])c.length&&c[c.length-1]===e.substr(2).replace("\x3e","")&&(c.pop(),d=d.parentNode);else{if(e=e.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/)){var f=e[1];var g=e[3];var h=dW[f];h?(h=_.wr(h),(f=eW[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||fW[g.localName]&&fW[g.localName]!==d.localName||(e[2]&&(g.className=e[2].substr(1).replace(/\./g," ")),c.push(e[1]),d.appendChild(g),
20
+ d=g)}}else d.appendChild(document.createTextNode(jV(e)));return b};var dW={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},eW={v:"voice",lang:"lang"},fW={rt:"ruby"},iV={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f","\x26nbsp;":"\u00a0"};xV.prototype.init=function(){this.j=!0};xV.prototype.A=function(){return!1};_.x(yV,xV);yV.prototype.A=function(){return!this.h&&!(this.f.region&&this.f.region.displayAlign)};
21
+ yV.prototype.init=function(a){xV.prototype.init.call(this,a);if(this.h)_.ur(this.a,"clpp-text-cue-image"),this.a.style.backgroundImage='url("'+this.f.backgroundImage+'")',this.l.stretchSmpteImage&&(this.a.style.backgroundSize="contain");else if(a){var b=this.f;if(b.payloadType===_.Kg){var c=_.wr(_.fe);c.innerHTML=b.payload;b=c}else b.payloadType===_.eh?b=(new gV).parse(b.payload):(c=_.wr(_.fe),c.textContent=b.payload,b=c);_.ur(b,this.w);this.id&&(b.id=this.id);c=_.w(this.f.cssClassList);for(var d=
22
+ c.next();!d.done;d=c.next())_.ur(b,d.value);kV({writingMode:IV(this)},b);this.a.appendChild(b);_.ur(this.a,"clpp-text-wrapper");c=_.w(this.f.cssClassList);for(d=c.next();!d.done;d=c.next())_.ur(this.a,"clpp-text-wrapper__"+d.value);_.N.R(this.f.line)&&(this.f.lineInterpretation=_.dj,this.f.line=zV(this)?-1:0);c=IV(this);kV({writingMode:c,webkitWritingMode:c,direction:cV,textAlign:GV(this)},this.a);if(!this.f.region||!this.f.region.displayAlign){c=FV(this,HV(this));d=EV(this,c,null);var e=DV(this,
23
+ c,null),f=CV(this)&&_.N.R(null)?mV(0,_.Xf):cV;kV({position:"absolute",left:d,right:f,top:e,width:zV(this)?mV(this.f.size,"%"):cV,height:BV(this)||CV(this)?mV(this.f.size,"%"):cV},this.a);d=this.f;a=zV(this)?a.height:a.width;e=AV(this);if(d.lineInterpretation===_.dj)f=e*Math.round(d.line),Math.abs(f)>a&&(f=e*(0>d.line?0:-1)),0>f&&(f+=a);else{f=e/a*100;var g=d.line;switch(d.lineAlign){case _.yd:g-=f/2;break;case _.ye:g-=f}f=Math.round(g/100*a)}CV(this)&&(f=a-f-e);a=f;d=EV(this,c,a);e=CV(this)&&_.N.R(a)?
24
+ mV(0,_.Xf):cV;kV({left:d,right:e,top:DV(this,c,a)},this.a)}lV(this.C,b)}};yV.prototype.o=function(){return _.wr(_.fe)};JV.prototype.append=function(a){var b=a.a;b.style.visibility=_.Ge;this.f.appendChild(b);a.j||a.init(this.a);if(a.A()){a:{var c=tV(a.a);var d=KV(this,a.f),e=AV(a),f=sV(c),g=null,h=0;d=_.w(d);for(var l=d.next();!l.done;l=d.next()){for(l=l.value;wV(c,this.a,l)||vV(c,this.a)&&uV(c,this.h);){var m=c,n=e;switch(l){case "+x":m.left+=n;m.f+=n;break;case "-x":m.left-=n;m.f-=n;break;case "+y":m.top+=n;m.a+=n;break;case "-y":m.top-=n,m.a-=n}}if(this.j||vV(c,this.a))break a;l=this.a;l=Math.max(0,Math.min(c.f,
25
+ l.f)-Math.max(c.left,l.left))*Math.max(0,Math.min(c.a,l.a)-Math.max(c.top,l.top))/(c.height*c.width);l>h&&(g=sV(c),h=l);c=sV(f)}c=g||f}kV({top:mV(c.top-this.a.top,_.Xf),bottom:mV(this.a.a-c.a,_.Xf),left:mV(c.left-this.a.left,_.Xf),right:mV(this.a.f-c.f,_.Xf),height:mV(c.height,_.Xf),width:mV(c.width,_.Xf)},a.a)}b.style.visibility="visible";this.h.push(tV(a.a))};_.x(MV,xV);MV.prototype.init=function(){this.h=new JV(this);this.j=!0};MV.prototype.o=function(){var a=_.wr(_.fe);_.ur(a,this.w);this.id&&(a.id=this.id);return a};MV.prototype.appendChild=function(a){LV(this.h);this.l.unshift(a);a=_.w(this.l);for(var b=a.next();!b.done;b=a.next())this.h.append(b.value)};_.x(NV,MV);
26
+ NV.prototype.init=function(a){a:{var b=this.f;switch(b.widthUnits){case 0:b=b.width;break a;case _.hj:b=b.width/100*a.width;break a;default:throw Error(ZU);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.hj)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(ZU);d=a.height;var e=OV(this,d,a.height);kV(this.B,this.a);kV({left:mV(c,_.Xf),top:mV(e,_.Xf),width:mV(b,_.Xf),height:mV(d,_.Xf)},this.a);this.f.writingMode&&kV({display:"flex",
27
+ "flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&kV({"justify-content":this.f.displayAlign},this.a);b=_.w(this.f.cssClassList);for(c=b.next();!c.done;c=b.next())_.ur(this.a,c.value);a:switch(b=this.f,b.heightUnits){case 0:b=b.height;break a;case _.hj:b=b.height/100*a.height;break a;case 2:b=b.height;d=new yV(new _.gj(0,1,"Lorem ipsum",_.aj),{},{});c=d.a;this.a.appendChild(c);d.init(tV(this.a));d=c.getBoundingClientRect().height;this.a.removeChild(c);b*=d;break a;default:throw Error(ZU);
28
+ }a=OV(this,b,a.height);kV({top:mV(a,_.Xf),height:mV(b,_.Xf)},this.a);this.h=new JV(this,!0);this.j=!0};NV.prototype.getId=function(){return this.f.id};QV.prototype.appendRule=function(a){if(null!=this.a&&!this.l.some(function(c){return c===a})){var b=SV(this,a);if(RV(this,b)){try{this.a.insertRule(b,this.a.cssRules.length),this.g.debug("Added CSS rule "+b)}catch(c){this.g.error("An error occurred when adding a CSS rule: "+b)}this.l.push(a)}else this.g.warn("Stylesheet CLPP Subtitle Styles ignoring the CSS rule because it's not safe: "+b)}};
29
+ QV.prototype.destroy=function(){var a=this;return _.I(function(b){if(null==a.a)return b["return"]();a.j.forEach(function(c){return c()});a.j=[];if(null!=a.a){for(;0<a.a.cssRules.length;)a.a.deleteRule(0);a.l=[]}document.head.removeChild(a.a.ownerNode);document.head.removeChild(a.f.ownerNode);a.a=null;a.f=null;a.g.debug("Stylesheet CLPP Subtitle Styles has been destroyed.");_.C(b)})};_.x(WV,_.Iv);_.u=WV.prototype;_.u.append=function(a,b){if(null!=this.h&&0!==a.length){for(var c=_.w(b),d=c.next();!d.done;d=c.next())this.h.appendRule(d.value);a.sort(function(e,f){return e.startTime!==f.startTime?e.startTime-f.startTime:e.endTime-f.endTime});this.f=eV(this.f,dV(a));this.l=null;VV(this,!1)}};_.u.Xb=function(){null==this.h||VV(this,!0)};
30
+ _.u.destroy=function(){var a=this;return _.I(function(b){if(1==b.a){if(null==a.h)return b["return"]();aW(a);a.G.stop();return _.y(b,a.h.destroy(),2)}a.h=null;a.C.removeChild(a.a.a);a.a=null;a.w.stop();a.w=null;a.j=!1;_.C(b)})};_.u.remove=function(a,b){if(null==this.h)return!1;this.f=this.f.filter(function(c){return c.startTime<a||c.endTime>=b});this.l=null;VV(this,!0);return!0};_.u.isTextVisible=function(){return this.j};
31
+ _.u.setTextVisibility=function(a){null!=this.h&&this.j!==a&&((this.j=a)?(this.G.Kb(.25),this.L.enableResizeObserver&&this.w.start(),VV(this,!0)):(this.G.stop(),this.w.stop(),aW(this)))};_.u.Kk=function(){VV(this,!0)};_.J(bV,WV);WV.prototype.setTextVisibility=WV.prototype.setTextVisibility;WV.prototype.isTextVisible=WV.prototype.isTextVisible;WV.prototype.remove=WV.prototype.remove;WV.prototype.destroy=WV.prototype.destroy;WV.prototype.append=WV.prototype.append;bW.prototype.a=function(a){return!!a.enableHtmlCue&&!_.Nl()};bW.prototype.create=function(a){return new WV(a)};_.x(cW,_.Gu);cW.prototype.f=function(){_.xq(_.He,new bW)};cW.prototype.a=function(){_.vq.has(_.He)&&(_.vq["delete"](_.He),_.wq.info("Removed factory: 'html'"))};cW.prototype.id=function(){return _.yg};_.J("clpp.htmlcue.HtmlCueComponent",cW);};
32
32
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
33
33
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
34
34
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.ima.js CHANGED
@@ -1,27 +1,28 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var HT="clpp.ima.AdsManagerFactory",IT=function(a,b,c){this.a=a;this.f=a.getAdPodInfo();this.j=b;this.h=c},JT=function(){},KT=function(a){this.a=a},LT=function(a){var b=a.ce("ima");if(!b)throw Error("IMA plugin not created.");var c=b.ld(),d=b.h;b=b.a;if(!c||!d||!b)throw Error("IMA plugin not initialized.");var e=a.getSurface().getMedia();if(!e)throw Error("Missing media element.");this.m=a;this.l=e;a=this.m.getConfiguration();a=_.N.gb(a.ima||{});this.G=_.N.ta({disableCustomPlayback:!1},a);this.L=
3
- c;this.M=d;this.j=b;this.J=new _.Gu;this.g=new _.K("clpp.ima");this.h=this.a=null;this.f=new _.ok;this.K=!1;this.H=new _.Yh;this.P=new JT;this.o=null;this.C=this.A=this.B=!1;this.I=this.w=null;c=this.H;d=google.ima.AdErrorEvent.Type.AD_ERROR;c.one(this.j,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.Nm.bind(this));c.on(this.j,d,this.Mm.bind(this));c.on(this.m,_.re,this.Tm.bind(this))},MT=function(a){var b=a.a,c=a.H,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.Dm.bind(a));c.on(b,
4
- d.LOADED,a.Fk.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.Um.bind(a));c.on(b,d.STARTED,a.Ik.bind(a));c.on(b,d.LOG,a.Hm.bind(a));c.on(b,d.AD_PROGRESS,a.Gk.bind(a));c.on(b,d.AD_BUFFERING,a.Em.bind(a));c.on(b,d.FIRST_QUARTILE,a.Dk.bind(a));c.on(b,d.MIDPOINT,a.Im.bind(a));c.on(b,d.THIRD_QUARTILE,a.Jk.bind(a));c.on(b,d.PAUSED,a.Km.bind(a));c.on(b,d.RESUMED,a.Lm.bind(a));c.on(b,d.CLICK,a.Ck.bind(a));c.on(b,d.SKIPPED,a.Hk.bind(a));c.on(b,d.IMPRESSION,a.Ek.bind(a));c.on(b,d.COMPLETE,a.Fm.bind(a));c.on(b,
5
- d.CONTENT_RESUME_REQUESTED,a.Vm.bind(a))},NT=function(a){a=a.G;var b=new google.ima.AdsRenderingSettings;b.restoreCustomPlaybackStateOnAdBreakComplete=!1;typeof a.bitrate===_.k&&(b.bitrate=a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.hd?a.enablePreloading:!0;typeof a.loadVideoTimeout===_.k&&(b.loadVideoTimeout=a.loadVideoTimeout);Array.isArray(a.mimeTypes)&&(b.mimeTypes=a.mimeTypes);typeof a.playAdsAfterTime===_.k&&(b.playAdsAfterTime=a.playAdsAfterTime);typeof a.useStyledLinearAds===
6
- _.hd&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},PT=function(a){a.o=null;OT(a,_.Jc);a.m.getSurface().hide(a.L)},QT=function(a){_.kr(a.l,{visibility:"visible"})},OT=function(a,b,c){c=c&&c.getAd();var d=null;c&&(d={ad:new IT(c,a.B,a.A)});a.m.trigger(new _.L(b,d))},RT=function(a,b){var c=b?a.P.create(b.getErrorCode()):null;a.m.onError(new _.P(1,9,10003,{errorType:c},b))},ST=function(a){return!1===a.G.disableCustomPlayback&&a.a.isCustomPlaybackUsed()&&
7
- _.wk()},UT=function(a){var b,c;return _.I(function(d){if(1==d.a)return a.M.initialize(),b=!!a.m.getConfiguration().muted,_.y(d,a.J.canPlay(b),2);c=d.f;if(!c&&!ST(a))return OT(a,_.fd),a.g.warn(_.ma),d["return"]();TT(a);_.B(d)})},VT=function(a,b){return _.I(function(c){if(1==c.a)return a.M.initialize(),_.y(c,b.play(),2);TT(a);_.B(c)})},TT=function(a){a.a.init(a.l.offsetWidth,a.l.offsetHeight,google.ima.ViewMode.NORMAL);a.a.start();a.K=!0},WT=function(){this.a=this.h=this.f=null},XT=function(){return!window.google||
8
- !google.ima||!google.ima.AdsLoader},YT=function(){},ZT=function(){this.sd=new _.K(HT)};_.t=IT.prototype;_.t.sb=function(){return"Google IMA SDK"};_.t.tb=function(){return google.ima.VERSION};_.t.wb=function(){return 0};_.t.getId=function(){return this.a.getAdId()};_.t.getCreativeId=function(){return this.a.getCreativeId()};_.t.Xb=function(){return""};_.t.getApiFramework=function(){return this.a.getApiFramework()};_.t.getAdSystem=function(){return this.a.getAdSystem()};_.t.getAdvertiserName=function(){return this.a.getAdvertiserName()};
9
- _.t.getTitle=function(){return this.a.getTitle()};_.t.getDuration=function(){return this.a.getDuration()};_.t.getPosition=function(){return 0};_.t.getSkipTimeOffset=function(){return this.a.getSkipTimeOffset()};_.t.ac=function(){return this.f?this.f.getIsBumper():!1};_.t.ub=function(){var a=null,b=this.a,c=Object.keys(b).find(function(d){return typeof b[d]===_.Ze&&typeof b[d].clickThroughUrl===_.lg});c&&(a=b[c].clickThroughUrl);return a};_.t.getMediaUrl=function(){return this.a.getMediaUrl()};
10
- _.t.jb=function(){return this.a.getVastMediaWidth()};_.t.ib=function(){return this.a.getVastMediaHeight()};_.t.Ta=function(){return this.a.getVastMediaBitrate()};_.t.Ua=function(){return this.h?2:this.j?1:0};_.t.getPodIndex=function(){return this.f?this.f.getPodIndex():0};_.t.Jb=function(){return this.f?this.f.getTimeOffset():0};_.t.Kb=function(){return this.f?this.f.getAdPosition():1};_.t.kb=function(){return this.f?this.f.getTotalAds():1};_.t.getWrapperAdIds=function(){return this.a.getWrapperAdIds()};
11
- _.t.getWrapperAdSystems=function(){return this.a.getWrapperAdSystems()};_.t.getWrapperCreativeIds=function(){return this.a.getWrapperCreativeIds()};_.t.$b=function(){return null};IT.prototype.getVideoElement=IT.prototype.$b;IT.prototype.getWrapperCreativeIds=IT.prototype.getWrapperCreativeIds;IT.prototype.getWrapperAdSystems=IT.prototype.getWrapperAdSystems;IT.prototype.getWrapperAdIds=IT.prototype.getWrapperAdIds;IT.prototype.getSequenceLength=IT.prototype.kb;IT.prototype.getPositionInSequence=IT.prototype.Kb;
12
- IT.prototype.getPodTimeOffset=IT.prototype.Jb;IT.prototype.getPodIndex=IT.prototype.getPodIndex;IT.prototype.getPodType=IT.prototype.Ua;IT.prototype.getMediaBitrate=IT.prototype.Ta;IT.prototype.getMediaHeight=IT.prototype.ib;IT.prototype.getMediaWidth=IT.prototype.jb;IT.prototype.getMediaUrl=IT.prototype.getMediaUrl;IT.prototype.getClickThroughUrl=IT.prototype.ub;IT.prototype.isBumper=IT.prototype.ac;IT.prototype.getSkipTimeOffset=IT.prototype.getSkipTimeOffset;IT.prototype.getPosition=IT.prototype.getPosition;
13
- IT.prototype.getDuration=IT.prototype.getDuration;IT.prototype.getTitle=IT.prototype.getTitle;IT.prototype.getAdvertiserName=IT.prototype.getAdvertiserName;IT.prototype.getAdSystem=IT.prototype.getAdSystem;IT.prototype.getApiFramework=IT.prototype.getApiFramework;IT.prototype.getSourceId=IT.prototype.Xb;IT.prototype.getCreativeId=IT.prototype.getCreativeId;IT.prototype.getId=IT.prototype.getId;IT.prototype.getTechnology=IT.prototype.wb;IT.prototype.getAdManagerVersion=IT.prototype.tb;
14
- IT.prototype.getAdManagerName=IT.prototype.sb;JT.prototype.create=function(a){var b=google.ima.AdError.ErrorCode;switch(a){case b.VAST_LOAD_TIMEOUT:case b.VAST_MEDIA_LOAD_TIMEOUT:case b.FAILED_TO_REQUEST_ADS:return 0;case b.VIDEO_PLAY_ERROR:return 1;default:return 2}};KT.prototype.getCuePoints=function(){return this.a};KT.prototype.Mb=function(){return 0<=this.a.indexOf(0)||0===this.a.length};KT.prototype.Lb=function(){return 0<=this.a.indexOf(-1)};KT.prototype.hasPostroll=KT.prototype.Lb;KT.prototype.hasPreroll=KT.prototype.Mb;KT.prototype.getCuePoints=KT.prototype.getCuePoints;_.t=LT.prototype;
15
- _.t.Nm=function(a){var b=this;this.a=a.getAdsManager(this.l,NT(this));this.a.isCustomPlaybackUsed()&&!ST(this)?(this.g.warn("IMA plugin is disabled for this platform with single video element. Disposing."),this.m.onError(new _.P(1,9,10002)),this.yc()):(this.h=new _.Eu(this.m.getSurface(),function(c,d,e){b.a.resize(c,d,e?google.ima.ViewMode.FULLSCREEN:google.ima.ViewMode.NORMAL)}),a=this.a.getCuePoints(),this.w=new KT(a),this.m.trigger(new _.L(_.Mc,{adsTimeline:this.w})),MT(this));this.f.resolve()};
16
- _.t.Mm=function(a){RT(this,a.getError());this.f.resolve()};_.t.Um=function(a){var b=this;return _.I(function(c){switch(c.a){case 1:return b.C=!0,ST(b)?(b.I=b.m.getPosition(),_.y(c,b.m.detach(),5)):_.y(c,b.m.pause(),4);case 4:_.kr(b.l,{visibility:_.ye});c.F(3);break;case 5:var d=b.m;d.a&&d.a.stopForwardingEventsTo(d);case 3:OT(b,_.qc,a),b.h.start(),_.B(c)}})};_.t.Dm=function(){var a=this;return _.I(function(b){a.a.start();_.B(b)})};
17
- _.t.Fk=function(a){a.getAd().isLinear()?OT(this,_.Cc,a):(this.a.discardAdBreak(),this.B||(this.B=!0,this.m.play()))};_.t.Ik=function(a){this.o=a.getAd().getDuration();OT(this,_.Ic,a);this.m.getSurface().show(this.L)};_.t.Hm=function(a){a=a.getAdData();RT(this,a?a.adError:null);PT(this)};_.t.Gk=function(a){OT(this,_.Fc,a)};_.t.Em=function(a){OT(this,_.uc,a)};_.t.Dk=function(a){OT(this,_.xc,a)};_.t.Im=function(a){OT(this,_.Dc,a)};_.t.Jk=function(a){OT(this,_.Kc,a)};_.t.Km=function(a){OT(this,_.Ec,a)};
18
- _.t.Lm=function(a){OT(this,_.Gc,a)};_.t.Ck=function(a){this.pause();OT(this,_.vc,a)};_.t.Hk=function(a){OT(this,_.Hc,a);PT(this)};_.t.Ek=function(a){OT(this,_.Bc,a)};_.t.Fm=function(a){OT(this,_.wc,a);PT(this)};
19
- _.t.Vm=function(){var a=this;return _.I(function(b){switch(b.a){case 1:a.B=!0;if(!ST(a)||null===a.I){if(!a.C)return b["return"](a.m.play());QT(a);b.F(2);break}var c=a.m;c.a&&c.a.forwardEventsTo(c);return _.y(b,_.Dt(a.m),3);case 3:if(a.A){b.F(2);break}return _.y(b,a.m.seek(a.I),2);case 2:a.C=!1;a.h&&a.h.stop();if(a.A){b.F(6);break}return _.y(b,a.m.play(),6);case 6:OT(a,_.sc),_.B(b)}})};_.t.Tm=function(){this.A=!0;this.j.contentComplete()};
20
- _.t.load=function(){var a=this,b,c,d,e,f;return _.I(function(g){if(1==g.a){b=a.m;c=a.G;try{if(typeof c.adTagUrl!==_.lg)throw new _.P(1,9,10001,{missingKeys:"adTagUrl"});}catch(h){return b.onError(h),a.f.resolve(),g["return"](a.f)}return c.adTagUrl?_.y(g,a.J.canPlay(!1),2):(a.f.resolve(),g["return"](a.f))}if(3!=g.a)return d=g.f,_.y(g,a.J.canPlay(!0),3);e=g.f;f=new google.ima.AdsRequest;f.adTagUrl=c.adTagUrl;f.setAdWillAutoPlay(d);f.setAdWillPlayMuted(e);a.j.getSettings().setAutoPlayAdBreaks(!1);a.j.requestAds(f);
21
- return g["return"](a.f)})};_.t.start=function(a){var b=this;return _.I(function(c){return b.a&&b.w&&!b.K?b.w.Mb()?_.y(c,UT(b),0):_.y(c,VT(b,a),0):_.y(c,a.play(),0)})};_.t.cd=function(){};_.t.Zc=function(){return!0};_.t.resume=function(){this.a&&this.a.resume()};_.t.pause=function(){this.a&&this.a.pause()};_.t.skip=function(){this.a&&this.a.skip()};_.t.getVolume=function(){return this.a?this.a.getVolume():1};_.t.setVolume=function(a){this.a&&this.a.setVolume(a)};
22
- _.t.getPosition=function(){if(!this.a||null===this.o)return-1;var a=this.a.getRemainingTime();return 0>a?0:this.o-a};_.t.yc=function(){this.a&&(this.a.destroy(),this.a=null);QT(this);this.H.release();this.h&&(this.h.stop(),this.h=null);return Promise.resolve()};LT.prototype.getPosition=LT.prototype.getPosition;LT.prototype.setVolume=LT.prototype.setVolume;LT.prototype.getVolume=LT.prototype.getVolume;LT.prototype.skip=LT.prototype.skip;LT.prototype.pause=LT.prototype.pause;LT.prototype.resume=LT.prototype.resume;_.x(WT,_.Lv);_.t=WT.prototype;_.t.onPlayerCreated=function(a){if(XT())return a.onError(new _.P(1,9,1E4));this.f=_.ir(_.Zd,{"class":"clpp-ima clpp-hidden"});a.getSurface().addElementToContainer(this.f);this.h=new google.ima.AdDisplayContainer(this.f,a.getSurface().getMedia());this.a=new google.ima.AdsLoader(this.h);this.a.getSettings().setPlayerType(_.va);this.a.getSettings().setPlayerVersion(_.ia);this.a.getSettings().setAutoPlayAdBreaks(!0)};
23
- _.t.onPlayerWillDestroy=function(a){this.a&&(this.a.destroy(),this.a=null);this.h&&(this.h.destroy(),this.h=null);this.f&&(a.getSurface().removeElementFromContainer(this.f),this.f=null)};_.t.Ml=function(){return this.a};_.t.Kl=function(){return this.h};_.t.ld=function(){return this.f};_.t.id=function(){return"ima"};_.J("clpp.ima.ImaPlugin",WT);WT.prototype.getAdContainer=WT.prototype.ld;WT.prototype.getAdDisplayContainer=WT.prototype.Kl;WT.prototype.getAdsLoader=WT.prototype.Ml;WT.Id="ima";
24
- WT.isSdkMissing=XT;YT.prototype.create=function(){return new WT};_.Ht(new YT);ZT.prototype.name=function(){return HT};ZT.prototype.a=function(a,b){return a.namespace()===_.zd?!1:XT()?(this.sd.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)};ZT.prototype.create=function(a){return new LT(a)};_.cr(new ZT);};
2
+ var f=function(window){var BU="clpp.ima.AdsManagerFactory",CU=function(a,b){return new Promise(function(c){if(a.readyState===HTMLMediaElement.HAVE_NOTHING&&0===a.networkState)c();else b.one(a,"emptied",c)})},DU=function(a,b,c){this.a=a;this.f=a.getAdPodInfo();this.j=b;this.h=c},EU=function(){},FU=function(a){this.a=a},GU=function(a){var b=a.ge("ima");if(!b)throw Error("IMA plugin not created.");var c=b.ud(),d=b.h;b=b.a;if(!c||!d||!b)throw Error("IMA plugin not initialized.");var e=a.getSurface().getMedia();if(!e)throw Error("Missing media element.");
3
+ this.m=a;this.f=e;a=this.m.getConfiguration();a=_.N.nb(a.ima||{});this.I=_.N.ua({disableCustomPlayback:!1},a);this.L=c;this.M=d;this.o=b;this.J=new _.bv;this.g=new _.K("clpp.ima");this.j=this.a=null;this.h=new _.xk;this.K=!1;this.l=new _.wi;this.P=new EU;this.w=null;this.H=this.B=this.C=!1;this.G=this.A=null;c=this.l;d=google.ima.AdErrorEvent.Type.AD_ERROR;c.one(this.o,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.cn.bind(this));c.on(this.o,d,this.bn.bind(this));c.on(this.m,_.ze,this.jn.bind(this))},
4
+ HU=function(a){var b=a.a,c=a.l,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.Tm.bind(a));c.on(b,d.LOADED,a.Ok.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.kn.bind(a));c.on(b,d.STARTED,a.Rk.bind(a));c.on(b,d.LOG,a.Xm.bind(a));c.on(b,d.AD_PROGRESS,a.Pk.bind(a));c.on(b,d.AD_BUFFERING,a.Um.bind(a));c.on(b,d.FIRST_QUARTILE,a.Mk.bind(a));c.on(b,d.MIDPOINT,a.Ym.bind(a));c.on(b,d.THIRD_QUARTILE,a.Sk.bind(a));c.on(b,d.PAUSED,a.$m.bind(a));c.on(b,d.RESUMED,a.an.bind(a));c.on(b,d.CLICK,a.Lk.bind(a));c.on(b,
5
+ d.SKIPPED,a.Qk.bind(a));c.on(b,d.IMPRESSION,a.Nk.bind(a));c.on(b,d.COMPLETE,a.Vm.bind(a));c.on(b,d.CONTENT_RESUME_REQUESTED,a.ln.bind(a))},IU=function(a){a=a.I;var b=new google.ima.AdsRenderingSettings;b.restoreCustomPlaybackStateOnAdBreakComplete=!1;typeof a.bitrate===_.k&&(b.bitrate=a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.nd?a.enablePreloading:!0;typeof a.loadVideoTimeout===_.k&&(b.loadVideoTimeout=a.loadVideoTimeout);Array.isArray(a.mimeTypes)&&(b.mimeTypes=a.mimeTypes);typeof a.playAdsAfterTime===
6
+ _.k&&(b.playAdsAfterTime=a.playAdsAfterTime);typeof a.useStyledLinearAds===_.nd&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},KU=function(a){a.w=null;JU(a,_.Oc);a.m.getSurface().hide(a.L)},LU=function(a){return _.I(function(b){if(1==b.a)return _.y(b,a.m.detach(),2);var c=a.m;c.a&&c.a.stopForwardingEventsTo(c);_.C(b)})},MU=function(a){return _.I(function(b){return _.y(b,CU(a.f,a.l),0)})},NU=function(a){return _.I(function(b){return b["return"](new Promise(function(c){a.l.on(a.f,
7
+ _.Wf,function(){a.m.getState()===_.Uq&&c()})}))})},OU=function(a){_.vr(a.f,{visibility:"visible"})},JU=function(a,b,c){c=c&&c.getAd();var d=null;c&&(d={ad:new DU(c,a.C,a.B)});a.m.trigger(new _.L(b,d))},PU=function(a,b){var c=b?a.P.create(b.getErrorCode()):null;a.m.onError(new _.O(1,9,10003,{errorType:c},b))},QU=function(a){return!1===a.I.disableCustomPlayback&&a.a.isCustomPlaybackUsed()},SU=function(a){var b,c;return _.I(function(d){if(1==d.a)return a.M.initialize(),b=!!a.m.getConfiguration().muted,
8
+ _.y(d,a.J.canPlay(b),2);if(3!=d.a)return c=d.f,c||QU(a)?QU(a)?_.y(d,LU(a),3):d.F(3):(JU(a,_.ld),a.g.warn(_.oa),d["return"]());RU(a);_.C(d)})},TU=function(a,b){return _.I(function(c){if(1==c.a)return a.M.initialize(),_.y(c,b.play(),2);RU(a);_.C(c)})},RU=function(a){a.a.init(a.f.offsetWidth,a.f.offsetHeight,google.ima.ViewMode.NORMAL);a.a.start();a.K=!0},UU=function(){this.a=this.h=this.f=null},VU=function(){return!window.google||!google.ima||!google.ima.AdsLoader},WU=function(){},XU=function(){this.Ca=
9
+ new _.K(BU)};_.u=DU.prototype;_.u.yb=function(){return"Google IMA SDK"};_.u.zb=function(){return google.ima.VERSION};_.u.Db=function(){return 0};_.u.getId=function(){return this.a.getAdId()};_.u.getCreativeId=function(){return this.a.getCreativeId()};_.u.cc=function(){return""};_.u.getApiFramework=function(){return this.a.getApiFramework()};_.u.getAdSystem=function(){return this.a.getAdSystem()};_.u.getAdvertiserName=function(){return this.a.getAdvertiserName()};_.u.getTitle=function(){return this.a.getTitle()};
10
+ _.u.getDuration=function(){return this.a.getDuration()};_.u.getPosition=function(){return 0};_.u.getSkipTimeOffset=function(){return this.a.getSkipTimeOffset()};_.u.gc=function(){return this.f?this.f.getIsBumper():!1};_.u.Ab=function(){var a=null,b=this.a,c=Object.keys(b).find(function(d){return typeof b[d]===_.gf&&typeof b[d].clickThroughUrl===_.ug});c&&(a=b[c].clickThroughUrl);return a};_.u.getMediaUrl=function(){return this.a.getMediaUrl()};_.u.qb=function(){return this.a.getVastMediaWidth()};
11
+ _.u.pb=function(){return this.a.getVastMediaHeight()};_.u.Xa=function(){return this.a.getVastMediaBitrate()};_.u.Ya=function(){return this.h?2:this.j?1:0};_.u.getPodIndex=function(){return this.f?this.f.getPodIndex():0};_.u.Pb=function(){return this.f?this.f.getTimeOffset():0};_.u.Cb=function(){return this.f?this.f.getAdPosition():1};_.u.rb=function(){return this.f?this.f.getTotalAds():1};_.u.getWrapperAdIds=function(){return this.a.getWrapperAdIds()};_.u.canSeek=function(){return!1};
12
+ _.u.getWrapperAdSystems=function(){return this.a.getWrapperAdSystems()};_.u.getWrapperCreativeIds=function(){return this.a.getWrapperCreativeIds()};_.u.fc=function(){return null};DU.prototype.getVideoElement=DU.prototype.fc;DU.prototype.getWrapperCreativeIds=DU.prototype.getWrapperCreativeIds;DU.prototype.getWrapperAdSystems=DU.prototype.getWrapperAdSystems;DU.prototype.canSeek=DU.prototype.canSeek;DU.prototype.getWrapperAdIds=DU.prototype.getWrapperAdIds;DU.prototype.getSequenceLength=DU.prototype.rb;
13
+ DU.prototype.getPositionInSequence=DU.prototype.Cb;DU.prototype.getPodTimeOffset=DU.prototype.Pb;DU.prototype.getPodIndex=DU.prototype.getPodIndex;DU.prototype.getPodType=DU.prototype.Ya;DU.prototype.getMediaBitrate=DU.prototype.Xa;DU.prototype.getMediaHeight=DU.prototype.pb;DU.prototype.getMediaWidth=DU.prototype.qb;DU.prototype.getMediaUrl=DU.prototype.getMediaUrl;DU.prototype.getClickThroughUrl=DU.prototype.Ab;DU.prototype.isBumper=DU.prototype.gc;DU.prototype.getSkipTimeOffset=DU.prototype.getSkipTimeOffset;
14
+ DU.prototype.getPosition=DU.prototype.getPosition;DU.prototype.getDuration=DU.prototype.getDuration;DU.prototype.getTitle=DU.prototype.getTitle;DU.prototype.getAdvertiserName=DU.prototype.getAdvertiserName;DU.prototype.getAdSystem=DU.prototype.getAdSystem;DU.prototype.getApiFramework=DU.prototype.getApiFramework;DU.prototype.getSourceId=DU.prototype.cc;DU.prototype.getCreativeId=DU.prototype.getCreativeId;DU.prototype.getId=DU.prototype.getId;DU.prototype.getTechnology=DU.prototype.Db;
15
+ DU.prototype.getAdManagerVersion=DU.prototype.zb;DU.prototype.getAdManagerName=DU.prototype.yb;EU.prototype.create=function(a){var b=google.ima.AdError.ErrorCode;switch(a){case b.VAST_LOAD_TIMEOUT:case b.VAST_MEDIA_LOAD_TIMEOUT:case b.FAILED_TO_REQUEST_ADS:return 0;case b.VIDEO_PLAY_ERROR:return 1;default:return 2}};FU.prototype.getCuePoints=function(){return this.a};FU.prototype.Sb=function(){return 0<=this.a.indexOf(0)||0===this.a.length};FU.prototype.Rb=function(){return 0<=this.a.indexOf(-1)};FU.prototype.hasPostroll=FU.prototype.Rb;FU.prototype.hasPreroll=FU.prototype.Sb;FU.prototype.getCuePoints=FU.prototype.getCuePoints;_.u=GU.prototype;
16
+ _.u.cn=function(a){var b=this;this.a=a.getAdsManager(this.f,IU(this));this.a.isCustomPlaybackUsed()&&!QU(this)?(this.g.warn("IMA plugin is disabled for this platform with single video element. Disposing."),this.m.onError(new _.O(1,9,10002)),this.Ec()):(this.j=new _.Zu(this.m.getSurface(),function(c,d,e){b.a.resize(c,d,e?google.ima.ViewMode.FULLSCREEN:google.ima.ViewMode.NORMAL)}),a=this.a.getCuePoints(),this.A=new FU(a),this.m.trigger(new _.L(_.Rc,{adsTimeline:this.A})),HU(this));this.h.resolve()};
17
+ _.u.bn=function(a){PU(this,a.getError());this.h.resolve()};_.u.kn=function(a){var b=this;return _.I(function(c){if(1==c.a)return b.H=!0,QU(b)?(b.G=b.m.getPosition(),_.y(c,LU(b),3)):_.y(c,b.m.pause(),4);if(3!=c.a)return _.vr(b.f,{visibility:_.Ge}),c.F(3);JU(b,_.xc,a);b.j.start();_.C(c)})};_.u.Tm=function(){var a=this;return _.I(function(b){if(1==b.a)return QU(a)?_.y(b,CU(a.f,a.l),2):b.F(2);a.a.start();_.C(b)})};
18
+ _.u.Ok=function(a){a.getAd().isLinear()?JU(this,_.Hc,a):(this.a.discardAdBreak(),this.C||(this.C=!0,this.m.play()))};_.u.Rk=function(a){this.w=a.getAd().getDuration();JU(this,_.Nc,a);this.m.getSurface().show(this.L)};_.u.Xm=function(a){a=a.getAdData();PU(this,a?a.adError:null);KU(this)};_.u.Pk=function(a){JU(this,_.Kc,a)};_.u.Um=function(a){JU(this,_.zc,a)};_.u.Mk=function(a){JU(this,_.Cc,a)};_.u.Ym=function(a){JU(this,_.Ic,a)};_.u.Sk=function(a){JU(this,_.Pc,a)};_.u.$m=function(a){JU(this,_.Jc,a)};
19
+ _.u.an=function(a){JU(this,_.Lc,a)};_.u.Lk=function(a){this.pause();JU(this,_.Ac,a)};_.u.Qk=function(a){JU(this,_.Mc,a);KU(this)};_.u.Nk=function(a){JU(this,_.Gc,a)};_.u.Vm=function(a){JU(this,_.Bc,a);KU(this)};
20
+ _.u.ln=function(){var a=this;return _.I(function(b){switch(b.a){case 1:a.C=!0;if(!QU(a)||null===a.G){if(!a.H)return b["return"](a.m.play());OU(a);b.F(2);break}return _.y(b,MU(a),3);case 3:return _.y(b,_.Zt(a.m),4);case 4:if(a.B||!a.G){b.F(2);break}return _.y(b,NU(a),6);case 6:return _.y(b,a.m.seek(a.G),2);case 2:a.H=!1;a.j&&a.j.stop();if(a.B){b.F(8);break}return _.y(b,a.m.play(),8);case 8:JU(a,_.yc),_.C(b)}})};_.u.jn=function(){this.B=!0;this.o.contentComplete()};
21
+ _.u.load=function(){var a=this,b,c,d,e,f;return _.I(function(g){if(1==g.a){b=a.m;c=a.I;try{if(typeof c.adTagUrl!==_.ug)throw new _.O(1,9,10001,{missingKeys:"adTagUrl"});}catch(h){return b.onError(h),a.h.resolve(),g["return"](a.h)}return c.adTagUrl?_.y(g,a.J.canPlay(!1),2):(a.h.resolve(),g["return"](a.h))}if(3!=g.a)return d=g.f,_.y(g,a.J.canPlay(!0),3);e=g.f;f=new google.ima.AdsRequest;f.adTagUrl=c.adTagUrl;f.setAdWillAutoPlay(d);f.setAdWillPlayMuted(e);a.o.getSettings().setAutoPlayAdBreaks(!1);a.o.requestAds(f);
22
+ return g["return"](a.h)})};_.u.start=function(a){var b=this;return _.I(function(c){return b.a&&b.A&&!b.K?b.A.Sb()?_.y(c,SU(b),0):_.y(c,TU(b,a),0):_.y(c,a.play(),0)})};_.u.kd=function(){};_.u.gd=function(){return!0};_.u.resume=function(){this.a&&this.a.resume()};_.u.pause=function(){this.a&&this.a.pause()};_.u.skip=function(){this.a&&this.a.skip()};_.u.getVolume=function(){return this.a?this.a.getVolume():1};_.u.setVolume=function(a){this.a&&this.a.setVolume(a)};
23
+ _.u.getPosition=function(){if(!this.a||null===this.w)return-1;var a=this.a.getRemainingTime();return 0>a?0:this.w-a};_.u.Ec=function(){this.a&&(this.a.destroy(),this.a=null);OU(this);this.l.release();this.j&&(this.j.stop(),this.j=null);return Promise.resolve()};GU.prototype.getPosition=GU.prototype.getPosition;GU.prototype.setVolume=GU.prototype.setVolume;GU.prototype.getVolume=GU.prototype.getVolume;GU.prototype.skip=GU.prototype.skip;GU.prototype.pause=GU.prototype.pause;GU.prototype.resume=GU.prototype.resume;_.x(UU,_.gw);_.u=UU.prototype;_.u.onPlayerCreated=function(a){if(VU())return a.onError(new _.O(1,9,1E4));this.f=_.tr(_.fe,{"class":"clpp-ima clpp-hidden"});a.getSurface().addElementToContainer(this.f);this.h=new google.ima.AdDisplayContainer(this.f,a.getSurface().getMedia());this.a=new google.ima.AdsLoader(this.h);this.a.getSettings().setPlayerType(_.xa);this.a.getSettings().setPlayerVersion(_.ia);this.a.getSettings().setAutoPlayAdBreaks(!0)};
24
+ _.u.onPlayerWillDestroy=function(a){this.a&&(this.a.destroy(),this.a=null);this.h&&(this.h.destroy(),this.h=null);this.f&&(a.getSurface().removeElementFromContainer(this.f),this.f=null)};_.u.Xl=function(){return this.a};_.u.Vl=function(){return this.h};_.u.ud=function(){return this.f};_.u.id=function(){return"ima"};_.J("clpp.ima.ImaPlugin",UU);UU.prototype.getAdContainer=UU.prototype.ud;UU.prototype.getAdDisplayContainer=UU.prototype.Vl;UU.prototype.getAdsLoader=UU.prototype.Xl;UU.Id="ima";
25
+ UU.isSdkMissing=VU;WU.prototype.create=function(){return new UU};_.cu(new WU);XU.prototype.name=function(){return BU};XU.prototype.a=function(a,b){return a.namespace()===_.Hd?!1:VU()?(this.Ca.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)};XU.prototype.create=function(a){return new GU(a)};_.nr(new XU);};
25
26
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
26
27
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
27
28
  else{_=this.clpp._;(f.call(g,this));}