@playkit-js/playkit-js-providers 2.41.4-canary.0-d258629 → 2.42.0-canary.0-07d09a7

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.
@@ -64,6 +64,7 @@ declare type ProviderEnvConfigObject = {
64
64
  useApiCaptions?: boolean;
65
65
  replaceHostOnlyManifestUrls?: boolean;
66
66
  overrideServiceUrl?: string;
67
+ initCallToServer?: string;
67
68
  };
68
69
 
69
70
  declare type ProviderNetworkRetryParameters = {
@@ -60,6 +60,7 @@ declare type ProviderEnvConfigObject = {
60
60
  useApiCaptions?: boolean;
61
61
  replaceHostOnlyManifestUrls?: boolean;
62
62
  overrideServiceUrl?: string;
63
+ initCallToServer?: string;
63
64
  };
64
65
 
65
66
  declare type ProviderNetworkRetryParameters = {
@@ -307,6 +307,7 @@ declare type ProviderEnvConfigObject = {
307
307
  useApiCaptions?: boolean;
308
308
  replaceHostOnlyManifestUrls?: boolean;
309
309
  overrideServiceUrl?: string;
310
+ initCallToServer?: string;
310
311
  };
311
312
 
312
313
  declare type ProviderFilterOptionsObject = {
@@ -1216,6 +1216,7 @@ declare type ProviderEnvConfigObject = {
1216
1216
  useApiCaptions?: boolean;
1217
1217
  replaceHostOnlyManifestUrls?: boolean;
1218
1218
  overrideServiceUrl?: string;
1219
+ initCallToServer?: string;
1219
1220
  };
1220
1221
 
1221
1222
  declare type ProviderFilterOptionsObject = {
@@ -1,2 +1,2 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,(function(){return function(){"use strict";var e={d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===n(t)?t:String(t)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}function s(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t,r){return(t=o(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}e.r(t),e.d(t,{NAME:function(){return A},OVPAnalyticsService:function(){return C},OVPConfiguration:function(){return v},RequestBuilder:function(){return l},VERSION:function(){return P}});var c=function(){return{VERSION:"",DEBUG:{value:"",name:""},ERROR:{value:"",name:""},INFO:{value:"",name:""},OFF:{value:"",name:""},TIME:{value:"",name:""},TRACE:{value:"",name:""},WARN:{value:"",name:""},createDefaultHandler:function(){},debug:function(){},enabledFor:function(){},error:function(){},get:function(){},getLevel:function(){},info:function(){},log:function(){},setHandler:function(){},setLevel:function(){},time:function(){},timeEnd:function(){},trace:function(){},useDefaults:function(){},warn:function(){}}};var u=function(e){return c(e)},f=s((function e(t,n,o){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r(this,e),this.severity=t,this.category=n,this.code=o,this.data=i,e._logger.error("Category:".concat(n," | Code:").concat(o," |"),i)}));a(f,"Severity",{RECOVERABLE:1,CRITICAL:2}),a(f,"Category",{NETWORK:1,SERVICE:2,PROVIDER:3}),a(f,"Code",{UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,BAD_SERVER_RESPONSE:1005,MULTIREQUEST_API_ERROR:1006,API_RESPONSE_MISMATCH:1007,ERROR:2e3,BLOCK_ACTION:2001,MEDIA_STATUS_NOT_READY:2002,SCHEDULED_RESTRICTED:2003,MISSING_MANDATORY_PARAMS:3e3,MISSING_PLAY_SOURCE:3001,METHOD_NOT_IMPLEMENTED:3002}),a(f,"_logger",u("Error"));var l=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Map;r(this,e),a(this,"retryConfig",{async:!0,timeout:0,maxAttempts:4}),a(this,"_attemptCounter",1),this.headers=t}return s(e,[{key:"getUrl",value:function(e){return e+"/service/"+this.service+(this.action?"/action/"+this.action:"")}},{key:"doHttpRequest",value:function(){var e=this,t=new Promise((function(t,r){e._requestPromise={resolve:t,reject:r}}));return this.url||this._requestPromise.reject(new f(f.Severity.CRITICAL,f.Category.NETWORK,f.Code.MALFORMED_DATA_URI,{url:this.url})),this._createXHR(),t}},{key:"_createXHR",value:function(){var e=this,t=new XMLHttpRequest;t.onreadystatechange=function(){if(4===t.readyState&&200===t.status)try{var r=JSON.parse(t.responseText);return e.responseHeaders=e._getResponseHeaders(t),e._requestPromise.resolve(r)}catch(r){e._requestPromise.reject(e._createError(t,f.Code.BAD_SERVER_RESPONSE,{text:t.responseText}))}},t.open(this.method,this.url,this.retryConfig.async),this.retryConfig.async&&this.retryConfig.timeout&&(t.timeout=this.retryConfig.timeout);var r=performance.now();t.ontimeout=function(){e._handleError(t,f.Code.TIMEOUT,{timeout:(performance.now()-r)/1e3,statusText:t.statusText})},t.onerror=t.onabort=function(){e._handleError(t,f.Code.HTTP_ERROR,{text:t.responseText,statusText:t.statusText})},this.headers.forEach((function(e,r){t.setRequestHeader(r,e)})),t.send(this.params)}},{key:"_getResponseHeaders",value:function(e){return e.getAllResponseHeaders().split("\n").filter((function(e){return 0===e.toLowerCase().indexOf("x-")}))}},{key:"_handleError",value:function(e,t,r){var n=this._createError(e,t,r);if(e.onreadystatechange=function(){},e.onerror=function(){},e.ontimeout=function(){},e.onabort=function(){},!(this.retryConfig.maxAttempts&&this._attemptCounter<this.retryConfig.maxAttempts))return this._requestPromise.reject(n);this._attemptCounter++,this._createXHR()}},{key:"_createError",value:function(e,t,r){return Object.assign(r,{url:this.url,headers:this._getResponseHeaders(e),attempt:this._attemptCounter}),new f(f.Severity.CRITICAL,f.Category.NETWORK,t,r)}}]),e}(),p=function e(t){var r;return Array.isArray(t)?(r=t.length>0?t.slice(0):[]).forEach((function(t,o){("object"===n(t)||Array.isArray(t)&&t.length>0)&&(r[o]=e(t))})):"object"===n(t)?(r=Object.assign({},t),Object.keys(r).forEach((function(t){("object"===n(r[t])||Array.isArray(r[t])&&r[t].length>0)&&(r[t]=e(r[t]))}))):r=t,r},y={serviceUrl:"https://cdnapisec.kaltura.com/api_v3",cdnUrl:"https://cdnapisec.kaltura.com",serviceParams:{apiVersion:"3.3.0",format:1},useApiCaptions:!0,loadThumbnailWithKs:!1,replaceHostOnlyManifestUrls:!1},v=function(){function e(){r(this,e)}return s(e,null,[{key:"set",value:function(e){null!=e&&e.overrideServiceUrl&&(e.serviceUrl=e.overrideServiceUrl),e&&Object.assign(y,e)}},{key:"get",value:function(){return p(y)}},{key:"serviceUrl",get:function(){return y.serviceUrl}}]),e}();function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}function E(e){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},E(e)}var R=s((function e(t){r(this,e),a(this,"hasError",!1),"KalturaAPIException"===t.objectType?(this.hasError=!0,this.error=new O(t.code,t.message)):t.error&&"KalturaAPIException"===t.error.objectType?(this.hasError=!0,this.error=new O(t.error.code,t.error.message)):this.data=t})),O=s((function e(t,n){r(this,e),this.code=t,this.message=n}));var b=function(e){d(i,e);var t,n,o=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=E(t);if(n){var o=E(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return g(this,e)});function i(){var e;r(this,i);for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return a(m(e=o.call.apply(o,[this].concat(n))),"requests",[]),e}return s(i,[{key:"add",value:function(e){this.requests.push(e);var t={},r={service:e.service,action:e.action};return Object.assign(t,a({},this.requests.length,Object.assign(r,e.params))),Object.assign(t,this.params),this.params=t,this}},{key:"execute",value:function(e){var t=this;return new Promise((function(r,n){try{t.params=JSON.stringify(t.params)}catch(e){i._logger.error("".concat(e.message)),n(new f(f.Severity.CRITICAL,f.Category.PROVIDER,f.Code.FAILED_PARSING_REQUEST,{error:e,params:t.params}))}t.doHttpRequest().then((function(o){var i=new _(o,e);i.success?r({headers:t.responseHeaders,response:i}):n(new f(f.Severity.CRITICAL,f.Category.NETWORK,f.Code.MULTIREQUEST_API_ERROR,{url:t.url,headers:t.responseHeaders,results:i.results}))}),(function(e){n(e)}))}))}}]),i}(l);a(b,"_logger",u("MultiRequestBuilder"));var _=s((function e(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];r(this,e),a(this,"results",[]);var o=t.result?t.result:t,i=(Array.isArray(o)?o:[o]).map((function(e){return new R(e)})),s=i.filter((function(e){return e.hasError}));s.forEach((function(t){e._logger.error("Service returned an error with error code: ".concat(t.error.code," and message: ").concat(t.error.message,"."))})),this.results=i,n&&s.length||s.length===this.results.length?this.success=!1:(this.results=this.results.filter((function(e){return!e.hasError})),this.success=!0)}));a(_,"_logger",u("MultiRequestResult"));var T=function(e){var t=[],r=/\[\]$/,o=function(e){return"[object Array]"===Object.prototype.toString.call(e)},i=function(e,r){r="function"==typeof r?r():null==r?"":r,t[t.length]=encodeURIComponent(e)+"="+encodeURIComponent(r)};return function e(s,a){var c,u,f;if(s)if(o(a))for(c=0,u=a.length;c<u;c++)r.test(s)?i(s,a[c]):e(s+":"+("object"===n(a[c])?c:""),a[c]);else if(a&&"[object Object]"===String(a))for(f in a)e(s+":"+f,a[f]);else i(s,a);else if(o(a))for(c=0,u=a.length;c<u;c++)i(a[c].name,a[c].value);else for(f in a)e(f,a[f]);return t}("",e).join("&").replace(/%20/g,"+")};var S="analytics",C=function(e){d(i,e);var t,n,o=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=E(t);if(n){var o=E(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return g(this,e)});function i(){return r(this,i),o.apply(this,arguments)}return s(i,null,[{key:"trackEvent",value:function(e,t,r){return"POST"===r?i._trackEventByPOST(e,t):i._trackEventByGET(e,t)}},{key:"_trackEventByGET",value:function(e,t){var r=v.get(),n={};Object.assign(n,r.serviceParams,t);var o=new l;return o.service=S,o.action="trackEvent",o.method="GET",o.retryConfig.maxAttempts=1,o.tag="analytics-trackEvent",o.params=n,o.url=e+"?service="+o.service+"&action="+o.action+"&"+T(o.params),o}},{key:"_trackEventByPOST",value:function(e,t){var r=v.get(),n={};Object.assign(n,r.serviceParams,t);var o=new Map;o.set("Content-Type","application/json");var i=new l(o),s={eventType:n.eventType,partnerId:n.partnerId,entryId:n.entryId,sessionId:n.sessionId};return["eventType","partnerId","entryId","sessionId"].forEach((function(e){return delete n[e]})),i.service=S,i.action="trackEvent",i.method="POST",i.retryConfig.maxAttempts=1,i.tag="analytics-trackEvent",i.params=JSON.stringify(n),i.url=e+"?service="+i.service+"&action="+i.action+"&"+T(s),i}}]),i}(function(){function e(){r(this,e)}return s(e,null,[{key:"getMultiRequest",value:function(e,t,r){var n=v.get(),o=n.serviceParams;Object.assign(o,{ks:t,clientTag:"html5:v"+e}),r&&Object.assign(o,{partnerId:r});var i=new Map;i.set("Content-Type","application/json");var s=new b(i);return s.method="POST",s.service="multirequest",s.url=s.getUrl(n.serviceUrl),s.params=o,s}}]),e}()),A="@playkit-js/playkit-js-providers-analytics-service",P="2.41.4-canary.0-d258629";return t}()}));
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,(function(){return function(){"use strict";var e={d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===n(t)?t:String(t)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}function s(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function a(e,t,r){return(t=o(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}e.r(t),e.d(t,{NAME:function(){return A},OVPAnalyticsService:function(){return C},OVPConfiguration:function(){return v},RequestBuilder:function(){return l},VERSION:function(){return P}});var c=function(){return{VERSION:"",DEBUG:{value:"",name:""},ERROR:{value:"",name:""},INFO:{value:"",name:""},OFF:{value:"",name:""},TIME:{value:"",name:""},TRACE:{value:"",name:""},WARN:{value:"",name:""},createDefaultHandler:function(){},debug:function(){},enabledFor:function(){},error:function(){},get:function(){},getLevel:function(){},info:function(){},log:function(){},setHandler:function(){},setLevel:function(){},time:function(){},timeEnd:function(){},trace:function(){},useDefaults:function(){},warn:function(){}}};var u=function(e){return c(e)},f=s((function e(t,n,o){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r(this,e),this.severity=t,this.category=n,this.code=o,this.data=i,e._logger.error("Category:".concat(n," | Code:").concat(o," |"),i)}));a(f,"Severity",{RECOVERABLE:1,CRITICAL:2}),a(f,"Category",{NETWORK:1,SERVICE:2,PROVIDER:3}),a(f,"Code",{UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,BAD_SERVER_RESPONSE:1005,MULTIREQUEST_API_ERROR:1006,API_RESPONSE_MISMATCH:1007,ERROR:2e3,BLOCK_ACTION:2001,MEDIA_STATUS_NOT_READY:2002,SCHEDULED_RESTRICTED:2003,MISSING_MANDATORY_PARAMS:3e3,MISSING_PLAY_SOURCE:3001,METHOD_NOT_IMPLEMENTED:3002}),a(f,"_logger",u("Error"));var l=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Map;r(this,e),a(this,"retryConfig",{async:!0,timeout:0,maxAttempts:4}),a(this,"_attemptCounter",1),this.headers=t}return s(e,[{key:"getUrl",value:function(e){return e+"/service/"+this.service+(this.action?"/action/"+this.action:"")}},{key:"doHttpRequest",value:function(){var e=this,t=new Promise((function(t,r){e._requestPromise={resolve:t,reject:r}}));return this.url||this._requestPromise.reject(new f(f.Severity.CRITICAL,f.Category.NETWORK,f.Code.MALFORMED_DATA_URI,{url:this.url})),this._createXHR(),t}},{key:"_createXHR",value:function(){var e=this,t=new XMLHttpRequest;t.onreadystatechange=function(){if(4===t.readyState&&200===t.status)try{var r=JSON.parse(t.responseText);return e.responseHeaders=e._getResponseHeaders(t),e._requestPromise.resolve(r)}catch(r){e._requestPromise.reject(e._createError(t,f.Code.BAD_SERVER_RESPONSE,{text:t.responseText}))}},t.open(this.method,this.url,this.retryConfig.async),this.retryConfig.async&&this.retryConfig.timeout&&(t.timeout=this.retryConfig.timeout);var r=performance.now();t.ontimeout=function(){e._handleError(t,f.Code.TIMEOUT,{timeout:(performance.now()-r)/1e3,statusText:t.statusText})},t.onerror=t.onabort=function(){e._handleError(t,f.Code.HTTP_ERROR,{text:t.responseText,statusText:t.statusText})},this.headers.forEach((function(e,r){t.setRequestHeader(r,e)})),t.send(this.params)}},{key:"_getResponseHeaders",value:function(e){return e.getAllResponseHeaders().split("\n").filter((function(e){return 0===e.toLowerCase().indexOf("x-")}))}},{key:"_handleError",value:function(e,t,r){var n=this._createError(e,t,r);if(e.onreadystatechange=function(){},e.onerror=function(){},e.ontimeout=function(){},e.onabort=function(){},!(this.retryConfig.maxAttempts&&this._attemptCounter<this.retryConfig.maxAttempts))return this._requestPromise.reject(n);this._attemptCounter++,this._createXHR()}},{key:"_createError",value:function(e,t,r){return Object.assign(r,{url:this.url,headers:this._getResponseHeaders(e),attempt:this._attemptCounter}),new f(f.Severity.CRITICAL,f.Category.NETWORK,t,r)}}]),e}(),p=function e(t){var r;return Array.isArray(t)?(r=t.length>0?t.slice(0):[]).forEach((function(t,o){("object"===n(t)||Array.isArray(t)&&t.length>0)&&(r[o]=e(t))})):"object"===n(t)?(r=Object.assign({},t),Object.keys(r).forEach((function(t){("object"===n(r[t])||Array.isArray(r[t])&&r[t].length>0)&&(r[t]=e(r[t]))}))):r=t,r},y={serviceUrl:"https://cdnapisec.kaltura.com/api_v3",cdnUrl:"https://cdnapisec.kaltura.com",serviceParams:{apiVersion:"3.3.0",format:1},useApiCaptions:!0,loadThumbnailWithKs:!1,replaceHostOnlyManifestUrls:!1},v=function(){function e(){r(this,e)}return s(e,null,[{key:"set",value:function(e){null!=e&&e.overrideServiceUrl&&(e.serviceUrl=e.overrideServiceUrl),e&&Object.assign(y,e)}},{key:"get",value:function(){return p(y)}},{key:"serviceUrl",get:function(){return y.serviceUrl}}]),e}();function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}function E(e){return E=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},E(e)}var R=s((function e(t){r(this,e),a(this,"hasError",!1),"KalturaAPIException"===t.objectType?(this.hasError=!0,this.error=new O(t.code,t.message)):t.error&&"KalturaAPIException"===t.error.objectType?(this.hasError=!0,this.error=new O(t.error.code,t.error.message)):this.data=t})),O=s((function e(t,n){r(this,e),this.code=t,this.message=n}));var b=function(e){d(i,e);var t,n,o=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=E(t);if(n){var o=E(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return g(this,e)});function i(){var e;r(this,i);for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return a(m(e=o.call.apply(o,[this].concat(n))),"requests",[]),e}return s(i,[{key:"add",value:function(e){this.requests.push(e);var t={},r={service:e.service,action:e.action};return Object.assign(t,a({},this.requests.length,Object.assign(r,e.params))),Object.assign(t,this.params),this.params=t,this}},{key:"execute",value:function(e){var t=this;return new Promise((function(r,n){try{t.params=JSON.stringify(t.params)}catch(e){i._logger.error("".concat(e.message)),n(new f(f.Severity.CRITICAL,f.Category.PROVIDER,f.Code.FAILED_PARSING_REQUEST,{error:e,params:t.params}))}t.doHttpRequest().then((function(o){var i=new _(o,e);i.success?r({headers:t.responseHeaders,response:i}):n(new f(f.Severity.CRITICAL,f.Category.NETWORK,f.Code.MULTIREQUEST_API_ERROR,{url:t.url,headers:t.responseHeaders,results:i.results}))}),(function(e){n(e)}))}))}}]),i}(l);a(b,"_logger",u("MultiRequestBuilder"));var _=s((function e(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];r(this,e),a(this,"results",[]);var o=t.result?t.result:t,i=(Array.isArray(o)?o:[o]).map((function(e){return new R(e)})),s=i.filter((function(e){return e.hasError}));s.forEach((function(t){e._logger.error("Service returned an error with error code: ".concat(t.error.code," and message: ").concat(t.error.message,"."))})),this.results=i,n&&s.length||s.length===this.results.length?this.success=!1:(this.results=this.results.filter((function(e){return!e.hasError})),this.success=!0)}));a(_,"_logger",u("MultiRequestResult"));var T=function(e){var t=[],r=/\[\]$/,o=function(e){return"[object Array]"===Object.prototype.toString.call(e)},i=function(e,r){r="function"==typeof r?r():null==r?"":r,t[t.length]=encodeURIComponent(e)+"="+encodeURIComponent(r)};return function e(s,a){var c,u,f;if(s)if(o(a))for(c=0,u=a.length;c<u;c++)r.test(s)?i(s,a[c]):e(s+":"+("object"===n(a[c])?c:""),a[c]);else if(a&&"[object Object]"===String(a))for(f in a)e(s+":"+f,a[f]);else i(s,a);else if(o(a))for(c=0,u=a.length;c<u;c++)i(a[c].name,a[c].value);else for(f in a)e(f,a[f]);return t}("",e).join("&").replace(/%20/g,"+")};var S="analytics",C=function(e){d(i,e);var t,n,o=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=E(t);if(n){var o=E(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return g(this,e)});function i(){return r(this,i),o.apply(this,arguments)}return s(i,null,[{key:"trackEvent",value:function(e,t,r){return"POST"===r?i._trackEventByPOST(e,t):i._trackEventByGET(e,t)}},{key:"_trackEventByGET",value:function(e,t){var r=v.get(),n={};Object.assign(n,r.serviceParams,t);var o=new l;return o.service=S,o.action="trackEvent",o.method="GET",o.retryConfig.maxAttempts=1,o.tag="analytics-trackEvent",o.params=n,o.url=e+"?service="+o.service+"&action="+o.action+"&"+T(o.params),o}},{key:"_trackEventByPOST",value:function(e,t){var r=v.get(),n={};Object.assign(n,r.serviceParams,t);var o=new Map;o.set("Content-Type","application/json");var i=new l(o),s={eventType:n.eventType,partnerId:n.partnerId,entryId:n.entryId,sessionId:n.sessionId};return["eventType","partnerId","entryId","sessionId"].forEach((function(e){return delete n[e]})),i.service=S,i.action="trackEvent",i.method="POST",i.retryConfig.maxAttempts=1,i.tag="analytics-trackEvent",i.params=JSON.stringify(n),i.url=e+"?service="+i.service+"&action="+i.action+"&"+T(s),i}}]),i}(function(){function e(){r(this,e)}return s(e,null,[{key:"getMultiRequest",value:function(e,t,r){var n=v.get(),o=n.serviceParams;Object.assign(o,{ks:t,clientTag:"html5:v"+e}),r&&Object.assign(o,{partnerId:r});var i=new Map;i.set("Content-Type","application/json");var s=new b(i);return s.method="POST",s.service="multirequest",s.url=s.getUrl(n.serviceUrl),s.params=o,s}}]),e}()),A="@playkit-js/playkit-js-providers-analytics-service",P="2.42.0-canary.0-07d09a7";return t}()}));
2
2
  //# sourceMappingURL=playkit-analytics-service.js.map
@@ -1,2 +1,2 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,(function(){return function(){"use strict";var e={d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===n(t)?t:String(t)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}function a(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,t,r){return(t=o(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}e.r(t),e.d(t,{NAME:function(){return S},OTTBookmarkService:function(){return T},OTTConfiguration:function(){return h},RequestBuilder:function(){return l},VERSION:function(){return C}});var u=function(){return{VERSION:"",DEBUG:{value:"",name:""},ERROR:{value:"",name:""},INFO:{value:"",name:""},OFF:{value:"",name:""},TIME:{value:"",name:""},TRACE:{value:"",name:""},WARN:{value:"",name:""},createDefaultHandler:function(){},debug:function(){},enabledFor:function(){},error:function(){},get:function(){},getLevel:function(){},info:function(){},log:function(){},setHandler:function(){},setLevel:function(){},time:function(){},timeEnd:function(){},trace:function(){},useDefaults:function(){},warn:function(){}}};var c=function(e){return u(e)},f=a((function e(t,n,o){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r(this,e),this.severity=t,this.category=n,this.code=o,this.data=i,e._logger.error("Category:".concat(n," | Code:").concat(o," |"),i)}));s(f,"Severity",{RECOVERABLE:1,CRITICAL:2}),s(f,"Category",{NETWORK:1,SERVICE:2,PROVIDER:3}),s(f,"Code",{UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,BAD_SERVER_RESPONSE:1005,MULTIREQUEST_API_ERROR:1006,API_RESPONSE_MISMATCH:1007,ERROR:2e3,BLOCK_ACTION:2001,MEDIA_STATUS_NOT_READY:2002,SCHEDULED_RESTRICTED:2003,MISSING_MANDATORY_PARAMS:3e3,MISSING_PLAY_SOURCE:3001,METHOD_NOT_IMPLEMENTED:3002}),s(f,"_logger",c("Error"));var l=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Map;r(this,e),s(this,"retryConfig",{async:!0,timeout:0,maxAttempts:4}),s(this,"_attemptCounter",1),this.headers=t}return a(e,[{key:"getUrl",value:function(e){return e+"/service/"+this.service+(this.action?"/action/"+this.action:"")}},{key:"doHttpRequest",value:function(){var e=this,t=new Promise((function(t,r){e._requestPromise={resolve:t,reject:r}}));return this.url||this._requestPromise.reject(new f(f.Severity.CRITICAL,f.Category.NETWORK,f.Code.MALFORMED_DATA_URI,{url:this.url})),this._createXHR(),t}},{key:"_createXHR",value:function(){var e=this,t=new XMLHttpRequest;t.onreadystatechange=function(){if(4===t.readyState&&200===t.status)try{var r=JSON.parse(t.responseText);return e.responseHeaders=e._getResponseHeaders(t),e._requestPromise.resolve(r)}catch(r){e._requestPromise.reject(e._createError(t,f.Code.BAD_SERVER_RESPONSE,{text:t.responseText}))}},t.open(this.method,this.url,this.retryConfig.async),this.retryConfig.async&&this.retryConfig.timeout&&(t.timeout=this.retryConfig.timeout);var r=performance.now();t.ontimeout=function(){e._handleError(t,f.Code.TIMEOUT,{timeout:(performance.now()-r)/1e3,statusText:t.statusText})},t.onerror=t.onabort=function(){e._handleError(t,f.Code.HTTP_ERROR,{text:t.responseText,statusText:t.statusText})},this.headers.forEach((function(e,r){t.setRequestHeader(r,e)})),t.send(this.params)}},{key:"_getResponseHeaders",value:function(e){return e.getAllResponseHeaders().split("\n").filter((function(e){return 0===e.toLowerCase().indexOf("x-")}))}},{key:"_handleError",value:function(e,t,r){var n=this._createError(e,t,r);if(e.onreadystatechange=function(){},e.onerror=function(){},e.ontimeout=function(){},e.onabort=function(){},!(this.retryConfig.maxAttempts&&this._attemptCounter<this.retryConfig.maxAttempts))return this._requestPromise.reject(n);this._attemptCounter++,this._createXHR()}},{key:"_createError",value:function(e,t,r){return Object.assign(r,{url:this.url,headers:this._getResponseHeaders(e),attempt:this._attemptCounter}),new f(f.Severity.CRITICAL,f.Category.NETWORK,t,r)}}]),e}(),p=function e(t){var r;return Array.isArray(t)?(r=t.length>0?t.slice(0):[]).forEach((function(t,o){("object"===n(t)||Array.isArray(t)&&t.length>0)&&(r[o]=e(t))})):"object"===n(t)?(r=Object.assign({},t),Object.keys(r).forEach((function(t){("object"===n(r[t])||Array.isArray(r[t])&&r[t].length>0)&&(r[t]=e(r[t]))}))):r=t,r},y={serviceParams:{apiVersion:"7.8.1"}},h=function(){function e(){r(this,e)}return a(e,null,[{key:"set",value:function(e){e&&Object.assign(y,e)}},{key:"get",value:function(){return p(y)}}]),e}();function v(e,t){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},v(e,t)}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}function R(e){return R=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},R(e)}var E=a((function e(t){r(this,e),s(this,"hasError",!1),"KalturaAPIException"===t.objectType?(this.hasError=!0,this.error=new b(t.code,t.message)):t.error&&"KalturaAPIException"===t.error.objectType?(this.hasError=!0,this.error=new b(t.error.code,t.error.message)):this.data=t})),b=a((function e(t,n){r(this,e),this.code=t,this.message=n}));var O=function(e){d(i,e);var t,n,o=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=R(t);if(n){var o=R(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return g(this,e)});function i(){var e;r(this,i);for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return s(m(e=o.call.apply(o,[this].concat(n))),"requests",[]),e}return a(i,[{key:"add",value:function(e){this.requests.push(e);var t={},r={service:e.service,action:e.action};return Object.assign(t,s({},this.requests.length,Object.assign(r,e.params))),Object.assign(t,this.params),this.params=t,this}},{key:"execute",value:function(e){var t=this;return new Promise((function(r,n){try{t.params=JSON.stringify(t.params)}catch(e){i._logger.error("".concat(e.message)),n(new f(f.Severity.CRITICAL,f.Category.PROVIDER,f.Code.FAILED_PARSING_REQUEST,{error:e,params:t.params}))}t.doHttpRequest().then((function(o){var i=new _(o,e);i.success?r({headers:t.responseHeaders,response:i}):n(new f(f.Severity.CRITICAL,f.Category.NETWORK,f.Code.MULTIREQUEST_API_ERROR,{url:t.url,headers:t.responseHeaders,results:i.results}))}),(function(e){n(e)}))}))}}]),i}(l);s(O,"_logger",c("MultiRequestBuilder"));var _=a((function e(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];r(this,e),s(this,"results",[]);var o=t.result?t.result:t,i=(Array.isArray(o)?o:[o]).map((function(e){return new E(e)})),a=i.filter((function(e){return e.hasError}));a.forEach((function(t){e._logger.error("Service returned an error with error code: ".concat(t.error.code," and message: ").concat(t.error.message,"."))})),this.results=i,n&&a.length||a.length===this.results.length?this.success=!1:(this.results=this.results.filter((function(e){return!e.hasError})),this.success=!0)}));s(_,"_logger",c("MultiRequestResult"));var T=function(e){d(i,e);var t,n,o=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=R(t);if(n){var o=R(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return g(this,e)});function i(){return r(this,i),o.apply(this,arguments)}return a(i,null,[{key:"add",value:function(e,t,r){var n=new Map;n.set("Content-Type","application/json");var o=new l(n);o.service="bookmark",o.action="add",o.method="POST",o.url=o.getUrl(e);var i={objectType:"KalturaBookmarkPlayerData",action:r.playerData.action,averageBitrate:r.playerData.averageBitrate,totalBitrate:r.playerData.totalBitrate,currentBitrate:r.playerData.currentBitrate,fileId:r.playerData.fileId},a={objectType:"KalturaBookmark",type:r.type,context:r.context,id:r.id,position:r.position,playerData:i};r.programId&&(a.programId=r.programId);var s=h.get().serviceParams;return Object.assign(s,{bookmark:a,ks:t}),o.params=JSON.stringify(s),o}}]),i}(function(){function e(){r(this,e)}return a(e,null,[{key:"getMultiRequest",value:function(e,t){var r=h.get(),n=r.serviceParams;e&&Object.assign(n,{ks:e}),t&&Object.assign(n,{partnerId:t});var o=new Map;o.set("Content-Type","application/json");var i=new O(o);return i.method="POST",i.service="multirequest",i.url=i.getUrl(r.serviceUrl),i.params=n,i}}]),e}()),S="@playkit-js/playkit-js-providers-bookmark-service",C="2.41.4-canary.0-d258629";return t}()}));
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,(function(){return function(){"use strict";var e={d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===n(t)?t:String(t)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}function a(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,t,r){return(t=o(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}e.r(t),e.d(t,{NAME:function(){return S},OTTBookmarkService:function(){return T},OTTConfiguration:function(){return h},RequestBuilder:function(){return l},VERSION:function(){return C}});var u=function(){return{VERSION:"",DEBUG:{value:"",name:""},ERROR:{value:"",name:""},INFO:{value:"",name:""},OFF:{value:"",name:""},TIME:{value:"",name:""},TRACE:{value:"",name:""},WARN:{value:"",name:""},createDefaultHandler:function(){},debug:function(){},enabledFor:function(){},error:function(){},get:function(){},getLevel:function(){},info:function(){},log:function(){},setHandler:function(){},setLevel:function(){},time:function(){},timeEnd:function(){},trace:function(){},useDefaults:function(){},warn:function(){}}};var c=function(e){return u(e)},f=a((function e(t,n,o){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r(this,e),this.severity=t,this.category=n,this.code=o,this.data=i,e._logger.error("Category:".concat(n," | Code:").concat(o," |"),i)}));s(f,"Severity",{RECOVERABLE:1,CRITICAL:2}),s(f,"Category",{NETWORK:1,SERVICE:2,PROVIDER:3}),s(f,"Code",{UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,BAD_SERVER_RESPONSE:1005,MULTIREQUEST_API_ERROR:1006,API_RESPONSE_MISMATCH:1007,ERROR:2e3,BLOCK_ACTION:2001,MEDIA_STATUS_NOT_READY:2002,SCHEDULED_RESTRICTED:2003,MISSING_MANDATORY_PARAMS:3e3,MISSING_PLAY_SOURCE:3001,METHOD_NOT_IMPLEMENTED:3002}),s(f,"_logger",c("Error"));var l=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Map;r(this,e),s(this,"retryConfig",{async:!0,timeout:0,maxAttempts:4}),s(this,"_attemptCounter",1),this.headers=t}return a(e,[{key:"getUrl",value:function(e){return e+"/service/"+this.service+(this.action?"/action/"+this.action:"")}},{key:"doHttpRequest",value:function(){var e=this,t=new Promise((function(t,r){e._requestPromise={resolve:t,reject:r}}));return this.url||this._requestPromise.reject(new f(f.Severity.CRITICAL,f.Category.NETWORK,f.Code.MALFORMED_DATA_URI,{url:this.url})),this._createXHR(),t}},{key:"_createXHR",value:function(){var e=this,t=new XMLHttpRequest;t.onreadystatechange=function(){if(4===t.readyState&&200===t.status)try{var r=JSON.parse(t.responseText);return e.responseHeaders=e._getResponseHeaders(t),e._requestPromise.resolve(r)}catch(r){e._requestPromise.reject(e._createError(t,f.Code.BAD_SERVER_RESPONSE,{text:t.responseText}))}},t.open(this.method,this.url,this.retryConfig.async),this.retryConfig.async&&this.retryConfig.timeout&&(t.timeout=this.retryConfig.timeout);var r=performance.now();t.ontimeout=function(){e._handleError(t,f.Code.TIMEOUT,{timeout:(performance.now()-r)/1e3,statusText:t.statusText})},t.onerror=t.onabort=function(){e._handleError(t,f.Code.HTTP_ERROR,{text:t.responseText,statusText:t.statusText})},this.headers.forEach((function(e,r){t.setRequestHeader(r,e)})),t.send(this.params)}},{key:"_getResponseHeaders",value:function(e){return e.getAllResponseHeaders().split("\n").filter((function(e){return 0===e.toLowerCase().indexOf("x-")}))}},{key:"_handleError",value:function(e,t,r){var n=this._createError(e,t,r);if(e.onreadystatechange=function(){},e.onerror=function(){},e.ontimeout=function(){},e.onabort=function(){},!(this.retryConfig.maxAttempts&&this._attemptCounter<this.retryConfig.maxAttempts))return this._requestPromise.reject(n);this._attemptCounter++,this._createXHR()}},{key:"_createError",value:function(e,t,r){return Object.assign(r,{url:this.url,headers:this._getResponseHeaders(e),attempt:this._attemptCounter}),new f(f.Severity.CRITICAL,f.Category.NETWORK,t,r)}}]),e}(),p=function e(t){var r;return Array.isArray(t)?(r=t.length>0?t.slice(0):[]).forEach((function(t,o){("object"===n(t)||Array.isArray(t)&&t.length>0)&&(r[o]=e(t))})):"object"===n(t)?(r=Object.assign({},t),Object.keys(r).forEach((function(t){("object"===n(r[t])||Array.isArray(r[t])&&r[t].length>0)&&(r[t]=e(r[t]))}))):r=t,r},y={serviceParams:{apiVersion:"7.8.1"}},h=function(){function e(){r(this,e)}return a(e,null,[{key:"set",value:function(e){e&&Object.assign(y,e)}},{key:"get",value:function(){return p(y)}}]),e}();function v(e,t){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},v(e,t)}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}function R(e){return R=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},R(e)}var E=a((function e(t){r(this,e),s(this,"hasError",!1),"KalturaAPIException"===t.objectType?(this.hasError=!0,this.error=new b(t.code,t.message)):t.error&&"KalturaAPIException"===t.error.objectType?(this.hasError=!0,this.error=new b(t.error.code,t.error.message)):this.data=t})),b=a((function e(t,n){r(this,e),this.code=t,this.message=n}));var O=function(e){d(i,e);var t,n,o=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=R(t);if(n){var o=R(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return g(this,e)});function i(){var e;r(this,i);for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return s(m(e=o.call.apply(o,[this].concat(n))),"requests",[]),e}return a(i,[{key:"add",value:function(e){this.requests.push(e);var t={},r={service:e.service,action:e.action};return Object.assign(t,s({},this.requests.length,Object.assign(r,e.params))),Object.assign(t,this.params),this.params=t,this}},{key:"execute",value:function(e){var t=this;return new Promise((function(r,n){try{t.params=JSON.stringify(t.params)}catch(e){i._logger.error("".concat(e.message)),n(new f(f.Severity.CRITICAL,f.Category.PROVIDER,f.Code.FAILED_PARSING_REQUEST,{error:e,params:t.params}))}t.doHttpRequest().then((function(o){var i=new _(o,e);i.success?r({headers:t.responseHeaders,response:i}):n(new f(f.Severity.CRITICAL,f.Category.NETWORK,f.Code.MULTIREQUEST_API_ERROR,{url:t.url,headers:t.responseHeaders,results:i.results}))}),(function(e){n(e)}))}))}}]),i}(l);s(O,"_logger",c("MultiRequestBuilder"));var _=a((function e(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];r(this,e),s(this,"results",[]);var o=t.result?t.result:t,i=(Array.isArray(o)?o:[o]).map((function(e){return new E(e)})),a=i.filter((function(e){return e.hasError}));a.forEach((function(t){e._logger.error("Service returned an error with error code: ".concat(t.error.code," and message: ").concat(t.error.message,"."))})),this.results=i,n&&a.length||a.length===this.results.length?this.success=!1:(this.results=this.results.filter((function(e){return!e.hasError})),this.success=!0)}));s(_,"_logger",c("MultiRequestResult"));var T=function(e){d(i,e);var t,n,o=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=R(t);if(n){var o=R(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return g(this,e)});function i(){return r(this,i),o.apply(this,arguments)}return a(i,null,[{key:"add",value:function(e,t,r){var n=new Map;n.set("Content-Type","application/json");var o=new l(n);o.service="bookmark",o.action="add",o.method="POST",o.url=o.getUrl(e);var i={objectType:"KalturaBookmarkPlayerData",action:r.playerData.action,averageBitrate:r.playerData.averageBitrate,totalBitrate:r.playerData.totalBitrate,currentBitrate:r.playerData.currentBitrate,fileId:r.playerData.fileId},a={objectType:"KalturaBookmark",type:r.type,context:r.context,id:r.id,position:r.position,playerData:i};r.programId&&(a.programId=r.programId);var s=h.get().serviceParams;return Object.assign(s,{bookmark:a,ks:t}),o.params=JSON.stringify(s),o}}]),i}(function(){function e(){r(this,e)}return a(e,null,[{key:"getMultiRequest",value:function(e,t){var r=h.get(),n=r.serviceParams;e&&Object.assign(n,{ks:e}),t&&Object.assign(n,{partnerId:t});var o=new Map;o.set("Content-Type","application/json");var i=new O(o);return i.method="POST",i.service="multirequest",i.url=i.getUrl(r.serviceUrl),i.params=n,i}}]),e}()),S="@playkit-js/playkit-js-providers-bookmark-service",C="2.42.0-canary.0-07d09a7";return t}()}));
2
2
  //# sourceMappingURL=playkit-bookmark-service.js.map
@@ -1,2 +1,2 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,(function(){return function(){"use strict";var e={d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function s(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,"string");if("object"!==n(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===n(t)?t:String(t)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,s(n.key),n)}}function a(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(e,t){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},o(e,t)}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&o(e,t)}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return c(e)}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function h(e,t,r){return(t=s(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}e.r(t),e.d(t,{ContextType:function(){return ne},MediaType:function(){return se},NAME:function(){return te},Provider:function(){return ee},VERSION:function(){return re}});var p={get:function(){return{VERSION:"",DEBUG:{value:"",name:""},ERROR:{value:"",name:""},INFO:{value:"",name:""},OFF:{value:"",name:""},TIME:{value:"",name:""},TRACE:{value:"",name:""},WARN:{value:"",name:""},createDefaultHandler:function(){},debug:function(){},enabledFor:function(){},error:function(){},get:function(){},getLevel:function(){},info:function(){},log:function(){},setHandler:function(){},setLevel:function(){},time:function(){},timeEnd:function(){},trace:function(){},useDefaults:function(){},warn:function(){}}}},d={};function y(e){return p.get(e)}var m=y,g=a((function e(t,n,s){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r(this,e),this.severity=t,this.category=n,this.code=s,this.data=i,e._logger.error("Category:".concat(n," | Code:").concat(s," |"),i)}));h(g,"Severity",{RECOVERABLE:1,CRITICAL:2}),h(g,"Category",{NETWORK:1,SERVICE:2,PROVIDER:3}),h(g,"Code",{UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,BAD_SERVER_RESPONSE:1005,MULTIREQUEST_API_ERROR:1006,API_RESPONSE_MISMATCH:1007,ERROR:2e3,BLOCK_ACTION:2001,MEDIA_STATUS_NOT_READY:2002,SCHEDULED_RESTRICTED:2003,MISSING_MANDATORY_PARAMS:3e3,MISSING_PLAY_SOURCE:3001,METHOD_NOT_IMPLEMENTED:3002}),h(g,"_logger",m("Error"));var v=function(){function e(t,n){r(this,e),h(this,"_networkRetryConfig",{async:!0,timeout:0,maxAttempts:4}),function(e){e&&"function"==typeof e.getLogger&&(p.get=e.getLogger),e&&e.LogLevel&&(d=e.LogLevel)}(t.logger),this._partnerId=t.partnerId,this._widgetId=t.widgetId,this._uiConfId=t.uiConfId,this._isAnonymous=!t.ks,this._ks=t.ks||"",this._playerVersion=n,this._referrer=t.referrer}return a(e,[{key:"partnerId",get:function(){return this._partnerId}},{key:"widgetId",get:function(){return this._widgetId||this.defaultWidgetId}},{key:"defaultWidgetId",get:function(){return"_"+this._partnerId}},{key:"uiConfId",get:function(){return this._uiConfId}},{key:"ks",get:function(){return this._ks},set:function(e){this._ks=e}},{key:"playerVersion",get:function(){return this._playerVersion}},{key:"isAnonymous",get:function(){return this._isAnonymous}},{key:"getMediaConfig",value:function(e){return Promise.reject(new g(g.Severity.CRITICAL,g.Category.PROVIDER,g.Code.METHOD_NOT_IMPLEMENTED,{message:"getMediaConfig method must be implement by the derived class"}))}},{key:"getPlaylistConfig",value:function(e){return Promise.reject(new g(g.Severity.CRITICAL,g.Category.PROVIDER,g.Code.METHOD_NOT_IMPLEMENTED,{message:"The provider does not support loading playlist by id"}))}},{key:"getEntryListConfig",value:function(e){return Promise.reject(new g(g.Severity.CRITICAL,g.Category.PROVIDER,g.Code.METHOD_NOT_IMPLEMENTED,{message:"The provider does not support loading entry list"}))}},{key:"_verifyHasSources",value:function(e){if(0===e.hls.concat(e.dash,e.progressive,e.image,e.document).length)throw new g(g.Severity.CRITICAL,g.Category.SERVICE,g.Code.MISSING_PLAY_SOURCE,{action:"",messages:"No play source for entry id: ".concat(e.id)})}},{key:"LogLevel",get:function(){return d}},{key:"getLogLevel",value:function(e){return function(e){return y(e).getLevel()}(e)}},{key:"setLogLevel",value:function(e,t){!function(e,t){y(t).setLevel(e)}(e,t)}}]),e}(),R=function e(t){var r;return Array.isArray(t)?(r=t.length>0?t.slice(0):[]).forEach((function(t,s){("object"===n(t)||Array.isArray(t)&&t.length>0)&&(r[s]=e(t))})):"object"===n(t)?(r=Object.assign({},t),Object.keys(r).forEach((function(t){("object"===n(r[t])||Array.isArray(r[t])&&r[t].length>0)&&(r[t]=e(r[t]))}))):r=t,r},_={serviceParams:{apiVersion:"7.8.1"}},T=function(){function e(){r(this,e)}return a(e,null,[{key:"set",value:function(e){e&&Object.assign(_,e)}},{key:"get",value:function(){return R(_)}}]),e}(),E=function(){function e(t){r(this,e),h(this,"_loadersResponseMap",new Map),h(this,"_loaders",new Map),this._networkRetryConfig=t}return a(e,[{key:"add",value:function(e,t,r){var n=this,s=new e(t);if(s.isValid()){this._loaders.set(e.id,s);var i=this._multiRequest.requests.length,a=s.requests;this._multiRequest.retryConfig=this._networkRetryConfig,a.forEach((function(e){e.params=e.params||{},e.params.ks=e.params.ks||r,n._multiRequest.add(e)}));var o=Array.from(new Array(a.length),(function(e,t){return t+i}));this._loadersResponseMap.set(e.id,o)}}},{key:"fetchData",value:function(e){var t=this;return new Promise((function(r,n){t._multiRequest.execute(e).then((function(e){t._multiResponse=e.response,t.prepareData(e.response).success?r(t._loaders):n(new g(g.Severity.CRITICAL,g.Category.NETWORK,g.Code.API_RESPONSE_MISMATCH,{headers:e.headers}))}),(function(e){n(e)}))}))}},{key:"prepareData",value:function(e){var t=this;return this._loaders.forEach((function(r,n){var s=t._loadersResponseMap.get(n);try{s&&s.length>0&&(r.response=e.results.slice(s[0],s[s.length-1]+1))}catch(e){return{success:!1,error:e}}})),{success:!0,data:this._loaders}}}]),e}(),O=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Map;r(this,e),h(this,"retryConfig",{async:!0,timeout:0,maxAttempts:4}),h(this,"_attemptCounter",1),this.headers=t}return a(e,[{key:"getUrl",value:function(e){return e+"/service/"+this.service+(this.action?"/action/"+this.action:"")}},{key:"doHttpRequest",value:function(){var e=this,t=new Promise((function(t,r){e._requestPromise={resolve:t,reject:r}}));return this.url||this._requestPromise.reject(new g(g.Severity.CRITICAL,g.Category.NETWORK,g.Code.MALFORMED_DATA_URI,{url:this.url})),this._createXHR(),t}},{key:"_createXHR",value:function(){var e=this,t=new XMLHttpRequest;t.onreadystatechange=function(){if(4===t.readyState&&200===t.status)try{var r=JSON.parse(t.responseText);return e.responseHeaders=e._getResponseHeaders(t),e._requestPromise.resolve(r)}catch(r){e._requestPromise.reject(e._createError(t,g.Code.BAD_SERVER_RESPONSE,{text:t.responseText}))}},t.open(this.method,this.url,this.retryConfig.async),this.retryConfig.async&&this.retryConfig.timeout&&(t.timeout=this.retryConfig.timeout);var r=performance.now();t.ontimeout=function(){e._handleError(t,g.Code.TIMEOUT,{timeout:(performance.now()-r)/1e3,statusText:t.statusText})},t.onerror=t.onabort=function(){e._handleError(t,g.Code.HTTP_ERROR,{text:t.responseText,statusText:t.statusText})},this.headers.forEach((function(e,r){t.setRequestHeader(r,e)})),t.send(this.params)}},{key:"_getResponseHeaders",value:function(e){return e.getAllResponseHeaders().split("\n").filter((function(e){return 0===e.toLowerCase().indexOf("x-")}))}},{key:"_handleError",value:function(e,t,r){var n=this._createError(e,t,r);if(e.onreadystatechange=function(){},e.onerror=function(){},e.ontimeout=function(){},e.onabort=function(){},!(this.retryConfig.maxAttempts&&this._attemptCounter<this.retryConfig.maxAttempts))return this._requestPromise.reject(n);this._attemptCounter++,this._createXHR()}},{key:"_createError",value:function(e,t,r){return Object.assign(r,{url:this.url,headers:this._getResponseHeaders(e),attempt:this._attemptCounter}),new g(g.Severity.CRITICAL,g.Category.NETWORK,t,r)}}]),e}(),I=a((function e(t){r(this,e),h(this,"hasError",!1),"KalturaAPIException"===t.objectType?(this.hasError=!0,this.error=new k(t.code,t.message)):t.error&&"KalturaAPIException"===t.error.objectType?(this.hasError=!0,this.error=new k(t.error.code,t.error.message)):this.data=t})),k=a((function e(t,n){r(this,e),this.code=t,this.message=n}));var A=function(e){u(i,e);var t,n,s=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=l(t);if(n){var s=l(this).constructor;e=Reflect.construct(r,arguments,s)}else e=r.apply(this,arguments);return f(this,e)});function i(){var e;r(this,i);for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return h(c(e=s.call.apply(s,[this].concat(n))),"requests",[]),e}return a(i,[{key:"add",value:function(e){this.requests.push(e);var t={},r={service:e.service,action:e.action};return Object.assign(t,h({},this.requests.length,Object.assign(r,e.params))),Object.assign(t,this.params),this.params=t,this}},{key:"execute",value:function(e){var t=this;return new Promise((function(r,n){try{t.params=JSON.stringify(t.params)}catch(e){i._logger.error("".concat(e.message)),n(new g(g.Severity.CRITICAL,g.Category.PROVIDER,g.Code.FAILED_PARSING_REQUEST,{error:e,params:t.params}))}t.doHttpRequest().then((function(s){var i=new C(s,e);i.success?r({headers:t.responseHeaders,response:i}):n(new g(g.Severity.CRITICAL,g.Category.NETWORK,g.Code.MULTIREQUEST_API_ERROR,{url:t.url,headers:t.responseHeaders,results:i.results}))}),(function(e){n(e)}))}))}}]),i}(O);h(A,"_logger",m("MultiRequestBuilder"));var C=a((function e(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];r(this,e),h(this,"results",[]);var s=t.result?t.result:t,i=(Array.isArray(s)?s:[s]).map((function(e){return new I(e)})),a=i.filter((function(e){return e.hasError}));a.forEach((function(t){e._logger.error("Service returned an error with error code: ".concat(t.error.code," and message: ").concat(t.error.message,"."))})),this.results=i,n&&a.length||a.length===this.results.length?this.success=!1:(this.results=this.results.filter((function(e){return!e.hasError})),this.success=!0)}));h(C,"_logger",m("MultiRequestResult"));var S=function(){function e(){r(this,e)}return a(e,null,[{key:"getMultiRequest",value:function(e,t){var r=T.get(),n=r.serviceParams;e&&Object.assign(n,{ks:e}),t&&Object.assign(n,{partnerId:t});var s=new Map;s.set("Content-Type","application/json");var i=new A(s);return i.method="POST",i.service="multirequest",i.url=i.getUrl(r.serviceUrl),i.params=n,i}}]),e}();var P=function(e){u(i,e);var t,n,s=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=l(t);if(n){var s=l(this).constructor;e=Reflect.construct(r,arguments,s)}else e=r.apply(this,arguments);return f(this,e)});function i(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",a=arguments.length>2?arguments[2]:void 0;return r(this,i),(t=s.call(this,a))._multiRequest=S.getMultiRequest(n,e),t}return a(i)}(E);var D=function(e){u(i,e);var t,n,s=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=l(t);if(n){var s=l(this).constructor;e=Reflect.construct(r,arguments,s)}else e=r.apply(this,arguments);return f(this,e)});function i(){return r(this,i),s.apply(this,arguments)}return a(i,null,[{key:"anonymousLogin",value:function(e,t,r){var n=new Map;n.set("Content-Type","application/json");var s=new O(n);s.service="ottuser",s.action="anonymousLogin",s.method="POST",s.url=s.getUrl(e);var i={partnerId:t};return r&&Object.assign(i,{udid:r}),s.params=i,s}}]),i}(S),b=function(){function e(t){r(this,e),h(this,"_response",{}),this.requests=this.buildRequests(t),this._partnerId=t.partnerId}return a(e,[{key:"requests",get:function(){return this._requests},set:function(e){this._requests=e}},{key:"response",get:function(){return this._response.ks},set:function(e){this._response.ks=e[0].data.ks}},{key:"buildRequests",value:function(e){var t=T.get(),r=[];return r.push(D.anonymousLogin(t.serviceUrl,e.partnerId,e.udid)),r}},{key:"isValid",value:function(){return!!this._partnerId}}],[{key:"id",get:function(){return"session"}}]),e}();var w="asset",L=function(e){u(i,e);var t,n,s=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=l(t);if(n){var s=l(this).constructor;e=Reflect.construct(r,arguments,s)}else e=r.apply(this,arguments);return f(this,e)});function i(){return r(this,i),s.apply(this,arguments)}return a(i,null,[{key:"getPlaybackContext",value:function(e,t,r,n,s){var i=new Map;i.set("Content-Type","application/json");var a=new O(i);a.service=w,a.action="getPlaybackContext",a.method="POST",a.url=a.getUrl(e);var o={objectType:"KalturaPlaybackContextOptions"};return Object.assign(o,s),a.params={assetId:r,assetType:n,contextDataParams:o,ks:t},a}},{key:"get",value:function(e,t,r,n){var s=new Map;s.set("Content-Type","application/json");var i=new O(s);return i.service=w,i.action="get",i.method="POST",i.url=i.getUrl(e),i.params={id:r,assetReferenceType:n,ks:t},i}}]),i}(S),M=a((function e(t){r(this,e),this.message=t.message,this.code=t.code})),N=a((function e(t){r(this,e),this.type=t.type}));h(N,"Type",{BLOCK:"BLOCK",START_DATE_OFFSET:"START_DATE_OFFSET",END_DATE_OFFSET:"END_DATE_OFFSET",USER_BLOCK:"USER_BLOCK",ALLOW_PLAYBACK:"ALLOW_PLAYBACK",BLOCK_PLAYBACK:"BLOCK_PLAYBACK",APPLY_DISCOUNT_MODULE:"APPLY_DISCOUNT_MODULE"});var j=a((function e(t){r(this,e),this.scheme=t.scheme,this.licenseURL=t.licenseURL,this.certificate=t.certificate}));h(j,"Scheme",{"drm.PLAYREADY_CENC":"com.microsoft.playready","drm.WIDEVINE_CENC":"com.widevine.alpha","fairplay.FAIRPLAY":"com.apple.fairplay",WIDEVINE_CENC:"com.widevine.alpha",PLAYREADY_CENC:"com.microsoft.playready",FAIRPLAY:"com.apple.fairplay"});var x=function(){function e(t){var n=this;r(this,e),h(this,"drm",[]),this.format=t.format,this.adsPolicy=t.adsPolicy,this.adsParam=t.adsParam,this.duration=t.duration,this.url=t.url,this.type=t.type,this.fileId=t.id,this.protocols=t.protocols,t.drm&&t.drm.map((function(e){return n.drm.push(new j(e))}))}return a(e,[{key:"hasDrmData",value:function(){return this.drm&&this.drm.length>0}},{key:"getProtocol",value:function(e){var t="";if(this.protocols&&this.protocols.length>0)this.protocols.split(",").forEach((function(r){r===e&&(t=r)}));else if("http"===e)return e;return t}}]),e}(),B=a((function e(t){r(this,e),this.streamertype=t.streamertype,this.url=t.url}));h(B,"StreamerType",{HLS:"hls",DASH:"dash",PROGRESSIVE:"progressive"});var U=function(e){u(i,e);var t,n,s=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=l(t);if(n){var s=l(this).constructor;e=Reflect.construct(r,arguments,s)}else e=r.apply(this,arguments);return f(this,e)});function i(e){var t;if(r(this,i),h(c(t=s.call(this,e)),"sources",[]),h(c(t),"actions",[]),h(c(t),"messages",[]),h(c(t),"plugins",[]),!t.hasError){var n=e.messages;n&&n.map((function(e){return t.messages.push(new M(e))}));var a=e.actions;a&&a.map((function(e){return t.actions.push(new N(e))}));var o=e.sources;o&&o.map((function(e){return t.sources.push(new x(e))}));var u=e.plugins;u&&u.map((function(e){return t.plugins.push(new B(e))}))}return t}return a(i,[{key:"hasBlockAction",value:function(){return void 0!==this.getBlockAction()}},{key:"getBlockAction",value:function(){return this.actions.find((function(e){return e.type===N.Type.BLOCK}))}},{key:"getErrorMessages",value:function(){return this.messages}}]),i}(I);h(U,"Type",{DOWNLOAD:"DOWNLOAD",TRAILER:"TRAILER",CATCHUP:"CATCHUP",START_OVER:"START_OVER",PLAYBACK:"PLAYBACK"});var q=function(e){u(i,e);var t,n,s=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=l(t);if(n){var s=l(this).constructor;e=Reflect.construct(r,arguments,s)}else e=r.apply(this,arguments);return f(this,e)});function i(e){var t;return r(this,i),h(c(t=s.call(this,e)),"name",""),h(c(t),"description",""),h(c(t),"tags",[]),h(c(t),"metas",[]),h(c(t),"pictures",[]),t.hasError||(t.id=e.id,t.name=e.name,t.description=e.description,t.createDate=e.createDate,t.endDate=e.endDate,t.plays=e.plays,t.views=e.views,t.metas=t._formatTagsMetas(e.metas),t.tags=t._formatTagsMetas(e.tags),t.pictures=e.images),t}return a(i,[{key:"_formatTagsMetas",value:function(e){var t=[];return Object.keys(e).forEach((function(r){if(e[r].objects){var n="";e[r].objects.forEach((function(e){n+=e.value+"|"})),t.push({key:r,value:n})}else t.push({key:r,value:e[r].value})})),t}}]),i}(I);h(q,"Type",{MEDIA:"media",RECORDING:"recording",EPG:"epg"}),h(q,"AssetReferenceType",{MEDIA:"media",EPG_INTERNAL:"epg_internal",EPG_EXTERNAL:"epg_external",NPVR:"nPVR"});var V=function(){function e(t){r(this,e),h(this,"_response",{}),this.requests=this.buildRequests(t),this._entryId=t.entryId}return a(e,[{key:"requests",get:function(){return this._requests},set:function(e){this._requests=e}},{key:"response",get:function(){return this._response},set:function(e){this._response.mediaDataResult=new q(e[0].data),this._response.playBackContextResult=new U(e[1].data)}},{key:"buildRequests",value:function(e){var t=T.get(),r=[];return r.push(L.get(t.serviceUrl,e.ks,e.entryId,e.assetReferenceType)),r.push(L.getPlaybackContext(t.serviceUrl,e.ks,e.entryId,e.type,e.playbackContext)),r}},{key:"isValid",value:function(){return!!this._entryId}}],[{key:"id",get:function(){return"asset"}}]),e}(),H=function(){function e(t){r(this,e),h(this,"_response",{playlistItems:{entries:[]}}),this.requests=this.buildRequests(t),this._entries=t.entries}return a(e,[{key:"requests",get:function(){return this._requests},set:function(e){this._requests=e}},{key:"response",get:function(){return this._response},set:function(e){var t=this;e.forEach((function(e){t._response.playlistItems.entries.push({mediaDataResult:new q(e.data)})}))}},{key:"buildRequests",value:function(e){var t=T.get(),r=[];return e.entries.forEach((function(n){var s=n.assetReferenceType||q.AssetReferenceType.MEDIA;r.push(L.get(t.serviceUrl,e.ks,n.entryId||n,s))})),r}},{key:"isValid",value:function(){return!(!this._entries||!this._entries.length)}}],[{key:"id",get:function(){return"asset_list"}}]),e}(),K={DASH:{name:"dash",mimeType:"application/dash+xml",pathExt:"mpd"},HLS:{name:"hls",mimeType:"application/x-mpegURL",pathExt:"m3u8"},WVM:{name:"wvm",mimeType:"video/wvm",pathExt:"wvm"},MP4:{name:"mp4",mimeType:"video/mp4",pathExt:"mp4"},MP3:{name:"mp3",mimeType:"audio/mpeg",pathExt:"mp3"}},F=new Map([["mpegdash",K.DASH],["applehttp",K.HLS],["url",K.MP4]]);function Y(e){var t=F.get(e);return!!t&&t.name===K.MP4.name}var W=function(){function e(){r(this,e),this.progressive=[],this.dash=[],this.hls=[],this.image=[],this.document=[]}return a(e,[{key:"map",value:function(e,t){if(t)switch(t.name){case K.MP4.name:this.progressive.push(e);break;case K.DASH.name:this.dash.push(e);break;case K.HLS.name:this.hls.push(e)}}},{key:"toJSON",value:function(){var e={progressive:[],dash:[],hls:[],image:[],document:[]};return this.progressive.forEach((function(t){return e.progressive.push(t.toJSON())})),this.hls.forEach((function(t){return e.hls.push(t.toJSON())})),this.dash.forEach((function(t){return e.dash.push(t.toJSON())})),e.image=this.image,e.document=this.document,e}}]),e}(),G=function(){function e(){r(this,e),this.metadata=new Map,this.sources=new W,this.type=e.Type.UNKNOWN}return a(e,[{key:"toJSON",value:function(){return{id:this.id,name:this.name,sources:this.sources.toJSON(),duration:this.duration,dvrStatus:this.dvrStatus,status:this.status,metadata:this.metadata,type:this.type,poster:this.poster,assetReferenceType:this.assetReferenceType,downloadUrl:this.downloadUrl,rawThumbnailUrl:this.rawThumbnailUrl}}}]),e}();h(G,"Type",{VOD:"Vod",LIVE:"Live",IMAGE:"Image",AUDIO:"Audio",UNKNOWN:"Unknown",DOCUMENT:"Document"}),h(G,"DvrStatus",{ON:1,OFF:0});var J=function(){function e(t,n,s){r(this,e),this.licenseUrl=t,this.scheme=n,s&&(this.certificate=s)}return a(e,[{key:"toJSON",value:function(){var e={licenseUrl:this.licenseUrl,scheme:this.scheme};return this.certificate&&(e.certificate=this.certificate),e}}]),e}(),X=function(){function e(){r(this,e)}return a(e,[{key:"toJSON",value:function(){var e={id:this.id,url:this.url,mimetype:this.mimetype};return this.bandwidth&&(e.bandwidth=this.bandwidth),this.width&&(e.width=this.width),this.height&&(e.height=this.height),this.label&&(e.label=this.label),this.drmData&&this.drmData.length>0&&(e.drmData=[],this.drmData.forEach((function(t){Array.isArray(e.drmData)&&e.drmData.push(t.toJSON())}))),e}}]),e}(),Q=a((function e(){r(this,e),this.items=[]})),z=a((function e(t){r(this,e),this.url=t.url,this.clickThroughUrl=t.clickThroughUrl})),Z=h(h(h({},q.Type.MEDIA,h(h({},U.Type.TRAILER,(function(){return{type:G.Type.VOD}})),U.Type.PLAYBACK,(function(e){return"KalturaLiveAsset"===e.objectType?{type:G.Type.LIVE,dvrStatus:e.enableTrickPlay?G.DvrStatus.ON:G.DvrStatus.OFF}:parseInt(e.externalIds)>0?{type:G.Type.LIVE,dvrStatus:G.DvrStatus.OFF}:{type:G.Type.VOD}}))),q.Type.EPG,h(h({},U.Type.CATCHUP,(function(){return{type:G.Type.VOD}})),U.Type.START_OVER,(function(){return{type:G.Type.LIVE,dvrStatus:G.DvrStatus.ON}}))),q.Type.RECORDING,h({},U.Type.PLAYBACK,(function(){return{type:G.Type.VOD}}))),$=function(){function e(){r(this,e)}return a(e,null,[{key:"getMediaEntry",value:function(t,r){var n=new G;e._fillBaseData(n,t,r);var s=t.playBackContextResult,i=t.mediaDataResult,a=s.sources,o=e._filterSourcesByFormats(a,r.formats);n.sources=e._getParsedSources(o);var u=e._getMediaType(i.data,r.mediaType,r.contextType);return n.type=u.type,n.dvrStatus=u.dvrStatus,n.duration=Math.max.apply(Math,a.map((function(e){return e.duration}))),n}},{key:"getEntryList",value:function(t,r){var n=new Q;return t.playlistItems.entries.forEach((function(t){var s=new G,i=r.find((function(e){return e.entryId===t.mediaDataResult.id}));e._fillBaseData(s,t,i),n.items.push(s)})),n}},{key:"getBumper",value:function(e){var t=e.playBackContextResult.plugins.find((function(e){return e.streamertype===B.StreamerType.PROGRESSIVE}));if(t)return new z(t)}},{key:"_fillBaseData",value:function(t,r,n){var s=r.mediaDataResult,i=e.reconstructMetadata(s);return i.description=s.description,i.name=s.name,s.createDate&&(i.createdAt=s.createDate),s.endDate&&(i.endDate=s.endDate),s.data.entryId&&(i.entryId=s.data.entryId),s.data.epgId&&(i.epgId=s.data.epgId),s.data.recordingId&&(i.recordingId=s.data.recordingId),n&&n.mediaType&&(i.mediaType=n.mediaType),n&&n.contextType&&(i.contextType=n.contextType),t.metadata=i,t.poster=e._getPoster(s.pictures),t.id=s.id,t}},{key:"reconstructMetadata",value:function(t){return{metas:e.addToMetaObject(t.metas),tags:e.addToMetaObject(t.tags)}}},{key:"addToMetaObject",value:function(e){var t={};return e&&e.forEach((function(e){t[e.key]=e.value})),t}},{key:"_getPoster",value:function(e){if(e&&e.length>0){var t=e[0].url;return/.*\/thumbnail\/.*(?:width|height)\/\d+\/(?:height|width)\/\d+/.test(t)?t:e.map((function(e){return{url:e.url,width:e.width,height:e.height}}))}return""}},{key:"_getMediaType",value:function(e,t,r){var n={type:G.Type.UNKNOWN};return Z[t]&&Z[t][r]&&(n=Z[t][r](e)),n}},{key:"_filterSourcesByFormats",value:function(e,t){return t.length>0&&(e=e.filter((function(e){return t.includes(e.type)}))),e}},{key:"_getParsedSources",value:function(t){var r=new W,n=function(t){var n=e._parseAdaptiveSource(t);if(n){var s=F.get(t.format);r.map(n,s)}};return t&&t.length>0&&(t.filter((function(e){return!Y(e.format)})).forEach(n),t.filter((function(e){return Y(e.format)})).forEach(n)),r}},{key:"_parseAdaptiveSource",value:function(t){var r=new X;if(t){var n=t.url,s=F.get(t.format);if(s&&(r.mimetype=s.mimeType),!n)return e._logger.error("failed to create play url from source, discarding source: (".concat(t.fileId,"), ").concat(t.format,".")),null;if(r.url=n,r.id=t.fileId+","+t.format,t.hasDrmData()){var i=[];t.drm.forEach((function(e){i.push(new J(e.licenseURL,j.Scheme[e.scheme],e.certificate))})),r.drmData=i}}return r}},{key:"hasBlockAction",value:function(e){return e.playBackContextResult.hasBlockAction()}},{key:"getBlockAction",value:function(e){return e.playBackContextResult.getBlockAction()}},{key:"getErrorMessages",value:function(e){return e.playBackContextResult.getErrorMessages()}}]),e}();h($,"_logger",m("OTTProviderParser"));var ee=function(e){u(i,e);var t,n,s=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=l(t);if(n){var s=l(this).constructor;e=Reflect.construct(r,arguments,s)}else e=r.apply(this,arguments);return f(this,e)});function i(e,t){var n;return r(this,i),(n=s.call(this,e,t))._logger=m("OTTProvider"),T.set(e.env),n._networkRetryConfig=Object.assign(n._networkRetryConfig,e.networkRetryParameters),n}return a(i,[{key:"env",get:function(){return T.get()}},{key:"getMediaConfig",value:function(e){var t=this;return e.ks&&(this.ks=e.ks,this._isAnonymous=!1),this._dataLoader=new P(this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var s=e.entryId;if(s){var i=t.ks;i||(i="{1:result:ks}",t._dataLoader.add(b,{partnerId:t.partnerId}));var a=e.contextType||U.Type.PLAYBACK,o=e.mediaType||q.Type.MEDIA,u=e.assetReferenceType||q.AssetReferenceType.MEDIA,c={mediaProtocol:e.protocol,assetFileIds:e.fileIds,context:a};e.streamerType&&(c.streamerType=e.streamerType),e.urlType&&(c.urlType=e.urlType),e.adapterData&&(c.adapterData=e.adapterData),t._dataLoader.add(V,{entryId:s,ks:i,type:o,playbackContext:c,assetReferenceType:u});var f={contextType:a,mediaType:o,formats:e.formats||[]};return t._dataLoader.fetchData().then((function(e){try{r(t._parseDataFromResponse(e,f))}catch(e){n(e)}}),(function(e){n(e)}))}n(new g(g.Severity.CRITICAL,g.Category.PROVIDER,g.Code.MISSING_MANDATORY_PARAMS,{message:"missing entry id"}))}))}},{key:"_parseDataFromResponse",value:function(e,t){this._logger.debug("Data parsing started");var r={session:{isAnonymous:this._isAnonymous,partnerId:this.partnerId},sources:this._getDefaultSourcesObject(),plugins:{}};if(this.uiConfId&&(r.session.uiConfId=this.uiConfId),e){if(e.has(b.id)){var n=e.get(b.id);n&&n.response&&(r.session.ks=n.response)}else r.session.ks=this.ks;if(e.has(V.id)){var s=e.get(V.id);if(s&&s.response&&Object.keys(s.response).length){var i=s.response;if($.hasBlockAction(i))throw new g(g.Severity.CRITICAL,g.Category.SERVICE,g.Code.BLOCK_ACTION,{action:$.getBlockAction(i),messages:$.getErrorMessages(i)});var a=$.getMediaEntry(i,t);Object.assign(r.sources,this._getSourcesObject(a)),this._verifyHasSources(r.sources);var o=$.getBumper(i);o&&Object.assign(r.plugins,{bumper:o})}}}return this._logger.debug("Data parsing finished",r),r}},{key:"getEntryListConfig",value:function(e){var t=this;return e.ks&&(this.ks=e.ks,this._isAnonymous=!1),this._dataLoader=new P(this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var s=e.entries;if(s&&s.length){var i=t.ks;i||(i="{1:result:ks}",t._dataLoader.add(b,{partnerId:t.partnerId})),t._dataLoader.add(H,{entries:s,ks:i}),t._dataLoader.fetchData(!1).then((function(e){r(t._parseEntryListDataFromResponse(e,s))}),(function(e){n(e)}))}else n({success:!1,data:"Missing mandatory parameter"})}))}},{key:"_parseEntryListDataFromResponse",value:function(e,t){var r=this;this._logger.debug("Data parsing started");var n={id:"",metadata:{name:"",description:""},poster:"",items:[],playlistLastEntryId:""};if(e&&e.has(H.id)){var s=e.get(H.id);s&&s.response&&$.getEntryList(s.response,t).items.forEach((function(e){return n.items.push({sources:r._getSourcesObject(e)})}))}return this._logger.debug("Data parsing finished",n),n}},{key:"_getDefaultSourcesObject",value:function(){return{hls:[],dash:[],progressive:[],image:[],document:[],id:"",duration:0,type:G.Type.UNKNOWN,poster:"",dvr:!1,vr:null,metadata:{name:"",description:"",tags:""}}}},{key:"_getSourcesObject",value:function(e){var t=this._getDefaultSourcesObject(),r=e.sources.toJSON();return t.hls=r.hls,t.dash=r.dash,t.progressive=r.progressive,t.id=e.id,t.duration=e.duration,t.type=e.type,t.dvr=!!e.dvrStatus,t.poster=e.poster,e.metadata&&e.metadata.metas&&"string"==typeof e.metadata.metas.tags&&e.metadata.metas.tags.indexOf("360")>-1&&(t.vr={}),Object.assign(t.metadata,e.metadata),t}}]),i}(v),te="@playkit-js/playkit-js-providers-ott",re="2.41.4-canary.0-d258629",ne=U.Type,se=q.Type;return t}()}));
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,(function(){return function(){"use strict";var e={d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function s(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,"string");if("object"!==n(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===n(t)?t:String(t)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,s(n.key),n)}}function a(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(e,t){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},o(e,t)}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&o(e,t)}function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return c(e)}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function h(e,t,r){return(t=s(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}e.r(t),e.d(t,{ContextType:function(){return ne},MediaType:function(){return se},NAME:function(){return te},Provider:function(){return ee},VERSION:function(){return re}});var p={get:function(){return{VERSION:"",DEBUG:{value:"",name:""},ERROR:{value:"",name:""},INFO:{value:"",name:""},OFF:{value:"",name:""},TIME:{value:"",name:""},TRACE:{value:"",name:""},WARN:{value:"",name:""},createDefaultHandler:function(){},debug:function(){},enabledFor:function(){},error:function(){},get:function(){},getLevel:function(){},info:function(){},log:function(){},setHandler:function(){},setLevel:function(){},time:function(){},timeEnd:function(){},trace:function(){},useDefaults:function(){},warn:function(){}}}},d={};function y(e){return p.get(e)}var m=y,g=a((function e(t,n,s){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r(this,e),this.severity=t,this.category=n,this.code=s,this.data=i,e._logger.error("Category:".concat(n," | Code:").concat(s," |"),i)}));h(g,"Severity",{RECOVERABLE:1,CRITICAL:2}),h(g,"Category",{NETWORK:1,SERVICE:2,PROVIDER:3}),h(g,"Code",{UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,BAD_SERVER_RESPONSE:1005,MULTIREQUEST_API_ERROR:1006,API_RESPONSE_MISMATCH:1007,ERROR:2e3,BLOCK_ACTION:2001,MEDIA_STATUS_NOT_READY:2002,SCHEDULED_RESTRICTED:2003,MISSING_MANDATORY_PARAMS:3e3,MISSING_PLAY_SOURCE:3001,METHOD_NOT_IMPLEMENTED:3002}),h(g,"_logger",m("Error"));var v=function(){function e(t,n){r(this,e),h(this,"_networkRetryConfig",{async:!0,timeout:0,maxAttempts:4}),function(e){e&&"function"==typeof e.getLogger&&(p.get=e.getLogger),e&&e.LogLevel&&(d=e.LogLevel)}(t.logger),this._partnerId=t.partnerId,this._widgetId=t.widgetId,this._uiConfId=t.uiConfId,this._isAnonymous=!t.ks,this._ks=t.ks||"",this._playerVersion=n,this._referrer=t.referrer}return a(e,[{key:"partnerId",get:function(){return this._partnerId}},{key:"widgetId",get:function(){return this._widgetId||this.defaultWidgetId}},{key:"defaultWidgetId",get:function(){return"_"+this._partnerId}},{key:"uiConfId",get:function(){return this._uiConfId}},{key:"ks",get:function(){return this._ks},set:function(e){this._ks=e}},{key:"playerVersion",get:function(){return this._playerVersion}},{key:"isAnonymous",get:function(){return this._isAnonymous}},{key:"getMediaConfig",value:function(e){return Promise.reject(new g(g.Severity.CRITICAL,g.Category.PROVIDER,g.Code.METHOD_NOT_IMPLEMENTED,{message:"getMediaConfig method must be implement by the derived class"}))}},{key:"getPlaylistConfig",value:function(e){return Promise.reject(new g(g.Severity.CRITICAL,g.Category.PROVIDER,g.Code.METHOD_NOT_IMPLEMENTED,{message:"The provider does not support loading playlist by id"}))}},{key:"getEntryListConfig",value:function(e){return Promise.reject(new g(g.Severity.CRITICAL,g.Category.PROVIDER,g.Code.METHOD_NOT_IMPLEMENTED,{message:"The provider does not support loading entry list"}))}},{key:"_verifyHasSources",value:function(e){if(0===e.hls.concat(e.dash,e.progressive,e.image,e.document).length)throw new g(g.Severity.CRITICAL,g.Category.SERVICE,g.Code.MISSING_PLAY_SOURCE,{action:"",messages:"No play source for entry id: ".concat(e.id)})}},{key:"LogLevel",get:function(){return d}},{key:"getLogLevel",value:function(e){return function(e){return y(e).getLevel()}(e)}},{key:"setLogLevel",value:function(e,t){!function(e,t){y(t).setLevel(e)}(e,t)}}]),e}(),R=function e(t){var r;return Array.isArray(t)?(r=t.length>0?t.slice(0):[]).forEach((function(t,s){("object"===n(t)||Array.isArray(t)&&t.length>0)&&(r[s]=e(t))})):"object"===n(t)?(r=Object.assign({},t),Object.keys(r).forEach((function(t){("object"===n(r[t])||Array.isArray(r[t])&&r[t].length>0)&&(r[t]=e(r[t]))}))):r=t,r},_={serviceParams:{apiVersion:"7.8.1"}},T=function(){function e(){r(this,e)}return a(e,null,[{key:"set",value:function(e){e&&Object.assign(_,e)}},{key:"get",value:function(){return R(_)}}]),e}(),E=function(){function e(t){r(this,e),h(this,"_loadersResponseMap",new Map),h(this,"_loaders",new Map),this._networkRetryConfig=t}return a(e,[{key:"add",value:function(e,t,r){var n=this,s=new e(t);if(s.isValid()){this._loaders.set(e.id,s);var i=this._multiRequest.requests.length,a=s.requests;this._multiRequest.retryConfig=this._networkRetryConfig,a.forEach((function(e){e.params=e.params||{},e.params.ks=e.params.ks||r,n._multiRequest.add(e)}));var o=Array.from(new Array(a.length),(function(e,t){return t+i}));this._loadersResponseMap.set(e.id,o)}}},{key:"fetchData",value:function(e){var t=this;return new Promise((function(r,n){t._multiRequest.execute(e).then((function(e){t._multiResponse=e.response,t.prepareData(e.response).success?r(t._loaders):n(new g(g.Severity.CRITICAL,g.Category.NETWORK,g.Code.API_RESPONSE_MISMATCH,{headers:e.headers}))}),(function(e){n(e)}))}))}},{key:"prepareData",value:function(e){var t=this;return this._loaders.forEach((function(r,n){var s=t._loadersResponseMap.get(n);try{s&&s.length>0&&(r.response=e.results.slice(s[0],s[s.length-1]+1))}catch(e){return{success:!1,error:e}}})),{success:!0,data:this._loaders}}}]),e}(),O=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Map;r(this,e),h(this,"retryConfig",{async:!0,timeout:0,maxAttempts:4}),h(this,"_attemptCounter",1),this.headers=t}return a(e,[{key:"getUrl",value:function(e){return e+"/service/"+this.service+(this.action?"/action/"+this.action:"")}},{key:"doHttpRequest",value:function(){var e=this,t=new Promise((function(t,r){e._requestPromise={resolve:t,reject:r}}));return this.url||this._requestPromise.reject(new g(g.Severity.CRITICAL,g.Category.NETWORK,g.Code.MALFORMED_DATA_URI,{url:this.url})),this._createXHR(),t}},{key:"_createXHR",value:function(){var e=this,t=new XMLHttpRequest;t.onreadystatechange=function(){if(4===t.readyState&&200===t.status)try{var r=JSON.parse(t.responseText);return e.responseHeaders=e._getResponseHeaders(t),e._requestPromise.resolve(r)}catch(r){e._requestPromise.reject(e._createError(t,g.Code.BAD_SERVER_RESPONSE,{text:t.responseText}))}},t.open(this.method,this.url,this.retryConfig.async),this.retryConfig.async&&this.retryConfig.timeout&&(t.timeout=this.retryConfig.timeout);var r=performance.now();t.ontimeout=function(){e._handleError(t,g.Code.TIMEOUT,{timeout:(performance.now()-r)/1e3,statusText:t.statusText})},t.onerror=t.onabort=function(){e._handleError(t,g.Code.HTTP_ERROR,{text:t.responseText,statusText:t.statusText})},this.headers.forEach((function(e,r){t.setRequestHeader(r,e)})),t.send(this.params)}},{key:"_getResponseHeaders",value:function(e){return e.getAllResponseHeaders().split("\n").filter((function(e){return 0===e.toLowerCase().indexOf("x-")}))}},{key:"_handleError",value:function(e,t,r){var n=this._createError(e,t,r);if(e.onreadystatechange=function(){},e.onerror=function(){},e.ontimeout=function(){},e.onabort=function(){},!(this.retryConfig.maxAttempts&&this._attemptCounter<this.retryConfig.maxAttempts))return this._requestPromise.reject(n);this._attemptCounter++,this._createXHR()}},{key:"_createError",value:function(e,t,r){return Object.assign(r,{url:this.url,headers:this._getResponseHeaders(e),attempt:this._attemptCounter}),new g(g.Severity.CRITICAL,g.Category.NETWORK,t,r)}}]),e}(),I=a((function e(t){r(this,e),h(this,"hasError",!1),"KalturaAPIException"===t.objectType?(this.hasError=!0,this.error=new k(t.code,t.message)):t.error&&"KalturaAPIException"===t.error.objectType?(this.hasError=!0,this.error=new k(t.error.code,t.error.message)):this.data=t})),k=a((function e(t,n){r(this,e),this.code=t,this.message=n}));var A=function(e){u(i,e);var t,n,s=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=l(t);if(n){var s=l(this).constructor;e=Reflect.construct(r,arguments,s)}else e=r.apply(this,arguments);return f(this,e)});function i(){var e;r(this,i);for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];return h(c(e=s.call.apply(s,[this].concat(n))),"requests",[]),e}return a(i,[{key:"add",value:function(e){this.requests.push(e);var t={},r={service:e.service,action:e.action};return Object.assign(t,h({},this.requests.length,Object.assign(r,e.params))),Object.assign(t,this.params),this.params=t,this}},{key:"execute",value:function(e){var t=this;return new Promise((function(r,n){try{t.params=JSON.stringify(t.params)}catch(e){i._logger.error("".concat(e.message)),n(new g(g.Severity.CRITICAL,g.Category.PROVIDER,g.Code.FAILED_PARSING_REQUEST,{error:e,params:t.params}))}t.doHttpRequest().then((function(s){var i=new C(s,e);i.success?r({headers:t.responseHeaders,response:i}):n(new g(g.Severity.CRITICAL,g.Category.NETWORK,g.Code.MULTIREQUEST_API_ERROR,{url:t.url,headers:t.responseHeaders,results:i.results}))}),(function(e){n(e)}))}))}}]),i}(O);h(A,"_logger",m("MultiRequestBuilder"));var C=a((function e(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];r(this,e),h(this,"results",[]);var s=t.result?t.result:t,i=(Array.isArray(s)?s:[s]).map((function(e){return new I(e)})),a=i.filter((function(e){return e.hasError}));a.forEach((function(t){e._logger.error("Service returned an error with error code: ".concat(t.error.code," and message: ").concat(t.error.message,"."))})),this.results=i,n&&a.length||a.length===this.results.length?this.success=!1:(this.results=this.results.filter((function(e){return!e.hasError})),this.success=!0)}));h(C,"_logger",m("MultiRequestResult"));var S=function(){function e(){r(this,e)}return a(e,null,[{key:"getMultiRequest",value:function(e,t){var r=T.get(),n=r.serviceParams;e&&Object.assign(n,{ks:e}),t&&Object.assign(n,{partnerId:t});var s=new Map;s.set("Content-Type","application/json");var i=new A(s);return i.method="POST",i.service="multirequest",i.url=i.getUrl(r.serviceUrl),i.params=n,i}}]),e}();var P=function(e){u(i,e);var t,n,s=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=l(t);if(n){var s=l(this).constructor;e=Reflect.construct(r,arguments,s)}else e=r.apply(this,arguments);return f(this,e)});function i(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",a=arguments.length>2?arguments[2]:void 0;return r(this,i),(t=s.call(this,a))._multiRequest=S.getMultiRequest(n,e),t}return a(i)}(E);var D=function(e){u(i,e);var t,n,s=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=l(t);if(n){var s=l(this).constructor;e=Reflect.construct(r,arguments,s)}else e=r.apply(this,arguments);return f(this,e)});function i(){return r(this,i),s.apply(this,arguments)}return a(i,null,[{key:"anonymousLogin",value:function(e,t,r){var n=new Map;n.set("Content-Type","application/json");var s=new O(n);s.service="ottuser",s.action="anonymousLogin",s.method="POST",s.url=s.getUrl(e);var i={partnerId:t};return r&&Object.assign(i,{udid:r}),s.params=i,s}}]),i}(S),b=function(){function e(t){r(this,e),h(this,"_response",{}),this.requests=this.buildRequests(t),this._partnerId=t.partnerId}return a(e,[{key:"requests",get:function(){return this._requests},set:function(e){this._requests=e}},{key:"response",get:function(){return this._response.ks},set:function(e){this._response.ks=e[0].data.ks}},{key:"buildRequests",value:function(e){var t=T.get(),r=[];return r.push(D.anonymousLogin(t.serviceUrl,e.partnerId,e.udid)),r}},{key:"isValid",value:function(){return!!this._partnerId}}],[{key:"id",get:function(){return"session"}}]),e}();var w="asset",L=function(e){u(i,e);var t,n,s=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=l(t);if(n){var s=l(this).constructor;e=Reflect.construct(r,arguments,s)}else e=r.apply(this,arguments);return f(this,e)});function i(){return r(this,i),s.apply(this,arguments)}return a(i,null,[{key:"getPlaybackContext",value:function(e,t,r,n,s){var i=new Map;i.set("Content-Type","application/json");var a=new O(i);a.service=w,a.action="getPlaybackContext",a.method="POST",a.url=a.getUrl(e);var o={objectType:"KalturaPlaybackContextOptions"};return Object.assign(o,s),a.params={assetId:r,assetType:n,contextDataParams:o,ks:t},a}},{key:"get",value:function(e,t,r,n){var s=new Map;s.set("Content-Type","application/json");var i=new O(s);return i.service=w,i.action="get",i.method="POST",i.url=i.getUrl(e),i.params={id:r,assetReferenceType:n,ks:t},i}}]),i}(S),M=a((function e(t){r(this,e),this.message=t.message,this.code=t.code})),N=a((function e(t){r(this,e),this.type=t.type}));h(N,"Type",{BLOCK:"BLOCK",START_DATE_OFFSET:"START_DATE_OFFSET",END_DATE_OFFSET:"END_DATE_OFFSET",USER_BLOCK:"USER_BLOCK",ALLOW_PLAYBACK:"ALLOW_PLAYBACK",BLOCK_PLAYBACK:"BLOCK_PLAYBACK",APPLY_DISCOUNT_MODULE:"APPLY_DISCOUNT_MODULE"});var j=a((function e(t){r(this,e),this.scheme=t.scheme,this.licenseURL=t.licenseURL,this.certificate=t.certificate}));h(j,"Scheme",{"drm.PLAYREADY_CENC":"com.microsoft.playready","drm.WIDEVINE_CENC":"com.widevine.alpha","fairplay.FAIRPLAY":"com.apple.fairplay",WIDEVINE_CENC:"com.widevine.alpha",PLAYREADY_CENC:"com.microsoft.playready",FAIRPLAY:"com.apple.fairplay"});var x=function(){function e(t){var n=this;r(this,e),h(this,"drm",[]),this.format=t.format,this.adsPolicy=t.adsPolicy,this.adsParam=t.adsParam,this.duration=t.duration,this.url=t.url,this.type=t.type,this.fileId=t.id,this.protocols=t.protocols,t.drm&&t.drm.map((function(e){return n.drm.push(new j(e))}))}return a(e,[{key:"hasDrmData",value:function(){return this.drm&&this.drm.length>0}},{key:"getProtocol",value:function(e){var t="";if(this.protocols&&this.protocols.length>0)this.protocols.split(",").forEach((function(r){r===e&&(t=r)}));else if("http"===e)return e;return t}}]),e}(),B=a((function e(t){r(this,e),this.streamertype=t.streamertype,this.url=t.url}));h(B,"StreamerType",{HLS:"hls",DASH:"dash",PROGRESSIVE:"progressive"});var U=function(e){u(i,e);var t,n,s=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=l(t);if(n){var s=l(this).constructor;e=Reflect.construct(r,arguments,s)}else e=r.apply(this,arguments);return f(this,e)});function i(e){var t;if(r(this,i),h(c(t=s.call(this,e)),"sources",[]),h(c(t),"actions",[]),h(c(t),"messages",[]),h(c(t),"plugins",[]),!t.hasError){var n=e.messages;n&&n.map((function(e){return t.messages.push(new M(e))}));var a=e.actions;a&&a.map((function(e){return t.actions.push(new N(e))}));var o=e.sources;o&&o.map((function(e){return t.sources.push(new x(e))}));var u=e.plugins;u&&u.map((function(e){return t.plugins.push(new B(e))}))}return t}return a(i,[{key:"hasBlockAction",value:function(){return void 0!==this.getBlockAction()}},{key:"getBlockAction",value:function(){return this.actions.find((function(e){return e.type===N.Type.BLOCK}))}},{key:"getErrorMessages",value:function(){return this.messages}}]),i}(I);h(U,"Type",{DOWNLOAD:"DOWNLOAD",TRAILER:"TRAILER",CATCHUP:"CATCHUP",START_OVER:"START_OVER",PLAYBACK:"PLAYBACK"});var q=function(e){u(i,e);var t,n,s=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=l(t);if(n){var s=l(this).constructor;e=Reflect.construct(r,arguments,s)}else e=r.apply(this,arguments);return f(this,e)});function i(e){var t;return r(this,i),h(c(t=s.call(this,e)),"name",""),h(c(t),"description",""),h(c(t),"tags",[]),h(c(t),"metas",[]),h(c(t),"pictures",[]),t.hasError||(t.id=e.id,t.name=e.name,t.description=e.description,t.createDate=e.createDate,t.endDate=e.endDate,t.plays=e.plays,t.views=e.views,t.metas=t._formatTagsMetas(e.metas),t.tags=t._formatTagsMetas(e.tags),t.pictures=e.images),t}return a(i,[{key:"_formatTagsMetas",value:function(e){var t=[];return Object.keys(e).forEach((function(r){if(e[r].objects){var n="";e[r].objects.forEach((function(e){n+=e.value+"|"})),t.push({key:r,value:n})}else t.push({key:r,value:e[r].value})})),t}}]),i}(I);h(q,"Type",{MEDIA:"media",RECORDING:"recording",EPG:"epg"}),h(q,"AssetReferenceType",{MEDIA:"media",EPG_INTERNAL:"epg_internal",EPG_EXTERNAL:"epg_external",NPVR:"nPVR"});var V=function(){function e(t){r(this,e),h(this,"_response",{}),this.requests=this.buildRequests(t),this._entryId=t.entryId}return a(e,[{key:"requests",get:function(){return this._requests},set:function(e){this._requests=e}},{key:"response",get:function(){return this._response},set:function(e){this._response.mediaDataResult=new q(e[0].data),this._response.playBackContextResult=new U(e[1].data)}},{key:"buildRequests",value:function(e){var t=T.get(),r=[];return r.push(L.get(t.serviceUrl,e.ks,e.entryId,e.assetReferenceType)),r.push(L.getPlaybackContext(t.serviceUrl,e.ks,e.entryId,e.type,e.playbackContext)),r}},{key:"isValid",value:function(){return!!this._entryId}}],[{key:"id",get:function(){return"asset"}}]),e}(),H=function(){function e(t){r(this,e),h(this,"_response",{playlistItems:{entries:[]}}),this.requests=this.buildRequests(t),this._entries=t.entries}return a(e,[{key:"requests",get:function(){return this._requests},set:function(e){this._requests=e}},{key:"response",get:function(){return this._response},set:function(e){var t=this;e.forEach((function(e){t._response.playlistItems.entries.push({mediaDataResult:new q(e.data)})}))}},{key:"buildRequests",value:function(e){var t=T.get(),r=[];return e.entries.forEach((function(n){var s=n.assetReferenceType||q.AssetReferenceType.MEDIA;r.push(L.get(t.serviceUrl,e.ks,n.entryId||n,s))})),r}},{key:"isValid",value:function(){return!(!this._entries||!this._entries.length)}}],[{key:"id",get:function(){return"asset_list"}}]),e}(),K={DASH:{name:"dash",mimeType:"application/dash+xml",pathExt:"mpd"},HLS:{name:"hls",mimeType:"application/x-mpegURL",pathExt:"m3u8"},WVM:{name:"wvm",mimeType:"video/wvm",pathExt:"wvm"},MP4:{name:"mp4",mimeType:"video/mp4",pathExt:"mp4"},MP3:{name:"mp3",mimeType:"audio/mpeg",pathExt:"mp3"}},F=new Map([["mpegdash",K.DASH],["applehttp",K.HLS],["url",K.MP4]]);function Y(e){var t=F.get(e);return!!t&&t.name===K.MP4.name}var W=function(){function e(){r(this,e),this.progressive=[],this.dash=[],this.hls=[],this.image=[],this.document=[]}return a(e,[{key:"map",value:function(e,t){if(t)switch(t.name){case K.MP4.name:this.progressive.push(e);break;case K.DASH.name:this.dash.push(e);break;case K.HLS.name:this.hls.push(e)}}},{key:"toJSON",value:function(){var e={progressive:[],dash:[],hls:[],image:[],document:[]};return this.progressive.forEach((function(t){return e.progressive.push(t.toJSON())})),this.hls.forEach((function(t){return e.hls.push(t.toJSON())})),this.dash.forEach((function(t){return e.dash.push(t.toJSON())})),e.image=this.image,e.document=this.document,e}}]),e}(),G=function(){function e(){r(this,e),this.metadata=new Map,this.sources=new W,this.type=e.Type.UNKNOWN}return a(e,[{key:"toJSON",value:function(){return{id:this.id,name:this.name,sources:this.sources.toJSON(),duration:this.duration,dvrStatus:this.dvrStatus,status:this.status,metadata:this.metadata,type:this.type,poster:this.poster,assetReferenceType:this.assetReferenceType,downloadUrl:this.downloadUrl,rawThumbnailUrl:this.rawThumbnailUrl}}}]),e}();h(G,"Type",{VOD:"Vod",LIVE:"Live",IMAGE:"Image",AUDIO:"Audio",UNKNOWN:"Unknown",DOCUMENT:"Document"}),h(G,"DvrStatus",{ON:1,OFF:0});var J=function(){function e(t,n,s){r(this,e),this.licenseUrl=t,this.scheme=n,s&&(this.certificate=s)}return a(e,[{key:"toJSON",value:function(){var e={licenseUrl:this.licenseUrl,scheme:this.scheme};return this.certificate&&(e.certificate=this.certificate),e}}]),e}(),X=function(){function e(){r(this,e)}return a(e,[{key:"toJSON",value:function(){var e={id:this.id,url:this.url,mimetype:this.mimetype};return this.bandwidth&&(e.bandwidth=this.bandwidth),this.width&&(e.width=this.width),this.height&&(e.height=this.height),this.label&&(e.label=this.label),this.drmData&&this.drmData.length>0&&(e.drmData=[],this.drmData.forEach((function(t){Array.isArray(e.drmData)&&e.drmData.push(t.toJSON())}))),e}}]),e}(),Q=a((function e(){r(this,e),this.items=[]})),z=a((function e(t){r(this,e),this.url=t.url,this.clickThroughUrl=t.clickThroughUrl})),Z=h(h(h({},q.Type.MEDIA,h(h({},U.Type.TRAILER,(function(){return{type:G.Type.VOD}})),U.Type.PLAYBACK,(function(e){return"KalturaLiveAsset"===e.objectType?{type:G.Type.LIVE,dvrStatus:e.enableTrickPlay?G.DvrStatus.ON:G.DvrStatus.OFF}:parseInt(e.externalIds)>0?{type:G.Type.LIVE,dvrStatus:G.DvrStatus.OFF}:{type:G.Type.VOD}}))),q.Type.EPG,h(h({},U.Type.CATCHUP,(function(){return{type:G.Type.VOD}})),U.Type.START_OVER,(function(){return{type:G.Type.LIVE,dvrStatus:G.DvrStatus.ON}}))),q.Type.RECORDING,h({},U.Type.PLAYBACK,(function(){return{type:G.Type.VOD}}))),$=function(){function e(){r(this,e)}return a(e,null,[{key:"getMediaEntry",value:function(t,r){var n=new G;e._fillBaseData(n,t,r);var s=t.playBackContextResult,i=t.mediaDataResult,a=s.sources,o=e._filterSourcesByFormats(a,r.formats);n.sources=e._getParsedSources(o);var u=e._getMediaType(i.data,r.mediaType,r.contextType);return n.type=u.type,n.dvrStatus=u.dvrStatus,n.duration=Math.max.apply(Math,a.map((function(e){return e.duration}))),n}},{key:"getEntryList",value:function(t,r){var n=new Q;return t.playlistItems.entries.forEach((function(t){var s=new G,i=r.find((function(e){return e.entryId===t.mediaDataResult.id}));e._fillBaseData(s,t,i),n.items.push(s)})),n}},{key:"getBumper",value:function(e){var t=e.playBackContextResult.plugins.find((function(e){return e.streamertype===B.StreamerType.PROGRESSIVE}));if(t)return new z(t)}},{key:"_fillBaseData",value:function(t,r,n){var s=r.mediaDataResult,i=e.reconstructMetadata(s);return i.description=s.description,i.name=s.name,s.createDate&&(i.createdAt=s.createDate),s.endDate&&(i.endDate=s.endDate),s.data.entryId&&(i.entryId=s.data.entryId),s.data.epgId&&(i.epgId=s.data.epgId),s.data.recordingId&&(i.recordingId=s.data.recordingId),n&&n.mediaType&&(i.mediaType=n.mediaType),n&&n.contextType&&(i.contextType=n.contextType),t.metadata=i,t.poster=e._getPoster(s.pictures),t.id=s.id,t}},{key:"reconstructMetadata",value:function(t){return{metas:e.addToMetaObject(t.metas),tags:e.addToMetaObject(t.tags)}}},{key:"addToMetaObject",value:function(e){var t={};return e&&e.forEach((function(e){t[e.key]=e.value})),t}},{key:"_getPoster",value:function(e){if(e&&e.length>0){var t=e[0].url;return/.*\/thumbnail\/.*(?:width|height)\/\d+\/(?:height|width)\/\d+/.test(t)?t:e.map((function(e){return{url:e.url,width:e.width,height:e.height}}))}return""}},{key:"_getMediaType",value:function(e,t,r){var n={type:G.Type.UNKNOWN};return Z[t]&&Z[t][r]&&(n=Z[t][r](e)),n}},{key:"_filterSourcesByFormats",value:function(e,t){return t.length>0&&(e=e.filter((function(e){return t.includes(e.type)}))),e}},{key:"_getParsedSources",value:function(t){var r=new W,n=function(t){var n=e._parseAdaptiveSource(t);if(n){var s=F.get(t.format);r.map(n,s)}};return t&&t.length>0&&(t.filter((function(e){return!Y(e.format)})).forEach(n),t.filter((function(e){return Y(e.format)})).forEach(n)),r}},{key:"_parseAdaptiveSource",value:function(t){var r=new X;if(t){var n=t.url,s=F.get(t.format);if(s&&(r.mimetype=s.mimeType),!n)return e._logger.error("failed to create play url from source, discarding source: (".concat(t.fileId,"), ").concat(t.format,".")),null;if(r.url=n,r.id=t.fileId+","+t.format,t.hasDrmData()){var i=[];t.drm.forEach((function(e){i.push(new J(e.licenseURL,j.Scheme[e.scheme],e.certificate))})),r.drmData=i}}return r}},{key:"hasBlockAction",value:function(e){return e.playBackContextResult.hasBlockAction()}},{key:"getBlockAction",value:function(e){return e.playBackContextResult.getBlockAction()}},{key:"getErrorMessages",value:function(e){return e.playBackContextResult.getErrorMessages()}}]),e}();h($,"_logger",m("OTTProviderParser"));var ee=function(e){u(i,e);var t,n,s=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=l(t);if(n){var s=l(this).constructor;e=Reflect.construct(r,arguments,s)}else e=r.apply(this,arguments);return f(this,e)});function i(e,t){var n;return r(this,i),(n=s.call(this,e,t))._logger=m("OTTProvider"),T.set(e.env),n._networkRetryConfig=Object.assign(n._networkRetryConfig,e.networkRetryParameters),n}return a(i,[{key:"env",get:function(){return T.get()}},{key:"getMediaConfig",value:function(e){var t=this;return e.ks&&(this.ks=e.ks,this._isAnonymous=!1),this._dataLoader=new P(this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var s=e.entryId;if(s){var i=t.ks;i||(i="{1:result:ks}",t._dataLoader.add(b,{partnerId:t.partnerId}));var a=e.contextType||U.Type.PLAYBACK,o=e.mediaType||q.Type.MEDIA,u=e.assetReferenceType||q.AssetReferenceType.MEDIA,c={mediaProtocol:e.protocol,assetFileIds:e.fileIds,context:a};e.streamerType&&(c.streamerType=e.streamerType),e.urlType&&(c.urlType=e.urlType),e.adapterData&&(c.adapterData=e.adapterData),t._dataLoader.add(V,{entryId:s,ks:i,type:o,playbackContext:c,assetReferenceType:u});var f={contextType:a,mediaType:o,formats:e.formats||[]};return t._dataLoader.fetchData().then((function(e){try{r(t._parseDataFromResponse(e,f))}catch(e){n(e)}}),(function(e){n(e)}))}n(new g(g.Severity.CRITICAL,g.Category.PROVIDER,g.Code.MISSING_MANDATORY_PARAMS,{message:"missing entry id"}))}))}},{key:"_parseDataFromResponse",value:function(e,t){this._logger.debug("Data parsing started");var r={session:{isAnonymous:this._isAnonymous,partnerId:this.partnerId},sources:this._getDefaultSourcesObject(),plugins:{}};if(this.uiConfId&&(r.session.uiConfId=this.uiConfId),e){if(e.has(b.id)){var n=e.get(b.id);n&&n.response&&(r.session.ks=n.response)}else r.session.ks=this.ks;if(e.has(V.id)){var s=e.get(V.id);if(s&&s.response&&Object.keys(s.response).length){var i=s.response;if($.hasBlockAction(i))throw new g(g.Severity.CRITICAL,g.Category.SERVICE,g.Code.BLOCK_ACTION,{action:$.getBlockAction(i),messages:$.getErrorMessages(i)});var a=$.getMediaEntry(i,t);Object.assign(r.sources,this._getSourcesObject(a)),this._verifyHasSources(r.sources);var o=$.getBumper(i);o&&Object.assign(r.plugins,{bumper:o})}}}return this._logger.debug("Data parsing finished",r),r}},{key:"getEntryListConfig",value:function(e){var t=this;return e.ks&&(this.ks=e.ks,this._isAnonymous=!1),this._dataLoader=new P(this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var s=e.entries;if(s&&s.length){var i=t.ks;i||(i="{1:result:ks}",t._dataLoader.add(b,{partnerId:t.partnerId})),t._dataLoader.add(H,{entries:s,ks:i}),t._dataLoader.fetchData(!1).then((function(e){r(t._parseEntryListDataFromResponse(e,s))}),(function(e){n(e)}))}else n({success:!1,data:"Missing mandatory parameter"})}))}},{key:"_parseEntryListDataFromResponse",value:function(e,t){var r=this;this._logger.debug("Data parsing started");var n={id:"",metadata:{name:"",description:""},poster:"",items:[],playlistLastEntryId:""};if(e&&e.has(H.id)){var s=e.get(H.id);s&&s.response&&$.getEntryList(s.response,t).items.forEach((function(e){return n.items.push({sources:r._getSourcesObject(e)})}))}return this._logger.debug("Data parsing finished",n),n}},{key:"_getDefaultSourcesObject",value:function(){return{hls:[],dash:[],progressive:[],image:[],document:[],id:"",duration:0,type:G.Type.UNKNOWN,poster:"",dvr:!1,vr:null,metadata:{name:"",description:"",tags:""}}}},{key:"_getSourcesObject",value:function(e){var t=this._getDefaultSourcesObject(),r=e.sources.toJSON();return t.hls=r.hls,t.dash=r.dash,t.progressive=r.progressive,t.id=e.id,t.duration=e.duration,t.type=e.type,t.dvr=!!e.dvrStatus,t.poster=e.poster,e.metadata&&e.metadata.metas&&"string"==typeof e.metadata.metas.tags&&e.metadata.metas.tags.indexOf("360")>-1&&(t.vr={}),Object.assign(t.metadata,e.metadata),t}}]),i}(v),te="@playkit-js/playkit-js-providers-ott",re="2.42.0-canary.0-07d09a7",ne=U.Type,se=q.Type;return t}()}));
2
2
  //# sourceMappingURL=playkit-ott-provider.js.map
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see playkit-ovp-provider.js.LICENSE.txt */
2
- !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r=e();for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(self,(function(){return function(){var t={61:function(t,e,r){var n=r(698).default;function i(){"use strict";t.exports=i=function(){return r},t.exports.__esModule=!0,t.exports.default=t.exports;var e,r={},a=Object.prototype,o=a.hasOwnProperty,s=Object.defineProperty||function(t,e,r){t[e]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",f=u.toStringTag||"@@toStringTag";function d(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{d({},"")}catch(e){d=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var i=e&&e.prototype instanceof _?e:_,a=Object.create(i.prototype),o=new L(n||[]);return s(a,"_invoke",{value:b(t,r,o)}),a}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}r.wrap=h;var y="suspendedStart",v="suspendedYield",m="executing",g="completed",E={};function _(){}function R(){}function I(){}var T={};d(T,c,(function(){return this}));var w=Object.getPrototypeOf,A=w&&w(w(x([])));A&&A!==a&&o.call(A,c)&&(T=A);var C=I.prototype=_.prototype=Object.create(T);function O(t){["next","throw","return"].forEach((function(e){d(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,e){function r(i,a,s,u){var c=p(t[i],t,a);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==n(f)&&o.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,s,u)}),(function(t){r("throw",t,s,u)})):e.resolve(f).then((function(t){l.value=t,s(l)}),(function(t){return r("throw",t,s,u)}))}u(c.arg)}var i;s(this,"_invoke",{value:function(t,n){function a(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(a,a):a()}})}function b(t,r,n){var i=y;return function(a,o){if(i===m)throw new Error("Generator is already running");if(i===g){if("throw"===a)throw o;return{value:e,done:!0}}for(n.method=a,n.arg=o;;){var s=n.delegate;if(s){var u=S(s,n);if(u){if(u===E)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===y)throw i=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=m;var c=p(t,r,n);if("normal"===c.type){if(i=n.done?g:v,c.arg===E)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=g,n.method="throw",n.arg=c.arg)}}}function S(t,r){var n=r.method,i=t.iterator[n];if(i===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,S(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),E;var a=p(i,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,E;var o=a.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,E):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,E)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function D(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function x(t){if(t||""===t){var r=t[c];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,a=function r(){for(;++i<t.length;)if(o.call(t,i))return r.value=t[i],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(n(t)+" is not iterable")}return R.prototype=I,s(C,"constructor",{value:I,configurable:!0}),s(I,"constructor",{value:R,configurable:!0}),R.displayName=d(I,f,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===R||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,I):(t.__proto__=I,d(t,f,"GeneratorFunction")),t.prototype=Object.create(C),t},r.awrap=function(t){return{__await:t}},O(k.prototype),d(k.prototype,l,(function(){return this})),r.AsyncIterator=k,r.async=function(t,e,n,i,a){void 0===a&&(a=Promise);var o=new k(h(t,e,n,i),a);return r.isGeneratorFunction(e)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},O(C),d(C,f,"Generator"),d(C,c,(function(){return this})),d(C,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=x,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(D),!t)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,i){return s.type="throw",s.arg=t,r.next=n,i&&(r.method="next",r.arg=e),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),c=o.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,E):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),E},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),D(r),E}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;D(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:x(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),E}},r}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports},698:function(t){function e(r){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},687:function(t,e,r){var n=r(61)();t.exports=n;try{regeneratorRuntime=n}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var a=e[n]={exports:{}};return t[n](a,a.exports,r),a.exports}r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,{a:e}),e},r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return function(){"use strict";r.r(n),r.d(n,{NAME:function(){return xt},Provider:function(){return Lt},ProviderParser:function(){return ut},RequestBuilder:function(){return lt},ResponseTypes:function(){return t},VERSION:function(){return Mt}});var t={};function e(t,e,r,n,i,a,o){try{var s=t[a](o),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,i)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function o(t){var e=function(t,e){if("object"!==a(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===a(e)?e:String(e)}function s(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,o(n.key),n)}}function u(t,e,r){return e&&s(t.prototype,e),r&&s(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function c(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function l(t,e){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},l(t,e)}function f(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e)}function d(t,e){if(e&&("object"===a(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return c(t)}function h(t){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},h(t)}function p(t,e,r){return(e=o(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}r.r(t),r.d(t,{BaseServiceResult:function(){return w},KalturaAccessControlMessage:function(){return N},KalturaAccessControlModifyRequestHostRegexAction:function(){return b},KalturaBaseEntryListResponse:function(){return O},KalturaBumper:function(){return D},KalturaDrmPlaybackPluginData:function(){return S},KalturaFlavorAsset:function(){return L},KalturaMediaEntries:function(){return x},KalturaMediaEntry:function(){return C},KalturaMetadata:function(){return M},KalturaMetadataListResponse:function(){return U},KalturaPlaybackContext:function(){return j},KalturaPlaybackSource:function(){return P},KalturaPlaylist:function(){return B},KalturaRuleAction:function(){return k},KalturaUIConfResponse:function(){return V},KalturaUserEntry:function(){return F},KalturaUserEntryListResponse:function(){return q}});var y=r(687),v=r.n(y),m={get:function(){return{VERSION:"",DEBUG:{value:"",name:""},ERROR:{value:"",name:""},INFO:{value:"",name:""},OFF:{value:"",name:""},TIME:{value:"",name:""},TRACE:{value:"",name:""},WARN:{value:"",name:""},createDefaultHandler:function(){},debug:function(){},enabledFor:function(){},error:function(){},get:function(){},getLevel:function(){},info:function(){},log:function(){},setHandler:function(){},setLevel:function(){},time:function(){},timeEnd:function(){},trace:function(){},useDefaults:function(){},warn:function(){}}}},g={};function E(t){return m.get(t)}var _=E,R=function t(e){var r;return Array.isArray(e)?(r=e.length>0?e.slice(0):[]).forEach((function(e,n){("object"===a(e)||Array.isArray(e)&&e.length>0)&&(r[n]=t(e))})):"object"===a(e)?(r=Object.assign({},e),Object.keys(r).forEach((function(e){("object"===a(r[e])||Array.isArray(r[e])&&r[e].length>0)&&(r[e]=t(r[e]))}))):r=e,r},I={serviceUrl:"https://cdnapisec.kaltura.com/api_v3",cdnUrl:"https://cdnapisec.kaltura.com",serviceParams:{apiVersion:"3.3.0",format:1},useApiCaptions:!0,loadThumbnailWithKs:!1,replaceHostOnlyManifestUrls:!1},T=function(){function t(){i(this,t)}return u(t,null,[{key:"set",value:function(t){null!=t&&t.overrideServiceUrl&&(t.serviceUrl=t.overrideServiceUrl),t&&Object.assign(I,t)}},{key:"get",value:function(){return R(I)}},{key:"serviceUrl",get:function(){return I.serviceUrl}}]),t}(),w=u((function t(e){i(this,t),p(this,"hasError",!1),"KalturaAPIException"===e.objectType?(this.hasError=!0,this.error=new A(e.code,e.message)):e.error&&"KalturaAPIException"===e.error.objectType?(this.hasError=!0,this.error=new A(e.error.code,e.error.message)):this.data=e})),A=u((function t(e,r){i(this,t),this.code=e,this.message=r})),C=u((function t(e){i(this,t),this.id=e.id,this.referenceId=e.referenceId,this.externalSourceType=e.externalSourceType,this.name=e.name,this.description=e.description,this.dataUrl=e.dataUrl,this.type=e.type,this.entryType=e.mediaType,this.flavorParamsIds=e.flavorParamsIds,this.duration=e.duration,this.poster=e.thumbnailUrl,this.rawThumbnailUrl=e.thumbnailUrl,this.status=e.status,this.dvrStatus=e.dvrStatus,this.tags=e.tags,this.createdAt=e.createdAt,this.updatedAt=e.updatedAt,this.creatorId=e.creatorId,this.endDate=e.endDate,this.plays=e.plays,this.views=e.views,this.downloadUrl=e.downloadUrl}));p(C,"EntryType",{AUTOMATIC:{value:-1},EXTERNAL_MEDIA:{value:"externalMedia.externalMedia"},MEDIA_CLIP:{value:1},MIX:{value:2},PLAYLIST:{value:5},DATA:{value:6},LIVE_STREAM:{value:7},LIVE_CHANNEL:{value:8},DOCUMENT:{value:10}}),p(C,"MediaType",{VIDEO:{value:1},IMAGE:{value:2},AUDIO:{value:5},LIVE_STREAM_FLASH:{value:201},LIVE_STREAM_WINDOWS_MEDIA:{value:202},LIVE_STREAM_REAL_MEDIA:{value:203},LIVE_STREAM_QUICK_TIME:{value:204}}),p(C,"EntryStatus",{ERROR_IMPORTING:-2,ERROR_CONVERTING:-1,SCAN_FAILURE:"virusScan.ScanFailure",IMPORT:0,INFECTED:"virusScan.Infected",PRECONVERT:1,READY:2,DELETED:3,PENDING:4,MODERATE:5,BLOCKED:6,NO_CONTENT:7}),p(C,"EntryModerationStatus",{PENDING_MODERATION:1,APPROVED:2,REJECTED:3,FLAGGED_FOR_REVIEW:4,MODERATE:5,AUTO_APPROVED:6});var O=function(t){f(a,t);var e,r,n=(e=a,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=h(e);if(r){var i=h(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return d(this,t)});function a(t){var e;return i(this,a),(e=n.call(this,t)).hasError||(e.totalCount=t.totalCount,e.totalCount>0&&(e.entries=[],t.objects.map((function(t){return e.entries.push(new C(t))})))),e}return u(a)}(w),k=u((function t(e){i(this,t),this.type=e.type}));p(k,"Type",{DRM_POLICY:"drm.DRM_POLICY",BLOCK:1,PREVIEW:2,LIMIT_FLAVORS:3,ADD_TO_STORAGE:4,LIMIT_DELIVERY_PROFILES:5,SERVE_FROM_REMOTE_SERVER:6,REQUEST_HOST_REGEX:7,LIMIT_THUMBNAIL_CAPTURE:8,SCHEDULED_RESTRICTED:"SCHEDULED_RESTRICTED"});var b=function(t){f(a,t);var e,r,n=(e=a,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=h(e);if(r){var i=h(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return d(this,t)});function a(t){var e;return i(this,a),(e=n.call(this,t)).pattern=t.pattern,e.replacement=t.replacement,e.replacmenServerNodeId=t.replacmenServerNodeId,e.checkAliveTimeoutMs=t.checkAliveTimeoutMs,e}return u(a)}(k),S=u((function t(e){i(this,t),this.scheme=e.scheme,this.licenseURL=e.licenseURL,this.certificate=e.certificate}));p(S,"Scheme",{"drm.PLAYREADY_CENC":"com.microsoft.playready","drm.WIDEVINE_CENC":"com.widevine.alpha","fairplay.FAIRPLAY":"com.apple.fairplay",WIDEVINE_CENC:"com.widevine.alpha",PLAYREADY_CENC:"com.microsoft.playready",FAIRPLAY:"com.apple.fairplay"});var P=function(){function t(e){var r=this;i(this,t),p(this,"drm",[]),this.format=e.format,this.deliveryProfileId=e.deliveryProfileId,this.url=e.url,this.protocols=e.protocols,this.flavorIds=e.flavorIds,e.drm&&e.drm.map((function(t){return r.drm.push(new S(t))}))}return u(t,[{key:"hasDrmData",value:function(){return this.drm&&this.drm.length>0}},{key:"hasFlavorIds",value:function(){return!!this.flavorIds&&this.flavorIds.length>0}},{key:"getProtocol",value:function(t){var e="";if(this.protocols&&this.protocols.length>0)this.protocols.split(",").forEach((function(r){r===t&&(e=r)}));else if("http"===t)return t;return e}}]),t}(),D=u((function t(e){i(this,t),this.entryId=e.entryId,this.clickThroughUrl=e.url,this.sources=e.sources?e.sources.map((function(t){return new P(t)})):[]})),L=function(){function t(e){i(this,t),this.id=e.id,this.flavorParamsId=e.flavorParamsId,this.fileExt=e.fileExt,this.bitrate=e.bitrate,this.width=e.width,this.height=e.height,this.id=e.id,this.frameRate=e.frameRate,this.isOriginal=e.isOriginal,this.isWeb=e.isWeb,this.containerFormat=e.containerFormat,this.videoCodecId=e.videoCodecId,this.status=e.status,this.language=e.language,this.label=e.label,this.tags=t.parseTags(e.tags)}return u(t,null,[{key:"parseTags",value:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(",")}}]),t}();p(L,"Status",{ERROR:-1,QUEUED:0,CONVERTING:1,READY:2,DELETED:3,NOT_APPLICABLE:4,TEMP:5,WAIT_FOR_CONVERT:6,IMPORTING:7,VALIDATING:8,EXPORTING:9});var x=function(t){f(a,t);var e,r,n=(e=a,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=h(e);if(r){var i=h(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return d(this,t)});function a(t){var e;return i(this,a),(e=n.call(this,t)).hasError||(e.entries=[],t.map((function(t){return e.entries.push(new C(t))}))),e}return u(a)}(w),M=u((function t(e){i(this,t),this.id=e.id,this.metadataProfileId=e.metadataProfileId,this.metadataProfileVersion=e.metadataProfileVersion,this.metadataProfileId=e.metadataProfileId,this.metadataObjectType=e.metadataObjectType,this.objectId=e.objectId,this.version=e.version,this.created=new Date(0),this.created.setUTCSeconds(e.createdAt),this.updated=new Date(0),this.updated.setUTCSeconds(e.updatedAt),this.status=e.status,this.xml=e.xml}));p(M,"ObjectType",{AD_CUE_POINT:"adCuePointMetadata.AdCuePoint",ANNOTATION:"annotationMetadata.Annotation",CODE_CUE_POINT:"codeCuePointMetadata.CodeCuePoint",THUMB_CUE_POINT:"thumbCuePointMetadata.thumbCuePoint",ENTRY:1,CATEGORY:2,USER:3,PARTNER:4,DYNAMIC_OBJECT:5}),p(M,"Status",{VALID:1,INVALID:2,DELETED:3});var U=function(t){f(a,t);var e,r,n=(e=a,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=h(e);if(r){var i=h(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return d(this,t)});function a(t){var e;return i(this,a),(e=n.call(this,t)).hasError||(e.totalCount=t.totalCount,e.totalCount>0&&(e.metas=[],t.objects.map((function(t){return e.metas.push(new M(t))})))),e}return u(a)}(w),N=u((function t(e){i(this,t),this.message=e.message,this.code=e.code}));var j=function(t){f(a,t);var e,r,n=(e=a,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=h(e);if(r){var i=h(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return d(this,t)});function a(t){var e;if(i(this,a),p(c(e=n.call(this,t)),"sources",[]),p(c(e),"actions",[]),p(c(e),"messages",[]),p(c(e),"flavorAssets",[]),p(c(e),"bumperData",[]),!e.hasError){var r=t.messages;r&&r.map((function(t){return e.messages.push(new N(t))}));var o=t.actions;o&&o.map((function(t){t.type===k.Type.REQUEST_HOST_REGEX?e.actions.push(new b(t)):e.actions.push(new k(t))}));var s=t.sources;s&&s.map((function(t){return e.sources.push(new P(t))}));var u=t.flavorAssets;u&&u.map((function(t){return e.flavorAssets.push(new L(t))}));var l=t.bumperData;l&&l.map((function(t){return e.bumperData.push(new D(t))}))}return e}return u(a,[{key:"hasBlockAction",value:function(){return void 0!==this.getBlockAction()}},{key:"getBlockAction",value:function(){return this.actions.find((function(t){return t.type===k.Type.BLOCK}))}},{key:"hasScheduledRestriction",value:function(){return this.messages.some((function(t){return t.code===k.Type.SCHEDULED_RESTRICTED}))}},{key:"getErrorMessages",value:function(){return this.messages}},{key:"getRequestHostRegexAction",value:function(){var t=this.actions.find((function(t){return t.type===k.Type.REQUEST_HOST_REGEX}));if(t instanceof b)return t}}]),a}(w),B=u((function t(e){i(this,t),this.id=e.id,this.name=e.name,this.description=e.description,this.poster=e.thumbnailUrl}));var V=function(t){f(a,t);var e,r,n=(e=a,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=h(e);if(r){var i=h(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return d(this,t)});function a(t){var e;return i(this,a),(e=n.call(this,t)).hasError||(e.name=t.name,e.description=t.description,e.objTypeAsString=t.objTypeAsString,e.width=t.width,e.height=t.height,e.htmlParams=t.htmlParams,e.swfUrl=t.swfUrl,e.confFilePath=t.confFilePath,e.confFile=t.confFile,e.confFileFeatures=t.confFileFeatures,e.config=t.config,e.confVars=t.confVars,e.useCdn=t.useCdn,e.tags=t.tags,e.swfUrlVersion=t.swfUrlVersion,e.created=new Date(0),e.created.setUTCSeconds(t.createdAt),e.updated=new Date(0),e.updated.setUTCSeconds(t.updatedAt),e.html5Url=t.description,e.version=t.description,e.partnerTags=t.description,e.objType=t.description,e.creationMode=t.description),e}return u(a)}(w);p(V,"Type",{PLAYER:1,CONTRIBUTION_WIZARD:2,SIMPLE_EDITOR:3,ADVANCED_EDITOR:4,PLAYLIST:5,APP_STUDIO:6,KRECORD:7,PLAYER_V3:8,KMC_ACCOUNT:9,KMC_ANALYTICS:10,KMC_CONTENT:11,KMC_DASHBOARD:12,KMC_LOGIN:13,PLAYER_SL:14,CLIENTSIDE_ENCODER:15,KMC_GENERAL:16,KMC_ROLES_AND_PERMISSIONS:17,CLIPPER:18,KSR:19,KUPLOAD:20,WEBCASTING:21}),p(V,"CreationMode",{WIZARD:2,ADVANCED:3});var F=u((function t(e){i(this,t),this.playlistLastEntryId=e.playlistLastEntryId,this.entryId=e.entryId,this.id=e.id,this.userId=e.userId,this.partnerId=e.partnerId,this.status=e.status,this.createdAt=e.createdAt,this.updatedAt=e.updatedAt}));var q=function(t){f(a,t);var e,r,n=(e=a,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=h(e);if(r){var i=h(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return d(this,t)});function a(t){var e;return i(this,a),(e=n.call(this,t)).hasError||(e.totalCount=t.totalCount,e.entries=[],e.totalCount>0&&t.objects.map((function(t){return e.entries.push(new F(t))}))),e}return u(a)}(w),H=function(){function t(){i(this,t)}return u(t,null,[{key:"build",value:function(t){var e=T.get(),r=e.serviceUrl.substr(0,e.serviceUrl.lastIndexOf("/")),n=t.partnerId,i=t.entryId,a=t.ks,o=t.uiConfId,s=t.format,u=t.protocol,c=t.extension,l=t.flavorIds;if(!r||isNaN(Number.parseInt(n))||!i||!s||!u)return"";var f=r;return r.endsWith("/")||(f+="/"),f+="p/"+n+"/sp/"+n+"00/playManifest/entryId/"+i+"/protocol/"+u+"/format/"+s,l?f+="/flavorIds/"+l:o&&(f+="/uiConfId/"+o),""!==a&&(f+="/ks/"+a),""!==c&&(f+="/a."+c),o&&""!==l&&(f+="?uiConfId="+o),f}}]),t}(),K=function(){function t(){i(this,t)}return u(t,null,[{key:"xmlToJson",value:function(t){var e={};if(1===t.nodeType){if(t.attributes.length>0){e["@attributes"]={};for(var r=0;r<t.attributes.length;r++){var n=t.attributes.item(r);e["@attributes"][n.nodeName]=n.nodeValue}}}else 3===t.nodeType&&(e=t.nodeValue);if(t.hasChildNodes())for(var i=0;i<t.childNodes.length;i++){var a=t.childNodes.item(i),o=a.nodeName;if(void 0===e[o])e[o]=this.xmlToJson(a);else{if(void 0===e[o].push){var s=e[o];e[o]=[],e[o].push(s)}e[o].push(this.xmlToJson(a))}}return e}}]),t}(),G={DASH:{name:"dash",mimeType:"application/dash+xml",pathExt:"mpd"},HLS:{name:"hls",mimeType:"application/x-mpegURL",pathExt:"m3u8"},WVM:{name:"wvm",mimeType:"video/wvm",pathExt:"wvm"},MP4:{name:"mp4",mimeType:"video/mp4",pathExt:"mp4"},MP3:{name:"mp3",mimeType:"audio/mpeg",pathExt:"mp3"}},W=new Map([["mpegdash",G.DASH],["applehttp",G.HLS],["url",G.MP4]]);function Y(t){var e=W.get(t);return!!e&&e.name===G.MP4.name}var J=function(){function t(){i(this,t),this.progressive=[],this.dash=[],this.hls=[],this.image=[],this.document=[]}return u(t,[{key:"map",value:function(t,e){if(e)switch(e.name){case G.MP4.name:this.progressive.push(t);break;case G.DASH.name:this.dash.push(t);break;case G.HLS.name:this.hls.push(t)}}},{key:"toJSON",value:function(){var t={progressive:[],dash:[],hls:[],image:[],document:[]};return this.progressive.forEach((function(e){return t.progressive.push(e.toJSON())})),this.hls.forEach((function(e){return t.hls.push(e.toJSON())})),this.dash.forEach((function(e){return t.dash.push(e.toJSON())})),t.image=this.image,t.document=this.document,t}}]),t}(),X=function(){function t(){i(this,t),this.metadata=new Map,this.sources=new J,this.type=t.Type.UNKNOWN}return u(t,[{key:"toJSON",value:function(){return{id:this.id,name:this.name,sources:this.sources.toJSON(),duration:this.duration,dvrStatus:this.dvrStatus,status:this.status,metadata:this.metadata,type:this.type,poster:this.poster,assetReferenceType:this.assetReferenceType,downloadUrl:this.downloadUrl,rawThumbnailUrl:this.rawThumbnailUrl}}}]),t}();p(X,"Type",{VOD:"Vod",LIVE:"Live",IMAGE:"Image",AUDIO:"Audio",UNKNOWN:"Unknown",DOCUMENT:"Document"}),p(X,"DvrStatus",{ON:1,OFF:0});var Q=function(){function t(e,r,n){i(this,t),this.licenseUrl=e,this.scheme=r,n&&(this.certificate=n)}return u(t,[{key:"toJSON",value:function(){var t={licenseUrl:this.licenseUrl,scheme:this.scheme};return this.certificate&&(t.certificate=this.certificate),t}}]),t}(),z=function(){function t(){i(this,t)}return u(t,[{key:"toJSON",value:function(){var t={id:this.id,url:this.url,mimetype:this.mimetype};return this.bandwidth&&(t.bandwidth=this.bandwidth),this.width&&(t.width=this.width),this.height&&(t.height=this.height),this.label&&(t.label=this.label),this.drmData&&this.drmData.length>0&&(t.drmData=[],this.drmData.forEach((function(e){Array.isArray(t.drmData)&&t.drmData.push(e.toJSON())}))),t}}]),t}(),Z=u((function t(){i(this,t),this.items=[]})),$=u((function t(){i(this,t),this.items=[]})),tt=u((function t(e){i(this,t),this.url=e.url,this.clickThroughUrl=e.clickThroughUrl})),et={SRT:"1",DFXP:"2",WEBVTT:"3",CAP:"4"},rt={3:"vtt",1:"srt"},nt=function(){function t(){i(this,t)}return u(t,null,[{key:"createConfig",value:function(t,e){return t.map((function(t){var r=t.url,n=rt[t.format];return[et.DFXP,et.CAP].includes(t.format)&&(r=t.webVttUrl,n=rt[et.WEBVTT]),r=st(r,e),{default:!!t.isDefault,type:n,language:t.languageCode,label:t.label,url:r}}))}}]),t}(),it=function(){function t(e){i(this,t),this.id=e.id,this.url=t.extractBaseThumbnailUrl(e.dataUrl),this.mimetype=""}return u(t,null,[{key:"extractBaseThumbnailUrl",value:function(t){return t.match(".+entry_id/[a-zA-Z0-9_]+/")[0].slice(0,-1)}}]),t}(),at=u((function t(e){i(this,t),this.id=e.id,this.url=e.downloadUrl,this.thumbnailUrl=e.poster,this.mimetype=""})),ot=function(){function t(){i(this,t)}return u(t,null,[{key:"getMediaEntry",value:function(e,r,n,i){var a=new X,o=i.entry,s=i.playBackContextResult,u=i.metadataListResult,c=s.sources;return a.sources=t._getParsedSources(c,e,r,n,o,s),t._fillBaseData(a,o,u,s),a.type!==X.Type.LIVE&&T.get().useApiCaptions&&s.data.playbackCaptions&&(a.sources.captions=nt.createConfig(s.data.playbackCaptions,e)),a}},{key:"addKsToUrl",value:function(t,e){var r;return e?(r=-1!==t.split("?")[0].replace(/^.*[\\/]/,"").indexOf(".")?-1===t.indexOf("?")?"?ks=":"&ks=":"/ks/",t+r+e):t}},{key:"getPlaylist",value:function(e){var r=new Z,n=e.playlistData,i=e.playlistItems.entries,a=e.playlistUserEntries.entries;return r.id=n.id,r.name=n.name,r.description=n.description,r.poster=n.poster,r.playlistLastEntryId=a.map((function(t){return t.playlistLastEntryId}))[0],i.forEach((function(e){var n=new X;t._fillBaseData(n,e),r.items.push(n)})),r}},{key:"getEntryList",value:function(e){var r=new $;return e.playlistItems.entries.forEach((function(e){var n=new X;t._fillBaseData(n,e),r.items.push(n)})),r}},{key:"getBumper",value:function(e,r,n){var i=e.playBackContextResult,a=i.bumperData[0];if(a){var o=(a&&a.sources).find((function(t){return Y(t.format)}));if(o){var s=t._parseProgressiveSources(o,i,r,n,0,a.entryId);if(s[0])return new tt({url:s[0].url,clickThroughUrl:a.clickThroughUrl})}}}},{key:"_fillBaseData",value:function(e,r,n,i){if(e.poster=r.poster,e.rawThumbnailUrl=r.rawThumbnailUrl,e.id=r.id,e.duration=r.duration,e.downloadUrl=r.downloadUrl||"",e.metadata=t._parseMetadata(n),e.metadata.description=r.description||"",e.metadata.entryId=r.id||"",e.metadata.name=r.name||"",r.createdAt&&(e.metadata.createdAt=r.createdAt),r.updatedAt&&(e.metadata.updatedAt=r.updatedAt),r.creatorId&&(e.metadata.creatorId=r.creatorId),r.endDate&&(e.metadata.endDate=r.endDate),r.views&&(e.metadata.views=r.views),r.plays&&(e.metadata.plays=r.plays),e.metadata.tags=r.tags||"",e.status=r.status,e.type=t._getEntryType(r.entryType,r.type),e.type===X.Type.LIVE&&(e.dvrStatus=r.dvrStatus),i&&i.flavorAssets[0]&&i.flavorAssets[0].width&&i.flavorAssets[0].height){var a=i.flavorAssets[0],o=a.height,s=a.width;e.metadata.aspectRatio=+Number(s/o).toFixed(2)}return i&&Array.isArray(i.flavorAssets)&&(e.metadata.audioFlavors=i.flavorAssets.filter((function(t){return t.bitrate&&!t.width&&!t.height}))),e}},{key:"_getEntryType",value:function(t,e){var r=X.Type.UNKNOWN;switch(t){case C.MediaType.IMAGE.value:r=X.Type.IMAGE;break;case C.MediaType.AUDIO.value:r=X.Type.AUDIO;break;default:switch(e){case C.EntryType.MEDIA_CLIP.value:r=X.Type.VOD;break;case C.EntryType.LIVE_STREAM.value:case C.EntryType.LIVE_CHANNEL.value:r=X.Type.LIVE;break;case C.EntryType.DOCUMENT.value:r=X.Type.DOCUMENT;break;default:r=X.Type.UNKNOWN}}return r}},{key:"_getParsedSources",value:function(e,r,n,i,a,o){var s,u,c=new J;return a.type===C.EntryType.EXTERNAL_MEDIA.value?((u=new z).mimetype="video/youtube",u.url=a.referenceId,u.id=a.id+"_youtube",c.progressive.push(u)):a.entryType===C.MediaType.IMAGE.value?c.image.push(new it(a)):a.type===C.EntryType.DOCUMENT.value?c.document.push(new at(a)):e&&e.length>0&&(e.filter((function(t){return!Y(t.format)})).forEach((function(e){var s=t._parseAdaptiveSource(e,o,r,n,i,a.id);if(s){var u=W.get(e.format);c.map(s,u)}})),s=e.find((function(e){return Y(e.format)&&""!==e.getProtocol(t._getBaseProtocol())})),c.progressive=t._parseProgressiveSources(s,o,r,n,i,a.id)),c}},{key:"_parseAdaptiveSource",value:function(e,r,n,i,a,o){var s=new z;if(e){var u="",c=W.get(e.format),l=e.getProtocol(t._getBaseProtocol()),f=e.deliveryProfileId,d=e.format,h="";if(c&&(h=c.pathExt,s.mimetype=c.mimeType),e.hasFlavorIds()?(!h&&r.flavorAssets&&r.flavorAssets.length>0&&(h=r.flavorAssets[0].fileExt),u=H.build({entryId:o,flavorIds:e.flavorIds,format:d,ks:n,partnerId:i,uiConfId:a,extension:h,protocol:l})):u=t.addKsToUrl(e.url,n),!u){var p="failed to create play url from source, discarding source: (".concat(o,"_").concat(f,"), ").concat(d);return t._logger.warn(p),null}if(s.url=u,s.id=o+"_"+f+","+d,e.hasDrmData()){var y=[];e.drm.forEach((function(t){y.push(new Q(t.licenseURL,S.Scheme[t.scheme],t.certificate))})),s.drmData=y}}return s}},{key:"_parseProgressiveSources",value:function(e,r,n,i,a,o){var s=[],u=[];if(e){var c=e.getProtocol(t._getBaseProtocol()),l=e.format,f=e.deliveryProfileId,d=f+","+l;r.flavorAssets.map((function(e){var r=new z;r.id=e.id+d,r.mimetype="mp3"===e.fileExt?"audio/mp3":"video/mp4",r.height=e.height,r.width=e.width,r.bandwidth=1024*e.bitrate,r.label=e.label||e.language;var h=H.build({entryId:o,flavorIds:e.id,format:l,ks:n,partnerId:i,uiConfId:a,extension:e.fileExt,protocol:c});if(""===h)return t._logger.warn("failed to create play url from source, discarding source: (".concat(o,"_").concat(f,"), ").concat(l,".")),null;r.url=h,e.height&&e.width?s.push(r):u.push(r)}))}return u.length&&!s.length?u:s}},{key:"_parseMetadata",value:function(t){var e={};return t&&t.metas&&t.metas.length>0&&t.metas.forEach((function(t){if(t.xml){var r=new DOMParser;t.xml=t.xml.replace(/\r?\n|\r/g,""),t.xml=t.xml.replace(/>\s*/g,">"),t.xml=t.xml.replace(/>\s*/g,">");var n=r.parseFromString(t.xml,"text/xml"),i=K.xmlToJson(n);Object.keys(i.metadata).forEach((function(t){e[t]=i.metadata[t]["#text"]}))}})),e}},{key:"_getBaseProtocol",value:function(){var t=T.get(),e=/^https?:/.exec(t.cdnUrl),r=e?e[0]:document.location.protocol;return"string"==typeof r?r.slice(0,-1):"https"}},{key:"hasBlockAction",value:function(t){return t.playBackContextResult.hasBlockAction()}},{key:"getBlockAction",value:function(t){return t.playBackContextResult.getBlockAction()}},{key:"hasScheduledRestriction",value:function(t){return t.playBackContextResult.hasScheduledRestriction()}},{key:"getErrorMessages",value:function(t){return t.playBackContextResult.getErrorMessages()}}]),t}();p(ot,"_logger",_("OVPProviderParser"));var st=ot.addKsToUrl,ut=ot,ct=u((function t(e,r,n){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};i(this,t),this.severity=e,this.category=r,this.code=n,this.data=a,t._logger.error("Category:".concat(r," | Code:").concat(n," |"),a)}));p(ct,"Severity",{RECOVERABLE:1,CRITICAL:2}),p(ct,"Category",{NETWORK:1,SERVICE:2,PROVIDER:3}),p(ct,"Code",{UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,BAD_SERVER_RESPONSE:1005,MULTIREQUEST_API_ERROR:1006,API_RESPONSE_MISMATCH:1007,ERROR:2e3,BLOCK_ACTION:2001,MEDIA_STATUS_NOT_READY:2002,SCHEDULED_RESTRICTED:2003,MISSING_MANDATORY_PARAMS:3e3,MISSING_PLAY_SOURCE:3001,METHOD_NOT_IMPLEMENTED:3002}),p(ct,"_logger",_("Error"));var lt=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Map;i(this,t),p(this,"retryConfig",{async:!0,timeout:0,maxAttempts:4}),p(this,"_attemptCounter",1),this.headers=e}return u(t,[{key:"getUrl",value:function(t){return t+"/service/"+this.service+(this.action?"/action/"+this.action:"")}},{key:"doHttpRequest",value:function(){var t=this,e=new Promise((function(e,r){t._requestPromise={resolve:e,reject:r}}));return this.url||this._requestPromise.reject(new ct(ct.Severity.CRITICAL,ct.Category.NETWORK,ct.Code.MALFORMED_DATA_URI,{url:this.url})),this._createXHR(),e}},{key:"_createXHR",value:function(){var t=this,e=new XMLHttpRequest;e.onreadystatechange=function(){if(4===e.readyState&&200===e.status)try{var r=JSON.parse(e.responseText);return t.responseHeaders=t._getResponseHeaders(e),t._requestPromise.resolve(r)}catch(r){t._requestPromise.reject(t._createError(e,ct.Code.BAD_SERVER_RESPONSE,{text:e.responseText}))}},e.open(this.method,this.url,this.retryConfig.async),this.retryConfig.async&&this.retryConfig.timeout&&(e.timeout=this.retryConfig.timeout);var r=performance.now();e.ontimeout=function(){t._handleError(e,ct.Code.TIMEOUT,{timeout:(performance.now()-r)/1e3,statusText:e.statusText})},e.onerror=e.onabort=function(){t._handleError(e,ct.Code.HTTP_ERROR,{text:e.responseText,statusText:e.statusText})},this.headers.forEach((function(t,r){e.setRequestHeader(r,t)})),e.send(this.params)}},{key:"_getResponseHeaders",value:function(t){return t.getAllResponseHeaders().split("\n").filter((function(t){return 0===t.toLowerCase().indexOf("x-")}))}},{key:"_handleError",value:function(t,e,r){var n=this._createError(t,e,r);if(t.onreadystatechange=function(){},t.onerror=function(){},t.ontimeout=function(){},t.onabort=function(){},!(this.retryConfig.maxAttempts&&this._attemptCounter<this.retryConfig.maxAttempts))return this._requestPromise.reject(n);this._attemptCounter++,this._createXHR()}},{key:"_createError",value:function(t,e,r){return Object.assign(r,{url:this.url,headers:this._getResponseHeaders(t),attempt:this._attemptCounter}),new ct(ct.Severity.CRITICAL,ct.Category.NETWORK,e,r)}}]),t}();var ft=function(t){f(a,t);var e,r,n=(e=a,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=h(e);if(r){var i=h(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return d(this,t)});function a(){var t;i(this,a);for(var e=arguments.length,r=new Array(e),o=0;o<e;o++)r[o]=arguments[o];return p(c(t=n.call.apply(n,[this].concat(r))),"requests",[]),t}return u(a,[{key:"add",value:function(t){this.requests.push(t);var e={},r={service:t.service,action:t.action};return Object.assign(e,p({},this.requests.length,Object.assign(r,t.params))),Object.assign(e,this.params),this.params=e,this}},{key:"execute",value:function(t){var e=this;return new Promise((function(r,n){try{e.params=JSON.stringify(e.params)}catch(t){a._logger.error("".concat(t.message)),n(new ct(ct.Severity.CRITICAL,ct.Category.PROVIDER,ct.Code.FAILED_PARSING_REQUEST,{error:t,params:e.params}))}e.doHttpRequest().then((function(i){var a=new dt(i,t);a.success?r({headers:e.responseHeaders,response:a}):n(new ct(ct.Severity.CRITICAL,ct.Category.NETWORK,ct.Code.MULTIREQUEST_API_ERROR,{url:e.url,headers:e.responseHeaders,results:a.results}))}),(function(t){n(t)}))}))}}]),a}(lt);p(ft,"_logger",_("MultiRequestBuilder"));var dt=u((function t(e){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];i(this,t),p(this,"results",[]);var n=e.result?e.result:e,a=(Array.isArray(n)?n:[n]).map((function(t){return new w(t)})),o=a.filter((function(t){return t.hasError}));o.forEach((function(e){t._logger.error("Service returned an error with error code: ".concat(e.error.code," and message: ").concat(e.error.message,"."))})),this.results=a,r&&o.length||o.length===this.results.length?this.success=!1:(this.results=this.results.filter((function(t){return!t.hasError})),this.success=!0)}));p(dt,"_logger",_("MultiRequestResult"));var ht=function(){function t(){i(this,t)}return u(t,null,[{key:"getMultiRequest",value:function(t,e,r){var n=T.get(),i=n.serviceParams;Object.assign(i,{ks:e,clientTag:"html5:v"+t}),r&&Object.assign(i,{partnerId:r});var a=new Map;a.set("Content-Type","application/json");var o=new ft(a);return o.method="POST",o.service="multirequest",o.url=o.getUrl(n.serviceUrl),o.params=i,o}}]),t}(),pt=u((function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,t),this.type=e.type||t.Type.INCLUDE_FIELDS,this.fields=e.fields||"id,referenceId,name,description,thumbnailUrl,dataUrl,duration,msDuration,flavorParamsIds,mediaType,type,tags,dvrStatus,externalSourceType,status,createdAt,updatedAt,endDate,plays,views,downloadUrl,creatorId"}));p(pt,"Type",{INCLUDE_FIELDS:1,EXCLUDE_FIELDS:2});var yt="baseEntry",vt=function(t){f(a,t);var e,r,n=(e=a,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=h(e);if(r){var i=h(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return d(this,t)});function a(){return i(this,a),n.apply(this,arguments)}return u(a,null,[{key:"getPlaybackContext",value:function(t,e,r,n){var i=new Map;i.set("Content-Type","application/json");var a=new lt(i);a.service=yt,a.action="getPlaybackContext",a.method="POST",a.url=a.getUrl(t),a.tag="baseEntry-getPlaybackContext";var o={objectType:"KalturaContextDataParams",flavorTags:"all"};return n&&(o.referrer=n),a.params={entryId:r,ks:e,contextDataParams:o},a}},{key:"list",value:function(t,e,r,n,i){var o=new Map;o.set("Content-Type","application/json");var s=new lt(o);return s.service=yt,s.action="list",s.method="POST",s.url=s.getUrl(t),s.tag="list",s.params=a.getEntryListReqParams(r,e,n,i),s}},{key:"getEntryListReqParams",value:function(t,e,r,n){var i={};return t?i=r?{redirectFromEntryId:t}:{idEqual:t}:n&&(i={objectType:"KalturaBaseEntryFilter",referenceIdEqual:n}),{ks:e,filter:i,responseProfile:new pt}}}]),a}(ht);var mt=function(t){f(a,t);var e,r,n=(e=a,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=h(e);if(r){var i=h(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return d(this,t)});function a(){return i(this,a),n.apply(this,arguments)}return u(a,null,[{key:"list",value:function(t,e,r){var n=new Map;n.set("Content-Type","application/json");var i=new lt(n);i.service="metadata_metadata",i.action="list",i.method="POST",i.url=i.getUrl(t),i.tag="metadata_metadata-list";var a={objectType:"KalturaMetadataFilter",objectIdEqual:r,metadataObjectTypeEqual:"1"};return i.params={filter:a,ks:e},i}}]),a}(ht),gt=function(){function t(e){i(this,t),p(this,"_response",{}),this.requests=this.buildRequests(e),this._entryId=e.entryId,this._referenceId=e.referenceId}return u(t,[{key:"requests",get:function(){return this._requests},set:function(t){this._requests=t}},{key:"response",get:function(){return this._response},set:function(t){var e=new O(t[0].data);this._response.entry=e.entries[0],this._response.playBackContextResult=new j(t[1].data),this._response.metadataListResult=new U(t[2].data)}},{key:"buildRequests",value:function(t){var e=T.get(),r=[];r.push(vt.list(e.serviceUrl,t.ks,t.entryId,t.redirectFromEntryId,t.referenceId));var n="{1:result:ks}"===t.ks?"{2:result:objects:0:id}":"{1:result:objects:0:id}";return r.push(vt.getPlaybackContext(e.serviceUrl,t.ks,n,t.referrer)),r.push(mt.list(e.serviceUrl,t.ks,n)),r}},{key:"isValid",value:function(){return!(!this._entryId&&!this._referenceId)}}],[{key:"id",get:function(){return"media"}}]),t}();var Et=function(t){f(a,t);var e,r,n=(e=a,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=h(e);if(r){var i=h(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return d(this,t)});function a(){return i(this,a),n.apply(this,arguments)}return u(a,null,[{key:"anonymousSession",value:function(t,e){var r=new Map;r.set("Content-Type","application/json");var n=new lt(r);return n.service="session",n.action="startWidgetSession",n.method="POST",n.url=n.getUrl(t),n.tag="session-startWidget",n.params={widgetId:e},n}}]),a}(ht),_t=function(){function t(e){i(this,t),p(this,"_response",{}),this.requests=this.buildRequests(e),this._widgetId=e.widgetId}return u(t,[{key:"requests",get:function(){return this._requests},set:function(t){this._requests=t}},{key:"response",get:function(){return this._response.ks},set:function(t){this._response.ks=t[0].data.ks}},{key:"buildRequests",value:function(t){var e=T.get(),r=[];return r.push(Et.anonymousSession(e.serviceUrl,t.widgetId)),r}},{key:"isValid",value:function(){return!!this._widgetId}}],[{key:"id",get:function(){return"session"}}]),t}();var Rt=function(t){f(a,t);var e,r,n=(e=a,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=h(e);if(r){var i=h(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return d(this,t)});function a(t,e){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",s=arguments.length>3?arguments[3]:void 0;return i(this,a),(r=n.call(this,s))._multiRequest=ht.getMultiRequest(t,o,e),r}return u(a)}(function(){function t(e){i(this,t),p(this,"_loadersResponseMap",new Map),p(this,"_loaders",new Map),this._networkRetryConfig=e}return u(t,[{key:"add",value:function(t,e,r){var n=this,i=new t(e);if(i.isValid()){this._loaders.set(t.id,i);var a=this._multiRequest.requests.length,o=i.requests;this._multiRequest.retryConfig=this._networkRetryConfig,o.forEach((function(t){t.params=t.params||{},t.params.ks=t.params.ks||r,n._multiRequest.add(t)}));var s=Array.from(new Array(o.length),(function(t,e){return e+a}));this._loadersResponseMap.set(t.id,s)}}},{key:"fetchData",value:function(t){var e=this;return new Promise((function(r,n){e._multiRequest.execute(t).then((function(t){e._multiResponse=t.response,e.prepareData(t.response).success?r(e._loaders):n(new ct(ct.Severity.CRITICAL,ct.Category.NETWORK,ct.Code.API_RESPONSE_MISMATCH,{headers:t.headers}))}),(function(t){n(t)}))}))}},{key:"prepareData",value:function(t){var e=this;return this._loaders.forEach((function(r,n){var i=e._loadersResponseMap.get(n);try{i&&i.length>0&&(r.response=t.results.slice(i[0],i[i.length-1]+1))}catch(t){return{success:!1,error:t}}})),{success:!0,data:this._loaders}}}]),t}());var It="playlist",Tt=function(t){f(a,t);var e,r,n=(e=a,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=h(e);if(r){var i=h(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return d(this,t)});function a(){return i(this,a),n.apply(this,arguments)}return u(a,null,[{key:"execute",value:function(t,e,r){var n=new Map;n.set("Content-Type","application/json");var i=new lt(n);return i.service=It,i.action="execute",i.method="POST",i.url=i.getUrl(t),i.tag="".concat(It,"-execute"),i.params={ks:e,id:r,responseProfile:new pt},i}},{key:"get",value:function(t,e,r){var n=new Map;n.set("Content-Type","application/json");var i=new lt(n);return i.service=It,i.action="get",i.method="POST",i.url=i.getUrl(t),i.tag="".concat(It,"-get"),i.params={ks:e,id:r,responseProfile:{fields:"id,name,description,thumbnailUrl",type:1}},i}},{key:"getLastEntryId",value:function(t,e,r){var n=new Map;n.set("Content-Type","application/json");var i=new lt(n);return i.service="userEntry",i.action="list",i.method="POST",i.url=i.getUrl(t),i.tag="userEntry-list",i.params={ks:e,filter:{objectType:"KalturaViewHistoryUserEntry",entryIdEqual:r,userIdEqualCurrent:1},responseProfile:{fields:"playlistLastEntryId",type:1}},i}}]),a}(ht),wt=function(){function t(e){i(this,t),p(this,"_response",{}),this.requests=this.buildRequests(e),this._playlistId=e.playlistId}return u(t,[{key:"requests",get:function(){return this._requests},set:function(t){this._requests=t}},{key:"response",get:function(){return this._response},set:function(t){this._response.playlistData=new B(t[0].data),this._response.playlistItems=new x(t[1].data),this._response.playlistUserEntries=new q(t[2].data)}},{key:"buildRequests",value:function(t){var e=T.get(),r=[];return r.push(Tt.get(e.serviceUrl,t.ks,t.playlistId)),r.push(Tt.execute(e.serviceUrl,t.ks,t.playlistId)),r.push(Tt.getLastEntryId(e.serviceUrl,t.ks,t.playlistId)),r}},{key:"isValid",value:function(){return!!this._playlistId}}],[{key:"id",get:function(){return"playlist"}}]),t}(),At=function(){function t(e,r){i(this,t),p(this,"_networkRetryConfig",{async:!0,timeout:0,maxAttempts:4}),function(t){t&&"function"==typeof t.getLogger&&(m.get=t.getLogger),t&&t.LogLevel&&(g=t.LogLevel)}(e.logger),this._partnerId=e.partnerId,this._widgetId=e.widgetId,this._uiConfId=e.uiConfId,this._isAnonymous=!e.ks,this._ks=e.ks||"",this._playerVersion=r,this._referrer=e.referrer}return u(t,[{key:"partnerId",get:function(){return this._partnerId}},{key:"widgetId",get:function(){return this._widgetId||this.defaultWidgetId}},{key:"defaultWidgetId",get:function(){return"_"+this._partnerId}},{key:"uiConfId",get:function(){return this._uiConfId}},{key:"ks",get:function(){return this._ks},set:function(t){this._ks=t}},{key:"playerVersion",get:function(){return this._playerVersion}},{key:"isAnonymous",get:function(){return this._isAnonymous}},{key:"getMediaConfig",value:function(t){return Promise.reject(new ct(ct.Severity.CRITICAL,ct.Category.PROVIDER,ct.Code.METHOD_NOT_IMPLEMENTED,{message:"getMediaConfig method must be implement by the derived class"}))}},{key:"getPlaylistConfig",value:function(t){return Promise.reject(new ct(ct.Severity.CRITICAL,ct.Category.PROVIDER,ct.Code.METHOD_NOT_IMPLEMENTED,{message:"The provider does not support loading playlist by id"}))}},{key:"getEntryListConfig",value:function(t){return Promise.reject(new ct(ct.Severity.CRITICAL,ct.Category.PROVIDER,ct.Code.METHOD_NOT_IMPLEMENTED,{message:"The provider does not support loading entry list"}))}},{key:"_verifyHasSources",value:function(t){if(0===t.hls.concat(t.dash,t.progressive,t.image,t.document).length)throw new ct(ct.Severity.CRITICAL,ct.Category.SERVICE,ct.Code.MISSING_PLAY_SOURCE,{action:"",messages:"No play source for entry id: ".concat(t.id)})}},{key:"LogLevel",get:function(){return g}},{key:"getLogLevel",value:function(t){return function(t){return E(t).getLevel()}(t)}},{key:"setLogLevel",value:function(t,e){!function(t,e){E(e).setLevel(t)}(t,e)}}]),t}(),Ct=function(){function t(e){i(this,t),p(this,"_response",{playlistItems:{entries:[]}}),this.requests=this.buildRequests(e),this._entries=e.entries}return u(t,[{key:"requests",get:function(){return this._requests},set:function(t){this._requests=t}},{key:"response",get:function(){return this._response},set:function(t){var e,r=this;t.forEach((function(t){e=new O(t.data),r._response.playlistItems.entries.push(e.entries[0])}))}},{key:"buildRequests",value:function(t){var e=T.get(),r=[];return t.entries.forEach((function(n){r.push(vt.list(e.serviceUrl,t.ks,n.entryId||n,t.redirectFromEntryId,n.referenceId))})),r}},{key:"isValid",value:function(){return!(!this._entries||!this._entries.length)}}],[{key:"id",get:function(){return"entry_list"}}]),t}();function Ot(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function kt(t){return function(t){if(Array.isArray(t))return Ot(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Ot(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ot(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var bt=function(){function t(){i(this,t)}return u(t,null,[{key:"_applyRegexAction",value:function(t,e){if(t){var r=new RegExp(t.pattern,"i");if(e.match(r))return e.replace(r,t.replacement+"/")}return e}},{key:"_pingECDNAndReplaceHostUrls",value:function(e,r,n){return new Promise((function(i){var a=n+"/api_v3/service/system/action/ping/format/1",o=new XMLHttpRequest;o.open("GET",a),o.timeout=r.checkAliveTimeoutMs,o.onreadystatechange=function(){4===o.readyState&&(200===o.status&&t._replaceHostUrls(e,r),i(e))},o.ontimeout=function(){t._logger.warn("Got timeout while pinging the ECDN url. the ping url: ".concat(a)),i(e)},o.send()}))}},{key:"handleRegexAction",value:function(e,r){return new Promise((function(n){var i=T.get().cdnUrl,a=t._extractRegexActionFromData(r),o=t._getRegExp(a);i&&a&&o&&i.match(o)?a.checkAliveTimeoutMs>0?(t._logger.debug("executing ping request..."),t._pingECDNAndReplaceHostUrls(e,a,i.replace(o,a.replacement)).then(n)):(t._replaceHostUrls(e,a),n(e)):(t._logger.debug("exiting handleRegexAction - not applying regex action."),n(e))}))}},{key:"_replaceHostUrls",value:function(e,r){t._logger.debug("Starting to modify urls...");var n=e.sources,i=n.hls,a=n.dash,o=n.progressive,s=n.image;[].concat(kt(i),kt(a),kt(o),kt(s)).forEach((function(e){return e.url=t._applyRegexAction(r,e.url)})),T.get().replaceHostOnlyManifestUrls||(t._logger.debug("replaceHostOnlyManifestUrls flag is off - modifying captions and poster URLs"),n.captions&&n.captions.forEach((function(e){return e.url=t._applyRegexAction(r,e.url)})),"string"==typeof n.poster&&(n.poster=t._applyRegexAction(r,n.poster))),t._logger.debug("Finished modifying urls")}},{key:"_extractRegexActionFromData",value:function(t){var e;return null===(e=t.get(gt.id))||void 0===e||null===(e=e.response)||void 0===e?void 0:e.playBackContextResult.getRequestHostRegexAction()}},{key:"_getRegExp",value:function(t){if(t&&t.pattern&&t.replacement)return new RegExp(t.pattern,"i")}}]),t}();p(bt,"_logger",_("RegexActionHandler"));var St=bt;var Pt=function(t){f(a,t);var e,r,n=(e=a,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=h(e);if(r){var i=h(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return d(this,t)});function a(){return i(this,a),n.apply(this,arguments)}return u(a,null,[{key:"get",value:function(t,e){var r=new Map;r.set("Content-Type","application/json");var n=new lt(r);return n.service="user",n.action="get",n.method="POST",n.url=n.getUrl(t),n.tag="user-get",n.params={ks:e,format:1},n}}]),a}(ht),Dt=function(){function t(e){i(this,t),this.id=e.id}return u(t,[{key:"isAnonymous",value:function(){return t.INVALID_IDS.includes(this.id)}}]),t}();p(Dt,"INVALID_IDS",["0","",null,void 0]);var Lt=function(t){f(l,t);var r,n,a,o,s=(a=l,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=h(a);if(o){var r=h(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return d(this,t)});function l(t,e){var r;return i(this,l),p(c(r=s.call(this,t,e)),"_filterOptionsConfig",{redirectFromEntryId:!0}),r._logger=_("OVPProvider"),T.set(t.env),r._setFilterOptionsConfig(t.filterOptions),r._vrTag=t.vrTag||"360",r._networkRetryConfig=Object.assign(r._networkRetryConfig,t.networkRetryParameters),r._isAnonymous=!r._ks||void 0,void 0===r._isAnonymous&&r.initializeUserResponse(T.serviceUrl,r._ks).then((function(){r._logger.info("User response initialized")})).catch((function(t){r._logger.error("Failed to initialize user response",t)})),r}return u(l,[{key:"env",get:function(){return T.get()}},{key:"initializeUserResponse",value:(r=v().mark((function t(e,r){var n,i,a;return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return(n=Pt.get(e,r)).params=JSON.stringify(n.params),t.next=4,n.doHttpRequest();case 4:i=t.sent,a=new Dt(i),this._isAnonymous=a.isAnonymous();case 7:case"end":return t.stop()}}),t,this)})),n=function(){var t=this,n=arguments;return new Promise((function(i,a){var o=r.apply(t,n);function s(t){e(o,i,a,s,u,"next",t)}function u(t){e(o,i,a,s,u,"throw",t)}s(void 0)}))},function(t,e){return n.apply(this,arguments)})},{key:"getMediaConfig",value:function(t){var e=this;return t.ks&&(this.ks=t.ks),this._dataLoader=new Rt(this.playerVersion,this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var i=t.entryId,a=t.referenceId;if(i||a){var o=e.ks;o||(o="{1:result:ks}",e._dataLoader.add(_t,{widgetId:e.widgetId}));var s=e._getEntryRedirectFilter(t);return e._dataLoader.add(gt,{entryId:i,ks:o,redirectFromEntryId:s,referenceId:a,referrer:e._referrer}),e._dataLoader.fetchData().then((function(t){try{var i=e._parseDataFromResponse(t);St.handleRegexAction(i,t).then(r)}catch(t){n(t)}}),(function(t){n(t)}))}n(new ct(ct.Severity.CRITICAL,ct.Category.PROVIDER,ct.Code.MISSING_MANDATORY_PARAMS,{message:"missing entry id"}))}))}},{key:"doRequest",value:function(t,e,r){var n=this,i=e||this.ks,a=new Rt(this.playerVersion,this.partnerId,i,this._networkRetryConfig);return new Promise((function(e,o){return i||a.add(_t,{widgetId:n.widgetId}),t.forEach((function(t){a.add(t.loader,t.params,i||"{1:result:ks}")})),a.fetchData(r).then((function(t){try{e(t)}catch(t){o(t)}}),(function(t){o(t)}))}))}},{key:"_getEntryRedirectFilter",value:function(t){return"boolean"==typeof t.redirectFromEntryId?t.redirectFromEntryId:"boolean"!=typeof this._filterOptionsConfig.redirectFromEntryId||this._filterOptionsConfig.redirectFromEntryId}},{key:"_setFilterOptionsConfig",value:function(t){t&&"boolean"==typeof t.redirectFromEntryId&&(this._filterOptionsConfig.redirectFromEntryId=t.redirectFromEntryId)}},{key:"_parseDataFromResponse",value:function(t){this._logger.debug("Data parsing started");var e={session:{isAnonymous:this._isAnonymous,partnerId:this.partnerId},sources:this._getDefaultSourcesObject(),plugins:{}};if(this.uiConfId&&(e.session.uiConfId=this.uiConfId),t){if(t.has(_t.id)){var r=t.get(_t.id);r&&r.response&&(e.session.ks=r.response,this.widgetId!==this.defaultWidgetId&&(this.ks=e.session.ks))}else e.session.ks=this.ks;if(t.has(gt.id)){var n=t.get(gt.id);if(n&&n.response){var i=n.response;if(ut.hasBlockAction(i))throw new ct(ct.Severity.CRITICAL,ct.Category.SERVICE,ct.Code.BLOCK_ACTION,{action:ut.getBlockAction(i),messages:ut.getErrorMessages(i)});if(ut.hasScheduledRestriction(i))throw new ct(ct.Severity.CRITICAL,ct.Category.SERVICE,ct.Code.SCHEDULED_RESTRICTED,{messages:ut.getErrorMessages(i)});var a=ut.getMediaEntry(this.ks,this.partnerId,this.uiConfId,i);Object.assign(e.sources,this._getSourcesObject(a)),this._verifyMediaStatus(a),this._verifyHasSources(e.sources);var o=ut.getBumper(i,this.ks,this.partnerId);o&&Object.assign(e.plugins,{bumper:o})}}}return this._logger.debug("Data parsing finished",e),e}},{key:"_verifyMediaStatus",value:function(t){if([C.EntryStatus.IMPORT,C.EntryStatus.PRECONVERT].includes(t.status))throw new ct(ct.Severity.CRITICAL,ct.Category.SERVICE,ct.Code.MEDIA_STATUS_NOT_READY,{messages:"Status of entry id ".concat(t.id," is ").concat(t.status," and is still being imported or converted"),data:{status:status}})}},{key:"getPlaylistConfig",value:function(t){var e=this;return t.ks&&(this.ks=t.ks),this._dataLoader=new Rt(this.playerVersion,this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var i=t.playlistId;if(i){var a=e.ks;a||(a="{1:result:ks}",e._dataLoader.add(_t,{widgetId:e.widgetId})),e._dataLoader.add(wt,{playlistId:i,ks:a}),e._dataLoader.fetchData().then((function(t){r(e._parsePlaylistDataFromResponse(t))}),(function(t){n(t)}))}else n({success:!1,data:"Missing mandatory parameter"})}))}},{key:"_parsePlaylistDataFromResponse",value:function(t){var e=this;this._logger.debug("Data parsing started");var r=this._getPlaylistObject();if(t&&t.has(wt.id)){var n=t.get(wt.id);if(n&&n.response){var i=ut.getPlaylist(n.response);r.id=i.id,r.poster=i.poster,r.metadata.name=i.name,r.metadata.description=i.description,r.playlistLastEntryId=i.playlistLastEntryId,i.items.forEach((function(t){return r.items.push({sources:e._getSourcesObject(t)})}))}}return this._logger.debug("Data parsing finished",r),r}},{key:"getEntryListConfig",value:function(t){var e=this;return t.ks&&(this.ks=t.ks),this._dataLoader=new Rt(this.playerVersion,this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var i=t.entries;if(i&&i.length){var a=e.ks;a||(a="{1:result:ks}",e._dataLoader.add(_t,{widgetId:e.widgetId}));var o=e._getEntryRedirectFilter(t);e._dataLoader.add(Ct,{entries:i,ks:a,redirectFromEntryId:o}),e._dataLoader.fetchData(!1).then((function(t){r(e._parseEntryListDataFromResponse(t))}),(function(t){n(t)}))}else n({success:!1,data:"Missing mandatory parameter"})}))}},{key:"_parseEntryListDataFromResponse",value:function(t){var e=this;this._logger.debug("Data parsing started");var r=this._getPlaylistObject();if(t&&t.has(Ct.id)){var n=t.get(Ct.id);n&&n.response&&ut.getEntryList(n.response).items.forEach((function(t){return r.items.push({sources:e._getSourcesObject(t)})}))}return this._logger.debug("Data parsing finished",r),r}},{key:"_getPlaylistObject",value:function(){return{id:"",metadata:{name:"",description:""},poster:"",playlistLastEntryId:"",items:[]}}},{key:"_getDefaultSourcesObject",value:function(){return{hls:[],dash:[],progressive:[],image:[],document:[],id:"",duration:0,type:X.Type.UNKNOWN,poster:"",rawThumbnailUrl:"",dvr:!1,vr:null,metadata:{name:"",description:"",tags:""}}}},{key:"_getSourcesObject",value:function(t){var e=this,r=this._getDefaultSourcesObject(),n=t.sources.toJSON();return r.hls=n.hls,r.dash=n.dash,r.progressive=n.progressive,r.image=n.image,r.document=n.document,r.id=t.id,r.duration=t.duration,r.type=t.type,r.dvr=!!t.dvrStatus,r.poster=t.poster,r.rawThumbnailUrl=t.rawThumbnailUrl,r.downloadUrl=t.downloadUrl,t.sources.captions&&(r.captions=t.sources.captions),t.metadata&&"string"==typeof t.metadata.tags&&t.metadata.tags.split(",").some((function(t){return t.trim()===e._vrTag}))&&(r.vr={}),Object.assign(r.metadata,t.metadata),r}}]),l}(At),xt="@playkit-js/playkit-js-providers-ovp",Mt="2.41.4-canary.0-d258629"}(),n}()}));
2
+ !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r=e();for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(self,(function(){return function(){var t={61:function(t,e,r){var n=r(698).default;function i(){"use strict";t.exports=i=function(){return r},t.exports.__esModule=!0,t.exports.default=t.exports;var e,r={},a=Object.prototype,o=a.hasOwnProperty,s=Object.defineProperty||function(t,e,r){t[e]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",f=u.toStringTag||"@@toStringTag";function d(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{d({},"")}catch(e){d=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var i=e&&e.prototype instanceof _?e:_,a=Object.create(i.prototype),o=new L(n||[]);return s(a,"_invoke",{value:b(t,r,o)}),a}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}r.wrap=h;var y="suspendedStart",v="suspendedYield",m="executing",g="completed",E={};function _(){}function R(){}function I(){}var T={};d(T,c,(function(){return this}));var w=Object.getPrototypeOf,A=w&&w(w(x([])));A&&A!==a&&o.call(A,c)&&(T=A);var C=I.prototype=_.prototype=Object.create(T);function O(t){["next","throw","return"].forEach((function(e){d(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,e){function r(i,a,s,u){var c=p(t[i],t,a);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==n(f)&&o.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,s,u)}),(function(t){r("throw",t,s,u)})):e.resolve(f).then((function(t){l.value=t,s(l)}),(function(t){return r("throw",t,s,u)}))}u(c.arg)}var i;s(this,"_invoke",{value:function(t,n){function a(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(a,a):a()}})}function b(t,r,n){var i=y;return function(a,o){if(i===m)throw new Error("Generator is already running");if(i===g){if("throw"===a)throw o;return{value:e,done:!0}}for(n.method=a,n.arg=o;;){var s=n.delegate;if(s){var u=S(s,n);if(u){if(u===E)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===y)throw i=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=m;var c=p(t,r,n);if("normal"===c.type){if(i=n.done?g:v,c.arg===E)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=g,n.method="throw",n.arg=c.arg)}}}function S(t,r){var n=r.method,i=t.iterator[n];if(i===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,S(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),E;var a=p(i,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,E;var o=a.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,E):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,E)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function D(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function x(t){if(t||""===t){var r=t[c];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,a=function r(){for(;++i<t.length;)if(o.call(t,i))return r.value=t[i],r.done=!1,r;return r.value=e,r.done=!0,r};return a.next=a}}throw new TypeError(n(t)+" is not iterable")}return R.prototype=I,s(C,"constructor",{value:I,configurable:!0}),s(I,"constructor",{value:R,configurable:!0}),R.displayName=d(I,f,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===R||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,I):(t.__proto__=I,d(t,f,"GeneratorFunction")),t.prototype=Object.create(C),t},r.awrap=function(t){return{__await:t}},O(k.prototype),d(k.prototype,l,(function(){return this})),r.AsyncIterator=k,r.async=function(t,e,n,i,a){void 0===a&&(a=Promise);var o=new k(h(t,e,n,i),a);return r.isGeneratorFunction(e)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},O(C),d(C,f,"Generator"),d(C,c,(function(){return this})),d(C,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=x,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(D),!t)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,i){return s.type="throw",s.arg=t,r.next=n,i&&(r.method="next",r.arg=e),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),c=o.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,E):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),E},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),D(r),E}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;D(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:x(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),E}},r}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports},698:function(t){function e(r){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},687:function(t,e,r){var n=r(61)();t.exports=n;try{regeneratorRuntime=n}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var a=e[n]={exports:{}};return t[n](a,a.exports,r),a.exports}r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,{a:e}),e},r.d=function(t,e){for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};return function(){"use strict";r.r(n),r.d(n,{NAME:function(){return xt},Provider:function(){return Lt},ProviderParser:function(){return ut},RequestBuilder:function(){return lt},ResponseTypes:function(){return t},VERSION:function(){return Mt}});var t={};function e(t,e,r,n,i,a,o){try{var s=t[a](o),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,i)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function o(t){var e=function(t,e){if("object"!==a(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===a(e)?e:String(e)}function s(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,o(n.key),n)}}function u(t,e,r){return e&&s(t.prototype,e),r&&s(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function c(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function l(t,e){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},l(t,e)}function f(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e)}function d(t,e){if(e&&("object"===a(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return c(t)}function h(t){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},h(t)}function p(t,e,r){return(e=o(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}r.r(t),r.d(t,{BaseServiceResult:function(){return w},KalturaAccessControlMessage:function(){return N},KalturaAccessControlModifyRequestHostRegexAction:function(){return b},KalturaBaseEntryListResponse:function(){return O},KalturaBumper:function(){return D},KalturaDrmPlaybackPluginData:function(){return S},KalturaFlavorAsset:function(){return L},KalturaMediaEntries:function(){return x},KalturaMediaEntry:function(){return C},KalturaMetadata:function(){return M},KalturaMetadataListResponse:function(){return U},KalturaPlaybackContext:function(){return j},KalturaPlaybackSource:function(){return P},KalturaPlaylist:function(){return B},KalturaRuleAction:function(){return k},KalturaUIConfResponse:function(){return V},KalturaUserEntry:function(){return F},KalturaUserEntryListResponse:function(){return q}});var y=r(687),v=r.n(y),m={get:function(){return{VERSION:"",DEBUG:{value:"",name:""},ERROR:{value:"",name:""},INFO:{value:"",name:""},OFF:{value:"",name:""},TIME:{value:"",name:""},TRACE:{value:"",name:""},WARN:{value:"",name:""},createDefaultHandler:function(){},debug:function(){},enabledFor:function(){},error:function(){},get:function(){},getLevel:function(){},info:function(){},log:function(){},setHandler:function(){},setLevel:function(){},time:function(){},timeEnd:function(){},trace:function(){},useDefaults:function(){},warn:function(){}}}},g={};function E(t){return m.get(t)}var _=E,R=function t(e){var r;return Array.isArray(e)?(r=e.length>0?e.slice(0):[]).forEach((function(e,n){("object"===a(e)||Array.isArray(e)&&e.length>0)&&(r[n]=t(e))})):"object"===a(e)?(r=Object.assign({},e),Object.keys(r).forEach((function(e){("object"===a(r[e])||Array.isArray(r[e])&&r[e].length>0)&&(r[e]=t(r[e]))}))):r=e,r},I={serviceUrl:"https://cdnapisec.kaltura.com/api_v3",cdnUrl:"https://cdnapisec.kaltura.com",serviceParams:{apiVersion:"3.3.0",format:1},useApiCaptions:!0,loadThumbnailWithKs:!1,replaceHostOnlyManifestUrls:!1},T=function(){function t(){i(this,t)}return u(t,null,[{key:"set",value:function(t){null!=t&&t.overrideServiceUrl&&(t.serviceUrl=t.overrideServiceUrl),t&&Object.assign(I,t)}},{key:"get",value:function(){return R(I)}},{key:"serviceUrl",get:function(){return I.serviceUrl}}]),t}(),w=u((function t(e){i(this,t),p(this,"hasError",!1),"KalturaAPIException"===e.objectType?(this.hasError=!0,this.error=new A(e.code,e.message)):e.error&&"KalturaAPIException"===e.error.objectType?(this.hasError=!0,this.error=new A(e.error.code,e.error.message)):this.data=e})),A=u((function t(e,r){i(this,t),this.code=e,this.message=r})),C=u((function t(e){i(this,t),this.id=e.id,this.referenceId=e.referenceId,this.externalSourceType=e.externalSourceType,this.name=e.name,this.description=e.description,this.dataUrl=e.dataUrl,this.type=e.type,this.entryType=e.mediaType,this.flavorParamsIds=e.flavorParamsIds,this.duration=e.duration,this.poster=e.thumbnailUrl,this.rawThumbnailUrl=e.thumbnailUrl,this.status=e.status,this.dvrStatus=e.dvrStatus,this.tags=e.tags,this.createdAt=e.createdAt,this.updatedAt=e.updatedAt,this.creatorId=e.creatorId,this.endDate=e.endDate,this.plays=e.plays,this.views=e.views,this.downloadUrl=e.downloadUrl}));p(C,"EntryType",{AUTOMATIC:{value:-1},EXTERNAL_MEDIA:{value:"externalMedia.externalMedia"},MEDIA_CLIP:{value:1},MIX:{value:2},PLAYLIST:{value:5},DATA:{value:6},LIVE_STREAM:{value:7},LIVE_CHANNEL:{value:8},DOCUMENT:{value:10}}),p(C,"MediaType",{VIDEO:{value:1},IMAGE:{value:2},AUDIO:{value:5},LIVE_STREAM_FLASH:{value:201},LIVE_STREAM_WINDOWS_MEDIA:{value:202},LIVE_STREAM_REAL_MEDIA:{value:203},LIVE_STREAM_QUICK_TIME:{value:204}}),p(C,"EntryStatus",{ERROR_IMPORTING:-2,ERROR_CONVERTING:-1,SCAN_FAILURE:"virusScan.ScanFailure",IMPORT:0,INFECTED:"virusScan.Infected",PRECONVERT:1,READY:2,DELETED:3,PENDING:4,MODERATE:5,BLOCKED:6,NO_CONTENT:7}),p(C,"EntryModerationStatus",{PENDING_MODERATION:1,APPROVED:2,REJECTED:3,FLAGGED_FOR_REVIEW:4,MODERATE:5,AUTO_APPROVED:6});var O=function(t){f(a,t);var e,r,n=(e=a,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=h(e);if(r){var i=h(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return d(this,t)});function a(t){var e;return i(this,a),(e=n.call(this,t)).hasError||(e.totalCount=t.totalCount,e.totalCount>0&&(e.entries=[],t.objects.map((function(t){return e.entries.push(new C(t))})))),e}return u(a)}(w),k=u((function t(e){i(this,t),this.type=e.type}));p(k,"Type",{DRM_POLICY:"drm.DRM_POLICY",BLOCK:1,PREVIEW:2,LIMIT_FLAVORS:3,ADD_TO_STORAGE:4,LIMIT_DELIVERY_PROFILES:5,SERVE_FROM_REMOTE_SERVER:6,REQUEST_HOST_REGEX:7,LIMIT_THUMBNAIL_CAPTURE:8,SCHEDULED_RESTRICTED:"SCHEDULED_RESTRICTED"});var b=function(t){f(a,t);var e,r,n=(e=a,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=h(e);if(r){var i=h(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return d(this,t)});function a(t){var e;return i(this,a),(e=n.call(this,t)).pattern=t.pattern,e.replacement=t.replacement,e.replacmenServerNodeId=t.replacmenServerNodeId,e.checkAliveTimeoutMs=t.checkAliveTimeoutMs,e}return u(a)}(k),S=u((function t(e){i(this,t),this.scheme=e.scheme,this.licenseURL=e.licenseURL,this.certificate=e.certificate}));p(S,"Scheme",{"drm.PLAYREADY_CENC":"com.microsoft.playready","drm.WIDEVINE_CENC":"com.widevine.alpha","fairplay.FAIRPLAY":"com.apple.fairplay",WIDEVINE_CENC:"com.widevine.alpha",PLAYREADY_CENC:"com.microsoft.playready",FAIRPLAY:"com.apple.fairplay"});var P=function(){function t(e){var r=this;i(this,t),p(this,"drm",[]),this.format=e.format,this.deliveryProfileId=e.deliveryProfileId,this.url=e.url,this.protocols=e.protocols,this.flavorIds=e.flavorIds,e.drm&&e.drm.map((function(t){return r.drm.push(new S(t))}))}return u(t,[{key:"hasDrmData",value:function(){return this.drm&&this.drm.length>0}},{key:"hasFlavorIds",value:function(){return!!this.flavorIds&&this.flavorIds.length>0}},{key:"getProtocol",value:function(t){var e="";if(this.protocols&&this.protocols.length>0)this.protocols.split(",").forEach((function(r){r===t&&(e=r)}));else if("http"===t)return t;return e}}]),t}(),D=u((function t(e){i(this,t),this.entryId=e.entryId,this.clickThroughUrl=e.url,this.sources=e.sources?e.sources.map((function(t){return new P(t)})):[]})),L=function(){function t(e){i(this,t),this.id=e.id,this.flavorParamsId=e.flavorParamsId,this.fileExt=e.fileExt,this.bitrate=e.bitrate,this.width=e.width,this.height=e.height,this.id=e.id,this.frameRate=e.frameRate,this.isOriginal=e.isOriginal,this.isWeb=e.isWeb,this.containerFormat=e.containerFormat,this.videoCodecId=e.videoCodecId,this.status=e.status,this.language=e.language,this.label=e.label,this.tags=t.parseTags(e.tags)}return u(t,null,[{key:"parseTags",value:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(",")}}]),t}();p(L,"Status",{ERROR:-1,QUEUED:0,CONVERTING:1,READY:2,DELETED:3,NOT_APPLICABLE:4,TEMP:5,WAIT_FOR_CONVERT:6,IMPORTING:7,VALIDATING:8,EXPORTING:9});var x=function(t){f(a,t);var e,r,n=(e=a,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=h(e);if(r){var i=h(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return d(this,t)});function a(t){var e;return i(this,a),(e=n.call(this,t)).hasError||(e.entries=[],t.map((function(t){return e.entries.push(new C(t))}))),e}return u(a)}(w),M=u((function t(e){i(this,t),this.id=e.id,this.metadataProfileId=e.metadataProfileId,this.metadataProfileVersion=e.metadataProfileVersion,this.metadataProfileId=e.metadataProfileId,this.metadataObjectType=e.metadataObjectType,this.objectId=e.objectId,this.version=e.version,this.created=new Date(0),this.created.setUTCSeconds(e.createdAt),this.updated=new Date(0),this.updated.setUTCSeconds(e.updatedAt),this.status=e.status,this.xml=e.xml}));p(M,"ObjectType",{AD_CUE_POINT:"adCuePointMetadata.AdCuePoint",ANNOTATION:"annotationMetadata.Annotation",CODE_CUE_POINT:"codeCuePointMetadata.CodeCuePoint",THUMB_CUE_POINT:"thumbCuePointMetadata.thumbCuePoint",ENTRY:1,CATEGORY:2,USER:3,PARTNER:4,DYNAMIC_OBJECT:5}),p(M,"Status",{VALID:1,INVALID:2,DELETED:3});var U=function(t){f(a,t);var e,r,n=(e=a,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=h(e);if(r){var i=h(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return d(this,t)});function a(t){var e;return i(this,a),(e=n.call(this,t)).hasError||(e.totalCount=t.totalCount,e.totalCount>0&&(e.metas=[],t.objects.map((function(t){return e.metas.push(new M(t))})))),e}return u(a)}(w),N=u((function t(e){i(this,t),this.message=e.message,this.code=e.code}));var j=function(t){f(a,t);var e,r,n=(e=a,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=h(e);if(r){var i=h(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return d(this,t)});function a(t){var e;if(i(this,a),p(c(e=n.call(this,t)),"sources",[]),p(c(e),"actions",[]),p(c(e),"messages",[]),p(c(e),"flavorAssets",[]),p(c(e),"bumperData",[]),!e.hasError){var r=t.messages;r&&r.map((function(t){return e.messages.push(new N(t))}));var o=t.actions;o&&o.map((function(t){t.type===k.Type.REQUEST_HOST_REGEX?e.actions.push(new b(t)):e.actions.push(new k(t))}));var s=t.sources;s&&s.map((function(t){return e.sources.push(new P(t))}));var u=t.flavorAssets;u&&u.map((function(t){return e.flavorAssets.push(new L(t))}));var l=t.bumperData;l&&l.map((function(t){return e.bumperData.push(new D(t))}))}return e}return u(a,[{key:"hasBlockAction",value:function(){return void 0!==this.getBlockAction()}},{key:"getBlockAction",value:function(){return this.actions.find((function(t){return t.type===k.Type.BLOCK}))}},{key:"hasScheduledRestriction",value:function(){return this.messages.some((function(t){return t.code===k.Type.SCHEDULED_RESTRICTED}))}},{key:"getErrorMessages",value:function(){return this.messages}},{key:"getRequestHostRegexAction",value:function(){var t=this.actions.find((function(t){return t.type===k.Type.REQUEST_HOST_REGEX}));if(t instanceof b)return t}}]),a}(w),B=u((function t(e){i(this,t),this.id=e.id,this.name=e.name,this.description=e.description,this.poster=e.thumbnailUrl}));var V=function(t){f(a,t);var e,r,n=(e=a,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=h(e);if(r){var i=h(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return d(this,t)});function a(t){var e;return i(this,a),(e=n.call(this,t)).hasError||(e.name=t.name,e.description=t.description,e.objTypeAsString=t.objTypeAsString,e.width=t.width,e.height=t.height,e.htmlParams=t.htmlParams,e.swfUrl=t.swfUrl,e.confFilePath=t.confFilePath,e.confFile=t.confFile,e.confFileFeatures=t.confFileFeatures,e.config=t.config,e.confVars=t.confVars,e.useCdn=t.useCdn,e.tags=t.tags,e.swfUrlVersion=t.swfUrlVersion,e.created=new Date(0),e.created.setUTCSeconds(t.createdAt),e.updated=new Date(0),e.updated.setUTCSeconds(t.updatedAt),e.html5Url=t.description,e.version=t.description,e.partnerTags=t.description,e.objType=t.description,e.creationMode=t.description),e}return u(a)}(w);p(V,"Type",{PLAYER:1,CONTRIBUTION_WIZARD:2,SIMPLE_EDITOR:3,ADVANCED_EDITOR:4,PLAYLIST:5,APP_STUDIO:6,KRECORD:7,PLAYER_V3:8,KMC_ACCOUNT:9,KMC_ANALYTICS:10,KMC_CONTENT:11,KMC_DASHBOARD:12,KMC_LOGIN:13,PLAYER_SL:14,CLIENTSIDE_ENCODER:15,KMC_GENERAL:16,KMC_ROLES_AND_PERMISSIONS:17,CLIPPER:18,KSR:19,KUPLOAD:20,WEBCASTING:21}),p(V,"CreationMode",{WIZARD:2,ADVANCED:3});var F=u((function t(e){i(this,t),this.playlistLastEntryId=e.playlistLastEntryId,this.entryId=e.entryId,this.id=e.id,this.userId=e.userId,this.partnerId=e.partnerId,this.status=e.status,this.createdAt=e.createdAt,this.updatedAt=e.updatedAt}));var q=function(t){f(a,t);var e,r,n=(e=a,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=h(e);if(r){var i=h(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return d(this,t)});function a(t){var e;return i(this,a),(e=n.call(this,t)).hasError||(e.totalCount=t.totalCount,e.entries=[],e.totalCount>0&&t.objects.map((function(t){return e.entries.push(new F(t))}))),e}return u(a)}(w),H=function(){function t(){i(this,t)}return u(t,null,[{key:"build",value:function(t){var e=T.get(),r=e.serviceUrl.substr(0,e.serviceUrl.lastIndexOf("/")),n=t.partnerId,i=t.entryId,a=t.ks,o=t.uiConfId,s=t.format,u=t.protocol,c=t.extension,l=t.flavorIds;if(!r||isNaN(Number.parseInt(n))||!i||!s||!u)return"";var f=r;return r.endsWith("/")||(f+="/"),f+="p/"+n+"/sp/"+n+"00/playManifest/entryId/"+i+"/protocol/"+u+"/format/"+s,l?f+="/flavorIds/"+l:o&&(f+="/uiConfId/"+o),""!==a&&(f+="/ks/"+a),""!==c&&(f+="/a."+c),o&&""!==l&&(f+="?uiConfId="+o),f}}]),t}(),K=function(){function t(){i(this,t)}return u(t,null,[{key:"xmlToJson",value:function(t){var e={};if(1===t.nodeType){if(t.attributes.length>0){e["@attributes"]={};for(var r=0;r<t.attributes.length;r++){var n=t.attributes.item(r);e["@attributes"][n.nodeName]=n.nodeValue}}}else 3===t.nodeType&&(e=t.nodeValue);if(t.hasChildNodes())for(var i=0;i<t.childNodes.length;i++){var a=t.childNodes.item(i),o=a.nodeName;if(void 0===e[o])e[o]=this.xmlToJson(a);else{if(void 0===e[o].push){var s=e[o];e[o]=[],e[o].push(s)}e[o].push(this.xmlToJson(a))}}return e}}]),t}(),G={DASH:{name:"dash",mimeType:"application/dash+xml",pathExt:"mpd"},HLS:{name:"hls",mimeType:"application/x-mpegURL",pathExt:"m3u8"},WVM:{name:"wvm",mimeType:"video/wvm",pathExt:"wvm"},MP4:{name:"mp4",mimeType:"video/mp4",pathExt:"mp4"},MP3:{name:"mp3",mimeType:"audio/mpeg",pathExt:"mp3"}},W=new Map([["mpegdash",G.DASH],["applehttp",G.HLS],["url",G.MP4]]);function Y(t){var e=W.get(t);return!!e&&e.name===G.MP4.name}var J=function(){function t(){i(this,t),this.progressive=[],this.dash=[],this.hls=[],this.image=[],this.document=[]}return u(t,[{key:"map",value:function(t,e){if(e)switch(e.name){case G.MP4.name:this.progressive.push(t);break;case G.DASH.name:this.dash.push(t);break;case G.HLS.name:this.hls.push(t)}}},{key:"toJSON",value:function(){var t={progressive:[],dash:[],hls:[],image:[],document:[]};return this.progressive.forEach((function(e){return t.progressive.push(e.toJSON())})),this.hls.forEach((function(e){return t.hls.push(e.toJSON())})),this.dash.forEach((function(e){return t.dash.push(e.toJSON())})),t.image=this.image,t.document=this.document,t}}]),t}(),X=function(){function t(){i(this,t),this.metadata=new Map,this.sources=new J,this.type=t.Type.UNKNOWN}return u(t,[{key:"toJSON",value:function(){return{id:this.id,name:this.name,sources:this.sources.toJSON(),duration:this.duration,dvrStatus:this.dvrStatus,status:this.status,metadata:this.metadata,type:this.type,poster:this.poster,assetReferenceType:this.assetReferenceType,downloadUrl:this.downloadUrl,rawThumbnailUrl:this.rawThumbnailUrl}}}]),t}();p(X,"Type",{VOD:"Vod",LIVE:"Live",IMAGE:"Image",AUDIO:"Audio",UNKNOWN:"Unknown",DOCUMENT:"Document"}),p(X,"DvrStatus",{ON:1,OFF:0});var Q=function(){function t(e,r,n){i(this,t),this.licenseUrl=e,this.scheme=r,n&&(this.certificate=n)}return u(t,[{key:"toJSON",value:function(){var t={licenseUrl:this.licenseUrl,scheme:this.scheme};return this.certificate&&(t.certificate=this.certificate),t}}]),t}(),z=function(){function t(){i(this,t)}return u(t,[{key:"toJSON",value:function(){var t={id:this.id,url:this.url,mimetype:this.mimetype};return this.bandwidth&&(t.bandwidth=this.bandwidth),this.width&&(t.width=this.width),this.height&&(t.height=this.height),this.label&&(t.label=this.label),this.drmData&&this.drmData.length>0&&(t.drmData=[],this.drmData.forEach((function(e){Array.isArray(t.drmData)&&t.drmData.push(e.toJSON())}))),t}}]),t}(),Z=u((function t(){i(this,t),this.items=[]})),$=u((function t(){i(this,t),this.items=[]})),tt=u((function t(e){i(this,t),this.url=e.url,this.clickThroughUrl=e.clickThroughUrl})),et={SRT:"1",DFXP:"2",WEBVTT:"3",CAP:"4"},rt={3:"vtt",1:"srt"},nt=function(){function t(){i(this,t)}return u(t,null,[{key:"createConfig",value:function(t,e){return t.map((function(t){var r=t.url,n=rt[t.format];return[et.DFXP,et.CAP].includes(t.format)&&(r=t.webVttUrl,n=rt[et.WEBVTT]),r=st(r,e),{default:!!t.isDefault,type:n,language:t.languageCode,label:t.label,url:r}}))}}]),t}(),it=function(){function t(e){i(this,t),this.id=e.id,this.url=t.extractBaseThumbnailUrl(e.dataUrl),this.mimetype=""}return u(t,null,[{key:"extractBaseThumbnailUrl",value:function(t){return t.match(".+entry_id/[a-zA-Z0-9_]+/")[0].slice(0,-1)}}]),t}(),at=u((function t(e){i(this,t),this.id=e.id,this.url=e.downloadUrl,this.thumbnailUrl=e.poster,this.mimetype=""})),ot=function(){function t(){i(this,t)}return u(t,null,[{key:"getMediaEntry",value:function(e,r,n,i){var a=new X,o=i.entry,s=i.playBackContextResult,u=i.metadataListResult,c=s.sources;return a.sources=t._getParsedSources(c,e,r,n,o,s),t._fillBaseData(a,o,u,s),a.type!==X.Type.LIVE&&T.get().useApiCaptions&&s.data.playbackCaptions&&(a.sources.captions=nt.createConfig(s.data.playbackCaptions,e)),a}},{key:"addKsToUrl",value:function(t,e){var r;return e?(r=-1!==t.split("?")[0].replace(/^.*[\\/]/,"").indexOf(".")?-1===t.indexOf("?")?"?ks=":"&ks=":"/ks/",t+r+e):t}},{key:"getPlaylist",value:function(e){var r=new Z,n=e.playlistData,i=e.playlistItems.entries,a=e.playlistUserEntries.entries;return r.id=n.id,r.name=n.name,r.description=n.description,r.poster=n.poster,r.playlistLastEntryId=a.map((function(t){return t.playlistLastEntryId}))[0],i.forEach((function(e){var n=new X;t._fillBaseData(n,e),r.items.push(n)})),r}},{key:"getEntryList",value:function(e){var r=new $;return e.playlistItems.entries.forEach((function(e){var n=new X;t._fillBaseData(n,e),r.items.push(n)})),r}},{key:"getBumper",value:function(e,r,n){var i=e.playBackContextResult,a=i.bumperData[0];if(a){var o=(a&&a.sources).find((function(t){return Y(t.format)}));if(o){var s=t._parseProgressiveSources(o,i,r,n,0,a.entryId);if(s[0])return new tt({url:s[0].url,clickThroughUrl:a.clickThroughUrl})}}}},{key:"_fillBaseData",value:function(e,r,n,i){if(e.poster=r.poster,e.rawThumbnailUrl=r.rawThumbnailUrl,e.id=r.id,e.duration=r.duration,e.downloadUrl=r.downloadUrl||"",e.metadata=t._parseMetadata(n),e.metadata.description=r.description||"",e.metadata.entryId=r.id||"",e.metadata.name=r.name||"",r.createdAt&&(e.metadata.createdAt=r.createdAt),r.updatedAt&&(e.metadata.updatedAt=r.updatedAt),r.creatorId&&(e.metadata.creatorId=r.creatorId),r.endDate&&(e.metadata.endDate=r.endDate),r.views&&(e.metadata.views=r.views),r.plays&&(e.metadata.plays=r.plays),e.metadata.tags=r.tags||"",e.status=r.status,e.type=t._getEntryType(r.entryType,r.type),e.type===X.Type.LIVE&&(e.dvrStatus=r.dvrStatus),i&&i.flavorAssets[0]&&i.flavorAssets[0].width&&i.flavorAssets[0].height){var a=i.flavorAssets[0],o=a.height,s=a.width;e.metadata.aspectRatio=+Number(s/o).toFixed(2)}return i&&Array.isArray(i.flavorAssets)&&(e.metadata.audioFlavors=i.flavorAssets.filter((function(t){return t.bitrate&&!t.width&&!t.height}))),e}},{key:"_getEntryType",value:function(t,e){var r=X.Type.UNKNOWN;switch(t){case C.MediaType.IMAGE.value:r=X.Type.IMAGE;break;case C.MediaType.AUDIO.value:r=X.Type.AUDIO;break;default:switch(e){case C.EntryType.MEDIA_CLIP.value:r=X.Type.VOD;break;case C.EntryType.LIVE_STREAM.value:case C.EntryType.LIVE_CHANNEL.value:r=X.Type.LIVE;break;case C.EntryType.DOCUMENT.value:r=X.Type.DOCUMENT;break;default:r=X.Type.UNKNOWN}}return r}},{key:"_getParsedSources",value:function(e,r,n,i,a,o){var s,u,c=new J;return a.type===C.EntryType.EXTERNAL_MEDIA.value?((u=new z).mimetype="video/youtube",u.url=a.referenceId,u.id=a.id+"_youtube",c.progressive.push(u)):a.entryType===C.MediaType.IMAGE.value?c.image.push(new it(a)):a.type===C.EntryType.DOCUMENT.value?c.document.push(new at(a)):e&&e.length>0&&(e.filter((function(t){return!Y(t.format)})).forEach((function(e){var s=t._parseAdaptiveSource(e,o,r,n,i,a.id);if(s){var u=W.get(e.format);c.map(s,u)}})),s=e.find((function(e){return Y(e.format)&&""!==e.getProtocol(t._getBaseProtocol())})),c.progressive=t._parseProgressiveSources(s,o,r,n,i,a.id)),c}},{key:"_parseAdaptiveSource",value:function(e,r,n,i,a,o){var s=new z;if(e){var u="",c=W.get(e.format),l=e.getProtocol(t._getBaseProtocol()),f=e.deliveryProfileId,d=e.format,h="";if(c&&(h=c.pathExt,s.mimetype=c.mimeType),e.hasFlavorIds()?(!h&&r.flavorAssets&&r.flavorAssets.length>0&&(h=r.flavorAssets[0].fileExt),u=H.build({entryId:o,flavorIds:e.flavorIds,format:d,ks:n,partnerId:i,uiConfId:a,extension:h,protocol:l})):u=t.addKsToUrl(e.url,n),!u){var p="failed to create play url from source, discarding source: (".concat(o,"_").concat(f,"), ").concat(d);return t._logger.warn(p),null}if(s.url=u,s.id=o+"_"+f+","+d,e.hasDrmData()){var y=[];e.drm.forEach((function(t){y.push(new Q(t.licenseURL,S.Scheme[t.scheme],t.certificate))})),s.drmData=y}}return s}},{key:"_parseProgressiveSources",value:function(e,r,n,i,a,o){var s=[],u=[];if(e){var c=e.getProtocol(t._getBaseProtocol()),l=e.format,f=e.deliveryProfileId,d=f+","+l;r.flavorAssets.map((function(e){var r=new z;r.id=e.id+d,r.mimetype="mp3"===e.fileExt?"audio/mp3":"video/mp4",r.height=e.height,r.width=e.width,r.bandwidth=1024*e.bitrate,r.label=e.label||e.language;var h=H.build({entryId:o,flavorIds:e.id,format:l,ks:n,partnerId:i,uiConfId:a,extension:e.fileExt,protocol:c});if(""===h)return t._logger.warn("failed to create play url from source, discarding source: (".concat(o,"_").concat(f,"), ").concat(l,".")),null;r.url=h,e.height&&e.width?s.push(r):u.push(r)}))}return u.length&&!s.length?u:s}},{key:"_parseMetadata",value:function(t){var e={};return t&&t.metas&&t.metas.length>0&&t.metas.forEach((function(t){if(t.xml){var r=new DOMParser;t.xml=t.xml.replace(/\r?\n|\r/g,""),t.xml=t.xml.replace(/>\s*/g,">"),t.xml=t.xml.replace(/>\s*/g,">");var n=r.parseFromString(t.xml,"text/xml"),i=K.xmlToJson(n);Object.keys(i.metadata).forEach((function(t){e[t]=i.metadata[t]["#text"]}))}})),e}},{key:"_getBaseProtocol",value:function(){var t=T.get(),e=/^https?:/.exec(t.cdnUrl),r=e?e[0]:document.location.protocol;return"string"==typeof r?r.slice(0,-1):"https"}},{key:"hasBlockAction",value:function(t){return t.playBackContextResult.hasBlockAction()}},{key:"getBlockAction",value:function(t){return t.playBackContextResult.getBlockAction()}},{key:"hasScheduledRestriction",value:function(t){return t.playBackContextResult.hasScheduledRestriction()}},{key:"getErrorMessages",value:function(t){return t.playBackContextResult.getErrorMessages()}}]),t}();p(ot,"_logger",_("OVPProviderParser"));var st=ot.addKsToUrl,ut=ot,ct=u((function t(e,r,n){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};i(this,t),this.severity=e,this.category=r,this.code=n,this.data=a,t._logger.error("Category:".concat(r," | Code:").concat(n," |"),a)}));p(ct,"Severity",{RECOVERABLE:1,CRITICAL:2}),p(ct,"Category",{NETWORK:1,SERVICE:2,PROVIDER:3}),p(ct,"Code",{UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,BAD_SERVER_RESPONSE:1005,MULTIREQUEST_API_ERROR:1006,API_RESPONSE_MISMATCH:1007,ERROR:2e3,BLOCK_ACTION:2001,MEDIA_STATUS_NOT_READY:2002,SCHEDULED_RESTRICTED:2003,MISSING_MANDATORY_PARAMS:3e3,MISSING_PLAY_SOURCE:3001,METHOD_NOT_IMPLEMENTED:3002}),p(ct,"_logger",_("Error"));var lt=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Map;i(this,t),p(this,"retryConfig",{async:!0,timeout:0,maxAttempts:4}),p(this,"_attemptCounter",1),this.headers=e}return u(t,[{key:"getUrl",value:function(t){return t+"/service/"+this.service+(this.action?"/action/"+this.action:"")}},{key:"doHttpRequest",value:function(){var t=this,e=new Promise((function(e,r){t._requestPromise={resolve:e,reject:r}}));return this.url||this._requestPromise.reject(new ct(ct.Severity.CRITICAL,ct.Category.NETWORK,ct.Code.MALFORMED_DATA_URI,{url:this.url})),this._createXHR(),e}},{key:"_createXHR",value:function(){var t=this,e=new XMLHttpRequest;e.onreadystatechange=function(){if(4===e.readyState&&200===e.status)try{var r=JSON.parse(e.responseText);return t.responseHeaders=t._getResponseHeaders(e),t._requestPromise.resolve(r)}catch(r){t._requestPromise.reject(t._createError(e,ct.Code.BAD_SERVER_RESPONSE,{text:e.responseText}))}},e.open(this.method,this.url,this.retryConfig.async),this.retryConfig.async&&this.retryConfig.timeout&&(e.timeout=this.retryConfig.timeout);var r=performance.now();e.ontimeout=function(){t._handleError(e,ct.Code.TIMEOUT,{timeout:(performance.now()-r)/1e3,statusText:e.statusText})},e.onerror=e.onabort=function(){t._handleError(e,ct.Code.HTTP_ERROR,{text:e.responseText,statusText:e.statusText})},this.headers.forEach((function(t,r){e.setRequestHeader(r,t)})),e.send(this.params)}},{key:"_getResponseHeaders",value:function(t){return t.getAllResponseHeaders().split("\n").filter((function(t){return 0===t.toLowerCase().indexOf("x-")}))}},{key:"_handleError",value:function(t,e,r){var n=this._createError(t,e,r);if(t.onreadystatechange=function(){},t.onerror=function(){},t.ontimeout=function(){},t.onabort=function(){},!(this.retryConfig.maxAttempts&&this._attemptCounter<this.retryConfig.maxAttempts))return this._requestPromise.reject(n);this._attemptCounter++,this._createXHR()}},{key:"_createError",value:function(t,e,r){return Object.assign(r,{url:this.url,headers:this._getResponseHeaders(t),attempt:this._attemptCounter}),new ct(ct.Severity.CRITICAL,ct.Category.NETWORK,e,r)}}]),t}();var ft=function(t){f(a,t);var e,r,n=(e=a,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=h(e);if(r){var i=h(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return d(this,t)});function a(){var t;i(this,a);for(var e=arguments.length,r=new Array(e),o=0;o<e;o++)r[o]=arguments[o];return p(c(t=n.call.apply(n,[this].concat(r))),"requests",[]),t}return u(a,[{key:"add",value:function(t){this.requests.push(t);var e={},r={service:t.service,action:t.action};return Object.assign(e,p({},this.requests.length,Object.assign(r,t.params))),Object.assign(e,this.params),this.params=e,this}},{key:"execute",value:function(t){var e=this;return new Promise((function(r,n){try{e.params=JSON.stringify(e.params)}catch(t){a._logger.error("".concat(t.message)),n(new ct(ct.Severity.CRITICAL,ct.Category.PROVIDER,ct.Code.FAILED_PARSING_REQUEST,{error:t,params:e.params}))}e.doHttpRequest().then((function(i){var a=new dt(i,t);a.success?r({headers:e.responseHeaders,response:a}):n(new ct(ct.Severity.CRITICAL,ct.Category.NETWORK,ct.Code.MULTIREQUEST_API_ERROR,{url:e.url,headers:e.responseHeaders,results:a.results}))}),(function(t){n(t)}))}))}}]),a}(lt);p(ft,"_logger",_("MultiRequestBuilder"));var dt=u((function t(e){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];i(this,t),p(this,"results",[]);var n=e.result?e.result:e,a=(Array.isArray(n)?n:[n]).map((function(t){return new w(t)})),o=a.filter((function(t){return t.hasError}));o.forEach((function(e){t._logger.error("Service returned an error with error code: ".concat(e.error.code," and message: ").concat(e.error.message,"."))})),this.results=a,r&&o.length||o.length===this.results.length?this.success=!1:(this.results=this.results.filter((function(t){return!t.hasError})),this.success=!0)}));p(dt,"_logger",_("MultiRequestResult"));var ht=function(){function t(){i(this,t)}return u(t,null,[{key:"getMultiRequest",value:function(t,e,r){var n=T.get(),i=n.serviceParams;Object.assign(i,{ks:e,clientTag:"html5:v"+t}),r&&Object.assign(i,{partnerId:r});var a=new Map;a.set("Content-Type","application/json");var o=new ft(a);return o.method="POST",o.service="multirequest",o.url=o.getUrl(n.serviceUrl),o.params=i,o}}]),t}(),pt=u((function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,t),this.type=e.type||t.Type.INCLUDE_FIELDS,this.fields=e.fields||"id,referenceId,name,description,thumbnailUrl,dataUrl,duration,msDuration,flavorParamsIds,mediaType,type,tags,dvrStatus,externalSourceType,status,createdAt,updatedAt,endDate,plays,views,downloadUrl,creatorId"}));p(pt,"Type",{INCLUDE_FIELDS:1,EXCLUDE_FIELDS:2});var yt="baseEntry",vt=function(t){f(a,t);var e,r,n=(e=a,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=h(e);if(r){var i=h(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return d(this,t)});function a(){return i(this,a),n.apply(this,arguments)}return u(a,null,[{key:"getPlaybackContext",value:function(t,e,r,n){var i=new Map;i.set("Content-Type","application/json");var a=new lt(i);a.service=yt,a.action="getPlaybackContext",a.method="POST",a.url=a.getUrl(t),a.tag="baseEntry-getPlaybackContext";var o={objectType:"KalturaContextDataParams",flavorTags:"all"};return n&&(o.referrer=n),a.params={entryId:r,ks:e,contextDataParams:o},a}},{key:"list",value:function(t,e,r,n,i){var o=new Map;o.set("Content-Type","application/json");var s=new lt(o);return s.service=yt,s.action="list",s.method="POST",s.url=s.getUrl(t),s.tag="list",s.params=a.getEntryListReqParams(r,e,n,i),s}},{key:"getEntryListReqParams",value:function(t,e,r,n){var i={};return t?i=r?{redirectFromEntryId:t}:{idEqual:t}:n&&(i={objectType:"KalturaBaseEntryFilter",referenceIdEqual:n}),{ks:e,filter:i,responseProfile:new pt}}}]),a}(ht);var mt=function(t){f(a,t);var e,r,n=(e=a,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=h(e);if(r){var i=h(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return d(this,t)});function a(){return i(this,a),n.apply(this,arguments)}return u(a,null,[{key:"list",value:function(t,e,r){var n=new Map;n.set("Content-Type","application/json");var i=new lt(n);i.service="metadata_metadata",i.action="list",i.method="POST",i.url=i.getUrl(t),i.tag="metadata_metadata-list";var a={objectType:"KalturaMetadataFilter",objectIdEqual:r,metadataObjectTypeEqual:"1"};return i.params={filter:a,ks:e},i}}]),a}(ht),gt=function(){function t(e){i(this,t),p(this,"_response",{}),this.requests=this.buildRequests(e),this._entryId=e.entryId,this._referenceId=e.referenceId}return u(t,[{key:"requests",get:function(){return this._requests},set:function(t){this._requests=t}},{key:"response",get:function(){return this._response},set:function(t){var e=new O(t[0].data);this._response.entry=e.entries[0],this._response.playBackContextResult=new j(t[1].data),this._response.metadataListResult=new U(t[2].data)}},{key:"buildRequests",value:function(t){var e=T.get(),r=[];r.push(vt.list(e.serviceUrl,t.ks,t.entryId,t.redirectFromEntryId,t.referenceId));var n="{1:result:ks}"===t.ks?"{2:result:objects:0:id}":"{1:result:objects:0:id}";return r.push(vt.getPlaybackContext(e.serviceUrl,t.ks,n,t.referrer)),r.push(mt.list(e.serviceUrl,t.ks,n)),r}},{key:"isValid",value:function(){return!(!this._entryId&&!this._referenceId)}}],[{key:"id",get:function(){return"media"}}]),t}();var Et=function(t){f(a,t);var e,r,n=(e=a,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=h(e);if(r){var i=h(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return d(this,t)});function a(){return i(this,a),n.apply(this,arguments)}return u(a,null,[{key:"anonymousSession",value:function(t,e){var r=new Map;r.set("Content-Type","application/json");var n=new lt(r);return n.service="session",n.action="startWidgetSession",n.method="POST",n.url=n.getUrl(t),n.tag="session-startWidget",n.params={widgetId:e},n}}]),a}(ht),_t=function(){function t(e){i(this,t),p(this,"_response",{}),this.requests=this.buildRequests(e),this._widgetId=e.widgetId}return u(t,[{key:"requests",get:function(){return this._requests},set:function(t){this._requests=t}},{key:"response",get:function(){return this._response.ks},set:function(t){this._response.ks=t[0].data.ks}},{key:"buildRequests",value:function(t){var e=T.get(),r=[];return r.push(Et.anonymousSession(e.serviceUrl,t.widgetId)),r}},{key:"isValid",value:function(){return!!this._widgetId}}],[{key:"id",get:function(){return"session"}}]),t}();var Rt=function(t){f(a,t);var e,r,n=(e=a,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=h(e);if(r){var i=h(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return d(this,t)});function a(t,e){var r,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",s=arguments.length>3?arguments[3]:void 0;return i(this,a),(r=n.call(this,s))._multiRequest=ht.getMultiRequest(t,o,e),r}return u(a)}(function(){function t(e){i(this,t),p(this,"_loadersResponseMap",new Map),p(this,"_loaders",new Map),this._networkRetryConfig=e}return u(t,[{key:"add",value:function(t,e,r){var n=this,i=new t(e);if(i.isValid()){this._loaders.set(t.id,i);var a=this._multiRequest.requests.length,o=i.requests;this._multiRequest.retryConfig=this._networkRetryConfig,o.forEach((function(t){t.params=t.params||{},t.params.ks=t.params.ks||r,n._multiRequest.add(t)}));var s=Array.from(new Array(o.length),(function(t,e){return e+a}));this._loadersResponseMap.set(t.id,s)}}},{key:"fetchData",value:function(t){var e=this;return new Promise((function(r,n){e._multiRequest.execute(t).then((function(t){e._multiResponse=t.response,e.prepareData(t.response).success?r(e._loaders):n(new ct(ct.Severity.CRITICAL,ct.Category.NETWORK,ct.Code.API_RESPONSE_MISMATCH,{headers:t.headers}))}),(function(t){n(t)}))}))}},{key:"prepareData",value:function(t){var e=this;return this._loaders.forEach((function(r,n){var i=e._loadersResponseMap.get(n);try{i&&i.length>0&&(r.response=t.results.slice(i[0],i[i.length-1]+1))}catch(t){return{success:!1,error:t}}})),{success:!0,data:this._loaders}}}]),t}());var It="playlist",Tt=function(t){f(a,t);var e,r,n=(e=a,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=h(e);if(r){var i=h(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return d(this,t)});function a(){return i(this,a),n.apply(this,arguments)}return u(a,null,[{key:"execute",value:function(t,e,r){var n=new Map;n.set("Content-Type","application/json");var i=new lt(n);return i.service=It,i.action="execute",i.method="POST",i.url=i.getUrl(t),i.tag="".concat(It,"-execute"),i.params={ks:e,id:r,responseProfile:new pt},i}},{key:"get",value:function(t,e,r){var n=new Map;n.set("Content-Type","application/json");var i=new lt(n);return i.service=It,i.action="get",i.method="POST",i.url=i.getUrl(t),i.tag="".concat(It,"-get"),i.params={ks:e,id:r,responseProfile:{fields:"id,name,description,thumbnailUrl",type:1}},i}},{key:"getLastEntryId",value:function(t,e,r){var n=new Map;n.set("Content-Type","application/json");var i=new lt(n);return i.service="userEntry",i.action="list",i.method="POST",i.url=i.getUrl(t),i.tag="userEntry-list",i.params={ks:e,filter:{objectType:"KalturaViewHistoryUserEntry",entryIdEqual:r,userIdEqualCurrent:1},responseProfile:{fields:"playlistLastEntryId",type:1}},i}}]),a}(ht),wt=function(){function t(e){i(this,t),p(this,"_response",{}),this.requests=this.buildRequests(e),this._playlistId=e.playlistId}return u(t,[{key:"requests",get:function(){return this._requests},set:function(t){this._requests=t}},{key:"response",get:function(){return this._response},set:function(t){this._response.playlistData=new B(t[0].data),this._response.playlistItems=new x(t[1].data),this._response.playlistUserEntries=new q(t[2].data)}},{key:"buildRequests",value:function(t){var e=T.get(),r=[];return r.push(Tt.get(e.serviceUrl,t.ks,t.playlistId)),r.push(Tt.execute(e.serviceUrl,t.ks,t.playlistId)),r.push(Tt.getLastEntryId(e.serviceUrl,t.ks,t.playlistId)),r}},{key:"isValid",value:function(){return!!this._playlistId}}],[{key:"id",get:function(){return"playlist"}}]),t}(),At=function(){function t(e,r){i(this,t),p(this,"_networkRetryConfig",{async:!0,timeout:0,maxAttempts:4}),function(t){t&&"function"==typeof t.getLogger&&(m.get=t.getLogger),t&&t.LogLevel&&(g=t.LogLevel)}(e.logger),this._partnerId=e.partnerId,this._widgetId=e.widgetId,this._uiConfId=e.uiConfId,this._isAnonymous=!e.ks,this._ks=e.ks||"",this._playerVersion=r,this._referrer=e.referrer}return u(t,[{key:"partnerId",get:function(){return this._partnerId}},{key:"widgetId",get:function(){return this._widgetId||this.defaultWidgetId}},{key:"defaultWidgetId",get:function(){return"_"+this._partnerId}},{key:"uiConfId",get:function(){return this._uiConfId}},{key:"ks",get:function(){return this._ks},set:function(t){this._ks=t}},{key:"playerVersion",get:function(){return this._playerVersion}},{key:"isAnonymous",get:function(){return this._isAnonymous}},{key:"getMediaConfig",value:function(t){return Promise.reject(new ct(ct.Severity.CRITICAL,ct.Category.PROVIDER,ct.Code.METHOD_NOT_IMPLEMENTED,{message:"getMediaConfig method must be implement by the derived class"}))}},{key:"getPlaylistConfig",value:function(t){return Promise.reject(new ct(ct.Severity.CRITICAL,ct.Category.PROVIDER,ct.Code.METHOD_NOT_IMPLEMENTED,{message:"The provider does not support loading playlist by id"}))}},{key:"getEntryListConfig",value:function(t){return Promise.reject(new ct(ct.Severity.CRITICAL,ct.Category.PROVIDER,ct.Code.METHOD_NOT_IMPLEMENTED,{message:"The provider does not support loading entry list"}))}},{key:"_verifyHasSources",value:function(t){if(0===t.hls.concat(t.dash,t.progressive,t.image,t.document).length)throw new ct(ct.Severity.CRITICAL,ct.Category.SERVICE,ct.Code.MISSING_PLAY_SOURCE,{action:"",messages:"No play source for entry id: ".concat(t.id)})}},{key:"LogLevel",get:function(){return g}},{key:"getLogLevel",value:function(t){return function(t){return E(t).getLevel()}(t)}},{key:"setLogLevel",value:function(t,e){!function(t,e){E(e).setLevel(t)}(t,e)}}]),t}(),Ct=function(){function t(e){i(this,t),p(this,"_response",{playlistItems:{entries:[]}}),this.requests=this.buildRequests(e),this._entries=e.entries}return u(t,[{key:"requests",get:function(){return this._requests},set:function(t){this._requests=t}},{key:"response",get:function(){return this._response},set:function(t){var e,r=this;t.forEach((function(t){e=new O(t.data),r._response.playlistItems.entries.push(e.entries[0])}))}},{key:"buildRequests",value:function(t){var e=T.get(),r=[];return t.entries.forEach((function(n){r.push(vt.list(e.serviceUrl,t.ks,n.entryId||n,t.redirectFromEntryId,n.referenceId))})),r}},{key:"isValid",value:function(){return!(!this._entries||!this._entries.length)}}],[{key:"id",get:function(){return"entry_list"}}]),t}();function Ot(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function kt(t){return function(t){if(Array.isArray(t))return Ot(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Ot(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ot(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var bt=function(){function t(){i(this,t)}return u(t,null,[{key:"_applyRegexAction",value:function(t,e){if(t){var r=new RegExp(t.pattern,"i");if(e.match(r))return e.replace(r,t.replacement+"/")}return e}},{key:"_pingECDNAndReplaceHostUrls",value:function(e,r,n){return new Promise((function(i){var a=n+"/api_v3/service/system/action/ping/format/1",o=new XMLHttpRequest;o.open("GET",a),o.timeout=r.checkAliveTimeoutMs,o.onreadystatechange=function(){4===o.readyState&&(200===o.status&&t._replaceHostUrls(e,r),i(e))},o.ontimeout=function(){t._logger.warn("Got timeout while pinging the ECDN url. the ping url: ".concat(a)),i(e)},o.send()}))}},{key:"handleRegexAction",value:function(e,r){return new Promise((function(n){var i=T.get().cdnUrl,a=t._extractRegexActionFromData(r),o=t._getRegExp(a);i&&a&&o&&i.match(o)?a.checkAliveTimeoutMs>0?(t._logger.debug("executing ping request..."),t._pingECDNAndReplaceHostUrls(e,a,i.replace(o,a.replacement)).then(n)):(t._replaceHostUrls(e,a),n(e)):(t._logger.debug("exiting handleRegexAction - not applying regex action."),n(e))}))}},{key:"_replaceHostUrls",value:function(e,r){t._logger.debug("Starting to modify urls...");var n=e.sources,i=n.hls,a=n.dash,o=n.progressive,s=n.image;[].concat(kt(i),kt(a),kt(o),kt(s)).forEach((function(e){return e.url=t._applyRegexAction(r,e.url)})),T.get().replaceHostOnlyManifestUrls||(t._logger.debug("replaceHostOnlyManifestUrls flag is off - modifying captions and poster URLs"),n.captions&&n.captions.forEach((function(e){return e.url=t._applyRegexAction(r,e.url)})),"string"==typeof n.poster&&(n.poster=t._applyRegexAction(r,n.poster))),t._logger.debug("Finished modifying urls")}},{key:"_extractRegexActionFromData",value:function(t){var e;return null===(e=t.get(gt.id))||void 0===e||null===(e=e.response)||void 0===e?void 0:e.playBackContextResult.getRequestHostRegexAction()}},{key:"_getRegExp",value:function(t){if(t&&t.pattern&&t.replacement)return new RegExp(t.pattern,"i")}}]),t}();p(bt,"_logger",_("RegexActionHandler"));var St=bt;var Pt=function(t){f(a,t);var e,r,n=(e=a,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,n=h(e);if(r){var i=h(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return d(this,t)});function a(){return i(this,a),n.apply(this,arguments)}return u(a,null,[{key:"get",value:function(t,e){var r=new Map;r.set("Content-Type","application/json");var n=new lt(r);return n.service="user",n.action="get",n.method="POST",n.url=n.getUrl(t),n.tag="user-get",n.params={ks:e,format:1},n}}]),a}(ht),Dt=function(){function t(e){i(this,t),this.id=e.id}return u(t,[{key:"isAnonymous",value:function(){return t.INVALID_IDS.includes(this.id)}}]),t}();p(Dt,"INVALID_IDS",["0","",null,void 0]);var Lt=function(t){f(l,t);var r,n,a,o,s=(a=l,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=h(a);if(o){var r=h(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return d(this,t)});function l(t,e){var r;return i(this,l),p(c(r=s.call(this,t,e)),"_filterOptionsConfig",{redirectFromEntryId:!0}),r._logger=_("OVPProvider"),T.set(t.env),r._setFilterOptionsConfig(t.filterOptions),r._vrTag=t.vrTag||"360",r._networkRetryConfig=Object.assign(r._networkRetryConfig,t.networkRetryParameters),r._isAnonymous=!r._ks||void 0,void 0===r._isAnonymous&&r.initializeUserResponse(T.serviceUrl,r._ks).then((function(){r._logger.info("User response initialized")})).catch((function(t){r._logger.error("Failed to initialize user response",t)})),r}return u(l,[{key:"env",get:function(){return T.get()}},{key:"initializeUserResponse",value:(r=v().mark((function t(e,r){var n,i,a;return v().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return(n=Pt.get(e,r)).params=JSON.stringify(n.params),t.next=4,n.doHttpRequest();case 4:i=t.sent,a=new Dt(i),this._isAnonymous=a.isAnonymous();case 7:case"end":return t.stop()}}),t,this)})),n=function(){var t=this,n=arguments;return new Promise((function(i,a){var o=r.apply(t,n);function s(t){e(o,i,a,s,u,"next",t)}function u(t){e(o,i,a,s,u,"throw",t)}s(void 0)}))},function(t,e){return n.apply(this,arguments)})},{key:"getMediaConfig",value:function(t){var e=this;return t.ks&&(this.ks=t.ks),this._dataLoader=new Rt(this.playerVersion,this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var i=t.entryId,a=t.referenceId;if(i||a){var o=e.ks;o||(o="{1:result:ks}",e._dataLoader.add(_t,{widgetId:e.widgetId}));var s=e._getEntryRedirectFilter(t);return e._dataLoader.add(gt,{entryId:i,ks:o,redirectFromEntryId:s,referenceId:a,referrer:e._referrer}),e._dataLoader.fetchData().then((function(t){try{var i=e._parseDataFromResponse(t);St.handleRegexAction(i,t).then(r)}catch(t){n(t)}}),(function(t){n(t)}))}n(new ct(ct.Severity.CRITICAL,ct.Category.PROVIDER,ct.Code.MISSING_MANDATORY_PARAMS,{message:"missing entry id"}))}))}},{key:"doRequest",value:function(t,e,r){var n=this,i=e||this.ks,a=new Rt(this.playerVersion,this.partnerId,i,this._networkRetryConfig);return new Promise((function(e,o){return i||a.add(_t,{widgetId:n.widgetId}),t.forEach((function(t){a.add(t.loader,t.params,i||"{1:result:ks}")})),a.fetchData(r).then((function(t){try{e(t)}catch(t){o(t)}}),(function(t){o(t)}))}))}},{key:"_getEntryRedirectFilter",value:function(t){return"boolean"==typeof t.redirectFromEntryId?t.redirectFromEntryId:"boolean"!=typeof this._filterOptionsConfig.redirectFromEntryId||this._filterOptionsConfig.redirectFromEntryId}},{key:"_setFilterOptionsConfig",value:function(t){t&&"boolean"==typeof t.redirectFromEntryId&&(this._filterOptionsConfig.redirectFromEntryId=t.redirectFromEntryId)}},{key:"_parseDataFromResponse",value:function(t){this._logger.debug("Data parsing started");var e={session:{isAnonymous:this._isAnonymous,partnerId:this.partnerId},sources:this._getDefaultSourcesObject(),plugins:{}};if(this.uiConfId&&(e.session.uiConfId=this.uiConfId),t){if(t.has(_t.id)){var r=t.get(_t.id);r&&r.response&&(e.session.ks=r.response,this.widgetId!==this.defaultWidgetId&&(this.ks=e.session.ks))}else e.session.ks=this.ks;if(t.has(gt.id)){var n=t.get(gt.id);if(n&&n.response){var i=n.response;if(ut.hasBlockAction(i))throw new ct(ct.Severity.CRITICAL,ct.Category.SERVICE,ct.Code.BLOCK_ACTION,{action:ut.getBlockAction(i),messages:ut.getErrorMessages(i)});if(ut.hasScheduledRestriction(i))throw new ct(ct.Severity.CRITICAL,ct.Category.SERVICE,ct.Code.SCHEDULED_RESTRICTED,{messages:ut.getErrorMessages(i)});var a=ut.getMediaEntry(this.ks,this.partnerId,this.uiConfId,i);Object.assign(e.sources,this._getSourcesObject(a)),this._verifyMediaStatus(a),this._verifyHasSources(e.sources);var o=ut.getBumper(i,this.ks,this.partnerId);o&&Object.assign(e.plugins,{bumper:o})}}}return this._logger.debug("Data parsing finished",e),e}},{key:"_verifyMediaStatus",value:function(t){if([C.EntryStatus.IMPORT,C.EntryStatus.PRECONVERT].includes(t.status))throw new ct(ct.Severity.CRITICAL,ct.Category.SERVICE,ct.Code.MEDIA_STATUS_NOT_READY,{messages:"Status of entry id ".concat(t.id," is ").concat(t.status," and is still being imported or converted"),data:{status:status}})}},{key:"getPlaylistConfig",value:function(t){var e=this;return t.ks&&(this.ks=t.ks),this._dataLoader=new Rt(this.playerVersion,this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var i=t.playlistId;if(i){var a=e.ks;a||(a="{1:result:ks}",e._dataLoader.add(_t,{widgetId:e.widgetId})),e._dataLoader.add(wt,{playlistId:i,ks:a}),e._dataLoader.fetchData().then((function(t){r(e._parsePlaylistDataFromResponse(t))}),(function(t){n(t)}))}else n({success:!1,data:"Missing mandatory parameter"})}))}},{key:"_parsePlaylistDataFromResponse",value:function(t){var e=this;this._logger.debug("Data parsing started");var r=this._getPlaylistObject();if(t&&t.has(wt.id)){var n=t.get(wt.id);if(n&&n.response){var i=ut.getPlaylist(n.response);r.id=i.id,r.poster=i.poster,r.metadata.name=i.name,r.metadata.description=i.description,r.playlistLastEntryId=i.playlistLastEntryId,i.items.forEach((function(t){return r.items.push({sources:e._getSourcesObject(t)})}))}}return this._logger.debug("Data parsing finished",r),r}},{key:"getEntryListConfig",value:function(t){var e=this;return t.ks&&(this.ks=t.ks),this._dataLoader=new Rt(this.playerVersion,this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var i=t.entries;if(i&&i.length){var a=e.ks;a||(a="{1:result:ks}",e._dataLoader.add(_t,{widgetId:e.widgetId}));var o=e._getEntryRedirectFilter(t);e._dataLoader.add(Ct,{entries:i,ks:a,redirectFromEntryId:o}),e._dataLoader.fetchData(!1).then((function(t){r(e._parseEntryListDataFromResponse(t))}),(function(t){n(t)}))}else n({success:!1,data:"Missing mandatory parameter"})}))}},{key:"_parseEntryListDataFromResponse",value:function(t){var e=this;this._logger.debug("Data parsing started");var r=this._getPlaylistObject();if(t&&t.has(Ct.id)){var n=t.get(Ct.id);n&&n.response&&ut.getEntryList(n.response).items.forEach((function(t){return r.items.push({sources:e._getSourcesObject(t)})}))}return this._logger.debug("Data parsing finished",r),r}},{key:"_getPlaylistObject",value:function(){return{id:"",metadata:{name:"",description:""},poster:"",playlistLastEntryId:"",items:[]}}},{key:"_getDefaultSourcesObject",value:function(){return{hls:[],dash:[],progressive:[],image:[],document:[],id:"",duration:0,type:X.Type.UNKNOWN,poster:"",rawThumbnailUrl:"",dvr:!1,vr:null,metadata:{name:"",description:"",tags:""}}}},{key:"_getSourcesObject",value:function(t){var e=this,r=this._getDefaultSourcesObject(),n=t.sources.toJSON();return r.hls=n.hls,r.dash=n.dash,r.progressive=n.progressive,r.image=n.image,r.document=n.document,r.id=t.id,r.duration=t.duration,r.type=t.type,r.dvr=!!t.dvrStatus,r.poster=t.poster,r.rawThumbnailUrl=t.rawThumbnailUrl,r.downloadUrl=t.downloadUrl,t.sources.captions&&(r.captions=t.sources.captions),t.metadata&&"string"==typeof t.metadata.tags&&t.metadata.tags.split(",").some((function(t){return t.trim()===e._vrTag}))&&(r.vr={}),Object.assign(r.metadata,t.metadata),r}}]),l}(At),xt="@playkit-js/playkit-js-providers-ovp",Mt="2.42.0-canary.0-07d09a7"}(),n}()}));
3
3
  //# sourceMappingURL=playkit-ovp-provider.js.map
@@ -1,2 +1,2 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,(function(){return function(){"use strict";var e={d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===n(t)?t:String(t)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}function s(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function u(e,t,r){return(t=o(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}e.r(t),e.d(t,{NAME:function(){return S},OVPConfiguration:function(){return y},OVPStatsService:function(){return T},RequestBuilder:function(){return l},VERSION:function(){return C}});var a=function(){return{VERSION:"",DEBUG:{value:"",name:""},ERROR:{value:"",name:""},INFO:{value:"",name:""},OFF:{value:"",name:""},TIME:{value:"",name:""},TRACE:{value:"",name:""},WARN:{value:"",name:""},createDefaultHandler:function(){},debug:function(){},enabledFor:function(){},error:function(){},get:function(){},getLevel:function(){},info:function(){},log:function(){},setHandler:function(){},setLevel:function(){},time:function(){},timeEnd:function(){},trace:function(){},useDefaults:function(){},warn:function(){}}};var c=function(e){return a(e)},f=s((function e(t,n,o){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r(this,e),this.severity=t,this.category=n,this.code=o,this.data=i,e._logger.error("Category:".concat(n," | Code:").concat(o," |"),i)}));u(f,"Severity",{RECOVERABLE:1,CRITICAL:2}),u(f,"Category",{NETWORK:1,SERVICE:2,PROVIDER:3}),u(f,"Code",{UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,BAD_SERVER_RESPONSE:1005,MULTIREQUEST_API_ERROR:1006,API_RESPONSE_MISMATCH:1007,ERROR:2e3,BLOCK_ACTION:2001,MEDIA_STATUS_NOT_READY:2002,SCHEDULED_RESTRICTED:2003,MISSING_MANDATORY_PARAMS:3e3,MISSING_PLAY_SOURCE:3001,METHOD_NOT_IMPLEMENTED:3002}),u(f,"_logger",c("Error"));var l=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Map;r(this,e),u(this,"retryConfig",{async:!0,timeout:0,maxAttempts:4}),u(this,"_attemptCounter",1),this.headers=t}return s(e,[{key:"getUrl",value:function(e){return e+"/service/"+this.service+(this.action?"/action/"+this.action:"")}},{key:"doHttpRequest",value:function(){var e=this,t=new Promise((function(t,r){e._requestPromise={resolve:t,reject:r}}));return this.url||this._requestPromise.reject(new f(f.Severity.CRITICAL,f.Category.NETWORK,f.Code.MALFORMED_DATA_URI,{url:this.url})),this._createXHR(),t}},{key:"_createXHR",value:function(){var e=this,t=new XMLHttpRequest;t.onreadystatechange=function(){if(4===t.readyState&&200===t.status)try{var r=JSON.parse(t.responseText);return e.responseHeaders=e._getResponseHeaders(t),e._requestPromise.resolve(r)}catch(r){e._requestPromise.reject(e._createError(t,f.Code.BAD_SERVER_RESPONSE,{text:t.responseText}))}},t.open(this.method,this.url,this.retryConfig.async),this.retryConfig.async&&this.retryConfig.timeout&&(t.timeout=this.retryConfig.timeout);var r=performance.now();t.ontimeout=function(){e._handleError(t,f.Code.TIMEOUT,{timeout:(performance.now()-r)/1e3,statusText:t.statusText})},t.onerror=t.onabort=function(){e._handleError(t,f.Code.HTTP_ERROR,{text:t.responseText,statusText:t.statusText})},this.headers.forEach((function(e,r){t.setRequestHeader(r,e)})),t.send(this.params)}},{key:"_getResponseHeaders",value:function(e){return e.getAllResponseHeaders().split("\n").filter((function(e){return 0===e.toLowerCase().indexOf("x-")}))}},{key:"_handleError",value:function(e,t,r){var n=this._createError(e,t,r);if(e.onreadystatechange=function(){},e.onerror=function(){},e.ontimeout=function(){},e.onabort=function(){},!(this.retryConfig.maxAttempts&&this._attemptCounter<this.retryConfig.maxAttempts))return this._requestPromise.reject(n);this._attemptCounter++,this._createXHR()}},{key:"_createError",value:function(e,t,r){return Object.assign(r,{url:this.url,headers:this._getResponseHeaders(e),attempt:this._attemptCounter}),new f(f.Severity.CRITICAL,f.Category.NETWORK,t,r)}}]),e}(),p=function e(t){var r;return Array.isArray(t)?(r=t.length>0?t.slice(0):[]).forEach((function(t,o){("object"===n(t)||Array.isArray(t)&&t.length>0)&&(r[o]=e(t))})):"object"===n(t)?(r=Object.assign({},t),Object.keys(r).forEach((function(t){("object"===n(r[t])||Array.isArray(r[t])&&r[t].length>0)&&(r[t]=e(r[t]))}))):r=t,r},h={serviceUrl:"https://cdnapisec.kaltura.com/api_v3",cdnUrl:"https://cdnapisec.kaltura.com",serviceParams:{apiVersion:"3.3.0",format:1},useApiCaptions:!0,loadThumbnailWithKs:!1,replaceHostOnlyManifestUrls:!1},y=function(){function e(){r(this,e)}return s(e,null,[{key:"set",value:function(e){null!=e&&e.overrideServiceUrl&&(e.serviceUrl=e.overrideServiceUrl),e&&Object.assign(h,e)}},{key:"get",value:function(){return p(h)}},{key:"serviceUrl",get:function(){return h.serviceUrl}}]),e}();function v(e,t){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},v(e,t)}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}function R(e){return R=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},R(e)}var E=s((function e(t){r(this,e),u(this,"hasError",!1),"KalturaAPIException"===t.objectType?(this.hasError=!0,this.error=new b(t.code,t.message)):t.error&&"KalturaAPIException"===t.error.objectType?(this.hasError=!0,this.error=new b(t.error.code,t.error.message)):this.data=t})),b=s((function e(t,n){r(this,e),this.code=t,this.message=n}));var O=function(e){d(i,e);var t,n,o=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=R(t);if(n){var o=R(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return g(this,e)});function i(){var e;r(this,i);for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return u(m(e=o.call.apply(o,[this].concat(n))),"requests",[]),e}return s(i,[{key:"add",value:function(e){this.requests.push(e);var t={},r={service:e.service,action:e.action};return Object.assign(t,u({},this.requests.length,Object.assign(r,e.params))),Object.assign(t,this.params),this.params=t,this}},{key:"execute",value:function(e){var t=this;return new Promise((function(r,n){try{t.params=JSON.stringify(t.params)}catch(e){i._logger.error("".concat(e.message)),n(new f(f.Severity.CRITICAL,f.Category.PROVIDER,f.Code.FAILED_PARSING_REQUEST,{error:e,params:t.params}))}t.doHttpRequest().then((function(o){var i=new _(o,e);i.success?r({headers:t.responseHeaders,response:i}):n(new f(f.Severity.CRITICAL,f.Category.NETWORK,f.Code.MULTIREQUEST_API_ERROR,{url:t.url,headers:t.responseHeaders,results:i.results}))}),(function(e){n(e)}))}))}}]),i}(l);u(O,"_logger",c("MultiRequestBuilder"));var _=s((function e(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];r(this,e),u(this,"results",[]);var o=t.result?t.result:t,i=(Array.isArray(o)?o:[o]).map((function(e){return new E(e)})),s=i.filter((function(e){return e.hasError}));s.forEach((function(t){e._logger.error("Service returned an error with error code: ".concat(t.error.code," and message: ").concat(t.error.message,"."))})),this.results=i,n&&s.length||s.length===this.results.length?this.success=!1:(this.results=this.results.filter((function(e){return!e.hasError})),this.success=!0)}));u(_,"_logger",c("MultiRequestResult"));var T=function(e){d(u,e);var t,o,i=(t=u,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=R(t);if(o){var n=R(this).constructor;e=Reflect.construct(r,arguments,n)}else e=r.apply(this,arguments);return g(this,e)});function u(){return r(this,u),i.apply(this,arguments)}return s(u,null,[{key:"collect",value:function(e,t,r,o){var i=y.get(),s={};Object.assign(s,i.serviceParams,{ks:t,clientTag:"html5:v"+r},o);var u,a,c,f,p,h=new l;return h.service="stats",h.action="collect",h.method="GET",h.tag="stats-collect",h.params=s,h.url=e+"?service="+h.service+"&action="+h.action+"&"+(u=h.params,a=[],c=/\[\]$/,f=function(e){return"[object Array]"===Object.prototype.toString.call(e)},p=function(e,t){t="function"==typeof t?t():null==t?"":t,a[a.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)},function e(t,r){var o,i,s;if(t)if(f(r))for(o=0,i=r.length;o<i;o++)c.test(t)?p(t,r[o]):e(t+":"+("object"===n(r[o])?o:""),r[o]);else if(r&&"[object Object]"===String(r))for(s in r)e(t+":"+s,r[s]);else p(t,r);else if(f(r))for(o=0,i=r.length;o<i;o++)p(r[o].name,r[o].value);else for(s in r)e(s,r[s]);return a}("",u).join("&").replace(/%20/g,"+")),h}}]),u}(function(){function e(){r(this,e)}return s(e,null,[{key:"getMultiRequest",value:function(e,t,r){var n=y.get(),o=n.serviceParams;Object.assign(o,{ks:t,clientTag:"html5:v"+e}),r&&Object.assign(o,{partnerId:r});var i=new Map;i.set("Content-Type","application/json");var s=new O(i);return s.method="POST",s.service="multirequest",s.url=s.getUrl(n.serviceUrl),s.params=o,s}}]),e}()),S="@playkit-js/playkit-js-providers-stats-service",C="2.41.4-canary.0-d258629";return t}()}));
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(self,(function(){return function(){"use strict";var e={d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===n(t)?t:String(t)}function i(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}function s(e,t,r){return t&&i(e.prototype,t),r&&i(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function u(e,t,r){return(t=o(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}e.r(t),e.d(t,{NAME:function(){return S},OVPConfiguration:function(){return y},OVPStatsService:function(){return T},RequestBuilder:function(){return l},VERSION:function(){return C}});var a=function(){return{VERSION:"",DEBUG:{value:"",name:""},ERROR:{value:"",name:""},INFO:{value:"",name:""},OFF:{value:"",name:""},TIME:{value:"",name:""},TRACE:{value:"",name:""},WARN:{value:"",name:""},createDefaultHandler:function(){},debug:function(){},enabledFor:function(){},error:function(){},get:function(){},getLevel:function(){},info:function(){},log:function(){},setHandler:function(){},setLevel:function(){},time:function(){},timeEnd:function(){},trace:function(){},useDefaults:function(){},warn:function(){}}};var c=function(e){return a(e)},f=s((function e(t,n,o){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};r(this,e),this.severity=t,this.category=n,this.code=o,this.data=i,e._logger.error("Category:".concat(n," | Code:").concat(o," |"),i)}));u(f,"Severity",{RECOVERABLE:1,CRITICAL:2}),u(f,"Category",{NETWORK:1,SERVICE:2,PROVIDER:3}),u(f,"Code",{UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,BAD_SERVER_RESPONSE:1005,MULTIREQUEST_API_ERROR:1006,API_RESPONSE_MISMATCH:1007,ERROR:2e3,BLOCK_ACTION:2001,MEDIA_STATUS_NOT_READY:2002,SCHEDULED_RESTRICTED:2003,MISSING_MANDATORY_PARAMS:3e3,MISSING_PLAY_SOURCE:3001,METHOD_NOT_IMPLEMENTED:3002}),u(f,"_logger",c("Error"));var l=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Map;r(this,e),u(this,"retryConfig",{async:!0,timeout:0,maxAttempts:4}),u(this,"_attemptCounter",1),this.headers=t}return s(e,[{key:"getUrl",value:function(e){return e+"/service/"+this.service+(this.action?"/action/"+this.action:"")}},{key:"doHttpRequest",value:function(){var e=this,t=new Promise((function(t,r){e._requestPromise={resolve:t,reject:r}}));return this.url||this._requestPromise.reject(new f(f.Severity.CRITICAL,f.Category.NETWORK,f.Code.MALFORMED_DATA_URI,{url:this.url})),this._createXHR(),t}},{key:"_createXHR",value:function(){var e=this,t=new XMLHttpRequest;t.onreadystatechange=function(){if(4===t.readyState&&200===t.status)try{var r=JSON.parse(t.responseText);return e.responseHeaders=e._getResponseHeaders(t),e._requestPromise.resolve(r)}catch(r){e._requestPromise.reject(e._createError(t,f.Code.BAD_SERVER_RESPONSE,{text:t.responseText}))}},t.open(this.method,this.url,this.retryConfig.async),this.retryConfig.async&&this.retryConfig.timeout&&(t.timeout=this.retryConfig.timeout);var r=performance.now();t.ontimeout=function(){e._handleError(t,f.Code.TIMEOUT,{timeout:(performance.now()-r)/1e3,statusText:t.statusText})},t.onerror=t.onabort=function(){e._handleError(t,f.Code.HTTP_ERROR,{text:t.responseText,statusText:t.statusText})},this.headers.forEach((function(e,r){t.setRequestHeader(r,e)})),t.send(this.params)}},{key:"_getResponseHeaders",value:function(e){return e.getAllResponseHeaders().split("\n").filter((function(e){return 0===e.toLowerCase().indexOf("x-")}))}},{key:"_handleError",value:function(e,t,r){var n=this._createError(e,t,r);if(e.onreadystatechange=function(){},e.onerror=function(){},e.ontimeout=function(){},e.onabort=function(){},!(this.retryConfig.maxAttempts&&this._attemptCounter<this.retryConfig.maxAttempts))return this._requestPromise.reject(n);this._attemptCounter++,this._createXHR()}},{key:"_createError",value:function(e,t,r){return Object.assign(r,{url:this.url,headers:this._getResponseHeaders(e),attempt:this._attemptCounter}),new f(f.Severity.CRITICAL,f.Category.NETWORK,t,r)}}]),e}(),p=function e(t){var r;return Array.isArray(t)?(r=t.length>0?t.slice(0):[]).forEach((function(t,o){("object"===n(t)||Array.isArray(t)&&t.length>0)&&(r[o]=e(t))})):"object"===n(t)?(r=Object.assign({},t),Object.keys(r).forEach((function(t){("object"===n(r[t])||Array.isArray(r[t])&&r[t].length>0)&&(r[t]=e(r[t]))}))):r=t,r},h={serviceUrl:"https://cdnapisec.kaltura.com/api_v3",cdnUrl:"https://cdnapisec.kaltura.com",serviceParams:{apiVersion:"3.3.0",format:1},useApiCaptions:!0,loadThumbnailWithKs:!1,replaceHostOnlyManifestUrls:!1},y=function(){function e(){r(this,e)}return s(e,null,[{key:"set",value:function(e){null!=e&&e.overrideServiceUrl&&(e.serviceUrl=e.overrideServiceUrl),e&&Object.assign(h,e)}},{key:"get",value:function(){return p(h)}},{key:"serviceUrl",get:function(){return h.serviceUrl}}]),e}();function v(e,t){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},v(e,t)}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&v(e,t)}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function g(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}function R(e){return R=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},R(e)}var E=s((function e(t){r(this,e),u(this,"hasError",!1),"KalturaAPIException"===t.objectType?(this.hasError=!0,this.error=new b(t.code,t.message)):t.error&&"KalturaAPIException"===t.error.objectType?(this.hasError=!0,this.error=new b(t.error.code,t.error.message)):this.data=t})),b=s((function e(t,n){r(this,e),this.code=t,this.message=n}));var O=function(e){d(i,e);var t,n,o=(t=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=R(t);if(n){var o=R(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return g(this,e)});function i(){var e;r(this,i);for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return u(m(e=o.call.apply(o,[this].concat(n))),"requests",[]),e}return s(i,[{key:"add",value:function(e){this.requests.push(e);var t={},r={service:e.service,action:e.action};return Object.assign(t,u({},this.requests.length,Object.assign(r,e.params))),Object.assign(t,this.params),this.params=t,this}},{key:"execute",value:function(e){var t=this;return new Promise((function(r,n){try{t.params=JSON.stringify(t.params)}catch(e){i._logger.error("".concat(e.message)),n(new f(f.Severity.CRITICAL,f.Category.PROVIDER,f.Code.FAILED_PARSING_REQUEST,{error:e,params:t.params}))}t.doHttpRequest().then((function(o){var i=new _(o,e);i.success?r({headers:t.responseHeaders,response:i}):n(new f(f.Severity.CRITICAL,f.Category.NETWORK,f.Code.MULTIREQUEST_API_ERROR,{url:t.url,headers:t.responseHeaders,results:i.results}))}),(function(e){n(e)}))}))}}]),i}(l);u(O,"_logger",c("MultiRequestBuilder"));var _=s((function e(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];r(this,e),u(this,"results",[]);var o=t.result?t.result:t,i=(Array.isArray(o)?o:[o]).map((function(e){return new E(e)})),s=i.filter((function(e){return e.hasError}));s.forEach((function(t){e._logger.error("Service returned an error with error code: ".concat(t.error.code," and message: ").concat(t.error.message,"."))})),this.results=i,n&&s.length||s.length===this.results.length?this.success=!1:(this.results=this.results.filter((function(e){return!e.hasError})),this.success=!0)}));u(_,"_logger",c("MultiRequestResult"));var T=function(e){d(u,e);var t,o,i=(t=u,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,r=R(t);if(o){var n=R(this).constructor;e=Reflect.construct(r,arguments,n)}else e=r.apply(this,arguments);return g(this,e)});function u(){return r(this,u),i.apply(this,arguments)}return s(u,null,[{key:"collect",value:function(e,t,r,o){var i=y.get(),s={};Object.assign(s,i.serviceParams,{ks:t,clientTag:"html5:v"+r},o);var u,a,c,f,p,h=new l;return h.service="stats",h.action="collect",h.method="GET",h.tag="stats-collect",h.params=s,h.url=e+"?service="+h.service+"&action="+h.action+"&"+(u=h.params,a=[],c=/\[\]$/,f=function(e){return"[object Array]"===Object.prototype.toString.call(e)},p=function(e,t){t="function"==typeof t?t():null==t?"":t,a[a.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)},function e(t,r){var o,i,s;if(t)if(f(r))for(o=0,i=r.length;o<i;o++)c.test(t)?p(t,r[o]):e(t+":"+("object"===n(r[o])?o:""),r[o]);else if(r&&"[object Object]"===String(r))for(s in r)e(t+":"+s,r[s]);else p(t,r);else if(f(r))for(o=0,i=r.length;o<i;o++)p(r[o].name,r[o].value);else for(s in r)e(s,r[s]);return a}("",u).join("&").replace(/%20/g,"+")),h}}]),u}(function(){function e(){r(this,e)}return s(e,null,[{key:"getMultiRequest",value:function(e,t,r){var n=y.get(),o=n.serviceParams;Object.assign(o,{ks:t,clientTag:"html5:v"+e}),r&&Object.assign(o,{partnerId:r});var i=new Map;i.set("Content-Type","application/json");var s=new O(i);return s.method="POST",s.service="multirequest",s.url=s.getUrl(n.serviceUrl),s.params=o,s}}]),e}()),S="@playkit-js/playkit-js-providers-stats-service",C="2.42.0-canary.0-07d09a7";return t}()}));
2
2
  //# sourceMappingURL=playkit-stats-service.js.map
@@ -63,6 +63,7 @@ declare type ProviderEnvConfigObject = {
63
63
  useApiCaptions?: boolean;
64
64
  replaceHostOnlyManifestUrls?: boolean;
65
65
  overrideServiceUrl?: string;
66
+ initCallToServer?: string;
66
67
  };
67
68
 
68
69
  declare type ProviderNetworkRetryParameters = {
package/dist/types.d.ts CHANGED
@@ -154,6 +154,7 @@ export declare type ProviderEnvConfigObject = {
154
154
  useApiCaptions?: boolean;
155
155
  replaceHostOnlyManifestUrls?: boolean;
156
156
  overrideServiceUrl?: string;
157
+ initCallToServer?: string;
157
158
  };
158
159
 
159
160
  export declare type ProviderFilterOptionsObject = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playkit-js/playkit-js-providers",
3
- "version": "2.41.4-canary.0-d258629",
3
+ "version": "2.42.0-canary.0-07d09a7",
4
4
  "description": "",
5
5
  "files": [
6
6
  "dist/**/*",
@@ -5,4 +5,5 @@ export type ProviderEnvConfigObject = {
5
5
  useApiCaptions?: boolean;
6
6
  replaceHostOnlyManifestUrls?: boolean;
7
7
  overrideServiceUrl?: string;
8
+ initCallToServer?: string;
8
9
  };