@playkit-js/playkit-js-providers 2.39.2 → 2.39.3-canary.0-edd6027

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.
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ovp=t():(e.playkit=e.playkit||{},e.playkit.providers=e.playkit.providers||{},e.playkit.providers.ovp=t())}(window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=18)}([function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(2);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=function e(t,r,n,i){void 0===i&&(i={}),this.severity=t,this.category=r,this.code=n,this.data=i,e._logger.error("Category:"+r+" | Code:"+n+" |",i)};i(a,"Severity",{RECOVERABLE:1,CRITICAL:2}),i(a,"Category",{NETWORK:1,SERVICE:2,PROVIDER:3}),i(a,"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,MISSING_MANDATORY_PARAMS:3e3,MISSING_PLAY_SOURCE:3001,METHOD_NOT_IMPLEMENTED:3002}),i(a,"_logger",Object(n.b)("Error"))},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(8);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=function(){function e(){this.metadata=new Map,this.sources=new n.a,this.type=e.Type.UNKNOWN}return e.prototype.toJSON=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}},e}();i(a,"Type",{VOD:"Vod",LIVE:"Live",IMAGE:"Image",AUDIO:"Audio",UNKNOWN:"Unknown"}),i(a,"DvrStatus",{ON:1,OFF:0})},function(e,t,r){"use strict";r.d(t,"c",(function(){return o})),r.d(t,"d",(function(){return u})),r.d(t,"e",(function(){return a})),r.d(t,"a",(function(){return i}));var n={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(){}}}},i={};function a(e){e&&"function"==typeof e.getLogger&&(n.get=e.getLogger),e&&e.LogLevel&&(i=e.LogLevel)}function s(e){return n.get(e)}function o(e){return s(e).getLevel()}function u(e,t){s(t).setLevel(e)}t.b=s},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=function(){function e(e){void 0===e&&(e=new Map),i(this,"retryConfig",{async:!0,timeout:0,maxAttempts:4}),i(this,"_attemptCounter",1),this.headers=e}var t=e.prototype;return t.getUrl=function(e){return e+"/service/"+this.service+(this.action?"/action/"+this.action:"")},t.doHttpRequest=function(){var e=this,t=new Promise((function(t,r){e._requestPromise={resolve:t,reject:r}}));return this.url||this._requestPromise.reject(new n.a(n.a.Severity.CRITICAL,n.a.Category.NETWORK,n.a.Code.MALFORMED_DATA_URI,{url:this.url})),this._createXHR(),t},t._createXHR=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,n.a.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,n.a.Code.TIMEOUT,{timeout:(performance.now()-r)/1e3,statusText:t.statusText})},t.onerror=t.onabort=function(){e._handleError(t,n.a.Code.HTTP_ERROR,{text:t.responseText,statusText:t.statusText})},this.headers.forEach((function(e,r){t.setRequestHeader(r,e)})),t.send(this.params)},t._getResponseHeaders=function(e){return e.getAllResponseHeaders().split("\n").filter((function(e){return 0===e.toLowerCase().indexOf("x-")}))},t._handleError=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()},t._createError=function(e,t,r){return Object.assign(r,{url:this.url,headers:this._getResponseHeaders(e),attempt:this._attemptCounter}),new n.a(n.a.Severity.CRITICAL,n.a.Category.NETWORK,t,r)},e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function(e){var t,r,n;n=!1,(r="hasError")in(t=this)?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,"KalturaAPIException"===e.objectType?(this.hasError=!0,this.error=new i(e.code,e.message)):e.error&&"KalturaAPIException"===e.error.objectType?(this.hasError=!0,this.error=new i(e.error.code,e.error.message)):this.data=e},i=function(e,t){this.code=e,this.message=t}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return i})),r.d(t,"c",(function(){return a}));var n={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"}},i=new Map([["mpegdash",n.DASH],["applehttp",n.HLS],["url",n.MP4]]);function a(e){var t=i.get(e);return!!t&&t.name===n.MP4.name}},function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n,i,a,s=function(e){this.scheme=e.scheme,this.licenseURL=e.licenseURL,this.certificate=e.certificate};a={"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"},(i="Scheme")in(n=s)?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function(e){this.message=e.message,this.code=e.code}},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));r(9);var n=r(5),i=(r(13),function(){function e(){this.progressive=[],this.dash=[],this.hls=[],this.image=[]}var t=e.prototype;return t.map=function(e,t){if(t)switch(t.name){case n.a.MP4.name:this.progressive.push(e);break;case n.a.DASH.name:this.dash.push(e);break;case n.a.HLS.name:this.hls.push(e)}},t.toJSON=function(){var e={progressive:[],dash:[],hls:[],image:[]};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},e}())},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));r(12);var n=function(){function e(){}return e.prototype.toJSON=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}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));r(11);var n=r(0);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=function(){function e(e){i(this,"_loadersResponseMap",new Map),i(this,"_loaders",new Map),this._networkRetryConfig=e}var t=e.prototype;return t.add=function(e,t,r){var n=this,i=new e(t);if(i.isValid()){this._loaders.set(e.id,i);var a=this._multiRequest.requests.length,s=i.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 o=Array.from(new Array(s.length),(function(e,t){return t+a}));this._loadersResponseMap.set(e.id,o)}},t.fetchData=function(e){var t=this;return new Promise((function(r,i){t._multiRequest.execute(e).then((function(e){t._multiResponse=e.response,t.prepareData(e.response).success?r(t._loaders):i(new n.a(n.a.Severity.CRITICAL,n.a.Category.NETWORK,n.a.Code.API_RESPONSE_MISMATCH,{headers:e.headers}))}),(function(e){i(e)}))}))},t.prepareData=function(e){var t=this;return this._loaders.forEach((function(r,n){var i=t._loadersResponseMap.get(n);try{i&&i.length>0&&(r.response=e.results.slice(i[0],i[i.length-1]+1))}catch(e){return{success:!1,error:e}}})),{success:!0,data:this._loaders}},e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(3),i=r(2),a=r(4),s=r(0);function o(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var c=function(e){var t,r;function n(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return u(o(t=e.call.apply(e,[this].concat(n))||this),"requests",[]),t}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var i=n.prototype;return i.add=function(e){var t;this.requests.push(e);var r={},n={service:e.service,action:e.action};return Object.assign(r,((t={})[this.requests.length]=Object.assign(n,e.params),t)),Object.assign(r,this.params),this.params=r,this},i.execute=function(e){var t=this;return new Promise((function(r,i){try{t.params=JSON.stringify(t.params)}catch(e){n._logger.error(""+e.message),i(new s.a(s.a.Severity.CRITICAL,s.a.Category.PROVIDER,s.a.Code.FAILED_PARSING_REQUEST,{error:e,params:t.params}))}t.doHttpRequest().then((function(n){var a=new l(n,e);a.success?r({headers:t.responseHeaders,response:a}):i(new s.a(s.a.Severity.CRITICAL,s.a.Category.NETWORK,s.a.Code.MULTIREQUEST_API_ERROR,{url:t.url,headers:t.responseHeaders,results:a.results}))}),(function(e){i(e)}))}))},n}(n.a);u(c,"_logger",Object(i.b)("MultiRequestBuilder"));var l=function e(t,r){void 0===r&&(r=!0),u(this,"results",[]);var n=t.result?t.result:t,i=(Array.isArray(n)?n:[n]).map((function(e){return new a.a(e)})),s=i.filter((function(e){return e.hasError}));s.forEach((function(t){e._logger.error("Service returned an error with error code: "+t.error.code+" and message: "+t.error.message+".")})),this.results=i,r&&s.length||s.length===this.results.length?this.success=!1:(this.results=this.results.filter((function(e){return!e.hasError})),this.success=!0)};u(l,"_logger",Object(i.b)("MultiRequestResult"))},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function(){function e(e,t,r){this.licenseUrl=e,this.scheme=t,r&&(this.certificate=r)}return e.prototype.toJSON=function(){var e={licenseUrl:this.licenseUrl,scheme:this.scheme};return this.certificate&&(e.certificate=this.certificate),e},e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function(){function e(t){this.id=t.id,this.url=e.extractBaseThumbnailUrl(t.dataUrl),this.mimetype=""}return e.extractBaseThumbnailUrl=function(e){return e.match(".+entry_id/[a-zA-Z0-9_]+/")[0].slice(0,-1)},e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(2),i=(r(10),r(0));function a(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,n.key,n)}}function s(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),e}var o=function(){function e(e,t){var r,i,a;a={async:!0,timeout:0,maxAttempts:4},(i="_networkRetryConfig")in(r=this)?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a,Object(n.e)(e.logger),this._partnerId=e.partnerId,this._widgetId=e.widgetId,this._uiConfId=e.uiConfId,this._isAnonymous=!e.ks,this._ks=e.ks||"",this._playerVersion=t}s(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}}]);var t=e.prototype;return t.getMediaConfig=function(e){return Promise.reject(new i.a(i.a.Severity.CRITICAL,i.a.Category.PROVIDER,i.a.Code.METHOD_NOT_IMPLEMENTED,{message:"getMediaConfig method must be implement by the derived class"}))},t.getPlaylistConfig=function(e){return Promise.reject(new i.a(i.a.Severity.CRITICAL,i.a.Category.PROVIDER,i.a.Code.METHOD_NOT_IMPLEMENTED,{message:"The provider does not support loading playlist by id"}))},t.getEntryListConfig=function(e){return Promise.reject(new i.a(i.a.Severity.CRITICAL,i.a.Category.PROVIDER,i.a.Code.METHOD_NOT_IMPLEMENTED,{message:"The provider does not support loading entry list"}))},t._verifyHasSources=function(e){if(0===e.hls.concat(e.dash,e.progressive,e.image).length)throw new i.a(i.a.Severity.CRITICAL,i.a.Category.SERVICE,i.a.Code.MISSING_PLAY_SOURCE,{action:"",messages:"No play source for entry id: "+e.id})},t.getLogLevel=function(e){return Object(n.c)(e)},t.setLogLevel=function(e,t){Object(n.d)(e,t)},s(e,[{key:"LogLevel",get:function(){return n.a}}]),e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function e(t){var r;return Array.isArray(t)?(r=t.length>0?t.slice(0):[]).forEach((function(t,n){("object"==typeof t&&t!=={}||Array.isArray(t)&&t.length>0)&&(r[n]=e(t))})):"object"==typeof t?(r=Object.assign({},t),Object.keys(r).forEach((function(t){("object"==typeof r[t]&&r[t]!=={}||Array.isArray(r[t])&&r[t].length>0)&&(r[t]=e(r[t]))}))):r=t,r}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));r(1);var n=function(){this.items=[]}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function(e){this.url=e.url,this.clickThroughUrl=e.clickThroughUrl}},function(e,t,r){"use strict";r.r(t),r.d(t,"Provider",(function(){return Ie})),r.d(t,"ProviderParser",(function(){return H})),r.d(t,"NAME",(function(){return Re})),r.d(t,"VERSION",(function(){return Te})),r.d(t,"RequestBuilder",(function(){return K.a})),r.d(t,"ResponseTypes",(function(){return n}));var n={};r.r(n),r.d(n,"KalturaBaseEntryListResponse",(function(){return Q})),r.d(n,"KalturaMediaEntry",(function(){return C})),r.d(n,"KalturaAccessControlModifyRequestHostRegexAction",(function(){return y})),r.d(n,"KalturaBumper",(function(){return v})),r.d(n,"KalturaFlavorAsset",(function(){return m})),r.d(n,"KalturaMediaEntries",(function(){return se})),r.d(n,"KalturaMetadata",(function(){return R})),r.d(n,"KalturaMetadataListResponse",(function(){return T})),r.d(n,"KalturaPlaybackContext",(function(){return b})),r.d(n,"KalturaPlaybackSource",(function(){return d})),r.d(n,"KalturaPlaylist",(function(){return ae})),r.d(n,"KalturaRuleAction",(function(){return g})),r.d(n,"KalturaUIConfResponse",(function(){return ye})),r.d(n,"KalturaDrmPlaybackPluginData",(function(){return l.a})),r.d(n,"KalturaAccessControlMessage",(function(){return c.a})),r.d(n,"BaseServiceResult",(function(){return u.a}));var i=r(2),a=r(15),s={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},o=function(){function e(){}return e.set=function(e){e&&Object.assign(s,e)},e.get=function(){return Object(a.a)(s)},e}(),u=r(4),c=r(7),l=r(6);var d=function(){function e(e){var t,r,n,i=this;n=[],(r="drm")in(t=this)?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,this.format=e.format,this.deliveryProfileId=e.deliveryProfileId,this.url=e.url,this.protocols=e.protocols,this.flavorIds=e.flavorIds,e.drm&&e.drm.map((function(e){return i.drm.push(new l.a(e))}))}var t=e.prototype;return t.hasDrmData=function(){return this.drm&&this.drm.length>0},t.hasFlavorIds=function(){return!!this.flavorIds&&this.flavorIds.length>0},t.getProtocol=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}();var f,p,h,g=function(e){this.type=e.type};h={DRM_POLICY:"drm.DRM_POLICY",BLOCK:1,PREVIEW:2,LIMIT_FLAVORS:3,ADD_TO_STORAGE:4,LIMIT_DELIVERY_PROFILES:5,SERVE_FROM_REMOTE_SERVER:6,REQUEST_HOST_REGEX:7,LIMIT_THUMBNAIL_CAPTURE:8},(p="Type")in(f=g)?Object.defineProperty(f,p,{value:h,enumerable:!0,configurable:!0,writable:!0}):f[p]=h;var y=function(e){var t,r;function n(t){var r;return(r=e.call(this,t)||this).pattern=t.pattern,r.replacement=t.replacement,r.replacmenServerNodeId=t.replacmenServerNodeId,r.checkAliveTimeoutMs=t.checkAliveTimeoutMs,r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n}(g);var m=function(e){this.id=e.id,this.flavorParamsId=e.flavorParamsId,this.fileExt=e.fileExt,this.bitrate=e.bitrate,this.width=e.width,this.height=e.height,this.id=e.id,this.frameRate=e.frameRate,this.isOriginal=e.isOriginal,this.isWeb=e.isWeb,this.containerFormat=e.containerFormat,this.videoCodecId=e.videoCodecId,this.status=e.status,this.language=e.language,this.label=e.label};!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(m,"Status",{ERROR:-1,QUEUED:0,CONVERTING:1,READY:2,DELETED:3,NOT_APPLICABLE:4,TEMP:5,WAIT_FOR_CONVERT:6,IMPORTING:7,VALIDATING:8,EXPORTING:9});var v=function(e){this.entryId=e.entryId,this.clickThroughUrl=e.url,this.sources=e.sources?e.sources.map((function(e){return new d(e)})):[]};function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function E(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var b=function(e){var t,r;function n(t){var r;if(E(_(r=e.call(this,t)||this),"sources",[]),E(_(r),"actions",[]),E(_(r),"messages",[]),E(_(r),"flavorAssets",[]),E(_(r),"bumperData",[]),!r.hasError){var n=t.messages;n&&n.map((function(e){return r.messages.push(new c.a(e))}));var i=t.actions;i&&i.map((function(e){e.type===g.Type.REQUEST_HOST_REGEX?r.actions.push(new y(e)):r.actions.push(new g(e))}));var a=t.sources;a&&a.map((function(e){return r.sources.push(new d(e))}));var s=t.flavorAssets;s&&s.map((function(e){return r.flavorAssets.push(new m(e))}));var o=t.bumperData;o&&o.map((function(e){return r.bumperData.push(new v(e))}))}return r}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var i=n.prototype;return i.hasBlockAction=function(){return void 0!==this.getBlockAction()},i.getBlockAction=function(){return this.actions.find((function(e){return e.type===g.Type.BLOCK}))},i.getErrorMessages=function(){return this.messages},i.getRequestHostRegexAction=function(){var e=this.actions.find((function(e){return e.type===g.Type.REQUEST_HOST_REGEX}));if(e instanceof y)return e},n}(u.a);function I(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var R=function(e){this.id=e.id,this.metadataProfileId=e.metadataProfileId,this.metadataProfileVersion=e.metadataProfileVersion,this.metadataProfileId=e.metadataProfileId,this.metadataObjectType=e.metadataObjectType,this.objectId=e.objectId,this.version=e.version,this.created=new Date(0),this.created.setUTCSeconds(e.createdAt),this.updated=new Date(0),this.updated.setUTCSeconds(e.updatedAt),this.status=e.status,this.xml=e.xml};I(R,"ObjectType",{AD_CUE_POINT:"adCuePointMetadata.AdCuePoint",ANNOTATION:"annotationMetadata.Annotation",CODE_CUE_POINT:"codeCuePointMetadata.CodeCuePoint",THUMB_CUE_POINT:"thumbCuePointMetadata.thumbCuePoint",ENTRY:1,CATEGORY:2,USER:3,PARTNER:4,DYNAMIC_OBJECT:5}),I(R,"Status",{VALID:1,INVALID:2,DELETED:3});var T=function(e){var t,r;function n(t){var r;return(r=e.call(this,t)||this).hasError||(r.totalCount=t.totalCount,r.totalCount>0&&(r.metas=[],t.objects.map((function(e){return r.metas.push(new R(e))})))),r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n}(u.a);function O(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var C=function(e){this.id=e.id,this.referenceId=e.referenceId,this.externalSourceType=e.externalSourceType,this.name=e.name,this.description=e.description,this.dataUrl=e.dataUrl,this.type=e.type,this.entryType=e.mediaType,this.flavorParamsIds=e.flavorParamsIds,this.duration=e.duration,this.poster=e.thumbnailUrl,this.status=e.status,this.dvrStatus=e.dvrStatus,this.tags=e.tags};O(C,"EntryType",{AUTOMATIC:{value:-1},EXTERNAL_MEDIA:{value:"externalMedia.externalMedia"},MEDIA_CLIP:{value:1},MIX:{value:2},PLAYLIST:{value:5},DATA:{value:6},LIVE_STREAM:{value:7},LIVE_CHANNEL:{value:8},DOCUMENT:{value:10}}),O(C,"MediaType",{VIDEO:{value:1},IMAGE:{value:2},AUDIO:{value:5},LIVE_STREAM_FLASH:{value:201},LIVE_STREAM_WINDOWS_MEDIA:{value:202},LIVE_STREAM_REAL_MEDIA:{value:203},LIVE_STREAM_QUICK_TIME:{value:204}}),O(C,"EntryStatus",{ERROR_IMPORTING:-2,ERROR_CONVERTING:-1,SCAN_FAILURE:"virusScan.ScanFailure",IMPORT:0,INFECTED:"virusScan.Infected",PRECONVERT:1,READY:2,DELETED:3,PENDING:4,MODERATE:5,BLOCKED:6,NO_CONTENT:7}),O(C,"EntryModerationStatus",{PENDING_MODERATION:1,APPROVED:2,REJECTED:3,FLAGGED_FOR_REVIEW:4,MODERATE:5,AUTO_APPROVED:6});var A=function(){function e(){}return e.build=function(e){var t=o.get(),r=t.serviceUrl.substr(0,t.serviceUrl.lastIndexOf("/")),n=e.partnerId,i=e.entryId,a=e.ks,s=e.uiConfId,u=e.format,c=e.protocol,l=e.extension,d=e.flavorIds;if(!r||isNaN(Number.parseInt(n))||!i||!u||!c)return"";var f=r;return r.endsWith("/")||(f+="/"),f+="p/"+n+"/sp/"+n+"00/playManifest/entryId/"+i+"/protocol/"+c+"/format/"+u,d?f+="/flavorIds/"+d:s&&(f+="/uiConfId/"+s),""!==a&&(f+="/ks/"+a),""!==l&&(f+="/a."+l),s&&""!==d&&(f+="?uiConfId="+s),f},e}(),P=function(){function e(){}return e.xmlToJson=function(e){var t={};if(1===e.nodeType){if(e.attributes.length>0){t["@attributes"]={};for(var r=0;r<e.attributes.length;r++){var n=e.attributes.item(r);t["@attributes"][n.nodeName]=n.nodeValue}}}else 3===e.nodeType&&(t=e.nodeValue);if(e.hasChildNodes())for(var i=0;i<e.childNodes.length;i++){var a=e.childNodes.item(i),s=a.nodeName;if(void 0===t[s])t[s]=this.xmlToJson(a);else{if(void 0===t[s].push){var o=t[s];t[s]=[],t[s].push(o)}t[s].push(this.xmlToJson(a))}}return t},e}(),w=r(1),S=r(12),D=r(9),M=r(8),k=r(5),L=function(){this.items=[]},N=r(16),j=r(17),x={SRT:"1",DFXP:"2",WEBVTT:"3",CAP:"4"},U={3:"vtt",1:"srt"},V=function(){function e(){}return e.createConfig=function(e,t){return e.map((function(e){var r=e.url,n=U[e.format];return[x.DFXP,x.CAP].includes(e.format)&&(r=e.webVttUrl,n=U[x.WEBVTT]),r=B(r,t),{default:!!e.isDefault,type:n,language:e.languageCode,label:e.label,url:r}}))},e}(),F=r(13);var q=function(){function e(){}return e.getMediaEntry=function(t,r,n,i){var a=new w.a,s=i.entry,u=i.playBackContextResult,c=i.metadataListResult,l=u.sources;return a.sources=e._getParsedSources(l,t,r,n,s,u),e._fillBaseData(a,s,c),a.type!==w.a.Type.LIVE&&o.get().useApiCaptions&&u.data.playbackCaptions&&(a.sources.captions=V.createConfig(u.data.playbackCaptions,t)),a},e.addKsToUrl=function(e,t){var r;return t?(r=-1!==e.split("?")[0].replace(/^.*[\\/]/,"").indexOf(".")?-1===e.indexOf("?")?"?ks=":"&ks=":"/ks/",e+r+t):e},e.getPlaylist=function(t){var r=new L,n=t.playlistData,i=t.playlistItems.entries;return r.id=n.id,r.name=n.name,r.description=n.description,r.poster=n.poster,i.forEach((function(t){var n=new w.a;e._fillBaseData(n,t),r.items.push(n)})),r},e.getEntryList=function(t){var r=new N.a;return t.playlistItems.entries.forEach((function(t){var n=new w.a;e._fillBaseData(n,t),r.items.push(n)})),r},e.getBumper=function(t,r,n){var i=t.playBackContextResult,a=i.bumperData[0];if(a){var s=(a&&a.sources).find((function(e){return Object(k.c)(e.format)}));if(s){var o=e._parseProgressiveSources(s,i,r,n,0,a.entryId);if(o[0])return new j.a({url:o[0].url,clickThroughUrl:a.clickThroughUrl})}}},e._fillBaseData=function(t,r,n){return t.poster=r.poster,t.id=r.id,t.duration=r.duration,t.metadata=e._parseMetadata(n),t.metadata.description=r.description||"",t.metadata.entryId=r.id||"",t.metadata.name=r.name||"",t.metadata.tags=r.tags||"",t.status=r.status,t.type=e._getEntryType(r.entryType,r.type),t.type===w.a.Type.LIVE&&(t.dvrStatus=r.dvrStatus),t},e._getEntryType=function(e,t){var r=w.a.Type.UNKNOWN;switch(e){case C.MediaType.IMAGE.value:r=w.a.Type.IMAGE;break;case C.MediaType.AUDIO.value:r=w.a.Type.AUDIO;break;default:switch(t){case C.EntryType.MEDIA_CLIP.value:r=w.a.Type.VOD;break;case C.EntryType.LIVE_STREAM.value:case C.EntryType.LIVE_CHANNEL.value:r=w.a.Type.LIVE;break;default:r=w.a.Type.UNKNOWN}}return r},e._getParsedSources=function(t,r,n,i,a,s){var o,u,c=new M.a,l=function(t){var o=e._parseAdaptiveSource(t,s,r,n,i,a.id);if(o){var u=k.b.get(t.format);c.map(o,u)}};return a.type===C.EntryType.EXTERNAL_MEDIA.value?((u=new D.a).mimetype="video/youtube",u.url=a.referenceId,u.id=a.id+"_youtube",c.progressive.push(u)):a.entryType===C.MediaType.IMAGE.value?c.image.push(new F.a(a)):t&&t.length>0&&(t.filter((function(e){return!Object(k.c)(e.format)})).forEach(l),o=t.find((function(t){return Object(k.c)(t.format)&&""!==t.getProtocol(e._getBaseProtocol())})),c.progressive=e._parseProgressiveSources(o,s,r,n,i,a.id)),c},e._parseAdaptiveSource=function(t,r,n,i,a,s){var o=new D.a;if(t){var u="",c=k.b.get(t.format),d=t.getProtocol(e._getBaseProtocol()),f=t.deliveryProfileId,p=t.format,h="";if(c&&(h=c.pathExt,o.mimetype=c.mimeType),t.hasFlavorIds()?(!h&&r.flavorAssets&&r.flavorAssets.length>0&&(h=r.flavorAssets[0].fileExt),u=A.build({entryId:s,flavorIds:t.flavorIds,format:p,ks:n,partnerId:i,uiConfId:a,extension:h,protocol:d})):u=e.addKsToUrl(t.url,n),!u){var g="failed to create play url from source, discarding source: ("+s+"_"+f+"), "+p;return e._logger.warn(g),null}if(o.url=u,o.id=s+"_"+f+","+p,t.hasDrmData()){var y=[];t.drm.forEach((function(e){y.push(new S.a(e.licenseURL,l.a.Scheme[e.scheme],e.certificate))})),o.drmData=y}}return o},e._parseProgressiveSources=function(t,r,n,i,a,s){var o=[],u=[];if(t){var c=t.getProtocol(e._getBaseProtocol()),l=t.format,d=t.deliveryProfileId,f=d+","+l;r.flavorAssets.map((function(t){var r=new D.a;r.id=t.id+f,r.mimetype="mp3"===t.fileExt?"audio/mp3":"video/mp4",r.height=t.height,r.width=t.width,r.bandwidth=1024*t.bitrate,r.label=t.label||t.language;var p=A.build({entryId:s,flavorIds:t.id,format:l,ks:n,partnerId:i,uiConfId:a,extension:t.fileExt,protocol:c});if(""===p)return e._logger.warn("failed to create play url from source, discarding source: ("+s+"_"+d+"), "+l+"."),null;r.url=p,t.height&&t.width?o.push(r):u.push(r)}))}return u.length&&!o.length?u:o},e._parseMetadata=function(e){var t={};return e&&e.metas&&e.metas.length>0&&e.metas.forEach((function(e){if(e.xml){var r,n=new DOMParser;e.xml=e.xml.replace(/\r?\n|\r/g,""),e.xml=e.xml.replace(/>\s*/g,">"),e.xml=e.xml.replace(/>\s*/g,">"),r=n.parseFromString(e.xml,"text/xml");var i=P.xmlToJson(r);Object.keys(i.metadata).forEach((function(e){t[e]=i.metadata[e]["#text"]}))}})),t},e._getBaseProtocol=function(){var e=o.get(),t=/^https?:/.exec(e.cdnUrl),r=t?t[0]:document.location.protocol;return"string"==typeof r?r.slice(0,-1):"https"},e.hasBlockAction=function(e){return e.playBackContextResult.hasBlockAction()},e.getBlockAction=function(e){return e.playBackContextResult.getBlockAction()},e.getErrorMessages=function(e){return e.playBackContextResult.getErrorMessages()},e}();!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(q,"_logger",Object(i.b)("OVPProviderParser"));var B=q.addKsToUrl,H=q,K=r(3),W=r(11),G=function(){function e(){}return e.getMultiRequest=function(e,t,r){var n=o.get(),i=n.serviceParams;Object.assign(i,{ks:t,clientTag:"html5:v"+e}),r&&Object.assign(i,{partnerId:r});var a=new Map;a.set("Content-Type","application/json");var s=new W.a(a);return s.method="POST",s.service="multirequest",s.url=s.getUrl(n.serviceUrl),s.params=i,s},e}();var Y=function e(t){void 0===t&&(t={}),this.type=t.type||e.Type.INCLUDE_FIELDS,this.fields=t.fields||"id,referenceId,name,description,thumbnailUrl,dataUrl,duration,msDuration,flavorParamsIds,mediaType,type,tags,dvrStatus,externalSourceType,status"};!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Y,"Type",{INCLUDE_FIELDS:1,EXCLUDE_FIELDS:2});var J=function(e){var t,r;function n(){return e.apply(this,arguments)||this}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n.getPlaybackContext=function(e,t,r){var n=new Map;n.set("Content-Type","application/json");var i=new K.a(n);i.service="baseEntry",i.action="getPlaybackContext",i.method="POST",i.url=i.getUrl(e),i.tag="baseEntry-getPlaybackContext";return i.params={entryId:r,ks:t,contextDataParams:{objectType:"KalturaContextDataParams",flavorTags:"all"}},i},n.list=function(e,t,r,i,a){var s=new Map;s.set("Content-Type","application/json");var o=new K.a(s);return o.service="baseEntry",o.action="list",o.method="POST",o.url=o.getUrl(e),o.tag="list",o.params=n.getEntryListReqParams(r,t,i,a),o},n.getEntryListReqParams=function(e,t,r,n){var i={};return e?i=r?{redirectFromEntryId:e}:{idEqual:e}:n&&(i={objectType:"KalturaBaseEntryFilter",referenceIdEqual:n}),{ks:t,filter:i,responseProfile:new Y}},n}(G);var X=function(e){var t,r;function n(){return e.apply(this,arguments)||this}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n.list=function(e,t,r){var n=new Map;n.set("Content-Type","application/json");var i=new K.a(n);i.service="metadata_metadata",i.action="list",i.method="POST",i.url=i.getUrl(e),i.tag="metadata_metadata-list";var a={objectType:"KalturaMetadataFilter",objectIdEqual:r,metadataObjectTypeEqual:"1"};return i.params={filter:a,ks:t},i},n}(G);var Q=function(e){var t,r;function n(t){var r;return(r=e.call(this,t)||this).hasError||(r.totalCount=t.totalCount,r.totalCount>0&&(r.entries=[],t.objects.map((function(e){return r.entries.push(new C(e))})))),r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n}(u.a);function Z(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,n.key,n)}}function z(e,t,r){return t&&Z(e.prototype,t),r&&Z(e,r),e}var $=function(){function e(e){!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"_response",{}),this.requests=this.buildRequests(e),this._entryId=e.entryId,this._referenceId=e.referenceId}z(e,null,[{key:"id",get:function(){return"media"}}]);var t=e.prototype;return t.buildRequests=function(e){var t=o.get(),r=[];r.push(J.list(t.serviceUrl,e.ks,e.entryId,e.redirectFromEntryId,e.referenceId));var n="{1:result:ks}"===e.ks?"{2:result:objects:0:id}":"{1:result:objects:0:id}";return r.push(J.getPlaybackContext(t.serviceUrl,e.ks,n)),r.push(X.list(t.serviceUrl,e.ks,n)),r},t.isValid=function(){return!(!this._entryId&&!this._referenceId)},z(e,[{key:"requests",set:function(e){this._requests=e},get:function(){return this._requests}},{key:"response",set:function(e){var t=new Q(e[0].data);this._response.entry=t.entries[0],this._response.playBackContextResult=new b(e[1].data),this._response.metadataListResult=new T(e[2].data)},get:function(){return this._response}}]),e}();var ee=function(e){var t,r;function n(){return e.apply(this,arguments)||this}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n.anonymousSession=function(e,t){var r=new Map;r.set("Content-Type","application/json");var n=new K.a(r);return n.service="session",n.action="startWidgetSession",n.method="POST",n.url=n.getUrl(e),n.tag="session-startWidget",n.params={widgetId:t},n},n}(G);function te(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,n.key,n)}}var re=function(){var e,t,r;function n(e){!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"_response",{}),this.requests=this.buildRequests(e),this._widgetId=e.widgetId}e=n,r=[{key:"id",get:function(){return"session"}}],(t=[{key:"requests",set:function(e){this._requests=e},get:function(){return this._requests}},{key:"response",set:function(e){this._response.ks=e[0].data.ks},get:function(){return this._response.ks}}])&&te(e.prototype,t),r&&te(e,r);var i=n.prototype;return i.buildRequests=function(e){var t=o.get(),r=[];return r.push(ee.anonymousSession(t.serviceUrl,e.widgetId)),r},i.isValid=function(){return!!this._widgetId},n}();var ne=function(e){var t,r;function n(t,r,n,i){var a;return void 0===n&&(n=""),(a=e.call(this,i)||this)._multiRequest=G.getMultiRequest(t,n,r),a}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n}(r(10).a);var ie=function(e){var t,r;function n(){return e.apply(this,arguments)||this}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n.execute=function(e,t,r){var n=new Map;n.set("Content-Type","application/json");var i=new K.a(n);return i.service="playlist",i.action="execute",i.method="POST",i.url=i.getUrl(e),i.tag="playlist-execute",i.params={ks:t,id:r,responseProfile:new Y},i},n.get=function(e,t,r){var n=new Map;n.set("Content-Type","application/json");var i=new K.a(n);return i.service="playlist",i.action="get",i.method="POST",i.url=i.getUrl(e),i.tag="playlist-get",i.params={ks:t,id:r,responseProfile:{fields:"id,name,description,thumbnailUrl",type:1}},i},n}(G),ae=function(e){this.id=e.id,this.name=e.name,this.description=e.description,this.poster=e.thumbnailUrl};var se=function(e){var t,r;function n(t){var r;return(r=e.call(this,t)||this).hasError||(r.entries=[],t.map((function(e){return r.entries.push(new C(e))}))),r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n}(u.a);function oe(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,n.key,n)}}function ue(e,t,r){return t&&oe(e.prototype,t),r&&oe(e,r),e}var ce=function(){function e(e){!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"_response",{}),this.requests=this.buildRequests(e),this._playlistId=e.playlistId}ue(e,null,[{key:"id",get:function(){return"playlist"}}]);var t=e.prototype;return t.buildRequests=function(e){var t=o.get(),r=[];return r.push(ie.get(t.serviceUrl,e.ks,e.playlistId)),r.push(ie.execute(t.serviceUrl,e.ks,e.playlistId)),r},t.isValid=function(){return!!this._playlistId},ue(e,[{key:"requests",set:function(e){this._requests=e},get:function(){return this._requests}},{key:"response",set:function(e){this._response.playlistData=new ae(e[0].data),this._response.playlistItems=new se(e[1].data)},get:function(){return this._response}}]),e}(),le=r(14);function de(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,n.key,n)}}function fe(e,t,r){return t&&de(e.prototype,t),r&&de(e,r),e}var pe=function(){function e(e){!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"_response",{playlistItems:{entries:[]}}),this.requests=this.buildRequests(e),this._entries=e.entries}fe(e,null,[{key:"id",get:function(){return"entry_list"}}]);var t=e.prototype;return t.buildRequests=function(e){var t=o.get(),r=[];return e.entries.forEach((function(n){r.push(J.list(t.serviceUrl,e.ks,n.entryId||n,e.redirectFromEntryId,n.referenceId))})),r},t.isValid=function(){return!(!this._entries||!this._entries.length)},fe(e,[{key:"requests",set:function(e){this._requests=e},get:function(){return this._requests}},{key:"response",set:function(e){var t,r=this;e.forEach((function(e){t=new Q(e.data),r._response.playlistItems.entries.push(t.entries[0])}))},get:function(){return this._response}}]),e}(),he=r(0);function ge(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ye=function(e){var t,r;function n(t){var r;return(r=e.call(this,t)||this).hasError||(r.name=t.name,r.description=t.description,r.objTypeAsString=t.objTypeAsString,r.width=t.width,r.height=t.height,r.htmlParams=t.htmlParams,r.swfUrl=t.swfUrl,r.confFilePath=t.confFilePath,r.confFile=t.confFile,r.confFileFeatures=t.confFileFeatures,r.config=t.config,r.confVars=t.confVars,r.useCdn=t.useCdn,r.tags=t.tags,r.swfUrlVersion=t.swfUrlVersion,r.created=new Date(0),r.created.setUTCSeconds(t.createdAt),r.updated=new Date(0),r.updated.setUTCSeconds(t.updatedAt),r.html5Url=t.description,r.version=t.description,r.partnerTags=t.description,r.objType=t.description,r.creationMode=t.description),r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n}(u.a);function me(e,t,r,n,i,a,s){try{var o=e[a](s),u=o.value}catch(e){return void r(e)}o.done?t(u):Promise.resolve(u).then(n,i)}function ve(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var a=e.apply(t,r);function s(e){me(a,n,i,s,o,"next",e)}function o(e){me(a,n,i,s,o,"throw",e)}s(void 0)}))}}ge(ye,"Type",{PLAYER:1,CONTRIBUTION_WIZARD:2,SIMPLE_EDITOR:3,ADVANCED_EDITOR:4,PLAYLIST:5,APP_STUDIO:6,KRECORD:7,PLAYER_V3:8,KMC_ACCOUNT:9,KMC_ANALYTICS:10,KMC_CONTENT:11,KMC_DASHBOARD:12,KMC_LOGIN:13,PLAYER_SL:14,CLIENTSIDE_ENCODER:15,KMC_GENERAL:16,KMC_ROLES_AND_PERMISSIONS:17,CLIPPER:18,KSR:19,KUPLOAD:20,WEBCASTING:21}),ge(ye,"CreationMode",{WIZARD:2,ADVANCED:3});var _e=function(){function e(){}return e._applyRegexAction=function(e,t){if(e){var r=new RegExp(e.pattern,"i");if(t.match(r))return t.replace(r,e.replacement+"/")}return t},e._isECDNUrlAlive=function(){var t=ve(regeneratorRuntime.mark((function t(r,n){var i,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i=n+"/api_v3/service/system/action/ping/format/1",(a=new XMLHttpRequest).open("GET",i),a.timeout=r.checkAliveTimeoutMs,a.onreadystatechange=function(){if(4===a.readyState)return 200===a.status},a.ontimeout=function(){return e._logger.warn("Got timeout while pinging the ECDN url. the ping url: "+i),!1},a.send();case 7:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),e.handleRegexAction=function(){var t=ve(regeneratorRuntime.mark((function t(r,n){var i,a,s;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=o.get().cdnUrl,a=e._extractRegexActionFromData(n),s=e._getRegExp(a),t.t0=i&&a&&s&&i.match(s),!t.t0){t.next=11;break}if(t.t1=a.checkAliveTimeoutMs>0,!t.t1){t.next=10;break}return t.next=9,e._isECDNUrlAlive(a,i.replace(s,a.replacement));case 9:t.t1=!t.sent;case 10:t.t0=!t.t1;case 11:if(!t.t0){t.next=14;break}return e._replaceHostUrls(r,a),t.abrupt("return",r);case 14:return e._logger.debug("exiting handleRegexAction - not applying regex action."),t.abrupt("return",r);case 16:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),e._replaceHostUrls=function(t,r){e._logger.debug("Starting to modify urls...");var n=t.sources,i=n.hls,a=n.dash,s=n.progressive,u=n.image;[].concat(i,a,s,u).forEach((function(t){return t.url=e._applyRegexAction(r,t.url)})),o.get().replaceHostOnlyManifestUrls||(e._logger.debug("replaceHostOnlyManifestUrls flag is off - modifying captions and poster URLs"),n.captions&&n.captions.forEach((function(t){return t.url=e._applyRegexAction(r,t.url)})),"string"==typeof n.poster&&(n.poster=e._applyRegexAction(r,n.poster))),e._logger.debug("Finished modifying urls")},e._extractRegexActionFromData=function(e){var t,r;return null==(t=e.get($.id))||null==(r=t.response)?void 0:r.playBackContextResult.getRequestHostRegexAction()},e._getRegExp=function(e){if(e&&e.pattern&&e.replacement)return new RegExp(e.pattern,"i")},e}();!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(_e,"_logger",Object(i.b)("RegexActionHandler"));var Ee=_e;function be(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,n.key,n)}}var Ie=function(e){var t,r;function n(t,r){var n;return function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n=e.call(this,t,r)||this),"_filterOptionsConfig",{redirectFromEntryId:!0}),n._logger=Object(i.b)("OVPProvider"),o.set(t.env),n._setFilterOptionsConfig(t.filterOptions),n._networkRetryConfig=Object.assign(n._networkRetryConfig,t.networkRetryParameters),n}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var a,s,u,c=n.prototype;return c.getMediaConfig=function(e){var t=this;return e.ks&&(this.ks=e.ks,this._isAnonymous=!1),this.widgetId!==this.defaultWidgetId&&(this._isAnonymous=!1),this._dataLoader=new ne(this.playerVersion,this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var i=e.entryId,a=e.referenceId;if(i||a){var s=t.ks;s||(s="{1:result:ks}",t._dataLoader.add(re,{widgetId:t.widgetId}));var o=t._getEntryRedirectFilter(e);return t._dataLoader.add($,{entryId:i,ks:s,redirectFromEntryId:o,referenceId:a}),t._dataLoader.fetchData().then((function(e){try{var i=t._parseDataFromResponse(e);Ee.handleRegexAction(i,e).then(r)}catch(e){n(e)}}),(function(e){n(e)}))}n(new he.a(he.a.Severity.CRITICAL,he.a.Category.PROVIDER,he.a.Code.MISSING_MANDATORY_PARAMS,{message:"missing entry id"}))}))},c.doRequest=function(e,t){var r=this,n=t||this.ks,i=new ne(this.playerVersion,this.partnerId,n,this._networkRetryConfig);return new Promise((function(t,a){return n||i.add(re,{widgetId:r.widgetId}),e.forEach((function(e){i.add(e.loader,e.params,n||"{1:result:ks}")})),i.fetchData().then((function(e){try{t(e)}catch(e){a(e)}}),(function(e){a(e)}))}))},c._getEntryRedirectFilter=function(e){return"boolean"==typeof e.redirectFromEntryId?e.redirectFromEntryId:"boolean"!=typeof this._filterOptionsConfig.redirectFromEntryId||this._filterOptionsConfig.redirectFromEntryId},c._setFilterOptionsConfig=function(e){e&&"boolean"==typeof e.redirectFromEntryId&&(this._filterOptionsConfig.redirectFromEntryId=e.redirectFromEntryId)},c._parseDataFromResponse=function(e){this._logger.debug("Data parsing started");var t={session:{isAnonymous:this._isAnonymous,partnerId:this.partnerId},sources:this._getDefaultSourcesObject(),plugins:{}};if(this.uiConfId&&(t.session.uiConfId=this.uiConfId),e){if(e.has(re.id)){var r=e.get(re.id);r&&r.response&&(t.session.ks=r.response,this.widgetId!==this.defaultWidgetId&&(this.ks=t.session.ks))}else t.session.ks=this.ks;if(e.has($.id)){var n=e.get($.id);if(n&&n.response){var i=n.response;if(H.hasBlockAction(i))throw new he.a(he.a.Severity.CRITICAL,he.a.Category.SERVICE,he.a.Code.BLOCK_ACTION,{action:H.getBlockAction(i),messages:H.getErrorMessages(i)});var a=H.getMediaEntry(this.isAnonymous?"":this.ks,this.partnerId,this.uiConfId,i);Object.assign(t.sources,this._getSourcesObject(a)),this._verifyMediaStatus(a),this._verifyHasSources(t.sources);var s=H.getBumper(i,this.isAnonymous?"":this.ks,this.partnerId);s&&Object.assign(t.plugins,{bumper:s})}}}return this._logger.debug("Data parsing finished",t),t},c._verifyMediaStatus=function(e){if([C.EntryStatus.IMPORT,C.EntryStatus.PRECONVERT].includes(e.status))throw new he.a(he.a.Severity.CRITICAL,he.a.Category.SERVICE,he.a.Code.MEDIA_STATUS_NOT_READY,{messages:"Status of entry id "+e.id+" is "+e.status+" and is still being imported or converted",data:{status:status}})},c.getPlaylistConfig=function(e){var t=this;return e.ks&&(this.ks=e.ks,this._isAnonymous=!1),this.widgetId!==this.defaultWidgetId&&(this._isAnonymous=!1),this._dataLoader=new ne(this.playerVersion,this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var i=e.playlistId;if(i){var a=t.ks;a||(a="{1:result:ks}",t._dataLoader.add(re,{widgetId:t.widgetId})),t._dataLoader.add(ce,{playlistId:i,ks:a}),t._dataLoader.fetchData().then((function(e){r(t._parsePlaylistDataFromResponse(e))}),(function(e){n(e)}))}else n({success:!1,data:"Missing mandatory parameter"})}))},c._parsePlaylistDataFromResponse=function(e){var t=this;this._logger.debug("Data parsing started");var r=this._getPlaylistObject();if(e&&e.has(ce.id)){var n=e.get(ce.id);if(n&&n.response){var i=H.getPlaylist(n.response);r.id=i.id,r.poster=i.poster,r.metadata.name=i.name,r.metadata.description=i.description,i.items.forEach((function(e){return r.items.push({sources:t._getSourcesObject(e)})}))}}return this._logger.debug("Data parsing finished",r),r},c.getEntryListConfig=function(e){var t=this;return e.ks&&(this.ks=e.ks,this._isAnonymous=!1),this.widgetId!==this.defaultWidgetId&&(this._isAnonymous=!1),this._dataLoader=new ne(this.playerVersion,this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var i=e.entries;if(i&&i.length){var a=t.ks;a||(a="{1:result:ks}",t._dataLoader.add(re,{widgetId:t.widgetId}));var s=t._getEntryRedirectFilter(e);t._dataLoader.add(pe,{entries:i,ks:a,redirectFromEntryId:s}),t._dataLoader.fetchData(!1).then((function(e){r(t._parseEntryListDataFromResponse(e))}),(function(e){n(e)}))}else n({success:!1,data:"Missing mandatory parameter"})}))},c._parseEntryListDataFromResponse=function(e){var t=this;this._logger.debug("Data parsing started");var r=this._getPlaylistObject();if(e&&e.has(pe.id)){var n=e.get(pe.id);if(n&&n.response)H.getEntryList(n.response).items.forEach((function(e){return r.items.push({sources:t._getSourcesObject(e)})}))}return this._logger.debug("Data parsing finished",r),r},c._getPlaylistObject=function(){return{id:"",metadata:{name:"",description:""},poster:"",items:[]}},c._getDefaultSourcesObject=function(){return{hls:[],dash:[],progressive:[],image:[],id:"",duration:0,type:w.a.Type.UNKNOWN,poster:"",dvr:!1,vr:null,metadata:{name:"",description:"",tags:""}}},c._getSourcesObject=function(e){var t=this._getDefaultSourcesObject(),r=e.sources.toJSON();return t.hls=r.hls,t.dash=r.dash,t.progressive=r.progressive,t.image=r.image,t.id=e.id,t.duration=e.duration,t.type=e.type,t.dvr=!!e.dvrStatus,t.poster=e.poster,e.sources.captions&&(t.captions=e.sources.captions),e.metadata&&"string"==typeof e.metadata.tags&&e.metadata.tags.search(/\b360\b/)>-1&&(t.vr={}),Object.assign(t.metadata,e.metadata),t},a=n,(s=[{key:"env",get:function(){return o.get()}}])&&be(a.prototype,s),u&&be(a,u),n}(le.a),Re="@playkit-js/playkit-js-providers-ovp",Te="2.39.2"}])}));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ovp=t():(e.playkit=e.playkit||{},e.playkit.providers=e.playkit.providers||{},e.playkit.providers.ovp=t())}(window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=18)}([function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(2);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=function e(t,r,n,i){void 0===i&&(i={}),this.severity=t,this.category=r,this.code=n,this.data=i,e._logger.error("Category:"+r+" | Code:"+n+" |",i)};i(a,"Severity",{RECOVERABLE:1,CRITICAL:2}),i(a,"Category",{NETWORK:1,SERVICE:2,PROVIDER:3}),i(a,"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,MISSING_MANDATORY_PARAMS:3e3,MISSING_PLAY_SOURCE:3001,METHOD_NOT_IMPLEMENTED:3002}),i(a,"_logger",Object(n.b)("Error"))},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(8);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=function(){function e(){this.metadata=new Map,this.sources=new n.a,this.type=e.Type.UNKNOWN}return e.prototype.toJSON=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}},e}();i(a,"Type",{VOD:"Vod",LIVE:"Live",IMAGE:"Image",AUDIO:"Audio",UNKNOWN:"Unknown"}),i(a,"DvrStatus",{ON:1,OFF:0})},function(e,t,r){"use strict";r.d(t,"c",(function(){return o})),r.d(t,"d",(function(){return u})),r.d(t,"e",(function(){return a})),r.d(t,"a",(function(){return i}));var n={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(){}}}},i={};function a(e){e&&"function"==typeof e.getLogger&&(n.get=e.getLogger),e&&e.LogLevel&&(i=e.LogLevel)}function s(e){return n.get(e)}function o(e){return s(e).getLevel()}function u(e,t){s(t).setLevel(e)}t.b=s},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=function(){function e(e){void 0===e&&(e=new Map),i(this,"retryConfig",{async:!0,timeout:0,maxAttempts:4}),i(this,"_attemptCounter",1),this.headers=e}var t=e.prototype;return t.getUrl=function(e){return e+"/service/"+this.service+(this.action?"/action/"+this.action:"")},t.doHttpRequest=function(){var e=this,t=new Promise((function(t,r){e._requestPromise={resolve:t,reject:r}}));return this.url||this._requestPromise.reject(new n.a(n.a.Severity.CRITICAL,n.a.Category.NETWORK,n.a.Code.MALFORMED_DATA_URI,{url:this.url})),this._createXHR(),t},t._createXHR=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,n.a.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,n.a.Code.TIMEOUT,{timeout:(performance.now()-r)/1e3,statusText:t.statusText})},t.onerror=t.onabort=function(){e._handleError(t,n.a.Code.HTTP_ERROR,{text:t.responseText,statusText:t.statusText})},this.headers.forEach((function(e,r){t.setRequestHeader(r,e)})),t.send(this.params)},t._getResponseHeaders=function(e){return e.getAllResponseHeaders().split("\n").filter((function(e){return 0===e.toLowerCase().indexOf("x-")}))},t._handleError=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()},t._createError=function(e,t,r){return Object.assign(r,{url:this.url,headers:this._getResponseHeaders(e),attempt:this._attemptCounter}),new n.a(n.a.Severity.CRITICAL,n.a.Category.NETWORK,t,r)},e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function(e){var t,r,n;n=!1,(r="hasError")in(t=this)?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,"KalturaAPIException"===e.objectType?(this.hasError=!0,this.error=new i(e.code,e.message)):e.error&&"KalturaAPIException"===e.error.objectType?(this.hasError=!0,this.error=new i(e.error.code,e.error.message)):this.data=e},i=function(e,t){this.code=e,this.message=t}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return i})),r.d(t,"c",(function(){return a}));var n={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"}},i=new Map([["mpegdash",n.DASH],["applehttp",n.HLS],["url",n.MP4]]);function a(e){var t=i.get(e);return!!t&&t.name===n.MP4.name}},function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n,i,a,s=function(e){this.scheme=e.scheme,this.licenseURL=e.licenseURL,this.certificate=e.certificate};a={"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"},(i="Scheme")in(n=s)?Object.defineProperty(n,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[i]=a},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function(e){this.message=e.message,this.code=e.code}},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));r(9);var n=r(5),i=(r(13),function(){function e(){this.progressive=[],this.dash=[],this.hls=[],this.image=[]}var t=e.prototype;return t.map=function(e,t){if(t)switch(t.name){case n.a.MP4.name:this.progressive.push(e);break;case n.a.DASH.name:this.dash.push(e);break;case n.a.HLS.name:this.hls.push(e)}},t.toJSON=function(){var e={progressive:[],dash:[],hls:[],image:[]};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},e}())},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));r(12);var n=function(){function e(){}return e.prototype.toJSON=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}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));r(11);var n=r(0);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var a=function(){function e(e){i(this,"_loadersResponseMap",new Map),i(this,"_loaders",new Map),this._networkRetryConfig=e}var t=e.prototype;return t.add=function(e,t,r){var n=this,i=new e(t);if(i.isValid()){this._loaders.set(e.id,i);var a=this._multiRequest.requests.length,s=i.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 o=Array.from(new Array(s.length),(function(e,t){return t+a}));this._loadersResponseMap.set(e.id,o)}},t.fetchData=function(e){var t=this;return new Promise((function(r,i){t._multiRequest.execute(e).then((function(e){t._multiResponse=e.response,t.prepareData(e.response).success?r(t._loaders):i(new n.a(n.a.Severity.CRITICAL,n.a.Category.NETWORK,n.a.Code.API_RESPONSE_MISMATCH,{headers:e.headers}))}),(function(e){i(e)}))}))},t.prepareData=function(e){var t=this;return this._loaders.forEach((function(r,n){var i=t._loadersResponseMap.get(n);try{i&&i.length>0&&(r.response=e.results.slice(i[0],i[i.length-1]+1))}catch(e){return{success:!1,error:e}}})),{success:!0,data:this._loaders}},e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(3),i=r(2),a=r(4),s=r(0);function o(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var c=function(e){var t,r;function n(){for(var t,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return u(o(t=e.call.apply(e,[this].concat(n))||this),"requests",[]),t}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var i=n.prototype;return i.add=function(e){var t;this.requests.push(e);var r={},n={service:e.service,action:e.action};return Object.assign(r,((t={})[this.requests.length]=Object.assign(n,e.params),t)),Object.assign(r,this.params),this.params=r,this},i.execute=function(e){var t=this;return new Promise((function(r,i){try{t.params=JSON.stringify(t.params)}catch(e){n._logger.error(""+e.message),i(new s.a(s.a.Severity.CRITICAL,s.a.Category.PROVIDER,s.a.Code.FAILED_PARSING_REQUEST,{error:e,params:t.params}))}t.doHttpRequest().then((function(n){var a=new l(n,e);a.success?r({headers:t.responseHeaders,response:a}):i(new s.a(s.a.Severity.CRITICAL,s.a.Category.NETWORK,s.a.Code.MULTIREQUEST_API_ERROR,{url:t.url,headers:t.responseHeaders,results:a.results}))}),(function(e){i(e)}))}))},n}(n.a);u(c,"_logger",Object(i.b)("MultiRequestBuilder"));var l=function e(t,r){void 0===r&&(r=!0),u(this,"results",[]);var n=t.result?t.result:t,i=(Array.isArray(n)?n:[n]).map((function(e){return new a.a(e)})),s=i.filter((function(e){return e.hasError}));s.forEach((function(t){e._logger.error("Service returned an error with error code: "+t.error.code+" and message: "+t.error.message+".")})),this.results=i,r&&s.length||s.length===this.results.length?this.success=!1:(this.results=this.results.filter((function(e){return!e.hasError})),this.success=!0)};u(l,"_logger",Object(i.b)("MultiRequestResult"))},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function(){function e(e,t,r){this.licenseUrl=e,this.scheme=t,r&&(this.certificate=r)}return e.prototype.toJSON=function(){var e={licenseUrl:this.licenseUrl,scheme:this.scheme};return this.certificate&&(e.certificate=this.certificate),e},e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function(){function e(t){this.id=t.id,this.url=e.extractBaseThumbnailUrl(t.dataUrl),this.mimetype=""}return e.extractBaseThumbnailUrl=function(e){return e.match(".+entry_id/[a-zA-Z0-9_]+/")[0].slice(0,-1)},e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(2),i=(r(10),r(0));function a(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,n.key,n)}}function s(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),e}var o=function(){function e(e,t){var r,i,a;a={async:!0,timeout:0,maxAttempts:4},(i="_networkRetryConfig")in(r=this)?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a,Object(n.e)(e.logger),this._partnerId=e.partnerId,this._widgetId=e.widgetId,this._uiConfId=e.uiConfId,this._isAnonymous=!e.ks,this._ks=e.ks||"",this._playerVersion=t}s(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}}]);var t=e.prototype;return t.getMediaConfig=function(e){return Promise.reject(new i.a(i.a.Severity.CRITICAL,i.a.Category.PROVIDER,i.a.Code.METHOD_NOT_IMPLEMENTED,{message:"getMediaConfig method must be implement by the derived class"}))},t.getPlaylistConfig=function(e){return Promise.reject(new i.a(i.a.Severity.CRITICAL,i.a.Category.PROVIDER,i.a.Code.METHOD_NOT_IMPLEMENTED,{message:"The provider does not support loading playlist by id"}))},t.getEntryListConfig=function(e){return Promise.reject(new i.a(i.a.Severity.CRITICAL,i.a.Category.PROVIDER,i.a.Code.METHOD_NOT_IMPLEMENTED,{message:"The provider does not support loading entry list"}))},t._verifyHasSources=function(e){if(0===e.hls.concat(e.dash,e.progressive,e.image).length)throw new i.a(i.a.Severity.CRITICAL,i.a.Category.SERVICE,i.a.Code.MISSING_PLAY_SOURCE,{action:"",messages:"No play source for entry id: "+e.id})},t.getLogLevel=function(e){return Object(n.c)(e)},t.setLogLevel=function(e,t){Object(n.d)(e,t)},s(e,[{key:"LogLevel",get:function(){return n.a}}]),e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function e(t){var r;return Array.isArray(t)?(r=t.length>0?t.slice(0):[]).forEach((function(t,n){("object"==typeof t&&t!=={}||Array.isArray(t)&&t.length>0)&&(r[n]=e(t))})):"object"==typeof t?(r=Object.assign({},t),Object.keys(r).forEach((function(t){("object"==typeof r[t]&&r[t]!=={}||Array.isArray(r[t])&&r[t].length>0)&&(r[t]=e(r[t]))}))):r=t,r}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));r(1);var n=function(){this.items=[]}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function(e){this.url=e.url,this.clickThroughUrl=e.clickThroughUrl}},function(e,t,r){"use strict";r.r(t),r.d(t,"Provider",(function(){return Ie})),r.d(t,"ProviderParser",(function(){return H})),r.d(t,"NAME",(function(){return Re})),r.d(t,"VERSION",(function(){return Te})),r.d(t,"RequestBuilder",(function(){return K.a})),r.d(t,"ResponseTypes",(function(){return n}));var n={};r.r(n),r.d(n,"KalturaBaseEntryListResponse",(function(){return Q})),r.d(n,"KalturaMediaEntry",(function(){return C})),r.d(n,"KalturaAccessControlModifyRequestHostRegexAction",(function(){return y})),r.d(n,"KalturaBumper",(function(){return v})),r.d(n,"KalturaFlavorAsset",(function(){return m})),r.d(n,"KalturaMediaEntries",(function(){return se})),r.d(n,"KalturaMetadata",(function(){return R})),r.d(n,"KalturaMetadataListResponse",(function(){return T})),r.d(n,"KalturaPlaybackContext",(function(){return b})),r.d(n,"KalturaPlaybackSource",(function(){return d})),r.d(n,"KalturaPlaylist",(function(){return ae})),r.d(n,"KalturaRuleAction",(function(){return g})),r.d(n,"KalturaUIConfResponse",(function(){return ye})),r.d(n,"KalturaDrmPlaybackPluginData",(function(){return l.a})),r.d(n,"KalturaAccessControlMessage",(function(){return c.a})),r.d(n,"BaseServiceResult",(function(){return u.a}));var i=r(2),a=r(15),s={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},o=function(){function e(){}return e.set=function(e){e&&Object.assign(s,e)},e.get=function(){return Object(a.a)(s)},e}(),u=r(4),c=r(7),l=r(6);var d=function(){function e(e){var t,r,n,i=this;n=[],(r="drm")in(t=this)?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,this.format=e.format,this.deliveryProfileId=e.deliveryProfileId,this.url=e.url,this.protocols=e.protocols,this.flavorIds=e.flavorIds,e.drm&&e.drm.map((function(e){return i.drm.push(new l.a(e))}))}var t=e.prototype;return t.hasDrmData=function(){return this.drm&&this.drm.length>0},t.hasFlavorIds=function(){return!!this.flavorIds&&this.flavorIds.length>0},t.getProtocol=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}();var f,p,h,g=function(e){this.type=e.type};h={DRM_POLICY:"drm.DRM_POLICY",BLOCK:1,PREVIEW:2,LIMIT_FLAVORS:3,ADD_TO_STORAGE:4,LIMIT_DELIVERY_PROFILES:5,SERVE_FROM_REMOTE_SERVER:6,REQUEST_HOST_REGEX:7,LIMIT_THUMBNAIL_CAPTURE:8},(p="Type")in(f=g)?Object.defineProperty(f,p,{value:h,enumerable:!0,configurable:!0,writable:!0}):f[p]=h;var y=function(e){var t,r;function n(t){var r;return(r=e.call(this,t)||this).pattern=t.pattern,r.replacement=t.replacement,r.replacmenServerNodeId=t.replacmenServerNodeId,r.checkAliveTimeoutMs=t.checkAliveTimeoutMs,r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n}(g);var m=function(e){this.id=e.id,this.flavorParamsId=e.flavorParamsId,this.fileExt=e.fileExt,this.bitrate=e.bitrate,this.width=e.width,this.height=e.height,this.id=e.id,this.frameRate=e.frameRate,this.isOriginal=e.isOriginal,this.isWeb=e.isWeb,this.containerFormat=e.containerFormat,this.videoCodecId=e.videoCodecId,this.status=e.status,this.language=e.language,this.label=e.label};!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(m,"Status",{ERROR:-1,QUEUED:0,CONVERTING:1,READY:2,DELETED:3,NOT_APPLICABLE:4,TEMP:5,WAIT_FOR_CONVERT:6,IMPORTING:7,VALIDATING:8,EXPORTING:9});var v=function(e){this.entryId=e.entryId,this.clickThroughUrl=e.url,this.sources=e.sources?e.sources.map((function(e){return new d(e)})):[]};function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function E(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var b=function(e){var t,r;function n(t){var r;if(E(_(r=e.call(this,t)||this),"sources",[]),E(_(r),"actions",[]),E(_(r),"messages",[]),E(_(r),"flavorAssets",[]),E(_(r),"bumperData",[]),!r.hasError){var n=t.messages;n&&n.map((function(e){return r.messages.push(new c.a(e))}));var i=t.actions;i&&i.map((function(e){e.type===g.Type.REQUEST_HOST_REGEX?r.actions.push(new y(e)):r.actions.push(new g(e))}));var a=t.sources;a&&a.map((function(e){return r.sources.push(new d(e))}));var s=t.flavorAssets;s&&s.map((function(e){return r.flavorAssets.push(new m(e))}));var o=t.bumperData;o&&o.map((function(e){return r.bumperData.push(new v(e))}))}return r}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var i=n.prototype;return i.hasBlockAction=function(){return void 0!==this.getBlockAction()},i.getBlockAction=function(){return this.actions.find((function(e){return e.type===g.Type.BLOCK}))},i.getErrorMessages=function(){return this.messages},i.getRequestHostRegexAction=function(){var e=this.actions.find((function(e){return e.type===g.Type.REQUEST_HOST_REGEX}));if(e instanceof y)return e},n}(u.a);function I(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var R=function(e){this.id=e.id,this.metadataProfileId=e.metadataProfileId,this.metadataProfileVersion=e.metadataProfileVersion,this.metadataProfileId=e.metadataProfileId,this.metadataObjectType=e.metadataObjectType,this.objectId=e.objectId,this.version=e.version,this.created=new Date(0),this.created.setUTCSeconds(e.createdAt),this.updated=new Date(0),this.updated.setUTCSeconds(e.updatedAt),this.status=e.status,this.xml=e.xml};I(R,"ObjectType",{AD_CUE_POINT:"adCuePointMetadata.AdCuePoint",ANNOTATION:"annotationMetadata.Annotation",CODE_CUE_POINT:"codeCuePointMetadata.CodeCuePoint",THUMB_CUE_POINT:"thumbCuePointMetadata.thumbCuePoint",ENTRY:1,CATEGORY:2,USER:3,PARTNER:4,DYNAMIC_OBJECT:5}),I(R,"Status",{VALID:1,INVALID:2,DELETED:3});var T=function(e){var t,r;function n(t){var r;return(r=e.call(this,t)||this).hasError||(r.totalCount=t.totalCount,r.totalCount>0&&(r.metas=[],t.objects.map((function(e){return r.metas.push(new R(e))})))),r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n}(u.a);function O(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var C=function(e){this.id=e.id,this.referenceId=e.referenceId,this.externalSourceType=e.externalSourceType,this.name=e.name,this.description=e.description,this.dataUrl=e.dataUrl,this.type=e.type,this.entryType=e.mediaType,this.flavorParamsIds=e.flavorParamsIds,this.duration=e.duration,this.poster=e.thumbnailUrl,this.status=e.status,this.dvrStatus=e.dvrStatus,this.tags=e.tags};O(C,"EntryType",{AUTOMATIC:{value:-1},EXTERNAL_MEDIA:{value:"externalMedia.externalMedia"},MEDIA_CLIP:{value:1},MIX:{value:2},PLAYLIST:{value:5},DATA:{value:6},LIVE_STREAM:{value:7},LIVE_CHANNEL:{value:8},DOCUMENT:{value:10}}),O(C,"MediaType",{VIDEO:{value:1},IMAGE:{value:2},AUDIO:{value:5},LIVE_STREAM_FLASH:{value:201},LIVE_STREAM_WINDOWS_MEDIA:{value:202},LIVE_STREAM_REAL_MEDIA:{value:203},LIVE_STREAM_QUICK_TIME:{value:204}}),O(C,"EntryStatus",{ERROR_IMPORTING:-2,ERROR_CONVERTING:-1,SCAN_FAILURE:"virusScan.ScanFailure",IMPORT:0,INFECTED:"virusScan.Infected",PRECONVERT:1,READY:2,DELETED:3,PENDING:4,MODERATE:5,BLOCKED:6,NO_CONTENT:7}),O(C,"EntryModerationStatus",{PENDING_MODERATION:1,APPROVED:2,REJECTED:3,FLAGGED_FOR_REVIEW:4,MODERATE:5,AUTO_APPROVED:6});var A=function(){function e(){}return e.build=function(e){var t=o.get(),r=t.serviceUrl.substr(0,t.serviceUrl.lastIndexOf("/")),n=e.partnerId,i=e.entryId,a=e.ks,s=e.uiConfId,u=e.format,c=e.protocol,l=e.extension,d=e.flavorIds;if(!r||isNaN(Number.parseInt(n))||!i||!u||!c)return"";var f=r;return r.endsWith("/")||(f+="/"),f+="p/"+n+"/sp/"+n+"00/playManifest/entryId/"+i+"/protocol/"+c+"/format/"+u,d?f+="/flavorIds/"+d:s&&(f+="/uiConfId/"+s),""!==a&&(f+="/ks/"+a),""!==l&&(f+="/a."+l),s&&""!==d&&(f+="?uiConfId="+s),f},e}(),P=function(){function e(){}return e.xmlToJson=function(e){var t={};if(1===e.nodeType){if(e.attributes.length>0){t["@attributes"]={};for(var r=0;r<e.attributes.length;r++){var n=e.attributes.item(r);t["@attributes"][n.nodeName]=n.nodeValue}}}else 3===e.nodeType&&(t=e.nodeValue);if(e.hasChildNodes())for(var i=0;i<e.childNodes.length;i++){var a=e.childNodes.item(i),s=a.nodeName;if(void 0===t[s])t[s]=this.xmlToJson(a);else{if(void 0===t[s].push){var o=t[s];t[s]=[],t[s].push(o)}t[s].push(this.xmlToJson(a))}}return t},e}(),w=r(1),S=r(12),D=r(9),M=r(8),k=r(5),L=function(){this.items=[]},N=r(16),j=r(17),x={SRT:"1",DFXP:"2",WEBVTT:"3",CAP:"4"},U={3:"vtt",1:"srt"},V=function(){function e(){}return e.createConfig=function(e,t){return e.map((function(e){var r=e.url,n=U[e.format];return[x.DFXP,x.CAP].includes(e.format)&&(r=e.webVttUrl,n=U[x.WEBVTT]),r=B(r,t),{default:!!e.isDefault,type:n,language:e.languageCode,label:e.label,url:r}}))},e}(),F=r(13);var q=function(){function e(){}return e.getMediaEntry=function(t,r,n,i){var a=new w.a,s=i.entry,u=i.playBackContextResult,c=i.metadataListResult,l=u.sources;return a.sources=e._getParsedSources(l,t,r,n,s,u),e._fillBaseData(a,s,c),a.type!==w.a.Type.LIVE&&o.get().useApiCaptions&&u.data.playbackCaptions&&(a.sources.captions=V.createConfig(u.data.playbackCaptions,t)),a},e.addKsToUrl=function(e,t){var r;return t?(r=-1!==e.split("?")[0].replace(/^.*[\\/]/,"").indexOf(".")?-1===e.indexOf("?")?"?ks=":"&ks=":"/ks/",e+r+t):e},e.getPlaylist=function(t){var r=new L,n=t.playlistData,i=t.playlistItems.entries;return r.id=n.id,r.name=n.name,r.description=n.description,r.poster=n.poster,i.forEach((function(t){var n=new w.a;e._fillBaseData(n,t),r.items.push(n)})),r},e.getEntryList=function(t){var r=new N.a;return t.playlistItems.entries.forEach((function(t){var n=new w.a;e._fillBaseData(n,t),r.items.push(n)})),r},e.getBumper=function(t,r,n){var i=t.playBackContextResult,a=i.bumperData[0];if(a){var s=(a&&a.sources).find((function(e){return Object(k.c)(e.format)}));if(s){var o=e._parseProgressiveSources(s,i,r,n,0,a.entryId);if(o[0])return new j.a({url:o[0].url,clickThroughUrl:a.clickThroughUrl})}}},e._fillBaseData=function(t,r,n){return t.poster=r.poster,t.id=r.id,t.duration=r.duration,t.metadata=e._parseMetadata(n),t.metadata.description=r.description||"",t.metadata.entryId=r.id||"",t.metadata.name=r.name||"",t.metadata.tags=r.tags||"",t.status=r.status,t.type=e._getEntryType(r.entryType,r.type),t.type===w.a.Type.LIVE&&(t.dvrStatus=r.dvrStatus),t},e._getEntryType=function(e,t){var r=w.a.Type.UNKNOWN;switch(e){case C.MediaType.IMAGE.value:r=w.a.Type.IMAGE;break;case C.MediaType.AUDIO.value:r=w.a.Type.AUDIO;break;default:switch(t){case C.EntryType.MEDIA_CLIP.value:r=w.a.Type.VOD;break;case C.EntryType.LIVE_STREAM.value:case C.EntryType.LIVE_CHANNEL.value:r=w.a.Type.LIVE;break;default:r=w.a.Type.UNKNOWN}}return r},e._getParsedSources=function(t,r,n,i,a,s){var o,u,c=new M.a,l=function(t){var o=e._parseAdaptiveSource(t,s,r,n,i,a.id);if(o){var u=k.b.get(t.format);c.map(o,u)}};return a.type===C.EntryType.EXTERNAL_MEDIA.value?((u=new D.a).mimetype="video/youtube",u.url=a.referenceId,u.id=a.id+"_youtube",c.progressive.push(u)):a.entryType===C.MediaType.IMAGE.value?c.image.push(new F.a(a)):t&&t.length>0&&(t.filter((function(e){return!Object(k.c)(e.format)})).forEach(l),o=t.find((function(t){return Object(k.c)(t.format)&&""!==t.getProtocol(e._getBaseProtocol())})),c.progressive=e._parseProgressiveSources(o,s,r,n,i,a.id)),c},e._parseAdaptiveSource=function(t,r,n,i,a,s){var o=new D.a;if(t){var u="",c=k.b.get(t.format),d=t.getProtocol(e._getBaseProtocol()),f=t.deliveryProfileId,p=t.format,h="";if(c&&(h=c.pathExt,o.mimetype=c.mimeType),t.hasFlavorIds()?(!h&&r.flavorAssets&&r.flavorAssets.length>0&&(h=r.flavorAssets[0].fileExt),u=A.build({entryId:s,flavorIds:t.flavorIds,format:p,ks:n,partnerId:i,uiConfId:a,extension:h,protocol:d})):u=e.addKsToUrl(t.url,n),!u){var g="failed to create play url from source, discarding source: ("+s+"_"+f+"), "+p;return e._logger.warn(g),null}if(o.url=u,o.id=s+"_"+f+","+p,t.hasDrmData()){var y=[];t.drm.forEach((function(e){y.push(new S.a(e.licenseURL,l.a.Scheme[e.scheme],e.certificate))})),o.drmData=y}}return o},e._parseProgressiveSources=function(t,r,n,i,a,s){var o=[],u=[];if(t){var c=t.getProtocol(e._getBaseProtocol()),l=t.format,d=t.deliveryProfileId,f=d+","+l;r.flavorAssets.map((function(t){var r=new D.a;r.id=t.id+f,r.mimetype="mp3"===t.fileExt?"audio/mp3":"video/mp4",r.height=t.height,r.width=t.width,r.bandwidth=1024*t.bitrate,r.label=t.label||t.language;var p=A.build({entryId:s,flavorIds:t.id,format:l,ks:n,partnerId:i,uiConfId:a,extension:t.fileExt,protocol:c});if(""===p)return e._logger.warn("failed to create play url from source, discarding source: ("+s+"_"+d+"), "+l+"."),null;r.url=p,t.height&&t.width?o.push(r):u.push(r)}))}return u.length&&!o.length?u:o},e._parseMetadata=function(e){var t={};return e&&e.metas&&e.metas.length>0&&e.metas.forEach((function(e){if(e.xml){var r,n=new DOMParser;e.xml=e.xml.replace(/\r?\n|\r/g,""),e.xml=e.xml.replace(/>\s*/g,">"),e.xml=e.xml.replace(/>\s*/g,">"),r=n.parseFromString(e.xml,"text/xml");var i=P.xmlToJson(r);Object.keys(i.metadata).forEach((function(e){t[e]=i.metadata[e]["#text"]}))}})),t},e._getBaseProtocol=function(){var e=o.get(),t=/^https?:/.exec(e.cdnUrl),r=t?t[0]:document.location.protocol;return"string"==typeof r?r.slice(0,-1):"https"},e.hasBlockAction=function(e){return e.playBackContextResult.hasBlockAction()},e.getBlockAction=function(e){return e.playBackContextResult.getBlockAction()},e.getErrorMessages=function(e){return e.playBackContextResult.getErrorMessages()},e}();!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(q,"_logger",Object(i.b)("OVPProviderParser"));var B=q.addKsToUrl,H=q,K=r(3),W=r(11),G=function(){function e(){}return e.getMultiRequest=function(e,t,r){var n=o.get(),i=n.serviceParams;Object.assign(i,{ks:t,clientTag:"html5:v"+e}),r&&Object.assign(i,{partnerId:r});var a=new Map;a.set("Content-Type","application/json");var s=new W.a(a);return s.method="POST",s.service="multirequest",s.url=s.getUrl(n.serviceUrl),s.params=i,s},e}();var Y=function e(t){void 0===t&&(t={}),this.type=t.type||e.Type.INCLUDE_FIELDS,this.fields=t.fields||"id,referenceId,name,description,thumbnailUrl,dataUrl,duration,msDuration,flavorParamsIds,mediaType,type,tags,dvrStatus,externalSourceType,status"};!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(Y,"Type",{INCLUDE_FIELDS:1,EXCLUDE_FIELDS:2});var J=function(e){var t,r;function n(){return e.apply(this,arguments)||this}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n.getPlaybackContext=function(e,t,r){var n=new Map;n.set("Content-Type","application/json");var i=new K.a(n);i.service="baseEntry",i.action="getPlaybackContext",i.method="POST",i.url=i.getUrl(e),i.tag="baseEntry-getPlaybackContext";return i.params={entryId:r,ks:t,contextDataParams:{objectType:"KalturaContextDataParams",flavorTags:"all"}},i},n.list=function(e,t,r,i,a){var s=new Map;s.set("Content-Type","application/json");var o=new K.a(s);return o.service="baseEntry",o.action="list",o.method="POST",o.url=o.getUrl(e),o.tag="list",o.params=n.getEntryListReqParams(r,t,i,a),o},n.getEntryListReqParams=function(e,t,r,n){var i={};return e?i=r?{redirectFromEntryId:e}:{idEqual:e}:n&&(i={objectType:"KalturaBaseEntryFilter",referenceIdEqual:n}),{ks:t,filter:i,responseProfile:new Y}},n}(G);var X=function(e){var t,r;function n(){return e.apply(this,arguments)||this}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n.list=function(e,t,r){var n=new Map;n.set("Content-Type","application/json");var i=new K.a(n);i.service="metadata_metadata",i.action="list",i.method="POST",i.url=i.getUrl(e),i.tag="metadata_metadata-list";var a={objectType:"KalturaMetadataFilter",objectIdEqual:r,metadataObjectTypeEqual:"1"};return i.params={filter:a,ks:t},i},n}(G);var Q=function(e){var t,r;function n(t){var r;return(r=e.call(this,t)||this).hasError||(r.totalCount=t.totalCount,r.totalCount>0&&(r.entries=[],t.objects.map((function(e){return r.entries.push(new C(e))})))),r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n}(u.a);function Z(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,n.key,n)}}function z(e,t,r){return t&&Z(e.prototype,t),r&&Z(e,r),e}var $=function(){function e(e){!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"_response",{}),this.requests=this.buildRequests(e),this._entryId=e.entryId,this._referenceId=e.referenceId}z(e,null,[{key:"id",get:function(){return"media"}}]);var t=e.prototype;return t.buildRequests=function(e){var t=o.get(),r=[];r.push(J.list(t.serviceUrl,e.ks,e.entryId,e.redirectFromEntryId,e.referenceId));var n="{1:result:ks}"===e.ks?"{2:result:objects:0:id}":"{1:result:objects:0:id}";return r.push(J.getPlaybackContext(t.serviceUrl,e.ks,n)),r.push(X.list(t.serviceUrl,e.ks,n)),r},t.isValid=function(){return!(!this._entryId&&!this._referenceId)},z(e,[{key:"requests",set:function(e){this._requests=e},get:function(){return this._requests}},{key:"response",set:function(e){var t=new Q(e[0].data);this._response.entry=t.entries[0],this._response.playBackContextResult=new b(e[1].data),this._response.metadataListResult=new T(e[2].data)},get:function(){return this._response}}]),e}();var ee=function(e){var t,r;function n(){return e.apply(this,arguments)||this}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n.anonymousSession=function(e,t){var r=new Map;r.set("Content-Type","application/json");var n=new K.a(r);return n.service="session",n.action="startWidgetSession",n.method="POST",n.url=n.getUrl(e),n.tag="session-startWidget",n.params={widgetId:t},n},n}(G);function te(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,n.key,n)}}var re=function(){var e,t,r;function n(e){!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"_response",{}),this.requests=this.buildRequests(e),this._widgetId=e.widgetId}e=n,r=[{key:"id",get:function(){return"session"}}],(t=[{key:"requests",set:function(e){this._requests=e},get:function(){return this._requests}},{key:"response",set:function(e){this._response.ks=e[0].data.ks},get:function(){return this._response.ks}}])&&te(e.prototype,t),r&&te(e,r);var i=n.prototype;return i.buildRequests=function(e){var t=o.get(),r=[];return r.push(ee.anonymousSession(t.serviceUrl,e.widgetId)),r},i.isValid=function(){return!!this._widgetId},n}();var ne=function(e){var t,r;function n(t,r,n,i){var a;return void 0===n&&(n=""),(a=e.call(this,i)||this)._multiRequest=G.getMultiRequest(t,n,r),a}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n}(r(10).a);var ie=function(e){var t,r;function n(){return e.apply(this,arguments)||this}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n.execute=function(e,t,r){var n=new Map;n.set("Content-Type","application/json");var i=new K.a(n);return i.service="playlist",i.action="execute",i.method="POST",i.url=i.getUrl(e),i.tag="playlist-execute",i.params={ks:t,id:r,responseProfile:new Y},i},n.get=function(e,t,r){var n=new Map;n.set("Content-Type","application/json");var i=new K.a(n);return i.service="playlist",i.action="get",i.method="POST",i.url=i.getUrl(e),i.tag="playlist-get",i.params={ks:t,id:r,responseProfile:{fields:"id,name,description,thumbnailUrl",type:1}},i},n}(G),ae=function(e){this.id=e.id,this.name=e.name,this.description=e.description,this.poster=e.thumbnailUrl};var se=function(e){var t,r;function n(t){var r;return(r=e.call(this,t)||this).hasError||(r.entries=[],t.map((function(e){return r.entries.push(new C(e))}))),r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n}(u.a);function oe(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,n.key,n)}}function ue(e,t,r){return t&&oe(e.prototype,t),r&&oe(e,r),e}var ce=function(){function e(e){!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"_response",{}),this.requests=this.buildRequests(e),this._playlistId=e.playlistId}ue(e,null,[{key:"id",get:function(){return"playlist"}}]);var t=e.prototype;return t.buildRequests=function(e){var t=o.get(),r=[];return r.push(ie.get(t.serviceUrl,e.ks,e.playlistId)),r.push(ie.execute(t.serviceUrl,e.ks,e.playlistId)),r},t.isValid=function(){return!!this._playlistId},ue(e,[{key:"requests",set:function(e){this._requests=e},get:function(){return this._requests}},{key:"response",set:function(e){this._response.playlistData=new ae(e[0].data),this._response.playlistItems=new se(e[1].data)},get:function(){return this._response}}]),e}(),le=r(14);function de(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,n.key,n)}}function fe(e,t,r){return t&&de(e.prototype,t),r&&de(e,r),e}var pe=function(){function e(e){!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"_response",{playlistItems:{entries:[]}}),this.requests=this.buildRequests(e),this._entries=e.entries}fe(e,null,[{key:"id",get:function(){return"entry_list"}}]);var t=e.prototype;return t.buildRequests=function(e){var t=o.get(),r=[];return e.entries.forEach((function(n){r.push(J.list(t.serviceUrl,e.ks,n.entryId||n,e.redirectFromEntryId,n.referenceId))})),r},t.isValid=function(){return!(!this._entries||!this._entries.length)},fe(e,[{key:"requests",set:function(e){this._requests=e},get:function(){return this._requests}},{key:"response",set:function(e){var t,r=this;e.forEach((function(e){t=new Q(e.data),r._response.playlistItems.entries.push(t.entries[0])}))},get:function(){return this._response}}]),e}(),he=r(0);function ge(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ye=function(e){var t,r;function n(t){var r;return(r=e.call(this,t)||this).hasError||(r.name=t.name,r.description=t.description,r.objTypeAsString=t.objTypeAsString,r.width=t.width,r.height=t.height,r.htmlParams=t.htmlParams,r.swfUrl=t.swfUrl,r.confFilePath=t.confFilePath,r.confFile=t.confFile,r.confFileFeatures=t.confFileFeatures,r.config=t.config,r.confVars=t.confVars,r.useCdn=t.useCdn,r.tags=t.tags,r.swfUrlVersion=t.swfUrlVersion,r.created=new Date(0),r.created.setUTCSeconds(t.createdAt),r.updated=new Date(0),r.updated.setUTCSeconds(t.updatedAt),r.html5Url=t.description,r.version=t.description,r.partnerTags=t.description,r.objType=t.description,r.creationMode=t.description),r}return r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,n}(u.a);function me(e,t,r,n,i,a,s){try{var o=e[a](s),u=o.value}catch(e){return void r(e)}o.done?t(u):Promise.resolve(u).then(n,i)}function ve(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var a=e.apply(t,r);function s(e){me(a,n,i,s,o,"next",e)}function o(e){me(a,n,i,s,o,"throw",e)}s(void 0)}))}}ge(ye,"Type",{PLAYER:1,CONTRIBUTION_WIZARD:2,SIMPLE_EDITOR:3,ADVANCED_EDITOR:4,PLAYLIST:5,APP_STUDIO:6,KRECORD:7,PLAYER_V3:8,KMC_ACCOUNT:9,KMC_ANALYTICS:10,KMC_CONTENT:11,KMC_DASHBOARD:12,KMC_LOGIN:13,PLAYER_SL:14,CLIENTSIDE_ENCODER:15,KMC_GENERAL:16,KMC_ROLES_AND_PERMISSIONS:17,CLIPPER:18,KSR:19,KUPLOAD:20,WEBCASTING:21}),ge(ye,"CreationMode",{WIZARD:2,ADVANCED:3});var _e=function(){function e(){}return e._applyRegexAction=function(e,t){if(e){var r=new RegExp(e.pattern,"i");if(t.match(r))return t.replace(r,e.replacement+"/")}return t},e._isECDNUrlAlive=function(){var t=ve(regeneratorRuntime.mark((function t(r,n){var i,a;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i=n+"/api_v3/service/system/action/ping/format/1",(a=new XMLHttpRequest).open("GET",i),a.timeout=r.checkAliveTimeoutMs,a.onreadystatechange=function(){if(4===a.readyState)return 200===a.status},a.ontimeout=function(){return e._logger.warn("Got timeout while pinging the ECDN url. the ping url: "+i),!1},a.send();case 7:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),e.handleRegexAction=function(){var t=ve(regeneratorRuntime.mark((function t(r,n){var i,a,s;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=o.get().cdnUrl,a=e._extractRegexActionFromData(n),s=e._getRegExp(a),t.t0=i&&a&&s&&i.match(s),!t.t0){t.next=11;break}if(t.t1=a.checkAliveTimeoutMs>0,!t.t1){t.next=10;break}return t.next=9,e._isECDNUrlAlive(a,i.replace(s,a.replacement));case 9:t.t1=!t.sent;case 10:t.t0=!t.t1;case 11:if(!t.t0){t.next=14;break}return e._replaceHostUrls(r,a),t.abrupt("return",r);case 14:return e._logger.debug("exiting handleRegexAction - not applying regex action."),t.abrupt("return",r);case 16:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),e._replaceHostUrls=function(t,r){e._logger.debug("Starting to modify urls...");var n=t.sources,i=n.hls,a=n.dash,s=n.progressive,u=n.image;[].concat(i,a,s,u).forEach((function(t){return t.url=e._applyRegexAction(r,t.url)})),o.get().replaceHostOnlyManifestUrls||(e._logger.debug("replaceHostOnlyManifestUrls flag is off - modifying captions and poster URLs"),n.captions&&n.captions.forEach((function(t){return t.url=e._applyRegexAction(r,t.url)})),"string"==typeof n.poster&&(n.poster=e._applyRegexAction(r,n.poster))),e._logger.debug("Finished modifying urls")},e._extractRegexActionFromData=function(e){var t,r;return null==(t=e.get($.id))||null==(r=t.response)?void 0:r.playBackContextResult.getRequestHostRegexAction()},e._getRegExp=function(e){if(e&&e.pattern&&e.replacement)return new RegExp(e.pattern,"i")},e}();!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(_e,"_logger",Object(i.b)("RegexActionHandler"));var Ee=_e;function be(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,n.key,n)}}var Ie=function(e){var t,r;function n(t,r){var n;return function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(n=e.call(this,t,r)||this),"_filterOptionsConfig",{redirectFromEntryId:!0}),n._logger=Object(i.b)("OVPProvider"),o.set(t.env),n._setFilterOptionsConfig(t.filterOptions),n._networkRetryConfig=Object.assign(n._networkRetryConfig,t.networkRetryParameters),n}r=e,(t=n).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r;var a,s,u,c=n.prototype;return c.getMediaConfig=function(e){var t=this;return e.ks&&(this.ks=e.ks,this._isAnonymous=!1),this.widgetId!==this.defaultWidgetId&&(this._isAnonymous=!1),this._dataLoader=new ne(this.playerVersion,this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var i=e.entryId,a=e.referenceId;if(i||a){var s=t.ks;s||(s="{1:result:ks}",t._dataLoader.add(re,{widgetId:t.widgetId}));var o=t._getEntryRedirectFilter(e);return t._dataLoader.add($,{entryId:i,ks:s,redirectFromEntryId:o,referenceId:a}),t._dataLoader.fetchData().then((function(e){try{var i=t._parseDataFromResponse(e);Ee.handleRegexAction(i,e).then(r)}catch(e){n(e)}}),(function(e){n(e)}))}n(new he.a(he.a.Severity.CRITICAL,he.a.Category.PROVIDER,he.a.Code.MISSING_MANDATORY_PARAMS,{message:"missing entry id"}))}))},c.doRequest=function(e,t){var r=this,n=t||this.ks,i=new ne(this.playerVersion,this.partnerId,n,this._networkRetryConfig);return new Promise((function(t,a){return n||i.add(re,{widgetId:r.widgetId}),e.forEach((function(e){i.add(e.loader,e.params,n||"{1:result:ks}")})),i.fetchData().then((function(e){try{t(e)}catch(e){a(e)}}),(function(e){a(e)}))}))},c._getEntryRedirectFilter=function(e){return"boolean"==typeof e.redirectFromEntryId?e.redirectFromEntryId:"boolean"!=typeof this._filterOptionsConfig.redirectFromEntryId||this._filterOptionsConfig.redirectFromEntryId},c._setFilterOptionsConfig=function(e){e&&"boolean"==typeof e.redirectFromEntryId&&(this._filterOptionsConfig.redirectFromEntryId=e.redirectFromEntryId)},c._parseDataFromResponse=function(e){this._logger.debug("Data parsing started");var t={session:{isAnonymous:this._isAnonymous,partnerId:this.partnerId},sources:this._getDefaultSourcesObject(),plugins:{}};if(this.uiConfId&&(t.session.uiConfId=this.uiConfId),e){if(e.has(re.id)){var r=e.get(re.id);r&&r.response&&(t.session.ks=r.response,this.widgetId!==this.defaultWidgetId&&(this.ks=t.session.ks))}else t.session.ks=this.ks;if(e.has($.id)){var n=e.get($.id);if(n&&n.response){var i=n.response;if(H.hasBlockAction(i))throw new he.a(he.a.Severity.CRITICAL,he.a.Category.SERVICE,he.a.Code.BLOCK_ACTION,{action:H.getBlockAction(i),messages:H.getErrorMessages(i)});var a=H.getMediaEntry(this.isAnonymous?"":this.ks,this.partnerId,this.uiConfId,i);Object.assign(t.sources,this._getSourcesObject(a)),this._verifyMediaStatus(a),this._verifyHasSources(t.sources);var s=H.getBumper(i,this.isAnonymous?"":this.ks,this.partnerId);s&&Object.assign(t.plugins,{bumper:s})}}}return this._logger.debug("Data parsing finished",t),t},c._verifyMediaStatus=function(e){if([C.EntryStatus.IMPORT,C.EntryStatus.PRECONVERT].includes(e.status))throw new he.a(he.a.Severity.CRITICAL,he.a.Category.SERVICE,he.a.Code.MEDIA_STATUS_NOT_READY,{messages:"Status of entry id "+e.id+" is "+e.status+" and is still being imported or converted",data:{status:status}})},c.getPlaylistConfig=function(e){var t=this;return e.ks&&(this.ks=e.ks,this._isAnonymous=!1),this.widgetId!==this.defaultWidgetId&&(this._isAnonymous=!1),this._dataLoader=new ne(this.playerVersion,this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var i=e.playlistId;if(i){var a=t.ks;a||(a="{1:result:ks}",t._dataLoader.add(re,{widgetId:t.widgetId})),t._dataLoader.add(ce,{playlistId:i,ks:a}),t._dataLoader.fetchData().then((function(e){r(t._parsePlaylistDataFromResponse(e))}),(function(e){n(e)}))}else n({success:!1,data:"Missing mandatory parameter"})}))},c._parsePlaylistDataFromResponse=function(e){var t=this;this._logger.debug("Data parsing started");var r=this._getPlaylistObject();if(e&&e.has(ce.id)){var n=e.get(ce.id);if(n&&n.response){var i=H.getPlaylist(n.response);r.id=i.id,r.poster=i.poster,r.metadata.name=i.name,r.metadata.description=i.description,i.items.forEach((function(e){return r.items.push({sources:t._getSourcesObject(e)})}))}}return this._logger.debug("Data parsing finished",r),r},c.getEntryListConfig=function(e){var t=this;return e.ks&&(this.ks=e.ks,this._isAnonymous=!1),this.widgetId!==this.defaultWidgetId&&(this._isAnonymous=!1),this._dataLoader=new ne(this.playerVersion,this.partnerId,this.ks,this._networkRetryConfig),new Promise((function(r,n){var i=e.entries;if(i&&i.length){var a=t.ks;a||(a="{1:result:ks}",t._dataLoader.add(re,{widgetId:t.widgetId}));var s=t._getEntryRedirectFilter(e);t._dataLoader.add(pe,{entries:i,ks:a,redirectFromEntryId:s}),t._dataLoader.fetchData(!1).then((function(e){r(t._parseEntryListDataFromResponse(e))}),(function(e){n(e)}))}else n({success:!1,data:"Missing mandatory parameter"})}))},c._parseEntryListDataFromResponse=function(e){var t=this;this._logger.debug("Data parsing started");var r=this._getPlaylistObject();if(e&&e.has(pe.id)){var n=e.get(pe.id);if(n&&n.response)H.getEntryList(n.response).items.forEach((function(e){return r.items.push({sources:t._getSourcesObject(e)})}))}return this._logger.debug("Data parsing finished",r),r},c._getPlaylistObject=function(){return{id:"",metadata:{name:"",description:""},poster:"",items:[]}},c._getDefaultSourcesObject=function(){return{hls:[],dash:[],progressive:[],image:[],id:"",duration:0,type:w.a.Type.UNKNOWN,poster:"",dvr:!1,vr:null,metadata:{name:"",description:"",tags:""}}},c._getSourcesObject=function(e){var t=this._getDefaultSourcesObject(),r=e.sources.toJSON();return t.hls=r.hls,t.dash=r.dash,t.progressive=r.progressive,t.image=r.image,t.id=e.id,t.duration=e.duration,t.type=e.type,t.dvr=!!e.dvrStatus,t.poster=e.poster,e.sources.captions&&(t.captions=e.sources.captions),e.metadata&&"string"==typeof e.metadata.tags&&e.metadata.tags.search(/\b360\b/)>-1&&(t.vr={}),Object.assign(t.metadata,e.metadata),t},a=n,(s=[{key:"env",get:function(){return o.get()}}])&&be(a.prototype,s),u&&be(a,u),n}(le.a),Re="@playkit-js/playkit-js-providers-ovp",Te="2.39.3-canary.0-edd6027"}])}));
2
2
  //# sourceMappingURL=playkit-ovp-provider.js.map