@castlabs/prestoplay 6.6.1 → 6.8.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 (59) hide show
  1. package/CHANGELOG.md +36 -1
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +6 -6
  5. package/cjs/cl.cast.js +110 -110
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +418 -419
  8. package/cjs/cl.crypto.js +10 -10
  9. package/cjs/cl.dash.js +72 -72
  10. package/cjs/cl.externs.js +48 -42
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +68 -49
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +31 -31
  15. package/cjs/cl.ima.js +24 -23
  16. package/cjs/cl.mse.js +275 -261
  17. package/cjs/cl.muxdata.js +15 -12
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +14 -14
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.smooth.js +71 -71
  22. package/cjs/cl.thumbnails.js +24 -24
  23. package/cjs/cl.tizen.js +71 -71
  24. package/cjs/cl.ttml.js +27 -27
  25. package/cjs/cl.verimatrix.js +5 -5
  26. package/cjs/cl.vimond.js +13 -13
  27. package/cjs/cl.vr.js +19 -19
  28. package/cjs/cl.vtt.js +14 -14
  29. package/cjs/cl.youbora.js +20 -20
  30. package/cl.adobe.js +3 -3
  31. package/cl.airplay.js +3 -3
  32. package/cl.broadpeak.js +5 -5
  33. package/cl.cast.js +88 -88
  34. package/cl.conviva.js +27 -27
  35. package/cl.core.js +362 -365
  36. package/cl.crypto.js +8 -8
  37. package/cl.dash.js +67 -67
  38. package/cl.externs.js +48 -42
  39. package/cl.freewheel.js +19 -19
  40. package/cl.hls.js +58 -40
  41. package/cl.hlssmpte.js +5 -5
  42. package/cl.htmlcue.js +25 -25
  43. package/cl.ima.js +17 -16
  44. package/cl.mse.js +238 -228
  45. package/cl.muxdata.js +12 -8
  46. package/cl.onboard.js +4 -4
  47. package/cl.persistent.js +10 -10
  48. package/cl.playlist.js +5 -5
  49. package/cl.smooth.js +58 -59
  50. package/cl.thumbnails.js +17 -17
  51. package/cl.tizen.js +57 -57
  52. package/cl.ttml.js +22 -22
  53. package/cl.verimatrix.js +4 -4
  54. package/cl.vimond.js +8 -8
  55. package/cl.vr.js +15 -15
  56. package/cl.vtt.js +12 -12
  57. package/cl.youbora.js +15 -15
  58. package/package.json +1 -1
  59. package/typings.d.ts +147 -19
package/cjs/cl.htmlcue.js CHANGED
@@ -1,35 +1,35 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var YI="CLPP Subtitle Styles",ZI="Unsupported unit",$I="clpp-text-plain",aJ="clpp-text-ttml",bJ="clpp.htmlcue.HtmlTextDisplayer",cJ="initial",dJ=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},eJ=function(){},fJ=function(a){if(!a.input)return null;var b=a.input.match(/^([^<]*)(<[^>]+>?)?/);b=b[1]?b[1]:b[2];a.input=a.input.substr(b.length);return b},hJ=function(a){for(var b=null;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],
3
- function(c){return gJ[c]});return a},jJ=function(a,b){iJ(a,b);Array.from(b.getElementsByTagName("*")).forEach(function(c){iJ(a,c)})},iJ=function(a,b){for(var c in a)null!=a[c]&&(b.style[c]=a[c])},kJ=function(a,b){return 0===a?"0":a+b},lJ=function(a,b){return 1>Math.abs(a-b)||a<b},mJ=function(a,b){return a<b&&1<Math.abs(a-b)},nJ=function(a,b){return a>b&&1<Math.abs(a-b)},oJ=function(a,b){return 1>Math.abs(a-b)||a>b},pJ=function(a,b,c,d,e,f){this.f=a;this.g=b;this.h=c;this.a=d;this.height=e;this.width=
4
- f},qJ=function(a){return new pJ(a.f,a.g,a.h,a.a,a.height,a.width)},rJ=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"))||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 pJ(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-
5
- d-e)},sJ=function(a,b){return b.some(function(c){return mJ(a.f,c.g)&&nJ(a.g,c.f)&&mJ(a.h,c.a)&&nJ(a.a,c.h)})},tJ=function(a,b){return oJ(a.h,b.h)&&lJ(a.a,b.a)&&oJ(a.f,b.f)&&lJ(a.g,b.g)},uJ=function(a,b,c){switch(c){case "+x":return mJ(a.f,b.f);case "-x":return nJ(a.g,b.g);case "+y":return mJ(a.h,b.h);case "-y":return nJ(a.a,b.a);default:throw Error("Unknown axis");}},vJ=function(a,b,c){this.id=a;this.o=b;this.A=c;this.a=this.m();this.h=!1},wJ=function(a,b,c){vJ.call(this,a.id,"clpp-text-cue",{});
6
- this.j=b;this.f=a;this.g=!!this.f.backgroundImage;this.B=c},yJ=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 xJ(a)?b:c},BJ=function(a,b,c){return xJ(a)&&_.K.la(c)?kJ(c,_.de):(zJ(a)||AJ(a))&&_.K.la(b)?kJ(b,"%"):cJ},zJ=function(a){return a.f.writingMode===_.Pe},AJ=function(a){return a.f.writingMode===_.Qe},xJ=function(a){return a.f.writingMode===_.vg},CJ=function(a,b,c){return(zJ(a)||AJ(a))&&_.K.la(c)?kJ(c,_.de):
7
- zJ(a)&&_.K.R(c)?kJ(0,_.de):xJ(a)&&_.K.la(b)?kJ(b,"%"):cJ},DJ=function(a,b){if(typeof a.f.position===_.k&&typeof a.f.size===_.k)switch(b){case _.ud:return a.f.position;case "auto":case _.Dc:return a.f.position-a.f.size/2;case _.vd:return a.f.position-a.f.size}return 0},EJ=function(a){switch(a.f.positionAlign){case _.ud:return _.rd;case "auto":case _.Dc:return _.ug;case _.vd:return _.ke}return a.f.textAlign},FJ=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.rd:case _.rd:return _.ud;
8
- case _.ug:return _.Dc;case _.ke:case _.ke:return _.vd}return a.f.positionAlign},GJ=function(a){switch(a.f.writingMode){case _.vg:return"horizontal-tb";case _.Pe:return _.Pe;case _.Qe:return _.Qe;default:throw Error("Unknown writing mode");}},HJ=function(a,b){this.j=a;this.f=a.a;this.h=void 0===b?!1:b;this.a=rJ(a.a);this.g=[]},IJ=function(a,b){if(a.h)switch(b.writingMode){case _.vg:return["-y"];case _.Pe:return["+x"];case _.Qe:return["-x"]}var c=[];switch(b.writingMode){case _.vg:c=["+y","-y"];break;
9
- case _.Pe:c=["+x","-x"];break;case _.Qe:c=["-x","+x"]}0>b.line&&(c=c.reverse());return c},JJ=function(a){for(a.g=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=rJ(a.j.a)},KJ=function(a,b,c){vJ.call(this,a,b,c);this.g=null;this.j=[]},LJ=function(a,b){JJ(a.g);a.j.unshift(b);for(var c=_.u(a.j),d=c.next();!d.done;d=c.next())a.g.append(d.value)},MJ=function(a,b){KJ.call(this,a.id,"clpp-text-cue-region",b);this.f=a},NJ=function(a,b,c){a=a.f;var d=a.viewportAnchorUnits;if(d===_.Ag)return a.viewportAnchorY/
10
- 100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(ZI);},PJ=function(a){this.f=new _.H("clpp.htmlcue.StyleManager");this.m=[];this.h=a.getSurface().getUniqueCssClass();this.j=[];this.a=OJ(this,this.h);this.g=OJ(this,this.h,!0);this.g.disabled=!0;this.f.debug("Stylesheet CLPP Subtitle Styles has been created.")},QJ=function(a,b){var c=!1;try{a.g.insertRule(b,0);var d=a.g.cssRules[0];d instanceof CSSStyleRule&&(c=d.selectorText.split(",").every(function(e){return 0===
11
- e.trim().indexOf("."+a.h+" ")}))}catch(e){}0<a.g.cssRules.length&&a.g.deleteRule(0);return c},RJ=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,c)},OJ=function(a,b,c){var d=document.createElement(_.xe),e=d.dataset;e.name=YI;
12
- e["for"]=b;c&&(e.name="CLPP Subtitle Styles (sandbox)",e.sandbox=!0);b=document.head;b.appendChild(d);SJ(a,b);a.f.debug("Created HTML style element #CLPP Subtitle Styles.");return d.sheet},SJ=function(a,b){var c=new MutationObserver(function(d){d.forEach(function(e){e.removedNodes.forEach(function(f){f.id===YI&&a.f.error("PRESTOplay HTML style element #CLPP Subtitle Styles has been unexpectedly removed! Some styles will not work!")})})});c.observe(b,{subtree:!1,childList:!0});a.m.push(function(){return c.disconnect()})},
13
- VJ=function(a){_.cq.call(this,a);var b=this;this.M=new _.H(bJ);this.l=a;this.K=TJ(a);this.h=!1;this.f=[];this.B=a.getSurface().getContainer();this.g=new PJ(a);this.a=new KJ(null,"clpp-text-container",{});this.o=new _.zp(a.getSurface(),this.oh.bind(this));this.I=null;this.B?(this.B.appendChild(this.a.a),this.a.init(null)):this.M.warn("No container element! Subtitles will not appear. Please check your player surface configuration or switch to NativeTextDisplayer.");this.D=new _.Si(function(){UJ(b)});
14
- this.w=new Map;this.j=null},TJ=function(a){a=_.K.Ma(a.getConfiguration().htmlcue||{});_.K.R(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.K.R(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},WJ=function(a,b){return a.startTime<=b&&a.endTime>b},UJ=function(a,b){if((b||a.h)&&a.B){var c=a.l.getPosition();if(b||a.I!==c&&a.l.getState()===_.ln){a.I=c;var d=XJ(a,c);(c=b)||(c=a.j,c=!(null===c&&null===d||null!==c&&null!==d&&c.start===d.start&&c.end===d.end));if(c&&(a.j=d,YJ(a),d)){c={color:a.getFontColor()||
15
- void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.hq(a)||void 0};d=a.f.slice(d.start,d.end+1);d=_.u(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 _.Ye:h="clpp-text-vtt";break;case _.He:h=aJ;break;case _.tg:h=$I}h&&!g.classList.contains(h)&&_.In(g,h);g=rJ(f.a.a);if(0===g.width||0===g.height)f.M.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{iJ({fontSize:ZJ(f,e.containerRows)},f.a.a);g=null;h=e.payloadType===_.Ye;var l=e.payloadType===_.He;e.region&&(h||l||e.backgroundImage)&&(f.w.has(e.region.id)?g=f.w.get(e.region.id):(g=new MJ(e.region,{}),f.w.set(e.region.id,g),LJ(f.a,g)));e=new wJ(e,f.K,c);g?LJ(g,e):LJ(f.a,e)}}}}}},XJ=function(a,b){var c=dJ(a.f,function(e){return WJ(e,b)?0:b!==e.startTime?b-e.startTime:b-e.endTime});if(-1===c)return null;for(var d=c;0<=d-1&&WJ(a.f[d-1],b);)d--;for(;c+1<a.f.length&&WJ(a.f[c+1],b);)c++;return{start:d,
17
- end:c}},$J=function(a){YJ(a);a.I=null;a.j=null;a.f=[]},YJ=function(a){a.w.clear();if(a.a){var b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(aJ);b.classList.remove($I);a=a.a;JJ(a.g);a.j=[]}},ZJ=function(a,b){var c=rJ(a.a.a).height;if(null!==a.H)return a.getFontSize();if(null!==a.A){var d=a.getFontSizePercent();return Math.round(c*d)+_.de}if(typeof b===_.k&&0<b)return Math.round(c/b)+_.de;d=a.getFontSizePercent();return Math.round(c*d)+_.de},aK=function(){},bK=function(){};
18
- eJ.prototype.parse=function(a){a={input:a};for(var b=_.Kn(_.Zc),c=[],d=b,e;null!==(e=fJ(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=cK[f];h?(h=_.Kn(h),(f=dK[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||eK[g.localName]&&eK[g.localName]!==d.localName||(e[2]&&(g.className=e[2].substr(1).replace(/\./g," ")),c.push(e[1]),d.appendChild(g),
19
- d=g)}}else d.appendChild(document.createTextNode(hJ(e)));return b};var cK={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},dK={v:"voice",lang:"lang"},eK={rt:"ruby"},gJ={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f","\x26nbsp;":"\u00a0"};vJ.prototype.init=function(){this.h=!0};vJ.prototype.w=function(){return!1};_.v(wJ,vJ);wJ.prototype.w=function(){return!this.g&&!(this.f.region&&this.f.region.displayAlign)};
20
- wJ.prototype.init=function(a){vJ.prototype.init.call(this,a);if(this.g)_.In(this.a,"clpp-text-cue-image"),this.a.style.backgroundImage='url("'+this.f.backgroundImage+'")',this.j.stretchSmpteImage&&(this.a.style.backgroundSize="contain");else if(a){var b=this.f;if(b.payloadType===_.He){var c=_.Kn(_.Zc);c.innerHTML=b.payload;b=c}else b.payloadType===_.Ye?b=(new eJ).parse(b.payload):(c=_.Kn(_.Zc),c.textContent=b.payload,b=c);_.In(b,this.o);this.id&&(b.id=this.id);c=_.u(this.f.cssClassList);for(var d=
21
- c.next();!d.done;d=c.next())_.In(b,d.value);iJ({writingMode:GJ(this)},b);this.a.appendChild(b);_.In(this.a,"clpp-text-wrapper");c=_.u(this.f.cssClassList);for(d=c.next();!d.done;d=c.next())_.In(this.a,"clpp-text-wrapper__"+d.value);_.K.R(this.f.line)&&(this.f.lineInterpretation=_.wg,this.f.line=xJ(this)?-1:0);c=GJ(this);iJ({writingMode:c,webkitWritingMode:c,direction:cJ,textAlign:EJ(this)},this.a);if(!this.f.region||!this.f.region.displayAlign){c=DJ(this,FJ(this));d=CJ(this,c,null);var e=BJ(this,
22
- c,null),f=AJ(this)&&_.K.R(null)?kJ(0,_.de):cJ;iJ({position:"absolute",left:d,right:f,top:e,width:xJ(this)?kJ(this.f.size,"%"):cJ,height:zJ(this)||AJ(this)?kJ(this.f.size,"%"):cJ},this.a);d=this.f;a=xJ(this)?a.height:a.width;e=yJ(this);if(d.lineInterpretation===_.wg)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 _.Dc:g-=f/2;break;case _.hd:g-=f}f=Math.round(g/100*a)}AJ(this)&&(f=a-f-e);a=f;d=CJ(this,c,a);e=AJ(this)&&_.K.R(a)?
23
- kJ(0,_.de):cJ;iJ({left:d,right:e,top:BJ(this,c,a)},this.a)}jJ(this.B,b)}};wJ.prototype.m=function(){return _.Kn(_.Zc)};HJ.prototype.append=function(a){var b=a.a;b.style.visibility=_.nd;this.f.appendChild(b);a.h||a.init(this.a);if(a.w()){a:{var c=rJ(a.a);var d=IJ(this,a.f),e=yJ(a),f=qJ(c),g=null,h=0;d=_.u(d);for(var l=d.next();!l.done;l=d.next()){for(l=l.value;uJ(c,this.a,l)||tJ(c,this.a)&&sJ(c,this.g);){var m=c,n=e;switch(l){case "+x":m.f+=n;m.g+=n;break;case "-x":m.f-=n;m.g-=n;break;case "+y":m.h+=n;m.a+=n;break;case "-y":m.h-=n,m.a-=n}}if(this.h||tJ(c,this.a))break a;l=this.a;l=Math.max(0,Math.min(c.g,l.g)-Math.max(c.f,
24
- l.f))*Math.max(0,Math.min(c.a,l.a)-Math.max(c.h,l.h))/(c.height*c.width);l>h&&(g=qJ(c),h=l);c=qJ(f)}c=g||f}iJ({top:kJ(c.h-this.a.h,_.de),bottom:kJ(this.a.a-c.a,_.de),left:kJ(c.f-this.a.f,_.de),right:kJ(this.a.g-c.g,_.de),height:kJ(c.height,_.de),width:kJ(c.width,_.de)},a.a)}b.style.visibility="visible";this.g.push(rJ(a.a))};_.v(KJ,vJ);KJ.prototype.init=function(){this.g=new HJ(this);this.h=!0};KJ.prototype.m=function(){var a=_.Kn(_.Zc);_.In(a,this.o);this.id&&(a.id=this.id);return a};_.v(MJ,KJ);
25
- MJ.prototype.init=function(a){a:{var b=this.f;switch(b.widthUnits){case 0:b=b.width;break a;case _.Ag:b=b.width/100*a.width;break a;default:throw Error(ZI);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.Ag)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(ZI);d=a.height;var e=NJ(this,d,a.height);iJ(this.A,this.a);iJ({left:kJ(c,_.de),top:kJ(e,_.de),width:kJ(b,_.de),height:kJ(d,_.de)},this.a);this.f.writingMode&&iJ({display:"flex",
26
- "flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&iJ({"justify-content":this.f.displayAlign},this.a);b=_.u(this.f.cssClassList);for(c=b.next();!c.done;c=b.next())_.In(this.a,c.value);a:switch(b=this.f,b.heightUnits){case 0:b=b.height;break a;case _.Ag:b=b.height/100*a.height;break a;case 2:b=b.height;d=new wJ(new _.zg(0,1,"Lorem ipsum",_.tg),{},{});c=d.a;this.a.appendChild(c);d.init(rJ(this.a));d=c.getBoundingClientRect().height;this.a.removeChild(c);b*=d;break a;default:throw Error(ZI);
27
- }a=NJ(this,b,a.height);iJ({top:kJ(a,_.de),height:kJ(b,_.de)},this.a);this.g=new HJ(this,!0);this.h=!0};MJ.prototype.getId=function(){return this.f.id};PJ.prototype.appendRule=function(a){if(null!=this.a&&!this.j.some(function(c){return c===a})){var b=RJ(this,a);if(QJ(this,b)){try{this.a.insertRule(b,this.a.cssRules.length),this.f.debug("Added CSS rule "+b)}catch(c){this.f.error("An error occurred when adding a CSS rule: "+b)}this.j.push(a)}else this.f.warn("Stylesheet CLPP Subtitle Styles ignoring the CSS rule because it's not safe: "+b)}};
28
- PJ.prototype.destroy=function(){var a=this;return _.A(function(b){if(null==a.a)return b["return"]();a.m.forEach(function(c){return c()});a.m=[];if(null!=a.a){for(;0<a.a.cssRules.length;)a.a.deleteRule(0);a.j=[]}document.head.removeChild(a.a.ownerNode);document.head.removeChild(a.g.ownerNode);a.a=null;a.g=null;a.f.debug("Stylesheet CLPP Subtitle Styles has been destroyed.");_.y(b)})};_.v(VJ,_.cq);_.t=VJ.prototype;
29
- _.t.append=function(a,b){if(null!=this.g&&0!==a.length){for(var c=_.u(b),d=c.next();!d.done;d=c.next())this.g.appendRule(d.value);a.sort(function(f,g){return f.startTime!==g.startTime?f.startTime-g.startTime:f.endTime-g.endTime});c=this.f.findIndex(function(f){return f.startTime>=a[0].startTime});0===c?this.f=[]:0<c&&this.f.splice(0,c);c={};d=_.u(a);for(var e=d.next();!e.done;c={od:c.od},e=d.next())c.od=e.value,this.f.some(function(f){return function(g){var h=f.od;return g.payload!==h.payload?!1:
30
- g.startTime!==h.startTime?!1:g.endTime!==h.endTime?!1:!0}}(c))||this.f.push(c.od);this.j=null;UJ(this,!1)}};_.t.ob=function(){null==this.g||UJ(this,!0)};_.t.destroy=function(){var a=this;return _.A(function(b){if(1==b.a){if(null==a.g)return b["return"]();$J(a);a.D.stop();return _.x(b,a.g.destroy(),2)}a.g=null;a.B.removeChild(a.a.a);a.a=null;a.o.stop();a.o=null;a.h=!1;_.y(b)})};
31
- _.t.remove=function(a,b){if(null==this.g)return!1;this.f=this.f.filter(function(c){return c.startTime<a||c.endTime>=b});this.j=null;UJ(this,!0);return!0};_.t.isTextVisible=function(){return this.h};_.t.setTextVisibility=function(a){null!=this.g&&this.h!==a&&((this.h=a)?(this.D.ab(.25),this.K.enableResizeObserver&&this.o.start(),UJ(this,!0)):(this.D.stop(),this.o.stop(),$J(this)))};_.t.oh=function(){UJ(this,!0)};_.D(bJ,VJ);VJ.prototype.setTextVisibility=VJ.prototype.setTextVisibility;
32
- VJ.prototype.isTextVisible=VJ.prototype.isTextVisible;VJ.prototype.remove=VJ.prototype.remove;VJ.prototype.destroy=VJ.prototype.destroy;VJ.prototype.append=VJ.prototype.append;aK.prototype.ca=function(a){return!!a.enableHtmlCue&&!_.aj()};aK.prototype.create=function(a){return new VJ(a)};_.v(bK,_.Jo);bK.prototype.Ia=function(){_.Km("html",new aK)};bK.prototype.Ca=function(){};bK.prototype.id=function(){return _.ze};_.D("clpp.htmlcue.HtmlCueComponent",bK);};
2
+ var f=function(window){var RJ="CLPP Subtitle Styles",SJ="Unsupported unit",TJ="clpp-text-plain",UJ="clpp-text-ttml",VJ="clpp.htmlcue.HtmlTextDisplayer",WJ="initial",XJ=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},YJ=function(){},ZJ=function(a){if(!a.input)return null;var b=a.input.match(/^([^<]*)(<[^>]+>?)?/);b=b[1]?b[1]:b[2];a.input=a.input.substr(b.length);return b},aK=function(a){for(var b=null;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],
3
+ function(c){return $J[c]});return a},cK=function(a,b){bK(a,b);Array.from(b.getElementsByTagName("*")).forEach(function(c){bK(a,c)})},bK=function(a,b){for(var c in a)null!=a[c]&&(b.style[c]=a[c])},dK=function(a,b){return 0===a?"0":a+b},eK=function(a,b){return 1>Math.abs(a-b)||a<b},fK=function(a,b){return a<b&&1<Math.abs(a-b)},gK=function(a,b){return a>b&&1<Math.abs(a-b)},hK=function(a,b){return 1>Math.abs(a-b)||a>b},iK=function(a,b,c,d,e,f){this.f=a;this.g=b;this.j=c;this.a=d;this.height=e;this.width=
4
+ f},jK=function(a){return new iK(a.f,a.g,a.j,a.a,a.height,a.width)},kK=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"))||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 iK(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-
5
+ d-e)},lK=function(a,b){return b.some(function(c){return fK(a.f,c.g)&&gK(a.g,c.f)&&fK(a.j,c.a)&&gK(a.a,c.j)})},mK=function(a,b){return hK(a.j,b.j)&&eK(a.a,b.a)&&hK(a.f,b.f)&&eK(a.g,b.g)},nK=function(a,b,c){switch(c){case "+x":return fK(a.f,b.f);case "-x":return gK(a.g,b.g);case "+y":return fK(a.j,b.j);case "-y":return gK(a.a,b.a);default:throw Error("Unknown axis");}},oK=function(a,b,c){this.id=a;this.w=b;this.B=c;this.a=this.o();this.j=!1},pK=function(a,b,c){oK.call(this,a.id,"clpp-text-cue",{});
6
+ this.m=b;this.f=a;this.g=!!this.f.backgroundImage;this.D=c},rK=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 qK(a)?b:c},uK=function(a,b,c){return qK(a)&&_.K.la(c)?dK(c,_.ce):(sK(a)||tK(a))&&_.K.la(b)?dK(b,"%"):WJ},sK=function(a){return a.f.writingMode===_.Oe},tK=function(a){return a.f.writingMode===_.Pe},qK=function(a){return a.f.writingMode===_.ug},vK=function(a,b,c){return(sK(a)||tK(a))&&_.K.la(c)?dK(c,_.ce):
7
+ sK(a)&&_.K.R(c)?dK(0,_.ce):qK(a)&&_.K.la(b)?dK(b,"%"):WJ},wK=function(a,b){if(typeof a.f.position===_.k&&typeof a.f.size===_.k)switch(b){case _.td:return a.f.position;case "auto":case _.Dc:return a.f.position-a.f.size/2;case _.ud:return a.f.position-a.f.size}return 0},xK=function(a){switch(a.f.positionAlign){case _.td:return _.qd;case "auto":case _.Dc:return _.tg;case _.ud:return _.je}return a.f.textAlign},yK=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.qd:case _.qd:return _.td;
8
+ case _.tg:return _.Dc;case _.je:case _.je:return _.ud}return a.f.positionAlign},zK=function(a){switch(a.f.writingMode){case _.ug:return"horizontal-tb";case _.Oe:return _.Oe;case _.Pe:return _.Pe;default:throw Error("Unknown writing mode");}},AK=function(a,b){this.m=a;this.f=a.a;this.j=void 0===b?!1:b;this.a=kK(a.a);this.g=[]},BK=function(a,b){if(a.j)switch(b.writingMode){case _.ug:return["-y"];case _.Oe:return["+x"];case _.Pe:return["-x"]}var c=[];switch(b.writingMode){case _.ug:c=["+y","-y"];break;
9
+ case _.Oe:c=["+x","-x"];break;case _.Pe:c=["-x","+x"]}0>b.line&&(c=c.reverse());return c},CK=function(a){for(a.g=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=kK(a.m.a)},DK=function(a,b,c){oK.call(this,a,b,c);this.g=null;this.m=[]},EK=function(a,b){CK(a.g);a.m.unshift(b);for(var c=_.u(a.m),d=c.next();!d.done;d=c.next())a.g.append(d.value)},FK=function(a,b){DK.call(this,a.id,"clpp-text-cue-region",b);this.f=a},GK=function(a,b,c){a=a.f;var d=a.viewportAnchorUnits;if(d===_.zg)return a.viewportAnchorY/
10
+ 100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(SJ);},IK=function(a){this.h=new _.H("clpp.htmlcue.StyleManager");this.m=[];this.g=a.getSurface().getUniqueCssClass();this.j=[];this.a=HK(this,this.g);this.f=HK(this,this.g,!0);this.f.disabled=!0;this.h.debug("Stylesheet CLPP Subtitle Styles has been created.")},JK=function(a,b){var c=!1;try{a.f.insertRule(b,0);var d=a.f.cssRules[0];d instanceof CSSStyleRule&&(c=d.selectorText.split(",").every(function(e){return 0===
11
+ e.trim().indexOf("."+a.g+" ")}))}catch(e){}0<a.f.cssRules.length&&a.f.deleteRule(0);return c},KK=function(a,b){var c="."+a.g+" .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,c)},HK=function(a,b,c){var d=document.createElement(_.we),e=d.dataset;e.name=RJ;
12
+ e["for"]=b;c&&(e.name="CLPP Subtitle Styles (sandbox)",e.sandbox=!0);b=document.head;b.appendChild(d);LK(a,b);a.h.debug("Created HTML style element #CLPP Subtitle Styles.");return d.sheet},LK=function(a,b){var c=new MutationObserver(function(d){d.forEach(function(e){e.removedNodes.forEach(function(f){f.id===RJ&&a.h.error("PRESTOplay HTML style element #CLPP Subtitle Styles has been unexpectedly removed! Some styles will not work!")})})});c.observe(b,{subtree:!1,childList:!0});a.m.push(function(){return c.disconnect()})},
13
+ OK=function(a){_.Tp.call(this,a);var b=this;this.h=new _.H(VJ);this.l=a;this.L=MK(a);this.j=!1;this.f=[];this.D=a.getSurface().getContainer();this.g=new IK(a);this.a=new DK(null,"clpp-text-container",{});this.w=new _.pp(a.getSurface(),this.$h.bind(this));this.J=null;this.D?(this.D.appendChild(this.a.a),this.a.init(null)):this.h.warn("No container element! Subtitles will not appear. Please check your player surface configuration or switch to NativeTextDisplayer.");this.F=new _.$i(function(){NK(b)});
14
+ this.A=new Map;this.m=null},MK=function(a){a=_.K.Qa(a.getConfiguration().htmlcue||{});_.K.R(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.K.R(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},PK=function(a,b){return a.startTime<=b&&a.endTime>b},NK=function(a,b){if((b||a.j)&&a.D){var c=a.l.getPosition();if(b||a.J!==c&&a.l.getState()===_.an){a.J=c;var d=QK(a,c);(c=b)||(c=a.m,c=!(null===c&&null===d||null!==c&&null!==d&&c.start===d.start&&c.end===d.end));if(c&&(a.m=d,RK(a),d)){c={color:a.getFontColor()||
15
+ void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.Yp(a)||void 0};d=a.f.slice(d.start,d.end+1);d=_.u(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 _.Xe:h="clpp-text-vtt";break;case _.Ge:h=UJ;break;case _.sg:h=TJ}h&&!g.classList.contains(h)&&_.yn(g,h);g=kK(f.a.a);if(0===g.width||0===g.height)f.h.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{bK({fontSize:SK(f,e.containerRows)},f.a.a);g=null;h=e.payloadType===_.Xe;var l=e.payloadType===_.Ge;e.region&&(h||l||e.backgroundImage)&&(f.A.has(e.region.id)?g=f.A.get(e.region.id):(g=new FK(e.region,{}),f.A.set(e.region.id,g),EK(f.a,g)));e=new pK(e,f.L,c);g?EK(g,e):EK(f.a,e)}}}}}},QK=function(a,b){var c=XJ(a.f,function(e){return PK(e,b)?0:b!==e.startTime?b-e.startTime:b-e.endTime});if(-1===c)return null;for(var d=c;0<=d-1&&PK(a.f[d-1],b);)d--;for(;c+1<a.f.length&&PK(a.f[c+1],b);)c++;return{start:d,
17
+ end:c}},TK=function(a){RK(a);a.J=null;a.m=null;a.f=[]},RK=function(a){a.A.clear();if(a.a){var b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(UJ);b.classList.remove(TJ);a=a.a;CK(a.g);a.m=[]}},SK=function(a,b){var c=kK(a.a.a).height;if(null!==a.I)return a.getFontSize();if(null!==a.B){var d=a.getFontSizePercent();return Math.round(c*d)+_.ce}if(typeof b===_.k&&0<b)return Math.round(c/b)+_.ce;d=a.getFontSizePercent();return Math.round(c*d)+_.ce},UK=function(){},VK=function(){};
18
+ YJ.prototype.parse=function(a){a={input:a};for(var b=_.An(_.Zc),c=[],d=b,e;null!==(e=ZJ(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=WK[f];h?(h=_.An(h),(f=XK[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||YK[g.localName]&&YK[g.localName]!==d.localName||(e[2]&&(g.className=e[2].substr(1).replace(/\./g," ")),c.push(e[1]),d.appendChild(g),
19
+ d=g)}}else d.appendChild(document.createTextNode(aK(e)));return b};var WK={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},XK={v:"voice",lang:"lang"},YK={rt:"ruby"},$J={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f","\x26nbsp;":"\u00a0"};oK.prototype.init=function(){this.j=!0};oK.prototype.A=function(){return!1};_.w(pK,oK);pK.prototype.A=function(){return!this.g&&!(this.f.region&&this.f.region.displayAlign)};
20
+ pK.prototype.init=function(a){oK.prototype.init.call(this,a);if(this.g)_.yn(this.a,"clpp-text-cue-image"),this.a.style.backgroundImage='url("'+this.f.backgroundImage+'")',this.m.stretchSmpteImage&&(this.a.style.backgroundSize="contain");else if(a){var b=this.f;if(b.payloadType===_.Ge){var c=_.An(_.Zc);c.innerHTML=b.payload;b=c}else b.payloadType===_.Xe?b=(new YJ).parse(b.payload):(c=_.An(_.Zc),c.textContent=b.payload,b=c);_.yn(b,this.w);this.id&&(b.id=this.id);c=_.u(this.f.cssClassList);for(var d=
21
+ c.next();!d.done;d=c.next())_.yn(b,d.value);bK({writingMode:zK(this)},b);this.a.appendChild(b);_.yn(this.a,"clpp-text-wrapper");c=_.u(this.f.cssClassList);for(d=c.next();!d.done;d=c.next())_.yn(this.a,"clpp-text-wrapper__"+d.value);_.K.R(this.f.line)&&(this.f.lineInterpretation=_.vg,this.f.line=qK(this)?-1:0);c=zK(this);bK({writingMode:c,webkitWritingMode:c,direction:WJ,textAlign:xK(this)},this.a);if(!this.f.region||!this.f.region.displayAlign){c=wK(this,yK(this));d=vK(this,c,null);var e=uK(this,
22
+ c,null),f=tK(this)&&_.K.R(null)?dK(0,_.ce):WJ;bK({position:"absolute",left:d,right:f,top:e,width:qK(this)?dK(this.f.size,"%"):WJ,height:sK(this)||tK(this)?dK(this.f.size,"%"):WJ},this.a);d=this.f;a=qK(this)?a.height:a.width;e=rK(this);if(d.lineInterpretation===_.vg)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 _.Dc:g-=f/2;break;case _.gd:g-=f}f=Math.round(g/100*a)}tK(this)&&(f=a-f-e);a=f;d=vK(this,c,a);e=tK(this)&&_.K.R(a)?
23
+ dK(0,_.ce):WJ;bK({left:d,right:e,top:uK(this,c,a)},this.a)}cK(this.D,b)}};pK.prototype.o=function(){return _.An(_.Zc)};AK.prototype.append=function(a){var b=a.a;b.style.visibility=_.md;this.f.appendChild(b);a.j||a.init(this.a);if(a.A()){a:{var c=kK(a.a);var d=BK(this,a.f),e=rK(a),f=jK(c),g=null,h=0;d=_.u(d);for(var l=d.next();!l.done;l=d.next()){for(l=l.value;nK(c,this.a,l)||mK(c,this.a)&&lK(c,this.g);){var m=c,n=e;switch(l){case "+x":m.f+=n;m.g+=n;break;case "-x":m.f-=n;m.g-=n;break;case "+y":m.j+=n;m.a+=n;break;case "-y":m.j-=n,m.a-=n}}if(this.j||mK(c,this.a))break a;l=this.a;l=Math.max(0,Math.min(c.g,l.g)-Math.max(c.f,
24
+ l.f))*Math.max(0,Math.min(c.a,l.a)-Math.max(c.j,l.j))/(c.height*c.width);l>h&&(g=jK(c),h=l);c=jK(f)}c=g||f}bK({top:dK(c.j-this.a.j,_.ce),bottom:dK(this.a.a-c.a,_.ce),left:dK(c.f-this.a.f,_.ce),right:dK(this.a.g-c.g,_.ce),height:dK(c.height,_.ce),width:dK(c.width,_.ce)},a.a)}b.style.visibility="visible";this.g.push(kK(a.a))};_.w(DK,oK);DK.prototype.init=function(){this.g=new AK(this);this.j=!0};DK.prototype.o=function(){var a=_.An(_.Zc);_.yn(a,this.w);this.id&&(a.id=this.id);return a};_.w(FK,DK);
25
+ FK.prototype.init=function(a){a:{var b=this.f;switch(b.widthUnits){case 0:b=b.width;break a;case _.zg:b=b.width/100*a.width;break a;default:throw Error(SJ);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.zg)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(SJ);d=a.height;var e=GK(this,d,a.height);bK(this.B,this.a);bK({left:dK(c,_.ce),top:dK(e,_.ce),width:dK(b,_.ce),height:dK(d,_.ce)},this.a);this.f.writingMode&&bK({display:"flex",
26
+ "flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&bK({"justify-content":this.f.displayAlign},this.a);b=_.u(this.f.cssClassList);for(c=b.next();!c.done;c=b.next())_.yn(this.a,c.value);a:switch(b=this.f,b.heightUnits){case 0:b=b.height;break a;case _.zg:b=b.height/100*a.height;break a;case 2:b=b.height;d=new pK(new _.yg(0,1,"Lorem ipsum",_.sg),{},{});c=d.a;this.a.appendChild(c);d.init(kK(this.a));d=c.getBoundingClientRect().height;this.a.removeChild(c);b*=d;break a;default:throw Error(SJ);
27
+ }a=GK(this,b,a.height);bK({top:dK(a,_.ce),height:dK(b,_.ce)},this.a);this.g=new AK(this,!0);this.j=!0};FK.prototype.getId=function(){return this.f.id};IK.prototype.appendRule=function(a){if(null!=this.a&&!this.j.some(function(c){return c===a})){var b=KK(this,a);if(JK(this,b)){try{this.a.insertRule(b,this.a.cssRules.length),this.h.debug("Added CSS rule "+b)}catch(c){this.h.error("An error occurred when adding a CSS rule: "+b)}this.j.push(a)}else this.h.warn("Stylesheet CLPP Subtitle Styles ignoring the CSS rule because it's not safe: "+b)}};
28
+ IK.prototype.destroy=function(){var a=this;return _.B(function(b){if(null==a.a)return b["return"]();a.m.forEach(function(c){return c()});a.m=[];if(null!=a.a){for(;0<a.a.cssRules.length;)a.a.deleteRule(0);a.j=[]}document.head.removeChild(a.a.ownerNode);document.head.removeChild(a.f.ownerNode);a.a=null;a.f=null;a.h.debug("Stylesheet CLPP Subtitle Styles has been destroyed.");_.z(b)})};_.w(OK,_.Tp);_.t=OK.prototype;
29
+ _.t.append=function(a,b){if(null!=this.g&&0!==a.length){for(var c=_.u(b),d=c.next();!d.done;d=c.next())this.g.appendRule(d.value);a.sort(function(f,g){return f.startTime!==g.startTime?f.startTime-g.startTime:f.endTime-g.endTime});c=this.f.findIndex(function(f){return f.startTime>=a[0].startTime});0===c?this.f=[]:0<c&&this.f.splice(0,c);c={};d=_.u(a);for(var e=d.next();!e.done;c={xd:c.xd},e=d.next())c.xd=e.value,this.f.some(function(f){return function(g){var h=f.xd;return g.payload!==h.payload?!1:
30
+ g.startTime!==h.startTime?!1:g.endTime!==h.endTime?!1:!0}}(c))||this.f.push(c.xd);this.m=null;NK(this,!1)}};_.t.qb=function(){null==this.g||NK(this,!0)};_.t.destroy=function(){var a=this;return _.B(function(b){if(1==b.a){if(null==a.g)return b["return"]();TK(a);a.F.stop();return _.x(b,a.g.destroy(),2)}a.g=null;a.D.removeChild(a.a.a);a.a=null;a.w.stop();a.w=null;a.j=!1;_.z(b)})};
31
+ _.t.remove=function(a,b){if(null==this.g)return!1;this.f=this.f.filter(function(c){return c.startTime<a||c.endTime>=b});this.m=null;NK(this,!0);return!0};_.t.isTextVisible=function(){return this.j};_.t.setTextVisibility=function(a){null!=this.g&&this.j!==a&&((this.j=a)?(this.F.cb(.25),this.L.enableResizeObserver&&this.w.start(),NK(this,!0)):(this.F.stop(),this.w.stop(),TK(this)))};_.t.$h=function(){NK(this,!0)};_.C(VJ,OK);OK.prototype.setTextVisibility=OK.prototype.setTextVisibility;
32
+ OK.prototype.isTextVisible=OK.prototype.isTextVisible;OK.prototype.remove=OK.prototype.remove;OK.prototype.destroy=OK.prototype.destroy;OK.prototype.append=OK.prototype.append;UK.prototype.aa=function(a){return!!a.enableHtmlCue&&!_.ij()};UK.prototype.create=function(a){return new OK(a)};_.w(VK,_.zo);VK.prototype.Ma=function(){_.vm("html",new UK)};VK.prototype.Fa=function(){};VK.prototype.id=function(){return _.ye};_.C("clpp.htmlcue.HtmlCueComponent",VK);};
33
33
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
34
34
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
35
35
  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 GI="clpp.ima.AdsManagerFactory",HI=function(a,b,c){this.a=a;this.f=a.getAdPodInfo();this.h=b;this.g=c},II=function(){},JI=function(a){this.a=a},KI=function(a){this.l=a;this.j=a.getSurface().getMedia();a=this.l.getConfiguration();this.K=_.K.Ma(a.ima||{});this.m=this.l.$b("ima").Ec();this.J=this.l.$b("ima").g;this.o=this.l.$b("ima").a;this.H=new _.Bp;this.P=new _.H("clpp.ima");this.h=this.a=null;this.f=new _.Sh;this.F=!1;this.w=new _.eg;this.S=new II;this.A=null;this.I=this.D=this.M=this.B=!1;this.g=
3
- null;a=this.w;var b=google.ima.AdErrorEvent.Type.AD_ERROR;a.one(this.o,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.Oi.bind(this));a.on(this.o,b,this.Ni.bind(this));a.one(this.j,_.id,this.Vi.bind(this))},LI=function(a){var b=a.a,c=a.w,d=google.ima.AdEvent.Type;c.on(b,d.LOADED,a.sh.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.Wi.bind(a));c.on(b,d.STARTED,a.uh.bind(a));c.on(b,d.LOG,a.Hi.bind(a));c.on(b,d.AD_PROGRESS,a.Li.bind(a));c.on(b,d.AD_BUFFERING,a.Ei.bind(a));c.on(b,d.FIRST_QUARTILE,
4
- a.qh.bind(a));c.on(b,d.MIDPOINT,a.Ii.bind(a));c.on(b,d.THIRD_QUARTILE,a.vh.bind(a));c.on(b,d.PAUSED,a.Ki.bind(a));c.on(b,d.RESUMED,a.Mi.bind(a));c.on(b,d.CLICK,a.ph.bind(a));c.on(b,d.SKIPPED,a.th.bind(a));c.on(b,d.IMPRESSION,a.rh.bind(a));c.on(b,d.COMPLETE,a.Fi.bind(a));c.on(b,d.CONTENT_RESUME_REQUESTED,a.Xi.bind(a));c.on(b,d.ALL_ADS_COMPLETED,a.Qi.bind(a))},MI=function(a){a=a.K;var b=new google.ima.AdsRenderingSettings;b.restoreCustomPlaybackStateOnAdBreakComplete=!1;typeof a.bitrate===_.k&&(b.bitrate=
5
- a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.uc?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===_.uc&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},OI=function(a){a.A=null;NI(a,_.Ub);a.m&&a.l.getSurface().hide(a.m)},PI=
6
- function(a){_.Jn(a.j,{visibility:"visible"})},NI=function(a,b,c){c=c&&c.getAd();var d=null;c&&(d={ad:new HI(c,a.B,a.M)});a.l.trigger(new _.J(b,d))},QI=function(a,b){var c=b?a.S.create(b.getErrorCode()):null;a.l.onError(new _.L(1,9,10003,{errorType:c},b))},SI=function(a){var b,c;return _.A(function(d){if(1==d.a)return a.J.initialize(),b=!!a.l.getConfiguration().muted,_.x(d,a.H.canPlay(b),2);c=d.f;if(!c)return NI(a,_.sc),a.P.warn(_.ka),d["return"]();RI(a);_.y(d)})},TI=function(a,b){return _.A(function(c){if(1==
7
- c.a)return a.J.initialize(),_.x(c,b.play(),2);RI(a);_.y(c)})},RI=function(a){a.a.init(a.j.offsetWidth,a.j.offsetHeight,google.ima.ViewMode.NORMAL);a.a.start();a.F=!0},UI=function(){this.a=this.g=this.f=null},VI=function(){return!window.google||!google.ima||!google.ima.AdsLoader},WI=function(){},XI=function(){this.a=new _.H(GI)};_.t=HI.prototype;_.t.rb=function(){return"Google IMA SDK"};_.t.sb=function(){return google.ima.VERSION};_.t.xb=function(){return 0};_.t.getId=function(){return this.a.getAdId()};
8
- _.t.getCreativeId=function(){return this.a.getCreativeId()};_.t.getApiFramework=function(){return this.a.getApiFramework()};_.t.getAdSystem=function(){return this.a.getAdSystem()};_.t.getAdvertiserName=function(){return this.a.getAdvertiserName()};_.t.getTitle=function(){return this.a.getTitle()};_.t.getDuration=function(){return this.a.getDuration()};_.t.getSkipTimeOffset=function(){return this.a.getSkipTimeOffset()};_.t.dc=function(){return this.f?this.f.getIsBumper():!1};
9
- _.t.Jb=function(){var a=null,b=this.a,c=Object.keys(b).find(function(d){return typeof b[d]===_.Ld&&typeof b[d].clickThroughUrl===_.ve});c&&(a=b[c].clickThroughUrl);return a};_.t.getMediaUrl=function(){return this.a.getMediaUrl()};_.t.ub=function(){return this.a.getVastMediaWidth()};_.t.tb=function(){return this.a.getVastMediaHeight()};_.t.gb=function(){return this.a.getVastMediaBitrate()};_.t.Ua=function(){return this.g?2:this.h?1:0};_.t.getPodIndex=function(){return this.f?this.f.getPodIndex():0};
10
- _.t.Kb=function(){return this.f?this.f.getTimeOffset():0};_.t.Lb=function(){return this.f?this.f.getAdPosition():1};_.t.wb=function(){return this.f?this.f.getTotalAds():1};_.t.getWrapperAdIds=function(){return this.a.getWrapperAdIds()};_.t.getWrapperAdSystems=function(){return this.a.getWrapperAdSystems()};_.t.getWrapperCreativeIds=function(){return this.a.getWrapperCreativeIds()};HI.prototype.getWrapperCreativeIds=HI.prototype.getWrapperCreativeIds;HI.prototype.getWrapperAdSystems=HI.prototype.getWrapperAdSystems;
11
- HI.prototype.getWrapperAdIds=HI.prototype.getWrapperAdIds;HI.prototype.getSequenceLength=HI.prototype.wb;HI.prototype.getPositionInSequence=HI.prototype.Lb;HI.prototype.getPodTimeOffset=HI.prototype.Kb;HI.prototype.getPodIndex=HI.prototype.getPodIndex;HI.prototype.getPodType=HI.prototype.Ua;HI.prototype.getMediaBitrate=HI.prototype.gb;HI.prototype.getMediaHeight=HI.prototype.tb;HI.prototype.getMediaWidth=HI.prototype.ub;HI.prototype.getMediaUrl=HI.prototype.getMediaUrl;
12
- HI.prototype.getClickThroughUrl=HI.prototype.Jb;HI.prototype.isBumper=HI.prototype.dc;HI.prototype.getSkipTimeOffset=HI.prototype.getSkipTimeOffset;HI.prototype.getDuration=HI.prototype.getDuration;HI.prototype.getTitle=HI.prototype.getTitle;HI.prototype.getAdvertiserName=HI.prototype.getAdvertiserName;HI.prototype.getAdSystem=HI.prototype.getAdSystem;HI.prototype.getApiFramework=HI.prototype.getApiFramework;HI.prototype.getCreativeId=HI.prototype.getCreativeId;HI.prototype.getId=HI.prototype.getId;
13
- HI.prototype.getTechnology=HI.prototype.xb;HI.prototype.getAdManagerVersion=HI.prototype.sb;HI.prototype.getAdManagerName=HI.prototype.rb;II.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}};JI.prototype.getCuePoints=function(){return this.a};JI.prototype.Mb=function(){return 0<=this.a.indexOf(0)||0===this.a.length};JI.prototype.hb=function(){return 0<=this.a.indexOf(-1)};JI.prototype.hasPostroll=JI.prototype.hb;JI.prototype.hasPreroll=JI.prototype.Mb;JI.prototype.getCuePoints=JI.prototype.getCuePoints;_.t=KI.prototype;
14
- _.t.Oi=function(a){var b=this;this.a=a.getAdsManager(this.j,MI(this));this.a.isCustomPlaybackUsed()?(this.P.warn("IMA plugin does not work correctly right now on platforms with single video element. Disposing."),this.l.onError(new _.L(1,9,10002)),this.dispose()):(this.h=new _.zp(this.l.getSurface(),function(c,d,e){b.a.resize(c,d,e?google.ima.ViewMode.FULLSCREEN:google.ima.ViewMode.NORMAL)}),a=this.a.getCuePoints(),this.g=new JI(a),this.l.trigger(new _.J(_.Xb,{adsTimeline:this.g})),LI(this));this.f.resolve()};
15
- _.t.Ni=function(a){QI(this,a.getError());this.f.resolve()};_.t.Wi=function(a){var b=this;return _.A(function(c){if(1==c.a)return b.D=!0,_.x(c,b.l.pause(),2);_.Jn(b.j,{visibility:_.nd});NI(b,_.Gb,a);b.h.start();_.y(c)})};_.t.sh=function(a){a.getAd().isLinear()?NI(this,_.Nb,a):(this.a.discardAdBreak(),this.B||(this.B=!0,this.l.play()))};_.t.uh=function(a){this.A=a.getAd().getDuration();NI(this,_.Tb,a);this.l.getSurface().show(this.m)};_.t.Hi=function(a){a=a.getAdData();QI(this,a?a.adError:null);OI(this)};
16
- _.t.Li=function(a){NI(this,_.Qb,a)};_.t.Ei=function(a){NI(this,_.Ib,a)};_.t.qh=function(a){NI(this,_.Lb,a)};_.t.Ii=function(a){NI(this,_.Ob,a)};_.t.vh=function(a){NI(this,_.Vb,a)};_.t.Ki=function(a){NI(this,_.Pb,a)};_.t.Mi=function(a){NI(this,_.Rb,a)};_.t.ph=function(a){this.pause();NI(this,_.Jb,a)};_.t.th=function(a){NI(this,_.Sb,a);OI(this)};_.t.rh=function(a){NI(this,_.Mb,a)};_.t.Fi=function(a){NI(this,_.Kb,a);OI(this)};
17
- _.t.Xi=function(){this.B=!0;if(!this.D)return this.l.play();this.D=!1;this.h.stop();this.l.isEnded()||this.l.play();NI(this,_.Hb);PI(this)};_.t.Qi=function(){this.I=!0};_.t.Vi=function(){this.M=!0;this.o.contentComplete()};
18
- _.t.load=function(){var a=this,b,c,d,e,f;return _.A(function(g){if(1==g.a){b=a.l;c=a.K;try{if(typeof c.adTagUrl!==_.ve)throw new _.L(1,9,10001,{missingKeys:"adTagUrl"});}catch(h){return b.onError(h),a.f.resolve(),g["return"](a.f)}return c.adTagUrl?_.x(g,a.H.canPlay(!1),2):(a.f.resolve(),g["return"](a.f))}if(3!=g.a)return d=g.f,_.x(g,a.H.canPlay(!0),3);e=g.f;f=new google.ima.AdsRequest;f.adTagUrl=c.adTagUrl;f.setAdWillAutoPlay(d);f.setAdWillPlayMuted(e);a.o.requestAds(f);return g["return"](a.f)})};
19
- _.t.start=function(a){var b=this;return _.A(function(c){return b.a&&b.g&&!b.F?b.g.Mb()?_.x(c,SI(b),0):_.x(c,TI(b,a),0):_.x(c,a.play(),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)};
20
- _.t.getPosition=function(){if(!this.a||null===this.A)return-1;var a=this.a.getRemainingTime();return 0>a?0:this.A-a};
21
- _.t.dispose=function(){var a=this;return(new Promise(function(b){a.F&&a.g&&a.g.hb()&&!a.I?(a.w.one(a.a,google.ima.AdEvent.Type.ALL_ADS_COMPLETED,function(){b();a.m&&a.l.getSurface().hide(a.m)}),_.fg(a.w,a.a,[google.ima.AdEvent.Type.LOADED,google.ima.AdEvent.Type.STARTED],function(){a.a&&a.a.discardAdBreak()})):b();a.a.discardAdBreak();a.o.contentComplete()})).then(function(){PI(a);a.w.release();a.h&&(a.h.stop(),a.h=null);a.a&&(a.a.destroy(),a.a=null)})};KI.prototype.getPosition=KI.prototype.getPosition;
22
- KI.prototype.setVolume=KI.prototype.setVolume;KI.prototype.getVolume=KI.prototype.getVolume;KI.prototype.skip=KI.prototype.skip;KI.prototype.pause=KI.prototype.pause;KI.prototype.resume=KI.prototype.resume;_.v(UI,_.mq);_.t=UI.prototype;_.t.onPlayerCreated=function(a){if(VI())return a.onError(new _.L(1,9,1E4));this.f=_.Hn(_.Zc,{"class":"clpp-ima clpp-hidden"});a.getSurface().addElementToContainer(this.f);this.g=new google.ima.AdDisplayContainer(this.f,a.getSurface().getMedia());this.a=new google.ima.AdsLoader(this.g);this.a.getSettings().setPlayerType(_.sa);this.a.getSettings().setPlayerVersion(_.ea);this.a.getSettings().setAutoPlayAdBreaks(!0)};
23
- _.t.onPlayerWillDestroy=function(a){this.a&&(this.a.destroy(),this.a=null);this.g&&(this.g.destroy(),this.g=null);this.f&&(a.getSurface().removeElementFromContainer(this.f),this.f=null)};_.t.gi=function(){return this.a};_.t.ei=function(){return this.g};_.t.Ec=function(){return this.f};_.t.id=function(){return"ima"};_.D("clpp.ima.ImaPlugin",UI);UI.prototype.getAdContainer=UI.prototype.Ec;UI.prototype.getAdDisplayContainer=UI.prototype.ei;UI.prototype.getAdsLoader=UI.prototype.gi;UI.Id="ima";
24
- UI.isSdkMissing=VI;WI.prototype.create=function(){return new UI};_.Eo(new WI);XI.prototype.name=function(){return GI};XI.prototype.ca=function(a,b){return a.namespace()===_.Jc?!1:VI()?(this.a.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)};XI.prototype.create=function(a){return new KI(a)};XI.prototype.create=XI.prototype.create;XI.prototype.isSupported=XI.prototype.ca;XI.prototype.name=XI.prototype.name;_.En(new XI);};
2
+ var f=function(window){var yJ="clpp.ima.AdsManagerFactory",zJ=function(a,b,c){this.a=a;this.f=a.getAdPodInfo();this.j=b;this.g=c},AJ=function(){},BJ=function(a){this.a=a},CJ=function(a){this.l=a;this.A=a.getSurface().getMedia();a=this.l.getConfiguration();a=_.K.Qa(a.ima||{});this.J=_.K.ua({disableCustomPlayback:!1},a);this.o=this.l.cc("ima").Jc();this.S=this.l.cc("ima").g;this.m=this.l.cc("ima").a;this.L=new _.rp;this.h=new _.H("clpp.ima");this.g=this.a=null;this.f=new _.ci;this.I=!1;this.w=new _.dg;this.V=new AJ;this.B=
3
+ null;this.O=this.H=this.D=this.F=!1;this.K=this.j=null;a=this.w;var b=google.ima.AdErrorEvent.Type.AD_ERROR;a.one(this.m,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.Wj.bind(this));a.on(this.m,b,this.Vj.bind(this));a.on(this.l,_.hd,this.ck.bind(this))},DJ=function(a){var b=a.a,c=a.w,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.Lj.bind(a));c.on(b,d.LOADED,a.di.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.dk.bind(a));c.on(b,d.STARTED,a.fi.bind(a));c.on(b,d.LOG,a.Pj.bind(a));c.on(b,
4
+ d.AD_PROGRESS,a.Tj.bind(a));c.on(b,d.AD_BUFFERING,a.Mj.bind(a));c.on(b,d.FIRST_QUARTILE,a.bi.bind(a));c.on(b,d.MIDPOINT,a.Qj.bind(a));c.on(b,d.THIRD_QUARTILE,a.gi.bind(a));c.on(b,d.PAUSED,a.Sj.bind(a));c.on(b,d.RESUMED,a.Uj.bind(a));c.on(b,d.CLICK,a.ai.bind(a));c.on(b,d.SKIPPED,a.ei.bind(a));c.on(b,d.IMPRESSION,a.ci.bind(a));c.on(b,d.COMPLETE,a.Nj.bind(a));c.on(b,d.CONTENT_RESUME_REQUESTED,a.ek.bind(a));c.on(b,d.ALL_ADS_COMPLETED,a.Yj.bind(a))},EJ=function(a){a=a.J;var b=new google.ima.AdsRenderingSettings;
5
+ b.restoreCustomPlaybackStateOnAdBreakComplete=!1;typeof a.bitrate===_.k&&(b.bitrate=a.bitrate);b.enablePreloading=typeof a.enablePreloading===_.uc?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===_.uc&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:
6
+ [];return b},GJ=function(a){a.B=null;FJ(a,_.Vb);a.o&&a.l.getSurface().hide(a.o)},HJ=function(a){_.zn(a.A,{visibility:"visible"})},FJ=function(a,b,c){c=c&&c.getAd();var d=null;c&&(d={ad:new zJ(c,a.F,a.D)});a.l.trigger(new _.J(b,d))},IJ=function(a,b){var c=b?a.V.create(b.getErrorCode()):null;a.l.onError(new _.L(1,9,10003,{errorType:c},b))},JJ=function(a){return!1===a.J.disableCustomPlayback&&a.a.isCustomPlaybackUsed()&&_.ji()},LJ=function(a){var b,c;return _.B(function(d){if(1==d.a)return a.S.initialize(),
7
+ b=!!a.l.getConfiguration().muted,_.x(d,a.L.canPlay(b),2);c=d.f;if(!c&&!JJ(a))return FJ(a,_.sc),a.h.warn(_.la),d["return"]();KJ(a);_.z(d)})},MJ=function(a,b){return _.B(function(c){if(1==c.a)return a.S.initialize(),_.x(c,b.play(),2);KJ(a);_.z(c)})},KJ=function(a){a.a.init(a.A.offsetWidth,a.A.offsetHeight,google.ima.ViewMode.NORMAL);a.I=!0},NJ=function(){this.a=this.g=this.f=null},OJ=function(){return!window.google||!google.ima||!google.ima.AdsLoader},PJ=function(){},QJ=function(){this.a=new _.H(yJ)};
8
+ _.t=zJ.prototype;_.t.tb=function(){return"Google IMA SDK"};_.t.ub=function(){return google.ima.VERSION};_.t.zb=function(){return 0};_.t.getId=function(){return this.a.getAdId()};_.t.getCreativeId=function(){return this.a.getCreativeId()};_.t.getApiFramework=function(){return this.a.getApiFramework()};_.t.getAdSystem=function(){return this.a.getAdSystem()};_.t.getAdvertiserName=function(){return this.a.getAdvertiserName()};_.t.getTitle=function(){return this.a.getTitle()};_.t.getDuration=function(){return this.a.getDuration()};
9
+ _.t.getSkipTimeOffset=function(){return this.a.getSkipTimeOffset()};_.t.gc=function(){return this.f?this.f.getIsBumper():!1};_.t.Nb=function(){var a=null,b=this.a,c=Object.keys(b).find(function(d){return typeof b[d]===_.Kd&&typeof b[d].clickThroughUrl===_.ue});c&&(a=b[c].clickThroughUrl);return a};_.t.getMediaUrl=function(){return this.a.getMediaUrl()};_.t.wb=function(){return this.a.getVastMediaWidth()};_.t.vb=function(){return this.a.getVastMediaHeight()};_.t.ib=function(){return this.a.getVastMediaBitrate()};
10
+ _.t.Ya=function(){return this.g?2:this.j?1:0};_.t.getPodIndex=function(){return this.f?this.f.getPodIndex():0};_.t.Ob=function(){return this.f?this.f.getTimeOffset():0};_.t.Pb=function(){return this.f?this.f.getAdPosition():1};_.t.yb=function(){return this.f?this.f.getTotalAds():1};_.t.getWrapperAdIds=function(){return this.a.getWrapperAdIds()};_.t.getWrapperAdSystems=function(){return this.a.getWrapperAdSystems()};_.t.getWrapperCreativeIds=function(){return this.a.getWrapperCreativeIds()};
11
+ zJ.prototype.getWrapperCreativeIds=zJ.prototype.getWrapperCreativeIds;zJ.prototype.getWrapperAdSystems=zJ.prototype.getWrapperAdSystems;zJ.prototype.getWrapperAdIds=zJ.prototype.getWrapperAdIds;zJ.prototype.getSequenceLength=zJ.prototype.yb;zJ.prototype.getPositionInSequence=zJ.prototype.Pb;zJ.prototype.getPodTimeOffset=zJ.prototype.Ob;zJ.prototype.getPodIndex=zJ.prototype.getPodIndex;zJ.prototype.getPodType=zJ.prototype.Ya;zJ.prototype.getMediaBitrate=zJ.prototype.ib;
12
+ zJ.prototype.getMediaHeight=zJ.prototype.vb;zJ.prototype.getMediaWidth=zJ.prototype.wb;zJ.prototype.getMediaUrl=zJ.prototype.getMediaUrl;zJ.prototype.getClickThroughUrl=zJ.prototype.Nb;zJ.prototype.isBumper=zJ.prototype.gc;zJ.prototype.getSkipTimeOffset=zJ.prototype.getSkipTimeOffset;zJ.prototype.getDuration=zJ.prototype.getDuration;zJ.prototype.getTitle=zJ.prototype.getTitle;zJ.prototype.getAdvertiserName=zJ.prototype.getAdvertiserName;zJ.prototype.getAdSystem=zJ.prototype.getAdSystem;
13
+ zJ.prototype.getApiFramework=zJ.prototype.getApiFramework;zJ.prototype.getCreativeId=zJ.prototype.getCreativeId;zJ.prototype.getId=zJ.prototype.getId;zJ.prototype.getTechnology=zJ.prototype.zb;zJ.prototype.getAdManagerVersion=zJ.prototype.ub;zJ.prototype.getAdManagerName=zJ.prototype.tb;AJ.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}};BJ.prototype.getCuePoints=function(){return this.a};BJ.prototype.Qb=function(){return 0<=this.a.indexOf(0)||0===this.a.length};BJ.prototype.jb=function(){return 0<=this.a.indexOf(-1)};BJ.prototype.hasPostroll=BJ.prototype.jb;BJ.prototype.hasPreroll=BJ.prototype.Qb;BJ.prototype.getCuePoints=BJ.prototype.getCuePoints;_.t=CJ.prototype;
14
+ _.t.Wj=function(a){var b=this;this.a=a.getAdsManager(this.A,EJ(this));this.a.isCustomPlaybackUsed()&&!JJ(this)?(this.h.warn("IMA plugin is disabled for this platform with single video element. Disposing."),this.l.onError(new _.L(1,9,10002)),this.dispose()):(this.g=new _.pp(this.l.getSurface(),function(c,d,e){b.a.resize(c,d,e?google.ima.ViewMode.FULLSCREEN:google.ima.ViewMode.NORMAL)}),a=this.a.getCuePoints(),this.j=new BJ(a),this.l.trigger(new _.J(_.Yb,{adsTimeline:this.j})),DJ(this));this.f.resolve()};
15
+ _.t.Vj=function(a){IJ(this,a.getError());this.f.resolve()};_.t.dk=function(a){var b=this;return _.B(function(c){if(1==c.a)return b.H=!0,JJ(b)?c.G(2):_.x(c,b.l.pause(),3);2!=c.a&&_.zn(b.A,{visibility:_.md});FJ(b,_.Hb,a);b.g.start();_.z(c)})};_.t.Lj=function(){var a=this;return _.B(function(b){if(1==b.a){if(!JJ(a))return b.G(2);a.K=a.l.getPosition();return _.x(b,a.l.detach(),3)}if(2!=b.a){var c=a.l;c.a&&c.a.removeDelegate(c)}a.a.start();_.z(b)})};
16
+ _.t.di=function(a){a.getAd().isLinear()?FJ(this,_.Ob,a):(this.a.discardAdBreak(),this.F||(this.F=!0,this.l.play()))};_.t.fi=function(a){this.B=a.getAd().getDuration();FJ(this,_.Ub,a);this.l.getSurface().show(this.o)};_.t.Pj=function(a){a=a.getAdData();IJ(this,a?a.adError:null);GJ(this)};_.t.Tj=function(a){FJ(this,_.Rb,a)};_.t.Mj=function(a){FJ(this,_.Jb,a)};_.t.bi=function(a){FJ(this,_.Mb,a)};_.t.Qj=function(a){FJ(this,_.Pb,a)};_.t.gi=function(a){FJ(this,_.Wb,a)};_.t.Sj=function(a){FJ(this,_.Qb,a)};
17
+ _.t.Uj=function(a){FJ(this,_.Sb,a)};_.t.ai=function(a){this.pause();FJ(this,_.Kb,a)};_.t.ei=function(a){FJ(this,_.Tb,a);GJ(this)};_.t.ci=function(a){FJ(this,_.Nb,a)};_.t.Nj=function(a){FJ(this,_.Lb,a);GJ(this)};
18
+ _.t.ek=function(){var a=this;return _.B(function(b){switch(b.a){case 1:a.F=!0;if(!JJ(a)||null===a.K){if(!a.H)return b["return"](a.l.play());HJ(a);b.G(2);break}var c=a.l;c.a&&c.a.addDelegate(c);return _.x(b,_.ro(a.l),3);case 3:if(a.D){b.G(2);break}return _.x(b,a.l.seek(a.K),2);case 2:a.H=!1;a.g&&a.g.stop();if(a.D){b.G(6);break}return _.x(b,a.l.play(),6);case 6:FJ(a,_.Ib),_.z(b)}})};_.t.Yj=function(){this.O=!0};_.t.ck=function(){this.D=!0;this.m.contentComplete()};
19
+ _.t.load=function(){var a=this,b,c,d,e,f;return _.B(function(g){if(1==g.a){b=a.l;c=a.J;try{if(typeof c.adTagUrl!==_.ue)throw new _.L(1,9,10001,{missingKeys:"adTagUrl"});}catch(h){return b.onError(h),a.f.resolve(),g["return"](a.f)}return c.adTagUrl?_.x(g,a.L.canPlay(!1),2):(a.f.resolve(),g["return"](a.f))}if(3!=g.a)return d=g.f,_.x(g,a.L.canPlay(!0),3);e=g.f;f=new google.ima.AdsRequest;f.adTagUrl=c.adTagUrl;f.setAdWillAutoPlay(d);f.setAdWillPlayMuted(e);a.m.getSettings().setAutoPlayAdBreaks(!1);a.m.requestAds(f);
20
+ return g["return"](a.f)})};_.t.start=function(a){var b=this;return _.B(function(c){return b.a&&b.j&&!b.I?b.j.Qb()?_.x(c,LJ(b),0):_.x(c,MJ(b,a),0):_.x(c,a.play(),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)};
21
+ _.t.getPosition=function(){if(!this.a||null===this.B)return-1;var a=this.a.getRemainingTime();return 0>a?0:this.B-a};
22
+ _.t.dispose=function(){var a=this;return(new Promise(function(b){a.I&&a.j&&a.j.jb()&&!a.O?(a.w.one(a.a,google.ima.AdEvent.Type.ALL_ADS_COMPLETED,function(){b();a.o&&a.l.getSurface().hide(a.o)}),_.eg(a.w,a.a,[google.ima.AdEvent.Type.LOADED,google.ima.AdEvent.Type.STARTED],function(){a.a&&a.a.discardAdBreak()})):b();a.a.discardAdBreak();a.m.contentComplete()})).then(function(){HJ(a);a.w.release();a.g&&(a.g.stop(),a.g=null);a.a&&(a.a.destroy(),a.a=null)})};CJ.prototype.getPosition=CJ.prototype.getPosition;
23
+ CJ.prototype.setVolume=CJ.prototype.setVolume;CJ.prototype.getVolume=CJ.prototype.getVolume;CJ.prototype.skip=CJ.prototype.skip;CJ.prototype.pause=CJ.prototype.pause;CJ.prototype.resume=CJ.prototype.resume;_.w(NJ,_.cq);_.t=NJ.prototype;_.t.onPlayerCreated=function(a){if(OJ())return a.onError(new _.L(1,9,1E4));this.f=_.xn(_.Zc,{"class":"clpp-ima clpp-hidden"});a.getSurface().addElementToContainer(this.f);this.g=new google.ima.AdDisplayContainer(this.f,a.getSurface().getMedia());this.a=new google.ima.AdsLoader(this.g);this.a.getSettings().setPlayerType(_.ra);this.a.getSettings().setPlayerVersion(_.ea);this.a.getSettings().setAutoPlayAdBreaks(!0)};
24
+ _.t.onPlayerWillDestroy=function(a){this.a&&(this.a.destroy(),this.a=null);this.g&&(this.g.destroy(),this.g=null);this.f&&(a.getSurface().removeElementFromContainer(this.f),this.f=null)};_.t.aj=function(){return this.a};_.t.Zi=function(){return this.g};_.t.Jc=function(){return this.f};_.t.id=function(){return"ima"};_.C("clpp.ima.ImaPlugin",NJ);NJ.prototype.getAdContainer=NJ.prototype.Jc;NJ.prototype.getAdDisplayContainer=NJ.prototype.Zi;NJ.prototype.getAdsLoader=NJ.prototype.aj;NJ.Id="ima";
25
+ NJ.isSdkMissing=OJ;PJ.prototype.create=function(){return new NJ};_.uo(new PJ);QJ.prototype.name=function(){return yJ};QJ.prototype.aa=function(a,b){return a.namespace()===_.Jc?!1:OJ()?(this.a.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)};QJ.prototype.create=function(a){return new CJ(a)};QJ.prototype.create=QJ.prototype.create;QJ.prototype.isSupported=QJ.prototype.aa;QJ.prototype.name=QJ.prototype.name;_.un(new QJ);};
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));}