@playkit-js/playkit-js-providers 2.45.0-canary.0-877671b → 2.45.0-canary.0-0441953

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.
@@ -57,6 +57,12 @@ declare class DataLoaderManager {
57
57
  * @protected
58
58
  */
59
59
  protected _multiRequest: MultiRequestBuilder;
60
+ /**
61
+ * @member - Loaders single requests
62
+ * @type {RequestSequenceBuilder}
63
+ * @protected
64
+ */
65
+ protected _singleRequests: RequestSequenceBuilder;
60
66
  /**
61
67
  * @member - Loaders multi response
62
68
  * @type {MultiRequestResult}
@@ -516,6 +522,53 @@ declare class RequestBuilder {
516
522
  private _createError;
517
523
  }
518
524
 
525
+ /**
526
+ * RequestSequenceBuilder provides a builder pattern for executing multiple individual requests
527
+ * sequentially, as an alternative to the MultiRequestBuilder which batches them together.
528
+ * @class RequestSequenceBuilder
529
+ */
530
+ declare class RequestSequenceBuilder {
531
+ private _logger;
532
+ /**
533
+ * Loaders to be executed
534
+ * @type {Map<string, ILoader>}
535
+ * @private
536
+ */
537
+ loaders: Map<string, ILoader>;
538
+ /**
539
+ * Global parameters for all requests
540
+ * @type {Record<string, unknown>}
541
+ * @private
542
+ */
543
+ private _globalParams;
544
+ /**
545
+ * Add a loader to the builder
546
+ * @function add
547
+ * @param {ILoader} loader The loader to add
548
+ */
549
+ add(loader: ILoader): void;
550
+ /**
551
+ * Executes a single request
552
+ * @function execute
553
+ * @param {RequestBuilder} request - The request to execute
554
+ * @returns {Promise<ServiceResult>} - Promise with the service result
555
+ */
556
+ private _executeRequest;
557
+ /**
558
+ * Executes multiple requests sequentially
559
+ * @function executeSequence
560
+ * @param {Array<RequestBuilder>} requests - The requests to execute in order
561
+ * @returns {Promise<SingleRequestsResult>} - Promise with the combined results
562
+ */
563
+ private _executeSequence;
564
+ /**
565
+ * Executes all added loaders as separate requests
566
+ * @function execute
567
+ * @returns {Promise<Map<string, ILoader>>} - Promise with the loaded loaders
568
+ */
569
+ execute(): Promise<Map<string, ILoader>>;
570
+ }
571
+
519
572
  declare class ServiceError {
520
573
  /**
521
574
  * @member - The error code
@@ -71,6 +71,12 @@ declare class DataLoaderManager {
71
71
  * @protected
72
72
  */
73
73
  protected _multiRequest: MultiRequestBuilder;
74
+ /**
75
+ * @member - Loaders single requests
76
+ * @type {RequestSequenceBuilder}
77
+ * @protected
78
+ */
79
+ protected _singleRequests: RequestSequenceBuilder;
74
80
  /**
75
81
  * @member - Loaders multi response
76
82
  * @type {MultiRequestResult}
@@ -1621,6 +1627,53 @@ declare type RequestLoader = {
1621
1627
  params: any;
1622
1628
  };
1623
1629
 
1630
+ /**
1631
+ * RequestSequenceBuilder provides a builder pattern for executing multiple individual requests
1632
+ * sequentially, as an alternative to the MultiRequestBuilder which batches them together.
1633
+ * @class RequestSequenceBuilder
1634
+ */
1635
+ declare class RequestSequenceBuilder {
1636
+ private _logger;
1637
+ /**
1638
+ * Loaders to be executed
1639
+ * @type {Map<string, ILoader>}
1640
+ * @private
1641
+ */
1642
+ loaders: Map<string, ILoader>;
1643
+ /**
1644
+ * Global parameters for all requests
1645
+ * @type {Record<string, unknown>}
1646
+ * @private
1647
+ */
1648
+ private _globalParams;
1649
+ /**
1650
+ * Add a loader to the builder
1651
+ * @function add
1652
+ * @param {ILoader} loader The loader to add
1653
+ */
1654
+ add(loader: ILoader): void;
1655
+ /**
1656
+ * Executes a single request
1657
+ * @function execute
1658
+ * @param {RequestBuilder} request - The request to execute
1659
+ * @returns {Promise<ServiceResult>} - Promise with the service result
1660
+ */
1661
+ private _executeRequest;
1662
+ /**
1663
+ * Executes multiple requests sequentially
1664
+ * @function executeSequence
1665
+ * @param {Array<RequestBuilder>} requests - The requests to execute in order
1666
+ * @returns {Promise<SingleRequestsResult>} - Promise with the combined results
1667
+ */
1668
+ private _executeSequence;
1669
+ /**
1670
+ * Executes all added loaders as separate requests
1671
+ * @function execute
1672
+ * @returns {Promise<Map<string, ILoader>>} - Promise with the loaded loaders
1673
+ */
1674
+ execute(): Promise<Map<string, ILoader>>;
1675
+ }
1676
+
1624
1677
  declare namespace ResponseTypes {
1625
1678
  export {
1626
1679
  KalturaBaseEntryListResponse,
@@ -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,DELETED_ENTRY:2004,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.45.0-canary.0-877671b";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,DELETED_ENTRY:2004,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.45.0-canary.0-0441953";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,DELETED_ENTRY:2004,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.45.0-canary.0-877671b";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,DELETED_ENTRY:2004,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.45.0-canary.0-0441953";return t}()}));
2
2
  //# sourceMappingURL=playkit-bookmark-service.js.map
@@ -1,2 +1,3 @@
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,DELETED_ENTRY:2004,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"}},E=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}(),T=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=E.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 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(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)}(T);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(){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=E.get(),r=[];return r.push(P.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=E.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=E.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,rootEntryId:this.rootEntryId,capabilities:this.capabilities}}}]),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"),E.set(e.env),n._networkRetryConfig=Object.assign(n._networkRetryConfig,e.networkRetryParameters),n}return a(i,[{key:"env",get:function(){return E.get()}},{key:"getMediaConfig",value:function(e){var t=this;return e.ks&&(this.ks=e.ks,this._isAnonymous=!1),this._dataLoader=new D(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 D(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.45.0-canary.0-877671b",ne=U.Type,se=q.Type;return t}()}));
1
+ /*! For license information please see playkit-ott-provider.js.LICENSE.txt */
2
+ !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(){var e={61:function(e,t,r){var n=r(698).default;function o(){"use strict";e.exports=o=function(){return r},e.exports.__esModule=!0,e.exports.default=e.exports;var t,r={},i=Object.prototype,s=i.hasOwnProperty,a=Object.defineProperty||function(e,t,r){e[t]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",f=u.toStringTag||"@@toStringTag";function h(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{h({},"")}catch(t){h=function(e,t,r){return e[t]=r}}function p(e,t,r,n){var o=t&&t.prototype instanceof E?t:E,i=Object.create(o.prototype),s=new x(n||[]);return a(i,"_invoke",{value:A(e,r,s)}),i}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}r.wrap=p;var y="suspendedStart",v="suspendedYield",g="executing",m="completed",_={};function E(){}function R(){}function T(){}var b={};h(b,c,(function(){return this}));var O=Object.getPrototypeOf,w=O&&O(O(D([])));w&&w!==i&&s.call(w,c)&&(b=w);var k=T.prototype=E.prototype=Object.create(b);function S(e){["next","throw","return"].forEach((function(t){h(e,t,(function(e){return this._invoke(t,e)}))}))}function I(e,t){function r(o,i,a,u){var c=d(e[o],e,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==n(f)&&s.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,a,u)}),(function(e){r("throw",e,a,u)})):t.resolve(f).then((function(e){l.value=e,a(l)}),(function(e){return r("throw",e,a,u)}))}u(c.arg)}var o;a(this,"_invoke",{value:function(e,n){function i(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(i,i):i()}})}function A(e,r,n){var o=y;return function(i,s){if(o===g)throw new Error("Generator is already running");if(o===m){if("throw"===i)throw s;return{value:t,done:!0}}for(n.method=i,n.arg=s;;){var a=n.delegate;if(a){var u=C(a,n);if(u){if(u===_)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===y)throw o=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=g;var c=d(e,r,n);if("normal"===c.type){if(o=n.done?m:v,c.arg===_)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=m,n.method="throw",n.arg=c.arg)}}}function C(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,C(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),_;var i=d(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,_;var s=i.arg;return s?s.done?(r[e.resultName]=s.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,_):s:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,_)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function D(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(s.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(n(e)+" is not iterable")}return R.prototype=T,a(k,"constructor",{value:T,configurable:!0}),a(T,"constructor",{value:R,configurable:!0}),R.displayName=h(T,f,"GeneratorFunction"),r.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===R||"GeneratorFunction"===(t.displayName||t.name))},r.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,T):(e.__proto__=T,h(e,f,"GeneratorFunction")),e.prototype=Object.create(k),e},r.awrap=function(e){return{__await:e}},S(I.prototype),h(I.prototype,l,(function(){return this})),r.AsyncIterator=I,r.async=function(e,t,n,o,i){void 0===i&&(i=Promise);var s=new I(p(e,t,n,o),i);return r.isGeneratorFunction(t)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},S(k),h(k,f,"Generator"),h(k,c,(function(){return this})),h(k,"toString",(function(){return"[object Generator]"})),r.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},r.values=D,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(L),!e)for(var r in this)"t"===r.charAt(0)&&s.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=s.call(i,"catchLoc"),c=s.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&s.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,_):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),_},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),_}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:D(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),_}},r}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports},698:function(e){function t(r){return e.exports=t="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},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},687:function(e,t,r){var n=r(61)();e.exports=n;try{regeneratorRuntime=n}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e){return t="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},t(e)}function o(e){var r=function(e,r){if("object"!==t(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,"string");if("object"!==t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===t(r)?r:String(r)}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){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},a(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&&a(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 l(e,r){if(r&&("object"===t(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return c(e)}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function h(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}r.r(n),r.d(n,{ContextType:function(){return de},MediaType:function(){return ye},NAME:function(){return he},Provider:function(){return fe},VERSION:function(){return pe}});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 v=y,g=s((function t(r,n,o){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};e(this,t),this.severity=r,this.category=n,this.code=o,this.data=i,t._logger.error("Category:".concat(n," | Code:").concat(o," |"),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,DELETED_ENTRY:2004,MISSING_MANDATORY_PARAMS:3e3,MISSING_PLAY_SOURCE:3001,METHOD_NOT_IMPLEMENTED:3002}),h(g,"_logger",v("Error"));var m=function(){function t(r,n){e(this,t),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)}(r.logger),this._partnerId=r.partnerId,this._widgetId=r.widgetId,this._uiConfId=r.uiConfId,this._isAnonymous=!r.ks,this._ks=r.ks||"",this._playerVersion=n,this._referrer=r.referrer}return s(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(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)}}]),t}(),_=function e(r){var n;return Array.isArray(r)?(n=r.length>0?r.slice(0):[]).forEach((function(r,o){("object"===t(r)||Array.isArray(r)&&r.length>0)&&(n[o]=e(r))})):"object"===t(r)?(n=Object.assign({},r),Object.keys(n).forEach((function(r){("object"===t(n[r])||Array.isArray(n[r])&&n[r].length>0)&&(n[r]=e(n[r]))}))):n=r,n},E={serviceParams:{apiVersion:"7.8.1"}},R=function(){function t(){e(this,t)}return s(t,null,[{key:"set",value:function(e){e&&Object.assign(E,e)}},{key:"get",value:function(){return _(E)}}]),t}();function T(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function b(e,t,r,n,o,i,s){try{var a=e[i](s),u=a.value}catch(e){return void r(e)}a.done?t(u):Promise.resolve(u).then(n,o)}function O(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function s(e){b(i,n,o,s,a,"next",e)}function a(e){b(i,n,o,s,a,"throw",e)}s(void 0)}))}}var w=r(687),k=r.n(w),S=s((function t(r){e(this,t),h(this,"hasError",!1),"KalturaAPIException"===r.objectType?(this.hasError=!0,this.error=new I(r.code,r.message)):r.error&&"KalturaAPIException"===r.error.objectType?(this.hasError=!0,this.error=new I(r.error.code,r.error.message)):this.data=r})),I=s((function t(r,n){e(this,t),this.code=r,this.message=n}));function A(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return C(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?C(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){a=!0,i=e},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw i}}}}function C(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function P(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function L(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?P(Object(r),!0).forEach((function(t){h(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):P(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var x=function(){function t(){var r;e(this,t),h(this,"_logger",v("RequestSequenceBuilder")),h(this,"loaders",new Map),h(this,"_globalParams",{apiVersion:null===(r=R.get().serviceParams)||void 0===r?void 0:r.apiVersion})}var r,n,o;return s(t,[{key:"add",value:function(e){this.loaders.set(e.constructor.name,e)}},{key:"_executeRequest",value:(o=O(k().mark((function e(t){var r,n,o,i,s;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.params=JSON.stringify(L(L({},this._globalParams),t.params)),e.prev=1,e.next=4,t.doHttpRequest();case 4:return r=e.sent,(n=new S(r.result||r)).hasError&&(o=n.error,i=o.code,s=o.message,this._logger.error("Service returned an error with error code: ".concat(i," and message: ").concat(s,"."))),e.abrupt("return",n);case 10:throw e.prev=10,e.t0=e.catch(1),new g(g.Severity.CRITICAL,g.Category.NETWORK,g.Code.API_RESPONSE_MISMATCH,{error:e.t0,request:t});case 13:case"end":return e.stop()}}),e,this,[[1,10]])}))),function(e){return o.apply(this,arguments)})},{key:"_executeSequence",value:(n=O(k().mark((function e(t){var r,n,o,i,s,a,u,c,l,f;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=[],n=A(t),e.prev=2,n.s();case 4:if((o=n.n()).done){e.next=18;break}return i=o.value,e.prev=6,e.next=9,this._executeRequest(i);case 9:s=e.sent,r.push(s),e.next=16;break;case 13:e.prev=13,e.t0=e.catch(6),this._logger.error("Request execution failed: ".concat(e.t0.message));case 16:e.next=4;break;case 18:e.next=23;break;case 20:e.prev=20,e.t1=e.catch(2),n.e(e.t1);case 23:return e.prev=23,n.f(),e.finish(23);case 26:if(!(a=new D(r)).success){e.next=31;break}return e.abrupt("return",a);case 31:if(!(u=r.find((function(e){return e.hasError})))){e.next=35;break}throw c=u.error,l=c.message,f=c.code,new g(g.Severity.CRITICAL,g.Category.NETWORK,g.Code.API_RESPONSE_MISMATCH,{error:u.error,errorMessage:"Request returned an error: ".concat(l," (code: ").concat(f,")")});case 35:return e.abrupt("return",a);case 36:case"end":return e.stop()}}),e,this,[[2,20,23,26],[6,13]])}))),function(e){return n.apply(this,arguments)})},{key:"execute",value:(r=O(k().mark((function e(){var t,r,n,o,i;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this.loaders.get("OTTSessionLoader"),r=this.loaders.get("OTTAssetLoader"),n="",e.prev=3,!t){e.next=10;break}return e.next=7,this._executeRequest(t.requests[0]);case 7:o=e.sent,t.response=[{data:o.data}],n=o.data.ks||"";case 10:if(!r){e.next=16;break}return r.requests.forEach((function(e){"{1:result:ks}"===e.params.ks&&(e.params.ks=n)})),e.next=14,this._executeSequence(r.requests);case 14:i=e.sent,r.response=i.results;case 16:e.next=21;break;case 18:e.prev=18,e.t0=e.catch(3),this._logger.error("loaders execution failed: ".concat(e.t0.message));case 21:return e.abrupt("return",this.loaders);case 22:case"end":return e.stop()}}),e,this,[[3,18]])}))),function(){return r.apply(this,arguments)})}]),t}(),D=s((function t(r){var n,o=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e(this,t),this.results=function(e){if(Array.isArray(e))return T(e)}(n=r)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||function(e,t){if(e){if("string"==typeof e)return T(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?T(e,t):void 0}}(n)||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 i,s=this.results.filter((function(e){return e.hasError})),a=A(s);try{for(a.s();!(i=a.n()).done;){var u=i.value.error,c=u.code,l=u.message;t._logger.error("Service returned an error with error code: ".concat(c," and message: ").concat(l,"."))}}catch(e){a.e(e)}finally{a.f()}var f=s.length===this.results.length,h=o&&s.length>0;f||h?this.success=!1:(o||(this.results=this.results.filter((function(e){return!e.hasError}))),this.success=!0)}));h(D,"_logger",v("SingleRequestsResult"));var M=function(){function t(r){e(this,t),h(this,"_loadersResponseMap",new Map),h(this,"_loaders",new Map),this._networkRetryConfig=r,this._singleRequests=new x}return s(t,[{key:"add",value:function(e,t,r){var n=this,o=new e(t);if(o.isValid())if(this._loaders.set(e.id,o),o.disableMultirequest)this._singleRequests.add(o);else{var i=this._multiRequest.requests.length,s=o.requests;this._multiRequest.retryConfig=this._networkRetryConfig,s.forEach((function(e){e.params=e.params||{},e.params.ks=e.params.ks||r,n._multiRequest.add(e)}));var a=Array.from(new Array(s.length),(function(e,t){return t+i}));this._loadersResponseMap.set(e.id,a)}}},{key:"fetchData",value:function(e){var t=this;return new Promise((function(r,n){t._singleRequests.loaders.size>0?t._singleRequests.execute().then((function(){return r(t._loaders)})).catch((function(e){return n(e)})):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 o=t._loadersResponseMap.get(n);try{o&&o.length>0&&(r.response=e.results.slice(o[0],o[o.length-1]+1))}catch(e){return{success:!1,error:e}}})),{success:!0,data:this._loaders}}}]),t}(),j=function(){function t(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Map;e(this,t),h(this,"retryConfig",{async:!0,timeout:0,maxAttempts:4}),h(this,"_attemptCounter",1),this.headers=r}return s(t,[{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)}}]),t}();var N=function(t){u(i,t);var r,n,o=(r=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,t=f(r);if(n){var o=f(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return l(this,e)});function i(){var t;e(this,i);for(var r=arguments.length,n=new Array(r),s=0;s<r;s++)n[s]=arguments[s];return h(c(t=o.call.apply(o,[this].concat(n))),"requests",[]),t}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,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(o){var i=new q(o,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}(j);h(N,"_logger",v("MultiRequestBuilder"));var q=s((function t(r){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];e(this,t),h(this,"results",[]);var o=r.result?r.result:r,i=(Array.isArray(o)?o:[o]).map((function(e){return new S(e)})),s=i.filter((function(e){return e.hasError}));s.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=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)}));h(q,"_logger",v("MultiRequestResult"));var B=function(){function t(){e(this,t)}return s(t,null,[{key:"getMultiRequest",value:function(e,t){var r=R.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 N(o);return i.method="POST",i.service="multirequest",i.url=i.getUrl(r.serviceUrl),i.params=n,i}}]),t}();var U=function(t){u(i,t);var r,n,o=(r=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,t=f(r);if(n){var o=f(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return l(this,e)});function i(t){var r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",s=arguments.length>2?arguments[2]:void 0;return e(this,i),(r=o.call(this,s))._multiRequest=B.getMultiRequest(n,t),r}return s(i)}(M);var V=function(t){u(i,t);var r,n,o=(r=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,t=f(r);if(n){var o=f(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return l(this,e)});function i(){return e(this,i),o.apply(this,arguments)}return s(i,null,[{key:"anonymousLogin",value:function(e,t,r){var n=new Map;n.set("Content-Type","application/json");var o=new j(n);o.service="ottuser",o.action="anonymousLogin",o.method="POST",o.url=o.getUrl(e);var i={partnerId:t};return r&&Object.assign(i,{udid:r}),o.params=i,o}}]),i}(B),H=function(){function t(r){e(this,t),h(this,"_response",{}),h(this,"_disableMultirequest",R.get().ottDisableMultirequest),this.requests=this.buildRequests(r),this._partnerId=r.partnerId}return s(t,[{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:"disableMultirequest",get:function(){return this._disableMultirequest}},{key:"buildRequests",value:function(e){var t=R.get(),r=[];return r.push(V.anonymousLogin(t.serviceUrl,e.partnerId,e.udid)),r}},{key:"isValid",value:function(){return!!this._partnerId}}],[{key:"id",get:function(){return"session"}}]),t}();var F="asset",K=function(t){u(i,t);var r,n,o=(r=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,t=f(r);if(n){var o=f(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return l(this,e)});function i(){return e(this,i),o.apply(this,arguments)}return s(i,null,[{key:"getPlaybackContext",value:function(e,t,r,n,o){var i=new Map;i.set("Content-Type","application/json");var s=new j(i);s.service=F,s.action="getPlaybackContext",s.method="POST",s.url=s.getUrl(e);var a={objectType:"KalturaPlaybackContextOptions"};return Object.assign(a,o),s.params={assetId:r,assetType:n,contextDataParams:a,ks:t},s}},{key:"get",value:function(e,t,r,n){var o=new Map;o.set("Content-Type","application/json");var i=new j(o);return i.service=F,i.action="get",i.method="POST",i.url=i.getUrl(e),i.params={id:r,assetReferenceType:n,ks:t},i}}]),i}(B),Y=s((function t(r){e(this,t),this.message=r.message,this.code=r.code})),G=s((function t(r){e(this,t),this.type=r.type}));h(G,"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 W=s((function t(r){e(this,t),this.scheme=r.scheme,this.licenseURL=r.licenseURL,this.certificate=r.certificate}));h(W,"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 J=function(){function t(r){var n=this;e(this,t),h(this,"drm",[]),this.format=r.format,this.adsPolicy=r.adsPolicy,this.adsParam=r.adsParam,this.duration=r.duration,this.url=r.url,this.type=r.type,this.fileId=r.id,this.protocols=r.protocols,r.drm&&r.drm.map((function(e){return n.drm.push(new W(e))}))}return s(t,[{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}}]),t}(),X=s((function t(r){e(this,t),this.streamertype=r.streamertype,this.url=r.url}));h(X,"StreamerType",{HLS:"hls",DASH:"dash",PROGRESSIVE:"progressive"});var Q=function(t){u(i,t);var r,n,o=(r=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,t=f(r);if(n){var o=f(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return l(this,e)});function i(t){var r;if(e(this,i),h(c(r=o.call(this,t)),"sources",[]),h(c(r),"actions",[]),h(c(r),"messages",[]),h(c(r),"plugins",[]),!r.hasError){var n=t.messages;n&&n.map((function(e){return r.messages.push(new Y(e))}));var s=t.actions;s&&s.map((function(e){return r.actions.push(new G(e))}));var a=t.sources;a&&a.map((function(e){return r.sources.push(new J(e))}));var u=t.plugins;u&&u.map((function(e){return r.plugins.push(new X(e))}))}return r}return s(i,[{key:"hasBlockAction",value:function(){return void 0!==this.getBlockAction()}},{key:"getBlockAction",value:function(){return this.actions.find((function(e){return e.type===G.Type.BLOCK}))}},{key:"getErrorMessages",value:function(){return this.messages}}]),i}(S);h(Q,"Type",{DOWNLOAD:"DOWNLOAD",TRAILER:"TRAILER",CATCHUP:"CATCHUP",START_OVER:"START_OVER",PLAYBACK:"PLAYBACK"});var $=function(t){u(i,t);var r,n,o=(r=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,t=f(r);if(n){var o=f(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return l(this,e)});function i(t){var r;return e(this,i),h(c(r=o.call(this,t)),"name",""),h(c(r),"description",""),h(c(r),"tags",[]),h(c(r),"metas",[]),h(c(r),"pictures",[]),r.hasError||(r.id=t.id,r.name=t.name,r.description=t.description,r.createDate=t.createDate,r.endDate=t.endDate,r.plays=t.plays,r.views=t.views,r.metas=r._formatTagsMetas(t.metas),r.tags=r._formatTagsMetas(t.tags),r.pictures=t.images),r}return s(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}(S);h($,"Type",{MEDIA:"media",RECORDING:"recording",EPG:"epg"}),h($,"AssetReferenceType",{MEDIA:"media",EPG_INTERNAL:"epg_internal",EPG_EXTERNAL:"epg_external",NPVR:"nPVR"});var z=function(){function t(r){e(this,t),h(this,"_response",{}),h(this,"_disableMultirequest",R.get().ottDisableMultirequest),this.requests=this.buildRequests(r),this._entryId=r.entryId}return s(t,[{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 $(e[0].data),this._response.playBackContextResult=new Q(e[1].data)}},{key:"disableMultirequest",get:function(){return this._disableMultirequest}},{key:"buildRequests",value:function(e){var t=R.get(),r=[];return r.push(K.get(t.serviceUrl,e.ks,e.entryId,e.assetReferenceType)),r.push(K.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"}}]),t}(),Z=function(){function t(r){e(this,t),h(this,"_response",{playlistItems:{entries:[]}}),this.requests=this.buildRequests(r),this._entries=r.entries}return s(t,[{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 $(e.data)})}))}},{key:"buildRequests",value:function(e){var t=R.get(),r=[];return e.entries.forEach((function(n){var o=n.assetReferenceType||$.AssetReferenceType.MEDIA;r.push(K.get(t.serviceUrl,e.ks,n.entryId||n,o))})),r}},{key:"isValid",value:function(){return!(!this._entries||!this._entries.length)}}],[{key:"id",get:function(){return"asset_list"}}]),t}(),ee={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"}},te=new Map([["mpegdash",ee.DASH],["applehttp",ee.HLS],["url",ee.MP4]]);function re(e){var t=te.get(e);return!!t&&t.name===ee.MP4.name}var ne=function(){function t(){e(this,t),this.progressive=[],this.dash=[],this.hls=[],this.image=[],this.document=[]}return s(t,[{key:"map",value:function(e,t){if(t)switch(t.name){case ee.MP4.name:this.progressive.push(e);break;case ee.DASH.name:this.dash.push(e);break;case ee.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}}]),t}(),oe=function(){function t(){e(this,t),this.metadata=new Map,this.sources=new ne,this.type=t.Type.UNKNOWN}return s(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,rootEntryId:this.rootEntryId,capabilities:this.capabilities}}}]),t}();h(oe,"Type",{VOD:"Vod",LIVE:"Live",IMAGE:"Image",AUDIO:"Audio",UNKNOWN:"Unknown",DOCUMENT:"Document"}),h(oe,"DvrStatus",{ON:1,OFF:0});var ie=function(){function t(r,n,o){e(this,t),this.licenseUrl=r,this.scheme=n,o&&(this.certificate=o)}return s(t,[{key:"toJSON",value:function(){var e={licenseUrl:this.licenseUrl,scheme:this.scheme};return this.certificate&&(e.certificate=this.certificate),e}}]),t}(),se=function(){function t(){e(this,t)}return s(t,[{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}}]),t}(),ae=s((function t(){e(this,t),this.items=[]})),ue=s((function t(r){e(this,t),this.url=r.url,this.clickThroughUrl=r.clickThroughUrl})),ce=h(h(h({},$.Type.MEDIA,h(h({},Q.Type.TRAILER,(function(){return{type:oe.Type.VOD}})),Q.Type.PLAYBACK,(function(e){return"KalturaLiveAsset"===e.objectType?{type:oe.Type.LIVE,dvrStatus:e.enableTrickPlay?oe.DvrStatus.ON:oe.DvrStatus.OFF}:parseInt(e.externalIds)>0?{type:oe.Type.LIVE,dvrStatus:oe.DvrStatus.OFF}:{type:oe.Type.VOD}}))),$.Type.EPG,h(h({},Q.Type.CATCHUP,(function(){return{type:oe.Type.VOD}})),Q.Type.START_OVER,(function(){return{type:oe.Type.LIVE,dvrStatus:oe.DvrStatus.ON}}))),$.Type.RECORDING,h({},Q.Type.PLAYBACK,(function(){return{type:oe.Type.VOD}}))),le=function(){function t(){e(this,t)}return s(t,null,[{key:"getMediaEntry",value:function(e,r){var n=new oe;t._fillBaseData(n,e,r);var o=e.playBackContextResult,i=e.mediaDataResult,s=o.sources,a=t._filterSourcesByFormats(s,r.formats);n.sources=t._getParsedSources(a);var u=t._getMediaType(i.data,r.mediaType,r.contextType);return n.type=u.type,n.dvrStatus=u.dvrStatus,n.duration=Math.max.apply(Math,s.map((function(e){return e.duration}))),n}},{key:"getEntryList",value:function(e,r){var n=new ae;return e.playlistItems.entries.forEach((function(e){var o=new oe,i=r.find((function(t){return t.entryId===e.mediaDataResult.id}));t._fillBaseData(o,e,i),n.items.push(o)})),n}},{key:"getBumper",value:function(e){var t=e.playBackContextResult.plugins.find((function(e){return e.streamertype===X.StreamerType.PROGRESSIVE}));if(t)return new ue(t)}},{key:"_fillBaseData",value:function(e,r,n){var o=r.mediaDataResult,i=t.reconstructMetadata(o);return i.description=o.description,i.name=o.name,o.createDate&&(i.createdAt=o.createDate),o.endDate&&(i.endDate=o.endDate),o.data.entryId&&(i.entryId=o.data.entryId),o.data.epgId&&(i.epgId=o.data.epgId),o.data.recordingId&&(i.recordingId=o.data.recordingId),n&&n.mediaType&&(i.mediaType=n.mediaType),n&&n.contextType&&(i.contextType=n.contextType),e.metadata=i,e.poster=t._getPoster(o.pictures),e.id=o.id,e}},{key:"reconstructMetadata",value:function(e){return{metas:t.addToMetaObject(e.metas),tags:t.addToMetaObject(e.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:oe.Type.UNKNOWN};return ce[t]&&ce[t][r]&&(n=ce[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(e){var r=new ne,n=function(e){var n=t._parseAdaptiveSource(e);if(n){var o=te.get(e.format);r.map(n,o)}};return e&&e.length>0&&(e.filter((function(e){return!re(e.format)})).forEach(n),e.filter((function(e){return re(e.format)})).forEach(n)),r}},{key:"_parseAdaptiveSource",value:function(e){var r=new se;if(e){var n=e.url,o=te.get(e.format);if(o&&(r.mimetype=o.mimeType),!n)return t._logger.error("failed to create play url from source, discarding source: (".concat(e.fileId,"), ").concat(e.format,".")),null;if(r.url=n,r.id=e.fileId+","+e.format,e.hasDrmData()){var i=[];e.drm.forEach((function(e){i.push(new ie(e.licenseURL,W.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()}}]),t}();h(le,"_logger",v("OTTProviderParser"));var fe=function(t){u(i,t);var r,n,o=(r=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,t=f(r);if(n){var o=f(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return l(this,e)});function i(t,r){var n;return e(this,i),(n=o.call(this,t,r))._logger=v("OTTProvider"),R.set(t.env),n._networkRetryConfig=Object.assign(n._networkRetryConfig,t.networkRetryParameters),n}return s(i,[{key:"env",get:function(){return R.get()}},{key:"getMediaConfig",value:function(e){var t=this;return e.ks&&(this.ks=e.ks,this._isAnonymous=!1),this._dataLoader=new U(this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var o=e.entryId;if(o){var i=t.ks;i||(i="{1:result:ks}",t._dataLoader.add(H,{partnerId:t.partnerId}));var s=e.contextType||Q.Type.PLAYBACK,a=e.mediaType||$.Type.MEDIA,u=e.assetReferenceType||$.AssetReferenceType.MEDIA,c={mediaProtocol:e.protocol,assetFileIds:e.fileIds,context:s};e.streamerType&&(c.streamerType=e.streamerType),e.urlType&&(c.urlType=e.urlType),e.adapterData&&(c.adapterData=e.adapterData),t._dataLoader.add(z,{entryId:o,ks:i,type:a,playbackContext:c,assetReferenceType:u});var l={contextType:s,mediaType:a,formats:e.formats||[]};return t._dataLoader.fetchData().then((function(e){try{r(t._parseDataFromResponse(e,l))}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(H.id)){var n=e.get(H.id);n&&n.response&&(r.session.ks=n.response)}else r.session.ks=this.ks;if(e.has(z.id)){var o=e.get(z.id);if(o&&o.response&&Object.keys(o.response).length){var i=o.response;if(le.hasBlockAction(i))throw new g(g.Severity.CRITICAL,g.Category.SERVICE,g.Code.BLOCK_ACTION,{action:le.getBlockAction(i),messages:le.getErrorMessages(i)});var s=le.getMediaEntry(i,t);Object.assign(r.sources,this._getSourcesObject(s)),this._verifyHasSources(r.sources);var a=le.getBumper(i);a&&Object.assign(r.plugins,{bumper:a})}}}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 U(this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var o=e.entries;if(o&&o.length){var i=t.ks;i||(i="{1:result:ks}",t._dataLoader.add(H,{partnerId:t.partnerId})),t._dataLoader.add(Z,{entries:o,ks:i}),t._dataLoader.fetchData(!1).then((function(e){r(t._parseEntryListDataFromResponse(e,o))}),(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(Z.id)){var o=e.get(Z.id);o&&o.response&&le.getEntryList(o.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:oe.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}(m),he="@playkit-js/playkit-js-providers-ott",pe="2.45.0-canary.0-0441953",de=Q.Type,ye=$.Type}(),n}()}));
2
3
  //# sourceMappingURL=playkit-ott-provider.js.map
@@ -0,0 +1 @@
1
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */