@castlabs/prestoplay 6.22.0 → 6.23.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 +9 -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 +112 -112
  6. package/cjs/cl.conviva.js +32 -33
  7. package/cjs/cl.core.js +591 -586
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +81 -80
  10. package/cjs/cl.externs.js +43 -36
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +69 -69
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +30 -29
  15. package/cjs/cl.ima.js +23 -23
  16. package/cjs/cl.mse.js +330 -325
  17. package/cjs/cl.muxdata.js +15 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +13 -13
  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 -13
  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 +477 -474
  39. package/cl.crypto.js +9 -9
  40. package/cl.dash.js +76 -75
  41. package/cl.externs.js +43 -36
  42. package/cl.freewheel.js +19 -19
  43. package/cl.hls.js +74 -74
  44. package/cl.hlssmpte.js +5 -5
  45. package/cl.htmlcue.js +26 -26
  46. package/cl.ima.js +17 -17
  47. package/cl.mse.js +295 -291
  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 +59 -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 +15 -15
  61. package/cl.vtt.js +12 -12
  62. package/cl.yospace.js +3 -3
  63. package/cl.youbora.js +28 -27
  64. package/package.json +1 -1
  65. package/typings.d.ts +53 -6
package/cjs/cl.htmlcue.js CHANGED
@@ -1,33 +1,34 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var CT="CLPP Subtitle Styles",DT="Unsupported unit",ET="clpp-text-plain",FT="clpp-text-ttml",GT="clpp.htmlcue.HtmlTextDisplayer",HT="initial",IT=function(a){return _.Bi(a,{yh:function(b,c){return b.oa(c)}})},JT=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)},KT=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},LT=function(){},MT=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},OT=function(a){for(var b=null;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],function(c){return NT[c]});return a},QT=function(a,b){PT(a,b);Array.from(b.getElementsByTagName("*")).forEach(function(c){PT(a,c)})},PT=function(a,b){for(var c in a)null!=a[c]&&(b.style[c]=a[c])},RT=function(a,b){return 0===a?"0":a+b},ST=function(a,b){return 1>Math.abs(a-b)||a<b},TT=function(a,b){return a<b&&
4
- 1<Math.abs(a-b)},UT=function(a,b){return a>b&&1<Math.abs(a-b)},VT=function(a,b){return 1>Math.abs(a-b)||a>b},WT=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},XT=function(a){return new WT(a.left,a.f,a.top,a.a,a.height,a.width)},YT=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 WT(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-d-e)},ZT=function(a,b){return b.some(function(c){return TT(a.left,c.f)&&UT(a.f,c.left)&&TT(a.top,c.a)&&UT(a.a,c.top)})},$T=function(a,b){return VT(a.top,b.top)&&ST(a.a,b.a)&&VT(a.left,b.left)&&ST(a.f,b.f)},aU=function(a,b,c){switch(c){case "+x":return TT(a.left,b.left);case "-x":return UT(a.f,b.f);
6
- case "+y":return TT(a.top,b.top);case "-y":return UT(a.a,b.a);default:throw Error("Unknown axis");}},bU=function(a,b,c){this.id=a;this.w=b;this.B=c;this.a=this.o();this.j=!1},cU=function(a,b,c){bU.call(this,a.id,"clpp-text-cue",{});this.l=b;this.f=a;this.h=!!this.f.backgroundImage;this.C=c},eU=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 dU(a)?b:c},hU=function(a,b,c){return dU(a)&&_.M.va(c)?RT(c,_.Kf):(fU(a)||
7
- gU(a))&&_.M.va(b)?RT(b,"%"):HT},fU=function(a){return a.f.writingMode===_.Dg},gU=function(a){return a.f.writingMode===_.Eg},dU=function(a){return a.f.writingMode===_.Fi},iU=function(a,b,c){return(fU(a)||gU(a))&&_.M.va(c)?RT(c,_.Kf):fU(a)&&_.M.R(c)?RT(0,_.Kf):dU(a)&&_.M.va(b)?RT(b,"%"):HT},jU=function(a,b){if(typeof a.f.position===_.k&&typeof a.f.size===_.k)switch(b){case _.De:return a.f.position;case "auto":case _.sd:return a.f.position-a.f.size/2;case _.Ee:return a.f.position-a.f.size}return 0},
8
- kU=function(a){switch(a.f.positionAlign){case _.De:return _.Ae;case "auto":case _.sd:return _.Ei;case _.Ee:return _.Rf}return a.f.textAlign},lU=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.Ae:case _.Ae:return _.De;case _.Ei:return _.sd;case _.Rf:case _.Rf:return _.Ee}return a.f.positionAlign},mU=function(a){switch(a.f.writingMode){case _.Fi:return"horizontal-tb";case _.Dg:return _.Dg;case _.Eg:return _.Eg;default:throw Error("Unknown writing mode");}},nU=function(a,b){this.l=a;this.f=
9
- a.a;this.j=void 0===b?!1:b;this.a=YT(a.a);this.h=[]},oU=function(a,b){if(a.j)switch(b.writingMode){case _.Fi:return["-y"];case _.Dg:return["+x"];case _.Eg:return["-x"]}var c=[];switch(b.writingMode){case _.Fi:c=["+y","-y"];break;case _.Dg:c=["+x","-x"];break;case _.Eg:c=["-x","+x"]}0>b.line&&(c=c.reverse());return c},pU=function(a){for(a.h=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=YT(a.l.a)},qU=function(a,b,c){bU.call(this,a,b,c);this.h=null;this.l=[]},rU=function(a,b){pU(a.h);
10
- a.l.unshift(b);for(var c=_.w(a.l),d=c.next();!d.done;d=c.next())a.h.append(d.value)},sU=function(a,b){qU.call(this,a.id,"clpp-text-cue-region",b);this.f=a},tU=function(a,b,c){a=a.f;var d=a.viewportAnchorUnits;if(d===_.Ki)return a.viewportAnchorY/100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(DT);},vU=function(a){this.g=new _.K("clpp.htmlcue.StyleManager");this.j=[];this.h=a;this.l=[];this.a=uU(this,this.h);this.f=uU(this,this.h,!0);this.f.disabled=!0;this.g.debug("Stylesheet CLPP Subtitle Styles has been created.")},
11
- wU=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===e.trim().indexOf("."+a.h+" ")}))}catch(e){}0<a.f.cssRules.length&&a.f.deleteRule(0);return c},xU=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,
12
- c+" .clpp-text-cue-region .clpp-text-cue").replace(/::ttml/g,c)},uU=function(a,b,c){var d=document.createElement(_.jg),e=d.dataset;e.name=CT;e["for"]=b;c&&(e.name="CLPP Subtitle Styles (sandbox)",e.sandbox=!0);b=document.head;b.appendChild(d);yU(a,b);a.g.debug("Created HTML style element #CLPP Subtitle Styles.");return d.sheet},yU=function(a,b){var c=new MutationObserver(function(d){d.forEach(function(e){e.removedNodes.forEach(function(f){f.id===CT&&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()})},BU=function(a){_.nv.call(this,a);var b=this;this.g=new _.K(GT);this.m=a;this.L=zU(a.getConfiguration());this.j=!1;this.f=[];this.C=a.getSurface().getContainer();this.h=new vU(a.getSurface().getUniqueCssClass());this.a=new qU(null,"clpp-text-container",{});this.w=new _.ru(a.getSurface(),this.ik.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 _.ul(function(){AU(b)});this.A=new Map;this.l=null},zU=function(a){a=_.M.eb(a.htmlcue||{});_.M.R(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.M.R(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},CU=function(a,b){return a.startTime<=b&&a.endTime>b},AU=function(a,b){if((b||a.j)&&a.C){var c=a.m.getPosition();if(b||a.J!==c&&a.m.getState()===_.$p){a.J=c;var d=DU(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,EU(a),
15
- d)){c={color:a.getFontColor()||void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.sv(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 _.Mg:h="clpp-text-vtt";break;case _.rg:h=FT;break;case _.Di:h=ET}h&&!g.classList.contains(h)&&_.Aq(g,h);g=YT(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{PT({fontSize:FU(f,e.containerRows)},f.a.a);g=null;h=e.payloadType===_.Mg;var l=e.payloadType===_.rg;e.region&&(h||l||e.backgroundImage)&&(f.A.has(e.region.id)?g=f.A.get(e.region.id):(g=new sU(e.region,{}),f.A.set(e.region.id,g),rU(f.a,g)));e=new cU(e,f.L,c);g?rU(g,e):rU(f.a,e)}}}}}},DU=function(a,b){var c=KT(a.f,function(e){return CU(e,b)?0:b!==e.startTime?b-e.startTime:b-e.endTime});if(-1===c)return null;for(var d=c;0<=d-1&&CU(a.f[d-1],b);)d--;for(;c+1<a.f.length&&CU(a.f[c+1],b);)c++;return{start:d,
17
- end:c}},GU=function(a){EU(a);a.J=null;a.l=null;a.f=[]},EU=function(a){a.A.clear();if(a.a){var b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(FT);b.classList.remove(ET);a=a.a;pU(a.h);a.l=[]}},FU=function(a,b){var c=YT(a.a.a).height;if(null!==a.I)return a.getFontSize();if(null!==a.B){var d=a.getFontSizePercent();return Math.round(c*d)+_.Kf}if(typeof b===_.k&&0<b)return Math.round(c/b)+_.Kf;d=a.getFontSizePercent();return Math.round(c*d)+_.Kf},HU=function(){},IU=function(){};
18
- LT.prototype.parse=function(a){a={input:a};for(var b=_.Cq(_.Yd),c=[],d=b,e;null!==(e=MT(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=JU[f];h?(h=_.Cq(h),(f=KU[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||LU[g.localName]&&LU[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(OT(e)));return b};var JU={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},KU={v:"voice",lang:"lang"},LU={rt:"ruby"},NT={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f","\x26nbsp;":"\u00a0"};bU.prototype.init=function(){this.j=!0};bU.prototype.A=function(){return!1};_.x(cU,bU);cU.prototype.A=function(){return!this.h&&!(this.f.region&&this.f.region.displayAlign)};
20
- cU.prototype.init=function(a){bU.prototype.init.call(this,a);if(this.h)_.Aq(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===_.rg){var c=_.Cq(_.Yd);c.innerHTML=b.payload;b=c}else b.payloadType===_.Mg?b=(new LT).parse(b.payload):(c=_.Cq(_.Yd),c.textContent=b.payload,b=c);_.Aq(b,this.w);this.id&&(b.id=this.id);c=_.w(this.f.cssClassList);for(var d=
21
- c.next();!d.done;d=c.next())_.Aq(b,d.value);PT({writingMode:mU(this)},b);this.a.appendChild(b);_.Aq(this.a,"clpp-text-wrapper");c=_.w(this.f.cssClassList);for(d=c.next();!d.done;d=c.next())_.Aq(this.a,"clpp-text-wrapper__"+d.value);_.M.R(this.f.line)&&(this.f.lineInterpretation=_.Gi,this.f.line=dU(this)?-1:0);c=mU(this);PT({writingMode:c,webkitWritingMode:c,direction:HT,textAlign:kU(this)},this.a);if(!this.f.region||!this.f.region.displayAlign){c=jU(this,lU(this));d=iU(this,c,null);var e=hU(this,
22
- c,null),f=gU(this)&&_.M.R(null)?RT(0,_.Kf):HT;PT({position:"absolute",left:d,right:f,top:e,width:dU(this)?RT(this.f.size,"%"):HT,height:fU(this)||gU(this)?RT(this.f.size,"%"):HT},this.a);d=this.f;a=dU(this)?a.height:a.width;e=eU(this);if(d.lineInterpretation===_.Gi)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 _.sd:g-=f/2;break;case _.ne:g-=f}f=Math.round(g/100*a)}gU(this)&&(f=a-f-e);a=f;d=iU(this,c,a);e=gU(this)&&_.M.R(a)?
23
- RT(0,_.Kf):HT;PT({left:d,right:e,top:hU(this,c,a)},this.a)}QT(this.C,b)}};cU.prototype.o=function(){return _.Cq(_.Yd)};nU.prototype.append=function(a){var b=a.a;b.style.visibility=_.ve;this.f.appendChild(b);a.j||a.init(this.a);if(a.A()){a:{var c=YT(a.a);var d=oU(this,a.f),e=eU(a),f=XT(c),g=null,h=0;d=_.w(d);for(var l=d.next();!l.done;l=d.next()){for(l=l.value;aU(c,this.a,l)||$T(c,this.a)&&ZT(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||$T(c,this.a))break a;l=this.a;l=Math.max(0,Math.min(c.f,
24
- 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=XT(c),h=l);c=XT(f)}c=g||f}PT({top:RT(c.top-this.a.top,_.Kf),bottom:RT(this.a.a-c.a,_.Kf),left:RT(c.left-this.a.left,_.Kf),right:RT(this.a.f-c.f,_.Kf),height:RT(c.height,_.Kf),width:RT(c.width,_.Kf)},a.a)}b.style.visibility="visible";this.h.push(YT(a.a))};_.x(qU,bU);qU.prototype.init=function(){this.h=new nU(this);this.j=!0};qU.prototype.o=function(){var a=_.Cq(_.Yd);_.Aq(a,this.w);this.id&&(a.id=this.id);return a};_.x(sU,qU);
25
- sU.prototype.init=function(a){a:{var b=this.f;switch(b.widthUnits){case 0:b=b.width;break a;case _.Ki:b=b.width/100*a.width;break a;default:throw Error(DT);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.Ki)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(DT);d=a.height;var e=tU(this,d,a.height);PT(this.B,this.a);PT({left:RT(c,_.Kf),top:RT(e,_.Kf),width:RT(b,_.Kf),height:RT(d,_.Kf)},this.a);this.f.writingMode&&PT({display:"flex",
26
- "flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&PT({"justify-content":this.f.displayAlign},this.a);b=_.w(this.f.cssClassList);for(c=b.next();!c.done;c=b.next())_.Aq(this.a,c.value);a:switch(b=this.f,b.heightUnits){case 0:b=b.height;break a;case _.Ki:b=b.height/100*a.height;break a;case 2:b=b.height;d=new cU(new _.Ji(0,1,"Lorem ipsum",_.Di),{},{});c=d.a;this.a.appendChild(c);d.init(YT(this.a));d=c.getBoundingClientRect().height;this.a.removeChild(c);b*=d;break a;default:throw Error(DT);
27
- }a=tU(this,b,a.height);PT({top:RT(a,_.Kf),height:RT(b,_.Kf)},this.a);this.h=new nU(this,!0);this.j=!0};sU.prototype.getId=function(){return this.f.id};vU.prototype.appendRule=function(a){if(null!=this.a&&!this.l.some(function(c){return c===a})){var b=xU(this,a);if(wU(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)}};
28
- vU.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(BU,_.nv);_.u=BU.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=JT(this.f,IT(a));this.l=null;AU(this,!1)}};_.u.Nb=function(){null==this.h||AU(this,!0)};
29
- _.u.destroy=function(){var a=this;return _.I(function(b){if(1==b.a){if(null==a.h)return b["return"]();GU(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;AU(this,!0);return!0};_.u.isTextVisible=function(){return this.j};
30
- _.u.setTextVisibility=function(a){null!=this.h&&this.j!==a&&((this.j=a)?(this.G.zb(.25),this.L.enableResizeObserver&&this.w.start(),AU(this,!0)):(this.G.stop(),this.w.stop(),GU(this)))};_.u.ik=function(){AU(this,!0)};_.J(GT,BU);BU.prototype.setTextVisibility=BU.prototype.setTextVisibility;BU.prototype.isTextVisible=BU.prototype.isTextVisible;BU.prototype.remove=BU.prototype.remove;BU.prototype.destroy=BU.prototype.destroy;BU.prototype.append=BU.prototype.append;HU.prototype.a=function(a){return!!a.enableHtmlCue&&!_.Dl()};HU.prototype.create=function(a){return new BU(a)};_.x(IU,_.Bt);IU.prototype.f=function(){_.zp(_.we,new HU)};IU.prototype.a=function(){_.xp.has(_.we)&&(_.xp["delete"](_.we),_.yp.info("Removed factory: 'html'"))};IU.prototype.id=function(){return _.lg};_.J("clpp.htmlcue.HtmlCueComponent",IU);};
2
+ var f=function(window){var TT="CLPP Subtitle Styles",UT="Unsupported unit",VT="clpp-text-plain",WT="clpp-text-ttml",XT="clpp.htmlcue.HtmlTextDisplayer",YT="initial",ZT=function(a){return _.Di(a,{zh:function(b,c){return b.na(c)}})},$T=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)},aU=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},bU=function(){},cU=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},eU=function(a){for(var b=null;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],function(c){return dU[c]});return a},gU=function(a,b){fU(a,b);Array.from(b.getElementsByTagName("*")).forEach(function(c){fU(a,c)})},fU=function(a,b){for(var c in a)null!=a[c]&&(b.style[c]=a[c])},hU=function(a,b){return 0===a?"0":a+b},iU=function(a,b){return 1>Math.abs(a-b)||a<b},jU=function(a,b){return a<b&&
4
+ 1<Math.abs(a-b)},kU=function(a,b){return a>b&&1<Math.abs(a-b)},lU=function(a,b){return 1>Math.abs(a-b)||a>b},mU=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},nU=function(a){return new mU(a.left,a.f,a.top,a.a,a.height,a.width)},oU=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 mU(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-d-e)},pU=function(a,b){return b.some(function(c){return jU(a.left,c.f)&&kU(a.f,c.left)&&jU(a.top,c.a)&&kU(a.a,c.top)})},qU=function(a,b){return lU(a.top,b.top)&&iU(a.a,b.a)&&lU(a.left,b.left)&&iU(a.f,b.f)},rU=function(a,b,c){switch(c){case "+x":return jU(a.left,b.left);case "-x":return kU(a.f,b.f);
6
+ case "+y":return jU(a.top,b.top);case "-y":return kU(a.a,b.a);default:throw Error("Unknown axis");}},sU=function(a,b,c){this.id=a;this.w=b;this.B=c;this.a=this.o();this.j=!1},tU=function(a,b,c){sU.call(this,a.id,"clpp-text-cue",{});this.l=b;this.f=a;this.h=!!this.f.backgroundImage;this.C=c},vU=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 uU(a)?b:c},yU=function(a,b,c){return uU(a)&&_.N.ua(c)?hU(c,_.Lf):(wU(a)||
7
+ xU(a))&&_.N.ua(b)?hU(b,"%"):YT},wU=function(a){return a.f.writingMode===_.Eg},xU=function(a){return a.f.writingMode===_.Hg},uU=function(a){return a.f.writingMode===_.Hi},zU=function(a,b,c){return(wU(a)||xU(a))&&_.N.ua(c)?hU(c,_.Lf):wU(a)&&_.N.R(c)?hU(0,_.Lf):uU(a)&&_.N.ua(b)?hU(b,"%"):YT},AU=function(a,b){if(typeof a.f.position===_.k&&typeof a.f.size===_.k)switch(b){case _.Ee:return a.f.position;case "auto":case _.rd:return a.f.position-a.f.size/2;case _.Fe:return a.f.position-a.f.size}return 0},
8
+ BU=function(a){switch(a.f.positionAlign){case _.Ee:return _.Be;case "auto":case _.rd:return _.Gi;case _.Fe:return _.Sf}return a.f.textAlign},CU=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.Be:case _.Be:return _.Ee;case _.Gi:return _.rd;case _.Sf:case _.Sf:return _.Fe}return a.f.positionAlign},DU=function(a){switch(a.f.writingMode){case _.Hi:return"horizontal-tb";case _.Eg:return _.Eg;case _.Hg:return _.Hg;default:throw Error("Unknown writing mode");}},EU=function(a,b){this.l=a;this.f=
9
+ a.a;this.j=void 0===b?!1:b;this.a=oU(a.a);this.h=[]},FU=function(a,b){if(a.j)switch(b.writingMode){case _.Hi:return["-y"];case _.Eg:return["+x"];case _.Hg:return["-x"]}var c=[];switch(b.writingMode){case _.Hi:c=["+y","-y"];break;case _.Eg:c=["+x","-x"];break;case _.Hg:c=["-x","+x"]}0>b.line&&(c=c.reverse());return c},GU=function(a){for(a.h=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=oU(a.l.a)},HU=function(a,b,c){sU.call(this,a,b,c);this.h=null;this.l=[]},IU=function(a,b){HU.call(this,
10
+ a.id,"clpp-text-cue-region",b);this.f=a},JU=function(a,b,c){a=a.f;var d=a.viewportAnchorUnits;if(d===_.Mi)return a.viewportAnchorY/100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(UT);},LU=function(a){this.g=new _.K("clpp.htmlcue.StyleManager");this.j=[];this.h=a;this.l=[];this.a=KU(this,this.h);this.f=KU(this,this.h,!0);this.f.disabled=!0;this.g.debug("Stylesheet CLPP Subtitle Styles has been created.")},MU=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},NU=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)},KU=function(a,b,c){var d=document.createElement(_.kg),e=d.dataset;e.name=TT;e["for"]=b;c&&(e.name="CLPP Subtitle Styles (sandbox)",e.sandbox=!0);b=document.head;b.appendChild(d);OU(a,b);a.g.debug("Created HTML style element #CLPP Subtitle Styles.");return d.sheet},OU=function(a,b){var c=new MutationObserver(function(d){d.forEach(function(e){e.removedNodes.forEach(function(f){f.id===TT&&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()})},RU=function(a){_.wv.call(this,a);var b=this;this.g=new _.K(XT);this.m=a;this.L=PU(a.getConfiguration());this.j=!1;this.f=[];this.C=a.getSurface().getContainer();this.h=new LU(a.getSurface().getUniqueCssClass());this.a=new HU(null,"clpp-text-container",{});this.w=new _.Au(a.getSurface(),this.lk.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 _.xl(function(){QU(b)});this.A=new Map;this.l=null},PU=function(a){a=_.N.cb(a.htmlcue||{});_.N.R(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.N.R(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},SU=function(a,b){return a.startTime<=b&&a.endTime>b},QU=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=TU(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,UU(a),
15
+ d)){c={color:a.getFontColor()||void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.Bv(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 _.Og:h="clpp-text-vtt";break;case _.sg:h=WT;break;case _.Fi:h=VT}h&&!g.classList.contains(h)&&_.Jq(g,h);g=oU(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{fU({fontSize:VU(f,e.containerRows)},f.a.a);g=null;h=e.payloadType===_.Og;var l=e.payloadType===_.sg;e.region&&(h||l||e.backgroundImage)&&(f.A.has(e.region.id)?g=f.A.get(e.region.id):(g=new IU(e.region,{}),f.A.set(e.region.id,g),f.a.appendChild(g)));e=new tU(e,f.L,c);g?g.appendChild(e):f.a.appendChild(e)}}}}}},TU=function(a,b){var c=aU(a.f,function(e){return SU(e,b)?0:b!==e.startTime?b-e.startTime:b-e.endTime});if(-1===c)return null;for(var d=c;0<=d-1&&SU(a.f[d-1],b);)d--;for(;c+1<a.f.length&&
17
+ SU(a.f[c+1],b);)c++;return{start:d,end:c}},WU=function(a){UU(a);a.J=null;a.l=null;a.f=[]},UU=function(a){a.A.clear();if(a.a){var b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(WT);b.classList.remove(VT);a=a.a;GU(a.h);a.l=[]}},VU=function(a,b){var c=oU(a.a.a).height;if(null!==a.I)return a.getFontSize();if(null!==a.B){var d=a.getFontSizePercent();return Math.round(c*d)+_.Lf}if(typeof b===_.k&&0<b)return Math.round(c/b)+_.Lf;d=a.getFontSizePercent();return Math.round(c*d)+_.Lf},XU=function(){},
18
+ YU=function(){};
19
+ bU.prototype.parse=function(a){a={input:a};for(var b=_.Lq(_.Xd),c=[],d=b,e;null!==(e=cU(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=ZU[f];h?(h=_.Lq(h),(f=$U[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||aV[g.localName]&&aV[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(eU(e)));return b};var ZU={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},$U={v:"voice",lang:"lang"},aV={rt:"ruby"},dU={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f","\x26nbsp;":"\u00a0"};sU.prototype.init=function(){this.j=!0};sU.prototype.A=function(){return!1};_.x(tU,sU);tU.prototype.A=function(){return!this.h&&!(this.f.region&&this.f.region.displayAlign)};
21
+ tU.prototype.init=function(a){sU.prototype.init.call(this,a);if(this.h)_.Jq(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===_.sg){var c=_.Lq(_.Xd);c.innerHTML=b.payload;b=c}else b.payloadType===_.Og?b=(new bU).parse(b.payload):(c=_.Lq(_.Xd),c.textContent=b.payload,b=c);_.Jq(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())_.Jq(b,d.value);fU({writingMode:DU(this)},b);this.a.appendChild(b);_.Jq(this.a,"clpp-text-wrapper");c=_.w(this.f.cssClassList);for(d=c.next();!d.done;d=c.next())_.Jq(this.a,"clpp-text-wrapper__"+d.value);_.N.R(this.f.line)&&(this.f.lineInterpretation=_.Ii,this.f.line=uU(this)?-1:0);c=DU(this);fU({writingMode:c,webkitWritingMode:c,direction:YT,textAlign:BU(this)},this.a);if(!this.f.region||!this.f.region.displayAlign){c=AU(this,CU(this));d=zU(this,c,null);var e=yU(this,
23
+ c,null),f=xU(this)&&_.N.R(null)?hU(0,_.Lf):YT;fU({position:"absolute",left:d,right:f,top:e,width:uU(this)?hU(this.f.size,"%"):YT,height:wU(this)||xU(this)?hU(this.f.size,"%"):YT},this.a);d=this.f;a=uU(this)?a.height:a.width;e=vU(this);if(d.lineInterpretation===_.Ii)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 _.oe:g-=f}f=Math.round(g/100*a)}xU(this)&&(f=a-f-e);a=f;d=zU(this,c,a);e=xU(this)&&_.N.R(a)?
24
+ hU(0,_.Lf):YT;fU({left:d,right:e,top:yU(this,c,a)},this.a)}gU(this.C,b)}};tU.prototype.o=function(){return _.Lq(_.Xd)};EU.prototype.append=function(a){var b=a.a;b.style.visibility=_.we;this.f.appendChild(b);a.j||a.init(this.a);if(a.A()){a:{var c=oU(a.a);var d=FU(this,a.f),e=vU(a),f=nU(c),g=null,h=0;d=_.w(d);for(var l=d.next();!l.done;l=d.next()){for(l=l.value;rU(c,this.a,l)||qU(c,this.a)&&pU(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||qU(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=nU(c),h=l);c=nU(f)}c=g||f}fU({top:hU(c.top-this.a.top,_.Lf),bottom:hU(this.a.a-c.a,_.Lf),left:hU(c.left-this.a.left,_.Lf),right:hU(this.a.f-c.f,_.Lf),height:hU(c.height,_.Lf),width:hU(c.width,_.Lf)},a.a)}b.style.visibility="visible";this.h.push(oU(a.a))};_.x(HU,sU);HU.prototype.init=function(){this.h=new EU(this);this.j=!0};HU.prototype.o=function(){var a=_.Lq(_.Xd);_.Jq(a,this.w);this.id&&(a.id=this.id);return a};HU.prototype.appendChild=function(a){GU(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(IU,HU);
26
+ IU.prototype.init=function(a){a:{var b=this.f;switch(b.widthUnits){case 0:b=b.width;break a;case _.Mi:b=b.width/100*a.width;break a;default:throw Error(UT);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.Mi)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(UT);d=a.height;var e=JU(this,d,a.height);fU(this.B,this.a);fU({left:hU(c,_.Lf),top:hU(e,_.Lf),width:hU(b,_.Lf),height:hU(d,_.Lf)},this.a);this.f.writingMode&&fU({display:"flex",
27
+ "flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&fU({"justify-content":this.f.displayAlign},this.a);b=_.w(this.f.cssClassList);for(c=b.next();!c.done;c=b.next())_.Jq(this.a,c.value);a:switch(b=this.f,b.heightUnits){case 0:b=b.height;break a;case _.Mi:b=b.height/100*a.height;break a;case 2:b=b.height;d=new tU(new _.Li(0,1,"Lorem ipsum",_.Fi),{},{});c=d.a;this.a.appendChild(c);d.init(oU(this.a));d=c.getBoundingClientRect().height;this.a.removeChild(c);b*=d;break a;default:throw Error(UT);
28
+ }a=JU(this,b,a.height);fU({top:hU(a,_.Lf),height:hU(b,_.Lf)},this.a);this.h=new EU(this,!0);this.j=!0};IU.prototype.getId=function(){return this.f.id};LU.prototype.appendRule=function(a){if(null!=this.a&&!this.l.some(function(c){return c===a})){var b=NU(this,a);if(MU(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
+ LU.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(RU,_.wv);_.u=RU.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=$T(this.f,ZT(a));this.l=null;QU(this,!1)}};_.u.Nb=function(){null==this.h||QU(this,!0)};
30
+ _.u.destroy=function(){var a=this;return _.I(function(b){if(1==b.a){if(null==a.h)return b["return"]();WU(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)})};_.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;QU(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.Ab(.25),this.L.enableResizeObserver&&this.w.start(),QU(this,!0)):(this.G.stop(),this.w.stop(),WU(this)))};_.u.lk=function(){QU(this,!0)};_.J(XT,RU);RU.prototype.setTextVisibility=RU.prototype.setTextVisibility;RU.prototype.isTextVisible=RU.prototype.isTextVisible;RU.prototype.remove=RU.prototype.remove;RU.prototype.destroy=RU.prototype.destroy;RU.prototype.append=RU.prototype.append;XU.prototype.a=function(a){return!!a.enableHtmlCue&&!_.Hl()};XU.prototype.create=function(a){return new RU(a)};_.x(YU,_.Kt);YU.prototype.f=function(){_.Ip(_.xe,new XU)};YU.prototype.a=function(){_.Gp.has(_.xe)&&(_.Gp["delete"](_.xe),_.Hp.info("Removed factory: 'html'"))};YU.prototype.id=function(){return _.mg};_.J("clpp.htmlcue.HtmlCueComponent",YU);};
31
32
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
32
33
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
33
34
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.ima.js CHANGED
@@ -1,27 +1,27 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var jT="clpp.ima.AdsManagerFactory",kT=function(a,b,c){this.a=a;this.f=a.getAdPodInfo();this.j=b;this.h=c},lT=function(){},mT=function(a){this.a=a},nT=function(a){var b=a.Wd("ima");if(!b)throw Error("IMA plugin not created.");var c=b.fd(),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=_.M.eb(a.ima||{});this.G=_.M.ra({disableCustomPlayback:!1},a);this.L=
3
- c;this.N=d;this.j=b;this.J=new _.tu;this.g=new _.K("clpp.ima");this.h=this.a=null;this.f=new _.kk;this.K=!1;this.H=new _.Uh;this.P=new lT;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.rm.bind(this));c.on(this.j,d,this.qm.bind(this));c.on(this.m,_.oe,this.xm.bind(this))},oT=function(a){var b=a.a,c=a.H,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.gm.bind(a));c.on(b,
4
- d.LOADED,a.mk.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.ym.bind(a));c.on(b,d.STARTED,a.pk.bind(a));c.on(b,d.LOG,a.km.bind(a));c.on(b,d.AD_PROGRESS,a.om.bind(a));c.on(b,d.AD_BUFFERING,a.hm.bind(a));c.on(b,d.FIRST_QUARTILE,a.kk.bind(a));c.on(b,d.MIDPOINT,a.lm.bind(a));c.on(b,d.THIRD_QUARTILE,a.qk.bind(a));c.on(b,d.PAUSED,a.nm.bind(a));c.on(b,d.RESUMED,a.pm.bind(a));c.on(b,d.CLICK,a.jk.bind(a));c.on(b,d.SKIPPED,a.nk.bind(a));c.on(b,d.IMPRESSION,a.lk.bind(a));c.on(b,d.COMPLETE,a.im.bind(a));c.on(b,
5
- d.CONTENT_RESUME_REQUESTED,a.zm.bind(a))},pT=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===_.id?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
- _.id&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},rT=function(a){a.o=null;qT(a,_.Kc);a.m.getSurface().hide(a.L)},sT=function(a){_.Bq(a.l,{visibility:"visible"})},qT=function(a,b,c){c=c&&c.getAd();var d=null;c&&(d={ad:new kT(c,a.B,a.A)});a.m.trigger(new _.L(b,d))},tT=function(a,b){var c=b?a.P.create(b.getErrorCode()):null;a.m.onError(new _.N(1,9,10003,{errorType:c},b))},uT=function(a){return!1===a.G.disableCustomPlayback&&a.a.isCustomPlaybackUsed()&&
7
- _.sk()},wT=function(a){var b,c;return _.I(function(d){if(1==d.a)return a.N.initialize(),b=!!a.m.getConfiguration().muted,_.y(d,a.J.canPlay(b),2);c=d.f;if(!c&&!uT(a))return qT(a,_.gd),a.g.warn(_.la),d["return"]();vT(a);_.C(d)})},xT=function(a,b){return _.I(function(c){if(1==c.a)return a.N.initialize(),_.y(c,b.play(),2);vT(a);_.C(c)})},vT=function(a){a.a.init(a.l.offsetWidth,a.l.offsetHeight,google.ima.ViewMode.NORMAL);a.a.start();a.K=!0},yT=function(){this.a=this.h=this.f=null},zT=function(){return!window.google||
8
- !google.ima||!google.ima.AdsLoader},AT=function(){},BT=function(){this.md=new _.K(jT)};_.u=kT.prototype;_.u.ob=function(){return"Google IMA SDK"};_.u.pb=function(){return google.ima.VERSION};_.u.sb=function(){return 0};_.u.getId=function(){return this.a.getAdId()};_.u.getCreativeId=function(){return this.a.getCreativeId()};_.u.Tb=function(){return""};_.u.getApiFramework=function(){return this.a.getApiFramework()};_.u.getAdSystem=function(){return this.a.getAdSystem()};_.u.getAdvertiserName=function(){return this.a.getAdvertiserName()};
9
- _.u.getTitle=function(){return this.a.getTitle()};_.u.getDuration=function(){return this.a.getDuration()};_.u.getPosition=function(){return 0};_.u.getSkipTimeOffset=function(){return this.a.getSkipTimeOffset()};_.u.Xb=function(){return this.f?this.f.getIsBumper():!1};_.u.qb=function(){var a=null,b=this.a,c=Object.keys(b).find(function(d){return typeof b[d]===_.We&&typeof b[d].clickThroughUrl===_.hg});c&&(a=b[c].clickThroughUrl);return a};_.u.getMediaUrl=function(){return this.a.getMediaUrl()};
10
- _.u.gb=function(){return this.a.getVastMediaWidth()};_.u.fb=function(){return this.a.getVastMediaHeight()};_.u.Ra=function(){return this.a.getVastMediaBitrate()};_.u.Sa=function(){return this.h?2:this.j?1:0};_.u.getPodIndex=function(){return this.f?this.f.getPodIndex():0};_.u.Db=function(){return this.f?this.f.getTimeOffset():0};_.u.Eb=function(){return this.f?this.f.getAdPosition():1};_.u.hb=function(){return this.f?this.f.getTotalAds():1};_.u.getWrapperAdIds=function(){return this.a.getWrapperAdIds()};
11
- _.u.getWrapperAdSystems=function(){return this.a.getWrapperAdSystems()};_.u.getWrapperCreativeIds=function(){return this.a.getWrapperCreativeIds()};_.u.Wb=function(){return null};kT.prototype.getVideoElement=kT.prototype.Wb;kT.prototype.getWrapperCreativeIds=kT.prototype.getWrapperCreativeIds;kT.prototype.getWrapperAdSystems=kT.prototype.getWrapperAdSystems;kT.prototype.getWrapperAdIds=kT.prototype.getWrapperAdIds;kT.prototype.getSequenceLength=kT.prototype.hb;kT.prototype.getPositionInSequence=kT.prototype.Eb;
12
- kT.prototype.getPodTimeOffset=kT.prototype.Db;kT.prototype.getPodIndex=kT.prototype.getPodIndex;kT.prototype.getPodType=kT.prototype.Sa;kT.prototype.getMediaBitrate=kT.prototype.Ra;kT.prototype.getMediaHeight=kT.prototype.fb;kT.prototype.getMediaWidth=kT.prototype.gb;kT.prototype.getMediaUrl=kT.prototype.getMediaUrl;kT.prototype.getClickThroughUrl=kT.prototype.qb;kT.prototype.isBumper=kT.prototype.Xb;kT.prototype.getSkipTimeOffset=kT.prototype.getSkipTimeOffset;kT.prototype.getPosition=kT.prototype.getPosition;
13
- kT.prototype.getDuration=kT.prototype.getDuration;kT.prototype.getTitle=kT.prototype.getTitle;kT.prototype.getAdvertiserName=kT.prototype.getAdvertiserName;kT.prototype.getAdSystem=kT.prototype.getAdSystem;kT.prototype.getApiFramework=kT.prototype.getApiFramework;kT.prototype.getSourceId=kT.prototype.Tb;kT.prototype.getCreativeId=kT.prototype.getCreativeId;kT.prototype.getId=kT.prototype.getId;kT.prototype.getTechnology=kT.prototype.sb;kT.prototype.getAdManagerVersion=kT.prototype.pb;
14
- kT.prototype.getAdManagerName=kT.prototype.ob;lT.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}};mT.prototype.getCuePoints=function(){return this.a};mT.prototype.Gb=function(){return 0<=this.a.indexOf(0)||0===this.a.length};mT.prototype.Fb=function(){return 0<=this.a.indexOf(-1)};mT.prototype.hasPostroll=mT.prototype.Fb;mT.prototype.hasPreroll=mT.prototype.Gb;mT.prototype.getCuePoints=mT.prototype.getCuePoints;_.u=nT.prototype;
15
- _.u.rm=function(a){var b=this;this.a=a.getAdsManager(this.l,pT(this));this.a.isCustomPlaybackUsed()&&!uT(this)?(this.g.warn("IMA plugin is disabled for this platform with single video element. Disposing."),this.m.onError(new _.N(1,9,10002)),this.uc()):(this.h=new _.ru(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 mT(a),this.m.trigger(new _.L(_.Nc,{adsTimeline:this.w})),oT(this));this.f.resolve()};
16
- _.u.qm=function(a){tT(this,a.getError());this.f.resolve()};_.u.ym=function(a){var b=this;return _.I(function(c){switch(c.a){case 1:return b.C=!0,uT(b)?(b.I=b.m.getPosition(),_.y(c,b.m.detach(),5)):_.y(c,b.m.pause(),4);case 4:_.Bq(b.l,{visibility:_.ve});c.F(3);break;case 5:var d=b.m;d.a&&d.a.stopForwardingEventsTo(d);case 3:qT(b,_.tc,a),b.h.start(),_.C(c)}})};_.u.gm=function(){var a=this;return _.I(function(b){a.a.start();_.C(b)})};
17
- _.u.mk=function(a){a.getAd().isLinear()?qT(this,_.Dc,a):(this.a.discardAdBreak(),this.B||(this.B=!0,this.m.play()))};_.u.pk=function(a){this.o=a.getAd().getDuration();qT(this,_.Jc,a);this.m.getSurface().show(this.L)};_.u.km=function(a){a=a.getAdData();tT(this,a?a.adError:null);rT(this)};_.u.om=function(a){qT(this,_.Gc,a)};_.u.hm=function(a){qT(this,_.vc,a)};_.u.kk=function(a){qT(this,_.yc,a)};_.u.lm=function(a){qT(this,_.Ec,a)};_.u.qk=function(a){qT(this,_.Lc,a)};_.u.nm=function(a){qT(this,_.Fc,a)};
18
- _.u.pm=function(a){qT(this,_.Hc,a)};_.u.jk=function(a){this.pause();qT(this,_.wc,a)};_.u.nk=function(a){qT(this,_.Ic,a);rT(this)};_.u.lk=function(a){qT(this,_.Cc,a)};_.u.im=function(a){qT(this,_.xc,a);rT(this)};
19
- _.u.zm=function(){var a=this;return _.I(function(b){switch(b.a){case 1:a.B=!0;if(!uT(a)||null===a.I){if(!a.C)return b["return"](a.m.play());sT(a);b.F(2);break}var c=a.m;c.a&&c.a.forwardEventsTo(c);return _.y(b,_.Us(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:qT(a,_.uc),_.C(b)}})};_.u.xm=function(){this.A=!0;this.j.contentComplete()};
20
- _.u.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!==_.hg)throw new _.N(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)})};_.u.start=function(a){var b=this;return _.I(function(c){return b.a&&b.w&&!b.K?b.w.Gb()?_.y(c,wT(b),0):_.y(c,xT(b,a),0):_.y(c,a.play(),0)})};_.u.Yc=function(){};_.u.Tc=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)};
22
- _.u.getPosition=function(){if(!this.a||null===this.o)return-1;var a=this.a.getRemainingTime();return 0>a?0:this.o-a};_.u.uc=function(){this.a&&(this.a.destroy(),this.a=null);sT(this);this.H.release();this.h&&(this.h.stop(),this.h=null);return Promise.resolve()};nT.prototype.getPosition=nT.prototype.getPosition;nT.prototype.setVolume=nT.prototype.setVolume;nT.prototype.getVolume=nT.prototype.getVolume;nT.prototype.skip=nT.prototype.skip;nT.prototype.pause=nT.prototype.pause;nT.prototype.resume=nT.prototype.resume;_.x(yT,_.yv);_.u=yT.prototype;_.u.onPlayerCreated=function(a){if(zT())return a.onError(new _.N(1,9,1E4));this.f=_.zq(_.Yd,{"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(_.ua);this.a.getSettings().setPlayerVersion(_.ha);this.a.getSettings().setAutoPlayAdBreaks(!0)};
23
- _.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.pl=function(){return this.a};_.u.nl=function(){return this.h};_.u.fd=function(){return this.f};_.u.id=function(){return"ima"};_.J("clpp.ima.ImaPlugin",yT);yT.prototype.getAdContainer=yT.prototype.fd;yT.prototype.getAdDisplayContainer=yT.prototype.nl;yT.prototype.getAdsLoader=yT.prototype.pl;yT.Id="ima";
24
- yT.isSdkMissing=zT;AT.prototype.create=function(){return new yT};_.Ys(new AT);BT.prototype.name=function(){return jT};BT.prototype.a=function(a,b){return a.namespace()===_.Ad?!1:zT()?(this.md.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)};BT.prototype.create=function(a){return new nT(a)};_.tq(new BT);};
2
+ var f=function(window){var AT="clpp.ima.AdsManagerFactory",BT=function(a,b,c){this.a=a;this.f=a.getAdPodInfo();this.j=b;this.h=c},CT=function(){},DT=function(a){this.a=a},ET=function(a){var b=a.Wd("ima");if(!b)throw Error("IMA plugin not created.");var c=b.cd(),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.cb(a.ima||{});this.G=_.N.qa({disableCustomPlayback:!1},a);this.L=
3
+ c;this.M=d;this.j=b;this.J=new _.Cu;this.g=new _.K("clpp.ima");this.h=this.a=null;this.f=new _.mk;this.K=!1;this.H=new _.Wh;this.P=new CT;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.zm.bind(this));c.on(this.j,d,this.ym.bind(this));c.on(this.m,_.pe,this.Fm.bind(this))},FT=function(a){var b=a.a,c=a.H,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.pm.bind(a));c.on(b,
4
+ d.LOADED,a.qk.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.Gm.bind(a));c.on(b,d.STARTED,a.tk.bind(a));c.on(b,d.LOG,a.tm.bind(a));c.on(b,d.AD_PROGRESS,a.rk.bind(a));c.on(b,d.AD_BUFFERING,a.qm.bind(a));c.on(b,d.FIRST_QUARTILE,a.nk.bind(a));c.on(b,d.MIDPOINT,a.um.bind(a));c.on(b,d.THIRD_QUARTILE,a.uk.bind(a));c.on(b,d.PAUSED,a.wm.bind(a));c.on(b,d.RESUMED,a.xm.bind(a));c.on(b,d.CLICK,a.mk.bind(a));c.on(b,d.SKIPPED,a.sk.bind(a));c.on(b,d.IMPRESSION,a.pk.bind(a));c.on(b,d.COMPLETE,a.rm.bind(a));c.on(b,
5
+ d.CONTENT_RESUME_REQUESTED,a.Hm.bind(a))},GT=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},IT=function(a){a.o=null;HT(a,_.Ic);a.m.getSurface().hide(a.L)},JT=function(a){_.Kq(a.l,{visibility:"visible"})},HT=function(a,b,c){c=c&&c.getAd();var d=null;c&&(d={ad:new BT(c,a.B,a.A)});a.m.trigger(new _.L(b,d))},KT=function(a,b){var c=b?a.P.create(b.getErrorCode()):null;a.m.onError(new _.O(1,9,10003,{errorType:c},b))},LT=function(a){return!1===a.G.disableCustomPlayback&&a.a.isCustomPlaybackUsed()&&
7
+ _.vk()},NT=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&&!LT(a))return HT(a,_.fd),a.g.warn(_.la),d["return"]();MT(a);_.B(d)})},OT=function(a,b){return _.I(function(c){if(1==c.a)return a.M.initialize(),_.y(c,b.play(),2);MT(a);_.B(c)})},MT=function(a){a.a.init(a.l.offsetWidth,a.l.offsetHeight,google.ima.ViewMode.NORMAL);a.a.start();a.K=!0},PT=function(){this.a=this.h=this.f=null},QT=function(){return!window.google||
8
+ !google.ima||!google.ima.AdsLoader},RT=function(){},ST=function(){this.jd=new _.K(AT)};_.u=BT.prototype;_.u.ob=function(){return"Google IMA SDK"};_.u.pb=function(){return google.ima.VERSION};_.u.sb=function(){return 0};_.u.getId=function(){return this.a.getAdId()};_.u.getCreativeId=function(){return this.a.getCreativeId()};_.u.Sb=function(){return""};_.u.getApiFramework=function(){return this.a.getApiFramework()};_.u.getAdSystem=function(){return this.a.getAdSystem()};_.u.getAdvertiserName=function(){return this.a.getAdvertiserName()};
9
+ _.u.getTitle=function(){return this.a.getTitle()};_.u.getDuration=function(){return this.a.getDuration()};_.u.getPosition=function(){return 0};_.u.getSkipTimeOffset=function(){return this.a.getSkipTimeOffset()};_.u.Wb=function(){return this.f?this.f.getIsBumper():!1};_.u.qb=function(){var a=null,b=this.a,c=Object.keys(b).find(function(d){return typeof b[d]===_.Xe&&typeof b[d].clickThroughUrl===_.ig});c&&(a=b[c].clickThroughUrl);return a};_.u.getMediaUrl=function(){return this.a.getMediaUrl()};
10
+ _.u.fb=function(){return this.a.getVastMediaWidth()};_.u.eb=function(){return this.a.getVastMediaHeight()};_.u.Qa=function(){return this.a.getVastMediaBitrate()};_.u.Ra=function(){return this.h?2:this.j?1:0};_.u.getPodIndex=function(){return this.f?this.f.getPodIndex():0};_.u.Fb=function(){return this.f?this.f.getTimeOffset():0};_.u.Gb=function(){return this.f?this.f.getAdPosition():1};_.u.gb=function(){return this.f?this.f.getTotalAds():1};_.u.getWrapperAdIds=function(){return this.a.getWrapperAdIds()};
11
+ _.u.getWrapperAdSystems=function(){return this.a.getWrapperAdSystems()};_.u.getWrapperCreativeIds=function(){return this.a.getWrapperCreativeIds()};_.u.Vb=function(){return null};BT.prototype.getVideoElement=BT.prototype.Vb;BT.prototype.getWrapperCreativeIds=BT.prototype.getWrapperCreativeIds;BT.prototype.getWrapperAdSystems=BT.prototype.getWrapperAdSystems;BT.prototype.getWrapperAdIds=BT.prototype.getWrapperAdIds;BT.prototype.getSequenceLength=BT.prototype.gb;BT.prototype.getPositionInSequence=BT.prototype.Gb;
12
+ BT.prototype.getPodTimeOffset=BT.prototype.Fb;BT.prototype.getPodIndex=BT.prototype.getPodIndex;BT.prototype.getPodType=BT.prototype.Ra;BT.prototype.getMediaBitrate=BT.prototype.Qa;BT.prototype.getMediaHeight=BT.prototype.eb;BT.prototype.getMediaWidth=BT.prototype.fb;BT.prototype.getMediaUrl=BT.prototype.getMediaUrl;BT.prototype.getClickThroughUrl=BT.prototype.qb;BT.prototype.isBumper=BT.prototype.Wb;BT.prototype.getSkipTimeOffset=BT.prototype.getSkipTimeOffset;BT.prototype.getPosition=BT.prototype.getPosition;
13
+ BT.prototype.getDuration=BT.prototype.getDuration;BT.prototype.getTitle=BT.prototype.getTitle;BT.prototype.getAdvertiserName=BT.prototype.getAdvertiserName;BT.prototype.getAdSystem=BT.prototype.getAdSystem;BT.prototype.getApiFramework=BT.prototype.getApiFramework;BT.prototype.getSourceId=BT.prototype.Sb;BT.prototype.getCreativeId=BT.prototype.getCreativeId;BT.prototype.getId=BT.prototype.getId;BT.prototype.getTechnology=BT.prototype.sb;BT.prototype.getAdManagerVersion=BT.prototype.pb;
14
+ BT.prototype.getAdManagerName=BT.prototype.ob;CT.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}};DT.prototype.getCuePoints=function(){return this.a};DT.prototype.Ib=function(){return 0<=this.a.indexOf(0)||0===this.a.length};DT.prototype.Hb=function(){return 0<=this.a.indexOf(-1)};DT.prototype.hasPostroll=DT.prototype.Hb;DT.prototype.hasPreroll=DT.prototype.Ib;DT.prototype.getCuePoints=DT.prototype.getCuePoints;_.u=ET.prototype;
15
+ _.u.zm=function(a){var b=this;this.a=a.getAdsManager(this.l,GT(this));this.a.isCustomPlaybackUsed()&&!LT(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.sc()):(this.h=new _.Au(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 DT(a),this.m.trigger(new _.L(_.Lc,{adsTimeline:this.w})),FT(this));this.f.resolve()};
16
+ _.u.ym=function(a){KT(this,a.getError());this.f.resolve()};_.u.Gm=function(a){var b=this;return _.I(function(c){switch(c.a){case 1:return b.C=!0,LT(b)?(b.I=b.m.getPosition(),_.y(c,b.m.detach(),5)):_.y(c,b.m.pause(),4);case 4:_.Kq(b.l,{visibility:_.we});c.F(3);break;case 5:var d=b.m;d.a&&d.a.stopForwardingEventsTo(d);case 3:HT(b,_.rc,a),b.h.start(),_.B(c)}})};_.u.pm=function(){var a=this;return _.I(function(b){a.a.start();_.B(b)})};
17
+ _.u.qk=function(a){a.getAd().isLinear()?HT(this,_.Bc,a):(this.a.discardAdBreak(),this.B||(this.B=!0,this.m.play()))};_.u.tk=function(a){this.o=a.getAd().getDuration();HT(this,_.Hc,a);this.m.getSurface().show(this.L)};_.u.tm=function(a){a=a.getAdData();KT(this,a?a.adError:null);IT(this)};_.u.rk=function(a){HT(this,_.Ec,a)};_.u.qm=function(a){HT(this,_.tc,a)};_.u.nk=function(a){HT(this,_.wc,a)};_.u.um=function(a){HT(this,_.Cc,a)};_.u.uk=function(a){HT(this,_.Jc,a)};_.u.wm=function(a){HT(this,_.Dc,a)};
18
+ _.u.xm=function(a){HT(this,_.Fc,a)};_.u.mk=function(a){this.pause();HT(this,_.uc,a)};_.u.sk=function(a){HT(this,_.Gc,a);IT(this)};_.u.pk=function(a){HT(this,_.Ac,a)};_.u.rm=function(a){HT(this,_.vc,a);IT(this)};
19
+ _.u.Hm=function(){var a=this;return _.I(function(b){switch(b.a){case 1:a.B=!0;if(!LT(a)||null===a.I){if(!a.C)return b["return"](a.m.play());JT(a);b.F(2);break}var c=a.m;c.a&&c.a.forwardEventsTo(c);return _.y(b,_.ct(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:HT(a,_.sc),_.B(b)}})};_.u.Fm=function(){this.A=!0;this.j.contentComplete()};
20
+ _.u.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!==_.ig)throw new _.O(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)})};_.u.start=function(a){var b=this;return _.I(function(c){return b.a&&b.w&&!b.K?b.w.Ib()?_.y(c,NT(b),0):_.y(c,OT(b,a),0):_.y(c,a.play(),0)})};_.u.Vc=function(){};_.u.Sc=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)};
22
+ _.u.getPosition=function(){if(!this.a||null===this.o)return-1;var a=this.a.getRemainingTime();return 0>a?0:this.o-a};_.u.sc=function(){this.a&&(this.a.destroy(),this.a=null);JT(this);this.H.release();this.h&&(this.h.stop(),this.h=null);return Promise.resolve()};ET.prototype.getPosition=ET.prototype.getPosition;ET.prototype.setVolume=ET.prototype.setVolume;ET.prototype.getVolume=ET.prototype.getVolume;ET.prototype.skip=ET.prototype.skip;ET.prototype.pause=ET.prototype.pause;ET.prototype.resume=ET.prototype.resume;_.x(PT,_.Gv);_.u=PT.prototype;_.u.onPlayerCreated=function(a){if(QT())return a.onError(new _.O(1,9,1E4));this.f=_.Iq(_.Xd,{"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(_.ta);this.a.getSettings().setPlayerVersion(_.ha);this.a.getSettings().setAutoPlayAdBreaks(!0)};
23
+ _.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.cd=function(){return this.f};_.u.id=function(){return"ima"};_.J("clpp.ima.ImaPlugin",PT);PT.prototype.getAdContainer=PT.prototype.cd;PT.prototype.getAdDisplayContainer=PT.prototype.vl;PT.prototype.getAdsLoader=PT.prototype.xl;PT.Id="ima";
24
+ PT.isSdkMissing=QT;RT.prototype.create=function(){return new PT};_.gt(new RT);ST.prototype.name=function(){return AT};ST.prototype.a=function(a,b){return a.namespace()===_.zd?!1:QT()?(this.jd.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)};ST.prototype.create=function(a){return new ET(a)};_.Cq(new ST);};
25
25
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
26
26
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
27
27
  else{_=this.clpp._;(f.call(g,this));}