@castlabs/prestoplay 6.9.0 → 6.11.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 (60) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/cjs/cl.adobe.js +3 -3
  3. package/cjs/cl.airplay.js +3 -3
  4. package/cjs/cl.broadpeak.js +6 -6
  5. package/cjs/cl.cast.js +112 -111
  6. package/cjs/cl.conviva.js +33 -33
  7. package/cjs/cl.core.js +467 -432
  8. package/cjs/cl.crypto.js +9 -9
  9. package/cjs/cl.dash.js +72 -72
  10. package/cjs/cl.externs.js +143 -45
  11. package/cjs/cl.freewheel.js +24 -24
  12. package/cjs/cl.hls.js +78 -73
  13. package/cjs/cl.hlssmpte.js +6 -6
  14. package/cjs/cl.htmlcue.js +29 -31
  15. package/cjs/cl.ima.js +24 -24
  16. package/cjs/cl.mse.js +276 -275
  17. package/cjs/cl.muxdata.js +14 -15
  18. package/cjs/cl.onboard.js +3 -3
  19. package/cjs/cl.persistent.js +14 -14
  20. package/cjs/cl.playlist.js +6 -6
  21. package/cjs/cl.smooth.js +71 -71
  22. package/cjs/cl.thumbnails.js +24 -24
  23. package/cjs/cl.tizen.js +71 -71
  24. package/cjs/cl.ttml.js +29 -27
  25. package/cjs/cl.verimatrix.js +5 -5
  26. package/cjs/cl.vimond.js +13 -13
  27. package/cjs/cl.vr.js +19 -19
  28. package/cjs/cl.vtt.js +14 -14
  29. package/cjs/cl.youbora.js +20 -20
  30. package/cl.adobe.js +3 -3
  31. package/cl.airplay.js +3 -3
  32. package/cl.broadpeak.js +5 -5
  33. package/cl.cast.js +88 -88
  34. package/cl.conviva.js +27 -27
  35. package/cl.core.js +396 -365
  36. package/cl.crypto.js +9 -9
  37. package/cl.dash.js +68 -67
  38. package/cl.externs.js +139 -45
  39. package/cl.freewheel.js +19 -19
  40. package/cl.hls.js +64 -61
  41. package/cl.hlssmpte.js +5 -5
  42. package/cl.htmlcue.js +26 -25
  43. package/cl.ima.js +17 -17
  44. package/cl.mse.js +240 -242
  45. package/cl.muxdata.js +12 -12
  46. package/cl.onboard.js +4 -4
  47. package/cl.persistent.js +11 -11
  48. package/cl.playlist.js +5 -5
  49. package/cl.smooth.js +59 -58
  50. package/cl.thumbnails.js +17 -17
  51. package/cl.tizen.js +57 -57
  52. package/cl.ttml.js +22 -22
  53. package/cl.verimatrix.js +4 -4
  54. package/cl.vimond.js +8 -8
  55. package/cl.vr.js +14 -14
  56. package/cl.vtt.js +12 -12
  57. package/cl.youbora.js +15 -15
  58. package/clpp.styles.css +15 -0
  59. package/package.json +1 -1
  60. package/typings.d.ts +249 -21
package/cl.tizen.js CHANGED
@@ -1,57 +1,57 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var eF="An unknown error occurred while trying to get volume",fF="Cannot get loading rendition due to platform limitations",gF="SecurityError",hF="The require privilege is: http://tizen.org/privilege/tv.audio",iF="|STARTBITRATE\x3d",jF=function(a,b,c){const d=e=>{c.call(a,e);a.removeEventListener(b,d)};a.addEventListener(b,d)},mF=function(a){return _.y(function*(){if(a.a!==_.Ic&&a.a!==_.Hc)throw new _.H(_.G,6,6001,`The key system ${a.a} is not supported by `+"the player or the platform");
2
- const b=a.f.get(a.a);if(!b.Kc)throw new _.H(_.G,6,6012,`No license server given for ${a.a}`);try{a.a===_.Ic?yield kF(a):yield lF(a,b),a.o={keySystem:a.a,licenseServerUri:b.Kc,distinctiveIdentifierRequired:!1,persistentStateRequired:b.Vd,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],keyIds:[],periodId:null}}catch(c){throw a.g.error(`Error while configuring CDM for ${a.a}`,c),new _.H(_.G,6,6005,{message:JSON.stringify(c)});}})},oF=function(a,b){_.y(function*(){var c=a.f.get(a.a);
3
- a.g.debug("DRM Challenge data: ",b.challenge);const d=atob(b.challenge);var e=new Uint8Array(d.length);for(let h=0;h<d.length;++h)e[h]=d.charCodeAt(h);c=_.jh([b.serverurl&&""!==b.serverurl?b.serverurl:c.Kc],_.gh());c.type=3;c.body=e.buffer;c.method="POST";try{var f=yield a.D.xb.fetch(c).P;if(a.j){var g=_.I(f.data);const h=g.byteLength;e="";for(f=0;f<h;f++)e+=String.fromCharCode(g[f]);const k=`${b.session_id}PARAM_START_POSITION`+`${btoa(e)}PARAM_START_POSITION`;a.g.debug("Widevine license params",
4
- k);try{webapis.avplay.setDrm(nF,"widevine_license_data",k)}catch(l){a.g.error("License response rejected by CDM");const m=new _.H(_.G,6,6008,{browserError:JSON.stringify(l)});a.D.onError(m)}}}catch(h){a.g.error("License request failed.",JSON.stringify(h)),g=new _.H(_.G,6,6007,{message:_.xa,url:h.data.url,status:h.data.status||NaN,response:h.data.response||"",headers:h.data.headers||{}},h),a.D.onError(g)}})},kF=function(a){return _.y(function*(){try{webapis.avplay.setDrm(nF,"Initialize",""),webapis.avplay.setDrm(nF,
5
- "widevine_app_session",a.m.id),webapis.avplay.setDrm(nF,"widevine_data_type",a.m.type)}catch(b){throw b;}})},lF=function(a,b){return _.y(function*(){var c={};c[pF]=!b.Vd;c[qF]=b.Kc;""!==b.customData&&(c[rF]=b.customData);c=JSON.stringify(c);a.g.debug("PlayReady properties: ",c);try{webapis.avplay.setDrm(sF,"SetProperties",c)}catch(d){throw d;}})},uF=function(a,b){if(a.f!==b)if(a.f===_.Dl&&b!==_.El)a.g.debug(_.Mt+`${tF(b)}`);else{var c=(new Date).getTime();a.j=a.f;a.f=b;a.f===_.zl?(a.o=(new Date).getTime(),
6
- a.l.trigger(new _.F(_.ic,{detail:{bufferedTimeMS:-1,reason:a.h}}))):a.j===_.zl&&a.l.trigger(new _.F(_.hc,{detail:{bufferedTimeMS:c-a.o,reason:a.h}}));b={currentState:a.f,previousState:a.j,timeSinceLastStateChangeMS:c-a.w};a.w=c;a.l.trigger(new _.F(_.je,{detail:b}));a.g.debug("State changed:",tF(a.j),"-\x3e",tF(a.f))}},tF=function(a){return Object.keys(_.Cl)[a]},xF=function(a){if(a.m){var b=a.a.getState(),c=a.f;switch(b){case vF:c=_.Hl;break;case wF:c=_.Gl;break;default:a.l.isEnded()?c=_.wl:a.g.debug("Inconsistent AVPlay playback state:",
7
- b)}uF(a,c)}},yF=function(a){return _.y(function*(){const b=a.l.getConfiguration();let c;(c=yield _.wn(a.B.url,a.l.getNetworkEngine(),b.manifest.attemptParameters,a.B.type||null))&&c.configure(b.manifest);return c})},zF=function(a){if(!a)return!1;a=a.periods;let b=!1;for(let c=0;c<a.length;c++)b=b||0<a[c].textStreams.length;return b},AF=function(a){const b=document.createElement(_.w),c=new _.Ny,d=new _.Cy(()=>null),e=a.l.getTextDisplayer();return new _.Oy(b,c,e,d,a.l.getConfiguration())},BF=function(a){const b=
8
- {tb:()=>a.l.getPosition(),X:a.h,xb:a.l.getNetworkEngine(),Sd:a.F.bind(a),Rd:a.C.bind(a),onError:a.U.bind(a),Je:()=>{},onEvent:()=>{},Ne:a.G.bind(a),gd:()=>{},yd:()=>new _.ez,pd:()=>!1,Ec:null};return new _.Hz(a.f,b)},CF=function(a){const b=a.l.getPosition();let c=null;for(const d of a.f.periods)d.startTime<=b&&(c=d);return c},DF=function(a){a.a.debug("getTextStreams()",a.f);if(a.f){var b=[],c=a.f.periods;a.a.debug("getting text streams");for(var d=0;d<c.length;d++)if(a.a.debug(c[d].startTime,a.l.getPosition()),
9
- c[d].startTime<=a.l.getPosition()){b=c[d].textStreams;break}a=b}else a=[];b=[];c=0;for(d=0;d<a.length;d++){const e=new _.xh(String(c++),_.J);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=a[d].kind||_.fu;const f=new _.Fh(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},EF=function(a){if(a.h&&!a.h.getTextDisplayer().isTextVisible())return null;if(a.g){const b=_.Fx(a.g,_.v);let c=null;if(b){a=DF(a);for(let d=0;d<a.length;d++)if(a[d].renditions[0].id===
10
- String(b.id)){c=a[d].renditions[0];break}}return c}return null},FF=function(a,b){a.a.debug("Set active track",b);if(b&&(a.o=b.language,a.A=b.roles[0]||"",a.f&&a.g)){a.setTextVisibility(!0);const c=CF(a),d=b.renditions[0];(b=c.textStreams.find(e=>String(e.id)==d.id))?(a.w?(a.a.debug("Switching period defer text selection"),a.m=b):(_.Px(a.g,b,!0,0),a.l.trigger(new _.F(_.Qi))),a.o=b.language):a.a.error(_.Lt,d.id)}},GF=function(a){const b=a.ia();b&&a.l.trigger(new _.F(_.ec,{detail:{width:b.width,height:b.height,
11
- bandwidth:b.bandwidth,rendition:b}}))},HF=function(a,b){a.l.trigger(new _.F(_.Le,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,abrSelection:a.f.o}}))},IF=function(a,b){let c=null;try{c=JSON.parse(b)}catch(d){a.a.warn("Couldn't retrieve extra infos from stream."),c=null}return c},JF=function(a,b){a=a.g[_.L]||[];const c=[];for(let d=0;d<a.length;d++)for(let e=0;e<a[d].renditions.length;e++)_.rf(a[d].renditions[e],b,Object.keys(b))&&c.push(a[d].renditions[e]);return c[0]||
12
- null},KF=function(a){const b=a.l.getConfiguration();var c=_.Yf(b.preferredAudioLanguage||[]);const d=a.g[_.K]||[];if(d.length){var e=null;c.some(g=>{e=_.xu(g,d.map(h=>h.language));return!!e});if(e){var f=d.filter(g=>g.language===e);c=f[0];1<f.length&&b.preferredAudioRole&&(f=f.filter(g=>0<=g.roles.indexOf(b.preferredAudioRole)),0<f.length&&(c=f[0]));a.a.debug("Setting audio track with preferred language:",e);a.ta(c)}else a.a.debug("Preferred language(s) not available")}else a.a.debug("Could not set preferred audio language")},
13
- QF=function(a,b){var c=(l,m)=>{for(let n=0;n<l.length;n++)if(l[n].language===m)return l[n];return null};const d={};if(0>=b.length)return d;var e=b.filter(l=>l.type===LF),f=b.filter(l=>l.type===MF);const g=[];for(var h=0;h<f.length;h++){const l=IF(a,f[h].extra_info);if(l){var k=_.rg(l.language||_.xe);k=_.th(k);k=c(g,k);k||(k=new _.xh(String(a.o++),_.K),g.push(k));k.renditions.push(NF(f[h].index,l,k))}else a.a.warn("Skipping audio stream with no extra info")}c=new _.xh(String(a.o++),_.L);for(f=0;f<
14
- e.length;f++)(h=IF(a,e[f].extra_info))?c.renditions.push(OF(e[f].index,h,c)):a.a.warn("Skipping video stream with no extra info");e=[];e=a.h?DF(a.h):PF(a,b);d[_.L]=[c];d[_.K]=g;d[_.J]=e;return d},TF=function(a,b){if(b===_.J&&a.h)return EF(a.h);var c=RF(a.f)||[];if(0===c.length)return null;c=c.filter(e=>e.type===b.toUpperCase())[0];var d=null;b===_.L&&(d=IF(a,c.extra_info),d=JF(a,{width:d.Width,height:d.Height}));b===_.K&&(c?(d=SF(a,c,_.K),a.j=d):d=a.j);b===_.J&&(c?(d=SF(a,c,_.J),a.m=d):d=a.m);return d},
15
- WF=function(a,b){if(b){const c=b.track.type.toUpperCase();UF(a.f,c,Number(b.id)).then(()=>{c===MF&&(a.j=b,a.l.trigger(new _.F(_.Pi)));c===VF&&(a.m=b,a.l.trigger(new _.F(_.Qi)))}).catch(()=>{a.a.error("Could not select "+c+" track.")})}else a.a.debug("Must provide valid rendition")},NF=function(a,b,c){const d=_.rg(b.language||_.xe);c.language=_.th(d);c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.bc;a=new _.Fh(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=b.bit_rate||null;
16
- return a},OF=function(a,b,c){c.mimeType=_.Je;a=new _.Fh(String(a),c);a.track=c;a.width=b.Width||null;a.height=b.Height||null;a.bandwidth=b.Bit_rate?Number(b.Bit_rate):null;a.codec=b.fourCC||null;return a},XF=function(a,b,c){b=_.rg(b.track_lang||_.xe);c.mimeType="text/ttml";c.language=_.th(b);c.kind=_.fu;return new _.Fh(String(a),c)},PF=function(a,b){b=b.filter(d=>d.type===VF);const c=[];for(let d=0;d<b.length;d++){const e=IF(a,b[d].extra_info);if(!e){a.a.warn("Skipping text stream with no extra info");
17
- continue}const f=new _.xh(String(a.o++),_.J);f.renditions.push(XF(b[d].index,e,f));c.push(f)}return c},SF=function(a,b,c){a=a.g[c]||[];b=String(b.index);c=null;for(let d=0;d<a.length;d++)for(let e=0;e<a[d].renditions.length;e++)if(a[d].renditions[e].id===b){c=a[d].renditions[e];break}return c},YF=function(a){return a.g&&a.f?a.f.pg:webapis.avplay.getTotalTrackInfo()},$F=function(a,b,c){a.a.debug("switchVideoTrack()");try{const d={estimatedBandwidth:parseInt(webapis.avplay.getStreamingProperty("CURRENT_BANDWITH"),
18
- 10),currentBandwidth:b,nextBandwidth:c,currentPosition:a.getPosition()};a.f=ZF(a);a.g=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.l.getConfiguration(),d).then(()=>{const e=a.f.qe;a.g=!1;a.f=null;return e===wF?a.pause():a.play()})}catch(d){return Promise.reject(d)}},aG=function(a,b){var c=a.l.getTextDisplayer();c&&c.setTextVisibility(b);c=a.l.g;try{c||webapis.avplay.setSilentSubtitle(!b)}catch(d){a.a.debug("Could not set text track visibility",d)}},UF=function(a,b,c){b=b.toUpperCase();
19
- b===VF&&aG(a,!0);const d=a.j[b];d&&(d.kd.stop(),a.j[b]=null,a.a.debug(`Cancelled pending track switch for ${b}`));return new Promise((e,f)=>{const g=(h,k,l)=>{l=void 0===l?!1:l;try{webapis.avplay.setSelectTrack(h,k),a.j[h]=null,e()}catch(m){a.a.debug(`Could not set ${h} track. Trying again...`+`AVPlay state: ${a.getState()}, `+`buffering: ${a.w}`,m),!1===l&&(a.j[h]={type:h,index:k,oe:0,kd:new _.Yh(()=>g(h,c,!0))}),(k=a.j[h])&&3>k.oe?(!a.w&&++k.oe,k.kd.da(a.w?.5:.25)):(a.a.debug("Could not set track after multiple attempts.Giving up..."),
20
- k&&k.kd.stop(),a.j[h]=null,f())}};g(b,c)})},RF=function(a){return a.g&&a.f?a.f.wf:webapis.avplay.getCurrentStreamInfo()},bG=function(a){return _.y(function*(){tizen.systeminfo.getPropertyValue("DISPLAY",b=>{a.A=b.resolutionWidth/1920;a.a.debug("Display resolution ratio: ",a.A)},b=>{a.a.debug("Could not load DISPLAY property");throw b;})})},dG=function(a){try{webapis.avplay.setListener({onbufferingstart:a.I.bind(a),onbufferingprogress:a.H.bind(a),onbufferingcomplete:a.G.bind(a),onstreamcompleted:a.M.bind(a),
21
- oncurrentplaytime:b=>{a.trigger(new _.F(cG,{currentTime:b}))},onevent:a.K.bind(a),onsubtitlechange:a.N.bind(a),ondrmevent:a.J.bind(a),onerror:a.U.bind(a)})}catch(b){a.a.error(b)}},eG=function(a){const b=!!a.l.getTrackManager().Ga();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.a.debug("Could not set AVPlay subtitle config",c)}},fG=function(a,b){try{const c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.a.debug({estimatedBandwidth:c,Fg:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",
22
- iF+d)}catch(c){a.a.debug(c)}},gG=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+iF+b)}catch(c){throw a.a.debug("Could not set fixed bandwidth",c),c;}},hG=function(a){let b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case gF:a.a.warn("The application doesn't have the privilege to get the mute state.",hF);break;default:a.a.warn(eF,c)}}return!!b},ZF=function(a){return{position:a.getPosition(),state:a.l.getState(),qe:a.getState(),playbackRate:a.getPlaybackRate(),
23
- isLive:a.isLive(),duration:a.getDuration(),isMuted:hG(a),volume:a.getVolume(),pg:YF(a),wf:RF(a)}},iG=function(){return new Promise((a,b)=>{if(window.webapis)a();else{const c=document.createElement("script");jF(c,"load",d=>a(d));jF(c,_.Yc,d=>b(d));c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},jG=function(a){return _.y(function*(){yield iG();const b=new Promise(c=>{(new _.Yh(c)).da(5)});if(!(yield Promise.race([bG(a).then(()=>!0),b.then(()=>!1)])))return a.a.debug("Took to long for the SDK to be ready"),
24
- Promise.reject("SDK Timeout")})},kG=function(a){return _.y(function*(){a.a.debug("avplay.prepare()");return new Promise((b,c)=>{try{webapis.avplay.prepareAsync(()=>{a.a.debug("AVPlay is ready!");eG(a);b()},d=>{a.a.debug("prepareAsync failed",d);c(d)})}catch(d){a.a.debug("Failed to prepare media player for playback"),c(d)}})})},lG=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case gF:a.a.warn("The application does not have the privilege to set mute.",hF);break;default:a.a.warn(eF,
25
- c)}}},qG=function(a,b,c){return _.y(function*(){a.m=_.Kl(b);const d=a.F,e=c||{estimatedBandwidth:0,currentBandwidth:0,nextBandwidth:null,currentPosition:0};a.a.debug(`Loading manifest URL: ${a.m[d].url}`);let f=b.startTime||void 0;a.g&&(a.trigger(new _.F(mG)),f=c.currentPosition);try{let g=a.m[d].url;if(a.m[d].type===_.Sb&&!g.includes(".mpd")){const h=new URL(g);h.searchParams.append("cl-ext",".mpd");g=h.toString()}webapis.avplay.open(g);e.nextBandwidth?(gG(a,e.nextBandwidth),a.o=!1):(a.o||fG(a,e),
26
- a.o=!0);dG(a);if(b.drm&&b.drm.env){const h={onError:k=>a.l.onError(k),xb:a.l.getNetworkEngine()};a.h=new nG(b.drm,h);yield a.h.init()}else a.a.debug("No DRM configuration was provided. Assuming clear content");a.g||a.trigger(new _.F(oG));yield kG(a);a.g||a.trigger(new _.F(pG));f&&typeof f===_.r&&0<f&&a.seek(f).catch(h=>{a.a.debug("Couldn't set start position",h)});a.g||(b.volume&&a.setVolume(b.volume),b.muted&&lG(a,b.muted),b.autoplay&&a.l.play().catch(h=>{a.a.debug("Autoplay failed",h)}))}catch(g){throw a.a.debug("Error while attempting to load source."),
27
- g;}})},rG=function(a){if("NONE"!==a.a.getState()){var b=a.j.getBoundingClientRect();{a=a.a;const c=Math.floor(b.left*a.A),d=Math.floor(b.top*a.A),e=Math.floor(b.width*a.A);b=Math.floor(b.height*a.A);a.a.debug("Setting display area to","x:",c,"y:",d,"width:",e,"height:",b);webapis.avplay.setDisplayRect(c,d,e,b);0===c&&0===d&&1920===e&&1080===b&&webapis.avplay.setDisplayMethod("PLAYER_DISPLAY_MODE_LETTER_BOX")}}else a.h.debug("Could not apply dimension. Player state "+a.a.getState())},nG=class{constructor(a,
28
- b){this.h=a;this.o=null;this.a=_.Ad;this.m=null;this.j=!1;this.f=new Map;this.D=b;this.g=new _.O("clpp.tizen.DrmEngine")}init(){const a=this;return _.y(function*(){var b=_.lj[a.h.env]||null;if(!b)throw a.g.debug(_.pa,_.Wa+a.h.env+_.aa),new _.H(_.G,6,6015,`DRM environment '${a.h.env}' is missing.`);a.m={id:String(Math.floor(1E4*Math.random())),type:"MPEG-DASH"};var c=Object.keys(a.h.customData||{}).length?btoa(JSON.stringify(a.h.customData)):"";b=_.nj(b,a.h.customData);const d=b[_.Hc];d&&a.f.set(_.Hc,
29
- {Kc:d.licenseUrl||"",customData:c,Vd:!1});(b=b[_.Ic])&&a.f.set(_.Ic,{Kc:b.licenseUrl||"",customData:c,Vd:!1});if(0===a.f.size)throw new _.H(_.G,6,6E3);if((c=a.h.preferredDrmSystem)&&a.f.get(c))a.a=c;else if(a.f.get(_.Hc))a.a=_.Hc;else if(a.f.get(_.Ic))a.a=_.Ic;else throw new _.H(_.G,6,6001,"Configuration for the target system is missing.");yield mF(a);a.j=!0})}release(){const a=this;return _.y(function*(){a.j=!1;a.o=null;a.a=_.Ad;a.m=null;a.f=new Map})}getDrmInfo(){return this.o}},pF="DeleteLicenseAfterUse",
30
- qF="LicenseServer",rF="CustomData";var xG=class{constructor(a){this.l=a;this.a=this.l.a;this.f=_.El;this.j=_.mp;this.w=(new Date).getTime();this.m=!1;this.o=-1;this.h=2;this.g=new _.O("clpp.tizen.StateManager")}initialize(){this.a.on(mG,this.C,this);this.a.on(sG,this.B,this);this.a.on(tG,this.A,this);this.a.on(oG,this.H,this);this.a.on(pG,this.G,this);this.a.on(uG,this.F,this)}release(){uF(this,_.El);this.m=!1;this.o=-1;this.h=2}destroy(){this.release();this.a.off(mG,this.C);this.a.off(sG,this.B);this.a.off(tG,this.A);this.a.off(oG,
31
- this.H);this.a.off(pG,this.G);this.a.off(uG,this.F);this.l=this.a=null}C(){this.g.debug("Buffering start. Player state: ",this.a.getState());this.h=this.a.B?1:2;uF(this,_.zl)}B(a){this.g.debug("Buffering progress: "+a.percent+" %. Player state: ",tF(this.f))}A(){this.g.debug("Buffering complete. Player state: ",this.a.getState());if(!this.m){this.m=!0;var a=this.l.getConfiguration().autoplay;const b=this.a.getState()===vG;if(!a&&b){uF(this,_.Gl);return}}if(a=this.f!==_.Fl)a=this.a.getState(),a=a===
32
- vF||a===wF;a&&xF(this)}H(){this.g.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===wG?uF(this,_.Fl):this.g.error("AVPlay prepares while state is not IDLE")}G(){this.g.debug("Preparing ends: AVPlay state:",this.a.getState())}F(){uF(this,_.wl)}getState(){return this.f}};var yG=class{constructor(){this.o=this.A=this.g=this.h=this.B=this.l=this.j=this.f=null;this.w=!0;this.m=null;this.a=new _.O("clpp.tizen.TextStreamer")}initialize(a){this.l=a}load(a){const b=this;return _.y(function*(){if(b.l)if(b.B=a,b.j=yield yF(b),b.j){var c={networkingEngine:b.l.getNetworkEngine(),filterNewPeriod:()=>{},filterAllPeriods:()=>{},onTimelineCueAdded:()=>{},onEvent:()=>{},onError:()=>{}};try{b.f=yield b.j.start(a.url,c)}catch(d){b.a.warn(d);try{b.f=yield b.j.start(a.url.replace("https://",
33
- "http://"),c)}catch(e){b.a.error(e),b.f=null}}if(b.f&&zF(b.f)){b.h=AF(b);try{yield b.h.I;b.g=BF(b);const d=b.l.getConfiguration();b.g.j=d.streaming;b.o=d.preferredTextLanguage;b.A=d.preferredTextRole}catch(d){b.a.debug("Could not setup media source..."),b.h=null,b.g=null,b.j=null,b.f=null}}}else b.a.debug("Could not find manifest parser for source. Make sure parsers are registered.");else b.a.debug("Text streamer is not initialized. Will not load()")})}F(a){this.a.debug(_.Zt,a);this.w=!0;let b=_.sw(a.textStreams,
34
- this.o||"",this.A||"")[0]||null;this.m&&(a.textStreams.includes(this.m)&&(b=this.m),this.m=null);return{variant:null,text:b}}C(){this.a.debug("canSwitch_");this.w=!1;this.m&&(_.Px(this.g,this.m,!0,0),this.m=null)}U(){this.a.debug("onError_")}G(){this.j&&this.j.update&&this.j.update()}start(){const a=this;return _.y(function*(){if(a.g)try{a.g.start()}catch(b){a.a.error("Error while starting streaming engine",b)}})}setTextVisibility(a){this.a.debug("Set text visibility",a);this.h&&this.h.getTextDisplayer().setTextVisibility(a)}release(){const a=
35
- this;return _.y(function*(){a.l=null;a.f=null;a.B=null;a.A=null;a.o=null;a.w=!0;a.m=null})}destroy(){const a=this;return _.y(function*(){a.j&&(yield a.j.stop(),a.j=null);a.g&&(yield a.g.destroy(),a.g=null,a.w=!0);a.h&&(yield a.h.destroy(),a.h=null)})}};var V=class extends _.P{constructor(){super();this.h=this.f=this.l=null;this.g={};this.a=new _.O("clpp.tizen.TrackManager");this.w=this.m=this.j=null;this.B=!1;this.o=1}C(a){var b=a.eventid;a=a.data;switch(b){case zG:0<Object.keys(this.g).length||(this.a.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+IF(this,b[0].extra_info).Bit_rate,b=JF(this,{bandwidth:b}))&&(this.w=b,HF(this,b));break;case AG:GF(this);break;default:this.a.debug("Event type: "+
36
- b+" data: "+a)}}A(a){a.detail.currentState===_.Hl&&this.l.off(_.je,this.A)}initialize(a){this.l=a;this.f=this.l.a;this.l.on(_.je,b=>{this.B||(b=b.detail,b.currentState===_.Hl&&(this.a.debug("Current state",b.currentState),this.B=!0,KF(this)))});this.f.on(BG,this.C,this)}release(){this.g={};this.h=this.w=this.m=this.j=null;this.B=!1;this.o=1}load(){if(this.f&&!(0<Object.keys(this.g).length)){this.h=this.l.g;this.l.off(_.je,this.A);this.l.on(_.je,this.A,this);try{const a=YF(this.f);this.g=QF(this,a);
37
- const b=this.g[_.K]||[];b.length&&(this.j=b[0].renditions[0]||null);GF(this)}catch(a){this.a.debug("Could not load track manager")}}}destroy(){this.f.off(BG,this.C);this.f=this.l=null}getVideoTracks(){return this.g[_.L]||[]}getAudioTracks(){return this.g[_.K]||[]}ja(){return this.g[_.J]||[]}ia(){return TF(this,_.L)}Fa(){return TF(this,_.K)}Ga(){return TF(this,_.J)}Ra(){return this.w}eb(){this.a.info(fF);return null}fb(){this.a.info(fF);return null}Ia(){const a=this.ia();return a?a.track:null}na(){const a=
38
- this.Fa();return a?a.track:null}oa(){const a=this.Ga();return a?a.track:null}Wa(a){null===a?(a=this.ia(),$F(this.f,a.bandwidth,null).then(()=>{GF(this)})):0<a.renditions.length&&this.Va(a.renditions[0])}ta(a){a?WF(this,a.renditions[0]):this.a.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")}Da(a){a?(a=a.renditions[0],this.h?FF(this.h,a.track):WF(this,a)):(this.a.debug("Disabling text tracks"),this.m=null,aG(this.f,!1),this.l.trigger(new _.F(_.Qi)))}Va(a){const b=
39
- this.ia();this.f.o||a.width!==b.width||a.height!==b.height||a.bandwidth!==b.bandwidth?(this.w=a,HF(this,a),$F(this.f,b.bandwidth,a.bandwidth).then(()=>{GF(this)}).catch(c=>{const d=new _.H(_.G,7,7200,{tizenerror:c});this.a.debug("Error while switching video track",c);this.l.onError(d)})):this.a.debug("Trying to switch to already active rendition. Doing nothing...")}kb(a){WF(this,a)}lb(a){this.h?FF(this.h,a.track):WF(this,a)}addTextTrack(){}la(){return this.f.o}};V.prototype.isAbrEnabled=V.prototype.la;
40
- V.prototype.addTextTrack=V.prototype.addTextTrack;V.prototype.setTextRendition=V.prototype.lb;V.prototype.setAudioRendition=V.prototype.kb;V.prototype.setVideoRendition=V.prototype.Va;V.prototype.setTextTrack=V.prototype.Da;V.prototype.setAudioTrack=V.prototype.ta;V.prototype.setVideoTrack=V.prototype.Wa;V.prototype.getTextTrack=V.prototype.oa;V.prototype.getAudioTrack=V.prototype.na;V.prototype.getVideoTrack=V.prototype.Ia;V.prototype.getLoadingTextRendition=V.prototype.fb;
41
- V.prototype.getLoadingAudioRendition=V.prototype.eb;V.prototype.getLoadingVideoRendition=V.prototype.Ra;V.prototype.getTextRendition=V.prototype.Ga;V.prototype.getAudioRendition=V.prototype.Fa;V.prototype.getVideoRendition=V.prototype.ia;V.prototype.getTextTracks=V.prototype.ja;V.prototype.getAudioTracks=V.prototype.getAudioTracks;V.prototype.getVideoTracks=V.prototype.getVideoTracks;var FG=class extends _.So{constructor(a){super();this.l=a;this.h=null;this.a=new _.O("clpp.tizen.Middleware");this.C=1;this.B=!1;this.m=null;this.F=0;this.o=!0;this.g=!1;this.f=null;this.A=1;this.w=!1;this.j={}}I(){this.w=!0;this.g||this.trigger(new _.F(mG))}H(a){this.w=!0;this.trigger(new _.F(sG,{percent:a}))}G(){this.w=!1;this.trigger(new _.F(tG))}M(){this.trigger(new _.F(uG))}K(a,b){this.trigger(new _.F(BG,{eventid:a,data:b}))}N(a,b,c,d,e){this.trigger(new _.F(CG,{duration:a,text:b,subtitleType:c,
42
- attriCount:d,attributes:e}))}J(a,b){this.trigger(new _.F(DG,{drmType:a,drmData:b}));this.h&&(a=this.h,a.j&&(a.a===_.Ic&&"Challenge"===b.name?oF(a,b):"DrmError"===b.name&&(a.g.debug("DrmError event",b),b=new _.H(_.G,6,6005,{message:JSON.stringify(b)}),a.D.onError(b))))}U(a){this.trigger(new _.F(EG,{eventType:a}))}play(){const a=this.getState(),b=()=>new Promise((c,d)=>{let e=null;const f=()=>{c();clearTimeout(e)};this.one(cG,f,this);e=setTimeout(()=>{this.off(cG,f);d("Timeout")},3E4)});if(a===wG)return(new Promise((c,
43
- d)=>{webapis.avplay.prepareAsync(()=>{eG(this);c(webapis.avplay.play())},e=>{this.trigger(new _.F(EG));d(e)})})).then(()=>b());if(a===wF||a===vG)try{return webapis.avplay.play(),b()}catch(c){return Promise.reject(c)}return a===vF?Promise.resolve():Promise.reject("Player is in invalid state")}pause(){try{webapis.avplay.pause()}catch(a){Promise.reject(a)}return this.getState()===wF?Promise.resolve():Promise.reject()}setPlaybackRate(a){const b=this.getState();if(b===vG||b===vF||b===wF){try{webapis.avplay.setSpeed(a),
44
- this.C=a}catch(c){return this.a.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.C)}return!0}this.a.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1}getPlaybackRate(){return this.C}load(a,b){const c=this;return _.y(function*(){c.a.debug("configure()",b||"");try{yield jG(c),yield qG(c,a,b)}catch(d){throw new _.H(_.G,7,7003,null,d);}})}getState(){if(this.g&&this.f)return this.f.qe;try{return webapis.avplay.getState()}catch(a){this.U(JSON.stringify(a))}}seek(a){const b=
45
- 1E3*a;return new Promise((c,d)=>{this.B=!0;this.l.trigger(new _.F(_.Ce));webapis.avplay.seekTo(b,()=>{this.B=!1;this.l.trigger(new _.F(_.Be));c()},()=>{this.B=!1;d()})})}getPosition(){if(this.g&&this.f)return this.f.position;try{return webapis.avplay.getCurrentTime()/1E3}catch(a){this.U(JSON.stringify(a))}}getDuration(){if(this.g&&this.f)return this.f.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.U(JSON.stringify(a))}}release(){return new Promise((a,b)=>{try{this.h&&(this.h.release(),
46
- this.h=null);webapis.avplay.stop();webapis.avplay.close();for(const c in this.j){const d=this.j[c];d&&d.kd.stop()}this.j={};this.C=1;this.B=!1;this.f=this.m=null;return a()}catch(c){return b(c)}})}getVolume(){let a=null;try{a=tizen.tvaudiocontrol.getVolume()}catch(b){switch(b.name){case gF:this.a.debug("The application does not have the privilege to get the volume.",hF);break;default:this.a.debug(eF,b)}}return a}setVolume(a){try{tizen.tvaudiocontrol.setVolume(Math.max(0,Math.min(100*a,100)))}catch(b){switch(b.name){case "InvalidValueError":this.a.warn("Invalid value passed for setVolume.",
47
- "The passed value value should be in the range of 0 to 1.");break;case gF:this.a.warn("The application does not have the privilege to set the volume.",hF);break;default:this.a.warn("An unknown error occurred while trying to set volume",b)}}}isLive(){if(this.g&&this.f)return this.f.isLive;try{return"1"===webapis.avplay.getStreamingProperty("IS_LIVE")}catch(a){this.U(JSON.stringify(a))}}stop(){try{webapis.avplay.stop()}catch(a){this.a.debug(a)}}getDrmInfo(){this.h&&this.h.getDrmInfo();return null}setSourceIndex(a){this.F=
48
- a}getSourceIndex(){return this.F}getLoadedSource(){return this.m&&this.m[this.getSourceIndex()]}},wG="IDLE",vG="READY",vF="PLAYING",wF="PAUSED",LF=_.qb,MF="AUDIO",VF="TEXT",AG="PLAYER_MSG_RESOLUTION_CHANGED",zG="PLAYER_MSG_BITRATE_CHANGE",sF="PLAYREADY",nF="WIDEVINE_CDM";var JG=class extends _.So{constructor(){super();this.a=new FG(this);this.f=new xG(this);this.configuration=this.B=_.$i();this.w=null;this.h=new _.O("clpp.tizen.Player");this.j=null;this.m=new V;this.C=new _.Em;this.o=this.g=null;this.A=!1}H(){this.h.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.F(_.Xc));this.configuration.loop?this.seek(this.configuration.startTime||0).catch(()=>{this.h.debug("Could not loop playback")}):this.a.stop()}F(a){this.trigger(new _.F(_.ue,
49
- {currentTime:a.currentTime/1E3}))}I(a){const b=this.a.getPosition(),c=b+a.duration/1E3;let d=a.text||"";this.h.debug("Got subtitles: ",d,"start:",b,"end:",c,a);(d=_.Rg(d))&&this.o.append([new _.ro(b,c,d)],[])}G(a){this.h.debug("DRM event: "+a.drmType+", data: "+a.drmData)}J(){this.A||(this.h.debug("Initial buffering completed..."),this.A=!0)}U(a){this.h.debug(`Error: TYPE: ${a.eventType}`);uF(this.f,_.Dl);a=new _.H(_.G,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.F(_.Yc,{detail:a}))}init(a,
50
- b){this.configuration=this.B=b;this.w=a;this.a.on(uG,this.H,this);this.a.on(cG,this.F,this);this.a.on(CG,this.I,this);this.a.on(DG,this.G,this);this.a.on(EG,this.U,this);this.a.on(tG,this.J,this);this.f.initialize();this.m.initialize(this);this.h.debug("Initializing player surface");this.w.hideMediaElement();a=GG;GG+=1;a="__clpp_tizen_player_"+a;this.j=_.am(_.Bd,{id:a,type:"application/avplayer"});this.w.addElementToContainer(this.j,!0);var c=this.w.getMedia();if(c){a=this.j;{b=[_.We,_.ad,"position",
51
- _.fd,"top"];const e={};c=null!==c.parentElement?window.getComputedStyle(c,null):c.style;if(!b||0===b.length)for(d in b||(b=[]),c)b.push(d);for(const f of b)e[f]=c[f];var d=e}_.cm(a,d);rG(this)}}getSurface(){return this.w}getConfiguration(){return this.configuration}destroy(){const a=this;return _.y(function*(){yield a.release();a.a.off(uG,a.H);a.a.off(cG,a.F);a.a.off(CG,a.I);a.a.off(DG,a.G);a.a.off(EG,a.U);a.a.off(tG,a.J);a.g&&(yield a.g.destroy(),a.g=null);a.j&&(a.j.parentElement.removeChild(a.j),
52
- a.j=null);a.m.destroy();a.f.destroy();a.m=null;a.f=null})}namespace(){return HG}getPlaybackRate(){return this.a.getPlaybackRate()}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}setPlaybackRate(a){this.a.setPlaybackRate(a)}getPosition(){return 0<(this.configuration.startTime||0)&&!this.A?0:this.f.getState()===_.wl?this.getDuration():this.a.getPosition()||0}seek(a){return typeof a===_.r&&0<=a?(this.isLive()||(a=Math.min(a,this.getDuration())),this.a.seek(a)):Promise.reject()}getPresentationStartTime(){return null}getSeekRange(){return{start:0,
53
- end:0}}getVolume(){const a=this.a.getVolume();return typeof a===_.r?a/100:null}setVolume(a){this.a.setVolume(a)}getDuration(){return this.a.getDuration()}getBufferInfo(){this.h.warn(_.la);return new _.Ro}getTrackManager(){return this.m}unload(){return this.a.release().then(()=>{this.m.release()})}release(){const a=this;return _.y(function*(){a.g&&(yield a.g.release());a.o&&(yield a.o.destroy(),a.o=null);yield a.a.release();a.m.release();a.f.release();a.A=!1})}load(a){const b=this;return _.y(function*(){_.cj(a)&&
54
- (b.configuration=_.bj(b.B,a));var c=_.ml(b.configuration,["html","native"]);b.o=c.create(b);c=_.Kl(b.configuration)[0];if(b.configuration.tizen&&b.configuration.tizen.sideStreamText){b.g=new yG;b.g.initialize(b);try{yield b.g.load(c),b.g.start()}catch(d){b.h.error(d)}}try{yield b.a.load(b.configuration)}catch(d){throw b.onError(d),d;}b.m.load()})}play(){this.trigger(new _.F(_.Rd));rG(this);return this.a.play().then(()=>{xF(this.f)})}pause(){return this.a.pause().then(()=>{xF(this.f)})}getState(){return this.f.getState()}getPeriods(){return[]}onError(a){const b=
55
- new _.F(_.Yc,{detail:a});a.severity===_.G&&(uF(this.f,_.Dl),this.a.release());this.trigger(b);b.defaultPrevented&&(b.a=!0)}getDrmInfo(){return this.a.getDrmInfo()}isEnded(){return this.f.getState()===_.wl}isPaused(){return this.a.getState()===wF}isMuted(){return hG(this.a)}setMuted(a){lG(this.a,a)}getNetworkEngine(){return this.C}setNetworkEngine(a){this.C=a}isLive(){return this.a.isLive()}getStats(){return null}setSourceIndex(a){this.a.setSourceIndex(a)}getSourceIndex(){return this.a.getSourceIndex()}getLoadedSource(){return this.a.getLoadedSource()}canPlay(a,
56
- b){return(new IG).canPlay(a,b)}getTimelineCues(){return[]}getTextDisplayer(){return this.o}resetAbr(){}};JG.prototype.getTextDisplayer=JG.prototype.getTextDisplayer;JG.prototype.setNetworkEngine=JG.prototype.setNetworkEngine;JG.prototype.getNetworkEngine=JG.prototype.getNetworkEngine;
57
- var HG="clpp.tizen",GG=0,IG=class{a(){return HG}canPlay(a){a=a.type;const b=!!window.webapis;if((a===_.Sb||a===_.Ui||a===_.Xb)&&b){if(_.bi(2))return 2;if(_.bi(3)||_.bi(4)||_.bi(5)||_.bi(6))return _.D("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0}create(){return new JG}};_.z("clpp.tizen.TizenComponent",class extends _.zp{constructor(){super();this.h=null}f(){this.h=new IG;_.Kf(this.h)}a(){if(this.h){var a=this.h.a();a&&_.If[a]&&(delete _.If[a],_.Jf.info("Removed Player factory: '"+a+"'"));this.h=null}}id(){return"tizen"}});var mG="onbufferingstart",sG="onbufferingprogress",tG="onbufferingcomplete",uG="onstreamcompleted",cG="oncurrentplaytime",BG="onevent",CG="onsubtitlechange",DG="ondrmevent",EG="onerror",oG="preparingstart",pG="preparingend";};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var DG="An unknown error occurred while trying to get volume",EG="Cannot get loading rendition due to platform limitations",FG="SecurityError",GG="The require privilege is: http://tizen.org/privilege/tv.audio",HG="|STARTBITRATE\x3d",IG=function(a,b,c){const d=e=>{c.call(a,e);a.removeEventListener(b,d)};a.addEventListener(b,d)},LG=function(a){return _.x(function*(){if(a.a!==_.Sc&&a.a!==_.Qc)throw new _.H(_.G,6,6001,`The key system ${a.a} is not supported by `+"the player or the platform");
2
+ const b=a.f.get(a.a);if(!b.Mc)throw new _.H(_.G,6,6012,`No license server given for ${a.a}`);try{a.a===_.Sc?yield JG(a):yield KG(a,b),a.o={keySystem:a.a,licenseServerUri:b.Mc,distinctiveIdentifierRequired:!1,persistentStateRequired:b.ce,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:[],keyIds:[],periodId:null}}catch(c){throw a.h.error(`Error while configuring CDM for ${a.a}`,c),new _.H(_.G,6,6005,{message:JSON.stringify(c)});}})},NG=function(a,b){_.x(function*(){var c=a.f.get(a.a);
3
+ a.h.debug("DRM Challenge data: ",b.challenge);const d=atob(b.challenge);var e=new Uint8Array(d.length);for(let h=0;h<d.length;++h)e[h]=d.charCodeAt(h);c=_.Kh([b.serverurl&&""!==b.serverurl?b.serverurl:c.Mc],_.Hh());c.type=3;c.body=e.buffer;c.method="POST";try{var f=yield a.D.xb.fetch(c).P;if(a.j){var g=_.J(f.data);const h=g.byteLength;e="";for(f=0;f<h;f++)e+=String.fromCharCode(g[f]);const k=`${b.session_id}PARAM_START_POSITION`+`${btoa(e)}PARAM_START_POSITION`;a.h.debug("Widevine license params",
4
+ k);try{webapis.avplay.setDrm(MG,"widevine_license_data",k)}catch(l){a.h.error("License response rejected by CDM");const m=new _.H(_.G,6,6008,{browserError:JSON.stringify(l)});a.D.onError(m)}}}catch(h){a.h.error("License request failed.",JSON.stringify(h)),g=new _.H(_.G,6,6007,{message:_.ya,url:h.data.url,status:h.data.status||NaN,response:h.data.response||"",headers:h.data.headers||{}},h),a.D.onError(g)}})},JG=function(a){return _.x(function*(){try{webapis.avplay.setDrm(MG,"Initialize",""),webapis.avplay.setDrm(MG,
5
+ "widevine_app_session",a.l.id),webapis.avplay.setDrm(MG,"widevine_data_type",a.l.type)}catch(b){throw b;}})},KG=function(a,b){return _.x(function*(){var c={};c[OG]=!b.ce;c[PG]=b.Mc;""!==b.customData&&(c[QG]=b.customData);c=JSON.stringify(c);a.h.debug("PlayReady properties: ",c);try{webapis.avplay.setDrm(RG,"SetProperties",c)}catch(d){throw d;}})},TG=function(a,b){if(a.f!==b)if(a.f===_.zm&&b!==_.Am)a.h.debug(_.fv+`${SG(b)}`);else{var c=(new Date).getTime();a.j=a.f;a.f=b;a.f===_.vm?(a.o=(new Date).getTime(),
6
+ a.m.trigger(new _.F(_.sc,{detail:{bufferedTimeMS:-1,reason:a.g}}))):a.j===_.vm&&a.m.trigger(new _.F(_.oc,{detail:{bufferedTimeMS:c-a.o,reason:a.g}}));b={currentState:a.f,previousState:a.j,timeSinceLastStateChangeMS:c-a.w};a.w=c;a.m.trigger(new _.F(_.Ge,{detail:b}));a.h.debug("State changed:",SG(a.j),"-\x3e",SG(a.f))}},SG=function(a){return Object.keys(_.ym)[a]},WG=function(a){if(a.l){var b=a.a.getState(),c=a.f;switch(b){case UG:c=_.Dm;break;case VG:c=_.Cm;break;default:a.m.isEnded()?c=_.sm:a.h.debug("Inconsistent AVPlay playback state:",
7
+ b)}TG(a,c)}},XG=function(a){return _.x(function*(){const b=a.m.getConfiguration();let c;(c=yield _.Io(a.B.url,a.m.getNetworkEngine(),b.manifest.attemptParameters,a.B.type||null))&&c.configure(b.manifest);return c})},YG=function(a){if(!a)return!1;a=a.periods;let b=!1;for(let c=0;c<a.length;c++)b=b||0<a[c].textStreams.length;return b},ZG=function(a){const b=document.createElement(_.w),c=new _.Wz,d=new _.Lz(()=>null),e=a.m.getTextDisplayer();return new _.Xz(b,c,e,d,a.m.getConfiguration())},$G=function(a){const b=
8
+ {tb:()=>a.m.getPosition(),X:a.g,xb:a.m.getNetworkEngine(),Zd:a.F.bind(a),Yd:a.C.bind(a),onError:a.U.bind(a),Ue:()=>{},onEvent:()=>{},Ye:a.G.bind(a),od:()=>{},Gd:()=>new _.aA,wd:()=>!1,Ec:null};return new _.SA(a.a,b)},aH=function(a){const b=a.m.getPosition();let c=null;for(const d of a.a.periods)d.startTime<=b&&(c=d);return c},bH=function(a){a.h.debug("getTextStreams()",a.a);if(a.a){var b=[],c=a.a.periods;a.h.debug("getting text streams");for(var d=0;d<c.length;d++)if(a.h.debug(c[d].startTime,a.m.getPosition()),
9
+ c[d].startTime<=a.m.getPosition()){b=c[d].textStreams;break}a=b}else a=[];b=[];c=0;for(d=0;d<a.length;d++){const e=new _.Zh(String(c++),_.K);e.mimeType=a[d].mimeType;e.language=a[d].language;e.roles=a[d].roles;e.kind=a[d].kind||_.Dv;const f=new _.gi(String(a[d].id),e);f.bandwidth=a[d].bandwidth||null;e.renditions.push(f);b.push(e)}return b},cH=function(a){if(a.g&&!a.g.getTextDisplayer().isTextVisible())return null;if(a.f){const b=_.Py(a.f,_.t);let c=null;if(b){a=bH(a);for(let d=0;d<a.length;d++)if(a[d].renditions[0].id===
10
+ String(b.id)){c=a[d].renditions[0];break}}return c}return null},dH=function(a,b){a.h.debug("Set active track",b);if(b&&(a.o=b.language,a.A=b.roles[0]||"",a.a&&a.f)){a.setTextVisibility(!0);const c=aH(a),d=b.renditions[0];(b=c.textStreams.find(e=>String(e.id)==d.id))?(a.w?(a.h.debug("Switching period defer text selection"),a.l=b):(_.Yy(a.f,b,!0,0),a.m.trigger(new _.F(_.rj))),a.o=b.language):a.h.error(_.ev,d.id)}},eH=function(a){const b=a.ia();b&&a.m.trigger(new _.F(_.mc,{detail:{width:b.width,height:b.height,
11
+ bandwidth:b.bandwidth,rendition:b}}))},fH=function(a,b){a.m.trigger(new _.F(_.hf,{details:{width:b.width,height:b.height,bandwidth:b.bandwidth,track:b.track,abrSelection:a.a.o}}))},gH=function(a,b){let c=null;try{c=JSON.parse(b)}catch(d){a.h.warn("Couldn't retrieve extra infos from stream."),c=null}return c},hH=function(a,b){a=a.f[_.M]||[];const c=[];for(let d=0;d<a.length;d++)for(let e=0;e<a[d].renditions.length;e++)_.Tf(a[d].renditions[e],b,Object.keys(b))&&c.push(a[d].renditions[e]);return c[0]||
12
+ null},iH=function(a){const b=a.m.getConfiguration();var c=_.ug(b.preferredAudioLanguage||[]);const d=a.f[_.L]||[];if(d.length){var e=null;c.some(g=>{e=_.Vv(g,d.map(h=>h.language));return!!e});if(e){var f=d.filter(g=>g.language===e);c=f[0];1<f.length&&b.preferredAudioRole&&(f=f.filter(g=>0<=g.roles.indexOf(b.preferredAudioRole)),0<f.length&&(c=f[0]));a.h.debug("Setting audio track with preferred language:",e);a.sa(c)}else a.h.debug("Preferred language(s) not available")}else a.h.debug("Could not set preferred audio language")},
13
+ oH=function(a,b){var c=(l,m)=>{for(let n=0;n<l.length;n++)if(l[n].language===m)return l[n];return null};const d={};if(0>=b.length)return d;var e=b.filter(l=>l.type===jH),f=b.filter(l=>l.type===kH);const g=[];for(var h=0;h<f.length;h++){const l=gH(a,f[h].extra_info);if(l){var k=_.Sg(l.language||_.Ve);k=_.Vh(k);k=c(g,k);k||(k=new _.Zh(String(a.o++),_.L),g.push(k));k.renditions.push(lH(f[h].index,l,k))}else a.h.warn("Skipping audio stream with no extra info")}c=new _.Zh(String(a.o++),_.M);for(f=0;f<
14
+ e.length;f++)(h=gH(a,e[f].extra_info))?c.renditions.push(mH(e[f].index,h,c)):a.h.warn("Skipping video stream with no extra info");e=[];e=a.g?bH(a.g):nH(a,b);d[_.M]=[c];d[_.L]=g;d[_.K]=e;return d},rH=function(a,b){if(b===_.K&&a.g)return cH(a.g);var c=pH(a.a)||[];if(0===c.length)return null;c=c.filter(e=>e.type===b.toUpperCase())[0];var d=null;b===_.M&&(d=gH(a,c.extra_info),d=hH(a,{width:d.Width,height:d.Height}));b===_.L&&(c?(d=qH(a,c,_.L),a.j=d):d=a.j);b===_.K&&(c?(d=qH(a,c,_.K),a.l=d):d=a.l);return d},
15
+ uH=function(a,b){if(b){const c=b.track.type.toUpperCase();sH(a.a,c,Number(b.id)).then(()=>{c===kH&&(a.j=b,a.m.trigger(new _.F(_.qj)));c===tH&&(a.l=b,a.m.trigger(new _.F(_.rj)))}).catch(()=>{a.h.error("Could not select "+c+" track.")})}else a.h.debug("Must provide valid rendition")},lH=function(a,b,c){const d=_.Sg(b.language||_.Ve);c.language=_.Vh(d);c.originalLanguage=d;c.channelsCount=b.channels?Number(b.channels):null;c.mimeType=_.jc;a=new _.gi(String(a),c);a.track=c;a.codec=b.fourCC||null;a.bandwidth=
16
+ b.bit_rate||null;return a},mH=function(a,b,c){c.mimeType=_.ff;a=new _.gi(String(a),c);a.track=c;a.width=b.Width||null;a.height=b.Height||null;a.bandwidth=b.Bit_rate?Number(b.Bit_rate):null;a.codec=b.fourCC||null;return a},vH=function(a,b,c){b=_.Sg(b.track_lang||_.Ve);c.mimeType="text/ttml";c.language=_.Vh(b);c.originalLanguage=b;c.kind=_.Dv;return new _.gi(String(a),c)},nH=function(a,b){b=b.filter(d=>d.type===tH);const c=[];for(let d=0;d<b.length;d++){const e=gH(a,b[d].extra_info);if(!e){a.h.warn("Skipping text stream with no extra info");
17
+ continue}const f=new _.Zh(String(a.o++),_.K);f.renditions.push(vH(b[d].index,e,f));c.push(f)}return c},qH=function(a,b,c){a=a.f[c]||[];b=String(b.index);c=null;for(let d=0;d<a.length;d++)for(let e=0;e<a[d].renditions.length;e++)if(a[d].renditions[e].id===b){c=a[d].renditions[e];break}return c},wH=function(a){return a.f&&a.a?a.a.Mg:webapis.avplay.getTotalTrackInfo()},yH=function(a,b,c){a.h.debug("switchVideoTrack()");try{const d={estimatedBandwidth:parseInt(webapis.avplay.getStreamingProperty("CURRENT_BANDWITH"),
18
+ 10),currentBandwidth:b,nextBandwidth:c,currentPosition:a.getPosition()};a.a=xH(a);a.f=!0;webapis.avplay.stop();webapis.avplay.close();return a.load(a.m.getConfiguration(),d).then(()=>{const e=a.a.ye;a.f=!1;a.a=null;return e===VG?a.pause():a.play()})}catch(d){return Promise.reject(d)}},zH=function(a,b){var c=a.m.getTextDisplayer();c&&c.setTextVisibility(b);c=a.m.g;try{c||webapis.avplay.setSilentSubtitle(!b)}catch(d){a.h.debug("Could not set text track visibility",d)}},sH=function(a,b,c){b=b.toUpperCase();
19
+ b===tH&&zH(a,!0);const d=a.j[b];d&&(d.rd.stop(),a.j[b]=null,a.h.debug(`Cancelled pending track switch for ${b}`));return new Promise((e,f)=>{const g=(h,k,l)=>{l=void 0===l?!1:l;try{webapis.avplay.setSelectTrack(h,k),a.j[h]=null,e()}catch(m){a.h.debug(`Could not set ${h} track. Trying again...`+`AVPlay state: ${a.getState()}, `+`buffering: ${a.w}`,m),!1===l&&(a.j[h]={type:h,index:k,ve:0,rd:new _.zi(()=>g(h,c,!0))}),(k=a.j[h])&&3>k.ve?(!a.w&&++k.ve,k.rd.ca(a.w?.5:.25)):(a.h.debug("Could not set track after multiple attempts.Giving up..."),
20
+ k&&k.rd.stop(),a.j[h]=null,f())}};g(b,c)})},pH=function(a){return a.f&&a.a?a.a.Lf:webapis.avplay.getCurrentStreamInfo()},AH=function(a){return _.x(function*(){tizen.systeminfo.getPropertyValue("DISPLAY",b=>{a.A=b.resolutionWidth/1920;a.h.debug("Display resolution ratio: ",a.A)},b=>{a.h.debug("Could not load DISPLAY property");throw b;})})},CH=function(a){try{webapis.avplay.setListener({onbufferingstart:a.I.bind(a),onbufferingprogress:a.H.bind(a),onbufferingcomplete:a.G.bind(a),onstreamcompleted:a.M.bind(a),
21
+ oncurrentplaytime:b=>{a.trigger(new _.F(BH,{currentTime:b}))},onevent:a.K.bind(a),onsubtitlechange:a.N.bind(a),ondrmevent:a.J.bind(a),onerror:a.U.bind(a)})}catch(b){a.h.error(b)}},DH=function(a){const b=!!a.m.getTrackManager().Ia();try{webapis.avplay.setSilentSubtitle(!b)}catch(c){a.h.debug("Could not set AVPlay subtitle config",c)}},EH=function(a,b){try{const c=b.estimatedBandwidth||0,d=b.currentBandwidth||0;a.h.debug({estimatedBandwidth:c,$g:d});0!==c&&0!==d&&c>=1.15*d&&webapis.avplay.setStreamingProperty("ADAPTIVE_INFO",
22
+ HG+d)}catch(c){a.h.debug(c)}},FH=function(a,b){try{webapis.avplay.setStreamingProperty("ADAPTIVE_INFO","|BITRATES\x3d"+b+HG+b)}catch(c){throw a.h.debug("Could not set fixed bandwidth",c),c;}},GH=function(a){let b=null;try{b=tizen.tvaudiocontrol.isMute()}catch(c){switch(c.name){case FG:a.h.warn("The application doesn't have the privilege to get the mute state.",GG);break;default:a.h.warn(DG,c)}}return!!b},xH=function(a){return{position:a.getPosition(),state:a.m.getState(),ye:a.getState(),playbackRate:a.getPlaybackRate(),
23
+ isLive:a.isLive(),duration:a.getDuration(),isMuted:GH(a),volume:a.getVolume(),Mg:wH(a),Lf:pH(a)}},HH=function(){return new Promise((a,b)=>{if(window.webapis)a();else{const c=document.createElement("script");IG(c,"load",d=>a(d));IG(c,_.ld,d=>b(d));c.src="$WEBAPIS/webapis/webapis.js";document.querySelector("head").appendChild(c)}})},IH=function(a){return _.x(function*(){yield HH();const b=new Promise(c=>{(new _.zi(c)).ca(5)});if(!(yield Promise.race([AH(a).then(()=>!0),b.then(()=>!1)])))return a.h.debug("Took to long for the SDK to be ready"),
24
+ Promise.reject("SDK Timeout")})},JH=function(a){return _.x(function*(){a.h.debug("avplay.prepare()");return new Promise((b,c)=>{try{webapis.avplay.prepareAsync(()=>{a.h.debug("AVPlay is ready!");DH(a);b()},d=>{a.h.debug("prepareAsync failed",d);c(d)})}catch(d){a.h.debug("Failed to prepare media player for playback"),c(d)}})})},KH=function(a,b){try{tizen.tvaudiocontrol.setMute(b)}catch(c){switch(c.name){case FG:a.h.warn("The application does not have the privilege to set mute.",GG);break;default:a.h.warn(DG,
25
+ c)}}},PH=function(a,b,c){return _.x(function*(){a.l=_.Gm(b);const d=a.F,e=c||{estimatedBandwidth:0,currentBandwidth:0,nextBandwidth:null,currentPosition:0};a.h.debug(`Loading manifest URL: ${a.l[d].url}`);let f=b.startTime||void 0;a.f&&(a.trigger(new _.F(LH)),f=c.currentPosition);try{let g=a.l[d].url;if(a.l[d].type===_.$b&&!g.includes(".mpd")){const h=new URL(g);h.searchParams.append("cl-ext",".mpd");g=h.toString()}webapis.avplay.open(g);e.nextBandwidth?(FH(a,e.nextBandwidth),a.o=!1):(a.o||EH(a,e),
26
+ a.o=!0);CH(a);if(b.drm&&b.drm.env){const h={onError:k=>a.m.onError(k),xb:a.m.getNetworkEngine()};a.g=new MH(b.drm,h);yield a.g.init()}else a.h.debug("No DRM configuration was provided. Assuming clear content");a.f||a.trigger(new _.F(NH));yield JH(a);a.f||a.trigger(new _.F(OH));f&&typeof f===_.r&&0<f&&a.seek(f).catch(h=>{a.h.debug("Couldn't set start position",h)});a.f||(b.volume&&a.setVolume(b.volume),b.muted&&KH(a,b.muted),b.autoplay&&a.m.play().catch(h=>{a.h.debug("Autoplay failed",h)}))}catch(g){throw a.h.debug("Error while attempting to load source."),
27
+ g;}})},QH=function(a){if("NONE"!==a.a.getState()){var b=a.j.getBoundingClientRect();{a=a.a;const c=Math.floor(b.left*a.A),d=Math.floor(b.top*a.A),e=Math.floor(b.width*a.A);b=Math.floor(b.height*a.A);a.h.debug("Setting display area to","x:",c,"y:",d,"width:",e,"height:",b);webapis.avplay.setDisplayRect(c,d,e,b);0===c&&0===d&&1920===e&&1080===b&&webapis.avplay.setDisplayMethod("PLAYER_DISPLAY_MODE_LETTER_BOX")}}else a.h.debug("Could not apply dimension. Player state "+a.a.getState())},MH=class{constructor(a,
28
+ b){this.g=a;this.o=null;this.a=_.Nd;this.l=null;this.j=!1;this.f=new Map;this.D=b;this.h=new _.R("clpp.tizen.DrmEngine")}init(){const a=this;return _.x(function*(){var b=_.Uj[a.g.env]||null;if(!b)throw a.h.debug(_.qa,_.$a+a.g.env+_.aa),new _.H(_.G,6,6015,`DRM environment '${a.g.env}' is missing.`);a.l={id:String(Math.floor(1E4*Math.random())),type:"MPEG-DASH"};var c=Object.keys(a.g.customData||{}).length?btoa(JSON.stringify(a.g.customData)):"";b=_.Wj(b,a.g.customData);const d=b[_.Qc];d&&a.f.set(_.Qc,
29
+ {Mc:d.licenseUrl||"",customData:c,ce:!1});(b=b[_.Sc])&&a.f.set(_.Sc,{Mc:b.licenseUrl||"",customData:c,ce:!1});if(0===a.f.size)throw new _.H(_.G,6,6E3);if((c=a.g.preferredDrmSystem)&&a.f.get(c))a.a=c;else if(a.f.get(_.Qc))a.a=_.Qc;else if(a.f.get(_.Sc))a.a=_.Sc;else throw new _.H(_.G,6,6001,"Configuration for the target system is missing.");yield LG(a);a.j=!0})}release(){const a=this;return _.x(function*(){a.j=!1;a.o=null;a.a=_.Nd;a.l=null;a.f=new Map})}getDrmInfo(){return this.o}},OG="DeleteLicenseAfterUse",
30
+ PG="LicenseServer",QG="CustomData";var WH=class{constructor(a){this.m=a;this.a=this.m.a;this.f=_.Am;this.j=_.Aq;this.w=(new Date).getTime();this.l=!1;this.o=-1;this.g=2;this.h=new _.R("clpp.tizen.StateManager")}initialize(){this.a.on(LH,this.C,this);this.a.on(RH,this.B,this);this.a.on(SH,this.A,this);this.a.on(NH,this.H,this);this.a.on(OH,this.G,this);this.a.on(TH,this.F,this)}release(){TG(this,_.Am);this.l=!1;this.o=-1;this.g=2}destroy(){this.release();this.a.off(LH,this.C);this.a.off(RH,this.B);this.a.off(SH,this.A);this.a.off(NH,
31
+ this.H);this.a.off(OH,this.G);this.a.off(TH,this.F);this.m=this.a=null}C(){this.h.debug("Buffering start. Player state: ",this.a.getState());this.g=this.a.B?1:2;TG(this,_.vm)}B(a){this.h.debug("Buffering progress: "+a.percent+" %. Player state: ",SG(this.f))}A(){this.h.debug("Buffering complete. Player state: ",this.a.getState());if(!this.l){this.l=!0;var a=this.m.getConfiguration().autoplay;const b=this.a.getState()===UH;if(!a&&b){TG(this,_.Cm);return}}if(a=this.f!==_.Bm)a=this.a.getState(),a=a===
32
+ UG||a===VG;a&&WG(this)}H(){this.h.debug("Preparing starts. AVPlay State: ",this.a.getState());this.a.getState()===VH?TG(this,_.Bm):this.h.error("AVPlay prepares while state is not IDLE")}G(){this.h.debug("Preparing ends: AVPlay state:",this.a.getState())}F(){TG(this,_.sm)}getState(){return this.f}};var XH=class{constructor(){this.o=this.A=this.f=this.g=this.B=this.m=this.j=this.a=null;this.w=!0;this.l=null;this.h=new _.R("clpp.tizen.TextStreamer")}initialize(a){this.m=a}load(a){const b=this;return _.x(function*(){if(b.m)if(b.B=a,b.j=yield XG(b),b.j){var c={networkingEngine:b.m.getNetworkEngine(),filterNewPeriod:()=>{},filterAllPeriods:()=>{},onTimelineCueAdded:()=>{},onEvent:()=>{},onError:()=>{}};try{b.a=yield b.j.start(a.url,c)}catch(d){b.h.warn(d);try{b.a=yield b.j.start(a.url.replace("https://",
33
+ "http://"),c)}catch(e){b.h.error(e),b.a=null}}if(b.a&&YG(b.a)){b.g=ZG(b);try{yield b.g.I;b.f=$G(b);const d=b.m.getConfiguration();b.f.g=d.streaming;b.o=d.preferredTextLanguage;b.A=d.preferredTextRole}catch(d){b.h.debug("Could not setup media source..."),b.g=null,b.f=null,b.j=null,b.a=null}}}else b.h.debug("Could not find manifest parser for source. Make sure parsers are registered.");else b.h.debug("Text streamer is not initialized. Will not load()")})}F(a){this.h.debug(_.wv,a);this.w=!0;let b=_.Cx(a.textStreams,
34
+ this.o||"",this.A||"")[0]||null;this.l&&(a.textStreams.includes(this.l)&&(b=this.l),this.l=null);return{variant:null,text:b}}C(){this.h.debug("canSwitch_");this.w=!1;this.l&&(_.Yy(this.f,this.l,!0,0),this.l=null)}U(){this.h.debug("onError_")}G(){this.j&&this.j.update&&this.j.update()}start(){const a=this;return _.x(function*(){if(a.f)try{a.f.start()}catch(b){a.h.error("Error while starting streaming engine",b)}})}setTextVisibility(a){this.h.debug("Set text visibility",a);this.g&&this.g.getTextDisplayer().setTextVisibility(a)}release(){const a=
35
+ this;return _.x(function*(){a.m=null;a.a=null;a.B=null;a.A=null;a.o=null;a.w=!0;a.l=null})}destroy(){const a=this;return _.x(function*(){a.j&&(yield a.j.stop(),a.j=null);a.f&&(yield a.f.destroy(),a.f=null,a.w=!0);a.g&&(yield a.g.destroy(),a.g=null)})}};var W=class extends _.S{constructor(){super();this.g=this.a=this.m=null;this.f={};this.h=new _.R("clpp.tizen.TrackManager");this.w=this.l=this.j=null;this.B=!1;this.o=1}C(a){var b=a.eventid;a=a.data;switch(b){case YH:0<Object.keys(this.f).length||(this.h.debug("Loading track manager!"),this.load());b=webapis.avplay.getCurrentStreamInfo();0<b.length&&(b=+gH(this,b[0].extra_info).Bit_rate,b=hH(this,{bandwidth:b}))&&(this.w=b,fH(this,b));break;case ZH:eH(this);break;default:this.h.debug("Event type: "+
36
+ b+" data: "+a)}}A(a){a.detail.currentState===_.Dm&&this.m.off(_.Ge,this.A)}initialize(a){this.m=a;this.a=this.m.a;this.m.on(_.Ge,b=>{this.B||(b=b.detail,b.currentState===_.Dm&&(this.h.debug("Current state",b.currentState),this.B=!0,iH(this)))});this.a.on($H,this.C,this)}release(){this.f={};this.g=this.w=this.l=this.j=null;this.B=!1;this.o=1}load(){if(this.a&&!(0<Object.keys(this.f).length)){this.g=this.m.g;this.m.off(_.Ge,this.A);this.m.on(_.Ge,this.A,this);try{const a=wH(this.a);this.f=oH(this,a);
37
+ const b=this.f[_.L]||[];b.length&&(this.j=b[0].renditions[0]||null);eH(this)}catch(a){this.h.debug("Could not load track manager")}}}destroy(){this.a.off($H,this.C);this.a=this.m=null}getVideoTracks(){return this.f[_.M]||[]}getAudioTracks(){return this.f[_.L]||[]}ja(){return this.f[_.K]||[]}ia(){return rH(this,_.M)}Ha(){return rH(this,_.L)}Ia(){return rH(this,_.K)}Sa(){return this.w}eb(){this.h.info(EG);return null}fb(){this.h.info(EG);return null}Ka(){const a=this.ia();return a?a.track:null}oa(){const a=
38
+ this.Ha();return a?a.track:null}pa(){const a=this.Ia();return a?a.track:null}Xa(a){null===a?(a=this.ia(),yH(this.a,a.bandwidth,null).then(()=>{eH(this)})):0<a.renditions.length&&this.Wa(a.renditions[0])}sa(a){a?uH(this,a.renditions[0]):this.h.warn("Cannot disable audio tracks on this platform.","Consider muting audio instead...")}Ea(a){a?(a=a.renditions[0],this.g?dH(this.g,a.track):uH(this,a)):(this.h.debug("Disabling text tracks"),this.l=null,zH(this.a,!1),this.m.trigger(new _.F(_.rj)))}Wa(a){const b=
39
+ this.ia();this.a.o||a.width!==b.width||a.height!==b.height||a.bandwidth!==b.bandwidth?(this.w=a,fH(this,a),yH(this.a,b.bandwidth,a.bandwidth).then(()=>{eH(this)}).catch(c=>{const d=new _.H(_.G,7,7200,{tizenerror:c});this.h.debug("Error while switching video track",c);this.m.onError(d)})):this.h.debug("Trying to switch to already active rendition. Doing nothing...")}kb(a){uH(this,a)}lb(a){this.g?dH(this.g,a.track):uH(this,a)}addTextTrack(){}la(){return this.a.o}};W.prototype.isAbrEnabled=W.prototype.la;
40
+ W.prototype.addTextTrack=W.prototype.addTextTrack;W.prototype.setTextRendition=W.prototype.lb;W.prototype.setAudioRendition=W.prototype.kb;W.prototype.setVideoRendition=W.prototype.Wa;W.prototype.setTextTrack=W.prototype.Ea;W.prototype.setAudioTrack=W.prototype.sa;W.prototype.setVideoTrack=W.prototype.Xa;W.prototype.getTextTrack=W.prototype.pa;W.prototype.getAudioTrack=W.prototype.oa;W.prototype.getVideoTrack=W.prototype.Ka;W.prototype.getLoadingTextRendition=W.prototype.fb;
41
+ W.prototype.getLoadingAudioRendition=W.prototype.eb;W.prototype.getLoadingVideoRendition=W.prototype.Sa;W.prototype.getTextRendition=W.prototype.Ia;W.prototype.getAudioRendition=W.prototype.Ha;W.prototype.getVideoRendition=W.prototype.ia;W.prototype.getTextTracks=W.prototype.ja;W.prototype.getAudioTracks=W.prototype.getAudioTracks;W.prototype.getVideoTracks=W.prototype.getVideoTracks;var dI=class extends _.dq{constructor(a){super();this.m=a;this.g=null;this.h=new _.R("clpp.tizen.Middleware");this.C=1;this.B=!1;this.l=null;this.F=0;this.o=!0;this.f=!1;this.a=null;this.A=1;this.w=!1;this.j={}}I(){this.w=!0;this.f||this.trigger(new _.F(LH))}H(a){this.w=!0;this.trigger(new _.F(RH,{percent:a}))}G(){this.w=!1;this.trigger(new _.F(SH))}M(){this.trigger(new _.F(TH))}K(a,b){this.trigger(new _.F($H,{eventid:a,data:b}))}N(a,b,c,d,e){this.trigger(new _.F(aI,{duration:a,text:b,subtitleType:c,
42
+ attriCount:d,attributes:e}))}J(a,b){this.trigger(new _.F(bI,{drmType:a,drmData:b}));this.g&&(a=this.g,a.j&&(a.a===_.Sc&&"Challenge"===b.name?NG(a,b):"DrmError"===b.name&&(a.h.debug("DrmError event",b),b=new _.H(_.G,6,6005,{message:JSON.stringify(b)}),a.D.onError(b))))}U(a){this.trigger(new _.F(cI,{eventType:a}))}play(){const a=this.getState(),b=()=>new Promise((c,d)=>{let e=null;const f=()=>{c();clearTimeout(e)};this.one(BH,f,this);e=setTimeout(()=>{this.off(BH,f);d("Timeout")},3E4)});if(a===VH)return(new Promise((c,
43
+ d)=>{webapis.avplay.prepareAsync(()=>{DH(this);c(webapis.avplay.play())},e=>{this.trigger(new _.F(cI));d(e)})})).then(()=>b());if(a===VG||a===UH)try{return webapis.avplay.play(),b()}catch(c){return Promise.reject(c)}return a===UG?Promise.resolve():Promise.reject("Player is in invalid state")}pause(){try{webapis.avplay.pause()}catch(a){Promise.reject(a)}return this.getState()===VG?Promise.resolve():Promise.reject()}setPlaybackRate(a){const b=this.getState();if(b===UH||b===UG||b===VG){try{webapis.avplay.setSpeed(a),
44
+ this.C=a}catch(c){return this.h.debug("Error while trying to set playback rate",c),this.setPlaybackRate(this.C)}return!0}this.h.debug("Cannot set playback rate; AVPlay is in inconsistent state: "+b);return!1}getPlaybackRate(){return this.C}load(a,b){const c=this;return _.x(function*(){c.h.debug("configure()",b||"");try{yield IH(c),yield PH(c,a,b)}catch(d){throw new _.H(_.G,7,7003,null,d);}})}getState(){if(this.f&&this.a)return this.a.ye;try{return webapis.avplay.getState()}catch(a){this.U(JSON.stringify(a))}}seek(a){const b=
45
+ 1E3*a;return new Promise((c,d)=>{this.B=!0;this.m.trigger(new _.F(_.af));webapis.avplay.seekTo(b,()=>{this.B=!1;this.m.trigger(new _.F(_.$e));c()},()=>{this.B=!1;d()})})}getPosition(){if(this.f&&this.a)return this.a.position;try{return webapis.avplay.getCurrentTime()/1E3}catch(a){this.U(JSON.stringify(a))}}getDuration(){if(this.f&&this.a)return this.a.duration;try{return webapis.avplay.getDuration()/1E3}catch(a){this.U(JSON.stringify(a))}}release(){return new Promise((a,b)=>{try{this.g&&(this.g.release(),
46
+ this.g=null);webapis.avplay.stop();webapis.avplay.close();for(const c in this.j){const d=this.j[c];d&&d.rd.stop()}this.j={};this.C=1;this.B=!1;this.a=this.l=null;return a()}catch(c){return b(c)}})}getVolume(){let a=null;try{a=tizen.tvaudiocontrol.getVolume()}catch(b){switch(b.name){case FG:this.h.debug("The application does not have the privilege to get the volume.",GG);break;default:this.h.debug(DG,b)}}return a}setVolume(a){try{tizen.tvaudiocontrol.setVolume(Math.max(0,Math.min(100*a,100)))}catch(b){switch(b.name){case "InvalidValueError":this.h.warn("Invalid value passed for setVolume.",
47
+ "The passed value value should be in the range of 0 to 1.");break;case FG:this.h.warn("The application does not have the privilege to set the volume.",GG);break;default:this.h.warn("An unknown error occurred while trying to set volume",b)}}}isLive(){if(this.f&&this.a)return this.a.isLive;try{return"1"===webapis.avplay.getStreamingProperty("IS_LIVE")}catch(a){this.U(JSON.stringify(a))}}stop(){try{webapis.avplay.stop()}catch(a){this.h.debug(a)}}getDrmInfo(){this.g&&this.g.getDrmInfo();return null}setSourceIndex(a){this.F=
48
+ a}getSourceIndex(){return this.F}getLoadedSource(){return this.l&&this.l[this.getSourceIndex()]}},VH="IDLE",UH="READY",UG="PLAYING",VG="PAUSED",jH=_.yb,kH="AUDIO",tH="TEXT",ZH="PLAYER_MSG_RESOLUTION_CHANGED",YH="PLAYER_MSG_BITRATE_CHANGE",RG="PLAYREADY",MG="WIDEVINE_CDM";var hI=class extends _.dq{constructor(){super();this.a=new dI(this);this.f=new WH(this);this.configuration=this.B=_.Bj();this.w=null;this.h=new _.R("clpp.tizen.Player");this.j=null;this.l=new W;this.C=new _.Bn;this.o=this.g=null;this.A=!1}H(){this.h.debug("On Stream completed. Current time: ",this.getPosition());this.trigger(new _.F(_.kd));this.configuration.loop?this.seek(this.configuration.startTime||0).catch(()=>{this.h.debug("Could not loop playback")}):this.a.stop()}F(a){this.trigger(new _.F(_.Se,
49
+ {currentTime:a.currentTime/1E3}))}I(a){const b=this.a.getPosition(),c=b+a.duration/1E3;let d=a.text||"";this.h.debug("Got subtitles: ",d,"start:",b,"end:",c,a);(d=_.th(d))&&this.o.append([new _.Dp(b,c,d)],[])}G(a){this.h.debug("DRM event: "+a.drmType+", data: "+a.drmData)}J(){this.A||(this.h.debug("Initial buffering completed..."),this.A=!0)}U(a){this.h.debug(`Error: TYPE: ${a.eventType}`);TG(this.f,_.zm);a=new _.H(_.G,7,7200,{tizenerror:a.eventType});this.a.release();this.trigger(new _.F(_.ld,{detail:a}))}init(a,
50
+ b){this.configuration=this.B=b;this.w=a;this.a.on(TH,this.H,this);this.a.on(BH,this.F,this);this.a.on(aI,this.I,this);this.a.on(bI,this.G,this);this.a.on(cI,this.U,this);this.a.on(SH,this.J,this);this.f.initialize();this.l.initialize(this);this.h.debug("Initializing player surface");this.w.hideMediaElement();a=eI;eI+=1;a="__clpp_tizen_player_"+a;this.j=_.Xm(_.Od,{id:a,type:"application/avplayer"});this.w.addElementToContainer(this.j,!0);var c=this.w.getMedia();if(c){a=this.j;{b=[_.tf,_.pd,"position",
51
+ _.vd,"top"];const e={};c=null!==c.parentElement?window.getComputedStyle(c,null):c.style;if(!b||0===b.length)for(d in b||(b=[]),c)b.push(d);for(const f of b)e[f]=c[f];var d=e}_.Zm(a,d);QH(this)}}getSurface(){return this.w}getConfiguration(){return this.configuration}destroy(){const a=this;return _.x(function*(){yield a.release();a.a.off(TH,a.H);a.a.off(BH,a.F);a.a.off(aI,a.I);a.a.off(bI,a.G);a.a.off(cI,a.U);a.a.off(SH,a.J);a.g&&(yield a.g.destroy(),a.g=null);a.j&&(a.j.parentElement.removeChild(a.j),
52
+ a.j=null);a.l.destroy();a.f.destroy();a.l=null;a.f=null})}namespace(){return fI}getPlaybackRate(){return this.a.getPlaybackRate()}setDrmCustomDataModifier(){}setCdnErrorCallback(){}detach(){}setPlaybackRate(a){this.a.setPlaybackRate(a)}getPosition(){return 0<(this.configuration.startTime||0)&&!this.A?0:this.f.getState()===_.sm?this.getDuration():this.a.getPosition()||0}seek(a){return typeof a===_.r&&0<=a?(this.isLive()||(a=Math.min(a,this.getDuration())),this.a.seek(a)):Promise.reject()}getPresentationStartTime(){return null}getSeekRange(){return{start:0,
53
+ end:0}}getVolume(){const a=this.a.getVolume();return typeof a===_.r?a/100:null}setVolume(a){this.a.setVolume(a)}getDuration(){return this.a.getDuration()}getBufferInfo(){this.h.warn(_.ma);return new _.cq}getTrackManager(){return this.l}unload(){return this.a.release().then(()=>{this.l.release()})}release(){const a=this;return _.x(function*(){a.g&&(yield a.g.release());a.o&&(yield a.o.destroy(),a.o=null);yield a.a.release();a.l.release();a.f.release();a.A=!1})}load(a){const b=this;return _.x(function*(){_.Ej(a)&&
54
+ (b.configuration=_.Dj(b.B,a));var c=_.im(b.configuration,[_.rd,"native"]);b.o=c.create(b);c=_.Gm(b.configuration)[0];if(b.configuration.tizen&&b.configuration.tizen.sideStreamText){b.g=new XH;b.g.initialize(b);try{yield b.g.load(c),b.g.start()}catch(d){b.h.error(d)}}try{yield b.a.load(b.configuration)}catch(d){throw b.onError(d),d;}b.l.load()})}play(){this.trigger(new _.F(_.ee));QH(this);return this.a.play().then(()=>{WG(this.f)})}pause(){return this.a.pause().then(()=>{WG(this.f)})}getState(){return this.f.getState()}getPeriods(){return[]}onError(a){const b=
55
+ new _.F(_.ld,{detail:a});a.severity===_.G&&(TG(this.f,_.zm),this.a.release());this.trigger(b);b.defaultPrevented&&(b.a=!0)}getDrmInfo(){return this.a.getDrmInfo()}isEnded(){return this.f.getState()===_.sm}isPaused(){return this.a.getState()===VG}isMuted(){return GH(this.a)}setMuted(a){KH(this.a,a)}getNetworkEngine(){return this.C}setNetworkEngine(a){this.C=a}isLive(){return this.a.isLive()}getStats(){return null}setSourceIndex(a){this.a.setSourceIndex(a)}getSourceIndex(){return this.a.getSourceIndex()}getLoadedSource(){return this.a.getLoadedSource()}canPlay(a,
56
+ b){return(new gI).canPlay(a,b)}getTimelineCues(){return[]}getTextDisplayer(){return this.o}resetAbr(){}};hI.prototype.getTextDisplayer=hI.prototype.getTextDisplayer;hI.prototype.setNetworkEngine=hI.prototype.setNetworkEngine;hI.prototype.getNetworkEngine=hI.prototype.getNetworkEngine;
57
+ var fI="clpp.tizen",eI=0,gI=class{a(){return fI}canPlay(a){a=a.type;const b=!!window.webapis;if((a===_.$b||a===_.vj||a===_.ec)&&b){if(_.Fi(2))return 2;if(_.Fi(3)||_.Fi(4)||_.Fi(5)||_.Fi(6))return _.C("Use of clpp.tizen.TizenComponent is not recommended for Tizen version \x3e\x3d 3."),1}return 0}create(){return new hI}};_.z("clpp.tizen.TizenComponent",class extends _.Pq{f(){_.hg(new gI)}a(){var a=fI;a&&_.fg[a]&&(delete _.fg[a],_.gg.info("Removed Player factory: '"+a+"'"))}id(){return"tizen"}});var LH="onbufferingstart",RH="onbufferingprogress",SH="onbufferingcomplete",TH="onstreamcompleted",BH="oncurrentplaytime",$H="onevent",aI="onsubtitlechange",bI="ondrmevent",cI="onerror",NH="preparingstart",OH="preparingend";};f.call(g, window);
package/cl.ttml.js CHANGED
@@ -1,22 +1,22 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var or='application/mp4; codecs\x3d"stpp.ttml"',pr='application/mp4; codecs\x3d"stpp.ttml.im1i"',qr='application/mp4; codecs\x3d"stpp.ttml.im1t"',rr="backgroundColor",sr="direction",tr="displayAlign",ur="region",vr="textAlign",wr="textDecoration",xr="writingMode",yr=function(a,b,c){a=a.f;for(let d=a.length-1;0<=d;d--){const e=b.get(a[d]);if(c in e.a)return e.getAttribute(c)}return null},Gr=function(a,b){var c=null;if(zr.test(a)){{a=zr.exec(a);c=Number(a[1]);const d=Number(a[2]);let e=
2
- Number(a[3]),f=Number(a[4]);f+=(Number(a[5])||0)/b.f;e+=f/b.frameRate;c=e+60*d+3600*c}}else Ar.test(a)?c=Br(Ar,a):Cr.test(a)?c=Br(Cr,a):Dr.test(a)?(a=Dr.exec(a),c=Number(a[1])/b.frameRate):Er.test(a)?(a=Er.exec(a),c=Number(a[1])/b.a):Fr.test(a)&&(c=Br(Fr,a));return c},Br=function(a,b){a=a.exec(b);return null==a||""===a[0]?null:(Number(a[4])||0)/1E3+(Number(a[3])||0)+60*(Number(a[2])||0)+3600*(Number(a[1])||0)},Hr=function(a){return a.split(":").pop()},Ir=function(a){return a.replace(/(\d*\.?\d+)c/g,
3
- "$1em")},Kr=function(a,b){for(;Jr.test(a);){const c=Jr.exec(a)[0];a=a.replace(c,`${parseInt(c,10)/b}em`)}return a},Lr=function(a,b,c){a=yr(a,b,vr);if(!a&&c&&(a=yr(c,b,vr),!a&&"rltb"===yr(c,b,xr)))return _.ce;switch(a){case _.sc:return _.mo;case _.ce:case _.Wc:return _.ce;default:return _.fd}},Mr=function(a,b,c){if(_.Ng(a.o))return document.createTextNode(_.Rg(a.o||""));if(a.w)return _.am("br");const d=_.am("span");for(const e of a.f)_.bm(d,e);for(const e of a.h)d.appendChild(Mr(c.get(e),b,c));return d},
4
- Pr=function(a,b,c,d){const e=Nr.exec(a);a=Or.exec(a);return typeof b===_.r&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},Qr=function(a,b){return typeof b===_.r&&0<b?_.uo:Or.test(a)?0:_.uo},Rr=function(a,b,c){return typeof a===_.r?a:typeof b===_.r?b:c},Sr=function(a,b){a=a.getAttribute("extent");return(a=Or.exec(a))?Number(a[b]):null},Ur=function(a){a=a.getAttribute("cellResolution");return(a=Tr.exec(a))?Number(a[2]):null},Wr=function(){return`${"inline-"}${Vr++}`},Yr=function(a){return Xr.some(b=>
5
- b in a.attributes)},Zr=function(a,b){if(0===b.length)return[];const c=[];for(const d of b)a.a.has(d)&&c.push(...Zr(a,a.a.get(d).f),d);return c},$r=function(a){return a.m.map(b=>b.build(a.j,a.o,a.w,a.g,a.a,a.h,a.f)).filter(b=>null!=b)},as=function(a){return Hr(a.g.nodeName)},ds=function(a,b){if(a.a.has(b))return a.a.get(b);var c=null,d=null;let e=[],f=[],g={};const h=b.parentNode;if(h&&a.a.has(h)){const k=a.a.get(h);e=[...k.j];-1===["#text","span","br"].indexOf(b.nodeName)&&(c=k.a,d=k.h,f=[...k.f],
6
- g={},bs.forEach(l=>{l in k.attributes&&(g[l]=k.attributes[l])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(ur)&&(c=b.getAttribute(ur));b.hasAttribute(_.oe)&&f.push(...b.getAttribute(_.oe).split(" "));d=Array.from(b.attributes).map(k=>k.name);for(const k of d)d=Hr(k),g[d]=b.getAttribute(k);d=g.backgroundImage}c=new cs(b,c,d,e,f,g);a.a.set(b,c);return c},es=function(a){return`${String(Math.floor(a/3600)).padStart(2,"0")}:${String(Math.floor(a/60%60)).padStart(2,"0")}:${String(Math.floor(a%60)).padStart(2,
7
- "0")}.${String(Math.floor(1E3*a%1E3)).padStart(3,"0")}`},fs=class{constructor(a,b,c){this.g=a;this.f=b;this.a=c}getId(){return this.g}getAttribute(a){return this.a[a]}};var gs=class extends fs{constructor(a,b,c){super(a,[],c);this.h=b||""}};var hs=class extends fs{constructor(a,b,c){super(a,b,c)}};var zr=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Ar=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,Cr=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,Dr=/^(\d*(?:\.\d*)?)f$/,Er=/^(\d*(?:\.\d*)?)t$/,Fr=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,Nr=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,Or=/^(\d+)px (\d+)px$/,Tr=/^(\d+) (\d+)$/,Jr=/(\d+)px/,is=/^(\d+px|\d+em|\d*\.?\d+c)$/,Xr=["fontStyle","fontSize","fontFamily","fontWeight","lineHeight",
8
- "color",rr,"opacity","padding","zIndex",vr,tr,xr,sr,wr,"textOutline"],bs=["begin",_.Wc];var js=class extends hs{constructor(a,b,c,d,e,f,g){super(a,f,g);this.o=b;this.w=c;this.m=d;this.j=e;this.h=[]}build(a,b,c,d,e,f,g){let h=Gr(this.a.begin,b);b=Gr(this.a.end,b);if(null===h||null===b)return null;h+=c;b+=c;c=_.am(_.Oc);for(const k of this.h)c.appendChild(Mr(g.get(k),e,g));g=new _.ro(h,b,c.innerHTML.trim(),_.we);g.cssClassList=[...this.f];g.textAlign=Lr(this,e,null);g.writingMode=_.no;g.line=-1;g.lineInterpretation=_.oo;g.lineAlign=_.po;g.containerRows=Rr(null,Ur(a),15);if(this.m&&(f=
9
- f.get(this.m))){g.region=f.build(a,e);g.textAlign=Lr(this,e,f);a:switch(yr(f,e,xr)){case "tb":case "tblr":a=_.Ee;break a;case "tbrl":a=_.Fe;break a;default:a=_.no}g.writingMode=a;a:switch(yr(f,e,tr)){case _.sc:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(yr(f,e,tr)){case _.sc:a=1;break a;default:a=_.oo}g.lineInterpretation=a;a:switch(yr(f,e,tr)){case _.sc:e=_.sc;break a;default:e=_.po}g.lineAlign=e}this.j&&(d=d.get(this.j))&&(a=d,d=a.getAttribute("encoding"),e=a.getAttribute("imageType")||
10
- a.getAttribute("imagetype"),a=a.h.trim(),d="PNG"===e&&"Base64"===d&&0<a.length?`data:image/png;base64,${a}`:null,g.backgroundImage=d||"");return g}};var ks=class{constructor(a,b,c,d){this.frameRate=Number(a)||30;this.f=Number(b)||1;this.a=Number(d);0===this.a&&(this.a=a?this.frameRate*this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&(this.frameRate*=Number(a[1])/Number(a[2]))}};var ls=class extends hs{constructor(a,b,c){super(a,b,c)}build(a,b){const c=new _.wo;c.id=this.getId();const d=Rr(a.h.containerWidth,Sr(a,1),720);a=Rr(a.h.containerHeight,Sr(a,2),480);a:switch(yr(this,b,tr)){case "after":var e="flex-start";break a;case _.sc:e=_.sc;break a;default:e="flex-end"}c.displayAlign=e;a:switch(yr(this,b,xr)){case "tb":case "tblr":e="row-reverse";break a;case "tbrl":e="row";break a;default:e=_.Ec}c.writingMode=e;e=this.getAttribute("extent")||yr(this,b,"extent");c.width=Pr(e,
11
- d,1,100);c.widthUnits=Qr(e,d);c.height=Pr(e,a,2,100);c.heightUnits=Qr(e,a);b=this.getAttribute("origin")||yr(this,b,"origin");c.viewportAnchorX=Pr(b,d,1,0);c.viewportAnchorY=Pr(b,a,2,0);c.viewportAnchorUnits=Qr(b,d);c.cssClassList=[...this.f];return c}};var ms=class extends fs{constructor(a,b){super("root-container",[],b);this.h=a}};var os=class extends fs{constructor(a,b,c){super(a,b,c)}build(a){var b=null;var c=Ur(a);c&&(b=Rr(a.h.containerHeight,Sr(a,2),480)/c);b=Rr(a.h.fontSizeRadix,b,16);a=[];c=`::ttml .${this.g}, ::ttml .${this.g} * {`;for(const [g,h]of ns.entries())g in this.a&&(c+=`${h}:${Ir(this.a[g])};`);a:{if("unicodeBidi"in this.a){var d=this.a.unicodeBidi;var e="";switch(d){case "normal":case "embed":e=d;break;case "bidiOverride":e="bidi-override"}if(0<e.length){d=`unicode-bidi:${e};`;break a}}d=""}c+=d;a:{if("textOutline"in
12
- this.a){d=this.a.textOutline.split(" ");e="black";let g=".4em";const h=d[0]&&d[0].trim(),k=d[1]&&d[1].trim(),l=d[2]&&d[2].trim();3===d.length&&!is.test(h)&&is.test(k)&&is.test(l)?(e=h,g=k):2===d.length&&!is.test(h)&&is.test(k)?(e=h,g=k):2===d.length&&is.test(h)&&is.test(k)&&(g=h);if(""!==g){g=Ir(g);d="text-shadow:"+`0 0 ${g} ${e},`+`0 0 ${g} ${e},`+`0 0 ${g} ${e};`;break a}}d=""}c=c+d+("fontFamily"in this.a?`font-family:${this.a.fontFamily.replace("monospaceSansSerif","monospace").replace("monospaceSerif",
13
- "monospace").replace("proportionalSansSerif","sans-serif").replace("proportionalSerif","sans-serif").replace("sansSerif","sans-serif").replace("default","sans-serif")};`:"");a:{if(wr in this.a){d=this.a.textDecoration.split(" ");e=[];for(f of d)switch(f){case "underline":case "overline":e.push(f);break;case "lineThrough":e.push("line-through")}if(0<e.length){var f=`text-decoration:${e.join(" ")};`;break a}}f=""}"padding"in this.a?(d="border: solid transparent;border-width:"+Ir(this.a.padding),d+=
14
- ";"):d="";f=c=c+f+d;"lineHeight"in this.a?(c="",d=this.a.lineHeight,d=Ir(d),d=Kr(d,b),c+="line-height:",c+=d,c+=";"):c="";a.push(f+c+"}");a:{if("fontSize"in this.a&&(f=this.a.fontSize.split(" "),c=null,1===f.length&&(c=f[0]),2===f.length&&(c=f[1]),c)){c=c.trim();c=Ir(c);c=Kr(c,b);b=`font-size:${c};`;break a}b=null}b&&(f=`::ttml .${this.g} .clpp-text-wrapper {`,f+=b,f+="}",a.push(f),f=`::ttml .clpp-text-wrapper__${this.g} {`,f+=b,f+="}",a.push(f));return a}},ns=new Map([["color","color"],[rr,"background-color"],
15
- [sr,sr],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var ps=class{constructor(a){this.A=a;this.o=this.j=null;this.w=0;this.g=new Map;this.a=new Map;this.h=new Map;this.f=new Map;this.m=[]}},Vr=0;var ss=class{constructor(a){this.a=a.firstChild;this.f=new Set}next(){if(!this.a)return null;let a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!qs.has(Hr(a.nodeName))||rs.has(Hr(a.nodeName))||!a.firstChild||this.f.has(a.firstChild)?a.nextSibling?a=a.nextSibling:a=a.parentNode:a=a.firstChild;while(a&&(this.f.has(a)||a.nodeType!==Node.TEXT_NODE&&!qs.has(Hr(a.nodeName))));const b=this.a;this.a=a;return b}},qs=new Set(["tt","head","layout",_.td,_.cd,ur,"styling",_.oe,"body",_.Oc,"p","span","br"]),
16
- rs=new Set([_.oe,_.cd]);var cs=class{constructor(a,b,c,d,e,f){this.g=a;this.a=b;this.h=c;this.j=d;this.f=e;this.attributes=f}getId(){return this.attributes.id}};var ts=class{constructor(){this.a=new Map}};var us=class{constructor(a){this.a=a;this.f=new DOMParser}parseInit(){}parseMedia(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.kf(this.a.ttml||{}),e=_.I(a,0,c[0]);e=_.Eg(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.te)}catch(m){throw new _.H(_.G,2,2005,"Failed to parse TTML.");}d=new ps(d);e=new ts;f=new ss(f);b=b.periodStart;typeof b===_.r&&(d.w=b);b=c[0];for(var g=1;g<c.length;++g){var h=c[g],k=_.I(a,b,h);k=_.Sg(k);const m=`urn:mpeg:14496-30:subs:${g}`;d.g.set(m,
17
- new gs(m,k,{imageType:"PNG",encoding:"Base64"}));b+=h}for(;f.a;)a=f.next(),a=ds(e,a),c=d,b=a,"tt"===as(b)&&(c.j=new ms(c.A,Object.assign({},b.attributes))),c=d,b=a,"tt"===as(b)&&(c.o=new ks(b.attributes.frameRate,b.attributes.subFrameRate,b.attributes.frameRateMultiplier,b.attributes.tickRate)),c=d,b=a,as(b)!==_.cd||b.attributes.begin||b.attributes.end||(g=`#${b.getId()}`,c.g.set(g,new gs(g,b.g.textContent,b.attributes))),c=d,g=a,as(g)===_.cd&&g.attributes.begin&&g.attributes.end?(b=`#${Wr()}`,g=
18
- new gs(b,g.g.textContent,g.attributes),c.g.set(b,g),c=g):c=null,c&&(a.h=c.getId()),c=d,b=a,as(b)===_.oe&&(g=b.getId()||Wr(),h=new os(g,b.f,Object.assign({},b.attributes)),c.a.set(g,h),b.a&&c.h.get(b.a).f.push(g)),c=d,g=a,as(g)!==_.oe&&Yr(g)?(b=Wr(),g=new os(b,[],Object.assign({},g.attributes)),c.a.set(b,g),c=g):c=null,c&&a.f.push(c.getId()),c=d,g=a,as(g)!==_.Oc||!g.attributes.extent&&!g.attributes.origin?c=null:(b=Wr(),g=new ls(b,Zr(c,g.f),Object.assign({},g.attributes)),c.h.set(b,g),c=g),c&&(a.a=
19
- c.getId()),c=d,g=a,as(g)!==ur?c=null:(b=g.getId(),g=new ls(b,Zr(c,g.f),Object.assign({},g.attributes)),c.h.set(b,g),c=g),c&&(a.a=c.getId()),c=d,g=a,b=g.j,-1===["#text","span","br"].indexOf(as(g))||0===b.length?c=null:(h=b[b.length-1],c.f.has(h)?(b=Wr(),g=new js(b,"#text"===g.g.nodeName?g.g.textContent:null,"br"===as(g),g.a,g.h,Zr(c,g.f),g.attributes),c.f.set(b,g),(c=c.f.get(h))&&c.h.push(b),c=g):c=null),c&&a.j.push(c.getId()),c=d,g=a,"p"===as(g)||g.h?(b=Wr(),g=new js(b,null,!1,g.a,g.h,Zr(c,g.f),g.attributes),
20
- c.f.set(b,g),c.m.push(g),c=g):c=null,c&&a.j.push(c.getId());e=$r(d);f=[];for(l of d.a.values())f.push(...l.build(d.j));var l=f;return{cues:e,styles:l}}};var vs=class{constructor(a){this.f=a}a(a){var b=new us(this.f);({cues:a}=b.parseMedia(a,{periodStart:0,segmentStart:null,segmentEnd:0}));b="WEBVTT\n\n";for(const d of a){a=b;b=es(d.startTime)+" --\x3e "+es(d.endTime);{var c=d;const e=[];switch(c.textAlign){case _.fd:e.push("align:left");break;case _.ce:e.push("align:right");break;case _.mo:e.push("align:middle");break;case _.fd:e.push("align:start");break;case _.ce:e.push("align:end")}switch(c.writingMode){case _.Ee:e.push("vertical:lr");break;case _.Fe:e.push("vertical:rl")}c=
21
- e.length?" "+e.join(" "):""}b=a+(b+c+"\n");b+=d.payload+"\n\n"}return _.Ig(b)}},ws=class{probe(a,b){return a===_.Wb&&b===_.se}create(a){return new vs(a)}};var xs=class{constructor(a){this.f=new us(a);this.a=new _.O("clpp.ttml.Mp4TtmlParser")}parseInit(a){let b=!1;(new _.Lj).L(_.wd,_.Ej).L(_.ve,_.Ej).L(_.rd,_.Ej).L(_.vd,_.Ej).L(_.le,_.Ej).Z(_.ne,_.Fj).L("stpp",c=>{b=!0;c.parser.stop()}).parse(a);if(!b)throw new _.H(_.G,2,2007);}parseMedia(a,b){let c=!1,d=[],e=[];const f=[];(new _.Lj).L("moof",_.Ej).L("traf",_.Ej).Z("subs",g=>{const h=_.N(g.reader);for(let k=0;k<h;++k){g.reader.skip(4);const l=_.xj(g.reader);for(let m=0;m<l;++m){const n=1===g.version?
22
- _.N(g.reader):_.xj(g.reader);f.push(n);g.reader.skip(6)}}}).L(_.qd,_.Gj(g=>{c=!0;g=this.f.parseMedia(g,b,f);d=d.concat(g.cues);e=e.concat(g.styles)})).parse(a);c||this.a.warn("Couldn't find the mdat box");return{cues:d,styles:e}}};_.z("clpp.ttml.TtmlComponent",class extends _.zp{constructor(){super();this.h=new ws}f(){_.Xn[_.Wb]=us;_.Xn[_.Ub]=xs;_.Xn[or]=xs;_.Xn[qr]=xs;_.Xn[pr]=xs;_.Rh.push(this.h)}a(){_.Yn(_.Wb);_.Yn(_.Ub);_.Yn(or);_.Yn(qr);_.Yn(pr);_.Th(this.h)}id(){return _.qe}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Gs='application/mp4; codecs\x3d"stpp.ttml"',Hs='application/mp4; codecs\x3d"stpp.ttml.im1i"',Is='application/mp4; codecs\x3d"stpp.ttml.im1t"',Js="backgroundColor",Ks="direction",Ls="displayAlign",Ms="region",Ns="textAlign",Os="textDecoration",Ps="writingMode",Qs=function(a,b,c){a=a.f;for(let d=a.length-1;0<=d;d--){const e=b.get(a[d]);if(c in e.a)return e.getAttribute(c)}return null},Ys=function(a,b){var c=null;if(Rs.test(a)){{a=Rs.exec(a);c=Number(a[1]);const d=Number(a[2]);let e=
2
+ Number(a[3]),f=Number(a[4]);f+=(Number(a[5])||0)/b.f;e+=f/b.frameRate;c=e+60*d+3600*c}}else Ss.test(a)?c=Ts(Ss,a):Us.test(a)?c=Ts(Us,a):Vs.test(a)?(a=Vs.exec(a),c=Number(a[1])/b.frameRate):Ws.test(a)?(a=Ws.exec(a),c=Number(a[1])/b.a):Xs.test(a)&&(c=Ts(Xs,a));return c},Ts=function(a,b){a=a.exec(b);return null==a||""===a[0]?null:(Number(a[4])||0)/1E3+(Number(a[3])||0)+60*(Number(a[2])||0)+3600*(Number(a[1])||0)},Zs=function(a){return a.split(":").pop()},$s=function(a){return a.replace(/(\d*\.?\d+)c/g,
3
+ "$1em")},bt=function(a,b){for(;at.test(a);){const c=at.exec(a)[0];a=a.replace(c,`${parseInt(c,10)/b}em`)}return a},ct=function(a){return a?a.replace(/(\d*\.?\d+)%/g,(b,c)=>`${c/100}em`):""},dt=function(a,b,c){a=Qs(a,b,Ns);if(!a&&c&&(a=Qs(c,b,Ns),!a&&"rltb"===Qs(c,b,Ps)))return _.ze;switch(a){case _.zc:return _.yp;case _.ze:case _.jd:return _.ze;default:return _.vd}},et=function(a,b,c){if(_.ph(a.w))return document.createTextNode(_.th(a.w||""));if(a.A)return _.Xm("br");const d=_.Xm("span");for(const e of a.f)_.Ym(d,
4
+ e);for(const e of a.j)d.appendChild(et(c.get(e),b,c));return d},ht=function(a,b,c,d){const e=ft.exec(a);a=gt.exec(a);return typeof b===_.r&&0<b&&a?100*Number(a[c])/b:e?Number(e[c]):a?Number(a[c]):d},it=function(a,b){return typeof b===_.r&&0<b?_.Gp:gt.test(a)?0:_.Gp},jt=function(a,b,c){return typeof a===_.r?a:typeof b===_.r?b:c},kt=function(a,b){a=a.getAttribute("extent");return(a=gt.exec(a))?Number(a[b]):null},mt=function(a){a=a.getAttribute("cellResolution");return(a=lt.exec(a))?Number(a[2]):null},
5
+ ot=function(){return`${"inline-"}${nt++}`},qt=function(a){return pt.some(b=>b in a.attributes)},rt=function(a,b){if(0===b.length)return[];const c=[];for(const d of b)a.a.has(d)&&c.push(...rt(a,a.a.get(d).f),d);return c},st=function(a){return a.o.map(b=>b.build(a.l,a.w,a.A,a.g,a.a,a.j,a.f)).filter(b=>null!=b)},tt=function(a){return Zs(a.g.nodeName)},wt=function(a,b){if(a.a.has(b))return a.a.get(b);var c=null,d=null;let e=[],f=[],g={};const h=b.parentNode;if(h&&a.a.has(h)){const k=a.a.get(h);e=[...k.l];
6
+ -1===["#text","span","br"].indexOf(b.nodeName)&&(c=k.a,d=k.j,f=[...k.f],g={},ut.forEach(l=>{l in k.attributes&&(g[l]=k.attributes[l])}))}if(b.nodeType===b.ELEMENT_NODE){b.hasAttribute(Ms)&&(c=b.getAttribute(Ms));b.hasAttribute(_.Le)&&f.push(...b.getAttribute(_.Le).split(" "));d=Array.from(b.attributes).map(k=>k.name);for(const k of d)d=Zs(k),g[d]=b.getAttribute(k);d=g.backgroundImage}c=new vt(b,c,d,e,f,g);a.a.set(b,c);return c},xt=function(a){return`${String(Math.floor(a/3600)).padStart(2,"0")}:${String(Math.floor(a/
7
+ 60%60)).padStart(2,"0")}:${String(Math.floor(a%60)).padStart(2,"0")}.${String(Math.floor(1E3*a%1E3)).padStart(3,"0")}`},yt=class{constructor(a,b,c){this.g=a;this.f=b;this.a=c}getId(){return this.g}getAttribute(a){return this.a[a]}};var zt=class extends yt{constructor(a,b,c){super(a,[],c);this.j=b||""}};var At=class extends yt{constructor(a,b,c){super(a,b,c)}};var Rs=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Ss=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,Us=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d+)$/,Vs=/^(\d*(?:\.\d*)?)f$/,Ws=/^(\d*(?:\.\d*)?)t$/,Xs=/^(?:(\d*(?:\.\d*)?)h)?(?:(\d*(?:\.\d*)?)m)?(?:(\d*(?:\.\d*)?)s)?(?:(\d*(?:\.\d*)?)ms)?$/,ft=/^(\d{1,2}(?:\.\d+)?|100(?:\.0+)?)% (\d{1,2}(?:\.\d+)?|100(?:\.0+)?)%$/,gt=/^(\d+)px (\d+)px$/,lt=/^(\d+) (\d+)$/,at=/(\d+)px/,Bt=/^(\d+px|\d+em|\d*\.?\d+c)$/,pt=[Js,"color",Ks,Ls,"fontFamily","fontSize","fontStyle","fontWeight",
8
+ "lineHeight","opacity","padding",Ns,Os,"textOutline",Ps,"zIndex"],ut=["begin",_.jd];var Ct=class extends At{constructor(a,b,c,d,e,f,g){super(a,f,g);this.w=b;this.A=c;this.o=d;this.l=e;this.j=[]}build(a,b,c,d,e,f,g){let h=Ys(this.a.begin,b);b=Ys(this.a.end,b);if(null===h||null===b)return null;h+=c;b+=c;c=_.Xm(_.Yc);for(const k of this.j)c.appendChild(et(g.get(k),e,g));g=new _.Dp(h,b,c.innerHTML.trim(),_.Ue);g.cssClassList=[...this.f];g.textAlign=dt(this,e,null);g.writingMode=_.zp;g.line=-1;g.lineInterpretation=_.Ap;g.lineAlign=_.Bp;g.containerRows=jt(null,mt(a),15);if(this.o&&(f=
9
+ f.get(this.o))){g.region=f.build(a,e);g.textAlign=dt(this,e,f);a:switch(Qs(f,e,Ps)){case "tb":case "tblr":a=_.cf;break a;case "tbrl":a=_.df;break a;default:a=_.zp}g.writingMode=a;a:switch(Qs(f,e,Ls)){case _.zc:a=50;break a;case "after":a=-1;break a;default:a=0}g.line=a;a:switch(Qs(f,e,Ls)){case _.zc:a=1;break a;default:a=_.Ap}g.lineInterpretation=a;a:switch(Qs(f,e,Ls)){case _.zc:e=_.zc;break a;default:e=_.Bp}g.lineAlign=e}this.l&&(d=d.get(this.l))&&(a=d,d=a.getAttribute("encoding"),e=a.getAttribute("imageType")||
10
+ a.getAttribute("imagetype"),a=a.j.trim(),d="PNG"===e&&"Base64"===d&&0<a.length?`data:image/png;base64,${a}`:null,g.backgroundImage=d||"");return g}};var Dt=class{constructor(a,b,c,d){this.frameRate=Number(a)||30;this.f=Number(b)||1;this.a=Number(d);0===this.a&&(this.a=a?this.frameRate*this.f:1);c&&(a=/^(\d+) (\d+)$/g.exec(c))&&(this.frameRate*=Number(a[1])/Number(a[2]))}};var Et=class extends At{constructor(a,b,c){super(a,b,c)}build(a,b){const c=new _.Ip;c.id=this.getId();const d=jt(a.j.containerWidth,kt(a,1),720);a=jt(a.j.containerHeight,kt(a,2),480);a:switch(Qs(this,b,Ls)){case "after":var e="flex-start";break a;case _.zc:e=_.zc;break a;default:e="flex-end"}c.displayAlign=e;a:switch(Qs(this,b,Ps)){case "tb":case "tblr":e="row-reverse";break a;case "tbrl":e="row";break a;default:e=_.Nc}c.writingMode=e;e=this.getAttribute("extent")||Qs(this,b,"extent");c.width=ht(e,
11
+ d,1,100);c.widthUnits=it(e,d);c.height=ht(e,a,2,100);c.heightUnits=it(e,a);b=this.getAttribute("origin")||Qs(this,b,"origin");c.viewportAnchorX=ht(b,d,1,0);c.viewportAnchorY=ht(b,a,2,0);c.viewportAnchorUnits=it(b,d);c.cssClassList=[...this.f];return c}};var Ft=class extends yt{constructor(a,b){super("root-container",[],b);this.j=a}};var Ht=class extends yt{constructor(a,b,c){super(a,b,c)}build(a){var b=null;var c=mt(a);c&&(b=jt(a.j.containerHeight,kt(a,2),480)/c);b=jt(a.j.fontSizeRadix,b,16);a=[];c=`::ttml .${this.g}, ::ttml .${this.g} * {`;for(const [g,h]of Gt.entries())g in this.a&&(c+=`${h}:${$s(this.a[g])};`);a:{if("unicodeBidi"in this.a){var d=this.a.unicodeBidi;var e="";switch(d){case "normal":case "embed":e=d;break;case "bidiOverride":e="bidi-override"}if(0<e.length){d=`unicode-bidi:${e};`;break a}}d=""}c+=d;a:{if("textOutline"in
12
+ this.a){d=this.a.textOutline.split(" ");e="black";let g=".4em";const h=d[0]&&d[0].trim(),k=d[1]&&d[1].trim(),l=d[2]&&d[2].trim();3===d.length&&!Bt.test(h)&&Bt.test(k)&&Bt.test(l)?(e=h,g=k):2===d.length&&!Bt.test(h)&&Bt.test(k)?(e=h,g=k):2===d.length&&Bt.test(h)&&Bt.test(k)&&(g=h);if(""!==g){g=$s(g);d="text-shadow:"+`0 0 ${g} ${e},`+`0 0 ${g} ${e},`+`0 0 ${g} ${e};`;break a}}d=""}c+=d;"textShadow"in this.a?(d=ct(this.a.textShadow),d=$s(d),d=`text-shadow:${d};`):d="";c=c+d+("fontFamily"in this.a?`font-family:${this.a.fontFamily.replace("monospaceSansSerif",
13
+ "monospace").replace("monospaceSerif","monospace").replace("proportionalSansSerif","sans-serif").replace("proportionalSerif","sans-serif").replace("sansSerif","sans-serif").replace("default","sans-serif")};`:"");a:{if(Os in this.a){d=this.a.textDecoration.split(" ");e=[];for(f of d)switch(f){case "underline":case "overline":e.push(f);break;case "lineThrough":e.push("line-through")}if(0<e.length){var f=`text-decoration:${e.join(" ")};`;break a}}f=""}"padding"in this.a?(d="border: solid transparent;border-width:"+
14
+ $s(this.a.padding),d+=";"):d="";f=c=c+f+d;"lineHeight"in this.a?(c="",d=this.a.lineHeight,d=$s(d),d=bt(d,b),c+="line-height:",c+=d,c+=";"):c="";a.push(f+c+"}");a:{if("fontSize"in this.a&&(f=this.a.fontSize.split(" "),c=null,1===f.length&&(c=f[0]),2===f.length&&(c=f[1]),c)){c=c.trim();c=$s(c);c=bt(c,b);b=`font-size:${c};`;break a}b=null}b&&(f=`::ttml .${this.g} .clpp-text-wrapper {`,f+=b,f+="}",a.push(f),f=`::ttml .clpp-text-wrapper__${this.g} {`,f+=b,f+="}",a.push(f));return a}},Gt=new Map([[Js,"background-color"],
15
+ ["color","color"],[Ks,Ks],["fontStyle","font-style"],["fontWeight","font-weight"],["opacity","opacity"],["zIndex","z-index"]]);var It=class{constructor(a){this.B=a;this.w=this.l=null;this.A=0;this.g=new Map;this.a=new Map;this.j=new Map;this.f=new Map;this.o=[]}},nt=0;var Lt=class{constructor(a){this.a=a.firstChild;this.f=new Set}jd(){return!!this.a}next(){if(!this.a)return null;let a=this.a;do this.f.add(a),a.nodeType!==Node.TEXT_NODE&&!Jt.has(Zs(a.nodeName))||Kt.has(Zs(a.nodeName))||!a.firstChild||this.f.has(a.firstChild)?a.nextSibling?a=a.nextSibling:a=a.parentNode:a=a.firstChild;while(a&&(this.f.has(a)||a.nodeType!==Node.TEXT_NODE&&!Jt.has(Zs(a.nodeName))));const b=this.a;this.a=a;return b}},Jt=new Set(["tt","head","layout",_.Gd,_.sd,Ms,"styling",_.Le,"body",
16
+ _.Yc,"p","span","br"]),Kt=new Set([_.Le,_.sd]);var vt=class{constructor(a,b,c,d,e,f){this.g=a;this.a=b;this.j=c;this.l=d;this.f=e;this.attributes=f}getId(){return this.attributes.id}};var Mt=class{constructor(){this.a=new Map}};var Nt=class{constructor(a){this.a=a;this.f=new DOMParser}parseInit(){}parseMedia(a,b,c){c&&c.length||(c=[a.byteLength]);var d=_.Hf(this.a.ttml||{}),e=_.J(a,0,c[0]);e=_.gh(e);if(""===e)return{cues:[],styles:[]};var f=null;try{f=this.f.parseFromString(e,_.Re)}catch(m){throw new _.H(_.G,2,2005,"Failed to parse TTML.");}d=new It(d);e=new Mt;f=new Lt(f);b=b.periodStart;typeof b===_.r&&(d.A=b);b=c[0];for(var g=1;g<c.length;++g){var h=c[g],k=_.J(a,b,h);k=_.uh(k);const m=`urn:mpeg:14496-30:subs:${g}`;d.g.set(m,
17
+ new zt(m,k,{imageType:"PNG",encoding:"Base64"}));b+=h}for(;f.jd();)a=f.next(),a=wt(e,a),c=d,b=a,"tt"===tt(b)&&(c.l=new Ft(c.B,Object.assign({},b.attributes))),c=d,b=a,"tt"===tt(b)&&(c.w=new Dt(b.attributes.frameRate,b.attributes.subFrameRate,b.attributes.frameRateMultiplier,b.attributes.tickRate)),c=d,b=a,tt(b)!==_.sd||b.attributes.begin||b.attributes.end||(g=`#${b.getId()}`,c.g.set(g,new zt(g,b.g.textContent,b.attributes))),c=d,g=a,tt(g)===_.sd&&g.attributes.begin&&g.attributes.end?(b=`#${ot()}`,
18
+ g=new zt(b,g.g.textContent,g.attributes),c.g.set(b,g),c=g):c=null,c&&(a.j=c.getId()),c=d,b=a,tt(b)===_.Le&&(g=b.getId()||ot(),h=new Ht(g,b.f,Object.assign({},b.attributes)),c.a.set(g,h),b.a&&c.j.get(b.a).f.push(g)),c=d,g=a,tt(g)!==_.Le&&qt(g)?(b=ot(),g=new Ht(b,[],Object.assign({},g.attributes)),c.a.set(b,g),c=g):c=null,c&&a.f.push(c.getId()),c=d,g=a,tt(g)!==_.Yc||!g.attributes.extent&&!g.attributes.origin?c=null:(b=ot(),g=new Et(b,rt(c,g.f),Object.assign({},g.attributes)),c.j.set(b,g),c=g),c&&(a.a=
19
+ c.getId()),c=d,g=a,tt(g)!==Ms?c=null:(b=g.getId(),g=new Et(b,rt(c,g.f),Object.assign({},g.attributes)),c.j.set(b,g),c=g),c&&(a.a=c.getId()),c=d,g=a,b=g.l,-1===["#text","span","br"].indexOf(tt(g))||0===b.length?c=null:(h=b[b.length-1],c.f.has(h)?(b=ot(),g=new Ct(b,"#text"===g.g.nodeName?g.g.textContent:null,"br"===tt(g),g.a,g.j,rt(c,g.f),g.attributes),c.f.set(b,g),(c=c.f.get(h))&&c.j.push(b),c=g):c=null),c&&a.l.push(c.getId()),c=d,g=a,"p"===tt(g)||g.j?(b=ot(),g=new Ct(b,null,!1,g.a,g.j,rt(c,g.f),g.attributes),
20
+ c.f.set(b,g),c.o.push(g),c=g):c=null,c&&a.l.push(c.getId());e=st(d);f=[];for(l of d.a.values())f.push(...l.build(d.l));var l=f;return{cues:e,styles:l}}};var Ot=class{constructor(a){this.f=a}a(a){var b=new Nt(this.f);({cues:a}=b.parseMedia(a,{periodStart:0,segmentStart:null,segmentEnd:0}));b="WEBVTT\n\n";for(const d of a){a=b;b=xt(d.startTime)+" --\x3e "+xt(d.endTime);{var c=d;const e=[];switch(c.textAlign){case _.vd:e.push("align:left");break;case _.ze:e.push("align:right");break;case _.yp:e.push("align:middle");break;case _.vd:e.push("align:start");break;case _.ze:e.push("align:end")}switch(c.writingMode){case _.cf:e.push("vertical:lr");break;case _.df:e.push("vertical:rl")}c=
21
+ e.length?" "+e.join(" "):""}b=a+(b+c+"\n");b+=d.payload+"\n\n"}return _.kh(b)}},Pt=class{probe(a,b){return a===_.dc&&b===_.Qe}create(a){return new Ot(a)}};var Qt=class{constructor(a){this.a=new Nt(a);this.h=new _.R("clpp.ttml.Mp4TtmlParser")}parseInit(a){let b=!1;(new _.tk).L(_.Jd,_.mk).L(_.Te,_.mk).L(_.Ed,_.mk).L(_.Id,_.mk).L(_.Ie,_.mk).Z(_.Ke,_.nk).L("stpp",c=>{b=!0;c.parser.stop()}).parse(a);if(!b)throw new _.H(_.G,2,2007);}parseMedia(a,b){let c=!1,d=[],e=[];const f=[];(new _.tk).L("moof",_.mk).L("traf",_.mk).Z("subs",g=>{const h=_.P(g.reader);for(let k=0;k<h;++k){g.reader.skip(4);const l=_.fk(g.reader);for(let m=0;m<l;++m){const n=1===g.version?
22
+ _.P(g.reader):_.fk(g.reader);f.push(n);g.reader.skip(6)}}}).L(_.Dd,_.ok(g=>{c=!0;g=this.a.parseMedia(g,b,f);d=d.concat(g.cues);e=e.concat(g.styles)})).parse(a);c||this.h.warn("Couldn't find the mdat box");return{cues:d,styles:e}}};_.z("clpp.ttml.TtmlComponent",class extends _.Pq{constructor(){super();this.j=new Pt}f(){_.jp[_.dc]=Nt;_.jp[_.bc]=Qt;_.jp[Gs]=Qt;_.jp[Is]=Qt;_.jp[Hs]=Qt;_.si.push(this.j)}a(){_.kp(_.dc);_.kp(_.bc);_.kp(Gs);_.kp(Is);_.kp(Hs);_.ui(this.j)}id(){return"subtitles-ttml"}});};f.call(g, window);
package/cl.verimatrix.js CHANGED
@@ -1,4 +1,4 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var dr="VerimatrixVCAS",er="clpp.verimatrix.Vcas",fr="clpp.verimatrix.VcasComponent",hr=function(a,b){return a.C===gr?(a=Object.assign({},{deviceId:_.Tg(_.Kg(a.A))},a.a&&{authenticator:_.Tg(_.Kg(a.a))}),b+_.Ah(a)):b},nr=class extends _.Xo{constructor(a){super(dr);const b={};b[ir]=ir;b[jr]=jr;const {deviceId:c,authenticator:d,licenseRequestVuidLocation:e=gr,httpHeaderNames:f=b,widevineLicenseUrl:g,playReadyLicenseUrl:h,fairPlayLicenseUrl:k,fairPlayCertificateUrl:l,fairPlaySiteId:m,fairPlayAssetIdStrategy:n=
2
- kr}=a;this.A=c;this.a=d;this.C=e;this.B=f;this.w=hr(this,g);this.o=hr(this,h);this.m=hr(this,k);this.j=l;this.G=m;this.F=n;this.f=new _.O(er);_.Og(this.w)?this.f.warn(_.sb):this.Ja(_.Ic,{licenseUrl:this.w,videoRobustness:[_.db,void 0],audioRobustness:[_.cb,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.h.bind(this)}});_.Og(this.o)?this.f.warn(_.Ua):this.Ja(_.Hc,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],
3
- modifiers:{licenseRequest:this.h.bind(this)}});_.Og(this.m)?this.f.warn(_.Aa):_.Og(this.j)?this.f.warn(_.za):this.Ja(_.Gc,{licenseUrl:this.m,certificateUrl:this.j,modifiers:{licenseRequest:this.J.bind(this),licenseResponse:this.K.bind(this),extractContentId:this.H.bind(this)}})}h(a,b){if(this.C===lr){a=this.B[jr];const c={};c[this.B[ir]]=this.A;this.a&&(c[a]=this.a);Object.keys(c).forEach(d=>{b.headers[d]=c[d]})}}H(a,b){a=_.Kj(b);switch(this.F){case mr:a=_.Ah({r:a,Pg:this.G},!0)}return a}J(a,b){this.h(a,
4
- b);_.Pj(b)}K(a,b){_.Qj(b)}};_.z(er,nr);nr.prototype.constructor=nr.prototype.constructor;nr.NAME=dr;var gr="query-string",lr="http-header";nr.LicenseRequestVuidLocation={QUERY_STRING:gr,HTTP_HEADER:lr};var ir="DeviceId",jr="Authenticator";nr.LicenseRequestHttpHeader={DEVICE_ID_HEADER:ir,AUTHENTICATOR_HEADER:jr};var kr="keyid",mr="contentid-siteid";nr.FairPlayAssetIdStrategy={KEYID:kr,CONTENTID_SITEID:mr};_.z(fr,class extends _.zp{constructor(){super();this.l=null;this.h=new _.O(fr)}f(a){this.l=a}a(){this.l=null}g(){var a=this.l.getConfiguration();if(a.drm&&a.drm.env===dr){({customData:a}=a.drm);if(!a)throw new _.H(_.G,7,7100,_.Jc);a=new nr(a);this.h.info("Registering the Verimatrix VCAS Ultra environment");_.mj(a)}}release(){}id(){return"verimatrix-vcas"}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var vs="VerimatrixVCAS",ws="clpp.verimatrix.Vcas",xs="clpp.verimatrix.VcasComponent",zs=function(a,b){return a.C===ys?(a=Object.assign({},{deviceId:_.vh(_.mh(a.A))},a.a&&{authenticator:_.vh(_.mh(a.a))}),b+_.bi(a)):b},Fs=class extends _.iq{constructor(a){super(vs);const b={};b[As]=As;b[Bs]=Bs;const {deviceId:c,authenticator:d,licenseRequestVuidLocation:e=ys,httpHeaderNames:f=b,widevineLicenseUrl:g,playReadyLicenseUrl:h,fairPlayLicenseUrl:k,fairPlayCertificateUrl:l,fairPlaySiteId:m,fairPlayAssetIdStrategy:n=
2
+ Cs}=a;this.A=c;this.a=d;this.C=e;this.B=f;this.w=zs(this,g);this.o=zs(this,h);this.l=zs(this,k);this.j=l;this.G=m;this.F=n;this.h=new _.R(ws);_.qh(this.w)?this.h.warn(_.Ab):this.La(_.Sc,{licenseUrl:this.w,videoRobustness:[_.jb,void 0],audioRobustness:[_.ib,void 0],persistentStateRequired:!1,distinctiveIdentifierRequired:!1,serverCertificate:null,modifiers:{licenseRequest:this.g.bind(this)}});_.qh(this.o)?this.h.warn(_.Xa):this.La(_.Qc,{licenseUrl:this.o,videoRobustness:["3000"],audioRobustness:["2000"],
3
+ modifiers:{licenseRequest:this.g.bind(this)}});_.qh(this.l)?this.h.warn(_.Aa):_.qh(this.j)?this.h.warn(_.za):this.La(_.Pc,{licenseUrl:this.l,certificateUrl:this.j,modifiers:{licenseRequest:this.J.bind(this),licenseResponse:this.K.bind(this),extractContentId:this.H.bind(this)}})}g(a,b){if(this.C===Ds){a=this.B[Bs];const c={};c[this.B[As]]=this.A;this.a&&(c[a]=this.a);Object.keys(c).forEach(d=>{b.headers[d]=c[d]})}}H(a,b){a=_.sk(b);switch(this.F){case Es:a=_.bi({r:a,kh:this.G},!0)}return a}J(a,b){this.g(a,
4
+ b);_.xk(b)}K(a,b){_.yk(b)}};_.z(ws,Fs);Fs.prototype.constructor=Fs.prototype.constructor;Fs.NAME=vs;var ys="query-string",Ds="http-header";Fs.LicenseRequestVuidLocation={QUERY_STRING:ys,HTTP_HEADER:Ds};var As="DeviceId",Bs="Authenticator";Fs.LicenseRequestHttpHeader={DEVICE_ID_HEADER:As,AUTHENTICATOR_HEADER:Bs};var Cs="keyid",Es="contentid-siteid";Fs.FairPlayAssetIdStrategy={KEYID:Cs,CONTENTID_SITEID:Es};_.z(xs,class extends _.Pq{constructor(){super();this.h=new _.R(xs)}a(){delete _.Uj.VerimatrixVCAS}g(a){a=a.getConfiguration();if(a.drm&&a.drm.env===vs){({customData:a}=a.drm);if(!a)throw new _.H(_.G,7,7100,_.Tc);a=new Fs(a);this.h.info("Registering the Verimatrix VCAS Ultra environment");_.Vj(a)}}id(){return"verimatrix-vcas"}});};f.call(g, window);
package/cl.vimond.js CHANGED
@@ -1,8 +1,8 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Vq="Registering listeners",Wq="clpp.vimond.VimondPlugin",Xq=function(a,b){a.l.trigger(new _.F(_.Me,{detail:b}))},Yq=function(a,b,c){b&&(a.B=!0,a.h.stop());a.l.onError(new _.H(b?_.G:1,9,9201,c))},Zq=function(a,b){const c=a.l.getState();if(1===b)return["str-start",_.Sd];if(a.h)return[_.Wc,_.Ld];if(c===_.wl)return[_.Wc,null];if(c===_.Dl)return[_.Yc,_.Ld];b=_.Ld;if(c===_.zl||c===_.Hl||a.f)b=_.Sd;return["period",b]},$q=class{constructor(a,b,c,d,e){this.K=a;this.M=b;this.N=c;this.l=d;this.F=
2
- e;this.f=new _.jo;this.m=!0;this.g=this.j=this.B=!1;this.C=null;this.h=new _.Yh(this.A.bind(this));this.a=new _.O("clpp.vimond.VimondDispatcher");this.o=this.w=0;this.l&&this.f&&(this.a.debug(Vq),this.f.on(this.l,_.je,this.I.bind(this)),this.f.on(this.l,_.ue,this.J.bind(this)),this.f.on(this.l,_.ub,this.G.bind(this)),this.f.on(this.l,_.vb,this.H.bind(this)))}J(){this.g||(this.g=1<Math.abs(this.w-this.l.getPosition()));this.w=this.l.getPosition()}G(){this.a.debug("Ad break started");this.j=!0}H(){this.a.debug("Ad break stopped");
3
- this.j=!1}I(a){const b=this;return _.y(function*(){const c=a.detail,d=c.currentState;b.a.debug(`State changed, prev: ${c.previousState} curr: ${d}`);b.B||b.j||(d!==b.C||b.g?b.m&&d!==_.Hl||(b.g&&[_.Gl,_.zl].includes(d)?b.a.debug("Seeking"):(b.g&&d===_.Hl&&(b.a.debug("Seeked"),b.g=!1),[_.Hl,_.Gl,_.Dl,_.wl].includes(d)&&(b.C=d,yield b.A(),d===_.wl&&b.h.stop()))):b.a.debug("Ignore transition"))})}A(){const a=this;return _.y(function*(){{const n=Math.floor(Date.now()/1E3);0<a.o&&a.a.debug(`Last event was ${n-
4
- a.o} seconds ago`);a.o=n}a.h.stop();a.h.da(a.m?10:a.K);a.m=!1;try{{var b=a.F;b.f++;const q=_.jf(b.o);q.client.buildName=_.ma;q.client.buildVersion=_.da;var c=q.client;{const A=b.a.l.getDrmInfo();var d=A?A.keySystem:""}c.drm=d;q.client.pageUrl=document.location.href;q.client.streamUrl=b.a.l.getLoadedSource().url;q.client.userAgent=navigator.userAgent;q.client.videoFormat=b.a.l.getLoadedSource().type||"";var e=q.client;{const A=b.a.l.getLoadedSource();var f=((new _.Jj(A.url)).scheme||"").replace(":",
5
- "")}e.videoProtocol=f;const t=Zq(b.a,b.f);q.client.playerEvent=t[0]||"";q.client.playerState=t[1]||"";q.progress.vod&&(q.progress.vod.position=b.a.getPosition());const u=q.progress.live;if(u){{var g=b.a;const A=g.l.getPresentationStartTime()||0,E=Math.floor(A+g.l.getPosition());var h=(new Date(1E3*E)).toISOString()}u.position=h;{var k=b.a;const A=k.l.getPosition(),E=k.l.getSeekRange().end;var l=30>Math.abs(E-A)}u.onLiveEdge=l;typeof u.liveResumePossible!==_.fc&&(u.liveResumePossible=!0)}q.progress.eventNumber=
6
- b.f;q.timestamp=(new Date).toISOString();b.h.debug("Fire an event");const x=_.jh(b.m);x.method="POST";x.contentType="application/json";x.headers.Authorization=`Bearer ${b.g}`;x.body=_.Kg(JSON.stringify(q));var m=b.j.fetch(x).P}const n=yield m;Xq(a,n)}catch(n){m=n.code,b=n.data,[1002,1003].includes(m)?(a.a.debug("Unreachable service"),Xq(a,b),Yq(a,a.M,b)):1001===m?(a.a.debug("Generic service error"),Xq(a,b),Yq(a,a.N,b)):a.a.error(n.toString())}})}dispose(){this.a.debug(_.nb);_.Mf(this.f);this.h.stop()}};var ar=class{constructor(a,b,c,d,e){this.m=a;this.o=c;this.g=b;this.a=d;this.j=e;this.h=new _.O("clpp.vimond.VimondService");this.f=0}je(a){this.g=a}};var br=class{constructor(a){this.l=a;this.a=new _.jo;this.g=new _.O("clpp.vimond.VimondAdapter");this.f=this.h=!1;this.l&&this.a&&(this.g.debug(Vq),this.a.on(this.l,_.Zd,this.o.bind(this)),this.a.on(this.l,_.ub,this.j.bind(this)),this.a.on(this.l,_.vb,this.m.bind(this)))}getPosition(){return Math.floor(this.l.getPosition())}o(){this.h=!0}j(){this.f=!0}m(){this.f=!1}dispose(){this.g.debug(_.nb);_.Mf(this.a)}};var cr=class extends _.$p{constructor(){super();this.a=!1;this.h=new _.O(Wq);this.j=this.g=this.f=null}onPlayerCreated(){}onContentWillLoad(a){var b=a.getConfiguration();(this.a=!_.C(b.vimond)&&typeof b.vimond===_.Bd)?a.namespace()===_.yc&&(this.a=!1,this.h.info("Vimond does not report when casting.")):this.h.warn("Vimond plugin is loaded but not configured. Will do nothing.");if(this.a){b=a.getConfiguration().vimond;for(var c of["authToken","playerEventRequest"])if(!b[c]){this.h.warn(`${c} key is missing`);
7
- a.onError(new _.H(1,9,9200));return}this.h.debug("Configuration is valid");c=b.failIfUnreachable;typeof c!==_.fc&&(c=!0);var d=b.failOnError;typeof d!==_.fc&&(d=!0);this.f=new br(a);this.g=new ar(b.playerEventRequest.uri,b.authToken,b.playerEventRequest.body,this.f,a.getNetworkEngine());this.j=new $q(b.playerEventRequest.eventInterval,c,d,a,this.g)}}onPlayerWillRelease(){this.a&&(this.f&&this.f.dispose(),this.j&&this.j.dispose(),this.j=this.g=this.f=null)}onPlayerWillDestroy(){}id(){return"vimond"}je(a){this.a&&
8
- this.g&&this.g.je(a)}};_.z(Wq,cr);cr.prototype.updateAuthToken=cr.prototype.je;cr.Id="vimond";_.Hm(new class{create(){return new cr}});};f.call(g, window);
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var ms="Registering listeners",ns="clpp.vimond.VimondPlugin",os=function(a,b){a.m.trigger(new _.F(_.jf,{detail:b}))},ps=function(a,b,c){b&&(a.B=!0,a.g.stop());a.m.onError(new _.H(b?_.G:1,9,9201,c))},qs=function(a,b){const c=a.m.getState();if(1===b)return["str-start",_.le];if(a.g)return[_.jd,_.ae];if(c===_.sm)return[_.jd,null];if(c===_.zm)return[_.ld,_.ae];b=_.ae;if(c===_.vm||c===_.Dm||a.f)b=_.le;return["period",b]},rs=class{constructor(a,b,c,d,e){this.K=a;this.M=b;this.N=c;this.m=d;this.F=
2
+ e;this.a=new _.vp;this.l=!0;this.f=this.j=this.B=!1;this.C=null;this.g=new _.zi(this.A.bind(this));this.h=new _.R("clpp.vimond.VimondDispatcher");this.o=this.w=0;this.m&&this.a&&(this.h.debug(ms),this.a.on(this.m,_.Ge,this.I.bind(this)),this.a.on(this.m,_.Se,this.J.bind(this)),this.a.on(this.m,_.Cb,this.G.bind(this)),this.a.on(this.m,_.Db,this.H.bind(this)))}J(){this.f||(this.f=1<Math.abs(this.w-this.m.getPosition()));this.w=this.m.getPosition()}G(){this.h.debug("Ad break started");this.j=!0}H(){this.h.debug("Ad break stopped");
3
+ this.j=!1}I(a){const b=this;return _.x(function*(){const c=a.detail,d=c.currentState;b.h.debug(`State changed, prev: ${c.previousState} curr: ${d}`);b.B||b.j||(d!==b.C||b.f?b.l&&d!==_.Dm||(b.f&&[_.Cm,_.vm].includes(d)?b.h.debug("Seeking"):(b.f&&d===_.Dm&&(b.h.debug("Seeked"),b.f=!1),[_.Dm,_.Cm,_.zm,_.sm].includes(d)&&(b.C=d,yield b.A(),d===_.sm&&b.g.stop()))):b.h.debug("Ignore transition"))})}A(){const a=this;return _.x(function*(){{const n=Math.floor(Date.now()/1E3);0<a.o&&a.h.debug(`Last event was ${n-
4
+ a.o} seconds ago`);a.o=n}a.g.stop();a.g.ca(a.l?10:a.K);a.l=!1;try{{var b=a.F;b.f++;const q=_.Gf(b.o);q.client.buildName=_.na;q.client.buildVersion=_.da;var c=q.client;{const A=b.a.m.getDrmInfo();var d=A?A.keySystem:""}c.drm=d;q.client.pageUrl=document.location.href;q.client.streamUrl=b.a.m.getLoadedSource().url;q.client.userAgent=navigator.userAgent;q.client.videoFormat=b.a.m.getLoadedSource().type||"";var e=q.client;{const A=b.a.m.getLoadedSource();var f=((new _.rk(A.url)).scheme||"").replace(":",
5
+ "")}e.videoProtocol=f;const u=qs(b.a,b.f);q.client.playerEvent=u[0]||"";q.client.playerState=u[1]||"";q.progress.vod&&(q.progress.vod.position=b.a.getPosition());const v=q.progress.live;if(v){{var g=b.a;const A=g.m.getPresentationStartTime()||0,D=Math.floor(A+g.m.getPosition());var h=(new Date(1E3*D)).toISOString()}v.position=h;{var k=b.a;const A=k.m.getPosition(),D=k.m.getSeekRange().end;var l=30>Math.abs(D-A)}v.onLiveEdge=l;typeof v.liveResumePossible!==_.nc&&(v.liveResumePossible=!0)}q.progress.eventNumber=
6
+ b.f;q.timestamp=(new Date).toISOString();b.h.debug("Fire an event");const y=_.Kh(b.l);y.method="POST";y.contentType="application/json";y.headers.Authorization=`Bearer ${b.g}`;y.body=_.mh(JSON.stringify(q));var m=b.j.fetch(y).P}const n=yield m;os(a,n)}catch(n){m=n.code,b=n.data,[1002,1003].includes(m)?(a.h.debug("Unreachable service"),os(a,b),ps(a,a.M,b)):1001===m?(a.h.debug("Generic service error"),os(a,b),ps(a,a.N,b)):a.h.error(n.toString())}})}dispose(){this.h.debug(_.vb);_.jg(this.a);this.g.stop()}};var ss=class{constructor(a,b,c,d,e){this.l=a;this.o=c;this.g=b;this.a=d;this.j=e;this.h=new _.R("clpp.vimond.VimondService");this.f=0}re(a){this.g=a}};var ts=class{constructor(a){this.m=a;this.a=new _.vp;this.h=new _.R("clpp.vimond.VimondAdapter");this.f=this.g=!1;this.m&&this.a&&(this.h.debug(ms),this.a.on(this.m,_.ve,this.o.bind(this)),this.a.on(this.m,_.Cb,this.j.bind(this)),this.a.on(this.m,_.Db,this.l.bind(this)))}getPosition(){return Math.floor(this.m.getPosition())}o(){this.g=!0}j(){this.f=!0}l(){this.f=!1}dispose(){this.h.debug(_.vb);_.jg(this.a)}};var us=class extends _.rr{constructor(){super();this.a=!1;this.h=new _.R(ns);this.j=this.g=this.f=null}onPlayerCreated(){}onContentWillLoad(a){var b=a.getConfiguration();(this.a=!_.B(b.vimond)&&typeof b.vimond===_.Od)?a.namespace()===_.Gc&&(this.a=!1,this.h.info("Vimond does not report when casting.")):this.h.warn("Vimond plugin is loaded but not configured. Will do nothing.");if(this.a){b=a.getConfiguration().vimond;for(var c of["authToken","playerEventRequest"])if(!b[c]){this.h.warn(`${c} key is missing`);
7
+ a.onError(new _.H(1,9,9200));return}this.h.debug("Configuration is valid");c=b.failIfUnreachable;typeof c!==_.nc&&(c=!0);var d=b.failOnError;typeof d!==_.nc&&(d=!0);this.f=new ts(a);this.g=new ss(b.playerEventRequest.uri,b.authToken,b.playerEventRequest.body,this.f,a.getNetworkEngine());this.j=new rs(b.playerEventRequest.eventInterval,c,d,a,this.g)}}onPlayerWillRelease(){this.a&&(this.f&&this.f.dispose(),this.j&&this.j.dispose(),this.j=this.g=this.f=null)}onPlayerWillDestroy(){}id(){return"vimond"}re(a){this.a&&
8
+ this.g&&this.g.re(a)}};_.z(ns,us);us.prototype.updateAuthToken=us.prototype.re;us.Id="vimond";_.En(new class{create(){return new us}});};f.call(g, window);
package/cl.vr.js CHANGED
@@ -1,15 +1,15 @@
1
- import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Bq="touchmove",Cq="touchstart",Eq=function(a,b,c){c*=.5;const d=Math.sqrt(a*a+b*b),e=Math.sin(c);return new Dq(a/d*e,b/d*e,0/d*e,Math.cos(c))},Fq=function(a,b){const c=a.x,d=a.y,e=a.a;a=a.f;b.set(1-2*(d*d+e*e),2*(c*d-e*a),2*(c*e+d*a),0,2*(c*d+e*a),1-2*(c*c+e*e),2*(d*e-c*a),0,2*(c*e-d*a),2*(d*e+c*a),1-2*(c*c+d*d),0,0,0,0,1)},Gq=function(a,b){isFinite(b)?(a.x*=b,a.y*=b,a.a*=b):(a.x=0,a.y=0,a.a=0)},Hq=function(a,b){return a.x*b.x+a.y*b.y+a.a*b.a},Iq=function(a,b,c){const d=b.x,e=b.y;
2
- b=b.a;const f=c.x,g=c.y;c=c.a;a.x=e*c-b*g;a.y=b*f-d*c;a.a=d*g-e*f;return a},Jq=function(a,b,c){b=b.a;c=c.a;const d=a.a;let e=0;do d[4*e]=b[4*e]*c[0]+b[4*e+1]*c[4]+b[4*e+2]*c[8]+b[4*e+3]*c[12],d[4*e+1]=b[4*e]*c[1]+b[4*e+1]*c[5]+b[4*e+2]*c[9]+b[4*e+3]*c[13],d[4*e+2]=b[4*e]*c[2]+b[4*e+1]*c[6]+b[4*e+2]*c[10]+b[4*e+3]*c[14],d[4*e+3]=b[4*e]*c[3]+b[4*e+1]*c[7]+b[4*e+2]*c[11]+b[4*e+3]*c[15];while(4>++e);return a},Lq=function(a){var b=new Kq(0,0,0),c=new Kq(0,0,1);const d=new Kq,e=new Kq,f=new Kq;a=a.a;var g=
3
- new Kq(0,1,0);f.x=b.x-g.x;f.y=b.y-g.y;f.a=b.a-g.a;g=f.length();Gq(f,1/g);c=Iq(d,c,f);g=c.length();Gq(c,1/g);Iq(e,f,d);a[0]=d.x;a[1]=d.y;a[2]=d.a;a[3]=-Hq(d,b);a[4]=e.x;a[5]=e.y;a[6]=e.a;a[7]=-Hq(e,b);a[8]=f.x;a[9]=f.y;a[10]=f.a;a[11]=-Hq(f,b);a[12]=0;a[13]=0;a[14]=0;a[15]=1},Mq=function(a,b,c){b=a.a.createShader(b?a.a.FRAGMENT_SHADER:a.a.VERTEX_SHADER);a.a.shaderSource(b,c);a.a.compileShader(b);if(!a.a.getShaderParameter(b,a.a.COMPILE_STATUS))throw new _.H(1,9,9004,"Unable to compile GL shader: "+
4
- a.a.getShaderInfoLog(b));return b},Nq=function(a){a.a&&(a.a.removeEventListener("mousemove",a.A,!1),a.a.removeEventListener(Bq,a.A,!1),a.a.removeEventListener("mouseup",a.B,!1),a.a.removeEventListener("touchend",a.B,!1))},Oq=function(a){const b=Eq(1,0,a.m*Math.PI/180);Fq(Eq(0,1,a.j*Math.PI/180),a.R);Fq(b,a.T);Lq(a.aa);Jq(a.ba,a.R,a.aa);Jq(a.G,a.T,a.ba)},Dq=class{constructor(a,b,c,d){this.x=a||0;this.y=b||0;this.a=c||0;this.f=d||1}};var Kq=class{constructor(a,b,c){this.x=a||0;this.y=b||0;this.a=c||0}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.a*this.a)}};var Pq=class{constructor(){this.a=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}set(a,b,c,d,e,f,g,h,k,l,m,n,q,t,u,x){const A=this.a;A[0]=a;A[4]=b;A[8]=c;A[12]=d;A[1]=e;A[5]=f;A[9]=g;A[13]=h;A[2]=k;A[6]=l;A[10]=m;A[14]=n;A[3]=q;A[7]=t;A[11]=u;A[15]=x;return this}};var Qq=class{constructor(a){this.a=a;this.f=a.createProgram();this.j=Mq(this,!1,"uniform highp mat4 Mvpm;\nattribute highp vec4 aPosition;\nattribute highp vec2 aTexCoord;\nvarying highp vec2 oTexCoord;\nvoid main()\n{\n gl_Position \x3d Mvpm * aPosition;\n oTexCoord \x3d aTexCoord;\n}\n");this.h=Mq(this,!0,"precision highp float;\nuniform sampler2D Texture0;\nvarying highp vec2 oTexCoord;\nvoid main()\n{\n gl_FragColor \x3d texture2D(Texture0, oTexCoord);\n gl_FragColor.w \x3d 1.0;\n}\n");
5
- a.attachShader(this.f,this.j);a.attachShader(this.f,this.h);a.bindAttribLocation(this.f,0,"aPosition");a.bindAttribLocation(this.f,1,"aTexCoord");a.linkProgram(this.f);if(!a.getProgramParameter(this.f,a.LINK_STATUS))throw new _.H(1,9,9004,"Unable to initialize shader");a.useProgram(this.f);this.g=a.getUniformLocation(this.f,"Mvpm");a.uniform1i(a.getUniformLocation(this.f,"Texture0"),0);a.useProgram(null)}};var Rq=class{constructor(a){this.a=a;var b=[];let c,d;for(d=0;70>=d;d++){var e=3>=d?d/4/64:67<=d?(63+(d-66)/4)/64:(d-3)/64;var f=(e-.5)*Math.PI;const g=Math.cos(f);for(c=0;128>=c;c++){const h=c/128,k=(.5+h)*Math.PI*2;128===c?(b.push(b[645*d]),b.push(b[645*d+1]),b.push(b[645*d+2])):(b.push(100*Math.cos(k)*g),b.push(100*Math.sin(k)*g),b.push(100*Math.sin(f)));0===d||70===d?b.push(.5):b.push(1-h);b.push(1-e)}}e=[];for(c=0;128>c;c++)for(d=0;70>d;d++)f=5*(129*d+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+
6
- 4]),f=5*(129*d+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*d+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]);this.g=e.length/5;this.f=a.createBuffer();b=new Float32Array(e);a.bindBuffer(a.ARRAY_BUFFER,this.f);a.bufferData(a.ARRAY_BUFFER,b,a.STATIC_DRAW)}};var Sq=class{constructor(a,b){this.a=b;this.f=this.a.createTexture();b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,this.f);b.texImage2D(b.TEXTURE_2D,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,a);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.bindTexture(b.TEXTURE_2D,null)}};var Tq={alpha:!1,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!1,devicePixelRatio:1},Uq=class extends _.$p{constructor(){super();this.o=this.w=this.K=this.I=this.C=this.Y=this.G=this.f=this.a=this.l=null;this.h=new _.O("clpp.vr");this.H=70;this.W=1;this.N=this.M=!1;this.F=()=>{if(this.a&&this.f){this.f.viewport(0,0,this.a.width,this.a.height);{const a=this.K.a,b=Math.tan(.5*this.H*Math.PI/180);a[0]=1/(this.a.width/this.a.height*b);a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1/
7
- b;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=2E3/-1999.9;a[11]=200/-1999.9;a[12]=0;a[13]=0;a[14]=-1;a[15]=1}}};this.m=this.j=0;this.g={x:0,y:0};this.R=new Pq;this.T=new Pq;this.aa=new Pq;this.ba=new Pq;this.A=this.ma.bind(this);this.B=this.La.bind(this);this.J=this.ga.bind(this)}onPlayerCreated(a){this.h.info("Player created");this.l=a}onContentWillLoad(a){const b=a.getConfiguration();if(b.vr&&b.vr.enable){{var c=b.vr,d=c.fieldOfView;const e=c.sensitivity,f=c.invertHorizontalControl;c=c.invertVerticalControl;
8
- if(void 0!==d&&_.qf(d))this.H=d;else throw new _.H(1,7,7100,"fieldOfView configuration must be a number");if(void 0!==e&&_.qf(e)&&0<e)this.W=e;else throw new _.H(1,7,7100,"sensitivity configuration must be a positive number");this.M=!!f;this.N=!!c}if(a=a.getSurface())if((d=a.getMedia())&&d.tagName.toLowerCase()===_.w){this.h.info("Initialize VR Surface");if(!this.a){this.a=document.createElement("canvas");this.a.style.width="100%";this.f=this.a.getContext("webgl",Tq)||this.a.getContext("experimental-webgl",
9
- Tq);if(!this.f)throw new _.H(1,9,9003,"Unable to create GL context");this.G=new Pq;Lq(this.G);this.Y=new Rq(this.f);this.C=new Qq(this.f);this.I=new Pq;this.K=new Pq;this.o=this.w=null;this.a.addEventListener(_.be,this.F)}a.addElementToContainer(this.a,!0,!0);a.hideMediaElement();b.vr.attachMouseListener&&(this.a.addEventListener("mousedown",this.J,!1),this.a.addEventListener(Cq,this.J,!1));this.F();this.V()}else this.h.info("No video element found, can not initialize VR plugin");else this.h.info("No surface found, can not initialize VR plugin")}}onPlayerWillRelease(){this.h.info("Releasing VR plugin resources");
10
- this.w&&cancelAnimationFrame(this.w);this.g.x=0;this.m=this.j=this.g.y=0;this.f&&(delete this.f,this.f=null);this.a&&(Nq(this),this.a.removeEventListener(_.be,this.F),this.a.parentElement.removeChild(this.a),this.a.removeEventListener("mousedown",this.J,!1),delete this.a,this.a=null)}onPlayerWillDestroy(){const a=this;return _.y(function*(){a.l=null})}id(){return"vr"}V(){if(this.l&&this.f){var a=this.l.getSurface();if(a&&(a=a.getMedia())&&a.tagName.toLowerCase()===_.w){this.w=requestAnimationFrame(this.V.bind(this));
11
- var b=this.f;this.o||a.readyState!==a.HAVE_ENOUGH_DATA||(this.o=new Sq(a,b));b.clearColor(0,0,0,1);b.clearDepth(1);b.clearStencil(0);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);b.depthMask(!0);b.clearColor(0,0,0,1);b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);if(this.o){var c=this.C;c.a.useProgram(c.f);{c=Jq(this.I,this.K,this.G).a;let d;d=c[1];c[1]=c[4];c[4]=d;d=c[2];c[2]=
1
+ import {clpp} from "./cl.core.js";let g={};const _ = clpp._;var f=function(window){'use strict';var Tr="touchmove",Ur="touchstart",Wr=function(a,b,c){c*=.5;const d=Math.sqrt(a*a+b*b),e=Math.sin(c);return new Vr(a/d*e,b/d*e,0/d*e,Math.cos(c))},Xr=function(a,b){const c=a.x,d=a.y,e=a.a;a=a.f;b.set(1-2*(d*d+e*e),2*(c*d-e*a),2*(c*e+d*a),0,2*(c*d+e*a),1-2*(c*c+e*e),2*(d*e-c*a),0,2*(c*e-d*a),2*(d*e+c*a),1-2*(c*c+d*d),0,0,0,0,1)},Yr=function(a,b){isFinite(b)?(a.x*=b,a.y*=b,a.a*=b):(a.x=0,a.y=0,a.a=0)},Zr=function(a,b){return a.x*b.x+a.y*b.y+a.a*b.a},$r=function(a,b,c){const d=b.x,e=b.y;
2
+ b=b.a;const f=c.x,g=c.y;c=c.a;a.x=e*c-b*g;a.y=b*f-d*c;a.a=d*g-e*f;return a},as=function(a,b,c){b=b.a;c=c.a;const d=a.a;let e=0;do d[4*e]=b[4*e]*c[0]+b[4*e+1]*c[4]+b[4*e+2]*c[8]+b[4*e+3]*c[12],d[4*e+1]=b[4*e]*c[1]+b[4*e+1]*c[5]+b[4*e+2]*c[9]+b[4*e+3]*c[13],d[4*e+2]=b[4*e]*c[2]+b[4*e+1]*c[6]+b[4*e+2]*c[10]+b[4*e+3]*c[14],d[4*e+3]=b[4*e]*c[3]+b[4*e+1]*c[7]+b[4*e+2]*c[11]+b[4*e+3]*c[15];while(4>++e);return a},cs=function(a){var b=new bs(0,0,0),c=new bs(0,0,1);const d=new bs,e=new bs,f=new bs;a=a.a;var g=
3
+ new bs(0,1,0);f.x=b.x-g.x;f.y=b.y-g.y;f.a=b.a-g.a;g=f.length();Yr(f,1/g);c=$r(d,c,f);g=c.length();Yr(c,1/g);$r(e,f,d);a[0]=d.x;a[1]=d.y;a[2]=d.a;a[3]=-Zr(d,b);a[4]=e.x;a[5]=e.y;a[6]=e.a;a[7]=-Zr(e,b);a[8]=f.x;a[9]=f.y;a[10]=f.a;a[11]=-Zr(f,b);a[12]=0;a[13]=0;a[14]=0;a[15]=1},ds=function(a,b,c){b=a.a.createShader(b?a.a.FRAGMENT_SHADER:a.a.VERTEX_SHADER);a.a.shaderSource(b,c);a.a.compileShader(b);if(!a.a.getShaderParameter(b,a.a.COMPILE_STATUS))throw new _.H(1,9,9004,"Unable to compile GL shader: "+
4
+ a.a.getShaderInfoLog(b));return b},es=function(a){a.a&&(a.a.removeEventListener("mousemove",a.A,!1),a.a.removeEventListener(Tr,a.A,!1),a.a.removeEventListener("mouseup",a.B,!1),a.a.removeEventListener("touchend",a.B,!1))},fs=function(a){const b=Wr(1,0,a.l*Math.PI/180);Xr(Wr(0,1,a.j*Math.PI/180),a.R);Xr(b,a.S);cs(a.aa);as(a.ba,a.R,a.aa);as(a.G,a.S,a.ba)},Vr=class{constructor(a,b,c,d){this.x=a||0;this.y=b||0;this.a=c||0;this.f=d||1}};var bs=class{constructor(a,b,c){this.x=a||0;this.y=b||0;this.a=c||0}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.a*this.a)}};var gs=class{constructor(){this.a=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}set(a,b,c,d,e,f,g,h,k,l,m,n,q,u,v,y){const A=this.a;A[0]=a;A[4]=b;A[8]=c;A[12]=d;A[1]=e;A[5]=f;A[9]=g;A[13]=h;A[2]=k;A[6]=l;A[10]=m;A[14]=n;A[3]=q;A[7]=u;A[11]=v;A[15]=y;return this}};var hs=class{constructor(a){this.a=a;this.f=a.createProgram();this.l=ds(this,!1,"uniform highp mat4 Mvpm;\nattribute highp vec4 aPosition;\nattribute highp vec2 aTexCoord;\nvarying highp vec2 oTexCoord;\nvoid main()\n{\n gl_Position \x3d Mvpm * aPosition;\n oTexCoord \x3d aTexCoord;\n}\n");this.j=ds(this,!0,"precision highp float;\nuniform sampler2D Texture0;\nvarying highp vec2 oTexCoord;\nvoid main()\n{\n gl_FragColor \x3d texture2D(Texture0, oTexCoord);\n gl_FragColor.w \x3d 1.0;\n}\n");
5
+ a.attachShader(this.f,this.l);a.attachShader(this.f,this.j);a.bindAttribLocation(this.f,0,"aPosition");a.bindAttribLocation(this.f,1,"aTexCoord");a.linkProgram(this.f);if(!a.getProgramParameter(this.f,a.LINK_STATUS))throw new _.H(1,9,9004,"Unable to initialize shader");a.useProgram(this.f);this.g=a.getUniformLocation(this.f,"Mvpm");a.uniform1i(a.getUniformLocation(this.f,"Texture0"),0);a.useProgram(null)}};var is=class{constructor(a){this.a=a;var b=[];let c,d;for(d=0;70>=d;d++){var e=3>=d?d/4/64:67<=d?(63+(d-66)/4)/64:(d-3)/64;var f=(e-.5)*Math.PI;const g=Math.cos(f);for(c=0;128>=c;c++){const h=c/128,k=(.5+h)*Math.PI*2;128===c?(b.push(b[645*d]),b.push(b[645*d+1]),b.push(b[645*d+2])):(b.push(100*Math.cos(k)*g),b.push(100*Math.sin(k)*g),b.push(100*Math.sin(f)));0===d||70===d?b.push(.5):b.push(1-h);b.push(1-e)}}e=[];for(c=0;128>c;c++)for(d=0;70>d;d++)f=5*(129*d+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+
6
+ 4]),f=5*(129*d+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*d+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]),f=5*(129*(d+1)+c+1),e.push(b[f],b[f+1],b[f+2],b[f+3],b[f+4]);this.g=e.length/5;this.f=a.createBuffer();b=new Float32Array(e);a.bindBuffer(a.ARRAY_BUFFER,this.f);a.bufferData(a.ARRAY_BUFFER,b,a.STATIC_DRAW)}};var js=class{constructor(a,b){this.a=b;this.f=this.a.createTexture();b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,this.f);b.texImage2D(b.TEXTURE_2D,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,a);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.bindTexture(b.TEXTURE_2D,null)}};var ks={alpha:!1,depth:!0,stencil:!1,antialias:!0,premultipliedAlpha:!1,preserveDrawingBuffer:!1,devicePixelRatio:1},ls=class extends _.rr{constructor(){super();this.o=this.w=this.K=this.I=this.C=this.Y=this.G=this.f=this.a=this.m=null;this.h=new _.R("clpp.vr");this.H=70;this.W=1;this.N=this.M=!1;this.F=()=>{if(this.a&&this.f){this.f.viewport(0,0,this.a.width,this.a.height);{const a=this.K.a,b=Math.tan(.5*this.H*Math.PI/180);a[0]=1/(this.a.width/this.a.height*b);a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1/
7
+ b;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=2E3/-1999.9;a[11]=200/-1999.9;a[12]=0;a[13]=0;a[14]=-1;a[15]=1}}};this.l=this.j=0;this.g={x:0,y:0};this.R=new gs;this.S=new gs;this.aa=new gs;this.ba=new gs;this.A=this.na.bind(this);this.B=this.Na.bind(this);this.J=this.fa.bind(this)}onPlayerCreated(a){this.h.info("Player created");this.m=a}onContentWillLoad(a){const b=a.getConfiguration();if(b.vr&&b.vr.enable){{var c=b.vr,d=c.fieldOfView;const e=c.sensitivity,f=c.invertHorizontalControl;c=c.invertVerticalControl;
8
+ if(void 0!==d&&_.Sf(d))this.H=d;else throw new _.H(1,7,7100,"fieldOfView configuration must be a number");if(void 0!==e&&_.Sf(e)&&0<e)this.W=e;else throw new _.H(1,7,7100,"sensitivity configuration must be a positive number");this.M=!!f;this.N=!!c}if(a=a.getSurface())if((d=a.getMedia())&&d.tagName.toLowerCase()===_.w){this.h.info("Initialize VR Surface");if(!this.a){this.a=document.createElement("canvas");this.a.style.width="100%";this.f=this.a.getContext("webgl",ks)||this.a.getContext("experimental-webgl",
9
+ ks);if(!this.f)throw new _.H(1,9,9003,"Unable to create GL context");this.G=new gs;cs(this.G);this.Y=new is(this.f);this.C=new hs(this.f);this.I=new gs;this.K=new gs;this.o=this.w=null;this.a.addEventListener(_.ye,this.F)}a.addElementToContainer(this.a,!0,!0);a.hideMediaElement();b.vr.attachMouseListener&&(this.a.addEventListener("mousedown",this.J,!1),this.a.addEventListener(Ur,this.J,!1));this.F();this.V()}else this.h.info("No video element found, can not initialize VR plugin");else this.h.info("No surface found, can not initialize VR plugin")}}onPlayerWillRelease(){this.h.info("Releasing VR plugin resources");
10
+ this.w&&cancelAnimationFrame(this.w);this.g.x=0;this.l=this.j=this.g.y=0;this.f&&(delete this.f,this.f=null);this.a&&(es(this),this.a.removeEventListener(_.ye,this.F),this.a.parentElement.removeChild(this.a),this.a.removeEventListener("mousedown",this.J,!1),delete this.a,this.a=null)}onPlayerWillDestroy(){const a=this;return _.x(function*(){a.m=null})}id(){return"vr"}V(){if(this.m&&this.f){var a=this.m.getSurface();if(a&&(a=a.getMedia())&&a.tagName.toLowerCase()===_.w){this.w=requestAnimationFrame(this.V.bind(this));
11
+ var b=this.f;this.o||a.readyState!==a.HAVE_ENOUGH_DATA||(this.o=new js(a,b));b.clearColor(0,0,0,1);b.clearDepth(1);b.clearStencil(0);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);b.depthMask(!0);b.clearColor(0,0,0,1);b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);if(this.o){var c=this.C;c.a.useProgram(c.f);{c=as(this.I,this.K,this.G).a;let d;d=c[1];c[1]=c[4];c[4]=d;d=c[2];c[2]=
12
12
  c[8];c[8]=d;d=c[6];c[6]=c[9];c[9]=d;d=c[3];c[3]=c[12];c[12]=d;d=c[7];c[7]=c[13];c[13]=d;d=c[11];c[11]=c[14];c[14]=d}b.uniformMatrix4fv(this.C.g,!1,this.I.a);c=this.o;c.a.activeTexture(c.a.TEXTURE0);c.a.bindTexture(c.a.TEXTURE_2D,c.f);b.texImage2D(b.TEXTURE_2D,0,b.RGB,b.RGB,b.UNSIGNED_BYTE,a);a=this.Y;a.a.bindBuffer(a.a.ARRAY_BUFFER,a.f);a.a.vertexAttribPointer(0,3,a.a.FLOAT,!1,20,0);a.a.vertexAttribPointer(1,2,a.a.FLOAT,!1,20,12);a.a.enableVertexAttribArray(0);a.a.enableVertexAttribArray(1);a.a.drawArrays(a.a.TRIANGLES,
13
- 0,a.g);a=this.o;a.a.bindTexture(a.a.TEXTURE_2D,null);this.C.a.useProgram(null)}}}}ga(a){this.h.debug("Mouse Down. Enable VR mouse interaction");a.preventDefault();if(0===a.button||a.type===Cq)a.type===Cq?a.touches[0]&&(this.g.x=a.touches[0].clientX,this.g.y=a.touches[0].clientY):(this.g.x=a.clientX,this.g.y=a.clientY),this.h.debug("Mouse Start coordinates:",this.g,a),this.a.addEventListener("mousemove",this.A,!1),this.a.addEventListener(Bq,this.A,!1),this.a.addEventListener("mouseup",this.B,!1),this.a.addEventListener("touchend",
14
- this.B,!1)}ma(a){a.preventDefault();var b=a.clientX;let c=a.clientY;a.type===Bq&&a.touches[0]&&(b=a.touches[0].clientX,c=a.touches[0].clientY);a=this.g.x-b;const d=this.g.y-c;this.g.x=b;this.g.y=c;b=this.W;const {pf:e,qf:f}={pf:a*b*(this.M?-1:1),qf:d*b*(this.N?-1:1)};this.j+=e;this.m+=f;Oq(this)}La(a){this.h.debug("Mouse Up. Removing mouse interaction listeners");a.preventDefault();Nq(this)}Zf(a,b){this.m=b;this.j=a;Oq(this)}If(){return{x:this.j,y:this.m}}ig(a){this.H=a;this.F()}};
15
- _.z("clpp.vr.VrPlugin",Uq);Uq.prototype.setCameraFieldOfView=Uq.prototype.ig;Uq.prototype.getCameraCoordinates=Uq.prototype.If;Uq.prototype.moveCamera=Uq.prototype.Zf;Uq.Id="vr";_.Hm(new class{create(){return new Uq}});};f.call(g, window);
13
+ 0,a.g);a=this.o;a.a.bindTexture(a.a.TEXTURE_2D,null);this.C.a.useProgram(null)}}}}fa(a){this.h.debug("Mouse Down. Enable VR mouse interaction");a.preventDefault();if(0===a.button||a.type===Ur)a.type===Ur?a.touches[0]&&(this.g.x=a.touches[0].clientX,this.g.y=a.touches[0].clientY):(this.g.x=a.clientX,this.g.y=a.clientY),this.h.debug("Mouse Start coordinates:",this.g,a),this.a.addEventListener("mousemove",this.A,!1),this.a.addEventListener(Tr,this.A,!1),this.a.addEventListener("mouseup",this.B,!1),this.a.addEventListener("touchend",
14
+ this.B,!1)}na(a){a.preventDefault();var b=a.clientX;let c=a.clientY;a.type===Tr&&a.touches[0]&&(b=a.touches[0].clientX,c=a.touches[0].clientY);a=this.g.x-b;const d=this.g.y-c;this.g.x=b;this.g.y=c;b=this.W;const {Ef:e,Ff:f}={Ef:a*b*(this.M?-1:1),Ff:d*b*(this.N?-1:1)};this.j+=e;this.l+=f;fs(this)}Na(a){this.h.debug("Mouse Up. Removing mouse interaction listeners");a.preventDefault();es(this)}og(a,b){this.l=b;this.j=a;fs(this)}Xf(){return{x:this.j,y:this.l}}Dg(a){this.H=a;this.F()}};
15
+ _.z("clpp.vr.VrPlugin",ls);ls.prototype.setCameraFieldOfView=ls.prototype.Dg;ls.prototype.getCameraCoordinates=ls.prototype.Xf;ls.prototype.moveCamera=ls.prototype.og;ls.Id="vr";_.En(new class{create(){return new ls}});};f.call(g, window);