diff --git a/dist/browser.js b/dist/browser.js index aaf68e3c9c..1861e479fd 100644 --- a/dist/browser.js +++ b/dist/browser.js @@ -525,8 +525,7 @@ var rudderanalytics = (function (exports) { function GA(config) { _classCallCheck(this, GA); - this.trackingID = config.trackingID; //UA-149602794-1 - + this.trackingID = config.trackingID; this.name = "GA"; } @@ -545,14 +544,14 @@ var rudderanalytics = (function (exports) { })(window, document, "script", "https://www.google-analytics.com/analytics.js", "ga"); //window.ga_debug = {trace: true}; - ga("create", this.trackingID, "auto"); - ga("send", "pageview"); + ga("create", this.trackingID, "auto", "rudder_ga"); //ga("send", "pageview"); + logger.debug("===in init GA==="); } }, { key: "identify", value: function identify(rudderElement) { - ga("set", "userId", rudderElement.message.anonymous_id); + ga("rudder_ga.set", "userId", rudderElement.message.anonymous_id); logger.debug("in GoogleAnalyticsManager identify"); } }, { @@ -565,6 +564,8 @@ var rudderanalytics = (function (exports) { if (rudderElement.message.properties) { eventValue = rudderElement.message.properties.value ? rudderElement.message.properties.value : rudderElement.message.properties.revenue; + eventCategory = rudderElement.message.properties.category ? rudderElement.message.properties.category : eventCategory; + eventLabel = rudderElement.message.properties.label ? rudderElement.message.properties.label : eventLabel; } var payLoad = { @@ -574,20 +575,30 @@ var rudderanalytics = (function (exports) { eventLabel: eventLabel, eventValue: eventValue }; - ga("send", "event", payLoad); + ga("rudder_ga.send", "event", payLoad); logger.debug("in GoogleAnalyticsManager track"); } }, { key: "page", value: function page(rudderElement) { logger.debug("in GoogleAnalyticsManager page"); - var path = rudderElement.properties && rudderElement.properties.path ? rudderElement.properties.path : undefined; + var path = rudderElement.message.properties && rudderElement.message.properties.path ? rudderElement.message.properties.path : undefined; + var title = rudderElement.message.properties && rudderElement.message.properties.title ? rudderElement.message.properties.title : undefined; + var location = rudderElement.message.properties && rudderElement.message.properties.url ? rudderElement.message.properties.url : undefined; if (path) { - ga("set", "page", path); + ga("rudder_ga.set", "page", path); + } + + if (title) { + ga("rudder_ga.set", "title", title); } - ga("send", "pageview"); + if (location) { + ga("rudder_ga.set", "location", location); + } + + ga("rudder_ga.send", "pageview"); } }, { key: "isLoaded", @@ -4787,7 +4798,7 @@ var rudderanalytics = (function (exports) { * @api public */ - var componentCookie = function(name, value, options){ + var rudderComponentCookie = function(name, value, options){ switch (arguments.length) { case 3: case 2: @@ -4821,6 +4832,7 @@ var rudderanalytics = (function (exports) { if (options.path) str += '; path=' + options.path; if (options.domain) str += '; domain=' + options.domain; if (options.expires) str += '; expires=' + options.expires.toUTCString(); + if (options.samesite) str += '; samesite=' + options.samesite; if (options.secure) str += '; secure'; document.cookie = str; @@ -6154,160 +6166,803 @@ var rudderanalytics = (function (exports) { var componentUrl_3 = componentUrl.isRelative; var componentUrl_4 = componentUrl.isCrossDomain; - var lib = createCommonjsModule(function (module, exports) { - /** - * Module dependencies. + * Helpers. */ - var parse = componentUrl.parse; - + var s$1 = 1000; + var m$1 = s$1 * 60; + var h$1 = m$1 * 60; + var d$1 = h$1 * 24; + var y$1 = d$1 * 365.25; /** - * Get the top domain. - * - * The function constructs the levels of domain and attempts to set a global - * cookie on each one when it succeeds it returns the top level domain. + * Parse or format the given `val`. * - * The method returns an empty string when the hostname is an ip or `localhost`. + * Options: * - * Example levels: + * - `long` verbose formatting [false] * - * domain.levels('http://www.google.co.uk'); - * // => ["co.uk", "google.co.uk", "www.google.co.uk"] + * @param {String|Number} val + * @param {Object} options + * @return {String|Number} + * @api public + */ + + var ms$1 = function(val, options){ + options = options || {}; + if ('string' == typeof val) return parse$2(val); + return options.long + ? long$1(val) + : short$1(val); + }; + + /** + * Parse the given `str` and return milliseconds. * - * Example: + * @param {String} str + * @return {Number} + * @api private + */ + + function parse$2(str) { + str = '' + str; + if (str.length > 10000) return; + var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str); + if (!match) return; + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y$1; + case 'days': + case 'day': + case 'd': + return n * d$1; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h$1; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m$1; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s$1; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + } + } + + /** + * Short format for `ms`. * - * domain('http://localhost:3000/baz'); - * // => '' - * domain('http://dev:3000/baz'); - * // => '' - * domain('http://127.0.0.1:3000/baz'); - * // => '' - * domain('http://segment.io/baz'); - * // => 'segment.io' + * @param {Number} ms + * @return {String} + * @api private + */ + + function short$1(ms) { + if (ms >= d$1) return Math.round(ms / d$1) + 'd'; + if (ms >= h$1) return Math.round(ms / h$1) + 'h'; + if (ms >= m$1) return Math.round(ms / m$1) + 'm'; + if (ms >= s$1) return Math.round(ms / s$1) + 's'; + return ms + 'ms'; + } + + /** + * Long format for `ms`. * - * @param {string} url - * @return {string} - * @api public + * @param {Number} ms + * @return {String} + * @api private */ - function domain(url) { - var cookie = exports.cookie; - var levels = exports.levels(url); - // Lookup the real top level one. - for (var i = 0; i < levels.length; ++i) { - var cname = '__tld__'; - var domain = levels[i]; - var opts = { domain: '.' + domain }; + function long$1(ms) { + return plural$1(ms, d$1, 'day') + || plural$1(ms, h$1, 'hour') + || plural$1(ms, m$1, 'minute') + || plural$1(ms, s$1, 'second') + || ms + ' ms'; + } - cookie(cname, 1, opts); - if (cookie(cname)) { - cookie(cname, null, opts); - return domain; - } - } + /** + * Pluralization helper. + */ - return ''; + function plural$1(ms, n, name) { + if (ms < n) return; + if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name; + return Math.ceil(ms / n) + ' ' + name + 's'; } + var debug_1$1 = createCommonjsModule(function (module, exports) { /** - * Levels returns all levels of the given url. + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. * - * @param {string} url - * @return {Array} - * @api public + * Expose `debug()` as the module. */ - domain.levels = function(url) { - var host = parse(url).hostname; - var parts = host.split('.'); - var last = parts[parts.length - 1]; - var levels = []; - // Ip address. - if (parts.length === 4 && last === parseInt(last, 10)) { - return levels; - } + exports = module.exports = debug; + exports.coerce = coerce; + exports.disable = disable; + exports.enable = enable; + exports.enabled = enabled; + exports.humanize = ms$1; - // Localhost. - if (parts.length <= 1) { - return levels; - } + /** + * The currently active debug mode names, and names to skip. + */ - // Create levels. - for (var i = parts.length - 2; i >= 0; --i) { - levels.push(parts.slice(i).join('.')); - } + exports.names = []; + exports.skips = []; - return levels; - }; + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lowercased letter, i.e. "n". + */ + + exports.formatters = {}; /** - * Expose cookie on domain. + * Previously assigned color. */ - domain.cookie = componentCookie; - /* - * Exports. + var prevColor = 0; + + /** + * Previous log timestamp. */ - exports = module.exports = domain; - }); + var prevTime; /** - * An object utility to persist values in cookies + * Select a color. + * + * @return {Number} + * @api private */ - var CookieLocal = - /*#__PURE__*/ - function () { - function CookieLocal(options) { - _classCallCheck(this, CookieLocal); + function selectColor() { + return exports.colors[prevColor++ % exports.colors.length]; + } - this._options = {}; - this.options(options); + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + + function debug(namespace) { + + // define the `disabled` version + function disabled() { } - /** - * - * @param {*} options - */ + disabled.enabled = false; + // define the `enabled` version + function enabled() { - _createClass(CookieLocal, [{ - key: "options", - value: function options() { - var _options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + var self = enabled; - if (arguments.length === 0) return this._options; - var domain = "." + lib(window.location.href); - if (domain === ".") domain = null; // the default maxage and path + // set `diff` timestamp + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; - this._options = defaults_1(_options, { - maxage: 31536000000, - path: "/", - domain: domain - }); //try setting a cookie first + // add the `color` if not set + if (null == self.useColors) self.useColors = exports.useColors(); + if (null == self.color && self.useColors) self.color = selectColor(); - this.set("test_rudder", true); + var args = Array.prototype.slice.call(arguments); - if (!this.get("test_rudder")) { - this._options.domain = null; - } + args[0] = exports.coerce(args[0]); - this.remove("test_rudder"); + if ('string' !== typeof args[0]) { + // anything else let's inspect with %o + args = ['%o'].concat(args); } - /** - * - * @param {*} key - * @param {*} value - */ + + // apply any `formatters` transformations + var index = 0; + args[0] = args[0].replace(/%([a-z%])/g, function(match, format) { + // if we encounter an escaped % then don't increase the array index + if (match === '%%') return match; + index++; + var formatter = exports.formatters[format]; + if ('function' === typeof formatter) { + var val = args[index]; + match = formatter.call(self, val); + + // now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + if ('function' === typeof exports.formatArgs) { + args = exports.formatArgs.apply(self, args); + } + var logFn = enabled.log || exports.log || console.log.bind(console); + logFn.apply(self, args); + } + enabled.enabled = true; + + var fn = exports.enabled(namespace) ? enabled : disabled; + + fn.namespace = namespace; + + return fn; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + + function enable(namespaces) { + exports.save(namespaces); + + var split = (namespaces || '').split(/[\s,]+/); + var len = split.length; + + for (var i = 0; i < len; i++) { + if (!split[i]) continue; // ignore empty strings + namespaces = split[i].replace(/\*/g, '.*?'); + if (namespaces[0] === '-') { + exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + exports.names.push(new RegExp('^' + namespaces + '$')); + } + } + } + + /** + * Disable debug output. + * + * @api public + */ + + function disable() { + exports.enable(''); + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + + function enabled(name) { + var i, len; + for (i = 0, len = exports.skips.length; i < len; i++) { + if (exports.skips[i].test(name)) { + return false; + } + } + for (i = 0, len = exports.names.length; i < len; i++) { + if (exports.names[i].test(name)) { + return true; + } + } + return false; + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + + function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; + } + }); + var debug_2$1 = debug_1$1.coerce; + var debug_3$1 = debug_1$1.disable; + var debug_4$1 = debug_1$1.enable; + var debug_5$1 = debug_1$1.enabled; + var debug_6$1 = debug_1$1.humanize; + var debug_7$1 = debug_1$1.names; + var debug_8$1 = debug_1$1.skips; + var debug_9$1 = debug_1$1.formatters; + + var browser$1 = createCommonjsModule(function (module, exports) { + /** + * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + + exports = module.exports = debug_1$1; + exports.log = log; + exports.formatArgs = formatArgs; + exports.save = save; + exports.load = load; + exports.useColors = useColors; + exports.storage = 'undefined' != typeof chrome + && 'undefined' != typeof chrome.storage + ? chrome.storage.local + : localstorage(); + + /** + * Colors. + */ + + exports.colors = [ + 'lightseagreen', + 'forestgreen', + 'goldenrod', + 'dodgerblue', + 'darkorchid', + 'crimson' + ]; + + /** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + + function useColors() { + // is webkit? http://stackoverflow.com/a/16459606/376773 + return ('WebkitAppearance' in document.documentElement.style) || + // is firebug? http://stackoverflow.com/a/398120/376773 + (window.console && (console.firebug || (console.exception && console.table))) || + // is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31); + } + + /** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + + exports.formatters.j = function(v) { + return JSON.stringify(v); + }; + + + /** + * Colorize log arguments if enabled. + * + * @api public + */ + + function formatArgs() { + var args = arguments; + var useColors = this.useColors; + + args[0] = (useColors ? '%c' : '') + + this.namespace + + (useColors ? ' %c' : ' ') + + args[0] + + (useColors ? '%c ' : ' ') + + '+' + exports.humanize(this.diff); + + if (!useColors) return args; + + var c = 'color: ' + this.color; + args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1)); + + // the final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + var index = 0; + var lastC = 0; + args[0].replace(/%[a-z%]/g, function(match) { + if ('%%' === match) return; + index++; + if ('%c' === match) { + // we only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); + return args; + } + + /** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + + function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === typeof console + && console.log + && Function.prototype.apply.call(console.log, console, arguments); + } + + /** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + + function save(namespaces) { + try { + if (null == namespaces) { + exports.storage.removeItem('debug'); + } else { + exports.storage.debug = namespaces; + } + } catch(e) {} + } + + /** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + + function load() { + var r; + try { + r = exports.storage.debug; + } catch(e) {} + return r; + } + + /** + * Enable namespaces listed in `localStorage.debug` initially. + */ + + exports.enable(load()); + + /** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + + function localstorage(){ + try { + return window.localStorage; + } catch (e) {} + } + }); + var browser_1$1 = browser$1.log; + var browser_2$1 = browser$1.formatArgs; + var browser_3$1 = browser$1.save; + var browser_4$1 = browser$1.load; + var browser_5$1 = browser$1.useColors; + var browser_6$1 = browser$1.storage; + var browser_7$1 = browser$1.colors; + + /** + * Module dependencies. + */ + + var debug$1 = browser$1('cookie'); + + /** + * Set or get cookie `name` with `value` and `options` object. + * + * @param {String} name + * @param {String} value + * @param {Object} options + * @return {Mixed} + * @api public + */ + + var componentCookie = function(name, value, options){ + switch (arguments.length) { + case 3: + case 2: + return set$1(name, value, options); + case 1: + return get$2(name); + default: + return all$1(); + } + }; + + /** + * Set cookie `name` to `value`. + * + * @param {String} name + * @param {String} value + * @param {Object} options + * @api private + */ + + function set$1(name, value, options) { + options = options || {}; + var str = encode$1(name) + '=' + encode$1(value); + + if (null == value) options.maxage = -1; + + if (options.maxage) { + options.expires = new Date(+new Date + options.maxage); + } + + if (options.path) str += '; path=' + options.path; + if (options.domain) str += '; domain=' + options.domain; + if (options.expires) str += '; expires=' + options.expires.toUTCString(); + if (options.secure) str += '; secure'; + if (options.samesite) str += '; samesite=' + options.samesite; + + document.cookie = str; + } + + /** + * Return all cookies. + * + * @return {Object} + * @api private + */ + + function all$1() { + var str; + try { + str = document.cookie; + } catch (err) { + if (typeof console !== 'undefined' && typeof console.error === 'function') { + console.error(err.stack || err); + } + return {}; + } + return parse$3(str); + } + + /** + * Get cookie `name`. + * + * @param {String} name + * @return {String} + * @api private + */ + + function get$2(name) { + return all$1()[name]; + } + + /** + * Parse cookie `str`. + * + * @param {String} str + * @return {Object} + * @api private + */ + + function parse$3(str) { + var obj = {}; + var pairs = str.split(/ *; */); + var pair; + if ('' == pairs[0]) return obj; + for (var i = 0; i < pairs.length; ++i) { + pair = pairs[i].split('='); + obj[decode$1(pair[0])] = decode$1(pair[1]); + } + return obj; + } + + /** + * Encode. + */ + + function encode$1(value){ + try { + return encodeURIComponent(value); + } catch (e) { + debug$1('error `encode(%o)` - %o', value, e); + } + } + + /** + * Decode. + */ + + function decode$1(value) { + try { + return decodeURIComponent(value); + } catch (e) { + debug$1('error `decode(%o)` - %o', value, e); + } + } + + var lib = createCommonjsModule(function (module, exports) { + + /** + * Module dependencies. + */ + + var parse = componentUrl.parse; + + + /** + * Get the top domain. + * + * The function constructs the levels of domain and attempts to set a global + * cookie on each one when it succeeds it returns the top level domain. + * + * The method returns an empty string when the hostname is an ip or `localhost`. + * + * Example levels: + * + * domain.levels('http://www.google.co.uk'); + * // => ["co.uk", "google.co.uk", "www.google.co.uk"] + * + * Example: + * + * domain('http://localhost:3000/baz'); + * // => '' + * domain('http://dev:3000/baz'); + * // => '' + * domain('http://127.0.0.1:3000/baz'); + * // => '' + * domain('http://segment.io/baz'); + * // => 'segment.io' + * + * @param {string} url + * @return {string} + * @api public + */ + function domain(url) { + var cookie = exports.cookie; + var levels = exports.levels(url); + + // Lookup the real top level one. + for (var i = 0; i < levels.length; ++i) { + var cname = '__tld__'; + var domain = levels[i]; + var opts = { domain: '.' + domain }; + + cookie(cname, 1, opts); + if (cookie(cname)) { + cookie(cname, null, opts); + return domain; + } + } + + return ''; + } + + /** + * Levels returns all levels of the given url. + * + * @param {string} url + * @return {Array} + * @api public + */ + domain.levels = function(url) { + var host = parse(url).hostname; + var parts = host.split('.'); + var last = parts[parts.length - 1]; + var levels = []; + + // Ip address. + if (parts.length === 4 && last === parseInt(last, 10)) { + return levels; + } + + // Localhost. + if (parts.length <= 1) { + return levels; + } + + // Create levels. + for (var i = parts.length - 2; i >= 0; --i) { + levels.push(parts.slice(i).join('.')); + } + + return levels; + }; + + /** + * Expose cookie on domain. + */ + domain.cookie = componentCookie; + + /* + * Exports. + */ + + exports = module.exports = domain; + }); + + /** + * An object utility to persist values in cookies + */ + + var CookieLocal = + /*#__PURE__*/ + function () { + function CookieLocal(options) { + _classCallCheck(this, CookieLocal); + + this._options = {}; + this.options(options); + } + /** + * + * @param {*} options + */ + + + _createClass(CookieLocal, [{ + key: "options", + value: function options() { + var _options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + if (arguments.length === 0) return this._options; + var domain = "." + lib(window.location.href); + if (domain === ".") domain = null; // the default maxage and path + + this._options = defaults_1(_options, { + maxage: 31536000000, + path: "/", + domain: domain, + samesite: "Lax" + }); //try setting a cookie first + + this.set("test_rudder", true); + + if (!this.get("test_rudder")) { + this._options.domain = null; + } + + this.remove("test_rudder"); + } + /** + * + * @param {*} key + * @param {*} value + */ }, { key: "set", value: function set(key, value) { try { value = json3.stringify(value); - componentCookie(key, value, clone_1(this._options)); + rudderComponentCookie(key, value, clone_1(this._options)); return true; } catch (e) { return false; @@ -6322,7 +6977,7 @@ var rudderanalytics = (function (exports) { key: "get", value: function get(key) { try { - var value = componentCookie(key); + var value = rudderComponentCookie(key); value = value ? json3.parse(value) : null; return value; } catch (e) { @@ -6338,7 +6993,7 @@ var rudderanalytics = (function (exports) { key: "remove", value: function remove(key) { try { - componentCookie(key, null, clone_1(this._options)); + rudderComponentCookie(key, null, clone_1(this._options)); return true; } catch (e) { return false; @@ -6822,12 +7477,13 @@ var rudderanalytics = (function (exports) { var Lotame = /*#__PURE__*/ function () { - function Lotame(config) { + function Lotame(config, analytics) { var _this = this; _classCallCheck(this, Lotame); this.name = "LOTAME"; + this.analytics = analytics; this.storage = lotameStorage; this.bcpUrlSettings = config.bcpUrlSettings; this.dspUrlSettings = config.dspUrlSettings; @@ -6856,11 +7512,11 @@ var rudderanalytics = (function (exports) { document.getElementsByTagName("body")[0].appendChild(image); } }, { - key: "synchPixel", - value: function synchPixel(userId) { + key: "syncPixel", + value: function syncPixel(userId) { var _this2 = this; - logger.debug("===== in synchPixel ======"); + logger.debug("===== in syncPixel ======"); if (this.dspUrlSettings && this.dspUrlSettings.length > 0) { this.dspUrlSettings.forEach(function (urlSettings) { @@ -6872,11 +7528,12 @@ var rudderanalytics = (function (exports) { }); } - this.storage.setLotameSynchTime(Date.now()); // this is custom to lotame, can be thought of as additional feature + this.storage.setLotameSynchTime(Date.now()); // emit on syncPixel - if (window.LOTAME_SYNCH_CALLBACK && typeof window.LOTAME_SYNCH_CALLBACK == "function") { - logger.debug("===== in synchPixel callback======"); - window.LOTAME_SYNCH_CALLBACK(); + if (this.analytics.methodToCallbackMapping["syncPixel"]) { + this.analytics.emit("syncPixel", { + destination: this.name + }); } } }, { @@ -6896,7 +7553,7 @@ var rudderanalytics = (function (exports) { value: function identify(rudderElement) { logger.debug("in Lotame identify"); var userId = rudderElement.message.userId; - this.synchPixel(userId); + this.syncPixel(userId); } }, { key: "track", @@ -6919,7 +7576,7 @@ var rudderanalytics = (function (exports) { } if (rudderElement.message.userId && this.isPixelToBeSynched()) { - this.synchPixel(rudderElement.message.userId); + this.syncPixel(rudderElement.message.userId); } } }, { @@ -8022,7 +8679,7 @@ var rudderanalytics = (function (exports) { * Expose `debug()` as the module. */ - var debug_1$1 = debug$1; + var debug_1$2 = debug$2; /** * Create a debugger with the given `name`. @@ -8032,20 +8689,20 @@ var rudderanalytics = (function (exports) { * @api public */ - function debug$1(name) { - if (!debug$1.enabled(name)) return function(){}; + function debug$2(name) { + if (!debug$2.enabled(name)) return function(){}; return function(fmt){ fmt = coerce(fmt); var curr = new Date; - var ms = curr - (debug$1[name] || curr); - debug$1[name] = curr; + var ms = curr - (debug$2[name] || curr); + debug$2[name] = curr; fmt = name + ' ' + fmt - + ' +' + debug$1.humanize(ms); + + ' +' + debug$2.humanize(ms); // This hackery is required for IE8 // where `console.log` doesn't have 'apply' @@ -8059,8 +8716,8 @@ var rudderanalytics = (function (exports) { * The currently active debug mode names. */ - debug$1.names = []; - debug$1.skips = []; + debug$2.names = []; + debug$2.skips = []; /** * Enables a debug mode by name. This can include modes @@ -8070,7 +8727,7 @@ var rudderanalytics = (function (exports) { * @api public */ - debug$1.enable = function(name) { + debug$2.enable = function(name) { try { localStorage.debug = name; } catch(e){} @@ -8081,10 +8738,10 @@ var rudderanalytics = (function (exports) { for (var i = 0; i < len; i++) { name = split[i].replace('*', '.*?'); if (name[0] === '-') { - debug$1.skips.push(new RegExp('^' + name.substr(1) + '$')); + debug$2.skips.push(new RegExp('^' + name.substr(1) + '$')); } else { - debug$1.names.push(new RegExp('^' + name + '$')); + debug$2.names.push(new RegExp('^' + name + '$')); } } }; @@ -8095,8 +8752,8 @@ var rudderanalytics = (function (exports) { * @api public */ - debug$1.disable = function(){ - debug$1.enable(''); + debug$2.disable = function(){ + debug$2.enable(''); }; /** @@ -8107,7 +8764,7 @@ var rudderanalytics = (function (exports) { * @api private */ - debug$1.humanize = function(ms) { + debug$2.humanize = function(ms) { var sec = 1000 , min = 60 * 1000 , hour = 60 * min; @@ -8126,14 +8783,14 @@ var rudderanalytics = (function (exports) { * @api public */ - debug$1.enabled = function(name) { - for (var i = 0, len = debug$1.skips.length; i < len; i++) { - if (debug$1.skips[i].test(name)) { + debug$2.enabled = function(name) { + for (var i = 0, len = debug$2.skips.length; i < len; i++) { + if (debug$2.skips[i].test(name)) { return false; } } - for (var i = 0, len = debug$1.names.length; i < len; i++) { - if (debug$1.names[i].test(name)) { + for (var i = 0, len = debug$2.names.length; i < len; i++) { + if (debug$2.names[i].test(name)) { return true; } } @@ -8152,7 +8809,7 @@ var rudderanalytics = (function (exports) { // persist try { - if (window.localStorage) debug$1.enable(localStorage.debug); + if (window.localStorage) debug$2.enable(localStorage.debug); } catch(e){} var componentEmitter = createCommonjsModule(function (module) { @@ -8335,7 +8992,7 @@ var rudderanalytics = (function (exports) { - var debug$2 = debug_1$1('localstorage-retry'); + var debug$3 = debug_1$2('localstorage-retry'); // Some browsers don't support Function.prototype.bind, so just including a simplified version here @@ -8566,7 +9223,7 @@ var rudderanalytics = (function (exports) { try { self.fn(el.item, el.done); } catch (err) { - debug$2('Process function threw error: ' + err); + debug$3('Process function threw error: ' + err); } }, toRun); @@ -9222,6 +9879,9 @@ var rudderanalytics = (function (exports) { this.readyCallback = function () {}; this.executeReadyCallback = undefined; + this.methodToCallbackMapping = { + syncPixel: "syncPixelCallback" + }; } /** * Process the response from control plane and @@ -9306,13 +9966,19 @@ var rudderanalytics = (function (exports) { }, { key: "replayEvents", value: function replayEvents(object) { - if (object.successfullyLoadedIntegration.length + object.failedToBeLoadedIntegration.length == object.clientIntegrations.length) { + if (object.successfullyLoadedIntegration.length + object.failedToBeLoadedIntegration.length == object.clientIntegrations.length && object.toBeProcessedByIntegrationArray.length > 0) { + logger.debug("===replay events called====", object.successfullyLoadedIntegration.length, object.failedToBeLoadedIntegration.length); object.clientIntegrationObjects = []; object.clientIntegrationObjects = object.successfullyLoadedIntegration; + logger.debug("==registering after callback===", object.clientIntegrationObjects.length); object.executeReadyCallback = after_1(object.clientIntegrationObjects.length, object.readyCallback); + logger.debug("==registering ready callback==="); object.on("ready", object.executeReadyCallback); object.clientIntegrationObjects.forEach(function (intg) { + logger.debug("===looping over each successful integration===="); + if (!intg["isReady"] || intg["isReady"]()) { + logger.debug("===letting know I am ready=====", intg["name"]); object.emit("ready"); } }); //send the queued events to the fetched integration @@ -9354,6 +10020,8 @@ var rudderanalytics = (function (exports) { var time = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; return new Promise(function (resolve) { if (instance.isLoaded()) { + logger.debug("===integration loaded successfully====", instance["name"]); + _this2.successfullyLoadedIntegration.push(instance); return resolve(_this2); @@ -9368,6 +10036,7 @@ var rudderanalytics = (function (exports) { } _this2.pause(INTEGRATION_LOAD_CHECK_INTERVAL).then(function () { + logger.debug("====after pause, again checking===="); return _this2.isInitialized(instance, time + INTEGRATION_LOAD_CHECK_INTERVAL).then(resolve); }); }); @@ -9830,6 +10499,20 @@ var rudderanalytics = (function (exports) { logger.error("ready callback is not a function"); } + }, { + key: "registerCallbacks", + value: function registerCallbacks() { + var _this3 = this; + + Object.keys(this.methodToCallbackMapping).forEach(function (methodName) { + if (_this3.methodToCallbackMapping.hasOwnProperty(methodName)) { + var callback = !!window.rudderanalytics ? typeof window.rudderanalytics[_this3.methodToCallbackMapping[methodName]] == "function" ? window.rudderanalytics[_this3.methodToCallbackMapping[methodName]] : function () {} : function () {}; + logger.debug("registerCallbacks", methodName, callback); + + _this3.on(methodName, callback); + } + }); + } }]); return Analytics; @@ -9845,12 +10528,15 @@ var rudderanalytics = (function (exports) { componentEmitter(instance); { + // register supported callbacks + instance.registerCallbacks(); var eventsPushedAlready = !!window.rudderanalytics && window.rudderanalytics.push == Array.prototype.push; var methodArg = window.rudderanalytics ? window.rudderanalytics[0] : []; if (methodArg.length > 0 && methodArg[0] == "load") { var method = methodArg[0]; methodArg.shift(); + logger.debug("=====from init, calling method:: ", method); instance[method].apply(instance, _toConsumableArray(methodArg)); } @@ -9864,6 +10550,7 @@ var rudderanalytics = (function (exports) { var _method = event[0]; event.shift(); + logger.debug("=====from init, calling method:: ", _method); instance[_method].apply(instance, _toConsumableArray(event)); } diff --git a/dist/rudder-analytics.min.br.js.br b/dist/rudder-analytics.min.br.js.br index 47bb635497..1d260d170d 100644 Binary files a/dist/rudder-analytics.min.br.js.br and b/dist/rudder-analytics.min.br.js.br differ diff --git a/dist/rudder-analytics.min.gzip.js.gz b/dist/rudder-analytics.min.gzip.js.gz index e0aaa3c28e..8645e6bf2d 100644 Binary files a/dist/rudder-analytics.min.gzip.js.gz and b/dist/rudder-analytics.min.gzip.js.gz differ diff --git a/dist/rudder-analytics.min.js b/dist/rudder-analytics.min.js index 4b63cefa57..307be78769 100644 --- a/dist/rudder-analytics.min.js +++ b/dist/rudder-analytics.min.js @@ -1 +1 @@ -var rudderanalytics=function(e){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n-1?t:t+e:window.location.href,r=n.indexOf("#");return r>-1?n.slice(0,r):n}(r)}}function y(){for(var e,t=document.getElementsByTagName("link"),n=0;e=t[n];n++)if("canonical"===e.getAttribute("rel"))return e.getAttribute("href")}function m(e,t){var n=e.revenue;return!n&&t&&t.match(/^[ _]?completed[ _]?order[ _]?|^[ _]?order[ _]?completed[ _]?$/i)&&(n=e.total),function(e){if(e){if("number"==typeof e)return e;if("string"==typeof e)return e=e.replace(/\$/g,""),e=parseFloat(e),isNaN(e)?void 0:e}}(n)}var v={TRACK:"track",PAGE:"page",IDENTIFY:"identify"},b={PRODUCTS_SEARCHED:"Products Searched",PRODUCT_LIST_VIEWED:"Product List Viewed",PRODUCT_LIST_FILTERED:"Product List Filtered",PROMOTION_VIEWED:"Promotion Viewed",PROMOTION_CLICKED:"Promotion Clicked",PRODUCT_CLICKED:"Product Clicked",PRODUCT_VIEWED:"Product Viewed",PRODUCT_ADDED:"Product Added",PRODUCT_REMOVED:"Product Removed",CART_VIEWED:"Cart Viewed",CHECKOUT_STARTED:"Checkout Started",CHECKOUT_STEP_VIEWED:"Checkout Step Viewed",CHECKOUT_STEP_COMPLETED:"Checkout Step Completed",PAYMENT_INFO_ENTERED:"Payment Info Entered",ORDER_UPDATED:"Order Updated",ORDER_COMPLETED:"Order Completed",ORDER_REFUNDED:"Order Refunded",ORDER_CANCELLED:"Order Cancelled",COUPON_ENTERED:"Coupon Entered",COUPON_APPLIED:"Coupon Applied",COUPON_DENIED:"Coupon Denied",COUPON_REMOVED:"Coupon Removed",PRODUCT_ADDED_TO_WISHLIST:"Product Added to Wishlist",PRODUCT_REMOVED_FROM_WISHLIST:"Product Removed from Wishlist",WISH_LIST_PRODUCT_ADDED_TO_CART:"Wishlist Product Added to Cart",PRODUCT_SHARED:"Product Shared",CART_SHARED:"Cart Shared",PRODUCT_REVIEWED:"Product Reviewed"},w="http://18.222.145.124:5000/dump";function k(e,t){l.debug("in script loader=== "+e);var n=document.createElement("script");n.src=t,n.type="text/javascript",n.id=e;var r=document.getElementsByTagName("script")[0];l.debug("==script==",r),r.parentNode.insertBefore(n,r)}var _=function(){function e(t){n(this,e),this.hubId=t.hubID,this.name="HS"}return i(e,[{key:"init",value:function(){k("hubspot-integration","http://js.hs-scripts.com/"+this.hubId+".js"),l.debug("===in init HS===")}},{key:"identify",value:function(e){l.debug("in HubspotAnalyticsManager identify");var n=e.message.context.traits,r={};for(var i in n)if(Object.getOwnPropertyDescriptor(n,i)&&n[i]){var o=i;"[object Date]"==toString.call(n[i])?r[o]=n[i].getTime():r[o]=n[i]}var s=e.message.context.user_properties;for(var a in s){if(Object.getOwnPropertyDescriptor(s,a)&&s[a])r[a]=s[a]}(l.debug(r),void 0!==("undefined"==typeof window?"undefined":t(window)))&&(window._hsq=window._hsq||[]).push(["identify",r])}},{key:"track",value:function(e){l.debug("in HubspotAnalyticsManager track");var t=window._hsq=window._hsq||[],n={};n.id=e.message.event,e.message.properties&&(e.message.properties.revenue||e.message.properties.value)&&(n.value=e.message.properties.revenue||e.message.properties.value),t.push(["trackEvent",n])}},{key:"page",value:function(e){l.debug("in HubspotAnalyticsManager page");var t=window._hsq=window._hsq||[];e.message.properties&&e.message.properties.path&&t.push(["setPath",e.message.properties.path]),t.push(["trackPageView"])}},{key:"isLoaded",value:function(){return l.debug("in hubspot isLoaded"),!(!window._hsq||window._hsq.push===Array.prototype.push)}},{key:"isReady",value:function(){return!(!window._hsq||window._hsq.push===Array.prototype.push)}}]),e}(),E=function(){function e(t){n(this,e),this.trackingID=t.trackingID,this.name="GA"}return i(e,[{key:"init",value:function(){!function(e,t,n,r,i,o,s){e.GoogleAnalyticsObject=i,e.ga=e.ga||function(){(e.ga.q=e.ga.q||[]).push(arguments)},e.ga.l=1*new Date,o=t.createElement(n),s=t.getElementsByTagName(n)[0],o.async=1,o.src="https://www.google-analytics.com/analytics.js",s.parentNode.insertBefore(o,s)}(window,document,"script",0,"ga"),ga("create",this.trackingID,"auto"),ga("send","pageview"),l.debug("===in init GA===")}},{key:"identify",value:function(e){ga("set","userId",e.message.anonymous_id),l.debug("in GoogleAnalyticsManager identify")}},{key:"track",value:function(e){var t=e.message.event,n=e.message.event,r=e.message.event,i="";e.message.properties&&(i=e.message.properties.value?e.message.properties.value:e.message.properties.revenue),ga("send","event",{hitType:"event",eventCategory:t,eventAction:n,eventLabel:r,eventValue:i}),l.debug("in GoogleAnalyticsManager track")}},{key:"page",value:function(e){l.debug("in GoogleAnalyticsManager page");var t=e.properties&&e.properties.path?e.properties.path:void 0;t&&ga("set","page",t),ga("send","pageview")}},{key:"isLoaded",value:function(){return l.debug("in GA isLoaded"),!!window.gaplugins}},{key:"isReady",value:function(){return!!window.gaplugins}}]),e}(),I=function(){function e(t){n(this,e),this.siteId=t.siteID,this.name="HOTJAR",this._ready=!1}return i(e,[{key:"init",value:function(){window.hotjarSiteId=this.siteId,function(e,t,n,r,i,o){e.hj=e.hj||function(){(e.hj.q=e.hj.q||[]).push(arguments)},e._hjSettings={hjid:e.hotjarSiteId,hjsv:6},i=t.getElementsByTagName("head")[0],(o=t.createElement("script")).async=1,o.src="https://static.hotjar.com/c/hotjar-"+e._hjSettings.hjid+".js?sv="+e._hjSettings.hjsv,i.appendChild(o)}(window,document),this._ready=!0,l.debug("===in init Hotjar===")}},{key:"identify",value:function(e){if(e.message.userId||e.message.anonymousId){var t=e.message.context.traits;window.hj("identify",e.message.userId,t)}else l.error("user id is required")}},{key:"track",value:function(e){l.error("method not supported")}},{key:"page",value:function(e){l.error("method not supported")}},{key:"isLoaded",value:function(){return this._ready}},{key:"isReady",value:function(){return this._ready}}]),e}(),A=function(){function e(t){n(this,e),this.conversionId=t.conversionID,this.pageLoadConversions=t.pageLoadConversions,this.clickEventConversions=t.clickEventConversions,this.name="GOOGLEADS"}return i(e,[{key:"init",value:function(){!function(e,t,n){l.debug("in script loader=== "+e);var r=n.createElement("script");r.src=t,r.async=1,r.type="text/javascript",r.id=e;var i=n.getElementsByTagName("head")[0];l.debug("==script==",i),i.appendChild(r)}("googleAds-integration","https://www.googletagmanager.com/gtag/js?id="+this.conversionId,document),window.dataLayer=window.dataLayer||[],window.gtag=function(){window.dataLayer.push(arguments)},window.gtag("js",new Date),window.gtag("config",this.conversionId),l.debug("===in init Google Ads===")}},{key:"identify",value:function(e){l.error("method not supported")}},{key:"track",value:function(e){l.debug("in GoogleAdsAnalyticsManager track");var t=this.getConversionData(this.clickEventConversions,e.message.event);if(t.conversionLabel){var n=t.conversionLabel,r=t.eventName,i=this.conversionId+"/"+n,o={};e.properties&&(o.value=e.properties.revenue,o.currency=e.properties.currency,o.transaction_id=e.properties.order_id),o.send_to=i,window.gtag("event",r,o)}}},{key:"page",value:function(e){l.debug("in GoogleAdsAnalyticsManager page");var t=this.getConversionData(this.pageLoadConversions,e.message.name);if(t.conversionLabel){var n=t.conversionLabel,r=t.eventName;window.gtag("event",r,{send_to:this.conversionId+"/"+n})}}},{key:"getConversionData",value:function(e,t){var n={};return e&&e.forEach((function(e){if(e.name.toLowerCase()===t.toLowerCase())return n.conversionLabel=e.conversionLabel,void(n.eventName=e.name)})),n}},{key:"isLoaded",value:function(){return window.dataLayer.push!==Array.prototype.push}},{key:"isReady",value:function(){return window.dataLayer.push!==Array.prototype.push}}]),e}(),T=function(){function e(t){n(this,e),this.accountId=t.accountId,this.settingsTolerance=t.settingsTolerance,this.isSPA=t.isSPA,this.libraryTolerance=t.libraryTolerance,this.useExistingJquery=t.useExistingJquery,this.sendExperimentTrack=t.sendExperimentTrack,this.sendExperimentIdentify=t.sendExperimentIdentify,this.name="VWO",l.debug("Config ",t)}return i(e,[{key:"init",value:function(){l.debug("===in init VWO===");var e=this.accountId,t=this.settingsTolerance,n=this.libraryTolerance,r=this.useExistingJquery,i=this.isSPA;window._vwo_code=function(){var o=!1,s=document;return{use_existing_jquery:function(){return r},library_tolerance:function(){return n},finish:function(){if(!o){o=!0;var e=s.getElementById("_vis_opt_path_hides");e&&e.parentNode.removeChild(e)}},finished:function(){return o},load:function(e){var t=s.createElement("script");t.src=e,t.type="text/javascript",t.innerText,t.onerror=function(){_vwo_code.finish()},s.getElementsByTagName("head")[0].appendChild(t)},init:function(){var n=setTimeout("_vwo_code.finish()",t),r=s.createElement("style"),o="body{opacity:0 !important;filter:alpha(opacity=0) !important;background:none !important;}",a=s.getElementsByTagName("head")[0];return r.setAttribute("id","_vis_opt_path_hides"),r.setAttribute("type","text/css"),r.styleSheet?r.styleSheet.cssText=o:r.appendChild(s.createTextNode(o)),a.appendChild(r),this.load("//dev.visualwebsiteoptimizer.com/j.php?a="+e+"&u="+encodeURIComponent(s.URL)+"&r="+Math.random()+"&f="+ +i),n}}}(),window._vwo_settings_timer=window._vwo_code.init(),(this.sendExperimentTrack||this.experimentViewedIdentify)&&this.experimentViewed()}},{key:"experimentViewed",value:function(){window.VWO=window.VWO||[];var e=this;window.VWO.push(["onVariationApplied",function(t){if(t){l.debug("Variation Applied");var n=t[1],r=t[2];if(l.debug("experiment id:",n,"Variation Name:",_vwo_exp[n].comb_n[r]),void 0!==_vwo_exp[n].comb_n[r]&&["VISUAL_AB","VISUAL","SPLIT_URL","SURVEY"].indexOf(_vwo_exp[n].type)>-1){try{e.sendExperimentTrack&&(l.debug("Tracking..."),window.rudderanalytics.track("Experiment Viewed",{experimentId:n,variationName:_vwo_exp[n].comb_n[r]}))}catch(e){l.error(e)}try{e.sendExperimentIdentify&&(l.debug("Identifying..."),window.rudderanalytics.identify(o({},"Experiment: ".concat(n),_vwo_exp[n].comb_n[r])))}catch(e){l.error(e)}}}}])}},{key:"identify",value:function(e){l.debug("method not supported")}},{key:"track",value:function(e){if("Order Completed"===e.message.event){var t=e.message.properties?e.message.properties.total||e.message.properties.revenue:0;l.debug("Revenue",t),window.VWO=window.VWO||[],window.VWO.push(["track.revenueConversion",t])}}},{key:"page",value:function(e){l.debug("method not supported")}},{key:"isLoaded",value:function(){return!!window._vwo_code}},{key:"isReady",value:function(){return!!window._vwo_code}}]),e}(),C=function(){function e(t){n(this,e),this.containerID=t.containerID,this.name="GOOGLETAGMANAGER"}return i(e,[{key:"init",value:function(){l.debug("===in init GoogleTagManager==="),function(e,t,n,r,i){e[r]=e[r]||[],e[r].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var o=t.getElementsByTagName(n)[0],s=t.createElement(n);s.async=!0,s.src="https://www.googletagmanager.com/gtm.js?id="+i,o.parentNode.insertBefore(s,o)}(window,document,"script","dataLayer",this.containerID)}},{key:"identify",value:function(e){l.error("method not supported")}},{key:"track",value:function(e){l.debug("===in track GoogleTagManager===");var t=e.message,n=a({event:t.event,userId:t.userId,anonymousId:t.anonymousId},t.properties);this.sendToGTMDatalayer(n)}},{key:"page",value:function(e){l.debug("===in page GoogleTagManager===");var t,n=e.message,r=n.name,i=n.properties?n.properties.category:void 0;r&&(t="Viewed "+r+" page"),i&&r&&(t="Viewed "+i+" "+r+" page");var o=a({event:t,userId:n.userId,anonymousId:n.anonymousId},n.properties);this.sendToGTMDatalayer(o)}},{key:"isLoaded",value:function(){return!(!window.dataLayer||Array.prototype.push===window.dataLayer.push)}},{key:"sendToGTMDatalayer",value:function(e){window.dataLayer.push(e)}},{key:"isReady",value:function(){return!(!window.dataLayer||Array.prototype.push===window.dataLayer.push)}}]),e}(),O=function(){function e(t,r){if(n(this,e),this.analytics=r,this.appKey=t.appKey,t.appKey||(this.appKey=""),this.endPoint="",t.dataCenter){var i=t.dataCenter.trim().split("-");"eu"===i[0].toLowerCase()?this.endPoint="sdk.fra-01.braze.eu":this.endPoint="sdk.iad-"+i[1]+".braze.com"}this.name="BRAZE",l.debug("Config ",t)}return i(e,[{key:"formatGender",value:function(e){if(e&&"string"==typeof e){return["woman","female","w","f"].indexOf(e.toLowerCase())>-1?window.appboy.ab.User.Genders.FEMALE:["man","male","m"].indexOf(e.toLowerCase())>-1?window.appboy.ab.User.Genders.MALE:["other","o"].indexOf(e.toLowerCase())>-1?window.appboy.ab.User.Genders.OTHER:void 0}}},{key:"init",value:function(){l.debug("===in init Braze==="),function(e,t,n,r,i){e.appboy={},e.appboyQueue=[];for(var o="initialize destroy getDeviceId toggleAppboyLogging setLogger openSession changeUser requestImmediateDataFlush requestFeedRefresh subscribeToFeedUpdates requestContentCardsRefresh subscribeToContentCardsUpdates logCardImpressions logCardClick logCardDismissal logFeedDisplayed logContentCardsDisplayed logInAppMessageImpression logInAppMessageClick logInAppMessageButtonClick logInAppMessageHtmlClick subscribeToNewInAppMessages subscribeToInAppMessage removeSubscription removeAllSubscriptions logCustomEvent logPurchase isPushSupported isPushBlocked isPushGranted isPushPermissionGranted registerAppboyPushMessages unregisterAppboyPushMessages trackLocation stopWebTracking resumeWebTracking wipeData ab ab.DeviceProperties ab.User ab.User.Genders ab.User.NotificationSubscriptionTypes ab.User.prototype.getUserId ab.User.prototype.setFirstName ab.User.prototype.setLastName ab.User.prototype.setEmail ab.User.prototype.setGender ab.User.prototype.setDateOfBirth ab.User.prototype.setCountry ab.User.prototype.setHomeCity ab.User.prototype.setLanguage ab.User.prototype.setEmailNotificationSubscriptionType ab.User.prototype.setPushNotificationSubscriptionType ab.User.prototype.setPhoneNumber ab.User.prototype.setAvatarImageUrl ab.User.prototype.setLastKnownLocation ab.User.prototype.setUserAttribute ab.User.prototype.setCustomUserAttribute ab.User.prototype.addToCustomAttributeArray ab.User.prototype.removeFromCustomAttributeArray ab.User.prototype.incrementCustomUserAttribute ab.User.prototype.addAlias ab.User.prototype.setCustomLocationAttribute ab.InAppMessage ab.InAppMessage.SlideFrom ab.InAppMessage.ClickAction ab.InAppMessage.DismissType ab.InAppMessage.OpenTarget ab.InAppMessage.ImageStyle ab.InAppMessage.TextAlignment ab.InAppMessage.Orientation ab.InAppMessage.CropType ab.InAppMessage.prototype.subscribeToClickedEvent ab.InAppMessage.prototype.subscribeToDismissedEvent ab.InAppMessage.prototype.removeSubscription ab.InAppMessage.prototype.removeAllSubscriptions ab.InAppMessage.prototype.closeMessage ab.InAppMessage.Button ab.InAppMessage.Button.prototype.subscribeToClickedEvent ab.InAppMessage.Button.prototype.removeSubscription ab.InAppMessage.Button.prototype.removeAllSubscriptions ab.SlideUpMessage ab.ModalMessage ab.FullScreenMessage ab.HtmlMessage ab.ControlMessage ab.Feed ab.Feed.prototype.getUnreadCardCount ab.ContentCards ab.ContentCards.prototype.getUnviewedCardCount ab.Card ab.Card.prototype.dismissCard ab.ClassicCard ab.CaptionedImage ab.Banner ab.ControlCard ab.WindowUtils display display.automaticallyShowNewInAppMessages display.showInAppMessage display.showFeed display.destroyFeed display.toggleFeed display.showContentCards display.hideContentCards display.toggleContentCards sharedLib".split(" "),s=0;s>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&n.rotl(e,8)|4278255360&n.rotl(e,24);for(var t=0;t0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,r=0;n>>5]|=e[n]<<24-r%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n>>6*(3-o)&63)):n.push("=");return n.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var n=[],r=0,i=0;r>>6-2*i);return n}};e.exports=n}()})),R={utf8:{stringToBytes:function(e){return R.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(R.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n>>24)|4278255360&(a[p]<<24|a[p]>>>8);a[u>>>5]|=128<>>9<<4)]=u;var h=o._ff,g=o._gg,y=o._hh,m=o._ii;for(p=0;p>>0,l=l+b>>>0,d=d+w>>>0,f=f+k>>>0}return t.endian([c,l,d,f])};o._ff=function(e,t,n,r,i,o,s){var a=e+(t&n|~t&r)+(i>>>0)+s;return(a<>>32-o)+t},o._gg=function(e,t,n,r,i,o,s){var a=e+(t&r|n&~r)+(i>>>0)+s;return(a<>>32-o)+t},o._hh=function(e,t,n,r,i,o,s){var a=e+(t^n^r)+(i>>>0)+s;return(a<>>32-o)+t},o._ii=function(e,t,n,r,i,o,s){var a=e+(n^(t|~r))+(i>>>0)+s;return(a<>>32-o)+t},o._blocksize=16,o._digestsize=16,e.exports=function(e,n){if(null==e)throw new Error("Illegal argument "+e);var r=t.wordsToBytes(o(e,n));return n&&n.asBytes?r:n&&n.asString?i.bytesToString(r):t.bytesToHex(r)}}()})),B=function(){function e(t){n(this,e),this.NAME="INTERCOM",this.API_KEY=t.apiKey,this.APP_ID=t.appId,this.MOBILE_APP_ID=t.mobileAppId,l.debug("Config ",t)}return i(e,[{key:"init",value:function(){window.intercomSettings={app_id:this.APP_ID},function(){var e=window,t=e.Intercom;if("function"==typeof t)t("reattach_activator"),t("update",e.intercomSettings);else{var n=document,r=function e(){e.c(arguments)};r.q=[],r.c=function(e){r.q.push(e)},e.Intercom=r;var i=function(){var e=n.createElement("script");e.type="text/javascript",e.async=!0,e.src="https://widget.intercom.io/widget/"+window.intercomSettings.app_id;var t=n.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)};"complete"===document.readyState?(i(),window.intercom_code=!0):e.attachEvent?(e.attachEvent("onload",i),window.intercom_code=!0):(e.addEventListener("load",i,!1),window.intercom_code=!0)}}()}},{key:"page",value:function(){window.Intercom("update")}},{key:"identify",value:function(e){var n={},r=e.message.context;if(null!=(r.Intercom?r.Intercom:null)){var i=r.Intercom.user_hash?r.Intercom.user_hash:null;null!=i&&(n.user_hash=i);var o=r.Intercom.hideDefaultLauncher?r.Intercom.hideDefaultLauncher:null;null!=o&&(n.hide_default_launcher=o)}Object.keys(r.traits).forEach((function(e){if(r.traits.hasOwnProperty(e)){var i=r.traits[e];if("company"===e){var o=[],s={};"string"==typeof r.traits[e]&&(s.company_id=M(r.traits[e]));var a="object"==t(r.traits[e])&&Object.keys(r.traits[e])||[];a.forEach((function(t){a.hasOwnProperty(t)&&("id"!=t?s[t]=r.traits[e][t]:s.company_id=r.traits[e][t])})),"object"!=t(r.traits[e])||a.includes("id")||(s.company_id=M(s.name)),o.push(s),n.companies=o}else n[e]=r.traits[e];switch(e){case"createdAt":n.created_at=i;break;case"anonymousId":n.user_id=i}}})),n.user_id=e.message.userId,window.Intercom("update",n)}},{key:"track",value:function(e){var t={},n=e.message;(n.properties?Object.keys(n.properties):null).forEach((function(e){var r=n.properties[e];t[e]=r})),n.event&&(t.event_name=n.event),t.user_id=n.userId?n.userId:n.anonymousId,t.created_at=Math.floor(new Date(n.originalTimestamp).getTime()/1e3),window.Intercom("trackEvent",t.event_name,t)}},{key:"isLoaded",value:function(){return!!window.intercom_code}},{key:"isReady",value:function(){return!!window.intercom_code}}]),e}(),F=function(){function e(t){n(this,e),this.projectID=t.projectID,this.writeKey=t.writeKey,this.ipAddon=t.ipAddon,this.uaAddon=t.uaAddon,this.urlAddon=t.urlAddon,this.referrerAddon=t.referrerAddon,this.client=null,this.name="KEEN"}return i(e,[{key:"init",value:function(){l.debug("===in init Keen==="),k("keen-integration","https://cdn.jsdelivr.net/npm/keen-tracking@4");var e=setInterval(function(){void 0!==window.KeenTracking&&void 0!==window.KeenTracking&&(this.client=function(e){return e.client=new window.KeenTracking({projectId:e.projectID,writeKey:e.writeKey}),e.client}(this),clearInterval(e))}.bind(this),1e3)}},{key:"identify",value:function(e){l.debug("in Keen identify");var t=e.message.context.traits,n=e.message.userId?e.message.userId:e.message.anonymousId,r=e.message.properties?Object.assign(r,e.message.properties):{};r.user={userId:n,traits:t},r=this.getAddOn(r),this.client.extendEvents(r)}},{key:"track",value:function(e){l.debug("in Keen track");var t=e.message.event,n=e.message.properties;n=this.getAddOn(n),this.client.recordEvent(t,n)}},{key:"page",value:function(e){l.debug("in Keen page");var t=e.message.name,n=e.message.properties?e.message.properties.category:void 0,r="Loaded a Page";t&&(r="Viewed "+t+" page"),n&&t&&(r="Viewed "+n+" "+t+" page");var i=e.message.properties;i=this.getAddOn(i),this.client.recordEvent(r,i)}},{key:"isLoaded",value:function(){return l.debug("in Keen isLoaded"),!(null==this.client)}},{key:"isReady",value:function(){return!(null==this.client)}},{key:"getAddOn",value:function(e){var t=[];return this.ipAddon&&(e.ip_address="${keen.ip}",t.push({name:"keen:ip_to_geo",input:{ip:"ip_address"},output:"ip_geo_info"})),this.uaAddon&&(e.user_agent="${keen.user_agent}",t.push({name:"keen:ua_parser",input:{ua_string:"user_agent"},output:"parsed_user_agent"})),this.urlAddon&&(e.page_url=document.location.href,t.push({name:"keen:url_parser",input:{url:"page_url"},output:"parsed_page_url"})),this.referrerAddon&&(e.page_url=document.location.href,e.referrer_url=document.referrer,t.push({name:"keen:referrer_parser",input:{referrer_url:"referrer_url",page_url:"page_url"},output:"referrer_info"})),e.keen={addons:t},e}}]),e}(),K=Object.prototype,q=K.hasOwnProperty,G=K.toString;"function"==typeof Symbol&&(N=Symbol.prototype.valueOf),"function"==typeof BigInt&&(L=BigInt.prototype.valueOf);var H=function(e){return e!=e},V={boolean:1,number:1,string:1,undefined:1},z=/^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$/,J=/^[A-Fa-f0-9]+$/,W={};W.a=W.type=function(e,t){return typeof e===t},W.defined=function(e){return void 0!==e},W.empty=function(e){var t,n=G.call(e);if("[object Array]"===n||"[object Arguments]"===n||"[object String]"===n)return 0===e.length;if("[object Object]"===n){for(t in e)if(q.call(e,t))return!1;return!0}return!e},W.equal=function(e,t){if(e===t)return!0;var n,r=G.call(e);if(r!==G.call(t))return!1;if("[object Object]"===r){for(n in e)if(!(W.equal(e[n],t[n])&&n in t))return!1;for(n in t)if(!(W.equal(e[n],t[n])&&n in e))return!1;return!0}if("[object Array]"===r){if((n=e.length)!==t.length)return!1;for(;n--;)if(!W.equal(e[n],t[n]))return!1;return!0}return"[object Function]"===r?e.prototype===t.prototype:"[object Date]"===r&&e.getTime()===t.getTime()},W.hosted=function(e,t){var n=typeof t[e];return"object"===n?!!t[e]:!V[n]},W.instance=W.instanceof=function(e,t){return e instanceof t},W.nil=W.null=function(e){return null===e},W.undef=W.undefined=function(e){return void 0===e},W.args=W.arguments=function(e){var t="[object Arguments]"===G.call(e),n=!W.array(e)&&W.arraylike(e)&&W.object(e)&&W.fn(e.callee);return t||n},W.array=Array.isArray||function(e){return"[object Array]"===G.call(e)},W.args.empty=function(e){return W.args(e)&&0===e.length},W.array.empty=function(e){return W.array(e)&&0===e.length},W.arraylike=function(e){return!!e&&!W.bool(e)&&q.call(e,"length")&&isFinite(e.length)&&W.number(e.length)&&e.length>=0},W.bool=W.boolean=function(e){return"[object Boolean]"===G.call(e)},W.false=function(e){return W.bool(e)&&!1===Boolean(Number(e))},W.true=function(e){return W.bool(e)&&!0===Boolean(Number(e))},W.date=function(e){return"[object Date]"===G.call(e)},W.date.valid=function(e){return W.date(e)&&!isNaN(Number(e))},W.element=function(e){return void 0!==e&&"undefined"!=typeof HTMLElement&&e instanceof HTMLElement&&1===e.nodeType},W.error=function(e){return"[object Error]"===G.call(e)},W.fn=W.function=function(e){if("undefined"!=typeof window&&e===window.alert)return!0;var t=G.call(e);return"[object Function]"===t||"[object GeneratorFunction]"===t||"[object AsyncFunction]"===t},W.number=function(e){return"[object Number]"===G.call(e)},W.infinite=function(e){return e===1/0||e===-1/0},W.decimal=function(e){return W.number(e)&&!H(e)&&!W.infinite(e)&&e%1!=0},W.divisibleBy=function(e,t){var n=W.infinite(e),r=W.infinite(t),i=W.number(e)&&!H(e)&&W.number(t)&&!H(t)&&0!==t;return n||r||i&&e%t==0},W.integer=W.int=function(e){return W.number(e)&&!H(e)&&e%1==0},W.maximum=function(e,t){if(H(e))throw new TypeError("NaN is not a valid value");if(!W.arraylike(t))throw new TypeError("second argument must be array-like");for(var n=t.length;--n>=0;)if(e=0;)if(e>t[n])return!1;return!0},W.nan=function(e){return!W.number(e)||e!=e},W.even=function(e){return W.infinite(e)||W.number(e)&&e==e&&e%2==0},W.odd=function(e){return W.infinite(e)||W.number(e)&&e==e&&e%2!=0},W.ge=function(e,t){if(H(e)||H(t))throw new TypeError("NaN is not a valid value");return!W.infinite(e)&&!W.infinite(t)&&e>=t},W.gt=function(e,t){if(H(e)||H(t))throw new TypeError("NaN is not a valid value");return!W.infinite(e)&&!W.infinite(t)&&e>t},W.le=function(e,t){if(H(e)||H(t))throw new TypeError("NaN is not a valid value");return!W.infinite(e)&&!W.infinite(t)&&e<=t},W.lt=function(e,t){if(H(e)||H(t))throw new TypeError("NaN is not a valid value");return!W.infinite(e)&&!W.infinite(t)&&e=t&&e<=n},W.object=function(e){return"[object Object]"===G.call(e)},W.primitive=function(e){return!e||!("object"==typeof e||W.object(e)||W.fn(e)||W.array(e))},W.hash=function(e){return W.object(e)&&e.constructor===Object&&!e.nodeType&&!e.setInterval},W.regexp=function(e){return"[object RegExp]"===G.call(e)},W.string=function(e){return"[object String]"===G.call(e)},W.base64=function(e){return W.string(e)&&(!e.length||z.test(e))},W.hex=function(e){return W.string(e)&&(!e.length||J.test(e))},W.symbol=function(e){return"function"==typeof Symbol&&"[object Symbol]"===G.call(e)&&"symbol"==typeof N.call(e)},W.bigint=function(e){return"function"==typeof BigInt&&"[object BigInt]"===G.call(e)&&"bigint"==typeof L.call(e)};var $,Y=W,Q=Object.prototype.hasOwnProperty,Z=function(e){for(var t=Array.prototype.slice.call(arguments,1),n=0;n-1&&s.push([a,n[a]])}},{key:"initAfterPage",value:function(){var e,t=this;e=function(){var e,n,r=t.isVideo?"chartbeat_video.js":"chartbeat.js";e=document.createElement("script"),n=document.getElementsByTagName("script")[0],e.type="text/javascript",e.async=!0,e.src="//static.chartbeat.com/js/"+r,n.parentNode.insertBefore(e,n)},we?Ee(e):ke.push(e),this._isReady(this).then((function(e){l.debug("===replaying on chartbeat==="),e.replayEvents.forEach((function(t){e[t[0]](t[1])}))}))}},{key:"pause",value:function(e){return new Promise((function(t){setTimeout(t,e)}))}},{key:"_isReady",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return new Promise((function(r){return t.isLoaded()?(t.failed=!1,l.debug("===chartbeat loaded successfully==="),e.analytics.emit("ready"),r(e)):n>=1e4?(t.failed=!0,l.debug("===chartbeat failed==="),r(e)):void t.pause(1e3).then((function(){return t._isReady(e,n+1e3).then(r)}))}))}}]),e}(),Ae=function(){function e(t,r){n(this,e),this.c2ID=t.c2ID,this.analytics=r,this.comScoreBeaconParam=t.comScoreBeaconParam?t.comScoreBeaconParam:{},this.isFirstPageCallMade=!1,this.failed=!1,this.comScoreParams={},this.replayEvents=[],this.name="COMSCORE"}return i(e,[{key:"init",value:function(){l.debug("===in init Comscore init===")}},{key:"identify",value:function(e){l.debug("in Comscore identify")}},{key:"track",value:function(e){l.debug("in Comscore track")}},{key:"page",value:function(e){if(l.debug("in Comscore page"),this.loadConfig(e),this.isFirstPageCallMade){if(this.failed)return void(this.replayEvents=[]);if(!this.isLoaded()&&!this.failed)return void this.replayEvents.push(["page",e]);e.message.properties;window.COMSCORE.beacon(this.comScoreParams)}else this.isFirstPageCallMade=!0,this.initAfterPage()}},{key:"loadConfig",value:function(e){l.debug("=====in loadConfig====="),this.comScoreParams=this.mapComscoreParams(e.message.properties),window._comscore=window._comscore||[],window._comscore.push(this.comScoreParams)}},{key:"initAfterPage",value:function(){l.debug("=====in initAfterPage====="),function(){var e=document.createElement("script"),t=document.getElementsByTagName("script")[0];e.async=!0,e.src=("https:"==document.location.protocol?"https://sb":"http://b")+".scorecardresearch.com/beacon.js",t.parentNode.insertBefore(e,t)}(),this._isReady(this).then((function(e){e.replayEvents.forEach((function(t){e[t[0]](t[1])}))}))}},{key:"pause",value:function(e){return new Promise((function(t){setTimeout(t,e)}))}},{key:"_isReady",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return new Promise((function(r){return t.isLoaded()?(t.failed=!1,e.analytics.emit("ready"),r(e)):n>=1e4?(t.failed=!0,r(e)):void t.pause(1e3).then((function(){return t._isReady(e,n+1e3).then(r)}))}))}},{key:"mapComscoreParams",value:function(e){l.debug("=====in mapComscoreParams=====");var t=this.comScoreBeaconParam,n={};return Object.keys(t).forEach((function(r){if(r in e){var i=t[r],o=e[r];n[i]=o}})),n.c1="2",n.c2=this.c2ID,l.debug("=====in mapComscoreParams=====",n),n}},{key:"isLoaded",value:function(){return l.debug("in Comscore isLoaded"),!this.isFirstPageCallMade||!!window.COMSCORE}},{key:"isReady",value:function(){return!!window.COMSCORE}}]),e}(),Te=Object.prototype.toString;var Ce=function e(t){var n=function(e){switch(Te.call(e)){case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object Error]":return"error"}return null===e?"null":void 0===e?"undefined":e!=e?"nan":e&&1===e.nodeType?"element":null!=(t=e)&&(t._isBuffer||t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t))?"buffer":typeof(e=e.valueOf?e.valueOf():Object.prototype.valueOf.apply(e));var t}(t);if("object"===n){var r={};for(var i in t)t.hasOwnProperty(i)&&(r[i]=e(t[i]));return r}if("array"===n){r=new Array(t.length);for(var o=0,s=t.length;o1e4)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*Re;case"days":case"day":case"d":return n*xe;case"hours":case"hour":case"hrs":case"hr":case"h":return n*je;case"minutes":case"minute":case"mins":case"min":case"m":return n*Se;case"seconds":case"second":case"secs":case"sec":case"s":return n*Oe;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}(e):t.long?function(e){return Ue(e,xe,"day")||Ue(e,je,"hour")||Ue(e,Se,"minute")||Ue(e,Oe,"second")||e+" ms"}(e):function(e){return e>=xe?Math.round(e/xe)+"d":e>=je?Math.round(e/je)+"h":e>=Se?Math.round(e/Se)+"m":e>=Oe?Math.round(e/Oe)+"s":e+"ms"}(e)};function Ue(e,t,n){if(!(e=31},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(e){return JSON.stringify(e)},t.enable(n())}))),Le=(Ne.log,Ne.formatArgs,Ne.save,Ne.load,Ne.useColors,Ne.storage,Ne.colors,Ne("cookie")),Me=function(e,t,n){switch(arguments.length){case 3:case 2:return Be(e,t,n);case 1:return Ke(e);default:return Fe()}};function Be(e,t,n){n=n||{};var r=qe(e)+"="+qe(t);null==t&&(n.maxage=-1),n.maxage&&(n.expires=new Date(+new Date+n.maxage)),n.path&&(r+="; path="+n.path),n.domain&&(r+="; domain="+n.domain),n.expires&&(r+="; expires="+n.expires.toUTCString()),n.samesite&&(r+="; samesite="+n.samesite),n.secure&&(r+="; secure"),document.cookie=r}function Fe(){var e;try{e=document.cookie}catch(e){return"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e.stack||e),{}}return function(e){var t,n={},r=e.split(/ *; */);if(""==r[0])return n;for(var i=0;i1)))/4)-l((e-1901+t)/100)+l((e-1601+t)/400)};t=function(e){for(i=l(e/864e5),n=l(i/365.2425)+1970-1;p(n+1,0)<=i;n++);for(r=l((i-p(n,0))/30.42);p(n,r+1)<=i;r++);i=1+i-p(n,r),s=l((o=(e%864e5+864e5)%864e5)/36e5)%24,a=l(o/6e4)%60,u=l(o/1e3)%60,c=o%1e3}}return(I=function(e){return e>-1/0&&e<1/0?(t(e),e=(n<=0||n>=1e4?(n<0?"-":"+")+E(6,n<0?-n:n):E(4,n))+"-"+E(2,r+1)+"-"+E(2,i)+"T"+E(2,s)+":"+E(2,a)+":"+E(2,u)+"."+E(3,c)+"Z",n=r=i=s=a=u=c=null):e=null,e})(e)};if(b("json-stringify")&&!b("date-serialization")){function A(e){return I(this)}var T=t.stringify;t.stringify=function(e,t,n){var r=u.prototype.toJSON;u.prototype.toJSON=A;var i=T(e,t,n);return u.prototype.toJSON=r,i}}else{var C=function(e){var t=e.charCodeAt(0),n=_[t];return n||"\\u00"+E(2,t.toString(16))},O=/[\x00-\x1f\x22\x5c]/g,S=function(e){return O.lastIndex=0,'"'+(O.test(e)?e.replace(O,C):e)+'"'},j=function(e,t,n,r,i,o,s){var a,c,d,f,h,y,v,b,w;if(m((function(){a=t[e]})),"object"==typeof a&&a&&(a.getUTCFullYear&&"[object Date]"==g.call(a)&&a.toJSON===u.prototype.toJSON?a=I(a):"function"==typeof a.toJSON&&(a=a.toJSON(e))),n&&(a=n.call(t,e,a)),a==p)return a===p?a:"null";switch("object"==(c=typeof a)&&(d=g.call(a)),d||c){case"boolean":case"[object Boolean]":return""+a;case"number":case"[object Number]":return a>-1/0&&a<1/0?""+a:"null";case"string":case"[object String]":return S(""+a)}if("object"==typeof a){for(v=s.length;v--;)if(s[v]===a)throw l();if(s.push(a),f=[],b=o,o+=i,"[object Array]"==d){for(y=0,v=a.length;y0)for(r>10&&(r=10),i="";i.length=48&&i<=57||i>=97&&i<=102||i>=65&&i<=70||D();e+=P("0x"+o.slice(t,x));break;default:D()}else{if(34==i)break;for(i=o.charCodeAt(x),t=x;i>=32&&92!=i&&34!=i;)i=o.charCodeAt(++x);e+=o.slice(t,x)}if(34==o.charCodeAt(x))return x++,e;D();default:if(t=x,45==i&&(r=!0,i=o.charCodeAt(++x)),i>=48&&i<=57){for(48==i&&((i=o.charCodeAt(x+1))>=48&&i<=57)&&D(),r=!1;x=48&&i<=57);x++);if(46==o.charCodeAt(x)){for(n=++x;n57);n++);n==x&&D(),x=n}if(101==(i=o.charCodeAt(x))||69==i){for(43!=(i=o.charCodeAt(++x))&&45!=i||x++,n=x;n57);n++);n==x&&D(),x=n}return+o.slice(t,x)}r&&D();var a=o.slice(x,x+4);if("true"==a)return x+=4,!0;if("fals"==a&&101==o.charCodeAt(x+4))return x+=5,!1;if("null"==a)return x+=4,null;D()}return"$"},L=function(e){var t,n;if("$"==e&&D(),"string"==typeof e){if("@"==(w?e.charAt(0):e[0]))return e.slice(1);if("["==e){for(t=[];"]"!=(e=N());)n?","==e?"]"==(e=N())&&D():D():n=!0,","==e&&D(),t.push(L(e));return t}if("{"==e){for(t={};"}"!=(e=N());)n?","==e?"}"==(e=N())&&D():D():n=!0,","!=e&&"string"==typeof e&&"@"==(w?e.charAt(0):e[0])&&":"==N()||D(),t[e.slice(1)]=L(N());return t}D()}return e},M=function(e,t,n){var r=B(e,t,n);r===p?delete e[t]:e[t]=r},B=function(e,t,n){var r,i=e[t];if("object"==typeof i&&i)if("[object Array]"==g.call(i))for(r=i.length;r--;)M(g,k,i);else k(i,(function(e){M(i,e,n)}));return n.call(e,t,i)};t.parse=function(e,t){var n,r;return x=0,R=""+e,n=L(N()),"$"!=N()&&D(),x=R=null,t&&"[object Function]"==g.call(t)?B(((r={})[""]=n,r),"",t):n}}}return t.runInContext=s,t}if(!o||o.global!==o&&o.window!==o&&o.self!==o||(i=o),r)s(i,r);else{var a=i.JSON,u=i.JSON3,c=!1,l=s(i,i.JSON3={noConflict:function(){return c||(c=!0,i.JSON=a,i.JSON3=u,a=u=null),l}});i.JSON={parse:l.parse,stringify:l.stringify}}}).call(S)})),ot=j((function(e,t){function n(e){switch(e){case"http:":return 80;case"https:":return 443;default:return location.port}}t.parse=function(e){var t=document.createElement("a");return t.href=e,{href:t.href,host:t.host||location.host,port:"0"===t.port||""===t.port?n(t.protocol):t.port,hash:t.hash,hostname:t.hostname||location.hostname,pathname:"/"!=t.pathname.charAt(0)?"/"+t.pathname:t.pathname,protocol:t.protocol&&":"!=t.protocol?t.protocol:location.protocol,search:t.search,query:t.search.slice(1)}},t.isAbsolute=function(e){return 0==e.indexOf("//")||!!~e.indexOf("://")},t.isRelative=function(e){return!t.isAbsolute(e)},t.isCrossDomain=function(e){e=t.parse(e);var n=t.parse(window.location.href);return e.hostname!==n.hostname||e.port!==n.port||e.protocol!==n.protocol}})),st=(ot.parse,ot.isAbsolute,ot.isRelative,ot.isCrossDomain,1e3),at=60*st,ut=60*at,ct=24*ut,lt=365.25*ct,dt=function(e,t){return t=t||{},"string"==typeof e?function(e){if((e=""+e).length>1e4)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*lt;case"days":case"day":case"d":return n*ct;case"hours":case"hour":case"hrs":case"hr":case"h":return n*ut;case"minutes":case"minute":case"mins":case"min":case"m":return n*at;case"seconds":case"second":case"secs":case"sec":case"s":return n*st;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}(e):t.long?function(e){return ft(e,ct,"day")||ft(e,ut,"hour")||ft(e,at,"minute")||ft(e,st,"second")||e+" ms"}(e):function(e){return e>=ct?Math.round(e/ct)+"d":e>=ut?Math.round(e/ut)+"h":e>=at?Math.round(e/at)+"m":e>=st?Math.round(e/st)+"s":e+"ms"}(e)};function ft(e,t,n){if(!(e=31},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(e){return JSON.stringify(e)},t.enable(n())}))),gt=(ht.log,ht.formatArgs,ht.save,ht.load,ht.useColors,ht.storage,ht.colors,ht("cookie")),yt=function(e,t,n){switch(arguments.length){case 3:case 2:return mt(e,t,n);case 1:return bt(e);default:return vt()}};function mt(e,t,n){n=n||{};var r=wt(e)+"="+wt(t);null==t&&(n.maxage=-1),n.maxage&&(n.expires=new Date(+new Date+n.maxage)),n.path&&(r+="; path="+n.path),n.domain&&(r+="; domain="+n.domain),n.expires&&(r+="; expires="+n.expires.toUTCString()),n.secure&&(r+="; secure"),n.samesite&&(r+="; samesite="+n.samesite),document.cookie=r}function vt(){var e;try{e=document.cookie}catch(e){return"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e.stack||e),{}}return function(e){var t,n={},r=e.split(/ *; */);if(""==r[0])return n;for(var i=0;i=0;--o)i.push(t.slice(o).join("."));return i},r.cookie=yt,t=e.exports=r})),Et=new(function(){function e(t){n(this,e),this._options={},this.options(t)}return i(e,[{key:"options",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(0===arguments.length)return this._options;var t="."+_t(window.location.href);"."===t&&(t=null),this._options=nt(e,{maxage:31536e6,path:"/",domain:t,samesite:"Lax"}),this.set("test_rudder",!0),this.get("test_rudder")||(this._options.domain=null),this.remove("test_rudder")}},{key:"set",value:function(e,t){try{return t=it.stringify(t),Me(e,t,Ce(this._options)),!0}catch(e){return!1}}},{key:"get",value:function(e){try{var t=Me(e);return t=t?it.parse(t):null}catch(e){return null}}},{key:"remove",value:function(e){try{return Me(e,null,Ce(this._options)),!0}catch(e){return!1}}}]),e}())({}),It=function(){var e,t={},n="undefined"!=typeof window?window:S,r=n.document,i="localStorage";if(t.disabled=!1,t.version="1.3.20",t.set=function(e,t){},t.get=function(e,t){},t.has=function(e){return void 0!==t.get(e)},t.remove=function(e){},t.clear=function(){},t.transact=function(e,n,r){null==r&&(r=n,n=null),null==n&&(n={});var i=t.get(e,n);r(i),t.set(e,i)},t.getAll=function(){var e={};return t.forEach((function(t,n){e[t]=n})),e},t.forEach=function(){},t.serialize=function(e){return it.stringify(e)},t.deserialize=function(e){if("string"==typeof e)try{return it.parse(e)}catch(t){return e||void 0}},function(){try{return i in n&&n[i]}catch(e){return!1}}())e=n[i],t.set=function(n,r){return void 0===r?t.remove(n):(e.setItem(n,t.serialize(r)),r)},t.get=function(n,r){var i=t.deserialize(e.getItem(n));return void 0===i?r:i},t.remove=function(t){e.removeItem(t)},t.clear=function(){e.clear()},t.forEach=function(n){for(var r=0;rdocument.w=window<\/script>'),s.close(),o=s.w.frames[0].document,e=o.createElement("div")}catch(t){e=r.createElement("div"),o=r.body}var a=function(n){return function(){var r=Array.prototype.slice.call(arguments,0);r.unshift(e),o.appendChild(e),e.addBehavior("#default#userData"),e.load(i);var s=n.apply(t,r);return o.removeChild(e),s}},u=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g"),c=function(e){return e.replace(/^d/,"___$&").replace(u,"___")};t.set=a((function(e,n,r){return n=c(n),void 0===r?t.remove(n):(e.setAttribute(n,t.serialize(r)),e.save(i),r)})),t.get=a((function(e,n,r){n=c(n);var i=t.deserialize(e.getAttribute(n));return void 0===i?r:i})),t.remove=a((function(e,t){t=c(t),e.removeAttribute(t),e.save(i)})),t.clear=a((function(e){var t=e.XMLDocument.documentElement.attributes;e.load(i);for(var n=t.length-1;n>=0;n--)e.removeAttribute(t[n].name);e.save(i)})),t.forEach=a((function(e,n){for(var r,i=e.XMLDocument.documentElement.attributes,o=0;r=i[o];++o)n(r.name,t.deserialize(e.getAttribute(r.name)))}))}try{var l="__storejs__";t.set(l,l),t.get(l)!=l&&(t.disabled=!0),t.remove(l)}catch(e){t.disabled=!0}return t.enabled=!t.disabled,t}(),At=new(function(){function e(t){n(this,e),this._options={},this.enabled=!1,this.options(t)}return i(e,[{key:"options",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(0===arguments.length)return this._options;nt(e,{enabled:!0}),this.enabled=e.enabled&&It.enabled,this._options=e}},{key:"set",value:function(e,t){return!!this.enabled&&It.set(e,t)}},{key:"get",value:function(e){return this.enabled?It.get(e):null}},{key:"remove",value:function(e){return!!this.enabled&&It.remove(e)}}]),e}())({}),Tt="rl_user_id",Ct="rl_trait",Ot="rl_anonymous_id",St="rl_group_id",jt="rl_group_trait",xt=new(function(){function e(){if(n(this,e),Et.set("rudder_cookies",!0),Et.get("rudder_cookies"))return Et.remove("rudder_cookies"),void(this.storage=Et);At.enabled&&(this.storage=At)}return i(e,[{key:"setItem",value:function(e,t){this.storage.set(e,t)}},{key:"setUserId",value:function(e){"string"==typeof e?this.storage.set(Tt,e):l.error("userId should be string")}},{key:"setUserTraits",value:function(e){this.storage.set(Ct,e)}},{key:"setGroupId",value:function(e){"string"==typeof e?this.storage.set(St,e):l.error("groupId should be string")}},{key:"setGroupTraits",value:function(e){this.storage.set(jt,e)}},{key:"setAnonymousId",value:function(e){"string"==typeof e?this.storage.set(Ot,e):l.error("anonymousId should be string")}},{key:"getItem",value:function(e){return this.storage.get(e)}},{key:"getUserId",value:function(){return this.storage.get(Tt)}},{key:"getUserTraits",value:function(){return this.storage.get(Ct)}},{key:"getGroupId",value:function(){return this.storage.get(St)}},{key:"getGroupTraits",value:function(){return this.storage.get(jt)}},{key:"getAnonymousId",value:function(){return this.storage.get(Ot)}},{key:"removeItem",value:function(e){return this.storage.remove(e)}},{key:"clear",value:function(){this.storage.remove(Tt),this.storage.remove(Ct),this.storage.remove(Ot)}}]),e}()),Rt="lt_synch_timestamp",Pt=new(function(){function e(){n(this,e),this.storage=xt}return i(e,[{key:"setLotameSynchTime",value:function(e){this.storage.setItem(Rt,e)}},{key:"getLotameSynchTime",value:function(){return this.storage.getItem(Rt)}}]),e}()),Ut={HS:_,GA:E,HOTJAR:I,GOOGLEADS:A,VWO:T,GTM:C,BRAZE:O,INTERCOM:B,KEEN:F,KISSMETRICS:fe,CUSTOMERIO:pe,CHARTBEAT:Ie,COMSCORE:Ae,LOTAME:function(){function e(t,r){var i=this;n(this,e),this.name="LOTAME",this.analytics=r,this.storage=Pt,this.bcpUrlSettings=t.bcpUrlSettings,this.dspUrlSettings=t.dspUrlSettings,this.mappings={},t.mappings.forEach((function(e){var t=e.key,n=e.value;i.mappings[t]=n}))}return i(e,[{key:"init",value:function(){l.debug("===in init Lotame==="),window.LOTAME_SYNCH_CALLBACK=function(){}}},{key:"addPixel",value:function(e,t,n){var r=document.createElement("img");r.src=e,r.setAttribute("width",t),r.setAttribute("height",n),document.getElementsByTagName("body")[0].appendChild(r)}},{key:"syncPixel",value:function(e){var t=this;l.debug("===== in syncPixel ======"),this.dspUrlSettings&&this.dspUrlSettings.length>0&&this.dspUrlSettings.forEach((function(n){var r=t.compileUrl(a({},t.mappings,{userId:e}),n.dspUrlTemplate);t.addPixel(r,"1","1")})),this.storage.setLotameSynchTime(Date.now()),this.analytics.methodToCallbackMapping.syncPixel&&this.analytics.emit("syncPixel",{destination:this.name})}},{key:"compileUrl",value:function(e,t){return Object.keys(e).forEach((function(n){if(e.hasOwnProperty(n)){var r=new RegExp("{{"+n+"}}","gi");t=t.replace(r,e[n])}})),t}},{key:"identify",value:function(e){l.debug("in Lotame identify");var t=e.message.userId;this.syncPixel(t)}},{key:"track",value:function(e){l.debug("track not supported for lotame")}},{key:"page",value:function(e){var t=this;l.debug("in Lotame page"),this.bcpUrlSettings&&this.bcpUrlSettings.length>0&&this.bcpUrlSettings.forEach((function(e){var n=t.compileUrl(a({},t.mappings),e.bcpUrlTemplate);t.addPixel(n,"1","1")})),e.message.userId&&this.isPixelToBeSynched()&&this.syncPixel(e.message.userId)}},{key:"isPixelToBeSynched",value:function(){var e=this.storage.getLotameSynchTime(),t=Date.now();return!e||Math.floor((t-e)/864e5)>=7}},{key:"isLoaded",value:function(){return l.debug("in Lotame isLoaded"),!0}},{key:"isReady",value:function(){return!0}}]),e}()},Dt=function e(){n(this,e),this.build="1.0.0",this.name="RudderLabs JavaScript SDK",this.namespace="com.rudderlabs.javascript",this.version="1.1.1-rc.2"},Nt=function e(){n(this,e),this.name="RudderLabs JavaScript SDK",this.version="1.1.1-rc.2"},Lt=function e(){n(this,e),this.name="",this.version=""},Mt=function e(){n(this,e),this.density=0,this.width=0,this.height=0},Bt=function e(){n(this,e),this.app=new Dt,this.traits=null,this.library=new Nt;var t=new Lt;t.version="";var r=new Mt;r.width=window.width,r.height=window.height,r.density=window.devicePixelRatio,this.userAgent=navigator.userAgent,this.locale=navigator.language||navigator.browserLanguage,this.os=t,this.screen=r,this.device=null,this.network=null},Ft=function(){function e(){n(this,e),this.channel="web",this.context=new Bt,this.type=null,this.action=null,this.messageId=f().toString(),this.originalTimestamp=(new Date).toISOString(),this.anonymousId=null,this.userId=null,this.event=null,this.properties={},this.integrations={},this.integrations.All=!0}return i(e,[{key:"getProperty",value:function(e){return this.properties[e]}},{key:"addProperty",value:function(e,t){this.properties[e]=t}},{key:"validateFor",value:function(e){if(!this.properties)throw new Error("Key properties is required");switch(e){case v.TRACK:if(!this.event)throw new Error("Key event is required for track event");if(this.event in Object.values(b))switch(this.event){case b.CHECKOUT_STEP_VIEWED:case b.CHECKOUT_STEP_COMPLETED:case b.PAYMENT_INFO_ENTERED:this.checkForKey("checkout_id"),this.checkForKey("step");break;case b.PROMOTION_VIEWED:case b.PROMOTION_CLICKED:this.checkForKey("promotion_id");break;case b.ORDER_REFUNDED:this.checkForKey("order_id")}else this.properties.category||(this.properties.category=this.event);break;case v.PAGE:break;case v.SCREEN:if(!this.properties.name)throw new Error("Key 'name' is required in properties")}}},{key:"checkForKey",value:function(e){if(!this.properties[e])throw new Error("Key '"+e+"' is required in properties")}}]),e}(),Kt=function(){function e(){n(this,e),this.message=new Ft}return i(e,[{key:"setType",value:function(e){this.message.type=e}},{key:"setProperty",value:function(e){this.message.properties=e}},{key:"setUserProperty",value:function(e){this.message.user_properties=e}},{key:"setUserId",value:function(e){this.message.userId=e}},{key:"setEventName",value:function(e){this.message.event=e}},{key:"updateTraits",value:function(e){this.message.context.traits=e}},{key:"getElementContent",value:function(){return this.message}}]),e}(),qt=function(){function e(){n(this,e),this.rudderProperty=null,this.rudderUserProperty=null,this.event=null,this.userId=null,this.channel=null,this.type=null}return i(e,[{key:"setProperty",value:function(e){return this.rudderProperty=e,this}},{key:"setPropertyBuilder",value:function(e){return this.rudderProperty=e.build(),this}},{key:"setUserProperty",value:function(e){return this.rudderUserProperty=e,this}},{key:"setUserPropertyBuilder",value:function(e){return this.rudderUserProperty=e.build(),this}},{key:"setEvent",value:function(e){return this.event=e,this}},{key:"setUserId",value:function(e){return this.userId=e,this}},{key:"setChannel",value:function(e){return this.channel=e,this}},{key:"setType",value:function(e){return this.type=e,this}},{key:"build",value:function(){var e=new Kt;return e.setUserId(this.userId),e.setType(this.type),e.setEventName(this.event),e.setProperty(this.rudderProperty),e.setUserProperty(this.rudderUserProperty),e}}]),e}(),Gt=function e(){n(this,e),this.batch=null,this.writeKey=null},Ht=j((function(e){var t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(t){var n=new Uint8Array(16);e.exports=function(){return t(n),n}}else{var r=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),r[t]=e>>>((3&t)<<3)&255;return r}}})),Vt=[],zt=0;zt<256;++zt)Vt[zt]=(zt+256).toString(16).substr(1);var Jt,Wt,$t=function(e,t){var n=t||0,r=Vt;return[r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]]].join("")},Yt=0,Qt=0;var Zt=function(e,t,n){var r=t&&n||0,i=t||[],o=(e=e||{}).node||Jt,s=void 0!==e.clockseq?e.clockseq:Wt;if(null==o||null==s){var a=Ht();null==o&&(o=Jt=[1|a[0],a[1],a[2],a[3],a[4],a[5]]),null==s&&(s=Wt=16383&(a[6]<<8|a[7]))}var u=void 0!==e.msecs?e.msecs:(new Date).getTime(),c=void 0!==e.nsecs?e.nsecs:Qt+1,l=u-Yt+(c-Qt)/1e4;if(l<0&&void 0===e.clockseq&&(s=s+1&16383),(l<0||u>Yt)&&void 0===e.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Yt=u,Qt=c,Wt=s;var d=(1e4*(268435455&(u+=122192928e5))+c)%4294967296;i[r++]=d>>>24&255,i[r++]=d>>>16&255,i[r++]=d>>>8&255,i[r++]=255&d;var f=u/4294967296*1e4&268435455;i[r++]=f>>>8&255,i[r++]=255&f,i[r++]=f>>>24&15|16,i[r++]=f>>>16&255,i[r++]=s>>>8|128,i[r++]=255&s;for(var p=0;p<6;++p)i[r+p]=o[p];return t||$t(i)};var Xt=function(e,t,n){var r=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var i=(e=e||{}).random||(e.rng||Ht)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t)for(var o=0;o<16;++o)t[r+o]=i[o];return t||$t(i)},en=Xt;en.v1=Zt,en.v4=Xt;var tn=en,nn=Object.prototype.hasOwnProperty,rn=String.prototype.charAt,on=Object.prototype.toString,sn=function(e,t){return rn.call(e,t)},an=function(e,t){return nn.call(e,t)},un=function(e,t){t=t||an;for(var n=[],r=0,i=e.length;r=36e5?(e/36e5).toFixed(1)+"h":e>=6e4?(e/6e4).toFixed(1)+"m":e>=1e3?(e/1e3|0)+"s":e+"ms"},On.enabled=function(e){for(var t=0,n=On.skips.length;tthis.maxAttempts)},Un.prototype.getDelay=function(e){var t=this.backoff.MIN_RETRY_DELAY*Math.pow(this.backoff.FACTOR,e);if(this.backoff.JITTER){var n=Math.random(),r=Math.floor(n*this.backoff.JITTER*t);Math.floor(10*n)<5?t-=r:t+=r}return Number(Math.min(t,this.backoff.MAX_RETRY_DELAY).toPrecision(1))},Un.prototype.addItem=function(e){this._enqueue({item:e,attemptNumber:0,time:this._schedule.now()})},Un.prototype.requeue=function(e,t,n){this.shouldRetry(e,t,n)?this._enqueue({item:e,attemptNumber:t,time:this._schedule.now()+this.getDelay(t)}):this.emit("discard",e,t)},Un.prototype._enqueue=function(e){var t=this._store.get(this.keys.QUEUE)||[];(t=t.slice(-(this.maxItems-1))).push(e),t=t.sort((function(e,t){return e.time-t.time})),this._store.set(this.keys.QUEUE,t),this._running&&this._processHead()},Un.prototype._processHead=function(){var e=this,t=this._store;this._schedule.cancel(this._processId);var n=t.get(this.keys.QUEUE)||[],r=t.get(this.keys.IN_PROGRESS)||{},i=this._schedule.now(),o=[];function s(n,r){o.push({item:n.item,done:function(i,o){var s=t.get(e.keys.IN_PROGRESS)||{};delete s[r],t.set(e.keys.IN_PROGRESS,s),e.emit("processed",i,o,n.item),i&&e.requeue(n.item,n.attemptNumber+1,i)}})}for(var a=Object.keys(r).length;n.length&&n[0].time<=i&&a++0&&(this._processId=this._schedule.run(this._processHead,n[0].time-i))},Un.prototype._ack=function(){this._store.set(this.keys.ACK,this._schedule.now()),this._store.set(this.keys.RECLAIM_START,null),this._store.set(this.keys.RECLAIM_END,null),this._schedule.run(this._ack,this.timeouts.ACK_TIMER)},Un.prototype._checkReclaim=function(){var e=this;vn((function(t){t.id!==e.id&&(e._schedule.now()-t.get(e.keys.ACK)=500&&o.status<600?(h(new Error("request failed with status: "+o.status+o.statusText+" for url: "+e)),i(new Error("request failed with status: "+o.status+o.statusText+" for url: "+e))):(l.debug("====== request processed successfully: "+o.status),i(null,o.status)))},o.send(JSON.stringify(n,d))}catch(e){i(e)}}},{key:"enqueue",value:function(e,t){var n={"Content-Type":"application/json",Authorization:"Basic "+btoa(this.writeKey+":")},r=e.getElementContent();r.originalTimestamp=p(),r.sentAt=p(),JSON.stringify(r).length>32e3&&l.error("message length greater 32 Kb ",r);var i="/"==this.url.slice(-1)?this.url.slice(0,-1):this.url;this.payloadQueue.addItem({url:i+"/v1/"+t,headers:n,message:r})}}]),e}());function Mn(e){var t=function(t){var n=(t=t||window.event).target||t.srcElement;Gn(n)&&(n=n.parentNode),Fn(n,t)?l.debug("to be tracked ",t.type):l.debug("not to be tracked ",t.type),function(e,t){var n=e.target||e.srcElement,r=void 0;Gn(n)&&(n=n.parentNode);if(Fn(n,e)){if("form"==n.tagName.toLowerCase()){r={};for(var i=0;i-1)return!0}return!1}function zn(e){return!(Hn(e).split(" ").indexOf("rudder-no-track")>=0)}function Jn(e){if(e.previousElementSibling)return e.previousElementSibling;do{e=e.previousSibling}while(e&&!qn(e));return e}var Wn=function(e,t,n){var r=!1;return n=n||$n,i.count=e,0===e?t():i;function i(e,o){if(i.count<=0)throw new Error("after called too many times");--i.count,e?(r=!0,t(e),t=n):0!==i.count||r||t(null,o)}};function $n(){}function Yn(e,t){this.eventRepository||(this.eventRepository=Ln),this.eventRepository.enqueue(e,t)}var Qn=function(){function e(){n(this,e),this.autoTrackHandlersRegistered=!1,this.autoTrackFeatureEnabled=!1,this.initialized=!1,this.trackValues=[],this.eventsBuffer=[],this.clientIntegrations=[],this.configArray=[],this.clientIntegrationObjects=void 0,this.successfullyLoadedIntegration=[],this.failedToBeLoadedIntegration=[],this.toBeProcessedArray=[],this.toBeProcessedByIntegrationArray=[],this.storage=xt,this.userId=null!=this.storage.getUserId()?this.storage.getUserId():"",this.userTraits=null!=this.storage.getUserTraits()?this.storage.getUserTraits():{},this.groupId=null!=this.storage.getGroupId()?this.storage.getGroupId():"",this.groupTraits=null!=this.storage.getGroupTraits()?this.storage.getGroupTraits():{},this.anonymousId=this.getAnonymousId(),this.storage.setUserId(this.userId),this.eventRepository=Ln,this.readyCallback=function(){},this.executeReadyCallback=void 0,this.methodToCallbackMapping={syncPixel:"syncPixelCallback"}}return i(e,[{key:"processResponse",value:function(e,t){try{l.debug("===in process response=== "+e),(t=JSON.parse(t)).source.useAutoTracking&&!this.autoTrackHandlersRegistered&&(this.autoTrackFeatureEnabled=!0,Mn(this),this.autoTrackHandlersRegistered=!0),t.source.destinations.forEach((function(e,t){l.debug("Destination "+t+" Enabled? "+e.enabled+" Type: "+e.destinationDefinition.name+" Use Native SDK? "+e.config.useNativeSDK),e.enabled&&(this.clientIntegrations.push(e.destinationDefinition.name),this.configArray.push(e.config))}),this),this.init(this.clientIntegrations,this.configArray)}catch(e){h(e),l.debug("===handling config BE response processing error==="),l.debug("autoTrackHandlersRegistered",this.autoTrackHandlersRegistered),this.autoTrackFeatureEnabled&&!this.autoTrackHandlersRegistered&&(Mn(this),this.autoTrackHandlersRegistered=!0)}}},{key:"init",value:function(e,t){var n=this,r=this;if(l.debug("supported intgs ",Ut),!e||0==e.length)return this.readyCallback&&this.readyCallback(),void(this.toBeProcessedByIntegrationArray=[]);e.forEach((function(e,i){var o=new(0,Ut[e])(t[i],r);o.init(),l.debug("initializing destination: ",e),n.isInitialized(o).then(n.replayEvents)}))}},{key:"replayEvents",value:function(e){e.successfullyLoadedIntegration.length+e.failedToBeLoadedIntegration.length==e.clientIntegrations.length&&e.toBeProcessedByIntegrationArray.length>0&&(l.debug("===replay events called====",e.successfullyLoadedIntegration.length,e.failedToBeLoadedIntegration.length),e.clientIntegrationObjects=[],e.clientIntegrationObjects=e.successfullyLoadedIntegration,l.debug("==registering after callback===",e.clientIntegrationObjects.length),e.executeReadyCallback=Wn(e.clientIntegrationObjects.length,e.readyCallback),l.debug("==registering ready callback==="),e.on("ready",e.executeReadyCallback),e.clientIntegrationObjects.forEach((function(t){l.debug("===looping over each successful integration===="),t.isReady&&!t.isReady()||(l.debug("===letting know I am ready=====",t.name),e.emit("ready"))})),e.toBeProcessedByIntegrationArray.forEach((function(t){var n=t[0];t.shift();for(var r=t[0].message.integrations,i=0;i1&&void 0!==arguments[1]?arguments[1]:0;return new Promise((function(r){return e.isLoaded()?(l.debug("===integration loaded successfully====",e.name),t.successfullyLoadedIntegration.push(e),r(t)):n>=1e4?(l.debug("====max wait over===="),t.failedToBeLoadedIntegration.push(e),r(t)):void t.pause(1e3).then((function(){return l.debug("====after pause, again checking===="),t.isInitialized(e,n+1e3).then(r)}))}))}},{key:"page",value:function(e,n,r,i,o){"function"==typeof i&&(o=i,i=null),"function"==typeof r&&(o=r,i=r=null),"function"==typeof n&&(o=n,i=r=n=null),"object"===t(e)&&(i=n,r=e,n=e=null),"object"===t(n)&&(i=r,r=n,n=null),"string"==typeof e&&"string"!=typeof n&&(n=e,e=null),this.processPage(e,n,r,i,o)}},{key:"track",value:function(e,t,n,r){"function"==typeof n&&(r=n,n=null),"function"==typeof t&&(r=t,n=null,t=null),this.processTrack(e,t,n,r)}},{key:"identify",value:function(e,n,r,i){"function"==typeof r&&(i=r,r=null),"function"==typeof n&&(i=n,r=null,n=null),"object"==t(e)&&(r=n,n=e,e=this.userId),this.processIdentify(e,n,r,i)}},{key:"alias",value:function(e,n,r,i){"function"==typeof r&&(i=r,r=null),"function"==typeof n&&(i=n,r=null,n=null),"object"==t(n)&&(r=n,n=null);var o=(new qt).setType("alias").build();o.message.previousId=n||this.userId?this.userId:this.getAnonymousId(),o.message.userId=e,this.processAndSendDataToDestinations("alias",o,r,i)}},{key:"group",value:function(e,n,r,i){if(arguments.length){"function"==typeof r&&(i=r,r=null),"function"==typeof n&&(i=n,r=null,n=null),"object"==t(e)&&(r=n,n=e,e=this.groupId),this.groupId=e,this.storage.setGroupId(this.groupId);var o=(new qt).setType("group").build();if(n)for(var s in n)this.groupTraits[s]=n[s];else this.groupTraits={};this.storage.setGroupTraits(this.groupTraits),this.processAndSendDataToDestinations("group",o,r,i)}}},{key:"processPage",value:function(e,t,n,r,i){var o=(new qt).setType("page").build();t&&(o.message.name=t),n||(n={}),e&&(n.category=e),n&&(o.message.properties=this.getPageProperties(n)),this.trackPage(o,r,i)}},{key:"processTrack",value:function(e,t,n,r){var i=(new qt).setType("track").build();e&&i.setEventName(e),t?i.setProperty(t):i.setProperty({}),this.trackEvent(i,n,r)}},{key:"processIdentify",value:function(e,t,n,r){e&&this.userId&&e!==this.userId&&this.reset(),this.userId=e,this.storage.setUserId(this.userId);var i=(new qt).setType("identify").build();if(t){for(var o in t)this.userTraits[o]=t[o];this.storage.setUserTraits(this.userTraits)}this.identifyUser(i,n,r)}},{key:"identifyUser",value:function(e,t,n){e.message.userId&&(this.userId=e.message.userId,this.storage.setUserId(this.userId)),e&&e.message&&e.message.context&&e.message.context.traits&&(this.userTraits=Object.assign({},e.message.context.traits),this.storage.setUserTraits(this.userTraits)),this.processAndSendDataToDestinations("identify",e,t,n)}},{key:"trackPage",value:function(e,t,n){this.processAndSendDataToDestinations("page",e,t,n)}},{key:"trackEvent",value:function(e,t,n){this.processAndSendDataToDestinations("track",e,t,n)}},{key:"processAndSendDataToDestinations",value:function(e,t,n,r){try{this.anonymousId||this.setAnonymousId(),t.message.context.page=g(),t.message.context.traits=Object.assign({},this.userTraits),l.debug("anonymousId: ",this.anonymousId),t.message.anonymousId=this.anonymousId,t.message.userId=t.message.userId?t.message.userId:this.userId,"group"==e&&(this.groupId&&(t.message.groupId=this.groupId),this.groupTraits&&(t.message.traits=Object.assign({},this.groupTraits))),n&&this.processOptionsParam(t,n),l.debug(JSON.stringify(t));var i=t.message.integrations;this.clientIntegrationObjects&&this.clientIntegrationObjects.forEach((function(n){l.debug("called in normal flow"),(i[n.name]||null==i[n.name]&&i.All)&&(n.isFailed&&n.isFailed()||n[e](t))})),this.clientIntegrationObjects||(l.debug("pushing in replay queue"),this.toBeProcessedByIntegrationArray.push([e,t])),Yn.call(this,t,e),l.debug(e+" is called "),r&&r()}catch(e){h(e)}}},{key:"processOptionsParam",value:function(e,t){var n=["integrations","anonymousId","originalTimestamp"];for(var r in t)if(n.includes(r))e.message[r]=t[r];else if("context"!==r)e.message.context[r]=t[r];else for(var i in t[r])e.message.context[i]=t[r][i]}},{key:"getPageProperties",value:function(e){var t=g();for(var n in t)void 0===e[n]&&(e[n]=t[n]);return e}},{key:"reset",value:function(){this.userId="",this.userTraits={},this.anonymousId=this.setAnonymousId(),this.storage.clear()}},{key:"getAnonymousId",value:function(){return this.anonymousId=this.storage.getAnonymousId(),this.anonymousId||this.setAnonymousId(),this.anonymousId}},{key:"setAnonymousId",value:function(e){this.anonymousId=e||f(),this.storage.setAnonymousId(this.anonymousId)}},{key:"load",value:function(e,t,n){var r="https://api.rudderlabs.com/sourceConfig";if(!e||!t||0==t.length)throw h({message:"Unable to load due to wrong writeKey or serverUrl"}),Error("failed to initialize");n&&n.logLevel&&l.setLogLevel(n.logLevel),n&&n.configUrl&&(r=n.configUrl),l.debug("inside load "),this.eventRepository.writeKey=e,t&&(this.eventRepository.url=t),n&&n.valTrackingList&&n.valTrackingList.push==Array.prototype.push&&(this.trackValues=n.valTrackingList),n&&n.useAutoTracking&&(this.autoTrackFeatureEnabled=!0,this.autoTrackFeatureEnabled&&!this.autoTrackHandlersRegistered&&(Mn(this),this.autoTrackHandlersRegistered=!0,l.debug("autoTrackHandlersRegistered",this.autoTrackHandlersRegistered)));try{!function(e,t,n,r){var i,o=r.bind(e);(i=new XMLHttpRequest).open("GET",t,!0),i.setRequestHeader("Authorization","Basic "+btoa(n+":")),i.onload=function(){var e=i.status;200==e?(l.debug("status 200 calling callback"),o(200,i.responseText)):(h(new Error("request failed with status: "+i.status+" for url: "+t)),o(e))},i.send()}(this,r,e,this.processResponse)}catch(e){h(e),this.autoTrackFeatureEnabled&&!this.autoTrackHandlersRegistered&&Mn(Zn)}}},{key:"ready",value:function(e){"function"!=typeof e?l.error("ready callback is not a function"):this.readyCallback=e}},{key:"registerCallbacks",value:function(){var e=this;Object.keys(this.methodToCallbackMapping).forEach((function(t){if(e.methodToCallbackMapping.hasOwnProperty(t)){var n=window.rudderanalytics&&"function"==typeof window.rudderanalytics[e.methodToCallbackMapping[t]]?window.rudderanalytics[e.methodToCallbackMapping[t]]:function(){};l.debug("registerCallbacks",t,n),e.on(t,n)}}))}}]),e}();window.addEventListener("error",(function(e){h(e)}),!0);var Zn=new Qn;jn(Zn),Zn.registerCallbacks();var Xn=!!window.rudderanalytics&&window.rudderanalytics.push==Array.prototype.push,er=window.rudderanalytics?window.rudderanalytics[0]:[];if(er.length>0&&"load"==er[0]){var tr=er[0];er.shift(),l.debug("=====from init, calling method:: ",tr),Zn[tr].apply(Zn,u(er))}if(Xn){for(var nr=1;nr-1?t:t+e:window.location.href,r=n.indexOf("#");return r>-1?n.slice(0,r):n}(r)}}function y(){for(var e,t=document.getElementsByTagName("link"),n=0;e=t[n];n++)if("canonical"===e.getAttribute("rel"))return e.getAttribute("href")}function m(e,t){var n=e.revenue;return!n&&t&&t.match(/^[ _]?completed[ _]?order[ _]?|^[ _]?order[ _]?completed[ _]?$/i)&&(n=e.total),function(e){if(e){if("number"==typeof e)return e;if("string"==typeof e)return e=e.replace(/\$/g,""),e=parseFloat(e),isNaN(e)?void 0:e}}(n)}var v={TRACK:"track",PAGE:"page",IDENTIFY:"identify"},b={PRODUCTS_SEARCHED:"Products Searched",PRODUCT_LIST_VIEWED:"Product List Viewed",PRODUCT_LIST_FILTERED:"Product List Filtered",PROMOTION_VIEWED:"Promotion Viewed",PROMOTION_CLICKED:"Promotion Clicked",PRODUCT_CLICKED:"Product Clicked",PRODUCT_VIEWED:"Product Viewed",PRODUCT_ADDED:"Product Added",PRODUCT_REMOVED:"Product Removed",CART_VIEWED:"Cart Viewed",CHECKOUT_STARTED:"Checkout Started",CHECKOUT_STEP_VIEWED:"Checkout Step Viewed",CHECKOUT_STEP_COMPLETED:"Checkout Step Completed",PAYMENT_INFO_ENTERED:"Payment Info Entered",ORDER_UPDATED:"Order Updated",ORDER_COMPLETED:"Order Completed",ORDER_REFUNDED:"Order Refunded",ORDER_CANCELLED:"Order Cancelled",COUPON_ENTERED:"Coupon Entered",COUPON_APPLIED:"Coupon Applied",COUPON_DENIED:"Coupon Denied",COUPON_REMOVED:"Coupon Removed",PRODUCT_ADDED_TO_WISHLIST:"Product Added to Wishlist",PRODUCT_REMOVED_FROM_WISHLIST:"Product Removed from Wishlist",WISH_LIST_PRODUCT_ADDED_TO_CART:"Wishlist Product Added to Cart",PRODUCT_SHARED:"Product Shared",CART_SHARED:"Cart Shared",PRODUCT_REVIEWED:"Product Reviewed"},w="http://18.222.145.124:5000/dump";function k(e,t){l.debug("in script loader=== "+e);var n=document.createElement("script");n.src=t,n.type="text/javascript",n.id=e;var r=document.getElementsByTagName("script")[0];l.debug("==script==",r),r.parentNode.insertBefore(n,r)}var _=function(){function e(t){n(this,e),this.hubId=t.hubID,this.name="HS"}return i(e,[{key:"init",value:function(){k("hubspot-integration","http://js.hs-scripts.com/"+this.hubId+".js"),l.debug("===in init HS===")}},{key:"identify",value:function(e){l.debug("in HubspotAnalyticsManager identify");var n=e.message.context.traits,r={};for(var i in n)if(Object.getOwnPropertyDescriptor(n,i)&&n[i]){var o=i;"[object Date]"==toString.call(n[i])?r[o]=n[i].getTime():r[o]=n[i]}var s=e.message.context.user_properties;for(var a in s){if(Object.getOwnPropertyDescriptor(s,a)&&s[a])r[a]=s[a]}(l.debug(r),void 0!==("undefined"==typeof window?"undefined":t(window)))&&(window._hsq=window._hsq||[]).push(["identify",r])}},{key:"track",value:function(e){l.debug("in HubspotAnalyticsManager track");var t=window._hsq=window._hsq||[],n={};n.id=e.message.event,e.message.properties&&(e.message.properties.revenue||e.message.properties.value)&&(n.value=e.message.properties.revenue||e.message.properties.value),t.push(["trackEvent",n])}},{key:"page",value:function(e){l.debug("in HubspotAnalyticsManager page");var t=window._hsq=window._hsq||[];e.message.properties&&e.message.properties.path&&t.push(["setPath",e.message.properties.path]),t.push(["trackPageView"])}},{key:"isLoaded",value:function(){return l.debug("in hubspot isLoaded"),!(!window._hsq||window._hsq.push===Array.prototype.push)}},{key:"isReady",value:function(){return!(!window._hsq||window._hsq.push===Array.prototype.push)}}]),e}(),E=function(){function e(t){n(this,e),this.trackingID=t.trackingID,this.name="GA"}return i(e,[{key:"init",value:function(){!function(e,t,n,r,i,o,s){e.GoogleAnalyticsObject=i,e.ga=e.ga||function(){(e.ga.q=e.ga.q||[]).push(arguments)},e.ga.l=1*new Date,o=t.createElement(n),s=t.getElementsByTagName(n)[0],o.async=1,o.src="https://www.google-analytics.com/analytics.js",s.parentNode.insertBefore(o,s)}(window,document,"script",0,"ga"),ga("create",this.trackingID,"auto","rudder_ga"),l.debug("===in init GA===")}},{key:"identify",value:function(e){ga("rudder_ga.set","userId",e.message.anonymous_id),l.debug("in GoogleAnalyticsManager identify")}},{key:"track",value:function(e){var t=e.message.event,n=e.message.event,r=e.message.event,i="";e.message.properties&&(i=e.message.properties.value?e.message.properties.value:e.message.properties.revenue,t=e.message.properties.category?e.message.properties.category:t,r=e.message.properties.label?e.message.properties.label:r),ga("rudder_ga.send","event",{hitType:"event",eventCategory:t,eventAction:n,eventLabel:r,eventValue:i}),l.debug("in GoogleAnalyticsManager track")}},{key:"page",value:function(e){l.debug("in GoogleAnalyticsManager page");var t=e.message.properties&&e.message.properties.path?e.message.properties.path:void 0,n=e.message.properties&&e.message.properties.title?e.message.properties.title:void 0,r=e.message.properties&&e.message.properties.url?e.message.properties.url:void 0;t&&ga("rudder_ga.set","page",t),n&&ga("rudder_ga.set","title",n),r&&ga("rudder_ga.set","location",r),ga("rudder_ga.send","pageview")}},{key:"isLoaded",value:function(){return l.debug("in GA isLoaded"),!!window.gaplugins}},{key:"isReady",value:function(){return!!window.gaplugins}}]),e}(),I=function(){function e(t){n(this,e),this.siteId=t.siteID,this.name="HOTJAR",this._ready=!1}return i(e,[{key:"init",value:function(){window.hotjarSiteId=this.siteId,function(e,t,n,r,i,o){e.hj=e.hj||function(){(e.hj.q=e.hj.q||[]).push(arguments)},e._hjSettings={hjid:e.hotjarSiteId,hjsv:6},i=t.getElementsByTagName("head")[0],(o=t.createElement("script")).async=1,o.src="https://static.hotjar.com/c/hotjar-"+e._hjSettings.hjid+".js?sv="+e._hjSettings.hjsv,i.appendChild(o)}(window,document),this._ready=!0,l.debug("===in init Hotjar===")}},{key:"identify",value:function(e){if(e.message.userId||e.message.anonymousId){var t=e.message.context.traits;window.hj("identify",e.message.userId,t)}else l.error("user id is required")}},{key:"track",value:function(e){l.error("method not supported")}},{key:"page",value:function(e){l.error("method not supported")}},{key:"isLoaded",value:function(){return this._ready}},{key:"isReady",value:function(){return this._ready}}]),e}(),A=function(){function e(t){n(this,e),this.conversionId=t.conversionID,this.pageLoadConversions=t.pageLoadConversions,this.clickEventConversions=t.clickEventConversions,this.name="GOOGLEADS"}return i(e,[{key:"init",value:function(){!function(e,t,n){l.debug("in script loader=== "+e);var r=n.createElement("script");r.src=t,r.async=1,r.type="text/javascript",r.id=e;var i=n.getElementsByTagName("head")[0];l.debug("==script==",i),i.appendChild(r)}("googleAds-integration","https://www.googletagmanager.com/gtag/js?id="+this.conversionId,document),window.dataLayer=window.dataLayer||[],window.gtag=function(){window.dataLayer.push(arguments)},window.gtag("js",new Date),window.gtag("config",this.conversionId),l.debug("===in init Google Ads===")}},{key:"identify",value:function(e){l.error("method not supported")}},{key:"track",value:function(e){l.debug("in GoogleAdsAnalyticsManager track");var t=this.getConversionData(this.clickEventConversions,e.message.event);if(t.conversionLabel){var n=t.conversionLabel,r=t.eventName,i=this.conversionId+"/"+n,o={};e.properties&&(o.value=e.properties.revenue,o.currency=e.properties.currency,o.transaction_id=e.properties.order_id),o.send_to=i,window.gtag("event",r,o)}}},{key:"page",value:function(e){l.debug("in GoogleAdsAnalyticsManager page");var t=this.getConversionData(this.pageLoadConversions,e.message.name);if(t.conversionLabel){var n=t.conversionLabel,r=t.eventName;window.gtag("event",r,{send_to:this.conversionId+"/"+n})}}},{key:"getConversionData",value:function(e,t){var n={};return e&&e.forEach((function(e){if(e.name.toLowerCase()===t.toLowerCase())return n.conversionLabel=e.conversionLabel,void(n.eventName=e.name)})),n}},{key:"isLoaded",value:function(){return window.dataLayer.push!==Array.prototype.push}},{key:"isReady",value:function(){return window.dataLayer.push!==Array.prototype.push}}]),e}(),T=function(){function e(t){n(this,e),this.accountId=t.accountId,this.settingsTolerance=t.settingsTolerance,this.isSPA=t.isSPA,this.libraryTolerance=t.libraryTolerance,this.useExistingJquery=t.useExistingJquery,this.sendExperimentTrack=t.sendExperimentTrack,this.sendExperimentIdentify=t.sendExperimentIdentify,this.name="VWO",l.debug("Config ",t)}return i(e,[{key:"init",value:function(){l.debug("===in init VWO===");var e=this.accountId,t=this.settingsTolerance,n=this.libraryTolerance,r=this.useExistingJquery,i=this.isSPA;window._vwo_code=function(){var o=!1,s=document;return{use_existing_jquery:function(){return r},library_tolerance:function(){return n},finish:function(){if(!o){o=!0;var e=s.getElementById("_vis_opt_path_hides");e&&e.parentNode.removeChild(e)}},finished:function(){return o},load:function(e){var t=s.createElement("script");t.src=e,t.type="text/javascript",t.innerText,t.onerror=function(){_vwo_code.finish()},s.getElementsByTagName("head")[0].appendChild(t)},init:function(){var n=setTimeout("_vwo_code.finish()",t),r=s.createElement("style"),o="body{opacity:0 !important;filter:alpha(opacity=0) !important;background:none !important;}",a=s.getElementsByTagName("head")[0];return r.setAttribute("id","_vis_opt_path_hides"),r.setAttribute("type","text/css"),r.styleSheet?r.styleSheet.cssText=o:r.appendChild(s.createTextNode(o)),a.appendChild(r),this.load("//dev.visualwebsiteoptimizer.com/j.php?a="+e+"&u="+encodeURIComponent(s.URL)+"&r="+Math.random()+"&f="+ +i),n}}}(),window._vwo_settings_timer=window._vwo_code.init(),(this.sendExperimentTrack||this.experimentViewedIdentify)&&this.experimentViewed()}},{key:"experimentViewed",value:function(){window.VWO=window.VWO||[];var e=this;window.VWO.push(["onVariationApplied",function(t){if(t){l.debug("Variation Applied");var n=t[1],r=t[2];if(l.debug("experiment id:",n,"Variation Name:",_vwo_exp[n].comb_n[r]),void 0!==_vwo_exp[n].comb_n[r]&&["VISUAL_AB","VISUAL","SPLIT_URL","SURVEY"].indexOf(_vwo_exp[n].type)>-1){try{e.sendExperimentTrack&&(l.debug("Tracking..."),window.rudderanalytics.track("Experiment Viewed",{experimentId:n,variationName:_vwo_exp[n].comb_n[r]}))}catch(e){l.error(e)}try{e.sendExperimentIdentify&&(l.debug("Identifying..."),window.rudderanalytics.identify(o({},"Experiment: ".concat(n),_vwo_exp[n].comb_n[r])))}catch(e){l.error(e)}}}}])}},{key:"identify",value:function(e){l.debug("method not supported")}},{key:"track",value:function(e){if("Order Completed"===e.message.event){var t=e.message.properties?e.message.properties.total||e.message.properties.revenue:0;l.debug("Revenue",t),window.VWO=window.VWO||[],window.VWO.push(["track.revenueConversion",t])}}},{key:"page",value:function(e){l.debug("method not supported")}},{key:"isLoaded",value:function(){return!!window._vwo_code}},{key:"isReady",value:function(){return!!window._vwo_code}}]),e}(),C=function(){function e(t){n(this,e),this.containerID=t.containerID,this.name="GOOGLETAGMANAGER"}return i(e,[{key:"init",value:function(){l.debug("===in init GoogleTagManager==="),function(e,t,n,r,i){e[r]=e[r]||[],e[r].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var o=t.getElementsByTagName(n)[0],s=t.createElement(n);s.async=!0,s.src="https://www.googletagmanager.com/gtm.js?id="+i,o.parentNode.insertBefore(s,o)}(window,document,"script","dataLayer",this.containerID)}},{key:"identify",value:function(e){l.error("method not supported")}},{key:"track",value:function(e){l.debug("===in track GoogleTagManager===");var t=e.message,n=a({event:t.event,userId:t.userId,anonymousId:t.anonymousId},t.properties);this.sendToGTMDatalayer(n)}},{key:"page",value:function(e){l.debug("===in page GoogleTagManager===");var t,n=e.message,r=n.name,i=n.properties?n.properties.category:void 0;r&&(t="Viewed "+r+" page"),i&&r&&(t="Viewed "+i+" "+r+" page");var o=a({event:t,userId:n.userId,anonymousId:n.anonymousId},n.properties);this.sendToGTMDatalayer(o)}},{key:"isLoaded",value:function(){return!(!window.dataLayer||Array.prototype.push===window.dataLayer.push)}},{key:"sendToGTMDatalayer",value:function(e){window.dataLayer.push(e)}},{key:"isReady",value:function(){return!(!window.dataLayer||Array.prototype.push===window.dataLayer.push)}}]),e}(),O=function(){function e(t,r){if(n(this,e),this.analytics=r,this.appKey=t.appKey,t.appKey||(this.appKey=""),this.endPoint="",t.dataCenter){var i=t.dataCenter.trim().split("-");"eu"===i[0].toLowerCase()?this.endPoint="sdk.fra-01.braze.eu":this.endPoint="sdk.iad-"+i[1]+".braze.com"}this.name="BRAZE",l.debug("Config ",t)}return i(e,[{key:"formatGender",value:function(e){if(e&&"string"==typeof e){return["woman","female","w","f"].indexOf(e.toLowerCase())>-1?window.appboy.ab.User.Genders.FEMALE:["man","male","m"].indexOf(e.toLowerCase())>-1?window.appboy.ab.User.Genders.MALE:["other","o"].indexOf(e.toLowerCase())>-1?window.appboy.ab.User.Genders.OTHER:void 0}}},{key:"init",value:function(){l.debug("===in init Braze==="),function(e,t,n,r,i){e.appboy={},e.appboyQueue=[];for(var o="initialize destroy getDeviceId toggleAppboyLogging setLogger openSession changeUser requestImmediateDataFlush requestFeedRefresh subscribeToFeedUpdates requestContentCardsRefresh subscribeToContentCardsUpdates logCardImpressions logCardClick logCardDismissal logFeedDisplayed logContentCardsDisplayed logInAppMessageImpression logInAppMessageClick logInAppMessageButtonClick logInAppMessageHtmlClick subscribeToNewInAppMessages subscribeToInAppMessage removeSubscription removeAllSubscriptions logCustomEvent logPurchase isPushSupported isPushBlocked isPushGranted isPushPermissionGranted registerAppboyPushMessages unregisterAppboyPushMessages trackLocation stopWebTracking resumeWebTracking wipeData ab ab.DeviceProperties ab.User ab.User.Genders ab.User.NotificationSubscriptionTypes ab.User.prototype.getUserId ab.User.prototype.setFirstName ab.User.prototype.setLastName ab.User.prototype.setEmail ab.User.prototype.setGender ab.User.prototype.setDateOfBirth ab.User.prototype.setCountry ab.User.prototype.setHomeCity ab.User.prototype.setLanguage ab.User.prototype.setEmailNotificationSubscriptionType ab.User.prototype.setPushNotificationSubscriptionType ab.User.prototype.setPhoneNumber ab.User.prototype.setAvatarImageUrl ab.User.prototype.setLastKnownLocation ab.User.prototype.setUserAttribute ab.User.prototype.setCustomUserAttribute ab.User.prototype.addToCustomAttributeArray ab.User.prototype.removeFromCustomAttributeArray ab.User.prototype.incrementCustomUserAttribute ab.User.prototype.addAlias ab.User.prototype.setCustomLocationAttribute ab.InAppMessage ab.InAppMessage.SlideFrom ab.InAppMessage.ClickAction ab.InAppMessage.DismissType ab.InAppMessage.OpenTarget ab.InAppMessage.ImageStyle ab.InAppMessage.TextAlignment ab.InAppMessage.Orientation ab.InAppMessage.CropType ab.InAppMessage.prototype.subscribeToClickedEvent ab.InAppMessage.prototype.subscribeToDismissedEvent ab.InAppMessage.prototype.removeSubscription ab.InAppMessage.prototype.removeAllSubscriptions ab.InAppMessage.prototype.closeMessage ab.InAppMessage.Button ab.InAppMessage.Button.prototype.subscribeToClickedEvent ab.InAppMessage.Button.prototype.removeSubscription ab.InAppMessage.Button.prototype.removeAllSubscriptions ab.SlideUpMessage ab.ModalMessage ab.FullScreenMessage ab.HtmlMessage ab.ControlMessage ab.Feed ab.Feed.prototype.getUnreadCardCount ab.ContentCards ab.ContentCards.prototype.getUnviewedCardCount ab.Card ab.Card.prototype.dismissCard ab.ClassicCard ab.CaptionedImage ab.Banner ab.ControlCard ab.WindowUtils display display.automaticallyShowNewInAppMessages display.showInAppMessage display.showFeed display.destroyFeed display.toggleFeed display.showContentCards display.hideContentCards display.toggleContentCards sharedLib".split(" "),s=0;s>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&n.rotl(e,8)|4278255360&n.rotl(e,24);for(var t=0;t0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],n=0,r=0;n>>5]|=e[n]<<24-r%32;return t},wordsToBytes:function(e){for(var t=[],n=0;n<32*e.length;n+=8)t.push(e[n>>>5]>>>24-n%32&255);return t},bytesToHex:function(e){for(var t=[],n=0;n>>4).toString(16)),t.push((15&e[n]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],n=0;n>>6*(3-o)&63)):n.push("=");return n.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var n=[],r=0,i=0;r>>6-2*i);return n}};e.exports=n}()})),R={utf8:{stringToBytes:function(e){return R.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(R.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],n=0;n>>24)|4278255360&(a[p]<<24|a[p]>>>8);a[u>>>5]|=128<>>9<<4)]=u;var h=o._ff,g=o._gg,y=o._hh,m=o._ii;for(p=0;p>>0,l=l+b>>>0,d=d+w>>>0,f=f+k>>>0}return t.endian([c,l,d,f])};o._ff=function(e,t,n,r,i,o,s){var a=e+(t&n|~t&r)+(i>>>0)+s;return(a<>>32-o)+t},o._gg=function(e,t,n,r,i,o,s){var a=e+(t&r|n&~r)+(i>>>0)+s;return(a<>>32-o)+t},o._hh=function(e,t,n,r,i,o,s){var a=e+(t^n^r)+(i>>>0)+s;return(a<>>32-o)+t},o._ii=function(e,t,n,r,i,o,s){var a=e+(n^(t|~r))+(i>>>0)+s;return(a<>>32-o)+t},o._blocksize=16,o._digestsize=16,e.exports=function(e,n){if(null==e)throw new Error("Illegal argument "+e);var r=t.wordsToBytes(o(e,n));return n&&n.asBytes?r:n&&n.asString?i.bytesToString(r):t.bytesToHex(r)}}()})),B=function(){function e(t){n(this,e),this.NAME="INTERCOM",this.API_KEY=t.apiKey,this.APP_ID=t.appId,this.MOBILE_APP_ID=t.mobileAppId,l.debug("Config ",t)}return i(e,[{key:"init",value:function(){window.intercomSettings={app_id:this.APP_ID},function(){var e=window,t=e.Intercom;if("function"==typeof t)t("reattach_activator"),t("update",e.intercomSettings);else{var n=document,r=function e(){e.c(arguments)};r.q=[],r.c=function(e){r.q.push(e)},e.Intercom=r;var i=function(){var e=n.createElement("script");e.type="text/javascript",e.async=!0,e.src="https://widget.intercom.io/widget/"+window.intercomSettings.app_id;var t=n.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)};"complete"===document.readyState?(i(),window.intercom_code=!0):e.attachEvent?(e.attachEvent("onload",i),window.intercom_code=!0):(e.addEventListener("load",i,!1),window.intercom_code=!0)}}()}},{key:"page",value:function(){window.Intercom("update")}},{key:"identify",value:function(e){var n={},r=e.message.context;if(null!=(r.Intercom?r.Intercom:null)){var i=r.Intercom.user_hash?r.Intercom.user_hash:null;null!=i&&(n.user_hash=i);var o=r.Intercom.hideDefaultLauncher?r.Intercom.hideDefaultLauncher:null;null!=o&&(n.hide_default_launcher=o)}Object.keys(r.traits).forEach((function(e){if(r.traits.hasOwnProperty(e)){var i=r.traits[e];if("company"===e){var o=[],s={};"string"==typeof r.traits[e]&&(s.company_id=M(r.traits[e]));var a="object"==t(r.traits[e])&&Object.keys(r.traits[e])||[];a.forEach((function(t){a.hasOwnProperty(t)&&("id"!=t?s[t]=r.traits[e][t]:s.company_id=r.traits[e][t])})),"object"!=t(r.traits[e])||a.includes("id")||(s.company_id=M(s.name)),o.push(s),n.companies=o}else n[e]=r.traits[e];switch(e){case"createdAt":n.created_at=i;break;case"anonymousId":n.user_id=i}}})),n.user_id=e.message.userId,window.Intercom("update",n)}},{key:"track",value:function(e){var t={},n=e.message;(n.properties?Object.keys(n.properties):null).forEach((function(e){var r=n.properties[e];t[e]=r})),n.event&&(t.event_name=n.event),t.user_id=n.userId?n.userId:n.anonymousId,t.created_at=Math.floor(new Date(n.originalTimestamp).getTime()/1e3),window.Intercom("trackEvent",t.event_name,t)}},{key:"isLoaded",value:function(){return!!window.intercom_code}},{key:"isReady",value:function(){return!!window.intercom_code}}]),e}(),F=function(){function e(t){n(this,e),this.projectID=t.projectID,this.writeKey=t.writeKey,this.ipAddon=t.ipAddon,this.uaAddon=t.uaAddon,this.urlAddon=t.urlAddon,this.referrerAddon=t.referrerAddon,this.client=null,this.name="KEEN"}return i(e,[{key:"init",value:function(){l.debug("===in init Keen==="),k("keen-integration","https://cdn.jsdelivr.net/npm/keen-tracking@4");var e=setInterval(function(){void 0!==window.KeenTracking&&void 0!==window.KeenTracking&&(this.client=function(e){return e.client=new window.KeenTracking({projectId:e.projectID,writeKey:e.writeKey}),e.client}(this),clearInterval(e))}.bind(this),1e3)}},{key:"identify",value:function(e){l.debug("in Keen identify");var t=e.message.context.traits,n=e.message.userId?e.message.userId:e.message.anonymousId,r=e.message.properties?Object.assign(r,e.message.properties):{};r.user={userId:n,traits:t},r=this.getAddOn(r),this.client.extendEvents(r)}},{key:"track",value:function(e){l.debug("in Keen track");var t=e.message.event,n=e.message.properties;n=this.getAddOn(n),this.client.recordEvent(t,n)}},{key:"page",value:function(e){l.debug("in Keen page");var t=e.message.name,n=e.message.properties?e.message.properties.category:void 0,r="Loaded a Page";t&&(r="Viewed "+t+" page"),n&&t&&(r="Viewed "+n+" "+t+" page");var i=e.message.properties;i=this.getAddOn(i),this.client.recordEvent(r,i)}},{key:"isLoaded",value:function(){return l.debug("in Keen isLoaded"),!(null==this.client)}},{key:"isReady",value:function(){return!(null==this.client)}},{key:"getAddOn",value:function(e){var t=[];return this.ipAddon&&(e.ip_address="${keen.ip}",t.push({name:"keen:ip_to_geo",input:{ip:"ip_address"},output:"ip_geo_info"})),this.uaAddon&&(e.user_agent="${keen.user_agent}",t.push({name:"keen:ua_parser",input:{ua_string:"user_agent"},output:"parsed_user_agent"})),this.urlAddon&&(e.page_url=document.location.href,t.push({name:"keen:url_parser",input:{url:"page_url"},output:"parsed_page_url"})),this.referrerAddon&&(e.page_url=document.location.href,e.referrer_url=document.referrer,t.push({name:"keen:referrer_parser",input:{referrer_url:"referrer_url",page_url:"page_url"},output:"referrer_info"})),e.keen={addons:t},e}}]),e}(),K=Object.prototype,q=K.hasOwnProperty,G=K.toString;"function"==typeof Symbol&&(N=Symbol.prototype.valueOf),"function"==typeof BigInt&&(L=BigInt.prototype.valueOf);var H=function(e){return e!=e},V={boolean:1,number:1,string:1,undefined:1},z=/^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$/,J=/^[A-Fa-f0-9]+$/,W={};W.a=W.type=function(e,t){return typeof e===t},W.defined=function(e){return void 0!==e},W.empty=function(e){var t,n=G.call(e);if("[object Array]"===n||"[object Arguments]"===n||"[object String]"===n)return 0===e.length;if("[object Object]"===n){for(t in e)if(q.call(e,t))return!1;return!0}return!e},W.equal=function(e,t){if(e===t)return!0;var n,r=G.call(e);if(r!==G.call(t))return!1;if("[object Object]"===r){for(n in e)if(!(W.equal(e[n],t[n])&&n in t))return!1;for(n in t)if(!(W.equal(e[n],t[n])&&n in e))return!1;return!0}if("[object Array]"===r){if((n=e.length)!==t.length)return!1;for(;n--;)if(!W.equal(e[n],t[n]))return!1;return!0}return"[object Function]"===r?e.prototype===t.prototype:"[object Date]"===r&&e.getTime()===t.getTime()},W.hosted=function(e,t){var n=typeof t[e];return"object"===n?!!t[e]:!V[n]},W.instance=W.instanceof=function(e,t){return e instanceof t},W.nil=W.null=function(e){return null===e},W.undef=W.undefined=function(e){return void 0===e},W.args=W.arguments=function(e){var t="[object Arguments]"===G.call(e),n=!W.array(e)&&W.arraylike(e)&&W.object(e)&&W.fn(e.callee);return t||n},W.array=Array.isArray||function(e){return"[object Array]"===G.call(e)},W.args.empty=function(e){return W.args(e)&&0===e.length},W.array.empty=function(e){return W.array(e)&&0===e.length},W.arraylike=function(e){return!!e&&!W.bool(e)&&q.call(e,"length")&&isFinite(e.length)&&W.number(e.length)&&e.length>=0},W.bool=W.boolean=function(e){return"[object Boolean]"===G.call(e)},W.false=function(e){return W.bool(e)&&!1===Boolean(Number(e))},W.true=function(e){return W.bool(e)&&!0===Boolean(Number(e))},W.date=function(e){return"[object Date]"===G.call(e)},W.date.valid=function(e){return W.date(e)&&!isNaN(Number(e))},W.element=function(e){return void 0!==e&&"undefined"!=typeof HTMLElement&&e instanceof HTMLElement&&1===e.nodeType},W.error=function(e){return"[object Error]"===G.call(e)},W.fn=W.function=function(e){if("undefined"!=typeof window&&e===window.alert)return!0;var t=G.call(e);return"[object Function]"===t||"[object GeneratorFunction]"===t||"[object AsyncFunction]"===t},W.number=function(e){return"[object Number]"===G.call(e)},W.infinite=function(e){return e===1/0||e===-1/0},W.decimal=function(e){return W.number(e)&&!H(e)&&!W.infinite(e)&&e%1!=0},W.divisibleBy=function(e,t){var n=W.infinite(e),r=W.infinite(t),i=W.number(e)&&!H(e)&&W.number(t)&&!H(t)&&0!==t;return n||r||i&&e%t==0},W.integer=W.int=function(e){return W.number(e)&&!H(e)&&e%1==0},W.maximum=function(e,t){if(H(e))throw new TypeError("NaN is not a valid value");if(!W.arraylike(t))throw new TypeError("second argument must be array-like");for(var n=t.length;--n>=0;)if(e=0;)if(e>t[n])return!1;return!0},W.nan=function(e){return!W.number(e)||e!=e},W.even=function(e){return W.infinite(e)||W.number(e)&&e==e&&e%2==0},W.odd=function(e){return W.infinite(e)||W.number(e)&&e==e&&e%2!=0},W.ge=function(e,t){if(H(e)||H(t))throw new TypeError("NaN is not a valid value");return!W.infinite(e)&&!W.infinite(t)&&e>=t},W.gt=function(e,t){if(H(e)||H(t))throw new TypeError("NaN is not a valid value");return!W.infinite(e)&&!W.infinite(t)&&e>t},W.le=function(e,t){if(H(e)||H(t))throw new TypeError("NaN is not a valid value");return!W.infinite(e)&&!W.infinite(t)&&e<=t},W.lt=function(e,t){if(H(e)||H(t))throw new TypeError("NaN is not a valid value");return!W.infinite(e)&&!W.infinite(t)&&e=t&&e<=n},W.object=function(e){return"[object Object]"===G.call(e)},W.primitive=function(e){return!e||!("object"==typeof e||W.object(e)||W.fn(e)||W.array(e))},W.hash=function(e){return W.object(e)&&e.constructor===Object&&!e.nodeType&&!e.setInterval},W.regexp=function(e){return"[object RegExp]"===G.call(e)},W.string=function(e){return"[object String]"===G.call(e)},W.base64=function(e){return W.string(e)&&(!e.length||z.test(e))},W.hex=function(e){return W.string(e)&&(!e.length||J.test(e))},W.symbol=function(e){return"function"==typeof Symbol&&"[object Symbol]"===G.call(e)&&"symbol"==typeof N.call(e)},W.bigint=function(e){return"function"==typeof BigInt&&"[object BigInt]"===G.call(e)&&"bigint"==typeof L.call(e)};var $,Y=W,Q=Object.prototype.hasOwnProperty,Z=function(e){for(var t=Array.prototype.slice.call(arguments,1),n=0;n-1&&s.push([a,n[a]])}},{key:"initAfterPage",value:function(){var e,t=this;e=function(){var e,n,r=t.isVideo?"chartbeat_video.js":"chartbeat.js";e=document.createElement("script"),n=document.getElementsByTagName("script")[0],e.type="text/javascript",e.async=!0,e.src="//static.chartbeat.com/js/"+r,n.parentNode.insertBefore(e,n)},we?Ee(e):ke.push(e),this._isReady(this).then((function(e){l.debug("===replaying on chartbeat==="),e.replayEvents.forEach((function(t){e[t[0]](t[1])}))}))}},{key:"pause",value:function(e){return new Promise((function(t){setTimeout(t,e)}))}},{key:"_isReady",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return new Promise((function(r){return t.isLoaded()?(t.failed=!1,l.debug("===chartbeat loaded successfully==="),e.analytics.emit("ready"),r(e)):n>=1e4?(t.failed=!0,l.debug("===chartbeat failed==="),r(e)):void t.pause(1e3).then((function(){return t._isReady(e,n+1e3).then(r)}))}))}}]),e}(),Ae=function(){function e(t,r){n(this,e),this.c2ID=t.c2ID,this.analytics=r,this.comScoreBeaconParam=t.comScoreBeaconParam?t.comScoreBeaconParam:{},this.isFirstPageCallMade=!1,this.failed=!1,this.comScoreParams={},this.replayEvents=[],this.name="COMSCORE"}return i(e,[{key:"init",value:function(){l.debug("===in init Comscore init===")}},{key:"identify",value:function(e){l.debug("in Comscore identify")}},{key:"track",value:function(e){l.debug("in Comscore track")}},{key:"page",value:function(e){if(l.debug("in Comscore page"),this.loadConfig(e),this.isFirstPageCallMade){if(this.failed)return void(this.replayEvents=[]);if(!this.isLoaded()&&!this.failed)return void this.replayEvents.push(["page",e]);e.message.properties;window.COMSCORE.beacon(this.comScoreParams)}else this.isFirstPageCallMade=!0,this.initAfterPage()}},{key:"loadConfig",value:function(e){l.debug("=====in loadConfig====="),this.comScoreParams=this.mapComscoreParams(e.message.properties),window._comscore=window._comscore||[],window._comscore.push(this.comScoreParams)}},{key:"initAfterPage",value:function(){l.debug("=====in initAfterPage====="),function(){var e=document.createElement("script"),t=document.getElementsByTagName("script")[0];e.async=!0,e.src=("https:"==document.location.protocol?"https://sb":"http://b")+".scorecardresearch.com/beacon.js",t.parentNode.insertBefore(e,t)}(),this._isReady(this).then((function(e){e.replayEvents.forEach((function(t){e[t[0]](t[1])}))}))}},{key:"pause",value:function(e){return new Promise((function(t){setTimeout(t,e)}))}},{key:"_isReady",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return new Promise((function(r){return t.isLoaded()?(t.failed=!1,e.analytics.emit("ready"),r(e)):n>=1e4?(t.failed=!0,r(e)):void t.pause(1e3).then((function(){return t._isReady(e,n+1e3).then(r)}))}))}},{key:"mapComscoreParams",value:function(e){l.debug("=====in mapComscoreParams=====");var t=this.comScoreBeaconParam,n={};return Object.keys(t).forEach((function(r){if(r in e){var i=t[r],o=e[r];n[i]=o}})),n.c1="2",n.c2=this.c2ID,l.debug("=====in mapComscoreParams=====",n),n}},{key:"isLoaded",value:function(){return l.debug("in Comscore isLoaded"),!this.isFirstPageCallMade||!!window.COMSCORE}},{key:"isReady",value:function(){return!!window.COMSCORE}}]),e}(),Te=Object.prototype.toString;var Ce=function e(t){var n=function(e){switch(Te.call(e)){case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object Error]":return"error"}return null===e?"null":void 0===e?"undefined":e!=e?"nan":e&&1===e.nodeType?"element":null!=(t=e)&&(t._isBuffer||t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t))?"buffer":typeof(e=e.valueOf?e.valueOf():Object.prototype.valueOf.apply(e));var t}(t);if("object"===n){var r={};for(var i in t)t.hasOwnProperty(i)&&(r[i]=e(t[i]));return r}if("array"===n){r=new Array(t.length);for(var o=0,s=t.length;o1e4)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*Re;case"days":case"day":case"d":return n*xe;case"hours":case"hour":case"hrs":case"hr":case"h":return n*je;case"minutes":case"minute":case"mins":case"min":case"m":return n*Se;case"seconds":case"second":case"secs":case"sec":case"s":return n*Oe;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}(e):t.long?function(e){return Ue(e,xe,"day")||Ue(e,je,"hour")||Ue(e,Se,"minute")||Ue(e,Oe,"second")||e+" ms"}(e):function(e){return e>=xe?Math.round(e/xe)+"d":e>=je?Math.round(e/je)+"h":e>=Se?Math.round(e/Se)+"m":e>=Oe?Math.round(e/Oe)+"s":e+"ms"}(e)};function Ue(e,t,n){if(!(e=31},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(e){return JSON.stringify(e)},t.enable(n())}))),Le=(Ne.log,Ne.formatArgs,Ne.save,Ne.load,Ne.useColors,Ne.storage,Ne.colors,Ne("cookie")),Me=function(e,t,n){switch(arguments.length){case 3:case 2:return Be(e,t,n);case 1:return Ke(e);default:return Fe()}};function Be(e,t,n){n=n||{};var r=qe(e)+"="+qe(t);null==t&&(n.maxage=-1),n.maxage&&(n.expires=new Date(+new Date+n.maxage)),n.path&&(r+="; path="+n.path),n.domain&&(r+="; domain="+n.domain),n.expires&&(r+="; expires="+n.expires.toUTCString()),n.samesite&&(r+="; samesite="+n.samesite),n.secure&&(r+="; secure"),document.cookie=r}function Fe(){var e;try{e=document.cookie}catch(e){return"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e.stack||e),{}}return function(e){var t,n={},r=e.split(/ *; */);if(""==r[0])return n;for(var i=0;i1)))/4)-l((e-1901+t)/100)+l((e-1601+t)/400)};t=function(e){for(i=l(e/864e5),n=l(i/365.2425)+1970-1;p(n+1,0)<=i;n++);for(r=l((i-p(n,0))/30.42);p(n,r+1)<=i;r++);i=1+i-p(n,r),s=l((o=(e%864e5+864e5)%864e5)/36e5)%24,a=l(o/6e4)%60,u=l(o/1e3)%60,c=o%1e3}}return(I=function(e){return e>-1/0&&e<1/0?(t(e),e=(n<=0||n>=1e4?(n<0?"-":"+")+E(6,n<0?-n:n):E(4,n))+"-"+E(2,r+1)+"-"+E(2,i)+"T"+E(2,s)+":"+E(2,a)+":"+E(2,u)+"."+E(3,c)+"Z",n=r=i=s=a=u=c=null):e=null,e})(e)};if(b("json-stringify")&&!b("date-serialization")){function A(e){return I(this)}var T=t.stringify;t.stringify=function(e,t,n){var r=u.prototype.toJSON;u.prototype.toJSON=A;var i=T(e,t,n);return u.prototype.toJSON=r,i}}else{var C=function(e){var t=e.charCodeAt(0),n=_[t];return n||"\\u00"+E(2,t.toString(16))},O=/[\x00-\x1f\x22\x5c]/g,S=function(e){return O.lastIndex=0,'"'+(O.test(e)?e.replace(O,C):e)+'"'},j=function(e,t,n,r,i,o,s){var a,c,d,f,h,y,v,b,w;if(m((function(){a=t[e]})),"object"==typeof a&&a&&(a.getUTCFullYear&&"[object Date]"==g.call(a)&&a.toJSON===u.prototype.toJSON?a=I(a):"function"==typeof a.toJSON&&(a=a.toJSON(e))),n&&(a=n.call(t,e,a)),a==p)return a===p?a:"null";switch("object"==(c=typeof a)&&(d=g.call(a)),d||c){case"boolean":case"[object Boolean]":return""+a;case"number":case"[object Number]":return a>-1/0&&a<1/0?""+a:"null";case"string":case"[object String]":return S(""+a)}if("object"==typeof a){for(v=s.length;v--;)if(s[v]===a)throw l();if(s.push(a),f=[],b=o,o+=i,"[object Array]"==d){for(y=0,v=a.length;y0)for(r>10&&(r=10),i="";i.length=48&&i<=57||i>=97&&i<=102||i>=65&&i<=70||D();e+=P("0x"+o.slice(t,x));break;default:D()}else{if(34==i)break;for(i=o.charCodeAt(x),t=x;i>=32&&92!=i&&34!=i;)i=o.charCodeAt(++x);e+=o.slice(t,x)}if(34==o.charCodeAt(x))return x++,e;D();default:if(t=x,45==i&&(r=!0,i=o.charCodeAt(++x)),i>=48&&i<=57){for(48==i&&((i=o.charCodeAt(x+1))>=48&&i<=57)&&D(),r=!1;x=48&&i<=57);x++);if(46==o.charCodeAt(x)){for(n=++x;n57);n++);n==x&&D(),x=n}if(101==(i=o.charCodeAt(x))||69==i){for(43!=(i=o.charCodeAt(++x))&&45!=i||x++,n=x;n57);n++);n==x&&D(),x=n}return+o.slice(t,x)}r&&D();var a=o.slice(x,x+4);if("true"==a)return x+=4,!0;if("fals"==a&&101==o.charCodeAt(x+4))return x+=5,!1;if("null"==a)return x+=4,null;D()}return"$"},L=function(e){var t,n;if("$"==e&&D(),"string"==typeof e){if("@"==(w?e.charAt(0):e[0]))return e.slice(1);if("["==e){for(t=[];"]"!=(e=N());)n?","==e?"]"==(e=N())&&D():D():n=!0,","==e&&D(),t.push(L(e));return t}if("{"==e){for(t={};"}"!=(e=N());)n?","==e?"}"==(e=N())&&D():D():n=!0,","!=e&&"string"==typeof e&&"@"==(w?e.charAt(0):e[0])&&":"==N()||D(),t[e.slice(1)]=L(N());return t}D()}return e},M=function(e,t,n){var r=B(e,t,n);r===p?delete e[t]:e[t]=r},B=function(e,t,n){var r,i=e[t];if("object"==typeof i&&i)if("[object Array]"==g.call(i))for(r=i.length;r--;)M(g,k,i);else k(i,(function(e){M(i,e,n)}));return n.call(e,t,i)};t.parse=function(e,t){var n,r;return x=0,R=""+e,n=L(N()),"$"!=N()&&D(),x=R=null,t&&"[object Function]"==g.call(t)?B(((r={})[""]=n,r),"",t):n}}}return t.runInContext=s,t}if(!o||o.global!==o&&o.window!==o&&o.self!==o||(i=o),r)s(i,r);else{var a=i.JSON,u=i.JSON3,c=!1,l=s(i,i.JSON3={noConflict:function(){return c||(c=!0,i.JSON=a,i.JSON3=u,a=u=null),l}});i.JSON={parse:l.parse,stringify:l.stringify}}}).call(S)})),ot=j((function(e,t){function n(e){switch(e){case"http:":return 80;case"https:":return 443;default:return location.port}}t.parse=function(e){var t=document.createElement("a");return t.href=e,{href:t.href,host:t.host||location.host,port:"0"===t.port||""===t.port?n(t.protocol):t.port,hash:t.hash,hostname:t.hostname||location.hostname,pathname:"/"!=t.pathname.charAt(0)?"/"+t.pathname:t.pathname,protocol:t.protocol&&":"!=t.protocol?t.protocol:location.protocol,search:t.search,query:t.search.slice(1)}},t.isAbsolute=function(e){return 0==e.indexOf("//")||!!~e.indexOf("://")},t.isRelative=function(e){return!t.isAbsolute(e)},t.isCrossDomain=function(e){e=t.parse(e);var n=t.parse(window.location.href);return e.hostname!==n.hostname||e.port!==n.port||e.protocol!==n.protocol}})),st=(ot.parse,ot.isAbsolute,ot.isRelative,ot.isCrossDomain,1e3),at=60*st,ut=60*at,ct=24*ut,lt=365.25*ct,dt=function(e,t){return t=t||{},"string"==typeof e?function(e){if((e=""+e).length>1e4)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var n=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return n*lt;case"days":case"day":case"d":return n*ct;case"hours":case"hour":case"hrs":case"hr":case"h":return n*ut;case"minutes":case"minute":case"mins":case"min":case"m":return n*at;case"seconds":case"second":case"secs":case"sec":case"s":return n*st;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}(e):t.long?function(e){return ft(e,ct,"day")||ft(e,ut,"hour")||ft(e,at,"minute")||ft(e,st,"second")||e+" ms"}(e):function(e){return e>=ct?Math.round(e/ct)+"d":e>=ut?Math.round(e/ut)+"h":e>=at?Math.round(e/at)+"m":e>=st?Math.round(e/st)+"s":e+"ms"}(e)};function ft(e,t,n){if(!(e=31},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(e){return JSON.stringify(e)},t.enable(n())}))),gt=(ht.log,ht.formatArgs,ht.save,ht.load,ht.useColors,ht.storage,ht.colors,ht("cookie")),yt=function(e,t,n){switch(arguments.length){case 3:case 2:return mt(e,t,n);case 1:return bt(e);default:return vt()}};function mt(e,t,n){n=n||{};var r=wt(e)+"="+wt(t);null==t&&(n.maxage=-1),n.maxage&&(n.expires=new Date(+new Date+n.maxage)),n.path&&(r+="; path="+n.path),n.domain&&(r+="; domain="+n.domain),n.expires&&(r+="; expires="+n.expires.toUTCString()),n.secure&&(r+="; secure"),n.samesite&&(r+="; samesite="+n.samesite),document.cookie=r}function vt(){var e;try{e=document.cookie}catch(e){return"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e.stack||e),{}}return function(e){var t,n={},r=e.split(/ *; */);if(""==r[0])return n;for(var i=0;i=0;--o)i.push(t.slice(o).join("."));return i},r.cookie=yt,t=e.exports=r})),Et=new(function(){function e(t){n(this,e),this._options={},this.options(t)}return i(e,[{key:"options",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(0===arguments.length)return this._options;var t="."+_t(window.location.href);"."===t&&(t=null),this._options=nt(e,{maxage:31536e6,path:"/",domain:t,samesite:"Lax"}),this.set("test_rudder",!0),this.get("test_rudder")||(this._options.domain=null),this.remove("test_rudder")}},{key:"set",value:function(e,t){try{return t=it.stringify(t),Me(e,t,Ce(this._options)),!0}catch(e){return!1}}},{key:"get",value:function(e){try{var t=Me(e);return t=t?it.parse(t):null}catch(e){return null}}},{key:"remove",value:function(e){try{return Me(e,null,Ce(this._options)),!0}catch(e){return!1}}}]),e}())({}),It=function(){var e,t={},n="undefined"!=typeof window?window:S,r=n.document,i="localStorage";if(t.disabled=!1,t.version="1.3.20",t.set=function(e,t){},t.get=function(e,t){},t.has=function(e){return void 0!==t.get(e)},t.remove=function(e){},t.clear=function(){},t.transact=function(e,n,r){null==r&&(r=n,n=null),null==n&&(n={});var i=t.get(e,n);r(i),t.set(e,i)},t.getAll=function(){var e={};return t.forEach((function(t,n){e[t]=n})),e},t.forEach=function(){},t.serialize=function(e){return it.stringify(e)},t.deserialize=function(e){if("string"==typeof e)try{return it.parse(e)}catch(t){return e||void 0}},function(){try{return i in n&&n[i]}catch(e){return!1}}())e=n[i],t.set=function(n,r){return void 0===r?t.remove(n):(e.setItem(n,t.serialize(r)),r)},t.get=function(n,r){var i=t.deserialize(e.getItem(n));return void 0===i?r:i},t.remove=function(t){e.removeItem(t)},t.clear=function(){e.clear()},t.forEach=function(n){for(var r=0;rdocument.w=window<\/script>'),s.close(),o=s.w.frames[0].document,e=o.createElement("div")}catch(t){e=r.createElement("div"),o=r.body}var a=function(n){return function(){var r=Array.prototype.slice.call(arguments,0);r.unshift(e),o.appendChild(e),e.addBehavior("#default#userData"),e.load(i);var s=n.apply(t,r);return o.removeChild(e),s}},u=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g"),c=function(e){return e.replace(/^d/,"___$&").replace(u,"___")};t.set=a((function(e,n,r){return n=c(n),void 0===r?t.remove(n):(e.setAttribute(n,t.serialize(r)),e.save(i),r)})),t.get=a((function(e,n,r){n=c(n);var i=t.deserialize(e.getAttribute(n));return void 0===i?r:i})),t.remove=a((function(e,t){t=c(t),e.removeAttribute(t),e.save(i)})),t.clear=a((function(e){var t=e.XMLDocument.documentElement.attributes;e.load(i);for(var n=t.length-1;n>=0;n--)e.removeAttribute(t[n].name);e.save(i)})),t.forEach=a((function(e,n){for(var r,i=e.XMLDocument.documentElement.attributes,o=0;r=i[o];++o)n(r.name,t.deserialize(e.getAttribute(r.name)))}))}try{var l="__storejs__";t.set(l,l),t.get(l)!=l&&(t.disabled=!0),t.remove(l)}catch(e){t.disabled=!0}return t.enabled=!t.disabled,t}(),At=new(function(){function e(t){n(this,e),this._options={},this.enabled=!1,this.options(t)}return i(e,[{key:"options",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(0===arguments.length)return this._options;nt(e,{enabled:!0}),this.enabled=e.enabled&&It.enabled,this._options=e}},{key:"set",value:function(e,t){return!!this.enabled&&It.set(e,t)}},{key:"get",value:function(e){return this.enabled?It.get(e):null}},{key:"remove",value:function(e){return!!this.enabled&&It.remove(e)}}]),e}())({}),Tt="rl_user_id",Ct="rl_trait",Ot="rl_anonymous_id",St="rl_group_id",jt="rl_group_trait",xt=new(function(){function e(){if(n(this,e),Et.set("rudder_cookies",!0),Et.get("rudder_cookies"))return Et.remove("rudder_cookies"),void(this.storage=Et);At.enabled&&(this.storage=At)}return i(e,[{key:"setItem",value:function(e,t){this.storage.set(e,t)}},{key:"setUserId",value:function(e){"string"==typeof e?this.storage.set(Tt,e):l.error("userId should be string")}},{key:"setUserTraits",value:function(e){this.storage.set(Ct,e)}},{key:"setGroupId",value:function(e){"string"==typeof e?this.storage.set(St,e):l.error("groupId should be string")}},{key:"setGroupTraits",value:function(e){this.storage.set(jt,e)}},{key:"setAnonymousId",value:function(e){"string"==typeof e?this.storage.set(Ot,e):l.error("anonymousId should be string")}},{key:"getItem",value:function(e){return this.storage.get(e)}},{key:"getUserId",value:function(){return this.storage.get(Tt)}},{key:"getUserTraits",value:function(){return this.storage.get(Ct)}},{key:"getGroupId",value:function(){return this.storage.get(St)}},{key:"getGroupTraits",value:function(){return this.storage.get(jt)}},{key:"getAnonymousId",value:function(){return this.storage.get(Ot)}},{key:"removeItem",value:function(e){return this.storage.remove(e)}},{key:"clear",value:function(){this.storage.remove(Tt),this.storage.remove(Ct),this.storage.remove(Ot)}}]),e}()),Rt="lt_synch_timestamp",Pt=new(function(){function e(){n(this,e),this.storage=xt}return i(e,[{key:"setLotameSynchTime",value:function(e){this.storage.setItem(Rt,e)}},{key:"getLotameSynchTime",value:function(){return this.storage.getItem(Rt)}}]),e}()),Ut={HS:_,GA:E,HOTJAR:I,GOOGLEADS:A,VWO:T,GTM:C,BRAZE:O,INTERCOM:B,KEEN:F,KISSMETRICS:fe,CUSTOMERIO:pe,CHARTBEAT:Ie,COMSCORE:Ae,LOTAME:function(){function e(t,r){var i=this;n(this,e),this.name="LOTAME",this.analytics=r,this.storage=Pt,this.bcpUrlSettings=t.bcpUrlSettings,this.dspUrlSettings=t.dspUrlSettings,this.mappings={},t.mappings.forEach((function(e){var t=e.key,n=e.value;i.mappings[t]=n}))}return i(e,[{key:"init",value:function(){l.debug("===in init Lotame==="),window.LOTAME_SYNCH_CALLBACK=function(){}}},{key:"addPixel",value:function(e,t,n){var r=document.createElement("img");r.src=e,r.setAttribute("width",t),r.setAttribute("height",n),document.getElementsByTagName("body")[0].appendChild(r)}},{key:"syncPixel",value:function(e){var t=this;l.debug("===== in syncPixel ======"),this.dspUrlSettings&&this.dspUrlSettings.length>0&&this.dspUrlSettings.forEach((function(n){var r=t.compileUrl(a({},t.mappings,{userId:e}),n.dspUrlTemplate);t.addPixel(r,"1","1")})),this.storage.setLotameSynchTime(Date.now()),this.analytics.methodToCallbackMapping.syncPixel&&this.analytics.emit("syncPixel",{destination:this.name})}},{key:"compileUrl",value:function(e,t){return Object.keys(e).forEach((function(n){if(e.hasOwnProperty(n)){var r=new RegExp("{{"+n+"}}","gi");t=t.replace(r,e[n])}})),t}},{key:"identify",value:function(e){l.debug("in Lotame identify");var t=e.message.userId;this.syncPixel(t)}},{key:"track",value:function(e){l.debug("track not supported for lotame")}},{key:"page",value:function(e){var t=this;l.debug("in Lotame page"),this.bcpUrlSettings&&this.bcpUrlSettings.length>0&&this.bcpUrlSettings.forEach((function(e){var n=t.compileUrl(a({},t.mappings),e.bcpUrlTemplate);t.addPixel(n,"1","1")})),e.message.userId&&this.isPixelToBeSynched()&&this.syncPixel(e.message.userId)}},{key:"isPixelToBeSynched",value:function(){var e=this.storage.getLotameSynchTime(),t=Date.now();return!e||Math.floor((t-e)/864e5)>=7}},{key:"isLoaded",value:function(){return l.debug("in Lotame isLoaded"),!0}},{key:"isReady",value:function(){return!0}}]),e}()},Dt=function e(){n(this,e),this.build="1.0.0",this.name="RudderLabs JavaScript SDK",this.namespace="com.rudderlabs.javascript",this.version="1.1.1-rc.2"},Nt=function e(){n(this,e),this.name="RudderLabs JavaScript SDK",this.version="1.1.1-rc.2"},Lt=function e(){n(this,e),this.name="",this.version=""},Mt=function e(){n(this,e),this.density=0,this.width=0,this.height=0},Bt=function e(){n(this,e),this.app=new Dt,this.traits=null,this.library=new Nt;var t=new Lt;t.version="";var r=new Mt;r.width=window.width,r.height=window.height,r.density=window.devicePixelRatio,this.userAgent=navigator.userAgent,this.locale=navigator.language||navigator.browserLanguage,this.os=t,this.screen=r,this.device=null,this.network=null},Ft=function(){function e(){n(this,e),this.channel="web",this.context=new Bt,this.type=null,this.action=null,this.messageId=f().toString(),this.originalTimestamp=(new Date).toISOString(),this.anonymousId=null,this.userId=null,this.event=null,this.properties={},this.integrations={},this.integrations.All=!0}return i(e,[{key:"getProperty",value:function(e){return this.properties[e]}},{key:"addProperty",value:function(e,t){this.properties[e]=t}},{key:"validateFor",value:function(e){if(!this.properties)throw new Error("Key properties is required");switch(e){case v.TRACK:if(!this.event)throw new Error("Key event is required for track event");if(this.event in Object.values(b))switch(this.event){case b.CHECKOUT_STEP_VIEWED:case b.CHECKOUT_STEP_COMPLETED:case b.PAYMENT_INFO_ENTERED:this.checkForKey("checkout_id"),this.checkForKey("step");break;case b.PROMOTION_VIEWED:case b.PROMOTION_CLICKED:this.checkForKey("promotion_id");break;case b.ORDER_REFUNDED:this.checkForKey("order_id")}else this.properties.category||(this.properties.category=this.event);break;case v.PAGE:break;case v.SCREEN:if(!this.properties.name)throw new Error("Key 'name' is required in properties")}}},{key:"checkForKey",value:function(e){if(!this.properties[e])throw new Error("Key '"+e+"' is required in properties")}}]),e}(),Kt=function(){function e(){n(this,e),this.message=new Ft}return i(e,[{key:"setType",value:function(e){this.message.type=e}},{key:"setProperty",value:function(e){this.message.properties=e}},{key:"setUserProperty",value:function(e){this.message.user_properties=e}},{key:"setUserId",value:function(e){this.message.userId=e}},{key:"setEventName",value:function(e){this.message.event=e}},{key:"updateTraits",value:function(e){this.message.context.traits=e}},{key:"getElementContent",value:function(){return this.message}}]),e}(),qt=function(){function e(){n(this,e),this.rudderProperty=null,this.rudderUserProperty=null,this.event=null,this.userId=null,this.channel=null,this.type=null}return i(e,[{key:"setProperty",value:function(e){return this.rudderProperty=e,this}},{key:"setPropertyBuilder",value:function(e){return this.rudderProperty=e.build(),this}},{key:"setUserProperty",value:function(e){return this.rudderUserProperty=e,this}},{key:"setUserPropertyBuilder",value:function(e){return this.rudderUserProperty=e.build(),this}},{key:"setEvent",value:function(e){return this.event=e,this}},{key:"setUserId",value:function(e){return this.userId=e,this}},{key:"setChannel",value:function(e){return this.channel=e,this}},{key:"setType",value:function(e){return this.type=e,this}},{key:"build",value:function(){var e=new Kt;return e.setUserId(this.userId),e.setType(this.type),e.setEventName(this.event),e.setProperty(this.rudderProperty),e.setUserProperty(this.rudderUserProperty),e}}]),e}(),Gt=function e(){n(this,e),this.batch=null,this.writeKey=null},Ht=j((function(e){var t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(t){var n=new Uint8Array(16);e.exports=function(){return t(n),n}}else{var r=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),r[t]=e>>>((3&t)<<3)&255;return r}}})),Vt=[],zt=0;zt<256;++zt)Vt[zt]=(zt+256).toString(16).substr(1);var Jt,Wt,$t=function(e,t){var n=t||0,r=Vt;return[r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]]].join("")},Yt=0,Qt=0;var Zt=function(e,t,n){var r=t&&n||0,i=t||[],o=(e=e||{}).node||Jt,s=void 0!==e.clockseq?e.clockseq:Wt;if(null==o||null==s){var a=Ht();null==o&&(o=Jt=[1|a[0],a[1],a[2],a[3],a[4],a[5]]),null==s&&(s=Wt=16383&(a[6]<<8|a[7]))}var u=void 0!==e.msecs?e.msecs:(new Date).getTime(),c=void 0!==e.nsecs?e.nsecs:Qt+1,l=u-Yt+(c-Qt)/1e4;if(l<0&&void 0===e.clockseq&&(s=s+1&16383),(l<0||u>Yt)&&void 0===e.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Yt=u,Qt=c,Wt=s;var d=(1e4*(268435455&(u+=122192928e5))+c)%4294967296;i[r++]=d>>>24&255,i[r++]=d>>>16&255,i[r++]=d>>>8&255,i[r++]=255&d;var f=u/4294967296*1e4&268435455;i[r++]=f>>>8&255,i[r++]=255&f,i[r++]=f>>>24&15|16,i[r++]=f>>>16&255,i[r++]=s>>>8|128,i[r++]=255&s;for(var p=0;p<6;++p)i[r+p]=o[p];return t||$t(i)};var Xt=function(e,t,n){var r=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var i=(e=e||{}).random||(e.rng||Ht)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t)for(var o=0;o<16;++o)t[r+o]=i[o];return t||$t(i)},en=Xt;en.v1=Zt,en.v4=Xt;var tn=en,nn=Object.prototype.hasOwnProperty,rn=String.prototype.charAt,on=Object.prototype.toString,sn=function(e,t){return rn.call(e,t)},an=function(e,t){return nn.call(e,t)},un=function(e,t){t=t||an;for(var n=[],r=0,i=e.length;r=36e5?(e/36e5).toFixed(1)+"h":e>=6e4?(e/6e4).toFixed(1)+"m":e>=1e3?(e/1e3|0)+"s":e+"ms"},On.enabled=function(e){for(var t=0,n=On.skips.length;tthis.maxAttempts)},Un.prototype.getDelay=function(e){var t=this.backoff.MIN_RETRY_DELAY*Math.pow(this.backoff.FACTOR,e);if(this.backoff.JITTER){var n=Math.random(),r=Math.floor(n*this.backoff.JITTER*t);Math.floor(10*n)<5?t-=r:t+=r}return Number(Math.min(t,this.backoff.MAX_RETRY_DELAY).toPrecision(1))},Un.prototype.addItem=function(e){this._enqueue({item:e,attemptNumber:0,time:this._schedule.now()})},Un.prototype.requeue=function(e,t,n){this.shouldRetry(e,t,n)?this._enqueue({item:e,attemptNumber:t,time:this._schedule.now()+this.getDelay(t)}):this.emit("discard",e,t)},Un.prototype._enqueue=function(e){var t=this._store.get(this.keys.QUEUE)||[];(t=t.slice(-(this.maxItems-1))).push(e),t=t.sort((function(e,t){return e.time-t.time})),this._store.set(this.keys.QUEUE,t),this._running&&this._processHead()},Un.prototype._processHead=function(){var e=this,t=this._store;this._schedule.cancel(this._processId);var n=t.get(this.keys.QUEUE)||[],r=t.get(this.keys.IN_PROGRESS)||{},i=this._schedule.now(),o=[];function s(n,r){o.push({item:n.item,done:function(i,o){var s=t.get(e.keys.IN_PROGRESS)||{};delete s[r],t.set(e.keys.IN_PROGRESS,s),e.emit("processed",i,o,n.item),i&&e.requeue(n.item,n.attemptNumber+1,i)}})}for(var a=Object.keys(r).length;n.length&&n[0].time<=i&&a++0&&(this._processId=this._schedule.run(this._processHead,n[0].time-i))},Un.prototype._ack=function(){this._store.set(this.keys.ACK,this._schedule.now()),this._store.set(this.keys.RECLAIM_START,null),this._store.set(this.keys.RECLAIM_END,null),this._schedule.run(this._ack,this.timeouts.ACK_TIMER)},Un.prototype._checkReclaim=function(){var e=this;vn((function(t){t.id!==e.id&&(e._schedule.now()-t.get(e.keys.ACK)=500&&o.status<600?(h(new Error("request failed with status: "+o.status+o.statusText+" for url: "+e)),i(new Error("request failed with status: "+o.status+o.statusText+" for url: "+e))):(l.debug("====== request processed successfully: "+o.status),i(null,o.status)))},o.send(JSON.stringify(n,d))}catch(e){i(e)}}},{key:"enqueue",value:function(e,t){var n={"Content-Type":"application/json",Authorization:"Basic "+btoa(this.writeKey+":")},r=e.getElementContent();r.originalTimestamp=p(),r.sentAt=p(),JSON.stringify(r).length>32e3&&l.error("message length greater 32 Kb ",r);var i="/"==this.url.slice(-1)?this.url.slice(0,-1):this.url;this.payloadQueue.addItem({url:i+"/v1/"+t,headers:n,message:r})}}]),e}());function Mn(e){var t=function(t){var n=(t=t||window.event).target||t.srcElement;Gn(n)&&(n=n.parentNode),Fn(n,t)?l.debug("to be tracked ",t.type):l.debug("not to be tracked ",t.type),function(e,t){var n=e.target||e.srcElement,r=void 0;Gn(n)&&(n=n.parentNode);if(Fn(n,e)){if("form"==n.tagName.toLowerCase()){r={};for(var i=0;i-1)return!0}return!1}function zn(e){return!(Hn(e).split(" ").indexOf("rudder-no-track")>=0)}function Jn(e){if(e.previousElementSibling)return e.previousElementSibling;do{e=e.previousSibling}while(e&&!qn(e));return e}var Wn=function(e,t,n){var r=!1;return n=n||$n,i.count=e,0===e?t():i;function i(e,o){if(i.count<=0)throw new Error("after called too many times");--i.count,e?(r=!0,t(e),t=n):0!==i.count||r||t(null,o)}};function $n(){}function Yn(e,t){this.eventRepository||(this.eventRepository=Ln),this.eventRepository.enqueue(e,t)}var Qn=function(){function e(){n(this,e),this.autoTrackHandlersRegistered=!1,this.autoTrackFeatureEnabled=!1,this.initialized=!1,this.trackValues=[],this.eventsBuffer=[],this.clientIntegrations=[],this.configArray=[],this.clientIntegrationObjects=void 0,this.successfullyLoadedIntegration=[],this.failedToBeLoadedIntegration=[],this.toBeProcessedArray=[],this.toBeProcessedByIntegrationArray=[],this.storage=xt,this.userId=null!=this.storage.getUserId()?this.storage.getUserId():"",this.userTraits=null!=this.storage.getUserTraits()?this.storage.getUserTraits():{},this.groupId=null!=this.storage.getGroupId()?this.storage.getGroupId():"",this.groupTraits=null!=this.storage.getGroupTraits()?this.storage.getGroupTraits():{},this.anonymousId=this.getAnonymousId(),this.storage.setUserId(this.userId),this.eventRepository=Ln,this.readyCallback=function(){},this.executeReadyCallback=void 0,this.methodToCallbackMapping={syncPixel:"syncPixelCallback"}}return i(e,[{key:"processResponse",value:function(e,t){try{l.debug("===in process response=== "+e),(t=JSON.parse(t)).source.useAutoTracking&&!this.autoTrackHandlersRegistered&&(this.autoTrackFeatureEnabled=!0,Mn(this),this.autoTrackHandlersRegistered=!0),t.source.destinations.forEach((function(e,t){l.debug("Destination "+t+" Enabled? "+e.enabled+" Type: "+e.destinationDefinition.name+" Use Native SDK? "+e.config.useNativeSDK),e.enabled&&(this.clientIntegrations.push(e.destinationDefinition.name),this.configArray.push(e.config))}),this),this.init(this.clientIntegrations,this.configArray)}catch(e){h(e),l.debug("===handling config BE response processing error==="),l.debug("autoTrackHandlersRegistered",this.autoTrackHandlersRegistered),this.autoTrackFeatureEnabled&&!this.autoTrackHandlersRegistered&&(Mn(this),this.autoTrackHandlersRegistered=!0)}}},{key:"init",value:function(e,t){var n=this,r=this;if(l.debug("supported intgs ",Ut),!e||0==e.length)return this.readyCallback&&this.readyCallback(),void(this.toBeProcessedByIntegrationArray=[]);e.forEach((function(e,i){var o=new(0,Ut[e])(t[i],r);o.init(),l.debug("initializing destination: ",e),n.isInitialized(o).then(n.replayEvents)}))}},{key:"replayEvents",value:function(e){e.successfullyLoadedIntegration.length+e.failedToBeLoadedIntegration.length==e.clientIntegrations.length&&e.toBeProcessedByIntegrationArray.length>0&&(l.debug("===replay events called====",e.successfullyLoadedIntegration.length,e.failedToBeLoadedIntegration.length),e.clientIntegrationObjects=[],e.clientIntegrationObjects=e.successfullyLoadedIntegration,l.debug("==registering after callback===",e.clientIntegrationObjects.length),e.executeReadyCallback=Wn(e.clientIntegrationObjects.length,e.readyCallback),l.debug("==registering ready callback==="),e.on("ready",e.executeReadyCallback),e.clientIntegrationObjects.forEach((function(t){l.debug("===looping over each successful integration===="),t.isReady&&!t.isReady()||(l.debug("===letting know I am ready=====",t.name),e.emit("ready"))})),e.toBeProcessedByIntegrationArray.forEach((function(t){var n=t[0];t.shift();for(var r=t[0].message.integrations,i=0;i1&&void 0!==arguments[1]?arguments[1]:0;return new Promise((function(r){return e.isLoaded()?(l.debug("===integration loaded successfully====",e.name),t.successfullyLoadedIntegration.push(e),r(t)):n>=1e4?(l.debug("====max wait over===="),t.failedToBeLoadedIntegration.push(e),r(t)):void t.pause(1e3).then((function(){return l.debug("====after pause, again checking===="),t.isInitialized(e,n+1e3).then(r)}))}))}},{key:"page",value:function(e,n,r,i,o){"function"==typeof i&&(o=i,i=null),"function"==typeof r&&(o=r,i=r=null),"function"==typeof n&&(o=n,i=r=n=null),"object"===t(e)&&(i=n,r=e,n=e=null),"object"===t(n)&&(i=r,r=n,n=null),"string"==typeof e&&"string"!=typeof n&&(n=e,e=null),this.processPage(e,n,r,i,o)}},{key:"track",value:function(e,t,n,r){"function"==typeof n&&(r=n,n=null),"function"==typeof t&&(r=t,n=null,t=null),this.processTrack(e,t,n,r)}},{key:"identify",value:function(e,n,r,i){"function"==typeof r&&(i=r,r=null),"function"==typeof n&&(i=n,r=null,n=null),"object"==t(e)&&(r=n,n=e,e=this.userId),this.processIdentify(e,n,r,i)}},{key:"alias",value:function(e,n,r,i){"function"==typeof r&&(i=r,r=null),"function"==typeof n&&(i=n,r=null,n=null),"object"==t(n)&&(r=n,n=null);var o=(new qt).setType("alias").build();o.message.previousId=n||this.userId?this.userId:this.getAnonymousId(),o.message.userId=e,this.processAndSendDataToDestinations("alias",o,r,i)}},{key:"group",value:function(e,n,r,i){if(arguments.length){"function"==typeof r&&(i=r,r=null),"function"==typeof n&&(i=n,r=null,n=null),"object"==t(e)&&(r=n,n=e,e=this.groupId),this.groupId=e,this.storage.setGroupId(this.groupId);var o=(new qt).setType("group").build();if(n)for(var s in n)this.groupTraits[s]=n[s];else this.groupTraits={};this.storage.setGroupTraits(this.groupTraits),this.processAndSendDataToDestinations("group",o,r,i)}}},{key:"processPage",value:function(e,t,n,r,i){var o=(new qt).setType("page").build();t&&(o.message.name=t),n||(n={}),e&&(n.category=e),n&&(o.message.properties=this.getPageProperties(n)),this.trackPage(o,r,i)}},{key:"processTrack",value:function(e,t,n,r){var i=(new qt).setType("track").build();e&&i.setEventName(e),t?i.setProperty(t):i.setProperty({}),this.trackEvent(i,n,r)}},{key:"processIdentify",value:function(e,t,n,r){e&&this.userId&&e!==this.userId&&this.reset(),this.userId=e,this.storage.setUserId(this.userId);var i=(new qt).setType("identify").build();if(t){for(var o in t)this.userTraits[o]=t[o];this.storage.setUserTraits(this.userTraits)}this.identifyUser(i,n,r)}},{key:"identifyUser",value:function(e,t,n){e.message.userId&&(this.userId=e.message.userId,this.storage.setUserId(this.userId)),e&&e.message&&e.message.context&&e.message.context.traits&&(this.userTraits=Object.assign({},e.message.context.traits),this.storage.setUserTraits(this.userTraits)),this.processAndSendDataToDestinations("identify",e,t,n)}},{key:"trackPage",value:function(e,t,n){this.processAndSendDataToDestinations("page",e,t,n)}},{key:"trackEvent",value:function(e,t,n){this.processAndSendDataToDestinations("track",e,t,n)}},{key:"processAndSendDataToDestinations",value:function(e,t,n,r){try{this.anonymousId||this.setAnonymousId(),t.message.context.page=g(),t.message.context.traits=Object.assign({},this.userTraits),l.debug("anonymousId: ",this.anonymousId),t.message.anonymousId=this.anonymousId,t.message.userId=t.message.userId?t.message.userId:this.userId,"group"==e&&(this.groupId&&(t.message.groupId=this.groupId),this.groupTraits&&(t.message.traits=Object.assign({},this.groupTraits))),n&&this.processOptionsParam(t,n),l.debug(JSON.stringify(t));var i=t.message.integrations;this.clientIntegrationObjects&&this.clientIntegrationObjects.forEach((function(n){l.debug("called in normal flow"),(i[n.name]||null==i[n.name]&&i.All)&&(n.isFailed&&n.isFailed()||n[e](t))})),this.clientIntegrationObjects||(l.debug("pushing in replay queue"),this.toBeProcessedByIntegrationArray.push([e,t])),Yn.call(this,t,e),l.debug(e+" is called "),r&&r()}catch(e){h(e)}}},{key:"processOptionsParam",value:function(e,t){var n=["integrations","anonymousId","originalTimestamp"];for(var r in t)if(n.includes(r))e.message[r]=t[r];else if("context"!==r)e.message.context[r]=t[r];else for(var i in t[r])e.message.context[i]=t[r][i]}},{key:"getPageProperties",value:function(e){var t=g();for(var n in t)void 0===e[n]&&(e[n]=t[n]);return e}},{key:"reset",value:function(){this.userId="",this.userTraits={},this.anonymousId=this.setAnonymousId(),this.storage.clear()}},{key:"getAnonymousId",value:function(){return this.anonymousId=this.storage.getAnonymousId(),this.anonymousId||this.setAnonymousId(),this.anonymousId}},{key:"setAnonymousId",value:function(e){this.anonymousId=e||f(),this.storage.setAnonymousId(this.anonymousId)}},{key:"load",value:function(e,t,n){var r="https://api.rudderlabs.com/sourceConfig";if(!e||!t||0==t.length)throw h({message:"Unable to load due to wrong writeKey or serverUrl"}),Error("failed to initialize");n&&n.logLevel&&l.setLogLevel(n.logLevel),n&&n.configUrl&&(r=n.configUrl),l.debug("inside load "),this.eventRepository.writeKey=e,t&&(this.eventRepository.url=t),n&&n.valTrackingList&&n.valTrackingList.push==Array.prototype.push&&(this.trackValues=n.valTrackingList),n&&n.useAutoTracking&&(this.autoTrackFeatureEnabled=!0,this.autoTrackFeatureEnabled&&!this.autoTrackHandlersRegistered&&(Mn(this),this.autoTrackHandlersRegistered=!0,l.debug("autoTrackHandlersRegistered",this.autoTrackHandlersRegistered)));try{!function(e,t,n,r){var i,o=r.bind(e);(i=new XMLHttpRequest).open("GET",t,!0),i.setRequestHeader("Authorization","Basic "+btoa(n+":")),i.onload=function(){var e=i.status;200==e?(l.debug("status 200 calling callback"),o(200,i.responseText)):(h(new Error("request failed with status: "+i.status+" for url: "+t)),o(e))},i.send()}(this,r,e,this.processResponse)}catch(e){h(e),this.autoTrackFeatureEnabled&&!this.autoTrackHandlersRegistered&&Mn(Zn)}}},{key:"ready",value:function(e){"function"!=typeof e?l.error("ready callback is not a function"):this.readyCallback=e}},{key:"registerCallbacks",value:function(){var e=this;Object.keys(this.methodToCallbackMapping).forEach((function(t){if(e.methodToCallbackMapping.hasOwnProperty(t)){var n=window.rudderanalytics&&"function"==typeof window.rudderanalytics[e.methodToCallbackMapping[t]]?window.rudderanalytics[e.methodToCallbackMapping[t]]:function(){};l.debug("registerCallbacks",t,n),e.on(t,n)}}))}}]),e}();window.addEventListener("error",(function(e){h(e)}),!0);var Zn=new Qn;jn(Zn),Zn.registerCallbacks();var Xn=!!window.rudderanalytics&&window.rudderanalytics.push==Array.prototype.push,er=window.rudderanalytics?window.rudderanalytics[0]:[];if(er.length>0&&"load"==er[0]){var tr=er[0];er.shift(),l.debug("=====from init, calling method:: ",tr),Zn[tr].apply(Zn,u(er))}if(Xn){for(var nr=1;nr ["co.uk", "google.co.uk", "www.google.co.uk"] + * @param {String|Number} val + * @param {Object} options + * @return {String|Number} + * @api public + */ + + var ms$1 = function(val, options){ + options = options || {}; + if ('string' == typeof val) return parse$2(val); + return options.long + ? long$1(val) + : short$1(val); + }; + + /** + * Parse the given `str` and return milliseconds. * - * Example: + * @param {String} str + * @return {Number} + * @api private + */ + + function parse$2(str) { + str = '' + str; + if (str.length > 10000) return; + var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str); + if (!match) return; + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y$1; + case 'days': + case 'day': + case 'd': + return n * d$1; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h$1; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m$1; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s$1; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + } + } + + /** + * Short format for `ms`. * - * domain('http://localhost:3000/baz'); - * // => '' - * domain('http://dev:3000/baz'); - * // => '' - * domain('http://127.0.0.1:3000/baz'); - * // => '' - * domain('http://segment.io/baz'); - * // => 'segment.io' + * @param {Number} ms + * @return {String} + * @api private + */ + + function short$1(ms) { + if (ms >= d$1) return Math.round(ms / d$1) + 'd'; + if (ms >= h$1) return Math.round(ms / h$1) + 'h'; + if (ms >= m$1) return Math.round(ms / m$1) + 'm'; + if (ms >= s$1) return Math.round(ms / s$1) + 's'; + return ms + 'ms'; + } + + /** + * Long format for `ms`. * - * @param {string} url - * @return {string} - * @api public + * @param {Number} ms + * @return {String} + * @api private */ - function domain(url) { - var cookie = exports.cookie; - var levels = exports.levels(url); - // Lookup the real top level one. - for (var i = 0; i < levels.length; ++i) { - var cname = '__tld__'; - var domain = levels[i]; - var opts = { domain: '.' + domain }; + function long$1(ms) { + return plural$1(ms, d$1, 'day') + || plural$1(ms, h$1, 'hour') + || plural$1(ms, m$1, 'minute') + || plural$1(ms, s$1, 'second') + || ms + ' ms'; + } - cookie(cname, 1, opts); - if (cookie(cname)) { - cookie(cname, null, opts); - return domain; - } - } + /** + * Pluralization helper. + */ - return ''; + function plural$1(ms, n, name) { + if (ms < n) return; + if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name; + return Math.ceil(ms / n) + ' ' + name + 's'; } + var debug_1$1 = createCommonjsModule(function (module, exports) { /** - * Levels returns all levels of the given url. + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. * - * @param {string} url - * @return {Array} - * @api public + * Expose `debug()` as the module. */ - domain.levels = function(url) { - var host = parse(url).hostname; - var parts = host.split('.'); - var last = parts[parts.length - 1]; - var levels = []; - // Ip address. - if (parts.length === 4 && last === parseInt(last, 10)) { - return levels; - } + exports = module.exports = debug; + exports.coerce = coerce; + exports.disable = disable; + exports.enable = enable; + exports.enabled = enabled; + exports.humanize = ms$1; - // Localhost. - if (parts.length <= 1) { - return levels; - } + /** + * The currently active debug mode names, and names to skip. + */ - // Create levels. - for (var i = parts.length - 2; i >= 0; --i) { - levels.push(parts.slice(i).join('.')); - } + exports.names = []; + exports.skips = []; - return levels; - }; + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lowercased letter, i.e. "n". + */ + + exports.formatters = {}; /** - * Expose cookie on domain. + * Previously assigned color. */ - domain.cookie = componentCookie; - /* - * Exports. + var prevColor = 0; + + /** + * Previous log timestamp. */ - exports = module.exports = domain; - }); + var prevTime; /** - * An object utility to persist values in cookies + * Select a color. + * + * @return {Number} + * @api private */ - var CookieLocal = - /*#__PURE__*/ - function () { - function CookieLocal(options) { - _classCallCheck(this, CookieLocal); + function selectColor() { + return exports.colors[prevColor++ % exports.colors.length]; + } - this._options = {}; - this.options(options); + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + + function debug(namespace) { + + // define the `disabled` version + function disabled() { } - /** - * - * @param {*} options - */ + disabled.enabled = false; + // define the `enabled` version + function enabled() { - _createClass(CookieLocal, [{ - key: "options", - value: function options() { - var _options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + var self = enabled; - if (arguments.length === 0) return this._options; - var domain = "." + lib(window.location.href); - if (domain === ".") domain = null; // the default maxage and path + // set `diff` timestamp + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; - this._options = defaults_1(_options, { - maxage: 31536000000, - path: "/", - domain: domain - }); //try setting a cookie first + // add the `color` if not set + if (null == self.useColors) self.useColors = exports.useColors(); + if (null == self.color && self.useColors) self.color = selectColor(); - this.set("test_rudder", true); + var args = Array.prototype.slice.call(arguments); - if (!this.get("test_rudder")) { - this._options.domain = null; - } + args[0] = exports.coerce(args[0]); - this.remove("test_rudder"); + if ('string' !== typeof args[0]) { + // anything else let's inspect with %o + args = ['%o'].concat(args); } - /** - * - * @param {*} key - * @param {*} value - */ + + // apply any `formatters` transformations + var index = 0; + args[0] = args[0].replace(/%([a-z%])/g, function(match, format) { + // if we encounter an escaped % then don't increase the array index + if (match === '%%') return match; + index++; + var formatter = exports.formatters[format]; + if ('function' === typeof formatter) { + var val = args[index]; + match = formatter.call(self, val); + + // now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + if ('function' === typeof exports.formatArgs) { + args = exports.formatArgs.apply(self, args); + } + var logFn = enabled.log || exports.log || console.log.bind(console); + logFn.apply(self, args); + } + enabled.enabled = true; + + var fn = exports.enabled(namespace) ? enabled : disabled; + + fn.namespace = namespace; + + return fn; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + + function enable(namespaces) { + exports.save(namespaces); + + var split = (namespaces || '').split(/[\s,]+/); + var len = split.length; + + for (var i = 0; i < len; i++) { + if (!split[i]) continue; // ignore empty strings + namespaces = split[i].replace(/\*/g, '.*?'); + if (namespaces[0] === '-') { + exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + exports.names.push(new RegExp('^' + namespaces + '$')); + } + } + } + + /** + * Disable debug output. + * + * @api public + */ + + function disable() { + exports.enable(''); + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + + function enabled(name) { + var i, len; + for (i = 0, len = exports.skips.length; i < len; i++) { + if (exports.skips[i].test(name)) { + return false; + } + } + for (i = 0, len = exports.names.length; i < len; i++) { + if (exports.names[i].test(name)) { + return true; + } + } + return false; + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + + function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; + } + }); + var debug_2$1 = debug_1$1.coerce; + var debug_3$1 = debug_1$1.disable; + var debug_4$1 = debug_1$1.enable; + var debug_5$1 = debug_1$1.enabled; + var debug_6$1 = debug_1$1.humanize; + var debug_7$1 = debug_1$1.names; + var debug_8$1 = debug_1$1.skips; + var debug_9$1 = debug_1$1.formatters; + + var browser$1 = createCommonjsModule(function (module, exports) { + /** + * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + + exports = module.exports = debug_1$1; + exports.log = log; + exports.formatArgs = formatArgs; + exports.save = save; + exports.load = load; + exports.useColors = useColors; + exports.storage = 'undefined' != typeof chrome + && 'undefined' != typeof chrome.storage + ? chrome.storage.local + : localstorage(); + + /** + * Colors. + */ + + exports.colors = [ + 'lightseagreen', + 'forestgreen', + 'goldenrod', + 'dodgerblue', + 'darkorchid', + 'crimson' + ]; + + /** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + + function useColors() { + // is webkit? http://stackoverflow.com/a/16459606/376773 + return ('WebkitAppearance' in document.documentElement.style) || + // is firebug? http://stackoverflow.com/a/398120/376773 + (window.console && (console.firebug || (console.exception && console.table))) || + // is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31); + } + + /** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + + exports.formatters.j = function(v) { + return JSON.stringify(v); + }; + + + /** + * Colorize log arguments if enabled. + * + * @api public + */ + + function formatArgs() { + var args = arguments; + var useColors = this.useColors; + + args[0] = (useColors ? '%c' : '') + + this.namespace + + (useColors ? ' %c' : ' ') + + args[0] + + (useColors ? '%c ' : ' ') + + '+' + exports.humanize(this.diff); + + if (!useColors) return args; + + var c = 'color: ' + this.color; + args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1)); + + // the final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + var index = 0; + var lastC = 0; + args[0].replace(/%[a-z%]/g, function(match) { + if ('%%' === match) return; + index++; + if ('%c' === match) { + // we only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); + return args; + } + + /** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ + + function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === typeof console + && console.log + && Function.prototype.apply.call(console.log, console, arguments); + } + + /** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ + + function save(namespaces) { + try { + if (null == namespaces) { + exports.storage.removeItem('debug'); + } else { + exports.storage.debug = namespaces; + } + } catch(e) {} + } + + /** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + + function load() { + var r; + try { + r = exports.storage.debug; + } catch(e) {} + return r; + } + + /** + * Enable namespaces listed in `localStorage.debug` initially. + */ + + exports.enable(load()); + + /** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + + function localstorage(){ + try { + return window.localStorage; + } catch (e) {} + } + }); + var browser_1$1 = browser$1.log; + var browser_2$1 = browser$1.formatArgs; + var browser_3$1 = browser$1.save; + var browser_4$1 = browser$1.load; + var browser_5$1 = browser$1.useColors; + var browser_6$1 = browser$1.storage; + var browser_7$1 = browser$1.colors; + + /** + * Module dependencies. + */ + + var debug$1 = browser$1('cookie'); + + /** + * Set or get cookie `name` with `value` and `options` object. + * + * @param {String} name + * @param {String} value + * @param {Object} options + * @return {Mixed} + * @api public + */ + + var componentCookie = function(name, value, options){ + switch (arguments.length) { + case 3: + case 2: + return set$1(name, value, options); + case 1: + return get$2(name); + default: + return all$1(); + } + }; + + /** + * Set cookie `name` to `value`. + * + * @param {String} name + * @param {String} value + * @param {Object} options + * @api private + */ + + function set$1(name, value, options) { + options = options || {}; + var str = encode$1(name) + '=' + encode$1(value); + + if (null == value) options.maxage = -1; + + if (options.maxage) { + options.expires = new Date(+new Date + options.maxage); + } + + if (options.path) str += '; path=' + options.path; + if (options.domain) str += '; domain=' + options.domain; + if (options.expires) str += '; expires=' + options.expires.toUTCString(); + if (options.secure) str += '; secure'; + if (options.samesite) str += '; samesite=' + options.samesite; + + document.cookie = str; + } + + /** + * Return all cookies. + * + * @return {Object} + * @api private + */ + + function all$1() { + var str; + try { + str = document.cookie; + } catch (err) { + if (typeof console !== 'undefined' && typeof console.error === 'function') { + console.error(err.stack || err); + } + return {}; + } + return parse$3(str); + } + + /** + * Get cookie `name`. + * + * @param {String} name + * @return {String} + * @api private + */ + + function get$2(name) { + return all$1()[name]; + } + + /** + * Parse cookie `str`. + * + * @param {String} str + * @return {Object} + * @api private + */ + + function parse$3(str) { + var obj = {}; + var pairs = str.split(/ *; */); + var pair; + if ('' == pairs[0]) return obj; + for (var i = 0; i < pairs.length; ++i) { + pair = pairs[i].split('='); + obj[decode$1(pair[0])] = decode$1(pair[1]); + } + return obj; + } + + /** + * Encode. + */ + + function encode$1(value){ + try { + return encodeURIComponent(value); + } catch (e) { + debug$1('error `encode(%o)` - %o', value, e); + } + } + + /** + * Decode. + */ + + function decode$1(value) { + try { + return decodeURIComponent(value); + } catch (e) { + debug$1('error `decode(%o)` - %o', value, e); + } + } + + var lib = createCommonjsModule(function (module, exports) { + + /** + * Module dependencies. + */ + + var parse = componentUrl.parse; + + + /** + * Get the top domain. + * + * The function constructs the levels of domain and attempts to set a global + * cookie on each one when it succeeds it returns the top level domain. + * + * The method returns an empty string when the hostname is an ip or `localhost`. + * + * Example levels: + * + * domain.levels('http://www.google.co.uk'); + * // => ["co.uk", "google.co.uk", "www.google.co.uk"] + * + * Example: + * + * domain('http://localhost:3000/baz'); + * // => '' + * domain('http://dev:3000/baz'); + * // => '' + * domain('http://127.0.0.1:3000/baz'); + * // => '' + * domain('http://segment.io/baz'); + * // => 'segment.io' + * + * @param {string} url + * @return {string} + * @api public + */ + function domain(url) { + var cookie = exports.cookie; + var levels = exports.levels(url); + + // Lookup the real top level one. + for (var i = 0; i < levels.length; ++i) { + var cname = '__tld__'; + var domain = levels[i]; + var opts = { domain: '.' + domain }; + + cookie(cname, 1, opts); + if (cookie(cname)) { + cookie(cname, null, opts); + return domain; + } + } + + return ''; + } + + /** + * Levels returns all levels of the given url. + * + * @param {string} url + * @return {Array} + * @api public + */ + domain.levels = function(url) { + var host = parse(url).hostname; + var parts = host.split('.'); + var last = parts[parts.length - 1]; + var levels = []; + + // Ip address. + if (parts.length === 4 && last === parseInt(last, 10)) { + return levels; + } + + // Localhost. + if (parts.length <= 1) { + return levels; + } + + // Create levels. + for (var i = parts.length - 2; i >= 0; --i) { + levels.push(parts.slice(i).join('.')); + } + + return levels; + }; + + /** + * Expose cookie on domain. + */ + domain.cookie = componentCookie; + + /* + * Exports. + */ + + exports = module.exports = domain; + }); + + /** + * An object utility to persist values in cookies + */ + + var CookieLocal = + /*#__PURE__*/ + function () { + function CookieLocal(options) { + _classCallCheck(this, CookieLocal); + + this._options = {}; + this.options(options); + } + /** + * + * @param {*} options + */ + + + _createClass(CookieLocal, [{ + key: "options", + value: function options() { + var _options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + if (arguments.length === 0) return this._options; + var domain = "." + lib(window.location.href); + if (domain === ".") domain = null; // the default maxage and path + + this._options = defaults_1(_options, { + maxage: 31536000000, + path: "/", + domain: domain, + samesite: "Lax" + }); //try setting a cookie first + + this.set("test_rudder", true); + + if (!this.get("test_rudder")) { + this._options.domain = null; + } + + this.remove("test_rudder"); + } + /** + * + * @param {*} key + * @param {*} value + */ }, { key: "set", value: function set(key, value) { try { value = json3.stringify(value); - componentCookie(key, value, clone_1(this._options)); + rudderComponentCookie(key, value, clone_1(this._options)); return true; } catch (e) { return false; @@ -6322,7 +6977,7 @@ var rudderanalytics = (function (exports) { key: "get", value: function get(key) { try { - var value = componentCookie(key); + var value = rudderComponentCookie(key); value = value ? json3.parse(value) : null; return value; } catch (e) { @@ -6338,7 +6993,7 @@ var rudderanalytics = (function (exports) { key: "remove", value: function remove(key) { try { - componentCookie(key, null, clone_1(this._options)); + rudderComponentCookie(key, null, clone_1(this._options)); return true; } catch (e) { return false; @@ -6822,12 +7477,13 @@ var rudderanalytics = (function (exports) { var Lotame = /*#__PURE__*/ function () { - function Lotame(config) { + function Lotame(config, analytics) { var _this = this; _classCallCheck(this, Lotame); this.name = "LOTAME"; + this.analytics = analytics; this.storage = lotameStorage; this.bcpUrlSettings = config.bcpUrlSettings; this.dspUrlSettings = config.dspUrlSettings; @@ -6856,11 +7512,11 @@ var rudderanalytics = (function (exports) { document.getElementsByTagName("body")[0].appendChild(image); } }, { - key: "synchPixel", - value: function synchPixel(userId) { + key: "syncPixel", + value: function syncPixel(userId) { var _this2 = this; - logger.debug("===== in synchPixel ======"); + logger.debug("===== in syncPixel ======"); if (this.dspUrlSettings && this.dspUrlSettings.length > 0) { this.dspUrlSettings.forEach(function (urlSettings) { @@ -6872,11 +7528,12 @@ var rudderanalytics = (function (exports) { }); } - this.storage.setLotameSynchTime(Date.now()); // this is custom to lotame, can be thought of as additional feature + this.storage.setLotameSynchTime(Date.now()); // emit on syncPixel - if (window.LOTAME_SYNCH_CALLBACK && typeof window.LOTAME_SYNCH_CALLBACK == "function") { - logger.debug("===== in synchPixel callback======"); - window.LOTAME_SYNCH_CALLBACK(); + if (this.analytics.methodToCallbackMapping["syncPixel"]) { + this.analytics.emit("syncPixel", { + destination: this.name + }); } } }, { @@ -6896,7 +7553,7 @@ var rudderanalytics = (function (exports) { value: function identify(rudderElement) { logger.debug("in Lotame identify"); var userId = rudderElement.message.userId; - this.synchPixel(userId); + this.syncPixel(userId); } }, { key: "track", @@ -6919,7 +7576,7 @@ var rudderanalytics = (function (exports) { } if (rudderElement.message.userId && this.isPixelToBeSynched()) { - this.synchPixel(rudderElement.message.userId); + this.syncPixel(rudderElement.message.userId); } } }, { @@ -8022,7 +8679,7 @@ var rudderanalytics = (function (exports) { * Expose `debug()` as the module. */ - var debug_1$1 = debug$1; + var debug_1$2 = debug$2; /** * Create a debugger with the given `name`. @@ -8032,20 +8689,20 @@ var rudderanalytics = (function (exports) { * @api public */ - function debug$1(name) { - if (!debug$1.enabled(name)) return function(){}; + function debug$2(name) { + if (!debug$2.enabled(name)) return function(){}; return function(fmt){ fmt = coerce(fmt); var curr = new Date; - var ms = curr - (debug$1[name] || curr); - debug$1[name] = curr; + var ms = curr - (debug$2[name] || curr); + debug$2[name] = curr; fmt = name + ' ' + fmt - + ' +' + debug$1.humanize(ms); + + ' +' + debug$2.humanize(ms); // This hackery is required for IE8 // where `console.log` doesn't have 'apply' @@ -8059,8 +8716,8 @@ var rudderanalytics = (function (exports) { * The currently active debug mode names. */ - debug$1.names = []; - debug$1.skips = []; + debug$2.names = []; + debug$2.skips = []; /** * Enables a debug mode by name. This can include modes @@ -8070,7 +8727,7 @@ var rudderanalytics = (function (exports) { * @api public */ - debug$1.enable = function(name) { + debug$2.enable = function(name) { try { localStorage.debug = name; } catch(e){} @@ -8081,10 +8738,10 @@ var rudderanalytics = (function (exports) { for (var i = 0; i < len; i++) { name = split[i].replace('*', '.*?'); if (name[0] === '-') { - debug$1.skips.push(new RegExp('^' + name.substr(1) + '$')); + debug$2.skips.push(new RegExp('^' + name.substr(1) + '$')); } else { - debug$1.names.push(new RegExp('^' + name + '$')); + debug$2.names.push(new RegExp('^' + name + '$')); } } }; @@ -8095,8 +8752,8 @@ var rudderanalytics = (function (exports) { * @api public */ - debug$1.disable = function(){ - debug$1.enable(''); + debug$2.disable = function(){ + debug$2.enable(''); }; /** @@ -8107,7 +8764,7 @@ var rudderanalytics = (function (exports) { * @api private */ - debug$1.humanize = function(ms) { + debug$2.humanize = function(ms) { var sec = 1000 , min = 60 * 1000 , hour = 60 * min; @@ -8126,14 +8783,14 @@ var rudderanalytics = (function (exports) { * @api public */ - debug$1.enabled = function(name) { - for (var i = 0, len = debug$1.skips.length; i < len; i++) { - if (debug$1.skips[i].test(name)) { + debug$2.enabled = function(name) { + for (var i = 0, len = debug$2.skips.length; i < len; i++) { + if (debug$2.skips[i].test(name)) { return false; } } - for (var i = 0, len = debug$1.names.length; i < len; i++) { - if (debug$1.names[i].test(name)) { + for (var i = 0, len = debug$2.names.length; i < len; i++) { + if (debug$2.names[i].test(name)) { return true; } } @@ -8152,7 +8809,7 @@ var rudderanalytics = (function (exports) { // persist try { - if (window.localStorage) debug$1.enable(localStorage.debug); + if (window.localStorage) debug$2.enable(localStorage.debug); } catch(e){} var componentEmitter = createCommonjsModule(function (module) { @@ -8335,7 +8992,7 @@ var rudderanalytics = (function (exports) { - var debug$2 = debug_1$1('localstorage-retry'); + var debug$3 = debug_1$2('localstorage-retry'); // Some browsers don't support Function.prototype.bind, so just including a simplified version here @@ -8566,7 +9223,7 @@ var rudderanalytics = (function (exports) { try { self.fn(el.item, el.done); } catch (err) { - debug$2('Process function threw error: ' + err); + debug$3('Process function threw error: ' + err); } }, toRun); @@ -9222,6 +9879,9 @@ var rudderanalytics = (function (exports) { this.readyCallback = function () {}; this.executeReadyCallback = undefined; + this.methodToCallbackMapping = { + syncPixel: "syncPixelCallback" + }; } /** * Process the response from control plane and @@ -9306,13 +9966,19 @@ var rudderanalytics = (function (exports) { }, { key: "replayEvents", value: function replayEvents(object) { - if (object.successfullyLoadedIntegration.length + object.failedToBeLoadedIntegration.length == object.clientIntegrations.length) { + if (object.successfullyLoadedIntegration.length + object.failedToBeLoadedIntegration.length == object.clientIntegrations.length && object.toBeProcessedByIntegrationArray.length > 0) { + logger.debug("===replay events called====", object.successfullyLoadedIntegration.length, object.failedToBeLoadedIntegration.length); object.clientIntegrationObjects = []; object.clientIntegrationObjects = object.successfullyLoadedIntegration; + logger.debug("==registering after callback===", object.clientIntegrationObjects.length); object.executeReadyCallback = after_1(object.clientIntegrationObjects.length, object.readyCallback); + logger.debug("==registering ready callback==="); object.on("ready", object.executeReadyCallback); object.clientIntegrationObjects.forEach(function (intg) { + logger.debug("===looping over each successful integration===="); + if (!intg["isReady"] || intg["isReady"]()) { + logger.debug("===letting know I am ready=====", intg["name"]); object.emit("ready"); } }); //send the queued events to the fetched integration @@ -9354,6 +10020,8 @@ var rudderanalytics = (function (exports) { var time = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; return new Promise(function (resolve) { if (instance.isLoaded()) { + logger.debug("===integration loaded successfully====", instance["name"]); + _this2.successfullyLoadedIntegration.push(instance); return resolve(_this2); @@ -9368,6 +10036,7 @@ var rudderanalytics = (function (exports) { } _this2.pause(INTEGRATION_LOAD_CHECK_INTERVAL).then(function () { + logger.debug("====after pause, again checking===="); return _this2.isInitialized(instance, time + INTEGRATION_LOAD_CHECK_INTERVAL).then(resolve); }); }); @@ -9830,6 +10499,20 @@ var rudderanalytics = (function (exports) { logger.error("ready callback is not a function"); } + }, { + key: "registerCallbacks", + value: function registerCallbacks() { + var _this3 = this; + + Object.keys(this.methodToCallbackMapping).forEach(function (methodName) { + if (_this3.methodToCallbackMapping.hasOwnProperty(methodName)) { + var callback = !!window.rudderanalytics ? typeof window.rudderanalytics[_this3.methodToCallbackMapping[methodName]] == "function" ? window.rudderanalytics[_this3.methodToCallbackMapping[methodName]] : function () {} : function () {}; + logger.debug("registerCallbacks", methodName, callback); + + _this3.on(methodName, callback); + } + }); + } }]); return Analytics; @@ -9845,12 +10528,15 @@ var rudderanalytics = (function (exports) { componentEmitter(instance); { + // register supported callbacks + instance.registerCallbacks(); var eventsPushedAlready = !!window.rudderanalytics && window.rudderanalytics.push == Array.prototype.push; var methodArg = window.rudderanalytics ? window.rudderanalytics[0] : []; if (methodArg.length > 0 && methodArg[0] == "load") { var method = methodArg[0]; methodArg.shift(); + logger.debug("=====from init, calling method:: ", method); instance[method].apply(instance, _toConsumableArray(methodArg)); } @@ -9864,6 +10550,7 @@ var rudderanalytics = (function (exports) { var _method = event[0]; event.shift(); + logger.debug("=====from init, calling method:: ", _method); instance[_method].apply(instance, _toConsumableArray(event)); }