@castlabs/prestoplay 6.20.0 → 6.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +7 -7
  5. package/cjs/cl.cast.js +109 -110
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +553 -550
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +78 -77
  10. package/cjs/cl.externs.js +81 -97
  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 +29 -29
  15. package/cjs/cl.ima.js +22 -24
  16. package/cjs/cl.mse.js +305 -305
  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 +25 -25
  25. package/cjs/cl.tizen.js +70 -69
  26. package/cjs/cl.ttml.js +29 -29
  27. package/cjs/cl.verimatrix.js +5 -5
  28. package/cjs/cl.vimond.js +13 -13
  29. package/cjs/cl.vr.js +18 -18
  30. package/cjs/cl.vtt.js +14 -14
  31. package/cjs/cl.yospace.js +9 -0
  32. package/cjs/cl.youbora.js +38 -20
  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 -89
  37. package/cl.conviva.js +27 -27
  38. package/cl.core.js +471 -468
  39. package/cl.crypto.js +8 -8
  40. package/cl.dash.js +74 -72
  41. package/cl.externs.js +71 -99
  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 +16 -17
  47. package/cl.mse.js +276 -276
  48. package/cl.muxdata.js +13 -13
  49. package/cl.onboard.js +4 -4
  50. package/cl.persistent.js +11 -11
  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 +14 -14
  61. package/cl.vtt.js +12 -12
  62. package/cl.yospace.js +3 -0
  63. package/cl.youbora.js +27 -15
  64. package/package.json +3 -1
  65. package/typings.d.ts +123 -24
package/cjs/cl.htmlcue.js CHANGED
@@ -1,33 +1,33 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var nS="CLPP Subtitle Styles",oS="Unsupported unit",pS="clpp-text-plain",qS="clpp-text-ttml",rS="clpp.htmlcue.HtmlTextDisplayer",sS="initial",tS=function(a){return _.xi(a,{ih:function(b,c){return b.la(c)}})},uS=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)},vS=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},wS=function(){},xS=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},zS=function(a){for(var b=null;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],function(c){return yS[c]});return a},BS=function(a,b){AS(a,b);Array.from(b.getElementsByTagName("*")).forEach(function(c){AS(a,c)})},AS=function(a,b){for(var c in a)null!=a[c]&&(b.style[c]=a[c])},CS=function(a,b){return 0===a?"0":a+b},DS=function(a,b){return 1>Math.abs(a-b)||a<b},ES=function(a,b){return a<b&&
4
- 1<Math.abs(a-b)},FS=function(a,b){return a>b&&1<Math.abs(a-b)},GS=function(a,b){return 1>Math.abs(a-b)||a>b},HS=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},IS=function(a){return new HS(a.left,a.f,a.top,a.a,a.height,a.width)},JS=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 HS(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-d-e)},KS=function(a,b){return b.some(function(c){return ES(a.left,c.f)&&FS(a.f,c.left)&&ES(a.top,c.a)&&FS(a.a,c.top)})},LS=function(a,b){return GS(a.top,b.top)&&DS(a.a,b.a)&&GS(a.left,b.left)&&DS(a.f,b.f)},MS=function(a,b,c){switch(c){case "+x":return ES(a.left,b.left);case "-x":return FS(a.f,b.f);
6
- case "+y":return ES(a.top,b.top);case "-y":return FS(a.a,b.a);default:throw Error("Unknown axis");}},NS=function(a,b,c){this.id=a;this.w=b;this.B=c;this.a=this.o();this.j=!1},OS=function(a,b,c){NS.call(this,a.id,"clpp-text-cue",{});this.l=b;this.f=a;this.h=!!this.f.backgroundImage;this.C=c},QS=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 PS(a)?b:c},TS=function(a,b,c){return PS(a)&&_.M.sa(c)?CS(c,_.If):(RS(a)||
7
- SS(a))&&_.M.sa(b)?CS(b,"%"):sS},RS=function(a){return a.f.writingMode===_.Bg},SS=function(a){return a.f.writingMode===_.Cg},PS=function(a){return a.f.writingMode===_.Bi},US=function(a,b,c){return(RS(a)||SS(a))&&_.M.sa(c)?CS(c,_.If):RS(a)&&_.M.R(c)?CS(0,_.If):PS(a)&&_.M.sa(b)?CS(b,"%"):sS},VS=function(a,b){if(typeof a.f.position===_.k&&typeof a.f.size===_.k)switch(b){case _.Be:return a.f.position;case "auto":case _.sd:return a.f.position-a.f.size/2;case _.Ce:return a.f.position-a.f.size}return 0},
8
- WS=function(a){switch(a.f.positionAlign){case _.Be:return _.ye;case "auto":case _.sd:return _.Ai;case _.Ce:return _.Pf}return a.f.textAlign},XS=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.ye:case _.ye:return _.Be;case _.Ai:return _.sd;case _.Pf:case _.Pf:return _.Ce}return a.f.positionAlign},YS=function(a){switch(a.f.writingMode){case _.Bi:return"horizontal-tb";case _.Bg:return _.Bg;case _.Cg:return _.Cg;default:throw Error("Unknown writing mode");}},ZS=function(a,b){this.l=a;this.f=
9
- a.a;this.j=void 0===b?!1:b;this.a=JS(a.a);this.h=[]},$S=function(a,b){if(a.j)switch(b.writingMode){case _.Bi:return["-y"];case _.Bg:return["+x"];case _.Cg:return["-x"]}var c=[];switch(b.writingMode){case _.Bi:c=["+y","-y"];break;case _.Bg:c=["+x","-x"];break;case _.Cg:c=["-x","+x"]}0>b.line&&(c=c.reverse());return c},aT=function(a){for(a.h=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=JS(a.l.a)},bT=function(a,b,c){NS.call(this,a,b,c);this.h=null;this.l=[]},cT=function(a,b){aT(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)},dT=function(a,b){bT.call(this,a.id,"clpp-text-cue-region",b);this.f=a},eT=function(a,b,c){a=a.f;var d=a.viewportAnchorUnits;if(d===_.Gi)return a.viewportAnchorY/100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(oS);},gT=function(a){this.g=new _.K("clpp.htmlcue.StyleManager");this.j=[];this.h=a;this.l=[];this.a=fT(this,this.h);this.f=fT(this,this.h,!0);this.f.disabled=!0;this.g.debug("Stylesheet CLPP Subtitle Styles has been created.")},
11
- hT=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},iT=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)},fT=function(a,b,c){var d=document.createElement(_.hg),e=d.dataset;e.name=nS;e["for"]=b;c&&(e.name="CLPP Subtitle Styles (sandbox)",e.sandbox=!0);b=document.head;b.appendChild(d);jT(a,b);a.g.debug("Created HTML style element #CLPP Subtitle Styles.");return d.sheet},jT=function(a,b){var c=new MutationObserver(function(d){d.forEach(function(e){e.removedNodes.forEach(function(f){f.id===nS&&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()})},mT=function(a){_.Vu.call(this,a);var b=this;this.g=new _.K(rS);this.m=a;this.L=kT(a.getConfiguration());this.j=!1;this.f=[];this.C=a.getSurface().getContainer();this.h=new gT(a.getSurface().getUniqueCssClass());this.a=new bT(null,"clpp-text-container",{});this.w=new _.Zt(a.getSurface(),this.Sj.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 _.ll(function(){lT(b)});this.A=new Map;this.l=null},kT=function(a){a=_.M.$a(a.htmlcue||{});_.M.R(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.M.R(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},nT=function(a,b){return a.startTime<=b&&a.endTime>b},lT=function(a,b){if((b||a.j)&&a.C){var c=a.m.getPosition();if(b||a.J!==c&&a.m.getState()===_.Mp){a.J=c;var d=oT(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,pT(a),
15
- d)){c={color:a.getFontColor()||void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.$u(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 _.Kg:h="clpp-text-vtt";break;case _.pg:h=qS;break;case _.zi:h=pS}h&&!g.classList.contains(h)&&_.mq(g,h);g=JS(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{AS({fontSize:qT(f,e.containerRows)},f.a.a);g=null;h=e.payloadType===_.Kg;var l=e.payloadType===_.pg;e.region&&(h||l||e.backgroundImage)&&(f.A.has(e.region.id)?g=f.A.get(e.region.id):(g=new dT(e.region,{}),f.A.set(e.region.id,g),cT(f.a,g)));e=new OS(e,f.L,c);g?cT(g,e):cT(f.a,e)}}}}}},oT=function(a,b){var c=vS(a.f,function(e){return nT(e,b)?0:b!==e.startTime?b-e.startTime:b-e.endTime});if(-1===c)return null;for(var d=c;0<=d-1&&nT(a.f[d-1],b);)d--;for(;c+1<a.f.length&&nT(a.f[c+1],b);)c++;return{start:d,
17
- end:c}},rT=function(a){pT(a);a.J=null;a.l=null;a.f=[]},pT=function(a){a.A.clear();if(a.a){var b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(qS);b.classList.remove(pS);a=a.a;aT(a.h);a.l=[]}},qT=function(a,b){var c=JS(a.a.a).height;if(null!==a.I)return a.getFontSize();if(null!==a.B){var d=a.getFontSizePercent();return Math.round(c*d)+_.If}if(typeof b===_.k&&0<b)return Math.round(c/b)+_.If;d=a.getFontSizePercent();return Math.round(c*d)+_.If},sT=function(){},tT=function(){};
18
- wS.prototype.parse=function(a){a={input:a};for(var b=_.oq(_.Wd),c=[],d=b,e;null!==(e=xS(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=uT[f];h?(h=_.oq(h),(f=vT[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||wT[g.localName]&&wT[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(zS(e)));return b};var uT={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},vT={v:"voice",lang:"lang"},wT={rt:"ruby"},yS={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f","\x26nbsp;":"\u00a0"};NS.prototype.init=function(){this.j=!0};NS.prototype.A=function(){return!1};_.x(OS,NS);OS.prototype.A=function(){return!this.h&&!(this.f.region&&this.f.region.displayAlign)};
20
- OS.prototype.init=function(a){NS.prototype.init.call(this,a);if(this.h)_.mq(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===_.pg){var c=_.oq(_.Wd);c.innerHTML=b.payload;b=c}else b.payloadType===_.Kg?b=(new wS).parse(b.payload):(c=_.oq(_.Wd),c.textContent=b.payload,b=c);_.mq(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())_.mq(b,d.value);AS({writingMode:YS(this)},b);this.a.appendChild(b);_.mq(this.a,"clpp-text-wrapper");c=_.w(this.f.cssClassList);for(d=c.next();!d.done;d=c.next())_.mq(this.a,"clpp-text-wrapper__"+d.value);_.M.R(this.f.line)&&(this.f.lineInterpretation=_.Ci,this.f.line=PS(this)?-1:0);c=YS(this);AS({writingMode:c,webkitWritingMode:c,direction:sS,textAlign:WS(this)},this.a);if(!this.f.region||!this.f.region.displayAlign){c=VS(this,XS(this));d=US(this,c,null);var e=TS(this,
22
- c,null),f=SS(this)&&_.M.R(null)?CS(0,_.If):sS;AS({position:"absolute",left:d,right:f,top:e,width:PS(this)?CS(this.f.size,"%"):sS,height:RS(this)||SS(this)?CS(this.f.size,"%"):sS},this.a);d=this.f;a=PS(this)?a.height:a.width;e=QS(this);if(d.lineInterpretation===_.Ci)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 _.le:g-=f}f=Math.round(g/100*a)}SS(this)&&(f=a-f-e);a=f;d=US(this,c,a);e=SS(this)&&_.M.R(a)?
23
- CS(0,_.If):sS;AS({left:d,right:e,top:TS(this,c,a)},this.a)}BS(this.C,b)}};OS.prototype.o=function(){return _.oq(_.Wd)};ZS.prototype.append=function(a){var b=a.a;b.style.visibility=_.te;this.f.appendChild(b);a.j||a.init(this.a);if(a.A()){a:{var c=JS(a.a);var d=$S(this,a.f),e=QS(a),f=IS(c),g=null,h=0;d=_.w(d);for(var l=d.next();!l.done;l=d.next()){for(l=l.value;MS(c,this.a,l)||LS(c,this.a)&&KS(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||LS(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=IS(c),h=l);c=IS(f)}c=g||f}AS({top:CS(c.top-this.a.top,_.If),bottom:CS(this.a.a-c.a,_.If),left:CS(c.left-this.a.left,_.If),right:CS(this.a.f-c.f,_.If),height:CS(c.height,_.If),width:CS(c.width,_.If)},a.a)}b.style.visibility="visible";this.h.push(JS(a.a))};_.x(bT,NS);bT.prototype.init=function(){this.h=new ZS(this);this.j=!0};bT.prototype.o=function(){var a=_.oq(_.Wd);_.mq(a,this.w);this.id&&(a.id=this.id);return a};_.x(dT,bT);
25
- dT.prototype.init=function(a){a:{var b=this.f;switch(b.widthUnits){case 0:b=b.width;break a;case _.Gi:b=b.width/100*a.width;break a;default:throw Error(oS);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.Gi)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(oS);d=a.height;var e=eT(this,d,a.height);AS(this.B,this.a);AS({left:CS(c,_.If),top:CS(e,_.If),width:CS(b,_.If),height:CS(d,_.If)},this.a);this.f.writingMode&&AS({display:"flex",
26
- "flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&AS({"justify-content":this.f.displayAlign},this.a);b=_.w(this.f.cssClassList);for(c=b.next();!c.done;c=b.next())_.mq(this.a,c.value);a:switch(b=this.f,b.heightUnits){case 0:b=b.height;break a;case _.Gi:b=b.height/100*a.height;break a;case 2:b=b.height;d=new OS(new _.Fi(0,1,"Lorem ipsum",_.zi),{},{});c=d.a;this.a.appendChild(c);d.init(JS(this.a));d=c.getBoundingClientRect().height;this.a.removeChild(c);b*=d;break a;default:throw Error(oS);
27
- }a=eT(this,b,a.height);AS({top:CS(a,_.If),height:CS(b,_.If)},this.a);this.h=new ZS(this,!0);this.j=!0};dT.prototype.getId=function(){return this.f.id};gT.prototype.appendRule=function(a){if(null!=this.a&&!this.l.some(function(c){return c===a})){var b=iT(this,a);if(hT(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
- gT.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(mT,_.Vu);_.u=mT.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=uS(this.f,tS(a));this.l=null;lT(this,!1)}};_.u.Mb=function(){null==this.h||lT(this,!0)};
29
- _.u.destroy=function(){var a=this;return _.I(function(b){if(1==b.a){if(null==a.h)return b["return"]();rT(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;lT(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.xb(.25),this.L.enableResizeObserver&&this.w.start(),lT(this,!0)):(this.G.stop(),this.w.stop(),rT(this)))};_.u.Sj=function(){lT(this,!0)};_.J(rS,mT);mT.prototype.setTextVisibility=mT.prototype.setTextVisibility;mT.prototype.isTextVisible=mT.prototype.isTextVisible;mT.prototype.remove=mT.prototype.remove;mT.prototype.destroy=mT.prototype.destroy;mT.prototype.append=mT.prototype.append;sT.prototype.a=function(a){return!!a.enableHtmlCue&&!_.ul()};sT.prototype.create=function(a){return new mT(a)};_.x(tT,_.it);tT.prototype.f=function(){_.lp(_.ue,new sT)};tT.prototype.a=function(){_.jp.has(_.ue)&&(_.jp["delete"](_.ue),_.kp.info("Removed factory: 'html'"))};tT.prototype.id=function(){return _.jg};_.J("clpp.htmlcue.HtmlCueComponent",tT);};
2
+ var f=function(window){var YS="CLPP Subtitle Styles",ZS="Unsupported unit",$S="clpp-text-plain",aT="clpp-text-ttml",bT="clpp.htmlcue.HtmlTextDisplayer",cT="initial",dT=function(a){return _.zi(a,{mh:function(b,c){return b.ma(c)}})},eT=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)},fT=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},gT=function(){},hT=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},jT=function(a){for(var b=null;b=a.match(/&(amp|lt|gt|lrm|rlm|nbsp);/);)a=a.replace(b[0],function(c){return iT[c]});return a},lT=function(a,b){kT(a,b);Array.from(b.getElementsByTagName("*")).forEach(function(c){kT(a,c)})},kT=function(a,b){for(var c in a)null!=a[c]&&(b.style[c]=a[c])},mT=function(a,b){return 0===a?"0":a+b},nT=function(a,b){return 1>Math.abs(a-b)||a<b},oT=function(a,b){return a<b&&
4
+ 1<Math.abs(a-b)},pT=function(a,b){return a>b&&1<Math.abs(a-b)},qT=function(a,b){return 1>Math.abs(a-b)||a>b},rT=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},sT=function(a){return new rT(a.left,a.f,a.top,a.a,a.height,a.width)},tT=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 rT(b.left+d,b.right+e,g,(b.bottom||g+f)+c,f,(b.width||a.offsetWidth)-d-e)},uT=function(a,b){return b.some(function(c){return oT(a.left,c.f)&&pT(a.f,c.left)&&oT(a.top,c.a)&&pT(a.a,c.top)})},vT=function(a,b){return qT(a.top,b.top)&&nT(a.a,b.a)&&qT(a.left,b.left)&&nT(a.f,b.f)},wT=function(a,b,c){switch(c){case "+x":return oT(a.left,b.left);case "-x":return pT(a.f,b.f);
6
+ case "+y":return oT(a.top,b.top);case "-y":return pT(a.a,b.a);default:throw Error("Unknown axis");}},xT=function(a,b,c){this.id=a;this.w=b;this.B=c;this.a=this.o();this.j=!1},yT=function(a,b,c){xT.call(this,a.id,"clpp-text-cue",{});this.l=b;this.f=a;this.h=!!this.f.backgroundImage;this.C=c},AT=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 zT(a)?b:c},DT=function(a,b,c){return zT(a)&&_.M.sa(c)?mT(c,_.If):(BT(a)||
7
+ CT(a))&&_.M.sa(b)?mT(b,"%"):cT},BT=function(a){return a.f.writingMode===_.Ag},CT=function(a){return a.f.writingMode===_.Bg},zT=function(a){return a.f.writingMode===_.Di},ET=function(a,b,c){return(BT(a)||CT(a))&&_.M.sa(c)?mT(c,_.If):BT(a)&&_.M.R(c)?mT(0,_.If):zT(a)&&_.M.sa(b)?mT(b,"%"):cT},FT=function(a,b){if(typeof a.f.position===_.k&&typeof a.f.size===_.k)switch(b){case _.Be:return a.f.position;case "auto":case _.sd:return a.f.position-a.f.size/2;case _.Ce:return a.f.position-a.f.size}return 0},
8
+ GT=function(a){switch(a.f.positionAlign){case _.Be:return _.ye;case "auto":case _.sd:return _.Ci;case _.Ce:return _.Pf}return a.f.textAlign},HT=function(a){if(!a.f.positionAlign)switch(a.f.textAlign){case _.ye:case _.ye:return _.Be;case _.Ci:return _.sd;case _.Pf:case _.Pf:return _.Ce}return a.f.positionAlign},IT=function(a){switch(a.f.writingMode){case _.Di:return"horizontal-tb";case _.Ag:return _.Ag;case _.Bg:return _.Bg;default:throw Error("Unknown writing mode");}},JT=function(a,b){this.l=a;this.f=
9
+ a.a;this.j=void 0===b?!1:b;this.a=tT(a.a);this.h=[]},KT=function(a,b){if(a.j)switch(b.writingMode){case _.Di:return["-y"];case _.Ag:return["+x"];case _.Bg:return["-x"]}var c=[];switch(b.writingMode){case _.Di:c=["+y","-y"];break;case _.Ag:c=["+x","-x"];break;case _.Bg:c=["-x","+x"]}0>b.line&&(c=c.reverse());return c},LT=function(a){for(a.h=[];0<a.f.childNodes.length;)a.f.removeChild(a.f.childNodes[0]);a.a=tT(a.l.a)},MT=function(a,b,c){xT.call(this,a,b,c);this.h=null;this.l=[]},NT=function(a,b){LT(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)},OT=function(a,b){MT.call(this,a.id,"clpp-text-cue-region",b);this.f=a},PT=function(a,b,c){a=a.f;var d=a.viewportAnchorUnits;if(d===_.Ii)return a.viewportAnchorY/100*c-a.regionAnchorY/100*b;if(0===d)return a.viewportAnchorY-a.regionAnchorY;throw Error(ZS);},RT=function(a){this.g=new _.K("clpp.htmlcue.StyleManager");this.j=[];this.h=a;this.l=[];this.a=QT(this,this.h);this.f=QT(this,this.h,!0);this.f.disabled=!0;this.g.debug("Stylesheet CLPP Subtitle Styles has been created.")},
11
+ ST=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},TT=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)},QT=function(a,b,c){var d=document.createElement(_.hg),e=d.dataset;e.name=YS;e["for"]=b;c&&(e.name="CLPP Subtitle Styles (sandbox)",e.sandbox=!0);b=document.head;b.appendChild(d);UT(a,b);a.g.debug("Created HTML style element #CLPP Subtitle Styles.");return d.sheet},UT=function(a,b){var c=new MutationObserver(function(d){d.forEach(function(e){e.removedNodes.forEach(function(f){f.id===YS&&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()})},XT=function(a){_.fv.call(this,a);var b=this;this.g=new _.K(bT);this.m=a;this.L=VT(a.getConfiguration());this.j=!1;this.f=[];this.C=a.getSurface().getContainer();this.h=new RT(a.getSurface().getUniqueCssClass());this.a=new MT(null,"clpp-text-container",{});this.w=new _.ju(a.getSurface(),this.Vj.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 _.pl(function(){WT(b)});this.A=new Map;this.l=null},VT=function(a){a=_.M.bb(a.htmlcue||{});_.M.R(a.stretchSmpteImage)&&(a.stretchSmpteImage=!1);_.M.R(a.enableResizeObserver)&&(a.enableResizeObserver=!0);return a},YT=function(a,b){return a.startTime<=b&&a.endTime>b},WT=function(a,b){if((b||a.j)&&a.C){var c=a.m.getPosition();if(b||a.J!==c&&a.m.getState()===_.Up){a.J=c;var d=ZT(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,$T(a),
15
+ d)){c={color:a.getFontColor()||void 0,backgroundColor:a.getBackgroundColor()||void 0,fontFamily:a.getFontFamily()||void 0,textShadow:_.kv(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 _.Kg:h="clpp-text-vtt";break;case _.pg:h=aT;break;case _.Bi:h=$S}h&&!g.classList.contains(h)&&_.uq(g,h);g=tT(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{kT({fontSize:aU(f,e.containerRows)},f.a.a);g=null;h=e.payloadType===_.Kg;var l=e.payloadType===_.pg;e.region&&(h||l||e.backgroundImage)&&(f.A.has(e.region.id)?g=f.A.get(e.region.id):(g=new OT(e.region,{}),f.A.set(e.region.id,g),NT(f.a,g)));e=new yT(e,f.L,c);g?NT(g,e):NT(f.a,e)}}}}}},ZT=function(a,b){var c=fT(a.f,function(e){return YT(e,b)?0:b!==e.startTime?b-e.startTime:b-e.endTime});if(-1===c)return null;for(var d=c;0<=d-1&&YT(a.f[d-1],b);)d--;for(;c+1<a.f.length&&YT(a.f[c+1],b);)c++;return{start:d,
17
+ end:c}},bU=function(a){$T(a);a.J=null;a.l=null;a.f=[]},$T=function(a){a.A.clear();if(a.a){var b=a.a.a;b.classList.remove("clpp-text-vtt");b.classList.remove(aT);b.classList.remove($S);a=a.a;LT(a.h);a.l=[]}},aU=function(a,b){var c=tT(a.a.a).height;if(null!==a.I)return a.getFontSize();if(null!==a.B){var d=a.getFontSizePercent();return Math.round(c*d)+_.If}if(typeof b===_.k&&0<b)return Math.round(c/b)+_.If;d=a.getFontSizePercent();return Math.round(c*d)+_.If},cU=function(){},dU=function(){};
18
+ gT.prototype.parse=function(a){a={input:a};for(var b=_.wq(_.Wd),c=[],d=b,e;null!==(e=hT(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=eU[f];h?(h=_.wq(h),(f=fU[f])&&g&&h.setAttribute(f,g.trim()),g=h):g=null;!g||gU[g.localName]&&gU[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(jT(e)));return b};var eU={c:"c",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"v",lang:"lang"},fU={v:"voice",lang:"lang"},gU={rt:"ruby"},iT={"\x26amp;":"\x26","\x26lt;":"\x3c","\x26gt;":"\x3e","\x26lrm;":"\u200e","\x26rlm;":"\u200f","\x26nbsp;":"\u00a0"};xT.prototype.init=function(){this.j=!0};xT.prototype.A=function(){return!1};_.x(yT,xT);yT.prototype.A=function(){return!this.h&&!(this.f.region&&this.f.region.displayAlign)};
20
+ yT.prototype.init=function(a){xT.prototype.init.call(this,a);if(this.h)_.uq(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===_.pg){var c=_.wq(_.Wd);c.innerHTML=b.payload;b=c}else b.payloadType===_.Kg?b=(new gT).parse(b.payload):(c=_.wq(_.Wd),c.textContent=b.payload,b=c);_.uq(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())_.uq(b,d.value);kT({writingMode:IT(this)},b);this.a.appendChild(b);_.uq(this.a,"clpp-text-wrapper");c=_.w(this.f.cssClassList);for(d=c.next();!d.done;d=c.next())_.uq(this.a,"clpp-text-wrapper__"+d.value);_.M.R(this.f.line)&&(this.f.lineInterpretation=_.Ei,this.f.line=zT(this)?-1:0);c=IT(this);kT({writingMode:c,webkitWritingMode:c,direction:cT,textAlign:GT(this)},this.a);if(!this.f.region||!this.f.region.displayAlign){c=FT(this,HT(this));d=ET(this,c,null);var e=DT(this,
22
+ c,null),f=CT(this)&&_.M.R(null)?mT(0,_.If):cT;kT({position:"absolute",left:d,right:f,top:e,width:zT(this)?mT(this.f.size,"%"):cT,height:BT(this)||CT(this)?mT(this.f.size,"%"):cT},this.a);d=this.f;a=zT(this)?a.height:a.width;e=AT(this);if(d.lineInterpretation===_.Ei)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 _.le:g-=f}f=Math.round(g/100*a)}CT(this)&&(f=a-f-e);a=f;d=ET(this,c,a);e=CT(this)&&_.M.R(a)?
23
+ mT(0,_.If):cT;kT({left:d,right:e,top:DT(this,c,a)},this.a)}lT(this.C,b)}};yT.prototype.o=function(){return _.wq(_.Wd)};JT.prototype.append=function(a){var b=a.a;b.style.visibility=_.te;this.f.appendChild(b);a.j||a.init(this.a);if(a.A()){a:{var c=tT(a.a);var d=KT(this,a.f),e=AT(a),f=sT(c),g=null,h=0;d=_.w(d);for(var l=d.next();!l.done;l=d.next()){for(l=l.value;wT(c,this.a,l)||vT(c,this.a)&&uT(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||vT(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=sT(c),h=l);c=sT(f)}c=g||f}kT({top:mT(c.top-this.a.top,_.If),bottom:mT(this.a.a-c.a,_.If),left:mT(c.left-this.a.left,_.If),right:mT(this.a.f-c.f,_.If),height:mT(c.height,_.If),width:mT(c.width,_.If)},a.a)}b.style.visibility="visible";this.h.push(tT(a.a))};_.x(MT,xT);MT.prototype.init=function(){this.h=new JT(this);this.j=!0};MT.prototype.o=function(){var a=_.wq(_.Wd);_.uq(a,this.w);this.id&&(a.id=this.id);return a};_.x(OT,MT);
25
+ OT.prototype.init=function(a){a:{var b=this.f;switch(b.widthUnits){case 0:b=b.width;break a;case _.Ii:b=b.width/100*a.width;break a;default:throw Error(ZS);}}var c=this.f;var d=c.viewportAnchorUnits;if(d===_.Ii)c=c.viewportAnchorX/100*a.width-c.regionAnchorX/100*b;else if(0===d)c=c.viewportAnchorX-c.regionAnchorX;else throw Error(ZS);d=a.height;var e=PT(this,d,a.height);kT(this.B,this.a);kT({left:mT(c,_.If),top:mT(e,_.If),width:mT(b,_.If),height:mT(d,_.If)},this.a);this.f.writingMode&&kT({display:"flex",
26
+ "flex-direction":this.f.writingMode},this.a);this.f.displayAlign&&kT({"justify-content":this.f.displayAlign},this.a);b=_.w(this.f.cssClassList);for(c=b.next();!c.done;c=b.next())_.uq(this.a,c.value);a:switch(b=this.f,b.heightUnits){case 0:b=b.height;break a;case _.Ii:b=b.height/100*a.height;break a;case 2:b=b.height;d=new yT(new _.Hi(0,1,"Lorem ipsum",_.Bi),{},{});c=d.a;this.a.appendChild(c);d.init(tT(this.a));d=c.getBoundingClientRect().height;this.a.removeChild(c);b*=d;break a;default:throw Error(ZS);
27
+ }a=PT(this,b,a.height);kT({top:mT(a,_.If),height:mT(b,_.If)},this.a);this.h=new JT(this,!0);this.j=!0};OT.prototype.getId=function(){return this.f.id};RT.prototype.appendRule=function(a){if(null!=this.a&&!this.l.some(function(c){return c===a})){var b=TT(this,a);if(ST(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
+ RT.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.");_.A(b)})};_.x(XT,_.fv);_.u=XT.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=eT(this.f,dT(a));this.l=null;WT(this,!1)}};_.u.Mb=function(){null==this.h||WT(this,!0)};
29
+ _.u.destroy=function(){var a=this;return _.I(function(b){if(1==b.a){if(null==a.h)return b["return"]();bU(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;_.A(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;WT(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.yb(.25),this.L.enableResizeObserver&&this.w.start(),WT(this,!0)):(this.G.stop(),this.w.stop(),bU(this)))};_.u.Vj=function(){WT(this,!0)};_.J(bT,XT);XT.prototype.setTextVisibility=XT.prototype.setTextVisibility;XT.prototype.isTextVisible=XT.prototype.isTextVisible;XT.prototype.remove=XT.prototype.remove;XT.prototype.destroy=XT.prototype.destroy;XT.prototype.append=XT.prototype.append;cU.prototype.a=function(a){return!!a.enableHtmlCue&&!_.yl()};cU.prototype.create=function(a){return new XT(a)};_.x(dU,_.tt);dU.prototype.f=function(){_.tp(_.ue,new cU)};dU.prototype.a=function(){_.rp.has(_.ue)&&(_.rp["delete"](_.ue),_.sp.info("Removed factory: 'html'"))};dU.prototype.id=function(){return _.jg};_.J("clpp.htmlcue.HtmlCueComponent",dU);};
31
31
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
32
32
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
33
33
  else{_=this.clpp._;(f.call(g,this));}
package/cjs/cl.ima.js CHANGED
@@ -1,28 +1,26 @@
1
1
  (function(){var g={}; var _ = _ || {}
2
- var f=function(window){var UR="clpp.ima.AdsManagerFactory",VR=function(a,b,c){this.a=a;this.f=a.getAdPodInfo();this.j=b;this.h=c},WR=function(){},YR=function(a){this.a=a},ZR=function(a){var b=a.Nd("ima");if(!b)throw Error("IMA plugin not created.");var c=b.Zc(),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.w=e;a=this.m.getConfiguration();a=_.M.$a(a.ima||{});this.J=_.M.pa({disableCustomPlayback:!1},a);this.I=
3
- c;this.P=d;this.l=b;this.L=new _.au;this.g=new _.K("clpp.ima");this.h=this.a=null;this.f=new _.ek;this.H=!1;this.o=new _.Qh;this.V=new WR;this.A=null;this.N=this.G=this.B=this.C=!1;this.K=this.j=null;c=this.o;d=google.ima.AdErrorEvent.Type.AD_ERROR;c.one(this.l,google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.cm.bind(this));c.on(this.l,d,this.bm.bind(this));c.on(this.m,_.me,this.jm.bind(this))},$R=function(a){var b=a.a,c=a.o,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.Sl.bind(a));
4
- c.on(b,d.LOADED,a.Wj.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.km.bind(a));c.on(b,d.STARTED,a.Yj.bind(a));c.on(b,d.LOG,a.Wl.bind(a));c.on(b,d.AD_PROGRESS,a.$l.bind(a));c.on(b,d.AD_BUFFERING,a.Tl.bind(a));c.on(b,d.FIRST_QUARTILE,a.Uj.bind(a));c.on(b,d.MIDPOINT,a.Xl.bind(a));c.on(b,d.THIRD_QUARTILE,a.Zj.bind(a));c.on(b,d.PAUSED,a.Zl.bind(a));c.on(b,d.RESUMED,a.am.bind(a));c.on(b,d.CLICK,a.Tj.bind(a));c.on(b,d.SKIPPED,a.Xj.bind(a));c.on(b,d.IMPRESSION,a.Vj.bind(a));c.on(b,d.COMPLETE,a.Ul.bind(a));
5
- c.on(b,d.CONTENT_RESUME_REQUESTED,a.lm.bind(a));c.on(b,d.ALL_ADS_COMPLETED,a.em.bind(a))},aS=function(a){a=a.J;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=
6
- a.playAdsAfterTime);typeof a.useStyledLinearAds===_.id&&(b.useStyledLinearAds=a.useStyledLinearAds);b.uiElements=Array.isArray(a.uiElements)?a.uiElements:[];return b},cS=function(a){a.A=null;bS(a,_.Kc);a.m.getSurface().hide(a.I)},dS=function(a){_.nq(a.w,{visibility:"visible"})},bS=function(a,b,c){c=c&&c.getAd();var d=null;c&&(d={ad:new VR(c,a.C,a.B)});a.m.trigger(new _.L(b,d))},eS=function(a,b){var c=b?a.V.create(b.getErrorCode()):null;a.m.onError(new _.N(1,9,10003,{errorType:c},b))},fS=function(a){return!1===
7
- a.J.disableCustomPlayback&&a.a.isCustomPlaybackUsed()&&_.mk()},hS=function(a){var b,c;return _.I(function(d){if(1==d.a)return a.P.initialize(),b=!!a.m.getConfiguration().muted,_.y(d,a.L.canPlay(b),2);c=d.f;if(!c&&!fS(a))return bS(a,_.gd),a.g.warn(_.na),d["return"]();gS(a);_.B(d)})},iS=function(a,b){return _.I(function(c){if(1==c.a)return a.P.initialize(),_.y(c,b.play(),2);gS(a);_.B(c)})},gS=function(a){a.a.init(a.w.offsetWidth,a.w.offsetHeight,google.ima.ViewMode.NORMAL);a.a.start();a.H=!0},jS=function(){this.a=
8
- this.h=this.f=null},kS=function(){return!window.google||!google.ima||!google.ima.AdsLoader},lS=function(){},mS=function(){this.fd=new _.K(UR)};_.u=VR.prototype;_.u.jb=function(){return"Google IMA SDK"};_.u.kb=function(){return google.ima.VERSION};_.u.qb=function(){return 0};_.u.getId=function(){return this.a.getAdId()};_.u.getCreativeId=function(){return this.a.getCreativeId()};_.u.getApiFramework=function(){return this.a.getApiFramework()};_.u.getAdSystem=function(){return this.a.getAdSystem()};
9
- _.u.getAdvertiserName=function(){return this.a.getAdvertiserName()};_.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.Sb=function(){return this.f?this.f.getIsBumper():!1};_.u.yb=function(){var a=null,b=this.a,c=Object.keys(b).find(function(d){return typeof b[d]===_.Ue&&typeof b[d].clickThroughUrl===_.fg});c&&(a=b[c].clickThroughUrl);return a};
10
- _.u.getMediaUrl=function(){return this.a.getMediaUrl()};_.u.ob=function(){return this.a.getVastMediaWidth()};_.u.nb=function(){return this.a.getVastMediaHeight()};_.u.ab=function(){return this.a.getVastMediaBitrate()};_.u.Ua=function(){return this.h?2:this.j?1:0};_.u.getPodIndex=function(){return this.f?this.f.getPodIndex():0};_.u.Cb=function(){return this.f?this.f.getTimeOffset():0};_.u.Db=function(){return this.f?this.f.getAdPosition():1};_.u.pb=function(){return this.f?this.f.getTotalAds():1};
11
- _.u.getWrapperAdIds=function(){return this.a.getWrapperAdIds()};_.u.getWrapperAdSystems=function(){return this.a.getWrapperAdSystems()};_.u.getWrapperCreativeIds=function(){return this.a.getWrapperCreativeIds()};VR.prototype.getWrapperCreativeIds=VR.prototype.getWrapperCreativeIds;VR.prototype.getWrapperAdSystems=VR.prototype.getWrapperAdSystems;VR.prototype.getWrapperAdIds=VR.prototype.getWrapperAdIds;VR.prototype.getSequenceLength=VR.prototype.pb;VR.prototype.getPositionInSequence=VR.prototype.Db;
12
- VR.prototype.getPodTimeOffset=VR.prototype.Cb;VR.prototype.getPodIndex=VR.prototype.getPodIndex;VR.prototype.getPodType=VR.prototype.Ua;VR.prototype.getMediaBitrate=VR.prototype.ab;VR.prototype.getMediaHeight=VR.prototype.nb;VR.prototype.getMediaWidth=VR.prototype.ob;VR.prototype.getMediaUrl=VR.prototype.getMediaUrl;VR.prototype.getClickThroughUrl=VR.prototype.yb;VR.prototype.isBumper=VR.prototype.Sb;VR.prototype.getSkipTimeOffset=VR.prototype.getSkipTimeOffset;VR.prototype.getPosition=VR.prototype.getPosition;
13
- VR.prototype.getDuration=VR.prototype.getDuration;VR.prototype.getTitle=VR.prototype.getTitle;VR.prototype.getAdvertiserName=VR.prototype.getAdvertiserName;VR.prototype.getAdSystem=VR.prototype.getAdSystem;VR.prototype.getApiFramework=VR.prototype.getApiFramework;VR.prototype.getCreativeId=VR.prototype.getCreativeId;VR.prototype.getId=VR.prototype.getId;VR.prototype.getTechnology=VR.prototype.qb;VR.prototype.getAdManagerVersion=VR.prototype.kb;VR.prototype.getAdManagerName=VR.prototype.jb;WR.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}};YR.prototype.getCuePoints=function(){return this.a};YR.prototype.Fb=function(){return 0<=this.a.indexOf(0)||0===this.a.length};YR.prototype.Eb=function(){return 0<=this.a.indexOf(-1)};YR.prototype.hasPostroll=YR.prototype.Eb;YR.prototype.hasPreroll=YR.prototype.Fb;YR.prototype.getCuePoints=YR.prototype.getCuePoints;_.u=ZR.prototype;
14
- _.u.cm=function(a){var b=this;this.a=a.getAdsManager(this.w,aS(this));this.a.isCustomPlaybackUsed()&&!fS(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.pc()):(this.h=new _.Zt(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.j=new YR(a),this.m.trigger(new _.L(_.Nc,{adsTimeline:this.j})),$R(this));this.f.resolve()};
15
- _.u.bm=function(a){eS(this,a.getError());this.f.resolve()};_.u.km=function(a){var b=this;return _.I(function(c){switch(c.a){case 1:return b.G=!0,fS(b)?(b.K=b.m.getPosition(),_.y(c,b.m.detach(),5)):_.y(c,b.m.pause(),4);case 4:_.nq(b.w,{visibility:_.te});c.F(3);break;case 5:var d=b.m;d.a&&d.a.stopForwardingEventsTo(d);case 3:bS(b,_.uc,a),b.h.start(),_.B(c)}})};_.u.Sl=function(){var a=this;return _.I(function(b){a.a.start();_.B(b)})};
16
- _.u.Wj=function(a){a.getAd().isLinear()?bS(this,_.Dc,a):(this.a.discardAdBreak(),this.C||(this.C=!0,this.m.play()))};_.u.Yj=function(a){this.A=a.getAd().getDuration();bS(this,_.Jc,a);this.m.getSurface().show(this.I)};_.u.Wl=function(a){a=a.getAdData();eS(this,a?a.adError:null);cS(this)};_.u.$l=function(a){bS(this,_.Gc,a)};_.u.Tl=function(a){bS(this,_.wc,a)};_.u.Uj=function(a){bS(this,_.zc,a)};_.u.Xl=function(a){bS(this,_.Ec,a)};_.u.Zj=function(a){bS(this,_.Lc,a)};_.u.Zl=function(a){bS(this,_.Fc,a)};
17
- _.u.am=function(a){bS(this,_.Hc,a)};_.u.Tj=function(a){this.pause();bS(this,_.xc,a)};_.u.Xj=function(a){bS(this,_.Ic,a);cS(this)};_.u.Vj=function(a){bS(this,_.Cc,a)};_.u.Ul=function(a){bS(this,_.yc,a);cS(this)};
18
- _.u.lm=function(){var a=this;return _.I(function(b){switch(b.a){case 1:a.C=!0;if(!fS(a)||null===a.K){if(!a.G)return b["return"](a.m.play());dS(a);b.F(2);break}var c=a.m;c.a&&c.a.forwardEventsTo(c);return _.y(b,_.Cs(a.m),3);case 3:if(a.B){b.F(2);break}return _.y(b,a.m.seek(a.K),2);case 2:a.G=!1;a.h&&a.h.stop();if(a.B){b.F(6);break}return _.y(b,a.m.play(),6);case 6:bS(a,_.vc),_.B(b)}})};_.u.em=function(){this.N=!0};_.u.jm=function(){this.B=!0;this.l.contentComplete()};
19
- _.u.load=function(){var a=this,b,c,d,e,f;return _.I(function(g){if(1==g.a){b=a.m;c=a.J;try{if(typeof c.adTagUrl!==_.fg)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.L.canPlay(!1),2):(a.f.resolve(),g["return"](a.f))}if(3!=g.a)return d=g.f,_.y(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.l.getSettings().setAutoPlayAdBreaks(!1);a.l.requestAds(f);
20
- return g["return"](a.f)})};_.u.start=function(a){var b=this;return _.I(function(c){return b.a&&b.j&&!b.H?b.j.Fb()?_.y(c,hS(b),0):_.y(c,iS(b,a),0):_.y(c,a.play(),0)})};_.u.Tc=function(){};_.u.Pc=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)};
21
- _.u.getPosition=function(){if(!this.a||null===this.A)return-1;var a=this.a.getRemainingTime();return 0>a?0:this.A-a};
22
- _.u.pc=function(){var a=this;return(new Promise(function(b){a.H&&a.j&&a.j.Eb()&&!a.N?(a.o.one(a.a,google.ima.AdEvent.Type.ALL_ADS_COMPLETED,function(){b();a.m.getSurface().hide(a.I)}),_.Rh(a.o,a.a,[google.ima.AdEvent.Type.LOADED,google.ima.AdEvent.Type.STARTED],function(){a.a&&a.a.discardAdBreak()})):b();a.a.discardAdBreak();a.l.contentComplete()})).then(function(){dS(a);a.o.release();a.h&&(a.h.stop(),a.h=null);a.a&&(a.a.destroy(),a.a=null)})};ZR.prototype.getPosition=ZR.prototype.getPosition;
23
- ZR.prototype.setVolume=ZR.prototype.setVolume;ZR.prototype.getVolume=ZR.prototype.getVolume;ZR.prototype.skip=ZR.prototype.skip;ZR.prototype.pause=ZR.prototype.pause;ZR.prototype.resume=ZR.prototype.resume;_.x(jS,_.ev);_.u=jS.prototype;_.u.onPlayerCreated=function(a){if(kS())return a.onError(new _.N(1,9,1E4));this.f=_.lq(_.Wd,{"class":"clpp-ima clpp-hidden"});a.getSurface().addElementToContainer(this.f);this.h=new google.ima.AdDisplayContainer(this.f,a.getSurface().getMedia());this.a=new google.ima.AdsLoader(this.h);this.a.getSettings().setPlayerType(_.va);this.a.getSettings().setPlayerVersion(_.ja);this.a.getSettings().setAutoPlayAdBreaks(!0)};
24
- _.u.onPlayerWillDestroy=function(a){this.a&&(this.a.destroy(),this.a=null);this.h&&(this.h.destroy(),this.h=null);this.f&&(a.getSurface().removeElementFromContainer(this.f),this.f=null)};_.u.Zk=function(){return this.a};_.u.Xk=function(){return this.h};_.u.Zc=function(){return this.f};_.u.id=function(){return"ima"};_.J("clpp.ima.ImaPlugin",jS);jS.prototype.getAdContainer=jS.prototype.Zc;jS.prototype.getAdDisplayContainer=jS.prototype.Xk;jS.prototype.getAdsLoader=jS.prototype.Zk;jS.Id="ima";
25
- jS.isSdkMissing=kS;lS.prototype.create=function(){return new jS};_.Fs(new lS);mS.prototype.name=function(){return UR};mS.prototype.a=function(a,b){return a.namespace()===_.Ad?!1:kS()?(this.fd.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)};mS.prototype.create=function(a){return new ZR(a)};_.fq(new mS);};
2
+ var f=function(window){var FS="clpp.ima.AdsManagerFactory",GS=function(a,b,c){this.a=a;this.f=a.getAdPodInfo();this.j=b;this.h=c},HS=function(){},IS=function(a){this.a=a},JS=function(a){var b=a.Nd("ima");if(!b)throw Error("IMA plugin not created.");var c=b.Zc(),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.bb(a.ima||{});this.G=_.M.pa({disableCustomPlayback:!1},a);this.L=
3
+ c;this.N=d;this.j=b;this.J=new _.lu;this.g=new _.K("clpp.ima");this.h=this.a=null;this.f=new _.gk;this.K=!1;this.H=new _.Sh;this.P=new HS;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.fm.bind(this));c.on(this.j,d,this.em.bind(this));c.on(this.m,_.me,this.lm.bind(this))},KS=function(a){var b=a.a,c=a.H,d=google.ima.AdEvent.Type;c.on(b,d.AD_BREAK_READY,a.Vl.bind(a));c.on(b,
4
+ d.LOADED,a.Zj.bind(a));c.on(b,d.CONTENT_PAUSE_REQUESTED,a.mm.bind(a));c.on(b,d.STARTED,a.ak.bind(a));c.on(b,d.LOG,a.Zl.bind(a));c.on(b,d.AD_PROGRESS,a.cm.bind(a));c.on(b,d.AD_BUFFERING,a.Wl.bind(a));c.on(b,d.FIRST_QUARTILE,a.Xj.bind(a));c.on(b,d.MIDPOINT,a.$l.bind(a));c.on(b,d.THIRD_QUARTILE,a.bk.bind(a));c.on(b,d.PAUSED,a.bm.bind(a));c.on(b,d.RESUMED,a.dm.bind(a));c.on(b,d.CLICK,a.Wj.bind(a));c.on(b,d.SKIPPED,a.$j.bind(a));c.on(b,d.IMPRESSION,a.Yj.bind(a));c.on(b,d.COMPLETE,a.Xl.bind(a));c.on(b,
5
+ d.CONTENT_RESUME_REQUESTED,a.nm.bind(a))},LS=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},NS=function(a){a.o=null;MS(a,_.Kc);a.m.getSurface().hide(a.L)},OS=function(a){_.vq(a.l,{visibility:"visible"})},MS=function(a,b,c){c=c&&c.getAd();var d=null;c&&(d={ad:new GS(c,a.B,a.A)});a.m.trigger(new _.L(b,d))},PS=function(a,b){var c=b?a.P.create(b.getErrorCode()):null;a.m.onError(new _.N(1,9,10003,{errorType:c},b))},QS=function(a){return!1===a.G.disableCustomPlayback&&a.a.isCustomPlaybackUsed()&&
7
+ _.ok()},SS=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&&!QS(a))return MS(a,_.gd),a.g.warn(_.na),d["return"]();RS(a);_.A(d)})},TS=function(a,b){return _.I(function(c){if(1==c.a)return a.N.initialize(),_.y(c,b.play(),2);RS(a);_.A(c)})},RS=function(a){a.a.init(a.l.offsetWidth,a.l.offsetHeight,google.ima.ViewMode.NORMAL);a.a.start();a.K=!0},US=function(){this.a=this.h=this.f=null},VS=function(){return!window.google||
8
+ !google.ima||!google.ima.AdsLoader},WS=function(){},XS=function(){this.fd=new _.K(FS)};_.u=GS.prototype;_.u.nb=function(){return"Google IMA SDK"};_.u.ob=function(){return google.ima.VERSION};_.u.rb=function(){return 0};_.u.getId=function(){return this.a.getAdId()};_.u.getCreativeId=function(){return this.a.getCreativeId()};_.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.Tb=function(){return this.f?this.f.getIsBumper():!1};_.u.pb=function(){var a=null,b=this.a,c=Object.keys(b).find(function(d){return typeof b[d]===_.Ue&&typeof b[d].clickThroughUrl===_.fg});c&&(a=b[c].clickThroughUrl);return a};_.u.getMediaUrl=function(){return this.a.getMediaUrl()};
10
+ _.u.eb=function(){return this.a.getVastMediaWidth()};_.u.cb=function(){return this.a.getVastMediaHeight()};_.u.Pa=function(){return this.a.getVastMediaBitrate()};_.u.Qa=function(){return this.h?2:this.j?1:0};_.u.getPodIndex=function(){return this.f?this.f.getPodIndex():0};_.u.Cb=function(){return this.f?this.f.getTimeOffset():0};_.u.Db=function(){return this.f?this.f.getAdPosition():1};_.u.fb=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()};GS.prototype.getWrapperCreativeIds=GS.prototype.getWrapperCreativeIds;GS.prototype.getWrapperAdSystems=GS.prototype.getWrapperAdSystems;GS.prototype.getWrapperAdIds=GS.prototype.getWrapperAdIds;GS.prototype.getSequenceLength=GS.prototype.fb;GS.prototype.getPositionInSequence=GS.prototype.Db;GS.prototype.getPodTimeOffset=GS.prototype.Cb;
12
+ GS.prototype.getPodIndex=GS.prototype.getPodIndex;GS.prototype.getPodType=GS.prototype.Qa;GS.prototype.getMediaBitrate=GS.prototype.Pa;GS.prototype.getMediaHeight=GS.prototype.cb;GS.prototype.getMediaWidth=GS.prototype.eb;GS.prototype.getMediaUrl=GS.prototype.getMediaUrl;GS.prototype.getClickThroughUrl=GS.prototype.pb;GS.prototype.isBumper=GS.prototype.Tb;GS.prototype.getSkipTimeOffset=GS.prototype.getSkipTimeOffset;GS.prototype.getPosition=GS.prototype.getPosition;GS.prototype.getDuration=GS.prototype.getDuration;
13
+ GS.prototype.getTitle=GS.prototype.getTitle;GS.prototype.getAdvertiserName=GS.prototype.getAdvertiserName;GS.prototype.getAdSystem=GS.prototype.getAdSystem;GS.prototype.getApiFramework=GS.prototype.getApiFramework;GS.prototype.getCreativeId=GS.prototype.getCreativeId;GS.prototype.getId=GS.prototype.getId;GS.prototype.getTechnology=GS.prototype.rb;GS.prototype.getAdManagerVersion=GS.prototype.ob;GS.prototype.getAdManagerName=GS.prototype.nb;HS.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}};IS.prototype.getCuePoints=function(){return this.a};IS.prototype.Fb=function(){return 0<=this.a.indexOf(0)||0===this.a.length};IS.prototype.Eb=function(){return 0<=this.a.indexOf(-1)};IS.prototype.hasPostroll=IS.prototype.Eb;IS.prototype.hasPreroll=IS.prototype.Fb;IS.prototype.getCuePoints=IS.prototype.getCuePoints;_.u=JS.prototype;
14
+ _.u.fm=function(a){var b=this;this.a=a.getAdsManager(this.l,LS(this));this.a.isCustomPlaybackUsed()&&!QS(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.pc()):(this.h=new _.ju(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 IS(a),this.m.trigger(new _.L(_.Nc,{adsTimeline:this.w})),KS(this));this.f.resolve()};
15
+ _.u.em=function(a){PS(this,a.getError());this.f.resolve()};_.u.mm=function(a){var b=this;return _.I(function(c){switch(c.a){case 1:return b.C=!0,QS(b)?(b.I=b.m.getPosition(),_.y(c,b.m.detach(),5)):_.y(c,b.m.pause(),4);case 4:_.vq(b.l,{visibility:_.te});c.F(3);break;case 5:var d=b.m;d.a&&d.a.stopForwardingEventsTo(d);case 3:MS(b,_.uc,a),b.h.start(),_.A(c)}})};_.u.Vl=function(){var a=this;return _.I(function(b){a.a.start();_.A(b)})};
16
+ _.u.Zj=function(a){a.getAd().isLinear()?MS(this,_.Dc,a):(this.a.discardAdBreak(),this.B||(this.B=!0,this.m.play()))};_.u.ak=function(a){this.o=a.getAd().getDuration();MS(this,_.Jc,a);this.m.getSurface().show(this.L)};_.u.Zl=function(a){a=a.getAdData();PS(this,a?a.adError:null);NS(this)};_.u.cm=function(a){MS(this,_.Gc,a)};_.u.Wl=function(a){MS(this,_.wc,a)};_.u.Xj=function(a){MS(this,_.zc,a)};_.u.$l=function(a){MS(this,_.Ec,a)};_.u.bk=function(a){MS(this,_.Lc,a)};_.u.bm=function(a){MS(this,_.Fc,a)};
17
+ _.u.dm=function(a){MS(this,_.Hc,a)};_.u.Wj=function(a){this.pause();MS(this,_.xc,a)};_.u.$j=function(a){MS(this,_.Ic,a);NS(this)};_.u.Yj=function(a){MS(this,_.Cc,a)};_.u.Xl=function(a){MS(this,_.yc,a);NS(this)};
18
+ _.u.nm=function(){var a=this;return _.I(function(b){switch(b.a){case 1:a.B=!0;if(!QS(a)||null===a.I){if(!a.C)return b["return"](a.m.play());OS(a);b.F(2);break}var c=a.m;c.a&&c.a.forwardEventsTo(c);return _.y(b,_.Ms(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:MS(a,_.vc),_.A(b)}})};_.u.lm=function(){this.A=!0;this.j.contentComplete()};
19
+ _.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!==_.fg)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);
20
+ 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.Fb()?_.y(c,SS(b),0):_.y(c,TS(b,a),0):_.y(c,a.play(),0)})};_.u.Tc=function(){};_.u.Pc=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)};
21
+ _.u.getPosition=function(){if(!this.a||null===this.o)return-1;var a=this.a.getRemainingTime();return 0>a?0:this.o-a};_.u.pc=function(){this.a&&(this.a.destroy(),this.a=null);OS(this);this.H.release();this.h&&(this.h.stop(),this.h=null);return Promise.resolve()};JS.prototype.getPosition=JS.prototype.getPosition;JS.prototype.setVolume=JS.prototype.setVolume;JS.prototype.getVolume=JS.prototype.getVolume;JS.prototype.skip=JS.prototype.skip;JS.prototype.pause=JS.prototype.pause;JS.prototype.resume=JS.prototype.resume;_.x(US,_.pv);_.u=US.prototype;_.u.onPlayerCreated=function(a){if(VS())return a.onError(new _.N(1,9,1E4));this.f=_.tq(_.Wd,{"class":"clpp-ima clpp-hidden"});a.getSurface().addElementToContainer(this.f);this.h=new google.ima.AdDisplayContainer(this.f,a.getSurface().getMedia());this.a=new google.ima.AdsLoader(this.h);this.a.getSettings().setPlayerType(_.va);this.a.getSettings().setPlayerVersion(_.ja);this.a.getSettings().setAutoPlayAdBreaks(!0)};
22
+ _.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.bl=function(){return this.a};_.u.$k=function(){return this.h};_.u.Zc=function(){return this.f};_.u.id=function(){return"ima"};_.J("clpp.ima.ImaPlugin",US);US.prototype.getAdContainer=US.prototype.Zc;US.prototype.getAdDisplayContainer=US.prototype.$k;US.prototype.getAdsLoader=US.prototype.bl;US.Id="ima";
23
+ US.isSdkMissing=VS;WS.prototype.create=function(){return new US};_.Qs(new WS);XS.prototype.name=function(){return FS};XS.prototype.a=function(a,b){return a.namespace()===_.Ad?!1:VS()?(this.fd.warn("IMA SDK is not loaded."),!1):!(!b||!b.ima)};XS.prototype.create=function(a){return new JS(a)};_.nq(new XS);};
26
24
  if(typeof(module)!="undefined"&&module.exports){var x=require("./cl.core.js");_ = x._;(f.call(g,this));module.exports=g;}
27
25
  else if (typeof(define)!="undefined"&&define.amd) {define(["./cl.core"], function(c){_=c._;(f.call(g,this));return g;});}
28
26
  else{_=this.clpp._;(f.call(g,this));}