New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@glomex/content-sdk-js

Package Overview
Dependencies
Maintainers
18
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@glomex/content-sdk-js - npm Package Compare versions

Comparing version 1.1.4 to 1.2.0

src/util.js

3

CHANGELOG.md
### v1.2.0 / 2018-06-08 14:42:24
### v1.1.4 / 2018-06-08 07:12:14

@@ -3,0 +6,0 @@

2

dist/example/create-video-player.js

@@ -1,2 +0,2 @@

!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([,function(e,t,n){var r,o,i;o=[],void 0===(i="function"==typeof(r=function(){"use strict";!function(e,t){t.createOwnVideoPlayer||(t.createOwnVideoPlayer=function(t){var n=e.getElementById("example-container");n||(n=e.createElement("div"),e.getElementsByTagName("body")[0].appendChild(n));var r=e.createElement("video"),o=e.createElement("source");return o.type="video/mp4",o.src=t.progressive,r.appendChild(o),r.autoplay=!1,r.setAttribute("width","640"),r.setAttribute("height","480"),r.controls=!0,n.appendChild(r),r})}(document,window)})?r.apply(t,o):r)||(e.exports=i)}]);
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}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 o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));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=0)}([function(e,t,r){"use strict";!function(e,t){t.createOwnVideoPlayer||(t.createOwnVideoPlayer=function(t){var r=e.getElementById("example-container");r||(r=e.createElement("div"),e.getElementsByTagName("body")[0].appendChild(r));var n=e.createElement("video"),o=e.createElement("source");return o.type="video/mp4",o.src=t.progressive,n.appendChild(o),n.autoplay=!1,n.setAttribute("width","640"),n.setAttribute("height","480"),n.controls=!0,r.appendChild(n),n})}(document,window)}]);
//# sourceMappingURL=create-video-player.js.map

@@ -1,16 +0,2 @@

!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=24)}([function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},,function(t,e,n){
/**
* lite-url - Small, JS lib that uses regex for parsing a URL into it's component parts.
* @version v1.0.5
* @link https://github.com/sadams/lite-url
* @license BSD-3-Clause
*/
(function(){"use strict";function n(t,e,n){var r=t.split(e);return n(r.shift(),r.join(e))}function r(t){var e={hash:"",host:"",hostname:"",origin:"",pathname:"",protocol:"",search:"",password:"",username:"",port:""};return n(t,"#",function(t,r){r&&(e.hash=r?"#"+r:""),n(t,"?",function(t,r){r&&(e.search="?"+r),t&&n(t,"//",function(t,r){e.protocol=t,n(r,"/",function(t,r){e.pathname="/"+(r||""),(e.protocol||t)&&(e.origin=e.protocol+"//"+t),n(t,"@",function(t,r){if(r){var o=t.split(":");e.username=o[0],e.password=o[1]}else r=t;e.host=r,n(r,":",function(t,n){e.hostname=t,n&&(e.port=n)})})})})})}),e.href=e.origin+e.pathname+e.search+e.hash,e}function o(t){var e={},n=t.search;if(n){var r=(n=n.replace(new RegExp("\\?"),"")).split("&");for(var o in r)if(r.hasOwnProperty(o)&&r[o]){var i=r[o].split("=");e[i[0]]=i[1]}}return e}function i(t){var e=u[t];return void 0!==e?e:((e=r(t)).params=o(e),u[t]=e,e)}var u={};return i.changeQueryParser=function(t){o=t},void 0!==t&&t.exports&&(e=t.exports=i),e.liteURL=i,i}).call(this)},function(t,e,n){var r,o,i;o=[e,n(2)],void 0===(i="function"==typeof(r=function(t,e){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.handleConfigErrors=t.getPageUrl=void 0;var n,r=(n=e)&&n.__esModule?n:{default:n};t.getPageUrl=function(){return window.glomexContext&&window.glomexContext.pageUrl?(0,r.default)(window.glomexContext.pageUrl):function(){try{return window.self!==window.top}catch(t){return!0}}()&&window.document.referrer?(0,r.default)(window.document.referrer):(0,r.default)(window.location.href)},t.handleConfigErrors=function(t){Object.keys(t).forEach(function(e){if(!t[e])throw new Error("config."+e+" not found, "+e+" must be provided")})}})?r.apply(e,o):r)||(t.exports=i)},function(t,e){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);t.exports=function(t,e){var r=e||0,o=n;return o[t[r++]]+o[t[r++]]+o[t[r++]]+o[t[r++]]+"-"+o[t[r++]]+o[t[r++]]+"-"+o[t[r++]]+o[t[r++]]+"-"+o[t[r++]]+o[t[r++]]+"-"+o[t[r++]]+o[t[r++]]+o[t[r++]]+o[t[r++]]+o[t[r++]]+o[t[r++]]}},function(t,e){var n="undefined"!=typeof crypto&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);t.exports=function(){return n(r),r}}else{var o=new Array(16);t.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),o[e]=t>>>((3&e)<<3)&255;return o}}},function(t,e,n){var r,o,i=n(5),u=n(4),c=0,s=0;t.exports=function(t,e,n){var a=e&&n||0,f=e||[],l=(t=t||{}).node||r,d=void 0!==t.clockseq?t.clockseq:o;if(null==l||null==d){var p=i();null==l&&(l=r=[1|p[0],p[1],p[2],p[3],p[4],p[5]]),null==d&&(d=o=16383&(p[6]<<8|p[7]))}var h=void 0!==t.msecs?t.msecs:(new Date).getTime(),v=void 0!==t.nsecs?t.nsecs:s+1,y=h-c+(v-s)/1e4;if(y<0&&void 0===t.clockseq&&(d=d+1&16383),(y<0||h>c)&&void 0===t.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=h,s=v,o=d;var g=(1e4*(268435455&(h+=122192928e5))+v)%4294967296;f[a++]=g>>>24&255,f[a++]=g>>>16&255,f[a++]=g>>>8&255,f[a++]=255&g;var m=h/4294967296*1e4&268435455;f[a++]=m>>>8&255,f[a++]=255&m,f[a++]=m>>>24&15|16,f[a++]=m>>>16&255,f[a++]=d>>>8|128,f[a++]=255&d;for(var w=0;w<6;++w)f[a+w]=l[w];return e||u(f)}},function(t,e,n){var r,o,i;o=[e,n(6),n(3)],void 0===(i="function"==typeof(r=function(t,e,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=(r=e)&&r.__esModule?r:{default:r},i={integrationId:null,contentId:null,pageUrl:(0,n.getPageUrl)().href,contentSessionId:(0,o.default)(),clientInfo:function(){try{return window.navigator.appVersion}catch(t){return"n/a"}}(),backendUrl:"https://integration-sdk-eu-west-1.mes.glomex.cloud/video"};t.default=function(t,e){return function(r){if(!r)throw new Error("No config found, config object must be provided");var o=Object.assign({},i,r);(0,n.handleConfigErrors)(o);var u=e(o);return new t(u)}}})?r.apply(e,o):r)||(t.exports=i)},function(t,e,n){var r,o,i;o=[e],void 0===(i="function"==typeof(r=function(t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t){return{getSources:function(){return t.getVideoSources()},trackContentBegin:function(){return t.trackEvent("contentBegin")},trackAdBegin:function(e){return t.trackEvent("adBegin",e)}}}})?r.apply(e,o):r)||(t.exports=i)},function(t,e){var n,r,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function c(t){if(n===setTimeout)return setTimeout(t,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(t){n=i}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(t){r=u}}();var s,a=[],f=!1,l=-1;function d(){f&&s&&(f=!1,s.length?a=s.concat(a):l=-1,a.length&&p())}function p(){if(!f){var t=c(d);f=!0;for(var e=a.length;e;){for(s=a,a=[];++l<e;)s&&s[l].run();l=-1,e=a.length}s=null,f=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function h(t,e){this.fun=t,this.array=e}function v(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];a.push(new h(t,e)),1!==a.length||f||c(p)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e,n){(function(e,n){
/*!
* @overview es6-promise - a tiny implementation of Promises/A+.
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
* @license Licensed under MIT license
* See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
* @version v4.2.4+314e4831
*/var r;r=function(){"use strict";function t(t){return"function"==typeof t}var r=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},o=0,i=void 0,u=void 0,c=function(t,e){h[o]=t,h[o+1]=e,2===(o+=2)&&(u?u(v):b())};var s="undefined"!=typeof window?window:void 0,a=s||{},f=a.MutationObserver||a.WebKitMutationObserver,l="undefined"==typeof self&&void 0!==e&&"[object process]"==={}.toString.call(e),d="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function p(){var t=setTimeout;return function(){return t(v,1)}}var h=new Array(1e3);function v(){for(var t=0;t<o;t+=2){(0,h[t])(h[t+1]),h[t]=void 0,h[t+1]=void 0}o=0}var y,g,m,w,b=void 0;function _(t,e){var n=this,r=new this.constructor(E);void 0===r[x]&&F(r);var o=n._state;if(o){var i=arguments[o-1];c(function(){return U(o,r,i,n._result)})}else q(n,r,t,e);return r}function j(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=new this(E);return R(e,t),e}l?b=function(){return e.nextTick(v)}:f?(g=0,m=new f(v),w=document.createTextNode(""),m.observe(w,{characterData:!0}),b=function(){w.data=g=++g%2}):d?((y=new MessageChannel).port1.onmessage=v,b=function(){return y.port2.postMessage(0)}):b=void 0===s?function(){try{var t=Function("return this")().require("vertx");return void 0!==(i=t.runOnLoop||t.runOnContext)?function(){i(v)}:p()}catch(t){return p()}}():p();var x=Math.random().toString(36).substring(2);function E(){}var k=void 0,O=1,T=2,S={error:null};function A(t){try{return t.then}catch(t){return S.error=t,S}}function C(e,n,r){n.constructor===e.constructor&&r===_&&n.constructor.resolve===j?function(t,e){e._state===O?P(t,e._result):e._state===T?I(t,e._result):q(e,void 0,function(e){return R(t,e)},function(e){return I(t,e)})}(e,n):r===S?(I(e,S.error),S.error=null):void 0===r?P(e,n):t(r)?function(t,e,n){c(function(t){var r=!1,o=function(t,e,n,r){try{t.call(e,n,r)}catch(t){return t}}(n,e,function(n){r||(r=!0,e!==n?R(t,n):P(t,n))},function(e){r||(r=!0,I(t,e))},t._label);!r&&o&&(r=!0,I(t,o))},t)}(e,n,r):P(e,n)}function R(t,e){var n,r;t===e?I(t,new TypeError("You cannot resolve a promise with itself")):(r=typeof(n=e),null===n||"object"!==r&&"function"!==r?P(t,e):C(t,e,A(e)))}function M(t){t._onerror&&t._onerror(t._result),L(t)}function P(t,e){t._state===k&&(t._result=e,t._state=O,0!==t._subscribers.length&&c(L,t))}function I(t,e){t._state===k&&(t._state=T,t._result=e,c(M,t))}function q(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+O]=n,o[i+T]=r,0===i&&t._state&&c(L,t)}function L(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,o=void 0,i=t._result,u=0;u<e.length;u+=3)r=e[u],o=e[u+n],r?U(n,r,o,i):o(i);t._subscribers.length=0}}function U(e,n,r,o){var i=t(r),u=void 0,c=void 0,s=void 0,a=void 0;if(i){if((u=function(t,e){try{return t(e)}catch(t){return S.error=t,S}}(r,o))===S?(a=!0,c=u.error,u.error=null):s=!0,n===u)return void I(n,new TypeError("A promises callback cannot return that same promise."))}else u=o,s=!0;n._state!==k||(i&&s?R(n,u):a?I(n,c):e===O?P(n,u):e===T&&I(n,u))}var X=0;function F(t){t[x]=X++,t._state=void 0,t._result=void 0,t._subscribers=[]}var H=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(E),this.promise[x]||F(this.promise),r(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?P(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&P(this.promise,this._result))):I(this.promise,new Error("Array Methods must be provided an Array"))}return t.prototype._enumerate=function(t){for(var e=0;this._state===k&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===j){var o=A(t);if(o===_&&t._state!==k)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(n===N){var i=new n(E);C(i,t,o),this._willSettleAt(i,e)}else this._willSettleAt(new n(function(e){return e(t)}),e)}else this._willSettleAt(r(t),e)},t.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===k&&(this._remaining--,t===T?I(r,n):this._result[e]=n),0===this._remaining&&P(r,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;q(t,void 0,function(t){return n._settledAt(O,e,t)},function(t){return n._settledAt(T,e,t)})},t}();var N=function(){function t(e){this[x]=X++,this._result=this._state=void 0,this._subscribers=[],E!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof t?function(t,e){try{e(function(e){R(t,e)},function(e){I(t,e)})}catch(e){I(t,e)}}(this,e):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return t.prototype.catch=function(t){return this.then(null,t)},t.prototype.finally=function(t){var e=this.constructor;return this.then(function(n){return e.resolve(t()).then(function(){return n})},function(n){return e.resolve(t()).then(function(){throw n})})},t}();return N.prototype.then=_,N.all=function(t){return new H(this,t).promise},N.race=function(t){var e=this;return r(t)?new e(function(n,r){for(var o=t.length,i=0;i<o;i++)e.resolve(t[i]).then(n,r)}):new e(function(t,e){return e(new TypeError("You must pass an array to race."))})},N.resolve=j,N.reject=function(t){var e=new this(E);return I(e,t),e},N._setScheduler=function(t){u=t},N._setAsap=function(t){c=t},N._asap=c,N.polyfill=function(){var t=void 0;if(void 0!==n)t=n;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var r=null;try{r=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===r&&!e.cast)return}t.Promise=N},N.Promise=N,N},t.exports=r()}).call(this,n(9),n(0))},function(t,e,n){"use strict";var r=new RegExp("%[a-f0-9]{2}","gi"),o=new RegExp("(%[a-f0-9]{2})+","gi");function i(t,e){try{return decodeURIComponent(t.join(""))}catch(t){}if(1===t.length)return t;e=e||1;var n=t.slice(0,e),r=t.slice(e);return Array.prototype.concat.call([],i(n),i(r))}function u(t){try{return decodeURIComponent(t)}catch(o){for(var e=t.match(r),n=1;n<e.length;n++)e=(t=i(e,n).join("")).match(r);return t}}t.exports=function(t){if("string"!=typeof t)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch(e){return function(t){for(var e={"%FE%FF":"��","%FF%FE":"��"},n=o.exec(t);n;){try{e[n[0]]=decodeURIComponent(n[0])}catch(t){var r=u(n[0]);r!==n[0]&&(e[n[0]]=r)}n=o.exec(t)}e["%C2"]="�";for(var i=Object.keys(e),c=0;c<i.length;c++){var s=i[c];t=t.replace(new RegExp(s,"g"),e[s])}return t}(t)}}},function(t,e,n){"use strict";t.exports=(t=>encodeURIComponent(t).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`))},function(t,e,n){"use strict";const r=n(12),o=n(11);function i(t,e){return e.encode?e.strict?r(t):encodeURIComponent(t):t}function u(t,e){return e.decode?o(t):t}function c(t){const e=t.indexOf("?");return-1===e?"":t.slice(e+1)}function s(t,e){const n=function(t){let e;switch(t.arrayFormat){case"index":return(t,n,r)=>{e=/\[(\d*)\]$/.exec(t),t=t.replace(/\[\d*\]$/,""),e?(void 0===r[t]&&(r[t]={}),r[t][e[1]]=n):r[t]=n};case"bracket":return(t,n,r)=>{e=/(\[\])$/.exec(t),t=t.replace(/\[\]$/,""),e?void 0!==r[t]?r[t]=[].concat(r[t],n):r[t]=[n]:r[t]=n};default:return(t,e,n)=>{void 0!==n[t]?n[t]=[].concat(n[t],e):n[t]=e}}}(e=Object.assign({decode:!0,arrayFormat:"none"},e)),r=Object.create(null);if("string"!=typeof t)return r;if(!(t=t.trim().replace(/^[?#&]/,"")))return r;for(const o of t.split("&")){let[t,i]=o.replace(/\+/g," ").split("=");i=void 0===i?null:u(i,e),n(u(t,e),i,r)}return Object.keys(r).sort().reduce((t,e)=>{const n=r[e];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?t[e]=function t(e){return Array.isArray(e)?e.sort():"object"==typeof e?t(Object.keys(e)).sort((t,e)=>Number(t)-Number(e)).map(t=>e[t]):e}(n):t[e]=n,t},Object.create(null))}e.extract=c,e.parse=s,e.stringify=((t,e)=>{!1===(e=Object.assign({encode:!0,strict:!0,arrayFormat:"none"},e)).sort&&(e.sort=(()=>{}));const n=function(t){switch(t.arrayFormat){case"index":return(e,n,r)=>null===n?[i(e,t),"[",r,"]"].join(""):[i(e,t),"[",i(r,t),"]=",i(n,t)].join("");case"bracket":return(e,n)=>null===n?[i(e,t),"[]"].join(""):[i(e,t),"[]=",i(n,t)].join("");default:return(e,n)=>null===n?i(e,t):[i(e,t),"=",i(n,t)].join("")}}(e);return t?Object.keys(t).sort(e.sort).map(r=>{const o=t[r];if(void 0===o)return"";if(null===o)return i(r,e);if(Array.isArray(o)){const t=[];for(const e of o.slice())void 0!==e&&t.push(n(r,e,t.length));return t.join("&")}return i(r,e)+"="+i(o,e)}).filter(t=>t.length>0).join("&"):""}),e.parseUrl=((t,e)=>({url:t.split("?")[0]||"",query:s(c(t),e)}))},function(t,e,n){var r,o,i;o=[e,n(13),n(10)],void 0===(i="function"==typeof(r=function(t,e){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,r=(n=e)&&n.__esModule?n:{default:n},o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._xhr=e,this._defaultXhrOptions={method:"get",url:null,json:!0},this._config=Object.assign({},n),this._videoStored=null}return i(t,[{key:"getVideoSources",value:function(){var t=this;return new Promise(function(e,n){var r=t._createUrl(t._config);t._xhr.get({url:r,json:!0},function(r,o,i){t._handleGetVideoSources(r,o,i,e,n)})})}},{key:"_handleGetVideoSources",value:function(t,e,n,r,i){return t?i(t):n&&n.error?i(n.error):n?n.video&&n.video.source?(this._storeVideo(n.video),void r(o({},n.video.source))):i(new Error("Video sources are malformed")):i(new Error("Can't fetch video sources"))}},{key:"_createUrl",value:function(t){var e=t.integrationId,n=t.contentId,o=t.pageUrl,i={integration_id:e,content_id:n,page_url:o,sdk_type:"js"},u=r.default.stringify(i);return this._config.backendUrl+"?"+u}},{key:"trackEvent",value:function(t,e){if(!t)throw new Error("event for tracking was not specified, event must be provided");if(!this._videoStored.tracking[t])throw new Error("Something is wrong with "+t+" tracking endpoints.");if("adBegin"===t&&!e)throw new Error("adRollName not found, adRollName must be provided");var n=this._videoStored.tracking[t];return this._executeTrackingRequests(n,e)}},{key:"_executeTrackingRequests",value:function(t,e){var n=this,r=t.map(function(t){var r=t.method,o=t.url,i=t.payload,u=void 0===i?{}:i;if(!o)return new Promise(function(t,e){return e(new Error("url is not found, endpoint is malformed"))});var c=n._getTrackingXhrOptions(r,o,u,e);return new Promise(function(t,e){n._xhr(c,function(n,r,o){return n?e(n):200===r.statusCode?t(o):void 0})})});return Promise.all(r).catch(function(t){throw console.log(t),new Error("Service is unavailable. Please contact glomex tech support")})}},{key:"_getTrackingXhrOptions",value:function(t,e,n,i){var u=this._defaultXhrOptions,c="get"===t.toLowerCase(),s=this._config,a=s.contentSessionId,f=s.clientInfo,l=o({},n,i?{contentSessionId:a,clientInfo:f,adRollName:i}:{contentSessionId:a,clientInfo:f});if(c){var d=e+"&"+r.default.stringify(l);return o({},u,{url:d})}return o({},u,{method:"post",url:e,body:l})}},{key:"_storeVideo",value:function(t){this._videoStored=t}}]),t}();t.default=u})?r.apply(e,o):r)||(t.exports=i)},function(t,e){t.exports=function(){for(var t={},e=0;e<arguments.length;e++){var r=arguments[e];for(var o in r)n.call(r,o)&&(t[o]=r[o])}return t};var n=Object.prototype.hasOwnProperty},function(t,e,n){"use strict";var r=Function.prototype.toString,o=/^\s*class /,i=function(t){try{var e=r.call(t).replace(/\/\/.*\n/g,"").replace(/\/\*[.\s\S]*\*\//g,"").replace(/\n/gm," ").replace(/ {2}/g," ");return o.test(e)}catch(t){return!1}},u=Object.prototype.toString,c="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;t.exports=function(t){if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if(c)return function(t){try{return!i(t)&&(r.call(t),!0)}catch(t){return!1}}(t);if(i(t))return!1;var e=u.call(t);return"[object Function]"===e||"[object GeneratorFunction]"===e}},function(t,e,n){"use strict";var r=n(16),o=Object.prototype.toString,i=Object.prototype.hasOwnProperty;t.exports=function(t,e,n){if(!r(e))throw new TypeError("iterator must be a function");var u;arguments.length>=3&&(u=n),"[object Array]"===o.call(t)?function(t,e,n){for(var r=0,o=t.length;r<o;r++)i.call(t,r)&&(null==n?e(t[r],r,t):e.call(n,t[r],r,t))}(t,e,u):"string"==typeof t?function(t,e,n){for(var r=0,o=t.length;r<o;r++)null==n?e(t.charAt(r),r,t):e.call(n,t.charAt(r),r,t)}(t,e,u):function(t,e,n){for(var r in t)i.call(t,r)&&(null==n?e(t[r],r,t):e.call(n,t[r],r,t))}(t,e,u)}},function(t,e){(e=t.exports=function(t){return t.replace(/^\s*|\s*$/g,"")}).left=function(t){return t.replace(/^\s*/,"")},e.right=function(t){return t.replace(/\s*$/,"")}},function(t,e,n){var r=n(18),o=n(17);t.exports=function(t){if(!t)return{};var e={};return o(r(t).split("\n"),function(t){var n,o=t.indexOf(":"),i=r(t.slice(0,o)).toLowerCase(),u=r(t.slice(o+1));void 0===e[i]?e[i]=u:(n=e[i],"[object Array]"===Object.prototype.toString.call(n)?e[i].push(u):e[i]=[e[i],u])}),e}},function(t,e){t.exports=function(t){var e=n.call(t);return"[object Function]"===e||"function"==typeof t&&"[object RegExp]"!==e||"undefined"!=typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)};var n=Object.prototype.toString},function(t,e,n){(function(e){var n;n="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},t.exports=n}).call(this,n(0))},function(t,e,n){"use strict";var r=n(21),o=n(20),i=n(19),u=n(15);function c(t,e,n){var r=t;return o(e)?(n=e,"string"==typeof t&&(r={uri:t})):r=u(e,{uri:t}),r.callback=n,r}function s(t,e,n){return a(e=c(t,e,n))}function a(t){if(void 0===t.callback)throw new Error("callback argument missing");var e=!1,n=function(n,r,o){e||(e=!0,t.callback(n,r,o))};function r(t){return clearTimeout(f),t instanceof Error||(t=new Error(""+(t||"Unknown XMLHttpRequest Error"))),t.statusCode=0,n(t,g)}function o(){if(!c){var e;clearTimeout(f),e=t.useXDR&&void 0===a.status?200:1223===a.status?204:a.status;var r=g,o=null;return 0!==e?(r={body:function(){var t=void 0;if(t=a.response?a.response:a.responseText||function(t){try{if("document"===t.responseType)return t.responseXML;var e=t.responseXML&&"parsererror"===t.responseXML.documentElement.nodeName;if(""===t.responseType&&!e)return t.responseXML}catch(t){}return null}(a),y)try{t=JSON.parse(t)}catch(t){}return t}(),statusCode:e,method:d,headers:{},url:l,rawRequest:a},a.getAllResponseHeaders&&(r.headers=i(a.getAllResponseHeaders()))):o=new Error("Internal XMLHttpRequest Error"),n(o,r,r.body)}}var u,c,a=t.xhr||null;a||(a=t.cors||t.useXDR?new s.XDomainRequest:new s.XMLHttpRequest);var f,l=a.url=t.uri||t.url,d=a.method=t.method||"GET",p=t.body||t.data,h=a.headers=t.headers||{},v=!!t.sync,y=!1,g={body:void 0,headers:{},statusCode:0,method:d,url:l,rawRequest:a};if("json"in t&&!1!==t.json&&(y=!0,h.accept||h.Accept||(h.Accept="application/json"),"GET"!==d&&"HEAD"!==d&&(h["content-type"]||h["Content-Type"]||(h["Content-Type"]="application/json"),p=JSON.stringify(!0===t.json?p:t.json))),a.onreadystatechange=function(){4===a.readyState&&setTimeout(o,0)},a.onload=o,a.onerror=r,a.onprogress=function(){},a.onabort=function(){c=!0},a.ontimeout=r,a.open(d,l,!v,t.username,t.password),v||(a.withCredentials=!!t.withCredentials),!v&&t.timeout>0&&(f=setTimeout(function(){if(!c){c=!0,a.abort("timeout");var t=new Error("XMLHttpRequest timeout");t.code="ETIMEDOUT",r(t)}},t.timeout)),a.setRequestHeader)for(u in h)h.hasOwnProperty(u)&&a.setRequestHeader(u,h[u]);else if(t.headers&&!function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}(t.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(a.responseType=t.responseType),"beforeSend"in t&&"function"==typeof t.beforeSend&&t.beforeSend(a),a.send(p||null),a}t.exports=s,t.exports.default=s,s.XMLHttpRequest=r.XMLHttpRequest||function(){},s.XDomainRequest="withCredentials"in new s.XMLHttpRequest?s.XMLHttpRequest:r.XDomainRequest,function(t,e){for(var n=0;n<t.length;n++)e(t[n])}(["get","put","post","patch","head","delete"],function(t){s["delete"===t?"del":t]=function(e,n,r){return(n=c(e,n,r)).method=t.toUpperCase(),a(n)}})},function(t,e,n){var r,o,i;o=[t,n(22),n(14),n(8),n(7)],void 0===(i="function"==typeof(r=function(t,e,n,r,o){"use strict";var i=a(e),u=a(n),c=a(r),s=a(o);function a(t){return t&&t.__esModule?t:{default:t}}t.exports=(0,s.default)(c.default,function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return new(Function.prototype.bind.apply(u.default,[null].concat([i.default],e)))})})?r.apply(e,o):r)||(t.exports=i)},function(t,e,n){var r,o,i;o=[n(23)],void 0===(i="function"==typeof(r=function(t){"use strict";var e=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(t);!function(t,n,r){var o={integrationId:"[INTEGRATION_ID]",contentId:"[CONTENT_ID]"};!function(){var t=new e.default(o);t.getSources().then(function(e){var n=r.createOwnVideoPlayer(e);t.trackContentBegin(),n.addEventListener("loadeddata",function(){t.trackAdBegin("preroll")}),n.addEventListener("ended",function(){t.trackAdBegin("postroll")}),n.play()},function(t){console.error(t)})}();var i=t.querySelectorAll(".js-get-config"),u=t.querySelector(".js-get-sources-demo"),c=t.querySelector(".js-track-content-begin-demo"),s=t.querySelector(".js-track-ad-begin-demo"),a=g(),f=new e.default(a);function l(){y(),function(){if(n){var t=g();Object.keys(t).forEach(function(e){return n.setItem("glomex_sdk_"+e,t[e])})}}()}function d(){(f=new e.default(g())).getSources().then(function(){s.removeAttribute("disabled"),c.removeAttribute("disabled"),v("getSources()")}).catch(function(t){y(),console.error(t)})}function p(){f.trackContentBegin().then(function(){return v("trackContentBegin()")})}function h(){f.trackAdBegin("postroll").then(function(){return v("trackAdBegin('postroll')")})}function v(t){console.warn(t+" was performed, check network requests")}function y(){s.setAttribute("disabled",""),c.setAttribute("disabled","")}function g(){var t=i[0].value,e=i[1].value,n=i[2].value,r={integrationId:t,contentId:e};return n&&(r.pageUrl=n),Object.assign({},o,r)}Object.keys(g()).forEach(function(t,e){return function(t,e){var r=n.getItem("glomex_sdk_"+t);r&&(i[e].value=r)}(t,e)}),i.forEach(function(t){["change","keyup"].forEach(function(e){return t.addEventListener(e,l)})}),u.addEventListener("click",d),c.addEventListener("click",p),s.addEventListener("click",h)}(document,window.localStorage,window)})?r.apply(e,o):r)||(t.exports=i)}]);
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=19)}([,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.getPageUrl=function(){try{return window.location.href}catch(e){return null}},t.getClientInfo=function(){try{return window.navigator.appVersion}catch(e){return"n/a"}},t.uniqueId=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.handleConfigErrors=function(e){Object.keys(e).forEach(function(t){if(!e[t])throw new Error("config."+t+" not found, "+t+" must be provided")})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2);t.default=function(e,t,n){var o=n.getPageUrl,i=n.getClientInfo,u=n.uniqueId;return function(n){var c={integrationId:null,contentId:null,pageUrl:o(),contentSessionId:u(),clientInfo:i(),backendUrl:"https://integration-sdk-eu-west-1.mes.glomex.cloud/video"};if(!n)throw new Error("No config found, config object must be provided");var a=Object.assign({},c,n);(0,r.handleConfigErrors)(a);var s=t(a);return e(s)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=function(e){return{getSources:function(){return e.getVideoSources()},trackContentBegin:function(){return e.trackEvent("contentBegin")},trackAdBegin:function(t){return e.trackEvent("adBegin",t)}}}},function(e,t,n){"use strict";var r=new RegExp("%[a-f0-9]{2}","gi"),o=new RegExp("(%[a-f0-9]{2})+","gi");function i(e,t){try{return decodeURIComponent(e.join(""))}catch(e){}if(1===e.length)return e;t=t||1;var n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],i(n),i(r))}function u(e){try{return decodeURIComponent(e)}catch(o){for(var t=e.match(r),n=1;n<t.length;n++)t=(e=i(t,n).join("")).match(r);return e}}e.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},n=o.exec(e);n;){try{t[n[0]]=decodeURIComponent(n[0])}catch(e){var r=u(n[0]);r!==n[0]&&(t[n[0]]=r)}n=o.exec(e)}t["%C2"]="�";for(var i=Object.keys(t),c=0;c<i.length;c++){var a=i[c];e=e.replace(new RegExp(a,"g"),t[a])}return e}(e)}}},function(e,t,n){"use strict";e.exports=(e=>encodeURIComponent(e).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`))},function(e,t,n){"use strict";const r=n(6),o=n(5);function i(e,t){return t.encode?t.strict?r(e):encodeURIComponent(e):e}function u(e,t){return t.decode?o(e):e}function c(e){const t=e.indexOf("?");return-1===t?"":e.slice(t+1)}function a(e,t){const n=function(e){let t;switch(e.arrayFormat){case"index":return(e,n,r)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===r[e]&&(r[e]={}),r[e][t[1]]=n):r[e]=n};case"bracket":return(e,n,r)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};default:return(e,t,n)=>{void 0!==n[e]?n[e]=[].concat(n[e],t):n[e]=t}}}(t=Object.assign({decode:!0,arrayFormat:"none"},t)),r=Object.create(null);if("string"!=typeof e)return r;if(!(e=e.trim().replace(/^[?#&]/,"")))return r;for(const o of e.split("&")){let[e,i]=o.replace(/\+/g," ").split("=");i=void 0===i?null:u(i,t),n(u(e,t),i,r)}return Object.keys(r).sort().reduce((e,t)=>{const n=r[t];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?e[t]=function e(t){return Array.isArray(t)?t.sort():"object"==typeof t?e(Object.keys(t)).sort((e,t)=>Number(e)-Number(t)).map(e=>t[e]):t}(n):e[t]=n,e},Object.create(null))}t.extract=c,t.parse=a,t.stringify=((e,t)=>{!1===(t=Object.assign({encode:!0,strict:!0,arrayFormat:"none"},t)).sort&&(t.sort=(()=>{}));const n=function(e){switch(e.arrayFormat){case"index":return(t,n,r)=>null===n?[i(t,e),"[",r,"]"].join(""):[i(t,e),"[",i(r,e),"]=",i(n,e)].join("");case"bracket":return(t,n)=>null===n?[i(t,e),"[]"].join(""):[i(t,e),"[]=",i(n,e)].join("");default:return(t,n)=>null===n?i(t,e):[i(t,e),"=",i(n,e)].join("")}}(t);return e?Object.keys(e).sort(t.sort).map(r=>{const o=e[r];if(void 0===o)return"";if(null===o)return i(r,t);if(Array.isArray(o)){const e=[];for(const t of o.slice())void 0!==t&&e.push(n(r,t,e.length));return e.join("&")}return i(r,t)+"="+i(o,t)}).filter(e=>e.length>0).join("&"):""}),t.parseUrl=((e,t)=>({url:e.split("?")[0]||"",query:a(c(e),t)}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(7),c=(r=u)&&r.__esModule?r:{default:r};var a=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._xhr=t,this._defaultXhrOptions={method:"get",url:null,json:!0},this._config=Object.assign({},n),this._videoStored=null}return i(e,[{key:"getVideoSources",value:function(){var e=this;return new Promise(function(t,n){var r=e._createUrl(e._config);e._xhr.get({url:r,json:!0},function(r,o,i){e._handleGetVideoSources(r,o,i,t,n)})})}},{key:"_handleGetVideoSources",value:function(e,t,n,r,i){return e?i(e):n&&n.error?i(n.error):n?n.video&&n.video.source?(this._storeVideo(n.video),void r(o({},n.video.source))):i(new Error("Video sources are malformed")):i(new Error("Can't fetch video sources"))}},{key:"_createUrl",value:function(e){var t={integration_id:e.integrationId,content_id:e.contentId,page_url:e.pageUrl,sdk_type:"js"},n=c.default.stringify(t);return this._config.backendUrl+"?"+n}},{key:"trackEvent",value:function(e,t){if(!e)throw new Error("event for tracking was not specified, event must be provided");if(!this._videoStored.tracking[e])throw new Error("Something is wrong with "+e+" tracking endpoints.");if("adBegin"===e&&!t)throw new Error("adRollName not found, adRollName must be provided");var n=this._videoStored.tracking[e];return this._executeTrackingRequests(n,t)}},{key:"_executeTrackingRequests",value:function(e,t){var n=this,r=e.map(function(e){var r=e.method,o=e.url,i=e.payload,u=void 0===i?{}:i;if(!o)return new Promise(function(e,t){return t(new Error("url is not found, endpoint is malformed"))});var c=n._getTrackingXhrOptions(r,o,u,t);return new Promise(function(e,t){n._xhr(c,function(n,r,o){return n?t(n):200===r.statusCode?e(o):void 0})})});return Promise.all(r).catch(function(e){throw console.log(e),new Error("Service is unavailable. Please contact glomex tech support")})}},{key:"_getTrackingXhrOptions",value:function(e,t,n,r){var i=this._defaultXhrOptions,u="get"===e.toLowerCase(),a=this._config,s=a.contentSessionId,l=a.clientInfo,f=o({},n,r?{contentSessionId:s,clientInfo:l,adRollName:r}:{contentSessionId:s,clientInfo:l});if(u){var d=t+"&"+c.default.stringify(f);return o({},i,{url:d})}return o({},i,{method:"post",url:t,body:f})}},{key:"_storeVideo",value:function(e){this._videoStored=e}}]),e}();t.default=a},function(e,t){e.exports=function(){for(var e={},t=0;t<arguments.length;t++){var r=arguments[t];for(var o in r)n.call(r,o)&&(e[o]=r[o])}return e};var n=Object.prototype.hasOwnProperty},function(e,t,n){"use strict";var r=Function.prototype.toString,o=/^\s*class /,i=function(e){try{var t=r.call(e).replace(/\/\/.*\n/g,"").replace(/\/\*[.\s\S]*\*\//g,"").replace(/\n/gm," ").replace(/ {2}/g," ");return o.test(t)}catch(e){return!1}},u=Object.prototype.toString,c="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;e.exports=function(e){if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if(c)return function(e){try{return!i(e)&&(r.call(e),!0)}catch(e){return!1}}(e);if(i(e))return!1;var t=u.call(e);return"[object Function]"===t||"[object GeneratorFunction]"===t}},function(e,t,n){"use strict";var r=n(10),o=Object.prototype.toString,i=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){if(!r(t))throw new TypeError("iterator must be a function");var u;arguments.length>=3&&(u=n),"[object Array]"===o.call(e)?function(e,t,n){for(var r=0,o=e.length;r<o;r++)i.call(e,r)&&(null==n?t(e[r],r,e):t.call(n,e[r],r,e))}(e,t,u):"string"==typeof e?function(e,t,n){for(var r=0,o=e.length;r<o;r++)null==n?t(e.charAt(r),r,e):t.call(n,e.charAt(r),r,e)}(e,t,u):function(e,t,n){for(var r in e)i.call(e,r)&&(null==n?t(e[r],r,e):t.call(n,e[r],r,e))}(e,t,u)}},function(e,t){(t=e.exports=function(e){return e.replace(/^\s*|\s*$/g,"")}).left=function(e){return e.replace(/^\s*/,"")},t.right=function(e){return e.replace(/\s*$/,"")}},function(e,t,n){var r=n(12),o=n(11);e.exports=function(e){if(!e)return{};var t={};return o(r(e).split("\n"),function(e){var n,o=e.indexOf(":"),i=r(e.slice(0,o)).toLowerCase(),u=r(e.slice(o+1));void 0===t[i]?t[i]=u:(n=t[i],"[object Array]"===Object.prototype.toString.call(n)?t[i].push(u):t[i]=[t[i],u])}),t}},function(e,t){e.exports=function(e){var t=n.call(e);return"[object Function]"===t||"function"==typeof e&&"[object RegExp]"!==t||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)};var n=Object.prototype.toString},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){(function(t){var n;n="undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{},e.exports=n}).call(this,n(15))},function(e,t,n){"use strict";var r=n(16),o=n(14),i=n(13),u=n(9);function c(e,t,n){var r=e;return o(t)?(n=t,"string"==typeof e&&(r={uri:e})):r=u(t,{uri:e}),r.callback=n,r}function a(e,t,n){return s(t=c(e,t,n))}function s(e){if(void 0===e.callback)throw new Error("callback argument missing");var t=!1,n=function(n,r,o){t||(t=!0,e.callback(n,r,o))};function r(e){return clearTimeout(l),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,n(e,h)}function o(){if(!c){var t;clearTimeout(l),t=e.useXDR&&void 0===s.status?200:1223===s.status?204:s.status;var r=h,o=null;return 0!==t?(r={body:function(){var e=void 0;if(e=s.response?s.response:s.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}(s),y)try{e=JSON.parse(e)}catch(e){}return e}(),statusCode:t,method:d,headers:{},url:f,rawRequest:s},s.getAllResponseHeaders&&(r.headers=i(s.getAllResponseHeaders()))):o=new Error("Internal XMLHttpRequest Error"),n(o,r,r.body)}}var u,c,s=e.xhr||null;s||(s=e.cors||e.useXDR?new a.XDomainRequest:new a.XMLHttpRequest);var l,f=s.url=e.uri||e.url,d=s.method=e.method||"GET",p=e.body||e.data,g=s.headers=e.headers||{},v=!!e.sync,y=!1,h={body:void 0,headers:{},statusCode:0,method:d,url:f,rawRequest:s};if("json"in e&&!1!==e.json&&(y=!0,g.accept||g.Accept||(g.Accept="application/json"),"GET"!==d&&"HEAD"!==d&&(g["content-type"]||g["Content-Type"]||(g["Content-Type"]="application/json"),p=JSON.stringify(!0===e.json?p:e.json))),s.onreadystatechange=function(){4===s.readyState&&setTimeout(o,0)},s.onload=o,s.onerror=r,s.onprogress=function(){},s.onabort=function(){c=!0},s.ontimeout=r,s.open(d,f,!v,e.username,e.password),v||(s.withCredentials=!!e.withCredentials),!v&&e.timeout>0&&(l=setTimeout(function(){if(!c){c=!0,s.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",r(e)}},e.timeout)),s.setRequestHeader)for(u in g)g.hasOwnProperty(u)&&s.setRequestHeader(u,g[u]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(s.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(s),s.send(p||null),s}e.exports=a,e.exports.default=a,a.XMLHttpRequest=r.XMLHttpRequest||function(){},a.XDomainRequest="withCredentials"in new a.XMLHttpRequest?a.XMLHttpRequest:r.XDomainRequest,function(e,t){for(var n=0;n<e.length;n++)t(e[n])}(["get","put","post","patch","head","delete"],function(e){a["delete"===e?"del":e]=function(t,n,r){return(n=c(t,n,r)).method=e.toUpperCase(),s(n)}})},function(e,t,n){"use strict";var r=a(n(17)),o=a(n(8)),i=a(n(4)),u=a(n(3)),c=n(1);function a(e){return e&&e.__esModule?e:{default:e}}e.exports=(0,u.default)(i.default,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return new(Function.prototype.bind.apply(o.default,[null].concat([r.default],t)))},{getPageUrl:c.getPageUrl,getClientInfo:c.getClientInfo,uniqueId:c.uniqueId})},function(e,t,n){"use strict";var r=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(18));!function(e,t,n){var o={integrationId:"[INTEGRATION_ID]",contentId:"[CONTENT_ID]"};!function(){var e=new r.default(o);e.getSources().then(function(t){var r=n.createOwnVideoPlayer(t);e.trackContentBegin(),r.addEventListener("loadeddata",function(){e.trackAdBegin("preroll")}),r.addEventListener("ended",function(){e.trackAdBegin("postroll")}),r.play()},function(e){console.error(e)})}();var i=e.querySelectorAll(".js-get-config"),u=e.querySelector(".js-get-sources-demo"),c=e.querySelector(".js-track-content-begin-demo"),a=e.querySelector(".js-track-ad-begin-demo"),s=h(),l=new r.default(s);function f(){y(),function(){if(!t)return;var e=h();Object.keys(e).forEach(function(n){return t.setItem("glomex_sdk_"+n,e[n])})}()}function d(){(l=new r.default(h())).getSources().then(function(){a.removeAttribute("disabled"),c.removeAttribute("disabled"),v("getSources()")}).catch(function(e){y(),console.error(e)})}function p(){l.trackContentBegin().then(function(){return v("trackContentBegin()")})}function g(){l.trackAdBegin("postroll").then(function(){return v("trackAdBegin('postroll')")})}function v(e){console.warn(e+" was performed, check network requests")}function y(){a.setAttribute("disabled",""),c.setAttribute("disabled","")}function h(){var e=i[0].value,t=i[1].value,n=i[2].value,r={integrationId:e,contentId:t};return n&&(r.pageUrl=n),Object.assign({},o,r)}Object.keys(h()).forEach(function(e,n){return function(e,n){var r=t.getItem("glomex_sdk_"+e);r&&(i[n].value=r)}(e,n)}),i.forEach(function(e){["change","keyup"].forEach(function(t){return e.addEventListener(t,f)})}),u.addEventListener("click",d),c.addEventListener("click",p),a.addEventListener("click",g)}(document,window.localStorage,window)}]);
//# sourceMappingURL=glomex.content-sdk-example.js.map

@@ -1,16 +0,2 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.glomexContentSDK=e():t.glomexContentSDK=e()}(window,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=22)}([function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){
/**
* lite-url - Small, JS lib that uses regex for parsing a URL into it's component parts.
* @version v1.0.5
* @link https://github.com/sadams/lite-url
* @license BSD-3-Clause
*/
(function(){"use strict";function n(t,e,n){var r=t.split(e);return n(r.shift(),r.join(e))}function r(t){var e={hash:"",host:"",hostname:"",origin:"",pathname:"",protocol:"",search:"",password:"",username:"",port:""};return n(t,"#",function(t,r){r&&(e.hash=r?"#"+r:""),n(t,"?",function(t,r){r&&(e.search="?"+r),t&&n(t,"//",function(t,r){e.protocol=t,n(r,"/",function(t,r){e.pathname="/"+(r||""),(e.protocol||t)&&(e.origin=e.protocol+"//"+t),n(t,"@",function(t,r){if(r){var o=t.split(":");e.username=o[0],e.password=o[1]}else r=t;e.host=r,n(r,":",function(t,n){e.hostname=t,n&&(e.port=n)})})})})})}),e.href=e.origin+e.pathname+e.search+e.hash,e}function o(t){var e={},n=t.search;if(n){var r=(n=n.replace(new RegExp("\\?"),"")).split("&");for(var o in r)if(r.hasOwnProperty(o)&&r[o]){var i=r[o].split("=");e[i[0]]=i[1]}}return e}function i(t){var e=u[t];return void 0!==e?e:((e=r(t)).params=o(e),u[t]=e,e)}var u={};return i.changeQueryParser=function(t){o=t},void 0!==t&&t.exports&&(e=t.exports=i),e.liteURL=i,i}).call(this)},function(t,e,n){var r,o,i;o=[e,n(1)],void 0===(i="function"==typeof(r=function(t,e){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.handleConfigErrors=t.getPageUrl=void 0;var n,r=(n=e)&&n.__esModule?n:{default:n};t.getPageUrl=function(){return window.glomexContext&&window.glomexContext.pageUrl?(0,r.default)(window.glomexContext.pageUrl):function(){try{return window.self!==window.top}catch(t){return!0}}()&&window.document.referrer?(0,r.default)(window.document.referrer):(0,r.default)(window.location.href)},t.handleConfigErrors=function(t){Object.keys(t).forEach(function(e){if(!t[e])throw new Error("config."+e+" not found, "+e+" must be provided")})}})?r.apply(e,o):r)||(t.exports=i)},function(t,e){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);t.exports=function(t,e){var r=e||0,o=n;return o[t[r++]]+o[t[r++]]+o[t[r++]]+o[t[r++]]+"-"+o[t[r++]]+o[t[r++]]+"-"+o[t[r++]]+o[t[r++]]+"-"+o[t[r++]]+o[t[r++]]+"-"+o[t[r++]]+o[t[r++]]+o[t[r++]]+o[t[r++]]+o[t[r++]]+o[t[r++]]}},function(t,e){var n="undefined"!=typeof crypto&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);t.exports=function(){return n(r),r}}else{var o=new Array(16);t.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),o[e]=t>>>((3&e)<<3)&255;return o}}},function(t,e,n){var r,o,i=n(4),u=n(3),c=0,s=0;t.exports=function(t,e,n){var a=e&&n||0,f=e||[],l=(t=t||{}).node||r,d=void 0!==t.clockseq?t.clockseq:o;if(null==l||null==d){var p=i();null==l&&(l=r=[1|p[0],p[1],p[2],p[3],p[4],p[5]]),null==d&&(d=o=16383&(p[6]<<8|p[7]))}var h=void 0!==t.msecs?t.msecs:(new Date).getTime(),v=void 0!==t.nsecs?t.nsecs:s+1,y=h-c+(v-s)/1e4;if(y<0&&void 0===t.clockseq&&(d=d+1&16383),(y<0||h>c)&&void 0===t.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=h,s=v,o=d;var g=(1e4*(268435455&(h+=122192928e5))+v)%4294967296;f[a++]=g>>>24&255,f[a++]=g>>>16&255,f[a++]=g>>>8&255,f[a++]=255&g;var m=h/4294967296*1e4&268435455;f[a++]=m>>>8&255,f[a++]=255&m,f[a++]=m>>>24&15|16,f[a++]=m>>>16&255,f[a++]=d>>>8|128,f[a++]=255&d;for(var w=0;w<6;++w)f[a+w]=l[w];return e||u(f)}},function(t,e,n){var r,o,i;o=[e,n(5),n(2)],void 0===(i="function"==typeof(r=function(t,e,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=(r=e)&&r.__esModule?r:{default:r},i={integrationId:null,contentId:null,pageUrl:(0,n.getPageUrl)().href,contentSessionId:(0,o.default)(),clientInfo:function(){try{return window.navigator.appVersion}catch(t){return"n/a"}}(),backendUrl:"https://integration-sdk-eu-west-1.mes.glomex.cloud/video"};t.default=function(t,e){return function(r){if(!r)throw new Error("No config found, config object must be provided");var o=Object.assign({},i,r);(0,n.handleConfigErrors)(o);var u=e(o);return new t(u)}}})?r.apply(e,o):r)||(t.exports=i)},function(t,e,n){var r,o,i;o=[e],void 0===(i="function"==typeof(r=function(t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t){return{getSources:function(){return t.getVideoSources()},trackContentBegin:function(){return t.trackEvent("contentBegin")},trackAdBegin:function(e){return t.trackEvent("adBegin",e)}}}})?r.apply(e,o):r)||(t.exports=i)},function(t,e){var n,r,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function c(t){if(n===setTimeout)return setTimeout(t,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(t){n=i}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(t){r=u}}();var s,a=[],f=!1,l=-1;function d(){f&&s&&(f=!1,s.length?a=s.concat(a):l=-1,a.length&&p())}function p(){if(!f){var t=c(d);f=!0;for(var e=a.length;e;){for(s=a,a=[];++l<e;)s&&s[l].run();l=-1,e=a.length}s=null,f=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function h(t,e){this.fun=t,this.array=e}function v(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];a.push(new h(t,e)),1!==a.length||f||c(p)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e,n){(function(e,n){
/*!
* @overview es6-promise - a tiny implementation of Promises/A+.
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
* @license Licensed under MIT license
* See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
* @version v4.2.4+314e4831
*/var r;r=function(){"use strict";function t(t){return"function"==typeof t}var r=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},o=0,i=void 0,u=void 0,c=function(t,e){h[o]=t,h[o+1]=e,2===(o+=2)&&(u?u(v):b())};var s="undefined"!=typeof window?window:void 0,a=s||{},f=a.MutationObserver||a.WebKitMutationObserver,l="undefined"==typeof self&&void 0!==e&&"[object process]"==={}.toString.call(e),d="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function p(){var t=setTimeout;return function(){return t(v,1)}}var h=new Array(1e3);function v(){for(var t=0;t<o;t+=2){(0,h[t])(h[t+1]),h[t]=void 0,h[t+1]=void 0}o=0}var y,g,m,w,b=void 0;function _(t,e){var n=this,r=new this.constructor(E);void 0===r[x]&&F(r);var o=n._state;if(o){var i=arguments[o-1];c(function(){return I(o,r,i,n._result)})}else q(n,r,t,e);return r}function j(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=new this(E);return R(e,t),e}l?b=function(){return e.nextTick(v)}:f?(g=0,m=new f(v),w=document.createTextNode(""),m.observe(w,{characterData:!0}),b=function(){w.data=g=++g%2}):d?((y=new MessageChannel).port1.onmessage=v,b=function(){return y.port2.postMessage(0)}):b=void 0===s?function(){try{var t=Function("return this")().require("vertx");return void 0!==(i=t.runOnLoop||t.runOnContext)?function(){i(v)}:p()}catch(t){return p()}}():p();var x=Math.random().toString(36).substring(2);function E(){}var O=void 0,T=1,S=2,k={error:null};function A(t){try{return t.then}catch(t){return k.error=t,k}}function C(e,n,r){n.constructor===e.constructor&&r===_&&n.constructor.resolve===j?function(t,e){e._state===T?P(t,e._result):e._state===S?U(t,e._result):q(e,void 0,function(e){return R(t,e)},function(e){return U(t,e)})}(e,n):r===k?(U(e,k.error),k.error=null):void 0===r?P(e,n):t(r)?function(t,e,n){c(function(t){var r=!1,o=function(t,e,n,r){try{t.call(e,n,r)}catch(t){return t}}(n,e,function(n){r||(r=!0,e!==n?R(t,n):P(t,n))},function(e){r||(r=!0,U(t,e))},t._label);!r&&o&&(r=!0,U(t,o))},t)}(e,n,r):P(e,n)}function R(t,e){var n,r;t===e?U(t,new TypeError("You cannot resolve a promise with itself")):(r=typeof(n=e),null===n||"object"!==r&&"function"!==r?P(t,e):C(t,e,A(e)))}function M(t){t._onerror&&t._onerror(t._result),X(t)}function P(t,e){t._state===O&&(t._result=e,t._state=T,0!==t._subscribers.length&&c(X,t))}function U(t,e){t._state===O&&(t._state=S,t._result=e,c(M,t))}function q(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+T]=n,o[i+S]=r,0===i&&t._state&&c(X,t)}function X(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,o=void 0,i=t._result,u=0;u<e.length;u+=3)r=e[u],o=e[u+n],r?I(n,r,o,i):o(i);t._subscribers.length=0}}function I(e,n,r,o){var i=t(r),u=void 0,c=void 0,s=void 0,a=void 0;if(i){if((u=function(t,e){try{return t(e)}catch(t){return k.error=t,k}}(r,o))===k?(a=!0,c=u.error,u.error=null):s=!0,n===u)return void U(n,new TypeError("A promises callback cannot return that same promise."))}else u=o,s=!0;n._state!==O||(i&&s?R(n,u):a?U(n,c):e===T?P(n,u):e===S&&U(n,u))}var L=0;function F(t){t[x]=L++,t._state=void 0,t._result=void 0,t._subscribers=[]}var H=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(E),this.promise[x]||F(this.promise),r(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?P(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&P(this.promise,this._result))):U(this.promise,new Error("Array Methods must be provided an Array"))}return t.prototype._enumerate=function(t){for(var e=0;this._state===O&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===j){var o=A(t);if(o===_&&t._state!==O)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(n===D){var i=new n(E);C(i,t,o),this._willSettleAt(i,e)}else this._willSettleAt(new n(function(e){return e(t)}),e)}else this._willSettleAt(r(t),e)},t.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===O&&(this._remaining--,t===S?U(r,n):this._result[e]=n),0===this._remaining&&P(r,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;q(t,void 0,function(t){return n._settledAt(T,e,t)},function(t){return n._settledAt(S,e,t)})},t}();var D=function(){function t(e){this[x]=L++,this._result=this._state=void 0,this._subscribers=[],E!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof t?function(t,e){try{e(function(e){R(t,e)},function(e){U(t,e)})}catch(e){U(t,e)}}(this,e):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return t.prototype.catch=function(t){return this.then(null,t)},t.prototype.finally=function(t){var e=this.constructor;return this.then(function(n){return e.resolve(t()).then(function(){return n})},function(n){return e.resolve(t()).then(function(){throw n})})},t}();return D.prototype.then=_,D.all=function(t){return new H(this,t).promise},D.race=function(t){var e=this;return r(t)?new e(function(n,r){for(var o=t.length,i=0;i<o;i++)e.resolve(t[i]).then(n,r)}):new e(function(t,e){return e(new TypeError("You must pass an array to race."))})},D.resolve=j,D.reject=function(t){var e=new this(E);return U(e,t),e},D._setScheduler=function(t){u=t},D._setAsap=function(t){c=t},D._asap=c,D.polyfill=function(){var t=void 0;if(void 0!==n)t=n;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var r=null;try{r=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===r&&!e.cast)return}t.Promise=D},D.Promise=D,D},t.exports=r()}).call(this,n(8),n(0))},function(t,e,n){"use strict";var r=new RegExp("%[a-f0-9]{2}","gi"),o=new RegExp("(%[a-f0-9]{2})+","gi");function i(t,e){try{return decodeURIComponent(t.join(""))}catch(t){}if(1===t.length)return t;e=e||1;var n=t.slice(0,e),r=t.slice(e);return Array.prototype.concat.call([],i(n),i(r))}function u(t){try{return decodeURIComponent(t)}catch(o){for(var e=t.match(r),n=1;n<e.length;n++)e=(t=i(e,n).join("")).match(r);return t}}t.exports=function(t){if("string"!=typeof t)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch(e){return function(t){for(var e={"%FE%FF":"��","%FF%FE":"��"},n=o.exec(t);n;){try{e[n[0]]=decodeURIComponent(n[0])}catch(t){var r=u(n[0]);r!==n[0]&&(e[n[0]]=r)}n=o.exec(t)}e["%C2"]="�";for(var i=Object.keys(e),c=0;c<i.length;c++){var s=i[c];t=t.replace(new RegExp(s,"g"),e[s])}return t}(t)}}},function(t,e,n){"use strict";t.exports=(t=>encodeURIComponent(t).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`))},function(t,e,n){"use strict";const r=n(11),o=n(10);function i(t,e){return e.encode?e.strict?r(t):encodeURIComponent(t):t}function u(t,e){return e.decode?o(t):t}function c(t){const e=t.indexOf("?");return-1===e?"":t.slice(e+1)}function s(t,e){const n=function(t){let e;switch(t.arrayFormat){case"index":return(t,n,r)=>{e=/\[(\d*)\]$/.exec(t),t=t.replace(/\[\d*\]$/,""),e?(void 0===r[t]&&(r[t]={}),r[t][e[1]]=n):r[t]=n};case"bracket":return(t,n,r)=>{e=/(\[\])$/.exec(t),t=t.replace(/\[\]$/,""),e?void 0!==r[t]?r[t]=[].concat(r[t],n):r[t]=[n]:r[t]=n};default:return(t,e,n)=>{void 0!==n[t]?n[t]=[].concat(n[t],e):n[t]=e}}}(e=Object.assign({decode:!0,arrayFormat:"none"},e)),r=Object.create(null);if("string"!=typeof t)return r;if(!(t=t.trim().replace(/^[?#&]/,"")))return r;for(const o of t.split("&")){let[t,i]=o.replace(/\+/g," ").split("=");i=void 0===i?null:u(i,e),n(u(t,e),i,r)}return Object.keys(r).sort().reduce((t,e)=>{const n=r[e];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?t[e]=function t(e){return Array.isArray(e)?e.sort():"object"==typeof e?t(Object.keys(e)).sort((t,e)=>Number(t)-Number(e)).map(t=>e[t]):e}(n):t[e]=n,t},Object.create(null))}e.extract=c,e.parse=s,e.stringify=((t,e)=>{!1===(e=Object.assign({encode:!0,strict:!0,arrayFormat:"none"},e)).sort&&(e.sort=(()=>{}));const n=function(t){switch(t.arrayFormat){case"index":return(e,n,r)=>null===n?[i(e,t),"[",r,"]"].join(""):[i(e,t),"[",i(r,t),"]=",i(n,t)].join("");case"bracket":return(e,n)=>null===n?[i(e,t),"[]"].join(""):[i(e,t),"[]=",i(n,t)].join("");default:return(e,n)=>null===n?i(e,t):[i(e,t),"=",i(n,t)].join("")}}(e);return t?Object.keys(t).sort(e.sort).map(r=>{const o=t[r];if(void 0===o)return"";if(null===o)return i(r,e);if(Array.isArray(o)){const t=[];for(const e of o.slice())void 0!==e&&t.push(n(r,e,t.length));return t.join("&")}return i(r,e)+"="+i(o,e)}).filter(t=>t.length>0).join("&"):""}),e.parseUrl=((t,e)=>({url:t.split("?")[0]||"",query:s(c(t),e)}))},function(t,e,n){var r,o,i;o=[e,n(12),n(9)],void 0===(i="function"==typeof(r=function(t,e){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,r=(n=e)&&n.__esModule?n:{default:n},o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._xhr=e,this._defaultXhrOptions={method:"get",url:null,json:!0},this._config=Object.assign({},n),this._videoStored=null}return i(t,[{key:"getVideoSources",value:function(){var t=this;return new Promise(function(e,n){var r=t._createUrl(t._config);t._xhr.get({url:r,json:!0},function(r,o,i){t._handleGetVideoSources(r,o,i,e,n)})})}},{key:"_handleGetVideoSources",value:function(t,e,n,r,i){return t?i(t):n&&n.error?i(n.error):n?n.video&&n.video.source?(this._storeVideo(n.video),void r(o({},n.video.source))):i(new Error("Video sources are malformed")):i(new Error("Can't fetch video sources"))}},{key:"_createUrl",value:function(t){var e=t.integrationId,n=t.contentId,o=t.pageUrl,i={integration_id:e,content_id:n,page_url:o,sdk_type:"js"},u=r.default.stringify(i);return this._config.backendUrl+"?"+u}},{key:"trackEvent",value:function(t,e){if(!t)throw new Error("event for tracking was not specified, event must be provided");if(!this._videoStored.tracking[t])throw new Error("Something is wrong with "+t+" tracking endpoints.");if("adBegin"===t&&!e)throw new Error("adRollName not found, adRollName must be provided");var n=this._videoStored.tracking[t];return this._executeTrackingRequests(n,e)}},{key:"_executeTrackingRequests",value:function(t,e){var n=this,r=t.map(function(t){var r=t.method,o=t.url,i=t.payload,u=void 0===i?{}:i;if(!o)return new Promise(function(t,e){return e(new Error("url is not found, endpoint is malformed"))});var c=n._getTrackingXhrOptions(r,o,u,e);return new Promise(function(t,e){n._xhr(c,function(n,r,o){return n?e(n):200===r.statusCode?t(o):void 0})})});return Promise.all(r).catch(function(t){throw console.log(t),new Error("Service is unavailable. Please contact glomex tech support")})}},{key:"_getTrackingXhrOptions",value:function(t,e,n,i){var u=this._defaultXhrOptions,c="get"===t.toLowerCase(),s=this._config,a=s.contentSessionId,f=s.clientInfo,l=o({},n,i?{contentSessionId:a,clientInfo:f,adRollName:i}:{contentSessionId:a,clientInfo:f});if(c){var d=e+"&"+r.default.stringify(l);return o({},u,{url:d})}return o({},u,{method:"post",url:e,body:l})}},{key:"_storeVideo",value:function(t){this._videoStored=t}}]),t}();t.default=u})?r.apply(e,o):r)||(t.exports=i)},function(t,e){t.exports=function(){for(var t={},e=0;e<arguments.length;e++){var r=arguments[e];for(var o in r)n.call(r,o)&&(t[o]=r[o])}return t};var n=Object.prototype.hasOwnProperty},function(t,e,n){"use strict";var r=Function.prototype.toString,o=/^\s*class /,i=function(t){try{var e=r.call(t).replace(/\/\/.*\n/g,"").replace(/\/\*[.\s\S]*\*\//g,"").replace(/\n/gm," ").replace(/ {2}/g," ");return o.test(e)}catch(t){return!1}},u=Object.prototype.toString,c="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;t.exports=function(t){if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if(c)return function(t){try{return!i(t)&&(r.call(t),!0)}catch(t){return!1}}(t);if(i(t))return!1;var e=u.call(t);return"[object Function]"===e||"[object GeneratorFunction]"===e}},function(t,e,n){"use strict";var r=n(15),o=Object.prototype.toString,i=Object.prototype.hasOwnProperty;t.exports=function(t,e,n){if(!r(e))throw new TypeError("iterator must be a function");var u;arguments.length>=3&&(u=n),"[object Array]"===o.call(t)?function(t,e,n){for(var r=0,o=t.length;r<o;r++)i.call(t,r)&&(null==n?e(t[r],r,t):e.call(n,t[r],r,t))}(t,e,u):"string"==typeof t?function(t,e,n){for(var r=0,o=t.length;r<o;r++)null==n?e(t.charAt(r),r,t):e.call(n,t.charAt(r),r,t)}(t,e,u):function(t,e,n){for(var r in t)i.call(t,r)&&(null==n?e(t[r],r,t):e.call(n,t[r],r,t))}(t,e,u)}},function(t,e){(e=t.exports=function(t){return t.replace(/^\s*|\s*$/g,"")}).left=function(t){return t.replace(/^\s*/,"")},e.right=function(t){return t.replace(/\s*$/,"")}},function(t,e,n){var r=n(17),o=n(16);t.exports=function(t){if(!t)return{};var e={};return o(r(t).split("\n"),function(t){var n,o=t.indexOf(":"),i=r(t.slice(0,o)).toLowerCase(),u=r(t.slice(o+1));void 0===e[i]?e[i]=u:(n=e[i],"[object Array]"===Object.prototype.toString.call(n)?e[i].push(u):e[i]=[e[i],u])}),e}},function(t,e){t.exports=function(t){var e=n.call(t);return"[object Function]"===e||"function"==typeof t&&"[object RegExp]"!==e||"undefined"!=typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)};var n=Object.prototype.toString},function(t,e,n){(function(e){var n;n="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},t.exports=n}).call(this,n(0))},function(t,e,n){"use strict";var r=n(20),o=n(19),i=n(18),u=n(14);function c(t,e,n){var r=t;return o(e)?(n=e,"string"==typeof t&&(r={uri:t})):r=u(e,{uri:t}),r.callback=n,r}function s(t,e,n){return a(e=c(t,e,n))}function a(t){if(void 0===t.callback)throw new Error("callback argument missing");var e=!1,n=function(n,r,o){e||(e=!0,t.callback(n,r,o))};function r(t){return clearTimeout(f),t instanceof Error||(t=new Error(""+(t||"Unknown XMLHttpRequest Error"))),t.statusCode=0,n(t,g)}function o(){if(!c){var e;clearTimeout(f),e=t.useXDR&&void 0===a.status?200:1223===a.status?204:a.status;var r=g,o=null;return 0!==e?(r={body:function(){var t=void 0;if(t=a.response?a.response:a.responseText||function(t){try{if("document"===t.responseType)return t.responseXML;var e=t.responseXML&&"parsererror"===t.responseXML.documentElement.nodeName;if(""===t.responseType&&!e)return t.responseXML}catch(t){}return null}(a),y)try{t=JSON.parse(t)}catch(t){}return t}(),statusCode:e,method:d,headers:{},url:l,rawRequest:a},a.getAllResponseHeaders&&(r.headers=i(a.getAllResponseHeaders()))):o=new Error("Internal XMLHttpRequest Error"),n(o,r,r.body)}}var u,c,a=t.xhr||null;a||(a=t.cors||t.useXDR?new s.XDomainRequest:new s.XMLHttpRequest);var f,l=a.url=t.uri||t.url,d=a.method=t.method||"GET",p=t.body||t.data,h=a.headers=t.headers||{},v=!!t.sync,y=!1,g={body:void 0,headers:{},statusCode:0,method:d,url:l,rawRequest:a};if("json"in t&&!1!==t.json&&(y=!0,h.accept||h.Accept||(h.Accept="application/json"),"GET"!==d&&"HEAD"!==d&&(h["content-type"]||h["Content-Type"]||(h["Content-Type"]="application/json"),p=JSON.stringify(!0===t.json?p:t.json))),a.onreadystatechange=function(){4===a.readyState&&setTimeout(o,0)},a.onload=o,a.onerror=r,a.onprogress=function(){},a.onabort=function(){c=!0},a.ontimeout=r,a.open(d,l,!v,t.username,t.password),v||(a.withCredentials=!!t.withCredentials),!v&&t.timeout>0&&(f=setTimeout(function(){if(!c){c=!0,a.abort("timeout");var t=new Error("XMLHttpRequest timeout");t.code="ETIMEDOUT",r(t)}},t.timeout)),a.setRequestHeader)for(u in h)h.hasOwnProperty(u)&&a.setRequestHeader(u,h[u]);else if(t.headers&&!function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}(t.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(a.responseType=t.responseType),"beforeSend"in t&&"function"==typeof t.beforeSend&&t.beforeSend(a),a.send(p||null),a}t.exports=s,t.exports.default=s,s.XMLHttpRequest=r.XMLHttpRequest||function(){},s.XDomainRequest="withCredentials"in new s.XMLHttpRequest?s.XMLHttpRequest:r.XDomainRequest,function(t,e){for(var n=0;n<t.length;n++)e(t[n])}(["get","put","post","patch","head","delete"],function(t){s["delete"===t?"del":t]=function(e,n,r){return(n=c(e,n,r)).method=t.toUpperCase(),a(n)}})},function(t,e,n){var r,o,i;o=[t,n(21),n(13),n(7),n(6)],void 0===(i="function"==typeof(r=function(t,e,n,r,o){"use strict";var i=a(e),u=a(n),c=a(r),s=a(o);function a(t){return t&&t.__esModule?t:{default:t}}t.exports=(0,s.default)(c.default,function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return new(Function.prototype.bind.apply(u.default,[null].concat([i.default],e)))})})?r.apply(e,o):r)||(t.exports=i)}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.glomexContentSdk=t():e.glomexContentSdk=t()}("undefined"!=typeof self?self:this,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=17)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.getPageUrl=function(){try{return window.location.href}catch(e){return null}},t.getClientInfo=function(){try{return window.navigator.appVersion}catch(e){return"n/a"}},t.uniqueId=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.handleConfigErrors=function(e){Object.keys(e).forEach(function(t){if(!e[t])throw new Error("config."+t+" not found, "+t+" must be provided")})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1);t.default=function(e,t,n){var o=n.getPageUrl,i=n.getClientInfo,u=n.uniqueId;return function(n){var c={integrationId:null,contentId:null,pageUrl:o(),contentSessionId:u(),clientInfo:i(),backendUrl:"https://integration-sdk-eu-west-1.mes.glomex.cloud/video"};if(!n)throw new Error("No config found, config object must be provided");var a=Object.assign({},c,n);(0,r.handleConfigErrors)(a);var s=t(a);return e(s)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=function(e){return{getSources:function(){return e.getVideoSources()},trackContentBegin:function(){return e.trackEvent("contentBegin")},trackAdBegin:function(t){return e.trackEvent("adBegin",t)}}}},function(e,t,n){"use strict";var r=new RegExp("%[a-f0-9]{2}","gi"),o=new RegExp("(%[a-f0-9]{2})+","gi");function i(e,t){try{return decodeURIComponent(e.join(""))}catch(e){}if(1===e.length)return e;t=t||1;var n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],i(n),i(r))}function u(e){try{return decodeURIComponent(e)}catch(o){for(var t=e.match(r),n=1;n<t.length;n++)t=(e=i(t,n).join("")).match(r);return e}}e.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},n=o.exec(e);n;){try{t[n[0]]=decodeURIComponent(n[0])}catch(e){var r=u(n[0]);r!==n[0]&&(t[n[0]]=r)}n=o.exec(e)}t["%C2"]="�";for(var i=Object.keys(t),c=0;c<i.length;c++){var a=i[c];e=e.replace(new RegExp(a,"g"),t[a])}return e}(e)}}},function(e,t,n){"use strict";e.exports=(e=>encodeURIComponent(e).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`))},function(e,t,n){"use strict";const r=n(5),o=n(4);function i(e,t){return t.encode?t.strict?r(e):encodeURIComponent(e):e}function u(e,t){return t.decode?o(e):e}function c(e){const t=e.indexOf("?");return-1===t?"":e.slice(t+1)}function a(e,t){const n=function(e){let t;switch(e.arrayFormat){case"index":return(e,n,r)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===r[e]&&(r[e]={}),r[e][t[1]]=n):r[e]=n};case"bracket":return(e,n,r)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};default:return(e,t,n)=>{void 0!==n[e]?n[e]=[].concat(n[e],t):n[e]=t}}}(t=Object.assign({decode:!0,arrayFormat:"none"},t)),r=Object.create(null);if("string"!=typeof e)return r;if(!(e=e.trim().replace(/^[?#&]/,"")))return r;for(const o of e.split("&")){let[e,i]=o.replace(/\+/g," ").split("=");i=void 0===i?null:u(i,t),n(u(e,t),i,r)}return Object.keys(r).sort().reduce((e,t)=>{const n=r[t];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?e[t]=function e(t){return Array.isArray(t)?t.sort():"object"==typeof t?e(Object.keys(t)).sort((e,t)=>Number(e)-Number(t)).map(e=>t[e]):t}(n):e[t]=n,e},Object.create(null))}t.extract=c,t.parse=a,t.stringify=((e,t)=>{!1===(t=Object.assign({encode:!0,strict:!0,arrayFormat:"none"},t)).sort&&(t.sort=(()=>{}));const n=function(e){switch(e.arrayFormat){case"index":return(t,n,r)=>null===n?[i(t,e),"[",r,"]"].join(""):[i(t,e),"[",i(r,e),"]=",i(n,e)].join("");case"bracket":return(t,n)=>null===n?[i(t,e),"[]"].join(""):[i(t,e),"[]=",i(n,e)].join("");default:return(t,n)=>null===n?i(t,e):[i(t,e),"=",i(n,e)].join("")}}(t);return e?Object.keys(e).sort(t.sort).map(r=>{const o=e[r];if(void 0===o)return"";if(null===o)return i(r,t);if(Array.isArray(o)){const e=[];for(const t of o.slice())void 0!==t&&e.push(n(r,t,e.length));return e.join("&")}return i(r,t)+"="+i(o,t)}).filter(e=>e.length>0).join("&"):""}),t.parseUrl=((e,t)=>({url:e.split("?")[0]||"",query:a(c(e),t)}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(6),c=(r=u)&&r.__esModule?r:{default:r};var a=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._xhr=t,this._defaultXhrOptions={method:"get",url:null,json:!0},this._config=Object.assign({},n),this._videoStored=null}return i(e,[{key:"getVideoSources",value:function(){var e=this;return new Promise(function(t,n){var r=e._createUrl(e._config);e._xhr.get({url:r,json:!0},function(r,o,i){e._handleGetVideoSources(r,o,i,t,n)})})}},{key:"_handleGetVideoSources",value:function(e,t,n,r,i){return e?i(e):n&&n.error?i(n.error):n?n.video&&n.video.source?(this._storeVideo(n.video),void r(o({},n.video.source))):i(new Error("Video sources are malformed")):i(new Error("Can't fetch video sources"))}},{key:"_createUrl",value:function(e){var t={integration_id:e.integrationId,content_id:e.contentId,page_url:e.pageUrl,sdk_type:"js"},n=c.default.stringify(t);return this._config.backendUrl+"?"+n}},{key:"trackEvent",value:function(e,t){if(!e)throw new Error("event for tracking was not specified, event must be provided");if(!this._videoStored.tracking[e])throw new Error("Something is wrong with "+e+" tracking endpoints.");if("adBegin"===e&&!t)throw new Error("adRollName not found, adRollName must be provided");var n=this._videoStored.tracking[e];return this._executeTrackingRequests(n,t)}},{key:"_executeTrackingRequests",value:function(e,t){var n=this,r=e.map(function(e){var r=e.method,o=e.url,i=e.payload,u=void 0===i?{}:i;if(!o)return new Promise(function(e,t){return t(new Error("url is not found, endpoint is malformed"))});var c=n._getTrackingXhrOptions(r,o,u,t);return new Promise(function(e,t){n._xhr(c,function(n,r,o){return n?t(n):200===r.statusCode?e(o):void 0})})});return Promise.all(r).catch(function(e){throw console.log(e),new Error("Service is unavailable. Please contact glomex tech support")})}},{key:"_getTrackingXhrOptions",value:function(e,t,n,r){var i=this._defaultXhrOptions,u="get"===e.toLowerCase(),a=this._config,s=a.contentSessionId,f=a.clientInfo,l=o({},n,r?{contentSessionId:s,clientInfo:f,adRollName:r}:{contentSessionId:s,clientInfo:f});if(u){var d=t+"&"+c.default.stringify(l);return o({},i,{url:d})}return o({},i,{method:"post",url:t,body:l})}},{key:"_storeVideo",value:function(e){this._videoStored=e}}]),e}();t.default=a},function(e,t){e.exports=function(){for(var e={},t=0;t<arguments.length;t++){var r=arguments[t];for(var o in r)n.call(r,o)&&(e[o]=r[o])}return e};var n=Object.prototype.hasOwnProperty},function(e,t,n){"use strict";var r=Function.prototype.toString,o=/^\s*class /,i=function(e){try{var t=r.call(e).replace(/\/\/.*\n/g,"").replace(/\/\*[.\s\S]*\*\//g,"").replace(/\n/gm," ").replace(/ {2}/g," ");return o.test(t)}catch(e){return!1}},u=Object.prototype.toString,c="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;e.exports=function(e){if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if(c)return function(e){try{return!i(e)&&(r.call(e),!0)}catch(e){return!1}}(e);if(i(e))return!1;var t=u.call(e);return"[object Function]"===t||"[object GeneratorFunction]"===t}},function(e,t,n){"use strict";var r=n(9),o=Object.prototype.toString,i=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){if(!r(t))throw new TypeError("iterator must be a function");var u;arguments.length>=3&&(u=n),"[object Array]"===o.call(e)?function(e,t,n){for(var r=0,o=e.length;r<o;r++)i.call(e,r)&&(null==n?t(e[r],r,e):t.call(n,e[r],r,e))}(e,t,u):"string"==typeof e?function(e,t,n){for(var r=0,o=e.length;r<o;r++)null==n?t(e.charAt(r),r,e):t.call(n,e.charAt(r),r,e)}(e,t,u):function(e,t,n){for(var r in e)i.call(e,r)&&(null==n?t(e[r],r,e):t.call(n,e[r],r,e))}(e,t,u)}},function(e,t){(t=e.exports=function(e){return e.replace(/^\s*|\s*$/g,"")}).left=function(e){return e.replace(/^\s*/,"")},t.right=function(e){return e.replace(/\s*$/,"")}},function(e,t,n){var r=n(11),o=n(10);e.exports=function(e){if(!e)return{};var t={};return o(r(e).split("\n"),function(e){var n,o=e.indexOf(":"),i=r(e.slice(0,o)).toLowerCase(),u=r(e.slice(o+1));void 0===t[i]?t[i]=u:(n=t[i],"[object Array]"===Object.prototype.toString.call(n)?t[i].push(u):t[i]=[t[i],u])}),t}},function(e,t){e.exports=function(e){var t=n.call(e);return"[object Function]"===t||"function"==typeof e&&"[object RegExp]"!==t||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)};var n=Object.prototype.toString},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){(function(t){var n;n="undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{},e.exports=n}).call(this,n(14))},function(e,t,n){"use strict";var r=n(15),o=n(13),i=n(12),u=n(8);function c(e,t,n){var r=e;return o(t)?(n=t,"string"==typeof e&&(r={uri:e})):r=u(t,{uri:e}),r.callback=n,r}function a(e,t,n){return s(t=c(e,t,n))}function s(e){if(void 0===e.callback)throw new Error("callback argument missing");var t=!1,n=function(n,r,o){t||(t=!0,e.callback(n,r,o))};function r(e){return clearTimeout(f),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,n(e,h)}function o(){if(!c){var t;clearTimeout(f),t=e.useXDR&&void 0===s.status?200:1223===s.status?204:s.status;var r=h,o=null;return 0!==t?(r={body:function(){var e=void 0;if(e=s.response?s.response:s.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}(s),v)try{e=JSON.parse(e)}catch(e){}return e}(),statusCode:t,method:d,headers:{},url:l,rawRequest:s},s.getAllResponseHeaders&&(r.headers=i(s.getAllResponseHeaders()))):o=new Error("Internal XMLHttpRequest Error"),n(o,r,r.body)}}var u,c,s=e.xhr||null;s||(s=e.cors||e.useXDR?new a.XDomainRequest:new a.XMLHttpRequest);var f,l=s.url=e.uri||e.url,d=s.method=e.method||"GET",p=e.body||e.data,y=s.headers=e.headers||{},g=!!e.sync,v=!1,h={body:void 0,headers:{},statusCode:0,method:d,url:l,rawRequest:s};if("json"in e&&!1!==e.json&&(v=!0,y.accept||y.Accept||(y.Accept="application/json"),"GET"!==d&&"HEAD"!==d&&(y["content-type"]||y["Content-Type"]||(y["Content-Type"]="application/json"),p=JSON.stringify(!0===e.json?p:e.json))),s.onreadystatechange=function(){4===s.readyState&&setTimeout(o,0)},s.onload=o,s.onerror=r,s.onprogress=function(){},s.onabort=function(){c=!0},s.ontimeout=r,s.open(d,l,!g,e.username,e.password),g||(s.withCredentials=!!e.withCredentials),!g&&e.timeout>0&&(f=setTimeout(function(){if(!c){c=!0,s.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",r(e)}},e.timeout)),s.setRequestHeader)for(u in y)y.hasOwnProperty(u)&&s.setRequestHeader(u,y[u]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(s.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(s),s.send(p||null),s}e.exports=a,e.exports.default=a,a.XMLHttpRequest=r.XMLHttpRequest||function(){},a.XDomainRequest="withCredentials"in new a.XMLHttpRequest?a.XMLHttpRequest:r.XDomainRequest,function(e,t){for(var n=0;n<e.length;n++)t(e[n])}(["get","put","post","patch","head","delete"],function(e){a["delete"===e?"del":e]=function(t,n,r){return(n=c(t,n,r)).method=e.toUpperCase(),s(n)}})},function(e,t,n){"use strict";var r=a(n(16)),o=a(n(7)),i=a(n(3)),u=a(n(2)),c=n(0);function a(e){return e&&e.__esModule?e:{default:e}}e.exports=(0,u.default)(i.default,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return new(Function.prototype.bind.apply(o.default,[null].concat([r.default],t)))},{getPageUrl:c.getPageUrl,getClientInfo:c.getClientInfo,uniqueId:c.uniqueId})}])});
//# sourceMappingURL=glomex.content-sdk.js.map
{
"name": "@glomex/content-sdk-js",
"version": "1.1.4",
"version": "1.2.0",
"license": "MIT",

@@ -27,6 +27,3 @@ "description": "SDK that offers easy access for developers to video sources and glomex tracking events",

"dependencies": {
"es6-promise": "^4.2.4",
"lite-url": "^1.0.4",
"query-string": "^6.1.0",
"uuid": "^3.2.1",
"xhr": "^2.5.0"

@@ -37,9 +34,5 @@ },

"babel-loader": "^7.1.4",
"babel-plugin-espower": "^2.3.2",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
"babel-plugin-transform-es2015-modules-umd": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.7.0",
"babel-preset-es2015": "^6.24.1",
"babel-register": "^6.24.1",

@@ -46,0 +39,0 @@ "clean-webpack-plugin": "^0.1.19",

@@ -14,7 +14,2 @@ # content-sdk-js

Using yarn:
```bash
yarn add @glomex/content-sdk-js
```
In a browser:

@@ -21,0 +16,0 @@ ```html

@@ -1,2 +0,2 @@

!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([,function(e,t,n){var r,o,i;o=[],void 0===(i="function"==typeof(r=function(){"use strict";!function(e,t){t.createOwnVideoPlayer||(t.createOwnVideoPlayer=function(t){var n=e.getElementById("example-container");n||(n=e.createElement("div"),e.getElementsByTagName("body")[0].appendChild(n));var r=e.createElement("video"),o=e.createElement("source");return o.type="video/mp4",o.src=t.progressive,r.appendChild(o),r.autoplay=!1,r.setAttribute("width","640"),r.setAttribute("height","480"),r.controls=!0,n.appendChild(r),r})}(document,window)})?r.apply(t,o):r)||(e.exports=i)}]);
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}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 o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));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=0)}([function(e,t,r){"use strict";!function(e,t){t.createOwnVideoPlayer||(t.createOwnVideoPlayer=function(t){var r=e.getElementById("example-container");r||(r=e.createElement("div"),e.getElementsByTagName("body")[0].appendChild(r));var n=e.createElement("video"),o=e.createElement("source");return o.type="video/mp4",o.src=t.progressive,n.appendChild(o),n.autoplay=!1,n.setAttribute("width","640"),n.setAttribute("height","480"),n.controls=!0,r.appendChild(n),n})}(document,window)}]);
//# sourceMappingURL=create-video-player.js.map

@@ -1,16 +0,2 @@

!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=24)}([function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},,function(t,e,n){
/**
* lite-url - Small, JS lib that uses regex for parsing a URL into it's component parts.
* @version v1.0.5
* @link https://github.com/sadams/lite-url
* @license BSD-3-Clause
*/
(function(){"use strict";function n(t,e,n){var r=t.split(e);return n(r.shift(),r.join(e))}function r(t){var e={hash:"",host:"",hostname:"",origin:"",pathname:"",protocol:"",search:"",password:"",username:"",port:""};return n(t,"#",function(t,r){r&&(e.hash=r?"#"+r:""),n(t,"?",function(t,r){r&&(e.search="?"+r),t&&n(t,"//",function(t,r){e.protocol=t,n(r,"/",function(t,r){e.pathname="/"+(r||""),(e.protocol||t)&&(e.origin=e.protocol+"//"+t),n(t,"@",function(t,r){if(r){var o=t.split(":");e.username=o[0],e.password=o[1]}else r=t;e.host=r,n(r,":",function(t,n){e.hostname=t,n&&(e.port=n)})})})})})}),e.href=e.origin+e.pathname+e.search+e.hash,e}function o(t){var e={},n=t.search;if(n){var r=(n=n.replace(new RegExp("\\?"),"")).split("&");for(var o in r)if(r.hasOwnProperty(o)&&r[o]){var i=r[o].split("=");e[i[0]]=i[1]}}return e}function i(t){var e=u[t];return void 0!==e?e:((e=r(t)).params=o(e),u[t]=e,e)}var u={};return i.changeQueryParser=function(t){o=t},void 0!==t&&t.exports&&(e=t.exports=i),e.liteURL=i,i}).call(this)},function(t,e,n){var r,o,i;o=[e,n(2)],void 0===(i="function"==typeof(r=function(t,e){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.handleConfigErrors=t.getPageUrl=void 0;var n,r=(n=e)&&n.__esModule?n:{default:n};t.getPageUrl=function(){return window.glomexContext&&window.glomexContext.pageUrl?(0,r.default)(window.glomexContext.pageUrl):function(){try{return window.self!==window.top}catch(t){return!0}}()&&window.document.referrer?(0,r.default)(window.document.referrer):(0,r.default)(window.location.href)},t.handleConfigErrors=function(t){Object.keys(t).forEach(function(e){if(!t[e])throw new Error("config."+e+" not found, "+e+" must be provided")})}})?r.apply(e,o):r)||(t.exports=i)},function(t,e){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);t.exports=function(t,e){var r=e||0,o=n;return o[t[r++]]+o[t[r++]]+o[t[r++]]+o[t[r++]]+"-"+o[t[r++]]+o[t[r++]]+"-"+o[t[r++]]+o[t[r++]]+"-"+o[t[r++]]+o[t[r++]]+"-"+o[t[r++]]+o[t[r++]]+o[t[r++]]+o[t[r++]]+o[t[r++]]+o[t[r++]]}},function(t,e){var n="undefined"!=typeof crypto&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);t.exports=function(){return n(r),r}}else{var o=new Array(16);t.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),o[e]=t>>>((3&e)<<3)&255;return o}}},function(t,e,n){var r,o,i=n(5),u=n(4),c=0,s=0;t.exports=function(t,e,n){var a=e&&n||0,f=e||[],l=(t=t||{}).node||r,d=void 0!==t.clockseq?t.clockseq:o;if(null==l||null==d){var p=i();null==l&&(l=r=[1|p[0],p[1],p[2],p[3],p[4],p[5]]),null==d&&(d=o=16383&(p[6]<<8|p[7]))}var h=void 0!==t.msecs?t.msecs:(new Date).getTime(),v=void 0!==t.nsecs?t.nsecs:s+1,y=h-c+(v-s)/1e4;if(y<0&&void 0===t.clockseq&&(d=d+1&16383),(y<0||h>c)&&void 0===t.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=h,s=v,o=d;var g=(1e4*(268435455&(h+=122192928e5))+v)%4294967296;f[a++]=g>>>24&255,f[a++]=g>>>16&255,f[a++]=g>>>8&255,f[a++]=255&g;var m=h/4294967296*1e4&268435455;f[a++]=m>>>8&255,f[a++]=255&m,f[a++]=m>>>24&15|16,f[a++]=m>>>16&255,f[a++]=d>>>8|128,f[a++]=255&d;for(var w=0;w<6;++w)f[a+w]=l[w];return e||u(f)}},function(t,e,n){var r,o,i;o=[e,n(6),n(3)],void 0===(i="function"==typeof(r=function(t,e,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=(r=e)&&r.__esModule?r:{default:r},i={integrationId:null,contentId:null,pageUrl:(0,n.getPageUrl)().href,contentSessionId:(0,o.default)(),clientInfo:function(){try{return window.navigator.appVersion}catch(t){return"n/a"}}(),backendUrl:"https://integration-sdk-eu-west-1.mes.glomex.cloud/video"};t.default=function(t,e){return function(r){if(!r)throw new Error("No config found, config object must be provided");var o=Object.assign({},i,r);(0,n.handleConfigErrors)(o);var u=e(o);return new t(u)}}})?r.apply(e,o):r)||(t.exports=i)},function(t,e,n){var r,o,i;o=[e],void 0===(i="function"==typeof(r=function(t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t){return{getSources:function(){return t.getVideoSources()},trackContentBegin:function(){return t.trackEvent("contentBegin")},trackAdBegin:function(e){return t.trackEvent("adBegin",e)}}}})?r.apply(e,o):r)||(t.exports=i)},function(t,e){var n,r,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function c(t){if(n===setTimeout)return setTimeout(t,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(t){n=i}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(t){r=u}}();var s,a=[],f=!1,l=-1;function d(){f&&s&&(f=!1,s.length?a=s.concat(a):l=-1,a.length&&p())}function p(){if(!f){var t=c(d);f=!0;for(var e=a.length;e;){for(s=a,a=[];++l<e;)s&&s[l].run();l=-1,e=a.length}s=null,f=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function h(t,e){this.fun=t,this.array=e}function v(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];a.push(new h(t,e)),1!==a.length||f||c(p)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e,n){(function(e,n){
/*!
* @overview es6-promise - a tiny implementation of Promises/A+.
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
* @license Licensed under MIT license
* See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
* @version v4.2.4+314e4831
*/var r;r=function(){"use strict";function t(t){return"function"==typeof t}var r=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},o=0,i=void 0,u=void 0,c=function(t,e){h[o]=t,h[o+1]=e,2===(o+=2)&&(u?u(v):b())};var s="undefined"!=typeof window?window:void 0,a=s||{},f=a.MutationObserver||a.WebKitMutationObserver,l="undefined"==typeof self&&void 0!==e&&"[object process]"==={}.toString.call(e),d="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function p(){var t=setTimeout;return function(){return t(v,1)}}var h=new Array(1e3);function v(){for(var t=0;t<o;t+=2){(0,h[t])(h[t+1]),h[t]=void 0,h[t+1]=void 0}o=0}var y,g,m,w,b=void 0;function _(t,e){var n=this,r=new this.constructor(E);void 0===r[x]&&F(r);var o=n._state;if(o){var i=arguments[o-1];c(function(){return U(o,r,i,n._result)})}else q(n,r,t,e);return r}function j(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=new this(E);return R(e,t),e}l?b=function(){return e.nextTick(v)}:f?(g=0,m=new f(v),w=document.createTextNode(""),m.observe(w,{characterData:!0}),b=function(){w.data=g=++g%2}):d?((y=new MessageChannel).port1.onmessage=v,b=function(){return y.port2.postMessage(0)}):b=void 0===s?function(){try{var t=Function("return this")().require("vertx");return void 0!==(i=t.runOnLoop||t.runOnContext)?function(){i(v)}:p()}catch(t){return p()}}():p();var x=Math.random().toString(36).substring(2);function E(){}var k=void 0,O=1,T=2,S={error:null};function A(t){try{return t.then}catch(t){return S.error=t,S}}function C(e,n,r){n.constructor===e.constructor&&r===_&&n.constructor.resolve===j?function(t,e){e._state===O?P(t,e._result):e._state===T?I(t,e._result):q(e,void 0,function(e){return R(t,e)},function(e){return I(t,e)})}(e,n):r===S?(I(e,S.error),S.error=null):void 0===r?P(e,n):t(r)?function(t,e,n){c(function(t){var r=!1,o=function(t,e,n,r){try{t.call(e,n,r)}catch(t){return t}}(n,e,function(n){r||(r=!0,e!==n?R(t,n):P(t,n))},function(e){r||(r=!0,I(t,e))},t._label);!r&&o&&(r=!0,I(t,o))},t)}(e,n,r):P(e,n)}function R(t,e){var n,r;t===e?I(t,new TypeError("You cannot resolve a promise with itself")):(r=typeof(n=e),null===n||"object"!==r&&"function"!==r?P(t,e):C(t,e,A(e)))}function M(t){t._onerror&&t._onerror(t._result),L(t)}function P(t,e){t._state===k&&(t._result=e,t._state=O,0!==t._subscribers.length&&c(L,t))}function I(t,e){t._state===k&&(t._state=T,t._result=e,c(M,t))}function q(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+O]=n,o[i+T]=r,0===i&&t._state&&c(L,t)}function L(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,o=void 0,i=t._result,u=0;u<e.length;u+=3)r=e[u],o=e[u+n],r?U(n,r,o,i):o(i);t._subscribers.length=0}}function U(e,n,r,o){var i=t(r),u=void 0,c=void 0,s=void 0,a=void 0;if(i){if((u=function(t,e){try{return t(e)}catch(t){return S.error=t,S}}(r,o))===S?(a=!0,c=u.error,u.error=null):s=!0,n===u)return void I(n,new TypeError("A promises callback cannot return that same promise."))}else u=o,s=!0;n._state!==k||(i&&s?R(n,u):a?I(n,c):e===O?P(n,u):e===T&&I(n,u))}var X=0;function F(t){t[x]=X++,t._state=void 0,t._result=void 0,t._subscribers=[]}var H=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(E),this.promise[x]||F(this.promise),r(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?P(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&P(this.promise,this._result))):I(this.promise,new Error("Array Methods must be provided an Array"))}return t.prototype._enumerate=function(t){for(var e=0;this._state===k&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===j){var o=A(t);if(o===_&&t._state!==k)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(n===N){var i=new n(E);C(i,t,o),this._willSettleAt(i,e)}else this._willSettleAt(new n(function(e){return e(t)}),e)}else this._willSettleAt(r(t),e)},t.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===k&&(this._remaining--,t===T?I(r,n):this._result[e]=n),0===this._remaining&&P(r,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;q(t,void 0,function(t){return n._settledAt(O,e,t)},function(t){return n._settledAt(T,e,t)})},t}();var N=function(){function t(e){this[x]=X++,this._result=this._state=void 0,this._subscribers=[],E!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof t?function(t,e){try{e(function(e){R(t,e)},function(e){I(t,e)})}catch(e){I(t,e)}}(this,e):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return t.prototype.catch=function(t){return this.then(null,t)},t.prototype.finally=function(t){var e=this.constructor;return this.then(function(n){return e.resolve(t()).then(function(){return n})},function(n){return e.resolve(t()).then(function(){throw n})})},t}();return N.prototype.then=_,N.all=function(t){return new H(this,t).promise},N.race=function(t){var e=this;return r(t)?new e(function(n,r){for(var o=t.length,i=0;i<o;i++)e.resolve(t[i]).then(n,r)}):new e(function(t,e){return e(new TypeError("You must pass an array to race."))})},N.resolve=j,N.reject=function(t){var e=new this(E);return I(e,t),e},N._setScheduler=function(t){u=t},N._setAsap=function(t){c=t},N._asap=c,N.polyfill=function(){var t=void 0;if(void 0!==n)t=n;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var r=null;try{r=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===r&&!e.cast)return}t.Promise=N},N.Promise=N,N},t.exports=r()}).call(this,n(9),n(0))},function(t,e,n){"use strict";var r=new RegExp("%[a-f0-9]{2}","gi"),o=new RegExp("(%[a-f0-9]{2})+","gi");function i(t,e){try{return decodeURIComponent(t.join(""))}catch(t){}if(1===t.length)return t;e=e||1;var n=t.slice(0,e),r=t.slice(e);return Array.prototype.concat.call([],i(n),i(r))}function u(t){try{return decodeURIComponent(t)}catch(o){for(var e=t.match(r),n=1;n<e.length;n++)e=(t=i(e,n).join("")).match(r);return t}}t.exports=function(t){if("string"!=typeof t)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch(e){return function(t){for(var e={"%FE%FF":"��","%FF%FE":"��"},n=o.exec(t);n;){try{e[n[0]]=decodeURIComponent(n[0])}catch(t){var r=u(n[0]);r!==n[0]&&(e[n[0]]=r)}n=o.exec(t)}e["%C2"]="�";for(var i=Object.keys(e),c=0;c<i.length;c++){var s=i[c];t=t.replace(new RegExp(s,"g"),e[s])}return t}(t)}}},function(t,e,n){"use strict";t.exports=(t=>encodeURIComponent(t).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`))},function(t,e,n){"use strict";const r=n(12),o=n(11);function i(t,e){return e.encode?e.strict?r(t):encodeURIComponent(t):t}function u(t,e){return e.decode?o(t):t}function c(t){const e=t.indexOf("?");return-1===e?"":t.slice(e+1)}function s(t,e){const n=function(t){let e;switch(t.arrayFormat){case"index":return(t,n,r)=>{e=/\[(\d*)\]$/.exec(t),t=t.replace(/\[\d*\]$/,""),e?(void 0===r[t]&&(r[t]={}),r[t][e[1]]=n):r[t]=n};case"bracket":return(t,n,r)=>{e=/(\[\])$/.exec(t),t=t.replace(/\[\]$/,""),e?void 0!==r[t]?r[t]=[].concat(r[t],n):r[t]=[n]:r[t]=n};default:return(t,e,n)=>{void 0!==n[t]?n[t]=[].concat(n[t],e):n[t]=e}}}(e=Object.assign({decode:!0,arrayFormat:"none"},e)),r=Object.create(null);if("string"!=typeof t)return r;if(!(t=t.trim().replace(/^[?#&]/,"")))return r;for(const o of t.split("&")){let[t,i]=o.replace(/\+/g," ").split("=");i=void 0===i?null:u(i,e),n(u(t,e),i,r)}return Object.keys(r).sort().reduce((t,e)=>{const n=r[e];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?t[e]=function t(e){return Array.isArray(e)?e.sort():"object"==typeof e?t(Object.keys(e)).sort((t,e)=>Number(t)-Number(e)).map(t=>e[t]):e}(n):t[e]=n,t},Object.create(null))}e.extract=c,e.parse=s,e.stringify=((t,e)=>{!1===(e=Object.assign({encode:!0,strict:!0,arrayFormat:"none"},e)).sort&&(e.sort=(()=>{}));const n=function(t){switch(t.arrayFormat){case"index":return(e,n,r)=>null===n?[i(e,t),"[",r,"]"].join(""):[i(e,t),"[",i(r,t),"]=",i(n,t)].join("");case"bracket":return(e,n)=>null===n?[i(e,t),"[]"].join(""):[i(e,t),"[]=",i(n,t)].join("");default:return(e,n)=>null===n?i(e,t):[i(e,t),"=",i(n,t)].join("")}}(e);return t?Object.keys(t).sort(e.sort).map(r=>{const o=t[r];if(void 0===o)return"";if(null===o)return i(r,e);if(Array.isArray(o)){const t=[];for(const e of o.slice())void 0!==e&&t.push(n(r,e,t.length));return t.join("&")}return i(r,e)+"="+i(o,e)}).filter(t=>t.length>0).join("&"):""}),e.parseUrl=((t,e)=>({url:t.split("?")[0]||"",query:s(c(t),e)}))},function(t,e,n){var r,o,i;o=[e,n(13),n(10)],void 0===(i="function"==typeof(r=function(t,e){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,r=(n=e)&&n.__esModule?n:{default:n},o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._xhr=e,this._defaultXhrOptions={method:"get",url:null,json:!0},this._config=Object.assign({},n),this._videoStored=null}return i(t,[{key:"getVideoSources",value:function(){var t=this;return new Promise(function(e,n){var r=t._createUrl(t._config);t._xhr.get({url:r,json:!0},function(r,o,i){t._handleGetVideoSources(r,o,i,e,n)})})}},{key:"_handleGetVideoSources",value:function(t,e,n,r,i){return t?i(t):n&&n.error?i(n.error):n?n.video&&n.video.source?(this._storeVideo(n.video),void r(o({},n.video.source))):i(new Error("Video sources are malformed")):i(new Error("Can't fetch video sources"))}},{key:"_createUrl",value:function(t){var e=t.integrationId,n=t.contentId,o=t.pageUrl,i={integration_id:e,content_id:n,page_url:o,sdk_type:"js"},u=r.default.stringify(i);return this._config.backendUrl+"?"+u}},{key:"trackEvent",value:function(t,e){if(!t)throw new Error("event for tracking was not specified, event must be provided");if(!this._videoStored.tracking[t])throw new Error("Something is wrong with "+t+" tracking endpoints.");if("adBegin"===t&&!e)throw new Error("adRollName not found, adRollName must be provided");var n=this._videoStored.tracking[t];return this._executeTrackingRequests(n,e)}},{key:"_executeTrackingRequests",value:function(t,e){var n=this,r=t.map(function(t){var r=t.method,o=t.url,i=t.payload,u=void 0===i?{}:i;if(!o)return new Promise(function(t,e){return e(new Error("url is not found, endpoint is malformed"))});var c=n._getTrackingXhrOptions(r,o,u,e);return new Promise(function(t,e){n._xhr(c,function(n,r,o){return n?e(n):200===r.statusCode?t(o):void 0})})});return Promise.all(r).catch(function(t){throw console.log(t),new Error("Service is unavailable. Please contact glomex tech support")})}},{key:"_getTrackingXhrOptions",value:function(t,e,n,i){var u=this._defaultXhrOptions,c="get"===t.toLowerCase(),s=this._config,a=s.contentSessionId,f=s.clientInfo,l=o({},n,i?{contentSessionId:a,clientInfo:f,adRollName:i}:{contentSessionId:a,clientInfo:f});if(c){var d=e+"&"+r.default.stringify(l);return o({},u,{url:d})}return o({},u,{method:"post",url:e,body:l})}},{key:"_storeVideo",value:function(t){this._videoStored=t}}]),t}();t.default=u})?r.apply(e,o):r)||(t.exports=i)},function(t,e){t.exports=function(){for(var t={},e=0;e<arguments.length;e++){var r=arguments[e];for(var o in r)n.call(r,o)&&(t[o]=r[o])}return t};var n=Object.prototype.hasOwnProperty},function(t,e,n){"use strict";var r=Function.prototype.toString,o=/^\s*class /,i=function(t){try{var e=r.call(t).replace(/\/\/.*\n/g,"").replace(/\/\*[.\s\S]*\*\//g,"").replace(/\n/gm," ").replace(/ {2}/g," ");return o.test(e)}catch(t){return!1}},u=Object.prototype.toString,c="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;t.exports=function(t){if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if(c)return function(t){try{return!i(t)&&(r.call(t),!0)}catch(t){return!1}}(t);if(i(t))return!1;var e=u.call(t);return"[object Function]"===e||"[object GeneratorFunction]"===e}},function(t,e,n){"use strict";var r=n(16),o=Object.prototype.toString,i=Object.prototype.hasOwnProperty;t.exports=function(t,e,n){if(!r(e))throw new TypeError("iterator must be a function");var u;arguments.length>=3&&(u=n),"[object Array]"===o.call(t)?function(t,e,n){for(var r=0,o=t.length;r<o;r++)i.call(t,r)&&(null==n?e(t[r],r,t):e.call(n,t[r],r,t))}(t,e,u):"string"==typeof t?function(t,e,n){for(var r=0,o=t.length;r<o;r++)null==n?e(t.charAt(r),r,t):e.call(n,t.charAt(r),r,t)}(t,e,u):function(t,e,n){for(var r in t)i.call(t,r)&&(null==n?e(t[r],r,t):e.call(n,t[r],r,t))}(t,e,u)}},function(t,e){(e=t.exports=function(t){return t.replace(/^\s*|\s*$/g,"")}).left=function(t){return t.replace(/^\s*/,"")},e.right=function(t){return t.replace(/\s*$/,"")}},function(t,e,n){var r=n(18),o=n(17);t.exports=function(t){if(!t)return{};var e={};return o(r(t).split("\n"),function(t){var n,o=t.indexOf(":"),i=r(t.slice(0,o)).toLowerCase(),u=r(t.slice(o+1));void 0===e[i]?e[i]=u:(n=e[i],"[object Array]"===Object.prototype.toString.call(n)?e[i].push(u):e[i]=[e[i],u])}),e}},function(t,e){t.exports=function(t){var e=n.call(t);return"[object Function]"===e||"function"==typeof t&&"[object RegExp]"!==e||"undefined"!=typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)};var n=Object.prototype.toString},function(t,e,n){(function(e){var n;n="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},t.exports=n}).call(this,n(0))},function(t,e,n){"use strict";var r=n(21),o=n(20),i=n(19),u=n(15);function c(t,e,n){var r=t;return o(e)?(n=e,"string"==typeof t&&(r={uri:t})):r=u(e,{uri:t}),r.callback=n,r}function s(t,e,n){return a(e=c(t,e,n))}function a(t){if(void 0===t.callback)throw new Error("callback argument missing");var e=!1,n=function(n,r,o){e||(e=!0,t.callback(n,r,o))};function r(t){return clearTimeout(f),t instanceof Error||(t=new Error(""+(t||"Unknown XMLHttpRequest Error"))),t.statusCode=0,n(t,g)}function o(){if(!c){var e;clearTimeout(f),e=t.useXDR&&void 0===a.status?200:1223===a.status?204:a.status;var r=g,o=null;return 0!==e?(r={body:function(){var t=void 0;if(t=a.response?a.response:a.responseText||function(t){try{if("document"===t.responseType)return t.responseXML;var e=t.responseXML&&"parsererror"===t.responseXML.documentElement.nodeName;if(""===t.responseType&&!e)return t.responseXML}catch(t){}return null}(a),y)try{t=JSON.parse(t)}catch(t){}return t}(),statusCode:e,method:d,headers:{},url:l,rawRequest:a},a.getAllResponseHeaders&&(r.headers=i(a.getAllResponseHeaders()))):o=new Error("Internal XMLHttpRequest Error"),n(o,r,r.body)}}var u,c,a=t.xhr||null;a||(a=t.cors||t.useXDR?new s.XDomainRequest:new s.XMLHttpRequest);var f,l=a.url=t.uri||t.url,d=a.method=t.method||"GET",p=t.body||t.data,h=a.headers=t.headers||{},v=!!t.sync,y=!1,g={body:void 0,headers:{},statusCode:0,method:d,url:l,rawRequest:a};if("json"in t&&!1!==t.json&&(y=!0,h.accept||h.Accept||(h.Accept="application/json"),"GET"!==d&&"HEAD"!==d&&(h["content-type"]||h["Content-Type"]||(h["Content-Type"]="application/json"),p=JSON.stringify(!0===t.json?p:t.json))),a.onreadystatechange=function(){4===a.readyState&&setTimeout(o,0)},a.onload=o,a.onerror=r,a.onprogress=function(){},a.onabort=function(){c=!0},a.ontimeout=r,a.open(d,l,!v,t.username,t.password),v||(a.withCredentials=!!t.withCredentials),!v&&t.timeout>0&&(f=setTimeout(function(){if(!c){c=!0,a.abort("timeout");var t=new Error("XMLHttpRequest timeout");t.code="ETIMEDOUT",r(t)}},t.timeout)),a.setRequestHeader)for(u in h)h.hasOwnProperty(u)&&a.setRequestHeader(u,h[u]);else if(t.headers&&!function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}(t.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(a.responseType=t.responseType),"beforeSend"in t&&"function"==typeof t.beforeSend&&t.beforeSend(a),a.send(p||null),a}t.exports=s,t.exports.default=s,s.XMLHttpRequest=r.XMLHttpRequest||function(){},s.XDomainRequest="withCredentials"in new s.XMLHttpRequest?s.XMLHttpRequest:r.XDomainRequest,function(t,e){for(var n=0;n<t.length;n++)e(t[n])}(["get","put","post","patch","head","delete"],function(t){s["delete"===t?"del":t]=function(e,n,r){return(n=c(e,n,r)).method=t.toUpperCase(),a(n)}})},function(t,e,n){var r,o,i;o=[t,n(22),n(14),n(8),n(7)],void 0===(i="function"==typeof(r=function(t,e,n,r,o){"use strict";var i=a(e),u=a(n),c=a(r),s=a(o);function a(t){return t&&t.__esModule?t:{default:t}}t.exports=(0,s.default)(c.default,function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return new(Function.prototype.bind.apply(u.default,[null].concat([i.default],e)))})})?r.apply(e,o):r)||(t.exports=i)},function(t,e,n){var r,o,i;o=[n(23)],void 0===(i="function"==typeof(r=function(t){"use strict";var e=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(t);!function(t,n,r){var o={integrationId:"[INTEGRATION_ID]",contentId:"[CONTENT_ID]"};!function(){var t=new e.default(o);t.getSources().then(function(e){var n=r.createOwnVideoPlayer(e);t.trackContentBegin(),n.addEventListener("loadeddata",function(){t.trackAdBegin("preroll")}),n.addEventListener("ended",function(){t.trackAdBegin("postroll")}),n.play()},function(t){console.error(t)})}();var i=t.querySelectorAll(".js-get-config"),u=t.querySelector(".js-get-sources-demo"),c=t.querySelector(".js-track-content-begin-demo"),s=t.querySelector(".js-track-ad-begin-demo"),a=g(),f=new e.default(a);function l(){y(),function(){if(n){var t=g();Object.keys(t).forEach(function(e){return n.setItem("glomex_sdk_"+e,t[e])})}}()}function d(){(f=new e.default(g())).getSources().then(function(){s.removeAttribute("disabled"),c.removeAttribute("disabled"),v("getSources()")}).catch(function(t){y(),console.error(t)})}function p(){f.trackContentBegin().then(function(){return v("trackContentBegin()")})}function h(){f.trackAdBegin("postroll").then(function(){return v("trackAdBegin('postroll')")})}function v(t){console.warn(t+" was performed, check network requests")}function y(){s.setAttribute("disabled",""),c.setAttribute("disabled","")}function g(){var t=i[0].value,e=i[1].value,n=i[2].value,r={integrationId:t,contentId:e};return n&&(r.pageUrl=n),Object.assign({},o,r)}Object.keys(g()).forEach(function(t,e){return function(t,e){var r=n.getItem("glomex_sdk_"+t);r&&(i[e].value=r)}(t,e)}),i.forEach(function(t){["change","keyup"].forEach(function(e){return t.addEventListener(e,l)})}),u.addEventListener("click",d),c.addEventListener("click",p),s.addEventListener("click",h)}(document,window.localStorage,window)})?r.apply(e,o):r)||(t.exports=i)}]);
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=19)}([,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.getPageUrl=function(){try{return window.location.href}catch(e){return null}},t.getClientInfo=function(){try{return window.navigator.appVersion}catch(e){return"n/a"}},t.uniqueId=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.handleConfigErrors=function(e){Object.keys(e).forEach(function(t){if(!e[t])throw new Error("config."+t+" not found, "+t+" must be provided")})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2);t.default=function(e,t,n){var o=n.getPageUrl,i=n.getClientInfo,u=n.uniqueId;return function(n){var c={integrationId:null,contentId:null,pageUrl:o(),contentSessionId:u(),clientInfo:i(),backendUrl:"https://integration-sdk-eu-west-1.mes.glomex.cloud/video"};if(!n)throw new Error("No config found, config object must be provided");var a=Object.assign({},c,n);(0,r.handleConfigErrors)(a);var s=t(a);return e(s)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=function(e){return{getSources:function(){return e.getVideoSources()},trackContentBegin:function(){return e.trackEvent("contentBegin")},trackAdBegin:function(t){return e.trackEvent("adBegin",t)}}}},function(e,t,n){"use strict";var r=new RegExp("%[a-f0-9]{2}","gi"),o=new RegExp("(%[a-f0-9]{2})+","gi");function i(e,t){try{return decodeURIComponent(e.join(""))}catch(e){}if(1===e.length)return e;t=t||1;var n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],i(n),i(r))}function u(e){try{return decodeURIComponent(e)}catch(o){for(var t=e.match(r),n=1;n<t.length;n++)t=(e=i(t,n).join("")).match(r);return e}}e.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},n=o.exec(e);n;){try{t[n[0]]=decodeURIComponent(n[0])}catch(e){var r=u(n[0]);r!==n[0]&&(t[n[0]]=r)}n=o.exec(e)}t["%C2"]="�";for(var i=Object.keys(t),c=0;c<i.length;c++){var a=i[c];e=e.replace(new RegExp(a,"g"),t[a])}return e}(e)}}},function(e,t,n){"use strict";e.exports=(e=>encodeURIComponent(e).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`))},function(e,t,n){"use strict";const r=n(6),o=n(5);function i(e,t){return t.encode?t.strict?r(e):encodeURIComponent(e):e}function u(e,t){return t.decode?o(e):e}function c(e){const t=e.indexOf("?");return-1===t?"":e.slice(t+1)}function a(e,t){const n=function(e){let t;switch(e.arrayFormat){case"index":return(e,n,r)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===r[e]&&(r[e]={}),r[e][t[1]]=n):r[e]=n};case"bracket":return(e,n,r)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};default:return(e,t,n)=>{void 0!==n[e]?n[e]=[].concat(n[e],t):n[e]=t}}}(t=Object.assign({decode:!0,arrayFormat:"none"},t)),r=Object.create(null);if("string"!=typeof e)return r;if(!(e=e.trim().replace(/^[?#&]/,"")))return r;for(const o of e.split("&")){let[e,i]=o.replace(/\+/g," ").split("=");i=void 0===i?null:u(i,t),n(u(e,t),i,r)}return Object.keys(r).sort().reduce((e,t)=>{const n=r[t];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?e[t]=function e(t){return Array.isArray(t)?t.sort():"object"==typeof t?e(Object.keys(t)).sort((e,t)=>Number(e)-Number(t)).map(e=>t[e]):t}(n):e[t]=n,e},Object.create(null))}t.extract=c,t.parse=a,t.stringify=((e,t)=>{!1===(t=Object.assign({encode:!0,strict:!0,arrayFormat:"none"},t)).sort&&(t.sort=(()=>{}));const n=function(e){switch(e.arrayFormat){case"index":return(t,n,r)=>null===n?[i(t,e),"[",r,"]"].join(""):[i(t,e),"[",i(r,e),"]=",i(n,e)].join("");case"bracket":return(t,n)=>null===n?[i(t,e),"[]"].join(""):[i(t,e),"[]=",i(n,e)].join("");default:return(t,n)=>null===n?i(t,e):[i(t,e),"=",i(n,e)].join("")}}(t);return e?Object.keys(e).sort(t.sort).map(r=>{const o=e[r];if(void 0===o)return"";if(null===o)return i(r,t);if(Array.isArray(o)){const e=[];for(const t of o.slice())void 0!==t&&e.push(n(r,t,e.length));return e.join("&")}return i(r,t)+"="+i(o,t)}).filter(e=>e.length>0).join("&"):""}),t.parseUrl=((e,t)=>({url:e.split("?")[0]||"",query:a(c(e),t)}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(7),c=(r=u)&&r.__esModule?r:{default:r};var a=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._xhr=t,this._defaultXhrOptions={method:"get",url:null,json:!0},this._config=Object.assign({},n),this._videoStored=null}return i(e,[{key:"getVideoSources",value:function(){var e=this;return new Promise(function(t,n){var r=e._createUrl(e._config);e._xhr.get({url:r,json:!0},function(r,o,i){e._handleGetVideoSources(r,o,i,t,n)})})}},{key:"_handleGetVideoSources",value:function(e,t,n,r,i){return e?i(e):n&&n.error?i(n.error):n?n.video&&n.video.source?(this._storeVideo(n.video),void r(o({},n.video.source))):i(new Error("Video sources are malformed")):i(new Error("Can't fetch video sources"))}},{key:"_createUrl",value:function(e){var t={integration_id:e.integrationId,content_id:e.contentId,page_url:e.pageUrl,sdk_type:"js"},n=c.default.stringify(t);return this._config.backendUrl+"?"+n}},{key:"trackEvent",value:function(e,t){if(!e)throw new Error("event for tracking was not specified, event must be provided");if(!this._videoStored.tracking[e])throw new Error("Something is wrong with "+e+" tracking endpoints.");if("adBegin"===e&&!t)throw new Error("adRollName not found, adRollName must be provided");var n=this._videoStored.tracking[e];return this._executeTrackingRequests(n,t)}},{key:"_executeTrackingRequests",value:function(e,t){var n=this,r=e.map(function(e){var r=e.method,o=e.url,i=e.payload,u=void 0===i?{}:i;if(!o)return new Promise(function(e,t){return t(new Error("url is not found, endpoint is malformed"))});var c=n._getTrackingXhrOptions(r,o,u,t);return new Promise(function(e,t){n._xhr(c,function(n,r,o){return n?t(n):200===r.statusCode?e(o):void 0})})});return Promise.all(r).catch(function(e){throw console.log(e),new Error("Service is unavailable. Please contact glomex tech support")})}},{key:"_getTrackingXhrOptions",value:function(e,t,n,r){var i=this._defaultXhrOptions,u="get"===e.toLowerCase(),a=this._config,s=a.contentSessionId,l=a.clientInfo,f=o({},n,r?{contentSessionId:s,clientInfo:l,adRollName:r}:{contentSessionId:s,clientInfo:l});if(u){var d=t+"&"+c.default.stringify(f);return o({},i,{url:d})}return o({},i,{method:"post",url:t,body:f})}},{key:"_storeVideo",value:function(e){this._videoStored=e}}]),e}();t.default=a},function(e,t){e.exports=function(){for(var e={},t=0;t<arguments.length;t++){var r=arguments[t];for(var o in r)n.call(r,o)&&(e[o]=r[o])}return e};var n=Object.prototype.hasOwnProperty},function(e,t,n){"use strict";var r=Function.prototype.toString,o=/^\s*class /,i=function(e){try{var t=r.call(e).replace(/\/\/.*\n/g,"").replace(/\/\*[.\s\S]*\*\//g,"").replace(/\n/gm," ").replace(/ {2}/g," ");return o.test(t)}catch(e){return!1}},u=Object.prototype.toString,c="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;e.exports=function(e){if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if(c)return function(e){try{return!i(e)&&(r.call(e),!0)}catch(e){return!1}}(e);if(i(e))return!1;var t=u.call(e);return"[object Function]"===t||"[object GeneratorFunction]"===t}},function(e,t,n){"use strict";var r=n(10),o=Object.prototype.toString,i=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){if(!r(t))throw new TypeError("iterator must be a function");var u;arguments.length>=3&&(u=n),"[object Array]"===o.call(e)?function(e,t,n){for(var r=0,o=e.length;r<o;r++)i.call(e,r)&&(null==n?t(e[r],r,e):t.call(n,e[r],r,e))}(e,t,u):"string"==typeof e?function(e,t,n){for(var r=0,o=e.length;r<o;r++)null==n?t(e.charAt(r),r,e):t.call(n,e.charAt(r),r,e)}(e,t,u):function(e,t,n){for(var r in e)i.call(e,r)&&(null==n?t(e[r],r,e):t.call(n,e[r],r,e))}(e,t,u)}},function(e,t){(t=e.exports=function(e){return e.replace(/^\s*|\s*$/g,"")}).left=function(e){return e.replace(/^\s*/,"")},t.right=function(e){return e.replace(/\s*$/,"")}},function(e,t,n){var r=n(12),o=n(11);e.exports=function(e){if(!e)return{};var t={};return o(r(e).split("\n"),function(e){var n,o=e.indexOf(":"),i=r(e.slice(0,o)).toLowerCase(),u=r(e.slice(o+1));void 0===t[i]?t[i]=u:(n=t[i],"[object Array]"===Object.prototype.toString.call(n)?t[i].push(u):t[i]=[t[i],u])}),t}},function(e,t){e.exports=function(e){var t=n.call(e);return"[object Function]"===t||"function"==typeof e&&"[object RegExp]"!==t||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)};var n=Object.prototype.toString},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){(function(t){var n;n="undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{},e.exports=n}).call(this,n(15))},function(e,t,n){"use strict";var r=n(16),o=n(14),i=n(13),u=n(9);function c(e,t,n){var r=e;return o(t)?(n=t,"string"==typeof e&&(r={uri:e})):r=u(t,{uri:e}),r.callback=n,r}function a(e,t,n){return s(t=c(e,t,n))}function s(e){if(void 0===e.callback)throw new Error("callback argument missing");var t=!1,n=function(n,r,o){t||(t=!0,e.callback(n,r,o))};function r(e){return clearTimeout(l),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,n(e,h)}function o(){if(!c){var t;clearTimeout(l),t=e.useXDR&&void 0===s.status?200:1223===s.status?204:s.status;var r=h,o=null;return 0!==t?(r={body:function(){var e=void 0;if(e=s.response?s.response:s.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}(s),y)try{e=JSON.parse(e)}catch(e){}return e}(),statusCode:t,method:d,headers:{},url:f,rawRequest:s},s.getAllResponseHeaders&&(r.headers=i(s.getAllResponseHeaders()))):o=new Error("Internal XMLHttpRequest Error"),n(o,r,r.body)}}var u,c,s=e.xhr||null;s||(s=e.cors||e.useXDR?new a.XDomainRequest:new a.XMLHttpRequest);var l,f=s.url=e.uri||e.url,d=s.method=e.method||"GET",p=e.body||e.data,g=s.headers=e.headers||{},v=!!e.sync,y=!1,h={body:void 0,headers:{},statusCode:0,method:d,url:f,rawRequest:s};if("json"in e&&!1!==e.json&&(y=!0,g.accept||g.Accept||(g.Accept="application/json"),"GET"!==d&&"HEAD"!==d&&(g["content-type"]||g["Content-Type"]||(g["Content-Type"]="application/json"),p=JSON.stringify(!0===e.json?p:e.json))),s.onreadystatechange=function(){4===s.readyState&&setTimeout(o,0)},s.onload=o,s.onerror=r,s.onprogress=function(){},s.onabort=function(){c=!0},s.ontimeout=r,s.open(d,f,!v,e.username,e.password),v||(s.withCredentials=!!e.withCredentials),!v&&e.timeout>0&&(l=setTimeout(function(){if(!c){c=!0,s.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",r(e)}},e.timeout)),s.setRequestHeader)for(u in g)g.hasOwnProperty(u)&&s.setRequestHeader(u,g[u]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(s.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(s),s.send(p||null),s}e.exports=a,e.exports.default=a,a.XMLHttpRequest=r.XMLHttpRequest||function(){},a.XDomainRequest="withCredentials"in new a.XMLHttpRequest?a.XMLHttpRequest:r.XDomainRequest,function(e,t){for(var n=0;n<e.length;n++)t(e[n])}(["get","put","post","patch","head","delete"],function(e){a["delete"===e?"del":e]=function(t,n,r){return(n=c(t,n,r)).method=e.toUpperCase(),s(n)}})},function(e,t,n){"use strict";var r=a(n(17)),o=a(n(8)),i=a(n(4)),u=a(n(3)),c=n(1);function a(e){return e&&e.__esModule?e:{default:e}}e.exports=(0,u.default)(i.default,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return new(Function.prototype.bind.apply(o.default,[null].concat([r.default],t)))},{getPageUrl:c.getPageUrl,getClientInfo:c.getClientInfo,uniqueId:c.uniqueId})},function(e,t,n){"use strict";var r=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(18));!function(e,t,n){var o={integrationId:"[INTEGRATION_ID]",contentId:"[CONTENT_ID]"};!function(){var e=new r.default(o);e.getSources().then(function(t){var r=n.createOwnVideoPlayer(t);e.trackContentBegin(),r.addEventListener("loadeddata",function(){e.trackAdBegin("preroll")}),r.addEventListener("ended",function(){e.trackAdBegin("postroll")}),r.play()},function(e){console.error(e)})}();var i=e.querySelectorAll(".js-get-config"),u=e.querySelector(".js-get-sources-demo"),c=e.querySelector(".js-track-content-begin-demo"),a=e.querySelector(".js-track-ad-begin-demo"),s=h(),l=new r.default(s);function f(){y(),function(){if(!t)return;var e=h();Object.keys(e).forEach(function(n){return t.setItem("glomex_sdk_"+n,e[n])})}()}function d(){(l=new r.default(h())).getSources().then(function(){a.removeAttribute("disabled"),c.removeAttribute("disabled"),v("getSources()")}).catch(function(e){y(),console.error(e)})}function p(){l.trackContentBegin().then(function(){return v("trackContentBegin()")})}function g(){l.trackAdBegin("postroll").then(function(){return v("trackAdBegin('postroll')")})}function v(e){console.warn(e+" was performed, check network requests")}function y(){a.setAttribute("disabled",""),c.setAttribute("disabled","")}function h(){var e=i[0].value,t=i[1].value,n=i[2].value,r={integrationId:e,contentId:t};return n&&(r.pageUrl=n),Object.assign({},o,r)}Object.keys(h()).forEach(function(e,n){return function(e,n){var r=t.getItem("glomex_sdk_"+e);r&&(i[n].value=r)}(e,n)}),i.forEach(function(e){["change","keyup"].forEach(function(t){return e.addEventListener(t,f)})}),u.addEventListener("click",d),c.addEventListener("click",p),a.addEventListener("click",g)}(document,window.localStorage,window)}]);
//# sourceMappingURL=glomex.content-sdk-example.js.map

@@ -1,16 +0,2 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.glomexContentSDK=e():t.glomexContentSDK=e()}(window,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=22)}([function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){
/**
* lite-url - Small, JS lib that uses regex for parsing a URL into it's component parts.
* @version v1.0.5
* @link https://github.com/sadams/lite-url
* @license BSD-3-Clause
*/
(function(){"use strict";function n(t,e,n){var r=t.split(e);return n(r.shift(),r.join(e))}function r(t){var e={hash:"",host:"",hostname:"",origin:"",pathname:"",protocol:"",search:"",password:"",username:"",port:""};return n(t,"#",function(t,r){r&&(e.hash=r?"#"+r:""),n(t,"?",function(t,r){r&&(e.search="?"+r),t&&n(t,"//",function(t,r){e.protocol=t,n(r,"/",function(t,r){e.pathname="/"+(r||""),(e.protocol||t)&&(e.origin=e.protocol+"//"+t),n(t,"@",function(t,r){if(r){var o=t.split(":");e.username=o[0],e.password=o[1]}else r=t;e.host=r,n(r,":",function(t,n){e.hostname=t,n&&(e.port=n)})})})})})}),e.href=e.origin+e.pathname+e.search+e.hash,e}function o(t){var e={},n=t.search;if(n){var r=(n=n.replace(new RegExp("\\?"),"")).split("&");for(var o in r)if(r.hasOwnProperty(o)&&r[o]){var i=r[o].split("=");e[i[0]]=i[1]}}return e}function i(t){var e=u[t];return void 0!==e?e:((e=r(t)).params=o(e),u[t]=e,e)}var u={};return i.changeQueryParser=function(t){o=t},void 0!==t&&t.exports&&(e=t.exports=i),e.liteURL=i,i}).call(this)},function(t,e,n){var r,o,i;o=[e,n(1)],void 0===(i="function"==typeof(r=function(t,e){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.handleConfigErrors=t.getPageUrl=void 0;var n,r=(n=e)&&n.__esModule?n:{default:n};t.getPageUrl=function(){return window.glomexContext&&window.glomexContext.pageUrl?(0,r.default)(window.glomexContext.pageUrl):function(){try{return window.self!==window.top}catch(t){return!0}}()&&window.document.referrer?(0,r.default)(window.document.referrer):(0,r.default)(window.location.href)},t.handleConfigErrors=function(t){Object.keys(t).forEach(function(e){if(!t[e])throw new Error("config."+e+" not found, "+e+" must be provided")})}})?r.apply(e,o):r)||(t.exports=i)},function(t,e){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);t.exports=function(t,e){var r=e||0,o=n;return o[t[r++]]+o[t[r++]]+o[t[r++]]+o[t[r++]]+"-"+o[t[r++]]+o[t[r++]]+"-"+o[t[r++]]+o[t[r++]]+"-"+o[t[r++]]+o[t[r++]]+"-"+o[t[r++]]+o[t[r++]]+o[t[r++]]+o[t[r++]]+o[t[r++]]+o[t[r++]]}},function(t,e){var n="undefined"!=typeof crypto&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);t.exports=function(){return n(r),r}}else{var o=new Array(16);t.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),o[e]=t>>>((3&e)<<3)&255;return o}}},function(t,e,n){var r,o,i=n(4),u=n(3),c=0,s=0;t.exports=function(t,e,n){var a=e&&n||0,f=e||[],l=(t=t||{}).node||r,d=void 0!==t.clockseq?t.clockseq:o;if(null==l||null==d){var p=i();null==l&&(l=r=[1|p[0],p[1],p[2],p[3],p[4],p[5]]),null==d&&(d=o=16383&(p[6]<<8|p[7]))}var h=void 0!==t.msecs?t.msecs:(new Date).getTime(),v=void 0!==t.nsecs?t.nsecs:s+1,y=h-c+(v-s)/1e4;if(y<0&&void 0===t.clockseq&&(d=d+1&16383),(y<0||h>c)&&void 0===t.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=h,s=v,o=d;var g=(1e4*(268435455&(h+=122192928e5))+v)%4294967296;f[a++]=g>>>24&255,f[a++]=g>>>16&255,f[a++]=g>>>8&255,f[a++]=255&g;var m=h/4294967296*1e4&268435455;f[a++]=m>>>8&255,f[a++]=255&m,f[a++]=m>>>24&15|16,f[a++]=m>>>16&255,f[a++]=d>>>8|128,f[a++]=255&d;for(var w=0;w<6;++w)f[a+w]=l[w];return e||u(f)}},function(t,e,n){var r,o,i;o=[e,n(5),n(2)],void 0===(i="function"==typeof(r=function(t,e,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=(r=e)&&r.__esModule?r:{default:r},i={integrationId:null,contentId:null,pageUrl:(0,n.getPageUrl)().href,contentSessionId:(0,o.default)(),clientInfo:function(){try{return window.navigator.appVersion}catch(t){return"n/a"}}(),backendUrl:"https://integration-sdk-eu-west-1.mes.glomex.cloud/video"};t.default=function(t,e){return function(r){if(!r)throw new Error("No config found, config object must be provided");var o=Object.assign({},i,r);(0,n.handleConfigErrors)(o);var u=e(o);return new t(u)}}})?r.apply(e,o):r)||(t.exports=i)},function(t,e,n){var r,o,i;o=[e],void 0===(i="function"==typeof(r=function(t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t){return{getSources:function(){return t.getVideoSources()},trackContentBegin:function(){return t.trackEvent("contentBegin")},trackAdBegin:function(e){return t.trackEvent("adBegin",e)}}}})?r.apply(e,o):r)||(t.exports=i)},function(t,e){var n,r,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function c(t){if(n===setTimeout)return setTimeout(t,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(t){n=i}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(t){r=u}}();var s,a=[],f=!1,l=-1;function d(){f&&s&&(f=!1,s.length?a=s.concat(a):l=-1,a.length&&p())}function p(){if(!f){var t=c(d);f=!0;for(var e=a.length;e;){for(s=a,a=[];++l<e;)s&&s[l].run();l=-1,e=a.length}s=null,f=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function h(t,e){this.fun=t,this.array=e}function v(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];a.push(new h(t,e)),1!==a.length||f||c(p)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e,n){(function(e,n){
/*!
* @overview es6-promise - a tiny implementation of Promises/A+.
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
* @license Licensed under MIT license
* See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
* @version v4.2.4+314e4831
*/var r;r=function(){"use strict";function t(t){return"function"==typeof t}var r=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},o=0,i=void 0,u=void 0,c=function(t,e){h[o]=t,h[o+1]=e,2===(o+=2)&&(u?u(v):b())};var s="undefined"!=typeof window?window:void 0,a=s||{},f=a.MutationObserver||a.WebKitMutationObserver,l="undefined"==typeof self&&void 0!==e&&"[object process]"==={}.toString.call(e),d="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function p(){var t=setTimeout;return function(){return t(v,1)}}var h=new Array(1e3);function v(){for(var t=0;t<o;t+=2){(0,h[t])(h[t+1]),h[t]=void 0,h[t+1]=void 0}o=0}var y,g,m,w,b=void 0;function _(t,e){var n=this,r=new this.constructor(E);void 0===r[x]&&F(r);var o=n._state;if(o){var i=arguments[o-1];c(function(){return I(o,r,i,n._result)})}else q(n,r,t,e);return r}function j(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=new this(E);return R(e,t),e}l?b=function(){return e.nextTick(v)}:f?(g=0,m=new f(v),w=document.createTextNode(""),m.observe(w,{characterData:!0}),b=function(){w.data=g=++g%2}):d?((y=new MessageChannel).port1.onmessage=v,b=function(){return y.port2.postMessage(0)}):b=void 0===s?function(){try{var t=Function("return this")().require("vertx");return void 0!==(i=t.runOnLoop||t.runOnContext)?function(){i(v)}:p()}catch(t){return p()}}():p();var x=Math.random().toString(36).substring(2);function E(){}var O=void 0,T=1,S=2,k={error:null};function A(t){try{return t.then}catch(t){return k.error=t,k}}function C(e,n,r){n.constructor===e.constructor&&r===_&&n.constructor.resolve===j?function(t,e){e._state===T?P(t,e._result):e._state===S?U(t,e._result):q(e,void 0,function(e){return R(t,e)},function(e){return U(t,e)})}(e,n):r===k?(U(e,k.error),k.error=null):void 0===r?P(e,n):t(r)?function(t,e,n){c(function(t){var r=!1,o=function(t,e,n,r){try{t.call(e,n,r)}catch(t){return t}}(n,e,function(n){r||(r=!0,e!==n?R(t,n):P(t,n))},function(e){r||(r=!0,U(t,e))},t._label);!r&&o&&(r=!0,U(t,o))},t)}(e,n,r):P(e,n)}function R(t,e){var n,r;t===e?U(t,new TypeError("You cannot resolve a promise with itself")):(r=typeof(n=e),null===n||"object"!==r&&"function"!==r?P(t,e):C(t,e,A(e)))}function M(t){t._onerror&&t._onerror(t._result),X(t)}function P(t,e){t._state===O&&(t._result=e,t._state=T,0!==t._subscribers.length&&c(X,t))}function U(t,e){t._state===O&&(t._state=S,t._result=e,c(M,t))}function q(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+T]=n,o[i+S]=r,0===i&&t._state&&c(X,t)}function X(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,o=void 0,i=t._result,u=0;u<e.length;u+=3)r=e[u],o=e[u+n],r?I(n,r,o,i):o(i);t._subscribers.length=0}}function I(e,n,r,o){var i=t(r),u=void 0,c=void 0,s=void 0,a=void 0;if(i){if((u=function(t,e){try{return t(e)}catch(t){return k.error=t,k}}(r,o))===k?(a=!0,c=u.error,u.error=null):s=!0,n===u)return void U(n,new TypeError("A promises callback cannot return that same promise."))}else u=o,s=!0;n._state!==O||(i&&s?R(n,u):a?U(n,c):e===T?P(n,u):e===S&&U(n,u))}var L=0;function F(t){t[x]=L++,t._state=void 0,t._result=void 0,t._subscribers=[]}var H=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(E),this.promise[x]||F(this.promise),r(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?P(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&P(this.promise,this._result))):U(this.promise,new Error("Array Methods must be provided an Array"))}return t.prototype._enumerate=function(t){for(var e=0;this._state===O&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===j){var o=A(t);if(o===_&&t._state!==O)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(n===D){var i=new n(E);C(i,t,o),this._willSettleAt(i,e)}else this._willSettleAt(new n(function(e){return e(t)}),e)}else this._willSettleAt(r(t),e)},t.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===O&&(this._remaining--,t===S?U(r,n):this._result[e]=n),0===this._remaining&&P(r,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;q(t,void 0,function(t){return n._settledAt(T,e,t)},function(t){return n._settledAt(S,e,t)})},t}();var D=function(){function t(e){this[x]=L++,this._result=this._state=void 0,this._subscribers=[],E!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof t?function(t,e){try{e(function(e){R(t,e)},function(e){U(t,e)})}catch(e){U(t,e)}}(this,e):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return t.prototype.catch=function(t){return this.then(null,t)},t.prototype.finally=function(t){var e=this.constructor;return this.then(function(n){return e.resolve(t()).then(function(){return n})},function(n){return e.resolve(t()).then(function(){throw n})})},t}();return D.prototype.then=_,D.all=function(t){return new H(this,t).promise},D.race=function(t){var e=this;return r(t)?new e(function(n,r){for(var o=t.length,i=0;i<o;i++)e.resolve(t[i]).then(n,r)}):new e(function(t,e){return e(new TypeError("You must pass an array to race."))})},D.resolve=j,D.reject=function(t){var e=new this(E);return U(e,t),e},D._setScheduler=function(t){u=t},D._setAsap=function(t){c=t},D._asap=c,D.polyfill=function(){var t=void 0;if(void 0!==n)t=n;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var r=null;try{r=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===r&&!e.cast)return}t.Promise=D},D.Promise=D,D},t.exports=r()}).call(this,n(8),n(0))},function(t,e,n){"use strict";var r=new RegExp("%[a-f0-9]{2}","gi"),o=new RegExp("(%[a-f0-9]{2})+","gi");function i(t,e){try{return decodeURIComponent(t.join(""))}catch(t){}if(1===t.length)return t;e=e||1;var n=t.slice(0,e),r=t.slice(e);return Array.prototype.concat.call([],i(n),i(r))}function u(t){try{return decodeURIComponent(t)}catch(o){for(var e=t.match(r),n=1;n<e.length;n++)e=(t=i(e,n).join("")).match(r);return t}}t.exports=function(t){if("string"!=typeof t)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch(e){return function(t){for(var e={"%FE%FF":"��","%FF%FE":"��"},n=o.exec(t);n;){try{e[n[0]]=decodeURIComponent(n[0])}catch(t){var r=u(n[0]);r!==n[0]&&(e[n[0]]=r)}n=o.exec(t)}e["%C2"]="�";for(var i=Object.keys(e),c=0;c<i.length;c++){var s=i[c];t=t.replace(new RegExp(s,"g"),e[s])}return t}(t)}}},function(t,e,n){"use strict";t.exports=(t=>encodeURIComponent(t).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`))},function(t,e,n){"use strict";const r=n(11),o=n(10);function i(t,e){return e.encode?e.strict?r(t):encodeURIComponent(t):t}function u(t,e){return e.decode?o(t):t}function c(t){const e=t.indexOf("?");return-1===e?"":t.slice(e+1)}function s(t,e){const n=function(t){let e;switch(t.arrayFormat){case"index":return(t,n,r)=>{e=/\[(\d*)\]$/.exec(t),t=t.replace(/\[\d*\]$/,""),e?(void 0===r[t]&&(r[t]={}),r[t][e[1]]=n):r[t]=n};case"bracket":return(t,n,r)=>{e=/(\[\])$/.exec(t),t=t.replace(/\[\]$/,""),e?void 0!==r[t]?r[t]=[].concat(r[t],n):r[t]=[n]:r[t]=n};default:return(t,e,n)=>{void 0!==n[t]?n[t]=[].concat(n[t],e):n[t]=e}}}(e=Object.assign({decode:!0,arrayFormat:"none"},e)),r=Object.create(null);if("string"!=typeof t)return r;if(!(t=t.trim().replace(/^[?#&]/,"")))return r;for(const o of t.split("&")){let[t,i]=o.replace(/\+/g," ").split("=");i=void 0===i?null:u(i,e),n(u(t,e),i,r)}return Object.keys(r).sort().reduce((t,e)=>{const n=r[e];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?t[e]=function t(e){return Array.isArray(e)?e.sort():"object"==typeof e?t(Object.keys(e)).sort((t,e)=>Number(t)-Number(e)).map(t=>e[t]):e}(n):t[e]=n,t},Object.create(null))}e.extract=c,e.parse=s,e.stringify=((t,e)=>{!1===(e=Object.assign({encode:!0,strict:!0,arrayFormat:"none"},e)).sort&&(e.sort=(()=>{}));const n=function(t){switch(t.arrayFormat){case"index":return(e,n,r)=>null===n?[i(e,t),"[",r,"]"].join(""):[i(e,t),"[",i(r,t),"]=",i(n,t)].join("");case"bracket":return(e,n)=>null===n?[i(e,t),"[]"].join(""):[i(e,t),"[]=",i(n,t)].join("");default:return(e,n)=>null===n?i(e,t):[i(e,t),"=",i(n,t)].join("")}}(e);return t?Object.keys(t).sort(e.sort).map(r=>{const o=t[r];if(void 0===o)return"";if(null===o)return i(r,e);if(Array.isArray(o)){const t=[];for(const e of o.slice())void 0!==e&&t.push(n(r,e,t.length));return t.join("&")}return i(r,e)+"="+i(o,e)}).filter(t=>t.length>0).join("&"):""}),e.parseUrl=((t,e)=>({url:t.split("?")[0]||"",query:s(c(t),e)}))},function(t,e,n){var r,o,i;o=[e,n(12),n(9)],void 0===(i="function"==typeof(r=function(t,e){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,r=(n=e)&&n.__esModule?n:{default:n},o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._xhr=e,this._defaultXhrOptions={method:"get",url:null,json:!0},this._config=Object.assign({},n),this._videoStored=null}return i(t,[{key:"getVideoSources",value:function(){var t=this;return new Promise(function(e,n){var r=t._createUrl(t._config);t._xhr.get({url:r,json:!0},function(r,o,i){t._handleGetVideoSources(r,o,i,e,n)})})}},{key:"_handleGetVideoSources",value:function(t,e,n,r,i){return t?i(t):n&&n.error?i(n.error):n?n.video&&n.video.source?(this._storeVideo(n.video),void r(o({},n.video.source))):i(new Error("Video sources are malformed")):i(new Error("Can't fetch video sources"))}},{key:"_createUrl",value:function(t){var e=t.integrationId,n=t.contentId,o=t.pageUrl,i={integration_id:e,content_id:n,page_url:o,sdk_type:"js"},u=r.default.stringify(i);return this._config.backendUrl+"?"+u}},{key:"trackEvent",value:function(t,e){if(!t)throw new Error("event for tracking was not specified, event must be provided");if(!this._videoStored.tracking[t])throw new Error("Something is wrong with "+t+" tracking endpoints.");if("adBegin"===t&&!e)throw new Error("adRollName not found, adRollName must be provided");var n=this._videoStored.tracking[t];return this._executeTrackingRequests(n,e)}},{key:"_executeTrackingRequests",value:function(t,e){var n=this,r=t.map(function(t){var r=t.method,o=t.url,i=t.payload,u=void 0===i?{}:i;if(!o)return new Promise(function(t,e){return e(new Error("url is not found, endpoint is malformed"))});var c=n._getTrackingXhrOptions(r,o,u,e);return new Promise(function(t,e){n._xhr(c,function(n,r,o){return n?e(n):200===r.statusCode?t(o):void 0})})});return Promise.all(r).catch(function(t){throw console.log(t),new Error("Service is unavailable. Please contact glomex tech support")})}},{key:"_getTrackingXhrOptions",value:function(t,e,n,i){var u=this._defaultXhrOptions,c="get"===t.toLowerCase(),s=this._config,a=s.contentSessionId,f=s.clientInfo,l=o({},n,i?{contentSessionId:a,clientInfo:f,adRollName:i}:{contentSessionId:a,clientInfo:f});if(c){var d=e+"&"+r.default.stringify(l);return o({},u,{url:d})}return o({},u,{method:"post",url:e,body:l})}},{key:"_storeVideo",value:function(t){this._videoStored=t}}]),t}();t.default=u})?r.apply(e,o):r)||(t.exports=i)},function(t,e){t.exports=function(){for(var t={},e=0;e<arguments.length;e++){var r=arguments[e];for(var o in r)n.call(r,o)&&(t[o]=r[o])}return t};var n=Object.prototype.hasOwnProperty},function(t,e,n){"use strict";var r=Function.prototype.toString,o=/^\s*class /,i=function(t){try{var e=r.call(t).replace(/\/\/.*\n/g,"").replace(/\/\*[.\s\S]*\*\//g,"").replace(/\n/gm," ").replace(/ {2}/g," ");return o.test(e)}catch(t){return!1}},u=Object.prototype.toString,c="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;t.exports=function(t){if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if(c)return function(t){try{return!i(t)&&(r.call(t),!0)}catch(t){return!1}}(t);if(i(t))return!1;var e=u.call(t);return"[object Function]"===e||"[object GeneratorFunction]"===e}},function(t,e,n){"use strict";var r=n(15),o=Object.prototype.toString,i=Object.prototype.hasOwnProperty;t.exports=function(t,e,n){if(!r(e))throw new TypeError("iterator must be a function");var u;arguments.length>=3&&(u=n),"[object Array]"===o.call(t)?function(t,e,n){for(var r=0,o=t.length;r<o;r++)i.call(t,r)&&(null==n?e(t[r],r,t):e.call(n,t[r],r,t))}(t,e,u):"string"==typeof t?function(t,e,n){for(var r=0,o=t.length;r<o;r++)null==n?e(t.charAt(r),r,t):e.call(n,t.charAt(r),r,t)}(t,e,u):function(t,e,n){for(var r in t)i.call(t,r)&&(null==n?e(t[r],r,t):e.call(n,t[r],r,t))}(t,e,u)}},function(t,e){(e=t.exports=function(t){return t.replace(/^\s*|\s*$/g,"")}).left=function(t){return t.replace(/^\s*/,"")},e.right=function(t){return t.replace(/\s*$/,"")}},function(t,e,n){var r=n(17),o=n(16);t.exports=function(t){if(!t)return{};var e={};return o(r(t).split("\n"),function(t){var n,o=t.indexOf(":"),i=r(t.slice(0,o)).toLowerCase(),u=r(t.slice(o+1));void 0===e[i]?e[i]=u:(n=e[i],"[object Array]"===Object.prototype.toString.call(n)?e[i].push(u):e[i]=[e[i],u])}),e}},function(t,e){t.exports=function(t){var e=n.call(t);return"[object Function]"===e||"function"==typeof t&&"[object RegExp]"!==e||"undefined"!=typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)};var n=Object.prototype.toString},function(t,e,n){(function(e){var n;n="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},t.exports=n}).call(this,n(0))},function(t,e,n){"use strict";var r=n(20),o=n(19),i=n(18),u=n(14);function c(t,e,n){var r=t;return o(e)?(n=e,"string"==typeof t&&(r={uri:t})):r=u(e,{uri:t}),r.callback=n,r}function s(t,e,n){return a(e=c(t,e,n))}function a(t){if(void 0===t.callback)throw new Error("callback argument missing");var e=!1,n=function(n,r,o){e||(e=!0,t.callback(n,r,o))};function r(t){return clearTimeout(f),t instanceof Error||(t=new Error(""+(t||"Unknown XMLHttpRequest Error"))),t.statusCode=0,n(t,g)}function o(){if(!c){var e;clearTimeout(f),e=t.useXDR&&void 0===a.status?200:1223===a.status?204:a.status;var r=g,o=null;return 0!==e?(r={body:function(){var t=void 0;if(t=a.response?a.response:a.responseText||function(t){try{if("document"===t.responseType)return t.responseXML;var e=t.responseXML&&"parsererror"===t.responseXML.documentElement.nodeName;if(""===t.responseType&&!e)return t.responseXML}catch(t){}return null}(a),y)try{t=JSON.parse(t)}catch(t){}return t}(),statusCode:e,method:d,headers:{},url:l,rawRequest:a},a.getAllResponseHeaders&&(r.headers=i(a.getAllResponseHeaders()))):o=new Error("Internal XMLHttpRequest Error"),n(o,r,r.body)}}var u,c,a=t.xhr||null;a||(a=t.cors||t.useXDR?new s.XDomainRequest:new s.XMLHttpRequest);var f,l=a.url=t.uri||t.url,d=a.method=t.method||"GET",p=t.body||t.data,h=a.headers=t.headers||{},v=!!t.sync,y=!1,g={body:void 0,headers:{},statusCode:0,method:d,url:l,rawRequest:a};if("json"in t&&!1!==t.json&&(y=!0,h.accept||h.Accept||(h.Accept="application/json"),"GET"!==d&&"HEAD"!==d&&(h["content-type"]||h["Content-Type"]||(h["Content-Type"]="application/json"),p=JSON.stringify(!0===t.json?p:t.json))),a.onreadystatechange=function(){4===a.readyState&&setTimeout(o,0)},a.onload=o,a.onerror=r,a.onprogress=function(){},a.onabort=function(){c=!0},a.ontimeout=r,a.open(d,l,!v,t.username,t.password),v||(a.withCredentials=!!t.withCredentials),!v&&t.timeout>0&&(f=setTimeout(function(){if(!c){c=!0,a.abort("timeout");var t=new Error("XMLHttpRequest timeout");t.code="ETIMEDOUT",r(t)}},t.timeout)),a.setRequestHeader)for(u in h)h.hasOwnProperty(u)&&a.setRequestHeader(u,h[u]);else if(t.headers&&!function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}(t.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(a.responseType=t.responseType),"beforeSend"in t&&"function"==typeof t.beforeSend&&t.beforeSend(a),a.send(p||null),a}t.exports=s,t.exports.default=s,s.XMLHttpRequest=r.XMLHttpRequest||function(){},s.XDomainRequest="withCredentials"in new s.XMLHttpRequest?s.XMLHttpRequest:r.XDomainRequest,function(t,e){for(var n=0;n<t.length;n++)e(t[n])}(["get","put","post","patch","head","delete"],function(t){s["delete"===t?"del":t]=function(e,n,r){return(n=c(e,n,r)).method=t.toUpperCase(),a(n)}})},function(t,e,n){var r,o,i;o=[t,n(21),n(13),n(7),n(6)],void 0===(i="function"==typeof(r=function(t,e,n,r,o){"use strict";var i=a(e),u=a(n),c=a(r),s=a(o);function a(t){return t&&t.__esModule?t:{default:t}}t.exports=(0,s.default)(c.default,function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return new(Function.prototype.bind.apply(u.default,[null].concat([i.default],e)))})})?r.apply(e,o):r)||(t.exports=i)}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.glomexContentSdk=t():e.glomexContentSdk=t()}("undefined"!=typeof self?self:this,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=17)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.getPageUrl=function(){try{return window.location.href}catch(e){return null}},t.getClientInfo=function(){try{return window.navigator.appVersion}catch(e){return"n/a"}},t.uniqueId=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.handleConfigErrors=function(e){Object.keys(e).forEach(function(t){if(!e[t])throw new Error("config."+t+" not found, "+t+" must be provided")})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1);t.default=function(e,t,n){var o=n.getPageUrl,i=n.getClientInfo,u=n.uniqueId;return function(n){var c={integrationId:null,contentId:null,pageUrl:o(),contentSessionId:u(),clientInfo:i(),backendUrl:"https://integration-sdk-eu-west-1.mes.glomex.cloud/video"};if(!n)throw new Error("No config found, config object must be provided");var a=Object.assign({},c,n);(0,r.handleConfigErrors)(a);var s=t(a);return e(s)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=function(e){return{getSources:function(){return e.getVideoSources()},trackContentBegin:function(){return e.trackEvent("contentBegin")},trackAdBegin:function(t){return e.trackEvent("adBegin",t)}}}},function(e,t,n){"use strict";var r=new RegExp("%[a-f0-9]{2}","gi"),o=new RegExp("(%[a-f0-9]{2})+","gi");function i(e,t){try{return decodeURIComponent(e.join(""))}catch(e){}if(1===e.length)return e;t=t||1;var n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],i(n),i(r))}function u(e){try{return decodeURIComponent(e)}catch(o){for(var t=e.match(r),n=1;n<t.length;n++)t=(e=i(t,n).join("")).match(r);return e}}e.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},n=o.exec(e);n;){try{t[n[0]]=decodeURIComponent(n[0])}catch(e){var r=u(n[0]);r!==n[0]&&(t[n[0]]=r)}n=o.exec(e)}t["%C2"]="�";for(var i=Object.keys(t),c=0;c<i.length;c++){var a=i[c];e=e.replace(new RegExp(a,"g"),t[a])}return e}(e)}}},function(e,t,n){"use strict";e.exports=(e=>encodeURIComponent(e).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`))},function(e,t,n){"use strict";const r=n(5),o=n(4);function i(e,t){return t.encode?t.strict?r(e):encodeURIComponent(e):e}function u(e,t){return t.decode?o(e):e}function c(e){const t=e.indexOf("?");return-1===t?"":e.slice(t+1)}function a(e,t){const n=function(e){let t;switch(e.arrayFormat){case"index":return(e,n,r)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===r[e]&&(r[e]={}),r[e][t[1]]=n):r[e]=n};case"bracket":return(e,n,r)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};default:return(e,t,n)=>{void 0!==n[e]?n[e]=[].concat(n[e],t):n[e]=t}}}(t=Object.assign({decode:!0,arrayFormat:"none"},t)),r=Object.create(null);if("string"!=typeof e)return r;if(!(e=e.trim().replace(/^[?#&]/,"")))return r;for(const o of e.split("&")){let[e,i]=o.replace(/\+/g," ").split("=");i=void 0===i?null:u(i,t),n(u(e,t),i,r)}return Object.keys(r).sort().reduce((e,t)=>{const n=r[t];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?e[t]=function e(t){return Array.isArray(t)?t.sort():"object"==typeof t?e(Object.keys(t)).sort((e,t)=>Number(e)-Number(t)).map(e=>t[e]):t}(n):e[t]=n,e},Object.create(null))}t.extract=c,t.parse=a,t.stringify=((e,t)=>{!1===(t=Object.assign({encode:!0,strict:!0,arrayFormat:"none"},t)).sort&&(t.sort=(()=>{}));const n=function(e){switch(e.arrayFormat){case"index":return(t,n,r)=>null===n?[i(t,e),"[",r,"]"].join(""):[i(t,e),"[",i(r,e),"]=",i(n,e)].join("");case"bracket":return(t,n)=>null===n?[i(t,e),"[]"].join(""):[i(t,e),"[]=",i(n,e)].join("");default:return(t,n)=>null===n?i(t,e):[i(t,e),"=",i(n,e)].join("")}}(t);return e?Object.keys(e).sort(t.sort).map(r=>{const o=e[r];if(void 0===o)return"";if(null===o)return i(r,t);if(Array.isArray(o)){const e=[];for(const t of o.slice())void 0!==t&&e.push(n(r,t,e.length));return e.join("&")}return i(r,t)+"="+i(o,t)}).filter(e=>e.length>0).join("&"):""}),t.parseUrl=((e,t)=>({url:e.split("?")[0]||"",query:a(c(e),t)}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(6),c=(r=u)&&r.__esModule?r:{default:r};var a=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._xhr=t,this._defaultXhrOptions={method:"get",url:null,json:!0},this._config=Object.assign({},n),this._videoStored=null}return i(e,[{key:"getVideoSources",value:function(){var e=this;return new Promise(function(t,n){var r=e._createUrl(e._config);e._xhr.get({url:r,json:!0},function(r,o,i){e._handleGetVideoSources(r,o,i,t,n)})})}},{key:"_handleGetVideoSources",value:function(e,t,n,r,i){return e?i(e):n&&n.error?i(n.error):n?n.video&&n.video.source?(this._storeVideo(n.video),void r(o({},n.video.source))):i(new Error("Video sources are malformed")):i(new Error("Can't fetch video sources"))}},{key:"_createUrl",value:function(e){var t={integration_id:e.integrationId,content_id:e.contentId,page_url:e.pageUrl,sdk_type:"js"},n=c.default.stringify(t);return this._config.backendUrl+"?"+n}},{key:"trackEvent",value:function(e,t){if(!e)throw new Error("event for tracking was not specified, event must be provided");if(!this._videoStored.tracking[e])throw new Error("Something is wrong with "+e+" tracking endpoints.");if("adBegin"===e&&!t)throw new Error("adRollName not found, adRollName must be provided");var n=this._videoStored.tracking[e];return this._executeTrackingRequests(n,t)}},{key:"_executeTrackingRequests",value:function(e,t){var n=this,r=e.map(function(e){var r=e.method,o=e.url,i=e.payload,u=void 0===i?{}:i;if(!o)return new Promise(function(e,t){return t(new Error("url is not found, endpoint is malformed"))});var c=n._getTrackingXhrOptions(r,o,u,t);return new Promise(function(e,t){n._xhr(c,function(n,r,o){return n?t(n):200===r.statusCode?e(o):void 0})})});return Promise.all(r).catch(function(e){throw console.log(e),new Error("Service is unavailable. Please contact glomex tech support")})}},{key:"_getTrackingXhrOptions",value:function(e,t,n,r){var i=this._defaultXhrOptions,u="get"===e.toLowerCase(),a=this._config,s=a.contentSessionId,f=a.clientInfo,l=o({},n,r?{contentSessionId:s,clientInfo:f,adRollName:r}:{contentSessionId:s,clientInfo:f});if(u){var d=t+"&"+c.default.stringify(l);return o({},i,{url:d})}return o({},i,{method:"post",url:t,body:l})}},{key:"_storeVideo",value:function(e){this._videoStored=e}}]),e}();t.default=a},function(e,t){e.exports=function(){for(var e={},t=0;t<arguments.length;t++){var r=arguments[t];for(var o in r)n.call(r,o)&&(e[o]=r[o])}return e};var n=Object.prototype.hasOwnProperty},function(e,t,n){"use strict";var r=Function.prototype.toString,o=/^\s*class /,i=function(e){try{var t=r.call(e).replace(/\/\/.*\n/g,"").replace(/\/\*[.\s\S]*\*\//g,"").replace(/\n/gm," ").replace(/ {2}/g," ");return o.test(t)}catch(e){return!1}},u=Object.prototype.toString,c="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;e.exports=function(e){if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if(c)return function(e){try{return!i(e)&&(r.call(e),!0)}catch(e){return!1}}(e);if(i(e))return!1;var t=u.call(e);return"[object Function]"===t||"[object GeneratorFunction]"===t}},function(e,t,n){"use strict";var r=n(9),o=Object.prototype.toString,i=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){if(!r(t))throw new TypeError("iterator must be a function");var u;arguments.length>=3&&(u=n),"[object Array]"===o.call(e)?function(e,t,n){for(var r=0,o=e.length;r<o;r++)i.call(e,r)&&(null==n?t(e[r],r,e):t.call(n,e[r],r,e))}(e,t,u):"string"==typeof e?function(e,t,n){for(var r=0,o=e.length;r<o;r++)null==n?t(e.charAt(r),r,e):t.call(n,e.charAt(r),r,e)}(e,t,u):function(e,t,n){for(var r in e)i.call(e,r)&&(null==n?t(e[r],r,e):t.call(n,e[r],r,e))}(e,t,u)}},function(e,t){(t=e.exports=function(e){return e.replace(/^\s*|\s*$/g,"")}).left=function(e){return e.replace(/^\s*/,"")},t.right=function(e){return e.replace(/\s*$/,"")}},function(e,t,n){var r=n(11),o=n(10);e.exports=function(e){if(!e)return{};var t={};return o(r(e).split("\n"),function(e){var n,o=e.indexOf(":"),i=r(e.slice(0,o)).toLowerCase(),u=r(e.slice(o+1));void 0===t[i]?t[i]=u:(n=t[i],"[object Array]"===Object.prototype.toString.call(n)?t[i].push(u):t[i]=[t[i],u])}),t}},function(e,t){e.exports=function(e){var t=n.call(e);return"[object Function]"===t||"function"==typeof e&&"[object RegExp]"!==t||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)};var n=Object.prototype.toString},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){(function(t){var n;n="undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{},e.exports=n}).call(this,n(14))},function(e,t,n){"use strict";var r=n(15),o=n(13),i=n(12),u=n(8);function c(e,t,n){var r=e;return o(t)?(n=t,"string"==typeof e&&(r={uri:e})):r=u(t,{uri:e}),r.callback=n,r}function a(e,t,n){return s(t=c(e,t,n))}function s(e){if(void 0===e.callback)throw new Error("callback argument missing");var t=!1,n=function(n,r,o){t||(t=!0,e.callback(n,r,o))};function r(e){return clearTimeout(f),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,n(e,h)}function o(){if(!c){var t;clearTimeout(f),t=e.useXDR&&void 0===s.status?200:1223===s.status?204:s.status;var r=h,o=null;return 0!==t?(r={body:function(){var e=void 0;if(e=s.response?s.response:s.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}(s),v)try{e=JSON.parse(e)}catch(e){}return e}(),statusCode:t,method:d,headers:{},url:l,rawRequest:s},s.getAllResponseHeaders&&(r.headers=i(s.getAllResponseHeaders()))):o=new Error("Internal XMLHttpRequest Error"),n(o,r,r.body)}}var u,c,s=e.xhr||null;s||(s=e.cors||e.useXDR?new a.XDomainRequest:new a.XMLHttpRequest);var f,l=s.url=e.uri||e.url,d=s.method=e.method||"GET",p=e.body||e.data,y=s.headers=e.headers||{},g=!!e.sync,v=!1,h={body:void 0,headers:{},statusCode:0,method:d,url:l,rawRequest:s};if("json"in e&&!1!==e.json&&(v=!0,y.accept||y.Accept||(y.Accept="application/json"),"GET"!==d&&"HEAD"!==d&&(y["content-type"]||y["Content-Type"]||(y["Content-Type"]="application/json"),p=JSON.stringify(!0===e.json?p:e.json))),s.onreadystatechange=function(){4===s.readyState&&setTimeout(o,0)},s.onload=o,s.onerror=r,s.onprogress=function(){},s.onabort=function(){c=!0},s.ontimeout=r,s.open(d,l,!g,e.username,e.password),g||(s.withCredentials=!!e.withCredentials),!g&&e.timeout>0&&(f=setTimeout(function(){if(!c){c=!0,s.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",r(e)}},e.timeout)),s.setRequestHeader)for(u in y)y.hasOwnProperty(u)&&s.setRequestHeader(u,y[u]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(s.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(s),s.send(p||null),s}e.exports=a,e.exports.default=a,a.XMLHttpRequest=r.XMLHttpRequest||function(){},a.XDomainRequest="withCredentials"in new a.XMLHttpRequest?a.XMLHttpRequest:r.XDomainRequest,function(e,t){for(var n=0;n<e.length;n++)t(e[n])}(["get","put","post","patch","head","delete"],function(e){a["delete"===e?"del":e]=function(t,n,r){return(n=c(t,n,r)).method=e.toUpperCase(),s(n)}})},function(e,t,n){"use strict";var r=a(n(16)),o=a(n(7)),i=a(n(3)),u=a(n(2)),c=n(0);function a(e){return e&&e.__esModule?e:{default:e}}e.exports=(0,u.default)(i.default,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return new(Function.prototype.bind.apply(o.default,[null].concat([r.default],t)))},{getPageUrl:c.getPageUrl,getClientInfo:c.getClientInfo,uniqueId:c.uniqueId})}])});
//# sourceMappingURL=glomex.content-sdk.js.map

@@ -1,2 +0,2 @@

!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([,function(e,t,n){var r,o,i;o=[],void 0===(i="function"==typeof(r=function(){"use strict";!function(e,t){t.createOwnVideoPlayer||(t.createOwnVideoPlayer=function(t){var n=e.getElementById("example-container");n||(n=e.createElement("div"),e.getElementsByTagName("body")[0].appendChild(n));var r=e.createElement("video"),o=e.createElement("source");return o.type="video/mp4",o.src=t.progressive,r.appendChild(o),r.autoplay=!1,r.setAttribute("width","640"),r.setAttribute("height","480"),r.controls=!0,n.appendChild(r),r})}(document,window)})?r.apply(t,o):r)||(e.exports=i)}]);
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}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 o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));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=0)}([function(e,t,r){"use strict";!function(e,t){t.createOwnVideoPlayer||(t.createOwnVideoPlayer=function(t){var r=e.getElementById("example-container");r||(r=e.createElement("div"),e.getElementsByTagName("body")[0].appendChild(r));var n=e.createElement("video"),o=e.createElement("source");return o.type="video/mp4",o.src=t.progressive,n.appendChild(o),n.autoplay=!1,n.setAttribute("width","640"),n.setAttribute("height","480"),n.controls=!0,r.appendChild(n),n})}(document,window)}]);
//# sourceMappingURL=create-video-player.js.map

@@ -1,16 +0,2 @@

!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=24)}([function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},,function(t,e,n){
/**
* lite-url - Small, JS lib that uses regex for parsing a URL into it's component parts.
* @version v1.0.5
* @link https://github.com/sadams/lite-url
* @license BSD-3-Clause
*/
(function(){"use strict";function n(t,e,n){var r=t.split(e);return n(r.shift(),r.join(e))}function r(t){var e={hash:"",host:"",hostname:"",origin:"",pathname:"",protocol:"",search:"",password:"",username:"",port:""};return n(t,"#",function(t,r){r&&(e.hash=r?"#"+r:""),n(t,"?",function(t,r){r&&(e.search="?"+r),t&&n(t,"//",function(t,r){e.protocol=t,n(r,"/",function(t,r){e.pathname="/"+(r||""),(e.protocol||t)&&(e.origin=e.protocol+"//"+t),n(t,"@",function(t,r){if(r){var o=t.split(":");e.username=o[0],e.password=o[1]}else r=t;e.host=r,n(r,":",function(t,n){e.hostname=t,n&&(e.port=n)})})})})})}),e.href=e.origin+e.pathname+e.search+e.hash,e}function o(t){var e={},n=t.search;if(n){var r=(n=n.replace(new RegExp("\\?"),"")).split("&");for(var o in r)if(r.hasOwnProperty(o)&&r[o]){var i=r[o].split("=");e[i[0]]=i[1]}}return e}function i(t){var e=u[t];return void 0!==e?e:((e=r(t)).params=o(e),u[t]=e,e)}var u={};return i.changeQueryParser=function(t){o=t},void 0!==t&&t.exports&&(e=t.exports=i),e.liteURL=i,i}).call(this)},function(t,e,n){var r,o,i;o=[e,n(2)],void 0===(i="function"==typeof(r=function(t,e){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.handleConfigErrors=t.getPageUrl=void 0;var n,r=(n=e)&&n.__esModule?n:{default:n};t.getPageUrl=function(){return window.glomexContext&&window.glomexContext.pageUrl?(0,r.default)(window.glomexContext.pageUrl):function(){try{return window.self!==window.top}catch(t){return!0}}()&&window.document.referrer?(0,r.default)(window.document.referrer):(0,r.default)(window.location.href)},t.handleConfigErrors=function(t){Object.keys(t).forEach(function(e){if(!t[e])throw new Error("config."+e+" not found, "+e+" must be provided")})}})?r.apply(e,o):r)||(t.exports=i)},function(t,e){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);t.exports=function(t,e){var r=e||0,o=n;return o[t[r++]]+o[t[r++]]+o[t[r++]]+o[t[r++]]+"-"+o[t[r++]]+o[t[r++]]+"-"+o[t[r++]]+o[t[r++]]+"-"+o[t[r++]]+o[t[r++]]+"-"+o[t[r++]]+o[t[r++]]+o[t[r++]]+o[t[r++]]+o[t[r++]]+o[t[r++]]}},function(t,e){var n="undefined"!=typeof crypto&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);t.exports=function(){return n(r),r}}else{var o=new Array(16);t.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),o[e]=t>>>((3&e)<<3)&255;return o}}},function(t,e,n){var r,o,i=n(5),u=n(4),c=0,s=0;t.exports=function(t,e,n){var a=e&&n||0,f=e||[],l=(t=t||{}).node||r,d=void 0!==t.clockseq?t.clockseq:o;if(null==l||null==d){var p=i();null==l&&(l=r=[1|p[0],p[1],p[2],p[3],p[4],p[5]]),null==d&&(d=o=16383&(p[6]<<8|p[7]))}var h=void 0!==t.msecs?t.msecs:(new Date).getTime(),v=void 0!==t.nsecs?t.nsecs:s+1,y=h-c+(v-s)/1e4;if(y<0&&void 0===t.clockseq&&(d=d+1&16383),(y<0||h>c)&&void 0===t.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=h,s=v,o=d;var g=(1e4*(268435455&(h+=122192928e5))+v)%4294967296;f[a++]=g>>>24&255,f[a++]=g>>>16&255,f[a++]=g>>>8&255,f[a++]=255&g;var m=h/4294967296*1e4&268435455;f[a++]=m>>>8&255,f[a++]=255&m,f[a++]=m>>>24&15|16,f[a++]=m>>>16&255,f[a++]=d>>>8|128,f[a++]=255&d;for(var w=0;w<6;++w)f[a+w]=l[w];return e||u(f)}},function(t,e,n){var r,o,i;o=[e,n(6),n(3)],void 0===(i="function"==typeof(r=function(t,e,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=(r=e)&&r.__esModule?r:{default:r},i={integrationId:null,contentId:null,pageUrl:(0,n.getPageUrl)().href,contentSessionId:(0,o.default)(),clientInfo:function(){try{return window.navigator.appVersion}catch(t){return"n/a"}}(),backendUrl:"https://integration-sdk-eu-west-1.mes.glomex.cloud/video"};t.default=function(t,e){return function(r){if(!r)throw new Error("No config found, config object must be provided");var o=Object.assign({},i,r);(0,n.handleConfigErrors)(o);var u=e(o);return new t(u)}}})?r.apply(e,o):r)||(t.exports=i)},function(t,e,n){var r,o,i;o=[e],void 0===(i="function"==typeof(r=function(t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t){return{getSources:function(){return t.getVideoSources()},trackContentBegin:function(){return t.trackEvent("contentBegin")},trackAdBegin:function(e){return t.trackEvent("adBegin",e)}}}})?r.apply(e,o):r)||(t.exports=i)},function(t,e){var n,r,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function c(t){if(n===setTimeout)return setTimeout(t,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(t){n=i}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(t){r=u}}();var s,a=[],f=!1,l=-1;function d(){f&&s&&(f=!1,s.length?a=s.concat(a):l=-1,a.length&&p())}function p(){if(!f){var t=c(d);f=!0;for(var e=a.length;e;){for(s=a,a=[];++l<e;)s&&s[l].run();l=-1,e=a.length}s=null,f=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function h(t,e){this.fun=t,this.array=e}function v(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];a.push(new h(t,e)),1!==a.length||f||c(p)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e,n){(function(e,n){
/*!
* @overview es6-promise - a tiny implementation of Promises/A+.
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
* @license Licensed under MIT license
* See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
* @version v4.2.4+314e4831
*/var r;r=function(){"use strict";function t(t){return"function"==typeof t}var r=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},o=0,i=void 0,u=void 0,c=function(t,e){h[o]=t,h[o+1]=e,2===(o+=2)&&(u?u(v):b())};var s="undefined"!=typeof window?window:void 0,a=s||{},f=a.MutationObserver||a.WebKitMutationObserver,l="undefined"==typeof self&&void 0!==e&&"[object process]"==={}.toString.call(e),d="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function p(){var t=setTimeout;return function(){return t(v,1)}}var h=new Array(1e3);function v(){for(var t=0;t<o;t+=2){(0,h[t])(h[t+1]),h[t]=void 0,h[t+1]=void 0}o=0}var y,g,m,w,b=void 0;function _(t,e){var n=this,r=new this.constructor(E);void 0===r[x]&&F(r);var o=n._state;if(o){var i=arguments[o-1];c(function(){return U(o,r,i,n._result)})}else q(n,r,t,e);return r}function j(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=new this(E);return R(e,t),e}l?b=function(){return e.nextTick(v)}:f?(g=0,m=new f(v),w=document.createTextNode(""),m.observe(w,{characterData:!0}),b=function(){w.data=g=++g%2}):d?((y=new MessageChannel).port1.onmessage=v,b=function(){return y.port2.postMessage(0)}):b=void 0===s?function(){try{var t=Function("return this")().require("vertx");return void 0!==(i=t.runOnLoop||t.runOnContext)?function(){i(v)}:p()}catch(t){return p()}}():p();var x=Math.random().toString(36).substring(2);function E(){}var k=void 0,O=1,T=2,S={error:null};function A(t){try{return t.then}catch(t){return S.error=t,S}}function C(e,n,r){n.constructor===e.constructor&&r===_&&n.constructor.resolve===j?function(t,e){e._state===O?P(t,e._result):e._state===T?I(t,e._result):q(e,void 0,function(e){return R(t,e)},function(e){return I(t,e)})}(e,n):r===S?(I(e,S.error),S.error=null):void 0===r?P(e,n):t(r)?function(t,e,n){c(function(t){var r=!1,o=function(t,e,n,r){try{t.call(e,n,r)}catch(t){return t}}(n,e,function(n){r||(r=!0,e!==n?R(t,n):P(t,n))},function(e){r||(r=!0,I(t,e))},t._label);!r&&o&&(r=!0,I(t,o))},t)}(e,n,r):P(e,n)}function R(t,e){var n,r;t===e?I(t,new TypeError("You cannot resolve a promise with itself")):(r=typeof(n=e),null===n||"object"!==r&&"function"!==r?P(t,e):C(t,e,A(e)))}function M(t){t._onerror&&t._onerror(t._result),L(t)}function P(t,e){t._state===k&&(t._result=e,t._state=O,0!==t._subscribers.length&&c(L,t))}function I(t,e){t._state===k&&(t._state=T,t._result=e,c(M,t))}function q(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+O]=n,o[i+T]=r,0===i&&t._state&&c(L,t)}function L(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,o=void 0,i=t._result,u=0;u<e.length;u+=3)r=e[u],o=e[u+n],r?U(n,r,o,i):o(i);t._subscribers.length=0}}function U(e,n,r,o){var i=t(r),u=void 0,c=void 0,s=void 0,a=void 0;if(i){if((u=function(t,e){try{return t(e)}catch(t){return S.error=t,S}}(r,o))===S?(a=!0,c=u.error,u.error=null):s=!0,n===u)return void I(n,new TypeError("A promises callback cannot return that same promise."))}else u=o,s=!0;n._state!==k||(i&&s?R(n,u):a?I(n,c):e===O?P(n,u):e===T&&I(n,u))}var X=0;function F(t){t[x]=X++,t._state=void 0,t._result=void 0,t._subscribers=[]}var H=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(E),this.promise[x]||F(this.promise),r(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?P(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&P(this.promise,this._result))):I(this.promise,new Error("Array Methods must be provided an Array"))}return t.prototype._enumerate=function(t){for(var e=0;this._state===k&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===j){var o=A(t);if(o===_&&t._state!==k)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(n===N){var i=new n(E);C(i,t,o),this._willSettleAt(i,e)}else this._willSettleAt(new n(function(e){return e(t)}),e)}else this._willSettleAt(r(t),e)},t.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===k&&(this._remaining--,t===T?I(r,n):this._result[e]=n),0===this._remaining&&P(r,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;q(t,void 0,function(t){return n._settledAt(O,e,t)},function(t){return n._settledAt(T,e,t)})},t}();var N=function(){function t(e){this[x]=X++,this._result=this._state=void 0,this._subscribers=[],E!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof t?function(t,e){try{e(function(e){R(t,e)},function(e){I(t,e)})}catch(e){I(t,e)}}(this,e):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return t.prototype.catch=function(t){return this.then(null,t)},t.prototype.finally=function(t){var e=this.constructor;return this.then(function(n){return e.resolve(t()).then(function(){return n})},function(n){return e.resolve(t()).then(function(){throw n})})},t}();return N.prototype.then=_,N.all=function(t){return new H(this,t).promise},N.race=function(t){var e=this;return r(t)?new e(function(n,r){for(var o=t.length,i=0;i<o;i++)e.resolve(t[i]).then(n,r)}):new e(function(t,e){return e(new TypeError("You must pass an array to race."))})},N.resolve=j,N.reject=function(t){var e=new this(E);return I(e,t),e},N._setScheduler=function(t){u=t},N._setAsap=function(t){c=t},N._asap=c,N.polyfill=function(){var t=void 0;if(void 0!==n)t=n;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var r=null;try{r=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===r&&!e.cast)return}t.Promise=N},N.Promise=N,N},t.exports=r()}).call(this,n(9),n(0))},function(t,e,n){"use strict";var r=new RegExp("%[a-f0-9]{2}","gi"),o=new RegExp("(%[a-f0-9]{2})+","gi");function i(t,e){try{return decodeURIComponent(t.join(""))}catch(t){}if(1===t.length)return t;e=e||1;var n=t.slice(0,e),r=t.slice(e);return Array.prototype.concat.call([],i(n),i(r))}function u(t){try{return decodeURIComponent(t)}catch(o){for(var e=t.match(r),n=1;n<e.length;n++)e=(t=i(e,n).join("")).match(r);return t}}t.exports=function(t){if("string"!=typeof t)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch(e){return function(t){for(var e={"%FE%FF":"��","%FF%FE":"��"},n=o.exec(t);n;){try{e[n[0]]=decodeURIComponent(n[0])}catch(t){var r=u(n[0]);r!==n[0]&&(e[n[0]]=r)}n=o.exec(t)}e["%C2"]="�";for(var i=Object.keys(e),c=0;c<i.length;c++){var s=i[c];t=t.replace(new RegExp(s,"g"),e[s])}return t}(t)}}},function(t,e,n){"use strict";t.exports=(t=>encodeURIComponent(t).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`))},function(t,e,n){"use strict";const r=n(12),o=n(11);function i(t,e){return e.encode?e.strict?r(t):encodeURIComponent(t):t}function u(t,e){return e.decode?o(t):t}function c(t){const e=t.indexOf("?");return-1===e?"":t.slice(e+1)}function s(t,e){const n=function(t){let e;switch(t.arrayFormat){case"index":return(t,n,r)=>{e=/\[(\d*)\]$/.exec(t),t=t.replace(/\[\d*\]$/,""),e?(void 0===r[t]&&(r[t]={}),r[t][e[1]]=n):r[t]=n};case"bracket":return(t,n,r)=>{e=/(\[\])$/.exec(t),t=t.replace(/\[\]$/,""),e?void 0!==r[t]?r[t]=[].concat(r[t],n):r[t]=[n]:r[t]=n};default:return(t,e,n)=>{void 0!==n[t]?n[t]=[].concat(n[t],e):n[t]=e}}}(e=Object.assign({decode:!0,arrayFormat:"none"},e)),r=Object.create(null);if("string"!=typeof t)return r;if(!(t=t.trim().replace(/^[?#&]/,"")))return r;for(const o of t.split("&")){let[t,i]=o.replace(/\+/g," ").split("=");i=void 0===i?null:u(i,e),n(u(t,e),i,r)}return Object.keys(r).sort().reduce((t,e)=>{const n=r[e];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?t[e]=function t(e){return Array.isArray(e)?e.sort():"object"==typeof e?t(Object.keys(e)).sort((t,e)=>Number(t)-Number(e)).map(t=>e[t]):e}(n):t[e]=n,t},Object.create(null))}e.extract=c,e.parse=s,e.stringify=((t,e)=>{!1===(e=Object.assign({encode:!0,strict:!0,arrayFormat:"none"},e)).sort&&(e.sort=(()=>{}));const n=function(t){switch(t.arrayFormat){case"index":return(e,n,r)=>null===n?[i(e,t),"[",r,"]"].join(""):[i(e,t),"[",i(r,t),"]=",i(n,t)].join("");case"bracket":return(e,n)=>null===n?[i(e,t),"[]"].join(""):[i(e,t),"[]=",i(n,t)].join("");default:return(e,n)=>null===n?i(e,t):[i(e,t),"=",i(n,t)].join("")}}(e);return t?Object.keys(t).sort(e.sort).map(r=>{const o=t[r];if(void 0===o)return"";if(null===o)return i(r,e);if(Array.isArray(o)){const t=[];for(const e of o.slice())void 0!==e&&t.push(n(r,e,t.length));return t.join("&")}return i(r,e)+"="+i(o,e)}).filter(t=>t.length>0).join("&"):""}),e.parseUrl=((t,e)=>({url:t.split("?")[0]||"",query:s(c(t),e)}))},function(t,e,n){var r,o,i;o=[e,n(13),n(10)],void 0===(i="function"==typeof(r=function(t,e){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,r=(n=e)&&n.__esModule?n:{default:n},o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._xhr=e,this._defaultXhrOptions={method:"get",url:null,json:!0},this._config=Object.assign({},n),this._videoStored=null}return i(t,[{key:"getVideoSources",value:function(){var t=this;return new Promise(function(e,n){var r=t._createUrl(t._config);t._xhr.get({url:r,json:!0},function(r,o,i){t._handleGetVideoSources(r,o,i,e,n)})})}},{key:"_handleGetVideoSources",value:function(t,e,n,r,i){return t?i(t):n&&n.error?i(n.error):n?n.video&&n.video.source?(this._storeVideo(n.video),void r(o({},n.video.source))):i(new Error("Video sources are malformed")):i(new Error("Can't fetch video sources"))}},{key:"_createUrl",value:function(t){var e=t.integrationId,n=t.contentId,o=t.pageUrl,i={integration_id:e,content_id:n,page_url:o,sdk_type:"js"},u=r.default.stringify(i);return this._config.backendUrl+"?"+u}},{key:"trackEvent",value:function(t,e){if(!t)throw new Error("event for tracking was not specified, event must be provided");if(!this._videoStored.tracking[t])throw new Error("Something is wrong with "+t+" tracking endpoints.");if("adBegin"===t&&!e)throw new Error("adRollName not found, adRollName must be provided");var n=this._videoStored.tracking[t];return this._executeTrackingRequests(n,e)}},{key:"_executeTrackingRequests",value:function(t,e){var n=this,r=t.map(function(t){var r=t.method,o=t.url,i=t.payload,u=void 0===i?{}:i;if(!o)return new Promise(function(t,e){return e(new Error("url is not found, endpoint is malformed"))});var c=n._getTrackingXhrOptions(r,o,u,e);return new Promise(function(t,e){n._xhr(c,function(n,r,o){return n?e(n):200===r.statusCode?t(o):void 0})})});return Promise.all(r).catch(function(t){throw console.log(t),new Error("Service is unavailable. Please contact glomex tech support")})}},{key:"_getTrackingXhrOptions",value:function(t,e,n,i){var u=this._defaultXhrOptions,c="get"===t.toLowerCase(),s=this._config,a=s.contentSessionId,f=s.clientInfo,l=o({},n,i?{contentSessionId:a,clientInfo:f,adRollName:i}:{contentSessionId:a,clientInfo:f});if(c){var d=e+"&"+r.default.stringify(l);return o({},u,{url:d})}return o({},u,{method:"post",url:e,body:l})}},{key:"_storeVideo",value:function(t){this._videoStored=t}}]),t}();t.default=u})?r.apply(e,o):r)||(t.exports=i)},function(t,e){t.exports=function(){for(var t={},e=0;e<arguments.length;e++){var r=arguments[e];for(var o in r)n.call(r,o)&&(t[o]=r[o])}return t};var n=Object.prototype.hasOwnProperty},function(t,e,n){"use strict";var r=Function.prototype.toString,o=/^\s*class /,i=function(t){try{var e=r.call(t).replace(/\/\/.*\n/g,"").replace(/\/\*[.\s\S]*\*\//g,"").replace(/\n/gm," ").replace(/ {2}/g," ");return o.test(e)}catch(t){return!1}},u=Object.prototype.toString,c="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;t.exports=function(t){if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if(c)return function(t){try{return!i(t)&&(r.call(t),!0)}catch(t){return!1}}(t);if(i(t))return!1;var e=u.call(t);return"[object Function]"===e||"[object GeneratorFunction]"===e}},function(t,e,n){"use strict";var r=n(16),o=Object.prototype.toString,i=Object.prototype.hasOwnProperty;t.exports=function(t,e,n){if(!r(e))throw new TypeError("iterator must be a function");var u;arguments.length>=3&&(u=n),"[object Array]"===o.call(t)?function(t,e,n){for(var r=0,o=t.length;r<o;r++)i.call(t,r)&&(null==n?e(t[r],r,t):e.call(n,t[r],r,t))}(t,e,u):"string"==typeof t?function(t,e,n){for(var r=0,o=t.length;r<o;r++)null==n?e(t.charAt(r),r,t):e.call(n,t.charAt(r),r,t)}(t,e,u):function(t,e,n){for(var r in t)i.call(t,r)&&(null==n?e(t[r],r,t):e.call(n,t[r],r,t))}(t,e,u)}},function(t,e){(e=t.exports=function(t){return t.replace(/^\s*|\s*$/g,"")}).left=function(t){return t.replace(/^\s*/,"")},e.right=function(t){return t.replace(/\s*$/,"")}},function(t,e,n){var r=n(18),o=n(17);t.exports=function(t){if(!t)return{};var e={};return o(r(t).split("\n"),function(t){var n,o=t.indexOf(":"),i=r(t.slice(0,o)).toLowerCase(),u=r(t.slice(o+1));void 0===e[i]?e[i]=u:(n=e[i],"[object Array]"===Object.prototype.toString.call(n)?e[i].push(u):e[i]=[e[i],u])}),e}},function(t,e){t.exports=function(t){var e=n.call(t);return"[object Function]"===e||"function"==typeof t&&"[object RegExp]"!==e||"undefined"!=typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)};var n=Object.prototype.toString},function(t,e,n){(function(e){var n;n="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},t.exports=n}).call(this,n(0))},function(t,e,n){"use strict";var r=n(21),o=n(20),i=n(19),u=n(15);function c(t,e,n){var r=t;return o(e)?(n=e,"string"==typeof t&&(r={uri:t})):r=u(e,{uri:t}),r.callback=n,r}function s(t,e,n){return a(e=c(t,e,n))}function a(t){if(void 0===t.callback)throw new Error("callback argument missing");var e=!1,n=function(n,r,o){e||(e=!0,t.callback(n,r,o))};function r(t){return clearTimeout(f),t instanceof Error||(t=new Error(""+(t||"Unknown XMLHttpRequest Error"))),t.statusCode=0,n(t,g)}function o(){if(!c){var e;clearTimeout(f),e=t.useXDR&&void 0===a.status?200:1223===a.status?204:a.status;var r=g,o=null;return 0!==e?(r={body:function(){var t=void 0;if(t=a.response?a.response:a.responseText||function(t){try{if("document"===t.responseType)return t.responseXML;var e=t.responseXML&&"parsererror"===t.responseXML.documentElement.nodeName;if(""===t.responseType&&!e)return t.responseXML}catch(t){}return null}(a),y)try{t=JSON.parse(t)}catch(t){}return t}(),statusCode:e,method:d,headers:{},url:l,rawRequest:a},a.getAllResponseHeaders&&(r.headers=i(a.getAllResponseHeaders()))):o=new Error("Internal XMLHttpRequest Error"),n(o,r,r.body)}}var u,c,a=t.xhr||null;a||(a=t.cors||t.useXDR?new s.XDomainRequest:new s.XMLHttpRequest);var f,l=a.url=t.uri||t.url,d=a.method=t.method||"GET",p=t.body||t.data,h=a.headers=t.headers||{},v=!!t.sync,y=!1,g={body:void 0,headers:{},statusCode:0,method:d,url:l,rawRequest:a};if("json"in t&&!1!==t.json&&(y=!0,h.accept||h.Accept||(h.Accept="application/json"),"GET"!==d&&"HEAD"!==d&&(h["content-type"]||h["Content-Type"]||(h["Content-Type"]="application/json"),p=JSON.stringify(!0===t.json?p:t.json))),a.onreadystatechange=function(){4===a.readyState&&setTimeout(o,0)},a.onload=o,a.onerror=r,a.onprogress=function(){},a.onabort=function(){c=!0},a.ontimeout=r,a.open(d,l,!v,t.username,t.password),v||(a.withCredentials=!!t.withCredentials),!v&&t.timeout>0&&(f=setTimeout(function(){if(!c){c=!0,a.abort("timeout");var t=new Error("XMLHttpRequest timeout");t.code="ETIMEDOUT",r(t)}},t.timeout)),a.setRequestHeader)for(u in h)h.hasOwnProperty(u)&&a.setRequestHeader(u,h[u]);else if(t.headers&&!function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}(t.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(a.responseType=t.responseType),"beforeSend"in t&&"function"==typeof t.beforeSend&&t.beforeSend(a),a.send(p||null),a}t.exports=s,t.exports.default=s,s.XMLHttpRequest=r.XMLHttpRequest||function(){},s.XDomainRequest="withCredentials"in new s.XMLHttpRequest?s.XMLHttpRequest:r.XDomainRequest,function(t,e){for(var n=0;n<t.length;n++)e(t[n])}(["get","put","post","patch","head","delete"],function(t){s["delete"===t?"del":t]=function(e,n,r){return(n=c(e,n,r)).method=t.toUpperCase(),a(n)}})},function(t,e,n){var r,o,i;o=[t,n(22),n(14),n(8),n(7)],void 0===(i="function"==typeof(r=function(t,e,n,r,o){"use strict";var i=a(e),u=a(n),c=a(r),s=a(o);function a(t){return t&&t.__esModule?t:{default:t}}t.exports=(0,s.default)(c.default,function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return new(Function.prototype.bind.apply(u.default,[null].concat([i.default],e)))})})?r.apply(e,o):r)||(t.exports=i)},function(t,e,n){var r,o,i;o=[n(23)],void 0===(i="function"==typeof(r=function(t){"use strict";var e=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}(t);!function(t,n,r){var o={integrationId:"[INTEGRATION_ID]",contentId:"[CONTENT_ID]"};!function(){var t=new e.default(o);t.getSources().then(function(e){var n=r.createOwnVideoPlayer(e);t.trackContentBegin(),n.addEventListener("loadeddata",function(){t.trackAdBegin("preroll")}),n.addEventListener("ended",function(){t.trackAdBegin("postroll")}),n.play()},function(t){console.error(t)})}();var i=t.querySelectorAll(".js-get-config"),u=t.querySelector(".js-get-sources-demo"),c=t.querySelector(".js-track-content-begin-demo"),s=t.querySelector(".js-track-ad-begin-demo"),a=g(),f=new e.default(a);function l(){y(),function(){if(n){var t=g();Object.keys(t).forEach(function(e){return n.setItem("glomex_sdk_"+e,t[e])})}}()}function d(){(f=new e.default(g())).getSources().then(function(){s.removeAttribute("disabled"),c.removeAttribute("disabled"),v("getSources()")}).catch(function(t){y(),console.error(t)})}function p(){f.trackContentBegin().then(function(){return v("trackContentBegin()")})}function h(){f.trackAdBegin("postroll").then(function(){return v("trackAdBegin('postroll')")})}function v(t){console.warn(t+" was performed, check network requests")}function y(){s.setAttribute("disabled",""),c.setAttribute("disabled","")}function g(){var t=i[0].value,e=i[1].value,n=i[2].value,r={integrationId:t,contentId:e};return n&&(r.pageUrl=n),Object.assign({},o,r)}Object.keys(g()).forEach(function(t,e){return function(t,e){var r=n.getItem("glomex_sdk_"+t);r&&(i[e].value=r)}(t,e)}),i.forEach(function(t){["change","keyup"].forEach(function(e){return t.addEventListener(e,l)})}),u.addEventListener("click",d),c.addEventListener("click",p),s.addEventListener("click",h)}(document,window.localStorage,window)})?r.apply(e,o):r)||(t.exports=i)}]);
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=19)}([,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.getPageUrl=function(){try{return window.location.href}catch(e){return null}},t.getClientInfo=function(){try{return window.navigator.appVersion}catch(e){return"n/a"}},t.uniqueId=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.handleConfigErrors=function(e){Object.keys(e).forEach(function(t){if(!e[t])throw new Error("config."+t+" not found, "+t+" must be provided")})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2);t.default=function(e,t,n){var o=n.getPageUrl,i=n.getClientInfo,u=n.uniqueId;return function(n){var c={integrationId:null,contentId:null,pageUrl:o(),contentSessionId:u(),clientInfo:i(),backendUrl:"https://integration-sdk-eu-west-1.mes.glomex.cloud/video"};if(!n)throw new Error("No config found, config object must be provided");var a=Object.assign({},c,n);(0,r.handleConfigErrors)(a);var s=t(a);return e(s)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=function(e){return{getSources:function(){return e.getVideoSources()},trackContentBegin:function(){return e.trackEvent("contentBegin")},trackAdBegin:function(t){return e.trackEvent("adBegin",t)}}}},function(e,t,n){"use strict";var r=new RegExp("%[a-f0-9]{2}","gi"),o=new RegExp("(%[a-f0-9]{2})+","gi");function i(e,t){try{return decodeURIComponent(e.join(""))}catch(e){}if(1===e.length)return e;t=t||1;var n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],i(n),i(r))}function u(e){try{return decodeURIComponent(e)}catch(o){for(var t=e.match(r),n=1;n<t.length;n++)t=(e=i(t,n).join("")).match(r);return e}}e.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},n=o.exec(e);n;){try{t[n[0]]=decodeURIComponent(n[0])}catch(e){var r=u(n[0]);r!==n[0]&&(t[n[0]]=r)}n=o.exec(e)}t["%C2"]="�";for(var i=Object.keys(t),c=0;c<i.length;c++){var a=i[c];e=e.replace(new RegExp(a,"g"),t[a])}return e}(e)}}},function(e,t,n){"use strict";e.exports=(e=>encodeURIComponent(e).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`))},function(e,t,n){"use strict";const r=n(6),o=n(5);function i(e,t){return t.encode?t.strict?r(e):encodeURIComponent(e):e}function u(e,t){return t.decode?o(e):e}function c(e){const t=e.indexOf("?");return-1===t?"":e.slice(t+1)}function a(e,t){const n=function(e){let t;switch(e.arrayFormat){case"index":return(e,n,r)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===r[e]&&(r[e]={}),r[e][t[1]]=n):r[e]=n};case"bracket":return(e,n,r)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};default:return(e,t,n)=>{void 0!==n[e]?n[e]=[].concat(n[e],t):n[e]=t}}}(t=Object.assign({decode:!0,arrayFormat:"none"},t)),r=Object.create(null);if("string"!=typeof e)return r;if(!(e=e.trim().replace(/^[?#&]/,"")))return r;for(const o of e.split("&")){let[e,i]=o.replace(/\+/g," ").split("=");i=void 0===i?null:u(i,t),n(u(e,t),i,r)}return Object.keys(r).sort().reduce((e,t)=>{const n=r[t];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?e[t]=function e(t){return Array.isArray(t)?t.sort():"object"==typeof t?e(Object.keys(t)).sort((e,t)=>Number(e)-Number(t)).map(e=>t[e]):t}(n):e[t]=n,e},Object.create(null))}t.extract=c,t.parse=a,t.stringify=((e,t)=>{!1===(t=Object.assign({encode:!0,strict:!0,arrayFormat:"none"},t)).sort&&(t.sort=(()=>{}));const n=function(e){switch(e.arrayFormat){case"index":return(t,n,r)=>null===n?[i(t,e),"[",r,"]"].join(""):[i(t,e),"[",i(r,e),"]=",i(n,e)].join("");case"bracket":return(t,n)=>null===n?[i(t,e),"[]"].join(""):[i(t,e),"[]=",i(n,e)].join("");default:return(t,n)=>null===n?i(t,e):[i(t,e),"=",i(n,e)].join("")}}(t);return e?Object.keys(e).sort(t.sort).map(r=>{const o=e[r];if(void 0===o)return"";if(null===o)return i(r,t);if(Array.isArray(o)){const e=[];for(const t of o.slice())void 0!==t&&e.push(n(r,t,e.length));return e.join("&")}return i(r,t)+"="+i(o,t)}).filter(e=>e.length>0).join("&"):""}),t.parseUrl=((e,t)=>({url:e.split("?")[0]||"",query:a(c(e),t)}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(7),c=(r=u)&&r.__esModule?r:{default:r};var a=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._xhr=t,this._defaultXhrOptions={method:"get",url:null,json:!0},this._config=Object.assign({},n),this._videoStored=null}return i(e,[{key:"getVideoSources",value:function(){var e=this;return new Promise(function(t,n){var r=e._createUrl(e._config);e._xhr.get({url:r,json:!0},function(r,o,i){e._handleGetVideoSources(r,o,i,t,n)})})}},{key:"_handleGetVideoSources",value:function(e,t,n,r,i){return e?i(e):n&&n.error?i(n.error):n?n.video&&n.video.source?(this._storeVideo(n.video),void r(o({},n.video.source))):i(new Error("Video sources are malformed")):i(new Error("Can't fetch video sources"))}},{key:"_createUrl",value:function(e){var t={integration_id:e.integrationId,content_id:e.contentId,page_url:e.pageUrl,sdk_type:"js"},n=c.default.stringify(t);return this._config.backendUrl+"?"+n}},{key:"trackEvent",value:function(e,t){if(!e)throw new Error("event for tracking was not specified, event must be provided");if(!this._videoStored.tracking[e])throw new Error("Something is wrong with "+e+" tracking endpoints.");if("adBegin"===e&&!t)throw new Error("adRollName not found, adRollName must be provided");var n=this._videoStored.tracking[e];return this._executeTrackingRequests(n,t)}},{key:"_executeTrackingRequests",value:function(e,t){var n=this,r=e.map(function(e){var r=e.method,o=e.url,i=e.payload,u=void 0===i?{}:i;if(!o)return new Promise(function(e,t){return t(new Error("url is not found, endpoint is malformed"))});var c=n._getTrackingXhrOptions(r,o,u,t);return new Promise(function(e,t){n._xhr(c,function(n,r,o){return n?t(n):200===r.statusCode?e(o):void 0})})});return Promise.all(r).catch(function(e){throw console.log(e),new Error("Service is unavailable. Please contact glomex tech support")})}},{key:"_getTrackingXhrOptions",value:function(e,t,n,r){var i=this._defaultXhrOptions,u="get"===e.toLowerCase(),a=this._config,s=a.contentSessionId,l=a.clientInfo,f=o({},n,r?{contentSessionId:s,clientInfo:l,adRollName:r}:{contentSessionId:s,clientInfo:l});if(u){var d=t+"&"+c.default.stringify(f);return o({},i,{url:d})}return o({},i,{method:"post",url:t,body:f})}},{key:"_storeVideo",value:function(e){this._videoStored=e}}]),e}();t.default=a},function(e,t){e.exports=function(){for(var e={},t=0;t<arguments.length;t++){var r=arguments[t];for(var o in r)n.call(r,o)&&(e[o]=r[o])}return e};var n=Object.prototype.hasOwnProperty},function(e,t,n){"use strict";var r=Function.prototype.toString,o=/^\s*class /,i=function(e){try{var t=r.call(e).replace(/\/\/.*\n/g,"").replace(/\/\*[.\s\S]*\*\//g,"").replace(/\n/gm," ").replace(/ {2}/g," ");return o.test(t)}catch(e){return!1}},u=Object.prototype.toString,c="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;e.exports=function(e){if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if(c)return function(e){try{return!i(e)&&(r.call(e),!0)}catch(e){return!1}}(e);if(i(e))return!1;var t=u.call(e);return"[object Function]"===t||"[object GeneratorFunction]"===t}},function(e,t,n){"use strict";var r=n(10),o=Object.prototype.toString,i=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){if(!r(t))throw new TypeError("iterator must be a function");var u;arguments.length>=3&&(u=n),"[object Array]"===o.call(e)?function(e,t,n){for(var r=0,o=e.length;r<o;r++)i.call(e,r)&&(null==n?t(e[r],r,e):t.call(n,e[r],r,e))}(e,t,u):"string"==typeof e?function(e,t,n){for(var r=0,o=e.length;r<o;r++)null==n?t(e.charAt(r),r,e):t.call(n,e.charAt(r),r,e)}(e,t,u):function(e,t,n){for(var r in e)i.call(e,r)&&(null==n?t(e[r],r,e):t.call(n,e[r],r,e))}(e,t,u)}},function(e,t){(t=e.exports=function(e){return e.replace(/^\s*|\s*$/g,"")}).left=function(e){return e.replace(/^\s*/,"")},t.right=function(e){return e.replace(/\s*$/,"")}},function(e,t,n){var r=n(12),o=n(11);e.exports=function(e){if(!e)return{};var t={};return o(r(e).split("\n"),function(e){var n,o=e.indexOf(":"),i=r(e.slice(0,o)).toLowerCase(),u=r(e.slice(o+1));void 0===t[i]?t[i]=u:(n=t[i],"[object Array]"===Object.prototype.toString.call(n)?t[i].push(u):t[i]=[t[i],u])}),t}},function(e,t){e.exports=function(e){var t=n.call(e);return"[object Function]"===t||"function"==typeof e&&"[object RegExp]"!==t||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)};var n=Object.prototype.toString},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){(function(t){var n;n="undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{},e.exports=n}).call(this,n(15))},function(e,t,n){"use strict";var r=n(16),o=n(14),i=n(13),u=n(9);function c(e,t,n){var r=e;return o(t)?(n=t,"string"==typeof e&&(r={uri:e})):r=u(t,{uri:e}),r.callback=n,r}function a(e,t,n){return s(t=c(e,t,n))}function s(e){if(void 0===e.callback)throw new Error("callback argument missing");var t=!1,n=function(n,r,o){t||(t=!0,e.callback(n,r,o))};function r(e){return clearTimeout(l),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,n(e,h)}function o(){if(!c){var t;clearTimeout(l),t=e.useXDR&&void 0===s.status?200:1223===s.status?204:s.status;var r=h,o=null;return 0!==t?(r={body:function(){var e=void 0;if(e=s.response?s.response:s.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}(s),y)try{e=JSON.parse(e)}catch(e){}return e}(),statusCode:t,method:d,headers:{},url:f,rawRequest:s},s.getAllResponseHeaders&&(r.headers=i(s.getAllResponseHeaders()))):o=new Error("Internal XMLHttpRequest Error"),n(o,r,r.body)}}var u,c,s=e.xhr||null;s||(s=e.cors||e.useXDR?new a.XDomainRequest:new a.XMLHttpRequest);var l,f=s.url=e.uri||e.url,d=s.method=e.method||"GET",p=e.body||e.data,g=s.headers=e.headers||{},v=!!e.sync,y=!1,h={body:void 0,headers:{},statusCode:0,method:d,url:f,rawRequest:s};if("json"in e&&!1!==e.json&&(y=!0,g.accept||g.Accept||(g.Accept="application/json"),"GET"!==d&&"HEAD"!==d&&(g["content-type"]||g["Content-Type"]||(g["Content-Type"]="application/json"),p=JSON.stringify(!0===e.json?p:e.json))),s.onreadystatechange=function(){4===s.readyState&&setTimeout(o,0)},s.onload=o,s.onerror=r,s.onprogress=function(){},s.onabort=function(){c=!0},s.ontimeout=r,s.open(d,f,!v,e.username,e.password),v||(s.withCredentials=!!e.withCredentials),!v&&e.timeout>0&&(l=setTimeout(function(){if(!c){c=!0,s.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",r(e)}},e.timeout)),s.setRequestHeader)for(u in g)g.hasOwnProperty(u)&&s.setRequestHeader(u,g[u]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(s.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(s),s.send(p||null),s}e.exports=a,e.exports.default=a,a.XMLHttpRequest=r.XMLHttpRequest||function(){},a.XDomainRequest="withCredentials"in new a.XMLHttpRequest?a.XMLHttpRequest:r.XDomainRequest,function(e,t){for(var n=0;n<e.length;n++)t(e[n])}(["get","put","post","patch","head","delete"],function(e){a["delete"===e?"del":e]=function(t,n,r){return(n=c(t,n,r)).method=e.toUpperCase(),s(n)}})},function(e,t,n){"use strict";var r=a(n(17)),o=a(n(8)),i=a(n(4)),u=a(n(3)),c=n(1);function a(e){return e&&e.__esModule?e:{default:e}}e.exports=(0,u.default)(i.default,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return new(Function.prototype.bind.apply(o.default,[null].concat([r.default],t)))},{getPageUrl:c.getPageUrl,getClientInfo:c.getClientInfo,uniqueId:c.uniqueId})},function(e,t,n){"use strict";var r=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(18));!function(e,t,n){var o={integrationId:"[INTEGRATION_ID]",contentId:"[CONTENT_ID]"};!function(){var e=new r.default(o);e.getSources().then(function(t){var r=n.createOwnVideoPlayer(t);e.trackContentBegin(),r.addEventListener("loadeddata",function(){e.trackAdBegin("preroll")}),r.addEventListener("ended",function(){e.trackAdBegin("postroll")}),r.play()},function(e){console.error(e)})}();var i=e.querySelectorAll(".js-get-config"),u=e.querySelector(".js-get-sources-demo"),c=e.querySelector(".js-track-content-begin-demo"),a=e.querySelector(".js-track-ad-begin-demo"),s=h(),l=new r.default(s);function f(){y(),function(){if(!t)return;var e=h();Object.keys(e).forEach(function(n){return t.setItem("glomex_sdk_"+n,e[n])})}()}function d(){(l=new r.default(h())).getSources().then(function(){a.removeAttribute("disabled"),c.removeAttribute("disabled"),v("getSources()")}).catch(function(e){y(),console.error(e)})}function p(){l.trackContentBegin().then(function(){return v("trackContentBegin()")})}function g(){l.trackAdBegin("postroll").then(function(){return v("trackAdBegin('postroll')")})}function v(e){console.warn(e+" was performed, check network requests")}function y(){a.setAttribute("disabled",""),c.setAttribute("disabled","")}function h(){var e=i[0].value,t=i[1].value,n=i[2].value,r={integrationId:e,contentId:t};return n&&(r.pageUrl=n),Object.assign({},o,r)}Object.keys(h()).forEach(function(e,n){return function(e,n){var r=t.getItem("glomex_sdk_"+e);r&&(i[n].value=r)}(e,n)}),i.forEach(function(e){["change","keyup"].forEach(function(t){return e.addEventListener(t,f)})}),u.addEventListener("click",d),c.addEventListener("click",p),a.addEventListener("click",g)}(document,window.localStorage,window)}]);
//# sourceMappingURL=glomex.content-sdk-example.js.map

@@ -1,16 +0,2 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.glomexContentSDK=e():t.glomexContentSDK=e()}(window,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=22)}([function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){
/**
* lite-url - Small, JS lib that uses regex for parsing a URL into it's component parts.
* @version v1.0.5
* @link https://github.com/sadams/lite-url
* @license BSD-3-Clause
*/
(function(){"use strict";function n(t,e,n){var r=t.split(e);return n(r.shift(),r.join(e))}function r(t){var e={hash:"",host:"",hostname:"",origin:"",pathname:"",protocol:"",search:"",password:"",username:"",port:""};return n(t,"#",function(t,r){r&&(e.hash=r?"#"+r:""),n(t,"?",function(t,r){r&&(e.search="?"+r),t&&n(t,"//",function(t,r){e.protocol=t,n(r,"/",function(t,r){e.pathname="/"+(r||""),(e.protocol||t)&&(e.origin=e.protocol+"//"+t),n(t,"@",function(t,r){if(r){var o=t.split(":");e.username=o[0],e.password=o[1]}else r=t;e.host=r,n(r,":",function(t,n){e.hostname=t,n&&(e.port=n)})})})})})}),e.href=e.origin+e.pathname+e.search+e.hash,e}function o(t){var e={},n=t.search;if(n){var r=(n=n.replace(new RegExp("\\?"),"")).split("&");for(var o in r)if(r.hasOwnProperty(o)&&r[o]){var i=r[o].split("=");e[i[0]]=i[1]}}return e}function i(t){var e=u[t];return void 0!==e?e:((e=r(t)).params=o(e),u[t]=e,e)}var u={};return i.changeQueryParser=function(t){o=t},void 0!==t&&t.exports&&(e=t.exports=i),e.liteURL=i,i}).call(this)},function(t,e,n){var r,o,i;o=[e,n(1)],void 0===(i="function"==typeof(r=function(t,e){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.handleConfigErrors=t.getPageUrl=void 0;var n,r=(n=e)&&n.__esModule?n:{default:n};t.getPageUrl=function(){return window.glomexContext&&window.glomexContext.pageUrl?(0,r.default)(window.glomexContext.pageUrl):function(){try{return window.self!==window.top}catch(t){return!0}}()&&window.document.referrer?(0,r.default)(window.document.referrer):(0,r.default)(window.location.href)},t.handleConfigErrors=function(t){Object.keys(t).forEach(function(e){if(!t[e])throw new Error("config."+e+" not found, "+e+" must be provided")})}})?r.apply(e,o):r)||(t.exports=i)},function(t,e){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);t.exports=function(t,e){var r=e||0,o=n;return o[t[r++]]+o[t[r++]]+o[t[r++]]+o[t[r++]]+"-"+o[t[r++]]+o[t[r++]]+"-"+o[t[r++]]+o[t[r++]]+"-"+o[t[r++]]+o[t[r++]]+"-"+o[t[r++]]+o[t[r++]]+o[t[r++]]+o[t[r++]]+o[t[r++]]+o[t[r++]]}},function(t,e){var n="undefined"!=typeof crypto&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);t.exports=function(){return n(r),r}}else{var o=new Array(16);t.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),o[e]=t>>>((3&e)<<3)&255;return o}}},function(t,e,n){var r,o,i=n(4),u=n(3),c=0,s=0;t.exports=function(t,e,n){var a=e&&n||0,f=e||[],l=(t=t||{}).node||r,d=void 0!==t.clockseq?t.clockseq:o;if(null==l||null==d){var p=i();null==l&&(l=r=[1|p[0],p[1],p[2],p[3],p[4],p[5]]),null==d&&(d=o=16383&(p[6]<<8|p[7]))}var h=void 0!==t.msecs?t.msecs:(new Date).getTime(),v=void 0!==t.nsecs?t.nsecs:s+1,y=h-c+(v-s)/1e4;if(y<0&&void 0===t.clockseq&&(d=d+1&16383),(y<0||h>c)&&void 0===t.nsecs&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=h,s=v,o=d;var g=(1e4*(268435455&(h+=122192928e5))+v)%4294967296;f[a++]=g>>>24&255,f[a++]=g>>>16&255,f[a++]=g>>>8&255,f[a++]=255&g;var m=h/4294967296*1e4&268435455;f[a++]=m>>>8&255,f[a++]=255&m,f[a++]=m>>>24&15|16,f[a++]=m>>>16&255,f[a++]=d>>>8|128,f[a++]=255&d;for(var w=0;w<6;++w)f[a+w]=l[w];return e||u(f)}},function(t,e,n){var r,o,i;o=[e,n(5),n(2)],void 0===(i="function"==typeof(r=function(t,e,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=(r=e)&&r.__esModule?r:{default:r},i={integrationId:null,contentId:null,pageUrl:(0,n.getPageUrl)().href,contentSessionId:(0,o.default)(),clientInfo:function(){try{return window.navigator.appVersion}catch(t){return"n/a"}}(),backendUrl:"https://integration-sdk-eu-west-1.mes.glomex.cloud/video"};t.default=function(t,e){return function(r){if(!r)throw new Error("No config found, config object must be provided");var o=Object.assign({},i,r);(0,n.handleConfigErrors)(o);var u=e(o);return new t(u)}}})?r.apply(e,o):r)||(t.exports=i)},function(t,e,n){var r,o,i;o=[e],void 0===(i="function"==typeof(r=function(t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(t){return{getSources:function(){return t.getVideoSources()},trackContentBegin:function(){return t.trackEvent("contentBegin")},trackAdBegin:function(e){return t.trackEvent("adBegin",e)}}}})?r.apply(e,o):r)||(t.exports=i)},function(t,e){var n,r,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function c(t){if(n===setTimeout)return setTimeout(t,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(t){n=i}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(t){r=u}}();var s,a=[],f=!1,l=-1;function d(){f&&s&&(f=!1,s.length?a=s.concat(a):l=-1,a.length&&p())}function p(){if(!f){var t=c(d);f=!0;for(var e=a.length;e;){for(s=a,a=[];++l<e;)s&&s[l].run();l=-1,e=a.length}s=null,f=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function h(t,e){this.fun=t,this.array=e}function v(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];a.push(new h(t,e)),1!==a.length||f||c(p)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=v,o.addListener=v,o.once=v,o.off=v,o.removeListener=v,o.removeAllListeners=v,o.emit=v,o.prependListener=v,o.prependOnceListener=v,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e,n){(function(e,n){
/*!
* @overview es6-promise - a tiny implementation of Promises/A+.
* @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
* @license Licensed under MIT license
* See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
* @version v4.2.4+314e4831
*/var r;r=function(){"use strict";function t(t){return"function"==typeof t}var r=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},o=0,i=void 0,u=void 0,c=function(t,e){h[o]=t,h[o+1]=e,2===(o+=2)&&(u?u(v):b())};var s="undefined"!=typeof window?window:void 0,a=s||{},f=a.MutationObserver||a.WebKitMutationObserver,l="undefined"==typeof self&&void 0!==e&&"[object process]"==={}.toString.call(e),d="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function p(){var t=setTimeout;return function(){return t(v,1)}}var h=new Array(1e3);function v(){for(var t=0;t<o;t+=2){(0,h[t])(h[t+1]),h[t]=void 0,h[t+1]=void 0}o=0}var y,g,m,w,b=void 0;function _(t,e){var n=this,r=new this.constructor(E);void 0===r[x]&&F(r);var o=n._state;if(o){var i=arguments[o-1];c(function(){return I(o,r,i,n._result)})}else q(n,r,t,e);return r}function j(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=new this(E);return R(e,t),e}l?b=function(){return e.nextTick(v)}:f?(g=0,m=new f(v),w=document.createTextNode(""),m.observe(w,{characterData:!0}),b=function(){w.data=g=++g%2}):d?((y=new MessageChannel).port1.onmessage=v,b=function(){return y.port2.postMessage(0)}):b=void 0===s?function(){try{var t=Function("return this")().require("vertx");return void 0!==(i=t.runOnLoop||t.runOnContext)?function(){i(v)}:p()}catch(t){return p()}}():p();var x=Math.random().toString(36).substring(2);function E(){}var O=void 0,T=1,S=2,k={error:null};function A(t){try{return t.then}catch(t){return k.error=t,k}}function C(e,n,r){n.constructor===e.constructor&&r===_&&n.constructor.resolve===j?function(t,e){e._state===T?P(t,e._result):e._state===S?U(t,e._result):q(e,void 0,function(e){return R(t,e)},function(e){return U(t,e)})}(e,n):r===k?(U(e,k.error),k.error=null):void 0===r?P(e,n):t(r)?function(t,e,n){c(function(t){var r=!1,o=function(t,e,n,r){try{t.call(e,n,r)}catch(t){return t}}(n,e,function(n){r||(r=!0,e!==n?R(t,n):P(t,n))},function(e){r||(r=!0,U(t,e))},t._label);!r&&o&&(r=!0,U(t,o))},t)}(e,n,r):P(e,n)}function R(t,e){var n,r;t===e?U(t,new TypeError("You cannot resolve a promise with itself")):(r=typeof(n=e),null===n||"object"!==r&&"function"!==r?P(t,e):C(t,e,A(e)))}function M(t){t._onerror&&t._onerror(t._result),X(t)}function P(t,e){t._state===O&&(t._result=e,t._state=T,0!==t._subscribers.length&&c(X,t))}function U(t,e){t._state===O&&(t._state=S,t._result=e,c(M,t))}function q(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+T]=n,o[i+S]=r,0===i&&t._state&&c(X,t)}function X(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,o=void 0,i=t._result,u=0;u<e.length;u+=3)r=e[u],o=e[u+n],r?I(n,r,o,i):o(i);t._subscribers.length=0}}function I(e,n,r,o){var i=t(r),u=void 0,c=void 0,s=void 0,a=void 0;if(i){if((u=function(t,e){try{return t(e)}catch(t){return k.error=t,k}}(r,o))===k?(a=!0,c=u.error,u.error=null):s=!0,n===u)return void U(n,new TypeError("A promises callback cannot return that same promise."))}else u=o,s=!0;n._state!==O||(i&&s?R(n,u):a?U(n,c):e===T?P(n,u):e===S&&U(n,u))}var L=0;function F(t){t[x]=L++,t._state=void 0,t._result=void 0,t._subscribers=[]}var H=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(E),this.promise[x]||F(this.promise),r(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?P(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&P(this.promise,this._result))):U(this.promise,new Error("Array Methods must be provided an Array"))}return t.prototype._enumerate=function(t){for(var e=0;this._state===O&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===j){var o=A(t);if(o===_&&t._state!==O)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(n===D){var i=new n(E);C(i,t,o),this._willSettleAt(i,e)}else this._willSettleAt(new n(function(e){return e(t)}),e)}else this._willSettleAt(r(t),e)},t.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===O&&(this._remaining--,t===S?U(r,n):this._result[e]=n),0===this._remaining&&P(r,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;q(t,void 0,function(t){return n._settledAt(T,e,t)},function(t){return n._settledAt(S,e,t)})},t}();var D=function(){function t(e){this[x]=L++,this._result=this._state=void 0,this._subscribers=[],E!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof t?function(t,e){try{e(function(e){R(t,e)},function(e){U(t,e)})}catch(e){U(t,e)}}(this,e):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return t.prototype.catch=function(t){return this.then(null,t)},t.prototype.finally=function(t){var e=this.constructor;return this.then(function(n){return e.resolve(t()).then(function(){return n})},function(n){return e.resolve(t()).then(function(){throw n})})},t}();return D.prototype.then=_,D.all=function(t){return new H(this,t).promise},D.race=function(t){var e=this;return r(t)?new e(function(n,r){for(var o=t.length,i=0;i<o;i++)e.resolve(t[i]).then(n,r)}):new e(function(t,e){return e(new TypeError("You must pass an array to race."))})},D.resolve=j,D.reject=function(t){var e=new this(E);return U(e,t),e},D._setScheduler=function(t){u=t},D._setAsap=function(t){c=t},D._asap=c,D.polyfill=function(){var t=void 0;if(void 0!==n)t=n;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var r=null;try{r=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===r&&!e.cast)return}t.Promise=D},D.Promise=D,D},t.exports=r()}).call(this,n(8),n(0))},function(t,e,n){"use strict";var r=new RegExp("%[a-f0-9]{2}","gi"),o=new RegExp("(%[a-f0-9]{2})+","gi");function i(t,e){try{return decodeURIComponent(t.join(""))}catch(t){}if(1===t.length)return t;e=e||1;var n=t.slice(0,e),r=t.slice(e);return Array.prototype.concat.call([],i(n),i(r))}function u(t){try{return decodeURIComponent(t)}catch(o){for(var e=t.match(r),n=1;n<e.length;n++)e=(t=i(e,n).join("")).match(r);return t}}t.exports=function(t){if("string"!=typeof t)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch(e){return function(t){for(var e={"%FE%FF":"��","%FF%FE":"��"},n=o.exec(t);n;){try{e[n[0]]=decodeURIComponent(n[0])}catch(t){var r=u(n[0]);r!==n[0]&&(e[n[0]]=r)}n=o.exec(t)}e["%C2"]="�";for(var i=Object.keys(e),c=0;c<i.length;c++){var s=i[c];t=t.replace(new RegExp(s,"g"),e[s])}return t}(t)}}},function(t,e,n){"use strict";t.exports=(t=>encodeURIComponent(t).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`))},function(t,e,n){"use strict";const r=n(11),o=n(10);function i(t,e){return e.encode?e.strict?r(t):encodeURIComponent(t):t}function u(t,e){return e.decode?o(t):t}function c(t){const e=t.indexOf("?");return-1===e?"":t.slice(e+1)}function s(t,e){const n=function(t){let e;switch(t.arrayFormat){case"index":return(t,n,r)=>{e=/\[(\d*)\]$/.exec(t),t=t.replace(/\[\d*\]$/,""),e?(void 0===r[t]&&(r[t]={}),r[t][e[1]]=n):r[t]=n};case"bracket":return(t,n,r)=>{e=/(\[\])$/.exec(t),t=t.replace(/\[\]$/,""),e?void 0!==r[t]?r[t]=[].concat(r[t],n):r[t]=[n]:r[t]=n};default:return(t,e,n)=>{void 0!==n[t]?n[t]=[].concat(n[t],e):n[t]=e}}}(e=Object.assign({decode:!0,arrayFormat:"none"},e)),r=Object.create(null);if("string"!=typeof t)return r;if(!(t=t.trim().replace(/^[?#&]/,"")))return r;for(const o of t.split("&")){let[t,i]=o.replace(/\+/g," ").split("=");i=void 0===i?null:u(i,e),n(u(t,e),i,r)}return Object.keys(r).sort().reduce((t,e)=>{const n=r[e];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?t[e]=function t(e){return Array.isArray(e)?e.sort():"object"==typeof e?t(Object.keys(e)).sort((t,e)=>Number(t)-Number(e)).map(t=>e[t]):e}(n):t[e]=n,t},Object.create(null))}e.extract=c,e.parse=s,e.stringify=((t,e)=>{!1===(e=Object.assign({encode:!0,strict:!0,arrayFormat:"none"},e)).sort&&(e.sort=(()=>{}));const n=function(t){switch(t.arrayFormat){case"index":return(e,n,r)=>null===n?[i(e,t),"[",r,"]"].join(""):[i(e,t),"[",i(r,t),"]=",i(n,t)].join("");case"bracket":return(e,n)=>null===n?[i(e,t),"[]"].join(""):[i(e,t),"[]=",i(n,t)].join("");default:return(e,n)=>null===n?i(e,t):[i(e,t),"=",i(n,t)].join("")}}(e);return t?Object.keys(t).sort(e.sort).map(r=>{const o=t[r];if(void 0===o)return"";if(null===o)return i(r,e);if(Array.isArray(o)){const t=[];for(const e of o.slice())void 0!==e&&t.push(n(r,e,t.length));return t.join("&")}return i(r,e)+"="+i(o,e)}).filter(t=>t.length>0).join("&"):""}),e.parseUrl=((t,e)=>({url:t.split("?")[0]||"",query:s(c(t),e)}))},function(t,e,n){var r,o,i;o=[e,n(12),n(9)],void 0===(i="function"==typeof(r=function(t,e){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,r=(n=e)&&n.__esModule?n:{default:n},o=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._xhr=e,this._defaultXhrOptions={method:"get",url:null,json:!0},this._config=Object.assign({},n),this._videoStored=null}return i(t,[{key:"getVideoSources",value:function(){var t=this;return new Promise(function(e,n){var r=t._createUrl(t._config);t._xhr.get({url:r,json:!0},function(r,o,i){t._handleGetVideoSources(r,o,i,e,n)})})}},{key:"_handleGetVideoSources",value:function(t,e,n,r,i){return t?i(t):n&&n.error?i(n.error):n?n.video&&n.video.source?(this._storeVideo(n.video),void r(o({},n.video.source))):i(new Error("Video sources are malformed")):i(new Error("Can't fetch video sources"))}},{key:"_createUrl",value:function(t){var e=t.integrationId,n=t.contentId,o=t.pageUrl,i={integration_id:e,content_id:n,page_url:o,sdk_type:"js"},u=r.default.stringify(i);return this._config.backendUrl+"?"+u}},{key:"trackEvent",value:function(t,e){if(!t)throw new Error("event for tracking was not specified, event must be provided");if(!this._videoStored.tracking[t])throw new Error("Something is wrong with "+t+" tracking endpoints.");if("adBegin"===t&&!e)throw new Error("adRollName not found, adRollName must be provided");var n=this._videoStored.tracking[t];return this._executeTrackingRequests(n,e)}},{key:"_executeTrackingRequests",value:function(t,e){var n=this,r=t.map(function(t){var r=t.method,o=t.url,i=t.payload,u=void 0===i?{}:i;if(!o)return new Promise(function(t,e){return e(new Error("url is not found, endpoint is malformed"))});var c=n._getTrackingXhrOptions(r,o,u,e);return new Promise(function(t,e){n._xhr(c,function(n,r,o){return n?e(n):200===r.statusCode?t(o):void 0})})});return Promise.all(r).catch(function(t){throw console.log(t),new Error("Service is unavailable. Please contact glomex tech support")})}},{key:"_getTrackingXhrOptions",value:function(t,e,n,i){var u=this._defaultXhrOptions,c="get"===t.toLowerCase(),s=this._config,a=s.contentSessionId,f=s.clientInfo,l=o({},n,i?{contentSessionId:a,clientInfo:f,adRollName:i}:{contentSessionId:a,clientInfo:f});if(c){var d=e+"&"+r.default.stringify(l);return o({},u,{url:d})}return o({},u,{method:"post",url:e,body:l})}},{key:"_storeVideo",value:function(t){this._videoStored=t}}]),t}();t.default=u})?r.apply(e,o):r)||(t.exports=i)},function(t,e){t.exports=function(){for(var t={},e=0;e<arguments.length;e++){var r=arguments[e];for(var o in r)n.call(r,o)&&(t[o]=r[o])}return t};var n=Object.prototype.hasOwnProperty},function(t,e,n){"use strict";var r=Function.prototype.toString,o=/^\s*class /,i=function(t){try{var e=r.call(t).replace(/\/\/.*\n/g,"").replace(/\/\*[.\s\S]*\*\//g,"").replace(/\n/gm," ").replace(/ {2}/g," ");return o.test(e)}catch(t){return!1}},u=Object.prototype.toString,c="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;t.exports=function(t){if(!t)return!1;if("function"!=typeof t&&"object"!=typeof t)return!1;if(c)return function(t){try{return!i(t)&&(r.call(t),!0)}catch(t){return!1}}(t);if(i(t))return!1;var e=u.call(t);return"[object Function]"===e||"[object GeneratorFunction]"===e}},function(t,e,n){"use strict";var r=n(15),o=Object.prototype.toString,i=Object.prototype.hasOwnProperty;t.exports=function(t,e,n){if(!r(e))throw new TypeError("iterator must be a function");var u;arguments.length>=3&&(u=n),"[object Array]"===o.call(t)?function(t,e,n){for(var r=0,o=t.length;r<o;r++)i.call(t,r)&&(null==n?e(t[r],r,t):e.call(n,t[r],r,t))}(t,e,u):"string"==typeof t?function(t,e,n){for(var r=0,o=t.length;r<o;r++)null==n?e(t.charAt(r),r,t):e.call(n,t.charAt(r),r,t)}(t,e,u):function(t,e,n){for(var r in t)i.call(t,r)&&(null==n?e(t[r],r,t):e.call(n,t[r],r,t))}(t,e,u)}},function(t,e){(e=t.exports=function(t){return t.replace(/^\s*|\s*$/g,"")}).left=function(t){return t.replace(/^\s*/,"")},e.right=function(t){return t.replace(/\s*$/,"")}},function(t,e,n){var r=n(17),o=n(16);t.exports=function(t){if(!t)return{};var e={};return o(r(t).split("\n"),function(t){var n,o=t.indexOf(":"),i=r(t.slice(0,o)).toLowerCase(),u=r(t.slice(o+1));void 0===e[i]?e[i]=u:(n=e[i],"[object Array]"===Object.prototype.toString.call(n)?e[i].push(u):e[i]=[e[i],u])}),e}},function(t,e){t.exports=function(t){var e=n.call(t);return"[object Function]"===e||"function"==typeof t&&"[object RegExp]"!==e||"undefined"!=typeof window&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)};var n=Object.prototype.toString},function(t,e,n){(function(e){var n;n="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{},t.exports=n}).call(this,n(0))},function(t,e,n){"use strict";var r=n(20),o=n(19),i=n(18),u=n(14);function c(t,e,n){var r=t;return o(e)?(n=e,"string"==typeof t&&(r={uri:t})):r=u(e,{uri:t}),r.callback=n,r}function s(t,e,n){return a(e=c(t,e,n))}function a(t){if(void 0===t.callback)throw new Error("callback argument missing");var e=!1,n=function(n,r,o){e||(e=!0,t.callback(n,r,o))};function r(t){return clearTimeout(f),t instanceof Error||(t=new Error(""+(t||"Unknown XMLHttpRequest Error"))),t.statusCode=0,n(t,g)}function o(){if(!c){var e;clearTimeout(f),e=t.useXDR&&void 0===a.status?200:1223===a.status?204:a.status;var r=g,o=null;return 0!==e?(r={body:function(){var t=void 0;if(t=a.response?a.response:a.responseText||function(t){try{if("document"===t.responseType)return t.responseXML;var e=t.responseXML&&"parsererror"===t.responseXML.documentElement.nodeName;if(""===t.responseType&&!e)return t.responseXML}catch(t){}return null}(a),y)try{t=JSON.parse(t)}catch(t){}return t}(),statusCode:e,method:d,headers:{},url:l,rawRequest:a},a.getAllResponseHeaders&&(r.headers=i(a.getAllResponseHeaders()))):o=new Error("Internal XMLHttpRequest Error"),n(o,r,r.body)}}var u,c,a=t.xhr||null;a||(a=t.cors||t.useXDR?new s.XDomainRequest:new s.XMLHttpRequest);var f,l=a.url=t.uri||t.url,d=a.method=t.method||"GET",p=t.body||t.data,h=a.headers=t.headers||{},v=!!t.sync,y=!1,g={body:void 0,headers:{},statusCode:0,method:d,url:l,rawRequest:a};if("json"in t&&!1!==t.json&&(y=!0,h.accept||h.Accept||(h.Accept="application/json"),"GET"!==d&&"HEAD"!==d&&(h["content-type"]||h["Content-Type"]||(h["Content-Type"]="application/json"),p=JSON.stringify(!0===t.json?p:t.json))),a.onreadystatechange=function(){4===a.readyState&&setTimeout(o,0)},a.onload=o,a.onerror=r,a.onprogress=function(){},a.onabort=function(){c=!0},a.ontimeout=r,a.open(d,l,!v,t.username,t.password),v||(a.withCredentials=!!t.withCredentials),!v&&t.timeout>0&&(f=setTimeout(function(){if(!c){c=!0,a.abort("timeout");var t=new Error("XMLHttpRequest timeout");t.code="ETIMEDOUT",r(t)}},t.timeout)),a.setRequestHeader)for(u in h)h.hasOwnProperty(u)&&a.setRequestHeader(u,h[u]);else if(t.headers&&!function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}(t.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in t&&(a.responseType=t.responseType),"beforeSend"in t&&"function"==typeof t.beforeSend&&t.beforeSend(a),a.send(p||null),a}t.exports=s,t.exports.default=s,s.XMLHttpRequest=r.XMLHttpRequest||function(){},s.XDomainRequest="withCredentials"in new s.XMLHttpRequest?s.XMLHttpRequest:r.XDomainRequest,function(t,e){for(var n=0;n<t.length;n++)e(t[n])}(["get","put","post","patch","head","delete"],function(t){s["delete"===t?"del":t]=function(e,n,r){return(n=c(e,n,r)).method=t.toUpperCase(),a(n)}})},function(t,e,n){var r,o,i;o=[t,n(21),n(13),n(7),n(6)],void 0===(i="function"==typeof(r=function(t,e,n,r,o){"use strict";var i=a(e),u=a(n),c=a(r),s=a(o);function a(t){return t&&t.__esModule?t:{default:t}}t.exports=(0,s.default)(c.default,function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return new(Function.prototype.bind.apply(u.default,[null].concat([i.default],e)))})})?r.apply(e,o):r)||(t.exports=i)}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.glomexContentSdk=t():e.glomexContentSdk=t()}("undefined"!=typeof self?self:this,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=17)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.getPageUrl=function(){try{return window.location.href}catch(e){return null}},t.getClientInfo=function(){try{return window.navigator.appVersion}catch(e){return"n/a"}},t.uniqueId=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.handleConfigErrors=function(e){Object.keys(e).forEach(function(t){if(!e[t])throw new Error("config."+t+" not found, "+t+" must be provided")})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1);t.default=function(e,t,n){var o=n.getPageUrl,i=n.getClientInfo,u=n.uniqueId;return function(n){var c={integrationId:null,contentId:null,pageUrl:o(),contentSessionId:u(),clientInfo:i(),backendUrl:"https://integration-sdk-eu-west-1.mes.glomex.cloud/video"};if(!n)throw new Error("No config found, config object must be provided");var a=Object.assign({},c,n);(0,r.handleConfigErrors)(a);var s=t(a);return e(s)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=function(e){return{getSources:function(){return e.getVideoSources()},trackContentBegin:function(){return e.trackEvent("contentBegin")},trackAdBegin:function(t){return e.trackEvent("adBegin",t)}}}},function(e,t,n){"use strict";var r=new RegExp("%[a-f0-9]{2}","gi"),o=new RegExp("(%[a-f0-9]{2})+","gi");function i(e,t){try{return decodeURIComponent(e.join(""))}catch(e){}if(1===e.length)return e;t=t||1;var n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],i(n),i(r))}function u(e){try{return decodeURIComponent(e)}catch(o){for(var t=e.match(r),n=1;n<t.length;n++)t=(e=i(t,n).join("")).match(r);return e}}e.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return e=e.replace(/\+/g," "),decodeURIComponent(e)}catch(t){return function(e){for(var t={"%FE%FF":"��","%FF%FE":"��"},n=o.exec(e);n;){try{t[n[0]]=decodeURIComponent(n[0])}catch(e){var r=u(n[0]);r!==n[0]&&(t[n[0]]=r)}n=o.exec(e)}t["%C2"]="�";for(var i=Object.keys(t),c=0;c<i.length;c++){var a=i[c];e=e.replace(new RegExp(a,"g"),t[a])}return e}(e)}}},function(e,t,n){"use strict";e.exports=(e=>encodeURIComponent(e).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`))},function(e,t,n){"use strict";const r=n(5),o=n(4);function i(e,t){return t.encode?t.strict?r(e):encodeURIComponent(e):e}function u(e,t){return t.decode?o(e):e}function c(e){const t=e.indexOf("?");return-1===t?"":e.slice(t+1)}function a(e,t){const n=function(e){let t;switch(e.arrayFormat){case"index":return(e,n,r)=>{t=/\[(\d*)\]$/.exec(e),e=e.replace(/\[\d*\]$/,""),t?(void 0===r[e]&&(r[e]={}),r[e][t[1]]=n):r[e]=n};case"bracket":return(e,n,r)=>{t=/(\[\])$/.exec(e),e=e.replace(/\[\]$/,""),t?void 0!==r[e]?r[e]=[].concat(r[e],n):r[e]=[n]:r[e]=n};default:return(e,t,n)=>{void 0!==n[e]?n[e]=[].concat(n[e],t):n[e]=t}}}(t=Object.assign({decode:!0,arrayFormat:"none"},t)),r=Object.create(null);if("string"!=typeof e)return r;if(!(e=e.trim().replace(/^[?#&]/,"")))return r;for(const o of e.split("&")){let[e,i]=o.replace(/\+/g," ").split("=");i=void 0===i?null:u(i,t),n(u(e,t),i,r)}return Object.keys(r).sort().reduce((e,t)=>{const n=r[t];return Boolean(n)&&"object"==typeof n&&!Array.isArray(n)?e[t]=function e(t){return Array.isArray(t)?t.sort():"object"==typeof t?e(Object.keys(t)).sort((e,t)=>Number(e)-Number(t)).map(e=>t[e]):t}(n):e[t]=n,e},Object.create(null))}t.extract=c,t.parse=a,t.stringify=((e,t)=>{!1===(t=Object.assign({encode:!0,strict:!0,arrayFormat:"none"},t)).sort&&(t.sort=(()=>{}));const n=function(e){switch(e.arrayFormat){case"index":return(t,n,r)=>null===n?[i(t,e),"[",r,"]"].join(""):[i(t,e),"[",i(r,e),"]=",i(n,e)].join("");case"bracket":return(t,n)=>null===n?[i(t,e),"[]"].join(""):[i(t,e),"[]=",i(n,e)].join("");default:return(t,n)=>null===n?i(t,e):[i(t,e),"=",i(n,e)].join("")}}(t);return e?Object.keys(e).sort(t.sort).map(r=>{const o=e[r];if(void 0===o)return"";if(null===o)return i(r,t);if(Array.isArray(o)){const e=[];for(const t of o.slice())void 0!==t&&e.push(n(r,t,e.length));return e.join("&")}return i(r,t)+"="+i(o,t)}).filter(e=>e.length>0).join("&"):""}),t.parseUrl=((e,t)=>({url:e.split("?")[0]||"",query:a(c(e),t)}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(6),c=(r=u)&&r.__esModule?r:{default:r};var a=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._xhr=t,this._defaultXhrOptions={method:"get",url:null,json:!0},this._config=Object.assign({},n),this._videoStored=null}return i(e,[{key:"getVideoSources",value:function(){var e=this;return new Promise(function(t,n){var r=e._createUrl(e._config);e._xhr.get({url:r,json:!0},function(r,o,i){e._handleGetVideoSources(r,o,i,t,n)})})}},{key:"_handleGetVideoSources",value:function(e,t,n,r,i){return e?i(e):n&&n.error?i(n.error):n?n.video&&n.video.source?(this._storeVideo(n.video),void r(o({},n.video.source))):i(new Error("Video sources are malformed")):i(new Error("Can't fetch video sources"))}},{key:"_createUrl",value:function(e){var t={integration_id:e.integrationId,content_id:e.contentId,page_url:e.pageUrl,sdk_type:"js"},n=c.default.stringify(t);return this._config.backendUrl+"?"+n}},{key:"trackEvent",value:function(e,t){if(!e)throw new Error("event for tracking was not specified, event must be provided");if(!this._videoStored.tracking[e])throw new Error("Something is wrong with "+e+" tracking endpoints.");if("adBegin"===e&&!t)throw new Error("adRollName not found, adRollName must be provided");var n=this._videoStored.tracking[e];return this._executeTrackingRequests(n,t)}},{key:"_executeTrackingRequests",value:function(e,t){var n=this,r=e.map(function(e){var r=e.method,o=e.url,i=e.payload,u=void 0===i?{}:i;if(!o)return new Promise(function(e,t){return t(new Error("url is not found, endpoint is malformed"))});var c=n._getTrackingXhrOptions(r,o,u,t);return new Promise(function(e,t){n._xhr(c,function(n,r,o){return n?t(n):200===r.statusCode?e(o):void 0})})});return Promise.all(r).catch(function(e){throw console.log(e),new Error("Service is unavailable. Please contact glomex tech support")})}},{key:"_getTrackingXhrOptions",value:function(e,t,n,r){var i=this._defaultXhrOptions,u="get"===e.toLowerCase(),a=this._config,s=a.contentSessionId,f=a.clientInfo,l=o({},n,r?{contentSessionId:s,clientInfo:f,adRollName:r}:{contentSessionId:s,clientInfo:f});if(u){var d=t+"&"+c.default.stringify(l);return o({},i,{url:d})}return o({},i,{method:"post",url:t,body:l})}},{key:"_storeVideo",value:function(e){this._videoStored=e}}]),e}();t.default=a},function(e,t){e.exports=function(){for(var e={},t=0;t<arguments.length;t++){var r=arguments[t];for(var o in r)n.call(r,o)&&(e[o]=r[o])}return e};var n=Object.prototype.hasOwnProperty},function(e,t,n){"use strict";var r=Function.prototype.toString,o=/^\s*class /,i=function(e){try{var t=r.call(e).replace(/\/\/.*\n/g,"").replace(/\/\*[.\s\S]*\*\//g,"").replace(/\n/gm," ").replace(/ {2}/g," ");return o.test(t)}catch(e){return!1}},u=Object.prototype.toString,c="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;e.exports=function(e){if(!e)return!1;if("function"!=typeof e&&"object"!=typeof e)return!1;if(c)return function(e){try{return!i(e)&&(r.call(e),!0)}catch(e){return!1}}(e);if(i(e))return!1;var t=u.call(e);return"[object Function]"===t||"[object GeneratorFunction]"===t}},function(e,t,n){"use strict";var r=n(9),o=Object.prototype.toString,i=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){if(!r(t))throw new TypeError("iterator must be a function");var u;arguments.length>=3&&(u=n),"[object Array]"===o.call(e)?function(e,t,n){for(var r=0,o=e.length;r<o;r++)i.call(e,r)&&(null==n?t(e[r],r,e):t.call(n,e[r],r,e))}(e,t,u):"string"==typeof e?function(e,t,n){for(var r=0,o=e.length;r<o;r++)null==n?t(e.charAt(r),r,e):t.call(n,e.charAt(r),r,e)}(e,t,u):function(e,t,n){for(var r in e)i.call(e,r)&&(null==n?t(e[r],r,e):t.call(n,e[r],r,e))}(e,t,u)}},function(e,t){(t=e.exports=function(e){return e.replace(/^\s*|\s*$/g,"")}).left=function(e){return e.replace(/^\s*/,"")},t.right=function(e){return e.replace(/\s*$/,"")}},function(e,t,n){var r=n(11),o=n(10);e.exports=function(e){if(!e)return{};var t={};return o(r(e).split("\n"),function(e){var n,o=e.indexOf(":"),i=r(e.slice(0,o)).toLowerCase(),u=r(e.slice(o+1));void 0===t[i]?t[i]=u:(n=t[i],"[object Array]"===Object.prototype.toString.call(n)?t[i].push(u):t[i]=[t[i],u])}),t}},function(e,t){e.exports=function(e){var t=n.call(e);return"[object Function]"===t||"function"==typeof e&&"[object RegExp]"!==t||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)};var n=Object.prototype.toString},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){(function(t){var n;n="undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{},e.exports=n}).call(this,n(14))},function(e,t,n){"use strict";var r=n(15),o=n(13),i=n(12),u=n(8);function c(e,t,n){var r=e;return o(t)?(n=t,"string"==typeof e&&(r={uri:e})):r=u(t,{uri:e}),r.callback=n,r}function a(e,t,n){return s(t=c(e,t,n))}function s(e){if(void 0===e.callback)throw new Error("callback argument missing");var t=!1,n=function(n,r,o){t||(t=!0,e.callback(n,r,o))};function r(e){return clearTimeout(f),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,n(e,h)}function o(){if(!c){var t;clearTimeout(f),t=e.useXDR&&void 0===s.status?200:1223===s.status?204:s.status;var r=h,o=null;return 0!==t?(r={body:function(){var e=void 0;if(e=s.response?s.response:s.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}(s),v)try{e=JSON.parse(e)}catch(e){}return e}(),statusCode:t,method:d,headers:{},url:l,rawRequest:s},s.getAllResponseHeaders&&(r.headers=i(s.getAllResponseHeaders()))):o=new Error("Internal XMLHttpRequest Error"),n(o,r,r.body)}}var u,c,s=e.xhr||null;s||(s=e.cors||e.useXDR?new a.XDomainRequest:new a.XMLHttpRequest);var f,l=s.url=e.uri||e.url,d=s.method=e.method||"GET",p=e.body||e.data,y=s.headers=e.headers||{},g=!!e.sync,v=!1,h={body:void 0,headers:{},statusCode:0,method:d,url:l,rawRequest:s};if("json"in e&&!1!==e.json&&(v=!0,y.accept||y.Accept||(y.Accept="application/json"),"GET"!==d&&"HEAD"!==d&&(y["content-type"]||y["Content-Type"]||(y["Content-Type"]="application/json"),p=JSON.stringify(!0===e.json?p:e.json))),s.onreadystatechange=function(){4===s.readyState&&setTimeout(o,0)},s.onload=o,s.onerror=r,s.onprogress=function(){},s.onabort=function(){c=!0},s.ontimeout=r,s.open(d,l,!g,e.username,e.password),g||(s.withCredentials=!!e.withCredentials),!g&&e.timeout>0&&(f=setTimeout(function(){if(!c){c=!0,s.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",r(e)}},e.timeout)),s.setRequestHeader)for(u in y)y.hasOwnProperty(u)&&s.setRequestHeader(u,y[u]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(s.responseType=e.responseType),"beforeSend"in e&&"function"==typeof e.beforeSend&&e.beforeSend(s),s.send(p||null),s}e.exports=a,e.exports.default=a,a.XMLHttpRequest=r.XMLHttpRequest||function(){},a.XDomainRequest="withCredentials"in new a.XMLHttpRequest?a.XMLHttpRequest:r.XDomainRequest,function(e,t){for(var n=0;n<e.length;n++)t(e[n])}(["get","put","post","patch","head","delete"],function(e){a["delete"===e?"del":e]=function(t,n,r){return(n=c(t,n,r)).method=e.toUpperCase(),s(n)}})},function(e,t,n){"use strict";var r=a(n(16)),o=a(n(7)),i=a(n(3)),u=a(n(2)),c=n(0);function a(e){return e&&e.__esModule?e:{default:e}}e.exports=(0,u.default)(i.default,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return new(Function.prototype.bind.apply(o.default,[null].concat([r.default],t)))},{getPageUrl:c.getPageUrl,getClientInfo:c.getClientInfo,uniqueId:c.uniqueId})}])});
//# sourceMappingURL=glomex.content-sdk.js.map

@@ -6,7 +6,10 @@ import xhr from 'xhr';

import createInit from './init';
import { getPageUrl, getClientInfo, uniqueId } from './service';
const createVideoSourceProvider = (...args) => new VideoSourceProvider(
xhr, ...args
);
const createVideoSourceProvider = (...args) => new VideoSourceProvider(xhr, ...args);
module.exports = createInit(Api, createVideoSourceProvider);
module.exports = createInit(Api, createVideoSourceProvider, {
getPageUrl,
getClientInfo,
uniqueId
});

@@ -1,22 +0,17 @@

import uniqueId from 'uuid/v1';
import { getPageUrl, handleConfigErrors } from './service';
import { handleConfigErrors } from './util';
const getClientInfo = () => {
try {
return window.navigator.appVersion;
} catch (e) {
return 'n/a';
}
};
export default (
Api,
createVideoSourceProvider,
{ getPageUrl, getClientInfo, uniqueId }
) => givenConfig => {
const defaultConfig = {
integrationId: null,
contentId: null,
pageUrl: getPageUrl(),
contentSessionId: uniqueId(),
clientInfo: getClientInfo(),
backendUrl: 'https://integration-sdk-eu-west-1.mes.glomex.cloud/video'
};
const DEFAULT_CONFIG = {
integrationId: null,
contentId: null,
pageUrl: getPageUrl().href,
contentSessionId: uniqueId(),
clientInfo: getClientInfo(),
backendUrl: 'https://integration-sdk-eu-west-1.mes.glomex.cloud/video'
};
export default (Api, createVideoSourceProvider) => givenConfig => {
if (!givenConfig) {

@@ -26,3 +21,3 @@ throw new Error('No config found, config object must be provided');

const config = Object.assign({}, DEFAULT_CONFIG, givenConfig);
const config = Object.assign({}, defaultConfig, givenConfig);
handleConfigErrors(config);

@@ -32,3 +27,3 @@

return new Api(videoSourceProvider);
return Api(videoSourceProvider);
};

@@ -1,32 +0,23 @@

import liteUrl from 'lite-url';
// taken from http://stackoverflow.com/questions/326069
const isInIframe = () => {
export const getPageUrl = () => {
try {
return window.self !== window.top;
} catch (e) {
return true;
return window.location.href;
} catch(e) {
return null;
}
};
const hasGlomexContext = () => window.glomexContext && window.glomexContext.pageUrl;
export const getPageUrl = () => {
if (hasGlomexContext()) {
return liteUrl(window.glomexContext.pageUrl);
export const getClientInfo = () => {
try {
return window.navigator.appVersion;
} catch (e) {
return 'n/a';
}
if (isInIframe() && window.document.referrer) {
return liteUrl(window.document.referrer);
}
return liteUrl(window.location.href);
};
export const handleConfigErrors = config => {
Object.keys(config).forEach(key => {
if (!config[key]) {
throw new Error(`config.${key} not found, ${key} must be provided`);
}
// taken from http://stackoverflow.com/a/2117523/1794177
export const uniqueId = () =>
'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
const r = Math.random() * 16 | 0;
const v = c === 'x' ? r : ((r & 0x3) | 0x8);
return v.toString(16);
});
};

@@ -1,2 +0,1 @@

import 'es6-promise';
import queryString from 'query-string';

@@ -3,0 +2,0 @@

@@ -14,4 +14,5 @@ const { resolve, join } = require('path');

output: {
globalObject: 'typeof self !== \'undefined\' ? self : this',
path: join(resolve(__dirname), 'dist'),
library: 'glomexContentSDK',
library: 'glomexContentSdk',
libraryTarget: 'umd'

@@ -18,0 +19,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc